@effect-agent/pr-review 0.1.0-beta.48 → 0.1.0-beta.50

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/README.md CHANGED
@@ -1,112 +1,175 @@
1
1
  # @effect-agent/pr-review
2
2
 
3
- A small, provider-neutral review agent. Bounded model runs receive admitted patches as
4
- literal unified diffs, read immutable base or head source when needed, record established
5
- findings with `record_finding`, and return findings through a required native completion Tool.
6
- There is no voting, candidate cache, private hypothesis
7
- handoff, or repository code execution.
8
-
9
- The native Agent `inputPrompt` projects each complete patch once, with literal newlines. It keeps
10
- file headers, hunk ranges, additions, deletions, context, and mode or rename metadata. It does not
11
- duplicate context into separate old/new views or JSON-escape the source for the model. The canonical
12
- `ReviewRequest` and finding validation retain the original patches. This reduces repeated input
13
- overhead without excluding changes; it does not guarantee a complete review within a spending cap.
14
-
15
- The reviewer assesses every supplied patch first. Source reads resolve concrete questions about
16
- plausible defects, such as a missing caller, guard, contract, or limit. It reuses supplied evidence
17
- and finishes when those questions are resolved; straightforward changes can finish without source
18
- tools. Reads prioritize implementation and owned boundary schemas over test examples, including
19
- the definitions needed to resolve the question rather than only a nearby call site.
20
- Findings explain a supported trigger, concrete impact, and needed correction. Changes that
21
- expose an unchanged downstream failure remain eligible. Incremental findings must arise from the
22
- exact delta; unrelated old bugs and target-only changes stay out of scope, while explicit reverts
23
- remain reviewable.
24
- Changes to collection membership, cardinality, or representation warrant checking affected
25
- consumer limits with a supported boundary input, including transformations and aggregation.
26
- New or moved resource acquisition warrants checking an early-failure sequence and its cleanup.
27
- Owned untrusted-input and model-output Schema boundaries must safely handle every admitted value,
28
- including adversarial values at the field and collection bounds.
29
- Novelty compares base and head with the same supported operation input, including when a
30
- previously failing helper becomes newly reachable.
31
-
32
- The result contains model findings with host-validated paths and line anchors, exact duplicate
33
- removal, aggregate usage, and optional host-priced cost. Unknown changed paths fail closed and
34
- invalid inline anchors become top-level findings. Model output, usage, context, and retained response
35
- bytes remain bounded. Public finding paths, titles, and bodies retain their 512, 200, and
36
- 2,000-character limits.
37
-
38
- Hosts may supply up to eight `ReviewFollowUp` values containing complete prior feedback, each
39
- bounded to 32,000 characters. The reviewer separately checks those blockers against current source
40
- and may return `ReviewOutcome.resolutions` with their exact IDs and fixing evidence. Omitted or
41
- uncertain resolutions leave prior feedback open. Unknown or duplicate resolution IDs fail
42
- verification. Incomplete, exhausted, pending-path, or excluded-path results return no resolutions.
43
- Follow-ups appear only in the final patch batch, sharing the existing execution and spending limits.
44
- They do not expand new-finding scope or declare a partial review safe to merge.
45
- GitHub history, credentials, selection, dismissal authorization, and publication belong to the host.
46
-
47
- Without host spending admission, the engine owns a cumulative 416,000-token stop policy and
48
- reserves 160,000 tokens for a final context and completion response. The model sees its current
49
- turn, tool, and token usage. Token, turn, or tool exhaustion permits one constrained completion
50
- through `submit_review`; it returns validated findings and accounted usage with
51
- `ReviewOutcome.exhausted` naming the limit. Hosts must
52
- treat that outcome as incomplete, even when it contains no findings. Measured usage can exceed a
53
- policy threshold before the engine observes it; this is not a provider-side spending cap.
54
- The usage ledger records research, compaction, and finalization without a second token limit that
55
- could abort delivery.
56
-
57
- An optional `costControl` reports the host's pre-request spending admission and provider usage.
58
- Supplying it replaces the cumulative token quota and completion reserve with that admission.
59
- Cached reads still contribute to usage diagnostics, but cannot force early token finalization.
60
- Cost-admitted runs allow up to 64 turns, matching the 64-tool-call allowance, while retaining
61
- the shared 5-minute and 128,000-token context bounds. Uncapped runs retain eight turns. A cost
62
- estimator alone does not disable the token quota. Capped hosts own model-visible spending feedback
63
- at their provider boundary; the generic turn/tool status is disabled for these runs. The Action
64
- counts its outgoing spending status before admission and keeps it outside the reusable cache prefix.
65
- With `costControl`, large requests run in sequential batches of at most 256,000 patch characters,
66
- preserving the host's file order and keeping each patch complete. One patch may use the full
67
- 256,000-character batch capacity. Each batch has a fresh context
68
- and the same source service. All batches share the host ledger, turn and tool allowances, deadline,
69
- and 24-finding capacity. They stop on an incomplete result or exhaustion. `pendingPaths` identifies
70
- admitted patches never sent to a model, including a batch refused before paid inference. Hosts
71
- must disclose those paths as unreviewed. Without `costControl`, the reviewer retains one run and its
72
- cumulative token policy.
73
- When the host stops research for cost, the reviewer returns `exhausted: "cost"` and delivers
74
- recorded findings without requiring another paid call. Hosts must reserve the full possible charge
75
- before sending each request; the port itself does not enforce a cap. The
76
- [GitHub Action](../../action/README.md) supplies that implementation for its supported OpenAI models.
77
- `reservedCostMicrousd` reports the maximum additional charge for requests whose usage is still
78
- unknown, separately from the observed usage estimate.
79
-
80
- Recorded findings also survive a later expected execution or verification failure. Such a result
81
- has `incomplete: true`; hosts must not treat an empty or partial result as clearing the change.
82
- The model can also set `incomplete: true` in `submit_review` when it cannot finish assessing the
83
- supplied patches. That declaration preserves findings and becomes `ReviewOutcome.incomplete`
84
- even when no engine limit or provider failure occurred. Host-tracked `unreviewedPaths` remain
85
- disclosed separately and do not by themselves mark the admitted patches unfinished. An empty
86
- complete result is not proof that the repository is defect-free.
87
- With `costControl`, an accounted provider attempt also returns an incomplete outcome after an
88
- expected failure, even without findings, so hosts can publish its usage and outstanding charges.
89
- An engine context-limit failure or the host's
90
- `costControl.snapshot.inputLimitExceeded` returns an incomplete `exhausted: "tokens"` outcome,
91
- even before any paid attempt. Batches that never started remain in `pendingPaths`.
92
- Otherwise failures without recorded findings remain typed. Defects and interruption still
93
- propagate, and these records belong to the current run's Scope, not persistent storage.
94
- The report retains recorded findings before adding newly submitted findings, removes exact
95
- duplicates, and marks coverage incomplete if the combined report exceeds 24 findings.
3
+ A provider-neutral agent that reviews an exact base-to-head change using a complete change
4
+ index, paged diffs, and immutable source tools. One conversation follows related behavior across
5
+ files. There are no separate patch batches, candidate pipeline, voting, or repository execution.
6
+
7
+ ## Evidence and findings
8
+
9
+ The initial prompt includes every admitted path and its character range in one literal diff
10
+ artifact. Changes up to 32,000 characters are included directly. Larger changes use `read_diff`:
11
+ start at offset zero and follow `nextOffset`, or select a file's start offset from the index.
12
+ Pages contain at most 32,000 UTF-16 characters and can cross file boundaries or split lines.
13
+ Original unified patches, hunk coordinates, deletions, renames, and mode metadata remain intact.
14
+
15
+ `read_file` reads up to 200 lines and 20,000 characters at the exact base or head.
16
+ `find_files` searches filenames. `search_code` searches literal, case-sensitive source text to
17
+ find definitions, callers, consumers, and tests, including unchanged code. Its path filter is a
18
+ filename substring; cursor zero starts the search. Each page scans twenty authorized files,
19
+ returns up to five matching lines per file, and provides `nextCursor` for more files.
20
+ `truncated` identifies omitted matching lines and `unreadablePaths` identifies failed reads.
21
+ A partial or failed search cannot establish that a caller is absent.
22
+
23
+ The reviewer turns changed contracts into material, falsifiable questions and traces evidence
24
+ for and against them across callers and consumers. Before recording a defect, it checks the
25
+ strongest relevant guard, documented exception, or alternative interpretation and establishes
26
+ why the supported trigger still causes concrete impact. It checks base/head causation, boundary
27
+ values, cleanup, concurrency, and whether changed tests would detect the claimed failure.
28
+ New features must satisfy their stated contracts, including validation, limits, isolation,
29
+ and aggregation; a bypass can be a defect even when the old code also accepted that input.
30
+ Unrelated old bugs, speculation, style, compiler diagnostics, and generic test requests are
31
+ excluded. Incremental reviews limit new findings to their exact delta.
32
+
33
+ The shared finding rubric, parent review procedure, and host-supplied repository policy are
34
+ separate instructions. Policy findings identify the specific rule and applicable exceptions,
35
+ citing instruction paths and lines when available. An explicitly reviewable architecture
36
+ contract can warrant a finding without a runtime failure; its supplied severity takes precedence.
37
+
38
+ `record_finding` is the only way to add findings to the report. The model is instructed to record
39
+ each distinct root cause once and recover the saved ledger with `review_status` after `new_context`,
40
+ without re-recording an issue with revised wording or severity. Counterevidence must be checked
41
+ before recording because the ledger has no retraction or revision operation. `submit_review` is the
42
+ required native completion tool and accepts only `blockedOn` and `resolutions` metadata.
43
+ The host builds the final report directly from the ledger, so completion never rewrites or merges
44
+ findings. Extra completion fields fail validation.
45
+
46
+ The host validates changed paths and RIGHT-side line anchors, demotes invalid anchors to
47
+ top-level findings, and removes only exact repeated records. Distinct defects at the same path
48
+ and line remain separate. Up to 24 findings are retained, prioritizing blocking over important
49
+ over minor findings. Overflow always marks the result incomplete, regardless of later completion.
50
+ Finding paths, titles, and bodies retain their 512, 200, and 2,000-character bounds.
51
+
52
+ ## Coverage and limits
53
+
54
+ Requests admit up to 1,000 distinct changed paths, 2,000,000 characters per patch, and 8,000,000
55
+ patch characters overall. These are host input limits, separate from the model's working context.
56
+ Source hosts can apply additional authorization and admission bounds.
57
+
58
+ The host tracks diff ranges available to completed model requests. Merely issuing a read, repeating
59
+ a page, skipping ahead, or failing a tool does not establish complete coverage. `pendingPaths`
60
+ includes partially read files. `review_status` recovers saved findings and outstanding ranges;
61
+ its optional cursor pages through the current pending list. While a range remains unread,
62
+ `submit_review` returns a recoverable error with the next unread offset. The same run continues
63
+ under its original budgets. A native budget stop preserves the pending paths and findings as
64
+ incomplete; repeated completion refusals cannot restart the run or reset its allowance.
65
+ Reading all ranges is necessary, but it does not prove that the model assessed every behavior.
66
+
67
+ `review_status` also keeps a bounded investigation notebook for the lifetime of the review.
68
+ Replace it with `notes: { text, expectedRevision }`; text is limited to 4,000 characters and
69
+ stale revisions fail without overwriting newer notes. The response supplies the current text and
70
+ revision. Notes preserve unresolved questions, exact evidence references, and next checks across
71
+ rollover. They are model-authored context, never proof of coverage or a source of findings.
72
+ Only the accepted-update count (`notesUpdates`) leaves the review; note text is not persisted in
73
+ the outcome. Children cannot update the parent's notebook.
74
+
75
+ Completion means a source-based assessment of the admitted changes and material supported
76
+ hypotheses, not proof of correctness or an exhaustive audit of every dependency. The model can
77
+ report `blockedOn` only for specific unavailable evidence, naming the affected behavior and its
78
+ attempts to retrieve that evidence. It must still review the remaining patches. The bounded
79
+ reason is retained in the outcome and summary, forces incompleteness, and prevents resolutions.
80
+ Excluded artifacts, lack of live execution, and hypothetical uncertainty do not themselves
81
+ block assessment of the admitted change.
82
+
83
+ Every parent conversation has 128 model turns, 512 tool calls, four concurrent tools, and a five-minute deadline.
84
+ The default `compaction: "rollover"` strategy uses a 48,000-token working context to bound
85
+ context growth during large reviews. Hosts can select `compaction: "prune"`
86
+ and an integer `contextTokenLimit` from 16,000 to 128,000. These settings do not widen host input
87
+ admission or create new spending, turn, or tool allowances. Invalid options fail before model work.
88
+
89
+ Native rollover starts a fresh window without a summarizer call. Its bounded recovery excerpt
90
+ may omit unseen tool results, so undelivered diff pages remain unread and must be fetched again.
91
+ Already delivered ranges and saved findings survive. Both strategies support calling `new_context`
92
+ alone with a handoff; original instructions and the complete change index remain available.
93
+
94
+ Every measured outcome includes `compactions`, an array of emitted native `CompactionPerformed`
95
+ events containing only `kind`, `turn`, `tokensBeforeEstimate`, and `tokensAfterEstimate`.
96
+ An empty array means no event was emitted; absence means the outcome supplied no measurement.
97
+ The array is bounded to 512 entries and includes events retained before a typed failure. It does
98
+ not expose source or handoff text, and events alone do not distinguish automatic from requested
99
+ rollovers. Boundaries that fail before event emission are not counted.
100
+
101
+ Without `costControl`, the engine applies a cumulative 416,000-token policy with a 160,000-token
102
+ completion reserve. A host cost estimator alone does not disable it. With `costControl`, the
103
+ host reserves the full possible charge before each provider call, replacing that token quota.
104
+ The [GitHub Action](../../action/README.md) supplies spending admission for supported OpenAI models.
105
+ Recorded findings survive a cost stop without requiring another paid call. `reservedCostMicrousd`
106
+ reports maximum additional charges for sent requests whose usage remains unknown.
107
+
108
+ Token, turn, tool, or cost exhaustion is incomplete. Expected failures preserve recorded findings
109
+ and completed model attempts, including their accounting when no finding was recorded. Context/input-token
110
+ refusals return an incomplete token-exhausted outcome before paid inference when possible.
111
+ Failures before any model attempt, finding, or budget refusal remain typed. Defects and interruption propagate, and every
112
+ resource belongs to the review's Scope. Excluded host `unreviewedPaths` remain separately disclosed.
113
+ An empty result never proves that the repository is defect-free.
114
+
115
+ ## Optional research children
116
+
117
+ The default reviewer runs alone. Experiments can provide `research: { model, concurrency: 2 }`
118
+ to expose native `delegate_research`. Concurrency is either one or two (default two), with at
119
+ most two children established per review. Each child has six ordinary model turns, twelve tool
120
+ calls, a 60-second deadline, and a 32,000-token context using native pruning. The runtime can
121
+ reserve a final completion response after structural exhaustion. The host configures the child
122
+ model's output limit; the eval uses 4,000 tokens.
123
+
124
+ A delegation supplies one unresolved, falsifiable question whose answer could change a finding,
125
+ and one to three distinct admitted changed paths. Instructions ask neutrally for supporting or
126
+ refuting evidence and discourage generic second reviews; children use the same finding rubric.
127
+ The host selects their exact patches, rejecting more than 32,000 total patch characters.
128
+ Children receive the immutable revisions and current saved findings, and can use only the
129
+ three repository read tools, `record_finding`, and `finish_research`. The completion contains
130
+ an evidence summary and incomplete flag; findings go directly to the same canonical ledger.
131
+ Children cannot delegate further, establish parent diff coverage, or resolve prior reviews.
132
+
133
+ Native reservations and child fibers belong to the review's Scope. Child compaction cannot
134
+ change the parent's unread ranges. Child model requirements remain visible in the review's
135
+ Effect requirements, and usage contributes to the existing accounting. A host supplying
136
+ `costControl` must use the same admission service for both model layers, so all requests draw
137
+ from one spending cap. Without host admission, the parent and child native token policies are
138
+ separate; the parent token quota is not a combined spending cap.
139
+
140
+ Research-enabled runs break equal-severity finding ties by their complete serialized values
141
+ before retaining 24, so child completion order cannot select the survivors. Exact duplicates
142
+ are still the only records removed. A rejected delegation, failed or interrupted child,
143
+ unfinished join, child-reported incomplete result, or child budget exhaustion makes the parent
144
+ incomplete and suppresses resolutions. Defects and external interruption still propagate.
145
+
146
+ Measured outcomes include `research` counters: `delegations` counts declared delegation calls;
147
+ `started`, `completed`, `failed`, and `interrupted` count emitted native child events; `incomplete`
148
+ counts completed child results that report incomplete or exhausted work. Zero counts are measured
149
+ zero, while an absent field means no measurement was supplied. Counts contain no child source,
150
+ summary, or transcript; prestart refusals have a declaration but no child event.
151
+
152
+ ## Follow-ups and hosting
153
+
154
+ Hosts can supply up to eight prior `ReviewFollowUp` values, each up to 32,000 characters. The
155
+ reviewer verifies every blocker in a follow-up against current source before returning its exact
156
+ ID and fixing evidence. Unknown or duplicate resolution IDs fail verification. Incomplete,
157
+ exhausted, pending-path, or excluded-path results return no resolutions. History selection,
158
+ credentials, dismissal authorization, and publication belong to the host.
96
159
 
