@theokit/agents 3.0.0 → 4.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.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { G as Guardrail, L as LoopStrategy, R as ReflectionStrategy, C as CompiledAgentOptions, M as MainLoopMeta, a as CompiledTool, b as ReasoningEffort, c as RoundStreamFactory, S as StreamEvent, D as DelegationResult, d as ContextWindowOptions, H as HumanInTheLoopOptions, e as McpServersMap, f as MemoryOptions, P as ProjectContextOptions, g as SkillsOptions, h as SkillsSelection, T as ToolOptions, A as ApprovalOptions, i as AgentManifestEntry } from './bridge-entry-8gsH0kVZ.js';
2
- export { j as AGENT_BRAND, k as AfterToolCallContext, l as AgentBuilder, m as AgentDefinition, n as AgentDefinitionError, o as AgentExecutionContext, p as AgentManifest, q as AgentManifestSource, r as AgentManifestTool, s as AgentOptions, t as AgentRoute, u as AgentRouteContext, v as AgentRunInfo, w as AgentStreamEvent, x as AgentTurnMetadata, y as AgentsPluginOptions, z as ApiErrorContext, B as ApiErrorDecision, E as ApiErrorPolicy, F as ApprovalRequiredEvent, I as ArtifactChunkEvent, J as ArtifactStartEvent, K as BackgroundDelegation, N as BeforeToolCallContext, O as BudgetExceededError, Q as BudgetOptions, U as CheckpointSavedEvent, V as CompiledContextWindow, W as ContextualTool, X as CostBudgetExceededError, Y as DEFAULT_MAX_ITERATIONS, Z as DefineAgentConfig, _ as DelegateFn, $ as DelegateOptions, a0 as DelegationError, a1 as DoneEvent, a2 as ErrorEvent, a3 as FileEditEvent, a4 as GuardrailAction, a5 as GuardrailPhase, a6 as GuardrailResult, a7 as GuardrailViolationError, a8 as HitlDecision, a9 as InferAgentInput, aa as InferAgentToolNames, ab as IterationEvent, ac as LLMCallContext, ad as LoopFinishReason, ae as LoopOutcome, af as LoopStrategyConfig, ag as MainLoopOptions, ah as McpApprovalSpec, ai as McpRegistryConfig, aj as McpRequestContext, ak as McpSelection, al as PartialToolCallEvent, am as PolicyHandler, an as ProcessInputContext, ao as ReflectionContext, ap as ReflectionResult, aq as ReflectionStrategyConfig, ar as RunStartedEvent, as as ScoreVerdict, at as ScoredDelegation, au as Scorer, av as SdkAgentHandle, aw as SdkMessage, ax as Segment, ay as SkillsRequestContext, az as StateUpdateEvent, aA as TextDeltaEvent, aB as ThinkingEvent, aC as TimeoutAction, aD as ToolCallEvent, aE as ToolCallVeto, aF as ToolHooks, aG as ToolHooksPlugin, aH as ToolResultEvent, aI as ToolWalkResult, aJ as ToolboxOptions, aK as ToolboxWalkResult, aL as agent, aM as agentsPlugin, aN as buildModelSelection, aO as compileAgentDefinition, aP as compileAgentModule, aQ as compileContextWindow, aR as compileProjectContext, aS as compileSkills, aT as compileTools, aU as contextualTool, aV as createAgentExecutionContext, aW as createApiErrorHandler, aX as createSdkAgentStream, aY as createThinkTagExtractor, aZ as createToolHooksPlugin, a_ as delegate, a$ as delegateBackground, b0 as delegateWithScoring, b1 as extractThinkTagStream, b2 as generateAgentManifest, b3 as generateAgentRoutes, b4 as isAgentContext, b5 as isAgentDefinition, b6 as isApprovalRequired, b7 as isDone, b8 as isError, b9 as isPartialToolCall, ba as isTextDelta, bb as isToolCall, bc as isToolResult, bd as ladderReflectionStrategy, be as loopStrategyConfigSchema, bf as mcpRegistry, bg as mcpToolApprovals, bh as noopReflectionStrategy, bi as presentUIMessageStream, bj as projectContextMetadataOnlyKnobs, bk as reflectionStrategyConfigSchema, bl as resolveEnabledSkills, bm as resolveLoopStrategy, bn as resolveMcpServers, bo as runWithApiErrorHandling, bp as streamAgentResponse, bq as streamAgentUIMessages, br as toAgentFactory, bs as translateSdkEvent } from './bridge-entry-8gsH0kVZ.js';
3
- import * as _theokit_sdk from '@theokit/sdk';
1
+ import { G as Guardrail, L as LoopStrategy, R as ReflectionStrategy, C as CompiledAgentOptions, M as MainLoopMeta, a as CompiledTool, b as ReasoningEffort, c as RoundStreamFactory, S as StreamEvent, D as DelegationResult, d as ContextWindowOptions, e as SkillsOptions, T as ToolOptions, A as ApprovalOptions, H as HumanInTheLoopOptions, f as AgentManifestEntry } from './bridge-entry-Ddu3Ug_3.js';
2
+ export { g as AGENT_BRAND, h as AfterToolCallContext, i as AgentBuilder, j as AgentDefinition, k as AgentDefinitionError, l as AgentExecutionContext, m as AgentManifest, n as AgentManifestSource, o as AgentManifestTool, p as AgentOptions, q as AgentRoute, r as AgentRouteContext, s as AgentRunInfo, t as AgentStreamEvent, u as AgentTurnMetadata, v as AgentsPluginOptions, w as ApiErrorContext, x as ApiErrorDecision, y as ApiErrorPolicy, z as ApprovalRequiredEvent, B as ArtifactChunkEvent, E as ArtifactStartEvent, F as BackgroundDelegation, I as BeforeToolCallContext, J as BudgetExceededError, K as BudgetOptions, N as CheckpointSavedEvent, O as CompiledContextWindow, P as ContextualTool, Q as CostBudgetExceededError, U as DEFAULT_MAX_ITERATIONS, V as DefineAgentConfig, W as DelegateFn, X as DelegateOptions, Y as DelegationError, Z as DoneEvent, _ as ErrorEvent, $ as FileEditEvent, a0 as GuardrailAction, a1 as GuardrailPhase, a2 as GuardrailResult, a3 as GuardrailViolationError, a4 as HitlDecision, a5 as InferAgentInput, a6 as InferAgentToolNames, a7 as IterationEvent, a8 as LLMCallContext, a9 as LoopFinishReason, aa as LoopOutcome, ab as LoopStrategyConfig, ac as MainLoopOptions, ad as McpApprovalSpec, ae as McpRegistryConfig, af as McpRequestContext, ag as McpSelection, ah as PartialToolCallEvent, ai as PolicyHandler, aj as ProcessInputContext, ak as ReflectionContext, al as ReflectionResult, am as ReflectionStrategyConfig, an as RunStartedEvent, ao as ScoreVerdict, ap as ScoredDelegation, aq as Scorer, ar as SdkAgentHandle, as as SdkMessage, at as Segment, au as SkillsRequestContext, av as SkillsSelection, aw as StateUpdateEvent, ax as TextDeltaEvent, ay as ThinkingEvent, az as TimeoutAction, aA as ToolCallEvent, aB as ToolCallVeto, aC as ToolHooks, aD as ToolHooksPlugin, aE as ToolResultEvent, aF as ToolWalkResult, aG as ToolboxOptions, aH as ToolboxWalkResult, aI as agentsPlugin, aJ as buildModelSelection, aK as compileAgentDefinition, aL as compileAgentModule, aM as compileContextWindow, aN as compileProjectContext, aO as compileSkills, aP as compileTools, aQ as createAgentExecutionContext, aR as createApiErrorHandler, aS as createSdkAgentStream, aT as createThinkTagExtractor, aU as createToolHooksPlugin, aV as delegate, aW as delegateBackground, aX as delegateWithScoring, aY as extractThinkTagStream, aZ as generateAgentManifest, a_ as generateAgentRoutes, a$ as isAgentContext, b0 as isAgentDefinition, b1 as isApprovalRequired, b2 as isDone, b3 as isError, b4 as isPartialToolCall, b5 as isTextDelta, b6 as isToolCall, b7 as isToolResult, b8 as ladderReflectionStrategy, b9 as loopStrategyConfigSchema, ba as mcpRegistry, bb as mcpToolApprovals, bc as noopReflectionStrategy, bd as presentUIMessageStream, be as projectContextMetadataOnlyKnobs, bf as reflectionStrategyConfigSchema, bg as resolveEnabledSkills, bh as resolveLoopStrategy, bi as resolveMcpServers, bj as runWithApiErrorHandling, bk as streamAgentResponse, bl as streamAgentUIMessages, bm as toAgentFactory, bn as translateSdkEvent } from './bridge-entry-Ddu3Ug_3.js';
4
3
  import { PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition, BudgetTracker, CustomTool, InlineSkill } from '@theokit/sdk';
