@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.
Files changed (86) hide show
  1. package/README.md +1 -0
  2. package/dashboard/dashboard-data.mjs +126 -5
  3. package/dashboard/dashboard.html +48 -7
  4. package/dashboard/lib/guards.mjs +1 -0
  5. package/dashboard/lib/live-refresh.mjs +1 -0
  6. package/dist/{add-RKZQX6ZK.js → add-G7KEZLWP.js} +17 -8
  7. package/dist/{chunk-7HDQEK6T.js → chunk-2G4K4ZI5.js} +7 -3
  8. package/dist/{chunk-5PSV76CQ.js → chunk-2GXN7HVG.js} +26 -7
  9. package/dist/chunk-2QYWMSI5.js +193 -0
  10. package/dist/{chunk-B3VR5YBQ.js → chunk-2TW7ENWC.js} +12 -11
  11. package/dist/{chunk-IESSMKOV.js → chunk-5A72LTR3.js} +7 -7
  12. package/dist/{chunk-R4DUO5DA.js → chunk-AXQMVQ6O.js} +61 -237
  13. package/dist/{chunk-6WUKLS4D.js → chunk-BIFTTL2O.js} +1 -1
  14. package/dist/{chunk-AWQ6KRFV.js → chunk-BVZDPVUL.js} +1 -1
  15. package/dist/{chunk-QNISTPPZ.js → chunk-ENRXS5O6.js} +19 -12
  16. package/dist/chunk-FB6G6OD6.js +519 -0
  17. package/dist/{chunk-MFKHIWEL.js → chunk-FOVHFMSH.js} +1 -1
  18. package/dist/{chunk-6BEFGKCU.js → chunk-FUSNEYGU.js} +29 -3
  19. package/dist/chunk-H7KAXI5R.js +357 -0
  20. package/dist/chunk-HGB4DHXV.js +138 -0
  21. package/dist/{chunk-W3ZJVBNY.js → chunk-HXV6VQD4.js} +2374 -983
  22. package/dist/{chunk-BGL5DRK2.js → chunk-I3FGWNU5.js} +4 -4
  23. package/dist/chunk-IHVJTGYR.js +144 -0
  24. package/dist/{chunk-5LNHRL5E.js → chunk-IUY24WPE.js} +93 -263
  25. package/dist/chunk-JG5MKMOM.js +248 -0
  26. package/dist/{chunk-SGTTC2JP.js → chunk-JWIJHO67.js} +17 -2
  27. package/dist/chunk-KMK4T4ZM.js +34 -0
  28. package/dist/{chunk-ZMYV6PRE.js → chunk-LEVNLHH3.js} +2 -1
  29. package/dist/{chunk-2IP4OO6R.js → chunk-MGVV6YC4.js} +1 -1
  30. package/dist/{chunk-7TYA3GMI.js → chunk-MWRYQLEG.js} +7 -4
  31. package/dist/chunk-NHJ4IAVN.js +435 -0
  32. package/dist/{chunk-C4Q77GGJ.js → chunk-O7VMHCNN.js} +6 -0
  33. package/dist/{chunk-5EBT3V7G.js → chunk-OVRGTHZD.js} +1 -1
  34. package/dist/{chunk-F7YAAKYP.js → chunk-PCIYXGB3.js} +7 -5
  35. package/dist/{chunk-UJCATSYO.js → chunk-PLLXFSN2.js} +46 -17
  36. package/dist/{chunk-OYFCBYMP.js → chunk-RJP47EGS.js} +18 -1
  37. package/dist/{chunk-KDJ4ML7I.js → chunk-RRJVC35Y.js} +4 -4
  38. package/dist/{chunk-DRZFWIBN.js → chunk-SWJJW624.js} +1 -1
  39. package/dist/{chunk-MJJBIOSY.js → chunk-SYRJ5TTK.js} +34 -12
  40. package/dist/{chunk-L5V3W3DY.js → chunk-TTUFIE26.js} +60 -14
  41. package/dist/{chunk-JFS4GKP7.js → chunk-XXPI4H4D.js} +2 -2
  42. package/dist/{chunk-CVZNSRXV.js → chunk-Y5526WCN.js} +84 -19
  43. package/dist/{chunk-CQHD6UKB.js → chunk-Y575INEC.js} +2 -1
  44. package/dist/{chunk-V2H57TFD.js → chunk-ZNZHDPS3.js} +80 -170
  45. package/dist/{commands-SAQEEE6V.js → commands-K4HSDML5.js} +8 -6
  46. package/dist/{conflicts-5JOP4GX2.js → conflicts-4SUWIPWP.js} +9 -10
  47. package/dist/{contribute-BQKRT5GN.js → contribute-HE4WCBRY.js} +7 -5
  48. package/dist/{countdown-25E5C7AR.js → countdown-TYQHVAIX.js} +305 -32
  49. package/dist/{dashboard-P65XHYCU.js → dashboard-6V6PCNYF.js} +1 -1
  50. package/dist/{dashboard-broadcast-GYK34QYL.js → dashboard-broadcast-PMVQ7PXU.js} +1 -1
  51. package/dist/{diff-6JSXBVSX.js → diff-3XUZM7ZT.js} +15 -6
  52. package/dist/{doctor-I3MTHS7F.js → doctor-KGUWU5SN.js} +106 -19
  53. package/dist/{engine-info-BBI5QO5Y.js → engine-info-VM4VPGQM.js} +2 -2
  54. package/dist/{ground-control-IDCXN5FK.js → ground-control-ZIDHEOPW.js} +7 -4
  55. package/dist/{guard-RJZEEKSL.js → guard-ZO4Z3LLB.js} +47 -9
  56. package/dist/{handoff-5AGE2D3T.js → handoff-LLT4CI6H.js} +4 -3
  57. package/dist/{hook-WNA42CXE.js → hook-UPZ3CPYS.js} +22 -20
  58. package/dist/index.js +51 -33
  59. package/dist/{init-FZ2UFPO7.js → init-ZHLVXEVT.js} +25 -18
  60. package/dist/install-XWOG64W3.js +42 -0
  61. package/dist/installs-2ROXPO6M.js +223 -0
  62. package/dist/{mission-control-CRMCRZUU.js → mission-control-IGOI3WHS.js} +2 -2
  63. package/dist/models-5BDXREWM.js +45 -0
  64. package/dist/paths-JTPV6SXH.js +107 -0
  65. package/dist/pi-DCMDOY65.js +248 -0
  66. package/dist/{plan-index-BNLUU6T5.js → plan-index-5QZJK4AG.js} +2 -3
  67. package/dist/{queue-JW4VR33H.js → queue-Z5VNNHM6.js} +10 -12
  68. package/dist/{run-X2WOONTB.js → run-QURAXAR2.js} +27 -33
  69. package/dist/{run-plan-4MOLLIES.js → run-plan-4MMHVCTS.js} +35 -23
  70. package/dist/{scan-K3T5RQLC.js → scan-7D3RMO34.js} +2 -1
  71. package/dist/{session-start-MV7A4263.js → session-start-NC2HE5X5.js} +20 -14
  72. package/dist/{sessions-UPFDWDMB.js → sessions-WWWLYPW6.js} +4 -4
  73. package/dist/{setup-global-VNADNTQ2.js → setup-global-WDMARD4Z.js} +12 -10
  74. package/dist/{status-SXA3OK5E.js → status-2WNJL7PP.js} +17 -13
  75. package/dist/update-YSVOYYK5.js +32 -0
  76. package/dist/update-all-5XLTCHPX.js +697 -0
  77. package/package.json +14 -4
  78. package/pi/agent-kit.ts +224 -0
  79. package/dist/chunk-4MR4QXMF.js +0 -52
  80. package/dist/chunk-7ABY6DYH.js +0 -89
  81. package/dist/chunk-C4LCOOL4.js +0 -71
  82. package/dist/chunk-DZCLMIAS.js +0 -391
  83. package/dist/chunk-HAFRAXGV.js +0 -17
  84. package/dist/chunk-MUTTNRX4.js +0 -53
  85. package/dist/install-CTLT3TSI.js +0 -38
  86. package/dist/update-RMAWXMCV.js +0 -304
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  assessEnvironment
3
- } from "./chunk-B3VR5YBQ.js";
3
+ } from "./chunk-2TW7ENWC.js";
4
4
  import {
5
5
  compareSemver,
6
6
  normalizeSemver
7
- } from "./chunk-CVZNSRXV.js";
7
+ } from "./chunk-Y5526WCN.js";
8
8
  import {
9
9
  MANIFEST_RELATIVE_PATH
10
- } from "./chunk-V2H57TFD.js";
10
+ } from "./chunk-KMK4T4ZM.js";
11
11
  import {
12
12
  KIT_VERSION,
13
13
  pinnedCliSpec
14
- } from "./chunk-7HDQEK6T.js";
14
+ } from "./chunk-2G4K4ZI5.js";
15
15
  import {
16
16
  fileExists
17
17
  } from "./chunk-5B4DVO6C.js";
