@opencode/client 0.0.0-dev-21599 → 0.0.0-dev-21612

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/chunks/{service-timing-y2etg5bs.js → service-timing-7f0py9js.js} +2 -2
  2. package/dist/chunks/{service-timing-ezt8t3fk.js → service-timing-c46qzyff.js} +2 -2
  3. package/dist/chunks/{service-timing-61wt4y9h.js → service-timing-g9ajxfy0.js} +1 -1
  4. package/dist/chunks/{service-timing-7j6qs0tw.js → service-timing-g9wej58t.js} +15 -15
  5. package/dist/chunks/{service-timing-nwcpakzx.js → service-timing-js54wxgp.js} +2 -2
  6. package/dist/chunks/{service-timing-bd9wd9zc.js → service-timing-ka0wmgdp.js} +10 -10
  7. package/dist/chunks/{service-timing-15p82y03.js → service-timing-myz4ngx9.js} +3 -3
  8. package/dist/chunks/{service-timing-g22sa7qz.js → service-timing-q4a98k9r.js} +29 -18
  9. package/dist/chunks/{service-timing-6vp15eh6.js → service-timing-skhp7hxc.js} +1 -1
  10. package/dist/chunks/{service-timing-f0mehgdh.js → service-timing-wwnmjcfr.js} +14 -9
  11. package/dist/effect/api/api.d.ts +16 -1
  12. package/dist/effect/client.d.ts +673 -670
  13. package/dist/effect/client.js +9 -9
  14. package/dist/effect/generated/client-error.js +3 -3
  15. package/dist/effect/generated/client.d.ts +452 -449
  16. package/dist/effect/generated/client.js +4 -4
  17. package/dist/effect/generated/index.js +6 -6
  18. package/dist/effect/index.js +8 -8
  19. package/dist/effect/rpc.js +3 -3
  20. package/dist/effect/service.js +1 -1
  21. package/dist/mcp.d.ts +44 -0
  22. package/dist/mcp.js +110 -0
  23. package/dist/promise/client.d.ts +3 -0
  24. package/dist/promise/client.js +9 -9
  25. package/dist/promise/generated/client-error.js +3 -3
  26. package/dist/promise/generated/client.d.ts +4 -1
  27. package/dist/promise/generated/client.js +4 -4
  28. package/dist/promise/generated/index.js +8 -8
  29. package/dist/promise/generated/types.d.ts +30 -9
  30. package/dist/promise/generated/types.js +2 -2
  31. package/dist/promise/index.js +10 -10
  32. package/dist/promise/rpc.js +2 -2
  33. package/dist/promise/service.js +1 -1
  34. package/dist/pty-handoff.js +1 -1
  35. package/dist/solid/data.js +6 -6
  36. package/dist/solid/index.js +6 -6
  37. package/package.json +9 -4
  38. /package/dist/chunks/{service-timing-b6wmvv71.js → service-timing-5g2t7szy.js} +0 -0
@@ -1,8 +1,8 @@
1
1
  import {
2
- make4
3
- } from "../../chunks/service-timing-f0mehgdh.js";
4
- import"../../chunks/service-timing-y2etg5bs.js";
2
+ make5
3
+ } from "../../chunks/service-timing-wwnmjcfr.js";
4
+ import"../../chunks/service-timing-7f0py9js.js";
5
5
  import"../../chunks/service-timing-vmytr4q8.js";
6
6
  export {
7
- make4 as make
7
+ make5 as make
8
8
  };
@@ -1,12 +1,12 @@
1
1
  import"../../chunks/service-timing-6mptkzbc.js";
2
2
  import {
3
- exports_client2
4
- } from "../../chunks/service-timing-f0mehgdh.js";
3
+ exports_client4
4
+ } from "../../chunks/service-timing-wwnmjcfr.js";
5
5
  import {
6
- ClientError2
7
- } from "../../chunks/service-timing-y2etg5bs.js";
6
+ ClientError3
7
+ } from "../../chunks/service-timing-7f0py9js.js";
8
8
  import"../../chunks/service-timing-vmytr4q8.js";
9
9
  export {
10
- ClientError2 as ClientError,
11
- exports_client2 as OpenCode
10
+ ClientError3 as ClientError,
11
+ exports_client4 as OpenCode
12
12
  };
@@ -1,15 +1,15 @@
1
1
  import {
2
- ClientError2
3
- } from "../chunks/service-timing-y2etg5bs.js";
2
+ ClientError3
3
+ } from "../chunks/service-timing-7f0py9js.js";
4
4
  import"../chunks/service-timing-vmytr4q8.js";
5
- import"../chunks/service-timing-f0mehgdh.js";
5
+ import"../chunks/service-timing-wwnmjcfr.js";
6
6
  import"../chunks/service-timing-6mptkzbc.js";
7
7
  import"../chunks/service-timing-8bbb028w.js";
8
8
  import"../chunks/service-timing-ryy6kscr.js";
