@theokit/sdk 2.9.0 → 2.10.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/eval.js CHANGED
@@ -3288,6 +3288,18 @@ async function writeVersionedJson(path, data2, currentVersion) {
3288
3288
  await atomicWriteJson(path, file);
3289
3289
  }
3290
3290
 
3291
+ // src/internal/plugins/enabled-names.ts
3292
+ function isPluginArray(plugins) {
3293
+ return Array.isArray(plugins);
3294
+ }
3295
+ function asPluginsSettings(plugins) {
3296
+ if (plugins === void 0) return void 0;
3297
+ return isPluginArray(plugins) ? void 0 : plugins;
3298
+ }
3299
+ function enabledPluginNames(plugins) {
3300
+ return asPluginsSettings(plugins)?.enabled ?? [];
3301
+ }
3302
+
3291
3303
  // src/internal/runtime/registry/agent-registry-store.ts
3292
3304
  var SCHEMA_VERSION = 1;
3293
3305
  var LEGACY_SCHEMA_VERSION_STRING = "1.0";
@@ -3301,7 +3313,9 @@ function stripSecretsFromOptions(options) {
3301
3313
  cloud: serializeCloud(options.cloud),
3302
3314
  memory: serializeMemory(options.memory),
3303
3315
  skills: serializeEnabledList(options.skills),
3304
- plugins: serializeEnabledList(options.plugins),
3316
+ // Code-`Plugin` objects are closures and cannot be persisted (like custom
3317
+ // tools); only the named-enable settings form is serialized.
3318
+ plugins: serializeEnabledList(asPluginsSettings(options.plugins)),
3305
3319
  context: serializeContext(options.context),
3306
3320
  providers: serializeProviders(options.providers),
3307
3321
  agents: serializeAgents(options.agents)
@@ -3609,8 +3623,9 @@ function serializeSkills(skills) {
3609
3623
  return { enabled: [...skills.enabled] };
3610
3624
  }
3611
3625
  function serializePlugins(plugins) {
3612
- if (plugins?.enabled === void 0 || plugins.enabled.length === 0) return void 0;
3613
- return { enabled: [...plugins.enabled] };
3626
+ const enabled = enabledPluginNames(plugins);
3627
+ if (enabled.length === 0) return void 0;
3628
+ return { enabled: [...enabled] };
3614
3629
  }
3615
3630
  function serializeMcp(mcpServers) {
3616
3631
  if (mcpServers === void 0) return void 0;
@@ -3793,11 +3808,8 @@ function defaultLocalTools(request) {
3793
3808
  tools.push(`mcp_${sanitizeMcpName(name)}_call`);
3794
3809
  }
3795
3810
  }
3796
- const plugins = request.agentOptions.plugins;
3797
- if (plugins?.enabled !== void 0) {
3798
- for (const _pluginName of plugins.enabled) {
3799
- tools.push("mcp_search_provider_web_search");
3800
- }
3811
+ for (const _pluginName of enabledPluginNames(request.agentOptions.plugins)) {
3812
+ tools.push("mcp_search_provider_web_search");
3801
3813
  }
3802
3814
  return tools;
3803
3815
  }
@@ -7040,7 +7052,7 @@ function resolveRoute(route, modelProvider, plugins) {
7040
7052
  if (modelName !== void 0) base.model = modelName;
7041
7053
  return base;
7042
7054
  }
7043
- if (plugins?.enabled !== void 0 && plugins.enabled.length > 0) {
7055
+ if (enabledPluginNames(plugins).length > 0) {
7044
7056
  return {
7045
7057
  capability: route.capability,
7046
7058
  provider: route.provider,
@@ -8043,7 +8055,7 @@ function bootstrapSubmanagers(args) {
8043
8055
  args.settingSourcesIncludeProject
8044
8056
  );
8045
8057
  }
8046
- const providerCount = (args.options.providers?.routes?.length ?? 0) + (args.options.plugins?.enabled?.length ?? 0);
8058
+ const providerCount = (args.options.providers?.routes?.length ?? 0) + enabledPluginNames(args.options.plugins).length;
8047
8059
  if (providerCount > 0 || args.options.providers !== void 0) {
8048
8060
  out.providers = new ProvidersManagerImpl(
8049
8061
  args.options.model,
@@ -8063,7 +8075,9 @@ function bootstrapSubmanagers(args) {
8063
8075
  if (args.options.plugins !== void 0 || args.settingSourcesIncludePlugins) {
8064
8076
  out.pluginsManager = new PluginsManager(
8065
8077
  args.workspaceCwd,
8066
- args.options.plugins?.enabled,
8078
+ // The array (code-`Plugin`) form has no named-enable list; `undefined`
8079
+ // here preserves "no filter / load all file-discovered plugins".
8080
+ asPluginsSettings(args.options.plugins)?.enabled,
8067
8081
  args.settingSourcesIncludePlugins,
8068
8082
  false,
8069
8083
  void 0
@@ -15355,7 +15369,7 @@ var Agent = class _Agent {
15355
15369
  const runtime = options.cloud !== void 0 ? "cloud" : "local";
15356
15370
  const span = telemetry.startSpan(SPAN_NAMES.AGENT_CREATE, {
15357
15371
  runtime,
15358
- pluginCount: options.plugins?.enabled?.length ?? 0
15372
+ pluginCount: enabledPluginNames(options.plugins).length
15359
15373
  });
15360
15374
  try {
15361
15375
  const agent = await runCreateUnderSpan(options, span);