@ricsam/r5d-worker 0.0.131 → 0.0.133

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 (47) hide show
  1. package/dist/cjs/atomic-rename.cjs +303 -0
  2. package/dist/cjs/git-blob-hash.cjs +41 -0
  3. package/dist/cjs/main.cjs +187 -38
  4. package/dist/cjs/package.json +1 -1
  5. package/dist/cjs/three-way-merge.cjs +346 -0
  6. package/dist/cjs/working-tree-mirror.cjs +1049 -64
  7. package/dist/cjs/workspace-command-sync-policy.cjs +8 -4
  8. package/dist/cjs/workspace-command-targets.cjs +63 -0
  9. package/dist/cjs/workspace-filesystem-job-types.cjs +11 -1
  10. package/dist/cjs/workspace-filesystem-jobs.cjs +2 -0
  11. package/dist/cjs/workspace-git-sync.cjs +846 -61
  12. package/dist/cjs/workspace-hydration-ledger.cjs +66 -0
  13. package/dist/cjs/workspace-hydration-merge.cjs +433 -0
  14. package/dist/cjs/workspace-hydration-recovery-state.cjs +53 -0
  15. package/dist/cjs/workspace-merge-projection.cjs +81 -10
  16. package/dist/cjs/workspace-project-config-policy.cjs +19 -12
  17. package/dist/mjs/atomic-rename.mjs +261 -0
  18. package/dist/mjs/git-blob-hash.mjs +16 -0
  19. package/dist/mjs/main.mjs +196 -39
  20. package/dist/mjs/package.json +1 -1
  21. package/dist/mjs/three-way-merge.mjs +318 -0
  22. package/dist/mjs/working-tree-mirror.mjs +1035 -64
  23. package/dist/mjs/workspace-command-sync-policy.mjs +8 -4
  24. package/dist/mjs/workspace-command-targets.mjs +37 -0
  25. package/dist/mjs/workspace-filesystem-job-types.mjs +11 -1
  26. package/dist/mjs/workspace-filesystem-jobs.mjs +4 -0
  27. package/dist/mjs/workspace-git-sync.mjs +854 -62
  28. package/dist/mjs/workspace-hydration-ledger.mjs +42 -0
  29. package/dist/mjs/workspace-hydration-merge.mjs +399 -0
  30. package/dist/mjs/workspace-hydration-recovery-state.mjs +29 -0
  31. package/dist/mjs/workspace-merge-projection.mjs +85 -11
  32. package/dist/mjs/workspace-project-config-policy.mjs +16 -10
  33. package/dist/types/atomic-rename.d.ts +78 -0
  34. package/dist/types/git-blob-hash.d.ts +10 -0
  35. package/dist/types/main.d.ts +21 -2
  36. package/dist/types/three-way-merge.d.ts +77 -0
  37. package/dist/types/working-tree-mirror.d.ts +270 -7
  38. package/dist/types/workspace-command-sync-policy.d.ts +12 -6
  39. package/dist/types/workspace-command-targets.d.ts +37 -0
  40. package/dist/types/workspace-filesystem-job-types.d.ts +46 -4
  41. package/dist/types/workspace-git-sync.d.ts +125 -3
  42. package/dist/types/workspace-hydration-ledger.d.ts +43 -0
  43. package/dist/types/workspace-hydration-merge.d.ts +95 -0
  44. package/dist/types/workspace-hydration-recovery-state.d.ts +10 -0
  45. package/dist/types/workspace-merge-projection.d.ts +19 -1
  46. package/dist/types/workspace-project-config-policy.d.ts +17 -3
  47. package/package.json +2 -2
@@ -26,18 +26,22 @@ __export(workspace_command_sync_policy_exports, {
26
26
  });
27
27
  module.exports = __toCommonJS(workspace_command_sync_policy_exports);
28
28
  var import_workspace_mount_hold_fence = require("./workspace-mount-hold-fence.cjs");
