@patronage/software-factory 1.0.0-alpha.39 → 1.0.0-alpha.40

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/index.d.ts CHANGED
@@ -1,17 +1,17 @@
1
1
  import { Command } from "commander";
2
2
  import { existsSync, readFileSync, rmSync } from "node:fs";
3
- import { z } from "zod";
4
3
  import { PreviewProofRegistration } from "@patronage/factory-ci";
5
- import { JsonValue, Questions, SystemOneRequest, choice, noul, score } from "@typesafe-ai/sdk";
4
+ import { z } from "zod";
6
5
 
7
6
  //#region src/factory-app-broker-client.d.ts
8
7
  /**
9
- * The opt-in broker permission set (#1360): `pull_requests: write`,
10
- * `issues: read`, and `contents: read` on the requesting repository. The
11
- * read-only contents grant is there because GitHub's pull request create
12
- * reads the head and base refs (#1327, #1375). The CLI asks for the scope by
13
- * name and the broker decides its permissions. A request without a scope is
14
- * the `checks: write` mint, unchanged.
8
+ * The opt-in broker permission set (#1360): `actions: read`, `checks: read`,
9
+ * `contents: read`, `issues: read`, and `pull_requests: write` on the
10
+ * requesting repository. Contents read supports pull request creation, which
11
+ * reads the head and base refs (#1327, #1375). Checks and actions read support
12
+ * PR `statusCheckRollup` reads on the ambient 401 retry (#1457).
13
+ * The CLI asks for the scope by name and the broker decides its permissions.
14
+ * A request without a scope is the `checks: write` mint, unchanged.
15
15
  */
16
16
  declare const FACTORY_APP_BROKER_ADMISSION_SCOPE = "admission";
17
17
  //#endregion
