@effect-agent/pr-review 0.0.1-beta.0 → 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 +3 -3
- package/dist/action.mjs +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/{fan-out-Dy84-dIs.d.mts → fan-out-BBEATQwc.d.mts} +56 -45
- package/dist/{github-bwQ2V-wb.mjs → github-BZNzmxao.mjs} +54 -42
- package/dist/github-BZNzmxao.mjs.map +1 -0
- package/dist/index.d.mts +13 -13
- package/dist/index.mjs +3 -3
- package/dist/{providers-DyLJlpJQ.mjs → providers-J6BKHyHe.mjs} +2 -2
- package/dist/{providers-DyLJlpJQ.mjs.map → providers-J6BKHyHe.mjs.map} +1 -1
- package/dist/testing.d.mts +3 -2
- package/dist/testing.mjs +1 -1
- package/dist/testing.mjs.map +1 -1
- package/package.json +20 -20
- package/src/internal/fan-out-scripted.ts +2 -1
- package/src/internal/fan-out.ts +74 -71
- package/src/internal/review-agent.ts +6 -0
- package/dist/github-bwQ2V-wb.mjs.map +0 -1
package/dist/action.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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,
|
|
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-
|
|
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-
|
|
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-
|
|
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,
|
|
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
|
|
@@ -695,6 +695,11 @@ declare const rankAndDedupeFindings: (findings: ReadonlyArray<ReviewFinding>) =>
|
|
|
695
695
|
declare const MAX_CHILD_FINDINGS = 8;
|
|
696
696
|
/** One child returns at most this many non-anchored concerns. */
|
|
697
697
|
declare const MAX_CHILD_CONCERNS = 3;
|
|
698
|
+
/**
|
|
699
|
+
* One mandatory diff read plus one bounded context read for every path in a
|
|
700
|
+
* maximum-size unit. Keep the child and delegation reservation aligned.
|
|
701
|
+
*/
|
|
702
|
+
declare const MAX_FILE_REVIEW_TOOL_CALLS: number;
|
|
698
703
|
declare const FileReviewToolkit: Toolkit.Toolkit<{
|
|
699
704
|
readonly read_file: Tool.Tool<"read_file", {
|
|
700
705
|
readonly parameters: typeof FileSliceQuery;
|
|
@@ -790,14 +795,6 @@ declare const mapFileReviewChildFailure: (failure: {
|
|
|
790
795
|
readonly _tag: string;
|
|
791
796
|
readonly message?: string;
|
|
792
797
|
}) => FileReviewUnitFailed;
|
|
793
|
-
/** Exactly the failure union `Subagent.define` declares for this delegation. */
|
|
794
|
-
declare const FileReviewDelegationFailure: Schema.Union<readonly [typeof FileReviewUnitFailed, typeof SubagentPrestartDenied, typeof SubagentBudgetExhausted, typeof SubagentProjectionFailure, typeof SubagentExecutionFailure, typeof ToolCallWaiting, typeof SubagentDurabilityError]>;
|
|
795
|
-
declare const DelegateFileReview: Tool.Tool<"delegate_file_review", {
|
|
796
|
-
readonly parameters: typeof FileReviewRequest;
|
|
797
|
-
readonly success: typeof FileReviewUnitResult;
|
|
798
|
-
readonly failure: Schema.Union<readonly [typeof FileReviewUnitFailed, typeof SubagentPrestartDenied, typeof SubagentBudgetExhausted, typeof SubagentProjectionFailure, typeof SubagentExecutionFailure, typeof ToolCallWaiting, typeof SubagentDurabilityError]>;
|
|
799
|
-
readonly failureMode: "return";
|
|
800
|
-
}, AgentSpawner | IdGenerator | RunEventSink | SubagentDurability>;
|
|
801
798
|
declare const ListReviewUnitsQuery_base: Schema.Class<ListReviewUnitsQuery, Schema.Struct<{
|
|
802
799
|
/** Explicit constant keeps the zero-choice operation compatible with strict provider schemas. */
|
|
803
800
|
readonly scope: Schema.Literal<"all">;
|
|
@@ -818,20 +815,6 @@ declare const FanOutCoordinatorToolkit: Toolkit.Toolkit<{
|
|
|
818
815
|
}, PullRequestSource>;
|
|
819
816
|
}>;
|
|
820
817
|
declare const FanOutCoordinatorToolkitLayer: import("effect/Layer").Layer<Tool.Handler<"list_review_units">, never, never>;
|
|
821
|
-
declare const FanOutReviewToolkit: Toolkit.Toolkit<{
|
|
822
|
-
readonly delegate_file_review: Tool.Tool<"delegate_file_review", {
|
|
823
|
-
readonly parameters: typeof FileReviewRequest;
|
|
824
|
-
readonly success: typeof FileReviewUnitResult;
|
|
825
|
-
readonly failure: Schema.Union<readonly [typeof FileReviewUnitFailed, typeof SubagentPrestartDenied, typeof SubagentBudgetExhausted, typeof SubagentProjectionFailure, typeof SubagentExecutionFailure, typeof ToolCallWaiting, typeof SubagentDurabilityError]>;
|
|
826
|
-
readonly failureMode: "return";
|
|
827
|
-
}, AgentSpawner | IdGenerator | RunEventSink | SubagentDurability>;
|
|
828
|
-
readonly list_review_units: Tool.Tool<"list_review_units", {
|
|
829
|
-
readonly parameters: typeof ListReviewUnitsQuery;
|
|
830
|
-
readonly success: typeof ReviewUnitPlan;
|
|
831
|
-
readonly failure: typeof PullRequestSourceFailure;
|
|
832
|
-
readonly failureMode: "error";
|
|
833
|
-
}, PullRequestSource>;
|
|
834
|
-
}>;
|
|
835
818
|
/**
|
|
836
819
|
* Build the coordinator's instructions. The same consumer guidance the
|
|
837
820
|
* children receive is injected between the mission framing and the procedure
|
|
@@ -870,20 +853,6 @@ declare const makeFileReviewerDefinition: (options?: FanOutInstructionOptions) =
|
|
|
870
853
|
interface FanOutSuiteOptions extends FanOutInstructionOptions {
|
|
871
854
|
readonly maxFindings?: number | undefined;
|
|
872
855
|
}
|
|
873
|
-
declare const makeFanOutReviewerDefinition: (options?: FanOutSuiteOptions) => import("effect-agent").Definition<typeof ReviewMission, typeof CodeReview, (mission: ReviewMission) => string, Toolkit.Toolkit<{
|
|
874
|
-
readonly delegate_file_review: Tool.Tool<"delegate_file_review", {
|
|
875
|
-
readonly parameters: typeof FileReviewRequest;
|
|
876
|
-
readonly success: typeof FileReviewUnitResult;
|
|
877
|
-
readonly failure: Schema.Union<readonly [typeof FileReviewUnitFailed, typeof SubagentPrestartDenied, typeof SubagentBudgetExhausted, typeof SubagentProjectionFailure, typeof SubagentExecutionFailure, typeof ToolCallWaiting, typeof SubagentDurabilityError]>;
|
|
878
|
-
readonly failureMode: "return";
|
|
879
|
-
}, AgentSpawner | IdGenerator | RunEventSink | SubagentDurability>;
|
|
880
|
-
readonly list_review_units: Tool.Tool<"list_review_units", {
|
|
881
|
-
readonly parameters: typeof ListReviewUnitsQuery;
|
|
882
|
-
readonly success: typeof ReviewUnitPlan;
|
|
883
|
-
readonly failure: typeof PullRequestSourceFailure;
|
|
884
|
-
readonly failureMode: "error";
|
|
885
|
-
}, PullRequestSource>;
|
|
886
|
-
}>>;
|
|
887
856
|
declare const makeFileReviewDelegation: (child: ReturnType<typeof makeFileReviewerDefinition>) => import("effect-agent").SubagentDelegation<"delegate_file_review", typeof FileReviewBrief, typeof FileReviewReport, (brief: FileReviewBrief) => string, {
|
|
888
857
|
readonly read_file: Tool.Tool<"read_file", {
|
|
889
858
|
readonly parameters: typeof FileSliceQuery;
|
|
@@ -897,7 +866,21 @@ declare const makeFileReviewDelegation: (child: ReturnType<typeof makeFileReview
|
|
|
897
866
|
readonly failure: Schema.Union<readonly [typeof PullRequestSourceFailure, typeof ReviewInputViolation]>;
|
|
898
867
|
readonly failureMode: "return";
|
|
899
868
|
}, PullRequestSource>;
|
|
900
|
-
}, 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
|
+
}>>;
|
|
901
884
|
/** Build one coherent fan-out suite: child, coordinator, and delegation. */
|
|
902
885
|
declare const makeFanOutReviewSuite: (options?: FanOutSuiteOptions) => FanOutReviewSuite;
|
|
903
886
|
/** The default child Agent Definition. */
|
|
@@ -919,10 +902,10 @@ declare const FileReviewer: import("effect-agent").Definition<typeof FileReviewB
|
|
|
919
902
|
declare const FanOutReviewer: import("effect-agent").Definition<typeof ReviewMission, typeof CodeReview, (mission: ReviewMission) => string, Toolkit.Toolkit<{
|
|
920
903
|
readonly delegate_file_review: Tool.Tool<"delegate_file_review", {
|
|
921
904
|
readonly parameters: typeof FileReviewRequest;
|
|
922
|
-
readonly success: typeof FileReviewUnitResult
|
|
923
|
-
readonly failure:
|
|
924
|
-
readonly failureMode: "
|
|
925
|
-
}, 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>;
|
|
926
909
|
readonly list_review_units: Tool.Tool<"list_review_units", {
|
|
927
910
|
readonly parameters: typeof ListReviewUnitsQuery;
|
|
928
911
|
readonly success: typeof ReviewUnitPlan;
|
|
@@ -944,7 +927,35 @@ declare const fileReviewDelegation: import("effect-agent").SubagentDelegation<"d
|
|
|
944
927
|
readonly failure: Schema.Union<readonly [typeof PullRequestSourceFailure, typeof ReviewInputViolation]>;
|
|
945
928
|
readonly failureMode: "return";
|
|
946
929
|
}, PullRequestSource>;
|
|
947
|
-
}, 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>;
|
|
948
959
|
/** Runtime wiring: one delegation plus one explicit child Binding. */
|
|
949
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, {
|
|
950
961
|
readonly read_file: Tool.Tool<"read_file", {
|
|
@@ -982,5 +993,5 @@ declare const fanOutHandlersLayer: <Provider, ModelProvides, ModelRequires>(chil
|
|
|
982
993
|
readonly message?: string;
|
|
983
994
|
}, never>>;
|
|
984
995
|
//#endregion
|
|
985
|
-
export {
|
|
986
|
-
//# sourceMappingURL=fan-out-
|
|
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 };
|
|
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,
|
|
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
|
|
@@ -414,7 +414,9 @@ const defaultReviewPolicy = AgentPolicy.make({
|
|
|
414
414
|
maxToolCalls: 24,
|
|
415
415
|
maxDuration: "8 minutes",
|
|
416
416
|
toolConcurrency: 2,
|
|
417
|
-
tokenBudget: 3e5
|
|
417
|
+
tokenBudget: 3e5,
|
|
418
|
+
contextTokenLimit: 15e4,
|
|
419
|
+
onExhaustion: "final-answer"
|
|
418
420
|
});
|
|
419
421
|
const PullRequestReviewer = Agent.define("pr-reviewer", {
|
|
420
422
|
input: ReviewMission,
|
|
@@ -549,6 +551,11 @@ const rankAndDedupeFindings = (findings) => {
|
|
|
549
551
|
const MAX_CHILD_FINDINGS = 8;
|
|
550
552
|
/** One child returns at most this many non-anchored concerns. */
|
|
551
553
|
const MAX_CHILD_CONCERNS = 3;
|
|
554
|
+
/**
|
|
555
|
+
* One mandatory diff read plus one bounded context read for every path in a
|
|
556
|
+
* maximum-size unit. Keep the child and delegation reservation aligned.
|
|
557
|
+
*/
|
|
558
|
+
const MAX_FILE_REVIEW_TOOL_CALLS = 24;
|
|
552
559
|
const FileReviewToolkit = Toolkit.make(ReadFileDiff, ReadFile);
|
|
553
560
|
const FileReviewToolkitLayer = FileReviewToolkit.toLayer({
|
|
554
561
|
read_file_diff: readFileDiffHandler,
|
|
@@ -589,10 +596,12 @@ const fileReviewerInstructions = makeFileReviewerInstructions();
|
|
|
589
596
|
/** The default per-unit child execution bounds. */
|
|
590
597
|
const defaultFileReviewerPolicy = AgentPolicy.make({
|
|
591
598
|
maxTurns: 8,
|
|
592
|
-
maxToolCalls:
|
|
599
|
+
maxToolCalls: MAX_FILE_REVIEW_TOOL_CALLS,
|
|
593
600
|
maxDuration: "4 minutes",
|
|
594
601
|
toolConcurrency: 2,
|
|
595
|
-
tokenBudget: 2e5
|
|
602
|
+
tokenBudget: 2e5,
|
|
603
|
+
contextTokenLimit: 15e4,
|
|
604
|
+
onExhaustion: "fail"
|
|
596
605
|
});
|
|
597
606
|
/** The model-decoded delegation parameters: which unit to review. */
|
|
598
607
|
var FileReviewRequest = class extends Schema.Class("@effect-agent/pr-review/FileReviewRequest")({
|
|
@@ -624,7 +633,7 @@ const fileReviewPolicy = SubagentPolicy.make({
|
|
|
624
633
|
maxChildren: 8,
|
|
625
634
|
maxConcurrency: 3,
|
|
626
635
|
maxTurns: 8,
|
|
627
|
-
maxToolCalls:
|
|
636
|
+
maxToolCalls: MAX_FILE_REVIEW_TOOL_CALLS,
|
|
628
637
|
maxDuration: "4 minutes"
|
|
629
638
|
});
|
|
630
639
|
const delegationDescription = "Delegate the review of one planned unit to a bounded file-reviewer child and return its line-anchored findings. Call it exactly once per unit from list_review_units; never retry a failed unit.";
|
|
@@ -636,23 +645,6 @@ const mapFileReviewChildFailure = (failure) => FileReviewUnitFailed.make({
|
|
|
636
645
|
childErrorTag: failure._tag,
|
|
637
646
|
message: (failure.message ?? "").slice(0, 400)
|
|
638
647
|
});
|
|
639
|
-
/** Exactly the failure union `Subagent.define` declares for this delegation. */
|
|
640
|
-
const FileReviewDelegationFailure = Schema.Union([
|
|
641
|
-
FileReviewUnitFailed,
|
|
642
|
-
SubagentPrestartDenied,
|
|
643
|
-
SubagentBudgetExhausted,
|
|
644
|
-
SubagentProjectionFailure,
|
|
645
|
-
SubagentExecutionFailure,
|
|
646
|
-
ToolCallWaiting,
|
|
647
|
-
SubagentDurabilityError
|
|
648
|
-
]);
|
|
649
|
-
const DelegateFileReview = Tool.make("delegate_file_review", {
|
|
650
|
-
description: delegationDescription,
|
|
651
|
-
parameters: FileReviewRequest,
|
|
652
|
-
success: FileReviewUnitResult,
|
|
653
|
-
failure: FileReviewDelegationFailure,
|
|
654
|
-
failureMode: "return"
|
|
655
|
-
}).addDependency(AgentSpawner).addDependency(RunEventSink).addDependency(SubagentDurability).addDependency(IdGenerator).annotate(ToolExecutionClass, "readonly");
|
|
656
648
|
var ListReviewUnitsQuery = class extends Schema.Class("@effect-agent/pr-review/ListReviewUnitsQuery")({
|
|
657
649
|
/** Explicit constant keeps the zero-choice operation compatible with strict provider schemas. */
|
|
658
650
|
scope: Schema.Literal("all") }) {};
|
|
@@ -669,7 +661,6 @@ const FanOutCoordinatorToolkitLayer = FanOutCoordinatorToolkit.toLayer({ list_re
|
|
|
669
661
|
const source = yield* PullRequestSource;
|
|
670
662
|
return planReviewUnits(yield* source.changedFiles, { totalChangedFiles: (yield* source.metadata).totalChangedFiles });
|
|
671
663
|
}) });
|
|
672
|
-
const FanOutReviewToolkit = Toolkit.make(ListReviewUnits, DelegateFileReview);
|
|
673
664
|
/**
|
|
674
665
|
* Build the coordinator's instructions. The same consumer guidance the
|
|
675
666
|
* children receive is injected between the mission framing and the procedure
|
|
@@ -700,8 +691,10 @@ const defaultFanOutPolicy = AgentPolicy.make({
|
|
|
700
691
|
maxToolCalls: 9,
|
|
701
692
|
maxDuration: "15 minutes",
|
|
702
693
|
toolConcurrency: 3,
|
|
703
|
-
repeatedFailureLimit:
|
|
704
|
-
tokenBudget: 3e5
|
|
694
|
+
repeatedFailureLimit: 3,
|
|
695
|
+
tokenBudget: 3e5,
|
|
696
|
+
contextTokenLimit: 15e4,
|
|
697
|
+
onExhaustion: "final-answer"
|
|
705
698
|
});
|
|
706
699
|
const makeFileReviewerDefinition = (options = {}) => Agent.define("pr-file-reviewer", {
|
|
707
700
|
input: FileReviewBrief,
|
|
@@ -715,25 +708,13 @@ const makeFileReviewerDefinition = (options = {}) => Agent.define("pr-file-revie
|
|
|
715
708
|
surface: "read-only"
|
|
716
709
|
}
|
|
717
710
|
});
|
|
718
|
-
const makeFanOutReviewerDefinition = (options = {}) => Agent.define("pr-fanout-reviewer", {
|
|
719
|
-
input: ReviewMission,
|
|
720
|
-
output: CodeReview,
|
|
721
|
-
instructions: makeFanOutReviewInstructions(options),
|
|
722
|
-
toolkit: FanOutReviewToolkit,
|
|
723
|
-
policy: defaultFanOutPolicy,
|
|
724
|
-
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.",
|
|
725
|
-
metadata: {
|
|
726
|
-
deploymentClass: "E",
|
|
727
|
-
surface: "read-only",
|
|
728
|
-
delegation: "S1-attached"
|
|
729
|
-
}
|
|
730
|
-
});
|
|
731
711
|
const makeFileReviewDelegation = (child) => Subagent.define("delegate_file_review", {
|
|
732
712
|
description: delegationDescription,
|
|
733
713
|
target: child,
|
|
734
714
|
parameters: FileReviewRequest,
|
|
735
715
|
success: FileReviewUnitResult,
|
|
736
716
|
failure: FileReviewUnitFailed,
|
|
717
|
+
failureMode: "return",
|
|
737
718
|
prepareInput: (request) => Effect.succeed(FileReviewBrief.make({
|
|
738
719
|
unitId: request.unitId,
|
|
739
720
|
paths: request.paths,
|
|
@@ -746,13 +727,34 @@ const makeFileReviewDelegation = (child) => Subagent.define("delegate_file_revie
|
|
|
746
727
|
})),
|
|
747
728
|
policy: fileReviewPolicy
|
|
748
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
|
+
});
|
|
749
750
|
/** Build one coherent fan-out suite: child, coordinator, and delegation. */
|
|
750
751
|
const makeFanOutReviewSuite = (options = {}) => {
|
|
751
752
|
const child = makeFileReviewerDefinition({ guidance: options.guidance });
|
|
753
|
+
const delegation = makeFileReviewDelegation(child);
|
|
752
754
|
return {
|
|
753
755
|
child,
|
|
754
|
-
parent: makeFanOutReviewerDefinition(options),
|
|
755
|
-
delegation
|
|
756
|
+
parent: makeFanOutReviewerDefinition(options, delegation),
|
|
757
|
+
delegation
|
|
756
758
|
};
|
|
757
759
|
};
|
|
758
760
|
const defaultSuite = makeFanOutReviewSuite();
|
|
@@ -762,6 +764,16 @@ const FileReviewer = defaultSuite.child;
|
|
|
762
764
|
const FanOutReviewer = defaultSuite.parent;
|
|
763
765
|
/** The default delegation over the default child. */
|
|
764
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;
|
|
765
777
|
/** Runtime wiring: one delegation plus one explicit child Binding. */
|
|
766
778
|
const fanOutHandlersLayerFor = (delegation) => (childBinding) => SubagentRuntime.layer(delegation, childBinding, { mapChildFailure: mapFileReviewChildFailure });
|
|
767
779
|
/** Runtime wiring over the default delegation, mirroring the leaf example. */
|
|
@@ -1355,6 +1367,6 @@ const fingerprintUnchanged = (current) => Effect.gen(function* () {
|
|
|
1355
1367
|
return Option.isSome(latest) && latest.value === current;
|
|
1356
1368
|
});
|
|
1357
1369
|
//#endregion
|
|
1358
|
-
export { ListReviewUnits as $,
|
|
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 };
|
|
1359
1371
|
|
|
1360
|
-
//# sourceMappingURL=github-
|
|
1372
|
+
//# sourceMappingURL=github-BZNzmxao.mjs.map
|