@dadado/agent-kit-cli 6.22.1 → 6.25.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 (69) hide show
  1. package/README.md +1 -0
  2. package/dashboard/dashboard-data.mjs +126 -5
  3. package/dashboard/dashboard.html +45 -4
  4. package/dashboard/lib/live-refresh.mjs +1 -0
  5. package/dist/{add-YVDIFP4N.js → add-OYLOMCM6.js} +14 -6
  6. package/dist/chunk-2F6NMQOA.js +519 -0
  7. package/dist/chunk-2QYWMSI5.js +193 -0
  8. package/dist/{chunk-B3VR5YBQ.js → chunk-2TW7ENWC.js} +12 -11
  9. package/dist/{chunk-GT5R7W66.js → chunk-2XLI7XEY.js} +1 -1
  10. package/dist/chunk-6M6UKECW.js +176 -0
  11. package/dist/{chunk-YRBRYTM5.js → chunk-7Y74KO7U.js} +45 -16
  12. package/dist/{chunk-DZCLMIAS.js → chunk-AQLBEEPD.js} +236 -2
  13. package/dist/{chunk-R4DUO5DA.js → chunk-AXQMVQ6O.js} +61 -237
  14. package/dist/{chunk-4SEQ76BQ.js → chunk-C7SV7UP5.js} +7 -4
  15. package/dist/{chunk-WS6OX2IG.js → chunk-CGXLR77R.js} +4 -0
  16. package/dist/{chunk-XZQM55BK.js → chunk-CIV42JGT.js} +7 -5
  17. package/dist/{chunk-CQHD6UKB.js → chunk-CXE6ASSX.js} +1 -0
  18. package/dist/{chunk-2FKAKFMH.js → chunk-EO5NGAYV.js} +1 -1
  19. package/dist/{chunk-GV4VKIPO.js → chunk-G5MQRP6M.js} +32 -14
  20. package/dist/chunk-GMG7ZH4E.js +357 -0
  21. package/dist/{chunk-5EBT3V7G.js → chunk-GQSSXDDK.js} +1 -1
  22. package/dist/{chunk-EYNSSL6B.js → chunk-H7RAFRRZ.js} +47 -251
  23. package/dist/{chunk-IESSMKOV.js → chunk-HSIHZWFF.js} +4 -4
  24. package/dist/{chunk-W3ZJVBNY.js → chunk-IFBIO7VT.js} +449 -418
  25. package/dist/{chunk-QWTBYXHN.js → chunk-JFS4GKP7.js} +1 -1
  26. package/dist/{chunk-LDZAK5DU.js → chunk-JG3CNGQM.js} +78 -170
  27. package/dist/{chunk-SDJIMC5S.js → chunk-JGG574RK.js} +3 -3
  28. package/dist/{chunk-SGTTC2JP.js → chunk-KWYF7QNH.js} +1 -1
  29. package/dist/{chunk-5HH3HSUR.js → chunk-M4UL422I.js} +80 -15
  30. package/dist/{chunk-DTSL2RH7.js → chunk-MFKHIWEL.js} +5 -3
  31. package/dist/{chunk-MGIPA6SD.js → chunk-NJ2SUSWX.js} +1 -1
  32. package/dist/{chunk-BCU54M2P.js → chunk-PIMGV3E5.js} +1 -1
  33. package/dist/{chunk-HJWSOZXS.js → chunk-QACMV46U.js} +10 -10
  34. package/dist/{chunk-WHBGJ7IJ.js → chunk-QLTGHJB3.js} +26 -7
  35. package/dist/{chunk-ZJDJCMQO.js → chunk-QX55T4UX.js} +23 -1
  36. package/dist/chunk-SAQ3EE5R.js +138 -0
  37. package/dist/{chunk-C4LCOOL4.js → chunk-TOSAAQ5A.js} +1 -1
  38. package/dist/chunk-WKFE3RUC.js +433 -0
  39. package/dist/{chunk-BGL5DRK2.js → chunk-XGZOU4DS.js} +1 -1
  40. package/dist/{commands-LEBG6DMD.js → commands-UW2C2ZN4.js} +5 -5
  41. package/dist/{conflicts-FJD3IVPQ.js → conflicts-RING6AHV.js} +22 -12
  42. package/dist/{contribute-XPAR2JER.js → contribute-LSY75JZH.js} +6 -5
  43. package/dist/{countdown-25E5C7AR.js → countdown-SZ2P4XHB.js} +267 -23
  44. package/dist/{diff-KFID4SX3.js → diff-NZVBVQSK.js} +14 -6
  45. package/dist/{doctor-J2GJFTSE.js → doctor-TJSXBVGV.js} +104 -18
  46. package/dist/{ground-control-IDCXN5FK.js → ground-control-ZJXPUIQN.js} +3 -3
  47. package/dist/{guard-RJZEEKSL.js → guard-ZO4Z3LLB.js} +47 -9
  48. package/dist/{handoff-5AGE2D3T.js → handoff-2OZSWGTE.js} +2 -0
  49. package/dist/{hook-HV6U3ANI.js → hook-3VPKNSOO.js} +14 -12
  50. package/dist/index.js +27 -26
  51. package/dist/{init-47WA2SCG.js → init-UW2BJBO2.js} +22 -16
  52. package/dist/install-RQSI4CHG.js +41 -0
  53. package/dist/installs-7TR4H4QH.js +222 -0
  54. package/dist/{mission-control-CRMCRZUU.js → mission-control-VSU6NT43.js} +1 -1
  55. package/dist/{queue-OJHKFKK3.js → queue-JHYILLMX.js} +10 -10
  56. package/dist/{run-Z2GHNVBO.js → run-CQF5RM5X.js} +29 -29
  57. package/dist/{run-plan-XA7MYOQ3.js → run-plan-BEOCOJCF.js} +13 -13
  58. package/dist/{scan-K3T5RQLC.js → scan-7D3RMO34.js} +2 -1
  59. package/dist/{session-start-PEVTDMOZ.js → session-start-QV7CEFRX.js} +18 -12
  60. package/dist/{sessions-6IGVH467.js → sessions-AWAAO3DU.js} +3 -3
  61. package/dist/{setup-global-KBJL7QRD.js → setup-global-ST4TT427.js} +9 -8
  62. package/dist/{status-3UGVDIO6.js → status-HUBPBGUU.js} +14 -11
  63. package/dist/update-DD5UZPGG.js +31 -0
  64. package/dist/update-all-YYUTXHGR.js +695 -0
  65. package/package.json +1 -1
  66. package/dist/chunk-HAFRAXGV.js +0 -17
  67. package/dist/chunk-ZNY32NK2.js +0 -52
  68. package/dist/install-Y63HEM4G.js +0 -38
  69. package/dist/update-4UQHGENC.js +0 -283
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  inspectQueueLease
3
- } from "./chunk-DTSL2RH7.js";
3
+ } from "./chunk-MFKHIWEL.js";
4
4
  import {
5
5
  HANDOFF_REL
6
6
  } from "./chunk-C4Q77GGJ.js";
