@tangle-network/agent-runtime 0.89.0 → 0.90.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +51 -18
  2. package/dist/agent.d.ts +53 -2
  3. package/dist/agent.js +166 -4
  4. package/dist/agent.js.map +1 -1
  5. package/dist/analyst-loop.d.ts +1 -1
  6. package/dist/{chunk-PIPPLSOF.js → chunk-4IBAMGBE.js} +33 -3
  7. package/dist/chunk-4IBAMGBE.js.map +1 -0
  8. package/dist/chunk-5QOB7H74.js +387 -0
  9. package/dist/chunk-5QOB7H74.js.map +1 -0
  10. package/dist/chunk-74SBMDTO.js +214 -0
  11. package/dist/chunk-74SBMDTO.js.map +1 -0
  12. package/dist/{chunk-BQPFZE2C.js → chunk-MHK62APK.js} +5 -5
  13. package/dist/{chunk-N7EJV7N3.js → chunk-QSNSMJSZ.js} +3417 -3393
  14. package/dist/chunk-QSNSMJSZ.js.map +1 -0
  15. package/dist/{chunk-VNOOH22O.js → chunk-XMOU4WEY.js} +74 -3
  16. package/dist/chunk-XMOU4WEY.js.map +1 -0
  17. package/dist/{chunk-5AVV7KAH.js → chunk-XQEISTK2.js} +2 -2
  18. package/dist/{worktree-harness-CX_McRLp.d.ts → completion-gate-BDaBP8dd.d.ts} +44 -44
  19. package/dist/{coordination-CuDLO8wj.d.ts → coordination-DxHduZg7.d.ts} +414 -226
  20. package/dist/environment-provider.d.ts +3 -3
  21. package/dist/index.d.ts +156 -13
  22. package/dist/index.js +316 -70
  23. package/dist/index.js.map +1 -1
  24. package/dist/intelligence.d.ts +2 -2
  25. package/dist/knowledge.d.ts +120 -0
  26. package/dist/knowledge.js +28 -0
  27. package/dist/knowledge.js.map +1 -0
  28. package/dist/lifecycle.js +1 -1
  29. package/dist/{loop-runner-bin-hQDUL8Ld.d.ts → loop-runner-bin-D3GmB2Ru.d.ts} +2 -2
  30. package/dist/loop-runner-bin.d.ts +5 -5
  31. package/dist/loop-runner-bin.js +5 -5
  32. package/dist/loops.d.ts +46 -141
  33. package/dist/loops.js +3 -3
  34. package/dist/mcp/bin.js +2 -2
  35. package/dist/mcp/index.d.ts +8 -9
  36. package/dist/mcp/index.js +7 -7
  37. package/dist/{openai-tools-BnrOmGjN.d.ts → openai-tools-D0xmzo0y.d.ts} +1 -1
  38. package/dist/profiles.d.ts +196 -5
  39. package/dist/profiles.js +8 -0
  40. package/dist/profiles.js.map +1 -1
  41. package/dist/{router-client-r8y_VFVM.d.ts → router-client-DJImUDlm.d.ts} +1 -1
  42. package/dist/supervise-BpCdssu0.d.ts +131 -0
  43. package/dist/{types-Driepl87.d.ts → types-DAJQRIUD.d.ts} +2 -2
  44. package/dist/{types-ESeMOj94.d.ts → types-Dnk189QA.d.ts} +1 -1
  45. package/dist/{worktree-fanout-D6xR2CIA.d.ts → worktree-fanout-CfRXYmgV.d.ts} +3 -3
  46. package/package.json +12 -4
  47. package/skills/agent-runtime-adoption/SKILL.md +74 -24
  48. package/skills/build-with-agent-runtime/SKILL.md +3 -3
  49. package/skills/loop-writer/SKILL.md +6 -5
  50. package/skills/supervise/SKILL.md +2 -2
  51. package/dist/chunk-N7EJV7N3.js.map +0 -1
  52. package/dist/chunk-PIPPLSOF.js.map +0 -1
  53. package/dist/chunk-VNOOH22O.js.map +0 -1
  54. package/dist/otel-export-BKmNwiCb.d.ts +0 -180
  55. /package/dist/{chunk-BQPFZE2C.js.map → chunk-MHK62APK.js.map} +0 -0
  56. /package/dist/{chunk-5AVV7KAH.js.map → chunk-XQEISTK2.js.map} +0 -0
@@ -1,9 +1,9 @@
1
1
  import { AgentProfile, AgentProfileValidationResult } from '@tangle-network/agent-interface';