4
+ export { Agent, CustomTool, Provider, SDKAgent, SessionRecord, Squad, Tool } from '@theokit/sdk';
5
5
  import { RetryOptions } from '@theokit/sdk/retry';
6
6
  import { CompressibleMessage } from '@theokit/sdk/compaction';
7
7
  export { CompressibleMessage } from '@theokit/sdk/compaction';
@@ -498,10 +498,16 @@ declare class ToolsCapability implements Capability {
498
498
  apply(draft: CompiledAgentOptionsDraft): void;
499
499
  }
500
500
  /**
501
- * Enables skills by name. FUNCTION, not class: it carries no behavior beyond assignment a class here
502
- * would be ceremony (the honest counter-example to "everything must be a class").
501
+ * Enables skills by name (or inline). M57: a CLASS now (was a factory function). Validation moves to
502
+ * the constructor fail-fast at authoring, the same place `ModelCapability`/`AgentConfigCapability`
503
+ * validate. The `apply` body (delegate + merge) is unchanged, so the compiled output is identical.
503
504
  */
504
- declare const skills: (entries: readonly (string | InlineSkill)[]) => Capability;
505
+ declare class SkillsCapability implements Capability {
506
+ #private;
507
+ readonly name = "skills";
508
+ constructor(entries: readonly (string | InlineSkill)[]);
509
+ apply(draft: CompiledAgentOptionsDraft): void;
510
+ }
505
511
 