@@ -5,7 +5,7 @@ import {
5
5
  DEFAULT_REGISTRY_REF,
6
6
  DEFAULT_REGISTRY_URL,
7
7
  resolveRegistryRoot
8
- } from "./chunk-V2H57TFD.js";
8
+ } from "./chunk-ZNZHDPS3.js";
9
9
 
10
10
  // src/lifecycle/resolve-cli.ts
11
11
  async function resolveRegistryFromCli(options) {
@@ -1,11 +1,11 @@
1
- import {
2
- validateHandoffText
3
- } from "./chunk-2YU2H7I6.js";
4
1
  import {
5
2
  collectLiveRoster,
6
3
  formatRosterLease,
7
4
  formatRosterRow
8
- } from "./chunk-JFS4GKP7.js";
5
+ } from "./chunk-XXPI4H4D.js";
6
+ import {
7
+ validateHandoffText
8
+ } from "./chunk-2YU2H7I6.js";
9
9
  import {
10
10
  CHANGELOG_FETCH_TIMEOUT_MS,
11
11
  resolveInventoryRoot,
@@ -18,22 +18,24 @@ import {
18
18
  import {
19
19
  formatPlanIndexSection,
20
20
  writePlanIndex
21
- } from "./chunk-L5V3W3DY.js";
21
+ } from "./chunk-TTUFIE26.js";
22
22
  import {
23
- READINESS_SNAPSHOT_RELATIVE_PATH
24
- } from "./chunk-HAFRAXGV.js";
23
+ READINESS_SNAPSHOT_RELATIVE_PATH,
24
+ UPDATE_NOTICE_SESSION_FETCH_TIMEOUT_MS,
25
+ computeUpdateNotice
26
+ } from "./chunk-FB6G6OD6.js";
25
27
  import {
26
28
  stampLastCheckedAt
27
- } from "./chunk-CVZNSRXV.js";
29
+ } from "./chunk-Y5526WCN.js";
28
30
  import {
29
31
  loadContextConfig
30
32
  } from "./chunk-PFEUZXVT.js";
