@theokit/agents 9.3.0 → 10.0.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.
@@ -1,12 +1,13 @@
1
1
  import { ExecutionContext } from '@theokit/http';
2
- import { d as AgentOptions, T as ToolOptions, z as ProjectContextOptions, C as CompiledAgentOptions, H as HumanInTheLoopOptions, A as AgentDefinition, a as CompiledTool, R as ReasoningEffort, G as Guardrail, p as SkillsSelection, S as SettingSourcesSelection, l as McpServersMap, M as MainLoopMeta } from './define-agent-3Kuf6iKM.js';
2
+ import { c as AgentOptions, T as ToolOptions, p as ProjectContextOptions, C as CompiledAgentOptions, H as HumanInTheLoopOptions, b as CompiledTool, R as ReasoningEffort, G as Guardrail, S as SkillsSelection, M as McpServersMap } from './agent-compiler-CIPQkehU.js';
3
3
  import { SkillsSettings, ContextSettings, SystemPromptResolver, ModelSelection, PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition as AgentDefinition$1, BudgetTracker, CustomTool, RunEventSink, MemorySettings } from '@theokit/sdk';
4
+ import { S as StreamEvent } from './delegation-scoring-CDvtrYKd.js';
4
5
  import { SandboxPosture } from '@theokit/sdk/sandbox';
6
+ import { A as AgentDefinition, S as SettingSourcesSelection } from './define-agent-BO5QSjV8.js';
5
7
  import { WireChunk } from '@theokit/presenter/wire';
6
8
  import { z } from 'zod';
7
9
  import { H as HookHandlers } from './hook-handlers-Cw2FsnE5.js';
8
10
  import { TheokitAgentError } from '@theokit/sdk/errors';
9
- import { RetryOptions } from '@theokit/sdk/retry';
10
11
 
11
12
  /**
12
13
  * AgentExecutionContext — extends http-decorators' ExecutionContext with agent-specific methods.
@@ -119,24 +120,6 @@ declare function projectContextMetadataOnlyKnobs(options: ProjectContextOptions)
119
120
  */
120
121
  declare function compileProjectContext(options: ProjectContextOptions, base?: string | SystemPromptResolver): SystemPromptResolver;
121
122
 
122
- /**
123
- * SSE streaming handler — Web Standard Response with ReadableStream.
124
- *
125
- * Per ADR D4: SSE is the v1 transport.
126
- * Per EC-2: uses ReadableStream with controller.enqueue() instead of res.write().
127
- * Works natively on Node, Bun, Deno, CF Workers.
128
- */
129
- /** Minimal event shape matching SDK's SDKMessage discriminated union. */
130
- interface StreamEvent {
131
- type: string;
132
- [key: string]: unknown;
133
- }
134
- /**
135
- * Create a Web Standard Response that streams SSE events.
136
- * Each event becomes: `event: {type}\ndata: {json}\n\n`
137
- */
138
- declare function streamAgentResponse(eventStream: AsyncIterable<StreamEvent>): Response;
139
-
140
123
  /**
141
124
  * Typed discriminated union for agent SSE stream events.
142
125
  *
@@ -426,6 +409,8 @@ interface HitlWiring {
426
409
  * an absent rule resolves to `ask`.
427
410
  */
428
411
 
412
+ /** The map of gated tools that `compileAgentDefinition` produces (`compiled.hitl`). */
413
+ type GatedTools = ReadonlyMap<string, HumanInTheLoopOptions>;
429
414
  /**
430
415
  * What this surface does when a gated tool asks for approval. Four variants, none of them
431
416
  * "omission" — each with a concrete consumer and a written reason.
@@ -478,6 +463,20 @@ type ApprovalPosture = {
478
463
  kind: 'owned-by-surface';
479
464
  reason: string;
480
465
  };
466
+ /**
467
+ * Writes the plugins the posture requires into `extra` — the object `toAgentFactory` spreads AFTER
468
+ * `m8` into the `Agent.create` options, and which therefore wins. Plugins already present (from the
469
+ * agent, via `m8`, and from an override, via `extra`) are preserved: running them over is the M14
470
+ * regression that `buildExtraCreateOptions` already carries a guard against.
471
+ *
472
+ * The legacy `plugins` shape (an `{ enabled }` object) cannot carry both, so a posture that needs to
473
+ * install a plugin alongside it is refused LOUD AND CLEAR, rather than resolved by dropping one of
474
+ * them: silently dropping the approval gate is exactly the class of defect this milestone closes
475
+ * (Rule 8, fail-closed).
476
+ */
477
+ declare function applyPosture(extra: Record<string, unknown>, m8: {
478
+ plugins?: unknown;
479
+ }, posturePolicy: ApprovalPosture, gated: GatedTools | undefined): void;
481
480
 
