@indigoai-us/hq-cli 5.345.226 → 5.345.230

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 (138) hide show
  1. package/CHANGELOG.md +156 -0
  2. package/dist/command-catalog.generated.d.ts +376 -11
  3. package/dist/command-catalog.generated.js +451 -11
  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 +2 -2
  18. package/dist/commands/index-cmd.d.ts +3 -1
  19. package/dist/commands/index-cmd.js +12 -0
  20. package/dist/commands/lanes-checks.js +1 -1
  21. package/dist/commands/lanes-session-start.d.ts +1 -2
  22. package/dist/commands/lanes-session-start.js +9 -145
  23. package/dist/commands/lanes-shared.d.ts +3 -0
  24. package/dist/commands/lanes.d.ts +3 -0
  25. package/dist/commands/lanes.js +94 -27
  26. package/dist/commands/link.d.ts +8 -3
  27. package/dist/commands/link.js +14 -17
  28. package/dist/commands/mcp-registration.d.ts +65 -7
  29. package/dist/commands/mcp-registration.js +289 -51
  30. package/dist/commands/mesh.d.ts +12 -0
  31. package/dist/commands/mesh.js +92 -10
  32. package/dist/commands/reindex.js +6 -0
  33. package/dist/commands/repo.d.ts +13 -0
  34. package/dist/commands/repo.js +39 -1
  35. package/dist/commands/sync-mode.d.ts +3 -1
  36. package/dist/commands/sync-mode.js +11 -1
  37. package/dist/hq-cloud-sync-runner/bin/sync-runner.js +1473 -1043
  38. package/dist/hq-cloud-sync-runner/package.json +1 -1
  39. package/dist/lazy-commands.js +3 -4
  40. package/dist/lib/checkpoint-ontology/entity-file.js +4 -4
  41. package/dist/lib/checkpoint-ontology/merge-copies.js +7 -11
  42. package/dist/lib/checkpoint-ontology/plan.js +2 -1
  43. package/dist/lib/core-utils/archive-old-threads.js +5 -2
  44. package/dist/lib/core-utils/session-company.d.ts +13 -1
  45. package/dist/lib/core-utils/session-company.js +75 -4
  46. package/dist/lib/core-utils/worktree-resume.d.ts +6 -0
  47. package/dist/lib/core-utils/worktree-resume.js +8 -4
  48. package/dist/lib/daemon/background-qos.d.ts +7 -0
  49. package/dist/lib/daemon/background-qos.js +13 -0
  50. package/dist/lib/daemon/catalog.d.ts +9 -0
  51. package/dist/lib/daemon/catalog.js +8 -1
  52. package/dist/lib/daemon/hook-requests-acl-suggest.d.ts +18 -0
  53. package/dist/lib/daemon/hook-requests-acl-suggest.js +245 -0
  54. package/dist/lib/daemon/hook-requests-conduct-link.d.ts +20 -0
  55. package/dist/lib/daemon/hook-requests-conduct-link.js +105 -0
  56. package/dist/lib/daemon/hook-requests-fleet-session-start.d.ts +32 -0
  57. package/dist/lib/daemon/hook-requests-fleet-session-start.js +214 -0
  58. package/dist/lib/daemon/hook-requests-mesh-tool-writes.d.ts +44 -0
  59. package/dist/lib/daemon/hook-requests-mesh-tool-writes.js +292 -0
  60. package/dist/lib/daemon/hook-requests-mesh.d.ts +54 -0
  61. package/dist/lib/daemon/hook-requests-mesh.js +559 -0
  62. package/dist/lib/daemon/hook-requests.d.ts +354 -8
  63. package/dist/lib/daemon/hook-requests.js +1330 -46
  64. package/dist/lib/daemon/machine-checks.d.ts +12 -2
  65. package/dist/lib/daemon/machine-checks.js +27 -10
  66. package/dist/lib/daemon/merge-sections.d.ts +24 -2
  67. package/dist/lib/daemon/merge-sections.js +58 -16
  68. package/dist/lib/daemon/ops/policy.js +4 -2
  69. package/dist/lib/daemon/resolver.js +9 -2
  70. package/dist/lib/daemon/run.d.ts +11 -7
  71. package/dist/lib/daemon/run.js +168 -24
  72. package/dist/lib/daemon/search-index-worker-v1.d.ts +2 -0
  73. package/dist/lib/daemon/search-index-worker-v1.js +25 -0
  74. package/dist/lib/daemon/session-registry.d.ts +0 -1
  75. package/dist/lib/daemon/session-registry.js +0 -3
  76. package/dist/lib/daemon/supervisor.d.ts +3 -1
  77. package/dist/lib/daemon/supervisor.js +1 -1
  78. package/dist/lib/daemon/tcc-eperm.d.ts +59 -4
  79. package/dist/lib/daemon/tcc-eperm.js +110 -8
  80. package/dist/lib/doctor/fix/process-identity.d.ts +20 -2
  81. package/dist/lib/doctor/fix/process-identity.js +48 -5
  82. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  83. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  84. package/dist/lib/hook-engine/canary-gate.js +1 -0
  85. package/dist/lib/hook-engine/native-stop-compatibility.json +2 -1
  86. package/dist/lib/hot-channels/adapters/attio.js +2 -1
  87. package/dist/lib/hot-channels/adapters/meetings.js +2 -1
  88. package/dist/lib/lanes/company-outposts.d.ts +37 -0
  89. package/dist/lib/lanes/company-outposts.js +164 -0
  90. package/dist/lib/lanes/liveness.d.ts +6 -0
  91. package/dist/lib/lanes/liveness.js +49 -8
  92. package/dist/lib/lanes/orphan-report.d.ts +15 -0
  93. package/dist/lib/lanes/orphan-report.js +223 -0
  94. package/dist/lib/lanes/orphan-sweep.d.ts +26 -0
  95. package/dist/lib/lanes/orphan-sweep.js +152 -0
  96. package/dist/lib/lanes/reaper.d.ts +2 -0
  97. package/dist/lib/lanes/reaper.js +11 -8
  98. package/dist/lib/lanes/reconcile.d.ts +8 -7
  99. package/dist/lib/lanes/reconcile.js +39 -0
  100. package/dist/lib/mesh/live/backfill-held.d.ts +13 -0
  101. package/dist/lib/mesh/live/backfill-held.js +23 -0
  102. package/dist/lib/mesh/live/daemon/mode.d.ts +8 -4
  103. package/dist/lib/mesh/live/daemon/mode.js +8 -4
  104. package/dist/lib/mesh/live/daemon/run.d.ts +14 -3
  105. package/dist/lib/mesh/live/daemon/run.js +116 -7
  106. package/dist/lib/mesh/live/direct-drain.d.ts +123 -0
  107. package/dist/lib/mesh/live/direct-drain.js +315 -0
  108. package/dist/lib/mesh/live/emit-replay.d.ts +10 -0
  109. package/dist/lib/mesh/live/emit-replay.js +10 -0
  110. package/dist/lib/mesh/live/flush.d.ts +15 -0
  111. package/dist/lib/mesh/live/flush.js +27 -0
  112. package/dist/lib/mesh/live/liveness-carry.d.ts +45 -0
  113. package/dist/lib/mesh/live/liveness-carry.js +141 -0
  114. package/dist/lib/mesh/live/spool.d.ts +19 -0
  115. package/dist/lib/mesh/live/spool.js +80 -0
  116. package/dist/lib/safe-store.d.ts +2 -0
  117. package/dist/lib/safe-store.js +8 -6
  118. package/dist/lib/search-index/index.d.ts +9 -3
  119. package/dist/lib/search-index/index.js +35 -10
  120. package/dist/lib/search-index/worker-process.d.ts +9 -0
  121. package/dist/lib/search-index/worker-process.js +171 -0
  122. package/dist/lib/session-company-lock.d.ts +3 -1
  123. package/dist/lib/session-company-lock.js +3 -2
  124. package/dist/utils/delegate-command-supervisor.d.ts +3 -0
  125. package/dist/utils/delegate-command-supervisor.js +44 -0
  126. package/dist/utils/delegate-lock.d.ts +12 -0
  127. package/dist/utils/delegate-lock.js +88 -0
  128. package/dist/utils/frontmatter.d.ts +27 -0
  129. package/dist/utils/frontmatter.js +33 -0
  130. package/dist/utils/hook-trust.d.ts +1 -0
  131. package/dist/utils/hook-trust.js +18 -2
  132. package/dist/utils/host-registration.d.ts +13 -1
  133. package/dist/utils/host-registration.js +98 -5
  134. package/dist/utils/package-use-lease.d.ts +1 -1
  135. package/dist/utils/package-use-lease.js +15 -7
  136. package/docs/anywhere-runtime.md +17 -0
  137. package/package.json +9 -8
  138. package/scripts/check-function-manifest.mjs +17 -3
