@theokit/agents 0.44.1 → 0.44.2

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.
@@ -196,6 +196,8 @@ interface CompiledAgentOptions {
196
196
  * (merged with `cwd`, decoupled from inline skills). Absent ⇒ inline (code) config only.
197
197
  */
198
198
  settingSources?: readonly SettingSource[];
199
+ /** Code `Plugin` objects forwarded to `Agent.create({ plugins })` (lifecycle-hook seam). */
200
+ plugins?: readonly unknown[];
199
201
  tools: CompiledTool[];
200
202
  agents: Record<string, CompiledSubAgent>;
201
203
  memory?: MemoryOptions;
@@ -585,6 +587,8 @@ interface DefineAgentConfig<TInput extends z.ZodType = z.ZodType> {
585
587
  * + execution (G2 / ADR-0040); theokit only wires this into `Agent.create({ local.settingSources })`.
586
588
  */
587
589
  settingSources?: readonly SettingSource[];
590
+ /** Code `Plugin` objects forwarded to `Agent.create({ plugins })` (lifecycle-hook seam). */
591
+ plugins?: readonly unknown[];
588
592
  /**
589
593
  * MCP servers available to the agent — the builder-chain equivalent of the `@MCP` class
590
594
  * decorator. Each key is a server name; the value is the server configuration. Forwarded
@@ -927,6 +931,14 @@ interface AgentBuilder<TInput extends z.ZodType | UnsetMarker = UnsetMarker, TMo
927
931
  * shell-executing hooks from `.theokit/hooks.json` — opt-in because `.theokit/` is your own repo.
928
932
  */
929
933
  settingSources(sources: readonly SettingSource[]): AgentBuilder<TInput, TModel, TContext, TTools>;
934
+ /**
935
+ * Register code `Plugin` objects for this agent — the builder-chain equivalent of
936
+ * `Agent.create({ plugins })`. This is how a fluent-built agent gets LIFECYCLE HOOKS in code:
937
+ * `plugins([createToolHooksPlugin({ beforeToolCall, afterToolCall })])` lets `beforeToolCall`
938
+ * VETO a tool call (`{ block, message }`) before it runs. Without this the fluent builder had no
939
+ * way to reach the SDK's plugin seam (file-based `.theokit/hooks.json` is the other path).
940
+ */
941
+ plugins(list: readonly unknown[]): AgentBuilder<TInput, TModel, TContext, TTools>;
930
942
  /**
931
943
  * Declare MCP (Model Context Protocol) servers available to this agent — the builder-chain
932
944
  * equivalent of the `@MCP` class decorator. Each key is a server name; the value is its config
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 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';
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-DQJMvdRy.js';
2
2
  import '@theokit/http';
3
3
  import './types-DVA4LQsA.js';
4
4
  import '@theokit/sdk';
package/dist/bridge.js CHANGED
@@ -47,7 +47,7 @@ import {
47
47
  translateToUIMessageStream,
48
48
  validateUniqueRoutes,
49
49
  walkAgentMetadata
50
- } from "./chunk-6WOLHCZB.js";
50
+ } from "./chunk-XRPFOFYF.js";
51
51
  import "./chunk-NERDIS45.js";
52
52
  import "./chunk-7QVYU63E.js";
53
53
  export {
@@ -562,6 +562,9 @@ function compileAgentDefinition(def) {
562
562
  ...def.settingSources !== void 0 ? {
563
563
  settingSources: def.settingSources
564
564
  } : {},
565
+ ...def.plugins !== void 0 ? {
566
+ plugins: def.plugins
567
+ } : {},
565
568
  // MCP — builder/`defineAgent` servers converge on the same `mcpServers` field the `@MCP`
566
569
  // decorator path populates; the SDK adapter forwards it to `Agent.create({ mcpServers })`.
567
570
  ...def.mcpServers !== void 0 ? {
@@ -923,6 +926,10 @@ function assembleM8CreateOptions(compiled) {
923
926
  options.skills = compiled.skills;
924
927
  applied.push("skills");
925
928
  }
929
+ if (compiled.plugins) {
930
+ options.plugins = compiled.plugins;
931
+ applied.push("plugins");
932
+ }
926
933
  const settingSources = resolveSettingSources(compiled);
927
934
  if (settingSources) {
928
935
  options.local = {
@@ -1097,7 +1104,12 @@ __name(withLeakedDialectRecovery, "withLeakedDialectRecovery");
1097
1104
  function buildExtraCreateOptions(overrides, compiled) {
1098
1105
  const recoverLeakedToolCalls = overrides.recoverLeakedToolCalls ?? compiled.recoverLeakedToolCalls ?? false;
1099
1106
  const extra = {};
1100
- if (overrides.plugins !== void 0) extra.plugins = overrides.plugins;
1107
+ if (overrides.plugins !== void 0) {
1108
+ extra.plugins = Array.isArray(overrides.plugins) && Array.isArray(compiled.plugins) ? [
1109
+ ...compiled.plugins,
1110
+ ...overrides.plugins
1111
+ ] : overrides.plugins;
1112
+ }
1101
1113
  if (overrides.providers !== void 0) {
1102
1114
  extra.providers = recoverLeakedToolCalls ? withLeakedDialectRecovery(overrides.providers) : overrides.providers;
1103
1115
  }
@@ -1689,6 +1701,10 @@ function makeBuilder(config) {
1689
1701
  ...config,
1690
1702
  settingSources: sources
1691
1703
  }), "settingSources"),
1704
+ plugins: /* @__PURE__ */ __name((list) => makeBuilder({
1705
+ ...config,
1706
+ plugins: list
1707
+ }), "plugins"),
1692
1708
  mcp: /* @__PURE__ */ __name((servers) => makeBuilder({
1693
1709
  ...config,
1694
1710
  mcpServers: servers
@@ -3069,4 +3085,4 @@ export {
3069
3085
  generateAgentManifest,
3070
3086
  agentsPlugin
3071
3087
  };
3072
- //# sourceMappingURL=chunk-6WOLHCZB.js.map
3088
+ //# sourceMappingURL=chunk-XRPFOFYF.js.map