@dadado/agent-kit-cli 6.12.0 → 6.13.1

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 (44) hide show
  1. package/dashboard/dashboard-data.mjs +19 -3
  2. package/dashboard/lib/live-refresh.mjs +1 -0
  3. package/dashboard/lib/workspace-docs.d.mts +49 -0
  4. package/dashboard/lib/workspace-docs.mjs +231 -0
  5. package/dist/{add-CLRIMPN4.js → add-FTPXOOZD.js} +3 -3
  6. package/dist/{chunk-I2SG2VPJ.js → chunk-2KATW2O4.js} +2 -2
  7. package/dist/{chunk-2KIOZMTV.js → chunk-4PL57BZ5.js} +4 -0
  8. package/dist/{chunk-DVCNJNCF.js → chunk-6QBU4DQF.js} +3 -3
  9. package/dist/{chunk-5RWTDCJ7.js → chunk-A4PHFHYO.js} +4 -1
  10. package/dist/{chunk-UX6FHSO7.js → chunk-AEUE74EZ.js} +1 -1
  11. package/dist/{chunk-WAWCS5PJ.js → chunk-CFJRCJWD.js} +12 -2
  12. package/dist/{chunk-2R4HYPQH.js → chunk-DONKV6MA.js} +2 -2
  13. package/dist/{chunk-XJWCL4PO.js → chunk-DQLIEJFK.js} +1 -1
  14. package/dist/{chunk-TFKEHC2D.js → chunk-GYPCR4UO.js} +8 -4
  15. package/dist/{chunk-LAYMAMPL.js → chunk-JGEGTOF6.js} +1 -1
  16. package/dist/{chunk-OKQ3SAHK.js → chunk-JRCI2GNS.js} +1 -1
  17. package/dist/{chunk-IBE2EJZS.js → chunk-LQJNGECA.js} +2 -1
  18. package/dist/{chunk-HWYVLEET.js → chunk-N7HMTWS5.js} +4 -4
  19. package/dist/{chunk-7TEEGAED.js → chunk-NDKSOPP7.js} +1 -0
  20. package/dist/{chunk-FX6BIH4C.js → chunk-OVRWRZ5S.js} +2 -2
  21. package/dist/{chunk-5T4CHRRR.js → chunk-PHH3H5EQ.js} +1 -1
  22. package/dist/{chunk-ODI2N2BN.js → chunk-PXURVVVO.js} +2 -2
  23. package/dist/{chunk-4WHPZGF4.js → chunk-SKC6QZW4.js} +30 -5
  24. package/dist/{chunk-PGCRP5A6.js → chunk-W6U3Z2RU.js} +8 -8
  25. package/dist/{chunk-LFWPB2JR.js → chunk-ZFJIJUZ4.js} +1 -0
  26. package/dist/{commands-DVEZOEEO.js → commands-MVUJZEJ6.js} +4 -4
  27. package/dist/{contribute-E3COXKH4.js → contribute-EKTMMEYU.js} +5 -5
  28. package/dist/{countdown-F6EIHGDR.js → countdown-TFKPAYIQ.js} +2 -2
  29. package/dist/{diff-SCGNC4SF.js → diff-RFW6K4X5.js} +6 -6
  30. package/dist/{doctor-QGO4QB7R.js → doctor-3KNZI3CK.js} +10 -10
  31. package/dist/{engine-info-MNCKB55Y.js → engine-info-CYDRD7SW.js} +1 -1
  32. package/dist/{guard-X6FNFZ27.js → guard-RJZEEKSL.js} +50 -8
  33. package/dist/{hook-R7V4NG3C.js → hook-VXHZ4ICK.js} +6 -6
  34. package/dist/index.js +20 -20
  35. package/dist/{init-ONPKZS63.js → init-BDWKZGMP.js} +13 -13
  36. package/dist/{install-NHTYTVSG.js → install-NXNO4RTU.js} +13 -13
  37. package/dist/{mission-control-C2QV5D25.js → mission-control-JIF6GFSV.js} +1 -1
  38. package/dist/{queue-XI4HUFLJ.js → queue-VLIWWVKM.js} +3 -3
  39. package/dist/{run-EO5P2YZG.js → run-NKCDKMTC.js} +7 -7
  40. package/dist/{run-plan-VMW34QY6.js → run-plan-3PCINKTY.js} +3 -3
  41. package/dist/{setup-global-PMKGHX2S.js → setup-global-K53H3ZEH.js} +7 -7
  42. package/dist/{status-P2I6LE6Y.js → status-GFV3KCUR.js} +8 -8
  43. package/dist/{update-K6L24JDP.js → update-25WSBSWM.js} +11 -11
  44. package/package.json +2 -2