@@ -83,14 +83,17 @@ interface FactoryAppAccessDependencies {
83
83
  /**
84
84
  * The GitHub calls a Cursor VM's own `gh` credential cannot make (#1327).
85
85
  * Cursor mints the VM token without `pull_requests: write` or `issues`, so on
86
- * a Cursor managed runtime these, and only these, run on the broker's
87
- * `admission` token (#1360): `pull_requests: write`, `issues: read`, and
88
- * `contents: read`, which creating a pull request needs because GitHub reads
89
- * the head and base refs (#1375). Push,
90
- * marking ready, arming auto-merge, check runs, and every other call keep
91
- * their own credential.
86
+ * a Cursor managed runtime pull request creation, body edits, issue reads,
87
+ * and the PR status HUD's pull request read use the broker's admission token.
88
+ * Its scope is `actions: read`, `checks: read`, `contents: read`,
89
+ * `issues: read`, and `pull_requests: write` (#1360, #1375, #1457).
90
+ * Contents read supports creation's head and base ref reads; checks and
91
+ * actions read support PR `statusCheckRollup` reads on the ambient 401 retry.
92
+ * PR reads may retry an ambient 401 on this token (#1457); writes never
93
+ * retry with a different identity. Push, marking ready, arming auto-merge,
94
+ * check-run writes, and other calls keep their own credential.
92
95
  */
93
- type AdmissionOperation = "create-pull-request" | "edit-pull-request-body" | "read-issue" | "read-pull-request-for-status-hud";
96
+ type AdmissionOperation = "create-pull-request" | "edit-pull-request-body" | "read-pull-request" | "read-issue" | "read-pull-request-for-status-hud";
94
97
  /** The one repository the admission token is minted for. */
95
98
  interface AdmissionRepository {
96
99
  owner: string;
@@ -126,8 +129,8 @@ declare const boundaryManifestBaseSchema: z.ZodObject<{
126
129
  boundary: z.ZodString;
127
130
  closeout: z.ZodOptional<z.ZodObject<{
128
131
  review: z.ZodEnum<{
129
- oracle: "oracle";
130
132
  "independent-model": "independent-model";
133
+ oracle: "oracle";
131
134
  human: "human";
132
135
  }>;
133
136
  }, z.core.$loose>>;
@@ -145,8 +148,8 @@ declare const boundaryManifestBaseSchema: z.ZodObject<{
145
148
  issues: z.ZodArray<z.ZodNumber>;
146
149
  name: z.ZodString;
147
150
  review: z.ZodEnum<{
148
- oracle: "oracle";
149
151
  "independent-model": "independent-model";
152
+ oracle: "oracle";
150
153
  human: "human";
151
154
  }>;
152
155
  }, z.core.$loose>>;
@@ -155,8 +158,8 @@ declare const boundaryManifestSchema: z.ZodObject<{
155
158
  boundary: z.ZodString;
156
159
  closeout: z.ZodOptional<z.ZodObject<{
157
160
  review: z.ZodEnum<{
158
- oracle: "oracle";
159
161
  "independent-model": "independent-model";
162
+ oracle: "oracle";
160
163
  human: "human";
161
164
  }>;
162
165
  }, z.core.$loose>>;
@@ -174,8 +177,8 @@ declare const boundaryManifestSchema: z.ZodObject<{
174
177
  issues: z.ZodArray<z.ZodNumber>;
175
178
  name: z.ZodString;
176
179
  review: z.ZodEnum<{
177
- oracle: "oracle";
178
180
  "independent-model": "independent-model";
181
+ oracle: "oracle";
179
182
  human: "human";
180
183
  }>;
181
184
  }, z.core.$loose>>;
@@ -236,8 +239,8 @@ declare const boundaryReviewProofBaseSchema: z.ZodObject<{
236
239
  mergedSha: z.ZodOptional<z.ZodString>;
237
240
  pr: z.ZodNumber;
238
241
  state: z.ZodEnum<{
239
- open: "open";
240
242
  merged: "merged";
243
+ open: "open";
241
244
  }>;
242
245
  wave: z.ZodOptional<z.ZodString>;
243
246
  }, z.core.$loose>>;
@@ -260,8 +263,8 @@ declare const boundaryReviewProofBaseSchema: z.ZodObject<{
260
263
  }>;
261
264
  producer: z.ZodString;
262
265
  rung: z.ZodEnum<{
263
- oracle: "oracle";
264
266
  "independent-model": "independent-model";
267
+ oracle: "oracle";
265
268
  human: "human";
266
269
  }>;
267
270
  schemaVersion: z.ZodLiteral<1>;
@@ -280,8 +283,8 @@ declare const boundaryReviewProofSchema: z.ZodObject<{
280
283
  mergedSha: z.ZodOptional<z.ZodString>;
281
284
  pr: z.ZodNumber;
282
285
  state: z.ZodEnum<{
283
- open: "open";
284
286
  merged: "merged";
287
+ open: "open";
285
288
  }>;
286
289
  wave: z.ZodOptional<z.ZodString>;
287
290
  }, z.core.$loose>>;
@@ -304,8 +307,8 @@ declare const boundaryReviewProofSchema: z.ZodObject<{
304
307
  }>;
305
308
  producer: z.ZodString;
306
309
  rung: z.ZodEnum<{
307
- oracle: "oracle";
308
310
  "independent-model": "independent-model";
311
+ oracle: "oracle";
309
312
  human: "human";
310
313
  }>;
311
314
  schemaVersion: z.ZodLiteral<1>;
@@ -751,6 +754,11 @@ declare const policyResolutionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
751
754
  status: z.ZodLiteral<"authoritative">;
752
755
  }, z.core.$strict>, z.ZodObject<{
753
756
  baseRefName: z.ZodString;
757
+ cause: z.ZodOptional<z.ZodEnum<{
758
+ "no-pull-request": "no-pull-request";
759
+ "lookup-failed": "lookup-failed";
760
+ "policy-unreadable": "policy-unreadable";
761
+ }>>;
754
762
  reason: z.ZodString;
755
763
  status: z.ZodLiteral<"unresolved">;
756
764
  }, z.core.$strict>], "status">;
@@ -781,26 +789,6 @@ interface ReviewLadderPolicy {
781
789
  };
782
790
  }
783
791
  //#endregion
784
- //#region src/review-recovery-item.d.ts
785
- /**
786
- * A schema-2 declaration the bounded import could not convert (ADR 0004
787
- * decision 7): the declaration as stored, the cycle that recorded it, why it
788
- * was refused and the occurrence addresses it could have meant. While any
789
- * item is present the proof admits nothing; an operator re-declares by
790
- * address on the next recording.
791
- */
792
- interface ReviewRecoveryItem {
793
- candidates: string[];
794
- cycle: number;
795
- declaration: {
796
- disposition: "fixed-in-thread" | "follow-up-filed" | "waived";
797
- file?: string;
798
- reference?: string;
799
- title: string;
800
- };
801
- reason: string;
802
- }
803
- //#endregion
804
792
  //#region src/review-ladder-ledger.d.ts
805
793
  type LadderCycleStage = "interior" | "gate";
806
794
  interface LadderCycleRef {
@@ -821,7 +809,7 @@ interface ReviewOccurrenceRecord {
821
809
  */
822
810
  repeatOf?: string;
823
811
  }
824
- declare const POLICY_DECLARATION_RULES: readonly ["cycle-2-severity-floor", "identity-repeat", "schema-2-import"];
812
+ declare const POLICY_DECLARATION_RULES: readonly ["cycle-2-severity-floor", "identity-repeat"];
825
813
  type PolicyDeclarationRule = (typeof POLICY_DECLARATION_RULES)[number];
826
814
  type DeclarationAuthority = "operator" | "reviewer" | "policy";
827
815
  /**
@@ -885,22 +873,10 @@ interface ReviewRecordedCycleIdentity {
885
873
  findingsDigest: string;
886
874
  recordingId: string;
887
875
  }
888
- /**
889
- * A cycle the bounded importer converted from a schema-2 proof (decision 7).
890
- * No bytes were read for it, so it carries the digest of the retained source
891
- * proof instead of a recording identity; it can never answer a retry as
892
- * `already-recorded`.
893
- */
894
- interface ReviewImportedCycleIdentity {
895
- imported: {
896
- proofDigest: string;
897
- schemaVersion: 2;
898
- };
899
- }
900
876
  type ReviewCycleRecording = {
901
877
  declarations: ReviewDeclarationRecord[]; /** Index-aligned with the cycle's `findings`. */
902
878
  occurrences: ReviewOccurrenceRecord[];
903
- } & (ReviewRecordedCycleIdentity | ReviewImportedCycleIdentity);
879
+ } & ReviewRecordedCycleIdentity;
904
880
  //#endregion
905
881
  //#region src/review-ladder.d.ts
906
882
  type ReviewLadderExecutedStage = "interior" | "gate";
@@ -1044,6 +1020,9 @@ interface PrReviewResult {
1044
1020
  issuesFlagged: number;
1045
1021
  summary: string;
1046
1022
  findings: PrReviewFinding[];
1023
+ lowerFindings?: (PrReviewFinding & {
1024
+ priority: string;
1025
+ })[];
1047
1026
  typedVerdict?: boolean;
1048
1027
  verdictSource?: "footer" | "recovered";
1049
1028
  promptSections?: ReviewPromptSection[];
@@ -1059,21 +1038,6 @@ interface PrReviewProof {
1059
1038
  changedFiles: string[];
1060
1039
  cleanedPaths: string[];
1061
1040
  ladder?: PrReviewLadderState;
1062
- /**
1063
- * Present when the ladder's earlier cycles were converted from a schema-2
1064
- * proof by the bounded import (#1068): the digest of the original bytes,
1065
- * retained content-addressed for audit before the converted proof is
1066
- * written.
1067
- */
1068
- importedFrom?: {
1069
- proofDigest: string;
1070
- schemaVersion: 2;
1071
- };
1072
- /**
1073
- * Schema-2 declarations the bounded import refused (#1068). Empty is never
1074
- * written; absent means nothing awaits recovery.
1075
- */
1076
- recoveryRequired?: ReviewRecoveryItem[];
1077
1041
  /**
1078
1042
  * The policy identity this review run resolved its demanded kinds under
1079
1043
  * (#922 Slice B). Optional: a run that could not reach the authority records
@@ -1363,6 +1327,8 @@ interface CandidatePullRequestPolicyContext {
1363
1327
  type CandidatePullRequestLookup = {
1364
1328
  pullRequest: CandidatePullRequestPolicyContext;
1365
1329
  status: "found";
1330
+ } | {
1331
+ status: "none";
1366
1332
  } | {
1367
1333
  reason: string;
1368
1334
  status: "unavailable";
@@ -1775,8 +1741,8 @@ declare const mergeFreezeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1775
1741
  generationId: z.ZodNumber;
1776
1742
  headSha: z.ZodString;
1777
1743
  outcome: z.ZodEnum<{
1778
- active: "active";
1779
1744
  stale: "stale";
1745
+ active: "active";
1780
1746
  }>;
1781
1747
  reason: z.ZodString;
1782
1748
  recordedAt: z.ZodISODateTime;
@@ -1784,9 +1750,9 @@ declare const mergeFreezeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1784
1750
  verification: z.ZodOptional<z.ZodObject<{
1785
1751
  jobs: z.ZodRecord<z.ZodString, z.ZodEnum<{
1786
1752
  success: "success";
1787
- skipped: "skipped";
1788
1753
  failure: "failure";
1789
1754
  cancelled: "cancelled";
1755
+ skipped: "skipped";
1790
1756
  }>>;
1791
1757
  runAttempt: z.ZodNumber;
1792
1758
  runId: z.ZodNumber;
@@ -1803,9 +1769,9 @@ declare const mergeFreezeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1803
1769
  verification: z.ZodOptional<z.ZodObject<{
1804
1770
  jobs: z.ZodRecord<z.ZodString, z.ZodEnum<{
1805
1771
  success: "success";
1806
- skipped: "skipped";
1807
1772
  failure: "failure";
1808
1773
  cancelled: "cancelled";
1774
+ skipped: "skipped";
1809
1775
  }>>;
1810
1776
  runAttempt: z.ZodNumber;
1811
1777
  runId: z.ZodNumber;
@@ -1924,7 +1890,6 @@ interface ProofDescriptor<T> {
1924
1890
  defaultPath: string;
1925
1891
  schemaVersion: number;
1926
1892
  parse: (raw: unknown) => T;
1927
- parseBytes?: (bytes: string) => T;
1928
1893
  }
1929
1894
  //#endregion
1930
1895
  //#region src/pr-readiness/readiness-ledger.d.ts
@@ -1979,9 +1944,9 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1979
1944
  mergeable: z.ZodString;
1980
1945
  requiredChecks: z.ZodEnum<{
1981
1946
  unknown: "unknown";
1982
- pending: "pending";
1983
1947
  passed: "passed";
1984
1948
  failed: "failed";
1949
+ pending: "pending";
1985
1950
  none: "none";
1986
1951
  }>;
1987
1952
  reviewDecision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -2047,8 +2012,8 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
2047
2012
  "ready-for-human": "ready-for-human";
2048
2013
  }>;
2049
2014
  stage: z.ZodEnum<{
2050
- interior: "interior";
2051
2015
  gate: "gate";
2016
+ interior: "interior";
2052
2017
  "interior-complete": "interior-complete";
2053
2018
  }>;
2054
2019
  }, z.core.$strip>>;
@@ -2064,10 +2029,10 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
2064
2029
  reviewedHeadSha: z.ZodOptional<z.ZodString>;
2065
2030
  reviewedPatchId: z.ZodOptional<z.ZodString>;
2066
2031
  status: z.ZodEnum<{
2067
- "not-required": "not-required";
2068
- stale: "stale";
2069
2032
  blocked: "blocked";
2033
+ "not-required": "not-required";
2070
2034
  current: "current";
2035
+ stale: "stale";
2071
2036
  missing: "missing";
2072
2037
  }>;
2073
2038
  }, z.core.$strip>;
@@ -2076,10 +2041,10 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
2076
2041
  reviewedHeadSha: z.ZodOptional<z.ZodString>;
2077
2042
  reviewedPatchId: z.ZodOptional<z.ZodString>;
2078
2043
  status: z.ZodEnum<{
2079
- "not-required": "not-required";
2080
- stale: "stale";
2081
2044
  blocked: "blocked";
2045
+ "not-required": "not-required";
2082
2046
  current: "current";
2047
+ stale: "stale";
2083
2048
  missing: "missing";
2084
2049
  }>;
2085
2050
  }, z.core.$strip>>;
@@ -2732,10 +2697,14 @@ interface GitHubPullRequest {
2732
2697
  */
2733
2698
  isCrossRepository: boolean;
2734
2699
  isDraft: boolean;
2700
+ mergeCommit: {
2701
+ oid: string;
2702
+ } | null;
2735
2703
  mergeStateStatus: string;
2736
2704
  mergeable: string;
2737
2705
  number: number;
2738
2706
  reviewDecision: string | null;
2707
+ state: "OPEN" | "CLOSED" | "MERGED";
2739
2708
  statusCheckRollup?: StatusCheckRollup[];
2740
2709
  title: string;
2741
2710
  unresolvedReviewThreads: number;
@@ -2745,7 +2714,8 @@ interface PrReadyProof {
2745
2714
  schemaVersion: 3;
2746
2715
  /**
2747
2716
  * What GitHub actually did when this run armed native auto-merge (#477).
2748
- * Present exactly when a ready run called the arming module (#1299): not
2717
+ * Also reports an already-merged no-op (#1456). Otherwise present exactly
2718
+ * when a ready run called the arming module (#1299): not
2749
2719
  * for an `autoMerge: false` wave, and not when a notice names why the run
2750
2720
  * did not arm. Read back from the PR rather than inferred from the
2751
2721
  * invocation, because `gh pr merge --auto` arms, merges, or does nothing
@@ -2927,6 +2897,7 @@ interface PrReadyDependencies {
2927
2897
  owner: string;
2928
2898
  repo: string;
2929
2899
  pr: number;
2900
+ extraEnv?: Readonly<Record<string, string>>;
2930
2901
  }) => GitHubPullRequest;
2931
2902
  };
2932
2903
  git?: PrReadyGitDependencies;
@@ -3013,8 +2984,8 @@ declare const evidenceEnvelopeBaseSchema: z.ZodObject<{
3013
2984
  producer: z.ZodString;
3014
2985
  requestId: z.ZodOptional<z.ZodString>;
3015
2986
  rung: z.ZodOptional<z.ZodEnum<{
3016
- oracle: "oracle";
3017
2987
  "independent-model": "independent-model";
2988
+ oracle: "oracle";
3018
2989
  human: "human";
3019
2990
  }>>;
3020
2991
  schemaVersion: z.ZodLiteral<1>;
@@ -3040,8 +3011,8 @@ declare const evidenceEnvelopeSchema: z.ZodObject<{
3040
3011
  producer: z.ZodString;
3041
3012
  requestId: z.ZodOptional<z.ZodString>;
3042
3013
  rung: z.ZodOptional<z.ZodEnum<{
3043
- oracle: "oracle";
3044
3014
  "independent-model": "independent-model";
3015
+ oracle: "oracle";
3045
3016
  human: "human";
3046
3017
  }>>;
3047
3018
  schemaVersion: z.ZodLiteral<1>;
@@ -3143,10 +3114,10 @@ declare const loadEvidenceEnvelopes: (cwd: string) => LoadedEvidenceEnvelope[];
3143
3114
  //#region src/review-proof-applicability.d.ts
3144
3115
  declare const REVIEW_STATUS_VALUES: readonly ["not-required", "current", "stale", "missing", "blocked"];
3145
3116
  declare const reviewStatusSchema: z.ZodEnum<{
3146
- "not-required": "not-required";
3147
- stale: "stale";
3148
3117
  blocked: "blocked";
3118
+ "not-required": "not-required";
3149
3119
  current: "current";
3120
+ stale: "stale";
3150
3121
  missing: "missing";
3151
3122
  }>;
3152
3123
  type ReviewStatus = z.infer<typeof reviewStatusSchema>;
@@ -3219,7 +3190,7 @@ interface ReviewCycleState {
3219
3190
  windowExhausted: boolean;
3220
3191
  }
3221
3192
  declare const reviewCycleStateFor: (proof: Pick<PrReviewProof, "ladder" | "reviewCycle" | "maxReviewCycles" | "reviews">, policy?: ReviewLadderPolicy) => ReviewCycleState;
3222
- type ReviewAcceptance = "accepted-after-cap" | "accepted-clean" | "accepted-through-ladder" | "blocked" | "recovery-required";
3193
+ type ReviewAcceptance = "accepted-after-cap" | "accepted-clean" | "accepted-through-ladder" | "blocked";
3223
3194
  declare const resolveReviewAcceptance: (proof: PrReviewProof, review: PrReviewResult, policy: ReviewLadderPolicy | undefined) => ReviewAcceptance;
3224
3195
  type ReviewTerminalState = "accepted-with-findings" | "blocked" | "clean";
3225
3196
  declare const resolveReviewTerminalStateForEpoch: (proof: PrReviewProof, review: PrReviewResult, epoch: ReviewEpochMode) => ReviewTerminalState;
@@ -3230,7 +3201,7 @@ declare const reviewProofFor: (proof: PrReviewProof | undefined, kind: PrReviewK
3230
3201
  patchId: string;
3231
3202
  }) => ReviewProofClaim;
3232
3203
  declare namespace review_proof_d_exports {
3233
- export { DEFAULT_PR_REVIEW_MAX_CYCLES, DEFAULT_PR_REVIEW_PROOF_PATH, PR_REVIEW_FINAL_READINESS_NOTICE, PR_REVIEW_FINDING_PROVENANCE_VERSION, PR_REVIEW_PROOF_DESCRIPTOR, PR_REVIEW_SCHEMA_VERSION, PrReviewFinding, PrReviewKind, PrReviewLadderState, PrReviewMode, PrReviewOutcome, PrReviewProof, PrReviewResult, PrReviewStageResolution, REVIEW_SEVERITIES, ReviewAcceptance, ReviewCycleState, ReviewFindingCategory, ReviewFindingSeverity, ReviewTerminalState, parseReviewProofBytes, prReviewFindingSchema, prReviewProofSchema, prReviewResultSchema, resolveReviewAcceptance, resolveReviewTerminalState, resolveReviewTerminalStateAcrossReviews, resolveReviewTerminalStateAcrossReviewsForPolicy, resolveReviewTerminalStateForEpoch, reviewCycleStateFor, reviewProofFor, validatePrReviewProof, validatePrReviewResult };
3204
+ export { DEFAULT_PR_REVIEW_MAX_CYCLES, DEFAULT_PR_REVIEW_PROOF_PATH, PR_REVIEW_FINAL_READINESS_NOTICE, PR_REVIEW_FINDING_PROVENANCE_VERSION, PR_REVIEW_PROOF_DESCRIPTOR, PR_REVIEW_SCHEMA_VERSION, PrReviewFinding, PrReviewKind, PrReviewLadderState, PrReviewMode, PrReviewOutcome, PrReviewProof, PrReviewResult, PrReviewStageResolution, REVIEW_SEVERITIES, ReviewAcceptance, ReviewCycleState, ReviewFindingCategory, ReviewFindingSeverity, ReviewTerminalState, prReviewFindingSchema, prReviewProofSchema, prReviewResultSchema, resolveReviewAcceptance, resolveReviewTerminalState, resolveReviewTerminalStateAcrossReviews, resolveReviewTerminalStateAcrossReviewsForPolicy, resolveReviewTerminalStateForEpoch, reviewCycleStateFor, reviewProofFor, validatePrReviewProof, validatePrReviewResult };
3234
3205
  }
3235
3206
  declare const PR_REVIEW_SCHEMA_VERSION = 3;
3236
3207
  declare const PR_REVIEW_FINDING_PROVENANCE_VERSION = 1;
@@ -3241,8 +3212,7 @@ declare const prReviewFindingSchema: z.ZodType<PrReviewFinding>;
3241
3212
  declare const prReviewResultSchema: z.ZodType<PrReviewResult>;
3242
3213
  declare const prReviewProofSchema: z.ZodType<PrReviewProof>;
3243
3214
  declare const validatePrReviewResult: (value: unknown) => PrReviewResult;
3244
- declare const validatePrReviewProof: (value: unknown, proofDigest?: string) => PrReviewProof;
3245
- declare const parseReviewProofBytes: (bytes: string) => PrReviewProof;
3215
+ declare const validatePrReviewProof: (value: unknown) => PrReviewProof;
3246
3216
  declare const PR_REVIEW_PROOF_DESCRIPTOR: ProofDescriptor<PrReviewProof>;
3247
3217
  //#endregion
3248
3218
  //#region src/schemas.d.ts
@@ -3255,14 +3225,14 @@ declare const boundaryCheckProofSchema: z.ZodObject<{
3255
3225
  pr: z.ZodNumber;
3256
3226
  sha: z.ZodString;
3257
3227
  state: z.ZodEnum<{
3258
- open: "open";
3259
3228
  merged: "merged";
3229
+ open: "open";
3260
3230
  }>;
3261
3231
  wave: z.ZodString;
3262
3232
  }, z.core.$strip>>;
3263
3233
  demandedRung: z.ZodOptional<z.ZodEnum<{
3264
- oracle: "oracle";
3265
3234
  "independent-model": "independent-model";
3235
+ oracle: "oracle";
3266
3236
  human: "human";
3267
3237
  }>>;
3268
3238
  epicIssue: z.ZodNumber;
@@ -3277,8 +3247,8 @@ declare const boundaryCheckProofSchema: z.ZodObject<{
3277
3247
  commentUrl: z.ZodOptional<z.ZodString>;
3278
3248
  producer: z.ZodString;
3279
3249
  rung: z.ZodEnum<{
3280
- oracle: "oracle";
3281
3250
  "independent-model": "independent-model";
3251
+ oracle: "oracle";
3282
3252
  human: "human";
3283
3253
  }>;
3284
3254
  sessionId: z.ZodOptional<z.ZodString>;
@@ -3937,85 +3907,12 @@ declare const UnknownFactoryTraceEventSchema: z.ZodObject<{
3937
3907
  repo: z.ZodString;
3938
3908
  schemaVersion: z.ZodLiteral<1>;
3939
3909
  threadId: z.ZodOptional<z.ZodString>;
3940
- workerId: z.ZodOptional<z.ZodString>;
3941
3910
  typeVersion: z.ZodNumber;
3911
+ workerId: z.ZodOptional<z.ZodString>;
3942
3912
  payload: z.ZodUnknown;
3943
3913
  unknownTraceEvent: z.ZodLiteral<true>;
3944
3914
  }, z.core.$strict>;
3945
3915
  //#endregion
3946
- //#region src/packages/trace/implementation/worker-closeout-lessons.d.ts
3947
- declare const WorkerCloseoutLessonsTraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3948
- createdAt: z.ZodString;
3949
- eventId: z.ZodString;
3950
- issue: z.ZodOptional<z.ZodNumber>;
3951
- observedAt: z.ZodString;
3952
- pr: z.ZodOptional<z.ZodNumber>;
3953
- repo: z.ZodString;
3954
- schemaVersion: z.ZodLiteral<1>;
3955
- threadId: z.ZodOptional<z.ZodString>;
3956
- workerId: z.ZodOptional<z.ZodString>;
3957
- eventType: z.ZodLiteral<"worker-closeout-lessons">;
3958
- lessonStatus: z.ZodLiteral<"captured">;
3959
- lessons: z.ZodString;
3960
- prompt: z.ZodOptional<z.ZodString>;
3961
- typeVersion: z.ZodLiteral<1>;
3962
- }, z.core.$strict>, z.ZodObject<{
3963
- createdAt: z.ZodString;
3964
- eventId: z.ZodString;
3965
- issue: z.ZodOptional<z.ZodNumber>;
3966
- observedAt: z.ZodString;
3967
- pr: z.ZodOptional<z.ZodNumber>;
3968
- repo: z.ZodString;
3969
- schemaVersion: z.ZodLiteral<1>;
3970
- threadId: z.ZodOptional<z.ZodString>;
3971
- workerId: z.ZodOptional<z.ZodString>;
3972
- eventType: z.ZodLiteral<"worker-closeout-lessons">;
3973
- lessonStatus: z.ZodLiteral<"unavailable">;
3974
- prompt: z.ZodOptional<z.ZodString>;
3975
- typeVersion: z.ZodLiteral<1>;
3976
- unavailableReason: z.ZodString;
3977
- }, z.core.$strict>], "lessonStatus">;
3978
- declare const LegacyWorkerCloseoutStatusTraceEventSchema: z.ZodObject<{
3979
- createdAt: z.ZodString;
3980
- eventId: z.ZodString;
3981
- issue: z.ZodOptional<z.ZodNumber>;
3982
- observedAt: z.ZodString;
3983
- pr: z.ZodOptional<z.ZodNumber>;
3984
- repo: z.ZodString;
3985
- schemaVersion: z.ZodLiteral<1>;
3986
- threadId: z.ZodOptional<z.ZodString>;
3987
- workerId: z.ZodOptional<z.ZodString>;
3988
- archiveStatus: z.ZodOptional<z.ZodEnum<{
3989
- unavailable: "unavailable";
3990
- archived: "archived";
3991
- skipped: "skipped";
3992
- "not-applicable": "not-applicable";
3993
- pending: "pending";
3994
- }>>;
3995
- closeoutReason: z.ZodOptional<z.ZodString>;
3996
- eventType: z.ZodLiteral<"worker-closeout-lessons">;
3997
- lessonStatus: z.ZodOptional<z.ZodEnum<{
3998
- captured: "captured";
3999
- unavailable: "unavailable";
4000
- skipped: "skipped";
4001
- }>>;
4002
- lessonSummary: z.ZodOptional<z.ZodString>;
4003
- typeVersion: z.ZodLiteral<2>;
4004
- }, z.core.$strict>;
4005
- declare const LegacyWorkerCloseoutLessonsTraceEventSchema: z.ZodObject<{
4006
- createdAt: z.ZodString;
4007
- eventId: z.ZodString;
4008
- issue: z.ZodOptional<z.ZodNumber>;
4009
- observedAt: z.ZodString;
4010
- pr: z.ZodOptional<z.ZodNumber>;
4011
- repo: z.ZodString;
4012
- schemaVersion: z.ZodLiteral<1>;
4013
- threadId: z.ZodOptional<z.ZodString>;
4014
- workerId: z.ZodOptional<z.ZodString>;
4015
- eventType: z.ZodLiteral<"worker-closeout-lessons">;
4016
- typeVersion: z.ZodLiteral<3>;
4017
- }, z.core.$strict>;
4018
- //#endregion
4019
3916
  //#region src/packages/trace/implementation/definitions.d.ts
4020
3917
  type InferSchema<TSchema> = TSchema extends z.ZodType ? z.infer<TSchema> : never;
4021
3918
  type ReadEventSchemasOf<TDefinition> = TDefinition extends {
@@ -4036,7 +3933,6 @@ interface DefinedTraceEvent<TKind extends string = string, TAppendSchema extends
4036
3933
  payloadVersions: TPayloadVersions;
4037
3934
  readEventSchemas: TReadSchemas;
4038
3935
  }
4039
- type WorkerCloseoutTraceEvent = z.infer<typeof WorkerCloseoutLessonsTraceEventSchema> | z.infer<typeof LegacyWorkerCloseoutStatusTraceEventSchema> | z.infer<typeof LegacyWorkerCloseoutLessonsTraceEventSchema>;
4040
3936
  declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"review-gate", z.ZodObject<{
4041
3937
  createdAt: z.ZodString;
4042
3938
  eventId: z.ZodString;
@@ -4163,8 +4059,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
4163
4059
  sessionId: z.ZodOptional<z.ZodString>;
4164
4060
  }, z.core.$strict>>;
4165
4061
  stage: z.ZodEnum<{
4166
- interior: "interior";
4167
4062
  gate: "gate";
4063
+ interior: "interior";
4168
4064
  }>;
4169
4065
  usage: z.ZodOptional<z.ZodObject<{
4170
4066
  estimatedCostUsd: z.ZodOptional<z.ZodNumber>;
@@ -4216,8 +4112,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
4216
4112
  sessionId: z.ZodOptional<z.ZodString>;
4217
4113
  }, z.core.$strict>>;
4218
4114
  stage: z.ZodEnum<{
4219
- interior: "interior";
4220
4115
  gate: "gate";
4116
+ interior: "interior";
4221
4117
  }>;
4222
4118
  usage: z.ZodOptional<z.ZodObject<{
4223
4119
  estimatedCostUsd: z.ZodOptional<z.ZodNumber>;
@@ -4260,8 +4156,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
4260
4156
  sessionId: z.ZodOptional<z.ZodString>;
4261
4157
  }, z.core.$strict>>;
4262
4158
  stage: z.ZodEnum<{
4263
- interior: "interior";
4264
4159
  gate: "gate";
4160
+ interior: "interior";
4265
4161
  }>;
4266
4162
  usage: z.ZodOptional<z.ZodObject<{
4267
4163
  estimatedCostUsd: z.ZodOptional<z.ZodNumber>;
@@ -4291,7 +4187,7 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
4291
4187
  staleRepeats: number;
4292
4188
  };
4293
4189
  observedAt: string;
4294
- stage: "interior" | "gate";
4190
+ stage: "gate" | "interior";
4295
4191
  issue?: number | undefined;
4296
4192
  pr?: number | undefined;
4297
4193
  threadId?: string | undefined;
@@ -4313,492 +4209,6 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
4313
4209
  source?: string | undefined;
4314
4210
  totalTokens?: number | undefined;
4315
4211
  } | undefined;
4316
- }>, DefinedTraceEvent<"worker-closeout-lessons", z.ZodDiscriminatedUnion<[z.ZodObject<{
4317
- createdAt: z.ZodString;
4318
- eventId: z.ZodString;
4319
- issue: z.ZodOptional<z.ZodNumber>;
4320
- observedAt: z.ZodString;
4321
- pr: z.ZodOptional<z.ZodNumber>;
4322
- repo: z.ZodString;
4323
- schemaVersion: z.ZodLiteral<1>;
4324
- threadId: z.ZodOptional<z.ZodString>;
4325
- workerId: z.ZodOptional<z.ZodString>;
4326
- eventType: z.ZodLiteral<"worker-closeout-lessons">;
4327
- lessonStatus: z.ZodLiteral<"captured">;
4328
- lessons: z.ZodString;
4329
- prompt: z.ZodOptional<z.ZodString>;
4330
- typeVersion: z.ZodLiteral<1>;
4331
- }, z.core.$strict>, z.ZodObject<{
4332
- createdAt: z.ZodString;
4333
- eventId: z.ZodString;
4334
- issue: z.ZodOptional<z.ZodNumber>;
4335
- observedAt: z.ZodString;
4336
- pr: z.ZodOptional<z.ZodNumber>;
4337
- repo: z.ZodString;
4338
- schemaVersion: z.ZodLiteral<1>;
4339
- threadId: z.ZodOptional<z.ZodString>;
4340
- workerId: z.ZodOptional<z.ZodString>;
4341
- eventType: z.ZodLiteral<"worker-closeout-lessons">;
4342
- lessonStatus: z.ZodLiteral<"unavailable">;
4343
- prompt: z.ZodOptional<z.ZodString>;
4344
- typeVersion: z.ZodLiteral<1>;
4345
- unavailableReason: z.ZodString;
4346
- }, z.core.$strict>], "lessonStatus">, readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
4347
- createdAt: z.ZodString;
4348
- eventId: z.ZodString;
4349
- issue: z.ZodOptional<z.ZodNumber>;
4350
- observedAt: z.ZodString;
4351
- pr: z.ZodOptional<z.ZodNumber>;
4352
- repo: z.ZodString;
4353
- schemaVersion: z.ZodLiteral<1>;
4354
- threadId: z.ZodOptional<z.ZodString>;
4355
- workerId: z.ZodOptional<z.ZodString>;
4356
- eventType: z.ZodLiteral<"worker-closeout-lessons">;
4357
- lessonStatus: z.ZodLiteral<"captured">;
4358
- lessons: z.ZodString;
4359
- prompt: z.ZodOptional<z.ZodString>;
4360
- typeVersion: z.ZodLiteral<1>;
4361
- }, z.core.$strict>, z.ZodObject<{
4362
- createdAt: z.ZodString;
4363
- eventId: z.ZodString;
4364
- issue: z.ZodOptional<z.ZodNumber>;
4365
- observedAt: z.ZodString;
4366
- pr: z.ZodOptional<z.ZodNumber>;
4367
- repo: z.ZodString;
4368
- schemaVersion: z.ZodLiteral<1>;
4369
- threadId: z.ZodOptional<z.ZodString>;
4370
- workerId: z.ZodOptional<z.ZodString>;
4371
- eventType: z.ZodLiteral<"worker-closeout-lessons">;
4372
- lessonStatus: z.ZodLiteral<"unavailable">;
4373
- prompt: z.ZodOptional<z.ZodString>;
4374
- typeVersion: z.ZodLiteral<1>;
4375
- unavailableReason: z.ZodString;
4376
- }, z.core.$strict>], "lessonStatus">, z.ZodObject<{
4377
- createdAt: z.ZodString;
4378
- eventId: z.ZodString;
4379
- issue: z.ZodOptional<z.ZodNumber>;
4380
- observedAt: z.ZodString;
4381
- pr: z.ZodOptional<z.ZodNumber>;
4382
- repo: z.ZodString;
4383
- schemaVersion: z.ZodLiteral<1>;
4384
- threadId: z.ZodOptional<z.ZodString>;
4385
- workerId: z.ZodOptional<z.ZodString>;
4386
- archiveStatus: z.ZodOptional<z.ZodEnum<{
4387
- unavailable: "unavailable";
4388
- archived: "archived";
4389
- skipped: "skipped";
4390
- "not-applicable": "not-applicable";
4391
- pending: "pending";
4392
- }>>;
4393
- closeoutReason: z.ZodOptional<z.ZodString>;
4394
- eventType: z.ZodLiteral<"worker-closeout-lessons">;
4395
- lessonStatus: z.ZodOptional<z.ZodEnum<{
4396
- captured: "captured";
4397
- unavailable: "unavailable";
4398
- skipped: "skipped";
4399
- }>>;
4400
- lessonSummary: z.ZodOptional<z.ZodString>;
4401
- typeVersion: z.ZodLiteral<2>;
4402
- }, z.core.$strict>, z.ZodObject<{
4403
- createdAt: z.ZodString;
4404
- eventId: z.ZodString;
4405
- issue: z.ZodOptional<z.ZodNumber>;
4406
- observedAt: z.ZodString;
4407
- pr: z.ZodOptional<z.ZodNumber>;
4408
- repo: z.ZodString;
4409
- schemaVersion: z.ZodLiteral<1>;
4410
- threadId: z.ZodOptional<z.ZodString>;
4411
- workerId: z.ZodOptional<z.ZodString>;
4412
- eventType: z.ZodLiteral<"worker-closeout-lessons">;
4413
- typeVersion: z.ZodLiteral<3>;
4414
- }, z.core.$strict>], {
4415
- readonly 1: z.ZodDiscriminatedUnion<[z.ZodObject<{
4416
- observedAt: z.ZodString;
4417
- prompt: z.ZodOptional<z.ZodString>;
4418
- lessonStatus: z.ZodLiteral<"captured">;
4419
- lessons: z.ZodString;
4420
- }, z.core.$strict>, z.ZodObject<{
4421
- observedAt: z.ZodString;
4422
- prompt: z.ZodOptional<z.ZodString>;
4423
- lessonStatus: z.ZodLiteral<"unavailable">;
4424
- unavailableReason: z.ZodString;
4425
- }, z.core.$strict>], "lessonStatus">;
4426
- readonly 2: z.ZodObject<{
4427
- archiveStatus: z.ZodOptional<z.ZodEnum<{
4428
- unavailable: "unavailable";
4429
- archived: "archived";
4430
- skipped: "skipped";
4431
- "not-applicable": "not-applicable";
4432
- pending: "pending";
4433
- }>>;
4434
- closeoutReason: z.ZodOptional<z.ZodString>;
4435
- lessonStatus: z.ZodOptional<z.ZodEnum<{
4436
- captured: "captured";
4437
- unavailable: "unavailable";
4438
- skipped: "skipped";
4439
- }>>;
4440
- lessonSummary: z.ZodOptional<z.ZodString>;
4441
- observedAt: z.ZodString;
4442
- }, z.core.$strict>;
4443
- readonly 3: z.ZodObject<{
4444
- observedAt: z.ZodString;
4445
- }, z.core.$strict>;
4446
- }, WorkerCloseoutTraceEvent>, DefinedTraceEvent<"orchestrator-session", z.ZodObject<{
4447
- createdAt: z.ZodString;
4448
- eventId: z.ZodString;
4449
- issue: z.ZodOptional<z.ZodNumber>;
4450
- pr: z.ZodOptional<z.ZodNumber>;
4451
- repo: z.ZodString;
4452
- schemaVersion: z.ZodLiteral<1>;
4453
- threadId: z.ZodOptional<z.ZodString>;
4454
- workerId: z.ZodOptional<z.ZodString>;
4455
- eventType: z.ZodLiteral<"orchestrator-session">;
4456
- typeVersion: z.ZodLiteral<1>;
4457
- avgContextTokens: z.ZodNumber;
4458
- cacheReadTokens: z.ZodNumber;
4459
- cacheWriteTokens: z.ZodNumber;
4460
- inputTokens: z.ZodNumber;
4461
- observedAt: z.ZodString;
4462
- outputTokens: z.ZodNumber;
4463
- sessionId: z.ZodString;
4464
- totalTokens: z.ZodNumber;
4465
- turnCount: z.ZodNumber;
4466
- usageSource: z.ZodEnum<{
4467
- "claude-code-jsonl": "claude-code-jsonl";
4468
- }>;
4469
- }, z.core.$strict>, readonly [z.ZodObject<{
4470
- createdAt: z.ZodString;
4471
- eventId: z.ZodString;
4472
- issue: z.ZodOptional<z.ZodNumber>;
4473
- pr: z.ZodOptional<z.ZodNumber>;
4474
- repo: z.ZodString;
4475
- schemaVersion: z.ZodLiteral<1>;
4476
- threadId: z.ZodOptional<z.ZodString>;
4477
- workerId: z.ZodOptional<z.ZodString>;
4478
- eventType: z.ZodLiteral<"orchestrator-session">;
4479
- typeVersion: z.ZodLiteral<1>;
4480
- avgContextTokens: z.ZodNumber;
4481
- cacheReadTokens: z.ZodNumber;
4482
- cacheWriteTokens: z.ZodNumber;
4483
- inputTokens: z.ZodNumber;
4484
- observedAt: z.ZodString;
4485
- outputTokens: z.ZodNumber;
4486
- sessionId: z.ZodString;
4487
- totalTokens: z.ZodNumber;
4488
- turnCount: z.ZodNumber;
4489
- usageSource: z.ZodEnum<{
4490
- "claude-code-jsonl": "claude-code-jsonl";
4491
- }>;
4492
- }, z.core.$strict>], {
4493
- readonly 1: z.ZodObject<{
4494
- avgContextTokens: z.ZodNumber;
4495
- cacheReadTokens: z.ZodNumber;
4496
- cacheWriteTokens: z.ZodNumber;
4497
- inputTokens: z.ZodNumber;
4498
- observedAt: z.ZodString;
4499
- outputTokens: z.ZodNumber;
4500
- sessionId: z.ZodString;
4501
- totalTokens: z.ZodNumber;
4502
- turnCount: z.ZodNumber;
4503
- usageSource: z.ZodEnum<{
4504
- "claude-code-jsonl": "claude-code-jsonl";
4505
- }>;
4506
- }, z.core.$strict>;
4507
- }, {
4508
- createdAt: string;
4509
- eventId: string;
4510
- repo: string;
4511
- schemaVersion: 1;
4512
- eventType: "orchestrator-session";
4513
- typeVersion: 1;
4514
- avgContextTokens: number;
4515
- cacheReadTokens: number;
4516
- cacheWriteTokens: number;
4517
- inputTokens: number;
4518
- observedAt: string;
4519
- outputTokens: number;
4520
- sessionId: string;
4521
- totalTokens: number;
4522
- turnCount: number;
4523
- usageSource: "claude-code-jsonl";
4524
- issue?: number | undefined;
4525
- pr?: number | undefined;
4526
- threadId?: string | undefined;
4527
- workerId?: string | undefined;
4528
- }>, DefinedTraceEvent<"delegate-exec", z.ZodObject<{
4529
- createdAt: z.ZodString;
4530
- eventId: z.ZodString;
4531
- issue: z.ZodOptional<z.ZodNumber>;
4532
- pr: z.ZodOptional<z.ZodNumber>;
4533
- repo: z.ZodString;
4534
- schemaVersion: z.ZodLiteral<1>;
4535
- threadId: z.ZodOptional<z.ZodString>;
4536
- workerId: z.ZodOptional<z.ZodString>;
4537
- eventType: z.ZodLiteral<"delegate-exec">;
4538
- typeVersion: z.ZodLiteral<1>;
4539
- changedFiles: z.ZodArray<z.ZodString>;
4540
- command: z.ZodString;
4541
- diff: z.ZodString;
4542
- durationMs: z.ZodNumber;
4543
- endedAt: z.ZodString;
4544
- engineSessionId: z.ZodOptional<z.ZodString>;
4545
- exitCode: z.ZodNullable<z.ZodNumber>;
4546
- harness: z.ZodString;
4547
- interiorCycle: z.ZodOptional<z.ZodNumber>;
4548
- observedAt: z.ZodString;
4549
- purpose: z.ZodEnum<{
4550
- review: "review";
4551
- code: "code";
4552
- }>;
4553
- slotResolution: z.ZodObject<{
4554
- effort: z.ZodEnum<{
4555
- high: "high";
4556
- low: "low";
4557
- medium: "medium";
4558
- xhigh: "xhigh";
4559
- }>;
4560
- engine: z.ZodString;
4561
- fallbackTier: z.ZodOptional<z.ZodLiteral<"delegate">>;
4562
- layerSource: z.ZodEnum<{
4563
- committedDefault: "committedDefault";
4564
- operatorSession: "operatorSession";
4565
- userConfig: "userConfig";
4566
- }>;
4567
- model: z.ZodString;
4568
- tier: z.ZodEnum<{
4569
- review: "review";
4570
- delegate: "delegate";
4571
- oracle: "oracle";
4572
- workhorse: "workhorse";
4573
- scout: "scout";
4574
- }>;
4575
- }, z.core.$strict>;
4576
- startedAt: z.ZodString;
4577
- tier: z.ZodEnum<{
4578
- review: "review";
4579
- delegate: "delegate";
4580
- oracle: "oracle";
4581
- workhorse: "workhorse";
4582
- scout: "scout";
4583
- }>;
4584
- tokenUsage: z.ZodDiscriminatedUnion<[z.ZodObject<{
4585
- cachedInputTokens: z.ZodOptional<z.ZodNumber>;
4586
- inputTokens: z.ZodOptional<z.ZodNumber>;
4587
- outputTokens: z.ZodOptional<z.ZodNumber>;
4588
- reasoningOutputTokens: z.ZodOptional<z.ZodNumber>;
4589
- source: z.ZodEnum<{
4590
- "cursor-csv": "cursor-csv";
4591
- "codex-json": "codex-json";
4592
- "cursor-json": "cursor-json";
4593
- "claude-json": "claude-json";
4594
- }>;
4595
- status: z.ZodLiteral<"available">;
4596
- totalTokens: z.ZodNumber;
4597
- }, z.core.$strict>, z.ZodObject<{
4598
- missingReason: z.ZodString;
4599
- status: z.ZodLiteral<"unavailable">;
4600
- }, z.core.$strict>], "status">;
4601
- usageSource: z.ZodEnum<{
4602
- "cursor-agent-json": "cursor-agent-json";
4603
- "codex-exec-json": "codex-exec-json";
4604
- "grok-exec-json": "grok-exec-json";
4605
- "in-harness": "in-harness";
4606
- }>;
4607
- }, z.core.$strict>, readonly [z.ZodObject<{
4608
- createdAt: z.ZodString;
4609
- eventId: z.ZodString;
4610
- issue: z.ZodOptional<z.ZodNumber>;
4611
- pr: z.ZodOptional<z.ZodNumber>;
4612
- repo: z.ZodString;
4613
- schemaVersion: z.ZodLiteral<1>;
4614
- threadId: z.ZodOptional<z.ZodString>;
4615
- workerId: z.ZodOptional<z.ZodString>;
4616
- eventType: z.ZodLiteral<"delegate-exec">;
4617
- typeVersion: z.ZodLiteral<1>;
4618
- changedFiles: z.ZodArray<z.ZodString>;
4619
- command: z.ZodString;
4620
- diff: z.ZodString;
4621
- durationMs: z.ZodNumber;
4622
- endedAt: z.ZodString;
4623
- engineSessionId: z.ZodOptional<z.ZodString>;
4624
- exitCode: z.ZodNullable<z.ZodNumber>;
4625
- harness: z.ZodString;
4626
- interiorCycle: z.ZodOptional<z.ZodNumber>;
4627
- observedAt: z.ZodString;
4628
- purpose: z.ZodEnum<{
4629
- review: "review";
4630
- code: "code";
4631
- }>;
4632
- slotResolution: z.ZodObject<{
4633
- effort: z.ZodEnum<{
4634
- high: "high";
4635
- low: "low";
4636
- medium: "medium";
4637
- xhigh: "xhigh";
4638
- }>;
4639
- engine: z.ZodString;
4640
- fallbackTier: z.ZodOptional<z.ZodLiteral<"delegate">>;
4641
- layerSource: z.ZodEnum<{
4642
- committedDefault: "committedDefault";
4643
- operatorSession: "operatorSession";
4644
- userConfig: "userConfig";
4645
- }>;
4646
- model: z.ZodString;
4647
- tier: z.ZodEnum<{
4648
- review: "review";
4649
- delegate: "delegate";
4650
- oracle: "oracle";
4651
- workhorse: "workhorse";
4652
- scout: "scout";
4653
- }>;
4654
- }, z.core.$strict>;
4655
- startedAt: z.ZodString;
4656
- tier: z.ZodEnum<{
4657
- review: "review";
4658
- delegate: "delegate";
4659
- oracle: "oracle";
4660
- workhorse: "workhorse";
4661
- scout: "scout";
4662
- }>;
4663
- tokenUsage: z.ZodDiscriminatedUnion<[z.ZodObject<{
4664
- cachedInputTokens: z.ZodOptional<z.ZodNumber>;
4665
- inputTokens: z.ZodOptional<z.ZodNumber>;
4666
- outputTokens: z.ZodOptional<z.ZodNumber>;
4667
- reasoningOutputTokens: z.ZodOptional<z.ZodNumber>;
4668
- source: z.ZodEnum<{
4669
- "cursor-csv": "cursor-csv";
4670
- "codex-json": "codex-json";
4671
- "cursor-json": "cursor-json";
4672
- "claude-json": "claude-json";
4673
- }>;
4674
- status: z.ZodLiteral<"available">;
4675
- totalTokens: z.ZodNumber;
4676
- }, z.core.$strict>, z.ZodObject<{
4677
- missingReason: z.ZodString;
4678
- status: z.ZodLiteral<"unavailable">;
4679
- }, z.core.$strict>], "status">;
4680
- usageSource: z.ZodEnum<{
4681
- "cursor-agent-json": "cursor-agent-json";
4682
- "codex-exec-json": "codex-exec-json";
4683
- "grok-exec-json": "grok-exec-json";
4684
- "in-harness": "in-harness";
4685
- }>;
4686
- }, z.core.$strict>], {
4687
- readonly 1: z.ZodObject<{
4688
- changedFiles: z.ZodArray<z.ZodString>;
4689
- command: z.ZodString;
4690
- diff: z.ZodString;
4691
- durationMs: z.ZodNumber;
4692
- endedAt: z.ZodString;
4693
- engineSessionId: z.ZodOptional<z.ZodString>;
4694
- exitCode: z.ZodNullable<z.ZodNumber>;
4695
- harness: z.ZodString;
4696
- interiorCycle: z.ZodOptional<z.ZodNumber>;
4697
- observedAt: z.ZodString;
4698
- purpose: z.ZodEnum<{
4699
- review: "review";
4700
- code: "code";
4701
- }>;
4702
- slotResolution: z.ZodObject<{
4703
- effort: z.ZodEnum<{
4704
- high: "high";
4705
- low: "low";
4706
- medium: "medium";
4707
- xhigh: "xhigh";
4708
- }>;
4709
- engine: z.ZodString;
4710
- fallbackTier: z.ZodOptional<z.ZodLiteral<"delegate">>;
4711
- layerSource: z.ZodEnum<{
4712
- committedDefault: "committedDefault";
4713
- operatorSession: "operatorSession";
4714
- userConfig: "userConfig";
4715
- }>;
4716
- model: z.ZodString;
4717
- tier: z.ZodEnum<{
4718
- review: "review";
4719
- delegate: "delegate";
4720
- oracle: "oracle";
4721
- workhorse: "workhorse";
4722
- scout: "scout";
4723
- }>;
4724
- }, z.core.$strict>;
4725
- startedAt: z.ZodString;
4726
- tier: z.ZodEnum<{
4727
- review: "review";
4728
- delegate: "delegate";
4729
- oracle: "oracle";
4730
- workhorse: "workhorse";
4731
- scout: "scout";
4732
- }>;
4733
- tokenUsage: z.ZodDiscriminatedUnion<[z.ZodObject<{
4734
- cachedInputTokens: z.ZodOptional<z.ZodNumber>;
4735
- inputTokens: z.ZodOptional<z.ZodNumber>;
4736
- outputTokens: z.ZodOptional<z.ZodNumber>;
4737
- reasoningOutputTokens: z.ZodOptional<z.ZodNumber>;
4738
- source: z.ZodEnum<{
4739
- "cursor-csv": "cursor-csv";
4740
- "codex-json": "codex-json";
4741
- "cursor-json": "cursor-json";
4742
- "claude-json": "claude-json";
4743
- }>;
4744
- status: z.ZodLiteral<"available">;
4745
- totalTokens: z.ZodNumber;
4746
- }, z.core.$strict>, z.ZodObject<{
4747
- missingReason: z.ZodString;
4748
- status: z.ZodLiteral<"unavailable">;
4749
- }, z.core.$strict>], "status">;
4750
- usageSource: z.ZodEnum<{
4751
- "cursor-agent-json": "cursor-agent-json";
4752
- "codex-exec-json": "codex-exec-json";
4753
- "grok-exec-json": "grok-exec-json";
4754
- "in-harness": "in-harness";
4755
- }>;
4756
- }, z.core.$strict>;
4757
- }, {
4758
- createdAt: string;
4759
- eventId: string;
4760
- repo: string;
4761
- schemaVersion: 1;
4762
- eventType: "delegate-exec";
4763
- typeVersion: 1;
4764
- changedFiles: string[];
4765
- command: string;
4766
- diff: string;
4767
- durationMs: number;
4768
- endedAt: string;
4769
- exitCode: number | null;
4770
- harness: string;
4771
- observedAt: string;
4772
- purpose: "review" | "code";
4773
- slotResolution: {
4774
- effort: "high" | "low" | "medium" | "xhigh";
4775
- engine: string;
4776
- layerSource: "committedDefault" | "operatorSession" | "userConfig";
4777
- model: string;
4778
- tier: "review" | "delegate" | "oracle" | "workhorse" | "scout";
4779
- fallbackTier?: "delegate" | undefined;
4780
- };
4781
- startedAt: string;
4782
- tier: "review" | "delegate" | "oracle" | "workhorse" | "scout";
4783
- tokenUsage: {
4784
- source: "cursor-csv" | "codex-json" | "cursor-json" | "claude-json";
4785
- status: "available";
4786
- totalTokens: number;
4787
- cachedInputTokens?: number | undefined;
4788
- inputTokens?: number | undefined;
4789
- outputTokens?: number | undefined;
4790
- reasoningOutputTokens?: number | undefined;
4791
- } | {
4792
- missingReason: string;
4793
- status: "unavailable";
4794
- };
4795
- usageSource: "cursor-agent-json" | "codex-exec-json" | "grok-exec-json" | "in-harness";
4796
- issue?: number | undefined;
4797
- pr?: number | undefined;
4798
- threadId?: string | undefined;
4799
- workerId?: string | undefined;
4800
- engineSessionId?: string | undefined;
4801
- interiorCycle?: number | undefined;
4802
4212
  }>];
4803
4213
  type FactoryTraceEvent = FactoryTraceEventFromDefinitions<typeof FACTORY_TRACE_EVENT_DEFINITIONS>;
4804
4214
  //#endregion
@@ -4830,7 +4240,6 @@ declare const resolveTraceWriteSinks: (repoRoot: string, options?: ResolveTraceW
4830
4240
  //#endregion
4831
4241
  //#region src/packages/trace/implementation/facade.d.ts
4832
4242
  type ReadableFactoryTraceEvent = FactoryTraceEvent | z.infer<typeof UnknownFactoryTraceEventSchema>;
4833
- type WorkerCloseoutLessonsTraceEvent = z.infer<typeof WorkerCloseoutLessonsTraceEventSchema>;
4834
4243
  interface FactoryTraceFilters {
4835
4244
  eventType?: string | readonly string[];
4836
4245
  issue?: number | readonly number[];
@@ -5059,6 +4468,8 @@ interface DoctorReport {
5059
4468
  schemaVersion: typeof PROFILE_SCHEMA_VERSION;
5060
4469
  }
5061
4470
  interface DoctorProjectProfileInput extends LoadProjectProfileInput {
4471
+ /** Test seam for the non-mutating ambient gh authentication probe (#1457). */
4472
+ checkAmbientGh?: (cwd: string, env: NodeJS.ProcessEnv) => Promise<void> | void;
5062
4473
  /** Diff base for the admission preflight; ignored unless `preflight`. */
5063
4474
  base?: string;
5064
4475
  env?: NodeJS.ProcessEnv;
@@ -5221,7 +4632,7 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
5221
4632
  draft: boolean;
5222
4633
  mergeStateStatus: string;
5223
4634
  mergeable: string;
5224
- requiredChecks: "unknown" | "pending" | "passed" | "failed" | "none";
4635
+ requiredChecks: "unknown" | "passed" | "failed" | "pending" | "none";
5225
4636
  unresolvedReviewThreads: number;
5226
4637
  reviewDecision?: string | null | undefined;
5227
4638
  };
@@ -5236,13 +4647,13 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
5236
4647
  reviews: {
5237
4648
  correctness: {
5238
4649
  required: boolean;
5239
- status: "not-required" | "stale" | "blocked" | "current" | "missing";
4650
+ status: "blocked" | "not-required" | "current" | "stale" | "missing";
5240
4651
  reviewedHeadSha?: string | undefined;
5241
4652
  reviewedPatchId?: string | undefined;
5242
4653
  };
5243
4654
  security?: {
5244
4655
  required: boolean;
5245
- status: "not-required" | "stale" | "blocked" | "current" | "missing";
4656
+ status: "blocked" | "not-required" | "current" | "stale" | "missing";
5246
4657
  reviewedHeadSha?: string | undefined;
5247
4658
  reviewedPatchId?: string | undefined;
5248
4659
  } | undefined;
@@ -5305,7 +4716,7 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
5305
4716
  interior: number;
5306
4717
  };
5307
4718
  nextAction: "run-interior-cycle" | "advance-to-gate" | "run-gate-cycle" | "accept-nonblocking-findings" | "escalate-to-triage" | "ready-for-human";
5308
- stage: "interior" | "gate" | "interior-complete";
4719
+ stage: "gate" | "interior" | "interior-complete";
5309
4720
  forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
5310
4721
  } | undefined;
5311
4722
  reviewRuns?: PrReviewResult[] | undefined;
@@ -5340,7 +4751,7 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
5340
4751
  draft: boolean;
5341
4752
  mergeStateStatus: string;
5342
4753
  mergeable: string;
5343
- requiredChecks: "unknown" | "pending" | "passed" | "failed" | "none";
4754
+ requiredChecks: "unknown" | "passed" | "failed" | "pending" | "none";
5344
4755
  unresolvedReviewThreads: number;
5345
4756
  reviewDecision?: string | null | undefined;
5346
4757
  };
@@ -5355,13 +4766,13 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
5355
4766
  reviews: {
5356
4767
  correctness: {
5357
4768
  required: boolean;
5358
- status: "not-required" | "stale" | "blocked" | "current" | "missing";
4769
+ status: "blocked" | "not-required" | "current" | "stale" | "missing";
5359
4770
  reviewedHeadSha?: string | undefined;
5360
4771
  reviewedPatchId?: string | undefined;
5361
4772
  };
5362
4773
  security?: {
5363
4774
  required: boolean;
5364
- status: "not-required" | "stale" | "blocked" | "current" | "missing";
4775
+ status: "blocked" | "not-required" | "current" | "stale" | "missing";
5365
4776
  reviewedHeadSha?: string | undefined;
5366
4777
  reviewedPatchId?: string | undefined;
5367
4778
  } | undefined;
@@ -5424,7 +4835,7 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
5424
4835
  interior: number;
5425
4836
  };
5426
4837
  nextAction: "run-interior-cycle" | "advance-to-gate" | "run-gate-cycle" | "accept-nonblocking-findings" | "escalate-to-triage" | "ready-for-human";
5427
- stage: "interior" | "gate" | "interior-complete";
4838
+ stage: "gate" | "interior" | "interior-complete";
5428
4839
  forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
5429
4840
  } | undefined;
