@crazyhappyone/dsh-tui 0.1.0-alpha.27 → 0.1.0-alpha.28

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.
Files changed (2) hide show
  1. package/dist/index.js +282 -188
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3169,6 +3169,220 @@ var RowSequence = class {
3169
3169
  }
3170
3170
  };
3171
3171
 
3172
+ // tui-render/src/tool-cards.ts
3173
+ import { isAbsolute } from "node:path";
3174
+ import { pathToFileURL } from "node:url";
3175
+ function toolCardDisplayStatus(card) {
3176
+ const terminal = card.resultView?.card === "terminal" ? card.resultView : void 0;
3177
+ if (terminal?.signal !== void 0) return "error";
3178
+ if (terminal?.exitCode !== void 0 && terminal.exitCode !== 0) return "error";
3179
+ return card.status;
3180
+ }
3181
+ function collapsedResultTail(text) {
3182
+ if (text === void 0) return void 0;
3183
+ const line5 = text.split(/\r?\n/u).map((item) => item.trim()).filter(Boolean).at(-1);
3184
+ return line5 === void 0 ? void 0 : escapeContent(line5);
3185
+ }
3186
+ function collapsedFailureSummary(card) {
3187
+ const terminal = card.resultView?.card === "terminal" ? card.resultView : void 0;
3188
+ const identity = terminal?.exitCode !== void 0 ? `exitCode ${String(terminal.exitCode)}` : terminal?.signal !== void 0 ? `signal ${terminal.signal}` : card.error?.code;
3189
+ const detail = collapsedResultTail(terminal?.output ?? card.resultText);
3190
+ if (identity === void 0) return detail;
3191
+ return detail === void 0 || detail === identity ? identity : `${identity} \xB7 ${detail}`;
3192
+ }
3193
+ function collapsedToolCardSummary(card) {
3194
+ if (toolCardDisplayStatus(card) === "error") {
3195
+ const failure = collapsedFailureSummary(card);
3196
+ if (failure !== void 0) return failure;
3197
+ }
3198
+ const result = card.resultView;
3199
+ const kind = result?.card ?? card.callView?.card ?? "generic";
3200
+ switch (kind) {
3201
+ case "terminal":
3202
+ if (result?.card === "terminal" && result.exitCode !== void 0) {
3203
+ return `exitCode ${String(result.exitCode)}`;
3204
+ }
3205
+ if (result?.card === "terminal" && result.signal !== void 0) {
3206
+ return `signal ${result.signal}`;
3207
+ }
3208
+ if (result?.card === "terminal" && result.output !== void 0 && result.output !== "") {
3209
+ return escapeContent(result.output.replace(/\n/g, " "));
3210
+ }
3211
+ return card.callView?.card === "terminal" && card.callView.cwd !== void 0 ? escapeContent(card.callView.cwd) : void 0;
3212
+ case "diff": {
3213
+ const paths = card.callView?.card === "diff" ? card.callView.locations ?? card.callView.diffs.map((diff) => ({ path: diff.path })) : result.diffs.map((diff) => ({ path: diff.path }));
3214
+ return paths.length === 0 ? void 0 : escapeContent(paths.map((entry) => entry.path).join(" \xB7 "));
3215
+ }
3216
+ case "search":
3217
+ return result?.card === "search" ? `${String(result.total)} matches` : void 0;
3218
+ case "read":
3219
+ return result?.card === "read" ? escapeContent(result.path) : void 0;
3220
+ case "web":
3221
+ if (result?.card !== "web") return void 0;
3222
+ if (result.kind === "fetch") {
3223
+ return escapeContent(`${result.url} \xB7 ${String(result.statusCode)}`);
3224
+ }
3225
+ if (result.sources.length === 0) return void 0;
3226
+ return escapeContent(result.sources.length === 1 ? result.sources[0]?.title ?? result.sources[0]?.url : `${String(result.sources.length)} sources`);
3227
+ default:
3228
+ return card.callView === void 0 ? collapsedCardSummary(card.arguments) : void 0;
3229
+ }
3230
+ }
3231
+ function cardsFrom(content) {
3232
+ const pending = /* @__PURE__ */ new Map();
3233
+ const ordered = [];
3234
+ for (const item of content) {
3235
+ if (item.kind === "tool-call") {
3236
+ const card2 = {
3237
+ callId: item.callId,
3238
+ name: item.name,
3239
+ arguments: item.arguments,
3240
+ status: "running"
3241
+ };
3242
+ pending.set(item.callId, card2);
3243
+ ordered.push(card2);
3244
+ continue;
3245
+ }
3246
+ if (item.kind !== "tool-result") continue;
3247
+ const card = pending.get(item.callId);
3248
+ if (card === void 0) continue;
3249
+ card.status = item.isError ? "error" : "ok";
3250
+ card.resultText = item.text;
3251
+ if (item.meta !== void 0) card.meta = item.meta;
3252
+ if (item.error !== void 0) card.error = item.error;
3253
+ }
3254
+ return ordered;
3255
+ }
3256
+ function cardsFromActiveTurn(toolCalls, content = []) {
3257
+ const calls = toolCalls.map((call) => ({
3258
+ kind: "tool-call",
3259
+ callId: call.callId,
3260
+ name: call.name,
3261
+ arguments: call.arguments
3262
+ }));
3263
+ const results = content.filter(
3264
+ (item) => item.kind === "tool-result"
3265
+ );
3266
+ return cardsFrom([...calls, ...results]);
3267
+ }
3268
+ function cardsFromTurn(turn) {
3269
+ return cardsFromActiveTurn(turn.toolCalls, turn.content ?? []);
3270
+ }
3271
+ function attachPresenterViews(tools, card) {
3272
+ if (tools === void 0) return card;
3273
+ let args;
3274
+ try {
3275
+ args = JSON.parse(card.arguments);
3276
+ } catch {
3277
+ return card;
3278
+ }
3279
+ const def = tools.get(card.name);
3280
+ if (def === void 0) return card;
3281
+ let callView;
3282
+ try {
3283
+ const view = def.presentCall?.(args);
3284
+ if (view !== void 0 && typeof view.title === "string" && view.title !== "") {
3285
+ callView = view;
3286
+ }
3287
+ } catch {
3288
+ }
3289
+ let resultView;
3290
+ if (card.status !== "running") {
3291
+ try {
3292
+ const view = def.presentResult?.(args, {
3293
+ content: [{ type: "text", text: card.resultText ?? "" }],
3294
+ isError: card.status === "error",
3295
+ ...card.meta === void 0 ? {} : { meta: card.meta }
3296
+ });
3297
+ if (view !== void 0) {
3298
+ resultView = view;
3299
+ }
3300
+ } catch {
3301
+ }
3302
+ }
3303
+ if (callView === void 0 && resultView === void 0) return card;
3304
+ return {
3305
+ ...card,
3306
+ ...callView === void 0 ? {} : { callView },
3307
+ ...resultView === void 0 ? {} : { resultView }
3308
+ };
3309
+ }
3310
+ function parseSubagentArguments(argumentsJson) {
3311
+ if (argumentsJson === "" || argumentsJson === "{}") return void 0;
3312
+ try {
3313
+ const parsed = JSON.parse(argumentsJson);
3314
+ if (parsed !== null && typeof parsed === "object") {
3315
+ const obj = parsed;
3316
+ const description = typeof obj.description === "string" && obj.description !== "" ? obj.description : void 0;
3317
+ const prompt = typeof obj.prompt === "string" && obj.prompt !== "" ? obj.prompt : void 0;
3318
+ const model = typeof obj.model === "string" && obj.model !== "" ? obj.model : void 0;
3319
+ const runInBackground = typeof obj.run_in_background === "boolean" ? obj.run_in_background : void 0;
3320
+ if (description !== void 0 || prompt !== void 0 || model !== void 0) {
3321
+ return { description, prompt, model, runInBackground };
3322
+ }
3323
+ }
3324
+ } catch {
3325
+ }
3326
+ return void 0;
3327
+ }
3328
+ function collapsedCardSummary(argumentsJson) {
3329
+ if (argumentsJson === "") return void 0;
3330
+ let command;
3331
+ try {
3332
+ const parsed = JSON.parse(argumentsJson);
3333
+ if (parsed !== null && typeof parsed === "object") {
3334
+ const obj = parsed;
3335
+ if (typeof obj.command === "string" && obj.command !== "") {
3336
+ command = obj.command;
3337
+ } else if (typeof obj.description === "string" && obj.description !== "") {
3338
+ command = obj.description;
3339
+ } else if (typeof obj.prompt === "string" && obj.prompt !== "") {
3340
+ command = obj.prompt;
3341
+ } else if (typeof obj.query === "string" && obj.query !== "") {
3342
+ command = obj.query;
3343
+ } else if (typeof obj.task === "string" && obj.task !== "") {
3344
+ command = obj.task;
3345
+ }
3346
+ }
3347
+ } catch {
3348
+ }
3349
+ return escapeContent(command ?? argumentsJson).replace(/\n/g, " ");
3350
+ }
3351
+ function truncateDisplay(text, maxCols) {
3352
+ if (maxCols <= 0) return "";
3353
+ if (displayWidth(text) <= maxCols) return text;
3354
+ if (maxCols === 1) return "\u2026";
3355
+ return `${wcwidthSafeSlice(text, maxCols - 1)}\u2026`;
3356
+ }
3357
+ var FILE_PATH_KEYS = ["path", "file_path", "file", "target_file", "target"];
3358
+ function fileUrlFromToolArguments(argumentsJson) {
3359
+ try {
3360
+ const parsed = JSON.parse(argumentsJson);
3361
+ if (parsed === null || typeof parsed !== "object") return void 0;
3362
+ const record = parsed;
3363
+ for (const key of FILE_PATH_KEYS) {
3364
+ const value = record[key];
3365
+ if (typeof value !== "string" || !isAbsolute(value)) continue;
3366
+ if (/[\u0000-\u001f\u007f]/.test(value)) continue;
3367
+ return pathToFileURL(value).href;
3368
+ }
3369
+ } catch {
3370
+ }
3371
+ return void 0;
3372
+ }
3373
+ function tokenizeCommandHeading(heading) {
3374
+ const trimmed = heading.trimStart();
3375
+ const leading = heading.slice(0, heading.length - trimmed.length);
3376
+ const firstSpace = trimmed.indexOf(" ");
3377
+ const cmd = firstSpace === -1 ? trimmed : trimmed.slice(0, firstSpace);
3378
+ const rest = firstSpace === -1 ? "" : trimmed.slice(firstSpace);
3379
+ const tokens = [];
3380
+ if (leading !== "") tokens.push({ text: leading, token: "fgSoft" });
3381
+ if (cmd !== "") tokens.push({ text: cmd, token: "codeCommand" });
3382
+ if (rest !== "") tokens.push({ text: rest, token: "fgSoft" });
3383
+ return Object.freeze(tokens);
3384
+ }
3385
+
3172
3386
  // tui-render/src/tool-body.ts
