@theokit/sdk 1.9.0 → 2.0.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 (74) hide show
  1. package/CHANGELOG.md +32 -1
  2. package/dist/a2a/index.cjs +154 -148
  3. package/dist/a2a/index.cjs.map +1 -1
  4. package/dist/a2a/index.js +154 -148
  5. package/dist/a2a/index.js.map +1 -1
  6. package/dist/{cron-Ci_NUkUj.d.ts → cron-Bj8-Aq1O.d.ts} +1 -1
  7. package/dist/{cron-Bse1MbaE.d.cts → cron-DFG9-W17.d.cts} +1 -1
  8. package/dist/cron.cjs +135 -128
  9. package/dist/cron.cjs.map +1 -1
  10. package/dist/cron.d.cts +1 -1
  11. package/dist/cron.d.ts +1 -1
  12. package/dist/cron.js +138 -131
  13. package/dist/cron.js.map +1 -1
  14. package/dist/eval.cjs +134 -124
  15. package/dist/eval.cjs.map +1 -1
  16. package/dist/eval.d.cts +1 -0
  17. package/dist/eval.d.ts +1 -0
  18. package/dist/eval.js +137 -127
  19. package/dist/eval.js.map +1 -1
  20. package/dist/index.cjs +113 -106
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +2 -2
  23. package/dist/index.d.ts +2 -2
  24. package/dist/index.js +113 -106
  25. package/dist/index.js.map +1 -1
  26. package/dist/internal/runtime/{fork-agent.d.ts → lifecycle/fork-agent.d.ts} +1 -1
  27. package/dist/internal/runtime/{run-until.d.ts → lifecycle/run-until.d.ts} +3 -3
  28. package/dist/internal/runtime/local-agent/local-agent-bootstrap.d.ts +1 -1
  29. package/dist/internal/runtime/registry/agent-factory-registry.d.ts +12 -9
  30. package/dist/internal/scorers/llm-judge.d.ts +4 -4
  31. package/dist/internal/security/index.d.cts +1 -1
  32. package/dist/internal/security/index.d.ts +1 -1
  33. package/dist/types/fork.d.ts +1 -1
  34. package/dist/workflow.cjs +2 -2
  35. package/dist/workflow.cjs.map +1 -1
  36. package/dist/workflow.js +2 -2
  37. package/dist/workflow.js.map +1 -1
  38. package/package.json +6 -12
  39. package/dist/rag/index.cjs +0 -136
  40. package/dist/rag/index.cjs.map +0 -1
  41. package/dist/rag/index.d.cts +0 -11
  42. package/dist/rag/index.d.ts +0 -11
  43. package/dist/rag/index.js +0 -129
  44. package/dist/rag/index.js.map +0 -1
  45. package/dist/rag/reranker.d.cts +0 -26
  46. package/dist/rag/reranker.d.ts +0 -26
  47. package/dist/rag/retriever.d.cts +0 -25
  48. package/dist/rag/retriever.d.ts +0 -25
  49. package/dist/rag/text-splitter.d.cts +0 -12
  50. package/dist/rag/text-splitter.d.ts +0 -12
  51. package/dist/rag/types.d.cts +0 -37
  52. package/dist/rag/types.d.ts +0 -37
  53. package/dist/voice/index.d.ts +0 -7
  54. package/dist/voice/openai-realtime.d.ts +0 -21
  55. package/dist/voice/types.d.ts +0 -35
  56. /package/dist/internal/{errors/mappers → error-mappers}/anthropic.d.ts +0 -0
  57. /package/dist/internal/{errors/mappers → error-mappers}/bedrock.d.ts +0 -0
  58. /package/dist/internal/{errors/mappers → error-mappers}/ollama.d.ts +0 -0
  59. /package/dist/internal/{errors/mappers → error-mappers}/openai-compatible.d.ts +0 -0
  60. /package/dist/internal/{errors/mappers → error-mappers}/shared.d.ts +0 -0
  61. /package/dist/internal/{errors/mappers → error-mappers}/vertex.d.ts +0 -0
  62. /package/dist/internal/runtime/{abort-utils.d.ts → concurrency/abort-utils.d.ts} +0 -0
  63. /package/dist/internal/runtime/{async-local-storage.d.ts → concurrency/async-local-storage.d.ts} +0 -0
  64. /package/dist/internal/runtime/{async-semaphore.d.ts → concurrency/async-semaphore.d.ts} +0 -0
  65. /package/dist/internal/runtime/{default-model.d.ts → config/default-model.d.ts} +0 -0
  66. /package/dist/internal/runtime/{providers-manager.d.ts → config/providers-manager.d.ts} +0 -0
  67. /package/dist/internal/runtime/{workspace-dir.d.ts → config/workspace-dir.d.ts} +0 -0
  68. /package/dist/internal/runtime/{yaml-frontmatter.d.ts → context/yaml-frontmatter.d.ts} +0 -0
  69. /package/dist/internal/runtime/{post-run-lifecycle.d.ts → lifecycle/post-run-lifecycle.d.ts} +0 -0
  70. /package/dist/internal/runtime/{spawn-collect.d.ts → lifecycle/spawn-collect.d.ts} +0 -0
  71. /package/dist/internal/runtime/{system-prompt.d.ts → system-prompt/system-prompt.d.ts} +0 -0
  72. /package/dist/internal/runtime/{shell-tool.d.ts → tools/shell-tool.d.ts} +0 -0
  73. /package/dist/internal/runtime/{validate-agent-options.d.ts → validation/validate-agent-options.d.ts} +0 -0
  74. /package/dist/internal/runtime/{validate-response.d.ts → validation/validate-response.d.ts} +0 -0
