@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
@@ -0,0 +1,123 @@
1
+ /**
2
+ * D-16 WorkReport transport envelope: the spec-build decision
3
+ * (`resolveWorkReportEnvelope`) and the unwrap (`unwrapWorkReportEnvelope`) for
4
+ * every channel, so a route arms exactly the transport the finalizer later
5
+ * reads. PURE (no I/O, no clock); `attemptFinalize.ts` folds the result.
6
+ */
7
+ import { WorkReport, type HarnessCapabilities, type WorkReportSource, type WorkReportUnverifiedReason } from "@claudexor/schema";
8
+ /**
9
+ * How the WorkReport rides the wire for an active envelope (D-16c):
10
+ * - `constrained_json`: the whole final answer IS the `{work_report, output}`
11
+ * JSON (codex `--output-schema`; claude `--json-schema` WITH a caller schema).
12
+ * - `side_tool`: a `{work_report}`-only schema arms claude's StructuredOutput
13
+ * TOOL; the markdown final message stays the deliverable and the report rides
14
+ * the tool payload (surfaced on the final message's `work_report_side_tool`).
15
+ * - `instructed_fence`: no native constraint — the model is ASKED to write its
16
+ * complete markdown answer, then append a fenced `{work_report}` metadata
17
+ * block validated off the last fenced JSON (cursor, agy, acp). Because
18
+ * nothing enforces it, a missing or broken footer is disclosed as an
19
+ * `unverified` work_state with a typed reason, never a contract failure
20
+ * (owner decision 2026-10-05); the two native channels stay strict.
21
+ */
22
+ export type WorkReportChannel = "constrained_json" | "side_tool" | "instructed_fence";
23
+ /** The per-attempt envelope decision made at spec build and consumed by the
24
+ * unwrap. `active` means the orchestrator actually armed a WorkReport transport
25
+ * for this route, so a missing/malformed report is a typed contract failure on
26
+ * the native channels and a disclosed unverified work_state on the instructed
27
+ * fence. */
28
+ export interface WorkReportEnvelopeMode {
29
+ active: boolean;
30
+ source: WorkReportSource;
31
+ hasCallerSchema: boolean;
32
+ channel: WorkReportChannel;
33
+ /** Instruction to APPEND to the spec (instructed_fence only); null otherwise. */
34
+ instruction: string | null;
35
+ }
36
+ /**
37
+ * The instruction appended to an `instructed_fence` (cursor, agy, acp) route so
38
+ * the model emits the WorkReport footer the finalizer validates. No native
39
+ * schema constrains these routes, so the footer is requested and validated off
40
+ * the last fenced JSON block (D-16c). The normal markdown before that footer is
41
+ * the deliverable; a historical fence-only `output` remains a read fallback. A
42
+ * footer that is missing or broken leaves the run's work_state `unverified`
43
+ * (the instruction says so) — it never fails the run.
44
+ */
45
+ export declare const WORK_REPORT_FENCE_INSTRUCTION: string;
46
+ /** Result of the spec-build envelope decision. */
47
+ export interface ResolvedWorkReportEnvelope {
48
+ /** What rides HarnessRunSpec.output_schema (undefined = leave unset). */
49
+ outputSchema: Record<string, unknown> | undefined;
50
+ mode: WorkReportEnvelopeMode;
51
+ }
52
+ /**
53
+ * Decide the transport envelope for one route at spec build (D-16 §2). The
54
+ * caller's ORIGINAL schema stays the conformance authority for `output` (it is
55
+ * NOT passed here strictified for validation — only the transport copy is).
56
+ *
57
+ * Activated HERE directly for `constrained` routes that natively constrain
58
+ * output and are not interactive-gated (the WorkReport rides the
59
+ * `{work_report, output}` envelope; claude's no-caller `side_tool` case instead
60
+ * arms a `{work_report}`-only schema on the StructuredOutput tool so the markdown
61
+ * final stays the deliverable — the D-16c seam), and for `validated` routes
62
+ * (cursor), where the report rides an INSTRUCTED fenced envelope. Only
63
+ * interactive-gated and schema-incapable routes stay inactive here (disclosed
64
+ * `absent` work_state).
65
+ */
66
+ export declare function resolveWorkReportEnvelope(opts: {
67
+ transport: HarnessCapabilities["work_report_transport"];
68
+ channel: HarnessCapabilities["structured_output_channel"];
69
+ supportsJsonSchemaOutput: boolean;
70
+ interactive: boolean;
71
+ callerSchema: Record<string, unknown> | null;
72
+ }): ResolvedWorkReportEnvelope;
73
+ /** The unwrapped attempt answer plus the extracted WorkReport (or a typed
74
+ * contract violation). `deliverable` is what answer.md / the caller-schema
75
+ * validator must see — never a valid envelope or footer; on an instructed
76
+ * footer problem it is the complete answer text. */
77
+ export interface UnwrappedAnswer {
78
+ deliverable: string;
79
+ workReport: WorkReport | null;
80
+ source: WorkReportSource;
81
+ /** Non-null when an active NATIVE route (constrained_json, side_tool) failed
82
+ * to carry a valid WorkReport — a typed contract failure. */
83
+ contractViolation: string | null;
84
+ /** Parsed model claim retained as evidence only; never a valid WorkReport. */
85
+ reportProblem?: {
86
+ kind: "completed_with_required_inputs";
87
+ reported: WorkReport;
88
+ };
89
+ /** Set when an INSTRUCTED footer (instructed_fence) yielded no valid report:
90
+ * the answer stays whole and the work_state is disclosed as unverified. */
91
+ unverified?: UnverifiedWorkReport;
92
+ }
93
+ /** The disclosed cause of an unverified work_state on an instructed-fence route. */
94
+ export interface UnverifiedWorkReport {
95
+ reason: WorkReportUnverifiedReason;
96
+ detail: string;
97
+ }
98
+ /**
99
+ * Un-nest the WorkReport envelope from an active route's answer (D-16 §2). The
100
+ * behavior forks on `mode.channel`:
101
+ * - `constrained_json`: the whole answer IS `{work_report, output}` JSON; a
102
+ * broken envelope is a typed contract violation.
103
+ * - `side_tool`: the answer text IS the markdown deliverable; the report rides
104
+ * `opts.sideToolReport` (the tool payload the adapter surfaced); a missing or
105
+ * malformed tool report is a typed contract violation.
106
+ * - `instructed_fence`: the LAST fenced JSON block carries metadata; the
107
+ * markdown before it is the deliverable. Historical fence-only envelopes
108
+ * fall back to their string `output`. A missing or broken footer is NOT a
109
+ * violation: see `unwrapInstructedFence`.
110
+ * A non-active mode passes the answer through untouched. The WorkReport
111
+ * cross-field rules (completed ⇒ no required_inputs; needs_input ⇒ ≥1) are
112
+ * enforced HERE so a broken report never passes as a valid one.
113
+ *
114
+ * For a `constrained_json` route `answerText` is the raw `{work_report, output}`
115
+ * envelope (codex #19816 / QA-009: the orchestrator passes `answer.machineText()`,
116
+ * which yields the raw envelope even when the codex adapter pre-unwrapped the
117
+ * DISPLAY copy of the final message — the visible stream sees the output, the
118
+ * un-nest here still sees the envelope).
119
+ */
120
+ export declare function unwrapWorkReportEnvelope(answerText: string, mode: WorkReportEnvelopeMode, opts?: {
121
+ sideToolReport?: unknown;
122
+ }): UnwrappedAnswer;
123
+ //# sourceMappingURL=workReportEnvelope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workReportEnvelope.d.ts","sourceRoot":"","sources":["../src/workReportEnvelope.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAGL,UAAU,EACV,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAChC,MAAM,mBAAmB,CAAC;AAG3B;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,GAAG,WAAW,GAAG,kBAAkB,CAAC;AAEtF;;;;YAIY;AACZ,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,gBAAgB,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,iFAAiF;IACjF,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B,QAY/B,CAAC;AAEZ,kDAAkD;AACl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ision
3
+ * (`resolveWorkReportEnvelope`) and the unwrap (`unwrapWorkReportEnvelope`) for
4
+ * every channel, so a route arms exactly the transport the finalizer later
5
+ * reads. PURE (no I/O, no clock); `attemptFinalize.ts` folds the result.
6
+ */
7
+ import { buildWorkReportEnvelope, strictifyOutputSchema, WorkReport, } from "@claudexor/schema";
8
+ import { redactSecrets } from "@claudexor/util";
9
+ /**
10
+ * The instruction appended to an `instructed_fence` (cursor, agy, acp) route so
11
+ * the model emits the WorkReport footer the finalizer validates. No native
12
+ * schema constrains these routes, so the footer is requested and validated off
13
+ * the last fenced JSON block (D-16c). The normal markdown before that footer is
14
+ * the deliverable; a historical fence-only `output` remains a read fallback. A
15
+ * footer that is missing or broken leaves the run's work_state `unverified`
16
+ * (the instruction says so) — it never fails the run.
17
+ */
18
+ export const WORK_REPORT_FENCE_INSTRUCTION = [
19
+ "Write your complete final answer as normal Markdown.",
20
+ "When you have finished, append a single fenced ```json code block",
21
+ "containing exactly this object and nothing after it:",
22
+ '{"work_report": {"state": "completed" | "needs_input" | "incomplete",',
23
+ '"required_inputs": [{"kind": "file"|"context"|"credential"|"permission"|"decision"|"external_dependency",',
24
+ '"locator": string|null, "description": string}]}}.',
25
+ "Do not duplicate or summarize your answer inside this block.",
26
+ 'Use state "completed" only when the task is fully done with an empty required_inputs list;',
27
+ 'use "needs_input" (with at least one required_inputs entry) when you are blocked on a missing input;',
28
+ 'use "incomplete" when partial work remains.',
29
+ "Always end with this block; without a valid one the engine records your work state as unverified.",
30
+ ].join(" ");
31
+ /**
32
+ * Decide the transport envelope for one route at spec build (D-16 §2). The
33
+ * caller's ORIGINAL schema stays the conformance authority for `output` (it is
34
+ * NOT passed here strictified for validation — only the transport copy is).
35
+ *
36
+ * Activated HERE directly for `constrained` routes that natively constrain
37
+ * output and are not interactive-gated (the WorkReport rides the
38
+ * `{work_report, output}` envelope; claude's no-caller `side_tool` case instead
39
+ * arms a `{work_report}`-only schema on the StructuredOutput tool so the markdown
40
+ * final stays the deliverable — the D-16c seam), and for `validated` routes
41
+ * (cursor), where the report rides an INSTRUCTED fenced envelope. Only
42
+ * interactive-gated and schema-incapable routes stay inactive here (disclosed
43
+ * `absent` work_state).
44
+ */
45
+ export function resolveWorkReportEnvelope(opts) {
46
+ const hasCallerSchema = opts.callerSchema !== null;
47
+ const callerStrict = hasCallerSchema
48
+ ? strictifyOutputSchema(opts.callerSchema)
49
+ : null;
50
+ // `--json-schema` × interactive stream-json is live-verified (claude
51
+ // 2.1.221) and CALLER schemas now ride interactive lanes (the DT2.1-16
52
+ // refusal is gone). The WorkReport side_tool envelope stays gated on
53
+ // interactive lanes as a DELIBERATE scope choice: arming a work-report
54
+ // tool on every interactive run is a behavior change with its own
55
+ // verification debt, not implied by the caller-schema verification. The
56
+ // inactive branch below still carries the caller schema through.
57
+ const interactiveGated = opts.channel === "side_tool" && opts.interactive;
58
+ // `validated` transport (cursor): no native schema constrains the output —
59
+ // the WorkReport rides an INSTRUCTED fenced envelope validated off the last
60
+ // fenced JSON (D-16c). Caller schemas on such routes were already refused by
61
+ // the mandatory-schema gate upstream, so this is the WorkReport-only case.
62
+ if (opts.transport === "validated" && !interactiveGated) {
63
+ return {
64
+ outputSchema: callerStrict ?? undefined,
65
+ mode: {
66
+ active: true,
67
+ source: "validated",
68
+ hasCallerSchema,
69
+ channel: "instructed_fence",
70
+ instruction: WORK_REPORT_FENCE_INSTRUCTION,
71
+ },
72
+ };
73
+ }
74
+ const active = opts.transport === "constrained" && opts.supportsJsonSchemaOutput && !interactiveGated;
75
+ if (active) {
76
+ // claude side_tool WITHOUT a caller schema (D-16c): arm a {work_report}-only
77
+ // schema on the StructuredOutput tool; the markdown final message stays the
78
+ // deliverable and the report rides the tool payload. Every other constrained
79
+ // case carries the output INSIDE the `{work_report, output}` envelope
80
+ // (caller schema → the strict S; no-caller final_message → output:string).
81
+ if (opts.channel === "side_tool" && !hasCallerSchema) {
82
+ return {
83
+ outputSchema: buildWorkReportEnvelope(null),
84
+ mode: {
85
+ active: true,
86
+ source: "constrained",
87
+ hasCallerSchema,
88
+ channel: "side_tool",
89
+ instruction: null,
90
+ },
91
+ };
92
+ }
93
+ const output = hasCallerSchema
94
+ ? callerStrict
95
+ : "string";
96
+ return {
97
+ outputSchema: buildWorkReportEnvelope(output),
98
+ mode: {
99
+ active: true,
100
+ source: "constrained",
101
+ hasCallerSchema,
102
+ channel: "constrained_json",
103
+ instruction: null,
104
+ },
105
+ };
106
+ }
107
+ return {
108
+ // Legacy path preserved: a caller schema still rides (strictified) on a
109
+ // non-activated route (the mandatory-schema gate already refused
110
+ // schema-incapable routes upstream).
111
+ outputSchema: callerStrict ?? undefined,
112
+ mode: {
113
+ active: false,
114
+ source: "absent",
115
+ hasCallerSchema,
116
+ channel: "constrained_json",
117
+ instruction: null,
118
+ },
119
+ };
120
+ }
121
+ function extractOutput(obj, mode) {
122
+ const output = obj["output"];
123
+ if (mode.hasCallerSchema) {
124
+ // Re-serialize the S-conformant object so finalizeStructuredOutput can
125
+ // JSON.parse + validate it against the caller schema (the caller schema is
126
+ // the conformance authority for `output`, so any shape rides through here).
127
+ return { deliverable: output === undefined ? "" : JSON.stringify(output) };
128
+ }
129
+ // No caller schema: `output` MUST be a string deliverable. A non-string
130
+ // (object/array/null/number/bool) or missing `output` is a BROKEN envelope —
131
+ // coercing it (String({...}) => "[object Object]") would let a bogus payload
132
+ // like {"work_report":{"state":"completed"},"output":{}} finalize CLEAN
133
+ // instead of failing the WorkReport contract. Fail it here (D-16 §2).
134
+ if (typeof output !== "string") {
135
+ return { violation: "work_report envelope output must be a string" };
136
+ }
137
+ return { deliverable: output };
138
+ }
139
+ /** Extract the LAST fenced ```…``` block's body (its optional language tag
140
+ * stripped) and the complete prefix before its opening fence, or null when the
141
+ * text has no closed fence. No-regex, mechanical transport parsing (INV-049
142
+ * governs the typed WorkReport, not this seam). */
143
+ function lastFencedBlock(text) {
144
+ const FENCE = "```";
145
+ const end = text.lastIndexOf(FENCE);
146
+ if (end <= 0)
147
+ return null;
148
+ const start = text.lastIndexOf(FENCE, end - 1);
149
+ if (start < 0)
150
+ return null;
151
+ let inner = text.slice(start + FENCE.length, end);
152
+ const nl = inner.indexOf("\n");
153
+ if (nl >= 0) {
154
+ const firstLine = inner.slice(0, nl).trim();
155
+ // A bare language tag (letters/digits/±_-, no whitespace) on the opening
156
+ // line is dropped; a first line that is already JSON content is kept.
157
+ const isLangTag = firstLine.length > 0 &&
158
+ firstLine.length <= 20 &&
159
+ ![...firstLine].some((ch) => ch === " " || ch === "{" || ch === "[" || ch === '"');
160
+ if (firstLine === "" || isLangTag)
161
+ inner = inner.slice(nl + 1);
162
+ }
163
+ return {
164
+ body: inner.trim(),
165
+ // Remove only the separator before the metadata footer. The caller owns
166
+ // any further presentation trimming; all authored markdown stays intact.
167
+ prefix: text.slice(0, start).trimEnd(),
168
+ };
169
+ }
170
+ /**
171
+ * Un-nest the WorkReport envelope from an active route's answer (D-16 §2). The
172
+ * behavior forks on `mode.channel`:
173
+ * - `constrained_json`: the whole answer IS `{work_report, output}` JSON; a
174
+ * broken envelope is a typed contract violation.
175
+ * - `side_tool`: the answer text IS the markdown deliverable; the report rides
176
+ * `opts.sideToolReport` (the tool payload the adapter surfaced); a missing or
177
+ * malformed tool report is a typed contract violation.
178
+ * - `instructed_fence`: the LAST fenced JSON block carries metadata; the
179
+ * markdown before it is the deliverable. Historical fence-only envelopes
180
+ * fall back to their string `output`. A missing or broken footer is NOT a
181
+ * violation: see `unwrapInstructedFence`.
182
+ * A non-active mode passes the answer through untouched. The WorkReport
183
+ * cross-field rules (completed ⇒ no required_inputs; needs_input ⇒ ≥1) are
184
+ * enforced HERE so a broken report never passes as a valid one.
185
+ *
186
+ * For a `constrained_json` route `answerText` is the raw `{work_report, output}`
187
+ * envelope (codex #19816 / QA-009: the orchestrator passes `answer.machineText()`,
188
+ * which yields the raw envelope even when the codex adapter pre-unwrapped the
189
+ * DISPLAY copy of the final message — the visible stream sees the output, the
190
+ * un-nest here still sees the envelope).
191
+ */
192
+ export function unwrapWorkReportEnvelope(answerText, mode, opts = {}) {
193
+ if (!mode.active) {
194
+ return {
195
+ deliverable: answerText,
196
+ workReport: null,
197
+ source: mode.source,
198
+ contractViolation: null,
199
+ };
200
+ }
201
+ const violation = (contractViolation) => ({
202
+ deliverable: answerText,
203
+ workReport: null,
204
+ source: mode.source,
205
+ contractViolation,
206
+ });
207
+ // side_tool: the markdown answer stays the deliverable; the report is the tool
208
+ // payload. A missing/malformed tool report is a typed contract failure.
209
+ if (mode.channel === "side_tool") {
210
+ if (opts.sideToolReport === undefined)
211
+ return violation("the StructuredOutput tool did not carry a work_report");
212
+ return validateWorkReport(answerText, opts.sideToolReport, mode.source);
213
+ }
214
+ if (mode.channel === "instructed_fence")
215
+ return unwrapInstructedFence(answerText, mode);
216
+ let parsed;
217
+ try {
218
+ parsed = JSON.parse(answerText.trim());
219
+ }
220
+ catch {
221
+ return violation("final answer is not the JSON work_report envelope");
222
+ }
223
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
224
+ return violation("work_report envelope is not a JSON object");
225
+ }
226
+ const obj = parsed;
227
+ const extracted = extractOutput(obj, mode);
228
+ if ("violation" in extracted)
229
+ return violation(extracted.violation);
230
+ return validateWorkReport(extracted.deliverable, obj["work_report"], mode.source);
231
+ }
232
+ /**
233
+ * The instructed fence (cursor, agy, acp): the model was ASKED for a trailing
234
+ * fenced `{work_report}` block; nothing constrains it natively, so a missing or
235
+ * broken footer is a disclosed `unverified` work_state with a typed reason,
236
+ * never a failure (owner decision 2026-10-05, partially revising the 2026-10-04
237
+ * strict reading; the two native channels stay strict because there the
238
+ * envelope is the only witness of a substituted final).
239
+ *
240
+ * Every unverified outcome keeps the COMPLETE answer text as the deliverable:
241
+ * nothing is cut. A trailing fence that is not a footer — prose, code, an
242
+ * array, an object without `work_report` — is the consumer's own content, and
243
+ * a broken footer attempt stays visible too, so a malformed `needs_input`
244
+ * claim is never hidden from the reader (the contradiction claim is also
245
+ * retained as typed evidence). Only a VALID report is metadata and leaves the
246
+ * deliverable: the prefix is the answer (completed → completed;
247
+ * needs_input/incomplete → veto), and a historical fence-only
248
+ * `{work_report, output}` reply yields its string output.
249
+ */
250
+ function unwrapInstructedFence(answerText, mode) {
251
+ const unverified = (reason, detail) => ({
252
+ deliverable: answerText,
253
+ workReport: null,
254
+ source: mode.source,
255
+ contractViolation: null,
256
+ unverified: { reason, detail },
257
+ });
258
+ const fenced = lastFencedBlock(answerText);
259
+ if (fenced === null)
260
+ return unverified("footer_missing", "final answer has no fenced work_report block");
261
+ let parsed;
262
+ try {
263
+ parsed = JSON.parse(fenced.body);
264
+ }
265
+ catch {
266
+ return unverified("footer_not_json", "the last fenced block is not JSON");
267
+ }
268
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
269
+ return unverified("footer_not_object", "the last fenced block is not a JSON object");
270
+ const obj = parsed;
271
+ if (!("work_report" in obj))
272
+ return unverified("report_missing", "the last fenced block carries no work_report");
273
+ const check = checkWorkReport(obj["work_report"]);
274
+ if (!check.ok) {
275
+ return {
276
+ ...unverified(check.reason, check.detail),
277
+ ...(check.reportProblem ? { reportProblem: check.reportProblem } : {}),
278
+ };
279
+ }
280
+ // The complete normal markdown is canonical. The legacy output slot is
281
+ // consulted only for historical fence-only replies; when both exist the
282
+ // prefix wins deterministically, without length/heading heuristics that
283
+ // could silently replace a full answer with a summary. A footer-only reply
284
+ // is still a valid report with an empty deliverable (each consumer keeps its
285
+ // product rule: Ask/report may surface "(no output)", Plan/reducer need prose).
286
+ const prefix = fenced.prefix.trim() ? fenced.prefix : null;
287
+ let deliverable = prefix ?? "";
288
+ if (prefix === null && obj["output"] !== undefined) {
289
+ const extracted = extractOutput(obj, mode);
290
+ if ("violation" in extracted) {
291
+ // An unusable historical output slot never downgrades a valid veto: the
292
+ // needs_input/incomplete report stands and the whole reply is kept.
293
+ if (check.report.state === "completed")
294
+ return unverified("legacy_output_invalid", extracted.violation);
295
+ deliverable = answerText;
296
+ }
297
+ else {
298
+ deliverable = extracted.deliverable;
299
+ }
300
+ }
301
+ return { deliverable, workReport: check.report, source: mode.source, contractViolation: null };
302
+ }
303
+ /** Parse + cross-field-check a raw work_report value. The cross-field rules
304
+ * (completed ⇒ no required_inputs; needs_input ⇒ ≥1) live HERE, not on the
305
+ * permissive Zod wire type. */
306
+ function checkWorkReport(rawReport) {
307
+ const wr = WorkReport.safeParse(rawReport);
308
+ if (!wr.success) {
309
+ return {
310
+ ok: false,
311
+ reason: "report_malformed",
312
+ detail: `work_report missing or malformed: ${wr.error.issues[0]?.message ?? "invalid"}`,
313
+ };
314
+ }
315
+ // ONE redaction owner for every WorkReport transport: the model-authored
316
+ // locator/description strings flow VERBATIM into telemetry yaml, decision
317
+ // facts, and the CLI needsInputLabel — the last reads the local artifact and
318
+ // bypasses serve-time redaction — so a token pasted into a required_input
319
+ // would otherwise persist unredacted at rest. Redact here, before the report
320
+ // is handed to any of them. (The cross-field checks below read only state and
321
+ // list length, so redaction order does not affect them.)
322
+ const report = {
323
+ ...wr.data,
324
+ required_inputs: wr.data.required_inputs.map((ri) => ({
325
+ ...ri,
326
+ locator: ri.locator === null ? null : redactSecrets(ri.locator),
327
+ description: redactSecrets(ri.description),
328
+ })),
329
+ };
330
+ if (report.state === "completed" && report.required_inputs.length > 0) {
331
+ return {
332
+ ok: false,
333
+ reason: "report_contradictory",
334
+ detail: "a completed work_report must not list required_inputs",
335
+ reportProblem: { kind: "completed_with_required_inputs", reported: report },
336
+ };
337
+ }
338
+ if (report.state === "needs_input" && report.required_inputs.length === 0) {
339
+ return {
340
+ ok: false,
341
+ reason: "report_contradictory",
342
+ detail: "a needs_input work_report must list at least one required_input",
343
+ };
344
+ }
345
+ return { ok: true, report };
346
+ }
347
+ /** Validate a raw work_report for a NATIVE channel against a resolved
348
+ * deliverable: a malformed or contradictory report is a typed contract
349
+ * violation (the contradiction claim is retained as evidence). */
350
+ function validateWorkReport(deliverable, rawReport, source) {
351
+ const check = checkWorkReport(rawReport);
352
+ if (check.ok)
353
+ return { deliverable, workReport: check.report, source, contractViolation: null };
354
+ return {
355
+ deliverable,
356
+ workReport: null,
357
+ source,
358
+ contractViolation: check.detail,
359
+ ...(check.reportProblem ? { reportProblem: check.reportProblem } : {}),
360
+ };
361
+ }
362
+ //# sourceMappingURL=workReportEnvelope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workReportEnvelope.js","sourceRoot":"","sources":["../src/workReportEnvelope.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,UAAU,GAIX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAgChD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,sDAAsD;IACtD,mEAAmE;IACnE,sDAAsD;IACtD,uEAAuE;IACvE,2GAA2G;IAC3G,oDAAoD;IACpD,8DAA8D;IAC9D,4FAA4F;IAC5F,sGAAsG;IACtG,6CAA6C;IAC7C,mGAAmG;CACpG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AASZ;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAMzC;IACC,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC;IACnD,MAAM,YAAY,GAAG,eAAe;QAClC,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC,YAAuC,CAAC;QACrE,CAAC,CAAC,IAAI,CAAC;IACT,qEAAqE;IACrE,uEAAuE;IACvE,qEAAqE;IACrE,uEAAuE;IACvE,kEAAkE;IAClE,wEAAwE;IACxE,iEAAiE;IACjE,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,KAAK,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC;IAE1E,2EAA2E;IAC3E,4EAA4E;IAC5E,6EAA6E;IAC7E,2EAA2E;IAC3E,IAAI,IAAI,CAAC,SAAS,KAAK,WA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EAAE,CAAC;IAChG,OAAO;QACL,WAAW;QACX,UAAU,EAAE,IAAI;QAChB,MAAM;QACN,iBAAiB,EAAE,KAAK,CAAC,MAAM;QAC/B,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACvE,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claudexor/orchestrator",
3
- "version": "3.20.1",
3
+ "version": "3.22.0",
4
4
  "license": "MIT",
