@staff0rd/assist 0.1150.0 → 0.1153.0

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 (101) hide show
  1. package/dist/.build-files +93 -93
  2. package/dist/{addActivity-FAJXPOZ4.js → addActivity-ZAQI4Q2G.js} +2 -2
  3. package/dist/{addPhase-QNJFCF4I.js → addPhase-7DVJ3KPA.js} +4 -4
  4. package/dist/{advise-5FZ6EQKW.js → advise-S3NVHTGZ.js} +3 -3
  5. package/dist/{ask-GXMVORX7.js → ask-ZZRX33YD.js} +2 -2
  6. package/dist/{askCheck-XUWBC3AC.js → askCheck-FTETNBJC.js} +8 -8
  7. package/dist/{askDesign-MSFOLBXG.js → askDesign-RCFPITLS.js} +3 -3
  8. package/dist/{askQuestion-MRI2ATSI.js → askQuestion-A653WELI.js} +1 -1
  9. package/dist/{branch-YN5MMZZZ.js → branch-SGFO3GZL.js} +3 -3
  10. package/dist/built-version +1 -1
  11. package/dist/{chunk-4ALZHLCO.js → chunk-2EBTDB27.js} +1 -1
  12. package/dist/{chunk-O7CF3E3N.js → chunk-36JBIJIM.js} +1 -1
  13. package/dist/{chunk-NDHXVSWO.js → chunk-3JJCNAGV.js} +312 -55
  14. package/dist/{chunk-HMRDPP46.js → chunk-4ACH2U5V.js} +1 -1
  15. package/dist/{chunk-6IGWBZ2R.js → chunk-4JZX7ILW.js} +49 -19
  16. package/dist/{chunk-GLEMD7P2.js → chunk-53HUKZXM.js} +1 -1
  17. package/dist/{chunk-WYJHBRSG.js → chunk-5ZEMQDY7.js} +2 -2
  18. package/dist/{chunk-Y4HYJDWR.js → chunk-6CQJKXAU.js} +3 -3
  19. package/dist/{chunk-IAS2D4WB.js → chunk-6DWFNXQR.js} +1 -1
  20. package/dist/{chunk-TGVUTAW4.js → chunk-7NH7CRHK.js} +4 -4
  21. package/dist/{chunk-CBHNIZFO.js → chunk-AKUIS624.js} +1 -1
  22. package/dist/{chunk-KV5L2IIA.js → chunk-BCJBPK3T.js} +6 -6
  23. package/dist/{chunk-SRDWYOJQ.js → chunk-BGE4GGTY.js} +1 -1
  24. package/dist/{chunk-EMNFCQKE.js → chunk-BWDXE5EC.js} +1 -1
  25. package/dist/{chunk-ZH7FLZPU.js → chunk-CJUZTNRQ.js} +1 -1
  26. package/dist/{chunk-YUVOTSA7.js → chunk-DPVBL2R7.js} +1 -1
  27. package/dist/{chunk-CJLBH3DN.js → chunk-DYGEMDS7.js} +1 -1
  28. package/dist/{chunk-77PMACIC.js → chunk-E47WLY5F.js} +2 -2
  29. package/dist/{chunk-F6EI2W6X.js → chunk-E53ZRNYD.js} +1 -1
  30. package/dist/{chunk-J4SWOWUT.js → chunk-ETHAWXUL.js} +1 -1
  31. package/dist/{chunk-RYHNVMY6.js → chunk-G3DXEE26.js} +1 -1
  32. package/dist/{chunk-H3UM6QRY.js → chunk-GOQK3KCL.js} +1 -1
  33. package/dist/{chunk-7Z3XNY5F.js → chunk-HL2HUE6U.js} +1 -1
  34. package/dist/{chunk-UKLCNYPF.js → chunk-KHIFO4T4.js} +1 -1
  35. package/dist/{chunk-DIQAEGJ5.js → chunk-KI7RHWH5.js} +15 -2
  36. package/dist/{chunk-MXGPUIL3.js → chunk-LKWECRYV.js} +2 -2
  37. package/dist/{chunk-Q3R6WLAI.js → chunk-MVLBCV3S.js} +1 -1
  38. package/dist/{chunk-XEXXLIGF.js → chunk-NAG3JU5H.js} +2 -2
  39. package/dist/{chunk-RUVMUOMX.js → chunk-NIVWISHG.js} +1 -1
  40. package/dist/{chunk-WEAZDCXB.js → chunk-NOOTKBS6.js} +1 -1
  41. package/dist/{chunk-AZBZH2MC.js → chunk-RAONMLZZ.js} +1 -1
  42. package/dist/{chunk-5KXFB5TL.js → chunk-RBWY5HC3.js} +1 -1
  43. package/dist/{chunk-K5AQPUDE.js → chunk-RK2RBWSI.js} +1 -1
  44. package/dist/{chunk-WQDDXI3P.js → chunk-SL5XEODQ.js} +1 -1
  45. package/dist/{chunk-YMYZBSS6.js → chunk-TECUUDTX.js} +1 -1
  46. package/dist/{chunk-KY6ZIBKH.js → chunk-UHHUPKXF.js} +1 -1
  47. package/dist/{chunk-I3TRD3TY.js → chunk-VKPP3JM7.js} +1 -1
  48. package/dist/{chunk-3RPWEZV4.js → chunk-VWO3F27D.js} +1 -1
  49. package/dist/{chunk-XSSOA4XV.js → chunk-WJCFZMFD.js} +1 -1
  50. package/dist/{chunk-Q27DNI5T.js → chunk-XZA2RLRL.js} +1 -1
  51. package/dist/{cliHook-H6ZSCG5B.js → cliHook-7F37NUA6.js} +5 -5
  52. package/dist/{cliHookCheck-NSMNW2QP.js → cliHookCheck-W6IF46CG.js} +2 -2
  53. package/dist/{codexHook-QSDA2ERO.js → codexHook-RRSLTOB6.js} +7 -7
  54. package/dist/commands/extension/extension/content.js +1 -1
  55. package/dist/commands/extension/extension/docs.js +18 -18
  56. package/dist/commands/extension/extension/updates.json +2 -2
  57. package/dist/commands/sessions/web/bundle.js +430 -430
  58. package/dist/{comment-NXF5C634.js → comment-CADYMIUH.js} +3 -3
  59. package/dist/{commentIssue-SZAB7TJQ.js → commentIssue-2VMPDQ74.js} +2 -2
  60. package/dist/{commit-4BXR2BKT.js → commit-HPITCLAY.js} +3 -3
  61. package/dist/{createIssue-FQQNJIWA.js → createIssue-J6QLUACO.js} +1 -1
  62. package/dist/{doctorNodes-SOE4FK2J.js → doctorNodes-WRNF5CFM.js} +3 -3
  63. package/dist/{done-ICXQHCNX.js → done-GMI65QNI.js} +4 -4
  64. package/dist/{edit-MRTB2VJQ.js → edit-XOU2IWSF.js} +1 -1
  65. package/dist/{editHook-45YKZZW7.js → editHook-5K5ETQOW.js} +5 -5
  66. package/dist/{editIssue-WICT2PNQ.js → editIssue-6I3BU4YO.js} +1 -1
  67. package/dist/{editIssueComment-OJZXFL5P.js → editIssueComment-OLT3MQDH.js} +2 -2
  68. package/dist/{fixConflict-7PTOATRG.js → fixConflict-LHAJTXKM.js} +2 -2
  69. package/dist/index.js +60 -60
  70. package/dist/{launchMode-63SE2LFL.js → launchMode-ZFTMKGEM.js} +13 -13
  71. package/dist/{list-SQVHXDIV.js → list-IUBZMQXV.js} +5 -5
  72. package/dist/{next-SOB4NPFS.js → next-5PV5AMBB.js} +12 -12
  73. package/dist/{piHook-Z75KKYZF.js → piHook-O3YAI3FX.js} +5 -5
  74. package/dist/{postSlackMessage-EOGHWXM5.js → postSlackMessage-IPJ2HPKC.js} +2 -2
  75. package/dist/{propose-6QAGKBFG.js → propose-UTSUAXOT.js} +5 -5
  76. package/dist/{raise-UADRWTZE.js → raise-AWHJN5PS.js} +1 -1
  77. package/dist/{refine-4GHYIF7R.js → refine-N6ZYVQDA.js} +14 -14
  78. package/dist/{reply-UTOBFFKP.js → reply-QXSMUPXO.js} +2 -2
  79. package/dist/{restartNode-HJTZIR6I.js → restartNode-C67ALX5G.js} +5 -5
  80. package/dist/{review-HIQXRL7U.js → review-BE44DKMH.js} +5 -5
  81. package/dist/{reviewPrComments-ZDNFSQIW.js → reviewPrComments-JZRJM7UL.js} +2 -2
  82. package/dist/{rewindPhase-7CXZMWRY.js → rewindPhase-7P3LNIEI.js} +8 -8
  83. package/dist/{run-WYJM7OH5.js → run-2GLAZKVZ.js} +10 -10
  84. package/dist/{run-HHISACD5.js → run-7X5GDF6S.js} +10 -10
  85. package/dist/{runDaemon-ARFA66LK.js → runDaemon-2BANX73X.js} +65 -26
  86. package/dist/{runExtract-CTLWMXRG.js → runExtract-HCHT2Z6A.js} +1 -1
  87. package/dist/{runRefine-C5EGJWP3.js → runRefine-BD44BNNA.js} +14 -14
  88. package/dist/{scan-SP5UQPWP.js → scan-GBLWINSJ.js} +2 -2
  89. package/dist/{schemaConfirm-LRWRIDFO.js → schemaConfirm-GHGHWXHO.js} +2 -2
  90. package/dist/{schemaUnlock-O3ENCUT6.js → schemaUnlock-NPEF3X5C.js} +2 -2
  91. package/dist/{search-FGBAR6ZI.js → search-VXRSTLP3.js} +5 -5
  92. package/dist/{show-P3OACYLT.js → show-63A3REOB.js} +3 -3
  93. package/dist/{show-YEME2NJH.js → show-6LOJV5VT.js} +3 -3
  94. package/dist/{signExtension-W26BMN5K.js → signExtension-NZEI4HQM.js} +1 -1
  95. package/dist/{slack-HQPEBAAX.js → slack-4ZPQ5C5L.js} +2 -2
  96. package/dist/{updateNode-KQQYUC5P.js → updateNode-NM32XF5V.js} +5 -5
  97. package/dist/{updatePlan-MQTC6WRG.js → updatePlan-5W7AAL7O.js} +5 -5
  98. package/dist/{web-P6JFUPFH.js → web-MS5XZ3RK.js} +16 -16
  99. package/dist/{web-WHMDGQN4.js → web-Z4I2R7IB.js} +16 -16
  100. package/dist/{wontfix-FIYGOSWH.js → wontfix-PHYW2KQ7.js} +2 -2
  101. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  printApprovedComments
