@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.
package/dist/index.cjs CHANGED
@@ -5874,6 +5874,18 @@ async function writeVersionedJson(path, data2, currentVersion) {
5874
5874
  await atomicWriteJson(path, file);
5875
5875
  }
5876
5876
 
5877
+ // src/internal/plugins/enabled-names.ts
5878
+ function isPluginArray(plugins) {
5879
+ return Array.isArray(plugins);
5880
+ }
5881
+ function asPluginsSettings(plugins) {
5882
+ if (plugins === void 0) return void 0;
5883
+ return isPluginArray(plugins) ? void 0 : plugins;
5884
+ }
5885
+ function enabledPluginNames(plugins) {
5886
+ return asPluginsSettings(plugins)?.enabled ?? [];
5887
+ }
5888
+
5877
5889
  // src/internal/runtime/registry/agent-registry-store.ts
5878
5890
  var SCHEMA_VERSION = 1;
5879
5891
  var LEGACY_SCHEMA_VERSION_STRING = "1.0";
@@ -5887,7 +5899,9 @@ function stripSecretsFromOptions(options) {
5887
5899
  cloud: serializeCloud(options.cloud),
5888
5900
  memory: serializeMemory(options.memory),
5889
5901
  skills: serializeEnabledList(options.skills),
5890
- plugins: serializeEnabledList(options.plugins),
5902
+ // Code-`Plugin` objects are closures and cannot be persisted (like custom
5903
+ // tools); only the named-enable settings form is serialized.
5904
+ plugins: serializeEnabledList(asPluginsSettings(options.plugins)),
5891
5905
  context: serializeContext(options.context),
5892
5906
  providers: serializeProviders(options.providers),
5893
5907
  agents: serializeAgents(options.agents)
@@ -6195,8 +6209,9 @@ function serializeSkills(skills) {
6195
6209
  return { enabled: [...skills.enabled] };
6196
6210
  }
6197
6211
  function serializePlugins(plugins) {
6198
- if (plugins?.enabled === void 0 || plugins.enabled.length === 0) return void 0;
6199
- return { enabled: [...plugins.enabled] };
6212
+ const enabled = enabledPluginNames(plugins);
6213
+ if (enabled.length === 0) return void 0;
6214
+ return { enabled: [...enabled] };
6200
6215
  }
6201
6216
  function serializeMcp(mcpServers) {
6202
6217
  if (mcpServers === void 0) return void 0;
@@ -6379,11 +6394,8 @@ function defaultLocalTools(request) {
6379
6394
  tools.push(`mcp_${sanitizeMcpName(name)}_call`);
6380
6395
  }
6381
6396
  }
6382
- const plugins = request.agentOptions.plugins;
6383
- if (plugins?.enabled !== void 0) {
6384
- for (const _pluginName of plugins.enabled) {
6385
- tools.push("mcp_search_provider_web_search");
6386
- }
6397
+ for (const _pluginName of enabledPluginNames(request.agentOptions.plugins)) {
6398
+ tools.push("mcp_search_provider_web_search");
6387
6399
  }
6388
6400
  return tools;
6389
6401
  }
@@ -9503,7 +9515,7 @@ function resolveRoute(route, modelProvider, plugins) {
9503
9515
  if (modelName !== void 0) base.model = modelName;
9504
9516
  return base;
9505
9517
  }
9506
- if (plugins?.enabled !== void 0 && plugins.enabled.length > 0) {
9518
+ if (enabledPluginNames(plugins).length > 0) {
9507
9519
  return {
9508
9520
  capability: route.capability,
9509
9521
  provider: route.provider,
@@ -10508,7 +10520,7 @@ function bootstrapSubmanagers(args) {
10508
10520
  args.settingSourcesIncludeProject
10509
10521
  );
10510
10522
  }
10511
- const providerCount = (args.options.providers?.routes?.length ?? 0) + (args.options.plugins?.enabled?.length ?? 0);
10523
+ const providerCount = (args.options.providers?.routes?.length ?? 0) + enabledPluginNames(args.options.plugins).length;
10512
10524
  if (providerCount > 0 || args.options.providers !== void 0) {
10513
10525
  out.providers = new ProvidersManagerImpl(
10514
10526
  args.options.model,
@@ -10528,7 +10540,9 @@ function bootstrapSubmanagers(args) {
10528
10540
  if (args.options.plugins !== void 0 || args.settingSourcesIncludePlugins) {
10529
10541
  out.pluginsManager = new PluginsManager(
10530
10542
  args.workspaceCwd,
10531
- args.options.plugins?.enabled,
10543
+ // The array (code-`Plugin`) form has no named-enable list; `undefined`
10544
+ // here preserves "no filter / load all file-discovered plugins".
10545
+ asPluginsSettings(args.options.plugins)?.enabled,
10532
10546
  args.settingSourcesIncludePlugins,
10533
10547
  false,
10534
10548
  void 0
@@ -16888,7 +16902,7 @@ var Agent = class _Agent {
16888
16902
  const runtime = options.cloud !== void 0 ? "cloud" : "local";
16889
16903
  const span = telemetry.startSpan(SPAN_NAMES.AGENT_CREATE, {
16890
16904
  runtime,
16891
- pluginCount: options.plugins?.enabled?.length ?? 0
16905
+ pluginCount: enabledPluginNames(options.plugins).length
16892
16906
  });
16893
16907
  try {
16894
16908
  const agent = await runCreateUnderSpan(options, span);