@indigoai-us/hq-cli 5.345.267 → 5.345.269

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 (52) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +12 -0
  3. package/contracts/host-canary-release.json +7 -7
  4. package/dist/commands/core-job-notify-native.d.ts +6 -0
  5. package/dist/commands/core-job-notify-native.js +64 -4
  6. package/dist/commands/core-jobs-native.js +3 -16
  7. package/dist/commands/install-global.js +54 -17
  8. package/dist/lib/daemon/machine-check-owner.js +1 -1
  9. package/dist/lib/daemon/machine-checks.d.ts +3 -11
  10. package/dist/lib/daemon/machine-checks.js +4 -15
  11. package/dist/lib/daemon/run.js +12 -0
  12. package/dist/lib/doctor/checks/codex-wiring.d.ts +4 -2
  13. package/dist/lib/doctor/checks/codex-wiring.js +70 -13
  14. package/dist/lib/doctor/checks/fleet-hook-core.d.ts +4 -4
  15. package/dist/lib/doctor/checks/fleet-hook-core.js +5 -10
  16. package/dist/lib/doctor/checks/grok-wiring.js +38 -0
  17. package/dist/lib/doctor/checks/hook-engine.js +0 -2
  18. package/dist/lib/doctor/checks/host-core.d.ts +1 -1
  19. package/dist/lib/doctor/checks/host-core.js +8 -38
  20. package/dist/lib/hook-engine/coverage.d.ts +10 -1
  21. package/dist/lib/hook-engine/coverage.js +63 -8
  22. package/dist/lib/hook-engine/fleet-registration.js +7 -4
  23. package/dist/lib/hook-engine/native-precompact-compatibility.json +7 -1
  24. package/dist/lib/hook-engine/native-stop-compatibility.json +30 -11
  25. package/dist/lib/hook-engine/reconcile.d.ts +10 -1
  26. package/dist/lib/hook-engine/reconcile.js +339 -42
  27. package/dist/lib/hook-engine/stable-gate.d.ts +43 -0
  28. package/dist/lib/hook-engine/stable-gate.js +276 -0
  29. package/dist/lib/hot-channels/fleet-complete.js +2 -2
  30. package/dist/lib/install/antigravity-targets.js +2 -1
  31. package/dist/lib/install/claude-targets.d.ts +6 -6
  32. package/dist/lib/install/claude-targets.js +13 -9
  33. package/dist/lib/install/codex-targets.d.ts +4 -4
  34. package/dist/lib/install/codex-targets.js +26 -16
  35. package/dist/lib/install/hook-target.d.ts +23 -2
  36. package/dist/lib/install/hook-target.js +89 -16
  37. package/dist/lib/outpost-identity-env.d.ts +18 -0
  38. package/dist/lib/outpost-identity-env.js +29 -0
  39. package/dist/lib/signals/steps/extract.js +46 -12
  40. package/dist/utils/core-next-kill.d.ts +2 -15
  41. package/dist/utils/core-next-kill.js +5 -36
  42. package/dist/utils/hook-engine-crash.d.ts +86 -0
  43. package/dist/utils/hook-engine-crash.js +325 -0
  44. package/dist/utils/hook-engine-rollup.d.ts +8 -3
  45. package/dist/utils/hook-engine-rollup.js +0 -1
  46. package/dist/utils/hook-trust.d.ts +2 -0
  47. package/dist/utils/hook-trust.js +156 -13
  48. package/dist/utils/host-registration.d.ts +158 -4
  49. package/dist/utils/host-registration.js +500 -17
  50. package/dist/utils/version-gate.d.ts +42 -4
  51. package/dist/utils/version-gate.js +84 -25
  52. package/package.json +7 -7
@@ -58,6 +58,50 @@ let currentVersionGatePhase = "unknown";
58
58
  export function getVersionGatePhase() {
59
59
  return currentVersionGatePhase;
60
60
  }
