@theokit/sdk 2.8.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/a2a/index.js CHANGED
@@ -1189,6 +1189,22 @@ var init_schema_version = __esm({
1189
1189
  init_atomic_write();
1190
1190
  }
1191
1191
  });
1192
+
1193
+ // src/internal/plugins/enabled-names.ts
1194
+ function isPluginArray(plugins) {
1195
+ return Array.isArray(plugins);
1196
+ }
1197
+ function asPluginsSettings(plugins) {
1198
+ if (plugins === void 0) return void 0;
1199
+ return isPluginArray(plugins) ? void 0 : plugins;
1200
+ }
1201
+ function enabledPluginNames(plugins) {
1202
+ return asPluginsSettings(plugins)?.enabled ?? [];
1203
+ }
1204
+ var init_enabled_names = __esm({
1205
+ "src/internal/plugins/enabled-names.ts"() {
1206
+ }
1207
+ });
1192
1208
  function stripSecretsFromOptions(options) {
1193
1209
  return assignDefined({
1194
1210
  name: options.name,
@@ -1198,7 +1214,9 @@ function stripSecretsFromOptions(options) {
1198
1214
  cloud: serializeCloud(options.cloud),
1199
1215
  memory: serializeMemory(options.memory),
1200
1216
  skills: serializeEnabledList(options.skills),
1201
- plugins: serializeEnabledList(options.plugins),
1217
+ // Code-`Plugin` objects are closures and cannot be persisted (like custom
1218
+ // tools); only the named-enable settings form is serialized.
1219
+ plugins: serializeEnabledList(asPluginsSettings(options.plugins)),
1202
1220
  context: serializeContext(options.context),
1203
1221
  providers: serializeProviders(options.providers),
1204
1222
  agents: serializeAgents(options.agents)
@@ -1360,6 +1378,7 @@ var init_agent_registry_store = __esm({
1360
1378
  "src/internal/runtime/registry/agent-registry-store.ts"() {
1361
1379
  init_cwd_mutex();
1362
1380
  init_schema_version();
1381
+ init_enabled_names();
1363
1382
  SCHEMA_VERSION = 1;
1364
1383
  LEGACY_SCHEMA_VERSION_STRING = "1.0";
1365
1384
  REGISTRY_RELATIVE_PATH = join(".theokit", "agents", "registry.json");
@@ -1526,8 +1545,9 @@ function serializeSkills(skills) {
1526
1545
  return { enabled: [...skills.enabled] };
1527
1546
  }
1528
1547
  function serializePlugins(plugins) {
1529
- if (plugins?.enabled === void 0 || plugins.enabled.length === 0) return void 0;
1530
- return { enabled: [...plugins.enabled] };
1548
+ const enabled = enabledPluginNames(plugins);
1549
+ if (enabled.length === 0) return void 0;
1550
+ return { enabled: [...enabled] };
1531
1551
  }
1532
1552
  function serializeMcp(mcpServers) {
1533
1553
  if (mcpServers === void 0) return void 0;
@@ -1603,6 +1623,7 @@ function serializeMemory2(memory) {
1603
1623
  }
1604
1624
  var init_cloud_config_serializer = __esm({
1605
1625
  "src/internal/runtime/cloud/cloud-config-serializer.ts"() {
1626
+ init_enabled_names();
1606
1627
  }
1607
1628
  });
1608
1629
 
@@ -1719,11 +1740,8 @@ function defaultLocalTools(request) {
1719
1740
  tools.push(`mcp_${sanitizeMcpName(name)}_call`);
1720
1741
  }
1721
1742
  }
1722
- const plugins = request.agentOptions.plugins;
1723
- if (plugins?.enabled !== void 0) {
1724
- for (const _pluginName of plugins.enabled) {
1725
- tools.push("mcp_search_provider_web_search");
1726
- }
1743
+ for (const _pluginName of enabledPluginNames(request.agentOptions.plugins)) {
1744
+ tools.push("mcp_search_provider_web_search");
1727
1745
  }
1728
1746
  return tools;
1729
1747
  }
@@ -1733,6 +1751,7 @@ function sanitizeMcpName(name) {
1733
1751
  var init_fixture_events = __esm({
1734
1752
  "src/internal/runtime/fixtures/fixture-events.ts"() {
1735
1753
  init_ids();
1754
+ init_enabled_names();
1736
1755
  }
1737
1756
  });
1738
1757
  function legacyMemoryJsonPath(cwd, config) {
@@ -5446,7 +5465,7 @@ function resolveRoute(route, modelProvider, plugins) {
5446
5465
  if (modelName !== void 0) base.model = modelName;
5447
5466
  return base;
5448
5467
  }
5449
- if (plugins?.enabled !== void 0 && plugins.enabled.length > 0) {
5468
+ if (enabledPluginNames(plugins).length > 0) {
5450
5469
  return {
5451
5470
  capability: route.capability,
5452
5471
  provider: route.provider,
@@ -5470,6 +5489,7 @@ function defaultModelForProvider(provider) {
5470
5489
  var ProvidersManagerImpl;
5471
5490
  var init_providers_manager = __esm({
5472
5491
  "src/internal/runtime/config/providers-manager.ts"() {
5492
+ init_enabled_names();
5473
5493
  ProvidersManagerImpl = class {
5474
5494
  constructor(model, providers, plugins) {
5475
5495
  this.model = model;
@@ -6542,7 +6562,7 @@ function bootstrapSubmanagers(args) {
6542
6562
  args.settingSourcesIncludeProject
6543
6563
  );
6544
6564
  }
6545
- const providerCount = (args.options.providers?.routes?.length ?? 0) + (args.options.plugins?.enabled?.length ?? 0);
6565
+ const providerCount = (args.options.providers?.routes?.length ?? 0) + enabledPluginNames(args.options.plugins).length;
6546
6566
  if (providerCount > 0 || args.options.providers !== void 0) {
6547
6567
  out.providers = new ProvidersManagerImpl(
6548
6568
  args.options.model,
@@ -6562,7 +6582,9 @@ function bootstrapSubmanagers(args) {
6562
6582
  if (args.options.plugins !== void 0 || args.settingSourcesIncludePlugins) {
6563
6583
  out.pluginsManager = new PluginsManager(
6564
6584
  args.workspaceCwd,
6565
- args.options.plugins?.enabled,
6585
+ // The array (code-`Plugin`) form has no named-enable list; `undefined`
6586
+ // here preserves "no filter / load all file-discovered plugins".
6587
+ asPluginsSettings(args.options.plugins)?.enabled,
6566
6588
  args.settingSourcesIncludePlugins,
6567
6589
  false,
6568
6590
  void 0
@@ -6574,6 +6596,7 @@ function bootstrapSubmanagers(args) {
6574
6596
  }
6575
6597
  var init_local_agent_bootstrap = __esm({
6576
6598
  "src/internal/runtime/local-agent/local-agent-bootstrap.ts"() {
6599
+ init_enabled_names();
6577
6600
  init_providers_manager();
6578
6601
  init_context_manager();
6579
6602
  init_plugins_manager();
@@ -16450,6 +16473,7 @@ var init_agent = __esm({
16450
16473
  init_agent_builder();
16451
16474
  init_agent_helpers();
16452
16475
  init_errors();
16476
+ init_enabled_names();
16453
16477
  init_agent_factory_registry();
16454
16478
  init_agent_registry();
16455
16479
  init_live_agent_registry();
@@ -16491,7 +16515,7 @@ var init_agent = __esm({
16491
16515
  const runtime = options.cloud !== void 0 ? "cloud" : "local";
16492
16516
  const span = telemetry.startSpan(SPAN_NAMES.AGENT_CREATE, {
16493
16517
  runtime,
16494
- pluginCount: options.plugins?.enabled?.length ?? 0
16518
+ pluginCount: enabledPluginNames(options.plugins).length
16495
16519
  });
16496
16520
  try {
16497
16521
  const agent = await runCreateUnderSpan(options, span);