@indigoai-us/hq-cloud 6.18.32 → 6.18.34

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 (95) hide show
  1. package/dist/bin/sync-runner-delete-snapshot.bench.test.js +13 -3
  2. package/dist/bin/sync-runner-delete-snapshot.bench.test.js.map +1 -1
  3. package/dist/bin/sync-runner-watch-loop.d.ts +9 -1
  4. package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
  5. package/dist/bin/sync-runner-watch-loop.js +139 -35
  6. package/dist/bin/sync-runner-watch-loop.js.map +1 -1
  7. package/dist/bin/sync-runner.d.ts.map +1 -1
  8. package/dist/bin/sync-runner.js +8 -4
  9. package/dist/bin/sync-runner.js.map +1 -1
  10. package/dist/bin/sync-runner.test.js +226 -36
  11. package/dist/bin/sync-runner.test.js.map +1 -1
  12. package/dist/cli/reindex-async.d.ts +9 -0
  13. package/dist/cli/reindex-async.d.ts.map +1 -0
  14. package/dist/cli/reindex-async.js +76 -0
  15. package/dist/cli/reindex-async.js.map +1 -0
  16. package/dist/cli/reindex.d.ts +4 -0
  17. package/dist/cli/reindex.d.ts.map +1 -1
  18. package/dist/cli/reindex.js +3 -3
  19. package/dist/cli/reindex.js.map +1 -1
  20. package/dist/cli/rescue-core.d.ts +2 -0
  21. package/dist/cli/rescue-core.d.ts.map +1 -1
  22. package/dist/cli/rescue-core.js +19 -11
  23. package/dist/cli/rescue-core.js.map +1 -1
  24. package/dist/cli/rescue-rsync-preflight.test.js +1 -1
  25. package/dist/cli/rescue-rsync-preflight.test.js.map +1 -1
  26. package/dist/cli/rescue-source-switch-floor.test.js +39 -2
  27. package/dist/cli/rescue-source-switch-floor.test.js.map +1 -1
  28. package/dist/cognito-auth.d.ts +5 -1
  29. package/dist/cognito-auth.d.ts.map +1 -1
  30. package/dist/cognito-auth.js +19 -8
  31. package/dist/cognito-auth.js.map +1 -1
  32. package/dist/http-keepalive.d.ts +7 -0
  33. package/dist/http-keepalive.d.ts.map +1 -0
  34. package/dist/http-keepalive.js +66 -0
  35. package/dist/http-keepalive.js.map +1 -0
  36. package/dist/journal.d.ts +1 -0
  37. package/dist/journal.d.ts.map +1 -1
  38. package/dist/journal.js +1 -1
  39. package/dist/journal.js.map +1 -1
  40. package/dist/machine-auth.test.js +87 -0
  41. package/dist/machine-auth.test.js.map +1 -1
  42. package/dist/object-io.d.ts +2 -1
  43. package/dist/object-io.d.ts.map +1 -1
  44. package/dist/object-io.js +37 -32
  45. package/dist/object-io.js.map +1 -1
  46. package/dist/object-io.test.js +8 -1
  47. package/dist/object-io.test.js.map +1 -1
  48. package/dist/s3.d.ts.map +1 -1
  49. package/dist/s3.js +2 -1
  50. package/dist/s3.js.map +1 -1
  51. package/dist/session-log-capture.d.ts +4 -0
  52. package/dist/session-log-capture.d.ts.map +1 -1
  53. package/dist/session-log-capture.js +56 -19
  54. package/dist/session-log-capture.js.map +1 -1
  55. package/dist/session-log-capture.test.js +79 -0
  56. package/dist/session-log-capture.test.js.map +1 -1
  57. package/dist/sync/multipart-uploader.d.ts +2 -0
  58. package/dist/sync/multipart-uploader.d.ts.map +1 -1
  59. package/dist/sync/multipart-uploader.js +31 -1
  60. package/dist/sync/multipart-uploader.js.map +1 -1
  61. package/dist/sync/multipart-uploader.test.js +17 -1
  62. package/dist/sync/multipart-uploader.test.js.map +1 -1
  63. package/dist/sync/realtime-network-integration.test.d.ts +2 -0
  64. package/dist/sync/realtime-network-integration.test.d.ts.map +1 -0
  65. package/dist/sync/realtime-network-integration.test.js +83 -0
  66. package/dist/sync/realtime-network-integration.test.js.map +1 -0
  67. package/dist/sync/realtime-telemetry.d.ts +20 -3
  68. package/dist/sync/realtime-telemetry.d.ts.map +1 -1
  69. package/dist/sync/realtime-telemetry.js +85 -7
  70. package/dist/sync/realtime-telemetry.js.map +1 -1
  71. package/dist/sync/realtime-telemetry.test.js +68 -6
  72. package/dist/sync/realtime-telemetry.test.js.map +1 -1
  73. package/dist/sync/sync-work.d.ts +1 -0
  74. package/dist/sync/sync-work.d.ts.map +1 -1
  75. package/dist/sync/sync-work.js.map +1 -1
  76. package/dist/vault-client.d.ts.map +1 -1
  77. package/dist/vault-client.js +8 -2
  78. package/dist/vault-client.js.map +1 -1
  79. package/dist/watcher-replan-sweep.test.js +21 -3
  80. package/dist/watcher-replan-sweep.test.js.map +1 -1
  81. package/dist/watcher.d.ts +2 -0
  82. package/dist/watcher.d.ts.map +1 -1
  83. package/dist/watcher.js +166 -50
  84. package/dist/watcher.js.map +1 -1
  85. package/dist/watcher.test.js +59 -5
  86. package/dist/watcher.test.js.map +1 -1
  87. package/dist/watcher.warmup-cancel.test.d.ts +2 -0
  88. package/dist/watcher.warmup-cancel.test.d.ts.map +1 -0
  89. package/dist/watcher.warmup-cancel.test.js +59 -0
  90. package/dist/watcher.warmup-cancel.test.js.map +1 -0
  91. package/dist/watcher.warmup-responsive.test.d.ts +2 -0
  92. package/dist/watcher.warmup-responsive.test.d.ts.map +1 -0
  93. package/dist/watcher.warmup-responsive.test.js +62 -0
  94. package/dist/watcher.warmup-responsive.test.js.map +1 -0
  95. package/package.json +1 -1
