@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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ac3f77d: @theokit/sdk: resolveModelCapabilities catalog gains cheap OpenRouter slugs (qwen3-coder, deepseek v4-flash/v3.2, glm-4.7-flash, gemini-2.5-flash-lite/pro) so they resolve real context windows instead of the 4096 default. @theokit/sdk-tools: new createGenericHttpSearchAdapter (env-keyed generic HTTP WebSearchCallback alongside Brave); buildEnvContext gains git-branch detection + an injectable clock. @theokit/sdk-cache: ships createLexicalEmbedder (zero-dependency token-hash lexical embedder built-in).
8
+
9
+ ## 2.10.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 5bd2f9c: @theokit/sdk: `shouldCompact`/`ShouldCompactInput` gains an optional `maxOutput` output-reserve term (`estimated >= contextWindow - buffer - (maxOutput ?? 0)`), defaulting to today's behavior. `AgentOptions.plugins` now also accepts an array of code `Plugin` objects (matching the runtime + docs), not only `{ enabled }`. @theokit/sdk-tools: `renderToolList` gains an optional `{ mode: "full" | "summary" | "names" }` — `"full"` (default) is the existing `<tools>` XML; `"summary"` renders `- name: <first sentence>`; `"names"` renders `- name`.
14
+
3
15
  ## 2.9.0
4
16
 
5
17
  ### Minor Changes
@@ -1192,6 +1192,22 @@ var init_schema_version = __esm({
1192
1192
  init_atomic_write();
1193
1193
  }
1194
1194
  });
