@patronage/software-factory 1.0.0-alpha.44 → 1.0.0-alpha.46

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
@@ -2,8 +2,6 @@ import { Command } from "commander";
2
2
  import { existsSync, readFileSync, rmSync } from "node:fs";
3
3
  import { PreviewProofRegistration } from "@patronage/factory-ci";
4
4
  import { z } from "zod";
5
-
6
- //#region src/factory-app-broker-client.d.ts
7
5
  /**
8
6
  * The opt-in broker permission set (#1360): `actions: read`, `checks: read`,
9
7
  * `contents: read`, `issues: read`, and `pull_requests: write` on the
@@ -14,8 +12,6 @@ import { z } from "zod";
14
12
  * A request without a scope is the `checks: write` mint, unchanged.
15
13
  */
16
14
  declare const FACTORY_APP_BROKER_ADMISSION_SCOPE = "admission";
17
- //#endregion
18
- //#region src/user-config.d.ts
19
15
  declare const githubAppConfigSchema: z.ZodObject<{
20
16
  appId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
21
17
  installationId: z.ZodOptional<z.ZodNumber>;
@@ -46,8 +42,6 @@ interface LoadUserConfigResult {
46
42
  config: FactoryUserConfig;
47
43
  ignoredKeys?: string[];
48
44
  }
49
- //#endregion
50
- //#region src/github-app-access.d.ts
51
45
  interface FactoryAppAccessDependencies {
52
46
  env?: NodeJS.ProcessEnv;
53
47
  existsSync?: (path: string) => boolean;
@@ -78,8 +72,6 @@ interface FactoryAppAccessDependencies {
78
72
  token?: string;
79
73
  transportAttempts?: number;
80
74
  }
81
- //#endregion
82
- //#region src/admission-credential.d.ts
83
75
  /**
84
76
  * The GitHub calls a Cursor VM's own `gh` credential cannot make (#1327).
85
77
  * Cursor mints the VM token without `pull_requests: write` or `issues`, so on
@@ -114,8 +106,6 @@ interface AdmissionCredential {
114
106
  */
115
107
  token: (operation: AdmissionOperation, repository: AdmissionRepository) => Promise<string | undefined>;
116
108
  }
117
- //#endregion
118
- //#region src/review-rungs.d.ts
119
109
  declare const EVIDENCE_REVIEW_RUNGS: readonly ["independent-model", "oracle", "human"];
120
110
  type EvidenceReviewRung = (typeof EVIDENCE_REVIEW_RUNGS)[number];
121
111
  declare namespace boundary_manifest_d_exports {
@@ -129,28 +119,28 @@ declare const boundaryManifestBaseSchema: z.ZodObject<{
129
119
  boundary: z.ZodString;
130
120
  closeout: z.ZodOptional<z.ZodObject<{
131
121
  review: z.ZodEnum<{
122
+ human: "human";
132
123
  "independent-model": "independent-model";
133
124
  oracle: "oracle";
134
- human: "human";
135
125
  }>;
136
126
  }, z.core.$loose>>;
137
127
  declaredBy: z.ZodString;
138
128
  integrationBranch: z.ZodOptional<z.ZodString>;
139
129
  schemaVersion: z.ZodLiteral<1>;
140
130
  topology: z.ZodEnum<{
131
+ "each-to-epic": "each-to-epic";
141
132
  "each-to-main": "each-to-main";
142
133
  flagged: "flagged";
143
134
  stacked: "stacked";
144
- "each-to-epic": "each-to-epic";
145
135
  }>;
146
136
  waves: z.ZodArray<z.ZodObject<{
147
137
  autoMerge: z.ZodOptional<z.ZodBoolean>;
148
138
  issues: z.ZodArray<z.ZodNumber>;
149
139
  name: z.ZodString;
150
140
  review: z.ZodEnum<{
141
+ human: "human";
151
142
  "independent-model": "independent-model";
152
143
  oracle: "oracle";
153
- human: "human";
154
144
  }>;
155
145
  }, z.core.$loose>>;
156
146
  }, z.core.$loose>;
@@ -158,28 +148,28 @@ declare const boundaryManifestSchema: z.ZodObject<{
158
148
  boundary: z.ZodString;
159
149
  closeout: z.ZodOptional<z.ZodObject<{
160
150
  review: z.ZodEnum<{
151
+ human: "human";
161
152
  "independent-model": "independent-model";
162
153
  oracle: "oracle";
163
- human: "human";
164
154
  }>;
165
155
  }, z.core.$loose>>;
166
156
  declaredBy: z.ZodString;
167
157
  integrationBranch: z.ZodOptional<z.ZodString>;
168
158
  schemaVersion: z.ZodLiteral<1>;
169
159
  topology: z.ZodEnum<{
160
+ "each-to-epic": "each-to-epic";
170
161
  "each-to-main": "each-to-main";
171
162
  flagged: "flagged";
172
163
  stacked: "stacked";
173
- "each-to-epic": "each-to-epic";
174
164
  }>;
175
165
  waves: z.ZodArray<z.ZodObject<{
176
166
  autoMerge: z.ZodOptional<z.ZodBoolean>;
177
167
  issues: z.ZodArray<z.ZodNumber>;
178
168
  name: z.ZodString;
179
169
  review: z.ZodEnum<{
170
+ human: "human";
180
171
  "independent-model": "independent-model";
181
172
  oracle: "oracle";
182
- human: "human";
183
173
  }>;
184
174
  }, z.core.$loose>>;
185
175
  }, z.core.$loose>;
@@ -204,8 +194,6 @@ type BoundaryManifestParse = {
204
194
  };
205
195
  declare const parseBoundaryManifest: (issueBody: string) => BoundaryManifestParse;
206
196
  declare const closeoutRungFor: (manifest: BoundaryManifest) => EvidenceReviewRung;
207
- //#endregion
208
- //#region src/github-issue-comments.d.ts
209
197
  interface GithubIssueCommentApi {
210
198
  body: string;
211
199
  created_at: string;
@@ -226,7 +214,7 @@ interface GithubIssueComment {
226
214
  updatedAt: string;
227
215
  url: string;
228
216
  }
229
- declare const normalizeIssueComments: (value: GithubIssueCommentApi[] | GithubIssueCommentApi[][]) => GithubIssueComment[];
217
+ export declare const normalizeIssueComments: (value: GithubIssueCommentApi[] | GithubIssueCommentApi[][]) => GithubIssueComment[];
230
218
  declare namespace boundary_review_proof_d_exports {
231
219
  export { BOUNDARY_REVIEW_PROOF_KIND, BoundaryReviewProof, BoundaryReviewProofComment, BoundaryReviewProofParseFailure, boundaryReviewProofAuthorsSeen, boundaryReviewProofParseFailures, boundaryReviewProofSchema, selectBoundaryReviewProof, undispositionedBlockingFindings };
232
220
  }
@@ -258,14 +246,14 @@ declare const boundaryReviewProofBaseSchema: z.ZodObject<{
258
246
  value: z.ZodString;
259
247
  }, z.core.$loose>;
260
248
  outcome: z.ZodEnum<{
261
- pass: "pass";
262
249
  fail: "fail";
250
+ pass: "pass";
263
251
  }>;
264
252
  producer: z.ZodString;
265
253
  rung: z.ZodEnum<{
254
+ human: "human";
266
255
  "independent-model": "independent-model";
267
256
  oracle: "oracle";
268
- human: "human";
269
257
  }>;
270
258
  schemaVersion: z.ZodLiteral<1>;
271
259
  sessionId: z.ZodOptional<z.ZodString>;
@@ -302,14 +290,14 @@ declare const boundaryReviewProofSchema: z.ZodObject<{
302
290
  value: z.ZodString;
303
291
  }, z.core.$loose>;
304
292
  outcome: z.ZodEnum<{
305
- pass: "pass";
306
293
  fail: "fail";
294
+ pass: "pass";
307
295
  }>;
308
296
  producer: z.ZodString;
309
297
  rung: z.ZodEnum<{
298
+ human: "human";
310
299
  "independent-model": "independent-model";
311
300
  oracle: "oracle";
312
- human: "human";
313
301
  }>;
314
302
  schemaVersion: z.ZodLiteral<1>;
315
303
  sessionId: z.ZodOptional<z.ZodString>;
@@ -334,8 +322,6 @@ declare const selectBoundaryReviewProof: (comments: GithubIssueComment[], bounda
334
322
  declare const boundaryReviewProofAuthorsSeen: (comments: GithubIssueComment[], boundary: string) => string[];
335
323
  declare const boundaryReviewProofParseFailures: (comments: GithubIssueComment[], boundary: string) => BoundaryReviewProofParseFailure[];
336
324
  declare const undispositionedBlockingFindings: (proof: BoundaryReviewProof) => string[];
337
- //#endregion
338
- //#region src/boundary-membership-graph.d.ts
339
325
  /** The boundary-manifest wave demand that applies to one pull request. */
340
326
  interface WaveReviewDemand {
341
327
  autoMerge: boolean;
@@ -352,9 +338,7 @@ interface BoundaryPullRequestRef {
352
338
  number: number;
353
339
  state: "OPEN" | "CLOSED" | "MERGED";
354
340
  }
355
- //#endregion
356
- //#region src/demand-waiver.d.ts
357
- declare const DEFAULT_DEMAND_WAIVER_PATH = ".factory-memory/demand-waivers.json";
341
+ export declare const DEFAULT_DEMAND_WAIVER_PATH = ".factory-memory/demand-waivers.json";
358
342
  /** One recorded operator act: this demand, on this candidate, waived. */
359
343
  interface DemandWaiver {
360
344
  candidate: {
@@ -374,7 +358,7 @@ interface DemandWaiverStore {
374
358
  schemaVersion: 1;
375
359
  waivers: DemandWaiver[];
376
360
  }
377
- declare const validateDemandWaiverStore: (value: unknown) => DemandWaiverStore;
361
+ export declare const validateDemandWaiverStore: (value: unknown) => DemandWaiverStore;
378
362
  /**
379
363
  * A demand that was in force, was NOT met, and was waived by the operator.
380
364
  *
@@ -391,13 +375,9 @@ interface WaivedDemand {
391
375
  /** The demand's refusals at evaluation time, preserved verbatim. */
392
376
  unmetReasons: string[];
393
377
  }
394
- declare const waivedDemandSchema: z.ZodType<WaivedDemand>;
378
+ export declare const waivedDemandSchema: z.ZodType<WaivedDemand>;
395
379
  /** The waivers that bind one candidate: same PR, same head. */
396
- declare const selectWaiversForCandidate: ({
397
- headSha,
398
- pr,
399
- waivers
400
- }: {
380
+ export declare const selectWaiversForCandidate: ({ headSha, pr, waivers }: {
401
381
  headSha: string | undefined;
402
382
  pr: number;
403
383
  waivers: readonly DemandWaiver[];
@@ -413,17 +393,13 @@ interface DemandOutcome {
413
393
  * — a waiver can only ever move a demand from *unmet-and-blocking* to
414
394
  * *unmet-and-waived*, never to met.
415
395
  */
416
- declare const applyDemandWaiver: ({
417
- demand,
418
- reasons,
419
- waivers
420
- }: {
396
+ export declare const applyDemandWaiver: ({ demand, reasons, waivers }: {
421
397
  demand: string;
422
398
  reasons: readonly string[];
423
399
  waivers: readonly DemandWaiver[];
424
400
  }) => DemandOutcome;
425
401
  /** How a waived demand reads to a human. Never the word "satisfied". */
426
- declare const waivedDemandNotice: (waived: WaivedDemand) => string;
402
+ export declare const waivedDemandNotice: (waived: WaivedDemand) => string;
427
403
  interface DemandWaiverAuthorization {
428
404
  operator: string;
429
405
  session?: string;
@@ -441,15 +417,10 @@ type AuthorizeDemandWaiverResult = {
441
417
  * not credential-backed, so its absence or equality never authorizes or
442
418
  * refuses an operator act.
443
419
  */
444
- declare const authorizeDemandWaiver: ({
445
- authenticatedLogin,
446
- session
447
- }: {
420
+ export declare const authorizeDemandWaiver: ({ authenticatedLogin, session }: {
448
421
  authenticatedLogin: string | undefined;
449
422
  session: string | undefined;
450
423
  }) => AuthorizeDemandWaiverResult;
451
- //#endregion
452
- //#region src/hq-credentials.d.ts
453
424
  /**
454
425
  * Why a reference did not resolve. Each value names a different remedy, and
455
426
  * none of them can be inferred from a value-or-nothing result:
@@ -474,14 +445,7 @@ type SecretResolution = {
474
445
  };
475
446
  /** Resolves a secret reference. Injected so tests stay offline. */
476
447
  type SecretReferenceResolver = (reference: string) => SecretResolution;
477
- //#endregion
478
- //#region src/hq-ingest-sink.d.ts
479
448
  interface HqIngestDependencies {
480
- /**
481
- * @deprecated Custom persistence seam. It receives an immutable spool-file
482
- * target and one complete JSON event; production never appends legacy JSONL.
483
- */
484
- appendJournal?: (target: string, row: string) => Promise<void> | void;
485
449
  diagnostic?: (line: string) => Promise<void> | void;
486
450
  env?: NodeJS.ProcessEnv;
487
451
  fetch?: typeof fetch;
@@ -633,7 +597,8 @@ interface HqSpoolWorkCount {
633
597
  * directory is created, nothing is secured, and nothing is delivered.
634
598
  */
635
599
  declare function countHqSpoolWork(input: Pick<HqSpoolFlushInput, "explicitDirectories" | "repository"> & {
636
- /** Also read each pending event's recorded reason (#1317). */reasons?: boolean;
600
+ /** Also read each pending event's recorded reason (#1317). */
601
+ reasons?: boolean;
637
602
  }, dependencies?: {
638
603
  budgetMs?: number;
639
604
  env?: NodeJS.ProcessEnv;
@@ -657,98 +622,32 @@ interface HqSpoolOrphanSweep {
657
622
  orphans: HqSpoolOrphan[];
658
623
  root: string;
659
624
  }
660
- /**
661
- * Reports spooled evidence sitting under an earlier key for *this* repository
662
- * (#420).
663
- *
664
- * The spool is keyed by owner and repo, so a change to the segment encoding
665
- * itself — which happened during #390's own development — moves the address
666
- * without moving the evidence. Both readers of the spool resolve exactly one
667
- * key, so the events under the old one become invisible: the drain reports
668
- * success, doctor reports empty, and three real proofs sat unread until an
669
- * attended recovery enumerated the tree by hand.
670
- *
671
- * This sweep only reports. Draining another key's events is a decision this
672
- * does not make — the operator gets the location and the count, and
673
- * `hq:flush --dir` remains the recovery path.
674
- *
675
- * **Why candidate keys and not a walk of the root (#446).** The root is shared
676
- * by every factory repository on the machine, so enumerating it and calling
677
- * everything that is not the current key an orphan describes another
678
- * repository's ordinary, current, correct spool exactly as well as it describes
679
- * this repository's obsolete one. That made doctor red in one checkout because
680
- * a different repository had pending work, and told the operator to drain it —
681
- * confidently prescribing the wrong action. Nothing on disk distinguishes the
682
- * two cases: an unrecognised key carries no statement about who wrote it.
683
- *
684
- * So discovery is scoped to the keys *this* repository could plausibly have
685
- * produced — the current scheme plus the earlier ones listed in
686
- * `hqSpoolCandidateKeys` — and a key outside that set is never this
687
- * repository's business. The #420 incident is inside it: the joined
688
- * single-segment key is one of the candidates.
689
- *
690
- * **And a marked walk beside them (#447).** Derivation's other blind spot is a
691
- * key whose *encoding* this checkout no longer produces but whose owner and
692
- * repo are unchanged — the retired non-injective era being the live example.
693
- * That era cannot be derived safely, because a candidate built from it can
694
- * equal a different repository's current key, so #446 dropped it rather than
695
- * risk the cross-repository claim again.
696
- *
697
- * `SPOOL_REPOSITORY_MARKER` supplies the proof that derivation could not. Every
698
- * enqueue stamps its spool with the repository writing it, so the root can be
699
- * walked again: a directory whose marker names *this* repository is this
700
- * repository's, whatever key encoding it sits under, and a directory whose
701
- * marker names another repository is never reported here. That is the
702
- * discriminator #446 correctly said did not exist — it exists now because
703
- * something writes it down.
704
- *
705
- * The two discoveries are complements, not alternatives. The walk sees only
706
- * what was stamped; directories written before this shipped have no marker, and
707
- * candidate keys still find those. An unmarked directory is still never
708
- * reported, because it still carries no statement about who wrote it.
709
- *
710
- * **What this does NOT close, despite being the marker's obvious use: renames
711
- * and owner changes.** A marker records the identity that was current when the
712
- * directory was written, so after `patronage/old` becomes `patronage/new` the
713
- * stranded directory is stamped `patronage/old` — and matching is equality
714
- * against the checkout's *present* identity, which rejects it. Making that work
715
- * needs an identifier that survives a rename, which neither the profile nor the
716
- * marker carries today; accepting a non-matching marker instead would be
717
- * guessing, which is the #446 defect wearing a new hat. #447 stays open for it.
718
- *
719
- * Also outside the sweep, by construction: evidence under a *different state
720
- * root*, if `XDG_STATE_HOME` moves. No walk of this root can reach another one.
721
- */
722
625
  declare function sweepHqSpoolOrphans(input: {
723
626
  repository: HqSpoolRepository;
724
627
  }, dependencies?: {
725
628
  budgetMs?: number;
726
629
  env?: NodeJS.ProcessEnv;
727
630
  }): Promise<HqSpoolOrphanSweep>;
728
- //#endregion
729
- //#region src/packages/review-prompt-sections/schema.d.ts
730
- declare const reviewPromptSectionSchema: z.ZodObject<{
631
+ export declare const reviewPromptSectionSchema: z.ZodObject<{
731
632
  provenance: z.ZodEnum<{
732
633
  "coding-standards": "coding-standards";
733
- "prior-review-ledger": "prior-review-ledger";
734
634
  "issue-review-focus": "issue-review-focus";
635
+ "prior-review-ledger": "prior-review-ledger";
735
636
  }>;
736
637
  source: z.ZodString;
737
638
  text: z.ZodString;
738
639
  }, z.core.$strict>;
739
640
  type ReviewPromptSection = z.infer<typeof reviewPromptSectionSchema>;
740
641
  type ReviewPromptSectionProvenance = ReviewPromptSection["provenance"];
741
- declare const reviewPromptSectionsSchema: z.ZodArray<z.ZodObject<{
642
+ export declare const reviewPromptSectionsSchema: z.ZodArray<z.ZodObject<{
742
643
  provenance: z.ZodEnum<{
743
644
  "coding-standards": "coding-standards";
744
- "prior-review-ledger": "prior-review-ledger";
745
645
  "issue-review-focus": "issue-review-focus";
646
+ "prior-review-ledger": "prior-review-ledger";
746
647
  }>;
747
648
  source: z.ZodString;
748
649
  text: z.ZodString;
749
650
  }, z.core.$strict>>;
750
- //#endregion
751
- //#region src/policy-resolution.d.ts
752
651
  /** How a gate resolved the review policy it evaluated a candidate under. */
753
652
  declare const policyResolutionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
754
653
  basePolicyDigest: z.ZodString;
@@ -761,16 +660,14 @@ declare const policyResolutionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
761
660
  }, z.core.$strict>, z.ZodObject<{
762
661
  baseRefName: z.ZodString;
763
662
  cause: z.ZodOptional<z.ZodEnum<{
764
- "no-pull-request": "no-pull-request";
765
663
  "lookup-failed": "lookup-failed";
664
+ "no-pull-request": "no-pull-request";
766
665
  "policy-unreadable": "policy-unreadable";
767
666
  }>>;
768
667
  reason: z.ZodString;
769
668
  status: z.ZodLiteral<"unresolved">;
770
669
  }, z.core.$strict>], "status">;
771
670
  type PolicyResolution = z.infer<typeof policyResolutionSchema>;
772
- //#endregion
773
- //#region src/review-ladder-policy.d.ts
774
671
  type ReviewFindingSeverity = "critical" | "high" | "medium" | "low" | "unknown";
775
672
  type ReviewFindingCategory = "correctness" | "safety" | "coordination" | "maintainability" | "unknown";
776
673
  declare const REVIEW_SEVERITIES: readonly ["critical", "high", "medium", "low", "unknown"];
@@ -794,8 +691,6 @@ interface ReviewLadderPolicy {
794
691
  cap: number;
795
692
  };
796
693
  }
797
- //#endregion
798
- //#region src/review-ladder-ledger.d.ts
799
694
  type LadderCycleStage = "interior" | "gate";
800
695
  interface LadderCycleRef {
801
696
  cycle: number;
@@ -860,8 +755,6 @@ interface FindingLedgerEntry extends ReviewFindingAttributes {
860
755
  reopenedCount: number;
861
756
  staleRepeatCount: number;
862
757
  }
863
- //#endregion
864
- //#region src/review-recording-schema.d.ts
865
758
  interface ReviewRecordedCycleIdentity {
866
759
  /**
867
760
  * SHA-256 of the proof file bytes this recording was applied to, or
@@ -880,11 +773,10 @@ interface ReviewRecordedCycleIdentity {
880
773
  recordingId: string;
881
774
  }
882
775
  type ReviewCycleRecording = {
883
- declarations: ReviewDeclarationRecord[]; /** Index-aligned with the cycle's `findings`. */
776
+ declarations: ReviewDeclarationRecord[];
777
+ /** Index-aligned with the cycle's `findings`. */
884
778
  occurrences: ReviewOccurrenceRecord[];
885
779
  } & ReviewRecordedCycleIdentity;
886
- //#endregion
887
- //#region src/review-ladder.d.ts
888
780
  type ReviewLadderExecutedStage = "interior" | "gate";
889
781
  interface LadderSessionAttribution {
890
782
  orchestrationMode?: "autonomous" | "manual";
@@ -910,6 +802,10 @@ interface ReviewLadderCycle {
910
802
  session?: LadderSessionAttribution;
911
803
  stage: LadderCycleStage;
912
804
  usage?: LadderUsageReport;
805
+ verdicts?: {
806
+ outcome: "error" | "failed" | "passed";
807
+ rung?: EvidenceReviewRung;
808
+ }[];
913
809
  }
914
810
  type LadderNextActionKind = "run-interior-cycle" | "advance-to-gate" | "run-gate-cycle" | "accept-nonblocking-findings" | "escalate-to-triage" | "ready-for-human";
915
811
  type ReviewLadderStage = "interior" | "interior-complete" | "gate";
@@ -962,8 +858,6 @@ type ReviewLadderEvaluation = LadderPosition & {
962
858
  ledger: FindingLedgerEntry[];
963
859
  occurrences: LedgerOccurrence[];
964
860
  };
965
- //#endregion
966
- //#region src/pr-readiness/ladder-proof-state.d.ts
967
861
  interface PrReviewLadderState {
968
862
  cycles: ReviewLadderCycle[];
969
863
  }
@@ -996,8 +890,6 @@ type ReviewEpochMode = {
996
890
  } | {
997
891
  kind: "declared-window";
998
892
  };
999
- //#endregion
1000
- //#region src/pr-readiness/review-proof-types.d.ts
1001
893
  type PrReviewKind = "correctness" | "security";
1002
894
  type PrReviewMode = PrReviewKind | "all";
1003
895
  type PrReviewOutcome = "passed" | "failed" | "error";
@@ -1005,8 +897,6 @@ interface PrReviewStageResolution {
1005
897
  model: string;
1006
898
  sessionId: string;
1007
899
  }
1008
- //#endregion
1009
- //#region src/pr-readiness/review-proof-shape.d.ts
1010
900
  interface PrReviewFinding extends ReviewFindingAttributes {
1011
901
  body: string;
1012
902
  category?: ReviewFindingCategory;
@@ -1057,15 +947,11 @@ interface PrReviewProof {
1057
947
  };
1058
948
  reviews: PrReviewResult[];
1059
949
  }
1060
- //#endregion
1061
- //#region src/blocked-reasons.d.ts
1062
950
  declare const blockedReasonSchema: z.ZodObject<{
1063
951
  code: z.ZodString;
1064
952
  detail: z.ZodString;
1065
953
  }, z.core.$strip>;
1066
954
  type BlockedReason = z.infer<typeof blockedReasonSchema>;
1067
- //#endregion
1068
- //#region src/arm-auto-merge.d.ts
1069
955
  /**
1070
956
  * How GitHub merges the candidate. `pr:ready` chooses `merge` for a
1071
957
  * recognized faithful catch-up merge (ADR 0028), because a squash drops the
@@ -1093,15 +979,11 @@ interface ArmAutoMergeOutcome {
1093
979
  headSha: string;
1094
980
  outcome: "armed" | "merged" | "not-armed";
1095
981
  }
1096
- //#endregion
1097
- //#region src/checkout-repository.d.ts
1098
982
  interface CheckoutRepository {
1099
983
  name: string;
1100
984
  owner: string;
1101
985
  }
1102
- //#endregion
1103
- //#region src/profile.d.ts
1104
- declare const DEFAULT_FACTORY_REPOSITORY = "unknown/unknown";
986
+ export declare const DEFAULT_FACTORY_REPOSITORY = "unknown/unknown";
1105
987
  /** The one profile shape this build accepts (ADR 0021, #318, #351, #742). */
1106
988
  declare const PROFILE_SCHEMA_VERSION = 6;
1107
989
  declare const factoryProjectProfileSchema: z.ZodObject<{
@@ -1112,6 +994,7 @@ declare const factoryProjectProfileSchema: z.ZodObject<{
1112
994
  endpoint: z.ZodIntersection<z.ZodString, z.ZodString>;
1113
995
  }, z.core.$strict>>;
1114
996
  impact: z.ZodOptional<z.ZodObject<{
997
+ dependencyLocal: z.ZodOptional<z.ZodArray<z.ZodString>>;
1115
998
  inert: z.ZodOptional<z.ZodArray<z.ZodString>>;
1116
999
  targets: z.ZodArray<z.ZodObject<{
1117
1000
  importers: z.ZodArray<z.ZodString>;
@@ -1150,15 +1033,15 @@ declare const factoryProjectProfileSchema: z.ZodObject<{
1150
1033
  name: z.ZodString;
1151
1034
  requiredCheck: z.ZodOptional<z.ZodString>;
1152
1035
  scope: z.ZodDefault<z.ZodEnum<{
1153
- trivial: "trivial";
1154
1036
  "docs-only": "docs-only";
1155
1037
  full: "full";
1038
+ trivial: "trivial";
1156
1039
  }>>;
1157
1040
  }, z.core.$strip>>;
1158
1041
  }, z.core.$strip>;
1159
1042
  }, z.core.$strict>;
1160
1043
  type FactoryProjectProfile = z.infer<typeof factoryProjectProfileSchema>;
1161
- declare const resolveFactoryRepository: (profile?: Pick<FactoryProjectProfile, "repository"> | undefined) => string;
1044
+ export declare const resolveFactoryRepository: (profile?: Pick<FactoryProjectProfile, "repository"> | undefined) => string;
1162
1045
  interface LoadProjectProfileInput {
1163
1046
  cwd?: string;
1164
1047
  profilePath?: string;
@@ -1167,9 +1050,7 @@ interface LoadProjectProfileResult {
1167
1050
  path: string;
1168
1051
  profile: FactoryProjectProfile;
1169
1052
  }
1170
- declare function loadProjectProfile(input?: LoadProjectProfileInput): LoadProjectProfileResult;
1171
- //#endregion
1172
- //#region src/catch-up-recognition-record.d.ts
1053
+ export declare function loadProjectProfile(input?: LoadProjectProfileInput): LoadProjectProfileResult;
1173
1054
  interface CatchUpRecognition {
1174
1055
  /** The ref the candidate targets, as the recognizing command resolved it. */
1175
1056
  baseRef: string;
@@ -1185,12 +1066,8 @@ interface CatchUpRecognition {
1185
1066
  /** The ref that proves the second parent is admitted content. */
1186
1067
  upstreamRef: string;
1187
1068
  }
1188
- //#endregion
1189
- //#region src/diff-classification.d.ts
1190
1069
  declare const DIFF_CLASSIFICATIONS: readonly ["docs/process-only", "trivial", "non-trivial"];
1191
1070
  type DiffClassification = (typeof DIFF_CLASSIFICATIONS)[number];
1192
- //#endregion
1193
- //#region src/impact-stamp.d.ts
1194
1071
  /**
1195
1072
  * The recorded stamp. `targets` satisfies the completeness invariant: every
1196
1073
  * target the profile declares is present, each with its exact basis — never
@@ -1199,8 +1076,8 @@ type DiffClassification = (typeof DIFF_CLASSIFICATIONS)[number];
1199
1076
  */
1200
1077
  declare const impactStampSchema: z.ZodObject<{
1201
1078
  basis: z.ZodEnum<{
1202
- "target-scoped": "target-scoped";
1203
1079
  conservative: "conservative";
1080
+ "target-scoped": "target-scoped";
1204
1081
  }>;
1205
1082
  inertPaths: z.ZodDefault<z.ZodArray<z.ZodString>>;
1206
1083
  reasons: z.ZodArray<z.ZodString>;
@@ -1253,24 +1130,18 @@ interface ImpactScopeDecision {
1253
1130
  * `trustedImpactStamp` in `pr-readiness/verification-proof.ts`); pass
1254
1131
  * `undefined` otherwise.
1255
1132
  */
1256
- declare const impactStampScopeDecision: ({
1257
- stamp,
1258
- surface,
1259
- targetName
1260
- }: {
1133
+ export declare const impactStampScopeDecision: ({ stamp, surface, targetName }: {
1261
1134
  stamp: ImpactStamp | undefined;
1262
1135
  surface: ImpactScopeSurface;
1263
1136
  targetName: string;
1264
1137
  }) => ImpactScopeDecision;
1265
- //#endregion
1266
- //#region src/required-check-policy.d.ts
1267
1138
  declare const EVIDENCE_CHECK_TYPES: readonly ["review", "verify"];
1268
1139
  type EvidenceCheckType = (typeof EVIDENCE_CHECK_TYPES)[number];
1269
1140
  declare const requiredCheckScopeSchema: z.ZodObject<{
1270
1141
  classifications: z.ZodArray<z.ZodEnum<{
1271
1142
  "docs/process-only": "docs/process-only";
1272
- trivial: "trivial";
1273
1143
  "non-trivial": "non-trivial";
1144
+ trivial: "trivial";
1274
1145
  }>>;
1275
1146
  }, z.core.$strict>;
1276
1147
  type RequiredCheckScope = z.infer<typeof requiredCheckScopeSchema>;
@@ -1283,10 +1154,7 @@ interface ScopeDecision {
1283
1154
  inScope: boolean;
1284
1155
  reason: string;
1285
1156
  }
1286
- declare const requiredCheckInScope: ({
1287
- context,
1288
- scope
1289
- }: {
1157
+ declare const requiredCheckInScope: ({ context, scope }: {
1290
1158
  context: RequiredCheckScopeContext;
1291
1159
  scope?: RequiredCheckScope;
1292
1160
  }) => ScopeDecision;
@@ -1295,8 +1163,6 @@ interface RequiredCheck {
1295
1163
  checkType: EvidenceCheckType;
1296
1164
  scope?: RequiredCheckScope;
1297
1165
  }
1298
- //#endregion
1299
- //#region src/demand-resolution.d.ts
1300
1166
  /**
1301
1167
  * The two GitHub reads that make the base policy authoritative: the live tip of
1302
1168
  * a branch, and one file's content at an exact commit. Injectable so tests can
@@ -1339,14 +1205,12 @@ type CandidatePullRequestLookup = {
1339
1205
  reason: string;
1340
1206
  status: "unavailable";
1341
1207
  };
1342
- //#endregion
1343
- //#region src/follow-up.d.ts
1344
1208
  interface FactoryCliInvocation {
1345
1209
  /** Runtime arguments ending with the factory CLI entry module. */
1346
1210
  argvPrefix: string[];
1347
1211
  executable: string;
1348
1212
  }
1349
- declare const FactoryCliInvocationSchema: z.ZodType<FactoryCliInvocation>;
1213
+ export declare const FactoryCliInvocationSchema: z.ZodType<FactoryCliInvocation>;
1350
1214
  interface FollowUpAction {
1351
1215
  /**
1352
1216
  * Machine-safe argv-style array for the obvious next action, e.g.
@@ -1366,11 +1230,18 @@ interface FollowUpAction {
1366
1230
  * Build a {@link FollowUpAction} from a literal argv array. The `command`
1367
1231
  * string is derived from argv so the two never drift.
1368
1232
  */
1369
- declare const followUpFromArgv: (argv: string[]) => FollowUpAction;
1233
+ export declare const followUpFromArgv: (argv: string[]) => FollowUpAction;
1370
1234
  /** Canonical zod schema for the optional follow-up field on JSON outputs. */
1371
- declare const FollowUpActionSchema: z.ZodType<FollowUpAction>;
1372
- //#endregion
1373
- //#region src/pr-verify-mode.d.ts
1235
+ export declare const FollowUpActionSchema: z.ZodType<FollowUpAction>;
1236
+ /** Cloudflare Access service-token credentials for production HQ ingest. */
1237
+ interface CloudflareAccessServiceToken {
1238
+ clientId: string;
1239
+ clientSecret: string;
1240
+ }
1241
+ interface CheckRunRelay {
1242
+ credentials: CloudflareAccessServiceToken;
1243
+ url: URL;
1244
+ }
1374
1245
  /**
1375
1246
  * The verification mode `pr:verify` resolved for a run.
1376
1247
  *
@@ -1379,8 +1250,6 @@ declare const FollowUpActionSchema: z.ZodType<FollowUpAction>;
1379
1250
  * check-run payload — can name the same union without importing each other.
1380
1251
  */
1381
1252
  type ResolvedPrVerifyMode = "docs-only" | "trivial" | "full";
1382
- //#endregion
1383
- //#region src/pr-verify-proof-contract.d.ts
1384
1253
  /**
1385
1254
  * The pr:verify proof versions a reader accepts: the current one only (#920
1386
1255
  * item 1). #917 narrowed the pr:ready reader the same way. A pr:verify proof
@@ -1450,6 +1319,34 @@ interface PrVerifyExecutedCommand {
1450
1319
  name: string;
1451
1320
  scope: "docs-only" | "trivial" | "full";
1452
1321
  }
1322
+ /** Where a verification battery ran (#1570). */
1323
+ declare const PR_VERIFY_RUNNER_KINDS: readonly ["ci", "cloud", "local"];
1324
+ /**
1325
+ * The machine a pr:verify battery ran on (#1570), so per-step durations in
1326
+ * `executedCommands` can be compared like for like: a Mac against a Mac, a
1327
+ * cloud agent VM against a cloud agent VM. It names the class of machine, not
1328
+ * the machine: no hostname, user, or path is recorded, because this proof is
1329
+ * sent to HQ.
1330
+ */
1331
+ interface PrVerifyRunner {
1332
+ /** Node's `process.arch`, such as `arm64` or `x64`. */
1333
+ arch: string;
1334
+ /** Logical CPUs the run could see. */
1335
+ cpuCount: number;
1336
+ /**
1337
+ * `ci` is a hosted CI runner, `cloud` an agent's cloud VM, and `local` a
1338
+ * developer machine: everything that is neither.
1339
+ */
1340
+ kind: (typeof PR_VERIFY_RUNNER_KINDS)[number];
1341
+ /** Node's `process.platform`, such as `darwin` or `linux`. */
1342
+ os: string;
1343
+ /**
1344
+ * The host that provided a `ci` or `cloud` runner when its environment
1345
+ * names it: `claude-code`, `cursor`, or `github-actions`. Absent for
1346
+ * `local` and for an unnamed CI.
1347
+ */
1348
+ provider?: "claude-code" | "cursor" | "github-actions";
1349
+ }
1453
1350
  /**
1454
1351
  * Epic #550 wave 3 (#430): a verification command the impact stamp proved this
1455
1352
  * candidate cannot reach, so the battery did not run it.
@@ -1521,13 +1418,17 @@ interface PrVerifyProof {
1521
1418
  profilePath: string;
1522
1419
  projectKey: string;
1523
1420
  repository: string;
1421
+ /**
1422
+ * The machine the battery ran on (#1570). Optional and additive: a proof
1423
+ * written before it existed parses unchanged, and the schema version does
1424
+ * not move.
1425
+ */
1426
+ runner?: PrVerifyRunner;
1524
1427
  startedAt: string;
1525
1428
  verificationCommands: PrVerifyCommandResult[];
1526
1429
  }
1527
1430
  type PrVerifyBaselineFullProof = NonNullable<PrVerifyProof["baselineFullProofs"]>[number];
1528
- declare function validatePrVerifyProof(value: unknown): PrVerifyProof;
1529
- //#endregion
1530
- //#region src/pr-verify-check-payload.d.ts
1431
+ export declare function validatePrVerifyProof(value: unknown): PrVerifyProof;
1531
1432
  /**
1532
1433
  * Machine-readable binding carried on the `patronage-factory/pr-verify` check
1533
1434
  * run (#247), alongside the human-readable prose summary.
@@ -1585,8 +1486,6 @@ interface PrVerifyCheckPayload {
1585
1486
  /** Original validated proof. Absence requires normal verification on a fresh runner. */
1586
1487
  verificationProof?: PrVerifyProof;
1587
1488
  }
1588
- //#endregion
1589
- //#region src/pr-verify-status.d.ts
1590
1489
  type CommitStatusState = "failure" | "pending" | "success";
1591
1490
  interface PostCommitStatusInput {
1592
1491
  context?: string;
@@ -1611,8 +1510,6 @@ interface PostCommitStatusInput {
1611
1510
  targetUrl: string;
1612
1511
  }
1613
1512
  type PostCommitStatus = (input: PostCommitStatusInput) => void;
1614
- //#endregion
1615
- //#region src/github-check-runs.d.ts
1616
1513
  declare const FACTORY_CHECK_NAMES: {
1617
1514
  readonly "pr-ready": "patronage-factory/pr-ready";
1618
1515
  readonly "pr-review": "patronage-factory/pr-review";
@@ -1639,6 +1536,12 @@ interface PublishFactoryCheckInput {
1639
1536
  }
1640
1537
  interface CheckRunDependencies extends FactoryAppAccessDependencies {
1641
1538
  postCommitStatus?: PostCommitStatus;
1539
+ /**
1540
+ * Post through HQ's check-run relay instead of with an App token (#1567).
1541
+ * The read-back then sends no credential of its own: the only machine that
1542
+ * relays is one whose egress proxy authenticates its GitHub reads.
1543
+ */
1544
+ relay?: CheckRunRelay;
1642
1545
  resolveDetailsUrl?: (input: PublishFactoryCheckInput, signal?: AbortSignal) => Promise<string> | string;
1643
1546
  /**
1644
1547
  * Bounded retry for the check-run POST. GitHub answers 422 for a head SHA it
@@ -1714,15 +1617,9 @@ interface PrVerifyProofBinding {
1714
1617
  * can never satisfy a consumer that wants proof. Absent, foreign, or
1715
1618
  * unparseable ⇒ `undefined` (fail closed).
1716
1619
  */
1717
- declare function fetchPrVerifyProofBinding({
1718
- expectedAppId,
1719
- githubApp,
1720
- owner,
1721
- repo,
1722
- sha,
1723
- runJson
1724
- }: {
1725
- /** Overrides the configured App id — CI has no user config (#247 part 3). */expectedAppId?: string;
1620
+ declare function fetchPrVerifyProofBinding({ expectedAppId, githubApp, owner, repo, sha, runJson }: {
1621
+ /** Overrides the configured App id — CI has no user config (#247 part 3). */
1622
+ expectedAppId?: string;
1726
1623
  githubApp?: GithubAppConfig;
1727
1624
  owner: string;
1728
1625
  repo: string;
@@ -1738,32 +1635,36 @@ interface ExactHeadRunSource {
1738
1635
  appId?: () => string;
1739
1636
  runJson?: GhJsonRunner;
1740
1637
  }
1741
- //#endregion
1742
- //#region src/merge-freeze.d.ts
1743
- declare const MERGE_FREEZE_CHECK_NAME = "patronage-factory/merge-freeze";
1638
+ interface HoldPullRequestInput {
1639
+ cwd: string;
1640
+ owner: string;
1641
+ pr: number;
1642
+ repo: string;
1643
+ }
1644
+ export declare const MERGE_FREEZE_CHECK_NAME = "patronage-factory/merge-freeze";
1744
1645
  /**
1745
1646
  * The Factory App's slug, as GitHub serves it on the runs the writer posts.
1746
1647
  * It is not a trust predicate: an App chooses its own slug, so the reader
1747
1648
  * trusts the pinned numeric App id instead (ADR 0022, #1393).
1748
1649
  */
1749
- declare const MERGE_FREEZE_APP_SLUG = "patronage-factory";
1650
+ export declare const MERGE_FREEZE_APP_SLUG = "patronage-factory";
1750
1651
  declare const mergeFreezeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1751
1652
  active: z.ZodLiteral<true>;
1752
1653
  generationId: z.ZodNumber;
1753
1654
  headSha: z.ZodString;
1754
1655
  outcome: z.ZodEnum<{
1755
- stale: "stale";
1756
1656
  active: "active";
1657
+ stale: "stale";
1757
1658
  }>;
1758
1659
  reason: z.ZodString;
1759
1660
  recordedAt: z.ZodISODateTime;
1760
1661
  schemaVersion: z.ZodLiteral<1>;
1761
1662
  verification: z.ZodOptional<z.ZodObject<{
1762
1663
  jobs: z.ZodRecord<z.ZodString, z.ZodEnum<{
1763
- success: "success";
1764
- failure: "failure";
1765
1664
  cancelled: "cancelled";
1665
+ failure: "failure";
1766
1666
  skipped: "skipped";
1667
+ success: "success";
1767
1668
  }>>;
1768
1669
  runAttempt: z.ZodNumber;
1769
1670
  runId: z.ZodNumber;
@@ -1779,10 +1680,10 @@ declare const mergeFreezeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1779
1680
  schemaVersion: z.ZodLiteral<1>;
1780
1681
  verification: z.ZodOptional<z.ZodObject<{
1781
1682
  jobs: z.ZodRecord<z.ZodString, z.ZodEnum<{
1782
- success: "success";
1783
- failure: "failure";
1784
1683
  cancelled: "cancelled";
1684
+ failure: "failure";
1785
1685
  skipped: "skipped";
1686
+ success: "success";
1786
1687
  }>>;
1787
1688
  runAttempt: z.ZodNumber;
1788
1689
  runId: z.ZodNumber;
@@ -1796,7 +1697,7 @@ type MergeFreezeState = z.infer<typeof mergeFreezeStateSchema>;
1796
1697
  * payload must parse under this exact reader schema, which is what the
1797
1698
  * workflow's own tests assert through this export.
1798
1699
  */
1799
- declare function validateMergeFreezeState(value: unknown): MergeFreezeState;
1700
+ export declare function validateMergeFreezeState(value: unknown): MergeFreezeState;
1800
1701
  interface MergeFreezeStoreInput {
1801
1702
  cwd: string;
1802
1703
  headSha: string;
@@ -1893,17 +1794,13 @@ interface GitHubCheckRunMergeFreezeApi {
1893
1794
  workflowId: number;
1894
1795
  }) => unknown;
1895
1796
  }
1896
- declare function createGitHubCheckRunMergeFreezeStore(api: GitHubCheckRunMergeFreezeApi): MergeFreezeAuthority;
1897
- //#endregion
1898
- //#region src/pr-proof-io.d.ts
1797
+ export declare function createGitHubCheckRunMergeFreezeStore(api: GitHubCheckRunMergeFreezeApi): MergeFreezeAuthority;
1899
1798
  interface ProofDescriptor<T> {
1900
1799
  label: string;
1901
1800
  defaultPath: string;
1902
1801
  schemaVersion: number;
1903
1802
  parse: (raw: unknown) => T;
1904
1803
  }
1905
- //#endregion
1906
- //#region src/pr-readiness/readiness-ledger.d.ts
1907
1804
  /**
1908
1805
  * Ledger schema version 2 (#894): `verification` is a tagged union on
1909
1806
  * `prVerify` and `externalChecks` no longer echoes `inScope`. Version 1
@@ -1915,8 +1812,8 @@ declare const READINESS_REPAIR_CODES: readonly ["undraft-pr", "await-post-undraf
1915
1812
  declare const readinessRepairSchema: z.ZodObject<{
1916
1813
  action: z.ZodString;
1917
1814
  code: z.ZodEnum<{
1918
- "undraft-pr": "undraft-pr";
1919
1815
  "await-post-undraft-checks": "await-post-undraft-checks";
1816
+ "undraft-pr": "undraft-pr";
1920
1817
  }>;
1921
1818
  command: z.ZodString;
1922
1819
  }, z.core.$strip>;
@@ -1925,8 +1822,8 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1925
1822
  blockingReasons: z.ZodArray<z.ZodString>;
1926
1823
  classification: z.ZodEnum<{
1927
1824
  "docs/process-only": "docs/process-only";
1928
- trivial: "trivial";
1929
1825
  "non-trivial": "non-trivial";
1826
+ trivial: "trivial";
1930
1827
  }>;
1931
1828
  externalChecks: z.ZodOptional<z.ZodArray<z.ZodObject<{
1932
1829
  checkType: z.ZodEnum<{
@@ -1938,15 +1835,15 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1938
1835
  scope: z.ZodOptional<z.ZodObject<{
1939
1836
  classifications: z.ZodArray<z.ZodEnum<{
1940
1837
  "docs/process-only": "docs/process-only";
1941
- trivial: "trivial";
1942
1838
  "non-trivial": "non-trivial";
1839
+ trivial: "trivial";
1943
1840
  }>>;
1944
1841
  }, z.core.$strict>>;
1945
1842
  scopeReason: z.ZodString;
1946
1843
  status: z.ZodEnum<{
1844
+ "out-of-scope": "out-of-scope";
1947
1845
  satisfied: "satisfied";
1948
1846
  unmet: "unmet";
1949
- "out-of-scope": "out-of-scope";
1950
1847
  }>;
1951
1848
  }, z.core.$strip>>>;
1952
1849
  github: z.ZodObject<{
@@ -1954,11 +1851,11 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1954
1851
  mergeStateStatus: z.ZodString;
1955
1852
  mergeable: z.ZodString;
1956
1853
  requiredChecks: z.ZodEnum<{
1957
- unknown: "unknown";
1958
- passed: "passed";
1959
1854
  failed: "failed";
1960
- pending: "pending";
1961
1855
  none: "none";
1856
+ passed: "passed";
1857
+ pending: "pending";
1858
+ unknown: "unknown";
1962
1859
  }>;
1963
1860
  reviewDecision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1964
1861
  unresolvedReviewThreads: z.ZodNumber;
@@ -1970,8 +1867,8 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1970
1867
  repairs: z.ZodDefault<z.ZodArray<z.ZodObject<{
1971
1868
  action: z.ZodString;
1972
1869
  code: z.ZodEnum<{
1973
- "undraft-pr": "undraft-pr";
1974
1870
  "await-post-undraft-checks": "await-post-undraft-checks";
1871
+ "undraft-pr": "undraft-pr";
1975
1872
  }>;
1976
1873
  command: z.ZodString;
1977
1874
  }, z.core.$strip>>>;
@@ -1985,18 +1882,18 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1985
1882
  unknown: z.ZodNumber;
1986
1883
  }, z.core.$strip>;
1987
1884
  highestBlockingSeverity: z.ZodOptional<z.ZodEnum<{
1988
- unknown: "unknown";
1989
1885
  critical: "critical";
1990
1886
  high: "high";
1991
1887
  low: "low";
1992
1888
  medium: "medium";
1889
+ unknown: "unknown";
1993
1890
  }>>;
1994
1891
  highestOpenSeverity: z.ZodOptional<z.ZodEnum<{
1995
- unknown: "unknown";
1996
1892
  critical: "critical";
1997
1893
  high: "high";
1998
1894
  low: "low";
1999
1895
  medium: "medium";
1896
+ unknown: "unknown";
2000
1897
  }>>;
2001
1898
  maxReviewCycles: z.ZodOptional<z.ZodNumber>;
2002
1899
  nonBlockingFindings: z.ZodNumber;
@@ -2015,12 +1912,12 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
2015
1912
  "interior-cap-reached": "interior-cap-reached";
2016
1913
  }>>;
2017
1914
  nextAction: z.ZodEnum<{
2018
- "run-interior-cycle": "run-interior-cycle";
2019
- "advance-to-gate": "advance-to-gate";
2020
- "run-gate-cycle": "run-gate-cycle";
2021
1915
  "accept-nonblocking-findings": "accept-nonblocking-findings";
1916
+ "advance-to-gate": "advance-to-gate";
2022
1917
  "escalate-to-triage": "escalate-to-triage";
2023
1918
  "ready-for-human": "ready-for-human";
1919
+ "run-gate-cycle": "run-gate-cycle";
1920
+ "run-interior-cycle": "run-interior-cycle";
2024
1921
  }>;
2025
1922
  stage: z.ZodEnum<{
2026
1923
  gate: "gate";
@@ -2030,8 +1927,8 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
2030
1927
  }, z.core.$strip>>;
2031
1928
  reviewRuns: z.ZodOptional<z.ZodArray<z.ZodType<PrReviewResult, unknown, z.core.$ZodTypeInternals<PrReviewResult, unknown>>>>;
2032
1929
  reviewTerminalState: z.ZodOptional<z.ZodEnum<{
2033
- blocked: "blocked";
2034
1930
  "accepted-with-findings": "accepted-with-findings";
1931
+ blocked: "blocked";
2035
1932
  clean: "clean";
2036
1933
  }>>;
2037
1934
  reviews: z.ZodObject<{
@@ -2041,10 +1938,10 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
2041
1938
  reviewedPatchId: z.ZodOptional<z.ZodString>;
2042
1939
  status: z.ZodEnum<{
2043
1940
  blocked: "blocked";
2044
- "not-required": "not-required";
2045
1941
  current: "current";
2046
- stale: "stale";
2047
1942
  missing: "missing";
1943
+ "not-required": "not-required";
1944
+ stale: "stale";
2048
1945
  }>;
2049
1946
  }, z.core.$strip>;
2050
1947
  security: z.ZodOptional<z.ZodObject<{
@@ -2053,10 +1950,10 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
2053
1950
  reviewedPatchId: z.ZodOptional<z.ZodString>;
2054
1951
  status: z.ZodEnum<{
2055
1952
  blocked: "blocked";
2056
- "not-required": "not-required";
2057
1953
  current: "current";
2058
- stale: "stale";
2059
1954
  missing: "missing";
1955
+ "not-required": "not-required";
1956
+ stale: "stale";
2060
1957
  }>;
2061
1958
  }, z.core.$strip>>;
2062
1959
  }, z.core.$strip>;
@@ -2089,7 +1986,7 @@ type ReadinessStatus = "ready" | "blocked";
2089
1986
  type ManagedReadinessLedger = z.infer<typeof managedReadinessLedgerSchema>;
2090
1987
  declare function validateManagedReadinessLedger(value: unknown): ManagedReadinessLedger;
2091
1988
  declare namespace status_check_rollup_d_exports {
2092
- export { CheckState, HOSTED_VERIFY_CHECK_NAME, HOSTED_VERIFY_DRAFT_CHECK_NAME, StatusCheckRollup, hostedVerifyCheckState, isCancelledPrStatusHudCheck, isDraftHostedVerifyCheck, isExcludedFromAdmissionChecks, isFactoryReadyCheck, isHostedVerifyCheck, isSupersededHostedVerifyCheck, pendingCheckNames, statusCheckState };
1989
+ export { CheckState, HOSTED_VERIFY_CHECK_NAME, HOSTED_VERIFY_DRAFT_CHECK_NAME, StatusCheckRollup, admissionCheckExclusion, admissionCheckSetDescription, fetchRequiredStatusCheckContexts, hostedVerifyCheckState, isCancelledPrStatusHudCheck, isDraftHostedVerifyCheck, isExcludedFromAdmissionChecks, isFactoryReadyCheck, isHostedVerifyCheck, isRequiredStatusCheck, isSupersededHostedVerifyCheck, pendingCheckNames, requiredStatusCheckContexts, statusCheckState, unsettledNonRequiredCheckNames };
2093
1990
  }
2094
1991
  type CheckState = "passed" | "failed" | "pending" | "none" | "unknown";
2095
1992
  interface StatusCheckRollup {
@@ -2173,6 +2070,26 @@ declare const isCancelledPrStatusHudCheck: (check: StatusCheckRollup) => boolean
2173
2070
  * and a cancelled PR status HUD run.
2174
2071
  */
2175
2072
  declare const isExcludedFromAdmissionChecks: (check: StatusCheckRollup) => boolean;
2073
+ /**
2074
+ * Does the base branch require this rollup row? (#1580)
2075
+ *
2076
+ * The hosted `verify` gate always counts: it is pinned by the factory's own
2077
+ * ruleset, and readiness reads it by presence regardless. Otherwise a row is
2078
+ * required when its check-run name or status context is one the rulesets
2079
+ * list. Matching on the name alone is the conservative direction here: a
2080
+ * same-named run from another workflow is waited on, never skipped.
2081
+ */
2082
+ declare const isRequiredStatusCheck: (check: StatusCheckRollup, requiredContexts: readonly string[]) => boolean;
2083
+ /**
2084
+ * The exclusion an admission read applies to the rollup (#1580).
2085
+ *
2086
+ * With the required contexts known, every row the base branch does not
2087
+ * require is excluded too, so a docs build or a status-only job neither holds
2088
+ * publish open nor refuses readiness. GitHub auto-merge does not wait for
2089
+ * those rows either. Unknown (`undefined`) or none required (`[]`) keeps
2090
+ * every row, which is the behaviour before #1580.
2091
+ */
2092
+ declare const admissionCheckExclusion: (requiredContexts?: readonly string[]) => (check: StatusCheckRollup) => boolean;
2176
2093
  /**
2177
2094
  * The hosted `verify` gate's state on this head, read by presence (#477).
2178
2095
  *
@@ -2197,6 +2114,15 @@ declare const hostedVerifyCheckState: (rollup: StatusCheckRollup[] | undefined)
2197
2114
  * unprintable.
2198
2115
  */
2199
2116
  declare const pendingCheckNames: (rollup: StatusCheckRollup[] | undefined, exclude?: (check: StatusCheckRollup) => boolean) => string[];
2117
+ /**
2118
+ * The non-required rows that are red or still running (#1580), so readiness
2119
+ * can name them in a notice. They no longer gate; saying nothing would hide a
2120
+ * failing docs build behind a green admission.
2121
+ */
2122
+ declare const unsettledNonRequiredCheckNames: (rollup: StatusCheckRollup[] | undefined, requiredContexts: readonly string[]) => {
2123
+ failed: string[];
2124
+ pending: string[];
2125
+ };
2200
2126
  declare const statusCheckState: (rollup: StatusCheckRollup[] | undefined, exclude?: (check: StatusCheckRollup) => boolean) => CheckState;
2201
2127
  /**
2202
2128
  * Is this a hosted `verify` check run that GitHub started before `cutoffIso`?
@@ -2217,8 +2143,17 @@ declare const statusCheckState: (rollup: StatusCheckRollup[] | undefined, exclud
2217
2143
  * this exists to remove.
2218
2144
  */
2219
2145
  declare const isSupersededHostedVerifyCheck: (check: StatusCheckRollup, cutoffIso: string) => boolean;
2220
- //#endregion
2221
- //#region src/github-client.d.ts
2146
+ declare const requiredStatusCheckContexts: (rules: unknown, branch?: unknown) => string[] | undefined;
2147
+ /**
2148
+ * Best-effort read: a failed request is the same "not known" as an unreadable
2149
+ * answer, so it can only keep today's wider wait, never narrow it.
2150
+ */
2151
+ declare const fetchRequiredStatusCheckContexts: (fetchRules: () => unknown, fetchBranch?: () => unknown) => string[] | undefined;
2152
+ /**
2153
+ * One line naming the set an admission read judges (#1580), so a log shows
2154
+ * whether the narrowing took effect or the read fell back to every run.
2155
+ */
2156
+ declare const admissionCheckSetDescription: (requiredContexts?: readonly string[]) => string;
2222
2157
  /**
2223
2158
  * Read a branch tip from GitHub rather than a checkout's cached remote ref.
2224
2159
  * `gh` is injectable so a test can hand the real read a fake GitHub.
@@ -2226,8 +2161,6 @@ declare const isSupersededHostedVerifyCheck: (check: StatusCheckRollup, cutoffIs
2226
2161
  declare const fetchGitHubBranchTipSha: (repository: CheckoutRepository, branch: string, cwd: string, gh?: <T>(args: string[], cwd: string) => T) => string;
2227
2162
  /** An asynchronous `gh` JSON read. Injected so a test can hand the reads a fake GitHub. */
2228
2163
  type GhBoundedJsonReader = (args: string[], cwd: string) => Promise<unknown>;
2229
- //#endregion
2230
- //#region src/github-app-client.d.ts
2231
2164
  interface FactoryAppRequest {
2232
2165
  body?: unknown;
2233
2166
  headers?: Readonly<Record<string, string>>;
@@ -2241,8 +2174,6 @@ interface FactoryAppExchange<T = unknown> {
2241
2174
  readonly json: T;
2242
2175
  readonly status: number;
2243
2176
  }
2244
- //#endregion
2245
- //#region src/github-pr-status-comment.d.ts
2246
2177
  interface UpsertFactoryPrStatusCommentInput {
2247
2178
  body: string;
2248
2179
  /** ISO instant at which this presentation was observed. */
@@ -2275,10 +2206,7 @@ type VerificationHeadShas = {
2275
2206
  declare function readPrVerifyProof(filePath: string): PrVerifyProof;
2276
2207
  declare const verifyProofPassed: (proof: PrVerifyProof) => boolean;
2277
2208
  declare const prVerifyProofHeadShas: (proof: PrVerifyProof | undefined, creditedHeadSha?: string) => VerifiedHeadShas;
2278
- declare const verifyProofIdentityMatches: ({
2279
- currentIdentity,
2280
- proof
2281
- }: {
2209
+ declare const verifyProofIdentityMatches: ({ currentIdentity, proof }: {
2282
2210
  currentIdentity?: {
2283
2211
  patchId: string;
2284
2212
  mergeBaseSha?: string;
@@ -2297,10 +2225,7 @@ declare const verifyProofIdentityMatches: ({
2297
2225
  * head-only or patch-id-only match): a stamp narrows external demands, so it
2298
2226
  * is trusted only on an exact double binding, fail closed.
2299
2227
  */
2300
- declare const trustedImpactStamp: ({
2301
- candidate,
2302
- proof
2303
- }: {
2228
+ declare const trustedImpactStamp: ({ candidate, proof }: {
2304
2229
  candidate: {
2305
2230
  headSha: string;
2306
2231
  patchId: string;
@@ -2315,21 +2240,14 @@ declare const trustedImpactStamp: ({
2315
2240
  * review and preview demands, so it earns the same strict double binding and
2316
2241
  * the same fail-closed answer (`undefined`) on every other state.
2317
2242
  */
2318
- declare const trustedCatchUpRecognition: ({
2319
- candidate,
2320
- proof
2321
- }: {
2243
+ declare const trustedCatchUpRecognition: ({ candidate, proof }: {
2322
2244
  candidate: {
2323
2245
  headSha: string;
2324
2246
  patchId: string;
2325
2247
  };
2326
2248
  proof: PrVerifyProof | undefined;
2327
2249
  }) => CatchUpRecognition | undefined;
2328
- declare const prVerifyFullHeadShasForDiff: ({
2329
- docsOnlyDeltaAcceptedSince,
2330
- files,
2331
- proof
2332
- }: {
2250
+ declare const prVerifyFullHeadShasForDiff: ({ docsOnlyDeltaAcceptedSince, files, proof }: {
2333
2251
  docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
2334
2252
  files: string[];
2335
2253
  proof: PrVerifyProof;
@@ -2350,25 +2268,12 @@ type VerificationProofState = {
2350
2268
  kind: "typed-diff-mismatch";
2351
2269
  mode: ResolvedPrVerifyMode;
2352
2270
  };
2353
- declare const verificationProofStateFor: ({
2354
- proof,
2355
- proofMatchesCurrentDiff,
2356
- proofPath
2357
- }: {
2271
+ declare const verificationProofStateFor: ({ proof, proofMatchesCurrentDiff, proofPath }: {
2358
2272
  proof?: PrVerifyProof;
2359
2273
  proofMatchesCurrentDiff?: boolean;
2360
2274
  proofPath?: string;
2361
2275
  }) => VerificationProofState;
2362
- declare const verificationProofApplicabilityFor: ({
2363
- docsOnlyDeltaAcceptedSince,
2364
- explicitProof,
2365
- files,
2366
- headSha,
2367
- currentIdentity,
2368
- proof,
2369
- proofPath,
2370
- proofReadError
2371
- }: {
2276
+ declare const verificationProofApplicabilityFor: ({ docsOnlyDeltaAcceptedSince, explicitProof, files, headSha, currentIdentity, proof, proofPath, proofReadError }: {
2372
2277
  docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
2373
2278
  explicitProof: boolean;
2374
2279
  files: string[];
@@ -2391,15 +2296,7 @@ declare const verificationProofApplicabilityFor: ({
2391
2296
  proof: PrVerifyProof;
2392
2297
  };
2393
2298
  };
2394
- declare const resolveVerifyProofApplicability: ({
2395
- proofPath,
2396
- explicitProof,
2397
- docsOnlyDeltaAcceptedSince,
2398
- files,
2399
- headSha,
2400
- currentVerifyIdentityForBase,
2401
- preread
2402
- }: {
2299
+ declare const resolveVerifyProofApplicability: ({ proofPath, explicitProof, docsOnlyDeltaAcceptedSince, files, headSha, currentVerifyIdentityForBase, preread }: {
2403
2300
  proofPath: string;
2404
2301
  explicitProof: boolean;
2405
2302
  docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
@@ -2426,8 +2323,6 @@ declare const resolveVerifyProofApplicability: ({
2426
2323
  };
2427
2324
  declare const verificationProofForReadiness: (state: VerificationProofState) => VerificationHeadShas;
2428
2325
  declare const verificationProofBlockingReason: (state: VerificationProofState) => string | undefined;
2429
- //#endregion
2430
- //#region src/preview-lifecycle.d.ts
2431
2326
  type PreviewDisposition = "deploy" | "not-required";
2432
2327
  interface PreviewTargetPlan {
2433
2328
  basis: string;
@@ -2445,7 +2340,7 @@ interface PreviewLifecyclePlan {
2445
2340
  targets: PreviewTargetPlan[];
2446
2341
  }
2447
2342
  /** Validate a serialized plan without deriving or changing its dispositions. */
2448
- declare const validatePreviewLifecyclePlan: (value: unknown) => PreviewLifecyclePlan;
2343
+ export declare const validatePreviewLifecyclePlan: (value: unknown) => PreviewLifecyclePlan;
2449
2344
  /**
2450
2345
  * Structural subset of the profile: the impact declarations plus the external
2451
2346
  * demand list. Structural rather than a `Pick` so this module does not import
@@ -2471,7 +2366,7 @@ interface PreviewLifecycleProfile {
2471
2366
  * plan can withhold are precisely the demands wave 2 can release, so a stack
2472
2367
  * can never be skipped while its proof stays demanded.
2473
2368
  */
2474
- declare const previewLifecycleTargets: (profile: PreviewLifecycleProfile) => string[];
2369
+ export declare const previewLifecycleTargets: (profile: PreviewLifecycleProfile) => string[];
2475
2370
  /**
2476
2371
  * Plan the preview lifecycle for one candidate.
2477
2372
  *
@@ -2483,12 +2378,7 @@ declare const previewLifecycleTargets: (profile: PreviewLifecycleProfile) => str
2483
2378
  * throw. A malformed CALL is the deliberate exception: omitting
2484
2379
  * `vetoedTargets` is API misuse, not data doubt, and throws.
2485
2380
  */
2486
- declare const planPreviewLifecycle: ({
2487
- candidate,
2488
- profile,
2489
- proof,
2490
- vetoedTargets
2491
- }: {
2381
+ export declare const planPreviewLifecycle: ({ candidate, profile, proof, vetoedTargets }: {
2492
2382
  candidate: {
2493
2383
  headSha: string;
2494
2384
  patchId: string;
@@ -2514,8 +2404,6 @@ declare const planPreviewLifecycle: ({
2514
2404
  */
2515
2405
  vetoedTargets: readonly string[];
2516
2406
  }) => PreviewLifecyclePlan;
2517
- //#endregion
2518
- //#region src/pr-status-hud.d.ts
2519
2407
  type FactoryPrStatusCheckName = "patronage-factory/merge-freeze" | "patronage-factory/pr-ready" | "patronage-factory/pr-verify";
2520
2408
  interface CompletedFactoryCheckSnapshot {
2521
2409
  readonly completedAt: string;
@@ -2587,7 +2475,8 @@ interface PresentFactoryPrStatusHudDependencies {
2587
2475
  * head-moved error, not as a second identity endpoint.
2588
2476
  */
2589
2477
  readonly assertCurrentIdentity: (input: {
2590
- baseRefName?: string; /** Retained for rendering/callers; identity compares base ref name. */
2478
+ baseRefName?: string;
2479
+ /** Retained for rendering/callers; identity compares base ref name. */
2591
2480
  baseSha?: string;
2592
2481
  headSha: string;
2593
2482
  owner: string;
@@ -2638,13 +2527,14 @@ interface ReadFactoryPrStatusSourcesDependencies {
2638
2527
  }) => Promise<readonly PreviewProofRegistration[]>;
2639
2528
  readonly timeoutMs?: number;
2640
2529
  }
2641
- declare function renderFactoryPrStatusHud(input: RenderFactoryPrStatusHudInput): string;
2642
- declare function presentFactoryPrStatusHud(input: PresentFactoryPrStatusHudInput, dependencies: PresentFactoryPrStatusHudDependencies): Promise<UpsertFactoryPrStatusCommentResult>;
2643
- declare function assertFactoryPrStatusIdentity(input: ReadFactoryPrStatusSourcesInput & {
2644
- readonly baseRefName?: string; /** Retained for rendering/callers; identity compares base ref name. */
2530
+ export declare function renderFactoryPrStatusHud(input: RenderFactoryPrStatusHudInput): string;
2531
+ export declare function presentFactoryPrStatusHud(input: PresentFactoryPrStatusHudInput, dependencies: PresentFactoryPrStatusHudDependencies): Promise<UpsertFactoryPrStatusCommentResult>;
2532
+ export declare function assertFactoryPrStatusIdentity(input: ReadFactoryPrStatusSourcesInput & {
2533
+ readonly baseRefName?: string;
2534
+ /** Retained for rendering/callers; identity compares base ref name. */
2645
2535
  readonly baseSha?: string;
2646
2536
  }, dependencies?: ReadFactoryPrStatusSourcesDependencies): Promise<void>;
2647
- declare function readFactoryPrStatusSources(input: ReadFactoryPrStatusSourcesInput, dependencies?: ReadFactoryPrStatusSourcesDependencies): Promise<FactoryPrStatusSources>;
2537
+ export declare function readFactoryPrStatusSources(input: ReadFactoryPrStatusSourcesInput, dependencies?: ReadFactoryPrStatusSourcesDependencies): Promise<FactoryPrStatusSources>;
2648
2538
  interface PlanFactoryPrStatusHudInput {
2649
2539
  readonly cwd: string;
2650
2540
  readonly headSha: string;
@@ -2658,7 +2548,7 @@ interface PlanFactoryPrStatusHudInput {
2658
2548
  * Candidate identity is never copied from the proof. Absent independent
2659
2549
  * identity or an unbound verify proof is the planner's conservative path.
2660
2550
  */
2661
- declare function planFactoryPrStatusHud(input: PlanFactoryPrStatusHudInput): PreviewLifecyclePlan;
2551
+ export declare function planFactoryPrStatusHud(input: PlanFactoryPrStatusHudInput): PreviewLifecyclePlan;
2662
2552
  interface RefreshFactoryPrStatusHudInput {
2663
2553
  readonly cwd: string;
2664
2554
  readonly headSha: string;
@@ -2687,18 +2577,17 @@ interface RefreshFactoryPrStatusHudDependencies {
2687
2577
  readonly fetch?: typeof fetch;
2688
2578
  }
2689
2579
  /** Plan from the checkout and present the App-owned HUD. */
2690
- declare function refreshFactoryPrStatusHud(input: RefreshFactoryPrStatusHudInput, dependencies?: RefreshFactoryPrStatusHudDependencies): Promise<UpsertFactoryPrStatusCommentResult>;
2580
+ export declare function refreshFactoryPrStatusHud(input: RefreshFactoryPrStatusHudInput, dependencies?: RefreshFactoryPrStatusHudDependencies): Promise<UpsertFactoryPrStatusCommentResult>;
2691
2581
  /**
2692
2582
  * Presentation must not fail an admission gate. Used after pr:ready publishes
2693
2583
  * its check so the table is not stuck at first-write.
2694
2584
  */
2695
- declare function refreshFactoryPrStatusHudSafely(input: RefreshFactoryPrStatusHudInput, onNotice?: (message: string) => void): Promise<void>;
2696
- //#endregion
2697
- //#region src/pr-ready.d.ts
2585
+ export declare function refreshFactoryPrStatusHudSafely(input: RefreshFactoryPrStatusHudInput, onNotice?: (message: string) => void): Promise<void>;
2698
2586
  interface PrReadyArgs extends LoadProjectProfileInput {
2699
2587
  authoringSessionIds?: string[];
2700
2588
  base: string;
2701
2589
  epic?: number;
2590
+ hold?: boolean;
2702
2591
  json?: boolean;
2703
2592
  output?: string;
2704
2593
  report?: boolean;
@@ -2744,6 +2633,12 @@ interface GitHubPullRequest {
2744
2633
  mergeable: string;
2745
2634
  number: number;
2746
2635
  reviewDecision: string | null;
2636
+ /**
2637
+ * The status-check contexts the base branch's rulesets require (#1580).
2638
+ * Absent means not known, and every hosted run on the head is judged, as
2639
+ * before #1580.
2640
+ */
2641
+ requiredCheckContexts?: string[];
2747
2642
  state: "OPEN" | "CLOSED" | "MERGED";
2748
2643
  statusCheckRollup?: StatusCheckRollup[];
2749
2644
  title: string;
@@ -2903,6 +2798,8 @@ interface PrReadyDependencies {
2903
2798
  * real GraphQL reads.
2904
2799
  */
2905
2800
  armingPolicy?: ArmingPolicyReads;
2801
+ /** Applies `factory:hold` for `--hold` (#1513). Defaults to the REST call. */
2802
+ holdPullRequest?: (input: HoldPullRequestInput) => Promise<void> | void;
2906
2803
  /**
2907
2804
  * Reads the authoritative base review policy (#922): the profile committed at
2908
2805
  * the live tip of the PR's own base ref. Defaults to the real GitHub reads,
@@ -2989,15 +2886,10 @@ interface PrReadyGitDependencies {
2989
2886
  showFileAtRef: (cwd: string, ref: string, absolutePath: string) => string | undefined;
2990
2887
  stablePatchId: (cwd: string, base: string) => string;
2991
2888
  }
2992
- declare function validatePrReadyProof(value: unknown): PrReadyProof;
2993
- declare function readPrReadyProof(filePath: string): PrReadyProof;
2994
- declare function runPrReady(args: PrReadyArgs, dependencies?: PrReadyDependencies): Promise<PrReadyProof>;
2995
- //#endregion
2996
- //#region src/factory-session.d.ts
2997
- declare const resolveAuthoringSessionIds: ({
2998
- override,
2999
- recorded
3000
- }: {
2889
+ export declare function validatePrReadyProof(value: unknown): PrReadyProof;
2890
+ export declare function readPrReadyProof(filePath: string): PrReadyProof;
2891
+ export declare function runPrReady(args: PrReadyArgs, dependencies?: PrReadyDependencies): Promise<PrReadyProof>;
2892
+ declare const resolveAuthoringSessionIds: ({ override, recorded }: {
3001
2893
  override?: string[];
3002
2894
  recorded?: string;
3003
2895
  }) => string[];
@@ -3016,17 +2908,17 @@ declare const evidenceEnvelopeBaseSchema: z.ZodObject<{
3016
2908
  mergeBaseSha: z.ZodString;
3017
2909
  model: z.ZodOptional<z.ZodString>;
3018
2910
  outcome: z.ZodEnum<{
3019
- pass: "pass";
3020
2911
  fail: "fail";
2912
+ pass: "pass";
3021
2913
  }>;
3022
2914
  patchId: z.ZodString;
3023
2915
  policyVersion: z.ZodOptional<z.ZodString>;
3024
2916
  producer: z.ZodString;
3025
2917
  requestId: z.ZodOptional<z.ZodString>;
3026
2918
  rung: z.ZodOptional<z.ZodEnum<{
2919
+ human: "human";
3027
2920
  "independent-model": "independent-model";
3028
2921
  oracle: "oracle";
3029
- human: "human";
3030
2922
  }>>;
3031
2923
  schemaVersion: z.ZodLiteral<1>;
3032
2924
  sessionId: z.ZodOptional<z.ZodString>;
@@ -3043,17 +2935,17 @@ declare const evidenceEnvelopeSchema: z.ZodObject<{
3043
2935
  mergeBaseSha: z.ZodString;
3044
2936
  model: z.ZodOptional<z.ZodString>;
3045
2937
  outcome: z.ZodEnum<{
3046
- pass: "pass";
3047
2938
  fail: "fail";
2939
+ pass: "pass";
3048
2940
  }>;
3049
2941
  patchId: z.ZodString;
3050
2942
  policyVersion: z.ZodOptional<z.ZodString>;
3051
2943
  producer: z.ZodString;
3052
2944
  requestId: z.ZodOptional<z.ZodString>;
3053
2945
  rung: z.ZodOptional<z.ZodEnum<{
2946
+ human: "human";
3054
2947
  "independent-model": "independent-model";
3055
2948
  oracle: "oracle";
3056
- human: "human";
3057
2949
  }>>;
3058
2950
  schemaVersion: z.ZodLiteral<1>;
3059
2951
  sessionId: z.ZodOptional<z.ZodString>;
@@ -3073,10 +2965,7 @@ interface EvidenceCandidateIdentity {
3073
2965
  patchId: string;
3074
2966
  mergeBaseSha: string;
3075
2967
  }
3076
- declare const evidenceBindingFresh: ({
3077
- candidate,
3078
- envelope
3079
- }: {
2968
+ declare const evidenceBindingFresh: ({ candidate, envelope }: {
3080
2969
  candidate: EvidenceCandidateIdentity;
3081
2970
  envelope: EvidenceEnvelope;
3082
2971
  }) => boolean;
@@ -3084,10 +2973,7 @@ interface IndependenceResult {
3084
2973
  independent: boolean;
3085
2974
  reason?: "no-session" | "unknown-authoring-identity" | "same-session";
3086
2975
  }
3087
- declare const evidenceReviewIndependence: ({
3088
- authoringSessionIds,
3089
- envelope
3090
- }: {
2976
+ declare const evidenceReviewIndependence: ({ authoringSessionIds, envelope }: {
3091
2977
  authoringSessionIds: string[];
3092
2978
  envelope: EvidenceEnvelope;
3093
2979
  }) => IndependenceResult;
@@ -3112,11 +2998,7 @@ type LoadedEvidenceEnvelope = {
3112
2998
  * verify-only (`resolveProfileRequiredChecks`), so a scoping caller passes
3113
2999
  * `"verify"` and matches exactly the pair wave 2 evaluates.
3114
3000
  */
3115
- declare const boundFailingCheckNames: ({
3116
- candidate,
3117
- checkType,
3118
- envelopes
3119
- }: {
3001
+ declare const boundFailingCheckNames: ({ candidate, checkType, envelopes }: {
3120
3002
  candidate: EvidenceCandidateIdentity;
3121
3003
  checkType: EvidenceCheckType;
3122
3004
  envelopes: LoadedEvidenceEnvelope[];
@@ -3141,38 +3023,23 @@ interface RequiredCheckEvaluation {
3141
3023
  outcomes: RequiredCheckOutcome[];
3142
3024
  blockingReasons: string[];
3143
3025
  }
3144
- declare const evaluateRequiredChecks: ({
3145
- authoringSessionIds,
3146
- candidate,
3147
- envelopes,
3148
- requiredChecks,
3149
- scopeContext
3150
- }: RequiredCheckEvaluationInput) => RequiredCheckEvaluation;
3026
+ declare const evaluateRequiredChecks: ({ authoringSessionIds, candidate, envelopes, requiredChecks, scopeContext }: RequiredCheckEvaluationInput) => RequiredCheckEvaluation;
3151
3027
  declare const EVIDENCE_DIR = ".factory-memory/evidence";
3152
3028
  declare const loadEvidenceEnvelopes: (cwd: string) => LoadedEvidenceEnvelope[];
3153
- //#endregion
3154
- //#region src/review-proof-applicability.d.ts
3155
3029
  declare const REVIEW_STATUS_VALUES: readonly ["not-required", "current", "stale", "missing", "blocked"];
3156
3030
  declare const reviewStatusSchema: z.ZodEnum<{
3157
3031
  blocked: "blocked";
3158
- "not-required": "not-required";
3159
3032
  current: "current";
3160
- stale: "stale";
3161
3033
  missing: "missing";
3034
+ "not-required": "not-required";
3035
+ stale: "stale";
3162
3036
  }>;
3163
3037
  type ReviewStatus = z.infer<typeof reviewStatusSchema>;
3164
3038
  interface CurrentReviewIdentity {
3165
3039
  headSha: string;
3166
3040
  patchId: string;
3167
3041
  }
3168
- declare const reviewStatus: ({
3169
- blocked,
3170
- required,
3171
- reviewedHeadSha,
3172
- reviewedPatchId,
3173
- headSha,
3174
- patchId
3175
- }: CurrentReviewIdentity & {
3042
+ declare const reviewStatus: ({ blocked, required, reviewedHeadSha, reviewedPatchId, headSha, patchId }: CurrentReviewIdentity & {
3176
3043
  blocked?: boolean;
3177
3044
  required: boolean;
3178
3045
  reviewedHeadSha?: string;
@@ -3206,17 +3073,13 @@ declare const explicitFailureIdentity: (proof: ReviewProofClaim) => {
3206
3073
  reviewedHeadSha?: string;
3207
3074
  reviewedPatchId?: string;
3208
3075
  };
3209
- declare const selectReviewProof: ({
3210
- reviewProof
3211
- }: {
3076
+ declare const selectReviewProof: ({ reviewProof }: {
3212
3077
  reviewProof: ReviewProofClaim;
3213
3078
  }) => {
3214
3079
  reviewedHeadSha?: string;
3215
3080
  reviewedPatchId?: string;
3216
3081
  untypedVerdict?: boolean;
3217
3082
  };
3218
- //#endregion
3219
- //#region src/pr-readiness/review-epoch.d.ts
3220
3083
  interface ReviewCycleState {
3221
3084
  autoBlockingFindings: number;
3222
3085
  countsBySeverity: Record<ReviewFindingSeverity, number>;
@@ -3254,8 +3117,6 @@ declare const prReviewProofSchema: z.ZodType<PrReviewProof>;
3254
3117
  declare const validatePrReviewResult: (value: unknown) => PrReviewResult;
3255
3118
  declare const validatePrReviewProof: (value: unknown) => PrReviewProof;
3256
3119
  declare const PR_REVIEW_PROOF_DESCRIPTOR: ProofDescriptor<PrReviewProof>;
3257
- //#endregion
3258
- //#region src/schemas.d.ts
3259
3120
  declare const boundaryCheckProofSchema: z.ZodObject<{
3260
3121
  blockingReasons: z.ZodArray<z.ZodString>;
3261
3122
  boundary: z.ZodOptional<z.ZodString>;
@@ -3271,9 +3132,9 @@ declare const boundaryCheckProofSchema: z.ZodObject<{
3271
3132
  wave: z.ZodString;
3272
3133
  }, z.core.$strip>>;
3273
3134
  demandedRung: z.ZodOptional<z.ZodEnum<{
3135
+ human: "human";
3274
3136
  "independent-model": "independent-model";
3275
3137
  oracle: "oracle";
3276
- human: "human";
3277
3138
  }>>;
3278
3139
  epicIssue: z.ZodNumber;
3279
3140
  manifestHash: z.ZodOptional<z.ZodObject<{
@@ -3287,9 +3148,9 @@ declare const boundaryCheckProofSchema: z.ZodObject<{
3287
3148
  commentUrl: z.ZodOptional<z.ZodString>;
3288
3149
  producer: z.ZodString;
3289
3150
  rung: z.ZodEnum<{
3151
+ human: "human";
3290
3152
  "independent-model": "independent-model";
3291
3153
  oracle: "oracle";
3292
- human: "human";
3293
3154
  }>;
3294
3155
  sessionId: z.ZodOptional<z.ZodString>;
3295
3156
  specHash: z.ZodOptional<z.ZodObject<{
@@ -3304,13 +3165,11 @@ declare const boundaryCheckProofSchema: z.ZodObject<{
3304
3165
  value: z.ZodString;
3305
3166
  }, z.core.$strip>>;
3306
3167
  status: z.ZodEnum<{
3307
- ready: "ready";
3308
3168
  blocked: "blocked";
3169
+ ready: "ready";
3309
3170
  }>;
3310
3171
  }, z.core.$strip>;
3311
3172
  type BoundaryCheckProofRecord = z.infer<typeof boundaryCheckProofSchema>;
3312
- //#endregion
3313
- //#region src/boundary-check.d.ts
3314
3173
  interface BoundaryCheckGithub {
3315
3174
  fetchIssueBody: (repo: string, issue: number) => string;
3316
3175
  fetchIssueComments: (repo: string, issue: number) => GithubIssueComment[];
@@ -3359,22 +3218,16 @@ interface BoundaryCheckDependencies {
3359
3218
  readWaivers?: (cwd: string) => DemandWaiver[];
3360
3219
  resolveRepo?: (cwd: string) => string;
3361
3220
  }
3362
- declare function runBoundaryCheck(args: BoundaryCheckArgs, dependencies?: BoundaryCheckDependencies): BoundaryCheckProofRecord;
3363
- declare function validateBoundaryCheckProof(value: unknown): BoundaryCheckProofRecord;
3364
- //#endregion
3365
- //#region src/cli-output.d.ts
3221
+ export declare function runBoundaryCheck(args: BoundaryCheckArgs, dependencies?: BoundaryCheckDependencies): BoundaryCheckProofRecord;
3222
+ export declare function validateBoundaryCheckProof(value: unknown): BoundaryCheckProofRecord;
3366
3223
  interface CliOutput {
3367
3224
  stderr: Pick<NodeJS.WriteStream, "write">;
3368
3225
  stdout: Pick<NodeJS.WriteStream, "write">;
3369
3226
  }
3370
- //#endregion
3371
- //#region src/commands/boundary-check.d.ts
3372
3227
  type BoundaryCheckAction = (args: BoundaryCheckArgs) => BoundaryCheckProofRecord;
3373
- //#endregion
3374
- //#region src/demand-waive.d.ts
3375
3228
  /** Every waiver recorded in this checkout; an absent or unreadable store is
3376
3229
  * no waivers, so a damaged file can only ever block, never permit. */
3377
- declare const readDemandWaivers: (cwd: string, filePath?: string) => DemandWaiver[];
3230
+ export declare const readDemandWaivers: (cwd: string, filePath?: string) => DemandWaiver[];
3378
3231
  interface DemandWaiveArgs {
3379
3232
  cwd?: string;
3380
3233
  demand: string;
@@ -3395,7 +3248,7 @@ interface DemandWaiveDependencies {
3395
3248
  }) => string | undefined;
3396
3249
  now?: () => Date;
3397
3250
  }
3398
- declare class DemandWaiveRefusalError extends Error {
3251
+ export declare class DemandWaiveRefusalError extends Error {
3399
3252
  readonly refusals: string[];
3400
3253
  constructor(refusals: string[]);
3401
3254
  }
@@ -3405,12 +3258,8 @@ declare class DemandWaiveRefusalError extends Error {
3405
3258
  * puts the bar at operator identity, not at ceremony aimed at the operator
3406
3259
  * (ADR 0025).
3407
3260
  */
3408
- declare const runDemandWaive: (args: DemandWaiveArgs, dependencies?: DemandWaiveDependencies) => DemandWaiver;
3409
- //#endregion
3410
- //#region src/commands/demand-waive.d.ts
3261
+ export declare const runDemandWaive: (args: DemandWaiveArgs, dependencies?: DemandWaiveDependencies) => DemandWaiver;
3411
3262
  type DemandWaiveAction = (args: DemandWaiveArgs) => DemandWaiver;
3412
- //#endregion
3413
- //#region src/hq-flush.d.ts
3414
3263
  /**
3415
3264
  * Spool locations this run did not drain because they sit under an earlier
3416
3265
  * key for this repository. Reported, never drained: draining an older key's
@@ -3432,8 +3281,6 @@ type HqFlushResult = (HqFlushOrphans & {
3432
3281
  endpoint: string;
3433
3282
  status: "flushed";
3434
3283
  });
3435
- //#endregion
3436
- //#region src/candidate-base.d.ts
3437
3284
  interface LivePullRequestBase {
3438
3285
  baseRefName: string;
3439
3286
  /** Left unvalidated: the base-policy reader is its one consumer (#922). */
@@ -3455,8 +3302,6 @@ type LivePullRequestBaseLookup = {
3455
3302
  reason: string;
3456
3303
  status: "unavailable";
3457
3304
  };
3458
- //#endregion
3459
- //#region src/catch-up-recognition.d.ts
3460
3305
  type CatchUpRecognitionResult = {
3461
3306
  recognition: CatchUpRecognition;
3462
3307
  recognized: true;
@@ -3468,8 +3313,6 @@ type CatchUpRecognizer = (input: {
3468
3313
  base: string;
3469
3314
  cwd: string;
3470
3315
  }) => CatchUpRecognitionResult;
3471
- //#endregion
3472
- //#region src/pr-review.d.ts
3473
3316
  interface PrReviewArgs extends LoadProjectProfileInput {
3474
3317
  /**
3475
3318
  * Test-only (#1131): honour `FACTORY_REVIEW_FAULT` outside `NODE_ENV=test`
@@ -3581,17 +3424,13 @@ interface PrReviewDependencies {
3581
3424
  */
3582
3425
  publishCheckRun?: (input: PublishFactoryCheckInput) => void;
3583
3426
  }
3584
- declare function runPrReview(args: PrReviewArgs, dependencies?: PrReviewDependencies): Promise<PrReviewProof>;
3585
- //#endregion
3586
- //#region src/workspace-install-resolution.d.ts
3427
+ export declare function runPrReview(args: PrReviewArgs, dependencies?: PrReviewDependencies): Promise<PrReviewProof>;
3587
3428
  interface CleanInstallResolutionDependencies {
3588
3429
  existsSync?: typeof existsSync;
3589
3430
  readFileSync?: typeof readFileSync;
3590
3431
  rmSync?: typeof rmSync;
3591
3432
  runInstall?: (repoRoot: string) => void;
3592
3433
  }
3593
- //#endregion
3594
- //#region src/pr-verify.d.ts
3595
3434
  type PrVerifyMode = "auto" | "docs-only" | "full";
3596
3435
  interface VerificationCommandOutcome {
3597
3436
  counts?: {
@@ -3649,6 +3488,11 @@ interface PrVerifyDependencies {
3649
3488
  * request resolves `unavailable`, which is normal before publication.
3650
3489
  */
3651
3490
  lookupPullRequest?: (cwd: string) => CandidatePullRequestLookup;
3491
+ /**
3492
+ * Classifies the machine the battery runs on (#1570). Injectable so a test
3493
+ * pins it instead of recording the host it happens to run on.
3494
+ */
3495
+ describeRunner?: (env: NodeJS.ProcessEnv) => PrVerifyRunner;
3652
3496
  env?: NodeJS.ProcessEnv;
3653
3497
  git?: PrVerifyGitDependencies;
3654
3498
  hq?: HqIngestDependencies;
@@ -3666,17 +3510,14 @@ interface PrVerifyDependencies {
3666
3510
  postCommitStatus?: PostCommitStatus;
3667
3511
  publishCheckRun?: (input: PublishFactoryCheckInput) => void;
3668
3512
  }
3669
- declare function runPrVerify(args: PrVerifyArgs, dependencies?: PrVerifyDependencies): PrVerifyProof;
3670
- //#endregion
3671
- //#region src/pull-request-fill.d.ts
3513
+ export declare function runPrVerify(args: PrVerifyArgs, dependencies?: PrVerifyDependencies): PrVerifyProof;
3672
3514
  interface CommitMessage {
3673
3515
  body: string;
3674
3516
  subject: string;
3675
3517
  }
3676
- //#endregion
3677
- //#region src/pr-publish.d.ts
3678
3518
  type PrPublishArgs = Omit<PrReadyArgs, "pr" | "throwWhenBlocked"> & {
3679
- /** A clean-session findings file to validate into the review proof. */findings?: string;
3519
+ /** A clean-session findings file to validate into the review proof. */
3520
+ findings?: string;
3680
3521
  pr?: number;
3681
3522
  };
3682
3523
  type GhRunner = (args: string[], cwd: string) => string;
@@ -3706,13 +3547,13 @@ type PrPublishFollowUpOutcome = {
3706
3547
  action: FollowUpAction;
3707
3548
  error: string;
3708
3549
  status: "failed";
3709
- }
3550
+ } |
3710
3551
  /**
3711
3552
  * The planner declined to run the follow-up because it cannot change the
3712
3553
  * condition that produced it (#291). `reason` is the one-line causal
3713
3554
  * statement; a skip is a decision, never a silent omission.
3714
3555
  */
3715
- | {
3556
+ {
3716
3557
  action: FollowUpAction;
3717
3558
  reason: string;
3718
3559
  status: "skipped";
@@ -3750,7 +3591,7 @@ interface PrPublishResult {
3750
3591
  */
3751
3592
  verifyProofBinding?: VerifyProofBindingOutcome;
3752
3593
  }
3753
- declare class PrPublishFollowUpError extends Error {
3594
+ export declare class PrPublishFollowUpError extends Error {
3754
3595
  readonly result: PrPublishResult;
3755
3596
  constructor(result: PrPublishResult, cause: unknown);
3756
3597
  }
@@ -3895,29 +3736,16 @@ type PublishFollowUpPlan = {
3895
3736
  * verify-once entry point (#692 / ADR 0016). Equal SHAs mean the proof was
3896
3737
  * accepted for this exact head rather than relabelled onto it.
3897
3738
  */
3898
- declare const planPublishFollowUp: ({
3899
- binding,
3900
- followUp,
3901
- proofHeadSha,
3902
- verifiedHeadSha
3903
- }: {
3739
+ export declare const planPublishFollowUp: ({ binding, followUp, proofHeadSha, verifiedHeadSha }: {
3904
3740
  binding: VerifyProofBindingOutcome;
3905
3741
  followUp: FollowUpAction;
3906
3742
  proofHeadSha: string;
3907
3743
  verifiedHeadSha: string;
3908
3744
  }) => PublishFollowUpPlan;
3909
- declare function runPrPublish(args: PrPublishArgs, dependencies?: PrPublishDependencies): Promise<PrPublishResult>;
3910
- //#endregion
3911
- //#region src/commands/pr-publish.d.ts
3745
+ export declare function runPrPublish(args: PrPublishArgs, dependencies?: PrPublishDependencies): Promise<PrPublishResult>;
3912
3746
  type PrPublishAction = (args: PrPublishArgs) => Promise<unknown>;
3913
- //#endregion
3914
- //#region src/commands/pr-ready.d.ts
3915
3747
  type PrReadyAction = (args: PrReadyArgs) => Promise<unknown>;
3916
- //#endregion
3917
- //#region src/commands/pr-review.d.ts
3918
3748
  type PrReviewAction = (args: PrReviewArgs) => Promise<unknown>;
3919
- //#endregion
3920
- //#region src/pr-status-hud-command.d.ts
3921
3749
  interface PrStatusHudArgs {
3922
3750
  readonly cwd: string;
3923
3751
  readonly headSha: string;
@@ -3938,8 +3766,6 @@ type PrStatusHudAction = (args: PrStatusHudArgs) => Promise<{
3938
3766
  commentId: number;
3939
3767
  url: string;
3940
3768
  }>;
3941
- //#endregion
3942
- //#region src/packages/trace/implementation/core.d.ts
3943
3769
  declare const FactoryTraceEnvelopeCoreSchema: z.ZodObject<{
3944
3770
  createdAt: z.ZodString;
3945
3771
  envelope: z.ZodLiteral<1>;
@@ -3968,8 +3794,6 @@ declare const UnknownFactoryTraceEventSchema: z.ZodObject<{
3968
3794
  payload: z.ZodUnknown;
3969
3795
  unknownTraceEvent: z.ZodLiteral<true>;
3970
3796
  }, z.core.$strict>;
3971
- //#endregion
3972
- //#region src/packages/trace/implementation/definitions.d.ts
3973
3797
  type InferSchema<TSchema> = TSchema extends z.ZodType ? z.infer<TSchema> : never;
3974
3798
  type ReadEventSchemasOf<TDefinition> = TDefinition extends {
3975
3799
  readEventSchemas: readonly (infer TSchema)[];
@@ -3998,8 +3822,6 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3998
3822
  schemaVersion: z.ZodLiteral<1>;
3999
3823
  threadId: z.ZodOptional<z.ZodString>;
4000
3824
  workerId: z.ZodOptional<z.ZodString>;
4001
- eventType: z.ZodLiteral<"review-gate">;
4002
- typeVersion: z.ZodLiteral<1>;
4003
3825
  base: z.ZodString;
4004
3826
  changedFiles: z.ZodArray<z.ZodString>;
4005
3827
  headSha: z.ZodString;
@@ -4008,10 +3830,12 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
4008
3830
  outcome: z.ZodLiteral<"not-required">;
4009
3831
  patchId: z.ZodString;
4010
3832
  reason: z.ZodEnum<{
4011
- "no-applicable-mode": "no-applicable-mode";
4012
3833
  "faithful-merge": "faithful-merge";
3834
+ "no-applicable-mode": "no-applicable-mode";
4013
3835
  }>;
4014
3836
  reviewCycle: z.ZodNumber;
3837
+ eventType: z.ZodLiteral<"review-gate">;
3838
+ typeVersion: z.ZodLiteral<1>;
4015
3839
  }, z.core.$strict>, readonly [z.ZodObject<{
4016
3840
  createdAt: z.ZodString;
4017
3841
  eventId: z.ZodString;
@@ -4021,8 +3845,6 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
4021
3845
  schemaVersion: z.ZodLiteral<1>;
4022
3846
  threadId: z.ZodOptional<z.ZodString>;
4023
3847
  workerId: z.ZodOptional<z.ZodString>;
4024
- eventType: z.ZodLiteral<"review-gate">;
4025
- typeVersion: z.ZodLiteral<1>;
4026
3848
  base: z.ZodString;
4027
3849
  changedFiles: z.ZodArray<z.ZodString>;
4028
3850
  headSha: z.ZodString;
@@ -4031,10 +3853,12 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
4031
3853
  outcome: z.ZodLiteral<"not-required">;
4032
3854
  patchId: z.ZodString;
4033
3855
  reason: z.ZodEnum<{
4034
- "no-applicable-mode": "no-applicable-mode";
4035
3856
  "faithful-merge": "faithful-merge";
3857
+ "no-applicable-mode": "no-applicable-mode";
4036
3858
  }>;
4037
3859
  reviewCycle: z.ZodNumber;
3860
+ eventType: z.ZodLiteral<"review-gate">;
3861
+ typeVersion: z.ZodLiteral<1>;
4038
3862
  }, z.core.$strict>], {
4039
3863
  readonly 1: z.ZodObject<{
4040
3864
  base: z.ZodString;
@@ -4045,18 +3869,20 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
4045
3869
  outcome: z.ZodLiteral<"not-required">;
4046
3870
  patchId: z.ZodString;
4047
3871
  reason: z.ZodEnum<{
4048
- "no-applicable-mode": "no-applicable-mode";
4049
3872
  "faithful-merge": "faithful-merge";
3873
+ "no-applicable-mode": "no-applicable-mode";
4050
3874
  }>;
4051
3875
  reviewCycle: z.ZodNumber;
4052
3876
  }, z.core.$strict>;
4053
3877
  }, {
4054
3878
  createdAt: string;
4055
3879
  eventId: string;
3880
+ issue?: number | undefined;
3881
+ pr?: number | undefined;
4056
3882
  repo: string;
4057
3883
  schemaVersion: 1;
4058
- eventType: "review-gate";
4059
- typeVersion: 1;
3884
+ threadId?: string | undefined;
3885
+ workerId?: string | undefined;
4060
3886
  base: string;
4061
3887
  changedFiles: string[];
4062
3888
  headSha: string;
@@ -4064,12 +3890,10 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
4064
3890
  observedAt: string;
4065
3891
  outcome: "not-required";
4066
3892
  patchId: string;
4067
- reason: "no-applicable-mode" | "faithful-merge";
3893
+ reason: "faithful-merge" | "no-applicable-mode";
4068
3894
  reviewCycle: number;
4069
- issue?: number | undefined;
4070
- pr?: number | undefined;
4071
- threadId?: string | undefined;
4072
- workerId?: string | undefined;
3895
+ eventType: "review-gate";
3896
+ typeVersion: 1;
4073
3897
  }>, DefinedTraceEvent<"review-ladder-stage", z.ZodObject<{
4074
3898
  createdAt: z.ZodString;
4075
3899
  eventId: z.ZodString;
@@ -4079,8 +3903,6 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
4079
3903
  schemaVersion: z.ZodLiteral<1>;
4080
3904
  threadId: z.ZodOptional<z.ZodString>;
4081
3905
  workerId: z.ZodOptional<z.ZodString>;
4082
- eventType: z.ZodLiteral<"review-ladder-stage">;
4083
- typeVersion: z.ZodLiteral<1>;
4084
3906
  cycle: z.ZodNumber;
4085
3907
  cyclesToClean: z.ZodOptional<z.ZodNumber>;
4086
3908
  engine: z.ZodOptional<z.ZodString>;
@@ -4123,6 +3945,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
4123
3945
  source: z.ZodOptional<z.ZodString>;
4124
3946
  totalTokens: z.ZodOptional<z.ZodNumber>;
4125
3947
  }, z.core.$strict>>;
3948
+ eventType: z.ZodLiteral<"review-ladder-stage">;
3949
+ typeVersion: z.ZodLiteral<1>;
4126
3950
  }, z.core.$strict>, readonly [z.ZodObject<{
4127
3951
  createdAt: z.ZodString;
4128
3952
  eventId: z.ZodString;
@@ -4132,8 +3956,6 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
4132
3956
  schemaVersion: z.ZodLiteral<1>;
4133
3957
  threadId: z.ZodOptional<z.ZodString>;
4134
3958
  workerId: z.ZodOptional<z.ZodString>;
4135
- eventType: z.ZodLiteral<"review-ladder-stage">;
4136
- typeVersion: z.ZodLiteral<1>;
4137
3959
  cycle: z.ZodNumber;
4138
3960
  cyclesToClean: z.ZodOptional<z.ZodNumber>;
4139
3961
  engine: z.ZodOptional<z.ZodString>;
@@ -4176,6 +3998,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
4176
3998
  source: z.ZodOptional<z.ZodString>;
4177
3999
  totalTokens: z.ZodOptional<z.ZodNumber>;
4178
4000
  }, z.core.$strict>>;
4001
+ eventType: z.ZodLiteral<"review-ladder-stage">;
4002
+ typeVersion: z.ZodLiteral<1>;
4179
4003
  }, z.core.$strict>], {
4180
4004
  readonly 1: z.ZodObject<{
4181
4005
  cycle: z.ZodNumber;
@@ -4224,11 +4048,15 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
4224
4048
  }, {
4225
4049
  createdAt: string;
4226
4050
  eventId: string;
4051
+ issue?: number | undefined;
4052
+ pr?: number | undefined;
4227
4053
  repo: string;
4228
4054
  schemaVersion: 1;
4229
- eventType: "review-ladder-stage";
4230
- typeVersion: 1;
4055
+ threadId?: string | undefined;
4056
+ workerId?: string | undefined;
4231
4057
  cycle: number;
4058
+ cyclesToClean?: number | undefined;
4059
+ engine?: string | undefined;
4232
4060
  findingsSummary: {
4233
4061
  blocking: number;
4234
4062
  bySeverity: {
@@ -4242,17 +4070,10 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
4242
4070
  open: number;
4243
4071
  staleRepeats: number;
4244
4072
  };
4245
- observedAt: string;
4246
- stage: "gate" | "interior";
4247
- issue?: number | undefined;
4248
- pr?: number | undefined;
4249
- threadId?: string | undefined;
4250
- workerId?: string | undefined;
4251
- cyclesToClean?: number | undefined;
4252
- engine?: string | undefined;
4253
4073
  forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
4254
4074
  headSha?: string | undefined;
4255
4075
  model?: string | undefined;
4076
+ observedAt: string;
4256
4077
  patchId?: string | undefined;
4257
4078
  session?: {
4258
4079
  orchestrationMode?: "autonomous" | "manual" | undefined;
@@ -4260,18 +4081,413 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
4260
4081
  runtime?: string | undefined;
4261
4082
  sessionId?: string | undefined;
4262
4083
  } | undefined;
4084
+ stage: "gate" | "interior";
4263
4085
  usage?: {
4264
4086
  estimatedCostUsd?: number | undefined;
4265
4087
  source?: string | undefined;
4266
4088
  totalTokens?: number | undefined;
4267
4089
  } | undefined;
4090
+ eventType: "review-ladder-stage";
4091
+ typeVersion: 1;
4268
4092
  }>];
4269
4093
  type FactoryTraceEvent = FactoryTraceEventFromDefinitions<typeof FACTORY_TRACE_EVENT_DEFINITIONS>;
4270
- //#endregion
4271
- //#region src/packages/trace/implementation/trace-shard.d.ts
4094
+ declare const { appendFactoryTraceEventSchema: AppendFactoryTraceEventSchema, factoryTraceEventSchema: FactoryTraceEventSchema, payloadSchemaRegistry, payloadVersions: FACTORY_TRACE_PAYLOAD_VERSIONS, wirePayloadFor }: {
4095
+ appendFactoryTraceEventSchema: z.ZodType<{
4096
+ createdAt: string;
4097
+ eventId: string;
4098
+ issue?: number | undefined;
4099
+ pr?: number | undefined;
4100
+ repo: string;
4101
+ schemaVersion: 1;
4102
+ threadId?: string | undefined;
4103
+ workerId?: string | undefined;
4104
+ base: string;
4105
+ changedFiles: string[];
4106
+ headSha: string;
4107
+ maxReviewCycles: number;
4108
+ observedAt: string;
4109
+ outcome: "not-required";
4110
+ patchId: string;
4111
+ reason: "faithful-merge" | "no-applicable-mode";
4112
+ reviewCycle: number;
4113
+ eventType: "review-gate";
4114
+ typeVersion: 1;
4115
+ } | {
4116
+ createdAt: string;
4117
+ eventId: string;
4118
+ issue?: number | undefined;
4119
+ pr?: number | undefined;
4120
+ repo: string;
4121
+ schemaVersion: 1;
4122
+ threadId?: string | undefined;
4123
+ workerId?: string | undefined;
4124
+ cycle: number;
4125
+ cyclesToClean?: number | undefined;
4126
+ engine?: string | undefined;
4127
+ findingsSummary: {
4128
+ blocking: number;
4129
+ bySeverity: {
4130
+ critical: number;
4131
+ high: number;
4132
+ low: number;
4133
+ medium: number;
4134
+ unknown: number;
4135
+ };
4136
+ flagged: number;
4137
+ open: number;
4138
+ staleRepeats: number;
4139
+ };
4140
+ forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
4141
+ headSha?: string | undefined;
4142
+ model?: string | undefined;
4143
+ observedAt: string;
4144
+ patchId?: string | undefined;
4145
+ session?: {
4146
+ orchestrationMode?: "autonomous" | "manual" | undefined;
4147
+ resumedSession?: boolean | undefined;
4148
+ runtime?: string | undefined;
4149
+ sessionId?: string | undefined;
4150
+ } | undefined;
4151
+ stage: "gate" | "interior";
4152
+ usage?: {
4153
+ estimatedCostUsd?: number | undefined;
4154
+ source?: string | undefined;
4155
+ totalTokens?: number | undefined;
4156
+ } | undefined;
4157
+ eventType: "review-ladder-stage";
4158
+ typeVersion: 1;
4159
+ }, unknown, z.core.$ZodTypeInternals<{
4160
+ createdAt: string;
4161
+ eventId: string;
4162
+ issue?: number | undefined;
4163
+ pr?: number | undefined;
4164
+ repo: string;
4165
+ schemaVersion: 1;
4166
+ threadId?: string | undefined;
4167
+ workerId?: string | undefined;
4168
+ base: string;
4169
+ changedFiles: string[];
4170
+ headSha: string;
4171
+ maxReviewCycles: number;
4172
+ observedAt: string;
4173
+ outcome: "not-required";
4174
+ patchId: string;
4175
+ reason: "faithful-merge" | "no-applicable-mode";
4176
+ reviewCycle: number;
4177
+ eventType: "review-gate";
4178
+ typeVersion: 1;
4179
+ } | {
4180
+ createdAt: string;
4181
+ eventId: string;
4182
+ issue?: number | undefined;
4183
+ pr?: number | undefined;
4184
+ repo: string;
4185
+ schemaVersion: 1;
4186
+ threadId?: string | undefined;
4187
+ workerId?: string | undefined;
4188
+ cycle: number;
4189
+ cyclesToClean?: number | undefined;
4190
+ engine?: string | undefined;
4191
+ findingsSummary: {
4192
+ blocking: number;
4193
+ bySeverity: {
4194
+ critical: number;
4195
+ high: number;
4196
+ low: number;
4197
+ medium: number;
4198
+ unknown: number;
4199
+ };
4200
+ flagged: number;
4201
+ open: number;
4202
+ staleRepeats: number;
4203
+ };
4204
+ forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
4205
+ headSha?: string | undefined;
4206
+ model?: string | undefined;
4207
+ observedAt: string;
4208
+ patchId?: string | undefined;
4209
+ session?: {
4210
+ orchestrationMode?: "autonomous" | "manual" | undefined;
4211
+ resumedSession?: boolean | undefined;
4212
+ runtime?: string | undefined;
4213
+ sessionId?: string | undefined;
4214
+ } | undefined;
4215
+ stage: "gate" | "interior";
4216
+ usage?: {
4217
+ estimatedCostUsd?: number | undefined;
4218
+ source?: string | undefined;
4219
+ totalTokens?: number | undefined;
4220
+ } | undefined;
4221
+ eventType: "review-ladder-stage";
4222
+ typeVersion: 1;
4223
+ }, unknown>>;
4224
+ appendUnionSchemas: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>[];
4225
+ definitionByKind: Record<string, {
4226
+ emit: (event: {
4227
+ createdAt: string;
4228
+ eventId: string;
4229
+ issue?: number | undefined;
4230
+ pr?: number | undefined;
4231
+ repo: string;
4232
+ schemaVersion: 1;
4233
+ threadId?: string | undefined;
4234
+ workerId?: string | undefined;
4235
+ base: string;
4236
+ changedFiles: string[];
4237
+ headSha: string;
4238
+ maxReviewCycles: number;
4239
+ observedAt: string;
4240
+ outcome: "not-required";
4241
+ patchId: string;
4242
+ reason: "faithful-merge" | "no-applicable-mode";
4243
+ reviewCycle: number;
4244
+ eventType: "review-gate";
4245
+ typeVersion: 1;
4246
+ } | {
4247
+ createdAt: string;
4248
+ eventId: string;
4249
+ issue?: number | undefined;
4250
+ pr?: number | undefined;
4251
+ repo: string;
4252
+ schemaVersion: 1;
4253
+ threadId?: string | undefined;
4254
+ workerId?: string | undefined;
4255
+ cycle: number;
4256
+ cyclesToClean?: number | undefined;
4257
+ engine?: string | undefined;
4258
+ findingsSummary: {
4259
+ blocking: number;
4260
+ bySeverity: {
4261
+ critical: number;
4262
+ high: number;
4263
+ low: number;
4264
+ medium: number;
4265
+ unknown: number;
4266
+ };
4267
+ flagged: number;
4268
+ open: number;
4269
+ staleRepeats: number;
4270
+ };
4271
+ forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
4272
+ headSha?: string | undefined;
4273
+ model?: string | undefined;
4274
+ observedAt: string;
4275
+ patchId?: string | undefined;
4276
+ session?: {
4277
+ orchestrationMode?: "autonomous" | "manual" | undefined;
4278
+ resumedSession?: boolean | undefined;
4279
+ runtime?: string | undefined;
4280
+ sessionId?: string | undefined;
4281
+ } | undefined;
4282
+ stage: "gate" | "interior";
4283
+ usage?: {
4284
+ estimatedCostUsd?: number | undefined;
4285
+ source?: string | undefined;
4286
+ totalTokens?: number | undefined;
4287
+ } | undefined;
4288
+ eventType: "review-ladder-stage";
4289
+ typeVersion: 1;
4290
+ }) => unknown;
4291
+ }>;
4292
+ factoryTraceEventSchema: z.ZodType<{
4293
+ createdAt: string;
4294
+ eventId: string;
4295
+ issue?: number | undefined;
4296
+ pr?: number | undefined;
4297
+ repo: string;
4298
+ schemaVersion: 1;
4299
+ threadId?: string | undefined;
4300
+ workerId?: string | undefined;
4301
+ base: string;
4302
+ changedFiles: string[];
4303
+ headSha: string;
4304
+ maxReviewCycles: number;
4305
+ observedAt: string;
4306
+ outcome: "not-required";
4307
+ patchId: string;
4308
+ reason: "faithful-merge" | "no-applicable-mode";
4309
+ reviewCycle: number;
4310
+ eventType: "review-gate";
4311
+ typeVersion: 1;
4312
+ } | {
4313
+ createdAt: string;
4314
+ eventId: string;
4315
+ issue?: number | undefined;
4316
+ pr?: number | undefined;
4317
+ repo: string;
4318
+ schemaVersion: 1;
4319
+ threadId?: string | undefined;
4320
+ workerId?: string | undefined;
4321
+ cycle: number;
4322
+ cyclesToClean?: number | undefined;
4323
+ engine?: string | undefined;
4324
+ findingsSummary: {
4325
+ blocking: number;
4326
+ bySeverity: {
4327
+ critical: number;
4328
+ high: number;
4329
+ low: number;
4330
+ medium: number;
4331
+ unknown: number;
4332
+ };
4333
+ flagged: number;
4334
+ open: number;
4335
+ staleRepeats: number;
4336
+ };
4337
+ forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
4338
+ headSha?: string | undefined;
4339
+ model?: string | undefined;
4340
+ observedAt: string;
4341
+ patchId?: string | undefined;
4342
+ session?: {
4343
+ orchestrationMode?: "autonomous" | "manual" | undefined;
4344
+ resumedSession?: boolean | undefined;
4345
+ runtime?: string | undefined;
4346
+ sessionId?: string | undefined;
4347
+ } | undefined;
4348
+ stage: "gate" | "interior";
4349
+ usage?: {
4350
+ estimatedCostUsd?: number | undefined;
4351
+ source?: string | undefined;
4352
+ totalTokens?: number | undefined;
4353
+ } | undefined;
4354
+ eventType: "review-ladder-stage";
4355
+ typeVersion: 1;
4356
+ }, unknown, z.core.$ZodTypeInternals<{
4357
+ createdAt: string;
4358
+ eventId: string;
4359
+ issue?: number | undefined;
4360
+ pr?: number | undefined;
4361
+ repo: string;
4362
+ schemaVersion: 1;
4363
+ threadId?: string | undefined;
4364
+ workerId?: string | undefined;
4365
+ base: string;
4366
+ changedFiles: string[];
4367
+ headSha: string;
4368
+ maxReviewCycles: number;
4369
+ observedAt: string;
4370
+ outcome: "not-required";
4371
+ patchId: string;
4372
+ reason: "faithful-merge" | "no-applicable-mode";
4373
+ reviewCycle: number;
4374
+ eventType: "review-gate";
4375
+ typeVersion: 1;
4376
+ } | {
4377
+ createdAt: string;
4378
+ eventId: string;
4379
+ issue?: number | undefined;
4380
+ pr?: number | undefined;
4381
+ repo: string;
4382
+ schemaVersion: 1;
4383
+ threadId?: string | undefined;
4384
+ workerId?: string | undefined;
4385
+ cycle: number;
4386
+ cyclesToClean?: number | undefined;
4387
+ engine?: string | undefined;
4388
+ findingsSummary: {
4389
+ blocking: number;
4390
+ bySeverity: {
4391
+ critical: number;
4392
+ high: number;
4393
+ low: number;
4394
+ medium: number;
4395
+ unknown: number;
4396
+ };
4397
+ flagged: number;
4398
+ open: number;
4399
+ staleRepeats: number;
4400
+ };
4401
+ forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
4402
+ headSha?: string | undefined;
4403
+ model?: string | undefined;
4404
+ observedAt: string;
4405
+ patchId?: string | undefined;
4406
+ session?: {
4407
+ orchestrationMode?: "autonomous" | "manual" | undefined;
4408
+ resumedSession?: boolean | undefined;
4409
+ runtime?: string | undefined;
4410
+ sessionId?: string | undefined;
4411
+ } | undefined;
4412
+ stage: "gate" | "interior";
4413
+ usage?: {
4414
+ estimatedCostUsd?: number | undefined;
4415
+ source?: string | undefined;
4416
+ totalTokens?: number | undefined;
4417
+ } | undefined;
4418
+ eventType: "review-ladder-stage";
4419
+ typeVersion: 1;
4420
+ }, unknown>>;
4421
+ payloadSchemaRegistry: Record<string, Record<number, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
4422
+ payloadVersions: Record<string, readonly number[]>;
4423
+ readUnionSchemas: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>[];
4424
+ wirePayloadFor: (event: {
4425
+ createdAt: string;
4426
+ eventId: string;
4427
+ issue?: number | undefined;
4428
+ pr?: number | undefined;
4429
+ repo: string;
4430
+ schemaVersion: 1;
4431
+ threadId?: string | undefined;
4432
+ workerId?: string | undefined;
4433
+ base: string;
4434
+ changedFiles: string[];
4435
+ headSha: string;
4436
+ maxReviewCycles: number;
4437
+ observedAt: string;
4438
+ outcome: "not-required";
4439
+ patchId: string;
4440
+ reason: "faithful-merge" | "no-applicable-mode";
4441
+ reviewCycle: number;
4442
+ eventType: "review-gate";
4443
+ typeVersion: 1;
4444
+ } | {
4445
+ createdAt: string;
4446
+ eventId: string;
4447
+ issue?: number | undefined;
4448
+ pr?: number | undefined;
4449
+ repo: string;
4450
+ schemaVersion: 1;
4451
+ threadId?: string | undefined;
4452
+ workerId?: string | undefined;
4453
+ cycle: number;
4454
+ cyclesToClean?: number | undefined;
4455
+ engine?: string | undefined;
4456
+ findingsSummary: {
4457
+ blocking: number;
4458
+ bySeverity: {
4459
+ critical: number;
4460
+ high: number;
4461
+ low: number;
4462
+ medium: number;
4463
+ unknown: number;
4464
+ };
4465
+ flagged: number;
4466
+ open: number;
4467
+ staleRepeats: number;
4468
+ };
4469
+ forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
4470
+ headSha?: string | undefined;
4471
+ model?: string | undefined;
4472
+ observedAt: string;
4473
+ patchId?: string | undefined;
4474
+ session?: {
4475
+ orchestrationMode?: "autonomous" | "manual" | undefined;
4476
+ resumedSession?: boolean | undefined;
4477
+ runtime?: string | undefined;
4478
+ sessionId?: string | undefined;
4479
+ } | undefined;
4480
+ stage: "gate" | "interior";
4481
+ usage?: {
4482
+ estimatedCostUsd?: number | undefined;
4483
+ source?: string | undefined;
4484
+ totalTokens?: number | undefined;
4485
+ } | undefined;
4486
+ eventType: "review-ladder-stage";
4487
+ typeVersion: 1;
4488
+ }) => unknown;
4489
+ };
4272
4490
  type FactoryTraceEnvelope = z.infer<typeof FactoryTraceEnvelopeCoreSchema>;
4273
- //#endregion
4274
- //#region src/packages/trace/implementation/trace-sinks.d.ts
4275
4491
  interface TraceSink {
4276
4492
  append: (envelope: FactoryTraceEnvelope) => void;
4277
4493
  }
@@ -4290,11 +4506,9 @@ interface TraceWriteResult {
4290
4506
  interface ResolveTraceWriteSinksOptions {
4291
4507
  mirror?: TraceSink;
4292
4508
  }
4293
- declare const createLocalJsonlTraceSink: (repoRoot: string) => TraceSink;
4294
- declare const appendWithTraceSinks: (envelope: FactoryTraceEnvelope, sinks: TraceWriteSinks) => TraceWriteResult;
4295
- declare const resolveTraceWriteSinks: (repoRoot: string, options?: ResolveTraceWriteSinksOptions) => TraceWriteSinks;
4296
- //#endregion
4297
- //#region src/packages/trace/implementation/facade.d.ts
4509
+ export declare const createLocalJsonlTraceSink: (repoRoot: string) => TraceSink;
4510
+ export declare const appendWithTraceSinks: (envelope: FactoryTraceEnvelope, sinks: TraceWriteSinks) => TraceWriteResult;
4511
+ export declare const resolveTraceWriteSinks: (repoRoot: string, options?: ResolveTraceWriteSinksOptions) => TraceWriteSinks;
4298
4512
  type ReadableFactoryTraceEvent = FactoryTraceEvent | z.infer<typeof UnknownFactoryTraceEventSchema>;
4299
4513
  interface FactoryTraceFilters {
4300
4514
  eventType?: string | readonly string[];
@@ -4337,18 +4551,18 @@ interface ScanFactoryTraceDiagnosticsOptions {
4337
4551
  repoRoot: string;
4338
4552
  to: string;
4339
4553
  }
4340
- declare const validateFactoryTraceEvent: (event: unknown) => FactoryTraceEvent;
4341
- declare const toFactoryTraceEnvelope: (event: FactoryTraceEvent) => {
4554
+ export declare const validateFactoryTraceEvent: (event: unknown) => FactoryTraceEvent;
4555
+ export declare const toFactoryTraceEnvelope: (event: FactoryTraceEvent) => {
4342
4556
  createdAt: string;
4343
4557
  envelope: 1;
4344
4558
  eventId: string;
4559
+ issue?: number | undefined;
4345
4560
  payload: unknown;
4561
+ pr?: number | undefined;
4346
4562
  repo: string;
4563
+ thread?: string | undefined;
4347
4564
  type: string;
4348
4565
  typeVersion: number;
4349
- issue?: number | undefined;
4350
- pr?: number | undefined;
4351
- thread?: string | undefined;
4352
4566
  worker?: string | undefined;
4353
4567
  };
4354
4568
  interface AppendFactoryTraceEventResult {
@@ -4356,14 +4570,7 @@ interface AppendFactoryTraceEventResult {
4356
4570
  filePath: string;
4357
4571
  mirrorDiagnostics: TraceMirrorDiagnostic[];
4358
4572
  }
4359
- declare const scanFactoryTraceEvents: ({
4360
- diagnosticsOnly,
4361
- filters,
4362
- from,
4363
- malformed,
4364
- repoRoot,
4365
- to
4366
- }: ScanFactoryTraceOptions) => ScanFactoryTraceResult;
4573
+ export declare const scanFactoryTraceEvents: ({ diagnosticsOnly, filters, from, malformed, repoRoot, to }: ScanFactoryTraceOptions) => ScanFactoryTraceResult;
4367
4574
  /**
4368
4575
  * Diagnostics-only trace read (#707). Scans the shard window purely to surface
4369
4576
  * malformed / unknown-record diagnostics, without materializing (and then
@@ -4372,20 +4579,13 @@ declare const scanFactoryTraceEvents: ({
4372
4579
  * but no event payloads — e.g. epic closeout after the orchestrator-metrics
4373
4580
  * removal.
4374
4581
  */
4375
- declare const scanFactoryTraceDiagnostics: ({
4376
- filters,
4377
- from,
4378
- repoRoot,
4379
- to
4380
- }: ScanFactoryTraceDiagnosticsOptions) => FactoryTraceDiagnostic[];
4582
+ export declare const scanFactoryTraceDiagnostics: ({ filters, from, repoRoot, to }: ScanFactoryTraceDiagnosticsOptions) => FactoryTraceDiagnostic[];
4381
4583
  declare namespace comment_provenance_d_exports {
4382
4584
  export { SHA_MATCH_MIN_LENGTH, isBotLogin, sameHeadSha };
4383
4585
  }
4384
4586
  declare const isBotLogin: (login?: string | undefined) => boolean;
4385
4587
  declare const SHA_MATCH_MIN_LENGTH = 7;
4386
4588
  declare const sameHeadSha: (left: string, right: string) => boolean;
4387
- //#endregion
4388
- //#region src/doctor-hq-checks.d.ts
4389
4589
  /**
4390
4590
  * The `doctor` check that makes silent HQ delivery failure loud (#394,
4391
4591
  * epic #389 wave 2): the local spool is empty, and no stranded evidence is
@@ -4410,8 +4610,6 @@ interface HqReadinessCheckDependencies {
4410
4610
  resolveSecret?: SecretReferenceResolver;
4411
4611
  timeoutMs?: number;
4412
4612
  }
4413
- //#endregion
4414
- //#region src/hq-last-stored.d.ts
4415
4613
  declare const lastStoredSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
4416
4614
  found: z.ZodLiteral<true>;
4417
4615
  lastFromCaller: z.ZodNullable<z.ZodObject<{
@@ -4480,24 +4678,18 @@ interface HqLastStoredDependencies {
4480
4678
  }
4481
4679
  /** Asks HQ when it last stored an event for `repository`. Never throws. */
4482
4680
  declare function fetchHqLastStored(input: HqLastStoredInput, dependencies?: HqLastStoredDependencies): Promise<HqLastStored>;
4483
- //#endregion
4484
- //#region src/doctor-hq-last-stored.d.ts
4485
4681
  /** Test seams. Production never sets these. */
4486
4682
  interface HqLastStoredCheckDependencies {
4487
4683
  countSpool?: typeof countHqSpoolWork;
4488
4684
  lastStored?: typeof fetchHqLastStored;
4489
4685
  now?: () => Date;
4490
4686
  }
4491
- //#endregion
4492
- //#region src/doctor-hq-webhook.d.ts
4493
4687
  /** Test seams. Production never sets these. */
4494
4688
  interface HqWebhookCheckDependencies {
4495
4689
  gh?: GhBoundedJsonReader;
4496
4690
  lastStored?: typeof fetchHqLastStored;
4497
4691
  now?: () => Date;
4498
4692
  }
4499
- //#endregion
4500
- //#region src/doctor-machine-checks.d.ts
4501
4693
  /** Test seams. Production never sets these. */
4502
4694
  interface MachineCheckDependencies {
4503
4695
  cpuCount?: () => number;
@@ -4510,8 +4702,6 @@ interface MachineCheckDependencies {
4510
4702
  /** What `/bin/sh` resolves to, or undefined when it cannot be resolved. */
4511
4703
  resolveShell?: () => string | undefined;
4512
4704
  }
4513
- //#endregion
4514
- //#region src/doctor.d.ts
4515
4705
  interface DoctorReport {
4516
4706
  checks: DoctorCheck[];
4517
4707
  ok: boolean;
@@ -4547,28 +4737,18 @@ interface DoctorProjectProfileInput extends LoadProjectProfileInput {
4547
4737
  preflight?: boolean;
4548
4738
  userConfig?: LoadUserConfigResult;
4549
4739
  }
4550
- declare function doctorProjectProfile(input?: DoctorProjectProfileInput): Promise<DoctorReport>;
4551
- //#endregion
4552
- //#region src/pr-review-gate-trace.d.ts
4740
+ export declare function doctorProjectProfile(input?: DoctorProjectProfileInput): Promise<DoctorReport>;
4553
4741
  interface ReviewGateTraceIdentity {
4554
4742
  issue?: number;
4555
4743
  repo: string;
4556
4744
  }
4557
4745
  type ReviewGateNotRequiredProof = Pick<PrReviewProof, "base" | "changedFiles" | "headSha" | "patchId"> & Required<Pick<PrReviewProof, "maxReviewCycles" | "reviewCycle" | "reviewRequirement">>;
4558
- declare const buildReviewGateNotRequiredTraceEvent: ({
4559
- createdAt,
4560
- identity,
4561
- proof
4562
- }: {
4746
+ export declare const buildReviewGateNotRequiredTraceEvent: ({ createdAt, identity, proof }: {
4563
4747
  createdAt?: string;
4564
4748
  identity: ReviewGateTraceIdentity;
4565
4749
  proof: ReviewGateNotRequiredProof;
4566
4750
  }) => FactoryTraceEvent;
4567
- declare const tryAppendReviewGateNotRequiredTraceEvent: ({
4568
- identity,
4569
- proof,
4570
- repoRoot
4571
- }: {
4751
+ export declare const tryAppendReviewGateNotRequiredTraceEvent: ({ identity, proof, repoRoot }: {
4572
4752
  identity: ReviewGateTraceIdentity;
4573
4753
  proof: ReviewGateNotRequiredProof;
4574
4754
  repoRoot: string;
@@ -4577,9 +4757,9 @@ declare const tryAppendReviewGateNotRequiredTraceEvent: ({
4577
4757
  readonly ok: true;
4578
4758
  readonly errorMessage?: undefined;
4579
4759
  } | {
4760
+ readonly filePath?: undefined;
4580
4761
  readonly errorMessage: string;
4581
4762
  readonly ok: false;
4582
- readonly filePath?: undefined;
4583
4763
  };
4584
4764
  declare namespace worktree_scratch_files_d_exports {
4585
4765
  export { WorktreeRootLister, WorktreeScratchFileCheck, checkWorktreeScratchFiles, formatScratchFileCheckSummary, isWorktreeScratchFile };
@@ -4603,26 +4783,18 @@ declare function checkWorktreeScratchFiles(worktreePath?: string, listRootEntrie
4603
4783
  * apart.
4604
4784
  */
4605
4785
  declare function formatScratchFileCheckSummary(check: WorktreeScratchFileCheck): string;
4606
- //#endregion
4607
- //#region src/pr-readiness/pr-body-sections.d.ts
4608
4786
  declare const MANAGED_SECTION_NAMES: readonly ["Verification", "Review proof", "How to review"];
4609
4787
  declare namespace pr_body_renderer_d_exports {
4610
4788
  export { MANAGED_SECTION_NAMES as PR_BODY_MANAGED_SECTIONS, renderPrBodySectionParts, renderPrBodySections };
4611
4789
  }
4612
- declare const renderPrBodySectionParts: ({
4613
- reviewProof,
4614
- verifyProof
4615
- }: {
4790
+ declare const renderPrBodySectionParts: ({ reviewProof, verifyProof }: {
4616
4791
  reviewProof?: PrReviewProof;
4617
4792
  verifyProof?: PrVerifyProof;
4618
4793
  }) => {
4619
4794
  heading: string;
4620
4795
  content: string;
4621
4796
  }[];
4622
- declare const renderPrBodySections: ({
4623
- reviewProof,
4624
- verifyProof
4625
- }: {
4797
+ declare const renderPrBodySections: ({ reviewProof, verifyProof }: {
4626
4798
  reviewProof?: PrReviewProof;
4627
4799
  verifyProof?: PrVerifyProof;
4628
4800
  }) => string;
@@ -4633,7 +4805,7 @@ declare const CORRECTNESS_UNTYPED_REVIEW_BLOCKER_REASON = "Correctness review pr
4633
4805
  declare const SECURITY_UNTYPED_REVIEW_BLOCKER_REASON = "Security review proof is not a head-bound typed findings verdict; re-run pr:review with a valid findings file.";
4634
4806
  declare const DRAFT_BLOCKER_REASON = "PR is still marked draft.";
4635
4807
  declare const PENDING_CHECKS_BLOCKER_REASON_PREFIX = "Required/current checks are";
4636
- declare const readinessExitCode: (status: ReadinessStatus) => 1 | 0;
4808
+ declare const readinessExitCode: (status: ReadinessStatus) => 0 | 1;
4637
4809
  interface EvaluationInput {
4638
4810
  pr: number;
4639
4811
  prTitle?: string;
@@ -4679,39 +4851,85 @@ interface EvaluationInput {
4679
4851
  waivers?: DemandWaiver[];
4680
4852
  }
4681
4853
  declare const evaluateReadiness: (input: EvaluationInput) => {
4854
+ catchUpRecognition: CatchUpRecognition;
4855
+ blockedReasons: {
4856
+ code: string;
4857
+ detail: string;
4858
+ }[];
4859
+ blockingReasons: string[];
4682
4860
  humanBlockingReasons: string[];
4683
4861
  ledger: {
4684
4862
  baseSha: string;
4685
4863
  blockingReasons: string[];
4686
- classification: "docs/process-only" | "trivial" | "non-trivial";
4864
+ classification: "docs/process-only" | "non-trivial" | "trivial";
4865
+ externalChecks?: {
4866
+ checkType: "review" | "verify";
4867
+ name: string;
4868
+ reason?: string | undefined;
4869
+ scope?: {
4870
+ classifications: ("docs/process-only" | "non-trivial" | "trivial")[];
4871
+ } | undefined;
4872
+ scopeReason: string;
4873
+ status: "out-of-scope" | "satisfied" | "unmet";
4874
+ }[] | undefined;
4687
4875
  github: {
4688
4876
  draft: boolean;
4689
4877
  mergeStateStatus: string;
4690
4878
  mergeable: string;
4691
- requiredChecks: "unknown" | "passed" | "failed" | "pending" | "none";
4692
- unresolvedReviewThreads: number;
4879
+ requiredChecks: "failed" | "none" | "passed" | "pending" | "unknown";
4693
4880
  reviewDecision?: string | null | undefined;
4881
+ unresolvedReviewThreads: number;
4694
4882
  };
4695
4883
  headSha: string;
4884
+ mergeBaseSha?: string | undefined;
4696
4885
  patchId: string;
4697
4886
  pr: number;
4698
4887
  repairs: {
4699
4888
  action: string;
4700
- code: "undraft-pr" | "await-post-undraft-checks";
4889
+ code: "await-post-undraft-checks" | "undraft-pr";
4701
4890
  command: string;
4702
4891
  }[];
4892
+ reviewCycleState?: {
4893
+ autoBlockingFindings: number;
4894
+ countsBySeverity: {
4895
+ critical: number;
4896
+ high: number;
4897
+ low: number;
4898
+ medium: number;
4899
+ unknown: number;
4900
+ };
4901
+ highestBlockingSeverity?: "critical" | "high" | "low" | "medium" | "unknown" | undefined;
4902
+ highestOpenSeverity?: "critical" | "high" | "low" | "medium" | "unknown" | undefined;
4903
+ maxReviewCycles?: number | undefined;
4904
+ nonBlockingFindings: number;
4905
+ openFindings: number;
4906
+ reviewCycle?: number | undefined;
4907
+ staleRepeatFindings?: number | undefined;
4908
+ windowExhausted: boolean;
4909
+ } | undefined;
4910
+ reviewLadder?: {
4911
+ cycleCounts: {
4912
+ gate: number;
4913
+ interior: number;
4914
+ };
4915
+ forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
4916
+ nextAction: "accept-nonblocking-findings" | "advance-to-gate" | "escalate-to-triage" | "ready-for-human" | "run-gate-cycle" | "run-interior-cycle";
4917
+ stage: "gate" | "interior" | "interior-complete";
4918
+ } | undefined;
4919
+ reviewRuns?: PrReviewResult[] | undefined;
4920
+ reviewTerminalState?: "accepted-with-findings" | "blocked" | "clean" | undefined;
4703
4921
  reviews: {
4704
4922
  correctness: {
4705
4923
  required: boolean;
4706
- status: "blocked" | "not-required" | "current" | "stale" | "missing";
4707
4924
  reviewedHeadSha?: string | undefined;
4708
4925
  reviewedPatchId?: string | undefined;
4926
+ status: "blocked" | "current" | "missing" | "not-required" | "stale";
4709
4927
  };
4710
4928
  security?: {
4711
4929
  required: boolean;
4712
- status: "blocked" | "not-required" | "current" | "stale" | "missing";
4713
4930
  reviewedHeadSha?: string | undefined;
4714
4931
  reviewedPatchId?: string | undefined;
4932
+ status: "blocked" | "current" | "missing" | "not-required" | "stale";
4715
4933
  } | undefined;
4716
4934
  };
4717
4935
  schemaVersion: 2;
@@ -4737,46 +4955,6 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4737
4955
  trivialVerifiedHeadSha: string;
4738
4956
  verifiedHeadSha?: string | undefined;
4739
4957
  };
4740
- externalChecks?: {
4741
- checkType: "review" | "verify";
4742
- name: string;
4743
- scopeReason: string;
4744
- status: "satisfied" | "unmet" | "out-of-scope";
4745
- reason?: string | undefined;
4746
- scope?: {
4747
- classifications: ("docs/process-only" | "trivial" | "non-trivial")[];
4748
- } | undefined;
4749
- }[] | undefined;
4750
- mergeBaseSha?: string | undefined;
4751
- reviewCycleState?: {
4752
- autoBlockingFindings: number;
4753
- countsBySeverity: {
4754
- critical: number;
4755
- high: number;
4756
- low: number;
4757
- medium: number;
4758
- unknown: number;
4759
- };
4760
- nonBlockingFindings: number;
4761
- openFindings: number;
4762
- windowExhausted: boolean;
4763
- highestBlockingSeverity?: "unknown" | "critical" | "high" | "low" | "medium" | undefined;
4764
- highestOpenSeverity?: "unknown" | "critical" | "high" | "low" | "medium" | undefined;
4765
- maxReviewCycles?: number | undefined;
4766
- reviewCycle?: number | undefined;
4767
- staleRepeatFindings?: number | undefined;
4768
- } | undefined;
4769
- reviewLadder?: {
4770
- cycleCounts: {
4771
- gate: number;
4772
- interior: number;
4773
- };
4774
- nextAction: "run-interior-cycle" | "advance-to-gate" | "run-gate-cycle" | "accept-nonblocking-findings" | "escalate-to-triage" | "ready-for-human";
4775
- stage: "gate" | "interior" | "interior-complete";
4776
- forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
4777
- } | undefined;
4778
- reviewRuns?: PrReviewResult[] | undefined;
4779
- reviewTerminalState?: "blocked" | "accepted-with-findings" | "clean" | undefined;
4780
4958
  };
4781
4959
  /**
4782
4960
  * Facts a reader needs that are not refusals (#477): the settle-window
@@ -4786,51 +4964,92 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4786
4964
  notices: string[];
4787
4965
  repairs: {
4788
4966
  action: string;
4789
- code: "undraft-pr" | "await-post-undraft-checks";
4967
+ code: "await-post-undraft-checks" | "undraft-pr";
4790
4968
  command: string;
4791
4969
  }[];
4792
- status: ReadinessStatus; /** Demands that were in force, were NOT met, and the operator waived. */
4970
+ status: ReadinessStatus;
4971
+ /** Demands that were in force, were NOT met, and the operator waived. */
4793
4972
  waivedDemands: WaivedDemand[];
4794
- catchUpRecognition: CatchUpRecognition;
4973
+ } | {
4974
+ catchUpRecognition?: undefined;
4795
4975
  blockedReasons: {
4796
4976
  code: string;
4797
4977
  detail: string;
4798
4978
  }[];
4799
4979
  blockingReasons: string[];
4800
- } | {
4801
4980
  humanBlockingReasons: string[];
4802
4981
  ledger: {
4803
4982
  baseSha: string;
4804
4983
  blockingReasons: string[];
4805
- classification: "docs/process-only" | "trivial" | "non-trivial";
4984
+ classification: "docs/process-only" | "non-trivial" | "trivial";
4985
+ externalChecks?: {
4986
+ checkType: "review" | "verify";
4987
+ name: string;
4988
+ reason?: string | undefined;
4989
+ scope?: {
4990
+ classifications: ("docs/process-only" | "non-trivial" | "trivial")[];
4991
+ } | undefined;
4992
+ scopeReason: string;
4993
+ status: "out-of-scope" | "satisfied" | "unmet";
4994
+ }[] | undefined;
4806
4995
  github: {
4807
4996
  draft: boolean;
4808
4997
  mergeStateStatus: string;
4809
4998
  mergeable: string;
4810
- requiredChecks: "unknown" | "passed" | "failed" | "pending" | "none";
4811
- unresolvedReviewThreads: number;
4999
+ requiredChecks: "failed" | "none" | "passed" | "pending" | "unknown";
4812
5000
  reviewDecision?: string | null | undefined;
5001
+ unresolvedReviewThreads: number;
4813
5002
  };
4814
5003
  headSha: string;
5004
+ mergeBaseSha?: string | undefined;
4815
5005
  patchId: string;
4816
5006
  pr: number;
4817
5007
  repairs: {
4818
5008
  action: string;
4819
- code: "undraft-pr" | "await-post-undraft-checks";
5009
+ code: "await-post-undraft-checks" | "undraft-pr";
4820
5010
  command: string;
4821
5011
  }[];
5012
+ reviewCycleState?: {
5013
+ autoBlockingFindings: number;
5014
+ countsBySeverity: {
5015
+ critical: number;
5016
+ high: number;
5017
+ low: number;
5018
+ medium: number;
5019
+ unknown: number;
5020
+ };
5021
+ highestBlockingSeverity?: "critical" | "high" | "low" | "medium" | "unknown" | undefined;
5022
+ highestOpenSeverity?: "critical" | "high" | "low" | "medium" | "unknown" | undefined;
5023
+ maxReviewCycles?: number | undefined;
5024
+ nonBlockingFindings: number;
5025
+ openFindings: number;
5026
+ reviewCycle?: number | undefined;
5027
+ staleRepeatFindings?: number | undefined;
5028
+ windowExhausted: boolean;
5029
+ } | undefined;
5030
+ reviewLadder?: {
5031
+ cycleCounts: {
5032
+ gate: number;
5033
+ interior: number;
5034
+ };
5035
+ forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
5036
+ nextAction: "accept-nonblocking-findings" | "advance-to-gate" | "escalate-to-triage" | "ready-for-human" | "run-gate-cycle" | "run-interior-cycle";
5037
+ stage: "gate" | "interior" | "interior-complete";
5038
+ } | undefined;
5039
+ reviewRuns?: PrReviewResult[] | undefined;
5040
+ reviewTerminalState?: "accepted-with-findings" | "blocked" | "clean" | undefined;
4822
5041
  reviews: {
4823
5042
  correctness: {
4824
5043
  required: boolean;
4825
- status: "blocked" | "not-required" | "current" | "stale" | "missing";
4826
5044
  reviewedHeadSha?: string | undefined;
4827
5045
  reviewedPatchId?: string | undefined;
5046
+ status: "blocked" | "current" | "missing" | "not-required" | "stale";
4828
5047
  };
4829
5048
  security?: {
4830
5049
  required: boolean;
4831
- status: "blocked" | "not-required" | "current" | "stale" | "missing";
4832
5050
  reviewedHeadSha?: string | undefined;
4833
5051
  reviewedPatchId?: string | undefined;
5052
+ status: "blocked" | "current" | "missing" | "not-required" | "stale";
4834
5053
  } | undefined;
4835
5054
  };
4836
5055
  schemaVersion: 2;
@@ -4856,46 +5075,6 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4856
5075
  trivialVerifiedHeadSha: string;
4857
5076
  verifiedHeadSha?: string | undefined;
4858
5077
  };
4859
- externalChecks?: {
4860
- checkType: "review" | "verify";
4861
- name: string;
4862
- scopeReason: string;
4863
- status: "satisfied" | "unmet" | "out-of-scope";
4864
- reason?: string | undefined;
4865
- scope?: {
4866
- classifications: ("docs/process-only" | "trivial" | "non-trivial")[];
4867
- } | undefined;
4868
- }[] | undefined;
4869
- mergeBaseSha?: string | undefined;
4870
- reviewCycleState?: {
4871
- autoBlockingFindings: number;
4872
- countsBySeverity: {
4873
- critical: number;
4874
- high: number;
4875
- low: number;
4876
- medium: number;
4877
- unknown: number;
4878
- };
4879
- nonBlockingFindings: number;
4880
- openFindings: number;
4881
- windowExhausted: boolean;
4882
- highestBlockingSeverity?: "unknown" | "critical" | "high" | "low" | "medium" | undefined;
4883
- highestOpenSeverity?: "unknown" | "critical" | "high" | "low" | "medium" | undefined;
4884
- maxReviewCycles?: number | undefined;
4885
- reviewCycle?: number | undefined;
4886
- staleRepeatFindings?: number | undefined;
4887
- } | undefined;
4888
- reviewLadder?: {
4889
- cycleCounts: {
4890
- gate: number;
4891
- interior: number;
4892
- };
4893
- nextAction: "run-interior-cycle" | "advance-to-gate" | "run-gate-cycle" | "accept-nonblocking-findings" | "escalate-to-triage" | "ready-for-human";
4894
- stage: "gate" | "interior" | "interior-complete";
4895
- forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
4896
- } | undefined;
4897
- reviewRuns?: PrReviewResult[] | undefined;
4898
- reviewTerminalState?: "blocked" | "accepted-with-findings" | "clean" | undefined;
4899
5078
  };
4900
5079
  /**
4901
5080
  * Facts a reader needs that are not refusals (#477): the settle-window
@@ -4905,20 +5084,13 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4905
5084
  notices: string[];
4906
5085
  repairs: {
4907
5086
  action: string;
4908
- code: "undraft-pr" | "await-post-undraft-checks";
5087
+ code: "await-post-undraft-checks" | "undraft-pr";
4909
5088
  command: string;
4910
5089
  }[];
4911
- status: ReadinessStatus; /** Demands that were in force, were NOT met, and the operator waived. */
5090
+ status: ReadinessStatus;
5091
+ /** Demands that were in force, were NOT met, and the operator waived. */
4912
5092
  waivedDemands: WaivedDemand[];
4913
- catchUpRecognition?: undefined;
4914
- blockedReasons: {
4915
- code: string;
4916
- detail: string;
4917
- }[];
4918
- blockingReasons: string[];
4919
5093
  };
4920
- //#endregion
4921
- //#region src/evidence-emit.d.ts
4922
5094
  interface EvidenceEmitArgs {
4923
5095
  base: string;
4924
5096
  check: string;
@@ -4947,18 +5119,9 @@ interface EvidenceEmitResult {
4947
5119
  envelope: EvidenceEnvelope;
4948
5120
  path: string;
4949
5121
  }
4950
- declare const evidenceEnvelopeFilename: (check: string, headSha: string) => string;
4951
- declare function buildEvidenceEnvelope(args: EvidenceEmitArgs, dependencies?: EvidenceEmitDependencies): EvidenceEnvelope;
4952
- declare function runEvidenceEmit(args: EvidenceEmitArgs, dependencies?: EvidenceEmitDependencies): EvidenceEmitResult;
4953
- //#endregion
4954
- //#region src/hq-access.d.ts
4955
- /** Cloudflare Access service-token credentials for production HQ ingest. */
4956
- interface CloudflareAccessServiceToken {
4957
- clientId: string;
4958
- clientSecret: string;
4959
- }
4960
- //#endregion
4961
- //#region src/epic-structure.d.ts
5122
+ export declare const evidenceEnvelopeFilename: (check: string, headSha: string) => string;
5123
+ export declare function buildEvidenceEnvelope(args: EvidenceEmitArgs, dependencies?: EvidenceEmitDependencies): EvidenceEnvelope;
5124
+ export declare function runEvidenceEmit(args: EvidenceEmitArgs, dependencies?: EvidenceEmitDependencies): EvidenceEmitResult;
4962
5125
  /**
4963
5126
  * Producer-side `epic-structure` v1 emitter (epic #132, lane #135).
4964
5127
  *
@@ -4979,7 +5142,7 @@ interface CloudflareAccessServiceToken {
4979
5142
  * The `dag.yml` schema itself is documented with the epic skill (lane #137);
4980
5143
  * this module is the executable contract, not a second source of truth.
4981
5144
  */
4982
- declare const EPIC_STRUCTURE_SCHEMA_VERSION = 1;
5145
+ export declare const EPIC_STRUCTURE_SCHEMA_VERSION = 1;
4983
5146
  /**
4984
5147
  * DAG-node PLANNING statuses — the planning-plane vocabulary a planner authors
4985
5148
  * on a `dag.yml` node. Carried forward by ADR 0018 and defined by the epic
@@ -5002,7 +5165,7 @@ declare const EPIC_STRUCTURE_SCHEMA_VERSION = 1;
5002
5165
  * emits a lane status. HQ's `epic-structure-parity.test.ts` fails CI if the
5003
5166
  * producer emits any status HQ won't accept.
5004
5167
  */
5005
- declare const EPIC_STRUCTURE_NODE_STATUSES: readonly ["open", "closed", "satisfied-on-main", "parked"];
5168
+ export declare const EPIC_STRUCTURE_NODE_STATUSES: readonly ["open", "closed", "satisfied-on-main", "parked"];
5006
5169
  type EpicStructureNodeStatus = (typeof EPIC_STRUCTURE_NODE_STATUSES)[number];
5007
5170
  interface DagDocument {
5008
5171
  epic?: unknown;
@@ -5050,7 +5213,7 @@ interface BuildEpicStructureEventInput {
5050
5213
  /**
5051
5214
  * Fail-closed validation error carrying every offending node/edge diagnostic.
5052
5215
  */
5053
- declare class EpicStructureValidationError extends Error {
5216
+ export declare class EpicStructureValidationError extends Error {
5054
5217
  readonly diagnostics: string[];
5055
5218
  constructor(diagnostics: string[]);
5056
5219
  }
@@ -5077,13 +5240,13 @@ interface ValidatedDag {
5077
5240
  * Validates a dag document fail-closed. Throws {@link
5078
5241
  * EpicStructureValidationError} with a diagnostic per offending node/edge.
5079
5242
  */
5080
- declare const validateDagDocument: (input: BuildEpicStructureEventInput) => ValidatedDag;
5243
+ export declare const validateDagDocument: (input: BuildEpicStructureEventInput) => ValidatedDag;
5081
5244
  /**
5082
5245
  * Builds the wire payload with deterministic ordering (nodes by slug, edges by
5083
5246
  * from then to) so re-emission of the same graph is byte-stable regardless of
5084
5247
  * the planner's source ordering — the basis for the content-addressed eventId.
5085
5248
  */
5086
- declare const buildEpicStructurePayload: (dag: ValidatedDag) => EpicStructureGraphPayload;
5249
+ export declare const buildEpicStructurePayload: (dag: ValidatedDag) => EpicStructureGraphPayload;
5087
5250
  /**
5088
5251
  * Deterministic eventId = `epic-structure-<boundary>-<sha256(payload)[0:16]>`.
5089
5252
  * Re-emitting identical graph content yields the same eventId (HQ dedups →
@@ -5091,12 +5254,12 @@ declare const buildEpicStructurePayload: (dag: ValidatedDag) => EpicStructureGra
5091
5254
  * supersedes the prior structure wholesale (HQ keeps the latest). This mirrors
5092
5255
  * seed-dev's fixed-eventId idempotency, content-addressed instead of literal.
5093
5256
  */
5094
- declare const epicStructureEventId: (boundary: string, payload: EpicStructureGraphPayload) => string;
5257
+ export declare const epicStructureEventId: (boundary: string, payload: EpicStructureGraphPayload) => string;
5095
5258
  /**
5096
5259
  * Validates and builds the full `epic-structure` v1 ingest event, ready to POST
5097
5260
  * to `/api/ingest`. Throws {@link EpicStructureValidationError} fail-closed.
5098
5261
  */
5099
- declare const buildEpicStructureEvent: (input: BuildEpicStructureEventInput) => EpicStructureEvent;
5262
+ export declare const buildEpicStructureEvent: (input: BuildEpicStructureEventInput) => EpicStructureEvent;
5100
5263
  type FetchLike = (input: string, init?: {
5101
5264
  body?: string;
5102
5265
  headers?: Record<string, string>;
@@ -5134,23 +5297,19 @@ interface PublishEpicStructureResult {
5134
5297
  /** The prod HQ worker is reachable at `hq.patronage.com` and its frozen
5135
5298
  * `-v1.*.workers.dev` alias. Emitting there without an Access service token is
5136
5299
  * fail-closed. */
5137
- declare const isProductionHqUrl: (url: string) => boolean;
5300
+ export declare const isProductionHqUrl: (url: string) => boolean;
5138
5301
  /**
5139
5302
  * POSTs the event to HQ ingest. Fail-closed: a production URL without a
5140
5303
  * Cloudflare Access service token is refused before any request; a 401/403 is
5141
5304
  * surfaced with actionable guidance; any non-2xx throws.
5142
5305
  */
5143
- declare const publishEpicStructure: (args: PublishEpicStructureArgs) => Promise<PublishEpicStructureResult>;
5144
- //#endregion
5145
- //#region src/review-focus.d.ts
5146
- declare const REVIEW_FOCUS_SECTION = "Review focus";
5306
+ export declare const publishEpicStructure: (args: PublishEpicStructureArgs) => Promise<PublishEpicStructureResult>;
5307
+ export declare const REVIEW_FOCUS_SECTION = "Review focus";
5147
5308
  interface IssueReviewFocus {
5148
5309
  issueNumber: number;
5149
5310
  text: string;
5150
5311
  }
5151
- declare const reviewFocusFromIssueBody: (body: string) => string | undefined;
5152
- //#endregion
5153
- //#region src/review-prompt.d.ts
5312
+ export declare const reviewFocusFromIssueBody: (body: string) => string | undefined;
5154
5313
  interface AssembleReviewPromptInput {
5155
5314
  base: string;
5156
5315
  changedFiles: string[];
@@ -5174,31 +5333,27 @@ interface AssembledReviewPrompt {
5174
5333
  prompt: string;
5175
5334
  sections: ReviewPromptSection[];
5176
5335
  }
5177
- declare const assembleReviewPrompt: ({
5178
- base,
5179
- changedFiles,
5180
- cwd,
5181
- headSha,
5182
- issueFocus,
5183
- kind,
5184
- patchId,
5185
- priorLedgerEntries,
5186
- profile,
5187
- waveRung
5188
- }: AssembleReviewPromptInput, dependencies?: AssembleReviewPromptDependencies) => AssembledReviewPrompt;
5189
- //#endregion
5190
- //#region src/verification-run-context.d.ts
5191
- declare const FACTORY_BASE_REF_ENV = "FACTORY_BASE_REF";
5192
- declare const FACTORY_CHANGED_FILES_ENV = "FACTORY_CHANGED_FILES";
5193
- declare const FACTORY_CHANGED_FILES_FILE_ENV = "FACTORY_CHANGED_FILES_FILE";
5194
- declare const EMPTY_TREE_OBJECT_HASH = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
5195
- declare const DEFAULT_ROOT_SHARED_GLOBS: string[];
5336
+ export declare const assembleReviewPrompt: ({ base, changedFiles, cwd, headSha, issueFocus, kind, patchId, priorLedgerEntries, profile, waveRung }: AssembleReviewPromptInput, dependencies?: AssembleReviewPromptDependencies) => AssembledReviewPrompt;
5337
+ export declare const FACTORY_BASE_REF_ENV = "FACTORY_BASE_REF";
5338
+ export declare const FACTORY_CHANGED_FILES_ENV = "FACTORY_CHANGED_FILES";
5339
+ export declare const FACTORY_CHANGED_FILES_FILE_ENV = "FACTORY_CHANGED_FILES_FILE";
5340
+ export declare const FACTORY_LOCKFILE_IMPORTERS_ENV = "FACTORY_LOCKFILE_IMPORTERS";
5341
+ export declare const FACTORY_LOCKFILE_BASE_REF_ENV = "FACTORY_LOCKFILE_BASE_REF";
5342
+ export declare const EMPTY_TREE_OBJECT_HASH = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
5343
+ export declare const DEFAULT_ROOT_SHARED_GLOBS: string[];
5196
5344
  interface VerificationRunContextInput {
5197
5345
  baseRef: string;
5198
5346
  changedFiles: string[];
5199
5347
  fullSuiteBaseRef?: string;
5200
5348
  rootSharedGlobs?: string[];
5201
5349
  inlineLimitBytes?: number;
5350
+ /**
5351
+ * #1579: the importers a changed `pnpm-lock.yaml` is scoped to. The
5352
+ * lockfile still forces the full-suite base ref; when it is the only
5353
+ * root/shared change, `psf affected` selects the packages at these
5354
+ * importers from the real base instead.
5355
+ */
5356
+ lockfileImporters?: readonly string[];
5202
5357
  tmpDir?: string;
5203
5358
  }
5204
5359
  interface VerificationEnv {
@@ -5213,9 +5368,7 @@ interface VerificationRunContext {
5213
5368
  buildEnv: () => VerificationEnv;
5214
5369
  runSummaryLines: () => string[];
5215
5370
  }
5216
- declare function createVerificationRunContext(input: VerificationRunContextInput): VerificationRunContext;
5217
- //#endregion
5218
- //#region src/verification-battery.d.ts
5371
+ export declare function createVerificationRunContext(input: VerificationRunContextInput): VerificationRunContext;
5219
5372
  type BatteryDisposition = "executed" | "not-required";
5220
5373
  /**
5221
5374
  * The structural subset of a profile verification command this planner reads.
@@ -5266,11 +5419,7 @@ interface VerificationBatteryPlan<Command> {
5266
5419
  * candidate's own identity triple; anywhere else it is `trustedImpactStamp`'s
5267
5420
  * output or `undefined`.
5268
5421
  */
5269
- declare const planVerificationBattery: <Command extends BatteryCandidateCommand>({
5270
- commands,
5271
- stamp,
5272
- vetoedTargets
5273
- }: {
5422
+ export declare const planVerificationBattery: <Command extends BatteryCandidateCommand>({ commands, stamp, vetoedTargets }: {
5274
5423
  commands: readonly Command[];
5275
5424
  stamp: ImpactStamp | undefined;
5276
5425
  /**
@@ -5290,28 +5439,20 @@ declare const planVerificationBattery: <Command extends BatteryCandidateCommand>
5290
5439
  vetoedTargets: readonly string[];
5291
5440
  }) => VerificationBatteryPlan<Command>;
5292
5441
  /** Console lines naming every withheld command and why. Never silent. */
5293
- declare const batteryScopeSummaryLines: (plan: VerificationBatteryPlan<BatteryCandidateCommand>) => string[];
5294
- //#endregion
5295
- //#region src/worker-checkout-guard.d.ts
5442
+ export declare const batteryScopeSummaryLines: (plan: VerificationBatteryPlan<BatteryCandidateCommand>) => string[];
5296
5443
  type CheckoutDirsProbe = (cwd: string) => {
5297
5444
  gitCommonDir: string;
5298
5445
  gitDir: string;
5299
5446
  };
5300
- declare class WorkerCheckoutGuardError extends Error {
5447
+ export declare class WorkerCheckoutGuardError extends Error {
5301
5448
  constructor(message: string);
5302
5449
  }
5303
- declare function assertWorkerCheckoutAllowed({
5304
- cwd,
5305
- operation,
5306
- probe
5307
- }: {
5450
+ export declare function assertWorkerCheckoutAllowed({ cwd, operation, probe }: {
5308
5451
  cwd: string;
5309
5452
  operation: string;
5310
5453
  probe?: CheckoutDirsProbe;
5311
5454
  }): void;
5312
- //#endregion
5313
- //#region src/index.d.ts
5314
- interface CreateProgramOptions {
5455
+ export interface CreateProgramOptions {
5315
5456
  actions?: {
5316
5457
  boundaryCheck?: BoundaryCheckAction;
5317
5458
  demandWaive?: DemandWaiveAction;
@@ -5323,7 +5464,7 @@ interface CreateProgramOptions {
5323
5464
  factoryCliInvocation?: FactoryCliInvocation;
5324
5465
  output?: CliOutput;
5325
5466
  }
5326
- declare function createProgram(options?: CreateProgramOptions): Command;
5467
+ export declare function createProgram(options?: CreateProgramOptions): Command;
5327
5468
  /**
5328
5469
  * Parse `argv` and run the matching command. `cliEntry` is the path of the
5329
5470
  * runnable bin module, which follow-up commands spawn; the bin entry passes its
@@ -5336,6 +5477,5 @@ declare function createProgram(options?: CreateProgramOptions): Command;
5336
5477
  * exit. `pr:ready` then prints one line if events are still spooled (#1317).
5337
5478
  * None of these steps can throw or change the command's exit code.
5338
5479
  */
5339
- declare function run(argv?: string[], cliEntry?: string): Promise<void>;
5340
- //#endregion
5341
- 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 };
5480
+ export declare function run(argv?: string[], cliEntry?: string): Promise<void>;
5481
+ export { type AppendFactoryTraceEventResult, type AssembledReviewPrompt, type BatteryCommandDisposition, type BatteryDisposition, type BoundaryCheckArgs, type BoundaryCheckDependencies, type BoundaryCheckProofRecord, type BuildEpicStructureEventInput, type CloudflareAccessServiceToken, type CompletedFactoryCheckSnapshot, type DagDocument, type DemandWaiveArgs, type DemandWaiveDependencies, type DemandWaiver, type DemandWaiverStore, type EpicStructureEvent, type EpicStructureGraphPayload, type EpicStructureNodeStatus, type EvidenceEmitArgs, type EvidenceEmitDependencies, type EvidenceEmitResult, type FactoryCliInvocation, type FactoryPrStatusCheckName, type FactoryPrStatusSources, type FactoryProjectProfile, type FactoryTraceDiagnostic, type FactoryTraceEnvelope, type FactoryTraceEvent, type FollowUpAction, type GitHubCheckRunMergeFreezeApi, type ImpactScopeDecision, type ImpactScopeSurface, type IssueReviewFocus, type MergeFreezeAuthority, type MergeFreezeGeneration, type MergeFreezeState, type MergeFreezeStoreInput, type PlanFactoryPrStatusHudInput, type PrPublishArgs, type PrPublishDependencies, 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, 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, boundary_manifest_d_exports as boundaryManifest, boundary_review_proof_d_exports as boundaryReviewProof, comment_provenance_d_exports as commentProvenance, 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, worktree_scratch_files_d_exports as worktreeScratchFiles };