@theokit/sdk 5.15.3 → 5.16.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.
Files changed (87) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/{agent-MOSFFVPU.js → agent-FB56RAXD.js} +11 -10
  3. package/dist/{agent-MOSFFVPU.js.map → agent-FB56RAXD.js.map} +1 -1
  4. package/dist/{agent-LTJYDRWI.cjs → agent-TM634NHQ.cjs} +12 -11
  5. package/dist/{agent-LTJYDRWI.cjs.map → agent-TM634NHQ.cjs.map} +1 -1
  6. package/dist/chunk-22HVMMXX.cjs +13 -0
  7. package/dist/chunk-22HVMMXX.cjs.map +1 -0
  8. package/dist/{chunk-QJVTDW3G.cjs → chunk-3JGRKXA7.cjs} +4 -4
  9. package/dist/{chunk-QJVTDW3G.cjs.map → chunk-3JGRKXA7.cjs.map} +1 -1
  10. package/dist/{chunk-CMDM4VF6.js → chunk-4XYCF5PA.js} +3 -3
  11. package/dist/{chunk-CMDM4VF6.js.map → chunk-4XYCF5PA.js.map} +1 -1
  12. package/dist/{chunk-4OMRDNPY.js → chunk-6WPNFZH3.js} +4 -4
  13. package/dist/{chunk-4OMRDNPY.js.map → chunk-6WPNFZH3.js.map} +1 -1
  14. package/dist/{chunk-5L7S2VOL.js → chunk-A3T2A2WU.js} +3 -69
  15. package/dist/chunk-A3T2A2WU.js.map +1 -0
  16. package/dist/{chunk-LAZTNGNR.cjs → chunk-BJB6RDEA.cjs} +59 -59
  17. package/dist/{chunk-LAZTNGNR.cjs.map → chunk-BJB6RDEA.cjs.map} +1 -1
  18. package/dist/{chunk-3ZRJ4RNB.cjs → chunk-BXEHUUDJ.cjs} +27 -27
  19. package/dist/{chunk-3ZRJ4RNB.cjs.map → chunk-BXEHUUDJ.cjs.map} +1 -1
  20. package/dist/{chunk-4TTR63O7.js → chunk-DLCYS5RI.js} +3 -3
  21. package/dist/{chunk-4TTR63O7.js.map → chunk-DLCYS5RI.js.map} +1 -1
  22. package/dist/chunk-GA4ZRKYF.cjs +75 -0
  23. package/dist/chunk-GA4ZRKYF.cjs.map +1 -0
  24. package/dist/chunk-ICBNSAO4.js +11 -0
  25. package/dist/chunk-ICBNSAO4.js.map +1 -0
  26. package/dist/{chunk-HFEAU2L2.js → chunk-MNE4633K.js} +3 -3
  27. package/dist/{chunk-HFEAU2L2.js.map → chunk-MNE4633K.js.map} +1 -1
  28. package/dist/{chunk-WAKGYSQ6.js → chunk-NHD5IN3E.js} +10 -10
  29. package/dist/{chunk-WAKGYSQ6.js.map → chunk-NHD5IN3E.js.map} +1 -1
  30. package/dist/{chunk-Q4UOCMAO.cjs → chunk-S5WTJ6LL.cjs} +5 -5
  31. package/dist/{chunk-Q4UOCMAO.cjs.map → chunk-S5WTJ6LL.cjs.map} +1 -1
  32. package/dist/chunk-SGKMTBCO.cjs +18 -0
  33. package/dist/{chunk-EDIYR4VR.cjs.map → chunk-SGKMTBCO.cjs.map} +1 -1
  34. package/dist/{chunk-RB3ZMMUU.cjs → chunk-TDKLSWHU.cjs} +4 -4
  35. package/dist/{chunk-RB3ZMMUU.cjs.map → chunk-TDKLSWHU.cjs.map} +1 -1
  36. package/dist/{chunk-AQ23NII7.js → chunk-UNUGF36D.js} +3 -3
  37. package/dist/{chunk-AQ23NII7.js.map → chunk-UNUGF36D.js.map} +1 -1
  38. package/dist/{chunk-Z5MB2HAN.cjs → chunk-WVQRE7CO.cjs} +4 -70
  39. package/dist/chunk-WVQRE7CO.cjs.map +1 -0
  40. package/dist/chunk-Z2UVCAYS.js +72 -0
  41. package/dist/chunk-Z2UVCAYS.js.map +1 -0
  42. package/dist/{compact-session-PIDZQ7AR.cjs → compact-session-OHA543HN.cjs} +14 -13
  43. package/dist/{compact-session-PIDZQ7AR.cjs.map → compact-session-OHA543HN.cjs.map} +1 -1
  44. package/dist/{compact-session-ZPEJSTLA.js → compact-session-XPJS27JD.js} +5 -4
  45. package/dist/{compact-session-ZPEJSTLA.js.map → compact-session-XPJS27JD.js.map} +1 -1
  46. package/dist/cron.cjs +11 -10
  47. package/dist/cron.js +10 -9
  48. package/dist/eval.cjs +10 -9
  49. package/dist/eval.cjs.map +1 -1
  50. package/dist/eval.js +9 -8
  51. package/dist/eval.js.map +1 -1
  52. package/dist/index.cjs +219 -45
  53. package/dist/index.cjs.map +1 -1
  54. package/dist/index.d.cts +106 -1
  55. package/dist/index.d.ts +106 -1
  56. package/dist/index.js +185 -14
  57. package/dist/index.js.map +1 -1
  58. package/dist/{inject-session-Z2HIB6P6.cjs → inject-session-NTL2UAE6.cjs} +5 -5
  59. package/dist/{inject-session-Z2HIB6P6.cjs.map → inject-session-NTL2UAE6.cjs.map} +1 -1
  60. package/dist/{inject-session-OMBJKMVD.js → inject-session-SCJ6MTUT.js} +4 -4
  61. package/dist/{inject-session-OMBJKMVD.js.map → inject-session-SCJ6MTUT.js.map} +1 -1
  62. package/dist/internal/providers/builtin/openai-chatgpt.d.ts +8 -0
  63. package/dist/internal/trim-trailing-slashes.d.ts +6 -0
  64. package/dist/models.cjs +12 -16
  65. package/dist/models.cjs.map +1 -1
  66. package/dist/models.js +4 -8
  67. package/dist/models.js.map +1 -1
  68. package/dist/openai-chatgpt-IVAL4MW6.cjs +22 -0
  69. package/dist/openai-chatgpt-IVAL4MW6.cjs.map +1 -0
  70. package/dist/openai-chatgpt-ZFNZWT2L.js +9 -0
  71. package/dist/openai-chatgpt-ZFNZWT2L.js.map +1 -0
  72. package/dist/providers.cjs +5 -4
  73. package/dist/providers.js +3 -2
  74. package/dist/sandbox/e2b-sandbox.d.cts +61 -0
  75. package/dist/sandbox/e2b-sandbox.d.ts +61 -0
  76. package/dist/sandbox/index.cjs +55 -0
  77. package/dist/sandbox/index.cjs.map +1 -1
  78. package/dist/sandbox/index.d.cts +1 -0
  79. package/dist/sandbox/index.d.ts +1 -0
  80. package/dist/sandbox/index.js +54 -1
  81. package/dist/sandbox/index.js.map +1 -1
  82. package/docs/error-codes.md +2 -1
  83. package/docs/harness-capability-map.md +21 -1
  84. package/package.json +5 -1
  85. package/dist/chunk-5L7S2VOL.js.map +0 -1
  86. package/dist/chunk-EDIYR4VR.cjs +0 -18
  87. package/dist/chunk-Z5MB2HAN.cjs.map +0 -1
