@effect-agent/pr-review 0.1.0-beta.6 → 0.1.0-beta.8

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/action.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { W as GitHubApiFailure, Y as ReviewPublisher, hn as PullRequestSourceFailure, lt as ReviewMode, mn as PullRequestSource, mt as ReviewStateAuthenticator, pn as PullRequestMetadata, q as PriorReviews, vn as ChangedFile } from "./fan-out-cMt8_Olv.mjs";
1
+ import { W as GitHubApiFailure, Y as ReviewPublisher, hn as PullRequestSourceFailure, lt as ReviewMode, mn as PullRequestSource, mt as ReviewStateAuthenticator, pn as PullRequestMetadata, q as PriorReviews, vn as ChangedFile } from "./fan-out-BBEATQwc.mjs";
2
2
  import { EffortPosition, InvalidEffortInput, ReviewProvider, ReviewRunOutcome, ReviewTargetUnresolved, RunReviewOptions } from "./index.mjs";
3
3
  import { Config, Effect, FileSystem, Schema } from "effect";
4
4
  import { BudgetExceeded } from "effect-agent";
@@ -148,7 +148,7 @@ declare const reviewActionProgram: Effect.Effect<{
148
148
  reason?: undefined;
149
149
  _tag: "Completed";
150
150
  outcome: ReviewRunOutcome;
151
- }, import("effect-agent").AgentApprovalDenied | import("effect-agent").AgentApprovalPending | import("effect-agent").AgentChildPending | import("effect-agent").AgentInputError | import("effect-agent").AgentOutputError | import("effect-agent").AgentPolicyError | import("effect/unstable/ai/AiError").AiError | import("effect-agent").BudgetAdapterError | BudgetExceeded | Config.ConfigError | GitHubApiFailure | GuidanceFileUnreadable | InvalidEffortInput | InvalidMaxDurationInput | import("effect-agent").ModelProtocolError | import("effect/PlatformError").PlatformError | PullRequestSourceFailure | ReviewGateFailed | ReviewTargetUnresolved | Schema.SchemaError, FileSystem.FileSystem>;
151
+ }, import("effect-agent").AgentApprovalDenied | import("effect-agent").AgentApprovalPending | import("effect-agent").AgentChildPending | import("effect-agent").AgentInputError | import("effect-agent").AgentOutputError | import("effect-agent").AgentPolicyError | import("effect/unstable/ai/AiError").AiError | import("effect-agent").BudgetAdapterError | BudgetExceeded | Config.ConfigError | import("effect-agent").ContextOverflowError | GitHubApiFailure | GuidanceFileUnreadable | InvalidEffortInput | InvalidMaxDurationInput | import("effect-agent").ModelProtocolError | import("effect/PlatformError").PlatformError | PullRequestSourceFailure | ReviewGateFailed | ReviewTargetUnresolved | Schema.SchemaError, FileSystem.FileSystem>;
152
152
  /** Run the packaged action program on Node; the bundled action entrypoint. */
153
153
  declare const main: () => void;
154
154
  /** The packaged GitHub Actions surface. */
@@ -177,7 +177,7 @@ declare const PrReviewAction: {
177
177
  reason?: undefined;
178
178
  _tag: "Completed";
179
179
  outcome: ReviewRunOutcome;
180
- }, import("effect-agent").AgentApprovalDenied | import("effect-agent").AgentApprovalPending | import("effect-agent").AgentChildPending | import("effect-agent").AgentInputError | import("effect-agent").AgentOutputError | import("effect-agent").AgentPolicyError | import("effect/unstable/ai/AiError").AiError | import("effect-agent").BudgetAdapterError | BudgetExceeded | Config.ConfigError | GitHubApiFailure | GuidanceFileUnreadable | InvalidEffortInput | InvalidMaxDurationInput | import("effect-agent").ModelProtocolError | import("effect/PlatformError").PlatformError | PullRequestSourceFailure | ReviewGateFailed | ReviewTargetUnresolved | Schema.SchemaError, FileSystem.FileSystem>;
180
+ }, import("effect-agent").AgentApprovalDenied | import("effect-agent").AgentApprovalPending | import("effect-agent").AgentChildPending | import("effect-agent").AgentInputError | import("effect-agent").AgentOutputError | import("effect-agent").AgentPolicyError | import("effect/unstable/ai/AiError").AiError | import("effect-agent").BudgetAdapterError | BudgetExceeded | Config.ConfigError | import("effect-agent").ContextOverflowError | GitHubApiFailure | GuidanceFileUnreadable | InvalidEffortInput | InvalidMaxDurationInput | import("effect-agent").ModelProtocolError | import("effect/PlatformError").PlatformError | PullRequestSourceFailure | ReviewGateFailed | ReviewTargetUnresolved | Schema.SchemaError, FileSystem.FileSystem>;
181
181
  readonly main: typeof main;
182
182
  };
183
183
  //#endregion
