@theokit/agents 15.1.1 → 16.1.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/README.md +48 -1
  3. package/dist/a2a.d.ts +37 -0
  4. package/dist/a2a.js +90 -0
  5. package/dist/a2a.js.map +1 -0
  6. package/dist/{agent-compiler-DMQcLHIs.d.ts → agent-compiler-JSYkHpa7.d.ts} +2 -2
  7. package/dist/agent-orchestrator-BFWg2URC.d.ts +449 -0
  8. package/dist/agent-runner-BUJKNNuI.d.ts +364 -0
  9. package/dist/agent-sse-handler-BRp9vHrb.d.ts +348 -0
  10. package/dist/{bridge-entry-CDFRjtbb.d.ts → bridge-entry-BNWDrPzg.d.ts} +8 -422
  11. package/dist/bridge.d.ts +8 -5
  12. package/dist/bridge.js +21 -15
  13. package/dist/{chunk-RAN4PBUL.js → chunk-3TE4PJZL.js} +569 -1526
  14. package/dist/chunk-3TE4PJZL.js.map +1 -0
  15. package/dist/{chunk-ULC47RCQ.js → chunk-4SXVNI5O.js} +7 -7
  16. package/dist/{chunk-ULC47RCQ.js.map → chunk-4SXVNI5O.js.map} +1 -1
  17. package/dist/chunk-A2UVVEB3.js +799 -0
  18. package/dist/chunk-A2UVVEB3.js.map +1 -0
  19. package/dist/chunk-FBCT4B2L.js +86 -0
  20. package/dist/chunk-FBCT4B2L.js.map +1 -0
  21. package/dist/{chunk-DZH5F4PP.js → chunk-KXE52FP2.js} +12 -67
  22. package/dist/chunk-KXE52FP2.js.map +1 -0
  23. package/dist/chunk-Z5SYU6Z6.js +353 -0
  24. package/dist/chunk-Z5SYU6Z6.js.map +1 -0
  25. package/dist/client-react.js +2 -1
  26. package/dist/client-react.js.map +1 -1
  27. package/dist/client.d.ts +12 -2
  28. package/dist/client.js +5 -3
  29. package/dist/delegation-scoring-Cn5eM4lQ.d.ts +79 -0
  30. package/dist/evals.d.ts +84 -0
  31. package/dist/evals.js +191 -0
  32. package/dist/evals.js.map +1 -0
  33. package/dist/handoff.d.ts +91 -0
  34. package/dist/handoff.js +268 -0
  35. package/dist/handoff.js.map +1 -0
  36. package/dist/index.d.ts +61 -401
  37. package/dist/index.js +142 -111
  38. package/dist/index.js.map +1 -1
  39. package/dist/mcp-health.d.ts +1 -1
  40. package/dist/sdk-adapter-DQnKx7bA.d.ts +435 -0
  41. package/dist/testing.d.ts +2 -2
  42. package/dist/tools.d.ts +5 -3
  43. package/dist/tools.js +10 -6
  44. package/dist/tools.js.map +1 -1
  45. package/dist/{types-CxI2x6mU.d.ts → types-D5cHmSLi.d.ts} +10 -4
  46. package/docs/capability-map.md +44 -5
  47. package/package.json +16 -2
  48. package/dist/chunk-DZH5F4PP.js.map +0 -1
  49. package/dist/chunk-RAN4PBUL.js.map +0 -1
  50. package/dist/delegation-scoring-CSe_C-iX.d.ts +0 -809
package/dist/index.d.ts CHANGED
@@ -1,26 +1,29 @@
1
- import { PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition, BudgetTracker, CustomTool, GoalLoopAgent, GoalOptions, runGoalLoop, GoalEvent, GoalResult, InlineSkill, Agent as Agent$1, ListAgentsOptions, ListResult, SDKAgentInfo } from '@theokit/sdk';
1
+ import { GoalLoopAgent, GoalOptions, runGoalLoop, GoalEvent, GoalResult, InlineSkill, Agent as Agent$1, ListAgentsOptions, ListResult, SDKAgentInfo } from '@theokit/sdk';
2
2
  export { BudgetTracker, CustomTool, DiagnosticsSink, GenerateObjectError, GoalEvent, GoalLoopAgent, GoalOptions, GoalResult, InlineSkill, JudgeCredentialError, JudgeResult, LayerOrderError, McpAuthConfig, McpHttpServerConfig, McpOAuthConfig, McpServerConfig, McpStdioServerConfig, Plugin, PluginsSettings, Provider, ProviderRoutingSettings, RunEvent, SDKAgent, SessionRecord, SessionStore, Squad, StreamObjectError, Tool, ToolError, ToolResultContentBlock, TrustLevel, TrustPosture, TrustPostureInput, TrustSource, UngatedCapabilityError, Verdict, WiredEntity, applySecurityFloor, auditEnvReachability, foldLayers, recordWiring, resolveTrustPosture, setDiagnosticsSink, verifyLayerOrdering } from '@theokit/sdk';