2
- import { AgentEnvironmentProvider, AgentEnvironmentCapabilities, CreateAgentEnvironmentInput, AgentTurnInput, AgentProfileRef } from '@tangle-network/agent-interface/environment-provider';
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-Driepl87.js';
6
- import { S as SandboxClient } from './types-ESeMOj94.js';
5
+ import { R as Runtime, E as ExecutorFactory } from './types-DAJQRIUD.js';
6
+ import { S as SandboxClient } from './types-Dnk189QA.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,31 @@
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 { f as AgentBackendInput, O as OpenAIChatTool, g as OpenAIChatToolChoice, h as OpenAIChatResponseFormat, i as AgentExecutionBackend, j as AgentBackendContext, a as RuntimeStreamEvent, K as KnowledgeReadinessDecision, k as RunAgentTaskOptions, l as AgentTaskRunResult, m as RunAgentTaskStreamOptions, n as AgentRuntimeEvent, o as AgentTaskStatus, p as RuntimeSessionStore, q as RuntimeSession, R as RuntimeHooks } from './types-ESeMOj94.js';
4
- export { r as AgentAdapter, s as AgentKnowledgeProvider, t as AgentRuntimeEventSink, u as AgentTaskContext, v as AgentTaskSpec, B as BackendErrorDetail, w as RuntimeDecisionEvidenceRef, x as RuntimeDecisionKind, y as RuntimeDecisionPoint, z as RuntimeHookContext, C as RuntimeHookErrorContext, D as RuntimeHookEvent, F as RuntimeHookPhase, G as RuntimeHookTarget, H as RuntimeRunHandle, J as RuntimeRunPersistenceAdapter, M as RuntimeRunRow, N as composeRuntimeHooks, P as defineRuntimeHooks, Q as notifyRuntimeDecisionPoint, T as notifyRuntimeHookEvent, U as startRuntimeRun } from './types-ESeMOj94.js';
3
+ import { f as AgentBackendInput, O as OpenAIChatTool, g as OpenAIChatToolChoice, h as OpenAIChatResponseFormat, i as AgentExecutionBackend, j as AgentBackendContext, a as RuntimeStreamEvent, K as KnowledgeReadinessDecision, k as RunAgentTaskOptions, l as AgentTaskRunResult, m as RunAgentTaskStreamOptions, n as AgentRuntimeEvent, o as AgentTaskStatus, p as RuntimeSessionStore, q as RuntimeSession, R as RuntimeHooks } from './types-Dnk189QA.js';
4
+ export { r as AgentAdapter, s as AgentKnowledgeProvider, t as AgentRuntimeEventSink, u as AgentTaskContext, v as AgentTaskSpec, B as BackendErrorDetail, w as RuntimeDecisionEvidenceRef, x as RuntimeDecisionKind, y as RuntimeDecisionPoint, z as RuntimeHookContext, C as RuntimeHookErrorContext, F as RuntimeHookEvent, G as RuntimeHookPhase, H as RuntimeHookTarget, J as RuntimeRunHandle, M as RuntimeRunPersistenceAdapter, N as RuntimeRunRow, P as composeRuntimeHooks, Q as defineRuntimeHooks, T as notifyRuntimeDecisionPoint, U as notifyRuntimeHookEvent, W as startRuntimeRun } from './types-Dnk189QA.js';
5
5
  import { Scenario, ProfileDispatchFn } from '@tangle-network/agent-eval/campaign';
6
- import { C as CandidateGenerator } from './mcp-serve-verifier-FL7-ZEb_.js';
7
- export { A as AgenticGeneratorOptions, I as ImprovementDriverOptions, M as McpServeSpec, V as Verifier, a as VerifyResult, b as agenticGenerator, c as commandVerifier, i as improvementDriver, m as mcpServeVerifier } from './mcp-serve-verifier-FL7-ZEb_.js';
8
- import { Scenario as Scenario$1, SurfaceProposer, JudgeConfig, MutableSurface, DispatchContext, SelfImproveBudget, SelfImproveLlm, SelfImproveResult } from '@tangle-network/agent-eval/contract';
6
+ import { V as Verifier, C as CandidateGenerator } from './mcp-serve-verifier-FL7-ZEb_.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-FL7-ZEb_.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-sI0S_XNA.js';
10
11
  import { S as SurfaceImprovementEdit } from './improvement-adapter-CDR8QNVM.js';
11
12
  import { I as ImprovementAdapter } from './types-BC3bZpH0.js';
