@1agents/acp-service 0.5.4 → 0.7.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/README.md +180 -9
- package/dist/bin/a2a.d.ts +1 -0
- package/dist/bin/a2a.js +52 -0
- package/dist/bin/acp-service.js +20 -2
- package/dist/src/a2a/automation.d.ts +99 -0
- package/dist/src/a2a/automation.js +372 -0
- package/dist/src/a2a/executor.d.ts +29 -0
- package/dist/src/a2a/executor.js +144 -0
- package/dist/src/a2a/gateway.d.ts +151 -0
- package/dist/src/a2a/gateway.js +454 -0
- package/dist/src/a2a/index.d.ts +9 -0
- package/dist/src/a2a/index.js +5 -0
- package/dist/src/a2a/server.d.ts +22 -0
- package/dist/src/a2a/server.js +339 -0
- package/dist/src/a2a/store.d.ts +34 -0
- package/dist/src/a2a/store.js +468 -0
- package/dist/src/a2a/types.d.ts +26 -0
- package/dist/src/a2a/types.js +1 -0
- package/dist/src/acp-connection.js +3 -2
- package/dist/src/bridge.js +18 -3
- package/package.json +15 -8
- package/skills/acp-service/SKILL.md +90 -0
- package/skills/acp-service/agents/openai.yaml +3 -0
- package/skills/acp-service/references/a2a.md +183 -0
- package/skills/acp-service/references/acp.md +104 -0
- package/skills/acp-service/references/dsh.md +61 -0
- package/vendor/dsh/README.md +34 -10
- package/vendor/dsh/a2a-executor.d.ts +26 -0
- package/vendor/dsh/a2a-executor.js +195 -0
- package/vendor/dsh/a2a.d.ts +15 -0
- package/vendor/dsh/a2a.js +32 -0
- package/vendor/dsh/adapter.js +33 -10
- package/vendor/dsh/index.d.ts +5 -1
- package/vendor/dsh/index.js +3 -0
- package/vendor/runtime/dist/docs-site/output-formats.html +4 -1
- package/vendor/runtime/dist/runtime.d.ts +8 -0
- package/vendor/runtime/dist/runtime.d.ts.map +1 -1
- package/vendor/runtime/dist/runtime.js +3 -1
- package/vendor/runtime/dist/runtime.js.map +1 -1
- package/vendor/runtime/skills/acpx/SKILL.md +1 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/** DSH session execution behind the shared A2A service's transport-independent backend. */
|
|
2
|
+
import { realpath, stat } from 'node:fs/promises';
|
|
3
|
+
import { isAbsolute } from 'node:path';
|
|
4
|
+
function resultOf(reason, text, finalAnswerExpected) {
|
|
5
|
+
switch (reason.kind) {
|
|
6
|
+
case 'completed': return finalAnswerExpected && !text.trim()
|
|
7
|
+
? { outcome: 'failed', text, detail: 'DSH completed the task without a final answer; ACP final-answer metadata contained no final output' }
|
|
8
|
+
: { outcome: 'completed', text };
|
|
9
|
+
case 'blocked': return { outcome: 'input-required', text, detail: 'DSH blocked the task before its next model step' };
|
|
10
|
+
case 'error': return { outcome: 'failed', text, detail: reason.error.message };
|
|
11
|
+
case 'max-tokens': return { outcome: 'failed', text, detail: 'DSH reached the model output token limit' };
|
|
12
|
+
case 'aborted': return { outcome: 'failed', text, detail: 'DSH task execution was canceled' };
|
|
13
|
+
case 'interrupted': return { outcome: 'failed', text, detail: 'DSH task execution was interrupted' };
|
|
14
|
+
case 'forked': return { outcome: 'failed', text, detail: 'DSH task turn was closed by a session fork' };
|
|
15
|
+
// DSH's turn reasons are merge-extensible; an unknown ending cannot report success.
|
|
16
|
+
default: return { outcome: 'failed', text, detail: 'DSH returned an unsupported turn ending' };
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/** Read durable ACP metadata, leaving ordinary DSH messages compatible. */
|
|
20
|
+
function answerOf(content, turn) {
|
|
21
|
+
const blocks = content.filter(part => part.type === 'text');
|
|
22
|
+
const terminal = blocks.findLast(part => part.acpResult?.turn === turn && typeof part.acpResult.finalAnswer === 'string');
|
|
23
|
+
if (terminal)
|
|
24
|
+
return { text: terminal.acpResult.finalAnswer, authoritative: true, phased: true };
|
|
25
|
+
const phased = blocks.some(part => part.acpStream?.turn === turn
|
|
26
|
+
&& (part.acpStream.messagePhase === 'commentary' || part.acpStream.messagePhase === 'final_answer'));
|
|
27
|
+
return {
|
|
28
|
+
text: blocks.filter(part => !phased || (part.acpStream?.turn === turn && part.acpStream.messagePhase === 'final_answer')).map(part => part.text).join(''),
|
|
29
|
+
authoritative: false, phased,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** Uses public session-controller and inbox events to account for one A2A prompt's exact DSH turn. */
|
|
33
|
+
export class DshA2ABackend {
|
|
34
|
+
ctx;
|
|
35
|
+
executions = new Map();
|
|
36
|
+
/** @param ctx DSH plugin context that owns session-controller and execution event registrations. */
|
|
37
|
+
constructor(ctx) {
|
|
38
|
+
this.ctx = ctx;
|
|
39
|
+
}
|
|
40
|
+
/** Create a new session or restore an explicitly addressed session without changing its workspace or preset.
|
|
41
|
+
* @param input Remote host directory, preset, and optional existing DSH session identity.
|
|
42
|
+
* @returns The resolved DSH session and its durable workspace and preset.
|
|
43
|
+
*/
|
|
44
|
+
async prepare(input) {
|
|
45
|
+
const previous = input.sessionId === undefined
|
|
46
|
+
? undefined
|
|
47
|
+
: await this.ctx.sessionController.inspect(input.sessionId);
|
|
48
|
+
const requestedCwd = input.cwd ?? previous?.meta.cwd ?? process.cwd();
|
|
49
|
+
if (!isAbsolute(requestedCwd))
|
|
50
|
+
throw new Error('A2A cwd must be an absolute directory on the DSH host');
|
|
51
|
+
const cwd = await realpath(requestedCwd);
|
|
52
|
+
if (!(await stat(cwd)).isDirectory())
|
|
53
|
+
throw new Error('A2A cwd must point to a directory on the DSH host');
|
|
54
|
+
const agentPreset = input.agentPreset ?? previous?.meta.agentPreset;
|
|
55
|
+
const created = await this.ctx.sessionController.create({
|
|
56
|
+
cwd,
|
|
57
|
+
...(input.sessionId === undefined ? {} : { sessionId: input.sessionId }),
|
|
58
|
+
...(agentPreset === undefined ? {} : { agentPreset }),
|
|
59
|
+
});
|
|
60
|
+
const agent = await this.agent(created.sessionId);
|
|
61
|
+
return {
|
|
62
|
+
sessionId: created.sessionId,
|
|
63
|
+
cwd: agent.session.header.cwd ?? cwd,
|
|
64
|
+
...(created.agentPreset === undefined ? {} : { agentPreset: created.agentPreset }),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/** Admit one identified queued prompt and wait only for its own turn, independent of the HTTP connection.
|
|
68
|
+
* @param target Previously prepared DSH session.
|
|
69
|
+
* @param prompt Plain-text A2A message content.
|
|
70
|
+
* @param options Task-owned request identity and cancellation signal.
|
|
71
|
+
* @returns The exact turn's ending and its final assistant text.
|
|
72
|
+
*/
|
|
73
|
+
async run(target, prompt, options) {
|
|
74
|
+
options.signal.throwIfAborted();
|
|
75
|
+
const queuedAbort = Promise.withResolvers();
|
|
76
|
+
const abort = () => { queuedAbort.reject(options.signal.reason); };
|
|
77
|
+
options.signal.addEventListener('abort', abort, { once: true });
|
|
78
|
+
const operation = (this.executions.get(target.sessionId) ?? Promise.resolve()).then(() => {
|
|
79
|
+
options.signal.removeEventListener('abort', abort);
|
|
80
|
+
options.signal.throwIfAborted();
|
|
81
|
+
return this.execute(target, prompt, options);
|
|
82
|
+
});
|
|
83
|
+
const tail = operation.then(() => undefined, () => undefined);
|
|
84
|
+
this.executions.set(target.sessionId, tail);
|
|
85
|
+
void tail.then(() => { if (this.executions.get(target.sessionId) === tail)
|
|
86
|
+
this.executions.delete(target.sessionId); });
|
|
87
|
+
try {
|
|
88
|
+
return await Promise.race([operation, queuedAbort.promise]);
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
options.signal.removeEventListener('abort', abort);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
async execute(target, prompt, options) {
|
|
95
|
+
const agent = await this.agent(target.sessionId);
|
|
96
|
+
options.signal.throwIfAborted();
|
|
97
|
+
const completion = Promise.withResolvers();
|
|
98
|
+
const listeners = [];
|
|
99
|
+
let messageId;
|
|
100
|
+
let turn;
|
|
101
|
+
let text = '';
|
|
102
|
+
let finalAnswerExpected = false;
|
|
103
|
+
let authoritativeAnswer = false;
|
|
104
|
+
let settled = false;
|
|
105
|
+
const owns = (message) => message.source.kind === 'user'
|
|
106
|
+
&& 'rpcId' in message.source && message.source.rpcId === options.requestId;
|
|
107
|
+
const settle = (result) => {
|
|
108
|
+
if (settled)
|
|
109
|
+
return;
|
|
110
|
+
settled = true;
|
|
111
|
+
options.signal.removeEventListener('abort', cancel);
|
|
112
|
+
completion.resolve(result);
|
|
113
|
+
};
|
|
114
|
+
const cancel = () => {
|
|
115
|
+
if (settled)
|
|
116
|
+
return;
|
|
117
|
+
if (turn !== undefined)
|
|
118
|
+
agent.cancel({ kind: 'user' }, { keepInbox: true });
|
|
119
|
+
else if (messageId !== undefined)
|
|
120
|
+
agent.inbox.remove(messageId);
|
|
121
|
+
};
|
|
122
|
+
// The session owns these temporary listeners until its turn settles. Plugin
|
|
123
|
+
// unloading removes plugin effects concurrently with the server's cancel/drain.
|
|
124
|
+
listeners.push(agent.ctx.on('agent/inbox/inserted', event => {
|
|
125
|
+
if (event.agent !== agent || !owns(event.message))
|
|
126
|
+
return;
|
|
127
|
+
messageId = event.message.id;
|
|
128
|
+
if (options.signal.aborted)
|
|
129
|
+
cancel();
|
|
130
|
+
}));
|
|
131
|
+
listeners.push(agent.ctx.on('agent/inbox/claimed', event => {
|
|
132
|
+
if (event.agent !== agent || !owns(event.message))
|
|
133
|
+
return;
|
|
134
|
+
messageId = undefined;
|
|
135
|
+
turn = event.turn;
|
|
136
|
+
if (options.signal.aborted)
|
|
137
|
+
cancel();
|
|
138
|
+
}));
|
|
139
|
+
listeners.push(agent.ctx.on('agent/inbox/discarded', event => {
|
|
140
|
+
if (event.agent === agent && owns(event.message)) {
|
|
141
|
+
settle({ outcome: 'failed', text, detail: 'DSH discarded the queued task before execution' });
|
|
142
|
+
}
|
|
143
|
+
}));
|
|
144
|
+
listeners.push(agent.ctx.on('agent/disposed', event => {
|
|
145
|
+
if (event.agent === agent)
|
|
146
|
+
settle({ outcome: 'failed', text, detail: 'DSH session was disposed before the task finished' });
|
|
147
|
+
}));
|
|
148
|
+
listeners.push(agent.ctx.on('session/event', (session, event) => {
|
|
149
|
+
if (session !== agent.session || turn === undefined)
|
|
150
|
+
return;
|
|
151
|
+
if (event.type === 'assistant/message' && event.data.turn === turn) {
|
|
152
|
+
const next = answerOf(event.data.message.content, turn);
|
|
153
|
+
if (next.authoritative) {
|
|
154
|
+
text = next.text;
|
|
155
|
+
authoritativeAnswer = true;
|
|
156
|
+
finalAnswerExpected = true;
|
|
157
|
+
}
|
|
158
|
+
else if (!authoritativeAnswer && next.phased) {
|
|
159
|
+
text = next.text;
|
|
160
|
+
finalAnswerExpected = true;
|
|
161
|
+
}
|
|
162
|
+
else if (!finalAnswerExpected && next.text.length > 0)
|
|
163
|
+
text = next.text;
|
|
164
|
+
}
|
|
165
|
+
else if (event.type === 'turn/end' && event.data.turn === turn) {
|
|
166
|
+
settle(resultOf(event.data.reason, text, finalAnswerExpected));
|
|
167
|
+
}
|
|
168
|
+
}));
|
|
169
|
+
options.signal.addEventListener('abort', cancel, { once: true });
|
|
170
|
+
try {
|
|
171
|
+
// Recheck after event registration; cancellation can arrive during Agent restoration.
|
|
172
|
+
options.signal.throwIfAborted();
|
|
173
|
+
await this.ctx.sessionController.prompt({
|
|
174
|
+
requestId: options.requestId,
|
|
175
|
+
sessionId: agent.id,
|
|
176
|
+
mode: 'queue',
|
|
177
|
+
content: [{ type: 'text', text: prompt }],
|
|
178
|
+
}, options.signal);
|
|
179
|
+
if (options.signal.aborted)
|
|
180
|
+
cancel();
|
|
181
|
+
return await completion.promise;
|
|
182
|
+
}
|
|
183
|
+
finally {
|
|
184
|
+
options.signal.removeEventListener('abort', cancel);
|
|
185
|
+
for (const dispose of listeners.reverse())
|
|
186
|
+
dispose();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
async agent(sessionId) {
|
|
190
|
+
const resolved = await this.ctx.sessionController.resolveAgent(sessionId);
|
|
191
|
+
if ('error' in resolved)
|
|
192
|
+
throw resolved.error;
|
|
193
|
+
return resolved.agent;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Mount the shared A2A implementation on the current DSH web host. */
|
|
2
|
+
import { type A2AServerOptions } from '@1agents/acp-service/a2a';
|
|
3
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
4
|
+
/** Optional host configuration; omitted configuration leaves A2A disabled. */
|
|
5
|
+
export interface DshA2AOptions extends Omit<A2AServerOptions, 'backend' | 'token' | 'stateDirectory' | 'publicUrl'> {
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
token?: string;
|
|
8
|
+
/** Defaults to DSH_A2A_TOKEN; host credentials are never copied into tasks. */
|
|
9
|
+
tokenEnv?: string;
|
|
10
|
+
stateDirectory?: string;
|
|
11
|
+
/** Public DSH origin, for example its Tailscale URL. */
|
|
12
|
+
publicUrl?: string;
|
|
13
|
+
}
|
|
14
|
+
/** Routes and in-flight turns are released with the owning Cordis plugin. */
|
|
15
|
+
export declare function mountDshA2A(ctx: Context, options: DshA2AOptions, stateDirectory: string): Promise<void>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Mount the shared A2A implementation on the current DSH web host. */
|
|
2
|
+
import { createA2AServer } from '@1agents/acp-service/a2a';
|
|
3
|
+
import { DshA2ABackend } from './a2a-executor.js';
|
|
4
|
+
/** Routes and in-flight turns are released with the owning Cordis plugin. */
|
|
5
|
+
export async function mountDshA2A(ctx, options, stateDirectory) {
|
|
6
|
+
if (options.enabled === false)
|
|
7
|
+
return;
|
|
8
|
+
const token = options.token ?? process.env[options.tokenEnv ?? 'DSH_A2A_TOKEN'];
|
|
9
|
+
if (!token)
|
|
10
|
+
throw new Error('Set DSH_A2A_TOKEN or a2a.token before enabling DSH A2A');
|
|
11
|
+
await ctx.effect(async () => {
|
|
12
|
+
const server = await createA2AServer({ ...options, token, backend: new DshA2ABackend(ctx),
|
|
13
|
+
stateDirectory: options.stateDirectory ?? stateDirectory,
|
|
14
|
+
publicUrl: options.publicUrl ?? `http://127.0.0.1:${ctx.webServer.port}` });
|
|
15
|
+
const routes = [];
|
|
16
|
+
try {
|
|
17
|
+
routes.push(ctx.webServer.register({ kind: 'exact', path: '/.well-known/agent-card.json', handler: server.cardHandler }));
|
|
18
|
+
routes.push(ctx.webServer.register({ kind: 'exact', path: server.path, handler: server.handler }));
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
for (const dispose of routes.reverse())
|
|
22
|
+
dispose();
|
|
23
|
+
await server.close();
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
return async () => {
|
|
27
|
+
for (const dispose of routes.reverse())
|
|
28
|
+
dispose();
|
|
29
|
+
await server.close();
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
}
|
package/vendor/dsh/adapter.js
CHANGED
|
@@ -384,25 +384,35 @@ export class AcpAdapter {
|
|
|
384
384
|
const turn = boundary?.lastTurn ?? 0;
|
|
385
385
|
const step = stepStart?.type === 'step/start' ? stepStart.data.step : 0;
|
|
386
386
|
let index = 0, current, content = '', answer = '';
|
|
387
|
+
let hasPhasedText = false, streamedFinalAnswer = false;
|
|
388
|
+
let currentStream;
|
|
387
389
|
const acpStream = { turn, step, requestId };
|
|
388
390
|
const endBlock = () => { if (current) {
|
|
389
|
-
queue.push({ type: 'block-end', index, block: { type: current, text: content } });
|
|
391
|
+
queue.push({ type: 'block-end', index, block: { type: current, text: content, acpStream: currentStream } });
|
|
390
392
|
index++;
|
|
391
393
|
current = undefined;
|
|
394
|
+
currentStream = undefined;
|
|
392
395
|
content = '';
|
|
393
396
|
} };
|
|
394
|
-
const emit = (kind, text) => {
|
|
397
|
+
const emit = (kind, text, identity = {}) => {
|
|
395
398
|
if (!text)
|
|
396
399
|
return;
|
|
397
|
-
|
|
400
|
+
const stream = { ...acpStream, ...identity };
|
|
401
|
+
if (current !== kind || currentStream?.messagePhase !== stream.messagePhase || currentStream?.messageId !== stream.messageId) {
|
|
398
402
|
endBlock();
|
|
399
403
|
current = kind;
|
|
400
|
-
|
|
404
|
+
currentStream = stream;
|
|
405
|
+
queue.push({ type: 'block-start', index, blockType: kind, acpStream: stream });
|
|
401
406
|
}
|
|
402
407
|
content += text;
|
|
403
|
-
if (kind === 'text')
|
|
408
|
+
if (kind === 'text') {
|
|
404
409
|
answer += text;
|
|
405
|
-
|
|
410
|
+
if (identity.messagePhase !== undefined)
|
|
411
|
+
hasPhasedText = true;
|
|
412
|
+
if (identity.messagePhase === 'final_answer')
|
|
413
|
+
streamedFinalAnswer = true;
|
|
414
|
+
}
|
|
415
|
+
const chunk = kind === 'text' ? { type: 'text-delta', index, text, acpStream: stream } : { type: 'reasoning-delta', index, text, acpStream: stream };
|
|
406
416
|
queue.push(chunk);
|
|
407
417
|
};
|
|
408
418
|
const update = (u) => {
|
|
@@ -414,8 +424,12 @@ export class AcpAdapter {
|
|
|
414
424
|
if (seen.has(meta.sequence))
|
|
415
425
|
return;
|
|
416
426
|
seen.add(meta.sequence);
|
|
417
|
-
if ((u.sessionUpdate === 'agent_message_chunk' || u.sessionUpdate === 'agent_thought_chunk') && u.content.type === 'text')
|
|
418
|
-
emit(u.sessionUpdate === 'agent_message_chunk' ? 'text' : 'reasoning', u.content.text
|
|
427
|
+
if ((u.sessionUpdate === 'agent_message_chunk' || u.sessionUpdate === 'agent_thought_chunk') && u.content.type === 'text') {
|
|
428
|
+
emit(u.sessionUpdate === 'agent_message_chunk' ? 'text' : 'reasoning', u.content.text, {
|
|
429
|
+
...(meta.messagePhase === 'commentary' || meta.messagePhase === 'final_answer' ? { messagePhase: meta.messagePhase } : {}),
|
|
430
|
+
...(typeof meta.messageId === 'string' ? { messageId: meta.messageId } : {}),
|
|
431
|
+
});
|
|
432
|
+
}
|
|
419
433
|
else if (u.sessionUpdate === 'tool_call' || u.sessionUpdate === 'tool_call_update') {
|
|
420
434
|
const tool = mergeTool(tools.get(u.toolCallId), u);
|
|
421
435
|
tools.set(u.toolCallId, tool);
|
|
@@ -444,9 +458,18 @@ export class AcpAdapter {
|
|
|
444
458
|
_meta: { '1agents': { turnManaged: true, turnId: requestId, requestId } } }, { cancellationSignal: signal });
|
|
445
459
|
signal.throwIfAborted();
|
|
446
460
|
const meta = result._meta?.['1agents'];
|
|
447
|
-
if (
|
|
448
|
-
emit('text', meta.finalAnswer);
|
|
461
|
+
if (typeof meta?.finalAnswer === 'string' && (!answer || (hasPhasedText && !streamedFinalAnswer))) {
|
|
462
|
+
emit('text', meta.finalAnswer, { messagePhase: 'final_answer' });
|
|
463
|
+
}
|
|
449
464
|
endBlock();
|
|
465
|
+
if (typeof meta?.finalAnswer === 'string') {
|
|
466
|
+
// The terminal answer is authoritative even when it is empty. Keep
|
|
467
|
+
// it durable without printing a second copy of streamed output.
|
|
468
|
+
const block = { type: 'text', text: '', acpResult: { ...acpStream, finalAnswer: meta.finalAnswer } };
|
|
469
|
+
queue.push({ type: 'block-start', index, blockType: 'text' });
|
|
470
|
+
queue.push({ type: 'block-end', index, block });
|
|
471
|
+
index++;
|
|
472
|
+
}
|
|
450
473
|
queue.push(result.stopReason === 'cancelled' ? { type: 'finish', reason: { kind: 'aborted', failure: { code: 'ABORTED', message: 'ACP turn cancelled' } } } : { type: 'finish', reason: result.stopReason === 'max_tokens' ? { kind: 'max-tokens' } : { kind: 'stop' } });
|
|
451
474
|
return;
|
|
452
475
|
}
|
package/vendor/dsh/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
2
|
import { type Config } from './adapter.js';
|
|
3
3
|
import { type ServiceOptions } from './service-process.js';
|
|
4
|
+
import { type DshA2AOptions } from './a2a.js';
|
|
5
|
+
export type { DshA2AOptions } from './a2a.js';
|
|
4
6
|
export { name, inject } from '@1agents/acp-service';
|
|
5
|
-
export declare function apply(ctx: Context, input?: Partial<Config & ServiceOptions>
|
|
7
|
+
export declare function apply(ctx: Context, input?: Partial<Config & ServiceOptions> & {
|
|
8
|
+
a2a?: DshA2AOptions;
|
|
9
|
+
}): Promise<void>;
|
package/vendor/dsh/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { AcpAdapter } from './adapter.js';
|
|
|
5
5
|
import { discoverPresets } from './discovery.js';
|
|
6
6
|
import { NativeSessions } from './imports.js';
|
|
7
7
|
import { acquireService, resolveServiceOptions } from './service-process.js';
|
|
8
|
+
import { mountDshA2A } from './a2a.js';
|
|
8
9
|
export { name, inject } from '@1agents/acp-service';
|
|
9
10
|
export async function apply(ctx, input = {}) {
|
|
10
11
|
const homePath = ctx.get('dshHomePath');
|
|
@@ -81,4 +82,6 @@ export async function apply(ctx, input = {}) {
|
|
|
81
82
|
});
|
|
82
83
|
ctx.effect(() => dispose);
|
|
83
84
|
}
|
|
85
|
+
if (input.a2a)
|
|
86
|
+
await mountDshA2A(ctx, input.a2a, join(home, 'plugins', '1agents-acp', 'a2a'));
|
|
84
87
|
}
|
|
@@ -332,12 +332,15 @@ echo <span class="hl-str">"$SUMMARY"</span></code></pre>
|
|
|
332
332
|
<p>ACP prompt response <code>_meta</code> is passed through to compare summaries and embedded runtime completion results, including queued prompts. An absent field stays absent, and an explicit <code>null</code> stays <code>null</code>. Nested values are opaque, adapter-defined data; ACPX does not authenticate them or treat them as proof of model identity or configuration. Raw JSON output retains the original ACP response.</p>
|
|
333
333
|
<h2 id="embedded-host-logging"><a class="anchor" href="#embedded-host-logging" aria-label="Anchor link">#</a>Embedded host logging</h2>
|
|
334
334
|
<p>Embedded ACP prompts leave the application's <code>console.error</code> function unchanged, including while prompts overlap or the host replaces its logger. Existing output modes and acpx warning and retry suppression controls keep their behavior.</p>
|
|
335
|
+
<h2 id="embedded-runtime-assistant-messages"><a class="anchor" href="#embedded-runtime-assistant-messages" aria-label="Anchor link">#</a>Embedded runtime assistant messages</h2>
|
|
336
|
+
<p>The <code>acpx/runtime</code> turn stream retains a supplied <code>messageId</code> on <code>text_delta</code> events. When an ACP update supplies <code>_meta.codex.phase</code> as <code>commentary</code> or <code>final_answer</code>, the event also carries <code>messagePhase</code> with that exact value. Absent, unknown, and malformed phases are omitted. Other nested metadata is not copied into the text event.</p>
|
|
337
|
+
<p>Hosts can use the explicit phase to keep commentary in execution logs and select final-answer text for reports. Both phases remain in the event stream. These adapter-supplied fields describe message boundaries; they do not authenticate authorship or authorize actions. Without a recognized phase, hosts must not infer a final answer from prose or tool timing.</p>
|
|
335
338
|
<h2 id="embedded-runtime-plans"><a class="anchor" href="#embedded-runtime-plans" aria-label="Anchor link">#</a>Embedded runtime plans</h2>
|
|
336
339
|
<p>The <code>acpx/runtime</code> turn stream exposes ACP plan notifications as <code>status</code> events with <code>tag: "plan"</code>. The existing text summary remains available. The optional <code>entries</code> field contains normalized <code>AcpRuntimePlanEntry</code> objects with <code>content</code>, <code>status</code> (<code>pending</code>, <code>in_progress</code>, or <code>completed</code>), and a valid advertised <code>priority</code> (<code>high</code>, <code>medium</code>, or <code>low</code>) when present.</p>
|
|
337
340
|
<p>Each <code>entries</code> array replaces the previous plan; <code>entries: []</code> clears it. An omitted field supplies no structured snapshot. Entries with blank content or invalid status are skipped, and invalid priorities are omitted. Legacy updates without valid statuses can still produce a text summary. CLI JSON output continues to expose the original ACP payload.</p>
|
|
338
341
|
<h2 id="embedded-runtime-tool-calls"><a class="anchor" href="#embedded-runtime-tool-calls" aria-label="Anchor link">#</a>Embedded runtime tool calls</h2>
|
|
339
342
|
<p>The <code>acpx/runtime</code> turn stream exposes both ACP <code>tool_call</code> and <code>tool_call_update</code> notifications as <code>tool_call</code> events, retaining the original tag. The optional <code>kind</code> preserves known ACP classifications, including <code>switch_mode</code>. Missing or unknown kinds are omitted without dropping the tool event.</p><nav class="page-nav" aria-label="Pager"><a class="page-nav-prev" href="session-control.html"><small>Previous</small><span>Session control</span></a><a class="page-nav-next" href="permissions.html"><small>Next</small><span>Permissions</span></a></nav></article>
|
|
340
|
-
<nav class="toc" aria-label="On this page"><h2>On this page</h2><a class="toc-l2" href="#text-default">#text (default)</a><a class="toc-l2" href="#json">#json</a><a class="toc-l2" href="#format-json-json-strict">#--format json --json-strict</a><a class="toc-l2" href="#quiet">#quiet</a><a class="toc-l2" href="#suppress-reads">#--suppress-reads</a><a class="toc-l2" href="#session-control-command-output">#Session-control command output</a><a class="toc-l2" href="#identity-fields-in-json">#Identity fields in JSON</a><a class="toc-l2" href="#picking-a-mode">#Picking a mode</a><a class="toc-l2" href="#see-also">#See also</a><a class="toc-l2" href="#prompt-response-metadata">#Prompt response metadata</a><a class="toc-l2" href="#embedded-host-logging">#Embedded host logging</a><a class="toc-l2" href="#embedded-runtime-plans">#Embedded runtime plans</a><a class="toc-l2" href="#embedded-runtime-tool-calls">#Embedded runtime tool calls</a></nav>
|
|
343
|
+
<nav class="toc" aria-label="On this page"><h2>On this page</h2><a class="toc-l2" href="#text-default">#text (default)</a><a class="toc-l2" href="#json">#json</a><a class="toc-l2" href="#format-json-json-strict">#--format json --json-strict</a><a class="toc-l2" href="#quiet">#quiet</a><a class="toc-l2" href="#suppress-reads">#--suppress-reads</a><a class="toc-l2" href="#session-control-command-output">#Session-control command output</a><a class="toc-l2" href="#identity-fields-in-json">#Identity fields in JSON</a><a class="toc-l2" href="#picking-a-mode">#Picking a mode</a><a class="toc-l2" href="#see-also">#See also</a><a class="toc-l2" href="#prompt-response-metadata">#Prompt response metadata</a><a class="toc-l2" href="#embedded-host-logging">#Embedded host logging</a><a class="toc-l2" href="#embedded-runtime-assistant-messages">#Embedded runtime assistant messages</a><a class="toc-l2" href="#embedded-runtime-plans">#Embedded runtime plans</a><a class="toc-l2" href="#embedded-runtime-tool-calls">#Embedded runtime tool calls</a></nav>
|
|
341
344
|
</div>
|
|
342
345
|
</main>
|
|
343
346
|
</div>
|
|
@@ -305,6 +305,14 @@ type AcpRuntimeEvent = {
|
|
|
305
305
|
* producer message when the adapter includes an id.
|
|
306
306
|
*/
|
|
307
307
|
messageId?: string;
|
|
308
|
+
/**
|
|
309
|
+
* Recognized assistant-message phase from ACP update `_meta.codex.phase`.
|
|
310
|
+
* Omitted for absent or unknown values. This producer-supplied hint lets
|
|
311
|
+
* consumers separate progress commentary from the final answer without
|
|
312
|
+
* discarding either from the event stream; it is not an authorization
|
|
313
|
+
* or authenticated provenance boundary.
|
|
314
|
+
*/
|
|
315
|
+
messagePhase?: "commentary" | "final_answer";
|
|
308
316
|
/**
|
|
309
317
|
* Allowlisted origin fields from the ACP update `_meta`.
|
|
310
318
|
* Only the documented string keys `origin`, `kind`, and `source` are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","names":[],"sources":["../src/acp/model-support.ts","../src/acp/config-option-support.ts","../src/acp/mode-support.ts","../src/session/journal.ts","../src/runtime/public/contract.ts","../src/runtime/public/probe.ts","../src/runtime/engine/turn.ts","../src/runtime/engine/manager.ts","../src/runtime/public/file-session-store.ts","../src/runtime/public/turn-journal.ts","../src/runtime/public/errors.ts","../src/runtime/public/shared.ts","../src/runtime/public/handle-state.ts","../src/runtime/shared.ts","../src/runtime.ts"],"mappings":";;;;;;qBAea;KAED,4CAA4C;qBAE3C;KAKD,0CAA0C;qBAEzC,uCAAuC;WACzC;WACA,QAAQ;WACR;EAGP,YAAA,iBACA,QAAQ,iCACR;IAAY;;;wBAoBA,iCACd,iBACC,SAAS;;;KCxDA;EACV;EACA;EACA;;KAGU;EACV;EACA;EACA;EACA;EACA,SAAS;;;;KCXC;EACV;EACA;EACA;;KAGU;EACV;EACA,gBAAgB;;;;KCIN;EAEN;EACA;EACA,QAAQ;;EAGR;EACA;IAAS;IAAiB;IAAe;IAAqB;;;KAGxD;EAAsB;;EAC5B;EAAiB;EAA0B,SAAS;;EACpD;EAAsB;;EACtB;EAAqB;EAAmB,QAAQ;;;;;;;;;KCuC1C;KAEA;KAEA;KAaA;KAMA;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;KAGU;EACV;EACA;EACA,MAAM;EACN;EACA;;;;;;;;;EASA,iBAAiB;;EAEjB;;EAEA,kBAAkB;;KAGR;;;;;EAKV;EACA;;;;;;KAOU,sBAAsB;EAChC,QAAQ;EACR;EACA,cAAc;EACd,MAAM;EACN;EACA;;;;;;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,QAAQ;QACZ,QAAQ,8BAA8B;;;;;EAK3C,kBACE,KAAK,yBACL;IAAO,QAAQ;QACZ,QAAQ,2BAA2B;;;;;;;;;;EAUxC,4BACE,oBACA,WAAW,qBACX,SAAS;;;;;;;;EASX;;;;;;;;EAQA;;KAGU;EACV;;;;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","names":[],"sources":["../src/acp/model-support.ts","../src/acp/config-option-support.ts","../src/acp/mode-support.ts","../src/session/journal.ts","../src/runtime/public/contract.ts","../src/runtime/public/probe.ts","../src/runtime/engine/turn.ts","../src/runtime/engine/manager.ts","../src/runtime/public/file-session-store.ts","../src/runtime/public/turn-journal.ts","../src/runtime/public/errors.ts","../src/runtime/public/shared.ts","../src/runtime/public/handle-state.ts","../src/runtime/shared.ts","../src/runtime.ts"],"mappings":";;;;;;qBAea;KAED,4CAA4C;qBAE3C;KAKD,0CAA0C;qBAEzC,uCAAuC;WACzC;WACA,QAAQ;WACR;EAGP,YAAA,iBACA,QAAQ,iCACR;IAAY;;;wBAoBA,iCACd,iBACC,SAAS;;;KCxDA;EACV;EACA;EACA;;KAGU;EACV;EACA;EACA;EACA;EACA,SAAS;;;;KCXC;EACV;EACA;EACA;;KAGU;EACV;EACA,gBAAgB;;;;KCIN;EAEN;EACA;EACA,QAAQ;;EAGR;EACA;IAAS;IAAiB;IAAe;IAAqB;;;KAGxD;EAAsB;;EAC5B;EAAiB;EAA0B,SAAS;;EACpD;EAAsB;;EACtB;EAAqB;EAAmB,QAAQ;;;;;;;;;KCuC1C;KAEA;KAEA;KAaA;KAMA;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;KAGU;EACV;EACA;EACA,MAAM;EACN;EACA;;;;;;;;;EASA,iBAAiB;;EAEjB;;EAEA,kBAAkB;;KAGR;;;;;EAKV;EACA;;;;;;KAOU,sBAAsB;EAChC,QAAQ;EACR;EACA,cAAc;EACd,MAAM;EACN;EACA;;;;;;EAMA,sBAAsB;;EAEtB,gBAAgB;;;KAIN;E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oB;wBAI9C,mBAAmB;EAAW;IAAqB"}
|
|
@@ -219,9 +219,11 @@ const ORIGIN_META_KEYS = [
|
|
|
219
219
|
*/
|
|
220
220
|
function extractTextDeltaOrigin(payload) {
|
|
221
221
|
const messageId = asOptionalString(payload.messageId);
|
|
222
|
+
const phase = isRecord(payload._meta) && isRecord(payload._meta.codex) ? payload._meta.codex.phase : void 0;
|
|
222
223
|
const meta = sanitizeOriginMeta(payload._meta);
|
|
223
224
|
return {
|
|
224
225
|
...messageId ? { messageId } : {},
|
|
226
|
+
...phase === "commentary" || phase === "final_answer" ? { messagePhase: phase } : {},
|
|
225
227
|
...meta ? { meta } : {}
|
|
226
228
|
};
|
|
227
229
|
}
|
|
@@ -2857,7 +2859,7 @@ const journalEventSchema = z.object({
|
|
|
2857
2859
|
occurred_at: z.string(),
|
|
2858
2860
|
created_at: z.string(),
|
|
2859
2861
|
agent_type: z.unknown().optional().transform(optionalString),
|
|
2860
|
-
final_answer: z.unknown().optional().transform(
|
|
2862
|
+
final_answer: z.unknown().optional().transform((value) => typeof value === "string" ? value : void 0),
|
|
2861
2863
|
error_code: z.unknown().optional().transform(optionalString),
|
|
2862
2864
|
error_text: z.unknown().optional().transform(optionalString),
|
|
2863
2865
|
runtime_record_id: z.unknown().optional().transform(optionalString),
|