@claudexor/workspace 4.8.1 → 5.0.1

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 (136) hide show
  1. package/dist/anchor-store.d.ts +20 -9
  2. package/dist/anchor-store.d.ts.map +1 -1
  3. package/dist/anchor-store.js +96 -16
  4. package/dist/anchor-store.js.map +1 -1
  5. package/dist/capture-failure.d.ts.map +1 -1
  6. package/dist/capture-failure.js +7 -2
  7. package/dist/capture-failure.js.map +1 -1
  8. package/dist/capture-inventory.d.ts +10 -0
  9. package/dist/capture-inventory.d.ts.map +1 -0
  10. package/dist/capture-inventory.js +63 -0
  11. package/dist/capture-inventory.js.map +1 -0
  12. package/dist/capture-objects.d.ts +32 -0
  13. package/dist/capture-objects.d.ts.map +1 -0
  14. package/dist/capture-objects.js +129 -0
  15. package/dist/capture-objects.js.map +1 -0
  16. package/dist/cleanup-fault.d.ts +18 -0
  17. package/dist/cleanup-fault.d.ts.map +1 -0
  18. package/dist/cleanup-fault.js +45 -0
  19. package/dist/cleanup-fault.js.map +1 -0
  20. package/dist/continuation-evidence.d.ts +61 -15
  21. package/dist/continuation-evidence.d.ts.map +1 -1
  22. package/dist/continuation-evidence.js +151 -36
  23. package/dist/continuation-evidence.js.map +1 -1
  24. package/dist/continuation-facts.d.ts +93 -0
  25. package/dist/continuation-facts.d.ts.map +1 -0
  26. package/dist/continuation-facts.js +162 -0
  27. package/dist/continuation-facts.js.map +1 -0
  28. package/dist/directory-workspace.d.ts.map +1 -1
  29. package/dist/directory-workspace.js +1 -3
  30. package/dist/directory-workspace.js.map +1 -1
  31. package/dist/files-io.d.ts.map +1 -1
  32. package/dist/files-io.js +1 -7
  33. package/dist/files-io.js.map +1 -1
  34. package/dist/fs-presence.d.ts +12 -0
  35. package/dist/fs-presence.d.ts.map +1 -0
  36. package/dist/fs-presence.js +35 -0
  37. package/dist/fs-presence.js.map +1 -0
  38. package/dist/git-nested-repositories.d.ts.map +1 -1
  39. package/dist/git-nested-repositories.js +11 -2
  40. package/dist/git-nested-repositories.js.map +1 -1
  41. package/dist/git-observed.d.ts +75 -0
  42. package/dist/git-observed.d.ts.map +1 -0
  43. package/dist/git-observed.js +172 -0
  44. package/dist/git-observed.js.map +1 -0
  45. package/dist/git-result.d.ts +36 -0
  46. package/dist/git-result.d.ts.map +1 -0
  47. package/dist/git-result.js +96 -0
  48. package/dist/git-result.js.map +1 -0
  49. package/dist/git-run.d.ts +11 -0
  50. package/dist/git-run.d.ts.map +1 -1
  51. package/dist/git-run.js +24 -0
  52. package/dist/git-run.js.map +1 -1
  53. package/dist/git-snapshot.d.ts +40 -0
  54. package/dist/git-snapshot.d.ts.map +1 -0
  55. package/dist/git-snapshot.js +238 -0
  56. package/dist/git-snapshot.js.map +1 -0
  57. package/dist/git-transient-capture.d.ts +63 -16
  58. package/dist/git-transient-capture.d.ts.map +1 -1
  59. package/dist/git-transient-capture.js +170 -57
  60. package/dist/git-transient-capture.js.map +1 -1
  61. package/dist/git.d.ts +46 -21
  62. package/dist/git.d.ts.map +1 -1
  63. package/dist/git.js +164 -103
  64. package/dist/git.js.map +1 -1
  65. package/dist/index.d.ts +9 -1
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +9 -1
  68. package/dist/index.js.map +1 -1
  69. package/dist/lanes.d.ts +2 -1
  70. package/dist/lanes.d.ts.map +1 -1
  71. package/dist/lanes.js +7 -6
  72. package/dist/lanes.js.map +1 -1
  73. package/dist/manager.d.ts +21 -7
  74. package/dist/manager.d.ts.map +1 -1
  75. package/dist/manager.js +30 -17
  76. package/dist/manager.js.map +1 -1
  77. package/dist/object-compose.d.ts +58 -0
  78. package/dist/object-compose.d.ts.map +1 -0
  79. package/dist/object-compose.js +444 -0
  80. package/dist/object-compose.js.map +1 -0
  81. package/dist/object-materialize.d.ts +52 -0
  82. package/dist/object-materialize.d.ts.map +1 -0
  83. package/dist/object-materialize.js +467 -0
  84. package/dist/object-materialize.js.map +1 -0
  85. package/dist/object-occupied.d.ts +27 -0
  86. package/dist/object-occupied.d.ts.map +1 -0
  87. package/dist/object-occupied.js +131 -0
  88. package/dist/object-occupied.js.map +1 -0
  89. package/dist/object-revert.d.ts +45 -0
  90. package/dist/object-revert.d.ts.map +1 -0
  91. package/dist/object-revert.js +265 -0
  92. package/dist/object-revert.js.map +1 -0
  93. package/dist/object-saved-files.d.ts +50 -0
  94. package/dist/object-saved-files.d.ts.map +1 -0
  95. package/dist/object-saved-files.js +176 -0
  96. package/dist/object-saved-files.js.map +1 -0
  97. package/dist/object-sparse.d.ts +22 -0
  98. package/dist/object-sparse.d.ts.map +1 -0
  99. package/dist/object-sparse.js +72 -0
  100. package/dist/object-sparse.js.map +1 -0
  101. package/dist/object-store-leases.d.ts +41 -0
  102. package/dist/object-store-leases.d.ts.map +1 -0
  103. package/dist/object-store-leases.js +277 -0
  104. package/dist/object-store-leases.js.map +1 -0
  105. package/dist/object-store-roots.d.ts +25 -0
  106. package/dist/object-store-roots.d.ts.map +1 -0
  107. package/dist/object-store-roots.js +114 -0
  108. package/dist/object-store-roots.js.map +1 -0
  109. package/dist/object-store.d.ts +110 -0
  110. package/dist/object-store.d.ts.map +1 -0
  111. package/dist/object-store.js +404 -0
  112. package/dist/object-store.js.map +1 -0
  113. package/dist/object-transfer.d.ts +41 -0
  114. package/dist/object-transfer.d.ts.map +1 -0
  115. package/dist/object-transfer.js +267 -0
  116. package/dist/object-transfer.js.map +1 -0
  117. package/dist/plain-diff-capture.d.ts +1 -2
  118. package/dist/plain-diff-capture.d.ts.map +1 -1
  119. package/dist/plain-diff-capture.js +2 -7
  120. package/dist/plain-diff-capture.js.map +1 -1
  121. package/dist/plain-diff.d.ts +0 -4
  122. package/dist/plain-diff.d.ts.map +1 -1
  123. package/dist/plain-diff.js +2 -44
  124. package/dist/plain-diff.js.map +1 -1
  125. package/dist/raw-patch.d.ts.map +1 -1
  126. package/dist/raw-patch.js +5 -8
  127. package/dist/raw-patch.js.map +1 -1
  128. package/dist/run-expiry.d.ts +3 -0
  129. package/dist/run-expiry.d.ts.map +1 -0
  130. package/dist/run-expiry.js +15 -0
  131. package/dist/run-expiry.js.map +1 -0
  132. package/dist/thread-tree.d.ts +36 -2
  133. package/dist/thread-tree.d.ts.map +1 -1
  134. package/dist/thread-tree.js +87 -11
  135. package/dist/thread-tree.js.map +1 -1
  136. package/package.json +5 -5
