@indigoai-us/hq-cli 5.345.220 → 5.345.222

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 (184) hide show
  1. package/CHANGELOG.md +164 -0
  2. package/dist/command-catalog.generated.d.ts +175 -2
  3. package/dist/command-catalog.generated.js +213 -2
  4. package/dist/commands/auth.js +6 -2
  5. package/dist/commands/bot-runtime.d.ts +18 -5
  6. package/dist/commands/bot-runtime.js +29 -12
  7. package/dist/commands/bot.d.ts +39 -2
  8. package/dist/commands/bot.js +140 -11
  9. package/dist/commands/core-delegate-w1b.js +9 -3
  10. package/dist/commands/core-stop-autosave.d.ts +21 -0
  11. package/dist/commands/core-stop-autosave.js +300 -0
  12. package/dist/commands/core.js +2 -0
  13. package/dist/commands/daemon.d.ts +6 -0
  14. package/dist/commands/daemon.js +46 -8
  15. package/dist/commands/doctor-usage.d.ts +5 -0
  16. package/dist/commands/doctor-usage.js +25 -0
  17. package/dist/commands/env.d.ts +49 -4
  18. package/dist/commands/env.js +355 -5
  19. package/dist/commands/lanes-shared.d.ts +3 -0
  20. package/dist/commands/lanes.d.ts +3 -0
  21. package/dist/commands/lanes.js +87 -3
  22. package/dist/commands/link.d.ts +2 -0
  23. package/dist/commands/link.js +14 -2
  24. package/dist/commands/mesh.js +23 -3
  25. package/dist/commands/sources.js +3 -3
  26. package/dist/commands/sync-core.d.ts +7 -0
  27. package/dist/commands/sync-core.js +132 -3
  28. package/dist/commands/whoami.js +96 -80
  29. package/dist/data/command-states.json +3 -0
  30. package/dist/lib/bot/config.d.ts +17 -0
  31. package/dist/lib/bot/config.js +13 -0
  32. package/dist/lib/bot/fleet-cron.js +24 -2
  33. package/dist/lib/bot/fleet-local.d.ts +30 -2
  34. package/dist/lib/bot/fleet-local.js +60 -1
  35. package/dist/lib/bot/grok-login-scope.d.ts +36 -0
  36. package/dist/lib/bot/grok-login-scope.js +93 -0
  37. package/dist/lib/bot/legacy-provider-login.d.ts +32 -9
  38. package/dist/lib/bot/legacy-provider-login.js +28 -22
  39. package/dist/lib/bot/runtime-sign-in-check.js +6 -1
  40. package/dist/lib/bot/runtime-sign-in.d.ts +2 -0
  41. package/dist/lib/core-utils/sentry-report.js +2 -0
  42. package/dist/lib/daemon/catalog.js +2 -0
  43. package/dist/lib/daemon/install.d.ts +2 -1
  44. package/dist/lib/daemon/install.js +9 -0
  45. package/dist/lib/daemon/legacy.d.ts +1 -0
  46. package/dist/lib/daemon/legacy.js +5 -2
  47. package/dist/lib/daemon/machine-check-owner.d.ts +2 -0
  48. package/dist/lib/daemon/machine-check-owner.js +6 -1
  49. package/dist/lib/daemon/machine-checks.d.ts +29 -2
  50. package/dist/lib/daemon/machine-checks.js +64 -13
  51. package/dist/lib/daemon/mesh-owner.d.ts +45 -0
  52. package/dist/lib/daemon/mesh-owner.js +166 -0
  53. package/dist/lib/daemon/native-notice-ledger.d.ts +27 -0
  54. package/dist/lib/daemon/native-notice-ledger.js +113 -0
  55. package/dist/lib/daemon/run.d.ts +15 -0
  56. package/dist/lib/daemon/run.js +137 -11
  57. package/dist/lib/daemon/selfcheck.d.ts +35 -2
  58. package/dist/lib/daemon/selfcheck.js +118 -9
  59. package/dist/lib/daemon/stop-autosave-lock.d.ts +19 -0
  60. package/dist/lib/daemon/stop-autosave-lock.js +166 -0
  61. package/dist/lib/daemon/stop-autosave.d.ts +28 -0
  62. package/dist/lib/daemon/stop-autosave.js +111 -0
  63. package/dist/lib/daemon/stop-diagnostics.d.ts +11 -0
  64. package/dist/lib/daemon/stop-diagnostics.js +136 -0
  65. package/dist/lib/daemon/stop-job-executor.d.ts +19 -0
  66. package/dist/lib/daemon/stop-job-executor.js +126 -0
  67. package/dist/lib/daemon/stop-jobs.d.ts +93 -0
  68. package/dist/lib/daemon/stop-jobs.js +599 -0
  69. package/dist/lib/doctor/checks/fleet-hook-core.js +1 -1
  70. package/dist/lib/doctor/checks/host-core.js +1 -1
  71. package/dist/lib/environment/access-probes.d.ts +234 -0
  72. package/dist/lib/environment/access-probes.js +918 -0
  73. package/dist/lib/environment/profile.d.ts +15 -2
  74. package/dist/lib/environment/profile.js +55 -20
  75. package/dist/lib/environment/rfc3339.d.ts +8 -0
  76. package/dist/lib/environment/rfc3339.js +26 -0
  77. package/dist/lib/environment/work-requirements.d.ts +169 -0
  78. package/dist/lib/environment/work-requirements.js +389 -0
  79. package/dist/lib/hook-engine/coverage.d.ts +146 -7
  80. package/dist/lib/hook-engine/coverage.js +1480 -4
  81. package/dist/lib/hook-engine/fleet-registration.js +2 -2
  82. package/dist/lib/hook-engine/git-stop-config.json +513 -0
  83. package/dist/lib/hook-engine/native-stop-compatibility.json +362 -0
  84. package/dist/lib/hook-engine/reconcile.js +2 -2
  85. package/dist/lib/hot-channels/alert.d.ts +2 -2
  86. package/dist/lib/hot-channels/alert.js +8 -5
  87. package/dist/lib/hot-channels/signals-pass.d.ts +126 -17
  88. package/dist/lib/hot-channels/signals-pass.js +296 -17
  89. package/dist/lib/hot-channels/signals-runtime.d.ts +30 -0
  90. package/dist/lib/hot-channels/signals-runtime.js +82 -0
  91. package/dist/lib/install/hook-target.js +1 -1
  92. package/dist/lib/lanes/host-capacity.d.ts +26 -2
  93. package/dist/lib/lanes/host-capacity.js +17 -2
  94. package/dist/lib/lanes/host-compute.d.ts +90 -0
  95. package/dist/lib/lanes/host-compute.js +185 -0
  96. package/dist/lib/lanes/index.d.ts +2 -0
  97. package/dist/lib/lanes/index.js +1 -0
  98. package/dist/lib/lanes/reconcile.js +22 -1
  99. package/dist/lib/lanes/resource-usage.d.ts +155 -0
  100. package/dist/lib/lanes/resource-usage.js +589 -0
  101. package/dist/lib/lanes/run-size.d.ts +46 -0
  102. package/dist/lib/lanes/run-size.js +197 -0
  103. package/dist/lib/lanes/store.js +27 -0
  104. package/dist/lib/lanes/throttle.d.ts +36 -1
  105. package/dist/lib/lanes/throttle.js +47 -10
  106. package/dist/lib/lanes/types.d.ts +40 -0
  107. package/dist/lib/lanes/types.js +2 -2
  108. package/dist/lib/lanes/watcher.js +13 -4
  109. package/dist/lib/lanes/worker-process.d.ts +25 -2
  110. package/dist/lib/lanes/worker-process.js +71 -19
  111. package/dist/lib/mesh/live/daemon/config.d.ts +8 -1
  112. package/dist/lib/mesh/live/daemon/config.js +16 -0
  113. package/dist/lib/mesh/live/daemon/install.d.ts +31 -2
  114. package/dist/lib/mesh/live/daemon/install.js +142 -1
  115. package/dist/lib/mesh/live/daemon/login-home.d.ts +5 -0
  116. package/dist/lib/mesh/live/daemon/login-home.js +27 -0
  117. package/dist/lib/mesh/live/daemon/unit-home.d.ts +49 -0
  118. package/dist/lib/mesh/live/daemon/unit-home.js +134 -0
  119. package/dist/lib/placement/match.d.ts +192 -0
  120. package/dist/lib/placement/match.js +667 -0
  121. package/dist/lib/registry/registry.d.ts +35 -7
  122. package/dist/lib/registry/registry.js +88 -13
  123. package/dist/lib/safe-store.d.ts +14 -0
  124. package/dist/lib/safe-store.js +77 -4
  125. package/dist/lib/scan-packages/index.js +24 -2
  126. package/dist/lib/search-index/index.d.ts +88 -4
  127. package/dist/lib/search-index/index.js +288 -24
  128. package/dist/lib/search-index/max-doc-bytes.d.ts +17 -6
  129. package/dist/lib/search-index/max-doc-bytes.js +49 -23
  130. package/dist/lib/service-manager/startup-migration.d.ts +1 -0
  131. package/dist/lib/service-manager/startup-migration.js +3 -0
  132. package/dist/lib/signals/codex-lockdown.d.ts +79 -0
  133. package/dist/lib/signals/codex-lockdown.js +271 -0
  134. package/dist/lib/signals/codex-login.d.ts +37 -0
  135. package/dist/lib/signals/codex-login.js +83 -0
  136. package/dist/lib/signals/engine.d.ts +27 -0
  137. package/dist/lib/signals/engine.js +70 -0
  138. package/dist/lib/signals/reply.js +22 -1
  139. package/dist/lib/signals/run-record.js +6 -1
  140. package/dist/lib/signals/settings.d.ts +5 -0
  141. package/dist/lib/signals/settings.js +2 -0
  142. package/dist/lib/signals/steps/extract.d.ts +85 -9
  143. package/dist/lib/signals/steps/extract.js +317 -68
  144. package/dist/lib/signals/steps/types.d.ts +2 -0
  145. package/dist/lib/sync-core/engine-holds.d.ts +14 -0
  146. package/dist/lib/sync-core/engine-holds.js +60 -0
  147. package/dist/lib/sync-core/engine-home.d.ts +37 -1
  148. package/dist/lib/sync-core/engine-home.js +119 -16
  149. package/dist/lib/sync-core/reconcile.js +8 -0
  150. package/dist/lib/sync-core/rollout-state.d.ts +2 -1
  151. package/dist/lib/sync-core/rollout-state.js +5 -2
  152. package/dist/lib/sync-core/vault-settings.d.ts +21 -0
  153. package/dist/lib/sync-core/vault-settings.js +131 -0
  154. package/dist/lib/sync-core/vault-uid.d.ts +2 -0
  155. package/dist/lib/sync-core/vault-uid.js +4 -0
  156. package/dist/lib/windows/install-followup.d.ts +2 -0
  157. package/dist/lib/windows/install-followup.js +4 -1
  158. package/dist/schemas/hq-work-requirements.v1.schema.json +145 -0
  159. package/dist/utils/auth-session-check.d.ts +16 -0
  160. package/dist/utils/auth-session-check.js +16 -0
  161. package/dist/utils/client-health-contract.d.ts +6 -0
  162. package/dist/utils/client-health-contract.js +13 -0
  163. package/dist/utils/client-health.d.ts +7 -0
  164. package/dist/utils/client-health.js +22 -1
  165. package/dist/utils/command-usage.d.ts +40 -0
  166. package/dist/utils/command-usage.js +61 -0
  167. package/dist/utils/duplicate-command-usage.d.ts +72 -0
  168. package/dist/utils/duplicate-command-usage.js +125 -0
  169. package/dist/utils/host-registration.js +5 -2
  170. package/dist/utils/pack-contributions.d.ts +3 -0
  171. package/dist/utils/pack-contributions.js +110 -23
  172. package/dist/utils/resident-package-preload.js +4 -0
  173. package/dist/utils/self-update.d.ts +3 -1
  174. package/dist/utils/self-update.js +56 -11
  175. package/dist/utils/sentry-fingerprint.js +9 -0
  176. package/dist/utils/update-lock.d.ts +151 -14
  177. package/dist/utils/update-lock.js +782 -46
  178. package/dist/utils/version-gate.js +12 -2
  179. package/dist/utils/windows-bash.d.ts +2 -0
  180. package/dist/utils/windows-bash.js +2 -1
  181. package/package.json +9 -8
  182. package/scripts/bench-core-compare.mjs +313 -0
  183. package/scripts/bench-core.mjs +399 -12
  184. package/scripts/check-function-manifest.mjs +116 -3
