@theokit/sdk 2.9.0 → 2.11.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.
@@ -847,6 +847,120 @@ interface SDKProvider {
847
847
  setupSchema: object;
848
848
  }
849
849
 
850
+ /**
851
+ * ProviderProfile + ApiMode types (T3.1, ADR D105).
852
+ *
853
+ * Profile is **data-only** — no methods. Adding a provider is declaring an
854
+ * object literal; the Transport layer (D106) consumes `apiMode` to pick
855
+ * the HTTP dialect.
856
+ *
857
+ * @public
858
+ */
859
+ type ApiMode = "chat_completions" | "anthropic_messages" | "responses_api" | "bedrock" | "bedrock_anthropic";
860
+ type AuthType = "api_key" | "oauth_device_code" | "oauth_external" | "aws_sdk" | "aws_bearer" | "gcp_oauth" | "none";
861
+ interface ProviderProfile {
862
+ name: string;
863
+ apiMode: ApiMode;
864
+ aliases?: ReadonlyArray<string>;
865
+ displayName?: string;
866
+ description?: string;
867
+ signupUrl?: string;
868
+ envVars: ReadonlyArray<string>;
869
+ authType: AuthType;
870
+ baseUrl: string;
871
+ modelsUrl?: string;
872
+ hostname?: string;
873
+ fallbackModels: ReadonlyArray<string>;
874
+ extraHeaders?: Record<string, string>;
875
+ bodyOverrides?: Record<string, unknown>;
876
+ }
877
+
878
+ type HookName = "pre_tool_call" | "post_tool_call" | "pre_llm_call" | "post_llm_call" | "on_session_start" | "on_session_end" | "transform_tool_result" | "transform_llm_output" | "pre_user_send" | "post_assistant_reply";
879
+ interface PreToolCallContext {
880
+ name: string;
881
+ args: Record<string, unknown>;
882
+ agentId: string;
883
+ runId: string;
884
+ }
885
+ interface PreToolCallDecision {
886
+ block: true;
887
+ message: string;
888
+ }
889
+ /**
890
+ * Context passed to `pre_user_send` hook handlers (ADR D145).
891
+ *
892
+ * @public
893
+ */
894
+ interface PreUserSendContext {
895
+ prompt: string;
896
+ agentId: string;
897
+ runId: string;
898
+ /** Caller-supplied memory context, flowing through from `AgentOptions.memoryContext`. */
899
+ memoryContext?: MemoryContext;
900
+ /** Forwarded `AbortSignal` so adapter recall HTTP can be cancelled mid-flight (EC-H). */
901
+ signal?: AbortSignal;
902
+ }
903
+ /**
904
+ * Optional result returned by `pre_user_send` handlers. The agent loop
905
+ * concatenates `recalledContext` from all handlers and injects it as a
906
+ * `<memory-context>...</memory-context>` block before the user prompt.
907
+ *
908
+ * @public
909
+ */
910
+ interface PreUserSendResult {
911
+ recalledContext?: string;
912
+ }
913
+ /**
914
+ * Context passed to `post_assistant_reply` hook handlers (ADR D145).
915
+ * Fire-and-forget — exceptions are caught and surfaced to stderr; the
916
+ * caller's `wait()` never blocks on this dispatch.
917
+ *
918
+ * @public
919
+ */
920
+ interface PostAssistantReplyContext {
921
+ prompt: string;
922
+ reply: string;
923
+ agentId: string;
924
+ runId: string;
925
+ memoryContext?: MemoryContext;
926
+ }
927
+ type HookHandler = (ctx: unknown) => unknown | Promise<unknown>;
928
+ type CommandHandler = (args: Record<string, unknown>) => Promise<string> | string;
929
+ interface CommandOptions {
930
+ description?: string;
931
+ }
932
+ interface PluginContext {
933
+ /** Register a custom tool. Equivalent to passing in `AgentOptions.tools`. */
934
+ registerTool(tool: CustomTool): void;
935
+ /** Register a slash-command-style handler. Consumed by CLI/bot wrappers; NOT used by the agent loop. */
936
+ registerCommand(name: string, handler: CommandHandler, opts?: CommandOptions): void;
937
+ /** Attach a hook handler. `pre_tool_call` supports veto via `PreToolCallDecision`. */
938
+ on(hook: HookName, handler: HookHandler): void;
939
+ /** Inject a user/system message into the next agent turn. v1 supports only `on_session_start` context. */
940
+ injectMessage(content: string, role?: "user" | "system"): void;
941
+ }
942
+ interface BasePlugin {
943
+ name: string;
944
+ version: string;
945
+ }
946
+ type Plugin = (BasePlugin & {
947
+ kind: "general";
948
+ register: (ctx: PluginContext) => void | Promise<void>;
949
+ }) | (BasePlugin & {
950
+ kind: "model-provider";
951
+ profile: ProviderProfile;
952
+ }) | (BasePlugin & {
953
+ kind: "memory";
954
+ createProvider: MemoryProviderFactory;
955
+ });
956
+ /**
957
+ * Identity helper for plugin authors. TS-only convenience — preserves
958
+ * inferred type without forcing manual `Plugin` annotation.
959
+ *
960
+ * @public
961
+ */
962
+ declare function definePlugin<P extends Plugin>(p: P): P;
963
+
850
964
  /**
851
965
  * Which on-disk settings layers a local agent loads.
852
966
  *
@@ -1149,8 +1263,19 @@ interface AgentOptions {
1149
1263
  context?: ContextSettings;
1150
1264
  /** Provider routing configuration. See `agent.providers`. */
