@dadado/agent-kit-cli 6.17.0 → 6.19.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.
Files changed (63) hide show
  1. package/dashboard/dashboard-data.mjs +8 -3
  2. package/dashboard/dashboard.html +140 -0
  3. package/dashboard/lib/guards.d.mts +20 -0
  4. package/dashboard/lib/guards.mjs +307 -0
  5. package/dashboard/lib/semantic-model.mjs +228 -1
  6. package/dist/{add-DRV3T42D.js → add-MRI5BXHH.js} +3 -3
  7. package/dist/{chunk-3IEE6Q37.js → chunk-2TX6NJEG.js} +1 -1
  8. package/dist/{chunk-IOQ6YXA3.js → chunk-3HNTNYPR.js} +1 -1
  9. package/dist/{chunk-MEZU47IB.js → chunk-5EBT3V7G.js} +1 -1
  10. package/dist/{chunk-5IJQGIOY.js → chunk-677W4QO3.js} +63 -1
  11. package/dist/{chunk-SKC6QZW4.js → chunk-6WUKLS4D.js} +1 -1
  12. package/dist/{chunk-YO4BLHDT.js → chunk-6XJZLH53.js} +149 -18
  13. package/dist/{chunk-J3YLSHRK.js → chunk-7MUTZHWP.js} +23 -4
  14. package/dist/{chunk-CJ3JAH7L.js → chunk-BGL5DRK2.js} +2 -2
  15. package/dist/{chunk-IJQAFPY3.js → chunk-C4LCOOL4.js} +3 -1
  16. package/dist/chunk-DTSL2RH7.js +433 -0
  17. package/dist/{chunk-4DLMU44M.js → chunk-EBDQYFA4.js} +71 -4
  18. package/dist/{chunk-AQTCXUYS.js → chunk-EOQMAU2J.js} +1 -1
  19. package/dist/{chunk-RAMT55TC.js → chunk-G2Z37XFM.js} +3 -3
  20. package/dist/{chunk-HKZH2IEE.js → chunk-GTP224FI.js} +1 -1
  21. package/dist/{chunk-QYIV6ZP6.js → chunk-HJWSOZXS.js} +52 -12
  22. package/dist/{chunk-AZCPUJJO.js → chunk-IQQQDEQ4.js} +2 -2
  23. package/dist/{chunk-ZFJIJUZ4.js → chunk-MPCNPZJZ.js} +1 -1
  24. package/dist/{hook-2YEC7GT5.js → chunk-NL3I2BWA.js} +104 -113
  25. package/dist/{chunk-WGAOM37Y.js → chunk-OKQ37A7E.js} +9 -9
  26. package/dist/{chunk-WRCXRV2U.js → chunk-P7732A25.js} +10 -0
  27. package/dist/{chunk-6RRG3WOE.js → chunk-Q35TWISF.js} +22 -1
  28. package/dist/{chunk-WA7IBNIL.js → chunk-QBYJNGCD.js} +2 -2
  29. package/dist/chunk-QWTBYXHN.js +751 -0
  30. package/dist/{chunk-SC2DBY2R.js → chunk-R4DUO5DA.js} +1 -0
  31. package/dist/{chunk-2Y27P6KC.js → chunk-SGTTC2JP.js} +4 -3
  32. package/dist/{chunk-TICKIKCQ.js → chunk-U23SLQGX.js} +5 -5
  33. package/dist/chunk-UATQQDVR.js +297 -0
  34. package/dist/{chunk-3YTFXTXH.js → chunk-UXQH2CNC.js} +2 -1
  35. package/dist/{chunk-VBQHBSIB.js → chunk-VJWWJA36.js} +3 -3
  36. package/dist/{chunk-OQNJRQPZ.js → chunk-W3ZJVBNY.js} +7 -4
  37. package/dist/{chunk-XDCCYBCJ.js → chunk-ZMYV6PRE.js} +13 -0
  38. package/dist/{commands-3O2HFLTW.js → commands-NL6UOEP7.js} +51 -17
  39. package/dist/{conflicts-UY6VTYIO.js → conflicts-XMN4PBCZ.js} +8 -8
  40. package/dist/{contribute-RF47NPZ2.js → contribute-QDTEJ42W.js} +4 -4
  41. package/dist/{countdown-JX3DZ2QU.js → countdown-7ONIVAG6.js} +40 -12
  42. package/dist/{dashboard-YNCFISNO.js → dashboard-P65XHYCU.js} +1 -1
  43. package/dist/{dashboard-broadcast-NK7PU72L.js → dashboard-broadcast-GYK34QYL.js} +1 -1
  44. package/dist/{diff-SVFAUOVP.js → diff-RLB7R2NE.js} +5 -5
  45. package/dist/{doctor-ATKYRCT4.js → doctor-OXMDSOXL.js} +11 -11
  46. package/dist/{engine-info-R6GXZ2VO.js → engine-info-BBI5QO5Y.js} +3 -3
  47. package/dist/{ground-control-D2X6CI66.js → ground-control-IDCXN5FK.js} +5 -5
  48. package/dist/hook-B4VUQOQF.js +108 -0
  49. package/dist/index.js +28 -28
  50. package/dist/{init-LUJRWMHC.js → init-BYONEUCW.js} +14 -14
  51. package/dist/{install-VQSO2JR7.js → install-HOR6VR44.js} +14 -14
  52. package/dist/{mission-control-JIF6GFSV.js → mission-control-QJBSZVNI.js} +2 -2
  53. package/dist/{queue-IEOXOBNL.js → queue-OJHKFKK3.js} +55 -11
  54. package/dist/{run-L63NZHAJ.js → run-PFANZJ5Y.js} +175 -27
  55. package/dist/{run-plan-BWJX6R7Q.js → run-plan-7EB4ERSQ.js} +46 -16
  56. package/dist/{scan-BWA64R7I.js → scan-K3T5RQLC.js} +1 -1
  57. package/dist/session-start-OSFSF4OZ.js +74 -0
  58. package/dist/sessions-WQU5DONU.js +102 -0
  59. package/dist/{setup-global-2X5TMDCB.js → setup-global-O34KFL2C.js} +6 -6
  60. package/dist/{status-MOOZCB5D.js → status-QB2FFYUP.js} +8 -8
  61. package/dist/{update-NMSO56CQ.js → update-N2EKKSE7.js} +16 -11
  62. package/package.json +1 -1
  63. package/dist/sessions-O7MYEMCT.js +0 -343
