@theokit/agents 0.42.0 → 0.44.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,8 +1,8 @@
1
1
  import { ExecutionContext } from '@theokit/http';
2
2
  import { A as AgentOptions, g as ToolOptions, M as MainLoopMeta, a as ApprovalOptions, B as BudgetOptions, H as HumanInTheLoopOptions, t as GatewayOptions, z as MemoryOptions, O as SkillsOptions, r as ContextWindowOptions, K as ProjectContextOptions, x as McpServersMap, G as Guardrail, o as CompactionDecoratorConfig, j as CheckpointOptions, R as ReasoningEffort } from './types-DVA4LQsA.js';
3
- import { InlineSkill, SystemPromptResolver, SettingSource, SkillsSettings, ContextSettings, PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition as AgentDefinition$1, BudgetTracker, CustomTool, ModelSelection } from '@theokit/sdk';
4
- import { UIMessageChunk } from 'ai';
3
+ import { InlineSkill, SystemPromptResolver, SettingSource, SkillsSettings, ContextSettings, CustomTool, PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition as AgentDefinition$1, BudgetTracker, ModelSelection } from '@theokit/sdk';
5
4
  import { z } from 'zod';
5
+ import { UIMessageChunk } from 'ai';
6
6
  import { RetryOptions } from '@theokit/sdk/retry';
7
7
 
8
8
  /**
@@ -414,6 +414,19 @@ interface DoneEvent {
414
414
  /** Total cost in USD for this agent run (EC-2: added for budget tracking). */
415
415
  cost?: number;
416
416
  }
417
+ /**
418
+ * Per-turn usage the translator attaches to the ai-sdk `finish` chunk's `messageMetadata`, so it
419
+ * lands on the reconstructed assistant `UIMessage.metadata` on the client (via `readUIMessageStream`)
420
+ * with NO extra header/store wiring. It is the seam that lets a surface (a TUI status bar, a web
421
+ * cost meter) show real tokens/cost for the turn it just streamed. Mirrors `DoneEvent`'s usage/cost
422
+ * (the authoritative totals the SDK reports at turn end) plus the wall-clock `durationMs`.
423
+ */
424
+ interface AgentTurnMetadata {
425
+ usage: DoneEvent['usage'];
426
+ /** Total cost in USD for the turn (present iff the SDK reported it). */
427
+ cost?: number;
428
+ durationMs: number;
429
+ }
417
430
  /** Agent run started. */