@@ -8,39 +8,20 @@ import {
8
8
  saveManagedHashLedger,
9
9
  shouldPreserveCustomizedOverlay,
10
10
  toPosixRel
11
- } from "./chunk-ZJDJCMQO.js";
11
+ } from "./chunk-QX55T4UX.js";
12
12
  import {
13
- HANDOFF_REL
14
- } from "./chunk-C4Q77GGJ.js";
13
+ DEFAULT_PROTECTED_PATHS,
14
+ LEGACY_CONTEXT_PROTECTED_GLOB,
15
+ MANIFEST_RELATIVE_PATH,
16
+ MANIFEST_SCHEMA_VERSION,
17
+ acquireDirLock
18
+ } from "./chunk-6M6UKECW.js";
15
19
  import {
16
20
  fileExists,
17
21
  readJson,
18
22
  writeJson
19
23
  } from "./chunk-5B4DVO6C.js";
20
24
 
21
- // src/manifest/types.ts
22
- var MANIFEST_FILENAME = "agent-kit.json";
23
- var MANIFEST_RELATIVE_PATH = `.cursor/${MANIFEST_FILENAME}`;
24
- var MANIFEST_SCHEMA_VERSION = 1;
25
- var DEFAULT_PROTECTED_PATHS = [
26
- HANDOFF_REL,
27
- ".cursor/plans/**",
28
- ".cursor/memory/**",
29
- ".cursor/context/config.json",
30
- ".cursor/context/current/**",
31
- ".cursor/context/backups/**"
32
- ];
33
- var LEGACY_CONTEXT_PROTECTED_GLOB = ".cursor/context/**";
34
- var DOMAIN_PACK_IDS = [
35
- "cybersec",
36
- "devops",
37
- "engineering-architecture",
38
- "clean-code",
39
- "project-management",
40
- "context-management",
41
- "quality"
42
- ];
43
-
44
25
  // src/manifest/index.ts
