@theokit/sdk 5.1.0 → 5.2.1

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/dist/{agent-ARLOD4JX.cjs → agent-GACKKINM.cjs} +7 -7
  3. package/dist/{agent-ARLOD4JX.cjs.map → agent-GACKKINM.cjs.map} +1 -1
  4. package/dist/{agent-N6WJ54ML.js → agent-VUNM33WJ.js} +6 -6
  5. package/dist/{agent-N6WJ54ML.js.map → agent-VUNM33WJ.js.map} +1 -1
  6. package/dist/{chunk-OYD3U3LY.js → chunk-43H4EBS2.js} +7 -7
  7. package/dist/{chunk-OYD3U3LY.js.map → chunk-43H4EBS2.js.map} +1 -1
  8. package/dist/{chunk-AW6F6HZR.js → chunk-AI4MXACC.js} +3 -3
  9. package/dist/{chunk-AW6F6HZR.js.map → chunk-AI4MXACC.js.map} +1 -1
  10. package/dist/{chunk-D3CCY3A2.cjs → chunk-DEJCKB65.cjs} +39 -39
  11. package/dist/{chunk-D3CCY3A2.cjs.map → chunk-DEJCKB65.cjs.map} +1 -1
  12. package/dist/{chunk-OQRGVTQF.js → chunk-DLFWMJE3.js} +3 -3
  13. package/dist/{chunk-OQRGVTQF.js.map → chunk-DLFWMJE3.js.map} +1 -1
  14. package/dist/{chunk-NYQ3IS7K.cjs → chunk-DWB3CN46.cjs} +8 -3
  15. package/dist/chunk-DWB3CN46.cjs.map +1 -0
  16. package/dist/{chunk-QYLZQ43D.cjs → chunk-IQBDR5YZ.cjs} +5 -5
  17. package/dist/{chunk-QYLZQ43D.cjs.map → chunk-IQBDR5YZ.cjs.map} +1 -1
  18. package/dist/{chunk-67SBTGMA.cjs → chunk-PEAOQMWE.cjs} +4 -4
  19. package/dist/{chunk-67SBTGMA.cjs.map → chunk-PEAOQMWE.cjs.map} +1 -1
  20. package/dist/{chunk-WMWEI3NS.js → chunk-RP3VXJMA.js} +8 -3
  21. package/dist/chunk-RP3VXJMA.js.map +1 -0
  22. package/dist/{chunk-KGANQYP7.cjs → chunk-SSIRPWWD.cjs} +5 -5
  23. package/dist/{chunk-KGANQYP7.cjs.map → chunk-SSIRPWWD.cjs.map} +1 -1
  24. package/dist/{chunk-XU6MLSC6.js → chunk-WHTMFN4Q.js} +3 -3
  25. package/dist/{chunk-XU6MLSC6.js.map → chunk-WHTMFN4Q.js.map} +1 -1
  26. package/dist/{context-4QOEWRDF.cjs → context-3YMZDEX5.cjs} +7 -7
  27. package/dist/{context-4QOEWRDF.cjs.map → context-3YMZDEX5.cjs.map} +1 -1
  28. package/dist/context-XNREEC7M.js +6 -0
  29. package/dist/{context-Z3CFTT3H.js.map → context-XNREEC7M.js.map} +1 -1
  30. package/dist/cron.cjs +6 -6
  31. package/dist/cron.js +5 -5
  32. package/dist/eval.cjs +5 -5
  33. package/dist/eval.js +4 -4
  34. package/dist/index.cjs +64 -21
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.cts +66 -1
  37. package/dist/index.d.ts +66 -1
  38. package/dist/index.js +51 -9
  39. package/dist/index.js.map +1 -1
  40. package/dist/internal/persistence/index.cjs +4 -4
  41. package/dist/internal/persistence/index.js +1 -1
  42. package/dist/internal/runtime/compat/foreign-config-sources.d.ts +16 -6
  43. package/dist/subagents-loader-7G76XOZU.cjs +16 -0
  44. package/dist/{subagents-loader-GEHYCMEX.cjs.map → subagents-loader-7G76XOZU.cjs.map} +1 -1
  45. package/dist/subagents-loader-PAZVOZHI.js +7 -0
  46. package/dist/{subagents-loader-DOBTTICM.js.map → subagents-loader-PAZVOZHI.js.map} +1 -1
  47. package/dist/subagents-loader.cjs +3 -3
  48. package/dist/subagents-loader.js +2 -2
  49. package/docs/error-codes.md +2 -1
  50. package/docs/harness-capability-map.md +4 -1
  51. package/package.json +1 -1
  52. package/dist/chunk-NYQ3IS7K.cjs.map +0 -1
  53. package/dist/chunk-WMWEI3NS.js.map +0 -1
  54. package/dist/context-Z3CFTT3H.js +0 -6
  55. package/dist/subagents-loader-DOBTTICM.js +0 -7
  56. package/dist/subagents-loader-GEHYCMEX.cjs +0 -16
