@indigoai-us/hq-cloud 6.11.5 → 6.11.7

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 (119) hide show
  1. package/dist/bin/sync-runner.d.ts +16 -16
  2. package/dist/bin/sync-runner.d.ts.map +1 -1
  3. package/dist/bin/sync-runner.js +51 -41
  4. package/dist/bin/sync-runner.js.map +1 -1
  5. package/dist/bin/sync-runner.test.js +108 -33
  6. package/dist/bin/sync-runner.test.js.map +1 -1
  7. package/dist/cli/share.d.ts +23 -0
  8. package/dist/cli/share.d.ts.map +1 -1
  9. package/dist/cli/share.js +54 -0
  10. package/dist/cli/share.js.map +1 -1
  11. package/dist/cli/share.test.js +142 -0
  12. package/dist/cli/share.test.js.map +1 -1
  13. package/dist/cli/sync.d.ts +16 -0
  14. package/dist/cli/sync.d.ts.map +1 -1
  15. package/dist/cli/sync.js +1 -62
  16. package/dist/cli/sync.js.map +1 -1
  17. package/dist/cli/tombstones.d.ts +43 -0
  18. package/dist/cli/tombstones.d.ts.map +1 -0
  19. package/dist/cli/tombstones.js +78 -0
  20. package/dist/cli/tombstones.js.map +1 -0
  21. package/dist/context.d.ts +6 -0
  22. package/dist/context.d.ts.map +1 -1
  23. package/dist/context.js +57 -17
  24. package/dist/context.js.map +1 -1
  25. package/dist/context.test.js +113 -1
  26. package/dist/context.test.js.map +1 -1
  27. package/dist/entity-resolver.test.js +3 -3
  28. package/dist/entity-resolver.test.js.map +1 -1
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +1 -1
  32. package/dist/index.js.map +1 -1
  33. package/dist/object-io.d.ts.map +1 -1
  34. package/dist/object-io.js +10 -0
  35. package/dist/object-io.js.map +1 -1
  36. package/dist/personal-vault.d.ts +36 -0
  37. package/dist/personal-vault.d.ts.map +1 -1
  38. package/dist/personal-vault.js +89 -1
  39. package/dist/personal-vault.js.map +1 -1
  40. package/dist/personal-vault.test.js +143 -1
  41. package/dist/personal-vault.test.js.map +1 -1
  42. package/dist/signals/get.d.ts.map +1 -1
  43. package/dist/signals/get.js +7 -11
  44. package/dist/signals/get.js.map +1 -1
  45. package/dist/signals/get.test.js +65 -1
  46. package/dist/signals/get.test.js.map +1 -1
  47. package/dist/signals/internals.d.ts +47 -3
  48. package/dist/signals/internals.d.ts.map +1 -1
  49. package/dist/signals/internals.js +110 -4
  50. package/dist/signals/internals.js.map +1 -1
  51. package/dist/signals/list.d.ts.map +1 -1
  52. package/dist/signals/list.js +16 -23
  53. package/dist/signals/list.js.map +1 -1
  54. package/dist/signals/list.test.js +84 -1
  55. package/dist/signals/list.test.js.map +1 -1
  56. package/dist/signals/types.d.ts +18 -1
  57. package/dist/signals/types.d.ts.map +1 -1
  58. package/dist/sources/get.d.ts.map +1 -1
  59. package/dist/sources/get.js +10 -22
  60. package/dist/sources/get.js.map +1 -1
  61. package/dist/sources/get.test.js +85 -1
  62. package/dist/sources/get.test.js.map +1 -1
  63. package/dist/sources/internals.d.ts +50 -3
  64. package/dist/sources/internals.d.ts.map +1 -1
  65. package/dist/sources/internals.js +113 -4
  66. package/dist/sources/internals.js.map +1 -1
  67. package/dist/sources/list.d.ts.map +1 -1
  68. package/dist/sources/list.js +16 -23
  69. package/dist/sources/list.js.map +1 -1
  70. package/dist/sources/list.test.js +101 -1
  71. package/dist/sources/list.test.js.map +1 -1
  72. package/dist/sources/types.d.ts +18 -1
  73. package/dist/sources/types.d.ts.map +1 -1
  74. package/dist/sync/event-sync.d.ts +6 -7
  75. package/dist/sync/event-sync.d.ts.map +1 -1
  76. package/dist/sync/event-sync.js +6 -7
  77. package/dist/sync/event-sync.js.map +1 -1
  78. package/dist/types.d.ts +33 -3
  79. package/dist/types.d.ts.map +1 -1
  80. package/dist/version.d.ts +14 -0
  81. package/dist/version.d.ts.map +1 -0
  82. package/dist/version.js +20 -0
  83. package/dist/version.js.map +1 -0
  84. package/dist/watcher.d.ts.map +1 -1
  85. package/dist/watcher.js +22 -1
  86. package/dist/watcher.js.map +1 -1
  87. package/dist/watcher.test.js +29 -0
  88. package/dist/watcher.test.js.map +1 -1
  89. package/package.json +1 -1
  90. package/src/bin/sync-runner.test.ts +131 -41
  91. package/src/bin/sync-runner.ts +56 -48
  92. package/src/cli/share.test.ts +169 -0
  93. package/src/cli/share.ts +81 -0
  94. package/src/cli/sync.ts +21 -88
  95. package/src/cli/tombstones.ts +106 -0
  96. package/src/context.test.ts +139 -1
  97. package/src/context.ts +59 -17
  98. package/src/entity-resolver.test.ts +3 -3
  99. package/src/index.ts +2 -0
  100. package/src/object-io.ts +12 -0
  101. package/src/personal-vault.test.ts +175 -0
  102. package/src/personal-vault.ts +86 -1
  103. package/src/signals/get.test.ts +83 -1
  104. package/src/signals/get.ts +9 -13
  105. package/src/signals/internals.ts +153 -4
  106. package/src/signals/list.test.ts +114 -1
  107. package/src/signals/list.ts +16 -29
  108. package/src/signals/types.ts +18 -1
  109. package/src/sources/get.test.ts +104 -1
  110. package/src/sources/get.ts +12 -24
  111. package/src/sources/internals.ts +156 -4
  112. package/src/sources/list.test.ts +132 -1
  113. package/src/sources/list.ts +16 -29
  114. package/src/sources/types.ts +18 -1
  115. package/src/sync/event-sync.ts +6 -7
  116. package/src/types.ts +33 -3
  117. package/src/version.ts +24 -0
  118. package/src/watcher.test.ts +41 -0
  119. package/src/watcher.ts +24 -1