package/dist/action.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { M as unavailableReviewStateAuthenticatorLayer, O as selectReviewRange, P as webCryptoReviewStateAuthenticatorLayer, i as PriorReviews, k as selectedPullRequestSourceLayer, m as ReviewHeadComparison, on as normalizeRepoRelativePath, p as ReviewExecutionContext, rn as PullRequestSource, y as ReviewStateAuthenticator } from "./github-CcCtaWZD.mjs";
2
- import { A as InvalidEffortInput, M as parseEffortPosition, a as anthropicClientLayer, b as fanOutReviewBudgetLimits, c as makeOpenAiReviewModel, f as gitHubReviewLayers, h as PrReview, l as openAiClientLayer, m as resolveReviewTarget, n as DEFAULT_PROVIDER, o as describeReviewModel, p as readGitHubEvent, s as makeAnthropicReviewModel, x as reviewBudgetLimits } from "./providers-5J9VeLkX.mjs";
1
+ import { M as unavailableReviewStateAuthenticatorLayer, O as selectReviewRange, P as webCryptoReviewStateAuthenticatorLayer, i as PriorReviews, k as selectedPullRequestSourceLayer, m as ReviewHeadComparison, on as normalizeRepoRelativePath, p as ReviewExecutionContext, rn as PullRequestSource, y as ReviewStateAuthenticator } from "./github-BZNzmxao.mjs";
2
+ import { A as InvalidEffortInput, M as parseEffortPosition, a as anthropicClientLayer, b as fanOutReviewBudgetLimits, c as makeOpenAiReviewModel, f as gitHubReviewLayers, h as PrReview, l as openAiClientLayer, m as resolveReviewTarget, n as DEFAULT_PROVIDER, o as describeReviewModel, p as readGitHubEvent, s as makeAnthropicReviewModel, x as reviewBudgetLimits } from "./providers-J6BKHyHe.mjs";
3
3
  import { Config, Console, Effect, FileSystem, Layer, Option, Redacted, Schema } from "effect";
4
4
  import { BudgetExceeded, UsageBudgetLimits } from "effect-agent";
5
5
  import { NodeRuntime, NodeServices } from "@effect/platform-node";
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { s as fingerprintUnchanged } from "./github-CcCtaWZD.mjs";
2
- import { A as InvalidEffortInput, M as parseEffortPosition, a as anthropicClientLayer, c as makeOpenAiReviewModel, f as gitHubReviewLayers, h as PrReview, l as openAiClientLayer, m as resolveReviewTarget, n as DEFAULT_PROVIDER, o as describeReviewModel, s as makeAnthropicReviewModel, t as DEFAULT_MODEL, w as ReviewPublicationPlan } from "./providers-5J9VeLkX.mjs";
1
+ import { s as fingerprintUnchanged } from "./github-BZNzmxao.mjs";
2
+ import { A as InvalidEffortInput, M as parseEffortPosition, a as anthropicClientLayer, c as makeOpenAiReviewModel, f as gitHubReviewLayers, h as PrReview, l as openAiClientLayer, m as resolveReviewTarget, n as DEFAULT_PROVIDER, o as describeReviewModel, s as makeAnthropicReviewModel, t as DEFAULT_MODEL, w as ReviewPublicationPlan } from "./providers-J6BKHyHe.mjs";
3
3
  import { Console, Effect, Layer, Option, Schema } from "effect";
4
4
  import { BudgetExceeded } from "effect-agent";
5
5
  import { NodeRuntime, NodeServices } from "@effect/platform-node";
@@ -1,5 +1,5 @@
1
1
  import { Context, Effect, Layer, Option, Redacted, Schema } from "effect";
2
- import { AgentPolicy, AgentSpawner, IdGenerator, RunEvent, RunEventSink, RuntimeBinding, SubagentBudgetExhausted, SubagentDurability, SubagentDurabilityError, SubagentExecutionFailure, SubagentPolicy, SubagentPrestartDenied, SubagentProjectionFailure, ToolCallWaiting } from "effect-agent";
2
+ import { AgentPolicy, RunEvent, RuntimeBinding, SubagentPolicy } 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
@@ -795,14 +795,6 @@ declare const mapFileReviewChildFailure: (failure: {
795
795
  readonly _tag: string;
796
796
  readonly message?: string;
797
797
  }) => FileReviewUnitFailed;