97
160
  ```ts
98
- const reviewer = makeReviewer({ model, guidance, estimateCostMicrousd, costControl });
161
+ const reviewer = makeReviewer({ model, guidance, costControl });
99
162
  const program = reviewer.review(request).pipe(Effect.provideService(ReviewRepository, repository));
100
163
  ```
101
164
 
102
- `repository.readFile` and `repository.findFiles` return typed Effects. Hosts must
103
- authorize the source sent to their model, enforce immutable revisions and read
104
- bounds, and treat source content as untrusted data. The reviewer exposes this
105
- dependency in its Effect requirements; it has no ambient filesystem or network
106
- access and does not cache review answers.
107
-
108
- `ReviewSource.fromText(request, text)` applies the shared line and character
109
- bounds after the host authorizes and reads a file.
165
+ `ReviewRepository` implementations provide typed Effect operations for `readFile`, `findFiles`,
166
+ and `searchCode`. Hosts authorize source sent to models, pin immutable revisions, enforce read
167
+ bounds, and treat all source and model output as untrusted. The reviewer has no ambient filesystem
168
+ or network access. `ReviewSource.fromText` applies the shared source-range bounds.
110
169
 
111
- Portions of the review instructions are adapted from
112
- [PR-Agent](https://github.com/The-PR-Agent/pr-agent). See `NOTICE` for its MIT license attribution.
170
+ The navigable diff approach is informed by [Pullfrog's review workflow](https://github.com/pullfrog/pullfrog/blob/0212dedb0f92b8ba4020c17dc30d3eced32415d7/modes.ts)
171
+ and [Codex's review task](https://github.com/openai/codex/blob/588b781ab4924ce7352488394028e63d74cf807f/codex-rs/core/src/tasks/review.rs).
172
+ These designs do not establish accuracy. The [eval bench](../../examples/pr-review-eval/README.md)
173
+ measures first-trial detection, false positives, and incomplete runs against adjudicated cases.
174
+ Portions of the original review instructions were adapted from
175
+ [PR-Agent](https://github.com/The-PR-Agent/pr-agent); see `NOTICE` for its MIT attribution.
package/dist/Review.d.mts CHANGED
@@ -1,16 +1,42 @@
1
- import { a as ReviewSource, i as ReviewRepository, n as ReviewContextError, r as ReviewFileList } from "./ReviewRepository-Bx4ikyhF.mjs";
2
- import { Effect, Schema } from "effect";
1
+ import { i as ReviewRepository, n as ReviewContextError, o as ReviewSearchResult, r as ReviewFileList, s as ReviewSource } from "./ReviewRepository-Wd_4qCaO.mjs";
2
+ import { Effect, Layer, Schema } from "effect";
3
3
  import * as Agent from "effect-agent/Agent";
4
4
  import * as AgentRuntime from "effect-agent/AgentRuntime";
5
+ import { ContextCompactor } from "effect-agent/ContextCompactor";
5
6
  import { IdGenerator } from "effect-agent/IdGenerator";
6
7
  import { RunCostEstimator } from "effect-agent/RunOptions";
7
8
  import { ThreadHistory } from "effect-agent/ThreadHistory";
8
9
  import { LanguageModel, Model, Tool } from "effect/unstable/ai";
9
10
  declare namespace Review_d_exports {
10
- export { MAX_REVIEW_PATCH_CHARS, ReviewCategory, ReviewChange, ReviewCostControl, ReviewCostSnapshot, ReviewFinding, ReviewFollowUp, ReviewOutcome, ReviewReport, ReviewRequest, ReviewResolution, ReviewSeverity, ReviewUsage, ReviewVerificationError, ReviewerOptions, isCommentableLine, makeReviewer };
11
+ export { MAX_REVIEW_FILES, MAX_REVIEW_PATCH_CHARS, MAX_REVIEW_TOTAL_PATCH_CHARS, ReviewCategory, ReviewChange, ReviewCompaction, ReviewCompactionEvent, ReviewContextTokenLimit, ReviewCostControl, ReviewCostSnapshot, ReviewFinding, ReviewFollowUp, ReviewOutcome, ReviewReport, ReviewRequest, ReviewResearchConcurrency, ReviewResearchStats, ReviewResolution, ReviewSeverity, ReviewUsage, ReviewVerificationError, ReviewerOptions, isCommentableLine, makeReviewer };
11
12
  }
12
- /** Maximum patch text per batch; one complete file may occupy the entire batch. */
13
- declare const MAX_REVIEW_PATCH_CHARS = 256000;
13
+ /** Host admission bounds, independent of the model's working context. */
14
+ declare const MAX_REVIEW_FILES = 1000;
15
+ declare const MAX_REVIEW_PATCH_CHARS = 2000000;
16
+ declare const MAX_REVIEW_TOTAL_PATCH_CHARS = 8000000;
17
+ /** Native strategies share the same review ledger and execution budgets. */
18
+ declare const ReviewCompaction: Schema.Literals<readonly ["prune", "rollover"]>;
19
+ type ReviewCompaction = typeof ReviewCompaction.Type;
20
+ /** Working-context bound for pressure experiments; it never widens host input admission. */
21
+ declare const ReviewContextTokenLimit: Schema.Int;
22
+ /** Emitted native compaction evidence, without source, summaries, or handoff text. */
23
+ declare const ReviewCompactionEvent: Schema.Struct<{
24
+ readonly kind: Schema.Literals<readonly ["clear-tool-results", "summarize", "rollover"]>;
25
+ readonly turn: Schema.Int;
26
+ readonly tokensBeforeEstimate: Schema.Natural;
27
+ readonly tokensAfterEstimate: Schema.Natural;
28
+ }>;
29
+ type ReviewCompactionEvent = typeof ReviewCompactionEvent.Type;
30
+ declare const ReviewResearchConcurrency: Schema.Literals<readonly [1, 2]>;
31
+ /** Measured native delegation events and incomplete child results; contains no child prose. */
32
+ declare const ReviewResearchStats: Schema.Struct<{
33
+ readonly delegations: Schema.Natural;
34
+ readonly started: Schema.Natural;
35
+ readonly completed: Schema.Natural;
36
+ readonly failed: Schema.Natural;
37
+ readonly interrupted: Schema.Natural;
38
+ readonly incomplete: Schema.Natural;
39
+ }>;
14
40
  declare const ReviewChange_base: Schema.Class<ReviewChange, Schema.Struct<{
15
41
  readonly path: Schema.NonEmptyString;
16
42
  readonly patch: Schema.NonEmptyString;
@@ -103,14 +129,33 @@ declare const ReviewOutcome_base: Schema.Class<ReviewOutcome, Schema.Struct<{
103
129
  readonly report: typeof ReviewReport;
104
130
  readonly turns: Schema.Natural;
105
131
  readonly usage: typeof ReviewUsage;
106
- /** Admitted patches in batches that never started. These are not reviewed files. */
132
+ /** Admitted paths with diff ranges never supplied to the model, including partially read files. */
107
133
  readonly pendingPaths: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
108
134
  /** A constrained final answer preserves findings but cannot establish complete coverage. */
109
135
  readonly exhausted: Schema.optionalKey<Schema.Literals<readonly ["tokens", "tool-calls", "turns", "cost"]>>;
110
136
  /** Unfinished coverage, reported by the model or caused by failure or the report capacity bound. */
111
137
  readonly incomplete: Schema.optionalKey<Schema.Literal<true>>;
138
+ /** Specific missing evidence reported after all admitted diff ranges were delivered. */
139
+ readonly blockedOn: Schema.optionalKey<Schema.NonEmptyString>;
112
140
  /** Only returned after complete coverage, with identifiers drawn from the supplied follow-ups. */
113
141
  readonly resolutions: Schema.optionalKey<Schema.$Array<typeof ReviewResolution>>;
142
+ /** Present for measured runs, including an empty array when no native event was emitted. */
143
+ readonly compactions: Schema.optionalKey<Schema.$Array<Schema.Struct<{
144
+ readonly kind: Schema.Literals<readonly ["clear-tool-results", "summarize", "rollover"]>;
145
+ readonly turn: Schema.Int;
146
+ readonly tokensBeforeEstimate: Schema.Natural;
147
+ readonly tokensAfterEstimate: Schema.Natural;
148
+ }>>>;
149
+ readonly research: Schema.optionalKey<Schema.Struct<{
150
+ readonly delegations: Schema.Natural;
151
+ readonly started: Schema.Natural;
152
+ readonly completed: Schema.Natural;
153
+ readonly failed: Schema.Natural;
154
+ readonly interrupted: Schema.Natural;
155
+ readonly incomplete: Schema.Natural;
156
+ }>>;
157
+ /** Accepted working-note replacements; the note text stays inside the review's Scope. */
158
+ readonly notesUpdates: Schema.optionalKey<Schema.Natural>;
114
159
  }>, {}>;
115
160
  declare class ReviewOutcome extends ReviewOutcome_base {}
116
161
  declare const ReviewVerificationError_base: Schema.Class<ReviewVerificationError, Schema.TaggedStruct<"ReviewVerificationError", {
@@ -123,10 +168,16 @@ interface ReviewerOptions<Provider, ModelProvides, ModelRequires> {
123
168
  readonly guidance?: string | undefined;
124
169
  readonly estimateCostMicrousd?: RunCostEstimator | undefined;
125
170
  readonly costControl?: ReviewCostControl | undefined;
171
+ readonly compaction?: ReviewCompaction | undefined;
172
+ readonly contextTokenLimit?: number | undefined;
173
+ readonly research?: {
174
+ readonly model: Model.Model<Provider, LanguageModel.LanguageModel | ModelProvides, ModelRequires>;
175
+ readonly concurrency?: typeof ReviewResearchConcurrency.Type | undefined;
176
+ } | undefined;
126
177
  }
127
- /** A bounded review, with sequential patch batches when a shared spending ledger is supplied. */
178
+ /** One navigable review with a complete change index and bounded evidence tools. */
128
179
  declare const makeReviewer: <Provider, ModelProvides, ModelRequires>(options: ReviewerOptions<Provider, ModelProvides, ModelRequires>) => {
129
- readonly review: (request: ReviewRequest) => Effect.Effect<ReviewOutcome, import("@effect-agent/core/AgentError").AgentApprovalDenied | import("@effect-agent/core/AgentError").AgentApprovalPending | AgentRuntime.AgentChildPending | import("@effect-agent/core/AgentError").AgentInputError | import("@effect-agent/core/AgentError").AgentOutputError | import("@effect-agent/core/AgentError").AgentPolicyError | import("@effect-agent/core/AgentError").AgentToolAuthorizationDenied | import("effect/unstable/ai/AiError").AiError | import("effect-agent/RunHooks").BudgetAdapterError | import("effect-agent/Budget").BudgetExceeded | import("@effect-agent/engine/ContextCompactor").CompactionError | import("@effect-agent/core/AgentError").ContextBudgetError | import("@effect-agent/core/AgentError").ContextOverflowError | import("@effect-agent/core/MemoryReference").MemoryRecallError | import("@effect-agent/core/AgentError").ModelProtocolError | ReviewVerificationError | import("effect-agent/ThreadHistory").ThreadHistoryError, ReviewRepository | Exclude<Exclude<Exclude<Exclude<(Agent.ModelServices extends ModelProvides | LanguageModel.LanguageModel | Model.ModelName | Model.ProviderName ? Model.Model<Provider, ModelProvides | LanguageModel.LanguageModel, ModelRequires> : never) extends (infer T) ? T extends (Agent.ModelServices extends ModelProvides | LanguageModel.LanguageModel | Model.ModelName | Model.ProviderName ? Model.Model<Provider, ModelProvides | LanguageModel.LanguageModel, ModelRequires> : never) ? T extends import("effect/Layer").Layer<infer _Provides, infer _Error, infer Services> ? Services : never : never : never, AgentRuntime.EngineProvidedToolServices>, Tool.Handler<"record_finding">>, Tool.Handler<"submit_review"> | IdGenerator | import("effect-agent/RunOptions").RunContextPreparation | ThreadHistory | Tool.HandlersFor<{
180
+ readonly review: (request: ReviewRequest) => Effect.Effect<ReviewOutcome, import("@effect-agent/core/AgentError").AgentApprovalDenied | import("@effect-agent/core/AgentError").AgentApprovalPending | AgentRuntime.AgentChildPending | import("@effect-agent/core/AgentError").AgentInputError | import("@effect-agent/core/AgentError").AgentOutputError | import("@effect-agent/core/AgentError").AgentPolicyError | import("@effect-agent/core/AgentError").AgentToolAuthorizationDenied | import("effect/unstable/ai/AiError").AiError | import("effect-agent/RunHooks").BudgetAdapterError | import("effect-agent/Budget").BudgetExceeded | import("effect-agent/ContextCompactor").CompactionError | import("@effect-agent/core/AgentError").ContextBudgetError | import("@effect-agent/core/AgentError").ContextOverflowError | import("@effect-agent/core/MemoryReference").MemoryRecallError | import("@effect-agent/core/AgentError").ModelProtocolError | ReviewVerificationError | AgentRuntime.SubagentDurabilityError | import("effect-agent/ThreadHistory").ThreadHistoryError | AgentRuntime.ToolCallWaiting, ReviewRepository | Exclude<Exclude<Exclude<Exclude<Exclude<Exclude<ModelRequires, AgentRuntime.EngineProvidedToolServices>, import("effect-agent/RunOptions").RunContextPreparation | ThreadHistory>, ContextCompactor | Tool.Handler<"finish_research"> | Tool.Handler<"record_finding"> | import("effect-agent/SubagentReservations").SubagentReservations>, ContextCompactor>, ContextCompactor | IdGenerator | import("effect-agent/RunOptions").RunContextPreparation | ThreadHistory | Tool.HandlersFor<{
130
181
  readonly find_files: Tool.Tool<"find_files", {
131
182
  readonly parameters: Schema.Struct<{
132
183
  readonly query: Schema.String;
@@ -147,8 +198,98 @@ declare const makeReviewer: <Provider, ModelProvides, ModelRequires>(options: Re
147
198
  readonly failure: typeof ReviewContextError;
148
199
  readonly failureMode: "return";
149
200
  }, never>;
201
+ readonly search_code: Tool.Tool<"search_code", {
202
+ readonly parameters: Schema.Struct<{
203
+ readonly query: Schema.NonEmptyString;
204
+ readonly path: Schema.String;
205
+ readonly revision: Schema.Literals<readonly ["base", "head"]>;
206
+ readonly cursor: Schema.Natural;
207
+ }>;
208
+ readonly success: typeof ReviewSearchResult;
209
+ readonly failure: typeof ReviewContextError;
210
+ readonly failureMode: "return";
211
+ }, never>;
212
+ }>>, import("effect/Scope").Scope> | Exclude<Exclude<Exclude<Exclude<Exclude<(Agent.ModelServices extends ModelProvides | LanguageModel.LanguageModel | Model.ModelName | Model.ProviderName ? Model.Model<Provider, ModelProvides | LanguageModel.LanguageModel, ModelRequires> : never) extends (infer T_1) ? T_1 extends (Agent.ModelServices extends ModelProvides | LanguageModel.LanguageModel | Model.ModelName | Model.ProviderName ? Model.Model<Provider, ModelProvides | LanguageModel.LanguageModel, ModelRequires> : never) ? T_1 extends Layer.Layer<infer _Provides, infer _Error, infer Services> ? Services : never : never : never, AgentRuntime.EngineProvidedToolServices>, Tool.Handler<"delegate_research"> | Tool.Handler<"record_finding"> | Tool.Handler<"submit_review"> | Tool.HandlersFor<{
213
+ readonly new_context: Tool.Tool<"new_context", {
214
+ readonly parameters: Schema.Struct<{
215
+ readonly handoff: Schema.optionalKey<Schema.NonEmptyString>;
216
+ }>;
217
+ readonly success: Schema.Struct<{
218
+ readonly handoff: Schema.optionalKey<Schema.NonEmptyString>;
219
+ }>;
220
+ readonly failure: Schema.Never;
221
+ readonly failureMode: "error";
222
+ }, never>;
223
+ readonly read_diff: Tool.Tool<"read_diff", {
224
+ readonly parameters: Schema.Struct<{
225
+ readonly offset: Schema.Natural;
226
+ }>;
227
+ readonly success: Schema.Struct<{
228
+ readonly offset: Schema.Natural;
229
+ readonly content: Schema.String;
230
+ readonly nextOffset: Schema.NullOr<Schema.Natural>;
231
+ readonly totalChars: Schema.Natural;
232
+ }>;
233
+ readonly failure: typeof ReviewVerificationError;
234
+ readonly failureMode: "return";
235
+ }, never>;
236
+ readonly review_status: Tool.Tool<"review_status", {
237
+ readonly parameters: Schema.Struct<{
238
+ readonly cursor: Schema.optionalKey<Schema.Natural>;
239
+ readonly notes: Schema.optionalKey<Schema.Struct<{
240
+ readonly text: Schema.String;
241
+ readonly expectedRevision: Schema.Natural;
242
+ }>>;
243
+ }>;
244
+ readonly success: Schema.Struct<{
245
+ readonly pending: Schema.$Array<Schema.Struct<{
246
+ readonly path: Schema.NonEmptyString;
247
+ readonly offset: Schema.Natural;
248
+ }>>;
249
+ readonly pendingCount: Schema.Natural;
250
+ readonly findings: Schema.$Array<typeof ReviewFinding>;
251
+ readonly notes: Schema.Struct<{
252
+ readonly text: Schema.String;
253
+ readonly revision: Schema.Natural;
254
+ }>;
255
+ }>;
256
+ readonly failure: typeof ReviewVerificationError;
257
+ readonly failureMode: "return";
258
+ }, never>;
259
+ }>>, ContextCompactor>, ContextCompactor | IdGenerator | import("effect-agent/RunOptions").RunContextPreparation | ThreadHistory | Tool.HandlersFor<{
260
+ readonly find_files: Tool.Tool<"find_files", {
261
+ readonly parameters: Schema.Struct<{
262
+ readonly query: Schema.String;
263
+ readonly revision: Schema.Literals<readonly ["base", "head"]>;
264
+ }>;
265
+ readonly success: typeof ReviewFileList;
266
+ readonly failure: typeof ReviewContextError;
267
+ readonly failureMode: "return";
268
+ }, never>;
269
+ readonly read_file: Tool.Tool<"read_file", {
270
+ readonly parameters: Schema.Struct<{
271
+ readonly path: Schema.NonEmptyString;
272
+ readonly revision: Schema.Literals<readonly ["base", "head"]>;
273
+ readonly startLine: Schema.Int;
274
+ readonly lineCount: Schema.Int;
275
+ }>;
276
+ readonly success: typeof ReviewSource;
277
+ readonly failure: typeof ReviewContextError;
278
+ readonly failureMode: "return";
279
+ }, never>;
280
+ readonly search_code: Tool.Tool<"search_code", {
281
+ readonly parameters: Schema.Struct<{
282
+ readonly query: Schema.NonEmptyString;
283
+ readonly path: Schema.String;
284
+ readonly revision: Schema.Literals<readonly ["base", "head"]>;
285
+ readonly cursor: Schema.Natural;
286
+ }>;
287
+ readonly success: typeof ReviewSearchResult;
288
+ readonly failure: typeof ReviewContextError;
289
+ readonly failureMode: "return";
290
+ }, never>;
150
291
  }>>, import("effect/Scope").Scope>>;
151
292
  };
152
293
  //#endregion
153
- export { MAX_REVIEW_PATCH_CHARS, ReviewCategory, ReviewChange, ReviewCostControl, ReviewCostSnapshot, ReviewFinding, ReviewFollowUp, ReviewOutcome, ReviewReport, ReviewRequest, ReviewResolution, ReviewSeverity, ReviewUsage, ReviewVerificationError, ReviewerOptions, isCommentableLine, makeReviewer, Review_d_exports as t };
294
+ export { MAX_REVIEW_FILES, MAX_REVIEW_PATCH_CHARS, MAX_REVIEW_TOTAL_PATCH_CHARS, ReviewCategory, ReviewChange, ReviewCompaction, ReviewCompactionEvent, ReviewContextTokenLimit, ReviewCostControl, ReviewCostSnapshot, ReviewFinding, ReviewFollowUp, ReviewOutcome, ReviewReport, ReviewRequest, ReviewResearchConcurrency, ReviewResearchStats, ReviewResolution, ReviewSeverity, ReviewUsage, ReviewVerificationError, ReviewerOptions, isCommentableLine, makeReviewer, Review_d_exports as t };
154
295
  //# sourceMappingURL=Review.d.mts.map