1151
1265
  providers?: ProviderRoutingSettings;
1152
- /** Plugins to enable. Plugin sources must also be active via `local.settingSources`. */
1153
- plugins?: PluginsSettings;
1266
+ /**
1267
+ * Plugins for this agent, in one of two forms:
1268
+ *
1269
+ * - **Named-enable settings** — `{ enabled: ["name", ...] }`. Selects which
1270
+ * file-discovered plugin providers (under `.theokit/plugins/`) are active.
1271
+ * Plugin sources must also be active via `local.settingSources`.
1272
+ * - **Code `Plugin` objects** — an array of `Plugin` instances, e.g.
1273
+ * `plugins: [Handoff.asPlugin({ ... })]`. These are registered directly by
1274
+ * the runtime (`extractCodePlugins`); no `settingSources` entry is needed.
1275
+ *
1276
+ * The two forms are mutually exclusive — pass one or the other.
1277
+ */
1278
+ plugins?: PluginsSettings | readonly Plugin[];
1154
1279
  /** Skills configuration. See `agent.skills`. */
1155
1280
  skills?: SkillsSettings;
1156
1281
  /** Memory configuration. Persists durable facts; auto-recalled on send. */
@@ -1866,4 +1991,4 @@ declare class Cron {
1866
1991
  static status(_options?: CronStartOptions): Promise<CronSchedulerStatus>;
1867
1992
  }
1868
1993
 
