@effect-agent/pr-review 0.1.0-beta.22 → 0.1.0-beta.24

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.
@@ -1,5 +1,5 @@
1
1
  import { Context, DateTime, Effect, Layer, Option, Redacted, Schema } from "effect";
2
- import { AgentPolicy, RunEvent, RuntimeBinding, SubagentPolicy } from "effect-agent";
2
+ import { AgentPolicy, BudgetAdapterError, BudgetExceeded, RunBudgetHook, RunEvent, RuntimeBinding } from "effect-agent";
3
3
  import { Tool, Toolkit } from "effect/unstable/ai";
4
4
  import { HttpClient } from "effect/unstable/http";
5
5
  //#region src/internal/diff.d.ts
@@ -384,9 +384,148 @@ declare const PullRequestReviewer: import("effect-agent").Definition<typeof Revi
384
384
  /** Why a finding cannot anchor to the current new-version diff, if any. */
385
385
  declare const anchorViolation: (finding: ReviewFinding, files: ReadonlyArray<ChangedFile>) => string | undefined;
386
386
  //#endregion
387
+ //#region src/internal/review-units.d.ts
388
+ /** The delegation fan-out bound: one parent Run spawns at most this many children. */
389
+ declare const MAX_REVIEW_UNITS = 8;
390
+ /** A unit never carries more files than this, regardless of their size. */
391
+ declare const MAX_UNIT_FILES = 12;
392
+ /** Compatibility export; complete evidence chars now own unit packing. */
393
+ declare const UNIT_CHANGED_LINE_BUDGET = 800;
394
+ /**
395
+ * Bound the complete model-visible evidence assigned to one child. This is a
396
+ * character bound rather than a token estimate because it is deterministic,
397
+ * provider-independent, and enforced before any model call.
398
+ */
399
+ declare const UNIT_EVIDENCE_CHAR_BUDGET = 240000;
400
+ /** Maximum complete evidence shards placed in one child brief. */
401
+ declare const MAX_UNIT_EVIDENCE_SHARDS = 12;
402
+ /**
403
+ * Keep overflow diagnostics bounded to one plan's total assignment capacity.
404
+ * The plan separately records the exact overflow count and every affected
405
+ * path, so identifiers are a deterministic diagnostic sample rather than the
406
+ * authority for whether input coverage is complete.
407
+ */
408
+ declare const MAX_REPORTED_UNASSIGNED_EVIDENCE_SHARDS: number;
409
+ /** @deprecated Use `MAX_PATCH_CHARS`; this is now the per-shard bound. */
410
+ declare const MAX_FILE_EVIDENCE_CHARS = 60000;
411
+ /** The merged review never exceeds the `CodeReview` findings bound. */
412
+ declare const MAX_MERGED_FINDINGS = 20;
413
+ declare const ReviewUnitId: Schema.NonEmptyString;
414
+ /** High-risk surfaces that receive an explicit specialist focus label. */
415
+ declare const ReviewRiskCategory: Schema.Literals<readonly ["authentication-authorization", "security-boundary", "persistence-durability", "concurrency", "credential-handling", "external-side-effects"]>;
416
+ type ReviewRiskCategory = typeof ReviewRiskCategory.Type;
417
+ declare const ReviewDiscoveryPerspective: Schema.Literals<readonly ["general", "risk-specialist"]>;
418
+ type ReviewDiscoveryPerspective = typeof ReviewDiscoveryPerspective.Type;
419
+ declare const ReviewPassId: Schema.NonEmptyString;
420
+ declare const ReviewEvidenceShardId: Schema.NonEmptyString;
421
+ declare const ReviewEvidenceShard_base: Schema.Class<ReviewEvidenceShard, Schema.Struct<{
422
+ readonly shardId: Schema.NonEmptyString;
423
+ readonly path: Schema.NonEmptyString;
424
+ readonly ordinal: Schema.Int;
425
+ readonly total: Schema.Int;
426
+ readonly evidenceChars: Schema.Int;
427
+ }>, {}>;
428
+ /** One complete bounded slice of a changed path's model-visible evidence. */
429
+ declare class ReviewEvidenceShard extends ReviewEvidenceShard_base {}
430
+ declare const ReviewDiscoveryPass_base: Schema.Class<ReviewDiscoveryPass, Schema.Struct<{
431
+ readonly passId: Schema.NonEmptyString;
432
+ readonly unitId: Schema.NonEmptyString;
433
+ readonly paths: Schema.$Array<Schema.NonEmptyString>;
434
+ readonly evidenceShardIds: Schema.$Array<Schema.NonEmptyString>;
435
+ readonly perspective: Schema.Literals<readonly ["general", "risk-specialist"]>;
436
+ /** Empty for the general pass; explicit deterministic focus for specialists. */
437
+ readonly riskCategories: Schema.$Array<Schema.Literals<readonly ["authentication-authorization", "security-boundary", "persistence-durability", "concurrency", "credential-handling", "external-side-effects"]>>;
438
+ }>, {}>;
439
+ /** One required, independently scoped discovery attempt. */
440
+ declare class ReviewDiscoveryPass extends ReviewDiscoveryPass_base {}
441
+ declare const ReviewUnit_base: Schema.Class<ReviewUnit, Schema.Struct<{
442
+ readonly unitId: Schema.NonEmptyString;
443
+ readonly paths: Schema.$Array<Schema.NonEmptyString>;
444
+ readonly evidenceShards: Schema.$Array<typeof ReviewEvidenceShard>;
445
+ /** additions + deletions across the unit's files, for honest sizing. */
446
+ readonly changedLines: Schema.Int;
447
+ /** Complete model-visible diff/content evidence assigned to each child. */
448
+ readonly evidenceChars: Schema.Int;
449
+ /** Host-classified focus labels for the unit's redundant specialist pass. */
450
+ readonly riskCategories: Schema.$Array<Schema.Literals<readonly ["authentication-authorization", "security-boundary", "persistence-durability", "concurrency", "credential-handling", "external-side-effects"]>>;
451
+ }>, {}>;
452
+ /** One bounded slice of the changeset delegated to one child reviewer. */
453
+ declare class ReviewUnit extends ReviewUnit_base {}
454
+ declare const ReviewUnitPlan_base: Schema.Class<ReviewUnitPlan, Schema.Struct<{
455
+ readonly totalFiles: Schema.Int;
456
+ /** True when the source returned fewer files than the pull request has. */
457
+ readonly truncated: Schema.Boolean;
458
+ readonly units: Schema.$Array<typeof ReviewUnit>;
459
+ /** Exact discovery calls the coordinator must make. */
460
+ readonly discoveryPasses: Schema.$Array<typeof ReviewDiscoveryPass>;
461
+ /** Changed files with neither a textual diff nor bounded base/head text. */
462
+ readonly undiffablePaths: Schema.$Array<Schema.NonEmptyString>;
463
+ /** Assigned paths with one or more evidence shards beyond plan capacity. */
464
+ readonly partialEvidencePaths: Schema.$Array<Schema.NonEmptyString>;
465
+ /** Exact number of shards beyond the bounded unit capacity. */
466
+ readonly unassignedEvidenceShardCount: Schema.Int;
467
+ /** Bounded deterministic prefix of the unassigned shard identifiers. */
468
+ readonly unassignedEvidenceShardIds: Schema.$Array<Schema.NonEmptyString>;
469
+ /**
470
+ * Diffable files beyond the fan-out capacity (MAX_REVIEW_UNITS units of
471
+ * MAX_UNIT_FILES files). Never silently dropped: the coordinator must name
472
+ * them as unreviewed in its summary.
473
+ */
474
+ readonly unassignedPaths: Schema.$Array<Schema.NonEmptyString>;
475
+ }>, {}>;
476
+ /** The complete deterministic fan-out plan over one changeset. */
477
+ declare class ReviewUnitPlan extends ReviewUnitPlan_base {}
478
+ /**
479
+ * Deterministic host policy for specialist assignment. It intentionally
480
+ * favors false positives: an extra bounded pass costs work, while a missed
481
+ * high-risk classification removes redundancy. This is not a claim that the
482
+ * keyword policy recognizes every semantically risky change.
483
+ */
484
+ declare const classifyReviewRisks: (file: ChangedFile) => ReadonlyArray<ReviewRiskCategory>;
485
+ /**
486
+ * Whether every claimed finding anchor was present in the exact bounded
487
+ * evidence shards assigned to one unit. This is stricter than checking the
488
+ * full pull-request diff when an oversized path spans multiple units.
489
+ */
490
+ declare const findingAnchorInUnitEvidence: (finding: ReviewFinding, unit: ReviewUnit, files: ReadonlyArray<ChangedFile>) => boolean;
491
+ /**
492
+ * Group the changeset into at most `MAX_REVIEW_UNITS` review units.
493
+ *
494
+ * Deterministic by construction: files are ordered by path (so files sharing
495
+ * a directory become neighbors — directory affinity without a heuristic),
496
+ * then split into complete line-bounded evidence shards and packed greedily
497
+ * under the hard evidence and per-unit shard bounds. Capacity is finite and
498
+ * explicit:
499
+ *
500
+ * - files without a textual diff are still delegated when the source
501
+ * recovered complete bounded UTF-8 base/head content. Findings from that
502
+ * evidence cannot anchor inline and are reported as concerns;
503
+ * - files with neither form of textual evidence surface in
504
+ * `undiffablePaths` instead of laundering missing coverage;
505
+ * - an oversized path spans as many deterministic shards and units as needed;
506
+ * - shards beyond `MAX_REVIEW_UNITS` full units surface explicitly, so a path
507
+ * is partial only when finite plan capacity is genuinely exhausted.
508
+ */
509
+ declare const planReviewUnits: (files: ReadonlyArray<ChangedFile>, options: {
510
+ readonly totalChangedFiles: number;
511
+ }) => ReviewUnitPlan;
512
+ /**
513
+ * Merge the children's findings into one bounded, deterministic list: dedupe
514
+ * findings sharing an anchor (path + line range) keeping the most severe —
515
+ * and, at equal severity, the first in declaration order — then rank by
516
+ * severity, path, and line, and cap at the `CodeReview` findings bound.
517
+ * This is the merge policy the coordinator's instructions state in prose;
518
+ * pinning it here keeps the policy itself deterministic and testable.
519
+ */
520
+ declare const rankAndDedupeFindings: (findings: ReadonlyArray<ReviewFinding>) => ReadonlyArray<ReviewFinding>;
521
+ /**
522
+ * The concern analogue of `rankAndDedupeFindings`: dedupe by exact content
523
+ * keeping the most severe duplicate, rank by severity, and cap at the
524
+ * `CodeReview` concerns bound.
525
+ */
526
+ declare const rankAndDedupeConcerns: (concerns: ReadonlyArray<ReviewConcern>) => ReadonlyArray<ReviewConcern>;
527
+ //#endregion
387
528
  //#region src/internal/coverage.d.ts
