@wrongstack/acp 1.1.1 → 1.1.4
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/dist/agent/stdio-transport.d.ts +2 -0
- package/dist/client/acp-request-state.d.ts +4 -0
- package/dist/client/acp-session-ops.d.ts +19 -0
- package/dist/client/acp-session-prompt.d.ts +2 -2
- package/dist/client/acp-session-types.d.ts +67 -1
- package/dist/client/acp-session-updates.d.ts +9 -0
- package/dist/client/acp-session.d.ts +21 -1
- package/dist/client.js +343 -41
- package/dist/index.d.ts +3 -1
- package/dist/index.js +347 -42
- package/dist/integration/acp-agent-failure.d.ts +20 -0
- package/dist/integration/acp-subagent-runner-options.d.ts +88 -0
- package/dist/integration/acp-subagent-runner.d.ts +4 -63
- package/dist/integration/run-one-acp-task.d.ts +3 -0
- package/dist/registry/contracts.d.ts +6 -0
- package/package.json +3 -3
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classify the error an external agent ends a turn with.
|
|
3
|
+
*
|
|
4
|
+
* Claude's ACP adapter fails a `session/prompt` with a JSON-RPC internal error
|
|
5
|
+
* whose message carries Claude's own text ("You've hit your limit · resets
|
|
6
|
+
* 3pm") and whose `data.errorKind` names the provider failure. Reported as a
|
|
7
|
+
* generic prompt failure, a spent subscription quota looked like a broken
|
|
8
|
+
* tool: the leader retried a worker that could not run for hours.
|
|
9
|
+
*/
|
|
10
|
+
import type { SubagentError } from '@wrongstack/core/types';
|
|
11
|
+
/**
|
|
12
|
+
* The SubagentError for a JSON-RPC error that names a provider failure, or
|
|
13
|
+
* undefined when it is something else (left to the generic mapping).
|
|
14
|
+
*/
|
|
15
|
+
export declare function classifyAgentFailure(rpc: {
|
|
16
|
+
code?: number;
|
|
17
|
+
message: string;
|
|
18
|
+
data?: unknown;
|
|
19
|
+
}, agent: string, now?: number): SubagentError | undefined;
|
|
20
|
+
//# sourceMappingURL=acp-agent-failure.d.ts.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/** Options for {@link makeACPSubagentRunner} (split out to keep the runner file small). */
|
|
2
|
+
import type { SubagentRunContext, TaskSpec } from '@wrongstack/core/types';
|
|
3
|
+
import type { ACPProgressEvent, ACPProgressHandler } from '../client/acp-session.js';
|
|
4
|
+
import type { AcpSteerOutcome } from '../client/acp-session-ops.js';
|
|
5
|
+
import type { PermissionPolicy } from '../client/permission.js';
|
|
6
|
+
import type { McpServer } from '../types/acp-v1.js';
|
|
7
|
+
export interface ACPSubagentRunnerOptions {
|
|
8
|
+
/** How to spawn the external agent. */
|
|
9
|
+
command: string;
|
|
10
|
+
args?: string[] | undefined;
|
|
11
|
+
env?: Record<string, string> | undefined;
|
|
12
|
+
cwd?: string | undefined;
|
|
13
|
+
/** Subagent role label — surfaced in errors and used for logging. */
|
|
14
|
+
role?: string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Cap for each request to the agent other than a prompt turn (initialize,
|
|
17
|
+
* session/new, …). Defaults to 5 minutes. A prompt turn has no length cap:
|
|
18
|
+
* it ends when the agent finishes, is aborted through `ctx.signal`, or goes
|
|
19
|
+
* silent for `promptIdleTimeoutMs`.
|
|
20
|
+
*/
|
|
21
|
+
timeoutMs?: number | undefined;
|
|
22
|
+
/** See `ACPSessionOptions.promptIdleTimeoutMs`. Default 10 minutes. */
|
|
23
|
+
promptIdleTimeoutMs?: number | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Filesystem sandbox root. Defaults to `options.cwd` (when set) or
|
|
26
|
+
* the process's current working directory. All `fs/read_text_file` /
|
|
27
|
+
* `fs/write_text_file` calls are bounded to this root.
|
|
28
|
+
*/
|
|
29
|
+
projectRoot?: string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Live progress callback. Forwarded to `ACPSession.prompt` so the host
|
|
32
|
+
* can render the external agent's tool calls / diffs / text as they
|
|
33
|
+
* stream, instead of waiting for the buffered final result.
|
|
34
|
+
*/
|
|
35
|
+
onProgress?: ACPProgressHandler | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Host live-view hook. Called with the run context so a fleet/TUI/WebUI
|
|
38
|
+
* publisher can attribute tool calls and text to the right subagent.
|
|
39
|
+
* Invoked in addition to `onProgress`.
|
|
40
|
+
*/
|
|
41
|
+
publishLive?: ((ctx: SubagentRunContext, task: TaskSpec, event: ACPProgressEvent) => void) | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Called while a turn runs on an agent that accepts steering, with a
|
|
44
|
+
* function that injects a message into that turn; the returned function is
|
|
45
|
+
* called when the turn ends. Lets the host route live notes to the worker.
|
|
46
|
+
*/
|
|
47
|
+
onTurnLive?: ((ctx: SubagentRunContext, task: TaskSpec, steer: (text: string) => Promise<AcpSteerOutcome>) => (() => void) | undefined) | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Permission policy for the external agent's `session/request_permission`
|
|
50
|
+
* calls. Defaults to the session's own default. Inject the host's
|
|
51
|
+
* confirm/trust UI here so an external agent's file writes / commands
|
|
52
|
+
* are surfaced to a human instead of silently auto-approved.
|
|
53
|
+
*/
|
|
54
|
+
permissionPolicy?: PermissionPolicy | undefined;
|
|
55
|
+
/** Session mode to switch to after `session/new` (see ACPSessionOptions.initialModeId). */
|
|
56
|
+
initialModeId?: string | undefined;
|
|
57
|
+
/** Fail the session when the agent does not offer `initialModeId`. */
|
|
58
|
+
requireInitialMode?: boolean | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* MCP servers to expose to the external agent (passed through
|
|
61
|
+
* `session/new` / `session/load`). Stdio servers are always sent;
|
|
62
|
+
* HTTP/SSE are filtered by the agent's advertised capabilities.
|
|
63
|
+
*/
|
|
64
|
+
mcpServers?: McpServer[] | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Per-session setup, computed from the task and run context each time a
|
|
67
|
+
* session starts (once per task, or once for a persistent session): extra
|
|
68
|
+
* MCP servers, appended to `mcpServers`, and the `_meta` for `session/new`.
|
|
69
|
+
* Lets the host give each worker its own identity on shared channels.
|
|
70
|
+
*/
|
|
71
|
+
sessionSetup?: ((task: TaskSpec, ctx: SubagentRunContext) => AcpSessionSetup) | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* When true, the underlying `ACPSession` is kept open across multiple
|
|
74
|
+
* runner invocations (multi-turn conversation — the external agent
|
|
75
|
+
* keeps its context). The caller MUST call `stop()` to tear it down.
|
|
76
|
+
* Defaults to false (one process per task).
|
|
77
|
+
*/
|
|
78
|
+
persistent?: boolean | undefined;
|
|
79
|
+
}
|
|
80
|
+
export interface AcpSessionSetup {
|
|
81
|
+
mcpServers?: McpServer[] | undefined;
|
|
82
|
+
meta?: Record<string, unknown> | undefined;
|
|
83
|
+
/** Per-task guidance placed before the user's task in the ACP prompt turn. */
|
|
84
|
+
promptPrefix?: string | undefined;
|
|
85
|
+
/** Replaces `permissionPolicy` for this session (e.g. bound to the delegating session). */
|
|
86
|
+
permissionPolicy?: PermissionPolicy | undefined;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=acp-subagent-runner-options.d.ts.map
|
|
@@ -11,62 +11,10 @@
|
|
|
11
11
|
* Connected to the Director / MultiAgentCoordinator via the
|
|
12
12
|
* `SubagentRunner` interface (same shape as `AgentSubagentRunner`).
|
|
13
13
|
*/
|
|
14
|
-
import type {
|
|
15
|
-
import {
|
|
16
|
-
import type {
|
|
17
|
-
|
|
18
|
-
export interface ACPSubagentRunnerOptions {
|
|
19
|
-
/** How to spawn the external agent. */
|
|
20
|
-
command: string;
|
|
21
|
-
args?: string[] | undefined;
|
|
22
|
-
env?: Record<string, string> | undefined;
|
|
23
|
-
cwd?: string | undefined;
|
|
24
|
-
/** Subagent role label — surfaced in errors and used for logging. */
|
|
25
|
-
role?: string | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Hard wall-clock cap for one prompt turn. Defaults to 5 minutes.
|
|
28
|
-
* Overrides `SubagentRunContext.budget.limits.timeoutMs` if both are set.
|
|
29
|
-
*/
|
|
30
|
-
timeoutMs?: number | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* Filesystem sandbox root. Defaults to `options.cwd` (when set) or
|
|
33
|
-
* the process's current working directory. All `fs/read_text_file` /
|
|
34
|
-
* `fs/write_text_file` calls are bounded to this root.
|
|
35
|
-
*/
|
|
36
|
-
projectRoot?: string | undefined;
|
|
37
|
-
/**
|
|
38
|
-
* Live progress callback. Forwarded to `ACPSession.prompt` so the host
|
|
39
|
-
* can render the external agent's tool calls / diffs / text as they
|
|
40
|
-
* stream, instead of waiting for the buffered final result.
|
|
41
|
-
*/
|
|
42
|
-
onProgress?: ACPProgressHandler | undefined;
|
|
43
|
-
/**
|
|
44
|
-
* Host live-view hook. Called with the run context so a fleet/TUI/WebUI
|
|
45
|
-
* publisher can attribute tool calls and text to the right subagent.
|
|
46
|
-
* Invoked in addition to `onProgress`.
|
|
47
|
-
*/
|
|
48
|
-
publishLive?: ((ctx: SubagentRunContext, task: TaskSpec, event: ACPProgressEvent) => void) | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* Permission policy for the external agent's `session/request_permission`
|
|
51
|
-
* calls. Defaults to the session's own default. Inject the host's
|
|
52
|
-
* confirm/trust UI here so an external agent's file writes / commands
|
|
53
|
-
* are surfaced to a human instead of silently auto-approved.
|
|
54
|
-
*/
|
|
55
|
-
permissionPolicy?: PermissionPolicy | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* MCP servers to expose to the external agent (passed through
|
|
58
|
-
* `session/new` / `session/load`). Stdio servers are always sent;
|
|
59
|
-
* HTTP/SSE are filtered by the agent's advertised capabilities.
|
|
60
|
-
*/
|
|
61
|
-
mcpServers?: McpServer[] | undefined;
|
|
62
|
-
/**
|
|
63
|
-
* When true, the underlying `ACPSession` is kept open across multiple
|
|
64
|
-
* runner invocations (multi-turn conversation — the external agent
|
|
65
|
-
* keeps its context). The caller MUST call `stop()` to tear it down.
|
|
66
|
-
* Defaults to false (one process per task).
|
|
67
|
-
*/
|
|
68
|
-
persistent?: boolean | undefined;
|
|
69
|
-
}
|
|
14
|
+
import type { SubagentRunner } from '@wrongstack/core/types';
|
|
15
|
+
import { ACPSession } from '../client/acp-session.js';
|
|
16
|
+
import type { ACPSubagentRunnerOptions } from './acp-subagent-runner-options.js';
|
|
17
|
+
export type { ACPSubagentRunnerOptions, AcpSessionSetup } from './acp-subagent-runner-options.js';
|
|
70
18
|
/**
|
|
71
19
|
* Static catalog of agent ids → spawn options.
|
|
72
20
|
*
|
|
@@ -86,13 +34,6 @@ export declare const ACP_AGENT_COMMANDS: Record<string, ACPSubagentRunnerOptions
|
|
|
86
34
|
* explicitly.
|
|
87
35
|
*/
|
|
88
36
|
export declare function makeACPSubagentRunner(options: ACPSubagentRunnerOptions): Promise<SubagentRunner>;
|
|
89
|
-
/**
|
|
90
|
-
* Build a long-lived `SubagentRunner` plus an explicit `stop()` for
|
|
91
|
-
* teardown. The caller is responsible for calling `stop()` when done
|
|
92
|
-
* (or when the host's signal fires). Useful for the `wstack acp spawn`
|
|
93
|
-
* CLI command, which holds the child open for the duration of a user
|
|
94
|
-
* task and tears down on SIGINT.
|
|
95
|
-
*/
|
|
96
37
|
export declare function makeACPSubagentRunnerWithStop(options: ACPSubagentRunnerOptions): Promise<{
|
|
97
38
|
runner: SubagentRunner;
|
|
98
39
|
stop: () => void | Promise<void>;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { ACPProgressHandler } from '../client/acp-session.js';
|
|
8
8
|
import type { PermissionPolicy } from '../client/permission.js';
|
|
9
|
+
import { type ACPSubagentRunnerOptions } from './acp-subagent-runner.js';
|
|
9
10
|
export interface RunOneAcpTaskOptions {
|
|
10
11
|
command: string;
|
|
11
12
|
args?: string[] | undefined;
|
|
@@ -22,6 +23,8 @@ export interface RunOneAcpTaskOptions {
|
|
|
22
23
|
permissionPolicy?: PermissionPolicy | undefined;
|
|
23
24
|
/** Owning WrongStack session for session-scoped ACP operations. */
|
|
24
25
|
sessionId?: string | undefined;
|
|
26
|
+
/** Per-session MCP servers and `_meta`; see {@link ACPSubagentRunnerOptions.sessionSetup}. */
|
|
27
|
+
sessionSetup?: ACPSubagentRunnerOptions['sessionSetup'];
|
|
25
28
|
}
|
|
26
29
|
export interface RunOneAcpTaskResult {
|
|
27
30
|
result: string;
|
|
@@ -48,6 +48,12 @@ export interface ACPAgentDescriptor {
|
|
|
48
48
|
fs: boolean;
|
|
49
49
|
};
|
|
50
50
|
integration: ACPIntegration;
|
|
51
|
+
/**
|
|
52
|
+
* The agent's context window in tokens, when the vendor publishes one.
|
|
53
|
+
* Shown as the session's context limit when the agent leads the session;
|
|
54
|
+
* absent means unknown.
|
|
55
|
+
*/
|
|
56
|
+
contextWindow?: number;
|
|
51
57
|
/** Documentation URL — shown in `wstack acp list` and the ensemble UI. */
|
|
52
58
|
docs: string;
|
|
53
59
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wrongstack/acp",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ACP (Agent Client Protocol) integration for WrongStack — client + agent support",
|
|
6
6
|
"keywords": [
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@agentclientprotocol/sdk": "^1.4.0",
|
|
63
|
-
"@wrongstack/core": "1.1.
|
|
64
|
-
"@wrongstack/primitives": "1.1.
|
|
63
|
+
"@wrongstack/core": "1.1.2",
|
|
64
|
+
"@wrongstack/primitives": "1.1.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/node": "^26.5.1",
|