61
+ /**
62
+ * Apply the optional `blockedVersions` / `targetVersion` fields. Returns the
63
+ * decision unchanged unless `current` is in a well-formed blocklist; then the
64
+ * update is required, and a valid `targetVersion` that is neither `current`
65
+ * nor itself blocked becomes the exact version to install (and the target the
66
+ * messages and convergence check use). Malformed fields are ignored.
67
+ */
68
+ export function applyBlockedVersions(decision, current = CLI_VERSION) {
69
+ const running = semver.valid(current);
70
+ if (!running || !Array.isArray(decision.blockedVersions))
71
+ return decision;
72
+ const blocked = decision.blockedVersions
73
+ .filter((v) => typeof v === "string")
74
+ .map((v) => semver.valid(v.trim()))
75
+ .filter((v) => v !== null);
76
+ if (!blocked.includes(running))
77
+ return decision;
78
+ const target = typeof decision.targetVersion === "string" ? semver.valid(decision.targetVersion.trim()) : null;
79
+ const pinned = target && target !== running && !blocked.includes(target) ? target : undefined;
80
+ return {
81
+ ...decision,
82
+ updateRequired: true,
83
+ blocked: true,
84
+ ...(pinned ? { pinnedVersion: pinned, latestVersion: pinned } : {}),
85
+ };
86
+ }
87
+ /** Whether `version` is in the response's well-formed `blockedVersions` list. */
88
+ export function isBlockedVersion(decision, version) {
89
+ const wanted = semver.valid(version);
90
+ if (!wanted || !Array.isArray(decision.blockedVersions))
91
+ return false;
92
+ return decision.blockedVersions.some((v) => typeof v === "string" && semver.valid(v.trim()) === wanted);
93
+ }
94
+ /** The package spec a required update installs: the pin when there is one, else `@latest`. */
95
+ function installSpec(decision) {
96
+ return decision.pinnedVersion ? `${CLI_NAME}@${decision.pinnedVersion}` : LATEST_PACKAGE_SPEC;
97
+ }
98
+ /** The server's bare npm command, with `@latest` swapped for the pin when there is one. */
99
+ function serverUpdateCommand(decision) {
100
+ const command = decision.updateCommand;
101
+ if (!command || !decision.pinnedVersion)
102
+ return command;
103
+ return command.split(/(\s+)/).map((part) => (part === LATEST_PACKAGE_SPEC ? installSpec(decision) : part)).join("");
104
+ }
61
105
  function isOptedOut() {
62
106
  // A process started by an update (re-exec, package-manager lifecycle script)
63
107
  // carries the recursion guard and must never start another install.
@@ -750,16 +794,16 @@ export function pnpmUpdateEnv(install, base = process.env) {
750
794
  result[pathKey] = [currentPath, binDir].filter(Boolean).join(path.delimiter);
751
795
  return Object.keys(result).some((key) => result[key] !== base[key]) ? result : undefined;
752
796
  }
753
- export function buildPrefixedInstallArgv(prefix) {
754
- return npmGlobalInstallArgv(LATEST_PACKAGE_SPEC, { prefix });
797
+ export function buildPrefixedInstallArgv(prefix, spec = LATEST_PACKAGE_SPEC) {
798
+ return npmGlobalInstallArgv(spec, { prefix });
755
799
  }
756
800
  /**
757
801
  * Argv for updating a pnpm-managed global install. `pnpm add -g` rewrites the
758
802
  * PATH shim as part of the install, so the next invocation genuinely resolves
759
803
  * the new version — which is the whole point of routing here instead of npm.
760
804
  */
761
- export function buildPnpmInstallArgv(install) {
762
- const args = ["add", "-g", LATEST_PACKAGE_SPEC, PNPM_FIRST_PARTY_RELEASE_AGE_EXCLUDE];
805
+ export function buildPnpmInstallArgv(install, spec = LATEST_PACKAGE_SPEC) {
806
+ const args = ["add", "-g", spec, PNPM_FIRST_PARTY_RELEASE_AGE_EXCLUDE];
763
807
  const dirs = install ? pnpmInstallDirs(install) : null;
764
808
  if (dirs) {
765
809
  args.push("--global-dir", dirs.globalDir, "--store-dir", dirs.storeDir);
@@ -865,7 +909,7 @@ export function probePnpmVersion(cmd, args, env, cwd) {
865
909
  }
866
910
  }
867
911
  /** Run the install-owned pnpm first; use PATH only if that version cannot run. */
868
- export function performPnpmUpdate(install, runner = runUpdateCommand, env = process.env, probe = probePnpmVersion) {
912
+ export function performPnpmUpdate(install, runner = runUpdateCommand, env = process.env, probe = probePnpmVersion, spec = LATEST_PACKAGE_SPEC) {
869
913
  const cwd = mkdtempSync(path.join(os.tmpdir(), "hq-cli-pnpm-update-"));
870
914
  const updateEnv = {
871
915
  ...packageManagerChildEnv(env),
@@ -877,7 +921,7 @@ export function performPnpmUpdate(install, runner = runUpdateCommand, env = proc
877
921
  if (installedVersion) {
878
922
  const command = `pnpm@${installedVersion}`;
879
923
  if (probe("corepack", [command, "--version"], updateEnv, cwd) === installedVersion) {
880
- return runner("corepack", [command, ...buildPnpmInstallArgv(install)], updateEnv, cwd);
924
+ return runner("corepack", [command, ...buildPnpmInstallArgv(install, spec)], updateEnv, cwd);
881
925
  }
882
926
  }
883
927
  const fallbackVersion = probe("pnpm", ["--version"], updateEnv, cwd);
@@ -887,7 +931,7 @@ export function performPnpmUpdate(install, runner = runUpdateCommand, env = proc
887
931
  // pnpm 10.28.1 and earlier reject --virtual-store-dir with -g. Keep the
888
932
  // existing global directory and store, but omit only that unsupported flag.
889
933
  const supportsGlobalVirtualStoreDir = semver.gte(fallbackVersion, "11.0.0");
890
- const args = buildPnpmInstallArgv(install);
934
+ const args = buildPnpmInstallArgv(install, spec);
891
935
  if (!supportsGlobalVirtualStoreDir) {
892
936
  const index = args.indexOf("--virtual-store-dir");
893
937
  if (index !== -1)
@@ -900,8 +944,8 @@ export function performPnpmUpdate(install, runner = runUpdateCommand, env = proc
900
944
  }
901
945
  }
902
946
  /** Argv for updating a Bun-managed global install. */
903
- export function buildBunInstallArgv() {
904
- return ["add", "-g", LATEST_PACKAGE_SPEC];
947
+ export function buildBunInstallArgv(spec = LATEST_PACKAGE_SPEC) {
948
+ return ["add", "-g", spec];
905
949
  }
906
950
  const nodeStaleInstallFs = {
907
951
  readdirSync: (dir) => readdirSync(dir),
@@ -1016,7 +1060,7 @@ async function fetchVersionDecision(timeoutMs = FETCH_TIMEOUT_MS) {
1016
1060
  typeof body.updateRequired !== "boolean") {
1017
1061
  return null;
1018
1062
  }
1019
- return body;
1063
+ return applyBlockedVersions(body);
1020
1064
  }
1021
1065
  catch {
1022
1066
  return null;
@@ -1386,18 +1430,19 @@ function performUpdate(command, runner = runUpdateCommand) {
1386
1430
  * speak the running manager's language.
1387
1431
  */
1388
1432
  function manualUpdateCommand(install, decision) {
1433
+ const spec = installSpec(decision);
1389
1434
  if (install.manager === "pnpm") {
1390
1435
  const version = pnpmInstalledVersion(install);
1391
1436
  const plan = version
1392
- ? `corepack pnpm@${version} ${buildPnpmInstallArgv(install).join(" ")}`
1393
- : `pnpm ${buildPnpmInstallArgv(install).join(" ")}`;
1437
+ ? `corepack pnpm@${version} ${buildPnpmInstallArgv(install, spec).join(" ")}`
1438
+ : `pnpm ${buildPnpmInstallArgv(install, spec).join(" ")}`;
1394
1439
  return plan;
1395
1440
  }
1396
1441
  if (install.manager === "bun")
1397
- return `bun ${buildBunInstallArgv().join(" ")}`;
1442
+ return `bun ${buildBunInstallArgv(spec).join(" ")}`;
1398
1443
  if (install.prefix)
1399
- return `npm ${buildPrefixedInstallArgv(install.prefix).join(" ")}`;
1400
- return decision.updateCommand;
1444
+ return `npm ${buildPrefixedInstallArgv(install.prefix, spec).join(" ")}`;
1445
+ return serverUpdateCommand(decision);
1401
1446
  }
1402
1447
  /**
1403
1448
  * Soft notify when the server says we're below `latestVersion` but still ≥
@@ -1738,6 +1783,10 @@ function execNewerGlobalHq(decision, install, deps) {
1738
1783
  const version = probe(candidate);
1739
1784
  if (!version || !semver.valid(version))
1740
1785
  continue;
1786
+ if (isBlockedVersion(decision, version)) {
1787
+ console.error(chalk.dim(` Global ${candidate} is ${version}, also blocked; not using it.`));
1788
+ continue;
1789
+ }
1741
1790
  if (!semver.gte(version, decision.minVersion) || !isNewerVersion(version, CLI_VERSION)) {
1742
1791
  console.error(chalk.dim(` Global ${candidate} is ${version}, also below ${decision.minVersion}; not using it.`));
1743
1792
  continue;
@@ -1774,11 +1823,13 @@ function execNewerGlobalHq(decision, install, deps) {
1774
1823
  */
1775
1824
  function enforceUpdateRequired(decision, deps = {}) {
1776
1825
  currentVersionGatePhase = "preflight";
1777
- const banner = chalk.red.bold(`✗ hq-cli ${CLI_VERSION} is below the minimum required version (${decision.minVersion}).`);
1826
+ const banner = chalk.red.bold(decision.blocked
1827
+ ? `✗ hq-cli ${CLI_VERSION} has been withdrawn and must be replaced${decision.pinnedVersion ? ` with ${decision.pinnedVersion}` : ""}.`
1828
+ : `✗ hq-cli ${CLI_VERSION} is below the minimum required version (${decision.minVersion}).`);
1778
1829
  console.error(banner);
1779
1830
  if (decision.message)
1780
1831
  console.error(chalk.dim(` ${decision.message}`));
1781
- const command = decision.updateCommand;
1832
+ const command = serverUpdateCommand(decision);
1782
1833
  // ONE package-root walk decides both the manager and the prefix. A
1783
1834
  // A pnpm- or Bun-managed install must be updated by its owning manager; the
1784
1835
  // server's `updateCommand` and any npm prefix are wrong for those layouts, so
@@ -1806,7 +1857,10 @@ function enforceUpdateRequired(decision, deps = {}) {
1806
1857
  // stale dist-tag, a bad cache, a misconfigured pin), reinstalling it on every
1807
1858
  // invocation and announcing success each time is strictly worse than saying
1808
1859
  // so once.
1809
- if (!isNewerVersion(decision.latestVersion, CLI_VERSION)) {
1860
+ // A pinned target for a blocked release may be older (moving off a bad
1861
+ // latest); applyBlockedVersions already refused a pin equal to the running
1862
+ // version, so it converges.
1863
+ if (!decision.pinnedVersion && !isNewerVersion(decision.latestVersion, CLI_VERSION)) {
1810
1864
  console.error(chalk.red(` Refusing to update: the offered version ${decision.latestVersion} is not newer than the running ${CLI_VERSION}.`));
1811
1865
  console.error(chalk.dim(" This is a server-side or registry problem, not a local one — reinstalling would loop without ever converging."));
1812
1866
  process.exit(75);
@@ -1872,7 +1926,7 @@ function enforceUpdateRequired(decision, deps = {}) {
1872
1926
  * (EX_TEMPFAIL) on failure.
1873
1927
  */
1874
1928
  function attemptRequiredUpdate(decision, deps, install) {
1875
- const command = decision.updateCommand;
1929
+ const command = serverUpdateCommand(decision);
1876
1930
  const isManagedOutsideNpm = install.manager !== "npm";
1877
1931
  const prefix = install.prefix;
1878
1932
  // Any npm global install with a known prefix must build away from the live package.
@@ -1883,17 +1937,18 @@ function attemptRequiredUpdate(decision, deps, install) {
1883
1937
  // the EXACT same command under elevation.
1884
1938
  let primaryCmd;
1885
1939
  let primaryArgs;
1940
+ const spec = installSpec(decision);
1886
1941
  if (install.manager === "pnpm") {
1887
1942
  primaryCmd = "pnpm";
1888
- primaryArgs = buildPnpmInstallArgv(install);
1943
+ primaryArgs = buildPnpmInstallArgv(install, spec);
1889
1944
  }
1890
1945
  else if (install.manager === "bun") {
1891
1946
  primaryCmd = "bun";
1892
- primaryArgs = buildBunInstallArgv();
1947
+ primaryArgs = buildBunInstallArgv(spec);
1893
1948
  }
1894
1949
  else if (prefix) {
1895
1950
  primaryCmd = "npm";
1896
- primaryArgs = buildPrefixedInstallArgv(prefix);
1951
+ primaryArgs = buildPrefixedInstallArgv(prefix, spec);
1897
1952
  }
1898
1953
  else {
1899
1954
  const parts = (command ?? "").split(/\s+/).filter(Boolean);
@@ -1913,7 +1968,7 @@ function attemptRequiredUpdate(decision, deps, install) {
1913
1968
  console.error(chalk.dim(` Detected a ${install.manager}-managed global install; updating with ${install.manager}`));
1914
1969
  console.error(chalk.dim(` Running: ${primaryCmd} ${primaryArgs.join(" ")}`));
1915
1970
  result = install.manager === "pnpm"
1916
- ? performPnpmUpdate(install, runner, updateEnv ?? process.env, deps.probePnpmVersion)
1971
+ ? performPnpmUpdate(install, runner, updateEnv ?? process.env, deps.probePnpmVersion, spec)
1917
1972
  : performUpdateCommand(primaryCmd, primaryArgs, runner, updateEnv);
1918
1973
  }
1919
1974
  else if (prefix) {
@@ -1925,7 +1980,7 @@ function attemptRequiredUpdate(decision, deps, install) {
1925
1980
  result = { ok: false, detail: "staged npm installer was not loaded" };
1926
1981
  }
1927
1982
  else {
1928
- result = installStaged(prefix, LATEST_PACKAGE_SPEC, runner);
1983
+ result = installStaged(prefix, spec, runner);
1929
1984
  }
1930
1985
  }
1931
1986
  else {
@@ -2038,7 +2093,9 @@ function attemptRequiredUpdate(decision, deps, install) {
2038
2093
  // it is rather than as a success the caller will keep retrying — see
2039
2094
  // checkUpdateConvergence.
2040
2095
  currentVersionGatePhase = "verifying";
2041
- const converged = (deps.checkConvergence ?? checkUpdateConvergence)(decision.latestVersion);
2096
+ // A pin must land exactly: a newer build on PATH may be the withdrawn one.
2097
+ const converged = (deps.checkConvergence ??
2098
+ ((target) => checkUpdateConvergence(target, decision.pinnedVersion ? { exactVersion: true } : {})))(decision.latestVersion);
2042
2099
  if (converged === false) {
2043
2100
  currentVersionGatePhase = "failed";
2044
2101
  console.error(chalk.red(`✗ Update did not take effect: \`hq\` on PATH still resolves a different build than ${decision.latestVersion}.`));
@@ -2103,6 +2160,8 @@ export function shouldSkipGate(argv) {
2103
2160
  }
2104
2161
  export const __test__ = {
2105
2162
  CLIENT_ID,
2163
+ applyBlockedVersions,
2164
+ manualUpdateCommand,
2106
2165
  getVersionGatePhase,
2107
2166
  CONVERGENCE_TIMEOUT_MS,
2108
2167
  DEFAULT_UPDATE_TIMEOUT_MS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.345.267",
3
+ "version": "5.345.269",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -128,11 +128,11 @@
128
128
  "*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}": "eslint --cache --no-error-on-unmatched-pattern"
129
129
  },
130
130
  "optionalDependencies": {
131
- "@indigoai-us/hq-hook-win32-x64": "5.345.267",
132
- "@indigoai-us/hq-hook-win32-arm64": "5.345.267",
133
- "@indigoai-us/hq-hook-darwin-x64": "5.345.267",
134
- "@indigoai-us/hq-hook-darwin-arm64": "5.345.267",
135
- "@indigoai-us/hq-hook-linux-x64": "5.345.267",
136
- "@indigoai-us/hq-hook-linux-arm64": "5.345.267"
131
+ "@indigoai-us/hq-hook-win32-x64": "5.345.269",
132
+ "@indigoai-us/hq-hook-win32-arm64": "5.345.269",
133
+ "@indigoai-us/hq-hook-darwin-x64": "5.345.269",
134
+ "@indigoai-us/hq-hook-darwin-arm64": "5.345.269",
135
+ "@indigoai-us/hq-hook-linux-x64": "5.345.269",
136
+ "@indigoai-us/hq-hook-linux-arm64": "5.345.269"
137
137
  }
138
138
  }