1195
+
1196
+ // src/internal/plugins/enabled-names.ts
1197
+ function isPluginArray(plugins) {
1198
+ return Array.isArray(plugins);
1199
+ }
1200
+ function asPluginsSettings(plugins) {
1201
+ if (plugins === void 0) return void 0;
1202
+ return isPluginArray(plugins) ? void 0 : plugins;
1203
+ }
1204
+ function enabledPluginNames(plugins) {
1205
+ return asPluginsSettings(plugins)?.enabled ?? [];
1206
+ }
1207
+ var init_enabled_names = __esm({
1208
+ "src/internal/plugins/enabled-names.ts"() {
1209
+ }
1210
+ });
1195
1211
  function stripSecretsFromOptions(options) {
1196
1212
  return assignDefined({
1197
1213
  name: options.name,
@@ -1201,7 +1217,9 @@ function stripSecretsFromOptions(options) {
1201
1217
  cloud: serializeCloud(options.cloud),
1202
1218
  memory: serializeMemory(options.memory),
1203
1219
  skills: serializeEnabledList(options.skills),
1204
- plugins: serializeEnabledList(options.plugins),
1220
+ // Code-`Plugin` objects are closures and cannot be persisted (like custom
1221
+ // tools); only the named-enable settings form is serialized.
1222
+ plugins: serializeEnabledList(asPluginsSettings(options.plugins)),
1205
1223
  context: serializeContext(options.context),
1206
1224
  providers: serializeProviders(options.providers),
1207
1225
  agents: serializeAgents(options.agents)
@@ -1363,6 +1381,7 @@ var init_agent_registry_store = __esm({
1363
1381
  "src/internal/runtime/registry/agent-registry-store.ts"() {
1364
1382
  init_cwd_mutex();
1365
1383
  init_schema_version();
1384
+ init_enabled_names();
1366
1385
  SCHEMA_VERSION = 1;
1367
1386
  LEGACY_SCHEMA_VERSION_STRING = "1.0";
1368
1387
  REGISTRY_RELATIVE_PATH = path.join(".theokit", "agents", "registry.json");
@@ -1529,8 +1548,9 @@ function serializeSkills(skills) {
1529
1548
  return { enabled: [...skills.enabled] };
1530
1549
  }
1531
1550
  function serializePlugins(plugins) {
1532
- if (plugins?.enabled === void 0 || plugins.enabled.length === 0) return void 0;
1533
- return { enabled: [...plugins.enabled] };
1551
+ const enabled = enabledPluginNames(plugins);
1552
+ if (enabled.length === 0) return void 0;
1553
+ return { enabled: [...enabled] };
1534
1554
  }
1535
1555
  function serializeMcp(mcpServers) {
1536
1556
  if (mcpServers === void 0) return void 0;
@@ -1606,6 +1626,7 @@ function serializeMemory2(memory) {
1606
1626
  }
1607
1627
  var init_cloud_config_serializer = __esm({
1608
1628
  "src/internal/runtime/cloud/cloud-config-serializer.ts"() {
1629
+ init_enabled_names();
1609
1630
  }
1610
1631
  });
1611
1632
 
@@ -1722,11 +1743,8 @@ function defaultLocalTools(request) {
1722
1743
  tools.push(`mcp_${sanitizeMcpName(name)}_call`);
1723
1744
  }
1724
1745
  }
1725
- const plugins = request.agentOptions.plugins;
1726
- if (plugins?.enabled !== void 0) {
1727
- for (const _pluginName of plugins.enabled) {
1728
- tools.push("mcp_search_provider_web_search");
1729
- }
1746
+ for (const _pluginName of enabledPluginNames(request.agentOptions.plugins)) {
1747
+ tools.push("mcp_search_provider_web_search");
1730
1748
  }
1731
1749
  return tools;
1732
1750
  }
@@ -1736,6 +1754,7 @@ function sanitizeMcpName(name) {
1736
1754
  var init_fixture_events = __esm({
1737
1755
  "src/internal/runtime/fixtures/fixture-events.ts"() {
1738
1756
  init_ids();
1757
+ init_enabled_names();
1739
1758
  }
1740
1759
  });
1741
1760
  function legacyMemoryJsonPath(cwd, config) {
@@ -5449,7 +5468,7 @@ function resolveRoute(route, modelProvider, plugins) {
5449
5468
  if (modelName !== void 0) base.model = modelName;
5450
5469
  return base;
5451
5470
  }
5452
- if (plugins?.enabled !== void 0 && plugins.enabled.length > 0) {
5471
+ if (enabledPluginNames(plugins).length > 0) {
5453
5472
  return {
5454
5473
  capability: route.capability,
5455
5474
  provider: route.provider,
@@ -5473,6 +5492,7 @@ function defaultModelForProvider(provider) {
5473
5492
  var ProvidersManagerImpl;
5474
5493
  var init_providers_manager = __esm({
5475
5494
  "src/internal/runtime/config/providers-manager.ts"() {
5495
+ init_enabled_names();
5476
5496
  ProvidersManagerImpl = class {
5477
5497
  constructor(model, providers, plugins) {
5478
5498
  this.model = model;
@@ -6545,7 +6565,7 @@ function bootstrapSubmanagers(args) {
6545
6565
  args.settingSourcesIncludeProject
6546
6566
  );
6547
6567
  }
6548
- const providerCount = (args.options.providers?.routes?.length ?? 0) + (args.options.plugins?.enabled?.length ?? 0);
6568
+ const providerCount = (args.options.providers?.routes?.length ?? 0) + enabledPluginNames(args.options.plugins).length;
6549
6569
  if (providerCount > 0 || args.options.providers !== void 0) {
6550
6570
  out.providers = new ProvidersManagerImpl(
6551
6571
  args.options.model,
@@ -6565,7 +6585,9 @@ function bootstrapSubmanagers(args) {
6565
6585
  if (args.options.plugins !== void 0 || args.settingSourcesIncludePlugins) {
6566
6586
  out.pluginsManager = new PluginsManager(
6567
6587
  args.workspaceCwd,
6568
- args.options.plugins?.enabled,
6588
+ // The array (code-`Plugin`) form has no named-enable list; `undefined`
6589
+ // here preserves "no filter / load all file-discovered plugins".
6590
+ asPluginsSettings(args.options.plugins)?.enabled,
6569
6591
  args.settingSourcesIncludePlugins,
6570
6592
  false,
6571
6593
  void 0
@@ -6577,6 +6599,7 @@ function bootstrapSubmanagers(args) {
6577
6599
  }
6578
6600
  var init_local_agent_bootstrap = __esm({
6579
6601
  "src/internal/runtime/local-agent/local-agent-bootstrap.ts"() {
6602
+ init_enabled_names();
6580
6603
  init_providers_manager();
6581
6604
  init_context_manager();
6582
6605
  init_plugins_manager();
@@ -16453,6 +16476,7 @@ var init_agent = __esm({
16453
16476
  init_agent_builder();
16454
16477
  init_agent_helpers();
16455
16478
  init_errors();
16479
+ init_enabled_names();
16456
16480
  init_agent_factory_registry();
16457
16481
  init_agent_registry();
16458
16482
  init_live_agent_registry();
@@ -16494,7 +16518,7 @@ var init_agent = __esm({
16494
16518
  const runtime = options.cloud !== void 0 ? "cloud" : "local";
16495
16519
  const span = telemetry.startSpan(SPAN_NAMES.AGENT_CREATE, {
16496
16520
  runtime,
16497
- pluginCount: options.plugins?.enabled?.length ?? 0
16521
+ pluginCount: enabledPluginNames(options.plugins).length
16498
16522
  });
16499
16523
  try {
16500
16524
  const agent = await runCreateUnderSpan(options, span);