@dsh-cc/acp 0.0.0-stage → 0.9.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/LICENSE-harness +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +4 -2
- package/README.zh.md +5 -0
- package/lib/codec.d.ts +13 -0
- package/lib/codec.d.ts.map +1 -0
- package/lib/codec.js +36 -0
- package/lib/codec.js.map +1 -0
- package/lib/content.d.ts +50 -0
- package/lib/content.d.ts.map +1 -0
- package/lib/content.js +217 -0
- package/lib/content.js.map +1 -0
- package/lib/index.d.ts +37 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +514 -0
- package/lib/index.js.map +1 -0
- package/lib/mcp.d.ts +15 -0
- package/lib/mcp.d.ts.map +1 -0
- package/lib/mcp.js +135 -0
- package/lib/mcp.js.map +1 -0
- package/lib/model-control.d.ts +62 -0
- package/lib/model-control.d.ts.map +1 -0
- package/lib/model-control.js +222 -0
- package/lib/model-control.js.map +1 -0
- package/lib/session.d.ts +135 -0
- package/lib/session.d.ts.map +1 -0
- package/lib/session.js +483 -0
- package/lib/session.js.map +1 -0
- package/lib/updates.d.ts +26 -0
- package/lib/updates.d.ts.map +1 -0
- package/lib/updates.js +100 -0
- package/lib/updates.js.map +1 -0
- package/lib/version.d.ts +13 -0
- package/lib/version.d.ts.map +1 -0
- package/lib/version.js +30 -0
- package/lib/version.js.map +1 -0
- package/package.json +71 -3
package/lib/session.js
ADDED
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
// Vendored from @deepseek-ai/dsh-acp (packages/acp/acp/src/session.ts)
|
|
2
|
+
// Source ref: c1b47e41fcd54d20a0f061df28683bfc29ee24e5 (deepseek-harness, MIT — see LICENSE-harness)
|
|
3
|
+
// Copied 2026-10-09. Structural fixes flow from upstream during harness
|
|
4
|
+
// migrations; CC-specific divergences must be recorded in DIVERGENCE.md.
|
|
5
|
+
/** One standard ACP session's Agent, configuration, prompt, update, and teardown lifecycle. */
|
|
6
|
+
import { RequestError, } from '@agentclientprotocol/sdk';
|
|
7
|
+
import { createUserMessage, errorChain } from '@deepseek-ai/dsh-llm';
|
|
8
|
+
import { AcpContentError, admitAcpPrompt } from "./content.js";
|
|
9
|
+
import { turnEndToStopReason } from "./codec.js";
|
|
10
|
+
import { mountAcpMcpServers } from "./mcp.js";
|
|
11
|
+
import { AcpModelControl } from "./model-control.js";
|
|
12
|
+
import { assistantUpdates, toolCallUpdate, toolResultUpdate } from "./updates.js";
|
|
13
|
+
/** Standard invalid-parameter failure with protocol-safe detail. */
|
|
14
|
+
function invalidParams(detail) {
|
|
15
|
+
return RequestError.invalidParams(undefined, detail);
|
|
16
|
+
}
|
|
17
|
+
/** Standard internal failure with protocol-safe detail. */
|
|
18
|
+
function internalError(detail) {
|
|
19
|
+
return RequestError.internalError(undefined, detail);
|
|
20
|
+
}
|
|
21
|
+
/** Restore the latest logged route before falling back to deployment config. */
|
|
22
|
+
function selectionFor(logged, fallback) {
|
|
23
|
+
return logged === undefined
|
|
24
|
+
? fallback
|
|
25
|
+
: {
|
|
26
|
+
provider: logged.config.provider,
|
|
27
|
+
model: logged.config.model,
|
|
28
|
+
...logged.config.reasoningEffort === undefined || logged.adapterDefaults?.reasoningEffort === true
|
|
29
|
+
? {}
|
|
30
|
+
: { reasoningEffort: logged.config.reasoningEffort },
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Per-session ACP module. It owns the unpublished Agent composition, selected
|
|
35
|
+
* route, one-prompt admission slot, ordered standard updates, and memoized
|
|
36
|
+
* quiescent teardown.
|
|
37
|
+
*/
|
|
38
|
+
export class AcpSession {
|
|
39
|
+
ctx;
|
|
40
|
+
notify;
|
|
41
|
+
/** The exact top-level Agent owned by this ACP session. */
|
|
42
|
+
agent;
|
|
43
|
+
modelControl;
|
|
44
|
+
outputTail = Promise.resolve();
|
|
45
|
+
inflight;
|
|
46
|
+
closing;
|
|
47
|
+
pendingSelections = new Map();
|
|
48
|
+
constructor(ctx, handle, modelControl, notify) {
|
|
49
|
+
this.ctx = ctx;
|
|
50
|
+
this.notify = notify;
|
|
51
|
+
this.agent = handle.agent;
|
|
52
|
+
this.modelControl = modelControl;
|
|
53
|
+
this.disposeAgent = () => handle.dispose();
|
|
54
|
+
}
|
|
55
|
+
disposeAgent;
|
|
56
|
+
/**
|
|
57
|
+
* Compose a fresh Agent and all requested MCP clients before publication.
|
|
58
|
+
* @param ctx - ACP plugin context with Agent, LLM, and persistence services.
|
|
59
|
+
* @param options - fresh session identity, workspace, route, MCP, and notifier.
|
|
60
|
+
* @returns the fully composed per-session module.
|
|
61
|
+
*/
|
|
62
|
+
static async create(ctx, options) {
|
|
63
|
+
const modelControl = new AcpModelControl(ctx.llm, options.fallbackSelection);
|
|
64
|
+
const handle = await ctx.agents.create({
|
|
65
|
+
sessionId: options.sessionId,
|
|
66
|
+
// §5.2 (docs/plans/2026-10-09-acp-m2-own-plugin.md): the create header
|
|
67
|
+
// records the composed preset identity (frozen creation fact, copied
|
|
68
|
+
// into the header by agents.create — core/session/src/index.ts:1058).
|
|
69
|
+
meta: { cwd: options.cwd, agentPreset: options.presetId },
|
|
70
|
+
agentOptions: options.agentOptions,
|
|
71
|
+
signal: options.signal,
|
|
72
|
+
setup: async (agentCtx) => {
|
|
73
|
+
// §5.2, revised after live acceptance (2026-10-09): the preset join
|
|
74
|
+
// moved OUT of the create setup — mount() inside setup double-applies
|
|
75
|
+
// the roster rows in the composed profile (persona/command
|
|
76
|
+
// double-registration surfacing at session/new). The join now runs
|
|
77
|
+
// on the serial `agent/created` event via registry select() in
|
|
78
|
+
// index.ts (the live-verified P2b form; select also appends the
|
|
79
|
+
// model-visible `agent-preset/selected` event). Setup keeps the
|
|
80
|
+
// remaining order: model control, then MCP (mounts plugins
|
|
81
|
+
// immediately, so it goes last).
|
|
82
|
+
modelControl.install(agentCtx);
|
|
83
|
+
await mountAcpMcpServers(agentCtx, options.mcpServers, options.cwd);
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
return new AcpSession(ctx, handle, modelControl, options.notify);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Restore a persisted Agent and compose the request's fresh MCP connections.
|
|
90
|
+
* @param ctx - ACP plugin context with Agent, LLM, and persistence services.
|
|
91
|
+
* @param options - persisted identity, workspace, fallback route, MCP, and notifier.
|
|
92
|
+
* @returns the restored per-session module.
|
|
93
|
+
*/
|
|
94
|
+
static async resume(ctx, options) {
|
|
95
|
+
let modelControl;
|
|
96
|
+
const handle = await ctx.agents.resume({
|
|
97
|
+
resumeSessionId: options.sessionId,
|
|
98
|
+
agentOptions: options.agentOptions,
|
|
99
|
+
signal: options.signal,
|
|
100
|
+
setup: async (agentCtx, agent) => {
|
|
101
|
+
// §5.2, revised after live acceptance (2026-10-09): the preset join
|
|
102
|
+
// runs on the serial `agent/created` event (index.ts) for resumed
|
|
103
|
+
// agents too — it joins the RECORDED header stamp, so a presetless
|
|
104
|
+
// session stays presetless and an unrecorded id fails loudly
|
|
105
|
+
// through select(). Resume therefore only re-installs model control
|
|
106
|
+
// and MCP here.
|
|
107
|
+
modelControl = new AcpModelControl(ctx.llm, selectionFor(agent.session.requestHeader(), options.fallbackSelection));
|
|
108
|
+
modelControl.install(agentCtx);
|
|
109
|
+
await mountAcpMcpServers(agentCtx, options.mcpServers, options.cwd);
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
/* v8 ignore start -- a fulfilled Agent resume necessarily ran setup to completion. */
|
|
113
|
+
if (modelControl === undefined) {
|
|
114
|
+
await handle.dispose();
|
|
115
|
+
throw internalError('session/resume did not compose model selection');
|
|
116
|
+
}
|
|
117
|
+
/* v8 ignore stop */
|
|
118
|
+
return new AcpSession(ctx, handle, modelControl, options.notify);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Whether this module owns an exact Agent reference.
|
|
122
|
+
* @param agent - Agent observed on a scoped runtime event.
|
|
123
|
+
* @returns true only for this session's owned Agent.
|
|
124
|
+
*/
|
|
125
|
+
owns(agent) {
|
|
126
|
+
return this.agent === agent;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Whether this module owns an exact Session reference.
|
|
130
|
+
* @param session - Session observed on a durable event.
|
|
131
|
+
* @returns true only for this session's owned Session.
|
|
132
|
+
*/
|
|
133
|
+
ownsSession(session) {
|
|
134
|
+
return this.agent.session === session;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Return the complete standard model configuration state.
|
|
138
|
+
* @param signal - optional request cancellation.
|
|
139
|
+
* @returns provider-grouped model and exact-model reasoning options.
|
|
140
|
+
*/
|
|
141
|
+
configOptions(signal) {
|
|
142
|
+
this.assertActive();
|
|
143
|
+
return this.modelControl.options(signal);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Apply one standard configuration option to later ACP turns.
|
|
147
|
+
* @param configId - advertised standard option id.
|
|
148
|
+
* @param value - selected standard option value.
|
|
149
|
+
* @param signal - optional request cancellation.
|
|
150
|
+
* @returns the complete resulting option state.
|
|
151
|
+
*/
|
|
152
|
+
setConfig(configId, value, signal) {
|
|
153
|
+
this.assertActive();
|
|
154
|
+
return this.modelControl.set(configId, value, signal);
|
|
155
|
+
}
|
|
156
|
+
/** Resolve topology state off-chain, then serialize its notification without blocking execution updates. */
|
|
157
|
+
topologyChanged() {
|
|
158
|
+
if (this.closing !== undefined)
|
|
159
|
+
return;
|
|
160
|
+
void this.modelControl.options()
|
|
161
|
+
.then((configOptions) => {
|
|
162
|
+
if (this.closing !== undefined)
|
|
163
|
+
return;
|
|
164
|
+
const previous = this.outputTail;
|
|
165
|
+
this.outputTail = previous
|
|
166
|
+
.then(() => this.notify({
|
|
167
|
+
sessionId: this.agent.session.id,
|
|
168
|
+
update: { sessionUpdate: 'config_option_update', configOptions },
|
|
169
|
+
}))
|
|
170
|
+
/* v8 ignore start -- the bridge notifier contains transport failure. */
|
|
171
|
+
.catch((error) => {
|
|
172
|
+
this.ctx.logger.warn(`acp: config-option update failed: ${errorChain(error)}`);
|
|
173
|
+
});
|
|
174
|
+
/* v8 ignore stop */
|
|
175
|
+
})
|
|
176
|
+
/* v8 ignore start -- option discovery contains per-provider failure. */
|
|
177
|
+
.catch((error) => {
|
|
178
|
+
this.ctx.logger.warn(`acp: config-option update failed: ${errorChain(error)}`);
|
|
179
|
+
});
|
|
180
|
+
/* v8 ignore stop */
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Admit, enqueue, and settle one prompt at whole-Agent quiescence.
|
|
184
|
+
* @param params - standard ACP prompt request for this session.
|
|
185
|
+
* @param imageEnabled - connection capability advertised at initialization.
|
|
186
|
+
* @param requestSignal - JSON-RPC request cancellation signal.
|
|
187
|
+
* @returns the correlated standard stop reason after ordered updates drain.
|
|
188
|
+
*/
|
|
189
|
+
async prompt(params, imageEnabled, requestSignal) {
|
|
190
|
+
this.assertActive();
|
|
191
|
+
if (this.inflight !== undefined)
|
|
192
|
+
throw invalidParams('a prompt is already in flight for this session');
|
|
193
|
+
const completion = Promise.withResolvers();
|
|
194
|
+
const admission = Promise.withResolvers();
|
|
195
|
+
const admissionController = new AbortController();
|
|
196
|
+
const inflight = {
|
|
197
|
+
resolve: completion.resolve,
|
|
198
|
+
reject: completion.reject,
|
|
199
|
+
messageId: undefined,
|
|
200
|
+
messageQueued: false,
|
|
201
|
+
turn: undefined,
|
|
202
|
+
endReason: undefined,
|
|
203
|
+
admissionDone: admission.promise,
|
|
204
|
+
finishAdmission: admission.resolve,
|
|
205
|
+
admissionController,
|
|
206
|
+
cancelRequested: false,
|
|
207
|
+
settlementStarted: false,
|
|
208
|
+
outputError: undefined,
|
|
209
|
+
agentError: undefined,
|
|
210
|
+
};
|
|
211
|
+
this.inflight = inflight;
|
|
212
|
+
const onRequestAbort = () => { this.cancelPrompt('ACP prompt request cancelled'); };
|
|
213
|
+
requestSignal?.addEventListener('abort', onRequestAbort, { once: true });
|
|
214
|
+
/* v8 ignore next -- the SDK dispatches a live signal, then notifies abort through its listener. */
|
|
215
|
+
if (requestSignal?.aborted === true)
|
|
216
|
+
onRequestAbort();
|
|
217
|
+
try {
|
|
218
|
+
let admissionFailure;
|
|
219
|
+
const promptSelection = this.modelControl.snapshot();
|
|
220
|
+
try {
|
|
221
|
+
if (this.ctx.agents.get(this.agent.id) !== this.agent) {
|
|
222
|
+
throw internalError('prompt was not queued: the agent was disposed outside the bridge');
|
|
223
|
+
}
|
|
224
|
+
const content = await admitAcpPrompt(this.ctx, promptSelection, params.prompt, imageEnabled, admissionController.signal);
|
|
225
|
+
admissionController.signal.throwIfAborted();
|
|
226
|
+
if (this.ctx.agents.get(this.agent.id) !== this.agent) {
|
|
227
|
+
throw internalError('prompt was not queued: the agent was disposed outside the bridge');
|
|
228
|
+
}
|
|
229
|
+
const message = createUserMessage({
|
|
230
|
+
content,
|
|
231
|
+
source: { kind: 'user' },
|
|
232
|
+
});
|
|
233
|
+
inflight.messageId = message.id;
|
|
234
|
+
inflight.messageQueued = true;
|
|
235
|
+
if (promptSelection !== undefined)
|
|
236
|
+
this.pendingSelections.set(message.id, promptSelection);
|
|
237
|
+
try {
|
|
238
|
+
this.agent.followup(message);
|
|
239
|
+
}
|
|
240
|
+
catch (error) {
|
|
241
|
+
inflight.messageQueued = false;
|
|
242
|
+
this.pendingSelections.delete(message.id);
|
|
243
|
+
throw error;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
admissionFailure = error;
|
|
248
|
+
}
|
|
249
|
+
finally {
|
|
250
|
+
inflight.finishAdmission();
|
|
251
|
+
}
|
|
252
|
+
if (inflight.cancelRequested) {
|
|
253
|
+
this.settleAfterQuiescence(inflight);
|
|
254
|
+
return { stopReason: await completion.promise };
|
|
255
|
+
}
|
|
256
|
+
if (admissionFailure !== undefined) {
|
|
257
|
+
this.inflight = undefined;
|
|
258
|
+
if (admissionFailure instanceof AcpContentError) {
|
|
259
|
+
throw admissionFailure.kind === 'invalid'
|
|
260
|
+
? invalidParams(admissionFailure.message)
|
|
261
|
+
: internalError(admissionFailure.message);
|
|
262
|
+
}
|
|
263
|
+
if (admissionFailure instanceof RequestError)
|
|
264
|
+
throw admissionFailure;
|
|
265
|
+
throw internalError(`prompt was not queued: ${admissionFailure.message}`);
|
|
266
|
+
}
|
|
267
|
+
this.settleAfterQuiescence(inflight);
|
|
268
|
+
return { stopReason: await completion.promise };
|
|
269
|
+
}
|
|
270
|
+
finally {
|
|
271
|
+
requestSignal?.removeEventListener('abort', onRequestAbort);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
/** Cancel the active prompt, or autonomous work when no ACP prompt exists. */
|
|
275
|
+
cancel() {
|
|
276
|
+
const inflight = this.inflight;
|
|
277
|
+
this.cancelPrompt('ACP prompt cancelled');
|
|
278
|
+
if (inflight === undefined)
|
|
279
|
+
this.agent.cancel({ kind: 'user' });
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Process one durable event and enqueue its standard ACP projections.
|
|
283
|
+
* @param session - exact event-owning Session.
|
|
284
|
+
* @param event - committed durable event.
|
|
285
|
+
*/
|
|
286
|
+
onSessionEvent(session, event) {
|
|
287
|
+
try {
|
|
288
|
+
if (event.type === 'assistant/message') {
|
|
289
|
+
const inflight = this.inflight?.turn === event.data.turn ? this.inflight : undefined;
|
|
290
|
+
const previous = this.outputTail;
|
|
291
|
+
const delivery = previous.then(async () => {
|
|
292
|
+
for (const update of await assistantUpdates(this.ctx, session, event)) {
|
|
293
|
+
await this.notify({ sessionId: this.agent.session.id, update });
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
this.outputTail = delivery.catch((error) => {
|
|
297
|
+
const failure = error;
|
|
298
|
+
if (inflight !== undefined)
|
|
299
|
+
inflight.outputError ??= failure;
|
|
300
|
+
this.ctx.logger.warn(`acp: assistant output conversion failed: ${errorChain(error)}`);
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
else if (event.type === 'tool/call') {
|
|
304
|
+
const previous = this.outputTail;
|
|
305
|
+
this.outputTail = previous
|
|
306
|
+
.then(() => this.notify({ sessionId: this.agent.session.id, update: toolCallUpdate(event) }))
|
|
307
|
+
/* v8 ignore start -- the bridge notifier contains transport rejection. */
|
|
308
|
+
.catch((error) => {
|
|
309
|
+
this.ctx.logger.warn(`acp: tool-call update delivery failed: ${errorChain(error)}`);
|
|
310
|
+
});
|
|
311
|
+
/* v8 ignore stop */
|
|
312
|
+
}
|
|
313
|
+
else if (event.type === 'tool/result') {
|
|
314
|
+
const previous = this.outputTail;
|
|
315
|
+
this.outputTail = previous
|
|
316
|
+
.then(async () => this.notify({
|
|
317
|
+
sessionId: this.agent.session.id,
|
|
318
|
+
update: await toolResultUpdate(this.ctx, event),
|
|
319
|
+
}))
|
|
320
|
+
/* v8 ignore start -- supplemental-content conversion failure is contained and cannot fail Agent work. */
|
|
321
|
+
.catch((error) => {
|
|
322
|
+
this.ctx.logger.warn(`acp: tool-result update delivery failed: ${errorChain(error)}`);
|
|
323
|
+
});
|
|
324
|
+
/* v8 ignore stop */
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
finally {
|
|
328
|
+
const inflight = this.inflight;
|
|
329
|
+
if (inflight !== undefined && event.type === 'turn/end' && inflight.turn === event.data.turn) {
|
|
330
|
+
inflight.endReason = event.data.reason;
|
|
331
|
+
}
|
|
332
|
+
if (event.type === 'turn/end')
|
|
333
|
+
this.modelControl.releaseTurn(event.data.turn);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Correlate an accepted user message with its Agent turn and pinned route.
|
|
338
|
+
* @param message - claimed durable inbox message.
|
|
339
|
+
* @param turn - allocated Agent turn.
|
|
340
|
+
*/
|
|
341
|
+
onInboxClaimed(message, turn) {
|
|
342
|
+
if (this.inflight !== undefined && this.inflight.messageId === message.id)
|
|
343
|
+
this.inflight.turn = turn;
|
|
344
|
+
const selection = this.pendingSelections.get(message.id);
|
|
345
|
+
this.pendingSelections.delete(message.id);
|
|
346
|
+
if (selection !== undefined)
|
|
347
|
+
this.modelControl.pinTurn(turn, selection);
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Correlate an Agent interval failure with the active ACP prompt.
|
|
351
|
+
* @param turn - failed turn number.
|
|
352
|
+
* @param error - original same-process failure.
|
|
353
|
+
*/
|
|
354
|
+
onAgentError(turn, error) {
|
|
355
|
+
const inflight = this.inflight;
|
|
356
|
+
if (inflight === undefined || !inflight.messageQueued)
|
|
357
|
+
return;
|
|
358
|
+
// AgentLoop balances an in-turn failure with durable turn/end; settlement
|
|
359
|
+
// reads that exact error reason. This slot records interval failures outside it.
|
|
360
|
+
if (inflight.turn === turn)
|
|
361
|
+
return;
|
|
362
|
+
inflight.agentError = new Error(errorChain(error));
|
|
363
|
+
this.settleAfterQuiescence(inflight);
|
|
364
|
+
}
|
|
365
|
+
/** Await every update queued before this call. */
|
|
366
|
+
drainUpdates() {
|
|
367
|
+
return this.outputTail;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Cancel, drain, flush, and dispose this session once.
|
|
371
|
+
* @param detail - cancellation detail for any prompt still in admission.
|
|
372
|
+
* @returns the shared quiescent teardown promise.
|
|
373
|
+
*/
|
|
374
|
+
close(detail) {
|
|
375
|
+
if (this.closing !== undefined)
|
|
376
|
+
return this.closing;
|
|
377
|
+
this.closing = (async () => {
|
|
378
|
+
const failures = [];
|
|
379
|
+
const inflight = this.inflight;
|
|
380
|
+
this.cancelPrompt(detail);
|
|
381
|
+
if (inflight === undefined || !inflight.messageQueued)
|
|
382
|
+
this.agent.cancel({ kind: 'user' });
|
|
383
|
+
try {
|
|
384
|
+
await inflight?.admissionDone;
|
|
385
|
+
await this.agent.whenIdle();
|
|
386
|
+
await this.outputTail;
|
|
387
|
+
}
|
|
388
|
+
catch (error) {
|
|
389
|
+
failures.push(new Error('ACP session activity drain failed', { cause: error }));
|
|
390
|
+
}
|
|
391
|
+
const subagents = this.ctx.get('subagents');
|
|
392
|
+
try {
|
|
393
|
+
await subagents?.drainContinuableDescendants([this.agent]);
|
|
394
|
+
}
|
|
395
|
+
catch (error) {
|
|
396
|
+
this.ctx.logger.warn(`acp: continuable subagent teardown failed: ${errorChain(error)}`);
|
|
397
|
+
failures.push(new Error('continuable subagent teardown failed', { cause: error }));
|
|
398
|
+
}
|
|
399
|
+
try {
|
|
400
|
+
await this.ctx.sessions.flush(this.agent.session);
|
|
401
|
+
}
|
|
402
|
+
catch (error) {
|
|
403
|
+
failures.push(new Error('ACP session persistence flush failed', { cause: error }));
|
|
404
|
+
}
|
|
405
|
+
try {
|
|
406
|
+
await this.disposeAgent();
|
|
407
|
+
}
|
|
408
|
+
catch (error) {
|
|
409
|
+
failures.push(error);
|
|
410
|
+
}
|
|
411
|
+
this.pendingSelections.clear();
|
|
412
|
+
if (failures.length === 1)
|
|
413
|
+
throw failures[0];
|
|
414
|
+
/* v8 ignore start -- independent teardown failures can aggregate only under multiple simultaneous provider faults. */
|
|
415
|
+
if (failures.length > 1) {
|
|
416
|
+
throw new AggregateError(failures, `ACP session teardown failed: ${failures.map(errorChain).join('; ')}`);
|
|
417
|
+
}
|
|
418
|
+
/* v8 ignore stop */
|
|
419
|
+
})();
|
|
420
|
+
return this.closing;
|
|
421
|
+
}
|
|
422
|
+
assertActive() {
|
|
423
|
+
if (this.closing !== undefined)
|
|
424
|
+
throw invalidParams(`session is closing: ${this.agent.session.id}`);
|
|
425
|
+
}
|
|
426
|
+
cancelPrompt(detail) {
|
|
427
|
+
const inflight = this.inflight;
|
|
428
|
+
if (inflight === undefined)
|
|
429
|
+
return;
|
|
430
|
+
inflight.cancelRequested = true;
|
|
431
|
+
inflight.admissionController.abort(new Error(detail));
|
|
432
|
+
this.settleAfterQuiescence(inflight);
|
|
433
|
+
if (inflight.messageQueued)
|
|
434
|
+
this.agent.cancel({ kind: 'user' });
|
|
435
|
+
}
|
|
436
|
+
settleAfterQuiescence(inflight) {
|
|
437
|
+
if (inflight.settlementStarted)
|
|
438
|
+
return;
|
|
439
|
+
inflight.settlementStarted = true;
|
|
440
|
+
void (async () => {
|
|
441
|
+
await inflight.admissionDone;
|
|
442
|
+
if (inflight.messageQueued) {
|
|
443
|
+
await this.agent.whenIdle();
|
|
444
|
+
await this.outputTail;
|
|
445
|
+
}
|
|
446
|
+
/* v8 ignore next -- this prompt owns the slot until this exact settlement clears it. */
|
|
447
|
+
if (this.inflight !== inflight)
|
|
448
|
+
return;
|
|
449
|
+
this.inflight = undefined;
|
|
450
|
+
if (inflight.cancelRequested) {
|
|
451
|
+
inflight.resolve('cancelled');
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
if (inflight.outputError !== undefined) {
|
|
455
|
+
inflight.reject(internalError(`assistant output delivery failed: ${inflight.outputError.message}`));
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
if (inflight.agentError !== undefined) {
|
|
459
|
+
inflight.reject(internalError(`turn failed: ${inflight.agentError.message}`));
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
const end = inflight.endReason;
|
|
463
|
+
if (end === undefined) {
|
|
464
|
+
inflight.resolve('cancelled');
|
|
465
|
+
}
|
|
466
|
+
else if (end.kind === 'error') {
|
|
467
|
+
inflight.reject(internalError(`turn failed: ${end.error.message}`));
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
inflight.resolve(turnEndToStopReason(end));
|
|
471
|
+
}
|
|
472
|
+
})()
|
|
473
|
+
/* v8 ignore start -- admissionDone only resolves; idle/output gates contain their own failures. */
|
|
474
|
+
.catch((error) => {
|
|
475
|
+
if (this.inflight !== inflight)
|
|
476
|
+
return;
|
|
477
|
+
this.inflight = undefined;
|
|
478
|
+
inflight.reject(internalError(`prompt settlement failed: ${errorChain(error)}`));
|
|
479
|
+
});
|
|
480
|
+
/* v8 ignore stop */
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
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CAAqC,QAAQ,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;gBACnG,OAAM;YACR,CAAC;YACD,IAAI,QAAQ,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;gBACtC,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,gBAAgB,QAAQ,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;gBAC7E,OAAM;YACR,CAAC;YACD,MAAM,GAAG,GAAG,QAAQ,CAAC,SAAS,CAAA;YAC9B,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;gBACtB,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;YAC/B,CAAC;iBAAM,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;gBAChC,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,gBAAgB,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;YACrE,CAAC;iBAAM,CAAC;gBACN,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAA;YAC5C,CAAC;QACH,CAAC,CAAC,EAAE;YACF,mGAAmG;aAClG,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YACxB,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ;gBAAE,OAAM;YACtC,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAA;YACzB,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,6BAA6B,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAA;QAClF,CAAC,CAAC,CAAA;QACJ,oBAAoB;IACtB,CAAC;CACF"}
|
package/lib/updates.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Standard ACP updates derived from committed DSH session events. */
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
+
import type { SessionUpdate } from '@agentclientprotocol/sdk';
|
|
4
|
+
import type { Session, SessionEvent } from '@deepseek-ai/dsh-session';
|
|
5
|
+
/**
|
|
6
|
+
* Convert one committed assistant message and its context usage in block order.
|
|
7
|
+
* @param ctx - bridge context carrying attachment and token-meter services.
|
|
8
|
+
* @param session - durable session used for context pressure.
|
|
9
|
+
* @param event - committed assistant message event.
|
|
10
|
+
* @returns ordered standard thought, message, and optional usage updates.
|
|
11
|
+
*/
|
|
12
|
+
export declare function assistantUpdates(ctx: Context, session: Session, event: SessionEvent<'assistant/message'>): Promise<SessionUpdate[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Start one generic ACP tool lifecycle from the durable call fact.
|
|
15
|
+
* @param event - committed DSH tool-call event.
|
|
16
|
+
* @returns the standard generic tool-call update.
|
|
17
|
+
*/
|
|
18
|
+
export declare function toolCallUpdate(event: SessionEvent<'tool/call'>): SessionUpdate;
|
|
19
|
+
/**
|
|
20
|
+
* Finish one generic ACP tool lifecycle from its committed model-facing result.
|
|
21
|
+
* @param ctx - bridge context carrying the attachment store.
|
|
22
|
+
* @param event - committed DSH tool-result event.
|
|
23
|
+
* @returns the standard completed or failed tool-call update.
|
|
24
|
+
*/
|
|
25
|
+
export declare function toolResultUpdate(ctx: Context, event: SessionEvent<'tool/result'>): Promise<SessionUpdate>;
|
|
26
|
+
//# sourceMappingURL=updates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updates.d.ts","sourceRoot":"","sources":["../src/updates.ts"],"names":[],"mappings":"AAIA,sEAAsE;AAEtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,aAAa,EAAmB,MAAM,0BAA0B,CAAA;AAC9E,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIrE;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,YAAY,CAAC,mBAAmB,CAAC,GACvC,OAAO,CAAC,aAAa,EAAE,CAAC,CAyB1B;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,CAAC,WAAW,CAAC,GAAG,aAAa,CAS9E;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,YAAY,CAAC,aAAa,CAAC,GACjC,OAAO,CAAC,aAAa,CAAC,CAaxB"}
|
package/lib/updates.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// Vendored from @deepseek-ai/dsh-acp (packages/acp/acp/src/updates.ts)
|
|
2
|
+
// Source ref: c1b47e41fcd54d20a0f061df28683bfc29ee24e5 (deepseek-harness, MIT — see LICENSE-harness)
|
|
3
|
+
// Copied 2026-10-09. Structural fixes flow from upstream during harness
|
|
4
|
+
// migrations; CC-specific divergences must be recorded in DIVERGENCE.md.
|
|
5
|
+
/** Standard ACP updates derived from committed DSH session events. */
|
|
6
|
+
import { assistantBlockToAcp } from "./content.js";
|
|
7
|
+
/**
|
|
8
|
+
* Convert one committed assistant message and its context usage in block order.
|
|
9
|
+
* @param ctx - bridge context carrying attachment and token-meter services.
|
|
10
|
+
* @param session - durable session used for context pressure.
|
|
11
|
+
* @param event - committed assistant message event.
|
|
12
|
+
* @returns ordered standard thought, message, and optional usage updates.
|
|
13
|
+
*/
|
|
14
|
+
export async function assistantUpdates(ctx, session, event) {
|
|
15
|
+
const updates = [];
|
|
16
|
+
for (const block of event.data.message.content) {
|
|
17
|
+
if (block.type === 'reasoning') {
|
|
18
|
+
if (block.text.length > 0) {
|
|
19
|
+
updates.push({
|
|
20
|
+
sessionUpdate: 'agent_thought_chunk',
|
|
21
|
+
messageId: event.data.message.id,
|
|
22
|
+
content: { type: 'text', text: block.text },
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
const content = await assistantBlockToAcp(ctx, block);
|
|
28
|
+
if (content !== undefined) {
|
|
29
|
+
updates.push({
|
|
30
|
+
sessionUpdate: 'agent_message_chunk',
|
|
31
|
+
messageId: event.data.message.id,
|
|
32
|
+
content,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const usage = usageUpdate(ctx, session, event);
|
|
37
|
+
if (usage !== undefined)
|
|
38
|
+
updates.push(usage);
|
|
39
|
+
return updates;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Start one generic ACP tool lifecycle from the durable call fact.
|
|
43
|
+
* @param event - committed DSH tool-call event.
|
|
44
|
+
* @returns the standard generic tool-call update.
|
|
45
|
+
*/
|
|
46
|
+
export function toolCallUpdate(event) {
|
|
47
|
+
return {
|
|
48
|
+
sessionUpdate: 'tool_call',
|
|
49
|
+
toolCallId: event.data.callId,
|
|
50
|
+
title: event.data.name,
|
|
51
|
+
kind: 'other',
|
|
52
|
+
status: 'in_progress',
|
|
53
|
+
rawInput: parseToolArguments(event.data.arguments),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Finish one generic ACP tool lifecycle from its committed model-facing result.
|
|
58
|
+
* @param ctx - bridge context carrying the attachment store.
|
|
59
|
+
* @param event - committed DSH tool-result event.
|
|
60
|
+
* @returns the standard completed or failed tool-call update.
|
|
61
|
+
*/
|
|
62
|
+
export async function toolResultUpdate(ctx, event) {
|
|
63
|
+
const message = event.data.message;
|
|
64
|
+
const content = [];
|
|
65
|
+
for (const block of message.content) {
|
|
66
|
+
const converted = await assistantBlockToAcp(ctx, block);
|
|
67
|
+
if (converted !== undefined)
|
|
68
|
+
content.push({ type: 'content', content: converted });
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
sessionUpdate: 'tool_call_update',
|
|
72
|
+
toolCallId: message.toolCallId,
|
|
73
|
+
status: message.isError === true ? 'failed' : 'completed',
|
|
74
|
+
content,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** Report current context occupancy only when DSH has both usage and capacity facts. */
|
|
78
|
+
function usageUpdate(ctx, session, event) {
|
|
79
|
+
if (event.data.usage === undefined)
|
|
80
|
+
return undefined;
|
|
81
|
+
const size = session.requestContext()?.contextWindow;
|
|
82
|
+
const meter = ctx.get('tokenMeter');
|
|
83
|
+
if (size === undefined || meter === undefined)
|
|
84
|
+
return undefined;
|
|
85
|
+
return {
|
|
86
|
+
sessionUpdate: 'usage_update',
|
|
87
|
+
used: meter.measure(session).totalTokens,
|
|
88
|
+
size,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/** Preserve malformed model output as opaque input instead of dropping the call update. */
|
|
92
|
+
function parseToolArguments(value) {
|
|
93
|
+
try {
|
|
94
|
+
return JSON.parse(value);
|
|
95
|
+
}
|
|
96
|
+
catch (_invalidModelJson) {
|
|
97
|
+
return value;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=updates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updates.js","sourceRoot":"","sources":["../src/updates.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,qGAAqG;AACrG,wEAAwE;AACxE,yEAAyE;AACzE,sEAAsE;AAMtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAElD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,GAAY,EACZ,OAAgB,EAChB,KAAwC;IAExC,MAAM,OAAO,GAAoB,EAAE,CAAA;IACnC,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAC/C,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YAC/B,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC1B,OAAO,CAAC,IAAI,CAAC;oBACX,aAAa,EAAE,qBAAqB;oBACpC,SAAS,EAAE,KAAK,CAA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Falls back to a compile-time constant in bundled deploys without the file.
|
|
4
|
+
* @module @dsh-cc/acp/version
|
|
5
|
+
*/
|
|
6
|
+
/** Compile-time fallback, kept in sync with package.json `version`. */
|
|
7
|
+
export declare const FALLBACK_VERSION = "0.9.0-rc.3";
|
|
8
|
+
/**
|
|
9
|
+
* Read this plugin's own version from its `package.json`.
|
|
10
|
+
* @returns the package version string.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readOwnVersion(): Promise<string>;
|
|
13
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAMH,uEAAuE;AACvE,eAAO,MAAM,gBAAgB,eAAe,CAAA;AAE5C;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAUtD"}
|