@claudexor/orchestrator 3.20.1 → 3.22.0

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 (180) hide show
  1. package/dist/attemptFinalize.d.ts +14 -101
  2. package/dist/attemptFinalize.d.ts.map +1 -1
  3. package/dist/attemptFinalize.js +7 -328
  4. package/dist/attemptFinalize.js.map +1 -1
  5. package/dist/candidateEvidence.d.ts +15 -6
  6. package/dist/candidateEvidence.d.ts.map +1 -1
  7. package/dist/candidateEvidence.js +1 -1
  8. package/dist/candidateEvidence.js.map +1 -1
  9. package/dist/candidateOutputs.d.ts +7 -3
  10. package/dist/candidateOutputs.d.ts.map +1 -1
  11. package/dist/candidateOutputs.js +4 -1
  12. package/dist/candidateOutputs.js.map +1 -1
  13. package/dist/candidateReview.d.ts.map +1 -1
  14. package/dist/candidateReview.js +3 -1
  15. package/dist/candidateReview.js.map +1 -1
  16. package/dist/candidateTerminals.d.ts +4 -0
  17. package/dist/candidateTerminals.d.ts.map +1 -1
  18. package/dist/candidateTerminals.js +18 -7
  19. package/dist/candidateTerminals.js.map +1 -1
  20. package/dist/candidateWorkProduct.d.ts.map +1 -1
  21. package/dist/candidateWorkProduct.js +6 -6
  22. package/dist/candidateWorkProduct.js.map +1 -1
  23. package/dist/carrier-planner.d.ts +94 -0
  24. package/dist/carrier-planner.d.ts.map +1 -0
  25. package/dist/carrier-planner.js +111 -0
  26. package/dist/carrier-planner.js.map +1 -0
  27. package/dist/continuation-custody.d.ts +57 -0
  28. package/dist/continuation-custody.d.ts.map +1 -0
  29. package/dist/continuation-custody.js +151 -0
  30. package/dist/continuation-custody.js.map +1 -0
  31. package/dist/continuation-evidence-io.d.ts +18 -0
  32. package/dist/continuation-evidence-io.d.ts.map +1 -0
  33. package/dist/continuation-evidence-io.js +167 -0
  34. package/dist/continuation-evidence-io.js.map +1 -0
  35. package/dist/continuation-evidence.d.ts +81 -0
  36. package/dist/continuation-evidence.d.ts.map +1 -0
  37. package/dist/continuation-evidence.js +122 -0
  38. package/dist/continuation-evidence.js.map +1 -0
  39. package/dist/continuation-input.d.ts +10 -0
  40. package/dist/continuation-input.d.ts.map +1 -0
  41. package/dist/continuation-input.js +69 -0
  42. package/dist/continuation-input.js.map +1 -0
  43. package/dist/continue-from.d.ts +41 -0
  44. package/dist/continue-from.d.ts.map +1 -0
  45. package/dist/continue-from.js +292 -0
  46. package/dist/continue-from.js.map +1 -0
  47. package/dist/continuity-notice.d.ts +42 -0
  48. package/dist/continuity-notice.d.ts.map +1 -0
  49. package/dist/continuity-notice.js +42 -0
  50. package/dist/continuity-notice.js.map +1 -0
  51. package/dist/continuity-terminal.d.ts +19 -0
  52. package/dist/continuity-terminal.d.ts.map +1 -0
  53. package/dist/continuity-terminal.js +34 -0
  54. package/dist/continuity-terminal.js.map +1 -0
  55. package/dist/credential-cooldown.d.ts.map +1 -1
  56. package/dist/credential-cooldown.js +8 -3
  57. package/dist/credential-cooldown.js.map +1 -1
  58. package/dist/credential-differential.d.ts +1 -0
  59. package/dist/credential-differential.d.ts.map +1 -1
  60. package/dist/credential-differential.js +32 -4
  61. package/dist/credential-differential.js.map +1 -1
  62. package/dist/deepScanReducer.d.ts +4 -1
  63. package/dist/deepScanReducer.d.ts.map +1 -1
  64. package/dist/deepScanReducer.js +10 -5
  65. package/dist/deepScanReducer.js.map +1 -1
  66. package/dist/delegationFailure.d.ts +4 -3
  67. package/dist/delegationFailure.d.ts.map +1 -1
  68. package/dist/delegationFailure.js +25 -24
  69. package/dist/delegationFailure.js.map +1 -1
  70. package/dist/directoryCandidate.d.ts +2 -2
  71. package/dist/directoryCandidate.d.ts.map +1 -1
  72. package/dist/directoryCandidate.js +3 -0
  73. package/dist/directoryCandidate.js.map +1 -1
  74. package/dist/inrun-continuity-carrier.d.ts +76 -0
  75. package/dist/inrun-continuity-carrier.d.ts.map +1 -0
  76. package/dist/inrun-continuity-carrier.js +218 -0
  77. package/dist/inrun-continuity-carrier.js.map +1 -0
  78. package/dist/inrun-continuity-thread.d.ts +8 -0
  79. package/dist/inrun-continuity-thread.d.ts.map +1 -0
  80. package/dist/inrun-continuity-thread.js +23 -0
  81. package/dist/inrun-continuity-thread.js.map +1 -0
  82. package/dist/inrun-continuity-types.d.ts +105 -0
  83. package/dist/inrun-continuity-types.d.ts.map +1 -0
  84. package/dist/inrun-continuity-types.js +2 -0
  85. package/dist/inrun-continuity-types.js.map +1 -0
  86. package/dist/inrun-continuity.d.ts +79 -0
  87. package/dist/inrun-continuity.d.ts.map +1 -0
  88. package/dist/inrun-continuity.js +465 -0
  89. package/dist/inrun-continuity.js.map +1 -0
  90. package/dist/inrun-continuity.test-support.d.ts +374 -0
  91. package/dist/inrun-continuity.test-support.d.ts.map +1 -0
  92. package/dist/inrun-continuity.test-support.js +198 -0
  93. package/dist/inrun-continuity.test-support.js.map +1 -0
  94. package/dist/inrun-retained-output.d.ts +9 -0
  95. package/dist/inrun-retained-output.d.ts.map +1 -0
  96. package/dist/inrun-retained-output.js +16 -0
  97. package/dist/inrun-retained-output.js.map +1 -0
  98. package/dist/interaction.d.ts +1 -1
  99. package/dist/interaction.d.ts.map +1 -1
  100. package/dist/interaction.js +6 -1
  101. package/dist/interaction.js.map +1 -1
  102. package/dist/modelGovernance.d.ts +4 -0
  103. package/dist/modelGovernance.d.ts.map +1 -1
  104. package/dist/modelGovernance.js +27 -1
  105. package/dist/modelGovernance.js.map +1 -1
  106. package/dist/orchestrator-credentials.d.ts +1 -1
  107. package/dist/orchestrator-credentials.d.ts.map +1 -1
  108. package/dist/orchestrator-credentials.js +4 -3
  109. package/dist/orchestrator-credentials.js.map +1 -1
  110. package/dist/orchestrator.d.ts +4 -4
  111. package/dist/orchestrator.d.ts.map +1 -1
  112. package/dist/orchestrator.js +252 -226
  113. package/dist/orchestrator.js.map +1 -1
  114. package/dist/persistedPatch.d.ts +55 -0
  115. package/dist/persistedPatch.d.ts.map +1 -0
  116. package/dist/persistedPatch.js +132 -0
  117. package/dist/persistedPatch.js.map +1 -0
  118. package/dist/planFinalize.d.ts +37 -0
  119. package/dist/planFinalize.d.ts.map +1 -0
  120. package/dist/planFinalize.js +94 -0
  121. package/dist/planFinalize.js.map +1 -0
  122. package/dist/planRun.d.ts +2 -28
  123. package/dist/planRun.d.ts.map +1 -1
  124. package/dist/planRun.js +5 -88
  125. package/dist/planRun.js.map +1 -1
  126. package/dist/plannerAttempt.d.ts +4 -1
  127. package/dist/plannerAttempt.d.ts.map +1 -1
  128. package/dist/plannerAttempt.js +9 -4
  129. package/dist/plannerAttempt.js.map +1 -1
  130. package/dist/prompt-framing.d.ts +1 -1
  131. package/dist/prompt-framing.d.ts.map +1 -1
  132. package/dist/prompt-framing.js.map +1 -1
  133. package/dist/reviewerEffort.d.ts +41 -0
  134. package/dist/reviewerEffort.d.ts.map +1 -0
  135. package/dist/reviewerEffort.js +37 -0
  136. package/dist/reviewerEffort.js.map +1 -0
  137. package/dist/reviewerPanel.d.ts +5 -5
  138. package/dist/reviewerPanel.d.ts.map +1 -1
  139. package/dist/reviewerPanel.js +22 -50
  140. package/dist/reviewerPanel.js.map +1 -1
  141. package/dist/run-input-resolution.d.ts.map +1 -1
  142. package/dist/run-input-resolution.js +10 -0
  143. package/dist/run-input-resolution.js.map +1 -1
  144. package/dist/runEventLog.d.ts.map +1 -1
  145. package/dist/runEventLog.js +5 -0
  146. package/dist/runEventLog.js.map +1 -1
  147. package/dist/runFactsBuilder.d.ts.map +1 -1
  148. package/dist/runFactsBuilder.js +11 -2
  149. package/dist/runFactsBuilder.js.map +1 -1
  150. package/dist/runSupport.d.ts +2 -1
  151. package/dist/runSupport.d.ts.map +1 -1
  152. package/dist/runSupport.js +2 -1
  153. package/dist/runSupport.js.map +1 -1
  154. package/dist/runTelemetryWriter.d.ts.map +1 -1
  155. package/dist/runTelemetryWriter.js +7 -2
  156. package/dist/runTelemetryWriter.js.map +1 -1
  157. package/dist/runTerminalResults.d.ts +6 -2
  158. package/dist/runTerminalResults.d.ts.map +1 -1
  159. package/dist/runTerminalResults.js +8 -1
  160. package/dist/runTerminalResults.js.map +1 -1
  161. package/dist/runTerminals.d.ts.map +1 -1
  162. package/dist/runTerminals.js +6 -5
  163. package/dist/runTerminals.js.map +1 -1
  164. package/dist/secretDiff.d.ts +67 -27
  165. package/dist/secretDiff.d.ts.map +1 -1
  166. package/dist/secretDiff.js +143 -113
  167. package/dist/secretDiff.js.map +1 -1
  168. package/dist/session-capsule.d.ts +29 -0
  169. package/dist/session-capsule.d.ts.map +1 -0
  170. package/dist/session-capsule.js +86 -0
  171. package/dist/session-capsule.js.map +1 -0
  172. package/dist/workReportEnvelope.d.ts +123 -0
  173. package/dist/workReportEnvelope.d.ts.map +1 -0
  174. package/dist/workReportEnvelope.js +362 -0
  175. package/dist/workReportEnvelope.js.map +1 -0
  176. package/package.json +17 -17
  177. package/dist/effortGovernance.d.ts +0 -13
  178. package/dist/effortGovernance.d.ts.map +0 -1
  179. package/dist/effortGovernance.js +0 -7
  180. package/dist/effortGovernance.js.map +0 -1
