@indigoai-us/hq-cloud 6.15.79 → 6.15.81

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 (100) hide show
  1. package/dist/bin/area-ledger-migration.d.ts +13 -0
  2. package/dist/bin/area-ledger-migration.d.ts.map +1 -0
  3. package/dist/bin/area-ledger-migration.js +64 -0
  4. package/dist/bin/area-ledger-migration.js.map +1 -0
  5. package/dist/bin/area-ledger-migration.test.d.ts +2 -0
  6. package/dist/bin/area-ledger-migration.test.d.ts.map +1 -0
  7. package/dist/bin/area-ledger-migration.test.js +55 -0
  8. package/dist/bin/area-ledger-migration.test.js.map +1 -0
  9. package/dist/bin/sync-runner-company.d.ts +6 -0
  10. package/dist/bin/sync-runner-company.d.ts.map +1 -1
  11. package/dist/bin/sync-runner-company.js +21 -0
  12. package/dist/bin/sync-runner-company.js.map +1 -1
  13. package/dist/bin/sync-runner-company.test.js +112 -0
  14. package/dist/bin/sync-runner-company.test.js.map +1 -1
  15. package/dist/bin/sync-runner-events.test.js +20 -0
  16. package/dist/bin/sync-runner-events.test.js.map +1 -1
  17. package/dist/bin/sync-runner-watch-loop.d.ts +7 -0
  18. package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
  19. package/dist/bin/sync-runner-watch-loop.js +308 -20
  20. package/dist/bin/sync-runner-watch-loop.js.map +1 -1
  21. package/dist/bin/sync-runner.d.ts +5 -0
  22. package/dist/bin/sync-runner.d.ts.map +1 -1
  23. package/dist/bin/sync-runner.js.map +1 -1
  24. package/dist/bin/sync-runner.test.js +144 -1
  25. package/dist/bin/sync-runner.test.js.map +1 -1
  26. package/dist/cli/share.d.ts +8 -0
  27. package/dist/cli/share.d.ts.map +1 -1
  28. package/dist/cli/share.js +213 -15
  29. package/dist/cli/share.js.map +1 -1
  30. package/dist/cli/share.test.js +461 -31
  31. package/dist/cli/share.test.js.map +1 -1
  32. package/dist/cli/sync.d.ts +30 -0
  33. package/dist/cli/sync.d.ts.map +1 -1
  34. package/dist/cli/sync.js +83 -8
  35. package/dist/cli/sync.js.map +1 -1
  36. package/dist/cli/sync.test.js +224 -0
  37. package/dist/cli/sync.test.js.map +1 -1
  38. package/dist/cli/watch-event-push-conflict.test.js +22 -11
  39. package/dist/cli/watch-event-push-conflict.test.js.map +1 -1
  40. package/dist/journal-store.test.js +42 -1
  41. package/dist/journal-store.test.js.map +1 -1
  42. package/dist/journal.d.ts +12 -1
  43. package/dist/journal.d.ts.map +1 -1
  44. package/dist/journal.js +103 -6
  45. package/dist/journal.js.map +1 -1
  46. package/dist/s3.d.ts +62 -0
  47. package/dist/s3.d.ts.map +1 -1
  48. package/dist/s3.js +91 -1
  49. package/dist/s3.js.map +1 -1
  50. package/dist/s3.rename-retry.test.d.ts +2 -0
  51. package/dist/s3.rename-retry.test.d.ts.map +1 -0
  52. package/dist/s3.rename-retry.test.js +153 -0
  53. package/dist/s3.rename-retry.test.js.map +1 -0
  54. package/dist/sync/area-ledger-migration.d.ts +116 -0
  55. package/dist/sync/area-ledger-migration.d.ts.map +1 -0
  56. package/dist/sync/area-ledger-migration.js +505 -0
  57. package/dist/sync/area-ledger-migration.js.map +1 -0
  58. package/dist/sync/area-ledger-migration.test.d.ts +2 -0
  59. package/dist/sync/area-ledger-migration.test.d.ts.map +1 -0
  60. package/dist/sync/area-ledger-migration.test.js +274 -0
  61. package/dist/sync/area-ledger-migration.test.js.map +1 -0
  62. package/dist/sync/feature-flags.d.ts +9 -0
  63. package/dist/sync/feature-flags.d.ts.map +1 -1
  64. package/dist/sync/feature-flags.js +19 -0
  65. package/dist/sync/feature-flags.js.map +1 -1
  66. package/dist/sync/feature-flags.test.js +11 -1
  67. package/dist/sync/feature-flags.test.js.map +1 -1
  68. package/dist/sync/index.d.ts +2 -0
  69. package/dist/sync/index.d.ts.map +1 -1
  70. package/dist/sync/index.js +1 -0
  71. package/dist/sync/index.js.map +1 -1
  72. package/dist/sync/parallel-sync-coordinator.d.ts.map +1 -1
  73. package/dist/sync/parallel-sync-coordinator.js +19 -4
  74. package/dist/sync/parallel-sync-coordinator.js.map +1 -1
  75. package/dist/sync/parallel-sync-coordinator.test.js +59 -0
  76. package/dist/sync/parallel-sync-coordinator.test.js.map +1 -1
  77. package/dist/sync/reconcile-cursor.d.ts +97 -0
  78. package/dist/sync/reconcile-cursor.d.ts.map +1 -0
  79. package/dist/sync/reconcile-cursor.js +215 -0
  80. package/dist/sync/reconcile-cursor.js.map +1 -0
  81. package/dist/sync/reconcile-cursor.test.d.ts +2 -0
  82. package/dist/sync/reconcile-cursor.test.d.ts.map +1 -0
  83. package/dist/sync/reconcile-cursor.test.js +139 -0
  84. package/dist/sync/reconcile-cursor.test.js.map +1 -0
  85. package/dist/sync/state-store.d.ts +37 -0
  86. package/dist/sync/state-store.d.ts.map +1 -1
  87. package/dist/sync/state-store.js +109 -1
  88. package/dist/sync/state-store.js.map +1 -1
  89. package/dist/sync/sync-work.d.ts +2 -1
  90. package/dist/sync/sync-work.d.ts.map +1 -1
  91. package/dist/sync/sync-work.js.map +1 -1
  92. package/dist/types.d.ts +6 -0
  93. package/dist/types.d.ts.map +1 -1
  94. package/dist/vault-client.d.ts +9 -2
  95. package/dist/vault-client.d.ts.map +1 -1
  96. package/dist/vault-client.js +3 -2
  97. package/dist/vault-client.js.map +1 -1
  98. package/dist/vault-client.test.js +26 -0
  99. package/dist/vault-client.test.js.map +1 -1
  100. package/package.json +3 -2