3
- import { b as MainLoopMeta, R as ReasoningEffort, T as ToolOptions, A as ApprovalOptions, H as HumanInTheLoopOptions } from './types-CxI2x6mU.js';
4
- export { c as AgentOptions, B as BudgetOptions, d as MainLoopOptions, M as McpServersMap, e as PolicyHandler, f as TimeoutAction, g as ToolboxOptions } from './types-CxI2x6mU.js';
5
- import { C as ContextWindowOptions, S as SkillsOptions, A as AgentManifestEntry, H as HitlDecision, s as streamAgentUIMessages, a as ApprovalPosture, b as AgentModule } from './bridge-entry-CDFRjtbb.js';
6
- export { c as APPROVAL_MODES, d as AfterToolCallContext, e as AgentBuilder, f as AgentDefinitionError, g as AgentExecutionContext, h as AgentManifest, i as AgentManifestSource, j as AgentManifestTool, k as AgentRoute, l as AgentRouteContext, m as AgentRunInfo, n as AgentsPluginOptions, o as ApiErrorContext, p as ApiErrorDecision, q as ApiErrorPolicy, r as ApprovalMode, t as ApprovalRequest, B as BeforeToolCallContext, u as CompiledContextWindow, v as ContextualTool, D as DefinitionOrThunk, w as DelegationTimeoutError, E as EphemeralAgent, L as LLMCallContext, M as McpApprovalSpec, x as McpFileError, y as McpRegistryConfig, z as McpRequestContext, F as McpSelection, P as PermissionsPluginOptions, G as ProcessInputContext, R as RuntimeOverrides, I as SdkAgentHandle, J as SdkMessage, K as SdkSendOptions, N as SdkTurnHandle, O as Segment, Q as ShouldAutoApproveOptions, T as ToolCallVeto, U as ToolHooks, V as ToolHooksPlugin, W as WRITE_SCOPED_TOOLS, X as agentsPlugin, Y as applyPosture, Z as buildModelSelection, _ as compileAgentModule, $ as compileContextWindow, a0 as compileLoadedAgentModule, a1 as compileProjectContext, a2 as compileSkills, a3 as createAgentExecutionContext, a4 as createApiErrorHandler, a5 as createPermissionsPlugin, a6 as createSdkAgentStream, a7 as createThinkTagExtractor, a8 as createToolHooksPlugin, a9 as extractThinkTagStream, aa as generateAgentManifest, ab as generateAgentRoutes, ac as isAgentContext, ad as loadMcpJson, ae as loadPersonalMcpServers, af as mcpRegistry, ag as mcpToolApprovals, ah as projectContextMetadataOnlyKnobs, ai as reasoningEffortOf, aj as resolveMcpServers, ak as runWithApiErrorHandling, al as shouldAutoApprove, am as toAgentFactory, an as translateSdkEvent, ao as withClockCap, ap as withEphemeralAgent } from './bridge-entry-CDFRjtbb.js';
3
+ import { R as ReasoningEffort, T as ToolOptions, A as ApprovalOptions, H as HumanInTheLoopOptions } from './types-D5cHmSLi.js';
4
+ export { c as AgentOptions, B as BudgetOptions, M as MainLoopMeta, d as MainLoopOptions, a as McpServersMap, e as PolicyHandler, f as TimeoutAction, g as ToolboxOptions } from './types-D5cHmSLi.js';
5
+ import { H as HitlDecision, A as ApprovalPosture } from './sdk-adapter-DQnKx7bA.js';
6
+ export { a as ApprovalRequest, D as DefinitionOrThunk, R as RuntimeOverrides, S as SdkAgentHandle, b as SdkSendOptions, c as SdkTurnHandle, d as applyPosture, e as createSdkAgentStream, t as toAgentFactory } from './sdk-adapter-DQnKx7bA.js';
7
7
  import { TheokitAgentError } from '@theokit/sdk/errors';
8
8
  export * from '@theokit/sdk/errors';
9
9
  export { ConfigurationError, BudgetExceededError as WindowBudgetExceededError } from '@theokit/sdk/errors';
10
- import { G as Guardrail, C as CompiledAgentOptions, a as CompiledTool } from './agent-compiler-DMQcLHIs.js';
11
- export { b as AGENT_BRAND, A as AgentDefinition, c as CompatImportUnsupportedError, d as CostBudgetExceededError, D as DefineAgentConfig, e as GuardrailAction, f as GuardrailError, g as GuardrailPhase, h as GuardrailResult, i as GuardrailViolationError, H as HookApprovalGate, j as HookApprovalRequest, k as HookGateUnsupportedError, I as InferAgentInput, l as InferAgentToolNames, M as MalformedGuardrailResultError, S as SkillsRequestContext, m as SkillsSelection, T as ToolWalkResult, n as ToolboxWalkResult, U as UnreadableTextPayloadError, o as compileAgentDefinition, p as compileTools, q as isAgentDefinition, r as resolveEnabledSkills } from './agent-compiler-DMQcLHIs.js';
10
+ import { G as Guardrail, a as CompiledAgentOptions, C as CompiledTool } from './agent-compiler-JSYkHpa7.js';
11
+ export { b as AGENT_BRAND, A as AgentDefinition, c as CompatImportUnsupportedError, d as CostBudgetExceededError, D as DefineAgentConfig, e as GuardrailAction, f as GuardrailError, g as GuardrailPhase, h as GuardrailResult, i as GuardrailViolationError, H as HookApprovalGate, j as HookApprovalRequest, k as HookGateUnsupportedError, I as InferAgentInput, l as InferAgentToolNames, M as MalformedGuardrailResultError, S as SkillsRequestContext, m as SkillsSelection, T as ToolWalkResult, n as ToolboxWalkResult, U as UnreadableTextPayloadError, o as compileAgentDefinition, p as compileTools, q as isAgentDefinition, r as resolveEnabledSkills } from './agent-compiler-JSYkHpa7.js';
12
+ import { C as ContextWindowOptions, S as SkillsOptions, A as AgentManifestEntry, s as streamAgentUIMessages, a as AgentModule } from './bridge-entry-BNWDrPzg.js';
13
+ export { b as APPROVAL_MODES, c as AfterToolCallContext, d as AgentBuilder, e as AgentDefinitionError, f as AgentExecutionContext, g as AgentManifest, h as AgentManifestSource, i as AgentManifestTool, j as AgentRoute, k as AgentRouteContext, l as AgentRunInfo, m as AgentsPluginOptions, n as ApiErrorContext, o as ApiErrorDecision, p as ApiErrorPolicy, q as ApprovalMode, B as BeforeToolCallContext, r as CompiledContextWindow, t as ContextualTool, D as DelegationTimeoutError, E as EphemeralAgent, L as LLMCallContext, M as McpApprovalSpec, u as McpFileError, v as McpRegistryConfig, w as McpRequestContext, x as McpSelection, P as PermissionsPluginOptions, y as ProcessInputContext, z as SdkMessage, F as Segment, G as ShouldAutoApproveOptions, T as ToolCallVeto, H as ToolHooks, I as ToolHooksPlugin, W as WRITE_SCOPED_TOOLS, J as agentsPlugin, K as buildModelSelection, N as compileAgentModule, O as compileContextWindow, Q as compileLoadedAgentModule, R as compileProjectContext, U as compileSkills, V as createAgentExecutionContext, X as createApiErrorHandler, Y as createPermissionsPlugin, Z as createThinkTagExtractor, _ as createToolHooksPlugin, $ as extractThinkTagStream, a0 as generateAgentManifest, a1 as generateAgentRoutes, a2 as isAgentContext, a3 as loadMcpJson, a4 as loadPersonalMcpServers, a5 as mcpRegistry, a6 as mcpToolApprovals, a7 as projectContextMetadataOnlyKnobs, a8 as reasoningEffortOf, a9 as resolveMcpServers, aa as runWithApiErrorHandling, ab as shouldAutoApprove, ac as translateSdkEvent, ad as withClockCap, ae as withEphemeralAgent } from './bridge-entry-BNWDrPzg.js';
12
14
  import { S as SettingSourcesSelection } from './setting-sources-gate-BJJiKq33.js';
13
15
  export { C as CompatSurface, a as GatedCompatSource, G as GatedSettingSource, P as ProjectSettingsGrant, R as ResolvedCompatSource, b as SettingSourceCapability, U as UntrustedSettingSourceError, r as resolveCompatSources, c as resolveSettingSources } from './setting-sources-gate-BJJiKq33.js';