@@ -8,6 +8,12 @@ import { Command } from "commander";
8
8
  * ordering, and quoting in the rest of the file are left as they were. The
9
9
  * result is parsed back before writing; if the entry does not show up where
10
10
  * expected, nothing is written.
11
+ *
12
+ * Folder-to-company has one store (US-030 c3): the registry that `hq link`
13
+ * writes and `hq resolve-company`, hqd and the MCP tool read. After the
14
+ * manifest write, `hq repo add` seeds that registry from the manifest the way
15
+ * `hq install --global` does, so the new checkout resolves at once. Seeding
16
+ * never replaces an `hq link` entry.
11
17
  */
12
18
  export declare const MANIFEST_RELATIVE_PATH: string;
13
19
  export declare function manifestRepos(text: string, company: string): string[] | null;
@@ -28,12 +34,19 @@ export interface RepoAddOptions {
28
34
  visibility: "private" | "public";
29
35
  name?: string;
30
36
  dryRun?: boolean;
37
+ /**
38
+ * Registry file to seed after the manifest write (the `hq link` store).
39
+ * Unset seeds nothing; the command passes the user's registry.
40
+ */
41
+ registryFile?: string;
31
42
  }
32
43
  export interface RepoAddResult {
33
44
  entry: string;
34
45
  linked: boolean;
35
46
  manifestChanged: boolean;
36
47
  warnings: string[];
48
+ /** True when the registry was seeded from the manifest after the write. */
49
+ registrySeeded?: boolean;
37
50
  }
