@staff0rd/assist 0.1151.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.
- package/dist/.build-files +93 -93
- package/dist/{addActivity-JEDMNTYW.js → addActivity-ZAQI4Q2G.js} +2 -2
- package/dist/{addPhase-J34XKHLO.js → addPhase-7DVJ3KPA.js} +4 -4
- package/dist/{advise-WN2C66UJ.js → advise-S3NVHTGZ.js} +3 -3
- package/dist/{ask-GXMVORX7.js → ask-ZZRX33YD.js} +2 -2
- package/dist/{askCheck-76WHHHNM.js → askCheck-FTETNBJC.js} +8 -8
- package/dist/{askDesign-ZNZD3VXM.js → askDesign-RCFPITLS.js} +3 -3
- package/dist/{askQuestion-MRI2ATSI.js → askQuestion-A653WELI.js} +1 -1
- package/dist/{branch-K2DGKPDR.js → branch-SGFO3GZL.js} +3 -3
- package/dist/built-version +1 -1
- package/dist/{chunk-OWWGKT6F.js → chunk-2EBTDB27.js} +1 -1
- package/dist/{chunk-C4POAODE.js → chunk-36JBIJIM.js} +1 -1
- package/dist/{chunk-OA4EJYZY.js → chunk-3JJCNAGV.js} +289 -53
- package/dist/{chunk-NU3L3SM2.js → chunk-4ACH2U5V.js} +1 -1
- package/dist/{chunk-GKCAEW5J.js → chunk-4JZX7ILW.js} +49 -19
- package/dist/{chunk-V4W6R2LK.js → chunk-53HUKZXM.js} +1 -1
- package/dist/{chunk-U2MFQ2H4.js → chunk-5ZEMQDY7.js} +2 -2
- package/dist/{chunk-D2GLGK3G.js → chunk-6CQJKXAU.js} +3 -3
- package/dist/{chunk-MOBXP7IB.js → chunk-6DWFNXQR.js} +1 -1
- package/dist/{chunk-YVCSXCBB.js → chunk-7NH7CRHK.js} +4 -4
- package/dist/{chunk-VYFXF763.js → chunk-AKUIS624.js} +1 -1
- package/dist/{chunk-3J2AZSPZ.js → chunk-BCJBPK3T.js} +6 -6
- package/dist/{chunk-CHAUXPIP.js → chunk-BGE4GGTY.js} +1 -1
- package/dist/{chunk-LZY4INWM.js → chunk-BWDXE5EC.js} +1 -1
- package/dist/{chunk-ZH7FLZPU.js → chunk-CJUZTNRQ.js} +1 -1
- package/dist/{chunk-AT33IHDZ.js → chunk-DPVBL2R7.js} +1 -1
- package/dist/{chunk-CJLBH3DN.js → chunk-DYGEMDS7.js} +1 -1
- package/dist/{chunk-OIEWOLWW.js → chunk-E47WLY5F.js} +2 -2
- package/dist/{chunk-GZEEGROK.js → chunk-E53ZRNYD.js} +1 -1
- package/dist/{chunk-PGJVFI4M.js → chunk-ETHAWXUL.js} +1 -1
- package/dist/{chunk-KA2V6HLD.js → chunk-G3DXEE26.js} +1 -1
- package/dist/{chunk-H3UM6QRY.js → chunk-GOQK3KCL.js} +1 -1
- package/dist/{chunk-QOQ6LRUD.js → chunk-HL2HUE6U.js} +1 -1
- package/dist/{chunk-KSMPUXH5.js → chunk-KHIFO4T4.js} +1 -1
- package/dist/{chunk-DIQAEGJ5.js → chunk-KI7RHWH5.js} +15 -2
- package/dist/{chunk-NFXJVC2Z.js → chunk-LKWECRYV.js} +2 -2
- package/dist/{chunk-SYTHN2X3.js → chunk-MVLBCV3S.js} +1 -1
- package/dist/{chunk-SXYX65J7.js → chunk-NAG3JU5H.js} +2 -2
- package/dist/{chunk-4NSAQ5E5.js → chunk-NIVWISHG.js} +1 -1
- package/dist/{chunk-S6TWGP2S.js → chunk-NOOTKBS6.js} +1 -1
- package/dist/{chunk-3JVE3EEO.js → chunk-RAONMLZZ.js} +1 -1
- package/dist/{chunk-C3DOHRWO.js → chunk-RBWY5HC3.js} +1 -1
- package/dist/{chunk-TGVCPC2F.js → chunk-RK2RBWSI.js} +1 -1
- package/dist/{chunk-SBRGQVWS.js → chunk-SL5XEODQ.js} +1 -1
- package/dist/{chunk-YMYZBSS6.js → chunk-TECUUDTX.js} +1 -1
- package/dist/{chunk-CD56HMTG.js → chunk-UHHUPKXF.js} +1 -1
- package/dist/{chunk-GZ5E7OHF.js → chunk-VKPP3JM7.js} +1 -1
- package/dist/{chunk-3RPWEZV4.js → chunk-VWO3F27D.js} +1 -1
- package/dist/{chunk-ZQQEBC6Y.js → chunk-WJCFZMFD.js} +1 -1
- package/dist/{chunk-XYT5LCUW.js → chunk-XZA2RLRL.js} +1 -1
- package/dist/{cliHook-NCHROJVU.js → cliHook-7F37NUA6.js} +5 -5
- package/dist/{cliHookCheck-2QH7HBCX.js → cliHookCheck-W6IF46CG.js} +2 -2
- package/dist/{codexHook-GQJFH7AF.js → codexHook-RRSLTOB6.js} +7 -7
- package/dist/commands/extension/extension/content.js +1 -1
- package/dist/commands/extension/extension/docs.js +18 -18
- package/dist/commands/extension/extension/updates.json +2 -2
- package/dist/commands/sessions/web/bundle.js +430 -430
- package/dist/{comment-NXF5C634.js → comment-CADYMIUH.js} +3 -3
- package/dist/{commentIssue-SZAB7TJQ.js → commentIssue-2VMPDQ74.js} +2 -2
- package/dist/{commit-VT7VJNAT.js → commit-HPITCLAY.js} +3 -3
- package/dist/{createIssue-FQQNJIWA.js → createIssue-J6QLUACO.js} +1 -1
- package/dist/{doctorNodes-A4WV4O2N.js → doctorNodes-WRNF5CFM.js} +3 -3
- package/dist/{done-3PMUFG5E.js → done-GMI65QNI.js} +4 -4
- package/dist/{edit-MRTB2VJQ.js → edit-XOU2IWSF.js} +1 -1
- package/dist/{editHook-4I4O24OG.js → editHook-5K5ETQOW.js} +5 -5
- package/dist/{editIssue-WICT2PNQ.js → editIssue-6I3BU4YO.js} +1 -1
- package/dist/{editIssueComment-OJZXFL5P.js → editIssueComment-OLT3MQDH.js} +2 -2
- package/dist/{fixConflict-KE72MGGP.js → fixConflict-LHAJTXKM.js} +2 -2
- package/dist/index.js +60 -60
- package/dist/{launchMode-G5GQI6RH.js → launchMode-ZFTMKGEM.js} +13 -13
- package/dist/{list-SFYLZAWU.js → list-IUBZMQXV.js} +5 -5
- package/dist/{next-6K6G7FPY.js → next-5PV5AMBB.js} +12 -12
- package/dist/{piHook-VW54NTXW.js → piHook-O3YAI3FX.js} +5 -5
- package/dist/{postSlackMessage-EOGHWXM5.js → postSlackMessage-IPJ2HPKC.js} +2 -2
- package/dist/{propose-2QLI6LNH.js → propose-UTSUAXOT.js} +5 -5
- package/dist/{raise-UADRWTZE.js → raise-AWHJN5PS.js} +1 -1
- package/dist/{refine-2TN2MGBJ.js → refine-N6ZYVQDA.js} +14 -14
- package/dist/{reply-UTOBFFKP.js → reply-QXSMUPXO.js} +2 -2
- package/dist/{restartNode-7747LAX4.js → restartNode-C67ALX5G.js} +5 -5
- package/dist/{review-YJZVECC6.js → review-BE44DKMH.js} +5 -5
- package/dist/{reviewPrComments-2K5ZASCB.js → reviewPrComments-JZRJM7UL.js} +2 -2
- package/dist/{rewindPhase-ESQ5E74W.js → rewindPhase-7P3LNIEI.js} +8 -8
- package/dist/{run-XK5D6Q5L.js → run-2GLAZKVZ.js} +10 -10
- package/dist/{run-NUMXNCH5.js → run-7X5GDF6S.js} +10 -10
- package/dist/{runDaemon-ZQ7BPPBN.js → runDaemon-2BANX73X.js} +56 -24
- package/dist/{runExtract-CTLWMXRG.js → runExtract-HCHT2Z6A.js} +1 -1
- package/dist/{runRefine-IPBZEQAF.js → runRefine-BD44BNNA.js} +14 -14
- package/dist/{scan-QLPUZAJB.js → scan-GBLWINSJ.js} +2 -2
- package/dist/{schemaConfirm-FH6DHU5D.js → schemaConfirm-GHGHWXHO.js} +2 -2
- package/dist/{schemaUnlock-RVWEQGBX.js → schemaUnlock-NPEF3X5C.js} +2 -2
- package/dist/{search-6IJI74JX.js → search-VXRSTLP3.js} +5 -5
- package/dist/{show-3BYF2XTK.js → show-63A3REOB.js} +3 -3
- package/dist/{show-N4PRGXZV.js → show-6LOJV5VT.js} +3 -3
- package/dist/{signExtension-J4OEQ55N.js → signExtension-NZEI4HQM.js} +1 -1
- package/dist/{slack-HQPEBAAX.js → slack-4ZPQ5C5L.js} +2 -2
- package/dist/{updateNode-ECV2WNLI.js → updateNode-NM32XF5V.js} +5 -5
- package/dist/{updatePlan-UYKO2LUV.js → updatePlan-5W7AAL7O.js} +5 -5
- package/dist/{web-CBUMKQK3.js → web-MS5XZ3RK.js} +16 -16
- package/dist/{web-LP6LWDBQ.js → web-Z4I2R7IB.js} +16 -16
- package/dist/{wontfix-FIYGOSWH.js → wontfix-PHYW2KQ7.js} +2 -2
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
printApprovedComments
|
|
3
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
24
|
+
} from "./chunk-3JJCNAGV.js";
|
|
25
25
|
import "./chunk-MRUIXQXS.js";
|
|
26
26
|
import "./chunk-HO7RNI6V.js";
|
|
27
27
|
import "./chunk-DIAC4XYA.js";
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
createBranch,
|
|
3
3
|
generateBranchSlug,
|
|
4
4
|
isConciseSlug
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
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-
|
|
21
|
+
import "./chunk-3JJCNAGV.js";
|
|
22
22
|
import "./chunk-MRUIXQXS.js";
|
|
23
23
|
import "./chunk-HO7RNI6V.js";
|
|
24
24
|
import "./chunk-DIAC4XYA.js";
|
package/dist/built-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.1153.0
|
|
@@ -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,12 +3529,275 @@ 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
|
|
3532
3792
|
var ELAPSED_RESYNC_SECONDS = 10;
|
|
3533
3793
|
function createSdkTurnEmitter(label, control) {
|
|
3534
3794
|
let status;
|
|
3535
3795
|
let activity = null;
|
|
3536
3796
|
let elapsed = null;
|
|
3797
|
+
const processWatch = createSdkProcessWatch(
|
|
3798
|
+
() => control.process.pid,
|
|
3799
|
+
(process2) => control.emit({ kind: "process", process: process2 })
|
|
3800
|
+
);
|
|
3537
3801
|
const setElapsed = (next) => {
|
|
3538
3802
|
elapsed = next;
|
|
3539
3803
|
control.emit({ kind: "elapsed", seconds: next });
|
|
@@ -3544,7 +3808,10 @@ function createSdkTurnEmitter(label, control) {
|
|
|
3544
3808
|
activity = next;
|
|
3545
3809
|
control.emit({ kind: "activity", text: next });
|
|
3546
3810
|
if (elapsed !== null) setElapsed(null);
|
|
3811
|
+
if (next === null || next === SDK_WORKING_ACTIVITY) processWatch.stop();
|
|
3812
|
+
else void processWatch.start();
|
|
3547
3813
|
},
|
|
3814
|
+
stopProcessWatch: processWatch.stop,
|
|
3548
3815
|
elapsed: (seconds) => {
|
|
3549
3816
|
const next = Math.floor(seconds);
|
|
3550
3817
|
if (elapsed !== null && next >= elapsed && next - elapsed < ELAPSED_RESYNC_SECONDS)
|
|
@@ -3582,6 +3849,7 @@ function createSdkTurnTracker(label, control, push) {
|
|
|
3582
3849
|
return {
|
|
3583
3850
|
setActivity: emit.activity,
|
|
3584
3851
|
setElapsed: emit.elapsed,
|
|
3852
|
+
stopProcessWatch: emit.stopProcessWatch,
|
|
3585
3853
|
setStatus,
|
|
3586
3854
|
start: (prompt) => {
|
|
3587
3855
|
busy = true;
|
|
@@ -3619,19 +3887,6 @@ function resolveClaudeExecutable() {
|
|
|
3619
3887
|
return path15;
|
|
3620
3888
|
}
|
|
3621
3889
|
|
|
3622
|
-
// src/commands/sessions/daemon/sdk/activityLine.ts
|
|
3623
|
-
var MAX_LINE = 80;
|
|
3624
|
-
function activityLine(text) {
|
|
3625
|
-
const line = text.trim().split("\n")[0].trim();
|
|
3626
|
-
return line.length > MAX_LINE ? `${line.slice(0, MAX_LINE - 1)}\u2026` : line;
|
|
3627
|
-
}
|
|
3628
|
-
|
|
3629
|
-
// src/commands/sessions/daemon/sdk/commandActivityLine.ts
|
|
3630
|
-
var LEADING_CD = /^cd\s+(?:"[^"]*"|'[^']*'|\S+)\s*(?:;|&&)\s*/;
|
|
3631
|
-
function commandActivityLine(command) {
|
|
3632
|
-
return activityLine(command.trim().replace(LEADING_CD, ""));
|
|
3633
|
-
}
|
|
3634
|
-
|
|
3635
3890
|
// src/commands/sessions/daemon/sdk/createSdkBackgroundTasks.ts
|
|
3636
3891
|
function createSdkBackgroundTasks() {
|
|
3637
3892
|
const described = /* @__PURE__ */ new Map();
|
|
@@ -3782,33 +4037,6 @@ function sdkTurnStatus(message2) {
|
|
|
3782
4037
|
return void 0;
|
|
3783
4038
|
}
|
|
3784
4039
|
|
|
3785
|
-
// src/commands/sessions/daemon/sdk/sdkActivityText.ts
|
|
3786
|
-
var TARGET_KEYS = [
|
|
3787
|
-
"description",
|
|
3788
|
-
"command",
|
|
3789
|
-
"file_path",
|
|
3790
|
-
"notebook_path",
|
|
3791
|
-
"path",
|
|
3792
|
-
"pattern",
|
|
3793
|
-
"url",
|
|
3794
|
-
"query",
|
|
3795
|
-
"skill"
|
|
3796
|
-
];
|
|
3797
|
-
function toolTarget2(input) {
|
|
3798
|
-
if (!input || typeof input !== "object") return "";
|
|
3799
|
-
const record3 = input;
|
|
3800
|
-
const key = TARGET_KEYS.find((k) => typeof record3[k] === "string");
|
|
3801
|
-
if (!key) return "";
|
|
3802
|
-
const value = record3[key];
|
|
3803
|
-
return key === "command" ? commandActivityLine(value) : activityLine(value);
|
|
3804
|
-
}
|
|
3805
|
-
function sdkActivityText(content) {
|
|
3806
|
-
const tool = [...content].reverse().find((block) => block.type === "tool_use");
|
|
3807
|
-
if (!tool?.name) return "Working";
|
|
3808
|
-
const target = toolTarget2(tool.input);
|
|
3809
|
-
return `Working \xB7 ${tool.name}${target ? ` ${target}` : ""}`;
|
|
3810
|
-
}
|
|
3811
|
-
|
|
3812
4040
|
// src/commands/sessions/daemon/sdk/trackSdkTurnProgress.ts
|
|
3813
4041
|
function trackSdkTurnProgress(message2, turn) {
|
|
3814
4042
|
if (message2.type === "assistant" && message2.parent_tool_use_id === null)
|
|
@@ -3833,6 +4061,8 @@ async function runSdkQuery(messages, sessionId, control, turn) {
|
|
|
3833
4061
|
if (status) turn.setStatus(status);
|
|
3834
4062
|
const background = sdkBackgroundTasks(message2);
|
|
3835
4063
|
if (background) control.emit({ kind: "background", tasks: background });
|
|
4064
|
+
if (message2.type === "prompt_suggestion")
|
|
4065
|
+
control.emit({ kind: "suggestion", text: message2.suggestion || null });
|
|
3836
4066
|
trackSdkTurnProgress(message2, turn);
|
|
3837
4067
|
}
|
|
3838
4068
|
daemonLog(`${label} sdk query finished`);
|
|
@@ -3847,6 +4077,8 @@ async function runSdkQuery(messages, sessionId, control, turn) {
|
|
|
3847
4077
|
`${label} sdk query failed: ${error instanceof Error ? error.message : String(error)}`
|
|
3848
4078
|
);
|
|
3849
4079
|
control.exit(1);
|
|
4080
|
+
} finally {
|
|
4081
|
+
turn.stopProcessWatch();
|
|
3850
4082
|
}
|
|
3851
4083
|
}
|
|
3852
4084
|
|
|
@@ -3913,10 +4145,24 @@ function sdkQueryOptions(opts2, executable, abort, control) {
|
|
|
3913
4145
|
spawnClaudeCodeProcess: (options) => spawnSdkChild(options, opts2, control.attach),
|
|
3914
4146
|
abortController: abort,
|
|
3915
4147
|
model: opts2.model,
|
|
4148
|
+
promptSuggestions: true,
|
|
3916
4149
|
systemPrompt: { type: "preset", preset: "claude_code", append }
|
|
3917
4150
|
};
|
|
3918
4151
|
}
|
|
3919
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
|
+
|
|
3920
4166
|
// src/commands/sessions/daemon/sdk/startSdkQuery.ts
|
|
3921
4167
|
async function startSdkQuery(opts2, abort, control, turn, prompt) {
|
|
3922
4168
|
const label = `session ${opts2.sessionId ?? "?"}`;
|
|
@@ -3934,7 +4180,8 @@ async function startSdkQuery(opts2, abort, control, turn, prompt) {
|
|
|
3934
4180
|
send: turn.send,
|
|
3935
4181
|
interrupt: () => turn.interrupt(async () => {
|
|
3936
4182
|
await messages.interrupt();
|
|
3937
|
-
})
|
|
4183
|
+
}),
|
|
4184
|
+
stopTask: (taskId) => messages.stopTask(taskId)
|
|
3938
4185
|
});
|
|
3939
4186
|
await runSdkQuery(messages, opts2.sessionId, control, turn);
|
|
3940
4187
|
} catch (error) {
|
|
@@ -3944,17 +4191,6 @@ async function startSdkQuery(opts2, abort, control, turn, prompt) {
|
|
|
3944
4191
|
control.exit(1);
|
|
3945
4192
|
}
|
|
3946
4193
|
}
|
|
3947
|
-
function awaitResume(label, messages, control) {
|
|
3948
|
-
messages.initializationResult().then(
|
|
3949
|
-
() => {
|
|
3950
|
-
daemonLog(`${label} sdk resume complete`);
|
|
3951
|
-
control.emit({ kind: "resumed" });
|
|
3952
|
-
},
|
|
3953
|
-
(error) => daemonLog(
|
|
3954
|
-
`${label} sdk resume did not complete: ${error instanceof Error ? error.message : String(error)}`
|
|
3955
|
-
)
|
|
3956
|
-
);
|
|
3957
|
-
}
|
|
3958
4194
|
|
|
3959
4195
|
// src/commands/sessions/daemon/spawnClaudeSdk.ts
|
|
3960
4196
|
function spawnClaudeSdk(opts2) {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
resolveLinkTarget,
|
|
12
12
|
usageWindowKey,
|
|
13
13
|
watcherLogPath
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-RK2RBWSI.js";
|
|
15
15
|
import {
|
|
16
16
|
readLogTail
|
|
17
17
|
} from "./chunk-JNCFHWBK.js";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
} from "./chunk-3NPVVAAT.js";
|
|
27
27
|
import {
|
|
28
28
|
firstBrokenHop
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-4ACH2U5V.js";
|
|
30
30
|
import {
|
|
31
31
|
TRACE_HEADER,
|
|
32
32
|
newTraceId
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
import {
|
|
35
35
|
ASSIST_VERSION,
|
|
36
36
|
PROTOCOL_VERSION
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-NIVWISHG.js";
|
|
38
38
|
import {
|
|
39
39
|
queryNodes
|
|
40
40
|
} from "./chunk-OD7CMDGZ.js";
|
|
@@ -79,7 +79,7 @@ import {
|
|
|
79
79
|
} from "./chunk-UJBW7FVI.js";
|
|
80
80
|
import {
|
|
81
81
|
targetConversationEvents
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-LKWECRYV.js";
|
|
83
83
|
import {
|
|
84
84
|
configEntryLayers,
|
|
85
85
|
ghFailure,
|
|
@@ -215,7 +215,7 @@ import {
|
|
|
215
215
|
} from "./chunk-AOTNNZPH.js";
|
|
216
216
|
import {
|
|
217
217
|
rewindItemToPhase
|
|
218
|
-
} from "./chunk-
|
|
218
|
+
} from "./chunk-DPVBL2R7.js";
|
|
219
219
|
import {
|
|
220
220
|
loadBacklogSummaries,
|
|
221
221
|
searchBacklogSummaries
|
|
@@ -242,7 +242,7 @@ import {
|
|
|
242
242
|
} from "./chunk-IZBQH3LW.js";
|
|
243
243
|
import {
|
|
244
244
|
resolveRewindPlan
|
|
245
|
-
} from "./chunk-
|
|
245
|
+
} from "./chunk-NAG3JU5H.js";
|
|
246
246
|
import {
|
|
247
247
|
deleteItem,
|
|
248
248
|
getOrigin,
|
|
@@ -291,7 +291,7 @@ import {
|
|
|
291
291
|
discoverSessionJsonlPaths,
|
|
292
292
|
harnessAdapter,
|
|
293
293
|
parseSessionFile
|
|
294
|
-
} from "./chunk-
|
|
294
|
+
} from "./chunk-3JJCNAGV.js";
|
|
295
295
|
import {
|
|
296
296
|
harnessLabel
|
|
297
297
|
} from "./chunk-AWIOBY7Q.js";
|
|
@@ -1548,15 +1548,35 @@ async function listCommitRefs(db, itemId2) {
|
|
|
1548
1548
|
}));
|
|
1549
1549
|
}
|
|
1550
1550
|
|
|
1551
|
+
// src/shared/withTimeout.ts
|
|
1552
|
+
function withTimeout(work, ms, label) {
|
|
1553
|
+
let timer;
|
|
1554
|
+
const expired = new Promise((_, reject) => {
|
|
1555
|
+
timer = setTimeout(
|
|
1556
|
+
() => reject(new Error(`${label} timed out after ${ms}ms`)),
|
|
1557
|
+
ms
|
|
1558
|
+
);
|
|
1559
|
+
});
|
|
1560
|
+
return Promise.race([work, expired]).finally(() => clearTimeout(timer));
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1551
1563
|
// src/commands/sessions/web/itemCommits.ts
|
|
1564
|
+
var LOOKUP_TIMEOUT_MS = 3e3;
|
|
1565
|
+
async function lookupItemCommits(sessionId) {
|
|
1566
|
+
const db = await getDb();
|
|
1567
|
+
const itemId2 = await findItemBySessionId(db, sessionId);
|
|
1568
|
+
if (itemId2 === void 0) return [];
|
|
1569
|
+
return listCommitRefs(db, itemId2);
|
|
1570
|
+
}
|
|
1552
1571
|
async function itemCommits(sessionId) {
|
|
1553
1572
|
try {
|
|
1554
1573
|
if (!process.env.ASSIST_DATABASE_URL && !loadConfig().database.url)
|
|
1555
1574
|
return [];
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1575
|
+
return await withTimeout(
|
|
1576
|
+
lookupItemCommits(sessionId),
|
|
1577
|
+
LOOKUP_TIMEOUT_MS,
|
|
1578
|
+
"item commits"
|
|
1579
|
+
);
|
|
1560
1580
|
} catch {
|
|
1561
1581
|
return [];
|
|
1562
1582
|
}
|
|
@@ -1678,13 +1698,18 @@ async function transcriptCommits(cwd, session) {
|
|
|
1678
1698
|
var cache = /* @__PURE__ */ new Map();
|
|
1679
1699
|
var inFlight = /* @__PURE__ */ new Map();
|
|
1680
1700
|
var CACHE_TTL_MS = 1e4;
|
|
1701
|
+
var LOOKUP_TIMEOUT_MS2 = 1e4;
|
|
1681
1702
|
async function committedPaths(cwd, session) {
|
|
1682
1703
|
const key = `${cwd} ${session.harness ?? ""}:${session.conversationId}`;
|
|
1683
1704
|
const cached2 = cache.get(key);
|
|
1684
1705
|
if (cached2 && cached2.expiresAt > Date.now()) return cached2.value;
|
|
1685
1706
|
const pending = inFlight.get(key);
|
|
1686
1707
|
if (pending) return pending;
|
|
1687
|
-
const lookup =
|
|
1708
|
+
const lookup = withTimeout(
|
|
1709
|
+
loadCommittedPaths(key, cwd, session),
|
|
1710
|
+
LOOKUP_TIMEOUT_MS2,
|
|
1711
|
+
"committed paths"
|
|
1712
|
+
).then((value) => {
|
|
1688
1713
|
cache.set(key, { value, expiresAt: Date.now() + CACHE_TTL_MS });
|
|
1689
1714
|
return value;
|
|
1690
1715
|
}).finally(() => inFlight.delete(key));
|
|
@@ -2855,6 +2880,7 @@ async function itemCountsFingerprint(cwd, groups, uncommitted) {
|
|
|
2855
2880
|
|
|
2856
2881
|
// src/commands/sessions/web/groupedCountsUnlessUnchanged.ts
|
|
2857
2882
|
var RECOUNT_AFTER_MS = 3e4;
|
|
2883
|
+
var COUNT_TIMEOUT_MS = 1e4;
|
|
2858
2884
|
var counted = /* @__PURE__ */ new Map();
|
|
2859
2885
|
var counting = /* @__PURE__ */ new Map();
|
|
2860
2886
|
function remember2(scope, fingerprint, counts) {
|
|
@@ -2879,7 +2905,11 @@ async function groupedCountsUnlessUnchanged(scope, cwd, groups, uncommitted) {
|
|
|
2879
2905
|
if (known) return known;
|
|
2880
2906
|
const pending = counting.get(scope);
|
|
2881
2907
|
if (pending?.fingerprint === fingerprint) return pending.counts;
|
|
2882
|
-
const counts =
|
|
2908
|
+
const counts = withTimeout(
|
|
2909
|
+
groupedCounts(cwd, groups),
|
|
2910
|
+
COUNT_TIMEOUT_MS,
|
|
2911
|
+
"grouped counts"
|
|
2912
|
+
).then((result) => {
|
|
2883
2913
|
remember2(scope, fingerprint, result);
|
|
2884
2914
|
return result;
|
|
2885
2915
|
}).finally(() => {
|
|
@@ -2935,16 +2965,16 @@ async function gitStatus(req, res) {
|
|
|
2935
2965
|
const session = getConversationParam(req);
|
|
2936
2966
|
const changeSet = await itemChangeSet(cwd, session).catch(() => void 0);
|
|
2937
2967
|
const uncommitted = await workingTreeCounts(cwd);
|
|
2938
|
-
|
|
2939
|
-
respondJson(res, 200, { ...uncommitted, ...branch });
|
|
2940
|
-
return;
|
|
2941
|
-
}
|
|
2942
|
-
const counts = await groupedCountsUnlessUnchanged(
|
|
2968
|
+
const counts = changeSet && await groupedCountsUnlessUnchanged(
|
|
2943
2969
|
`${cwd} ${session?.harness ?? ""}:${session?.conversationId ?? ""}`,
|
|
2944
2970
|
cwd,
|
|
2945
2971
|
changeSet.groups,
|
|
2946
2972
|
uncommitted
|
|
2947
|
-
);
|
|
2973
|
+
).catch(() => void 0);
|
|
2974
|
+
if (!changeSet || !counts) {
|
|
2975
|
+
respondJson(res, 200, { ...uncommitted, ...branch });
|
|
2976
|
+
return;
|
|
2977
|
+
}
|
|
2948
2978
|
respondJson(res, 200, {
|
|
2949
2979
|
...counts,
|
|
2950
2980
|
...branch,
|