@@ -14,6 +14,7 @@ import { type CompanyTombstone } from "./tombstones.js";
14
14
  import { MutationClient, type MutationStatus } from "../sync/mutation-client.js";
15
15
  import { DurableApplyEngine, type DurableApplyContent } from "../sync/durable-apply.js";
16
16
  import type { DeltaPage, DeltaRecord } from "../sync/delta-client.js";
17
+ import { type ReconcileApplyCheckpoint } from "../sync/reconcile-cursor.js";
17
18
  /** The desktop sidecar invokes exactly `hq-cloud sync mutation --stdin-json`. */
18
19
  export declare const SYNC_MUTATION_STDIN_COMMAND: readonly ["sync", "mutation", "--stdin-json"];
19
20
  /**
@@ -481,6 +482,29 @@ export type SyncProgressEvent = {
481
482
  target: string;
482
483
  /** Fixed remediation text (enable Developer Mode / run once elevated). */
483
484
  remedy: string;
485
+ } | {
486
+ /**
487
+ * Emitted by the PULL leg (download install OR conflict-keep preserve)
488
+ * once per object whose Windows rename was refused by a transient sharing
489
+ * violation (EPERM/EBUSY). The refusal surfaces immediately on the first
490
+ * attempt (no retry, no synchronous backoff — see
491
+ * renameOrRaiseWindowsBlocked); recovery is the next sync pass, once the
492
+ * file is released. Like `skip-symlink-privilege` this is deliberately NOT
493
+ * `type: "error"` (policy hq-sync-deliberate-skip-not-fatal-error-exit2):
494
+ * a per-object refusal counted as an error lands in the runner's
495
+ * `errors[]`, forces PARTIAL_SYNC_EXIT (2), and the desktop menubar
496
+ * Sentry-alerts `[sync] hq-sync-runner exited with code 2` every pass
497
+ * (Sentry HQ-DESKTOP-54, second path). The downloaded bytes are intact in
498
+ * the staged temp and the operator's local body is untouched, so no
499
+ * content is lost; the object is left UNJOURNALED (and a skipped conflict
500
+ * leaves its journal entry untouched with `localDiverges` NOT armed) so a
501
+ * later pass, once the file is released, converges without any manual
502
+ * reset. `remedy` is a fixed, content-free instruction for the user.
503
+ */
504
+ type: "skip-rename-blocked";
505
+ path: string;
506
+ /** Fixed remediation text (a program is holding the file open). */
507
+ remedy: string;
484
508
  };