38
51
  /** Register a checkout. Throws a user-facing Error on any refusal. */
39
52
  export declare function runRepoAdd(opts: RepoAddOptions): RepoAddResult;
@@ -3,6 +3,8 @@ import * as fs from "node:fs";
3
3
  import * as path from "node:path";
4
4
  import * as yaml from "js-yaml";
5
5
  import { findHqRoot } from "../utils/manifest.js";
6
+ import { readRegistry, registryFile, resolveCompanyForDir } from "../lib/registry/registry.js";
7
+ import { seedRegistryFromHqRoot } from "./link.js";
6
8
  /**
7
9
  * `hq repo add <path> --company <slug>` — register a git checkout with HQ:
8
10
  * link it into `repos/<private|public>/<name>` and list it under
@@ -12,6 +14,12 @@ import { findHqRoot } from "../utils/manifest.js";
12
14
  * ordering, and quoting in the rest of the file are left as they were. The
13
15
  * result is parsed back before writing; if the entry does not show up where
14
16
  * expected, nothing is written.
17
+ *
18
+ * Folder-to-company has one store (US-030 c3): the registry that `hq link`
19
+ * writes and `hq resolve-company`, hqd and the MCP tool read. After the
20
+ * manifest write, `hq repo add` seeds that registry from the manifest the way
21
+ * `hq install --global` does, so the new checkout resolves at once. Seeding
22
+ * never replaces an `hq link` entry.
15
23
  */
16
24
  export const MANIFEST_RELATIVE_PATH = path.join("companies", "manifest.yaml");