1869
- export { type MemoryAdapter as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type ContextManagerKind as D, type ContextSnapshot as E, type ContextSource as F, type GetAgentOptions as G, type ContextSourceStatus as H, Cron as I, type CronCreateOptions as J, type CronGetOptions as K, type LocalOptions as L, type MemorySettings as M, type CronJob as N, type CronJobStatus as O, type ProviderRoutingSettings as P, type CronListOptions as Q, type CronOperationOptions as R, type SystemPromptResolver as S, type CronRunOptions as T, type CronRuntime as U, type CronSchedulerStatus as V, type CronStartOptions as W, type GoalEvent as X, type GoalOptions as Y, type GoalResult as Z, type InvalidateCacheOptions as _, type AgentDefinition as a, type MemoryAdapterCapabilities as a0, type MemoryFact as a1, type MemoryProviderHandle as a2, type MemoryProviderInitOptions as a3, type MemoryRevision as a4, type MemoryToolSchema as a5, type MemoryTurnMessage as a6, type PersonalityPreset as a7, type ProviderCapability as a8, type ProviderRoute as a9, type RecordSessionSummaryArgs as aa, type ResolvedProviderRoute as ab, type RunUntilIterator as ac, type SDKAgentPlugins as ad, type SDKAgentSkills as ae, type SDKArtifact as af, type SDKContextManager as ag, type SDKPluginMetadata as ah, type SDKProvidersManager as ai, type SettingSource as aj, type SystemPromptContext as ak, type SystemPromptMemoryFact as al, type SystemPromptSkillRef as am, type TelemetrySettings as an, type ContextSettings as b, type PluginsSettings as c, type SkillsSettings as d, type SDKAgent as e, type ListAgentsOptions as f, type ListResult as g, type SDKAgentInfo as h, type ListRunsOptions as i, type GetRunOptions as j, type AgentOperationOptions as k, type MemoryContext as l, type ConversationStorageAdapter as m, type StoredMessage as n, type MemoryProvider as o, type MemoryId as p, type SDKProvider as q, type ActiveMemoryPassArgs as r, type ActiveMemoryPassResult as s, type AgentMemory as t, type BudgetCheck as u, type BudgetTotal as v, type BudgetUsageEvent as w, type CloudEnv as x, type CloudRepo as y, type ContextBudget as z };
1994
+ export { type GoalResult as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type CloudRepo as D, type ContextBudget as E, type ContextManagerKind as F, type GetAgentOptions as G, type ContextSnapshot as H, type ContextSource as I, type ContextSourceStatus as J, Cron as K, type LocalOptions as L, type MemorySettings as M, type CronCreateOptions as N, type CronGetOptions as O, type ProviderRoutingSettings as P, type CronJob as Q, type CronJobStatus as R, type SystemPromptResolver as S, type CronListOptions as T, type CronOperationOptions as U, type CronRunOptions as V, type CronRuntime as W, type CronSchedulerStatus as X, type CronStartOptions as Y, type GoalEvent as Z, type GoalOptions as _, type AgentDefinition as a, type HookName as a0, type InvalidateCacheOptions as a1, type MemoryAdapter as a2, type MemoryAdapterCapabilities as a3, type MemoryContext as a4, type MemoryFact as a5, type MemoryProviderHandle as a6, type MemoryProviderInitOptions as a7, type MemoryRevision as a8, type MemoryToolSchema as a9, type MemoryTurnMessage as aa, type PersonalityPreset as ab, type PluginContext as ac, type PostAssistantReplyContext as ad, type PreToolCallContext as ae, type PreUserSendContext as af, type PreUserSendResult as ag, type ProviderCapability as ah, type ProviderRoute as ai, type RecordSessionSummaryArgs as aj, type ResolvedProviderRoute as ak, type RunUntilIterator as al, type SDKAgentPlugins as am, type SDKAgentSkills as an, type SDKArtifact as ao, type SDKContextManager as ap, type SDKPluginMetadata as aq, type SDKProvidersManager as ar, type SettingSource as as, type SystemPromptContext as at, type SystemPromptMemoryFact as au, type SystemPromptSkillRef as av, type TelemetrySettings as aw, definePlugin as ax, type ContextSettings as b, type PluginsSettings as c, type SkillsSettings as d, type SDKAgent as e, type ListAgentsOptions as f, type ListResult as g, type SDKAgentInfo as h, type ListRunsOptions as i, type GetRunOptions as j, type AgentOperationOptions as k, type ProviderProfile as l, type Plugin as m, type ConversationStorageAdapter as n, type StoredMessage as o, type MemoryProvider as p, type MemoryId as q, type PreToolCallDecision as r, type SDKProvider as s, type ActiveMemoryPassArgs as t, type ActiveMemoryPassResult as u, type AgentMemory as v, type BudgetCheck as w, type BudgetTotal as x, type BudgetUsageEvent as y, type CloudEnv as z };
@@ -847,6 +847,120 @@ interface SDKProvider {
847
847
  setupSchema: object;
848
848
  }
849
849
 
