lastlight-core 0.34.1 → 0.35.1
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/config/default.yaml +114 -138
- package/dist/config/config.d.ts +11 -0
- package/dist/config/config.js +100 -30
- package/dist/config/config.js.map +1 -1
- package/dist/engine/dispatcher.d.ts +5 -0
- package/dist/engine/dispatcher.js +13 -1
- package/dist/engine/dispatcher.js.map +1 -1
- package/dist/engine/github/github.d.ts +49 -0
- package/dist/engine/github/github.js +53 -1
- package/dist/engine/github/github.js.map +1 -1
- package/dist/engine/github/review-poster.d.ts +16 -3
- package/dist/engine/github/review-poster.js +3 -3
- package/dist/engine/github/review-poster.js.map +1 -1
- package/dist/engine/github/review-summary.d.ts +2 -2
- package/dist/engine/github/review-summary.js +1 -1
- package/dist/engine/github/review-summary.js.map +1 -1
- package/dist/engine/pr-decisions.d.ts +29 -0
- package/dist/engine/pr-decisions.js +145 -100
- package/dist/engine/pr-decisions.js.map +1 -1
- package/dist/engine/pr-discussion.d.ts +23 -0
- package/dist/engine/pr-discussion.js +55 -0
- package/dist/engine/pr-discussion.js.map +1 -0
- package/dist/engine/pr-intent.d.ts +32 -0
- package/dist/engine/pr-intent.js +55 -0
- package/dist/engine/pr-intent.js.map +1 -0
- package/dist/engine/pr-state.d.ts +23 -2
- package/dist/engine/pr-state.js +24 -3
- package/dist/engine/pr-state.js.map +1 -1
- package/dist/engine/review-check.d.ts +2 -0
- package/dist/engine/review-check.js +6 -0
- package/dist/engine/review-check.js.map +1 -1
- package/dist/engine/review-spec.d.ts +2 -87
- package/dist/engine/review-spec.js +2 -445
- package/dist/engine/review-spec.js.map +1 -1
- package/dist/engine/review-triage.d.ts +27 -9
- package/dist/engine/review-triage.js +20 -7
- package/dist/engine/review-triage.js.map +1 -1
- package/dist/engine/supersede.d.ts +42 -0
- package/dist/engine/supersede.js +72 -0
- package/dist/engine/supersede.js.map +1 -0
- package/dist/evals-api.d.ts +7 -0
- package/dist/evals-api.js +21 -0
- package/dist/evals-api.js.map +1 -1
- package/dist/sandbox/index.d.ts +9 -0
- package/dist/sandbox/index.js +24 -0
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/sandbox.d.ts +25 -0
- package/dist/sandbox/sandbox.js +97 -14
- package/dist/sandbox/sandbox.js.map +1 -1
- package/dist/state/client.d.ts +8 -3
- package/dist/state/client.js.map +1 -1
- package/dist/state/db.js +7 -6
- package/dist/state/db.js.map +1 -1
- package/dist/state/sqlite-write-lock.d.ts +46 -0
- package/dist/state/sqlite-write-lock.js +145 -0
- package/dist/state/sqlite-write-lock.js.map +1 -0
- package/dist/state/workflow-run-store.d.ts +4 -1
- package/dist/state/workflow-run-store.js.map +1 -1
- package/dist/workflows/handlers/fanout.d.ts +17 -4
- package/dist/workflows/handlers/fanout.js +68 -31
- package/dist/workflows/handlers/fanout.js.map +1 -1
- package/dist/workflows/handlers/host-repo-dir.d.ts +38 -0
- package/dist/workflows/handlers/host-repo-dir.js +55 -0
- package/dist/workflows/handlers/host-repo-dir.js.map +1 -0
- package/dist/workflows/handlers/post-review.d.ts +9 -1
- package/dist/workflows/handlers/post-review.js +39 -16
- package/dist/workflows/handlers/post-review.js.map +1 -1
- package/dist/workflows/handlers/survey-units.d.ts +323 -0
- package/dist/workflows/handlers/survey-units.js +1211 -0
- package/dist/workflows/handlers/survey-units.js.map +1 -0
- package/dist/workflows/live-runs.d.ts +36 -0
- package/dist/workflows/live-runs.js +69 -0
- package/dist/workflows/live-runs.js.map +1 -0
- package/dist/workflows/runner.js +55 -15
- package/dist/workflows/runner.js.map +1 -1
- package/dist/workflows/simple.js +10 -3
- package/dist/workflows/simple.js.map +1 -1
- package/package.json +8 -8
- package/skills/code-review/SKILL.md +2 -3
- package/skills/pr-review/references/findings-schema.md +4 -4
- package/workflows/pr-review.yaml +491 -271
- package/workflows/prompts/review-falsify.md +17 -9
- package/workflows/prompts/review-select.md +113 -0
- package/workflows/prompts/review-site-summary.md +48 -0
- package/workflows/prompts/review-site.md +305 -0
- package/workflows/prompts/review.md +0 -60
- package/workflows/prompts/survey-unit.md +60 -0
- package/skills/adjudicate-pass/SKILL.md +0 -149
- package/skills/survey-pass/SKILL.md +0 -139
- package/workflows/prompts/review-adjudicate.md +0 -498
- package/workflows/prompts/survey-contract.md +0 -121
- package/workflows/prompts/survey-enforcement.md +0 -105
- package/workflows/prompts/survey-security.md +0 -162
- package/workflows/prompts/survey-spec.md +0 -131
- package/workflows/prompts/survey-state.md +0 -152
- package/workflows/prompts/survey-tests.md +0 -99
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import type { AssetLoader, DagNode, ExecutorConfig, GitSandboxAccess, LedgerDeps, PhaseDefinition, PhaseOutcome, PhaseReporter, PhaseResolver, PhaseTypeHandler, TemplateContext, WorkflowStateStore } from "lastlight-workflow-engine";
|
|
2
|
+
import type { SandboxBackend } from "../../config/config.js";
|
|
3
|
+
/** The tool name the transcript records each unit call under. */
|
|
4
|
+
export declare const SURVEY_UNIT_TOOL = "survey_unit";
|
|
5
|
+
export interface UnitCallUsage {
|
|
6
|
+
input: number;
|
|
7
|
+
output: number;
|
|
8
|
+
cacheRead: number;
|
|
9
|
+
cacheWrite: number;
|
|
10
|
+
costUsd: number;
|
|
11
|
+
}
|
|
12
|
+
export interface UnitCallResult {
|
|
13
|
+
/** Every text block of the reply, joined. */
|
|
14
|
+
text: string;
|
|
15
|
+
usage: UnitCallUsage;
|
|
16
|
+
/** Set when the provider answered with an error or an abort rather than text. */
|
|
17
|
+
error?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Why generation stopped, as pi-ai reports it (`stop` | `length` | …).
|
|
20
|
+
* `length` is the one the handler acts on: the reply was cut at the output
|
|
21
|
+
* cap, and re-sending the identical request would be cut there again, so it
|
|
22
|
+
* is never retried.
|
|
23
|
+
*/
|
|
24
|
+
stopReason?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* ONE model call. Injected so tests run with no network; production uses
|
|
28
|
+
* {@link completeUnitCall}. A throw is treated exactly like `error`.
|
|
29
|
+
*/
|
|
30
|
+
export type UnitModelCall = (args: {
|
|
31
|
+
model: string;
|
|
32
|
+
/** The phase's thinking level (`variant:`), or undefined for the provider default. */
|
|
33
|
+
variant?: string;
|
|
34
|
+
/** The SYSTEM text actually sent: the phase prompt, plus the shared prefix when split off. */
|
|
35
|
+
systemPrompt: string;
|
|
36
|
+
/** The USER message actually sent: the unit's request, minus the prefix when split off. */
|
|
37
|
+
request: string;
|
|
38
|
+
timeoutMs: number;
|
|
39
|
+
/**
|
|
40
|
+
* The same for every call of one phase — a provider-side cache ROUTING hint
|
|
41
|
+
* (`sessionId` → OpenAI's `prompt_cache_key`), so concurrent calls that share
|
|
42
|
+
* a prefix land where that prefix is already cached.
|
|
43
|
+
*/
|
|
44
|
+
cacheKey: string;
|
|
45
|
+
/** Aborted at the phase deadline or on a run cancel; the call must stop. */
|
|
46
|
+
signal?: AbortSignal;
|
|
47
|
+
}) => Promise<UnitCallResult>;
|
|
48
|
+
/**
|
|
49
|
+
* The production {@link UnitModelCall}: pi-ai's `completeSimple`, resolved and
|
|
50
|
+
* credentialed exactly as the in-process chat path does it (`chat-runner.ts`) —
|
|
51
|
+
* a deployment's endpoint override, a named key env var, an OAuth subscription
|
|
52
|
+
* token. Transient provider faults (429 / 5xx / network) are retried with
|
|
53
|
+
* backoff by `completeWithRetry` INSIDE one attempt; the handler's own single
|
|
54
|
+
* retry is for a reply that came back without a usable object for the unit.
|
|
55
|
+
*
|
|
56
|
+
* No explicit `maxTokens`: pi-ai sends the model's own output cap
|
|
57
|
+
* (`options.maxTokens ?? model.maxTokens`), the most generous value there is,
|
|
58
|
+
* and a reply that still hits it comes back `stopReason: "length"`.
|
|
59
|
+
*
|
|
60
|
+
* **Prompt caching.** The handler moves code-facts' byte-identical
|
|
61
|
+
* `sharedPrefix` (the unit-independent questions, evidence record and rules)
|
|
62
|
+
* OUT of the user message and onto the end of the system prompt, so every call
|
|
63
|
+
* of a phase opens with the same system text. `cacheRetention: "short"` is
|
|
64
|
+
* pi-ai's default, spelled out so a `PI_CACHE_RETENTION=long` in the harness
|
|
65
|
+
* env cannot silently double the write price of a phase that re-asks within
|
|
66
|
+
* minutes, not hours. What each provider does with it differs:
|
|
67
|
+
* - Anthropic caches only at explicit breakpoints. pi-ai folds
|
|
68
|
+
* `Context.systemPrompt` into a leading system message and emits it as
|
|
69
|
+
* `system: [{ type: "text", text, cache_control: { type: "ephemeral" } }]`
|
|
70
|
+
* (plus a second breakpoint on the last user block), so the system text —
|
|
71
|
+
* prompt AND shared prefix — is the cross-unit cache hit. It is cached only
|
|
72
|
+
* above the model's minimum cacheable length.
|
|
73
|
+
* - OpenAI-family prefix caching is automatic over any identical prefix
|
|
74
|
+
* (≥1024 tokens); `cacheKey` goes out as `prompt_cache_key` to keep
|
|
75
|
+
* concurrent calls on one cache.
|
|
76
|
+
*/
|
|
77
|
+
export declare const completeUnitCall: UnitModelCall;
|
|
78
|
+
/**
|
|
79
|
+
* Keep Anthropic's cache breakpoint on the SYSTEM prompt only.
|
|
80
|
+
*
|
|
81
|
+
* pi-ai also marks the last user block `cache_control`, which is right for a
|
|
82
|
+
* conversation and wrong here: a unit's user message is that unit's own
|
|
83
|
+
* request, never sent twice, so the breakpoint bought a 1.25x cache WRITE on
|
|
84
|
+
* every unit's unique input and no read. Measured on 1587-r2 (Haiku 4.5, v7,
|
|
85
|
+
* 74 calls): 358k tokens written, 26k read — about 55% of the case's $0.81.
|
|
86
|
+
* The system prompt (role + the shared prefix) is identical on every call and
|
|
87
|
+
* keeps its breakpoint, which is the part worth caching.
|
|
88
|
+
*/
|
|
89
|
+
export declare function systemOnlyCacheBreakpoint(payload: unknown): unknown;
|
|
90
|
+
/**
|
|
91
|
+
* What identifies the ENDPOINT a model string resolves to — provider, request
|
|
92
|
+
* family, model id and base URL, after this deployment's `providers:`
|
|
93
|
+
* overrides. Part of the reply cache key: the same `{{models.review-survey}}`
|
|
94
|
+
* spelling pointed at a different gateway is a different model as far as a
|
|
95
|
+
* cached reading is concerned. An unresolvable spec keys on itself (its call
|
|
96
|
+
* fails anyway, and a failure is never cached).
|
|
97
|
+
*/
|
|
98
|
+
export declare function unitEndpointIdentity(model: string): string;
|
|
99
|
+
/** One entry of `units.json` — only the fields this handler reads. */
|
|
100
|
+
export interface SurveyUnit {
|
|
101
|
+
id: string;
|
|
102
|
+
kind?: string;
|
|
103
|
+
file: string | null;
|
|
104
|
+
symbol: string | null;
|
|
105
|
+
lines: [number, number] | null;
|
|
106
|
+
families?: string[];
|
|
107
|
+
obligationIds?: string[];
|
|
108
|
+
request: string;
|
|
109
|
+
requestSha256?: string;
|
|
110
|
+
truncated?: boolean;
|
|
111
|
+
}
|
|
112
|
+
export interface UnitsDocument {
|
|
113
|
+
coverage?: string;
|
|
114
|
+
promptVersion?: string;
|
|
115
|
+
/**
|
|
116
|
+
* The byte-identical head every `unit.request` opens with (optional: older
|
|
117
|
+
* documents carry none). Never sent on its own — each request already
|
|
118
|
+
* contains it — so it is read only to keep the transcript from repeating it
|
|
119
|
+
* per unit, and to key the provider cache.
|
|
120
|
+
*/
|
|
121
|
+
sharedPrefix?: string;
|
|
122
|
+
sharedPrefixSha256?: string;
|
|
123
|
+
/** Why coverage is not `full` — the `units` CLI's own reasons, or the shell fallback's. */
|
|
124
|
+
degraded?: {
|
|
125
|
+
extractor?: string;
|
|
126
|
+
reason?: string;
|
|
127
|
+
}[];
|
|
128
|
+
units: SurveyUnit[];
|
|
129
|
+
}
|
|
130
|
+
/** `units/responses/<unitId>.json`, exactly per the plan's FILE CONTRACT. */
|
|
131
|
+
export interface UnitResponseRecord {
|
|
132
|
+
unitId: string;
|
|
133
|
+
model: string;
|
|
134
|
+
systemPromptSha256: string;
|
|
135
|
+
requestSha256: string;
|
|
136
|
+
ok: boolean;
|
|
137
|
+
cached: boolean;
|
|
138
|
+
attempts: number;
|
|
139
|
+
raw: string;
|
|
140
|
+
error: string | null;
|
|
141
|
+
usage: UnitCallUsage;
|
|
142
|
+
durationMs: number;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Read and shape-check `units.json`. Throws with a message fit for the loud
|
|
146
|
+
* summary: the `units` phase ALWAYS writes a document (its shell fallback
|
|
147
|
+
* included), so a missing or malformed one is a broken contract, never an
|
|
148
|
+
* empty survey — the caller degrades on it rather than failing the phase.
|
|
149
|
+
*/
|
|
150
|
+
export declare function readUnitsDocument(path: string): UnitsDocument;
|
|
151
|
+
/**
|
|
152
|
+
* The reply object for `unitId` in a model's raw text, or `null` — the
|
|
153
|
+
* canonical rule, step for step:
|
|
154
|
+
*
|
|
155
|
+
* 1. Candidates are every balanced top-level `{…}` span that parses as a JSON
|
|
156
|
+
* object — first across the whole of `raw`, then inside each ``` fence
|
|
157
|
+
* body — in that order (see `objectSpans`).
|
|
158
|
+
* 2. The FIRST candidate whose `unitId` is exactly `unitId` is the reply.
|
|
159
|
+
* 3. Otherwise ONE level of nesting: per candidate, a property value that is
|
|
160
|
+
* an object with that `unitId`, or such an object element of a property
|
|
161
|
+
* value that is an array (`{"result": {…}}`, `{"units": [{…}]}`).
|
|
162
|
+
* 4. Otherwise `null`. An object naming ANOTHER unit is never this unit's.
|
|
163
|
+
*/
|
|
164
|
+
export declare function findUnitObject(raw: string, unitId: string): Record<string, unknown> | null;
|
|
165
|
+
/**
|
|
166
|
+
* Whether a found object is a reply `units-ingest` can use: an object naming
|
|
167
|
+
* this unit, with `answers` and `defects` both arrays (possibly empty). The
|
|
168
|
+
* entries are not inspected — a malformed entry is ingest's to record, never a
|
|
169
|
+
* reason to re-ask.
|
|
170
|
+
*/
|
|
171
|
+
export declare function isUsableUnitReply(obj: unknown, unitId: string): boolean;
|
|
172
|
+
/** The handler's one decision about a reply: {@link findUnitObject} then {@link isUsableUnitReply}. */
|
|
173
|
+
export declare function usableUnitReply(raw: string, unitId: string): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Readings cached OUTSIDE the per-run workspace, so a re-review of the same
|
|
176
|
+
* repo reuses every unit whose request did not change — the other half of the
|
|
177
|
+
* perch shape. Keyed on everything that determines the reply: the RESOLVED
|
|
178
|
+
* endpoint ({@link unitEndpointIdentity} — provider, api, model id, base URL),
|
|
179
|
+
* the thinking level, and the hashes of the system text and the user message
|
|
180
|
+
* actually sent (which together carry the prompt, the shared prefix, the
|
|
181
|
+
* unit's code, its obligations and code-facts' `promptVersion`).
|
|
182
|
+
*
|
|
183
|
+
* Only replies that pass the ONE reply rule ({@link usableUnitReply}) are
|
|
184
|
+
* stored, and a hit is re-checked against it — so an entry written under a
|
|
185
|
+
* looser rule is ignored rather than replayed. An entry `units-ingest` later
|
|
186
|
+
* judged `invalid` / `partial` is EVICTED at the start of the next run (see
|
|
187
|
+
* `previousBadRequests`). Scoped by `<owner>/<repo>` so one repository's cache
|
|
188
|
+
* cannot answer for another's, even on an identical request.
|
|
189
|
+
*/
|
|
190
|
+
export declare function unitCacheDir(stateDir: string, owner: string, repo: string): string;
|
|
191
|
+
/** Run-scoped data the `survey-units` handler needs. */
|
|
192
|
+
export interface SurveyUnitsRunScope {
|
|
193
|
+
workflowName: string;
|
|
194
|
+
ctx: TemplateContext;
|
|
195
|
+
config: ExecutorConfig;
|
|
196
|
+
/** Single workspace shared by every phase of the run. */
|
|
197
|
+
taskId: string;
|
|
198
|
+
triggerId: string;
|
|
199
|
+
githubAccess: GitSandboxAccess;
|
|
200
|
+
backend: SandboxBackend;
|
|
201
|
+
assets: AssetLoader;
|
|
202
|
+
resolver: PhaseResolver;
|
|
203
|
+
store?: WorkflowStateStore;
|
|
204
|
+
workflowId?: string;
|
|
205
|
+
ledger: Omit<LedgerDeps, "store">;
|
|
206
|
+
/** Test seam — the model call. Defaults to {@link completeUnitCall}. */
|
|
207
|
+
callUnit?: UnitModelCall;
|
|
208
|
+
/** Test seam — how often the run row is polled for a cancel. Default 5 s. */
|
|
209
|
+
cancelPollMs?: number;
|
|
210
|
+
}
|
|
211
|
+
/** What one unit came to — its response record, and the calls it spent. */
|
|
212
|
+
export interface UnitOutcome {
|
|
213
|
+
record: UnitResponseRecord;
|
|
214
|
+
calls: number;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Where each call is reported as it completes — the phase transcript
|
|
218
|
+
* ({@link UnitSurveyTranscript}) in production; nothing in the evals replay.
|
|
219
|
+
*/
|
|
220
|
+
export interface UnitSurveySink {
|
|
221
|
+
call(toolCallId: string, text: string, args: Record<string, unknown>, usage: UnitCallUsage, result: string, isError: boolean): void;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* The SYSTEM text every call of a survey sends, and how it was decided.
|
|
225
|
+
*
|
|
226
|
+
* The shared prefix goes to the SYSTEM prompt — where pi-ai puts Anthropic's
|
|
227
|
+
* cache breakpoint — only when every request really opens with it and keeps
|
|
228
|
+
* something after it. Otherwise every request is sent verbatim.
|
|
229
|
+
*/
|
|
230
|
+
export declare function unitSurveySystemText(systemPrompt: string, doc: Pick<UnitsDocument, "units" | "sharedPrefix">): {
|
|
231
|
+
systemText: string;
|
|
232
|
+
systemSha256: string;
|
|
233
|
+
sharedPrefix: string | undefined;
|
|
234
|
+
splitPrefix: string | undefined;
|
|
235
|
+
};
|
|
236
|
+
/** Inputs of {@link runUnitSurvey} — everything the phase resolved, nothing it reads from a run. */
|
|
237
|
+
export interface RunUnitSurveyOptions {
|
|
238
|
+
/** The units document (`units.json`), already read. */
|
|
239
|
+
doc: Pick<UnitsDocument, "units" | "sharedPrefix">;
|
|
240
|
+
/** The RENDERED phase prompt (`prompts/survey-unit.md`). */
|
|
241
|
+
systemPrompt: string;
|
|
242
|
+
/** The resolved `provider/model` spec. */
|
|
243
|
+
model: string;
|
|
244
|
+
/** Thinking level (`variant:`); undefined = the provider default. */
|
|
245
|
+
variant?: string;
|
|
246
|
+
concurrency: number;
|
|
247
|
+
/** Epoch ms the whole survey must finish by — each call's timeout is what is left. */
|
|
248
|
+
deadlineAt: number;
|
|
249
|
+
/** Aborted at the deadline or on a cancel; every call in flight stops. */
|
|
250
|
+
signal: AbortSignal;
|
|
251
|
+
/** Where `<unitId>.json` response records are written (created if absent; NOT cleared). */
|
|
252
|
+
responsesDir: string;
|
|
253
|
+
/** The reply cache directory. Omit for NO cache — nothing read, evicted or written. */
|
|
254
|
+
cacheDir?: string;
|
|
255
|
+
/** Requests whose cached reply must be evicted and asked again. */
|
|
256
|
+
evict?: Set<string>;
|
|
257
|
+
/** The model call. Defaults to {@link completeUnitCall}. */
|
|
258
|
+
call?: UnitModelCall;
|
|
259
|
+
transcript?: UnitSurveySink;
|
|
260
|
+
/** Called as each unit settles (its response file written or failed), in completion order. */
|
|
261
|
+
onSettled?: (outcome: UnitOutcome) => void;
|
|
262
|
+
}
|
|
263
|
+
/** What {@link runUnitSurvey} came to. `outcomes` is in document order. */
|
|
264
|
+
export interface UnitSurveyRun {
|
|
265
|
+
outcomes: UnitOutcome[];
|
|
266
|
+
usage: UnitCallUsage;
|
|
267
|
+
/** Model calls made (a cache hit is none). */
|
|
268
|
+
calls: number;
|
|
269
|
+
systemSha256: string;
|
|
270
|
+
/** Whether the shared prefix went out as system text. */
|
|
271
|
+
prefixInSystem: boolean;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* The model half of the unit survey, with no run, ledger or transcript of its
|
|
275
|
+
* own: one bounded call per unit (a cache hit, or up to two calls — see
|
|
276
|
+
* `surveyUnit`), `concurrency` at a time, one `<unitId>.json` per unit under
|
|
277
|
+
* `responsesDir`. Every unit settles — a throw anywhere in one unit (a
|
|
278
|
+
* response file that cannot be written, a bug) becomes THAT unit's failure, so
|
|
279
|
+
* the pool always drains. The phase handler wraps this; the evals replay calls
|
|
280
|
+
* it directly, with no cache, so every replay pays and measures.
|
|
281
|
+
*/
|
|
282
|
+
export declare function runUnitSurvey(opts: RunUnitSurveyOptions): Promise<UnitSurveyRun>;
|
|
283
|
+
export declare class SurveyUnitsHandler implements PhaseTypeHandler {
|
|
284
|
+
private readonly run;
|
|
285
|
+
private readonly reporter;
|
|
286
|
+
constructor(run: SurveyUnitsRunScope, reporter: PhaseReporter);
|
|
287
|
+
execute(phase: PhaseDefinition, _node: DagNode, _outputs: Readonly<Record<string, unknown>>): Promise<PhaseOutcome>;
|
|
288
|
+
/**
|
|
289
|
+
* The ledgered body — everything that spends, and the transcript that shows
|
|
290
|
+
* it. Returns an {@link ExecutionResult} whose cost and tokens are the sum of
|
|
291
|
+
* every call, which `runLedgeredPhase` copies onto the `executions` row.
|
|
292
|
+
*
|
|
293
|
+
* SUCCEEDS on every path (see the module header): a degraded survey is a
|
|
294
|
+
* loud summary on a green phase, never a red one.
|
|
295
|
+
*/
|
|
296
|
+
private survey;
|
|
297
|
+
/**
|
|
298
|
+
* Abort `controller` when the run row turns `cancelled`. The admin cancel
|
|
299
|
+
* only flips the row (and kills sandbox containers — this phase has none),
|
|
300
|
+
* so polling it is the only way an in-process phase hears of it. Returns
|
|
301
|
+
* the stopper. Best-effort: a store error stops nothing.
|
|
302
|
+
*/
|
|
303
|
+
private pollForCancel;
|
|
304
|
+
private transcript;
|
|
305
|
+
/** Always a SUCCESS — every outcome of the survey itself degrades, never fails. */
|
|
306
|
+
private executionResult;
|
|
307
|
+
/** YAML template first, then the resolver — `fanout.ts`'s precedence. */
|
|
308
|
+
private resolveModel;
|
|
309
|
+
/** The thinking level, resolved exactly as an agent phase's `variant:` is. */
|
|
310
|
+
private resolveVariant;
|
|
311
|
+
/**
|
|
312
|
+
* The WHOLE-PHASE deadline, in seconds: the phase's `timeout_seconds`
|
|
313
|
+
* (`{ from: surveyUnitsTimeoutSeconds }` in the packaged YAML), else the
|
|
314
|
+
* run's agent limit (`timeouts.agentSeconds`) — a config key, never a
|
|
315
|
+
* literal (issue #385).
|
|
316
|
+
*/
|
|
317
|
+
private deadlineSeconds;
|
|
318
|
+
/** `surveyUnitConcurrency` off the run context, else the shipped default. */
|
|
319
|
+
private concurrency;
|
|
320
|
+
private fail;
|
|
321
|
+
}
|
|
322
|
+
/** Build the app-registered `survey-units` phase-type handler for a run. */
|
|
323
|
+
export declare function makeSurveyUnitsHandler(run: SurveyUnitsRunScope, reporter: PhaseReporter): PhaseTypeHandler;
|