482
481
  /**
483
482
  * A definition, or a THUNK that produces one per session.
@@ -659,6 +658,85 @@ declare function toAgentFactory(def: DefinitionOrThunk, opts: {
659
658
  overrides?: RuntimeOverrides;
660
659
  }): (sessionId: string) => Promise<SdkAgentHandle>;
661
660
 
661
+ /**
662
+ * T2.1 — "may I auto-approve this tool right now?", as a symbol a surface can call.
663
+ *
664
+ * ## Why this exists next to `approval-posture.ts` rather than inside it
665
+ *
666
+ * {@link applyPosture} answers a different question: *"construct this agent with a gate?"*. It runs
667
+ * once, at factory time, mutating an options bag. A surface asks per EVENT, before it decides
668
+ * whether to render a prompt, and it has no options bag in hand.
669
+ *
670
+ * Until this function existed the only reachable half of the rule was the type. `approval-posture.ts`
671
+ * says in writing that the consumer implemented the refusal twice and calls that a G12 violation —
672
+ * and it was still true when this was written, because the enforcement stayed private. A rule that
673
+ * lives in an unexported function lives once for the framework and zero times for everyone else.
674
+ *
675
+ * ## The invariant, stated once
676
+ *
677
+ * **Nothing auto-approves without positive evidence of enforced confinement.** Two consumer defects
678
+ * reduce to it:
679
+ *
680
+ * - *B-006* — an absent posture counts as unconfined. Absence of evidence is not evidence of
681
+ * confinement, and defaulting the other way silently disables the guard anywhere the posture has
682
+ * not been threaded through.
683
+ * - *B-021* — the headless path made the posture a required argument precisely because omitting it
684
+ * returned "approved" for `full-auto`, skipping the refusal the function exists for.
685
+ *
686
+ * `posture` stays OPTIONAL in the type so a surface mid-migration still compiles; it just gets
687
+ * `false`. Making it required would be the stricter type and the worse outcome — a caller who cannot
688
+ * yet supply it writes its own predicate instead, which is how the duplication started.
689
+ *
690
+ * The peers resolve omission the same way: `codex`'s `GranularApprovalConfig` auto-REJECTS an absent
691
+ * field, and `opencode` resolves an absent rule to `ask`.
692
+ */
693
+
694
+ /**
695
+ * What a surface does about asking, as the three modes a coding agent actually offers.
696
+ *
697
+ * Not a framework invention: these are the values the only real consumer put in front of users, and
698
+ * naming them here is what lets its two copies of the rule become one call.
699
+ */
700
+ declare const APPROVAL_MODES: readonly ["suggest", "auto-edit", "full-auto"];
701
+ type ApprovalMode = (typeof APPROVAL_MODES)[number];
702
+ /**
703
+ * Tools whose writes are bounded by their own write root rather than by the kernel.
704
+ *
705
+ * A CATALOG, not a policy. The names are the SDK factories' defaults (`apply-patch.ts:51`,
706
+ * `edit-file.ts:155`, `write-file.ts:86`), so this answers "does this tool confine its own writes?"
707
+ * — a fact about the SDK. It does NOT answer "may this tool run without asking a human?", which is
708
+ * the product's to decide and is why {@link shouldAutoApprove} does not read this by default. See
709
+ * the `auto-edit` branch there for what conflating the two cost.
710
+ *
711
+ * Genuinely immutable, not merely typed that way. `ReadonlySet` is erased at runtime, and one
712
+ * `as Set<string>` on an approval gate reachable from every consumer of this package would widen
713
+ * what auto-approves everywhere, with no diff in the module that owns the rule. `Object.freeze`
714
+ * alone does not do it: a Set keeps its entries in internal slots rather than own properties, so
715
+ * freezing leaves `add` fully functional — the mutators have to be replaced.
716
+ */
717
+ declare const WRITE_SCOPED_TOOLS: ReadonlySet<string>;
718
+ interface ShouldAutoApproveOptions {
719
+ /**
720
+ * Which tools this PRODUCT lets run without asking, in `auto-edit`.
721
+ *
722
+ * Required in practice: absent, `auto-edit` approves nothing. {@link WRITE_SCOPED_TOOLS} is
723
+ * available for a product that wants every write-scoped tool, but passing it is a decision the
724
+ * product makes, not a default it inherits.
725
+ */
726
+ writeScopedTools?: ReadonlySet<string>;
727
+ }
728
+ /**
729
+ * Whether a gated tool may run without asking a human.
730
+ *
731
+ * Pure over its arguments and holds no state, so a surface can call it per event.
732
+ *
733
+ * @param mode - what the user chose.
734
+ * @param toolName - the name the model sees, which is also the approval key.
735
+ * @param posture - the sandbox's own answer to "am I kernel-enforced right now?". Absent or
736
+ * unenforced means NOT confined, and nothing auto-approves.
737
+ */
738
+ declare function shouldAutoApprove(mode: ApprovalMode, toolName: string, posture?: Pick<SandboxPosture, 'enforced'>, options?: ShouldAutoApproveOptions): boolean;
739
+
662
740
  /**
663
741
  * Model-selection mapping (M1 reasoning-visibility) — the single site that turns a
664
742
  * provider-agnostic `ReasoningEffort` into the SDK `ModelSelection`. Kept in its own small module
@@ -1077,373 +1155,6 @@ interface StreamAgentOptions {
1077
1155
  */
1078
1156
  declare function streamAgentUIMessages(compiled: CompiledAgentOptions, apiKey: string, input: StreamAgentOptions): AsyncGenerator<WireChunk>;
1079
1157
 