485
509
  export interface SyncOptions {
486
510
  /** Company slug or UID (defaults to active company from config) */
@@ -672,6 +696,12 @@ export interface SyncOptions {
672
696
  * per-root operation lock for this sync pass.
673
697
  */
674
698
  operationLockAlreadyHeld?: boolean;
699
+ /**
700
+ * Opt-in bounded reconcile apply checkpoint. Callers pair this with exact
701
+ * `pullPrefixes`; the cursor advances only after this leg persists its
702
+ * journal outcomes.
703
+ */
704
+ reconcileApply?: ReconcileApplyCheckpoint;
675
705
  }
676
706
  export interface SyncResult {
677
707
  filesDownloaded: number;
@@ -1 +1 @@
1
- {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":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AoBT"}
package/dist/cli/sync.js CHANGED
@@ -14,7 +14,7 @@ import { resolveEntityContext, isExpiringSoon, refreshEntityContext } from "../c
14
14
  import { createSyncProgressRecorder } from "../sync-progress.js";
15
15
  import { canonicalVaultKeySpelling, localPathForVaultKey, vaultKeyForLocalPath, } from "../local-path-codec.js";
16
16
  import { SKILLS_KEY_PREFIX } from "./doctor.js";
17
- import { downloadFile, listRemoteFiles, headRemoteFile, primeObjectTransport, toPosixKey, classifyVaultKey, DanglingSymlinkParentError, WindowsSymlinkPrivilegeError, WINDOWS_SYMLINK_PRIVILEGE_REMEDY, } from "../s3.js";
17
+ import { downloadFile, listRemoteFiles, headRemoteFile, primeObjectTransport, toPosixKey, classifyVaultKey, DanglingSymlinkParentError, WindowsSymlinkPrivilegeError, WINDOWS_SYMLINK_PRIVILEGE_REMEDY, WindowsRenameBlockedError, WINDOWS_RENAME_BLOCKED_REMEDY, renameOrRaiseWindowsBlocked, } from "../s3.js";
18
18
  import { readJournal, writeJournal, openJournalStoreSession, hashFile, hashSymlinkTarget, updateEntry, removeEntry, getEntry, normalizeEtag, migrateToV2, gcTombstones, isTombstone, tombstoneEntry, lastPullRecord, appendPullRecord, generatePullId, PERSONAL_VAULT_JOURNAL_SLUG, migratePersonalVaultJournal, } from "../journal.js";
19
19
  import { isGeneratedCoreMirrorKey, PERSONAL_VAULT_MANIFEST_KEY, } from "../personal-vault.js";
20
20
  import { isPersonalVaultExcluded } from "../personal-vault-exclusions.js";
@@ -32,6 +32,7 @@ import { reindex } from "./reindex.js";
32
32
  import { withOperationLock } from "../operation-lock.js";
33
33
  import { fetchFileTombstones, } from "./tombstones.js";
34
34
  import { MutationClient, } from "../sync/mutation-client.js";
35
+ import { checkpointReconcileApply } from "../sync/reconcile-cursor.js";
35
36
  /** The desktop sidecar invokes exactly `hq-cloud sync mutation --stdin-json`. */
36
37
  export const SYNC_MUTATION_STDIN_COMMAND = ["sync", "mutation", "--stdin-json"];
37
38
  /**
@@ -589,6 +590,7 @@ function createPullCounters() {
589
590
  filesOutOfScope: 0,
590
591
  conflictPaths: [],
591
592
  changedPaths: [],
593
+ hasRetryableOutcome: false,
592
594
  };
593
595
  }
594
596
  function planScopeShrink(run) {
@@ -772,7 +774,7 @@ function executeFileTombstoneDelete(run, item, counters) {
772
774
  run.emit({
773
775
  type: "error",
774
776
  path: tombstoneKey,
775
- message: `tombstone-suppress unlink failed: ${err instanceof Error ? err.message : String(err)}`,
777
+ message: `tombstone-suppress unlink failed: ${describeError(err)}`,
776
778
  });
777
779
  return;
778
780
  }
@@ -878,10 +880,29 @@ async function executeConflictItem(run, plan, scopeRun, counters, downloadItems,
878
880
  });
879
881
  return null;
880
882
  }
883
+ if (probeErr instanceof WindowsRenameBlockedError) {
884
+ // Same deliberate skip as downloadOne: the remote body could not be
885
+ // materialized to the conflict mirror because a program is holding the
886
+ // destination open. Skip it (never type:"error") so the company stays
887
+ // complete and the runner exits 0, and leave it unjournaled so a later
888
+ // pass converges once the file is released (Sentry HQ-DESKTOP-54).
889
+ counters.filesSkipped++;
890
+ run.emit({
891
+ type: "skip-rename-blocked",
892
+ path: remoteFile.key,
893
+ remedy: WINDOWS_RENAME_BLOCKED_REMEDY,
894
+ });
895
+ return null;
896
+ }
881
897
  run.emit({
882
898
  type: "error",
883
899
  path: remoteFile.key,
884
- message: `conflict convergence probe failed: ${probeErr instanceof Error ? probeErr.message : String(probeErr)}`,
900
+ // describeError surfaces the error name and any code=/cause=/syscall=
901
+ // tokens the desktop's cause axis parses, so a future recurrence carries
902
+ // an attributable identity instead of `cause: unknown` (HQ-DESKTOP-54
903
+ // instrumentation). The literal prefix is unchanged so the desktop's
904
+ // fixed shape vocabulary keeps matching.
905
+ message: `conflict convergence probe failed: ${describeError(probeErr)}`,
885
906
  });
886
907
  }
887
908
  if (converged) {
@@ -955,7 +976,7 @@ async function executeConflictItem(run, plan, scopeRun, counters, downloadItems,
955
976
  run.emit({
956
977
  type: "error",
957
978
  path: remoteFile.key,
958
- message: `conflict mirror index write failed: ${mirrorErr instanceof Error ? mirrorErr.message : String(mirrorErr)}`,
979
+ message: `conflict mirror index write failed: ${describeError(mirrorErr)}`,
959
980
  });
960
981
  }
961
982
  }
@@ -1044,14 +1065,37 @@ async function executeConflictItem(run, plan, scopeRun, counters, downloadItems,
1044
1065
  // tested download path —
1045
1066
  // symlink materialization, path codec, mtime and etag journalling —
1046
1067
  // instead of a hand-rolled three-way swap with its own crash window.
1068
+ //
1069
+ // A transient Windows sharing violation on the preserve rename surfaces as
1070
+ // WindowsRenameBlockedError (renameOrRaiseWindowsBlocked); the sidecar
1071
+ // itself is a freshly-minted conflict path, so a plain rmSync is enough.
1047
1072
  fs.rmSync(conflictAbs, { force: true });
1048
- fs.renameSync(localPath, conflictAbs);
1073
+ renameOrRaiseWindowsBlocked(localPath, conflictAbs);
1049
1074
  }
1050
1075
  catch (preserveErr) {
1076
+ if (preserveErr instanceof WindowsRenameBlockedError) {
1077
+ // A program is holding the local file open, so it could not be moved
1078
+ // aside. Downgrade to a deliberate skip and return WITHOUT holdLocal():
1079
+ // the journal entry is left untouched (no remoteEtag stamp, no
1080
+ // `localDiverges` arming), so the conflict simply re-fires next pass
1081
+ // instead of stranding the operator's elected file as divergent (never
1082
+ // type:"error"; company stays complete and the one-shot runner exits 0
1083
+ // — Sentry HQ-DESKTOP-54, second path).
1084
+ counters.filesSkipped++;
1085
+ run.emit({
1086
+ type: "skip-rename-blocked",
1087
+ path: remoteFile.key,
1088
+ remedy: WINDOWS_RENAME_BLOCKED_REMEDY,
1089
+ });
1090
+ return null;
1091
+ }
1051
1092
  run.emit({
1052
1093
  type: "error",
1053
1094
  path: remoteFile.key,
1054
- message: `conflict keep could not preserve the local copy: ${preserveErr instanceof Error ? preserveErr.message : String(preserveErr)}`,
1095
+ // describeError carries the error name / code= / syscall= tokens for a
1096
+ // non-downgradable failure (e.g. EACCES) so the next occurrence is
1097
+ // attributable; the literal prefix is unchanged (HQ-DESKTOP-54).
1098
+ message: `conflict keep could not preserve the local copy: ${describeError(preserveErr)}`,
1055
1099
  });
1056
1100
  return holdLocal();
1057
1101
  }
@@ -1136,6 +1180,7 @@ async function downloadOne(run, downloadItem, counters) {
1136
1180
  await refreshRunContextIfExpiring(run);
1137
1181
  if (!isDownloadWritePathStillContained(run.companyRoot, remoteFile.key, localPath)) {
1138
1182
  counters.filesSkipped++;
1183
+ counters.hasRetryableOutcome = true;
1139
1184
  run.emit({
1140
1185
  type: "error",
1141
1186
  path: remoteFile.key,
@@ -1203,6 +1248,7 @@ async function downloadOne(run, downloadItem, counters) {
1203
1248
  catch (err) {
1204
1249
  if (err instanceof VaultAuthError)
1205
1250
  throw err;
1251
+ counters.hasRetryableOutcome = true;
1206
1252
  if (err instanceof LocalSnapshotChangedError) {
1207
1253
  reportLocalSnapshotConflict(run, counters, remoteFile.key);
1208
1254
  }
@@ -1227,6 +1273,26 @@ async function downloadOne(run, downloadItem, counters) {
1227
1273
  remedy: WINDOWS_SYMLINK_PRIVILEGE_REMEDY,
1228
1274
  });
1229
1275
  }
1276
+ else if (err instanceof WindowsRenameBlockedError) {
1277
+ // Transient Windows rename refusal (a program holding the file open),
1278
+ // surfaced immediately on the first attempt (no retry) — a per-object,
1279
+ // machine-local condition, NOT a transfer failure. The downloaded bytes
1280
+ // are intact in
1281
+ // the staged temp and the local body is untouched. Downgrade to a
1282
+ // deliberate skip (never type:"error") so the company settles `complete`
1283
+ // and the one-shot runner exits 0 instead of PARTIAL_SYNC_EXIT (Sentry
1284
+ // HQ-DESKTOP-54, second path; policy
1285
+ // hq-sync-deliberate-skip-not-fatal-error-exit2). Deliberately does NOT
1286
+ // journal the key: the success path below (updateEntry) never runs, so a
1287
+ // later pass, once the file is released, materializes and journals it —
1288
+ // convergence with no manual reset.
1289
+ counters.filesSkipped++;
1290
+ run.emit({
1291
+ type: "skip-rename-blocked",
1292
+ path: remoteFile.key,
1293
+ remedy: WINDOWS_RENAME_BLOCKED_REMEDY,
1294
+ });
1295
+ }
1230
1296
  else if (err instanceof DanglingSymlinkParentError) {
1231
1297
  // Per-object condition, not a company failure. The pre-flight
1232
1298
  // containment check can miss this: it runs before the download, and a
@@ -1353,7 +1419,7 @@ async function verifyPlannedJournalTombstones(run, plan) {
1353
1419
  run.emit({
1354
1420
  type: "error",
1355
1421
  path: tombstone.key,
1356
- message: `tombstone HEAD verify failed (deferring): ${err instanceof Error ? err.message : String(err)}`,
1422
+ message: `tombstone HEAD verify failed (deferring): ${describeError(err)}`,
1357
1423
  });
1358
1424
  return null;
1359
1425
  }
@@ -1453,7 +1519,7 @@ function finalizePullRun(run, plan, scopeRun, counters) {
1453
1519
  // best-effort: a post-sync refresh failure never fails the sync
1454
1520
  }
1455
1521
  }
1456
- return {
1522
+ const result = {
1457
1523
  filesDownloaded: counters.filesDownloaded,
1458
1524
  bytesDownloaded: counters.bytesDownloaded,
1459
1525
  filesSkipped: counters.filesSkipped,
@@ -1469,6 +1535,12 @@ function finalizePullRun(run, plan, scopeRun, counters) {
1469
1535
  scopeOrphansBlocked: scopeRun.shrinkResult.dirtyTombstoned,
1470
1536
  changedPaths: [...counters.changedPaths, ...scopeRun.changedPaths],
1471
1537
  };
1538
+ // Do not advance a bounded reconcile past an unjournaled download. A retry
1539
+ // replays successful work at most, while retaining every failed candidate.
1540
+ if (!counters.hasRetryableOutcome) {
1541
+ checkpointReconcileApply(run.options.reconcileApply, result.changedPaths ?? []);
1542
+ }
1543
+ return result;
1472
1544
  }
1473
1545
  /**
1474
1546
  * Surface the shared-vs-all materialization gap (feedback_d2082110). When a
@@ -2734,6 +2806,9 @@ function defaultConsoleLogger(event) {
2734
2806
  else if (event.type === "skip-symlink-privilege") {
2735
2807
  console.warn(` ! ${event.path} skipped — could not create the symbolic link on this Windows host (missing privilege). ${event.remedy}`);
2736
2808
  }
2809
+ else if (event.type === "skip-rename-blocked") {
2810
+ console.warn(` ! ${event.path} skipped — another program on this PC is holding the file open, so HQ could not replace it yet. ${event.remedy}`);
2811
+ }
2737
2812
  else if (event.type === "not-shipped") {
2738
2813
  if (event.reason === "unreachable-path") {
2739
2814
  console.warn(` ! ${event.count} named path${event.count === 1 ? "" : "s"} could NOT be pushed — the file exists but is not reachable under the company folder (nothing was uploaded for ${event.count === 1 ? "it" : "them"}):`);