@patronage/software-factory 1.0.0-alpha.22 → 1.0.0-alpha.23

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
@@ -472,159 +472,448 @@ declare function sweepHqSpoolOrphans(input: {
472
472
  env?: NodeJS.ProcessEnv;
473
473
  }): Promise<HqSpoolOrphanSweep>;
474
474
  //#endregion
475
- //#region src/demand-waiver.d.ts
476
- declare const DEFAULT_DEMAND_WAIVER_PATH = ".factory-memory/demand-waivers.json";
477
- /** One recorded operator act: this demand, on this candidate, waived. */
478
- interface DemandWaiver {
479
- candidate: {
480
- headSha: string;
481
- pr: number;
475
+ //#region src/packages/review-prompt-sections/schema.d.ts
476
+ declare const reviewPromptSectionSchema: z.ZodObject<{
477
+ provenance: z.ZodEnum<{
478
+ "prior-review-ledger": "prior-review-ledger";
479
+ "issue-review-focus": "issue-review-focus";
480
+ }>;
481
+ source: z.ZodString;
482
+ text: z.ZodString;
483
+ }, z.core.$strict>;
484
+ type ReviewPromptSection = z.infer<typeof reviewPromptSectionSchema>;
485
+ type ReviewPromptSectionProvenance = ReviewPromptSection["provenance"];
486
+ declare const reviewPromptSectionsSchema: z.ZodArray<z.ZodObject<{
487
+ provenance: z.ZodEnum<{
488
+ "prior-review-ledger": "prior-review-ledger";
489
+ "issue-review-focus": "issue-review-focus";
490
+ }>;
491
+ source: z.ZodString;
492
+ text: z.ZodString;
493
+ }, z.core.$strict>>;
494
+ //#endregion
495
+ //#region src/review-ladder-policy.d.ts
496
+ type ReviewFindingSeverity = "critical" | "high" | "medium" | "low" | "unknown";
497
+ type ReviewFindingCategory = "correctness" | "safety" | "coordination" | "maintainability" | "unknown";
498
+ declare const REVIEW_SEVERITIES: readonly ["critical", "high", "medium", "low", "unknown"];
499
+ declare const resolveReviewFindingSeverity: (priority?: string) => ReviewFindingSeverity;
500
+ declare const resolveReviewFindingCategory: (category?: string) => ReviewFindingCategory;
501
+ declare const FINDING_DISPOSITIONS: readonly ["open", "fixed-in-thread", "follow-up-filed", "waived", "stale-repeat", "rerun-noise"];
502
+ type FindingDisposition = (typeof FINDING_DISPOSITIONS)[number];
503
+ interface ReviewFindingAttributes {
504
+ blockingAfterCap?: boolean;
505
+ category?: string;
506
+ citedSpan?: string;
507
+ file?: string;
508
+ prescribedAction?: string;
509
+ priority?: string;
510
+ supersedes?: {
511
+ file?: string;
512
+ title: string;
482
513
  };
483
- demand: string;
484
- /** The authenticated GitHub account that recorded the waiver. */
485
- operator: string;
486
- rationale: string;
487
- recordedAt: string;
488
- /** Optional audit metadata; never waiver authority. */
489
- session?: string;
514
+ title: string;
490
515
  }
491
- interface DemandWaiverStore {
492
- command: "patronage-factory demand:waive";
493
- schemaVersion: 1;
494
- waivers: DemandWaiver[];
516
+ type BlockingResolvableFinding = Pick<ReviewFindingAttributes, "blockingAfterCap" | "category" | "priority">;
517
+ declare const resolveFindingBlocking: (finding: BlockingResolvableFinding, disposition?: FindingDisposition) => boolean;
518
+ interface ReviewLadderPolicy {
519
+ gate: {
520
+ cap: number;
521
+ };
522
+ interior: {
523
+ cap: number;
524
+ };
495
525
  }
496
- declare const validateDemandWaiverStore: (value: unknown) => DemandWaiverStore;
497
- /**
498
- * A demand that was in force, was NOT met, and was waived by the operator.
499
- *
500
- * `unmetReasons` is required and non-empty: every reason the demand refused is
501
- * carried through verbatim. There is no field on this record that could say
502
- * "satisfied", and no code path constructs one without a refusal to carry.
503
- */
504
- interface WaivedDemand {
505
- demand: string;
506
- operator: string;
507
- rationale: string;
508
- recordedAt: string;
509
- session?: string;
510
- /** The demand's refusals at evaluation time, preserved verbatim. */
511
- unmetReasons: string[];
526
+ declare const resolveReviewLadderPolicy: () => ReviewLadderPolicy;
527
+ //#endregion
528
+ //#region src/review-ladder-ledger.d.ts
529
+ type LadderCycleStage = "interior" | "gate";
530
+ interface LadderCycleRef {
531
+ cycle: number;
532
+ stage: LadderCycleStage;
512
533
  }
513
- declare const waivedDemandSchema: z.ZodType<WaivedDemand>;
514
- /** The waivers that bind one candidate: same PR, same head. */
515
- declare const selectWaiversForCandidate: ({
516
- headSha,
517
- pr,
518
- waivers
519
- }: {
520
- headSha: string | undefined;
521
- pr: number;
522
- waivers: readonly DemandWaiver[];
523
- }) => DemandWaiver[];
524
- interface DemandOutcome {
525
- blockingReasons: string[];
526
- waived?: WaivedDemand;
534
+ type LadderFindingReport = ReviewFindingAttributes;
535
+ type DeclarableFindingDisposition = Exclude<FindingDisposition, "open" | "stale-repeat" | "rerun-noise">;
536
+ interface LadderDispositionDeclaration {
537
+ disposition: DeclarableFindingDisposition;
538
+ finding: {
539
+ file?: string;
540
+ title: string;
541
+ };
542
+ findingReport?: LadderFindingReport;
543
+ reference?: string;
527
544
  }
528
- /**
529
- * Fold one resolved demand's refusals through the operator's waivers.
530
- *
531
- * A satisfied demand (no refusals) stays satisfied and the waiver stays inert
532
- * — a waiver can only ever move a demand from *unmet-and-blocking* to
533
- * *unmet-and-waived*, never to met.
534
- */
535
- declare const applyDemandWaiver: ({
536
- demand,
537
- reasons,
538
- waivers
539
- }: {
540
- demand: string;
541
- reasons: readonly string[];
542
- waivers: readonly DemandWaiver[];
543
- }) => DemandOutcome;
544
- /** How a waived demand reads to a human. Never the word "satisfied". */
545
- declare const waivedDemandNotice: (waived: WaivedDemand) => string;
546
- interface DemandWaiverAuthorization {
547
- operator: string;
548
- session?: string;
545
+ interface FindingLedgerEntry extends ReviewFindingAttributes {
546
+ disposition: FindingDisposition;
547
+ firstFlagged: LadderCycleRef;
548
+ flagCount: number;
549
+ key: string;
550
+ lastFlagged: LadderCycleRef;
551
+ priorDisposition?: FindingDisposition;
552
+ reference?: string;
553
+ reopenedCount: number;
554
+ staleRepeatCount: number;
549
555
  }
550
- type AuthorizeDemandWaiverResult = {
551
- authorization: DemandWaiverAuthorization;
552
- refusals?: undefined;
553
- } | {
554
- authorization?: undefined;
555
- refusals: string[];
556
- };
557
- /**
558
- * Operator identity, `declaredBy`-style: a named human account, recorded on
559
- * the waiver and enforced here. Session is optional audit metadata only: it is
560
- * not credential-backed, so its absence or equality never authorizes or
561
- * refuses an operator act.
562
- */
563
- declare const authorizeDemandWaiver: ({
564
- authenticatedLogin,
565
- session
566
- }: {
567
- authenticatedLogin: string | undefined;
568
- session: string | undefined;
569
- }) => AuthorizeDemandWaiverResult;
570
- //#endregion
571
- //#region src/blocked-reasons.d.ts
572
- declare const blockedReasonSchema: z.ZodObject<{
573
- code: z.ZodString;
574
- detail: z.ZodString;
575
- }, z.core.$strip>;
576
- type BlockedReason = z.infer<typeof blockedReasonSchema>;
556
+ declare const findingKey: (finding: {
557
+ citedSpan?: string;
558
+ file?: string;
559
+ prescribedAction?: string;
560
+ title?: string;
561
+ }) => string;
562
+ declare const openLadderFindings: (ledger: FindingLedgerEntry[]) => FindingLedgerEntry[];
563
+ declare const blockingLadderFindings: (ledger: FindingLedgerEntry[]) => FindingLedgerEntry[];
564
+ declare const staleRepeatLadderFindings: (ledger: FindingLedgerEntry[]) => FindingLedgerEntry[];
565
+ declare const inferFixedInThreadDispositions: (ledger: FindingLedgerEntry[], findings: readonly LadderFindingReport[], options?: {
566
+ sameHeadAsPriorCycle?: boolean;
567
+ }) => LadderDispositionDeclaration[];
577
568
  //#endregion
578
- //#region src/arm-auto-merge.d.ts
579
- interface ArmAutoMergeInput {
580
- cwd: string;
581
- /** The validated PR head this arming is a compare-and-set against. */
582
- headSha: string;
583
- owner: string;
584
- pr: number;
585
- repo: string;
586
- }
587
- /**
588
- * What the PR actually did, read back after the call — never inferred from the
589
- * exit code. `not-armed` is a failure: the candidate is admitted but nothing
590
- * will merge it, so it carries the detail and `pr:ready` emits a re-dispatch.
591
- */
592
- interface ArmAutoMergeOutcome {
593
- /** Why the arming did not take effect, or what the invocation reported. */
594
- detail?: string;
595
- headSha: string;
596
- outcome: "armed" | "merged" | "not-armed";
569
+ //#region src/review-ladder.d.ts
570
+ type ReviewLadderExecutedStage = "interior" | "gate";
571
+ interface LadderSessionAttribution {
572
+ orchestrationMode?: "autonomous" | "manual";
573
+ resumedSession?: boolean;
574
+ runtime?: string;
575
+ sessionId?: string;
597
576
  }
598
- //#endregion
599
- //#region src/checkout-repository.d.ts
600
- interface CheckoutRepository {
601
- name: string;
602
- owner: string;
577
+ interface LadderUsageReport {
578
+ estimatedCostUsd?: number;
579
+ source?: string;
580
+ totalTokens?: number;
603
581
  }
604
- //#endregion
605
- //#region src/follow-up.d.ts
606
- interface FactoryCliInvocation {
607
- /** Runtime arguments ending with the factory CLI entry module. */
608
- argvPrefix: string[];
609
- executable: string;
582
+ interface ReviewLadderCycle {
583
+ dispositions?: LadderDispositionDeclaration[];
584
+ engine?: string;
585
+ findings: LadderFindingReport[];
586
+ identity?: {
587
+ headSha: string;
588
+ patchId: string;
589
+ };
590
+ model?: string;
591
+ correlatedRerun?: boolean;
592
+ session?: LadderSessionAttribution;
593
+ stage: LadderCycleStage;
594
+ usage?: LadderUsageReport;
610
595
  }
611
- declare const FactoryCliInvocationSchema: z.ZodType<FactoryCliInvocation>;
612
- interface FollowUpAction {
613
- /**
614
- * Machine-safe argv-style array for the obvious next action, e.g.
615
- * ["gh","pr","merge","513","--squash"]. Same shape and field name that
616
- * `factory:delegate --print` emits, so an orchestrating agent can spawn the
617
- * next command without reconstructing a shell string. argv[0] is the
618
- * executable; the rest are literal, already-split arguments.
619
- */
620
- argv: string[];
621
- /**
622
- * Human-readable rendering of {@link argv} for logs and operators. Additive
623
- * to argv, never a substitute for it — argv is the source of truth.
624
- */
625
- command: string;
596
+ interface LadderInteriorCapTransition {
597
+ cap: number;
598
+ kind: "interior-cap-reached";
626
599
  }
627
- /**
600
+ interface LadderGateCapTransition {
601
+ blockingFindings: string[];
602
+ cap: number;
603
+ kind: "gate-cap-exhausted";
604
+ }
605
+ type LadderForcedTransition = LadderGateCapTransition | LadderInteriorCapTransition;
606
+ interface LadderRunInteriorCycleAction {
607
+ cycle: number;
608
+ kind: "run-interior-cycle";
609
+ }
610
+ type LadderGateNextAction = {
611
+ cycle: number;
612
+ kind: "run-gate-cycle";
613
+ } | {
614
+ kind: "accept-nonblocking-findings";
615
+ } | {
616
+ kind: "escalate-to-triage";
617
+ } | {
618
+ kind: "ready-for-human";
619
+ };
620
+ type LadderPosition = {
621
+ forcedTransition?: LadderGateCapTransition;
622
+ nextAction: LadderGateNextAction;
623
+ stage: "gate";
624
+ } | {
625
+ forcedTransition?: LadderInteriorCapTransition;
626
+ nextAction: {
627
+ kind: "advance-to-gate";
628
+ };
629
+ stage: "interior-complete";
630
+ } | {
631
+ forcedTransition?: never;
632
+ nextAction: LadderRunInteriorCycleAction;
633
+ stage: "interior";
634
+ };
635
+ type LadderNextAction = LadderPosition["nextAction"];
636
+ type ReviewLadderStage = LadderPosition["stage"];
637
+ interface ReviewLadderStageEvent {
638
+ cycle: number;
639
+ cyclesToClean?: number;
640
+ engine?: string;
641
+ findingsSummary: {
642
+ blocking: number;
643
+ bySeverity: Record<ReviewFindingSeverity, number>;
644
+ flagged: number;
645
+ open: number;
646
+ staleRepeats: number;
647
+ };
648
+ forcedTransition?: LadderForcedTransition["kind"];
649
+ model?: string;
650
+ payloadVersion: 1;
651
+ session?: LadderSessionAttribution;
652
+ stage: ReviewLadderExecutedStage;
653
+ type: "review-ladder-stage";
654
+ usage?: LadderUsageReport;
655
+ }
656
+ interface LadderDiagnostic {
657
+ code: "interior-cycles-unrecorded";
658
+ message: string;
659
+ }
660
+ type ReviewLadderEvaluation = LadderPosition & {
661
+ cycleCounts: {
662
+ gate: number;
663
+ interior: number;
664
+ };
665
+ diagnostics: LadderDiagnostic[];
666
+ event?: ReviewLadderStageEvent;
667
+ ledger: FindingLedgerEntry[];
668
+ unmatchedDispositions: LadderDispositionDeclaration[];
669
+ };
670
+ interface EvaluateReviewLadderInput {
671
+ cycles: ReviewLadderCycle[];
672
+ policy: ReviewLadderPolicy;
673
+ }
674
+ declare const evaluateReviewLadder: ({
675
+ cycles,
676
+ policy
677
+ }: EvaluateReviewLadderInput) => ReviewLadderEvaluation;
678
+ //#endregion
679
+ //#region src/pr-readiness/ladder-proof-state.d.ts
680
+ interface PrReviewLadderState {
681
+ cycles: ReviewLadderCycle[];
682
+ }
683
+ interface OpenCycleState {
684
+ autoBlockingFindings: number;
685
+ blockingEntries: ReviewFindingAttributes[];
686
+ openEntries: ReviewFindingAttributes[];
687
+ staleRepeatFindings?: number;
688
+ }
689
+ interface ReviewLadderSummaryState {
690
+ cycleCounts: {
691
+ gate: number;
692
+ interior: number;
693
+ };
694
+ forcedTransition?: LadderForcedTransition["kind"];
695
+ nextAction: LadderNextAction["kind"];
696
+ stage: ReviewLadderStage;
697
+ }
698
+ interface ReviewLadderSnapshot {
699
+ cycleState: OpenCycleState;
700
+ evaluation: ReviewLadderEvaluation;
701
+ ledger: FindingLedgerEntry[];
702
+ policyGateCap: number;
703
+ summary: ReviewLadderSummaryState;
704
+ }
705
+ type ReviewEpochMode = {
706
+ kind: "ladder";
707
+ ladder: PrReviewLadderState;
708
+ snapshot?: ReviewLadderSnapshot;
709
+ } | {
710
+ kind: "declared-window";
711
+ };
712
+ //#endregion
713
+ //#region src/pr-readiness/review-proof-types.d.ts
714
+ type PrReviewKind = "correctness" | "security";
715
+ type PrReviewMode = PrReviewKind | "all";
716
+ type PrReviewOutcome = "passed" | "failed" | "error";
717
+ interface PrReviewStageResolution {
718
+ model: string;
719
+ sessionId: string;
720
+ }
721
+ //#endregion
722
+ //#region src/pr-readiness/review-proof-shape.d.ts
723
+ interface PrReviewFinding extends ReviewFindingAttributes {
724
+ body: string;
725
+ category?: ReviewFindingCategory;
726
+ line?: number;
727
+ protocolFinding?: true;
728
+ }
729
+ interface PrReviewResult {
730
+ kind: PrReviewKind;
731
+ startedAt: string;
732
+ endedAt: string;
733
+ durationMs: number;
734
+ model?: string;
735
+ producer?: string;
736
+ rung?: EvidenceReviewRung;
737
+ sessionId?: string;
738
+ outcome: PrReviewOutcome;
739
+ issuesFlagged: number;
740
+ summary: string;
741
+ findings: PrReviewFinding[];
742
+ typedVerdict?: boolean;
743
+ verdictSource?: "footer" | "recovered";
744
+ promptSections?: ReviewPromptSection[];
745
+ }
746
+ interface PrReviewProof {
747
+ schemaVersion: 2;
748
+ findingProvenanceVersion: 1;
749
+ base: string;
750
+ headSha: string;
751
+ patchId: string;
752
+ reviewCycle?: number;
753
+ maxReviewCycles?: number;
754
+ changedFiles: string[];
755
+ cleanedPaths: string[];
756
+ ladder?: PrReviewLadderState;
757
+ reviewRequirement?: {
758
+ reason: "no-applicable-mode" | "faithful-merge";
759
+ status: "not-required";
760
+ };
761
+ reviews: PrReviewResult[];
762
+ }
763
+ //#endregion
764
+ //#region src/demand-waiver.d.ts
765
+ declare const DEFAULT_DEMAND_WAIVER_PATH = ".factory-memory/demand-waivers.json";
766
+ /** One recorded operator act: this demand, on this candidate, waived. */
767
+ interface DemandWaiver {
768
+ candidate: {
769
+ headSha: string;
770
+ pr: number;
771
+ };
772
+ demand: string;
773
+ /** The authenticated GitHub account that recorded the waiver. */
774
+ operator: string;
775
+ rationale: string;
776
+ recordedAt: string;
777
+ /** Optional audit metadata; never waiver authority. */
778
+ session?: string;
779
+ }
780
+ interface DemandWaiverStore {
781
+ command: "patronage-factory demand:waive";
782
+ schemaVersion: 1;
783
+ waivers: DemandWaiver[];
784
+ }
785
+ declare const validateDemandWaiverStore: (value: unknown) => DemandWaiverStore;
786
+ /**
787
+ * A demand that was in force, was NOT met, and was waived by the operator.
788
+ *
789
+ * `unmetReasons` is required and non-empty: every reason the demand refused is
790
+ * carried through verbatim. There is no field on this record that could say
791
+ * "satisfied", and no code path constructs one without a refusal to carry.
792
+ */
793
+ interface WaivedDemand {
794
+ demand: string;
795
+ operator: string;
796
+ rationale: string;
797
+ recordedAt: string;
798
+ session?: string;
799
+ /** The demand's refusals at evaluation time, preserved verbatim. */
800
+ unmetReasons: string[];
801
+ }
802
+ declare const waivedDemandSchema: z.ZodType<WaivedDemand>;
803
+ /** The waivers that bind one candidate: same PR, same head. */
804
+ declare const selectWaiversForCandidate: ({
805
+ headSha,
806
+ pr,
807
+ waivers
808
+ }: {
809
+ headSha: string | undefined;
810
+ pr: number;
811
+ waivers: readonly DemandWaiver[];
812
+ }) => DemandWaiver[];
813
+ interface DemandOutcome {
814
+ blockingReasons: string[];
815
+ waived?: WaivedDemand;
816
+ }
817
+ /**
818
+ * Fold one resolved demand's refusals through the operator's waivers.
819
+ *
820
+ * A satisfied demand (no refusals) stays satisfied and the waiver stays inert
821
+ * — a waiver can only ever move a demand from *unmet-and-blocking* to
822
+ * *unmet-and-waived*, never to met.
823
+ */
824
+ declare const applyDemandWaiver: ({
825
+ demand,
826
+ reasons,
827
+ waivers
828
+ }: {
829
+ demand: string;
830
+ reasons: readonly string[];
831
+ waivers: readonly DemandWaiver[];
832
+ }) => DemandOutcome;
833
+ /** How a waived demand reads to a human. Never the word "satisfied". */
834
+ declare const waivedDemandNotice: (waived: WaivedDemand) => string;
835
+ interface DemandWaiverAuthorization {
836
+ operator: string;
837
+ session?: string;
838
+ }
839
+ type AuthorizeDemandWaiverResult = {
840
+ authorization: DemandWaiverAuthorization;
841
+ refusals?: undefined;
842
+ } | {
843
+ authorization?: undefined;
844
+ refusals: string[];
845
+ };
846
+ /**
847
+ * Operator identity, `declaredBy`-style: a named human account, recorded on
848
+ * the waiver and enforced here. Session is optional audit metadata only: it is
849
+ * not credential-backed, so its absence or equality never authorizes or
850
+ * refuses an operator act.
851
+ */
852
+ declare const authorizeDemandWaiver: ({
853
+ authenticatedLogin,
854
+ session
855
+ }: {
856
+ authenticatedLogin: string | undefined;
857
+ session: string | undefined;
858
+ }) => AuthorizeDemandWaiverResult;
859
+ //#endregion
860
+ //#region src/blocked-reasons.d.ts
861
+ declare const blockedReasonSchema: z.ZodObject<{
862
+ code: z.ZodString;
863
+ detail: z.ZodString;
864
+ }, z.core.$strip>;
865
+ type BlockedReason = z.infer<typeof blockedReasonSchema>;
866
+ //#endregion
867
+ //#region src/arm-auto-merge.d.ts
868
+ interface ArmAutoMergeInput {
869
+ cwd: string;
870
+ /** The validated PR head this arming is a compare-and-set against. */
871
+ headSha: string;
872
+ owner: string;
873
+ pr: number;
874
+ repo: string;
875
+ }
876
+ /**
877
+ * What the PR actually did, read back after the call — never inferred from the
878
+ * exit code. `not-armed` is a failure: the candidate is admitted but nothing
879
+ * will merge it, so it carries the detail and `pr:ready` emits a re-dispatch.
880
+ */
881
+ interface ArmAutoMergeOutcome {
882
+ /** Why the arming did not take effect, or what the invocation reported. */
883
+ detail?: string;
884
+ headSha: string;
885
+ outcome: "armed" | "merged" | "not-armed";
886
+ }
887
+ //#endregion
888
+ //#region src/checkout-repository.d.ts
889
+ interface CheckoutRepository {
890
+ name: string;
891
+ owner: string;
892
+ }
893
+ //#endregion
894
+ //#region src/follow-up.d.ts
895
+ interface FactoryCliInvocation {
896
+ /** Runtime arguments ending with the factory CLI entry module. */
897
+ argvPrefix: string[];
898
+ executable: string;
899
+ }
900
+ declare const FactoryCliInvocationSchema: z.ZodType<FactoryCliInvocation>;
901
+ interface FollowUpAction {
902
+ /**
903
+ * Machine-safe argv-style array for the obvious next action, e.g.
904
+ * ["gh","pr","merge","513","--squash"]. Same shape and field name that
905
+ * `factory:delegate --print` emits, so an orchestrating agent can spawn the
906
+ * next command without reconstructing a shell string. argv[0] is the
907
+ * executable; the rest are literal, already-split arguments.
908
+ */
909
+ argv: string[];
910
+ /**
911
+ * Human-readable rendering of {@link argv} for logs and operators. Additive
912
+ * to argv, never a substitute for it — argv is the source of truth.
913
+ */
914
+ command: string;
915
+ }
916
+ /**
628
917
  * Build a {@link FollowUpAction} from a literal argv array. The `command`
629
918
  * string is derived from argv so the two never drift.
630
919
  */
@@ -650,7 +939,7 @@ declare const impactStampSchema: z.ZodObject<{
650
939
  }>;
651
940
  inertPaths: z.ZodDefault<z.ZodArray<z.ZodString>>;
652
941
  reasons: z.ZodArray<z.ZodString>;
653
- stampVersion: z.ZodLiteral<3>;
942
+ stampVersion: z.ZodLiteral<4>;
654
943
  targets: z.ZodArray<z.ZodObject<{
655
944
  basis: z.ZodString;
656
945
  impact: z.ZodEnum<{
@@ -658,6 +947,7 @@ declare const impactStampSchema: z.ZodObject<{
658
947
  "not-affected": "not-affected";
659
948
  }>;
660
949
  name: z.ZodString;
950
+ subscribedPaths: z.ZodArray<z.ZodString>;
661
951
  }, z.core.$strip>>;
662
952
  unsubscribedPaths: z.ZodArray<z.ZodString>;
663
953
  }, z.core.$strip>;
@@ -758,541 +1048,296 @@ declare const factoryProjectProfileSchema: z.ZodObject<{
758
1048
  name: z.ZodString;
759
1049
  requiredCheck: z.ZodOptional<z.ZodString>;
760
1050
  scope: z.ZodDefault<z.ZodEnum<{
761
- trivial: "trivial";
762
- "docs-only": "docs-only";
763
- full: "full";
764
- }>>;
765
- }, z.core.$strip>>;
766
- }, z.core.$strip>;
767
- }, z.core.$strict>;
768
- type FactoryProjectProfile = z.infer<typeof factoryProjectProfileSchema>;
769
- declare const resolveFactoryRepository: (profile?: Pick<FactoryProjectProfile, "repository"> | undefined) => string;
770
- interface LoadProjectProfileInput {
771
- cwd?: string;
772
- profilePath?: string;
773
- }
774
- interface LoadProjectProfileResult {
775
- path: string;
776
- profile: FactoryProjectProfile;
777
- }
778
- declare function loadProjectProfile(input?: LoadProjectProfileInput): LoadProjectProfileResult;
779
- //#endregion
780
- //#region src/pr-verify-mode.d.ts
781
- /**
782
- * The verification mode `pr:verify` resolved for a run.
783
- *
784
- * Canonically declared here rather than inside `pr-readiness/` so that modules
785
- * on either side of that boundary — the readiness proof shape and the durable
786
- * check-run payload — can name the same union without importing each other.
787
- */
788
- type ResolvedPrVerifyMode = "docs-only" | "trivial" | "full";
789
- //#endregion
790
- //#region src/pr-verify-status.d.ts
791
- type CommitStatusState = "failure" | "pending" | "success";
792
- interface PostCommitStatusInput {
793
- context?: string;
794
- cwd: string;
795
- description: string;
796
- owner: string;
797
- repo: string;
798
- sha: string;
799
- state: CommitStatusState;
800
- /**
801
- * Drop this mirror's own failure diagnostic because the caller has already
802
- * reported the same cause. Set only on the pre-push path, where the status
803
- * POST 422s for exactly the reason the pre-push notice gives and a trailing
804
- * "unable to post ... status" line would put back the false-defect reading
805
- * that notice exists to remove (#316).
806
- *
807
- * Deliberately a field on the request rather than a second, quieter poster:
808
- * an injected `PostCommitStatus` double sees the flag, so the branch is
809
- * assertable instead of collapsing to the same closure under test.
810
- */
811
- suppressFailureDiagnostic?: boolean;
812
- targetUrl: string;
813
- }
814
- type PostCommitStatus = (input: PostCommitStatusInput) => void;
815
- //#endregion
816
- //#region src/user-config.d.ts
817
- declare const githubAppConfigSchema: z.ZodObject<{
818
- appId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
819
- installationId: z.ZodOptional<z.ZodNumber>;
820
- privateKeyPath: z.ZodString;
821
- }, z.core.$strip>;
822
- type GithubAppConfig = z.infer<typeof githubAppConfigSchema>;
823
- declare const factoryUserConfigSchema: z.ZodObject<{
824
- githubApp: z.ZodOptional<z.ZodObject<{
825
- appId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
826
- installationId: z.ZodOptional<z.ZodNumber>;
827
- privateKeyPath: z.ZodString;
828
- }, z.core.$strip>>;
829
- hqAllowedOrigins: z.ZodOptional<z.ZodArray<z.ZodString>>;
830
- hqIngestCredentials: z.ZodOptional<z.ZodObject<{
831
- clientIdRef: z.ZodString;
832
- clientSecretRef: z.ZodString;
833
- }, z.core.$strip>>;
834
- schemaVersion: z.ZodLiteral<2>;
835
- }, z.core.$strip>;
836
- type FactoryUserConfig = z.infer<typeof factoryUserConfigSchema>;
837
- interface LoadUserConfigResult {
838
- path: string;
839
- config: FactoryUserConfig;
840
- ignoredKeys?: string[];
841
- }
842
- //#endregion
843
- //#region src/github-check-runs.d.ts
844
- declare const FACTORY_CHECK_NAMES: {
845
- readonly "pr-ready": "patronage-factory/pr-ready";
846
- readonly "pr-verify": "patronage-factory/pr-verify";
847
- };
848
- type FactoryCheckGate = keyof typeof FACTORY_CHECK_NAMES;
849
- interface PublishFactoryCheckInput {
850
- conclusion?: "failure" | "success";
851
- cwd: string;
852
- gate: FactoryCheckGate;
853
- /**
854
- * HQ lane-permalink base (`<origin>/lanes/by-ref`). When present, the check
855
- * run's Details link deep-links to the HQ lane page instead of the PR-ledger
856
- * fallback. Derive it from the repository profile via
857
- * `hqLaneRefBaseUrlFromProfile` — the same source as the HQ gate sink.
858
- */
859
- hqLaneBaseUrl?: string;
860
- owner: string;
861
- pr?: number;
862
- proof: unknown;
863
- repo: string;
864
- sha: string;
865
- status?: "completed" | "in_progress";
866
- }
867
- interface CheckRunDependencies {
868
- fetch?: typeof fetch;
869
- githubApp?: GithubAppConfig;
870
- now?: () => number;
871
- postCommitStatus?: PostCommitStatus;
872
- resolveDetailsUrl?: (input: PublishFactoryCheckInput) => Promise<string> | string;
873
- /**
874
- * Bounded retry for the check-run POST. GitHub answers 422 for a head SHA it
875
- * has not seen yet, which is the normal state when `pr:verify` runs before
876
- * the branch is pushed, and is also briefly true right after a push.
877
- */
878
- retry?: {
879
- attempts: number;
880
- budgetMs?: number;
881
- delayMs: number;
882
- };
883
- /** Injectable delay for the bounded retry (tests only). */
884
- sleep?: (ms: number) => Promise<void>;
885
- /** Overrides GITHUB_PUBLISH_TIMEOUT_MS for the App fetch calls (tests only). */
886
- timeoutMs?: number;
887
- }
888
- /**
889
- * Publish a factory check run and *wait* for it, so a caller that has just made
890
- * the head SHA visible on GitHub (pushed the branch, created the PR) can make
891
- * the proof reliably present for that SHA before it returns (#247).
892
- *
893
- * Never throws and never posts a commit-status fallback: the commit status is a
894
- * human-readable mirror, not a proof surface, so a caller that needs an
895
- * App-verified check run must be told plainly whether it got one. Returns
896
- * `true` only when the App-owned check run landed.
897
- *
898
- * "Landed" means GitHub serves it, not that the POST was accepted (#520). On
899
- * PR #519 the POST was accepted, `pr:ready` reported ready and armed, and the
900
- * source-pinned required check read `in_progress` across three runs — so GitHub
901
- * never scheduled the merge and emitted no rollup row saying why. Arming
902
- * already refuses to infer its outcome from the invocation and reads the pull
903
- * request back (`arm-auto-merge.ts`); publication now does the same.
904
- *
905
- * "Landed" is judged against every run of the name from the pinned App, not
906
- * against the one GitHub collapses to (#524): the newest must be *this* run, in
907
- * the status and conclusion that were published, and no run of the name may
908
- * still be unfinished. A surviving `in_progress` run blocks the required check
909
- * on its own, so confirming past it would report success on a pull request
910
- * GitHub will never merge. One read, no polling: an unconfirmed publication
911
- * returns `false`, which `pr:ready` already turns into a notice and an
912
- * idempotent re-dispatch.
913
- *
914
- * Confirmation is a point-in-time read, deliberately: a later publication for
915
- * the same name changes the answer — a completed one by becoming the newest, an
916
- * unfinished one by holding the check open beside this verdict rather than
917
- * replacing it — and every remaining writer publishes once, as the last thing
918
- * its invocation does. No retry, no poll, no re-confirm.
919
- */
920
- declare function ensureFactoryCheckRunPublished(input: PublishFactoryCheckInput, dependencies?: CheckRunDependencies & {
921
- onDiagnostic?: (message: string) => void;
922
- }): Promise<boolean>;
923
- //#endregion
924
- //#region src/merge-freeze.d.ts
925
- declare const MERGE_FREEZE_CHECK_NAME = "patronage-factory/merge-freeze";
926
- declare const MERGE_FREEZE_APP_SLUG = "patronage-factory";
927
- declare const mergeFreezeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
928
- active: z.ZodLiteral<true>;
929
- generationId: z.ZodNumber;
930
- headSha: z.ZodString;
931
- outcome: z.ZodEnum<{
932
- active: "active";
933
- stale: "stale";
934
- }>;
935
- reason: z.ZodString;
936
- recordedAt: z.ZodISODateTime;
937
- schemaVersion: z.ZodLiteral<1>;
938
- }, z.core.$strip>, z.ZodObject<{
939
- active: z.ZodLiteral<false>;
940
- clearRationale: z.ZodOptional<z.ZodString>;
941
- generationId: z.ZodNumber;
942
- headSha: z.ZodString;
943
- outcome: z.ZodLiteral<"inactive">;
944
- reason: z.ZodString;
945
- recordedAt: z.ZodISODateTime;
946
- schemaVersion: z.ZodLiteral<1>;
947
- }, z.core.$strip>], "active">;
948
- type MergeFreezeState = z.infer<typeof mergeFreezeStateSchema>;
949
- /**
950
- * The write side of this contract lives in the generated merge-target push
951
- * Verify workflow (#356, ADR 0016 as amended; #429): it is the ONLY producer of
952
- * `patronage-factory/merge-freeze` generations. Its emitted `output.text`
953
- * payload must parse under this exact reader schema, which is what the
954
- * workflow's own tests assert through this export.
955
- */
956
- declare function validateMergeFreezeState(value: unknown): MergeFreezeState;
957
- interface MergeFreezeStoreInput {
958
- cwd: string;
959
- headSha: string;
960
- repository: CheckoutRepository;
961
- }
962
- interface MergeFreezeStore {
963
- read: (input: MergeFreezeStoreInput) => unknown;
964
- }
965
- /**
966
- * The freeze generation as a readiness decision needs to see it (#477).
967
- *
968
- * `read` above collapses three different situations into one refusal, because
969
- * merge time treated all of them as "do not merge". Readiness distinguishes
970
- * them: a settled generation is the writer's verdict, a **settling** one is the
971
- * window between a merge landing and its merge-target Verify completing (a
972
- * running generation, or a missing generation proven by the immediately prior
973
- * settled tip plus a current source-pinned verify run), and an **unreadable**
974
- * one is ambiguous, malformed, foreign-App, or unavailable state. Same
975
- * selection, same pinned App, same `started_at` ordering — only the reporting
976
- * is finer.
977
- */
978
- type MergeFreezeGeneration = {
979
- kind: "settled";
980
- state: MergeFreezeState;
981
- } | {
982
- kind: "settling";
983
- reason: string;
984
- running?: {
985
- headSha: string;
986
- id: number;
987
- };
988
- } | {
989
- kind: "unreadable";
990
- reason: string;
991
- };
992
- /** A merge-freeze reader that can also report the settle window (#477). */
993
- interface MergeFreezeAuthority extends MergeFreezeStore {
994
- readGeneration: (input: MergeFreezeStoreInput) => MergeFreezeGeneration;
995
- }
996
- //#endregion
997
- //#region src/pr-proof-io.d.ts
998
- interface ProofDescriptor<T> {
999
- label: string;
1000
- defaultPath: string;
1001
- schemaVersion: number;
1002
- parse: (raw: unknown) => T;
1003
- }
1004
- //#endregion
1005
- //#region src/packages/review-prompt-sections/schema.d.ts
1006
- declare const reviewPromptSectionSchema: z.ZodObject<{
1007
- provenance: z.ZodEnum<{
1008
- "prior-review-ledger": "prior-review-ledger";
1009
- "issue-review-focus": "issue-review-focus";
1010
- }>;
1011
- source: z.ZodString;
1012
- text: z.ZodString;
1051
+ trivial: "trivial";
1052
+ "docs-only": "docs-only";
1053
+ full: "full";
1054
+ }>>;
1055
+ }, z.core.$strip>>;
1056
+ }, z.core.$strip>;
1013
1057
  }, z.core.$strict>;
1014
- type ReviewPromptSection = z.infer<typeof reviewPromptSectionSchema>;
1015
- type ReviewPromptSectionProvenance = ReviewPromptSection["provenance"];
1016
- declare const reviewPromptSectionsSchema: z.ZodArray<z.ZodObject<{
1017
- provenance: z.ZodEnum<{
1018
- "prior-review-ledger": "prior-review-ledger";
1019
- "issue-review-focus": "issue-review-focus";
1020
- }>;
1021
- source: z.ZodString;
1022
- text: z.ZodString;
1023
- }, z.core.$strict>>;
1024
- //#endregion
1025
- //#region src/review-ladder-policy.d.ts
1026
- type ReviewFindingSeverity = "critical" | "high" | "medium" | "low" | "unknown";
1027
- type ReviewFindingCategory = "correctness" | "safety" | "coordination" | "maintainability" | "unknown";
1028
- declare const REVIEW_SEVERITIES: readonly ["critical", "high", "medium", "low", "unknown"];
1029
- declare const resolveReviewFindingSeverity: (priority?: string) => ReviewFindingSeverity;
1030
- declare const resolveReviewFindingCategory: (category?: string) => ReviewFindingCategory;
1031
- declare const FINDING_DISPOSITIONS: readonly ["open", "fixed-in-thread", "follow-up-filed", "waived", "stale-repeat", "rerun-noise"];
1032
- type FindingDisposition = (typeof FINDING_DISPOSITIONS)[number];
1033
- interface ReviewFindingAttributes {
1034
- blockingAfterCap?: boolean;
1035
- category?: string;
1036
- citedSpan?: string;
1037
- file?: string;
1038
- prescribedAction?: string;
1039
- priority?: string;
1040
- supersedes?: {
1041
- file?: string;
1042
- title: string;
1043
- };
1044
- title: string;
1058
+ type FactoryProjectProfile = z.infer<typeof factoryProjectProfileSchema>;
1059
+ declare const resolveFactoryRepository: (profile?: Pick<FactoryProjectProfile, "repository"> | undefined) => string;
1060
+ interface LoadProjectProfileInput {
1061
+ cwd?: string;
1062
+ profilePath?: string;
1045
1063
  }
1046
- type BlockingResolvableFinding = Pick<ReviewFindingAttributes, "blockingAfterCap" | "category" | "priority">;
1047
- declare const resolveFindingBlocking: (finding: BlockingResolvableFinding, disposition?: FindingDisposition) => boolean;
1048
- interface ReviewLadderPolicy {
1049
- gate: {
1050
- cap: number;
1051
- };
1052
- interior: {
1053
- cap: number;
1054
- };
1064
+ interface LoadProjectProfileResult {
1065
+ path: string;
1066
+ profile: FactoryProjectProfile;
1055
1067
  }
1056
- declare const resolveReviewLadderPolicy: () => ReviewLadderPolicy;
1068
+ declare function loadProjectProfile(input?: LoadProjectProfileInput): LoadProjectProfileResult;
1057
1069
  //#endregion
1058
- //#region src/review-ladder-ledger.d.ts
1059
- type LadderCycleStage = "interior" | "gate";
1060
- interface LadderCycleRef {
1061
- cycle: number;
1062
- stage: LadderCycleStage;
1063
- }
1064
- type LadderFindingReport = ReviewFindingAttributes;
1065
- type DeclarableFindingDisposition = Exclude<FindingDisposition, "open" | "stale-repeat" | "rerun-noise">;
1066
- interface LadderDispositionDeclaration {
1067
- disposition: DeclarableFindingDisposition;
1068
- finding: {
1069
- file?: string;
1070
- title: string;
1071
- };
1072
- findingReport?: LadderFindingReport;
1073
- reference?: string;
1074
- }
1075
- interface FindingLedgerEntry extends ReviewFindingAttributes {
1076
- disposition: FindingDisposition;
1077
- firstFlagged: LadderCycleRef;
1078
- flagCount: number;
1079
- key: string;
1080
- lastFlagged: LadderCycleRef;
1081
- priorDisposition?: FindingDisposition;
1082
- reference?: string;
1083
- reopenedCount: number;
1084
- staleRepeatCount: number;
1085
- }
1086
- declare const findingKey: (finding: {
1087
- citedSpan?: string;
1088
- file?: string;
1089
- prescribedAction?: string;
1090
- title?: string;
1091
- }) => string;
1092
- declare const openLadderFindings: (ledger: FindingLedgerEntry[]) => FindingLedgerEntry[];
1093
- declare const blockingLadderFindings: (ledger: FindingLedgerEntry[]) => FindingLedgerEntry[];
1094
- declare const staleRepeatLadderFindings: (ledger: FindingLedgerEntry[]) => FindingLedgerEntry[];
1095
- declare const inferFixedInThreadDispositions: (ledger: FindingLedgerEntry[], findings: readonly LadderFindingReport[], options?: {
1096
- sameHeadAsPriorCycle?: boolean;
1097
- }) => LadderDispositionDeclaration[];
1070
+ //#region src/pr-verify-mode.d.ts
1071
+ /**
1072
+ * The verification mode `pr:verify` resolved for a run.
1073
+ *
1074
+ * Canonically declared here rather than inside `pr-readiness/` so that modules
1075
+ * on either side of that boundary — the readiness proof shape and the durable
1076
+ * check-run payload — can name the same union without importing each other.
1077
+ */
1078
+ type ResolvedPrVerifyMode = "docs-only" | "trivial" | "full";
1098
1079
  //#endregion
1099
- //#region src/review-ladder.d.ts
1100
- type ReviewLadderExecutedStage = "interior" | "gate";
1101
- interface LadderSessionAttribution {
1102
- orchestrationMode?: "autonomous" | "manual";
1103
- resumedSession?: boolean;
1104
- runtime?: string;
1105
- sessionId?: string;
1106
- }
1107
- interface LadderUsageReport {
1108
- estimatedCostUsd?: number;
1109
- source?: string;
1110
- totalTokens?: number;
1111
- }
1112
- interface ReviewLadderCycle {
1113
- dispositions?: LadderDispositionDeclaration[];
1114
- engine?: string;
1115
- findings: LadderFindingReport[];
1116
- identity?: {
1117
- headSha: string;
1118
- patchId: string;
1119
- };
1120
- model?: string;
1121
- correlatedRerun?: boolean;
1122
- session?: LadderSessionAttribution;
1123
- stage: LadderCycleStage;
1124
- usage?: LadderUsageReport;
1125
- }
1126
- interface LadderInteriorCapTransition {
1127
- cap: number;
1128
- kind: "interior-cap-reached";
1129
- }
1130
- interface LadderGateCapTransition {
1131
- blockingFindings: string[];
1132
- cap: number;
1133
- kind: "gate-cap-exhausted";
1080
+ //#region src/pr-verify-status.d.ts
1081
+ type CommitStatusState = "failure" | "pending" | "success";
1082
+ interface PostCommitStatusInput {
1083
+ context?: string;
1084
+ cwd: string;
1085
+ description: string;
1086
+ owner: string;
1087
+ repo: string;
1088
+ sha: string;
1089
+ state: CommitStatusState;
1090
+ /**
1091
+ * Drop this mirror's own failure diagnostic because the caller has already
1092
+ * reported the same cause. Set only on the pre-push path, where the status
1093
+ * POST 422s for exactly the reason the pre-push notice gives and a trailing
1094
+ * "unable to post ... status" line would put back the false-defect reading
1095
+ * that notice exists to remove (#316).
1096
+ *
1097
+ * Deliberately a field on the request rather than a second, quieter poster:
1098
+ * an injected `PostCommitStatus` double sees the flag, so the branch is
1099
+ * assertable instead of collapsing to the same closure under test.
1100
+ */
1101
+ suppressFailureDiagnostic?: boolean;
1102
+ targetUrl: string;
1134
1103
  }
1135
- type LadderForcedTransition = LadderGateCapTransition | LadderInteriorCapTransition;
1136
- interface LadderRunInteriorCycleAction {
1137
- cycle: number;
1138
- kind: "run-interior-cycle";
1104
+ type PostCommitStatus = (input: PostCommitStatusInput) => void;
1105
+ //#endregion
1106
+ //#region src/user-config.d.ts
1107
+ declare const githubAppConfigSchema: z.ZodObject<{
1108
+ appId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
1109
+ installationId: z.ZodOptional<z.ZodNumber>;
1110
+ privateKeyPath: z.ZodString;
1111
+ }, z.core.$strip>;
1112
+ type GithubAppConfig = z.infer<typeof githubAppConfigSchema>;
1113
+ declare const factoryUserConfigSchema: z.ZodObject<{
1114
+ githubApp: z.ZodOptional<z.ZodObject<{
1115
+ appId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
1116
+ installationId: z.ZodOptional<z.ZodNumber>;
1117
+ privateKeyPath: z.ZodString;
1118
+ }, z.core.$strip>>;
1119
+ hqAllowedOrigins: z.ZodOptional<z.ZodArray<z.ZodString>>;
1120
+ hqIngestCredentials: z.ZodOptional<z.ZodObject<{
1121
+ clientIdRef: z.ZodString;
1122
+ clientSecretRef: z.ZodString;
1123
+ }, z.core.$strip>>;
1124
+ schemaVersion: z.ZodLiteral<2>;
1125
+ }, z.core.$strip>;
1126
+ type FactoryUserConfig = z.infer<typeof factoryUserConfigSchema>;
1127
+ interface LoadUserConfigResult {
1128
+ path: string;
1129
+ config: FactoryUserConfig;
1130
+ ignoredKeys?: string[];
1139
1131
  }
1140
- type LadderGateNextAction = {
1141
- cycle: number;
1142
- kind: "run-gate-cycle";
1143
- } | {
1144
- kind: "accept-nonblocking-findings";
1145
- } | {
1146
- kind: "escalate-to-triage";
1147
- } | {
1148
- kind: "ready-for-human";
1149
- };
1150
- type LadderPosition = {
1151
- forcedTransition?: LadderGateCapTransition;
1152
- nextAction: LadderGateNextAction;
1153
- stage: "gate";
1154
- } | {
1155
- forcedTransition?: LadderInteriorCapTransition;
1156
- nextAction: {
1157
- kind: "advance-to-gate";
1158
- };
1159
- stage: "interior-complete";
1160
- } | {
1161
- forcedTransition?: never;
1162
- nextAction: LadderRunInteriorCycleAction;
1163
- stage: "interior";
1132
+ //#endregion
1133
+ //#region src/github-check-runs.d.ts
1134
+ declare const FACTORY_CHECK_NAMES: {
1135
+ readonly "pr-ready": "patronage-factory/pr-ready";
1136
+ readonly "pr-verify": "patronage-factory/pr-verify";
1164
1137
  };
1165
- type LadderNextAction = LadderPosition["nextAction"];
1166
- type ReviewLadderStage = LadderPosition["stage"];
1167
- interface ReviewLadderStageEvent {
1168
- cycle: number;
1169
- cyclesToClean?: number;
1170
- engine?: string;
1171
- findingsSummary: {
1172
- blocking: number;
1173
- bySeverity: Record<ReviewFindingSeverity, number>;
1174
- flagged: number;
1175
- open: number;
1176
- staleRepeats: number;
1177
- };
1178
- forcedTransition?: LadderForcedTransition["kind"];
1179
- model?: string;
1180
- payloadVersion: 1;
1181
- session?: LadderSessionAttribution;
1182
- stage: ReviewLadderExecutedStage;
1183
- type: "review-ladder-stage";
1184
- usage?: LadderUsageReport;
1185
- }
1186
- interface LadderDiagnostic {
1187
- code: "interior-cycles-unrecorded";
1188
- message: string;
1138
+ type FactoryCheckGate = keyof typeof FACTORY_CHECK_NAMES;
1139
+ interface PublishFactoryCheckInput {
1140
+ conclusion?: "failure" | "success";
1141
+ cwd: string;
1142
+ gate: FactoryCheckGate;
1143
+ /**
1144
+ * HQ lane-permalink base (`<origin>/lanes/by-ref`). When present, the check
1145
+ * run's Details link deep-links to the HQ lane page instead of the PR-ledger
1146
+ * fallback. Derive it from the repository profile via
1147
+ * `hqLaneRefBaseUrlFromProfile` — the same source as the HQ gate sink.
1148
+ */
1149
+ hqLaneBaseUrl?: string;
1150
+ owner: string;
1151
+ pr?: number;
1152
+ proof: unknown;
1153
+ repo: string;
1154
+ sha: string;
1155
+ status?: "completed" | "in_progress";
1189
1156
  }
1190
- type ReviewLadderEvaluation = LadderPosition & {
1191
- cycleCounts: {
1192
- gate: number;
1193
- interior: number;
1157
+ interface CheckRunDependencies {
1158
+ fetch?: typeof fetch;
1159
+ githubApp?: GithubAppConfig;
1160
+ now?: () => number;
1161
+ postCommitStatus?: PostCommitStatus;
1162
+ resolveDetailsUrl?: (input: PublishFactoryCheckInput) => Promise<string> | string;
1163
+ /**
1164
+ * Bounded retry for the check-run POST. GitHub answers 422 for a head SHA it
1165
+ * has not seen yet, which is the normal state when `pr:verify` runs before
1166
+ * the branch is pushed, and is also briefly true right after a push.
1167
+ */
1168
+ retry?: {
1169
+ attempts: number;
1170
+ budgetMs?: number;
1171
+ delayMs: number;
1194
1172
  };
1195
- diagnostics: LadderDiagnostic[];
1196
- event?: ReviewLadderStageEvent;
1197
- ledger: FindingLedgerEntry[];
1198
- unmatchedDispositions: LadderDispositionDeclaration[];
1199
- };
1200
- interface EvaluateReviewLadderInput {
1201
- cycles: ReviewLadderCycle[];
1202
- policy: ReviewLadderPolicy;
1173
+ /** Injectable delay for the bounded retry (tests only). */
1174
+ sleep?: (ms: number) => Promise<void>;
1175
+ /** Overrides GITHUB_PUBLISH_TIMEOUT_MS for the App fetch calls (tests only). */
1176
+ timeoutMs?: number;
1203
1177
  }
1204
- declare const evaluateReviewLadder: ({
1205
- cycles,
1206
- policy
1207
- }: EvaluateReviewLadderInput) => ReviewLadderEvaluation;
1178
+ /**
1179
+ * Publish a factory check run and *wait* for it, so a caller that has just made
1180
+ * the head SHA visible on GitHub (pushed the branch, created the PR) can make
1181
+ * the proof reliably present for that SHA before it returns (#247).
1182
+ *
1183
+ * Never throws and never posts a commit-status fallback: the commit status is a
1184
+ * human-readable mirror, not a proof surface, so a caller that needs an
1185
+ * App-verified check run must be told plainly whether it got one. Returns
1186
+ * `true` only when the App-owned check run landed.
1187
+ *
1188
+ * "Landed" means GitHub serves it, not that the POST was accepted (#520). On
1189
+ * PR #519 the POST was accepted, `pr:ready` reported ready and armed, and the
1190
+ * source-pinned required check read `in_progress` across three runs — so GitHub
1191
+ * never scheduled the merge and emitted no rollup row saying why. Arming
1192
+ * already refuses to infer its outcome from the invocation and reads the pull
1193
+ * request back (`arm-auto-merge.ts`); publication now does the same.
1194
+ *
1195
+ * "Landed" is judged against every run of the name from the pinned App, not
1196
+ * against the one GitHub collapses to (#524): the newest must be *this* run, in
1197
+ * the status and conclusion that were published, and no run of the name may
1198
+ * still be unfinished. A surviving `in_progress` run blocks the required check
1199
+ * on its own, so confirming past it would report success on a pull request
1200
+ * GitHub will never merge. One read, no polling: an unconfirmed publication
1201
+ * returns `false`, which `pr:ready` already turns into a notice and an
1202
+ * idempotent re-dispatch.
1203
+ *
1204
+ * Confirmation is a point-in-time read, deliberately: a later publication for
1205
+ * the same name changes the answer — a completed one by becoming the newest, an
1206
+ * unfinished one by holding the check open beside this verdict rather than
1207
+ * replacing it — and every remaining writer publishes once, as the last thing
1208
+ * its invocation does. No retry, no poll, no re-confirm.
1209
+ */
1210
+ declare function ensureFactoryCheckRunPublished(input: PublishFactoryCheckInput, dependencies?: CheckRunDependencies & {
1211
+ onDiagnostic?: (message: string) => void;
1212
+ }): Promise<boolean>;
1208
1213
  //#endregion
1209
- //#region src/pr-readiness/ladder-proof-state.d.ts
1210
- interface PrReviewLadderState {
1211
- cycles: ReviewLadderCycle[];
1214
+ //#region src/merge-freeze.d.ts
1215
+ declare const MERGE_FREEZE_CHECK_NAME = "patronage-factory/merge-freeze";
1216
+ declare const MERGE_FREEZE_APP_SLUG = "patronage-factory";
1217
+ declare const mergeFreezeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1218
+ active: z.ZodLiteral<true>;
1219
+ generationId: z.ZodNumber;
1220
+ headSha: z.ZodString;
1221
+ outcome: z.ZodEnum<{
1222
+ active: "active";
1223
+ stale: "stale";
1224
+ }>;
1225
+ reason: z.ZodString;
1226
+ recordedAt: z.ZodISODateTime;
1227
+ schemaVersion: z.ZodLiteral<1>;
1228
+ }, z.core.$strip>, z.ZodObject<{
1229
+ active: z.ZodLiteral<false>;
1230
+ clearRationale: z.ZodOptional<z.ZodString>;
1231
+ generationId: z.ZodNumber;
1232
+ headSha: z.ZodString;
1233
+ outcome: z.ZodLiteral<"inactive">;
1234
+ reason: z.ZodString;
1235
+ recordedAt: z.ZodISODateTime;
1236
+ schemaVersion: z.ZodLiteral<1>;
1237
+ }, z.core.$strip>], "active">;
1238
+ type MergeFreezeState = z.infer<typeof mergeFreezeStateSchema>;
1239
+ /**
1240
+ * The write side of this contract lives in the generated merge-target push
1241
+ * Verify workflow (#356, ADR 0016 as amended; #429): it is the ONLY producer of
1242
+ * `patronage-factory/merge-freeze` generations. Its emitted `output.text`
1243
+ * payload must parse under this exact reader schema, which is what the
1244
+ * workflow's own tests assert through this export.
1245
+ */
1246
+ declare function validateMergeFreezeState(value: unknown): MergeFreezeState;
1247
+ interface MergeFreezeStoreInput {
1248
+ cwd: string;
1249
+ headSha: string;
1250
+ repository: CheckoutRepository;
1212
1251
  }
1213
- interface OpenCycleState {
1214
- autoBlockingFindings: number;
1215
- blockingEntries: ReviewFindingAttributes[];
1216
- openEntries: ReviewFindingAttributes[];
1217
- staleRepeatFindings?: number;
1252
+ interface MergeFreezeStore {
1253
+ read: (input: MergeFreezeStoreInput) => unknown;
1218
1254
  }
1219
- interface ReviewLadderSummaryState {
1220
- cycleCounts: {
1221
- gate: number;
1222
- interior: number;
1223
- };
1224
- forcedTransition?: LadderForcedTransition["kind"];
1225
- nextAction: LadderNextAction["kind"];
1226
- stage: ReviewLadderStage;
1255
+ /**
1256
+ * The run identity that proves a generation is settling because it is running.
1257
+ */
1258
+ interface RunningMergeFreezeWitness {
1259
+ /** The base tip the running generation was created on. */
1260
+ headSha: string;
1261
+ /** The running `patronage-factory/merge-freeze` check-run id. */
1262
+ runId: number;
1227
1263
  }
1228
- interface ReviewLadderSnapshot {
1229
- cycleState: OpenCycleState;
1230
- evaluation: ReviewLadderEvaluation;
1231
- ledger: FindingLedgerEntry[];
1232
- policyGateCap: number;
1233
- summary: ReviewLadderSummaryState;
1264
+ /**
1265
+ * The evidence that a generation is settling because it is still owed (#521).
1266
+ */
1267
+ interface AwaitedMergeFreezeWitness {
1268
+ /** The base tip whose generation is awaited. */
1269
+ headSha: string;
1270
+ /** The immediate parent whose settled generation proves the writer runs. */
1271
+ parentSha: string;
1272
+ /** The source-pinned hosted verify run that owes the generation. */
1273
+ verifyRunId: number;
1274
+ /** That run's status. A completed run owes nothing, so it is not settling. */
1275
+ verifyStatus: "in_progress" | "queued";
1234
1276
  }
1235
- type ReviewEpochMode = {
1236
- kind: "ladder";
1237
- ladder: PrReviewLadderState;
1238
- snapshot?: ReviewLadderSnapshot;
1277
+ /**
1278
+ * The two settling phases, each with the witness that proves it (#890).
1279
+ *
1280
+ * `phase` replaces an optional `running` field that made one situation two:
1281
+ * the field's presence, not the situation, decided how readers behaved. Each
1282
+ * phase now carries exactly the witness its own rule needs.
1283
+ */
1284
+ type SettlingMergeFreezeGeneration = {
1285
+ kind: "settling";
1286
+ phase: "running-generation";
1287
+ reason: string;
1288
+ witness: RunningMergeFreezeWitness;
1239
1289
  } | {
1240
- kind: "declared-window";
1290
+ kind: "settling";
1291
+ phase: "awaiting-generation";
1292
+ reason: string;
1293
+ witness: AwaitedMergeFreezeWitness;
1241
1294
  };
1242
- //#endregion
1243
- //#region src/pr-readiness/review-proof-types.d.ts
1244
- type PrReviewKind = "correctness" | "security";
1245
- type PrReviewMode = PrReviewKind | "all";
1246
- type PrReviewOutcome = "passed" | "failed" | "error";
1247
- interface PrReviewStageResolution {
1248
- model: string;
1249
- sessionId: string;
1250
- }
1251
- //#endregion
1252
- //#region src/pr-readiness/review-proof-shape.d.ts
1253
- interface PrReviewFinding extends ReviewFindingAttributes {
1254
- body: string;
1255
- category?: ReviewFindingCategory;
1256
- line?: number;
1257
- protocolFinding?: true;
1295
+ /**
1296
+ * The freeze generation as a readiness decision needs to see it (#477).
1297
+ *
1298
+ * `read` below collapses every situation short of a verdict into one refusal,
1299
+ * because merge time treats all of them as "do not merge". Readiness
1300
+ * distinguishes them: a settled generation is the writer's verdict, a
1301
+ * **settling** one is the window between a merge landing and its merge-target
1302
+ * Verify completing, and an **unreadable** one is ambiguous, malformed,
1303
+ * foreign-App, or unavailable state. Same selection, same pinned App, same
1304
+ * `started_at` ordering — only the reporting is finer.
1305
+ */
1306
+ type MergeFreezeGeneration = {
1307
+ kind: "settled";
1308
+ state: MergeFreezeState;
1309
+ } | SettlingMergeFreezeGeneration | {
1310
+ kind: "unreadable";
1311
+ reason: string;
1312
+ };
1313
+ /** A merge-freeze reader that can also report the settle window (#477). */
1314
+ interface MergeFreezeAuthority extends MergeFreezeStore {
1315
+ readGeneration: (input: MergeFreezeStoreInput) => MergeFreezeGeneration;
1258
1316
  }
1259
- interface PrReviewResult {
1260
- kind: PrReviewKind;
1261
- startedAt: string;
1262
- endedAt: string;
1263
- durationMs: number;
1264
- model?: string;
1265
- producer?: string;
1266
- rung?: EvidenceReviewRung;
1267
- sessionId?: string;
1268
- outcome: PrReviewOutcome;
1269
- issuesFlagged: number;
1270
- summary: string;
1271
- findings: PrReviewFinding[];
1272
- typedVerdict?: boolean;
1273
- verdictSource?: "footer" | "recovered";
1274
- promptSections?: ReviewPromptSection[];
1317
+ interface GitHubCheckRunMergeFreezeApi {
1318
+ list: (input: MergeFreezeStoreInput & {
1319
+ name: string;
1320
+ }) => unknown;
1321
+ parent?: (input: MergeFreezeStoreInput) => unknown;
1275
1322
  }
1276
- interface PrReviewProof {
1277
- schemaVersion: 2;
1278
- findingProvenanceVersion: 1;
1279
- base: string;
1280
- headSha: string;
1281
- patchId: string;
1282
- reviewCycle?: number;
1283
- maxReviewCycles?: number;
1284
- changedFiles: string[];
1285
- cleanedPaths: string[];
1286
- ladder?: PrReviewLadderState;
1287
- reviewRequirement?: {
1288
- reason: "no-applicable-mode" | "faithful-merge";
1289
- status: "not-required";
1290
- };
1291
- reviews: PrReviewResult[];
1323
+ declare function createGitHubCheckRunMergeFreezeStore(api: GitHubCheckRunMergeFreezeApi): MergeFreezeAuthority;
1324
+ //#endregion
1325
+ //#region src/pr-proof-io.d.ts
1326
+ interface ProofDescriptor<T> {
1327
+ label: string;
1328
+ defaultPath: string;
1329
+ schemaVersion: number;
1330
+ parse: (raw: unknown) => T;
1292
1331
  }
1293
1332
  //#endregion
1294
1333
  //#region src/pr-readiness/readiness-ledger.d.ts
1295
- declare const SCHEMA_VERSION = 1;
1334
+ /**
1335
+ * Ledger schema version 2 (#894): `verification` is a tagged union on
1336
+ * `prVerify` and `externalChecks` no longer echoes `inScope`. Version 1
1337
+ * ledgers are not read — the pre-1.0 posture keeps one shape per contract, so
1338
+ * there is no compat reader here.
1339
+ */
1340
+ declare const SCHEMA_VERSION = 2;
1296
1341
  declare const READINESS_REPAIR_CODES: readonly ["undraft-pr", "await-post-undraft-checks"];
1297
1342
  declare const readinessRepairSchema: z.ZodObject<{
1298
1343
  action: z.ZodString;
@@ -1315,7 +1360,6 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1315
1360
  review: "review";
1316
1361
  verify: "verify";
1317
1362
  }>;
1318
- inScope: z.ZodBoolean;
1319
1363
  name: z.ZodString;
1320
1364
  reason: z.ZodOptional<z.ZodString>;
1321
1365
  scope: z.ZodOptional<z.ZodObject<{
@@ -1423,9 +1467,9 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1423
1467
  reviewedHeadSha: z.ZodOptional<z.ZodString>;
1424
1468
  reviewedPatchId: z.ZodOptional<z.ZodString>;
1425
1469
  status: z.ZodEnum<{
1426
- blocked: "blocked";
1427
1470
  "not-required": "not-required";
1428
1471
  stale: "stale";
1472
+ blocked: "blocked";
1429
1473
  current: "current";
1430
1474
  missing: "missing";
1431
1475
  }>;
@@ -1435,28 +1479,37 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1435
1479
  reviewedHeadSha: z.ZodOptional<z.ZodString>;
1436
1480
  reviewedPatchId: z.ZodOptional<z.ZodString>;
1437
1481
  status: z.ZodEnum<{
1438
- blocked: "blocked";
1439
1482
  "not-required": "not-required";
1440
1483
  stale: "stale";
1484
+ blocked: "blocked";
1441
1485
  current: "current";
1442
1486
  missing: "missing";
1443
1487
  }>;
1444
1488
  }, z.core.$strip>>;
1445
1489
  }, z.core.$strip>;
1446
- schemaVersion: z.ZodLiteral<1>;
1447
- verification: z.ZodObject<{
1490
+ schemaVersion: z.ZodLiteral<2>;
1491
+ verification: z.ZodDiscriminatedUnion<[z.ZodObject<{
1448
1492
  command: z.ZodLiteral<"patronage-factory pr:verify">;
1449
- docsOnlyDeltaAccepted: z.ZodOptional<z.ZodBoolean>;
1450
- docsOnlyVerifiedHeadSha: z.ZodOptional<z.ZodString>;
1451
- prVerify: z.ZodEnum<{
1452
- stale: "stale";
1453
- passed: "passed";
1454
- missing: "missing";
1455
- }>;
1456
- trivialDeltaAccepted: z.ZodOptional<z.ZodBoolean>;
1457
- trivialVerifiedHeadSha: z.ZodOptional<z.ZodString>;
1493
+ prVerify: z.ZodLiteral<"missing">;
1494
+ }, z.core.$strict>, z.ZodObject<{
1495
+ command: z.ZodLiteral<"patronage-factory pr:verify">;
1496
+ prVerify: z.ZodLiteral<"stale">;
1497
+ verifiedHeadSha: z.ZodString;
1498
+ }, z.core.$strict>, z.ZodObject<{
1499
+ command: z.ZodLiteral<"patronage-factory pr:verify">;
1500
+ prVerify: z.ZodLiteral<"passed-via-head">;
1501
+ verifiedHeadSha: z.ZodString;
1502
+ }, z.core.$strict>, z.ZodObject<{
1503
+ command: z.ZodLiteral<"patronage-factory pr:verify">;
1504
+ docsOnlyVerifiedHeadSha: z.ZodString;
1505
+ prVerify: z.ZodLiteral<"docs-only-delta">;
1458
1506
  verifiedHeadSha: z.ZodOptional<z.ZodString>;
1459
- }, z.core.$strip>;
1507
+ }, z.core.$strict>, z.ZodObject<{
1508
+ command: z.ZodLiteral<"patronage-factory pr:verify">;
1509
+ prVerify: z.ZodLiteral<"trivial-delta">;
1510
+ trivialVerifiedHeadSha: z.ZodString;
1511
+ verifiedHeadSha: z.ZodOptional<z.ZodString>;
1512
+ }, z.core.$strict>], "prVerify">;
1460
1513
  }, z.core.$strip>;
1461
1514
  type ReadinessRepair = z.infer<typeof readinessRepairSchema>;
1462
1515
  type ReadinessStatus = "ready" | "blocked";
@@ -2392,7 +2445,6 @@ interface RequiredCheckOutcome {
2392
2445
  name: string;
2393
2446
  checkType: EvidenceCheckType;
2394
2447
  status: "satisfied" | "unmet" | "out-of-scope";
2395
- inScope: boolean;
2396
2448
  scopeReason: string;
2397
2449
  scope?: RequiredCheckScope;
2398
2450
  reason?: string;
@@ -2415,9 +2467,9 @@ declare const loadEvidenceEnvelopes: (cwd: string) => LoadedEvidenceEnvelope[];
2415
2467
  //#region src/review-proof-applicability.d.ts
2416
2468
  declare const REVIEW_STATUS_VALUES: readonly ["not-required", "current", "stale", "missing", "blocked"];
2417
2469
  declare const reviewStatusSchema: z.ZodEnum<{
2418
- blocked: "blocked";
2419
2470
  "not-required": "not-required";
2420
2471
  stale: "stale";
2472
+ blocked: "blocked";
2421
2473
  current: "current";
2422
2474
  missing: "missing";
2423
2475
  }>;
@@ -4155,30 +4207,42 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4155
4207
  reviews: {
4156
4208
  correctness: {
4157
4209
  required: boolean;
4158
- status: "blocked" | "not-required" | "stale" | "current" | "missing";
4210
+ status: "not-required" | "stale" | "blocked" | "current" | "missing";
4159
4211
  reviewedHeadSha?: string | undefined;
4160
4212
  reviewedPatchId?: string | undefined;
4161
4213
  };
4162
4214
  security?: {
4163
4215
  required: boolean;
4164
- status: "blocked" | "not-required" | "stale" | "current" | "missing";
4216
+ status: "not-required" | "stale" | "blocked" | "current" | "missing";
4165
4217
  reviewedHeadSha?: string | undefined;
4166
4218
  reviewedPatchId?: string | undefined;
4167
4219
  } | undefined;
4168
4220
  };
4169
- schemaVersion: 1;
4221
+ schemaVersion: 2;
4170
4222
  verification: {
4171
4223
  command: "patronage-factory pr:verify";
4172
- prVerify: "stale" | "passed" | "missing";
4173
- docsOnlyDeltaAccepted?: boolean | undefined;
4174
- docsOnlyVerifiedHeadSha?: string | undefined;
4175
- trivialDeltaAccepted?: boolean | undefined;
4176
- trivialVerifiedHeadSha?: string | undefined;
4224
+ prVerify: "missing";
4225
+ } | {
4226
+ command: "patronage-factory pr:verify";
4227
+ prVerify: "stale";
4228
+ verifiedHeadSha: string;
4229
+ } | {
4230
+ command: "patronage-factory pr:verify";
4231
+ prVerify: "passed-via-head";
4232
+ verifiedHeadSha: string;
4233
+ } | {
4234
+ command: "patronage-factory pr:verify";
4235
+ docsOnlyVerifiedHeadSha: string;
4236
+ prVerify: "docs-only-delta";
4237
+ verifiedHeadSha?: string | undefined;
4238
+ } | {
4239
+ command: "patronage-factory pr:verify";
4240
+ prVerify: "trivial-delta";
4241
+ trivialVerifiedHeadSha: string;
4177
4242
  verifiedHeadSha?: string | undefined;
4178
4243
  };
4179
4244
  externalChecks?: {
4180
4245
  checkType: "review" | "verify";
4181
- inScope: boolean;
4182
4246
  name: string;
4183
4247
  scopeReason: string;
4184
4248
  status: "satisfied" | "unmet" | "out-of-scope";
@@ -4676,4 +4740,4 @@ interface CreateProgramOptions {
4676
4740
  declare function createProgram(options?: CreateProgramOptions): Command;
4677
4741
  declare function run(argv?: string[]): Promise<void>;
4678
4742
  //#endregion
4679
- 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 FindingDisposition, type FindingLedgerEntry, type FollowUpAction, FollowUpActionSchema, type ImpactScopeDecision, type ImpactScopeSurface, type IssueReviewFocus, type LadderDispositionDeclaration, MERGE_FREEZE_APP_SLUG, MERGE_FREEZE_CHECK_NAME, type MergeFreezeState, type PlanFactoryPrStatusHudInput, type PrPublishArgs, type PrPublishDependencies, PrPublishFollowUpError, type PrPublishFollowUpOutcome, type PrPublishHandoff, type PrPublishResult, type PrReadyArgs, type PrReadyProof, 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 ReviewLadderCycle, type ReviewLadderEvaluation, type ReviewLadderPolicy, type ReviewLadderStageEvent, type ReviewLadderTraceIdentity, 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, type WorkerCloseoutLessonsTraceEvent, appendReviewLadderStageTraceEvent, appendWithTraceSinks, applyDemandWaiver, assembleReviewPrompt, assertFactoryPrStatusIdentity, assertWorkerCheckoutAllowed, authorizeDemandWaiver, batteryScopeSummaryLines, blockingLadderFindings, boundary_manifest_d_exports as boundaryManifest, boundary_review_proof_d_exports as boundaryReviewProof, buildEpicStructureEvent, buildEpicStructurePayload, buildEvidenceEnvelope, buildReviewGateNotRequiredTraceEvent, buildReviewLadderStageTraceEvent, comment_provenance_d_exports as commentProvenance, createLocalJsonlTraceSink, createProgram, createVerificationRunContext, doctorProjectProfile, epicStructureEventId, evaluateReviewLadder, evidenceEnvelopeFilename, findingKey, followUpFromArgv, impactStampScopeDecision, inferFixedInThreadDispositions, isProductionHqUrl, loadProjectProfile, normalizeIssueComments, openLadderFindings, 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, readPrReviewProof, refreshFactoryPrStatusHud, refreshFactoryPrStatusHudSafely, renderFactoryPrStatusHud, resolveFactoryRepository, resolveFindingBlocking, resolveReviewFindingCategory, resolveReviewFindingSeverity, resolveReviewLadderPolicy, resolveTraceWriteSinks, reviewCycleStateFor, reviewFocusFromIssueBody, reviewPromptSectionSchema, reviewPromptSectionsSchema, run, runBoundaryCheck, runDemandWaive, runEvidenceEmit, runPrPublish, runPrReady, runPrReview, runPrVerify, scanFactoryTraceDiagnostics, scanFactoryTraceEvents, selectWaiversForCandidate, staleRepeatLadderFindings, toFactoryTraceEnvelope, tryAppendReviewGateNotRequiredTraceEvent, tryAppendReviewLadderStageTraceEvent, validateBoundaryCheckProof, validateDagDocument, validateDemandWaiverStore, validateFactoryTraceEvent, validateMergeFreezeState, validatePrReadyProof, validatePrReviewProof, validatePrVerifyProof, validatePreviewLifecyclePlan, waivedDemandNotice, waivedDemandSchema, worktree_scratch_files_d_exports as worktreeScratchFiles };
4743
+ 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 FindingDisposition, type FindingLedgerEntry, type FollowUpAction, FollowUpActionSchema, type GitHubCheckRunMergeFreezeApi, type ImpactScopeDecision, type ImpactScopeSurface, type IssueReviewFocus, type LadderDispositionDeclaration, 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 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 ReviewLadderCycle, type ReviewLadderEvaluation, type ReviewLadderPolicy, type ReviewLadderStageEvent, type ReviewLadderTraceIdentity, 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, type WorkerCloseoutLessonsTraceEvent, appendReviewLadderStageTraceEvent, appendWithTraceSinks, applyDemandWaiver, assembleReviewPrompt, assertFactoryPrStatusIdentity, assertWorkerCheckoutAllowed, authorizeDemandWaiver, batteryScopeSummaryLines, blockingLadderFindings, boundary_manifest_d_exports as boundaryManifest, boundary_review_proof_d_exports as boundaryReviewProof, buildEpicStructureEvent, buildEpicStructurePayload, buildEvidenceEnvelope, buildReviewGateNotRequiredTraceEvent, buildReviewLadderStageTraceEvent, comment_provenance_d_exports as commentProvenance, createGitHubCheckRunMergeFreezeStore, createLocalJsonlTraceSink, createProgram, createVerificationRunContext, doctorProjectProfile, epicStructureEventId, evaluateReviewLadder, evidenceEnvelopeFilename, findingKey, followUpFromArgv, impactStampScopeDecision, inferFixedInThreadDispositions, isProductionHqUrl, loadProjectProfile, normalizeIssueComments, openLadderFindings, 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, readPrReviewProof, refreshFactoryPrStatusHud, refreshFactoryPrStatusHudSafely, renderFactoryPrStatusHud, resolveFactoryRepository, resolveFindingBlocking, resolveReviewFindingCategory, resolveReviewFindingSeverity, resolveReviewLadderPolicy, resolveTraceWriteSinks, reviewCycleStateFor, reviewFocusFromIssueBody, reviewPromptSectionSchema, reviewPromptSectionsSchema, run, runBoundaryCheck, runDemandWaive, runEvidenceEmit, runPrPublish, runPrReady, runPrReview, runPrVerify, scanFactoryTraceDiagnostics, scanFactoryTraceEvents, selectWaiversForCandidate, staleRepeatLadderFindings, toFactoryTraceEnvelope, tryAppendReviewGateNotRequiredTraceEvent, tryAppendReviewLadderStageTraceEvent, validateBoundaryCheckProof, validateDagDocument, validateDemandWaiverStore, validateFactoryTraceEvent, validateMergeFreezeState, validatePrReadyProof, validatePrReviewProof, validatePrVerifyProof, validatePreviewLifecyclePlan, waivedDemandNotice, waivedDemandSchema, worktree_scratch_files_d_exports as worktreeScratchFiles };