@dadado/agent-kit-cli 6.22.1 → 6.25.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/README.md +1 -0
- package/dashboard/dashboard-data.mjs +126 -5
- package/dashboard/dashboard.html +45 -4
- package/dashboard/lib/live-refresh.mjs +1 -0
- package/dist/{add-YVDIFP4N.js → add-OYLOMCM6.js} +14 -6
- package/dist/chunk-2F6NMQOA.js +519 -0
- package/dist/chunk-2QYWMSI5.js +193 -0
- package/dist/{chunk-B3VR5YBQ.js → chunk-2TW7ENWC.js} +12 -11
- package/dist/{chunk-GT5R7W66.js → chunk-2XLI7XEY.js} +1 -1
- package/dist/chunk-6M6UKECW.js +176 -0
- package/dist/{chunk-YRBRYTM5.js → chunk-7Y74KO7U.js} +45 -16
- package/dist/{chunk-DZCLMIAS.js → chunk-AQLBEEPD.js} +236 -2
- package/dist/{chunk-R4DUO5DA.js → chunk-AXQMVQ6O.js} +61 -237
- package/dist/{chunk-4SEQ76BQ.js → chunk-C7SV7UP5.js} +7 -4
- package/dist/{chunk-WS6OX2IG.js → chunk-CGXLR77R.js} +4 -0
- package/dist/{chunk-XZQM55BK.js → chunk-CIV42JGT.js} +7 -5
- package/dist/{chunk-CQHD6UKB.js → chunk-CXE6ASSX.js} +1 -0
- package/dist/{chunk-2FKAKFMH.js → chunk-EO5NGAYV.js} +1 -1
- package/dist/{chunk-GV4VKIPO.js → chunk-G5MQRP6M.js} +32 -14
- package/dist/chunk-GMG7ZH4E.js +357 -0
- package/dist/{chunk-5EBT3V7G.js → chunk-GQSSXDDK.js} +1 -1
- package/dist/{chunk-EYNSSL6B.js → chunk-H7RAFRRZ.js} +47 -251
- package/dist/{chunk-IESSMKOV.js → chunk-HSIHZWFF.js} +4 -4
- package/dist/{chunk-W3ZJVBNY.js → chunk-IFBIO7VT.js} +449 -418
- package/dist/{chunk-QWTBYXHN.js → chunk-JFS4GKP7.js} +1 -1
- package/dist/{chunk-LDZAK5DU.js → chunk-JG3CNGQM.js} +78 -170
- package/dist/{chunk-SDJIMC5S.js → chunk-JGG574RK.js} +3 -3
- package/dist/{chunk-SGTTC2JP.js → chunk-KWYF7QNH.js} +1 -1
- package/dist/{chunk-5HH3HSUR.js → chunk-M4UL422I.js} +80 -15
- package/dist/{chunk-DTSL2RH7.js → chunk-MFKHIWEL.js} +5 -3
- package/dist/{chunk-MGIPA6SD.js → chunk-NJ2SUSWX.js} +1 -1
- package/dist/{chunk-BCU54M2P.js → chunk-PIMGV3E5.js} +1 -1
- package/dist/{chunk-HJWSOZXS.js → chunk-QACMV46U.js} +10 -10
- package/dist/{chunk-WHBGJ7IJ.js → chunk-QLTGHJB3.js} +26 -7
- package/dist/{chunk-ZJDJCMQO.js → chunk-QX55T4UX.js} +23 -1
- package/dist/chunk-SAQ3EE5R.js +138 -0
- package/dist/{chunk-C4LCOOL4.js → chunk-TOSAAQ5A.js} +1 -1
- package/dist/chunk-WKFE3RUC.js +433 -0
- package/dist/{chunk-BGL5DRK2.js → chunk-XGZOU4DS.js} +1 -1
- package/dist/{commands-LEBG6DMD.js → commands-UW2C2ZN4.js} +5 -5
- package/dist/{conflicts-FJD3IVPQ.js → conflicts-RING6AHV.js} +22 -12
- package/dist/{contribute-XPAR2JER.js → contribute-LSY75JZH.js} +6 -5
- package/dist/{countdown-25E5C7AR.js → countdown-SZ2P4XHB.js} +267 -23
- package/dist/{diff-KFID4SX3.js → diff-NZVBVQSK.js} +14 -6
- package/dist/{doctor-J2GJFTSE.js → doctor-TJSXBVGV.js} +104 -18
- package/dist/{ground-control-IDCXN5FK.js → ground-control-ZJXPUIQN.js} +3 -3
- package/dist/{guard-RJZEEKSL.js → guard-ZO4Z3LLB.js} +47 -9
- package/dist/{handoff-5AGE2D3T.js → handoff-2OZSWGTE.js} +2 -0
- package/dist/{hook-HV6U3ANI.js → hook-3VPKNSOO.js} +14 -12
- package/dist/index.js +27 -26
- package/dist/{init-47WA2SCG.js → init-UW2BJBO2.js} +22 -16
- package/dist/install-RQSI4CHG.js +41 -0
- package/dist/installs-7TR4H4QH.js +222 -0
- package/dist/{mission-control-CRMCRZUU.js → mission-control-VSU6NT43.js} +1 -1
- package/dist/{queue-OJHKFKK3.js → queue-JHYILLMX.js} +10 -10
- package/dist/{run-Z2GHNVBO.js → run-CQF5RM5X.js} +29 -29
- package/dist/{run-plan-XA7MYOQ3.js → run-plan-BEOCOJCF.js} +13 -13
- package/dist/{scan-K3T5RQLC.js → scan-7D3RMO34.js} +2 -1
- package/dist/{session-start-PEVTDMOZ.js → session-start-QV7CEFRX.js} +18 -12
- package/dist/{sessions-6IGVH467.js → sessions-AWAAO3DU.js} +3 -3
- package/dist/{setup-global-KBJL7QRD.js → setup-global-ST4TT427.js} +9 -8
- package/dist/{status-3UGVDIO6.js → status-HUBPBGUU.js} +14 -11
- package/dist/update-DD5UZPGG.js +31 -0
- package/dist/update-all-YYUTXHGR.js +695 -0
- package/package.json +1 -1
- package/dist/chunk-HAFRAXGV.js +0 -17
- package/dist/chunk-ZNY32NK2.js +0 -52
- package/dist/install-Y63HEM4G.js +0 -38
- package/dist/update-4UQHGENC.js +0 -283
|
@@ -1,9 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CLAUDE_SUBAGENT_MODEL_ENV,
|
|
3
|
+
armExternalPlanReview,
|
|
4
|
+
describeIdenticalReviewModel,
|
|
5
|
+
describeResolvedRoles,
|
|
6
|
+
describeSameFamilyReviewModel,
|
|
7
|
+
formatAgentStopLine,
|
|
8
|
+
formatSentinelLine,
|
|
9
|
+
isPlanExhaustedReason,
|
|
10
|
+
readPlanRoleOverrides,
|
|
11
|
+
resolveSubworkerModel,
|
|
12
|
+
resolveTickResultStatus,
|
|
13
|
+
resolveTickSentinel,
|
|
14
|
+
reviewModelRelation,
|
|
15
|
+
shouldArmExternalPlanReview
|
|
16
|
+
} from "./chunk-AQLBEEPD.js";
|
|
17
|
+
import {
|
|
18
|
+
REVIEW_BACKENDS,
|
|
19
|
+
runReviewJob
|
|
20
|
+
} from "./chunk-HSIHZWFF.js";
|
|
1
21
|
import {
|
|
2
22
|
InputLine,
|
|
3
23
|
ScrollRegion,
|
|
4
24
|
renderMcLive,
|
|
5
25
|
runMcTuiLoop
|
|
6
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-CXE6ASSX.js";
|
|
7
27
|
import {
|
|
8
28
|
DRIVER_PROTOCOL_VERSION,
|
|
9
29
|
DriverAgentSink,
|
|
@@ -13,28 +33,6 @@ import {
|
|
|
13
33
|
driverReplies,
|
|
14
34
|
driverStop
|
|
15
35
|
} from "./chunk-6WUKLS4D.js";
|
|
16
|
-
import {
|
|
17
|
-
QUEUE_LEASE_INTERRUPT_WAIT_MS,
|
|
18
|
-
QUEUE_LEASE_SESSION_ENV,
|
|
19
|
-
acquirePlanWriterLease,
|
|
20
|
-
forwardTermination,
|
|
21
|
-
gateCheckIn,
|
|
22
|
-
holdQueueStatus,
|
|
23
|
-
procStart
|
|
24
|
-
} from "./chunk-DTSL2RH7.js";
|
|
25
|
-
import {
|
|
26
|
-
CLAUDE_SUBAGENT_MODEL_ENV,
|
|
27
|
-
describeIdenticalReviewModel,
|
|
28
|
-
describeResolvedRoles,
|
|
29
|
-
describeSameFamilyReviewModel,
|
|
30
|
-
readPlanRoleOverrides,
|
|
31
|
-
resolveSubworkerModel,
|
|
32
|
-
reviewModelRelation
|
|
33
|
-
} from "./chunk-DZCLMIAS.js";
|
|
34
|
-
import {
|
|
35
|
-
REVIEW_BACKENDS,
|
|
36
|
-
runReviewJob
|
|
37
|
-
} from "./chunk-IESSMKOV.js";
|
|
38
36
|
import {
|
|
39
37
|
countPendingTodos,
|
|
40
38
|
findActivePlanFile,
|
|
@@ -45,21 +43,27 @@ import {
|
|
|
45
43
|
} from "./chunk-7ABY6DYH.js";
|
|
46
44
|
import {
|
|
47
45
|
detectAgentBackend
|
|
48
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-TOSAAQ5A.js";
|
|
49
47
|
import {
|
|
50
48
|
classifyGateExit,
|
|
51
49
|
landGateExit
|
|
52
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-XGZOU4DS.js";
|
|
53
51
|
import {
|
|
54
52
|
parsePlanFrontmatter
|
|
55
53
|
} from "./chunk-L5V3W3DY.js";
|
|
56
54
|
import {
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
QUEUE_LEASE_INTERRUPT_WAIT_MS,
|
|
56
|
+
QUEUE_LEASE_SESSION_ENV,
|
|
57
|
+
acquirePlanWriterLease,
|
|
58
|
+
forwardTermination,
|
|
59
|
+
gateCheckIn,
|
|
60
|
+
holdQueueStatus,
|
|
61
|
+
procStart
|
|
62
|
+
} from "./chunk-MFKHIWEL.js";
|
|
63
|
+
import {
|
|
59
64
|
parseStreamLine,
|
|
60
|
-
redactSecrets,
|
|
61
65
|
renderStreamEvent
|
|
62
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-IFBIO7VT.js";
|
|
63
67
|
import {
|
|
64
68
|
LineSplitter,
|
|
65
69
|
formatHitlSummary,
|
|
@@ -465,106 +469,11 @@ async function withLiveTui(opts, run) {
|
|
|
465
469
|
}
|
|
466
470
|
|
|
467
471
|
// src/plan-loop/run-loop.ts
|
|
468
|
-
import { readFile as
|
|
469
|
-
import
|
|
470
|
-
|
|
471
|
-
// src/plan-loop/external-review.ts
|
|
472
|
-
import { spawn } from "child_process";
|
|
473
|
-
import path2 from "path";
|
|
474
|
-
var CANONICAL_REL = path2.join(".cursor", "scripts", "plan-external-review.sh");
|
|
475
|
-
var FALLBACK_REL = path2.join("scripts", "plan-external-review.sh");
|
|
476
|
-
function isPlanExhaustedReason(reason) {
|
|
477
|
-
const r = reason.trim().toLowerCase();
|
|
478
|
-
if (!r) return false;
|
|
479
|
-
if (r.includes("plan exhausted")) return true;
|
|
480
|
-
if (r.includes("nothing to do")) return true;
|
|
481
|
-
if (r.includes("no implementable")) return true;
|
|
482
|
-
if (/\ball\s+(implementable\s+)?to-?dos?\b/.test(r) && (r.includes("completed") || r.includes("done") || r.includes("exhausted"))) {
|
|
483
|
-
return true;
|
|
484
|
-
}
|
|
485
|
-
return false;
|
|
486
|
-
}
|
|
487
|
-
function shouldArmExternalPlanReview(input) {
|
|
488
|
-
if (input.pending === 0) return true;
|
|
489
|
-
if (input.stopReason && isPlanExhaustedReason(input.stopReason)) return true;
|
|
490
|
-
return false;
|
|
491
|
-
}
|
|
492
|
-
async function armExternalPlanReview(root, options = {}) {
|
|
493
|
-
const spawnFn = options.spawnFn ?? spawn;
|
|
494
|
-
const existsFn = options.existsFn ?? fileExists;
|
|
495
|
-
const log = options.log ?? ((line) => console.log(line));
|
|
496
|
-
const force = options.force === true;
|
|
497
|
-
const canonicalPath = path2.join(root, CANONICAL_REL);
|
|
498
|
-
const fallbackPath = path2.join(root, FALLBACK_REL);
|
|
499
|
-
let scriptPath = null;
|
|
500
|
-
let scriptRel = CANONICAL_REL;
|
|
501
|
-
if (await existsFn(canonicalPath)) {
|
|
502
|
-
scriptPath = canonicalPath;
|
|
503
|
-
scriptRel = CANONICAL_REL;
|
|
504
|
-
} else if (await existsFn(fallbackPath)) {
|
|
505
|
-
scriptPath = fallbackPath;
|
|
506
|
-
scriptRel = FALLBACK_REL;
|
|
507
|
-
}
|
|
508
|
-
if (!scriptPath) {
|
|
509
|
-
log(
|
|
510
|
-
`tip: ${CANONICAL_REL} missing (optional wrapper: ${FALLBACK_REL}). Manual: /plan-external-review (enable externalPlanReview in .cursor/context/config.json).`
|
|
511
|
-
);
|
|
512
|
-
return { invoked: false, exitCode: null, output: "" };
|
|
513
|
-
}
|
|
514
|
-
log("Plan exhausted: arming optional external plan review (opt-in handled by script)...");
|
|
515
|
-
const args = force ? [scriptPath, "--force", "--print"] : [scriptPath, "--print"];
|
|
516
|
-
const implementerModel = options.implementerModel?.trim();
|
|
517
|
-
if (implementerModel) args.push("--implementer-model", implementerModel);
|
|
518
|
-
return new Promise((resolve) => {
|
|
519
|
-
const child = spawnFn("bash", args, {
|
|
520
|
-
cwd: root,
|
|
521
|
-
env: { ...process.env, AGENT_KIT_HEADLESS: "1" }
|
|
522
|
-
});
|
|
523
|
-
const redact = claudeRedactions(process.env);
|
|
524
|
-
const outBuffer = new RedactingStreamBuffer(redact);
|
|
525
|
-
const errBuffer = new RedactingStreamBuffer(redact);
|
|
526
|
-
let output = "";
|
|
527
|
-
const emitOut = (s) => {
|
|
528
|
-
if (!s) return;
|
|
529
|
-
output += s;
|
|
530
|
-
if (options.writeOut) options.writeOut(s);
|
|
531
|
-
else process.stdout.write(s);
|
|
532
|
-
};
|
|
533
|
-
const emitErr = (s) => {
|
|
534
|
-
if (!s) return;
|
|
535
|
-
output += s;
|
|
536
|
-
process.stderr.write(s);
|
|
537
|
-
};
|
|
538
|
-
let flushed = false;
|
|
539
|
-
const flush = () => {
|
|
540
|
-
if (flushed) return;
|
|
541
|
-
flushed = true;
|
|
542
|
-
emitOut(outBuffer.flush());
|
|
543
|
-
emitErr(errBuffer.flush());
|
|
544
|
-
};
|
|
545
|
-
child.stdout?.on("data", (chunk) => emitOut(outBuffer.push(chunk)));
|
|
546
|
-
child.stderr?.on("data", (chunk) => emitErr(errBuffer.push(chunk)));
|
|
547
|
-
child.on("error", (err) => {
|
|
548
|
-
flush();
|
|
549
|
-
log(
|
|
550
|
-
`tip: external plan review launcher failed (${redactSecrets(err.message, redact)}). Manual: ${scriptRel} or /plan-external-review`
|
|
551
|
-
);
|
|
552
|
-
resolve({ invoked: true, exitCode: null, output });
|
|
553
|
-
});
|
|
554
|
-
child.on("close", (code) => {
|
|
555
|
-
flush();
|
|
556
|
-
if (code !== 0 && code !== null) {
|
|
557
|
-
log(
|
|
558
|
-
`tip: external plan review exited ${code} (ignored; does not fail the loop). Manual: ${scriptRel} or /plan-external-review`
|
|
559
|
-
);
|
|
560
|
-
}
|
|
561
|
-
resolve({ invoked: true, exitCode: code, output });
|
|
562
|
-
});
|
|
563
|
-
});
|
|
564
|
-
}
|
|
472
|
+
import { readFile as readFile2, rm, unlink } from "fs/promises";
|
|
473
|
+
import path3 from "path";
|
|
565
474
|
|
|
566
475
|
// src/plan-loop/persona-banners.ts
|
|
567
|
-
import
|
|
476
|
+
import path2 from "path";
|
|
568
477
|
import {
|
|
569
478
|
blue,
|
|
570
479
|
cyan,
|
|
@@ -600,7 +509,7 @@ function resolveColor(name, fallback) {
|
|
|
600
509
|
async function resolveCliPersonaId(root) {
|
|
601
510
|
try {
|
|
602
511
|
const cfg = await readJson(
|
|
603
|
-
|
|
512
|
+
path2.join(root, ".cursor", "context", "config.json")
|
|
604
513
|
);
|
|
605
514
|
const modes = cfg?.agentPersona?.modes ?? cfg?.workspaceSkin?.modes;
|
|
606
515
|
const id = modes?.[CLI_RUN_PLAN_MODE];
|
|
@@ -611,7 +520,7 @@ async function resolveCliPersonaId(root) {
|
|
|
611
520
|
}
|
|
612
521
|
async function loadPersonaPack(root, personaId) {
|
|
613
522
|
try {
|
|
614
|
-
const personaPath =
|
|
523
|
+
const personaPath = path2.join(root, "registry", "personas", "core", personaId, "persona.json");
|
|
615
524
|
const pack = await readJson(personaPath);
|
|
616
525
|
if (!pack || typeof pack.id !== "string") return null;
|
|
617
526
|
return pack;
|
|
@@ -659,119 +568,6 @@ function createPersonaBannerPrinter(persona) {
|
|
|
659
568
|
};
|
|
660
569
|
}
|
|
661
570
|
|
|
662
|
-
// src/plan-loop/sentinel.ts
|
|
663
|
-
import { readFile as readFile2 } from "fs/promises";
|
|
664
|
-
var SENTINEL_RE = /LOOP_TICK_RESULT:\s*(continue|stop(?:\s*[—-].*)?)/i;
|
|
665
|
-
function takeFromText(text) {
|
|
666
|
-
if (!text) return null;
|
|
667
|
-
const m = SENTINEL_RE.exec(text);
|
|
668
|
-
if (!m?.[1]) return null;
|
|
669
|
-
const raw = m[1].trim();
|
|
670
|
-
if (raw.toLowerCase().startsWith("stop")) {
|
|
671
|
-
const reason = raw.slice(4).replace(/^[—\-\s]+/, "").trim() || "requested by agent";
|
|
672
|
-
return { kind: "stop", reason };
|
|
673
|
-
}
|
|
674
|
-
return { kind: "continue" };
|
|
675
|
-
}
|
|
676
|
-
function parseSentinelFromLog(content) {
|
|
677
|
-
let lastJson = null;
|
|
678
|
-
let lastText = null;
|
|
679
|
-
let sawJson = false;
|
|
680
|
-
for (const line of content.split(/\r?\n/)) {
|
|
681
|
-
const trimmed = line.trim();
|
|
682
|
-
if (!trimmed) continue;
|
|
683
|
-
if (!trimmed.startsWith("{")) {
|
|
684
|
-
const hit = takeFromText(trimmed);
|
|
685
|
-
if (hit) lastText = hit;
|
|
686
|
-
continue;
|
|
687
|
-
}
|
|
688
|
-
try {
|
|
689
|
-
const ev = JSON.parse(trimmed);
|
|
690
|
-
sawJson = true;
|
|
691
|
-
if (ev.type === "result" && typeof ev.result === "string") {
|
|
692
|
-
const hit = takeFromText(ev.result);
|
|
693
|
-
if (hit) lastJson = hit;
|
|
694
|
-
}
|
|
695
|
-
const parts = ev.type === "assistant" ? ev.message?.content : void 0;
|
|
696
|
-
if (Array.isArray(parts)) {
|
|
697
|
-
for (const part of parts) {
|
|
698
|
-
if (part && typeof part === "object" && part.type === "text" && typeof part.text === "string") {
|
|
699
|
-
const hit = takeFromText(part.text);
|
|
700
|
-
if (hit) lastJson = hit;
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
} catch {
|
|
705
|
-
const hit = takeFromText(trimmed);
|
|
706
|
-
if (hit) lastText = hit;
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
return (sawJson ? lastJson : lastText) ?? { kind: "missing" };
|
|
710
|
-
}
|
|
711
|
-
function parseTickResultStatus(content) {
|
|
712
|
-
let last = null;
|
|
713
|
-
for (const line of content.split(/\r?\n/)) {
|
|
714
|
-
const trimmed = line.trim();
|
|
715
|
-
if (!trimmed.startsWith("{")) continue;
|
|
716
|
-
try {
|
|
717
|
-
const ev = JSON.parse(trimmed);
|
|
718
|
-
if (ev.type !== "result") continue;
|
|
719
|
-
const errors = Array.isArray(ev.errors) ? ev.errors.filter((e) => typeof e === "string") : [];
|
|
720
|
-
last = {
|
|
721
|
-
isError: ev.is_error === true,
|
|
722
|
-
...typeof ev.subtype === "string" ? { subtype: ev.subtype } : {},
|
|
723
|
-
errors
|
|
724
|
-
};
|
|
725
|
-
} catch {
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
return last;
|
|
729
|
-
}
|
|
730
|
-
async function parseTickResultStatusFromLogFile(logPath) {
|
|
731
|
-
try {
|
|
732
|
-
return parseTickResultStatus(await readFile2(logPath, "utf8"));
|
|
733
|
-
} catch {
|
|
734
|
-
return null;
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
async function parseSentinelFromLogFile(logPath) {
|
|
738
|
-
try {
|
|
739
|
-
const content = await readFile2(logPath, "utf8");
|
|
740
|
-
return parseSentinelFromLog(content);
|
|
741
|
-
} catch {
|
|
742
|
-
return { kind: "missing" };
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
function formatSentinelLine(sentinel) {
|
|
746
|
-
if (sentinel.kind === "continue") return "LOOP_TICK_RESULT: continue";
|
|
747
|
-
if (sentinel.kind === "stop") return `LOOP_TICK_RESULT: stop - ${sentinel.reason}`;
|
|
748
|
-
return "";
|
|
749
|
-
}
|
|
750
|
-
function sentinelFromTurn(turn) {
|
|
751
|
-
const fromResult = takeFromText(turn.resultText);
|
|
752
|
-
if (fromResult) return fromResult;
|
|
753
|
-
for (let i = turn.assistantTexts.length - 1; i >= 0; i--) {
|
|
754
|
-
const hit = takeFromText(turn.assistantTexts[i] ?? "");
|
|
755
|
-
if (hit) return hit;
|
|
756
|
-
}
|
|
757
|
-
return null;
|
|
758
|
-
}
|
|
759
|
-
function tickResultStatusFromTurn(turn) {
|
|
760
|
-
return {
|
|
761
|
-
isError: turn.isError,
|
|
762
|
-
...turn.subtype !== null ? { subtype: turn.subtype } : {},
|
|
763
|
-
errors: turn.errors
|
|
764
|
-
};
|
|
765
|
-
}
|
|
766
|
-
async function resolveTickResultStatus(lastResult, logPath, fromFile = parseTickResultStatusFromLogFile) {
|
|
767
|
-
if (lastResult) return tickResultStatusFromTurn(lastResult);
|
|
768
|
-
return fromFile(logPath);
|
|
769
|
-
}
|
|
770
|
-
async function resolveTickSentinel(lastResult, logPath, fromFile = parseSentinelFromLogFile) {
|
|
771
|
-
const fromTurn = lastResult ? sentinelFromTurn(lastResult) : null;
|
|
772
|
-
return fromTurn ?? fromFile(logPath);
|
|
773
|
-
}
|
|
774
|
-
|
|
775
571
|
// src/plan-loop/usage-limit.ts
|
|
776
572
|
var LIMIT_TEXT_RE = /\b(?:usage|rate)[ _-]?limit|\blimit (?:reached|exceeded)|\bquota (?:exceeded|reached)|\btoo many requests\b|\bout of (?:extra )?usage\b/i;
|
|
777
573
|
var NON_LIMIT_STATUSES = /* @__PURE__ */ new Set(["allowed", "allowed_warning"]);
|
|
@@ -980,7 +776,7 @@ async function runPlanLoop(opts) {
|
|
|
980
776
|
return finishRun(1, "no active plan", null);
|
|
981
777
|
}
|
|
982
778
|
const pending = async () => countPendingTodos(await readPlan(planPath));
|
|
983
|
-
landPlan =
|
|
779
|
+
landPlan = path3.basename(planPath);
|
|
984
780
|
if (statePaths.invalid !== void 0) {
|
|
985
781
|
say(
|
|
986
782
|
`${STATE_ROOT_ENV}=${statePaths.invalid} is not supported (use .cursor or .agent-kit); using .cursor.`,
|
|
@@ -1055,12 +851,12 @@ async function runPlanLoop(opts) {
|
|
|
1055
851
|
protocol: DRIVER_PROTOCOL_VERSION,
|
|
1056
852
|
command: "run-plan",
|
|
1057
853
|
backend: opts.backend.id,
|
|
1058
|
-
plan:
|
|
854
|
+
plan: path3.basename(planPath),
|
|
1059
855
|
pending: pendingAtStart,
|
|
1060
856
|
maxTicks: opts.maxTicks,
|
|
1061
857
|
hitl: opts.noHitl ? "off" : "driver"
|
|
1062
858
|
});
|
|
1063
|
-
say(`Active plan: ${
|
|
859
|
+
say(`Active plan: ${path3.basename(planPath)}`);
|
|
1064
860
|
say(`Pending to-dos: ${pendingAtStart} | max ticks: ${opts.maxTicks}`);
|
|
1065
861
|
say(`Backend: ${opts.backend.id}`);
|
|
1066
862
|
if (persona) {
|
|
@@ -1104,7 +900,7 @@ async function runPlanLoop(opts) {
|
|
|
1104
900
|
process.env[QUEUE_LEASE_SESSION_ENV] = lease.session;
|
|
1105
901
|
leaseSessionSet = true;
|
|
1106
902
|
restoreQueue = holdQueueStatus(opts.root, {
|
|
1107
|
-
plan:
|
|
903
|
+
plan: path3.basename(planPath),
|
|
1108
904
|
who: `agent-kit run-plan session ${lease.session}`,
|
|
1109
905
|
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1110
906
|
});
|
|
@@ -1218,10 +1014,10 @@ async function runPlanLoop(opts) {
|
|
|
1218
1014
|
endReason = "plan exhausted";
|
|
1219
1015
|
break;
|
|
1220
1016
|
}
|
|
1221
|
-
const logPath =
|
|
1017
|
+
const logPath = path3.join(logDir, `tick-${stamp()}.log`);
|
|
1222
1018
|
landLogPath = logPath;
|
|
1223
1019
|
landBackend = backend.id;
|
|
1224
|
-
const relLog =
|
|
1020
|
+
const relLog = path3.relative(opts.root, logPath);
|
|
1225
1021
|
if (!driver) console.log("");
|
|
1226
1022
|
const tickLine = `=== tick ${tick}/${opts.maxTicks} - pending: ${before} - log: ${relLog} ===`;
|
|
1227
1023
|
if (banners) banners.tickStart(tickLine);
|
|
@@ -1347,7 +1143,7 @@ async function runPlanLoop(opts) {
|
|
|
1347
1143
|
}
|
|
1348
1144
|
let logText = "";
|
|
1349
1145
|
try {
|
|
1350
|
-
logText = await
|
|
1146
|
+
logText = await readFile2(logPath, "utf8");
|
|
1351
1147
|
} catch {
|
|
1352
1148
|
}
|
|
1353
1149
|
limit = detectUsageLimit(logText);
|
|
@@ -1431,7 +1227,7 @@ async function runPlanLoop(opts) {
|
|
|
1431
1227
|
}
|
|
1432
1228
|
if (sentinel.kind === "continue") {
|
|
1433
1229
|
} else if (sentinel.kind === "stop") {
|
|
1434
|
-
say(
|
|
1230
|
+
say(formatAgentStopLine(sentinel));
|
|
1435
1231
|
stopReason = sentinel.reason;
|
|
1436
1232
|
endReason = `agent requested stop: ${sentinel.reason}`;
|
|
1437
1233
|
if (after === 0 || isPlanExhaustedReason(sentinel.reason)) {
|
|
@@ -1473,7 +1269,7 @@ async function runPlanLoop(opts) {
|
|
|
1473
1269
|
const finishDetail = `after ${tick} tick(s); pending: ${pendingNow}`;
|
|
1474
1270
|
if (banners) banners.phaseComplete(finishDetail);
|
|
1475
1271
|
say(
|
|
1476
|
-
`Loop finished after ${tick} tick(s). Pending now: ${pendingNow}. Logs in ${
|
|
1272
|
+
`Loop finished after ${tick} tick(s). Pending now: ${pendingNow}. Logs in ${path3.relative(opts.root, logDir)}/`
|
|
1477
1273
|
);
|
|
1478
1274
|
if (planExhausted || shouldArmExternalPlanReview({ pending: pendingNow, stopReason })) {
|
|
1479
1275
|
await armExternalPlanReview(opts.root, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isBranchInBase
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GQSSXDDK.js";
|
|
4
4
|
import {
|
|
5
5
|
GATE_EXIT_BRANCH_PREFIX,
|
|
6
6
|
GATE_EXIT_NOTE_DIR,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
isSafeBaseRef,
|
|
12
12
|
landGateExit,
|
|
13
13
|
resolveGateExitRefs
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-XGZOU4DS.js";
|
|
15
15
|
import {
|
|
16
16
|
ensurePathIgnored
|
|
17
17
|
} from "./chunk-MUTTNRX4.js";
|
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
ensureDispatchLogPath,
|
|
20
20
|
readCommandFile,
|
|
21
21
|
runHeadlessDispatch
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-KWYF7QNH.js";
|
|
23
23
|
import {
|
|
24
24
|
redactSecrets
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-IFBIO7VT.js";
|
|
26
26
|
import {
|
|
27
27
|
formatHitlSummary,
|
|
28
28
|
hitlExitCode
|