package/src/types.ts CHANGED
@@ -155,9 +155,26 @@ export interface EntityContext {
155
155
  bucketName: string;
156
156
  /** AWS region */
157
157
  region: string;
158
- /** STS-scoped credentials */
159
- credentials: VaultCredentials;
160
- /** When the credentials expire (ISO 8601) */
158
+ /**
159
+ * STS-scoped credentials.
160
+ *
161
+ * Absent for presign-only COMPANY contexts (HQ-59): when a run uses the
162
+ * presigned-URL transport for company vaults (`companyVaultUsesPresign`),
163
+ * `resolveEntityContext` skips the `POST /sts/vend` call entirely — the
164
+ * presign transport authorizes each object server-side and never reads these
165
+ * creds, and a compliant sync-runner must NOT hit the company vend route
166
+ * (the route-presence signal the hq-pro min-version gate keys on). The only
167
+ * reader of these creds is the direct-S3 (`S3SdkObjectIO`) path, which is
168
+ * used for personal vaults (`prs_*`, still vended) and pre-presign clients —
169
+ * never for a `cmp_*` context built on the presign path. That path throws
170
+ * loudly if it ever receives a credential-less context.
171
+ */
172
+ credentials?: VaultCredentials;
173
+ /**
174
+ * When the credentials expire (ISO 8601). For a presign-only company context
175
+ * (no STS vend) this is a far-future sentinel so `isExpiringSoon` is always
176
+ * false and no auto-refresh ever re-vends the skipped company route.
177
+ */
161
178
  expiresAt: string;
162
179
  }
163
180
 
