@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.cjs CHANGED
@@ -3291,6 +3291,18 @@ async function writeVersionedJson(path, data2, currentVersion) {
3291
3291
  await atomicWriteJson(path, file);
3292
3292
  }
3293
3293
 
3294
+ // src/internal/plugins/enabled-names.ts
3295
+ function isPluginArray(plugins) {
3296
+ return Array.isArray(plugins);
3297
+ }
3298
+ function asPluginsSettings(plugins) {
3299
+ if (plugins === void 0) return void 0;
3300
+ return isPluginArray(plugins) ? void 0 : plugins;
3301
+ }
3302
+ function enabledPluginNames(plugins) {
3303
+ return asPluginsSettings(plugins)?.enabled ?? [];
3304
+ }
3305
+
3294
3306
  // src/internal/runtime/registry/agent-registry-store.ts
3295
3307
  var SCHEMA_VERSION = 1;
3296
3308
  var LEGACY_SCHEMA_VERSION_STRING = "1.0";
@@ -3304,7 +3316,9 @@ function stripSecretsFromOptions(options) {
3304
3316
  cloud: serializeCloud(options.cloud),
3305
3317
  memory: serializeMemory(options.memory),
3306
3318
  skills: serializeEnabledList(options.skills),
3307
- plugins: serializeEnabledList(options.plugins),
3319
+ // Code-`Plugin` objects are closures and cannot be persisted (like custom
3320
+ // tools); only the named-enable settings form is serialized.
3321
+ plugins: serializeEnabledList(asPluginsSettings(options.plugins)),
3308
3322
  context: serializeContext(options.context),
3309
3323
  providers: serializeProviders(options.providers),
3310
3324
  agents: serializeAgents(options.agents)
@@ -3612,8 +3626,9 @@ function serializeSkills(skills) {
3612
3626
  return { enabled: [...skills.enabled] };
3613
3627
  }
3614
3628
  function serializePlugins(plugins) {
3615
- if (plugins?.enabled === void 0 || plugins.enabled.length === 0) return void 0;
3616
- return { enabled: [...plugins.enabled] };
3629
+ const enabled = enabledPluginNames(plugins);
3630
+ if (enabled.length === 0) return void 0;
3631
+ return { enabled: [...enabled] };
3617
3632
  }
3618
3633
  function serializeMcp(mcpServers) {
3619
3634
  if (mcpServers === void 0) return void 0;
@@ -3796,11 +3811,8 @@ function defaultLocalTools(request) {
3796
3811
  tools.push(`mcp_${sanitizeMcpName(name)}_call`);
3797
3812
  }
3798
3813
  }
3799
- const plugins = request.agentOptions.plugins;
3800
- if (plugins?.enabled !== void 0) {
3801
- for (const _pluginName of plugins.enabled) {
3802
- tools.push("mcp_search_provider_web_search");
3803
- }
3814
+ for (const _pluginName of enabledPluginNames(request.agentOptions.plugins)) {
3815
+ tools.push("mcp_search_provider_web_search");
3804
3816
  }
3805
3817
  return tools;
3806
3818
  }
@@ -7043,7 +7055,7 @@ function resolveRoute(route, modelProvider, plugins) {
7043
7055
  if (modelName !== void 0) base.model = modelName;
7044
7056
  return base;
7045
7057
  }
7046
- if (plugins?.enabled !== void 0 && plugins.enabled.length > 0) {
7058
+ if (enabledPluginNames(plugins).length > 0) {
7047
7059
  return {
7048
7060
  capability: route.capability,
7049
7061
  provider: route.provider,
@@ -8046,7 +8058,7 @@ function bootstrapSubmanagers(args) {
8046
8058
  args.settingSourcesIncludeProject
8047
8059
  );
8048
8060
  }
8049
- const providerCount = (args.options.providers?.routes?.length ?? 0) + (args.options.plugins?.enabled?.length ?? 0);
8061
+ const providerCount = (args.options.providers?.routes?.length ?? 0) + enabledPluginNames(args.options.plugins).length;
8050
8062
  if (providerCount > 0 || args.options.providers !== void 0) {
8051
8063
  out.providers = new ProvidersManagerImpl(
8052
8064
  args.options.model,
@@ -8066,7 +8078,9 @@ function bootstrapSubmanagers(args) {
8066
8078
  if (args.options.plugins !== void 0 || args.settingSourcesIncludePlugins) {
8067
8079
  out.pluginsManager = new PluginsManager(
8068
8080
  args.workspaceCwd,
8069
- args.options.plugins?.enabled,
8081
+ // The array (code-`Plugin`) form has no named-enable list; `undefined`
8082
+ // here preserves "no filter / load all file-discovered plugins".
8083
+ asPluginsSettings(args.options.plugins)?.enabled,
8070
8084
  args.settingSourcesIncludePlugins,
8071
8085
  false,
8072
8086
  void 0
@@ -15358,7 +15372,7 @@ var Agent = class _Agent {
15358
15372
  const runtime = options.cloud !== void 0 ? "cloud" : "local";
15359
15373
  const span = telemetry.startSpan(SPAN_NAMES.AGENT_CREATE, {
15360
15374
  runtime,
15361
- pluginCount: options.plugins?.enabled?.length ?? 0
15375
+ pluginCount: enabledPluginNames(options.plugins).length
15362
15376
  });
15363
15377
  try {
15364
15378
  const agent = await runCreateUnderSpan(options, span);