@@ -1,10 +1,21 @@
1
- /** Persist a binary/mode-aware turn patch outside Git before its dangling
2
- * snapshot commits can be collected. The patch digest is the immutable ID. */
3
- export declare function createRevertAnchor(repo: string, preTurnSha: string, postTurnSha: string): Promise<string>;
1
+ import { GitDeliveryPair } from "@claudexor/schema";
2
+ /**
3
+ * Anchor the actual pair (T, M) for revert. Its objects enter the project store
4
+ * owned by the anchor file itself, so they live exactly as long as the anchor
5
+ * (retention prunes anchors by the runs that name them). `repo` is where Git
6
+ * reads the pair; `projectRoot` is the project that keeps it, where retention
7
+ * finds it (a delegated run's or an isolated thread's project).
8
+ */
9
+ export declare function createPairRevertAnchor(repo: string, pair: GitDeliveryPair, projectRoot?: string): Promise<string>;
10
+ export declare function createPairRevertAnchorOrNull(repo: string, pair: GitDeliveryPair | null | undefined, projectRoot?: string): Promise<string | null>;
11
+ /** The recorded pair of an object anchor; null for a legacy patch anchor. */
12
+ export declare function readRevertPair(projectRoot: string, id: string): GitDeliveryPair | null;
13
+ /** An in-place turn's pair from its pre/post snapshot commits (no patch is rendered). */
14
+ export declare function createRevertAnchor(repo: string, preTurnSha: string, postTurnSha: string, projectRoot?: string): Promise<string>;
4
15
  export declare function createRevertAnchorFromPatchOrNull(repo: string, patch: string): string | null;
5
16
  export declare function readRevertAnchor(repo: string, id: string, maxBytes?: number): string;
6
- /** The typed refusal every consumer of a saved patch shares when the saved
7
- * copy is display-only and its exact bytes cannot be produced (INV-062). */
17
+ /** The typed refusal every consumer of a saved patch shares when a historical
18
+ * saved copy is display-only and its exact bytes cannot be produced. */
8
19
  export declare const PATCH_EXACT_BYTES_UNAVAILABLE = "patch_exact_bytes_unavailable";