@@ -232,7 +232,33 @@ describe("TreeWatcher pending backlog caps", () => {
232
232
  expect(result.scannedPaths).toBe(0);
233
233
  expect(result.batch.paths.size).toBe(50_000);
234
234
  expect(eventLoopTicks).toBeGreaterThan(1);
235
- expect(Number(histogram.max) / 1_000_000).toBeLessThan(250);
235
+ expect(Number(histogram.max) / 1_000_000).toBeLessThan(50);
236
+ }
237
+ finally {
238
+ fs.rmSync(dir, { recursive: true, force: true });
239
+ }
240
+ });
241
+ it("uses async filesystem calls and prunes excluded trees during warm-up", async () => {
242
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), "hq-watcher-warmup-async-fs-"));
243
+ const allowed = path.join(dir, "core", "knowledge", "public");
244
+ const nodeModules = path.join(dir, "core", "workers", "demo", "node_modules", "pkg");
245
+ const target = path.join(dir, "core", "packages", "demo", "target", "debug");
246
+ fs.mkdirSync(allowed, { recursive: true });
247
+ fs.mkdirSync(nodeModules, { recursive: true });
248
+ fs.mkdirSync(target, { recursive: true });
249
+ fs.writeFileSync(path.join(allowed, "keep.md"), "keep");
250
+ fs.writeFileSync(path.join(nodeModules, "skip.js"), "skip");
251
+ fs.writeFileSync(path.join(target, "skip.o"), "skip");
252
+ try {
253
+ const watcher = new TreeWatcher({
254
+ hqRoot: dir,
255
+ pathFilter: createWatchPathFilter(dir, false),
256
+ });
257
+ const result = await watcher.collectWarmupCatchupAsync(Date.now() - 10_000);
258
+ expect(result.scannedPaths).toBeGreaterThan(0);
259
+ expect([...result.batch.paths.values()]).toEqual([
260
+ "core/knowledge/public/keep.md",
261
+ ]);
236
262
  }
237
263
  finally {
238
264
  fs.rmSync(dir, { recursive: true, force: true });
@@ -3933,20 +3959,33 @@ describe("Linux folder-only native backend (startScopedRecursiveWatch, recursive
3933
3959
  }
3934
3960
  expect(check()).toBe(true);
3935
3961
  }
3962
+ function waitForReady(backend) {
3963
+ return new Promise((resolve) => {
3964
+ if (backend.onReady)
3965
+ backend.onReady(resolve);
3966
+ else
3967
+ resolve();
3968
+ });
3969
+ }
3936
3970
  function startFolderOnly(opts = {}) {
3937
- const shouldEmit = createWatchPathFilter(root, false);
3971
+ const shouldEmit = opts.includeAll
3972
+ ? () => true
3973
+ : createWatchPathFilter(root, false);
3938
3974
  return startScopedRecursiveWatch(root, shouldEmit, opts.onEvent ?? (() => { }), opts.onError ?? ((err) => { throw err; }), undefined, {
3939
3975
  recursiveWatches: false,
3940
3976
  maxWatchedPaths: opts.maxWatchedPaths,
3941
3977
  onWatchBudgetExceeded: opts.onWatchBudgetExceeded,
3942
3978
  listChildDirs: opts.listChildDirs,
3979
+ watchDirectory: opts.watchDirectory,
3980
+ directoryIdentity: opts.directoryIdentity,
3943
3981
  });
3944
3982
  }