418
431
  interface RunStartedEvent {
419
432
  type: 'run_started';
@@ -500,6 +513,114 @@ interface AgentRouteContext {
500
513
  /** Generate HTTP routes for a single agent. Returns Web Standard handlers. */
501
514
  declare function generateAgentRoutes(ctx: AgentRouteContext): AgentRoute[];
502
515
 
516
+ /**
517
+ * M2 (theokit-ai-first) — `defineAgent`, the zero-config imperative agent surface.
518
+ *
519
+ * ADR-B1: `defineAgent({...})` (default-exported from a top-level `agents/<name>.ts`) is
520
+ * the canonical zero-config surface; the `@Agent` class decorator stays the advanced/DI
521
+ * surface. Both compile to {@link CompiledAgentOptions} and run through the same SDK
522
+ * runtime (`createSdkAgentStream`) — one runtime, two syntaxes.
523
+ *
524
+ * This module is PURE metadata (sdk-runtime.md / G2): `defineAgent` describes an agent, it
525
+ * NEVER calls an LLM. It imports only `zod` (types) + the compiler shape — no `theokit`
526
+ * core, preserving the agents → (nothing) dependency direction (G1).
527
+ */
528
+
529
+ /**
530
+ * Brand tag for a `defineAgent` value. `Symbol.for` (global registry, not `Symbol()`) so
531
+ * the brand survives duplicate module instances (dual-package / bundling) — the scanner's
532
+ * brand-check then works regardless of which copy created the definition.
533
+ */
534
+ declare const AGENT_BRAND: unique symbol;
535
+ /** Config accepted by {@link defineAgent}. */
536
+ interface DefineAgentConfig<TInput extends z.ZodType = z.ZodType> {
537
+ /** Zod schema for the request body — lifted into the typed client (M2, {@link InferAgentInput}). */
538
+ input?: TInput;
539
+ /** Model id (e.g. `claude-sonnet-4-6`). Falls back to the SDK default when omitted. */
540
+ model?: string;
541
+ /** Static system prompt. */
542
+ system?: string;
543
+ /** Extended-thinking effort (mirrors `@Agent({ reasoningEffort })`). */
544
+ reasoningEffort?: ReasoningEffort;
545
+ /**
546
+ * Pre-built tools. Accepts the `@theokit/sdk` `CustomTool` that `defineAgentTool`
547
+ * (theokit/server) and every `@theokit/sdk-tools` factory return (issue #81) — they are
548
+ * normalized to the internal {@link CompiledTool} shape at compile time.
549
+ */
550
+ tools?: readonly CustomTool[];
551
+ /**
552
+ * M7 — run-context: an opaque, per-agent object forwarded to every tool handler's
553
+ * `ctx.context` at run time (injected by the theokit adapter's tool wrapper). Set shared config
554
+ * (e.g. `{ projectRoot }`) ONCE at the agent level instead of baking it into each tool
555
+ * factory. Mirrors ai-sdk `experimental_context`, mastra `RuntimeContext`, and
556
+ * openai-agents-js `RunContext`. Distinct from `@Agent`'s context-window `context`.
557
+ */
558
+ context?: Record<string, unknown>;
559
+ /**
560
+ * M9 — guardrails: input/output guards applied at the framework boundary (ADR-0040 § D2).
561
+ * Input guards run on the user message before the SDK runtime; a `block` fails the run fast.
562
+ * Built-ins live in `@theokit/agents` (`promptInjectionDetector`, `piiDetector`, `costGuard`,
563
+ * `unicodeNormalizer`, `outputModeration`).
564
+ */
565
+ guardrails?: readonly Guardrail[];
566
+ /**
567
+ * M14 — HITL approvals keyed by tool name. Each gated tool pauses the run and emits an
568
+ * `approval_required` event until approved (reuses the same `compiled.hitl` wiring the `@Agent`
569
+ * + `@HumanInTheLoop` path produces). A key that does not match a declared tool fails fast at
570
+ * compile time.
571
+ */
572
+ approvals?: Record<string, HumanInTheLoopOptions>;
573
+ /**
574
+ * M13 — skills selection: a static list (compiled straight to the SDK `skills.enabled`) OR a
575
+ * per-request resolver `(ctx) => string[]` (carried on `compiled.skillsResolver`, resolved by the
576
+ * request path against the run-context). Absent ⇒ the SDK enables every discovered skill.
577
+ */
578
+ skills?: SkillsSelection;
579
+ /**
580
+ * theokit-file-based-config — opt into `.theokit/` file-based config (skills, subagents, hooks,
581
+ * MCP, context, cron). The SDK discovers config from these roots under the app's `cwd`:
582
+ * `"project"` = `<cwd>/.theokit/`, `"user"` = `~/.theokit/`. Absent ⇒ inline (code) config only.
583
+ * SECURITY: enabling `"project"` enables shell-executing hooks from `.theokit/hooks.json` — this
584
+ * is opt-in because `.theokit/` is the app's own repo (informed consent). The SDK owns discovery
585
+ * + execution (G2 / ADR-0040); theokit only wires this into `Agent.create({ local.settingSources })`.
586
+ */
587
+ settingSources?: readonly SettingSource[];
588
+ /**
589
+ * MCP servers available to the agent — the builder-chain equivalent of the `@MCP` class
590
+ * decorator. Each key is a server name; the value is the server configuration. Forwarded
591
+ * unchanged to `Agent.create({ mcpServers })` (the SDK owns MCP execution). Absent ⇒ no MCP.
592
+ */
593
+ mcpServers?: McpServersMap;
594
+ }
595
+ /**
596
+ * A branded agent definition — the value {@link defineAgent} returns.
597
+ *
598
+ * `TTools` (M8) is a phantom type parameter carrying the tool-name union: the `agent()` builder
599
+ * threads its accumulated literal tool names here (`.build()` returns `AgentDefinition<TInput,
600
+ * 'a' | 'b'>`), so the generated client (`.theokit/agents.d.ts`) can expose them via
601
+ * {@link InferAgentToolNames}. `defineAgent` leaves it `string` (its tools array carries no literal
602
+ * names). Never present at runtime.
603
+ */
604
+ type AgentDefinition<TInput extends z.ZodType = z.ZodType, TTools extends string = string> = DefineAgentConfig<TInput> & {
605
+ readonly [AGENT_BRAND]: true;
606
+ readonly __toolNames?: TTools;
607
+ };
608
+ /** Infer the request type of an agent definition from its `input` Zod schema. */
609
+ type InferAgentInput<T> = T extends AgentDefinition<infer S> ? (S extends z.ZodType ? z.infer<S> : never) : never;
610
+ /**
611
+ * Infer the tool-name union of an agent definition (M8). Yields the literal union for agents built
612
+ * with the `agent()` builder (`'read_file' | 'count_lines'`), or `string` for `defineAgent` agents
613
+ * whose tools array carries no literal names.
614
+ */
615
+ type InferAgentToolNames<T> = T extends AgentDefinition<z.ZodType, infer N> ? N : never;
616
+ /** Brand-check: is `value` a {@link defineAgent} result? */
617
+ declare function isAgentDefinition(value: unknown): value is AgentDefinition;
618
+ /**
619
+ * Lower a definition to the SDK-ready {@link CompiledAgentOptions} — the same shape
620
+ * `compileAgent` (decorator path) produces, so both surfaces converge on one runtime.
621
+ */
622
+ declare function compileAgentDefinition(def: AgentDefinition): CompiledAgentOptions;
623
+
503
624
  /**
504
625
  * SDK Adapter — bridges @theokit/agents decorators → @theokit/sdk runtime.
505
626
  *
@@ -584,6 +705,33 @@ interface RuntimeOverrides {
584
705
  declare function createSdkAgentStream(compiled: CompiledAgentOptions, compiledTools: CompiledTool[], apiKey: string, overrides?: RuntimeOverrides): (message: string, sessionId: string, factoryOpts?: {
585
706
  disableTools?: boolean;
586
707
  }) => AsyncIterable<StreamEvent>;
708
+ /**
709
+ * The minimal `SDKAgent` surface a serving host needs (ACP checks `agentId: string` + `send: fn`).
710
+ * `Agent.getOrCreate` returns the real SDK agent — this alias just types what {@link toAgentFactory}
711
+ * hands back without re-exporting the full `@theokit/sdk` `Agent` type.
712
+ */
713
+ interface SdkAgentHandle {
714
+ readonly agentId: string;
715
+ send: (msg: string, opts?: unknown) => unknown;
716
+ dispose: () => Promise<void>;
717
+ }
718
+ /**
719
+ * #12 — bridge a builder/`defineAgent` {@link TheokitAgentDefinition} to a real `SDKAgent` FACTORY,
720
+ * so surfaces that require an `SDKAgent` (or `(sessionId) => SDKAgent`) — notably `theokit acp`,
721
+ * whose entry default-export must be one — can serve an agent defined with the `agent()` chain.
722
+ *
723
+ * The factory reuses the SAME projection the streaming path uses (`compileAgentDefinition` → tools /
724
+ * model / `assembleM8CreateOptions`), so the served agent has identical tools, model, system prompt,
725
+ * skills, and `mcpServers`. Keyed per `sessionId` via `Agent.getOrCreate` (matches the run path).
726
+ *
727
+ * NOTE: HITL approvals (`.approval(...)`) are driven by the framework's streaming runner, not by
728
+ * `Agent.create`; a raw `SDKAgent` from this factory does not auto-pause gated tools — the serving
729
+ * surface (e.g. the ACP client) owns approval. Tools still execute; they are simply not HITL-gated here.
730
+ */
731
+ declare function toAgentFactory(def: AgentDefinition, opts: {
732
+ apiKey: string;
733
+ overrides?: RuntimeOverrides;
734
+ }): (sessionId: string) => Promise<SdkAgentHandle>;
587
735
 
588
736
  /**
589
737
  * Model-selection mapping (M1 reasoning-visibility) — the single site that turns a
@@ -672,108 +820,6 @@ declare function translateToUIMessageStream(events: AsyncIterable<AgentStreamEve
672
820
  textId: string;
673
821
  }): AsyncGenerator<UIMessageChunk, void, unknown>;
674
822
 
675
- /**
676
- * M2 (theokit-ai-first) — `defineAgent`, the zero-config imperative agent surface.
677
- *
678
- * ADR-B1: `defineAgent({...})` (default-exported from a top-level `agents/<name>.ts`) is
679
- * the canonical zero-config surface; the `@Agent` class decorator stays the advanced/DI
680
- * surface. Both compile to {@link CompiledAgentOptions} and run through the same SDK
681
- * runtime (`createSdkAgentStream`) — one runtime, two syntaxes.
682
- *
683
- * This module is PURE metadata (sdk-runtime.md / G2): `defineAgent` describes an agent, it
684
- * NEVER calls an LLM. It imports only `zod` (types) + the compiler shape — no `theokit`
685
- * core, preserving the agents → (nothing) dependency direction (G1).
686
- */
687
-
688
- /**
689
- * Brand tag for a `defineAgent` value. `Symbol.for` (global registry, not `Symbol()`) so
690
- * the brand survives duplicate module instances (dual-package / bundling) — the scanner's
691
- * brand-check then works regardless of which copy created the definition.
692
- */
693
- declare const AGENT_BRAND: unique symbol;
694
- /** Config accepted by {@link defineAgent}. */
695
- interface DefineAgentConfig<TInput extends z.ZodType = z.ZodType> {
696
- /** Zod schema for the request body — lifted into the typed client (M2, {@link InferAgentInput}). */
697
- input?: TInput;
698
- /** Model id (e.g. `claude-sonnet-4-6`). Falls back to the SDK default when omitted. */
699
- model?: string;
700
- /** Static system prompt. */
701
- system?: string;
702
- /** Extended-thinking effort (mirrors `@Agent({ reasoningEffort })`). */
703
- reasoningEffort?: ReasoningEffort;
704
- /**
705
- * Pre-built tools. Accepts the `@theokit/sdk` `CustomTool` that `defineAgentTool`
706
- * (theokit/server) and every `@theokit/sdk-tools` factory return (issue #81) — they are
707
- * normalized to the internal {@link CompiledTool} shape at compile time.
708
- */
709
- tools?: readonly CustomTool[];
710
- /**
711
- * M7 — run-context: an opaque, per-agent object forwarded to every tool handler's
712
- * `ctx.context` at run time (injected by the theokit adapter's tool wrapper). Set shared config
713
- * (e.g. `{ projectRoot }`) ONCE at the agent level instead of baking it into each tool
714
- * factory. Mirrors ai-sdk `experimental_context`, mastra `RuntimeContext`, and
715
- * openai-agents-js `RunContext`. Distinct from `@Agent`'s context-window `context`.
716
- */
717
- context?: Record<string, unknown>;
718
- /**
719
- * M9 — guardrails: input/output guards applied at the framework boundary (ADR-0040 § D2).
720
- * Input guards run on the user message before the SDK runtime; a `block` fails the run fast.
721
- * Built-ins live in `@theokit/agents` (`promptInjectionDetector`, `piiDetector`, `costGuard`,
722
- * `unicodeNormalizer`, `outputModeration`).
723
- */
724
- guardrails?: readonly Guardrail[];
725
- /**
726
- * M14 — HITL approvals keyed by tool name. Each gated tool pauses the run and emits an
727
- * `approval_required` event until approved (reuses the same `compiled.hitl` wiring the `@Agent`
728
- * + `@HumanInTheLoop` path produces). A key that does not match a declared tool fails fast at
729
- * compile time.
730
- */
731
- approvals?: Record<string, HumanInTheLoopOptions>;
732
- /**
733
- * M13 — skills selection: a static list (compiled straight to the SDK `skills.enabled`) OR a
734
- * per-request resolver `(ctx) => string[]` (carried on `compiled.skillsResolver`, resolved by the
735
- * request path against the run-context). Absent ⇒ the SDK enables every discovered skill.
736
- */
737
- skills?: SkillsSelection;
738
- /**
739
- * theokit-file-based-config — opt into `.theokit/` file-based config (skills, subagents, hooks,
740
- * MCP, context, cron). The SDK discovers config from these roots under the app's `cwd`:
741
- * `"project"` = `<cwd>/.theokit/`, `"user"` = `~/.theokit/`. Absent ⇒ inline (code) config only.
742
- * SECURITY: enabling `"project"` enables shell-executing hooks from `.theokit/hooks.json` — this
743
- * is opt-in because `.theokit/` is the app's own repo (informed consent). The SDK owns discovery
744
- * + execution (G2 / ADR-0040); theokit only wires this into `Agent.create({ local.settingSources })`.
745
- */
746
- settingSources?: readonly SettingSource[];
747
- }
748
- /**
749
- * A branded agent definition — the value {@link defineAgent} returns.
750
- *
751
- * `TTools` (M8) is a phantom type parameter carrying the tool-name union: the `agent()` builder
752
- * threads its accumulated literal tool names here (`.build()` returns `AgentDefinition<TInput,
753
- * 'a' | 'b'>`), so the generated client (`.theokit/agents.d.ts`) can expose them via
754
- * {@link InferAgentToolNames}. `defineAgent` leaves it `string` (its tools array carries no literal
755
- * names). Never present at runtime.
756
- */
757
- type AgentDefinition<TInput extends z.ZodType = z.ZodType, TTools extends string = string> = DefineAgentConfig<TInput> & {
758
- readonly [AGENT_BRAND]: true;
759
- readonly __toolNames?: TTools;
760
- };
761
- /** Infer the request type of an agent definition from its `input` Zod schema. */
762
- type InferAgentInput<T> = T extends AgentDefinition<infer S> ? (S extends z.ZodType ? z.infer<S> : never) : never;
763
- /**
764
- * Infer the tool-name union of an agent definition (M8). Yields the literal union for agents built
765
- * with the `agent()` builder (`'read_file' | 'count_lines'`), or `string` for `defineAgent` agents
766
- * whose tools array carries no literal names.
767
- */
768
- type InferAgentToolNames<T> = T extends AgentDefinition<z.ZodType, infer N> ? N : never;
769
- /** Brand-check: is `value` a {@link defineAgent} result? */
770
- declare function isAgentDefinition(value: unknown): value is AgentDefinition;
771
- /**
772
- * Lower a definition to the SDK-ready {@link CompiledAgentOptions} — the same shape
773
- * `compileAgent` (decorator path) produces, so both surfaces converge on one runtime.
774
- */
775
- declare function compileAgentDefinition(def: AgentDefinition): CompiledAgentOptions;
776
-
777
823
  /**
778
824
  * M8 — `agent()`, the fluent agent builder with accumulative **type-state**.
779
825
  *
@@ -881,6 +927,13 @@ interface AgentBuilder<TInput extends z.ZodType | UnsetMarker = UnsetMarker, TMo
881
927
  * shell-executing hooks from `.theokit/hooks.json` — opt-in because `.theokit/` is your own repo.
882
928
  */
883
929
  settingSources(sources: readonly SettingSource[]): AgentBuilder<TInput, TModel, TContext, TTools>;
930
+ /**
931
+ * Declare MCP (Model Context Protocol) servers available to this agent — the builder-chain
932
+ * equivalent of the `@MCP` class decorator. Each key is a server name; the value is its config
933
+ * (`command` / `args` / `env` / `cwd`). Forwarded to `Agent.create({ mcpServers })`; the SDK owns
934
+ * MCP execution. Call once — a later call replaces the map.
935
+ */
936
+ mcp(servers: McpServersMap): AgentBuilder<TInput, TModel, TContext, TTools>;
884
937
  /**
885
938
  * Apply a reusable partial chain (Spring-Boot-style composition). `preset` receives the current
886
939
  * builder and returns an advanced one; its accumulated type-state flows through.
@@ -1643,4 +1696,4 @@ declare function agentsPlugin(opts: AgentsPluginOptions): {
1643
1696
  register(app: PluginApp): void;
1644
1697
  };
1645
1698
 
1646
- export { type McpRequestContext as $, type AgentManifestEntry as A, type BackgroundDelegation as B, type CompiledAgentOptions as C, type DelegationResult as D, type CompiledContextWindow as E, type ContextualTool as F, DEFAULT_MAX_ITERATIONS as G, type DefineAgentConfig as H, type DelegateFn as I, type DelegateOptions as J, DelegationError as K, type LoopStrategy as L, type DoneEvent as M, type ErrorEvent as N, type FileEditEvent as O, type HitlDecision as P, type InferAgentInput as Q, type ReflectionStrategy as R, type StreamEvent as S, type InferAgentToolNames as T, type IterationEvent as U, type LLMCallContext as V, type LoopFinishReason as W, type LoopOutcome as X, type LoopStrategyConfig as Y, type McpApprovalSpec as Z, type McpRegistryConfig as _, type CompiledTool as a, resolveLoopStrategy as a$, type McpSelection as a0, type PartialToolCallEvent as a1, type ProcessInputContext as a2, type ReflectionContext as a3, type ReflectionResult as a4, type ReflectionStrategyConfig as a5, type RunStartedEvent as a6, type ScoreVerdict as a7, type ScoredDelegation as a8, type Scorer as a9, createApiErrorHandler as aA, createSdkAgentStream as aB, createThinkTagExtractor as aC, createToolHooksPlugin as aD, delegate as aE, delegateBackground as aF, delegateWithScoring as aG, extractThinkTagStream as aH, generateAgentManifest as aI, generateAgentRoutes as aJ, isAgentContext as aK, isAgentDefinition as aL, isApprovalRequired as aM, isDone as aN, isError as aO, isPartialToolCall as aP, isTextDelta as aQ, isToolCall as aR, isToolResult as aS, ladderReflectionStrategy as aT, loopStrategyConfigSchema as aU, mcpRegistry as aV, mcpToolApprovals as aW, noopReflectionStrategy as aX, projectContextMetadataOnlyKnobs as aY, reflectionStrategyConfigSchema as aZ, resolveEnabledSkills as a_, type SdkMessage as aa, type Segment as ab, type SkillsRequestContext as ac, type SkillsSelection as ad, type StateUpdateEvent as ae, type TextDeltaEvent as af, type ThinkingEvent as ag, type ToolCallEvent as ah, type ToolCallVeto as ai, type ToolHooks as aj, type ToolHooksPlugin as ak, type ToolResultEvent as al, type ToolWalkResult as am, type ToolboxWalkResult as an, agent as ao, agentsPlugin as ap, buildModelSelection as aq, compileAgent as ar, compileAgentDefinition as as, compileAgentModule as at, compileContextWindow as au, compileProjectContext as av, compileSkills as aw, compileTools as ax, contextualTool as ay, createAgentExecutionContext as az, type RoundStreamFactory as b, resolveMcpServers as b0, runWithApiErrorHandling as b1, streamAgentResponse as b2, streamAgentUIMessages as b3, translateSdkEvent as b4, translateToUIMessageStream as b5, validateUniqueRoutes as b6, walkAgentMetadata as b7, AGENT_BRAND as c, type AfterToolCallContext as d, type AgentBuilder as e, type AgentDefinition as f, AgentDefinitionError as g, type AgentExecutionContext as h, type AgentManifest as i, type AgentManifestTool as j, type AgentRoute as k, type AgentRouteContext as l, type AgentRunInfo as m, type AgentStreamEvent as n, type AgentWalkResult as o, AgentWarningCode as p, type AgentsPluginOptions as q, type ApiErrorContext as r, type ApiErrorDecision 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 };
1699
+ export { type McpRegistryConfig as $, type AgentManifestEntry as A, type BackgroundDelegation as B, type CompiledAgentOptions as C, type DelegationResult as D, type CheckpointSavedEvent as E, type CompiledContextWindow as F, type ContextualTool as G, DEFAULT_MAX_ITERATIONS as H, type DefineAgentConfig as I, type DelegateFn as J, type DelegateOptions as K, type LoopStrategy as L, DelegationError as M, type DoneEvent as N, type ErrorEvent as O, type FileEditEvent as P, type HitlDecision as Q, type ReflectionStrategy as R, type StreamEvent as S, type InferAgentInput as T, type InferAgentToolNames as U, type IterationEvent as V, type LLMCallContext as W, type LoopFinishReason as X, type LoopOutcome as Y, type LoopStrategyConfig as Z, type McpApprovalSpec as _, type CompiledTool as a, reflectionStrategyConfigSchema as a$, type McpRequestContext as a0, type McpSelection as a1, type PartialToolCallEvent as a2, type ProcessInputContext as a3, type ReflectionContext as a4, type ReflectionResult as a5, type ReflectionStrategyConfig as a6, type RunStartedEvent as a7, type ScoreVerdict as a8, type ScoredDelegation as a9, contextualTool as aA, createAgentExecutionContext as aB, createApiErrorHandler as aC, createSdkAgentStream as aD, createThinkTagExtractor as aE, createToolHooksPlugin as aF, delegate as aG, delegateBackground as aH, delegateWithScoring as aI, extractThinkTagStream as aJ, generateAgentManifest as aK, generateAgentRoutes as aL, isAgentContext as aM, isAgentDefinition as aN, isApprovalRequired as aO, isDone as aP, isError as aQ, isPartialToolCall as aR, isTextDelta as aS, isToolCall as aT, isToolResult as aU, ladderReflectionStrategy as aV, loopStrategyConfigSchema as aW, mcpRegistry as aX, mcpToolApprovals as aY, noopReflectionStrategy as aZ, projectContextMetadataOnlyKnobs as a_, type Scorer as aa, type SdkAgentHandle as ab, type SdkMessage as ac, type Segment as ad, type SkillsRequestContext as ae, type SkillsSelection as af, type StateUpdateEvent as ag, type TextDeltaEvent as ah, type ThinkingEvent as ai, type ToolCallEvent as aj, type ToolCallVeto as ak, type ToolHooks as al, type ToolHooksPlugin as am, type ToolResultEvent as an, type ToolWalkResult as ao, type ToolboxWalkResult as ap, agent as aq, agentsPlugin as ar, buildModelSelection as as, compileAgent as at, compileAgentDefinition as au, compileAgentModule as av, compileContextWindow as aw, compileProjectContext as ax, compileSkills as ay, compileTools as az, type RoundStreamFactory as b, resolveEnabledSkills as b0, resolveLoopStrategy as b1, resolveMcpServers as b2, runWithApiErrorHandling as b3, streamAgentResponse as b4, streamAgentUIMessages as b5, toAgentFactory as b6, translateSdkEvent as b7, translateToUIMessageStream as b8, validateUniqueRoutes as b9, walkAgentMetadata as ba, AGENT_BRAND as c, type AfterToolCallContext as d, type AgentBuilder as e, type AgentDefinition as f, AgentDefinitionError as g, type AgentExecutionContext as h, type AgentManifest 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 AgentWalkResult as p, AgentWarningCode as q, type AgentsPluginOptions as r, type ApiErrorContext as s, type ApiErrorDecision as t, type ApiErrorPolicy as u, type ApprovalRequiredEvent as v, type ArtifactChunkEvent as w, type ArtifactStartEvent as x, type BeforeToolCallContext as y, BudgetExceededError as z };
package/dist/bridge.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { c as AGENT_BRAND, d as AfterToolCallContext, e as AgentBuilder, f as AgentDefinition, g as AgentDefinitionError, h as AgentExecutionContext, i as AgentManifest, A as AgentManifestEntry, j as AgentManifestTool, k as AgentRoute, l as AgentRouteContext, m as AgentRunInfo, n as AgentStreamEvent, o as AgentWalkResult, p as AgentWarningCode, q as AgentsPluginOptions, r as ApiErrorContext, s as ApiErrorDecision, t as ApiErrorPolicy, u as ApprovalRequiredEvent, v as ArtifactChunkEvent, w as ArtifactStartEvent, B as BackgroundDelegation, x as BeforeToolCallContext, y as BudgetExceededError, z as CheckpointSavedEvent, C as CompiledAgentOptions, E as CompiledContextWindow, a as CompiledTool, F as ContextualTool, H as DefineAgentConfig, I as DelegateFn, J as DelegateOptions, K as DelegationError, D as DelegationResult, M as DoneEvent, N as ErrorEvent, O as FileEditEvent, Q as InferAgentInput, T as InferAgentToolNames, U as IterationEvent, V as LLMCallContext, Z as McpApprovalSpec, _ as McpRegistryConfig, $ as McpRequestContext, a0 as McpSelection, a1 as PartialToolCallEvent, a2 as ProcessInputContext, a6 as RunStartedEvent, a7 as ScoreVerdict, a8 as ScoredDelegation, a9 as Scorer, aa as SdkMessage, ab as Segment, ae as StateUpdateEvent, S as StreamEvent, af as TextDeltaEvent, ag as ThinkingEvent, ah as ToolCallEvent, ai as ToolCallVeto, aj as ToolHooks, ak as ToolHooksPlugin, al as ToolResultEvent, am as ToolWalkResult, an as ToolboxWalkResult, ao as agent, ap as agentsPlugin, aq as buildModelSelection, ar as compileAgent, as as compileAgentDefinition, at as compileAgentModule, au as compileContextWindow, av as compileProjectContext, aw as compileSkills, ax as compileTools, ay as contextualTool, az as createAgentExecutionContext, aA as createApiErrorHandler, aB as createSdkAgentStream, aC as createThinkTagExtractor, aD as createToolHooksPlugin, aE as delegate, aF as delegateBackground, aG as delegateWithScoring, aH as extractThinkTagStream, aI as generateAgentManifest, aJ as generateAgentRoutes, aK as isAgentContext, aL as isAgentDefinition, aM as isApprovalRequired, aN as isDone, aO as isError, aP as isPartialToolCall, aQ as isTextDelta, aR as isToolCall, aS as isToolResult, aV as mcpRegistry, aW as mcpToolApprovals, aY as projectContextMetadataOnlyKnobs, b0 as resolveMcpServers, b1 as runWithApiErrorHandling, b2 as streamAgentResponse, b3 as streamAgentUIMessages, b4 as translateSdkEvent, b5 as translateToUIMessageStream, b6 as validateUniqueRoutes, b7 as walkAgentMetadata } from './bridge-entry-CE3ie8rG.js';
1
+ export { c as AGENT_BRAND, d as AfterToolCallContext, e as AgentBuilder, f as AgentDefinition, g as AgentDefinitionError, h as AgentExecutionContext, i as AgentManifest, A as AgentManifestEntry, j as AgentManifestTool, k as AgentRoute, l as AgentRouteContext, m as AgentRunInfo, n as AgentStreamEvent, o as AgentTurnMetadata, p as AgentWalkResult, q as AgentWarningCode, r as AgentsPluginOptions, s as ApiErrorContext, t as ApiErrorDecision, u as ApiErrorPolicy, v as ApprovalRequiredEvent, w as ArtifactChunkEvent, x as ArtifactStartEvent, B as BackgroundDelegation, y as BeforeToolCallContext, z as BudgetExceededError, E as CheckpointSavedEvent, C as CompiledAgentOptions, F as CompiledContextWindow, a as CompiledTool, G as ContextualTool, I as DefineAgentConfig, J as DelegateFn, K as DelegateOptions, M as DelegationError, D as DelegationResult, N as DoneEvent, O as ErrorEvent, P as FileEditEvent, T as InferAgentInput, U as InferAgentToolNames, V as IterationEvent, W as LLMCallContext, _ as McpApprovalSpec, $ as McpRegistryConfig, a0 as McpRequestContext, a1 as McpSelection, a2 as PartialToolCallEvent, a3 as ProcessInputContext, a7 as RunStartedEvent, a8 as ScoreVerdict, a9 as ScoredDelegation, aa as Scorer, ab as SdkAgentHandle, ac as SdkMessage, ad as Segment, ag as StateUpdateEvent, S as StreamEvent, ah as TextDeltaEvent, ai as ThinkingEvent, aj as ToolCallEvent, ak as ToolCallVeto, al as ToolHooks, am as ToolHooksPlugin, an as ToolResultEvent, ao as ToolWalkResult, ap as ToolboxWalkResult, aq as agent, ar as agentsPlugin, as as buildModelSelection, at as compileAgent, au as compileAgentDefinition, av as compileAgentModule, aw as compileContextWindow, ax as compileProjectContext, ay as compileSkills, az as compileTools, aA as contextualTool, aB as createAgentExecutionContext, aC as createApiErrorHandler, aD as createSdkAgentStream, aE as createThinkTagExtractor, aF as createToolHooksPlugin, aG as delegate, aH as delegateBackground, aI as delegateWithScoring, aJ as extractThinkTagStream, aK as generateAgentManifest, aL as generateAgentRoutes, aM as isAgentContext, aN as isAgentDefinition, aO as isApprovalRequired, aP as isDone, aQ as isError, aR as isPartialToolCall, aS as isTextDelta, aT as isToolCall, aU as isToolResult, aX as mcpRegistry, aY as mcpToolApprovals, a_ as projectContextMetadataOnlyKnobs, b2 as resolveMcpServers, b3 as runWithApiErrorHandling, b4 as streamAgentResponse, b5 as streamAgentUIMessages, b6 as toAgentFactory, b7 as translateSdkEvent, b8 as translateToUIMessageStream, b9 as validateUniqueRoutes, ba as walkAgentMetadata } from './bridge-entry-BW1ifbWg.js';
2
2
  import '@theokit/http';
3
3
  import './types-DVA4LQsA.js';
4
4
  import '@theokit/sdk';
package/dist/bridge.js CHANGED
@@ -42,11 +42,12 @@ import {
42
42
  runWithApiErrorHandling,
43
43
  streamAgentResponse,
44
44
  streamAgentUIMessages,
45
+ toAgentFactory,
45
46
  translateSdkEvent,
46
47
  translateToUIMessageStream,
47
48
  validateUniqueRoutes,
48
49
  walkAgentMetadata
49
- } from "./chunk-OFPS2N3U.js";
50
+ } from "./chunk-6WOLHCZB.js";
50
51
  import "./chunk-NERDIS45.js";
51
52
  import "./chunk-7QVYU63E.js";
52
53
  export {
@@ -93,6 +94,7 @@ export {
93
94
  runWithApiErrorHandling,
94
95
  streamAgentResponse,
95
96
  streamAgentUIMessages,
97
+ toAgentFactory,
96
98
  translateSdkEvent,
97
99
  translateToUIMessageStream,
98
100
  validateUniqueRoutes,