@claudexor/orchestrator 3.0.4 → 3.1.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.
- package/dist/attemptFinalize.d.ts +162 -0
- package/dist/attemptFinalize.d.ts.map +1 -0
- package/dist/attemptFinalize.js +368 -0
- package/dist/attemptFinalize.js.map +1 -0
- package/dist/attemptTelemetry.d.ts +88 -7
- package/dist/attemptTelemetry.d.ts.map +1 -1
- package/dist/attemptTelemetry.js +276 -14
- package/dist/attemptTelemetry.js.map +1 -1
- package/dist/budgetFailure.d.ts +70 -0
- package/dist/budgetFailure.d.ts.map +1 -0
- package/dist/budgetFailure.js +114 -0
- package/dist/budgetFailure.js.map +1 -0
- package/dist/candidateEvidence.d.ts +55 -1
- package/dist/candidateEvidence.d.ts.map +1 -1
- package/dist/candidateEvidence.js +72 -0
- package/dist/candidateEvidence.js.map +1 -1
- package/dist/continuation.d.ts +77 -0
- package/dist/continuation.d.ts.map +1 -0
- package/dist/continuation.js +92 -0
- package/dist/continuation.js.map +1 -0
- package/dist/deepScanReducer.d.ts +148 -0
- package/dist/deepScanReducer.d.ts.map +1 -0
- package/dist/deepScanReducer.js +352 -0
- package/dist/deepScanReducer.js.map +1 -0
- package/dist/harnessFailure.d.ts +27 -0
- package/dist/harnessFailure.d.ts.map +1 -0
- package/dist/harnessFailure.js +61 -0
- package/dist/harnessFailure.js.map +1 -0
- package/dist/orchestrator.d.ts +97 -10
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +1213 -295
- package/dist/orchestrator.js.map +1 -1
- package/dist/planQuestions.d.ts.map +1 -1
- package/dist/planQuestions.js +105 -50
- package/dist/planQuestions.js.map +1 -1
- package/dist/planRun.d.ts +15 -7
- package/dist/planRun.d.ts.map +1 -1
- package/dist/planRun.js +88 -42
- package/dist/planRun.js.map +1 -1
- package/dist/planTerminal.d.ts +36 -0
- package/dist/planTerminal.d.ts.map +1 -0
- package/dist/planTerminal.js +63 -0
- package/dist/planTerminal.js.map +1 -0
- package/dist/runSupport.d.ts +50 -2
- package/dist/runSupport.d.ts.map +1 -1
- package/dist/runSupport.js +60 -6
- package/dist/runSupport.js.map +1 -1
- package/dist/runTelemetryWriter.d.ts +6 -1
- package/dist/runTelemetryWriter.d.ts.map +1 -1
- package/dist/runTelemetryWriter.js +2 -0
- package/dist/runTelemetryWriter.js.map +1 -1
- package/dist/runTerminals.d.ts +15 -4
- package/dist/runTerminals.d.ts.map +1 -1
- package/dist/runTerminals.js +16 -1
- package/dist/runTerminals.js.map +1 -1
- package/dist/structuredOutput.d.ts +27 -0
- package/dist/structuredOutput.d.ts.map +1 -1
- package/dist/structuredOutput.js +65 -7
- package/dist/structuredOutput.js.map +1 -1
- package/dist/transientClassify.d.ts +59 -0
- package/dist/transientClassify.d.ts.map +1 -0
- package/dist/transientClassify.js +109 -0
- package/dist/transientClassify.js.map +1 -0
- package/package.json +17 -17
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* D-16 unified attempt finalizer.
|
|
3
|
+
*
|
|
4
|
+
* ONE owner for the "did this attempt deliver, and in what work_state?" decision
|
|
5
|
+
* — replacing the three divergent deliverable predicates (candidate diff||answer;
|
|
6
|
+
* planner no-error⇒delivered; read-only nonempty-report). It folds the raw
|
|
7
|
+
* intent-specific deliverable evidence with the model-authored WorkReport, the
|
|
8
|
+
* typed context signals, the harness error state, and the gates into:
|
|
9
|
+
* - a final `deliverablePresent`,
|
|
10
|
+
* - a `work_state` axis (orthogonal to lifecycle, INV-116),
|
|
11
|
+
* - a typed reason,
|
|
12
|
+
* - and the class of outcome (clean / veto / contract-failure / interrupted).
|
|
13
|
+
*
|
|
14
|
+
* The module is PURE (no I/O, no clock). The envelope compile/unwrap helpers
|
|
15
|
+
* live here too so the spec-build decision and the finalizer read one contract.
|
|
16
|
+
*/
|
|
17
|
+
import { WorkReport, type HarnessCapabilities, type RunReason, type WorkReportSource, type WorkState } from "@claudexor/schema";
|
|
18
|
+
/**
|
|
19
|
+
* How the WorkReport rides the wire for an active envelope (D-16c):
|
|
20
|
+
* - `constrained_json`: the whole final answer IS the `{work_report, output}`
|
|
21
|
+
* JSON (codex `--output-schema`; claude `--json-schema` WITH a caller schema).
|
|
22
|
+
* - `side_tool`: a `{work_report}`-only schema arms claude's StructuredOutput
|
|
23
|
+
* TOOL; the markdown final message stays the deliverable and the report rides
|
|
24
|
+
* the tool payload (surfaced on the final message's `work_report_side_tool`).
|
|
25
|
+
* - `instructed_fence`: no native constraint — the model is INSTRUCTED to end
|
|
26
|
+
* its answer with a fenced `{work_report, output}` JSON block, validated off
|
|
27
|
+
* the last fenced JSON (cursor).
|
|
28
|
+
*/
|
|
29
|
+
export type WorkReportChannel = "constrained_json" | "side_tool" | "instructed_fence";
|
|
30
|
+
/** The per-attempt envelope decision made at spec build and consumed by the
|
|
31
|
+
* unwrap. `active` means the orchestrator actually armed a WorkReport transport
|
|
32
|
+
* for this route, so a missing/malformed report is a typed contract failure. */
|
|
33
|
+
export interface WorkReportEnvelopeMode {
|
|
34
|
+
active: boolean;
|
|
35
|
+
source: WorkReportSource;
|
|
36
|
+
hasCallerSchema: boolean;
|
|
37
|
+
channel: WorkReportChannel;
|
|
38
|
+
/** Instruction to APPEND to the spec (instructed_fence only); null otherwise. */
|
|
39
|
+
instruction: string | null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The instruction appended to an `instructed_fence` (cursor) route so the model
|
|
43
|
+
* emits the WorkReport envelope the finalizer validates. No native schema
|
|
44
|
+
* constrains cursor, so the contract is instructed and validated off the last
|
|
45
|
+
* fenced JSON block (D-16c). The `output` string carries the deliverable prose.
|
|
46
|
+
*/
|
|
47
|
+
export declare const WORK_REPORT_FENCE_INSTRUCTION: string;
|
|
48
|
+
/** Result of the spec-build envelope decision. */
|
|
49
|
+
export interface ResolvedWorkReportEnvelope {
|
|
50
|
+
/** What rides HarnessRunSpec.output_schema (undefined = leave unset). */
|
|
51
|
+
outputSchema: Record<string, unknown> | undefined;
|
|
52
|
+
mode: WorkReportEnvelopeMode;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Decide the transport envelope for one route at spec build (D-16 §2). The
|
|
56
|
+
* caller's ORIGINAL schema stays the conformance authority for `output` (it is
|
|
57
|
+
* NOT passed here strictified for validation — only the transport copy is).
|
|
58
|
+
*
|
|
59
|
+
* Activated HERE directly for `constrained` routes that natively constrain
|
|
60
|
+
* output and are not interactive-gated (the WorkReport rides the
|
|
61
|
+
* `{work_report, output}` envelope; claude's no-caller `side_tool` case instead
|
|
62
|
+
* arms a `{work_report}`-only schema on the StructuredOutput tool so the markdown
|
|
63
|
+
* final stays the deliverable — the D-16c seam), and for `validated` routes
|
|
64
|
+
* (cursor), where the report rides an INSTRUCTED fenced envelope. Only
|
|
65
|
+
* interactive-gated and schema-incapable routes stay inactive here (disclosed
|
|
66
|
+
* `absent` work_state).
|
|
67
|
+
*/
|
|
68
|
+
export declare function resolveWorkReportEnvelope(opts: {
|
|
69
|
+
transport: HarnessCapabilities["work_report_transport"];
|
|
70
|
+
channel: HarnessCapabilities["structured_output_channel"];
|
|
71
|
+
supportsJsonSchemaOutput: boolean;
|
|
72
|
+
interactive: boolean;
|
|
73
|
+
callerSchema: Record<string, unknown> | null;
|
|
74
|
+
}): ResolvedWorkReportEnvelope;
|
|
75
|
+
/** The unwrapped attempt answer plus the extracted WorkReport (or a typed
|
|
76
|
+
* contract violation). `deliverable` is what answer.md / the caller-schema
|
|
77
|
+
* validator must see — never the envelope. */
|
|
78
|
+
export interface UnwrappedAnswer {
|
|
79
|
+
deliverable: string;
|
|
80
|
+
workReport: WorkReport | null;
|
|
81
|
+
source: WorkReportSource;
|
|
82
|
+
/** Non-null when an active route failed to carry a valid WorkReport. */
|
|
83
|
+
contractViolation: string | null;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Un-nest the WorkReport envelope from an active route's answer (D-16 §2). The
|
|
87
|
+
* behavior forks on `mode.channel`:
|
|
88
|
+
* - `constrained_json`: the whole answer IS `{work_report, output}` JSON.
|
|
89
|
+
* - `instructed_fence`: the envelope is the LAST fenced JSON block; prose
|
|
90
|
+
* before it is discarded (the `output` string is the deliverable).
|
|
91
|
+
* - `side_tool`: the answer text IS the markdown deliverable; the report rides
|
|
92
|
+
* `opts.sideToolReport` (the tool payload the adapter surfaced).
|
|
93
|
+
* A non-active mode passes the answer through untouched. The WorkReport
|
|
94
|
+
* cross-field rules (completed ⇒ no required_inputs; needs_input ⇒ ≥1) are
|
|
95
|
+
* enforced HERE so a broken report is a typed contract violation.
|
|
96
|
+
*
|
|
97
|
+
* For a `constrained_json` route `answerText` is the raw `{work_report, output}`
|
|
98
|
+
* envelope (codex #19816 / QA-009: the orchestrator passes `answer.machineText()`,
|
|
99
|
+
* which yields the raw envelope even when the codex adapter pre-unwrapped the
|
|
100
|
+
* DISPLAY copy of the final message — the visible stream sees the output, the
|
|
101
|
+
* un-nest here still sees the envelope).
|
|
102
|
+
*/
|
|
103
|
+
export declare function unwrapWorkReportEnvelope(answerText: string, mode: WorkReportEnvelopeMode, opts?: {
|
|
104
|
+
sideToolReport?: unknown;
|
|
105
|
+
}): UnwrappedAnswer;
|
|
106
|
+
/**
|
|
107
|
+
* QA-036: the terminal outcome facts for a read-only (ask) run that produced NO
|
|
108
|
+
* successful attempt. The D8 legacy mapping treated ANY web-blocked run as a
|
|
109
|
+
* succeeded/review_blocked terminal (exit 0, "Needs review"); a blocked Ask that
|
|
110
|
+
* delivered nothing then read as done. This re-checks the DELIVERABLE: only a
|
|
111
|
+
* blocked attempt that actually produced a partial answer is a review-blocked
|
|
112
|
+
* SUCCESS; an empty blocked (or plain failed) run is a failure (exit 1).
|
|
113
|
+
*/
|
|
114
|
+
export declare function readOnlyNoSuccessTerminal(opts: {
|
|
115
|
+
webBlocked: boolean;
|
|
116
|
+
hasDeliverable: boolean;
|
|
117
|
+
budgetStopped: boolean;
|
|
118
|
+
attemptsCount: number;
|
|
119
|
+
}): {
|
|
120
|
+
lifecycle: "succeeded" | "failed";
|
|
121
|
+
review?: "blocked";
|
|
122
|
+
reason: RunReason;
|
|
123
|
+
};
|
|
124
|
+
/** Everything the finalizer folds for one attempt. The gate/web/belt axes are
|
|
125
|
+
* NOT folded here — the finalizer decides deliverable+work_state, and
|
|
126
|
+
* `setAttemptOutcome` runs the status math over gates/web/belt on top (so a
|
|
127
|
+
* `completed` claim with a failed gate still yields a failed status there). */
|
|
128
|
+
export interface FinalizeAttemptInput {
|
|
129
|
+
/** Raw intent-specific deliverable evidence (diff/answer/report present). */
|
|
130
|
+
deliverableEvidence: boolean;
|
|
131
|
+
harnessErrored: boolean;
|
|
132
|
+
workReport: WorkReport | null;
|
|
133
|
+
workReportSource: WorkReportSource;
|
|
134
|
+
/** Non-null when an active route failed its WorkReport contract. */
|
|
135
|
+
workReportViolation: string | null;
|
|
136
|
+
/** A terminal capacity_exhausted context signal was observed this attempt. */
|
|
137
|
+
contextTerminalExhausted: boolean;
|
|
138
|
+
}
|
|
139
|
+
/** Outcome class the run-level terminal maps onto lifecycle/facts. */
|
|
140
|
+
export type AttemptOutcomeClass = "clean" | "veto" | "contract_failure" | "interrupted";
|
|
141
|
+
export interface FinalizeAttemptResult {
|
|
142
|
+
/** Final deliverable presence (a completed claim never invents evidence). */
|
|
143
|
+
deliverablePresent: boolean;
|
|
144
|
+
/** Final harness-error state (a contract failure elevates it). */
|
|
145
|
+
harnessErrored: boolean;
|
|
146
|
+
workState: WorkState;
|
|
147
|
+
/** Typed reason for the veto/failure; null on a clean outcome. */
|
|
148
|
+
reason: RunReason | null;
|
|
149
|
+
outcomeClass: AttemptOutcomeClass;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The unified finalizer. Precedence (hardest signal wins):
|
|
153
|
+
* 1. terminal context exhaustion with no completed report ⇒ interrupted;
|
|
154
|
+
* 2. a broken WorkReport contract on a constrained route ⇒ hard failure
|
|
155
|
+
* (never prose-success);
|
|
156
|
+
* 3. a valid needs_input/incomplete report ⇒ veto (lifecycle stays, run is
|
|
157
|
+
* non-applyable, exit non-zero) — a `completed` claim NEVER overrides a
|
|
158
|
+
* harness error / failed gate / missing evidence;
|
|
159
|
+
* 4. otherwise the disclosed work_state (completed or unverified).
|
|
160
|
+
*/
|
|
161
|
+
export declare function finalizeAttempt(input: FinalizeAttemptInput): FinalizeAttemptResult;
|
|
162
|
+
//# sourceMappingURL=attemptFinalize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attemptFinalize.d.ts","sourceRoot":"","sources":["../src/attemptFinalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAGL,UAAU,EACV,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACf,MAAM,mBAAmB,CAAC;AAG3B;;;;;;;;;;GAUG;AACH,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,GAAG,WAAW,GAAG,kBAAkB,CAAC;AAEtF;;gFAEgF;AAChF,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;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,QAS/B,CAAC;AAEZ,kDAAkD;AAClD,MAAM,WAAW,0BAA0B;IACzC,yEAAyE;IACzE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAClD,IAAI,EAAE,sBAAsB,CAAC;CAC9B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC9C,SAAS,EAAE,mBAAmB,CAAC,uBAAuB,CAAC,CAAC;IACxD,OAAO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;CACnC;AAED,sEAAsE;AACtE,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,MAAM,GAAG,kBAAkB,GAAG,aAAa,CAAC;AAExF,MAAM,WAAW,qBAAqB;IACpC,6EAA6E;IAC7E,kBAAkB,EAAE,OAAO,CAAC;IAC5B,kEAAkE;IAClE,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB,kEAAkE;IAClE,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB,YAAY,EAAE,mBAAmB,CAAC;CACnC;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,qBAAqB,CAkDlF"}
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* D-16 unified attempt finalizer.
|
|
3
|
+
*
|
|
4
|
+
* ONE owner for the "did this attempt deliver, and in what work_state?" decision
|
|
5
|
+
* — replacing the three divergent deliverable predicates (candidate diff||answer;
|
|
6
|
+
* planner no-error⇒delivered; read-only nonempty-report). It folds the raw
|
|
7
|
+
* intent-specific deliverable evidence with the model-authored WorkReport, the
|
|
8
|
+
* typed context signals, the harness error state, and the gates into:
|
|
9
|
+
* - a final `deliverablePresent`,
|
|
10
|
+
* - a `work_state` axis (orthogonal to lifecycle, INV-116),
|
|
11
|
+
* - a typed reason,
|
|
12
|
+
* - and the class of outcome (clean / veto / contract-failure / interrupted).
|
|
13
|
+
*
|
|
14
|
+
* The module is PURE (no I/O, no clock). The envelope compile/unwrap helpers
|
|
15
|
+
* live here too so the spec-build decision and the finalizer read one contract.
|
|
16
|
+
*/
|
|
17
|
+
import { buildWorkReportEnvelope, strictifyOutputSchema, WorkReport, } from "@claudexor/schema";
|
|
18
|
+
import { redactSecrets } from "@claudexor/util";
|
|
19
|
+
/**
|
|
20
|
+
* The instruction appended to an `instructed_fence` (cursor) route so the model
|
|
21
|
+
* emits the WorkReport envelope the finalizer validates. No native schema
|
|
22
|
+
* constrains cursor, so the contract is instructed and validated off the last
|
|
23
|
+
* fenced JSON block (D-16c). The `output` string carries the deliverable prose.
|
|
24
|
+
*/
|
|
25
|
+
export const WORK_REPORT_FENCE_INSTRUCTION = [
|
|
26
|
+
"When you have finished, end your reply with a single fenced ```json code block",
|
|
27
|
+
"containing exactly this object and nothing after it:",
|
|
28
|
+
'{"work_report": {"state": "completed" | "needs_input" | "incomplete",',
|
|
29
|
+
'"required_inputs": [{"kind": "file"|"context"|"credential"|"permission"|"decision"|"external_dependency",',
|
|
30
|
+
'"locator": string|null, "description": string}]}, "output": "<your final answer as a string>"}.',
|
|
31
|
+
'Use state "completed" only when the task is fully done with an empty required_inputs list;',
|
|
32
|
+
'use "needs_input" (with at least one required_inputs entry) when you are blocked on a missing input;',
|
|
33
|
+
'use "incomplete" when partial work remains. This block is mandatory.',
|
|
34
|
+
].join(" ");
|
|
35
|
+
/**
|
|
36
|
+
* Decide the transport envelope for one route at spec build (D-16 §2). The
|
|
37
|
+
* caller's ORIGINAL schema stays the conformance authority for `output` (it is
|
|
38
|
+
* NOT passed here strictified for validation — only the transport copy is).
|
|
39
|
+
*
|
|
40
|
+
* Activated HERE directly for `constrained` routes that natively constrain
|
|
41
|
+
* output and are not interactive-gated (the WorkReport rides the
|
|
42
|
+
* `{work_report, output}` envelope; claude's no-caller `side_tool` case instead
|
|
43
|
+
* arms a `{work_report}`-only schema on the StructuredOutput tool so the markdown
|
|
44
|
+
* final stays the deliverable — the D-16c seam), and for `validated` routes
|
|
45
|
+
* (cursor), where the report rides an INSTRUCTED fenced envelope. Only
|
|
46
|
+
* interactive-gated and schema-incapable routes stay inactive here (disclosed
|
|
47
|
+
* `absent` work_state).
|
|
48
|
+
*/
|
|
49
|
+
export function resolveWorkReportEnvelope(opts) {
|
|
50
|
+
const hasCallerSchema = opts.callerSchema !== null;
|
|
51
|
+
const callerStrict = hasCallerSchema
|
|
52
|
+
? strictifyOutputSchema(opts.callerSchema)
|
|
53
|
+
: null;
|
|
54
|
+
// claude's `--json-schema` × interactive stream-json is an unverified combo:
|
|
55
|
+
// disclose the WorkReport transport as unsupported for that lane (§1).
|
|
56
|
+
const interactiveGated = opts.channel === "side_tool" && opts.interactive;
|
|
57
|
+
// `validated` transport (cursor): no native schema constrains the output —
|
|
58
|
+
// the WorkReport rides an INSTRUCTED fenced envelope validated off the last
|
|
59
|
+
// fenced JSON (D-16c). Caller schemas on such routes were already refused by
|
|
60
|
+
// the mandatory-schema gate upstream, so this is the WorkReport-only case.
|
|
61
|
+
if (opts.transport === "validated" && !interactiveGated) {
|
|
62
|
+
return {
|
|
63
|
+
outputSchema: callerStrict ?? undefined,
|
|
64
|
+
mode: {
|
|
65
|
+
active: true,
|
|
66
|
+
source: "validated",
|
|
67
|
+
hasCallerSchema,
|
|
68
|
+
channel: "instructed_fence",
|
|
69
|
+
instruction: WORK_REPORT_FENCE_INSTRUCTION,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const active = opts.transport === "constrained" && opts.supportsJsonSchemaOutput && !interactiveGated;
|
|
74
|
+
if (active) {
|
|
75
|
+
// claude side_tool WITHOUT a caller schema (D-16c): arm a {work_report}-only
|
|
76
|
+
// schema on the StructuredOutput tool; the markdown final message stays the
|
|
77
|
+
// deliverable and the report rides the tool payload. Every other constrained
|
|
78
|
+
// case carries the output INSIDE the `{work_report, output}` envelope
|
|
79
|
+
// (caller schema → the strict S; no-caller final_message → output:string).
|
|
80
|
+
if (opts.channel === "side_tool" && !hasCallerSchema) {
|
|
81
|
+
return {
|
|
82
|
+
outputSchema: buildWorkReportEnvelope(null),
|
|
83
|
+
mode: {
|
|
84
|
+
active: true,
|
|
85
|
+
source: "constrained",
|
|
86
|
+
hasCallerSchema,
|
|
87
|
+
channel: "side_tool",
|
|
88
|
+
instruction: null,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const output = hasCallerSchema
|
|
93
|
+
? callerStrict
|
|
94
|
+
: "string";
|
|
95
|
+
return {
|
|
96
|
+
outputSchema: buildWorkReportEnvelope(output),
|
|
97
|
+
mode: {
|
|
98
|
+
active: true,
|
|
99
|
+
source: "constrained",
|
|
100
|
+
hasCallerSchema,
|
|
101
|
+
channel: "constrained_json",
|
|
102
|
+
instruction: null,
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
// Legacy path preserved: a caller schema still rides (strictified) on a
|
|
108
|
+
// non-activated route (the mandatory-schema gate already refused
|
|
109
|
+
// schema-incapable routes upstream).
|
|
110
|
+
outputSchema: callerStrict ?? undefined,
|
|
111
|
+
mode: {
|
|
112
|
+
active: false,
|
|
113
|
+
source: "absent",
|
|
114
|
+
hasCallerSchema,
|
|
115
|
+
channel: "constrained_json",
|
|
116
|
+
instruction: null,
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function extractOutput(obj, mode) {
|
|
121
|
+
const output = obj["output"];
|
|
122
|
+
if (mode.hasCallerSchema) {
|
|
123
|
+
// Re-serialize the S-conformant object so finalizeStructuredOutput can
|
|
124
|
+
// JSON.parse + validate it against the caller schema (the caller schema is
|
|
125
|
+
// the conformance authority for `output`, so any shape rides through here).
|
|
126
|
+
return { deliverable: output === undefined ? "" : JSON.stringify(output) };
|
|
127
|
+
}
|
|
128
|
+
// No caller schema: `output` MUST be a string deliverable. A non-string
|
|
129
|
+
// (object/array/null/number/bool) or missing `output` is a BROKEN envelope —
|
|
130
|
+
// coercing it (String({...}) => "[object Object]") would let a bogus payload
|
|
131
|
+
// like {"work_report":{"state":"completed"},"output":{}} finalize CLEAN
|
|
132
|
+
// instead of failing the WorkReport contract. Fail it here (D-16 §2).
|
|
133
|
+
if (typeof output !== "string") {
|
|
134
|
+
return { violation: "work_report envelope output must be a string" };
|
|
135
|
+
}
|
|
136
|
+
return { deliverable: output };
|
|
137
|
+
}
|
|
138
|
+
/** Extract the LAST fenced ```…``` block's body (its optional language tag
|
|
139
|
+
* stripped), or null when the text has no closed fence. No-regex, mechanical
|
|
140
|
+
* transport parsing (INV-049 governs the typed WorkReport, not this seam). */
|
|
141
|
+
function lastFencedBlock(text) {
|
|
142
|
+
const FENCE = "```";
|
|
143
|
+
const end = text.lastIndexOf(FENCE);
|
|
144
|
+
if (end <= 0)
|
|
145
|
+
return null;
|
|
146
|
+
const start = text.lastIndexOf(FENCE, end - 1);
|
|
147
|
+
if (start < 0)
|
|
148
|
+
return null;
|
|
149
|
+
let inner = text.slice(start + FENCE.length, end);
|
|
150
|
+
const nl = inner.indexOf("\n");
|
|
151
|
+
if (nl >= 0) {
|
|
152
|
+
const firstLine = inner.slice(0, nl).trim();
|
|
153
|
+
// A bare language tag (letters/digits/±_-, no whitespace) on the opening
|
|
154
|
+
// line is dropped; a first line that is already JSON content is kept.
|
|
155
|
+
const isLangTag = firstLine.length > 0 &&
|
|
156
|
+
firstLine.length <= 20 &&
|
|
157
|
+
![...firstLine].some((ch) => ch === " " || ch === "{" || ch === "[" || ch === '"');
|
|
158
|
+
if (firstLine === "" || isLangTag)
|
|
159
|
+
inner = inner.slice(nl + 1);
|
|
160
|
+
}
|
|
161
|
+
return inner.trim();
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Un-nest the WorkReport envelope from an active route's answer (D-16 §2). The
|
|
165
|
+
* behavior forks on `mode.channel`:
|
|
166
|
+
* - `constrained_json`: the whole answer IS `{work_report, output}` JSON.
|
|
167
|
+
* - `instructed_fence`: the envelope is the LAST fenced JSON block; prose
|
|
168
|
+
* before it is discarded (the `output` string is the deliverable).
|
|
169
|
+
* - `side_tool`: the answer text IS the markdown deliverable; the report rides
|
|
170
|
+
* `opts.sideToolReport` (the tool payload the adapter surfaced).
|
|
171
|
+
* A non-active mode passes the answer through untouched. The WorkReport
|
|
172
|
+
* cross-field rules (completed ⇒ no required_inputs; needs_input ⇒ ≥1) are
|
|
173
|
+
* enforced HERE so a broken report is a typed contract violation.
|
|
174
|
+
*
|
|
175
|
+
* For a `constrained_json` route `answerText` is the raw `{work_report, output}`
|
|
176
|
+
* envelope (codex #19816 / QA-009: the orchestrator passes `answer.machineText()`,
|
|
177
|
+
* which yields the raw envelope even when the codex adapter pre-unwrapped the
|
|
178
|
+
* DISPLAY copy of the final message — the visible stream sees the output, the
|
|
179
|
+
* un-nest here still sees the envelope).
|
|
180
|
+
*/
|
|
181
|
+
export function unwrapWorkReportEnvelope(answerText, mode, opts = {}) {
|
|
182
|
+
if (!mode.active) {
|
|
183
|
+
return {
|
|
184
|
+
deliverable: answerText,
|
|
185
|
+
workReport: null,
|
|
186
|
+
source: mode.source,
|
|
187
|
+
contractViolation: null,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
// side_tool: the markdown answer stays the deliverable; the report is the tool
|
|
191
|
+
// payload. A missing/malformed tool report is a typed contract failure.
|
|
192
|
+
if (mode.channel === "side_tool") {
|
|
193
|
+
if (opts.sideToolReport === undefined) {
|
|
194
|
+
return {
|
|
195
|
+
deliverable: answerText,
|
|
196
|
+
workReport: null,
|
|
197
|
+
source: mode.source,
|
|
198
|
+
contractViolation: "the StructuredOutput tool did not carry a work_report",
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
return validateWorkReport(answerText, opts.sideToolReport, mode.source);
|
|
202
|
+
}
|
|
203
|
+
let text = answerText.trim();
|
|
204
|
+
if (mode.channel === "instructed_fence") {
|
|
205
|
+
const fenced = lastFencedBlock(answerText);
|
|
206
|
+
if (fenced === null) {
|
|
207
|
+
return {
|
|
208
|
+
deliverable: answerText,
|
|
209
|
+
workReport: null,
|
|
210
|
+
source: mode.source,
|
|
211
|
+
contractViolation: "final answer has no fenced work_report envelope",
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
text = fenced;
|
|
215
|
+
}
|
|
216
|
+
let parsed;
|
|
217
|
+
try {
|
|
218
|
+
parsed = JSON.parse(text);
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
return {
|
|
222
|
+
deliverable: answerText,
|
|
223
|
+
workReport: null,
|
|
224
|
+
source: mode.source,
|
|
225
|
+
contractViolation: "final answer is not the JSON work_report envelope",
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
229
|
+
return {
|
|
230
|
+
deliverable: answerText,
|
|
231
|
+
workReport: null,
|
|
232
|
+
source: mode.source,
|
|
233
|
+
contractViolation: "work_report envelope is not a JSON object",
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
const obj = parsed;
|
|
237
|
+
const extracted = extractOutput(obj, mode);
|
|
238
|
+
if ("violation" in extracted) {
|
|
239
|
+
return {
|
|
240
|
+
deliverable: answerText,
|
|
241
|
+
workReport: null,
|
|
242
|
+
source: mode.source,
|
|
243
|
+
contractViolation: extracted.violation,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
return validateWorkReport(extracted.deliverable, obj["work_report"], mode.source);
|
|
247
|
+
}
|
|
248
|
+
/** Parse + cross-field-validate a raw work_report value against a resolved
|
|
249
|
+
* deliverable. The cross-field rules (completed ⇒ no required_inputs;
|
|
250
|
+
* needs_input ⇒ ≥1) live HERE, not on the permissive Zod wire type. */
|
|
251
|
+
function validateWorkReport(deliverable, rawReport, source) {
|
|
252
|
+
const wr = WorkReport.safeParse(rawReport);
|
|
253
|
+
if (!wr.success) {
|
|
254
|
+
return {
|
|
255
|
+
deliverable,
|
|
256
|
+
workReport: null,
|
|
257
|
+
source,
|
|
258
|
+
contractViolation: `work_report missing or malformed: ${wr.error.issues[0]?.message ?? "invalid"}`,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
// ONE redaction owner for every WorkReport transport: the model-authored
|
|
262
|
+
// locator/description strings flow VERBATIM into telemetry yaml, decision
|
|
263
|
+
// facts, and the CLI needsInputLabel — the last reads the local artifact and
|
|
264
|
+
// bypasses serve-time redaction — so a token pasted into a required_input
|
|
265
|
+
// would otherwise persist unredacted at rest. Redact here, before the report
|
|
266
|
+
// is handed to any of them. (The cross-field checks below read only state and
|
|
267
|
+
// list length, so redaction order does not affect them.)
|
|
268
|
+
const report = {
|
|
269
|
+
...wr.data,
|
|
270
|
+
required_inputs: wr.data.required_inputs.map((ri) => ({
|
|
271
|
+
...ri,
|
|
272
|
+
locator: ri.locator === null ? null : redactSecrets(ri.locator),
|
|
273
|
+
description: redactSecrets(ri.description),
|
|
274
|
+
})),
|
|
275
|
+
};
|
|
276
|
+
if (report.state === "completed" && report.required_inputs.length > 0) {
|
|
277
|
+
return {
|
|
278
|
+
deliverable,
|
|
279
|
+
workReport: null,
|
|
280
|
+
source,
|
|
281
|
+
contractViolation: "a completed work_report must not list required_inputs",
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
if (report.state === "needs_input" && report.required_inputs.length === 0) {
|
|
285
|
+
return {
|
|
286
|
+
deliverable,
|
|
287
|
+
workReport: null,
|
|
288
|
+
source,
|
|
289
|
+
contractViolation: "a needs_input work_report must list at least one required_input",
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
return { deliverable, workReport: report, source, contractViolation: null };
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* QA-036: the terminal outcome facts for a read-only (ask) run that produced NO
|
|
296
|
+
* successful attempt. The D8 legacy mapping treated ANY web-blocked run as a
|
|
297
|
+
* succeeded/review_blocked terminal (exit 0, "Needs review"); a blocked Ask that
|
|
298
|
+
* delivered nothing then read as done. This re-checks the DELIVERABLE: only a
|
|
299
|
+
* blocked attempt that actually produced a partial answer is a review-blocked
|
|
300
|
+
* SUCCESS; an empty blocked (or plain failed) run is a failure (exit 1).
|
|
301
|
+
*/
|
|
302
|
+
export function readOnlyNoSuccessTerminal(opts) {
|
|
303
|
+
if (opts.webBlocked && opts.hasDeliverable) {
|
|
304
|
+
return { lifecycle: "succeeded", review: "blocked", reason: "review_blocked" };
|
|
305
|
+
}
|
|
306
|
+
if (opts.budgetStopped && opts.attemptsCount === 0) {
|
|
307
|
+
return { lifecycle: "failed", reason: "budget_exhausted" };
|
|
308
|
+
}
|
|
309
|
+
return { lifecycle: "failed", reason: "harness_failed" };
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* The unified finalizer. Precedence (hardest signal wins):
|
|
313
|
+
* 1. terminal context exhaustion with no completed report ⇒ interrupted;
|
|
314
|
+
* 2. a broken WorkReport contract on a constrained route ⇒ hard failure
|
|
315
|
+
* (never prose-success);
|
|
316
|
+
* 3. a valid needs_input/incomplete report ⇒ veto (lifecycle stays, run is
|
|
317
|
+
* non-applyable, exit non-zero) — a `completed` claim NEVER overrides a
|
|
318
|
+
* harness error / failed gate / missing evidence;
|
|
319
|
+
* 4. otherwise the disclosed work_state (completed or unverified).
|
|
320
|
+
*/
|
|
321
|
+
export function finalizeAttempt(input) {
|
|
322
|
+
const completed = input.workReport?.state === "completed";
|
|
323
|
+
if (input.contextTerminalExhausted && !completed) {
|
|
324
|
+
return {
|
|
325
|
+
deliverablePresent: input.deliverableEvidence,
|
|
326
|
+
harnessErrored: input.harnessErrored,
|
|
327
|
+
workState: { state: "unverified", source: input.workReportSource },
|
|
328
|
+
reason: "context_capacity_exhausted",
|
|
329
|
+
outcomeClass: "interrupted",
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
if (input.workReportViolation) {
|
|
333
|
+
return {
|
|
334
|
+
deliverablePresent: false,
|
|
335
|
+
// A constrained route that promised a WorkReport and broke the contract
|
|
336
|
+
// failed the attempt — it must never terminalize as a prose success.
|
|
337
|
+
harnessErrored: true,
|
|
338
|
+
workState: { state: "unverified", source: input.workReportSource },
|
|
339
|
+
reason: "work_report_contract",
|
|
340
|
+
outcomeClass: "contract_failure",
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
const report = input.workReport;
|
|
344
|
+
if (report && (report.state === "needs_input" || report.state === "incomplete")) {
|
|
345
|
+
return {
|
|
346
|
+
deliverablePresent: input.deliverableEvidence,
|
|
347
|
+
harnessErrored: input.harnessErrored,
|
|
348
|
+
workState: {
|
|
349
|
+
state: report.state,
|
|
350
|
+
source: input.workReportSource,
|
|
351
|
+
...(report.required_inputs.length > 0 ? { required_inputs: report.required_inputs } : {}),
|
|
352
|
+
},
|
|
353
|
+
reason: report.state === "needs_input" ? "input_required" : "work_incomplete",
|
|
354
|
+
outcomeClass: "veto",
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
return {
|
|
358
|
+
deliverablePresent: input.deliverableEvidence,
|
|
359
|
+
harnessErrored: input.harnessErrored,
|
|
360
|
+
workState: {
|
|
361
|
+
state: report?.state === "completed" ? "completed" : "unverified",
|
|
362
|
+
source: report ? input.workReportSource : "absent",
|
|
363
|
+
},
|
|
364
|
+
reason: null,
|
|
365
|
+
outcomeClass: "clean",
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
//# sourceMappingURL=attemptFinalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attemptFinalize.js","sourceRoot":"","sources":["../src/attemptFinalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,UAAU,GAKX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA2BhD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,gFAAgF;IAChF,sDAAsD;IACtD,uEAAuE;IACvE,2GAA2G;IAC3G,iGAAiG;IACjG,4FAA4F;IAC5F,sGAAsG;IACtG,sEAAsE;CACvE,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,C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