798
- /** Exactly the failure union `Subagent.define` declares for this delegation. */
799
- declare const FileReviewDelegationFailure: Schema.Union<readonly [typeof FileReviewUnitFailed, typeof SubagentPrestartDenied, typeof SubagentBudgetExhausted, typeof SubagentProjectionFailure, typeof SubagentExecutionFailure, typeof ToolCallWaiting, typeof SubagentDurabilityError]>;
800
- declare const DelegateFileReview: Tool.Tool<"delegate_file_review", {
801
- readonly parameters: typeof FileReviewRequest;
802
- readonly success: typeof FileReviewUnitResult;
803
- readonly failure: Schema.Union<readonly [typeof FileReviewUnitFailed, typeof SubagentPrestartDenied, typeof SubagentBudgetExhausted, typeof SubagentProjectionFailure, typeof SubagentExecutionFailure, typeof ToolCallWaiting, typeof SubagentDurabilityError]>;
804
- readonly failureMode: "return";
805
- }, AgentSpawner | IdGenerator | RunEventSink | SubagentDurability>;
806
798
  declare const ListReviewUnitsQuery_base: Schema.Class<ListReviewUnitsQuery, Schema.Struct<{
807
799
  /** Explicit constant keeps the zero-choice operation compatible with strict provider schemas. */
808
800
  readonly scope: Schema.Literal<"all">;
@@ -823,20 +815,6 @@ declare const FanOutCoordinatorToolkit: Toolkit.Toolkit<{
823
815
  }, PullRequestSource>;
824
816
  }>;
825
817
  declare const FanOutCoordinatorToolkitLayer: import("effect/Layer").Layer<Tool.Handler<"list_review_units">, never, never>;
826
- declare const FanOutReviewToolkit: Toolkit.Toolkit<{
827
- readonly delegate_file_review: Tool.Tool<"delegate_file_review", {
828
- readonly parameters: typeof FileReviewRequest;
829
- readonly success: typeof FileReviewUnitResult;
830
- readonly failure: Schema.Union<readonly [typeof FileReviewUnitFailed, typeof SubagentPrestartDenied, typeof SubagentBudgetExhausted, typeof SubagentProjectionFailure, typeof SubagentExecutionFailure, typeof ToolCallWaiting, typeof SubagentDurabilityError]>;
831
- readonly failureMode: "return";
832
- }, AgentSpawner | IdGenerator | RunEventSink | SubagentDurability>;
833
- readonly list_review_units: Tool.Tool<"list_review_units", {
834
- readonly parameters: typeof ListReviewUnitsQuery;
835
- readonly success: typeof ReviewUnitPlan;
836
- readonly failure: typeof PullRequestSourceFailure;
837
- readonly failureMode: "error";
838
- }, PullRequestSource>;
839
- }>;
840
818
  /**
841
819
  * Build the coordinator's instructions. The same consumer guidance the
842
820
  * children receive is injected between the mission framing and the procedure
@@ -875,20 +853,6 @@ declare const makeFileReviewerDefinition: (options?: FanOutInstructionOptions) =
875
853
  interface FanOutSuiteOptions extends FanOutInstructionOptions {
876
854
  readonly maxFindings?: number | undefined;
877
855
  }
878
- declare const makeFanOutReviewerDefinition: (options?: FanOutSuiteOptions) => import("effect-agent").Definition<typeof ReviewMission, typeof CodeReview, (mission: ReviewMission) => string, Toolkit.Toolkit<{
879
- readonly delegate_file_review: Tool.Tool<"delegate_file_review", {
880
- readonly parameters: typeof FileReviewRequest;
881
- readonly success: typeof FileReviewUnitResult;
882
- readonly failure: Schema.Union<readonly [typeof FileReviewUnitFailed, typeof SubagentPrestartDenied, typeof SubagentBudgetExhausted, typeof SubagentProjectionFailure, typeof SubagentExecutionFailure, typeof ToolCallWaiting, typeof SubagentDurabilityError]>;
883
- readonly failureMode: "return";
884
- }, AgentSpawner | IdGenerator | RunEventSink | SubagentDurability>;
885
- readonly list_review_units: Tool.Tool<"list_review_units", {
886
- readonly parameters: typeof ListReviewUnitsQuery;
887
- readonly success: typeof ReviewUnitPlan;
888
- readonly failure: typeof PullRequestSourceFailure;
889
- readonly failureMode: "error";
890
- }, PullRequestSource>;
891
- }>>;
892
856
  declare const makeFileReviewDelegation: (child: ReturnType<typeof makeFileReviewerDefinition>) => import("effect-agent").SubagentDelegation<"delegate_file_review", typeof FileReviewBrief, typeof FileReviewReport, (brief: FileReviewBrief) => string, {
893
857
  readonly read_file: Tool.Tool<"read_file", {
894
858
  readonly parameters: typeof FileSliceQuery;
@@ -902,7 +866,21 @@ declare const makeFileReviewDelegation: (child: ReturnType<typeof makeFileReview
902
866
  readonly failure: Schema.Union<readonly [typeof PullRequestSourceFailure, typeof ReviewInputViolation]>;
903
867
  readonly failureMode: "return";
904
868
  }, PullRequestSource>;
905
- }, typeof FileReviewRequest, typeof FileReviewUnitResult, typeof FileReviewUnitFailed, never, never>;
869
+ }, typeof FileReviewRequest, typeof FileReviewUnitResult, typeof FileReviewUnitFailed, never, never, "return">;
870
+ declare const makeFanOutReviewerDefinition: (options: FanOutSuiteOptions, delegation: ReturnType<typeof makeFileReviewDelegation>) => import("effect-agent").Definition<typeof ReviewMission, typeof CodeReview, (mission: ReviewMission) => string, Toolkit.Toolkit<{
871
+ readonly delegate_file_review: Tool.Tool<"delegate_file_review", {
872
+ readonly parameters: typeof FileReviewRequest;
873
+ readonly success: Schema.Union<readonly [typeof FileReviewUnitResult, import("effect-agent").SubagentContainedFailure<typeof FileReviewUnitFailed>]>;
874
+ readonly failure: import("effect-agent").SubagentReturnModeFailure;
875
+ readonly failureMode: "error";
876
+ }, import("effect-agent").AgentSpawner | import("effect-agent").IdGenerator | import("effect-agent").RunEventSink | import("effect-agent").SubagentDurability>;
877
+ readonly list_review_units: Tool.Tool<"list_review_units", {
878
+ readonly parameters: typeof ListReviewUnitsQuery;
879
+ readonly success: typeof ReviewUnitPlan;
880
+ readonly failure: typeof PullRequestSourceFailure;
881
+ readonly failureMode: "error";
882
+ }, PullRequestSource>;
883
+ }>>;
906
884
  /** Build one coherent fan-out suite: child, coordinator, and delegation. */
