@tangle-network/agent-runtime 0.79.1 → 0.79.3

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.
@@ -8,7 +8,7 @@ import {
8
8
  DELEGATION_STATUS_DESCRIPTION,
9
9
  DELEGATION_STATUS_INPUT_SCHEMA,
10
10
  DELEGATION_STATUS_TOOL_NAME
11
- } from "./chunk-TSDKBFZP.js";
11
+ } from "./chunk-KRULXIWS.js";
12
12
 
13
13
  // src/mcp/openai-tools.ts
14
14
  function buildTool(name, description, parameters) {
@@ -45,4 +45,4 @@ export {
45
45
  mcpToolsForRuntimeMcp,
46
46
  mcpToolsForRuntimeMcpSubset
47
47
  };
48
- //# sourceMappingURL=chunk-SONQUREI.js.map
48
+ //# sourceMappingURL=chunk-PVPFDTO3.js.map
@@ -5,8 +5,8 @@ import { e as LoopTraceEmitter, c as LoopTraceEvent, S as SandboxClient, A as Ag
5
5
  import { SandboxEvent, SandboxInstance, BackendType } from '@tangle-network/sandbox';
6
6
  import { AgentEvalError } from '@tangle-network/agent-eval';
7
7
  import { O as OtelExporter } from './otel-export-BKmNwiCb.js';
8
- import { T as ToolSpec, R as RouterConfig } from './router-client-CMAWGv1h.js';
9
- import { d as DeliverableSpec } from './worktree-CpptK3oF.js';
8
+ import { T as ToolSpec, R as RouterConfig } from './router-client-Ak2IGuXq.js';
9
+ import { G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './worktree-harness-Bmho9SH0.js';
10
10
  import { L as LocalHarness } from './local-harness-DU7yV6mG.js';
11
11
  import { ProviderExecutorOptions, AgentEnvironmentProviderRegistry } from './environment-provider.js';
12
12
  import { AgentEnvironmentProvider } from '@tangle-network/agent-interface/environment-provider';
@@ -1608,11 +1608,35 @@ interface CliSeam {
1608
1608
  */
1609
1609
  interface CliWorktreeSeam {
1610
1610
  repoRoot: string;
1611
- harness: LocalHarness;
1611
+ /** Local CLI harness transport. Omit when `bridge` is set. */
1612
+ harness?: LocalHarness;
1612
1613
  taskPrompt: string;
1613
1614
  runId?: string;
1614
1615
  baseRef?: string;
1615
1616
  harnessTimeoutMs?: number;
1617
+ testCmd?: string;
1618
+ typecheckCmd?: string;
1619
+ checkTimeoutMs?: number;
1620
+ checkOutputCap?: number;
1621
+ budgetExempt?: boolean;
1622
+ /** Live cli-bridge transport inside the worktree. When set, the worktree leaf accepts
1623
+ * `deliver()` messages and resumes the same bridge session in this worktree cwd. */
1624
+ bridge?: CliWorktreeBridgeSeam;
1625
+ /** Test seam — forwarded to worktree helpers. */
1626
+ runGit?: GitRunner;
1627
+ /** Test seam — forwarded to verification checks. */
1628
+ runCommand?: WorktreeCheckRunner;
1629
+ }
1630
+ interface CliWorktreeBridgeSeam {
1631
+ bridgeUrl: string;
1632
+ bridgeBearer: string;
1633
+ /** Bridge model/harness id. Defaults to the profile's model hint when omitted. */
1634
+ model?: string;
1635
+ agentProfile?: Record<string, unknown>;
1636
+ timeoutMs?: number;
1637
+ /** Stable cli-bridge session id. Defaults to `bridge-worktree-${runId}`. */
1638
+ sessionId?: string;
1639
+ maxTurns?: number;
1616
1640
  }
1617
1641
  /**
1618
1642
  * cli-bridge seam. A local OpenAI-compatible bridge that fronts harness CLIs
@@ -1632,6 +1656,8 @@ interface BridgeSeam {
1632
1656
  bridgeUrl: string;
1633
1657
  bridgeBearer: string;
1634
1658
  model: string;
1659
+ /** Optional working directory forwarded to cli-bridge and persisted with the session. */
1660
+ cwd?: string;
1635
1661
  agentProfile?: Record<string, unknown>;
1636
1662
  timeoutMs?: number;
1637
1663
  /** Stable, caller-owned cli-bridge session id for harness-side resume. Defaults
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ import { Scenario as Scenario$1, SurfaceProposer, JudgeConfig, MutableSurface, D
9
9
  import { AgentProfile as AgentProfile$1 } from '@tangle-network/agent-interface';
10
10
  import { S as SurfaceImprovementEdit } from './improvement-adapter-CioiEE2z.js';
11
11
  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-DCr5OMe5.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-C4X0FZ2Z.js';
13
13
  export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from './openai-tools-B-3v06BE.js';
14
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';
15
15
  import '@tangle-network/sandbox';
@@ -17,8 +17,8 @@ import './local-harness-DU7yV6mG.js';
17
17
  import 'node:child_process';
18
18
  import './kb-gate-CuzMYGYM.js';
19
19
  import './types-C1sozrte.js';
20
- import './worktree-fanout-CtQrRDME.js';
21
- import './worktree-CpptK3oF.js';
20
+ import './worktree-fanout-CXGzHET4.js';
21
+ import './worktree-harness-Bmho9SH0.js';
22
22
 
23
23
  /**
24
24
  * @stable
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  mcpToolsForRuntimeMcp,
3
3
  mcpToolsForRuntimeMcpSubset
4
- } from "./chunk-SONQUREI.js";
4
+ } from "./chunk-PVPFDTO3.js";
5
5
  import {
6
6
  DEFAULT_ROUTER_BASE_URL,
7
7
  cleanModelId,
@@ -20,16 +20,16 @@ import {
20
20
  runLoopRunnerCli,
21
21
  selfImproveLoopRunner,
22
22
  worktreeLoopRunner
23
- } from "./chunk-2DS6T46I.js";
23
+ } from "./chunk-63MHOCIE.js";
24
24
  import "./chunk-FNMGYYSS.js";
25
- import "./chunk-75V2XXYJ.js";
25
+ import "./chunk-AG335EXG.js";
26
26
  import {
27
27
  assertModelAllowed,
28
28
  composeRuntimeHooks,
29
29
  defineRuntimeHooks,
30
30
  notifyRuntimeDecisionPoint,
31
31
  notifyRuntimeHookEvent
32
- } from "./chunk-TSDKBFZP.js";
32
+ } from "./chunk-KRULXIWS.js";
33
33
  import {
34
34
  INTELLIGENCE_WIRE_VERSION,
35
35
  buildLoopOtelSpans,
@@ -1,6 +1,6 @@
1
1
  import { c as LoopTraceEvent } from './types-BF-MEsQB.js';
2
2
  import { AgentProfileMcpServer } from '@tangle-network/agent-interface';
3
- import { T as ToolSpec } from './router-client-CMAWGv1h.js';
3
+ import { T as ToolSpec } from './router-client-Ak2IGuXq.js';
4
4
  import '@tangle-network/agent-eval';
5
5
  import '@tangle-network/sandbox';
6
6
 
@@ -3,7 +3,7 @@ import { SelfImproveOptions, SelfImproveResult } from '@tangle-network/agent-eva
3
3
  import { R as RunAnalystLoopOpts, a as RunAnalystLoopResult } from './types-BC3bZpH0.js';
4
4
  import { F as FactCandidate, C as CreateKbGateOptions } from './kb-gate-CuzMYGYM.js';
5
5
  import { B as Budget } from './types-C1sozrte.js';
6
- import { A as AuthoredHarness, W as WinnerStrategy, a as WorktreeFanoutOptions, b as WorktreePatchArtifact } from './worktree-fanout-CtQrRDME.js';
6
+ import { A as AuthoredHarness, W as WinnerStrategy, a as WorktreeFanoutOptions, b as WorktreePatchArtifact } from './worktree-fanout-CXGzHET4.js';
7
7
 
8
8
  /**
9
9
  * @experimental
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- export { L as LoopRunnerCliArgs, e as LoopRunnerCliResult, p as parseLoopRunnerArgv, k as runLoopRunnerCli } from './loop-runner-bin-DCr5OMe5.js';
2
+ export { L as LoopRunnerCliArgs, e as LoopRunnerCliResult, p as parseLoopRunnerArgv, k as runLoopRunnerCli } from './loop-runner-bin-C4X0FZ2Z.js';
3
3
  import '@tangle-network/agent-eval/campaign';
4
4
  import '@tangle-network/agent-eval/contract';
5
5
  import './types-BC3bZpH0.js';
@@ -9,7 +9,7 @@ import './types-C1sozrte.js';
9
9
  import '@tangle-network/agent-interface';
10
10
  import '@tangle-network/sandbox';
11
11
  import './types-BF-MEsQB.js';
12
- import './worktree-fanout-CtQrRDME.js';
13
- import './worktree-CpptK3oF.js';
12
+ import './worktree-fanout-CXGzHET4.js';
13
+ import './worktree-harness-Bmho9SH0.js';
14
14
  import './local-harness-DU7yV6mG.js';
15
15
  import 'node:child_process';
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  parseLoopRunnerArgv,
4
4
  runLoopRunnerCli
5
- } from "./chunk-2DS6T46I.js";
5
+ } from "./chunk-63MHOCIE.js";
6
6
  import "./chunk-FNMGYYSS.js";
7
- import "./chunk-75V2XXYJ.js";
8
- import "./chunk-TSDKBFZP.js";
7
+ import "./chunk-AG335EXG.js";
8
+ import "./chunk-KRULXIWS.js";
9
9
  import "./chunk-VMNEQHJR.js";
10
10
  import "./chunk-Z3RRRPRB.js";
11
11
  import "./chunk-IODKUOBA.js";
package/dist/loops.d.ts CHANGED
@@ -4,20 +4,20 @@ import { SandboxEvent, SandboxInstance, CreateSandboxOptions } from '@tangle-net
4
4
  export { AgentProfile, CreateSandboxOptions, SandboxEvent, SandboxInstance } from '@tangle-network/sandbox';
5
5
  import { d as ResultBlobStore, S as SpawnJournal, N as NodeId, j as SpawnEvent, E as ExecutorFactory, c as Agent, B as Budget, i as Scope, g as Settled, f as SupervisedResult, h as Spend, U as UsageEvent, b as ExecutorRegistry, k as Supervisor } from './types-C1sozrte.js';
6
6
  export { A as AgentSpec, a as Executor, l as ExecutorContext, m as ExecutorResult, n as SupervisorOpts, T as TreeView, W as WidenGate } from './types-C1sozrte.js';
7
- import { ak as MakeWorkerAgent, o as CoordinationTools, A as AnalystRegistry, n as CoordinationEvent, ar as QuestionPolicy, a$ as ExecutorConfig } from './coordination-BoEPhGas.js';
8
- export { b0 as BusEvent, b1 as BusRecord, b2 as BusStats, b3 as EventBus, b4 as ProviderSeam, b5 as PublishOptions, b6 as cliWorktreeExecutor, b7 as createEventBus, b8 as createExecutor, b9 as createExecutorRegistry } from './coordination-BoEPhGas.js';
7
+ import { ak as MakeWorkerAgent, A as AnalystRegistry, o as CoordinationTools, n as CoordinationEvent, ar as QuestionPolicy, a$ as ExecutorConfig } from './coordination-DCmljYDf.js';
8
+ export { b0 as BusEvent, b1 as BusRecord, b2 as BusStats, b3 as EventBus, b4 as ProviderSeam, b5 as PublishOptions, b6 as cliWorktreeExecutor, b7 as createEventBus, b8 as createExecutor, b9 as createExecutorRegistry } from './coordination-DCmljYDf.js';
9
9
  import { R as RuntimeHooks, I as Iteration, S as SandboxClient, W as Driver, A as AgentRunSpec, b as OutputAdapter, V as Validator, E as ExecCtx, X as LoopWinner, Y as LoopLineageOptions, Z as LoopResult, L as LoopTokenUsage, a as RuntimeStreamEvent, _ as MountRecorder } from './types-BF-MEsQB.js';
10
10
  export { $ as LoopDecisionPayload, a0 as LoopEndedPayload, a1 as LoopIterationDispatchPayload, a2 as LoopIterationEndedPayload, a3 as LoopIterationStartedPayload, a4 as LoopPlanDescription, a5 as LoopPlanPayload, d as LoopSandboxPlacement, a6 as LoopStartedPayload, a7 as LoopTeardownFailedPayload, e as LoopTraceEmitter, c as LoopTraceEvent, a8 as MountManifestEntry, a9 as RunProvenance, aa as SelectionReceipt, ab as ValidationCtx } from './types-BF-MEsQB.js';
11
11
  export { AgentEnvironmentProviderRef, AgentEnvironmentProviderRegistry, ProviderAsSandboxClientOptions, ProviderExecutorOptions, SandboxClientProviderOptions, createAgentEnvironmentProviderRegistry, providerAsExecutor, providerAsSandboxClient, resolveAgentEnvironmentProvider, sandboxClientAsProvider } from './environment-provider.js';
12
- import { C as CorpusRecord, c as Corpus, O as Outcome, S as ScopeAnalyzeInput, d as AssertTraceDerivedFindings, e as SteerContext, f as ScopeAnalyst, F as FanoutOptions, g as CombinatorShape, h as ScopeWidenGate, L as LoopUntilSpec, P as PanelSpec, i as PipelineStage, W as WinnerStrategy, j as FanoutWinnerSelector, V as VerifySpec, k as WidenSpec, l as CorpusFilter, R as RenderCorpusToInstructionsOptions, D as DefinePersonaInput, m as Persona, n as RunPersonifiedOptions, o as ShapeRegistry, p as LoopShape, E as EqualKArm, q as EqualKOnCostOptions, r as EqualKVerdict, T as TrajectoryReportOptions, s as TrajectoryReport } from './worktree-fanout-CtQrRDME.js';
13
- export { A as AuthoredHarness, t as DefinePersona, u as EqualKOnCost, v as Fanout, w as FanoutSynthesis, x as FlatWidenGate, y as LoopUntil, z as LoopUntilState, B as Panel, G as PanelJudge, H as PanelVerdict, I as PatchDeliverableOptions, J as PersonaContext, K as PersonaExecutors, M as Pipeline, N as RenderCorpusToInstructions, Q as RunPersonified, U as ShapeBudget, X as ShapeContext, Y as TrajectoryNode, Z as TrajectoryReportFn, _ as Verify, $ as Widen, a0 as WidenDecision, a1 as WidenLineage, a2 as WorktreeCliExecutorOptions, a3 as WorktreeCommandResult, a as WorktreeFanoutOptions, b as WorktreePatchArtifact, a4 as createWorktreeCliExecutor, a5 as patchDelivered, a6 as worktreeFanout } from './worktree-fanout-CtQrRDME.js';
12
+ import { C as CorpusRecord, c as Corpus, O as Outcome, S as ScopeAnalyzeInput, d as AssertTraceDerivedFindings, e as SteerContext, f as ScopeAnalyst, F as FanoutOptions, g as CombinatorShape, h as ScopeWidenGate, L as LoopUntilSpec, P as PanelSpec, i as PipelineStage, W as WinnerStrategy, j as FanoutWinnerSelector, V as VerifySpec, k as WidenSpec, l as CorpusFilter, R as RenderCorpusToInstructionsOptions, D as DefinePersonaInput, m as Persona, n as RunPersonifiedOptions, o as ShapeRegistry, p as LoopShape, E as EqualKArm, q as EqualKOnCostOptions, r as EqualKVerdict, T as TrajectoryReportOptions, s as TrajectoryReport } from './worktree-fanout-CXGzHET4.js';
13
+ export { A as AuthoredHarness, t as DefinePersona, u as EqualKOnCost, v as Fanout, w as FanoutSynthesis, x as FlatWidenGate, y as LoopUntil, z as LoopUntilState, B as Panel, G as PanelJudge, H as PanelVerdict, I as PatchDeliverableOptions, J as PersonaContext, K as PersonaExecutors, M as Pipeline, N as RenderCorpusToInstructions, Q as RunPersonified, U as ShapeBudget, X as ShapeContext, Y as TrajectoryNode, Z as TrajectoryReportFn, _ as Verify, $ as Widen, a0 as WidenDecision, a1 as WidenLineage, a2 as WorktreeCliExecutorOptions, a as WorktreeFanoutOptions, b as WorktreePatchArtifact, a3 as createWorktreeCliExecutor, a4 as patchDelivered, a5 as worktreeFanout } from './worktree-fanout-CXGzHET4.js';
14
14
  import { Scenario, ProfileDispatchFn } from '@tangle-network/agent-eval/campaign';
15
15
  import { b as AnalystRegistryLike } from './types-BC3bZpH0.js';
16
16
  import { AgentProfile as AgentProfile$1 } from '@tangle-network/agent-interface';
17
- import { R as RouterConfig, a as ToolLoopChat } from './router-client-CMAWGv1h.js';
18
- export { b as RouterChatResult, c as RouterChatToolsResult, d as RouterToolCall, e as RouterToolLoopResult, T as ToolSpec, r as routerBrain, f as routerChatWithTools, g as routerChatWithUsage, h as routerToolLoop } from './router-client-CMAWGv1h.js';
19
- import { d as DeliverableSpec } from './worktree-CpptK3oF.js';
20
- export { g as gateOnDeliverable } from './worktree-CpptK3oF.js';
17
+ import { R as RouterConfig, a as ToolLoopChat, b as ToolLoopCompactionOptions } from './router-client-Ak2IGuXq.js';
18
+ export { c as RouterChatResult, d as RouterChatToolsResult, e as RouterToolCall, f as RouterToolLoopResult, g as ToolLoopCompaction, T as ToolSpec, r as routerBrain, h as routerChatWithTools, i as routerChatWithUsage, j as routerToolLoop } from './router-client-Ak2IGuXq.js';
19
+ import { D as DeliverableSpec } from './worktree-harness-Bmho9SH0.js';
20
+ export { g as WorktreeCommandResult, h as gateOnDeliverable } from './worktree-harness-Bmho9SH0.js';
21
21
  import { stuckLoopView, toolWasteView } from '@tangle-network/agent-eval/pipelines';
22
22
  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';
23
23
  import './substrate-rNj6TDc3.js';
@@ -2556,6 +2556,13 @@ interface DriverAgentOptions {
2556
2556
  /** Hard cap on simultaneously-LIVE workers — `spawn_agent` fails closed once this many are in
2557
2557
  * flight (a concurrency fence on top of the conserved-pool fence). Omit/`<= 0` = no cap. */
2558
2558
  readonly maxLiveWorkers?: number;
2559
+ /** The analyst lenses available to the driver. Required for `analyzeOnSettle` (and `run_analyst`).
2560
+ * Unset → no analyst feed (status quo: the driver gets settled outputs, no findings). */
2561
+ readonly analysts?: AnalystRegistry;
2562
+ /** Analyst kind ids run AUTOMATICALLY when a worker settles `done` — each result re-enters as a
2563
+ * `finding` the driver pulls and composes its next steer from. The UP-leg of the self-improving
2564
+ * loop. Omit/empty = no auto-analysis (status quo). Requires `analysts`. */
2565
+ readonly analyzeOnSettle?: ReadonlyArray<string>;
2559
2566
  /** The driver's stance — a string, or built from the task (the worker-driver prompt /
2560
2567
  * the generator). INJECTED so the prompt is a pluggable, optimizable role. */
2561
2568
  readonly systemPrompt: string | ((task: unknown) => string);
@@ -2579,6 +2586,15 @@ interface DriverAgentOptions {
2579
2586
  /** Injected clock for the in-loop absolute-deadline guard — keeps the deadline check
2580
2587
  * deterministic in tests. Defaults to `Date.now`. */
2581
2588
  readonly now?: () => number;
2589
+ /** Give the driver brain a chapter-lifecycle on its OWN context window. The LLM-brain front doors
2590
+ * lose to a dumb-Ralph respawn because the brain re-bills its whole coordination transcript every
2591
+ * turn — the same context overflow a single steered agent suffers, one level up. With this set,
2592
+ * once the brain's running conversation exceeds `thresholdTokens` it distills the accumulated
2593
+ * history to a compact progress note and continues fresh: the supervisor analog of respawning
2594
+ * against external tracking state, except the live `Scope` roster IS the durable state. Default
2595
+ * off (no behavior change). `distill` defaults to a self-summary authored by the brain combined
2596
+ * with the factual settled-worker roster; override to supply your own. */
2597
+ readonly compaction?: ToolLoopCompactionOptions;
2582
2598
  }
2583
2599
  /**
2584
2600
  * Build the intelligent recursive driver. Its `act` is the LLM tool-loop; spawn it as a
@@ -2705,7 +2721,16 @@ interface SupervisorAgentDeps {
2705
2721
  }>;
2706
2722
  /** Runs an `extraTools` call; null/undefined falls through to the coordination dispatch. */
2707
2723
  readonly executeExtraTool?: (name: string, args: Record<string, unknown>) => Promise<string | null | undefined>;
2724
+ /** Analyst lenses available to the driver (both arms). Required for `analyzeOnSettle`. */
2725
+ readonly analysts?: AnalystRegistry;
2726
+ /** Analyst kinds run on each worker-settle → a `finding` the driver composes its next steer from
2727
+ * (the self-improving UP-leg). Unset/empty = status quo (no analyst feed). Requires `analysts`. */
2728
+ readonly analyzeOnSettle?: ReadonlyArray<string>;
2708
2729
  readonly maxTurns?: number;
2730
+ /** Give the supervisor brain a chapter-lifecycle on its OWN context window (router arm only) — it
2731
+ * distills its coordination transcript to a compact progress note once it exceeds the threshold,
2732
+ * instead of re-billing the whole thing every turn. See `DriverAgentOptions.compaction`. */
2733
+ readonly compaction?: ToolLoopCompactionOptions;
2709
2734
  }
2710
2735
  declare function supervisorAgent(profile: SupervisorProfile, deps: SupervisorAgentDeps): Agent<unknown, unknown>;
2711
2736
 
@@ -3078,10 +3103,24 @@ interface SuperviseOptions {
3078
3103
  * flight. The conserved pool bounds TOTAL work; this bounds SIMULTANEOUS work (live boxes/
3079
3104
  * sandboxes a real fleet runs at once). Omit/`<= 0` = no cap (the pool stays the only fence). */
3080
3105
  readonly maxLiveWorkers?: number;
3106
+ /** Analyst lenses available to the driver. Required for `analyzeOnSettle`. Unset → status quo
3107
+ * (the driver receives settled worker outputs, no analyst findings). */
3108
+ readonly analysts?: AnalystRegistry;
3109
+ /** Analyst kind ids run AUTOMATICALLY when a worker settles `done` — each re-enters as a `finding`
3110
+ * the driver pulls (`await_event`) and composes its next steer from. The self-improving UP-leg,
3111
+ * threaded to the driver at this level (propagate to sub-drivers via a recursive `makeWorkerAgent`).
3112
+ * Omit/empty = status quo (no analyst feed). Requires `analysts`. */
3113
+ readonly analyzeOnSettle?: ReadonlyArray<string>;
3081
3114
  /** Worker output store. Defaults to in-memory. */
3082
3115
  readonly blobs?: ResultBlobStore;
3083
3116
  readonly maxDepth?: number;
3084
3117
  readonly maxTurns?: number;
3118
+ /** Give the supervisor brain a chapter-lifecycle on its OWN context window (router arm only): once
3119
+ * its coordination transcript exceeds `thresholdTokens` it distills to a compact progress note and
3120
+ * continues, instead of re-billing the whole transcript every turn (the cost that makes the LLM-brain
3121
+ * front door lose to a dumb-Ralph respawn). The live `Scope` roster is the durable state across
3122
+ * chapters. Default off. `distill` defaults to a brain self-summary + the settled-worker roster. */
3123
+ readonly compaction?: ToolLoopCompactionOptions;
3085
3124
  readonly runId?: string;
3086
3125
  readonly now?: () => number;
3087
3126
  /** Restrict the run to this subset of models. When set, every configured model — the
@@ -3246,4 +3285,4 @@ declare function runInWorkspace<T>(ws: Workspace, body: (cwd: string) => Promise
3246
3285
  commitOnInvalid?: boolean;
3247
3286
  }): Promise<WorkspaceRun<T>>;
3248
3287
 
3249
- export { Agent, AgentRunSpec, type AgenticOptions, type AgenticRunResult, type AgenticSurface, type AgenticTask, type AgenticTool, type AnytimeReport, type AnytimeStrategySummary, type AnytimeTaskCurve, type ApplyContinuation, type ArtifactHandle, AssertTraceDerivedFindings, type AuditIntentInput, type AuditIntentOptions, type AuthorStrategyOptions, type AuthoredProfile, type AuthoredStrategy, type BenchmarkCell, type BenchmarkConfig, type BenchmarkLift, type BenchmarkReport, type BenchmarkStrategySummary, type BenchmarkTaskRow, Budget, type BudgetPool, type BudgetReadout, type ChampionPick, type ChampionPolicy, type CheckpointCapableBox, CombinatorShape, type CompletionAnalyst, type CompletionEvidence, type CompletionPolicy, type CompletionVerdict, CoordinationEvent, type CoordinationMcpHandle, Corpus, CorpusFilter, CorpusRecord, type CreateScopeAnalystOptions, type CriuCapableClient, DefinePersonaInput, type DelegateOptions, type Deliverable, DeliverableSpec, type DriveHarness, Driver, type DriverAgentOptions, type DumbDriverOptions, type Environment, EqualKArm, EqualKOnCostOptions, EqualKVerdict, type EvolutionArchiveNode, type EvolutionAuthor, type EvolutionBandInfo, type EvolutionCandidate, type EvolutionGeneration, type EvolutionReport, ExecCtx, ExecutorConfig, FanoutOptions, FanoutWinnerSelector, FileCorpus, type ForkCapableBox, type GitWorkspaceOptions, type HarvestCorpusOptions, type HarvestFailure, type HarvestReport, InMemoryCorpus, InMemoryResultBlobStore, type InMemoryRunContext, type InMemoryRunContextOptions, InMemorySpawnJournal, type InProcessOnPrompt, type InProcessPromptCtx, type InProcessSandboxClientOptions, type Inbox, type InboxMessage, type IntentAudit, Iteration, type LoopDispatchOptions, LoopLineageOptions, type LoopOptionsForDispatch, LoopResult, LoopShape, LoopTokenUsage, LoopUntilSpec, LoopWinner, type McpEndpoint, type McpEnvironmentOptions, MountRecorder, type NaiveDriverOptions, type Observation, type ObserveInput, type ObserveOptions, type OpenSandboxRunOptions, Outcome, OutputAdapter, PanelSpec, Persona, PipelineStage, type ProfileRichness, type ProfileRichnessThresholds, type PromotionGateOptions, type PromotionVerdict, type RegistryAnalyzeProjection, RenderCorpusToInstructionsOptions, type ReservationTicket, ResultBlobStore, RouterConfig, type RunAgenticOptions, RunPersonifiedOptions, type SandboxCapabilities, SandboxClient, type SandboxLineage, type SandboxLineageHandle, type SandboxRun, SandboxRunAbortError, Scope, ScopeAnalyst, ScopeAnalyzeInput, ScopeWidenGate, type SessionCapableBox, type SessionTraceBox, Settled, ShapeRegistry, type Shell, type ShotPersona, type ShotSpec, Spend, SteerContext, type SteeringDecision, type Strategy, type StrategyCtx, type StrategyEvolutionConfig, type StrategyResult, type SuperviseOptions, SupervisedResult, Supervisor, type SupervisorAgentDeps, type SupervisorProfile, type SurfaceScore, ToolLoopChat, type TraceSource, type TrajectoryAnalysis, TrajectoryReport, TrajectoryReportOptions, type TurnResult, UsageEvent, type UsageSink, Validator, type VerifierEnvironmentOptions, VerifySpec, type WatchTraceOptions, type WaterfallCollector, type WaterfallReport, type WaterfallSpan, WidenSpec, WinnerStrategy, type Workspace, type WorkspaceCommit, type WorkspaceRun, acquireSandbox, adaptiveRefine, analyzeTrace, anytimeReport, asAuthoredProfile, assertModelAllowed, assertStrategyContract, assertTraceDerivedFindings, assessAuthoredProfile, auditIntent, authorStrategy, authoredWorker, breadthStrategy, buildSteerContext, builtinShapes, completionAuthorizes, contentAddress, createBudgetPool, createInMemoryRunContext, createInbox, createMcpEnvironment, createPushTraceSource, createSandboxLineage, createScope, createScopeAnalyst, createShapeRegistry, createSupervisor, createVerifierEnvironment, createWaterfallCollector, decodeToolPart, defaultAnalystInstruction, defaultAuditorInstruction, defaultDelegateBudget, defaultProfileRichnessThresholds, defaultSelectWinner, defaultToolDetectors, definePersona, defineStrategy, delegate, depthStrategy, deterministicCompletion, discriminatingMeans, driverAgent, dumbDriver, equalKOnCost, extractLlmCallEvent, fanout, finalizeBestDelivered, flatWidenGate, gitWorkspace, harvestCorpus, inProcessSandboxClient, inlineSandboxClient, jjWorkspace, localShell, loopDispatch, loopUntil, mapSandboxEvent, naiveDriver, observe, openSandboxRun, panel, pickChampion, pipeline, printBenchmarkReport, probeSandboxCapabilities, profileRichnessFinding, promotionGate, refine, registerShape, registryScopeAnalyst, renderAnytimeTable, renderCorpusToInstructions, renderReport, reportLoopUsage, runAgentic, runBenchmark, runInWorkspace, runLoop, runPersonified, runStrategyEvolution, sample, sampleThenRefine, sandboxSessionTraceSource, selectChampion, selectValidWinner, sentinelCompletion, serveCoordinationMcp, settledToIteration, spendFromUsageEvents, stopSentinel, strategyAuthorContract, supervise, supervisorAgent, supervisorInstructions, trajectoryReport, verify, watchTrace, widen, workerFromBackend };
3288
+ export { Agent, AgentRunSpec, type AgenticOptions, type AgenticRunResult, type AgenticSurface, type AgenticTask, type AgenticTool, AnalystRegistry, type AnytimeReport, type AnytimeStrategySummary, type AnytimeTaskCurve, type ApplyContinuation, type ArtifactHandle, AssertTraceDerivedFindings, type AuditIntentInput, type AuditIntentOptions, type AuthorStrategyOptions, type AuthoredProfile, type AuthoredStrategy, type BenchmarkCell, type BenchmarkConfig, type BenchmarkLift, type BenchmarkReport, type BenchmarkStrategySummary, type BenchmarkTaskRow, Budget, type BudgetPool, type BudgetReadout, type ChampionPick, type ChampionPolicy, type CheckpointCapableBox, CombinatorShape, type CompletionAnalyst, type CompletionEvidence, type CompletionPolicy, type CompletionVerdict, CoordinationEvent, type CoordinationMcpHandle, Corpus, CorpusFilter, CorpusRecord, type CreateScopeAnalystOptions, type CriuCapableClient, DefinePersonaInput, type DelegateOptions, type Deliverable, DeliverableSpec, type DriveHarness, Driver, type DriverAgentOptions, type DumbDriverOptions, type Environment, EqualKArm, EqualKOnCostOptions, EqualKVerdict, type EvolutionArchiveNode, type EvolutionAuthor, type EvolutionBandInfo, type EvolutionCandidate, type EvolutionGeneration, type EvolutionReport, ExecCtx, ExecutorConfig, FanoutOptions, FanoutWinnerSelector, FileCorpus, type ForkCapableBox, type GitWorkspaceOptions, type HarvestCorpusOptions, type HarvestFailure, type HarvestReport, InMemoryCorpus, InMemoryResultBlobStore, type InMemoryRunContext, type InMemoryRunContextOptions, InMemorySpawnJournal, type InProcessOnPrompt, type InProcessPromptCtx, type InProcessSandboxClientOptions, type Inbox, type InboxMessage, type IntentAudit, Iteration, type LoopDispatchOptions, LoopLineageOptions, type LoopOptionsForDispatch, LoopResult, LoopShape, LoopTokenUsage, LoopUntilSpec, LoopWinner, MakeWorkerAgent, type McpEndpoint, type McpEnvironmentOptions, MountRecorder, type NaiveDriverOptions, type Observation, type ObserveInput, type ObserveOptions, type OpenSandboxRunOptions, Outcome, OutputAdapter, PanelSpec, Persona, PipelineStage, type ProfileRichness, type ProfileRichnessThresholds, type PromotionGateOptions, type PromotionVerdict, type RegistryAnalyzeProjection, RenderCorpusToInstructionsOptions, type ReservationTicket, ResultBlobStore, RouterConfig, type RunAgenticOptions, RunPersonifiedOptions, type SandboxCapabilities, SandboxClient, type SandboxLineage, type SandboxLineageHandle, type SandboxRun, SandboxRunAbortError, Scope, ScopeAnalyst, ScopeAnalyzeInput, ScopeWidenGate, type SessionCapableBox, type SessionTraceBox, Settled, ShapeRegistry, type Shell, type ShotPersona, type ShotSpec, Spend, SteerContext, type SteeringDecision, type Strategy, type StrategyCtx, type StrategyEvolutionConfig, type StrategyResult, type SuperviseOptions, SupervisedResult, Supervisor, type SupervisorAgentDeps, type SupervisorProfile, type SurfaceScore, ToolLoopChat, ToolLoopCompactionOptions, type TraceSource, type TrajectoryAnalysis, TrajectoryReport, TrajectoryReportOptions, type TurnResult, UsageEvent, type UsageSink, Validator, type VerifierEnvironmentOptions, VerifySpec, type WatchTraceOptions, type WaterfallCollector, type WaterfallReport, type WaterfallSpan, WidenSpec, WinnerStrategy, type Workspace, type WorkspaceCommit, type WorkspaceRun, acquireSandbox, adaptiveRefine, analyzeTrace, anytimeReport, asAuthoredProfile, assertModelAllowed, assertStrategyContract, assertTraceDerivedFindings, assessAuthoredProfile, auditIntent, authorStrategy, authoredWorker, breadthStrategy, buildSteerContext, builtinShapes, completionAuthorizes, contentAddress, createBudgetPool, createInMemoryRunContext, createInbox, createMcpEnvironment, createPushTraceSource, createSandboxLineage, createScope, createScopeAnalyst, createShapeRegistry, createSupervisor, createVerifierEnvironment, createWaterfallCollector, decodeToolPart, defaultAnalystInstruction, defaultAuditorInstruction, defaultDelegateBudget, defaultProfileRichnessThresholds, defaultSelectWinner, defaultToolDetectors, definePersona, defineStrategy, delegate, depthStrategy, deterministicCompletion, discriminatingMeans, driverAgent, dumbDriver, equalKOnCost, extractLlmCallEvent, fanout, finalizeBestDelivered, flatWidenGate, gitWorkspace, harvestCorpus, inProcessSandboxClient, inlineSandboxClient, jjWorkspace, localShell, loopDispatch, loopUntil, mapSandboxEvent, naiveDriver, observe, openSandboxRun, panel, pickChampion, pipeline, printBenchmarkReport, probeSandboxCapabilities, profileRichnessFinding, promotionGate, refine, registerShape, registryScopeAnalyst, renderAnytimeTable, renderCorpusToInstructions, renderReport, reportLoopUsage, runAgentic, runBenchmark, runInWorkspace, runLoop, runPersonified, runStrategyEvolution, sample, sampleThenRefine, sandboxSessionTraceSource, selectChampion, selectValidWinner, sentinelCompletion, serveCoordinationMcp, settledToIteration, spendFromUsageEvents, stopSentinel, strategyAuthorContract, supervise, supervisorAgent, supervisorInstructions, trajectoryReport, verify, watchTrace, widen, workerFromBackend };
package/dist/loops.js CHANGED
@@ -76,7 +76,7 @@ import {
76
76
  watchTrace,
77
77
  widen,
78
78
  worktreeFanout
79
- } from "./chunk-75V2XXYJ.js";
79
+ } from "./chunk-AG335EXG.js";
80
80
  import {
81
81
  InMemoryResultBlobStore,
82
82
  InMemorySpawnJournal,
@@ -118,7 +118,7 @@ import {
118
118
  supervisorAgent,
119
119
  supervisorInstructions,
120
120
  workerFromBackend
121
- } from "./chunk-TSDKBFZP.js";
121
+ } from "./chunk-KRULXIWS.js";
122
122
  import "./chunk-VMNEQHJR.js";
123
123
  import {
124
124
  createAgentEnvironmentProviderRegistry,
package/dist/mcp/bin.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  DelegationTaskQueue,
10
10
  FileDelegationStore,
11
11
  createMcpServer
12
- } from "../chunk-TSDKBFZP.js";
12
+ } from "../chunk-KRULXIWS.js";
13
13
  import "../chunk-VMNEQHJR.js";
14
14
  import "../chunk-Z3RRRPRB.js";
15
15
  import "../chunk-T2HVQVB4.js";
@@ -1,10 +1,10 @@
1
1
  import { S as SandboxClient, d as LoopSandboxPlacement } from '../types-BF-MEsQB.js';
2
- import { F as FleetHandle, D as DelegationExecutor, a as DelegationTaskQueue, b as FeedbackStore, c as DelegateFeedbackResult, d as DelegateFeedbackArgs, U as UiAuditorDelegate, e as DelegateUiAuditArgs, f as DelegateUiAuditResult, g as DelegationHistoryResult, h as DelegationHistoryArgs, i as DelegationStatusResult, j as DelegationStatusArgs } from '../coordination-BoEPhGas.js';
3
- export { A as AnalystRegistry, C as CappedDelegationTrace, k as CoderDelegate, l as CoderReview, m as CoderReviewer, n as CoordinationEvent, o as CoordinationTools, p as CoordinationToolsOptions, q as DELEGATE_DESCRIPTION, r as DELEGATE_INPUT_SCHEMA, s as DELEGATE_TOOL_NAME, t as DELEGATION_TRACE_MAX_BYTES, u as DELEGATION_TRACE_MAX_SPANS, v as DelegateArgs, w as DelegateCodeArgs, x as DelegateCodeConfig, y as DelegateCodeResult, z as DelegateHandlerOptions, B as DelegateResearchArgs, E as DelegateResearchConfig, G as DelegateResearchResult, H as DelegateResult, I as DelegateRunCtx, J as DelegateUiAuditConfig, K as DelegateUiAuditRoute, L as DelegationError, M as DelegationFeedbackSnapshot, N as DelegationHistoryEntry, O as DelegationPersistenceError, P as DelegationProfile, Q as DelegationProgress, R as DelegationRecord, S as DelegationResultPayload, T as DelegationResumeContext, V as DelegationResumeDriver, W as DelegationResumeTick, X as DelegationRunContext, Y as DelegationStateCorruptError, Z as DelegationStatus, _ as DelegationStore, $ as DelegationTaskQueueOptions, a0 as DelegationTraceCaps, a1 as DelegationTraceCollector, a2 as DelegationTraceSpan, a3 as DetachedSessionDelegateOptions, a4 as DetachedSessionRefParts, a5 as DetachedTurn, a6 as DetachedTurnResumeDriverOptions, a7 as DetachedWinnerSelection, a8 as DriveTurnCapableBox, a9 as DriveTurnTick, aa as FeedbackEvent, ab as FeedbackRating, ac as FeedbackRefersTo, ad as FileDelegationStore, ae as FileDelegationStoreOptions, af as FleetWorkspaceExecutorOptions, ag as InMemoryDelegationStore, ah as InMemoryFeedbackStore, ai as JsonRpcMessage, aj as JsonRpcResponse, ak as MakeWorkerAgent, al as McpServer, am as McpServerOptions, an as McpToolDescriptor, ao as McpTransport, ap as Question, aq as QuestionDecision, ar as QuestionPolicy, as as QuestionRecord, at as ResearchOutputShape, au as ResearchSource, av as RunDetachedTurnOptions, aw as SettleDetachedCoderTurnOptions, ax as SettledWorker, ay as SiblingSandboxExecutorOptions, az as SubmitInput, aA as SubmitOutput, aB as TraceContext, aC as UiAuditorDelegationOutput, aD as buildDelegationTraceSpans, aE as capDelegationTrace, aF as coderTaskFromArgs, aG as composeLoopTraceEmitters, aH as createCoordinationTools, aI as createDelegateHandler, aJ as createDelegationTraceCollector, aK as createDetachedTurnResumeDriver, aL as createFleetWorkspaceExecutor, aM as createInProcessTransport, aN as createMcpServer, aO as createPropagatingTraceEmitter, aP as createSiblingSandboxExecutor, aQ as detachedSessionDelegate, aR as detachedTurnEvents, aS as eventToSnapshot, aT as formatDetachedSessionRef, aU as hashIdempotencyInput, aV as parseDetachedSessionRef, aW as readTraceContextFromEnv, aX as runDetachedTurn, aY as settleDetachedCoderTurn, aZ as traceContextToEnv, a_ as validateDelegateArgs } from '../coordination-BoEPhGas.js';
2
+ import { F as FleetHandle, D as DelegationExecutor, a as DelegationTaskQueue, b as FeedbackStore, c as DelegateFeedbackResult, d as DelegateFeedbackArgs, U as UiAuditorDelegate, e as DelegateUiAuditArgs, f as DelegateUiAuditResult, g as DelegationHistoryResult, h as DelegationHistoryArgs, i as DelegationStatusResult, j as DelegationStatusArgs } from '../coordination-DCmljYDf.js';
3
+ export { A as AnalystRegistry, C as CappedDelegationTrace, k as CoderDelegate, l as CoderReview, m as CoderReviewer, n as CoordinationEvent, o as CoordinationTools, p as CoordinationToolsOptions, q as DELEGATE_DESCRIPTION, r as DELEGATE_INPUT_SCHEMA, s as DELEGATE_TOOL_NAME, t as DELEGATION_TRACE_MAX_BYTES, u as DELEGATION_TRACE_MAX_SPANS, v as DelegateArgs, w as DelegateCodeArgs, x as DelegateCodeConfig, y as DelegateCodeResult, z as DelegateHandlerOptions, B as DelegateResearchArgs, E as DelegateResearchConfig, G as DelegateResearchResult, H as DelegateResult, I as DelegateRunCtx, J as DelegateUiAuditConfig, K as DelegateUiAuditRoute, L as DelegationError, M as DelegationFeedbackSnapshot, N as DelegationHistoryEntry, O as DelegationPersistenceError, P as DelegationProfile, Q as DelegationProgress, R as DelegationRecord, S as DelegationResultPayload, T as DelegationResumeContext, V as DelegationResumeDriver, W as DelegationResumeTick, X as DelegationRunContext, Y as DelegationStateCorruptError, Z as DelegationStatus, _ as DelegationStore, $ as DelegationTaskQueueOptions, a0 as DelegationTraceCaps, a1 as DelegationTraceCollector, a2 as DelegationTraceSpan, a3 as DetachedSessionDelegateOptions, a4 as DetachedSessionRefParts, a5 as DetachedTurn, a6 as DetachedTurnResumeDriverOptions, a7 as DetachedWinnerSelection, a8 as DriveTurnCapableBox, a9 as DriveTurnTick, aa as FeedbackEvent, ab as FeedbackRating, ac as FeedbackRefersTo, ad as FileDelegationStore, ae as FileDelegationStoreOptions, af as FleetWorkspaceExecutorOptions, ag as InMemoryDelegationStore, ah as InMemoryFeedbackStore, ai as JsonRpcMessage, aj as JsonRpcResponse, ak as MakeWorkerAgent, al as McpServer, am as McpServerOptions, an as McpToolDescriptor, ao as McpTransport, ap as Question, aq as QuestionDecision, ar as QuestionPolicy, as as QuestionRecord, at as ResearchOutputShape, au as ResearchSource, av as RunDetachedTurnOptions, aw as SettleDetachedCoderTurnOptions, ax as SettledWorker, ay as SiblingSandboxExecutorOptions, az as SubmitInput, aA as SubmitOutput, aB as TraceContext, aC as UiAuditorDelegationOutput, aD as buildDelegationTraceSpans, aE as capDelegationTrace, aF as coderTaskFromArgs, aG as composeLoopTraceEmitters, aH as createCoordinationTools, aI as createDelegateHandler, aJ as createDelegationTraceCollector, aK as createDetachedTurnResumeDriver, aL as createFleetWorkspaceExecutor, aM as createInProcessTransport, aN as createMcpServer, aO as createPropagatingTraceEmitter, aP as createSiblingSandboxExecutor, aQ as detachedSessionDelegate, aR as detachedTurnEvents, aS as eventToSnapshot, aT as formatDetachedSessionRef, aU as hashIdempotencyInput, aV as parseDetachedSessionRef, aW as readTraceContextFromEnv, aX as runDetachedTurn, aY as settleDetachedCoderTurn, aZ as traceContextToEnv, a_ as validateDelegateArgs } from '../coordination-DCmljYDf.js';
4
4
  import { L as LocalHarness, r as runLocalHarness } from '../local-harness-DU7yV6mG.js';
5
5
  export { a as LocalHarnessResult, R as RunLocalHarnessOptions } from '../local-harness-DU7yV6mG.js';
6
- import { G as GitRunner } from '../worktree-CpptK3oF.js';
7
- export { C as CreateWorktreeOptions, D as DiffOptions, a as DiffResult, R as RemoveWorktreeOptions, W as WorktreeHandle, c as captureWorktreeDiff, b as createWorktree, r as removeWorktree } from '../worktree-CpptK3oF.js';
6
+ import { G as GitRunner } from '../worktree-harness-Bmho9SH0.js';
7
+ export { C as CreateWorktreeOptions, b as DiffOptions, c as DiffResult, R as RemoveWorktreeOptions, d as WorktreeHandle, e as captureWorktreeDiff, f as createWorktree, r as removeWorktree } from '../worktree-harness-Bmho9SH0.js';
8
8
  export { C as CreateKbGateOptions, F as FactCandidate, a as FactJudge, b as FactJudgeVerdict, K as KbGateResult, c as createKbGate } from '../kb-gate-CuzMYGYM.js';
9
9
  export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from '../openai-tools-B-3v06BE.js';
10
10
  import { AnalystFinding } from '@tangle-network/agent-eval';
@@ -13,7 +13,7 @@ import '@tangle-network/sandbox';
13
13
  import '../types-C1sozrte.js';
14
14
  import '@tangle-network/agent-interface';
15
15
  import '../otel-export-BKmNwiCb.js';
16
- import '../router-client-CMAWGv1h.js';
16
+ import '../router-client-Ak2IGuXq.js';
17
17
  import '../environment-provider.js';
18
18
  import '@tangle-network/agent-interface/environment-provider';
19
19
  import 'node:child_process';
package/dist/mcp/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  mcpToolsForRuntimeMcp,
8
8
  mcpToolsForRuntimeMcpSubset
9
- } from "../chunk-SONQUREI.js";
9
+ } from "../chunk-PVPFDTO3.js";
10
10
  import {
11
11
  createKbGate
12
12
  } from "../chunk-FNMGYYSS.js";
@@ -14,7 +14,7 @@ import {
14
14
  assertTraceDerivedFindings,
15
15
  runCoderChecks,
16
16
  selectValidWinner
17
- } from "../chunk-75V2XXYJ.js";
17
+ } from "../chunk-AG335EXG.js";
18
18
  import {
19
19
  DELEGATE_DESCRIPTION,
20
20
  DELEGATE_FEEDBACK_DESCRIPTION,
@@ -64,7 +64,7 @@ import {
64
64
  validateDelegateUiAuditArgs,
65
65
  validateDelegationHistoryArgs,
66
66
  validateDelegationStatusArgs
67
- } from "../chunk-TSDKBFZP.js";
67
+ } from "../chunk-KRULXIWS.js";
68
68
  import "../chunk-VMNEQHJR.js";
69
69
  import {
70
70
  deleteBoxSafe,
@@ -23,6 +23,38 @@ type ToolLoopChat = (messages: ReadonlyArray<Msg>, tools: ReadonlyArray<ToolSpec
23
23
  * into a conserved pool (the supervisor brain). `runBrainLoop` itself ignores it. */
24
24
  costUsd?: number;
25
25
  }>;
26
+ /** Self-compaction — bound the loop's OWN context window the way a fresh-respawn (dumb-Ralph) loop
27
+ * does, but in place. A stateless chat API re-sends the WHOLE running conversation every turn, so an
28
+ * agent that accumulates dozens of turns of tool results re-bills its entire transcript on every
29
+ * inference — the context-overflow-one-level-up that the conserved budget pool cannot fix. With
30
+ * compaction set, once the conversation exceeds `thresholdTokens` the accumulated middle (every prior
31
+ * assistant turn + tool result) is distilled into ONE compact progress note and the conversation is
32
+ * reset to `[...head, digest]`: the preserved head (system + the original task) survives, the stale
33
+ * turn-by-turn history does not. The model keeps deciding; it stops re-billing the whole transcript.
34
+ * Fires at a CLEAN turn boundary (after a turn's tool results are folded in, before the next
35
+ * inference) so it never orphans an assistant `tool_calls` from its `tool` replies. */
36
+ interface ToolLoopCompaction {
37
+ /** Compact once the estimated token count of the conversation exceeds this. */
38
+ readonly thresholdTokens: number;
39
+ /** Distill the conversation into a compact progress note that REPLACES the middle. Receives the
40
+ * full conversation (so it can summarize everything done so far); returns the digest string. */
41
+ readonly distill: (messages: ReadonlyArray<Msg>) => Promise<string> | string;
42
+ /** Leading messages preserved verbatim (system + the original task). Default 2. */
43
+ readonly preserveHead?: number;
44
+ /** Token estimator over the conversation. Default ≈ chars/4 (incl. tool-call arguments). */
45
+ readonly estimateTokens?: (messages: ReadonlyArray<Msg>) => number;
46
+ /** Notified each time a compaction fires — for observability/metering. */
47
+ readonly onCompact?: (info: {
48
+ turn: number;
49
+ beforeTokens: number;
50
+ afterTokens: number;
51
+ }) => void;
52
+ }
53
+ /** Public supervisor-facing compaction config: same knobs as the primitive, but `distill` is optional
54
+ * because the supervisor has a default digest that combines a brain note with live worker state. */
55
+ type ToolLoopCompactionOptions = Omit<ToolLoopCompaction, 'distill'> & {
56
+ readonly distill?: ToolLoopCompaction['distill'];
57
+ };
26
58
 
27
59
  /**
28
60
  * The one router chat client: direct OpenAI-compatible completions through the
@@ -161,4 +193,4 @@ declare function routerBrain(cfg: RouterConfig, opts?: {
161
193
  temperature?: number;
162
194
  }): ToolLoopChat;
163
195
 
164
- export { type RouterConfig as R, type ToolSpec as T, type ToolLoopChat as a, type RouterChatResult as b, type RouterChatToolsResult as c, type RouterToolCall as d, type RouterToolLoopResult as e, routerChatWithTools as f, routerChatWithUsage as g, routerToolLoop as h, routerBrain as r };
196
+ export { type RouterConfig as R, type ToolSpec as T, type ToolLoopChat as a, type ToolLoopCompactionOptions as b, type RouterChatResult as c, type RouterChatToolsResult as d, type RouterToolCall as e, type RouterToolLoopResult as f, type ToolLoopCompaction as g, routerChatWithTools as h, routerChatWithUsage as i, routerToolLoop as j, routerBrain as r };
@@ -3,7 +3,7 @@ import { AnalystFinding, DefaultVerdict } from '@tangle-network/agent-eval';
3
3
  import { A as AgentSpec, b as ExecutorRegistry, B as Budget, c as Agent, S as SpawnJournal, d as ResultBlobStore, e as RootHandle, f as SupervisedResult, N as NodeId, g as Settled, h as Spend, i as Scope, a as Executor } from './types-C1sozrte.js';
4
4
  import { R as RuntimeHooks, I as Iteration } from './types-BF-MEsQB.js';
5
5
  import { BackendType } from '@tangle-network/sandbox';
6
- import { G as GitRunner, d as DeliverableSpec } from './worktree-CpptK3oF.js';
6
+ import { W as WorktreeHarnessResult, G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './worktree-harness-Bmho9SH0.js';
7
7
  import { L as LocalHarness, r as runLocalHarness } from './local-harness-DU7yV6mG.js';
8
8
 
9
9
  /**
@@ -785,77 +785,6 @@ interface CoderCheckConstraints {
785
785
  forbiddenPaths?: string[];
786
786
  }
787
787
 
788
- /**
789
- * @experimental
790
- *
791
- * The ONE worktree-harness execution core. The physical act — run a supervisor-authored
792
- * `AgentProfile` on a local coding-harness CLI (claude / codex / opencode) against a fresh git
793
- * worktree off `repoRoot`, capture the diff, derive the test/typecheck PASS signals, then clean
794
- * up — lives here ONCE. Two executors adapt it to two ports without re-implementing it:
795
- * - `createWorktreeCliExecutor` — the `Scope`/`Supervisor` leaf `Executor`.
796
- * - `createInProcessExecutor` — the `runLoop` `SandboxClient` / coder-delegate path.
797
- *
798
- * §1.5 by construction: the authored `profile.prompt.systemPrompt` + `profile.model.default`
799
- * reach the harness through `harnessInvocation` HERE, so neither port can drop them — the exact
800
- * bug that existed while the in-process path called `runLocalHarness` with only the task prompt.
801
- *
802
- * Lifecycle: `createWorktree` → `harnessInvocation` + `runLocalHarness` → `captureWorktreeDiff`
803
- * (BEFORE checks, so the patch is the harness's output, not polluted by files a test run writes)
804
- * → the configured test/typecheck commands in the live worktree → return the result + a `cleanup`
805
- * the caller invokes at its own teardown point. A throw cleans up before propagating, so a failed
806
- * run never leaks a worktree.
807
- */
808
-
809
- /** Outcome of one verification command run in the worktree (test or typecheck). */
810
- interface WorktreeCommandResult {
811
- /** The shell command line that was run. */
812
- command: string;
813
- /** Did the command exit 0? The PASS signal a deliverable gate / coder output reads. */
814
- passed: boolean;
815
- /** OS exit code, or `null` when killed before exit. */
816
- exitCode: number | null;
817
- /** Combined stdout+stderr (capped) — surfaced in traces for diagnosis. */
818
- output: string;
819
- }
820
- /** The canonical result of one worktree-harness run, projected by each port to its own shape. */
821
- interface WorktreeHarnessResult {
822
- /** The branch the worktree was cut on (`delegate/<runId>`). */
823
- branch: string;
824
- /** `git diff` of the worktree against its base — the unified patch the harness produced. */
825
- patch: string;
826
- /** Shortstat-derived change counts. */
827
- stats: {
828
- filesChanged: number;
829
- insertions: number;
830
- deletions: number;
831
- };
832
- /** The harness subprocess outcome. */
833
- harness: {
834
- name: LocalHarness;
835
- exitCode: number | null;
836
- timedOut: boolean;
837
- killedBySignal: NodeJS.Signals | null;
838
- durationMs: number;
839
- stdout: string;
840
- stderr: string;
841
- };
842
- /** Verification signals derived in the live worktree (present only when commands were given). */
843
- checks?: {
844
- tests?: WorktreeCommandResult;
845
- typecheck?: WorktreeCommandResult;
846
- };
847
- }
848
- /** The single shell-command-in-worktree runner seam (replaces the per-executor copies). */
849
- type WorktreeCheckRunner = (opts: {
850
- command: string;
851
- cwd: string;
852
- timeoutMs: number;
853
- signal?: AbortSignal;
854
- }) => Promise<{
855
- exitCode: number | null;
856
- output: string;
857
- }>;
858
-
859
788
  /**
860
789
  * @experimental
861
790
  *
@@ -907,6 +836,8 @@ interface WorktreeCliExecutorOptions {
907
836
  typecheckCmd?: string;
908
837
  /** Wall-clock cap per verification command (ms). Default = `harnessTimeoutMs` or 5 min. */
909
838
  checkTimeoutMs?: number;
839
+ /** Cap on each check's captured output. Default 16k. */
840
+ checkOutputCap?: number;
910
841
  /** Test seam — inject a git runner so unit tests drive the worktree helpers without git. */
911
842
  runGit?: GitRunner;
912
843
  /** Test seam — inject the harness runner so unit tests script a `LocalHarnessResult`. */
@@ -1038,4 +969,4 @@ interface WorktreeFanoutOptions extends PatchDeliverableOptions {
1038
969
  */
1039
970
  declare function worktreeFanout<Task>(options: WorktreeFanoutOptions): CombinatorShape<Task, WorktreePatchArtifact>;
1040
971
 
1041
- export { type Widen as $, type AuthoredHarness as A, type Panel as B, type CorpusRecord as C, type DefinePersonaInput as D, type EqualKArm as E, type FanoutOptions as F, type PanelJudge as G, type PanelVerdict as H, type PatchDeliverableOptions as I, type PersonaContext as J, type PersonaExecutors as K, type LoopUntilSpec as L, type Pipeline as M, type RenderCorpusToInstructions as N, type Outcome as O, type PanelSpec as P, type RunPersonified as Q, type RenderCorpusToInstructionsOptions as R, type ScopeAnalyzeInput as S, type TrajectoryReportOptions as T, type ShapeBudget as U, type VerifySpec as V, type WinnerStrategy as W, type ShapeContext as X, type TrajectoryNode as Y, type TrajectoryReportFn as Z, type Verify as _, type WorktreeFanoutOptions as a, type WidenDecision as a0, type WidenLineage as a1, type WorktreeCliExecutorOptions as a2, type WorktreeCommandResult as a3, createWorktreeCliExecutor as a4, patchDelivered as a5, worktreeFanout as a6, type WorktreePatchArtifact as b, type Corpus as c, type AssertTraceDerivedFindings as d, type SteerContext as e, type ScopeAnalyst as f, type CombinatorShape as g, type ScopeWidenGate as h, type PipelineStage as i, type FanoutWinnerSelector as j, type WidenSpec as k, type CorpusFilter as l, type Persona as m, type RunPersonifiedOptions as n, type ShapeRegistry as o, type LoopShape as p, type EqualKOnCostOptions as q, type EqualKVerdict as r, type TrajectoryReport as s, type DefinePersona as t, type EqualKOnCost as u, type Fanout as v, type FanoutSynthesis as w, type FlatWidenGate as x, type LoopUntil as y, type LoopUntilState as z };
972
+ export { type Widen as $, type AuthoredHarness as A, type Panel as B, type CorpusRecord as C, type DefinePersonaInput as D, type EqualKArm as E, type FanoutOptions as F, type PanelJudge as G, type PanelVerdict as H, type PatchDeliverableOptions as I, type PersonaContext as J, type PersonaExecutors as K, type LoopUntilSpec as L, type Pipeline as M, type RenderCorpusToInstructions as N, type Outcome as O, type PanelSpec as P, type RunPersonified as Q, type RenderCorpusToInstructionsOptions as R, type ScopeAnalyzeInput as S, type TrajectoryReportOptions as T, type ShapeBudget as U, type VerifySpec as V, type WinnerStrategy as W, type ShapeContext as X, type TrajectoryNode as Y, type TrajectoryReportFn as Z, type Verify as _, type WorktreeFanoutOptions as a, type WidenDecision as a0, type WidenLineage as a1, type WorktreeCliExecutorOptions as a2, createWorktreeCliExecutor as a3, patchDelivered as a4, worktreeFanout as a5, type WorktreePatchArtifact as b, type Corpus as c, type AssertTraceDerivedFindings as d, type SteerContext as e, type ScopeAnalyst as f, type CombinatorShape as g, type ScopeWidenGate as h, type PipelineStage as i, type FanoutWinnerSelector as j, type WidenSpec as k, type CorpusFilter as l, type Persona as m, type RunPersonifiedOptions as n, type ShapeRegistry as o, type LoopShape as p, type EqualKOnCostOptions as q, type EqualKVerdict as r, type TrajectoryReport as s, type DefinePersona as t, type EqualKOnCost as u, type Fanout as v, type FanoutSynthesis as w, type FlatWidenGate as x, type LoopUntil as y, type LoopUntilState as z };