506
512
  /**
507
513
  * M52 — resolution + composition. The registry is what unlocks FILE-BASED authoring (a config lists
@@ -531,51 +537,122 @@ declare class CapabilityPreset implements Capability {
531
537
  apply(draft: CompiledAgentOptionsDraft): void;
532
538
  }
533
539
 
540
+ /**
541
+ * M53 — the capabilities that replace the waist-bound agent decorators, one per field the decorator
542
+ * pipeline produces today (`docs/agents/decorator-to-capability.md` § A).
543
+ *
544
+ * M57 reverses ADR 0001 § 4 (which kept the pure-assignment ones as a factory function to avoid
545
+ * "13 near-identical classes"): the authoring surface is now 100% classes, aligned with the SDK's
546
+ * `X.create()`/class shape. The `FieldCapability` base keeps the assignment ones DRY (one line each);
547
+ * the behaviour-carrying ones are written out. Rationale in ADR 0005.
548
+ */
549
+ /**
550
+ * Base for a capability whose only job is to assign one waist field — no validation, no merge, no
551
+ * precedence. M57: this replaces the `fieldCapability(name, field)` factory function with a class, so
552
+ * the authoring surface is 100% classes (aligned with the SDK's `X.create()` and the existing
553
+ * `ModelCapability`). The subclasses below are one line each; the shared `apply` lives here (DRY).
554
+ * NOT the Template-Method the ADR-0001 refused — that was inheritance of variable *behaviour*
555
+ * (`shouldContinue`); here the base carries *data* (name/field) and `apply` is identical for all.
556
+ */
557
+ declare abstract class FieldCapability<K extends keyof CompiledAgentOptionsDraft> implements Capability {
558
+ private readonly value;
559
+ abstract readonly name: string;
560
+ protected abstract readonly field: K;
561
+ constructor(value: NonNullable<CompiledAgentOptionsDraft[K]>);
562
+ apply(draft: CompiledAgentOptionsDraft): void;
563
+ }
534
564
  /** `@Memory` → `memory`. */
