@tangle-network/agent-runtime 0.82.0 → 0.83.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 +4 -0
- package/dist/agent.d.ts +5 -3
- package/dist/agent.js +7 -7
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop.d.ts +3 -2
- package/dist/analyst-loop.js +2 -2
- package/dist/{chunk-A7LZR5DT.js → chunk-4WXGK6GV.js} +2 -2
- package/dist/chunk-4WXGK6GV.js.map +1 -0
- package/dist/{chunk-UZ5SODU7.js → chunk-5IBQAPVB.js} +1 -1
- package/dist/chunk-5IBQAPVB.js.map +1 -0
- package/dist/{chunk-5JAUQZQA.js → chunk-7LO5GMAO.js} +1 -1
- package/dist/chunk-7LO5GMAO.js.map +1 -0
- package/dist/{chunk-H7IBHAFT.js → chunk-BZF3KQ6G.js} +1 -1
- package/dist/chunk-BZF3KQ6G.js.map +1 -0
- package/dist/{chunk-WIR4HOOJ.js → chunk-DPEUKJRO.js} +1 -1
- package/dist/chunk-DPEUKJRO.js.map +1 -0
- package/dist/{chunk-DJQFJEOD.js → chunk-J3N6GODQ.js} +2 -2
- package/dist/chunk-J3N6GODQ.js.map +1 -0
- package/dist/{chunk-GRAGM4MC.js → chunk-NURIQBJQ.js} +1 -1
- package/dist/chunk-NURIQBJQ.js.map +1 -0
- package/dist/{chunk-JYURIKPF.js → chunk-QDVLTRCP.js} +4 -4
- package/dist/chunk-QDVLTRCP.js.map +1 -0
- package/dist/{chunk-FNMGYYSS.js → chunk-SGKPNBXE.js} +1 -1
- package/dist/chunk-SGKPNBXE.js.map +1 -0
- package/dist/{chunk-CO2KBPRE.js → chunk-SSA6OERV.js} +6 -6
- package/dist/chunk-SSA6OERV.js.map +1 -0
- package/dist/{chunk-SRGV56W4.js → chunk-UD4BHQMI.js} +2 -2
- package/dist/{chunk-SRGV56W4.js.map → chunk-UD4BHQMI.js.map} +1 -1
- package/dist/{chunk-KSGHI53L.js → chunk-UJ3ONGHR.js} +6 -6
- package/dist/chunk-UJ3ONGHR.js.map +1 -0
- package/dist/{chunk-LWGVVP2C.js → chunk-VNOOH22O.js} +2 -2
- package/dist/chunk-VNOOH22O.js.map +1 -0
- package/dist/{chunk-NBV35BR6.js → chunk-YEJR7IXO.js} +1 -1
- package/dist/chunk-YEJR7IXO.js.map +1 -0
- package/dist/{chunk-C2FZ6GR6.js → chunk-YPA5MLVE.js} +2 -2
- package/dist/chunk-YPA5MLVE.js.map +1 -0
- package/dist/{coordination-BI9tpcmF.d.ts → coordination-CuDLO8wj.d.ts} +53 -32
- package/dist/environment-provider.d.ts +2 -2
- package/dist/environment-provider.js +1 -1
- package/dist/{improvement-adapter-CioiEE2z.d.ts → improvement-adapter-CDR8QNVM.d.ts} +3 -0
- package/dist/index.d.ts +163 -49
- package/dist/index.js +43 -13
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +14 -8
- package/dist/intelligence.js +1 -1
- package/dist/intelligence.js.map +1 -1
- package/dist/{kb-gate-CuzMYGYM.d.ts → kb-gate-CwHO0vz6.d.ts} +4 -2
- package/dist/lifecycle.d.ts +2 -2
- package/dist/lifecycle.js +3 -3
- package/dist/{local-harness-DU7yV6mG.d.ts → local-harness-sI0S_XNA.d.ts} +2 -1
- package/dist/{loop-runner-bin-CBkLsyFg.d.ts → loop-runner-bin-hQDUL8Ld.d.ts} +28 -13
- package/dist/loop-runner-bin.d.ts +7 -7
- package/dist/loop-runner-bin.js +10 -10
- package/dist/loops.d.ts +102 -45
- package/dist/loops.js +7 -7
- package/dist/mcp/bin.js +8 -8
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +44 -38
- package/dist/mcp/index.js +11 -11
- package/dist/mcp/index.js.map +1 -1
- package/dist/{mcp-serve-verifier-BvMAV_8U.d.ts → mcp-serve-verifier-FL7-ZEb_.d.ts} +8 -3
- package/dist/{openai-tools-B-3v06BE.d.ts → openai-tools-BnrOmGjN.d.ts} +7 -4
- package/dist/platform.d.ts +4 -0
- package/dist/platform.js.map +1 -1
- package/dist/profiles.d.ts +36 -23
- package/dist/profiles.js +2 -2
- package/dist/profiles.js.map +1 -1
- package/dist/{router-client-D6Ocf4jG.d.ts → router-client-r8y_VFVM.d.ts} +1 -0
- package/dist/{substrate-rNj6TDc3.d.ts → substrate-DO2GHNg2.d.ts} +5 -3
- package/dist/{types-By9LXllv.d.ts → types-Driepl87.d.ts} +3 -2
- package/dist/{types-BF-MEsQB.d.ts → types-ESeMOj94.d.ts} +26 -11
- package/dist/{worktree-fanout-D9Z2dMS9.d.ts → worktree-fanout-D6xR2CIA.d.ts} +16 -10
- package/dist/{worktree-harness-Dx8XULW3.d.ts → worktree-harness-CX_McRLp.d.ts} +11 -8
- package/package.json +1 -1
- package/dist/chunk-5JAUQZQA.js.map +0 -1
- package/dist/chunk-A7LZR5DT.js.map +0 -1
- package/dist/chunk-C2FZ6GR6.js.map +0 -1
- package/dist/chunk-CO2KBPRE.js.map +0 -1
- package/dist/chunk-DJQFJEOD.js.map +0 -1
- package/dist/chunk-FNMGYYSS.js.map +0 -1
- package/dist/chunk-GRAGM4MC.js.map +0 -1
- package/dist/chunk-H7IBHAFT.js.map +0 -1
- package/dist/chunk-JYURIKPF.js.map +0 -1
- package/dist/chunk-KSGHI53L.js.map +0 -1
- package/dist/chunk-LWGVVP2C.js.map +0 -1
- package/dist/chunk-NBV35BR6.js.map +0 -1
- package/dist/chunk-UZ5SODU7.js.map +0 -1
- package/dist/chunk-WIR4HOOJ.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import { AgentProfile, AgentEvalError, AnalystFinding, KnowledgeReadinessReport, RunRecord, ControlEvalResult, KnowledgeRequirement } from '@tangle-network/agent-eval';
|
|
2
2
|
export { AgentEvalError, AgentEvalErrorCode, ConfigError, ControlBudget, ControlDecision, ControlEvalResult, ControlRunResult, ControlStep, DataAcquisitionPlan, JudgeError, KnowledgeReadinessReport, KnowledgeRequirement, NotFoundError, RunRecord, ValidationError } from '@tangle-network/agent-eval';
|
|
3
|
-
import { f as AgentBackendInput,
|
|
4
|
-
export { r as AgentAdapter, s as AgentKnowledgeProvider, t as AgentRuntimeEventSink, u as AgentTaskContext, v as AgentTaskSpec, B as BackendErrorDetail, w as RuntimeDecisionEvidenceRef, x as RuntimeDecisionKind, y as RuntimeDecisionPoint, z as RuntimeHookContext, C as RuntimeHookErrorContext, D as RuntimeHookEvent, F as RuntimeHookPhase, G as RuntimeHookTarget, H as RuntimeRunHandle, J as RuntimeRunPersistenceAdapter, M as RuntimeRunRow, N as composeRuntimeHooks, P as defineRuntimeHooks, Q as notifyRuntimeDecisionPoint, T as notifyRuntimeHookEvent, U as startRuntimeRun } from './types-
|
|
3
|
+
import { f as AgentBackendInput, O as OpenAIChatTool, g as OpenAIChatToolChoice, h as OpenAIChatResponseFormat, i as AgentExecutionBackend, j as AgentBackendContext, a as RuntimeStreamEvent, K as KnowledgeReadinessDecision, k as RunAgentTaskOptions, l as AgentTaskRunResult, m as RunAgentTaskStreamOptions, n as AgentRuntimeEvent, o as AgentTaskStatus, p as RuntimeSessionStore, q as RuntimeSession, R as RuntimeHooks } from './types-ESeMOj94.js';
|
|
4
|
+
export { r as AgentAdapter, s as AgentKnowledgeProvider, t as AgentRuntimeEventSink, u as AgentTaskContext, v as AgentTaskSpec, B as BackendErrorDetail, w as RuntimeDecisionEvidenceRef, x as RuntimeDecisionKind, y as RuntimeDecisionPoint, z as RuntimeHookContext, C as RuntimeHookErrorContext, D as RuntimeHookEvent, F as RuntimeHookPhase, G as RuntimeHookTarget, H as RuntimeRunHandle, J as RuntimeRunPersistenceAdapter, M as RuntimeRunRow, N as composeRuntimeHooks, P as defineRuntimeHooks, Q as notifyRuntimeDecisionPoint, T as notifyRuntimeHookEvent, U as startRuntimeRun } from './types-ESeMOj94.js';
|
|
5
5
|
import { Scenario, ProfileDispatchFn } from '@tangle-network/agent-eval/campaign';
|
|
6
|
-
import { C as CandidateGenerator } from './mcp-serve-verifier-
|
|
7
|
-
export { A as AgenticGeneratorOptions, I as ImprovementDriverOptions, M as McpServeSpec, V as Verifier, a as VerifyResult, b as agenticGenerator, c as commandVerifier, i as improvementDriver, m as mcpServeVerifier } from './mcp-serve-verifier-
|
|
6
|
+
import { C as CandidateGenerator } from './mcp-serve-verifier-FL7-ZEb_.js';
|
|
7
|
+
export { A as AgenticGeneratorOptions, I as ImprovementDriverOptions, M as McpServeSpec, V as Verifier, a as VerifyResult, b as agenticGenerator, c as commandVerifier, i as improvementDriver, m as mcpServeVerifier } from './mcp-serve-verifier-FL7-ZEb_.js';
|
|
8
8
|
import { Scenario as Scenario$1, SurfaceProposer, JudgeConfig, MutableSurface, DispatchContext, SelfImproveBudget, SelfImproveLlm, SelfImproveResult } from '@tangle-network/agent-eval/contract';
|
|
9
9
|
import { AgentProfile as AgentProfile$1 } from '@tangle-network/agent-interface';
|
|
10
|
-
import { S as SurfaceImprovementEdit } from './improvement-adapter-
|
|
10
|
+
import { S as SurfaceImprovementEdit } from './improvement-adapter-CDR8QNVM.js';
|
|
11
11
|
import { I as ImprovementAdapter } from './types-BC3bZpH0.js';
|
|
12
|
-
export { D as DELEGATED_LOOP_MODES, a as DelegatedLoopMode, b as DelegatedLoopRegistry, c as DelegatedLoopResult, d as DelegatedLoopRunner, L as LoopRunnerCliArgs, e as LoopRunnerCliResult, R as ResearchLoopResult, f as ResearchLoopRunnerOptions, g as RunDelegatedLoopOptions, V as VetoedFact, W as WorktreeLoopRunnerOptions, h as auditLoopRunner, i as isDelegatedLoopMode, p as parseLoopRunnerArgv, r as researchLoopRunner, j as runDelegatedLoop, k as runLoopRunnerCli, s as selfImproveLoopRunner, w as worktreeLoopRunner } from './loop-runner-bin-
|
|
13
|
-
export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from './openai-tools-
|
|
12
|
+
export { D as DELEGATED_LOOP_MODES, a as DelegatedLoopMode, b as DelegatedLoopRegistry, c as DelegatedLoopResult, d as DelegatedLoopRunner, L as LoopRunnerCliArgs, e as LoopRunnerCliResult, R as ResearchLoopResult, f as ResearchLoopRunnerOptions, g as RunDelegatedLoopOptions, V as VetoedFact, W as WorktreeLoopRunnerOptions, h as auditLoopRunner, i as isDelegatedLoopMode, p as parseLoopRunnerArgv, r as researchLoopRunner, j as runDelegatedLoop, k as runLoopRunnerCli, s as selfImproveLoopRunner, w as worktreeLoopRunner } from './loop-runner-bin-hQDUL8Ld.js';
|
|
13
|
+
export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from './openai-tools-BnrOmGjN.js';
|
|
14
14
|
export { E as EvalRunEvent, a as EvalRunGeneration, b as EvalRunsExportConfig, c as EvalRunsExportResult, I as INTELLIGENCE_WIRE_VERSION, L as LoopSpanNode, d as OtelAttribute, e as OtelExportConfig, O as OtelExporter, f as OtelSpan, g as buildLoopOtelSpans, h as buildLoopSpanNodes, i as createOtelExporter, j as exportEvalRuns, l as loopEventToOtelSpan } from './otel-export-BKmNwiCb.js';
|
|
15
15
|
import '@tangle-network/sandbox';
|
|
16
|
-
import './local-harness-
|
|
16
|
+
import './local-harness-sI0S_XNA.js';
|
|
17
17
|
import 'node:child_process';
|
|
18
|
-
import './kb-gate-
|
|
19
|
-
import './types-
|
|
20
|
-
import './worktree-fanout-
|
|
21
|
-
import './worktree-harness-
|
|
18
|
+
import './kb-gate-CwHO0vz6.js';
|
|
19
|
+
import './types-Driepl87.js';
|
|
20
|
+
import './worktree-fanout-D6xR2CIA.js';
|
|
21
|
+
import './worktree-harness-CX_McRLp.js';
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* @stable
|
|
25
24
|
*
|
|
26
25
|
* Backend factories for `runAgentTaskStream`. Three shapes ship in core:
|
|
27
26
|
*
|
|
@@ -32,9 +31,11 @@ import './worktree-harness-Dx8XULW3.js';
|
|
|
32
31
|
* Adapters stay thin: domain repos own auth, model selection, and the concrete
|
|
33
32
|
* tool surface. The factories handle session creation, stream normalization,
|
|
34
33
|
* and graceful end-of-stream signalling.
|
|
34
|
+
*
|
|
35
|
+
* @stable
|
|
35
36
|
*/
|
|
36
37
|
|
|
37
|
-
/** @stable */
|
|
38
|
+
/** Wrap any custom async-iterable stream into a typed `AgentExecutionBackend`. @stable */
|
|
38
39
|
declare function createIterableBackend<TInput extends AgentBackendInput>(options: {
|
|
39
40
|
kind: string;
|
|
40
41
|
start?: AgentExecutionBackend<TInput>['start'];
|
|
@@ -42,7 +43,7 @@ declare function createIterableBackend<TInput extends AgentBackendInput>(options
|
|
|
42
43
|
stream: AgentExecutionBackend<TInput>['stream'];
|
|
43
44
|
stop?: AgentExecutionBackend<TInput>['stop'];
|
|
44
45
|
}): AgentExecutionBackend<TInput>;
|
|
45
|
-
/** @stable */
|
|
46
|
+
/** Build an `AgentExecutionBackend` backed by a sandbox/sidecar `streamPrompt` call. @stable */
|
|
46
47
|
declare function createSandboxPromptBackend<TBox, TInput extends AgentBackendInput = AgentBackendInput>(options: {
|
|
47
48
|
kind?: string;
|
|
48
49
|
getBox(input: TInput, context: Omit<AgentBackendContext, 'session'>): Promise<TBox> | TBox;
|
|
@@ -85,7 +86,6 @@ interface BackendRetryPolicy {
|
|
|
85
86
|
requestTimeoutMs?: number;
|
|
86
87
|
}
|
|
87
88
|
/**
|
|
88
|
-
* @stable
|
|
89
89
|
*
|
|
90
90
|
* OpenAI-compat streaming backend. Routes `runAgentTaskStream` through any
|
|
91
91
|
* `POST /chat/completions` endpoint that speaks OpenAI's SSE protocol —
|
|
@@ -117,6 +117,8 @@ interface BackendRetryPolicy {
|
|
|
117
117
|
* `final.error` onto their `RunRecord.error` — silently treating an empty
|
|
118
118
|
* `finalText` as "agent produced nothing" hides credit exhaustion, auth
|
|
119
119
|
* failure, and upstream outages.
|
|
120
|
+
*
|
|
121
|
+
* @stable
|
|
120
122
|
*/
|
|
121
123
|
declare function createOpenAICompatibleBackend<TInput extends AgentBackendInput = AgentBackendInput>(options: {
|
|
122
124
|
apiKey: string;
|
|
@@ -146,7 +148,6 @@ declare function createOpenAICompatibleBackend<TInput extends AgentBackendInput
|
|
|
146
148
|
}): AgentExecutionBackend<TInput>;
|
|
147
149
|
|
|
148
150
|
/**
|
|
149
|
-
* @stable
|
|
150
151
|
*
|
|
151
152
|
* Per-call resilience policy for participant backends: deadline, retry with
|
|
152
153
|
* backoff, and a circuit breaker. Each policy is applied *around* a single
|
|
@@ -158,6 +159,8 @@ declare function createOpenAICompatibleBackend<TInput extends AgentBackendInput
|
|
|
158
159
|
* leaking sockets. Retries replay the same logical turn (same `turnId`) so
|
|
159
160
|
* any caching gateway can dedupe. Circuit breakers are *per participant*: A's
|
|
160
161
|
* failures don't open B's breaker.
|
|
162
|
+
*
|
|
163
|
+
* @stable
|
|
161
164
|
*/
|
|
162
165
|
/** Pure judgment of whether an error is worth retrying. Defaults: TimeoutError, AbortError, fetch-level network errors. */
|
|
163
166
|
type RetryableErrorPredicate = (err: unknown) => boolean;
|
|
@@ -180,9 +183,11 @@ interface BackendCallPolicy {
|
|
|
180
183
|
/** Circuit breaker that opens after N consecutive failures per participant. */
|
|
181
184
|
circuitBreaker?: CircuitBreakerConfig;
|
|
182
185
|
}
|
|
186
|
+
/** Thrown when the circuit breaker is open for a participant and no retry is allowed yet. */
|
|
183
187
|
declare class CircuitOpenError extends Error {
|
|
184
188
|
constructor(participant: string, retryAfterMs: number);
|
|
185
189
|
}
|
|
190
|
+
/** Thrown when a backend call exceeds its per-attempt deadline. */
|
|
186
191
|
declare class DeadlineExceededError extends Error {
|
|
187
192
|
constructor(deadlineMs: number);
|
|
188
193
|
}
|
|
@@ -222,10 +227,10 @@ declare function makePerAttemptSignal(parentSignal: AbortSignal | undefined, dea
|
|
|
222
227
|
};
|
|
223
228
|
/** Compute the delay before the next attempt. Default: 250ms exponential with jitter. */
|
|
224
229
|
declare function computeBackoff(spec: RetryBackoff | undefined, attempt: number): number;
|
|
230
|
+
/** Resolve after `ms` milliseconds — used for retry backoff in conversation call policy. */
|
|
225
231
|
declare function sleep(ms: number): Promise<void>;
|
|
226
232
|
|
|
227
233
|
/**
|
|
228
|
-
* @stable
|
|
229
234
|
*
|
|
230
235
|
* Cross-gateway forwarding headers — the wire-level contract that makes
|
|
231
236
|
* agent-to-agent communication composable across organizational boundaries.
|
|
@@ -239,6 +244,8 @@ declare function sleep(ms: number): Promise<void>;
|
|
|
239
244
|
* rules so both sides agree.
|
|
240
245
|
*
|
|
241
246
|
* Full protocol: `docs/agent-bus-protocol.md`.
|
|
247
|
+
*
|
|
248
|
+
* @stable
|
|
242
249
|
*/
|
|
243
250
|
/** Standard names — lowercased so Headers maps interop on every runtime. */
|
|
244
251
|
declare const FORWARD_HEADERS: {
|
|
@@ -293,7 +300,6 @@ declare function buildForwardHeaders(input: {
|
|
|
293
300
|
type PropagatedHeaders = Readonly<Record<string, string>>;
|
|
294
301
|
|
|
295
302
|
/**
|
|
296
|
-
* @stable
|
|
297
303
|
*
|
|
298
304
|
* Durable conversation transcript — survives a driver process crash mid-run.
|
|
299
305
|
* The runner journals every committed turn before yielding `turn_end`, so a
|
|
@@ -306,6 +312,8 @@ type PropagatedHeaders = Readonly<Record<string, string>>;
|
|
|
306
312
|
* is ~30 lines. The in-memory adapter is the default for tests and scratch.
|
|
307
313
|
* The file adapter (JSONL on disk) is the default-durable choice when no
|
|
308
314
|
* upstream store is wired.
|
|
315
|
+
*
|
|
316
|
+
* @stable
|
|
309
317
|
*/
|
|
310
318
|
|
|
311
319
|
interface ConversationJournalEntry {
|
|
@@ -342,6 +350,7 @@ interface ConversationJournal {
|
|
|
342
350
|
*/
|
|
343
351
|
recordHalt(runId: string, halt: HaltReason, endedAt: string): Promise<void>;
|
|
344
352
|
}
|
|
353
|
+
/** In-memory `ConversationJournal` — suitable for testing and single-process runs. */
|
|
345
354
|
declare class InMemoryConversationJournal implements ConversationJournal {
|
|
346
355
|
private readonly entries;
|
|
347
356
|
loadRun(runId: string): Promise<ConversationJournalEntry | undefined>;
|
|
@@ -370,7 +379,6 @@ declare class FileConversationJournal implements ConversationJournal {
|
|
|
370
379
|
}
|
|
371
380
|
|
|
372
381
|
/**
|
|
373
|
-
* @stable
|
|
374
382
|
*
|
|
375
383
|
* Public types for multi-agent conversations. A `Conversation` is two-or-more
|
|
376
384
|
* participants taking turns through their own `AgentExecutionBackend`s, driven
|
|
@@ -380,6 +388,8 @@ declare class FileConversationJournal implements ConversationJournal {
|
|
|
380
388
|
* in-process iterable, local cli-bridge, sandbox, router, or a remote
|
|
381
389
|
* agent-gateway — so the same `runConversation` call drives same-machine,
|
|
382
390
|
* same-cloud, and cross-cloud orchestration without code change.
|
|
391
|
+
*
|
|
392
|
+
* @stable
|
|
383
393
|
*/
|
|
384
394
|
|
|
385
395
|
/** @stable */
|
|
@@ -642,7 +652,6 @@ type ConversationStreamEvent = {
|
|
|
642
652
|
};
|
|
643
653
|
|
|
644
654
|
/**
|
|
645
|
-
* @stable
|
|
646
655
|
*
|
|
647
656
|
* Wrap a `Conversation` so it satisfies `AgentExecutionBackend`. The result is
|
|
648
657
|
* an addressable "single agent" whose internal behavior is an N-party
|
|
@@ -654,6 +663,8 @@ type ConversationStreamEvent = {
|
|
|
654
663
|
* callers see one `text_delta` per inner turn (the turn's full text), tagged
|
|
655
664
|
* with `[speaker] ` prefix so the outer transcript stays attributable. The
|
|
656
665
|
* conversation's `conversation_end` halt reason rides on a `final` event.
|
|
666
|
+
*
|
|
667
|
+
* @stable
|
|
657
668
|
*/
|
|
658
669
|
|
|
659
670
|
declare function createConversationBackend(options: {
|
|
@@ -663,12 +674,13 @@ declare function createConversationBackend(options: {
|
|
|
663
674
|
}): AgentExecutionBackend;
|
|
664
675
|
|
|
665
676
|
/**
|
|
666
|
-
* @stable
|
|
667
677
|
*
|
|
668
678
|
* Declarative constructor for a multi-agent `Conversation`. Validates inputs
|
|
669
679
|
* fail-loud at definition time (duplicate participant names, alternate order
|
|
670
680
|
* with ≠2 participants, non-positive `maxTurns`) so misconfiguration is caught
|
|
671
681
|
* before `runConversation` is called and not buried inside a streaming run.
|
|
682
|
+
*
|
|
683
|
+
* @stable
|
|
672
684
|
*/
|
|
673
685
|
|
|
674
686
|
declare function defineConversation(input: {
|
|
@@ -677,7 +689,6 @@ declare function defineConversation(input: {
|
|
|
677
689
|
}): Conversation;
|
|
678
690
|
|
|
679
691
|
/**
|
|
680
|
-
* @stable
|
|
681
692
|
*
|
|
682
693
|
* Durable conversation journal backed by any SQL store. Adapter-agnostic by
|
|
683
694
|
* design: callers wire a `SqlAdapter` against their driver of choice (D1,
|
|
@@ -711,6 +722,8 @@ declare function defineConversation(input: {
|
|
|
711
722
|
* }
|
|
712
723
|
* const journal = new SqlConversationJournal(pg)
|
|
713
724
|
* await journal.migrate()
|
|
725
|
+
*
|
|
726
|
+
* @stable
|
|
714
727
|
*/
|
|
715
728
|
|
|
716
729
|
/**
|
|
@@ -777,7 +790,6 @@ declare class SqlConversationJournal implements ConversationJournal {
|
|
|
777
790
|
}
|
|
778
791
|
|
|
779
792
|
/**
|
|
780
|
-
* @stable
|
|
781
793
|
*
|
|
782
794
|
* Conversation orchestrator. Drives N participants in turn through their own
|
|
783
795
|
* `AgentExecutionBackend`s, aggregating per-turn text + usage, enforcing
|
|
@@ -805,9 +817,12 @@ declare class SqlConversationJournal implements ConversationJournal {
|
|
|
805
817
|
* Credit cap is enforced *between turns*, not mid-stream: a turn that
|
|
806
818
|
* overshoots the cap completes, the cap then halts the conversation before
|
|
807
819
|
* the next turn.
|
|
820
|
+
*
|
|
821
|
+
* @stable
|
|
808
822
|
*/
|
|
809
823
|
|
|
810
824
|
declare function runConversation(conversation: Conversation, options: RunConversationOptions): Promise<ConversationResult>;
|
|
825
|
+
/** Streaming conversation orchestrator: drives N participants in turn through their own backends, enforcing `maxTurns` / `maxCreditsCents` / `haltOn`, yielding per-event stream markers. */
|
|
811
826
|
declare function runConversationStream(conversation: Conversation, options: RunConversationOptions): AsyncIterable<ConversationStreamEvent>;
|
|
812
827
|
|
|
813
828
|
/**
|
|
@@ -896,7 +911,6 @@ interface RunPersonaConfig<TScenario extends Scenario, TArtifact> {
|
|
|
896
911
|
declare function runPersonaDispatch<TScenario extends Scenario, TArtifact>(config: RunPersonaConfig<TScenario, TArtifact>): ProfileDispatchFn<TScenario, TArtifact>;
|
|
897
912
|
|
|
898
913
|
/**
|
|
899
|
-
* @stable
|
|
900
914
|
*
|
|
901
915
|
* Deterministic turn identifier. Stable across retries of the same logical
|
|
902
916
|
* turn so backends (and any caching gateway in between) can dedupe on it.
|
|
@@ -906,6 +920,8 @@ declare function runPersonaDispatch<TScenario extends Scenario, TArtifact>(confi
|
|
|
906
920
|
* Shape: `${runId}.t${index}.${speakerSlug}` — readable in logs, sortable by
|
|
907
921
|
* turn index, attributable to a speaker. Slugify keeps the speaker portion
|
|
908
922
|
* URL-safe so it can ride in HTTP headers without escaping.
|
|
923
|
+
*
|
|
924
|
+
* @stable
|
|
909
925
|
*/
|
|
910
926
|
declare function turnId(runId: string, index: number, speaker: string): string;
|
|
911
927
|
/**
|
|
@@ -1038,7 +1054,6 @@ declare function deriveExecutionId(input: {
|
|
|
1038
1054
|
}): string;
|
|
1039
1055
|
|
|
1040
1056
|
/**
|
|
1041
|
-
* @stable
|
|
1042
1057
|
*
|
|
1043
1058
|
* Error taxonomy for `@tangle-network/agent-runtime`.
|
|
1044
1059
|
*
|
|
@@ -1057,15 +1072,18 @@ declare function deriveExecutionId(input: {
|
|
|
1057
1072
|
* backend, backend transport errors) get fresh subclasses that still carry an
|
|
1058
1073
|
* `AgentEvalErrorCode` so cross-package handlers can pattern-match without
|
|
1059
1074
|
* importing the runtime.
|
|
1075
|
+
*
|
|
1076
|
+
* @stable
|
|
1060
1077
|
*/
|
|
1061
1078
|
|
|
1062
1079
|
/**
|
|
1063
|
-
* @stable
|
|
1064
1080
|
*
|
|
1065
1081
|
* A backend transport call (HTTP, gRPC, sidecar IPC) failed with a non-success
|
|
1066
1082
|
* status. Distinct from `JudgeError` (which is structural / unrecoverable)
|
|
1067
1083
|
* because backend failures are sometimes retryable and consumers may want to
|
|
1068
1084
|
* branch on the upstream status code.
|
|
1085
|
+
*
|
|
1086
|
+
* @stable
|
|
1069
1087
|
*/
|
|
1070
1088
|
declare class BackendTransportError extends AgentEvalError {
|
|
1071
1089
|
readonly backend: string;
|
|
@@ -1084,10 +1102,11 @@ declare class BackendTransportError extends AgentEvalError {
|
|
|
1084
1102
|
});
|
|
1085
1103
|
}
|
|
1086
1104
|
/**
|
|
1087
|
-
* @stable
|
|
1088
1105
|
*
|
|
1089
1106
|
* A runtime-run lifecycle method was called in an order the state machine does
|
|
1090
1107
|
* not allow: `persist()` before `complete()`, `complete()` twice, etc.
|
|
1108
|
+
*
|
|
1109
|
+
* @stable
|
|
1091
1110
|
*/
|
|
1092
1111
|
declare class RuntimeRunStateError extends AgentEvalError {
|
|
1093
1112
|
constructor(message: string, options?: {
|
|
@@ -1095,7 +1114,6 @@ declare class RuntimeRunStateError extends AgentEvalError {
|
|
|
1095
1114
|
});
|
|
1096
1115
|
}
|
|
1097
1116
|
/**
|
|
1098
|
-
* @stable
|
|
1099
1117
|
*
|
|
1100
1118
|
* The dynamic-loop planner returned an unusable topology move — the LLM emitted
|
|
1101
1119
|
* no parseable envelope, an unknown `kind`, or a structurally-invalid move
|
|
@@ -1104,6 +1122,8 @@ declare class RuntimeRunStateError extends AgentEvalError {
|
|
|
1104
1122
|
* cannot drive the kernel. Carries `validation` so cross-package handlers can
|
|
1105
1123
|
* pattern-match without importing the runtime. Fail loud — never substitute a
|
|
1106
1124
|
* default move, or the loop silently runs a topology nobody chose.
|
|
1125
|
+
*
|
|
1126
|
+
* @stable
|
|
1107
1127
|
*/
|
|
1108
1128
|
declare class PlannerError extends AgentEvalError {
|
|
1109
1129
|
constructor(message: string, options?: {
|
|
@@ -1132,11 +1152,12 @@ type FindingsArg = {
|
|
|
1132
1152
|
report: unknown;
|
|
1133
1153
|
findings: AnalystFinding[];
|
|
1134
1154
|
};
|
|
1155
|
+
/** Build the starting instruction for a coder agent tasked with implementing a new tool. */
|
|
1135
1156
|
declare function toolBuildPrompt(args: FindingsArg): string;
|
|
1157
|
+
/** Build the starting instruction for a coder agent tasked with implementing a new MCP server. */
|
|
1136
1158
|
declare function mcpBuildPrompt(args: FindingsArg): string;
|
|
1137
1159
|
|
|
1138
1160
|
/**
|
|
1139
|
-
* @experimental
|
|
1140
1161
|
*
|
|
1141
1162
|
* `improve` — the ONE public, surface-pluggable RSI verb.
|
|
1142
1163
|
*
|
|
@@ -1159,6 +1180,8 @@ declare function mcpBuildPrompt(args: FindingsArg): string;
|
|
|
1159
1180
|
*
|
|
1160
1181
|
* Everything else (`scenarios`, `judge`, `agent`, `budget`, `llm`) passes
|
|
1161
1182
|
* straight through to `selfImprove`.
|
|
1183
|
+
*
|
|
1184
|
+
* @experimental
|
|
1162
1185
|
*/
|
|
1163
1186
|
|
|
1164
1187
|
/** The agent-profile lever `improve` optimizes. Mirrors the AgentProfile-law
|
|
@@ -1221,7 +1244,6 @@ interface ImproveResult<TScenario extends Scenario$1, TArtifact> {
|
|
|
1221
1244
|
declare function improve<TScenario extends Scenario$1, TArtifact>(profile: AgentProfile$1, findings: unknown[], opts: ImproveOptions<TScenario, TArtifact>): Promise<ImproveResult<TScenario, TArtifact>>;
|
|
1222
1245
|
|
|
1223
1246
|
/**
|
|
1224
|
-
* @experimental
|
|
1225
1247
|
*
|
|
1226
1248
|
* `reflectiveGenerator` — the cheap, no-sandbox `CandidateGenerator`. It drafts
|
|
1227
1249
|
* surface edits via the existing improvement adapter (`proposeFromFindings`,
|
|
@@ -1232,15 +1254,17 @@ declare function improve<TScenario extends Scenario$1, TArtifact>(profile: Agent
|
|
|
1232
1254
|
* This is the `shots=1, sandbox=off` setting of the one improvement driver.
|
|
1233
1255
|
* The `agenticGenerator` (a multi-shot verify-in-session loop) is the
|
|
1234
1256
|
* `shots=N` setting — both plug into the same `improvementDriver`.
|
|
1257
|
+
*
|
|
1258
|
+
* @experimental
|
|
1235
1259
|
*/
|
|
1236
1260
|
|
|
1237
1261
|
interface ReflectiveGeneratorOptions {
|
|
1238
1262
|
improvementAdapter: ImprovementAdapter<SurfaceImprovementEdit>;
|
|
1239
1263
|
}
|
|
1264
|
+
/** Cheap no-sandbox `CandidateGenerator` (the `shots=1` setting): draft surface edits via the improvement adapter and apply them as one coherent candidate. */
|
|
1240
1265
|
declare function reflectiveGenerator(opts: ReflectiveGeneratorOptions): CandidateGenerator;
|
|
1241
1266
|
|
|
1242
1267
|
/**
|
|
1243
|
-
* @stable
|
|
1244
1268
|
*
|
|
1245
1269
|
* Chat-model resolution + catalog validation — the shared primitive every
|
|
1246
1270
|
* product chat handler needs and was, until now, hand-rolling. Lifts the
|
|
@@ -1253,6 +1277,8 @@ declare function reflectiveGenerator(opts: ReflectiveGeneratorOptions): Candidat
|
|
|
1253
1277
|
* sharing the catalog fetch, the malformed-id guard, and the fail-closed
|
|
1254
1278
|
* admission rule. No React, no `process.env` assumption — `env` is an
|
|
1255
1279
|
* explicit narrow record so this runs unchanged in Node and in Workers.
|
|
1280
|
+
*
|
|
1281
|
+
* @stable
|
|
1256
1282
|
*/
|
|
1257
1283
|
/**
|
|
1258
1284
|
* A model entry as returned by the Tangle Router `/v1/models` endpoint.
|
|
@@ -1276,6 +1302,7 @@ interface RouterEnv {
|
|
|
1276
1302
|
TANGLE_ROUTER_URL?: string;
|
|
1277
1303
|
TANGLE_ROUTER_BASE_URL?: string;
|
|
1278
1304
|
}
|
|
1305
|
+
/** Default Tangle Router base URL used when no env override is set. */
|
|
1279
1306
|
declare const DEFAULT_ROUTER_BASE_URL = "https://router.tangle.tools";
|
|
1280
1307
|
/** Resolve the router base URL from env, normalised — no trailing `/v1` or `/`. */
|
|
1281
1308
|
declare function resolveRouterBaseUrl(env?: RouterEnv): string;
|
|
@@ -1327,7 +1354,6 @@ declare function validateChatModelId(modelId: unknown, options?: {
|
|
|
1327
1354
|
}): Promise<ChatModelValidation>;
|
|
1328
1355
|
|
|
1329
1356
|
/**
|
|
1330
|
-
* @stable
|
|
1331
1357
|
*
|
|
1332
1358
|
* Pure readiness-decision helper. Maps a `KnowledgeReadinessReport` from
|
|
1333
1359
|
* `@tangle-network/agent-eval` to a three-state branch (`ready` / `blocked` /
|
|
@@ -1337,15 +1363,89 @@ declare function validateChatModelId(modelId: unknown, options?: {
|
|
|
1337
1363
|
* agent-eval; callers tightening or loosening this should keep it consistent
|
|
1338
1364
|
* across all entry points for the same product so the UI / metrics agree on
|
|
1339
1365
|
* what "caveat" means.
|
|
1366
|
+
*
|
|
1367
|
+
* @stable
|
|
1340
1368
|
*/
|
|
1341
1369
|
|
|
1342
|
-
/**
|
|
1370
|
+
/**
|
|
1371
|
+
* Map a `KnowledgeReadinessReport` to a three-state branch (`ready` / `blocked` / `caveat`) the runtime, route handlers, and UI shells all switch on.
|
|
1372
|
+
*
|
|
1373
|
+
* @stable
|
|
1374
|
+
*/
|
|
1343
1375
|
declare function decideKnowledgeReadiness(report: KnowledgeReadinessReport, options?: {
|
|
1344
1376
|
minimumScore?: number;
|
|
1345
1377
|
}): KnowledgeReadinessDecision;
|
|
1346
1378
|
|
|
1347
1379
|
/**
|
|
1348
|
-
*
|
|
1380
|
+
* The product-facing backend selector for `runChatThroughRuntime` /
|
|
1381
|
+
* `runAgentTaskStream`: one call turns a `--backend {router,tcloud,cli-bridge,
|
|
1382
|
+
* sandbox}` choice into the `AgentExecutionBackend` the chat leg runs on.
|
|
1383
|
+
*
|
|
1384
|
+
* It is the `AgentExecutionBackend` sibling of `resolveSandboxClient` (which
|
|
1385
|
+
* resolves the `SandboxClient` a `runLoop` drives). Both exist for the same
|
|
1386
|
+
* reason: every in-process eval product hand-rolled the identical
|
|
1387
|
+
* "`backend-name` → `createOpenAICompatibleBackend`" branch, and the copies
|
|
1388
|
+
* drift. This is the single generic resolver they share.
|
|
1389
|
+
*
|
|
1390
|
+
* - `router` / `tcloud` / `cli-bridge` → OpenAI-compatible chat completions.
|
|
1391
|
+
* All three speak `POST {baseUrl}/chat/completions` in OpenAI's SSE shape —
|
|
1392
|
+
* the router (a.k.a. tcloud) IS that endpoint, and cli-bridge fronts a
|
|
1393
|
+
* harness CLI behind the same protocol at its own `/v1`. They differ only
|
|
1394
|
+
* in `baseUrl` / `apiKey` and the `kind` label a product wants on its
|
|
1395
|
+
* traces. cli-bridge REQUIRES `model` in the request body, so it MUST route
|
|
1396
|
+
* through `createOpenAICompatibleBackend` (which sends it), never a
|
|
1397
|
+
* transport that drops the field.
|
|
1398
|
+
* - `sandbox` → the caller's own domain backend. The sandbox variant carries
|
|
1399
|
+
* product specifics (system prompt, workspace id, in-box D1 executor) that
|
|
1400
|
+
* do NOT belong in the substrate, so the product passes a `sandboxBackend()`
|
|
1401
|
+
* seam that this resolver simply invokes.
|
|
1402
|
+
*
|
|
1403
|
+
* This resolver is PURE backend selection. Product concerns — credit hard-cuts,
|
|
1404
|
+
* fetch-capture shims, D1 platform wiring — stay as product-side WRAPPERS
|
|
1405
|
+
* around the returned backend. The OpenAI-compat passthrough fields (`tools`,
|
|
1406
|
+
* `toolChoice`, `responseFormat`, `fetchImpl`, `retry`) are forwarded verbatim
|
|
1407
|
+
* so a product can advertise its app tools or install a capturing fetch without
|
|
1408
|
+
* re-opening the branch this consolidation closes.
|
|
1409
|
+
*/
|
|
1410
|
+
|
|
1411
|
+
/** The transport a chat backend runs on. */
|
|
1412
|
+
type AgentBackendKind = 'router' | 'tcloud' | 'cli-bridge' | 'sandbox';
|
|
1413
|
+
/**
|
|
1414
|
+
* OpenAI-compat passthrough forwarded to `createOpenAICompatibleBackend` for
|
|
1415
|
+
* the `router` / `tcloud` / `cli-bridge` kinds. Mirrors that factory's optional
|
|
1416
|
+
* inputs so a product keeps its tool advertising / capture-fetch without
|
|
1417
|
+
* re-implementing the backend branch.
|
|
1418
|
+
*/
|
|
1419
|
+
type OpenAICompatPassthrough = Pick<Parameters<typeof createOpenAICompatibleBackend>[0], 'tools' | 'toolChoice' | 'responseFormat' | 'fetchImpl' | 'retry'>;
|
|
1420
|
+
interface ResolveAgentBackendOptions<TInput extends AgentBackendInput = AgentBackendInput> extends OpenAICompatPassthrough {
|
|
1421
|
+
/** The chat transport to resolve. */
|
|
1422
|
+
kind: AgentBackendKind;
|
|
1423
|
+
/**
|
|
1424
|
+
* Bearer credential for the OpenAI-compat kinds. Empty string is valid for a
|
|
1425
|
+
* loopback-anonymous cli-bridge; a `router`/`tcloud` route with an empty key
|
|
1426
|
+
* is a caller bug the product surfaces before calling in.
|
|
1427
|
+
*/
|
|
1428
|
+
apiKey: string;
|
|
1429
|
+
/** Base URL for the OpenAI-compat kinds. cli-bridge's is its `/v1`. */
|
|
1430
|
+
baseUrl: string;
|
|
1431
|
+
/** Model id sent on every request. cli-bridge rejects a request without it. */
|
|
1432
|
+
model: string;
|
|
1433
|
+
/** `kind` label stamped on the resolved backend + its traces. Defaults to `kind`. */
|
|
1434
|
+
label?: string;
|
|
1435
|
+
/**
|
|
1436
|
+
* `sandbox` kind: the product's own domain backend. Required for that kind —
|
|
1437
|
+
* the substrate owns no product sandbox shape, so a `sandbox` resolution with
|
|
1438
|
+
* no seam is a caller bug, not a silent fallback.
|
|
1439
|
+
*/
|
|
1440
|
+
sandboxBackend?: () => AgentExecutionBackend<TInput>;
|
|
1441
|
+
}
|
|
1442
|
+
/**
|
|
1443
|
+
* Resolve the `AgentExecutionBackend` for the chosen `kind`. Reuse this instead
|
|
1444
|
+
* of hand-rolling the `createOpenAICompatibleBackend` branch in each product.
|
|
1445
|
+
*/
|
|
1446
|
+
declare function resolveAgentBackend<TInput extends AgentBackendInput = AgentBackendInput>(opts: ResolveAgentBackendOptions<TInput>): AgentExecutionBackend<TInput>;
|
|
1447
|
+
|
|
1448
|
+
/**
|
|
1349
1449
|
*
|
|
1350
1450
|
* The two top-level entry points:
|
|
1351
1451
|
*
|
|
@@ -1356,6 +1456,8 @@ declare function decideKnowledgeReadiness(report: KnowledgeReadinessReport, opti
|
|
|
1356
1456
|
* Both gate the run on `KnowledgeReadinessReport` from `agent-eval`, emit the
|
|
1357
1457
|
* same lifecycle event vocabulary (under different shapes — see `types.ts`),
|
|
1358
1458
|
* and route session lifecycle through a pluggable `RuntimeSessionStore`.
|
|
1459
|
+
*
|
|
1460
|
+
* @stable
|
|
1359
1461
|
*/
|
|
1360
1462
|
|
|
1361
1463
|
/** Stamp cross-cutting defaults onto adapter-projected RunRecords without
|
|
@@ -1367,18 +1469,27 @@ declare function decideKnowledgeReadiness(report: KnowledgeReadinessReport, opti
|
|
|
1367
1469
|
* agent in one vocabulary instead of per-agent ad-hoc strings. */
|
|
1368
1470
|
declare function applyRunRecordDefaults(records: RunRecord[], scenarioId: string, controlFailureClass: string | undefined): RunRecord[];
|
|
1369
1471
|
|
|
1370
|
-
/**
|
|
1472
|
+
/**
|
|
1473
|
+
* Single-shot task lifecycle for adapter-driven tasks: readiness-gated, emits the runtime lifecycle event vocabulary, session-store pluggable.
|
|
1474
|
+
*
|
|
1475
|
+
* @stable
|
|
1476
|
+
*/
|
|
1371
1477
|
declare function runAgentTask<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult>(options: RunAgentTaskOptions<TState, TAction, TActionResult, TEval>): Promise<AgentTaskRunResult<TState, TAction, TActionResult, TEval>>;
|
|
1372
|
-
/**
|
|
1478
|
+
/**
|
|
1479
|
+
* Streaming task lifecycle: delegates execution to an `AgentExecutionBackend` (model API, sandbox, or custom iterable) and yields lifecycle events as they happen.
|
|
1480
|
+
*
|
|
1481
|
+
* @stable
|
|
1482
|
+
*/
|
|
1373
1483
|
declare function runAgentTaskStream<TInput extends AgentBackendInput = AgentBackendInput>(options: RunAgentTaskStreamOptions<TInput>): AsyncIterable<RuntimeStreamEvent>;
|
|
1374
1484
|
|
|
1375
1485
|
/**
|
|
1376
|
-
* @stable
|
|
1377
1486
|
*
|
|
1378
1487
|
* Sanitization for runtime telemetry. The rule: nothing user-controlled leaks
|
|
1379
1488
|
* unless the caller opts in with a `RuntimeTelemetryOptions` flag. This is the
|
|
1380
1489
|
* envelope that ends up in `agent_run.metadata.runtimeEvents` on every
|
|
1381
1490
|
* consumer, so the default must be safe.
|
|
1491
|
+
*
|
|
1492
|
+
* @stable
|
|
1382
1493
|
*/
|
|
1383
1494
|
|
|
1384
1495
|
/** @stable */
|
|
@@ -1430,11 +1541,11 @@ interface SanitizedKnowledgeReadinessReport {
|
|
|
1430
1541
|
evidenceIds?: string[];
|
|
1431
1542
|
missingRequirementIds: string[];
|
|
1432
1543
|
}
|
|
1433
|
-
/** @stable */
|
|
1544
|
+
/** Strip PII and large blobs from a `KnowledgeReadinessReport` for safe telemetry emission. @stable */
|
|
1434
1545
|
declare function sanitizeKnowledgeReadinessReport(report: KnowledgeReadinessReport, options?: RuntimeTelemetryOptions): SanitizedKnowledgeReadinessReport;
|
|
1435
|
-
/** @stable */
|
|
1546
|
+
/** Reduce an `AgentRuntimeEvent` to a PII-safe, serializable plain object for telemetry. @stable */
|
|
1436
1547
|
declare function sanitizeAgentRuntimeEvent<TState, TAction, TActionResult, TEval extends ControlEvalResult>(event: AgentRuntimeEvent<TState, TAction, TActionResult, TEval>, options?: RuntimeTelemetryOptions): Record<string, unknown>;
|
|
1437
|
-
/** @stable */
|
|
1548
|
+
/** Reduce a `RuntimeStreamEvent` to a PII-safe, serializable plain object for telemetry. @stable */
|
|
1438
1549
|
declare function sanitizeRuntimeStreamEvent(event: RuntimeStreamEvent, options?: RuntimeTelemetryOptions): Record<string, unknown>;
|
|
1439
1550
|
/** @stable */
|
|
1440
1551
|
interface RuntimeEventCollector<TState = unknown, TAction = unknown, TActionResult = unknown, TEval extends ControlEvalResult = ControlEvalResult> {
|
|
@@ -1465,10 +1576,9 @@ interface RuntimeStreamEventCollector {
|
|
|
1465
1576
|
/** Snapshot of a small streaming-flavored summary derived from collected events. */
|
|
1466
1577
|
summary(): RuntimeStreamEventSummary;
|
|
1467
1578
|
}
|
|
1468
|
-
/** @stable */
|
|
1579
|
+
/** Build an in-memory collector that sanitizes and accumulates `AgentRuntimeEvent`s for inspection. @stable */
|
|
1469
1580
|
declare function createRuntimeEventCollector<TState = unknown, TAction = unknown, TActionResult = unknown, TEval extends ControlEvalResult = ControlEvalResult>(options?: RuntimeTelemetryOptions): RuntimeEventCollector<TState, TAction, TActionResult, TEval>;
|
|
1470
1581
|
/**
|
|
1471
|
-
* @stable
|
|
1472
1582
|
*
|
|
1473
1583
|
* Streaming-event counterpart of `createRuntimeEventCollector`. Pass each
|
|
1474
1584
|
* event yielded by `runAgentTaskStream` through `onEvent` and read the
|
|
@@ -1476,19 +1586,22 @@ declare function createRuntimeEventCollector<TState = unknown, TAction = unknown
|
|
|
1476
1586
|
* flags apply. Kept distinct from `createRuntimeEventCollector` because the
|
|
1477
1587
|
* stream and non-stream event shapes overlap on `type` literals — dispatching
|
|
1478
1588
|
* on `type` alone would misroute events.
|
|
1589
|
+
*
|
|
1590
|
+
* @stable
|
|
1479
1591
|
*/
|
|
1480
1592
|
declare function createRuntimeStreamEventCollector(options?: RuntimeTelemetryOptions): RuntimeStreamEventCollector;
|
|
1481
1593
|
|
|
1482
1594
|
/**
|
|
1483
|
-
* @stable
|
|
1484
1595
|
*
|
|
1485
1596
|
* Session helpers + an in-memory `RuntimeSessionStore` implementation suitable
|
|
1486
1597
|
* for tests, scratch processes, and per-request scratch storage in serverless
|
|
1487
1598
|
* runtimes. Durable stores (D1, postgres, Durable Objects) implement the same
|
|
1488
1599
|
* interface from `./types`.
|
|
1600
|
+
*
|
|
1601
|
+
* @stable
|
|
1489
1602
|
*/
|
|
1490
1603
|
|
|
1491
|
-
/** @stable */
|
|
1604
|
+
/** In-memory `RuntimeSessionStore` for single-process use and tests. @stable */
|
|
1492
1605
|
declare class InMemoryRuntimeSessionStore implements RuntimeSessionStore {
|
|
1493
1606
|
private readonly sessions;
|
|
1494
1607
|
private readonly events;
|
|
@@ -1499,7 +1612,6 @@ declare class InMemoryRuntimeSessionStore implements RuntimeSessionStore {
|
|
|
1499
1612
|
}
|
|
1500
1613
|
|
|
1501
1614
|
/**
|
|
1502
|
-
* @stable
|
|
1503
1615
|
*
|
|
1504
1616
|
* Server-Sent Events serialization for runtime telemetry streams.
|
|
1505
1617
|
*
|
|
@@ -1507,6 +1619,8 @@ declare class InMemoryRuntimeSessionStore implements RuntimeSessionStore {
|
|
|
1507
1619
|
* a space (browsers terminate fields on newline), and multi-line `data`
|
|
1508
1620
|
* payloads are split into one `data:` line per source line so JSON.stringify
|
|
1509
1621
|
* output transports cleanly.
|
|
1622
|
+
*
|
|
1623
|
+
* @stable
|
|
1510
1624
|
*/
|
|
1511
1625
|
|
|
1512
1626
|
/** @stable */
|
|
@@ -1515,9 +1629,9 @@ interface ServerSentEventOptions {
|
|
|
1515
1629
|
id?: string;
|
|
1516
1630
|
retry?: number;
|
|
1517
1631
|
}
|
|
1518
|
-
/** @stable */
|
|
1632
|
+
/** Serialize a `KnowledgeReadinessReport` as a Server-Sent Event string. @stable */
|
|
1519
1633
|
declare function readinessServerSentEvent(report: KnowledgeReadinessReport, options?: RuntimeTelemetryOptions & ServerSentEventOptions): string;
|
|
1520
|
-
/** @stable */
|
|
1634
|
+
/** Serialize a `RuntimeStreamEvent` as a Server-Sent Event string. @stable */
|
|
1521
1635
|
declare function runtimeStreamServerSentEvent(event: RuntimeStreamEvent, options?: RuntimeTelemetryOptions & ServerSentEventOptions): string;
|
|
1522
1636
|
|
|
1523
1637
|
/**
|
|
@@ -1683,4 +1797,4 @@ interface StreamToolLoopOptions<Raw> {
|
|
|
1683
1797
|
* `capped` if it stops for any non-completed reason with calls still pending. */
|
|
1684
1798
|
declare function streamToolLoop<Raw>(opts: StreamToolLoopOptions<Raw>): AsyncGenerator<StreamToolLoopYield<Raw>, void, unknown>;
|
|
1685
1799
|
|
|
1686
|
-
export { AgentBackendContext, AgentBackendInput, AgentExecutionBackend, AgentRuntimeEvent, AgentTaskRunResult, AgentTaskStatus, type AuthSource, type BackendCallPolicy, BackendTransportError, CandidateGenerator, type ChatStreamEvent, type ChatTurnHooks, type ChatTurnIdentity, type ChatTurnProducer, type ChatTurnResult, type CircuitBreakerConfig, CircuitBreakerState, CircuitOpenError, type Conversation, type ConversationDriveState, type ConversationJournal, type ConversationJournalEntry, type ConversationParticipant, type ConversationPolicy, type ConversationResult, type ConversationStreamEvent, type ConversationTurn, type D1DatabaseLike, type D1StmtLike, DEFAULT_MAX_DEPTH, DEFAULT_ROUTER_BASE_URL, DeadlineExceededError, FORWARD_HEADERS, FileConversationJournal, type ForwardHeaderName, type HaltContext, type HaltPredicate, type HaltReason, type HaltSignal, type ImproveOptions, type ImproveResult, type ImproveSurface, InMemoryConversationJournal, InMemoryRuntimeSessionStore, type ModelInfo, OpenAIChatResponseFormat, OpenAIChatTool, OpenAIChatToolChoice, type PersonaConversationResult, type PersonaDriver, PlannerError, type PropagatedHeaders, type ReflectiveGeneratorOptions, type ResolvedChatModel, type RetryBackoff, type RetryableErrorPredicate, type RouterEnv, type RunChatTurnInput, type RunConversationOptions, type RunPersonaConfig, type RunPersonaConversationOptions, type RunToolLoopOptions, type RuntimeEventCollector, RuntimeHooks, RuntimeRunStateError, RuntimeSessionStore, RuntimeStreamEvent, type RuntimeStreamEventCollector, type RuntimeTelemetryOptions, type SanitizedKnowledgeReadinessReport, type SqlAdapter, SqlConversationJournal, type StreamToolLoopOptions, type StreamToolLoopYield, type ToolCallOutcome, type ToolLoopAssistantToolCall, type ToolLoopCall, type ToolLoopEvent, type ToolLoopMessage, type ToolLoopResult, type ToolLoopStopReason, type TurnOrder, applyRunRecordDefaults, buildForwardHeaders, cleanModelId, computeBackoff, createConversationBackend, createIterableBackend, createOpenAICompatibleBackend, createRuntimeEventCollector, createRuntimeStreamEventCollector, createSandboxPromptBackend, d1ToSqlAdapter, decideKnowledgeReadiness, defaultIsRetryable, defineConversation, deriveExecutionId, getModels, handleChatTurn, improve, isDepthExceeded, makePerAttemptSignal, mcpBuildPrompt, readDepth, readinessServerSentEvent, reflectiveGenerator, resolveChatModel, resolveRouterBaseUrl, runAgentTask, runAgentTaskStream, runConversation, runConversationStream, runPersonaConversation, runPersonaDispatch, runToolLoop, runtimeStreamServerSentEvent, sanitizeAgentRuntimeEvent, sanitizeKnowledgeReadinessReport, sanitizeRuntimeStreamEvent, sleep, slugifySpeaker, streamToolLoop, toolBuildPrompt, turnId, validateChatModelId };
|
|
1800
|
+
export { AgentBackendContext, AgentBackendInput, type AgentBackendKind, AgentExecutionBackend, AgentRuntimeEvent, AgentTaskRunResult, AgentTaskStatus, type AuthSource, type BackendCallPolicy, BackendTransportError, CandidateGenerator, type ChatStreamEvent, type ChatTurnHooks, type ChatTurnIdentity, type ChatTurnProducer, type ChatTurnResult, type CircuitBreakerConfig, CircuitBreakerState, CircuitOpenError, type Conversation, type ConversationDriveState, type ConversationJournal, type ConversationJournalEntry, type ConversationParticipant, type ConversationPolicy, type ConversationResult, type ConversationStreamEvent, type ConversationTurn, type D1DatabaseLike, type D1StmtLike, DEFAULT_MAX_DEPTH, DEFAULT_ROUTER_BASE_URL, DeadlineExceededError, FORWARD_HEADERS, FileConversationJournal, type ForwardHeaderName, type HaltContext, type HaltPredicate, type HaltReason, type HaltSignal, type ImproveOptions, type ImproveResult, type ImproveSurface, InMemoryConversationJournal, InMemoryRuntimeSessionStore, type ModelInfo, OpenAIChatResponseFormat, OpenAIChatTool, OpenAIChatToolChoice, type PersonaConversationResult, type PersonaDriver, PlannerError, type PropagatedHeaders, type ReflectiveGeneratorOptions, type ResolveAgentBackendOptions, type ResolvedChatModel, type RetryBackoff, type RetryableErrorPredicate, type RouterEnv, type RunChatTurnInput, type RunConversationOptions, type RunPersonaConfig, type RunPersonaConversationOptions, type RunToolLoopOptions, type RuntimeEventCollector, RuntimeHooks, RuntimeRunStateError, RuntimeSessionStore, RuntimeStreamEvent, type RuntimeStreamEventCollector, type RuntimeTelemetryOptions, type SanitizedKnowledgeReadinessReport, type SqlAdapter, SqlConversationJournal, type StreamToolLoopOptions, type StreamToolLoopYield, type ToolCallOutcome, type ToolLoopAssistantToolCall, type ToolLoopCall, type ToolLoopEvent, type ToolLoopMessage, type ToolLoopResult, type ToolLoopStopReason, type TurnOrder, applyRunRecordDefaults, buildForwardHeaders, cleanModelId, computeBackoff, createConversationBackend, createIterableBackend, createOpenAICompatibleBackend, createRuntimeEventCollector, createRuntimeStreamEventCollector, createSandboxPromptBackend, d1ToSqlAdapter, decideKnowledgeReadiness, defaultIsRetryable, defineConversation, deriveExecutionId, getModels, handleChatTurn, improve, isDepthExceeded, makePerAttemptSignal, mcpBuildPrompt, readDepth, readinessServerSentEvent, reflectiveGenerator, resolveAgentBackend, resolveChatModel, resolveRouterBaseUrl, runAgentTask, runAgentTaskStream, runConversation, runConversationStream, runPersonaConversation, runPersonaDispatch, runToolLoop, runtimeStreamServerSentEvent, sanitizeAgentRuntimeEvent, sanitizeKnowledgeReadinessReport, sanitizeRuntimeStreamEvent, sleep, slugifySpeaker, streamToolLoop, toolBuildPrompt, turnId, validateChatModelId };
|