@tangle-network/agent-runtime 0.72.0 → 0.73.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +4 -3
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/analyst-loop.js +3 -2
- package/dist/{chunk-VYXBFWHZ.js → chunk-7ODB76J5.js} +2 -2
- package/dist/{chunk-PHKNOAOU.js → chunk-HPYWEFVY.js} +25 -7
- package/dist/chunk-HPYWEFVY.js.map +1 -0
- package/dist/{chunk-P5OKDSLB.js → chunk-IODKUOBA.js} +5 -3
- package/dist/{chunk-P5OKDSLB.js.map → chunk-IODKUOBA.js.map} +1 -1
- package/dist/chunk-NBV35BR6.js +68 -0
- package/dist/chunk-NBV35BR6.js.map +1 -0
- package/dist/{chunk-55WKGOGU.js → chunk-NCH4XUZ7.js} +111 -31
- package/dist/chunk-NCH4XUZ7.js.map +1 -0
- package/dist/{chunk-VLF5RHEQ.js → chunk-T2HVQVB4.js} +1 -66
- package/dist/chunk-T2HVQVB4.js.map +1 -0
- package/dist/{chunk-HXVMLRYU.js → chunk-U56XGKVY.js} +7 -7
- package/dist/{coordination-CFVF0OzX.d.ts → coordination-DU0saWeg.d.ts} +8 -2
- package/dist/index.d.ts +6 -6
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +1 -1
- package/dist/lifecycle.d.ts +281 -0
- package/dist/lifecycle.js +174 -0
- package/dist/lifecycle.js.map +1 -0
- package/dist/{loop-runner-bin-B7biH0Gk.d.ts → loop-runner-bin-eD3m0rHW.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +4 -4
- package/dist/loop-runner-bin.js +6 -5
- package/dist/loops.d.ts +45 -9
- package/dist/loops.js +6 -3
- package/dist/mcp/bin.js +6 -5
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +6 -6
- package/dist/mcp/index.js +5 -4
- package/dist/mcp/index.js.map +1 -1
- package/dist/{openai-tools-DOI5mKNw.d.ts → openai-tools-CBurv8Cu.d.ts} +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/{types-K8-xkiw1.d.ts → types-JufmXF2a.d.ts} +80 -1
- package/dist/{worktree-JXGJ1MxQ.d.ts → worktree-DaxOvw-C.d.ts} +1 -1
- package/dist/{worktree-fanout-DJHQy7Ux.d.ts → worktree-fanout-DIffZohV.d.ts} +15 -5
- package/package.json +6 -1
- package/dist/chunk-55WKGOGU.js.map +0 -1
- package/dist/chunk-PHKNOAOU.js.map +0 -1
- package/dist/chunk-VLF5RHEQ.js.map +0 -1
- /package/dist/{chunk-VYXBFWHZ.js.map → chunk-7ODB76J5.js.map} +0 -0
- /package/dist/{chunk-HXVMLRYU.js.map → chunk-U56XGKVY.js.map} +0 -0
package/dist/loops.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ import { ChatClient, AnalystFinding, AgentProfile, AnalystRunInputs, ToolSpan, S
|
|
|
2
2
|
export { AnalystFinding, DefaultVerdict, computeFindingId, makeFinding } from '@tangle-network/agent-eval';
|
|
3
3
|
import { SandboxInstance, CreateSandboxOptions, SandboxEvent } from '@tangle-network/sandbox';
|
|
4
4
|
export { AgentProfile, CreateSandboxOptions, SandboxEvent, SandboxInstance } from '@tangle-network/sandbox';
|
|
5
|
-
import { h as ResultBlobStore, S as SpawnJournal, N as NodeId, q as SpawnEvent, p as ExecutorFactory, g as Agent, B as Budget, m as Scope, k as Settled, j as SupervisedResult, o as DeliverableSpec, l as Spend, U as UsageEvent, E as ExecutorRegistry, s as Supervisor } from './worktree-
|
|
6
|
-
export { A as AgentSpec, n as Executor, t as ExecutorContext, u as ExecutorResult, v as SupervisorOpts, T as TreeView, w as WidenGate, x as gateOnDeliverable } from './worktree-
|
|
7
|
-
import { ak as MakeWorkerAgent, o as CoordinationTools, A as AnalystRegistry, n as CoordinationEvent, ar as QuestionPolicy, a$ as ExecutorConfig } from './coordination-
|
|
8
|
-
export { b0 as BusEvent, b1 as BusRecord, b2 as BusStats, b3 as EventBus, b4 as PublishOptions, b5 as cliWorktreeExecutor, b6 as createEventBus, b7 as createExecutor, b8 as createExecutorRegistry } from './coordination-
|
|
9
|
-
import { b as RuntimeHooks, I as Iteration, S as SandboxClient, U as Driver, A as AgentRunSpec, a as OutputAdapter, V as Validator, E as ExecCtx, W as LoopWinner, X as LoopLineageOptions, Y as LoopResult, L as LoopTokenUsage, R as RuntimeStreamEvent } from './types-
|
|
10
|
-
export {
|
|
11
|
-
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-
|
|
12
|
-
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-
|
|
5
|
+
import { h as ResultBlobStore, S as SpawnJournal, N as NodeId, q as SpawnEvent, p as ExecutorFactory, g as Agent, B as Budget, m as Scope, k as Settled, j as SupervisedResult, o as DeliverableSpec, l as Spend, U as UsageEvent, E as ExecutorRegistry, s as Supervisor } from './worktree-DaxOvw-C.js';
|
|
6
|
+
export { A as AgentSpec, n as Executor, t as ExecutorContext, u as ExecutorResult, v as SupervisorOpts, T as TreeView, w as WidenGate, x as gateOnDeliverable } from './worktree-DaxOvw-C.js';
|
|
7
|
+
import { ak as MakeWorkerAgent, o as CoordinationTools, A as AnalystRegistry, n as CoordinationEvent, ar as QuestionPolicy, a$ as ExecutorConfig } from './coordination-DU0saWeg.js';
|
|
8
|
+
export { b0 as BusEvent, b1 as BusRecord, b2 as BusStats, b3 as EventBus, b4 as PublishOptions, b5 as cliWorktreeExecutor, b6 as createEventBus, b7 as createExecutor, b8 as createExecutorRegistry } from './coordination-DU0saWeg.js';
|
|
9
|
+
import { b as RuntimeHooks, I as Iteration, S as SandboxClient, U as Driver, A as AgentRunSpec, a as OutputAdapter, V as Validator, E as ExecCtx, W as LoopWinner, X as LoopLineageOptions, Y as LoopResult, L as LoopTokenUsage, R as RuntimeStreamEvent, Z as MountRecorder } from './types-JufmXF2a.js';
|
|
10
|
+
export { _ as LoopDecisionPayload, $ as LoopEndedPayload, a0 as LoopIterationDispatchPayload, a1 as LoopIterationEndedPayload, a2 as LoopIterationStartedPayload, a3 as LoopPlanDescription, a4 as LoopPlanPayload, d as LoopSandboxPlacement, a5 as LoopStartedPayload, a6 as LoopTeardownFailedPayload, e as LoopTraceEmitter, c as LoopTraceEvent, a7 as MountManifestEntry, a8 as RunProvenance, a9 as SelectionReceipt, aa as ValidationCtx } from './types-JufmXF2a.js';
|
|
11
|
+
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-DIffZohV.js';
|
|
12
|
+
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-DIffZohV.js';
|
|
13
13
|
import { Scenario, ProfileDispatchFn } from '@tangle-network/agent-eval/campaign';
|
|
14
14
|
import { b as AnalystRegistryLike } from './types-BC3bZpH0.js';
|
|
15
15
|
import { AgentProfile as AgentProfile$1 } from '@tangle-network/agent-interface';
|
|
@@ -1722,6 +1722,10 @@ interface SandboxLineage {
|
|
|
1722
1722
|
declare function createSandboxLineage(client: SandboxClient, capabilities: SandboxCapabilities, options?: {
|
|
1723
1723
|
maxConcurrency?: number;
|
|
1724
1724
|
streaming?: 'sse' | 'poll';
|
|
1725
|
+
/** Run provenance recorder forwarded to every `prepareBox` the lineage runs
|
|
1726
|
+
* (fresh start, continue, and fork branches). Absent ⇒ mounts go unrecorded
|
|
1727
|
+
* (a no-op recorder stands in so the ctx shape is always satisfied). */
|
|
1728
|
+
recordMount?: MountRecorder;
|
|
1725
1729
|
}): SandboxLineage;
|
|
1726
1730
|
/**
|
|
1727
1731
|
* Loop-side widening of the box's optional checkpoint method. The
|
|
@@ -1816,6 +1820,24 @@ interface TurnResult<Out> {
|
|
|
1816
1820
|
events: SandboxEvent[];
|
|
1817
1821
|
readError?: string;
|
|
1818
1822
|
}
|
|
1823
|
+
/**
|
|
1824
|
+
* @experimental
|
|
1825
|
+
* Thrown when a turn is aborted/timed-out mid-settle. Carries the events drained
|
|
1826
|
+
* BEFORE the abort fired (and any in-progress `readError`) so an aborted run is
|
|
1827
|
+
* DIAGNOSABLE — the caller can tell never-started (`events: []`) from looped
|
|
1828
|
+
* (many events, no terminal `result`) from produced-nothing-then-cancelled.
|
|
1829
|
+
*
|
|
1830
|
+
* `name === 'AbortError'`, so existing `err.name === 'AbortError'` callers (the
|
|
1831
|
+
* loop kernel, scope, supervise runtime) keep matching it unchanged.
|
|
1832
|
+
*/
|
|
1833
|
+
declare class SandboxRunAbortError extends Error {
|
|
1834
|
+
readonly name = "AbortError";
|
|
1835
|
+
/** Events drained from the stream before the abort interrupted the turn. */
|
|
1836
|
+
readonly events: SandboxEvent[];
|
|
1837
|
+
/** The last artifact read error, if the abort fired during the retry loop. */
|
|
1838
|
+
readonly readError?: string;
|
|
1839
|
+
constructor(events: SandboxEvent[], readError?: string);
|
|
1840
|
+
}
|
|
1819
1841
|
/** @experimental A live run over ONE persistent artifact (box + session). Close it
|
|
1820
1842
|
* when done — `close()` tears the box down. */
|
|
1821
1843
|
interface SandboxRun<Out> {
|
|
@@ -2349,6 +2371,9 @@ interface DriverAgentOptions {
|
|
|
2349
2371
|
readonly makeWorkerAgent: MakeWorkerAgent;
|
|
2350
2372
|
/** Per-child budget reserved from the conserved pool on each spawn. */
|
|
2351
2373
|
readonly perWorker: Budget;
|
|
2374
|
+
/** Hard cap on simultaneously-LIVE workers — `spawn_agent` fails closed once this many are in
|
|
2375
|
+
* flight (a concurrency fence on top of the conserved-pool fence). Omit/`<= 0` = no cap. */
|
|
2376
|
+
readonly maxLiveWorkers?: number;
|
|
2352
2377
|
/** The driver's stance — a string, or built from the task (the worker-driver prompt /
|
|
2353
2378
|
* the generator). INJECTED so the prompt is a pluggable, optimizable role. */
|
|
2354
2379
|
readonly systemPrompt: string | ((task: unknown) => string);
|
|
@@ -2438,6 +2463,9 @@ declare function serveCoordinationMcp(opts: {
|
|
|
2438
2463
|
blobs: ResultBlobStore;
|
|
2439
2464
|
makeWorkerAgent: MakeWorkerAgent;
|
|
2440
2465
|
perWorker: Budget;
|
|
2466
|
+
/** Hard cap on simultaneously-LIVE workers — `spawn_agent` fails closed once this many are in
|
|
2467
|
+
* flight (a concurrency fence on top of the conserved-pool fence). Omit/`<= 0` = no cap. */
|
|
2468
|
+
maxLiveWorkers?: number;
|
|
2441
2469
|
port?: number;
|
|
2442
2470
|
host?: string;
|
|
2443
2471
|
/** Trace-analyst lenses the driver can run (`run_analyst`) or auto-fire on settle. */
|
|
@@ -2476,6 +2504,10 @@ interface SupervisorAgentDeps {
|
|
|
2476
2504
|
readonly makeWorkerAgent: MakeWorkerAgent;
|
|
2477
2505
|
/** Per-child budget reserved from the conserved pool on each spawn. */
|
|
2478
2506
|
readonly perWorker: Budget;
|
|
2507
|
+
/** Hard cap on simultaneously-LIVE workers across both arms — `spawn_agent` fails closed once
|
|
2508
|
+
* this many are in flight (a concurrency fence on top of the conserved-pool fence; bounds live
|
|
2509
|
+
* boxes/sandboxes, not total work). Omit/`<= 0` = no cap. */
|
|
2510
|
+
readonly maxLiveWorkers?: number;
|
|
2479
2511
|
/** Router substrate for a router-brained supervisor (`harness` null). The profile's model wins. */
|
|
2480
2512
|
readonly router?: RouterConfig;
|
|
2481
2513
|
/** Inject the brain directly (tests / advanced) instead of resolving `routerBrain` from the profile. */
|
|
@@ -2860,6 +2892,10 @@ interface SuperviseOptions {
|
|
|
2860
2892
|
readonly executeExtraTool?: (name: string, args: Record<string, unknown>) => Promise<string | null | undefined>;
|
|
2861
2893
|
/** Per-child budget reserved on each spawn. Defaults to a quarter of the pool's tokens. */
|
|
2862
2894
|
readonly perWorker?: Budget;
|
|
2895
|
+
/** Hard cap on simultaneously-LIVE workers — `spawn_agent` fails closed once this many are in
|
|
2896
|
+
* flight. The conserved pool bounds TOTAL work; this bounds SIMULTANEOUS work (live boxes/
|
|
2897
|
+
* sandboxes a real fleet runs at once). Omit/`<= 0` = no cap (the pool stays the only fence). */
|
|
2898
|
+
readonly maxLiveWorkers?: number;
|
|
2863
2899
|
/** Worker output store. Defaults to in-memory. */
|
|
2864
2900
|
readonly blobs?: ResultBlobStore;
|
|
2865
2901
|
readonly maxDepth?: number;
|
|
@@ -3028,4 +3064,4 @@ declare function runInWorkspace<T>(ws: Workspace, body: (cwd: string) => Promise
|
|
|
3028
3064
|
commitOnInvalid?: boolean;
|
|
3029
3065
|
}): Promise<WorkspaceRun<T>>;
|
|
3030
3066
|
|
|
3031
|
-
export { Agent, AgentRunSpec, type AgenticOptions, type AgenticRunResult, type AgenticSurface, type AgenticTask, type AgenticTool, type AnytimeReport, type AnytimeStrategySummary, type AnytimeTaskCurve, 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 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 Inbox, type InboxMessage, type IntentAudit, Iteration, type LoopDispatchOptions, LoopLineageOptions, type LoopOptionsForDispatch, LoopResult, LoopShape, LoopTokenUsage, LoopUntilSpec, LoopWinner, type McpEndpoint, type McpEnvironmentOptions, 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, Scope, ScopeAnalyst, ScopeAnalyzeInput, ScopeWidenGate, type SessionCapableBox, type SessionTraceBox, Settled, ShapeRegistry, type Shell, type ShotPersona, type ShotSpec, Spend, SteerContext, 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, equalKOnCost, extractLlmCallEvent, fanout, finalizeBestDelivered, flatWidenGate, gitWorkspace, harvestCorpus, inlineSandboxClient, jjWorkspace, localShell, loopDispatch, loopUntil, mapSandboxEvent, 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 };
|
|
3067
|
+
export { Agent, AgentRunSpec, type AgenticOptions, type AgenticRunResult, type AgenticSurface, type AgenticTask, type AgenticTool, type AnytimeReport, type AnytimeStrategySummary, type AnytimeTaskCurve, 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 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 Inbox, type InboxMessage, type IntentAudit, Iteration, type LoopDispatchOptions, LoopLineageOptions, type LoopOptionsForDispatch, LoopResult, LoopShape, LoopTokenUsage, LoopUntilSpec, LoopWinner, type McpEndpoint, type McpEnvironmentOptions, MountRecorder, 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 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, equalKOnCost, extractLlmCallEvent, fanout, finalizeBestDelivered, flatWidenGate, gitWorkspace, harvestCorpus, inlineSandboxClient, jjWorkspace, localShell, loopDispatch, loopUntil, mapSandboxEvent, 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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FileCorpus,
|
|
3
3
|
InMemoryCorpus,
|
|
4
|
+
SandboxRunAbortError,
|
|
4
5
|
adaptiveRefine,
|
|
5
6
|
analyzeTrace,
|
|
6
7
|
anytimeReport,
|
|
@@ -72,7 +73,7 @@ import {
|
|
|
72
73
|
watchTrace,
|
|
73
74
|
widen,
|
|
74
75
|
worktreeFanout
|
|
75
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-HPYWEFVY.js";
|
|
76
77
|
import {
|
|
77
78
|
InMemoryResultBlobStore,
|
|
78
79
|
InMemorySpawnJournal,
|
|
@@ -114,12 +115,13 @@ import {
|
|
|
114
115
|
supervisorAgent,
|
|
115
116
|
supervisorInstructions,
|
|
116
117
|
workerFromBackend
|
|
117
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-NCH4XUZ7.js";
|
|
118
119
|
import "./chunk-VMNEQHJR.js";
|
|
119
120
|
import {
|
|
120
121
|
extractLlmCallEvent,
|
|
121
122
|
mapSandboxEvent
|
|
122
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-T2HVQVB4.js";
|
|
124
|
+
import "./chunk-NBV35BR6.js";
|
|
123
125
|
import "./chunk-WIR4HOOJ.js";
|
|
124
126
|
import "./chunk-DGUM43GV.js";
|
|
125
127
|
export {
|
|
@@ -127,6 +129,7 @@ export {
|
|
|
127
129
|
InMemoryCorpus,
|
|
128
130
|
InMemoryResultBlobStore,
|
|
129
131
|
InMemorySpawnJournal,
|
|
132
|
+
SandboxRunAbortError,
|
|
130
133
|
acquireSandbox,
|
|
131
134
|
adaptiveRefine,
|
|
132
135
|
analyzeTrace,
|
package/dist/mcp/bin.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
resolveRouterBaseUrl
|
|
4
|
-
} from "../chunk-GRAGM4MC.js";
|
|
5
2
|
import {
|
|
6
3
|
readTraceContextFromEnv
|
|
7
4
|
} from "../chunk-PBE35ULD.js";
|
|
5
|
+
import {
|
|
6
|
+
resolveRouterBaseUrl
|
|
7
|
+
} from "../chunk-GRAGM4MC.js";
|
|
8
8
|
import {
|
|
9
9
|
DelegationTaskQueue,
|
|
10
10
|
FileDelegationStore,
|
|
11
11
|
createMcpServer
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-NCH4XUZ7.js";
|
|
13
13
|
import "../chunk-VMNEQHJR.js";
|
|
14
|
-
import "../chunk-
|
|
14
|
+
import "../chunk-T2HVQVB4.js";
|
|
15
|
+
import "../chunk-NBV35BR6.js";
|
|
15
16
|
import "../chunk-WIR4HOOJ.js";
|
|
16
17
|
import "../chunk-DGUM43GV.js";
|
|
17
18
|
|
package/dist/mcp/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/mcp/delegate-supervisor-provisioning.ts","../../src/mcp/bin.ts"],"sourcesContent":["/**\n * @experimental\n *\n * Resolve the `delegate` supervisor substrate (router brain + worker backend) from env, so the\n * `agent-runtime-mcp` bin can serve the ONE generic `delegate` verb the same way it serves\n * `delegate_code` — by env, over the SAME stdio invocation a consumer already mounts.\n *\n * `delegate` is wired into `createMcpServer` via `McpServerOptions.delegateSupervisor`, which needs a\n * router (the supervisor brain's substrate) and a backend (WHERE the authored workers run). Inside a\n * sandbox child the natural backend is `sandbox`: authored workers run as sub-sandboxes through the\n * SAME `SandboxClient` the bin already loads from `TANGLE_API_KEY` — the deployment shape\n * `delegate_code` used. The brain's router reuses the repo's `resolveRouterBaseUrl` convention\n * (`TANGLE_ROUTER_URL` / `TANGLE_ROUTER_BASE_URL`), normalised to an OpenAI-compatible `/v1` endpoint,\n * keyed by `TANGLE_API_KEY`.\n */\n\nimport type { BackendType } from '@tangle-network/sandbox'\nimport { type RouterEnv, resolveRouterBaseUrl } from '../model-resolution.js'\nimport type { SandboxClient } from '../runtime'\nimport type { RouterConfig } from '../runtime/router-client'\nimport type { ExecutorConfig } from '../runtime/supervise/runtime'\nimport type { DelegateHandlerOptions } from './tools/delegate'\n\nconst DEFAULT_SUPERVISOR_MODEL = 'moonshotai/kimi-k2.6'\nconst DEFAULT_WORKER_HARNESS = 'opencode'\n\nfunction trimmed(value: string | undefined): string | undefined {\n const v = value?.trim()\n return v ? v : undefined\n}\n\n/** True when the operator opted the generic `delegate` verb in (`MCP_ENABLE_DELEGATE=1`). Default off:\n * the wiring is additive, so existing `delegate_code` / `delegate_research` consumers are unaffected. */\nexport function delegateEnabled(env: NodeJS.ProcessEnv = process.env): boolean {\n return env.MCP_ENABLE_DELEGATE === '1'\n}\n\n/** Resolve the supervisor brain's router substrate from env. The key falls back through the platform\n * key the bin already requires; the base reuses `resolveRouterBaseUrl`, normalised to `/v1`. */\nfunction resolveRouter(env: NodeJS.ProcessEnv): RouterConfig {\n const routerKey = trimmed(env.MCP_SUPERVISOR_ROUTER_KEY) ?? trimmed(env.TANGLE_API_KEY) ?? ''\n const base = trimmed(env.MCP_SUPERVISOR_ROUTER_BASE_URL) ?? resolveRouterBaseUrl(env as RouterEnv)\n const routerBaseUrl = /\\/v\\d+\\/?$/.test(base)\n ? base.replace(/\\/$/, '')\n : `${base.replace(/\\/$/, '')}/v1`\n const model =\n trimmed(env.MCP_SUPERVISOR_MODEL) ??\n trimmed(env.MCP_WORKER_MODEL) ??\n trimmed(env.WORKER_MODEL) ??\n DEFAULT_SUPERVISOR_MODEL\n return { routerBaseUrl, routerKey, model }\n}\n\n/**\n * Build the `delegateSupervisor` substrate for `createMcpServer` from env + the bin's loaded\n * `SandboxClient`. Returns `undefined` when `delegate` is not opted in, so the caller mounts it only\n * when asked. The worker backend is `sandbox` (authored workers run as sub-sandboxes via the same\n * client) on the harness named by `MCP_DELEGATE_WORKER_HARNESS` (default `opencode`).\n */\nexport function resolveDelegateSupervisor(\n sandboxClient: SandboxClient,\n env: NodeJS.ProcessEnv = process.env,\n): DelegateHandlerOptions | undefined {\n if (!delegateEnabled(env)) return undefined\n const router = resolveRouter(env)\n const harness = (trimmed(env.MCP_DELEGATE_WORKER_HARNESS) ??\n DEFAULT_WORKER_HARNESS) as BackendType\n const backend: ExecutorConfig = {\n backend: 'sandbox',\n harness,\n sandboxClient,\n }\n return {\n router,\n backend,\n model: router.model,\n }\n}\n","#!/usr/bin/env node\n\n/**\n * @experimental\n *\n * `agent-runtime-mcp` — stdio MCP server entry point.\n *\n * Serves the ONE generic `delegate` verb (opt-in via `MCP_ENABLE_DELEGATE=1`): one intent → a\n * supervisor that authors + drives its own worker over `supervise()`, returning the delivered output\n * with its cost. The supervisor brain runs on the router; authored workers run as sub-sandboxes\n * through the same `SandboxClient` the bin loads from `TANGLE_API_KEY`. The queue-bound tools\n * (`delegate_feedback`, `delegation_status`, `delegation_history`) are always served.\n *\n * Environment variables:\n * TANGLE_API_KEY required — passed to `new Sandbox({ apiKey })`\n * SANDBOX_BASE_URL optional — sandbox-SDK base URL override\n * MCP_ENABLE_DELEGATE set to `1` to serve the generic `delegate` verb. Its authoring\n * supervisor runs the brain on the router and spawns authored\n * workers as sub-sandboxes via the same client; needs TANGLE_API_KEY.\n * MCP_SUPERVISOR_MODEL supervisor brain model id (falls back to MCP_WORKER_MODEL, then\n * WORKER_MODEL, then a default). Must be a tool-calling model.\n * MCP_SUPERVISOR_ROUTER_KEY router key for the supervisor brain (defaults to TANGLE_API_KEY)\n * MCP_SUPERVISOR_ROUTER_BASE_URL router base for the supervisor brain (defaults to the repo's\n * resolveRouterBaseUrl, normalized to `/v1`)\n * MCP_DELEGATE_WORKER_HARNESS harness the authored workers run on (default `opencode`)\n * AGENT_RUNTIME_DELEGATION_STATE_FILE\n * optional — absolute path of a JSON state\n * file. When set, delegation records persist\n * across MCP restarts (FileDelegationStore):\n * status/history survive and idempotency keys\n * dedupe across processes.\n * AGENT_RUNTIME_DELEGATION_STATE_RECOVER\n * set to `1` to archive a corrupt state file\n * (`<file>.corrupt-<ts>`) and start empty\n * instead of refusing to boot.\n * AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL\n * optional — positive integer cap on retained\n * terminal records. Unset = keep forever.\n */\n\nimport type { SandboxClient } from '../runtime'\nimport { delegateEnabled, resolveDelegateSupervisor } from './delegate-supervisor-provisioning'\nimport { FileDelegationStore } from './delegation-store'\nimport { createMcpServer } from './server'\nimport { DelegationTaskQueue } from './task-queue'\nimport { readTraceContextFromEnv, type TraceContext } from './trace-propagation'\n\nconst DEFAULT_SANDBOX_BASE_URL = 'https://sandbox.tangle.tools'\n\nasync function main(): Promise<void> {\n const wantDelegate = delegateEnabled(process.env)\n\n // The generic `delegate` verb needs the sandbox client: its authored workers run as sub-sandboxes\n // (the `sandbox` backend). When `delegate` is not opted in, the server runs the queue-only subset\n // (feedback + status + history) with no sandbox.\n let sandboxClient: SandboxClient | undefined\n if (wantDelegate) {\n const apiKey = process.env.TANGLE_API_KEY\n if (!apiKey && !process.env.AGENT_RUNTIME_MCP_ALLOW_NO_KEY) {\n process.stderr.write(\n 'agent-runtime-mcp: TANGLE_API_KEY is required to serve `delegate`. Set AGENT_RUNTIME_MCP_ALLOW_NO_KEY=1 to run without it for diagnostics, or unset MCP_ENABLE_DELEGATE to run the queue-only subset.\\n',\n )\n process.exit(2)\n }\n sandboxClient = await loadSandboxClient(apiKey)\n }\n\n // The supervisor's loop topology spans export to the OTLP / Tangle Intelligence sink when\n // OTEL_EXPORTER_OTLP_ENDPOINT is set (+ TRACE_ID / PARENT_SPAN_ID for correlation). The same\n // context is stamped onto every delegation record so journal consumers join records into the\n // caller's trace.\n const traceContext = readTraceContextFromEnv()\n if (process.env.OTEL_EXPORTER_OTLP_ENDPOINT) {\n process.stderr.write(\n `agent-runtime-mcp: exporting loop topology → ${process.env.OTEL_EXPORTER_OTLP_ENDPOINT}\\n`,\n )\n }\n\n // The ONE generic `delegate` verb — opt-in via MCP_ENABLE_DELEGATE=1. Its authoring supervisor\n // runs the brain on the router and spawns authored workers as sub-sandboxes through the SAME\n // client, so it needs the loaded `sandboxClient`. Gated on the client resolving (no key → no\n // delegate, fail-closed).\n const delegateSupervisor =\n wantDelegate && sandboxClient ? resolveDelegateSupervisor(sandboxClient) : undefined\n if (wantDelegate && delegateSupervisor) {\n process.stderr.write('agent-runtime-mcp: delegate enabled — generic authoring supervisor\\n')\n }\n\n const durableQueue = await buildDurableQueueFromEnv(traceContext)\n const server = createMcpServer({\n ...(delegateSupervisor ? { delegateSupervisor } : {}),\n traceContext,\n ...(durableQueue ? { queue: durableQueue } : {}),\n })\n\n const shutdown = () => {\n server.stop()\n // Drain journal writes so the state file reflects the final record\n // states before the process exits. A persist failure already routed\n // through onPersistError; swallow the duplicate rejection here.\n if (durableQueue) {\n void durableQueue\n .flush()\n .catch(() => {})\n .finally(() => process.exit(0))\n return\n }\n process.exit(0)\n }\n process.on('SIGINT', shutdown)\n process.on('SIGTERM', shutdown)\n\n await server.serve()\n}\n\nasync function buildDurableQueueFromEnv(\n traceContext: TraceContext,\n): Promise<DelegationTaskQueue | undefined> {\n const stateFile = process.env.AGENT_RUNTIME_DELEGATION_STATE_FILE?.trim()\n if (!stateFile) return undefined\n const store = new FileDelegationStore({\n filePath: stateFile,\n recoverCorrupt: process.env.AGENT_RUNTIME_DELEGATION_STATE_RECOVER === '1',\n })\n const maxTerminalRecords = parseRetention(process.env.AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL)\n const queue = await DelegationTaskQueue.restore({\n store,\n traceContext,\n ...(maxTerminalRecords !== undefined ? { maxTerminalRecords } : {}),\n onPersistError: (error) => {\n // Durable mode that can no longer write is a broken contract: crash\n // loud instead of degrading to memory-only behind the caller's back.\n process.stderr.write(`agent-runtime-mcp: ${error.message}\\n`)\n process.exit(1)\n },\n })\n process.stderr.write(`agent-runtime-mcp: durable delegation state → ${stateFile}\\n`)\n return queue\n}\n\nfunction parseRetention(raw: string | undefined): number | undefined {\n if (raw === undefined || raw.trim() === '') return undefined\n const n = Number(raw)\n if (!Number.isInteger(n) || n < 1) {\n process.stderr.write(\n `agent-runtime-mcp: AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL must be a positive integer, got \"${raw}\"\\n`,\n )\n process.exit(2)\n }\n return n\n}\n\nasync function loadSandboxClient(apiKey: string | undefined): Promise<SandboxClient> {\n // Diagnostic mode: AGENT_RUNTIME_MCP_ALLOW_NO_KEY=1 enables tools/list + the\n // queue-bound tools (status / history / feedback) without sandbox creds.\n // `delegate` requires a real client; the stub fails loud at create() so the\n // agent observes the cause instead of silent success.\n if (!apiKey) {\n return {\n async create() {\n throw new Error(\n 'agent-runtime-mcp: TANGLE_API_KEY is unset; `delegate` is disabled in diagnostic mode. Set TANGLE_API_KEY or unset MCP_ENABLE_DELEGATE to remove the unsupported tool from the tool list.',\n )\n },\n } satisfies SandboxClient\n }\n // Dynamic import keeps the bin importable in environments that haven't\n // installed `@tangle-network/sandbox` yet (the runtime package lists it\n // as a peer dep, not a hard dep).\n const mod = await import('@tangle-network/sandbox').catch((err) => {\n process.stderr.write(\n `agent-runtime-mcp: failed to load @tangle-network/sandbox (${err.message}); install the peer dependency\\n`,\n )\n process.exit(2)\n })\n const SandboxCtor = (mod as { Sandbox?: new (config: unknown) => SandboxClient }).Sandbox\n if (!SandboxCtor) {\n process.stderr.write(\n 'agent-runtime-mcp: @tangle-network/sandbox does not export Sandbox; cannot construct client\\n',\n )\n process.exit(2)\n }\n // @tangle-network/sandbox ≥0.6 makes baseUrl required; default it so the MCP server\n // starts without forcing every caller to set SANDBOX_BASE_URL. Treat empty/whitespace as\n // unset (|| not ??) so `SANDBOX_BASE_URL=` still resolves to the default.\n const baseUrl = process.env.SANDBOX_BASE_URL?.trim() || DEFAULT_SANDBOX_BASE_URL\n return new SandboxCtor({ apiKey, baseUrl })\n}\n\nmain().catch((err) => {\n process.stderr.write(`agent-runtime-mcp: ${err instanceof Error ? err.stack : String(err)}\\n`)\n process.exit(1)\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuBA,IAAM,2BAA2B;AACjC,IAAM,yBAAyB;AAE/B,SAAS,QAAQ,OAA+C;AAC9D,QAAM,IAAI,OAAO,KAAK;AACtB,SAAO,IAAI,IAAI;AACjB;AAIO,SAAS,gBAAgB,MAAyB,QAAQ,KAAc;AAC7E,SAAO,IAA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AAS,eAAe,KAA6C;AACnE,MAAI,QAAQ,UAAa,IAAI,KAAK,MAAM,GAAI,QAAO;AACnD,QAAM,IAAI,OAAO,GAAG;AACpB,MAAI,CAAC,OAAO,UAAU,CAAC,KAAK,IAAI,GAAG;AACjC,YAAQ,OAAO;AAAA,MACb,gGAAgG,GAAG;AAAA;AAAA,IACrG;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,SAAO;AACT;AAEA,eAAe,kBAAkB,QAAoD;AAKnF,MAAI,CAAC,QAAQ;AACX,WAAO;AAAA,MACL,MAAM,SAAS;AACb,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAIA,QAAM,MAAM,MAAM,OAAO,yBAAyB,EAAE,MAAM,CAAC,QAAQ;AACjE,YAAQ,OAAO;AAAA,MACb,8DAA8D,IAAI,OAAO;AAAA;AAAA,IAC3E;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACD,QAAM,cAAe,IAA6D;AAClF,MAAI,CAAC,aAAa;AAChB,YAAQ,OAAO;AAAA,MACb;AAAA,IACF;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AAIA,QAAM,UAAU,QAAQ,IAAI,kBAAkB,KAAK,KAAK;AACxD,SAAO,IAAI,YAAY,EAAE,QAAQ,QAAQ,CAAC;AAC5C;AAEA,KAAK,EAAE,MAAM,CAAC,QAAQ;AACpB,UAAQ,OAAO,MAAM,sBAAsB,eAAe,QAAQ,IAAI,QAAQ,OAAO,GAAG,CAAC;AAAA,CAAI;AAC7F,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/mcp/delegate-supervisor-provisioning.ts","../../src/mcp/bin.ts"],"sourcesContent":["/**\n * @experimental\n *\n * Resolve the `delegate` supervisor substrate (router brain + worker backend) from env, so the\n * `agent-runtime-mcp` bin can serve the ONE generic `delegate` verb the same way it serves\n * `delegate_code` — by env, over the SAME stdio invocation a consumer already mounts.\n *\n * `delegate` is wired into `createMcpServer` via `McpServerOptions.delegateSupervisor`, which needs a\n * router (the supervisor brain's substrate) and a backend (WHERE the authored workers run). Inside a\n * sandbox child the natural backend is `sandbox`: authored workers run as sub-sandboxes through the\n * SAME `SandboxClient` the bin already loads from `TANGLE_API_KEY` — the deployment shape\n * `delegate_code` used. The brain's router reuses the repo's `resolveRouterBaseUrl` convention\n * (`TANGLE_ROUTER_URL` / `TANGLE_ROUTER_BASE_URL`), normalised to an OpenAI-compatible `/v1` endpoint,\n * keyed by `TANGLE_API_KEY`.\n */\n\nimport type { BackendType } from '@tangle-network/sandbox'\nimport { type RouterEnv, resolveRouterBaseUrl } from '../model-resolution.js'\nimport type { SandboxClient } from '../runtime'\nimport type { RouterConfig } from '../runtime/router-client'\nimport type { ExecutorConfig } from '../runtime/supervise/runtime'\nimport type { DelegateHandlerOptions } from './tools/delegate'\n\nconst DEFAULT_SUPERVISOR_MODEL = 'moonshotai/kimi-k2.6'\nconst DEFAULT_WORKER_HARNESS = 'opencode'\n\nfunction trimmed(value: string | undefined): string | undefined {\n const v = value?.trim()\n return v ? v : undefined\n}\n\n/** True when the operator opted the generic `delegate` verb in (`MCP_ENABLE_DELEGATE=1`). Default off:\n * the wiring is additive, so existing `delegate_code` / `delegate_research` consumers are unaffected. */\nexport function delegateEnabled(env: NodeJS.ProcessEnv = process.env): boolean {\n return env.MCP_ENABLE_DELEGATE === '1'\n}\n\n/** Resolve the supervisor brain's router substrate from env. The key falls back through the platform\n * key the bin already requires; the base reuses `resolveRouterBaseUrl`, normalised to `/v1`. */\nfunction resolveRouter(env: NodeJS.ProcessEnv): RouterConfig {\n const routerKey = trimmed(env.MCP_SUPERVISOR_ROUTER_KEY) ?? trimmed(env.TANGLE_API_KEY) ?? ''\n const base = trimmed(env.MCP_SUPERVISOR_ROUTER_BASE_URL) ?? resolveRouterBaseUrl(env as RouterEnv)\n const routerBaseUrl = /\\/v\\d+\\/?$/.test(base)\n ? base.replace(/\\/$/, '')\n : `${base.replace(/\\/$/, '')}/v1`\n const model =\n trimmed(env.MCP_SUPERVISOR_MODEL) ??\n trimmed(env.MCP_WORKER_MODEL) ??\n trimmed(env.WORKER_MODEL) ??\n DEFAULT_SUPERVISOR_MODEL\n return { routerBaseUrl, routerKey, model }\n}\n\n/**\n * Build the `delegateSupervisor` substrate for `createMcpServer` from env + the bin's loaded\n * `SandboxClient`. Returns `undefined` when `delegate` is not opted in, so the caller mounts it only\n * when asked. The worker backend is `sandbox` (authored workers run as sub-sandboxes via the same\n * client) on the harness named by `MCP_DELEGATE_WORKER_HARNESS` (default `opencode`).\n */\nexport function resolveDelegateSupervisor(\n sandboxClient: SandboxClient,\n env: NodeJS.ProcessEnv = process.env,\n): DelegateHandlerOptions | undefined {\n if (!delegateEnabled(env)) return undefined\n const router = resolveRouter(env)\n const harness = (trimmed(env.MCP_DELEGATE_WORKER_HARNESS) ??\n DEFAULT_WORKER_HARNESS) as BackendType\n const backend: ExecutorConfig = {\n backend: 'sandbox',\n harness,\n sandboxClient,\n }\n return {\n router,\n backend,\n model: router.model,\n }\n}\n","#!/usr/bin/env node\n\n/**\n * @experimental\n *\n * `agent-runtime-mcp` — stdio MCP server entry point.\n *\n * Serves the ONE generic `delegate` verb (opt-in via `MCP_ENABLE_DELEGATE=1`): one intent → a\n * supervisor that authors + drives its own worker over `supervise()`, returning the delivered output\n * with its cost. The supervisor brain runs on the router; authored workers run as sub-sandboxes\n * through the same `SandboxClient` the bin loads from `TANGLE_API_KEY`. The queue-bound tools\n * (`delegate_feedback`, `delegation_status`, `delegation_history`) are always served.\n *\n * Environment variables:\n * TANGLE_API_KEY required — passed to `new Sandbox({ apiKey })`\n * SANDBOX_BASE_URL optional — sandbox-SDK base URL override\n * MCP_ENABLE_DELEGATE set to `1` to serve the generic `delegate` verb. Its authoring\n * supervisor runs the brain on the router and spawns authored\n * workers as sub-sandboxes via the same client; needs TANGLE_API_KEY.\n * MCP_SUPERVISOR_MODEL supervisor brain model id (falls back to MCP_WORKER_MODEL, then\n * WORKER_MODEL, then a default). Must be a tool-calling model.\n * MCP_SUPERVISOR_ROUTER_KEY router key for the supervisor brain (defaults to TANGLE_API_KEY)\n * MCP_SUPERVISOR_ROUTER_BASE_URL router base for the supervisor brain (defaults to the repo's\n * resolveRouterBaseUrl, normalized to `/v1`)\n * MCP_DELEGATE_WORKER_HARNESS harness the authored workers run on (default `opencode`)\n * AGENT_RUNTIME_DELEGATION_STATE_FILE\n * optional — absolute path of a JSON state\n * file. When set, delegation records persist\n * across MCP restarts (FileDelegationStore):\n * status/history survive and idempotency keys\n * dedupe across processes.\n * AGENT_RUNTIME_DELEGATION_STATE_RECOVER\n * set to `1` to archive a corrupt state file\n * (`<file>.corrupt-<ts>`) and start empty\n * instead of refusing to boot.\n * AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL\n * optional — positive integer cap on retained\n * terminal records. Unset = keep forever.\n */\n\nimport type { SandboxClient } from '../runtime'\nimport { delegateEnabled, resolveDelegateSupervisor } from './delegate-supervisor-provisioning'\nimport { FileDelegationStore } from './delegation-store'\nimport { createMcpServer } from './server'\nimport { DelegationTaskQueue } from './task-queue'\nimport { readTraceContextFromEnv, type TraceContext } from './trace-propagation'\n\nconst DEFAULT_SANDBOX_BASE_URL = 'https://sandbox.tangle.tools'\n\nasync function main(): Promise<void> {\n const wantDelegate = delegateEnabled(process.env)\n\n // The generic `delegate` verb needs the sandbox client: its authored workers run as sub-sandboxes\n // (the `sandbox` backend). When `delegate` is not opted in, the server runs the queue-only subset\n // (feedback + status + history) with no sandbox.\n let sandboxClient: SandboxClient | undefined\n if (wantDelegate) {\n const apiKey = process.env.TANGLE_API_KEY\n if (!apiKey && !process.env.AGENT_RUNTIME_MCP_ALLOW_NO_KEY) {\n process.stderr.write(\n 'agent-runtime-mcp: TANGLE_API_KEY is required to serve `delegate`. Set AGENT_RUNTIME_MCP_ALLOW_NO_KEY=1 to run without it for diagnostics, or unset MCP_ENABLE_DELEGATE to run the queue-only subset.\\n',\n )\n process.exit(2)\n }\n sandboxClient = await loadSandboxClient(apiKey)\n }\n\n // The supervisor's loop topology spans export to the OTLP / Tangle Intelligence sink when\n // OTEL_EXPORTER_OTLP_ENDPOINT is set (+ TRACE_ID / PARENT_SPAN_ID for correlation). The same\n // context is stamped onto every delegation record so journal consumers join records into the\n // caller's trace.\n const traceContext = readTraceContextFromEnv()\n if (process.env.OTEL_EXPORTER_OTLP_ENDPOINT) {\n process.stderr.write(\n `agent-runtime-mcp: exporting loop topology → ${process.env.OTEL_EXPORTER_OTLP_ENDPOINT}\\n`,\n )\n }\n\n // The ONE generic `delegate` verb — opt-in via MCP_ENABLE_DELEGATE=1. Its authoring supervisor\n // runs the brain on the router and spawns authored workers as sub-sandboxes through the SAME\n // client, so it needs the loaded `sandboxClient`. Gated on the client resolving (no key → no\n // delegate, fail-closed).\n const delegateSupervisor =\n wantDelegate && sandboxClient ? resolveDelegateSupervisor(sandboxClient) : undefined\n if (wantDelegate && delegateSupervisor) {\n process.stderr.write('agent-runtime-mcp: delegate enabled — generic authoring supervisor\\n')\n }\n\n const durableQueue = await buildDurableQueueFromEnv(traceContext)\n const server = createMcpServer({\n ...(delegateSupervisor ? { delegateSupervisor } : {}),\n traceContext,\n ...(durableQueue ? { queue: durableQueue } : {}),\n })\n\n const shutdown = () => {\n server.stop()\n // Drain journal writes so the state file reflects the final record\n // states before the process exits. A persist failure already routed\n // through onPersistError; swallow the duplicate rejection here.\n if (durableQueue) {\n void durableQueue\n .flush()\n .catch(() => {})\n .finally(() => process.exit(0))\n return\n }\n process.exit(0)\n }\n process.on('SIGINT', shutdown)\n process.on('SIGTERM', shutdown)\n\n await server.serve()\n}\n\nasync function buildDurableQueueFromEnv(\n traceContext: TraceContext,\n): Promise<DelegationTaskQueue | undefined> {\n const stateFile = process.env.AGENT_RUNTIME_DELEGATION_STATE_FILE?.trim()\n if (!stateFile) return undefined\n const store = new FileDelegationStore({\n filePath: stateFile,\n recoverCorrupt: process.env.AGENT_RUNTIME_DELEGATION_STATE_RECOVER === '1',\n })\n const maxTerminalRecords = parseRetention(process.env.AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL)\n const queue = await DelegationTaskQueue.restore({\n store,\n traceContext,\n ...(maxTerminalRecords !== undefined ? { maxTerminalRecords } : {}),\n onPersistError: (error) => {\n // Durable mode that can no longer write is a broken contract: crash\n // loud instead of degrading to memory-only behind the caller's back.\n process.stderr.write(`agent-runtime-mcp: ${error.message}\\n`)\n process.exit(1)\n },\n })\n process.stderr.write(`agent-runtime-mcp: durable delegation state → ${stateFile}\\n`)\n return queue\n}\n\nfunction parseRetention(raw: string | undefined): number | undefined {\n if (raw === undefined || raw.trim() === '') return undefined\n const n = Number(raw)\n if (!Number.isInteger(n) || n < 1) {\n process.stderr.write(\n `agent-runtime-mcp: AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL must be a positive integer, got \"${raw}\"\\n`,\n )\n process.exit(2)\n }\n return n\n}\n\nasync function loadSandboxClient(apiKey: string | undefined): Promise<SandboxClient> {\n // Diagnostic mode: AGENT_RUNTIME_MCP_ALLOW_NO_KEY=1 enables tools/list + the\n // queue-bound tools (status / history / feedback) without sandbox creds.\n // `delegate` requires a real client; the stub fails loud at create() so the\n // agent observes the cause instead of silent success.\n if (!apiKey) {\n return {\n async create() {\n throw new Error(\n 'agent-runtime-mcp: TANGLE_API_KEY is unset; `delegate` is disabled in diagnostic mode. Set TANGLE_API_KEY or unset MCP_ENABLE_DELEGATE to remove the unsupported tool from the tool list.',\n )\n },\n } satisfies SandboxClient\n }\n // Dynamic import keeps the bin importable in environments that haven't\n // installed `@tangle-network/sandbox` yet (the runtime package lists it\n // as a peer dep, not a hard dep).\n const mod = await import('@tangle-network/sandbox').catch((err) => {\n process.stderr.write(\n `agent-runtime-mcp: failed to load @tangle-network/sandbox (${err.message}); install the peer dependency\\n`,\n )\n process.exit(2)\n })\n const SandboxCtor = (mod as { Sandbox?: new (config: unknown) => SandboxClient }).Sandbox\n if (!SandboxCtor) {\n process.stderr.write(\n 'agent-runtime-mcp: @tangle-network/sandbox does not export Sandbox; cannot construct client\\n',\n )\n process.exit(2)\n }\n // @tangle-network/sandbox ≥0.6 makes baseUrl required; default it so the MCP server\n // starts without forcing every caller to set SANDBOX_BASE_URL. Treat empty/whitespace as\n // unset (|| not ??) so `SANDBOX_BASE_URL=` still resolves to the default.\n const baseUrl = process.env.SANDBOX_BASE_URL?.trim() || DEFAULT_SANDBOX_BASE_URL\n return new SandboxCtor({ apiKey, baseUrl })\n}\n\nmain().catch((err) => {\n process.stderr.write(`agent-runtime-mcp: ${err instanceof Error ? err.stack : String(err)}\\n`)\n process.exit(1)\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAuBA,IAAM,2BAA2B;AACjC,IAAM,yBAAyB;AAE/B,SAAS,QAAQ,OAA+C;AAC9D,QAAM,IAAI,OAAO,KAAK;AACtB,SAAO,IAAI,IAAI;AACjB;AAIO,SAAS,gBAAgB,MAAyB,QAAQ,KAAc;AAC7E,SAAO,IAAI,wBAAwB;AACrC;AAIA,SAAS,cAAc,KAAsC;AAC3D,QAAM,YAAY,QAAQ,IAAI,yBAAyB,KAAK,QAAQ,IAAI,cAAc,KAAK;AAC3F,QAAM,OAAO,QAAQ,IAAI,8BAA8B,KAAK,qBAAqB,GAAgB;AACjG,QAAM,gBAAgB,aAAa,KAAK,IAAI,IACxC,KAAK,QAAQ,OAAO,EAAE,IACtB,GAAG,KAAK,QAAQ,OAAO,EAAE,CAAC;AAC9B,QAAM,QACJ,QAAQ,IAAI,oBAAoB,KAChC,QAAQ,IAAI,gBAAgB,KAC5B,QAAQ,IAAI,YAAY,KACxB;AACF,SAAO,EAAE,eAAe,WAAW,MAAM;AAC3C;AAQO,SAAS,0BACd,eACA,MAAyB,QAAQ,KACG;AACpC,MAAI,CAAC,gBAAgB,GAAG,EAAG,QAAO;AAClC,QAAM,SAAS,cAAc,GAAG;AAChC,QAAM,UAAW,QAAQ,IAAI,2BAA2B,K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AA,EAChB,CAAC;AACD,QAAM,cAAe,IAA6D;AAClF,MAAI,CAAC,aAAa;AAChB,YAAQ,OAAO;AAAA,MACb;AAAA,IACF;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AAIA,QAAM,UAAU,QAAQ,IAAI,kBAAkB,KAAK,KAAK;AACxD,SAAO,IAAI,YAAY,EAAE,QAAQ,QAAQ,CAAC;AAC5C;AAEA,KAAK,EAAE,MAAM,CAAC,QAAQ;AACpB,UAAQ,OAAO,MAAM,sBAAsB,eAAe,QAAQ,IAAI,QAAQ,OAAO,GAAG,CAAC;AAAA,CAAI;AAC7F,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { S as SandboxClient, d as LoopSandboxPlacement } from '../types-
|
|
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-
|
|
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-
|
|
4
|
-
import { L as LocalHarness, G as GitRunner, r as runLocalHarness } from '../worktree-
|
|
5
|
-
export { C as CreateWorktreeOptions, D as DiffOptions, a as DiffResult, b as LocalHarnessResult, R as RemoveWorktreeOptions, c as RunLocalHarnessOptions, W as WorktreeHandle, d as captureWorktreeDiff, e as createWorktree, f as removeWorktree } from '../worktree-
|
|
1
|
+
import { S as SandboxClient, d as LoopSandboxPlacement } from '../types-JufmXF2a.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-DU0saWeg.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-DU0saWeg.js';
|
|
4
|
+
import { L as LocalHarness, G as GitRunner, r as runLocalHarness } from '../worktree-DaxOvw-C.js';
|
|
5
|
+
export { C as CreateWorktreeOptions, D as DiffOptions, a as DiffResult, b as LocalHarnessResult, R as RemoveWorktreeOptions, c as RunLocalHarnessOptions, W as WorktreeHandle, d as captureWorktreeDiff, e as createWorktree, f as removeWorktree } from '../worktree-DaxOvw-C.js';
|
|
6
6
|
export { C as CreateKbGateOptions, F as FactCandidate, a as FactJudge, b as FactJudgeVerdict, K as KbGateResult, c as createKbGate } from '../kb-gate-CuzMYGYM.js';
|
|
7
|
-
export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from '../openai-tools-
|
|
7
|
+
export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from '../openai-tools-CBurv8Cu.js';
|
|
8
8
|
import { AnalystFinding } from '@tangle-network/agent-eval';
|
|
9
9
|
import { U as UiLens } from '../substrate-rNj6TDc3.js';
|
|
10
10
|
import '@tangle-network/sandbox';
|
package/dist/mcp/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
mcpToolsForRuntimeMcp,
|
|
8
8
|
mcpToolsForRuntimeMcpSubset
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-7ODB76J5.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-
|
|
17
|
+
} from "../chunk-HPYWEFVY.js";
|
|
18
18
|
import {
|
|
19
19
|
DELEGATE_DESCRIPTION,
|
|
20
20
|
DELEGATE_FEEDBACK_DESCRIPTION,
|
|
@@ -69,11 +69,12 @@ import {
|
|
|
69
69
|
validateDelegateUiAuditArgs,
|
|
70
70
|
validateDelegationHistoryArgs,
|
|
71
71
|
validateDelegationStatusArgs
|
|
72
|
-
} from "../chunk-
|
|
72
|
+
} from "../chunk-NCH4XUZ7.js";
|
|
73
73
|
import "../chunk-VMNEQHJR.js";
|
|
74
|
+
import "../chunk-T2HVQVB4.js";
|
|
74
75
|
import {
|
|
75
76
|
ValidationError
|
|
76
|
-
} from "../chunk-
|
|
77
|
+
} from "../chunk-NBV35BR6.js";
|
|
77
78
|
import {
|
|
78
79
|
coderTaskToPrompt
|
|
79
80
|
} from "../chunk-UZ5SODU7.js";
|