@dadado/agent-kit-cli 6.23.0 → 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-RKZQX6ZK.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-2IP4OO6R.js → chunk-2XLI7XEY.js} +1 -1
- package/dist/chunk-6M6UKECW.js +176 -0
- package/dist/{chunk-UJCATSYO.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-7TYA3GMI.js → chunk-C7SV7UP5.js} +7 -4
- package/dist/{chunk-F7YAAKYP.js → chunk-CIV42JGT.js} +7 -5
- package/dist/{chunk-CQHD6UKB.js → chunk-CXE6ASSX.js} +1 -0
- package/dist/{chunk-6BEFGKCU.js → chunk-EO5NGAYV.js} +1 -1
- package/dist/{chunk-MJJBIOSY.js → chunk-G5MQRP6M.js} +31 -13
- package/dist/chunk-GMG7ZH4E.js +357 -0
- package/dist/{chunk-5EBT3V7G.js → chunk-GQSSXDDK.js} +1 -1
- package/dist/{chunk-5LNHRL5E.js → chunk-H7RAFRRZ.js} +41 -245
- package/dist/{chunk-IESSMKOV.js → chunk-HSIHZWFF.js} +4 -4
- package/dist/{chunk-W3ZJVBNY.js → chunk-IFBIO7VT.js} +449 -418
- package/dist/{chunk-V2H57TFD.js → chunk-JG3CNGQM.js} +78 -170
- package/dist/{chunk-KDJ4ML7I.js → chunk-JGG574RK.js} +3 -3
- package/dist/{chunk-SGTTC2JP.js → chunk-KWYF7QNH.js} +1 -1
- package/dist/{chunk-CVZNSRXV.js → chunk-M4UL422I.js} +80 -15
- package/dist/{chunk-AWQ6KRFV.js → chunk-NJ2SUSWX.js} +1 -1
- package/dist/{chunk-DRZFWIBN.js → chunk-PIMGV3E5.js} +1 -1
- package/dist/{chunk-QNISTPPZ.js → chunk-QACMV46U.js} +3 -3
- package/dist/{chunk-5PSV76CQ.js → chunk-QLTGHJB3.js} +25 -6
- package/dist/{chunk-OYFCBYMP.js → chunk-QX55T4UX.js} +13 -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-SAQEEE6V.js → commands-UW2C2ZN4.js} +4 -4
- package/dist/{conflicts-5JOP4GX2.js → conflicts-RING6AHV.js} +6 -6
- package/dist/{contribute-BQKRT5GN.js → contribute-LSY75JZH.js} +5 -4
- package/dist/{countdown-25E5C7AR.js → countdown-SZ2P4XHB.js} +267 -23
- package/dist/{diff-6JSXBVSX.js → diff-NZVBVQSK.js} +13 -5
- package/dist/{doctor-I3MTHS7F.js → doctor-TJSXBVGV.js} +103 -17
- 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-WNA42CXE.js → hook-3VPKNSOO.js} +12 -10
- package/dist/index.js +27 -26
- package/dist/{init-FZ2UFPO7.js → init-UW2BJBO2.js} +21 -15
- package/dist/{install-CTLT3TSI.js → install-RQSI4CHG.js} +18 -15
- package/dist/installs-7TR4H4QH.js +222 -0
- package/dist/{mission-control-CRMCRZUU.js → mission-control-VSU6NT43.js} +1 -1
- package/dist/{queue-JW4VR33H.js → queue-JHYILLMX.js} +9 -9
- package/dist/{run-X2WOONTB.js → run-CQF5RM5X.js} +21 -21
- package/dist/{run-plan-4MOLLIES.js → run-plan-BEOCOJCF.js} +13 -13
- package/dist/{scan-K3T5RQLC.js → scan-7D3RMO34.js} +2 -1
- package/dist/{session-start-MV7A4263.js → session-start-QV7CEFRX.js} +16 -10
- package/dist/{sessions-UPFDWDMB.js → sessions-AWAAO3DU.js} +1 -1
- package/dist/{setup-global-VNADNTQ2.js → setup-global-ST4TT427.js} +8 -7
- package/dist/{status-SXA3OK5E.js → status-HUBPBGUU.js} +13 -10
- package/dist/update-DD5UZPGG.js +31 -0
- package/dist/update-all-YYUTXHGR.js +695 -0
- package/package.json +1 -1
- package/dist/chunk-4MR4QXMF.js +0 -52
- package/dist/chunk-HAFRAXGV.js +0 -17
- package/dist/update-RMAWXMCV.js +0 -304
|
@@ -5,10 +5,18 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
isBackendId,
|
|
7
7
|
isRequestedBackend
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-TOSAAQ5A.js";
|
|
9
|
+
import {
|
|
10
|
+
RedactingStreamBuffer,
|
|
11
|
+
claudeRedactions,
|
|
12
|
+
redactSecrets
|
|
13
|
+
} from "./chunk-IFBIO7VT.js";
|
|
9
14
|
import {
|
|
10
15
|
loadContextConfig
|
|
11
16
|
} from "./chunk-PFEUZXVT.js";
|
|
17
|
+
import {
|
|
18
|
+
fileExists
|
|
19
|
+
} from "./chunk-5B4DVO6C.js";
|
|
12
20
|
|
|
13
21
|
// src/plan-loop/model-roles.ts
|
|
14
22
|
var ROLE_CAPABILITIES = Object.freeze({
|
|
@@ -377,6 +385,224 @@ async function loadRolesContext(root, usePlan) {
|
|
|
377
385
|
};
|
|
378
386
|
}
|
|
379
387
|
|
|
388
|
+
// src/plan-loop/external-review.ts
|
|
389
|
+
import { spawn } from "child_process";
|
|
390
|
+
import path from "path";
|
|
391
|
+
var CANONICAL_REL = path.join(".cursor", "scripts", "plan-external-review.sh");
|
|
392
|
+
var FALLBACK_REL = path.join("scripts", "plan-external-review.sh");
|
|
393
|
+
function isPlanExhaustedReason(reason) {
|
|
394
|
+
const r = reason.trim().toLowerCase();
|
|
395
|
+
if (!r) return false;
|
|
396
|
+
if (r.includes("plan exhausted")) return true;
|
|
397
|
+
if (r.includes("nothing to do")) return true;
|
|
398
|
+
if (r.includes("no implementable")) return true;
|
|
399
|
+
if (/\ball\s+(implementable\s+)?to-?dos?\b/.test(r) && (r.includes("completed") || r.includes("done") || r.includes("exhausted"))) {
|
|
400
|
+
return true;
|
|
401
|
+
}
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
function shouldArmExternalPlanReview(input) {
|
|
405
|
+
if (input.pending === 0) return true;
|
|
406
|
+
if (input.stopReason && isPlanExhaustedReason(input.stopReason)) return true;
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
async function armExternalPlanReview(root, options = {}) {
|
|
410
|
+
const spawnFn = options.spawnFn ?? spawn;
|
|
411
|
+
const existsFn = options.existsFn ?? fileExists;
|
|
412
|
+
const log = options.log ?? ((line) => console.log(line));
|
|
413
|
+
const force = options.force === true;
|
|
414
|
+
const canonicalPath = path.join(root, CANONICAL_REL);
|
|
415
|
+
const fallbackPath = path.join(root, FALLBACK_REL);
|
|
416
|
+
let scriptPath = null;
|
|
417
|
+
let scriptRel = CANONICAL_REL;
|
|
418
|
+
if (await existsFn(canonicalPath)) {
|
|
419
|
+
scriptPath = canonicalPath;
|
|
420
|
+
scriptRel = CANONICAL_REL;
|
|
421
|
+
} else if (await existsFn(fallbackPath)) {
|
|
422
|
+
scriptPath = fallbackPath;
|
|
423
|
+
scriptRel = FALLBACK_REL;
|
|
424
|
+
}
|
|
425
|
+
if (!scriptPath) {
|
|
426
|
+
log(
|
|
427
|
+
`tip: ${CANONICAL_REL} missing (optional wrapper: ${FALLBACK_REL}). Manual: /plan-external-review (enable externalPlanReview in .cursor/context/config.json).`
|
|
428
|
+
);
|
|
429
|
+
return { invoked: false, exitCode: null, output: "" };
|
|
430
|
+
}
|
|
431
|
+
log("Plan exhausted: arming optional external plan review (opt-in handled by script)...");
|
|
432
|
+
const args = force ? [scriptPath, "--force", "--print"] : [scriptPath, "--print"];
|
|
433
|
+
const implementerModel = options.implementerModel?.trim();
|
|
434
|
+
if (implementerModel) args.push("--implementer-model", implementerModel);
|
|
435
|
+
return new Promise((resolve) => {
|
|
436
|
+
const child = spawnFn("bash", args, {
|
|
437
|
+
cwd: root,
|
|
438
|
+
env: { ...process.env, AGENT_KIT_HEADLESS: "1" }
|
|
439
|
+
});
|
|
440
|
+
const redact = claudeRedactions(process.env);
|
|
441
|
+
const outBuffer = new RedactingStreamBuffer(redact);
|
|
442
|
+
const errBuffer = new RedactingStreamBuffer(redact);
|
|
443
|
+
let output = "";
|
|
444
|
+
const emitOut = (s) => {
|
|
445
|
+
if (!s) return;
|
|
446
|
+
output += s;
|
|
447
|
+
if (options.writeOut) options.writeOut(s);
|
|
448
|
+
else process.stdout.write(s);
|
|
449
|
+
};
|
|
450
|
+
const emitErr = (s) => {
|
|
451
|
+
if (!s) return;
|
|
452
|
+
output += s;
|
|
453
|
+
process.stderr.write(s);
|
|
454
|
+
};
|
|
455
|
+
let flushed = false;
|
|
456
|
+
const flush = () => {
|
|
457
|
+
if (flushed) return;
|
|
458
|
+
flushed = true;
|
|
459
|
+
emitOut(outBuffer.flush());
|
|
460
|
+
emitErr(errBuffer.flush());
|
|
461
|
+
};
|
|
462
|
+
child.stdout?.on("data", (chunk) => emitOut(outBuffer.push(chunk)));
|
|
463
|
+
child.stderr?.on("data", (chunk) => emitErr(errBuffer.push(chunk)));
|
|
464
|
+
child.on("error", (err) => {
|
|
465
|
+
flush();
|
|
466
|
+
log(
|
|
467
|
+
`tip: external plan review launcher failed (${redactSecrets(err.message, redact)}). Manual: ${scriptRel} or /plan-external-review`
|
|
468
|
+
);
|
|
469
|
+
resolve({ invoked: true, exitCode: null, output });
|
|
470
|
+
});
|
|
471
|
+
child.on("close", (code) => {
|
|
472
|
+
flush();
|
|
473
|
+
if (code !== 0 && code !== null) {
|
|
474
|
+
log(
|
|
475
|
+
`tip: external plan review exited ${code} (ignored; does not fail the loop). Manual: ${scriptRel} or /plan-external-review`
|
|
476
|
+
);
|
|
477
|
+
}
|
|
478
|
+
resolve({ invoked: true, exitCode: code, output });
|
|
479
|
+
});
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// src/plan-loop/sentinel.ts
|
|
484
|
+
import { readFile } from "fs/promises";
|
|
485
|
+
var SENTINEL_RE = /LOOP_TICK_RESULT:\s*(continue|stop(?:\s*[—-].*)?)/i;
|
|
486
|
+
function takeFromText(text) {
|
|
487
|
+
if (!text) return null;
|
|
488
|
+
const m = SENTINEL_RE.exec(text);
|
|
489
|
+
if (!m?.[1]) return null;
|
|
490
|
+
const raw = m[1].trim();
|
|
491
|
+
if (raw.toLowerCase().startsWith("stop")) {
|
|
492
|
+
const reason = raw.slice(4).replace(/^[—\-\s]+/, "").trim() || "requested by agent";
|
|
493
|
+
return { kind: "stop", reason };
|
|
494
|
+
}
|
|
495
|
+
return { kind: "continue" };
|
|
496
|
+
}
|
|
497
|
+
function parseSentinelFromLog(content) {
|
|
498
|
+
let lastJson = null;
|
|
499
|
+
let lastText = null;
|
|
500
|
+
let sawJson = false;
|
|
501
|
+
for (const line of content.split(/\r?\n/)) {
|
|
502
|
+
const trimmed = line.trim();
|
|
503
|
+
if (!trimmed) continue;
|
|
504
|
+
if (!trimmed.startsWith("{")) {
|
|
505
|
+
const hit = takeFromText(trimmed);
|
|
506
|
+
if (hit) lastText = hit;
|
|
507
|
+
continue;
|
|
508
|
+
}
|
|
509
|
+
try {
|
|
510
|
+
const ev = JSON.parse(trimmed);
|
|
511
|
+
sawJson = true;
|
|
512
|
+
if (ev.type === "result" && typeof ev.result === "string") {
|
|
513
|
+
const hit = takeFromText(ev.result);
|
|
514
|
+
if (hit) lastJson = hit;
|
|
515
|
+
}
|
|
516
|
+
const parts = ev.type === "assistant" ? ev.message?.content : void 0;
|
|
517
|
+
if (Array.isArray(parts)) {
|
|
518
|
+
for (const part of parts) {
|
|
519
|
+
if (part && typeof part === "object" && part.type === "text" && typeof part.text === "string") {
|
|
520
|
+
const hit = takeFromText(part.text);
|
|
521
|
+
if (hit) lastJson = hit;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
} catch {
|
|
526
|
+
const hit = takeFromText(trimmed);
|
|
527
|
+
if (hit) lastText = hit;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
return (sawJson ? lastJson : lastText) ?? { kind: "missing" };
|
|
531
|
+
}
|
|
532
|
+
function parseTickResultStatus(content) {
|
|
533
|
+
let last = null;
|
|
534
|
+
for (const line of content.split(/\r?\n/)) {
|
|
535
|
+
const trimmed = line.trim();
|
|
536
|
+
if (!trimmed.startsWith("{")) continue;
|
|
537
|
+
try {
|
|
538
|
+
const ev = JSON.parse(trimmed);
|
|
539
|
+
if (ev.type !== "result") continue;
|
|
540
|
+
const errors = Array.isArray(ev.errors) ? ev.errors.filter((e) => typeof e === "string") : [];
|
|
541
|
+
last = {
|
|
542
|
+
isError: ev.is_error === true,
|
|
543
|
+
...typeof ev.subtype === "string" ? { subtype: ev.subtype } : {},
|
|
544
|
+
errors
|
|
545
|
+
};
|
|
546
|
+
} catch {
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
return last;
|
|
550
|
+
}
|
|
551
|
+
async function parseTickResultStatusFromLogFile(logPath) {
|
|
552
|
+
try {
|
|
553
|
+
return parseTickResultStatus(await readFile(logPath, "utf8"));
|
|
554
|
+
} catch {
|
|
555
|
+
return null;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
async function parseSentinelFromLogFile(logPath) {
|
|
559
|
+
try {
|
|
560
|
+
const content = await readFile(logPath, "utf8");
|
|
561
|
+
return parseSentinelFromLog(content);
|
|
562
|
+
} catch {
|
|
563
|
+
return { kind: "missing" };
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
function formatSentinelLine(sentinel) {
|
|
567
|
+
if (sentinel.kind === "continue") return "LOOP_TICK_RESULT: continue";
|
|
568
|
+
if (sentinel.kind === "stop") return `LOOP_TICK_RESULT: stop - ${sentinel.reason}`;
|
|
569
|
+
return "";
|
|
570
|
+
}
|
|
571
|
+
var AGENT_STOP_LINE_PREFIX = "Agent requested stop: ";
|
|
572
|
+
function formatAgentStopLine(sentinel) {
|
|
573
|
+
return `${AGENT_STOP_LINE_PREFIX}${formatSentinelLine(sentinel)}`;
|
|
574
|
+
}
|
|
575
|
+
var AGENT_STOP_LINE_RE = /^Agent requested stop: LOOP_TICK_RESULT: stop - (.*)$/;
|
|
576
|
+
function parseAgentStopLine(line) {
|
|
577
|
+
const m = AGENT_STOP_LINE_RE.exec(line.replace(/\r$/, ""));
|
|
578
|
+
if (!m) return null;
|
|
579
|
+
return m[1]?.trim() || "requested by agent";
|
|
580
|
+
}
|
|
581
|
+
function sentinelFromTurn(turn) {
|
|
582
|
+
const fromResult = takeFromText(turn.resultText);
|
|
583
|
+
if (fromResult) return fromResult;
|
|
584
|
+
for (let i = turn.assistantTexts.length - 1; i >= 0; i--) {
|
|
585
|
+
const hit = takeFromText(turn.assistantTexts[i] ?? "");
|
|
586
|
+
if (hit) return hit;
|
|
587
|
+
}
|
|
588
|
+
return null;
|
|
589
|
+
}
|
|
590
|
+
function tickResultStatusFromTurn(turn) {
|
|
591
|
+
return {
|
|
592
|
+
isError: turn.isError,
|
|
593
|
+
...turn.subtype !== null ? { subtype: turn.subtype } : {},
|
|
594
|
+
errors: turn.errors
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
async function resolveTickResultStatus(lastResult, logPath, fromFile = parseTickResultStatusFromLogFile) {
|
|
598
|
+
if (lastResult) return tickResultStatusFromTurn(lastResult);
|
|
599
|
+
return fromFile(logPath);
|
|
600
|
+
}
|
|
601
|
+
async function resolveTickSentinel(lastResult, logPath, fromFile = parseSentinelFromLogFile) {
|
|
602
|
+
const fromTurn = lastResult ? sentinelFromTurn(lastResult) : null;
|
|
603
|
+
return fromTurn ?? fromFile(logPath);
|
|
604
|
+
}
|
|
605
|
+
|
|
380
606
|
export {
|
|
381
607
|
CLAUDE_SUBAGENT_MODEL_ENV,
|
|
382
608
|
readPlanRoleOverrides,
|
|
@@ -387,5 +613,13 @@ export {
|
|
|
387
613
|
describeIdenticalReviewModel,
|
|
388
614
|
describeSameFamilyReviewModel,
|
|
389
615
|
resolveReviewJobRole,
|
|
390
|
-
loadRolesContext
|
|
616
|
+
loadRolesContext,
|
|
617
|
+
isPlanExhaustedReason,
|
|
618
|
+
shouldArmExternalPlanReview,
|
|
619
|
+
armExternalPlanReview,
|
|
620
|
+
formatSentinelLine,
|
|
621
|
+
formatAgentStopLine,
|
|
622
|
+
parseAgentStopLine,
|
|
623
|
+
resolveTickResultStatus,
|
|
624
|
+
resolveTickSentinel
|
|
391
625
|
};
|