@lucascouts/claude-agent-tui 0.16.1 → 0.16.3
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 +12 -0
- package/dist/acp-agent.js +19 -2
- package/dist/claude-path.d.ts +1 -1
- package/dist/claude-path.js +1 -1
- package/dist/model-catalog.d.ts +5 -0
- package/dist/model-catalog.js +16 -1
- package/dist/session-delete.d.ts +17 -0
- package/dist/session-delete.js +34 -0
- package/dist/tools.d.ts +9 -0
- package/dist/tools.js +93 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -71,6 +71,18 @@ npm test
|
|
|
71
71
|
- Token-usage updates
|
|
72
72
|
- Prompt input, cancellation, and session load/replay
|
|
73
73
|
|
|
74
|
+
## Release notes
|
|
75
|
+
|
|
76
|
+
**0.16.3** — security and hygiene:
|
|
77
|
+
|
|
78
|
+
- zod 4.6.7 (GHSA-mrhx).
|
|
79
|
+
- Fast mode is detected on any model, not only Opus.
|
|
80
|
+
- A tool call with a non-string path no longer breaks its title; Grep and Bash titles show the CLI's input aliases (`file_path`, `-l`, `-c`, `command_description`).
|
|
81
|
+
- Deleting a never-prompted, unknown or non-UUID session succeeds.
|
|
82
|
+
- `effort = "ultracode"` is accepted as deprecated and maps to effort `xhigh` plus the Ultracode switch.
|
|
83
|
+
|
|
84
|
+
The full per-commit log is [`CHANGELOG.md`](CHANGELOG.md).
|
|
85
|
+
|
|
74
86
|
## Supply-chain notes
|
|
75
87
|
|
|
76
88
|
[Socket](https://socket.dev/npm/package/@lucascouts/claude-agent-tui) flags some
|
package/dist/acp-agent.js
CHANGED
|
@@ -28,7 +28,7 @@ import { guardEvent } from "./billing/entrypoint-guard.js";
|
|
|
28
28
|
import { usageUpdatesFor } from "./usage.js";
|
|
29
29
|
import { createTurnResolver } from "./end-of-turn.js";
|
|
30
30
|
import { sendPrompt } from "./engine-pty.js";
|
|
31
|
-
import { MODEL_CONTEXT_WINDOWS, MODEL_ID_CONTEXT_WINDOWS, modelSelectorDescription, DEFAULT_MODEL_INFO, resolveCatalogValueFromModelId, isFastModeCapableModel, classifyFastModeSignal, FAST_MODE_CONFIG_ID, FAST_MODE_ON, FAST_MODE_OFF, createFastModeConfigOption, clientSupportsBooleanConfigOptions, resolveFastModeEnabled, ULTRACODE_CONFIG_ID, ultracodeCommand, isUltracodeCapableModel, resolveUltracodeEnabled, createUltracodeConfigOption, classifyUltracodeReply, } from "./model-catalog.js";
|
|
31
|
+
import { MODEL_CONTEXT_WINDOWS, MODEL_ID_CONTEXT_WINDOWS, modelSelectorDescription, DEFAULT_MODEL_INFO, resolveCatalogValueFromModelId, isFastModeCapableModel, classifyFastModeSignal, FAST_MODE_CONFIG_ID, FAST_MODE_ON, FAST_MODE_OFF, createFastModeConfigOption, clientSupportsBooleanConfigOptions, resolveFastModeEnabled, ULTRACODE_CONFIG_ID, ULTRACODE_EFFORT_LEVEL, LEGACY_ULTRACODE_EFFORT_VALUE, ultracodeCommand, isUltracodeCapableModel, resolveUltracodeEnabled, createUltracodeConfigOption, classifyUltracodeReply, } from "./model-catalog.js";
|
|
32
32
|
import { resolveModelCatalog } from "./live-model-catalog.js";
|
|
33
33
|
// Item 84 — mirror the Ultracode switch into the gate's per-session scratch settings file as
|
|
34
34
|
// `ultracode:true`, so a re-spawn of this session keeps it (`/effort ultracode on` is session-scoped
|
|
@@ -46,6 +46,7 @@ import { setupSessionGate } from "./permissions/gate-wiring.js";
|
|
|
46
46
|
// re-spawn regeneration (R2.4). The module never logs the scratch contents/path-with-secrets (R2.3).
|
|
47
47
|
import { translateMcpServers, writeMcpScratch, removeMcpScratch } from "./mcp-config-writer.js";
|
|
48
48
|
import { materializeImage, cleanupMaterializedImages } from "./image-input.js";
|
|
49
|
+
import { deleteSessionIfStored } from "./session-delete.js";
|
|
49
50
|
export const CLAUDE_CONFIG_DIR = process.env.CLAUDE_CONFIG_DIR ?? path.join(os.homedir(), ".claude");
|
|
50
51
|
const MAX_TITLE_LENGTH = 256;
|
|
51
52
|
function sanitizeTitle(text) {
|
|
@@ -1344,7 +1345,9 @@ export class ClaudeAcpAgent {
|
|
|
1344
1345
|
if (this.sessions[params.sessionId]) {
|
|
1345
1346
|
await this.teardownSession(params.sessionId);
|
|
1346
1347
|
}
|
|
1347
|
-
|
|
1348
|
+
// A never-prompted, unknown or non-UUID session has no transcript, and
|
|
1349
|
+
// deleting it succeeds (upstream #1351); any other SDK failure still fails.
|
|
1350
|
+
await deleteSessionIfStored(params.sessionId, deleteSession);
|
|
1348
1351
|
return {};
|
|
1349
1352
|
}
|
|
1350
1353
|
async setSessionMode(params) {
|
|
@@ -1406,6 +1409,20 @@ export class ClaudeAcpAgent {
|
|
|
1406
1409
|
const allValues = "options" in option && Array.isArray(option.options)
|
|
1407
1410
|
? option.options.flatMap((o) => ("options" in o ? o.options : [o]))
|
|
1408
1411
|
: [];
|
|
1412
|
+
// Story 063 — the retired `ultracode` effort notch, accepted as deprecated from clients that
|
|
1413
|
+
// still send it and mapped as claude-agent-plus maps it: effort xhigh plus the Ultracode switch
|
|
1414
|
+
// on. Only where this model's effort select offers xhigh; elsewhere it is rejected below like any
|
|
1415
|
+
// unknown value. `ultracode` itself is never typed as an effort level.
|
|
1416
|
+
if (params.configId === "effort" &&
|
|
1417
|
+
params.value === LEGACY_ULTRACODE_EFFORT_VALUE &&
|
|
1418
|
+
allValues.some((o) => o.value === ULTRACODE_EFFORT_LEVEL)) {
|
|
1419
|
+
this.logger.log(`[ultracode] event=legacy_effort_value_mapped session=${params.sessionId} effort=${ULTRACODE_EFFORT_LEVEL}`);
|
|
1420
|
+
this.applyEffortChange(session, ULTRACODE_EFFORT_LEVEL);
|
|
1421
|
+
await this.applyConfigOptionValue(params.sessionId, session, "effort", ULTRACODE_EFFORT_LEVEL);
|
|
1422
|
+
await this.applyUltracodeChange(params.sessionId, session, true);
|
|
1423
|
+
session.configOptions = this.rebuildConfigOptionsPreserving(session, this.currentModel(session));
|
|
1424
|
+
return { configOptions: session.configOptions };
|
|
1425
|
+
}
|
|
1409
1426
|
let validValue = allValues.find((o) => o.value === params.value);
|
|
1410
1427
|
// For model options, fall back to resolveModelPreference when the exact
|
|
1411
1428
|
// value doesn't match. This lets callers use human-friendly aliases like
|
package/dist/claude-path.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* binary whose version differs only triggers a soft drift *warning* (R1.2), never
|
|
5
5
|
* a resolution failure.
|
|
6
6
|
*/
|
|
7
|
-
export declare const PROVENANCE_CLAUDE_VERSION = "2.1.
|
|
7
|
+
export declare const PROVENANCE_CLAUDE_VERSION = "2.1.312";
|
|
8
8
|
/**
|
|
9
9
|
* Extract the leading `x.y.z` semver from `claude --version` output.
|
|
10
10
|
*
|
package/dist/claude-path.js
CHANGED
|
@@ -34,7 +34,7 @@ import { reportImageVisionSmoke } from "./image-vision-smoke.js";
|
|
|
34
34
|
* binary whose version differs only triggers a soft drift *warning* (R1.2), never
|
|
35
35
|
* a resolution failure.
|
|
36
36
|
*/
|
|
37
|
-
export const PROVENANCE_CLAUDE_VERSION = "2.1.
|
|
37
|
+
export const PROVENANCE_CLAUDE_VERSION = "2.1.312";
|
|
38
38
|
/** Shared install hint appended to the fail-loud resolution error (R1.3). */
|
|
39
39
|
const INSTALL_HINT = 'Install the Claude Code subscription CLI or ensure "claude" is on PATH.';
|
|
40
40
|
/** True if `p` exists and is executable by the current process. */
|
package/dist/model-catalog.d.ts
CHANGED
|
@@ -182,6 +182,11 @@ export declare const ULTRACODE_CONFIG_ID = "ultracode";
|
|
|
182
182
|
* Item 84 — the CLI command that turns Ultracode on or off for the session. Always the explicit
|
|
183
183
|
* `on|off` form: never a bare `/effort ultracode`, whose meaning the CLI has changed between builds.
|
|
184
184
|
*/
|
|
185
|
+
/** Story 063 — the effort level the retired `ultracode` notch maps to (claude-agent-plus's
|
|
186
|
+
* `ULTRACODE_EFFORT_LEVEL`): the level the CLI requires for Ultracode. */
|
|
187
|
+
export declare const ULTRACODE_EFFORT_LEVEL = "xhigh";
|
|
188
|
+
/** Story 063 — the value the old effort-select notch carried; accepted as deprecated. */
|
|
189
|
+
export declare const LEGACY_ULTRACODE_EFFORT_VALUE = "ultracode";
|
|
185
190
|
export declare function ultracodeCommand(on: boolean): string;
|
|
186
191
|
/**
|
|
187
192
|
* Item 84 — can this model run Ultracode? The CLI's own gate is "workflows are enabled AND the model
|
package/dist/model-catalog.js
CHANGED
|
@@ -312,8 +312,18 @@ function stripControlSequences(raw) {
|
|
|
312
312
|
* Story 073 (R1) — the `/fast` panel header, present in BOTH the available and gated renders (verified
|
|
313
313
|
* live in the spike). Its presence means the panel finished rendering, so a verdict can be reached; its
|
|
314
314
|
* absence means "not rendered yet" → pending.
|
|
315
|
+
*
|
|
316
|
+
* Story 063 — the first two anchors are model-conditional: CLI 2.1.310 renders ` (research preview)`
|
|
317
|
+
* only for some models, and the second matches an Opus display name only. The panel's description line
|
|
318
|
+
* (`High-speed mode for <name>. Draws from usage credits at a higher rate.`, in 2.1.302 and 2.1.310)
|
|
319
|
+
* does not name the model, so it is the anchor that holds on every one. It also appears on the gated
|
|
320
|
+
* panel, which is safe because the gate markers are checked first.
|
|
315
321
|
*/
|
|
316
|
-
const FAST_PANEL_ANCHORS = [
|
|
322
|
+
const FAST_PANEL_ANCHORS = [
|
|
323
|
+
/fast mode \(research preview\)/i,
|
|
324
|
+
/high-speed mode for opus/i,
|
|
325
|
+
/draws from usage credits at a higher rate/i,
|
|
326
|
+
];
|
|
317
327
|
/** Story 073 (R1) — still resolving. Checked BEFORE the gate markers because the CLI renders this as
|
|
318
328
|
* `Fast mode unavailable: Checking fast mode availability`, which also matches a gate substring. */
|
|
319
329
|
const FAST_PENDING_MARKERS = ["checking fast mode availability"];
|
|
@@ -366,6 +376,11 @@ export const ULTRACODE_CONFIG_ID = "ultracode";
|
|
|
366
376
|
* Item 84 — the CLI command that turns Ultracode on or off for the session. Always the explicit
|
|
367
377
|
* `on|off` form: never a bare `/effort ultracode`, whose meaning the CLI has changed between builds.
|
|
368
378
|
*/
|
|
379
|
+
/** Story 063 — the effort level the retired `ultracode` notch maps to (claude-agent-plus's
|
|
380
|
+
* `ULTRACODE_EFFORT_LEVEL`): the level the CLI requires for Ultracode. */
|
|
381
|
+
export const ULTRACODE_EFFORT_LEVEL = "xhigh";
|
|
382
|
+
/** Story 063 — the value the old effort-select notch carried; accepted as deprecated. */
|
|
383
|
+
export const LEGACY_ULTRACODE_EFFORT_VALUE = "ultracode";
|
|
369
384
|
export function ultracodeCommand(on) {
|
|
370
385
|
return on ? "/effort ultracode on" : "/effort ultracode off";
|
|
371
386
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `session/delete` without a transcript succeeds (upstream fadbe18, #1351; ported from
|
|
3
|
+
* claude-agent-plus, story 063).
|
|
4
|
+
*
|
|
5
|
+
* ACP: "Deleting an already-deleted session, or a session that never existed,
|
|
6
|
+
* SHOULD succeed silently." The SDK delete instead throws for an id that is
|
|
7
|
+
* not a UUID ("Invalid sessionId") and for a session with nothing on disk —
|
|
8
|
+
* which includes a live session never prompted, since Claude Code writes the
|
|
9
|
+
* transcript at the first prompt. Every other SDK failure still fails.
|
|
10
|
+
*/
|
|
11
|
+
/** Whether `value` is a Claude session id (a UUID): only such ids name a
|
|
12
|
+
* transcript. */
|
|
13
|
+
export declare function isSessionId(value: unknown): value is string;
|
|
14
|
+
/** The SDK's own "nothing on disk" error, matched on its message as upstream
|
|
15
|
+
* does — the SDK throws a plain `Error` with no code. */
|
|
16
|
+
export declare function isSdkSessionNotFound(error: unknown): boolean;
|
|
17
|
+
export declare function deleteSessionIfStored(sessionId: string, deleteSession?: (sessionId: string) => Promise<void>): Promise<void>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `session/delete` without a transcript succeeds (upstream fadbe18, #1351; ported from
|
|
3
|
+
* claude-agent-plus, story 063).
|
|
4
|
+
*
|
|
5
|
+
* ACP: "Deleting an already-deleted session, or a session that never existed,
|
|
6
|
+
* SHOULD succeed silently." The SDK delete instead throws for an id that is
|
|
7
|
+
* not a UUID ("Invalid sessionId") and for a session with nothing on disk —
|
|
8
|
+
* which includes a live session never prompted, since Claude Code writes the
|
|
9
|
+
* transcript at the first prompt. Every other SDK failure still fails.
|
|
10
|
+
*/
|
|
11
|
+
import { deleteSession as sdkDeleteSession } from "@anthropic-ai/claude-agent-sdk";
|
|
12
|
+
const SESSION_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
13
|
+
/** Whether `value` is a Claude session id (a UUID): only such ids name a
|
|
14
|
+
* transcript. */
|
|
15
|
+
export function isSessionId(value) {
|
|
16
|
+
return typeof value === "string" && SESSION_ID_PATTERN.test(value);
|
|
17
|
+
}
|
|
18
|
+
/** The SDK's own "nothing on disk" error, matched on its message as upstream
|
|
19
|
+
* does — the SDK throws a plain `Error` with no code. */
|
|
20
|
+
export function isSdkSessionNotFound(error) {
|
|
21
|
+
return error instanceof Error && /^Session \S+ not found in /.test(error.message);
|
|
22
|
+
}
|
|
23
|
+
export async function deleteSessionIfStored(sessionId, deleteSession = sdkDeleteSession) {
|
|
24
|
+
if (!isSessionId(sessionId))
|
|
25
|
+
return;
|
|
26
|
+
try {
|
|
27
|
+
await deleteSession(sessionId);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
if (isSdkSessionNotFound(error))
|
|
31
|
+
return;
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
}
|
package/dist/tools.d.ts
CHANGED
|
@@ -70,6 +70,15 @@ interface RawToolUse {
|
|
|
70
70
|
id: string;
|
|
71
71
|
input?: unknown;
|
|
72
72
|
}
|
|
73
|
+
/** Read a Bash input's description the way the CLI validates it. Since CLI
|
|
74
|
+
* 2.1.295 the CLI accepts `command_description` for `description`, but the
|
|
75
|
+
* tool_use block keeps the key the model sent. The canonical key wins when both
|
|
76
|
+
* spellings are present. (Upstream #1330, ported from claude-agent-plus.) */
|
|
77
|
+
export declare function shellDescription(input: unknown): string | undefined;
|
|
78
|
+
/** Read a Grep input's path the way the CLI validates it. Since CLI 2.1.292 the
|
|
79
|
+
* CLI accepts `file_path` for `path`; the canonical key wins when both are
|
|
80
|
+
* present. (Upstream #1271, ported from claude-agent-plus.) */
|
|
81
|
+
export declare function grepPath(input: unknown): string | undefined;
|
|
73
82
|
export declare function toolInfoFromToolUse(toolUse: RawToolUse, supportsTerminalOutput?: boolean, cwd?: string): ToolInfo;
|
|
74
83
|
export declare function toolUpdateFromToolResult(toolResult: ToolResultBlockParam | BetaToolResultBlockParam | BetaWebSearchToolResultBlockParam | BetaWebFetchToolResultBlockParam | WebSearchToolResultBlockParam | BetaCodeExecutionToolResultBlockParam | BetaBashCodeExecutionToolResultBlockParam | BetaTextEditorCodeExecutionToolResultBlockParam | BetaRequestMCPToolResultBlockParam | BetaToolSearchToolResultBlockParam, toolUse: {
|
|
75
84
|
name?: string;
|
package/dist/tools.js
CHANGED
|
@@ -12,6 +12,10 @@ function failureExitCode(text) {
|
|
|
12
12
|
* Returns the original path if it's outside the project directory or if no cwd is provided.
|
|
13
13
|
*/
|
|
14
14
|
export function toDisplayPath(filePath, cwd) {
|
|
15
|
+
// `path.resolve` throws on a non-string (upstream issue #1308); the type says
|
|
16
|
+
// string, but the value is a model's tool input. Port of claude-agent-plus.
|
|
17
|
+
if (typeof filePath !== "string")
|
|
18
|
+
return displayValueOf(filePath) ?? "";
|
|
15
19
|
if (!cwd)
|
|
16
20
|
return filePath;
|
|
17
21
|
const resolvedCwd = path.resolve(cwd);
|
|
@@ -21,6 +25,30 @@ export function toDisplayPath(filePath, cwd) {
|
|
|
21
25
|
}
|
|
22
26
|
return filePath;
|
|
23
27
|
}
|
|
28
|
+
/** A tool input's path, when it is one: a non-empty string. Anything else — a
|
|
29
|
+
* model can emit `{"file_path": 12345}`, which Claude Code rejects — is no
|
|
30
|
+
* path, so it is neither resolved nor sent as a location or a diff target
|
|
31
|
+
* (upstream issue #1308, ported from claude-agent-plus). */
|
|
32
|
+
function pathOf(value) {
|
|
33
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
34
|
+
}
|
|
35
|
+
/** How a tool input value that is not a path still shows in a title: a number
|
|
36
|
+
* or boolean as its text, so the failed call names what the model sent;
|
|
37
|
+
* anything else (an object, null) as nothing. */
|
|
38
|
+
function displayValueOf(value) {
|
|
39
|
+
if (typeof value === "string")
|
|
40
|
+
return value.length > 0 ? value : undefined;
|
|
41
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
42
|
+
return String(value);
|
|
43
|
+
}
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
/** The title form of a tool input's path: project-relative when it is a path
|
|
47
|
+
* under `cwd`, the value's text when it is a scalar that is not a path. */
|
|
48
|
+
function displayPathOf(value, cwd) {
|
|
49
|
+
const filePath = pathOf(value);
|
|
50
|
+
return filePath !== undefined ? toDisplayPath(filePath, cwd) : displayValueOf(value);
|
|
51
|
+
}
|
|
24
52
|
/**
|
|
25
53
|
* Story 025 / Task 2.2 (R2.1, R2.3) — derive the ACP `toolCallId` from a JSONL
|
|
26
54
|
* `tool_use.id`. Pure, total and side-effect-free, and STABLE across the live and
|
|
@@ -50,6 +78,45 @@ function normalizeWriteInput(input) {
|
|
|
50
78
|
const content = raw.content ?? raw.file_text ?? raw.file_content;
|
|
51
79
|
return { ...raw, file_path: filePath, content };
|
|
52
80
|
}
|
|
81
|
+
/** Read a Bash input's description the way the CLI validates it. Since CLI
|
|
82
|
+
* 2.1.295 the CLI accepts `command_description` for `description`, but the
|
|
83
|
+
* tool_use block keeps the key the model sent. The canonical key wins when both
|
|
84
|
+
* spellings are present. (Upstream #1330, ported from claude-agent-plus.) */
|
|
85
|
+
export function shellDescription(input) {
|
|
86
|
+
if (!input || typeof input !== "object")
|
|
87
|
+
return undefined;
|
|
88
|
+
const raw = input;
|
|
89
|
+
if (typeof raw.description === "string")
|
|
90
|
+
return raw.description;
|
|
91
|
+
return typeof raw.command_description === "string" ? raw.command_description : undefined;
|
|
92
|
+
}
|
|
93
|
+
/** Read a Grep input's path the way the CLI validates it. Since CLI 2.1.292 the
|
|
94
|
+
* CLI accepts `file_path` for `path`; the canonical key wins when both are
|
|
95
|
+
* present. (Upstream #1271, ported from claude-agent-plus.) */
|
|
96
|
+
export function grepPath(input) {
|
|
97
|
+
if (!input || typeof input !== "object")
|
|
98
|
+
return undefined;
|
|
99
|
+
const raw = input;
|
|
100
|
+
if (typeof raw.path === "string")
|
|
101
|
+
return raw.path;
|
|
102
|
+
return typeof raw.file_path === "string" ? raw.file_path : undefined;
|
|
103
|
+
}
|
|
104
|
+
/** Read a Grep input's output mode the way the CLI validates it. Since CLI
|
|
105
|
+
* 2.1.295 the CLI reads a `-l` or `-c` flag (`true` or `"true"`) as
|
|
106
|
+
* `output_mode: "files_with_matches"` or `"count"` when `output_mode` is
|
|
107
|
+
* unset. (Upstream #1330, ported from claude-agent-plus.) */
|
|
108
|
+
function grepOutputMode(input) {
|
|
109
|
+
if (!input || typeof input !== "object")
|
|
110
|
+
return undefined;
|
|
111
|
+
const raw = input;
|
|
112
|
+
if (typeof raw.output_mode === "string")
|
|
113
|
+
return raw.output_mode;
|
|
114
|
+
if (raw["-l"] === true || raw["-l"] === "true")
|
|
115
|
+
return "files_with_matches";
|
|
116
|
+
if (raw["-c"] === true || raw["-c"] === "true")
|
|
117
|
+
return "count";
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
53
120
|
export function toolInfoFromToolUse(toolUse, supportsTerminalOutput = false, cwd) {
|
|
54
121
|
const name = toolUse.name;
|
|
55
122
|
switch (name) {
|
|
@@ -91,16 +158,17 @@ export function toolInfoFromToolUse(toolUse, supportsTerminalOutput = false, cwd
|
|
|
91
158
|
}
|
|
92
159
|
case "Bash": {
|
|
93
160
|
const input = toolUse.input;
|
|
161
|
+
const description = shellDescription(input);
|
|
94
162
|
return {
|
|
95
163
|
title: input?.command ? input.command : "Terminal",
|
|
96
164
|
kind: "execute",
|
|
97
165
|
content: supportsTerminalOutput
|
|
98
166
|
? [{ type: "terminal", terminalId: toolUse.id }]
|
|
99
|
-
:
|
|
167
|
+
: description
|
|
100
168
|
? [
|
|
101
169
|
{
|
|
102
170
|
type: "content",
|
|
103
|
-
content: { type: "text", text:
|
|
171
|
+
content: { type: "text", text: description },
|
|
104
172
|
},
|
|
105
173
|
]
|
|
106
174
|
: [],
|
|
@@ -115,15 +183,16 @@ export function toolInfoFromToolUse(toolUse, supportsTerminalOutput = false, cwd
|
|
|
115
183
|
else if (input?.offset) {
|
|
116
184
|
limit = " (from line " + input.offset + ")";
|
|
117
185
|
}
|
|
118
|
-
const
|
|
186
|
+
const filePath = pathOf(input?.file_path);
|
|
187
|
+
const displayPath = displayPathOf(input?.file_path, cwd) ?? "File";
|
|
119
188
|
return {
|
|
120
189
|
title: "Read " + displayPath + limit,
|
|
121
190
|
kind: "read",
|
|
122
|
-
locations:
|
|
191
|
+
locations: filePath
|
|
123
192
|
? [
|
|
124
193
|
{
|
|
125
|
-
path:
|
|
126
|
-
line: input
|
|
194
|
+
path: filePath,
|
|
195
|
+
line: input?.offset ?? 1,
|
|
127
196
|
},
|
|
128
197
|
]
|
|
129
198
|
: [],
|
|
@@ -132,12 +201,13 @@ export function toolInfoFromToolUse(toolUse, supportsTerminalOutput = false, cwd
|
|
|
132
201
|
}
|
|
133
202
|
case "Write": {
|
|
134
203
|
const input = normalizeWriteInput(toolUse.input);
|
|
204
|
+
const filePath = pathOf(input?.file_path);
|
|
135
205
|
let content = [];
|
|
136
|
-
if (input &&
|
|
206
|
+
if (input && filePath) {
|
|
137
207
|
content = [
|
|
138
208
|
{
|
|
139
209
|
type: "diff",
|
|
140
|
-
path:
|
|
210
|
+
path: filePath,
|
|
141
211
|
oldText: null,
|
|
142
212
|
newText: input.content,
|
|
143
213
|
},
|
|
@@ -151,37 +221,39 @@ export function toolInfoFromToolUse(toolUse, supportsTerminalOutput = false, cwd
|
|
|
151
221
|
},
|
|
152
222
|
];
|
|
153
223
|
}
|
|
154
|
-
const displayPath = input?.file_path
|
|
224
|
+
const displayPath = displayPathOf(input?.file_path, cwd);
|
|
155
225
|
return {
|
|
156
226
|
title: displayPath ? `Write ${displayPath}` : "Write",
|
|
157
227
|
kind: "edit",
|
|
158
228
|
content,
|
|
159
|
-
locations:
|
|
229
|
+
locations: filePath ? [{ path: filePath }] : [],
|
|
160
230
|
};
|
|
161
231
|
}
|
|
162
232
|
case "Edit": {
|
|
163
233
|
const input = toolUse.input;
|
|
234
|
+
const filePath = pathOf(input?.file_path);
|
|
164
235
|
let content = [];
|
|
165
|
-
if (input &&
|
|
236
|
+
if (input && filePath && (input.old_string || input.new_string)) {
|
|
166
237
|
content = [
|
|
167
238
|
{
|
|
168
239
|
type: "diff",
|
|
169
|
-
path:
|
|
240
|
+
path: filePath,
|
|
170
241
|
oldText: input.old_string || null,
|
|
171
242
|
newText: input.new_string ?? "",
|
|
172
243
|
},
|
|
173
244
|
];
|
|
174
245
|
}
|
|
175
|
-
const displayPath = input?.file_path
|
|
246
|
+
const displayPath = displayPathOf(input?.file_path, cwd);
|
|
176
247
|
return {
|
|
177
248
|
title: displayPath ? `Edit ${displayPath}` : "Edit",
|
|
178
249
|
kind: "edit",
|
|
179
250
|
content,
|
|
180
|
-
locations:
|
|
251
|
+
locations: filePath ? [{ path: filePath }] : [],
|
|
181
252
|
};
|
|
182
253
|
}
|
|
183
254
|
case "Glob": {
|
|
184
255
|
const input = toolUse.input;
|
|
256
|
+
const globPath = pathOf(input?.path);
|
|
185
257
|
let label = "Find";
|
|
186
258
|
if (input?.path) {
|
|
187
259
|
label += ` \`${input.path}\``;
|
|
@@ -193,7 +265,7 @@ export function toolInfoFromToolUse(toolUse, supportsTerminalOutput = false, cwd
|
|
|
193
265
|
title: label,
|
|
194
266
|
kind: "search",
|
|
195
267
|
content: [],
|
|
196
|
-
locations:
|
|
268
|
+
locations: globPath ? [{ path: globPath }] : [],
|
|
197
269
|
};
|
|
198
270
|
}
|
|
199
271
|
case "Grep": {
|
|
@@ -214,8 +286,9 @@ export function toolInfoFromToolUse(toolUse, supportsTerminalOutput = false, cwd
|
|
|
214
286
|
if (input?.["-C"] !== undefined) {
|
|
215
287
|
label += ` -C ${input["-C"]}`;
|
|
216
288
|
}
|
|
217
|
-
|
|
218
|
-
|
|
289
|
+
const outputMode = grepOutputMode(input);
|
|
290
|
+
if (outputMode) {
|
|
291
|
+
switch (outputMode) {
|
|
219
292
|
case "files_with_matches":
|
|
220
293
|
label += " -l";
|
|
221
294
|
break;
|
|
@@ -242,8 +315,9 @@ export function toolInfoFromToolUse(toolUse, supportsTerminalOutput = false, cwd
|
|
|
242
315
|
if (input?.pattern) {
|
|
243
316
|
label += ` "${input.pattern}"`;
|
|
244
317
|
}
|
|
245
|
-
|
|
246
|
-
|
|
318
|
+
const searchPath = grepPath(input);
|
|
319
|
+
if (searchPath) {
|
|
320
|
+
label += ` ${searchPath}`;
|
|
247
321
|
}
|
|
248
322
|
return {
|
|
249
323
|
title: label,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.16.
|
|
6
|
+
"version": "0.16.3",
|
|
7
7
|
"description": "Runs the official Claude Code TUI over a PTY and exposes it via ACP, so Claude Code threads render natively in Zed's agent panel. Built for Anthropic's June 2026 billing split (since paused).",
|
|
8
8
|
"main": "dist/lib.js",
|
|
9
9
|
"types": "dist/lib.d.ts",
|