3945
- it("takes exactly one watch per in-scope directory and none per file", () => {
3983
+ it("takes exactly one watch per in-scope directory and none per file", async () => {
3946
3984
  const { inScopeDirs } = seedTree();
3947
3985
  const before = isLinux ? inotifyWatchDescriptors() : 0;
3948
3986
  const backend = startFolderOnly();
3949
3987
  try {
3988
+ await waitForReady(backend);
3950
3989
  expect(backend.mode).toBe("native");
3951
3990
  expect(backend.attachFailures).toBe(0);
3952
3991
  // 4 in-scope directories; 8 in-scope files and an excluded subtree add nothing.
@@ -4081,6 +4120,7 @@ describe("Linux folder-only native backend (startScopedRecursiveWatch, recursive
4081
4120
  seedTree();
4082
4121
  const seen = [];
4083
4122
  const late = path.join(root, "notes", "late");
4123
+ const watchEvents = new Map();
4084
4124
  // The plan walk lists `notes`, then — before any watch existed on the
4085
4125
  // old code path — `notes/late` appears. The snapshot plan never holds
4086
4126
  // it, and a shallow watch on `notes` attached only after the whole walk
@@ -4095,13 +4135,25 @@ describe("Linux folder-only native backend (startScopedRecursiveWatch, recursive
4095
4135
  fs.mkdirSync(late);
4096
4136
  return children;
4097
4137
  };
4098
- const backend = startFolderOnly({ onEvent: (p) => seen.push(p), listChildDirs });
4138
+ const backend = startFolderOnly({
4139
+ onEvent: (p) => seen.push(p),
4140
+ listChildDirs,
4141
+ watchDirectory: ((dir, _options, listener) => {
4142
+ watchEvents.set(path.resolve(String(dir)), listener);
4143
+ const handle = new EventEmitter();
4144
+ handle.close = () => { };
4145
+ return handle;
4146
+ }),
4147
+ });
4099
4148
  try {
4149
+ await waitForReady(backend);
4150
+ watchEvents.get(path.join(root, "notes"))?.("rename", "late");
4100
4151
  // root, docs, docs/deep, notes — plus `late`, picked up by the live
4101
4152
  // watch on `notes` rather than by the plan.
4102
4153
  await waitFor(() => backend.watchedPathCount() === 5);
4103
4154
  const file = path.join(late, "inside.md");
4104
4155
  fs.writeFileSync(file, "x");
4156
+ watchEvents.get(late)?.("rename", "inside.md");
4105
4157
  await waitFor(() => seen.includes(file));
4106
4158
  }
4107
4159
  finally {
@@ -4125,7 +4177,7 @@ describe("Linux folder-only native backend (startScopedRecursiveWatch, recursive
4125
4177
  backend.close();
4126
4178
  }
4127
4179
  });
4128
- it("stops attaching at the budget and reports the exhaustion exactly once, counting real watches", () => {
4180
+ it("stops attaching at the budget and reports the exhaustion exactly once, counting real watches", async () => {
4129
4181
  seedTree();
4130
4182
  const exceeded = vi.fn();
4131
4183
  const backend = startFolderOnly({
@@ -4133,6 +4185,7 @@ describe("Linux folder-only native backend (startScopedRecursiveWatch, recursive
4133
4185
  onWatchBudgetExceeded: exceeded,
4134
4186
  });
4135
4187
  try {
4188
+ await waitForReady(backend);
4136
4189
  expect(backend.watchedPathCount()).toBe(2);
4137
4190
  expect(exceeded).toHaveBeenCalledTimes(1);
4138
4191
  expect(exceeded.mock.calls[0][0]).toMatchObject({
@@ -4234,6 +4287,7 @@ describe("Linux folder-only native backend (startScopedRecursiveWatch, recursive
4234
4287
  w.onChange(changed);
4235
4288
  w.start();
4236
4289
  try {
4290
+ await new Promise((resolve) => w.onReady(resolve));
4237
4291
  expect(w.watchMode()).toBe("native");
4238
4292
  expect(inotifyWatchDescriptors() - before).toBe(inScopeDirs.length);
4239
4293
  fs.writeFileSync(path.join(root, "notes", "new.md"), "hi");