@effect-agent/pr-review 0.0.1-beta.0

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.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +164 -0
  3. package/dist/action.d.mts +185 -0
  4. package/dist/action.mjs +406 -0
  5. package/dist/action.mjs.map +1 -0
  6. package/dist/cli.d.mts +1 -0
  7. package/dist/cli.mjs +102 -0
  8. package/dist/cli.mjs.map +1 -0
  9. package/dist/fan-out-Dy84-dIs.d.mts +986 -0
  10. package/dist/github-bwQ2V-wb.mjs +1360 -0
  11. package/dist/github-bwQ2V-wb.mjs.map +1 -0
  12. package/dist/index.d.mts +716 -0
  13. package/dist/index.mjs +66 -0
  14. package/dist/index.mjs.map +1 -0
  15. package/dist/providers-DyLJlpJQ.mjs +986 -0
  16. package/dist/providers-DyLJlpJQ.mjs.map +1 -0
  17. package/dist/testing.d.mts +130 -0
  18. package/dist/testing.mjs +228 -0
  19. package/dist/testing.mjs.map +1 -0
  20. package/package.json +54 -0
  21. package/src/action.ts +666 -0
  22. package/src/cli.ts +213 -0
  23. package/src/index.ts +20 -0
  24. package/src/internal/action-entry.ts +41 -0
  25. package/src/internal/coverage.ts +245 -0
  26. package/src/internal/diff.ts +134 -0
  27. package/src/internal/effort.ts +86 -0
  28. package/src/internal/factory.ts +374 -0
  29. package/src/internal/fan-out-scripted.ts +163 -0
  30. package/src/internal/fan-out.ts +447 -0
  31. package/src/internal/fingerprint.ts +74 -0
  32. package/src/internal/fixtures.ts +127 -0
  33. package/src/internal/github-env.ts +128 -0
  34. package/src/internal/github.ts +531 -0
  35. package/src/internal/ignore.ts +88 -0
  36. package/src/internal/profiles.ts +79 -0
  37. package/src/internal/providers.ts +91 -0
  38. package/src/internal/render.ts +428 -0
  39. package/src/internal/review-agent.ts +379 -0
  40. package/src/internal/review-state.ts +488 -0
  41. package/src/internal/review-units.ts +167 -0
  42. package/src/internal/run.ts +397 -0
  43. package/src/internal/scripted.ts +108 -0
  44. package/src/internal/source.ts +110 -0
  45. package/src/testing.ts +8 -0