5
5
  "description": "Hub that composes all subsystems and implements the three canonical intents (ask, plan, agent) with their strategy flags (ask deep-scan, plan solo/council, agent best-of-N race, attempt caps, until-clean, create, delegate).",
6
6
  "type": "module",
@@ -17,24 +17,24 @@
17
17
  ],
18
18
  "dependencies": {
19
19
  "ajv": "^8.20.0",
20
- "@claudexor/arbitration": "3.20.1",
21
- "@claudexor/artifact-store": "3.20.1",
22
- "@claudexor/config": "3.20.1",
23
- "@claudexor/budget": "3.20.1",
24
- "@claudexor/context": "3.20.1",
25
- "@claudexor/core": "3.20.1",
26
- "@claudexor/delivery": "3.20.1",
27
- "@claudexor/event-log": "3.20.1",
28
- "@claudexor/gateway": "3.20.1",
29
- "@claudexor/review": "3.20.1",
30
- "@claudexor/policy": "3.20.1",
31
- "@claudexor/schema": "3.20.1",
32
- "@claudexor/synthesis": "3.20.1",
33
- "@claudexor/util": "3.20.1",
34
- "@claudexor/workspace": "3.20.1"
20
+ "@claudexor/arbitration": "3.22.0",
21
+ "@claudexor/artifact-store": "3.22.0",
22
+ "@claudexor/budget": "3.22.0",
23
+ "@claudexor/context": "3.22.0",
24
+ "@claudexor/config": "3.22.0",
25
+ "@claudexor/core": "3.22.0",
26
+ "@claudexor/event-log": "3.22.0",
27
+ "@claudexor/delivery": "3.22.0",
28
+ "@claudexor/gateway": "3.22.0",
29
+ "@claudexor/policy": "3.22.0",
30
+ "@claudexor/review": "3.22.0",
31
+ "@claudexor/schema": "3.22.0",
32
+ "@claudexor/synthesis": "3.22.0",
33
+ "@claudexor/util": "3.22.0",
34
+ "@claudexor/workspace": "3.22.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@claudexor/harness-fake": "3.20.1"
37
+ "@claudexor/harness-fake": "3.22.0"
38
38
  },