12
- 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-hQDUL8Ld.js';
13
- export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from './openai-tools-BnrOmGjN.js';
14
- export { E as EvalRunEvent, a as EvalRunGeneration, b as EvalRunsExportConfig, c as EvalRunsExportResult, I as INTELLIGENCE_WIRE_VERSION, L as LoopSpanNode, d as OtelAttribute, e as OtelExportConfig, O as OtelExporter, f as OtelSpan, g as buildLoopOtelSpans, h as buildLoopSpanNodes, i as createOtelExporter, j as exportEvalRuns, l as loopEventToOtelSpan } from './otel-export-BKmNwiCb.js';
13
+ 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';
14
+ 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-D3GmB2Ru.js';
15
+ export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from './openai-tools-D0xmzo0y.js';
16
+ 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-DxHduZg7.js';
15
17
  import '@tangle-network/sandbox';
16
- import './local-harness-sI0S_XNA.js';
17
18
  import 'node:child_process';
19
+ import '@tangle-network/agent-knowledge';
20
+ import './supervise-BpCdssu0.js';
21
+ import './types-DAJQRIUD.js';
22
+ import './router-client-DJImUDlm.js';
23
+ import './completion-gate-BDaBP8dd.js';
18
24
  import './kb-gate-CwHO0vz6.js';
19
- import './types-Driepl87.js';
20
- import './worktree-fanout-D6xR2CIA.js';
21
- import './worktree-harness-CX_McRLp.js';
25
+ import './worktree-fanout-CfRXYmgV.js';
26
+ import './substrate-DO2GHNg2.js';
27
+ import './environment-provider.js';
28
+ import '@tangle-network/agent-interface/environment-provider';
22
29
 
23
30
  /**
24
31
  *
@@ -1218,6 +1225,73 @@ interface ImproveOptions<TScenario extends Scenario$1, TArtifact> {
1218
1225
  * (`llm.model`, or the default when unset) must be a member, or `improve()` throws
1219
1226
  * a `ConfigError` before the generator is built. Unset = unrestricted. */
1220
1227
  allowedModels?: readonly string[];
1228
+ /** Run directory passthrough to `selfImprove`. Pass a REAL path to make the loop
1229
+ * durable: campaign cells + the loop provenance record land on the filesystem as
1230
+ * they complete, so a multi-hour search survives a process/infra death instead of
1231
+ * losing every generation with it (the default `mem://` run keeps everything
1232
+ * in-process). */
1233
+ runDir?: string;
1234
+ /** Per-generation findings producer passthrough (see selfImprove.analyzeGeneration).
1235
+ * DEFAULT: the built-in failure distiller — after each generation it turns the
1236
+ * worst-scoring/errored cells into structured findings ({ scenario, composite,
1237
+ * notes, error }) for the NEXT proposal round, so the proposer reasons over what
1238
+ * actually failed instead of a static seed. Pass your own producer (e.g. a
1239
+ * trace-analyst over the runDir's traces) to replace it; pass `null` to disable
1240
+ * and keep the static `findings` all the way through. */
1241
+ analyzeGeneration?: SelfImproveOptions<TScenario, TArtifact>['analyzeGeneration'] | null;
1242
+ /** META-HARNESS mode: instead of the ~400-char distilled findings, feed the
1243
+ * proposer RAW-TRACE FILESYSTEM CONTEXT — the PATHS into the prior generation's
1244
+ * real run traces under `runDir` (per-cell `spans.jsonl` event logs +
1245
+ * `cached-result.json` scores + artifacts) plus a `grep`/`cat`-to-diagnose
1246
+ * instruction — so the coding agent reads the actual failures itself rather than
1247
+ * a pre-summary. Requires a REAL `runDir` (that is where the traces live).
1248
+ * Ignored when `analyzeGeneration` is set explicitly (that wins) or is `null`
1249
+ * (disabled). Equivalent to `analyzeGeneration: rawTraceDistiller()`; this flag
1250
+ * is the one-line enable. Default `false` (the distiller stays the default). */
1251
+ rawTraceContext?: boolean;
1252
+ /** CODE-surface wiring with prompt-parity DX: name `surface: 'code'`, point at a
1253
+ * repo, and the facade assembles the whole candidate pipeline — git worktrees
1254
+ * (`gitWorktreeAdapter`) driven by `improvementDriver` with the full agentic
1255
+ * generator (a real coding harness edits each candidate worktree; a `verify`
1256
+ * hook gates candidates before they are ever measured). Ignored when
1257
+ * `opts.generator` is supplied. Without either, `surface: 'code'` still fails
1258
+ * loud — there is no safe zero-config repo to invent. */
1259
+ code?: ImproveCodeOptions;
1260
+ /** SKILLS-surface wiring for real skill-DOCUMENT optimization. Without this,
1261
+ * `surface: 'skills'` optimizes the profile's skills REFS array (file pointers)
1262
+ * — which `skillOptProposer` (a document patcher) cannot meaningfully edit.
1263
+ * Provide the document CONTENT to optimize + a `writeBack` to persist the
1264
+ * shipped winner (the profile ref points at a file the caller owns). This is
1265
+ * what makes skillOpt reachable through improve(). */
1266
+ skills?: ImproveSkillsOptions;
1267
+ /** Storage passthrough to `selfImprove`; overrides the default chosen from `runDir`. */
1268
+ storage?: SelfImproveOptions<TScenario, TArtifact>['storage'];
1269
+ }
1270
+ interface ImproveSkillsOptions {
1271
+ /** The skill document's current text — the baseline `skillOptProposer` patches. */
1272
+ document: string;
1273
+ /** Persist the shipped winner document (write the file the profile ref points at).
1274
+ * Called only on a ship verdict. When omitted, the winner is still returned in
1275
+ * `result.raw.winner.surface` for the caller to materialize. */
1276
+ writeBack?: (winnerDocument: string) => void;
1277
+ }
1278
+ interface ImproveCodeOptions {
1279
+ /** Repo root candidate worktrees fork from. */
1280
+ repoRoot: string;
1281
+ /** Base ref candidates fork from. Default `main`. */
1282
+ baseRef?: string;
1283
+ /** Directory worktrees are created under. Default `<repoRoot>/.worktrees`. */
1284
+ worktreeDir?: string;
1285
+ /** Coding harness the agentic generator runs in each worktree. Default `claude`. */
1286
+ harness?: LocalHarness;
1287
+ /** Verify a candidate worktree before it becomes a measurable surface; failures
1288
+ * feed the next shot (see `agenticGenerator.verify` / `commandVerifier`). */
1289
+ verify?: Verifier;
1290
+ /** Per-shot wall-clock timeout for the harness (ms). */
1291
+ timeoutMs?: number;
1292
+ /** Byte-producer override — the test seam and the escape hatch for custom
1293
+ * candidate production. When set, `harness`/`verify`/`timeoutMs` are unused. */
1294
+ generator?: CandidateGenerator;
1221
1295
  }