29
- function requiresCurrentSyncBarrier(target) {
30
- return target.type === "workspace" && target.rootProfile === "visible_projects";
29
+ function requiresCurrentSyncBarrier(targets) {
30
+ return targets.some((target) => target.type === "workspace" && target.rootProfile === "visible_projects");
31
+ }
32
+ function asTargetList(target) {
33
+ return Array.isArray(target) ? target : [target];
31
34
  }
32
35
  async function reserveWorkspaceCommandAfterCurrentSync(target, coordinator, reserve, options = {}) {
36
+ const targets = asTargetList(target);
33
37
  while (true) {
34
- if (requiresCurrentSyncBarrier(target)) {
38
+ if (requiresCurrentSyncBarrier(targets)) {
35
39
  const currentSync = coordinator.afterCurrent();
36
40
  await raceWithAbort(currentSync, options.signal);
37
41
  if (currentSync !== coordinator.afterCurrent()) continue;
38
42
  }
39
43
  if (options.signal?.aborted) throw new import_workspace_mount_hold_fence.WorkspaceMountHoldAbortedError(abortReason(options.signal));
40
- const hold = coordinator.mountHold(target, options.signal);
44
+ const hold = coordinator.mountHold(targets, options.signal);
41
45
  if (hold) {
42
46
  await hold;
43
47
  continue;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var workspace_command_targets_exports = {};
20
+ __export(workspace_command_targets_exports, {
21
+ commandTargets: () => commandTargets,
22
+ describeCommandAdditionalTargets: () => describeCommandAdditionalTargets,
23
+ normalizeCommandAdditionalTargets: () => normalizeCommandAdditionalTargets
24
+ });
25
+ module.exports = __toCommonJS(workspace_command_targets_exports);
26
+ function targetKey(target) {
27
+ return `${target.projectId}\0${target.branchName}`;
28
+ }
29
+ function normalizeCommandAdditionalTargets(primary, additional, validators) {
30
+ if (additional === void 0 || additional === null) return [];
31
+ if (!Array.isArray(additional)) throw new Error("Command additional targets must be a list of project branches");
32
+ const seen = new Set(primary.type === "project" ? [targetKey(primary)] : []);
33
+ const normalized = [];
34
+ for (const entry of additional) {
35
+ if (!entry || typeof entry !== "object" || entry.type !== "project") {
36
+ throw new Error("Command additional targets must be project branches");
37
+ }
38
+ const { projectId, branchName } = entry;
39
+ if (typeof projectId !== "string" || typeof branchName !== "string")
40
+ throw new Error("Command additional target is missing its project or branch");
41
+ validators.validateProjectId(projectId);
42
+ validators.validateBranchName(branchName);
43
+ const target = { type: "project", projectId, branchName };
44
+ const key = targetKey(target);
45
+ if (seen.has(key)) continue;
46
+ seen.add(key);
47
+ normalized.push(target);
48
+ }
49
+ return normalized;
50
+ }
51
+ function commandTargets(primary, additional) {
52
+ return [primary, ...additional];
53
+ }
54
+ function describeCommandAdditionalTargets(additional) {
55
+ if (additional.length === 0) return "";
56
+ return ` (also fencing ${additional.map((target) => `${target.projectId}/${target.branchName}`).join(", ")})`;
57
+ }
58
+ // Annotate the CommonJS export names for ESM import in node:
59
+ 0 && (module.exports = {
60
+ commandTargets,
61
+ describeCommandAdditionalTargets,
62
+ normalizeCommandAdditionalTargets
63
+ });
@@ -28,6 +28,8 @@ module.exports = __toCommonJS(workspace_filesystem_job_types_exports);
28
28
  const WORKSPACE_FILESYSTEM_JOB_KINDS = [
29
29
  "checkout_durability_recovery",
30
30
  "hydration_recovery",
31
+ "hydration_recovery_inspect",
32
+ "hydration_preserve_interrupted",
31
33
  "hydration_transaction",
32
34
  "hydration_raw",
33
35
  "checkout_transition_begin",
@@ -57,13 +59,19 @@ function describeWorkspaceFilesystemJob(kind, input) {
57
59
  switch (kind) {
58
60
  case "checkout_durability_recovery":
59
61
  case "hydration_recovery":
62
+ case "hydration_recovery_inspect":
60
63
  case "checkout_transition_begin":
61
64
  case "checkout_transition_complete":
62
65
  case "outer_checkout_fsync":
63
66
  return `${kind.replaceAll("_", " ")} of ${input.workspacePath}`;
67
+ case "hydration_preserve_interrupted": {
68
+ const recovery = input;
69
+ return `preservation of hydration transaction ${recovery.expectedTransactionId} in ${recovery.workspacePath}`;
70
+ }
64
71
  case "hydration_transaction": {
65
72
  const hydration = input;
66
- return `hydration of ${summarizeIds(hydration.hydrationMounts.map(({ id }) => id))} (durability ${summarizeIds(hydration.advancedDurabilityMounts.map(({ id }) => id))})`;
73
+ const merged = Object.keys(hydration.mergeBases ?? {}).length;
74
+ return `hydration of ${summarizeIds(hydration.hydrationMounts.map(({ id }) => id))}${merged > 0 ? ` (${merged} merge-hydrated)` : ""} (durability ${summarizeIds(hydration.advancedDurabilityMounts.map(({ id }) => id))})`;
67
75
  }
68
76
  case "hydration_raw":
69
77
  return `pre-clone hydration of ${summarizeIds(input.mounts.map(({ id }) => id))}`;
@@ -104,6 +112,7 @@ function serializeWorkspaceFilesystemError(error, depth = 0) {
104
112
  if (typeof error.stack === "string") serialized.stack = error.stack;
105
113
  if (typeof record.code === "string") serialized.code = record.code;
106
114
  if (record.branchMayExist === true) serialized.branchMayExist = true;
115
+ if (record.hydrationRecovery) serialized.hydrationRecovery = structuredClone(record.hydrationRecovery);
107
116
  if (Array.isArray(record.cleanupFailures) && record.cleanupFailures.every((failure) => typeof failure === "string")) {
108
117
  serialized.cleanupFailures = [...record.cleanupFailures];
109
118
  }
@@ -122,6 +131,7 @@ function restoreWorkspaceFilesystemError(serialized) {
122
131
  if (serialized.code !== void 0) error.code = serialized.code;
123
132
  if (serialized.branchMayExist) error.branchMayExist = true;
124
133
  if (serialized.cleanupFailures) error.cleanupFailures = [...serialized.cleanupFailures];
134
+ if (serialized.hydrationRecovery) error.hydrationRecovery = structuredClone(serialized.hydrationRecovery);
125
135
  return error;
126
136
  }
127
137
  // Annotate the CommonJS export names for ESM import in node:
@@ -28,6 +28,8 @@ var import_workspace_path_move = require("./workspace-path-move.cjs");
28
28
  const workspaceFilesystemJobOperations = {
29
29
  checkout_durability_recovery: (input) => (0, import_workspace_git_sync.runCheckoutDurabilityRecoveryJob)(input),
30
30
  hydration_recovery: (input) => (0, import_workspace_git_sync.runHydrationRecoveryJob)(input),
31
+ hydration_recovery_inspect: (input) => (0, import_workspace_git_sync.runHydrationRecoveryInspectJob)(input),
32
+ hydration_preserve_interrupted: (input) => (0, import_workspace_git_sync.runHydrationPreserveInterruptedJob)(input),
31
33
  hydration_transaction: (input) => (0, import_workspace_git_sync.runHydrationTransactionJob)(input),
32
34
  hydration_raw: (input) => (0, import_workspace_git_sync.runHydrationRawJob)(input),
33
35
  checkout_transition_begin: (input) => (0, import_workspace_git_sync.runCheckoutTransitionBeginJob)(input),