850
+ /**
851
+ * ProviderProfile + ApiMode types (T3.1, ADR D105).
852
+ *
853
+ * Profile is **data-only** — no methods. Adding a provider is declaring an
854
+ * object literal; the Transport layer (D106) consumes `apiMode` to pick
855
+ * the HTTP dialect.
856
+ *
857
+ * @public
858
+ */
859
+ type ApiMode = "chat_completions" | "anthropic_messages" | "responses_api" | "bedrock" | "bedrock_anthropic";
860
+ type AuthType = "api_key" | "oauth_device_code" | "oauth_external" | "aws_sdk" | "aws_bearer" | "gcp_oauth" | "none";
861
+ interface ProviderProfile {
862
+ name: string;
863
+ apiMode: ApiMode;
864
+ aliases?: ReadonlyArray<string>;
865
+ displayName?: string;
866
+ description?: string;
867
+ signupUrl?: string;
868
+ envVars: ReadonlyArray<string>;
869
+ authType: AuthType;
870
+ baseUrl: string;
871
+ modelsUrl?: string;
872
+ hostname?: string;
873
+ fallbackModels: ReadonlyArray<string>;
874
+ extraHeaders?: Record<string, string>;
875
+ bodyOverrides?: Record<string, unknown>;
876
+ }
877
+
878
+ type HookName = "pre_tool_call" | "post_tool_call" | "pre_llm_call" | "post_llm_call" | "on_session_start" | "on_session_end" | "transform_tool_result" | "transform_llm_output" | "pre_user_send" | "post_assistant_reply";
879
+ interface PreToolCallContext {
880
+ name: string;
881
+ args: Record<string, unknown>;
882
+ agentId: string;
883
+ runId: string;
884
+ }
885
+ interface PreToolCallDecision {
886
+ block: true;
887
+ message: string;
888
+ }
889
+ /**
890
+ * Context passed to `pre_user_send` hook handlers (ADR D145).
891
+ *
892
+ * @public
893
+ */
894
+ interface PreUserSendContext {
895
+ prompt: string;
896
+ agentId: string;
897
+ runId: string;
898
+ /** Caller-supplied memory context, flowing through from `AgentOptions.memoryContext`. */
899
+ memoryContext?: MemoryContext;
900
+ /** Forwarded `AbortSignal` so adapter recall HTTP can be cancelled mid-flight (EC-H). */
901
+ signal?: AbortSignal;
902
+ }
903
+ /**
904
+ * Optional result returned by `pre_user_send` handlers. The agent loop
905
+ * concatenates `recalledContext` from all handlers and injects it as a
906
+ * `<memory-context>...</memory-context>` block before the user prompt.
907
+ *
908
+ * @public
909
+ */
910
+ interface PreUserSendResult {
911
+ recalledContext?: string;
912
+ }
913
+ /**
914
+ * Context passed to `post_assistant_reply` hook handlers (ADR D145).
915
+ * Fire-and-forget — exceptions are caught and surfaced to stderr; the
916
+ * caller's `wait()` never blocks on this dispatch.
917
+ *
918
+ * @public
919
+ */
920
+ interface PostAssistantReplyContext {
921
+ prompt: string;
922
+ reply: string;
923
+ agentId: string;
924
+ runId: string;
925
+ memoryContext?: MemoryContext;
926
+ }
927
+ type HookHandler = (ctx: unknown) => unknown | Promise<unknown>;
928
+ type CommandHandler = (args: Record<string, unknown>) => Promise<string> | string;
929
+ interface CommandOptions {
930
+ description?: string;
931
+ }
932
+ interface PluginContext {
933
+ /** Register a custom tool. Equivalent to passing in `AgentOptions.tools`. */
934
+ registerTool(tool: CustomTool): void;
935
+ /** Register a slash-command-style handler. Consumed by CLI/bot wrappers; NOT used by the agent loop. */
936
+ registerCommand(name: string, handler: CommandHandler, opts?: CommandOptions): void;
937
+ /** Attach a hook handler. `pre_tool_call` supports veto via `PreToolCallDecision`. */
938
+ on(hook: HookName, handler: HookHandler): void;
939
+ /** Inject a user/system message into the next agent turn. v1 supports only `on_session_start` context. */
940
+ injectMessage(content: string, role?: "user" | "system"): void;
941
+ }
942
+ interface BasePlugin {
943
+ name: string;
944
+ version: string;
945
+ }
946
+ type Plugin = (BasePlugin & {
947
+ kind: "general";
948
+ register: (ctx: PluginContext) => void | Promise<void>;
949
+ }) | (BasePlugin & {
950
+ kind: "model-provider";
951
+ profile: ProviderProfile;
952
+ }) | (BasePlugin & {
953
+ kind: "memory";
954
+ createProvider: MemoryProviderFactory;
955
+ });
956
+ /**
957
+ * Identity helper for plugin authors. TS-only convenience — preserves
958
+ * inferred type without forcing manual `Plugin` annotation.
959
+ *
960
+ * @public
961
+ */
962
+ declare function definePlugin<P extends Plugin>(p: P): P;
963
+
850
964
  /**
851
965
  * Which on-disk settings layers a local agent loads.
852
966
  *
@@ -1149,8 +1263,19 @@ interface AgentOptions {
1149
1263
  context?: ContextSettings;
1150
1264
  /** Provider routing configuration. See `agent.providers`. */