5430
4841
  reviewRuns?: PrReviewResult[] | undefined;
@@ -5843,275 +5254,6 @@ declare function assertWorkerCheckoutAllowed({
5843
5254
  probe?: CheckoutDirsProbe;
5844
5255
  }): void;
5845
5256
  //#endregion
5846
- //#region src/jev/schema.d.ts
5847
- /** The request body this package sends. No `model` field, ever: HQ names it. */
5848
- type JevRequestBody = Pick<SystemOneRequest, "state" | "questions">;
5849
- /**
5850
- * One answer, discriminated exactly as Jev discriminates it.
5851
- *
5852
- * Every member is a *stripping* object: an unknown key inside one answer is
5853
- * dropped, not an error. Erroring would let a single surprising field sink a
5854
- * whole response, and keeping it would put an upstream-named field into a
5855
- * record. Dropping is the only behavior that is both safe and non-destructive.
5856
- */
5857
- declare const jevAnswerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
5858
- noul: z.ZodNumber;
5859
- type: z.ZodLiteral<"noul">;
5860
- }, z.core.$strip>, z.ZodObject<{
5861
- choice: z.ZodString;
5862
- confidence: z.ZodNumber;
5863
- probabilities: z.ZodRecord<z.ZodString, z.ZodNumber>;
5864
- type: z.ZodLiteral<"choice">;
5865
- }, z.core.$strip>, z.ZodObject<{
5866
- confidence: z.ZodNumber;
5867
- probabilities: z.ZodRecord<z.ZodString, z.ZodNumber>;
5868
- score: z.ZodNumber;
5869
- type: z.ZodLiteral<"score">;
5870
- }, z.core.$strip>], "type">;
5871
- type JevAnswer = z.infer<typeof jevAnswerSchema>;
5872
- interface JevUsage {
5873
- input_tokens?: number;
5874
- output_tokens?: number;
5875
- }
5876
- interface JevResponse {
5877
- answers: Record<string, JevAnswer>;
5878
- /** The model HQ ran, or `unknown` when what it returned is not an id. */
5879
- model: string;
5880
- usage?: JevUsage;
5881
- }
5882
- /** What a report says when HQ names its model in something other than an id. */
5883
- declare const UNKNOWN_MODEL = "unknown";
5884
- /**
5885
- * A question set keyed by the names its answers come back under. Re-stated as a
5886
- * value type so adapters can build one incrementally without importing the
5887
- * SDK.
5888
- */
5889
- type JevQuestions = Questions;
5890
- type JevJsonValue = JsonValue;
5891
- //#endregion
5892
- //#region src/jev/cache.d.ts
5893
- /**
5894
- * The request-hash cache: the same request bytes against the same endpoint
5895
- * answer from disk instead of from HQ.
5896
- *
5897
- * The key is the endpoint plus the exact serialized request, and nothing else.
5898
- * That is the whole design: a changed snippet, a reworded question, a
5899
- * different reference file and a different HQ all move the bytes, so they all
5900
- * move the key. There is no key schema to keep in step with the request
5901
- * builder, and no way to grow one that forgets a field.
5902
- *
5903
- * It lives under `node_modules/.cache`, which is disposable by convention and
5904
- * already ignored everywhere — a Jev answer is a session diagnostic (ADR
5905
- * 0034), not a build input and not evidence.
5906
- *
5907
- * An entry that exists but cannot be used — unreadable, not JSON, not Jev's
5908
- * response shape — is an error, not a miss, and so is a write that fails. Only
5909
- * `ENOENT` means "nothing is stored". Repairing any of the others silently and
5910
- * calling HQ anyway would be a second behavior for one failure, and a paid
5911
- * one; the run names the entry and its cause, and the operator removes it.
5912
- */
5913
- /** A cache entry that could not be used, or could not be written. */
5914
- declare class JevCacheError extends Error {
5915
- readonly path: string;
5916
- constructor(entryPath: string, detail: string);
5917
- }
5918
- /** Where a repository's Jev answers are kept. */
5919
- declare const defaultJevCacheDirectory: (cwd: string) => string;
5920
- interface JevCache {
5921
- /** The entry key for these request bytes: endpoint plus the bytes, hashed. */
5922
- keyFor: (serialized: string) => string;
5923
- /** The stored answer, or `undefined` when nothing is stored. */
5924
- read: (serialized: string) => JevResponse | undefined;
5925
- write: (serialized: string, response: JevResponse) => void;
5926
- }
5927
- interface OpenJevCacheInput {
5928
- /** Defaults to `node_modules/.cache/patronage-jev` under `cwd`. */
5929
- directory?: string;
5930
- /** The HQ Jev endpoint these answers came from. Part of every key. */
5931
- endpoint: string;
5932
- }
5933
- /**
5934
- * Opens the cache, creating its directory now so a directory that cannot be
5935
- * written fails here — at the one place that names it — rather than midway
5936
- * through a run as an unexplained request failure.
5937
- */
5938
- declare const openJevCache: ({
5939
- directory,
5940
- endpoint
5941
- }: OpenJevCacheInput) => JevCache;
5942
- //#endregion
5943
- //#region src/jev/client.d.ts
5944
- /** Sends one prepared packet and returns Jev's body, plus the model HQ ran. */
5945
- type JevEvaluate = (serializedBody: string) => Promise<JevResponse>;
5946
- /**
5947
- * Either a reachable HQ Jev route, or the one sentence saying why there is
5948
- * none. A run takes this union rather than a bare `evaluate`, so "there are no
5949
- * credentials" arrives at the caller in the same shape as "HQ refused": one
5950
- * typed unavailable result naming its cause, never a throw and never a
5951
- * silently skipped run.
5952
- */
5953
- type JevGateway = {
5954
- evaluate: JevEvaluate;
5955
- endpoint: string;
5956
- status: "ready";
5957
- } /** No call is possible. Every match is unavailable with this reason. */ | {
5958
- reason: string;
5959
- status: "unavailable";
5960
- };
5961
- /**
5962
- * An upstream refusal, carried with the code HQ passed through rather than
5963
- * flattened into prose. `max_tokens_exceeded` is the one a caller acts on: it
5964
- * means the packet was too large despite the local budget.
5965
- */
5966
- declare class JevRequestError extends Error {
5967
- readonly code: string | undefined;
5968
- readonly httpStatus: number;
5969
- constructor(httpStatus: number, code: string | undefined, message: string);
5970
- }
5971
- interface ResolveJevGatewayInput {
5972
- env: NodeJS.ProcessEnv;
5973
- fetchImpl?: typeof fetch;
5974
- }
5975
- /**
5976
- * Resolves the gateway, or says why there isn't one. Every `unavailable`
5977
- * reason is an operator-facing sentence naming a remedy that applies to this
5978
- * command, and none of them can carry a credential: nothing here reads a
5979
- * resolved value into a message.
5980
- *
5981
- * The order is the policy. The origin is checked against HQ ingest's protocol
5982
- * rule and the operator's `hqAllowedOrigins` first, and only an authorized
5983
- * origin gets as far as reading credentials. An unauthorized origin never sees
5984
- * a request.
5985
- */
5986
- declare const resolveJevGateway: ({
5987
- env,
5988
- fetchImpl
5989
- }: ResolveJevGatewayInput) => Promise<JevGateway>;
5990
- //#endregion
5991
- //#region src/jev/request.d.ts
5992
- interface JevMatch {
5993
- /**
5994
- * Stable across splitting. Question names must already namespace it, so
5995
- * moving a match into a later split never rewrites a question or an answer
5996
- * name.
5997
- */
5998
- key: string;
5999
- /** Answer-name-keyed questions about this match. */
6000
- questions: JevQuestions;
6001
- /** Match-local state, published at `matches.<key>` of the request. */
6002
- state: JevJsonValue;
6003
- }
6004
- interface JevFile {
6005
- matches: readonly JevMatch[];
6006
- /** Repository-relative path. Identity of the shared state, and sent with it. */
6007
- path: string;
6008
- /** State every match in this file is read against, sent once per request. */
6009
- shared: JevJsonValue;
6010
- }
6011
- interface JevRequest {
6012
- /** The parsed body, for a caller that records a request without sending it. */
6013
- body: JevRequestBody;
6014
- estimatedTokens: number;
6015
- /** SHA-256 of `serialized` — the exact bytes that would be sent. */
6016
- hash: string;
6017
- matchKeys: string[];
6018
- /** The file this request asks about. */
6019
- path: string;
6020
- /** The bytes to POST. Serialized once so the hash cannot drift from them. */
6021
- serialized: string;
6022
- }
6023
- interface JevUnavailableMatch {
6024
- key: string;
6025
- reason: string;
6026
- }
6027
- interface JevRequestPlan {
6028
- requests: JevRequest[];
6029
- unavailable: JevUnavailableMatch[];
6030
- }
6031
- interface BuildJevRequestsInput {
6032
- /** Per-request ceiling override, in tokens. Defaults to the budget above. */
6033
- budgetTokens?: number;
6034
- files: readonly JevFile[];
6035
- }
6036
- /**
6037
- * Turns files into the requests that will be sent, plus the matches that
6038
- * cannot be sent and why. Pure: it performs no I/O and decides nothing about
6039
- * transport.
6040
- */
6041
- declare const buildJevRequests: ({
6042
- budgetTokens,
6043
- files
6044
- }: BuildJevRequestsInput) => JevRequestPlan;
6045
- //#endregion
6046
- //#region src/jev/run.d.ts
6047
- /**
6048
- * Sending a file's requests and recording exactly what happened.
6049
- *
6050
- * A Jev run is a session diagnostic (ADR 0034): it owns no gate and no demand,
6051
- * so a failed request is data, not a stop. One request failing never erases
6052
- * the answers a sibling request already returned, and every match that did not
6053
- * get an answer says why — including when the failure was that there was no
6054
- * gateway to call at all.
6055
- *
6056
- * Every failure has exactly one behavior: the affected matches become
6057
- * unavailable, named with their cause. Nothing is retried, nothing is
6058
- * truncated to fit, and no result is dropped to keep a run tidy.
6059
- */
6060
- /** What one request did. Recorded whether it succeeded, failed, or was cached. */
6061
- interface JevRequestRecord {
6062
- /** True when the answer came from the request-hash cache; no HQ call was made. */
6063
- cached: boolean;
6064
- elapsedMs: number;
6065
- /** Set when the request failed; the reason, in operator-facing prose. */
6066
- error?: string;
6067
- /** The upstream code, when HQ passed one through (`max_tokens_exceeded`). */
6068
- errorCode?: string;
6069
- estimatedTokens: number;
6070
- matchKeys: string[];
6071
- /** The model HQ reported actually running. Absent on a failed request. */
6072
- model?: string;
6073
- /** The file this request asked about. */
6074
- path: string;
6075
- /** SHA-256 of the exact request bytes. */
6076
- requestHash: string;
6077
- usage?: JevUsage;
6078
- }
6079
- /** Whether the run got answers for everything it set out to ask about. */
6080
- type JevCompletion = "complete" | "partial" | "unavailable";
6081
- interface JevRunResult {
6082
- /** Answers per match, keyed by that match's own question names. */
6083
- answersByMatchKey: Record<string, Record<string, JevAnswer>>;
6084
- completion: JevCompletion;
6085
- /** Wall-clock time spent on requests, including cache reads. */
6086
- elapsedMs: number;
6087
- /** Distinct models HQ reported, in first-seen order. */
6088
- models: string[];
6089
- requests: JevRequestRecord[];
6090
- /** Why a match has no answers. Every unanswered match appears here. */
6091
- unavailableByMatchKey: Record<string, string>;
6092
- }
6093
- interface RunJevFilesInput {
6094
- budgetTokens?: number;
6095
- /** Omitted means every request is sent live. */
6096
- cache?: JevCache;
6097
- files: readonly JevFile[];
6098
- gateway: JevGateway;
6099
- }
6100
- /**
6101
- * Builds the requests, sends the ones the cache does not already answer, and
6102
- * routes answers back to the matches that asked for them.
6103
- *
6104
- * Requests go one at a time. Bounded load is the point: a repository-wide run
6105
- * would otherwise open dozens of concurrent 32k-token requests against one HQ
6106
- * route for a diagnostic nothing is waiting on.
6107
- */
6108
- declare const runJevFiles: ({
6109
- budgetTokens,
6110
- cache,
6111
- files,
6112
- gateway
6113
- }: RunJevFilesInput) => Promise<JevRunResult>;
6114
- //#endregion
6115
5257
  //#region src/index.d.ts