package/dist/index.mjs ADDED
@@ -0,0 +1,66 @@
1
+ import { $ as ListReviewUnits, $t as MAX_CHANGED_FILES, A as toStoredConcern, At as FileSliceQuery, B as FanOutCoordinatorToolkit, Bt as ReviewFinding, C as StoredReviewFinding, Ct as rankAndDedupeFindings, D as fromStoredFinding, Dt as FileDiffQuery, E as fromStoredConcern, Et as CodeReview, F as FINGERPRINT_MARKER_LENGTH, Ft as MAX_FINDINGS, G as FileReviewDelegationFailure, Gt as clampMaxFindings, H as FanOutReviewToolkit, Ht as ReviewToolkit, I as computeChangesetFingerprint, It as PullRequestReviewer, J as FileReviewToolkit, Jt as makeReviewInstructions, K as FileReviewReport, Kt as defaultReviewPolicy, L as extractFingerprint, Lt as ReadFile, M as unavailableReviewStateAuthenticatorLayer, Mt as ListChangedFiles, N as validateReviewState, Nt as ListChangedFilesQuery, O as selectReviewRange, Ot as FileDiffView, P as webCryptoReviewStateAuthenticatorLayer, Pt as MAX_CONCERNS, Q as FileReviewer, Qt as reviewInstructions, R as renderFingerprintMarker, Rt as ReadFileDiff, S as StoredReviewConcern, St as planReviewUnits, T as computeProfileFingerprint, Tt as ChangedFilesView, U as FanOutReviewer, Ut as ReviewToolkitLayer, V as FanOutCoordinatorToolkitLayer, Vt as ReviewMission, W as FileReviewBrief, Wt as ReviewVerdict, X as FileReviewUnitFailed, Xt as readFileHandler, Y as FileReviewToolkitLayer, Yt as readFileDiffHandler, Z as FileReviewUnitResult, Zt as resolveGuidance, _ as ReviewState, _t as MAX_UNIT_FILES, a as PublishedReview, an as normalizeRepoRelativePath, at as fanOutHandlersLayer, b as ReviewStateMarker, bt as ReviewUnitPlan, c as gitHubPriorReviewsLayer, cn as ChangedPath, ct as fileReviewDelegation, d as GitCommitSha, dn as parsePatch, dt as makeFanOutReviewInstructions, en as MAX_FILE_CHARS, et as ListReviewUnitsQuery, f as MAX_REVIEW_STATE_MARKER_CHARS, ft as makeFanOutReviewSuite, g as ReviewScopeMode, gt as MAX_REVIEW_UNITS, h as ReviewMode, ht as MAX_MERGED_FINDINGS, i as PriorReviews, in as ReviewInputViolation, it as defaultFileReviewerPolicy, j as toStoredFinding, jt as FindingSeverity, k as selectedPullRequestSourceLayer, kt as FileSlice, l as gitHubPullRequestSourceLayer, ln as annotatePatch, lt as fileReviewPolicy, m as ReviewHeadComparison, mt as mapFileReviewChildFailure, n as GitHubReviewTarget, nn as PullRequestSource, nt as MAX_CHILD_FINDINGS, o as ReviewPublisher, on as ChangedFile, ot as fanOutHandlersLayerFor, p as ReviewExecutionContext, pt as makeFileReviewerInstructions, q as FileReviewRequest, qt as listChangedFilesHandler, r as PriorReviewLookupFailure, rn as PullRequestSourceFailure, rt as defaultFanOutPolicy, s as fingerprintUnchanged, sn as ChangedFileStatus, st as fanOutReviewInstructions, t as GitHubApiFailure, tn as PullRequestMetadata, tt as MAX_CHILD_CONCERNS, u as gitHubReviewPublisherLayer, un as commentableLines, ut as fileReviewerInstructions, v as ReviewStateAuthenticationFailure, vt as ReviewUnit, w as buildProfileMission, wt as ChangedFileSummary, x as ReviewStateMarkerTooLarge, xt as UNIT_CHANGED_LINE_BUDGET, y as ReviewStateAuthenticator, yt as ReviewUnitId, z as DelegateFileReview, zt as ReviewConcern } from "./github-bwQ2V-wb.mjs";
2
+ import { A as InvalidEffortInput, C as ReviewEvent, D as compileIgnoreGlobs, E as planPublication, F as ReviewCoverage, I as ReviewShape, L as assessReviewCoverage, M as parseEffortPosition, N as resolveEffortRung, O as ignoringPullRequestSourceLayer, P as FailedReviewUnit, S as ReviewCommentDraft, T as anchorViolation, _ as buildReviewMission, a as anthropicClientLayer, b as fanOutReviewBudgetLimits, c as makeOpenAiReviewModel, d as ReviewTargetUnresolved, f as gitHubReviewLayers, g as ReviewRunOutcome, h as PrReview, i as PROVIDER_EFFORT_RUNGS, j as isEffortPosition, k as EFFORT_ALIASES, l as openAiClientLayer, m as resolveReviewTarget, n as DEFAULT_PROVIDER, o as describeReviewModel, p as readGitHubEvent, r as PROVIDER_CREDENTIAL_ENV, s as makeAnthropicReviewModel, t as DEFAULT_MODEL, u as GitHubEventWire, v as enforceFindingsBound, w as ReviewPublicationPlan, x as reviewBudgetLimits, y as executeReview } from "./providers-DyLJlpJQ.mjs";
3
+ import { Schema } from "effect";
4
+ //#region src/internal/profiles.ts
5
+ /** The flat reviewer's committed capability claim. */
6
+ var PullRequestReviewerProfile = class extends Schema.Class("@effect-agent/pr-review/PullRequestReviewerProfile")({
7
+ /** Ephemeral runtime: one bounded AgentRuntime.run per invocation. */
8
+ deploymentClass: Schema.Literal("E"),
9
+ /** Every model-callable tool is a read of the pull request; none mutate. */
10
+ readOnlyToolSurface: Schema.Literal(true),
11
+ /** The review is posted by the host AFTER the run settles, never by a tool. */
12
+ publicationOutsideAgentLoop: Schema.Literal(true),
13
+ /** Finding anchors are validated against the parsed diff before posting. */
14
+ anchorsValidatedBeforePublication: Schema.Literal(true),
15
+ /** The live profile is env-gated out of every ordinary test gate. */
16
+ liveProfileOptIn: Schema.Literal(true),
17
+ /** Never claimed at any phase (DUR-003). */
18
+ exactlyOnceExternalEffects: Schema.Literal(false)
19
+ }) {};
20
+ const pullRequestReviewerProfile = PullRequestReviewerProfile.make({
21
+ deploymentClass: "E",
22
+ readOnlyToolSurface: true,
23
+ publicationOutsideAgentLoop: true,
24
+ anchorsValidatedBeforePublication: true,
25
+ liveProfileOptIn: true,
26
+ exactlyOnceExternalEffects: false
27
+ });
28
+ /** The fan-out reviewer's committed capability claim, schema-first. */
29
+ var FanOutReviewerProfile = class extends Schema.Class("@effect-agent/pr-review/FanOutReviewerProfile")({
30
+ /** Ephemeral runtime: one bounded AgentRuntime.run per invocation. */
31
+ deploymentClass: Schema.Literal("E"),
32
+ /** Every model-callable tool — parent and child — is a read; none mutate. */
33
+ readOnlyToolSurface: Schema.Literal(true),
34
+ /** The review is posted by the host AFTER the run settles, never by a tool. */
35
+ publicationOutsideAgentLoop: Schema.Literal(true),
36
+ /** Child findings are untrusted; anchors are validated against the parsed diff. */
37
+ anchorsValidatedBeforePublication: Schema.Literal(true),
38
+ /** S1 attached ephemeral delegation at depth 1; nested delegation is rejected. */
39
+ attachedEphemeralDelegation: Schema.Literal(true),
40
+ /** A failed unit surfaces to the coordinator as a typed failed result, never retried. */
41
+ failedUnitsReportedNotRetried: Schema.Literal(true),
42
+ /** The live profile is env-gated out of every ordinary test gate. */
43
+ liveProfileOptIn: Schema.Literal(true),
44
+ /** Never claimed at any phase (DUR-003). */
45
+ exactlyOnceExternalEffects: Schema.Literal(false)
46
+ }) {};
47
+ const fanOutReviewerProfile = FanOutReviewerProfile.make({
48
+ deploymentClass: "E",
49
+ readOnlyToolSurface: true,
50
+ publicationOutsideAgentLoop: true,
51
+ anchorsValidatedBeforePublication: true,
52
+ attachedEphemeralDelegation: true,
53
+ failedUnitsReportedNotRetried: true,
54
+ liveProfileOptIn: true,
55
+ exactlyOnceExternalEffects: false
56
+ });
57
+ const LIVE_GATE_ENV = "EFFECT_AGENT_LIVE";
58
+ /**
59
+ * `EFFECT_AGENT_LIVE=1` plus the named credential is the only enabling
60
+ * combination for live (network, billed) profiles.
61
+ */
62
+ const liveProfileEnabled = (env, credentialEnv) => env["EFFECT_AGENT_LIVE"] === "1" && (env[credentialEnv] ?? "") !== "";
63
+ //#endregion
64
+ export { ChangedFile, ChangedFileStatus, ChangedFileSummary, ChangedFilesView, ChangedPath, CodeReview, DEFAULT_MODEL, DEFAULT_PROVIDER, DelegateFileReview, EFFORT_ALIASES, FINGERPRINT_MARKER_LENGTH, FailedReviewUnit, FanOutCoordinatorToolkit, FanOutCoordinatorToolkitLayer, FanOutReviewToolkit, FanOutReviewer, FanOutReviewerProfile, FileDiffQuery, FileDiffView, FileReviewBrief, FileReviewDelegationFailure, FileReviewReport, FileReviewRequest, FileReviewToolkit, FileReviewToolkitLayer, FileReviewUnitFailed, FileReviewUnitResult, FileReviewer, FileSlice, FileSliceQuery, FindingSeverity, GitCommitSha, GitHubApiFailure, GitHubEventWire, GitHubReviewTarget, InvalidEffortInput, LIVE_GATE_ENV, ListChangedFiles, ListChangedFilesQuery, ListReviewUnits, ListReviewUnitsQuery, MAX_CHANGED_FILES, MAX_CHILD_CONCERNS, MAX_CHILD_FINDINGS, MAX_CONCERNS, MAX_FILE_CHARS, MAX_FINDINGS, MAX_MERGED_FINDINGS, MAX_REVIEW_STATE_MARKER_CHARS, MAX_REVIEW_UNITS, MAX_UNIT_FILES, PROVIDER_CREDENTIAL_ENV, PROVIDER_EFFORT_RUNGS, PrReview, PriorReviewLookupFailure, PriorReviews, PublishedReview, PullRequestMetadata, PullRequestReviewer, PullRequestReviewerProfile, PullRequestSource, PullRequestSourceFailure, ReadFile, ReadFileDiff, ReviewCommentDraft, ReviewConcern, ReviewCoverage, ReviewEvent, ReviewExecutionContext, ReviewFinding, ReviewHeadComparison, ReviewInputViolation, ReviewMission, ReviewMode, ReviewPublicationPlan, ReviewPublisher, ReviewRunOutcome, ReviewScopeMode, ReviewShape, ReviewState, ReviewStateAuthenticationFailure, ReviewStateAuthenticator, ReviewStateMarker, ReviewStateMarkerTooLarge, ReviewTargetUnresolved, ReviewToolkit, ReviewToolkitLayer, ReviewUnit, ReviewUnitId, ReviewUnitPlan, ReviewVerdict, StoredReviewConcern, StoredReviewFinding, UNIT_CHANGED_LINE_BUDGET, anchorViolation, annotatePatch, anthropicClientLayer, assessReviewCoverage, buildProfileMission, buildReviewMission, clampMaxFindings, commentableLines, compileIgnoreGlobs, computeChangesetFingerprint, computeProfileFingerprint, defaultFanOutPolicy, defaultFileReviewerPolicy, defaultReviewPolicy, describeReviewModel, enforceFindingsBound, executeReview, extractFingerprint, fanOutHandlersLayer, fanOutHandlersLayerFor, fanOutReviewBudgetLimits, fanOutReviewInstructions, fanOutReviewerProfile, fileReviewDelegation, fileReviewPolicy, fileReviewerInstructions, fingerprintUnchanged, fromStoredConcern, fromStoredFinding, gitHubPriorReviewsLayer, gitHubPullRequestSourceLayer, gitHubReviewLayers, gitHubReviewPublisherLayer, ignoringPullRequestSourceLayer, isEffortPosition, listChangedFilesHandler, liveProfileEnabled, makeAnthropicReviewModel, makeFanOutReviewInstructions, makeFanOutReviewSuite, makeFileReviewerInstructions, makeOpenAiReviewModel, makeReviewInstructions, mapFileReviewChildFailure, normalizeRepoRelativePath, openAiClientLayer, parseEffortPosition, parsePatch, planPublication, planReviewUnits, pullRequestReviewerProfile, rankAndDedupeFindings, readFileDiffHandler, readFileHandler, readGitHubEvent, renderFingerprintMarker, resolveEffortRung, resolveGuidance, resolveReviewTarget, reviewBudgetLimits, reviewInstructions, selectReviewRange, selectedPullRequestSourceLayer, toStoredConcern, toStoredFinding, unavailableReviewStateAuthenticatorLayer, validateReviewState, webCryptoReviewStateAuthenticatorLayer };
65
+
66
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/internal/profiles.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\n// ---------------------------------------------------------------------------\n// Committed capability claims, schema-first: what this package's reviewers\n// promise and — just as deliberately — what they never claim. Deployment\n// class E (ephemeral): one bounded AgentRuntime.run per invocation, no\n// durability, no exactly-once external effects (DUR-003).\n// ---------------------------------------------------------------------------\n\n/** The flat reviewer's committed capability claim. */\nexport class PullRequestReviewerProfile extends Schema.Class<PullRequestReviewerProfile>(\n \"@effect-agent/pr-review/PullRequestReviewerProfile\",\n)({\n /** Ephemeral runtime: one bounded AgentRuntime.run per invocation. */\n deploymentClass: Schema.Literal(\"E\"),\n /** Every model-callable tool is a read of the pull request; none mutate. */\n readOnlyToolSurface: Schema.Literal(true),\n /** The review is posted by the host AFTER the run settles, never by a tool. */\n publicationOutsideAgentLoop: Schema.Literal(true),\n /** Finding anchors are validated against the parsed diff before posting. */\n anchorsValidatedBeforePublication: Schema.Literal(true),\n /** The live profile is env-gated out of every ordinary test gate. */\n liveProfileOptIn: Schema.Literal(true),\n /** Never claimed at any phase (DUR-003). */\n exactlyOnceExternalEffects: Schema.Literal(false),\n}) {}\n\nexport const pullRequestReviewerProfile = PullRequestReviewerProfile.make({\n deploymentClass: \"E\",\n readOnlyToolSurface: true,\n publicationOutsideAgentLoop: true,\n anchorsValidatedBeforePublication: true,\n liveProfileOptIn: true,\n exactlyOnceExternalEffects: false,\n});\n\n/** The fan-out reviewer's committed capability claim, schema-first. */\nexport class FanOutReviewerProfile extends Schema.Class<FanOutReviewerProfile>(\n \"@effect-agent/pr-review/FanOutReviewerProfile\",\n)({\n /** Ephemeral runtime: one bounded AgentRuntime.run per invocation. */\n deploymentClass: Schema.Literal(\"E\"),\n /** Every model-callable tool — parent and child — is a read; none mutate. */\n readOnlyToolSurface: Schema.Literal(true),\n /** The review is posted by the host AFTER the run settles, never by a tool. */\n publicationOutsideAgentLoop: Schema.Literal(true),\n /** Child findings are untrusted; anchors are validated against the parsed diff. */\n anchorsValidatedBeforePublication: Schema.Literal(true),\n /** S1 attached ephemeral delegation at depth 1; nested delegation is rejected. */\n attachedEphemeralDelegation: Schema.Literal(true),\n /** A failed unit surfaces to the coordinator as a typed failed result, never retried. */\n failedUnitsReportedNotRetried: Schema.Literal(true),\n /** The live profile is env-gated out of every ordinary test gate. */\n liveProfileOptIn: Schema.Literal(true),\n /** Never claimed at any phase (DUR-003). */\n exactlyOnceExternalEffects: Schema.Literal(false),\n}) {}\n\nexport const fanOutReviewerProfile = FanOutReviewerProfile.make({\n deploymentClass: \"E\",\n readOnlyToolSurface: true,\n publicationOutsideAgentLoop: true,\n anchorsValidatedBeforePublication: true,\n attachedEphemeralDelegation: true,\n failedUnitsReportedNotRetried: true,\n liveProfileOptIn: true,\n exactlyOnceExternalEffects: false,\n});\n\nexport const LIVE_GATE_ENV = \"EFFECT_AGENT_LIVE\";\n\n/**\n * `EFFECT_AGENT_LIVE=1` plus the named credential is the only enabling\n * combination for live (network, billed) profiles.\n */\nexport const liveProfileEnabled = (\n env: Record<string, string | undefined>,\n credentialEnv: string,\n): boolean => env[LIVE_GATE_ENV] === \"1\" && (env[credentialEnv] ?? \"\") !== \"\";\n"],"mappings":";;;;;AAUA,IAAa,6BAAb,cAAgD,OAAO,MACrD,oDACF,CAAC,CAAC;;CAEA,iBAAiB,OAAO,QAAQ,GAAG;;CAEnC,qBAAqB,OAAO,QAAQ,IAAI;;CAExC,6BAA6B,OAAO,QAAQ,IAAI;;CAEhD,mCAAmC,OAAO,QAAQ,IAAI;;CAEtD,kBAAkB,OAAO,QAAQ,IAAI;;CAErC,4BAA4B,OAAO,QAAQ,KAAK;AAClD,CAAC,CAAC,CAAC,CAAC;AAEJ,MAAa,6BAA6B,2BAA2B,KAAK;CACxE,iBAAiB;CACjB,qBAAqB;CACrB,6BAA6B;CAC7B,mCAAmC;CACnC,kBAAkB;CAClB,4BAA4B;AAC9B,CAAC;;AAGD,IAAa,wBAAb,cAA2C,OAAO,MAChD,+CACF,CAAC,CAAC;;CAEA,iBAAiB,OAAO,QAAQ,GAAG;;CAEnC,qBAAqB,OAAO,QAAQ,IAAI;;CAExC,6BAA6B,OAAO,QAAQ,IAAI;;CAEhD,mCAAmC,OAAO,QAAQ,IAAI;;CAEtD,6BAA6B,OAAO,QAAQ,IAAI;;CAEhD,+BAA+B,OAAO,QAAQ,IAAI;;CAElD,kBAAkB,OAAO,QAAQ,IAAI;;CAErC,4BAA4B,OAAO,QAAQ,KAAK;AAClD,CAAC,CAAC,CAAC,CAAC;AAEJ,MAAa,wBAAwB,sBAAsB,KAAK;CAC9D,iBAAiB;CACjB,qBAAqB;CACrB,6BAA6B;CAC7B,mCAAmC;CACnC,6BAA6B;CAC7B,+BAA+B;CAC/B,kBAAkB;CAClB,4BAA4B;AAC9B,CAAC;AAED,MAAa,gBAAgB;;;;;AAM7B,MAAa,sBACX,KACA,kBACY,IAAA,yBAAuB,QAAQ,IAAI,kBAAkB,QAAQ"}