@@ -442,6 +442,7 @@ var KIT_OWNED_IGNORE_PATTERNS = [
442
442
  ".cursor/context/gate-exit.json",
443
443
  ".cursor/context/review-ledger.json",
444
444
  ".cursor/context/plan-index.json",
445
+ ".cursor/context/run-plan-all.lock",
445
446
  ".cursor/loop-logs/"
446
447
  ];
447
448
  function globToRegExp(glob) {
@@ -13,10 +13,10 @@ import {
13
13
  redactSecrets,
14
14
  resolveHitlRunOptions,
15
15
  spawnLogged
16
- } from "./chunk-OQNJRQPZ.js";
16
+ } from "./chunk-W3ZJVBNY.js";
17
17
  import {
18
18
  RESERVED_GATE_IDS
19
- } from "./chunk-WRCXRV2U.js";
19
+ } from "./chunk-P7732A25.js";
20
20
  import {
21
21
  ensureLoopLogsDir,
22
22
  runnerStatePaths
@@ -190,7 +190,7 @@ async function runHeadlessDispatch(opts) {
190
190
  }
191
191
  if (opts.backendId === "claude") {
192
192
  const log = opts.log ?? ((line) => console.log(line));
193
- const env = claudeChildEnv();
193
+ const env = claudeChildEnv(opts.env);
194
194
  const redact = claudeRedactions(env);
195
195
  const version = checkClaudeVersion(opts.bin, opts.versionFn);
196
196
  if (!version.ok) throw new Error(`claude dispatch: ${version.message}`);
@@ -242,6 +242,7 @@ async function ensureDispatchLogPath(root) {
242
242
 
243
243
  export {
244
244
  RUN_CATALOG,
245
+ RUN_PROMOTE_BLOCKED,
245
246
  normalizeSlashName,
246
247
  classifySlash,
247
248
  rewriteRootArgvToRun,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isBranchInBase
3
- } from "./chunk-MEZU47IB.js";
3
+ } from "./chunk-5EBT3V7G.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-CJ3JAH7L.js";
14
+ } from "./chunk-BGL5DRK2.js";
15
15
  import {
16
16
  ensurePathIgnored
17
17
  } from "./chunk-MUTTNRX4.js";
@@ -19,14 +19,14 @@ import {
19
19
  ensureDispatchLogPath,
20
20
  readCommandFile,
21
21
  runHeadlessDispatch
22
- } from "./chunk-2Y27P6KC.js";
22
+ } from "./chunk-SGTTC2JP.js";
23
23
  import {
24
24
  redactSecrets
25
- } from "./chunk-OQNJRQPZ.js";
25
+ } from "./chunk-W3ZJVBNY.js";
26
26
  import {
27
27
  formatHitlSummary,
28
28
  hitlExitCode
29
- } from "./chunk-WRCXRV2U.js";
29
+ } from "./chunk-P7732A25.js";
30
30
 