package/dist/eval.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { shellEscapePosix, LocalSandbox } from './chunk-O6USDERH.js';
2
- import { openRouterMemoryEmbeddingProviderAdapter } from './chunk-OYD3U3LY.js';
2
+ import { openRouterMemoryEmbeddingProviderAdapter } from './chunk-43H4EBS2.js';
3
3
  import './chunk-K2VMFZQ5.js';
4
4
  import './chunk-AWINL3ZC.js';
5
5
  import { getTracer } from './chunk-K2BQQ445.js';
6
6
  import './chunk-7SZAV6QG.js';
7
- import './chunk-AW6F6HZR.js';
7
+ import './chunk-AI4MXACC.js';
8
8
  import './chunk-2SFBB54R.js';
9
9
  import './chunk-55GB6JYQ.js';
10
10
  import './chunk-H73MEMQB.js';
@@ -43,8 +43,8 @@ export { JsonlParseError, loadJsonl } from './chunk-TA3K7SBK.js';
43
43
  import './chunk-Q5EWJPRY.js';
44
44
  import './chunk-EIQFAOFD.js';
45
45
  import './chunk-3JHIFQ4I.js';
46
- import './chunk-OQRGVTQF.js';
47
- import './chunk-WMWEI3NS.js';
46
+ import './chunk-DLFWMJE3.js';
47
+ import './chunk-RP3VXJMA.js';
48
48
  import './chunk-JNAA4G4H.js';
49
49
  import './chunk-6M2OIS4Y.js';
50
50
  import './chunk-R7WIIPUR.js';
package/dist/index.cjs CHANGED
@@ -9,13 +9,13 @@ require('./chunk-7JJ3A6AT.cjs');
9
9
  var chunk4HS6FFGL_cjs = require('./chunk-4HS6FFGL.cjs');
10
10
  require('./chunk-4A3SKJ53.cjs');
11
11
  require('./chunk-VTYY7XL5.cjs');
12
- var chunk67SBTGMA_cjs = require('./chunk-67SBTGMA.cjs');
13
- var chunkD3CCY3A2_cjs = require('./chunk-D3CCY3A2.cjs');
12
+ var chunkPEAOQMWE_cjs = require('./chunk-PEAOQMWE.cjs');
13
+ var chunkDEJCKB65_cjs = require('./chunk-DEJCKB65.cjs');
14
14
  var chunkKVSAY6NZ_cjs = require('./chunk-KVSAY6NZ.cjs');
15
15
  require('./chunk-Y2KYR2ED.cjs');
16
16
  require('./chunk-BUUUWQMB.cjs');
17
17
  require('./chunk-Z2JFX372.cjs');
18
- require('./chunk-KGANQYP7.cjs');
18
+ require('./chunk-SSIRPWWD.cjs');
19
19
  require('./chunk-BV2MWEMV.cjs');
