@tangle-network/agent-runtime 0.94.13 → 0.96.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.
Files changed (110) hide show
  1. package/README.md +64 -15
  2. package/dist/activation-B0ZD7nfX.d.ts +63 -0
  3. package/dist/agent.d.ts +6 -193
  4. package/dist/agent.js +10 -234
  5. package/dist/agent.js.map +1 -1
  6. package/dist/analyst-loop.d.ts +7 -10
  7. package/dist/analyst-loop.js +1 -2
  8. package/dist/candidate-execution/index.d.ts +43 -16
  9. package/dist/candidate-execution/index.js +17 -8
  10. package/dist/{chunk-VYA2YEKA.js → chunk-2KGAN2HM.js} +83 -14
  11. package/dist/chunk-2KGAN2HM.js.map +1 -0
  12. package/dist/chunk-3XKSBI2U.js +474 -0
  13. package/dist/chunk-3XKSBI2U.js.map +1 -0
  14. package/dist/{chunk-TVJQAYQM.js → chunk-6XKPVJAZ.js} +107 -716
  15. package/dist/chunk-6XKPVJAZ.js.map +1 -0
  16. package/dist/chunk-BLQIYRVR.js +699 -0
  17. package/dist/chunk-BLQIYRVR.js.map +1 -0
  18. package/dist/{chunk-QDSOD7RC.js → chunk-FD2MBMOH.js} +13 -101
  19. package/dist/chunk-FD2MBMOH.js.map +1 -0
  20. package/dist/{chunk-U33YZ7B2.js → chunk-FXF2OL34.js} +8 -8
  21. package/dist/{chunk-EP6RVHMX.js → chunk-HZDEXTSL.js} +848 -2
  22. package/dist/chunk-HZDEXTSL.js.map +1 -0
  23. package/dist/{chunk-WIPGQ4GT.js → chunk-IMSNJSXH.js} +1 -1
  24. package/dist/{chunk-WIPGQ4GT.js.map → chunk-IMSNJSXH.js.map} +1 -1
  25. package/dist/{chunk-VSWBYWFK.js → chunk-M6MD6JBS.js} +20 -27
  26. package/dist/chunk-M6MD6JBS.js.map +1 -0
  27. package/dist/chunk-PSOCBNM3.js +2069 -0
  28. package/dist/chunk-PSOCBNM3.js.map +1 -0
  29. package/dist/{chunk-AEG3NGJ2.js → chunk-Q2JSAVQ3.js} +34 -2
  30. package/dist/chunk-Q2JSAVQ3.js.map +1 -0
  31. package/dist/{chunk-XP5KDM3R.js → chunk-SGQ4YIQW.js} +4 -4
  32. package/dist/{chunk-C3UKLQ54.js → chunk-UQ6PNNXM.js} +18 -10
  33. package/dist/chunk-UQ6PNNXM.js.map +1 -0
  34. package/dist/{chunk-33OG2NN3.js → chunk-WYC2XJF2.js} +2 -2
  35. package/dist/{chunk-ZEYAT33L.js → chunk-Y3SRWZMP.js} +2 -2
  36. package/dist/{chunk-CNH7DF7Z.js → chunk-YOLKCWRV.js} +1116 -591
  37. package/dist/chunk-YOLKCWRV.js.map +1 -0
  38. package/dist/{completion-gate-D1gX1-hg.d.ts → completion-gate-C80jiRfN.d.ts} +1 -1
  39. package/dist/conversation.d.ts +12 -1
  40. package/dist/conversation.js +2 -3
  41. package/dist/{coordination-Dr_axlAf.d.ts → coordination-BFE3Den7.d.ts} +10 -11
  42. package/dist/environment-provider.d.ts +2 -2
  43. package/dist/environment-provider.js +1 -2
  44. package/dist/{agentic-generator-DDMM45kZ.d.ts → improve-g75IE2Cx.d.ts} +152 -4
  45. package/dist/{improvement-adapter-BieWeK5J.d.ts → improvement-adapter-HAZz-7vK.d.ts} +8 -31
  46. package/dist/index.d.ts +55 -28
  47. package/dist/index.js +206 -82
  48. package/dist/index.js.map +1 -1
  49. package/dist/intelligence.d.ts +185 -120
  50. package/dist/intelligence.js +509 -345
  51. package/dist/intelligence.js.map +1 -1
  52. package/dist/knowledge.d.ts +40 -12
  53. package/dist/knowledge.js +13 -7
  54. package/dist/{loop-runner-bin-BRQSQdHa.d.ts → loop-runner-bin-Cn1N2rRo.d.ts} +3 -3
  55. package/dist/loop-runner-bin.d.ts +6 -6
  56. package/dist/loop-runner-bin.js +8 -10
  57. package/dist/loops.d.ts +13 -13
  58. package/dist/loops.js +6 -8
  59. package/dist/mcp/bin.js +5 -7
  60. package/dist/mcp/bin.js.map +1 -1
  61. package/dist/mcp/index.d.ts +6 -6
  62. package/dist/mcp/index.js +12 -14
  63. package/dist/mcp/index.js.map +1 -1
  64. package/dist/platform.js +0 -2
  65. package/dist/platform.js.map +1 -1
  66. package/dist/primeintellect/index.js +1 -2
  67. package/dist/primeintellect/index.js.map +1 -1
  68. package/dist/profile-DbfaMTdk.d.ts +233 -0
  69. package/dist/profiles.d.ts +1 -1
  70. package/dist/profiles.js +0 -1
  71. package/dist/profiles.js.map +1 -1
  72. package/dist/{supervise-DmYOug5f.d.ts → supervise-BLPI50-w.d.ts} +3 -3
  73. package/dist/{types-ByAYqlVb.d.ts → types-B3vAW0Oq.d.ts} +1 -1
  74. package/dist/{prepare-CtdtsFNG.d.ts → types-CWqfCO8s.d.ts} +67 -298
  75. package/dist/{types-BC3bZpH0.d.ts → types-CmYCMbFT.d.ts} +12 -54
  76. package/dist/{types-1d5QGK3t.d.ts → types-CmnA2iL3.d.ts} +3 -3
  77. package/dist/{worktree-fanout-CPprU-qI.d.ts → worktree-fanout-DCA3G4bO.d.ts} +3 -3
  78. package/package.json +14 -16
  79. package/skills/build-with-agent-runtime/SKILL.md +122 -213
  80. package/dist/chunk-6O73TRHW.js +0 -142
  81. package/dist/chunk-6O73TRHW.js.map +0 -1
  82. package/dist/chunk-AEG3NGJ2.js.map +0 -1
  83. package/dist/chunk-C3UKLQ54.js.map +0 -1
  84. package/dist/chunk-CNH7DF7Z.js.map +0 -1
  85. package/dist/chunk-D3H7F6L2.js +0 -626
  86. package/dist/chunk-D3H7F6L2.js.map +0 -1
  87. package/dist/chunk-DGUM43GV.js +0 -11
  88. package/dist/chunk-DGUM43GV.js.map +0 -1
  89. package/dist/chunk-EP6RVHMX.js.map +0 -1
  90. package/dist/chunk-HGRW27YY.js +0 -214
  91. package/dist/chunk-HGRW27YY.js.map +0 -1
  92. package/dist/chunk-ISTDY47H.js +0 -849
  93. package/dist/chunk-ISTDY47H.js.map +0 -1
  94. package/dist/chunk-PCURO3DL.js +0 -661
  95. package/dist/chunk-PCURO3DL.js.map +0 -1
  96. package/dist/chunk-QDSOD7RC.js.map +0 -1
  97. package/dist/chunk-TVJQAYQM.js.map +0 -1
  98. package/dist/chunk-VSWBYWFK.js.map +0 -1
  99. package/dist/chunk-VYA2YEKA.js.map +0 -1
  100. package/dist/generator-YkAQrOoD.d.ts +0 -382
  101. package/dist/improve-BN3HyXIO.d.ts +0 -172
  102. package/dist/lifecycle.d.ts +0 -870
  103. package/dist/lifecycle.js +0 -981
  104. package/dist/lifecycle.js.map +0 -1
  105. package/dist/mcp-serve-verifier-DQQDbuyz.d.ts +0 -34
  106. package/skills/agent-runtime-adoption/SKILL.md +0 -246
  107. /package/dist/{chunk-U33YZ7B2.js.map → chunk-FXF2OL34.js.map} +0 -0
  108. /package/dist/{chunk-XP5KDM3R.js.map → chunk-SGQ4YIQW.js.map} +0 -0
  109. /package/dist/{chunk-33OG2NN3.js.map → chunk-WYC2XJF2.js.map} +0 -0
  110. /package/dist/{chunk-ZEYAT33L.js.map → chunk-Y3SRWZMP.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { WorkspacePlanReceipt } from '@tangle-network/agent-profile-materialize';
2
2
  import { L as LocalHarness, C as CodexTokenUsage, c as CodexExecutionPolicy } from './local-harness-ZqCx51u7.js';
3
- import { c as Executor } from './types-1d5QGK3t.js';
3
+ import { c as Executor } from './types-CmnA2iL3.js';
4
4
 
5
5
  /**
6
6
  *
@@ -1,4 +1,4 @@
1
- import { c as AgentExecutionBackend } from './types-BwoZWq-i.js';
1
+ import { c as AgentExecutionBackend, k as RuntimeSessionStore } from './types-BwoZWq-i.js';
2
2
  import { AgentProfile, MaximumCharge } from '@tangle-network/agent-eval';
3
3
  import { Scenario, ProfileDispatchFn } from '@tangle-network/agent-eval/campaign';
4
4
 
@@ -370,6 +370,8 @@ interface ConversationTurn {
370
370
  * `${runId}.t${index}.${speakerSlug}`.
371
371
  */
372
372
  turnId: string;
373
+ /** Backend session used for this turn. Present on turns recorded by session-aware runners. */
374
+ sessionId?: string;
373
375
  text: string;
374
376
  /**
375
377
  * Aggregated backend usage for this turn alone. Populated from any
@@ -424,6 +426,13 @@ interface RunConversationOptions {
424
426
  * driver process crash mid-run loses zero acknowledged turns.
425
427
  */
426
428
  journal?: ConversationJournal;
429
+ /**
430
+ * Stores each participant's backend session. The runner keeps an in-memory
431
+ * store for one invocation when omitted. Reuse a durable store with the same
432
+ * `runId` and journal after a process restart. Backends implementing `resume`
433
+ * continue their provider session; other backends receive the full transcript.
434
+ */
435
+ sessionStore?: RuntimeSessionStore;
427
436
  /**
428
437
  * Headers to forward verbatim to every participant backend call (gateway
429
438
  * propagation: `X-Tangle-Forwarded-Authorization`, run/turn correlation,
@@ -656,6 +665,8 @@ declare class SqlConversationJournal implements ConversationJournal {
656
665
  * forward events as they arrive. Both share one driving loop.
657
666
  *
658
667
  * Distributed-systems primitives layered on top of the loop:
668
+ * - **Participant sessions**: one backend session per participant is resumed
669
+ * between turns; stateless backends receive one reconstructed transcript.
659
670
  * - **Idempotent turn ids** — `turnId(runId, index, speaker)` stays stable
660
671
  * across retries so caching gateways can dedupe.
661
672
  * - **Durable journal** — optional `ConversationJournal` persists every
@@ -23,10 +23,9 @@ import {
23
23
  sleep,
24
24
  slugifySpeaker,
25
25
  turnId
26
- } from "./chunk-VYA2YEKA.js";
27
- import "./chunk-AEG3NGJ2.js";
26
+ } from "./chunk-2KGAN2HM.js";
27
+ import "./chunk-Q2JSAVQ3.js";
28
28
  import "./chunk-YEJR7IXO.js";
29
- import "./chunk-DGUM43GV.js";
30
29
  export {
31
30
  CircuitBreakerState,
32
31
  CircuitOpenError,
@@ -1,12 +1,12 @@
1
- import { E as ExecutorFactory, e as ExecutorRegistry, i as Spend, A as Agent, S as Scope, a as ResultBlobStore, B as Budget } from './types-1d5QGK3t.js';
1
+ import { E as ExecutorFactory, e as ExecutorRegistry, i as Spend, A as Agent, S as Scope, a as ResultBlobStore, B as Budget } from './types-CmnA2iL3.js';
2
2
  import { AgentProfile } from '@tangle-network/agent-interface';
3
3
  import { U as UiLens, a as UiFinding, C as CoderTask } from './substrate-DO2GHNg2.js';
4
- import { S as SandboxClient, E as ExecCtx, r as LoopTraceEmitter, a as LoopTraceEvent, A as AgentRunSpec } from './types-ByAYqlVb.js';
4
+ import { S as SandboxClient, E as ExecCtx, r as LoopTraceEmitter, b as LoopTraceEvent, A as AgentRunSpec } from './types-B3vAW0Oq.js';
5
5
  import { BackendType, SandboxEvent, SandboxInstance } from '@tangle-network/sandbox';
6
6
  import { AgentEvalError } from '@tangle-network/agent-eval';
7
7
  import { b as ToolSpec, c as RuntimeTelemetryOptions, R as RouterConfig } from './sanitize-BTSsdBXw.js';
8
8
  import { R as RuntimeStreamEvent } from './types-BwoZWq-i.js';
9
- import { G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './completion-gate-D1gX1-hg.js';
9
+ import { G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './completion-gate-C80jiRfN.js';
10
10
  import { L as LocalHarness } from './local-harness-ZqCx51u7.js';
11
11
  import { ProviderExecutorOptions, AgentEnvironmentProviderRegistry } from './environment-provider.js';
12
12
  import { AgentEnvironmentProvider } from '@tangle-network/agent-interface/environment-provider';
@@ -1012,9 +1012,9 @@ interface DelegateUiAuditResult {
1012
1012
  estimatedDurationMs?: number;
1013
1013
  }
1014
1014
  /**
1015
- * Loose shape of a research output over the wire the substrate cannot
1016
- * import the `ResearchOutput` type from agent-knowledge without inducing
1017
- * a dependency cycle, so the MCP layer treats it structurally.
1015
+ * Provider-neutral research output carried over the MCP boundary. The MCP
1016
+ * layer accepts this structural shape instead of coupling its wire contract to
1017
+ * one research implementation.
1018
1018
  *
1019
1019
  * @experimental
1020
1020
  */
@@ -1908,11 +1908,10 @@ declare function settleDetachedCoderTurn(turn: DetachedTurn, options: SettleDeta
1908
1908
  *
1909
1909
  * Feedback persistence surface for the MCP layer.
1910
1910
  *
1911
- * The substrate cannot import `@tangle-network/agent-knowledge` (it would
1912
- * induce a dependency cycle), so the store is an abstract interface. The
1913
- * default implementation is in-memory; consumers wire their own adapter
1914
- * (a real KbStore-backed sink, an HTTP relay to gtm-agent's knowledge
1915
- * service, etc.) via `createMcpServer({ feedbackStore })`.
1911
+ * Feedback storage is product policy, so the MCP layer depends on this narrow
1912
+ * interface instead of choosing a knowledge store. The default implementation
1913
+ * is in-memory; consumers wire their own durable adapter via
1914
+ * `createMcpServer({ feedbackStore })`.
1916
1915
  *
1917
1916
  * Feedback events are append-only: every rating is a new event with a
1918
1917
  * fresh id, even when the same delegation is rated multiple times. The
@@ -2,8 +2,8 @@ import { AgentProfile, AgentProfileValidationResult } from '@tangle-network/agen
2
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-1d5QGK3t.js';
6
- import { S as SandboxClient } from './types-ByAYqlVb.js';
5
+ import { R as Runtime, E as ExecutorFactory } from './types-CmnA2iL3.js';
6
+ import { S as SandboxClient } from './types-B3vAW0Oq.js';
7
7
  import '@tangle-network/agent-eval';
8
8
  import './types-BwoZWq-i.js';
9
9
 
@@ -4,9 +4,8 @@ import {
4
4
  providerAsSandboxClient,
5
5
  resolveAgentEnvironmentProvider,
6
6
  sandboxClientAsProvider
7
- } from "./chunk-VSWBYWFK.js";
7
+ } from "./chunk-M6MD6JBS.js";
8
8
  import "./chunk-3MDZX7YU.js";
9
- import "./chunk-DGUM43GV.js";
10
9
  export {
11
10
  createAgentEnvironmentProviderRegistry,
12
11
  providerAsExecutor,
@@ -1,7 +1,8 @@
1
- import { AnalystFinding, CostLedgerHandle, MaximumCharge } from '@tangle-network/agent-eval';
1
+ import { LabeledScenarioStore, WorktreeAdapter, SurfaceProposer } from '@tangle-network/agent-eval/campaign';
2
+ import { Scenario, SelfImproveOptions, SurfaceProposer as SurfaceProposer$1, MutableSurface, SelfImproveResult } from '@tangle-network/agent-eval/contract';
2
3
  import { AgentProfile, ReasoningEffort } from '@tangle-network/agent-interface';
3
4
  import { L as LocalHarness, C as CodexTokenUsage, a as CodexExecutionEvidence, b as LocalHarnessResult, r as runLocalHarness } from './local-harness-ZqCx51u7.js';
4
- import { LabeledScenarioStore, WorktreeAdapter, SurfaceProposer } from '@tangle-network/agent-eval/campaign';
5
+ import { AnalystFinding, CostLedgerHandle, MaximumCharge } from '@tangle-network/agent-eval';
5
6
 
6
7
  /**
7
8
  *
@@ -129,7 +130,6 @@ interface VerifyResult {
129
130
  * throw). */
130
131
  type Verifier = (worktreePath: string) => Promise<VerifyResult> | VerifyResult;
131
132
  interface AgenticGeneratorShotReceipt {
132
- readonly schemaVersion: 1;
133
133
  readonly generation: number | null;
134
134
  readonly candidateIndex: number | null;
135
135
  /** One-based shot number within this candidate. */
@@ -255,4 +255,152 @@ declare function agenticGenerator(opts?: AgenticGeneratorOptions): CandidateGene
255
255
  * silent fallback). */
256
256
  declare function commandVerifier(command: string, args?: string[], timeoutMs?: number): Verifier;
257
257
 
258
- export { AGENTIC_PROFILE_RESOURCE_ROOT as A, type CandidateGenerator as C, type ImprovementDriverOptions as I, type ManagedImprovementDriver as M, type Verifier as V, type AgenticGeneratorOptions as a, type AgenticGeneratorShotDisposition as b, type AgenticGeneratorShotExecution as c, type AgenticGeneratorShotReceipt as d, type VerifyResult as e, agenticGenerator as f, commandVerifier as g, improvementDriver as i };
258
+ /**
259
+ *
260
+ * `improve` — the ONE public, surface-pluggable RSI verb.
261
+ *
262
+ * A thin facade over agent-eval's `selfImprove` (the held-out-gated closed
263
+ * loop). It removes the two things a caller otherwise has to know to drive the
264
+ * loop by hand: WHICH `MutableSurface` of the profile is being optimized, and
265
+ * WHICH `SurfaceProposer` mutates that surface. You name a `surface`; the
266
+ * facade picks the matching default proposer, extracts the baseline surface from
267
+ * the profile, and runs `selfImprove`. It returns a frozen candidate and never
268
+ * changes the input profile or caller-owned state.
269
+ *
270
+ * - `surface: 'prompt'` → `gepaProposer` mutates `profile.prompt.systemPrompt`.
271
+ * - `surface: 'skills'` → `skillOptProposer` mutates one named inline skill.
272
+ * - `surface: 'memory'` → `memoryCurationProposer` curates the profile's
273
+ * additional instructions as bounded durable lessons.
274
+ * - `surface: 'agent-profile'` → caller-supplied proposer mutates the complete
275
+ * canonical AgentProfile JSON in one candidate.
276
+ * - `surface` ∈ {`tools`, `mcp`, `hooks`, `subagents`, `agent-profile`} → no zero-config default
277
+ * proposer exists (a code/config proposer needs caller-supplied wiring — a
278
+ * worktree repo root, a candidate generator, a serializer). The facade
279
+ * requires an explicit `opts.generator` for these and throws a `ConfigError`
280
+ * otherwise. This is a designed boundary, not a missing default: there is
281
+ * no safe value the facade could invent for those surfaces. Code instead
282
+ * requires `opts.code.repoRoot` and accepts only the runtime-owned
283
+ * `opts.code.generator` path so every isolated checkout can be released.
284
+ *
285
+ * Everything else (`scenarios`, `judge`, `agent`, `budget`, `llm`) passes
286
+ * straight through to `selfImprove`.
287
+ *
288
+ * @experimental
289
+ */
290
+
291
+ /** The executable agent lever `improve` optimizes. Profile fields remain
292
+ * portable AgentProfile coordinates; implementation and orchestration files
293
+ * use the code surface so a winner can be sealed into an exact candidate. */
294
+ type ImproveSurface = 'prompt' | 'skills' | 'tools' | 'mcp' | 'hooks' | 'subagents' | 'agent-profile' | 'memory' | 'code';
295
+ type ImproveOptions<TScenario extends Scenario, TArtifact> = Omit<SelfImproveOptions<TScenario, TArtifact>, 'analyzeGeneration' | 'baselineSurface' | 'findings' | 'gate' | 'proposer'> & {
296
+ /** Which profile lever to optimize. Default `'prompt'`. Selects the default
297
+ * generator + the baseline-surface extraction shape. */
298
+ surface?: ImproveSurface;
299
+ /** The `SurfaceProposer` that mutates a profile surface. When unset, the facade
300
+ * picks the default for prompt, skills, and memory; surfaces
301
+ * with no default REQUIRE this (fail-loud otherwise). Forbidden for code;
302
+ * use `code.generator` so the runtime owns candidate cleanup. */
303
+ generator?: SurfaceProposer$1;
304
+ /** Gate mode. `'holdout'` (default) runs the held-out promotion gate;
305
+ * `'none'` is a baseline-only run (`budget.generations = 0`). */
306
+ gate?: 'holdout' | 'none';
307
+ /** Restrict the run to this subset of models. When set, the reflection model
308
+ * (`llm.model`, or the default when unset) must be a member, or `improve()` throws
309
+ * a `ConfigError` before the generator is built. Unset = unrestricted. */
310
+ allowedModels?: readonly string[];
311
+ /** Per-generation findings producer passthrough (see selfImprove.analyzeGeneration).
312
+ * DEFAULT: the built-in failure distiller — after each generation it turns the
313
+ * worst-scoring/errored cells into structured findings ({ scenario, composite,
314
+ * notes, error }) for the NEXT proposal round, so the proposer reasons over what
315
+ * actually failed instead of a static seed. Pass your own producer (e.g. a
316
+ * trace-analyst over the runDir's traces) to replace it; pass `null` to disable
317
+ * and keep the static `findings` all the way through. */
318
+ analyzeGeneration?: SelfImproveOptions<TScenario, TArtifact>['analyzeGeneration'] | null;
319
+ /** META-HARNESS mode: instead of the ~1500-char distilled findings, feed the
320
+ * proposer RAW-TRACE FILESYSTEM CONTEXT — the PATHS into the prior generation's
321
+ * real run traces under `runDir` (per-cell `spans.jsonl` event logs +
322
+ * `cached-result.json` scores + artifacts) plus a `grep`/`cat`-to-diagnose
323
+ * instruction — so the coding agent reads the actual failures itself rather than
324
+ * a pre-summary. Requires a REAL `runDir` (that is where the traces live).
325
+ * Ignored when `analyzeGeneration` is set explicitly (that wins) or is `null`
326
+ * (disabled). Equivalent to `analyzeGeneration: rawTraceDistiller()`; this flag
327
+ * is the one-line enable. Default `false` (the distiller stays the default). */
328
+ rawTraceContext?: boolean;
329
+ /** CODE-surface wiring: name `surface: 'code'`, point at a repo, and the
330
+ * facade assembles the whole candidate pipeline — an isolated incumbent plus git worktrees
331
+ * (`gitWorktreeAdapter`) driven by `improvementDriver` with the full agentic
332
+ * generator (a real coding harness edits each candidate worktree; a `verify`
333
+ * hook gates candidates before they are ever measured). Ignored when
334
+ * `opts.generator` is supplied. Required for every code run because a real
335
+ * repository and base ref are necessary to measure the incumbent. */
336
+ code?: ImproveCodeOptions;
337
+ /** Select the exact inline skill document to optimize. */
338
+ skills?: ImproveSkillsOptions;
339
+ /** Custom held-back-exam decision. The string `gate` above controls whether
340
+ * the exam runs; this callback controls how its evidence decides promotion. */
341
+ promotionGate?: SelfImproveOptions<TScenario, TArtifact>['gate'];
342
+ };
343
+ interface ImproveSkillsOptions {
344
+ /** `name` of one inline entry in `profile.resources.skills`. */
345
+ resourceName: string;
346
+ }
347
+ interface ImproveCodeOptions {
348
+ /** Repo root candidate worktrees fork from. */
349
+ repoRoot: string;
350
+ /** Base ref candidates fork from. Default `main`. */
351
+ baseRef?: string;
352
+ /** Directory worktrees are created under. Default `<repoRoot>/.worktrees`. */
353
+ worktreeDir?: string;
354
+ /** Git-compatible adapter override, primarily for tests. Candidate advancement
355
+ * still requires normal Git worktree and commit semantics. */
356
+ worktree?: WorktreeAdapter;
357
+ /** Coding harness the agentic generator runs in each worktree. Default `claude`. */
358
+ harness?: LocalHarness;
359
+ /** Verify a candidate worktree before it becomes a measurable surface; failures
360
+ * feed the next shot (see `agenticGenerator.verify` / `commandVerifier`). */
361
+ verify?: Verifier;
362
+ /** Per-shot wall-clock timeout for the harness (ms). */
363
+ timeoutMs?: number;
364
+ /** Byte-producer override — the test seam and the escape hatch for custom
365
+ * candidate production. When set, `harness`/`verify`/`timeoutMs` are unused. */
366
+ generator?: CandidateGenerator;
367
+ }
368
+ interface ImprovementCandidate {
369
+ /** Surface searched by this run. */
370
+ surface: ImproveSurface;
371
+ /** Exact winning value returned by agent-eval. */
372
+ value: MutableSurface;
373
+ /** Detached profile candidate when the surface maps directly to AgentProfile. */
374
+ profile?: AgentProfile;
375
+ }
376
+ interface ImproveResult<TScenario extends Scenario, TArtifact> {
377
+ /** Frozen candidate only. Live state is changed through an approved activation. */
378
+ candidate: ImprovementCandidate;
379
+ /** Held-out decision for this search result. */
380
+ decision: SelfImproveResult<TScenario, TArtifact>['gateDecision'];
381
+ /** Held-out lift (`winner − baseline` composite). */
382
+ lift: number;
383
+ /** Full `selfImprove` result for advanced inspection. For code runs,
384
+ * `raw.winner.surface.worktreeRef` remains live after return whether the
385
+ * candidate passed or held; call `dispose()` after consuming it. */
386
+ raw: SelfImproveResult<TScenario, TArtifact>;
387
+ /** Release resources owned by this result. Idempotent; currently disposes
388
+ * the returned code worktree and is a no-op for profile-only surfaces. */
389
+ dispose(): Promise<void>;
390
+ }
391
+ /**
392
+ * Run the held-out-gated self-improvement loop on ONE profile surface.
393
+ *
394
+ * @example Optimize the system prompt, default holdout gate:
395
+ *
396
+ * const out = await improve(profile, findings, {
397
+ * surface: 'prompt',
398
+ * scenarios,
399
+ * judge,
400
+ * agent: (surface, scenario, ctx) => runAgent(surface, scenario, ctx.signal),
401
+ * })
402
+ * if (out.decision === 'ship') console.log(out.candidate)
403
+ */
404
+ declare function improve<TScenario extends Scenario, TArtifact>(profile: AgentProfile, findings: unknown[], opts: ImproveOptions<TScenario, TArtifact>): Promise<ImproveResult<TScenario, TArtifact>>;
405
+
406
+ export { AGENTIC_PROFILE_RESOURCE_ROOT as A, type CandidateGenerator as C, type ImproveOptions as I, type ManagedImprovementDriver as M, type Verifier as V, type ImproveResult as a, type AgenticGeneratorOptions as b, type AgenticGeneratorShotDisposition as c, type AgenticGeneratorShotExecution as d, type AgenticGeneratorShotReceipt as e, type ImproveCodeOptions as f, type ImproveSkillsOptions as g, type ImproveSurface as h, type ImprovementCandidate as i, type ImprovementDriverOptions as j, type VerifyResult as k, agenticGenerator as l, commandVerifier as m, improve as n, improvementDriver as o };
@@ -1,5 +1,5 @@
1
1
  import { FindingSubject, AnalystFinding } from '@tangle-network/agent-eval';
2
- import { I as ImprovementAdapter } from './types-BC3bZpH0.js';
2
+ import { I as ImprovementProposalSource } from './types-CmYCMbFT.js';
3
3
 
4
4
  /**
5
5
  * `AgentSurfaces` — declarative map of the mutable file/directory paths
@@ -116,23 +116,15 @@ declare function validateSurfaces(surfaces: AgentSurfaces, repoRoot: string): Re
116
116
  declare function renderSurfaceIssues(issues: ReadonlyArray<SurfaceValidationIssue>, repoRoot: string): string;
117
117
 
118
118
  /**
119
- * Substrate-default `ImprovementAdapter`surfaces-driven, LLM-drafted
120
- * patches, optional auto-apply or PR-open.
119
+ * Surface improvement proposer resolves analyst findings into LLM-drafted
120
+ * candidate patches without changing the caller's repository.
121
121
  *
122
- * This is the one ImprovementAdapter every vertical agent uses. The
123
- * substrate parses each finding's `subject` via
122
+ * The proposer parses each finding's `subject` via
124
123
  * `parseFindingSubject` (agent-eval), resolves it to a real file path
125
124
  * via the agent's `AgentSurfaces`, reads the current content, and asks
126
125
  * an LLM to draft a unified-diff patch given the finding + current
127
126
  * content + per-kind editing-discipline rules.
128
127
  *
129
- * Auto-apply gates on the source-finding's confidence and the
130
- * autoApply.improvement policy. Two modes:
131
- * `write` — apply the patch in-place via `git apply -p0`. Operator
132
- * reviews via `git diff`.
133
- * `open-pr` — write to a branch, commit, push, open a PR via `gh`.
134
- * Operator reviews via the PR UI.
135
- *
136
128
  * Fail-loud rules:
137
129
  * - Findings whose subject doesn't parse → counted in `errors`.
138
130
  * - Findings whose subject targets an undeclared surface → counted in
@@ -169,7 +161,7 @@ interface SurfaceImprovementEdit {
169
161
  /** Carry-forward severity for prioritization. */
170
162
  severity: AnalystFinding['severity'];
171
163
  }
172
- interface CreateSurfaceImprovementAdapterOpts {
164
+ interface CreateSurfaceImprovementProposerOptions {
173
165
  surfaces: AgentSurfaces;
174
166
  repoRoot: string;
175
167
  /**
@@ -181,21 +173,6 @@ interface CreateSurfaceImprovementAdapterOpts {
181
173
  * substantive prompt rewrites, etc.) via this callback.
182
174
  */
183
175
  draftPatch: (input: DraftPatchInput) => Promise<DraftPatchOutput>;
184
- /**
185
- * Apply mode:
186
- * `write` — `git apply` in-place; operator reviews via `git diff`
187
- * `open-pr` — branch + commit + push + `gh pr create`
188
- * `none` — never apply; collect proposals for the report only
189
- *
190
- * The `apply` method honours this even when the loop calls it; the
191
- * effective behaviour is also gated on the per-finding confidence
192
- * threshold via `runAnalystLoop`'s `autoApply` policy.
193
- */
194
- mode?: 'write' | 'open-pr' | 'none';
195
- /** When `mode === 'open-pr'`, the base branch new PRs target. Default: `main`. */
196
- baseBranch?: string;
197
- /** Required for `mode === 'open-pr'` — the GH owner/repo (`tangle-network/tax-agent`). */
198
- ghRepo?: string;
199
176
  /**
200
177
  * When the resolved target doesn't exist, allow the substrate to
201
178
  * CREATE the file (for `knowledge.wiki`, `new-tool` subjects). Default
@@ -220,7 +197,7 @@ interface DraftPatchOutput {
220
197
  /** Multi-line rationale for the PR body. */
221
198
  rationale: string;
222
199
  }
223
- /** The substrate-default `ImprovementAdapter`: resolve each finding's subject to a real surface path, LLM-draft a unified-diff patch, then auto-apply or open a PR. */
224
- declare function createSurfaceImprovementAdapter(opts: CreateSurfaceImprovementAdapterOpts): ImprovementAdapter<SurfaceImprovementEdit>;
200
+ /** Resolve each finding to a real surface and draft a detached patch candidate. */
201
+ declare function createSurfaceImprovementProposer(opts: CreateSurfaceImprovementProposerOptions): ImprovementProposalSource<SurfaceImprovementEdit>;
225
202
 
226
- export { type AgentSurfaces as A, type CreateSurfaceImprovementAdapterOpts as C, type DraftPatchInput as D, type ResolvedSurface as R, type SurfaceImprovementEdit as S, type DraftPatchOutput as a, type SurfaceValidationIssue as b, createSurfaceImprovementAdapter as c, resolveSubjectPath as d, renderSurfaceIssues as r, validateSurfaces as v };
203
+ export { type AgentSurfaces as A, type CreateSurfaceImprovementProposerOptions as C, type DraftPatchInput as D, type ResolvedSurface as R, type SurfaceImprovementEdit as S, type DraftPatchOutput as a, type SurfaceValidationIssue as b, createSurfaceImprovementProposer as c, resolveSubjectPath as d, renderSurfaceIssues as r, validateSurfaces as v };
package/dist/index.d.ts CHANGED
@@ -2,38 +2,39 @@ import { AgentEvalError, AnalystFinding, KnowledgeReadinessReport, RunRecord, Co
2
2
  export { AgentEvalError, AgentEvalErrorCode, ConfigError, ControlBudget, ControlDecision, ControlEvalResult, ControlRunResult, ControlStep, DataAcquisitionPlan, JudgeError, KnowledgeReadinessReport, KnowledgeRequirement, NotFoundError, RunRecord, ValidationError } from '@tangle-network/agent-eval';
3
3
  import { c as createOpenAICompatibleBackend } from './backends-BO4Jqoe2.js';
4
4
  export { a as createIterableBackend, b as createSandboxPromptBackend } from './backends-BO4Jqoe2.js';
5
- export { AgentCandidateCodeSource, AgentCandidateCodeSurfaceSource, AgentCandidateModelGrantActivateInput, AgentCandidateModelGrantClient, AgentCandidateModelGrantReservation, AgentCandidateModelGrantReserveInput, AgentCandidateModelGrantSettleInput, AgentCandidateProfileSource, AgentCandidateWorkspaceArchiveLimits, BuildAgentCandidateBundleInput, CaptureAgentCandidateWorkspaceOptions, CapturedAgentCandidateWorkspace, CreateAgentCandidateWorkspacePortOptions, CreateProtectedAgentCandidateModelPortOptions, DisposePreparedAgentCandidateOptions, FileAgentCandidateExecutionClaimStore, FileAgentCandidateExecutionClaimStoreOptions, RecoverExpiredAgentCandidateOptions, applyExactAgentProfileDiff, buildAgentCandidateBundle, candidateExecutionClaim, captureAgentCandidateWorkspace, captureAgentCandidateWorkspaceFiles, createAgentCandidateWorkspacePort, createProtectedAgentCandidateModelPort, disposePreparedAgentCandidateExecution, parseExactAgentProfile, parseExactAgentProfileDiff, persistCandidateOutputArtifact, recoverExpiredAgentCandidateExecution, verifyAgentCandidateBundle } from './candidate-execution/index.js';
6
- export { d as AgentCandidateArtifactPort, e as AgentCandidateBenchmarkGraderIdentity, f as AgentCandidateBenchmarkGraderPort, A as AgentCandidateBundleInput, g as AgentCandidateContainerPort, h as AgentCandidateExecutionAttemptRecord, i as AgentCandidateExecutionAttemptRef, j as AgentCandidateExecutionClaim, k as AgentCandidateExecutionClaimResult, l as AgentCandidateExecutionClaimStore, m as AgentCandidateExecutionCleanupHandles, n as AgentCandidateExecutionFailureClass, o as AgentCandidateExecutionFinishResult, p as AgentCandidateExecutionLease, q as AgentCandidateExecutionPhase, r as AgentCandidateExecutionPhaseResult, b as AgentCandidateExecutionPorts, s as AgentCandidateExecutionRecoveryEvidence, t as AgentCandidateExecutionStageResult, u as AgentCandidateExecutionTerminalRecord, v as AgentCandidateExecutionTerminalResult, w as AgentCandidateExecutionUsage, x as AgentCandidateExecutorFinalCapture, y as AgentCandidateExecutorMemoryCapture, z as AgentCandidateExecutorPort, B as AgentCandidateExecutorProfileFile, C as AgentCandidateExecutorRequest, D as AgentCandidateExecutorStopRequest, F as AgentCandidateExecutorTaskOutcomeCapture, G as AgentCandidateExecutorWorkspaceFile, H as AgentCandidateExecutorWorkspaceInput, I as AgentCandidateMemoryPort, J as AgentCandidateMemoryResetResult, K as AgentCandidateModelLimits, L as AgentCandidateModelPort, M as AgentCandidateOutputArtifactPort, N as AgentCandidateOutputPurpose, O as AgentCandidateProtectedModelActivation, Q as AgentCandidateProtectedModelCall, R as AgentCandidateProtectedModelReservation, S as AgentCandidateProtectedModelSettlement, T as AgentCandidateProtectedRunCapture, U as AgentCandidateRepositoryPort, V as AgentCandidateRetryRejection, c as AgentCandidateRunFinalization, a as AgentCandidateTaskExecution, W as AgentCandidateVerificationPorts, X as AgentCandidateWorkspacePort, Y as CANDIDATE_TRACE_ENV, Z as CANDIDATE_TRACE_TAGS, _ as CanonicalCandidateDocument, E as ExecutePreparedAgentCandidateOptions, $ as InMemoryAgentCandidateExecutionClaimStore, P as PrepareAgentCandidateExecutionOptions, a0 as PreparedAgentCandidateExecution, a1 as PreparedAgentCandidateInstruction, a2 as PreparedAgentCandidateKnowledge, a3 as PreparedAgentCandidateLaunch, a4 as PreparedAgentCandidateTrace, a5 as ResolvedAgentCandidateContainer, a6 as VerifiedAgentCandidate, a7 as VerifiedAgentCandidateTaskOutcome, a8 as executePreparedAgentCandidate, a9 as prepareAgentCandidateExecution, aa as sealAgentCandidateBundle } from './prepare-CtdtsFNG.js';
5
+ export { AGENT_CANDIDATE_EXECUTION_SUPPORT, AgentCandidateBundleInput, AgentCandidateCodeSource, AgentCandidateCodeSurfaceSource, AgentCandidateModelGrantActivateInput, AgentCandidateModelGrantClient, AgentCandidateModelGrantReservation, AgentCandidateModelGrantReserveInput, AgentCandidateModelGrantSettleInput, AgentCandidateProfileSource, AgentCandidateWorkspaceArchiveLimits, BuildAgentCandidateBundleInput, CANDIDATE_KNOWLEDGE_RETRIEVAL_CONFIG_ENV, CANDIDATE_KNOWLEDGE_ROOT_ENV, CaptureAgentCandidateWorkspaceOptions, CapturedAgentCandidateWorkspace, CreateAgentCandidateWorkspacePortOptions, CreateProtectedAgentCandidateModelPortOptions, DisposePreparedAgentCandidateOptions, FileAgentCandidateExecutionClaimStore, FileAgentCandidateExecutionClaimStoreOptions, RecoverExpiredAgentCandidateOptions, buildAgentCandidateBundle, candidateExecutionClaim, candidateKnowledgeExecutionPaths, captureAgentCandidateWorkspace, captureAgentCandidateWorkspaceFiles, createAgentCandidateWorkspacePort, createProtectedAgentCandidateModelPort, disposePreparedAgentCandidateExecution, persistCandidateOutputArtifact, recoverExpiredAgentCandidateExecution, sealAgentCandidateBundle, verifyAgentCandidateBundle } from './candidate-execution/index.js';
6
+ export { a as AgentCandidateExecutionAttemptRecord, b as AgentCandidateExecutionAttemptRef, c as AgentCandidateExecutionClaim, d as AgentCandidateExecutionClaimResult, A as AgentCandidateExecutionClaimStore, e as AgentCandidateExecutionCleanupHandles, f as AgentCandidateExecutionFailureClass, g as AgentCandidateExecutionFinishResult, h as AgentCandidateExecutionLease, i as AgentCandidateExecutionPhase, j as AgentCandidateExecutionPhaseResult, k as AgentCandidateExecutionRecoveryEvidence, l as AgentCandidateExecutionStageResult, m as AgentCandidateExecutionTerminalRecord, n as AgentCandidateExecutionTerminalResult, o as AgentCandidatePreparationEvidence, q as AgentCandidateRetryRejection, E as ExecutePreparedAgentCandidateOptions, I as InMemoryAgentCandidateExecutionClaimStore, P as PrepareAgentCandidateExecutionOptions, r as applyExactAgentProfileDiff, s as executePreparedAgentCandidate, t as parseExactAgentProfile, u as parseExactAgentProfileDiff, v as prepareAgentCandidateExecution } from './profile-DbfaMTdk.js';
7
+ export { f as AgentCandidateArtifactPort, a as AgentCandidateBenchmarkGraderPort, g as AgentCandidateContainerPort, e as AgentCandidateExecutionPorts, h as AgentCandidateExecutorFinalCapture, i as AgentCandidateExecutorMemoryCapture, A as AgentCandidateExecutorPort, j as AgentCandidateExecutorProfileFile, k as AgentCandidateExecutorRequest, l as AgentCandidateExecutorStopRequest, m as AgentCandidateExecutorTaskOutcomeCapture, n as AgentCandidateExecutorWorkspaceFile, o as AgentCandidateExecutorWorkspaceInput, p as AgentCandidateMemoryPort, q as AgentCandidateMemoryResetResult, r as AgentCandidateModelLimits, s as AgentCandidateModelPort, b as AgentCandidateOutputArtifactPort, t as AgentCandidateOutputPurpose, u as AgentCandidateProtectedModelActivation, v as AgentCandidateProtectedModelReservation, w as AgentCandidateProtectedModelSettlement, x as AgentCandidateProtectedRunCapture, y as AgentCandidateRepositoryPort, c as AgentCandidateRunFinalization, d as AgentCandidateTaskExecution, z as AgentCandidateVerificationPorts, B as AgentCandidateWorkspacePort, C as CANDIDATE_TRACE_ENV, D as CANDIDATE_TRACE_TAGS, E as CanonicalCandidateDocument, P as PreparedAgentCandidateExecution, F as PreparedAgentCandidateInstruction, G as PreparedAgentCandidateKnowledge, H as PreparedAgentCandidateLaunch, I as PreparedAgentCandidateTrace, R as ResolvedAgentCandidateContainer, V as VerifiedAgentCandidate, J as VerifiedAgentCandidateTaskOutcome } from './types-CWqfCO8s.js';
7
8
  export { AuthSource, BackendCallPolicy, CircuitBreakerConfig, CircuitBreakerState, CircuitOpenError, Conversation, ConversationDriveState, ConversationJournal, ConversationJournalEntry, ConversationParticipant, ConversationPolicy, ConversationResult, ConversationStreamEvent, ConversationTurn, D1DatabaseLike, D1StmtLike, DEFAULT_MAX_DEPTH, DeadlineExceededError, FORWARD_HEADERS, FileConversationJournal, ForwardHeaderName, HaltContext, HaltPredicate, HaltReason, HaltSignal, InMemoryConversationJournal, PersonaConversationResult, PersonaDriver, PropagatedHeaders, RetryBackoff, RetryableErrorPredicate, RunConversationOptions, RunPersonaConfig, RunPersonaConversationOptions, SqlAdapter, SqlConversationJournal, TurnOrder, buildForwardHeaders, computeBackoff, createConversationBackend, d1ToSqlAdapter, defaultIsRetryable, defineConversation, isDepthExceeded, makePerAttemptSignal, readDepth, runConversation, runConversationStream, runPersonaConversation, runPersonaDispatch, sleep, slugifySpeaker, turnId } from './conversation.js';
8
- import { C as CandidateGenerator } from './agentic-generator-DDMM45kZ.js';
9
- export { A as AGENTIC_PROFILE_RESOURCE_ROOT, a as AgenticGeneratorOptions, b as AgenticGeneratorShotDisposition, c as AgenticGeneratorShotExecution, d as AgenticGeneratorShotReceipt, I as ImprovementDriverOptions, M as ManagedImprovementDriver, V as Verifier, e as VerifyResult, f as agenticGenerator, g as commandVerifier, i as improvementDriver } from './agentic-generator-DDMM45kZ.js';
10
- export { c as ImproveCodeOptions, d as ImproveMemoryOptions, a as ImproveOptions, b as ImproveResult, e as ImproveSkillsOptions, I as ImproveSurface, f as applyImprovementWinnerToProfile, i as improve } from './improve-BN3HyXIO.js';
11
- export { M as McpServeSpec, m as mcpServeVerifier } from './mcp-serve-verifier-DQQDbuyz.js';
9
+ import { V as Verifier, C as CandidateGenerator } from './improve-g75IE2Cx.js';
10
+ export { A as AGENTIC_PROFILE_RESOURCE_ROOT, b as AgenticGeneratorOptions, c as AgenticGeneratorShotDisposition, d as AgenticGeneratorShotExecution, e as AgenticGeneratorShotReceipt, f as ImproveCodeOptions, I as ImproveOptions, a as ImproveResult, g as ImproveSkillsOptions, h as ImproveSurface, i as ImprovementCandidate, j as ImprovementDriverOptions, M as ManagedImprovementDriver, k as VerifyResult, l as agenticGenerator, m as commandVerifier, n as improve, o as improvementDriver } from './improve-g75IE2Cx.js';
12
11
  import { ProposeContext, SurfaceProposer } from '@tangle-network/agent-eval/campaign';
13
- import { AgentProfileDiff, AgentProfile } from '@tangle-network/agent-interface';
12
+ import { AgentProfile, AgentProfileDiff } from '@tangle-network/agent-interface';
13
+ export { AgentCandidateBenchmarkGraderIdentity } from '@tangle-network/agent-interface';
14
14
  import { Scenario, SelfImproveOptions } from '@tangle-network/agent-eval/contract';
15
- import { S as SurfaceImprovementEdit } from './improvement-adapter-BieWeK5J.js';
16
- import { I as ImprovementAdapter } from './types-BC3bZpH0.js';
17
- 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';
18
- 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-BRQSQdHa.js';
15
+ import { S as SurfaceImprovementEdit } from './improvement-adapter-HAZz-7vK.js';
16
+ import { I as ImprovementProposalSource } from './types-CmYCMbFT.js';
17
+ export { AgentKnowledgeReadinessCheckOptions, CreateKnowledgeImprovementActivationExecutorOptions, KnowledgeImprovementActivationExecutor, KnowledgeImprovementCandidatePair, KnowledgeImprovementExperimentBundles, KnowledgeImprovementJobMeasurement, KnowledgeImprovementJobResult, KnowledgeReadinessCheck, KnowledgeReadinessCheckInput, KnowledgeReadinessCheckResult, RESEARCH_SUPERVISOR_SYSTEM_PROMPT, RunKnowledgeImprovementJobOptions, SupervisedKnowledgeUpdateInput, SupervisedKnowledgeUpdateOptions, SupervisedKnowledgeUpdateResult, SupervisedKnowledgeUpdater, buildKnowledgeImprovementExperimentBundles, createAgentKnowledgeReadinessCheck, createKnowledgeImprovementActivationExecutor, createSupervisedKnowledgeUpdater, formatSupervisedKnowledgeTask, knowledgeReadinessDeliverable, runKnowledgeImprovementJob, runSupervisedKnowledgeUpdate } from './knowledge.js';
18
+ 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-Cn1N2rRo.js';
19
19
  export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from './openai-tools-fnj6SRVg.js';
20
- 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 RuntimeEventOtelOptions, bb as buildLoopOtelSpans, bc as buildLoopSpanNodes, bd as buildRuntimeEventOtelSpans, be as createOtelExporter, bf as exportEvalRuns, bg as loopEventToOtelSpan } from './coordination-Dr_axlAf.js';
20
+ 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 RuntimeEventOtelOptions, bb as buildLoopOtelSpans, bc as buildLoopSpanNodes, bd as buildRuntimeEventOtelSpans, be as createOtelExporter, bf as exportEvalRuns, bg as loopEventToOtelSpan } from './coordination-BFE3Den7.js';
21
21
  import { K as KnowledgeReadinessDecision, A as AgentBackendInput, c as AgentExecutionBackend, h as RunAgentTaskOptions, i as AgentTaskRunResult, j as RunAgentTaskStreamOptions, R as RuntimeStreamEvent, k as RuntimeSessionStore, l as RuntimeSession } from './types-BwoZWq-i.js';
22
22
  export { m as AgentAdapter, d as AgentBackendContext, n as AgentKnowledgeProvider, e as AgentRuntimeEvent, o as AgentRuntimeEventSink, p as AgentTaskContext, g as AgentTaskSpec, f as AgentTaskStatus, B as BackendErrorDetail, b as OpenAIChatResponseFormat, O as OpenAIChatTool, a as OpenAIChatToolChoice } from './types-BwoZWq-i.js';
23
- import { R as RuntimeHooks } from './types-ByAYqlVb.js';
24
- export { c as RuntimeDecisionEvidenceRef, d as RuntimeDecisionKind, e as RuntimeDecisionPoint, f as RuntimeHookContext, g as RuntimeHookErrorContext, h as RuntimeHookEvent, i as RuntimeHookPhase, j as RuntimeHookTarget, k as RuntimeRunHandle, l as RuntimeRunPersistenceAdapter, m as RuntimeRunRow, n as composeRuntimeHooks, o as defineRuntimeHooks, p as notifyRuntimeDecisionPoint, q as notifyRuntimeHookEvent, s as startRuntimeRun } from './types-ByAYqlVb.js';
23
+ import { R as RuntimeHooks } from './types-B3vAW0Oq.js';
24
+ export { c as RuntimeDecisionEvidenceRef, d as RuntimeDecisionKind, e as RuntimeDecisionPoint, f as RuntimeHookContext, g as RuntimeHookErrorContext, h as RuntimeHookEvent, i as RuntimeHookPhase, j as RuntimeHookTarget, k as RuntimeRunHandle, l as RuntimeRunPersistenceAdapter, m as RuntimeRunRow, n as composeRuntimeHooks, o as defineRuntimeHooks, p as notifyRuntimeDecisionPoint, q as notifyRuntimeHookEvent, s as startRuntimeRun } from './types-B3vAW0Oq.js';
25
25
  import { c as RuntimeTelemetryOptions } from './sanitize-BTSsdBXw.js';
26
26
  export { d as RuntimeEventCollector, e as RuntimeStreamEventCollector, S as SanitizedKnowledgeReadinessReport, f as createRuntimeEventCollector, g as createRuntimeStreamEventCollector, s as sanitizeAgentRuntimeEvent, h as sanitizeKnowledgeReadinessReport, i as sanitizeRuntimeStreamEvent } from './sanitize-BTSsdBXw.js';
27
27
  import './local-harness-ZqCx51u7.js';
28
28
  import 'node:child_process';
29
29
  import '@tangle-network/agent-knowledge';
30
- import './supervise-DmYOug5f.js';
31
- import './types-1d5QGK3t.js';
30
+ import './activation-B0ZD7nfX.js';
31
+ import './supervise-BLPI50-w.js';
32
+ import './types-CmnA2iL3.js';
32
33
  import '@tangle-network/sandbox';
33
- import './completion-gate-D1gX1-hg.js';
34
+ import './completion-gate-C80jiRfN.js';
34
35
  import '@tangle-network/agent-profile-materialize';
35
36
  import './kb-gate-CwHO0vz6.js';
36
- import './worktree-fanout-CPprU-qI.js';
37
+ import './worktree-fanout-DCA3G4bO.js';
37
38
  import './substrate-DO2GHNg2.js';
38
39
  import './environment-provider.js';
39
40
  import '@tangle-network/agent-interface/environment-provider';
@@ -263,16 +264,42 @@ declare function toolBuildPrompt(args: FindingsArg): string;
263
264
  /** Build the starting instruction for a coder agent tasked with implementing a new MCP server. */
264
265
  declare function mcpBuildPrompt(args: FindingsArg): string;
265
266
 
266
- interface AgentProfileDiffProposal {
267
- diff: AgentProfileDiff;
268
- label?: string;
269
- rationale?: string;
267
+ /**
268
+ * `mcpServeVerifier` — the intrinsic verifier for a built MCP server: the
269
+ * boot-and-probe checker named in docs/artifact-lifecycle-frontier.md. A
270
+ * generated MCP server is only a candidate if it actually *serves* — so this
271
+ * boots it over stdio (the default local MCP transport) and runs the real
272
+ * handshake: `initialize` → `notifications/initialized` → `tools/list`, and
273
+ * asserts the server answers with at least `minTools` tools.
274
+ *
275
+ * Outcomes follow the `Verifier` contract: a server that fails to start, exits
276
+ * early, errors the handshake, times out, or exposes no tools is a FAILED
277
+ * candidate (`{ok:false}`, fed back into the next generation shot); a missing
278
+ * start binary or spawn fault THROWS (a setup bug, never a silent fallback).
279
+ *
280
+ * Protocol matches the runtime's own stdio MCP server (src/mcp/server.ts):
281
+ * newline-delimited JSON-RPC 2.0, protocol version 2024-11-05.
282
+ */
283
+
284
+ interface McpServeSpec {
285
+ /** Command that starts the built MCP server in the worktree (stdio transport). */
286
+ command: string;
287
+ args?: string[];
288
+ /** Extra env for the server process (merged over `process.env`). */
289
+ env?: Record<string, string>;
290
+ /** Handshake timeout (ms). Default 30s. */
291
+ timeoutMs?: number;
292
+ /** Minimum tools the server must expose to pass. Default 1. */
293
+ minTools?: number;
270
294
  }
295
+ /** Build a `Verifier` that boots a generated MCP server over stdio and checks it exposes tools. */
296
+ declare function mcpServeVerifier(spec: McpServeSpec): Verifier;
297
+
271
298
  type ProfileDiffProposerContext<TFindings = unknown> = ProposeContext<TFindings> & {
272
299
  profile: AgentProfile;
273
300
  };
274
301
  interface ProfileDiffProposerOptions<TFindings = unknown> {
275
- proposeDiffs(context: ProfileDiffProposerContext<TFindings>): Promise<readonly AgentProfileDiffProposal[]> | readonly AgentProfileDiffProposal[];
302
+ proposeDiffs(context: ProfileDiffProposerContext<TFindings>): Promise<readonly AgentProfileDiff[]> | readonly AgentProfileDiff[];
276
303
  }
277
304
  /**
278
305
  * Turn exact AgentProfileDiffs from any source into full profile candidates for
@@ -286,7 +313,7 @@ declare function profileDiffProposer<TFindings = unknown>(options: ProfileDiffPr
286
313
  * `rawTraceDistiller` — the meta-harness `analyzeGeneration` producer.
287
314
  *
288
315
  * The default `generationFailureDistiller` (in `improve.ts`) COMPRESSES each
289
- * generation's failing cells into ~400-char structured findings before the next
316
+ * generation's failing cells into ~1500-char structured findings before the next
290
317
  * proposal round. That is the ACE-style recipe: a small summary is the proposer's
291
318
  * whole view of what went wrong. This producer does the opposite — the
292
319
  * meta-harness recipe (yoonholee.com/meta-harness): it does NOT summarize. It
@@ -294,7 +321,7 @@ declare function profileDiffProposer<TFindings = unknown>(options: ProfileDiffPr
294
321
  * disk under `runDir` — the durable per-cell `spans.jsonl` event logs,
295
322
  * `cached-result.json` scores, and any artifacts the substrate persisted — and
296
323
  * instructs the agent to `grep`/`cat`/`ls` them to diagnose the failures itself
297
- * (up to the harness's full context, ~millions of tokens, vs a ~400-char digest).
324
+ * (up to the harness's full context, ~millions of tokens, vs a ~1500-char digest).
298
325
  *
299
326
  * It emits `AnalystFinding[]` so it drops into the SAME `opts.analyzeGeneration`
300
327
  * slot the default distiller uses, and renders through the same
@@ -353,7 +380,7 @@ declare function rawTraceDistiller<TScenario extends Scenario = Scenario, TArtif
353
380
  /**
354
381
  *
355
382
  * `reflectiveGenerator` — the cheap, no-sandbox `CandidateGenerator`. It drafts
356
- * surface edits via the existing improvement adapter (`proposeFromFindings`,
383
+ * surface edits via the existing improvement proposer (`proposeFromFindings`,
357
384
  * one LLM patch per finding) and applies them as ONE coherent improvement into
358
385
  * the candidate worktree. `maxShots` is ignored — reflection is single-shot by
359
386
  * construction (the patches are already drafted).
@@ -366,7 +393,7 @@ declare function rawTraceDistiller<TScenario extends Scenario = Scenario, TArtif
366
393
  */
367
394
 
368
395
  interface ReflectiveGeneratorOptions {
369
- improvementAdapter: ImprovementAdapter<SurfaceImprovementEdit>;
396
+ improvementProposalSource: ImprovementProposalSource<SurfaceImprovementEdit>;
370
397
  }
371
398
  /** Cheap no-sandbox `CandidateGenerator` (the `shots=1` setting): draft surface edits via the improvement adapter and apply them as one coherent candidate. */
372
399
  declare function reflectiveGenerator(opts: ReflectiveGeneratorOptions): CandidateGenerator;
@@ -796,4 +823,4 @@ interface StreamToolLoopOptions<Raw> {
796
823
  * `capped` if it stops for any non-completed reason with calls still pending. */
797
824
  declare function streamToolLoop<Raw>(opts: StreamToolLoopOptions<Raw>): AsyncGenerator<StreamToolLoopYield<Raw>, void, unknown>;
798
825
 
799
- export { AgentBackendInput, type AgentBackendKind, AgentExecutionBackend, type AgentProfileDiffProposal, AgentTaskRunResult, BackendTransportError, CandidateGenerator, type ChatStreamEvent, type ChatTurnHooks, type ChatTurnIdentity, type ChatTurnProducer, type ChatTurnResult, DEFAULT_ROUTER_BASE_URL, InMemoryRuntimeSessionStore, type ModelInfo, PlannerError, type ProfileDiffProposerContext, type ProfileDiffProposerOptions, type RawTraceDistillerOptions, type ReflectiveGeneratorOptions, type ResolveAgentBackendOptions, type ResolvedChatModel, type RouterEnv, type RunChatTurnInput, type RunToolLoopOptions, RuntimeHooks, RuntimeRunStateError, RuntimeSessionStore, RuntimeStreamEvent, RuntimeTelemetryOptions, type StreamToolLoopOptions, type StreamToolLoopYield, type ToolCallOutcome, type ToolLoopAssistantToolCall, type ToolLoopCall, type ToolLoopEvent, type ToolLoopMessage, type ToolLoopResult, type ToolLoopStopReason, applyRunRecordDefaults, cleanModelId, createOpenAICompatibleBackend, decideKnowledgeReadiness, deriveExecutionId, getModels, handleChatTurn, mcpBuildPrompt, profileDiffProposer, rawTraceDistiller, readinessServerSentEvent, reflectiveGenerator, resolveAgentBackend, resolveChatModel, resolveRouterBaseUrl, runAgentTask, runAgentTaskStream, runToolLoop, runtimeStreamServerSentEvent, streamToolLoop, toolBuildPrompt, validateChatModelId };
826
+ export { AgentBackendInput, type AgentBackendKind, AgentExecutionBackend, AgentTaskRunResult, BackendTransportError, CandidateGenerator, type ChatStreamEvent, type ChatTurnHooks, type ChatTurnIdentity, type ChatTurnProducer, type ChatTurnResult, DEFAULT_ROUTER_BASE_URL, InMemoryRuntimeSessionStore, type McpServeSpec, type ModelInfo, PlannerError, type ProfileDiffProposerContext, type ProfileDiffProposerOptions, type RawTraceDistillerOptions, type ReflectiveGeneratorOptions, type ResolveAgentBackendOptions, type ResolvedChatModel, type RouterEnv, type RunChatTurnInput, type RunToolLoopOptions, RuntimeHooks, RuntimeRunStateError, RuntimeSessionStore, RuntimeStreamEvent, RuntimeTelemetryOptions, type StreamToolLoopOptions, type StreamToolLoopYield, type ToolCallOutcome, type ToolLoopAssistantToolCall, type ToolLoopCall, type ToolLoopEvent, type ToolLoopMessage, type ToolLoopResult, type ToolLoopStopReason, Verifier, applyRunRecordDefaults, cleanModelId, createOpenAICompatibleBackend, decideKnowledgeReadiness, deriveExecutionId, getModels, handleChatTurn, mcpBuildPrompt, mcpServeVerifier, profileDiffProposer, rawTraceDistiller, readinessServerSentEvent, reflectiveGenerator, resolveAgentBackend, resolveChatModel, resolveRouterBaseUrl, runAgentTask, runAgentTaskStream, runToolLoop, runtimeStreamServerSentEvent, streamToolLoop, toolBuildPrompt, validateChatModelId };