@indigoai-us/hq-cli 5.345.221 → 5.345.223

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 (87) hide show
  1. package/CHANGELOG.md +70 -1
  2. package/dist/command-catalog.generated.d.ts +31 -0
  3. package/dist/command-catalog.generated.js +38 -0
  4. package/dist/commands/auth.js +2 -1
  5. package/dist/commands/bot.d.ts +1 -1
  6. package/dist/commands/bot.js +34 -33
  7. package/dist/commands/core-delegate-w1b.js +216 -190
  8. package/dist/commands/daemon.d.ts +1 -0
  9. package/dist/commands/daemon.js +15 -1
  10. package/dist/commands/link.d.ts +2 -0
  11. package/dist/commands/link.js +14 -2
  12. package/dist/commands/mesh.js +23 -3
  13. package/dist/commands/packs.js +13 -2
  14. package/dist/commands/sync-core.d.ts +6 -0
  15. package/dist/commands/sync-core.js +75 -1
  16. package/dist/data/command-states.json +3 -0
  17. package/dist/lib/bot/fleet-cron.d.ts +26 -3
  18. package/dist/lib/bot/fleet-cron.js +44 -4
  19. package/dist/lib/bot/run.d.ts +4 -4
  20. package/dist/lib/bot/run.js +5 -3
  21. package/dist/lib/bot/signals-engine-flag.d.ts +53 -13
  22. package/dist/lib/bot/signals-engine-flag.js +202 -9
  23. package/dist/lib/daemon/catalog.js +2 -0
  24. package/dist/lib/daemon/install.d.ts +2 -1
  25. package/dist/lib/daemon/install.js +9 -0
  26. package/dist/lib/daemon/legacy.d.ts +1 -0
  27. package/dist/lib/daemon/legacy.js +5 -2
  28. package/dist/lib/daemon/machine-check-owner.d.ts +2 -0
  29. package/dist/lib/daemon/machine-check-owner.js +6 -1
  30. package/dist/lib/daemon/machine-checks.d.ts +52 -1
  31. package/dist/lib/daemon/machine-checks.js +104 -11
  32. package/dist/lib/daemon/mesh-owner.d.ts +45 -0
  33. package/dist/lib/daemon/mesh-owner.js +166 -0
  34. package/dist/lib/daemon/native-notice-ledger.d.ts +36 -0
  35. package/dist/lib/daemon/native-notice-ledger.js +156 -0
  36. package/dist/lib/daemon/run.d.ts +15 -0
  37. package/dist/lib/daemon/run.js +72 -3
  38. package/dist/lib/daemon/selfcheck.d.ts +35 -2
  39. package/dist/lib/daemon/selfcheck.js +118 -9
  40. package/dist/lib/daemon/supervisor.d.ts +10 -0
  41. package/dist/lib/daemon/supervisor.js +86 -0
  42. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  43. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  44. package/dist/lib/flag-registry-worker.js +33 -3
  45. package/dist/lib/flag-registry.js +13 -0
  46. package/dist/lib/hook-engine/coverage.d.ts +9 -0
  47. package/dist/lib/hook-engine/coverage.js +56 -0
  48. package/dist/lib/hook-engine/native-stop-compatibility.json +56 -5
  49. package/dist/lib/mesh/live/daemon/config.d.ts +8 -1
  50. package/dist/lib/mesh/live/daemon/config.js +16 -0
  51. package/dist/lib/mesh/live/daemon/install.d.ts +31 -2
  52. package/dist/lib/mesh/live/daemon/install.js +142 -1
  53. package/dist/lib/mesh/live/daemon/login-home.d.ts +5 -0
  54. package/dist/lib/mesh/live/daemon/login-home.js +27 -0
  55. package/dist/lib/mesh/live/daemon/unit-home.d.ts +49 -0
  56. package/dist/lib/mesh/live/daemon/unit-home.js +134 -0
  57. package/dist/lib/registry/registry.d.ts +35 -7
  58. package/dist/lib/registry/registry.js +88 -13
  59. package/dist/lib/scan-packages/index.js +23 -2
  60. package/dist/lib/search-index/max-doc-bytes.js +2 -1
  61. package/dist/lib/service-manager/startup-migration.d.ts +1 -0
  62. package/dist/lib/service-manager/startup-migration.js +3 -0
  63. package/dist/lib/signals/engine.d.ts +8 -0
  64. package/dist/lib/signals/engine.js +15 -5
  65. package/dist/lib/sync-core/engine-holds.d.ts +14 -0
  66. package/dist/lib/sync-core/engine-holds.js +60 -0
  67. package/dist/lib/sync-core/engine-home.d.ts +2 -0
  68. package/dist/lib/sync-core/flag.d.ts +18 -0
  69. package/dist/lib/sync-core/flag.js +66 -0
  70. package/dist/lib/sync-core/reconcile.d.ts +6 -0
  71. package/dist/lib/sync-core/reconcile.js +23 -0
  72. package/dist/lib/sync-core/rollout-state.d.ts +2 -0
  73. package/dist/lib/sync-core/rollout-state.js +7 -0
  74. package/dist/lib/sync-core/vault-settings.d.ts +32 -0
  75. package/dist/lib/sync-core/vault-settings.js +147 -0
  76. package/dist/lib/windows/install-followup.d.ts +2 -0
  77. package/dist/lib/windows/install-followup.js +4 -1
  78. package/dist/utils/host-registration.js +3 -1
  79. package/dist/utils/pack-contributions.d.ts +16 -1
  80. package/dist/utils/pack-contributions.js +139 -26
  81. package/dist/utils/self-update.d.ts +3 -1
  82. package/dist/utils/self-update.js +56 -11
  83. package/dist/utils/update-lock.d.ts +151 -14
  84. package/dist/utils/update-lock.js +782 -46
  85. package/dist/utils/version-gate.js +12 -2
  86. package/package.json +7 -7
  87. package/scripts/bench-core.mjs +34 -3
