@anhlp/alp-cli 0.0.0-beta.1 → 0.0.0-beta.2
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/acp/agent.d.ts +11 -3
- package/dist/acp/agent.js +118 -19
- package/dist/acp/main.js +1 -1
- package/dist/acp.js +119 -22
- package/dist/alpd.js +1867 -741
- package/dist/backup.js +1 -1
- package/dist/build-manifest.json +4 -1
- package/dist/sessions.d.ts +2 -0
- package/dist/sessions.js +23 -1
- package/package.json +4 -4
- package/src/acp/agent.ts +111 -20
- package/src/sessions.js +16 -1
package/dist/backup.js
CHANGED
|
@@ -7,7 +7,7 @@ import { acquireDaemonLock, alpHome, assertPrivateDirectory, daemonPaths, lockAl
|
|
|
7
7
|
import { daemonHeld, holdDaemon, releaseHold } from "@anhlp/alp-client/supervise";
|
|
8
8
|
import { start, stop } from "./daemon.js";
|
|
9
9
|
import { UsageError } from "./usage.js";
|
|
10
|
-
var VERSION = true ? "0.0.0-beta.
|
|
10
|
+
var VERSION = true ? "0.0.0-beta.2" : "dev";
|
|
11
11
|
var BY = `alp ${VERSION}`;
|
|
12
12
|
var size = (bytes) => bytes >= 1024 * 1024 ? `${(bytes / 1024 / 1024).toFixed(1)} MB` : bytes >= 1024 ? `${(bytes / 1024).toFixed(1)} KB` : `${bytes} B`;
|
|
13
13
|
var stamp = () => (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\.\d+Z$/, "Z");
|
package/dist/build-manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.0-beta.
|
|
2
|
+
"version": "0.0.0-beta.2",
|
|
3
3
|
"entries": {
|
|
4
4
|
"packages/cli/dist/alpd.js": {
|
|
5
5
|
"inputs": [
|
|
@@ -44,6 +44,8 @@
|
|
|
44
44
|
"packages/core/src/validation.js",
|
|
45
45
|
"packages/core/src/verify.js",
|
|
46
46
|
"packages/core/src/workflow.js",
|
|
47
|
+
"packages/daemon/src/files.ts",
|
|
48
|
+
"packages/daemon/src/gitignore.ts",
|
|
47
49
|
"packages/daemon/src/lock.ts",
|
|
48
50
|
"packages/daemon/src/main.ts",
|
|
49
51
|
"packages/daemon/src/operations.ts",
|
|
@@ -77,6 +79,7 @@
|
|
|
77
79
|
"packages/runtime/src/runtime-context.ts",
|
|
78
80
|
"packages/runtime/src/runtime.ts",
|
|
79
81
|
"packages/runtime/src/session-config.ts",
|
|
82
|
+
"packages/runtime/src/tool-detail.ts",
|
|
80
83
|
"packages/runtime/src/tool-results.ts",
|
|
81
84
|
"packages/runtime/src/tools.ts",
|
|
82
85
|
"packages/runtime/src/transport.ts",
|
package/dist/sessions.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** One line for a finished tool call: its command, or what a typed call touched (ALPD §4.2). */
|
|
2
|
+
export function toolLine(item: any): any;
|
|
1
3
|
export function printer(json: any): (envelope: any) => void;
|
|
2
4
|
/** Reads answers to questions for the user from the terminal, one question at a time. */
|
|
3
5
|
export function answerer(client: any): {
|
package/dist/sessions.js
CHANGED
|
@@ -9,6 +9,27 @@ import { connect } from "@anhlp/alp-client/index";
|
|
|
9
9
|
import { UsageError } from "./usage.js";
|
|
10
10
|
import { start, running, stop } from "./daemon.js";
|
|
11
11
|
import { taskProject } from "./tasks.js";
|
|
12
|
+
function toolLine(item) {
|
|
13
|
+
const detail = item.detail ?? {};
|
|
14
|
+
const first = (text) => String(text ?? "").split("\n")[0].slice(0, 200);
|
|
15
|
+
switch (detail.type) {
|
|
16
|
+
case "shell":
|
|
17
|
+
return detail.command;
|
|
18
|
+
case "read":
|
|
19
|
+
case "edit":
|
|
20
|
+
case "write":
|
|
21
|
+
return `${item.name} ${detail.filePath}`;
|
|
22
|
+
case "search":
|
|
23
|
+
return `${item.name} ${first(detail.query)}`;
|
|
24
|
+
case "fetch":
|
|
25
|
+
return `${item.name} ${detail.url}`;
|
|
26
|
+
case "sub_agent":
|
|
27
|
+
return `${item.name}${detail.description ? ` ${first(detail.description)}` : ""}`;
|
|
28
|
+
case "plain_text":
|
|
29
|
+
return `${item.name}${detail.label ? ` ${detail.label}` : ""}`;
|
|
30
|
+
}
|
|
31
|
+
return item.name === "alp_delegate" ? `delegate \u2192 ${detail.input?.agent}` : item.name;
|
|
32
|
+
}
|
|
12
33
|
function printer(json) {
|
|
13
34
|
const depth = /* @__PURE__ */ new Map();
|
|
14
35
|
const agents = /* @__PURE__ */ new Map();
|
|
@@ -31,7 +52,7 @@ function printer(json) {
|
|
|
31
52
|
latest.set(item.id, { sessionId, item });
|
|
32
53
|
if (item.kind === "tool_call" && item.status !== "running" && !printed.has(item.id)) {
|
|
33
54
|
printed.add(item.id);
|
|
34
|
-
const detail = item
|
|
55
|
+
const detail = toolLine(item);
|
|
35
56
|
line(sessionId, ` ${item.status === "failed" ? "\u2717" : "\u2713"} ${detail}`);
|
|
36
57
|
}
|
|
37
58
|
if (item.kind === "notice") line(sessionId, ` ${item.level === "error" ? "\u203C" : item.level === "warning" ? "!" : "\u2139"} ${item.text}`);
|
|
@@ -421,5 +442,6 @@ export {
|
|
|
421
442
|
resume,
|
|
422
443
|
run,
|
|
423
444
|
send,
|
|
445
|
+
toolLine,
|
|
424
446
|
top
|
|
425
447
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anhlp/alp-cli",
|
|
3
|
-
"version": "0.0.0-beta.
|
|
3
|
+
"version": "0.0.0-beta.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "ALP cli module",
|
|
6
6
|
"files": [
|
|
@@ -126,9 +126,9 @@
|
|
|
126
126
|
"node": ">=22.12"
|
|
127
127
|
},
|
|
128
128
|
"dependencies": {
|
|
129
|
-
"@anhlp/alp-core": "0.0.0-beta.
|
|
130
|
-
"@anhlp/alp-client": "0.0.0-beta.
|
|
131
|
-
"@anhlp/alp-protocol": "0.0.0-beta.
|
|
129
|
+
"@anhlp/alp-core": "0.0.0-beta.2",
|
|
130
|
+
"@anhlp/alp-client": "0.0.0-beta.2",
|
|
131
|
+
"@anhlp/alp-protocol": "0.0.0-beta.2",
|
|
132
132
|
"smol-toml": "1.9.0",
|
|
133
133
|
"@agentclientprotocol/sdk": "1.7.0",
|
|
134
134
|
"@anthropic-ai/claude-agent-sdk": "^0.3.292"
|
package/src/acp/agent.ts
CHANGED
|
@@ -27,6 +27,11 @@ type Session = {
|
|
|
27
27
|
cwd: string;
|
|
28
28
|
mcpServers: Record<string, HostMcpServer>;
|
|
29
29
|
preview: SessionPreview;
|
|
30
|
+
/**
|
|
31
|
+
* The team the first preview named when the project's team list lacks it (`custom`, for settings
|
|
32
|
+
* without workflow.mode), kept so the editor can choose it again after trying another team.
|
|
33
|
+
*/
|
|
34
|
+
unlisted?: Team;
|
|
30
35
|
/** Open in alpd: the team is fixed from then on. */
|
|
31
36
|
opened: boolean;
|
|
32
37
|
/** Prompts this connection sent, which the editor already shows. */
|
|
@@ -43,6 +48,10 @@ type Session = {
|
|
|
43
48
|
waiting?: { clientMessageId: string; turnId?: string; done(result: { state: 'completed' | 'failed' | 'canceled'; error?: string }): void };
|
|
44
49
|
};
|
|
45
50
|
|
|
51
|
+
/** The team a preview named when its list lacks it (`custom` runs settings' delegation graph, ALPD §42). */
|
|
52
|
+
const unlistedOf = ({ teams, team, teamLabel }: SessionPreview): Team | undefined =>
|
|
53
|
+
teams.some(entry => entry.id === team) ? undefined : { id: team, label: teamLabel ?? (team === 'custom' ? 'Custom' : team) };
|
|
54
|
+
|
|
46
55
|
const MODES = [
|
|
47
56
|
{ id: 'read-only', name: 'Read only', description: 'Agents read and search; nothing is changed' },
|
|
48
57
|
{ id: 'workspace-write', name: 'Workspace write', description: 'Agents change files and run commands inside the project' },
|
|
@@ -86,35 +95,104 @@ export function promptText(blocks: acp.ContentBlock[]) {
|
|
|
86
95
|
return text.trim();
|
|
87
96
|
}
|
|
88
97
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
98
|
+
type ToolItem = Extract<TimelineItem, { kind: 'tool_call' }>;
|
|
99
|
+
/** A detail as received; a type later than this version's falls to the unknown branches. */
|
|
100
|
+
type AnyDetail = ToolItem['detail'];
|
|
101
|
+
|
|
102
|
+
/** A path as the editor's user knows it: relative to the session's folder when inside it. */
|
|
103
|
+
function shown(file: string, cwd?: string) {
|
|
104
|
+
if (!cwd || !path.isAbsolute(file)) return file;
|
|
105
|
+
const relative = path.relative(cwd, file);
|
|
106
|
+
return relative && !relative.startsWith('..') && !path.isAbsolute(relative) ? relative : file;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** What kind of work a tool call is: from its typed detail, else its name or its command's first word (older Claude items are `Read {…}` commands). */
|
|
110
|
+
export function toolKind(item: ToolItem): acp.ToolKind {
|
|
111
|
+
const detail = item.detail as AnyDetail;
|
|
112
|
+
switch (detail.type) {
|
|
113
|
+
case 'read': return 'read';
|
|
114
|
+
case 'edit': case 'write': return 'edit';
|
|
115
|
+
case 'search': return detail.toolName === 'web_search' ? 'fetch' : 'search';
|
|
116
|
+
case 'fetch': return 'fetch';
|
|
117
|
+
case 'plan': return 'think';
|
|
118
|
+
case 'sub_agent': case 'plain_text': return 'other';
|
|
119
|
+
}
|
|
120
|
+
const word = detail.type === 'shell' ? String(detail.command ?? '').trim().split(/[\s{(]/)[0] : item.name;
|
|
92
121
|
if (/^(Read|NotebookRead|LS)$/.test(word)) return 'read';
|
|
93
122
|
if (/^(Edit|MultiEdit|Write|NotebookEdit)$/.test(word)) return 'edit';
|
|
94
123
|
if (/^(Grep|Glob)$/.test(word)) return 'search';
|
|
95
124
|
if (/^(WebFetch|WebSearch)$/.test(word)) return 'fetch';
|
|
96
125
|
if (/^(Skill|Task|TodoWrite)$/.test(word) || item.name.startsWith('alp_')) return 'other';
|
|
97
|
-
return
|
|
126
|
+
return detail.type === 'shell' ? 'execute' : 'other';
|
|
98
127
|
}
|
|
99
128
|
|
|
100
|
-
function toolTitle(item:
|
|
101
|
-
|
|
102
|
-
|
|
129
|
+
export function toolTitle(item: ToolItem, cwd?: string) {
|
|
130
|
+
const detail = item.detail as AnyDetail;
|
|
131
|
+
switch (detail.type) {
|
|
132
|
+
case 'shell': return clip(String(detail.command ?? '').split('\n')[0], 160);
|
|
133
|
+
case 'read': return clip(`Read ${shown(detail.filePath, cwd)}`, 160);
|
|
134
|
+
case 'edit': return clip(`Edit ${shown(detail.filePath, cwd)}`, 160);
|
|
135
|
+
case 'write': return clip(`Write ${shown(detail.filePath, cwd)}`, 160);
|
|
136
|
+
case 'search': return clip(`${detail.toolName === 'web_search' ? 'Search the web' : 'Search'} ${detail.query}`, 160);
|
|
137
|
+
case 'fetch': return clip(`Fetch ${detail.url}`, 160);
|
|
138
|
+
case 'sub_agent': return clip(`${detail.subAgentType ?? 'Sub-agent'}${detail.description ? `: ${detail.description.split('\n')[0]}` : ''}`, 160);
|
|
139
|
+
case 'plan': return 'Plan';
|
|
140
|
+
case 'plain_text': return clip(`${item.name}${detail.label ? `: ${detail.label}` : ''}`, 160);
|
|
141
|
+
}
|
|
142
|
+
const input = ((detail as { input?: unknown }).input ?? {}) as Record<string, unknown>;
|
|
103
143
|
if (item.name === 'alp_delegate') return clip(`Delegate to ${input.agent ?? 'an agent'}: ${String(input.task ?? '').split('\n')[0]}`, 160);
|
|
104
144
|
return clip(`${item.name} ${JSON.stringify(input)}`, 160);
|
|
105
145
|
}
|
|
106
146
|
|
|
107
|
-
|
|
147
|
+
const bounded = (text: string) => text.length > OUTPUT_CHARS ? `${text.slice(0, OUTPUT_CHARS)}\n… (${text.length - OUTPUT_CHARS} more characters)` : text;
|
|
148
|
+
|
|
149
|
+
export function toolOutput(item: ToolItem): acp.ToolCallContent[] {
|
|
150
|
+
const detail = item.detail as AnyDetail;
|
|
151
|
+
const parts: acp.ToolCallContent[] = [];
|
|
108
152
|
let text = '';
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
153
|
+
switch (detail.type) {
|
|
154
|
+
case 'shell': text = detail.output ?? ''; break;
|
|
155
|
+
case 'read': text = detail.content ?? ''; break;
|
|
156
|
+
case 'edit':
|
|
157
|
+
// The editor shows a change as a diff when both sides are known.
|
|
158
|
+
if (detail.newString !== undefined || detail.oldString !== undefined) parts.push({ type: 'diff', path: detail.filePath, oldText: detail.oldString ?? null, newText: detail.newString ?? '' });
|
|
159
|
+
else if (detail.unifiedDiff) text = '```diff\n' + detail.unifiedDiff + (detail.unifiedDiff.endsWith('\n') ? '' : '\n') + '```';
|
|
160
|
+
break;
|
|
161
|
+
case 'write':
|
|
162
|
+
if (detail.content !== undefined) parts.push({ type: 'diff', path: detail.filePath, oldText: null, newText: detail.content });
|
|
163
|
+
break;
|
|
164
|
+
case 'search':
|
|
165
|
+
text = detail.content ?? [...(detail.filePaths ?? []), ...(detail.webResults ?? []).map(hit => `${hit.title} — ${hit.url}`)].join('\n');
|
|
166
|
+
break;
|
|
167
|
+
case 'fetch': text = detail.result ?? ''; break;
|
|
168
|
+
case 'sub_agent': text = detail.log || detail.description || ''; break;
|
|
169
|
+
case 'plan': text = detail.text; break;
|
|
170
|
+
case 'plain_text': text = detail.text ?? ''; break;
|
|
171
|
+
default: {
|
|
172
|
+
const output = (detail as { output?: unknown }).output;
|
|
173
|
+
text = Array.isArray(output) ? output.map(part => typeof part?.text === 'string' ? part.text : JSON.stringify(part)).join('\n') : output == null ? '' : typeof output === 'string' ? output : JSON.stringify(output, null, 2);
|
|
174
|
+
}
|
|
113
175
|
}
|
|
114
176
|
if (item.error) text = text ? `${text}\n${item.error}` : item.error;
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
|
|
177
|
+
if (text) parts.push({ type: 'content', content: { type: 'text', text: bounded(text) } });
|
|
178
|
+
return parts.map(part => part.type === 'diff' ? { ...part, newText: bounded(part.newText), ...(part.oldText ? { oldText: bounded(part.oldText) } : {}) } : part);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** The call's input as the editor shows it raw: a command, a typed call's own fields without its long texts, or the tool's input. */
|
|
182
|
+
export function toolInput(item: ToolItem): unknown {
|
|
183
|
+
const detail = item.detail as AnyDetail;
|
|
184
|
+
if (detail.type === 'shell') return { command: detail.command, cwd: detail.cwd };
|
|
185
|
+
if (detail.type === 'unknown' || !['read', 'edit', 'write', 'search', 'fetch', 'sub_agent', 'plan', 'plain_text'].includes(detail.type as string)) return (detail as { input?: unknown }).input;
|
|
186
|
+
const { type: _type, content: _content, oldString: _old, newString: _new, unifiedDiff: _diff, result: _result, log: _log, text: _text, filePaths: _paths, webResults: _hits, ...rest } = detail as Record<string, unknown>;
|
|
187
|
+
return rest;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** The file a typed call read or changed, for the editor to follow. */
|
|
191
|
+
export function toolLocations(item: ToolItem): acp.ToolCallLocation[] | undefined {
|
|
192
|
+
const detail = item.detail as AnyDetail;
|
|
193
|
+
if (detail.type !== 'read' && detail.type !== 'edit' && detail.type !== 'write') return undefined;
|
|
194
|
+
const filePath = String(detail.filePath);
|
|
195
|
+
return [{ path: filePath, ...(detail.type === 'read' && typeof detail.offset === 'number' ? { line: detail.offset } : {}) }];
|
|
118
196
|
}
|
|
119
197
|
|
|
120
198
|
const clip = (text: string, chars: number) => text.length > chars ? `${text.slice(0, chars - 1)}…` : text;
|
|
@@ -157,21 +235,33 @@ export function createAcpAgent(options: AcpAgentOptions) {
|
|
|
157
235
|
const say = (session: Session, text: string) => send(session, { sessionUpdate: 'agent_message_chunk', content: { type: 'text', text } });
|
|
158
236
|
|
|
159
237
|
function configOptions(session: Session): acp.SessionConfigOption[] {
|
|
160
|
-
const teams: Team[] = session.opened ? session.
|
|
238
|
+
const teams: Team[] = session.opened ? choices(session).filter(team => team.id === session.preview.team) : choices(session);
|
|
161
239
|
return [
|
|
162
240
|
{
|
|
163
241
|
id: 'team', name: 'Team', category: 'model', type: 'select', currentValue: session.preview.team,
|
|
164
242
|
description: session.opened ? 'A session keeps its team; start a new one for another team' : 'The team that works on this session',
|
|
165
|
-
options:
|
|
243
|
+
options: teams.map(team => ({ value: team.id, name: team.label, ...(team.description ? { description: team.description } : {}) })),
|
|
166
244
|
},
|
|
167
245
|
{ id: 'mode', name: 'Permissions', category: 'mode', type: 'select', currentValue: session.preview.mode, options: MODES.map(mode => ({ value: mode.id, name: mode.name, description: mode.description })) },
|
|
168
246
|
];
|
|
169
247
|
}
|
|
170
248
|
|
|
249
|
+
/**
|
|
250
|
+
* The teams the editor may choose: the project's, led by the team the preview named when the
|
|
251
|
+
* list lacks it (`custom`, for settings without workflow.mode), so it can be chosen back.
|
|
252
|
+
*/
|
|
253
|
+
function choices(session: Session): Team[] {
|
|
254
|
+
const { teams, team } = session.preview;
|
|
255
|
+
const own = unlistedOf(session.preview);
|
|
256
|
+
const first = session.unlisted && session.unlisted.id !== team && !teams.some(entry => entry.id === session.unlisted!.id) ? [session.unlisted] : [];
|
|
257
|
+
return [...first, ...(own ? [own] : []), ...teams];
|
|
258
|
+
}
|
|
259
|
+
|
|
171
260
|
const modeState = (session: Session): acp.SessionModeState => ({ currentModeId: session.preview.mode, availableModes: MODES });
|
|
172
261
|
|
|
173
262
|
function track(id: string, cwd: string, mcpServers: Record<string, HostMcpServer>, preview: SessionPreview, opened: boolean) {
|
|
174
|
-
const
|
|
263
|
+
const unlisted = unlistedOf(preview);
|
|
264
|
+
const session: Session = { id, cwd, mcpServers, preview, opened, ...(unlisted ? { unlisted } : {}), ours: new Set(), texts: new Map(), tools: new Set(), questions: new Map(), queue: Promise.resolve() };
|
|
175
265
|
sessions.set(id, session);
|
|
176
266
|
return session;
|
|
177
267
|
}
|
|
@@ -260,7 +350,8 @@ export function createAcpAgent(options: AcpAgentOptions) {
|
|
|
260
350
|
send(session, { sessionUpdate: 'plan', entries: item.items.map(entry => ({ content: entry.text, priority: 'medium', status: entry.status })) });
|
|
261
351
|
return;
|
|
262
352
|
case 'tool_call': {
|
|
263
|
-
const
|
|
353
|
+
const locations = toolLocations(item);
|
|
354
|
+
const fields = { title: toolTitle(item, session.cwd), kind: toolKind(item), status: status(item.status), content: toolOutput(item), rawInput: toolInput(item), ...(locations ? { locations } : {}) };
|
|
264
355
|
if (session.tools.has(item.id)) send(session, { sessionUpdate: 'tool_call_update', toolCallId: item.id, ...fields });
|
|
265
356
|
else {
|
|
266
357
|
session.tools.add(item.id);
|
|
@@ -398,7 +489,7 @@ export function createAcpAgent(options: AcpAgentOptions) {
|
|
|
398
489
|
if (params.configId === 'mode') await setMode(session, value);
|
|
399
490
|
else if (params.configId === 'team') {
|
|
400
491
|
if (session.opened && value !== session.preview.team) throw acp.RequestError.invalidParams(undefined, 'A session keeps its team; start a new one for another team');
|
|
401
|
-
if (!session.
|
|
492
|
+
if (!choices(session).some(team => team.id === value)) throw acp.RequestError.invalidParams(undefined, `Unknown team ${value}`);
|
|
402
493
|
session.preview = { ...await preview(session.cwd, session.mcpServers, value), mode: session.preview.mode };
|
|
403
494
|
} else throw acp.RequestError.invalidParams(undefined, `Unknown option ${params.configId}`);
|
|
404
495
|
return { configOptions: configOptions(session) };
|
package/src/sessions.js
CHANGED
|
@@ -9,6 +9,21 @@ import { UsageError } from './usage.js';
|
|
|
9
9
|
import { start, running, stop } from './daemon.js';
|
|
10
10
|
import { taskProject } from './tasks.js';
|
|
11
11
|
|
|
12
|
+
/** One line for a finished tool call: its command, or what a typed call touched (ALPD §4.2). */
|
|
13
|
+
export function toolLine(item) {
|
|
14
|
+
const detail = item.detail ?? {};
|
|
15
|
+
const first = text => String(text ?? '').split('\n')[0].slice(0, 200);
|
|
16
|
+
switch (detail.type) {
|
|
17
|
+
case 'shell': return detail.command;
|
|
18
|
+
case 'read': case 'edit': case 'write': return `${item.name} ${detail.filePath}`;
|
|
19
|
+
case 'search': return `${item.name} ${first(detail.query)}`;
|
|
20
|
+
case 'fetch': return `${item.name} ${detail.url}`;
|
|
21
|
+
case 'sub_agent': return `${item.name}${detail.description ? ` ${first(detail.description)}` : ''}`;
|
|
22
|
+
case 'plain_text': return `${item.name}${detail.label ? ` ${detail.label}` : ''}`;
|
|
23
|
+
}
|
|
24
|
+
return item.name === 'alp_delegate' ? `delegate → ${detail.input?.agent}` : item.name;
|
|
25
|
+
}
|
|
26
|
+
|
|
12
27
|
function printer(json) {
|
|
13
28
|
const depth = new Map();
|
|
14
29
|
const agents = new Map();
|
|
@@ -28,7 +43,7 @@ function printer(json) {
|
|
|
28
43
|
latest.set(item.id, { sessionId, item });
|
|
29
44
|
if (item.kind === 'tool_call' && item.status !== 'running' && !printed.has(item.id)) {
|
|
30
45
|
printed.add(item.id);
|
|
31
|
-
const detail = item
|
|
46
|
+
const detail = toolLine(item);
|
|
32
47
|
line(sessionId, ` ${item.status === 'failed' ? '✗' : '✓'} ${detail}`);
|
|
33
48
|
}
|
|
34
49
|
if (item.kind === 'notice') line(sessionId, ` ${item.level === 'error' ? '‼' : item.level === 'warning' ? '!' : 'ℹ'} ${item.text}`);
|