45
26
  import path from "path";
46
27
 
@@ -307,6 +288,33 @@ function isProtectedPath(relPath, globs) {
307
288
  return matchesAnyGlob(relPath, globs);
308
289
  }
309
290
 
291
+ // src/registry/pack-aliases.ts
292
+ var LEGACY_PACK_ID_ALIASES = Object.freeze({
293
+ "gestao-projeto": "project-management",
294
+ "gestao-contexto": "context-management",
295
+ "engenharia-arquitetura": "engineering-architecture"
296
+ });
297
+ function legacyPackIdTarget(id) {
298
+ return Object.hasOwn(LEGACY_PACK_ID_ALIASES, id) ? LEGACY_PACK_ID_ALIASES[id] : void 0;
299
+ }
300
+ function formatPackIdRewrite(rewrite) {
301
+ return `Pack id '${rewrite.from}' renamed to '${rewrite.to}' in ${MANIFEST_RELATIVE_PATH} (legacy L1 pack id).`;
302
+ }
303
+ function formatUnknownPack(packId, knownIds) {
304
+ const known = knownIds.length > 0 ? knownIds.join(", ") : "none";
305
+ return `Unknown pack '${packId}': not found in registry (known packs: ${known}). Next: replace or remove '${packId}' in "packs" of ${MANIFEST_RELATIVE_PATH} (or in --pack), then re-run.`;
306
+ }
307
+ var UnknownPackError = class extends Error {
308
+ packId;
309
+ knownIds;
310
+ constructor(packId, knownIds) {
311
+ super(formatUnknownPack(packId, knownIds));
312
+ this.name = "UnknownPackError";
313
+ this.packId = packId;
314
+ this.knownIds = knownIds;
315
+ }
316
+ };
317
+
310
318
  // src/registry/client.ts
311
319
  import path2 from "path";
312
320
 
@@ -332,12 +340,39 @@ async function findSkill(rootDir, skillId) {
332
340
  if (!skill) throw new Error(`Skill '${skillId}' not found in registry.`);
333
341
  return skill;
334
342
  }
343
+ function resolvePackSummary(index, packId) {
344
+ const packs = allPacks(index);
345
+ const exact = packs.find((item) => item.id === packId);
346
+ if (exact) return exact;
347
+ const alias = legacyPackIdTarget(packId);
348
+ return alias ? packs.find((item) => item.id === alias) : void 0;
349
+ }
335
350
  async function findPack(rootDir, packId) {
336
351
  const index = await loadRegistry(rootDir);
337
- const pack = allPacks(index).find((item) => item.id === packId);
338
- if (!pack) throw new Error(`Pack '${packId}' not found in registry.`);
352
+ const pack = resolvePackSummary(index, packId);
353
+ if (!pack)
354
+ throw new UnknownPackError(
355
+ packId,
356
+ allPacks(index).map((item) => item.id)
357
+ );
339
358
  return pack;
340
359
  }
360
+ async function canonicalizePackIds(rootDir, packIds) {
361
+ const index = await loadRegistry(rootDir);
362
+ const knownIds = allPacks(index).map((item) => item.id);
363
+ if (!packIds) return { packs: void 0, rewrites: [], unknown: [], knownIds };
364
+ const packs = [];
365
+ const rewrites = [];
366
+ const unknown = [];
367
+ for (const id of packIds) {
368
+ const summary = resolvePackSummary(index, id);
369
+ if (!summary) unknown.push(id);
370
+ else if (summary.id !== id) rewrites.push({ from: id, to: summary.id });
371
+ const resolved = summary?.id ?? id;
372
+ if (!packs.includes(resolved)) packs.push(resolved);
373
+ }
374
+ return { packs, rewrites, unknown, knownIds };
375
+ }
341
376
 
342
377
  // src/lifecycle/apply.ts
343
378
  import { copyFile, lstat, mkdir, readFile } from "fs/promises";