535
- declare const memory: (value: NonNullable<MemoryOptions | _theokit_sdk.MemorySettings | undefined>) => Capability;
565
+ declare class MemoryCapability extends FieldCapability<'memory'> {
566
+ readonly name = "memory";
567
+ protected readonly field: "memory";
568
+ }
536
569
  /**
537
570
  * `@ContextWindow` → `context`. DELEGATES to `compileContextWindow`, which is the canonical
538
571
  * `ContextWindowOptions → ContextSettings` conversion (it also reports the metadata-only knobs).
539
572
  * Taking a pre-converted value here would duplicate that knowledge — the exact divergence the M52
540
573
  * zero-behavior proof caught in `skills`.
541
574
  */
542
- declare const contextWindow: (options: ContextWindowOptions) => Capability;
575
+ declare class ContextWindowCapability implements Capability {
576
+ private readonly options;
577
+ readonly name = "context-window";
578
+ constructor(options: ContextWindowOptions);
579
+ apply(draft: CompiledAgentOptionsDraft): void;
580
+ }
543
581
  /** `@ProjectContext` → `projectContext`. */
544
- declare const projectContext: (value: ProjectContextOptions) => Capability;
582
+ declare class ProjectContextCapability extends FieldCapability<'projectContext'> {
583
+ readonly name = "project-context";
584
+ protected readonly field: "projectContext";
585
+ }
545
586
  /** `@MCP` → `mcpServers`. */
546
- declare const mcpServers: (value: McpServersMap) => Capability;
587
+ declare class McpServersCapability extends FieldCapability<'mcpServers'> {
588
+ readonly name = "mcp";
589
+ protected readonly field: "mcpServers";
590
+ }
547
591
  /** `@Guardrails` → `guardrails`. */
548
- declare const guardrails: (value: readonly Guardrail[]) => Capability;
592
+ declare class GuardrailsCapability extends FieldCapability<'guardrails'> {
593
+ readonly name = "guardrails";
594
+ protected readonly field: "guardrails";
595
+ }
549
596
  /**
550
597
  * `@Checkpoint` → `checkpoint`. Carries the non-durable WARNING the metadata walk used to emit: only
551
598
  * `'filesystem'` selects the SDK's durable store, so any other storage cannot resume across
552
599
  * requests. The warning moves WITH the feature — a declared checkpoint that silently cannot resume
553
600
  * is exactly the kind of no-op this project refuses to ship.
554
601
  */
555
- declare const checkpoint: (options: CompiledAgentOptions["checkpoint"]) => Capability;
602
+ declare class CheckpointCapability implements Capability {
603
+ private readonly options;
604
+ readonly name = "checkpoint";
605
+ constructor(options: CompiledAgentOptions['checkpoint']);
606
+ apply(draft: CompiledAgentOptionsDraft): void;
607
+ }
556
608
  /**
557
609
  * `@HumanInTheLoop` → `hitl`, keyed `"<namespace>_<tool>"` — the same key `compileHitlGates` mints
558
610
  * via `toolRuntimeName`. The separator is `_`, not `.`: the dot is outside the charset the SDK
559
611
  * accepts, and a gate keyed with a dot silently failed to match its tool (theokit#145).
560
612
  */
