@1agents/acp-service 0.6.0 → 0.8.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 +57 -12
- package/dist/bin/a2a.js +2 -0
- package/dist/bin/acp-service.js +0 -0
- package/dist/src/a2a/automation.d.ts +99 -0
- package/dist/src/a2a/automation.js +372 -0
- package/dist/src/a2a/gateway.d.ts +15 -0
- package/dist/src/a2a/gateway.js +37 -9
- package/dist/src/a2a/index.d.ts +2 -0
- package/dist/src/a2a/index.js +1 -0
- package/dist/src/acp-connection.js +3 -2
- package/dist/src/bridge.js +18 -3
- package/package.json +13 -12
- package/vendor/dsh/README.md +33 -11
- package/vendor/dsh/a2a-executor.js +32 -6
- package/vendor/dsh/adapter.js +33 -10
- package/vendor/runtime/dist/cli.js +0 -0
- 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
- package/vendor/runtime/dist/docs-site/.nojekyll +0 -0
- package/vendor/runtime/dist/docs-site/CLI.html +0 -832
- package/vendor/runtime/dist/docs-site/CNAME +0 -1
- package/vendor/runtime/dist/docs-site/VISION.html +0 -415
- package/vendor/runtime/dist/docs-site/agents.html +0 -391
- package/vendor/runtime/dist/docs-site/compare.html +0 -359
- package/vendor/runtime/dist/docs-site/config.html +0 -450
- package/vendor/runtime/dist/docs-site/custom-agents.html +0 -408
- package/vendor/runtime/dist/docs-site/exit-codes.html +0 -347
- package/vendor/runtime/dist/docs-site/favicon.svg +0 -21
- package/vendor/runtime/dist/docs-site/flows.html +0 -497
- package/vendor/runtime/dist/docs-site/index.html +0 -367
- package/vendor/runtime/dist/docs-site/install.html +0 -386
- package/vendor/runtime/dist/docs-site/llms.txt +0 -35
- package/vendor/runtime/dist/docs-site/output-formats.html +0 -403
- package/vendor/runtime/dist/docs-site/permissions.html +0 -413
- package/vendor/runtime/dist/docs-site/prompting.html +0 -460
- package/vendor/runtime/dist/docs-site/proof-2026-07-18-grok-ext-methods/index.html +0 -336
- package/vendor/runtime/dist/docs-site/quickstart.html +0 -382
- package/vendor/runtime/dist/docs-site/runtime-environment.html +0 -329
- package/vendor/runtime/dist/docs-site/runtime-process-lifecycle.html +0 -335
- package/vendor/runtime/dist/docs-site/session-control.html +0 -406
- package/vendor/runtime/dist/docs-site/session-watch.html +0 -354
- package/vendor/runtime/dist/docs-site/sessions.html +0 -486
- package/vendor/runtime/dist/docs-site/shared-sessions.html +0 -377
package/dist/src/a2a/gateway.js
CHANGED
|
@@ -8,6 +8,7 @@ import { ClientFactory, DefaultAgentCardResolver, JsonRpcTransportFactory } from
|
|
|
8
8
|
import { reportAndHoldRegistration } from '@1agents/dreammate-node/client';
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
import { FileA2AStore } from './store.js';
|
|
11
|
+
import { A2AAutomation, automationConfigSchema, createAutomationServer } from './automation.js';
|
|
11
12
|
const string = z.string().trim().min(1).max(512);
|
|
12
13
|
const endpoint = z.string().url().refine(value => {
|
|
13
14
|
const url = new URL(value);
|
|
@@ -19,8 +20,16 @@ const configSchema = z.object({
|
|
|
19
20
|
remotes: z.record(string, z.object({ url: endpoint, token: string }).strict()),
|
|
20
21
|
callback: z.object({ host: string, port: z.number().int().min(0).max(65535), url: endpoint, token: string }).strict().optional(),
|
|
21
22
|
notificationTargets: z.record(string, z.object({ url: endpoint, token: string }).strict()).default({}),
|
|
23
|
+
automation: automationConfigSchema.optional(),
|
|
22
24
|
pollIntervalMs: z.number().int().min(50).max(60_000).default(3000),
|
|
23
|
-
}).strict()
|
|
25
|
+
}).strict().superRefine((config, ctx) => {
|
|
26
|
+
for (const [id, schedule] of Object.entries(config.automation?.schedules ?? {})) {
|
|
27
|
+
if (!Object.hasOwn(config.remotes, schedule.remote))
|
|
28
|
+
ctx.addIssue({ code: 'custom', path: ['automation', 'schedules', id, 'remote'], message: 'Unknown automation remote' });
|
|
29
|
+
if (schedule.notificationTarget && !Object.hasOwn(config.notificationTargets, schedule.notificationTarget))
|
|
30
|
+
ctx.addIssue({ code: 'custom', path: ['automation', 'schedules', id, 'notificationTarget'], message: 'Unknown automation notificationTarget' });
|
|
31
|
+
}
|
|
32
|
+
});
|
|
24
33
|
const originFields = { originSessionId: string };
|
|
25
34
|
const taskFields = { ...originFields, remote: string, taskId: string };
|
|
26
35
|
const prompt = z.string().min(1).max(256 * 1024).refine(value => Boolean(value.trim()), 'Prompt must contain text');
|
|
@@ -69,6 +78,7 @@ function atomicJson(file, value) {
|
|
|
69
78
|
}
|
|
70
79
|
export class RemoteAgentGateway {
|
|
71
80
|
config;
|
|
81
|
+
automation;
|
|
72
82
|
lease;
|
|
73
83
|
stateFile;
|
|
74
84
|
state;
|
|
@@ -108,6 +118,14 @@ export class RemoteAgentGateway {
|
|
|
108
118
|
}
|
|
109
119
|
this.state = { version: 1, jobs: [], notices: [] };
|
|
110
120
|
}
|
|
121
|
+
try {
|
|
122
|
+
if (this.config.automation)
|
|
123
|
+
this.automation = new A2AAutomation(this, this.config.automation);
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
this.lease.close();
|
|
127
|
+
throw error;
|
|
128
|
+
}
|
|
111
129
|
this.timer = setInterval(() => { void this.reconcile(); }, this.config.pollIntervalMs);
|
|
112
130
|
this.timer.unref();
|
|
113
131
|
void this.reconcile();
|
|
@@ -218,6 +236,7 @@ export class RemoteAgentGateway {
|
|
|
218
236
|
if (this.closed)
|
|
219
237
|
return;
|
|
220
238
|
await Promise.allSettled(this.state.notices.filter(record => record.target && !record.delivered && !record.acknowledged).map(record => this.deliver(record)));
|
|
239
|
+
await this.automation?.reconcileAcknowledgements();
|
|
221
240
|
})();
|
|
222
241
|
this.reconciling = pending;
|
|
223
242
|
try {
|
|
@@ -384,6 +403,8 @@ export async function serveA2AGateway(input, options = {}) {
|
|
|
384
403
|
});
|
|
385
404
|
let receiver;
|
|
386
405
|
let callbackPort;
|
|
406
|
+
let automationServer;
|
|
407
|
+
let automationPort;
|
|
387
408
|
try {
|
|
388
409
|
const port = await listen(server, gateway.config.port, '127.0.0.1');
|
|
389
410
|
if (gateway.config.callback) {
|
|
@@ -406,21 +427,28 @@ export async function serveA2AGateway(input, options = {}) {
|
|
|
406
427
|
});
|
|
407
428
|
callbackPort = await listen(receiver, callback.port, callback.host);
|
|
408
429
|
}
|
|
430
|
+
if (gateway.config.automation && gateway.automation) {
|
|
431
|
+
automationServer = createAutomationServer(gateway.automation);
|
|
432
|
+
automationPort = await listen(automationServer, gateway.config.automation.port, gateway.config.automation.host);
|
|
433
|
+
}
|
|
409
434
|
const entry = { id: 'a2a-gateway', name: 'DSH 远端智能体', kind: 'agent_runtime',
|
|
410
435
|
capabilities: Object.keys(REMOTE_AGENT_METHODS), execution: 'http', port, reachability: 'localhost', health: '/health', methods: REMOTE_AGENT_METHODS };
|
|
411
436
|
const registration = options.report === false ? undefined : await reportAndHoldRegistration(entry);
|
|
412
|
-
let
|
|
413
|
-
return { gateway, port, callbackPort, registration, close: async () => {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
437
|
+
let closing;
|
|
438
|
+
return { gateway, port, callbackPort, automationPort, registration, close: async () => {
|
|
439
|
+
closing ??= (async () => {
|
|
440
|
+
// Stop accepting requests and drain their ledger writes while this instance
|
|
441
|
+
// still owns the storage lease. Automation continuations and its admission
|
|
442
|
+
// queue can outlive the gateway operation they awaited.
|
|
443
|
+
await Promise.all([stop(server), ...(receiver ? [stop(receiver)] : []), ...(automationServer ? [stop(automationServer)] : [])]);
|
|
444
|
+
await gateway.close();
|
|
445
|
+
})();
|
|
446
|
+
await closing;
|
|
419
447
|
} };
|
|
420
448
|
}
|
|
421
449
|
catch (error) {
|
|
450
|
+
await Promise.all([stop(server), ...(receiver ? [stop(receiver)] : []), ...(automationServer ? [stop(automationServer)] : [])]);
|
|
422
451
|
await gateway.close();
|
|
423
|
-
await Promise.all([stop(server), ...(receiver ? [stop(receiver)] : [])]);
|
|
424
452
|
throw error;
|
|
425
453
|
}
|
|
426
454
|
}
|
package/dist/src/a2a/index.d.ts
CHANGED
|
@@ -5,3 +5,5 @@ export { FileA2AStore } from './store.js';
|
|
|
5
5
|
export type { A2ABackend, A2APrepareInput, A2ARunResult, A2ATarget } from './types.js';
|
|
6
6
|
export { RemoteAgentGateway, serveA2AGateway, REMOTE_AGENT_METHODS } from './gateway.js';
|
|
7
7
|
export type { A2AGatewayConfig, RemoteAgentNotice } from './gateway.js';
|
|
8
|
+
export { A2AAutomation } from './automation.js';
|
|
9
|
+
export type { A2AAutomationConfig, AutomationRun, AutomationRunStatus } from './automation.js';
|
package/dist/src/a2a/index.js
CHANGED
|
@@ -107,7 +107,7 @@ function envelope(value) {
|
|
|
107
107
|
function updateFor(event, toolUpdate = false) {
|
|
108
108
|
const common = { _meta: envelope(event) };
|
|
109
109
|
switch (event.event) {
|
|
110
|
-
case 'text_delta': return { ...common, sessionUpdate: event.type === 'thought' ? 'agent_thought_chunk' : 'agent_message_chunk', content: { type: 'text', text: event.text || '' } };
|
|
110
|
+
case 'text_delta': return { ...common, ...(event.messageId ? { messageId: event.messageId } : {}), sessionUpdate: event.type === 'thought' ? 'agent_thought_chunk' : 'agent_message_chunk', content: { type: 'text', text: event.text || '' } };
|
|
111
111
|
case 'tool_call': {
|
|
112
112
|
const fields = { ...common, toolCallId: event.toolCallId, title: event.title ?? event.toolName, status: event.status,
|
|
113
113
|
kind: event.kind, rawInput: event.arguments, rawOutput: event.rawOutput, content: event.content, locations: event.locations };
|
|
@@ -271,7 +271,8 @@ export function attachAcpConnection(ws, req, backend = production, state = new A
|
|
|
271
271
|
const terminal = (event.event === 'turn_state' && ['completed', 'failed', 'cancelled'].includes(event.status)) || event.event === 'done' || event.event === 'turn_terminal' || (event.event === 'error' && event.terminal !== false && event.scope === 'turn');
|
|
272
272
|
if (terminal) {
|
|
273
273
|
if (summary && event.event !== 'turn_state') {
|
|
274
|
-
|
|
274
|
+
const finalAnswer = event.finalAnswer ?? event.resultText ?? answers.get(sessionId) ?? event.summary ?? '';
|
|
275
|
+
event = { ...event, responsePolicy: 'summary', resultText: finalAnswer, summary: finalAnswer, sessionRef: { sessionId, turnId: event.turnId } };
|
|
275
276
|
if (extensions)
|
|
276
277
|
notify(`${EXT}events/turn_complete`, { ...event, event: undefined });
|
|
277
278
|
}
|
package/dist/src/bridge.js
CHANGED
|
@@ -936,6 +936,7 @@ function sendSummaryTerminal(ws, session, sessionId, payload) {
|
|
|
936
936
|
status: payload.status,
|
|
937
937
|
responsePolicy: "summary",
|
|
938
938
|
resultText,
|
|
939
|
+
finalAnswer: resultText,
|
|
939
940
|
sessionRef,
|
|
940
941
|
completedAt: new Date().toISOString(),
|
|
941
942
|
...(payload.error ? { error: payload.error } : {}),
|
|
@@ -946,6 +947,7 @@ function sendSummaryTerminal(ws, session, sessionId, payload) {
|
|
|
946
947
|
status: payload.status,
|
|
947
948
|
responsePolicy: "summary",
|
|
948
949
|
resultText,
|
|
950
|
+
finalAnswer: resultText,
|
|
949
951
|
sessionRef,
|
|
950
952
|
summary: resultText ||
|
|
951
953
|
(payload.status === "failed"
|
|
@@ -2438,6 +2440,8 @@ async function runPromptTurn(session, sessionId, promptItem) {
|
|
|
2438
2440
|
session.activeTurn = turn;
|
|
2439
2441
|
let terminalSent = false;
|
|
2440
2442
|
let accumulatedAnswer = "";
|
|
2443
|
+
let hasMessagePhase = false;
|
|
2444
|
+
let finalAnswer = "";
|
|
2441
2445
|
void (async () => {
|
|
2442
2446
|
try {
|
|
2443
2447
|
for await (const event of turn.events) {
|
|
@@ -2445,6 +2449,11 @@ async function runPromptTurn(session, sessionId, promptItem) {
|
|
|
2445
2449
|
const streamType = event.stream || "output";
|
|
2446
2450
|
if (streamType === "output") {
|
|
2447
2451
|
accumulatedAnswer += event.text || "";
|
|
2452
|
+
if (event.messagePhase === "commentary" || event.messagePhase === "final_answer") {
|
|
2453
|
+
hasMessagePhase = true;
|
|
2454
|
+
if (event.messagePhase === "final_answer")
|
|
2455
|
+
finalAnswer += event.text || "";
|
|
2456
|
+
}
|
|
2448
2457
|
}
|
|
2449
2458
|
}
|
|
2450
2459
|
else if (event.type === "status" &&
|
|
@@ -2471,6 +2480,8 @@ async function runPromptTurn(session, sessionId, promptItem) {
|
|
|
2471
2480
|
text: event.text,
|
|
2472
2481
|
type: event.stream || "output",
|
|
2473
2482
|
...(event.agentTurnId ? { agentTurnId: event.agentTurnId } : {}),
|
|
2483
|
+
...(event.messageId ? { messageId: event.messageId } : {}),
|
|
2484
|
+
...(event.messagePhase ? { messagePhase: event.messagePhase } : {}),
|
|
2474
2485
|
});
|
|
2475
2486
|
}
|
|
2476
2487
|
else if (event.type === "tool_call") {
|
|
@@ -2592,7 +2603,10 @@ async function runPromptTurn(session, sessionId, promptItem) {
|
|
|
2592
2603
|
console.log(`[acpx-server] Turn finished for session: ${sessionId}. Status: ${result.status}`);
|
|
2593
2604
|
const currentSession = activeSessions.get(sessionId);
|
|
2594
2605
|
const targetWs = currentSession ? currentSession.ws : null;
|
|
2595
|
-
|
|
2606
|
+
// An explicit terminal answer is authoritative, including an empty one.
|
|
2607
|
+
// Otherwise select only final-answer phases, while retaining every message
|
|
2608
|
+
// in the execution log. Unphased agents keep their legacy stream fallback.
|
|
2609
|
+
const finalResultText = result.finalAnswer ?? (hasMessagePhase ? finalAnswer : accumulatedAnswer);
|
|
2596
2610
|
const journalTerminal = turn.hostTurnId
|
|
2597
2611
|
? await turnJournal.record({
|
|
2598
2612
|
sessionId,
|
|
@@ -2601,7 +2615,7 @@ async function runPromptTurn(session, sessionId, promptItem) {
|
|
|
2601
2615
|
status: result.status,
|
|
2602
2616
|
promptText: promptItem.text,
|
|
2603
2617
|
agentType: currentSession?.agentType || session.agentType,
|
|
2604
|
-
finalAnswer:
|
|
2618
|
+
finalAnswer: finalResultText,
|
|
2605
2619
|
errorCode: result.status === "failed" ? result.error?.code || "ACP_PROMPT_FAILED" : undefined,
|
|
2606
2620
|
errorText: result.status === "failed" ? result.error?.message : undefined,
|
|
2607
2621
|
runtimeRecordId: currentSession?.handle?.acpxRecordId || session.handle?.acpxRecordId || sessionId,
|
|
@@ -2637,7 +2651,7 @@ async function runPromptTurn(session, sessionId, promptItem) {
|
|
|
2637
2651
|
status: result.status,
|
|
2638
2652
|
journalSequence: journalTerminal.turn.lastEventSeq,
|
|
2639
2653
|
stopReason: result.stopReason || (result.status === "failed" ? "runtime_error" : undefined),
|
|
2640
|
-
|
|
2654
|
+
finalAnswer: finalResultText,
|
|
2641
2655
|
runtimeRequestId: result.runtimeRequestId || requestId,
|
|
2642
2656
|
promptMessageId: result.promptMessageId || requestId,
|
|
2643
2657
|
completedAt: new Date().toISOString(),
|
|
@@ -2681,6 +2695,7 @@ async function runPromptTurn(session, sessionId, promptItem) {
|
|
|
2681
2695
|
event: "done",
|
|
2682
2696
|
sessionId,
|
|
2683
2697
|
stopReason: result.stopReason,
|
|
2698
|
+
finalAnswer: finalResultText,
|
|
2684
2699
|
summary,
|
|
2685
2700
|
...(stopped ? { stopped: true } : {}),
|
|
2686
2701
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1agents/acp-service",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "ACP runtime, CLI, HTTP/WebSocket service and DeepSeek Harness ACP/A2A plugins in one package.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dreammate",
|
|
@@ -75,13 +75,21 @@
|
|
|
75
75
|
"skills",
|
|
76
76
|
"vendor"
|
|
77
77
|
],
|
|
78
|
+
"scripts": {
|
|
79
|
+
"build": "node ../../scripts/embed-runtime.mjs && tsc -p tsconfig.build.json",
|
|
80
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
81
|
+
"test": "npm run build && npm run test:only",
|
|
82
|
+
"prepack": "node ../../scripts/verify-package-build.mjs",
|
|
83
|
+
"start": "tsx bin/acp-service.ts",
|
|
84
|
+
"test:only": "node --import tsx --test test/*.test.ts"
|
|
85
|
+
},
|
|
78
86
|
"engines": {
|
|
79
87
|
"node": ">=22.13.0"
|
|
80
88
|
},
|
|
81
89
|
"dependencies": {
|
|
82
90
|
"@1agents/acp-runtime-sdk": "npm:@agentclientprotocol/sdk@^1.5.0",
|
|
83
|
-
"@1agents/dreammate-network": "^0.
|
|
84
|
-
"@1agents/dreammate-node": "^0.
|
|
91
|
+
"@1agents/dreammate-network": "^0.5.0",
|
|
92
|
+
"@1agents/dreammate-node": "^0.15.0",
|
|
85
93
|
"@a2a-js/sdk": "1.3.0",
|
|
86
94
|
"@agentclientprotocol/sdk": "1.4.0",
|
|
87
95
|
"@openclaw/fs-safe": "^0.20.0",
|
|
@@ -92,7 +100,7 @@
|
|
|
92
100
|
"zod": "^4.6.5"
|
|
93
101
|
},
|
|
94
102
|
"devDependencies": {
|
|
95
|
-
"@scottzx/1acp": "
|
|
103
|
+
"@scottzx/1acp": "workspace:*",
|
|
96
104
|
"@types/node": "^22.10.2",
|
|
97
105
|
"@types/ws": "^8.5.14",
|
|
98
106
|
"typescript": "^5.7.2"
|
|
@@ -112,12 +120,5 @@
|
|
|
112
120
|
"@deepseek-ai/dsh-api-remotes"
|
|
113
121
|
]
|
|
114
122
|
}
|
|
115
|
-
},
|
|
116
|
-
"scripts": {
|
|
117
|
-
"build": "node ../../scripts/embed-runtime.mjs && tsc -p tsconfig.build.json",
|
|
118
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
119
|
-
"test": "npm run build && npm run test:only",
|
|
120
|
-
"start": "tsx bin/acp-service.ts",
|
|
121
|
-
"test:only": "node --import tsx --test test/*.test.ts"
|
|
122
123
|
}
|
|
123
|
-
}
|
|
124
|
+
}
|
package/vendor/dsh/README.md
CHANGED
|
@@ -1,37 +1,59 @@
|
|
|
1
1
|
# DSH plugin in @1agents/acp-service
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Use persistent native Codex, Claude Code, Grok Build and other locally discovered ACP Agent sessions inside DeepSeek Harness. Choose native models and settings, use advertised commands, and answer tool permissions in DSH. The plugin is embedded with the runtime and service in the single public **`@1agents/acp-service`** package. This directory is its private source module.
|
|
4
4
|
|
|
5
|
-
The
|
|
5
|
+
The CI API baseline is **DSH 0.1.7-rc.2**, commit `21638c56315ae6a2b552d6091945d3144c9af32e`. Additional installed-package and interactive checks used an isolated profile on a locally modified DSH build labeled `0.2.0-rc.1`; see the [verification record](https://github.com/scottzx/1acp/blob/main/docs/marketplaces/verification-2026-10-09.md) for the exact scope. Other DSH releases require checking their plugin and preset APIs.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The same host supports opt-in A2A 1.0 delegation, disabled by default: remote text messages create or restore DSH sessions, return task IDs, and continue execution independently of HTTP clients. Configure `a2a` on the existing plugin row, set the host's `DSH_A2A_TOKEN`, and choose its public origin, default cwd and preset. Query and subscribe through the official A2A interfaces; allowed webhook origins enable completion callbacks. Waking a caller's main Agent requires its receiving host adapter. See the [service README's DSH A2A section](https://github.com/scottzx/1acp/blob/main/packages/service/README.md#dsh-a2a) for configuration, metadata and recovery behavior. The shared server is exported as `@1agents/acp-service/a2a` and remains independent of DSH imports.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Install and start a session
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Requires **Node.js 22.13+**, a working DSH installation, and each selected native Agent's CLI and authentication on the DSH host. Adapter-backed Agents require their ACP adapter as well; the native Codex CLI does not replace `@agentclientprotocol/codex-acp`. Ensure these executables and credentials are available to the DSH process.
|
|
12
|
+
|
|
13
|
+
Install the one public package:
|
|
12
14
|
|
|
13
15
|
```sh
|
|
14
|
-
|
|
16
|
+
dsh plugin --profile web add @1agents/acp-service@^0.7.0
|
|
15
17
|
```
|
|
16
18
|
|
|
17
|
-
If pnpm pauses
|
|
19
|
+
If pnpm pauses or fails with an ignored transitive `esbuild` build script, follow its prompt or configure that individual package's approval in the profile's `pnpm-workspace.yaml`, then repeat the install. Approve or deny it according to your policy. A successful isolated package smoke used `--ignore-scripts`; the interactive pnpm 11 profile check approved only `esbuild`. A partial install can leave the bundle disabled, so check the Plugins page afterward.
|
|
20
|
+
|
|
21
|
+
Restart DSH after updating packages, confirm **`@1agents/acp-service`** is enabled on its Plugins page, and choose a discovered **ACP · Agent** preset for a new session. Select an existing workspace, then send a text prompt. Replace `web` with your profile name, such as `desktop`; from a DSH source checkout, use `pnpm dsh` in place of `dsh`.
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
For a pinned fallback, install the identical npm artifact from [GitHub Release 0.6.0](https://github.com/scottzx/1acp/releases/tag/acp-service-v0.6.0):
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
dsh plugin --profile web add https://github.com/scottzx/1acp/releases/download/acp-service-v0.6.0/1agents-acp-service-0.6.0.tgz
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The package declares `dsh.bundle.patch` and its browser entry, so installation selects the bundle automatically.
|
|
20
30
|
|
|
21
31
|
The plugin starts its bundled ACP service on `127.0.0.1:36812` when no service is listening. An existing healthy ACP service is reused. Start DSH normally; no separate service command is needed. To manage the service yourself, set `serviceMode: external` and run:
|
|
22
32
|
|
|
23
33
|
```sh
|
|
24
|
-
npx --yes @1agents/acp-service@^0.
|
|
34
|
+
npx --yes @1agents/acp-service@^0.7.0 serve --host 127.0.0.1 --port 36812 --no-report
|
|
25
35
|
```
|
|
26
36
|
|
|
27
|
-
|
|
37
|
+
Installing the package alone starts no process; activating the plugin starts the service. For local development, install the built checkout with `pnpm dsh plugin --profile web add /absolute/path/1acp/packages/service`.
|
|
38
|
+
|
|
39
|
+
ACP routes are not listed as ordinary DSH models, and the adapter rejects requests from ordinary presets, including previously saved ACP routes. Before the first turn, switching the Agent preset replaces the discovery connection and its native commands. Once a turn starts, the session keeps its remote Agent and workspace; start a new session to change Agent. Native Agent binaries and authentication belong to acp-service.
|
|
28
40
|
|
|
29
|
-
|
|
41
|
+
### Migrate an older installation
|
|
42
|
+
|
|
43
|
+
For an existing `@1agents/dsh-acp` installation, stop DSH, remove that bundle and add `@1agents/acp-service`. Keep existing binding files and copy any custom row configuration. The same plugin and preset IDs preserve session identity. Custom preset rows now load `@1agents/acp-service/dsh/preset`. Enable only the unified bundle.
|
|
44
|
+
|
|
45
|
+
## Session behavior
|
|
30
46
|
|
|
31
47
|
The bundle registers an ACP adapter through DSH's public streaming extension and routes the ACP presets to it. It sends newly admitted messages whose source is `user` to `session/prompt`, not to `subagent-acp`; there is no coordinating DeepSeek model call. DSH-generated workspace instructions and runtime-context messages are excluded. The external Agent owns its model, prompt, tools and native history, including any project instructions it discovers itself. DSH owns its UI and local user/assistant transcript. External tool progress is preserved as display metadata on empty text blocks in DSH's existing assistant stream records and projected onto collapsed groups of peer tool cards, separated by native prose and reasoning. ACP updates retain previously supplied fields, and replay is deduplicated by the managed turn sequence. These snapshots contain no visible text and never dispatch local tools; they use the existing persisted session format so conversations can reopen normally. Only Agent thought chunks enter the thinking stream.
|
|
32
48
|
|
|
33
49
|
## Continue imported native sessions
|
|
34
50
|
|
|
51
|
+
History import is optional. Install the separate history browser only when needed:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
dsh plugin --profile web add @1agents/session-reader
|
|
55
|
+
```
|
|
56
|
+
|
|
35
57
|
With `@1agents/session-reader` installed, choose **在 DSH 中继续原会话** on a Claude, Codex or Grok history. The original workspace must still exist. The plugin restores the native session through acp-service's `_1agents/session/import`, creates DSH history under the matching ACP preset, and attaches it to that workspace. Importing sends no prompt. Subsequent messages go to the original Agent; imported messages are never resent, including an unfinished trailing user message. Unsupported sources stay readable in session-reader.
|
|
36
58
|
|
|
37
59
|
Imported bindings use `session/resume` because the service does not own a complete ACP replay of earlier native history. Existing ordinary ACP bindings continue using `session/load`. Endpoint, source provider and native ID identify an import; repeated admission reuses its DSH session without refreshing or replacing history. Old history-only DSH copies are not adopted. Original Agent history can continue changing outside DSH; the imported DSH history is a snapshot.
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/** DSH session execution behind the shared A2A service's transport-independent backend. */
|
|
2
2
|
import { realpath, stat } from 'node:fs/promises';
|
|
3
3
|
import { isAbsolute } from 'node:path';
|
|
4
|
-
function resultOf(reason, text) {
|
|
4
|
+
function resultOf(reason, text, finalAnswerExpected) {
|
|
5
5
|
switch (reason.kind) {
|
|
6
|
-
case 'completed': return
|
|
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 };
|
|
7
9
|
case 'blocked': return { outcome: 'input-required', text, detail: 'DSH blocked the task before its next model step' };
|
|
8
10
|
case 'error': return { outcome: 'failed', text, detail: reason.error.message };
|
|
9
11
|
case 'max-tokens': return { outcome: 'failed', text, detail: 'DSH reached the model output token limit' };
|
|
@@ -14,6 +16,19 @@ function resultOf(reason, text) {
|
|
|
14
16
|
default: return { outcome: 'failed', text, detail: 'DSH returned an unsupported turn ending' };
|
|
15
17
|
}
|
|
16
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
|
+
}
|
|
17
32
|
/** Uses public session-controller and inbox events to account for one A2A prompt's exact DSH turn. */
|
|
18
33
|
export class DshA2ABackend {
|
|
19
34
|
ctx;
|
|
@@ -84,6 +99,8 @@ export class DshA2ABackend {
|
|
|
84
99
|
let messageId;
|
|
85
100
|
let turn;
|
|
86
101
|
let text = '';
|
|
102
|
+
let finalAnswerExpected = false;
|
|
103
|
+
let authoritativeAnswer = false;
|
|
87
104
|
let settled = false;
|
|
88
105
|
const owns = (message) => message.source.kind === 'user'
|
|
89
106
|
&& 'rpcId' in message.source && message.source.rpcId === options.requestId;
|
|
@@ -132,12 +149,21 @@ export class DshA2ABackend {
|
|
|
132
149
|
if (session !== agent.session || turn === undefined)
|
|
133
150
|
return;
|
|
134
151
|
if (event.type === 'assistant/message' && event.data.turn === turn) {
|
|
135
|
-
const next = event.data.message.content
|
|
136
|
-
if (next.
|
|
137
|
-
text = next;
|
|
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;
|
|
138
164
|
}
|
|
139
165
|
else if (event.type === 'turn/end' && event.data.turn === turn) {
|
|
140
|
-
settle(resultOf(event.data.reason, text));
|
|
166
|
+
settle(resultOf(event.data.reason, text, finalAnswerExpected));
|
|
141
167
|
}
|
|
142
168
|
}));
|
|
143
169
|
options.signal.addEventListener('abort', cancel, { once: true });
|
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
|
}
|
|
File without changes
|
|
@@ -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;;;KCx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AAoB;;EAE9D,qBAAqB;IAAS,QAAQ;MAAqB;EAC3D,MAAM;IACJ,QAAQ;IACR;IACA;MACE;;KAGM,mBAAmB;UAEd;EACf,KAAK,oBAAoB,QAAQ;EACjC,KAAK,QAAQ,mBAAmB;;;;;EAKhC,QAAQ,yBAAyB,QAAQ,mBAAmB;;KAGlD;EACV;EACA;EACA;EACA;;KAGU,+BAA+B,QACzC,KACE;KAKQ;EACV;;EAEA,kBAAkB;EAClB,cAAc;EACd,eAAe;;;;;;;EAOf,aAAa,kBAAgB,SAAS,6BAA6B;;;;;;;EAOnE,sBACE,SAAS,6BACN;EACL,gBAAgB;EAChB,4BAA4B;EAC5B,mBAAmB;EACnB;EACA;EACA;;EAEA,4BAA4B;;EAE5B,mBAAmB;EACnB,sBAAsB;;;;;EAKtB,qBACE,KAAK,4BACL;IAAO,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;E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AU,OAAO;;;;;;;IAkCM,OAAA;MAAE;QAAiB;IAGd,YAAA;MAAE;QAAiB;;EAMxC,QAAQ,OAAO,sBAAsB,cAAc;EAkBpD,gBAAgB;IAAU,SAAS;MAAqB,QAAQ;EAWhE,UAAU;IACd,QAAQ;IACR,SAAS;MACP,QAAQ;EAMN,QACJ,OAAO;IAAwB,QAAQ;IAAkB;MACxD;EAMG,SACJ,OAAO;IAAwB,QAAQ;IAAkB;MACxD;EAMG,gBACJ,OAAO;IACL,QAAQ;IACR;IACA;MAED,QAAQ;EAML,OAAO;IAAS,QAAQ;IAAkB;MAAoB;EAM9D,oBAAoB;IAAS,QAAQ;MAAqB;EAM1D,MAAM;IACV,QAAQ;IACR;IACA;MACE;EAQJ,YAAY;UAeE;UAkBA;UAmBN;UAcA;;wBA+BM,iBAAiB,SAAS,oBAAoB;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),
|