@@ -1,15 +1,15 @@
1
1
  'use strict';
2
2
 
3
+ var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
3
4
  var chunkER3BF23R_cjs = require('./chunk-ER3BF23R.cjs');
4
- var chunkQJVTDW3G_cjs = require('./chunk-QJVTDW3G.cjs');
5
+ var chunk3JGRKXA7_cjs = require('./chunk-3JGRKXA7.cjs');
5
6
  var chunkHI5TJWQE_cjs = require('./chunk-HI5TJWQE.cjs');
6
7
  var chunkNDXZXGVP_cjs = require('./chunk-NDXZXGVP.cjs');
7
- var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
8
8
  var chunkDEHPRORL_cjs = require('./chunk-DEHPRORL.cjs');
9
9
  var chunkEBX6XUN7_cjs = require('./chunk-EBX6XUN7.cjs');
10
10
  var chunkKC2HKUPT_cjs = require('./chunk-KC2HKUPT.cjs');
11
11
  var chunkN2ORTDSO_cjs = require('./chunk-N2ORTDSO.cjs');
12
- var chunk3ZRJ4RNB_cjs = require('./chunk-3ZRJ4RNB.cjs');
12
+ var chunkBXEHUUDJ_cjs = require('./chunk-BXEHUUDJ.cjs');
13
13
  var chunk2ZPEDVLM_cjs = require('./chunk-2ZPEDVLM.cjs');
14
14
  var chunkXR6O6G3B_cjs = require('./chunk-XR6O6G3B.cjs');
15
15
  var chunkX4ZYEZPD_cjs = require('./chunk-X4ZYEZPD.cjs');
@@ -32,10 +32,10 @@ var chunkFZSPVIFK_cjs = require('./chunk-FZSPVIFK.cjs');
32
32
  var chunkJVH3NNJ3_cjs = require('./chunk-JVH3NNJ3.cjs');
33
33
  var chunk3YCNBOX7_cjs = require('./chunk-3YCNBOX7.cjs');
34
34
  var chunkKX5QXLBS_cjs = require('./chunk-KX5QXLBS.cjs');