31
31
  // src/plan-loop/review-job.ts
32
32
  import { randomBytes } from "crypto";
@@ -0,0 +1,297 @@
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 checkPlanRoleOverrides(plan) {
261
+ if (plan.workerBackend && !isRequestedBackend(plan.workerBackend.toLowerCase())) {
262
+ return `plan frontmatter worker_backend must be auto or a kit backend id (got ${JSON.stringify(plan.workerBackend)})`;
263
+ }
264
+ for (const [key, value] of [
265
+ ["worker_model", plan.workerModel],
266
+ ["subworker_model", plan.subworkerModel]
267
+ ]) {
268
+ if (value && !ROLE_MODEL_ID.test(value)) {
269
+ return `plan frontmatter ${key} must be a model id (got ${JSON.stringify(value)})`;
270
+ }
271
+ }
272
+ return null;
273
+ }
274
+ async function loadRolesContext(root, usePlan) {
275
+ const config = await loadContextConfig(root);
276
+ const parsed = parseModelRoles(config?.roles);
277
+ if (!parsed.ok) return { ok: false, error: `.cursor/context/config.json: ${parsed.error}` };
278
+ let plan = {};
279
+ if (usePlan) {
280
+ const planPath = await resolveActivePlanPath(root);
281
+ if (planPath) {
282
+ plan = readPlanRoleOverrides(await readPlan(planPath).catch(() => ""));
283
+ const problem = checkPlanRoleOverrides(plan);
284
+ if (problem) return { ok: false, error: `${planPath}: ${problem}` };
285
+ }
286
+ }
287
+ return { ok: true, roles: parsed.roles, plan };
288
+ }
289
+
290
+ export {
291
+ CLAUDE_SUBAGENT_MODEL_ENV,
292
+ readPlanRoleOverrides,
293
+ resolveWorkerRole,
294
+ resolveSubworkerModel,
295
+ describeResolvedRoles,
296
+ loadRolesContext
297
+ };
@@ -5,7 +5,7 @@ import {
5
5
  resolveContained,
6
6
  saveManagedHashLedger,
7
7
  shouldPreserveCustomizedOverlay
8
- } from "./chunk-5IJQGIOY.js";
8
+ } from "./chunk-677W4QO3.js";
9
9
  import {
10
10
  ensureDir,
11
11
  fileExists
@@ -119,6 +119,7 @@ async function generateClaudeCommandAdapters(rootDir) {
119
119
  }
120
120
 
121
121
  export {
122
+ CURSOR_COMMANDS_DIR_REL,
122
123
  CLAUDE_COMMANDS_DIR_REL,
123
124
  CLAUDE_HITL_FALLBACK,
124
125
  discoverInstalledCommands,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  managedPairs
3
- } from "./chunk-AQTCXUYS.js";
3
+ } from "./chunk-EOQMAU2J.js";
4
4
  import {
5
5
  isProtectedPath,
6
6
  resolveProtectedGlobs
7
- } from "./chunk-IOQ6YXA3.js";
7
+ } from "./chunk-3HNTNYPR.js";
8
8
  import {
9
9
  resolveContained
10
- } from "./chunk-5IJQGIOY.js";
10
+ } from "./chunk-677W4QO3.js";
11
11
 
12
12
  // src/lifecycle/diff.ts
13
13
  import { readFile } from "fs/promises";
@@ -9,13 +9,13 @@ import {
9
9
  noRelayStop,
10
10
  unansweredStop,
11
11
  userEventLine
12
- } from "./chunk-WRCXRV2U.js";
12
+ } from "./chunk-P7732A25.js";
13
13
  import {
14
14
  findOnPath
15
15
  } from "./chunk-WGLPZXNU.js";
