MCPcopy Create free account
hub / github.com/anomalyco/opencode / makeQueryOptionsApi

Function makeQueryOptionsApi

packages/app/src/context/server-sync.tsx:80–99  ·  view source on GitHub ↗
(
  scope: ServerScope,
  serverSDK: () => OpencodeClient,
  sdkFor: (dir: PathKey) => OpencodeClient,
)

Source from the content-addressed store, hash-verified

78 })
79
80function makeQueryOptionsApi(
81 scope: ServerScope,
82 serverSDK: () => OpencodeClient,
83 sdkFor: (dir: PathKey) => OpencodeClient,
84) {
85 return {
86 globalConfig: () => loadGlobalConfigQuery(scope, serverSDK()),
87 projects: () => loadProjectsQuery(scope, serverSDK()),
88 providers: (directory: PathKey | null) =>
89 loadProvidersQuery(scope, directory, directory === null ? serverSDK() : sdkFor(directory)),
90 path: (directory: PathKey | null) =>
91 loadPathQuery(scope, directory, directory === null ? serverSDK() : sdkFor(directory)),
92 agents: (directory: PathKey) => loadAgentsQuery(scope, directory, sdkFor(directory)),
93 references: (directory: PathKey) => loadReferencesQuery(scope, directory, sdkFor(directory)),
94 mcp: (directory: PathKey) => loadMcpQuery(scope, directory, sdkFor(directory)),
95 mcpResources: (directory: PathKey) => loadMcpResourcesQuery(scope, directory, sdkFor(directory)),
96 lsp: (directory: PathKey) => loadLspQuery(scope, directory, sdkFor(directory)),
97 sessions: (directory: PathKey) => ({ queryKey: [scope, directory, "loadSessions"] as const }),
98 }
99}
100export type QueryOptionsApi = ReturnType<typeof makeQueryOptionsApi>
101
102export function createServerSyncContextInner(serverSDK: ServerSDK) {

Callers 1

Calls 11

loadGlobalConfigQueryFunction · 0.90
loadProjectsQueryFunction · 0.90
loadProvidersQueryFunction · 0.90
loadPathQueryFunction · 0.90
loadAgentsQueryFunction · 0.90
loadReferencesQueryFunction · 0.90
sdkForFunction · 0.85
loadMcpQueryFunction · 0.85
loadMcpResourcesQueryFunction · 0.85
loadLspQueryFunction · 0.85
serverSDKFunction · 0.70

Tested by

no test coverage detected