@@ -1,32 +1,72 @@
1
- import type { WorkspaceEnvelope } from "@claudexor/schema";
2
- import { revertWorkingTreePatch, type WorkspaceManager } from "@claudexor/workspace";
3
- export interface SecretDiffRefusal {
4
- disposition: "discarded" | "reverted" | "manual_cleanup";
1
+ import type { ArtifactStore } from "@claudexor/artifact-store";
2
+ import { AnswerAssembly } from "@claudexor/core";
3
+ import type { HarnessEvent, WorkspaceEnvelope } from "@claudexor/schema";
4
+ import { type WorkspaceManager } from "@claudexor/workspace";
5
+ import { secretLikeSummaryLine, type SecretLikeFinding } from "./persistedPatch.js";
6
+ /** The candidate's changes could not be observed at all. This is the ONLY
7
+ * capture-time refusal left: secret-like content is never one (INV-062). */
8
+ export interface CaptureRefusal {
9
+ disposition: "discarded" | "manual_cleanup";
5
10
  detail: string;
11
+ /** Failure phase; a directory result keeps its sensitive-resource phase. */
12
+ phase?: "workspace" | "artifact_security";
6
13
  }
7
- export declare function recordSecretDiffRefusal(refusal: SecretDiffRefusal | undefined, errors: string[], existingError: boolean): boolean;
8
- export declare function secretDiffNextActions(refusal: SecretDiffRefusal): string[];
9
- /** Keep a secret-bearing patch memory-only. Isolated bytes die with their
10
- * envelope; in-place bytes are removed only through the existing exact
11
- * postimage check, so a concurrent edit turns into manual cleanup rather than
12
- * a destructive rollback. */
13
- export declare function quarantineSecretDiff(input: {
14
+ export declare function recordCaptureRefusal(refusal: CaptureRefusal | undefined, errors: string[], existingError: boolean): boolean;
15
+ export declare function captureRefusalNextActions(refusal: CaptureRefusal): string[];
16
+ /** Answer assembly that also counts secret-like matches in answer material
17
+ * BEFORE its first redaction. Harness events are redacted one by one on their
18
+ * way into the assembly, so a count taken on the assembled answer would
19
+ * always read zero. The count mirrors the assembly's own selection: a typed
20
+ * final wins verbatim, otherwise the narration parts add up. */
21
+ export declare class CountedAnswerAssembly extends AnswerAssembly {
22
+ private finalMatches;
23
+ private partMatches;
24
+ private lastPart;
25
+ observeCounted(raw: HarnessEvent, safe: HarnessEvent): void;
26
+ secretLikeMatches(): number;
27
+ }
28
+ /** Read-only products have no patch or media findings. Their selected answer's
29
+ * pre-redaction count uses the same disclosure shape as a candidate capture. */
30
+ export declare function answerSecretLikeFinding(answerMatches?: number): SecretLikeFinding | undefined;
31
+ export interface CandidateCapture {
32
+ /** The EXACT candidate patch: apply, synthesis, digests and gates read it. */
14
33
  diff: string;
34
+ /** The saved copy, present only when it differs from the exact patch. */
35
+ persistedDiff?: string;
36
+ secretLike?: SecretLikeFinding;
37
+ captureRefusal?: CaptureRefusal;
38
+ /** Set when the private exact patch object of an isolated candidate could
39
+ * not be written: its envelope is kept and this is where the bytes still are. */
40
+ exactBytesRetainedAt?: string;
41
+ }
42
+ /** Disclosure fields of one attempt record (`attempt.yaml`). */
43
+ export declare function attemptDisclosure(capture: CandidateCapture): Record<string, unknown>;
44
+ /**
45
+ * Capture a candidate's changes and classify what a SAVED copy must hide.
46
+ * Nothing is rolled back, discarded or failed for secret-like content: the
47
+ * tree, the in-memory diff and the reviewer's verdict all keep the real bytes.
48
+ */
49
+ export declare function captureCandidateWorkspace(input: {
50
+ wsm: WorkspaceManager;
51
+ envelope: WorkspaceEnvelope;
15
52
  inPlace: boolean;
16
- repo: string;
17
- binarySecretLike: boolean;
18
- /** Secret-risk media that is not represented by `diff` cannot be removed by
19
- * a successful text rollback and therefore requires truthful manual cleanup. */
20
- secretOutsidePatch?: boolean;
21
- gitBacked: boolean;
22
- /** Test seam for the typed workspace rollback contract. */
23
- revertPatch?: typeof revertWorkingTreePatch;
24
- }): Promise<{
25
- diff: string;
26
- refusal?: SecretDiffRefusal;
27
- }>;
28
- export declare function quarantineCandidateWorkspace(wsm: WorkspaceManager, envelope: WorkspaceEnvelope, inPlace: boolean, answerText?: string): ReturnType<typeof quarantineSecretDiff>;
29
- /** Fail-loud persistence fence for a final artifact: a secret-like token in
30
- * the winner's bytes must throw before anything is written (INV-062). */
31
- export declare function assertNoSecretLikeTokens(label: string, text: string): void;
53
+ /** Project root owning the private exact patch object store. */
54
+ projectRoot: string;
55
+ answerText?: string;
56
+ answerMatches: number;
57
+ }): Promise<CandidateCapture>;
58
+ /**
59
+ * Write a run's final patch: the saved copy to `final/patch.diff`, the exact
60
+ * bytes to the private exact patch object when the copy hides anything, and
61
+ * the disclosure fields for `work_product.yaml` meta. `patchSha256` is ALWAYS
62
+ * the digest of the exact patch, so a redacted copy can never pass the apply
63
+ * gate's digest binding on any route.
64
+ */
65
+ export declare function persistFinalPatch(store: ArtifactStore, finalDir: string, run: Pick<CandidateCapture, "diff" | "persistedDiff" | "secretLike" | "exactBytesRetainedAt">): {
66
+ patchSha256: string;
67
+ meta: Record<string, unknown>;
68
+ };
69
+ export { secretLikeSummaryLine };
70
+ /** `\n`-prefixed disclosure line for a summary template; "" when clean. */
71
+ export declare function summaryDisclosure(finding: SecretLikeFinding | undefined): string;
32
72
  //# sourceMappingURL=secretDiff.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"secretDiff.d.ts","sourceRo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,CAAC;IACvB,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;qFACiF;IACjF,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,gEAAgE;AAChE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQpF;AAED;;;;GAIG;AACH,wBAAsB,yBAAyB,CAAC,KAAK,EAAE;IACrD,GAAG,EAAE,gBAAgB,CAAC;IACtB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA6D5B;AAMD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,eAAe,GAAG,YAAY,GAAG,sBAAsB,CAAC,GAC5F;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAgBxD;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,SAAS,GAAG,MAAM,CAGhF"}
@@ -1,141 +1,171 @@
1
- import { realpathSync } from "node:fs";
2
- import { resolve, sep } from "node:path";
3
- import { summarizeDiffPaths } from "@claudexor/core";
4
- import { revertWorkingTreePatch } from "@claudexor/workspace";
5
- import { containsSecretLikeToken, redactSecrets } from "@claudexor/util";
1
+ import { join } from "node:path";
2
+ import { AnswerAssembly, summarizeDiffPaths } from "@claudexor/core";
3
+ import { createRevertAnchorFromPatchOrNull } from "@claudexor/workspace";
4
+ import { sensitiveResourcePolicy, sha256 } from "@claudexor/util";
6
5
  import { candidateOutputSecretRisk, rasterLinksInMarkdown } from "./candidateOutputs.js";
7
- export function recordSecretDiffRefusal(refusal, errors, existingError) {
6
+ import { assertPersistableText, buildSecretLikeFinding, persistedPatchCopy, secretLikeSummaryLine, } from "./persistedPatch.js";
7
+ export function recordCaptureRefusal(refusal, errors, existingError) {
8
8
  if (!refusal)
9
9
  return existingError;
10
- errors.push("candidate output could not be proven secret-safe; refusing artifact persistence");
10
+ errors.push(refusal.detail);
11
11
  return true;
12
12
  }
13
- export function secretDiffNextActions(refusal) {
13
+ export function captureRefusalNextActions(refusal) {
14
14
  return refusal.disposition === "manual_cleanup"
15
- ? ["Inspect and clean the state named in the recovery receipt", "Retry the run"]
16
- : ["Retry the run without writing secret material"];
15
+ ? ["Inspect the changed files in the project folder directly", "Retry the run"]
16
+ : ["Retry the run"];
17
17
  }
18
- /** Keep a secret-bearing patch memory-only. Isolated bytes die with their
19
- * envelope; in-place bytes are removed only through the existing exact
20
- * postimage check, so a concurrent edit turns into manual cleanup rather than
21
- * a destructive rollback. */
22
- export async function quarantineSecretDiff(input) {
23
- if (!containsSecretLikeToken(input.diff) && !input.binarySecretLike) {
24
- return { diff: input.diff };
18
+ /** Answer assembly that also counts secret-like matches in answer material
19
+ * BEFORE its first redaction. Harness events are redacted one by one on their
20
+ * way into the assembly, so a count taken on the assembled answer would
21
+ * always read zero. The count mirrors the assembly's own selection: a typed
22
+ * final wins verbatim, otherwise the narration parts add up. */
23
+ export class CountedAnswerAssembly extends AnswerAssembly {
24
+ finalMatches = null;
25
+ partMatches = 0;
26
+ lastPart;
27
+ observeCounted(raw, safe) {
28
+ this.observe(safe);
29
+ if (raw.type !== "message")
30
+ return;
31
+ const payload = raw.payload ?? {};
32
+ if (payload["auth_switched"] === true || payload["delta"] === true)
33
+ return;
34
+ if (payload["buffered"] === true)
35
+ return;
36
+ const text = raw.text ?? "";
37
+ const count = () => sensitiveResourcePolicy.inspectContent(text, "redact").matches;
38
+ if (raw.final === true) {
39
+ // The same acceptance as AnswerAssembly: an empty display final counts
40
+ // only when it carries the machine envelope (and then shows nothing).
41
+ const envelope = typeof payload["work_report_envelope"] === "string";
42
+ if (text.trim().length > 0 || envelope)
43
+ this.finalMatches = text.trim() ? count() : 0;
44
+ return;
45
+ }
46
+ // Narration repeats are shown once (pushUniqueText), so they count once.
47
+ const normalized = text.trim();
48
+ if (!normalized || normalized === this.lastPart)
49
+ return;
50
+ this.lastPart = normalized;
51
+ this.partMatches += count();
25
52
  }
26
- if (!input.inPlace) {
27
- return {
28
- diff: "",
29
- refusal: {
30
- disposition: "discarded",
31
- detail: "isolated candidate bytes that could not be proven secret-safe were discarded with the candidate envelope",
32
- },
33
- };
53
+ secretLikeMatches() {
54
+ return this.hasFinal() && this.finalMatches !== null ? this.finalMatches : this.partMatches;
34
55
  }
35
- if (input.binarySecretLike && !input.diff.trim()) {
36
- return {
37
- diff: "",
38
- refusal: {
39
- disposition: "manual_cleanup",
40
- detail: "candidate output could not be proven secret-safe or captured as an exact reversible patch; manual cleanup required",
41
- },
42
- };
43
- }
44
- let rollback;
45
- try {
46
- rollback = await (input.revertPatch ?? revertWorkingTreePatch)(input.repo, input.diff, {
47
- isolateObjectWrites: input.gitBacked,
48
- noIndex: !input.gitBacked,
49
- });
50
- }
51
- catch (error) {
52
- const rollbackCompleted = error instanceof Error &&
53
- Object.prototype.hasOwnProperty.call(error, "cleanupError") &&
54
- error.rollbackReverted === true;
55
- return {
56
- diff: "",
57
- refusal: {
58
- disposition: "manual_cleanup",
59
- detail: rollbackCompleted
60
- ? "in-place bytes were rolled back, but Claudexor scratch cleanup could not be proven; manual cleanup of Claudexor temporary state is required"
61
- : "in-place output that could not be proven secret-safe could not be rolled back; manual cleanup required",
62
- },
63
- };
64
- }
65
- const manuallyClean = !rollback.reverted || input.gitBacked || input.secretOutsidePatch === true;
56
+ }
57
+ /** Read-only products have no patch or media findings. Their selected answer's
58
+ * pre-redaction count uses the same disclosure shape as a candidate capture. */
59
+ export function answerSecretLikeFinding(answerMatches = 0) {
60
+ return buildSecretLikeFinding({
61
+ copy: { text: "", files: [], unattributedMatches: 0 },
62
+ binaryPaths: [],
63
+ mediaWithheld: [],
64
+ answerMatches,
65
+ });
66
+ }
67
+ /** Disclosure fields of one attempt record (`attempt.yaml`). */
68
+ export function attemptDisclosure(capture) {
66
69
  return {
67
- diff: "",
68
- refusal: !manuallyClean
69
- ? {
70
- disposition: "reverted",
71
- detail: "in-place bytes that could not be proven secret-safe were removed by an exact checked rollback",
72
- }
73
- : {
74
- disposition: "manual_cleanup",
75
- detail: redactSecrets(rollback.reverted && input.secretOutsidePatch
76
- ? `the exact reversible patch was removed, but candidate media outside that patch could not be proven removed; manual cleanup required${input.gitBacked ? "; inspect Git index, refs, and objects too" : ""}`
77
- : rollback.reverted && input.gitBacked
78
- ? "worktree bytes were removed; inspect Git index, refs, and objects for harness-written secret state"
79
- : (rollback.reason ??
80
- "candidate output could not be proven removed; manual cleanup required")),
81
- },
70
+ ...(capture.captureRefusal ? { capture_refusal: capture.captureRefusal } : {}),
71
+ ...(capture.secretLike ? { secret_like: capture.secretLike } : {}),
72
+ ...(capture.exactBytesRetainedAt
73
+ ? { exact_bytes_retained_at: capture.exactBytesRetainedAt }
74
+ : {}),
82
75
  };
83
76
  }
84
- export async function quarantineCandidateWorkspace(wsm, envelope, inPlace, answerText) {
77
+ /**
78
+ * Capture a candidate's changes and classify what a SAVED copy must hide.
79
+ * Nothing is rolled back, discarded or failed for secret-like content: the
80
+ * tree, the in-memory diff and the reviewer's verdict all keep the real bytes.
81
+ */
82
+ export async function captureCandidateWorkspace(input) {
83
+ const { wsm, envelope, inPlace } = input;
85
84
  let captured;
86
85
  try {
87
86
  captured = await wsm.captureDiff(envelope);
88
87
  }
89
88
  catch (error) {
90
89
  const scratchCleanupUnproven = error instanceof Error && Object.prototype.hasOwnProperty.call(error, "cleanupError");
91
- return {
92
- diff: "",
93
- refusal: {
94
- disposition: inPlace || scratchCleanupUnproven ? "manual_cleanup" : "discarded",
95
- detail: scratchCleanupUnproven
96
- ? "candidate output capture failed and private scratch cleanup could not be proven; manual cleanup of Claudexor temporary state is required"
97
- : inPlace
98
- ? "candidate output could not be captured safely; manual cleanup required"
99
- : "uncaptured isolated candidate output was discarded with the candidate envelope",
100
- },
101
- };
90
+ return refused(inPlace || scratchCleanupUnproven ? "manual_cleanup" : "discarded", scratchCleanupUnproven
91
+ ? "candidate output capture failed and private scratch cleanup could not be proven; manual cleanup of Claudexor temporary state is required"
92
+ : inPlace
93
+ ? "candidate output could not be captured; the changed files are untouched and need direct inspection"
94
+ : "uncaptured isolated candidate output was discarded with the candidate envelope");
95
+ }
96
+ if (captured.captureIncomplete) {
97
+ return refused(inPlace ? "manual_cleanup" : "discarded", inPlace
98
+ ? "candidate output could not be captured as a complete patch; the changed files are untouched and need direct inspection"
99
+ : "uncaptured isolated candidate output was discarded with the candidate envelope");
102
100
  }
103
- const diffPaths = summarizeDiffPaths(captured.diff).paths;
104
- const linkedPaths = rasterLinksInMarkdown(answerText ?? "");
105
- const mediaRisk = candidateOutputSecretRisk({
101
+ const media = candidateOutputSecretRisk({
106
102
  worktreePath: envelope.worktree_path,
107
- changedPaths: [...diffPaths, ...linkedPaths],
103
+ changedPaths: [
104
+ ...summarizeDiffPaths(captured.diff).paths,
105
+ ...rasterLinksInMarkdown(input.answerText ?? ""),
106
+ ],
108
107
  artifactRelativeDir: wsm.ownedArtifactRelativeDirectory(envelope),
109
108
  });
110
- const diffIdentities = new Set(diffPaths.map((path) => candidatePathIdentity(envelope.worktree_path, path)));
111
- const secretOutsidePatch = mediaRisk.artifactDirectoryUnsafe ||
112
- mediaRisk.nonReversiblePaths.length > 0 ||
113
- mediaRisk.riskyPaths.some((path) => !diffIdentities.has(candidatePathIdentity(envelope.worktree_path, path)));
114
- return quarantineSecretDiff({
115
- diff: captured.diff,
116
- binarySecretLike: captured.binarySecretLike || mediaRisk.risky,
117
- secretOutsidePatch,
118
- repo: envelope.worktree_path,
119
- inPlace,
120
- gitBacked: Boolean(envelope.base_sha),
109
+ const copy = persistedPatchCopy(captured.diff, captured.binarySecretPaths);
110
+ const secretLike = buildSecretLikeFinding({
111
+ copy,
112
+ binaryPaths: captured.binarySecretPaths,
113
+ mediaWithheld: [
114
+ ...media.riskyPaths,
115
+ ...(media.artifactDirectoryUnsafe
116
+ ? [wsm.ownedArtifactRelativeDirectory(envelope) ?? ""]
117
+ : []),
118
+ ].filter(Boolean),
119
+ answerMatches: input.answerText ? input.answerMatches : 0,
121
120
  });
121
+ const redactedCopy = copy.text !== captured.diff;
122
+ // An isolated candidate's envelope is the only other holder of the exact
123
+ // bytes and is about to be removed, so its exact object is written NOW. If
124
+ // that write fails the envelope is kept: a deferred Apply then refuses typed
125
+ // while the bytes, the answer and the run state stay readable.
126
+ const retained = redactedCopy &&
127
+ !inPlace &&
128
+ createRevertAnchorFromPatchOrNull(input.projectRoot, captured.diff) === null;
129
+ if (retained)
130
+ wsm.retainEnvelope(envelope);
131
+ return {
132
+ diff: captured.diff,
133
+ ...(redactedCopy ? { persistedDiff: copy.text } : {}),
134
+ ...(secretLike ? { secretLike } : {}),
135
+ ...(retained ? { exactBytesRetainedAt: envelope.worktree_path } : {}),
136
+ };
122
137
  }
123
- function candidatePathIdentity(root, raw) {
124
- const absolute = resolve(root, raw);
125
- if (absolute !== resolve(root) && !absolute.startsWith(resolve(root) + sep))
126
- return absolute;
127
- try {
128
- return realpathSync.native(absolute);
129
- }
130
- catch {
131
- return absolute;
132
- }
138
+ function refused(disposition, detail) {
139
+ return { diff: "", captureRefusal: { disposition, detail } };
133
140
  }
134
- /** Fail-loud persistence fence for a final artifact: a secret-like token in
135
- * the winner's bytes must throw before anything is written (INV-062). */
136
- export function assertNoSecretLikeTokens(label, text) {
137
- if (containsSecretLikeToken(text)) {
138
- throw new Error(`${label} contains secret-like token; refusing to persist artifact`);
141
+ /**
142
+ * Write a run's final patch: the saved copy to `final/patch.diff`, the exact
143
+ * bytes to the private exact patch object when the copy hides anything, and
144
+ * the disclosure fields for `work_product.yaml` meta. `patchSha256` is ALWAYS
145
+ * the digest of the exact patch, so a redacted copy can never pass the apply
146
+ * gate's digest binding on any route.
147
+ */
148
+ export function persistFinalPatch(store, finalDir, run) {
149
+ const copy = run.persistedDiff ?? persistedPatchCopy(run.diff, []).text;
150
+ assertPersistableText("final patch copy", copy);
151
+ store.writeText(join(finalDir, "patch.diff"), copy);
152
+ const meta = run.secretLike ? { secret_like: run.secretLike } : {};
153
+ if (copy !== run.diff) {
154
+ meta["persisted_patch"] = "redacted";
155
+ // null: the exact bytes could not be stored; a deferred Apply answers
156
+ // patch_exact_bytes_unavailable instead of applying the copy.
157
+ const exactObject = createRevertAnchorFromPatchOrNull(store.repoRoot, run.diff);
158
+ meta["exact_patch_object"] = exactObject;
159
+ if (exactObject === null && run.exactBytesRetainedAt) {
160
+ meta["exact_bytes_retained_at"] = run.exactBytesRetainedAt;
161
+ }
139
162
  }
163
+ return { patchSha256: sha256(run.diff), meta };
164
+ }
165
+ export { secretLikeSummaryLine };
166
+ /** `\n`-prefixed disclosure line for a summary template; "" when clean. */
167
+ export function summaryDisclosure(finding) {
168
+ const line = secretLikeSummaryLine(finding);
169
+ return line ? `\n${line}` : "";
140
170
  }
141
171
  //# sourceMappingURL=secretDiff.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"secretDiff.js","sourceRoot":"","sources":["../src/secretDiff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAE,sBAAsB,EAAyB,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,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,EAAE,CAAC;QACtB,IAAI,CAAC,iBAAiB,CAAC,GAAG,UAAU,CAAC;QACrC,sEAAsE;QACtE,8DAA8D;QAC9D,MAAM,WAAW,GAAG,iCAAiC,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QAChF,IAAI,CAAC,oBAAoB,CAAC,GAAG,WAAW,CAAC;QACzC,IAAI,WAAW,KAAK,IAAI,IAAI,GAAG,CAAC,oBAAoB,EAAE,CAAC;YACrD,IAAI,CAAC,yBAAyB,CAAC,GAAG,GAAG,CAAC,oBAAoB,CAAC;QAC7D,CAAC;IACH,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;AACjD,CAAC;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC,2EAA2E;AAC3E,MAAM,UAAU,iBAAiB,CAAC,OAAsC;IACtE,MAAM,IAAI,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAC5C,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACjC,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { SessionCapsule, type CredentialProfile } from "@claudexor/schema";
2
+ import { type EnvMap, type HarnessContinuityCapability } from "@claudexor/core";
3
+ export declare const SESSION_CAPSULE_FILE = "session-capsule.json";
4
+ export declare function sessionCapsulePath(attemptDir: string): string;
5
+ /** Atomic-enough write (temp + rename is overkill for a one-line JSON; a torn
6
+ * write fails `readSessionCapsule`'s parse and reads as "no capsule"). */
7
+ export declare function writeSessionCapsule(attemptDir: string, capsule: SessionCapsule): void;
8
+ /** The attempt's capsule, or null when none was written or it does not parse. */
9
+ export declare function readSessionCapsule(attemptDir: string): SessionCapsule | null;
10
+ /**
11
+ * The EnvMap the adapter's `locate`/`move` resolve a store from: the child's
12
+ * spec env plus the registry locator of the profile that holds the session.
13
+ * The engine names the row's `isolation_locator` under ONE neutral key; the
14
+ * adapter maps it onto its vendor variable (INV-135, no vendor paths here).
15
+ */
16
+ export declare function storeEnvFor(specEnv: Record<string, string> | undefined, profile: Pick<CredentialProfile, "isolation_locator"> | null | undefined): EnvMap;
17
+ /** The registry row of a profile id, or null for the engine default. */
18
+ export declare function registryProfile(registry: readonly CredentialProfile[], profileId: string | null): CredentialProfile | null;
19
+ /**
20
+ * Re-locate the capsule's holder file through the adapter (best-effort I/O).
21
+ * A located file refreshes `file`/`mtimeMs`/`sidecars`; a miss leaves the
22
+ * capsule as it was (a resume by id; only adapters with `continuity` have the
23
+ * engine compare the resumed session id). Never throws.
24
+ */
25
+ export declare function relocateSessionCapsule(capsule: SessionCapsule, continuity: HarnessContinuityCapability | undefined, env: EnvMap): Promise<{
26
+ capsule: SessionCapsule;
27
+ located: boolean | null;
28
+ }>;
29
+ //# sourceMappingURL=session-capsule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-capsule.d.ts","sourceRoot":"","sources":["../src/session-capsule.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,cAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,2BAA2B,EACjC,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAE3D,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;0EAC0E;AAC1E,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI,CAIrF;AAED,iFAAiF;AACjF,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAQ5E;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC3C,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,GAAG,IAAI,GAAG,SAAS,GACvE,MAAM,CAMR;AAED,wEAAwE;AACxE,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,SAAS,iBAAiB,EAAE,EACtC,SAAS,EAAE,MAAM,GAAG,IAAI,GACvB,iBAAiB,GAAG,IAAI,CAG1B;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,2BAA2B,GAAG,SAAS,EACnD,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,OAAO,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;CAAE,CAAC,CAoB/D"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Session capsule (A5): ONE durable record per attempt of the native vendor
3
+ * session — `attempts/<attemptId>/session-capsule.json` under the run dir.
4
+ *
5
+ * Written by the orchestrator when `started` reports a native session id (every
6
+ * try, every envelope kind, standalone runs included — the daemon's thread
7
+ * callback is not standalone persistence), re-located after the try settles
8
+ * (the vendor may write the history file after `started`) and refreshed after
9
+ * a move. The holder is the concrete file the adapter's `locate` found; a
10
+ * session has one holder at a time. Readers: the in-run continuation loop,
11
+ * the `continueFrom` run chain and the thread store's projection.
12
+ */
13
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
14
+ import { dirname, join } from "node:path";
15
+ import { SessionCapsule } from "@claudexor/schema";
16
+ import { CONTINUITY_PROFILE_LOCATOR_ENV, } from "@claudexor/core";
17
+ export const SESSION_CAPSULE_FILE = "session-capsule.json";
18
+ export function sessionCapsulePath(attemptDir) {
19
+ return join(attemptDir, SESSION_CAPSULE_FILE);
20
+ }
21
+ /** Atomic-enough write (temp + rename is overkill for a one-line JSON; a torn
22
+ * write fails `readSessionCapsule`'s parse and reads as "no capsule"). */
23
+ export function writeSessionCapsule(attemptDir, capsule) {
24
+ const path = sessionCapsulePath(attemptDir);
25
+ mkdirSync(dirname(path), { recursive: true });
26
+ writeFileSync(path, JSON.stringify(SessionCapsule.parse(capsule), null, 2) + "\n");
27
+ }
28
+ /** The attempt's capsule, or null when none was written or it does not parse. */
29
+ export function readSessionCapsule(attemptDir) {
30
+ const path = sessionCapsulePath(attemptDir);
31
+ if (!existsSync(path))
32
+ return null;
33
+ try {
34
+ return SessionCapsule.parse(JSON.parse(readFileSync(path, "utf8")));
35
+ }
36
+ catch {
37
+ return null;
38
+ }
39
+ }
40
+ /**
41
+ * The EnvMap the adapter's `locate`/`move` resolve a store from: the child's
42
+ * spec env plus the registry locator of the profile that holds the session.
43
+ * The engine names the row's `isolation_locator` under ONE neutral key; the
44
+ * adapter maps it onto its vendor variable (INV-135, no vendor paths here).
45
+ */
46
+ export function storeEnvFor(specEnv, profile) {
47
+ const locator = profile?.isolation_locator ?? null;
48
+ return {
49
+ ...(specEnv ?? {}),
50
+ ...(locator ? { [CONTINUITY_PROFILE_LOCATOR_ENV]: locator } : {}),
51
+ };
52
+ }
53
+ /** The registry row of a profile id, or null for the engine default. */
54
+ export function registryProfile(registry, profileId) {
55
+ if (profileId === null)
56
+ return null;
57
+ return registry.find((row) => row.profile_id === profileId) ?? null;
58
+ }
59
+ /**
60
+ * Re-locate the capsule's holder file through the adapter (best-effort I/O).
61
+ * A located file refreshes `file`/`mtimeMs`/`sidecars`; a miss leaves the
62
+ * capsule as it was (a resume by id; only adapters with `continuity` have the
63
+ * engine compare the resumed session id). Never throws.
64
+ */
65
+ export async function relocateSessionCapsule(capsule, continuity, env) {
66
+ if (!continuity)
67
+ return { capsule, located: null };
68
+ try {
69
+ const found = await continuity.locate({ nativeSessionId: capsule.nativeSessionId, cwd: capsule.cwd }, env);
70
+ if (!found.found)
71
+ return { capsule, located: false };
72
+ return {
73
+ capsule: {
74
+ ...capsule,
75
+ file: found.file,
76
+ mtimeMs: found.mtimeMs,
77
+ sidecars: found.sidecars,
78
+ },
79
+ located: true,
80
+ };
81
+ }
82
+ catch {
83
+ return { capsule, located: false };
84
+ }
85
+ }
86
+ //# sourceMappingURL=session-capsule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-capsule.js","sourceRoot":"","sources":["../src/session-capsule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,cAAc,EAA0B,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EACL,8BAA8B,GAG/B,MAAM,iBAAiB,CAAC;AAEzB,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAE3D,MAAM,UAAU,kBAAkB,CAAC,UAAkB;IACnD,OAAO,IAAI,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC;AAChD,CAAC;AAED;0EAC0E;AAC1E,MAAM,UAAU,mBAAmB,CAAC,UAAkB,EAAE,OAAuB;IAC7E,MAAM,IAAI,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC5C,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AACrF,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,kBAAkB,CAAC,UAAkB;IACnD,MAAM,IAAI,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC5C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACnC,IAAI,CAAC;QACH,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,Y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