14
- import { L as LoopStrategy, R as ReflectionStrategy, b as RoundStreamFactory, S as StreamEvent, c as DelegationResult } from './delegation-scoring-CSe_C-iX.js';
15
- export { A as AgentStopReason, d as AgentStreamEvent, e as AgentTurnMetadata, f as ApprovalRequiredEvent, g as ArtifactChunkEvent, h as ArtifactStartEvent, B as BackgroundDelegation, i as BudgetExceededError, C as CheckpointSavedEvent, j as DEFAULT_MAX_ITERATIONS, k as DelegateFn, a as DelegateOptions, l as DelegationBudgetExceededError, m as DelegationError, n as DelegationPort, D as DelegationTarget, o as DoneEvent, E as ErrorEvent, F as FileEditEvent, I as IterationEvent, p as LoopFinishReason, q as LoopOutcome, r as LoopStrategyConfig, P as PartialToolCallEvent, s as ReflectionContext, t as ReflectionResult, u as ReflectionStrategyConfig, v as RunStartedEvent, w as ScoreVerdict, x as ScoredDelegation, y as Scorer, z as StateUpdateEvent, T as TextDeltaEvent, G as ThinkingEvent, H as ToolCallEvent, J as ToolResultEvent, K as delegate, M as delegateBackground, N as delegateWithScoring, O as isApprovalRequired, Q as isDone, U as isError, V as isPartialToolCall, W as isTextDelta, X as isToolCall, Y as isToolResult, Z as ladderReflectionStrategy, _ as loopStrategyConfigSchema, $ as noopReflectionStrategy, a0 as presentUIMessageStream, a1 as reflectionStrategyConfigSchema, a2 as resolveLoopStrategy, a3 as streamAgentResponse } from './delegation-scoring-CSe_C-iX.js';
16
- import { RetryOptions } from '@theokit/sdk/retry';
17
- export * from '@theokit/sdk/retry';
18
- export { RetryOptions } from '@theokit/sdk/retry';
16
+ export { a as AgentStopReason, b as AgentStreamEvent, c as AgentTurnMetadata, A as ApprovalRequiredEvent, d as ArtifactChunkEvent, e as ArtifactStartEvent, C as CheckpointSavedEvent, D as DoneEvent, E as ErrorEvent, F as FileEditEvent, I as IterationEvent, P as PartialToolCallEvent, R as RunStartedEvent, f as StateUpdateEvent, S as StreamEvent, T as TextDeltaEvent, g as ThinkingEvent, h as ToolCallEvent, i as ToolResultEvent, j as isApprovalRequired, k as isDone, l as isError, m as isPartialToolCall, n as isTextDelta, o as isToolCall, p as isToolResult, q as presentUIMessageStream, s as streamAgentResponse } from './agent-sse-handler-BRp9vHrb.js';
17
+ export { B as BudgetExceededError, c as DEFAULT_MAX_ITERATIONS, a as DelegateOptions, d as DelegationBudgetCostUnknownError, e as DelegationBudgetExceededError, f as DelegationError, D as DelegationResult, g as LoopFinishReason, h as LoopOutcome, L as LoopStrategy, i as LoopStrategyConfig, j as ReflectionContext, k as ReflectionResult, b as ReflectionStrategy, l as ReflectionStrategyConfig, R as RoundStreamFactory, m as delegate, n as ladderReflectionStrategy, o as loopStrategyConfigSchema, p as noopReflectionStrategy, r as reflectionStrategyConfigSchema, q as resolveLoopStrategy } from './agent-orchestrator-BFWg2URC.js';
18
+ export { B as BackgroundDelegation, a as DelegateFn, b as DelegationPort, D as DelegationTarget, S as ScoreVerdict, c as ScoredDelegation, d as Scorer, e as delegateBackground, f as delegateWithScoring } from './delegation-scoring-Cn5eM4lQ.js';
19
+ import { T as TranscriptCompactionStrategy } from './agent-runner-BUJKNNuI.js';
20
+ export { a as AgentRunner, b as AgentRunnerBuilder, A as AgentRunnerRunOptions, C as CompactionCallOptions, c as CompactionStrategyConfig, D as DEFAULT_KEEP_TOKENS, S as Summarize, d as compactionStrategyConfigSchema, r as resolveCompactionStrategy, t as tokenBudgetCompactionStrategy } from './agent-runner-BUJKNNuI.js';
19
21
  import { CompressibleMessage } from '@theokit/sdk/compaction';
20
22
  export { CONTEXT_WINDOW_FLOOR, CONTEXT_WINDOW_MARGIN, CompressibleMessage, ContextWindowMarginError, ContextWindowSource, EffectiveContextWindow, resolveEffectiveContextWindow } from '@theokit/sdk/compaction';
21
- import { z } from 'zod';
22
23
  export { SubAgent } from '@theokit/sdk/a2a';
23
24
  export { assertNoSymlinkEscape, isForbiddenPath, safePathJoin } from '@theokit/sdk/path-safety';
25
+ export * from '@theokit/sdk/retry';
26
+ export { RetryOptions } from '@theokit/sdk/retry';
24
27
  export * from '@theokit/sdk/concurrency';
25
28
  export * from '@theokit/sdk/messages';
26
29
  export * from '@theokit/sdk/models';
@@ -30,8 +33,9 @@ export { H as HookHandlers } from './hook-handlers-Cw2FsnE5.js';
30
33
  import { WireChunk } from '@theokit/presenter/wire';
31
34
  export { WireChunk, WireDataPart } from '@theokit/presenter/wire';
32
35
  export { ContentChunk, LifecycleItem, LifecycleVocabulary, TurnLifecycle, TurnOutcome, foldTurnLifecycle } from '@theokit/presenter';
33
- import '@theokit/http';
36
+ import 'zod';
34
37
  import '@theokit/sdk/sandbox';
38
+ import '@theokit/http';
35
39
 