39
39
  "repository": {
40
40
  "type": "git",
@@ -1,13 +0,0 @@
1
- import type { EffortHint } from "@claudexor/schema";
2
- export interface EffortGovernedRoute {
3
- id: string;
4
- effortLevels: readonly EffortHint[];
5
- }
6
- /** Discovery describes the default account, not necessarily the selected one.
7
- * Preserve the preference until the adapter resolves the final native route.
8
- * Unsupported knobs are disclosed there, without erasing the original request. */
9
- export declare function governRouteEffort(requested: EffortHint | null, _route: EffortGovernedRoute): {
10
- effort: EffortHint | null;
11
- ignored: string | null;
12
- };
13
- //# sourceMappingURL=effortGovernance.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"effortGovernance.d.ts","sourceRoot":"","sources":["../src/effortGovernance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,SAAS,UAAU,EAAE,CAAC;CACrC;AAED;;kFAEkF;AAClF,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,UAAU,GAAG,IAAI,EAC5B,MAAM,EAAE,mBAAmB,GAC1B;IAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAEvD"}
@@ -1,7 +0,0 @@
1
- /** Discovery describes the default account, not necessarily the selected one.
2
- * Preserve the preference until the adapter resolves the final native route.
3
- * Unsupported knobs are disclosed there, without erasing the original request. */
4
- export function governRouteEffort(requested, _route) {
5
- return { effort: requested, ignored: null };
6
- }
7
- //# sourceMappingURL=effortGovernance.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"effortGovernance.js","sourceRoot":"","sources":["../src/effortGovernance.ts"],"names":[],"mappings":"AAOA;;kFAEkF;AAClF,MAAM,UAAU,iBAAiB,CAC/B,SAA4B,EAC5B,MAA2B;IAE3B,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC9C,CAAC"}