@dadado/agent-kit-cli 6.23.0 → 6.26.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 +48 -7
- package/dashboard/lib/guards.mjs +1 -0
- package/dashboard/lib/live-refresh.mjs +1 -0
- package/dist/{add-RKZQX6ZK.js → add-G7KEZLWP.js} +17 -8
- package/dist/{chunk-7HDQEK6T.js → chunk-2G4K4ZI5.js} +7 -3
- package/dist/{chunk-5PSV76CQ.js → chunk-2GXN7HVG.js} +26 -7
- package/dist/chunk-2QYWMSI5.js +193 -0
- package/dist/{chunk-B3VR5YBQ.js → chunk-2TW7ENWC.js} +12 -11
- package/dist/{chunk-IESSMKOV.js → chunk-5A72LTR3.js} +7 -7
- package/dist/{chunk-R4DUO5DA.js → chunk-AXQMVQ6O.js} +61 -237
- package/dist/{chunk-6WUKLS4D.js → chunk-BIFTTL2O.js} +1 -1
- package/dist/{chunk-AWQ6KRFV.js → chunk-BVZDPVUL.js} +1 -1
- package/dist/{chunk-QNISTPPZ.js → chunk-ENRXS5O6.js} +19 -12
- package/dist/chunk-FB6G6OD6.js +519 -0
- package/dist/{chunk-MFKHIWEL.js → chunk-FOVHFMSH.js} +1 -1
- package/dist/{chunk-6BEFGKCU.js → chunk-FUSNEYGU.js} +29 -3
- package/dist/chunk-H7KAXI5R.js +357 -0
- package/dist/chunk-HGB4DHXV.js +138 -0
- package/dist/{chunk-W3ZJVBNY.js → chunk-HXV6VQD4.js} +2374 -983
- package/dist/{chunk-BGL5DRK2.js → chunk-I3FGWNU5.js} +4 -4
- package/dist/chunk-IHVJTGYR.js +144 -0
- package/dist/{chunk-5LNHRL5E.js → chunk-IUY24WPE.js} +93 -263
- package/dist/chunk-JG5MKMOM.js +248 -0
- package/dist/{chunk-SGTTC2JP.js → chunk-JWIJHO67.js} +17 -2
- package/dist/chunk-KMK4T4ZM.js +34 -0
- package/dist/{chunk-ZMYV6PRE.js → chunk-LEVNLHH3.js} +2 -1
- package/dist/{chunk-2IP4OO6R.js → chunk-MGVV6YC4.js} +1 -1
- package/dist/{chunk-7TYA3GMI.js → chunk-MWRYQLEG.js} +7 -4
- package/dist/chunk-NHJ4IAVN.js +435 -0
- package/dist/{chunk-C4Q77GGJ.js → chunk-O7VMHCNN.js} +6 -0
- package/dist/{chunk-5EBT3V7G.js → chunk-OVRGTHZD.js} +1 -1
- package/dist/{chunk-F7YAAKYP.js → chunk-PCIYXGB3.js} +7 -5
- package/dist/{chunk-UJCATSYO.js → chunk-PLLXFSN2.js} +46 -17
- package/dist/{chunk-OYFCBYMP.js → chunk-RJP47EGS.js} +18 -1
- package/dist/{chunk-KDJ4ML7I.js → chunk-RRJVC35Y.js} +4 -4
- package/dist/{chunk-DRZFWIBN.js → chunk-SWJJW624.js} +1 -1
- package/dist/{chunk-MJJBIOSY.js → chunk-SYRJ5TTK.js} +34 -12
- package/dist/{chunk-L5V3W3DY.js → chunk-TTUFIE26.js} +60 -14
- package/dist/{chunk-JFS4GKP7.js → chunk-XXPI4H4D.js} +2 -2
- package/dist/{chunk-CVZNSRXV.js → chunk-Y5526WCN.js} +84 -19
- package/dist/{chunk-CQHD6UKB.js → chunk-Y575INEC.js} +2 -1
- package/dist/{chunk-V2H57TFD.js → chunk-ZNZHDPS3.js} +80 -170
- package/dist/{commands-SAQEEE6V.js → commands-K4HSDML5.js} +8 -6
- package/dist/{conflicts-5JOP4GX2.js → conflicts-4SUWIPWP.js} +9 -10
- package/dist/{contribute-BQKRT5GN.js → contribute-HE4WCBRY.js} +7 -5
- package/dist/{countdown-25E5C7AR.js → countdown-TYQHVAIX.js} +305 -32
- package/dist/{dashboard-P65XHYCU.js → dashboard-6V6PCNYF.js} +1 -1
- package/dist/{dashboard-broadcast-GYK34QYL.js → dashboard-broadcast-PMVQ7PXU.js} +1 -1
- package/dist/{diff-6JSXBVSX.js → diff-3XUZM7ZT.js} +15 -6
- package/dist/{doctor-I3MTHS7F.js → doctor-KGUWU5SN.js} +106 -19
- package/dist/{engine-info-BBI5QO5Y.js → engine-info-VM4VPGQM.js} +2 -2
- package/dist/{ground-control-IDCXN5FK.js → ground-control-ZIDHEOPW.js} +7 -4
- package/dist/{guard-RJZEEKSL.js → guard-ZO4Z3LLB.js} +47 -9
- package/dist/{handoff-5AGE2D3T.js → handoff-LLT4CI6H.js} +4 -3
- package/dist/{hook-WNA42CXE.js → hook-UPZ3CPYS.js} +22 -20
- package/dist/index.js +51 -33
- package/dist/{init-FZ2UFPO7.js → init-ZHLVXEVT.js} +25 -18
- package/dist/install-XWOG64W3.js +42 -0
- package/dist/installs-2ROXPO6M.js +223 -0
- package/dist/{mission-control-CRMCRZUU.js → mission-control-IGOI3WHS.js} +2 -2
- package/dist/models-5BDXREWM.js +45 -0
- package/dist/paths-JTPV6SXH.js +107 -0
- package/dist/pi-DCMDOY65.js +248 -0
- package/dist/{plan-index-BNLUU6T5.js → plan-index-5QZJK4AG.js} +2 -3
- package/dist/{queue-JW4VR33H.js → queue-Z5VNNHM6.js} +10 -12
- package/dist/{run-X2WOONTB.js → run-QURAXAR2.js} +27 -33
- package/dist/{run-plan-4MOLLIES.js → run-plan-4MMHVCTS.js} +35 -23
- package/dist/{scan-K3T5RQLC.js → scan-7D3RMO34.js} +2 -1
- package/dist/{session-start-MV7A4263.js → session-start-NC2HE5X5.js} +20 -14
- package/dist/{sessions-UPFDWDMB.js → sessions-WWWLYPW6.js} +4 -4
- package/dist/{setup-global-VNADNTQ2.js → setup-global-WDMARD4Z.js} +12 -10
- package/dist/{status-SXA3OK5E.js → status-2WNJL7PP.js} +17 -13
- package/dist/update-YSVOYYK5.js +32 -0
- package/dist/update-all-5XLTCHPX.js +697 -0
- package/package.json +14 -4
- package/pi/agent-kit.ts +224 -0
- package/dist/chunk-4MR4QXMF.js +0 -52
- package/dist/chunk-7ABY6DYH.js +0 -89
- package/dist/chunk-C4LCOOL4.js +0 -71
- package/dist/chunk-DZCLMIAS.js +0 -391
- package/dist/chunk-HAFRAXGV.js +0 -17
- package/dist/chunk-MUTTNRX4.js +0 -53
- package/dist/install-CTLT3TSI.js +0 -38
- package/dist/update-RMAWXMCV.js +0 -304
package/dist/chunk-DZCLMIAS.js
DELETED
|
@@ -1,391 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
readPlan,
|
|
3
|
-
resolveActivePlanPath
|
|
4
|
-
} from "./chunk-7ABY6DYH.js";
|
|
5
|
-
import {
|
|
6
|
-
isBackendId,
|
|
7
|
-
isRequestedBackend
|
|
8
|
-
} from "./chunk-C4LCOOL4.js";
|
|
9
|
-
import {
|
|
10
|
-
loadContextConfig
|
|
11
|
-
} from "./chunk-PFEUZXVT.js";
|
|
12
|
-
|
|
13
|
-
// src/plan-loop/model-roles.ts
|
|
14
|
-
var ROLE_CAPABILITIES = Object.freeze({
|
|
15
|
-
claude: { workerModel: true, subworkerModel: true, reviewer: true },
|
|
16
|
-
"cursor-agent": { workerModel: true, subworkerModel: false, reviewer: true },
|
|
17
|
-
codex: { workerModel: true, subworkerModel: false, reviewer: false },
|
|
18
|
-
openrouter: { workerModel: true, subworkerModel: false, reviewer: false },
|
|
19
|
-
"cursor-acp": { workerModel: false, subworkerModel: false, reviewer: false }
|
|
20
|
-
});
|
|
21
|
-
var ROLE_MODEL_ID = /^[A-Za-z0-9._:/+=,[\]-]{1,128}$/;
|
|
22
|
-
var ROLE_WORKER_TYPE_KEY = /^[a-z0-9][a-z0-9_-]{0,63}$/;
|
|
23
|
-
var SUBWORKER_AUTO = "auto";
|
|
24
|
-
var REVIEWER_SCOPES = ["off", "tick", "plan"];
|
|
25
|
-
var REVIEWER_BACKENDS = ["auto", "claude", "cursor-agent"];
|
|
26
|
-
var CLAUDE_SUBAGENT_MODEL_ENV = "CLAUDE_CODE_SUBAGENT_MODEL";
|
|
27
|
-
function isPlainObject(v) {
|
|
28
|
-
return v !== null && typeof v === "object" && !Array.isArray(v);
|
|
29
|
-
}
|
|
30
|
-
function modelField(v, where) {
|
|
31
|
-
if (v === void 0 || v === null || v === "") return {};
|
|
32
|
-
if (typeof v !== "string" || !ROLE_MODEL_ID.test(v.trim())) {
|
|
33
|
-
return { error: `${where} must be a model id (letters, digits, . _ : / + = , [ ] -)` };
|
|
34
|
-
}
|
|
35
|
-
return { value: v.trim() };
|
|
36
|
-
}
|
|
37
|
-
function parseModelRoles(raw) {
|
|
38
|
-
if (raw === void 0 || raw === null) return { ok: true, roles: {} };
|
|
39
|
-
if (!isPlainObject(raw)) return { ok: false, error: "roles must be an object" };
|
|
40
|
-
const roles = {};
|
|
41
|
-
for (const key of Object.keys(raw)) {
|
|
42
|
-
if (key !== "worker" && key !== "subworker" && key !== "reviewer") {
|
|
43
|
-
return { ok: false, error: `unknown roles key: ${key}` };
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (raw.worker !== void 0 && raw.worker !== null) {
|
|
47
|
-
const w = raw.worker;
|
|
48
|
-
if (!isPlainObject(w)) return { ok: false, error: "roles.worker must be an object" };
|
|
49
|
-
for (const key of Object.keys(w)) {
|
|
50
|
-
if (key !== "backend" && key !== "model") {
|
|
51
|
-
return { ok: false, error: `unknown roles.worker key: ${key}` };
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const worker = {};
|
|
55
|
-
if (w.backend !== void 0 && w.backend !== null && w.backend !== "") {
|
|
56
|
-
const b = typeof w.backend === "string" ? w.backend.trim().toLowerCase() : "";
|
|
57
|
-
if (!isRequestedBackend(b)) {
|
|
58
|
-
return {
|
|
59
|
-
ok: false,
|
|
60
|
-
error: `roles.worker.backend must be auto or a kit backend id (got ${JSON.stringify(w.backend)})`
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
worker.backend = b;
|
|
64
|
-
}
|
|
65
|
-
const m = modelField(w.model, "roles.worker.model");
|
|
66
|
-
if (m.error) return { ok: false, error: m.error };
|
|
67
|
-
if (m.value) worker.model = m.value;
|
|
68
|
-
roles.worker = worker;
|
|
69
|
-
}
|
|
70
|
-
if (raw.subworker !== void 0 && raw.subworker !== null) {
|
|
71
|
-
const s = raw.subworker;
|
|
72
|
-
if (!isPlainObject(s)) return { ok: false, error: "roles.subworker must be an object" };
|
|
73
|
-
for (const key of Object.keys(s)) {
|
|
74
|
-
if (key !== "model" && key !== "byWorkerType") {
|
|
75
|
-
return { ok: false, error: `unknown roles.subworker key: ${key}` };
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
const sub = {};
|
|
79
|
-
const m = modelField(s.model, "roles.subworker.model");
|
|
80
|
-
if (m.error) return { ok: false, error: m.error };
|
|
81
|
-
if (m.value) sub.model = m.value;
|
|
82
|
-
if (s.byWorkerType !== void 0 && s.byWorkerType !== null) {
|
|
83
|
-
if (!isPlainObject(s.byWorkerType)) {
|
|
84
|
-
return { ok: false, error: "roles.subworker.byWorkerType must be an object" };
|
|
85
|
-
}
|
|
86
|
-
const map = {};
|
|
87
|
-
for (const [type, value] of Object.entries(s.byWorkerType)) {
|
|
88
|
-
if (!ROLE_WORKER_TYPE_KEY.test(type)) {
|
|
89
|
-
return {
|
|
90
|
-
ok: false,
|
|
91
|
-
error: `roles.subworker.byWorkerType key ${type} is not a worker_type`
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
const mv = modelField(value, `roles.subworker.byWorkerType.${type}`);
|
|
95
|
-
if (mv.error) return { ok: false, error: mv.error };
|
|
96
|
-
if (mv.value) map[type] = mv.value;
|
|
97
|
-
}
|
|
98
|
-
sub.byWorkerType = map;
|
|
99
|
-
}
|
|
100
|
-
roles.subworker = sub;
|
|
101
|
-
}
|
|
102
|
-
if (raw.reviewer !== void 0 && raw.reviewer !== null) {
|
|
103
|
-
const r = raw.reviewer;
|
|
104
|
-
if (!isPlainObject(r)) return { ok: false, error: "roles.reviewer must be an object" };
|
|
105
|
-
const reviewer = {};
|
|
106
|
-
for (const key of Object.keys(r)) {
|
|
107
|
-
if (!["enabled", "scope", "backend", "model", "advisorModel"].includes(key)) {
|
|
108
|
-
return { ok: false, error: `unknown roles.reviewer key: ${key}` };
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
if (r.enabled !== void 0 && r.enabled !== null) {
|
|
112
|
-
if (typeof r.enabled !== "boolean") {
|
|
113
|
-
return { ok: false, error: "roles.reviewer.enabled must be boolean" };
|
|
114
|
-
}
|
|
115
|
-
reviewer.enabled = r.enabled;
|
|
116
|
-
}
|
|
117
|
-
if (r.scope !== void 0 && r.scope !== null) {
|
|
118
|
-
if (typeof r.scope !== "string" || !REVIEWER_SCOPES.includes(r.scope)) {
|
|
119
|
-
return { ok: false, error: "roles.reviewer.scope must be off, tick, or plan" };
|
|
120
|
-
}
|
|
121
|
-
reviewer.scope = r.scope;
|
|
122
|
-
}
|
|
123
|
-
if (r.backend !== void 0 && r.backend !== null) {
|
|
124
|
-
if (typeof r.backend !== "string" || !REVIEWER_BACKENDS.includes(r.backend)) {
|
|
125
|
-
return { ok: false, error: "roles.reviewer.backend must be auto, claude, or cursor-agent" };
|
|
126
|
-
}
|
|
127
|
-
reviewer.backend = r.backend;
|
|
128
|
-
}
|
|
129
|
-
for (const key of ["model", "advisorModel"]) {
|
|
130
|
-
const mv = modelField(r[key], `roles.reviewer.${key}`);
|
|
131
|
-
if (mv.error) return { ok: false, error: mv.error };
|
|
132
|
-
if (mv.value) reviewer[key] = mv.value;
|
|
133
|
-
}
|
|
134
|
-
roles.reviewer = reviewer;
|
|
135
|
-
}
|
|
136
|
-
return { ok: true, roles };
|
|
137
|
-
}
|
|
138
|
-
function frontmatterBlock(planText) {
|
|
139
|
-
const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(planText);
|
|
140
|
-
return m?.[1] ?? null;
|
|
141
|
-
}
|
|
142
|
-
function unquote(v) {
|
|
143
|
-
const t = v.trim();
|
|
144
|
-
if (t.length >= 2 && (t[0] === '"' || t[0] === "'") && t[t.length - 1] === t[0]) {
|
|
145
|
-
return t.slice(1, -1).trim();
|
|
146
|
-
}
|
|
147
|
-
return t;
|
|
148
|
-
}
|
|
149
|
-
function readPlanRoleOverrides(planText) {
|
|
150
|
-
const block = frontmatterBlock(planText);
|
|
151
|
-
if (!block) return {};
|
|
152
|
-
const out = {};
|
|
153
|
-
const top = (key) => {
|
|
154
|
-
const m = new RegExp(`^${key}:[ \\t]*(.+)$`, "m").exec(block);
|
|
155
|
-
const v = m?.[1] ? unquote(m[1]) : "";
|
|
156
|
-
return v ? v : void 0;
|
|
157
|
-
};
|
|
158
|
-
const wb = top("worker_backend");
|
|
159
|
-
if (wb) out.workerBackend = wb;
|
|
160
|
-
const wm = top("worker_model");
|
|
161
|
-
if (wm) out.workerModel = wm;
|
|
162
|
-
const sm = top("subworker_model");
|
|
163
|
-
if (sm) out.subworkerModel = sm;
|
|
164
|
-
const items = block.split(/^\s*- id:/m).slice(1);
|
|
165
|
-
for (const item of items) {
|
|
166
|
-
const status = /^\s*status:\s*(\S+)/m.exec(item)?.[1];
|
|
167
|
-
if (status !== "pending" && status !== "in_progress") continue;
|
|
168
|
-
if (unquote(item.split("\n")[0] ?? "") === "dogfood-poc") continue;
|
|
169
|
-
const type = /^\s*worker_type:\s*(.+)$/m.exec(item)?.[1];
|
|
170
|
-
if (type) out.nextWorkerType = unquote(type);
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
return out;
|
|
174
|
-
}
|
|
175
|
-
var RANK = { flag: 3, plan: 2, config: 1, default: 0 };
|
|
176
|
-
function resolveWorkerRole(input) {
|
|
177
|
-
const warnings = [];
|
|
178
|
-
const layers = [
|
|
179
|
-
{
|
|
180
|
-
source: "flag",
|
|
181
|
-
backend: input.flagBackend?.trim() || void 0,
|
|
182
|
-
model: input.flagModel?.trim() || void 0
|
|
183
|
-
},
|
|
184
|
-
{ source: "plan", backend: input.plan?.workerBackend, model: input.plan?.workerModel },
|
|
185
|
-
{ source: "config", backend: input.roles?.worker?.backend, model: input.roles?.worker?.model },
|
|
186
|
-
{ source: "default", backend: input.defaultBackend }
|
|
187
|
-
];
|
|
188
|
-
const bLayer = layers.find((l) => l.backend) ?? {
|
|
189
|
-
source: "default",
|
|
190
|
-
backend: input.defaultBackend
|
|
191
|
-
};
|
|
192
|
-
const backend = bLayer.backend.trim().toLowerCase();
|
|
193
|
-
let model;
|
|
194
|
-
let modelSource;
|
|
195
|
-
for (const l of layers) {
|
|
196
|
-
if (!l.model) continue;
|
|
197
|
-
if (RANK[l.source] < RANK[bLayer.source]) {
|
|
198
|
-
warnings.push(
|
|
199
|
-
`${l.source} model ${l.model} ignored: the backend ${backend} came from the ${bLayer.source} layer, and a model only applies to its own backend or a lower layer's`
|
|
200
|
-
);
|
|
201
|
-
break;
|
|
202
|
-
}
|
|
203
|
-
model = l.model;
|
|
204
|
-
modelSource = l.source;
|
|
205
|
-
break;
|
|
206
|
-
}
|
|
207
|
-
if (model && modelSource !== "flag" && isBackendId(backend) && !ROLE_CAPABILITIES[backend].workerModel) {
|
|
208
|
-
warnings.push(
|
|
209
|
-
`${modelSource} model ${model} ignored: ${backend} cannot select a model (docs/model-roles-capability-matrix.md)`
|
|
210
|
-
);
|
|
211
|
-
model = void 0;
|
|
212
|
-
modelSource = void 0;
|
|
213
|
-
}
|
|
214
|
-
return {
|
|
215
|
-
backend,
|
|
216
|
-
...model ? { model, modelSource } : {},
|
|
217
|
-
backendSource: bLayer.source,
|
|
218
|
-
warnings
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
function resolveSubworkerModel(input) {
|
|
222
|
-
const sub = input.roles?.subworker;
|
|
223
|
-
const type = input.plan?.nextWorkerType;
|
|
224
|
-
let model;
|
|
225
|
-
let source;
|
|
226
|
-
if (input.plan?.subworkerModel) {
|
|
227
|
-
model = input.plan.subworkerModel;
|
|
228
|
-
source = "plan";
|
|
229
|
-
} else if (type && sub?.byWorkerType?.[type]) {
|
|
230
|
-
model = sub.byWorkerType[type];
|
|
231
|
-
source = "worker_type";
|
|
232
|
-
} else if (sub?.model) {
|
|
233
|
-
model = sub.model;
|
|
234
|
-
source = "config";
|
|
235
|
-
}
|
|
236
|
-
if (!model) return {};
|
|
237
|
-
if (model === SUBWORKER_AUTO) {
|
|
238
|
-
return {
|
|
239
|
-
warning: "subworker model auto is reserved and not implemented yet (auto tier routing); no subworker model set"
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
if (!ROLE_MODEL_ID.test(model)) {
|
|
243
|
-
return {
|
|
244
|
-
warning: `subworker model ${JSON.stringify(model)} is not a model id; no subworker model set`
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
if (!ROLE_CAPABILITIES[input.backend].subworkerModel) {
|
|
248
|
-
const how = input.backend === "cursor-agent" ? "Cursor subagents follow the worker model (model: inherit)" : "subagents keep the backend default";
|
|
249
|
-
return {
|
|
250
|
-
warning: `subworker model ${model} is not supported on ${input.backend}; ${how} (docs/model-roles-capability-matrix.md)`
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
return { model, source };
|
|
254
|
-
}
|
|
255
|
-
function describeResolvedRoles(input) {
|
|
256
|
-
const model = input.model ? `${input.model} (${input.modelSource ?? "flag"})` : "backend default";
|
|
257
|
-
const sub = input.subworker?.model ? `, subworker ${input.subworker.model} (${input.subworker.source})` : "";
|
|
258
|
-
return `roles: worker ${input.backendId} (${input.backendSource}), model ${model}${sub}`;
|
|
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
|
-
}
|
|
345
|
-
function checkPlanRoleOverrides(plan) {
|
|
346
|
-
if (plan.workerBackend && !isRequestedBackend(plan.workerBackend.toLowerCase())) {
|
|
347
|
-
return `plan frontmatter worker_backend must be auto or a kit backend id (got ${JSON.stringify(plan.workerBackend)})`;
|
|
348
|
-
}
|
|
349
|
-
for (const [key, value] of [
|
|
350
|
-
["worker_model", plan.workerModel],
|
|
351
|
-
["subworker_model", plan.subworkerModel]
|
|
352
|
-
]) {
|
|
353
|
-
if (value && !ROLE_MODEL_ID.test(value)) {
|
|
354
|
-
return `plan frontmatter ${key} must be a model id (got ${JSON.stringify(value)})`;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
return null;
|
|
358
|
-
}
|
|
359
|
-
async function loadRolesContext(root, usePlan) {
|
|
360
|
-
const config = await loadContextConfig(root);
|
|
361
|
-
const parsed = parseModelRoles(config?.roles);
|
|
362
|
-
if (!parsed.ok) return { ok: false, error: `.cursor/context/config.json: ${parsed.error}` };
|
|
363
|
-
let plan = {};
|
|
364
|
-
if (usePlan) {
|
|
365
|
-
const planPath = await resolveActivePlanPath(root);
|
|
366
|
-
if (planPath) {
|
|
367
|
-
plan = readPlanRoleOverrides(await readPlan(planPath).catch(() => ""));
|
|
368
|
-
const problem = checkPlanRoleOverrides(plan);
|
|
369
|
-
if (problem) return { ok: false, error: `${planPath}: ${problem}` };
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
return {
|
|
373
|
-
ok: true,
|
|
374
|
-
roles: parsed.roles,
|
|
375
|
-
plan,
|
|
376
|
-
reviewer: resolveReviewerRole(parsed.roles, config?.externalPlanReview)
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
export {
|
|
381
|
-
CLAUDE_SUBAGENT_MODEL_ENV,
|
|
382
|
-
readPlanRoleOverrides,
|
|
383
|
-
resolveWorkerRole,
|
|
384
|
-
resolveSubworkerModel,
|
|
385
|
-
describeResolvedRoles,
|
|
386
|
-
reviewModelRelation,
|
|
387
|
-
describeIdenticalReviewModel,
|
|
388
|
-
describeSameFamilyReviewModel,
|
|
389
|
-
resolveReviewJobRole,
|
|
390
|
-
loadRolesContext
|
|
391
|
-
};
|
package/dist/chunk-HAFRAXGV.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
writeJson
|
|
3
|
-
} from "./chunk-5B4DVO6C.js";
|
|
4
|
-
|
|
5
|
-
// src/scanner/snapshot.ts
|
|
6
|
-
import path from "path";
|
|
7
|
-
var READINESS_SNAPSHOT_RELATIVE_PATH = ".cursor/context/readiness.json";
|
|
8
|
-
async function writeReadinessSnapshot(rootDir, report) {
|
|
9
|
-
const snapshotPath = path.join(rootDir, READINESS_SNAPSHOT_RELATIVE_PATH);
|
|
10
|
-
await writeJson(snapshotPath, report);
|
|
11
|
-
return snapshotPath;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
READINESS_SNAPSHOT_RELATIVE_PATH,
|
|
16
|
-
writeReadinessSnapshot
|
|
17
|
-
};
|
package/dist/chunk-MUTTNRX4.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// src/utils/git-local-exclude.ts
|
|
2
|
-
import { execFile } from "child_process";
|
|
3
|
-
import { appendFile, mkdir, readFile } from "fs/promises";
|
|
4
|
-
import path from "path";
|
|
5
|
-
function gitAt(cwd) {
|
|
6
|
-
return (args) => new Promise((resolve) => {
|
|
7
|
-
execFile(
|
|
8
|
-
"git",
|
|
9
|
-
[...args],
|
|
10
|
-
{
|
|
11
|
-
cwd,
|
|
12
|
-
env: { ...process.env, GIT_TERMINAL_PROMPT: "0" },
|
|
13
|
-
encoding: "utf8",
|
|
14
|
-
timeout: 3e4
|
|
15
|
-
},
|
|
16
|
-
(err, stdout, stderr) => {
|
|
17
|
-
resolve({
|
|
18
|
-
code: err ? typeof err.code === "number" ? err.code : 1 : 0,
|
|
19
|
-
stdout: String(stdout ?? ""),
|
|
20
|
-
stderr: String(stderr ?? err?.message ?? "")
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
async function ensurePathIgnored(git, root, relPath) {
|
|
27
|
-
try {
|
|
28
|
-
const check = () => git(["check-ignore", "-q", "--", relPath]);
|
|
29
|
-
const first = await check();
|
|
30
|
-
if (first.code === 0) return true;
|
|
31
|
-
if (first.code !== 1) return false;
|
|
32
|
-
const prefix = await git(["rev-parse", "--show-prefix"]);
|
|
33
|
-
const where = await git(["rev-parse", "--git-path", "info/exclude"]);
|
|
34
|
-
if (prefix.code !== 0 || where.code !== 0 || !where.stdout.trim()) return false;
|
|
35
|
-
const line = `/${prefix.stdout.trim()}${relPath}`;
|
|
36
|
-
const exclude = path.resolve(root, where.stdout.trim());
|
|
37
|
-
const current = await readFile(exclude, "utf8").catch(() => "");
|
|
38
|
-
if (!current.split("\n").some((l) => l.trim() === line)) {
|
|
39
|
-
await mkdir(path.dirname(exclude), { recursive: true });
|
|
40
|
-
const sep = current && !current.endsWith("\n") ? "\n" : "";
|
|
41
|
-
await appendFile(exclude, `${sep}${line}
|
|
42
|
-
`, "utf8");
|
|
43
|
-
}
|
|
44
|
-
return (await check()).code === 0;
|
|
45
|
-
} catch {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export {
|
|
51
|
-
gitAt,
|
|
52
|
-
ensurePathIgnored
|
|
53
|
-
};
|
package/dist/install-CTLT3TSI.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
installCommand,
|
|
3
|
-
nextStepAfterInstall,
|
|
4
|
-
performInstall,
|
|
5
|
-
printInstallEpilogue
|
|
6
|
-
} from "./chunk-UJCATSYO.js";
|
|
7
|
-
import "./chunk-5PSV76CQ.js";
|
|
8
|
-
import "./chunk-HS7LVVLO.js";
|
|
9
|
-
import "./chunk-DRZFWIBN.js";
|
|
10
|
-
import "./chunk-F7YAAKYP.js";
|
|
11
|
-
import "./chunk-HAFRAXGV.js";
|
|
12
|
-
import "./chunk-AWQ6KRFV.js";
|
|
13
|
-
import "./chunk-6BEFGKCU.js";
|
|
14
|
-
import "./chunk-WGLPZXNU.js";
|
|
15
|
-
import "./chunk-Q35TWISF.js";
|
|
16
|
-
import "./chunk-QTON2GQX.js";
|
|
17
|
-
import "./chunk-PNFF6OU3.js";
|
|
18
|
-
import "./chunk-R4DUO5DA.js";
|
|
19
|
-
import "./chunk-F6C3GFKV.js";
|
|
20
|
-
import "./chunk-ZB43YMHW.js";
|
|
21
|
-
import "./chunk-KDJ4ML7I.js";
|
|
22
|
-
import "./chunk-B3VR5YBQ.js";
|
|
23
|
-
import "./chunk-CVZNSRXV.js";
|
|
24
|
-
import "./chunk-PFEUZXVT.js";
|
|
25
|
-
import "./chunk-7TYA3GMI.js";
|
|
26
|
-
import "./chunk-4MR4QXMF.js";
|
|
27
|
-
import "./chunk-CGXLR77R.js";
|
|
28
|
-
import "./chunk-V2H57TFD.js";
|
|
29
|
-
import "./chunk-OYFCBYMP.js";
|
|
30
|
-
import "./chunk-7HDQEK6T.js";
|
|
31
|
-
import "./chunk-C4Q77GGJ.js";
|
|
32
|
-
import "./chunk-5B4DVO6C.js";
|
|
33
|
-
export {
|
|
34
|
-
installCommand,
|
|
35
|
-
nextStepAfterInstall,
|
|
36
|
-
performInstall,
|
|
37
|
-
printInstallEpilogue
|
|
38
|
-
};
|