35
- var chunkQ4UOCMAO_cjs = require('./chunk-Q4UOCMAO.cjs');
35
+ var chunkS5WTJ6LL_cjs = require('./chunk-S5WTJ6LL.cjs');
36
36
  var chunk3EE6LVWT_cjs = require('./chunk-3EE6LVWT.cjs');
37
- var chunkEDIYR4VR_cjs = require('./chunk-EDIYR4VR.cjs');
38
- var chunkZ5MB2HAN_cjs = require('./chunk-Z5MB2HAN.cjs');
37
+ var chunkSGKMTBCO_cjs = require('./chunk-SGKMTBCO.cjs');
38
+ var chunkWVQRE7CO_cjs = require('./chunk-WVQRE7CO.cjs');
39
39
  var chunkNVXXWAU7_cjs = require('./chunk-NVXXWAU7.cjs');
40
40
  var chunkEHD25JBZ_cjs = require('./chunk-EHD25JBZ.cjs');
41
41
  var chunkCEGU5AVD_cjs = require('./chunk-CEGU5AVD.cjs');
@@ -1625,7 +1625,7 @@ function createRealCloudRun(options) {
1625
1625
  conversation: []
1626
1626
  };
1627
1627
  const apiKey = chunkRNXXYF22_cjs.resolveApiKey(options.agentOptions.apiKey);
