linkshell-cli 0.2.121 → 0.2.122
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/cli/src/runtime/acp/agent-workspace.js +4 -1
- package/dist/cli/src/runtime/acp/agent-workspace.js.map +1 -1
- package/dist/cli/src/runtime/acp/claude-sdk-client.js +19 -0
- package/dist/cli/src/runtime/acp/claude-sdk-client.js.map +1 -1
- package/dist/cli/src/runtime/acp/claude-stream-json-client.js +38 -1
- package/dist/cli/src/runtime/acp/claude-stream-json-client.js.map +1 -1
- package/dist/cli/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/runtime/acp/agent-workspace.ts +5 -1
- package/src/runtime/acp/claude-sdk-client.ts +19 -0
- package/src/runtime/acp/claude-stream-json-client.ts +39 -1
|
@@ -222,10 +222,21 @@ export class ClaudeStreamJsonClient {
|
|
|
222
222
|
let currentToolId: string | undefined;
|
|
223
223
|
let currentToolName: string | undefined;
|
|
224
224
|
let currentMessageId: string | undefined;
|
|
225
|
+
const progressItemId = `claude-progress:${input.clientMessageId}`;
|
|
225
226
|
// Map tool_use_id → tool_name so tool_result can look up the correct name
|
|
226
227
|
// even when multiple tools are in flight
|
|
227
228
|
const toolNames = new Map<string, string>();
|
|
228
229
|
|
|
230
|
+
this.input.onNotification("item/started", {
|
|
231
|
+
sessionId: input.sessionId ?? this.claudeSessionId,
|
|
232
|
+
item: {
|
|
233
|
+
id: progressItemId,
|
|
234
|
+
type: "thinking",
|
|
235
|
+
text: "Claude 正在处理请求",
|
|
236
|
+
status: "running",
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
|
|
229
240
|
rl.on("line", (line: string) => {
|
|
230
241
|
if (this.pendingCancel) {
|
|
231
242
|
child.kill("SIGTERM");
|
|
@@ -375,6 +386,16 @@ export class ClaudeStreamJsonClient {
|
|
|
375
386
|
}
|
|
376
387
|
|
|
377
388
|
case "result": {
|
|
389
|
+
const isError = event.subtype === "error" || event.is_error === true;
|
|
390
|
+
this.input.onNotification("item/completed", {
|
|
391
|
+
sessionId: this.claudeSessionId ?? input.sessionId,
|
|
392
|
+
item: {
|
|
393
|
+
id: progressItemId,
|
|
394
|
+
type: "thinking",
|
|
395
|
+
text: isError ? "Claude 运行出错" : "Claude 已完成",
|
|
396
|
+
status: isError ? "failed" : "completed",
|
|
397
|
+
},
|
|
398
|
+
});
|
|
378
399
|
// Mark the last agent message as complete so isStreaming flips to false
|
|
379
400
|
if (currentMessageId) {
|
|
380
401
|
this.input.onNotification("item/completed", {
|
|
@@ -387,7 +408,6 @@ export class ClaudeStreamJsonClient {
|
|
|
387
408
|
});
|
|
388
409
|
}
|
|
389
410
|
// Turn complete
|
|
390
|
-
const isError = event.subtype === "error" || event.is_error === true;
|
|
391
411
|
this.input.onNotification("turn/completed", {
|
|
392
412
|
sessionId: this.claudeSessionId,
|
|
393
413
|
stopReason: event.stop_reason ?? (isError ? "error" : "end_turn"),
|
|
@@ -408,11 +428,29 @@ export class ClaudeStreamJsonClient {
|
|
|
408
428
|
});
|
|
409
429
|
|
|
410
430
|
child.on("error", (err) => {
|
|
431
|
+
this.input.onNotification("item/completed", {
|
|
432
|
+
sessionId: this.claudeSessionId ?? input.sessionId,
|
|
433
|
+
item: {
|
|
434
|
+
id: progressItemId,
|
|
435
|
+
type: "thinking",
|
|
436
|
+
text: "Claude 运行出错",
|
|
437
|
+
status: "failed",
|
|
438
|
+
},
|
|
439
|
+
});
|
|
411
440
|
finish(err, undefined);
|
|
412
441
|
});
|
|
413
442
|
|
|
414
443
|
child.on("exit", (code, signal) => {
|
|
415
444
|
if (!settled) {
|
|
445
|
+
this.input.onNotification("item/completed", {
|
|
446
|
+
sessionId: this.claudeSessionId ?? input.sessionId,
|
|
447
|
+
item: {
|
|
448
|
+
id: progressItemId,
|
|
449
|
+
type: "thinking",
|
|
450
|
+
text: this.pendingCancel ? "Claude 已停止" : "Claude 意外退出",
|
|
451
|
+
status: "failed",
|
|
452
|
+
},
|
|
453
|
+
});
|
|
416
454
|
finish(
|
|
417
455
|
new Error(`Claude exited unexpectedly (code=${code ?? "null"}, signal=${signal ?? "null"})`),
|
|
418
456
|
undefined,
|