package/dist/index.cjs CHANGED
@@ -839,7 +839,7 @@ var init_markdown_store = __esm({
839
839
  }
840
840
  });
841
841
 
842
- // src/internal/runtime/yaml-frontmatter.ts
842
+ // src/internal/runtime/context/yaml-frontmatter.ts
843
843
  function parseSimpleYaml(text) {
844
844
  const fields = {};
845
845
  for (const line of text.split(/\r?\n/)) {
@@ -863,7 +863,7 @@ function coerce(raw) {
863
863
  return raw;
864
864
  }
865
865
  var init_yaml_frontmatter = __esm({
866
- "src/internal/runtime/yaml-frontmatter.ts"() {
866
+ "src/internal/runtime/context/yaml-frontmatter.ts"() {
867
867
  }
868
868
  });
869
869
  async function loadMarkdownEntities(opts) {
@@ -1114,7 +1114,7 @@ function checkToolWhitelist(toolName) {
1114
1114
  }
1115
1115
  var toolWhitelistStore;
1116
1116
  var init_async_local_storage = __esm({
1117
- "src/internal/runtime/async-local-storage.ts"() {
1117
+ "src/internal/runtime/concurrency/async-local-storage.ts"() {
1118
1118
  toolWhitelistStore = new async_hooks.AsyncLocalStorage();
1119
1119
  }
1120
1120
  });
@@ -2493,7 +2493,7 @@ var init_local_agent_plugins = __esm({
2493
2493
  }
2494
2494
  });
2495
2495
 
2496
- // src/internal/runtime/run-until.ts
2496
+ // src/internal/runtime/lifecycle/run-until.ts
2497
2497
  var run_until_exports = {};
2498
2498
  __export(run_until_exports, {
2499
2499
  composeContinuation: () => composeContinuation,
@@ -2586,7 +2586,7 @@ Your last response was:
2586
2586
  ${lastResponse.slice(0, 1e3)}`;
2587
2587
  }
2588
2588
  var init_run_until = __esm({
2589
- "src/internal/runtime/run-until.ts"() {
2589
+ "src/internal/runtime/lifecycle/run-until.ts"() {
2590
2590
  }
2591
2591
  });
2592
2592
 
@@ -2697,16 +2697,16 @@ var init_judge_call = __esm({
2697
2697
  // src/internal/runtime/registry/agent-factory-registry.ts
2698
2698
  var agent_factory_registry_exports = {};
2699
2699
  __export(agent_factory_registry_exports, {
2700
- getAgentCreate: () => getAgentCreate,
2701
- setAgentCreate: () => setAgentCreate
2700
+ getAgentFacade: () => getAgentFacade,
2701
+ setAgentFacade: () => setAgentFacade
2702
2702
  });
2703
- function setAgentCreate(fn) {
2704
- registered3 = fn;
2703
+ function setAgentFacade(facade) {
2704
+ registered3 = facade;
2705
2705
  }
2706
- function getAgentCreate() {
2706
+ function getAgentFacade() {
2707
2707
  if (registered3 === void 0) {
2708
2708
  throw new Error(
2709
- "internal: Agent.create not registered. The `agent.ts` module must be loaded before LocalAgent.runUntil/fork are invoked."
2709
+ "internal: Agent facade not registered. The `agent.ts` module must be loaded before internal subsystems (LocalAgent.runUntil/fork, eval, scorers, cron) invoke it."
2710
2710
  );
2711
2711
  }
2712
2712
  return registered3;
@@ -2717,7 +2717,7 @@ var init_agent_factory_registry = __esm({
2717
2717
  }
2718
2718
  });
2719
2719
 
2720
- // src/internal/runtime/fork-agent.ts
2720
+ // src/internal/runtime/lifecycle/fork-agent.ts
2721
2721
  var fork_agent_exports = {};
2722
2722
  __export(fork_agent_exports, {
2723
2723
  filterMemoryPlugins: () => filterMemoryPlugins,
@@ -2777,7 +2777,7 @@ function extractUsage(result) {
2777
2777
  };
2778
2778
  }
2779
2779
  var init_fork_agent = __esm({
2780
- "src/internal/runtime/fork-agent.ts"() {
2780
+ "src/internal/runtime/lifecycle/fork-agent.ts"() {
2781
2781
  init_async_local_storage();
2782
2782
  init_local_agent_plugins();
2783
2783
  }
@@ -2800,7 +2800,7 @@ var init_task = __esm({
2800
2800
  }
2801
2801
  });
2802
2802
 
2803
- // src/internal/runtime/async-semaphore.ts
2803
+ // src/internal/runtime/concurrency/async-semaphore.ts
2804
2804
  function createSemaphore(permits) {
2805
2805
  if (!Number.isInteger(permits) || permits < 1) {
2806
2806
  throw new exports.ConfigurationError(
@@ -2838,7 +2838,7 @@ function createSemaphore(permits) {
2838
2838
  };
2839
2839
  }
2840
2840
  var init_async_semaphore = __esm({
2841
- "src/internal/runtime/async-semaphore.ts"() {
2841
+ "src/internal/runtime/concurrency/async-semaphore.ts"() {
2842
2842
  init_errors();
2843
2843
  }
2844
2844
  });
@@ -5651,7 +5651,7 @@ init_errors();
5651
5651
  init_cwd_mutex();
5652
5652
  init_path_guard();
5653
5653
 
5654
- // src/internal/runtime/default-model.ts
5654
+ // src/internal/runtime/config/default-model.ts
5655
5655
  var DEFAULT_AGENTIC_MODEL_ID = "google/gemini-2.0-flash-001";
5656
5656
 
5657
5657
  // src/internal/runtime/registry/agent-registry-store.ts
@@ -5972,7 +5972,7 @@ async function flushRegistrySaves(cwd) {
5972
5972
  }
5973
5973
  }
5974
5974
 
5975
- // src/internal/runtime/system-prompt.ts
5975
+ // src/internal/runtime/system-prompt/system-prompt.ts
5976
5976
  async function resolveSystemPrompt(agent, override, ctx) {
5977
5977
  if (override !== void 0) return override;
5978
5978
  if (agent === void 0) return void 0;
@@ -8267,6 +8267,9 @@ function parseDecisionFromStdout(stdout) {
8267
8267
  return { decision: "allow" };
8268
8268
  }
8269
8269
 
8270
+ // src/internal/runtime/lifecycle/post-run-lifecycle.ts
8271
+ init_session_summary_writer();
8272
+
8270
8273
  // src/internal/runtime/memory/memory-path-selector.ts
8271
8274
  var PORT_MEMORY_PATH_ENV_VAR = "THEOKIT_PORT_MEMORY_PATH";
8272
8275
  function shouldUsePortMemoryPath() {
@@ -8289,9 +8292,6 @@ function resolveActiveMemorySummaryForSend(legacySummary, portPathEnabled) {
8289
8292
  return legacySummary;
8290
8293
  }
8291
8294
 
8292
- // src/internal/runtime/post-run-lifecycle.ts
8293
- init_session_summary_writer();
8294
-
8295
8295
  // src/internal/runtime/session/agent-session-store.ts
8296
8296
  init_atomic_write();
8297
8297
  init_security();
@@ -8550,7 +8550,7 @@ function clearSession(agentId) {
8550
8550
  sessions.delete(agentId);
8551
8551
  }
8552
8552
 
8553
- // src/internal/runtime/post-run-lifecycle.ts
8553
+ // src/internal/runtime/lifecycle/post-run-lifecycle.ts
8554
8554
  async function runPostRunLifecycle(inputs) {
8555
8555
  const {
8556
8556
  run,
@@ -8782,7 +8782,7 @@ var liveAgentRegistry = new LiveAgentRegistry();
8782
8782
  // src/internal/runtime/skills/subagents-loader.ts
8783
8783
  init_errors();
8784
8784
 
8785
- // src/internal/runtime/workspace-dir.ts
8785
+ // src/internal/runtime/config/workspace-dir.ts
8786
8786
  init_errors();
8787
8787
  async function readWorkspaceDir(root, errorCode, describe) {
8788
8788
  try {
@@ -9068,7 +9068,7 @@ var SystemPromptPipeline = class _SystemPromptPipeline {
9068
9068
  }
9069
9069
  };
9070
9070
 
9071
- // src/internal/runtime/validate-agent-options.ts
9071
+ // src/internal/runtime/validation/validate-agent-options.ts
9072
9072
  init_errors();
9073
9073
  function validateAgentOptions(options) {
9074
9074
  rejectProgrammaticHooks(options);
@@ -9263,6 +9263,71 @@ function validateMemory(options) {
9263
9263
  }
9264
9264
  }
9265
9265
 
9266
+ // src/internal/runtime/config/providers-manager.ts
9267
+ var ProvidersManagerImpl = class {
9268
+ constructor(model, providers, plugins) {
9269
+ this.model = model;
9270
+ this.providers = providers;
9271
+ this.plugins = plugins;
9272
+ }
9273
+ model;
9274
+ providers;
9275
+ plugins;
9276
+ routes() {
9277
+ const resolved = [];
9278
+ const modelProvider = providerFromModel(this.model);
9279
+ const seen = /* @__PURE__ */ new Set();
9280
+ if (this.providers?.routes !== void 0) {
9281
+ for (const route of this.providers.routes) {
9282
+ const resolvedRoute = resolveRoute(route, modelProvider, this.plugins);
9283
+ if (!seen.has(route.capability)) {
9284
+ seen.add(route.capability);
9285
+ resolved.push(resolvedRoute);
9286
+ }
9287
+ }
9288
+ }
9289
+ return Promise.resolve(resolved);
9290
+ }
9291
+ };
9292
+ function providerFromModel(model) {
9293
+ if (model === void 0) return void 0;
9294
+ const id = model.id;
9295
+ if (id.includes(":")) return id.split(":")[0];
9296
+ return void 0;
9297
+ }
9298
+ function resolveRoute(route, modelProvider, plugins) {
9299
+ if (route.capability === "chat" && modelProvider === route.provider) {
9300
+ const modelName = extractModelName(modelProvider, route);
9301
+ const base = {
9302
+ capability: route.capability,
9303
+ provider: route.provider,
9304
+ reason: "explicit-model-provider"
9305
+ };
9306
+ if (modelName !== void 0) base.model = modelName;
9307
+ return base;
9308
+ }
9309
+ if (plugins?.enabled !== void 0 && plugins.enabled.length > 0) {
9310
+ return {
9311
+ capability: route.capability,
9312
+ provider: route.provider,
9313
+ reason: "first-available-plugin-provider"
9314
+ };
9315
+ }
9316
+ return {
9317
+ capability: route.capability,
9318
+ provider: route.provider,
9319
+ reason: "explicit-route"
9320
+ };
9321
+ }
9322
+ function extractModelName(prefix, route) {
9323
+ if (route.model !== void 0) return route.model;
9324
+ return prefix === route.provider ? defaultModelForProvider(prefix) : void 0;
9325
+ }
9326
+ function defaultModelForProvider(provider) {
9327
+ if (provider === "anthropic") return "claude-3-7-sonnet";
9328
+ return void 0;
9329
+ }
9330
+
9266
9331
  // src/internal/runtime/context/context-manager.ts
9267
9332
  init_errors();
9268
9333
  init_markdown_config_loader();
@@ -10060,71 +10125,6 @@ async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
10060
10125
  return metadata;
10061
10126
  }
10062
10127
 
10063
- // src/internal/runtime/providers-manager.ts
10064
- var ProvidersManagerImpl = class {
10065
- constructor(model, providers, plugins) {
10066
- this.model = model;
10067
- this.providers = providers;
10068
- this.plugins = plugins;
10069
- }
10070
- model;
10071
- providers;
10072
- plugins;
10073
- routes() {
10074
- const resolved = [];
10075
- const modelProvider = providerFromModel(this.model);
10076
- const seen = /* @__PURE__ */ new Set();
10077
- if (this.providers?.routes !== void 0) {
10078
- for (const route of this.providers.routes) {
10079
- const resolvedRoute = resolveRoute(route, modelProvider, this.plugins);
10080
- if (!seen.has(route.capability)) {
10081
- seen.add(route.capability);
10082
- resolved.push(resolvedRoute);
10083
- }
10084
- }
10085
- }
10086
- return Promise.resolve(resolved);
10087
- }
10088
- };
10089
- function providerFromModel(model) {
10090
- if (model === void 0) return void 0;
10091
- const id = model.id;
10092
- if (id.includes(":")) return id.split(":")[0];
10093
- return void 0;
10094
- }
10095
- function resolveRoute(route, modelProvider, plugins) {
10096
- if (route.capability === "chat" && modelProvider === route.provider) {
10097
- const modelName = extractModelName(modelProvider, route);
10098
- const base = {
10099
- capability: route.capability,
10100
- provider: route.provider,
10101
- reason: "explicit-model-provider"
10102
- };
10103
- if (modelName !== void 0) base.model = modelName;
10104
- return base;
10105
- }
10106
- if (plugins?.enabled !== void 0 && plugins.enabled.length > 0) {
10107
- return {
10108
- capability: route.capability,
10109
- provider: route.provider,
10110
- reason: "first-available-plugin-provider"
10111
- };
10112
- }
10113
- return {
10114
- capability: route.capability,
10115
- provider: route.provider,
10116
- reason: "explicit-route"
10117
- };
10118
- }
10119
- function extractModelName(prefix, route) {
10120
- if (route.model !== void 0) return route.model;
10121
- return prefix === route.provider ? defaultModelForProvider(prefix) : void 0;
10122
- }
10123
- function defaultModelForProvider(provider) {
10124
- if (provider === "anthropic") return "claude-3-7-sonnet";
10125
- return void 0;
10126
- }
10127
-
10128
10128
  // src/internal/runtime/skills/skills-manager.ts
10129
10129
  init_errors();
10130
10130
  init_path_guard();
@@ -10472,7 +10472,7 @@ var IterationBudget = class {
10472
10472
  }
10473
10473
  };
10474
10474
 
10475
- // src/internal/runtime/validate-response.ts
10475
+ // src/internal/runtime/validation/validate-response.ts
10476
10476
  function validateResponse(response) {
10477
10477
  const trimmed = response.content.trim();
10478
10478
  const toolCallsArr = Array.isArray(response.toolCalls) ? response.toolCalls : [];
@@ -10931,7 +10931,7 @@ function coerceArgsToSchema(args, schema) {
10931
10931
  return { value: out, changed };
10932
10932
  }
10933
10933
 
10934
- // src/internal/runtime/shell-tool.ts
10934
+ // src/internal/runtime/tools/shell-tool.ts
10935
10935
  async function runShell(options) {
10936
10936
  if (options.sandbox === true && isObviouslyUnsafe(options.command)) {
10937
10937
  return {
@@ -12146,10 +12146,10 @@ function registerBuiltins() {
12146
12146
  registerCatalogProviders();
12147
12147
  }
12148
12148
 
12149
- // src/internal/errors/mappers/anthropic.ts
12149
+ // src/internal/error-mappers/anthropic.ts
12150
12150
  init_errors();
12151
12151
 
12152
- // src/internal/errors/mappers/shared.ts
12152
+ // src/internal/error-mappers/shared.ts
12153
12153
  init_security();
12154
12154
  var RAW_MAX_BYTES = 2048;
12155
12155
  function parseRetryAfter(headers) {
@@ -12179,7 +12179,7 @@ function buildErrorMetadata(args) {
12179
12179
  };
12180
12180
  }
12181
12181
 
12182
- // src/internal/errors/mappers/anthropic.ts
12182
+ // src/internal/error-mappers/anthropic.ts
12183
12183
  function mapAnthropicError(args) {
12184
12184
  const { status, body, headers, endpoint } = args;
12185
12185
  const code = mapAnthropicStatusToCode(status, body);
@@ -12519,7 +12519,7 @@ function buildAnthropicBody(request) {
12519
12519
  // src/internal/llm/bedrock-anthropic.ts
12520
12520
  init_errors();
12521
12521
 
12522
- // src/internal/errors/mappers/bedrock.ts
12522
+ // src/internal/error-mappers/bedrock.ts
12523
12523
  init_errors();
12524
12524
  function classifyBedrockError(args, awsType, message) {
12525
12525
  if (args.status === 429 || awsType.includes("Throttling") || awsType.includes("TooManyRequests")) {
@@ -12656,7 +12656,7 @@ function buildBedrockBody(request) {
12656
12656
  init_credential_pool();
12657
12657
  init_credential_pool_context();
12658
12658
 
12659
- // src/internal/errors/mappers/openai-compatible.ts
12659
+ // src/internal/error-mappers/openai-compatible.ts
12660
12660
  init_errors();
12661
12661
  function mapOpenAICompatibleError(args) {
12662
12662
  const { providerId, status, body, headers, endpoint } = args;
@@ -12820,7 +12820,7 @@ function readOpenAiContent(body) {
12820
12820
  return void 0;
12821
12821
  }
12822
12822
 
12823
- // src/internal/errors/mappers/ollama.ts
12823
+ // src/internal/error-mappers/ollama.ts
12824
12824
  init_errors();
12825
12825
  function mapOllamaTransportError(args) {
12826
12826
  if (args.providerId !== "ollama") return void 0;
@@ -13470,7 +13470,7 @@ function abortError2(signal) {
13470
13470
  // src/internal/llm/vertex-anthropic.ts
13471
13471
  init_errors();
13472
13472
 
13473
- // src/internal/errors/mappers/vertex.ts
13473
+ // src/internal/error-mappers/vertex.ts
13474
13474
  init_errors();
13475
13475
  var VERTEX_RULES = [
13476
13476
  { test: (s, e) => s === 429 || e === "RESOURCE_EXHAUSTED", code: "rate_limit" },
@@ -15787,8 +15787,8 @@ function localAgentRunUntil(agent, goal, options) {
15787
15787
  async function* wrap() {
15788
15788
  const { runUntilImpl: runUntilImpl2 } = await Promise.resolve().then(() => (init_run_until(), run_until_exports));
15789
15789
  const { judgeCallImpl: judgeCallImpl2 } = await Promise.resolve().then(() => (init_judge_call(), judge_call_exports));
15790
- const { getAgentCreate: getAgentCreate2 } = await Promise.resolve().then(() => (init_agent_factory_registry(), agent_factory_registry_exports));
15791
- const create = getAgentCreate2();
15790
+ const { getAgentFacade: getAgentFacade2 } = await Promise.resolve().then(() => (init_agent_factory_registry(), agent_factory_registry_exports));
15791
+ const create = getAgentFacade2().create;
15792
15792
  const deps = {
15793
15793
  judge: async (ctx, opts) => judgeCallImpl2(ctx, opts, { create })
15794
15794
  };
@@ -15798,9 +15798,9 @@ function localAgentRunUntil(agent, goal, options) {
15798
15798
  }
15799
15799
  async function localAgentFork(parent, options) {
15800
15800
  const { forkAgentImpl: forkAgentImpl2 } = await Promise.resolve().then(() => (init_fork_agent(), fork_agent_exports));
15801
- const { getAgentCreate: getAgentCreate2 } = await Promise.resolve().then(() => (init_agent_factory_registry(), agent_factory_registry_exports));
15801
+ const { getAgentFacade: getAgentFacade2 } = await Promise.resolve().then(() => (init_agent_factory_registry(), agent_factory_registry_exports));
15802
15802
  const { withPersonalityContext: withPersonalityContext2 } = await Promise.resolve().then(() => (init_context(), context_exports));
15803
- const create = getAgentCreate2();
15803
+ const create = getAgentFacade2().create;
15804
15804
  return withPersonalityContext2(
15805
15805
  { slug: parent.personalitySlugSnapshot, isFork: true },
15806
15806
  () => forkAgentImpl2(parent, options, { create })
@@ -15821,7 +15821,7 @@ async function persistMemoryFactIfWritePrompt(workspaceCwd, memoryConfig, userTe
15821
15821
  // src/internal/runtime/local-agent/local-agent-send.ts
15822
15822
  init_errors();
15823
15823
 
15824
- // src/internal/runtime/abort-utils.ts
15824
+ // src/internal/runtime/concurrency/abort-utils.ts
15825
15825
  function anySignal(signals) {
15826
15826
  const filtered = signals.filter((s) => s !== void 0);
15827
15827
  if (filtered.length === 0) {
@@ -16850,7 +16850,13 @@ async function getOrCreateUncached(agentId, options) {
16850
16850
  throw err;
16851
16851
  }
16852
16852
  }
16853
- setAgentCreate((options) => Agent.create(options));
16853
+ setAgentFacade({
16854
+ create: (options) => Agent.create(options),
16855
+ prompt: (message, options) => Agent.prompt(message, options),
16856
+ get: (agentId) => Agent.get(agentId),
16857
+ resume: (agentId, options) => Agent.resume(agentId, options),
16858
+ batch: (prompts, options) => Agent.batch(prompts, options)
16859
+ });
16854
16860
 
16855
16861
  // src/agent-factory.ts
16856
16862
  function createAgentFactory(common) {
@@ -17288,6 +17294,7 @@ init_errors();
17288
17294
 
17289
17295
  // src/internal/cron/run-job.ts
17290
17296
  init_errors();
17297
+ init_agent_factory_registry();
17291
17298
  async function runCronJob(job) {
17292
17299
  if (job.agent !== void 0) return runWithEphemeralAgent(job.agent, job.message);
17293
17300
  if (job.agentId !== void 0) return runWithExistingAgent(job.agentId, job.message);
@@ -17296,18 +17303,18 @@ async function runCronJob(job) {
17296
17303
  });
17297
17304
  }
17298
17305
  async function runWithExistingAgent(agentId, message) {
17299
- const info = await Agent.get(agentId).catch(() => void 0);
17306
+ const info = await getAgentFacade().get(agentId).catch(() => void 0);
17300
17307
  if (info === void 0) {
17301
17308
  throw new exports.UnknownAgentError(
17302
17309
  `Cron job references agentId "${agentId}" but no such agent is registered. The agent may have been disposed or the process restarted without persisting the agent registry.`,
17303
17310
  { code: "agent_not_registered" }
17304
17311
  );
17305
17312
  }
17306
- const agent = await Agent.resume(agentId);
17313
+ const agent = await getAgentFacade().resume(agentId);
17307
17314
  return agent.send(message);
17308
17315
  }
17309
17316
  async function runWithEphemeralAgent(baseOptions, message) {
17310
- const agent = await Agent.create(baseOptions);
17317
+ const agent = await getAgentFacade().create(baseOptions);
17311
17318
  return agent.send(message);
17312
17319
  }
17313
17320