31
33
  import {
32
34
  MANIFEST_RELATIVE_PATH
33
- } from "./chunk-V2H57TFD.js";
35
+ } from "./chunk-KMK4T4ZM.js";
34
36
  import {
35
37
  HANDOFF_REL
36
- } from "./chunk-C4Q77GGJ.js";
38
+ } from "./chunk-O7VMHCNN.js";
37
39
  import {
38
40
  fileExists
39
41
  } from "./chunk-5B4DVO6C.js";
@@ -300,6 +302,9 @@ var HARD_RULES = `# Agent Kit session hard rules (manual mode default)
300
302
  10. **Backlog CRUD never activates.** \`/backlog-add\` enqueues (Broad Intake + write Ask + plan file + HANDOFF Backlog) without park, activate, or Gate B. \`/backlog-edit\` / \`/backlog-delete\` / \`/backlog-cancel\` require Ask confirm before mutate; delete archives from Backlog, cancel is soft in place. No Field Report cards for routine backlog CRUD.
301
303
  11. **HANDOFF machine fields are bullet fields, not \`##\` headings.** Mission Control parses \`- **Plan:**\`, \`- **Backlog plans:**\`, \`- **Parked plans:**\`, \`- **Run queue:**\` (etc.). Canonical Plan: \`- **Plan:** \\\`name.plan.md\\\`\` or \`none\`. Nested backlog/parked rows: \`- \\\`other.plan.md\\\`\`. Never invent \`## Backlog plans\` / \`## Parked plans\` / \`## Run queue\` headings in place of those fields (Checklist / Current mission go empty or idle).
302
304
  12. **Plans inventory is index + HANDOFF.** \`/continue-plan\`, \`/run-plan-all\`, and Broad Intake read \`.cursor/context/plan-index.json\` and \`.cursor/HANDOFF.md\` only. Do not glob \`.cursor/plans/*.plan.md\`. Named single-file reads of a known basename remain OK. Delegation stays (ADR \`decisions/2026-07-26_command-orchestration-delegation-pattern.md\`).`;
305
+ var PI_HOST_HITL = `## Host: pi (HITL is the numbered list)
306
+
307
+ This session runs in pi, which has no structured question tool. Wherever these rules, a slash command, a skill, AGENTS.md or CLAUDE.md say to confirm or ask through Ask questions, an Ask or a question tool, use the numbered-list fallback instead: print one line \`HITL_GATE: <ask-id> | <label 1> | <label 2> | ...\` immediately followed by the same labels as one numbered list, one list per message, then WAIT for the operator's answer (ask-id and labels: \`.cursor/skills/core/hitl-gates/SKILL.md\`). Skip or cancel means stop. Never \`/git-prod\` without the operator's explicit yes.`;
303
308
  var DOGFOOD_INBOX_HINT = `## Dogfood inbox
304
309
 
305
310
  Unprocessed files are listed under \`dogfood/README.md\` (factory) or \`.cursor/dogfood/README.md\` (consumer). To file a new note, use \`/dogfood <topic> [summary]\`. Follow the ingest ritual (detect \u2192 analyze \u2192 memory WRITE \u2192 triage). Do not auto-start analysis unless the user asks.`;