388
- declare const ReviewShape: Schema.Literals<readonly ["flat", "fan-out"]>;
389
- type ReviewShape = typeof ReviewShape.Type;
390
529
  declare const FailedReviewUnit_base: Schema.Class<FailedReviewUnit, Schema.Struct<{
391
530
  readonly unitId: Schema.NonEmptyString;
392
531
  readonly errorTag: Schema.NonEmptyString;
@@ -413,6 +552,14 @@ declare const ReviewInputCoverage_base: Schema.Class<ReviewInputCoverage, Schema
413
552
  /** Assigned paths whose model-visible diff was truncated by the evidence bound. */
414
553
  readonly partialPaths: Schema.$Array<Schema.NonEmptyString>;
415
554
  readonly unassignedPaths: Schema.$Array<Schema.NonEmptyString>;
555
+ /**
556
+ * Paths with neither a textual diff nor bounded base/head text (binaries,
557
+ * oversized files). Fail-closed: they keep the status incomplete for as
558
+ * long as they are part of the pull request — an unreviewable change must
559
+ * never authorize a green check. Exclude them deliberately with ignore
560
+ * globs when that is intended.
561
+ */
562
+ readonly undiffablePaths: Schema.$Array<Schema.NonEmptyString>;
416
563
  readonly reasons: Schema.$Array<Schema.NonEmptyString>;
417
564
  }>, {}>;
418
565
  declare class ReviewInputCoverage extends ReviewInputCoverage_base {}
@@ -434,40 +581,56 @@ declare const ReviewAssurance_base: Schema.Class<ReviewAssurance, Schema.Struct<
434
581
  readonly confirmedCandidates: Schema.Int;
435
582
  readonly rejectedCandidates: Schema.Int;
436
583
  readonly unsettledCandidates: Schema.Int;
437
- /** Every failure remains visible within the coordinator's 32-call hard bound. */
584
+ /** Discovery claims discarded for anchors/paths outside their assigned evidence. */
585
+ readonly discardedInvalidFindings: Schema.Int;
438
586
  readonly failedPasses: Schema.$Array<typeof FailedReviewPass>;
439
587
  readonly reasons: Schema.$Array<Schema.NonEmptyString>;
440
588
  }>, {}>;
589
+ /**
590
+ * Settlement of scheduled review work. `incomplete` means reviewer-side work
591
+ * failed after its bounded retry — a machinery gap that is carried forward and
592
+ * retried on the next run, never a statement about the code under review.
593
+ * `unverified` is the flat reviewer's honest constant: one pass with no
594
+ * independent verifier is neither settled assurance nor a failure.
595
+ */
441
596
  declare class ReviewAssurance extends ReviewAssurance_base {}
442
- interface ReviewPipelineAssessment {
597
+ /** Render a bounded, deterministic "label (n): a, b, … (+k more)" reason line. */
598
+ declare const boundedListReason: (label: string, values: Iterable<string>) => string;
599
+ /** The flat reviewer's honest constant assurance: one pass, no verifier. */
600
+ declare const flatAssurance: () => ReviewAssurance;
601
+ interface FlatReviewAssessment {
443
602
  readonly inputCoverage: ReviewInputCoverage;
444
603
  readonly assurance: ReviewAssurance;
445
- /** Deprecated compatibility aggregate. */
446
- readonly coverage: ReviewCoverage;
447
- readonly confirmedFindings: ReadonlyArray<ReviewFinding>;
448
- readonly confirmedConcerns: ReadonlyArray<ReviewConcern>;
449
- readonly walkthrough: ReadonlyArray<WalkthroughEntry>;
604
+ /** Retryable evidence gaps (failed or missing diff reads), never undiffable paths. */
605
+ readonly unreviewedPaths: ReadonlyArray<string>;
450
606
  }
451
- /** Assess one settled run without trusting coordinator prose or findings. */
452
- declare const assessReviewPipeline: (input: {
453
- readonly shape: ReviewShape;
607
+ /**
608
+ * Assess one settled flat run from its Run event trace: which required paths
609
+ * received successful bounded diff evidence. This observes tool INPUT
610
+ * assignment only — the host cannot know which evidence the model weighed.
611
+ */
612
+ declare const assessFlatReview: (input: {
454
613
  readonly files: ReadonlyArray<ChangedFile>;
455
614
  readonly totalFiles: number;
456
615
  readonly anchorFiles: ReadonlyArray<ChangedFile>;
457
616
  readonly totalAnchorFiles: number;
458
617
  readonly events: ReadonlyArray<RunEvent>;
459
- }) => ReviewPipelineAssessment;
460
- /** Compatibility helper; prefer assessReviewPipeline for precise claims. */
461
- declare const assessReviewCoverage: (input: {
462
- readonly shape: ReviewShape;
618
+ }) => FlatReviewAssessment;
619
+ /**
620
+ * Input coverage of one host-scheduled fan-out plan: which required paths the
621
+ * bounded plan actually assigned complete evidence for. Capacity overflow and
622
+ * undiffable paths are both real gaps; the pipeline carries them so the check
623
+ * stays fail-closed until they are reviewed, removed, or explicitly ignored.
624
+ */
625
+ declare const fanOutInputCoverage: (input: {
626
+ readonly plan: ReviewUnitPlan;
463
627
  readonly files: ReadonlyArray<ChangedFile>;
464
628
  readonly totalFiles: number;
465
629
  readonly anchorFiles: ReadonlyArray<ChangedFile>;
466
630
  readonly totalAnchorFiles: number;
467
- readonly events: ReadonlyArray<RunEvent>;
468
- }) => ReviewCoverage;
469
- /** Host-verified summaries from successful general discovery passes only. */
470
- declare const collectUnitFileSummaries: (events: ReadonlyArray<RunEvent>) => ReadonlyArray<WalkthroughEntry>;
631
+ }) => ReviewInputCoverage;
632
+ /** Compatibility aggregate over the two precise claims. */
633
+ declare const compatibilityCoverage: (inputCoverage: ReviewInputCoverage, assurance: ReviewAssurance) => ReviewCoverage;
471
634
  //#endregion
472
635
  //#region src/internal/review-state.d.ts
473
636
  declare const ReviewMode: Schema.Literals<readonly ["incremental", "final"]>;
@@ -492,8 +655,21 @@ declare const StoredReviewConcern_base: Schema.Class<StoredReviewConcern, Schema
492
655
  }>, {}>;
493
656
  /** A compact unresolved non-anchored concern carried until a final audit. */
494
657
  declare class StoredReviewConcern extends StoredReviewConcern_base {}
