@staff0rd/assist 0.1150.0 → 0.1152.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-FAJXPOZ4.js → addActivity-RCVI7MFJ.js} +2 -2
- package/dist/{addPhase-QNJFCF4I.js → addPhase-G2Q3CN22.js} +4 -4
- package/dist/{advise-5FZ6EQKW.js → advise-HYDI6MD2.js} +3 -3
- package/dist/{ask-GXMVORX7.js → ask-ZZRX33YD.js} +2 -2
- package/dist/{askCheck-XUWBC3AC.js → askCheck-V6JBBUTK.js} +8 -8
- package/dist/{askDesign-MSFOLBXG.js → askDesign-WQHY6WQU.js} +3 -3
- package/dist/{askQuestion-MRI2ATSI.js → askQuestion-A653WELI.js} +1 -1
- package/dist/{branch-YN5MMZZZ.js → branch-GDJ66H7C.js} +3 -3
- package/dist/built-version +1 -1
- package/dist/{chunk-J4SWOWUT.js → chunk-37I3HCXS.js} +1 -1
- package/dist/{chunk-Q27DNI5T.js → chunk-3ETEYHXZ.js} +1 -1
- package/dist/{chunk-5KXFB5TL.js → chunk-3RGJVOHF.js} +1 -1
- package/dist/{chunk-K5AQPUDE.js → chunk-4GMKRFT6.js} +1 -1
- package/dist/{chunk-MXGPUIL3.js → chunk-5UTFJBQW.js} +2 -2
- package/dist/{chunk-6IGWBZ2R.js → chunk-6J7H4L5U.js} +49 -19
- package/dist/{chunk-AZBZH2MC.js → chunk-7QD3L7KA.js} +1 -1
- package/dist/{chunk-HMRDPP46.js → chunk-A2GTJKBK.js} +1 -1
- package/dist/{chunk-F6EI2W6X.js → chunk-B2URMB3I.js} +1 -1
- package/dist/{chunk-KV5L2IIA.js → chunk-B3L73DOX.js} +6 -6
- package/dist/{chunk-WEAZDCXB.js → chunk-C56W3PEA.js} +1 -1
- package/dist/{chunk-YUVOTSA7.js → chunk-C67WW2XW.js} +1 -1
- package/dist/{chunk-ZH7FLZPU.js → chunk-CJUZTNRQ.js} +1 -1
- package/dist/{chunk-4ALZHLCO.js → chunk-CNDR5OUJ.js} +1 -1
- package/dist/{chunk-O7CF3E3N.js → chunk-D6XI63MC.js} +1 -1
- package/dist/{chunk-CJLBH3DN.js → chunk-DYGEMDS7.js} +1 -1
- package/dist/{chunk-H3UM6QRY.js → chunk-GOQK3KCL.js} +1 -1
- package/dist/{chunk-WYJHBRSG.js → chunk-GSVPCLVG.js} +2 -2
- package/dist/{chunk-7Z3XNY5F.js → chunk-GT44SBVO.js} +1 -1
- package/dist/{chunk-WQDDXI3P.js → chunk-II6SR37X.js} +1 -1
- package/dist/{chunk-UKLCNYPF.js → chunk-INKR7DE3.js} +1 -1
- package/dist/{chunk-SRDWYOJQ.js → chunk-JTUJI55D.js} +1 -1
- package/dist/{chunk-DIQAEGJ5.js → chunk-KI7RHWH5.js} +15 -2
- package/dist/{chunk-TGVUTAW4.js → chunk-M57ATSAM.js} +4 -4
- package/dist/{chunk-NDHXVSWO.js → chunk-OAPWC2T4.js} +309 -55
- package/dist/{chunk-GLEMD7P2.js → chunk-ONXZPFKE.js} +1 -1
- package/dist/{chunk-Y4HYJDWR.js → chunk-PPWM3WBM.js} +3 -3
- package/dist/{chunk-XEXXLIGF.js → chunk-PSQ24TON.js} +2 -2
- package/dist/{chunk-RYHNVMY6.js → chunk-QAS45635.js} +1 -1
- package/dist/{chunk-KY6ZIBKH.js → chunk-RML5ROGC.js} +1 -1
- package/dist/{chunk-CBHNIZFO.js → chunk-RV4NFZZ5.js} +1 -1
- package/dist/{chunk-EMNFCQKE.js → chunk-SLKU7FHG.js} +1 -1
- package/dist/{chunk-YMYZBSS6.js → chunk-TECUUDTX.js} +1 -1
- package/dist/{chunk-77PMACIC.js → chunk-UKXNBLDW.js} +2 -2
- package/dist/{chunk-3RPWEZV4.js → chunk-VWO3F27D.js} +1 -1
- package/dist/{chunk-RUVMUOMX.js → chunk-XX5PPG3E.js} +1 -1
- package/dist/{chunk-I3TRD3TY.js → chunk-YDWT36XX.js} +1 -1
- package/dist/{chunk-IAS2D4WB.js → chunk-YJJJFSV6.js} +1 -1
- package/dist/{chunk-Q3R6WLAI.js → chunk-YRVUUZLX.js} +1 -1
- package/dist/{chunk-XSSOA4XV.js → chunk-ZNPV7M2Z.js} +1 -1
- package/dist/{cliHook-H6ZSCG5B.js → cliHook-P6HTSFES.js} +5 -5
- package/dist/{cliHookCheck-NSMNW2QP.js → cliHookCheck-PQHNJXBZ.js} +2 -2
- package/dist/{codexHook-QSDA2ERO.js → codexHook-UABSPFWA.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 +425 -425
- package/dist/{comment-NXF5C634.js → comment-CADYMIUH.js} +3 -3
- package/dist/{commentIssue-SZAB7TJQ.js → commentIssue-2VMPDQ74.js} +2 -2
- package/dist/{commit-4BXR2BKT.js → commit-B4I4JBLS.js} +3 -3
- package/dist/{createIssue-FQQNJIWA.js → createIssue-J6QLUACO.js} +1 -1
- package/dist/{doctorNodes-SOE4FK2J.js → doctorNodes-MA4UZTAL.js} +3 -3
- package/dist/{done-ICXQHCNX.js → done-LI5N36L5.js} +4 -4
- package/dist/{edit-MRTB2VJQ.js → edit-XOU2IWSF.js} +1 -1
- package/dist/{editHook-45YKZZW7.js → editHook-7UT6UAJN.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-7PTOATRG.js → fixConflict-MIFDKQ3T.js} +2 -2
- package/dist/index.js +60 -60
- package/dist/{launchMode-63SE2LFL.js → launchMode-GKCBLWHJ.js} +13 -13
- package/dist/{list-SQVHXDIV.js → list-MI7LNQ7D.js} +5 -5
- package/dist/{next-SOB4NPFS.js → next-VHPVHFWC.js} +12 -12
- package/dist/{piHook-Z75KKYZF.js → piHook-WFN7QKHJ.js} +5 -5
- package/dist/{postSlackMessage-EOGHWXM5.js → postSlackMessage-IPJ2HPKC.js} +2 -2
- package/dist/{propose-6QAGKBFG.js → propose-UFC5CRVG.js} +5 -5
- package/dist/{raise-UADRWTZE.js → raise-AWHJN5PS.js} +1 -1
- package/dist/{refine-4GHYIF7R.js → refine-2HT7X4Q3.js} +14 -14
- package/dist/{reply-UTOBFFKP.js → reply-QXSMUPXO.js} +2 -2
- package/dist/{restartNode-HJTZIR6I.js → restartNode-2DCPTOOE.js} +5 -5
- package/dist/{review-HIQXRL7U.js → review-M3EL4NJ7.js} +5 -5
- package/dist/{reviewPrComments-ZDNFSQIW.js → reviewPrComments-FRL5QJOW.js} +2 -2
- package/dist/{rewindPhase-7CXZMWRY.js → rewindPhase-WK2SFUPK.js} +8 -8
- package/dist/{run-WYJM7OH5.js → run-3UGWKORI.js} +10 -10
- package/dist/{run-HHISACD5.js → run-RWVOOLOQ.js} +10 -10
- package/dist/{runDaemon-ARFA66LK.js → runDaemon-D7OMPX4F.js} +59 -26
- package/dist/{runExtract-CTLWMXRG.js → runExtract-HCHT2Z6A.js} +1 -1
- package/dist/{runRefine-C5EGJWP3.js → runRefine-JURYPIDG.js} +14 -14
- package/dist/{scan-SP5UQPWP.js → scan-RQPVCLF6.js} +2 -2
- package/dist/{schemaConfirm-LRWRIDFO.js → schemaConfirm-SSOJL34W.js} +2 -2
- package/dist/{schemaUnlock-O3ENCUT6.js → schemaUnlock-Y5I3NWZT.js} +2 -2
- package/dist/{search-FGBAR6ZI.js → search-Z3EALCQT.js} +5 -5
- package/dist/{show-YEME2NJH.js → show-P7PK7BRV.js} +3 -3
- package/dist/{show-P3OACYLT.js → show-WP2QQPMY.js} +3 -3
- package/dist/{signExtension-W26BMN5K.js → signExtension-NVKKIUU6.js} +1 -1
- package/dist/{slack-HQPEBAAX.js → slack-4ZPQ5C5L.js} +2 -2
- package/dist/{updateNode-KQQYUC5P.js → updateNode-YPCZVJSA.js} +5 -5
- package/dist/{updatePlan-MQTC6WRG.js → updatePlan-U34WLBXQ.js} +5 -5
- package/dist/{web-WHMDGQN4.js → web-5RR4WETV.js} +16 -16
- package/dist/{web-P6JFUPFH.js → web-UDO3S4E5.js} +16 -16
- package/dist/{wontfix-FIYGOSWH.js → wontfix-PHYW2KQ7.js} +2 -2
- package/package.json +1 -1
|
@@ -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,7 @@ 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
|
-
|
|
3815
|
-
turn.setActivity(sdkActivityText(message2.message.content));
|
|
4064
|
+
trackSdkTurnProgress(message2, turn);
|
|
3816
4065
|
}
|
|
3817
4066
|
daemonLog(`${label} sdk query finished`);
|
|
3818
4067
|
control.exit(0);
|
|
@@ -3826,6 +4075,8 @@ async function runSdkQuery(messages, sessionId, control, turn) {
|
|
|
3826
4075
|
`${label} sdk query failed: ${error instanceof Error ? error.message : String(error)}`
|
|
3827
4076
|
);
|
|
3828
4077
|
control.exit(1);
|
|
4078
|
+
} finally {
|
|
4079
|
+
turn.stopProcessWatch();
|
|
3829
4080
|
}
|
|
3830
4081
|
}
|
|
3831
4082
|
|
|
@@ -3896,6 +4147,19 @@ function sdkQueryOptions(opts2, executable, abort, control) {
|
|
|
3896
4147
|
};
|
|
3897
4148
|
}
|
|
3898
4149
|
|
|
4150
|
+
// src/commands/sessions/daemon/sdk/awaitResume.ts
|
|
4151
|
+
function awaitResume(label, messages, control) {
|
|
4152
|
+
messages.initializationResult().then(
|
|
4153
|
+
() => {
|
|
4154
|
+
daemonLog(`${label} sdk resume complete`);
|
|
4155
|
+
control.emit({ kind: "resumed" });
|
|
4156
|
+
},
|
|
4157
|
+
(error) => daemonLog(
|
|
4158
|
+
`${label} sdk resume did not complete: ${error instanceof Error ? error.message : String(error)}`
|
|
4159
|
+
)
|
|
4160
|
+
);
|
|
4161
|
+
}
|
|
4162
|
+
|
|
3899
4163
|
// src/commands/sessions/daemon/sdk/startSdkQuery.ts
|
|
3900
4164
|
async function startSdkQuery(opts2, abort, control, turn, prompt) {
|
|
3901
4165
|
const label = `session ${opts2.sessionId ?? "?"}`;
|
|
@@ -3913,7 +4177,8 @@ async function startSdkQuery(opts2, abort, control, turn, prompt) {
|
|
|
3913
4177
|
send: turn.send,
|
|
3914
4178
|
interrupt: () => turn.interrupt(async () => {
|
|
3915
4179
|
await messages.interrupt();
|
|
3916
|
-
})
|
|
4180
|
+
}),
|
|
4181
|
+
stopTask: (taskId) => messages.stopTask(taskId)
|
|
3917
4182
|
});
|
|
3918
4183
|
await runSdkQuery(messages, opts2.sessionId, control, turn);
|
|
3919
4184
|
} catch (error) {
|
|
@@ -3923,17 +4188,6 @@ async function startSdkQuery(opts2, abort, control, turn, prompt) {
|
|
|
3923
4188
|
control.exit(1);
|
|
3924
4189
|
}
|
|
3925
4190
|
}
|
|
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
4191
|
|
|
3938
4192
|
// src/commands/sessions/daemon/spawnClaudeSdk.ts
|
|
3939
4193
|
function spawnClaudeSdk(opts2) {
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
} from "./chunk-SB4BG7PH.js";
|
|
4
4
|
import {
|
|
5
5
|
run
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-B3L73DOX.js";
|
|
7
7
|
import {
|
|
8
8
|
isLockedByOther
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3ETEYHXZ.js";
|
|
10
10
|
import {
|
|
11
11
|
isBlocked,
|
|
12
12
|
typeLabel
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-7QD3L7KA.js";
|
|
14
14
|
import {
|
|
15
15
|
loadBacklog
|
|
16
16
|
} from "./chunk-PYZUB3JT.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveReviewPhase
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CNDR5OUJ.js";
|
|
4
4
|
import {
|
|
5
5
|
resolvePlan
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QAS45635.js";
|
|
7
7
|
|
|
8
8
|
// src/commands/backlog/resolveRewindPlan.ts
|
|
9
9
|
function resolveRewindPlan(item) {
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
isApprovedRead,
|
|
14
14
|
resolvePermission,
|
|
15
15
|
splitCompound
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-B2URMB3I.js";
|
|
17
17
|
import {
|
|
18
18
|
DOCS_LOCK_REASON,
|
|
19
19
|
SCHEMA_LOCK_REASON,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
isSchemaPath,
|
|
24
24
|
isSchemaRelativePath,
|
|
25
25
|
mentionsDocsPath
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-RV4NFZZ5.js";
|
|
27
27
|
import {
|
|
28
28
|
isLiveDaemonSession
|
|
29
29
|
} from "./chunk-C5U44UI7.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decideToolOperations,
|
|
3
3
|
logPolicyDeny
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UKXNBLDW.js";
|
|
5
5
|
import "./chunk-CDU6M5IX.js";
|
|
6
6
|
import "./chunk-HKGCLAZ7.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-B2URMB3I.js";
|
|
8
8
|
import "./chunk-VDXS55BC.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-RV4NFZZ5.js";
|
|
10
10
|
import "./chunk-SOLU75ED.js";
|
|
11
11
|
import {
|
|
12
12
|
currentExecutionIdentity
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-YRVUUZLX.js";
|
|
14
14
|
import "./chunk-ZMH7UZNP.js";
|
|
15
15
|
import "./chunk-FPWL4VRC.js";
|
|
16
16
|
import "./chunk-C5U44UI7.js";
|
|
@@ -26,7 +26,7 @@ import "./chunk-LMUTL44M.js";
|
|
|
26
26
|
import "./chunk-6NDXAN45.js";
|
|
27
27
|
import {
|
|
28
28
|
claudeAdapter
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-OAPWC2T4.js";
|
|
30
30
|
import "./chunk-MRUIXQXS.js";
|
|
31
31
|
import "./chunk-HO7RNI6V.js";
|
|
32
32
|
import "./chunk-DIAC4XYA.js";
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
findTruncatedReadDenyRaw,
|
|
6
6
|
isApprovedRead,
|
|
7
7
|
splitCompound
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-B2URMB3I.js";
|
|
9
9
|
import "./chunk-VDXS55BC.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-OAPWC2T4.js";
|
|
11
11
|
import "./chunk-MRUIXQXS.js";
|
|
12
12
|
import "./chunk-HO7RNI6V.js";
|
|
13
13
|
import "./chunk-DIAC4XYA.js";
|