3173
3387
  var graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
3174
3388
  function textLines(text, prefix = "") {
@@ -3383,10 +3597,31 @@ function createToolBodyDocument(card, options) {
3383
3597
  }
3384
3598
  }
3385
3599
  break;
3386
- default:
3387
- args();
3600
+ default: {
3601
+ const isSubagent = card.name === "subagent" || card.name.startsWith("subagent_") || card.name === "delegate";
3602
+ const subInfo = isSubagent ? parseSubagentArguments(card.arguments) : void 0;
3603
+ if (subInfo !== void 0) {
3604
+ if (subInfo.description !== void 0) {
3605
+ section(options.locale === "zh-CN" ? "\u4EFB\u52A1\u76EE\u6807" : "Task", textLines(subInfo.description));
3606
+ }
3607
+ if (subInfo.model !== void 0) {
3608
+ section(options.locale === "zh-CN" ? "\u59D4\u6D3E\u6A21\u578B" : "Model", textLines(subInfo.model));
3609
+ }
3610
+ if (card.status === "running") {
3611
+ section(
3612
+ options.locale === "zh-CN" ? "\u8FD0\u884C\u72B6\u6001" : "Status",
3613
+ textLines(options.locale === "zh-CN" ? "\u25CF \u6B63\u5728\u6267\u884C\u5B50\u4EE3\u7406\u4EFB\u52A1..." : "\u25CF Running subagent task...")
3614
+ );
3615
+ }
3616
+ if (subInfo.prompt !== void 0) {
3617
+ section(options.locale === "zh-CN" ? "\u4EFB\u52A1\u6307\u4EE4" : "Prompt", textLines(subInfo.prompt));
3618
+ }
3619
+ } else {
3620
+ args();
3621
+ }
3388
3622
  if (card.resultText !== void 0) section(tuiCopy("result", options.locale), textLines(card.resultText));
3389
3623
  break;
3624
+ }
3390
3625
  }
