diff --git a/docs/api/primitive-catalog.md b/docs/api/primitive-catalog.md index dfdeb23d..4693c1b5 100644 --- a/docs/api/primitive-catalog.md +++ b/docs/api/primitive-catalog.md @@ -801,7 +801,6 @@ Import from `@tangle-network/agent-runtime/loops` — 546 exports. | `StdioMcpServerSpec` | interface | Same-host stdio MCP: the ONE persistent newline-delimited JSON-RPC 2.0 | | `SteerableSandboxSession` | interface | What the steerable session exposes to its executor: the usage stream plus the live reads. | | `SteerContext` | interface | How a combinator's `act` consumes findings to steer — the SINGLE firewalled steer surface a | -| `Strategy` | interface | A Strategy is HOW you spend the compute budget to beat the Environment's check — it | | `StrategyCtx` | interface | What a strategy body composes with: the artifact lifecycle, the budget, and the two steps. | | `StructuralRolloutPolicy` | interface | The rollout's compute recipe — promoted from the proven rigs' env vars (K/REPAIRS/ | | `StructuralRolloutResult` | interface | The body's deliverable — a `StrategyResult` plus selection provenance. The extra | @@ -885,7 +884,7 @@ Import from `@tangle-network/agent-runtime/loops` — 546 exports. | `WinnerStrategy` | type | Built-in valid-only winner strategies for `selectValidWinner` (selector≠judge): best gated-valid | | `WorktreePatchArtifact` | type | Terminal artifact of one worktree-CLI run — the canonical worktree-harness result (the captured | -**Undocumented supporting types** (add a TSDoc line at the declaration to earn a table row): `AgentEnvironment`, `AgentEnvironmentCapabilities`, `AgentEnvironmentEvent`, `AgentEnvironmentProvider`, `AgentEnvironmentQuery`, `AgentEnvironmentSummary`, `AgenticOptions`, `AgenticRunResult`, `AgenticTool`, `AgentSession`, `AgentSessionRef`, `AgentTurnInput`, `AgentTurnResult`, `AllWorkersStalledOptions`, `AnalystRegistry`, `AnytimeReport`, `AnytimeStrategySummary`, `ArtifactHandle`, `AuditIntentOptions`, `AuthoredHarness`, `AuthoredStrategy`, `AuthorStrategyOptions`, `BenchmarkConfig`, `BenchmarkLift`, `BenchmarkStrategySummary`, `BenchmarkTaskRow`, `BudgetPool`, `BusStats`, `ChampionPick`, `CheckpointRef`, `CheckpointRequest`, `CheckRunContext`, `CorpusReadbackOptions`, `CreateAgentEnvironmentInput`, `CreateTangleSandboxExactProcessProviderOptions`, `DefinedLeaderboard`, `DispatchReport`, `Driver`, `EventBus`, `EvolutionArchiveNode`, `EvolutionBandInfo`, `EvolutionCandidate`, `EvolutionGeneration`, `EvolutionReport`, `ExecRequest`, `ExecResult`, `ForkRequest`, `GitWorkspaceOptions`, `HarvestFailure`, `HarvestReport`, `Inbox`, `InProcessSandboxClientOptions`, `IntentAudit`, `Iteration`, `Leaderboard`, `LeaderboardOptions`, `LoopDecisionPayload`, `LoopDispatchOptions`, `LoopEndedPayload`, `LoopIterationEndedPayload`, `LoopIterationStartedPayload`, `LoopPlanDescription`, `LoopResult`, `LoopSandboxPlacement`, `LoopStartedPayload`, `LoopTraceEmitter`, `LoopWinner`, `MaterializeLocalMcpOptions`, `McpEnvironmentOptions`, `McpToolDescriptor`, `NoProgressForOptions`, `Observation`, `ObserveOptions`, `OpenSandboxRunOptions`, `PairwiseOptions`, `PatchDeliverableOptions`, `PlacementInfo`, `PlateauOptions`, `ProgressTrackerOptions`, `PromotionGateOptions`, `PromotionVerdict`, `PublishOptions`, `ResourceRequest`, `RollingDispatchOptions`, `RouterChatResult`, `RouterChatToolsResult`, `RouterToolLoopResult`, `RunAgenticOptions`, `RunAgentRoundsOptions`, `SandboxRun`, `ShotSpec`, `SpawnOpts`, `StdioMcpConnection`, `StrategyEvolutionConfig`, `StrategyResult`, `StreamAgentTurnOptions`, `StructuralRolloutConfig`, `SuperviseOptions`, `SuperviseSurfaceOptions`, `SupervisorAgentDeps`, `SupervisorOpts`, `SurfaceScore`, `ToolSpec`, `TraceSource`, `ValidationCtx`, `Validator`, `WaterfallCollector`, `WaterfallReport`, `Workspace`, `WorkspaceRequest`, `WorkspaceRun`, `WorktreeCliExecutorOptions`, `WorktreeFanoutOptions`, `AgentEnvironmentStatus`, `AgentSessionStatus`, `ChampionPolicy`, `LoopTraceEvent`, `MakeWorkerAgent`, `RepairStop`, `WorkspaceCommit`. +**Undocumented supporting types** (add a TSDoc line at the declaration to earn a table row): `AgentEnvironment`, `AgentEnvironmentCapabilities`, `AgentEnvironmentEvent`, `AgentEnvironmentProvider`, `AgentEnvironmentQuery`, `AgentEnvironmentSummary`, `AgenticOptions`, `AgenticRunResult`, `AgenticTool`, `AgentSession`, `AgentSessionRef`, `AgentTurnInput`, `AgentTurnResult`, `AllWorkersStalledOptions`, `AnalystRegistry`, `AnytimeReport`, `AnytimeStrategySummary`, `ArtifactHandle`, `AuditIntentOptions`, `AuthoredHarness`, `AuthoredStrategy`, `AuthorStrategyOptions`, `BenchmarkConfig`, `BenchmarkLift`, `BenchmarkStrategySummary`, `BenchmarkTaskRow`, `BudgetPool`, `BusStats`, `ChampionPick`, `CheckpointRef`, `CheckpointRequest`, `CheckRunContext`, `CorpusReadbackOptions`, `CreateAgentEnvironmentInput`, `CreateTangleSandboxExactProcessProviderOptions`, `DefinedLeaderboard`, `DispatchReport`, `Driver`, `EventBus`, `EvolutionArchiveNode`, `EvolutionBandInfo`, `EvolutionCandidate`, `EvolutionGeneration`, `EvolutionReport`, `ExecRequest`, `ExecResult`, `ForkRequest`, `GitWorkspaceOptions`, `HarvestFailure`, `HarvestReport`, `Inbox`, `InProcessSandboxClientOptions`, `IntentAudit`, `Iteration`, `Leaderboard`, `LeaderboardOptions`, `LoopDecisionPayload`, `LoopDispatchOptions`, `LoopEndedPayload`, `LoopIterationEndedPayload`, `LoopIterationStartedPayload`, `LoopPlanDescription`, `LoopResult`, `LoopSandboxPlacement`, `LoopStartedPayload`, `LoopTraceEmitter`, `LoopWinner`, `MaterializeLocalMcpOptions`, `McpEnvironmentOptions`, `McpToolDescriptor`, `NoProgressForOptions`, `Observation`, `ObserveOptions`, `OpenSandboxRunOptions`, `PairwiseOptions`, `PatchDeliverableOptions`, `PlacementInfo`, `PlateauOptions`, `ProgressTrackerOptions`, `PromotionGateOptions`, `PromotionVerdict`, `PublishOptions`, `ResourceRequest`, `RollingDispatchOptions`, `RouterChatResult`, `RouterChatToolsResult`, `RouterToolLoopResult`, `RunAgenticOptions`, `RunAgentRoundsOptions`, `SandboxRun`, `ShotSpec`, `SpawnOpts`, `StdioMcpConnection`, `Strategy`, `StrategyEvolutionConfig`, `StrategyResult`, `StreamAgentTurnOptions`, `StructuralRolloutConfig`, `SuperviseOptions`, `SuperviseSurfaceOptions`, `SupervisorAgentDeps`, `SupervisorOpts`, `SurfaceScore`, `ToolSpec`, `TraceSource`, `ValidationCtx`, `Validator`, `WaterfallCollector`, `WaterfallReport`, `Workspace`, `WorkspaceRequest`, `WorkspaceRun`, `WorktreeCliExecutorOptions`, `WorktreeFanoutOptions`, `AgentEnvironmentStatus`, `AgentSessionStatus`, `ChampionPolicy`, `LoopTraceEvent`, `MakeWorkerAgent`, `RepairStop`, `WorkspaceCommit`. ### Environment provider adapters — generic sandbox/compute bridge diff --git a/docs/api/runtime.md b/docs/api/runtime.md index 177295c3..e9fb72a0 100644 --- a/docs/api/runtime.md +++ b/docs/api/runtime.md @@ -6134,7 +6134,7 @@ The worker: model + router + (optional) the critic's instruction (the steerer kn ##### strategies? -> `optional` **strategies?**: [`Strategy`](#strategy-3)[] +> `optional` **strategies?**: [`Strategy`](#strategy-3)\<[`StrategyResult`](#strategyresult-1)\>[] Defined in: [src/runtime/run-benchmark.ts:41](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/run-benchmark.ts#L41) @@ -7940,7 +7940,7 @@ Authored candidates per generation. Default 2. ##### baselines? -> `optional` **baselines?**: [`Strategy`](#strategy-3)[] +> `optional` **baselines?**: [`Strategy`](#strategy-3)\<[`StrategyResult`](#strategyresult-1)\>[] Defined in: [src/runtime/strategy-evolution.ts:77](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy-evolution.ts#L77) @@ -8902,16 +8902,13 @@ Defined in: [src/runtime/strategy.ts:621](https://github.com/tangle-network/agen ### Strategy -Defined in: [src/runtime/strategy.ts:758](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L758) +Defined in: [src/runtime/strategy.ts:760](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L760) + +#### Type Parameters + +##### Result -A Strategy is HOW you spend the compute budget to beat the Environment's check — it -builds the driver `Agent` the Supervisor runs. This is the OPEN extension point: a dev -authors their own by implementing `driver()` to return an Agent whose `act()` spawns -shots/analysts via `scope.spawn` / `scope.next` / `scope.send`. The two built-ins are -the reference implementations to copy: - sample — K INDEPENDENT attempts, keep the best-verifying (best-of-N / resample). - refine — attempt → observe() reads the trace → steer the next → repeat (iterate). -(A multi-agent "team" is just a Strategy whose driver spawns several different agents.) +`Result` *extends* [`StrategyResult`](#strategyresult-1) = [`StrategyResult`](#strategyresult-1) #### Properties @@ -8919,7 +8916,7 @@ the reference implementations to copy: > `readonly` **name**: `string` -Defined in: [src/runtime/strategy.ts:759](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L759) +Defined in: [src/runtime/strategy.ts:761](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L761) #### Methods @@ -8927,7 +8924,7 @@ Defined in: [src/runtime/strategy.ts:759](https://github.com/tangle-network/agen > **driver**(`surface`, `task`, `opts`, `budget`): [`Agent`](#agent-1)\<`unknown`, [`Outcome`](#outcome-1)\<`unknown`\>\> -Defined in: [src/runtime/strategy.ts:760](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L760) +Defined in: [src/runtime/strategy.ts:764](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L764) ###### Parameters @@ -8955,7 +8952,7 @@ Defined in: [src/runtime/strategy.ts:760](https://github.com/tangle-network/agen ### ShotPersona -Defined in: [src/runtime/strategy.ts:790](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L790) +Defined in: [src/runtime/strategy.ts:794](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L794) A role for one shot — multi-agent loops (researcher + engineer, a panel of k researchers) give each shot its own system prompt and optionally its own model. @@ -8966,7 +8963,7 @@ A role for one shot — multi-agent loops (researcher + engineer, a panel of k > `optional` **systemPrompt?**: `string` -Defined in: [src/runtime/strategy.ts:793](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L793) +Defined in: [src/runtime/strategy.ts:797](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L797) Replaces the task's systemPrompt for a FRESH shot; on a carried conversation it is injected as a hand-off message (the transcript's earlier roles stay intact). @@ -8975,7 +8972,7 @@ Replaces the task's systemPrompt for a FRESH shot; on a carried conversation it > `optional` **model?**: `string` -Defined in: [src/runtime/strategy.ts:795](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L795) +Defined in: [src/runtime/strategy.ts:799](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L799) Per-shot model override (e.g. a stronger model for the engineer shot). @@ -8983,7 +8980,7 @@ Per-shot model override (e.g. a stronger model for the engineer shot). ### ShotSpec -Defined in: [src/runtime/strategy.ts:798](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L798) +Defined in: [src/runtime/strategy.ts:802](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L802) #### Properties @@ -8991,7 +8988,7 @@ Defined in: [src/runtime/strategy.ts:798](https://github.com/tangle-network/agen > `optional` **handle?**: [`ArtifactHandle`](#artifacthandle) -Defined in: [src/runtime/strategy.ts:800](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L800) +Defined in: [src/runtime/strategy.ts:804](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L804) present ⇒ continue this artifact (depth); absent ⇒ the shot opens a fresh one (sample/restart). @@ -8999,25 +8996,25 @@ present ⇒ continue this artifact (depth); absent ⇒ the shot opens a fresh on > `optional` **messages?**: `Msg`[] -Defined in: [src/runtime/strategy.ts:801](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L801) +Defined in: [src/runtime/strategy.ts:805](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L805) ##### steer? > `optional` **steer?**: `string` -Defined in: [src/runtime/strategy.ts:802](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L802) +Defined in: [src/runtime/strategy.ts:806](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L806) ##### persona? > `optional` **persona?**: [`ShotPersona`](#shotpersona) -Defined in: [src/runtime/strategy.ts:803](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L803) +Defined in: [src/runtime/strategy.ts:807](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L807) ##### tools? > `optional` **tools?**: `string`[] -Defined in: [src/runtime/strategy.ts:806](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L806) +Defined in: [src/runtime/strategy.ts:810](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L810) Restrict THIS shot to a subset of the domain's tools (by name) — focus a shot on the relevant capabilities. Restriction-only; unknown names throw. Omitted ⇒ all. @@ -9026,7 +9023,7 @@ Restrict THIS shot to a subset of the domain's tools (by name) — focus a shot ### StrategyResult -Defined in: [src/runtime/strategy.ts:808](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L808) +Defined in: [src/runtime/strategy.ts:812](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L812) #### Extended by @@ -9038,37 +9035,37 @@ Defined in: [src/runtime/strategy.ts:808](https://github.com/tangle-network/agen > **score**: `number` -Defined in: [src/runtime/strategy.ts:809](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L809) +Defined in: [src/runtime/strategy.ts:813](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L813) ##### resolved > **resolved**: `boolean` -Defined in: [src/runtime/strategy.ts:810](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L810) +Defined in: [src/runtime/strategy.ts:814](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L814) ##### completions > **completions**: `number` -Defined in: [src/runtime/strategy.ts:811](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L811) +Defined in: [src/runtime/strategy.ts:815](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L815) ##### progression > **progression**: `number`[] -Defined in: [src/runtime/strategy.ts:812](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L812) +Defined in: [src/runtime/strategy.ts:816](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L816) ##### shots > **shots**: `number` -Defined in: [src/runtime/strategy.ts:813](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L813) +Defined in: [src/runtime/strategy.ts:817](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L817) *** ### StrategyCtx -Defined in: [src/runtime/strategy.ts:825](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L825) +Defined in: [src/runtime/strategy.ts:829](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L829) What a strategy body composes with: the artifact lifecycle, the budget, and the two steps. @@ -9078,7 +9075,7 @@ What a strategy body composes with: the artifact lifecycle, the budget, and the > `readonly` **surface**: `StrategyArtifacts` -Defined in: [src/runtime/strategy.ts:827](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L827) +Defined in: [src/runtime/strategy.ts:831](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L831) Open/close artifacts the body manages itself (e.g. one persistent handle for depth). @@ -9086,25 +9083,25 @@ Open/close artifacts the body manages itself (e.g. one persistent handle for dep > `readonly` **task**: [`AgenticTask`](#agentictask) -Defined in: [src/runtime/strategy.ts:828](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L828) +Defined in: [src/runtime/strategy.ts:832](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L832) ##### opts > `readonly` **opts**: [`AgenticOptions`](#agenticoptions) -Defined in: [src/runtime/strategy.ts:829](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L829) +Defined in: [src/runtime/strategy.ts:833](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L833) ##### budget > `readonly` **budget**: `number` -Defined in: [src/runtime/strategy.ts:830](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L830) +Defined in: [src/runtime/strategy.ts:834](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L834) ##### scope > `readonly` **scope**: [`Scope`](#scope-1)\<[`Outcome`](#outcome-1)\<`unknown`\>\> -Defined in: [src/runtime/strategy.ts:831](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L831) +Defined in: [src/runtime/strategy.ts:835](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L835) #### Methods @@ -9112,7 +9109,7 @@ Defined in: [src/runtime/strategy.ts:831](https://github.com/tangle-network/agen > **shot**(`spec?`): `Promise`\<`ShotResult` \| `null`\> -Defined in: [src/runtime/strategy.ts:833](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L833) +Defined in: [src/runtime/strategy.ts:837](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L837) Run ONE worker shot; its harness-scored result, or null if it went down. @@ -9130,7 +9127,7 @@ Run ONE worker shot; its harness-scored result, or null if it went down. > **critique**(`messages`): `Promise`\<`string` \| `null`\> -Defined in: [src/runtime/strategy.ts:835](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L835) +Defined in: [src/runtime/strategy.ts:839](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L839) The firewalled critic reads the trajectory → a steer string, or null on COMPLETE/down. @@ -9148,7 +9145,7 @@ The firewalled critic reads the trajectory → a steer string, or null on COMPLE > **consult**(`messages`, `instruction`): `Promise`\<`string` \| `null`\> -Defined in: [src/runtime/strategy.ts:840](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L840) +Defined in: [src/runtime/strategy.ts:844](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L844) The RAW analyst channel: the firewalled critic answers `instruction` over the trajectory verbatim — no findings extraction, so verdict-shaped formats @@ -9173,7 +9170,7 @@ The RAW analyst channel: the firewalled critic answers `instruction` over the > **listTools**(`handle`): `Promise`\<`object`[]\> -Defined in: [src/runtime/strategy.ts:844](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L844) +Defined in: [src/runtime/strategy.ts:848](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L848) The tools THIS artifact's task actually offers (names + descriptions only — never the implementations). Tool sets vary per task on heterogeneous domains; a strategy @@ -9193,12 +9190,18 @@ The tools THIS artifact's task actually offers (names + descriptions only — ne ### RunAgenticOptions -Defined in: [src/runtime/strategy.ts:1073](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1073) +Defined in: [src/runtime/strategy.ts:1077](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1077) #### Extends - [`AgenticOptions`](#agenticoptions) +#### Type Parameters + +##### Result + +`Result` *extends* [`StrategyResult`](#strategyresult-1) = [`StrategyResult`](#strategyresult-1) + #### Properties ##### routerBaseUrl @@ -9361,28 +9364,28 @@ In-context learning: when set, query `corpus` before each depth shot and inject > **surface**: [`AgenticSurface`](#agenticsurface) -Defined in: [src/runtime/strategy.ts:1074](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1074) +Defined in: [src/runtime/strategy.ts:1079](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1079) ##### task > **task**: [`AgenticTask`](#agentictask) -Defined in: [src/runtime/strategy.ts:1075](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1075) +Defined in: [src/runtime/strategy.ts:1080](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1080) ##### hooks? > `optional` **hooks?**: [`RuntimeHooks`](index.md#runtimehooks) -Defined in: [src/runtime/strategy.ts:1078](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1078) +Defined in: [src/runtime/strategy.ts:1083](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1083) Lifecycle observability — every spawn/settle (shots, analysts) streams here live. The seam online watchdogs/route-auditors subscribe to. ##### strategy? -> `optional` **strategy?**: [`Strategy`](#strategy-3) +> `optional` **strategy?**: [`Strategy`](#strategy-3)\<`Result`\> -Defined in: [src/runtime/strategy.ts:1080](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1080) +Defined in: [src/runtime/strategy.ts:1085](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1085) A Strategy (the open way) — author/pass your own. Overrides `mode` when present. @@ -9390,7 +9393,7 @@ A Strategy (the open way) — author/pass your own. Overrides `mode` when presen > `optional` **mode?**: `"depth"` \| `"breadth"` -Defined in: [src/runtime/strategy.ts:1082](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1082) +Defined in: [src/runtime/strategy.ts:1087](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1087) Built-in shorthand: 'depth'→refine, 'breadth'→sample. Default 'depth'. @@ -9398,7 +9401,7 @@ Built-in shorthand: 'depth'→refine, 'breadth'→sample. Default 'depth'. > **budget**: `number` -Defined in: [src/runtime/strategy.ts:1084](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1084) +Defined in: [src/runtime/strategy.ts:1089](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1089) budget: refine→max shots; sample→rollout width. @@ -9406,7 +9409,7 @@ budget: refine→max shots; sample→rollout width. > `optional` **rootBudget?**: [`Budget`](#budget-12) -Defined in: [src/runtime/strategy.ts:1085](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1085) +Defined in: [src/runtime/strategy.ts:1090](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1090) *** @@ -9902,7 +9905,7 @@ The body's deliverable — a `StrategyResult` plus selection provenance. The ext #### Extends -- [`StrategyResult`](#strategyresult) +- [`StrategyResult`](#strategyresult-1) #### Properties @@ -9910,57 +9913,65 @@ The body's deliverable — a `StrategyResult` plus selection provenance. The ext > **score**: `number` -Defined in: [src/runtime/strategy.ts:809](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L809) +Defined in: [src/runtime/strategy.ts:813](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L813) ###### Inherited from -[`StrategyResult`](#strategyresult).[`score`](#score-9) +[`StrategyResult`](#strategyresult-1).[`score`](#score-9) ##### resolved > **resolved**: `boolean` -Defined in: [src/runtime/strategy.ts:810](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L810) +Defined in: [src/runtime/strategy.ts:814](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L814) ###### Inherited from -[`StrategyResult`](#strategyresult).[`resolved`](#resolved-4) +[`StrategyResult`](#strategyresult-1).[`resolved`](#resolved-4) ##### completions > **completions**: `number` -Defined in: [src/runtime/strategy.ts:811](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L811) +Defined in: [src/runtime/strategy.ts:815](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L815) ###### Inherited from -[`StrategyResult`](#strategyresult).[`completions`](#completions-1) +[`StrategyResult`](#strategyresult-1).[`completions`](#completions-1) ##### progression > **progression**: `number`[] -Defined in: [src/runtime/strategy.ts:812](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L812) +Defined in: [src/runtime/strategy.ts:816](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L816) ###### Inherited from -[`StrategyResult`](#strategyresult).[`progression`](#progression-2) +[`StrategyResult`](#strategyresult-1).[`progression`](#progression-2) ##### shots > **shots**: `number` -Defined in: [src/runtime/strategy.ts:813](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L813) +Defined in: [src/runtime/strategy.ts:817](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L817) ###### Inherited from -[`StrategyResult`](#strategyresult).[`shots`](#shots-3) +[`StrategyResult`](#strategyresult-1).[`shots`](#shots-3) + +##### artifact + +> **artifact**: `string` \| `null` + +Defined in: [src/runtime/structural-rollout.ts:491](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L491) + +Exact selected candidate text passed to the visible checks, or null when no shot ran. ##### selection > **selection**: [`SelectionReceipt`](#selectionreceipt)[] -Defined in: [src/runtime/structural-rollout.ts:492](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L492) +Defined in: [src/runtime/structural-rollout.ts:494](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L494) One receipt per scored candidate (k samples, then repairs), `SelectionReceipt` shaped like the kernel's (`types.ts`), selector 'driver'. @@ -9969,25 +9980,25 @@ One receipt per scored candidate (k samples, then repairs), `SelectionReceipt` > **repairStop**: [`RepairStop`](#repairstop) -Defined in: [src/runtime/structural-rollout.ts:493](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L493) +Defined in: [src/runtime/structural-rollout.ts:495](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L495) ##### officialChecks > **officialChecks**: `number` -Defined in: [src/runtime/structural-rollout.ts:494](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L494) +Defined in: [src/runtime/structural-rollout.ts:496](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L496) ##### authoredChecks > **authoredChecks**: `number` -Defined in: [src/runtime/structural-rollout.ts:495](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L495) +Defined in: [src/runtime/structural-rollout.ts:497](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L497) *** ### StructuralRolloutConfig -Defined in: [src/runtime/structural-rollout.ts:498](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L498) +Defined in: [src/runtime/structural-rollout.ts:500](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L500) #### Properties @@ -9995,7 +10006,7 @@ Defined in: [src/runtime/structural-rollout.ts:498](https://github.com/tangle-ne > `optional` **policy?**: `Partial`\<[`StructuralRolloutPolicy`](#structuralrolloutpolicy)\> -Defined in: [src/runtime/structural-rollout.ts:500](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L500) +Defined in: [src/runtime/structural-rollout.ts:502](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L502) Knobs; missing fields take the measured defaults (k=5, repairRounds=2, testgen=6). @@ -10003,7 +10014,7 @@ Knobs; missing fields take the measured defaults (k=5, repairRounds=2, testgen=6 > `optional` **checkSource?**: [`CheckSource`](#checksource) -Defined in: [src/runtime/structural-rollout.ts:503](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L503) +Defined in: [src/runtime/structural-rollout.ts:505](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L505) Where the visible checks come from. Default: official checks from `task.meta.visibleChecks` composed with `modelAuthoredChecks()`. @@ -10012,7 +10023,7 @@ Where the visible checks come from. Default: official checks from > `optional` **checkRunner?**: [`CheckRunner`](#checkrunner) -Defined in: [src/runtime/structural-rollout.ts:506](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L506) +Defined in: [src/runtime/structural-rollout.ts:508](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L508) How candidates are measured. Default `sandboxCheckRunner()` — it needs an exec channel (bind one to the runner, or pass `box` here) and fails loud without one. @@ -10021,7 +10032,7 @@ How candidates are measured. Default `sandboxCheckRunner()` — it needs an exec > `optional` **box?**: [`CheckExecChannel`](#checkexecchannel) -Defined in: [src/runtime/structural-rollout.ts:510](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L510) +Defined in: [src/runtime/structural-rollout.ts:512](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L512) Exec channel threaded into every check run of this strategy (a sandbox instance / `ValidationCtx.box`). The strategy seam itself carries no sandbox, so the caller @@ -10031,7 +10042,7 @@ Exec channel threaded into every check run of this strategy (a sandbox instance > `optional` **extractCandidate?**: (`messages`) => `string` -Defined in: [src/runtime/structural-rollout.ts:512](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L512) +Defined in: [src/runtime/structural-rollout.ts:514](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L514) Candidate extraction from a shot's conversation. Default `defaultExtractCandidate`. @@ -10189,7 +10200,7 @@ The self-improvement lens fed to the driver on each settled worker. Default `fai ##### strategy? -> `readonly` `optional` **strategy?**: [`Strategy`](#strategy-3) +> `readonly` `optional` **strategy?**: [`Strategy`](#strategy-3)\<[`StrategyResult`](#strategyresult-1)\> Defined in: [src/runtime/supervise-surface.ts:184](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/supervise-surface.ts#L184) @@ -19188,7 +19199,7 @@ The compressed consumable a skill carries: everything an author needs to emit a > `const` **sample**: [`Strategy`](#strategy-3) -Defined in: [src/runtime/strategy.ts:769](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L769) +Defined in: [src/runtime/strategy.ts:773](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L773) Built-in `Strategy`: K independent attempts, keep the best-verifying (best-of-N / resample). @@ -19198,7 +19209,7 @@ Built-in `Strategy`: K independent attempts, keep the best-verifying (best-of-N > `const` **refine**: [`Strategy`](#strategy-3) -Defined in: [src/runtime/strategy.ts:774](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L774) +Defined in: [src/runtime/strategy.ts:778](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L778) Built-in `Strategy`: attempt → `observe()` reads the trace → steer the next attempt → repeat (deepen one lineage). @@ -19206,9 +19217,9 @@ Built-in `Strategy`: attempt → `observe()` reads the trace → steer the next ### adaptiveRefine -> `const` **adaptiveRefine**: [`Strategy`](#strategy-3) +> `const` **adaptiveRefine**: [`Strategy`](#strategy-3)\<\{ `score`: `number`; `resolved`: `boolean`; `completions`: `number`; `progression`: `number`[]; `shots`: `number`; \}\> -Defined in: [src/runtime/strategy.ts:974](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L974) +Defined in: [src/runtime/strategy.ts:978](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L978) A NEW strategy, authored from the steps (~20 lines): refine, but when a steered shot fails to improve the score it ABANDONS that line and restarts fresh (branch-when-stuck) @@ -19220,9 +19231,9 @@ A NEW strategy, authored from the steps (~20 lines): refine, but when a steered ### sampleThenRefine -> `const` **sampleThenRefine**: [`Strategy`](#strategy-3) +> `const` **sampleThenRefine**: [`Strategy`](#strategy-3)\<\{ `score`: `number`; `resolved`: `boolean`; `completions`: `number`; `progression`: `number`[]; `shots`: `number`; \}\> -Defined in: [src/runtime/strategy.ts:1017](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1017) +Defined in: [src/runtime/strategy.ts:1021](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1021) The explore-then-exploit MIX: spend ⌈budget/2⌉ on independent samples (kept open), then refine the best-verifying line with the remaining budget. Sample's basin escape + @@ -21922,12 +21933,18 @@ BREADTH: K independent rollouts (each own artifact), verifier picks the best. ### defineStrategy() -> **defineStrategy**(`name`, `run`): [`Strategy`](#strategy-3) +> **defineStrategy**\<`Result`\>(`name`, `run`): [`Strategy`](#strategy-3)\<`Result`\> -Defined in: [src/runtime/strategy.ts:848](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L848) +Defined in: [src/runtime/strategy.ts:852](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L852) Author a Strategy from the composable steps — the open, compact way. +#### Type Parameters + +##### Result + +`Result` *extends* [`StrategyResult`](#strategyresult-1) + #### Parameters ##### name @@ -21936,31 +21953,37 @@ Author a Strategy from the composable steps — the open, compact way. ##### run -(`ctx`) => `Promise`\<[`StrategyResult`](#strategyresult)\> +(`ctx`) => `Promise`\<`Result`\> #### Returns -[`Strategy`](#strategy-3) +[`Strategy`](#strategy-3)\<`Result`\> *** ### runAgentic() -> **runAgentic**(`opts`): `Promise`\<[`AgenticRunResult`](#agenticrunresult)\> +> **runAgentic**\<`Result`\>(`opts`): `Promise`\<[`AgenticRunResult`](#agenticrunresult) & `Result`\> -Defined in: [src/runtime/strategy.ts:1089](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1089) +Defined in: [src/runtime/strategy.ts:1094](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/strategy.ts#L1094) Run a Strategy through the keystone Supervisor — `Agent.act` over a conserved-budget Scope. +#### Type Parameters + +##### Result + +`Result` *extends* [`StrategyResult`](#strategyresult-1) = [`StrategyResult`](#strategyresult-1) + #### Parameters ##### opts -[`RunAgenticOptions`](#runagenticoptions) +[`RunAgenticOptions`](#runagenticoptions)\<`Result`\> #### Returns -`Promise`\<[`AgenticRunResult`](#agenticrunresult)\> +`Promise`\<[`AgenticRunResult`](#agenticrunresult) & `Result`\> *** @@ -22299,9 +22322,9 @@ readonly `Msg`[] ### structuralRollout() -> **structuralRollout**(`config?`): [`Strategy`](#strategy-3) +> **structuralRollout**(`config?`): [`Strategy`](#strategy-3)\<[`StructuralRolloutResult`](#structuralrolloutresult)\> -Defined in: [src/runtime/structural-rollout.ts:525](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L525) +Defined in: [src/runtime/structural-rollout.ts:527](https://github.com/tangle-network/agent-runtime/blob/main/src/runtime/structural-rollout.ts#L527) Build the structuralRollout `Strategy`: k shots → score each by the frozen visible checks (official above authored, crash lowest) → argmax with first-index tie-break → @@ -22320,7 +22343,7 @@ Budget note: `runAgentic`'s `budget` sizes the pool — pass at least #### Returns -[`Strategy`](#strategy-3) +[`Strategy`](#strategy-3)\<[`StructuralRolloutResult`](#structuralrolloutresult)\> *** diff --git a/src/runtime/strategy.ts b/src/runtime/strategy.ts index b4e146be..bc0388f7 100644 --- a/src/runtime/strategy.ts +++ b/src/runtime/strategy.ts @@ -755,8 +755,12 @@ export function breadthStrategy( * refine — attempt → observe() reads the trace → steer the next → repeat (iterate). * (A multi-agent "team" is just a Strategy whose driver spawns several different agents.) */ -export interface Strategy { +declare const strategyResult: unique symbol + +export interface Strategy { readonly name: string + /** @internal Associates a strategy with its typed result without adding a runtime field. */ + readonly [strategyResult]?: Result driver( surface: AgenticSurface, task: AgenticTask, @@ -845,10 +849,10 @@ export interface StrategyCtx { } /** Author a Strategy from the composable steps — the open, compact way. */ -export function defineStrategy( +export function defineStrategy( name: string, - run: (ctx: StrategyCtx) => Promise, -): Strategy { + run: (ctx: StrategyCtx) => Promise, +): Strategy { return { name, driver: (surface, task, opts, budget) => ({ @@ -1070,14 +1074,15 @@ export const sampleThenRefine = defineStrategy( }, ) -export interface RunAgenticOptions extends AgenticOptions { +export interface RunAgenticOptions + extends AgenticOptions { surface: AgenticSurface task: AgenticTask /** Lifecycle observability — every spawn/settle (shots, analysts) streams here live. * The seam online watchdogs/route-auditors subscribe to. */ hooks?: RuntimeHooks /** A Strategy (the open way) — author/pass your own. Overrides `mode` when present. */ - strategy?: Strategy + strategy?: Strategy /** Built-in shorthand: 'depth'→refine, 'breadth'→sample. Default 'depth'. */ mode?: 'depth' | 'breadth' /** budget: refine→max shots; sample→rollout width. */ @@ -1086,7 +1091,9 @@ export interface RunAgenticOptions extends AgenticOptions { } /** Run a Strategy through the keystone Supervisor — `Agent.act` over a conserved-budget Scope. */ -export async function runAgentic(opts: RunAgenticOptions): Promise { +export async function runAgentic( + opts: RunAgenticOptions, +): Promise { const strategy: Strategy = opts.strategy ?? (opts.mode === 'breadth' ? sample : refine) const driver = strategy.driver(opts.surface, opts.task, opts, opts.budget) const supervisor = createSupervisor>() @@ -1113,11 +1120,11 @@ export async function runAgentic(opts: RunAgenticOptions): Promise + const core = result.out.deliverable as Omit return { ...core, usd: result.spentTotal.usd, tokens: result.spentTotal.tokens, ms: Date.now() - started, - } + } as AgenticRunResult & Result } diff --git a/src/runtime/structural-rollout.test.ts b/src/runtime/structural-rollout.test.ts index dcfe5b96..3e784cf2 100644 --- a/src/runtime/structural-rollout.test.ts +++ b/src/runtime/structural-rollout.test.ts @@ -257,6 +257,51 @@ describe('structuralRollout — the strategy, end to end (offline transport, fak expect(() => structuralRollout({ policy: { testgen: 1.5 } })).toThrow(/policy\.testgen/) }) + it('returns a typed null artifact when the pool cannot admit a candidate', async () => { + const surface: AgenticSurface = { + name: 'starved', + async open() { + return { id: 'unused', surface: 'starved' } + }, + async tools() { + return [] + }, + async call() { + throw new Error('candidate should not run') + }, + async score() { + throw new Error('candidate should not run') + }, + async close() {}, + } + + const result = await runAgentic({ + surface, + task: { id: 'starved', systemPrompt: 'Solve it.', userPrompt: 'Solve it.' }, + routerBaseUrl: 'http://offline.test/v1', + routerKey: 'k', + model: 'stub-model', + complete: async () => { + throw new Error('candidate should not run') + }, + strategy: structuralRollout({ + policy: { k: 1, repairRounds: 0, testgen: 0 }, + checkSource: { generate: async () => [] }, + checkRunner: { + async run() { + throw new Error('candidate should not run') + }, + }, + }), + budget: 1, + rootBudget: { maxIterations: 1, maxTokens: 1 }, + }) + + expect(result.repairStop).toBe('no-candidates') + expect(result.artifact).toBeNull() + expect(result.shots).toBe(0) + }) + it('selects by frozen visible checks, repairs on failure output, and holds the official guard', async () => { // The domain: a verifier-environment-shaped surface (submit_answer only); each // shot's artifact scores 0 so nothing here can leak a hidden signal into selection — @@ -363,11 +408,12 @@ describe('structuralRollout — the strategy, end to end (offline transport, fak }), budget: 6, }) - const rollout = result as unknown as StructuralRolloutResult & { mode: string } + const rollout: StructuralRolloutResult & { mode: string } = result expect(rollout.mode).toBe('structuralRollout') expect(rollout.shots).toBe(4) // 2 samples + 2 repairs expect(rollout.repairStop).toBe('repaired-pass') + expect(rollout.artifact).toBe('def f():\n return "D"') // Checks were generated ONCE and the same frozen set fed every run. expect(generate).toHaveBeenCalledOnce() diff --git a/src/runtime/structural-rollout.ts b/src/runtime/structural-rollout.ts index cc9d4ac9..b9ff4f68 100644 --- a/src/runtime/structural-rollout.ts +++ b/src/runtime/structural-rollout.ts @@ -487,6 +487,8 @@ export type RepairStop = * fields ride through `defineStrategy`'s deliverable spread onto `AgenticRunResult` * (score/resolved stay harness-verified, exactly as for every authored strategy). */ export interface StructuralRolloutResult extends StrategyResult { + /** Exact selected candidate text passed to the visible checks, or null when no shot ran. */ + artifact: string | null /** One receipt per scored candidate (k samples, then repairs), `SelectionReceipt` * shaped like the kernel's (`types.ts`), selector 'driver'. */ selection: SelectionReceipt[] @@ -522,7 +524,9 @@ export interface StructuralRolloutConfig { * Budget note: `runAgentic`'s `budget` sizes the pool — pass at least * `k + repairRounds + 1` so the samples, repairs, and the check-author consult all admit. */ -export function structuralRollout(config: StructuralRolloutConfig = {}): Strategy { +export function structuralRollout( + config: StructuralRolloutConfig = {}, +): Strategy { const policy = resolvePolicy(config.policy) const checkSource = config.checkSource ?? composeCheckSources(officialChecksFromMeta(), modelAuthoredChecks()) @@ -559,6 +563,7 @@ export function structuralRollout(config: StructuralRolloutConfig = {}): Strateg interface Candidate { index: number messages: Msg[] + artifact: string outcome: CheckOutcome shotScore: number shotResolved: boolean @@ -572,10 +577,12 @@ export function structuralRollout(config: StructuralRolloutConfig = {}): Strateg shots += 1 completions += out.completions progression.push(out.score) - const outcome = await checkRunner.run(extract(out.messages), checks, runCtx) + const artifact = extract(out.messages) + const outcome = await checkRunner.run(artifact, checks, runCtx) candidates.push({ index: candidates.length, messages: out.messages, + artifact, outcome, shotScore: out.score, shotResolved: out.total > 0 && out.passes === out.total, @@ -588,6 +595,7 @@ export function structuralRollout(config: StructuralRolloutConfig = {}): Strateg completions, progression, shots, + artifact: null, selection: receipts, repairStop: 'no-candidates', officialChecks, @@ -623,7 +631,8 @@ export function structuralRollout(config: StructuralRolloutConfig = {}): Strateg shots += 1 completions += out.completions progression.push(out.score) - const outcome = await checkRunner.run(extract(out.messages), checks, runCtx) + const artifact = extract(out.messages) + const outcome = await checkRunner.run(artifact, checks, runCtx) const displaced = canDisplace(outcome, best.outcome) const label = displaced ? 'repair (displaced the incumbent)' @@ -641,6 +650,7 @@ export function structuralRollout(config: StructuralRolloutConfig = {}): Strateg best = { index: seq, messages: out.messages, + artifact, outcome, shotScore: out.score, shotResolved: out.total > 0 && out.passes === out.total, @@ -664,6 +674,7 @@ export function structuralRollout(config: StructuralRolloutConfig = {}): Strateg completions, progression, shots, + artifact: best.artifact, selection: receipts, repairStop, officialChecks,