6116
5258
  interface CreateProgramOptions {
6117
5259
  actions?: {
@@ -6140,4 +5282,4 @@ declare function createProgram(options?: CreateProgramOptions): Command;
6140
5282
  */
6141
5283
  declare function run(argv?: string[], cliEntry?: string): Promise<void>;
6142
5284
  //#endregion
6143
- export { type AppendFactoryTraceEventResult, type AssembledReviewPrompt, type BatteryCommandDisposition, type BatteryDisposition, type BoundaryCheckArgs, type BoundaryCheckDependencies, type BoundaryCheckProofRecord, type BuildEpicStructureEventInput, type CloudflareAccessServiceToken, type CompletedFactoryCheckSnapshot, CreateProgramOptions, DEFAULT_DEMAND_WAIVER_PATH, DEFAULT_FACTORY_REPOSITORY, DEFAULT_ROOT_SHARED_GLOBS, type DagDocument, type DemandWaiveArgs, type DemandWaiveDependencies, DemandWaiveRefusalError, type DemandWaiver, type DemandWaiverStore, EMPTY_TREE_OBJECT_HASH, EPIC_STRUCTURE_NODE_STATUSES, EPIC_STRUCTURE_SCHEMA_VERSION, type EpicStructureEvent, type EpicStructureGraphPayload, type EpicStructureNodeStatus, EpicStructureValidationError, type EvidenceEmitArgs, type EvidenceEmitDependencies, type EvidenceEmitResult, FACTORY_BASE_REF_ENV, FACTORY_CHANGED_FILES_ENV, FACTORY_CHANGED_FILES_FILE_ENV, type FactoryCliInvocation, FactoryCliInvocationSchema, type FactoryPrStatusCheckName, type FactoryPrStatusSources, type FactoryProjectProfile, type FactoryTraceDiagnostic, type FactoryTraceEnvelope, type FactoryTraceEvent, type FollowUpAction, FollowUpActionSchema, type GitHubCheckRunMergeFreezeApi, type ImpactScopeDecision, type ImpactScopeSurface, type IssueReviewFocus, type JevAnswer, type JevCache, JevCacheError, type JevCompletion, type JevEvaluate, type JevFile, type JevGateway, type JevJsonValue, type JevMatch, type JevQuestions, type JevRequest, JevRequestError, type JevRequestPlan, type JevRequestRecord, type JevResponse, type JevRunResult, type JevUnavailableMatch, type JevUsage, MERGE_FREEZE_APP_SLUG, MERGE_FREEZE_CHECK_NAME, type MergeFreezeAuthority, type MergeFreezeGeneration, type MergeFreezeState, type MergeFreezeStoreInput, type PlanFactoryPrStatusHudInput, type PrPublishArgs, type PrPublishDependencies, PrPublishFollowUpError, type PrPublishFollowUpOutcome, type PrPublishHandoff, type PrPublishResult, type PrReadyArgs, type PrReadyProof, type PrVerifyProof, type PresentFactoryPrStatusHudDependencies, type PresentFactoryPrStatusHudInput, type PreviewDisposition, type PreviewLifecyclePlan, type PreviewTargetPlan, type PublishEpicStructureArgs, type PublishEpicStructureResult, type PublishFollowUpPlan, REVIEW_FOCUS_SECTION, type ReadFactoryPrStatusSourcesDependencies, type ReadFactoryPrStatusSourcesInput, type RefreshFactoryPrStatusHudInput, type RenderFactoryPrStatusHudInput, type ReviewGateNotRequiredProof, type ReviewGateTraceIdentity, type ReviewPromptSection, type ReviewPromptSectionProvenance, type ScanFactoryTraceDiagnosticsOptions, type ScanFactoryTraceOptions, type ScanFactoryTraceResult, type ScopedOutCommand, type TraceMirrorDiagnostic, type TraceSink, type TraceWriteResult, type TraceWriteSinks, UNKNOWN_MODEL, type VerificationBatteryPlan, type VerificationReuse, type VerificationRunContext, type VerificationRunContextInput, type WaivedDemand, WorkerCheckoutGuardError, type WorkerCloseoutLessonsTraceEvent, appendWithTraceSinks, applyDemandWaiver, assembleReviewPrompt, assertFactoryPrStatusIdentity, assertWorkerCheckoutAllowed, authorizeDemandWaiver, batteryScopeSummaryLines, boundary_manifest_d_exports as boundaryManifest, boundary_review_proof_d_exports as boundaryReviewProof, buildEpicStructureEvent, buildEpicStructurePayload, buildEvidenceEnvelope, buildJevRequests, buildReviewGateNotRequiredTraceEvent, choice, comment_provenance_d_exports as commentProvenance, createGitHubCheckRunMergeFreezeStore, createLocalJsonlTraceSink, createProgram, createVerificationRunContext, defaultJevCacheDirectory, doctorProjectProfile, epicStructureEventId, evidenceEnvelopeFilename, followUpFromArgv, impactStampScopeDecision, isProductionHqUrl, loadProjectProfile, normalizeIssueComments, noul, openJevCache, planFactoryPrStatusHud, planPreviewLifecycle, planPublishFollowUp, planVerificationBattery, readiness_evaluation_d_exports as prReadinessEvaluation, external_evidence_d_exports as prReadinessExternalEvidence, pr_body_renderer_d_exports as prReadinessPrBodyRenderer, proof_identity_d_exports as prReadinessProofIdentity, review_proof_d_exports as prReadinessReviewProof, status_check_rollup_d_exports as prReadinessStatusChecks, verification_proof_d_exports as prReadinessVerificationProof, presentFactoryPrStatusHud, previewLifecycleTargets, publishEpicStructure, readDemandWaivers, readFactoryPrStatusSources, readPrReadyProof, refreshFactoryPrStatusHud, refreshFactoryPrStatusHudSafely, renderFactoryPrStatusHud, resolveFactoryRepository, resolveJevGateway, resolveTraceWriteSinks, reviewFocusFromIssueBody, reviewPromptSectionSchema, reviewPromptSectionsSchema, run, runBoundaryCheck, runDemandWaive, runEvidenceEmit, runJevFiles, runPrPublish, runPrReady, runPrReview, runPrVerify, scanFactoryTraceDiagnostics, scanFactoryTraceEvents, score, selectWaiversForCandidate, toFactoryTraceEnvelope, tryAppendReviewGateNotRequiredTraceEvent, validateBoundaryCheckProof, validateDagDocument, validateDemandWaiverStore, validateFactoryTraceEvent, validateMergeFreezeState, validatePrReadyProof, validatePrVerifyProof, validatePreviewLifecyclePlan, waivedDemandNotice, waivedDemandSchema, worktree_scratch_files_d_exports as worktreeScratchFiles };
5285
+ export { type AppendFactoryTraceEventResult, type AssembledReviewPrompt, type BatteryCommandDisposition, type BatteryDisposition, type BoundaryCheckArgs, type BoundaryCheckDependencies, type BoundaryCheckProofRecord, type BuildEpicStructureEventInput, type CloudflareAccessServiceToken, type CompletedFactoryCheckSnapshot, CreateProgramOptions, DEFAULT_DEMAND_WAIVER_PATH, DEFAULT_FACTORY_REPOSITORY, DEFAULT_ROOT_SHARED_GLOBS, type DagDocument, type DemandWaiveArgs, type DemandWaiveDependencies, DemandWaiveRefusalError, type DemandWaiver, type DemandWaiverStore, EMPTY_TREE_OBJECT_HASH, EPIC_STRUCTURE_NODE_STATUSES, EPIC_STRUCTURE_SCHEMA_VERSION, type EpicStructureEvent, type EpicStructureGraphPayload, type EpicStructureNodeStatus, EpicStructureValidationError, type EvidenceEmitArgs, type EvidenceEmitDependencies, type EvidenceEmitResult, FACTORY_BASE_REF_ENV, FACTORY_CHANGED_FILES_ENV, FACTORY_CHANGED_FILES_FILE_ENV, type FactoryCliInvocation, FactoryCliInvocationSchema, type FactoryPrStatusCheckName, type FactoryPrStatusSources, type FactoryProjectProfile, type FactoryTraceDiagnostic, type FactoryTraceEnvelope, type FactoryTraceEvent, type FollowUpAction, FollowUpActionSchema, type GitHubCheckRunMergeFreezeApi, type ImpactScopeDecision, type ImpactScopeSurface, type IssueReviewFocus, MERGE_FREEZE_APP_SLUG, MERGE_FREEZE_CHECK_NAME, type MergeFreezeAuthority, type MergeFreezeGeneration, type MergeFreezeState, type MergeFreezeStoreInput, type PlanFactoryPrStatusHudInput, type PrPublishArgs, type PrPublishDependencies, PrPublishFollowUpError, type PrPublishFollowUpOutcome, type PrPublishHandoff, type PrPublishResult, type PrReadyArgs, type PrReadyProof, type PrVerifyProof, type PresentFactoryPrStatusHudDependencies, type PresentFactoryPrStatusHudInput, type PreviewDisposition, type PreviewLifecyclePlan, type PreviewTargetPlan, type PublishEpicStructureArgs, type PublishEpicStructureResult, type PublishFollowUpPlan, REVIEW_FOCUS_SECTION, type ReadFactoryPrStatusSourcesDependencies, type ReadFactoryPrStatusSourcesInput, type RefreshFactoryPrStatusHudInput, type RenderFactoryPrStatusHudInput, type ReviewGateNotRequiredProof, type ReviewGateTraceIdentity, type ReviewPromptSection, type ReviewPromptSectionProvenance, type ScanFactoryTraceDiagnosticsOptions, type ScanFactoryTraceOptions, type ScanFactoryTraceResult, type ScopedOutCommand, type TraceMirrorDiagnostic, type TraceSink, type TraceWriteResult, type TraceWriteSinks, type VerificationBatteryPlan, type VerificationReuse, type VerificationRunContext, type VerificationRunContextInput, type WaivedDemand, WorkerCheckoutGuardError, appendWithTraceSinks, applyDemandWaiver, assembleReviewPrompt, assertFactoryPrStatusIdentity, assertWorkerCheckoutAllowed, authorizeDemandWaiver, batteryScopeSummaryLines, boundary_manifest_d_exports as boundaryManifest, boundary_review_proof_d_exports as boundaryReviewProof, buildEpicStructureEvent, buildEpicStructurePayload, buildEvidenceEnvelope, buildReviewGateNotRequiredTraceEvent, comment_provenance_d_exports as commentProvenance, createGitHubCheckRunMergeFreezeStore, createLocalJsonlTraceSink, createProgram, createVerificationRunContext, doctorProjectProfile, epicStructureEventId, evidenceEnvelopeFilename, followUpFromArgv, impactStampScopeDecision, isProductionHqUrl, loadProjectProfile, normalizeIssueComments, planFactoryPrStatusHud, planPreviewLifecycle, planPublishFollowUp, planVerificationBattery, readiness_evaluation_d_exports as prReadinessEvaluation, external_evidence_d_exports as prReadinessExternalEvidence, pr_body_renderer_d_exports as prReadinessPrBodyRenderer, proof_identity_d_exports as prReadinessProofIdentity, review_proof_d_exports as prReadinessReviewProof, status_check_rollup_d_exports as prReadinessStatusChecks, verification_proof_d_exports as prReadinessVerificationProof, presentFactoryPrStatusHud, previewLifecycleTargets, publishEpicStructure, readDemandWaivers, readFactoryPrStatusSources, readPrReadyProof, refreshFactoryPrStatusHud, refreshFactoryPrStatusHudSafely, renderFactoryPrStatusHud, resolveFactoryRepository, resolveTraceWriteSinks, reviewFocusFromIssueBody, reviewPromptSectionSchema, reviewPromptSectionsSchema, run, runBoundaryCheck, runDemandWaive, runEvidenceEmit, runPrPublish, runPrReady, runPrReview, runPrVerify, scanFactoryTraceDiagnostics, scanFactoryTraceEvents, selectWaiversForCandidate, toFactoryTraceEnvelope, tryAppendReviewGateNotRequiredTraceEvent, validateBoundaryCheckProof, validateDagDocument, validateDemandWaiverStore, validateFactoryTraceEvent, validateMergeFreezeState, validatePrReadyProof, validatePrVerifyProof, validatePreviewLifecyclePlan, waivedDemandNotice, waivedDemandSchema, worktree_scratch_files_d_exports as worktreeScratchFiles };