@dadado/agent-kit-cli 6.20.0 → 6.22.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/dashboard/dashboard-data.mjs +18 -0
- package/dashboard/dashboard.html +2 -2
- package/dashboard/lib/live-refresh.mjs +1 -0
- package/dashboard/lib/semantic-model.mjs +84 -0
- package/dist/{add-47WDZNCP.js → add-YVDIFP4N.js} +3 -3
- package/dist/{chunk-PCJR7STN.js → chunk-2FKAKFMH.js} +1 -1
- package/dist/{chunk-CFQYATWP.js → chunk-4SEQ76BQ.js} +3 -3
- package/dist/{chunk-4W2BD3BI.js → chunk-5HH3HSUR.js} +2 -2
- package/dist/{chunk-XBK654NO.js → chunk-BCU54M2P.js} +1 -1
- package/dist/{chunk-MPCNPZJZ.js → chunk-CQHD6UKB.js} +1 -0
- package/dist/{chunk-UATQQDVR.js → chunk-DZCLMIAS.js} +95 -1
- package/dist/{chunk-6XJZLH53.js → chunk-EYNSSL6B.js} +93 -7
- package/dist/{chunk-BVQRECND.js → chunk-GT5R7W66.js} +1 -1
- package/dist/{chunk-PHSXV6WI.js → chunk-GV4VKIPO.js} +2 -2
- package/dist/{chunk-U23SLQGX.js → chunk-IESSMKOV.js} +3 -1
- package/dist/{chunk-VLT7UHI2.js → chunk-LDZAK5DU.js} +1 -1
- package/dist/{chunk-52TVPSBL.js → chunk-MGIPA6SD.js} +1 -1
- package/dist/{chunk-2QGH6YCT.js → chunk-SDJIMC5S.js} +2 -2
- package/dist/{chunk-6GNVGHH4.js → chunk-WHBGJ7IJ.js} +3 -3
- package/dist/{chunk-DEEOPP2G.js → chunk-XZQM55BK.js} +2 -2
- package/dist/{chunk-XIWJL57Q.js → chunk-YRBRYTM5.js} +8 -8
- package/dist/{chunk-TU4UG4DB.js → chunk-ZJDJCMQO.js} +9 -1
- package/dist/{chunk-3ROLNGCM.js → chunk-ZNY32NK2.js} +1 -1
- package/dist/{commands-7QFWLW3V.js → commands-LEBG6DMD.js} +2 -2
- package/dist/{conflicts-7T7KKQOY.js → conflicts-FJD3IVPQ.js} +1 -1
- package/dist/{contribute-3HWO3HVM.js → contribute-XPAR2JER.js} +4 -4
- package/dist/{countdown-7ONIVAG6.js → countdown-25E5C7AR.js} +24 -6
- package/dist/{diff-Y2SWY73V.js → diff-KFID4SX3.js} +5 -5
- package/dist/{doctor-5HD6HWGA.js → doctor-J2GJFTSE.js} +9 -9
- package/dist/{hook-R3IUBLCU.js → hook-HV6U3ANI.js} +6 -6
- package/dist/index.js +18 -18
- package/dist/{init-UZU2UU5J.js → init-47WA2SCG.js} +12 -12
- package/dist/{install-QZSYPAH6.js → install-Y63HEM4G.js} +12 -12
- package/dist/{mission-control-QJBSZVNI.js → mission-control-CRMCRZUU.js} +1 -1
- package/dist/{run-PFANZJ5Y.js → run-Z2GHNVBO.js} +25 -10
- package/dist/{run-plan-7EB4ERSQ.js → run-plan-XA7MYOQ3.js} +8 -4
- package/dist/{session-start-UJ7GUO5V.js → session-start-PEVTDMOZ.js} +6 -6
- package/dist/{sessions-MQ3TXULD.js → sessions-6IGVH467.js} +1 -1
- package/dist/{setup-global-BQZKKXZY.js → setup-global-KBJL7QRD.js} +6 -6
- package/dist/{status-2FEGHEF6.js → status-3UGVDIO6.js} +7 -7
- package/dist/{update-IKLNUSEE.js → update-4UQHGENC.js} +10 -10
- package/package.json +1 -1
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
EXTERNAL_REPORT_FILE_RE,
|
|
46
46
|
extractChatSnippet,
|
|
47
47
|
FIELD_REPORT_CADENCE_LEDGER_REL,
|
|
48
|
+
FIELD_REPORT_PLAN_VERDICTS_REL,
|
|
48
49
|
FLIGHT_LOG_LEDGER_REL,
|
|
49
50
|
MAX_AGENT_PROMPTS,
|
|
50
51
|
MAX_EXTERNAL_REPORTS,
|
|
@@ -53,6 +54,7 @@ import {
|
|
|
53
54
|
parseCadenceLedger,
|
|
54
55
|
parseExternalReport,
|
|
55
56
|
parseFieldReportDismissals,
|
|
57
|
+
parseFieldReportPlanVerdicts,
|
|
56
58
|
parseFieldReportReviewCadenceConfig,
|
|
57
59
|
parseFlightLogLedger,
|
|
58
60
|
parseHandoffMarkdown,
|
|
@@ -1636,6 +1638,21 @@ function collectFieldReportDismissedIds() {
|
|
|
1636
1638
|
}
|
|
1637
1639
|
}
|
|
1638
1640
|
|
|
1641
|
+
/**
|
|
1642
|
+
* Local per-plan verdicts for the Field Report owed set (plan basenames and
|
|
1643
|
+
* Ask provenance only). Missing or unreadable file → [].
|
|
1644
|
+
*/
|
|
1645
|
+
function collectFieldReportPlanVerdicts() {
|
|
1646
|
+
const verdictsPath = join(ROOT, FIELD_REPORT_PLAN_VERDICTS_REL);
|
|
1647
|
+
if (!existsSync(verdictsPath)) return [];
|
|
1648
|
+
try {
|
|
1649
|
+
const raw = JSON.parse(readFileSync(verdictsPath, "utf-8"));
|
|
1650
|
+
return parseFieldReportPlanVerdicts(raw).verdicts;
|
|
1651
|
+
} catch {
|
|
1652
|
+
return [];
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1639
1656
|
/**
|
|
1640
1657
|
* Local Current mission timing ledger. Missing or unreadable → empty ledger.
|
|
1641
1658
|
* Gitignored observation store; not a UI mutation API.
|
|
@@ -1747,6 +1764,7 @@ let finalTimingLedger = null;
|
|
|
1747
1764
|
externalReports: collectExternalReports(),
|
|
1748
1765
|
subagentRuns: collectSubagentRuns(),
|
|
1749
1766
|
dismissedIds: collectFieldReportDismissedIds(),
|
|
1767
|
+
planVerdicts: collectFieldReportPlanVerdicts(),
|
|
1750
1768
|
archivedPlanFiles,
|
|
1751
1769
|
agents: SNAPSHOT.agents,
|
|
1752
1770
|
skills: SNAPSHOT.skills,
|
package/dashboard/dashboard.html
CHANGED
|
@@ -6335,7 +6335,7 @@ function renderRolesFieldset(cfg) {
|
|
|
6335
6335
|
<select id="config-role-reviewer-enabled" name="roleReviewerEnabled" data-focus-key="config-role-reviewer-enabled">
|
|
6336
6336
|
${roleSelectHtml(['on', 'off'], enabled, 'Not set (Audits section)')}
|
|
6337
6337
|
</select>
|
|
6338
|
-
<span class="config-hint">
|
|
6338
|
+
<span class="config-hint">On or off here wins over the Audits switch; not set follows it. The identical model as the worker is refused; another model of the same family runs with a warning.</span>
|
|
6339
6339
|
</div>
|
|
6340
6340
|
<div class="config-row">
|
|
6341
6341
|
<label for="config-role-reviewer-scope">Reviewer scope</label>
|
|
@@ -6501,7 +6501,7 @@ function renderConfigSection(d) {
|
|
|
6501
6501
|
<div class="config-row">
|
|
6502
6502
|
<label for="config-epr-reviewerModel">Reviewer model</label>
|
|
6503
6503
|
<input type="text" id="config-epr-reviewerModel" name="eprReviewerModel" value="${escapeAttr(epr.reviewerModel || 'sonnet')}" maxlength="64" data-focus-key="config-epr-reviewerModel" />
|
|
6504
|
-
<span class="config-hint">Claude default sonnet (auto permission mode). Must
|
|
6504
|
+
<span class="config-hint">Claude default sonnet (auto permission mode). Must not be the identical model of the implementer stamp (Auto/Auto refused); the Model roles reviewer model is read first.</span>
|
|
6505
6505
|
</div>
|
|
6506
6506
|
<div class="config-row">
|
|
6507
6507
|
<label for="config-epr-advisorModel">Advisor model</label>
|
|
@@ -36,6 +36,7 @@ export const SNAPSHOT_REPO_SOURCE_RELS = Object.freeze([
|
|
|
36
36
|
".cursor/context/current",
|
|
37
37
|
".cursor/context/readiness.json",
|
|
38
38
|
".cursor/context/field-report-dismissals.json",
|
|
39
|
+
".cursor/context/field-report-plan-verdicts.json",
|
|
39
40
|
".cursor/context/mission-timing.json",
|
|
40
41
|
".cursor/context/flight-log.json",
|
|
41
42
|
".cursor/context/test-results.json",
|
|
@@ -320,6 +320,79 @@ export function dismissedAttentionIds(parsed) {
|
|
|
320
320
|
return (parsed?.dismissals || []).map((d) => d.id).filter(Boolean);
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
+
/** Local per-plan verdict store for the Field Report owed set (gitignored). */
|
|
324
|
+
export const FIELD_REPORT_PLAN_VERDICTS_REL = ".cursor/context/field-report-plan-verdicts.json";
|
|
325
|
+
|
|
326
|
+
/** Verdicts that take a plan out of the owed set. `Keep owed` writes no row. */
|
|
327
|
+
export const FIELD_REPORT_PLAN_VERDICT_VALUES = Object.freeze(["delivered-nothing", "superseded"]);
|
|
328
|
+
|
|
329
|
+
const PLAN_VERDICT_BASENAME_RE = /^[A-Za-z0-9._-]+\.plan\.md$/i;
|
|
330
|
+
const MAX_PLAN_VERDICT_ASK = 160;
|
|
331
|
+
const MAX_PLAN_VERDICT_NOTE = 120;
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Parse `.cursor/context/field-report-plan-verdicts.json`. Missing or malformed
|
|
335
|
+
* input yields an empty list (never throws). One row per plan basename: a later
|
|
336
|
+
* row for the same basename (case-insensitive) replaces the earlier one. A row
|
|
337
|
+
* counts only with a known verdict and a non-empty `ask` (the operator reply
|
|
338
|
+
* that produced it): a verdict without Ask provenance leaves the plan owed.
|
|
339
|
+
* Unknown fields are dropped so review prose cannot ride along.
|
|
340
|
+
* @param {unknown} raw
|
|
341
|
+
* @returns {{ verdicts: { plan: string, verdict: 'delivered-nothing'|'superseded', ask: string, at?: string, note?: string }[] }}
|
|
342
|
+
*/
|
|
343
|
+
export function parseFieldReportPlanVerdicts(raw) {
|
|
344
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
345
|
+
return { verdicts: [] };
|
|
346
|
+
}
|
|
347
|
+
const list = Array.isArray(/** @type {{ verdicts?: unknown }} */ (raw).verdicts)
|
|
348
|
+
? /** @type {{ verdicts: unknown[] }} */ (raw).verdicts
|
|
349
|
+
: [];
|
|
350
|
+
/** @type {Map<string, { plan: string, verdict: 'delivered-nothing'|'superseded', ask: string, at?: string, note?: string }>} */
|
|
351
|
+
const byPlan = new Map();
|
|
352
|
+
for (const entry of list) {
|
|
353
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) continue;
|
|
354
|
+
const plan = typeof entry.plan === "string" ? entry.plan.trim() : "";
|
|
355
|
+
if (!PLAN_VERDICT_BASENAME_RE.test(plan)) continue;
|
|
356
|
+
const verdict = typeof entry.verdict === "string" ? entry.verdict.trim() : "";
|
|
357
|
+
if (!FIELD_REPORT_PLAN_VERDICT_VALUES.includes(verdict)) continue;
|
|
358
|
+
const ask = typeof entry.ask === "string" ? entry.ask.trim() : "";
|
|
359
|
+
if (!ask) continue;
|
|
360
|
+
const row = {
|
|
361
|
+
plan,
|
|
362
|
+
verdict: /** @type {'delivered-nothing'|'superseded'} */ (verdict),
|
|
363
|
+
ask: ask.slice(0, MAX_PLAN_VERDICT_ASK),
|
|
364
|
+
};
|
|
365
|
+
if (typeof entry.at === "string" && entry.at.trim()) {
|
|
366
|
+
row.at = entry.at.trim();
|
|
367
|
+
}
|
|
368
|
+
if (typeof entry.note === "string" && entry.note.trim()) {
|
|
369
|
+
row.note = entry.note.trim().slice(0, MAX_PLAN_VERDICT_NOTE);
|
|
370
|
+
}
|
|
371
|
+
const key = plan.toLowerCase();
|
|
372
|
+
byPlan.delete(key);
|
|
373
|
+
byPlan.set(key, row);
|
|
374
|
+
}
|
|
375
|
+
return { verdicts: [...byPlan.values()] };
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Lower-cased plan basenames that carry a verdict. Accepts parsed rows or bare
|
|
380
|
+
* basenames; anything else is ignored.
|
|
381
|
+
* @param {unknown} planVerdicts
|
|
382
|
+
* @returns {Set<string>}
|
|
383
|
+
*/
|
|
384
|
+
function verdictPlanKeys(planVerdicts) {
|
|
385
|
+
const keys = new Set();
|
|
386
|
+
for (const entry of Array.isArray(planVerdicts) ? planVerdicts : []) {
|
|
387
|
+
const plan =
|
|
388
|
+
typeof entry === "string" ? entry : entry && typeof entry === "object" ? entry.plan : "";
|
|
389
|
+
if (typeof plan !== "string") continue;
|
|
390
|
+
const base = plan.split("/").pop().trim().toLowerCase();
|
|
391
|
+
if (PLAN_VERDICT_BASENAME_RE.test(base)) keys.add(base);
|
|
392
|
+
}
|
|
393
|
+
return keys;
|
|
394
|
+
}
|
|
395
|
+
|
|
323
396
|
/** Relative path of the gitignored mission timing ledger (local observation). */
|
|
324
397
|
export const MISSION_TIMING_LEDGER_REL = ".cursor/context/mission-timing.json";
|
|
325
398
|
|
|
@@ -1038,6 +1111,10 @@ export function classifyOwedPlan(plan, lifecycle, opts = {}) {
|
|
|
1038
1111
|
* `TERMINAL_FIELD_REPORT_LIFECYCLES` stays unchanged: it also drives prompt
|
|
1039
1112
|
* clear and report demotion.
|
|
1040
1113
|
* Owed targets also carry `classification` and one `evidenceLine` (classifyOwedPlan).
|
|
1114
|
+
* A plan with an operator verdict row (`opts.planVerdicts`, see
|
|
1115
|
+
* parseFieldReportPlanVerdicts) is never owed. Untriaged monitors are not
|
|
1116
|
+
* affected: a verdict never hides a review that exists.
|
|
1117
|
+
* @param {{ planVerdicts?: ({ plan: string } | string)[] }} [opts]
|
|
1041
1118
|
* @returns {{ kind: 'report'|'owed', planFile: string, slug: string, path: string, lifecycle?: string, completedTodoIds?: string[], totalTodos?: number, classification?: string, evidenceLine?: string }[]}
|
|
1042
1119
|
*/
|
|
1043
1120
|
export function listUnreviewedReviewTargets(
|
|
@@ -1045,10 +1122,12 @@ export function listUnreviewedReviewTargets(
|
|
|
1045
1122
|
handoff,
|
|
1046
1123
|
externalReports = [],
|
|
1047
1124
|
archivedPlanFiles = [],
|
|
1125
|
+
opts = {},
|
|
1048
1126
|
) {
|
|
1049
1127
|
const targets = [];
|
|
1050
1128
|
const seenPlans = new Set();
|
|
1051
1129
|
const monitorSlugs = new Set();
|
|
1130
|
+
const verdictPlans = verdictPlanKeys(opts?.planVerdicts);
|
|
1052
1131
|
|
|
1053
1132
|
for (const report of externalReports || []) {
|
|
1054
1133
|
if (!report || !report.file) continue;
|
|
@@ -1080,6 +1159,7 @@ export function listUnreviewedReviewTargets(
|
|
|
1080
1159
|
if (!slug || monitorSlugs.has(normalizeSlug(slug))) continue;
|
|
1081
1160
|
const stats = todoStats(plan);
|
|
1082
1161
|
if (stats.completed === 0) continue;
|
|
1162
|
+
if (verdictPlans.has(planFile.toLowerCase())) continue;
|
|
1083
1163
|
seenPlans.add(planFile);
|
|
1084
1164
|
targets.push({
|
|
1085
1165
|
kind: "owed",
|
|
@@ -3269,6 +3349,7 @@ export function buildAttentionItems({
|
|
|
3269
3349
|
agentPrompts = [],
|
|
3270
3350
|
externalReports = [],
|
|
3271
3351
|
dismissedIds = [],
|
|
3352
|
+
planVerdicts = [],
|
|
3272
3353
|
archivedPlanFiles = [],
|
|
3273
3354
|
readinessPending = [],
|
|
3274
3355
|
deferredCheckIds = [],
|
|
@@ -3308,6 +3389,7 @@ export function buildAttentionItems({
|
|
|
3308
3389
|
handoff,
|
|
3309
3390
|
externalReports,
|
|
3310
3391
|
archivedPlanFiles,
|
|
3392
|
+
{ planVerdicts },
|
|
3311
3393
|
);
|
|
3312
3394
|
const cadenceItem = buildCadenceAttentionItem(cadenceLedger, unreviewed, {
|
|
3313
3395
|
enabled: cadenceOpts.enabled,
|
|
@@ -4101,6 +4183,7 @@ export function buildMissionControlView({
|
|
|
4101
4183
|
externalReports = [],
|
|
4102
4184
|
subagentRuns = [],
|
|
4103
4185
|
dismissedIds = [],
|
|
4186
|
+
planVerdicts = [],
|
|
4104
4187
|
archivedPlanFiles = [],
|
|
4105
4188
|
agents = [],
|
|
4106
4189
|
skills = [],
|
|
@@ -4184,6 +4267,7 @@ export function buildMissionControlView({
|
|
|
4184
4267
|
agentPrompts,
|
|
4185
4268
|
externalReports,
|
|
4186
4269
|
dismissedIds,
|
|
4270
|
+
planVerdicts,
|
|
4187
4271
|
archivedPlanFiles,
|
|
4188
4272
|
readinessPending: allowlistReadinessPending(readinessPending),
|
|
4189
4273
|
deferredCheckIds,
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
REGISTRY_CLI_ARGS,
|
|
7
7
|
resolveRegistryFromCli
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BCU54M2P.js";
|
|
9
9
|
import {
|
|
10
10
|
logger
|
|
11
11
|
} from "./chunk-ZB43YMHW.js";
|
|
@@ -22,8 +22,8 @@ import {
|
|
|
22
22
|
resolveProtectedGlobs,
|
|
23
23
|
saveManifest,
|
|
24
24
|
upsertIdList
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-LDZAK5DU.js";
|
|
26
|
+
import "./chunk-ZJDJCMQO.js";
|
|
27
27
|
import {
|
|
28
28
|
KIT_VERSION
|
|
29
29
|
} from "./chunk-7HDQEK6T.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
managedPairs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZNY32NK2.js";
|
|
4
4
|
import {
|
|
5
5
|
isProtectedPath,
|
|
6
6
|
resolveProtectedGlobs
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LDZAK5DU.js";
|
|
8
8
|
import {
|
|
9
9
|
resolveContained
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ZJDJCMQO.js";
|
|
11
11
|
|
|
12
12
|
// src/lifecycle/diff.ts
|
|
13
13
|
import { readFile } from "fs/promises";
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
diffAgainstRegistry,
|
|
8
8
|
summarizeDiff
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4SEQ76BQ.js";
|
|
10
10
|
import {
|
|
11
11
|
DEFAULT_REGISTRY_URL,
|
|
12
12
|
assertSafeRegistrySource,
|
|
13
13
|
loadAgentKitManifest,
|
|
14
14
|
resolveRegistryRoot
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-LDZAK5DU.js";
|
|
16
16
|
import {
|
|
17
17
|
KIT_PACKAGE_SPEC,
|
|
18
18
|
KIT_VERSION
|
|
@@ -39,6 +39,7 @@ var SNAPSHOT_REPO_SOURCE_RELS = Object.freeze([
|
|
|
39
39
|
".cursor/context/current",
|
|
40
40
|
".cursor/context/readiness.json",
|
|
41
41
|
".cursor/context/field-report-dismissals.json",
|
|
42
|
+
".cursor/context/field-report-plan-verdicts.json",
|
|
42
43
|
".cursor/context/mission-timing.json",
|
|
43
44
|
".cursor/context/flight-log.json",
|
|
44
45
|
".cursor/context/test-results.json",
|
|
@@ -257,6 +257,91 @@ function describeResolvedRoles(input) {
|
|
|
257
257
|
const sub = input.subworker?.model ? `, subworker ${input.subworker.model} (${input.subworker.source})` : "";
|
|
258
258
|
return `roles: worker ${input.backendId} (${input.backendSource}), model ${model}${sub}`;
|
|
259
259
|
}
|
|
260
|
+
function resolveReviewerRole(roles, externalPlanReview) {
|
|
261
|
+
const r = roles?.reviewer;
|
|
262
|
+
const legacyOn = isPlainObject(externalPlanReview) && externalPlanReview.enabled === true;
|
|
263
|
+
const fields = {
|
|
264
|
+
...r?.backend ? { backend: r.backend } : {},
|
|
265
|
+
...r?.model ? { model: r.model } : {},
|
|
266
|
+
...r?.advisorModel ? { advisorModel: r.advisorModel } : {}
|
|
267
|
+
};
|
|
268
|
+
if (r?.enabled === false || r?.scope === "off") {
|
|
269
|
+
return { scope: "off", source: "roles", ...fields };
|
|
270
|
+
}
|
|
271
|
+
const on = r?.enabled === true || legacyOn;
|
|
272
|
+
const source = r?.enabled === true ? "roles" : legacyOn ? "externalPlanReview" : "default";
|
|
273
|
+
if (!on) return { scope: "off", source, ...fields };
|
|
274
|
+
return { scope: r?.scope ?? "plan", source, ...fields };
|
|
275
|
+
}
|
|
276
|
+
function normalizeReviewModelId(raw) {
|
|
277
|
+
const id = (raw ?? "").toLowerCase().replace(/\s+/g, "").replace(/\[.*$/, "");
|
|
278
|
+
if (id === "" || id === "auto" || id === "cursor-auto" || id === "cursorauto" || id === "default")
|
|
279
|
+
return "auto";
|
|
280
|
+
return id;
|
|
281
|
+
}
|
|
282
|
+
var FAMILY_PATTERNS = [
|
|
283
|
+
[
|
|
284
|
+
"haiku",
|
|
285
|
+
/^(haiku|claude-haiku|claude-3-haiku.*|claude-3\.5-haiku.*|claude-3-5-haiku.*|claude-haiku-.*|claude-4-haiku.*|claude-4\.5-haiku.*)$/
|
|
286
|
+
],
|
|
287
|
+
[
|
|
288
|
+
"opus",
|
|
289
|
+
/^(opus|claude-opus|claude-3-opus.*|claude-opus-.*|claude-4-opus.*|claude-4\.5-opus.*)$/
|
|
290
|
+
],
|
|
291
|
+
[
|
|
292
|
+
"sonnet",
|
|
293
|
+
/^(sonnet|claude-sonnet|claude-3-sonnet.*|claude-3\.5-sonnet.*|claude-3-5-sonnet.*|claude-3-7-sonnet.*|claude-sonnet-.*|claude-4-sonnet.*|claude-4\.5-sonnet.*)$/
|
|
294
|
+
],
|
|
295
|
+
["fable", /^(fable|claude-fable|claude-fable-.*)$/],
|
|
296
|
+
["composer", /^(composer|composer-.*|cursor-composer.*)$/],
|
|
297
|
+
["grok", /^(grok|grok-.*)$/]
|
|
298
|
+
];
|
|
299
|
+
function reviewModelFamily(raw) {
|
|
300
|
+
const id = normalizeReviewModelId(raw);
|
|
301
|
+
for (const [family, pattern] of FAMILY_PATTERNS) if (pattern.test(id)) return family;
|
|
302
|
+
return id;
|
|
303
|
+
}
|
|
304
|
+
function isFamilyAlias(id, family) {
|
|
305
|
+
return id === family || id === `claude-${family}` || id === `cursor-${family}`;
|
|
306
|
+
}
|
|
307
|
+
function reviewModelRelation(implementer, reviewer) {
|
|
308
|
+
const a = normalizeReviewModelId(implementer);
|
|
309
|
+
const b = normalizeReviewModelId(reviewer);
|
|
310
|
+
if (a === b) return "identical";
|
|
311
|
+
const fa = reviewModelFamily(a);
|
|
312
|
+
const fb = reviewModelFamily(b);
|
|
313
|
+
if (fa !== fb) return "different";
|
|
314
|
+
if (isFamilyAlias(a, fa) || isFamilyAlias(b, fb)) return "identical";
|
|
315
|
+
return "same-family";
|
|
316
|
+
}
|
|
317
|
+
function describeIdenticalReviewModel(implementer, reviewer) {
|
|
318
|
+
return `reviewer model ${reviewer} is the implementer model (${implementer}): identical-model review is refused, Auto/Auto and a family alias against an id of that family included. This is not a silent self-review; set roles.reviewer.model to a different model`;
|
|
319
|
+
}
|
|
320
|
+
function describeSameFamilyReviewModel(implementer, reviewer) {
|
|
321
|
+
return `reviewer model ${reviewer} and implementer model ${implementer} are the same family (${reviewModelFamily(reviewer)}): the review runs, as a second read by a different model of one family`;
|
|
322
|
+
}
|
|
323
|
+
function resolveReviewJobRole(input) {
|
|
324
|
+
const flagBackend = input.flagBackend?.trim() ?? "";
|
|
325
|
+
const flagModel = input.flagModel?.trim() ?? "";
|
|
326
|
+
const reviewer = input.roles?.reviewer;
|
|
327
|
+
const backend = flagBackend || reviewer?.backend || "auto";
|
|
328
|
+
const backendSource = flagBackend ? "flag" : reviewer?.backend ? "config" : "default";
|
|
329
|
+
const model = flagModel || (flagBackend ? "" : reviewer?.model ?? "");
|
|
330
|
+
const out = {
|
|
331
|
+
backend,
|
|
332
|
+
backendSource,
|
|
333
|
+
...model ? { model, modelSource: flagModel ? "flag" : "config" } : {}
|
|
334
|
+
};
|
|
335
|
+
const implementer = input.roles?.worker?.model;
|
|
336
|
+
if (model && implementer) {
|
|
337
|
+
const relation = reviewModelRelation(implementer, model);
|
|
338
|
+
if (relation === "identical") out.refusal = describeIdenticalReviewModel(implementer, model);
|
|
339
|
+
else if (relation === "same-family") {
|
|
340
|
+
out.warning = describeSameFamilyReviewModel(implementer, model);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return out;
|
|
344
|
+
}
|
|
260
345
|
function checkPlanRoleOverrides(plan) {
|
|
261
346
|
if (plan.workerBackend && !isRequestedBackend(plan.workerBackend.toLowerCase())) {
|
|
262
347
|
return `plan frontmatter worker_backend must be auto or a kit backend id (got ${JSON.stringify(plan.workerBackend)})`;
|
|
@@ -284,7 +369,12 @@ async function loadRolesContext(root, usePlan) {
|
|
|
284
369
|
if (problem) return { ok: false, error: `${planPath}: ${problem}` };
|
|
285
370
|
}
|
|
286
371
|
}
|
|
287
|
-
return {
|
|
372
|
+
return {
|
|
373
|
+
ok: true,
|
|
374
|
+
roles: parsed.roles,
|
|
375
|
+
plan,
|
|
376
|
+
reviewer: resolveReviewerRole(parsed.roles, config?.externalPlanReview)
|
|
377
|
+
};
|
|
288
378
|
}
|
|
289
379
|
|
|
290
380
|
export {
|
|
@@ -293,5 +383,9 @@ export {
|
|
|
293
383
|
resolveWorkerRole,
|
|
294
384
|
resolveSubworkerModel,
|
|
295
385
|
describeResolvedRoles,
|
|
386
|
+
reviewModelRelation,
|
|
387
|
+
describeIdenticalReviewModel,
|
|
388
|
+
describeSameFamilyReviewModel,
|
|
389
|
+
resolveReviewJobRole,
|
|
296
390
|
loadRolesContext
|
|
297
391
|
};
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
ScrollRegion,
|
|
4
4
|
renderMcLive,
|
|
5
5
|
runMcTuiLoop
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CQHD6UKB.js";
|
|
7
7
|
import {
|
|
8
8
|
DRIVER_PROTOCOL_VERSION,
|
|
9
9
|
DriverAgentSink,
|
|
@@ -24,10 +24,17 @@ import {
|
|
|
24
24
|
} from "./chunk-DTSL2RH7.js";
|
|
25
25
|
import {
|
|
26
26
|
CLAUDE_SUBAGENT_MODEL_ENV,
|
|
27
|
+
describeIdenticalReviewModel,
|
|
27
28
|
describeResolvedRoles,
|
|
29
|
+
describeSameFamilyReviewModel,
|
|
28
30
|
readPlanRoleOverrides,
|
|
29
|
-
resolveSubworkerModel
|
|
30
|
-
|
|
31
|
+
resolveSubworkerModel,
|
|
32
|
+
reviewModelRelation
|
|
33
|
+
} from "./chunk-DZCLMIAS.js";
|
|
34
|
+
import {
|
|
35
|
+
REVIEW_BACKENDS,
|
|
36
|
+
runReviewJob
|
|
37
|
+
} from "./chunk-IESSMKOV.js";
|
|
31
38
|
import {
|
|
32
39
|
countPendingTodos,
|
|
33
40
|
findActivePlanFile,
|
|
@@ -36,6 +43,9 @@ import {
|
|
|
36
43
|
resolveActivePlanFromHandoff,
|
|
37
44
|
resolveActivePlanPath
|
|
38
45
|
} from "./chunk-7ABY6DYH.js";
|
|
46
|
+
import {
|
|
47
|
+
detectAgentBackend
|
|
48
|
+
} from "./chunk-C4LCOOL4.js";
|
|
39
49
|
import {
|
|
40
50
|
classifyGateExit,
|
|
41
51
|
landGateExit
|
|
@@ -503,6 +513,8 @@ async function armExternalPlanReview(root, options = {}) {
|
|
|
503
513
|
}
|
|
504
514
|
log("Plan exhausted: arming optional external plan review (opt-in handled by script)...");
|
|
505
515
|
const args = force ? [scriptPath, "--force", "--print"] : [scriptPath, "--print"];
|
|
516
|
+
const implementerModel = options.implementerModel?.trim();
|
|
517
|
+
if (implementerModel) args.push("--implementer-model", implementerModel);
|
|
506
518
|
return new Promise((resolve) => {
|
|
507
519
|
const child = spawnFn("bash", args, {
|
|
508
520
|
cwd: root,
|
|
@@ -1109,6 +1121,68 @@ async function runPlanLoop(opts) {
|
|
|
1109
1121
|
let backend = opts.backend;
|
|
1110
1122
|
let limitSwitched = false;
|
|
1111
1123
|
const rolesWarned = /* @__PURE__ */ new Set();
|
|
1124
|
+
let implementerModel = opts.model;
|
|
1125
|
+
const reviewAfterTick = async (tickBackend, tickModel) => {
|
|
1126
|
+
const reviewer = opts.roles?.reviewer;
|
|
1127
|
+
const proceed = { stop: false, exitCode: 0 };
|
|
1128
|
+
if (reviewer?.scope !== "tick") return proceed;
|
|
1129
|
+
const warnOnce = (line) => {
|
|
1130
|
+
if (rolesWarned.has(line)) return;
|
|
1131
|
+
rolesWarned.add(line);
|
|
1132
|
+
say(`roles: ${line}`, "warn");
|
|
1133
|
+
};
|
|
1134
|
+
const relation = reviewModelRelation(tickModel, reviewer.model);
|
|
1135
|
+
if (relation === "identical") {
|
|
1136
|
+
warnOnce(
|
|
1137
|
+
`post-tick review skipped: ${describeIdenticalReviewModel(tickModel ?? "auto", reviewer.model ?? "auto")}`
|
|
1138
|
+
);
|
|
1139
|
+
return proceed;
|
|
1140
|
+
}
|
|
1141
|
+
if (relation === "same-family") {
|
|
1142
|
+
warnOnce(describeSameFamilyReviewModel(tickModel ?? "auto", reviewer.model ?? "auto"));
|
|
1143
|
+
}
|
|
1144
|
+
const requested = reviewer.backend && reviewer.backend !== "auto" ? reviewer.backend : reviewer.backend !== "auto" && REVIEW_BACKENDS.includes(tickBackend) ? tickBackend : "auto";
|
|
1145
|
+
const detected = await (opts.tickReview?.detect ?? detectAgentBackend)(requested);
|
|
1146
|
+
if (!detected.ok) {
|
|
1147
|
+
say(`roles: post-tick review not run: ${detected.message}`, "warn");
|
|
1148
|
+
return proceed;
|
|
1149
|
+
}
|
|
1150
|
+
say(
|
|
1151
|
+
`roles: reviewer ${detected.id}, model ${reviewer.model ?? "(backend default)"} (scope tick) after tick ${tick}`
|
|
1152
|
+
);
|
|
1153
|
+
let result;
|
|
1154
|
+
try {
|
|
1155
|
+
result = await (opts.tickReview?.run ?? runReviewJob)({
|
|
1156
|
+
root: opts.root,
|
|
1157
|
+
backendId: detected.id,
|
|
1158
|
+
bin: detected.bin,
|
|
1159
|
+
...reviewer.model ? { model: reviewer.model } : {},
|
|
1160
|
+
noHitl: true,
|
|
1161
|
+
dryRun: false,
|
|
1162
|
+
log: (line) => say(line),
|
|
1163
|
+
...driver ? { render: { feed: () => {
|
|
1164
|
+
}, end: () => {
|
|
1165
|
+
} } } : {},
|
|
1166
|
+
// The review session is this run's live agent while it runs: the
|
|
1167
|
+
// lease names it and a host signal (driver mode) is forwarded to it.
|
|
1168
|
+
onSpawn: (info) => {
|
|
1169
|
+
lease?.setAgent(info.pid);
|
|
1170
|
+
tickAgent = info.pid === void 0 ? null : { pid: info.pid, start: procStart(info.pid) };
|
|
1171
|
+
}
|
|
1172
|
+
});
|
|
1173
|
+
} catch (err) {
|
|
1174
|
+
tickAgent = null;
|
|
1175
|
+
say(`roles: post-tick review failed to run: ${String(err)}`, "warn");
|
|
1176
|
+
return proceed;
|
|
1177
|
+
}
|
|
1178
|
+
tickAgent = null;
|
|
1179
|
+
if (result.error) {
|
|
1180
|
+
say(`roles: post-tick review not run: ${result.error}`, "warn");
|
|
1181
|
+
return proceed;
|
|
1182
|
+
}
|
|
1183
|
+
if (result.outcome !== "landed") return proceed;
|
|
1184
|
+
return { stop: true, exitCode: result.exitCode };
|
|
1185
|
+
};
|
|
1112
1186
|
const stopRequested = () => {
|
|
1113
1187
|
if (!driver?.reader.stopRequested()) return false;
|
|
1114
1188
|
const msg = `Stop requested by the driver (stop_after_tick) - stopping after tick ${ticksRun}. The plan is as the tick left it.`;
|
|
@@ -1187,6 +1261,7 @@ async function runPlanLoop(opts) {
|
|
|
1187
1261
|
try {
|
|
1188
1262
|
const switched = backend !== opts.backend;
|
|
1189
1263
|
const tickModel = switched && opts.roles && opts.roles.modelSource !== "flag" ? void 0 : opts.model;
|
|
1264
|
+
implementerModel = tickModel;
|
|
1190
1265
|
let tickEnv;
|
|
1191
1266
|
if (opts.roles) {
|
|
1192
1267
|
const planOverrides = readPlanRoleOverrides(await readPlan(planPath).catch(() => ""));
|
|
@@ -1343,6 +1418,17 @@ async function runPlanLoop(opts) {
|
|
|
1343
1418
|
banners.tickEnd(`pending: ${after}`);
|
|
1344
1419
|
}
|
|
1345
1420
|
endTick(after, sentinel);
|
|
1421
|
+
const review = await reviewAfterTick(backend.id, implementerModel);
|
|
1422
|
+
if (review.stop) {
|
|
1423
|
+
const msg = `Post-tick review landed a gate exit after tick ${tick} - stopping. Read the ticket before the next tick.`;
|
|
1424
|
+
if (banners) banners.stop(msg);
|
|
1425
|
+
else say(msg);
|
|
1426
|
+
if (sentinel.kind === "stop") stopReason = sentinel.reason;
|
|
1427
|
+
if (after === 0) planExhausted = true;
|
|
1428
|
+
exitCode = review.exitCode;
|
|
1429
|
+
endReason = "review findings landed; gate exit pending";
|
|
1430
|
+
break;
|
|
1431
|
+
}
|
|
1346
1432
|
if (sentinel.kind === "continue") {
|
|
1347
1433
|
} else if (sentinel.kind === "stop") {
|
|
1348
1434
|
say(`Agent requested stop: ${formatSentinelLine(sentinel)}`);
|
|
@@ -1390,10 +1476,10 @@ async function runPlanLoop(opts) {
|
|
|
1390
1476
|
`Loop finished after ${tick} tick(s). Pending now: ${pendingNow}. Logs in ${path4.relative(opts.root, logDir)}/`
|
|
1391
1477
|
);
|
|
1392
1478
|
if (planExhausted || shouldArmExternalPlanReview({ pending: pendingNow, stopReason })) {
|
|
1393
|
-
await armExternalPlanReview(
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
);
|
|
1479
|
+
await armExternalPlanReview(opts.root, {
|
|
1480
|
+
...driver ? { log: (line) => say(line), writeOut: driver.writeErr } : {},
|
|
1481
|
+
...implementerModel ? { implementerModel } : {}
|
|
1482
|
+
});
|
|
1397
1483
|
}
|
|
1398
1484
|
await landIfNeeded(exitCode, endReason || "stopped", pendingNow);
|
|
1399
1485
|
return finishRun(exitCode, endReason || "stopped", pendingNow, planExhausted);
|
|
@@ -24,13 +24,13 @@ import {
|
|
|
24
24
|
} from "./chunk-HAFRAXGV.js";
|
|
25
25
|
import {
|
|
26
26
|
stampLastCheckedAt
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-5HH3HSUR.js";
|
|
28
28
|
import {
|
|
29
29
|
loadContextConfig
|
|
30
30
|
} from "./chunk-PFEUZXVT.js";
|
|
31
31
|
import {
|
|
32
32
|
MANIFEST_RELATIVE_PATH
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-LDZAK5DU.js";
|
|
34
34
|
import {
|
|
35
35
|
HANDOFF_REL
|
|
36
36
|
} from "./chunk-C4Q77GGJ.js";
|
|
@@ -419,7 +419,9 @@ async function runReviewJob(input) {
|
|
|
419
419
|
logPath,
|
|
420
420
|
readOnly: true,
|
|
421
421
|
hitl: { policy: input.noHitl ? "off" : "prompt" },
|
|
422
|
-
log: (line) => say(line)
|
|
422
|
+
log: (line) => say(line),
|
|
423
|
+
...input.render ? { render: input.render } : {},
|
|
424
|
+
...input.onSpawn ? { onSpawn: input.onSpawn } : {}
|
|
423
425
|
});
|
|
424
426
|
for (const line of formatHitlSummary(result.hitl)) say(line);
|
|
425
427
|
exitCode = hitlExitCode(result.exitCode, result.hitl);
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
compareSemver,
|
|
6
6
|
normalizeSemver
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5HH3HSUR.js";
|
|
8
8
|
import {
|
|
9
9
|
MANIFEST_RELATIVE_PATH
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-LDZAK5DU.js";
|
|
11
11
|
import {
|
|
12
12
|
KIT_VERSION,
|
|
13
13
|
pinnedCliSpec
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
compareSemver,
|
|
3
3
|
normalizeSemver,
|
|
4
4
|
readLocalKitVersion
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5HH3HSUR.js";
|
|
6
6
|
import {
|
|
7
7
|
L0_ARTIFACTS
|
|
8
8
|
} from "./chunk-WS6OX2IG.js";
|
|
@@ -15,11 +15,11 @@ import {
|
|
|
15
15
|
mergeStats,
|
|
16
16
|
recordOutcome,
|
|
17
17
|
resolveProtectedGlobs
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-LDZAK5DU.js";
|
|
19
19
|
import {
|
|
20
20
|
loadManagedHashLedger,
|
|
21
21
|
saveManagedHashLedger
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-ZJDJCMQO.js";
|
|
23
23
|
import {
|
|
24
24
|
KIT_PACKAGE_SPEC,
|
|
25
25
|
KIT_VERSION
|