561
- declare const humanInTheLoop: (value: Map<string, HumanInTheLoopOptions>) => Capability;
613
+ declare class HumanInTheLoopCapability extends FieldCapability<'hitl'> {
614
+ readonly name = "human-in-the-loop";
615
+ protected readonly field: "hitl";
616
+ }
562
617
  /**
563
618
  * `@SubAgents` → `agents`. MERGES instead of `setOnce`: `agents` is a pre-seeded collection on the
564
619
  * draft (`createDraft` gives it `{}`), so a `setOnce` would conflict against the seed itself — the
565
620
  * same trap the pre-seeded `stream` sprang in M52. Merging also lets a preset declare a baseline
566
621
  * child set that a call site extends.
567
622
  */
568
- declare const subAgents: (children: CompiledAgentOptions["agents"]) => Capability;
623
+ declare class SubAgentsCapability implements Capability {
624
+ private readonly children;
625
+ readonly name = "sub-agents";
626
+ constructor(children: CompiledAgentOptions['agents']);
627
+ apply(draft: CompiledAgentOptionsDraft): void;
628
+ }
569
629
  /**
570
630
  * `@Skills({ include, autoDiscover })` → `skills`. Delegates to `compileSkills` (same reason as
571
631
  * `contextWindow`). Distinct from the M52 `skills([...])`, which takes the plain name/inline list.
572
632
  */
573
- declare const skillsOptions: (options: SkillsOptions) => Capability;
633
+ declare class SkillsOptionsCapability implements Capability {
634
+ private readonly options;
635
+ readonly name = "skills";
636
+ constructor(options: SkillsOptions);
637
+ apply(draft: CompiledAgentOptionsDraft): void;
638
+ }
574
639
  /** Functional-path fields that had no decorator source — closing the gap list, not adding surface. */
575
- declare const settingSources: (value: readonly _theokit_sdk.SettingSource[]) => Capability;
576
- declare const plugins: (value: readonly unknown[]) => Capability;
577
- declare const runContext: (value: Record<string, unknown>) => Capability;
578
- declare const skillsResolver: (value: NonNullable<SkillsSelection | undefined>) => Capability;
640
+ declare class SettingSourcesCapability extends FieldCapability<'settingSources'> {
641
+ readonly name = "setting-sources";
642
+ protected readonly field: "settingSources";
643
+ }
644
+ declare class PluginsCapability extends FieldCapability<'plugins'> {
645
+ readonly name = "plugins";
646
+ protected readonly field: "plugins";
647
+ }
648
+ declare class RunContextCapability extends FieldCapability<'runContext'> {
649
+ readonly name = "run-context";
650
+ protected readonly field: "runContext";
651
+ }
652
+ declare class SkillsResolverCapability extends FieldCapability<'skillsResolver'> {
653
+ readonly name = "skills-resolver";
654
+ protected readonly field: "skillsResolver";
655
+ }
579
656
  /** The scalar agent config (name/route are HTTP concerns, never agent config). */