@@ -209,6 +226,19 @@ export interface VaultServiceConfig {
209
226
  * Optional for back-compat, but all first-party clients should pass it.
210
227
  */
211
228
  clientInfo?: ClientInfo;
229
+ /**
230
+ * When true, COMPANY vaults (`cmp_*`) use the presigned-URL transport, so
231
+ * `resolveEntityContext` SKIPS `POST /sts/vend` for them and returns a
232
+ * credential-less context with a far-future `expiresAt` (HQ-59). Set by the
233
+ * sync-runner exactly when it installs the presign transport factory, so the
234
+ * vend-skip and the transport choice can never diverge. Personal vaults
235
+ * (`prs_*`) are unaffected — they always vend self via `/sts/vend-self`.
236
+ *
237
+ * Leaving this unset (the default) preserves the historical behavior: every
238
+ * context vends STS creds. Non-runner callers (standalone `hq sync`, hq-cli)
239
+ * that keep the direct-S3 path for company vaults must NOT set this.
240
+ */
241
+ companyVaultUsesPresign?: boolean;
212
242
  }
213
243
 
214
244
  // ── Conflict index (consumed by /resolve-conflicts) ─────────────────────────
package/src/version.ts ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The hq-cloud package version, read once at module load.
3
+ *
4
+ * Mirrors hq-cli's `cli-version.ts` pattern: resolve the version from the
5
+ * package.json at runtime via `import.meta.url` (rootDir-safe — no JSON import
6
+ * that would trip `tsc`'s rootDir, and resolves correctly from both `src/`
7
+ * during tests and `dist/` at runtime). Used to stamp `clientInfo.version` on
8
+ * the sync-runner's vault requests so the company-vend min-version gate (HQ-59,
9
+ * hq-pro) can tell a compliant (>= 6.11.6) sync-runner from a pre-6.11.6
10
+ * straggler. This is the hq-cloud package version — the version the gate
11
+ * compares against its floor — NOT the hq-sync desktop app version.
12
+ */
13
+
14
+ import { readFileSync } from "node:fs";
15
+ import { fileURLToPath } from "node:url";
16
+ import path from "node:path";
17
+
18
+ const here = path.dirname(fileURLToPath(import.meta.url));
19
+ // src/version.ts → dist/version.js; one level up from either is the package root.
20
+ const pkg = JSON.parse(
21
+ readFileSync(path.resolve(here, "..", "package.json"), "utf-8"),
22
+ ) as { name: string; version: string };
23
+
24
+ export const HQ_CLOUD_VERSION: string = pkg.version;
@@ -263,6 +263,47 @@ describe("US-002: createWatchPathFilter — personal-vault exclusions", () => {
263
263
  expect(personal(path.join(ROOT, "repos/private/foo/file.ts"))).toBe(false);
264
264
  });
265
265
 