20
20
  require('./chunk-D6POWE7E.cjs');
21
21
  require('./chunk-GHX4P3V2.cjs');
@@ -53,8 +53,8 @@ require('./chunk-BJUJT5ED.cjs');
53
53
  var chunkZF2LDKQQ_cjs = require('./chunk-ZF2LDKQQ.cjs');
54
54
  var chunkHCT4HPCL_cjs = require('./chunk-HCT4HPCL.cjs');
55
55
  var chunkJLRLCBJ4_cjs = require('./chunk-JLRLCBJ4.cjs');
56
- require('./chunk-QYLZQ43D.cjs');
57
- require('./chunk-NYQ3IS7K.cjs');
56
+ require('./chunk-IQBDR5YZ.cjs');
57
+ require('./chunk-DWB3CN46.cjs');
58
58
  require('./chunk-HW7SEELD.cjs');
59
59
  var chunkATT276RD_cjs = require('./chunk-ATT276RD.cjs');
60
60
  var chunk3EE6LVWT_cjs = require('./chunk-3EE6LVWT.cjs');
@@ -74,8 +74,8 @@ var path = require('path');
74
74
  // src/agent-factory.ts
75
75
  function createAgentFactory(common) {
76
76
  return {
77
- forSession: (agentId, overrides) => chunkD3CCY3A2_cjs.Agent.create(mergeAgentOptions(common, overrides, agentId)),
78
- getOrCreate: (agentId, overrides) => chunkD3CCY3A2_cjs.Agent.getOrCreate(agentId, mergeAgentOptions(common, overrides, agentId))
77
+ forSession: (agentId, overrides) => chunkDEJCKB65_cjs.Agent.create(mergeAgentOptions(common, overrides, agentId)),
78
+ getOrCreate: (agentId, overrides) => chunkDEJCKB65_cjs.Agent.getOrCreate(agentId, mergeAgentOptions(common, overrides, agentId))
79
79
  };
80
80
  }
81
81
  function mergeAgentOptions(common, overrides, agentId) {
@@ -914,6 +914,48 @@ var NoopMemoryProvider = class {
914
914
  return createNoopMemoryProvider();
915
915
  }
916
916
  };
917
+
918
+ // src/internal/runtime/validation/effective-tools.ts
919
+ var ALWAYS_REGISTERED = ["shell"];
920
+ var MEMORY_BUILTINS = ["memory_search", "memory_get"];
921
+ function effectiveToolNames(options) {
922
+ refuseCreatedTool(options);
923
+ return { names: resolvableNames(options), unresolved: unresolvableSources(options) };
924
+ }
925
+ function refuseCreatedTool(options) {
926
+ const candidate = options;
927
+ if (candidate.handler === void 0 || candidate.inputSchema === void 0) return;
928
+ throw new chunkJ7J7J2GN_cjs.ConfigurationError(
929
+ `effectiveToolNames received a created tool${typeof candidate.name === "string" ? ` ("${candidate.name}")` : ""}, not AgentOptions. \`SubAgent.create()\` returns a CustomTool and closes its spec inside the handler, so the spec cannot be recovered from it. Pass the spec you built it from \u2014 keep it in a variable, or extract it into a function the test can call.`,
930
+ { code: "effective_tools_expected_options" }
931
+ );
932
+ }
933
+ function resolvableNames(options) {
934
+ const withheld = new Set(options.withheldBuiltinTools ?? []);
935
+ const builtins = [
936
+ ...ALWAYS_REGISTERED,
937
+ ...options.memory?.enabled === true ? MEMORY_BUILTINS : []
938
+ ];
939
+ return [
940
+ ...builtins.filter((builtin) => !withheld.has(builtin)),
941
+ ...(options.tools ?? []).map((tool) => tool.name)
942
+ ];
943
+ }
944
+ function unresolvableSources(options) {
945
+ const unresolved = [];
946
+ if (options.mcpServers !== void 0 && Object.keys(options.mcpServers).length > 0) {
947
+ unresolved.push("mcp");
948
+ }
949
+ if (hasPlugins(options.plugins)) unresolved.push("plugins");
950
+ if (options.reasoning === true) unresolved.push("reasoning");
951
+ return unresolved;
952
+ }
953
+ function hasPlugins(plugins) {
954
+ if (plugins === void 0) return false;
955
+ if (Array.isArray(plugins)) return plugins.length > 0;
956
+ const enabled = plugins.enabled;
957
+ return enabled === void 0 || enabled.length > 0;
958
+ }
917
959
  var JobQueue = class {
918
960
  jobs = /* @__PURE__ */ new Map();
919
961
  controllers = /* @__PURE__ */ new Map();
@@ -1293,7 +1335,7 @@ var Memory = {
1293
1335
  return await peer.IndexManager.open(openArgs);
1294
1336
  }
1295
1337
  const { IndexManager } = await import('./index-manager-3UNPYH34.cjs');
1296
- openArgs.embedding = await resolveEmbedding(opts.embedding, chunkD3CCY3A2_cjs.MEMORY_EMBEDDING_ADAPTERS);
1338
+ openArgs.embedding = await resolveEmbedding(opts.embedding, chunkDEJCKB65_cjs.MEMORY_EMBEDDING_ADAPTERS);
1297
1339
  return await IndexManager.open(openArgs);
1298
1340
  },