@@ -29,6 +29,18 @@
29
29
  // --no-manifest run without a manifest (hq-cli pull request job: the
30
30
  // manifest lives in another repository). Only the
31
31
  // command-states file is checked against the hq-cli tree
32
+ // --installed-core <dir> an installed HQ core (the folder an install or
33
+ // update writes). Reports every test or tooling file in
34
+ // it; see "Installed core" below. Runs alone (no
35
+ // manifest needed) or beside the other rules
36
+ // --keep <path> with --installed-core: a path (relative to that
37
+ // folder) that is kept although it matches; end it with
38
+ // / to keep a whole folder. Repeatable
39
+ // --keep-file <file> with --installed-core: --keep entries, one per line
40
+ // (blank lines and lines starting with # are skipped)
41
+ // --tooling <glob> with --installed-core: a CI or release script glob
42
+ // the release leaves out (* within a folder, ** across
43
+ // folders, ?). Repeatable; none are built in
32
44
  // --json print the result as JSON
33
45
  //
34
46
  // Exit 0: no problem. Exit 1: at least one problem. Exit 2: usage error.
@@ -68,6 +80,18 @@
68
80
  // src/lib/daemon. Other daemon functions: the owner path as text, or an
69
81
  // import of the owner (a relative import is resolved from the importing