580
657
  interface AgentConfig {
581
658
  readonly systemPrompt?: CompiledAgentOptions['systemPrompt'];
@@ -872,4 +949,4 @@ declare class AcpClient {
872
949
  private handleServerRequest;
873
950
  }
874
951
 
875
- export { type A2AAuth, type A2ACapabilities, type A2ASkill, type A2AToolConfig, AcpClient, AcpMessageDecoder, type AcpTransport, type AgentCard, type AgentConfig, AgentConfigCapability, AgentManifestEntry, AgentRunner, AgentRunnerBuilder, type AgentRunnerRunOptions, ApprovalOptions, type BuildAgentCardOptions, type Capability, CapabilityConflictError, CapabilityPreset, CapabilityRegistry, type CompactionCallOptions, type CompactionStrategyConfig, CompiledAgentOptions, type CompiledAgentOptionsDraft, CompiledTool, ConfigurationError, type CostGuardOptions, DEFAULT_KEEP_TOKENS, DelegationResult, type FinalizedDraft, Guardrail, HumanInTheLoopOptions, LoopStrategy, MCP_PROTOCOL_VERSION, MainLoopCapability, MainLoopMeta, type McpJsonSchema, type McpServerInfo, type McpToolDescriptor, ModelCapability, type OutputModerationOptions, type PiiOptions, type PromptInjectionOptions, type ProvenanceEntry, ReasoningEffort, ReflectionStrategy, RoundStreamFactory, SkillsSelection, StreamEvent, type Summarize, type ToolDeclaration, ToolOptions, ToolboxCapability, type ToolboxSource, ToolsCapability, type TranscriptCompactionStrategy, UnknownCapabilityError, applyCapabilities, buildAgentCard, buildMcpToolDescriptors, checkpoint, compactionStrategyConfigSchema, contextWindow, costGuard, createA2ATool, createDraft, deriveConversationId, encodeAcpMessage, estimateTokens, guardrails, humanInTheLoop, mcpServerInfo, mcpServers, memory, moderateOutputStream, outputModeration, parseConversationId, piiDetector, plugins, projectContext, promptInjectionDetector, resolveCompactionStrategy, runContext, runInputGuards, runOutputGuards, setOnce, settingSources, skills, skillsOptions, skillsResolver, subAgents, tokenBudgetCompactionStrategy, unicodeNormalizer, wellKnownCardPath };
952
+ export { type A2AAuth, type A2ACapabilities, type A2ASkill, type A2AToolConfig, AcpClient, AcpMessageDecoder, type AcpTransport, type AgentCard, type AgentConfig, AgentConfigCapability, AgentManifestEntry, AgentRunner, AgentRunnerBuilder, type AgentRunnerRunOptions, ApprovalOptions, type BuildAgentCardOptions, type Capability, CapabilityConflictError, CapabilityPreset, CapabilityRegistry, CheckpointCapability, type CompactionCallOptions, type CompactionStrategyConfig, CompiledAgentOptions, type CompiledAgentOptionsDraft, CompiledTool, ConfigurationError, ContextWindowCapability, type CostGuardOptions, DEFAULT_KEEP_TOKENS, DelegationResult, FieldCapability, type FinalizedDraft, Guardrail, GuardrailsCapability, HumanInTheLoopCapability, HumanInTheLoopOptions, LoopStrategy, MCP_PROTOCOL_VERSION, MainLoopCapability, MainLoopMeta, type McpJsonSchema, type McpServerInfo, McpServersCapability, type McpToolDescriptor, MemoryCapability, ModelCapability, type OutputModerationOptions, type PiiOptions, PluginsCapability, ProjectContextCapability, type PromptInjectionOptions, type ProvenanceEntry, ReasoningEffort, ReflectionStrategy, RoundStreamFactory, RunContextCapability, SettingSourcesCapability, SkillsCapability, SkillsOptionsCapability, SkillsResolverCapability, StreamEvent, SubAgentsCapability, type Summarize, type ToolDeclaration, ToolOptions, ToolboxCapability, type ToolboxSource, ToolsCapability, type TranscriptCompactionStrategy, UnknownCapabilityError, applyCapabilities, buildAgentCard, buildMcpToolDescriptors, compactionStrategyConfigSchema, costGuard, createA2ATool, createDraft, deriveConversationId, encodeAcpMessage, estimateTokens, mcpServerInfo, moderateOutputStream, outputModeration, parseConversationId, piiDetector, promptInjectionDetector, resolveCompactionStrategy, runInputGuards, runOutputGuards, setOnce, tokenBudgetCompactionStrategy, unicodeNormalizer, wellKnownCardPath };