17
25
  function indentOf(line) {
@@ -271,7 +279,36 @@ export function runRepoAdd(opts) {
271
279
  if (manifestChanged)
272
280
  writeManifestAtomically(manifestPath, manifestText, nextText);
273
281
  }
274
- return { entry, linked: linkPath !== null, manifestChanged, warnings };
282
+ const result = { entry, linked: linkPath !== null, manifestChanged, warnings };
283
+ if (!opts.dryRun && opts.registryFile !== undefined) {
284
+ result.registrySeeded = seedRegistryAfterAdd(hqRoot, opts.registryFile, sourceReal, opts.company, warnings);
285
+ }
286
+ return result;
287
+ }
288
+ /**
289
+ * Seed the folder-to-company registry from the manifest just written. The
290
+ * manifest write has already happened, so a registry failure is a warning,
291
+ * not an error: `hq install --global` or `hq link --seed-manifest` repairs it.
292
+ */
293
+ function seedRegistryAfterAdd(hqRoot, file, checkout, company, warnings) {
294
+ try {
295
+ seedRegistryFromHqRoot(hqRoot, { file });
296
+ }
297
+ catch (err) {
298
+ warnings.push(`The HQ registry was not updated (${err instanceof Error ? err.message : String(err)}). ` +
299
+ `Run \`hq link --seed-manifest ${hqRoot}\` to update it.`);
300
+ return false;
301
+ }
302
+ try {
303
+ const bound = resolveCompanyForDir(readRegistry(file), checkout);
304
+ if (bound.company && bound.company !== company) {
305
+ warnings.push(`${checkout} is linked to ${bound.company} with \`hq link\`; hq resolve-company keeps answering ${bound.company} until that link is removed (\`hq unlink\`).`);
306
+ }
307
+ }
308
+ catch {
309
+ // The seed above read and wrote this file; a failed re-read changes nothing written.
310
+ }
311
+ return true;
275
312
  }
276
313
  function isDanglingSymlink(p) {
277
314
  try {
@@ -312,6 +349,7 @@ export function registerRepoCommand(program) {
312
349
  visibility: opts.public ? "public" : "private",
313
350
  name: opts.name,
314
351
  dryRun: opts.dryRun,
352
+ registryFile: registryFile(),
315
353
  });
316
354
  for (const w of result.warnings)
317
355
  console.warn(chalk.yellow("Warning:"), w);
@@ -95,7 +95,9 @@ export declare function validateMode(mode: string): SyncMode;
95
95
  * throws — auto-detect is best-effort.
96
96
  */
97
97
  export declare function readActiveCompanySlug(hqRoot: string): string | undefined;
98
- /** Parse `--paths a/,b/c/` into trimmed non-empty entries. */
98
+ /** Validate portable, company-relative sync prefixes without normalizing them. */
99
+ export declare function validateCustomPaths(entries: readonly string[] | undefined): void;
100
+ /** Parse `--paths a/,b/c/` into validated, trimmed non-empty entries. */
99
101
  export declare function parseCustomPaths(raw: string | undefined): string[] | undefined;
100
102
  /**
101
103
  * Resolve a membership by company slug, then PUT the new sync-mode. Returns
@@ -69,7 +69,15 @@ export function readActiveCompanySlug(hqRoot) {
69
69
  return undefined;
70
70
  }
71
71
  }
72
- /** Parse `--paths a/,b/c/` into trimmed non-empty entries. */
72
+ /** Validate portable, company-relative sync prefixes without normalizing them. */
73
+ export function validateCustomPaths(entries) {
74
+ for (const entry of entries ?? []) {
75
+ if (!entry || entry.includes("..") || /^[\\/]/.test(entry) || /^[A-Za-z]:/.test(entry)) {
76
+ throw new Error("Custom sync paths must be relative paths without parent ('..') components.");
77
+ }
78
+ }
79
+ }
80
+ /** Parse `--paths a/,b/c/` into validated, trimmed non-empty entries. */
73
81
  export function parseCustomPaths(raw) {
74
82
  if (!raw)
75
83
  return undefined;
@@ -77,6 +85,7 @@ export function parseCustomPaths(raw) {
77
85
  .split(",")
78
86
  .map((s) => s.trim())
79
87
  .filter((s) => s.length > 0);
88
+ validateCustomPaths(parts);
80
89
  return parts.length > 0 ? parts : undefined;
81
90
  }
82
91
  // ── Orchestrators (pure, injectable — driven by tests) ──────────────────────
@@ -87,6 +96,7 @@ export function parseCustomPaths(raw) {
87
96
  */
88
97
  export async function setSyncMode(options) {
89
98
  const { mode, companySlug, customPaths, vaultClient } = options;
99
+ validateCustomPaths(customPaths);
90
100
  // 1. Find the caller's membership for this company.
91
101
  const memberships = await vaultClient.listMyMemberships();
92
102
  // Resolve slug → uid via entity.get on each membership's companyUid in