3
- } from "./chunk-CJLBH3DN.js";
3
+ } from "./chunk-DYGEMDS7.js";
4
4
  import {
5
5
  isLiveDaemonSession
6
6
  } from "./chunk-C5U44UI7.js";
7
7
  import {
8
8
  awaitPreviewApproval
9
- } from "./chunk-DIQAEGJ5.js";
9
+ } from "./chunk-KI7RHWH5.js";
10
10
  import "./chunk-BAHQJHYD.js";
11
11
  import {
12
12
  readBodyArgument
@@ -21,7 +21,7 @@ import {
21
21
  import "./chunk-OGJ6AZK4.js";
22
22
  import {
23
23
  harnessAdapter
24
- } from "./chunk-NDHXVSWO.js";
24
+ } from "./chunk-3JJCNAGV.js";
25
25
  import "./chunk-MRUIXQXS.js";
26
26
  import "./chunk-HO7RNI6V.js";
27
27
  import "./chunk-DIAC4XYA.js";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-C5U44UI7.js";
7
7
  import {
8
8
  awaitPreviewApproval
9
- } from "./chunk-DIQAEGJ5.js";
9
+ } from "./chunk-KI7RHWH5.js";
10
10
  import "./chunk-BAHQJHYD.js";
11
11
  import "./chunk-54QTHCXV.js";