1222
1296
  interface ImproveResult<TScenario extends Scenario$1, TArtifact> {
1223
1297
  /** The profile after improvement: the winner surface applied back into the
@@ -1247,6 +1321,75 @@ interface ImproveResult<TScenario extends Scenario$1, TArtifact> {
1247
1321
  */
1248
1322
  declare function improve<TScenario extends Scenario$1, TArtifact>(profile: AgentProfile$1, findings: unknown[], opts: ImproveOptions<TScenario, TArtifact>): Promise<ImproveResult<TScenario, TArtifact>>;
1249
1323
 
1324
+ /**
1325
+ *
1326
+ * `rawTraceDistiller` — the meta-harness `analyzeGeneration` producer.
1327
+ *
1328
+ * The default `generationFailureDistiller` (in `improve.ts`) COMPRESSES each
1329
+ * generation's failing cells into ~400-char structured findings before the next
1330
+ * proposal round. That is the ACE-style recipe: a small summary is the proposer's
1331
+ * whole view of what went wrong. This producer does the opposite — the
1332
+ * meta-harness recipe (yoonholee.com/meta-harness): it does NOT summarize. It
1333
+ * points the coding-agent proposer at the generation's RAW run traces already on
1334
+ * disk under `runDir` — the durable per-cell `spans.jsonl` event logs,
1335
+ * `cached-result.json` scores, and any artifacts the substrate persisted — and
1336
+ * instructs the agent to `grep`/`cat`/`ls` them to diagnose the failures itself
1337
+ * (up to the harness's full context, ~millions of tokens, vs a ~400-char digest).
1338
+ *
1339
+ * It emits `AnalystFinding[]` so it drops into the SAME `opts.analyzeGeneration`
1340
+ * slot the default distiller uses, and renders through the same
1341
+ * `agenticGenerator` prompt path (`claim` + `recommended_action`). The findings
1342
+ * carry ABSOLUTE paths — the coding harness runs with `cwd` = a candidate
1343
+ * worktree, so a relative `runDir` would be uncattable from there.
1344
+ *
1345
+ * Runtime layout it reads (written by agent-eval's optimization loop):
1346
+ *
1347
+ * <runDir>/gen-<N>/ ← the generation dir (input.runDir)
1348
+ * candidate-<i>/ ← one candidate campaign (campaign.runDir)
1349
+ * <sanitized cellId>/ ← one scenario×rep cell
1350
+ * spans.jsonl ← the raw trace (event/span log)
1351
+ * cached-result.json ← the cell's score + artifact ref
1352
+ * <artifacts…> ← whatever the dispatch wrote
1353
+ *
1354
+ * @experimental
1355
+ */
1356
+
1357
+ interface RawTraceDistillerOptions {
1358
+ /** Anchor the emitted paths at this run root instead of the generation `runDir`
1359
+ * the loop passes in. Normally unset — each call points at that generation's
1360
+ * own directory (`input.runDir`). Pass an absolute path when you construct the
1361
+ * producer ahead of the loop and want a fixed anchor (e.g. a test fixture). */
1362
+ runDir?: string;
1363
+ /** Max candidates to surface trace paths for, worst-scoring first. Default 12. */
1364
+ maxCandidates?: number;
1365
+ /** Max failing cells to enumerate per candidate before collapsing the rest into
1366
+ * an "ls the candidate dir" pointer. Default 8. */
1367
+ maxCellsPerCandidate?: number;
1368
+ /** Max concrete file paths to list per cell (the agent can always `ls` the dir
1369
+ * for the rest). Default 24. */
1370
+ maxFilesPerCell?: number;
1371
+ /** Findings to fall back to when the generation had NO failing cells, so a
1372
+ * clean round never wipes the proposer's steering context. Mirrors the default
1373
+ * distiller's static-seed fallback. Default: a single instruction finding. */
1374
+ fallbackFindings?: unknown[];
1375
+ }
1376
+ /**
1377
+ * Build an `analyzeGeneration` producer that feeds the proposer RAW-TRACE
1378
+ * FILESYSTEM CONTEXT — paths into the prior generation's real run traces plus a
1379
+ * grep/cat-to-diagnose instruction — instead of a pre-summarized digest.
1380
+ *
1381
+ * Drop-in for `opts.analyzeGeneration` on `improve()` / `selfImprove()`:
1382
+ *
1383
+ * await improve(profile, seedFindings, {
1384
+ * surface: 'code',
1385
+ * code: { repoRoot },
1386
+ * runDir: '/abs/run', // MUST be a real path — the traces live here
1387
+ * analyzeGeneration: rawTraceDistiller(),
1388
+ * scenarios, judge, agent,
1389
+ * })
1390
+ */
1391
+ declare function rawTraceDistiller<TScenario extends Scenario$1 = Scenario$1, TArtifact = unknown>(options?: RawTraceDistillerOptions): NonNullable<SelfImproveOptions<TScenario, TArtifact>['analyzeGeneration']>;
1392
+
1250
1393
  /**
1251
1394
  *
1252
1395
  * `reflectiveGenerator` — the cheap, no-sandbox `CandidateGenerator`. It drafts
@@ -1802,4 +1945,4 @@ interface StreamToolLoopOptions<Raw> {
1802
1945
  * `capped` if it stops for any non-completed reason with calls still pending. */
1803
1946
  declare function streamToolLoop<Raw>(opts: StreamToolLoopOptions<Raw>): AsyncGenerator<StreamToolLoopYield<Raw>, void, unknown>;
1804
1947
 
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 };
1948
+ 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 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, applyRunRecordDefaults, buildForwardHeaders, cleanModelId, computeBackoff, createConversationBackend, createIterableBackend, createOpenAICompatibleBackend, createRuntimeEventCollector, createRuntimeStreamEventCollector, createSandboxPromptBackend, d1ToSqlAdapter, decideKnowledgeReadiness, defaultIsRetryable, defineConversation, deriveExecutionId, getModels, handleChatTurn, improve, isDepthExceeded, makePerAttemptSignal, mcpBuildPrompt, rawTraceDistiller, readDepth, readinessServerSentEvent, reflectiveGenerator, resolveAgentBackend, resolveChatModel, resolveRouterBaseUrl, runAgentTask, runAgentTaskStream, runConversation, runConversationStream, runPersonaConversation, runPersonaDispatch, runToolLoop, runtimeStreamServerSentEvent, sanitizeAgentRuntimeEvent, sanitizeKnowledgeReadinessReport, sanitizeRuntimeStreamEvent, sleep, slugifySpeaker, streamToolLoop, toolBuildPrompt, turnId, validateChatModelId };