36
40
  /**
37
41
  * M9 (theokit-ai-first) — built-in guardrail detectors.
@@ -206,352 +210,6 @@ declare function textPayloadExtractor<E extends {
206
210
  type?: unknown;
207
211
  }>(kind: string, read: (event: E) => unknown): (event: E) => string | undefined;
208
212
 
209
- /**
210
- * TranscriptCompactionStrategy — a named, callable transcript-compaction authoring layer
211
- * (Strategy pattern, V4-F). Mirrors `ReflectionStrategy`/`LoopStrategy`: interface
212
- * + zod config schema + a `'token-budget'` default + `resolveCompactionStrategy`.
213
- *
214
- * The `'token-budget'` strategy DELEGATES to the SDK's `compactTranscript` (ADR D2 /
215
- * G2 / sdk-runtime.md — the SDK owns the algorithm; agents owns the named interface;
216
- * no reimplementation). Per ADR D1 it is CALLABLE by the app (exposed as
217
- * `AgentRunner.compaction`), NOT auto-invoked by the reflective loop — the SDK owns
218
- * per-turn context, so the app decides WHEN to compact and supplies the `summarize`
219
- * callback (its own LLM). EC-6: consumers whose transcript rows carry roles outside
220
- * the SDK's `CompressibleMessage` union (e.g. `'tool'`) cast at the call site, exactly
221
- * as the SDK's own type contract requires.
222
- */
223
-
224
- /** Token budget mirrored from theocode's proven `DEFAULT_KEEP_TOKENS` (server/lib/compaction.ts). */
225
- declare const DEFAULT_KEEP_TOKENS = 8000;
226
- /**
227
- * App-supplied summarizer: collapse the older window into one turn (the app's LLM).
228
- * Signature matches the SDK `compactTranscript` contract — receives the older window
229
- * AND the (optionally overridden) summary template.
230
- */
231
- type Summarize = (older: CompressibleMessage[], template: string) => Promise<CompressibleMessage>;
232
- /**
233
- * Per-call options for {@link TranscriptCompactionStrategy.compact} — a faithful
234
- * pass-through of the SDK `CompactTranscriptOptions` knobs the app controls. Defaults
235
- * are the SDK's, EXCEPT `failSafe` which defaults `true` here: a thrown `summarize`
236
- * returns the ORIGINAL transcript + a structured warn instead of losing it — compaction
237
- * is an optimization, never a cause of data loss (error-handling discipline). The app
238
- * passes `failSafe: false` to opt into fail-fast propagation.
239
- */
240
- interface CompactionCallOptions {
241
- /** Override the strategy's configured `keepTokens` for this call. */
242
- readonly keepTokens?: number;
243
- /** Summarize the older window; if omitted, the SDK drops it (its documented contract). */
244
- readonly summarize?: Summarize;
245
- /** Checkpoint marker (SDK default when omitted). */
246
- readonly marker?: string;
247
- /** Summary template passed to `summarize` (SDK default when omitted). */
248
- readonly summaryTemplate?: string;
249
- /** When true (DEFAULT here), a thrown `summarize` returns the original transcript + a warn. */
250
- readonly failSafe?: boolean;
251
- }
252
- /** A named, callable compaction strategy. Pure of I/O except the delegated SDK call. */
253
- interface TranscriptCompactionStrategy {
254
- /** Strategy identifier (e.g. `'token-budget'`). */
255
- readonly name: string;
256
- /** The configured token budget (from `@Compaction` / `.compaction()` / default). */
257
- readonly keepTokens: number;
258
- /**
259
- * Compact `messages` to the (optionally overridden) token budget via the SDK's
260
- * `compactTranscript`. Returns the compacted transcript; never mutates the input.
261
- */
262
- compact(messages: CompressibleMessage[], options?: CompactionCallOptions): Promise<CompressibleMessage[]>;
263
- }
264
- /**
265
- * Serializable config for a TranscriptCompactionStrategy (SSoT per type-safety.md / G3).
266
- * `keepTokens` is REQUIRED for `'token-budget'` (EC-2 / G10 — no silent degradation
267
- * to the SDK's turn-count `keepRecent` default; the strategy is named for token budget).
268
- */
269
- declare const compactionStrategyConfigSchema: z.ZodObject<{
270
- name: z.ZodLiteral<"token-budget">;
271
- keepTokens: z.ZodNumber;
272
- }, z.core.$strip>;
273
- type CompactionStrategyConfig = z.infer<typeof compactionStrategyConfigSchema>;
274
- /**
275
- * Resolve a `@Compaction` / `.compaction()` declaration to a concrete strategy.
276
- * Throws (Zod) on an unknown name or a missing/invalid `keepTokens` (EC-2/EC-5 —
277
- * fail-fast, mirrors `resolveLoopStrategy`). The returned strategy's `compact`
278
- * delegates to `compactTranscript`, defaulting `keepTokens` to the configured value.
279
- */
280
- declare function resolveCompactionStrategy(name: string, config: {
281
- keepTokens?: number;
282
- }): TranscriptCompactionStrategy;
283
- /**
284
- * The default `'token-budget'` strategy (what `@Compaction('token-budget')` without
285
- * an explicit budget resolves to). Carries {@link DEFAULT_KEEP_TOKENS}; the app may
286
- * override per call via `compact(messages, { keepTokens })`.
287
- */
288
- declare const tokenBudgetCompactionStrategy: TranscriptCompactionStrategy;
289
-
290
- /**
291
- * AgentRunner — the imperative twin of `@MainLoop` (plan ADR D4, V4-B).
292
- *
293
- * `AgentRunner.fromSpec(spec).reflection().stream().build()` resolves the loop strategy from
294
- * an already-compiled spec (the capability-authored agent). `delegate()` shares the same runtime.
295
- * `build()` is the compile boundary (no I/O, no IoC — standalone, mirrors
296
- * Spring's `ChatClient.builder(...).build()`); `stream()`/`run()` do the I/O via
297
- * `runReflectiveLoopStream` (the SAME loop `delegate()` drains — DRY, ADR 0031).
298
- * V4-D-stream: `stream()` yields events live (SSE-first); `run()` drains it to a result.
299
- */
300
-
301
- /**
302
- * Resolves the credential at the start of the stream, instead of demanding the value ready before the call.
303
- *
304
- * M74 — the credential injection point was ALREADY per run; what blocked it was the type. With a
305
- * `string`, the caller must hold the value beforehand, so the *moment* is per run but the *value* is
306
- * frozen earlier — and a short-lived OAuth bearer crosses the whole run without being re-fetched. It
307
- * was the structural cause of a silent turn in production.
308
- */
309
- type CredentialResolver = () => string | Promise<string>;
310
- /** Options for {@link AgentRunner.run}. */
311
- interface AgentRunnerRunOptions {
312
- /**
313
- * The LLM API key, or a resolver called when the stream starts.
314
- *
315
- * `string` remains valid and is the path for anyone holding an API key — it does not expire, and
316
- * demanding a resolver there would be ceremony with no gain. The resolver exists for credentials
317
- * that EXPIRE.
318
- */
319
- readonly apiKey: string | CredentialResolver;
320
- /** Session id override (default: a fresh isolated id). */
321
- readonly sessionId?: string;
322
- /** Cumulative USD budget across rounds. */
323
- readonly budget?: number;
324
- /** Cancellation — aborts stop the reflective loop from re-entering. */
325
- readonly signal?: AbortSignal;
326
- /**
327
- * V4-J: per-run tool override. When provided, REPLACES the build-time
328
- * `compiled.tools` for this call only (e.g. a consumer that selects tools by
329
- * request mode/permission). Absent ⇒ the agent's compiled tools (unchanged).
330
- */
331
- readonly tools?: readonly CompiledTool[];
332
- /**
333
- * V4-L.2 (Axis-A SWAP): per-run model override. Merge-over-compiled —
334
- * `opts.model ?? compiled.model ?? default`. Absent ⇒ the compiled model.
335
- */
336
- readonly model?: string;
337
- /**
338
- * M1 (Axis-A SWAP): per-run extended-thinking effort. Merge-over-compiled —
339
- * `opts.reasoningEffort ?? compiled.reasoningEffort` (resolved in the adapter, single site).
340
- * Mapped to the SDK `ModelSelection.params` so the provider reasons (surfaced as `thinking`
341
- * StreamEvents). Absent ⇒ the compiled reasoning effort (or none).
342
- */
343
- readonly reasoningEffort?: ReasoningEffort;
344
- /**
345
- * M2 (Axis-A SWAP): per-run opt-in to convert inline `<think>…</think>` text into `thinking`
346
- * events. Merge-over-compiled (`opts.parseThinkTags ?? compiled.parseThinkTags ?? false`). For
347
- * models that emit reasoning as inline tags (qwen/deepseek) instead of a native reasoning param.
348
- */
349
- readonly parseThinkTags?: boolean;
350
- /**
351
- * theocode#32 (Axis-A SWAP): per-run opt-in to strip a leaked Hermes `<function=…></tool_call>`
352
- * tool-call dialect out of the text stream. Merge-over-compiled
353
- * (`opts.stripToolDialect ?? compiled.stripToolDialect ?? false`). For models (qwen/qwen3-coder)
354
- * that leak tool calls as text instead of native `tool_calls`.
355
- */
356
- readonly stripToolDialect?: boolean;
357
- /**
358
- * theokit#58 (Axis-A SWAP): per-run opt-in to RECOVER a leaked Hermes `<function=…></tool_call>`
359
- * tool-call dialect so the call EXECUTES (enables the SDK route's `extractToolCallsFromContent`).
360
- * Merge-over-compiled (`opts.recoverLeakedToolCalls ?? compiled.recoverLeakedToolCalls ?? false`).
361
- * Sibling of {@link stripToolDialect} (display-only); typically enabled together. Has effect only
362
- * when {@link providers} routes a provider.
363
- */
364
- readonly recoverLeakedToolCalls?: boolean;
365
- /**
366
- * V4-L.2 (Axis-A SWAP): per-run working directory, forwarded into
367
- * `Agent.create({ local: { cwd } })` so the SDK populates `SystemPromptContext.cwd`
368
- * (read by a `SystemPromptResolver` / `@ProjectContext`). Absent ⇒ no `local.cwd`.
369
- */
370
- readonly cwd?: string;
371
- /**
372
- * SDK 4.0 (SE40): per-run root of the native `.jsonl` session transcript, forwarded into
373
- * `Agent.create({ local: { baseDir } })`. Absent ⇒ the SDK default (`~/.theokit`).
374
- */
375
- readonly baseDir?: string;
376
- /**
377
- * V4-L.2 (Axis-A SWAP): per-run loop-ceiling override. When provided, the loop
378
- * strategy is re-resolved with this ceiling for this call only (zod-validated —
379
- * `< 1` throws, never a silent unbounded loop). Absent ⇒ the build-time ceiling.
380
- */
381
- readonly maxIterations?: number;
382
- /**
383
- * V4-L.3 (Axis-A SWAP): per-run plugins (e.g. permission gate by request mode).
384
- * Accepts EITHER named-plugin discovery settings (`{ enabled: [...] }`) OR an
385
- * array of code `Plugin` objects (`[permissionPlugin, cachePlugin]`). Both are
386
- * forwarded RAW through the duck-typed `Agent.create` bridge to the SDK runtime,
387
- * which accepts either form (mirrors the @theokit/sdk `AgentOptions.plugins` widen).
388
- */
389
- readonly plugins?: PluginsSettings | readonly Plugin[];
390
- /** V4-L.3 (Axis-A SWAP): per-run provider routing. */
391
- readonly providers?: ProviderRoutingSettings;
392
- /** V4-L.3 (Axis-A SWAP): per-run sub-agent definitions (opts-only; @SubAgents stays deferred). */
393
- readonly agents?: Record<string, AgentDefinition>;
394
- /**
395
- * V4-L.3 (Axis-A SWAP): per-run SDK budget tracker — caps the INNER SDK tool-loop per
396
- * send. Distinct from {@link AgentRunnerRunOptions.budget} (the OUTER reflective-loop USD ceiling).
397
- */
398
- readonly budgetTracker?: BudgetTracker;
399
- /**
400
- * V4-Q: pre-built SDK `CustomTool[]` forwarded RAW to `Agent.create.tools` (appended after the
401
- * agent's compiled tools), bypassing `defineTool`. For an app whose tools come from imperative
402
- * SDK factories (no `@Tool` compile path / no recoverable Zod schema). Distinct from `tools`
403
- * (which REPLACES the compiled `CompiledTool[]`).
404
- */
405
- readonly sdkTools?: readonly CustomTool[];
406
- /**
407
- * V4-R: inject the per-round stream factory, driving the reflective loop with a caller-provided
408
- * stream INSTEAD of the SDK adapter (tests / custom transport). When set, the SDK-create options
409
- * (`tools`/`sdkTools`/`model`/`cwd`/`plugins`/...) are NOT used for this call — the consumer owns
410
- * the stream. Absent ⇒ `createSdkAgentStream` (the default runtime).
411
- */
412
- readonly streamFactory?: RoundStreamFactory;
413
- /**
414
- * V4-P: per-round transient retry. When set, the START of each reflective round (factory
415
- * creation + first event, before any event is yielded) is wrapped in the SDK `withRetry` —
416
- * a 429/5xx/network blip is recovered without re-applying an edit. Absent ⇒ single attempt.
417
- * Default `isRetryable` is the SDK `isTransientError`.
418
- */
419
- readonly retry?: RetryOptions;
420
- }
421
- /**
422
- * A built, runnable agent. Construct via {@link AgentRunner.fromSpec} — the
423
- * constructor takes already-resolved state and is an internal detail.
424
- */
425
- /** Already-resolved state handed to the {@link AgentRunner} constructor (internal). */
426
- interface AgentRunnerState {
427
- readonly compiled: CompiledAgentOptions;
428
- readonly agentName: string;
429
- /** The resolved terminal-decision strategy (parity with `delegate()`). */
430
- readonly loopStrategy: LoopStrategy;
431
- /**
432
- * M54 — true when `loopStrategy` came from `.loopStrategy(custom)` rather than a built-in name.
433
- * A custom must NOT be re-resolved by name (its name is outside the `z.enum`); a per-run
434
- * `maxIterations` override applies to it as a runner ceiling instead (see `stream`). Optional and
435
- * defaults to `false`: a state built directly (tests, `delegate()`) is a by-name built-in.
436
- */
437
- readonly loopStrategyIsCustom?: boolean;
438
- /** The resolved between-round reflection (default or `.reflection(custom)` override). */
439
- readonly reflectionStrategy: ReflectionStrategy;
440
- /** Recorded streaming preference (see {@link AgentRunner.streamEnabled}). */
441
- readonly streamEnabled: boolean;
442
- /** The resolved compaction strategy, or `undefined` when none is declared (EC-4). */
443
- readonly compaction?: TranscriptCompactionStrategy;
444
- }
445
- declare class AgentRunner {
446
- private readonly compiled;
447
- private readonly agentName;
448
- /** The resolved terminal-decision strategy (parity with `delegate()`). */
449
- readonly loopStrategy: LoopStrategy;
450
- /** M54 — whether {@link loopStrategy} is a caller-injected custom (see {@link AgentRunnerState}). */
451
- private readonly loopStrategyIsCustom;
452
- /** The resolved between-round reflection (default or `.reflection(custom)` override). */
453
- readonly reflectionStrategy: ReflectionStrategy;
454
- /**
455
- * Recorded streaming preference. The reflective loop currently always streams via
456
- * the SDK `Run.stream()`; a non-streaming collect mode is future work — the flag is
457
- * captured + exposed here, not yet branched on (honest per G10: documented, not a
458
- * silent no-op).
459
- */
460
- readonly streamEnabled: boolean;
461
- /**
462
- * V4-F: the resolved compaction strategy (from `@Compaction` or `.compaction()`),
463
- * or `undefined` when neither is declared — compaction is opt-in (EC-4). CALLABLE
464
- * by the app (ADR D1: `runner.compaction?.compact(messages, { summarize })`); the
465
- * reflective loop does NOT auto-invoke it (the SDK owns per-turn context).
466
- */
467
- readonly compaction?: TranscriptCompactionStrategy;
468
- constructor(state: AgentRunnerState);
469
- /** Start a fluent builder from an already-compiled spec. */
470
- static fromSpec(spec: AgentRunnerSpec): AgentRunnerBuilder;
471
- /**
472
- * V4-D-stream: stream the agent's events LIVE across the reflective loop, returning
473
- * the aggregated {@link DelegationResult} as the generator's return value. This is the
474
- * on-ramp for streaming-first apps (SSE) — `runReflectiveLoopStream` yields every
475
- * round's events before the loop terminates. `streamEnabled` is honored: when the
476
- * builder set `.stream(false)`, callers should use {@link run} instead.
477
- */
478
- stream(message: string, opts: AgentRunnerRunOptions): AsyncGenerator<StreamEvent, DelegationResult>;
479
- /** The core stream path, after input guardrails have run (M9). */
480
- private streamUnguarded;
481
- /** Run the agent to a terminal result via the shared reflective loop (collect mode). */
482
- /**
483
- * Apply a per-call `maxIterations` override (M54 D4). A custom strategy must NOT be re-resolved by
484
- * name — its name is outside the `z.enum`, which would throw — and its `shouldContinue` closure
485
- * must survive; since the runner enforces the ceiling via `round < loop.maxIterations` (T1.1),
486
- * overriding just that field bounds a custom without touching its logic. A built-in keeps the
487
- * by-name re-resolution (zod fail-loud on `< 1`) — unchanged, zero-behavior.
488
- */
489
- private resolvePerRunLoop;
490
- run(message: string, opts: AgentRunnerRunOptions): Promise<DelegationResult>;
491
- }
492
- /**
493
- * M53 — what the runner actually needs in order to run: an already-compiled agent plus the two
494
- * loop knobs. It used to derive all of this from `walkAgentMetadata`, which chained the runner to
495
- * the decorator surface. `strategy` and `compaction` are the two non-waist channels ADR 0002 keeps
496
- * (the builder's `.compaction()` already outranked the decorator; this just names the input).
497
- */
498
- /**
499
- * The already-compiled agent the runner executes. Field-compatible with `SubAgentSpec` on purpose —
500
- * one spec drives both `AgentRunner.fromSpec` and `delegate`.
501
- */
502
- interface AgentRunnerSpec {
503
- readonly name: string;
504
- readonly compiled: CompiledAgentOptions;
505
- readonly strategy?: MainLoopMeta['strategy'];
506
- readonly maxIterations?: number;
507
- readonly compaction?: {
508
- name: string;
509
- keepTokens?: number;
510
- };
511
- }
512
- /** Fluent builder — accumulates config; `build()` is the compile boundary. */
513
- declare class AgentRunnerBuilder {
514
- private readonly spec;
515
- private reflectionOverride?;
516
- private streamEnabled;
517
- private compactionOverride?;
518
- private loopStrategyOverride?;
519
- constructor(spec: AgentRunnerSpec);
520
- /** Override the default reflection strategy (OCP — plan Drawback #2). No arg ⇒ keep default. */
521
- reflection(strategy?: ReflectionStrategy): this;
522
- /**
523
- * M54 — inject a custom terminal-decision strategy (the fourth OCP axis, alongside
524
- * `.reflection()`/`.compaction()`/`streamFactory`). WINS over the strategy the spec's name would
525
- * resolve to, exactly as `.compaction()` outranks the spec. The runner caps ANY strategy at
526
- * `custom.maxIterations` (T1.1), so a `shouldContinue: () => true` still terminates — never an
527
- * infinite loop.
528
- *
529
- * @example
530
- * ```ts
531
- * // Stop as soon as the confidence in the last round crosses 0.9, else run to the ceiling.
532
- * const stopWhenConfident: LoopStrategy = {
533
- * name: 'confident',
534
- * maxIterations: 8,
535
- * shouldContinue: (o) => !o.responseText.includes('confidence: high'),
536
- * }
537
- * AgentRunner.fromSpec(spec).loopStrategy(stopWhenConfident).build()
538
- * ```
539
- */
540
- loopStrategy(custom: LoopStrategy): this;
541
- /** Record the streaming preference (see {@link AgentRunner.streamEnabled}). */
542
- stream(enabled?: boolean): this;
543
- /**
544
- * V4-F: declare the compaction strategy (e.g. `.compaction('token-budget', { keepTokens: 8000 })`).
545
- * Resolved + validated at {@link build} (EC-5 — fail-fast there, not here). This builder
546
- * call WINS over a `@Compaction` decorator on the same agent (EC-1 — explicit override).
547
- */
548
- compaction(name: string, options?: {
549
- keepTokens?: number;
550
- }): this;
551
- /** Resolve strategies from the spec — the compile→execute boundary (no I/O). */
552
- build(): AgentRunner;
553
- }
554
-
555
213
  /**
556
214
  * M59 — `GoalRunner`, the OO twin of the SDK's free `runGoalLoop`, parallel to {@link AgentRunner}.
557
215
  *
@@ -1377,45 +1035,6 @@ declare function buildMcpToolDescriptors(entry: AgentManifestEntry): McpToolDesc
1377
1035
  /** Build the MCP `initialize` server-info block for an agent. */