907
885
  declare const makeFanOutReviewSuite: (options?: FanOutSuiteOptions) => FanOutReviewSuite;
908
886
  /** The default child Agent Definition. */
@@ -924,10 +902,10 @@ declare const FileReviewer: import("effect-agent").Definition<typeof FileReviewB
924
902
  declare const FanOutReviewer: import("effect-agent").Definition<typeof ReviewMission, typeof CodeReview, (mission: ReviewMission) => string, Toolkit.Toolkit<{
925
903
  readonly delegate_file_review: Tool.Tool<"delegate_file_review", {
926
904
  readonly parameters: typeof FileReviewRequest;
927
- readonly success: typeof FileReviewUnitResult;
928
- readonly failure: Schema.Union<readonly [typeof FileReviewUnitFailed, typeof SubagentPrestartDenied, typeof SubagentBudgetExhausted, typeof SubagentProjectionFailure, typeof SubagentExecutionFailure, typeof ToolCallWaiting, typeof SubagentDurabilityError]>;
929
- readonly failureMode: "return";
930
- }, AgentSpawner | IdGenerator | RunEventSink | SubagentDurability>;
905
+ readonly success: Schema.Union<readonly [typeof FileReviewUnitResult, import("effect-agent").SubagentContainedFailure<typeof FileReviewUnitFailed>]>;
906
+ readonly failure: import("effect-agent").SubagentReturnModeFailure;
907
+ readonly failureMode: "error";
908
+ }, import("effect-agent").AgentSpawner | import("effect-agent").IdGenerator | import("effect-agent").RunEventSink | import("effect-agent").SubagentDurability>;
931
909
  readonly list_review_units: Tool.Tool<"list_review_units", {
932
910
  readonly parameters: typeof ListReviewUnitsQuery;
933
911
  readonly success: typeof ReviewUnitPlan;
@@ -949,7 +927,35 @@ declare const fileReviewDelegation: import("effect-agent").SubagentDelegation<"d
949
927
  readonly failure: Schema.Union<readonly [typeof PullRequestSourceFailure, typeof ReviewInputViolation]>;
950
928
  readonly failureMode: "return";
951
929
  }, PullRequestSource>;
952
- }, typeof FileReviewRequest, typeof FileReviewUnitResult, typeof FileReviewUnitFailed, never, never>;
930
+ }, typeof FileReviewRequest, typeof FileReviewUnitResult, typeof FileReviewUnitFailed, never, never, "return">;
931
+ /** The default coordinator-facing delegation Tool (first-party contained mode). */
932
+ declare const DelegateFileReview: Tool.Tool<"delegate_file_review", {
933
+ readonly parameters: typeof FileReviewRequest;
934
+ readonly success: Schema.Union<readonly [typeof FileReviewUnitResult, import("effect-agent").SubagentContainedFailure<typeof FileReviewUnitFailed>]>;
935
+ readonly failure: import("effect-agent").SubagentReturnModeFailure;
936
+ readonly failureMode: "error";
937
+ }, import("effect-agent").AgentSpawner | import("effect-agent").IdGenerator | import("effect-agent").RunEventSink | import("effect-agent").SubagentDurability>;
938
+ /** The default coordinator Toolkit. */
939
+ declare const FanOutReviewToolkit: Toolkit.Toolkit<{
940
+ readonly delegate_file_review: Tool.Tool<"delegate_file_review", {
941
+ readonly parameters: typeof FileReviewRequest;
942
+ readonly success: Schema.Union<readonly [typeof FileReviewUnitResult, import("effect-agent").SubagentContainedFailure<typeof FileReviewUnitFailed>]>;
943
+ readonly failure: import("effect-agent").SubagentReturnModeFailure;
944
+ readonly failureMode: "error";
945
+ }, import("effect-agent").AgentSpawner | import("effect-agent").IdGenerator | import("effect-agent").RunEventSink | import("effect-agent").SubagentDurability>;
946
+ readonly list_review_units: Tool.Tool<"list_review_units", {
947
+ readonly parameters: typeof ListReviewUnitsQuery;
948
+ readonly success: typeof ReviewUnitPlan;
949
+ readonly failure: typeof PullRequestSourceFailure;
950
+ readonly failureMode: "error";
951
+ }, PullRequestSource>;
952
+ }>;
953
+ /**
954
+ * The contained failure family the delegation can surface as result data
955
+ * (SUB-033), derived from the delegation itself so the coverage decoder can
956
+ * never diverge from what the runtime actually contains.
957
+ */
958
+ declare const FileReviewDelegationFailure: import("effect-agent").SubagentContainedFailure<typeof FileReviewUnitFailed>;
953
959
  /** Runtime wiring: one delegation plus one explicit child Binding. */