658
+ /** The carried-scope bound; a run that cannot fit its leftovers publishes no state. */
659
+ declare const MAX_STORED_UNREVIEWED_PATHS = 100;
660
+ /** Failed-pass records stored beside the leftover paths; one per unit stage. */
661
+ declare const MAX_STORED_UNREVIEWED_PASSES = 24;
662
+ /** Stages a leftover path may need retried without a second general discovery. */
663
+ declare const UnreviewedStage: Schema.Literals<readonly ["discovery", "specialist", "verification"]>;
664
+ type UnreviewedStage = typeof UnreviewedStage.Type;
665
+ declare const StoredUnreviewedPass_base: Schema.Class<StoredUnreviewedPass, Schema.Struct<{
666
+ readonly stage: Schema.Literals<readonly ["discovery", "specialist", "verification"]>;
667
+ readonly paths: Schema.$Array<Schema.NonEmptyString>;
668
+ }>, {}>;
669
+ /** One failed fan-out pass whose paths should be retried, not rediscovered. */
670
+ declare class StoredUnreviewedPass extends StoredUnreviewedPass_base {}
495
671
  declare const ReviewState_base: Schema.Class<ReviewState, Schema.Struct<{
496
- readonly version: Schema.Literal<1>;
672
+ readonly version: Schema.Literal<2>;
497
673
  readonly repository: Schema.NonEmptyString;
498
674
  readonly pullRequestNumber: Schema.Int;
499
675
  readonly baseRef: Schema.NonEmptyString;
@@ -505,15 +681,32 @@ declare const ReviewState_base: Schema.Class<ReviewState, Schema.Struct<{
505
681
  readonly reviewedPathCount: Schema.Int;
506
682
  readonly unresolvedFindings: Schema.$Array<typeof StoredReviewFinding>;
507
683
  readonly unresolvedConcerns: Schema.$Array<typeof StoredReviewConcern>;
684
+ /** Retryable review gaps carried into the next incremental run's scope. */
685
+ readonly unreviewedPaths: Schema.$Array<Schema.NonEmptyString>;
686
+ /**
687
+ * Which failed pass produced those leftovers. Absent on state-v2 markers
688
+ * written before this field existed; those leftovers still re-enter scope
689
+ * but cannot skip rediscovery. Present (including empty) on new markers.
690
+ */
691
+ readonly unreviewedPasses: Schema.optionalKey<Schema.$Array<typeof StoredUnreviewedPass>>;
692
+ /**
693
+ * True only when the producing run had complete input coverage, no
694
+ * unsettled pass, and nothing carried. Skip-unchanged authority: an
695
+ * unchanged patch may skip re-review only over a settled state.
696
+ */
697
+ readonly settled: Schema.Boolean;
508
698
  readonly lastReviewMode: Schema.Literals<readonly ["incremental", "full"]>;
509
699
  }>, {}>;
510
700
  /**
511
- * Versioned state embedded only after complete input assignment and settled
512
- * configured review assurance. The head plus full-scope fingerprint forms an
513
- * incremental baseline; an absent unresolved item never means the path is
514
- * defect-free. The `acceptedScopeFingerprint` name is retained for wire
515
- * compatibility. Storing hundreds of path strings separately would not fit
516
- * GitHub's bounded review body in the worst case.
701
+ * Versioned state embedded after EVERY completed run that can be signed. The
702
+ * head plus full-scope fingerprint forms an incremental baseline; an absent
703
+ * unresolved item never means the path is defect-free. `unreviewedPaths`
704
+ * carries retryable review gaps (failed passes) forward so the next
705
+ * incremental run re-reviews exactly them plus the new delta — the baseline
706
+ * advances monotonically instead of freezing on one flaky pass and reopening
707
+ * the whole post-baseline scope. The `acceptedScopeFingerprint` name is
708
+ * retained for wire compatibility. Storing hundreds of path strings
709
+ * separately would not fit GitHub's bounded review body in the worst case.
517
710
  */
518
711
  declare class ReviewState extends ReviewState_base {}
519
712
  declare const toStoredFinding: (finding: ReviewFinding) => StoredReviewFinding;
@@ -562,6 +755,12 @@ interface ReviewSelection {
562
755
  readonly files: ReadonlyArray<ChangedFile>;
563
756
  /** Paths whose changes invalidate prior findings, including paths reverted out of the PR. */
564
757
  readonly affectedPaths: ReadonlyArray<string>;
758
+ /**
759
+ * Leftover paths whose contents did not change. Fan-out retries only the
760
+ * recorded failed stages on these paths and keeps their stored findings.
761
+ */
762
+ readonly retryPaths: ReadonlyArray<string>;
763
+ readonly retryStages: ReadonlyArray<UnreviewedStage>;
565
764
  readonly totalFiles: number;
566
765
  readonly baselineSha: string | undefined;
567
766
  readonly priorState: ReviewState | undefined;
@@ -569,6 +768,8 @@ interface ReviewSelection {
569
768
  /** Action-owned authentication capability, constructed at the composition root. */
570
769
  readonly stateAuthenticator?: ReviewStateAuthenticator["Service"] | undefined;
571
770
  }
771
+ /** Three-dot lineage from the reviewed head to the current head is usable. */
772
+ declare const isLineageAncestor: (comparison: ReviewHeadComparison, priorState: ReviewState, currentHeadSha: string) => boolean;
572
773
  /**
573
774
  * Validate that persisted state belongs to this exact PR/base lineage and the
574
775
  * same review profile. A mismatch is a full-review reason, never an error that
@@ -584,6 +785,12 @@ declare const selectReviewRange: (input: {
584
785
  readonly priorState: ReviewState | undefined;
585
786
  readonly comparison: ReviewHeadComparison | undefined;
586
787
  readonly baseComparison?: ReviewHeadComparison | undefined;
788
+ /**
789
+ * Two-dot tree comparison used when the reviewed head is not a git ancestor
790
+ * (rebase, amend, force-push). Intersected with the current PR path set so
791
+ * main-drift outside the pull request never re-enters scope.
792
+ */
793
+ readonly contentComparison?: ReviewHeadComparison | undefined;
587
794
  readonly lookupFailure?: string | undefined;
588
795
  }) => ReviewSelection;
589
796
  declare const ReviewExecutionContext_base: Context.ServiceClass<ReviewExecutionContext, "@effect-agent/pr-review/ReviewExecutionContext", ReviewSelection>;
@@ -595,8 +802,6 @@ declare class ReviewExecutionContext extends ReviewExecutionContext_base {}
595
802
  * the selected delta and may read head context only for that delta's paths.
596
803
  */
597
804
  declare const selectedPullRequestSourceLayer: (selection: ReviewSelection) => Layer.Layer<PullRequestSource, never, PullRequestSource>;
598
- /** Profile fingerprints are SHA-256 over configuration-only signatures. */
599
- declare const computeProfileFingerprint: (signature: string) => Effect.Effect<string>;
600
805
  /** Build the full-surface mission used only to resolve profile guidance. */
601
806
  declare const buildProfileMission: (metadata: PullRequestMetadata, files: ReadonlyArray<ChangedFile>) => ReviewMission;
602
807
  //#endregion
@@ -677,25 +882,23 @@ declare const planPublication: (review: CodeReview, files: ReadonlyArray<Changed
677
882
  readonly modelLabel?: string | undefined;
678
883
  /** Workflow-run URL rendered into the footer. */
679
884
  readonly runUrl?: string | undefined;
680
- /** Observed run usage rendered into the footer. */
885
+ /** Observed whole-run usage rendered into the footer. */
681
886
  readonly usage?: {
682
887
  readonly inputTokens: number;
683
888
  readonly outputTokens: number;
684
889
  } | undefined;
685
- /** What the usage observed: the whole run, or the coordinator only. */
686
- readonly usageScope?: "run" | "coordinator" | undefined;
687
890
  /**
688
891
  * Changeset fingerprint embedded invisibly in the review body so a later
689
892
  * run can skip re-reviewing an unchanged changeset.
690
893
  */
691
894
  readonly fingerprint?: string | undefined;
692
- /** Host-owned coverage; incomplete coverage is rendered and fails the check. */
693
- readonly coverage?: ReviewCoverage | undefined;
694
895
  /** Host-owned path/evidence assignment, separate from review assurance. */
695
896
  readonly inputCoverage?: ReviewInputCoverage | undefined;
696
897
  /** Host-owned discovery/specialist/verification settlement. */
697
898
  readonly assurance?: ReviewAssurance | undefined;
698
- /** Unchanged unresolved items carried from the prior settled assurance baseline. */
899
+ /** Retryable scope this run could not settle; carried to the next run. */
900
+ readonly unreviewedPaths?: ReadonlyArray<string> | undefined;
901
+ /** Unchanged unresolved items carried from the prior reviewed baseline. */
699
902
  readonly carriedFindings?: ReadonlyArray<ReviewFinding> | undefined;
700
903
  readonly carriedConcerns?: ReadonlyArray<ReviewConcern> | undefined;
701
904
  /** Selected review scope, made visible whenever orchestration chose it. */
@@ -860,6 +1063,12 @@ declare const PriorReviews_base: Context.ServiceClass<PriorReviews, "@effect-age
860
1063
  readonly latestState: Effect.Effect<Option.Option<ReviewState>, PriorReviewLookupFailure, ReviewStateAuthenticator>;
861
1064
  /** Compare a previously reviewed head to the live current head. */
862
1065
  readonly compareHeads: (baseSha: string, headSha: string) => Effect.Effect<ReviewHeadComparison, PriorReviewLookupFailure>;
1066
+ /**
1067
+ * Two-dot tree comparison (`base..head`). Used when the reviewed head is
1068
+ * not a git ancestor so a rebase or amend can still name the paths whose
1069
+ * blob contents actually changed.
1070
+ */
1071
+ readonly compareTrees: (baseSha: string, headSha: string) => Effect.Effect<ReviewHeadComparison, PriorReviewLookupFailure>;
863
1072
  }>;