1151
1265
  providers?: ProviderRoutingSettings;
1152
- /** Plugins to enable. Plugin sources must also be active via `local.settingSources`. */
1153
- plugins?: PluginsSettings;
1266
+ /**
1267
+ * Plugins for this agent, in one of two forms:
1268
+ *
1269
+ * - **Named-enable settings** — `{ enabled: ["name", ...] }`. Selects which
1270
+ * file-discovered plugin providers (under `.theokit/plugins/`) are active.
1271
+ * Plugin sources must also be active via `local.settingSources`.
1272
+ * - **Code `Plugin` objects** — an array of `Plugin` instances, e.g.
1273
+ * `plugins: [Handoff.asPlugin({ ... })]`. These are registered directly by
1274
+ * the runtime (`extractCodePlugins`); no `settingSources` entry is needed.
1275
+ *
1276
+ * The two forms are mutually exclusive — pass one or the other.
1277
+ */
1278
+ plugins?: PluginsSettings | readonly Plugin[];
1154
1279
  /** Skills configuration. See `agent.skills`. */
1155
1280
  skills?: SkillsSettings;
1156
1281
  /** Memory configuration. Persists durable facts; auto-recalled on send. */
@@ -1866,4 +1991,4 @@ declare class Cron {
1866
1991
  static status(_options?: CronStartOptions): Promise<CronSchedulerStatus>;
1867
1992
  }
1868
1993
 