1378
1036
  declare function mcpServerInfo(entry: AgentManifestEntry): McpServerInfo;
1379
1037
 
1380
- /**
1381
- * M15 (theokit-ai-first) — A2A client: call a remote A2A agent as a tool (ADR-0040 § D2).
1382
- *
1383
- * `createA2ATool` returns a `CustomTool` whose handler POSTs the input message to a remote agent's
1384
- * HTTP endpoint and returns its text response — cross-network delegation. Uses `fetch` (Web
1385
- * Standards, G8). The target is a remote AGENT endpoint, not an LLM provider, so the G2 grep guard
1386
- * (`openrouter.ai|api.openai.com|api.anthropic.com`) is unaffected. `fetchImpl` is injectable for tests.
1387
- */
1388
-
1389
- /** How to authenticate to the remote agent. */
1390
- interface A2AAuth {
1391
- /** Bearer token → `Authorization: Bearer <token>`. */
1392
- bearer?: string;
1393
- /** API-key header pair → `<name>: <value>` (e.g. `x-api-key`). */
1394
- apiKey?: {
1395
- header: string;
1396
- value: string;
1397
- };
1398
- }
1399
- interface A2AToolConfig {
1400
- /** Remote agent endpoint URL (POST target). */
1401
- url: string;
1402
- /** Tool name the model calls. */
1403
- name: string;
1404
- /** Tool description surfaced to the model. */
1405
- description: string;
1406
- /** Static headers merged into every request. */
1407
- headers?: Record<string, string>;
1408
- /** Auth applied to every request. */
1409
- auth?: A2AAuth;
1410
- /** Injected fetch (defaults to the global). Narrowed to the call shape this client uses. */
1411
- fetchImpl?: (url: string, init: RequestInit) => Promise<Response>;
1412
- }
1413
- /**
1414
- * Create a tool that delegates to a remote A2A agent. The remote is expected to answer a
1415
- * `{ message }` POST with a JSON body carrying a `response` (or `text`) string.
1416
- */
1417
- declare function createA2ATool(config: A2AToolConfig): CustomTool;
1418
-
1419
1038
  /**
1420
1039
  * M11 (theokit-ai-first) — {resource, thread} conversation scoping (ADR-0040 § D2, home concern).
1421
1040
  *
@@ -1463,27 +1082,68 @@ declare class AcpMessageDecoder {
1463
1082
  push(chunk: string): unknown[];
1464
1083
  }
1465
1084
 
1085
+ /**
1086
+ * M17 (theokit-ai-first) — ACP client: JSON-RPC over the stdio framing.
1087
+ *
1088
+ * Drives a coding agent (Claude Code, Amp, Codex) over an INJECTED {@link AcpTransport}. The
1089
+ * subprocess spawn is a Node API and lives in the adapter layer (G8); this client is transport-
1090
+ * agnostic and testable. It correlates responses to requests by `id`, dispatches server→client
1091
+ * requests (e.g. `session/request_permission`) to a registered handler, replying with its decision,
1092
+ * and delivers notifications (a `method` with no `id`, e.g. `session/update`) to their handler.
1093
+ */
1094
+
1466
1095
  /** The stdio channel to the coding-agent subprocess (abstracted for testability + G8). */