954
960
  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>) => import("effect/Layer").Layer<Tool.Handler<"delegate_file_review">, never, import("effect-agent").SubagentLayerRequirements<typeof FileReviewBrief, typeof FileReviewReport, (brief: FileReviewBrief) => string, {
955
961
  readonly read_file: Tool.Tool<"read_file", {
@@ -988,4 +994,4 @@ declare const fanOutHandlersLayer: <Provider, ModelProvides, ModelRequires>(chil
988
994
  }, never>>;
989
995
  //#endregion
990
996
  export { gitHubReviewPublisherLayer as $, clampMaxFindings as $t, fileReviewerInstructions as A, ChangedFileSummary as At, ReviewUnitPlan as B, MAX_CONCERNS as Bt, defaultFanOutPolicy as C, commentableLines as Cn, selectReviewRange as Ct, fanOutReviewInstructions as D, unavailableReviewStateAuthenticatorLayer as Dt, fanOutHandlersLayerFor as E, toStoredFinding as Et, MAX_MERGED_FINDINGS as F, FileSlice as Ft, GitHubReviewTarget as G, ReviewConcern as Gt, planReviewUnits as H, PullRequestReviewer as Ht, MAX_REVIEW_UNITS as I, FileSliceQuery as It, PublishedReview as J, ReviewInstructionOptions as Jt, PriorReviewLookupFailure as K, ReviewFinding as Kt, MAX_UNIT_FILES as L, FindingSeverity as Lt, makeFanOutReviewSuite as M, CodeReview as Mt, makeFileReviewerInstructions as N, FileDiffQuery as Nt, fileReviewDelegation as O, validateReviewState as Ot, mapFileReviewChildFailure as P, FileDiffView as Pt, gitHubPullRequestSourceLayer as Q, ReviewVerdict as Qt, ReviewUnit as R, ListChangedFiles as Rt, MAX_FILE_REVIEW_TOOL_CALLS as S, annotatePatch as Sn, fromStoredFinding as St, fanOutHandlersLayer as T, toStoredConcern as Tt, rankAndDedupeFindings as U, ReadFile as Ut, UNIT_CHANGED_LINE_BUDGET as V, MAX_FINDINGS as Vt, GitHubApiFailure as W, ReadFileDiff as Wt, fingerprintUnchanged as X, ReviewToolkit as Xt, ReviewPublisher as Y, ReviewMission as Yt, gitHubPriorReviewsLayer as Z, ReviewToolkitLayer as Zt, FileReviewer as _, normalizeRepoRelativePath as _n, StoredReviewConcern as _t, FanOutReviewSuite as a, resolveGuidance as an, GitCommitSha as at, MAX_CHILD_CONCERNS as b, ChangedPath as bn, computeProfileFingerprint as bt, FanOutSuiteOptions as c, ReviewCoverage as cn, ReviewHeadComparison as ct, FileReviewReport as d, MAX_CHANGED_FILES as dn, ReviewSelection as dt, defaultReviewPolicy as en, ReviewCommentDraft as et, FileReviewRequest as f, MAX_FILE_CHARS as fn, ReviewState as ft, FileReviewUnitResult as g, ReviewInputViolation as gn, ReviewStateMarkerTooLarge as gt, FileReviewUnitFailed as h, PullRequestSourceFailure as hn, ReviewStateMarker as ht, FanOutInstructionOptions as i, readFileHandler as in, planPublication as it, makeFanOutReviewInstructions as j, ChangedFilesView as jt, fileReviewPolicy as k, webCryptoReviewStateAuthenticatorLayer as kt, FileReviewBrief as l, ReviewShape as ln, ReviewMode as lt, FileReviewToolkitLayer as m, PullRequestSource as mn, ReviewStateAuthenticator as mt, FanOutCoordinatorToolkit as n, makeReviewInstructions as nn, ReviewPublicationPlan as nt, FanOutReviewToolkit as o, reviewInstructions as on, MAX_REVIEW_STATE_MARKER_CHARS as ot, FileReviewToolkit as p, PullRequestMetadata as pn, ReviewStateAuthenticationFailure as pt, PriorReviews as q, ReviewGuidance as qt, FanOutCoordinatorToolkitLayer as r, readFileDiffHandler as rn, anchorViolation as rt, FanOutReviewer as s, FailedReviewUnit as sn, ReviewExecutionContext as st, DelegateFileReview as t, listChangedFilesHandler as tn, ReviewEvent as tt, FileReviewDelegationFailure as u, assessReviewCoverage as un, ReviewScopeMode as ut, ListReviewUnits as v, ChangedFile as vn, StoredReviewFinding as vt, defaultFileReviewerPolicy as w, parsePatch as wn, selectedPullRequestSourceLayer as wt, MAX_CHILD_FINDINGS as x, PatchLine as xn, fromStoredConcern as xt, ListReviewUnitsQuery as y, ChangedFileStatus as yn, buildProfileMission as yt, ReviewUnitId as z, ListChangedFilesQuery as zt };
991
- //# sourceMappingURL=fan-out-cMt8_Olv.d.mts.map
997
+ //# sourceMappingURL=fan-out-BBEATQwc.d.mts.map
@@ -1,5 +1,5 @@
1
1
  import { Context, Effect, Encoding, Layer, Option, Redacted, Result, Schema } from "effect";
2
- import { Agent, AgentPolicy, AgentSpawner, IdGenerator, RunEventSink, Subagent, SubagentBudgetExhausted, SubagentDurability, SubagentDurabilityError, SubagentExecutionFailure, SubagentPolicy, SubagentPrestartDenied, SubagentProjectionFailure, SubagentRuntime, ToolCallWaiting, ToolExecutionClass } from "effect-agent";
2
+ import { Agent, AgentPolicy, Subagent, SubagentPolicy, SubagentRuntime, ToolExecutionClass } from "effect-agent";
3
3
  import { Tool, Toolkit } from "effect/unstable/ai";
4
4
  import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/unstable/http";
5
5
  //#region src/internal/diff.ts
@@ -415,7 +415,8 @@ const defaultReviewPolicy = AgentPolicy.make({
415
415
  maxDuration: "8 minutes",
416
416
  toolConcurrency: 2,
417
417
  tokenBudget: 3e5,
418
- onExhaustion: "fail"
418
+ contextTokenLimit: 15e4,
419
+ onExhaustion: "final-answer"
419
420
  });
420
421
  const PullRequestReviewer = Agent.define("pr-reviewer", {
421
422
  input: ReviewMission,
@@ -599,6 +600,7 @@ const defaultFileReviewerPolicy = AgentPolicy.make({
599
600
  maxDuration: "4 minutes",
600
601
  toolConcurrency: 2,
601
602
  tokenBudget: 2e5,
603
+ contextTokenLimit: 15e4,
602
604
  onExhaustion: "fail"
603
605
  });
604
606
  /** The model-decoded delegation parameters: which unit to review. */
@@ -643,23 +645,6 @@ const mapFileReviewChildFailure = (failure) => FileReviewUnitFailed.make({
643
645
  childErrorTag: failure._tag,
644
646
  message: (failure.message ?? "").slice(0, 400)
645
647
  });
646
- /** Exactly the failure union `Subagent.define` declares for this delegation. */
647
- const FileReviewDelegationFailure = Schema.Union([
648
- FileReviewUnitFailed,
649
- SubagentPrestartDenied,
650
- SubagentBudgetExhausted,
651
- SubagentProjectionFailure,
652
- SubagentExecutionFailure,
653
- ToolCallWaiting,
654
- SubagentDurabilityError
655
- ]);
656
- const DelegateFileReview = Tool.make("delegate_file_review", {
657
- description: delegationDescription,
658
- parameters: FileReviewRequest,
659
- success: FileReviewUnitResult,
660
- failure: FileReviewDelegationFailure,
661
- failureMode: "return"
662
- }).addDependency(AgentSpawner).addDependency(RunEventSink).addDependency(SubagentDurability).addDependency(IdGenerator).annotate(ToolExecutionClass, "readonly");
663
648
  var ListReviewUnitsQuery = class extends Schema.Class("@effect-agent/pr-review/ListReviewUnitsQuery")({
664
649
  /** Explicit constant keeps the zero-choice operation compatible with strict provider schemas. */
665
650
  scope: Schema.Literal("all") }) {};
@@ -676,7 +661,6 @@ const FanOutCoordinatorToolkitLayer = FanOutCoordinatorToolkit.toLayer({ list_re
676
661
  const source = yield* PullRequestSource;
677
662
  return planReviewUnits(yield* source.changedFiles, { totalChangedFiles: (yield* source.metadata).totalChangedFiles });
678
663
  }) });
679
- const FanOutReviewToolkit = Toolkit.make(ListReviewUnits, DelegateFileReview);
680
664
  /**
681
665
  * Build the coordinator's instructions. The same consumer guidance the
682
666
  * children receive is injected between the mission framing and the procedure
@@ -707,9 +691,10 @@ const defaultFanOutPolicy = AgentPolicy.make({
707
691
  maxToolCalls: 9,
708
692
  maxDuration: "15 minutes",
709
693
  toolConcurrency: 3,
710
- repeatedFailureLimit: 9,
694
+ repeatedFailureLimit: 3,
711
695
  tokenBudget: 3e5,
712
- onExhaustion: "fail"
696
+ contextTokenLimit: 15e4,
697
+ onExhaustion: "final-answer"
713
698
  });
714
699
  const makeFileReviewerDefinition = (options = {}) => Agent.define("pr-file-reviewer", {
715
700
  input: FileReviewBrief,
@@ -723,25 +708,13 @@ const makeFileReviewerDefinition = (options = {}) => Agent.define("pr-file-revie
723
708
  surface: "read-only"
724
709
  }
725
710
  });
726
- const makeFanOutReviewerDefinition = (options = {}) => Agent.define("pr-fanout-reviewer", {
727
- input: ReviewMission,
728
- output: CodeReview,
729
- instructions: makeFanOutReviewInstructions(options),
730
- toolkit: FanOutReviewToolkit,
731
- policy: defaultFanOutPolicy,
732
- description: "Coordinate one pull-request review by fanning bounded per-unit file reviews out to delegated children and merging their findings into one structured review.",
733
- metadata: {
734
- deploymentClass: "E",
735
- surface: "read-only",
736
- delegation: "S1-attached"
737
- }
738
- });
739
711
  const makeFileReviewDelegation = (child) => Subagent.define("delegate_file_review", {
740
712
  description: delegationDescription,
741
713
  target: child,
742
714
  parameters: FileReviewRequest,
743
715
  success: FileReviewUnitResult,
744
716
  failure: FileReviewUnitFailed,
717
+ failureMode: "return",
745
718
  prepareInput: (request) => Effect.succeed(FileReviewBrief.make({
746
719
  unitId: request.unitId,
747
720
  paths: request.paths,
@@ -754,13 +727,34 @@ const makeFileReviewDelegation = (child) => Subagent.define("delegate_file_revie
754
727
  })),
755
728
  policy: fileReviewPolicy
756
729
  });
730
+ /**
731
+ * The coordinator-facing delegation Tool: the delegation's own first-party
732
+ * contained Tool plus the read-only execution class (the delegated child's
733
+ * whole tool surface is read-only). Effect AI resolves handlers by Tool name,
734
+ * so `SubagentRuntime.layer`'s handler serves this annotated copy unchanged.
735
+ */
736
+ const delegationToolFor = (delegation) => delegation.tool.annotate(ToolExecutionClass, "readonly");
737
+ const makeFanOutReviewerDefinition = (options, delegation) => Agent.define("pr-fanout-reviewer", {
738
+ input: ReviewMission,
739
+ output: CodeReview,
740
+ instructions: makeFanOutReviewInstructions(options),
741
+ toolkit: Toolkit.make(ListReviewUnits, delegationToolFor(delegation)),
742
+ policy: defaultFanOutPolicy,
743
+ description: "Coordinate one pull-request review by fanning bounded per-unit file reviews out to delegated children and merging their findings into one structured review.",
744
+ metadata: {
745
+ deploymentClass: "E",
746
+ surface: "read-only",
747
+ delegation: "S1-attached"
748
+ }
749
+ });
757
750
  /** Build one coherent fan-out suite: child, coordinator, and delegation. */
758
751
  const makeFanOutReviewSuite = (options = {}) => {
759
752
  const child = makeFileReviewerDefinition({ guidance: options.guidance });
753
+ const delegation = makeFileReviewDelegation(child);
760
754
  return {
761
755
  child,
762
- parent: makeFanOutReviewerDefinition(options),
763
- delegation: makeFileReviewDelegation(child)
756
+ parent: makeFanOutReviewerDefinition(options, delegation),
757
+ delegation
764
758
  };
765
759
  };
766
760
  const defaultSuite = makeFanOutReviewSuite();
@@ -770,6 +764,16 @@ const FileReviewer = defaultSuite.child;
770
764
  const FanOutReviewer = defaultSuite.parent;
771
765
  /** The default delegation over the default child. */
772
766
  const fileReviewDelegation = defaultSuite.delegation;
767
+ /** The default coordinator-facing delegation Tool (first-party contained mode). */
768
+ const DelegateFileReview = delegationToolFor(fileReviewDelegation);
769
+ /** The default coordinator Toolkit. */
770
+ const FanOutReviewToolkit = FanOutReviewer.toolkit;
771
+ /**
772
+ * The contained failure family the delegation can surface as result data
773
+ * (SUB-033), derived from the delegation itself so the coverage decoder can
774
+ * never diverge from what the runtime actually contains.
775
+ */
776
+ const FileReviewDelegationFailure = fileReviewDelegation.containedFailure;
773
777
  /** Runtime wiring: one delegation plus one explicit child Binding. */
774
778
  const fanOutHandlersLayerFor = (delegation) => (childBinding) => SubagentRuntime.layer(delegation, childBinding, { mapChildFailure: mapFileReviewChildFailure });
775
779
  /** Runtime wiring over the default delegation, mirroring the leaf example. */
@@ -1365,4 +1369,4 @@ const fingerprintUnchanged = (current) => Effect.gen(function* () {
1365
1369
  //#endregion
1366
1370
  export { ListReviewUnits as $, reviewInstructions as $t, toStoredConcern as A, FileSlice as At, FanOutCoordinatorToolkit as B, ReviewConcern as Bt, StoredReviewFinding as C, planReviewUnits as Ct, fromStoredFinding as D, CodeReview as Dt, fromStoredConcern as E, ChangedFilesView as Et, FINGERPRINT_MARKER_LENGTH as F, MAX_CONCERNS as Ft, FileReviewDelegationFailure as G, ReviewVerdict as Gt, FanOutReviewToolkit as H, ReviewMission as Ht, computeChangesetFingerprint as I, MAX_FINDINGS as It, FileReviewToolkit as J, listChangedFilesHandler as Jt, FileReviewReport as K, clampMaxFindings as Kt, extractFingerprint as L, PullRequestReviewer as Lt, unavailableReviewStateAuthenticatorLayer as M, FindingSeverity as Mt, validateReviewState as N, ListChangedFiles as Nt, selectReviewRange as O, FileDiffQuery as Ot, webCryptoReviewStateAuthenticatorLayer as P, ListChangedFilesQuery as Pt, FileReviewer as Q, resolveGuidance as Qt, renderFingerprintMarker as R, ReadFile as Rt, StoredReviewConcern as S, UNIT_CHANGED_LINE_BUDGET as St, computeProfileFingerprint as T, ChangedFileSummary as Tt, FanOutReviewer as U, ReviewToolkit as Ut, FanOutCoordinatorToolkitLayer as V, ReviewFinding as Vt, FileReviewBrief as W, ReviewToolkitLayer as Wt, FileReviewUnitFailed as X, readFileDiffHandler as Xt, FileReviewToolkitLayer as Y, makeReviewInstructions as Yt, FileReviewUnitResult as Z, readFileHandler as Zt, ReviewState as _, MAX_REVIEW_UNITS as _t, PublishedReview as a, ReviewInputViolation as an, defaultFileReviewerPolicy as at, ReviewStateMarker as b, ReviewUnitId as bt, gitHubPriorReviewsLayer as c, ChangedFileStatus as cn, fanOutReviewInstructions as ct, GitCommitSha as d, commentableLines as dn, fileReviewerInstructions as dt, MAX_CHANGED_FILES as en, ListReviewUnitsQuery as et, MAX_REVIEW_STATE_MARKER_CHARS as f, parsePatch as fn, makeFanOutReviewInstructions as ft, ReviewScopeMode as g, MAX_MERGED_FINDINGS as gt, ReviewMode as h, mapFileReviewChildFailure as ht, PriorReviews as i, PullRequestSourceFailure as in, defaultFanOutPolicy as it, toStoredFinding as j, FileSliceQuery as jt, selectedPullRequestSourceLayer as k, FileDiffView as kt, gitHubPullRequestSourceLayer as l, ChangedPath as ln, fileReviewDelegation as lt, ReviewHeadComparison as m, makeFileReviewerInstructions as mt, GitHubReviewTarget as n, PullRequestMetadata as nn, MAX_CHILD_FINDINGS as nt, ReviewPublisher as o, normalizeRepoRelativePath as on, fanOutHandlersLayer as ot, ReviewExecutionContext as p, makeFanOutReviewSuite as pt, FileReviewRequest as q, defaultReviewPolicy as qt, PriorReviewLookupFailure as r, PullRequestSource as rn, MAX_FILE_REVIEW_TOOL_CALLS as rt, fingerprintUnchanged as s, ChangedFile as sn, fanOutHandlersLayerFor as st, GitHubApiFailure as t, MAX_FILE_CHARS as tn, MAX_CHILD_CONCERNS as tt, gitHubReviewPublisherLayer as u, annotatePatch as un, fileReviewPolicy as ut, ReviewStateAuthenticationFailure as v, MAX_UNIT_FILES as vt, buildProfileMission as w, rankAndDedupeFindings as wt, ReviewStateMarkerTooLarge as x, ReviewUnitPlan as xt, ReviewStateAuthenticator as y, ReviewUnit as yt, DelegateFileReview as z, ReadFileDiff as zt };
1367
1371
 
1368
- //# sourceMappingURL=github-CcCtaWZD.mjs.map
1372
+ //# sourceMappingURL=github-BZNzmxao.mjs.map