1299
1341
  /**
@@ -1304,7 +1346,7 @@ var Memory = {
1304
1346
  */
1305
1347
  async runDreamingSweep(opts) {
1306
1348
  const peer = await tryLoadSdkMemoryPeer();
1307
- const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS : chunkD3CCY3A2_cjs.MEMORY_EMBEDDING_ADAPTERS;
1349
+ const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS : chunkDEJCKB65_cjs.MEMORY_EMBEDDING_ADAPTERS;
1308
1350
  const sweepArgs = await buildDreamingSweepArgs(opts, catalog);
1309
1351
  const result = peer !== null ? (
1310
1352
  // biome-ignore lint/suspicious/noExplicitAny: peer is dynamically loaded — structural compat ensured by sdk-memory
@@ -1728,7 +1770,7 @@ function guardSessionDestruction(sessionId, live) {
1728
1770
  // src/session-messages.ts
1729
1771
  async function readSessionMessages2(options) {
1730
1772
  const cwd = options.cwd ?? process.cwd();
1731
- const baseDir = chunkD3CCY3A2_cjs.resolveSessionDir({ sessionDir: options.sessionDir });
1773
+ const baseDir = chunkDEJCKB65_cjs.resolveSessionDir({ sessionDir: options.sessionDir });
1732
1774
  return chunkYIFFF23U_cjs.readSessionMessages(new chunk7FDKWDA2_cjs.FsSessionStore({ baseDir, cwd }), options.sessionId);
1733
1775
  }
1734
1776
 
@@ -1745,7 +1787,7 @@ function isBuiltAgent(m) {
1745
1787
  return typeof m.send === "function";
1746
1788
  }
1747
1789
  async function materialize(def, index) {
1748
- const { Agent: Agent2 } = await import('./agent-ARLOD4JX.cjs');
1790
+ const { Agent: Agent2 } = await import('./agent-GACKKINM.cjs');
1749
1791
  return Agent2.create({
1750
1792
  // `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
1751
1793
  // here means "declare nothing and let the default apply" — forwarding the literal would create
@@ -1887,7 +1929,7 @@ var FIXTURE_USER = {
1887
1929
  };
1888
1930
  var FIXTURE_MODELS = [
1889
1931
  {
1890
- id: chunkD3CCY3A2_cjs.DEFAULT_AGENTIC_MODEL_ID,
1932
+ id: chunkDEJCKB65_cjs.DEFAULT_AGENTIC_MODEL_ID,
1891
1933
  name: "Gemini 2.0 Flash",
1892
1934
  displayName: "Gemini 2.0 Flash",
1893
1935
  parameters: [
@@ -2090,7 +2132,7 @@ var Theokit = class {
2090
2132
  envVars: p.envVars
2091
2133
  }));
2092
2134
  },
2093
- embeddingAdapters: () => Object.entries(chunkD3CCY3A2_cjs.MEMORY_EMBEDDING_ADAPTERS).map(([id, adapter]) => ({
2135
+ embeddingAdapters: () => Object.entries(chunkDEJCKB65_cjs.MEMORY_EMBEDDING_ADAPTERS).map(([id, adapter]) => ({
2094
2136
  id,
2095
2137
  transport: adapter.transport,
2096
2138
  defaultModel: adapter.defaultModel
@@ -2309,35 +2351,35 @@ Object.defineProperty(exports, "fn", {
2309
2351
  });
2310
2352
  Object.defineProperty(exports, "Cron", {
2311
2353
  enumerable: true,
2312
- get: function () { return chunk67SBTGMA_cjs.Cron; }
2354
+ get: function () { return chunkPEAOQMWE_cjs.Cron; }
2313
2355
  });
2314
2356
  Object.defineProperty(exports, "Agent", {
2315
2357
  enumerable: true,
2316
- get: function () { return chunkD3CCY3A2_cjs.Agent; }
2358
+ get: function () { return chunkDEJCKB65_cjs.Agent; }
2317
2359
  });
2318
2360
  Object.defineProperty(exports, "AgentBuilder", {
2319
2361
  enumerable: true,
2320
- get: function () { return chunkD3CCY3A2_cjs.AgentBuilder; }
2362
+ get: function () { return chunkDEJCKB65_cjs.AgentBuilder; }
2321
2363
  });
2322
2364
  Object.defineProperty(exports, "Tool", {
2323
2365
  enumerable: true,
2324
- get: function () { return chunkD3CCY3A2_cjs.Tool; }
2366
+ get: function () { return chunkDEJCKB65_cjs.Tool; }
2325
2367
  });
2326
2368
  Object.defineProperty(exports, "ToolError", {
2327
2369
  enumerable: true,
2328
- get: function () { return chunkD3CCY3A2_cjs.ToolError; }
2370
+ get: function () { return chunkDEJCKB65_cjs.ToolError; }
2329
2371
  });
2330
2372
  Object.defineProperty(exports, "UsageAccumulator", {
2331
2373
  enumerable: true,
2332
- get: function () { return chunkD3CCY3A2_cjs.UsageAccumulator; }
2374
+ get: function () { return chunkDEJCKB65_cjs.UsageAccumulator; }
2333
2375
  });
2334
2376
  Object.defineProperty(exports, "computeCost", {
2335
2377
  enumerable: true,
2336
- get: function () { return chunkD3CCY3A2_cjs.computeCost; }
2378
+ get: function () { return chunkDEJCKB65_cjs.computeCost; }
2337
2379
  });
2338
2380
  Object.defineProperty(exports, "getPricingEntry", {
2339
2381
  enumerable: true,
2340
- get: function () { return chunkD3CCY3A2_cjs.getPricingEntry; }
2382
+ get: function () { return chunkDEJCKB65_cjs.getPricingEntry; }
2341
2383
  });
2342
2384
  Object.defineProperty(exports, "emitRunEvent", {
2343
2385
  enumerable: true,
@@ -2462,6 +2504,7 @@ exports.createCounterBudgetTracker = createCounterBudgetTracker;
2462
2504
  exports.decideApproval = decideApproval;
2463
2505
  exports.describeAction = describeAction;
2464
2506
  exports.describeCredential = describeCredential;
2507
+ exports.effectiveToolNames = effectiveToolNames;
2465
2508
  exports.evaluateBlastRadius = evaluateBlastRadius;
2466
2509
  exports.extractRawId = extractRawId;
2467
2510
  exports.foldLayers = foldLayers;