1467
1096
  interface AcpTransport {
1468
1097
  /** Write one already-encoded (newline-terminated) line to the agent's stdin. */
1469
1098
  send(line: string): void;
1470
1099
  /** Subscribe to raw lines/chunks from the agent's stdout. */
1471
1100
  subscribe(onData: (chunk: string) => void): void;
1101
+ /**
1102
+ * Report a channel that closed on its own (the process exited or failed). Optional: a transport
1103
+ * that has it lets the client reject the requests no reply will ever answer.
1104
+ */
1105
+ onClose?(listener: (cause: Error) => void): void;
1106
+ }
1107
+ /**
1108
+ * The agent wrote a stdout line that does not decode to a JSON-RPC message: it is not JSON, it is
1109
+ * JSON but not an object (`null`, a number, a string, an array), or it is an object that is not a
1110
+ * response, a request or a notification. `line` is the line, trimmed. Code `ACP_PROTOCOL_ERROR`.
1111
+ */
1112
+ declare class AcpProtocolError extends TheokitAgentError {
1113
+ readonly line: string;
1114
+ readonly name = "AcpProtocolError";
1115
+ constructor(line: string, options?: {
1116
+ cause?: unknown;
1117
+ });
1118
+ }
1119
+ /** The transport closed; `cause` is what the transport reported. Code `ACP_CONNECTION_CLOSED`. */
1120
+ declare class AcpConnectionClosedError extends TheokitAgentError {
1121
+ readonly name = "AcpConnectionClosedError";
1122
+ constructor(cause: Error);
1472
1123
  }