1080
- /**
1081
- * LoopStrategy — the per-round terminal-decision contract that gives runtime to
1082
- * `@MainLoop({ strategy })`.
1083
- *
1084
- * V4-A proved `@MainLoop`'s `strategy` field was metadata-only (declared +
1085
- * compiled, never executed). This module is the foundation Phase 2's
1086
- * `runReflectiveLoop` branches on. Modeled on Mastra's `agentic-loop`/`stopWhen`
1087
- * (inverted) + `maxSteps` ceiling — NOT Spring's per-call Advisor (plan ADR D1).
1088
- * Config is Zod-validated so an invalid `maxIterations` fails fast at resolve
1089
- * time, never as a silent infinite loop at runtime (plan ADR D3).
1090
- *
1091
- * reference: knowledge-base/references/mastra agentic-loop/index.ts (stopWhen + maxSteps).
1092
- */
1093
-
1094
- /** Why a single round ended (or, for the V4-D terminals, why the whole loop ended). */
1095
- type LoopFinishReason = 'tool-calls' | 'stop' | 'length' | 'error' | 'step_limit' | 'no_progress';
1096
- /** Value object describing one round's result. */
1097
- interface LoopOutcome {
1098
- /** Why the round ended (the continuation signal). */
1099
- readonly finishReason: LoopFinishReason;
1100
- /** 1-indexed round number that just completed. */
1101
- readonly round: number;
1102
- /** Tool calls executed during the round (V4-N: `id` correlates the call to its result). */
1103
- readonly toolCalls: readonly {
1104
- id: string;
1105
- name: string;
1106
- input: unknown;
1107
- output: string;
1108
- }[];
1109
- /** Accumulated assistant text for the round. */
1110
- readonly responseText: string;
1111
- }
1112
- /** The terminal-decision contract. `shouldContinue` is the inverted `stopWhen`. */
1113
- interface LoopStrategy {
1114
- /**
1115
- * The strategy name, surfaced in `finalize`/logs. M54 relaxes this from
1116
- * `MainLoopMeta['strategy']` to `string` so a caller-injected `.loopStrategy(custom)` can name
1117
- * itself freely — the three built-ins keep their names, but the seam is no longer union-locked.
1118
- * The INTERNAL resolution (`loopStrategyConfigSchema`) still validates the three built-in names
1119
- * via `z.enum`; a custom never passes through it (it enters by the seam, not by name).
1120
- */
1121
- readonly name: string;
1122
- /** Hard ceiling on rounds — guarantees termination (enforced by the runner since M54). */
1123
- readonly maxIterations: number;
1124
- /** True ⇒ re-enter for another round; false ⇒ terminate. The runner caps it at `maxIterations`. */
1125
- shouldContinue(outcome: LoopOutcome): boolean;
1126
- }
1127
- /** Default round ceiling when `@MainLoop` declares no `maxIterations` (EC-3: finite, never Infinity). */
1128
- declare const DEFAULT_MAX_ITERATIONS = 8;
1129
- /** Serializable config for a LoopStrategy. SSoT per type-safety.md (ADR D3). */
1130
- declare const loopStrategyConfigSchema: z.ZodObject<{
1131
- name: z.ZodEnum<{
1132
- "simple-chat": "simple-chat";
1133
- "plan-act-reflect": "plan-act-reflect";
1134
- react: "react";
1135
- }>;
1136
- maxIterations: z.ZodNumber;
1137
- }, z.core.$strip>;
1138
- type LoopStrategyConfig = z.infer<typeof loopStrategyConfigSchema>;
1139
- /**
1140
- * Map a `@MainLoop` strategy + ceiling to a concrete {@link LoopStrategy}.
1141
- *
1142
- * - `simple-chat` ⇒ exactly one round (`shouldContinue` always false).
1143
- * - `react` ⇒ continue while the round ended on `tool-calls` AND the ceiling has not been reached
1144
- * (`round < maxIterations`) — the reflection is `noop` (no feedback), so the strategy IS the gate.
1145
- * - `plan-act-reflect` ⇒ DEFER continuation to the reflection (V4-S): `shouldContinue` is
1146
- * `round < maxIterations`, so the loop continues iff the (custom) `ReflectionStrategy` returns
1147
- * `continue: true` within the ceiling — letting a reflection extend even a terminal (`stop`)
1148
- * round (e.g. "you answered without editing — make the edit now"). Backward-compatible with the
1149
- * default `ladderReflectionStrategy`, which itself returns `continue: true` only on `tool-calls`,
1150
- * so the observable behavior with the shipped ladder is unchanged.
1151
- *
1152
- * Throws (Zod) when `maxIterations < 1` — fail fast, never a silent infinite loop.
1153
- */
1154
- declare function resolveLoopStrategy(strategy: string, maxIterations?: number): LoopStrategy;
1155
-
1156
- interface DelegationResult {
1157
- response: string;
1158
- toolCalls: {
1159
- id: string;
1160
- name: string;
1161
- input: unknown;
1162
- output: string;
1163
- }[];
1164
- cost: number;
1165
- tokens: number;
1166
- /** V4-N: split token usage accumulated across rounds (`tokens` stays as the total). Absent for the single-shot path. */
1167
- tokensInput?: number;
1168
- tokensOutput?: number;
1169
- /** V4-O: reasoning/cache token buckets accumulated across rounds (0 on any loop-driven run; the loop seeds them). Optional for type compat. */
1170
- reasoningTokens?: number;
1171
- cacheReadTokens?: number;
1172
- cacheWriteTokens?: number;
1173
- /** Rounds the reflective loop ran (set by `runReflectiveLoop`; absent for the single-shot path). */
1174
- rounds?: number;
1175
- /**
1176
- * The loop's terminal reason (set by `runReflectiveLoop`): `'stop'`/`'length'` natural end,
1177
- * `'step_limit'` (hit maxIterations), `'no_progress'` (stuck). Absent for the single-shot path. (V4-D)
1178
- */
1179
- finishReason?: LoopFinishReason;
1180
- }
1181
- /**
1182
- * DELEGATION budget exceeded — the dollar cost of a delegated agent.
1183
- *
1184
- * ## Why the name changed in M91
1185
- *
1186
- * It was called `BudgetExceededError` and **shadowed** the SDK class of the same name, which belongs
1187
- * to another domain: context-WINDOW budget (`budgetName`/`window`/`mode`) against DELEGATION budget
1188
- * (`agentName`/`actualCost`). Since the consumer holds an unbreakable rule never to import
1189
- * `@theokit/sdk` directly, it **could never reach the SDK's** — and an `instanceof` against this
1190
- * barrel silently matched the wrong domain.
1191
- *
1192
- * It is the failure mode M73 documented in `auth-parity.test.ts`: when two classes compete for the
1193
- * same name, no behavioural test goes red — only an identity `toBe` catches it.
1194
- *
1195
- * `subpath-coverage.test.ts` recorded the collision as a `gap` on `./errors`, with the reason written
1196
- * down and the acknowledgement that renaming was breaking and out of M78's scope. M91 paid the bill.
1197
- */
1198
- /**
1199
- * M80 — extends {@link TheokitAgentError}, not plain `Error`.
1200
- *
1201
- * `isTransientError` is defined over `TheokitAgentError`, so a class outside that hierarchy is
1202
- * INVISIBLE to it and the only recourse left to a consumer is matching on message text. `code` is
1203
- * stable across a rename; `isRetryable` is DECLARED, because a default would be a retry policy
1204
- * nobody chose.
1205
- */
1206
- declare class DelegationBudgetExceededError extends TheokitAgentError {
1207
- readonly agentName: string;
1208
- readonly actualCost: number;
1209
- readonly budgetLimit: number;
1210
- readonly name = "DelegationBudgetExceededError";
1211
- constructor(agentName: string, actualCost: number, budgetLimit: number);
1212
- }
1213
- /**
1214
- * @deprecated Use {@link DelegationBudgetExceededError}. The alias is kept for one major so anyone
1215
- * catching by the old name is not broken; it is the **same** class, not a copy — `instanceof` still
1216
- * holds in both directions, and a referential-identity test (`toBe`) pins that.
1217
- */
1218
- declare const BudgetExceededError: typeof DelegationBudgetExceededError;
1219
- /** @deprecated Use {@link DelegationBudgetExceededError}. */
1220
- type BudgetExceededError = DelegationBudgetExceededError;
1221
- /**
1222
- * M80 — extends {@link TheokitAgentError}, not plain `Error`.
1223
- *
1224
- * `isTransientError` is defined over `TheokitAgentError`, so a class outside that hierarchy is
1225
- * INVISIBLE to it and the only recourse left to a consumer is matching on message text. `code` is
1226
- * stable across a rename; `isRetryable` is DECLARED, because a default would be a retry policy
1227
- * nobody chose.
1228
- */
1229
- declare class DelegationError extends TheokitAgentError {
1230
- readonly agentName: string;
1231
- readonly cause: unknown;
1232
- readonly name = "DelegationError";
1233
- constructor(agentName: string, cause: unknown);
1234
- }
1235
-
1236
- /**
1237
- * ReflectionStrategy — composes INTO the loop between rounds (the loop calls
1238
- * `reflect()` then `LoopStrategy.shouldContinue()`).
1239
- *
1240
- * `'plan-act-reflect'` resolves to the `'ladder'` default shipped here; a custom
1241
- * strategy may be supplied (OCP — plan Drawback #2). `reflect()` is pure (no
1242
- * I/O, no LLM) — it inspects the round's outcome and returns feedback to inject
1243
- * into the next round's prompt plus a `continue` hint. The hard round ceiling
1244
- * lives in `LoopStrategy.shouldContinue` (maxIterations), NOT here.
1245
- *
1246
- * reference: knowledge-base/references/mastra agentic-loop/index.ts (onIterationComplete → { feedback, continue }).
1247
- */
1248
-
1249
- /** Result of reflecting on a completed round. */
1250
- interface ReflectionResult {
1251
- /** Optional text prepended to the next round's prompt. */
1252
- readonly feedback?: string;
1253
- /** Hint: should the loop reflect-and-continue? (the ceiling still bounds it) */
1254
- readonly continue: boolean;
1255
- }
1256
- /**
1257
- * V4-K: a per-run mutable scratch bag threaded to every `reflect()` call within one
1258
- * `runReflectiveLoopStream` run, so a STATEFUL strategy can accumulate cumulative state
1259
- * (counters, one-shot flags) across rounds. The framework owns the lifecycle (creates
1260
- * one per run, passes the SAME ref each round) but writes NOTHING into it — the strategy
1261
- * owns the contents. Generic by design: the framework cannot know app semantics (e.g.
1262
- * what an "edit" is). A consumer narrows it locally (`ctx as MyState`).
1263
- */
1264
- type ReflectionContext = Record<string, unknown>;
1265
- /** Pluggable between-round reflection. Pure — never performs I/O. */
1266
- interface ReflectionStrategy {
1267
- /** Strategy identifier (e.g. `'ladder'`). */
1268
- readonly name: string;
1269
- /**
1270
- * Inspect the round outcome; return feedback + continue hint. `ctx` (V4-K) is the
1271
- * per-run mutable scratch — optional for backward compatibility (shipped strategies
1272
- * ignore it; stateful custom strategies accumulate in it across rounds).
1273
- */
1274
- reflect(outcome: LoopOutcome, ctx?: ReflectionContext): ReflectionResult;
1275
- }
1276
- /** Serializable config for a ReflectionStrategy. SSoT per type-safety.md (ADR D3). */
1277
- declare const reflectionStrategyConfigSchema: z.ZodObject<{
1278
- name: z.ZodString;
1279
- }, z.core.$strip>;
1280
- type ReflectionStrategyConfig = z.infer<typeof reflectionStrategyConfigSchema>;
1281
- /**
1282
- * The default `'ladder'` reflection (what `'plan-act-reflect'` resolves to).
1283
- *
1284
- * Continues with bounded templated feedback while the round ended on
1285
- * `tool-calls`; terminates on any terminal `finishReason` (`stop`/`error`/
1286
- * `length`). The feedback is a short fixed template (bounded — EC-5; context
1287
- * growth is the SDK's responsibility, not the loop's).
1288
- */
1289
- declare const ladderReflectionStrategy: ReflectionStrategy;
1290
- /**
1291
- * No-op reflection for `'react'` (multi-round WITHOUT reflection feedback).
1292
- *
1293
- * Returns `{ continue: true }` (no feedback) so the round-continuation decision
1294
- * is delegated entirely to `LoopStrategy.shouldContinue` (i.e. `react` loops
1295
- * while `finishReason === 'tool-calls'` under the ceiling). NOTE: the plan's
1296
- * pseudo-code (Files-to-edit) sketched `{ continue: false }`, which would make
1297
- * `react` single-shot — that contradicts the plan's own Deep Dives ("`react`
1298
- * still multi-rounds while finishReason==='tool-calls'"); `continue: true` is
1299
- * the behavior the resolved react LoopStrategy requires.
1300
- */
1301
- declare const noopReflectionStrategy: ReflectionStrategy;
1302
-
1303
- /**
1304
- * runReflectiveLoop — the multi-round reflective driver that gives `@MainLoop`
1305
- * its runtime (closes the metadata-only gap, V4-A / plan ADR D2).
1306
- *
1307
- * Per round it consumes ONE SDK stream turn (the model call stays in the SDK —
1308
- * the factory is `createSdkAgentStream(...)`, injected for testability), derives
1309
- * a {@link LoopOutcome}, asks the {@link ReflectionStrategy} for feedback, then
1310
- * the {@link LoopStrategy} whether to continue. Bounded by `maxIterations`
1311
- * (forced terminal at the ceiling — never an infinite loop). The bridge owns the
1312
- * loop; the SDK owns the model call (sdk-runtime.md / ADR 0031 — no second runtime).
1313
- *
1314
- * `runReflectiveLoop` is INTERNAL (not re-exported from the package barrel,
1315
- * Drawback #4) — consumed by `delegate()` (T2.2) and `AgentRunner` (T3.1).
1316
- *
1317
- * reference: knowledge-base/references/mastra agent.ts (re-enter the loop with feedback).
1318
- */
1319
-
1320
- /** One SDK stream turn: `createSdkAgentStream(...)` returns this shape. */
1321
- /**
1322
- * Opens one round's SDK stream. `opts.disableTools` (step-cap force-close) asks the factory to
1323
- * gate tools OFF for THIS round (the SDK adapter maps it to `tool_choice:"none"` at send-time, so a
1324
- * cached agent — whose tools can't be un-registered — is still forced to a text summary). Optional +
1325
- * ignored by injected test factories ⇒ backward-compatible.
1326
- */
1327
- type RoundStreamFactory = (message: string, sessionId: string, opts?: {
1328
- disableTools?: boolean;
1329
- }) => AsyncIterable<StreamEvent>;
1330
-
1331
- /**
1332
- * Multi-agent orchestration runtime.
1333
- *
1334
- * Provides `delegate()` — a function that lets a parent agent invoke a
1335
- * sub-agent and receive its result. Handles budget clamping (D4), tool sharing,
1336
- * toolbox auto-instantiation (EC-1), and routes the resolved `@MainLoop` strategy
1337
- * through `runReflectiveLoop` — the SAME driver `AgentRunner.run()` uses, so both
1338
- * on-ramps are one runtime (ADR D4). `simple-chat` ⇒ `shouldContinue:()=>false`
1339
- * ⇒ exactly one round; `react`/`plan-act-reflect` ⇒ multi-round reflective loop.
1340
- */
1341
-
1342
- interface DelegateOptions {
1343
- /**
1344
- * M81 — wall-clock cap for the delegation, in milliseconds. Absent ⇒ no clock cap.
1345
- *
1346
- * A DIFFERENT guard from `budget`: money is spent by work that progresses, and a delegation that
1347
- * HANGS burns clock without spending a cent. A consumer wrote its own timeout race with its own
1348
- * typed error because this was missing. Exceeding it raises `DelegationTimeoutError`, which —
1349
- * unlike the budget errors — is marked retryable, because a hang is often transient.
1350
- */
1351
- readonly timeoutMs?: number;
1352
- /** Max USD for this sub-agent call. */
1353
- budget?: number;
1354
- /** Parent's remaining budget (for clamping). */
1355
- parentBudgetRemaining?: number;
1356
- /** Parent's tools (for sharing — sub-agent inherits these). */
1357
- parentTools?: CompiledTool[];
1358
- /**
1359
- * Parent's hooks. The member inherits them, and inheritance may only TIGHTEN: both
1360
- * `pre_tool_call` gates run and the first refusal wins, so a member cannot widen what the parent
1361
- * refused.
1362
- *
1363
- * Symmetric with `parentTools` on purpose — `delegate` already carried the parent's tools and its
1364
- * budget into the member's run and left its AUTHORITY behind, which is how a squad member could
1365
- * call a tool the supervisor had vetoed. The failure was silent: nothing threw, and the member's
1366
- * own suite passed because the member never declared the gate.
1367
- *
1368
- * To scope a member differently, pass its handlers on `spec.compiled.hooks` — they compose with
1369
- * these rather than replacing them, because a widening that a call site cannot see is the state
1370
- * this option exists to remove.
1371
- */
1372
- parentHooks?: HookHandlers;
1373
- /** LLM API key (inherited from parent). */
1374
- apiKey?: string;
1375
- /** Session ID override (default: crypto.randomUUID for isolation). */
1376
- sessionId?: string;
1377
- /** Cancellation — aborts stop the reflective loop from re-entering. */
1378
- signal?: AbortSignal;
1379
- /** Per-run model override (`?? SubAgent @Agent model`). */
1380
- model?: string;
1381
- /** Per-run working directory → `Agent.create({ local: { cwd } })`. */
1382
- cwd?: string;
1383
- /** Per-run plugins (e.g. a read-only permission gate for an explore sub-agent). */
1384
- plugins?: PluginsSettings;
1385
- /** Per-run provider routing (e.g. OpenRouter). */
1386
- providers?: ProviderRoutingSettings;
1387
- /** Per-run sub-agent definitions. */
1388
- agents?: Record<string, AgentDefinition$1>;
1389
- /** Per-run SDK budget tracker (inner tool-loop cap). */
1390
- budgetTracker?: BudgetTracker;
1391
- /** Per-run pre-built SDK tools forwarded raw (V4-Q). */
1392
- sdkTools?: readonly CustomTool[];
1393
- /** Per-round transient retry (V4-P). */
1394
- retry?: RetryOptions;
1395
- /** Custom between-round reflection (default: ladder for `plan-act-reflect`, else noop). */
1396
- reflection?: ReflectionStrategy;
1397
- /** Per-run loop-ceiling override (`?? SubAgent @MainLoop maxIterations`). */
1398
- maxIterations?: number;
1399
- /**
1400
- * Called BEFORE the sub-agent runs. Returns the input the sub-agent will receive — return
1401
- * `ctx.input` unchanged, or a rewritten string (e.g. inject a persona). A transform, not a veto.
1402
- */
1403
- onDelegationStart?: (ctx: {
1404
- subAgent: string;
1405
- input: string;
1406
- }) => string | Promise<string>;
1407
- /**
1408
- * Called AFTER the sub-agent completes. Returns the result the supervisor sees — return
1409
- * `ctx.result` unchanged, or a transformed one (e.g. redact, score, re-wrap).
1410
- */
1411
- onDelegationComplete?: (ctx: {
1412
- subAgent: string;
1413
- result: DelegationResult;
1414
- }) => DelegationResult | Promise<DelegationResult>;
1415
- /**
1416
- * Injected stream factory (parity with `AgentRunnerRunOptions.streamFactory`) — drives the loop
1417
- * directly instead of the SDK adapter (tests / custom transport). Absent ⇒ `createSdkAgentStream`.
1418
- */
1419
- streamFactory?: RoundStreamFactory;
1420
- }
1421
- /**
1422
- * Delegate a task to a sub-agent and collect its result.
1423
- *
1424
- * - Budget clamping: `min(parentBudgetRemaining, budget)` (D4)
1425
- * - Tool sharing: parent tools merged with sub-agent tools (sub wins on collision)
1426
- * - Toolbox auto-instantiation: sub-agent toolboxes instantiated without DI (EC-1)
1427
- * - Session isolation: each delegation gets a unique session ID (EC-4)
1428
- * - `@MainLoop` strategy runtime: routes through `runReflectiveLoop` (the same loop
1429
- * `AgentRunner.run` uses — one runtime for both on-ramps, ADR D4). The runtime
1430
- * metric (`THEO_AGENT_MAINLOOP_RUNTIME_APPLIED`) + typed-error + cumulative budget
1431
- * all live in the shared driver, so they fire identically on both paths.
1432
- */
1433
- /**
1434
- * What `delegate` needs from a sub-agent: a name and already-compiled options (built by
1435
- * `applyCapabilities`). Compatible with {@link AgentRunnerSpec} — one spec drives both on-ramps.
1436
- */
1437
- interface SubAgentSpec {
1438
- readonly name: string;
1439
- readonly compiled: CompiledAgentOptions;
1440
- /** Loop strategy (`@MainLoop({ strategy })`); absent ⇒ the same `'simple-chat'` default. */
1441
- readonly strategy?: MainLoopMeta['strategy'];
1442
- /** Loop ceiling (`@MainLoop({ maxIterations })`); a per-run override still wins. */
1443
- readonly maxIterations?: number;
1444
- }
1445
- declare function delegate(spec: SubAgentSpec, message: string, opts?: DelegateOptions): Promise<DelegationResult>;
1446
-
1447
1158
  /**
1448
1159
  * M10 (theokit-ai-first) — createToolHooksPlugin: `beforeToolCall` / `afterToolCall` observability.
1449
1160
  *
@@ -1592,82 +1303,6 @@ declare function runWithApiErrorHandling<R>(thunk: () => Promise<R>, policy: Api
1592
1303
  */
