opencode-claude-code-acpbridge 0.8.0 → 0.10.0
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.
- package/CHANGELOG.md +122 -0
- package/README.md +139 -68
- package/dist/acp/claude-config.d.ts +52 -0
- package/dist/acp/claude-config.d.ts.map +1 -1
- package/dist/acp/claude-config.js +23 -7
- package/dist/acp/claude-config.js.map +1 -1
- package/dist/acp/mcp-host.d.ts +10 -0
- package/dist/acp/mcp-host.d.ts.map +1 -1
- package/dist/acp/mcp-host.js +17 -4
- package/dist/acp/mcp-host.js.map +1 -1
- package/dist/acp/mcp-runtime.js +112 -11
- package/dist/acp/mcp-runtime.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/log.d.ts +11 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +50 -0
- package/dist/log.js.map +1 -0
- package/dist/plugin/bridge-rules.d.ts +22 -0
- package/dist/plugin/bridge-rules.d.ts.map +1 -0
- package/dist/plugin/bridge-rules.js +104 -0
- package/dist/plugin/bridge-rules.js.map +1 -0
- package/dist/plugin/catalog.d.ts +7 -0
- package/dist/plugin/catalog.d.ts.map +1 -1
- package/dist/plugin/catalog.js +38 -0
- package/dist/plugin/catalog.js.map +1 -1
- package/dist/plugin/index.d.ts +6 -13
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +305 -241
- package/dist/plugin/index.js.map +1 -1
- package/dist/plugin/sessions.d.ts +11 -8
- package/dist/plugin/sessions.d.ts.map +1 -1
- package/dist/plugin/sessions.js +47 -7
- package/dist/plugin/sessions.js.map +1 -1
- package/dist/provider/factory.d.ts.map +1 -1
- package/dist/provider/factory.js +5 -3
- package/dist/provider/factory.js.map +1 -1
- package/dist/provider/history.d.ts +44 -0
- package/dist/provider/history.d.ts.map +1 -0
- package/dist/provider/history.js +145 -0
- package/dist/provider/history.js.map +1 -0
- package/dist/provider/model.d.ts +193 -32
- package/dist/provider/model.d.ts.map +1 -1
- package/dist/provider/model.js +1521 -500
- package/dist/provider/model.js.map +1 -1
- package/dist/provider/recorder.d.ts +5 -0
- package/dist/provider/recorder.d.ts.map +1 -0
- package/dist/provider/recorder.js +63 -0
- package/dist/provider/recorder.js.map +1 -0
- package/docs/DEVELOPMENT.md +56 -27
- package/examples/01-minimal.jsonc +9 -6
- package/examples/02-permisos-por-agente.jsonc +22 -17
- package/examples/03-fidelidad-opencode.jsonc +8 -7
- package/examples/04-modelo-y-esfuerzo.jsonc +29 -23
- package/examples/05-agentes-personalizados.jsonc +24 -14
- package/examples/06-ecosistema-claude.jsonc +12 -11
- package/examples/07-provider-manual.jsonc +12 -8
- package/examples/08-puente-permisos.jsonc +43 -25
- package/examples/README.md +10 -9
- package/package.json +6 -5
package/dist/provider/model.d.ts
CHANGED
|
@@ -9,7 +9,17 @@ export interface ACPModelConfig {
|
|
|
9
9
|
claudeCode?: ClaudeCodeControl;
|
|
10
10
|
streamCloseTimeoutMs?: number;
|
|
11
11
|
claudeExecutable?: string;
|
|
12
|
+
/** Test seam: an in-process agent instead of spawning `command`. */
|
|
13
|
+
transport?: () => {
|
|
14
|
+
input: WritableStream<Uint8Array>;
|
|
15
|
+
output: ReadableStream<Uint8Array>;
|
|
16
|
+
close?: () => void;
|
|
17
|
+
};
|
|
12
18
|
}
|
|
19
|
+
/** Claude's usage/rate limit, rewritten so the user knows to switch models — and in
|
|
20
|
+
* words OpenCode's retry classifier doesn't match ("try again", "overloaded"…), so it
|
|
21
|
+
* isn't retried in a loop against an exhausted subscription. */
|
|
22
|
+
export declare function limitError(err: unknown): Error | undefined;
|
|
13
23
|
export declare class ACPOrchestratorModel implements LanguageModelV3 {
|
|
14
24
|
private readonly config;
|
|
15
25
|
readonly specificationVersion: "v3";
|
|
@@ -17,6 +27,7 @@ export declare class ACPOrchestratorModel implements LanguageModelV3 {
|
|
|
17
27
|
readonly modelId: string;
|
|
18
28
|
readonly supportedUrls: Record<string, RegExp[]>;
|
|
19
29
|
private agent;
|
|
30
|
+
private closeTransport;
|
|
20
31
|
private connection;
|
|
21
32
|
private connecting;
|
|
22
33
|
/** Live conversations, keyed by OpenCode sessionID (or the conversation hash).
|
|
@@ -25,10 +36,19 @@ export declare class ACPOrchestratorModel implements LanguageModelV3 {
|
|
|
25
36
|
private readonly sessions;
|
|
26
37
|
/** Same states indexed by ACP sessionId, to route agent-initiated callbacks. */
|
|
27
38
|
private readonly byAcpSession;
|
|
39
|
+
/** Per-conversation lock for session lookup/creation (see `startFresh`). */
|
|
40
|
+
private readonly locks;
|
|
41
|
+
/** Per-call model override (see `doStream`). */
|
|
42
|
+
private readonly callModel;
|
|
28
43
|
private idSeq;
|
|
29
44
|
private promptCaps;
|
|
45
|
+
/** The agent merges a prompt sent mid-turn into the running turn (claude-agent-acp). */
|
|
46
|
+
private promptQueueing;
|
|
30
47
|
constructor(config: ACPModelConfig);
|
|
31
|
-
doStream(options: LanguageModelV3CallOptions
|
|
48
|
+
doStream(options: LanguageModelV3CallOptions,
|
|
49
|
+
/** Model for THIS call when one orchestrator (one agent process) serves several
|
|
50
|
+
* OpenCode models — see `ACPModelView`. */
|
|
51
|
+
modelId?: string): Promise<{
|
|
32
52
|
stream: ReadableStream<LanguageModelV3StreamPart>;
|
|
33
53
|
warnings: never[];
|
|
34
54
|
}>;
|
|
@@ -39,11 +59,83 @@ export declare class ACPOrchestratorModel implements LanguageModelV3 {
|
|
|
39
59
|
* (independent) ACP stdio channel meanwhile — dropping them truncated answers and
|
|
40
60
|
* hid the reasoning block entirely. */
|
|
41
61
|
private emit;
|
|
62
|
+
/** A turn that is not a continuation: reuse the live session (append), or create /
|
|
63
|
+
* resume one. Runs under the conversation lock. */
|
|
64
|
+
private startFresh;
|
|
65
|
+
/** Swap `t` onto a fork of its ACP session created with the current profile. The
|
|
66
|
+
* fork carries the whole transcript, so what `t` knows (sentKeys, own output) still
|
|
67
|
+
* holds; it gets its own MCP host. The old session is closed. */
|
|
68
|
+
private forkInPlace;
|
|
69
|
+
/** Remember where this turn starts (index of its first user message) and Claude's
|
|
70
|
+
* last transcript entry before it. */
|
|
71
|
+
private recordCheckpoint;
|
|
72
|
+
/** uuid of the last main-thread assistant entry in the session's transcript
|
|
73
|
+
* (`<configDir>/projects/<cwd as slug>/<sessionId>.jsonl`), read from its tail. */
|
|
74
|
+
private lastAssistantUuid;
|
|
75
|
+
/** Free the agent-side session (its Claude Code process and MCP servers). The client
|
|
76
|
+
* SDK has no method for it; the agent implements `session/close`. */
|
|
77
|
+
private closeAcpSession;
|
|
78
|
+
/** Answer OpenCode's compaction request inside the live session (it already holds
|
|
79
|
+
* the conversation and its cache): only the summary instruction is sent. In v2 the
|
|
80
|
+
* session then compacts itself natively, so the checkpoint can be adopted next turn.
|
|
81
|
+
* Returns false when the session is busy (V2 can compact mid tool loop). */
|
|
82
|
+
private serveCompaction;
|
|
83
|
+
/** Native `/compact` of the live session, output hidden. */
|
|
84
|
+
private nativeCompact;
|
|
85
|
+
private withLock;
|
|
86
|
+
/** Remember the text of every block we emit: OpenCode stores each block as one part of
|
|
87
|
+
* the assistant message it sends back next turn, which is how `dropOwnLead` knows the
|
|
88
|
+
* agent already has it. */
|
|
89
|
+
private trackOwnText;
|
|
90
|
+
private isOwnId;
|
|
91
|
+
/** Strip the agent's own output from the head of a tail: the assistant/tool messages
|
|
92
|
+
* before the next user message, as long as they carry only our ids and (when this
|
|
93
|
+
* process emitted them) only text we emitted. A message that fails the check — another
|
|
94
|
+
* model's turn — stops the skip, so it still reaches the agent. After a restart there
|
|
95
|
+
* is no emitted text to compare, and the position alone decides. */
|
|
96
|
+
private dropOwnLead;
|
|
97
|
+
/** Everything in `hist` is now known to the agent (both fingerprints). */
|
|
98
|
+
private markKnown;
|
|
99
|
+
private historyMode;
|
|
100
|
+
/** Legacy per-message keys or anchors, per `historyMode`. In `shadow` (the default
|
|
101
|
+
* while the anchor fingerprint proves itself on real sessions) both are computed, the
|
|
102
|
+
* legacy one decides, and every disagreement is logged for review. */
|
|
103
|
+
private classify;
|
|
104
|
+
/** Send a prompt as the session's newest generation. Completions of older ones — a
|
|
105
|
+
* cancelled turn, or the original prompt the agent resolves early when it merges a
|
|
106
|
+
* queued one — are ignored instead of closing the stream of the current turn. */
|
|
107
|
+
private sendPrompt;
|
|
108
|
+
/** Wait (bounded) for the running prompt to settle — e.g. after a cancel. */
|
|
109
|
+
private settle;
|
|
110
|
+
/** Stop the current turn for good: cancel it agent-side, unblock everything it waits
|
|
111
|
+
* on (deferred tool calls, bridged permissions) and drop what it still produces. */
|
|
112
|
+
private abortTurn;
|
|
113
|
+
/** The prompt completed while no stream was attached: close the current one with it. */
|
|
114
|
+
private finishFromDone;
|
|
42
115
|
private flushPending;
|
|
43
116
|
private onPromptDone;
|
|
44
117
|
private onPromptError;
|
|
45
|
-
/** Fired by the MCP host when the agent calls an OpenCode tool.
|
|
118
|
+
/** Fired by the MCP host when the agent calls an OpenCode tool. The call is NOT
|
|
119
|
+
* resolved here: it waits for OpenCode to run the tool and send the continuation. */
|
|
46
120
|
private onToolCall;
|
|
121
|
+
/** The agent cancelled a call: if OpenCode hasn't been given it yet, it never will be.
|
|
122
|
+
* (An already emitted one stays pending so its continuation is still recognised.) */
|
|
123
|
+
private onToolCancelled;
|
|
124
|
+
private parallelTools;
|
|
125
|
+
/** Collect a call into the current step. Serial tools close the step at once; a
|
|
126
|
+
* read-only one waits TOOL_BATCH_MS for the siblings Claude Code issues in parallel,
|
|
127
|
+
* so OpenCode gets them in ONE step and runs them in parallel too. With no stream
|
|
128
|
+
* attached the call is queued for the next continuation — never dropped. */
|
|
129
|
+
private addStepItem;
|
|
130
|
+
/** Usage for a `finish`: the CURRENT context size (OpenCode reads input + cache +
|
|
131
|
+
* output of the last step as the prompt size when deciding to compact), split into
|
|
132
|
+
* cache read/write/no-cache with the ratios of the turn's totals. The turn totals
|
|
133
|
+
* themselves are a sum over all its requests — reporting them inflated the context
|
|
134
|
+
* N-fold and triggered compactions early. */
|
|
135
|
+
private usageNow;
|
|
136
|
+
/** Emit the collected calls and end the stream with ONE `tool-calls` finish (OpenCode
|
|
137
|
+
* rejects a second finish in a step). */
|
|
138
|
+
private closeStep;
|
|
47
139
|
/** Map approve/reject to one of the options the agent offered (by kind/optionId). */
|
|
48
140
|
private permOutcome;
|
|
49
141
|
/** Tool name the agent wants permission for. The ACP toolCall carries NO bare
|
|
@@ -54,16 +146,35 @@ export declare class ACPOrchestratorModel implements LanguageModelV3 {
|
|
|
54
146
|
/** Extract the markdown plan from an ExitPlanMode (`switch_mode`) tool call: it rides
|
|
55
147
|
* in `rawInput.plan`, with the tool-call text content as a fallback. */
|
|
56
148
|
private planText;
|
|
57
|
-
/** ACP requestPermission →
|
|
58
|
-
* Deferred: returns a Promise the agent awaits until
|
|
59
|
-
*
|
|
149
|
+
/** ACP requestPermission → the agent's own rules first, then the `question` dialog.
|
|
150
|
+
* Deferred: returns a Promise the agent awaits until the verdict comes back as
|
|
151
|
+
* the `question` tool-result (resolved in onStart's continuation branch). */
|
|
60
152
|
private onRequestPermission;
|
|
61
|
-
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
153
|
+
/** ExitPlanMode: offer the agent's OWN choices (auto / accept edits / approve each
|
|
154
|
+
* edit / keep planning) instead of a generic allow/deny that always meant "approve
|
|
155
|
+
* each edit". A typed answer means "keep planning, and here's why": the plan is
|
|
156
|
+
* rejected and the text reaches the agent as a message, so it revises the plan. */
|
|
157
|
+
private askPlanApproval;
|
|
158
|
+
/** Action target of a native request (command / skill / path), plus the glob an
|
|
159
|
+
* "Always allow" would persist. Shell commands collapse to their first token
|
|
160
|
+
* (`git status` → `git *`); a request with no real target persists nothing, so
|
|
161
|
+
* the dialog never offers a broad rule that would auto-approve everything. */
|
|
162
|
+
private bridgeTarget;
|
|
163
|
+
/** Emit a `question` tool-call to OpenCode (same deferred pattern as a real
|
|
164
|
+
* tool-call): the native tool's request becomes a dialog — Allow once /
|
|
165
|
+
* Always allow / Deny — and the answer arrives as the tool-result on the next
|
|
166
|
+
* doStream. The agent itself only ever sees the ACP permission outcome. */
|
|
64
167
|
private emitPermissionCall;
|
|
65
168
|
/** Fired by the ACP client on session/update. */
|
|
66
169
|
private onSessionUpdate;
|
|
170
|
+
/** Native Claude Code tools run INSIDE the agent: OpenCode never sees them, so after a
|
|
171
|
+
* switch to another model what Claude read, searched or delegated was simply gone.
|
|
172
|
+
* Each one that completes is written into the answer as a short text block — plain
|
|
173
|
+
* text, the only form every model accepts (tools marked provider-executed would be
|
|
174
|
+
* replayed to other providers as calls they don't know). OpenCode's own tools
|
|
175
|
+
* (mcp__opencode__*) are skipped: they're already in the history. */
|
|
176
|
+
private onNativeTool;
|
|
177
|
+
private nativeResultText;
|
|
67
178
|
private closeBlocks;
|
|
68
179
|
private endTurn;
|
|
69
180
|
/** Keep at most MAX_LIVE_SESSIONS conversations alive; tear down the oldest idle ones
|
|
@@ -71,18 +182,37 @@ export declare class ACPOrchestratorModel implements LanguageModelV3 {
|
|
|
71
182
|
private evictIdleSessions;
|
|
72
183
|
/** Resolve every outstanding bridged permission as denied so the agent unblocks. */
|
|
73
184
|
private drainPermissions;
|
|
185
|
+
/** Per-call provider options: V2 nests them under `providerOptionKey(package,
|
|
186
|
+
* providerID)` = the providerID. El fallback al primer objeto del mapa sería
|
|
187
|
+
* voraz (podría tomar opciones de OTRO provider): solo se acepta si la key
|
|
188
|
+
* contiene nuestro provider id (`acp`) o el objeto trae forma conocida
|
|
189
|
+
* (ocSession/ocAgent/resumeId/…/mode/effort/native*); si no, como ausente. */
|
|
190
|
+
private providerOptions;
|
|
74
191
|
/** Provider config overlaid with per-call `providerOptions.acp` (per-agent mode/effort/…). */
|
|
75
192
|
private effectiveCtrl;
|
|
76
193
|
/** Apply runtime config (mode/effort) to a live ACP session via set_mode/set_config_option. */
|
|
77
194
|
private applySessionConfig;
|
|
78
195
|
private ensureConnected;
|
|
79
196
|
private connect;
|
|
197
|
+
private openTransport;
|
|
198
|
+
private spawnAgent;
|
|
199
|
+
/** V2 reads every stream to its end; a cancel only comes from an error or the user
|
|
200
|
+
* aborting (V1 also cancelled to PAUSE for a permission prompt — not anymore). So a
|
|
201
|
+
* cancel ends the turn: the agent stops, deferred calls are released, leftovers are
|
|
202
|
+
* dropped. The session itself — and its prompt cache — stays for the next message. */
|
|
80
203
|
private onCancel;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
204
|
+
private sweeper;
|
|
205
|
+
private startSweeper;
|
|
206
|
+
/** Close sessions nobody is using. Only resumable ones (an OpenCode session id, so
|
|
207
|
+
* the registry can bring them back without a replay); a turn left waiting on
|
|
208
|
+
* OpenCode for hours is treated as abandoned. */
|
|
209
|
+
private sweepIdle;
|
|
85
210
|
cleanup(): void;
|
|
211
|
+
/** Conversation id for logs/recordings: OpenCode's sessionID, else the first-message hash. */
|
|
212
|
+
private convId;
|
|
213
|
+
/** One line per turn decision (file log + recording): the evidence needed to tell a
|
|
214
|
+
* genuine divergence from a false one after the fact. */
|
|
215
|
+
private decide;
|
|
86
216
|
private convertTools;
|
|
87
217
|
/** Nudges the agent can only get from the tool description. Under the default
|
|
88
218
|
* `systemPromptMode: "preset"` OpenCode's system prompt never reaches the agent,
|
|
@@ -91,21 +221,19 @@ export declare class ACPOrchestratorModel implements LanguageModelV3 {
|
|
|
91
221
|
* agent silently assumes instead of asking. A tool description is NOT a system
|
|
92
222
|
* prompt, so this doesn't affect how Anthropic bills the session. */
|
|
93
223
|
private toolDescription;
|
|
94
|
-
/**
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
* than payloads: it must survive re-serialization but change if the turn changes. */
|
|
102
|
-
private msgKey;
|
|
103
|
-
/** How the incoming history relates to what the agent already knows.
|
|
104
|
-
* - append → normal turn (or another agent ran turns meanwhile): send the tail.
|
|
105
|
-
* - revert → the user rewound: the agent can't unremember, so it needs a new session.
|
|
106
|
-
* - diverged → compaction/rollback replaced the middle: same, a new session. */
|
|
107
|
-
private classifyHistory;
|
|
224
|
+
/** Messages the agent hasn't seen, as prompt blocks.
|
|
225
|
+
* - `tail` (live or resumed session): the user's messages verbatim; every run of
|
|
226
|
+
* assistant/tool messages between them was produced by ANOTHER model or agent in
|
|
227
|
+
* OpenCode (the agent's own output is dropped beforehand), and is labelled so —
|
|
228
|
+
* as a bare "Assistant:" the agent took those actions for its own.
|
|
229
|
+
* - `replay` (brand-new session): everything before the current request becomes a
|
|
230
|
+
* bounded `<conversation_history>`; the request itself follows on its own. */
|
|
108
231
|
private blocksFor;
|
|
232
|
+
private replayBlocks;
|
|
233
|
+
/** One message as tagged blocks (for history and other models' turns). Reasoning and
|
|
234
|
+
* the agent's own tool traffic are left out: neither is something to re-read. */
|
|
235
|
+
private renderMessage;
|
|
236
|
+
/** A user message verbatim (text + attachments), minus tags other plugins inject. */
|
|
109
237
|
private messageToBlocks;
|
|
110
238
|
/** A foreign tool-result is replayed only so the agent can follow the thread —
|
|
111
239
|
* the full payload isn't worth the tokens. */
|
|
@@ -115,7 +243,6 @@ export declare class ACPOrchestratorModel implements LanguageModelV3 {
|
|
|
115
243
|
private toBase64;
|
|
116
244
|
/** OpenCode's system text → `_meta.systemPrompt` per mode. */
|
|
117
245
|
private buildSystemPromptMeta;
|
|
118
|
-
private systemText;
|
|
119
246
|
/** The FACTUAL part of OpenCode's system prompt: where we are, what the workspace is,
|
|
120
247
|
* what references exist. Under `preset` the system prompt itself never reaches the
|
|
121
248
|
* agent (forwarding it would get the session billed as extra usage), but this
|
|
@@ -128,22 +255,56 @@ export declare class ACPOrchestratorModel implements LanguageModelV3 {
|
|
|
128
255
|
* small delta at the END of the conversation is cache-safe (the cached prefix is
|
|
129
256
|
* untouched); resending the whole block every turn would not be. */
|
|
130
257
|
private contextBlocks;
|
|
258
|
+
/** What OpenCode appended after the results of a continuation, as prompt blocks:
|
|
259
|
+
* user text verbatim (a steered message, a subagent result, a `<system-update>`), and
|
|
260
|
+
* any assistant prefill (V2's max-steps notice) as an explicit notice. */
|
|
261
|
+
private midTurnBlocks;
|
|
262
|
+
/** Fallback when the agent can't queue a prompt: the extras ride on a tool result. */
|
|
263
|
+
private appendToResult;
|
|
131
264
|
/** Only the last user message (delta for a persistent session). */
|
|
132
265
|
private lastUserBlocks;
|
|
133
266
|
/** Find the live conversation whose deferred tool-calls/permissions this prompt
|
|
134
|
-
* answers.
|
|
267
|
+
* answers. Acotado a la conversación actual (`ocSession`/convKey de ESTA llamada):
|
|
268
|
+
* iterar todas las sesiones cruzaba continuaciones de chats concurrentes. */
|
|
135
269
|
private detectContinuation;
|
|
136
270
|
/** A tool-result is an error/denial when its output type is error-* (OpenCode
|
|
137
271
|
* RejectedError) — used by the permission bridge to map approve vs reject. */
|
|
138
272
|
private isErrorOutput;
|
|
139
|
-
/** Approve a bridged permission ONLY on an explicit positive
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
|
|
273
|
+
/** Approve a bridged permission ONLY on an explicit positive answer to the
|
|
274
|
+
* `question` dialog. Errors, dismissals, and any ambiguous output (including
|
|
275
|
+
* a typed-in answer) fail CLOSED so an unclear verdict never runs the tool.
|
|
276
|
+
* Verificado: OpenCode V2 no expone identificador estable (sin schema de la tool
|
|
277
|
+
* `question` en node_modules/@opencode-ai ni en /opt/OpenCode/resources; el shape
|
|
278
|
+
* documentado es etiqueta en `{ answers: [["…"]] }` o texto renderizado) → match
|
|
279
|
+
* por etiqueta normalizada (minúsculas, trim, "_" y espacios colapsados) con
|
|
280
|
+
* fallback deny ante cualquier cosa no reconocida. Flujo de 3 opciones intacto. */
|
|
281
|
+
private questionVerdict;
|
|
282
|
+
/** Normaliza una etiqueta de respuesta para el match robusto. */
|
|
283
|
+
private normalizeAnswer;
|
|
284
|
+
/** The chosen label: typed output (`{ answers: [["Always allow"]] }`) first,
|
|
285
|
+
* then the rendered text fallback (`"question"="Always allow"`). */
|
|
286
|
+
private answerLabel;
|
|
143
287
|
private outputToText;
|
|
144
288
|
/** OpenCode tool output → MCP CallToolResult. Structured content (images from a
|
|
145
289
|
* `read`, mixed blocks) is mapped through rather than flattened to a string, so
|
|
146
290
|
* the agent sees what OpenCode actually returned. */
|
|
147
291
|
private toMcpResult;
|
|
148
292
|
}
|
|
293
|
+
/** One OpenCode model served by a shared orchestrator. Every model of the provider
|
|
294
|
+
* talks to the SAME agent process and session map: switching opus ↔ sonnet mid-
|
|
295
|
+
* conversation is a `session/set_model` on the live session, not a second process
|
|
296
|
+
* resuming a session that is still open in the first one. */
|
|
297
|
+
export declare class ACPModelView implements LanguageModelV3 {
|
|
298
|
+
private readonly core;
|
|
299
|
+
readonly modelId: string;
|
|
300
|
+
readonly specificationVersion: "v3";
|
|
301
|
+
readonly provider = "acp";
|
|
302
|
+
readonly supportedUrls: Record<string, RegExp[]>;
|
|
303
|
+
constructor(core: ACPOrchestratorModel, modelId: string);
|
|
304
|
+
doStream(options: LanguageModelV3CallOptions): Promise<{
|
|
305
|
+
stream: ReadableStream<LanguageModelV3StreamPart>;
|
|
306
|
+
warnings: never[];
|
|
307
|
+
}>;
|
|
308
|
+
doGenerate(options: LanguageModelV3CallOptions): Promise<LanguageModelV3GenerateResult>;
|
|
309
|
+
}
|
|
149
310
|
//# sourceMappingURL=model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/provider/model.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/provider/model.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EACV,eAAe,EACf,0BAA0B,EAC1B,yBAAyB,EACzB,6BAA6B,EAG9B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AAiFjC,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EA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