864
1073
  /**
865
1074
  * Read-only view of this package's previously posted reviews on the target
@@ -875,141 +1084,6 @@ declare const gitHubPriorReviewsLayer: Layer.Layer<PriorReviews, never, GitHubRe
875
1084
  */
876
1085
  declare const fingerprintUnchanged: (current: string) => Effect.Effect<boolean, never, PriorReviews>;
877
1086
  //#endregion
878
- //#region src/internal/review-units.d.ts
879
- /** The delegation fan-out bound: one parent Run spawns at most this many children. */
880
- declare const MAX_REVIEW_UNITS = 8;
881
- /** A unit never carries more files than this, regardless of their size. */
882
- declare const MAX_UNIT_FILES = 12;
883
- /** Compatibility export; complete evidence chars now own unit packing. */
884
- declare const UNIT_CHANGED_LINE_BUDGET = 800;
885
- /**
886
- * Bound the complete model-visible evidence assigned to one child. This is a
887
- * character bound rather than a token estimate because it is deterministic,
888
- * provider-independent, and enforced before any model call.
889
- */
890
- declare const UNIT_EVIDENCE_CHAR_BUDGET = 240000;
891
- /** Maximum complete evidence shards placed in one child brief. */
892
- declare const MAX_UNIT_EVIDENCE_SHARDS = 12;
893
- /**
894
- * Keep overflow diagnostics bounded to one plan's total assignment capacity.
895
- * The plan separately records the exact overflow count and every affected
896
- * path, so identifiers are a deterministic diagnostic sample rather than the
897
- * authority for whether input coverage is complete.
898
- */
899
- declare const MAX_REPORTED_UNASSIGNED_EVIDENCE_SHARDS: number;
900
- /** @deprecated Use `MAX_PATCH_CHARS`; this is now the per-shard bound. */
901
- declare const MAX_FILE_EVIDENCE_CHARS = 60000;
902
- /** The merged review never exceeds the `CodeReview` findings bound. */
903
- declare const MAX_MERGED_FINDINGS = 20;
904
- declare const ReviewUnitId: Schema.NonEmptyString;
905
- /** High-risk surfaces that receive an explicit specialist focus label. */
906
- declare const ReviewRiskCategory: Schema.Literals<readonly ["authentication-authorization", "security-boundary", "persistence-durability", "concurrency", "credential-handling", "external-side-effects"]>;
907
- type ReviewRiskCategory = typeof ReviewRiskCategory.Type;
908
- declare const ReviewDiscoveryPerspective: Schema.Literals<readonly ["general", "risk-specialist"]>;
909
- type ReviewDiscoveryPerspective = typeof ReviewDiscoveryPerspective.Type;
910
- declare const ReviewPassId: Schema.NonEmptyString;
911
- declare const ReviewEvidenceShardId: Schema.NonEmptyString;
912
- declare const ReviewEvidenceShard_base: Schema.Class<ReviewEvidenceShard, Schema.Struct<{
913
- readonly shardId: Schema.NonEmptyString;
914
- readonly path: Schema.NonEmptyString;
915
- readonly ordinal: Schema.Int;
916
- readonly total: Schema.Int;
917
- readonly evidenceChars: Schema.Int;
918
- }>, {}>;
919
- /** One complete bounded slice of a changed path's model-visible evidence. */
920
- declare class ReviewEvidenceShard extends ReviewEvidenceShard_base {}
921
- declare const ReviewDiscoveryPass_base: Schema.Class<ReviewDiscoveryPass, Schema.Struct<{
922
- readonly passId: Schema.NonEmptyString;
923
- readonly unitId: Schema.NonEmptyString;
924
- readonly paths: Schema.$Array<Schema.NonEmptyString>;
925
- readonly evidenceShardIds: Schema.$Array<Schema.NonEmptyString>;
926
- readonly perspective: Schema.Literals<readonly ["general", "risk-specialist"]>;
927
- /** Empty for the general pass; explicit deterministic focus for specialists. */
928
- readonly riskCategories: Schema.$Array<Schema.Literals<readonly ["authentication-authorization", "security-boundary", "persistence-durability", "concurrency", "credential-handling", "external-side-effects"]>>;
929
- }>, {}>;
930
- /** One required, independently scoped discovery attempt. */
931
- declare class ReviewDiscoveryPass extends ReviewDiscoveryPass_base {}
932
- declare const ReviewUnit_base: Schema.Class<ReviewUnit, Schema.Struct<{
933
- readonly unitId: Schema.NonEmptyString;
934
- readonly paths: Schema.$Array<Schema.NonEmptyString>;
935
- readonly evidenceShards: Schema.$Array<typeof ReviewEvidenceShard>;
936
- /** additions + deletions across the unit's files, for honest sizing. */
937
- readonly changedLines: Schema.Int;
938
- /** Complete model-visible diff/content evidence assigned to each child. */
939
- readonly evidenceChars: Schema.Int;
940
- /** Host-classified focus labels for the unit's redundant specialist pass. */
941
- readonly riskCategories: Schema.$Array<Schema.Literals<readonly ["authentication-authorization", "security-boundary", "persistence-durability", "concurrency", "credential-handling", "external-side-effects"]>>;
942
- }>, {}>;
943
- /** One bounded slice of the changeset delegated to one child reviewer. */
944
- declare class ReviewUnit extends ReviewUnit_base {}
945
- declare const ReviewUnitPlan_base: Schema.Class<ReviewUnitPlan, Schema.Struct<{
946
- readonly totalFiles: Schema.Int;
947
- /** True when the source returned fewer files than the pull request has. */
948
- readonly truncated: Schema.Boolean;
949
- readonly units: Schema.$Array<typeof ReviewUnit>;
950
- /** Exact discovery calls the coordinator must make. */
951
- readonly discoveryPasses: Schema.$Array<typeof ReviewDiscoveryPass>;
952
- /** Changed files with neither a textual diff nor bounded base/head text. */
953
- readonly undiffablePaths: Schema.$Array<Schema.NonEmptyString>;
954
- /** Assigned paths with one or more evidence shards beyond plan capacity. */
955
- readonly partialEvidencePaths: Schema.$Array<Schema.NonEmptyString>;
956
- /** Exact number of shards beyond the bounded unit capacity. */
957
- readonly unassignedEvidenceShardCount: Schema.Int;
958
- /** Bounded deterministic prefix of the unassigned shard identifiers. */
959
- readonly unassignedEvidenceShardIds: Schema.$Array<Schema.NonEmptyString>;
960
- /**
961
- * Diffable files beyond the fan-out capacity (MAX_REVIEW_UNITS units of
962
- * MAX_UNIT_FILES files). Never silently dropped: the coordinator must name
963
- * them as unreviewed in its summary.
964
- */
965
- readonly unassignedPaths: Schema.$Array<Schema.NonEmptyString>;
966
- }>, {}>;
967
- /** The complete deterministic fan-out plan over one changeset. */
968
- declare class ReviewUnitPlan extends ReviewUnitPlan_base {}
969
- /**
970
- * Deterministic host policy for specialist assignment. It intentionally
971
- * favors false positives: an extra bounded pass costs work, while a missed
972
- * high-risk classification removes redundancy. This is not a claim that the
973
- * keyword policy recognizes every semantically risky change.
974
- */
975
- declare const classifyReviewRisks: (file: ChangedFile) => ReadonlyArray<ReviewRiskCategory>;
976
- /**
977
- * Whether every claimed finding anchor was present in the exact bounded
978
- * evidence shards assigned to one unit. This is stricter than checking the
979
- * full pull-request diff when an oversized path spans multiple units.
980
- */
981
- declare const findingAnchorInUnitEvidence: (finding: ReviewFinding, unit: ReviewUnit, files: ReadonlyArray<ChangedFile>) => boolean;
982
- /**
983
- * Group the changeset into at most `MAX_REVIEW_UNITS` review units.
984
- *
985
- * Deterministic by construction: files are ordered by path (so files sharing
986
- * a directory become neighbors — directory affinity without a heuristic),
987
- * then split into complete line-bounded evidence shards and packed greedily
988
- * under the hard evidence and per-unit shard bounds. Capacity is finite and
989
- * explicit:
990
- *
991
- * - files without a textual diff are still delegated when the source
992
- * recovered complete bounded UTF-8 base/head content. Findings from that
993
- * evidence cannot anchor inline and are reported as concerns;
994
- * - files with neither form of textual evidence surface in
995
- * `undiffablePaths` instead of laundering missing coverage;
996
- * - an oversized path spans as many deterministic shards and units as needed;
997
- * - shards beyond `MAX_REVIEW_UNITS` full units surface explicitly, so a path
998
- * is partial only when finite plan capacity is genuinely exhausted.
999
- */
1000
- declare const planReviewUnits: (files: ReadonlyArray<ChangedFile>, options: {
1001
- readonly totalChangedFiles: number;
1002
- }) => ReviewUnitPlan;
1003
- /**
1004
- * Merge the children's findings into one bounded, deterministic list: dedupe
1005
- * findings sharing an anchor (path + line range) keeping the most severe —
1006
- * and, at equal severity, the first in declaration order — then rank by
1007
- * severity, path, and line, and cap at the `CodeReview` findings bound.
1008
- * This is the merge policy the coordinator's instructions state in prose;
1009
- * pinning it here keeps the policy itself deterministic and testable.
1010
- */
1011
- declare const rankAndDedupeFindings: (findings: ReadonlyArray<ReviewFinding>) => ReadonlyArray<ReviewFinding>;
1012
- //#endregion
1013
1087
  //#region src/internal/fan-out.d.ts