@@ -42,7 +42,7 @@ import { isVersionRequest } from "../version-request.js";
42
42
  import { Sentry } from "../sentry.js";
43
43
  import { isCliTelemetryDisabled } from "./cli-telemetry.js";
44
44
  import { DEFAULT_VAULT_API_URL } from "./cognito-session.js";
45
- import { acquireUpdateLock, } from "./update-lock.js";
45
+ import { acquireUpdateLock, STARTUP_TAKEOVER_WAIT_MS, } from "./update-lock.js";
46
46
  import { HQ_CLI_NPM_UPDATE_COMMAND, hqCliNpmInstallCommand, npmGlobalInstallArgv } from "./npm-install-flags.js";
47
47
  /** Prevent an update package manager's lifecycle child from starting another updater. */
48
48
  export const UPDATE_RECURSION_GUARD_ENV = "HQ_RESCUE_SELF_UPDATED";
@@ -1825,12 +1825,22 @@ function enforceUpdateRequired(decision, deps = {}) {
1825
1825
  // for the cross-repo contract. A fresh holder means someone else is already
1826
1826
  // installing the version we want: skip and continue on the current version
1827
1827
  // (the gate must never break the CLI).
1828
- const lock = (deps.acquireLock ?? acquireUpdateLock)();
1828
+ // Start-up path: a short mutex wait, so a wedged takeover mutex costs every
1829
+ // command at most a second instead of ten.
1830
+ const lock = deps.acquireLock
1831
+ ? deps.acquireLock()
1832
+ : acquireUpdateLock({ takeoverWaitMs: STARTUP_TAKEOVER_WAIT_MS });
1829
1833
  if (!lock) {
1830
1834
  console.error(chalk.dim(" Another hq updater is already installing (update lock held); continuing on the current version."));
1831
1835
  return;
1832
1836
  }
1833
1837
  currentVersionGatePhase = "lock_acquired";
1838
+ // A racing taker may have moved our lock between acquisition and now.
1839
+ if (typeof lock.stillHeld === "function" && !lock.stillHeld()) {
1840
+ lock.release();
1841
+ console.error(chalk.dim(" Another hq updater took over the update lock; continuing on the current version."));
1842
+ return;
1843
+ }
1834
1844
  let attempt;
1835
1845
  try {
1836
1846
  attempt = attemptRequiredUpdate(decision, deps, install);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.345.221",
3
+ "version": "5.345.223",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -124,11 +124,11 @@
124
124
  "*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}": "eslint --cache --no-error-on-unmatched-pattern"
125
125
  },
126
126
  "optionalDependencies": {
127
- "@indigoai-us/hq-hook-win32-x64": "5.345.221",
128
- "@indigoai-us/hq-hook-win32-arm64": "5.345.221",
129
- "@indigoai-us/hq-hook-darwin-x64": "5.345.221",
130
- "@indigoai-us/hq-hook-darwin-arm64": "5.345.221",
131
- "@indigoai-us/hq-hook-linux-x64": "5.345.221",
132
- "@indigoai-us/hq-hook-linux-arm64": "5.345.221"
127
+ "@indigoai-us/hq-hook-win32-x64": "5.345.223",
128
+ "@indigoai-us/hq-hook-win32-arm64": "5.345.223",
129
+ "@indigoai-us/hq-hook-darwin-x64": "5.345.223",
130
+ "@indigoai-us/hq-hook-darwin-arm64": "5.345.223",
131
+ "@indigoai-us/hq-hook-linux-x64": "5.345.223",
132
+ "@indigoai-us/hq-hook-linux-arm64": "5.345.223"
133
133
  }
134
134
  }