16
16
  import {
17
17
  HEADLESS_DENY_RULES
18
- } from "./chunk-6RRG3WOE.js";
18
+ } from "./chunk-Q35TWISF.js";
19
19
  import {
20
20
  HELMET_ACCENT,
21
21
  LABEL_MUTED,
@@ -848,7 +848,8 @@ async function runCursorAcp(opts) {
848
848
  write: hitl.write,
849
849
  signal: abort.signal,
850
850
  onPromptStart: hitl.onPromptStart,
851
- onPromptEnd: hitl.onPromptEnd
851
+ onPromptEnd: hitl.onPromptEnd,
852
+ checkIn: hitl.checkIn
852
853
  });
853
854
  const cancelSession = () => {
854
855
  if (sessionId && !closed)
@@ -1140,6 +1141,7 @@ function resolveHitlRunOptions(hitl, transport) {
1140
1141
  write: hitl?.write ?? ((text) => process.stdout.write(text)),
1141
1142
  onPromptStart: hitl?.onPromptStart,
1142
1143
  onPromptEnd: hitl?.onPromptEnd,
1144
+ checkIn: hitl?.checkIn,
1143
1145
  killAfterMs: hitl?.killAfterMs
1144
1146
  };
1145
1147
  }
@@ -1500,7 +1502,8 @@ function createRelay(hitl, child, redactedError) {
1500
1502
  // The gate's turn has already been noted above, so this is the session total so far.
1501
1503
  usage: usage.total(),
1502
1504
  onPromptStart: hitl.onPromptStart,
1503
- onPromptEnd: hitl.onPromptEnd
1505
+ onPromptEnd: hitl.onPromptEnd,
1506
+ checkIn: hitl.checkIn
1504
1507
  }).then(
1505
1508
  (outcome) => {
1506
1509
  if (record.stop) return;
@@ -22,6 +22,19 @@ var CONFIG_PERSONA_MODES = Object.freeze(["continue-plan", "run-plan", "cli-run-
22
22
  var CONFIG_REVIEW_BACKENDS = Object.freeze(["auto", "claude", "cursor"]);
23
23
  var CONFIG_REVIEW_MODES = Object.freeze(["paste", "autonomous"]);
24
24
  var CONFIG_REVIEW_PREFLIGHT = Object.freeze(["off", "warn", "block"]);
25
+ var ROLE_CAPABILITIES = Object.freeze({
26
+ claude: Object.freeze({ workerModel: true, subworkerModel: true, reviewer: true }),
27
+ "cursor-agent": Object.freeze({ workerModel: true, subworkerModel: false, reviewer: true }),
28
+ codex: Object.freeze({ workerModel: true, subworkerModel: false, reviewer: false }),
29
+ openrouter: Object.freeze({ workerModel: true, subworkerModel: false, reviewer: false }),
30
+ "cursor-acp": Object.freeze({ workerModel: false, subworkerModel: false, reviewer: false })
31
+ });
32
+ var CONFIG_ROLE_WORKER_BACKENDS = Object.freeze([
33
+ "auto",
34
+ ...Object.keys(ROLE_CAPABILITIES)
35
+ ]);
36
+ var CONFIG_ROLE_REVIEWER_BACKENDS = Object.freeze(["auto", "claude", "cursor-agent"]);
37
+ var CONFIG_ROLE_REVIEWER_SCOPES = Object.freeze(["off", "tick", "plan"]);
25
38
  function resolveContextConfigPath(repoRoot, fsHooks = {}) {
26
39
  const exists = fsHooks.existsSync;
27
40
  const realpath = fsHooks.realpathSync;
@@ -1,18 +1,20 @@
1
1
  import {
2
- RUN_CATALOG
3
- } from "./chunk-2Y27P6KC.js";
4
- import "./chunk-OQNJRQPZ.js";
5
- import "./chunk-WRCXRV2U.js";
2
+ RUN_CATALOG,
3
+ RUN_PROMOTE_BLOCKED
4
+ } from "./chunk-SGTTC2JP.js";
5
+ import "./chunk-W3ZJVBNY.js";
6
+ import "./chunk-P7732A25.js";
6
7
  import {
8
+ CURSOR_COMMANDS_DIR_REL,
7
9
  discoverInstalledCommands
8
- } from "./chunk-3YTFXTXH.js";
10
+ } from "./chunk-UXQH2CNC.js";
9
11
  import "./chunk-WGLPZXNU.js";
10
- import "./chunk-6RRG3WOE.js";
12
+ import "./chunk-Q35TWISF.js";
11
13
  import "./chunk-QTON2GQX.js";
12
14
  import {
13
15
  L0_ARTIFACTS
14
16
  } from "./chunk-WS6OX2IG.js";
15
- import "./chunk-5IJQGIOY.js";
17
+ import "./chunk-677W4QO3.js";
16
18
  import {
17
19
  KIT_VERSION
18
20
  } from "./chunk-7HDQEK6T.js";
@@ -20,11 +22,13 @@ import "./chunk-C4Q77GGJ.js";
20
22
  import "./chunk-5B4DVO6C.js";
21
23
 
22
24
  // src/commands/commands.ts
23
- import path from "path";
25
+ import path2 from "path";
24
26
  import { defineCommand } from "citty";
25
27
 
26
28
  // src/lifecycle/commands-catalog.ts
27
- var COMMANDS_CATALOG_VERSION = "1.0.0";
29
+ import { readFile } from "fs/promises";
30
+ import path from "path";
31
+ var COMMANDS_CATALOG_VERSION = "1.1.0";
28
32
  var COMMAND_NAME_RE = /^[a-z0-9][a-z0-9-]{0,63}$/;
29
33
  var COMMANDS_PREFIX = ".cursor/commands/";
30
34
  var NON_L0_KIT_COMMAND_IDS = /* @__PURE__ */ new Set(["context-status", "tips"]);
@@ -40,6 +44,20 @@ var FACTORY_COMMAND_IDS = /* @__PURE__ */ new Set([
40
44
  "public-inbound-radar",
41
45
  "public-issue-triage"
42
46
  ]);
47
+ var COMMAND_CONTEXTS = ["none", "goal", "plan", "branch", "pr", "sha"];
48
+ var COMMAND_AUDIENCES = ["user", "meta"];
49
+ var INTERACTIVE_ONLY_COMMAND_IDS = new Set(RUN_PROMOTE_BLOCKED);
50
+ function parseCommandRunMeta(name, raw) {
51
+ const body = /^---\r?\n([\s\S]*?)\r?\n---/.exec(raw)?.[1] ?? "";
52
+ const field = (key) => new RegExp(`^${key}:\\s*(\\S+)\\s*$`, "m").exec(body)?.[1];
53
+ const context = field("context");
54
+ const audience = field("audience");
55
+ return {
56
+ context: COMMAND_CONTEXTS.includes(context ?? "") ? context : "none",
57
+ interactiveOnly: INTERACTIVE_ONLY_COMMAND_IDS.has(name) || field("interactiveOnly") === "true",
58
+ audience: COMMAND_AUDIENCES.includes(audience ?? "") ? audience : "user"
59
+ };
60
+ }
43
61
  function commandLayer(name) {
44
62
  if (KIT_COMMAND_IDS.has(name)) return "kit";
45
63
  if (FACTORY_COMMAND_IDS.has(name)) return "factory";
@@ -47,19 +65,35 @@ function commandLayer(name) {
47
65
  }
48
66
  async function buildCommandsCatalog(rootDir) {
49
67
  const headless = new Set(RUN_CATALOG);
50
- const commands = (await discoverInstalledCommands(rootDir)).filter((c) => COMMAND_NAME_RE.test(c.name)).map((c) => ({
51
- name: c.name,
52
- description: c.description,
53
- layer: commandLayer(c.name),
54
- headless: headless.has(c.name)
55
- })).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
68
+ const dir = path.join(rootDir, CURSOR_COMMANDS_DIR_REL);
69
+ const rows = (await discoverInstalledCommands(rootDir)).filter(
70
+ (c) => COMMAND_NAME_RE.test(c.name)
71
+ );
72
+ const commands = (await Promise.all(
73
+ rows.map(async (c) => {
74
+ const raw = await readFile(path.join(dir, `${c.name}.md`), "utf8").catch(() => "");
75
+ return {
76
+ name: c.name,
77
+ description: c.description,
78
+ layer: commandLayer(c.name),
79
+ headless: headless.has(c.name),
80
+ ...parseCommandRunMeta(c.name, raw)
81
+ };
82
+ })
83
+ )).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
56
84
  return { catalogVersion: COMMANDS_CATALOG_VERSION, kitVersion: KIT_VERSION, commands };
57
85
  }
58
86
  function renderCommandsCatalog(catalog) {
59
87
  if (catalog.commands.length === 0) return "No slash commands found in .cursor/commands/.";
60
88
  const width = Math.max(...catalog.commands.map((c) => c.name.length)) + 1;
61
89
  return catalog.commands.map((c) => {
62
- const tags = [c.layer, ...c.headless ? ["headless"] : []].join(", ");
90
+ const tags = [
91
+ c.layer,
92
+ ...c.headless ? ["headless"] : [],
93
+ ...c.interactiveOnly ? ["interactive-only"] : [],
94
+ ...c.audience === "meta" ? ["meta"] : [],
95
+ ...c.context !== "none" ? [`context: ${c.context}`] : []
96
+ ].join(", ");
63
97
  return `/${c.name.padEnd(width)} [${tags}] ${c.description}`;
64
98
  }).join("\n");
65
99
  }
@@ -79,7 +113,7 @@ var commandsCommand = defineCommand({
79
113
  json: { type: "boolean", description: "Print the versioned catalog as JSON", default: false }
80
114
  },
81
115
  async run({ args }) {
82
- const catalog = await buildCommandsCatalog(path.resolve(args.cwd));
116
+ const catalog = await buildCommandsCatalog(path2.resolve(args.cwd));
83
117
  process.stdout.write(
84
118
  args.json ? `${JSON.stringify(catalog, null, 2)}
85
119
  ` : `${renderCommandsCatalog(catalog)}
@@ -1,28 +1,28 @@
1
1
  import {
2
2
  REVIEW_PACK_DEFAULT_MAX_BYTES
3
- } from "./chunk-TICKIKCQ.js";
3
+ } from "./chunk-U23SLQGX.js";
4
4
  import {
5
5
  detectAgentBackend
6
- } from "./chunk-IJQAFPY3.js";
7
- import "./chunk-MEZU47IB.js";
6
+ } from "./chunk-C4LCOOL4.js";
7
+ import "./chunk-5EBT3V7G.js";
8
8
  import {
9
9
  defaultExec,
10
10
  gateExitRedactions,
11
11
  isOutside
12
- } from "./chunk-CJ3JAH7L.js";
12
+ } from "./chunk-BGL5DRK2.js";
13
13
  import "./chunk-MUTTNRX4.js";
14
14
  import {
15
15
  ensureDispatchLogPath,
16
16
  readCommandFile,
17
17
  runHeadlessDispatch
18
- } from "./chunk-2Y27P6KC.js";
18
+ } from "./chunk-SGTTC2JP.js";
19
19
  import {
20
20
  createStreamRenderer,
21
21
  redactSecrets
22
- } from "./chunk-OQNJRQPZ.js";
23
- import "./chunk-WRCXRV2U.js";
22
+ } from "./chunk-W3ZJVBNY.js";
23
+ import "./chunk-P7732A25.js";
24
24
  import "./chunk-WGLPZXNU.js";
25
- import "./chunk-6RRG3WOE.js";
25
+ import "./chunk-Q35TWISF.js";
26
26
  import "./chunk-QTON2GQX.js";
27
27
  import {
28
28
  logger
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  REGISTRY_CLI_ARGS,
3
3
  resolveRegistryFromCli
4
- } from "./chunk-HKZH2IEE.js";
4
+ } from "./chunk-GTP224FI.js";
5
5
  import {
6
6
  logger
7
7
  } from "./chunk-ZB43YMHW.js";
8
8
  import {
9
9
  managedPairs
10
- } from "./chunk-AQTCXUYS.js";
10
+ } from "./chunk-EOQMAU2J.js";
11
11
  import "./chunk-WS6OX2IG.js";
12
12
  import {
13
13
  loadAgentKitManifest,
14
14
  normalizeRelPath
15
- } from "./chunk-IOQ6YXA3.js";
15
+ } from "./chunk-3HNTNYPR.js";
16
16
  import {
17
17
  resolveContained
18
- } from "./chunk-5IJQGIOY.js";
18
+ } from "./chunk-677W4QO3.js";
19
19
  import "./chunk-C4Q77GGJ.js";
20
20
  import "./chunk-5B4DVO6C.js";
21
21