9
- import"../chunks/service-timing-15p82y03.js";
9
+ import"../chunks/service-timing-myz4ngx9.js";
10
10
  import {
11
- exports_client
12
- } from "../chunks/service-timing-7j6qs0tw.js";
11
+ exports_client3
12
+ } from "../chunks/service-timing-g9wej58t.js";
13
13
 
14
14
  // src/effect/index.ts
15
15
  import { Agent } from "@opencode/schema/agent";
@@ -43,7 +43,7 @@ import { PromptInput } from "@opencode/schema/prompt-input";
43
43
  export {
44
44
  AbsolutePath,
45
45
  Agent,
46
- ClientError2 as ClientError,
46
+ ClientError3 as ClientError,
47
47
  Command,
48
48
  Config,
49
49
  Credential,
@@ -54,7 +54,7 @@ export {
54
54
  Integration,
55
55
  Location,
56
56
  Model,
57
- exports_client as OpenCode,
57
+ exports_client3 as OpenCode,
58
58
  Permission,
59
59
  PermissionSaved,
60
60
  Project,
@@ -1,11 +1,11 @@
1
1
  import {
2
- make3,
2
+ make6,
3
3
  aborted2,
4
4
  exports_rpc
5
- } from "../chunks/service-timing-15p82y03.js";
5
+ } from "../chunks/service-timing-myz4ngx9.js";
6
6
  import"../chunks/service-timing-ryy6kscr.js";
7
7
  export {
8
8
  exports_rpc as RpcClientRuntime,
9
9
  aborted2 as aborted,
10
- make3 as make
10
+ make6 as make
11
11
  };
@@ -14,7 +14,7 @@ import {
14
14
  environment2,
15
15
  complete2,
16
16
  clear2
17
- } from "../chunks/service-timing-b6wmvv71.js";
17
+ } from "../chunks/service-timing-5g2t7szy.js";
18
18
  import {
19
19
  decide2,
20
20
  fallback2,
package/dist/mcp.d.ts ADDED
@@ -0,0 +1,44 @@
1
+ export type ClientMcpOptions = {
2
+ /** Base URL of the opencode server, for example `http://127.0.0.1:4096`. Its query params are kept. */
3
+ readonly url: string;
4
+ /** Client name, `[a-zA-Z0-9_-]+`. Tools are exposed to the model as `<name>_<tool>`. */
5
+ readonly name: string;
6
+ /** Sent as `location[directory]`. */
7
+ readonly directory?: string;
8
+ /** Handshake headers, such as `authorization`. Browsers cannot send them; use a ticket in `url` instead. */
9
+ readonly headers?: Record<string, string>;
10
+ readonly tools: ReadonlyArray<ClientMcpTool>;
11
+ readonly WebSocket?: typeof WebSocket;
12
+ };
13
+ export type ClientMcpTool = {
14
+ /** `[a-zA-Z0-9_-]+` */
15
+ readonly name: string;
16
+ readonly description?: string;
17
+ /** JSON Schema for the arguments; `type: "object"` is always set. Arguments are not validated here. */
18
+ readonly inputSchema?: Record<string, unknown>;
19
+ readonly handler: (args: Record<string, unknown>, ctx: ClientMcpToolContext) => ClientMcpToolResult | Promise<ClientMcpToolResult>;
20
+ };
21
+ export type ClientMcpToolContext = {
22
+ /** The opencode session that issued the call. */
23
+ readonly sessionID?: string;
24
+ };
25
+ export type ClientMcpToolResult = {
26
+ readonly content: ReadonlyArray<{
27
+ readonly type: "text";
28
+ readonly text: string;
29
+ } | {
30
+ readonly type: "image";
31
+ readonly data: string;
32
+ readonly mimeType: string;
33
+ }>;
34
+ readonly isError?: boolean;
35
+ };
36
+ export type ClientMcpConnection = {
37
+ close(): Promise<void>;
38
+ };
39
+ /**
40
+ * Exposes tools to the opencode server: opens a WebSocket to `/api/experimental/client-mcp` and answers MCP
41
+ * JSON-RPC over it (one message per text frame), so the opencode server is the MCP client. Reconnects with
42
+ * backoff until `close()`.
43
+ */
44
+ export declare function connectClientMcp(options: ClientMcpOptions): ClientMcpConnection;
package/dist/mcp.js ADDED
@@ -0,0 +1,110 @@
1
+ // src/mcp.ts
2
+ var SESSION_ID_META_KEY = "ai.opencode/sessionID";
3
+ var PROTOCOL_VERSION = "2025-11-25";
4
+ var RECONNECT_MIN = 500;
5
+ var RECONNECT_MAX = 1e4;
6
+ function connectClientMcp(options) {
7
+ const state = {
8
+ disposed: false,
9
+ delay: RECONNECT_MIN
10
+ };
11
+ const connect = () => {
12
+ if (state.disposed)
13
+ return;
14
+ const Socket = options.WebSocket ?? WebSocket;
15
+ const socket = options.headers ? new Socket(endpoint(options), { headers: options.headers }) : new Socket(endpoint(options));
16
+ state.socket = socket;
17
+ socket.addEventListener("message", (event) => {
18
+ if (state.disposed || typeof event.data !== "string")
19
+ return;
20
+ const message = parse(event.data);
21
+ if (!message)
22
+ return;
23
+ if (message.method === "notifications/initialized")
24
+ state.delay = RECONNECT_MIN;
25
+ if (typeof message.id !== "string" && typeof message.id !== "number" || typeof message.method !== "string")
26
+ return;
27
+ respond(options, message.method, message.params).then((reply) => send(socket, { jsonrpc: "2.0", id: message.id, ...reply }));
28
+ });
29
+ socket.addEventListener("close", () => {
30
+ if (state.socket === socket)
31
+ state.socket = undefined;
32
+ if (state.disposed)
33
+ return;
34
+ state.timer = setTimeout(connect, state.delay);
35
+ state.delay = Math.min(state.delay * 2, RECONNECT_MAX);
36
+ });
37
+ };
38
+ connect();
39
+ return {
40
+ async close() {
41
+ state.disposed = true;
42
+ clearTimeout(state.timer);
43
+ state.socket?.close(1000);
44
+ }
45
+ };
46
+ }
47
+ async function respond(options, method, params) {
48
+ switch (method) {
49
+ case "initialize":
50
+ return {
51
+ result: {
52
+ protocolVersion: typeof params?.protocolVersion === "string" ? params.protocolVersion : PROTOCOL_VERSION,
53
+ capabilities: { tools: {} },
54
+ serverInfo: { name: options.name, version: "1.0.0" }
55
+ }
56
+ };
57
+ case "ping":
58
+ return { result: {} };
59
+ case "tools/list":
60
+ return {
61
+ result: {
62
+ tools: options.tools.map((tool) => ({
63
+ name: tool.name,
64
+ description: tool.description,
65
+ inputSchema: { type: "object", ...tool.inputSchema }
66
+ }))
67
+ }
68
+ };
69
+ case "tools/call": {
70
+ const tool = options.tools.find((tool) => tool.name === params?.name);
71
+ if (!tool)
72
+ return { error: { code: -32602, message: `Unknown tool: ${String(params?.name)}` } };
73
+ const meta = params?._meta?.[SESSION_ID_META_KEY];
74
+ return Promise.resolve().then(() => tool.handler(params?.arguments ?? {}, { sessionID: typeof meta === "string" ? meta : undefined })).then((result) => ({ result }), (error) => ({
75
+ result: {
76
+ content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }],
77
+ isError: true
78
+ }
79
+ }));
80
+ }
81
+ }
82
+ return { error: { code: -32601, message: `Method not found: ${method}` } };
83
+ }
84
+ function send(socket, message) {
85
+ if (socket.readyState === socket.OPEN)
86
+ socket.send(JSON.stringify(message));
87
+ }
88
+ function parse(text) {
89
+ try {
90
+ const value = JSON.parse(text);
91
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : undefined;
92
+ } catch {
93
+ return;
94
+ }
95
+ }
96
+ function endpoint(options) {
97
+ const base = new URL(options.url);
98
+ if (!base.pathname.endsWith("/"))
99
+ base.pathname += "/";
100
+ const url = new URL("api/experimental/client-mcp", base);
101
+ url.search = base.search;
102
+ if (options.directory)
103
+ url.searchParams.set("location[directory]", options.directory);
104
+ url.searchParams.set("name", options.name);
105
+ url.protocol = url.protocol === "https:" || url.protocol === "wss:" ? "wss:" : "ws:";
106
+ return url;
107
+ }
108
+ export {
109
+ connectClientMcp
110
+ };
@@ -143,6 +143,9 @@ export declare function make(options: ClientOptions): {
143
143
  resource: {
144
144
  catalog: (input?: import("./index.js").McpResourceCatalogInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").McpResourceCatalogOutput>;
145
145
  };
146
+ client: {
147
+ token: (input: import("./index.js").McpClientTokenInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").McpClientTokenOutput>;
148
+ };
146
149
  };
147
150
  credential: {
148
151
  list: (requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").CredentialEntry[]>;
@@ -1,14 +1,14 @@
1
1
  import {
2
- make5,
3
- exports_client3
4
- } from "../chunks/service-timing-bd9wd9zc.js";
5
- import"../chunks/service-timing-6vp15eh6.js";
2
+ make2,
3
+ exports_client
4
+ } from "../chunks/service-timing-ka0wmgdp.js";
5
+ import"../chunks/service-timing-skhp7hxc.js";
6
6
  import"../chunks/service-timing-vyas3vgt.js";
7
- import"../chunks/service-timing-ezt8t3fk.js";
8
- import"../chunks/service-timing-g22sa7qz.js";
9
- import"../chunks/service-timing-nwcpakzx.js";
7
+ import"../chunks/service-timing-c46qzyff.js";
8
+ import"../chunks/service-timing-q4a98k9r.js";
9
+ import"../chunks/service-timing-js54wxgp.js";
10
10
  import"../chunks/service-timing-8bbb028w.js";
11
11
  export {
12
- exports_client3 as OpenCode,
13
- make5 as make
12
+ exports_client as OpenCode,
13
+ make2 as make
14
14
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
- ClientError3
3
- } from "../../chunks/service-timing-nwcpakzx.js";
2
+ ClientError2
3
+ } from "../../chunks/service-timing-js54wxgp.js";
4
4
  export {
5
- ClientError3 as ClientError
5
+ ClientError2 as ClientError
6
6
  };
@@ -1,4 +1,4 @@
1
- import type { ServerConnectInput, LocationGetInput, AgentListInput, AgentListOutput, AgentGetInput, AgentGetOutput, PluginListInput, PluginListOutput, PluginCheckInput, PluginCheckOutput, PluginUpdateInput, SessionListInput, SessionStatsInput, SessionCreateInput, SessionImportInput, SessionExportInput, SessionGetInput, SessionRemoveInput, SessionForkInput, SessionSwitchAgentInput, SessionSwitchModelInput, SessionUpdateInput, SessionMoveInput, SessionPromptInput, SessionCommandInput, SessionSkillInput, SessionSyntheticInput, SessionShellInput, SessionCompactInput, SessionWaitInput, SessionRevertStageInput, SessionRevertClearInput, SessionRevertCommitInput, SessionContextInput, SessionDiffInput, SessionInboxListInput, SessionInboxCancelInput, SessionInboxUpdateInput, SessionInstructionsEntryListInput, SessionInstructionsEntryPutInput, SessionInstructionsEntryRemoveInput, SessionGenerateInput, SessionLogInput, SessionLogOutput, SessionInterruptInput, SessionBackgroundInput, SessionMessageGetInput, SessionFormListInput, SessionFormCreateInput, SessionFormGetInput, SessionFormReplyInput, SessionFormCancelInput, SessionEnvironmentInput, SessionViewInput, MessageListInput, ModelListInput, ModelListOutput, ModelDefaultInput, ModelDefaultOutput, GenerateTextInput, VoiceSessionInput, VoiceInstructionsInput, ProviderListInput, ProviderListOutput, ProviderGetInput, ProviderGetOutput, IntegrationListInput, IntegrationListOutput, IntegrationGetInput, IntegrationGetOutput, IntegrationWellknownAddInput, IntegrationConnectKeyInput, IntegrationConnectExternalInput, IntegrationOauthConnectInput, IntegrationOauthConnectOutput, IntegrationOauthStatusInput, IntegrationOauthStatusOutput, IntegrationOauthCompleteInput, IntegrationOauthCancelInput, IntegrationCommandConnectInput, IntegrationCommandConnectOutput, IntegrationCommandStatusInput, IntegrationCommandStatusOutput, IntegrationCommandCancelInput, McpListInput, McpListOutput, McpAddInput, McpRemoveInput, McpConnectInput, McpDisconnectInput, McpResourceCatalogInput, McpResourceCatalogOutput, CredentialCreateInput, CredentialUpdateInput, CredentialActivateInput, CredentialRemoveInput, ProjectListInput, ProjectListOutput, ProjectUpdateInput, FormListInput, FormListOutput, PermissionRequestListInput, PermissionRequestListOutput, PermissionSavedListInput, PermissionSavedUpdateInput, PermissionSavedRemoveInput, PermissionCreateInput, PermissionListInput, PermissionGetInput, PermissionReplyInput, FileReadInput, FileReadOutput, FileListInput, FileListOutput, FileFindInput, FileFindOutput, FileWriteInput, FileWriteOutput, CommandListInput, CommandListOutput, SkillListInput, SkillListOutput, RpcCallInput, EventSubscribeOutput, PtyListInput, PtyListOutput, PtyCreateInput, PtyCreateOutput, PtyGetInput, PtyGetOutput, PtyUpdateInput, PtyUpdateOutput, PtyRemoveInput, PtyConnectTokenInput, PtyConnectTokenOutput, ExperimentalPersistentPtyReadInput, ExperimentalPersistentPtyListInput, ExperimentalPersistentPtyCreateInput, ExperimentalPersistentPtyHandoffOutput, ExperimentalPersistentPtyGetInput, ExperimentalPersistentPtyUpdateInput, ExperimentalPersistentPtySnapshotInput, ExperimentalPersistentPtyRemoveInput, ExperimentalPersistentPtyConnectTokenInput, ShellListInput, ShellListOutput, ShellCreateInput, ShellCreateOutput, ShellGetInput, ShellGetOutput, ShellOutputInput, ShellOutputOutput, ShellRemoveInput, ReferenceListInput, ReferenceListOutput, WorktreeListInput, WorktreeCreateInput, WorktreeRemoveInput, WorktreeRefreshInput, VcsInitInput, VcsGetInput, VcsGetOutput, VcsBaseInput, VcsBaseOutput, VcsStatusInput, VcsStatusOutput, VcsBranchListInput, VcsBranchListOutput, VcsDiffInput, VcsDiffOutput, DebugLocationListOutput, DebugLocationEvictInput, MigrationV1StatusOutput, WebsearchProvidersInput, WebsearchProvidersOutput, WebsearchQueryInput, WebsearchQueryOutput, ConfigGetInput, ConfigGetOutput, ConfigShellsOutput, ConfigUpdateInput } from "./types.js";
1
+ import type { ServerConnectInput, LocationGetInput, AgentListInput, AgentListOutput, AgentGetInput, AgentGetOutput, PluginListInput, PluginListOutput, PluginCheckInput, PluginCheckOutput, PluginUpdateInput, SessionListInput, SessionStatsInput, SessionCreateInput, SessionImportInput, SessionExportInput, SessionGetInput, SessionRemoveInput, SessionForkInput, SessionSwitchAgentInput, SessionSwitchModelInput, SessionUpdateInput, SessionMoveInput, SessionPromptInput, SessionCommandInput, SessionSkillInput, SessionSyntheticInput, SessionShellInput, SessionCompactInput, SessionWaitInput, SessionRevertStageInput, SessionRevertClearInput, SessionRevertCommitInput, SessionContextInput, SessionDiffInput, SessionInboxListInput, SessionInboxCancelInput, SessionInboxUpdateInput, SessionInstructionsEntryListInput, SessionInstructionsEntryPutInput, SessionInstructionsEntryRemoveInput, SessionGenerateInput, SessionLogInput, SessionLogOutput, SessionInterruptInput, SessionBackgroundInput, SessionMessageGetInput, SessionFormListInput, SessionFormCreateInput, SessionFormGetInput, SessionFormReplyInput, SessionFormCancelInput, SessionEnvironmentInput, SessionViewInput, MessageListInput, ModelListInput, ModelListOutput, ModelDefaultInput, ModelDefaultOutput, GenerateTextInput, VoiceSessionInput, VoiceInstructionsInput, ProviderListInput, ProviderListOutput, ProviderGetInput, ProviderGetOutput, IntegrationListInput, IntegrationListOutput, IntegrationGetInput, IntegrationGetOutput, IntegrationWellknownAddInput, IntegrationConnectKeyInput, IntegrationConnectExternalInput, IntegrationOauthConnectInput, IntegrationOauthConnectOutput, IntegrationOauthStatusInput, IntegrationOauthStatusOutput, IntegrationOauthCompleteInput, IntegrationOauthCancelInput, IntegrationCommandConnectInput, IntegrationCommandConnectOutput, IntegrationCommandStatusInput, IntegrationCommandStatusOutput, IntegrationCommandCancelInput, McpListInput, McpListOutput, McpAddInput, McpRemoveInput, McpConnectInput, McpDisconnectInput, McpResourceCatalogInput, McpResourceCatalogOutput, McpClientTokenInput, McpClientTokenOutput, CredentialCreateInput, CredentialUpdateInput, CredentialActivateInput, CredentialRemoveInput, ProjectListInput, ProjectListOutput, ProjectUpdateInput, FormListInput, FormListOutput, PermissionRequestListInput, PermissionRequestListOutput, PermissionSavedListInput, PermissionSavedUpdateInput, PermissionSavedRemoveInput, PermissionCreateInput, PermissionListInput, PermissionGetInput, PermissionReplyInput, FileReadInput, FileReadOutput, FileListInput, FileListOutput, FileFindInput, FileFindOutput, FileWriteInput, FileWriteOutput, CommandListInput, CommandListOutput, SkillListInput, SkillListOutput, RpcCallInput, EventSubscribeOutput, PtyListInput, PtyListOutput, PtyCreateInput, PtyCreateOutput, PtyGetInput, PtyGetOutput, PtyUpdateInput, PtyUpdateOutput, PtyRemoveInput, PtyConnectTokenInput, PtyConnectTokenOutput, ExperimentalPersistentPtyReadInput, ExperimentalPersistentPtyListInput, ExperimentalPersistentPtyCreateInput, ExperimentalPersistentPtyHandoffOutput, ExperimentalPersistentPtyGetInput, ExperimentalPersistentPtyUpdateInput, ExperimentalPersistentPtySnapshotInput, ExperimentalPersistentPtyRemoveInput, ExperimentalPersistentPtyConnectTokenInput, ShellListInput, ShellListOutput, ShellCreateInput, ShellCreateOutput, ShellGetInput, ShellGetOutput, ShellOutputInput, ShellOutputOutput, ShellRemoveInput, ReferenceListInput, ReferenceListOutput, WorktreeListInput, WorktreeCreateInput, WorktreeRemoveInput, WorktreeRefreshInput, VcsInitInput, VcsGetInput, VcsGetOutput, VcsBaseInput, VcsBaseOutput, VcsStatusInput, VcsStatusOutput, VcsBranchListInput, VcsBranchListOutput, VcsDiffInput, VcsDiffOutput, DebugLocationListOutput, DebugLocationEvictInput, MigrationV1StatusOutput, WebsearchProvidersInput, WebsearchProvidersOutput, WebsearchQueryInput, WebsearchQueryOutput, ConfigGetInput, ConfigGetOutput, ConfigShellsOutput, ConfigUpdateInput } from "./types.js";
2
2
  export interface ClientOptions {
3
3
  readonly baseUrl: string;
4
4
  readonly fetch?: typeof globalThis.fetch;
@@ -150,6 +150,9 @@ export declare function make(options: ClientOptions): {
150
150
  resource: {
151
151
  catalog: (input?: McpResourceCatalogInput, requestOptions?: RequestOptions) => Promise<McpResourceCatalogOutput>;
152
152
  };
153
+ client: {
154
+ token: (input: McpClientTokenInput, requestOptions?: RequestOptions) => Promise<McpClientTokenOutput>;
155
+ };
153
156
  };
154
157
  credential: {
155
158
  list: (requestOptions?: RequestOptions) => Promise<import("./types.js").CredentialEntry[]>;
@@ -1,7 +1,7 @@
1
1
  import {
2
- make6
3
- } from "../../chunks/service-timing-g22sa7qz.js";
4
- import"../../chunks/service-timing-nwcpakzx.js";
2
+ make3
3
+ } from "../../chunks/service-timing-q4a98k9r.js";
4
+ import"../../chunks/service-timing-js54wxgp.js";
5
5
  export {
6
- make6 as make
6
+ make3 as make
7
7
  };
@@ -23,6 +23,7 @@ import {
23
23
  isIntegrationAttemptNotFoundError2,
24
24
  isIntegrationMethodNotFoundError2,
25
25
  isMcpServerNotFoundError2,
26
+ isForbiddenError2,
26
27
  isProjectNotFoundError2,
27
28
  isPermissionSavedNotFoundError2,
28
29
  isPermissionNotFoundError2,
@@ -30,20 +31,19 @@ import {
30
31
  isRpcError2,
31
32
  isRpcInternalError2,
32
33
  isPtyNotFoundError2,
33
- isForbiddenError2,
34
34
  isShellNotFoundError2,
35
35
  isWorktreeError2,
36
36
  isVcsInitNotSupportedError2
37
- } from "../../chunks/service-timing-ezt8t3fk.js";
37
+ } from "../../chunks/service-timing-c46qzyff.js";
38
38
  import {
39
- exports_client4
40
- } from "../../chunks/service-timing-g22sa7qz.js";
39
+ exports_client2
40
+ } from "../../chunks/service-timing-q4a98k9r.js";
41
41
  import {
42
- ClientError3
43
- } from "../../chunks/service-timing-nwcpakzx.js";
42
+ ClientError2
43
+ } from "../../chunks/service-timing-js54wxgp.js";
44
44
  export {
45
- ClientError3 as ClientError,
46
- exports_client4 as OpenCode,
45
+ ClientError2 as ClientError,
46
+ exports_client2 as OpenCode,
47
47
  isAgentNotFoundError2 as isAgentNotFoundError,
48
48
  isCommandExecutionError2 as isCommandExecutionError,
49
49
  isCommandNotFoundError2 as isCommandNotFoundError,
@@ -347,6 +347,10 @@ export type McpResourceTemplate = {
347
347
  description?: string;
348
348
  mimeType?: string;
349
349
  };
350
+ export type PtyTicketConnectToken = {
351
+ ticket: string;
352
+ expires_in: number;
353
+ };
350
354
  export type CredentialKey = {
351
355
  type: "key";
352
356
  key: string;
@@ -412,10 +416,6 @@ export type SessionStatus = {
412
416
  } | {
413
417
  type: "busy";
414
418
  };
415
- export type PtyTicketConnectToken = {
416
- ticket: string;
417
- expires_in: number;
418
- };
419
419
  export type PersistentPtyHandoff = {
420
420
  directory: string;
421
421
  instanceID: string;
@@ -3632,6 +3632,11 @@ export type McpServerNotFoundError = {
3632
3632
  readonly message: string;
3633
3633
  };
3634
3634
  export declare const isMcpServerNotFoundError: (value: unknown) => value is McpServerNotFoundError;
3635
+ export type ForbiddenError = {
3636
+ readonly _tag: "ForbiddenError";
3637
+ readonly message: string;
3638
+ };
3639
+ export declare const isForbiddenError: (value: unknown) => value is ForbiddenError;
3635
3640
  export type ProjectNotFoundError = {
3636
3641
  readonly _tag: "ProjectNotFoundError";
3637
3642
  readonly projectID: string;
@@ -3676,11 +3681,6 @@ export type PtyNotFoundError = {
3676
3681
  readonly message: string;
3677
3682
  };
3678
3683
  export declare const isPtyNotFoundError: (value: unknown) => value is PtyNotFoundError;
3679
- export type ForbiddenError = {
3680
- readonly _tag: "ForbiddenError";
3681
- readonly message: string;
3682
- };
3683
- export declare const isForbiddenError: (value: unknown) => value is ForbiddenError;
3684
3684
  export type ShellNotFoundError = {
3685
3685
  readonly _tag: "ShellNotFoundError";
3686
3686
  readonly id: string;
@@ -6598,6 +6598,27 @@ export type McpResourceCatalogOutput = {
6598
6598
  location: LocationPublicRef;
6599
6599
  data: McpResourceCatalog;
6600
6600
  };
6601
+ export type McpClientTokenInput = {
6602
+ readonly location?: {
6603
+ readonly location?: {
6604
+ readonly directory?: string | undefined;
6605
+ } | undefined;
6606
+ readonly name: string;
6607
+ }["location"];
6608
+ readonly name: {
6609
+ readonly location?: {
6610
+ readonly directory?: string | undefined;
6611
+ } | undefined;
6612
+ readonly name: string;
6613
+ }["name"];
6614
+ readonly "x-opencode-ticket"?: {
6615
+ readonly "x-opencode-ticket"?: string | undefined;
6616
+ }["x-opencode-ticket"];
6617
+ };
6618
+ export type McpClientTokenOutput = {
6619
+ location: LocationPublicRef;
6620
+ data: PtyTicketConnectToken;
6621
+ };
6601
6622
  export type CredentialListOutput = {
6602
6623
  data: Array<CredentialEntry>;
6603
6624
  }["data"];
@@ -22,6 +22,7 @@ import {
22
22
  isIntegrationAttemptNotFoundError2,
23
23
  isIntegrationMethodNotFoundError2,
24
24
  isMcpServerNotFoundError2,
25
+ isForbiddenError2,
25
26
  isProjectNotFoundError2,
26
27
  isPermissionSavedNotFoundError2,
27
28
  isPermissionNotFoundError2,
@@ -29,11 +30,10 @@ import {
29
30
  isRpcError2,
30
31
  isRpcInternalError2,
31
32
  isPtyNotFoundError2,
32
- isForbiddenError2,
33
33
  isShellNotFoundError2,
34
34
  isWorktreeError2,
35
35
  isVcsInitNotSupportedError2
36
- } from "../../chunks/service-timing-ezt8t3fk.js";
36
+ } from "../../chunks/service-timing-c46qzyff.js";
37
37
  export {
38
38
  isAgentNotFoundError2 as isAgentNotFoundError,
39
39
  isCommandExecutionError2 as isCommandExecutionError,
@@ -1,8 +1,8 @@
1
1
  import"../chunks/service-timing-m2eywc8w.js";
2
2
  import {
3
- exports_client3
4
- } from "../chunks/service-timing-bd9wd9zc.js";
5
- import"../chunks/service-timing-6vp15eh6.js";
3
+ exports_client
4
+ } from "../chunks/service-timing-ka0wmgdp.js";
5
+ import"../chunks/service-timing-skhp7hxc.js";
6
6
  import"../chunks/service-timing-vyas3vgt.js";
7
7
  import {
8
8
  isInvalidRequestError2,
@@ -28,6 +28,7 @@ import {
28
28
  isIntegrationAttemptNotFoundError2,
29
29
  isIntegrationMethodNotFoundError2,
30
30
  isMcpServerNotFoundError2,
31
+ isForbiddenError2,
31
32
  isProjectNotFoundError2,
32
33
  isPermissionSavedNotFoundError2,
33
34
  isPermissionNotFoundError2,
@@ -35,19 +36,18 @@ import {
35
36
  isRpcError2,
36
37
  isRpcInternalError2,
37
38
  isPtyNotFoundError2,
38
- isForbiddenError2,
39
39
  isShellNotFoundError2,
40
40
  isWorktreeError2,
41
41
  isVcsInitNotSupportedError2
42
- } from "../chunks/service-timing-ezt8t3fk.js";
43
- import"../chunks/service-timing-g22sa7qz.js";
42
+ } from "../chunks/service-timing-c46qzyff.js";
43
+ import"../chunks/service-timing-q4a98k9r.js";
44
44
  import {
45
- ClientError3
46
- } from "../chunks/service-timing-nwcpakzx.js";
45
+ ClientError2
46
+ } from "../chunks/service-timing-js54wxgp.js";
47
47
  import"../chunks/service-timing-8bbb028w.js";
48
48
  export {
49
- ClientError3 as ClientError,
50
- exports_client3 as OpenCode,
49
+ ClientError2 as ClientError,
50
+ exports_client as OpenCode,
51
51
  isAgentNotFoundError2 as isAgentNotFoundError,
52
52
  isCommandExecutionError2 as isCommandExecutionError,
53
53
  isCommandNotFoundError2 as isCommandNotFoundError,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  makeRpc2
3
- } from "../chunks/service-timing-6vp15eh6.js";
4
- import"../chunks/service-timing-ezt8t3fk.js";
3
+ } from "../chunks/service-timing-skhp7hxc.js";
4
+ import"../chunks/service-timing-c46qzyff.js";
5
5
  export {
6
6
  makeRpc2 as makeRpc
7
7
  };
@@ -14,7 +14,7 @@ import {
14
14
  environment2,
15
15
  complete2,
16
16
  clear2
17
- } from "../chunks/service-timing-b6wmvv71.js";
17
+ } from "../chunks/service-timing-5g2t7szy.js";
18
18
  import {
19
19
  decide2,
20
20
  fallback2,
@@ -4,7 +4,7 @@ import {
4
4
  complete2,
5
5
  clear2,
6
6
  exports_pty_handoff
7
- } from "./chunks/service-timing-b6wmvv71.js";
7
+ } from "./chunks/service-timing-5g2t7szy.js";
8
8
  export {
9
9
  exports_pty_handoff as PtyHandoff,
10
10
  clear2 as clear,
@@ -2,14 +2,14 @@ import {
2
2
  settleMs2,
3
3
  locationKey2,
4
4
  createData2
5
- } from "../chunks/service-timing-61wt4y9h.js";
5
+ } from "../chunks/service-timing-g9ajxfy0.js";
6
6
  import"../chunks/service-timing-m2eywc8w.js";
7
- import"../chunks/service-timing-bd9wd9zc.js";
8
- import"../chunks/service-timing-6vp15eh6.js";
7
+ import"../chunks/service-timing-ka0wmgdp.js";
8
+ import"../chunks/service-timing-skhp7hxc.js";
9
9
  import"../chunks/service-timing-vyas3vgt.js";
10
- import"../chunks/service-timing-ezt8t3fk.js";
11
- import"../chunks/service-timing-g22sa7qz.js";
12
- import"../chunks/service-timing-nwcpakzx.js";
10
+ import"../chunks/service-timing-c46qzyff.js";
11
+ import"../chunks/service-timing-q4a98k9r.js";
12
+ import"../chunks/service-timing-js54wxgp.js";
13
13
  import"../chunks/service-timing-8bbb028w.js";
14
14
  export {
15
15
  createData2 as createData,
@@ -1,16 +1,16 @@
1
- import"../chunks/service-timing-nwcpakzx.js";
2
- import"../chunks/service-timing-g22sa7qz.js";
3
- import"../chunks/service-timing-ezt8t3fk.js";
1
+ import"../chunks/service-timing-js54wxgp.js";
2
+ import"../chunks/service-timing-q4a98k9r.js";
3
+ import"../chunks/service-timing-c46qzyff.js";
4
4
  import"../chunks/service-timing-vyas3vgt.js";
5
5
  import"../chunks/service-timing-8bbb028w.js";
6
- import"../chunks/service-timing-6vp15eh6.js";
7
- import"../chunks/service-timing-bd9wd9zc.js";
6
+ import"../chunks/service-timing-skhp7hxc.js";
7
+ import"../chunks/service-timing-ka0wmgdp.js";
8
8
  import"../chunks/service-timing-m2eywc8w.js";
9
9
  import {
10
10
  settleMs2,
11
11
  locationKey2,
12
12
  createData2
13
- } from "../chunks/service-timing-61wt4y9h.js";
13
+ } from "../chunks/service-timing-g9ajxfy0.js";
14
14
  import {
15
15
  defaultIdleTimeout2,
16
16
  foregroundIdleThreshold2,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/client",
4
- "version": "0.0.0-dev-21599",
4
+ "version": "0.0.0-dev-21612",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -47,6 +47,10 @@
47
47
  "./effect/service": {
48
48
  "import": "./dist/effect/service.js",
49
49
  "types": "./dist/effect/service.d.ts"
50
+ },
51
+ "./mcp": {
52
+ "import": "./dist/mcp.js",
53
+ "types": "./dist/mcp.d.ts"
50
54
  }
51
55
  },
52
56
  "scripts": {
@@ -57,8 +61,8 @@
57
61
  "typecheck": "tsc --noEmit"
58
62
  },
59
63
  "dependencies": {
60
- "@opencode/schema": "0.0.0-dev-21599",
61
- "@opencode/protocol": "0.0.0-dev-21599"
64
+ "@opencode/schema": "0.0.0-dev-21612",
65
+ "@opencode/protocol": "0.0.0-dev-21612"
62
66
  },
63
67
  "peerDependencies": {
64
68
  "effect": "4.0.1",
@@ -74,7 +78,8 @@
74
78
  },
75
79
  "devDependencies": {
76
80
  "@effect/platform-node": "4.0.1",
77
- "@opencode/httpapi-codegen": "0.0.0-dev-21599",
81
+ "@modelcontextprotocol/client": "2.0.0",
82
+ "@opencode/httpapi-codegen": "0.0.0-dev-21612",
78
83
  "@tsconfig/bun": "1.0.9",
79
84
  "@types/bun": "1.4.3",
80
85
  "@typescript/native": "npm:typescript@7.0.2",