@indigoai-us/hq-cli 5.345.225 → 5.345.228

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 (164) hide show
  1. package/CHANGELOG.md +174 -0
  2. package/dist/command-catalog.generated.d.ts +215 -0
  3. package/dist/command-catalog.generated.js +261 -0
  4. package/dist/commands/auth.d.ts +2 -2
  5. package/dist/commands/auth.js +3 -3
  6. package/dist/commands/core-delegate-w1b.js +92 -69
  7. package/dist/commands/core-delegate.d.ts +19 -1
  8. package/dist/commands/core-delegate.js +411 -6
  9. package/dist/commands/core-dm-bind-native.js +2 -1
  10. package/dist/commands/core-handoff.d.ts +5 -0
  11. package/dist/commands/core-handoff.js +1008 -14
  12. package/dist/commands/core-pin-native.d.ts +1 -0
  13. package/dist/commands/core-pin-native.js +3 -15
  14. package/dist/commands/core-register-project-native.d.ts +6 -0
  15. package/dist/commands/core-register-project-native.js +182 -52
  16. package/dist/commands/core-work-mesh-bind-trusted-native.js +4 -9
  17. package/dist/commands/daemon.js +3 -3
  18. package/dist/commands/deploy-domains.js +38 -2
  19. package/dist/commands/index-cmd.d.ts +3 -1
  20. package/dist/commands/index-cmd.js +12 -0
  21. package/dist/commands/lanes-accounts.d.ts +14 -0
  22. package/dist/commands/lanes-accounts.js +119 -0
  23. package/dist/commands/lanes-checks.js +1 -1
  24. package/dist/commands/lanes-move.js +10 -0
  25. package/dist/commands/lanes-session-start.d.ts +1 -2
  26. package/dist/commands/lanes-session-start.js +9 -145
  27. package/dist/commands/lanes-shared.d.ts +3 -0
  28. package/dist/commands/lanes-shared.js +9 -0
  29. package/dist/commands/lanes.d.ts +3 -0
  30. package/dist/commands/lanes.js +231 -39
  31. package/dist/commands/link.d.ts +8 -3
  32. package/dist/commands/link.js +14 -17
  33. package/dist/commands/mcp-registration.d.ts +65 -7
  34. package/dist/commands/mcp-registration.js +289 -51
  35. package/dist/commands/mesh.d.ts +12 -0
  36. package/dist/commands/mesh.js +92 -10
  37. package/dist/commands/reindex.js +6 -0
  38. package/dist/commands/repo.d.ts +13 -0
  39. package/dist/commands/repo.js +39 -1
  40. package/dist/commands/sync-held.d.ts +22 -0
  41. package/dist/commands/sync-held.js +167 -18
  42. package/dist/commands/sync-mode.d.ts +3 -1
  43. package/dist/commands/sync-mode.js +11 -1
  44. package/dist/hq-cloud-sync-runner/bin/sync-runner.js +4845 -2524
  45. package/dist/hq-cloud-sync-runner/package.json +1 -1
  46. package/dist/lazy-commands.js +3 -4
  47. package/dist/lib/capacity/accounts.d.ts +4 -0
  48. package/dist/lib/capacity/accounts.js +4 -0
  49. package/dist/lib/capacity/route.js +14 -0
  50. package/dist/lib/capacity/sign-in.d.ts +18 -0
  51. package/dist/lib/capacity/sign-in.js +34 -1
  52. package/dist/lib/checkpoint-ontology/entity-file.js +4 -4
  53. package/dist/lib/checkpoint-ontology/merge-copies.js +7 -11
  54. package/dist/lib/checkpoint-ontology/plan.js +2 -1
  55. package/dist/lib/core-utils/archive-old-threads.js +5 -2
  56. package/dist/lib/core-utils/session-company.d.ts +13 -1
  57. package/dist/lib/core-utils/session-company.js +75 -4
  58. package/dist/lib/core-utils/worktree-resume.d.ts +6 -0
  59. package/dist/lib/core-utils/worktree-resume.js +8 -4
  60. package/dist/lib/daemon/background-qos.d.ts +7 -0
  61. package/dist/lib/daemon/background-qos.js +13 -0
  62. package/dist/lib/daemon/catalog.d.ts +10 -0
  63. package/dist/lib/daemon/catalog.js +9 -2
  64. package/dist/lib/daemon/hook-requests-acl-suggest.d.ts +18 -0
  65. package/dist/lib/daemon/hook-requests-acl-suggest.js +245 -0
  66. package/dist/lib/daemon/hook-requests-fleet-session-start.d.ts +32 -0
  67. package/dist/lib/daemon/hook-requests-fleet-session-start.js +214 -0
  68. package/dist/lib/daemon/hook-requests-mesh-tool-writes.d.ts +44 -0
  69. package/dist/lib/daemon/hook-requests-mesh-tool-writes.js +292 -0
  70. package/dist/lib/daemon/hook-requests-mesh.d.ts +54 -0
  71. package/dist/lib/daemon/hook-requests-mesh.js +559 -0
  72. package/dist/lib/daemon/hook-requests.d.ts +417 -0
  73. package/dist/lib/daemon/hook-requests.js +1747 -0
  74. package/dist/lib/daemon/lanes-reconcile-status.d.ts +35 -0
  75. package/dist/lib/daemon/lanes-reconcile-status.js +86 -0
  76. package/dist/lib/daemon/machine-checks.d.ts +12 -2
  77. package/dist/lib/daemon/machine-checks.js +27 -10
  78. package/dist/lib/daemon/merge-sections.d.ts +24 -2
  79. package/dist/lib/daemon/merge-sections.js +58 -16
  80. package/dist/lib/daemon/ops/policy.d.ts +1 -1
  81. package/dist/lib/daemon/ops/policy.js +47 -6
  82. package/dist/lib/daemon/resolver.js +9 -2
  83. package/dist/lib/daemon/run.d.ts +11 -7
  84. package/dist/lib/daemon/run.js +195 -18
  85. package/dist/lib/daemon/search-index-worker-v1.d.ts +2 -0
  86. package/dist/lib/daemon/search-index-worker-v1.js +25 -0
  87. package/dist/lib/daemon/server.js +6 -1
  88. package/dist/lib/daemon/session-registry.d.ts +0 -1
  89. package/dist/lib/daemon/session-registry.js +0 -3
  90. package/dist/lib/daemon/supervisor.d.ts +5 -1
  91. package/dist/lib/daemon/supervisor.js +1 -1
  92. package/dist/lib/daemon/tcc-eperm.d.ts +59 -4
  93. package/dist/lib/daemon/tcc-eperm.js +110 -8
  94. package/dist/lib/doctor/fix/process-identity.d.ts +20 -2
  95. package/dist/lib/doctor/fix/process-identity.js +48 -5
  96. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  97. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  98. package/dist/lib/hook-engine/canary-gate.js +1 -0
  99. package/dist/lib/hook-engine/native-stop-compatibility.json +2 -1
  100. package/dist/lib/hot-channels/adapters/attio.js +2 -1
  101. package/dist/lib/hot-channels/adapters/meetings.js +2 -1
  102. package/dist/lib/lanes/account-company.d.ts +7 -1
  103. package/dist/lib/lanes/account-company.js +22 -4
  104. package/dist/lib/lanes/account-ownership.d.ts +65 -0
  105. package/dist/lib/lanes/account-ownership.js +134 -0
  106. package/dist/lib/lanes/accounts.js +9 -2
  107. package/dist/lib/lanes/claude-balance.js +9 -3
  108. package/dist/lib/lanes/company-outposts.d.ts +37 -0
  109. package/dist/lib/lanes/company-outposts.js +164 -0
  110. package/dist/lib/lanes/config.js +17 -0
  111. package/dist/lib/lanes/host-capacity.d.ts +19 -0
  112. package/dist/lib/lanes/host-capacity.js +37 -0
  113. package/dist/lib/lanes/liveness.d.ts +6 -0
  114. package/dist/lib/lanes/liveness.js +49 -8
  115. package/dist/lib/lanes/orphan-report.d.ts +15 -0
  116. package/dist/lib/lanes/orphan-report.js +223 -0
  117. package/dist/lib/lanes/orphan-sweep.d.ts +26 -0
  118. package/dist/lib/lanes/orphan-sweep.js +152 -0
  119. package/dist/lib/lanes/reaper.d.ts +2 -0
  120. package/dist/lib/lanes/reaper.js +11 -8
  121. package/dist/lib/lanes/reconcile.d.ts +8 -7
  122. package/dist/lib/lanes/reconcile.js +83 -3
  123. package/dist/lib/lanes/spawn.d.ts +0 -10
  124. package/dist/lib/lanes/spawn.js +51 -1
  125. package/dist/lib/lanes/types.d.ts +12 -0
  126. package/dist/lib/mesh/live/backfill-held.d.ts +13 -0
  127. package/dist/lib/mesh/live/backfill-held.js +23 -0
  128. package/dist/lib/mesh/live/daemon/mode.d.ts +8 -4
  129. package/dist/lib/mesh/live/daemon/mode.js +8 -4
  130. package/dist/lib/mesh/live/daemon/run.d.ts +14 -3
  131. package/dist/lib/mesh/live/daemon/run.js +116 -7
  132. package/dist/lib/mesh/live/direct-drain.d.ts +123 -0
  133. package/dist/lib/mesh/live/direct-drain.js +315 -0
  134. package/dist/lib/mesh/live/emit-replay.d.ts +10 -0
  135. package/dist/lib/mesh/live/emit-replay.js +10 -0
  136. package/dist/lib/mesh/live/flush.d.ts +15 -0
  137. package/dist/lib/mesh/live/flush.js +27 -0
  138. package/dist/lib/mesh/live/liveness-carry.d.ts +45 -0
  139. package/dist/lib/mesh/live/liveness-carry.js +141 -0
  140. package/dist/lib/mesh/live/spool.d.ts +19 -0
  141. package/dist/lib/mesh/live/spool.js +80 -0
  142. package/dist/lib/safe-store.d.ts +2 -0
  143. package/dist/lib/safe-store.js +8 -6
  144. package/dist/lib/search-index/index.d.ts +9 -3
  145. package/dist/lib/search-index/index.js +35 -10
  146. package/dist/lib/search-index/worker-process.d.ts +9 -0
  147. package/dist/lib/search-index/worker-process.js +171 -0
  148. package/dist/lib/session-company-lock.d.ts +3 -1
  149. package/dist/lib/session-company-lock.js +3 -2
  150. package/dist/utils/delegate-command-supervisor.d.ts +3 -0
  151. package/dist/utils/delegate-command-supervisor.js +44 -0
  152. package/dist/utils/delegate-lock.d.ts +12 -0
  153. package/dist/utils/delegate-lock.js +88 -0
  154. package/dist/utils/frontmatter.d.ts +27 -0
  155. package/dist/utils/frontmatter.js +33 -0
  156. package/dist/utils/hook-trust.d.ts +1 -0
  157. package/dist/utils/hook-trust.js +18 -2
  158. package/dist/utils/host-registration.d.ts +13 -1
  159. package/dist/utils/host-registration.js +98 -5
  160. package/dist/utils/package-use-lease.d.ts +1 -1
  161. package/dist/utils/package-use-lease.js +15 -7
  162. package/docs/anywhere-runtime.md +17 -0
  163. package/package.json +9 -8
  164. package/scripts/check-function-manifest.mjs +17 -3