@@ -78,6 +78,7 @@ import {
78
78
  trimShipLaneGraphql,
79
79
  } from "./lib/ship-lane.mjs";
80
80
  import { buildTerminalSnapshotFields, MAX_TERMINAL_BYTES } from "./lib/terminal-snapshot.mjs";
81
+ import { collectDecisionIndex, collectRules } from "./lib/workspace-docs.mjs";
81
82
 
82
83
  const KIT_ROOT = resolve(import.meta.dirname, "..");
83
84
  /** Snapshot root: consumer workspace when MISSION_CONTROL_REPO_ROOT is set, else kit tree. */
@@ -164,7 +165,7 @@ function redactTerminalOutput(text) {
164
165
 
165
166
  const SNAPSHOT = {
166
167
  _schema: {
167
- version: "1.9.0",
168
+ version: "1.10.0",
168
169
  description: "Mission Control dashboard data model",
169
170
  fields: {
170
171
  generatedAt: "ISO-8601 timestamp of snapshot generation",
@@ -175,7 +176,9 @@ const SNAPSHOT = {
175
176
  agents: "Agent definitions from .cursor/agents/*.md",
176
177
  commands: "Slash commands from .cursor/commands/*.md",
177
178
  memory:
178
- "Memory records: error count, decision count, recent decisions, recent parsed errors, error-o-meter stats",
179
+ "Memory records: error count, decision count, recent decisions, recent parsed errors, error-o-meter stats, decisionIndex[] ({id, path, title, date, status: proposed|accepted|deprecated|superseded|unknown, statusText, tags[], amends[], modifiedAt}, newest file first, capped at 600; bodies never ship) (1.10.0)",
180
+ rules:
181
+ "Rules from .cursor/rules/*.mdc|*.md: {id, file, path, description, alwaysApply, globs[], kitManaged, modifiedAt}, sorted by id, capped at 200; bodies never ship (1.10.0)",
179
182
  git: "Git repository state: branch, dirty status, commit, ahead/behind, bounded files[], promotion flow vs staging/main, graph lines, staging hygiene",
180
183
  devops:
181
184
  "Best-effort DevOps signal: pipeline ({available, runs[], reason?} recent gh run list rows; reason is 'budget' when the shared snapshot budget ran out before gh was attempted, or 'call-failed' when gh was attempted and missing/unauthenticated/timed out/errored; reason is only present when available is false; fetchedAt is the ISO time gh was last attempted, reused from serve.mjs for up to 60s) and deploy ({tags[], changelog} v* git tags + latest CHANGELOG release entry as a 'what shipped recently' proxy, not a live infra poll)",
@@ -199,7 +202,7 @@ const SNAPSHOT = {
199
202
  },
200
203
  },
201
204
  generatedAt: new Date().toISOString(),
202
- dashboardDataVersion: "1.9.0",
205
+ dashboardDataVersion: "1.10.0",
203
206
  plans: [],
204
207
  system: {
205
208
  repoRoot: ROOT,
@@ -207,6 +210,7 @@ const SNAPSHOT = {
207
210
  },
208
211
  agents: [],
209
212
  commands: [],
213
+ rules: [],
210
214
  memory: {},
211
215
  git: {},
212
216
  terminals: [],
@@ -321,6 +325,7 @@ if (existsSync(commandsDir)) {
321
325
  const kitCommandPaths = new Set();
322
326
  const kitSkillDirs = new Set();
323
327
  const kitAgentPaths = new Set();
328
+ const kitRulePaths = new Set();
324
329
  const registryFile = join(ROOT, "registry", "registry.json");
325
330
  let registryHadCommands = false;
326
331
  if (existsSync(registryFile)) {
@@ -341,6 +346,9 @@ if (existsSync(registryFile)) {
341
346
  if (entry?.kind === "agent" && typeof entry?.path === "string") {
342
347
  kitAgentPaths.add(entry.path);
343
348
  }
349
+ if (entry?.kind === "rule" && typeof entry?.path === "string") {
350
+ kitRulePaths.add(entry.path);
351
+ }
344
352
  }
345
353
  registryHadCommands = kitCommandPaths.size > 0;
346
354
  } catch {
@@ -389,6 +397,8 @@ if (!registryHadCommands) {
389
397
  kitCommandPaths.add(path);
390
398
  } else if (path.startsWith(".cursor/agents/")) {
391
399
  kitAgentPaths.add(path);
400
+ } else if (path.startsWith(".cursor/rules/")) {
401
+ kitRulePaths.add(path);
392
402
  } else if (path.startsWith(".cursor/skills/") && path.endsWith("/SKILL.md")) {
393
403
  kitSkillDirs.add(path.slice(0, -"/SKILL.md".length));
394
404
  }
@@ -401,6 +411,9 @@ for (const a of SNAPSHOT.agents) {
401
411
  a.kitManaged = kitAgentPaths.has(a.path);
402
412
  }
403
413
 
414
+ // 4c. Rules: frontmatter summary only (a host opens the file by its path).
415
+ SNAPSHOT.rules = collectRules(ROOT, { kitPaths: kitRulePaths });
416
+
404
417
  // 5. Memory
405
418
  const memoryErrorsDir = join(ROOT, ".cursor", "memory", "errors");
406
419
  const memoryDecisionsDir = join(ROOT, ".cursor", "memory", "decisions");
@@ -521,6 +534,9 @@ if (existsSync(memoryDecisionsDir)) {
521
534
  id: f.replace(/\.md$/, ""),
522
535
  path: `.cursor/memory/decisions/${f}`,
523
536
  }));
537
+ // Decision index (1.10.0): title, date, Status and tags of every record, for a host's
538
+ // Decisions/ADR browser; the host opens the file by its path.
539
+ SNAPSHOT.memory.decisionIndex = collectDecisionIndex(ROOT);
524
540
  }
525
541
 
526
542
  // 6. Git
@@ -30,6 +30,7 @@ export const SNAPSHOT_REPO_SOURCE_RELS = Object.freeze([
30
30
  ".cursor/HANDOFF.md",
31
31
  ".cursor/agents",
32
32
  ".cursor/commands",
33
+ ".cursor/rules",
33
34
  ".cursor/memory",
34
35
  ".cursor/context/config.json",
35
36
  ".cursor/context/current",
@@ -0,0 +1,49 @@
1
+ export const RULES_CAP: number;
2
+ export const DECISION_INDEX_CAP: number;
3
+ export const DOC_READ_MAX_BYTES: number;
4
+ export const DOC_TITLE_MAX: number;
5
+ export const DOC_DESCRIPTION_MAX: number;
6
+ export const DOC_STATUS_TEXT_MAX: number;
7
+ export const DOC_TAGS_MAX: number;
8
+ export const DOC_TAG_MAX: number;
9
+ export const DECISION_STATUSES: readonly ["proposed", "accepted", "deprecated", "superseded"];
10
+
11
+ export type DecisionStatus = "proposed" | "accepted" | "deprecated" | "superseded" | "unknown";
12
+
13
+ export interface RuleDoc {
14
+ id: string;
15
+ file: string;
16
+ /** Repo-relative, `.cursor/rules/<file>`. */
17
+ path: string;
18
+ description: string;
19
+ alwaysApply: boolean;
20
+ globs: string[];
21
+ }
22
+
23
+ export interface RuleEntry extends RuleDoc {
24
+ kitManaged: boolean;
25
+ modifiedAt: string | null;
26
+ }
27
+
28
+ export interface DecisionDoc {
29
+ id: string;
30
+ /** Repo-relative, `.cursor/memory/decisions/<file>`. */
31
+ path: string;
32
+ title: string;
33
+ date: string;
34
+ status: DecisionStatus;
35
+ statusText: string;
36
+ tags: string[];
37
+ /** Dates of the `## Amend (...)` headings, ascending. */
38
+ amends: string[];
39
+ }
40
+
41
+ export interface DecisionIndexEntry extends DecisionDoc {
42
+ modifiedAt: string | null;
43
+ }
44
+
45
+ export function parseRuleFile(file: string, raw: string | null): RuleDoc;
46
+ export function collectRules(root: string, opts?: { kitPaths?: Set<string> }): RuleEntry[];
47
+ export function decisionStatus(text: string): DecisionStatus;
48
+ export function parseDecisionFile(file: string, raw: string | null): DecisionDoc;
49
+ export function collectDecisionIndex(root: string): DecisionIndexEntry[];
@@ -0,0 +1,231 @@
1
+ /**
2
+ * Workspace documents for the Mission Control snapshot (1.10.0): the rules
3
+ * (`.cursor/rules/*.mdc|*.md`) and a decision index over
4
+ * `.cursor/memory/decisions/*.md` (title, date, Status, tags).
5
+ *
6
+ * A host (the Colony Workspace view: Rules, Decisions/ADR) lists these natively and
7
+ * opens the file itself by its repo-relative `path`; bodies never ship in the snapshot.
8
+ * Read-only, bounded (entry caps, byte caps per file, string caps), and never throws:
9
+ * an unreadable file degrades to an entry with empty fields, a missing directory to [].
10
+ */
11
+
12
+ import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
13
+ import { join } from "node:path";
14
+
15
+ export const RULES_CAP = 200;
16
+ export const DECISION_INDEX_CAP = 600;
17
+ /** Bytes parsed per file: frontmatter and the Status line sit at the top, Tags at the end. */
18
+ export const DOC_READ_MAX_BYTES = 256 * 1024;
19
+ export const DOC_TITLE_MAX = 200;
20
+ export const DOC_DESCRIPTION_MAX = 400;
21
+ export const DOC_STATUS_TEXT_MAX = 160;
22
+ export const DOC_TAGS_MAX = 10;
23
+ export const DOC_TAG_MAX = 60;
24
+
25
+ /** The per-file Status vocabulary of `memory-loop.mdc` (decisions `_index.md` Convention). */
26
+ export const DECISION_STATUSES = Object.freeze([
27
+ "proposed",
28
+ "accepted",
29
+ "deprecated",
30
+ "superseded",
31
+ ]);
32
+
33
+ function cap(value, max) {
34
+ const s = String(value ?? "")
35
+ // biome-ignore lint/suspicious/noControlCharactersInRegex: stripping control characters is the point
36
+ .replace(/[\u0000-\u0008\u000b-\u001f\u007f]/g, "")
37
+ .trim();
38
+ return s.length > max ? `${s.slice(0, max - 1)}…` : s;
39
+ }
40
+
41
+ function readCapped(full) {
42
+ try {
43
+ const st = statSync(full);
44
+ if (!st.isFile()) return { raw: null, modifiedAt: null };
45
+ const modifiedAt = st.mtime.toISOString();
46
+ try {
47
+ const buf = readFileSync(full);
48
+ return { raw: buf.subarray(0, DOC_READ_MAX_BYTES).toString("utf8"), modifiedAt };
49
+ } catch {
50
+ return { raw: null, modifiedAt };
51
+ }
52
+ } catch {
53
+ return { raw: null, modifiedAt: null };
54
+ }
55
+ }
56
+
57
+ /** Unquote a YAML scalar (`"a"`, `'a'`) without a YAML dependency. */
58
+ function scalar(v) {
59
+ const s = String(v ?? "").trim();
60
+ if ((s.startsWith('"') && s.endsWith('"')) || (s.startsWith("'") && s.endsWith("'"))) {
61
+ return s.slice(1, -1);
62
+ }
63
+ return s;
64
+ }
65
+
66
+ /**
67
+ * Parse one rule file (Cursor `.mdc` frontmatter: `description`, `alwaysApply`, `globs`).
68
+ * `globs` may be a comma list, a flow list `[a, b]` or a block list of `- a` lines.
69
+ *
70
+ * @param {string} file - basename under `.cursor/rules/`
71
+ * @param {string | null} raw - file text (null when unreadable)
72
+ */
73
+ export function parseRuleFile(file, raw) {
74
+ const id = file.replace(/\.(mdc|md)$/, "");
75
+ const out = {
76
+ id,
77
+ file,
78
+ path: `.cursor/rules/${file}`,
79
+ description: "",
80
+ alwaysApply: false,
81
+ globs: [],
82
+ };
83
+ if (typeof raw !== "string") return out;
84
+ const fm = raw.match(/^---\r?\n([\s\S]*?)\r?\n---/);
85
+ const body = fm ? raw.slice(fm[0].length) : raw;
86
+ if (fm) {
87
+ const lines = fm[1].split(/\r?\n/);
88
+ for (let i = 0; i < lines.length; i++) {
89
+ const m = lines[i].match(/^([A-Za-z]+):\s*(.*)$/);
90
+ if (!m) continue;
91
+ const [, key, value] = m;
92
+ if (key === "description") out.description = cap(scalar(value), DOC_DESCRIPTION_MAX);
93
+ else if (key === "alwaysApply") out.alwaysApply = /^true$/i.test(scalar(value));
94
+ else if (key === "globs") {
95
+ let items = [];
96
+ const v = value.trim();
97
+ if (v.startsWith("[")) items = v.replace(/^\[|\]$/g, "").split(",");
98
+ else if (v) items = v.split(",");
99
+ else {
100
+ while (i + 1 < lines.length && /^\s+-\s+/.test(lines[i + 1])) {
101
+ items.push(lines[++i].replace(/^\s+-\s+/, ""));
102
+ }
103
+ }
104
+ out.globs = items
105
+ .map((g) => cap(scalar(g), DOC_TAG_MAX * 2))
106
+ .filter(Boolean)
107
+ .slice(0, DOC_TAGS_MAX);
108
+ }
109
+ }
110
+ }
111
+ if (!out.description) {
112
+ const h = body.match(/^#\s+(.+)$/m);
113
+ if (h) out.description = cap(h[1], DOC_DESCRIPTION_MAX);
114
+ }
115
+ return out;
116
+ }
117
+
118
+ /**
119
+ * Rules of the workspace, sorted by id, capped at RULES_CAP.
120
+ *
121
+ * @param {string} root - repository root
122
+ * @param {{ kitPaths?: Set<string> }} [opts] - repo-relative paths owned by kit updates
123
+ */
124
+ export function collectRules(root, opts = {}) {
125
+ const dir = join(root, ".cursor", "rules");
126
+ if (!existsSync(dir)) return [];
127
+ let files = [];
128
+ try {
129
+ files = readdirSync(dir).filter((f) => /\.(mdc|md)$/.test(f) && !f.startsWith("."));
130
+ } catch {
131
+ return [];
132
+ }
133
+ const kit = opts.kitPaths instanceof Set ? opts.kitPaths : new Set();
134
+ return files
135
+ .sort()
136
+ .slice(0, RULES_CAP)
137
+ .map((f) => {
138
+ const { raw, modifiedAt } = readCapped(join(dir, f));
139
+ const rule = parseRuleFile(f, raw);
140
+ return { ...rule, kitManaged: kit.has(rule.path), modifiedAt };
141
+ });
142
+ }
143
+
144
+ /**
145
+ * Normalize a Status line to the memory-loop vocabulary: the first word decides
146
+ * (`Accepted 2026-10-25 (...)` -> accepted, `Superseded by x.md` -> superseded).
147
+ */
148
+ export function decisionStatus(text) {
149
+ const w = String(text ?? "")
150
+ .replace(/^[\s*_`]+/, "")
151
+ .split(/[^A-Za-z]/)[0]
152
+ .toLowerCase();
153
+ return DECISION_STATUSES.includes(w) ? w : "unknown";
154
+ }
155
+
156
+ function splitTags(text) {
157
+ return String(text ?? "")
158
+ .split(",")
159
+ .map((t) => cap(t.replace(/[`*]/g, ""), DOC_TAG_MAX))
160
+ .filter(Boolean)
161
+ .slice(0, DOC_TAGS_MAX);
162
+ }
163
+
164
+ /**
165
+ * Parse one decision record. Fields: `# Title`, `- **Date:**`, the first
166
+ * `- **Status:**` line, tags from `- **Tags:**` or the line after a `## Tags` heading,
167
+ * and the dates of `## Amend (...)` headings.
168
+ *
169
+ * @param {string} file - basename under `.cursor/memory/decisions/`
170
+ * @param {string | null} raw - file text (null when unreadable)
171
+ */
172
+ export function parseDecisionFile(file, raw) {
173
+ const id = file.replace(/\.md$/, "");
174
+ const out = {
175
+ id,
176
+ path: `.cursor/memory/decisions/${file}`,
177
+ title: id,
178
+ date: (id.match(/^(\d{4}-\d{2}-\d{2})/) || [])[1] || "",
179
+ status: "unknown",
180
+ statusText: "",
181
+ tags: [],
182
+ amends: [],
183
+ };
184
+ if (typeof raw !== "string") return out;
185
+ const title = raw.match(/^#\s+(.+)$/m);
186
+ if (title) out.title = cap(title[1], DOC_TITLE_MAX);
187
+ const date = raw.match(/^[-*]\s+\*\*(?:Date|Data):\*\*\s*(\d{4}-\d{2}-\d{2})/m);
188
+ if (date) out.date = date[1];
189
+ const status = raw.match(/^[-*]\s+\*\*Status:\*\*\s*(.+)$/m);
190
+ if (status) {
191
+ out.statusText = cap(status[1], DOC_STATUS_TEXT_MAX);
192
+ out.status = decisionStatus(status[1]);
193
+ }
194
+ const inlineTags = raw.match(/^[-*]?\s*\*\*Tags:\*\*\s*(.+)$/m);
195
+ if (inlineTags) out.tags = splitTags(inlineTags[1]);
196
+ else {
197
+ const block = raw.match(/^##\s+Tags\s*\r?\n+([^\n#][^\n]*)/m);
198
+ if (block) out.tags = splitTags(block[1]);
199
+ }
200
+ const amends = new Set();
201
+ for (const m of raw.matchAll(/^##\s+Amend[^\n]*?(\d{4}-\d{2}-\d{2})/gm)) amends.add(m[1]);
202
+ out.amends = [...amends].sort().slice(0, DOC_TAGS_MAX);
203
+ return out;
204
+ }
205
+
206
+ /**
207
+ * Decision index, newest file name first (names are date-prefixed), capped at
208
+ * DECISION_INDEX_CAP. `_index.md` and the `archive/` folder are not records.
209
+ *
210
+ * @param {string} root - repository root
211
+ */
212
+ export function collectDecisionIndex(root) {
213
+ const dir = join(root, ".cursor", "memory", "decisions");
214
+ if (!existsSync(dir)) return [];
215
+ let files = [];
216
+ try {
217
+ files = readdirSync(dir).filter(
218
+ (f) => f.endsWith(".md") && !f.startsWith("_") && !f.startsWith("."),
219
+ );
220
+ } catch {
221
+ return [];
222
+ }
223
+ return files
224
+ .sort()
225
+ .reverse()
226
+ .slice(0, DECISION_INDEX_CAP)
227
+ .map((f) => {
228
+ const { raw, modifiedAt } = readCapped(join(dir, f));
229
+ return { ...parseDecisionFile(f, raw), modifiedAt };
230
+ });
231
+ }
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  REGISTRY_CLI_ARGS,
7
7
  resolveRegistryFromCli
8
- } from "./chunk-5T4CHRRR.js";
8
+ } from "./chunk-PHH3H5EQ.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-XJWCL4PO.js";
26
- import "./chunk-5RWTDCJ7.js";
25
+ } from "./chunk-DQLIEJFK.js";
26
+ import "./chunk-A4PHFHYO.js";
27
27
  import {
28
28
  KIT_VERSION
29
29
  } from "./chunk-7HDQEK6T.js";
@@ -4,10 +4,10 @@ import {
4
4
  import {
5
5
  compareSemver,
6
6
  normalizeSemver
7
- } from "./chunk-2R4HYPQH.js";
7
+ } from "./chunk-DONKV6MA.js";
8
8
  import {
9
9
  MANIFEST_RELATIVE_PATH
10
- } from "./chunk-XJWCL4PO.js";
10
+ } from "./chunk-DQLIEJFK.js";
11
11
  import {
12
12
  KIT_VERSION,
13
13
  pinnedCliSpec
@@ -108,6 +108,10 @@ var L0_ARTIFACTS = [
108
108
  source: ".cursor/commands/backlog-cancel.md",
109
109
  target: ".cursor/commands/backlog-cancel.md"
110
110
  },
111
+ {
112
+ source: ".cursor/commands/cancel-plan.md",
113
+ target: ".cursor/commands/cancel-plan.md"
114
+ },
111
115
  {
112
116
  source: ".cursor/commands/archive-plan.md",
113
117
  target: ".cursor/commands/archive-plan.md"
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  managedPairs
3
- } from "./chunk-FX6BIH4C.js";
3
+ } from "./chunk-OVRWRZ5S.js";
4
4
  import {
5
5
  isProtectedPath,
6
6
  resolveProtectedGlobs
7
- } from "./chunk-XJWCL4PO.js";
7
+ } from "./chunk-DQLIEJFK.js";
8
8
  import {
9
9
  resolveContained
10
- } from "./chunk-5RWTDCJ7.js";
10
+ } from "./chunk-A4PHFHYO.js";
11
11
 
12
12
  // src/lifecycle/diff.ts
13
13
  import { readFile } from "fs/promises";
@@ -374,7 +374,10 @@ var KNOWN_SHIPPED_OVERLAY_HASHES = /* @__PURE__ */ new Set([
374
374
  "2bd11cdf44d1fd536d9a52206b79b78ecb7e0276efdf0e598d3cec5f831c35b6",
375
375
  "88fa5ebe0d0fc29f8dac3de140797a85fbc8dc00e9b9c461b0e9e10bb9ef4e64",
376
376
  "c746b0424dfc3a9e36c588e48526b1f14e9c2c3032397f2ba721fa7f50390230",
377
- "9f0e1cf2e28f6949a98b7ffa0eb9c3237d8868460014f35edd9122a30fb4367c"
377
+ "9f0e1cf2e28f6949a98b7ffa0eb9c3237d8868460014f35edd9122a30fb4367c",
378
+ "22683e3bb4e85c1224b9a2fab7c3322b5dd5a2c91657a80616e29da2d5b21a19",
379
+ "99f0825be20a8f05a1e31490f0bf92b329a4bdf5e5a0dfc283ddbe8e87067dfa",
380
+ "d67f8fadb27f0cb65a8bf1672d760a0296baad60ac82cf280e91436bf95b1f71"
378
381
  ]);
379
382
 
380
383
  // src/lifecycle/paths.ts
@@ -19,7 +19,7 @@ import {
19
19
  ensureDispatchLogPath,
20
20
  readCommandFile,
21
21
  runHeadlessDispatch
22
- } from "./chunk-7TEEGAED.js";
22
+ } from "./chunk-NDKSOPP7.js";
23
23
  import {
24
24
  redactSecrets
25
25
  } from "./chunk-GDKTTV2A.js";
@@ -3,7 +3,7 @@ import {
3
3
  ScrollRegion,
4
4
  renderMcLive,
5
5
  runMcTuiLoop
6
- } from "./chunk-LFWPB2JR.js";
6
+ } from "./chunk-ZFJIJUZ4.js";
7
7
  import {
8
8
  countPendingTodos,
9
9
  findActivePlanFile,
@@ -15,11 +15,12 @@ import {
15
15
  import {
16
16
  DRIVER_PROTOCOL_VERSION,
17
17
  DriverAgentSink,
18
+ STOPPED_BY_REQUEST_REASON,
18
19
  createDriverAnswerReader,
19
20
  createDriverEmitter,
20
21
  driverReplies,
21
22
  driverStop
22
- } from "./chunk-4WHPZGF4.js";
23
+ } from "./chunk-SKC6QZW4.js";
23
24
  import {
24
25
  classifyGateExit,
25
26
  landGateExit
@@ -1015,7 +1016,15 @@ async function runPlanLoop(opts) {
1015
1016
  let endReason = "";
1016
1017
  let backend = opts.backend;
1017
1018
  let limitSwitched = false;
1019
+ const stopRequested = () => {
1020
+ if (!driver?.reader.stopRequested()) return false;
1021
+ const msg = `Stop requested by the driver (stop_after_tick) - stopping after tick ${ticksRun}. The plan is as the tick left it.`;
1022
+ say(msg);
1023
+ endReason = `${STOPPED_BY_REQUEST_REASON} after tick ${ticksRun}`;
1024
+ return true;
1025
+ };
1018
1026
  while (true) {
1027
+ if (stopRequested()) break;
1019
1028
  tick += 1;
1020
1029
  if (tick > opts.maxTicks) {
1021
1030
  const msg = `Budget of ${opts.maxTicks} ticks reached - stopping. Run again to continue.`;
@@ -1233,6 +1242,7 @@ async function runPlanLoop(opts) {
1233
1242
  endReason = "plan exhausted";
1234
1243
  break;
1235
1244
  }
1245
+ if (stopRequested()) break;
1236
1246
  if (opts.sleepSeconds > 0) {
1237
1247
  if (banners) banners.sleep(opts.sleepSeconds);
1238
1248
  if (driver) await sleep(opts.sleepSeconds * 1e3);
@@ -6,13 +6,13 @@ import {
6
6
  import {
7
7
  diffAgainstRegistry,
8
8
  summarizeDiff
9
- } from "./chunk-DVCNJNCF.js";
9
+ } from "./chunk-6QBU4DQF.js";
10
10
  import {
11
11
  DEFAULT_REGISTRY_URL,
12
12
  assertSafeRegistrySource,
13
13
  loadAgentKitManifest,
14
14
  resolveRegistryRoot
15
- } from "./chunk-XJWCL4PO.js";
15
+ } from "./chunk-DQLIEJFK.js";
16
16
  import {
17
17
  KIT_PACKAGE_SPEC,
18
18
  KIT_VERSION
@@ -8,7 +8,7 @@ import {
8
8
  saveManagedHashLedger,
9
9
  shouldPreserveCustomizedOverlay,
10
10
  toPosixRel
11
- } from "./chunk-5RWTDCJ7.js";
11
+ } from "./chunk-A4PHFHYO.js";
12
12
  import {
13
13
  HANDOFF_REL
14
14
  } from "./chunk-C4Q77GGJ.js";
@@ -8,7 +8,7 @@ import {
8
8
  createDriverEmitter,
9
9
  driverReplies,
10
10
  driverStop
11
- } from "./chunk-4WHPZGF4.js";
11
+ } from "./chunk-SKC6QZW4.js";
12
12
  import {
13
13
  detectAgentBackend
14
14
  } from "./chunk-EE3LTOBZ.js";
@@ -21,7 +21,7 @@ import {
21
21
  ensureDispatchLogPath,
22
22
  readCommandFile,
23
23
  runHeadlessDispatch
24
- } from "./chunk-7TEEGAED.js";
24
+ } from "./chunk-NDKSOPP7.js";
25
25
  import {
26
26
  formatHitlSummary,
27
27
  hitlExitCode
@@ -138,15 +138,19 @@ async function landDispatchOutcome(opts) {
138
138
  async function runDispatchDriver(opts) {
139
139
  const root = path.resolve(opts.root);
140
140
  const emitter = createDriverEmitter(opts.events.write, opts.events.now);
141
+ const say = (message, level = "info") => emitter.emit({ type: "log", level, message });
141
142
  const reader = createDriverAnswerReader({
142
143
  input: opts.events.input,
143
144
  emitter,
144
- tick: () => DISPATCH_DRIVER_TICK
145
+ tick: () => DISPATCH_DRIVER_TICK,
146
+ onStopRequested: () => say(
147
+ `stop_after_tick received: ${opts.slash} has no tick boundary, so the session runs on until its next gate, which is not offered (the run ends there, exit 4). Send {"type":"stop"} at a gate or terminate the process to end it sooner.`,
148
+ "warn"
149
+ )
145
150
  });
146
151
  const writeErr = opts.events.writeErr ?? ((text) => {
147
152
  process.stderr.write(text);
148
153
  });
149
- const say = (message, level = "info") => emitter.emit({ type: "log", level, message });
150
154
  let ticks = 0;
151
155
  let queue = null;
152
156
  const finish = async (exitCode, reason, result) => {
@@ -7,7 +7,7 @@ import {
7
7
  assertRealParentContained,
8
8
  isRealWriteTargetContained,
9
9
  resolveContained
10
- } from "./chunk-5RWTDCJ7.js";
10
+ } from "./chunk-A4PHFHYO.js";
11
11
  import {
12
12
  ensureDir
13
13
  } from "./chunk-5B4DVO6C.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MANIFEST_RELATIVE_PATH
3
- } from "./chunk-XJWCL4PO.js";
3
+ } from "./chunk-DQLIEJFK.js";
4
4
  import {
5
5
  fileExists
6
6
  } from "./chunk-5B4DVO6C.js";
@@ -5,7 +5,7 @@ import {
5
5
  resolveContained,
6
6
  saveManagedHashLedger,
7
7
  shouldPreserveCustomizedOverlay
8
- } from "./chunk-5RWTDCJ7.js";
8
+ } from "./chunk-A4PHFHYO.js";
9
9
  import {
10
10
  ensureDir,
11
11
  fileExists
@@ -33,6 +33,7 @@ var MODEL_INVOCATION_DISABLED = /* @__PURE__ */ new Set([
33
33
  "kit-prod",
34
34
  "backlog-delete",
35
35
  "backlog-cancel",
36
+ "cancel-plan",
36
37
  "archive-plan",
37
38
  "hotfix",
38
39
  "run-plan-all"
@@ -2,10 +2,10 @@ import {
2
2
  compareSemver,
3
3
  normalizeSemver,
4
4
  readLocalKitVersion
5
- } from "./chunk-2R4HYPQH.js";
5
+ } from "./chunk-DONKV6MA.js";
6
6
  import {
7
7
  L0_ARTIFACTS
8
- } from "./chunk-2KIOZMTV.js";
8
+ } from "./chunk-4PL57BZ5.js";
9
9
  import {
10
10
  copyRegistryFile,
11
11
  emptyStats,
@@ -15,11 +15,11 @@ import {
15
15
  mergeStats,
16
16
  recordOutcome,
17
17
  resolveProtectedGlobs
18
- } from "./chunk-XJWCL4PO.js";
18
+ } from "./chunk-DQLIEJFK.js";
19
19
  import {
20
20
  loadManagedHashLedger,
21
21
  saveManagedHashLedger
22
- } from "./chunk-5RWTDCJ7.js";
22
+ } from "./chunk-A4PHFHYO.js";
23
23
  import {
24
24
  KIT_PACKAGE_SPEC,
25
25
  KIT_VERSION
@@ -37,6 +37,7 @@ var RUN_CATALOG = [
37
37
  "backlog-edit",
38
38
  "backlog-delete",
39
39
  "backlog-cancel",
40
+ "cancel-plan",
40
41
  "git-staging",
41
42
  "review-pack"
42
43
  ];
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  L0_ARTIFACTS
3
- } from "./chunk-2KIOZMTV.js";
3
+ } from "./chunk-4PL57BZ5.js";
4
4
  import {
5
5
  allSkills,
6
6
  loadPackManifest,
7
7
  loadRegistry,
8
8
  packMemberFileTargets,
9
9
  skillFileTargets
10
- } from "./chunk-XJWCL4PO.js";
10
+ } from "./chunk-DQLIEJFK.js";
11
11
 
12
12
  // src/lifecycle/targets.ts
13
13
  import path from "path";