acpx 0.3.1 → 0.4.1
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 +65 -16
- package/dist/{acp-jsonrpc-BNHXq7qK.js → acp-jsonrpc-BbBgC5gO.js} +15 -2
- package/dist/acp-jsonrpc-BbBgC5gO.js.map +1 -0
- package/dist/cli-idpWyCOs.js +176 -0
- package/dist/cli-idpWyCOs.js.map +1 -0
- package/dist/cli.d.ts +1 -118
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +235 -336
- package/dist/cli.js.map +1 -1
- package/dist/flags-CCcX9fZj.js +194 -0
- package/dist/flags-CCcX9fZj.js.map +1 -0
- package/dist/flows-BL1tSvZT.js +1551 -0
- package/dist/flows-BL1tSvZT.js.map +1 -0
- package/dist/flows.d.ts +292 -0
- package/dist/flows.d.ts.map +1 -0
- package/dist/flows.js +2 -0
- package/dist/{output-BmkPP7qE.js → output-Du3m6oPQ.js} +139 -30
- package/dist/output-Du3m6oPQ.js.map +1 -0
- package/dist/{output-render-DEAaMxg8.js → output-render-Bz58qaQn.js} +10 -10
- package/dist/output-render-Bz58qaQn.js.map +1 -0
- package/dist/{queue-ipc-EQLpBMKv.js → queue-ipc-CE8_QGX3.js} +258 -95
- package/dist/queue-ipc-CE8_QGX3.js.map +1 -0
- package/dist/{session-C2Q8ktsN.js → session-RO_LZUnv.js} +687 -138
- package/dist/session-RO_LZUnv.js.map +1 -0
- package/dist/types-CeRKmEQ1.d.ts +137 -0
- package/dist/types-CeRKmEQ1.d.ts.map +1 -0
- package/package.json +44 -16
- package/skills/acpx/SKILL.md +22 -5
- package/dist/acp-jsonrpc-BNHXq7qK.js.map +0 -1
- package/dist/output-BmkPP7qE.js.map +0 -1
- package/dist/output-render-DEAaMxg8.js.map +0 -1
- package/dist/queue-ipc-EQLpBMKv.js.map +0 -1
- package/dist/runtime-session-id-C544sPPL.js +0 -31
- package/dist/runtime-session-id-C544sPPL.js.map +0 -1
- package/dist/session-C2Q8ktsN.js.map +0 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { AgentCapabilities, ContentBlock, McpServer, SessionConfigOption } from "@agentclientprotocol/sdk";
|
|
2
|
+
|
|
3
|
+
//#region src/prompt-content.d.ts
|
|
4
|
+
type PromptInput = ContentBlock[];
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/types.d.ts
|
|
7
|
+
declare const PERMISSION_MODES: readonly ["approve-all", "approve-reads", "deny-all"];
|
|
8
|
+
type PermissionMode = (typeof PERMISSION_MODES)[number];
|
|
9
|
+
declare const AUTH_POLICIES: readonly ["skip", "fail"];
|
|
10
|
+
type AuthPolicy = (typeof AUTH_POLICIES)[number];
|
|
11
|
+
declare const NON_INTERACTIVE_PERMISSION_POLICIES: readonly ["deny", "fail"];
|
|
12
|
+
type NonInteractivePermissionPolicy = (typeof NON_INTERACTIVE_PERMISSION_POLICIES)[number];
|
|
13
|
+
type SessionEventLog = {
|
|
14
|
+
active_path: string;
|
|
15
|
+
segment_count: number;
|
|
16
|
+
max_segment_bytes: number;
|
|
17
|
+
max_segments: number;
|
|
18
|
+
last_write_at?: string;
|
|
19
|
+
last_write_error?: string | null;
|
|
20
|
+
};
|
|
21
|
+
declare const SESSION_RECORD_SCHEMA: "acpx.session.v1";
|
|
22
|
+
type SessionMessageImage = {
|
|
23
|
+
source: string;
|
|
24
|
+
size?: {
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
} | null;
|
|
28
|
+
};
|
|
29
|
+
type SessionUserContent = {
|
|
30
|
+
Text: string;
|
|
31
|
+
} | {
|
|
32
|
+
Mention: {
|
|
33
|
+
uri: string;
|
|
34
|
+
content: string;
|
|
35
|
+
};
|
|
36
|
+
} | {
|
|
37
|
+
Image: SessionMessageImage;
|
|
38
|
+
};
|
|
39
|
+
type SessionToolUse = {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
raw_input: string;
|
|
43
|
+
input: unknown;
|
|
44
|
+
is_input_complete: boolean;
|
|
45
|
+
thought_signature?: string | null;
|
|
46
|
+
};
|
|
47
|
+
type SessionToolResultContent = {
|
|
48
|
+
Text: string;
|
|
49
|
+
} | {
|
|
50
|
+
Image: SessionMessageImage;
|
|
51
|
+
};
|
|
52
|
+
type SessionToolResult = {
|
|
53
|
+
tool_use_id: string;
|
|
54
|
+
tool_name: string;
|
|
55
|
+
is_error: boolean;
|
|
56
|
+
content: SessionToolResultContent;
|
|
57
|
+
output?: unknown;
|
|
58
|
+
};
|
|
59
|
+
type SessionAgentContent = {
|
|
60
|
+
Text: string;
|
|
61
|
+
} | {
|
|
62
|
+
Thinking: {
|
|
63
|
+
text: string;
|
|
64
|
+
signature?: string | null;
|
|
65
|
+
};
|
|
66
|
+
} | {
|
|
67
|
+
RedactedThinking: string;
|
|
68
|
+
} | {
|
|
69
|
+
ToolUse: SessionToolUse;
|
|
70
|
+
};
|
|
71
|
+
type SessionUserMessage = {
|
|
72
|
+
id: string;
|
|
73
|
+
content: SessionUserContent[];
|
|
74
|
+
};
|
|
75
|
+
type SessionAgentMessage = {
|
|
76
|
+
content: SessionAgentContent[];
|
|
77
|
+
tool_results: Record<string, SessionToolResult>;
|
|
78
|
+
reasoning_details?: unknown;
|
|
79
|
+
};
|
|
80
|
+
type SessionMessage = {
|
|
81
|
+
User: SessionUserMessage;
|
|
82
|
+
} | {
|
|
83
|
+
Agent: SessionAgentMessage;
|
|
84
|
+
} | "Resume";
|
|
85
|
+
type SessionTokenUsage = {
|
|
86
|
+
input_tokens?: number;
|
|
87
|
+
output_tokens?: number;
|
|
88
|
+
cache_creation_input_tokens?: number;
|
|
89
|
+
cache_read_input_tokens?: number;
|
|
90
|
+
};
|
|
91
|
+
type SessionAcpxState = {
|
|
92
|
+
current_mode_id?: string;
|
|
93
|
+
desired_mode_id?: string;
|
|
94
|
+
current_model_id?: string;
|
|
95
|
+
available_models?: string[];
|
|
96
|
+
available_commands?: string[];
|
|
97
|
+
config_options?: SessionConfigOption[];
|
|
98
|
+
session_options?: {
|
|
99
|
+
model?: string;
|
|
100
|
+
allowed_tools?: string[];
|
|
101
|
+
max_turns?: number;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
type SessionRecord = {
|
|
105
|
+
schema: typeof SESSION_RECORD_SCHEMA;
|
|
106
|
+
acpxRecordId: string;
|
|
107
|
+
acpSessionId: string;
|
|
108
|
+
agentSessionId?: string;
|
|
109
|
+
agentCommand: string;
|
|
110
|
+
cwd: string;
|
|
111
|
+
name?: string;
|
|
112
|
+
createdAt: string;
|
|
113
|
+
lastUsedAt: string;
|
|
114
|
+
lastSeq: number;
|
|
115
|
+
lastRequestId?: string;
|
|
116
|
+
eventLog: SessionEventLog;
|
|
117
|
+
closed?: boolean;
|
|
118
|
+
closedAt?: string;
|
|
119
|
+
pid?: number;
|
|
120
|
+
agentStartedAt?: string;
|
|
121
|
+
lastPromptAt?: string;
|
|
122
|
+
lastAgentExitCode?: number | null;
|
|
123
|
+
lastAgentExitSignal?: NodeJS.Signals | null;
|
|
124
|
+
lastAgentExitAt?: string;
|
|
125
|
+
lastAgentDisconnectReason?: string;
|
|
126
|
+
protocolVersion?: number;
|
|
127
|
+
agentCapabilities?: AgentCapabilities;
|
|
128
|
+
title?: string | null;
|
|
129
|
+
messages: SessionMessage[];
|
|
130
|
+
updated_at: string;
|
|
131
|
+
cumulative_token_usage: SessionTokenUsage;
|
|
132
|
+
request_token_usage: Record<string, SessionTokenUsage>;
|
|
133
|
+
acpx?: SessionAcpxState;
|
|
134
|
+
};
|
|
135
|
+
//#endregion
|
|
136
|
+
export { SessionRecord as a, PermissionMode as i, McpServer as n, PromptInput as o, NonInteractivePermissionPolicy as r, AuthPolicy as t };
|
|
137
|
+
//# sourceMappingURL=types-CeRKmEQ1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-CeRKmEQ1.d.ts","names":[],"sources":["../src/prompt-content.ts","../src/types.ts"],"mappings":";;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BAAA;EACA,kBAAA;EACA,cAAA,GAAiB,mBAAA;EACjB,eAAA;IACE,KAAA;IACA,aAAA;IACA,SAAA;EAAA;AAAA;AAAA,KAIQ,aAAA;EACV,MAAA,SAAe,qBAAA;EACf,YAAA;EACA,YAAA;EACA,cAAA;EACA,YAAA;EACA,GAAA;EACA,IAAA;EACA,SAAA;EACA,UAAA;EACA,OAAA;EACA,aAAA;EACA,QAAA,EAAU,eAAA;EACV,MAAA;EACA,QAAA;EACA,GAAA;EACA,cAAA;EACA,YAAA;EACA,iBAAA;EACA,mBAAA,GAAsB,MAAA,CAAO,OAAA;EAC7B,eAAA;EACA,yBAAA;EACA,eAAA;EACA,iBAAA,GAAoB,iBAAA;EACpB,KAAA;EACA,QAAA,EAAU,cAAA;EACV,UAAA;EACA,sBAAA,EAAwB,iBAAA;EACxB,mBAAA,EAAqB,MAAA,SAAe,iBAAA;EACpC,IAAA,GAAO,gBAAA;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "acpx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Headless CLI client for the Agent Client Protocol (ACP) — talk to coding agents from the command line",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"acp",
|
|
@@ -27,21 +27,28 @@
|
|
|
27
27
|
"LICENSE"
|
|
28
28
|
],
|
|
29
29
|
"type": "module",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": "./dist/cli.js",
|
|
32
|
+
"./flows": "./dist/flows.js",
|
|
33
|
+
"./dist/*": "./dist/*",
|
|
34
|
+
"./package.json": "./package.json"
|
|
35
|
+
},
|
|
30
36
|
"scripts": {
|
|
31
|
-
"build": "tsdown src/cli.ts --format esm --dts --clean --platform node --target node22 --no-fixedExtension",
|
|
37
|
+
"build": "tsdown src/cli.ts src/flows.ts --format esm --dts --clean --platform node --target node22 --no-fixedExtension",
|
|
32
38
|
"build:test": "node -e \"require('node:fs').rmSync('dist-test',{recursive:true,force:true})\" && tsc -p tsconfig.test.json",
|
|
33
|
-
"check": "pnpm run format:check && pnpm run typecheck && pnpm run lint && pnpm run build && pnpm run test:coverage",
|
|
39
|
+
"check": "pnpm run format:check && pnpm run typecheck && pnpm run lint && pnpm run build && pnpm run viewer:typecheck && pnpm run viewer:build && pnpm run test:coverage",
|
|
34
40
|
"check:docs": "pnpm run format:docs:check && pnpm run lint:docs",
|
|
35
41
|
"conformance:run": "tsx conformance/runner/run.ts",
|
|
36
42
|
"dev": "tsx src/cli.ts",
|
|
37
43
|
"format": "oxfmt --write",
|
|
38
44
|
"format:check": "oxfmt --check",
|
|
39
45
|
"format:diff": "oxfmt --write && git --no-pager diff",
|
|
40
|
-
"format:docs": "git ls-files 'docs/**/*.md' 'README.md' | xargs oxfmt --write",
|
|
41
|
-
"format:docs:check": "git ls-files 'docs/**/*.md' 'README.md' | xargs oxfmt --check",
|
|
42
|
-
"lint": "oxlint --type-aware src && pnpm run lint:persisted-key-casing",
|
|
43
|
-
"lint:docs": "markdownlint-cli2 README.md docs/**/*.md",
|
|
46
|
+
"format:docs": "git ls-files 'docs/**/*.md' 'examples/flows/**/*.md' 'README.md' | xargs oxfmt --write",
|
|
47
|
+
"format:docs:check": "git ls-files 'docs/**/*.md' 'examples/flows/**/*.md' 'README.md' | xargs oxfmt --check",
|
|
48
|
+
"lint": "oxlint --type-aware src && pnpm run lint:persisted-key-casing && pnpm run lint:flow-schema-terms",
|
|
49
|
+
"lint:docs": "markdownlint-cli2 README.md docs/**/*.md examples/flows/**/*.md",
|
|
44
50
|
"lint:fix": "oxlint --type-aware --fix src && pnpm run format",
|
|
51
|
+
"lint:flow-schema-terms": "tsx scripts/lint-flow-schema-terms.ts",
|
|
45
52
|
"lint:persisted-key-casing": "tsx scripts/lint-persisted-key-casing.ts",
|
|
46
53
|
"perf:report": "tsx scripts/perf-report.ts",
|
|
47
54
|
"precommit": "pnpm exec lint-staged && pnpm run -s build",
|
|
@@ -51,25 +58,46 @@
|
|
|
51
58
|
"test:coverage": "pnpm run build:test && node --experimental-test-coverage --test-coverage-lines=83 --test-coverage-branches=76 --test-coverage-functions=86 --test dist-test/test/*.test.js",
|
|
52
59
|
"test:live": "pnpm run build:test && node --test dist-test/test/cursor-live.integration.js",
|
|
53
60
|
"typecheck": "tsgo --noEmit",
|
|
54
|
-
"typecheck:tsc": "tsc --noEmit"
|
|
61
|
+
"typecheck:tsc": "tsc --noEmit",
|
|
62
|
+
"viewer": "tsx examples/flows/replay-viewer/server.ts start",
|
|
63
|
+
"viewer:build": "vite build --config examples/flows/replay-viewer/vite.config.ts",
|
|
64
|
+
"viewer:dev": "tsx examples/flows/replay-viewer/server.ts start",
|
|
65
|
+
"viewer:open": "tsx examples/flows/replay-viewer/server.ts start --open",
|
|
66
|
+
"viewer:preview": "tsx examples/flows/replay-viewer/server.ts start",
|
|
67
|
+
"viewer:status": "tsx examples/flows/replay-viewer/server.ts status",
|
|
68
|
+
"viewer:stop": "tsx examples/flows/replay-viewer/server.ts stop",
|
|
69
|
+
"viewer:typecheck": "tsc -p examples/flows/replay-viewer/tsconfig.json --noEmit && tsc -p examples/flows/replay-viewer/tsconfig.server.json --noEmit"
|
|
55
70
|
},
|
|
56
71
|
"dependencies": {
|
|
57
|
-
"@agentclientprotocol/sdk": "^0.
|
|
72
|
+
"@agentclientprotocol/sdk": "^0.17.0",
|
|
58
73
|
"commander": "^14.0.3",
|
|
59
|
-
"skillflag": "^0.1.4"
|
|
74
|
+
"skillflag": "^0.1.4",
|
|
75
|
+
"tsx": "^4.0.0"
|
|
60
76
|
},
|
|
61
77
|
"devDependencies": {
|
|
62
78
|
"@types/node": "^25.3.5",
|
|
63
|
-
"@
|
|
79
|
+
"@types/react": "^19.2.14",
|
|
80
|
+
"@types/react-dom": "^19.2.3",
|
|
81
|
+
"@types/react-test-renderer": "^19.1.0",
|
|
82
|
+
"@types/ws": "^8.18.1",
|
|
83
|
+
"@typescript/native-preview": "7.0.0-dev.20260328.1",
|
|
84
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
85
|
+
"@xyflow/react": "^12.10.1",
|
|
86
|
+
"elkjs": "^0.11.1",
|
|
87
|
+
"fast-json-patch": "^3.1.1",
|
|
64
88
|
"husky": "^9.1.7",
|
|
65
89
|
"lint-staged": "^16.3.2",
|
|
66
|
-
"markdownlint-cli2": "^0.
|
|
67
|
-
"oxfmt": "^0.
|
|
90
|
+
"markdownlint-cli2": "^0.22.0",
|
|
91
|
+
"oxfmt": "^0.42.0",
|
|
68
92
|
"oxlint": "^1.51.0",
|
|
69
|
-
"oxlint-tsgolint": "^0.
|
|
93
|
+
"oxlint-tsgolint": "^0.18.1",
|
|
94
|
+
"react": "^19.2.4",
|
|
95
|
+
"react-dom": "^19.2.4",
|
|
96
|
+
"react-test-renderer": "^19.2.0",
|
|
70
97
|
"tsdown": "^0.21.0-beta.2",
|
|
71
|
-
"
|
|
72
|
-
"
|
|
98
|
+
"typescript": "^6.0.2",
|
|
99
|
+
"vite": "^8.0.3",
|
|
100
|
+
"ws": "^8.18.3"
|
|
73
101
|
},
|
|
74
102
|
"lint-staged": {
|
|
75
103
|
"*.{js,ts}": [
|
package/skills/acpx/SKILL.md
CHANGED
|
@@ -29,7 +29,7 @@ Core capabilities:
|
|
|
29
29
|
- Local agent process checks via `status`
|
|
30
30
|
- Stable ACP client methods for filesystem and terminal requests
|
|
31
31
|
- Stable ACP `authenticate` handshake via env/config credentials
|
|
32
|
-
- Structured streaming output (`text`, `json`, `quiet`)
|
|
32
|
+
- Structured streaming output (`text`, `json`, `quiet`) with optional `--suppress-reads`
|
|
33
33
|
- Built-in agent registry plus raw `--agent` escape hatch
|
|
34
34
|
|
|
35
35
|
## Install
|
|
@@ -74,16 +74,20 @@ Friendly agent names resolve to commands:
|
|
|
74
74
|
- `pi` -> `npx pi-acp`
|
|
75
75
|
- `openclaw` -> `openclaw acp`
|
|
76
76
|
- `codex` -> `npx @zed-industries/codex-acp`
|
|
77
|
-
- `claude` -> `npx -y @
|
|
77
|
+
- `claude` -> `npx -y @agentclientprotocol/claude-agent-acp`
|
|
78
78
|
- `gemini` -> `gemini --acp`
|
|
79
79
|
- `cursor` -> `cursor-agent acp`
|
|
80
80
|
- `copilot` -> `copilot --acp --stdio`
|
|
81
81
|
- `droid` -> `droid exec --output-format acp` (`factory-droid` and `factorydroid` also resolve to `droid`)
|
|
82
|
+
- `iflow` -> `iflow --experimental-acp`
|
|
83
|
+
- `kilocode` -> `npx -y @kilocode/cli acp`
|
|
82
84
|
- `kimi` -> `kimi acp`
|
|
85
|
+
- `kiro` -> `kiro-cli-chat acp`
|
|
83
86
|
- `opencode` -> `npx -y opencode-ai acp`
|
|
84
|
-
- `
|
|
85
|
-
- `
|
|
87
|
+
- `qoder` -> `qodercli --acp`
|
|
88
|
+
Forwards Qoder-native `--allowed-tools` and `--max-turns` startup flags from `acpx` session options.
|
|
86
89
|
- `qwen` -> `qwen --acp`
|
|
90
|
+
- `trae` -> `traecli acp serve`
|
|
87
91
|
|
|
88
92
|
Rules:
|
|
89
93
|
|
|
@@ -135,12 +139,13 @@ Behavior:
|
|
|
135
139
|
- Runs a single prompt in a temporary ACP session
|
|
136
140
|
- Does not reuse or save persistent session state
|
|
137
141
|
|
|
138
|
-
### Cancel / Mode / Config
|
|
142
|
+
### Cancel / Mode / Config / Model
|
|
139
143
|
|
|
140
144
|
```bash
|
|
141
145
|
acpx codex cancel
|
|
142
146
|
acpx codex set-mode auto
|
|
143
147
|
acpx codex set thought_level high
|
|
148
|
+
acpx codex set model gpt-5.4
|
|
144
149
|
```
|
|
145
150
|
|
|
146
151
|
Behavior:
|
|
@@ -150,6 +155,8 @@ Behavior:
|
|
|
150
155
|
- `set-mode` mode ids are adapter-defined; unsupported values are rejected by the adapter (often `Invalid params`).
|
|
151
156
|
- `set`: calls ACP `session/set_config_option`.
|
|
152
157
|
- For codex, `thought_level` is accepted as a compatibility alias for codex-acp `reasoning_effort`.
|
|
158
|
+
- `--model <id>`: passed through to agent-specific session creation metadata when applicable; if the agent advertises models, `acpx` also applies it via `session/set_model`.
|
|
159
|
+
- `set model <id>`: calls `session/set_model`. This is the generic ACP method for mid-session model switching.
|
|
153
160
|
- `set-mode`/`set` route through queue-owner IPC when active, otherwise reconnect directly.
|
|
154
161
|
|
|
155
162
|
### Sessions
|
|
@@ -192,8 +199,10 @@ Behavior:
|
|
|
192
199
|
- `--approve-reads`: auto-approve reads/searches, prompt for writes (default mode)
|
|
193
200
|
- `--deny-all`: deny all permission requests
|
|
194
201
|
- `--format <fmt>`: output format (`text`, `json`, `quiet`)
|
|
202
|
+
- `--suppress-reads`: suppress raw read-file contents while preserving the selected format
|
|
195
203
|
- `--timeout <seconds>`: max wait time (positive number)
|
|
196
204
|
- `--ttl <seconds>`: queue owner idle TTL before shutdown (default `300`, `0` disables TTL)
|
|
205
|
+
- `--model <id>`: request an agent model during session creation; when the agent advertises models, `acpx` also applies it via `session/set_model`
|
|
197
206
|
- `--verbose`: verbose ACP/debug logs to stderr
|
|
198
207
|
|
|
199
208
|
Permission flags are mutually exclusive.
|
|
@@ -266,6 +275,7 @@ Use `--format <fmt>`:
|
|
|
266
275
|
- `text` (default): human-readable stream with updates/tool status and done line
|
|
267
276
|
- `json`: NDJSON event stream (good for automation)
|
|
268
277
|
- `quiet`: final assistant text only
|
|
278
|
+
- `--suppress-reads`: replace raw read-file contents with `[read output suppressed]` in `text` and `json` output
|
|
269
279
|
|
|
270
280
|
Example automation:
|
|
271
281
|
|
|
@@ -323,6 +333,13 @@ Raw custom adapter command:
|
|
|
323
333
|
acpx --agent './bin/custom-acp-server --profile ci' 'run validation checks'
|
|
324
334
|
```
|
|
325
335
|
|
|
336
|
+
Flow run:
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
acpx flow run ./my-flow.ts --input-file ./flow-input.json
|
|
340
|
+
acpx flow run examples/flows/branch.flow.ts --input-json '{"task":"FIX: add a regression test"}'
|
|
341
|
+
```
|
|
342
|
+
|
|
326
343
|
Repo-scoped review with permissive mode:
|
|
327
344
|
|
|
328
345
|
```bash
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acp-jsonrpc-BNHXq7qK.js","names":[],"sources":["../src/acp-jsonrpc.ts"],"sourcesContent":["import type { AnyMessage } from \"@agentclientprotocol/sdk\";\n\ntype JsonRpcId = string | number | null;\n\nfunction asRecord(value: unknown): Record<string, unknown> | null {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return null;\n }\n return value as Record<string, unknown>;\n}\n\nfunction hasValidId(value: unknown): value is JsonRpcId {\n return (\n value === null ||\n typeof value === \"string\" ||\n (typeof value === \"number\" && Number.isFinite(value))\n );\n}\n\nfunction isErrorObject(value: unknown): value is { code: number; message: string } {\n const record = asRecord(value);\n return (\n !!record &&\n typeof record.code === \"number\" &&\n Number.isFinite(record.code) &&\n typeof record.message === \"string\"\n );\n}\n\nfunction hasResultOrError(value: Record<string, unknown>): boolean {\n const hasResult = Object.hasOwn(value, \"result\");\n const hasError = Object.hasOwn(value, \"error\");\n if (hasResult && hasError) {\n return false;\n }\n if (!hasResult && !hasError) {\n return false;\n }\n if (hasError && !isErrorObject(value.error)) {\n return false;\n }\n return true;\n}\n\nexport function isAcpJsonRpcMessage(value: unknown): value is AnyMessage {\n const record = asRecord(value);\n if (!record || record.jsonrpc !== \"2.0\") {\n return false;\n }\n\n const hasMethod = typeof record.method === \"string\" && record.method.length > 0;\n const hasId = Object.hasOwn(record, \"id\");\n\n if (hasMethod && !hasId) {\n // Notification\n return true;\n }\n\n if (hasMethod && hasId) {\n // Request\n return hasValidId(record.id);\n }\n\n if (!hasMethod && hasId) {\n // Response\n if (!hasValidId(record.id)) {\n return false;\n }\n return hasResultOrError(record);\n }\n\n return false;\n}\n\nexport function isJsonRpcNotification(message: AnyMessage): boolean {\n return (\n Object.hasOwn(message, \"method\") &&\n typeof (message as { method?: unknown }).method === \"string\" &&\n !Object.hasOwn(message, \"id\")\n );\n}\n\nexport function isSessionUpdateNotification(message: AnyMessage): boolean {\n return (\n isJsonRpcNotification(message) && (message as { method?: unknown }).method === \"session/update\"\n );\n}\n\nexport function parsePromptStopReason(message: AnyMessage): string | undefined {\n if (!Object.hasOwn(message, \"id\") || !Object.hasOwn(message, \"result\")) {\n return undefined;\n }\n const record = asRecord((message as { result?: unknown }).result);\n if (!record) {\n return undefined;\n }\n return typeof record.stopReason === \"string\" ? record.stopReason : undefined;\n}\n\nexport function parseJsonRpcErrorMessage(message: AnyMessage): string | undefined {\n if (!Object.hasOwn(message, \"error\")) {\n return undefined;\n }\n const errorRecord = asRecord((message as { error?: unknown }).error);\n if (!errorRecord || typeof errorRecord.message !== \"string\") {\n return undefined;\n }\n return errorRecord.message;\n}\n"],"mappings":";AAIA,SAAS,SAAS,OAAgD;AAChE,KAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,MAAM,CAC7D,QAAO;AAET,QAAO;;AAGT,SAAS,WAAW,OAAoC;AACtD,QACE,UAAU,QACV,OAAO,UAAU,YAChB,OAAO,UAAU,YAAY,OAAO,SAAS,MAAM;;AAIxD,SAAS,cAAc,OAA4D;CACjF,MAAM,SAAS,SAAS,MAAM;AAC9B,QACE,CAAC,CAAC,UACF,OAAO,OAAO,SAAS,YACvB,OAAO,SAAS,OAAO,KAAK,IAC5B,OAAO,OAAO,YAAY;;AAI9B,SAAS,iBAAiB,OAAyC;CACjE,MAAM,YAAY,OAAO,OAAO,OAAO,SAAS;CAChD,MAAM,WAAW,OAAO,OAAO,OAAO,QAAQ;AAC9C,KAAI,aAAa,SACf,QAAO;AAET,KAAI,CAAC,aAAa,CAAC,SACjB,QAAO;AAET,KAAI,YAAY,CAAC,cAAc,MAAM,MAAM,CACzC,QAAO;AAET,QAAO;;AAGT,SAAgB,oBAAoB,OAAqC;CACvE,MAAM,SAAS,SAAS,MAAM;AAC9B,KAAI,CAAC,UAAU,OAAO,YAAY,MAChC,QAAO;CAGT,MAAM,YAAY,OAAO,OAAO,WAAW,YAAY,OAAO,OAAO,SAAS;CAC9E,MAAM,QAAQ,OAAO,OAAO,QAAQ,KAAK;AAEzC,KAAI,aAAa,CAAC,MAEhB,QAAO;AAGT,KAAI,aAAa,MAEf,QAAO,WAAW,OAAO,GAAG;AAG9B,KAAI,CAAC,aAAa,OAAO;AAEvB,MAAI,CAAC,WAAW,OAAO,GAAG,CACxB,QAAO;AAET,SAAO,iBAAiB,OAAO;;AAGjC,QAAO;;AAGT,SAAgB,sBAAsB,SAA8B;AAClE,QACE,OAAO,OAAO,SAAS,SAAS,IAChC,OAAQ,QAAiC,WAAW,YACpD,CAAC,OAAO,OAAO,SAAS,KAAK;;AAIjC,SAAgB,4BAA4B,SAA8B;AACxE,QACE,sBAAsB,QAAQ,IAAK,QAAiC,WAAW;;AAInF,SAAgB,sBAAsB,SAAyC;AAC7E,KAAI,CAAC,OAAO,OAAO,SAAS,KAAK,IAAI,CAAC,OAAO,OAAO,SAAS,SAAS,CACpE;CAEF,MAAM,SAAS,SAAU,QAAiC,OAAO;AACjE,KAAI,CAAC,OACH;AAEF,QAAO,OAAO,OAAO,eAAe,WAAW,OAAO,aAAa,KAAA;;AAGrE,SAAgB,yBAAyB,SAAyC;AAChF,KAAI,CAAC,OAAO,OAAO,SAAS,QAAQ,CAClC;CAEF,MAAM,cAAc,SAAU,QAAgC,MAAM;AACpE,KAAI,CAAC,eAAe,OAAO,YAAY,YAAY,SACjD;AAEF,QAAO,YAAY"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"output-BmkPP7qE.js","names":[],"sources":["../src/jsonrpc-error.ts","../src/output-json-formatter.ts","../src/output.ts"],"sourcesContent":["import type { OutputErrorAcpPayload, OutputErrorCode, OutputErrorOrigin } from \"./types.js\";\n\nexport const OUTPUT_ERROR_JSONRPC_CODES: Record<OutputErrorCode, number> = {\n NO_SESSION: -32002,\n TIMEOUT: -32070,\n PERMISSION_DENIED: -32071,\n PERMISSION_PROMPT_UNAVAILABLE: -32072,\n RUNTIME: -32603,\n USAGE: -32602,\n};\n\ntype JsonRpcErrorObject = {\n code: number;\n message: string;\n data?: unknown;\n};\n\nexport type BuildJsonRpcErrorParams = {\n id?: string | number | null;\n outputCode: OutputErrorCode;\n detailCode?: string;\n origin?: OutputErrorOrigin;\n message: string;\n retryable?: boolean;\n timestamp?: string;\n sessionId?: string;\n acp?: OutputErrorAcpPayload;\n};\n\nfunction hasValidAcpError(\n acp: OutputErrorAcpPayload | undefined,\n): acp is { code: number; message: string; data?: unknown } {\n return Boolean(\n acp &&\n Number.isFinite(acp.code) &&\n typeof acp.message === \"string\" &&\n acp.message.trim().length > 0,\n );\n}\n\nfunction buildFallbackData(params: BuildJsonRpcErrorParams): Record<string, unknown> {\n const data: Record<string, unknown> = {\n acpxCode: params.outputCode,\n detailCode: params.detailCode,\n origin: params.origin,\n retryable: params.retryable,\n timestamp: params.timestamp,\n sessionId: params.sessionId,\n };\n\n for (const [key, value] of Object.entries(data)) {\n if (value === undefined) {\n delete data[key];\n }\n }\n\n return data;\n}\n\nfunction buildErrorObject(params: BuildJsonRpcErrorParams): JsonRpcErrorObject {\n if (hasValidAcpError(params.acp)) {\n return {\n code: params.acp.code,\n message: params.acp.message,\n ...(params.acp.data !== undefined ? { data: params.acp.data } : {}),\n };\n }\n\n const data = buildFallbackData(params);\n return {\n code: OUTPUT_ERROR_JSONRPC_CODES[params.outputCode] ?? -32603,\n message: params.message,\n ...(Object.keys(data).length > 0 ? { data } : {}),\n };\n}\n\nexport function buildJsonRpcErrorResponse(params: BuildJsonRpcErrorParams): {\n jsonrpc: \"2.0\";\n id: string | number | null;\n error: JsonRpcErrorObject;\n} {\n return {\n jsonrpc: \"2.0\",\n id: params.id ?? null,\n error: buildErrorObject(params),\n };\n}\n","import { buildJsonRpcErrorResponse } from \"./jsonrpc-error.js\";\nimport type {\n OutputErrorAcpPayload,\n OutputErrorCode,\n OutputErrorOrigin,\n OutputFormatter,\n OutputFormatterContext,\n} from \"./types.js\";\n\ntype WritableLike = {\n write(chunk: string): void;\n};\n\nconst DEFAULT_JSON_SESSION_ID = \"unknown\";\n\nclass JsonOutputFormatter implements OutputFormatter {\n private readonly stdout: WritableLike;\n private sessionId: string;\n\n constructor(stdout: WritableLike, context?: OutputFormatterContext) {\n this.stdout = stdout;\n this.sessionId = context?.sessionId?.trim() || DEFAULT_JSON_SESSION_ID;\n }\n\n setContext(context: OutputFormatterContext): void {\n this.sessionId = context.sessionId?.trim() || this.sessionId || DEFAULT_JSON_SESSION_ID;\n }\n\n onAcpMessage(message: unknown): void {\n this.stdout.write(`${JSON.stringify(message)}\\n`);\n }\n\n onError(params: {\n code: OutputErrorCode;\n detailCode?: string;\n origin?: OutputErrorOrigin;\n message: string;\n retryable?: boolean;\n acp?: OutputErrorAcpPayload;\n timestamp?: string;\n }): void {\n this.stdout.write(\n `${JSON.stringify(\n buildJsonRpcErrorResponse({\n outputCode: params.code,\n detailCode: params.detailCode,\n origin: params.origin,\n message: params.message,\n retryable: params.retryable,\n timestamp: params.timestamp,\n sessionId: this.sessionId,\n acp: params.acp,\n }),\n )}\\n`,\n );\n }\n\n flush(): void {\n // no-op for streaming output\n }\n}\n\nexport function createJsonOutputFormatter(\n stdout: WritableLike,\n context?: OutputFormatterContext,\n): OutputFormatter {\n return new JsonOutputFormatter(stdout, context);\n}\n","import type {\n AnyMessage,\n ContentBlock,\n SessionNotification,\n ToolCall,\n ToolCallContent,\n ToolCallLocation,\n ToolCallStatus,\n ToolCallUpdate,\n} from \"@agentclientprotocol/sdk\";\nimport { parseJsonRpcErrorMessage, parsePromptStopReason } from \"./acp-jsonrpc.js\";\nimport { createJsonOutputFormatter } from \"./output-json-formatter.js\";\nimport type {\n AcpJsonRpcMessage,\n ClientOperation,\n OutputErrorAcpPayload,\n OutputErrorCode,\n OutputFormatterContext,\n OutputFormat,\n OutputFormatter,\n OutputErrorOrigin,\n} from \"./types.js\";\n\ntype WritableLike = {\n write(chunk: string): void;\n isTTY?: boolean;\n};\n\ntype OutputFormatterOptions = {\n stdout?: WritableLike;\n jsonContext?: OutputFormatterContext;\n};\n\ntype NormalizedToolStatus = ToolCallStatus | \"unknown\";\n\ntype FormatterSection = \"assistant\" | \"thought\" | \"tool\" | \"plan\" | \"client\" | \"done\";\n\ntype ToolRenderState = {\n id: string;\n title?: string;\n status?: ToolCallStatus | null;\n kind?: string | null;\n locations?: Array<ToolCallLocation> | null;\n rawInput?: unknown;\n rawOutput?: unknown;\n content?: Array<ToolCallContent> | null;\n startedPrinted: boolean;\n finalSignature?: string;\n};\n\nconst MAX_THOUGHT_CHARS = 900;\nconst MAX_INLINE_CHARS = 220;\nconst MAX_OUTPUT_CHARS = 2_000;\nconst MAX_OUTPUT_LINES = 28;\nconst MAX_LOCATION_ITEMS = 5;\nconst OUTPUT_PRIORITY_KEYS = [\n \"stdout\",\n \"stderr\",\n \"output\",\n \"content\",\n \"text\",\n \"message\",\n \"result\",\n \"response\",\n \"value\",\n] as const;\n\nfunction asStatus(status: ToolCallStatus | null | undefined): NormalizedToolStatus {\n return status ?? \"unknown\";\n}\n\nfunction isFinalStatus(status: NormalizedToolStatus): status is \"completed\" | \"failed\" {\n return status === \"completed\" || status === \"failed\";\n}\n\nfunction toStatusLabel(status: NormalizedToolStatus): string {\n switch (status) {\n case \"in_progress\":\n return \"running\";\n case \"pending\":\n return \"pending\";\n case \"completed\":\n return \"completed\";\n case \"failed\":\n return \"failed\";\n default:\n return \"running\";\n }\n}\n\nfunction asRecord(value: unknown): Record<string, unknown> | undefined {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return undefined;\n }\n return value as Record<string, unknown>;\n}\n\nfunction extractSessionUpdate(message: AnyMessage): SessionNotification | undefined {\n if (!Object.hasOwn(message, \"method\")) {\n return undefined;\n }\n const method = (message as { method?: unknown }).method;\n if (method !== \"session/update\") {\n return undefined;\n }\n const params = asRecord((message as { params?: unknown }).params);\n if (!params) {\n return undefined;\n }\n const sessionId = typeof params.sessionId === \"string\" ? params.sessionId : null;\n if (!sessionId) {\n return undefined;\n }\n const update = asRecord(params.update);\n if (!update || typeof update.sessionUpdate !== \"string\") {\n return undefined;\n }\n return {\n sessionId,\n update: update as SessionNotification[\"update\"],\n };\n}\n\nfunction extractJsonRpcMethod(message: AnyMessage): string | undefined {\n return Object.hasOwn(message, \"method\")\n ? (message as { method?: unknown }).method?.toString()\n : undefined;\n}\n\nfunction collapseWhitespace(value: string): string {\n return value.replace(/\\s+/g, \" \").trim();\n}\n\nfunction truncate(value: string, maxChars: number): string {\n if (value.length <= maxChars) {\n return value;\n }\n if (maxChars <= 3) {\n return value.slice(0, maxChars);\n }\n return `${value.slice(0, maxChars - 3)}...`;\n}\n\nfunction toInline(value: string, maxChars = MAX_INLINE_CHARS): string {\n return truncate(collapseWhitespace(value), maxChars);\n}\n\nfunction indentBlock(value: string, prefix: string): string {\n return value\n .split(\"\\n\")\n .map((line) => `${prefix}${line}`)\n .join(\"\\n\");\n}\n\nfunction dedupeStrings(values: string[]): string[] {\n const seen = new Set<string>();\n const result: string[] = [];\n\n for (const value of values) {\n if (seen.has(value)) {\n continue;\n }\n seen.add(value);\n result.push(value);\n }\n\n return result;\n}\n\nfunction safeJson(value: unknown, spacing: number): string | undefined {\n const seen = new WeakSet();\n\n try {\n return JSON.stringify(\n value,\n (_key, entry: unknown) => {\n if (typeof entry === \"bigint\") {\n return `${entry}n`;\n }\n if (typeof entry === \"function\") {\n return `[Function ${entry.name || \"anonymous\"}]`;\n }\n if (typeof entry === \"symbol\") {\n return entry.toString();\n }\n if (entry && typeof entry === \"object\") {\n if (seen.has(entry)) {\n return \"[Circular]\";\n }\n seen.add(entry);\n }\n return entry;\n },\n spacing,\n );\n } catch {\n return undefined;\n }\n}\n\nfunction readFirstString(source: Record<string, unknown>, keys: string[]): string | undefined {\n for (const key of keys) {\n const value = source[key];\n if (typeof value === \"string\" && value.trim()) {\n return value.trim();\n }\n }\n return undefined;\n}\n\nfunction readFirstStringArray(\n source: Record<string, unknown>,\n keys: string[],\n): string[] | undefined {\n for (const key of keys) {\n const value = source[key];\n if (!Array.isArray(value)) {\n continue;\n }\n const entries = value\n .map((entry) => (typeof entry === \"string\" ? entry.trim() : \"\"))\n .filter((entry) => entry.length > 0);\n if (entries.length > 0) {\n return entries;\n }\n }\n return undefined;\n}\n\nfunction summarizeToolInput(rawInput: unknown): string | undefined {\n if (rawInput == null) {\n return undefined;\n }\n\n if (\n typeof rawInput === \"string\" ||\n typeof rawInput === \"number\" ||\n typeof rawInput === \"boolean\"\n ) {\n return toInline(String(rawInput));\n }\n\n const record = asRecord(rawInput);\n if (record) {\n const command = readFirstString(record, [\"command\", \"cmd\", \"program\"]);\n const args = readFirstStringArray(record, [\"args\", \"arguments\"]);\n if (command) {\n const invocation = [command, ...(args ?? [])].join(\" \");\n return toInline(invocation);\n }\n\n const location = readFirstString(record, [\n \"path\",\n \"file\",\n \"filePath\",\n \"filepath\",\n \"target\",\n \"uri\",\n \"url\",\n ]);\n if (location) {\n return toInline(location);\n }\n\n const query = readFirstString(record, [\"query\", \"pattern\", \"text\", \"search\"]);\n if (query) {\n return toInline(query);\n }\n }\n\n const json = safeJson(rawInput, 0);\n return json ? toInline(json) : undefined;\n}\n\nfunction formatLocations(\n locations: Array<ToolCallLocation> | null | undefined,\n): string | undefined {\n if (!locations || locations.length === 0) {\n return undefined;\n }\n\n const unique = new Set<string>();\n for (const location of locations) {\n const path = location.path?.trim();\n if (!path) {\n continue;\n }\n\n const line =\n typeof location.line === \"number\" && Number.isFinite(location.line)\n ? `:${Math.max(1, Math.trunc(location.line))}`\n : \"\";\n unique.add(`${path}${line}`);\n }\n\n const items = [...unique];\n if (items.length === 0) {\n return undefined;\n }\n\n const visible = items.slice(0, MAX_LOCATION_ITEMS);\n const hidden = items.length - visible.length;\n if (hidden <= 0) {\n return visible.join(\", \");\n }\n\n return `${visible.join(\", \")}, +${hidden} more`;\n}\n\nfunction summarizeDiff(path: string, oldText: string | null | undefined, newText: string): string {\n const oldLines = oldText ? oldText.split(\"\\n\").length : 0;\n const newLines = newText.split(\"\\n\").length;\n const delta = newLines - oldLines;\n\n if (delta === 0) {\n return `diff ${path} (line count unchanged)`;\n }\n\n const signedDelta = `${delta > 0 ? \"+\" : \"\"}${delta}`;\n return `diff ${path} (${signedDelta} lines)`;\n}\n\nfunction textFromContentBlock(content: ContentBlock): string | undefined {\n switch (content.type) {\n case \"text\":\n return content.text;\n case \"resource_link\":\n return content.title ?? content.name ?? content.uri;\n case \"resource\": {\n if (\"text\" in content.resource && typeof content.resource.text === \"string\") {\n return content.resource.text;\n }\n const uri = content.resource.uri;\n const mimeType = content.resource.mimeType;\n return `[resource] ${uri}${mimeType ? ` (${mimeType})` : \"\"}`;\n }\n case \"image\":\n return `[image] ${content.mimeType}`;\n case \"audio\":\n return `[audio] ${content.mimeType}`;\n default:\n return undefined;\n }\n}\n\nfunction summarizeToolContent(\n content: Array<ToolCallContent> | null | undefined,\n): string | undefined {\n if (!content || content.length === 0) {\n return undefined;\n }\n\n const fragments: string[] = [];\n\n for (const entry of content) {\n if (entry.type === \"content\") {\n const text = textFromContentBlock(entry.content);\n if (text && text.trim()) {\n fragments.push(text.trimEnd());\n }\n continue;\n }\n\n if (entry.type === \"diff\") {\n fragments.push(summarizeDiff(entry.path, entry.oldText, entry.newText));\n continue;\n }\n\n if (entry.type === \"terminal\") {\n fragments.push(`[terminal] ${entry.terminalId}`);\n }\n }\n\n const unique = dedupeStrings(\n fragments.map((fragment) => fragment.trim()).filter((fragment) => fragment.length > 0),\n );\n if (unique.length === 0) {\n return undefined;\n }\n\n return unique.join(\"\\n\\n\");\n}\n\nfunction extractOutputText(\n value: unknown,\n depth = 0,\n seen = new Set<unknown>(),\n): string | undefined {\n if (value == null) {\n return undefined;\n }\n\n if (typeof value === \"string\") {\n const trimmed = value.trimEnd();\n return trimmed.length > 0 ? trimmed : undefined;\n }\n\n if (typeof value === \"number\" || typeof value === \"boolean\") {\n return String(value);\n }\n\n if (depth >= 4) {\n return undefined;\n }\n\n if (Array.isArray(value)) {\n const parts = value\n .map((entry) => extractOutputText(entry, depth + 1, seen))\n .filter((entry): entry is string => Boolean(entry));\n if (parts.length === 0) {\n return undefined;\n }\n return dedupeStrings(parts).join(\"\\n\");\n }\n\n const record = asRecord(value);\n if (!record) {\n return undefined;\n }\n if (seen.has(record)) {\n return undefined;\n }\n seen.add(record);\n\n const preferred: string[] = [];\n for (const key of OUTPUT_PRIORITY_KEYS) {\n if (!(key in record)) {\n continue;\n }\n const extracted = extractOutputText(record[key], depth + 1, seen);\n if (extracted) {\n preferred.push(extracted);\n }\n }\n\n const uniquePreferred = dedupeStrings(preferred);\n if (uniquePreferred.length > 0) {\n return uniquePreferred.join(\"\\n\");\n }\n\n const json = safeJson(record, 2);\n if (!json || json === \"{}\") {\n return undefined;\n }\n return json;\n}\n\nfunction summarizeToolOutput(\n rawOutput: unknown,\n content: Array<ToolCallContent> | null | undefined,\n): string | undefined {\n const outputFromRaw = extractOutputText(rawOutput);\n const outputFromContent = summarizeToolContent(content);\n\n const fragments = dedupeStrings(\n [outputFromRaw, outputFromContent]\n .map((fragment) => fragment?.trim())\n .filter((fragment): fragment is string => Boolean(fragment)),\n );\n\n if (fragments.length === 0) {\n return undefined;\n }\n\n return fragments.join(\"\\n\\n\");\n}\n\nfunction limitOutputBlock(value: string): string {\n const normalized = value.replace(/\\r\\n/g, \"\\n\").trim();\n if (!normalized) {\n return \"\";\n }\n\n const lines = normalized.split(\"\\n\");\n const visible = lines.slice(0, MAX_OUTPUT_LINES);\n let result = visible.join(\"\\n\");\n\n if (lines.length > visible.length) {\n const hidden = lines.length - visible.length;\n result += `\\n... (${hidden} more lines)`;\n }\n\n if (result.length > MAX_OUTPUT_CHARS) {\n result = `${result.slice(0, MAX_OUTPUT_CHARS - 3)}...`;\n }\n\n return result;\n}\n\nclass TextOutputFormatter implements OutputFormatter {\n private readonly stdout: WritableLike;\n private readonly useColor: boolean;\n private readonly toolStates = new Map<string, ToolRenderState>();\n private thoughtBuffer = \"\";\n private wroteAny = false;\n private atLineStart = true;\n private section: FormatterSection | null = null;\n\n constructor(stdout: WritableLike) {\n this.stdout = stdout;\n this.useColor = Boolean(stdout.isTTY);\n }\n\n setContext(_context: OutputFormatterContext): void {\n // no-op for text mode\n }\n\n onAcpMessage(message: AcpJsonRpcMessage): void {\n const notification = extractSessionUpdate(message);\n if (notification) {\n this.renderSessionUpdate(notification);\n return;\n }\n\n const method = extractJsonRpcMethod(message);\n if (method && method !== \"session/prompt\" && method !== \"session/cancel\") {\n this.onClientOperation({\n method: method as ClientOperation[\"method\"],\n status: \"running\",\n summary: method,\n timestamp: new Date().toISOString(),\n });\n return;\n }\n\n const stopReason = parsePromptStopReason(message);\n if (stopReason) {\n this.renderDone(stopReason);\n return;\n }\n\n const errorMessage = parseJsonRpcErrorMessage(message);\n if (errorMessage) {\n this.onError({\n code: \"RUNTIME\",\n origin: \"acp\",\n message: errorMessage,\n });\n }\n }\n\n private renderSessionUpdate(notification: SessionNotification): void {\n const update = notification.update;\n if (update.sessionUpdate !== \"agent_thought_chunk\") {\n this.flushThoughtBuffer();\n }\n\n switch (update.sessionUpdate) {\n case \"agent_message_chunk\": {\n if (update.content.type === \"text\") {\n this.writeAssistantChunk(update.content.text);\n }\n return;\n }\n case \"agent_thought_chunk\": {\n if (update.content.type === \"text\") {\n this.thoughtBuffer += update.content.text;\n }\n return;\n }\n case \"tool_call\": {\n this.renderToolUpdate(update);\n return;\n }\n case \"tool_call_update\": {\n this.renderToolUpdate(update);\n return;\n }\n case \"plan\": {\n this.beginSection(\"plan\");\n this.writeLine(this.bold(\"[plan]\"));\n for (const entry of update.entries) {\n this.writeLine(` - [${entry.status}] ${entry.content}`);\n }\n return;\n }\n default:\n return;\n }\n }\n\n private renderDone(stopReason: string): void {\n this.flushThoughtBuffer();\n this.beginSection(\"done\");\n this.writeLine(this.dim(`[done] ${stopReason}`));\n }\n\n onError(params: {\n code: OutputErrorCode;\n detailCode?: string;\n origin?: OutputErrorOrigin;\n message: string;\n retryable?: boolean;\n acp?: OutputErrorAcpPayload;\n timestamp?: string;\n }): void {\n this.flushThoughtBuffer();\n this.beginSection(\"done\");\n this.writeLine(this.formatAnsi(`[error] ${params.code}: ${params.message}`, \"31\"));\n }\n\n onClientOperation(operation: ClientOperation): void {\n this.flushThoughtBuffer();\n this.beginSection(\"client\");\n\n const normalizedStatus: NormalizedToolStatus =\n operation.status === \"completed\"\n ? \"completed\"\n : operation.status === \"failed\"\n ? \"failed\"\n : \"in_progress\";\n const statusText = this.colorStatus(operation.status, normalizedStatus);\n this.writeLine(`${this.bold(\"[client]\")} ${operation.summary} (${statusText})`);\n if (operation.details && operation.details.trim().length > 0) {\n this.writeLine(\" details:\");\n this.writeLine(indentBlock(operation.details, \" \"));\n }\n }\n\n flush(): void {\n this.flushThoughtBuffer();\n if (!this.atLineStart) {\n this.write(\"\\n\");\n }\n }\n\n private write(chunk: string): void {\n if (!chunk) {\n return;\n }\n this.stdout.write(chunk);\n this.wroteAny = true;\n this.atLineStart = chunk.endsWith(\"\\n\");\n }\n\n private writeLine(line: string): void {\n this.write(`${line}\\n`);\n }\n\n private beginSection(next: Exclude<FormatterSection, \"assistant\">): void {\n if (!this.atLineStart) {\n this.write(\"\\n\");\n }\n if (this.wroteAny) {\n this.write(\"\\n\");\n }\n this.section = next;\n }\n\n private writeAssistantChunk(text: string): void {\n if (!text) {\n return;\n }\n this.section = \"assistant\";\n this.write(text);\n }\n\n private flushThoughtBuffer(): void {\n const thought = truncate(collapseWhitespace(this.thoughtBuffer), MAX_THOUGHT_CHARS);\n this.thoughtBuffer = \"\";\n if (!thought) {\n return;\n }\n\n this.beginSection(\"thought\");\n this.writeLine(this.dim(`[thinking] ${thought}`));\n }\n\n private renderToolUpdate(update: ToolCall | ToolCallUpdate): void {\n const state = this.getOrCreateToolState(update.toolCallId);\n this.mergeToolState(state, update);\n\n const status = asStatus(state.status);\n if (isFinalStatus(status)) {\n const signature = this.toolSignature(state);\n if (signature !== state.finalSignature) {\n state.finalSignature = signature;\n this.renderFinalToolState(state, status);\n }\n return;\n }\n\n if (state.startedPrinted) {\n return;\n }\n\n state.startedPrinted = true;\n this.renderStartingToolState(state, status);\n }\n\n private getOrCreateToolState(toolCallId: string): ToolRenderState {\n const existing = this.toolStates.get(toolCallId);\n if (existing) {\n return existing;\n }\n\n const created: ToolRenderState = {\n id: toolCallId,\n startedPrinted: false,\n };\n this.toolStates.set(toolCallId, created);\n return created;\n }\n\n private mergeToolState(state: ToolRenderState, update: ToolCall | ToolCallUpdate): void {\n if (typeof update.title === \"string\" && update.title.trim().length > 0) {\n state.title = update.title;\n }\n\n if (update.status !== undefined) {\n state.status = update.status;\n }\n if (update.kind !== undefined) {\n state.kind = update.kind;\n }\n if (update.locations !== undefined) {\n state.locations = update.locations;\n }\n if (update.rawInput !== undefined) {\n state.rawInput = update.rawInput;\n }\n if (update.rawOutput !== undefined) {\n state.rawOutput = update.rawOutput;\n }\n if (update.content !== undefined) {\n state.content = update.content;\n }\n }\n\n private toolSignature(state: ToolRenderState): string {\n const signaturePayload = {\n title: state.title,\n status: state.status,\n kind: state.kind,\n input: summarizeToolInput(state.rawInput),\n files: formatLocations(state.locations),\n output: summarizeToolOutput(state.rawOutput, state.content),\n };\n\n return safeJson(signaturePayload, 0) ?? JSON.stringify(signaturePayload);\n }\n\n private renderStartingToolState(\n state: ToolRenderState,\n status: Exclude<NormalizedToolStatus, \"completed\" | \"failed\">,\n ): void {\n this.beginSection(\"tool\");\n\n const title = state.title ?? state.id;\n const label = status === \"pending\" ? \"pending\" : \"running\";\n const statusText = this.colorStatus(label, status);\n this.writeLine(`${this.bold(\"[tool]\")} ${title} (${statusText})`);\n\n const input = summarizeToolInput(state.rawInput);\n if (input) {\n this.writeLine(` input: ${input}`);\n }\n\n const files = formatLocations(state.locations);\n if (files) {\n this.writeLine(` files: ${files}`);\n }\n }\n\n private renderFinalToolState(state: ToolRenderState, status: \"completed\" | \"failed\"): void {\n this.beginSection(\"tool\");\n\n const title = state.title ?? state.id;\n const statusText = this.colorStatus(toStatusLabel(status), status);\n this.writeLine(`${this.bold(\"[tool]\")} ${title} (${statusText})`);\n\n if (state.kind) {\n this.writeLine(` kind: ${state.kind}`);\n }\n\n const input = summarizeToolInput(state.rawInput);\n if (input) {\n this.writeLine(` input: ${input}`);\n }\n\n const files = formatLocations(state.locations);\n if (files) {\n this.writeLine(` files: ${files}`);\n }\n\n const output = summarizeToolOutput(state.rawOutput, state.content);\n if (output) {\n this.writeLine(\" output:\");\n this.writeLine(indentBlock(limitOutputBlock(output), \" \"));\n }\n }\n\n private formatAnsi(text: string, code: string): string {\n if (!this.useColor) {\n return text;\n }\n return `\\u001b[${code}m${text}\\u001b[0m`;\n }\n\n private bold(text: string): string {\n return this.formatAnsi(text, \"1\");\n }\n\n private dim(text: string): string {\n return this.formatAnsi(text, \"2\");\n }\n\n private colorStatus(text: string, status: NormalizedToolStatus): string {\n if (!this.useColor) {\n return text;\n }\n\n switch (status) {\n case \"completed\":\n return this.formatAnsi(text, \"32\");\n case \"failed\":\n return this.formatAnsi(text, \"31\");\n case \"pending\":\n case \"in_progress\":\n case \"unknown\":\n default:\n return this.formatAnsi(text, \"33\");\n }\n }\n}\n\nclass QuietOutputFormatter implements OutputFormatter {\n private readonly stdout: WritableLike;\n private chunks: string[] = [];\n private flushed = false;\n\n constructor(stdout: WritableLike) {\n this.stdout = stdout;\n }\n\n setContext(_context: OutputFormatterContext): void {\n // no-op for quiet mode\n }\n\n onAcpMessage(message: AcpJsonRpcMessage): void {\n const update = extractSessionUpdate(message);\n if (\n update?.update.sessionUpdate === \"agent_message_chunk\" &&\n update.update.content.type === \"text\"\n ) {\n this.chunks.push(update.update.content.text);\n return;\n }\n\n if (parsePromptStopReason(message)) {\n this.flushBufferedOutput();\n }\n }\n\n onError(_params: {\n code: OutputErrorCode;\n detailCode?: string;\n origin?: OutputErrorOrigin;\n message: string;\n retryable?: boolean;\n acp?: OutputErrorAcpPayload;\n timestamp?: string;\n }): void {\n // no-op in quiet mode\n }\n\n flush(): void {\n // no-op for streaming output\n }\n\n private flushBufferedOutput(): void {\n if (this.flushed) {\n return;\n }\n\n this.flushed = true;\n const text = this.chunks.join(\"\");\n this.stdout.write(text.endsWith(\"\\n\") ? text : `${text}\\n`);\n }\n}\n\nexport function createOutputFormatter(\n format: OutputFormat,\n options: OutputFormatterOptions = {},\n): OutputFormatter {\n const stdout = options.stdout ?? process.stdout;\n\n switch (format) {\n case \"text\":\n return new TextOutputFormatter(stdout);\n case \"json\":\n return createJsonOutputFormatter(stdout, options.jsonContext);\n case \"quiet\":\n return new QuietOutputFormatter(stdout);\n default: {\n const exhaustive: never = format;\n void exhaustive;\n throw new Error(\"Unsupported output format\");\n }\n }\n}\n"],"mappings":";;AAEA,MAAa,6BAA8D;CACzE,YAAY;CACZ,SAAS;CACT,mBAAmB;CACnB,+BAA+B;CAC/B,SAAS;CACT,OAAO;CACR;AAoBD,SAAS,iBACP,KAC0D;AAC1D,QAAO,QACL,OACA,OAAO,SAAS,IAAI,KAAK,IACzB,OAAO,IAAI,YAAY,YACvB,IAAI,QAAQ,MAAM,CAAC,SAAS,EAC7B;;AAGH,SAAS,kBAAkB,QAA0D;CACnF,MAAM,OAAgC;EACpC,UAAU,OAAO;EACjB,YAAY,OAAO;EACnB,QAAQ,OAAO;EACf,WAAW,OAAO;EAClB,WAAW,OAAO;EAClB,WAAW,OAAO;EACnB;AAED,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,CAC7C,KAAI,UAAU,KAAA,EACZ,QAAO,KAAK;AAIhB,QAAO;;AAGT,SAAS,iBAAiB,QAAqD;AAC7E,KAAI,iBAAiB,OAAO,IAAI,CAC9B,QAAO;EACL,MAAM,OAAO,IAAI;EACjB,SAAS,OAAO,IAAI;EACpB,GAAI,OAAO,IAAI,SAAS,KAAA,IAAY,EAAE,MAAM,OAAO,IAAI,MAAM,GAAG,EAAE;EACnE;CAGH,MAAM,OAAO,kBAAkB,OAAO;AACtC,QAAO;EACL,MAAM,2BA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AO,MAAM,KAAK,SAAS,KAAK,GAAG,OAAO,GAAG,KAAK,IAAI;;;AAI/D,SAAgB,sBACd,QACA,UAAkC,EAAE,EACnB;CACjB,MAAM,SAAS,QAAQ,UAAU,QAAQ;AAEzC,SAAQ,QAAR;EACE,KAAK,OACH,QAAO,IAAI,oBAAoB,OAAO;EACxC,KAAK,OACH,QAAO,0BAA0B,QAAQ,QAAQ,YAAY;EAC/D,KAAK,QACH,QAAO,IAAI,qBAAqB,OAAO;EACzC,QAGE,OAAM,IAAI,MAAM,4BAA4B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"output-render-DEAaMxg8.js","names":[],"sources":["../src/cli/output-render.ts"],"sourcesContent":["import path from \"node:path\";\nimport { probeQueueOwnerHealth } from \"../queue-ipc.js\";\nimport { normalizeRuntimeSessionId } from \"../runtime-session-id.js\";\nimport type { OutputFormat, SessionRecord } from \"../types.js\";\n\nfunction formatSessionLabel(record: SessionRecord): string {\n return record.name ?? \"cwd\";\n}\n\nfunction formatRoutedFrom(sessionCwd: string, currentCwd: string): string | undefined {\n const relative = path.relative(sessionCwd, currentCwd);\n if (!relative || relative === \".\") {\n return undefined;\n }\n return relative.startsWith(\".\") ? relative : `.${path.sep}${relative}`;\n}\n\ntype SessionConnectionStatus = \"connected\" | \"needs reconnect\";\n\nasync function resolveSessionConnectionStatus(\n record: SessionRecord,\n): Promise<SessionConnectionStatus> {\n const health = await probeQueueOwnerHealth(record.acpxRecordId);\n return health.healthy ? \"connected\" : \"needs reconnect\";\n}\n\nexport function emitJsonResult(format: OutputFormat, payload: unknown): boolean {\n if (format !== \"json\") {\n return false;\n }\n process.stdout.write(`${JSON.stringify(payload)}\\n`);\n return true;\n}\n\nexport function printSessionsByFormat(sessions: SessionRecord[], format: OutputFormat): void {\n if (format === \"json\") {\n process.stdout.write(`${JSON.stringify(sessions)}\\n`);\n return;\n }\n\n if (format === \"quiet\") {\n for (const session of sessions) {\n const closedMarker = session.closed ? \" [closed]\" : \"\";\n process.stdout.write(`${session.acpxRecordId}${closedMarker}\\n`);\n }\n return;\n }\n\n if (sessions.length === 0) {\n process.stdout.write(\"No sessions\\n\");\n return;\n }\n\n for (const session of sessions) {\n const closedMarker = session.closed ? \" [closed]\" : \"\";\n process.stdout.write(\n `${session.acpxRecordId}${closedMarker}\\t${session.name ?? \"-\"}\\t${session.cwd}\\t${session.lastUsedAt}\\n`,\n );\n }\n}\n\nexport function printClosedSessionByFormat(record: SessionRecord, format: OutputFormat): void {\n if (\n emitJsonResult(format, {\n action: \"session_closed\",\n acpxRecordId: record.acpxRecordId,\n acpxSessionId: record.acpSessionId,\n agentSessionId: record.agentSessionId,\n })\n ) {\n return;\n }\n\n if (format === \"quiet\") {\n return;\n }\n\n process.stdout.write(`${record.acpxRecordId}\\n`);\n}\n\nexport function printNewSessionByFormat(\n record: SessionRecord,\n replaced: SessionRecord | undefined,\n format: OutputFormat,\n): void {\n if (\n emitJsonResult(format, {\n action: \"session_ensured\",\n created: true,\n acpxRecordId: record.acpxRecordId,\n acpxSessionId: record.acpSessionId,\n agentSessionId: record.agentSessionId,\n name: record.name,\n replacedSessionId: replaced?.acpxRecordId,\n })\n ) {\n return;\n }\n\n if (format === \"quiet\") {\n process.stdout.write(`${record.acpxRecordId}\\n`);\n return;\n }\n\n if (replaced) {\n process.stdout.write(`${record.acpxRecordId}\\t(replaced ${replaced.acpxRecordId})\\n`);\n return;\n }\n\n process.stdout.write(`${record.acpxRecordId}\\n`);\n}\n\nexport function printEnsuredSessionByFormat(\n record: SessionRecord,\n created: boolean,\n format: OutputFormat,\n): void {\n if (\n emitJsonResult(format, {\n action: \"session_ensured\",\n created,\n acpxRecordId: record.acpxRecordId,\n acpxSessionId: record.acpSessionId,\n agentSessionId: record.agentSessionId,\n name: record.name,\n })\n ) {\n return;\n }\n\n if (format === \"quiet\") {\n process.stdout.write(`${record.acpxRecordId}\\n`);\n return;\n }\n\n const action = created ? \"created\" : \"existing\";\n process.stdout.write(`${record.acpxRecordId}\\t(${action})\\n`);\n}\n\nexport function printQueuedPromptByFormat(\n result: {\n sessionId: string;\n requestId: string;\n },\n format: OutputFormat,\n): void {\n if (\n emitJsonResult(format, {\n action: \"prompt_queued\",\n acpxRecordId: result.sessionId,\n requestId: result.requestId,\n })\n ) {\n return;\n }\n\n if (format === \"quiet\") {\n return;\n }\n\n process.stdout.write(`[queued] ${result.requestId}\\n`);\n}\n\nexport function formatPromptSessionBannerLine(\n record: SessionRecord,\n currentCwd: string,\n connectionStatus: SessionConnectionStatus = \"needs reconnect\",\n): string {\n const label = formatSessionLabel(record);\n const normalizedSessionCwd = path.resolve(record.cwd);\n const normalizedCurrentCwd = path.resolve(currentCwd);\n const routedFrom =\n normalizedSessionCwd === normalizedCurrentCwd\n ? undefined\n : formatRoutedFrom(normalizedSessionCwd, normalizedCurrentCwd);\n const status = connectionStatus;\n\n if (routedFrom) {\n return `[acpx] session ${label} (${record.acpxRecordId}) · ${normalizedSessionCwd} (routed from ${routedFrom}) · agent ${status}`;\n }\n\n return `[acpx] session ${label} (${record.acpxRecordId}) · ${normalizedSessionCwd} · agent ${status}`;\n}\n\nexport async function printPromptSessionBanner(\n record: SessionRecord,\n currentCwd: string,\n format: OutputFormat,\n jsonStrict = false,\n): Promise<void> {\n if (format === \"quiet\" || (jsonStrict && format === \"json\")) {\n return;\n }\n\n const status = await resolveSessionConnectionStatus(record);\n process.stderr.write(`${formatPromptSessionBannerLine(record, currentCwd, status)}\\n`);\n}\n\nexport function printCreatedSessionBanner(\n record: SessionRecord,\n agentName: string,\n format: OutputFormat,\n jsonStrict = false,\n): void {\n if (format === \"quiet\" || (jsonStrict && format === \"json\")) {\n return;\n }\n\n const label = formatSessionLabel(record);\n process.stderr.write(`[acpx] created session ${label} (${record.acpxRecordId})\\n`);\n process.stderr.write(`[acpx] agent: ${agentName}\\n`);\n process.stderr.write(`[acpx] cwd: ${record.cwd}\\n`);\n}\n\nexport function agentSessionIdPayload(agentSessionId: string | undefined): {\n agentSessionId?: string;\n} {\n const normalized = normalizeRuntimeSessionId(agentSessionId);\n if (!normalized) {\n return {};\n }\n\n return { agentSessionId: normalized };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAKA,SAAS,mBAAmB,QAA+B;AACzD,QAAO,OAAO,QAAQ;;AAGxB,SAAS,iBAAiB,YAAoB,YAAwC;CACpF,MAAM,WAAW,KAAK,SAAS,YAAY,WAAW;AACtD,KAAI,CAAC,YAAY,aAAa,IAC5B;AAEF,QAAO,SAAS,WAAW,IAAI,GAAG,WAAW,IAAI,KAAK,MAAM;;AAK9D,eAAe,+BACb,QACkC;AAElC,SADe,MAAM,sBAAsB,OAAO,aAAa,EACjD,UAAU,cAAc;;AAGxC,SAAgB,eAAe,QAAsB,SAA2B;AAC9E,KAAI,WAAW,OACb,QAAO;AAET,SAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,QAAQ,CAAC,IAAI;AACpD,QAAO;;AAGT,SAAgB,sBAAsB,UAA2B,QAA4B;AAC3F,KAAI,WAAW,QAAQ;AACrB,UAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,SAAS,CAAC,IAAI;AACrD;;AAGF,KAAI,WAAW,SAAS;AACtB,OAAK,MAAM,WAAW,UAAU;GAC9B,MAAM,eAAe,QAAQ,SAAS,cAAc;AACpD,WAAQ,OAAO,MAAM,GAAG,QAAQ,eAAe,aAAa,IAAI;;AAElE;;AAGF,KAAI,SAAS,WAAW,GAAG;AACzB,UAAQ,OAAO,MAAM,gBAAgB;AACrC;;AAGF,MAAK,MAAM,WAAW,UAAU;EAC9B,MAAM,eAAe,QAAQ,SAAS,cAAc;AACpD,UAAQ,OAAO,MACb,GAAG,QAAQ,eAAe,aAAa,IAAI,QAAQ,QAAQ,IAAI,IAAI,QAAQ,IAAI,IAAI,QAAQ,WAAW,IACvG;;;AAIL,SAAgB,2BAA2B,QAAuB,QAA4B;AAC5F,KACE,eAAe,QAAQ;EACrB,QAAQ;EACR,cAAc,OAAO;EACrB,eAAe,O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