@@ -39,7 +39,9 @@
39
39
  // (master-hook.sh or the host's adapter script).
40
40
  // A bot host's adapter is not in this
41
41
  // repository: give it with --core-cmd old=...
42
- // new hq-hook run --host <host> <Event>; a bot host
42
+ // new hq-hook run --host <host> <Event>
43
+ // --hq-root <root>, as host registration
44
+ // writes it; a bot host
43
45
  // gets its own event name (pre_tool_call,
44
46
  // post_tool_call, pre_llm_call)
45
47
  // selected whatever the host's registration under
@@ -849,6 +851,34 @@ function botSelected({ host, event, options, rootEnv }) {
849
851
  return { steps, detected: describeCore(steps.map((step) => step.named)), profile: candidates[0].profile.file };
850
852
  }
851
853
 
854
+ // The spelling of a script path that Git Bash can run and resolve its own
855
+ // folder from: on Windows, forward slashes and /c/... for a drive path (the
856
+ // same conversion src/utils/run-bundled-script.ts uses). master-hook.sh finds
857
+ // its sibling scripts from BASH_SOURCE, and a backslash path makes that the
858
+ // working directory instead. Other platforms get the path unchanged.
859
+ export function bashScriptPath(value, platform = process.platform) {
860
+ if (platform !== "win32") return value;
861
+ const normalized = value.replaceAll("\\", "/");
862
+ const drive = /^([A-Za-z]):\/(.*)$/u.exec(normalized);
863
+ return drive ? `/${drive[1].toLowerCase()}/${drive[2]}` : normalized;
864
+ }
865
+
866
+ // The HQ root as a host registration writes it after --hq-root: trailing
867
+ // separators removed, except for a bare drive or the filesystem root (the
868
+ // same rule as launcherRoot in src/lib/hook-engine/registration-identity.ts).
869
+ export function registrationRoot(root) {
870
+ const trimmed = root.replace(/[\\/]+$/u, "");
871
+ return trimmed === "" || /^[A-Za-z]:$/u.test(trimmed) ? root : trimmed;
872
+ }
873
+
874
+ // Arguments for --core new: what host registration writes for a project
875
+ // entry, `run --host <host> <Event> --hq-root <root>`. The root is given
876
+ // explicitly, as registration does on every platform, so the engine does not
877
+ // fall back to CLAUDE_PROJECT_DIR (which it does not read on Windows).
878
+ export function newCoreArgs(host, word, root) {
879
+ return ["run", "--host", host, word, "--hq-root", registrationRoot(root)];
880
+ }
881
+
852
882
  function defaultBash(platform) {
853
883
  if (platform !== "win32") return "bash";
854
884
  for (const base of [process.env.ProgramFiles, process.env["ProgramFiles(x86)"], process.env.LOCALAPPDATA && path.join(process.env.LOCALAPPDATA, "Programs")]) {
@@ -880,14 +910,15 @@ export function resolveInvocation({ host, core, event, tool, options, platform =
880
910
  }
881
911
 
882
912
  if (core === "new") {
883
- const args = ["run", "--host", host, word];
913
+ const args = newCoreArgs(host, word, root);
884
914
  return { steps: [{ file: options.hqHook, args, env: rootEnv, cwd: root, display: `${options.hqHook} ${args.join(" ")}` }], detected: "new" };
885
915
  }
886
916
 
887
917
  if (core === "old") {
888
918
  const script = path.join(root, ...OLD_ENTRY[host]);
889
919
  if (!fs.existsSync(script)) return { steps: [], detected: "old", missing: `the old core is not under --root (${script} is missing)` };
890
- const args = host === "claude" ? [script, event] : [script];
920
+ const scriptArg = bashScriptPath(script, platform);
921
+ const args = host === "claude" ? [scriptArg, event] : [scriptArg];
891
922
  const env = { ...rootEnv, BASH_ENV: os.devNull };
892
923
  if (host === "grok") Object.assign(env, { GROK_WORKSPACE_ROOT: root, GROK_HOOK_EVENT: event });
893
924
  return { steps: [{ file: bash, args, env, cwd: root, display: `bash ${args.join(" ")}` }], detected: "old" };