12
12
  import "./chunk-OFLEIPAR.js";
@@ -2,8 +2,8 @@ import {
2
2
  createBranch,
3
3
  generateBranchSlug,
4
4
  isConciseSlug
5
- } from "./chunk-IAS2D4WB.js";
6
- import "./chunk-WEAZDCXB.js";
5
+ } from "./chunk-6DWFNXQR.js";
6
+ import "./chunk-NOOTKBS6.js";
7
7
  import "./chunk-OZNYQOQK.js";
8
8
  import "./chunk-ORSRBZ2X.js";
9
9
  import "./chunk-PCF66ALO.js";
@@ -18,7 +18,7 @@ import "./chunk-LMUTL44M.js";
18
18
  import "./chunk-6NDXAN45.js";
19
19
  import "./chunk-MELBVXKL.js";
20
20
  import "./chunk-OGJ6AZK4.js";
21
- import "./chunk-NDHXVSWO.js";
21
+ import "./chunk-3JJCNAGV.js";
22
22
  import "./chunk-MRUIXQXS.js";
23
23
  import "./chunk-HO7RNI6V.js";
24
24
  import "./chunk-DIAC4XYA.js";
@@ -1 +1 @@
1
- 0.1150.0
1
+ 0.1153.0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  REVIEW_PHASE_NAME
3
- } from "./chunk-UKLCNYPF.js";
3
+ } from "./chunk-KHIFO4T4.js";
4
4
 