1628
- const baseUrl = chunk3ZRJ4RNB_cjs.getConfiguredBaseUrl();
1628
+ const baseUrl = chunkBXEHUUDJ_cjs.getConfiguredBaseUrl();
1629
1629
  const handle = new RealCloudRun(
1630
1630
  {
1631
1631
  id,
@@ -1711,7 +1711,7 @@ var RealCloudRun = class extends FixtureRunBase {
1711
1711
  async consumeStream(response) {
1712
1712
  let finalStatus = "finished";
1713
1713
  let finalText = "";
1714
- for await (const record of chunk3ZRJ4RNB_cjs.parseSseStream(response.body, this.controller.signal)) {
1714
+ for await (const record of chunkBXEHUUDJ_cjs.parseSseStream(response.body, this.controller.signal)) {
1715
1715
  const parsed = safeParse(record.data);
1716
1716
  if (parsed === void 0) continue;
1717
1717
  const update = this.applyRecord(record.event, parsed);
@@ -1882,7 +1882,7 @@ var CloudAgent = class _CloudAgent {
1882
1882
  */
1883
1883
  isFixtureMode() {
1884
1884
  const apiKey = chunkRNXXYF22_cjs.resolveApiKey(this.options.apiKey);
1885
- return chunk3ZRJ4RNB_cjs.isFixtureApiKey(apiKey) && chunk3ZRJ4RNB_cjs.getConfiguredBaseUrl() === void 0;
1885
+ return chunkBXEHUUDJ_cjs.isFixtureApiKey(apiKey) && chunkBXEHUUDJ_cjs.getConfiguredBaseUrl() === void 0;
1886
1886
  }
1887
1887
  // SE9 — integrated structured output; delegates to the shared helper.
1888
1888
  generate(message, options) {
@@ -1937,7 +1937,7 @@ var CloudAgent = class _CloudAgent {
1937
1937
  const userText = typeof message === "string" ? message : message.text;
1938
1938
  const systemPrompt = await this.resolveSystemPromptForSend(userText, options);
1939
1939
  const apiKey = chunkRNXXYF22_cjs.resolveApiKey(this.options.apiKey);
1940
- const useRealRuntime = apiKey !== void 0 && !chunk3ZRJ4RNB_cjs.isFixtureApiKey(apiKey) && chunk3ZRJ4RNB_cjs.getConfiguredBaseUrl() !== void 0;
1940
+ const useRealRuntime = apiKey !== void 0 && !chunkBXEHUUDJ_cjs.isFixtureApiKey(apiKey) && chunkBXEHUUDJ_cjs.getConfiguredBaseUrl() !== void 0;
1941
1941
  return useRealRuntime ? createRealCloudRun({
1942
1942
  agentId: this.agentId,
1943
1943
  model: this.model ?? { id: DEFAULT_AGENTIC_MODEL_ID },
@@ -2977,7 +2977,7 @@ function resolveWindowForRun(model, contextWindow) {
2977
2977
  const override = contextWindow !== void 0 && contextWindow > 0 ? contextWindow : void 0;
2978
2978
  return chunkKX5QXLBS_cjs.resolveEffectiveContextWindow({
2979
2979
  ...override !== void 0 ? { override } : {},
2980
- catalog: chunkZ5MB2HAN_cjs.getCatalogModelInfo(model)?.limit?.context,
2980
+ catalog: chunkWVQRE7CO_cjs.getCatalogModelInfo(model)?.limit?.context,
2981
2981
  margin: chunkKX5QXLBS_cjs.CONTEXT_WINDOW_MARGIN,
2982
2982
  floor: chunkKX5QXLBS_cjs.CONTEXT_WINDOW_FLOOR
2983
2983
  });
@@ -3002,7 +3002,7 @@ async function runPostRunLifecycle(inputs) {
3002
3002
  try {
3003
3003
  const partial = await safeConversation(run);
3004
3004
  if (partial !== void 0) {
3005
- chunkQJVTDW3G_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
3005
+ chunk3JGRKXA7_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
3006
3006
  userText,
3007
3007
  conversation: partial
3008
3008
  });
@@ -3012,11 +3012,11 @@ async function runPostRunLifecycle(inputs) {
3012
3012
  chunkRNXXYF22_cjs.diag(`[theokit-sdk] partial transcript write failed (${agentId}): ${msg}
3013
3013
  `);
3014
3014
  }
3015
- await chunkQJVTDW3G_cjs.flushSessionWrites();
3015
+ await chunk3JGRKXA7_cjs.flushSessionWrites();
3016
3016
  return;
3017
3017
  }
3018
3018
  if (result.result !== void 0) {
3019
- chunkQJVTDW3G_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
3019
+ chunk3JGRKXA7_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
3020
3020
  }
3021
3021
  const conversation = await safeConversation(run);
3022
3022
  const resolvedWindow = resolveWindowForRun(model, contextWindow);
@@ -3027,7 +3027,7 @@ async function runPostRunLifecycle(inputs) {
3027
3027
  }
3028
3028
  const lastRequestUsage = result.usage?.requests?.at(-1)?.totalTokens;
3029
3029
  const usageForTrigger = lastRequestUsage ?? result.usage?.totalTokens;
3030
- chunkQJVTDW3G_cjs.persistTurnToTranscript(
3030
+ chunk3JGRKXA7_cjs.persistTurnToTranscript(
3031
3031
  sessionStore,
3032
3032
  { cwd: workspaceCwd, agentId, model },
3033
3033
  agentId,
@@ -3039,7 +3039,7 @@ async function runPostRunLifecycle(inputs) {
3039
3039
  // The EFFECTIVE window (after override, clamp and margin) — not the declared one. Swapping for
3040
3040
  // `contextWindow` here would budget against a number the clamp already rejected.
3041
3041
  contextWindow: effectiveWindow,
3042
- summarize: chunk3ZRJ4RNB_cjs.buildDefaultSummarizer({
3042
+ summarize: chunkBXEHUUDJ_cjs.buildDefaultSummarizer({
3043
3043
  agentModel: model,
3044
3044
  ...inputs.apiKey !== void 0 ? { apiKey: inputs.apiKey } : {}
3045
3045
  })
@@ -3081,7 +3081,7 @@ async function runPostRunLifecycle(inputs) {
3081
3081
  agentId,
3082
3082
  runId: result.id
3083
3083
  });
3084
- await chunkQJVTDW3G_cjs.flushSessionWrites();
3084
+ await chunk3JGRKXA7_cjs.flushSessionWrites();
3085
3085
  }
3086
3086
  async function safeConversation(run) {
3087
3087
  try {
@@ -3098,12 +3098,12 @@ var WORKSPACE_TRUST = {
3098
3098
  entries: "absolute folder realpaths"
3099
3099
  };
3100
3100
  function workspaceTrustRecordPath() {
3101
- return node_path.join(node_path.dirname(chunk3ZRJ4RNB_cjs.trustFilePath()), "trusted-workspace-plugins.json");
3101
+ return node_path.join(node_path.dirname(chunkBXEHUUDJ_cjs.trustFilePath()), "trusted-workspace-plugins.json");
3102
3102
  }
3103
3103
  function readTrustedWorkspaceFolders() {
3104
3104
  const path = workspaceTrustRecordPath();
3105
3105
  const trusted = /* @__PURE__ */ new Set();
3106
- for (const entry of chunk3ZRJ4RNB_cjs.readTrustArray(path, WORKSPACE_TRUST)) {
3106
+ for (const entry of chunkBXEHUUDJ_cjs.readTrustArray(path, WORKSPACE_TRUST)) {
3107
3107
  if (node_path.isAbsolute(entry)) {
3108
3108
  trusted.add(entry);
3109
3109
  continue;
@@ -4013,7 +4013,7 @@ var HISTOGRAM_NAMES = {
4013
4013
  };
4014
4014
  function safeRequire(moduleName) {
4015
4015
  try {
4016
- const r = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-LAZTNGNR.cjs', document.baseURI).href)));
4016
+ const r = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-BJB6RDEA.cjs', document.baseURI).href)));
4017
4017
  return r(moduleName);
4018
4018
  } catch {
4019
4019
  return void 0;
@@ -4256,7 +4256,7 @@ var cachedOtel;
4256
4256
  function loadOtel() {
4257
4257
  if (cachedOtel === void 0) {
4258
4258
  try {
4259
- const r = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-LAZTNGNR.cjs', document.baseURI).href)));
4259
+ const r = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-BJB6RDEA.cjs', document.baseURI).href)));
4260
4260
  const mod = r("@opentelemetry/api");
4261
4261
  cachedOtel = mod;
4262
4262
  } catch {
@@ -6037,7 +6037,7 @@ function catalogCostFallback(provider, cleanedModel) {
6037
6037
  const candidates = [`${provider}/${cleanedModel}`, cleanedModel];
6038
6038
  if (stripped !== cleanedModel) candidates.push(`${provider}/${stripped}`, stripped);
6039
6039
  for (const key of candidates) {
6040
- const info = chunkZ5MB2HAN_cjs.getCatalogModelInfo(key);
6040
+ const info = chunkWVQRE7CO_cjs.getCatalogModelInfo(key);
6041
6041
  const cost = info?.cost;
6042
6042
  if (cost === void 0) continue;
6043
6043
  const [prov, ...modelParts] = key.split("/");
@@ -6049,7 +6049,7 @@ function catalogCostFallback(provider, cleanedModel) {
6049
6049
  ...cost.cache_read !== void 0 ? { cacheReadCostPerMillion: cost.cache_read } : {},
6050
6050
  ...cost.cache_write !== void 0 ? { cacheWriteCostPerMillion: cost.cache_write } : {},
6051
6051
  // M44 M5 fix — honest provenance: a key patched by the LIVE models-dev source is not "vendored".
6052
- pricingVersion: chunkZ5MB2HAN_cjs.isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
6052
+ pricingVersion: chunkWVQRE7CO_cjs.isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
6053
6053
  };
6054
6054
  }
6055
6055
  return void 0;
@@ -6303,7 +6303,7 @@ ${chunkNMRNE6QX_cjs.escapeBlockBody(additions)}
6303
6303
  </active-memory>`;
6304
6304
  }
6305
6305
  function buildLoopSystem(systemPrompt, additions, modelId) {
6306
- if (!chunkQ4UOCMAO_cjs.isAnthropicFamilyModel(modelId) || systemPrompt === void 0 || systemPrompt.length === 0) {
6306
+ if (!chunkS5WTJ6LL_cjs.isAnthropicFamilyModel(modelId) || systemPrompt === void 0 || systemPrompt.length === 0) {
6307
6307
  return resolveSystemPromptWithMemoryAdditions(systemPrompt, additions);
6308
6308
  }
6309
6309
  const blocks = [{ text: systemPrompt, cacheable: true }];
@@ -7192,7 +7192,7 @@ function applyToolResultGuard(parts, opts) {
7192
7192
  (p) => (
7193
7193
  // SE7 — guard the TEXT of a tool result (string or the text blocks of a
7194
7194
  // structured content); image blocks pass through untouched.
7195
- p.type === "tool_result" ? { ...p, content: chunk3ZRJ4RNB_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
7195
+ p.type === "tool_result" ? { ...p, content: chunkBXEHUUDJ_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
7196
7196
  )
7197
7197
  );
7198
7198
  }
@@ -7534,13 +7534,13 @@ var FallbackLlmClient = class {
7534
7534
  async *stream(request, signal) {
7535
7535
  let lastError;
7536
7536
  for (const client of this.clients) {
7537
- if (signal.aborted) throw chunk3ZRJ4RNB_cjs.abortError(signal);
7538
- const attempt = await chunk3ZRJ4RNB_cjs.tryFirstEvent(client, request, signal, true);
7537
+ if (signal.aborted) throw chunkBXEHUUDJ_cjs.abortError(signal);
7538
+ const attempt = await chunkBXEHUUDJ_cjs.tryFirstEvent(client, request, signal, true);
7539
7539
  if (attempt.kind === "handshake_error") {
7540
7540
  lastError = attempt.error;
7541
7541
  continue;
7542
7542
  }
7543
- return yield* chunk3ZRJ4RNB_cjs.relayStream(attempt.generator, attempt.firstResult);
7543
+ return yield* chunkBXEHUUDJ_cjs.relayStream(attempt.generator, attempt.firstResult);
7544
7544
  }
7545
7545
  if (lastError !== void 0) throw lastError;
7546
7546
  throw new chunkCEGU5AVD_cjs.NetworkError("FallbackLlmClient has no providers configured", {
@@ -8221,9 +8221,9 @@ function buildLoopInputs(options, runId, userText, userImages) {
8221
8221
  );
8222
8222
  }
8223
8223
  validatePruneToolResults(options.sendOptions.pruneToolResults);
8224
- const { primary, effectiveModelId } = chunk3ZRJ4RNB_cjs.resolveRunProvider(options);
8224
+ const { primary, effectiveModelId } = chunkBXEHUUDJ_cjs.resolveRunProvider(options);
8225
8225
  const fallback = options.agentOptions.providers?.fallback;
8226
- const apiKeys = chunk3ZRJ4RNB_cjs.mergeExplicitApiKey(
8226
+ const apiKeys = chunkBXEHUUDJ_cjs.mergeExplicitApiKey(
8227
8227
  options.agentOptions.providers?.apiKeys,
8228
8228
  primary,
8229
8229
  options.agentOptions.apiKey
@@ -8232,7 +8232,7 @@ function buildLoopInputs(options, runId, userText, userImages) {
8232
8232
  const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
8233
8233
  const rateLimitSink = options.sendOptions.onRunEvent;
8234
8234
  const modelBaseUrl = options.model?.url;
8235
- const chain = chunk3ZRJ4RNB_cjs.resolveProviderChain({
8235
+ const chain = chunkBXEHUUDJ_cjs.resolveProviderChain({
8236
8236
  primary,
8237
8237
  ...modelBaseUrl !== void 0 ? { baseUrl: modelBaseUrl } : {},
8238
8238
  ...fallback !== void 0 ? { fallback } : {},
@@ -8517,7 +8517,7 @@ function buildRealRunOptions(args) {
8517
8517
  };
8518
8518
  }
8519
8519
  async function createFixtureRunHelper(args) {
8520
- const sessionMessages = chunkQJVTDW3G_cjs.getSessionMessages(args.inputs.agentId);
8520
+ const sessionMessages = chunk3JGRKXA7_cjs.getSessionMessages(args.inputs.agentId);
8521
8521
  const projectMcpServers = args.inputs.settingSourcesIncludeProject ? await readProjectMcpServers(args.inputs.workspaceCwd) : {};
8522
8522
  return createLocalRun({
8523
8523
  agentId: args.inputs.agentId,
@@ -8536,7 +8536,7 @@ async function createFixtureRunHelper(args) {
8536
8536
  }
8537
8537
  async function dispatchLocalRun(args) {
8538
8538
  const apiKey = chunkRNXXYF22_cjs.resolveApiKey(args.inputs.options.apiKey);
8539
- if (chunk3ZRJ4RNB_cjs.shouldUseRealLocalRuntime(apiKey)) {
8539
+ if (chunkBXEHUUDJ_cjs.shouldUseRealLocalRuntime(apiKey)) {
8540
8540
  return createRealLocalRun(
8541
8541
  buildRealRunOptions({
8542
8542
  inputs: args.inputs,
@@ -8622,10 +8622,10 @@ async function disposeLocalAgentSession(agent) {
8622
8622
  agent.lifecycleAbortController.abort();
8623
8623
  await chunkU3DW3WDE_cjs.withCwdMutex(`agent-send:${agent.agentId}`, () => Promise.resolve());
8624
8624
  disposeSessionMcpClients(agent.agentId);
8625
- await chunkQJVTDW3G_cjs.flushSessionWrites();
8625
+ await chunk3JGRKXA7_cjs.flushSessionWrites();
8626
8626
  await flushRegistrySaves(agent.workspaceCwd);
8627
8627
  await disposeSessionStore(agent.sessionStore);
8628
- chunkQJVTDW3G_cjs.discardSession(agent.workspaceCwd, agent.agentId);
8628
+ chunk3JGRKXA7_cjs.discardSession(agent.workspaceCwd, agent.agentId);
8629
8629
  }
8630
8630
  async function reloadLocalAgent(agent) {
8631
8631
  if (agent.context !== void 0) await agent.context.refresh();
@@ -9489,7 +9489,7 @@ var LocalAgentMemory = class {
9489
9489
  async runActiveMemoryIfEnabled(userText, priorMessages, telemetry) {
9490
9490
  const cfg = this.options.memory?.activeRecall;
9491
9491
  if (cfg?.enabled !== true || this.index === void 0) return void 0;
9492
- if (this.breaker === void 0) this.breaker = new chunk3ZRJ4RNB_cjs.CircuitBreaker();
9492
+ if (this.breaker === void 0) this.breaker = new chunkBXEHUUDJ_cjs.CircuitBreaker();
9493
9493
  if (this.cache === void 0) this.cache = new ActiveMemoryCache();
9494
9494
  const result = await runActiveMemory({
9495
9495
  userText,
@@ -9804,8 +9804,8 @@ async function localAgentUsePersonality(agent, name, opts) {
9804
9804
  registry,
9805
9805
  store: agent.personalityStore,
9806
9806
  invalidateCache: (reason) => agent.invalidateCache(reason),
9807
- appendSessionMessage: (msg) => chunkQJVTDW3G_cjs.appendSessionMessage(agent.agentId, msg),
9808
- clearSession: () => chunkQJVTDW3G_cjs.clearSession(agent.agentId),
9807
+ appendSessionMessage: (msg) => chunk3JGRKXA7_cjs.appendSessionMessage(agent.agentId, msg),
9808
+ clearSession: () => chunk3JGRKXA7_cjs.clearSession(agent.agentId),
9809
9809
  opts: opts ?? {}
9810
9810
  })
9811
9811
  );
@@ -10322,7 +10322,7 @@ function applyIdleReset(agentId, minutes) {
10322
10322
  const previous = lastSendAt.get(agentId);
10323
10323
  lastSendAt.set(agentId, now);
10324
10324
  if (minutes === void 0 || !Number.isFinite(minutes) || minutes <= 0) return;
10325
- if (previous !== void 0 && now - previous > minutes * 6e4) chunkQJVTDW3G_cjs.clearSession(agentId);
10325
+ if (previous !== void 0 && now - previous > minutes * 6e4) chunk3JGRKXA7_cjs.clearSession(agentId);
10326
10326
  }
10327
10327
  async function executeSendLocked(inputs, message, options) {
10328
10328
  if (inputs.disposed) throw new chunkCEGU5AVD_cjs.AgentDisposedError(inputs.agentId);
@@ -10342,7 +10342,7 @@ async function executeSendLocked(inputs, message, options) {
10342
10342
  if (inputs.options.onBeforeSend !== void 0) {
10343
10343
  await inputs.options.onBeforeSend({
10344
10344
  conversationId: inputs.agentId,
10345
- previousMessageCount: chunkQJVTDW3G_cjs.getSessionMessages(inputs.agentId).length
10345
+ previousMessageCount: chunk3JGRKXA7_cjs.getSessionMessages(inputs.agentId).length
10346
10346
  });
10347
10347
  }
10348
10348
  await inputs.runPreHook(userText);
@@ -10354,8 +10354,8 @@ async function executeSendLocked(inputs, message, options) {
10354
10354
  userText,
10355
10355
  sendOptions: options
10356
10356
  });
10357
- const priorMessages = [...chunkQJVTDW3G_cjs.getSessionMessages(inputs.agentId)];
10358
- chunkQJVTDW3G_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
10357
+ const priorMessages = [...chunk3JGRKXA7_cjs.getSessionMessages(inputs.agentId)];
10358
+ chunk3JGRKXA7_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
10359
10359
  await persistMemoryFactIfWritePrompt(inputs.workspaceCwd, inputs.options.memory, userText);
10360
10360
  const memoryFacts = await readMemoryForSend(inputs.workspaceCwd, inputs.options.memory, userText);
10361
10361
  const memoryTools = void 0;
@@ -10708,7 +10708,7 @@ var LocalAgent = class {
10708
10708
  );
10709
10709
  await acquireLeaseIfPossible(this.sessionStore, this.agentId);
10710
10710
  try {
10711
- await chunkQJVTDW3G_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
10711
+ await chunk3JGRKXA7_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
10712
10712
  await this.personalityStore.hydrate(this.agentId);
10713
10713
  } catch (err) {
10714
10714
  await releaseLeaseIfPossible(this.sessionStore, this.agentId);
@@ -11114,22 +11114,22 @@ async function maybeInjectHandoffTools(options) {
11114
11114
  };
11115
11115
  }
11116
11116
  function keyWillFlowToProvider(apiKey, provider) {
11117
- if (chunk3ZRJ4RNB_cjs.isFixtureApiKey(apiKey)) return false;
11118
- if (chunk3ZRJ4RNB_cjs.getConfiguredBaseUrl() !== void 0) return false;
11117
+ if (chunkBXEHUUDJ_cjs.isFixtureApiKey(apiKey)) return false;
11118
+ if (chunkBXEHUUDJ_cjs.getConfiguredBaseUrl() !== void 0) return false;
11119
11119
  if (provider === void 0) return false;
11120
- const profile = chunkEDIYR4VR_cjs.getProviderProfile(provider);
11120
+ const profile = chunkSGKMTBCO_cjs.getProviderProfile(provider);
11121
11121
  if (profile === void 0) return false;
11122
11122
  return profile.authType !== "none";
11123
11123
  }
11124
11124
  function missingApiKeyMessage() {
11125
- const present = chunk3ZRJ4RNB_cjs.presentProviderCredentialEnvVars();
11125
+ const present = chunkBXEHUUDJ_cjs.presentProviderCredentialEnvVars();
11126
11126
  const base = `Missing API key \u2014 set ${chunkRNXXYF22_cjs.API_KEY_ENV_VAR}, or pass \`apiKey\` to Agent.create()`;
11127
11127
  if (present.length === 0) return `${base}.`;
11128
11128
  return `${base}. ${present.join(" and ")} ${present.length === 1 ? "is" : "are"} set, but a provider credential is not read from the environment automatically \u2014 pass it explicitly, e.g. \`Agent.create({ apiKey: process.env.${present[0]}, ... })\`.`;
11129
11129
  }
11130
11130
  function providerNeedsCallerKey(provider) {
11131
11131
  if (provider === void 0) return true;
11132
- const profile = chunkEDIYR4VR_cjs.getProviderProfile(provider);
11132
+ const profile = chunkSGKMTBCO_cjs.getProviderProfile(provider);
11133
11133
  if (profile === void 0) return true;
11134
11134
  return profile.authType === "api_key";
11135
11135
  }
@@ -11142,7 +11142,7 @@ async function createLocalAgent(options) {
11142
11142
  }
11143
11143
  } else {
11144
11144
  const willFlowToProvider = keyWillFlowToProvider(apiKey, provider);
11145
- const shape = chunk3ZRJ4RNB_cjs.validateApiKeyShape(apiKey, {
11145
+ const shape = chunkBXEHUUDJ_cjs.validateApiKeyShape(apiKey, {
11146
11146
  strict: willFlowToProvider,
11147
11147
  ...willFlowToProvider ? { provider } : {}
11148
11148
  });
@@ -11161,15 +11161,15 @@ async function createCloudAgent(options) {
11161
11161
  code: "missing_api_key"
11162
11162
  });
11163
11163
  }
11164
- const shape = chunk3ZRJ4RNB_cjs.validateApiKeyShape(apiKey);
11164
+ const shape = chunkBXEHUUDJ_cjs.validateApiKeyShape(apiKey);
11165
11165
  if (shape.malformed) {
11166
11166
  throw new chunkCEGU5AVD_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
11167
11167
  }
11168
- const baseUrl = chunk3ZRJ4RNB_cjs.getConfiguredBaseUrl();
11168
+ const baseUrl = chunkBXEHUUDJ_cjs.getConfiguredBaseUrl();
11169
11169
  if (baseUrl === void 0) {
11170
11170
  return new CloudAgent(options);
11171
11171
  }
11172
- const response = await chunk3ZRJ4RNB_cjs.httpRequest("/v1/agents", {
11172
+ const response = await chunkBXEHUUDJ_cjs.httpRequest("/v1/agents", {
11173
11173
  apiKey,
11174
11174
  method: "POST",
11175
11175
  body: {
@@ -11194,7 +11194,7 @@ function resolveAgentPersistenceCwd(options) {
11194
11194
  return process.cwd();
11195
11195
  }
11196
11196
  async function rehydrateExistingAgent(agentId, existing, options) {
11197
- await chunk3ZRJ4RNB_cjs.discoverProviderPlugins();
11197
+ await chunkBXEHUUDJ_cjs.discoverProviderPlugins();
11198
11198
  await validateRehydratedAgent(agentId, existing);
11199
11199
  const mergedLocal = options.local !== void 0 && existing.options.local !== void 0 ? { ...existing.options.local, ...options.local } : options.local ?? existing.options.local;
11200
11200
  const mergedMemory = mergeResumedMemory(existing.options.memory, options.memory);
@@ -11355,7 +11355,7 @@ var Agent = class _Agent {
11355
11355
  pluginCount: enabledPluginNames(options.plugins).length
11356
11356
  });
11357
11357
  try {
11358
- await chunk3ZRJ4RNB_cjs.discoverProviderPlugins();
11358
+ await chunkBXEHUUDJ_cjs.discoverProviderPlugins();
11359
11359
  const agent = await runCreateUnderSpan(options, span);
11360
11360
  return agent;
11361
11361
  } catch (err) {
@@ -11662,9 +11662,9 @@ var Agent = class _Agent {
11662
11662
  */
11663
11663
  static async compact(agentId, options = {}) {
11664
11664
  const reg = await requireLocalAgent(agentId, "compact");
11665
- const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-PIDZQ7AR.cjs');
11665
+ const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-OHA543HN.cjs');
11666
11666
  const { cwd, model, store } = await openLocalStore(reg);
11667
- return chunkQJVTDW3G_cjs.enqueueSessionWrite(
11667
+ return chunk3JGRKXA7_cjs.enqueueSessionWrite(
11668
11668
  cwd,
11669
11669
  agentId,
11670
11670
  () => compactSessionTranscript({
@@ -11692,7 +11692,7 @@ var Agent = class _Agent {
11692
11692
  */
11693
11693
  static async injectSessionTurn(agentId, turn) {
11694
11694
  const reg = await requireLocalAgent(agentId, "injectSessionTurn");
11695
- const { injectSessionTurn } = await import('./inject-session-Z2HIB6P6.cjs');
11695
+ const { injectSessionTurn } = await import('./inject-session-NTL2UAE6.cjs');
11696
11696
  const { cwd, model, store } = await openLocalStore(reg);
11697
11697
  await injectSessionTurn({
11698
11698
  store,
@@ -11865,5 +11865,5 @@ exports.managedSettingsPathFor = managedSettingsPathFor;
11865
11865
  exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
11866
11866
  exports.readManagedSettings = readManagedSettings;
11867
11867
  exports.resolveSessionDir = resolveSessionDir;
11868
- //# sourceMappingURL=chunk-LAZTNGNR.cjs.map
11869
- //# sourceMappingURL=chunk-LAZTNGNR.cjs.map
11868
+ //# sourceMappingURL=chunk-BJB6RDEA.cjs.map
11869
+ //# sourceMappingURL=chunk-BJB6RDEA.cjs.map