@@ -480,6 +485,18 @@ async function dogfoodInboxSection(root) {
480
485
  function colonyHostSection(env = process.env) {
481
486
  return env.COLONY_HOST_CLI?.trim() ? COLONY_HOST_HINT : null;
482
487
  }
488
+ var UPDATE_NOTICE_SECTION_DEADLINE_MS = UPDATE_NOTICE_SESSION_FETCH_TIMEOUT_MS + 1e3;
489
+ async function updateNoticeSection(root, options = {}) {
490
+ const { deadlineMs, ...noticeOptions } = options;
491
+ const summary = await withDeadline(
492
+ computeUpdateNotice(root, {
493
+ timeoutMs: UPDATE_NOTICE_SESSION_FETCH_TIMEOUT_MS,
494
+ ...noticeOptions
495
+ }),
496
+ deadlineMs ?? UPDATE_NOTICE_SECTION_DEADLINE_MS
497
+ );
498
+ return summary?.line ?? null;
499
+ }
483
500
  async function loadUpdateCheckPrefs(root) {
484
501
  const data = await loadContextConfig(root);
485
502
  if (!data) return null;
@@ -948,6 +965,7 @@ async function buildSessionStartAdditionalContext(rootDir, _payload = {}, deps =
948
965
  const handoffFull = await readFull(handoffPath);
949
966
  const handoff = capHandoffExcerpt(handoffFull);
950
967
  const parts = [HARD_RULES];
968
+ if (deps.host === "pi") parts.push(PI_HOST_HITL);
951
969
  if (await l0Present(root)) {
952
970
  const readiness = await readinessSection(root);
953
971
  if (readiness) parts.push(readiness);
@@ -962,13 +980,15 @@ async function buildSessionStartAdditionalContext(rootDir, _payload = {}, deps =
962
980
  const cursorAttempt = newAttempt();
963
981
  const inboundAttempt = newAttempt();
964
982
  const runSection = (section, attempt) => runSectionWithDeadline(section, root, deps.spawnFn, deadlineMs, attempt);
965
- const [updateNudge, cursorNudge, inboundNudge] = await Promise.all([
983
+ const [updateNotice, updateNudge, cursorNudge, inboundNudge] = await Promise.all([
984
+ updateNoticeSection(root, deps.updateNotice).catch(() => null),
966
985
  runSection(updateCheckSection, updateAttempt),
967
986
  runSection(cursorAwarenessSection, cursorAttempt),
968
987
  runSection(publicInboundSection, inboundAttempt)
969
988
  ]);
970
989
  await stampSectionAttempts(root, updateAttempt, cursorAttempt, inboundAttempt);
971
- if (updateNudge) parts.push(updateNudge);
990
+ if (updateNotice) parts.push(updateNotice);
991
+ else if (updateNudge) parts.push(updateNudge);
972
992
  if (cursorNudge) parts.push(cursorNudge);
973
993
  if (inboundNudge) parts.push(inboundNudge);
974
994
  const liveAgents = await liveAgentsPending.catch(() => null);
@@ -1048,6 +1068,8 @@ export {
1048
1068
  CURSOR_AWARENESS_SPAWN_TIMEOUT_MS,
1049
1069
  parseUnprocessedDogfoodItems,
1050
1070
  colonyHostSection,
1071
+ UPDATE_NOTICE_SECTION_DEADLINE_MS,
1072
+ updateNoticeSection,
1051
1073
  SESSION_START_SECTION_DEADLINE_MS,
1052
1074
  withDeadline,
1053
1075
  runSectionWithDeadline,
@@ -1,17 +1,62 @@
1
- import {
2
- ensurePathIgnored,
3
- gitAt
4
- } from "./chunk-MUTTNRX4.js";
5
1
  import {
6
2
  HANDOFF_REL
7
- } from "./chunk-C4Q77GGJ.js";
3
+ } from "./chunk-O7VMHCNN.js";
8
4
  import {
9
5
  ensureDir
10
6
  } from "./chunk-5B4DVO6C.js";
11
7
 
12
- // src/plan-index/plan-index.ts
13
- import { readFile, writeFile } from "fs/promises";
8
+ // src/utils/git-local-exclude.ts
9
+ import { execFile } from "child_process";
10
+ import { appendFile, mkdir, readFile } from "fs/promises";
14
11
  import path from "path";
12
+ function gitAt(cwd) {
13
+ return (args) => new Promise((resolve) => {
14
+ execFile(
15
+ "git",
16
+ [...args],
17
+ {
18
+ cwd,
19
+ env: { ...process.env, GIT_TERMINAL_PROMPT: "0" },
20
+ encoding: "utf8",
21
+ timeout: 3e4
22
+ },
23
+ (err, stdout, stderr) => {
24
+ resolve({
25
+ code: err ? typeof err.code === "number" ? err.code : 1 : 0,
26
+ stdout: String(stdout ?? ""),
27
+ stderr: String(stderr ?? err?.message ?? "")
28
+ });
29
+ }
30
+ );
31
+ });
32
+ }
33
+ async function ensurePathIgnored(git, root, relPath) {
34
+ try {
35
+ const check = () => git(["check-ignore", "-q", "--", relPath]);
36
+ const first = await check();
37
+ if (first.code === 0) return true;
38
+ if (first.code !== 1) return false;
39
+ const prefix = await git(["rev-parse", "--show-prefix"]);
40
+ const where = await git(["rev-parse", "--git-path", "info/exclude"]);
41
+ if (prefix.code !== 0 || where.code !== 0 || !where.stdout.trim()) return false;
42
+ const line = `/${prefix.stdout.trim()}${relPath}`;
43
+ const exclude = path.resolve(root, where.stdout.trim());
44
+ const current = await readFile(exclude, "utf8").catch(() => "");
45
+ if (!current.split("\n").some((l) => l.trim() === line)) {
46
+ await mkdir(path.dirname(exclude), { recursive: true });
47
+ const sep = current && !current.endsWith("\n") ? "\n" : "";
48
+ await appendFile(exclude, `${sep}${line}
49
+ `, "utf8");
50
+ }
51
+ return (await check()).code === 0;
52
+ } catch {
53
+ return false;
54
+ }
55
+ }
56
+
57
+ // src/plan-index/plan-index.ts
58
+ import { readFile as readFile2, writeFile } from "fs/promises";
59
+ import path2 from "path";
15
60
  var PLAN_INDEX_REL = ".cursor/context/plan-index.json";
16
61
  var NONE = /^(none|n\/a|empty|nil)$/i;
17
62
  var OPEN_STATUSES = /* @__PURE__ */ new Set(["pending", "in_progress"]);
@@ -20,13 +65,13 @@ function defaultPlanIndexIo() {
20
65
  return {
21
66
  async readFile(absPath) {
22
67
  try {
23
- return await readFile(absPath, "utf8");
68
+ return await readFile2(absPath, "utf8");
24
69
  } catch {
25
70
  return null;
26
71
  }
27
72
  },
28
73
  async writeFile(absPath, body) {
29
- await ensureDir(path.dirname(absPath));
74
+ await ensureDir(path2.dirname(absPath));
30
75
  await writeFile(absPath, body, "utf8");
31
76
  },
32
77
  ensureIgnored(root, relPath) {
@@ -55,11 +100,11 @@ function collectNamedPlanBasenames(named) {
55
100
  return out;
56
101
  }
57
102
  function namedPlanCandidatePaths(root, basename) {
58
- const safe = path.basename(basename);
103
+ const safe = path2.basename(basename);
59
104
  if (!/^[A-Za-z0-9._-]+\.plan\.md$/i.test(safe)) return [];
60
105
  return [
61
- path.join(root, ".cursor", "plans", safe),
62
- path.join(root, ".cursor", "plans", "archive", safe)
106
+ path2.join(root, ".cursor", "plans", safe),
107
+ path2.join(root, ".cursor", "plans", "archive", safe)
63
108
  ];
64
109
  }
65
110
  function classifyPlanRole(file, named, openTodos) {
@@ -101,7 +146,7 @@ function parsePlanFrontmatter(raw) {
101
146
  return { name, todos };
102
147
  }
103
148
  async function buildPlanIndex(root, io = defaultPlanIndexIo(), now = () => /* @__PURE__ */ new Date()) {
104
- const handoffPath = path.join(root, HANDOFF_REL);
149
+ const handoffPath = path2.join(root, HANDOFF_REL);
105
150
  const handoffText = await io.readFile(handoffPath) ?? "";
106
151
  const named = extractHandoffNamedPlans(handoffText);
107
152
  const plans = [];
@@ -132,7 +177,7 @@ async function buildPlanIndex(root, io = defaultPlanIndexIo(), now = () => /* @_
132
177
  }
133
178
  async function writePlanIndex(root, io = defaultPlanIndexIo(), now = () => /* @__PURE__ */ new Date()) {
134
179
  const index = await buildPlanIndex(root, io, now);
135
- const dest = path.join(root, PLAN_INDEX_REL);
180
+ const dest = path2.join(root, PLAN_INDEX_REL);
136
181
  const write = io.writeFile ?? defaultPlanIndexIo().writeFile;
137
182
  const ensureIgnored = io.ensureIgnored ?? (io.writeFile ? void 0 : defaultPlanIndexIo().ensureIgnored);
138
183
  if (write) {
@@ -215,6 +260,7 @@ function extractPlanBasenames(raw) {
215
260
  }
216
261
 
217
262
  export {
263
+ ensurePathIgnored,
218
264
  extractHandoffNamedPlans,
219
265
  namedPlanCandidatePaths,
220
266
  parsePlanFrontmatter,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  inspectQueueLease
3
- } from "./chunk-MFKHIWEL.js";
3
+ } from "./chunk-FOVHFMSH.js";
4
4
  import {
5
5
  HANDOFF_REL
6
- } from "./chunk-C4Q77GGJ.js";
6
+ } from "./chunk-O7VMHCNN.js";
7
7
 
8
8
  // ../../dashboard/lib/chat-sessions.mjs
9
9
  import {
@@ -1,22 +1,22 @@
1
+ import {
2
+ diffAgainstRegistry,
3
+ summarizeDiff
4
+ } from "./chunk-MWRYQLEG.js";
1
5
  import {
2
6
  contextConfigPath,
3
7
  intervalElapsed,
4
8
  loadContextConfig
5
9
  } from "./chunk-PFEUZXVT.js";
6
- import {
7
- diffAgainstRegistry,
8
- summarizeDiff
9
- } from "./chunk-7TYA3GMI.js";
10
10
  import {
11
11
  DEFAULT_REGISTRY_URL,
12
12
  assertSafeRegistrySource,
13
13
  loadAgentKitManifest,
14
14
  resolveRegistryRoot
15
- } from "./chunk-V2H57TFD.js";
15
+ } from "./chunk-ZNZHDPS3.js";
16
16
  import {
17
17
  KIT_PACKAGE_SPEC,
18
18
  KIT_VERSION
19
- } from "./chunk-7HDQEK6T.js";
19
+ } from "./chunk-2G4K4ZI5.js";
20
20
  import {
21
21
  readJson,
22
22
  writeJson
@@ -31,10 +31,43 @@ var SEMVER_CORE = /^v?(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/i;
31
31
  var FACTORY_URL_MARKERS = ["agent-kit-dev"];
32
32
  var FACTORY_REFS = /* @__PURE__ */ new Set(["staging", "homologacao", "develop", "dev"]);
33
33
  var DEFAULT_UPDATE_CHECK = {
34
- enabled: false,
34
+ enabled: true,
35
35
  intervalDays: 7,
36
36
  lastCheckedAt: null
37
37
  };
38
+ var UPDATE_CHECK_OPT_OUT_ENV = "AGENT_KIT_NO_UPDATE_CHECK";
39
+ var UPDATE_NOTIFIER_OPT_OUT_ENV = "NO_UPDATE_NOTIFIER";
40
+ function envFlagSet(value) {
41
+ if (value === void 0) return false;
42
+ const v = value.trim().toLowerCase();
43
+ return v !== "" && v !== "0" && v !== "false";
44
+ }
45
+ function updateCheckOptOut(env, config) {
46
+ if (envFlagSet(env.CI)) return "ci";
47
+ if (envFlagSet(env[UPDATE_CHECK_OPT_OUT_ENV]) || envFlagSet(env[UPDATE_NOTIFIER_OPT_OUT_ENV])) {
48
+ return "env";
49
+ }
50
+ if (config && typeof config === "object" && !Array.isArray(config)) {
51
+ const uc = config.updateCheck;
52
+ if (uc && typeof uc === "object" && uc.enabled === false) {
53
+ return "config";
54
+ }
55
+ }
56
+ return null;
57
+ }
58
+ function updateCheckAllowed(env, config) {
59
+ return updateCheckOptOut(env, config) === null;
60
+ }
61
+ function updateCheckOptOutMessage(reason) {
62
+ switch (reason) {
63
+ case "ci":
64
+ return "Update check is off under CI.";
65
+ case "env":
66
+ return `Update check is off (${UPDATE_CHECK_OPT_OUT_ENV} or ${UPDATE_NOTIFIER_OPT_OUT_ENV} is set).`;
67
+ default:
68
+ return "updateCheck.enabled is false in .cursor/context/config.json (the check is on by default and only notifies).";
69
+ }
70
+ }
38
71
  function gitEnv() {
39
72
  return { ...process.env, GIT_ALLOW_PROTOCOL: "https" };
40
73
  }
@@ -91,13 +124,21 @@ async function fetchLatestPublicVersion(registryUrl = DEFAULT_REGISTRY_URL) {
91
124
  });
92
125
  return pickLatestSemverTag(stdout);
93
126
  }
94
- var NPM_CLI_LATEST_URL = "https://registry.npmjs.org/@dadado%2Fagent-kit-cli/latest";
95
- async function fetchLatestNpmDistTag() {
127
+ var CLI_NPM_PACKAGES = [
128
+ { name: "@dadado/agent-kit-cli", bin: "agent-kit" },
129
+ { name: "@missionkit/cli", bin: "missionkit" }
130
+ ];
131
+ var CLI_BIN_NAMES = CLI_NPM_PACKAGES.map((pkg) => pkg.bin);
132
+ function npmLatestUrl(packageName) {
133
+ return `https://registry.npmjs.org/${packageName.replace("/", "%2F")}/latest`;
134
+ }
135
+ var globalNpmFetch = (url, init) => fetch(url, init);
136
+ async function fetchLatestNpmVersion(packageName, fetchImpl = globalNpmFetch, timeoutMs = 8e3) {
96
137
  try {
97
- const res = await fetch(NPM_CLI_LATEST_URL, {
138
+ const res = await fetchImpl(npmLatestUrl(packageName), {
98
139
  method: "GET",
99
140
  headers: { accept: "application/json" },
100
- signal: AbortSignal.timeout(8e3)
141
+ signal: AbortSignal.timeout(timeoutMs)
101
142
  });
102
143
  if (!res.ok) return null;
103
144
  const body = await res.json();
@@ -108,6 +149,22 @@ async function fetchLatestNpmDistTag() {
108
149
  return null;
109
150
  }
110
151
  }
152
+ async function fetchLatestCliNpmVersion(fetchImpl = globalNpmFetch, timeoutMs = 8e3) {
153
+ const results = await Promise.all(
154
+ CLI_NPM_PACKAGES.map(async (pkg) => ({
155
+ packageName: pkg.name,
156
+ version: await fetchLatestNpmVersion(pkg.name, fetchImpl, timeoutMs)
157
+ }))
158
+ );
159
+ let best = null;
160
+ for (const result of results) {
161
+ if (!result.version) continue;
162
+ if (!best || compareSemver(result.version, best.version) > 0) {
163
+ best = { packageName: result.packageName, version: result.version };
164
+ }
165
+ }
166
+ return best;
167
+ }
111
168
  function readUpdateCheckPrefs(config) {
112
169
  if (!config || typeof config !== "object" || Array.isArray(config)) {
113
170
  return { ...DEFAULT_UPDATE_CHECK };
@@ -119,7 +176,7 @@ function readUpdateCheckPrefs(config) {
119
176
  const uc = raw;
120
177
  const intervalDays = typeof uc.intervalDays === "number" && Number.isInteger(uc.intervalDays) && uc.intervalDays >= 1 ? uc.intervalDays : DEFAULT_UPDATE_CHECK.intervalDays;
121
178
  return {
122
- enabled: uc.enabled === true,
179
+ enabled: uc.enabled !== false,
123
180
  intervalDays,
124
181
  lastCheckedAt: typeof uc.lastCheckedAt === "string" ? uc.lastCheckedAt : null
125
182
  };
@@ -128,7 +185,7 @@ async function stampLastCheckedAt(cwd) {
128
185
  const existing = await loadContextConfig(cwd) ?? {};
129
186
  const prev = existing.updateCheck && typeof existing.updateCheck === "object" ? { ...existing.updateCheck } : {};
130
187
  existing.updateCheck = {
131
- ...DEFAULT_UPDATE_CHECK,
188
+ intervalDays: DEFAULT_UPDATE_CHECK.intervalDays,
132
189
  ...prev,
133
190
  lastCheckedAt: (/* @__PURE__ */ new Date()).toISOString()
134
191
  };
@@ -277,7 +334,8 @@ async function checkForUpdates(cwd, options = {}) {
277
334
  if (options.respectPrefs) {
278
335
  const config = await loadContextConfig(cwd);
279
336
  const prefs = readUpdateCheckPrefs(config);
280
- if (!prefs.enabled) {
337
+ const optOut = updateCheckOptOut(options.env ?? process.env, config);
338
+ if (optOut) {
281
339
  return {
282
340
  status: "skipped-disabled",
283
341
  installedVersion: manifest.version,
@@ -285,7 +343,7 @@ async function checkForUpdates(cwd, options = {}) {
285
343
  registryUrl,
286
344
  registryRef,
287
345
  applyRecommended: false,
288
- message: "updateCheck.enabled is false (opt-in). Set true in .cursor/context/config.json to nudge."
346
+ message: updateCheckOptOutMessage(optOut)
289
347
  };
290
348
  }
291
349
  if (!intervalElapsed(prefs.lastCheckedAt, prefs.intervalDays)) {
@@ -387,12 +445,13 @@ async function checkRunningCliVsNpmLatest(cwd, options = {}) {
387
445
  if (options.respectPrefs) {
388
446
  const config = await loadContextConfig(cwd);
389
447
  const prefs = readUpdateCheckPrefs(config);
390
- if (!prefs.enabled) {
448
+ const optOut = updateCheckOptOut(options.env ?? process.env, config);
449
+ if (optOut) {
391
450
  return {
392
451
  status: "skipped-disabled",
393
452
  runningVersion: running,
394
453
  latestVersion: null,
395
- message: "updateCheck.enabled is false (opt-in). Set true in .cursor/context/config.json to nudge."
454
+ message: updateCheckOptOutMessage(optOut)
396
455
  };
397
456
  }
398
457
  if (!intervalElapsed(prefs.lastCheckedAt, prefs.intervalDays)) {
@@ -411,7 +470,7 @@ async function checkRunningCliVsNpmLatest(cwd, options = {}) {
411
470
  } else if (options.fetchLatest) {
412
471
  latest = await options.fetchLatest();
413
472
  } else {
414
- latest = await fetchLatestNpmDistTag();
473
+ latest = (await fetchLatestCliNpmVersion())?.version ?? null;
415
474
  }
416
475
  } catch (err) {
417
476
  const msg = err instanceof Error ? err.message : String(err);
@@ -433,7 +492,7 @@ async function checkRunningCliVsNpmLatest(cwd, options = {}) {
433
492
  status: "error",
434
493
  runningVersion: running,
435
494
  latestVersion: null,
436
- message: "No semver on npm dist-tags.latest for @dadado/agent-kit-cli."
495
+ message: `No semver on npm dist-tags.latest for ${CLI_NPM_PACKAGES.map((pkg) => pkg.name).join(" or ")}.`
437
496
  };
438
497
  }
439
498
  let cmp;
@@ -474,6 +533,7 @@ async function warnIfRunningCliBehindNpm(cwd, options = {}) {
474
533
  try {
475
534
  const result = await checkRunningCliVsNpmLatest(cwd, {
476
535
  respectPrefs: options.respectPrefs ?? true,
536
+ env: options.env,
477
537
  stamp: options.stamp ?? true,
478
538
  latestVersion: options.latestVersion,
479
539
  fetchLatest: options.fetchLatest
@@ -494,10 +554,15 @@ async function warnIfRunningCliBehindNpm(cwd, options = {}) {
494
554
  }
495
555
 
496
556
  export {
557
+ updateCheckAllowed,
497
558
  compareSemver,
498
559
  normalizeSemver,
560
+ isFactoryOrDevRegistry,
561
+ CLI_NPM_PACKAGES,
562
+ fetchLatestCliNpmVersion,
499
563
  stampLastCheckedAt,
500
564
  readLocalKitVersion,
501
565
  checkForUpdates,
566
+ checkRunningCliVsNpmLatest,
502
567
  warnIfRunningCliBehindNpm
503
568
  };
@@ -2,7 +2,7 @@ import {
2
2
  REPO_ROOT_ENV,
3
3
  bundledDashboardCandidates,
4
4
  findDashboardStart
5
- } from "./chunk-ZMYV6PRE.js";
5
+ } from "./chunk-LEVNLHH3.js";
6
6
  import {
7
7
  HELMET_ACCENT,
8
8
  HELMET_FILL,
@@ -38,6 +38,7 @@ var SNAPSHOT_REPO_SOURCE_RELS = Object.freeze([
38
38
  ".cursor/context/config.json",
39
39
  ".cursor/context/current",
40
40
  ".cursor/context/readiness.json",
41
+ ".cursor/context/install-health.json",
41
42
  ".cursor/context/field-report-dismissals.json",
42
43
  ".cursor/context/field-report-plan-verdicts.json",
43
44
  ".cursor/context/mission-timing.json",