@@ -231,7 +231,7 @@ function waitForUpdateRequest(requestPath, timeoutMs, notify = null) {
231
231
  function notifyWaitingForUpdate() {
232
232
  process.stderr.write("hq-cli: waiting for the HQ CLI update to finish...\n");
233
233
  }
234
- export function acquirePackageUseLease(prefix, hqVersion, stateDirectory, purpose = "command") {
234
+ export function acquirePackageUseLease(prefix, hqVersion, stateDirectory, purpose = "command", waitMs = updateWaitTimeoutMs(), onMaxHold) {
235
235
  const directory = packageUseLeaseDirectory(prefix, stateDirectory);
236
236
  mkdirSync(directory, { recursive: true, mode: 0o700 });
237
237
  const requestPath = path.join(directory, UPDATE_REQUEST);
@@ -245,6 +245,7 @@ export function acquirePackageUseLease(prefix, hqVersion, stateDirectory, purpos
245
245
  const tempPath = `${leasePath}.${Math.random().toString(36).slice(2)}.tmp`;
246
246
  let released = false;
247
247
  let heartbeatInFlight = false;
248
+ let expiryNotified = false;
248
249
  let heartbeat = null;
249
250
  const acquiredAtMs = Date.now();
250
251
  const maxHoldMs = packageUseLeaseMaxHoldMs();
@@ -253,11 +254,18 @@ export function acquirePackageUseLease(prefix, hqVersion, stateDirectory, purpos
253
254
  if (released || heartbeatInFlight)
254
255
  return;
255
256
  const heldMs = Date.now() - acquiredAtMs;
256
- if (heldMs >= maxHoldMs) {
257
- process.stderr.write(`hq-cli: released the HQ CLI package-use lease held by pid ${record.pid} (${purpose}) ` +
258
- `after ${formatHoldDuration(heldMs)} so HQ CLI updates are not blocked\n`);
259
- release();
260
- return;
257
+ if (heldMs >= maxHoldMs && !expiryNotified) {
258
+ expiryNotified = true;
259
+ if (onMaxHold) {
260
+ // The owner is responsible for stopping package reads and releasing.
261
+ onMaxHold();
262
+ }
263
+ else {
264
+ process.stderr.write(`hq-cli: released the HQ CLI package-use lease held by pid ${record.pid} (${purpose}) ` +
265
+ `after ${formatHoldDuration(heldMs)} so HQ CLI updates are not blocked\n`);
266
+ release();
267
+ return;
268
+ }
261
269
  }
262
270
  heartbeatInFlight = true;
263
271
  const now = new Date();
@@ -289,7 +297,7 @@ export function acquirePackageUseLease(prefix, hqVersion, stateDirectory, purpos
289
297
  };
290
298
  const releaseOnExit = () => release();
291
299
  for (let attempt = 0; attempt < 2; attempt += 1) {
292
- waitForUpdateRequest(requestPath, updateWaitTimeoutMs(), notifyWaitingForUpdate);
300
+ waitForUpdateRequest(requestPath, waitMs, notifyWaitingForUpdate);
293
301
  try {
294
302
  writeFileSync(tempPath, `${JSON.stringify(record)}\n`, { flag: "wx", mode: 0o600 });
295
303
  renameSync(tempPath, leasePath);
@@ -33,6 +33,23 @@ The CLI stores the HQ root at `~/.hq/root` and keeps the folder registry in
33
33
  `~/.hq/registry.json`. These files belong to the current host. They are not
34
34
  stored in a repository or synced HQ folder.
35
35
 
36
+ While it updates a runtime's config file (for example `~/.claude.json`), the
37
+ installer holds a lock file beside it (`~/.claude.json.hqlock`). A second hq
38
+ command that finds the lock waits up to 10 seconds and then stops without
39
+ writing, and its message gives the time at which hq clears the lock by itself.
40
+ hq clears a lock once it is older than the maximum hold time, even when the
41
+ process that wrote it still appears to be running. A lock whose process has
42
+ exited is cleared after 30 seconds. If a lock is past its limit but another
43
+ program has the file open (on Windows, without delete sharing), hq clears it
44
+ once that program closes the file, and the message says so. If the lock
45
+ exists but cannot be read (for example it was left by an hq command run as
46
+ root, the path is a directory, or it is a symlink whose target is missing), hq waits out the 10 seconds, then stops and
47
+ names the lock and the read error; it never clears a lock it cannot read. The default
48
+ maximum hold time is 10 minutes. `HQ_CONFIG_LOCK_MAX_HOLD_MS` changes it, in
49
+ whole milliseconds. Values below 10000 (10 seconds) are raised to 10000, and
50
+ values above 604800000 (7 days) are lowered to 604800000. 0, negative numbers
51
+ and anything that is not a whole number are ignored, and the default applies.
52
+
36
53
  Windows requires Windows PowerShell 5.1 or PowerShell 7 for the bundled pipe
37
54
  host. If it is unavailable, the pipe cannot be created with a verified
38
55
  current-user-only DACL, or another process already owns the pipe name, hqd
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.345.225",
3
+ "version": "5.345.228",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -62,7 +62,7 @@
62
62
  "@aws-sdk/client-iot-data-plane": "^3.1096.0",
63
63
  "@aws-sdk/client-s3": "^3.1049.0",
64
64
  "@aws-sdk/dsql-signer": "^3.1146.0",
65
- "@indigoai-us/hq-cloud": "6.18.109",
65
+ "@indigoai-us/hq-cloud": "6.18.110",
66
66
  "@indigoai-us/hq-flags-client": "^0.2.0",
67
67
  "@modelcontextprotocol/sdk": "1.32.2",
68
68
  "@sentry/node": "^10.49.0",
@@ -94,6 +94,7 @@
94
94
  "eslint": "^10.5.0",
95
95
  "husky": "^9.1.7",
96
96
  "lint-staged": "^15.5.2",
97
+ "tar": "7.5.22",
97
98
  "typescript": "^5.7.0",
98
99
  "typescript-eslint": "^8.61.1",
99
100
  "vitest": "^4.1.2"
@@ -124,11 +125,11 @@
124
125
  "*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}": "eslint --cache --no-error-on-unmatched-pattern"
125
126
  },
126
127
  "optionalDependencies": {
127
- "@indigoai-us/hq-hook-win32-x64": "5.345.225",
128
- "@indigoai-us/hq-hook-win32-arm64": "5.345.225",
129
- "@indigoai-us/hq-hook-darwin-x64": "5.345.225",
130
- "@indigoai-us/hq-hook-darwin-arm64": "5.345.225",
131
- "@indigoai-us/hq-hook-linux-x64": "5.345.225",
132
- "@indigoai-us/hq-hook-linux-arm64": "5.345.225"
128
+ "@indigoai-us/hq-hook-win32-x64": "5.345.228",
129
+ "@indigoai-us/hq-hook-win32-arm64": "5.345.228",
130
+ "@indigoai-us/hq-hook-darwin-x64": "5.345.228",
131
+ "@indigoai-us/hq-hook-darwin-arm64": "5.345.228",
132
+ "@indigoai-us/hq-hook-linux-x64": "5.345.228",
133
+ "@indigoai-us/hq-hook-linux-arm64": "5.345.228"
133
134
  }
134
135
  }
@@ -42,6 +42,9 @@
42
42
  // the release leaves out (* within a folder, ** across
43
43
  // folders, ?). Repeatable; none are built in
44
44
  // --json print the result as JSON
45
+ // --max-seconds <n> time limit for the whole run (default 10). A run that
46
+ // takes n seconds or longer fails (rule time-budget),
47
+ // so the check stays fast enough to run locally
45
48
  //
46
49
  // Exit 0: no problem. Exit 1: at least one problem. Exit 2: usage error.
47
50
  //
@@ -128,6 +131,8 @@ const DOC_EXT_RE = /\.(md|mdx|mdc|txt|rst|html?)$/i;
128
131
  const COMMENT_RE = /^\s*(#(?!!)|\/\/|\/\*|\*(\s|$)|<!--|rem\s|::\s)/i;
129
132
  const SCRIPT_NAME_RE = /\.(sh|bash|mjs|cjs|js|py|ps1|cmd|awk)$/;
130
133
  const MAX_FILE_BYTES = 2_000_000;
134
+ // The check has to run locally in under this many seconds.
135
+ const DEFAULT_MAX_SECONDS = 10;
131
136
 
132
137
  // ---------- small helpers ----------
133
138
  const posix = (p) => p.split(path.sep).join("/");
@@ -666,7 +671,7 @@ function readKeepFile(file) {
666
671
 
667
672
  // ---------- main ----------
668
673
  function parseArgs(argv) {
669
- const opt = { json: false, noManifest: false, keep: [], tooling: [] };
674
+ const opt = { json: false, noManifest: false, keep: [], tooling: [], maxSeconds: DEFAULT_MAX_SECONDS };
670
675
  const value = (i) => {
671
676
  if (argv[i + 1] === undefined) usage(`${argv[i]} needs a value`);
672
677
  return argv[i + 1];
@@ -685,6 +690,11 @@ function parseArgs(argv) {
685
690
  else if (a === "--keep-file") opt.keep.push(...readKeepFile(path.resolve(value(i++))));
686
691
  else if (a === "--tooling") opt.tooling.push(value(i++));
687
692
  else if (a === "--json") opt.json = true;
693
+ else if (a === "--max-seconds") {
694
+ const v = value(i++);
695
+ if (!/^\d+(\.\d+)?$/.test(v)) usage(`--max-seconds needs a number of seconds, got ${v}`);
696
+ opt.maxSeconds = Number(v);
697
+ }
688
698
  else if (a === "--help" || a === "-h") usage();
689
699
  else usage(`unknown argument: ${a}`);
690
700
  }
@@ -692,7 +702,7 @@ function parseArgs(argv) {
692
702
  }
693
703
  function usage(error) {
694
704
  if (error) console.error(`check-function-manifest: ${error}`);
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]");
705
+ 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>]...] [--max-seconds <n>] [--json]");
696
706
  process.exit(2);
697
707
  }
698
708
 
@@ -787,7 +797,11 @@ export async function run(argv) {
787
797
  }
788
798
  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)");
789
799
 
790
- const seconds = ((Date.now() - started) / 1000).toFixed(1);
800
+ const elapsedMs = Date.now() - started;
801
+ if (elapsedMs >= opt.maxSeconds * 1000) {
802
+ problems.push({ rule: "time-budget", message: `the check took ${(elapsedMs / 1000).toFixed(1)} s; it must finish in under ${opt.maxSeconds} s (--max-seconds) so it stays fast enough to run locally` });
803
+ }
804
+ const seconds = (elapsedMs / 1000).toFixed(1);
791
805
  if (opt.json) {
792
806
  console.log(JSON.stringify({ ok: problems.length === 0, seconds: Number(seconds), checked, notices, problems }, null, 2));
793
807
  } else {