266
+ // ── DEV-1778 continuity-pointer carve-out ───────────────────────────────
267
+ it("DOES emit for workspace/threads/handoff.json (the continuity pointer)", () => {
268
+ expect(personal(path.join(ROOT, "workspace/threads/handoff.json"))).toBe(
269
+ true,
270
+ );
271
+ });
272
+
273
+ it("still does NOT emit for other workspace/ files (carve-out is pointer-only)", () => {
274
+ // The pointer is the ONLY re-include — sibling threads, the journal, and
275
+ // unrelated workspace litter stay machine-local.
276
+ expect(personal(path.join(ROOT, "workspace/threads/T-old.json"))).toBe(
277
+ false,
278
+ );
279
+ expect(personal(path.join(ROOT, "workspace/threads/INDEX.md"))).toBe(false);
280
+ expect(personal(path.join(ROOT, "workspace/locks/x.lock"))).toBe(false);
281
+ // The pointer queried as a directory is not an emit target either.
282
+ expect(
283
+ personal(path.join(ROOT, "workspace/threads/handoff.json"), true),
284
+ ).toBe(false);
285
+ });
286
+
287
+ it("allows chokidar to DESCEND through the pointer's ancestor dirs (dir probe)", () => {
288
+ // Without this the Linux chokidar backend prunes `workspace/` before ever
289
+ // reaching the leaf. Ancestor dirs return true ONLY when queried as dirs.
290
+ expect(personal(path.join(ROOT, "workspace"), true)).toBe(true);
291
+ expect(personal(path.join(ROOT, "workspace/threads"), true)).toBe(true);
292
+ // A non-ancestor dir under workspace/ is still pruned.
293
+ expect(personal(path.join(ROOT, "workspace/locks"), true)).toBe(false);
294
+ // Ancestor dirs queried as FILES are not emit targets.
295
+ expect(personal(path.join(ROOT, "workspace"), false)).toBe(false);
296
+ });
297
+
298
+ it("does not apply the carve-out in non-personal mode", () => {
299
+ // In non-personal mode the excluded-top-level layer never runs, so the
300
+ // carve-out is irrelevant; handoff.json passes via the ordinary ignore
301
+ // stack like any other tracked file (no special-casing needed).
302
+ expect(
303
+ nonPersonal(path.join(ROOT, "workspace/threads/handoff.json")),
304
+ ).toBe(true);
305
+ });
306
+
266
307
  it("DOES emit for an included top-level personal path in personalMode", () => {
267
308
  expect(personal(path.join(ROOT, "personal/notes.md"))).toBe(true);
268
309
  expect(personal(path.join(ROOT, "core/policies/x.md"))).toBe(true);
package/src/watcher.ts CHANGED
@@ -19,7 +19,10 @@ import { readJournal, writeJournal, hashFile, updateEntry } from "./journal.js";
19
19
  import { uploadFile, deleteRemoteFile, toPosixKey } from "./s3.js";
20
20
  import type { UploadAuthor } from "./s3.js";
21
21
  import { isPersonalVaultExcluded } from "./personal-vault-exclusions.js";
22
- import { PERSONAL_VAULT_EXCLUDED_TOP_LEVEL } from "./personal-vault.js";
22
+ import {
23
+ CONTINUITY_POINTER_REL,
24
+ PERSONAL_VAULT_EXCLUDED_TOP_LEVEL,
25
+ } from "./personal-vault.js";
23
26
  import type { PushEvent } from "./sync/push-event.js";
24
27
  import type { PushTransport } from "./sync/push-transport.js";
25
28
  import type { EventDrivenPushFlagProvider } from "./sync/feature-flags.js";
@@ -498,6 +501,26 @@ export function createWatchPathFilter(
498
501
  if (!ignoreFilter(absolutePath, isDir)) return false;
499
502
 
500
503
  if (personalMode) {
504
+ // Continuity-pointer carve-out: the session pointer lives under the
505
+ // otherwise-excluded `workspace/`, so it must re-include BEFORE the
506
+ // top-level bucket rejection below. Two cases:
507
+ // (a) the pointer FILE itself → emit. Waking on the pointer is
508
+ // sufficient: `/handoff` rewrites handoff.json AFTER its
509
+ // (immutable) thread file, and the resulting personal push
510
+ // re-enumerates via computePersonalVaultPaths, which sweeps the
511
+ // pointer + its active thread file together.
512
+ // (b) an ANCESTOR DIR of the pointer (`workspace`, `workspace/threads`)
513
+ // queried as a directory → allow descent. The Linux chokidar
514
+ // backend prunes a subtree the instant its dir probe says "ignore",
515
+ // so without this it would prune `workspace/` before ever reaching
516
+ // the leaf (the same ancestor-descent subtlety `.hqinclude` handles
517
+ // via its ancestor matcher). The native recursive backend ignores
518
+ // descent decisions and re-checks each path at event time, so this
519
+ // only matters for chokidar but is harmless everywhere.
520
+ // See computeContinuityPointerPaths for the matching push-side carve-out.
521
+ if (rel === CONTINUITY_POINTER_REL && !isDir) return true;
522
+ if (isDir && CONTINUITY_POINTER_REL.startsWith(rel + "/")) return true;
523
+
501
524
  // Layer 3: excluded top-level buckets (.git/companies/repos/workspace).
502
525
  const topLevel = rel.split("/")[0];
503
526
  if (excludedTopLevel.has(topLevel)) return false;