MCPcopy
hub / github.com/anomalyco/opencode / client

Function client

packages/opencode/test/server/httpapi-sdk.test.ts:60–82  ·  view source on GitHub ↗
(
  serverPath: ServerPath,
  directory?: string,
  input?: {
    password?: string
    username?: string
    headers?: Record<string, string>
    workspaceID?: string
    onRequest?: (request: Request) => void
  },
)

Source from the content-addressed store, hash-verified

58type TestScope = Scope.Scope | TestServices
59
60function client(
61 serverPath: ServerPath,
62 directory?: string,
63 input?: {
64 password?: string
65 username?: string
66 headers?: Record<string, string>
67 workspaceID?: string
68 onRequest?: (request: Request) => void
69 },
70) {
71 return serverFetch(serverPath, input).pipe(
72 Effect.map((fetch) =>
73 createOpencodeClient({
74 baseUrl: "http://localhost",
75 directory,
76 experimental_workspaceID: input?.workspaceID,
77 headers: input?.headers,
78 fetch,
79 }),
80 ),
81 )
82}
83
84function serverFetch(
85 serverPath: ServerPath,

Callers 3

httpapiInstanceFunction · 0.70
withProjectFunction · 0.70

Calls 2

createOpencodeClientFunction · 0.90
serverFetchFunction · 0.85

Tested by

no test coverage detected