1473
1124
  /** Return a value or a Promise — `unknown` already includes `Promise<unknown>`; `await` handles both. */
1474
1125
  type ServerRequestHandler = (params: unknown) => unknown;
1126
+ /** Called with a notification's `params`; nothing is sent back. A returned promise is watched. */
1127
+ type NotificationHandler = (params: unknown) => void | Promise<void>;
1475
1128
  declare class AcpClient {
1476
1129
  private readonly transport;
1477
1130
  private nextId;
1478
1131
  private readonly pending;
1479
1132
  private readonly handlers;
1480
- private readonly decoder;
1133
+ private readonly notificationHandlers;
1134
+ private buffer;
1135
+ private closed;
1481
1136
  constructor(transport: AcpTransport);
1482
1137
  /** Send a JSON-RPC request and resolve with its `result` (or reject on `error`). */
1483
1138
  request(method: string, params: unknown): Promise<unknown>;
1484
1139
  /** Register a handler for a server→client request method (e.g. `session/request_permission`). */
1485
1140
  onRequest(method: string, handler: ServerRequestHandler): void;
1141
+ /** Register a notification handler; one that throws or rejects is reported. */
1142
+ onNotification(method: string, handler: NotificationHandler): void;
1143
+ private receive;
1144
+ private fail;
1486
1145
  private dispatch;
1146
+ private notify;
1487
1147
  private handleServerRequest;
1488
1148
  }