9
20
  export type ExactPatchResolution = {
10
21
  ok: true;
@@ -17,9 +28,9 @@ export type ExactPatchResolution = {
17
28
  /**
18
29
  * Resolve the EXACT patch bytes behind a run's saved `final/patch.diff`.
19
30
  *
20
- * A saved copy is byte-exact unless the work product says
21
- * `persisted_patch: redacted` — then secret-like strings were hidden in it and
22
- * it is display-only. Apply, apply/check, the operator-decision binding and
31
+ * A saved copy is byte-exact. Only historical runs whose work product says
32
+ * `persisted_patch: redacted` saved a copy with secret-like strings hidden; it
33
+ * is display-only. Apply, apply/check, the operator-decision binding and
23
34
  * eligibility must read the private exact patch object instead (same private
24
35
  * store and digest identity as a revert anchor: id === `patch_sha256`). A
25
36
  * missing, unrecorded or corrupt object is a typed refusal; the redacted copy
@@ -33,5 +44,5 @@ export declare function resolveExactPatch(input: {
33
44
  }): ExactPatchResolution;
34
45
  /** Revert is an optional recovery affordance; never advertise it until the
35
46
  * immutable anchor has finalized successfully. */
36
- export declare function createRevertAnchorOrNull(repo: string, preTurnSha: string | null, postTurnSha: string | null): Promise<string | null>;
47
+ export declare function createRevertAnchorOrNull(repo: string, preTurnSha: string | null, postTurnSha: string | null, projectRoot?: string): Promise<string | null>;
37
48
  //# sourceMappingURL=anchor-store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"anchor-store.d.ts","sourceRoot":"","sources":["../src/anchor-store.ts"],"names":[],"mappings":"AAmBA;8EAC8E;AAC9E,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAGjB;AAOD,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM5F;AAiBD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,M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,SAAO,GACjB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAOxB"}
@@ -1,19 +1,94 @@
1
- import { existsSync, readFileSync } from "node:fs";
1
+ import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, utimesSync, writeFileSync, } from "node:fs";
2
+ import { randomUUID } from "node:crypto";
2
3
  import { dirname, join } from "node:path";
3
4
  import { fsyncDirectory, projectRuntimeDir, sha256, writePatchObject, readFileUtf8BoundedSync, } from "@claudexor/util";
4
5
  import { WorkspaceError } from "@claudexor/core";
5
- import { diffTrees } from "./git.js";
6
+ import { GIT_OBJECTS_V1, GitDeliveryPair } from "@claudexor/schema";
7
+ import { repositoryObjectFormat, storeBoundaryCommit, treeOf } from "./git-result.js";
8
+ import { repositoryEndpoint, retainInObjectStore } from "./object-store.js";
6
9
  const ANCHOR_ID = /^sha256:[0-9a-f]{64}$/;
7
10
  function objectPath(repo, id) {
8
11
  if (!ANCHOR_ID.test(id))
9
12
  throw new WorkspaceError("invalid revert anchor id");
10
13
  return join(projectRuntimeDir(repo), "anchors", "objects", `${id.slice(7)}.patch`);
11
14
  }
12
- /** Persist a binary/mode-aware turn patch outside Git before its dangling
13
- * snapshot commits can be collected. The patch digest is the immutable ID. */
14
- export async function createRevertAnchor(repo, preTurnSha, postTurnSha) {
15
- const patch = await diffTrees(repo, preTurnSha, postTurnSha);
16
- return persistRevertAnchor(repo, patch);
15
+ /** An object revert anchor (#535): the actual pair a delivery or an in-place
16
+ * turn produced. Same id space and directory as patch anchors, so one handle
17
+ * (`revert_anchor_id`) and one retention owner serve both representations. */
18
+ function pairPath(repo, id) {
19
+ if (!ANCHOR_ID.test(id))
20
+ throw new WorkspaceError("invalid revert anchor id");
21
+ return join(projectRuntimeDir(repo), "anchors", "objects", `${id.slice(7)}.pair`);
22
+ }
23
+ /**
24
+ * Anchor the actual pair (T, M) for revert. Its objects enter the project store
25
+ * owned by the anchor file itself, so they live exactly as long as the anchor
26
+ * (retention prunes anchors by the runs that name them). `repo` is where Git
27
+ * reads the pair; `projectRoot` is the project that keeps it, where retention
28
+ * finds it (a delegated run's or an isolated thread's project).
29
+ */
30
+ export async function createPairRevertAnchor(repo, pair, projectRoot = repo) {
31
+ const parsed = GitDeliveryPair.parse(pair);
32
+ const text = `${JSON.stringify(parsed)}\n`;
33
+ const id = sha256(text);
34
+ const target = pairPath(projectRoot, id);
35
+ mkdirSync(dirname(target), { recursive: true });
36
+ const created = !existsSync(target);
37
+ if (created) {
38
+ const temp = `${target}.tmp-${process.pid}-${randomUUID()}`;
39
+ writeFileSync(temp, text, { mode: 0o600 });
40
+ renameSync(temp, target);
41
+ }
42
+ try {
43
+ const boundary = await storeBoundaryCommit(repo, parsed.pre_commit);
44
+ await retainInObjectStore({
45
+ projectRoot,
46
+ source: await repositoryEndpoint(repo),
47
+ roots: [parsed.post_tree, parsed.pre_commit],
48
+ boundary: boundary ? { commit: boundary, tree: await treeOf(repo, boundary) } : null,
49
+ objectFormat: parsed.object_format,
50
+ owner: target,
51
+ });
52
+ }
53
+ catch (error) {
54
+ // An anchor whose objects never entered the store is none: this call's own goes.
55
+ if (created)
56
+ rmSync(target, { force: true });
57
+ throw error;
58
+ }
59
+ const now = new Date();
60
+ utimesSync(target, now, now);
61
+ return id;
62
+ }
63
+ export async function createPairRevertAnchorOrNull(repo, pair, projectRoot = repo) {
64
+ if (!pair)
65
+ return null;
66
+ try {
67
+ return await createPairRevertAnchor(repo, pair, projectRoot);
68
+ }
69
+ catch {
70
+ return null;
71
+ }
72
+ }
73
+ /** The recorded pair of an object anchor; null for a legacy patch anchor. */
74
+ export function readRevertPair(projectRoot, id) {
75
+ const path = pairPath(projectRoot, id);
76
+ if (!existsSync(path))
77
+ return null;
78
+ const text = readFileSync(path, "utf8");
79
+ if (sha256(text) !== id)
80
+ throw new WorkspaceError(`revert anchor ${id} is corrupt`);
81
+ return GitDeliveryPair.parse(JSON.parse(text));
82
+ }
83
+ /** An in-place turn's pair from its pre/post snapshot commits (no patch is rendered). */
84
+ export async function createRevertAnchor(repo, preTurnSha, postTurnSha, projectRoot = repo) {
85
+ return createPairRevertAnchor(repo, {
86
+ schema: GIT_OBJECTS_V1,
87
+ object_format: await repositoryObjectFormat(repo),
88
+ pre_commit: preTurnSha,
89
+ pre_tree: await treeOf(repo, preTurnSha),
90
+ post_tree: await treeOf(repo, postTurnSha),
91
+ }, projectRoot);
17
92
  }
18
93
  /** Persist the exact canonical patch written by a protected delivery. */
19
94
  function createRevertAnchorFromPatch(repo, patch) {
@@ -36,9 +111,14 @@ function persistRevertAnchor(repo, patch) {
36
111
  throw new WorkspaceError(`revert anchor ${id} failed its content digest`);
37
112
  }
38
113
  fsyncDirectory(targetDir);
39
- return id;
40
114
  }
41
- writePatchObject(projectRuntimeDir(repo), target, patch);
115
+ else {
116
+ writePatchObject(projectRuntimeDir(repo), target, patch);
117
+ }
118
+ // Every publication renews the run-owned anchor, including a fresh hard link
119
+ // to an old cache inode. Sibling unlink ctime does not extend this age window.
120
+ const now = new Date();
121
+ utimesSync(target, now, now);
42
122
  return id;
43
123
  }
44
124
  export function readRevertAnchor(repo, id, maxBytes) {
@@ -48,15 +128,15 @@ export function readRevertAnchor(repo, id, maxBytes) {
48
128
  throw new WorkspaceError(`revert anchor ${id} is corrupt`);
49
129
  return patch;
50
130
  }
51
- /** The typed refusal every consumer of a saved patch shares when the saved
52
- * copy is display-only and its exact bytes cannot be produced (INV-062). */
131
+ /** The typed refusal every consumer of a saved patch shares when a historical
132
+ * saved copy is display-only and its exact bytes cannot be produced. */
53
133
  export const PATCH_EXACT_BYTES_UNAVAILABLE = "patch_exact_bytes_unavailable";
54
134
  /**
55
135
  * Resolve the EXACT patch bytes behind a run's saved `final/patch.diff`.
56
136
  *
57
- * A saved copy is byte-exact unless the work product says
58
- * `persisted_patch: redacted` — then secret-like strings were hidden in it and
59
- * it is display-only. Apply, apply/check, the operator-decision binding and
137
+ * A saved copy is byte-exact. Only historical runs whose work product says
138
+ * `persisted_patch: redacted` saved a copy with secret-like strings hidden; it
139
+ * is display-only. Apply, apply/check, the operator-decision binding and
60
140
  * eligibility must read the private exact patch object instead (same private
61
141
  * store and digest identity as a revert anchor: id === `patch_sha256`). A
62
142
  * missing, unrecorded or corrupt object is a typed refusal; the redacted copy
@@ -90,11 +170,11 @@ export function resolveExactPatch(input) {
90
170
  }
91
171
  /** Revert is an optional recovery affordance; never advertise it until the
92
172
  * immutable anchor has finalized successfully. */
93
- export async function createRevertAnchorOrNull(repo, preTurnSha, postTurnSha) {
173
+ export async function createRevertAnchorOrNull(repo, preTurnSha, postTurnSha, projectRoot = repo) {
94
174
  if (!preTurnSha || !postTurnSha)
95
175
  return null;
96
176
  try {
97
- return await createRevertAnchor(repo, preTurnSha, postTurnSha);
177
+ return await createRevertAnchor(repo, preTurnSha, postTurnSha, projectRoot);
98
178
  }
99
179
  catch {
100
180
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"anchor-store.js","sourceRoot":"","sources":["../src/anchor-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,MAAM,EACN,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,SAAS,GAAG,uBAAuB,CAAC;AAE1C,SAAS,UAAU,CAAC,IAAY,EAAE,EAAU;IAC1C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,MAAM,IAAI,cAAc,CAAC,0BAA0B,CAAC,CAAC;IAC9E,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,KAAK,C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B,EACzB,WAA0B,EAC1B,WAAW,GAAG,IAAI;IAElB,IAAI,CAAC,UAAU,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAC7C,IAAI,CAAC;QACH,OAAO,MAAM,kBAAkB,CAAC,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IAC9E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"capture-failure.d.ts","sourceRoot":"","sources":["../src/capture-failure.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,mFAAmF;AACnF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,CAOhF;AAED,mFAAmF;AACnF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,uBAAuB,CAwBxF"}
1
+ {"version":3,"file":"capture-failure.d.ts","sourceRoot":"","sources":["../src/capture-failure.ts"],"names":[],"mappings":"AACA,OAAO,EAA0B,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEpF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,mFAAmF;AACnF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,CAMhF;AAED,mFAAmF;AACnF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,uBAAuB,CAgCxF"}
@@ -1,11 +1,10 @@
1
1
  import { WorkspaceError } from "@claudexor/core";
2
- import { WorkspaceCaptureFailure } from "@claudexor/schema";
2
+ import { CaptureChangeInventory, WorkspaceCaptureFailure } from "@claudexor/schema";
3
3
  import { redactSecrets } from "@claudexor/util";
4
4
  /** Keep the original error until scratch cleanup has attached its own evidence. */
5
5
  export function incompleteWorkspaceCapture(error) {
6
6
  return {
7
7
  diff: "",
8
- binarySecretPaths: [],
9
8
  captureIncomplete: true,
10
9
  captureFailure: error instanceof Error ? error : new WorkspaceError(String(error)),
11
10
  };
@@ -17,6 +16,7 @@ export function captureFailureEvidence(error) {
17
16
  const safe = (text) => redactSecrets(text).slice(0, 4000);
18
17
  const cleanup = facts["cleanupError"];
19
18
  const cleanupCode = cleanup?.code;
19
+ const inventory = CaptureChangeInventory.safeParse(facts["captureInventory"]);
20
20
  return WorkspaceCaptureFailure.parse({
21
21
  code: code.success ? code.data : "capture_failed",
22
22
  message: safe(error?.message ?? "Workspace changes could not be captured completely"),
@@ -26,6 +26,11 @@ export function captureFailureEvidence(error) {
26
26
  : {}),
27
27
  ...(["stdout", "stderr"].includes(String(facts["stream"])) ? { stream: facts["stream"] } : {}),
28
28
  ...(facts["drain"] === "truncated" ? { drain: "truncated" } : {}),
29
+ ...Object.fromEntries(["requiredBytes", "availableBytes", "stallMs"]
30
+ .filter((key) => Number.isSafeInteger(facts[key]) && Number(facts[key]) >= 0)
31
+ .map((key) => [key, facts[key]])),
32
+ ...(typeof facts["signal"] === "string" ? { signal: safe(facts["signal"]).slice(0, 32) } : {}),
33
+ ...(inventory.success ? { inventory: inventory.data } : {}),
29
34
  ...(cleanup === undefined
30
35
  ? {}
31
36
  : {
@@ -1 +1 @@
1
- {"version":3,"file":"capture-failure.js","sourceRoot":"","sources":["../src/capture-failure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,mFAAmF;AACnF,MAAM,UAAU,0BAA0B,CAAC,KAAc;IACvD,OAAO;QACL,IAAI,EAAE,EAAE;QACR,iBAAiB,EAAE,EAAE;QACrB,iBAAiB,EAAE,IAAI;Q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AAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;iBAC5E;aACF,CAAC;KACP,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { CaptureChangeInventory } from "@claudexor/schema";
2
+ /**
3
+ * A bounded, NON-EXACT inventory of the changed files behind a refused capture:
4
+ * its own tree-to-tree `git diff --raw` and blob-size pass over the candidate
5
+ * tree the capture already wrote, through the same raw capture budget. It never
6
+ * reads file contents or the refused patch bytes (those are already released).
7
+ * Null when this pass cannot complete; the capture refusal stands either way.
8
+ */
9
+ export declare function changedFileInventory(repo: string, baseSha: string, tree: string, env: Record<string, string>): Promise<CaptureChangeInventory | null>;
10
+ //# sourceMappingURL=capture-inventory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capture-inventory.d.ts","sourceRoot":"","sources":["../src/capture-inventory.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,sBAAsB,EAEvB,MAAM,mBAAmB,CAAC;AAU3B;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1B,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAmDxC"}
@@ -0,0 +1,63 @@
1
+ import { CAPTURE_INVENTORY_LIMIT, CaptureChangeInventory, } from "@claudexor/schema";
2
+ import { gitEnv } from "./git-run.js";
3
+ const CHANGE = {
4
+ A: "added",
5
+ M: "modified",
6
+ D: "deleted",
7
+ T: "type_changed",
8
+ };
9
+ /**
10
+ * A bounded, NON-EXACT inventory of the changed files behind a refused capture:
11
+ * its own tree-to-tree `git diff --raw` and blob-size pass over the candidate
12
+ * tree the capture already wrote, through the same raw capture budget. It never
13
+ * reads file contents or the refused patch bytes (those are already released).
14
+ * Null when this pass cannot complete; the capture refusal stands either way.
15
+ */
16
+ export async function changedFileInventory(repo, baseSha, tree, env) {
17
+ try {
18
+ const raw = await gitEnv(repo, ["diff", "--raw", "-z", "--no-renames", "--no-abbrev", baseSha, tree], env);
19
+ if (raw.code !== 0)
20
+ return null;
21
+ // `-z --raw`: ":<old mode> <new mode> <old oid> <new oid> <status>\0<path>\0".
22
+ const fields = raw.stdout.split("\0");
23
+ const rows = [];
24
+ for (let index = 0; index + 1 < fields.length; index += 2) {
25
+ const meta = fields[index];
26
+ const [, , oldOid, newOid, status] = meta.slice(1).split(" ");
27
+ const change = CHANGE[status ?? ""];
28
+ // An unexpected record yields no inventory rather than a wrong one.
29
+ if (!meta.startsWith(":") || !change || !oldOid || !newOid)
30
+ return null;
31
+ rows.push({ path: fields[index + 1], change, oid: change === "deleted" ? oldOid : newOid });
32
+ }
33
+ const sizes = new Map();
34
+ const oids = [...new Set(rows.map((row) => row.oid))];
35
+ if (oids.length > 0) {
36
+ const check = await gitEnv(repo, ["cat-file", "--batch-check=%(objectname) %(objectsize)"], env, `${oids.join("\n")}\n`);
37
+ // A missing object (a submodule link) answers "<oid> missing": size unknown.
38
+ for (const line of check.code === 0 ? check.stdout.split("\n") : []) {
39
+ const [oid, size] = line.split(" ");
40
+ if (oid && size && /^\d+$/.test(size))
41
+ sizes.set(oid, Number(size));
42
+ }
43
+ }
44
+ const entries = rows
45
+ .map((row) => ({
46
+ // A changed path is working content: exact, within the entry's length cap.
47
+ path: row.path.slice(0, 1024),
48
+ change: row.change,
49
+ sizeBytes: sizes.get(row.oid) ?? null,
50
+ }))
51
+ .sort((a, b) => (b.sizeBytes ?? -1) - (a.sizeBytes ?? -1) || a.path.localeCompare(b.path));
52
+ return CaptureChangeInventory.parse({
53
+ exact: false,
54
+ changedFiles: rows.length,
55
+ largest: entries.slice(0, CAPTURE_INVENTORY_LIMIT),
56
+ });
57
+ }
58
+ catch {
59
+ // Its own overflow, timeout or I/O fault leaves no inventory, never a partial claim.
60
+ return null;
61
+ }
62
+ }
63
+ //# sourceMappingURL=capture-inventory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capture-inventory.js","sourceRoot":"","sources":["../src/capture-inventory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,sBAAsB,GAEvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,MAAM,GAAoD;IAC9D,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,cAAc;CAClB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,IAAY,EACZ,OAAe,EACf,IAAY,EACZ,GAA2B;IAE3B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,MAAM,CACtB,IAAI,EACJ,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,EACrE,GAAG,CACJ,CAAC;QACF,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAChC,+EAA+E;QAC/E,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,IAAI,GAA6E,EAAE,CAAC;QAC1F,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;YAC1D,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAE,CAAC;YAC5B,MAAM,CAAC,EAAE,AAAD,EAAG,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC9D,MAAM,MAAM,GAA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AC,CAAC;YACtE,CAAC;QACH,CAAC;QACD,MAAM,OAAO,GAAG,IAAI;aACjB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACb,2EAA2E;YAC3E,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC;YAC7B,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI;SACtC,CAAC,CAAC;aACF,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7F,OAAO,sBAAsB,CAAC,KAAK,CAAC;YAClC,KAAK,EAAE,KAAK;YACZ,YAAY,EAAE,IAAI,CAAC,MAAM;YACzB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,uBAAuB,CAAC;SACnD,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,qFAAqF;QACrF,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Estimate of the rendered patch view of B..C from blob sizes alone (no blob is
3
+ * read): every changed path contributes its old and new size plus a fixed header
4
+ * allowance (a mode-only change, the allowance alone). Text hunks hold at most both sides' lines; a `--binary` payload is
5
+ * base85 of deflated data (5/4 of at most the raw size) per side. It decides
6
+ * whether a render is attempted. It is NOT an upper bound: per-line prefixes and
7
+ * per-hunk headers are not counted, so many short changed lines render larger.
8
+ * The render is bounded separately by its own buffer, and one that overflows is
9
+ * the same typed absence.
10
+ */
11
+ export declare function estimatePatchViewBytes(repo: string, base: string, candidate: string, env: Record<string, string>): Promise<{
12
+ bytes: number;
13
+ paths: string[];
14
+ existingPaths: string[];
15
+ }>;
16
+ /** Cheap object-growth evidence for the stall watchdog of a writing Git child. */
17
+ export declare function objectDirectoryProgress(objectsDir: string): () => number;
18
+ /**
19
+ * Free-space preflight BEFORE a capture writes anything (owner decision
20
+ * 29.10 17:10): the scratch object directory will hold at most the bytes of the
21
+ * worktree's changed and untracked files, so refuse with exact numbers when the
22
+ * filesystem cannot hold them; nothing has been written at that point.
23
+ */
24
+ export declare function preflightCaptureSpace(repo: string, scratchDir: string, env: Record<string, string>): Promise<number>;
25
+ /**
26
+ * D2 for an isolated envelope: when its base is a Claudexor dirty snapshot (no
27
+ * user ref keeps it), retain the snapshot's own closure beyond its parent in
28
+ * the project store before the clone exists. Returns the store's object
29
+ * directory for the clone's second alternate.
30
+ */
31
+ export declare function isolatedBaseCustody(repo: string, projectRoot: string, baseSha: string, owners: [string, ...string[]]): Promise<string | undefined>;
32
+ //# sourceMappingURL=capture-objects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capture-objects.d.ts","sourceRoot":"","sources":["../src/capture-objects.ts"],"names":[],"mappings":"AAcA;;;;;;;;;GASG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1B,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,aAAa,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA4CtE;AAED,kFAAkF;AAClF,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,MAAM,CAcxE;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1B,OAAO,CAAC,MAAM,CAAC,CAyBjB;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,GAC5B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAmB7B"}
@@ -0,0 +1,129 @@
1
+ import { existsSync, lstatSync, readdirSync, statSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { gitObserved } from "./git-observed.js";
4
+ import { repositoryObjectFormat, storeBoundaryCommit, treeOf } from "./git-result.js";
5
+ import { assertProjectObjectFormat, objectStorePath, repositoryEndpoint, retainInObjectStore, writeRootRecord, } from "./object-store.js";
6
+ import { assertSpaceFor } from "./object-transfer.js";
7
+ import { parseRawRecords } from "./object-compose.js";
8
+ /**
9
+ * Estimate of the rendered patch view of B..C from blob sizes alone (no blob is
10
+ * read): every changed path contributes its old and new size plus a fixed header
11
+ * allowance (a mode-only change, the allowance alone). Text hunks hold at most both sides' lines; a `--binary` payload is
12
+ * base85 of deflated data (5/4 of at most the raw size) per side. It decides
13
+ * whether a render is attempted. It is NOT an upper bound: per-line prefixes and
14
+ * per-hunk headers are not counted, so many short changed lines render larger.
15
+ * The render is bounded separately by its own buffer, and one that overflows is
16
+ * the same typed absence.
17
+ */
18
+ export async function estimatePatchViewBytes(repo, base, candidate, env) {
19
+ const listed = await gitObserved(repo, ["diff-tree", "-r", "--raw", "-z", "--no-renames", "--no-abbrev", base, candidate], { env, label: "diff-tree --raw (estimate)" });
20
+ const records = parseRawRecords(listed.stdout);
21
+ const zero = /^0+$/;
22
+ const oids = [
23
+ ...new Set(records.flatMap((record) => [record.oldOid, record.newOid]).filter((oid) => !zero.test(oid))),
24
+ ];
25
+ const sizes = new Map();
26
+ if (oids.length > 0) {
27
+ const checked = await gitObserved(repo, ["cat-file", "--batch-check=%(objectname) %(objectsize)"], {
28
+ env,
29
+ input: `${oids.join("\n")}\n`,
30
+ label: "cat-file --batch-check (estimate)",
31
+ });
32
+ for (const line of checked.stdout.split("\n")) {
33
+ const [oid, size] = line.split(" ");
34
+ if (oid && size && /^\d+$/.test(size))
35
+ sizes.set(oid, Number(size));
36
+ }
37
+ }
38
+ let bytes = 0;
39
+ for (const record of records) {
40
+ // A mode-only change renders its header and reads no blob.
41
+ const sides = record.oldOid === record.newOid
42
+ ? []
43
+ : [record.oldOid, record.newOid].filter((oid) => !zero.test(oid));
44
+ bytes += 1024 + sides.reduce((sum, oid) => sum + Math.ceil(((sizes.get(oid) ?? 0) * 5) / 4), 0);
45
+ }
46
+ return {
47
+ bytes,
48
+ paths: records.map((record) => record.src),
49
+ // No renames are detected here: an old side exists for M, T and D records.
50
+ existingPaths: records.filter((record) => record.status !== "A").map((record) => record.src),
51
+ };
52
+ }
53
+ /** Cheap object-growth evidence for the stall watchdog of a writing Git child. */
54
+ export function objectDirectoryProgress(objectsDir) {
55
+ return () => {
56
+ let total = 0;
57
+ try {
58
+ const pack = join(objectsDir, "pack");
59
+ if (existsSync(pack))
60
+ for (const name of readdirSync(pack))
61
+ total += statSync(join(pack, name)).size;
62
+ for (const fan of readdirSync(objectsDir))
63
+ if (fan.length === 2)
64
+ total += readdirSync(join(objectsDir, fan)).length;
65
+ }
66
+ catch {
67
+ // A directory being created or removed is not a stall.
68
+ }
69
+ return total;
70
+ };
71
+ }
72
+ /**
73
+ * Free-space preflight BEFORE a capture writes anything (owner decision
74
+ * 29.10 17:10): the scratch object directory will hold at most the bytes of the
75
+ * worktree's changed and untracked files, so refuse with exact numbers when the
76
+ * filesystem cannot hold them; nothing has been written at that point.
77
+ */
78
+ export async function preflightCaptureSpace(repo, scratchDir, env) {
79
+ const status = await gitObserved(repo, ["status", "--porcelain=v1", "-z", "--untracked-files=all", "--no-renames"], { env, label: "status (space preflight)", allowFailure: true });
80
+ if (status.code !== 0)
81
+ return 0;
82
+ const top = (await gitObserved(repo, ["rev-parse", "--show-toplevel"], {
83
+ env,
84
+ label: "rev-parse --show-toplevel",
85
+ })).stdout.trim();
86
+ let bytes = 0;
87
+ for (const entry of status.stdout.split("\0")) {
88
+ if (entry.length < 4 || entry[1] === "D" || entry[0] === "D")
89
+ continue;
90
+ try {
91
+ const stat = lstatSync(join(top, entry.slice(3)));
92
+ if (stat.isFile())
93
+ bytes += stat.size;
94
+ }
95
+ catch {
96
+ // Vanished meanwhile: it adds nothing to write.
97
+ }
98
+ }
99
+ assertSpaceFor(scratchDir, bytes, "capture");
100
+ return bytes;
101
+ }
102
+ /**
103
+ * D2 for an isolated envelope: when its base is a Claudexor dirty snapshot (no
104
+ * user ref keeps it), retain the snapshot's own closure beyond its parent in
105
+ * the project store before the clone exists. Returns the store's object
106
+ * directory for the clone's second alternate.
107
+ */
108
+ export async function isolatedBaseCustody(repo, projectRoot, baseSha, owners) {
109
+ // One project keeps one object format: its store never becomes a foreign clone's alternate.
110
+ if (projectRoot !== repo)
111
+ await assertProjectObjectFormat(projectRoot, await repositoryObjectFormat(repo));
112
+ const boundary = await storeBoundaryCommit(repo, baseSha);
113
+ if (boundary && boundary !== baseSha) {
114
+ const retained = await retainInObjectStore({
115
+ projectRoot,
116
+ source: await repositoryEndpoint(repo),
117
+ roots: [baseSha],
118
+ boundary: { commit: boundary, tree: await treeOf(repo, boundary) },
119
+ objectFormat: await repositoryObjectFormat(repo),
120
+ owner: owners[0],
121
+ });
122
+ // Live while ANY owner exists: the holder run, or the envelope itself.
123
+ for (const owner of owners.slice(1))
124
+ writeRootRecord(retained.store, owner, [baseSha]);
125
+ }
126
+ const objects = join(objectStorePath(projectRoot), "objects");
127
+ return existsSync(objects) ? objects : undefined;
128
+ }
129
+ //# sourceMappingURL=capture-objects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capture-objects.js","sourceRoot":"","sources":["../src/capture-objects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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M,QAAQ,GAAG,MAAM,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1D,IAAI,QAAQ,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACrC,MAAM,QAAQ,GAAG,MAAM,mBAAmB,CAAC;YACzC,WAAW;YACX,MAAM,EAAE,MAAM,kBAAkB,CAAC,IAAI,CAAC;YACtC,KAAK,EAAE,CAAC,OAAO,CAAC;YAChB,QAAQ,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE;YAClE,YAAY,EAAE,MAAM,sBAAsB,CAAC,IAAI,CAAC;YAChD,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;SACjB,CAAC,CAAC;QACH,uEAAuE;QACvE,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAAE,eAAe,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACzF,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC,CAAC;IAC9D,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AACnD,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Keep a cleanup fault beside the outcome it followed, never in its place: a
3
+ * non-enumerable `cleanupError` (the lane capture and revert already use), so no
4
+ * receipt or record serializes it and the outcome's own facts stay as they were.
5
+ * An outcome that already carries one, or cannot take one (frozen), keeps its own.
6
+ */
7
+ export declare function noteCleanupFault(outcome: unknown, fault: unknown): void;
8
+ /** A disposable scratch directory `body` may allocate (`held.dir`). */
9
+ export interface HeldScratch {
10
+ dir: string | null;
11
+ }
12
+ /**
13
+ * Run `body`, then remove the scratch it allocated. A removal that fails leaves the
14
+ * directory where it is (the OS temp dir) and never replaces what `body` returned or
15
+ * threw: its fault is noted beside that outcome ({@link noteCleanupFault}).
16
+ */
17
+ export declare function withDisposableScratch<T>(body: (held: HeldScratch) => Promise<T>): Promise<T>;
18
+ //# sourceMappingURL=cleanup-fault.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleanup-fault.d.ts","sourceRoot":"","sources":["../src/cleanup-fault.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAQvE;AAED,uEAAuE;AACvE,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,CAAC,EAC3C,IAAI,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,GACtC,OAAO,CAAC,CAAC,CAAC,CAeZ"}
@@ -0,0 +1,45 @@
1
+ import { rmSync } from "node:fs";
2
+ /**
3
+ * Keep a cleanup fault beside the outcome it followed, never in its place: a
4
+ * non-enumerable `cleanupError` (the lane capture and revert already use), so no
5
+ * receipt or record serializes it and the outcome's own facts stay as they were.
6
+ * An outcome that already carries one, or cannot take one (frozen), keeps its own.
7
+ */
8
+ export function noteCleanupFault(outcome, fault) {
9
+ if (fault === undefined || outcome === null || typeof outcome !== "object")
10
+ return;
11
+ if ("cleanupError" in outcome)
12
+ return;
13
+ try {
14
+ Object.defineProperty(outcome, "cleanupError", { value: fault, enumerable: false });
15
+ }
16
+ catch {
17
+ // Frozen: the outcome stands without the diagnostic.
18
+ }
19
+ }
20
+ /**
21
+ * Run `body`, then remove the scratch it allocated. A removal that fails leaves the
22
+ * directory where it is (the OS temp dir) and never replaces what `body` returned or
23
+ * threw: its fault is noted beside that outcome ({@link noteCleanupFault}).
24
+ */
25
+ export async function withDisposableScratch(body) {
26
+ const held = { dir: null };
27
+ let outcome;
28
+ try {
29
+ return (outcome = await body(held));
30
+ }
31
+ catch (error) {
32
+ outcome = error;
33
+ throw error;
34
+ }
35
+ finally {
36
+ try {
37
+ if (held.dir)
38
+ rmSync(held.dir, { recursive: true, force: true });
39
+ }
40
+ catch (fault) {
41
+ noteCleanupFault(outcome, fault);
42
+ }
43
+ }
44
+ }
45
+ //# sourceMappingURL=cleanup-fault.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleanup-fault.js","sourceRoot":"","sources":["../src/cleanup-fault.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgB,EAAE,KAAc;IAC/D,IAAI,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO;IACnF,IAAI,cAAc,IAAI,OAAO;QAAE,OAAO;IACtC,IAAI,CAAC;QACH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;IACtF,CAAC;IAAC,MAAM,CAAC;QACP,qDAAqD;IACvD,CAAC;AACH,CAAC;AAOD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,IAAuC;IAEvC,MAAM,IAAI,GAAgB,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IACxC,IAAI,OAAgB,CAAC;IACrB,IAAI,CAAC;QACH,OAAO,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,GAAG,KAAK,CAAC;QAChB,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QACT,IAAI,CAAC;YACH,IAAI,IAAI,CAAC,GAAG;gBAAE,MAAM,CAAC,IAA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