@@ -676,147 +711,16 @@ async function packMemberFileTargets(registryRoot, member) {
676
711
 
677
712
  // src/registry/resolve.ts
678
713
  import { execFile } from "child_process";
679
- import { createHash, randomUUID } from "crypto";
680
- import { mkdir as mkdir2, readFile as readFile3, rename, rm, stat, writeFile } from "fs/promises";
714
+ import { createHash } from "crypto";
681
715
  import { homedir } from "os";
682
716
  import path5 from "path";
683
717
  import { promisify } from "util";
684
718
  var execFileAsync = promisify(execFile);
685
- var LOCK_TIMEOUT_MS = 6e4;
686
- var LOCK_RETRY_MS = 200;
687
- var LOCK_STALE_MS = 5 * 6e4;
688
- var LOCK_REFRESH_MS = 1e4;
689
- function lockOwnerPath(lockDir) {
690
- return path5.join(lockDir, "owner.json");
691
- }
692
- function isProcessAlive(pid) {
693
- try {
694
- process.kill(pid, 0);
695
- return true;
696
- } catch {
697
- return false;
698
- }
699
- }
700
- async function readLockOwner(lockDir) {
701
- try {
702
- const raw = await readFile3(lockOwnerPath(lockDir), "utf8");
703
- const parsed = JSON.parse(raw);
704
- if (typeof parsed.pid === "number" && typeof parsed.uuid === "string") {
705
- return parsed;
706
- }
707
- } catch {
708
- }
709
- return null;
710
- }
711
- async function writeLockOwner(lockDir, owner) {
712
- const finalPath = lockOwnerPath(lockDir);
713
- const tmpPath = path5.join(lockDir, `owner.${owner.uuid}.${randomUUID()}.tmp`);
714
- await writeFile(tmpPath, JSON.stringify(owner), "utf8");
715
- await rename(tmpPath, finalPath);
716
- }
717
- async function refreshLockOwner(lockDir, uuid) {
718
- const owner = await readLockOwner(lockDir);
719
- if (owner && owner.uuid !== uuid) return;
720
- await writeLockOwner(lockDir, { pid: process.pid, uuid, updatedAt: Date.now() });
721
- }
722
- async function releaseCacheLock(lockDir, uuid) {
723
- const claimPath = path5.join(lockDir, `releasing.${uuid}`);
724
- try {
725
- await rename(lockOwnerPath(lockDir), claimPath);
726
- } catch {
727
- return;
728
- }
729
- let claimed = null;
730
- try {
731
- const raw = await readFile3(claimPath, "utf8");
732
- const parsed = JSON.parse(raw);
733
- if (typeof parsed.pid === "number" && typeof parsed.uuid === "string") {
734
- claimed = parsed;
735
- }
736
- } catch {
737
- }
738
- if (!claimed || claimed.uuid !== uuid) {
739
- try {
740
- await rename(claimPath, lockOwnerPath(lockDir));
741
- } catch {
742
- }
743
- return;
744
- }
745
- try {
746
- await rm(lockDir, { recursive: true, force: true });
747
- } catch {
748
- }
749
- }
750
- async function tryReclaimStaleLock(lockDir) {
751
- let owner;
752
- let lockStat;
753
- try {
754
- lockStat = await stat(lockDir);
755
- owner = await readLockOwner(lockDir);
756
- } catch {
757
- return false;
758
- }
759
- const now = Date.now();
760
- if (owner) {
761
- const ownerFresh = now - owner.updatedAt < LOCK_STALE_MS;
762
- if (isProcessAlive(owner.pid) && ownerFresh) {
763
- return false;
764
- }
765
- }
766
- if (now - lockStat.mtimeMs > LOCK_STALE_MS) {
767
- try {
768
- await rm(lockDir, { recursive: true, force: true });
769
- return true;
770
- } catch {
771
- }
772
- }
773
- return false;
774
- }
775
- async function acquireCacheLock(cacheDir) {
776
- const lockDir = `${cacheDir}.lock`;
777
- const deadline = Date.now() + LOCK_TIMEOUT_MS;
778
- const uuid = randomUUID();
779
- const owner = { pid: process.pid, uuid, updatedAt: Date.now() };
780
- await mkdir2(path5.dirname(lockDir), { recursive: true });
781
- let lastErrorCode;
782
- while (Date.now() < deadline) {
783
- try {
784
- await mkdir2(lockDir, { recursive: false });
785
- await writeLockOwner(lockDir, owner);
786
- let refreshing = false;
787
- const refreshInterval = setInterval(() => {
788
- if (refreshing) return;
789
- refreshing = true;
790
- refreshLockOwner(lockDir, uuid).catch(() => {
791
- }).finally(() => {
792
- refreshing = false;
793
- });
794
- }, LOCK_REFRESH_MS);
795
- return async () => {
796
- clearInterval(refreshInterval);
797
- await releaseCacheLock(lockDir, uuid);
798
- };
799
- } catch (err) {
800
- const code = err.code;
801
- lastErrorCode = code;
802
- if (code === "EEXIST") {
803
- if (await tryReclaimStaleLock(lockDir)) {
804
- continue;
805
- }
806
- await new Promise((r) => setTimeout(r, LOCK_RETRY_MS + Math.random() * 100));
807
- continue;
808
- }
809
- if (code === "ENOENT") {
810
- await mkdir2(path5.dirname(lockDir), { recursive: true });
811
- await new Promise((r) => setTimeout(r, LOCK_RETRY_MS + Math.random() * 100));
812
- continue;
813
- }
814
- throw err;
815
- }
816
- }
817
- throw new Error(
818
- lastErrorCode === "ENOENT" ? `Timed out acquiring cache lock on ${cacheDir}: the lock parent directory kept vanishing (concurrent cache clear?).` : `Timed out waiting for cache lock on ${cacheDir}. Another install may be stuck.`
819
- );
719
+ function acquireCacheLock(cacheDir) {
720
+ return acquireDirLock(cacheDir, {
721
+ vanishedMessage: (target) => `Timed out acquiring cache lock on ${target}: the lock parent directory kept vanishing (concurrent cache clear?).`,
722
+ timeoutMessage: (target) => `Timed out waiting for cache lock on ${target}. Another install may be stuck.`
723
+ });
820
724
  }
821
725
  var DEFAULT_REGISTRY_URL = "https://github.com/agent-kit-startup/agent-kit";
822
726
  var DEFAULT_REGISTRY_REF = "main";
@@ -842,9 +746,9 @@ async function hasRegistryIndex(root) {
842
746
  return fileExists(path5.join(root, REGISTRY_INDEX_REL));
843
747
  }
844
748
  async function cloneRegistry(url, ref, dest) {
845
- const { mkdir: mkdir3, rm: rm2 } = await import("fs/promises");
846
- await mkdir3(path5.dirname(dest), { recursive: true });
847
- const clearPartial = () => rm2(dest, { recursive: true, force: true });
749
+ const { mkdir: mkdir2, rm } = await import("fs/promises");
750
+ await mkdir2(path5.dirname(dest), { recursive: true });
751
+ const clearPartial = () => rm(dest, { recursive: true, force: true });
848
752
  await clearPartial();
849
753
  try {
850
754
  await execFileAsync("git", ["clone", "--depth", "1", "--branch", ref, "--", url, dest], {
@@ -935,8 +839,6 @@ async function resolveRegistryRoot(options) {
935
839
  }
936
840
 
937
841
  export {
938
- MANIFEST_RELATIVE_PATH,
939
- DOMAIN_PACK_IDS,
940
842
  loadAgentKitManifest,
941
843
  DEFAULT_REGISTRY_URL,
942
844
  DEFAULT_REGISTRY_REF,
@@ -945,11 +847,17 @@ export {
945
847
  normalizeRelPath,
946
848
  resolveProtectedGlobs,
947
849
  isProtectedPath,
850
+ legacyPackIdTarget,
851
+ formatPackIdRewrite,
852
+ formatUnknownPack,
853
+ UnknownPackError,
948
854
  loadRegistry,
949
855
  allSkills,
950
856
  allPacks,
951
857
  findSkill,
858
+ resolvePackSummary,
952
859
  findPack,
860
+ canonicalizePackIds,
953
861
  emptyStats,
954
862
  mergeStats,
955
863
  copyRegistryFile,
@@ -1,13 +1,13 @@
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-5HH3HSUR.js";
7
+ } from "./chunk-M4UL422I.js";
8
8
  import {
9
9
  MANIFEST_RELATIVE_PATH
10
- } from "./chunk-LDZAK5DU.js";
10
+ } from "./chunk-6M6UKECW.js";
11
11
  import {
12
12
  KIT_VERSION,
13
13
  pinnedCliSpec
@@ -13,7 +13,7 @@ import {
13
13
  redactSecrets,
14
14
  resolveHitlRunOptions,
15
15
  spawnLogged
16
- } from "./chunk-W3ZJVBNY.js";
16
+ } from "./chunk-IFBIO7VT.js";
17
17
  import {
18
18
  RESERVED_GATE_IDS
19
19
  } from "./chunk-P7732A25.js";
@@ -6,13 +6,13 @@ import {
6
6
  import {
7
7
  diffAgainstRegistry,
8
8
  summarizeDiff
9
- } from "./chunk-4SEQ76BQ.js";
9
+ } from "./chunk-C7SV7UP5.js";
10
10
  import {
11
11
  DEFAULT_REGISTRY_URL,
12
12
  assertSafeRegistrySource,
13
13
  loadAgentKitManifest,
14
14
  resolveRegistryRoot
15
- } from "./chunk-LDZAK5DU.js";
15
+ } from "./chunk-JG3CNGQM.js";
16
16
  import {
17
17
  KIT_PACKAGE_SPEC,
18
18
  KIT_VERSION
@@ -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
  };
@@ -62,7 +62,7 @@ function decideQueueLease(lease, probe) {
62
62
  reason: `heartbeat expired (dispatcher pid ${lease.dispatcher.pid})`
63
63
  };
64
64
  }
65
- function formatQueueLeaseRefusal(v) {
65
+ function formatQueueLeaseRefusal(v, opts = {}) {
66
66
  const l = v.lease;
67
67
  const who = [
68
68
  `dispatcher pid ${l.dispatcher.pid}`,
@@ -72,8 +72,10 @@ function formatQueueLeaseRefusal(v) {
72
72
  `started ${l.startedAt}`,
73
73
  `last heartbeat ${l.heartbeatAt}`
74
74
  ].join(", ");
75
- const next = v.orphan ? `It may still be writing this repository. Check it (ps -o pid,etime,args -p ${l.agent?.pid}), stop it, then start /run-plan-all again.` : "Wait for that session to end (or stop it from the window that started it), then start /run-plan-all again.";
76
- return `Queue lease held: another /run-plan-all owns this queue (${v.reason}; ${who}). ${next}`;
75
+ const again = opts.next ?? "start /run-plan-all again";
76
+ const next = v.orphan ? `It may still be writing this repository. Check it (ps -o pid,etime,args -p ${l.agent?.pid}), stop it, then ${again}.` : `Wait for that session to end (or stop it from the window that started it), then ${again}.`;
77
+ const what = opts.what ?? "another /run-plan-all owns this queue";
78
+ return `Queue lease held: ${what} (${v.reason}; ${who}). ${next}`;
77
79
  }
78
80
  function procStart(pid) {
79
81
  if (process.platform !== "linux") return null;
@@ -9,7 +9,7 @@ import {
9
9
  assertRealParentContained,
10
10
  isRealWriteTargetContained,
11
11
  resolveContained
12
- } from "./chunk-ZJDJCMQO.js";
12
+ } from "./chunk-QX55T4UX.js";
13
13
  import {
14
14
  ensureDir
15
15
  } 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-LDZAK5DU.js";
8
+ } from "./chunk-JG3CNGQM.js";
9
9
 
10
10
  // src/lifecycle/resolve-cli.ts
11
11
  async function resolveRegistryFromCli(options) {
@@ -6,29 +6,29 @@ import {
6
6
  driverReplies,
7
7
  driverStop
8
8
  } from "./chunk-6WUKLS4D.js";
9
- import {
10
- QUEUE_LEASE_INTERRUPT_WAIT_MS,
11
- QUEUE_LEASE_SESSION_ENV,
12
- acquireQueueLease,
13
- forwardTermination,
14
- gateCheckIn
15
- } from "./chunk-DTSL2RH7.js";
16
9
  import {
17
10
  readRunQueueState
18
11
  } from "./chunk-7ABY6DYH.js";
19
12
  import {
20
13
  detectAgentBackend
21
- } from "./chunk-C4LCOOL4.js";
14
+ } from "./chunk-TOSAAQ5A.js";
22
15
  import {
23
16
  classifyGateExit,
24
17
  landGateExit
25
- } from "./chunk-BGL5DRK2.js";
18
+ } from "./chunk-XGZOU4DS.js";
19
+ import {
20
+ QUEUE_LEASE_INTERRUPT_WAIT_MS,
21
+ QUEUE_LEASE_SESSION_ENV,
22
+ acquireQueueLease,
23
+ forwardTermination,
24
+ gateCheckIn
25
+ } from "./chunk-MFKHIWEL.js";
26
26
  import {
27
27
  buildDispatchPrompt,
28
28
  ensureDispatchLogPath,
29
29
  readCommandFile,
30
30
  runHeadlessDispatch
31
- } from "./chunk-SGTTC2JP.js";
31
+ } from "./chunk-KWYF7QNH.js";
32
32
  import {
33
33
  formatHitlSummary,
34
34
  hitlExitCode