70
82
  // file), in any file including other daemon files.
83
+ //
84
+ // Installed core (--installed-core)
85
+ // Walks every file and symlink under the folder; symlinks are not followed,
86
+ // and a symlink whose own path matches is reported. A path (relative, forward
87
+ // slashes) is reported as installed-test-file when any of these match:
88
+ // core/scripts/tests/...; any path part named tests, __tests__, __fixtures__
89
+ // or __snapshots__; test/... at the root; core/scripts/hook-corpus/...;
90
+ // a file name *.test.<ext> or *.spec.<ext> with ext sh, bash, js, mjs, cjs,
91
+ // ts, mts, cts or py; a file name test_*.py.
92
+ // and as installed-tooling-file when it matches a --tooling glob. Names that
93
+ // only contain -test. or test- (keyboard-test.md) and core/hook-tests/ (an
94
+ // install reads it) are not test files here. --keep paths are not reported.
71
95
 
72
96
  import { execFileSync } from "node:child_process";
73
97
  import { existsSync, lstatSync, readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
@@ -564,9 +588,85 @@ export function checkCliStates(entries, states, file) {
564
588
  return { problems, notices };
565
589
  }
566
590
 
591
+ // ---------- installed core: no test or tooling files ----------
592
+ const INSTALLED_TEST_PREFIX = ["core/scripts/tests/", "test/", "core/scripts/hook-corpus/"];
593
+ const INSTALLED_TEST_PART = new Set(["tests", "__tests__", "__fixtures__", "__snapshots__"]);
594
+ const INSTALLED_TEST_NAME_RE = /\.(test|spec)\.(sh|bash|js|mjs|cjs|ts|mts|cts|py)$|^test_[^/]*\.py$/;
595
+
596
+ /** The reason a path is a test file in an installed core, or null. */
597
+ export function installedTestReason(rel) {
598
+ const prefix = INSTALLED_TEST_PREFIX.find((p) => rel.startsWith(p));
599
+ if (prefix) return `under ${prefix}`;
600
+ const parts = rel.split("/");
601
+ const part = parts.find((x) => INSTALLED_TEST_PART.has(x));
602
+ if (part) return `a "${part}" folder`;
603
+ if (INSTALLED_TEST_NAME_RE.test(parts[parts.length - 1])) return "a test file name";
604
+ return null;
605
+ }
606
+
607
+ /** A glob (* within a folder, ** across folders, ?) as an anchored regex. */
608
+ export function globToRegExp(glob) {
609
+ let re = "";
610
+ for (let i = 0; i < glob.length; i++) {
611
+ const c = glob[i];
612
+ if (c === "*" && glob[i + 1] === "*") {
613
+ i++;
614
+ if (glob[i + 1] === "/") { i++; re += "(?:.*/)?"; } else re += ".*";
615
+ } else if (c === "*") re += "[^/]*";
616
+ else if (c === "?") re += "[^/]";
617
+ else re += esc(c);
618
+ }
619
+ return new RegExp(`^${re}$`);
620
+ }
621
+
622
+ const normalRel = (p) => p.replace(/\\/g, "/").replace(/^(\.\/)+/, "");
623
+
624
+ /** Every test or tooling file in an installed core, minus the kept paths. */
625
+ export function checkInstalledCore(root, { keep = [], tooling = [] } = {}) {
626
+ const problems = [];
627
+ const keepExact = new Set();
628
+ const keepDirs = [];
629
+ for (const k of keep.map(normalRel).filter(Boolean)) {
630
+ if (k.endsWith("/")) keepDirs.push(k);
631
+ else keepExact.add(k);
632
+ }
633
+ const kept = (rel, isDir) => (!isDir && keepExact.has(rel)) || keepDirs.some((d) => (isDir ? `${rel}/` : rel).startsWith(d));
634
+ const toolingRes = tooling.map((g) => ({ glob: g, re: globToRegExp(normalRel(g)) }));
635
+ let walked = 0;
636
+ const walk = (rel) => {
637
+ const entries = readdirSync(rel ? path.join(root, rel) : root, { withFileTypes: true });
638
+ entries.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
639
+ for (const entry of entries) {
640
+ const child = rel ? `${rel}/${entry.name}` : entry.name;
641
+ // Dirent types come from lstat: a symlink is never a directory here.
642
+ if (entry.isDirectory()) {
643
+ if (!kept(child, true)) walk(child);
644
+ continue;
645
+ }
646
+ walked++;
647
+ if (kept(child, false)) continue;
648
+ const link = entry.isSymbolicLink() ? " (a symlink)" : "";
649
+ const reason = installedTestReason(child);
650
+ if (reason) {
651
+ problems.push({ rule: "installed-test-file", file: child, message: `${child}${link} is a test file in the installed core (${reason}). The release must leave it out; pass --keep ${child} if an install needs it.` });
652
+ continue;
653
+ }
654
+ const tool = toolingRes.find((t) => t.re.test(child));
655
+ if (tool) problems.push({ rule: "installed-tooling-file", file: child, message: `${child}${link} is a tooling file in the installed core (matches --tooling ${tool.glob}). The release must leave it out; pass --keep ${child} if an install needs it.` });
656
+ }
657
+ };
658
+ walk("");
659
+ return { problems, files: walked };
660
+ }
661
+
662
+ function readKeepFile(file) {
663
+ if (!existsSync(file)) usage(`--keep-file ${file} does not exist`);
664
+ return readFileSync(file, "utf8").split("\n").map((l) => l.replace(/\r$/, "").trim()).filter((l) => l && !l.startsWith("#"));
665
+ }
666
+
567
667
  // ---------- main ----------
568
668
  function parseArgs(argv) {
569
- const opt = { json: false, noManifest: false };
669
+ const opt = { json: false, noManifest: false, keep: [], tooling: [] };
570
670
  const value = (i) => {
571
671
  if (argv[i + 1] === undefined) usage(`${argv[i]} needs a value`);
572
672
  return argv[i + 1];
@@ -580,6 +680,10 @@ function parseArgs(argv) {
580
680
  else if (a === "--cli-states") opt.cliStates = path.resolve(value(i++));
581
681
  else if (a === "--require-cli-states") opt.requireCliStates = true;
582
682
  else if (a === "--no-manifest") opt.noManifest = true;
683
+ else if (a === "--installed-core") opt.installedCore = path.resolve(value(i++));
684
+ else if (a === "--keep") opt.keep.push(value(i++));
685
+ else if (a === "--keep-file") opt.keep.push(...readKeepFile(path.resolve(value(i++))));
686
+ else if (a === "--tooling") opt.tooling.push(value(i++));
583
687
  else if (a === "--json") opt.json = true;
584
688
  else if (a === "--help" || a === "-h") usage();
585
689
  else usage(`unknown argument: ${a}`);
@@ -588,7 +692,7 @@ function parseArgs(argv) {
588
692
  }
589
693
  function usage(error) {
590
694
  if (error) console.error(`check-function-manifest: ${error}`);
591
- console.error("usage: node scripts/check-function-manifest.mjs [--manifest <file>] [--core-root <dir>] [--cli-root <dir> | --cli-package <dir>] [--cli-states <file> [--require-cli-states]] [--no-manifest] [--json]");
695
+ console.error("usage: node scripts/check-function-manifest.mjs [--manifest <file>] [--core-root <dir>] [--cli-root <dir> | --cli-package <dir>] [--cli-states <file> [--require-cli-states]] [--no-manifest] [--installed-core <dir> [--keep <path>]... [--keep-file <file>] [--tooling <glob>]...] [--json]");
592
696
  process.exit(2);
593
697
  }
594
698
 
@@ -606,7 +710,11 @@ export async function run(argv) {
606
710
  }
607
711
  if (!opt.manifest && opt.coreRoot) opt.manifest = path.join(opt.coreRoot, MANIFEST_REL);
608
712
  if (opt.noManifest && (opt.manifest || opt.coreRoot)) usage("--no-manifest cannot be combined with --manifest or --core-root");
609
- if (!opt.noManifest && !opt.manifest) usage("no manifest: pass --core-root or --manifest (or --no-manifest in the hq-cli pull request job)");
713
+ if (opt.installedCore && !(existsSync(opt.installedCore) && statSync(opt.installedCore).isDirectory())) usage(`--installed-core ${opt.installedCore} is not a folder`);
714
+ if (!opt.installedCore && (opt.keep.length || opt.tooling.length)) usage("--keep, --keep-file and --tooling need --installed-core");
715
+ // --installed-core alone needs no manifest.
716
+ const installedOnly = opt.installedCore && !opt.manifest && !opt.coreRoot && !opt.noManifest && !opt.cliStates;
717
+ if (!opt.noManifest && !opt.manifest && !installedOnly) usage("no manifest: pass --core-root or --manifest (or --no-manifest in the hq-cli pull request job)");
610
718
  if (opt.manifest && !existsSync(opt.manifest)) usage(`manifest ${opt.manifest} does not exist`);
611
719
 
612
720
  const problems = [];
@@ -672,6 +780,11 @@ export async function run(argv) {
672
780
  }
673
781
  }
674
782
  }
783
+ if (opt.installedCore) {
784
+ const inst = checkInstalledCore(opt.installedCore, { keep: opt.keep, tooling: opt.tooling });
785
+ problems.push(...inst.problems);
786
+ checked.push(`installed core ${opt.installedCore}: ${inst.files} files and links checked for test and tooling files (${opt.keep.length} kept paths, ${opt.tooling.length} tooling globs)`);
787
+ }
675
788
  if (opt.noManifest) notices.push("--no-manifest: the manifest rules did not run here; they run where the manifest is (hq-core-staging pull requests and a local run with --core-root)");
676
789
 
677
790
  const seconds = ((Date.now() - started) / 1000).toFixed(1);