3391
3626
  if (result === void 0 && kind !== "generic" && card.resultText !== void 0) {
3392
3627
  section(tuiCopy("result", options.locale), textLines(card.resultText));
@@ -3441,191 +3676,6 @@ function toolCardOriginalText(card, options) {
3441
3676
  `;
3442
3677
  }
3443
3678
 
3444
- // tui-render/src/tool-cards.ts
3445
- import { isAbsolute } from "node:path";
3446
- import { pathToFileURL } from "node:url";
3447
- function toolCardDisplayStatus(card) {
3448
- const terminal = card.resultView?.card === "terminal" ? card.resultView : void 0;
3449
- if (terminal?.signal !== void 0) return "error";
3450
- if (terminal?.exitCode !== void 0 && terminal.exitCode !== 0) return "error";
3451
- return card.status;
3452
- }
3453
- function collapsedResultTail(text) {
3454
- if (text === void 0) return void 0;
3455
- const line5 = text.split(/\r?\n/u).map((item) => item.trim()).filter(Boolean).at(-1);
3456
- return line5 === void 0 ? void 0 : escapeContent(line5);
3457
- }
3458
- function collapsedFailureSummary(card) {
3459
- const terminal = card.resultView?.card === "terminal" ? card.resultView : void 0;
3460
- const identity = terminal?.exitCode !== void 0 ? `exitCode ${String(terminal.exitCode)}` : terminal?.signal !== void 0 ? `signal ${terminal.signal}` : card.error?.code;
3461
- const detail = collapsedResultTail(terminal?.output ?? card.resultText);
3462
- if (identity === void 0) return detail;
3463
- return detail === void 0 || detail === identity ? identity : `${identity} \xB7 ${detail}`;
3464
- }
3465
- function collapsedToolCardSummary(card) {
3466
- if (toolCardDisplayStatus(card) === "error") {
3467
- const failure = collapsedFailureSummary(card);
3468
- if (failure !== void 0) return failure;
3469
- }
3470
- const result = card.resultView;
3471
- const kind = result?.card ?? card.callView?.card ?? "generic";
3472
- switch (kind) {
3473
- case "terminal":
3474
- if (result?.card === "terminal" && result.exitCode !== void 0) {
3475
- return `exitCode ${String(result.exitCode)}`;
3476
- }
3477
- if (result?.card === "terminal" && result.signal !== void 0) {
3478
- return `signal ${result.signal}`;
3479
- }
3480
- if (result?.card === "terminal" && result.output !== void 0 && result.output !== "") {
3481
- return escapeContent(result.output.replace(/\n/g, " "));
3482
- }
3483
- return card.callView?.card === "terminal" && card.callView.cwd !== void 0 ? escapeContent(card.callView.cwd) : void 0;
3484
- case "diff": {
3485
- const paths = card.callView?.card === "diff" ? card.callView.locations ?? card.callView.diffs.map((diff) => ({ path: diff.path })) : result.diffs.map((diff) => ({ path: diff.path }));
3486
- return paths.length === 0 ? void 0 : escapeContent(paths.map((entry) => entry.path).join(" \xB7 "));
3487
- }
3488
- case "search":
3489
- return result?.card === "search" ? `${String(result.total)} matches` : void 0;
3490
- case "read":
3491
- return result?.card === "read" ? escapeContent(result.path) : void 0;
3492
- case "web":
3493
- if (result?.card !== "web") return void 0;
3494
- if (result.kind === "fetch") {
3495
- return escapeContent(`${result.url} \xB7 ${String(result.statusCode)}`);
3496
- }
3497
- if (result.sources.length === 0) return void 0;
3498
- return escapeContent(result.sources.length === 1 ? result.sources[0]?.title ?? result.sources[0]?.url : `${String(result.sources.length)} sources`);
3499
- default:
3500
- return card.callView === void 0 ? collapsedCardSummary(card.arguments) : void 0;
3501
- }
3502
- }
3503
- function cardsFrom(content) {
3504
- const pending = /* @__PURE__ */ new Map();
3505
- const ordered = [];
3506
- for (const item of content) {
3507
- if (item.kind === "tool-call") {
3508
- const card2 = {
3509
- callId: item.callId,
3510
- name: item.name,
3511
- arguments: item.arguments,
3512
- status: "running"
3513
- };
3514
- pending.set(item.callId, card2);
3515
- ordered.push(card2);
3516
- continue;
3517
- }
3518
- if (item.kind !== "tool-result") continue;
3519
- const card = pending.get(item.callId);
3520
- if (card === void 0) continue;
3521
- card.status = item.isError ? "error" : "ok";
3522
- card.resultText = item.text;
3523
- if (item.meta !== void 0) card.meta = item.meta;
3524
- if (item.error !== void 0) card.error = item.error;
3525
- }
3526
- return ordered;
3527
- }
3528
- function cardsFromActiveTurn(toolCalls, content = []) {
3529
- const calls = toolCalls.map((call) => ({
3530
- kind: "tool-call",
3531
- callId: call.callId,
3532
- name: call.name,
3533
- arguments: call.arguments
3534
- }));
3535
- const results = content.filter(
3536
- (item) => item.kind === "tool-result"
3537
- );
3538
- return cardsFrom([...calls, ...results]);
3539
- }
3540
- function cardsFromTurn(turn) {
3541
- return cardsFromActiveTurn(turn.toolCalls, turn.content ?? []);
3542
- }
3543
- function attachPresenterViews(tools, card) {
3544
- if (tools === void 0) return card;
3545
- let args;
3546
- try {
3547
- args = JSON.parse(card.arguments);
3548
- } catch {
3549
- return card;
3550
- }
3551
- const def = tools.get(card.name);
3552
- if (def === void 0) return card;
3553
- let callView;
3554
- try {
3555
- const view = def.presentCall?.(args);
3556
- if (view !== void 0 && typeof view.title === "string" && view.title !== "") {
3557
- callView = view;
3558
- }
3559
- } catch {
3560
- }
3561
- let resultView;
3562
- if (card.status !== "running") {
3563
- try {
3564
- const view = def.presentResult?.(args, {
3565
- content: [{ type: "text", text: card.resultText ?? "" }],
3566
- isError: card.status === "error",
3567
- ...card.meta === void 0 ? {} : { meta: card.meta }
3568
- });
3569
- if (view !== void 0) {
3570
- resultView = view;
3571
- }
3572
- } catch {
3573
- }
3574
- }
3575
- if (callView === void 0 && resultView === void 0) return card;
3576
- return {
3577
- ...card,
3578
- ...callView === void 0 ? {} : { callView },
3579
- ...resultView === void 0 ? {} : { resultView }
3580
- };
3581
- }
3582
- function collapsedCardSummary(argumentsJson) {
3583
- if (argumentsJson === "") return void 0;
3584
- let command;
3585
- try {
3586
- const parsed = JSON.parse(argumentsJson);
3587
- if (parsed !== null && typeof parsed === "object" && "command" in parsed && typeof parsed.command === "string") {
3588
- command = parsed.command;
3589
- }
3590
- } catch {
3591
- }
3592
- return escapeContent(command ?? argumentsJson).replace(/\n/g, " ");
3593
- }
3594
- function truncateDisplay(text, maxCols) {
3595
- if (maxCols <= 0) return "";
3596
- if (displayWidth(text) <= maxCols) return text;
3597
- if (maxCols === 1) return "\u2026";
3598
- return `${wcwidthSafeSlice(text, maxCols - 1)}\u2026`;
3599
- }
3600
- var FILE_PATH_KEYS = ["path", "file_path", "file", "target_file", "target"];
3601
- function fileUrlFromToolArguments(argumentsJson) {
3602
- try {
3603
- const parsed = JSON.parse(argumentsJson);
3604
- if (parsed === null || typeof parsed !== "object") return void 0;
3605
- const record = parsed;
3606
- for (const key of FILE_PATH_KEYS) {
3607
- const value = record[key];
3608
- if (typeof value !== "string" || !isAbsolute(value)) continue;
3609
- if (/[\u0000-\u001f\u007f]/.test(value)) continue;
3610
- return pathToFileURL(value).href;
3611
- }
3612
- } catch {
3613
- }
3614
- return void 0;
3615
- }
3616
- function tokenizeCommandHeading(heading) {
3617
- const trimmed = heading.trimStart();
3618
- const leading = heading.slice(0, heading.length - trimmed.length);
3619
- const firstSpace = trimmed.indexOf(" ");
3620
- const cmd = firstSpace === -1 ? trimmed : trimmed.slice(0, firstSpace);
3621
- const rest = firstSpace === -1 ? "" : trimmed.slice(firstSpace);
3622
- const tokens = [];
3623
- if (leading !== "") tokens.push({ text: leading, token: "fgSoft" });
3624
- if (cmd !== "") tokens.push({ text: cmd, token: "codeCommand" });
3625
- if (rest !== "") tokens.push({ text: rest, token: "fgSoft" });
3626
- return Object.freeze(tokens);
3627
- }
3628
-
3629
3679
  // tui-render/src/tool-rows.ts
3630
3680
  var graphemes2 = new Intl.Segmenter(void 0, { granularity: "grapheme" });
3631
3681
  function truncateMiddleDisplay(text, maxCols, leadingShare = 0.5) {
@@ -3668,8 +3718,48 @@ function toolRow(parts, index, width, background) {
3668
3718
  }
3669
3719
  function toolHeadingRow(card, width, expanded, locale) {
3670
3720
  const status = toolCardDisplayStatus(card);
3671
- const label = status === "ok" ? "\u2713" : tuiCopy(status === "error" ? "failed" : "running", locale);
3672
3721
  const glyph = expanded ? "\u25BE" : "\u25B8";
3722
+ const isSubagent = card.name === "subagent" || card.name.startsWith("subagent_") || card.name === "delegate";
3723
+ const subagentInfo = isSubagent ? parseSubagentArguments(card.arguments) : void 0;
3724
+ if (isSubagent) {
3725
+ const statusLabel = status === "ok" ? locale === "zh-CN" ? "\u2713 \u5DF2\u5B8C\u6210" : "\u2713 completed" : status === "error" ? locale === "zh-CN" ? "\u2717 \u5931\u8D25" : "\u2717 failed" : locale === "zh-CN" ? "\u25CF \u8FD0\u884C\u4E2D" : "\u25CF running";
3726
+ const statusToken2 = status === "error" ? "error" : status === "running" ? "accentText" : "success";
3727
+ const glyphToken = status === "running" ? "accentText" : "fgDim";
3728
+ const tag = locale === "zh-CN" ? "[\u5B50\u4EE3\u7406] " : "[Subagent] ";
3729
+ if (width < displayWidth(`${glyph} \u2026 \xB7 ${statusLabel}`)) {
3730
+ return toolRow([{ text: truncateDisplay(`${glyph} ${statusLabel}`, width), token: statusToken2 }], 0, width, "toolBg");
3731
+ }
3732
+ const headingText = subagentInfo?.description !== void 0 && subagentInfo.description !== "" ? subagentInfo.description : card.resultView?.title ?? card.callView?.title ?? card.name;
3733
+ const heading2 = escapeContent(headingText).replace(/[\n\t]/gu, " ");
3734
+ const prefixBudget = displayWidth(`${glyph} ${tag} \xB7 ${statusLabel}`);
3735
+ const fitted2 = truncateMiddleDisplay(heading2, Math.max(1, width - prefixBudget), 0.6);
3736
+ const parts2 = [
3737
+ { text: `${glyph} `, token: glyphToken },
3738
+ { text: tag, token: "codeKeyword" },
3739
+ { text: `${fitted2} \xB7 `, token: "fg" },
3740
+ { text: statusLabel, token: statusToken2 }
3741
+ ];
3742
+ if (subagentInfo?.model !== void 0) {
3743
+ parts2.push({ text: ` [${subagentInfo.model}]`, token: "markdownCode" });
3744
+ }
3745
+ let summary2;
3746
+ if (status === "error") {
3747
+ summary2 = collapsedToolCardSummary(card);
3748
+ } else if (!expanded) {
3749
+ if (subagentInfo?.prompt !== void 0 && subagentInfo.prompt !== "") {
3750
+ summary2 = escapeContent(subagentInfo.prompt).replace(/\n/g, " ");
3751
+ } else {
3752
+ summary2 = collapsedToolCardSummary(card);
3753
+ }
3754
+ }
3755
+ const available2 = width - parts2.reduce((sum, part) => sum + displayWidth(part.text), 0) - 1;
3756
+ const href2 = fileUrlFromToolArguments(card.arguments);
3757
+ if (summary2 !== void 0 && available2 >= 2) {
3758
+ parts2.push({ text: ` ${truncateDisplay(summary2, available2)}`, token: "fgSoft", ...href2 === void 0 ? {} : { href: href2 } });
3759
+ }
3760
+ return toolRow(parts2, 0, width, "toolBg");
3761
+ }
3762
+ const label = status === "ok" ? "\u2713" : tuiCopy(status === "error" ? "failed" : "running", locale);
3673
3763
  if (width < displayWidth(`${glyph} \u2026 \xB7 ${label}`)) return toolRow([{ text: truncateDisplay(`${glyph} ${label}`, width), token: status === "error" ? "error" : "fgDim" }], 0, width, "toolBg");
3674
3764
  const heading = escapeContent(card.resultView?.title ?? card.callView?.title ?? card.name).replace(/[\n\t]/gu, " ");
3675
3765
  const terminal = card.callView?.card === "terminal" || card.resultView?.card === "terminal";
@@ -3741,6 +3831,9 @@ function toolBodyRenderRow(line5, index, width) {
3741
3831
  if (diffKind !== void 0) {
3742
3832
  return toolRow(formatDiffParts(line5.text, diffKind), index, width, bg);
3743
3833
  }
3834
+ if (line5.text.includes("\u25CF \u6B63\u5728\u6267\u884C") || line5.text.includes("\u25CF Running")) {
3835
+ return toolRow([{ text: ` ${line5.text}`, token: "accentText" }], index, width, bg);
3836
+ }
3744
3837
  return toolRow([{ text: ` ${line5.text}`, token: line5.token === "codeBg" ? "fgSoft" : "fgDim" }], index, width, bg);
3745
3838
  }
3746
3839
  function toolRemainingRow(remaining, width, index, locale) {
@@ -13838,6 +13931,7 @@ export {
13838
13931
  notifyBytes,
13839
13932
  paintBackgroundRow,
13840
13933
  paintRow,
13934
+ parseSubagentArguments,
13841
13935
  physicalLineIdentity,
13842
13936
  physicalScrollRailGeometry,
13843
13937
  planToolBodyWindow,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crazyhappyone/dsh-tui",
3
- "version": "0.1.0-alpha.27",
3
+ "version": "0.1.0-alpha.28",
4
4
  "description": "Source-runtime launcher for the DeepSeek Harness terminal interface",
5
5
  "type": "module",
6
6
  "license": "MIT",