1014
1088
  /** One discovery pass returns at most this many anchored candidates. */
1015
1089
  declare const MAX_CHILD_FINDINGS = 6;
@@ -1017,8 +1091,14 @@ declare const MAX_CHILD_FINDINGS = 6;
1017
1091
  declare const MAX_CHILD_CONCERNS = 3;
1018
1092
  /** Every unit receives independent general and specialist discovery passes. */
1019
1093
  declare const MAX_UNIT_CANDIDATES: number;
1020
- /** General + specialist discovery for every unit, then one verifier per unit. */
1094
+ /**
1095
+ * General + specialist discovery for every unit, then one verifier per unit.
1096
+ * The one-retry budget doubles the worst-case child Run count, but the
1097
+ * schedule itself never exceeds this bound.
1098
+ */
1021
1099
  declare const MAX_REVIEW_CHILDREN: number;
1100
+ /** Bounded structured concurrency across units; passes inside a unit are sequential. */
1101
+ declare const REVIEW_UNIT_CONCURRENCY = 4;
1022
1102
  /** Structural minimum for a child that exposes no tools. */
1023
1103
  declare const MAX_FILE_REVIEW_TOOL_CALLS = 1;
1024
1104
  declare const ReviewWorkPhase: Schema.Literals<readonly ["discovery", "verification"]>;
@@ -1061,8 +1141,8 @@ declare const CandidateAssessment_base: Schema.Class<CandidateAssessment, Schema
1061
1141
  declare class CandidateAssessment extends CandidateAssessment_base {}
1062
1142
  /**
1063
1143
  * Exact suggestion settlement shape: a carried suggestion must be settled and
1064
- * nothing else may be. Enforced identically by the live delegation projection
1065
- * and the independent host coverage fold.
1144
+ * nothing else may be. A verification report that violates it is treated as a
1145
+ * misbehaving pass and retried within the pass budget.
1066
1146
  */
1067
1147
  declare const assessmentSettlesSuggestionExactly: (assessment: CandidateAssessment, candidate: ReviewCandidate) => boolean;
1068
1148
  /**
@@ -1083,19 +1163,6 @@ declare const DiscoveredConcern_base: Schema.Class<DiscoveredConcern, Schema.Str
1083
1163
  * remains path-free after the host confirms and projects it.
1084
1164
  */
1085
1165
  declare class DiscoveredConcern extends DiscoveredConcern_base {}
1086
- declare const FileReviewRequest_base: Schema.Class<FileReviewRequest, Schema.Struct<{
1087
- readonly phase: Schema.Literals<readonly ["discovery", "verification"]>;
1088
- readonly workId: Schema.NonEmptyString;
1089
- readonly unitId: Schema.NonEmptyString;
1090
- readonly paths: Schema.$Array<Schema.NonEmptyString>;
1091
- readonly evidenceShardIds: Schema.$Array<Schema.NonEmptyString>;
1092
- readonly perspective: Schema.Literals<readonly ["general", "risk-specialist", "candidate-verification"]>;
1093
- readonly riskCategories: Schema.$Array<Schema.Literals<readonly ["authentication-authorization", "security-boundary", "persistence-durability", "concurrency", "credential-handling", "external-side-effects"]>>;
1094
- /** Empty for discovery; the exact discovered set for unit verification. */
1095
- readonly candidates: Schema.$Array<Schema.Union<readonly [typeof FindingCandidate, typeof ConcernCandidate]>>;
1096
- }>, {}>;
1097
- /** Strict-object coordinator request for either discovery or verification. */
1098
- declare class FileReviewRequest extends FileReviewRequest_base {}
1099
1166
  declare const FileReviewEvidence_base: Schema.Class<FileReviewEvidence, Schema.Struct<{
1100
1167
  readonly shardId: Schema.NonEmptyString;
1101
1168
  readonly path: Schema.NonEmptyString;
@@ -1115,6 +1182,7 @@ declare const FileReviewBrief_base: Schema.Class<FileReviewBrief, Schema.Struct<
1115
1182
  readonly evidenceShardIds: Schema.$Array<Schema.NonEmptyString>;
1116
1183
  readonly perspective: Schema.Literals<readonly ["general", "risk-specialist", "candidate-verification"]>;
1117
1184
  readonly riskCategories: Schema.$Array<Schema.Literals<readonly ["authentication-authorization", "security-boundary", "persistence-durability", "concurrency", "credential-handling", "external-side-effects"]>>;
1185
+ /** Empty for discovery; the exact discovered set for unit verification. */
1118
1186
  readonly candidates: Schema.$Array<Schema.Union<readonly [typeof FindingCandidate, typeof ConcernCandidate]>>;
1119
1187
  readonly evidence: Schema.$Array<typeof FileReviewEvidence>;
1120
1188
  }>, {}>;
@@ -1131,27 +1199,17 @@ declare const FileReviewReport_base: Schema.Class<FileReviewReport, Schema.Struc
1131
1199
  }>, {}>;
1132
1200
  /** Child output; phase-inapplicable collections must be empty. */
1133
1201
  declare class FileReviewReport extends FileReviewReport_base {}