1869
- export { type MemoryAdapter as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type ContextManagerKind as D, type ContextSnapshot as E, type ContextSource as F, type GetAgentOptions as G, type ContextSourceStatus as H, Cron as I, type CronCreateOptions as J, type CronGetOptions as K, type LocalOptions as L, type MemorySettings as M, type CronJob as N, type CronJobStatus as O, type ProviderRoutingSettings as P, type CronListOptions as Q, type CronOperationOptions as R, type SystemPromptResolver as S, type CronRunOptions as T, type CronRuntime as U, type CronSchedulerStatus as V, type CronStartOptions as W, type GoalEvent as X, type GoalOptions as Y, type GoalResult as Z, type InvalidateCacheOptions as _, type AgentDefinition as a, type MemoryAdapterCapabilities as a0, type MemoryFact as a1, type MemoryProviderHandle as a2, type MemoryProviderInitOptions as a3, type MemoryRevision as a4, type MemoryToolSchema as a5, type MemoryTurnMessage as a6, type PersonalityPreset as a7, type ProviderCapability as a8, type ProviderRoute as a9, type RecordSessionSummaryArgs as aa, type ResolvedProviderRoute as ab, type RunUntilIterator as ac, type SDKAgentPlugins as ad, type SDKAgentSkills as ae, type SDKArtifact as af, type SDKContextManager as ag, type SDKPluginMetadata as ah, type SDKProvidersManager as ai, type SettingSource as aj, type SystemPromptContext as ak, type SystemPromptMemoryFact as al, type SystemPromptSkillRef as am, type TelemetrySettings as an, type ContextSettings as b, type PluginsSettings as c, type SkillsSettings as d, type SDKAgent as e, type ListAgentsOptions as f, type ListResult as g, type SDKAgentInfo as h, type ListRunsOptions as i, type GetRunOptions as j, type AgentOperationOptions as k, type MemoryContext as l, type ConversationStorageAdapter as m, type StoredMessage as n, type MemoryProvider as o, type MemoryId as p, type SDKProvider as q, type ActiveMemoryPassArgs as r, type ActiveMemoryPassResult as s, type AgentMemory as t, type BudgetCheck as u, type BudgetTotal as v, type BudgetUsageEvent as w, type CloudEnv as x, type CloudRepo as y, type ContextBudget as z };
1994
+ export { type GoalResult as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type CloudRepo as D, type ContextBudget as E, type ContextManagerKind as F, type GetAgentOptions as G, type ContextSnapshot as H, type ContextSource as I, type ContextSourceStatus as J, Cron as K, type LocalOptions as L, type MemorySettings as M, type CronCreateOptions as N, type CronGetOptions as O, type ProviderRoutingSettings as P, type CronJob as Q, type CronJobStatus as R, type SystemPromptResolver as S, type CronListOptions as T, type CronOperationOptions as U, type CronRunOptions as V, type CronRuntime as W, type CronSchedulerStatus as X, type CronStartOptions as Y, type GoalEvent as Z, type GoalOptions as _, type AgentDefinition as a, type HookName as a0, type InvalidateCacheOptions as a1, type MemoryAdapter as a2, type MemoryAdapterCapabilities as a3, type MemoryContext as a4, type MemoryFact as a5, type MemoryProviderHandle as a6, type MemoryProviderInitOptions as a7, type MemoryRevision as a8, type MemoryToolSchema as a9, type MemoryTurnMessage as aa, type PersonalityPreset as ab, type PluginContext as ac, type PostAssistantReplyContext as ad, type PreToolCallContext as ae, type PreUserSendContext as af, type PreUserSendResult as ag, type ProviderCapability as ah, type ProviderRoute as ai, type RecordSessionSummaryArgs as aj, type ResolvedProviderRoute as ak, type RunUntilIterator as al, type SDKAgentPlugins as am, type SDKAgentSkills as an, type SDKArtifact as ao, type SDKContextManager as ap, type SDKPluginMetadata as aq, type SDKProvidersManager as ar, type SettingSource as as, type SystemPromptContext as at, type SystemPromptMemoryFact as au, type SystemPromptSkillRef as av, type TelemetrySettings as aw, definePlugin as ax, type ContextSettings as b, type PluginsSettings as c, type SkillsSettings as d, type SDKAgent as e, type ListAgentsOptions as f, type ListResult as g, type SDKAgentInfo as h, type ListRunsOptions as i, type GetRunOptions as j, type AgentOperationOptions as k, type ProviderProfile as l, type Plugin as m, type ConversationStorageAdapter as n, type StoredMessage as o, type MemoryProvider as p, type MemoryId as q, type PreToolCallDecision as r, type SDKProvider as s, type ActiveMemoryPassArgs as t, type ActiveMemoryPassResult as u, type AgentMemory as v, type BudgetCheck as w, type BudgetTotal as x, type BudgetUsageEvent as y, type CloudEnv as z };
package/dist/cron.cjs CHANGED
@@ -3296,6 +3296,18 @@ async function writeVersionedJson(path, data2, currentVersion) {
3296
3296
  await atomicWriteJson(path, file);
3297
3297
  }
3298
3298
 
3299
+ // src/internal/plugins/enabled-names.ts
3300
+ function isPluginArray(plugins) {
3301
+ return Array.isArray(plugins);
3302
+ }
3303
+ function asPluginsSettings(plugins) {
3304
+ if (plugins === void 0) return void 0;
3305
+ return isPluginArray(plugins) ? void 0 : plugins;
3306
+ }
3307
+ function enabledPluginNames(plugins) {
3308
+ return asPluginsSettings(plugins)?.enabled ?? [];
3309
+ }
3310
+
3299
3311
  // src/internal/runtime/registry/agent-registry-store.ts
3300
3312
  var SCHEMA_VERSION = 1;
3301
3313
  var LEGACY_SCHEMA_VERSION_STRING = "1.0";
