@tangle-network/agent-runtime 0.89.0 → 0.90.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/README.md +51 -18
- package/dist/agent.d.ts +53 -2
- package/dist/agent.js +168 -6
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/chunk-5QOB7H74.js +387 -0
- package/dist/chunk-5QOB7H74.js.map +1 -0
- package/dist/{chunk-4WXGK6GV.js → chunk-7ON74BQO.js} +2 -2
- package/dist/{chunk-7LO5GMAO.js → chunk-CMYMTRGA.js} +14 -5
- package/dist/chunk-CMYMTRGA.js.map +1 -0
- package/dist/{chunk-UD4BHQMI.js → chunk-IVGYLCFH.js} +2 -2
- package/dist/{chunk-UD4BHQMI.js.map → chunk-IVGYLCFH.js.map} +1 -1
- package/dist/{chunk-VNOOH22O.js → chunk-OOL3675H.js} +85 -4
- package/dist/chunk-OOL3675H.js.map +1 -0
- package/dist/{chunk-5AVV7KAH.js → chunk-QK4DV5PR.js} +2 -2
- package/dist/chunk-R2VAJGR3.js +214 -0
- package/dist/chunk-R2VAJGR3.js.map +1 -0
- package/dist/{chunk-N7EJV7N3.js → chunk-RYBVU4M3.js} +3592 -3562
- package/dist/chunk-RYBVU4M3.js.map +1 -0
- package/dist/{chunk-BQPFZE2C.js → chunk-WRUSWK4F.js} +5 -5
- package/dist/{chunk-PIPPLSOF.js → chunk-ZV4LXYCJ.js} +451 -24
- package/dist/chunk-ZV4LXYCJ.js.map +1 -0
- package/dist/{worktree-harness-CX_McRLp.d.ts → completion-gate-DkAnUmpb.d.ts} +45 -45
- package/dist/{coordination-CuDLO8wj.d.ts → coordination-rRj5hjJK.d.ts} +415 -227
- package/dist/environment-provider.d.ts +3 -3
- package/dist/index.d.ts +255 -16
- package/dist/index.js +463 -72
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +228 -84
- package/dist/intelligence.js +259 -166
- package/dist/intelligence.js.map +1 -1
- package/dist/knowledge.d.ts +120 -0
- package/dist/knowledge.js +28 -0
- package/dist/knowledge.js.map +1 -0
- package/dist/lifecycle.d.ts +2 -2
- package/dist/lifecycle.js +2 -2
- package/dist/{local-harness-sI0S_XNA.d.ts → local-harness-dcD5WTTr.d.ts} +3 -0
- package/dist/{loop-runner-bin-hQDUL8Ld.d.ts → loop-runner-bin-DTbZVGfM.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +6 -6
- package/dist/loop-runner-bin.js +7 -7
- package/dist/loops.d.ts +34 -369
- package/dist/loops.js +31 -5
- package/dist/mcp/bin.js +5 -5
- package/dist/mcp/index.d.ts +10 -11
- package/dist/mcp/index.js +10 -10
- package/dist/{mcp-serve-verifier-FL7-ZEb_.d.ts → mcp-serve-verifier-XsX8rkB9.d.ts} +12 -1
- package/dist/{openai-tools-BnrOmGjN.d.ts → openai-tools-C4ZfUD4L.d.ts} +1 -1
- package/dist/profiles.d.ts +196 -5
- package/dist/profiles.js +8 -0
- package/dist/profiles.js.map +1 -1
- package/dist/{router-client-r8y_VFVM.d.ts → router-client-DJImUDlm.d.ts} +1 -1
- package/dist/structural-rollout-MwlpgQ-6.d.ts +446 -0
- package/dist/supervise-DPmYPk0j.d.ts +131 -0
- package/dist/{types-ESeMOj94.d.ts → types-SyuwunY_.d.ts} +1 -1
- package/dist/{types-Driepl87.d.ts → types-eMNgWgFi.d.ts} +2 -2
- package/dist/{worktree-fanout-D6xR2CIA.d.ts → worktree-fanout-BDFQIO-Y.d.ts} +234 -234
- package/package.json +12 -4
- package/skills/agent-runtime-adoption/SKILL.md +74 -24
- package/skills/build-with-agent-runtime/SKILL.md +23 -20
- package/skills/loop-writer/SKILL.md +6 -5
- package/skills/supervise/SKILL.md +2 -2
- package/dist/chunk-7LO5GMAO.js.map +0 -1
- package/dist/chunk-N7EJV7N3.js.map +0 -1
- package/dist/chunk-PIPPLSOF.js.map +0 -1
- package/dist/chunk-VNOOH22O.js.map +0 -1
- package/dist/otel-export-BKmNwiCb.d.ts +0 -180
- /package/dist/{chunk-4WXGK6GV.js.map → chunk-7ON74BQO.js.map} +0 -0
- /package/dist/{chunk-5AVV7KAH.js.map → chunk-QK4DV5PR.js.map} +0 -0
- /package/dist/{chunk-BQPFZE2C.js.map → chunk-WRUSWK4F.js.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AgentProfile, AgentProfileValidationResult } from '@tangle-network/agent-interface';
|
|
2
|
-
import {
|
|
2
|
+
import { CreateAgentEnvironmentInput, AgentTurnInput, AgentEnvironmentProvider, AgentEnvironmentCapabilities, AgentProfileRef } from '@tangle-network/agent-interface/environment-provider';
|
|
3
3
|
export { AgentEnvironment, AgentEnvironmentCapabilities, AgentEnvironmentEvent, AgentEnvironmentProvider, AgentEnvironmentQuery, AgentEnvironmentStatus, AgentEnvironmentSummary, AgentProfileRef, AgentSession, AgentSessionRef, AgentSessionStatus, AgentTurnInput, AgentTurnResult, CheckpointRef, CheckpointRequest, CreateAgentEnvironmentInput, ExecRequest, ExecResult, ForkRequest, PlacementInfo, ResourceRequest, WorkspaceRequest } from '@tangle-network/agent-interface/environment-provider';
|
|
4
4
|
import { CreateSandboxOptions, BackendType } from '@tangle-network/sandbox';
|
|
5
|
-
import { R as Runtime, E as ExecutorFactory } from './types-
|
|
6
|
-
import { S as SandboxClient } from './types-
|
|
5
|
+
import { R as Runtime, E as ExecutorFactory } from './types-eMNgWgFi.js';
|
|
6
|
+
import { S as SandboxClient } from './types-SyuwunY_.js';
|
|
7
7
|
import '@tangle-network/agent-eval';
|
|
8
8
|
|
|
9
9
|
/** Provider object or registry name accepted by runtime provider adapters.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,32 @@
|
|
|
1
1
|
import { AgentProfile, AgentEvalError, AnalystFinding, KnowledgeReadinessReport, RunRecord, ControlEvalResult, KnowledgeRequirement } from '@tangle-network/agent-eval';
|
|
2
2
|
export { AgentEvalError, AgentEvalErrorCode, ConfigError, ControlBudget, ControlDecision, ControlEvalResult, ControlRunResult, ControlStep, DataAcquisitionPlan, JudgeError, KnowledgeReadinessReport, KnowledgeRequirement, NotFoundError, RunRecord, ValidationError } from '@tangle-network/agent-eval';
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import { Scenario, ProfileDispatchFn } from '@tangle-network/agent-eval/campaign';
|
|
6
|
-
import { C as CandidateGenerator } from './mcp-serve-verifier-
|
|
7
|
-
export { A as AgenticGeneratorOptions, I as ImprovementDriverOptions, M as McpServeSpec,
|
|
8
|
-
import { Scenario as Scenario$1, SurfaceProposer, JudgeConfig, MutableSurface, DispatchContext, SelfImproveBudget, SelfImproveLlm, SelfImproveResult } from '@tangle-network/agent-eval/contract';
|
|
3
|
+
import { g as AgentBackendInput, O as OpenAIChatTool, h as OpenAIChatToolChoice, i as OpenAIChatResponseFormat, j as AgentExecutionBackend, k as AgentBackendContext, b as RuntimeStreamEvent, K as KnowledgeReadinessDecision, l as RunAgentTaskOptions, m as AgentTaskRunResult, n as RunAgentTaskStreamOptions, o as AgentRuntimeEvent, p as AgentTaskStatus, q as RuntimeSessionStore, r as RuntimeSession, R as RuntimeHooks } from './types-SyuwunY_.js';
|
|
4
|
+
export { s as AgentAdapter, t as AgentKnowledgeProvider, u as AgentRuntimeEventSink, v as AgentTaskContext, w as AgentTaskSpec, B as BackendErrorDetail, x as RuntimeDecisionEvidenceRef, y as RuntimeDecisionKind, z as RuntimeDecisionPoint, C as RuntimeHookContext, F as RuntimeHookErrorContext, G as RuntimeHookEvent, H as RuntimeHookPhase, J as RuntimeHookTarget, M as RuntimeRunHandle, N as RuntimeRunPersistenceAdapter, P as RuntimeRunRow, Q as composeRuntimeHooks, T as defineRuntimeHooks, U as notifyRuntimeDecisionPoint, W as notifyRuntimeHookEvent, X as startRuntimeRun } from './types-SyuwunY_.js';
|
|
5
|
+
import { Scenario, ProfileDispatchFn, MutableSurface as MutableSurface$1, SurfaceProposer as SurfaceProposer$1 } from '@tangle-network/agent-eval/campaign';
|
|
6
|
+
import { V as Verifier, C as CandidateGenerator } from './mcp-serve-verifier-XsX8rkB9.js';
|
|
7
|
+
export { A as AgenticGeneratorOptions, I as ImprovementDriverOptions, M as McpServeSpec, a as VerifyResult, b as agenticGenerator, c as commandVerifier, i as improvementDriver, m as mcpServeVerifier } from './mcp-serve-verifier-XsX8rkB9.js';
|
|
8
|
+
import { Scenario as Scenario$1, SurfaceProposer, JudgeConfig, MutableSurface, DispatchContext, SelfImproveBudget, SelfImproveLlm, SelfImproveOptions, SelfImproveResult } from '@tangle-network/agent-eval/contract';
|
|
9
9
|
import { AgentProfile as AgentProfile$1 } from '@tangle-network/agent-interface';
|
|
10
|
+
import { L as LocalHarness } from './local-harness-dcD5WTTr.js';
|
|
10
11
|
import { S as SurfaceImprovementEdit } from './improvement-adapter-CDR8QNVM.js';
|
|
11
12
|
import { I as ImprovementAdapter } from './types-BC3bZpH0.js';
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
13
|
+
import { S as StructuralRolloutPolicy } from './structural-rollout-MwlpgQ-6.js';
|
|
14
|
+
export { AgentKnowledgeReadinessCheckOptions, KnowledgeImprovementJobMeasurement, KnowledgeImprovementJobResult, KnowledgeReadinessCheck, KnowledgeReadinessCheckInput, KnowledgeReadinessCheckResult, RESEARCH_SUPERVISOR_SYSTEM_PROMPT, RunKnowledgeImprovementJobOptions, SupervisedKnowledgeUpdateInput, SupervisedKnowledgeUpdateOptions, SupervisedKnowledgeUpdateResult, SupervisedKnowledgeUpdater, createAgentKnowledgeReadinessCheck, createSupervisedKnowledgeUpdater, formatSupervisedKnowledgeTask, knowledgeReadinessDeliverable, runKnowledgeImprovementJob, runSupervisedKnowledgeUpdate } from './knowledge.js';
|
|
15
|
+
export { D as DELEGATED_LOOP_MODES, a as DelegatedLoopMode, b as DelegatedLoopRegistry, c as DelegatedLoopResult, d as DelegatedLoopRunner, L as LoopRunnerCliArgs, e as LoopRunnerCliResult, R as ResearchLoopResult, f as ResearchLoopRunnerOptions, g as RunDelegatedLoopOptions, V as VetoedFact, W as WorktreeLoopRunnerOptions, h as auditLoopRunner, i as isDelegatedLoopMode, p as parseLoopRunnerArgv, r as researchLoopRunner, j as runDelegatedLoop, k as runLoopRunnerCli, s as selfImproveLoopRunner, w as worktreeLoopRunner } from './loop-runner-bin-DTbZVGfM.js';
|
|
16
|
+
export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from './openai-tools-C4ZfUD4L.js';
|
|
17
|
+
export { b0 as EvalRunEvent, b1 as EvalRunGeneration, b2 as EvalRunsExportConfig, b3 as EvalRunsExportResult, b4 as INTELLIGENCE_WIRE_VERSION, b5 as LoopSpanNode, b6 as OtelAttribute, b7 as OtelExportConfig, b8 as OtelExporter, b9 as OtelSpan, ba as buildLoopOtelSpans, bb as buildLoopSpanNodes, bc as createOtelExporter, bd as exportEvalRuns, be as loopEventToOtelSpan } from './coordination-rRj5hjJK.js';
|
|
15
18
|
import '@tangle-network/sandbox';
|
|
16
|
-
import './local-harness-sI0S_XNA.js';
|
|
17
19
|
import 'node:child_process';
|
|
20
|
+
import './worktree-fanout-BDFQIO-Y.js';
|
|
21
|
+
import './types-eMNgWgFi.js';
|
|
22
|
+
import './completion-gate-DkAnUmpb.js';
|
|
23
|
+
import '@tangle-network/agent-knowledge';
|
|
24
|
+
import './supervise-DPmYPk0j.js';
|
|
25
|
+
import './router-client-DJImUDlm.js';
|
|
18
26
|
import './kb-gate-CwHO0vz6.js';
|
|
19
|
-
import './
|
|
20
|
-
import './
|
|
21
|
-
import '
|
|
27
|
+
import './substrate-DO2GHNg2.js';
|
|
28
|
+
import './environment-provider.js';
|
|
29
|
+
import '@tangle-network/agent-interface/environment-provider';
|
|
22
30
|
|
|
23
31
|
/**
|
|
24
32
|
*
|
|
@@ -1175,6 +1183,11 @@ declare function mcpBuildPrompt(args: FindingsArg): string;
|
|
|
1175
1183
|
*
|
|
1176
1184
|
* - `surface: 'prompt'` → `gepaProposer` mutates `profile.prompt.systemPrompt`.
|
|
1177
1185
|
* - `surface: 'skills'` → `skillOptProposer` mutates a skills document string.
|
|
1186
|
+
* - `surface: 'rollout-policy'` → `rolloutPolicyProposer` mutates the
|
|
1187
|
+
* inference-time `StructuralRolloutPolicy` dials ({ k, repairRounds, testgen })
|
|
1188
|
+
* persisted in `profile.extensions['structural-rollout']` — deterministic
|
|
1189
|
+
* bounded neighbor enumeration; the held-out gate does the deciding. No-op
|
|
1190
|
+
* (nothing proposed, nothing shipped) when the profile has no such extension.
|
|
1178
1191
|
* - `surface` ∈ {`tools`, `mcp`, `hooks`, `code`} → no zero-config default
|
|
1179
1192
|
* proposer exists (a code/config proposer needs caller-supplied wiring — a
|
|
1180
1193
|
* worktree repo root, a candidate generator, a serializer). The facade
|
|
@@ -1189,8 +1202,10 @@ declare function mcpBuildPrompt(args: FindingsArg): string;
|
|
|
1189
1202
|
*/
|
|
1190
1203
|
|
|
1191
1204
|
/** The agent-profile lever `improve` optimizes. Mirrors the AgentProfile-law
|
|
1192
|
-
* profile levers; `code` is the implementation-tier surface
|
|
1193
|
-
|
|
1205
|
+
* profile levers; `code` is the implementation-tier surface, `rollout-policy`
|
|
1206
|
+
* the inference-time structuralRollout dials
|
|
1207
|
+
* (`profile.extensions['structural-rollout']`). */
|
|
1208
|
+
type ImproveSurface = 'prompt' | 'skills' | 'tools' | 'mcp' | 'hooks' | 'code' | 'rollout-policy';
|
|
1194
1209
|
interface ImproveOptions<TScenario extends Scenario$1, TArtifact> {
|
|
1195
1210
|
/** Which profile lever to optimize. Default `'prompt'`. Selects the default
|
|
1196
1211
|
* generator + the baseline-surface extraction shape. */
|
|
@@ -1218,6 +1233,73 @@ interface ImproveOptions<TScenario extends Scenario$1, TArtifact> {
|
|
|
1218
1233
|
* (`llm.model`, or the default when unset) must be a member, or `improve()` throws
|
|
1219
1234
|
* a `ConfigError` before the generator is built. Unset = unrestricted. */
|
|
1220
1235
|
allowedModels?: readonly string[];
|
|
1236
|
+
/** Run directory passthrough to `selfImprove`. Pass a REAL path to make the loop
|
|
1237
|
+
* durable: campaign cells + the loop provenance record land on the filesystem as
|
|
1238
|
+
* they complete, so a multi-hour search survives a process/infra death instead of
|
|
1239
|
+
* losing every generation with it (the default `mem://` run keeps everything
|
|
1240
|
+
* in-process). */
|
|
1241
|
+
runDir?: string;
|
|
1242
|
+
/** Per-generation findings producer passthrough (see selfImprove.analyzeGeneration).
|
|
1243
|
+
* DEFAULT: the built-in failure distiller — after each generation it turns the
|
|
1244
|
+
* worst-scoring/errored cells into structured findings ({ scenario, composite,
|
|
1245
|
+
* notes, error }) for the NEXT proposal round, so the proposer reasons over what
|
|
1246
|
+
* actually failed instead of a static seed. Pass your own producer (e.g. a
|
|
1247
|
+
* trace-analyst over the runDir's traces) to replace it; pass `null` to disable
|
|
1248
|
+
* and keep the static `findings` all the way through. */
|
|
1249
|
+
analyzeGeneration?: SelfImproveOptions<TScenario, TArtifact>['analyzeGeneration'] | null;
|
|
1250
|
+
/** META-HARNESS mode: instead of the ~400-char distilled findings, feed the
|
|
1251
|
+
* proposer RAW-TRACE FILESYSTEM CONTEXT — the PATHS into the prior generation's
|
|
1252
|
+
* real run traces under `runDir` (per-cell `spans.jsonl` event logs +
|
|
1253
|
+
* `cached-result.json` scores + artifacts) plus a `grep`/`cat`-to-diagnose
|
|
1254
|
+
* instruction — so the coding agent reads the actual failures itself rather than
|
|
1255
|
+
* a pre-summary. Requires a REAL `runDir` (that is where the traces live).
|
|
1256
|
+
* Ignored when `analyzeGeneration` is set explicitly (that wins) or is `null`
|
|
1257
|
+
* (disabled). Equivalent to `analyzeGeneration: rawTraceDistiller()`; this flag
|
|
1258
|
+
* is the one-line enable. Default `false` (the distiller stays the default). */
|
|
1259
|
+
rawTraceContext?: boolean;
|
|
1260
|
+
/** CODE-surface wiring with prompt-parity DX: name `surface: 'code'`, point at a
|
|
1261
|
+
* repo, and the facade assembles the whole candidate pipeline — git worktrees
|
|
1262
|
+
* (`gitWorktreeAdapter`) driven by `improvementDriver` with the full agentic
|
|
1263
|
+
* generator (a real coding harness edits each candidate worktree; a `verify`
|
|
1264
|
+
* hook gates candidates before they are ever measured). Ignored when
|
|
1265
|
+
* `opts.generator` is supplied. Without either, `surface: 'code'` still fails
|
|
1266
|
+
* loud — there is no safe zero-config repo to invent. */
|
|
1267
|
+
code?: ImproveCodeOptions;
|
|
1268
|
+
/** SKILLS-surface wiring for real skill-DOCUMENT optimization. Without this,
|
|
1269
|
+
* `surface: 'skills'` optimizes the profile's skills REFS array (file pointers)
|
|
1270
|
+
* — which `skillOptProposer` (a document patcher) cannot meaningfully edit.
|
|
1271
|
+
* Provide the document CONTENT to optimize + a `writeBack` to persist the
|
|
1272
|
+
* shipped winner (the profile ref points at a file the caller owns). This is
|
|
1273
|
+
* what makes skillOpt reachable through improve(). */
|
|
1274
|
+
skills?: ImproveSkillsOptions;
|
|
1275
|
+
/** Storage passthrough to `selfImprove`; overrides the default chosen from `runDir`. */
|
|
1276
|
+
storage?: SelfImproveOptions<TScenario, TArtifact>['storage'];
|
|
1277
|
+
}
|
|
1278
|
+
interface ImproveSkillsOptions {
|
|
1279
|
+
/** The skill document's current text — the baseline `skillOptProposer` patches. */
|
|
1280
|
+
document: string;
|
|
1281
|
+
/** Persist the shipped winner document (write the file the profile ref points at).
|
|
1282
|
+
* Called only on a ship verdict. When omitted, the winner is still returned in
|
|
1283
|
+
* `result.raw.winner.surface` for the caller to materialize. */
|
|
1284
|
+
writeBack?: (winnerDocument: string) => void;
|
|
1285
|
+
}
|
|
1286
|
+
interface ImproveCodeOptions {
|
|
1287
|
+
/** Repo root candidate worktrees fork from. */
|
|
1288
|
+
repoRoot: string;
|
|
1289
|
+
/** Base ref candidates fork from. Default `main`. */
|
|
1290
|
+
baseRef?: string;
|
|
1291
|
+
/** Directory worktrees are created under. Default `<repoRoot>/.worktrees`. */
|
|
1292
|
+
worktreeDir?: string;
|
|
1293
|
+
/** Coding harness the agentic generator runs in each worktree. Default `claude`. */
|
|
1294
|
+
harness?: LocalHarness;
|
|
1295
|
+
/** Verify a candidate worktree before it becomes a measurable surface; failures
|
|
1296
|
+
* feed the next shot (see `agenticGenerator.verify` / `commandVerifier`). */
|
|
1297
|
+
verify?: Verifier;
|
|
1298
|
+
/** Per-shot wall-clock timeout for the harness (ms). */
|
|
1299
|
+
timeoutMs?: number;
|
|
1300
|
+
/** Byte-producer override — the test seam and the escape hatch for custom
|
|
1301
|
+
* candidate production. When set, `harness`/`verify`/`timeoutMs` are unused. */
|
|
1302
|
+
generator?: CandidateGenerator;
|
|
1221
1303
|
}
|
|
1222
1304
|
interface ImproveResult<TScenario extends Scenario$1, TArtifact> {
|
|
1223
1305
|
/** The profile after improvement: the winner surface applied back into the
|
|
@@ -1247,6 +1329,75 @@ interface ImproveResult<TScenario extends Scenario$1, TArtifact> {
|
|
|
1247
1329
|
*/
|
|
1248
1330
|
declare function improve<TScenario extends Scenario$1, TArtifact>(profile: AgentProfile$1, findings: unknown[], opts: ImproveOptions<TScenario, TArtifact>): Promise<ImproveResult<TScenario, TArtifact>>;
|
|
1249
1331
|
|
|
1332
|
+
/**
|
|
1333
|
+
*
|
|
1334
|
+
* `rawTraceDistiller` — the meta-harness `analyzeGeneration` producer.
|
|
1335
|
+
*
|
|
1336
|
+
* The default `generationFailureDistiller` (in `improve.ts`) COMPRESSES each
|
|
1337
|
+
* generation's failing cells into ~400-char structured findings before the next
|
|
1338
|
+
* proposal round. That is the ACE-style recipe: a small summary is the proposer's
|
|
1339
|
+
* whole view of what went wrong. This producer does the opposite — the
|
|
1340
|
+
* meta-harness recipe (yoonholee.com/meta-harness): it does NOT summarize. It
|
|
1341
|
+
* points the coding-agent proposer at the generation's RAW run traces already on
|
|
1342
|
+
* disk under `runDir` — the durable per-cell `spans.jsonl` event logs,
|
|
1343
|
+
* `cached-result.json` scores, and any artifacts the substrate persisted — and
|
|
1344
|
+
* instructs the agent to `grep`/`cat`/`ls` them to diagnose the failures itself
|
|
1345
|
+
* (up to the harness's full context, ~millions of tokens, vs a ~400-char digest).
|
|
1346
|
+
*
|
|
1347
|
+
* It emits `AnalystFinding[]` so it drops into the SAME `opts.analyzeGeneration`
|
|
1348
|
+
* slot the default distiller uses, and renders through the same
|
|
1349
|
+
* `agenticGenerator` prompt path (`claim` + `recommended_action`). The findings
|
|
1350
|
+
* carry ABSOLUTE paths — the coding harness runs with `cwd` = a candidate
|
|
1351
|
+
* worktree, so a relative `runDir` would be uncattable from there.
|
|
1352
|
+
*
|
|
1353
|
+
* Runtime layout it reads (written by agent-eval's optimization loop):
|
|
1354
|
+
*
|
|
1355
|
+
* <runDir>/gen-<N>/ ← the generation dir (input.runDir)
|
|
1356
|
+
* candidate-<i>/ ← one candidate campaign (campaign.runDir)
|
|
1357
|
+
* <sanitized cellId>/ ← one scenario×rep cell
|
|
1358
|
+
* spans.jsonl ← the raw trace (event/span log)
|
|
1359
|
+
* cached-result.json ← the cell's score + artifact ref
|
|
1360
|
+
* <artifacts…> ← whatever the dispatch wrote
|
|
1361
|
+
*
|
|
1362
|
+
* @experimental
|
|
1363
|
+
*/
|
|
1364
|
+
|
|
1365
|
+
interface RawTraceDistillerOptions {
|
|
1366
|
+
/** Anchor the emitted paths at this run root instead of the generation `runDir`
|
|
1367
|
+
* the loop passes in. Normally unset — each call points at that generation's
|
|
1368
|
+
* own directory (`input.runDir`). Pass an absolute path when you construct the
|
|
1369
|
+
* producer ahead of the loop and want a fixed anchor (e.g. a test fixture). */
|
|
1370
|
+
runDir?: string;
|
|
1371
|
+
/** Max candidates to surface trace paths for, worst-scoring first. Default 12. */
|
|
1372
|
+
maxCandidates?: number;
|
|
1373
|
+
/** Max failing cells to enumerate per candidate before collapsing the rest into
|
|
1374
|
+
* an "ls the candidate dir" pointer. Default 8. */
|
|
1375
|
+
maxCellsPerCandidate?: number;
|
|
1376
|
+
/** Max concrete file paths to list per cell (the agent can always `ls` the dir
|
|
1377
|
+
* for the rest). Default 24. */
|
|
1378
|
+
maxFilesPerCell?: number;
|
|
1379
|
+
/** Findings to fall back to when the generation had NO failing cells, so a
|
|
1380
|
+
* clean round never wipes the proposer's steering context. Mirrors the default
|
|
1381
|
+
* distiller's static-seed fallback. Default: a single instruction finding. */
|
|
1382
|
+
fallbackFindings?: unknown[];
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* Build an `analyzeGeneration` producer that feeds the proposer RAW-TRACE
|
|
1386
|
+
* FILESYSTEM CONTEXT — paths into the prior generation's real run traces plus a
|
|
1387
|
+
* grep/cat-to-diagnose instruction — instead of a pre-summarized digest.
|
|
1388
|
+
*
|
|
1389
|
+
* Drop-in for `opts.analyzeGeneration` on `improve()` / `selfImprove()`:
|
|
1390
|
+
*
|
|
1391
|
+
* await improve(profile, seedFindings, {
|
|
1392
|
+
* surface: 'code',
|
|
1393
|
+
* code: { repoRoot },
|
|
1394
|
+
* runDir: '/abs/run', // MUST be a real path — the traces live here
|
|
1395
|
+
* analyzeGeneration: rawTraceDistiller(),
|
|
1396
|
+
* scenarios, judge, agent,
|
|
1397
|
+
* })
|
|
1398
|
+
*/
|
|
1399
|
+
declare function rawTraceDistiller<TScenario extends Scenario$1 = Scenario$1, TArtifact = unknown>(options?: RawTraceDistillerOptions): NonNullable<SelfImproveOptions<TScenario, TArtifact>['analyzeGeneration']>;
|
|
1400
|
+
|
|
1250
1401
|
/**
|
|
1251
1402
|
*
|
|
1252
1403
|
* `reflectiveGenerator` — the cheap, no-sandbox `CandidateGenerator`. It drafts
|
|
@@ -1268,6 +1419,94 @@ interface ReflectiveGeneratorOptions {
|
|
|
1268
1419
|
/** Cheap no-sandbox `CandidateGenerator` (the `shots=1` setting): draft surface edits via the improvement adapter and apply them as one coherent candidate. */
|
|
1269
1420
|
declare function reflectiveGenerator(opts: ReflectiveGeneratorOptions): CandidateGenerator;
|
|
1270
1421
|
|
|
1422
|
+
/**
|
|
1423
|
+
* `rolloutPolicyProposer` — the `'rollout-policy'` surface for `improve()`: the
|
|
1424
|
+
* inference-time `StructuralRolloutPolicy` dials { k, repairRounds, testgen } as a
|
|
1425
|
+
* held-out-gated optimizable surface.
|
|
1426
|
+
*
|
|
1427
|
+
* Why this seam: agent-eval's loop contract is already generic — `MutableSurface`
|
|
1428
|
+
* admits any string, documented as "serialized tool config" — so the policy rides
|
|
1429
|
+
* the SAME serialize→propose→gate→parse-back cycle the tools/mcp/hooks surfaces
|
|
1430
|
+
* use. No agent-eval changes; the only net-new piece is this proposer.
|
|
1431
|
+
*
|
|
1432
|
+
* Why deterministic: prompt-wording proposals are a measured zero on this stack,
|
|
1433
|
+
* and the policy space is tiny and fully enumerable. The proposer emits bounded
|
|
1434
|
+
* single-dial neighbors (k±2 in [1,10], repairRounds±1 in [0,3], testgen±3 in
|
|
1435
|
+
* [0,10], ≤4 per generation) and lets the held-out gate do ALL the deciding — an
|
|
1436
|
+
* LLM proposer would add cost and nondeterminism with nothing to reason about.
|
|
1437
|
+
*
|
|
1438
|
+
* Persistence: the policy lives in `profile.extensions['structural-rollout']`
|
|
1439
|
+
* (AgentProfile's designed slot for runtime-specific config). A gated winner is
|
|
1440
|
+
* written back there by `improve()`, the same profile-field write-back every other
|
|
1441
|
+
* config surface gets; `structuralRolloutPolicyFromProfile` is the read side a
|
|
1442
|
+
* runtime caller feeds to `structuralRollout({ policy })`.
|
|
1443
|
+
*
|
|
1444
|
+
* @experimental
|
|
1445
|
+
*/
|
|
1446
|
+
|
|
1447
|
+
/** The profile extensions namespace the policy persists under. */
|
|
1448
|
+
declare const ROLLOUT_POLICY_EXTENSION = "structural-rollout";
|
|
1449
|
+
/** Proposal bounds per dial. These are the SEARCH bounds (what the proposer may
|
|
1450
|
+
* explore), chosen so every reachable value is a measured-sane recipe: k=1 is the
|
|
1451
|
+
* low-compute preset, testgen=0 disables check authoring, repairRounds caps where
|
|
1452
|
+
* the measured increment flattens (+1–3pp beyond round 2). */
|
|
1453
|
+
declare const ROLLOUT_POLICY_BOUNDS: {
|
|
1454
|
+
readonly k: {
|
|
1455
|
+
readonly min: 1;
|
|
1456
|
+
readonly max: 10;
|
|
1457
|
+
readonly step: 2;
|
|
1458
|
+
};
|
|
1459
|
+
readonly repairRounds: {
|
|
1460
|
+
readonly min: 0;
|
|
1461
|
+
readonly max: 3;
|
|
1462
|
+
readonly step: 1;
|
|
1463
|
+
};
|
|
1464
|
+
readonly testgen: {
|
|
1465
|
+
readonly min: 0;
|
|
1466
|
+
readonly max: 10;
|
|
1467
|
+
readonly step: 3;
|
|
1468
|
+
};
|
|
1469
|
+
};
|
|
1470
|
+
/** Parse a serialized policy surface. Defensive by design — the proposer reads
|
|
1471
|
+
* `ctx.currentSurface`, which the loop types as `string | CodeSurface`. Returns
|
|
1472
|
+
* `undefined` (never throws) for non-strings, malformed JSON, or a shape that
|
|
1473
|
+
* violates the policy's own invariants: the no-op signal. Unknown dials are
|
|
1474
|
+
* dropped; `diverse`/`temperature` ride through untouched (the proposer never
|
|
1475
|
+
* mutates them — `diverse` is a measured paired null). */
|
|
1476
|
+
declare function parseRolloutPolicy(surface: MutableSurface$1): StructuralRolloutPolicy | undefined;
|
|
1477
|
+
/** Normalize an untyped policy bag (a parsed surface or a profile extension) into
|
|
1478
|
+
* a full `StructuralRolloutPolicy`, defaults merged. Returns `undefined` when any
|
|
1479
|
+
* present dial violates the policy invariants (mirrors `resolvePolicy`: integer
|
|
1480
|
+
* k ≥ 1, repairRounds ≥ 0, testgen ≥ 0) — a corrupt config must read as "not
|
|
1481
|
+
* configured", never as a fabricated recipe. */
|
|
1482
|
+
declare function normalizeRolloutPolicy(raw: unknown): StructuralRolloutPolicy | undefined;
|
|
1483
|
+
/** Stable serialization — dial order is fixed so identical policies produce
|
|
1484
|
+
* identical surfaces (the loop dedupes/hashes candidates by surface content). */
|
|
1485
|
+
declare function serializeRolloutPolicy(policy: StructuralRolloutPolicy): string;
|
|
1486
|
+
/** Read the persisted policy off the profile. `undefined` when the profile does
|
|
1487
|
+
* not opt into structural rollout — the improve() surface no-ops then, because
|
|
1488
|
+
* tuning dials nothing consumes would ship dead config. */
|
|
1489
|
+
declare function structuralRolloutPolicyFromProfile(profile: AgentProfile$1): StructuralRolloutPolicy | undefined;
|
|
1490
|
+
/** Persist a policy into the profile's extensions namespace. Shallow copy; never
|
|
1491
|
+
* mutates the input profile (the applyWinnerToProfile contract). */
|
|
1492
|
+
declare function applyRolloutPolicyToProfile(profile: AgentProfile$1, policy: StructuralRolloutPolicy): AgentProfile$1;
|
|
1493
|
+
/** All bounded single-dial neighbors of `policy`, in a fixed priority order: k
|
|
1494
|
+
* first (selection breadth carries 85–92% of the measured effect), then
|
|
1495
|
+
* repairRounds, then testgen. Steps clamp to the dial's bounds; clamped-to-no-op
|
|
1496
|
+
* and duplicate policies are dropped. */
|
|
1497
|
+
declare function enumerateNeighborPolicies(policy: StructuralRolloutPolicy): StructuralRolloutPolicy[];
|
|
1498
|
+
/**
|
|
1499
|
+
* The deterministic `SurfaceProposer` for the `'rollout-policy'` surface.
|
|
1500
|
+
*
|
|
1501
|
+
* Each generation: parse the current policy surface, enumerate its bounded
|
|
1502
|
+
* single-dial neighbors, and return at most `min(populationSize, 4)` of them,
|
|
1503
|
+
* rotating the enumeration window by generation so successive generations explore
|
|
1504
|
+
* different neighbors when nothing promoted. Proposes NOTHING when the surface
|
|
1505
|
+
* carries no policy (the profile never opted in) — an empty proposal is the
|
|
1506
|
+
* loop-native no-op, mirroring `improvementDriver`'s no-findings behavior.
|
|
1507
|
+
*/
|
|
1508
|
+
declare function rolloutPolicyProposer(): SurfaceProposer$1;
|
|
1509
|
+
|
|
1271
1510
|
/**
|
|
1272
1511
|
*
|
|
1273
1512
|
* Chat-model resolution + catalog validation — the shared primitive every
|
|
@@ -1802,4 +2041,4 @@ interface StreamToolLoopOptions<Raw> {
|
|
|
1802
2041
|
* `capped` if it stops for any non-completed reason with calls still pending. */
|
|
1803
2042
|
declare function streamToolLoop<Raw>(opts: StreamToolLoopOptions<Raw>): AsyncGenerator<StreamToolLoopYield<Raw>, void, unknown>;
|
|
1804
2043
|
|
|
1805
|
-
export { AgentBackendContext, AgentBackendInput, type AgentBackendKind, AgentExecutionBackend, AgentRuntimeEvent, AgentTaskRunResult, AgentTaskStatus, type AuthSource, type BackendCallPolicy, BackendTransportError, CandidateGenerator, type ChatStreamEvent, type ChatTurnHooks, type ChatTurnIdentity, type ChatTurnProducer, type ChatTurnResult, type CircuitBreakerConfig, CircuitBreakerState, CircuitOpenError, type Conversation, type ConversationDriveState, type ConversationJournal, type ConversationJournalEntry, type ConversationParticipant, type ConversationPolicy, type ConversationResult, type ConversationStreamEvent, type ConversationTurn, type D1DatabaseLike, type D1StmtLike, DEFAULT_MAX_DEPTH, DEFAULT_ROUTER_BASE_URL, DeadlineExceededError, FORWARD_HEADERS, FileConversationJournal, type ForwardHeaderName, type HaltContext, type HaltPredicate, type HaltReason, type HaltSignal, type ImproveOptions, type ImproveResult, type ImproveSurface, InMemoryConversationJournal, InMemoryRuntimeSessionStore, type ModelInfo, OpenAIChatResponseFormat, OpenAIChatTool, OpenAIChatToolChoice, type PersonaConversationResult, type PersonaDriver, PlannerError, type PropagatedHeaders, type ReflectiveGeneratorOptions, type ResolveAgentBackendOptions, type ResolvedChatModel, type RetryBackoff, type RetryableErrorPredicate, type RouterEnv, type RunChatTurnInput, type RunConversationOptions, type RunPersonaConfig, type RunPersonaConversationOptions, type RunToolLoopOptions, type RuntimeEventCollector, RuntimeHooks, RuntimeRunStateError, RuntimeSessionStore, RuntimeStreamEvent, type RuntimeStreamEventCollector, type RuntimeTelemetryOptions, type SanitizedKnowledgeReadinessReport, type SqlAdapter, SqlConversationJournal, type StreamToolLoopOptions, type StreamToolLoopYield, type ToolCallOutcome, type ToolLoopAssistantToolCall, type ToolLoopCall, type ToolLoopEvent, type ToolLoopMessage, type ToolLoopResult, type ToolLoopStopReason, type TurnOrder, applyRunRecordDefaults, buildForwardHeaders, cleanModelId, computeBackoff, createConversationBackend, createIterableBackend, createOpenAICompatibleBackend, createRuntimeEventCollector, createRuntimeStreamEventCollector, createSandboxPromptBackend, d1ToSqlAdapter, decideKnowledgeReadiness, defaultIsRetryable, defineConversation, deriveExecutionId, getModels, handleChatTurn, improve, isDepthExceeded, makePerAttemptSignal, mcpBuildPrompt, readDepth, readinessServerSentEvent, reflectiveGenerator, resolveAgentBackend, resolveChatModel, resolveRouterBaseUrl, runAgentTask, runAgentTaskStream, runConversation, runConversationStream, runPersonaConversation, runPersonaDispatch, runToolLoop, runtimeStreamServerSentEvent, sanitizeAgentRuntimeEvent, sanitizeKnowledgeReadinessReport, sanitizeRuntimeStreamEvent, sleep, slugifySpeaker, streamToolLoop, toolBuildPrompt, turnId, validateChatModelId };
|
|
2044
|
+
export { AgentBackendContext, AgentBackendInput, type AgentBackendKind, AgentExecutionBackend, AgentRuntimeEvent, AgentTaskRunResult, AgentTaskStatus, type AuthSource, type BackendCallPolicy, BackendTransportError, CandidateGenerator, type ChatStreamEvent, type ChatTurnHooks, type ChatTurnIdentity, type ChatTurnProducer, type ChatTurnResult, type CircuitBreakerConfig, CircuitBreakerState, CircuitOpenError, type Conversation, type ConversationDriveState, type ConversationJournal, type ConversationJournalEntry, type ConversationParticipant, type ConversationPolicy, type ConversationResult, type ConversationStreamEvent, type ConversationTurn, type D1DatabaseLike, type D1StmtLike, DEFAULT_MAX_DEPTH, DEFAULT_ROUTER_BASE_URL, DeadlineExceededError, FORWARD_HEADERS, FileConversationJournal, type ForwardHeaderName, type HaltContext, type HaltPredicate, type HaltReason, type HaltSignal, type ImproveOptions, type ImproveResult, type ImproveSurface, InMemoryConversationJournal, InMemoryRuntimeSessionStore, type ModelInfo, OpenAIChatResponseFormat, OpenAIChatTool, OpenAIChatToolChoice, type PersonaConversationResult, type PersonaDriver, PlannerError, type PropagatedHeaders, ROLLOUT_POLICY_BOUNDS, ROLLOUT_POLICY_EXTENSION, type RawTraceDistillerOptions, type ReflectiveGeneratorOptions, type ResolveAgentBackendOptions, type ResolvedChatModel, type RetryBackoff, type RetryableErrorPredicate, type RouterEnv, type RunChatTurnInput, type RunConversationOptions, type RunPersonaConfig, type RunPersonaConversationOptions, type RunToolLoopOptions, type RuntimeEventCollector, RuntimeHooks, RuntimeRunStateError, RuntimeSessionStore, RuntimeStreamEvent, type RuntimeStreamEventCollector, type RuntimeTelemetryOptions, type SanitizedKnowledgeReadinessReport, type SqlAdapter, SqlConversationJournal, type StreamToolLoopOptions, type StreamToolLoopYield, type ToolCallOutcome, type ToolLoopAssistantToolCall, type ToolLoopCall, type ToolLoopEvent, type ToolLoopMessage, type ToolLoopResult, type ToolLoopStopReason, type TurnOrder, Verifier, applyRolloutPolicyToProfile, applyRunRecordDefaults, buildForwardHeaders, cleanModelId, computeBackoff, createConversationBackend, createIterableBackend, createOpenAICompatibleBackend, createRuntimeEventCollector, createRuntimeStreamEventCollector, createSandboxPromptBackend, d1ToSqlAdapter, decideKnowledgeReadiness, defaultIsRetryable, defineConversation, deriveExecutionId, enumerateNeighborPolicies, getModels, handleChatTurn, improve, isDepthExceeded, makePerAttemptSignal, mcpBuildPrompt, normalizeRolloutPolicy, parseRolloutPolicy, rawTraceDistiller, readDepth, readinessServerSentEvent, reflectiveGenerator, resolveAgentBackend, resolveChatModel, resolveRouterBaseUrl, rolloutPolicyProposer, runAgentTask, runAgentTaskStream, runConversation, runConversationStream, runPersonaConversation, runPersonaDispatch, runToolLoop, runtimeStreamServerSentEvent, sanitizeAgentRuntimeEvent, sanitizeKnowledgeReadinessReport, sanitizeRuntimeStreamEvent, serializeRolloutPolicy, sleep, slugifySpeaker, streamToolLoop, structuralRolloutPolicyFromProfile, toolBuildPrompt, turnId, validateChatModelId };
|