1593
1304
  declare function createApiErrorHandler<R = unknown>(policy: ApiErrorPolicy<R>): (thunk: () => Promise<R>) => Promise<R>;
1594
1305
 
1595
- /**
1596
- * M25 (theokit-ai-first) — background delegation + task-completion scoring.
1597
- *
1598
- * Two THIN wrappers over the M12 `delegate` (ADR 0038/0040): no new orchestration engine, no second
1599
- * loop, no new store. `delegateBackground` kicks off a sub-agent without blocking the supervisor and
1600
- * hands back a handle to await later. `delegateWithScoring` runs `delegate`, scores the result with
1601
- * an injected scorer, and re-delegates with the scorer's feedback until it passes or `maxRounds` is
1602
- * hit. The `delegate` implementation is injectable (`delegateFn`) so this is testable without a
1603
- * SubAgent class or an LLM — and so it NEVER re-implements the delegation runtime.
1604
- */
1605
-
1606
- /**
1607
- * M81 — anything that can run a delegation.
1608
- *
1609
- * The reach gap this closes: both wrappers took a `SubAgentSpec` produced by the capability
1610
- * compiler, so a consumer holding an SDK `SubAgent` or `Squad` could not feed them. That is why the
1611
- * scoring loop — the layer's highest-value piece — had ZERO adoption in a product that runs an
1612
- * explicit review pass: it was unreachable from the primitives that product actually holds.
1613
- *
1614
- * An SDK `SubAgent` or `Squad` satisfies this by having `run`. So does a test double, which is why
1615
- * the loop is now testable without a compiler, a class or an LLM.
1616
- */
1617
- interface DelegationPort {
1618
- run(message: string): Promise<DelegationResult>;
1619
- }
1620
- /** What both wrappers accept: the compiled spec (unchanged) or the port (M81, additive). */
1621
- type DelegationTarget = SubAgentSpec | DelegationPort;
1622
- /** The delegation primitive both wrappers drive. Defaults to the M12 {@link delegate}. */
1623
- type DelegateFn = (subAgent: SubAgentSpec, message: string, opts?: DelegateOptions) => Promise<DelegationResult>;
1624
- /** A running background delegation the supervisor can await/poll later. */
1625
- interface BackgroundDelegation {
1626
- /** Await the sub-agent's result (or rejection). Idempotent — returns the same settled promise. */
1627
- wait(): Promise<DelegationResult>;
1628
- /** Whether the underlying delegation has resolved or rejected. */
1629
- settled(): boolean;
1630
- }
1631
- /**
1632
- * Start a sub-agent WITHOUT blocking the supervisor. Returns immediately with a handle; the
1633
- * supervisor keeps working and calls `wait()` when it needs the result. A thin async wrapper over
1634
- * `delegate` — not a scheduler (Top-risk 1). Rejections are still observable via `wait()`.
1635
- */
1636
- declare function delegateBackground(subAgent: DelegationTarget, message: string, opts?: DelegateOptions & {
1637
- delegateFn?: DelegateFn;
1638
- }): BackgroundDelegation;
1639
- /** A scorer's verdict on a sub-agent result. `feedback` is fed back into the next round on failure. */
1640
- interface ScoreVerdict {
1641
- pass: boolean;
1642
- /** Optional numeric score (0..1) for logging/telemetry. */
1643
- score?: number;
1644
- /** Guidance appended to the next delegation when `pass` is false. */
1645
- feedback?: string;
1646
- }
1647
- /** Scores a sub-agent result. Opt-in (Top-risk 2) — the caller supplies it, and pays its cost. */
1648
- type Scorer = (result: DelegationResult) => ScoreVerdict | Promise<ScoreVerdict>;
1649
- /** The outcome of a scored delegation: the final result plus the per-round verdict trail. */
1650
- interface ScoredDelegation {
1651
- result: DelegationResult;
1652
- /** Rounds actually run (1..maxRounds). */
1653
- rounds: number;
1654
- /** Whether the final round passed the scorer. */
1655
- passed: boolean;
1656
- /** The verdict from each round, in order. */
1657
- verdicts: ScoreVerdict[];
1658
- }
1659
- /**
1660
- * Run `delegate`, score the result, and re-delegate with the scorer's feedback until it passes or
1661
- * `maxRounds` is reached. Each round is ONE `delegate` call — no second loop, no new store. Returns
1662
- * the final result (passing, or the last attempt) with the per-round verdict trail.
1663
- */
1664
- declare function delegateWithScoring(subAgent: DelegationTarget, message: string, opts: DelegateOptions & {
1665
- scorer: Scorer;
1666
- maxRounds?: number;
1667
- delegateFn?: DelegateFn;
1668
- feedbackTemplate?: (message: string, feedback: string) => string;
1669
- }): Promise<ScoredDelegation>;
1670
-
1671
1306
  /**
1672
1307
  * M81 — the two gaps around a delegation's LIFE, as opposed to its execution.
1673
1308
  *
@@ -1959,4 +1594,4 @@ declare function agentsPlugin(opts: AgentsPluginOptions): {
1959
1594
  register(app: PluginApp): void;
1960
1595
  };
1961
1596
 
1962
- export { type LoopStrategyConfig as $, type AgentManifestEntry as A, type BackgroundDelegation as B, type ContextWindowOptions as C, type DelegationResult as D, type CompiledContextWindow as E, ContextualTool as F, DEFAULT_MAX_ITERATIONS as G, type HitlDecision as H, type DefinitionOrThunk as I, type DelegateFn as J, type DelegateOptions as K, type LoopStrategy as L, DelegationBudgetExceededError as M, DelegationError as N, type DelegationPort as O, type DelegationTarget as P, DelegationTimeoutError as Q, type ReflectionStrategy as R, type StreamEvent as S, type DoneEvent as T, type EphemeralAgent as U, type ErrorEvent as V, type FileEditEvent as W, type IterationEvent as X, type LLMCallContext as Y, type LoopFinishReason as Z, type LoopOutcome as _, type RoundStreamFactory as a, resolveMcpServers as a$, type McpApprovalSpec as a0, McpFileError as a1, type McpRegistryConfig as a2, type McpRequestContext as a3, type McpSelection as a4, type PartialToolCallEvent as a5, type ProcessInputContext as a6, type ReflectionContext as a7, type ReflectionResult as a8, type ReflectionStrategyConfig as a9, createThinkTagExtractor as aA, createToolHooksPlugin as aB, delegate as aC, delegateBackground as aD, delegateWithScoring as aE, extractThinkTagStream as aF, generateAgentManifest as aG, generateAgentRoutes as aH, isAgentContext as aI, isApprovalRequired as aJ, isDone as aK, isError as aL, isPartialToolCall as aM, isTextDelta as aN, isToolCall as aO, isToolResult as aP, ladderReflectionStrategy as aQ, loadMcpJson as aR, loopStrategyConfigSchema as aS, mcpRegistry as aT, mcpToolApprovals as aU, noopReflectionStrategy as aV, presentUIMessageStream as aW, projectContextMetadataOnlyKnobs as aX, reasoningEffortOf as aY, reflectionStrategyConfigSchema as aZ, resolveLoopStrategy as a_, type RunStartedEvent as aa, type ScoreVerdict as ab, type ScoredDelegation as ac, type Scorer as ad, type SdkAgentHandle as ae, type SdkMessage as af, type SdkSendOptions as ag, type SdkTurnHandle as ah, type Segment as ai, type StateUpdateEvent as aj, type TextDeltaEvent as ak, type ThinkingEvent as al, type ToolCallEvent as am, type ToolCallVeto as an, type ToolHooks as ao, type ToolHooksPlugin as ap, type ToolResultEvent as aq, agentsPlugin as ar, buildModelSelection as as, compileAgentModule as at, compileContextWindow as au, compileProjectContext as av, compileSkills as aw, createAgentExecutionContext as ax, createApiErrorHandler as ay, createSdkAgentStream as az, type SkillsOptions as b, runWithApiErrorHandling as b0, streamAgentResponse as b1, toAgentFactory as b2, translateSdkEvent as b3, withClockCap as b4, withEphemeralAgent as b5, type ApprovalPosture as c, type AfterToolCallContext as d, AgentBuilder as e, AgentDefinitionError as f, type AgentExecutionContext as g, type AgentManifest as h, type AgentManifestSource as i, type AgentManifestTool as j, type AgentRoute as k, type AgentRouteContext as l, type AgentRunInfo as m, type AgentStreamEvent as n, type AgentTurnMetadata as o, type AgentsPluginOptions as p, type ApiErrorContext as q, type ApiErrorDecision as r, streamAgentUIMessages as s, type ApiErrorPolicy as t, type ApprovalRequiredEvent as u, type ArtifactChunkEvent as v, type ArtifactStartEvent as w, type BeforeToolCallContext as x, BudgetExceededError as y, type CheckpointSavedEvent as z };
1597
+ export { type StateUpdateEvent as $, type AgentManifestEntry as A, type BeforeToolCallContext as B, type ContextWindowOptions as C, type DefinitionOrThunk as D, DelegationTimeoutError as E, type DoneEvent as F, type EphemeralAgent as G, type HitlDecision as H, type ErrorEvent as I, type FileEditEvent as J, type IterationEvent as K, type LLMCallContext as L, type McpApprovalSpec as M, McpFileError as N, type McpRegistryConfig as O, type McpRequestContext as P, type McpSelection as Q, type PartialToolCallEvent as R, type SkillsOptions as S, type ProcessInputContext as T, type RunStartedEvent as U, type SdkAgentHandle as V, type SdkMessage as W, type SdkSendOptions as X, type SdkTurnHandle as Y, type Segment as Z, type ShouldAutoApproveOptions as _, type ApprovalPosture as a, type TextDeltaEvent as a0, type ThinkingEvent as a1, type ToolCallEvent as a2, type ToolCallVeto as a3, type ToolHooks as a4, type ToolHooksPlugin as a5, type ToolResultEvent as a6, WRITE_SCOPED_TOOLS as a7, agentsPlugin as a8, applyPosture as a9, reasoningEffortOf as aA, resolveMcpServers as aB, runWithApiErrorHandling as aC, shouldAutoApprove as aD, toAgentFactory as aE, translateSdkEvent as aF, withClockCap as aG, withEphemeralAgent as aH, buildModelSelection as aa, compileAgentModule as ab, compileContextWindow as ac, compileProjectContext as ad, compileSkills as ae, createAgentExecutionContext as af, createApiErrorHandler as ag, createSdkAgentStream as ah, createThinkTagExtractor as ai, createToolHooksPlugin as aj, extractThinkTagStream as ak, generateAgentManifest as al, generateAgentRoutes as am, isAgentContext as an, isApprovalRequired as ao, isDone as ap, isError as aq, isPartialToolCall as ar, isTextDelta as as, isToolCall as at, isToolResult as au, loadMcpJson as av, mcpRegistry as aw, mcpToolApprovals as ax, presentUIMessageStream as ay, projectContextMetadataOnlyKnobs as az, APPROVAL_MODES as b, type AfterToolCallContext as c, AgentBuilder as d, AgentDefinitionError as e, type AgentExecutionContext as f, type AgentManifest as g, type AgentManifestSource as h, type AgentManifestTool as i, type AgentRoute as j, type AgentRouteContext as k, type AgentRunInfo as l, type AgentStreamEvent as m, type AgentTurnMetadata as n, type AgentsPluginOptions as o, type ApiErrorContext as p, type ApiErrorDecision as q, type ApiErrorPolicy as r, streamAgentUIMessages as s, type ApprovalMode as t, type ApprovalRequiredEvent as u, type ArtifactChunkEvent as v, type ArtifactStartEvent as w, type CheckpointSavedEvent as x, type CompiledContextWindow as y, ContextualTool as z };
package/dist/bridge.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- export { d as AfterToolCallContext, e as AgentBuilder, f as AgentDefinitionError, g as AgentExecutionContext, h as AgentManifest, A as AgentManifestEntry, i as AgentManifestSource, j as AgentManifestTool, k as AgentRoute, l as AgentRouteContext, m as AgentRunInfo, n as AgentStreamEvent, o as AgentTurnMetadata, p as AgentsPluginOptions, q as ApiErrorContext, r as ApiErrorDecision, t as ApiErrorPolicy, c as ApprovalPosture, u as ApprovalRequiredEvent, v as ArtifactChunkEvent, w as ArtifactStartEvent, B as BackgroundDelegation, x as BeforeToolCallContext, y as BudgetExceededError, z as CheckpointSavedEvent, E as CompiledContextWindow, F as ContextualTool, I as DefinitionOrThunk, J as DelegateFn, K as DelegateOptions, M as DelegationBudgetExceededError, N as DelegationError, O as DelegationPort, D as DelegationResult, P as DelegationTarget, Q as DelegationTimeoutError, T as DoneEvent, U as EphemeralAgent, V as ErrorEvent, W as FileEditEvent, X as IterationEvent, Y as LLMCallContext, a0 as McpApprovalSpec, a1 as McpFileError, a2 as McpRegistryConfig, a3 as McpRequestContext, a4 as McpSelection, a5 as PartialToolCallEvent, a6 as ProcessInputContext, aa as RunStartedEvent, ab as ScoreVerdict, ac as ScoredDelegation, ad as Scorer, ae as SdkAgentHandle, af as SdkMessage, ag as SdkSendOptions, ah as SdkTurnHandle, ai as Segment, aj as StateUpdateEvent, S as StreamEvent, ak as TextDeltaEvent, al as ThinkingEvent, am as ToolCallEvent, an as ToolCallVeto, ao as ToolHooks, ap as ToolHooksPlugin, aq as ToolResultEvent, ar as agentsPlugin, as as buildModelSelection, at as compileAgentModule, au as compileContextWindow, av as compileProjectContext, aw as compileSkills, ax as createAgentExecutionContext, ay as createApiErrorHandler, az as createSdkAgentStream, aA as createThinkTagExtractor, aB as createToolHooksPlugin, aC as delegate, aD as delegateBackground, aE as delegateWithScoring, aF as extractThinkTagStream, aG as generateAgentManifest, aH as generateAgentRoutes, aI as isAgentContext, aJ as isApprovalRequired, aK as isDone, aL as isError, aM as isPartialToolCall, aN as isTextDelta, aO as isToolCall, aP as isToolResult, aR as loadMcpJson, aT as mcpRegistry, aU as mcpToolApprovals, aW as presentUIMessageStream, aX as projectContextMetadataOnlyKnobs, aY as reasoningEffortOf, a$ as resolveMcpServers, b0 as runWithApiErrorHandling, b1 as streamAgentResponse, s as streamAgentUIMessages, b2 as toAgentFactory, b3 as translateSdkEvent, b4 as withClockCap, b5 as withEphemeralAgent } from './bridge-entry-51lU7LQw.js';
2
- export { c as AGENT_BRAND, A as AgentDefinition, C as CompiledAgentOptions, a as CompiledTool, D as DefineAgentConfig, I as InferAgentInput, j as InferAgentToolNames, m as ProjectSettingsGrant, n as SettingSourceCapability, S as SettingSourcesSelection, r as ToolWalkResult, t as ToolboxWalkResult, U as UntrustedSettingSourceError, u as compileAgentDefinition, v as compileTools, w as isAgentDefinition, y as resolveSettingSources } from './define-agent-3Kuf6iKM.js';
1
+ export { b as APPROVAL_MODES, c as AfterToolCallContext, d as AgentBuilder, e as AgentDefinitionError, f as AgentExecutionContext, g as AgentManifest, A as AgentManifestEntry, h as AgentManifestSource, i as AgentManifestTool, j as AgentRoute, k as AgentRouteContext, l as AgentRunInfo, m as AgentStreamEvent, n as AgentTurnMetadata, o as AgentsPluginOptions, p as ApiErrorContext, q as ApiErrorDecision, r as ApiErrorPolicy, t as ApprovalMode, a as ApprovalPosture, u as ApprovalRequiredEvent, v as ArtifactChunkEvent, w as ArtifactStartEvent, B as BeforeToolCallContext, x as CheckpointSavedEvent, y as CompiledContextWindow, z as ContextualTool, D as DefinitionOrThunk, E as DelegationTimeoutError, F as DoneEvent, G as EphemeralAgent, I as ErrorEvent, J as FileEditEvent, K as IterationEvent, L as LLMCallContext, M as McpApprovalSpec, N as McpFileError, O as McpRegistryConfig, P as McpRequestContext, Q as McpSelection, R as PartialToolCallEvent, T as ProcessInputContext, U as RunStartedEvent, V as SdkAgentHandle, W as SdkMessage, X as SdkSendOptions, Y as SdkTurnHandle, Z as Segment, _ as ShouldAutoApproveOptions, $ as StateUpdateEvent, a0 as TextDeltaEvent, a1 as ThinkingEvent, a2 as ToolCallEvent, a3 as ToolCallVeto, a4 as ToolHooks, a5 as ToolHooksPlugin, a6 as ToolResultEvent, a7 as WRITE_SCOPED_TOOLS, a8 as agentsPlugin, a9 as applyPosture, aa as buildModelSelection, ab as compileAgentModule, ac as compileContextWindow, ad as compileProjectContext, ae as compileSkills, af as createAgentExecutionContext, ag as createApiErrorHandler, ah as createSdkAgentStream, ai as createThinkTagExtractor, aj as createToolHooksPlugin, ak as extractThinkTagStream, al as generateAgentManifest, am as generateAgentRoutes, an as isAgentContext, ao as isApprovalRequired, ap as isDone, aq as isError, ar as isPartialToolCall, as as isTextDelta, at as isToolCall, au as isToolResult, av as loadMcpJson, aw as mcpRegistry, ax as mcpToolApprovals, ay as presentUIMessageStream, az as projectContextMetadataOnlyKnobs, aA as reasoningEffortOf, aB as resolveMcpServers, aC as runWithApiErrorHandling, aD as shouldAutoApprove, s as streamAgentUIMessages, aE as toAgentFactory, aF as translateSdkEvent, aG as withClockCap, aH as withEphemeralAgent } from './bridge-entry-emr2PSXC.js';
2
+ export { C as CompiledAgentOptions, b as CompiledTool, l as ToolWalkResult, n as ToolboxWalkResult, o as compileTools } from './agent-compiler-CIPQkehU.js';
3
+ export { B as BackgroundDelegation, d as BudgetExceededError, f as DelegateFn, a as DelegateOptions, g as DelegationBudgetExceededError, h as DelegationError, i as DelegationPort, c as DelegationResult, D as DelegationTarget, p as ScoreVerdict, q as ScoredDelegation, r as Scorer, S as StreamEvent, s as delegate, t as delegateBackground, u as delegateWithScoring, A as streamAgentResponse } from './delegation-scoring-CDvtrYKd.js';
4
+ export { a as AGENT_BRAND, A as AgentDefinition, D as DefineAgentConfig, I as InferAgentInput, b as InferAgentToolNames, P as ProjectSettingsGrant, c as SettingSourceCapability, S as SettingSourcesSelection, U as UntrustedSettingSourceError, d as compileAgentDefinition, i as isAgentDefinition, r as resolveSettingSources } from './define-agent-BO5QSjV8.js';
3
5
  import '@theokit/http';
4
6
  import '@theokit/sdk';
5
7
  import '@theokit/sdk/sandbox';