1489
1149
 
@@ -1664,4 +1324,4 @@ type AgentWithNarrowedList = Omit<typeof Agent$1, 'list'> & {
1664
1324
  type AgentWithNarrowedListAlias = AgentWithNarrowedList;
1665
1325
  declare const Agent: AgentWithNarrowedList;
1666
1326
 
1667
- export { type A2AAuth, type A2ACapabilities, type A2ASkill, type A2AToolConfig, AcpClient, AcpMessageDecoder, type AcpTransport, Agent, type AgentCard, type AgentConfig, AgentConfigCapability, AgentManifestEntry, AgentModule, AgentRunner, AgentRunnerBuilder, type AgentRunnerRunOptions, type AgentShape, type AgentWithNarrowedListAlias, ApprovalOptions, ApprovalPosture, type BuildAgentCardOptions, CanUseToolCapability, type Capability, CapabilityConflictError, CapabilityPreset, CapabilityRegistry, CheckpointCapability, type CompactionCallOptions, type CompactionStrategyConfig, CompiledAgentOptions, type CompiledAgentOptionsDraft, CompiledTool, ContextWindowCapability, ContextWindowOptions, type CostGuardOptions, DEFAULT_HANDLER_TIMEOUT_MS, DEFAULT_KEEP_TOKENS, DelegationResult, FieldCapability, type FinalizedDraft, GoalRunner, type GoalRunnerDeps, Guardrail, GuardrailsCapability, HitlDecision, HookApprovalCapability, HumanInTheLoopCapability, HumanInTheLoopOptions, type InProcessApprovalRequest, InProcessApprovalRequiredError, type InProcessAwaitApproval, type ListOptionsWithoutPaginationAlias, LoopStrategy, MCP_PROTOCOL_VERSION, MainLoopCapability, MainLoopMeta, type McpJsonSchema, type McpServerInfo, McpServersCapability, type McpToolDescriptor, MemoryCapability, ModelCapability, type NamedTool, type OutputModerationOptions, type PiiOptions, PluginsCapability, type PreCompactionHandler, PreCompactionHandlerError, type PreCompactionOptions, ProjectContextCapability, type PromptInjectionOptions, type ProvenanceEntry, ReasoningEffort, ReflectionStrategy, RoundStreamFactory, RunContextCapability, SessionStoreCapability, SettingSourcesCapability, SettingSourcesSelection, SkillsCapability, SkillsOptions, SkillsOptionsCapability, SkillsResolverCapability, type StreamAgentTurnDeps, type StreamAgentTurnInProcessInput, StreamEvent, SubAgentsCapability, SubagentsCapability, type Summarize, TelemetryCapability, type ToolComNome, type ToolDeclaration, ToolOptions, ToolboxCapability, type ToolboxSource, ToolsCapability, Toolset, ToolsetError, type TranscriptCompactionStrategy, UnknownCapabilityError, applyCapabilities, buildAgentCard, buildMcpToolDescriptors, compactionStrategyConfigSchema, costGuard, createA2ATool, createDraft, declareAgentShape, deriveConversationId, encodeAcpMessage, estimateTokens, formatGoalEvent, listSubagentNames, mcpServerInfo, moderateOutputStream, outputModeration, parseConversationId, piiDetector, promptInjectionDetector, resolveCompactionStrategy, resolveDecomposition, runInputGuards, runOutputGuards, setOnce, streamAgentTurnInProcess, streamAgentUIMessages, textPayloadExtractor, tokenBudgetCompactionStrategy, unicodeNormalizer, wellKnownCardPath, withPreCompaction };
1327
+ export { type A2ACapabilities, type A2ASkill, AcpClient, AcpConnectionClosedError, AcpMessageDecoder, AcpProtocolError, type AcpTransport, Agent, type AgentCard, type AgentConfig, AgentConfigCapability, AgentManifestEntry, AgentModule, type AgentShape, type AgentWithNarrowedListAlias, ApprovalOptions, ApprovalPosture, type BuildAgentCardOptions, CanUseToolCapability, type Capability, CapabilityConflictError, CapabilityPreset, CapabilityRegistry, CheckpointCapability, CompiledAgentOptions, type CompiledAgentOptionsDraft, CompiledTool, ContextWindowCapability, ContextWindowOptions, type CostGuardOptions, DEFAULT_HANDLER_TIMEOUT_MS, FieldCapability, type FinalizedDraft, GoalRunner, type GoalRunnerDeps, Guardrail, GuardrailsCapability, HitlDecision, HookApprovalCapability, HumanInTheLoopCapability, HumanInTheLoopOptions, type InProcessApprovalRequest, InProcessApprovalRequiredError, type InProcessAwaitApproval, type ListOptionsWithoutPaginationAlias, MCP_PROTOCOL_VERSION, MainLoopCapability, type McpJsonSchema, type McpServerInfo, McpServersCapability, type McpToolDescriptor, MemoryCapability, ModelCapability, type NamedTool, type OutputModerationOptions, type PiiOptions, PluginsCapability, type PreCompactionHandler, PreCompactionHandlerError, type PreCompactionOptions, ProjectContextCapability, type PromptInjectionOptions, type ProvenanceEntry, ReasoningEffort, RunContextCapability, SessionStoreCapability, SettingSourcesCapability, SettingSourcesSelection, SkillsCapability, SkillsOptions, SkillsOptionsCapability, SkillsResolverCapability, type StreamAgentTurnDeps, type StreamAgentTurnInProcessInput, SubAgentsCapability, SubagentsCapability, TelemetryCapability, type ToolComNome, type ToolDeclaration, ToolOptions, ToolboxCapability, type ToolboxSource, ToolsCapability, Toolset, ToolsetError, TranscriptCompactionStrategy, UnknownCapabilityError, applyCapabilities, buildAgentCard, buildMcpToolDescriptors, costGuard, createDraft, declareAgentShape, deriveConversationId, encodeAcpMessage, estimateTokens, formatGoalEvent, listSubagentNames, mcpServerInfo, moderateOutputStream, outputModeration, parseConversationId, piiDetector, promptInjectionDetector, resolveDecomposition, runInputGuards, runOutputGuards, setOnce, streamAgentTurnInProcess, streamAgentUIMessages, textPayloadExtractor, unicodeNormalizer, wellKnownCardPath, withPreCompaction };