@@ -3309,7 +3321,9 @@ function stripSecretsFromOptions(options) {
3309
3321
  cloud: serializeCloud(options.cloud),
3310
3322
  memory: serializeMemory(options.memory),
3311
3323
  skills: serializeEnabledList(options.skills),
3312
- plugins: serializeEnabledList(options.plugins),
3324
+ // Code-`Plugin` objects are closures and cannot be persisted (like custom
3325
+ // tools); only the named-enable settings form is serialized.
3326
+ plugins: serializeEnabledList(asPluginsSettings(options.plugins)),
3313
3327
  context: serializeContext(options.context),
3314
3328
  providers: serializeProviders(options.providers),
3315
3329
  agents: serializeAgents(options.agents)
@@ -3617,8 +3631,9 @@ function serializeSkills(skills) {
3617
3631
  return { enabled: [...skills.enabled] };
3618
3632
  }
3619
3633
  function serializePlugins(plugins) {
3620
- if (plugins?.enabled === void 0 || plugins.enabled.length === 0) return void 0;
3621
- return { enabled: [...plugins.enabled] };
3634
+ const enabled = enabledPluginNames(plugins);
3635
+ if (enabled.length === 0) return void 0;
3636
+ return { enabled: [...enabled] };
3622
3637
  }
3623
3638
  function serializeMcp(mcpServers) {
3624
3639
  if (mcpServers === void 0) return void 0;
@@ -3801,11 +3816,8 @@ function defaultLocalTools(request) {
3801
3816
  tools.push(`mcp_${sanitizeMcpName(name)}_call`);
3802
3817
  }
3803
3818
  }
3804
- const plugins = request.agentOptions.plugins;
3805
- if (plugins?.enabled !== void 0) {
3806
- for (const _pluginName of plugins.enabled) {
3807
- tools.push("mcp_search_provider_web_search");
3808
- }
3819
+ for (const _pluginName of enabledPluginNames(request.agentOptions.plugins)) {
3820
+ tools.push("mcp_search_provider_web_search");
3809
3821
  }
3810
3822
  return tools;
3811
3823
  }
@@ -7048,7 +7060,7 @@ function resolveRoute(route, modelProvider, plugins) {
7048
7060
  if (modelName !== void 0) base.model = modelName;
7049
7061
  return base;
7050
7062
  }
7051
- if (plugins?.enabled !== void 0 && plugins.enabled.length > 0) {
7063
+ if (enabledPluginNames(plugins).length > 0) {
7052
7064
  return {
7053
7065
  capability: route.capability,
7054
7066
  provider: route.provider,
@@ -8051,7 +8063,7 @@ function bootstrapSubmanagers(args) {
8051
8063
  args.settingSourcesIncludeProject
8052
8064
  );
8053
8065
  }
8054
- const providerCount = (args.options.providers?.routes?.length ?? 0) + (args.options.plugins?.enabled?.length ?? 0);
8066
+ const providerCount = (args.options.providers?.routes?.length ?? 0) + enabledPluginNames(args.options.plugins).length;
8055
8067
  if (providerCount > 0 || args.options.providers !== void 0) {
8056
8068
  out.providers = new ProvidersManagerImpl(
8057
8069
  args.options.model,
@@ -8071,7 +8083,9 @@ function bootstrapSubmanagers(args) {
8071
8083
  if (args.options.plugins !== void 0 || args.settingSourcesIncludePlugins) {
8072
8084
  out.pluginsManager = new PluginsManager(
8073
8085
  args.workspaceCwd,
8074
- args.options.plugins?.enabled,
8086
+ // The array (code-`Plugin`) form has no named-enable list; `undefined`
8087
+ // here preserves "no filter / load all file-discovered plugins".
8088
+ asPluginsSettings(args.options.plugins)?.enabled,
8075
8089
  args.settingSourcesIncludePlugins,
8076
8090
  false,
8077
8091
  void 0
@@ -15363,7 +15377,7 @@ var Agent = class _Agent {
15363
15377
  const runtime = options.cloud !== void 0 ? "cloud" : "local";
15364
15378
  const span = telemetry.startSpan(SPAN_NAMES.AGENT_CREATE, {
15365
15379
  runtime,
15366
- pluginCount: options.plugins?.enabled?.length ?? 0
15380
+ pluginCount: enabledPluginNames(options.plugins).length
15367
15381
  });
15368
15382
  try {
15369
15383
  const agent = await runCreateUnderSpan(options, span);