5
5
  // src/commands/backlog/buildReviewPhase.ts
6
6
  function buildReviewPhase() {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-OGJ6AZK4.js";
4
4
  import {
5
5
  harnessAdapter
6
- } from "./chunk-NDHXVSWO.js";
6
+ } from "./chunk-3JJCNAGV.js";
7
7
 
8
8
  // src/commands/sessions/shared/conversationOf.ts
9
9
  function lookupConversation(session) {
@@ -3410,7 +3410,8 @@ function sdkSessionHandle(label) {
3410
3410
  const handle = {
3411
3411
  onEvent: (listener) => listeners.push(listener),
3412
3412
  send: (text) => turn ? turn.send(text) : unbound("message"),
3413
- interrupt: () => turn ? turn.interrupt() : unbound("interrupt")
3413
+ interrupt: () => turn ? turn.interrupt() : unbound("interrupt"),
3414
+ stopTask: (taskId) => turn ? turn.stopTask(taskId) : Promise.reject(new Error("query not started"))
3414
3415
  };
3415
3416
  return {
3416
3417
  handle,
@@ -3528,15 +3529,294 @@ function createSdkMessageQueue(label, control, push) {
3528
3529
  };
3529
3530
  }
3530
3531
 
3532
+ // src/commands/sessions/daemon/sdk/procSampler/dedupeProcessEmit.ts
3533
+ function dedupeProcessEmit(emit) {
3534
+ let published;
3535
+ return (info) => {
3536
+ const key = info ? JSON.stringify(info) : void 0;
3537
+ if (key === published) return;
3538
+ published = key;
3539
+ emit(info);
3540
+ };
3541
+ }
3542
+
3543
+ // src/commands/sessions/daemon/sdk/procSampler/readUptimeTicks.ts
3544
+ import { readFile } from "fs/promises";
3545
+ import { join as join15 } from "path";
3546
+ var CLOCK_TICKS_PER_SECOND = 100;
3547
+ async function readUptimeTicks(procRoot) {
3548
+ try {
3549
+ const text = await readFile(join15(procRoot, "uptime"), "utf8");
3550
+ return Math.floor(Number.parseFloat(text) * CLOCK_TICKS_PER_SECOND);
3551
+ } catch {
3552
+ return void 0;
3553
+ }
3554
+ }
3555
+
3556
+ // src/commands/sessions/daemon/sdk/procSampler/sampleLeafProcess.ts
3557
+ import { readdir, readFile as readFile3 } from "fs/promises";
3558
+ import { join as join17 } from "path";
3559
+
3560
+ // src/commands/sessions/daemon/sdk/procSampler/findLeafProcess.ts
3561
+ function outranks(stat, depth, best) {
3562
+ if (depth !== best.depth) return depth > best.depth;
3563
+ if (stat.startTicks !== best.stat.startTicks)
3564
+ return stat.startTicks > best.stat.startTicks;
3565
+ return stat.pid < best.stat.pid;
3566
+ }
3567
+ function findLeafProcess(stats, rootPid, minStartTicks) {
3568
+ const children = /* @__PURE__ */ new Map();
3569
+ for (const stat of stats) {
3570
+ const siblings = children.get(stat.ppid) ?? [];
3571
+ siblings.push(stat);
3572
+ children.set(stat.ppid, siblings);
3573
+ }
3574
+ let best;
3575
+ const walk = (pid, depth) => {
3576
+ for (const child of children.get(pid) ?? []) {
3577
+ if (child.state === "Z") continue;
3578
+ if (child.startTicks >= minStartTicks && (!best || outranks(child, depth, best)))
3579
+ best = { stat: child, depth };
3580
+ walk(child.pid, depth + 1);
3581
+ }
3582
+ };
3583
+ walk(rootPid, 1);
3584
+ return best?.stat;
3585
+ }
3586
+
3587
+ // src/commands/sessions/daemon/sdk/procSampler/readProcStat.ts
3588
+ import { readFile as readFile2 } from "fs/promises";
3589
+ import { join as join16 } from "path";
3590
+ async function readProcStat(procRoot, pid) {
3591
+ try {
3592
+ const text = await readFile2(join16(procRoot, String(pid), "stat"), "utf8");
3593
+ const fields = text.slice(text.lastIndexOf(")") + 2).split(" ");
3594
+ return {
3595
+ pid,
3596
+ state: fields[0],
3597
+ ppid: Number(fields[1]),
3598
+ cpuTicks: Number(fields[11]) + Number(fields[12]),
3599
+ startTicks: Number(fields[19])
3600
+ };
3601
+ } catch {
3602
+ return void 0;
3603
+ }
3604
+ }
3605
+
3606
+ // src/commands/sessions/daemon/sdk/procSampler/trimProcessCommand.ts
3607
+ import { basename as basename5 } from "path";
3608
+ var MAX_LENGTH2 = 60;
3609
+ var INTERPRETERS = /* @__PURE__ */ new Set([
3610
+ "node",
3611
+ "python",
3612
+ "python3",
3613
+ "bash",
3614
+ "sh",
3615
+ "bun",
3616
+ "deno"
3617
+ ]);
3618
+ function trimProcessCommand(argv) {
3619
+ const args = argv.filter(Boolean);
3620
+ if (args.length === 0) return "";
3621
+ const [first, ...rest] = args;
3622
+ const program = basename5(first);
3623
+ const script = rest[0];
3624
+ const words = INTERPRETERS.has(program) && script?.includes("/") && !script.startsWith("-") ? [basename5(script), ...rest.slice(1)] : [program, ...rest];
3625
+ const text = words.join(" ");
3626
+ return text.length > MAX_LENGTH2 ? `${text.slice(0, MAX_LENGTH2 - 1)}\u2026` : text;
3627
+ }
3628
+
3629
+ // src/commands/sessions/daemon/sdk/procSampler/sampleLeafProcess.ts
3630
+ async function readText(path15) {
3631
+ try {
3632
+ return await readFile3(path15, "utf8");
3633
+ } catch {
3634
+ return void 0;
3635
+ }
3636
+ }
3637
+ function ioCounter(io, key) {
3638
+ const match = io?.match(new RegExp(`^${key}: (\\d+)$`, "m"));
3639
+ return match ? Number(match[1]) : void 0;
3640
+ }
3641
+ async function sampleLeafProcess(procRoot, rootPid, minStartTicks) {
3642
+ const entries = await readdir(procRoot).catch(() => []);
3643
+ const stats = await Promise.all(
3644
+ entries.filter((name) => /^\d+$/.test(name)).map((name) => readProcStat(procRoot, Number(name)))
3645
+ );
3646
+ const leaf = findLeafProcess(
3647
+ stats.filter((stat) => stat !== void 0),
3648
+ rootPid,
3649
+ minStartTicks
3650
+ );
3651
+ if (!leaf) return void 0;
3652
+ const dir = join17(procRoot, String(leaf.pid));
3653
+ const [cmdline, io] = await Promise.all([
3654
+ readText(join17(dir, "cmdline")),
3655
+ readText(join17(dir, "io"))
3656
+ ]);
3657
+ const command = trimProcessCommand(cmdline?.split("\0") ?? []);
3658
+ if (!command) return void 0;
3659
+ return {
3660
+ pid: leaf.pid,
3661
+ command,
3662
+ cpuTicks: leaf.cpuTicks,
3663
+ readBytes: ioCounter(io, "rchar"),
3664
+ writeBytes: ioCounter(io, "wchar")
3665
+ };
3666
+ }
3667
+
3668
+ // src/commands/sessions/daemon/sdk/procSampler/startSerialInterval.ts
3669
+ function startSerialInterval(run, intervalMs) {
3670
+ let busy = false;
3671
+ const fire = () => {
3672
+ if (busy) return;
3673
+ busy = true;
3674
+ void run().finally(() => {
3675
+ busy = false;
3676
+ });
3677
+ };
3678
+ const timer = setInterval(fire, intervalMs);
3679
+ fire();
3680
+ return () => clearInterval(timer);
3681
+ }
3682
+
3683
+ // src/commands/sessions/daemon/sdk/procSampler/ioBytesPerSecond.ts
3684
+ function delta(next, prev) {
3685
+ return next === void 0 || prev === void 0 ? void 0 : next - prev;
3686
+ }
3687
+ function ioBytesPerSecond(next, prev, seconds) {
3688
+ if (!prev || prev.pid !== next.pid || seconds <= 0) return void 0;
3689
+ const read = delta(next.readBytes, prev.readBytes);
3690
+ const write = delta(next.writeBytes, prev.writeBytes);
3691
+ if (read === void 0 && write === void 0) return void 0;
3692
+ return Math.round(Math.max(read ?? 0, write ?? 0) / seconds);
3693
+ }
3694
+
3695
+ // src/commands/sessions/daemon/sdk/procSampler/toSdkProcessInfo.ts
3696
+ function toSdkProcessInfo(next, previous) {
3697
+ const ioRate = ioBytesPerSecond(
3698
+ next.sample,
3699
+ previous?.sample,
3700
+ previous ? (next.at - previous.at) / 1e3 : 0
3701
+ );
3702
+ return {
3703
+ command: next.sample.command,
3704
+ ...ioRate === void 0 ? {} : { ioBytesPerSec: ioRate }
3705
+ };
3706
+ }
3707
+
3708
+ // src/commands/sessions/daemon/sdk/procSampler/createSdkProcessWatch.ts
3709
+ var SAMPLE_INTERVAL_MS = 2e3;
3710
+ var START_GRACE_TICKS = 2 * CLOCK_TICKS_PER_SECOND;
3711
+ function createSdkProcessWatch(getPid, emit, {
3712
+ procRoot = "/proc",
3713
+ platform = process.platform,
3714
+ now = Date.now
3715
+ } = {}) {
3716
+ let generation = 0;
3717
+ let stopTimer;
3718
+ let previous;
3719
+ const publish = dedupeProcessEmit(emit);
3720
+ const tick = async (run, pid, since) => {
3721
+ const sample = await sampleLeafProcess(procRoot, pid, since);
3722
+ if (run !== generation) return;
3723
+ const current = sample ? { sample, at: now() } : void 0;
3724
+ publish(current ? toSdkProcessInfo(current, previous) : null);
3725
+ previous = current;
3726
+ };
3727
+ const stop = () => {
3728
+ generation++;
3729
+ stopTimer?.();
3730
+ stopTimer = void 0;
3731
+ previous = void 0;
3732
+ publish(null);
3733
+ };
3734
+ const start = async () => {
3735
+ stop();
3736
+ const pid = getPid();
3737
+ if (platform !== "linux" || !pid) return;
3738
+ const run = generation;
3739
+ const uptime = await readUptimeTicks(procRoot);
3740
+ if (run !== generation || uptime === void 0) return;
3741
+ const since = uptime - START_GRACE_TICKS;
3742
+ stopTimer = startSerialInterval(
3743
+ () => tick(run, pid, since),
3744
+ SAMPLE_INTERVAL_MS
3745
+ );
3746
+ };
3747
+ return { start, stop };
3748
+ }
3749
+
3750
+ // src/commands/sessions/daemon/sdk/activityLine.ts
3751
+ var MAX_LINE = 80;
3752
+ function activityLine(text) {
3753
+ const line = text.trim().split("\n")[0].trim();
3754
+ return line.length > MAX_LINE ? `${line.slice(0, MAX_LINE - 1)}\u2026` : line;
3755
+ }
3756
+
3757
+ // src/commands/sessions/daemon/sdk/commandActivityLine.ts
3758
+ var LEADING_CD = /^cd\s+(?:"[^"]*"|'[^']*'|\S+)\s*(?:;|&&)\s*/;
3759
+ function commandActivityLine(command) {
3760
+ return activityLine(command.trim().replace(LEADING_CD, ""));
3761
+ }
3762
+
3763
+ // src/commands/sessions/daemon/sdk/sdkActivityText.ts
3764
+ var TARGET_KEYS = [
3765
+ "description",
3766
+ "command",
3767
+ "file_path",
3768
+ "notebook_path",
3769
+ "path",
3770
+ "pattern",
3771
+ "url",
3772
+ "query",
3773
+ "skill"
3774
+ ];
3775
+ function toolTarget2(input) {
3776
+ if (!input || typeof input !== "object") return "";
3777
+ const record3 = input;
3778
+ const key = TARGET_KEYS.find((k) => typeof record3[k] === "string");
3779
+ if (!key) return "";
3780
+ const value = record3[key];
3781
+ return key === "command" ? commandActivityLine(value) : activityLine(value);
3782
+ }
3783
+ var SDK_WORKING_ACTIVITY = "Working";
3784
+ function sdkActivityText(content) {
3785
+ const tool = [...content].reverse().find((block) => block.type === "tool_use");
3786
+ if (!tool?.name) return SDK_WORKING_ACTIVITY;
3787
+ const target = toolTarget2(tool.input);
3788
+ return `${SDK_WORKING_ACTIVITY} \xB7 ${tool.name}${target ? ` ${target}` : ""}`;
3789
+ }
3790
+
3531
3791
  // src/commands/sessions/daemon/sdk/createSdkTurnEmitter.ts
3792
+ var ELAPSED_RESYNC_SECONDS = 10;
3532
3793
  function createSdkTurnEmitter(label, control) {
3533
3794
  let status;
3534
3795
  let activity = null;
3796
+ let elapsed = null;
3797
+ const processWatch = createSdkProcessWatch(
3798
+ () => control.process.pid,
3799
+ (process2) => control.emit({ kind: "process", process: process2 })
3800
+ );
3801
+ const setElapsed = (next) => {
3802
+ elapsed = next;
3803
+ control.emit({ kind: "elapsed", seconds: next });
3804
+ };
3535
3805
  return {
3536
3806
  activity: (next) => {
3537
3807
  if (next === activity) return;
3538
3808
  activity = next;
3539
3809
  control.emit({ kind: "activity", text: next });
3810
+ if (elapsed !== null) setElapsed(null);
3811
+ if (next === null || next === SDK_WORKING_ACTIVITY) processWatch.stop();
3812
+ else void processWatch.start();
3813
+ },
3814
+ stopProcessWatch: processWatch.stop,
3815
+ elapsed: (seconds) => {
3816
+ const next = Math.floor(seconds);
3817
+ if (elapsed !== null && next >= elapsed && next - elapsed < ELAPSED_RESYNC_SECONDS)
3818
+ return;
3819
+ setElapsed(next);
3540
3820
  },
3541
3821
  status: (next) => {
3542
3822
  if (next === status) return;
@@ -3568,6 +3848,8 @@ function createSdkTurnTracker(label, control, push) {
3568
3848
  };
3569
3849
  return {
3570
3850
  setActivity: emit.activity,
3851
+ setElapsed: emit.elapsed,
3852
+ stopProcessWatch: emit.stopProcessWatch,
3571
3853
  setStatus,
3572
3854
  start: (prompt) => {
3573
3855
  busy = true;
@@ -3605,19 +3887,6 @@ function resolveClaudeExecutable() {
3605
3887
  return path15;
3606
3888
  }
3607
3889
 
3608
- // src/commands/sessions/daemon/sdk/activityLine.ts
3609
- var MAX_LINE = 80;
3610
- function activityLine(text) {
3611
- const line = text.trim().split("\n")[0].trim();
3612
- return line.length > MAX_LINE ? `${line.slice(0, MAX_LINE - 1)}\u2026` : line;
3613
- }
3614
-
3615
- // src/commands/sessions/daemon/sdk/commandActivityLine.ts
3616
- var LEADING_CD = /^cd\s+(?:"[^"]*"|'[^']*'|\S+)\s*(?:;|&&)\s*/;
3617
- function commandActivityLine(command) {
3618
- return activityLine(command.trim().replace(LEADING_CD, ""));
3619
- }
3620
-
3621
3890
  // src/commands/sessions/daemon/sdk/createSdkBackgroundTasks.ts
3622
3891
  function createSdkBackgroundTasks() {
3623
3892
  const described = /* @__PURE__ */ new Map();
@@ -3758,33 +4027,6 @@ function logSdkMessage(label, message2) {
3758
4027
  daemonLog(`${label} sdk turn ended: ${message2.subtype}`);
3759
4028
  }
3760
4029
 
3761
- // src/commands/sessions/daemon/sdk/sdkActivityText.ts
3762
- var TARGET_KEYS = [
3763
- "description",
3764
- "command",
3765
- "file_path",
3766
- "notebook_path",
3767
- "path",
3768
- "pattern",
3769
- "url",
3770
- "query",
3771
- "skill"
3772
- ];
3773
- function toolTarget2(input) {
3774
- if (!input || typeof input !== "object") return "";
3775
- const record3 = input;
3776
- const key = TARGET_KEYS.find((k) => typeof record3[k] === "string");
3777
- if (!key) return "";
3778
- const value = record3[key];
3779
- return key === "command" ? commandActivityLine(value) : activityLine(value);
3780
- }
3781
- function sdkActivityText(content) {
3782
- const tool = [...content].reverse().find((block) => block.type === "tool_use");
3783
- if (!tool?.name) return "Working";
3784
- const target = toolTarget2(tool.input);
3785
- return `Working \xB7 ${tool.name}${target ? ` ${target}` : ""}`;
3786
- }
3787
-
3788
4030
  // src/commands/sessions/daemon/sdk/sdkTurnStatus.ts
3789
4031
  function sdkTurnStatus(message2) {
3790
4032
  if (message2.type === "assistant" && message2.parent_tool_use_id === null)
@@ -3795,6 +4037,14 @@ function sdkTurnStatus(message2) {
3795
4037
  return void 0;
3796
4038
  }
3797
4039
 
4040
+ // src/commands/sessions/daemon/sdk/trackSdkTurnProgress.ts
4041
+ function trackSdkTurnProgress(message2, turn) {
4042
+ if (message2.type === "assistant" && message2.parent_tool_use_id === null)
4043
+ turn.setActivity(sdkActivityText(message2.message.content));
4044
+ if (message2.type === "tool_progress" && message2.parent_tool_use_id === null)
4045
+ turn.setElapsed(message2.elapsed_time_seconds);
4046
+ }
4047
+
3798
4048
  // src/commands/sessions/daemon/sdk/runSdkQuery.ts
3799
4049
  async function runSdkQuery(messages, sessionId, control, turn) {
3800
4050
  const label = `session ${sessionId ?? "?"}`;
@@ -3811,8 +4061,9 @@ async function runSdkQuery(messages, sessionId, control, turn) {
3811
4061
  if (status) turn.setStatus(status);
3812
4062
  const background = sdkBackgroundTasks(message2);
3813
4063
  if (background) control.emit({ kind: "background", tasks: background });
3814
- if (message2.type === "assistant" && message2.parent_tool_use_id === null)
3815
- turn.setActivity(sdkActivityText(message2.message.content));
4064
+ if (message2.type === "prompt_suggestion")
4065
+ control.emit({ kind: "suggestion", text: message2.suggestion || null });
4066
+ trackSdkTurnProgress(message2, turn);
3816
4067
  }
3817
4068
  daemonLog(`${label} sdk query finished`);
3818
4069
  control.exit(0);
@@ -3826,6 +4077,8 @@ async function runSdkQuery(messages, sessionId, control, turn) {
3826
4077
  `${label} sdk query failed: ${error instanceof Error ? error.message : String(error)}`
3827
4078
  );
3828
4079
  control.exit(1);
4080
+ } finally {
4081
+ turn.stopProcessWatch();
3829
4082
  }
3830
4083
  }
3831
4084
 
@@ -3892,10 +4145,24 @@ function sdkQueryOptions(opts2, executable, abort, control) {
3892
4145
  spawnClaudeCodeProcess: (options) => spawnSdkChild(options, opts2, control.attach),
3893
4146
  abortController: abort,
3894
4147
  model: opts2.model,
4148
+ promptSuggestions: true,
3895
4149
  systemPrompt: { type: "preset", preset: "claude_code", append }
3896
4150
  };
3897
4151
  }
3898
4152
 
4153
+ // src/commands/sessions/daemon/sdk/awaitResume.ts
4154
+ function awaitResume(label, messages, control) {
4155
+ messages.initializationResult().then(
4156
+ () => {
4157
+ daemonLog(`${label} sdk resume complete`);
4158
+ control.emit({ kind: "resumed" });
4159
+ },
4160
+ (error) => daemonLog(
4161
+ `${label} sdk resume did not complete: ${error instanceof Error ? error.message : String(error)}`
4162
+ )
4163
+ );
4164
+ }
4165
+
3899
4166
  // src/commands/sessions/daemon/sdk/startSdkQuery.ts
3900
4167
  async function startSdkQuery(opts2, abort, control, turn, prompt) {
3901
4168
  const label = `session ${opts2.sessionId ?? "?"}`;
@@ -3913,7 +4180,8 @@ async function startSdkQuery(opts2, abort, control, turn, prompt) {
3913
4180
  send: turn.send,
3914
4181
  interrupt: () => turn.interrupt(async () => {
3915
4182
  await messages.interrupt();
3916
- })
4183
+ }),
4184
+ stopTask: (taskId) => messages.stopTask(taskId)
3917
4185
  });
3918
4186
  await runSdkQuery(messages, opts2.sessionId, control, turn);
3919
4187
  } catch (error) {
@@ -3923,17 +4191,6 @@ async function startSdkQuery(opts2, abort, control, turn, prompt) {
3923
4191
  control.exit(1);
3924
4192
  }
3925
4193
  }
3926
- function awaitResume(label, messages, control) {
3927
- messages.initializationResult().then(
3928
- () => {
3929
- daemonLog(`${label} sdk resume complete`);
3930
- control.emit({ kind: "resumed" });
3931
- },
3932
- (error) => daemonLog(
3933
- `${label} sdk resume did not complete: ${error instanceof Error ? error.message : String(error)}`
3934
- )
3935
- );
3936
- }
3937
4194
 
3938
4195
  // src/commands/sessions/daemon/spawnClaudeSdk.ts
3939
4196
  function spawnClaudeSdk(opts2) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  buildDoctorProbes,
3
3
  diagnoseLink
4
- } from "./chunk-J4SWOWUT.js";
4
+ } from "./chunk-ETHAWXUL.js";
5
5
  import {
6
6
  queryNodes
7
7
  } from "./chunk-OD7CMDGZ.js";