@tangle-network/agent-runtime 0.89.0 → 0.90.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -18
- package/dist/agent.d.ts +53 -2
- package/dist/agent.js +166 -4
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/{chunk-PIPPLSOF.js → chunk-4IBAMGBE.js} +33 -3
- package/dist/chunk-4IBAMGBE.js.map +1 -0
- package/dist/chunk-5QOB7H74.js +387 -0
- package/dist/chunk-5QOB7H74.js.map +1 -0
- package/dist/chunk-74SBMDTO.js +214 -0
- package/dist/chunk-74SBMDTO.js.map +1 -0
- package/dist/{chunk-BQPFZE2C.js → chunk-MHK62APK.js} +5 -5
- package/dist/{chunk-N7EJV7N3.js → chunk-QSNSMJSZ.js} +3417 -3393
- package/dist/chunk-QSNSMJSZ.js.map +1 -0
- package/dist/{chunk-VNOOH22O.js → chunk-XMOU4WEY.js} +74 -3
- package/dist/chunk-XMOU4WEY.js.map +1 -0
- package/dist/{chunk-5AVV7KAH.js → chunk-XQEISTK2.js} +2 -2
- package/dist/{worktree-harness-CX_McRLp.d.ts → completion-gate-BDaBP8dd.d.ts} +44 -44
- package/dist/{coordination-CuDLO8wj.d.ts → coordination-DxHduZg7.d.ts} +414 -226
- package/dist/environment-provider.d.ts +3 -3
- package/dist/index.d.ts +156 -13
- package/dist/index.js +316 -70
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +2 -2
- package/dist/knowledge.d.ts +120 -0
- package/dist/knowledge.js +28 -0
- package/dist/knowledge.js.map +1 -0
- package/dist/lifecycle.js +1 -1
- package/dist/{loop-runner-bin-hQDUL8Ld.d.ts → loop-runner-bin-D3GmB2Ru.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +5 -5
- package/dist/loop-runner-bin.js +5 -5
- package/dist/loops.d.ts +46 -141
- package/dist/loops.js +3 -3
- package/dist/mcp/bin.js +2 -2
- package/dist/mcp/index.d.ts +8 -9
- package/dist/mcp/index.js +7 -7
- package/dist/{openai-tools-BnrOmGjN.d.ts → openai-tools-D0xmzo0y.d.ts} +1 -1
- package/dist/profiles.d.ts +196 -5
- package/dist/profiles.js +8 -0
- package/dist/profiles.js.map +1 -1
- package/dist/{router-client-r8y_VFVM.d.ts → router-client-DJImUDlm.d.ts} +1 -1
- package/dist/supervise-BpCdssu0.d.ts +131 -0
- package/dist/{types-Driepl87.d.ts → types-DAJQRIUD.d.ts} +2 -2
- package/dist/{types-ESeMOj94.d.ts → types-Dnk189QA.d.ts} +1 -1
- package/dist/{worktree-fanout-D6xR2CIA.d.ts → worktree-fanout-CfRXYmgV.d.ts} +3 -3
- package/package.json +12 -4
- package/skills/agent-runtime-adoption/SKILL.md +74 -24
- package/skills/build-with-agent-runtime/SKILL.md +3 -3
- package/skills/loop-writer/SKILL.md +6 -5
- package/skills/supervise/SKILL.md +2 -2
- package/dist/chunk-N7EJV7N3.js.map +0 -1
- package/dist/chunk-PIPPLSOF.js.map +0 -1
- package/dist/chunk-VNOOH22O.js.map +0 -1
- package/dist/otel-export-BKmNwiCb.d.ts +0 -180
- /package/dist/{chunk-BQPFZE2C.js.map → chunk-MHK62APK.js.map} +0 -0
- /package/dist/{chunk-5AVV7KAH.js.map → chunk-XQEISTK2.js.map} +0 -0
|
@@ -1,16 +1,234 @@
|
|
|
1
|
-
import { E as ExecutorFactory,
|
|
1
|
+
import { E as ExecutorFactory, e as ExecutorRegistry, i as Spend, A as Agent, S as Scope, a as ResultBlobStore, B as Budget } from './types-DAJQRIUD.js';
|
|
2
2
|
import { AgentProfile } from '@tangle-network/agent-interface';
|
|
3
3
|
import { U as UiLens, a as UiFinding, C as CoderTask } from './substrate-DO2GHNg2.js';
|
|
4
|
-
import {
|
|
5
|
-
import { SandboxEvent, SandboxInstance
|
|
4
|
+
import { S as SandboxClient, E as ExecCtx, e as LoopTraceEmitter, c as LoopTraceEvent, A as AgentRunSpec } from './types-Dnk189QA.js';
|
|
5
|
+
import { BackendType, SandboxEvent, SandboxInstance } from '@tangle-network/sandbox';
|
|
6
6
|
import { AgentEvalError } from '@tangle-network/agent-eval';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './worktree-harness-CX_McRLp.js';
|
|
7
|
+
import { b as ToolSpec, R as RouterConfig } from './router-client-DJImUDlm.js';
|
|
8
|
+
import { G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './completion-gate-BDaBP8dd.js';
|
|
10
9
|
import { L as LocalHarness } from './local-harness-sI0S_XNA.js';
|
|
11
10
|
import { ProviderExecutorOptions, AgentEnvironmentProviderRegistry } from './environment-provider.js';
|
|
12
11
|
import { AgentEnvironmentProvider } from '@tangle-network/agent-interface/environment-provider';
|
|
13
12
|
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* The leaf runtime — the built-in `Executor` IMPLEMENTATIONS behind the ONE
|
|
16
|
+
* open interface frozen in `./types`, plus the open resolver/registry that maps
|
|
17
|
+
* an `AgentSpec` to one of them OR accepts a bring-your-own executor verbatim.
|
|
18
|
+
*
|
|
19
|
+
* The interface is the extension point, not a closed `inline|sandbox|cli` union:
|
|
20
|
+
* - router/inline : a direct OpenAI-compatible Router call, no box (one-shot).
|
|
21
|
+
* - sandbox : COMPOSES the existing `runLoop` kernel as a single-task
|
|
22
|
+
* leaf and surfaces its token/cost usage as `UsageEvent`s;
|
|
23
|
+
* forwards PR #150's optional `lineage` passthrough WITHOUT
|
|
24
|
+
* reinventing checkpoint/fork (streaming).
|
|
25
|
+
* - cli : a Halo/RLM subprocess; `budgetExempt` (no token accounting),
|
|
26
|
+
* excluded from the equal-k arms by construction (streaming).
|
|
27
|
+
* Every metered runtime reports through the SAME normalized `UsageEvent` channel
|
|
28
|
+
* so the conserved budget pool meters them identically. A user's own agent is
|
|
29
|
+
* first-class the moment it implements `Executor` — register it by name or
|
|
30
|
+
* pass it as `AgentSpec.executor`.
|
|
31
|
+
*
|
|
32
|
+
* Layering: `estimateCost`/`isModelPriced` are substrate primitives from
|
|
33
|
+
* `@tangle-network/agent-eval`; `runLoop`/`acquireSandbox` are runtime kernels
|
|
34
|
+
* from this package. No per-vendor adapters live here.
|
|
35
|
+
*
|
|
36
|
+
* @experimental
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Router/inline connection seam. A direct OpenAI-compatible Router endpoint —
|
|
41
|
+
* the cheapest leaf, no box, no tools. `model` overrides the profile's model
|
|
42
|
+
* hint when present; otherwise the profile's `model.default` is required.
|
|
43
|
+
*/
|
|
44
|
+
interface RouterSeam {
|
|
45
|
+
routerBaseUrl: string;
|
|
46
|
+
routerKey: string;
|
|
47
|
+
model?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Sandbox executor seam. The `sandboxClient` the composed `runLoop` creates
|
|
51
|
+
* boxes through, plus the optional trace/run/lineage wiring forwarded into the
|
|
52
|
+
* loop. `lineage` is opaque here (PR #150's `RunLoopOptions.lineage`): forwarded
|
|
53
|
+
* forward-compatibly, never inspected — this executor does NOT reinvent
|
|
54
|
+
* checkpoint/fork.
|
|
55
|
+
*/
|
|
56
|
+
interface SandboxSeam {
|
|
57
|
+
sandboxClient: SandboxClient;
|
|
58
|
+
/** Forwarded into the composed `runLoop`'s `ctx` (trace emitter, run handle, etc.). */
|
|
59
|
+
loopCtx?: Partial<Omit<ExecCtx, 'sandboxClient' | 'signal'>>;
|
|
60
|
+
/** PR #150 `RunLoopOptions.lineage` passthrough — opaque; forwarded, not parsed. */
|
|
61
|
+
lineage?: unknown;
|
|
62
|
+
/** Hard cap on the composed loop's iterations. The budget pool reserves against
|
|
63
|
+
* the spawn `Budget.maxIterations`; this is the leaf's own ceiling. Default 1. */
|
|
64
|
+
maxIterations?: number;
|
|
65
|
+
}
|
|
66
|
+
/** CLI subprocess seam. `bin` + `args` describe the Halo/RLM process to spawn. */
|
|
67
|
+
interface CliSeam {
|
|
68
|
+
bin: string;
|
|
69
|
+
args?: string[];
|
|
70
|
+
/** Extra environment for the subprocess (merged over `process.env`). */
|
|
71
|
+
env?: Record<string, string>;
|
|
72
|
+
/** Working directory for the subprocess. */
|
|
73
|
+
cwd?: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* cli-worktree seam. A supervisor-authored `AgentProfile` driving a local coding-harness CLI
|
|
77
|
+
* (claude / codex / opencode) on its own git worktree — the leaf `createWorktreeCliExecutor`
|
|
78
|
+
* named as data. `harness` + `repoRoot` + `taskPrompt` are required; the authored
|
|
79
|
+
* `profile.prompt.systemPrompt` + `profile.model.default` reach the harness via the §1.5
|
|
80
|
+
* `harnessInvocation` mapper. Everything else mirrors `WorktreeCliExecutorOptions`.
|
|
81
|
+
*/
|
|
82
|
+
interface CliWorktreeSeam {
|
|
83
|
+
repoRoot: string;
|
|
84
|
+
/** Local CLI harness transport. Omit when `bridge` is set. */
|
|
85
|
+
harness?: LocalHarness;
|
|
86
|
+
taskPrompt: string;
|
|
87
|
+
runId?: string;
|
|
88
|
+
baseRef?: string;
|
|
89
|
+
harnessTimeoutMs?: number;
|
|
90
|
+
testCmd?: string;
|
|
91
|
+
typecheckCmd?: string;
|
|
92
|
+
checkTimeoutMs?: number;
|
|
93
|
+
checkOutputCap?: number;
|
|
94
|
+
budgetExempt?: boolean;
|
|
95
|
+
/** Live cli-bridge transport inside the worktree. When set, the worktree leaf accepts
|
|
96
|
+
* `deliver()` messages and resumes the same bridge session in this worktree cwd. */
|
|
97
|
+
bridge?: CliWorktreeBridgeSeam;
|
|
98
|
+
/** Test seam — forwarded to worktree helpers. */
|
|
99
|
+
runGit?: GitRunner;
|
|
100
|
+
/** Test seam — forwarded to verification checks. */
|
|
101
|
+
runCommand?: WorktreeCheckRunner;
|
|
102
|
+
}
|
|
103
|
+
interface CliWorktreeBridgeSeam {
|
|
104
|
+
bridgeUrl: string;
|
|
105
|
+
bridgeBearer: string;
|
|
106
|
+
/** Bridge model/harness id. Defaults to the profile's model hint when omitted. */
|
|
107
|
+
model?: string;
|
|
108
|
+
agentProfile?: Record<string, unknown>;
|
|
109
|
+
timeoutMs?: number;
|
|
110
|
+
/** Stable cli-bridge session id. Defaults to `bridge-worktree-${runId}`. */
|
|
111
|
+
sessionId?: string;
|
|
112
|
+
maxTurns?: number;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* cli-bridge seam. A local OpenAI-compatible bridge that fronts harness CLIs
|
|
116
|
+
* (claude-code / opencode / kimi / pi) behind one HTTP surface; `model` doubles
|
|
117
|
+
* as the harness selector (e.g. `claude-code/sonnet`, `opencode/<provider>/<model>`).
|
|
118
|
+
* `agentProfile` is the bridge-dialect profile (metadata.disallowedTools, mcp)
|
|
119
|
+
* forwarded verbatim per request — how an arm disables native tools or injects
|
|
120
|
+
* a provider search MCP.
|
|
121
|
+
*
|
|
122
|
+
* The executor opens a RESUMABLE cli-bridge session — structurally identical to the
|
|
123
|
+
* sandbox executor's persistent box, just local. `sessionId` is the stable
|
|
124
|
+
* caller-owned id cli-bridge maps to the harness's internal conversation id; a
|
|
125
|
+
* follow-up steer/resume on the SAME id continues the SAME harness session (opencode
|
|
126
|
+
* `-s`, claude `--resume`, …). Omit it and the executor mints a stable one per spawn.
|
|
127
|
+
*/
|
|
128
|
+
interface BridgeSeam {
|
|
129
|
+
bridgeUrl: string;
|
|
130
|
+
bridgeBearer: string;
|
|
131
|
+
model: string;
|
|
132
|
+
/** Optional working directory forwarded to cli-bridge and persisted with the session. */
|
|
133
|
+
cwd?: string;
|
|
134
|
+
agentProfile?: Record<string, unknown>;
|
|
135
|
+
timeoutMs?: number;
|
|
136
|
+
/** Stable, caller-owned cli-bridge session id for harness-side resume. Defaults
|
|
137
|
+
* to a freshly minted per-spawn id so each worker is its own resumable session. */
|
|
138
|
+
sessionId?: string;
|
|
139
|
+
/** Per-resume-turn inference cap before the worker settles on its last output.
|
|
140
|
+
* Mirrors `routerToolsInlineExecutor.maxTurns`; default 200 (runaway backstop). */
|
|
141
|
+
maxTurns?: number;
|
|
142
|
+
}
|
|
143
|
+
/** Generic environment provider executor config. External packages implement
|
|
144
|
+
* `AgentEnvironmentProvider`; this built-in wrapper lets `createExecutor`
|
|
145
|
+
* consume them as backend data while preserving the existing usage channel. */
|
|
146
|
+
interface ProviderSeam extends ProviderExecutorOptions {
|
|
147
|
+
provider: AgentEnvironmentProvider | string;
|
|
148
|
+
registry?: AgentEnvironmentProviderRegistry;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Router seam WITH tool use — the tool-using router backend. Same direct
|
|
152
|
+
* OpenAI-compatible endpoint as `RouterSeam`, but each turn passes `tools`; when
|
|
153
|
+
* the model emits tool_calls they run via `executeToolCall` ON THIS HOST and the
|
|
154
|
+
* results fold back as `tool` messages, repeating until the model answers without
|
|
155
|
+
* a tool or `maxTurns` is hit. A real agentic loop, OFF-BOX — no sandbox, so it
|
|
156
|
+
* is unaffected by a box's egress allowlist. One turn = one completion = the
|
|
157
|
+
* equal-compute unit. `executeToolCall` receives the task so per-task tool
|
|
158
|
+
* surfaces (e.g. a gym keyed by task) can dispatch correctly.
|
|
159
|
+
*/
|
|
160
|
+
interface RouterToolsSeam {
|
|
161
|
+
routerBaseUrl: string;
|
|
162
|
+
routerKey: string;
|
|
163
|
+
model?: string;
|
|
164
|
+
tools: ReadonlyArray<ToolSpec>;
|
|
165
|
+
executeToolCall: (name: string, args: Record<string, unknown>, task: unknown) => Promise<string>;
|
|
166
|
+
/** Online observer of each tool step — the seam a `DetectorMonitor` taps to watch the live pipe
|
|
167
|
+
* (raise a `finding` when the worker loops/errors). Called after every tool call resolves, with
|
|
168
|
+
* real per-call wall-clock (`startedAt`/`endedAt`/`durationMs`) so a push `TraceSource` can carry
|
|
169
|
+
* non-zero span durations onto the unified timeline. */
|
|
170
|
+
onToolStep?: (step: {
|
|
171
|
+
toolName: string;
|
|
172
|
+
args: Record<string, unknown>;
|
|
173
|
+
status: 'ok' | 'error';
|
|
174
|
+
startedAt?: number;
|
|
175
|
+
endedAt?: number;
|
|
176
|
+
durationMs?: number;
|
|
177
|
+
}) => void;
|
|
178
|
+
/** Max inference turns. Default 200 (runaway backstop — set far above any
|
|
179
|
+
* legitimate workflow). For tighter per-workflow limits use a cost budget
|
|
180
|
+
* or wall-clock deadline at the call site. */
|
|
181
|
+
maxTurns?: number;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* The leaf `createWorktreeCliExecutor` as a backend-as-data factory: a supervisor-authored
|
|
185
|
+
* `AgentProfile` driving claude / codex / opencode on its own worktree. `budgetExempt` like
|
|
186
|
+
* the other CLI leaves; the authored systemPrompt + model reach the harness via §1.5.
|
|
187
|
+
*/
|
|
188
|
+
declare const cliWorktreeExecutor: ExecutorFactory<unknown>;
|
|
189
|
+
/**
|
|
190
|
+
* Config for {@link createExecutor}: the backend is DATA — the cost dial a profile,
|
|
191
|
+
* an experiment config, or a replay journal can name — not an import choice. Each
|
|
192
|
+
* variant carries its backend's seam (router/router-tools/bridge/cli/cli-worktree/sandbox).
|
|
193
|
+
*/
|
|
194
|
+
type ExecutorConfig = ({
|
|
195
|
+
backend: 'router';
|
|
196
|
+
} & RouterSeam) | ({
|
|
197
|
+
backend: 'router-tools';
|
|
198
|
+
} & RouterToolsSeam) | ({
|
|
199
|
+
backend: 'bridge';
|
|
200
|
+
} & BridgeSeam) | ({
|
|
201
|
+
backend: 'cli';
|
|
202
|
+
} & CliSeam) | ({
|
|
203
|
+
backend: 'cli-worktree';
|
|
204
|
+
} & CliWorktreeSeam) | ({
|
|
205
|
+
backend: 'provider';
|
|
206
|
+
} & ProviderSeam) | ({
|
|
207
|
+
backend: 'sandbox';
|
|
208
|
+
harness?: BackendType;
|
|
209
|
+
} & SandboxSeam);
|
|
210
|
+
/**
|
|
211
|
+
* The single built-in executor factory. Picks a leaf backend by data (`config.backend`),
|
|
212
|
+
* injects the matching seam, and delegates to that backend's built-in implementation.
|
|
213
|
+
* The `Executor` port stays OPEN: bring-your-own agents implement `Executor` directly
|
|
214
|
+
* and never pass through here. Use this (or `createExecutorRegistry`) instead of a
|
|
215
|
+
* per-vendor adapter or a closed `inline|sandbox|cli` switch — those bypass the
|
|
216
|
+
* `UsageEvent` reporting channel.
|
|
217
|
+
*/
|
|
218
|
+
declare function createExecutor(config: ExecutorConfig): ExecutorFactory<unknown>;
|
|
219
|
+
/**
|
|
220
|
+
* The open resolver/registry. Pre-registers the three built-ins under their
|
|
221
|
+
* runtime tags (`'router'`, `'sandbox'`, `'cli'`) and accepts `register(name,
|
|
222
|
+
* factory)` for any additional runtime — and a BYO `AgentSpec.executor` resolves
|
|
223
|
+
* without touching the registry at all. NOT a closed switch; registration + BYO
|
|
224
|
+
* ARE the extension points.
|
|
225
|
+
*
|
|
226
|
+
* `resolve` precedence (frozen in `ExecutorRegistry`): a BYO `spec.executor` →
|
|
227
|
+
* `harness === null` → the `'router'` factory; else a registered factory for the
|
|
228
|
+
* harness-derived runtime (`'sandbox'` for any `BackendType`); else fail loud.
|
|
229
|
+
*/
|
|
230
|
+
declare function createExecutorRegistry(): ExecutorRegistry;
|
|
231
|
+
|
|
14
232
|
/**
|
|
15
233
|
*
|
|
16
234
|
* The child→parent message bus: the ONE pipe carrying every message a worker, sub-driver, or
|
|
@@ -342,6 +560,185 @@ declare function createDelegationTraceCollector(onSpans: (spans: DelegationTrace
|
|
|
342
560
|
*/
|
|
343
561
|
declare function composeLoopTraceEmitters(...emitters: ReadonlyArray<LoopTraceEmitter | undefined>): LoopTraceEmitter | undefined;
|
|
344
562
|
|
|
563
|
+
/**
|
|
564
|
+
* OTEL span exporter — streams LoopTraceEvents to an OTLP/HTTP collector.
|
|
565
|
+
*
|
|
566
|
+
* Reads OTEL_EXPORTER_OTLP_ENDPOINT + OTEL_EXPORTER_OTLP_HEADERS from env
|
|
567
|
+
* when no explicit config is given. Keeps the runtime dep-free from
|
|
568
|
+
* @opentelemetry/sdk-trace-base — minimal OTLP/JSON serializer.
|
|
569
|
+
*
|
|
570
|
+
* The exporter accepts both raw OtelSpan objects and LoopTraceEvents
|
|
571
|
+
* (which get converted to OTLP spans automatically).
|
|
572
|
+
*/
|
|
573
|
+
interface OtelExportConfig {
|
|
574
|
+
/** OTLP endpoint. Reads OTEL_EXPORTER_OTLP_ENDPOINT env by default. */
|
|
575
|
+
endpoint?: string;
|
|
576
|
+
/** OTLP headers. Reads OTEL_EXPORTER_OTLP_HEADERS env by default. */
|
|
577
|
+
headers?: Record<string, string>;
|
|
578
|
+
/** Batch size before flush. Default 64. */
|
|
579
|
+
batchSize?: number;
|
|
580
|
+
/** Flush interval ms. Default 5000. */
|
|
581
|
+
flushIntervalMs?: number;
|
|
582
|
+
/** Resource attributes stamped on every export. */
|
|
583
|
+
resourceAttributes?: Record<string, string | number | boolean>;
|
|
584
|
+
/** Service name. Default 'agent-runtime'. */
|
|
585
|
+
serviceName?: string;
|
|
586
|
+
}
|
|
587
|
+
interface OtelExporter {
|
|
588
|
+
/** Export a span. */
|
|
589
|
+
exportSpan(span: OtelSpan): void;
|
|
590
|
+
/** Force flush pending spans. */
|
|
591
|
+
flush(): Promise<void>;
|
|
592
|
+
/** Shutdown cleanly. */
|
|
593
|
+
shutdown(): Promise<void>;
|
|
594
|
+
}
|
|
595
|
+
interface OtelSpan {
|
|
596
|
+
traceId: string;
|
|
597
|
+
spanId: string;
|
|
598
|
+
parentSpanId?: string;
|
|
599
|
+
name: string;
|
|
600
|
+
kind?: number;
|
|
601
|
+
startTimeUnixNano: string;
|
|
602
|
+
endTimeUnixNano: string;
|
|
603
|
+
attributes?: OtelAttribute[];
|
|
604
|
+
status?: {
|
|
605
|
+
code: number;
|
|
606
|
+
message?: string;
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
interface OtelAttribute {
|
|
610
|
+
key: string;
|
|
611
|
+
value: {
|
|
612
|
+
stringValue?: string;
|
|
613
|
+
intValue?: string;
|
|
614
|
+
doubleValue?: number;
|
|
615
|
+
boolValue?: boolean;
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Create an OTEL exporter. Returns undefined when no endpoint is configured.
|
|
620
|
+
*/
|
|
621
|
+
declare function createOtelExporter(config?: OtelExportConfig): OtelExporter | undefined;
|
|
622
|
+
/**
|
|
623
|
+
* Convert a LoopTraceEvent into an OtelSpan for export.
|
|
624
|
+
*/
|
|
625
|
+
declare function loopEventToOtelSpan(event: {
|
|
626
|
+
kind: string;
|
|
627
|
+
runId: string;
|
|
628
|
+
timestamp: number;
|
|
629
|
+
payload: object;
|
|
630
|
+
}, traceId: string, parentSpanId?: string): OtelSpan;
|
|
631
|
+
/**
|
|
632
|
+
* Sink-neutral node in a reconstructed loop span tree. The root node's
|
|
633
|
+
* `parentSpanId` is `undefined` — sinks decide how to parent it (the OTEL
|
|
634
|
+
* mapper attaches the inherited delegation span; the delegation journal
|
|
635
|
+
* leaves it as the tree root).
|
|
636
|
+
*/
|
|
637
|
+
interface LoopSpanNode {
|
|
638
|
+
spanId: string;
|
|
639
|
+
parentSpanId?: string;
|
|
640
|
+
/** `'loop'` | `'loop.round'` | `'loop.iteration'`. */
|
|
641
|
+
name: string;
|
|
642
|
+
/** Topology level: loop root, plan round, or iteration branch. */
|
|
643
|
+
kind: 'loop' | 'round' | 'branch';
|
|
644
|
+
startMs: number;
|
|
645
|
+
endMs: number;
|
|
646
|
+
attrs: Record<string, string | number | boolean>;
|
|
647
|
+
/** True when the iteration carried an error — maps to OTEL status code 2. */
|
|
648
|
+
error: boolean;
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Build a nested, real-duration OTLP span tree for ONE loop run from its full
|
|
652
|
+
* ordered `LoopTraceEvent` stream. Unlike `loopEventToOtelSpan` (one flat,
|
|
653
|
+
* zero-duration span per event), this reconstructs the topology hierarchy a
|
|
654
|
+
* GenAI trace viewer renders natively:
|
|
655
|
+
*
|
|
656
|
+
* loop (invoke_workflow)
|
|
657
|
+
* └─ loop.round[k] (invoke_workflow) ← tangle.loop.move.{kind,width,rationale}
|
|
658
|
+
* ├─ loop.iteration[i] (invoke_agent) ← gen_ai.agent.name + usage + verdict + placement
|
|
659
|
+
* └─ …
|
|
660
|
+
*
|
|
661
|
+
* Attributes follow the current GenAI semconv (`gen_ai.*`) where they apply and
|
|
662
|
+
* a namespaced `tangle.loop.*` / `tangle.cost.usd` extension for topology /
|
|
663
|
+
* verdict / placement / cost (not yet standardized). Pure: feed it a buffered
|
|
664
|
+
* per-runId event array (e.g. flushed on `loop.ended`) and export the result.
|
|
665
|
+
*/
|
|
666
|
+
declare function buildLoopOtelSpans(events: ReadonlyArray<{
|
|
667
|
+
kind: string;
|
|
668
|
+
runId: string;
|
|
669
|
+
timestamp: number;
|
|
670
|
+
payload: object;
|
|
671
|
+
}>, traceId: string, rootParentSpanId?: string): OtelSpan[];
|
|
672
|
+
/**
|
|
673
|
+
* Sink-neutral core behind {@link buildLoopOtelSpans}: reconstruct the
|
|
674
|
+
* loop → round → branch span tree from one run's ordered `LoopTraceEvent`
|
|
675
|
+
* stream. Consumed by the OTEL mapper above and by the MCP delegation
|
|
676
|
+
* journal's compact trace tee — one topology reconstruction, two sinks.
|
|
677
|
+
* Tolerates partial streams (a run that never reached `loop.ended` closes
|
|
678
|
+
* at the last observed event's timestamp).
|
|
679
|
+
*/
|
|
680
|
+
declare function buildLoopSpanNodes(events: ReadonlyArray<{
|
|
681
|
+
kind: string;
|
|
682
|
+
runId: string;
|
|
683
|
+
timestamp: number;
|
|
684
|
+
payload: object;
|
|
685
|
+
}>): LoopSpanNode[];
|
|
686
|
+
/** Wire version the eval-runs ingest enforces (X-Tangle-Wire-Version + body). */
|
|
687
|
+
declare const INTELLIGENCE_WIRE_VERSION = "2026-05-26.v1";
|
|
688
|
+
interface EvalRunGeneration {
|
|
689
|
+
/** 0-based ordinal of this generation within the run (required by ingest). */
|
|
690
|
+
index: number;
|
|
691
|
+
/** Identity of the proposed surface change (content-addressed hash). */
|
|
692
|
+
surfaceHash: string;
|
|
693
|
+
/** Arbitrary provenance for this generation (rationale, evidence, source). */
|
|
694
|
+
surface?: unknown;
|
|
695
|
+
/** Per-scenario results; empty until the generation is measured. */
|
|
696
|
+
cells?: unknown[];
|
|
697
|
+
/** Mean composite score (0 when unmeasured — pair with labels.measured). */
|
|
698
|
+
compositeMean: number;
|
|
699
|
+
costUsd: number;
|
|
700
|
+
durationMs: number;
|
|
701
|
+
}
|
|
702
|
+
interface EvalRunEvent {
|
|
703
|
+
runId: string;
|
|
704
|
+
runDir: string;
|
|
705
|
+
/** ISO timestamp. */
|
|
706
|
+
timestamp: string;
|
|
707
|
+
status: 'started' | 'baseline-complete' | 'generation-complete' | 'gate-decided' | 'finished' | 'errored';
|
|
708
|
+
labels?: Record<string, string>;
|
|
709
|
+
baseline?: EvalRunGeneration;
|
|
710
|
+
generations?: EvalRunGeneration[];
|
|
711
|
+
gateDecision?: 'ship' | 'hold' | 'need_more_work' | 'model_ceiling' | 'arch_ceiling';
|
|
712
|
+
holdoutLift?: number;
|
|
713
|
+
totalCostUsd: number;
|
|
714
|
+
totalDurationMs: number;
|
|
715
|
+
errorMessage?: string;
|
|
716
|
+
}
|
|
717
|
+
interface EvalRunsExportConfig {
|
|
718
|
+
/** Bearer key — tenant is resolved server-side from it. Reads TANGLE_API_KEY. */
|
|
719
|
+
apiKey?: string;
|
|
720
|
+
/** Intelligence base. Reads INTELLIGENCE_BASE env, else prod. */
|
|
721
|
+
base?: string;
|
|
722
|
+
/** Idempotency-Key header (e.g. the runId) — safe retries + upsert. */
|
|
723
|
+
idempotencyKey?: string;
|
|
724
|
+
}
|
|
725
|
+
interface EvalRunsExportResult {
|
|
726
|
+
ok: boolean;
|
|
727
|
+
status: number;
|
|
728
|
+
accepted: number;
|
|
729
|
+
rejected: Array<{
|
|
730
|
+
index: number;
|
|
731
|
+
reason: string;
|
|
732
|
+
}>;
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* Ship self-improvement eval-run events to Tangle Intelligence. Unlike the
|
|
736
|
+
* best-effort span exporter, this RESOLVES with the ingest verdict (accepted /
|
|
737
|
+
* rejected per event) so a consumer's loop can assert its provenance landed.
|
|
738
|
+
* Throws only on a missing key or network failure.
|
|
739
|
+
*/
|
|
740
|
+
declare function exportEvalRuns(events: EvalRunEvent[], config?: EvalRunsExportConfig): Promise<EvalRunsExportResult>;
|
|
741
|
+
|
|
345
742
|
/**
|
|
346
743
|
*
|
|
347
744
|
* Trace context propagation for MCP subprocess.
|
|
@@ -1551,225 +1948,6 @@ declare class InMemoryFeedbackStore implements FeedbackStore {
|
|
|
1551
1948
|
*/
|
|
1552
1949
|
declare function eventToSnapshot(event: FeedbackEvent): DelegationFeedbackSnapshot;
|
|
1553
1950
|
|
|
1554
|
-
/**
|
|
1555
|
-
*
|
|
1556
|
-
* The leaf runtime — the built-in `Executor` IMPLEMENTATIONS behind the ONE
|
|
1557
|
-
* open interface frozen in `./types`, plus the open resolver/registry that maps
|
|
1558
|
-
* an `AgentSpec` to one of them OR accepts a bring-your-own executor verbatim.
|
|
1559
|
-
*
|
|
1560
|
-
* The interface is the extension point, not a closed `inline|sandbox|cli` union:
|
|
1561
|
-
* - router/inline : a direct OpenAI-compatible Router call, no box (one-shot).
|
|
1562
|
-
* - sandbox : COMPOSES the existing `runLoop` kernel as a single-task
|
|
1563
|
-
* leaf and surfaces its token/cost usage as `UsageEvent`s;
|
|
1564
|
-
* forwards PR #150's optional `lineage` passthrough WITHOUT
|
|
1565
|
-
* reinventing checkpoint/fork (streaming).
|
|
1566
|
-
* - cli : a Halo/RLM subprocess; `budgetExempt` (no token accounting),
|
|
1567
|
-
* excluded from the equal-k arms by construction (streaming).
|
|
1568
|
-
* Every metered runtime reports through the SAME normalized `UsageEvent` channel
|
|
1569
|
-
* so the conserved budget pool meters them identically. A user's own agent is
|
|
1570
|
-
* first-class the moment it implements `Executor` — register it by name or
|
|
1571
|
-
* pass it as `AgentSpec.executor`.
|
|
1572
|
-
*
|
|
1573
|
-
* Layering: `estimateCost`/`isModelPriced` are substrate primitives from
|
|
1574
|
-
* `@tangle-network/agent-eval`; `runLoop`/`acquireSandbox` are runtime kernels
|
|
1575
|
-
* from this package. No per-vendor adapters live here.
|
|
1576
|
-
*
|
|
1577
|
-
* @experimental
|
|
1578
|
-
*/
|
|
1579
|
-
|
|
1580
|
-
/**
|
|
1581
|
-
* Router/inline connection seam. A direct OpenAI-compatible Router endpoint —
|
|
1582
|
-
* the cheapest leaf, no box, no tools. `model` overrides the profile's model
|
|
1583
|
-
* hint when present; otherwise the profile's `model.default` is required.
|
|
1584
|
-
*/
|
|
1585
|
-
interface RouterSeam {
|
|
1586
|
-
routerBaseUrl: string;
|
|
1587
|
-
routerKey: string;
|
|
1588
|
-
model?: string;
|
|
1589
|
-
}
|
|
1590
|
-
/**
|
|
1591
|
-
* Sandbox executor seam. The `sandboxClient` the composed `runLoop` creates
|
|
1592
|
-
* boxes through, plus the optional trace/run/lineage wiring forwarded into the
|
|
1593
|
-
* loop. `lineage` is opaque here (PR #150's `RunLoopOptions.lineage`): forwarded
|
|
1594
|
-
* forward-compatibly, never inspected — this executor does NOT reinvent
|
|
1595
|
-
* checkpoint/fork.
|
|
1596
|
-
*/
|
|
1597
|
-
interface SandboxSeam {
|
|
1598
|
-
sandboxClient: SandboxClient;
|
|
1599
|
-
/** Forwarded into the composed `runLoop`'s `ctx` (trace emitter, run handle, etc.). */
|
|
1600
|
-
loopCtx?: Partial<Omit<ExecCtx, 'sandboxClient' | 'signal'>>;
|
|
1601
|
-
/** PR #150 `RunLoopOptions.lineage` passthrough — opaque; forwarded, not parsed. */
|
|
1602
|
-
lineage?: unknown;
|
|
1603
|
-
/** Hard cap on the composed loop's iterations. The budget pool reserves against
|
|
1604
|
-
* the spawn `Budget.maxIterations`; this is the leaf's own ceiling. Default 1. */
|
|
1605
|
-
maxIterations?: number;
|
|
1606
|
-
}
|
|
1607
|
-
/** CLI subprocess seam. `bin` + `args` describe the Halo/RLM process to spawn. */
|
|
1608
|
-
interface CliSeam {
|
|
1609
|
-
bin: string;
|
|
1610
|
-
args?: string[];
|
|
1611
|
-
/** Extra environment for the subprocess (merged over `process.env`). */
|
|
1612
|
-
env?: Record<string, string>;
|
|
1613
|
-
/** Working directory for the subprocess. */
|
|
1614
|
-
cwd?: string;
|
|
1615
|
-
}
|
|
1616
|
-
/**
|
|
1617
|
-
* cli-worktree seam. A supervisor-authored `AgentProfile` driving a local coding-harness CLI
|
|
1618
|
-
* (claude / codex / opencode) on its own git worktree — the leaf `createWorktreeCliExecutor`
|
|
1619
|
-
* named as data. `harness` + `repoRoot` + `taskPrompt` are required; the authored
|
|
1620
|
-
* `profile.prompt.systemPrompt` + `profile.model.default` reach the harness via the §1.5
|
|
1621
|
-
* `harnessInvocation` mapper. Everything else mirrors `WorktreeCliExecutorOptions`.
|
|
1622
|
-
*/
|
|
1623
|
-
interface CliWorktreeSeam {
|
|
1624
|
-
repoRoot: string;
|
|
1625
|
-
/** Local CLI harness transport. Omit when `bridge` is set. */
|
|
1626
|
-
harness?: LocalHarness;
|
|
1627
|
-
taskPrompt: string;
|
|
1628
|
-
runId?: string;
|
|
1629
|
-
baseRef?: string;
|
|
1630
|
-
harnessTimeoutMs?: number;
|
|
1631
|
-
testCmd?: string;
|
|
1632
|
-
typecheckCmd?: string;
|
|
1633
|
-
checkTimeoutMs?: number;
|
|
1634
|
-
checkOutputCap?: number;
|
|
1635
|
-
budgetExempt?: boolean;
|
|
1636
|
-
/** Live cli-bridge transport inside the worktree. When set, the worktree leaf accepts
|
|
1637
|
-
* `deliver()` messages and resumes the same bridge session in this worktree cwd. */
|
|
1638
|
-
bridge?: CliWorktreeBridgeSeam;
|
|
1639
|
-
/** Test seam — forwarded to worktree helpers. */
|
|
1640
|
-
runGit?: GitRunner;
|
|
1641
|
-
/** Test seam — forwarded to verification checks. */
|
|
1642
|
-
runCommand?: WorktreeCheckRunner;
|
|
1643
|
-
}
|
|
1644
|
-
interface CliWorktreeBridgeSeam {
|
|
1645
|
-
bridgeUrl: string;
|
|
1646
|
-
bridgeBearer: string;
|
|
1647
|
-
/** Bridge model/harness id. Defaults to the profile's model hint when omitted. */
|
|
1648
|
-
model?: string;
|
|
1649
|
-
agentProfile?: Record<string, unknown>;
|
|
1650
|
-
timeoutMs?: number;
|
|
1651
|
-
/** Stable cli-bridge session id. Defaults to `bridge-worktree-${runId}`. */
|
|
1652
|
-
sessionId?: string;
|
|
1653
|
-
maxTurns?: number;
|
|
1654
|
-
}
|
|
1655
|
-
/**
|
|
1656
|
-
* cli-bridge seam. A local OpenAI-compatible bridge that fronts harness CLIs
|
|
1657
|
-
* (claude-code / opencode / kimi / pi) behind one HTTP surface; `model` doubles
|
|
1658
|
-
* as the harness selector (e.g. `claude-code/sonnet`, `opencode/<provider>/<model>`).
|
|
1659
|
-
* `agentProfile` is the bridge-dialect profile (metadata.disallowedTools, mcp)
|
|
1660
|
-
* forwarded verbatim per request — how an arm disables native tools or injects
|
|
1661
|
-
* a provider search MCP.
|
|
1662
|
-
*
|
|
1663
|
-
* The executor opens a RESUMABLE cli-bridge session — structurally identical to the
|
|
1664
|
-
* sandbox executor's persistent box, just local. `sessionId` is the stable
|
|
1665
|
-
* caller-owned id cli-bridge maps to the harness's internal conversation id; a
|
|
1666
|
-
* follow-up steer/resume on the SAME id continues the SAME harness session (opencode
|
|
1667
|
-
* `-s`, claude `--resume`, …). Omit it and the executor mints a stable one per spawn.
|
|
1668
|
-
*/
|
|
1669
|
-
interface BridgeSeam {
|
|
1670
|
-
bridgeUrl: string;
|
|
1671
|
-
bridgeBearer: string;
|
|
1672
|
-
model: string;
|
|
1673
|
-
/** Optional working directory forwarded to cli-bridge and persisted with the session. */
|
|
1674
|
-
cwd?: string;
|
|
1675
|
-
agentProfile?: Record<string, unknown>;
|
|
1676
|
-
timeoutMs?: number;
|
|
1677
|
-
/** Stable, caller-owned cli-bridge session id for harness-side resume. Defaults
|
|
1678
|
-
* to a freshly minted per-spawn id so each worker is its own resumable session. */
|
|
1679
|
-
sessionId?: string;
|
|
1680
|
-
/** Per-resume-turn inference cap before the worker settles on its last output.
|
|
1681
|
-
* Mirrors `routerToolsInlineExecutor.maxTurns`; default 200 (runaway backstop). */
|
|
1682
|
-
maxTurns?: number;
|
|
1683
|
-
}
|
|
1684
|
-
/** Generic environment provider executor config. External packages implement
|
|
1685
|
-
* `AgentEnvironmentProvider`; this built-in wrapper lets `createExecutor`
|
|
1686
|
-
* consume them as backend data while preserving the existing usage channel. */
|
|
1687
|
-
interface ProviderSeam extends ProviderExecutorOptions {
|
|
1688
|
-
provider: AgentEnvironmentProvider | string;
|
|
1689
|
-
registry?: AgentEnvironmentProviderRegistry;
|
|
1690
|
-
}
|
|
1691
|
-
/**
|
|
1692
|
-
* Router seam WITH tool use — the tool-using router backend. Same direct
|
|
1693
|
-
* OpenAI-compatible endpoint as `RouterSeam`, but each turn passes `tools`; when
|
|
1694
|
-
* the model emits tool_calls they run via `executeToolCall` ON THIS HOST and the
|
|
1695
|
-
* results fold back as `tool` messages, repeating until the model answers without
|
|
1696
|
-
* a tool or `maxTurns` is hit. A real agentic loop, OFF-BOX — no sandbox, so it
|
|
1697
|
-
* is unaffected by a box's egress allowlist. One turn = one completion = the
|
|
1698
|
-
* equal-compute unit. `executeToolCall` receives the task so per-task tool
|
|
1699
|
-
* surfaces (e.g. a gym keyed by task) can dispatch correctly.
|
|
1700
|
-
*/
|
|
1701
|
-
interface RouterToolsSeam {
|
|
1702
|
-
routerBaseUrl: string;
|
|
1703
|
-
routerKey: string;
|
|
1704
|
-
model?: string;
|
|
1705
|
-
tools: ReadonlyArray<ToolSpec>;
|
|
1706
|
-
executeToolCall: (name: string, args: Record<string, unknown>, task: unknown) => Promise<string>;
|
|
1707
|
-
/** Online observer of each tool step — the seam a `DetectorMonitor` taps to watch the live pipe
|
|
1708
|
-
* (raise a `finding` when the worker loops/errors). Called after every tool call resolves, with
|
|
1709
|
-
* real per-call wall-clock (`startedAt`/`endedAt`/`durationMs`) so a push `TraceSource` can carry
|
|
1710
|
-
* non-zero span durations onto the unified timeline. */
|
|
1711
|
-
onToolStep?: (step: {
|
|
1712
|
-
toolName: string;
|
|
1713
|
-
args: Record<string, unknown>;
|
|
1714
|
-
status: 'ok' | 'error';
|
|
1715
|
-
startedAt?: number;
|
|
1716
|
-
endedAt?: number;
|
|
1717
|
-
durationMs?: number;
|
|
1718
|
-
}) => void;
|
|
1719
|
-
/** Max inference turns. Default 200 (runaway backstop — set far above any
|
|
1720
|
-
* legitimate workflow). For tighter per-workflow limits use a cost budget
|
|
1721
|
-
* or wall-clock deadline at the call site. */
|
|
1722
|
-
maxTurns?: number;
|
|
1723
|
-
}
|
|
1724
|
-
/**
|
|
1725
|
-
* The leaf `createWorktreeCliExecutor` as a backend-as-data factory: a supervisor-authored
|
|
1726
|
-
* `AgentProfile` driving claude / codex / opencode on its own worktree. `budgetExempt` like
|
|
1727
|
-
* the other CLI leaves; the authored systemPrompt + model reach the harness via §1.5.
|
|
1728
|
-
*/
|
|
1729
|
-
declare const cliWorktreeExecutor: ExecutorFactory<unknown>;
|
|
1730
|
-
/**
|
|
1731
|
-
* Config for {@link createExecutor}: the backend is DATA — the cost dial a profile,
|
|
1732
|
-
* an experiment config, or a replay journal can name — not an import choice. Each
|
|
1733
|
-
* variant carries its backend's seam (router/router-tools/bridge/cli/cli-worktree/sandbox).
|
|
1734
|
-
*/
|
|
1735
|
-
type ExecutorConfig = ({
|
|
1736
|
-
backend: 'router';
|
|
1737
|
-
} & RouterSeam) | ({
|
|
1738
|
-
backend: 'router-tools';
|
|
1739
|
-
} & RouterToolsSeam) | ({
|
|
1740
|
-
backend: 'bridge';
|
|
1741
|
-
} & BridgeSeam) | ({
|
|
1742
|
-
backend: 'cli';
|
|
1743
|
-
} & CliSeam) | ({
|
|
1744
|
-
backend: 'cli-worktree';
|
|
1745
|
-
} & CliWorktreeSeam) | ({
|
|
1746
|
-
backend: 'provider';
|
|
1747
|
-
} & ProviderSeam) | ({
|
|
1748
|
-
backend: 'sandbox';
|
|
1749
|
-
harness?: BackendType;
|
|
1750
|
-
} & SandboxSeam);
|
|
1751
|
-
/**
|
|
1752
|
-
* The single built-in executor factory. Picks a leaf backend by data (`config.backend`),
|
|
1753
|
-
* injects the matching seam, and delegates to that backend's built-in implementation.
|
|
1754
|
-
* The `Executor` port stays OPEN: bring-your-own agents implement `Executor` directly
|
|
1755
|
-
* and never pass through here. Use this (or `createExecutorRegistry`) instead of a
|
|
1756
|
-
* per-vendor adapter or a closed `inline|sandbox|cli` switch — those bypass the
|
|
1757
|
-
* `UsageEvent` reporting channel.
|
|
1758
|
-
*/
|
|
1759
|
-
declare function createExecutor(config: ExecutorConfig): ExecutorFactory<unknown>;
|
|
1760
|
-
/**
|
|
1761
|
-
* The open resolver/registry. Pre-registers the three built-ins under their
|
|
1762
|
-
* runtime tags (`'router'`, `'sandbox'`, `'cli'`) and accepts `register(name,
|
|
1763
|
-
* factory)` for any additional runtime — and a BYO `AgentSpec.executor` resolves
|
|
1764
|
-
* without touching the registry at all. NOT a closed switch; registration + BYO
|
|
1765
|
-
* ARE the extension points.
|
|
1766
|
-
*
|
|
1767
|
-
* `resolve` precedence (frozen in `ExecutorRegistry`): a BYO `spec.executor` →
|
|
1768
|
-
* `harness === null` → the `'router'` factory; else a registered factory for the
|
|
1769
|
-
* harness-derived runtime (`'sandbox'` for any `BackendType`); else fail loud.
|
|
1770
|
-
*/
|
|
1771
|
-
declare function createExecutorRegistry(): ExecutorRegistry;
|
|
1772
|
-
|
|
1773
1951
|
/**
|
|
1774
1952
|
*
|
|
1775
1953
|
* `delegate` MCP tool — the ONE generic delegation verb, the agent-facing front door to
|
|
@@ -2089,6 +2267,16 @@ interface CoordinationToolsOptions {
|
|
|
2089
2267
|
* conserved-budget fence (the pool bounds total work; this bounds simultaneous work, e.g. live
|
|
2090
2268
|
* sandboxes/boxes). Omit or `<= 0` = no cap (the prior behavior; the pool stays the only fence). */
|
|
2091
2269
|
readonly maxLiveWorkers?: number;
|
|
2270
|
+
/** Max wall-clock ms a single `await_event` call may block waiting on a live worker to settle
|
|
2271
|
+
* before it returns a non-error `{ pending: true, live }` snapshot and lets the caller re-poll.
|
|
2272
|
+
* The underlying `scope.next()` blocks for the WHOLE (multi-minute) worker run; over a remote MCP
|
|
2273
|
+
* transport that block outlives the client's per-request timeout, so an unbounded await surfaces
|
|
2274
|
+
* to the supervisor as a hard tool ERROR on every call — the exact failure that leaves it flying
|
|
2275
|
+
* blind. Bounding the wait converts that error into a re-pollable liveness signal. The background
|
|
2276
|
+
* drain keeps running, so a settlement that lands after the bound is published to the bus and
|
|
2277
|
+
* pulled by the next call — nothing is lost. Omit = {@link DEFAULT_AWAIT_EVENT_TIMEOUT_MS}; `<= 0`
|
|
2278
|
+
* restores the prior UNBOUNDED block (only safe for in-process drivers with no transport timeout). */
|
|
2279
|
+
readonly awaitTimeoutMs?: number;
|
|
2092
2280
|
}
|
|
2093
2281
|
/**
|
|
2094
2282
|
* The supervisor-side toolbox returned by {@link createCoordinationTools}: the MCP tool
|
|
@@ -2126,4 +2314,4 @@ interface CoordinationTools {
|
|
|
2126
2314
|
/** Build the driver's MCP tools over a live scope. */
|
|
2127
2315
|
declare function createCoordinationTools(opts: CoordinationToolsOptions): CoordinationTools;
|
|
2128
2316
|
|
|
2129
|
-
export { type
|
|
2317
|
+
export { type DelegationStatus as $, type AnalystRegistry as A, type DelegateResearchArgs as B, type CappedDelegationTrace as C, type DelegationExecutor as D, type ExecutorConfig as E, type FleetHandle as F, type DelegateResearchConfig as G, type DelegateResearchResult as H, type DelegateResult as I, type DelegateRunCtx as J, type DelegateUiAuditConfig as K, type DelegateUiAuditRoute as L, type MakeWorkerAgent as M, type DelegationError as N, type DelegationFeedbackSnapshot as O, type DelegationHistoryEntry as P, DelegationPersistenceError as Q, type DelegationProfile as R, type DelegationProgress as S, type DelegationRecord as T, type UiAuditorDelegate as U, type DelegationResultPayload as V, type DelegationResumeContext as W, type DelegationResumeDriver as X, type DelegationResumeTick as Y, type DelegationRunContext as Z, DelegationStateCorruptError as _, DelegationTaskQueue as a, validateDelegateArgs as a$, type DelegationStore as a0, type DelegationTaskQueueOptions as a1, type DelegationTraceCaps as a2, type DelegationTraceCollector as a3, type DelegationTraceSpan as a4, type DetachedSessionDelegateOptions as a5, type DetachedSessionRefParts as a6, type DetachedTurn as a7, type DetachedTurnResumeDriverOptions as a8, type DetachedWinnerSelection as a9, type SubmitInput as aA, type SubmitOutput as aB, type TraceContext as aC, type UiAuditorDelegationOutput as aD, buildDelegationTraceSpans as aE, capDelegationTrace as aF, coderTaskFromArgs as aG, composeLoopTraceEmitters as aH, createCoordinationTools as aI, createDelegateHandler as aJ, createDelegationTraceCollector as aK, createDetachedTurnResumeDriver as aL, createFleetWorkspaceExecutor as aM, createInProcessTransport as aN, createMcpServer as aO, createPropagatingTraceEmitter as aP, createSiblingSandboxExecutor as aQ, detachedSessionDelegate as aR, detachedTurnEvents as aS, eventToSnapshot as aT, formatDetachedSessionRef as aU, hashIdempotencyInput as aV, parseDetachedSessionRef as aW, readTraceContextFromEnv as aX, runDetachedTurn as aY, settleDetachedCoderTurn as aZ, traceContextToEnv as a_, type DriveTurnCapableBox as aa, type DriveTurnTick as ab, type FeedbackEvent as ac, type FeedbackRating as ad, type FeedbackRefersTo as ae, FileDelegationStore as af, type FileDelegationStoreOptions as ag, type FleetWorkspaceExecutorOptions as ah, InMemoryDelegationStore as ai, InMemoryFeedbackStore as aj, type JsonRpcMessage as ak, type JsonRpcResponse as al, type McpServer as am, type McpServerOptions as an, type McpToolDescriptor as ao, type McpTransport as ap, type Question as aq, type QuestionDecision as ar, type QuestionPolicy as as, type QuestionRecord as at, type ResearchOutputShape as au, type ResearchSource as av, type RunDetachedTurnOptions as aw, type SettleDetachedCoderTurnOptions as ax, type SettledWorker as ay, type SiblingSandboxExecutorOptions as az, type FeedbackStore as b, type EvalRunEvent as b0, type EvalRunGeneration as b1, type EvalRunsExportConfig as b2, type EvalRunsExportResult as b3, INTELLIGENCE_WIRE_VERSION as b4, type LoopSpanNode as b5, type OtelAttribute as b6, type OtelExportConfig as b7, type OtelExporter as b8, type OtelSpan as b9, buildLoopOtelSpans as ba, buildLoopSpanNodes as bb, createOtelExporter as bc, exportEvalRuns as bd, loopEventToOtelSpan as be, type BusEvent as bf, type BusRecord as bg, type BusStats as bh, type EventBus as bi, type ProviderSeam as bj, type PublishOptions as bk, cliWorktreeExecutor as bl, createEventBus as bm, createExecutor as bn, createExecutorRegistry as bo, type DelegateFeedbackResult as c, type DelegateFeedbackArgs as d, type DelegateUiAuditArgs as e, type DelegateUiAuditResult as f, type DelegationHistoryResult as g, type DelegationHistoryArgs as h, type DelegationStatusResult as i, type DelegationStatusArgs as j, type CoderDelegate as k, type CoderReview as l, type CoderReviewer as m, type CoordinationEvent as n, type CoordinationTools as o, type CoordinationToolsOptions as p, DELEGATE_DESCRIPTION as q, DELEGATE_INPUT_SCHEMA as r, DELEGATE_TOOL_NAME as s, DELEGATION_TRACE_MAX_BYTES as t, DELEGATION_TRACE_MAX_SPANS as u, type DelegateArgs as v, type DelegateCodeArgs as w, type DelegateCodeConfig as x, type DelegateCodeResult as y, type DelegateHandlerOptions as z };
|