1134
- declare const FileReviewUnitResult_base: Schema.Class<FileReviewUnitResult, Schema.Struct<{
1135
- readonly phase: Schema.Literals<readonly ["discovery", "verification"]>;
1136
- readonly workId: Schema.NonEmptyString;
1137
- readonly unitId: Schema.NonEmptyString;
1138
- readonly candidates: Schema.$Array<Schema.Union<readonly [typeof FindingCandidate, typeof ConcernCandidate]>>;
1139
- readonly fileSummaries: Schema.$Array<typeof WalkthroughEntry>;
1140
- readonly assessments: Schema.$Array<typeof CandidateAssessment>;
1141
- }>, {}>;
1142
- /** Bounded coordinator-visible result with host-assigned candidate IDs. */
1143
- declare class FileReviewUnitResult extends FileReviewUnitResult_base {}
1144
- declare const FileReviewUnitFailed_base: Schema.Class<FileReviewUnitFailed, Schema.TaggedStruct<"FileReviewUnitFailed", {
1145
- readonly childErrorTag: Schema.NonEmptyString;
1146
- readonly message: Schema.String;
1147
- }>, import("effect/Cause").YieldableError>;
1148
- declare class FileReviewUnitFailed extends FileReviewUnitFailed_base {}
1149
- declare const FileReviewWorkRejected_base: Schema.Class<FileReviewWorkRejected, Schema.TaggedStruct<"FileReviewWorkRejected", {
1202
+ declare const ReviewPassMisbehaved_base: Schema.Class<ReviewPassMisbehaved, Schema.TaggedStruct<"ReviewPassMisbehaved", {
1150
1203
  readonly workId: Schema.NonEmptyString;
1151
1204
  readonly reason: Schema.NonEmptyString;
1152
1205
  }>, import("effect/Cause").YieldableError>;
1153
- declare class FileReviewWorkRejected extends FileReviewWorkRejected_base {}
1154
- declare const FileReviewFailure: Schema.Union<readonly [typeof FileReviewUnitFailed, typeof FileReviewWorkRejected]>;
1206
+ /**
1207
+ * A structurally valid child report that does not answer the scheduled pass:
1208
+ * wrong identity, phase-inapplicable fields, or an inexact assessment set.
1209
+ * Retried once like any other pass fault, because it is model misbehavior,
1210
+ * not evidence about the code under review.
1211
+ */
1212
+ declare class ReviewPassMisbehaved extends ReviewPassMisbehaved_base {}
1155
1213
  interface FanOutInstructionOptions {
1156
1214
  readonly guidance?: string | ReadonlyArray<string> | undefined;
1157
1215
  }
@@ -1159,110 +1217,59 @@ interface FanOutInstructionOptions {
1159
1217
  declare const makeFileReviewerInstructions: (options?: FanOutInstructionOptions) => (brief: FileReviewBrief) => string;
1160
1218
  declare const fileReviewerInstructions: (brief: FileReviewBrief) => string;
1161
1219
  declare const FileReviewToolkit: Toolkit.Toolkit<{}>;
1162
- /** Compatibility export: the evidence-only child has no handler requirements. */
1163
- declare const FileReviewToolkitLayer: Layer.Layer<never, never, never>;
1164
1220
  declare const defaultFileReviewerPolicy: AgentPolicy;
1165
- declare const fileReviewPolicy: SubagentPolicy;
1166
- declare const mapFileReviewChildFailure: (failure: {
1167
- readonly _tag: string;
1168
- readonly message?: string;
1169
- }) => FileReviewUnitFailed;
1170
- declare const makeFileReviewDelegation: (child: ReturnType<typeof makeFileReviewerDefinition>) => import("effect-agent").SubagentDelegation<"delegate_file_review", typeof FileReviewBrief, typeof FileReviewReport, (brief: FileReviewBrief) => string, {}, typeof FileReviewRequest, typeof FileReviewUnitResult, Schema.Union<readonly [typeof FileReviewUnitFailed, typeof FileReviewWorkRejected]>, PullRequestSource, PullRequestSource, "return">;
1171
- declare const ListReviewUnitsQuery_base: Schema.Class<ListReviewUnitsQuery, Schema.Struct<{
1172
- readonly scope: Schema.Literal<"all">;
1173
- }>, {}>;
1174
- declare class ListReviewUnitsQuery extends ListReviewUnitsQuery_base {}
1175
- declare const ListReviewUnits: Tool.Tool<"list_review_units", {
1176
- readonly parameters: typeof ListReviewUnitsQuery;
1177
- readonly success: typeof ReviewUnitPlan;
1178
- readonly failure: typeof PullRequestSourceFailure;
1179
- readonly failureMode: "error";
1180
- }, PullRequestSource>;
1181
- declare const FanOutCoordinatorToolkit: Toolkit.Toolkit<{
1182
- readonly list_review_units: Tool.Tool<"list_review_units", {
1183
- readonly parameters: typeof ListReviewUnitsQuery;
1184
- readonly success: typeof ReviewUnitPlan;
1185
- readonly failure: typeof PullRequestSourceFailure;
1186
- readonly failureMode: "error";
1187
- }, PullRequestSource>;
1188
- }>;
1189
- declare const FanOutCoordinatorToolkitLayer: Layer.Layer<Tool.Handler<"list_review_units">, never, never>;
1190
- declare const makeFanOutReviewInstructions: (options?: FanOutInstructionOptions & {
1191
- readonly maxFindings?: number | undefined;
1192
- }) => (mission: ReviewMission) => string;
1193
- declare const fanOutReviewInstructions: (mission: ReviewMission) => string;
1194
- declare const defaultFanOutPolicy: AgentPolicy;
1195
- interface FanOutReviewSuite {
1196
- readonly child: ReturnType<typeof makeFileReviewerDefinition>;
1197
- readonly parent: ReturnType<typeof makeFanOutReviewerDefinition>;
1198
- readonly delegation: ReturnType<typeof makeFileReviewDelegation>;
1199
- }
1200
1221
  declare const makeFileReviewerDefinition: (options?: FanOutInstructionOptions) => import("effect-agent").Definition<typeof FileReviewBrief, typeof FileReviewReport, (brief: FileReviewBrief) => string, Toolkit.Toolkit<{}>, undefined>;
1201
- declare const makeFanOutReviewerDefinition: (options: FanOutInstructionOptions & {
1202
- readonly maxFindings?: number | undefined;
1203
- }, delegation: ReturnType<typeof makeFileReviewDelegation>) => import("effect-agent").Definition<typeof ReviewMission, typeof CodeReview, (mission: ReviewMission) => string, Toolkit.Toolkit<{
1204
- readonly delegate_file_review: Tool.Tool<"delegate_file_review", {
1205
- readonly parameters: typeof FileReviewRequest;
1206
- readonly success: Schema.Union<readonly [typeof FileReviewUnitResult, import("effect-agent").SubagentContainedFailure<Schema.Union<readonly [typeof FileReviewUnitFailed, typeof FileReviewWorkRejected]>>]>;
1207
- readonly failure: import("effect-agent").SubagentReturnModeFailure;
1208
- readonly failureMode: "error";
1209
- }, import("effect-agent").AgentSpawner | import("effect-agent").IdGenerator | import("effect-agent").RunEventSink | import("effect-agent").SubagentDurability>;
1210
- readonly list_review_units: Tool.Tool<"list_review_units", {
1211
- readonly parameters: typeof ListReviewUnitsQuery;
1212
- readonly success: typeof ReviewUnitPlan;
1213
- readonly failure: typeof PullRequestSourceFailure;
1214
- readonly failureMode: "error";
1215
- }, PullRequestSource>;
1216
- }>, undefined>;
1217
- interface FanOutSuiteOptions extends FanOutInstructionOptions {
1222
+ declare const FileReviewer: import("effect-agent").Definition<typeof FileReviewBrief, typeof FileReviewReport, (brief: FileReviewBrief) => string, Toolkit.Toolkit<{}>, undefined>;
1223
+ /** The exact child binding shape the host pipeline schedules. */
1224
+ type FileReviewerBinding<Provider, ModelProvides, ModelRequires> = RuntimeBinding<typeof FileReviewBrief, typeof FileReviewReport, ReturnType<typeof makeFileReviewerInstructions>, Toolkit.Tools<typeof FileReviewToolkit>, Provider, ModelProvides, ModelRequires>;
1225
+ /** Everything one settled fan-out pipeline run produced, before publication. */
1226
+ interface FanOutPipelineOutcome {
1227
+ readonly review: CodeReview;
1228
+ readonly assurance: ReviewAssurance;
1229
+ readonly plan: ReviewUnitPlan;
1230
+ /** Paths of units with an unsettled pass — retryable scope for the next run. */
1231
+ readonly unreviewedPaths: ReadonlyArray<string>;
1232
+ /** Failed stages paired with the leftover paths they still own. */
1233
+ readonly unreviewedPasses: ReadonlyArray<{
1234
+ readonly stage: FailedReviewPass["stage"];
1235
+ readonly paths: ReadonlyArray<string>;
1236
+ }>;
1237
+ /** Total settled child turns across every scheduled pass. */
1238
+ readonly turns: number;
1239
+ }
1240
+ interface FanOutPipelineInput {
1241
+ readonly files: ReadonlyArray<ChangedFile>;
1242
+ readonly anchorFiles: ReadonlyArray<ChangedFile>;
1243
+ readonly totalChangedFiles: number;
1218
1244
  readonly maxFindings?: number | undefined;
1245
+ /** Shared run budget observed by every child pass. */
1246
+ readonly budget?: RunBudgetHook<BudgetExceeded | BudgetAdapterError> | undefined;
1247
+ /**
1248
+ * Unchanged leftover paths from a prior failed pass. Those units retry only
1249
+ * the recorded stages — no second general discovery on files nobody touched.
1250
+ */
1251
+ readonly retry?: {
1252
+ readonly paths: ReadonlyArray<string>;
1253
+ readonly stages: ReadonlyArray<FailedReviewPass["stage"]>;
1254
+ } | undefined;
1219
1255
  }
1220
- declare const makeFanOutReviewSuite: (options?: FanOutSuiteOptions) => FanOutReviewSuite;
1221
- declare const FileReviewer: import("effect-agent").Definition<typeof FileReviewBrief, typeof FileReviewReport, (brief: FileReviewBrief) => string, Toolkit.Toolkit<{}>, undefined>;
1222
- declare const FanOutReviewer: import("effect-agent").Definition<typeof ReviewMission, typeof CodeReview, (mission: ReviewMission) => string, Toolkit.Toolkit<{
1223
- readonly delegate_file_review: Tool.Tool<"delegate_file_review", {
1224
- readonly parameters: typeof FileReviewRequest;
1225
- readonly success: Schema.Union<readonly [typeof FileReviewUnitResult, import("effect-agent").SubagentContainedFailure<Schema.Union<readonly [typeof FileReviewUnitFailed, typeof FileReviewWorkRejected]>>]>;
1226
- readonly failure: import("effect-agent").SubagentReturnModeFailure;
1227
- readonly failureMode: "error";
1228
- }, import("effect-agent").AgentSpawner | import("effect-agent").IdGenerator | import("effect-agent").RunEventSink | import("effect-agent").SubagentDurability>;
1229
- readonly list_review_units: Tool.Tool<"list_review_units", {
1230
- readonly parameters: typeof ListReviewUnitsQuery;
1231
- readonly success: typeof ReviewUnitPlan;
1232
- readonly failure: typeof PullRequestSourceFailure;
1233
- readonly failureMode: "error";
1234
- }, PullRequestSource>;
1235
- }>, undefined>;
1236
- declare const fileReviewDelegation: import("effect-agent").SubagentDelegation<"delegate_file_review", typeof FileReviewBrief, typeof FileReviewReport, (brief: FileReviewBrief) => string, {}, typeof FileReviewRequest, typeof FileReviewUnitResult, Schema.Union<readonly [typeof FileReviewUnitFailed, typeof FileReviewWorkRejected]>, PullRequestSource, PullRequestSource, "return">;
1237
- declare const DelegateFileReview: Tool.Tool<"delegate_file_review", {
1238
- readonly parameters: typeof FileReviewRequest;
1239
- readonly success: Schema.Union<readonly [typeof FileReviewUnitResult, import("effect-agent").SubagentContainedFailure<Schema.Union<readonly [typeof FileReviewUnitFailed, typeof FileReviewWorkRejected]>>]>;
1240
- readonly failure: import("effect-agent").SubagentReturnModeFailure;
1241
- readonly failureMode: "error";
1242
- }, import("effect-agent").AgentSpawner | import("effect-agent").IdGenerator | import("effect-agent").RunEventSink | import("effect-agent").SubagentDurability>;
1243
- declare const FanOutReviewToolkit: Toolkit.Toolkit<{
1244
- readonly delegate_file_review: Tool.Tool<"delegate_file_review", {
1245
- readonly parameters: typeof FileReviewRequest;
1246
- readonly success: Schema.Union<readonly [typeof FileReviewUnitResult, import("effect-agent").SubagentContainedFailure<Schema.Union<readonly [typeof FileReviewUnitFailed, typeof FileReviewWorkRejected]>>]>;
1247
- readonly failure: import("effect-agent").SubagentReturnModeFailure;
1248
- readonly failureMode: "error";
1249
- }, import("effect-agent").AgentSpawner | import("effect-agent").IdGenerator | import("effect-agent").RunEventSink | import("effect-agent").SubagentDurability>;
1250
- readonly list_review_units: Tool.Tool<"list_review_units", {
1251
- readonly parameters: typeof ListReviewUnitsQuery;
1252
- readonly success: typeof ReviewUnitPlan;
1253
- readonly failure: typeof PullRequestSourceFailure;
1254
- readonly failureMode: "error";
1255
- }, PullRequestSource>;
1256
- }>;
1257
- declare const FileReviewDelegationFailure: import("effect-agent").SubagentContainedFailure<Schema.Union<readonly [typeof FileReviewUnitFailed, typeof FileReviewWorkRejected]>>;
1258
- declare const fanOutHandlersLayerFor: (delegation: ReturnType<typeof makeFileReviewDelegation>) => <Provider, ModelProvides, ModelRequires>(childBinding: RuntimeBinding<typeof FileReviewBrief, typeof FileReviewReport, ReturnType<typeof makeFileReviewerInstructions>, Toolkit.Tools<typeof FileReviewToolkit>, Provider, ModelProvides, ModelRequires>) => Layer.Layer<Tool.Handler<"delegate_file_review">, never, import("effect-agent").SubagentLayerRequirements<typeof FileReviewBrief, typeof FileReviewReport, (brief: FileReviewBrief) => string, {}, Provider, ModelProvides, ModelRequires, PullRequestSource, PullRequestSource, never, {
1259
- readonly _tag: string;
1260
- readonly message?: string;
1261
- }, never>>;
1262
- declare const fanOutHandlersLayer: <Provider, ModelProvides, ModelRequires>(childBinding: RuntimeBinding<typeof FileReviewBrief, typeof FileReviewReport, ReturnType<typeof makeFileReviewerInstructions>, Toolkit.Tools<typeof FileReviewToolkit>, Provider, ModelProvides, ModelRequires>) => Layer.Layer<Tool.Handler<"delegate_file_review">, never, import("effect-agent").SubagentLayerRequirements<typeof FileReviewBrief, typeof FileReviewReport, (brief: FileReviewBrief) => string, {}, Provider, ModelProvides, ModelRequires, PullRequestSource, PullRequestSource, never, {
1263
- readonly _tag: string;
1264
- readonly message?: string;
1265
- }, never>>;
1256
+ /**
1257
+ * Run the complete host-scheduled fan-out pipeline over one selected
1258
+ * changeset snapshot: plan, independent discovery, exact verification, and a
1259
+ * deterministic host-composed CodeReview from verifier-confirmed candidates
1260
+ * only. The verdict is derived from confirmed severities, never model prose.
1261
+ */
1262
+ declare const runFanOutReview: <Provider, ModelProvides, ModelRequires>(binding: FileReviewerBinding<Provider, ModelProvides, ModelRequires>, input: FanOutPipelineInput) => Effect.Effect<{
1263
+ review: CodeReview;
1264
+ assurance: ReviewAssurance;
1265
+ plan: ReviewUnitPlan;
1266
+ unreviewedPaths: string[];
1267
+ unreviewedPasses: {
1268
+ stage: "discovery" | "specialist" | "verification";
1269
+ paths: readonly string[];
1270
+ }[];
1271
+ turns: number;
1272
+ }, never, import("effect-agent").IdGenerator | Exclude<Exclude<ModelRequires, import("effect-agent").EngineProvidedToolServices>, import("effect/Scope").Scope>>;
1266
1273
  //#endregion
1267
- export { MAX_REPORTED_UNASSIGNED_EVIDENCE_SHARDS as $, ReviewFinding as $n, ReviewMode as $t, MAX_REVIEW_CHILDREN as A, anchorViolation as An, commentableLines as Ar, parseGitHubSubmittedAt as At, fanOutHandlersLayer as B, FindingSeverity as Bn, retireStaleReviews as Bt, FileReviewer as C, ReviewCoverage as Cn, normalizeRepoRelativePath as Cr, PublishedReview as Ct, MAX_CHILD_CONCERNS as D, assessReviewCoverage as Dn, MAX_REVIEW_CONTENT_CHARS as Dr, gitHubPullRequestSourceLayer as Dt, ListReviewUnitsQuery as E, ReviewShape as En, ChangedPath as Er, gitHubPriorReviewsLayer as Et, ReviewWorkPhase as F, FileDiffView as Fn, ReviewRetirementHost as Ft, fileReviewerInstructions as G, MAX_PATCH_CHARS as Gn, estimateReviewEffort as Gt, fanOutReviewInstructions as H, ListChangedFilesQuery as Hn, ReviewCommentDraft as Ht, assessmentSettlesSuggestionExactly as I, FileReviewEvidenceChunk as In, ReviewRetirementInput as It, makeFileReviewerInstructions as J, PullRequestReviewer as Jn, renderAgentPrompt as Jt, makeFanOutReviewInstructions as K, MAX_WALKTHROUGH_ENTRIES as Kn, planPublication as Kt, confirmedFindingForPublication as L, FileSlice as Ln, ReviewRetirementReport as Lt, ReviewCandidate as M, ChangedFilesView as Mn, isReviewableFile as Mr, RetirableReviewComment as Mt, ReviewCandidateId as N, CodeReview as Nn, parsePatch as Nr, ReviewRetirementDecision as Nt, MAX_CHILD_FINDINGS as O, assessReviewPipeline as On, PatchLine as Or, gitHubReviewPublisherLayer as Ot, ReviewWorkPerspective as P, FileDiffQuery as Pn, renderReviewContent as Pr, ReviewRetirementFailure as Pt, MAX_MERGED_FINDINGS as Q, ReviewConcern as Qn, ReviewHeadComparison as Qt, defaultFanOutPolicy as R, FileSliceQuery as Rn, decideReviewRetirement as Rt, FileReviewWorkRejected as S, ReviewAssurance as Sn, ReviewInputViolation as Sr, PriorReviews as St, ListReviewUnits as T, ReviewPipelineAssessment as Tn, ChangedFileStatus as Tr, fingerprintUnchanged as Tt, fileReviewDelegation as U, MAX_CONCERNS as Un, ReviewEvent as Ut, fanOutHandlersLayerFor as V, ListChangedFiles as Vn, AGENT_PROMPT_PREAMBLE as Vt, fileReviewPolicy as W, MAX_FINDINGS as Wn, ReviewPublicationPlan as Wt, reviewCandidateSubjectKey as X, ReadFile as Xn, MAX_REVIEW_STATE_MARKER_CHARS as Xt, mapFileReviewChildFailure as Y, REVIEW_TOOL_RESULT_MAX_BYTES as Yn, GitCommitSha as Yt, MAX_FILE_EVIDENCE_CHARS as Z, ReadFileDiff as Zn, ReviewExecutionContext as Zt, FileReviewRequest as _, unavailableReviewStateAuthenticatorLayer as _n, MAX_CHANGED_FILES as _r, rankAndDedupeFindings as _t, FanOutCoordinatorToolkit as a, ReviewStateMarker as an, ReviewVerdict as ar, ReviewEvidenceShard as at, FileReviewUnitFailed as b, FailedReviewPass as bn, PullRequestSource as br, GitHubReviewTarget as bt, FanOutReviewSuite as c, StoredReviewFinding as cn, defaultReviewPolicy as cr, ReviewRiskCategory as ct, FanOutSuiteOptions as d, fromStoredConcern as dn, listChangedFilesHandler as dr, ReviewUnitPlan as dt, ReviewScopeMode as en, ReviewGuidance as er, MAX_REVIEW_UNITS as et, FileReviewBrief as f, fromStoredFinding as fn, makeReviewInstructions as fr, UNIT_CHANGED_LINE_BUDGET as ft, FileReviewReport as g, toStoredFinding as gn, reviewInstructions as gr, planReviewUnits as gt, FileReviewFailure as h, toStoredConcern as hn, resolveGuidance as hr, findingAnchorInUnitEvidence as ht, DiscoveredConcern as i, ReviewStateAuthenticator as in, ReviewToolkitLayer as ir, ReviewDiscoveryPerspective as it, MAX_UNIT_CANDIDATES as j, ChangedFileSummary as jn, hasReviewableContent as jr, RetirableReview as jt, MAX_FILE_REVIEW_TOOL_CALLS as k, collectUnitFileSummaries as kn, annotatePatch as kr, gitHubReviewRetirementHostLayer as kt, FanOutReviewToolkit as l, buildProfileMission as ln, fileDiffView as lr, ReviewUnit as lt, FileReviewEvidence as m, selectedPullRequestSourceLayer as mn, readFileHandler as mr, classifyReviewRisks as mt, ConcernCandidate as n, ReviewState as nn, ReviewMission as nr, MAX_UNIT_FILES as nt, FanOutCoordinatorToolkitLayer as o, ReviewStateMarkerTooLarge as on, WalkthroughEntry as or, ReviewEvidenceShardId as ot, FileReviewDelegationFailure as p, selectReviewRange as pn, readFileDiffHandler as pr, UNIT_EVIDENCE_CHAR_BUDGET as pt, makeFanOutReviewSuite as q, MAX_WALKTHROUGH_SUMMARY_CHARS as qn, planWalkthrough as qt, DelegateFileReview as r, ReviewStateAuthenticationFailure as rn, ReviewToolkit as rr, ReviewDiscoveryPass as rt, FanOutInstructionOptions as s, StoredReviewConcern as sn, clampMaxFindings as sr, ReviewPassId as st, CandidateAssessment as t, ReviewSelection as tn, ReviewInstructionOptions as tr, MAX_UNIT_EVIDENCE_SHARDS as tt, FanOutReviewer as u, computeProfileFingerprint as un, fileReviewEvidenceChunks as ur, ReviewUnitId as ut, FileReviewToolkit as v, validateReviewState as vn, MAX_FILE_CHARS as vr, DEFAULT_GITHUB_REVIEW_AUTHOR_LOGIN as vt, FindingCandidate as w, ReviewInputCoverage as wn, ChangedFile as wr, ReviewPublisher as wt, FileReviewUnitResult as x, FailedReviewUnit as xn, PullRequestSourceFailure as xr, PriorReviewLookupFailure as xt, FileReviewToolkitLayer as y, webCryptoReviewStateAuthenticatorLayer as yn, PullRequestMetadata as yr, GitHubApiFailure as yt, defaultFileReviewerPolicy as z, FindingCategory as zn, hasReviewMetadataMarker as zt };
1268
- //# sourceMappingURL=fan-out-n-00ppWr.d.mts.map
1274
+ export { decideReviewRetirement as $, listChangedFilesHandler as $n, MAX_REVIEW_UNITS as $t, makeFileReviewerInstructions as A, ListChangedFilesQuery as An, fromStoredFinding as At, fingerprintUnchanged as B, ReviewConcern as Bn, FailedReviewUnit as Bt, ReviewWorkPerspective as C, FileDiffView as Cn, ReviewStateMarkerTooLarge as Ct, defaultFileReviewerPolicy as D, FindingCategory as Dn, UnreviewedStage as Dt, confirmedFindingForPublication as E, FileSliceQuery as En, StoredUnreviewedPass as Et, GitHubReviewTarget as F, MAX_WALKTHROUGH_SUMMARY_CHARS as Fn, toStoredFinding as Ft, parseGitHubSubmittedAt as G, ReviewToolkit as Gn, assessFlatReview as Gt, gitHubPullRequestSourceLayer as H, ReviewGuidance as Hn, ReviewAssurance as Ht, PriorReviewLookupFailure as I, PullRequestReviewer as In, unavailableReviewStateAuthenticatorLayer as It, ReviewRetirementDecision as J, WalkthroughEntry as Jn, fanOutInputCoverage as Jt, RetirableReview as K, ReviewToolkitLayer as Kn, boundedListReason as Kt, PriorReviews as L, REVIEW_TOOL_RESULT_MAX_BYTES as Ln, validateReviewState as Lt, runFanOutReview as M, MAX_FINDINGS as Mn, selectReviewRange as Mt, DEFAULT_GITHUB_REVIEW_AUTHOR_LOGIN as N, MAX_PATCH_CHARS as Nn, selectedPullRequestSourceLayer as Nt, fileReviewerInstructions as O, FindingSeverity as On, buildProfileMission as Ot, GitHubApiFailure as P, MAX_WALKTHROUGH_ENTRIES as Pn, toStoredConcern as Pt, ReviewRetirementReport as Q, fileReviewEvidenceChunks as Qn, MAX_REPORTED_UNASSIGNED_EVIDENCE_SHARDS as Qt, PublishedReview as R, ReadFile as Rn, webCryptoReviewStateAuthenticatorLayer as Rt, ReviewPassMisbehaved as S, FileDiffQuery as Sn, renderReviewContent as Sr, ReviewStateMarker as St, assessmentSettlesSuggestionExactly as T, FileSlice as Tn, StoredReviewFinding as Tt, gitHubReviewPublisherLayer as U, ReviewInstructionOptions as Un, ReviewCoverage as Ut, gitHubPriorReviewsLayer as V, ReviewFinding as Vn, FlatReviewAssessment as Vt, gitHubReviewRetirementHostLayer as W, ReviewMission as Wn, ReviewInputCoverage as Wt, ReviewRetirementHost as X, defaultReviewPolicy as Xn, MAX_FILE_EVIDENCE_CHARS as Xt, ReviewRetirementFailure as Y, clampMaxFindings as Yn, flatAssurance as Yt, ReviewRetirementInput as Z, fileDiffView as Zn, MAX_MERGED_FINDINGS as Zt, MAX_REVIEW_CHILDREN as _, rankAndDedupeFindings as _n, annotatePatch as _r, ReviewScopeMode as _t, FanOutPipelineInput as a, ReviewEvidenceShardId as an, MAX_CHANGED_FILES as ar, ReviewPublicationPlan as at, ReviewCandidate as b, ChangedFilesView as bn, isReviewableFile as br, ReviewStateAuthenticationFailure as bt, FileReviewEvidence as c, ReviewUnit as cn, PullRequestSource as cr, planWalkthrough as ct, FileReviewer as d, UNIT_CHANGED_LINE_BUDGET as dn, normalizeRepoRelativePath as dr, MAX_REVIEW_STATE_MARKER_CHARS as dt, MAX_UNIT_EVIDENCE_SHARDS as en, makeReviewInstructions as er, hasReviewMetadataMarker as et, FileReviewerBinding as f, UNIT_EVIDENCE_CHAR_BUDGET as fn, ChangedFile as fr, MAX_STORED_UNREVIEWED_PASSES as ft, MAX_FILE_REVIEW_TOOL_CALLS as g, rankAndDedupeConcerns as gn, PatchLine as gr, ReviewMode as gt, MAX_CHILD_FINDINGS as h, planReviewUnits as hn, MAX_REVIEW_CONTENT_CHARS as hr, ReviewHeadComparison as ht, FanOutInstructionOptions as i, ReviewEvidenceShard as in, reviewInstructions as ir, ReviewEvent as it, reviewCandidateSubjectKey as j, MAX_CONCERNS as jn, isLineageAncestor as jt, makeFileReviewerDefinition as k, ListChangedFiles as kn, fromStoredConcern as kt, FileReviewReport as l, ReviewUnitId as ln, PullRequestSourceFailure as lr, renderAgentPrompt as lt, MAX_CHILD_CONCERNS as m, findingAnchorInUnitEvidence as mn, ChangedPath as mr, ReviewExecutionContext as mt, ConcernCandidate as n, ReviewDiscoveryPass as nn, readFileHandler as nr, AGENT_PROMPT_PREAMBLE as nt, FanOutPipelineOutcome as o, ReviewPassId as on, MAX_FILE_CHARS as or, estimateReviewEffort as ot, FindingCandidate as p, classifyReviewRisks as pn, ChangedFileStatus as pr, MAX_STORED_UNREVIEWED_PATHS as pt, RetirableReviewComment as q, ReviewVerdict as qn, compatibilityCoverage as qt, DiscoveredConcern as r, ReviewDiscoveryPerspective as rn, resolveGuidance as rr, ReviewCommentDraft as rt, FileReviewBrief as s, ReviewRiskCategory as sn, PullRequestMetadata as sr, planPublication as st, CandidateAssessment as t, MAX_UNIT_FILES as tn, readFileDiffHandler as tr, retireStaleReviews as tt, FileReviewToolkit as u, ReviewUnitPlan as un, ReviewInputViolation as ur, GitCommitSha as ut, MAX_UNIT_CANDIDATES as v, anchorViolation as vn, commentableLines as vr, ReviewSelection as vt, ReviewWorkPhase as w, FileReviewEvidenceChunk as wn, StoredReviewConcern as wt, ReviewCandidateId as x, CodeReview as xn, parsePatch as xr, ReviewStateAuthenticator as xt, REVIEW_UNIT_CONCURRENCY as y, ChangedFileSummary as yn, hasReviewableContent as yr, ReviewState as yt, ReviewPublisher as z, ReadFileDiff as zn, FailedReviewPass as zt };
1275
+ //# sourceMappingURL=fan-out-Bi1v0VaU.d.mts.map