@theokit/sdk 5.13.0 → 5.14.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 (107) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/{agent-iW5kPpfT.d.cts → agent-DExqjqYy.d.cts} +9 -1
  3. package/dist/{agent-DSMuwADp.d.ts → agent-Dfw3VsIX.d.ts} +9 -1
  4. package/dist/{agent-5DSDDH7K.js → agent-T34LCGQM.js} +11 -11
  5. package/dist/{agent-5DSDDH7K.js.map → agent-T34LCGQM.js.map} +1 -1
  6. package/dist/{agent-WOMRT3KX.cjs → agent-TL4K7BTG.cjs} +12 -12
  7. package/dist/{agent-WOMRT3KX.cjs.map → agent-TL4K7BTG.cjs.map} +1 -1
  8. package/dist/auth/index.cjs +17 -16
  9. package/dist/auth/index.cjs.map +1 -1
  10. package/dist/auth/index.js +5 -4
  11. package/dist/auth/index.js.map +1 -1
  12. package/dist/{chunk-NHOEXFZT.js → chunk-2HXTNVLM.js} +5 -2
  13. package/dist/chunk-2HXTNVLM.js.map +1 -0
  14. package/dist/{chunk-KL7ZUMK3.cjs → chunk-2WY2OFSC.cjs} +146 -77
  15. package/dist/chunk-2WY2OFSC.cjs.map +1 -0
  16. package/dist/{chunk-3FSBE4PS.js → chunk-3GTN4HOO.js} +10 -6
  17. package/dist/chunk-3GTN4HOO.js.map +1 -0
  18. package/dist/{chunk-XOYNB3YN.js → chunk-3ONIVO2I.js} +3 -3
  19. package/dist/{chunk-XOYNB3YN.js.map → chunk-3ONIVO2I.js.map} +1 -1
  20. package/dist/{chunk-7WARNHWW.cjs → chunk-3UMPP553.cjs} +5 -2
  21. package/dist/chunk-3UMPP553.cjs.map +1 -0
  22. package/dist/{chunk-NWWTYBD3.cjs → chunk-4KBI37F3.cjs} +5 -5
  23. package/dist/{chunk-NWWTYBD3.cjs.map → chunk-4KBI37F3.cjs.map} +1 -1
  24. package/dist/{chunk-S46WJTDL.cjs → chunk-4TEGFMSP.cjs} +6 -6
  25. package/dist/{chunk-S46WJTDL.cjs.map → chunk-4TEGFMSP.cjs.map} +1 -1
  26. package/dist/{chunk-QISSETTG.cjs → chunk-5645PMVU.cjs} +6 -4
  27. package/dist/chunk-5645PMVU.cjs.map +1 -0
  28. package/dist/{chunk-5A4UFBHW.cjs → chunk-A77UMVMD.cjs} +15 -11
  29. package/dist/chunk-A77UMVMD.cjs.map +1 -0
  30. package/dist/{chunk-47EACDOC.cjs → chunk-BZK5QL3N.cjs} +4 -4
  31. package/dist/{chunk-47EACDOC.cjs.map → chunk-BZK5QL3N.cjs.map} +1 -1
  32. package/dist/{chunk-5HSMH2ZZ.js → chunk-CJN5CEI3.js} +4 -4
  33. package/dist/{chunk-5HSMH2ZZ.js.map → chunk-CJN5CEI3.js.map} +1 -1
  34. package/dist/{chunk-JX4LB6XO.js → chunk-GARVAUCU.js} +93 -24
  35. package/dist/chunk-GARVAUCU.js.map +1 -0
  36. package/dist/{chunk-DVP3YMDA.cjs → chunk-LXG6VL6R.cjs} +3 -3
  37. package/dist/{chunk-DVP3YMDA.cjs.map → chunk-LXG6VL6R.cjs.map} +1 -1
  38. package/dist/{chunk-ZTP6ZACR.js → chunk-NAVUTK6X.js} +3 -3
  39. package/dist/{chunk-ZTP6ZACR.js.map → chunk-NAVUTK6X.js.map} +1 -1
  40. package/dist/{chunk-2SFLLOMN.js → chunk-NVQSBRG6.js} +3 -3
  41. package/dist/{chunk-2SFLLOMN.js.map → chunk-NVQSBRG6.js.map} +1 -1
  42. package/dist/{chunk-MS3TQSXU.js → chunk-QD6B6W6I.js} +6 -4
  43. package/dist/chunk-QD6B6W6I.js.map +1 -0
  44. package/dist/chunk-R5UQL2R5.cjs +18 -0
  45. package/dist/{chunk-LO6LIUZ6.cjs.map → chunk-R5UQL2R5.cjs.map} +1 -1
  46. package/dist/{chunk-4UYHP6NF.cjs → chunk-SNVYOX46.cjs} +28 -28
  47. package/dist/{chunk-4UYHP6NF.cjs.map → chunk-SNVYOX46.cjs.map} +1 -1
  48. package/dist/{chunk-NKQVLWDF.js → chunk-ULEK4OM4.js} +3 -3
  49. package/dist/{chunk-NKQVLWDF.js.map → chunk-ULEK4OM4.js.map} +1 -1
  50. package/dist/{chunk-2PRGRYEQ.js → chunk-ZOL3L4EH.js} +4 -4
  51. package/dist/{chunk-2PRGRYEQ.js.map → chunk-ZOL3L4EH.js.map} +1 -1
  52. package/dist/{compact-session-B7P6EU3Z.cjs → compact-session-D2MQDB6G.cjs} +15 -15
  53. package/dist/{compact-session-B7P6EU3Z.cjs.map → compact-session-D2MQDB6G.cjs.map} +1 -1
  54. package/dist/{compact-session-5HMX6KYT.js → compact-session-N2PPHQO6.js} +6 -6
  55. package/dist/{compact-session-5HMX6KYT.js.map → compact-session-N2PPHQO6.js.map} +1 -1
  56. package/dist/{cron-DdKzwJqK.d.ts → cron-BubDpFJG.d.ts} +2 -2
  57. package/dist/{cron-BvxrLW5J.d.cts → cron-CK2v0VWA.d.cts} +2 -2
  58. package/dist/cron.cjs +11 -11
  59. package/dist/cron.d.cts +3 -3
  60. package/dist/cron.d.ts +3 -3
  61. package/dist/cron.js +10 -10
  62. package/dist/eval.cjs +10 -10
  63. package/dist/eval.js +9 -9
  64. package/dist/index.cjs +69 -53
  65. package/dist/index.cjs.map +1 -1
  66. package/dist/index.d.cts +9 -6
  67. package/dist/index.d.ts +9 -6
  68. package/dist/index.js +38 -22
  69. package/dist/index.js.map +1 -1
  70. package/dist/{inject-session-WOH7TPDX.cjs → inject-session-3ICZIJ2N.cjs} +4 -4
  71. package/dist/{inject-session-WOH7TPDX.cjs.map → inject-session-3ICZIJ2N.cjs.map} +1 -1
  72. package/dist/{inject-session-75L3NCNL.js → inject-session-J26SHHIO.js} +3 -3
  73. package/dist/{inject-session-75L3NCNL.js.map → inject-session-J26SHHIO.js.map} +1 -1
  74. package/dist/internal/agent-loop/prune-tool-results.d.ts +37 -0
  75. package/dist/internal/auth/credential-store.d.ts +1 -1
  76. package/dist/internal/auth/types.d.ts +4 -0
  77. package/dist/internal/runtime/skills/binary-on-path.d.ts +1 -0
  78. package/dist/internal/runtime/skills/discover-skills.d.ts +2 -0
  79. package/dist/mcp-auth.cjs +2 -2
  80. package/dist/mcp-auth.js +1 -1
  81. package/dist/models.cjs +11 -11
  82. package/dist/models.js +4 -4
  83. package/dist/providers.cjs +6 -6
  84. package/dist/providers.js +4 -4
  85. package/dist/{sdk-agent-4-dXI2GS.d.cts → sdk-agent-DwzHcuxy.d.cts} +28 -3
  86. package/dist/{sdk-agent-CTOJlWA_.d.ts → sdk-agent-a3fW1xUK.d.ts} +28 -3
  87. package/dist/skills.cjs +4 -4
  88. package/dist/skills.js +1 -1
  89. package/dist/subagents-loader.d.cts +2 -2
  90. package/dist/subagents-loader.d.ts +2 -2
  91. package/dist/types/agent.d.ts +6 -0
  92. package/dist/types/run.d.ts +27 -2
  93. package/dist/workflow.d.cts +1 -1
  94. package/dist/workflow.d.ts +1 -1
  95. package/docs/adr/mutation-testing-scope.md +56 -0
  96. package/docs/error-codes.md +8 -6
  97. package/docs/harness-capability-map.md +29 -1
  98. package/package.json +1 -1
  99. package/dist/chunk-3FSBE4PS.js.map +0 -1
  100. package/dist/chunk-5A4UFBHW.cjs.map +0 -1
  101. package/dist/chunk-7WARNHWW.cjs.map +0 -1
  102. package/dist/chunk-JX4LB6XO.js.map +0 -1
  103. package/dist/chunk-KL7ZUMK3.cjs.map +0 -1
  104. package/dist/chunk-LO6LIUZ6.cjs +0 -18
  105. package/dist/chunk-MS3TQSXU.js.map +0 -1
  106. package/dist/chunk-NHOEXFZT.js.map +0 -1
  107. package/dist/chunk-QISSETTG.cjs.map +0 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkL7JPXZ2C_cjs = require('./chunk-L7JPXZ2C.cjs');
4
- var chunkDVP3YMDA_cjs = require('./chunk-DVP3YMDA.cjs');
4
+ var chunkLXG6VL6R_cjs = require('./chunk-LXG6VL6R.cjs');
5
5
  var chunkCWQPQTUZ_cjs = require('./chunk-CWQPQTUZ.cjs');
6
6
  var chunk7YUPSBDV_cjs = require('./chunk-7YUPSBDV.cjs');
7
7
  var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
@@ -9,7 +9,7 @@ var chunkCGH4BCIY_cjs = require('./chunk-CGH4BCIY.cjs');
9
9
  var chunkRS7YQR4X_cjs = require('./chunk-RS7YQR4X.cjs');
10
10
  var chunkSDZ4XDWS_cjs = require('./chunk-SDZ4XDWS.cjs');
11
11
  var chunk6OCJWGVD_cjs = require('./chunk-6OCJWGVD.cjs');
12
- var chunk4UYHP6NF_cjs = require('./chunk-4UYHP6NF.cjs');
12
+ var chunkSNVYOX46_cjs = require('./chunk-SNVYOX46.cjs');
13
13
  var chunk2ZPEDVLM_cjs = require('./chunk-2ZPEDVLM.cjs');
14
14
  var chunkQG4SXZ2A_cjs = require('./chunk-QG4SXZ2A.cjs');
15
15
  var chunkUDAKAE4Z_cjs = require('./chunk-UDAKAE4Z.cjs');
@@ -18,7 +18,7 @@ var chunkAA27GEYS_cjs = require('./chunk-AA27GEYS.cjs');
18
18
  var chunkYSTXFWQE_cjs = require('./chunk-YSTXFWQE.cjs');
19
19
  var chunkH7HD6RXO_cjs = require('./chunk-H7HD6RXO.cjs');
20
20
  var chunkNINIJCHU_cjs = require('./chunk-NINIJCHU.cjs');
21
- var chunk7WARNHWW_cjs = require('./chunk-7WARNHWW.cjs');
21
+ var chunk3UMPP553_cjs = require('./chunk-3UMPP553.cjs');
22
22
  var chunkIJ7M6GOG_cjs = require('./chunk-IJ7M6GOG.cjs');
23
23
  var chunk3KIUY67P_cjs = require('./chunk-3KIUY67P.cjs');
24
24
  var chunkSA6K24NB_cjs = require('./chunk-SA6K24NB.cjs');
@@ -31,10 +31,10 @@ var chunkWDVG5R2Q_cjs = require('./chunk-WDVG5R2Q.cjs');
31
31
  var chunkYQ3XC6C2_cjs = require('./chunk-YQ3XC6C2.cjs');
32
32
  var chunk6XQLTQB6_cjs = require('./chunk-6XQLTQB6.cjs');
33
33
  var chunkKX5QXLBS_cjs = require('./chunk-KX5QXLBS.cjs');
34
- var chunkNWWTYBD3_cjs = require('./chunk-NWWTYBD3.cjs');
34
+ var chunk4KBI37F3_cjs = require('./chunk-4KBI37F3.cjs');
35
35
  var chunk3EE6LVWT_cjs = require('./chunk-3EE6LVWT.cjs');
36
- var chunkLO6LIUZ6_cjs = require('./chunk-LO6LIUZ6.cjs');
37
- var chunkS46WJTDL_cjs = require('./chunk-S46WJTDL.cjs');
36
+ var chunkR5UQL2R5_cjs = require('./chunk-R5UQL2R5.cjs');
37
+ var chunk4TEGFMSP_cjs = require('./chunk-4TEGFMSP.cjs');
38
38
  var chunkNVXXWAU7_cjs = require('./chunk-NVXXWAU7.cjs');
39
39
  var chunkEHD25JBZ_cjs = require('./chunk-EHD25JBZ.cjs');
40
40
  var chunkCEGU5AVD_cjs = require('./chunk-CEGU5AVD.cjs');
@@ -1624,7 +1624,7 @@ function createRealCloudRun(options) {
1624
1624
  conversation: []
1625
1625
  };
1626
1626
  const apiKey = chunkRNXXYF22_cjs.resolveApiKey(options.agentOptions.apiKey);
1627
- const baseUrl = chunk4UYHP6NF_cjs.getConfiguredBaseUrl();
1627
+ const baseUrl = chunkSNVYOX46_cjs.getConfiguredBaseUrl();
1628
1628
  const handle = new RealCloudRun(
1629
1629
  {
1630
1630
  id,
@@ -1707,7 +1707,7 @@ var RealCloudRun = class extends FixtureRunBase {
1707
1707
  async consumeStream(response) {
1708
1708
  let finalStatus = "finished";
1709
1709
  let finalText = "";
1710
- for await (const record of chunk4UYHP6NF_cjs.parseSseStream(response.body, this.controller.signal)) {
1710
+ for await (const record of chunkSNVYOX46_cjs.parseSseStream(response.body, this.controller.signal)) {
1711
1711
  const parsed = safeParse(record.data);
1712
1712
  if (parsed === void 0) continue;
1713
1713
  const update = this.applyRecord(record.event, parsed);
@@ -1874,7 +1874,7 @@ var CloudAgent = class _CloudAgent {
1874
1874
  */
1875
1875
  isFixtureMode() {
1876
1876
  const apiKey = chunkRNXXYF22_cjs.resolveApiKey(this.options.apiKey);
1877
- return chunk4UYHP6NF_cjs.isFixtureApiKey(apiKey) && chunk4UYHP6NF_cjs.getConfiguredBaseUrl() === void 0;
1877
+ return chunkSNVYOX46_cjs.isFixtureApiKey(apiKey) && chunkSNVYOX46_cjs.getConfiguredBaseUrl() === void 0;
1878
1878
  }
1879
1879
  // SE9 — integrated structured output; delegates to the shared helper.
1880
1880
  generate(message, options) {
@@ -1929,7 +1929,7 @@ var CloudAgent = class _CloudAgent {
1929
1929
  const userText = typeof message === "string" ? message : message.text;
1930
1930
  const systemPrompt = await this.resolveSystemPromptForSend(userText, options);
1931
1931
  const apiKey = chunkRNXXYF22_cjs.resolveApiKey(this.options.apiKey);
1932
- const useRealRuntime = apiKey !== void 0 && !chunk4UYHP6NF_cjs.isFixtureApiKey(apiKey) && chunk4UYHP6NF_cjs.getConfiguredBaseUrl() !== void 0;
1932
+ const useRealRuntime = apiKey !== void 0 && !chunkSNVYOX46_cjs.isFixtureApiKey(apiKey) && chunkSNVYOX46_cjs.getConfiguredBaseUrl() !== void 0;
1933
1933
  return useRealRuntime ? createRealCloudRun({
1934
1934
  agentId: this.agentId,
1935
1935
  model: this.model ?? { id: DEFAULT_AGENTIC_MODEL_ID },
@@ -2969,7 +2969,7 @@ function resolveWindowForRun(model, contextWindow) {
2969
2969
  const override = contextWindow !== void 0 && contextWindow > 0 ? contextWindow : void 0;
2970
2970
  return chunkKX5QXLBS_cjs.resolveEffectiveContextWindow({
2971
2971
  ...override !== void 0 ? { override } : {},
2972
- catalog: chunkS46WJTDL_cjs.getCatalogModelInfo(model)?.limit?.context,
2972
+ catalog: chunk4TEGFMSP_cjs.getCatalogModelInfo(model)?.limit?.context,
2973
2973
  margin: chunkKX5QXLBS_cjs.CONTEXT_WINDOW_MARGIN,
2974
2974
  floor: chunkKX5QXLBS_cjs.CONTEXT_WINDOW_FLOOR
2975
2975
  });
@@ -2994,7 +2994,7 @@ async function runPostRunLifecycle(inputs) {
2994
2994
  try {
2995
2995
  const partial = await safeConversation(run);
2996
2996
  if (partial !== void 0) {
2997
- chunkDVP3YMDA_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
2997
+ chunkLXG6VL6R_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
2998
2998
  userText,
2999
2999
  conversation: partial
3000
3000
  });
@@ -3004,11 +3004,11 @@ async function runPostRunLifecycle(inputs) {
3004
3004
  chunkRNXXYF22_cjs.diag(`[theokit-sdk] partial transcript write failed (${agentId}): ${msg}
3005
3005
  `);
3006
3006
  }
3007
- await chunkDVP3YMDA_cjs.flushSessionWrites();
3007
+ await chunkLXG6VL6R_cjs.flushSessionWrites();
3008
3008
  return;
3009
3009
  }
3010
3010
  if (result.result !== void 0) {
3011
- chunkDVP3YMDA_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
3011
+ chunkLXG6VL6R_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
3012
3012
  }
3013
3013
  const conversation = await safeConversation(run);
3014
3014
  const resolvedWindow = resolveWindowForRun(model, contextWindow);
@@ -3019,7 +3019,7 @@ async function runPostRunLifecycle(inputs) {
3019
3019
  }
3020
3020
  const lastRequestUsage = result.usage?.requests?.at(-1)?.totalTokens;
3021
3021
  const usageForTrigger = lastRequestUsage ?? result.usage?.totalTokens;
3022
- chunkDVP3YMDA_cjs.persistTurnToTranscript(
3022
+ chunkLXG6VL6R_cjs.persistTurnToTranscript(
3023
3023
  sessionStore,
3024
3024
  { cwd: workspaceCwd, agentId, model },
3025
3025
  agentId,
@@ -3031,7 +3031,7 @@ async function runPostRunLifecycle(inputs) {
3031
3031
  // The EFFECTIVE window (after override, clamp and margin) — not the declared one. Swapping for
3032
3032
  // `contextWindow` here would budget against a number the clamp already rejected.
3033
3033
  contextWindow: effectiveWindow,
3034
- summarize: chunk4UYHP6NF_cjs.buildDefaultSummarizer({
3034
+ summarize: chunkSNVYOX46_cjs.buildDefaultSummarizer({
3035
3035
  agentModel: model,
3036
3036
  ...inputs.apiKey !== void 0 ? { apiKey: inputs.apiKey } : {}
3037
3037
  })
@@ -3073,7 +3073,7 @@ async function runPostRunLifecycle(inputs) {
3073
3073
  agentId,
3074
3074
  runId: result.id
3075
3075
  });
3076
- await chunkDVP3YMDA_cjs.flushSessionWrites();
3076
+ await chunkLXG6VL6R_cjs.flushSessionWrites();
3077
3077
  }
3078
3078
  async function safeConversation(run) {
3079
3079
  try {
@@ -3090,12 +3090,12 @@ var WORKSPACE_TRUST = {
3090
3090
  entries: "absolute folder realpaths"
3091
3091
  };
3092
3092
  function workspaceTrustRecordPath() {
3093
- return path.join(path.dirname(chunk4UYHP6NF_cjs.trustFilePath()), "trusted-workspace-plugins.json");
3093
+ return path.join(path.dirname(chunkSNVYOX46_cjs.trustFilePath()), "trusted-workspace-plugins.json");
3094
3094
  }
3095
3095
  function readTrustedWorkspaceFolders() {
3096
3096
  const path$1 = workspaceTrustRecordPath();
3097
3097
  const trusted = /* @__PURE__ */ new Set();
3098
- for (const entry of chunk4UYHP6NF_cjs.readTrustArray(path$1, WORKSPACE_TRUST)) {
3098
+ for (const entry of chunkSNVYOX46_cjs.readTrustArray(path$1, WORKSPACE_TRUST)) {
3099
3099
  if (path.isAbsolute(entry)) {
3100
3100
  trusted.add(entry);
3101
3101
  continue;
@@ -3166,38 +3166,61 @@ async function importEntry(candidate) {
3166
3166
  function isGeneralPlugin(value) {
3167
3167
  return chunkBV2MWEMV_cjs.isCodePlugin(value) && value.kind === "general" && typeof value.name === "string";
3168
3168
  }
3169
+ function executableExtensions() {
3170
+ return process.platform === "win32" ? ["", ...(process.env.PATHEXT ?? ".EXE;.CMD").split(";")] : [""];
3171
+ }
3172
+ function isExecutable(file) {
3173
+ try {
3174
+ fs.accessSync(file, fs.constants.X_OK);
3175
+ return true;
3176
+ } catch {
3177
+ return false;
3178
+ }
3179
+ }
3180
+ function binaryOnPath(bin) {
3181
+ if (bin.length === 0 || /[\\/]/.test(bin)) return false;
3182
+ const dirs = (process.env.PATH ?? "").split(path.delimiter).filter((dir) => dir.length > 0);
3183
+ return dirs.some(
3184
+ (dir) => executableExtensions().some((ext) => isExecutable(path.join(dir, bin + ext)))
3185
+ );
3186
+ }
3169
3187
  var SkillsManager = class {
3170
- constructor(cwd, _enabled, settingSourcesIncludeProject, skillsDir, inline, compatSources = []) {
3188
+ constructor(cwd, _enabled, settingSourcesIncludeProject, skillsDir, inline, compatSources = [], bundledDirs = []) {
3171
3189
  this.cwd = cwd;
3172
3190
  this.settingSourcesIncludeProject = settingSourcesIncludeProject;
3173
3191
  this.skillsDir = skillsDir;
3174
3192
  this.inline = inline;
3175
3193
  this.compatSources = compatSources;
3194
+ this.bundledDirs = bundledDirs;
3176
3195
  }
3177
3196
  cwd;
3178
3197
  settingSourcesIncludeProject;
3179
3198
  skillsDir;
3180
3199
  inline;
3181
3200
  compatSources;
3201
+ bundledDirs;
3182
3202
  skills = [];
3183
3203
  async initialize() {
3184
3204
  if (!this.settingSourcesIncludeProject) {
3185
- this.skills = this.mergeInline([]);
3205
+ this.skills = this.mergeInline(await this.discoverFrom(this.bundledDirs));
3186
3206
  return;
3187
3207
  }
3188
3208
  await this.refresh();
3189
3209
  }
3190
3210
  async refresh() {
3191
- const roots = this.skillsDir === void 0 ? [
3211
+ const ownRoots = this.skillsDir === void 0 ? [
3192
3212
  ...chunkYQ3XC6C2_cjs.projectConfigRoots(this.cwd, this.compatSources, "skills").map(
3193
3213
  (root) => path.join(root, "skills")
3194
3214
  ),
3195
3215
  ...(await chunkWDVG5R2Q_cjs.pluginBundleDirs(this.cwd, this.compatSources)).map((b) => path.join(b, "skills"))
3196
3216
  ] : [this.skillsDir];
3217
+ this.skills = this.mergeInline(await this.discoverFrom([...ownRoots, ...this.bundledDirs]));
3218
+ }
3219
+ async discoverFrom(roots) {
3197
3220
  const discovered = [];
3198
3221
  const seen = /* @__PURE__ */ new Set();
3199
3222
  for (const root of roots) {
3200
- for (const skill of await chunk7WARNHWW_cjs.discoverSkills(root, {
3223
+ for (const skill of await chunk3UMPP553_cjs.discoverSkills(root, {
3201
3224
  onInvalidSkill: (info) => {
3202
3225
  chunkRNXXYF22_cjs.diag(`[theokit-sdk] skill ${info.name} skipped (${info.code}): ${info.message}
3203
3226
  `);
@@ -3208,7 +3231,7 @@ var SkillsManager = class {
3208
3231
  discovered.push(skill);
3209
3232
  }
3210
3233
  }
3211
- this.skills = this.mergeInline(discovered);
3234
+ return discovered;
3212
3235
  }
3213
3236
  /** M22 — merge inline skills over discovered ones; inline wins on a name conflict. */
3214
3237
  mergeInline(discovered) {
@@ -3228,7 +3251,7 @@ var SkillsManager = class {
3228
3251
  async get(name) {
3229
3252
  const skill = this.skills.find((s) => s.name === name);
3230
3253
  if (skill === void 0) return void 0;
3231
- const instructions = typeof skill.instructions === "string" ? skill.instructions : chunk7WARNHWW_cjs.stripSkillFrontmatter(await promises.readFile(skill.source, "utf8"));
3254
+ const instructions = typeof skill.instructions === "string" ? skill.instructions : chunk3UMPP553_cjs.stripSkillFrontmatter(await promises.readFile(skill.source, "utf8"));
3232
3255
  const references = skill.references;
3233
3256
  return {
3234
3257
  name: skill.name,
@@ -3336,7 +3359,8 @@ async function resolveSendSkills(inputs, userText, memoryFacts) {
3336
3359
  inputs.settingSourcesIncludeProject,
3337
3360
  settings.skillsDir,
3338
3361
  settings.inline,
3339
- resolveCompatSources(inputs.options, inputs.workspaceCwd)
3362
+ resolveCompatSources(inputs.options, inputs.workspaceCwd),
3363
+ settings.bundledDirs
3340
3364
  );
3341
3365
  await manager.initialize();
3342
3366
  return { manager, autoInject: settings.autoInject ?? true };
@@ -3355,7 +3379,9 @@ async function buildSystemPromptContext(inputs, userText, memoryFacts, manager =
3355
3379
  // because a caller naming one has already made the decision this field keeps away from the
3356
3380
  // model. Widening it to execution would break the case the field is FOR — a side-effecting
3357
3381
  // skill a human may run and the model may not propose.
3358
- skills: skills.filter((skill) => skill.disableModelInvocation !== true).map((skill) => ({ name: skill.name, description: skill.description })),
3382
+ skills: skills.filter((skill) => skill.disableModelInvocation !== true).filter(
3383
+ (skill) => skill.requiresBins === void 0 || skill.requiresBins.every((bin) => binaryOnPath(bin))
3384
+ ).map((skill) => ({ name: skill.name, description: skill.description })),
3359
3385
  userMessage: userText,
3360
3386
  memory: memoryFacts.map((fact) => ({ text: fact.text }))
3361
3387
  };
@@ -3415,7 +3441,7 @@ var ActiveMemoryPromptProvider = class {
3415
3441
  if (ctx.activeMemorySummary === void 0 || ctx.activeMemorySummary.length === 0) {
3416
3442
  return Promise.resolve(void 0);
3417
3443
  }
3418
- const body = chunk7WARNHWW_cjs.escapeBlockBody(ctx.activeMemorySummary);
3444
+ const body = chunk3UMPP553_cjs.escapeBlockBody(ctx.activeMemorySummary);
3419
3445
  return Promise.resolve(`<active-memory>
3420
3446
  ${body}
3421
3447
  </active-memory>`);
@@ -3468,7 +3494,7 @@ function formatSource(name, tokens) {
3468
3494
  if (tokens.length === 0) {
3469
3495
  return ` <source name="${escapeAttribute(name)}" />`;
3470
3496
  }
3471
- const body = chunk7WARNHWW_cjs.escapeBlockBody(tokens.join(" "));
3497
+ const body = chunk3UMPP553_cjs.escapeBlockBody(tokens.join(" "));
3472
3498
  return ` <source name="${escapeAttribute(name)}">
3473
3499
  ${body}
3474
3500
  </source>`;
@@ -3492,7 +3518,7 @@ var MemoryPromptProvider = class {
3492
3518
  if (ctx.memory.length === 0) return Promise.resolve(void 0);
3493
3519
  const lines = ctx.memory.map((fact) => {
3494
3520
  const tag = fact.observations === 1 ? "[unconfirmed] " : "";
3495
- return ` - ${tag}${chunk7WARNHWW_cjs.escapeBlockBody(fact.text)}`;
3521
+ return ` - ${tag}${chunk3UMPP553_cjs.escapeBlockBody(fact.text)}`;
3496
3522
  });
3497
3523
  return Promise.resolve(`${MEMORY_GUIDANCE}
3498
3524
  <memory>
@@ -3516,7 +3542,7 @@ var SkillsPromptProvider = class {
3516
3542
  priority = 20;
3517
3543
  contribute(ctx) {
3518
3544
  if (ctx.skillsAutoInject === false) return Promise.resolve(void 0);
3519
- return Promise.resolve(chunk7WARNHWW_cjs.buildSkillsBlock(ctx.skills));
3545
+ return Promise.resolve(chunk3UMPP553_cjs.buildSkillsBlock(ctx.skills));
3520
3546
  }
3521
3547
  };
3522
3548
 
@@ -3785,7 +3811,7 @@ var HISTOGRAM_NAMES = {
3785
3811
  };
3786
3812
  function safeRequire(moduleName) {
3787
3813
  try {
3788
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-KL7ZUMK3.cjs', document.baseURI).href)));
3814
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-2WY2OFSC.cjs', document.baseURI).href)));
3789
3815
  return r(moduleName);
3790
3816
  } catch {
3791
3817
  return void 0;
@@ -4028,7 +4054,7 @@ var cachedOtel;
4028
4054
  function loadOtel() {
4029
4055
  if (cachedOtel === void 0) {
4030
4056
  try {
4031
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-KL7ZUMK3.cjs', document.baseURI).href)));
4057
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-2WY2OFSC.cjs', document.baseURI).href)));
4032
4058
  const mod = r("@opentelemetry/api");
4033
4059
  cachedOtel = mod;
4034
4060
  } catch {
@@ -4900,7 +4926,8 @@ function buildSkills(args, out) {
4900
4926
  staticSkills?.inline,
4901
4927
  // #524 — the same declaration the per-send manager reads. Omitting it here would make
4902
4928
  // `agent.skills` disagree with the system prompt about which skills exist.
4903
- resolveCompatSources(args.options, args.workspaceCwd)
4929
+ resolveCompatSources(args.options, args.workspaceCwd),
4930
+ staticSkills?.bundledDirs
4904
4931
  );
4905
4932
  const localSkills = out.skillsManager;
4906
4933
  out.skills = {
@@ -5752,7 +5779,7 @@ function catalogCostFallback(provider, cleanedModel) {
5752
5779
  const candidates = [`${provider}/${cleanedModel}`, cleanedModel];
5753
5780
  if (stripped !== cleanedModel) candidates.push(`${provider}/${stripped}`, stripped);
5754
5781
  for (const key of candidates) {
5755
- const info = chunkS46WJTDL_cjs.getCatalogModelInfo(key);
5782
+ const info = chunk4TEGFMSP_cjs.getCatalogModelInfo(key);
5756
5783
  const cost = info?.cost;
5757
5784
  if (cost === void 0) continue;
5758
5785
  const [prov, ...modelParts] = key.split("/");
@@ -5764,7 +5791,7 @@ function catalogCostFallback(provider, cleanedModel) {
5764
5791
  ...cost.cache_read !== void 0 ? { cacheReadCostPerMillion: cost.cache_read } : {},
5765
5792
  ...cost.cache_write !== void 0 ? { cacheWriteCostPerMillion: cost.cache_write } : {},
5766
5793
  // M44 M5 fix — honest provenance: a key patched by the LIVE models-dev source is not "vendored".
5767
- pricingVersion: chunkS46WJTDL_cjs.isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
5794
+ pricingVersion: chunk4TEGFMSP_cjs.isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
5768
5795
  };
5769
5796
  }
5770
5797
  return void 0;
@@ -5967,6 +5994,42 @@ function stripThinkBlocks(content) {
5967
5994
  return { visible, thinking };
5968
5995
  }
5969
5996
 
5997
+ // src/internal/agent-loop/prune-tool-results.ts
5998
+ function stubFor(olderThanRounds) {
5999
+ return `[tool result pruned: older than ${olderThanRounds} rounds]`;
6000
+ }
6001
+ function carriesToolResult(message) {
6002
+ return message.content.some((part) => part.type === "tool_result");
6003
+ }
6004
+ function stubbed(message, stub) {
6005
+ const content = message.content.map(
6006
+ (part) => part.type === "tool_result" ? { ...part, content: stub } : part
6007
+ );
6008
+ return { ...message, content };
6009
+ }
6010
+ function pruneToolResultsForRequest(messages, options) {
6011
+ if (options === void 0) return messages;
6012
+ const stub = stubFor(options.olderThanRounds);
6013
+ const out = [...messages];
6014
+ let rounds = 0;
6015
+ for (let index = messages.length - 1; index >= 0; index -= 1) {
6016
+ const message = messages[index];
6017
+ if (!carriesToolResult(message)) continue;
6018
+ rounds += 1;
6019
+ if (rounds > options.olderThanRounds) out[index] = stubbed(message, stub);
6020
+ }
6021
+ return out;
6022
+ }
6023
+ function validatePruneToolResults(options) {
6024
+ if (options === void 0) return;
6025
+ const value = options.olderThanRounds;
6026
+ if (typeof value === "number" && Number.isInteger(value) && value >= 1) return;
6027
+ throw new chunkCEGU5AVD_cjs.ConfigurationError(
6028
+ `SendOptions.pruneToolResults.olderThanRounds must be an integer of at least 1, got ${String(value)}`,
6029
+ { code: "invalid_prune_tool_results" }
6030
+ );
6031
+ }
6032
+
5970
6033
  // src/internal/agent-loop/loop-llm-stream.ts
5971
6034
  function resolveSystemPromptWithMemoryAdditions(systemPrompt, additions) {
5972
6035
  if (additions === void 0 || additions.length === 0) return systemPrompt;
@@ -5978,11 +6041,11 @@ ${systemPrompt}`;
5978
6041
  }
5979
6042
  function activeMemoryBlock(additions) {
5980
6043
  return `<active-memory>
5981
- ${chunk7WARNHWW_cjs.escapeBlockBody(additions)}
6044
+ ${chunk3UMPP553_cjs.escapeBlockBody(additions)}
5982
6045
  </active-memory>`;
5983
6046
  }
5984
6047
  function buildLoopSystem(systemPrompt, additions, modelId) {
5985
- if (!chunkNWWTYBD3_cjs.isAnthropicFamilyModel(modelId) || systemPrompt === void 0 || systemPrompt.length === 0) {
6048
+ if (!chunk4KBI37F3_cjs.isAnthropicFamilyModel(modelId) || systemPrompt === void 0 || systemPrompt.length === 0) {
5986
6049
  return resolveSystemPromptWithMemoryAdditions(systemPrompt, additions);
5987
6050
  }
5988
6051
  const blocks = [{ text: systemPrompt, cacheable: true }];
@@ -6055,7 +6118,8 @@ async function streamLlmTurn(inputs, ctx) {
6055
6118
  const key = derivePromptCacheKey(inputs.agentId);
6056
6119
  return key !== void 0 ? { promptCacheKey: key } : {};
6057
6120
  })(),
6058
- messages: ctx.messages,
6121
+ // B-564: the request gets a pruned copy; ctx.messages stays whole (the transcript is resent from it).
6122
+ messages: pruneToolResultsForRequest(ctx.messages, inputs.pruneToolResults),
6059
6123
  tools: ctx.tools.map(toLlmTool)
6060
6124
  },
6061
6125
  signal
@@ -6846,7 +6910,7 @@ function applyToolResultGuard(parts, opts) {
6846
6910
  (p) => (
6847
6911
  // SE7 — guard the TEXT of a tool result (string or the text blocks of a
6848
6912
  // structured content); image blocks pass through untouched.
6849
- p.type === "tool_result" ? { ...p, content: chunk4UYHP6NF_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
6913
+ p.type === "tool_result" ? { ...p, content: chunkSNVYOX46_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
6850
6914
  )
6851
6915
  );
6852
6916
  }
@@ -7164,13 +7228,13 @@ var FallbackLlmClient = class {
7164
7228
  async *stream(request, signal) {
7165
7229
  let lastError;
7166
7230
  for (const client of this.clients) {
7167
- if (signal.aborted) throw chunk4UYHP6NF_cjs.abortError(signal);
7168
- const attempt = await chunk4UYHP6NF_cjs.tryFirstEvent(client, request, signal, true);
7231
+ if (signal.aborted) throw chunkSNVYOX46_cjs.abortError(signal);
7232
+ const attempt = await chunkSNVYOX46_cjs.tryFirstEvent(client, request, signal, true);
7169
7233
  if (attempt.kind === "handshake_error") {
7170
7234
  lastError = attempt.error;
7171
7235
  continue;
7172
7236
  }
7173
- return yield* chunk4UYHP6NF_cjs.relayStream(attempt.generator, attempt.firstResult);
7237
+ return yield* chunkSNVYOX46_cjs.relayStream(attempt.generator, attempt.firstResult);
7174
7238
  }
7175
7239
  if (lastError !== void 0) throw lastError;
7176
7240
  throw new chunkCEGU5AVD_cjs.NetworkError("FallbackLlmClient has no providers configured", {
@@ -7798,6 +7862,13 @@ function createRealLocalRun(options) {
7798
7862
  registerRun(handle);
7799
7863
  return handle;
7800
7864
  }
7865
+ function toolResultPolicyInputs(sendOptions) {
7866
+ return {
7867
+ ...sendOptions.perToolTimeoutMs !== void 0 ? { perToolTimeoutMs: sendOptions.perToolTimeoutMs } : {},
7868
+ ...sendOptions.toolResultGuard !== void 0 ? { toolResultGuard: sendOptions.toolResultGuard } : {},
7869
+ ...sendOptions.pruneToolResults !== void 0 ? { pruneToolResults: sendOptions.pruneToolResults } : {}
7870
+ };
7871
+ }
7801
7872
  function buildLoopInputs(options, runId, userText, userImages) {
7802
7873
  const maxIterations = options.sendOptions.maxIterations;
7803
7874
  if (maxIterations !== void 0 && (!Number.isInteger(maxIterations) || maxIterations < 1)) {
@@ -7806,9 +7877,10 @@ function buildLoopInputs(options, runId, userText, userImages) {
7806
7877
  { code: "invalid_max_iterations" }
7807
7878
  );
7808
7879
  }
7809
- const { primary, effectiveModelId } = chunk4UYHP6NF_cjs.resolveRunProvider(options);
7880
+ validatePruneToolResults(options.sendOptions.pruneToolResults);
7881
+ const { primary, effectiveModelId } = chunkSNVYOX46_cjs.resolveRunProvider(options);
7810
7882
  const fallback = options.agentOptions.providers?.fallback;
7811
- const apiKeys = chunk4UYHP6NF_cjs.mergeExplicitApiKey(
7883
+ const apiKeys = chunkSNVYOX46_cjs.mergeExplicitApiKey(
7812
7884
  options.agentOptions.providers?.apiKeys,
7813
7885
  primary,
7814
7886
  options.agentOptions.apiKey
@@ -7817,7 +7889,7 @@ function buildLoopInputs(options, runId, userText, userImages) {
7817
7889
  const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
7818
7890
  const rateLimitSink = options.sendOptions.onRunEvent;
7819
7891
  const modelBaseUrl = options.model?.url;
7820
- const chain = chunk4UYHP6NF_cjs.resolveProviderChain({
7892
+ const chain = chunkSNVYOX46_cjs.resolveProviderChain({
7821
7893
  primary,
7822
7894
  ...modelBaseUrl !== void 0 ? { baseUrl: modelBaseUrl } : {},
7823
7895
  ...fallback !== void 0 ? { fallback } : {},
@@ -7875,10 +7947,7 @@ function buildLoopInputs(options, runId, userText, userImages) {
7875
7947
  ...options.sendOptions.context !== void 0 ? { context: options.sendOptions.context } : {},
7876
7948
  // SE2 — forward the opt-in typed runtime-event sink to the loop.
7877
7949
  ...options.sendOptions.onRunEvent !== void 0 ? { runEventSink: options.sendOptions.onRunEvent } : {},
7878
- // #58 / #57 — forward the per-tool timeout + tool-result guard so a consumer
7879
- // can enable them via SendOptions (not only internal AgentLoopInputs).
7880
- ...options.sendOptions.perToolTimeoutMs !== void 0 ? { perToolTimeoutMs: options.sendOptions.perToolTimeoutMs } : {},
7881
- ...options.sendOptions.toolResultGuard !== void 0 ? { toolResultGuard: options.sendOptions.toolResultGuard } : {},
7950
+ ...toolResultPolicyInputs(options.sendOptions),
7882
7951
  // M1-2: per-send iteration ceiling (validated above). The loop reads
7883
7952
  // inputs.maxIterations (default 8 when unset).
7884
7953
  ...maxIterations !== void 0 ? { maxIterations } : {},
@@ -8103,7 +8172,7 @@ function buildRealRunOptions(args) {
8103
8172
  };
8104
8173
  }
8105
8174
  async function createFixtureRunHelper(args) {
8106
- const sessionMessages = chunkDVP3YMDA_cjs.getSessionMessages(args.inputs.agentId);
8175
+ const sessionMessages = chunkLXG6VL6R_cjs.getSessionMessages(args.inputs.agentId);
8107
8176
  const projectMcpServers = args.inputs.settingSourcesIncludeProject ? await readProjectMcpServers(args.inputs.workspaceCwd) : {};
8108
8177
  return createLocalRun({
8109
8178
  agentId: args.inputs.agentId,
@@ -8122,7 +8191,7 @@ async function createFixtureRunHelper(args) {
8122
8191
  }
8123
8192
  async function dispatchLocalRun(args) {
8124
8193
  const apiKey = chunkRNXXYF22_cjs.resolveApiKey(args.inputs.options.apiKey);
8125
- if (chunk4UYHP6NF_cjs.shouldUseRealLocalRuntime(apiKey)) {
8194
+ if (chunkSNVYOX46_cjs.shouldUseRealLocalRuntime(apiKey)) {
8126
8195
  return createRealLocalRun(
8127
8196
  buildRealRunOptions({
8128
8197
  inputs: args.inputs,
@@ -8378,10 +8447,10 @@ async function disposeLocalAgentSession(agent) {
8378
8447
  agent.lifecycleAbortController.abort();
8379
8448
  await chunkZF2LDKQQ_cjs.withCwdMutex(`agent-send:${agent.agentId}`, () => Promise.resolve());
8380
8449
  disposeSessionMcpClients(agent.agentId);
8381
- await chunkDVP3YMDA_cjs.flushSessionWrites();
8450
+ await chunkLXG6VL6R_cjs.flushSessionWrites();
8382
8451
  await flushRegistrySaves(agent.workspaceCwd);
8383
8452
  await disposeSessionStore(agent.sessionStore);
8384
- chunkDVP3YMDA_cjs.discardSession(agent.workspaceCwd, agent.agentId);
8453
+ chunkLXG6VL6R_cjs.discardSession(agent.workspaceCwd, agent.agentId);
8385
8454
  }
8386
8455
  async function reloadLocalAgent(agent) {
8387
8456
  if (agent.context !== void 0) await agent.context.refresh();
@@ -9245,7 +9314,7 @@ var LocalAgentMemory = class {
9245
9314
  async runActiveMemoryIfEnabled(userText, priorMessages, telemetry) {
9246
9315
  const cfg = this.options.memory?.activeRecall;
9247
9316
  if (cfg?.enabled !== true || this.index === void 0) return void 0;
9248
- if (this.breaker === void 0) this.breaker = new chunk4UYHP6NF_cjs.CircuitBreaker();
9317
+ if (this.breaker === void 0) this.breaker = new chunkSNVYOX46_cjs.CircuitBreaker();
9249
9318
  if (this.cache === void 0) this.cache = new ActiveMemoryCache();
9250
9319
  const result = await runActiveMemory({
9251
9320
  userText,
@@ -9560,8 +9629,8 @@ async function localAgentUsePersonality(agent, name, opts) {
9560
9629
  registry,
9561
9630
  store: agent.personalityStore,
9562
9631
  invalidateCache: (reason) => agent.invalidateCache(reason),
9563
- appendSessionMessage: (msg) => chunkDVP3YMDA_cjs.appendSessionMessage(agent.agentId, msg),
9564
- clearSession: () => chunkDVP3YMDA_cjs.clearSession(agent.agentId),
9632
+ appendSessionMessage: (msg) => chunkLXG6VL6R_cjs.appendSessionMessage(agent.agentId, msg),
9633
+ clearSession: () => chunkLXG6VL6R_cjs.clearSession(agent.agentId),
9565
9634
  opts: opts ?? {}
9566
9635
  })
9567
9636
  );
@@ -10089,7 +10158,7 @@ async function executeSendLocked(inputs, message, options) {
10089
10158
  if (inputs.options.onBeforeSend !== void 0) {
10090
10159
  await inputs.options.onBeforeSend({
10091
10160
  conversationId: inputs.agentId,
10092
- previousMessageCount: chunkDVP3YMDA_cjs.getSessionMessages(inputs.agentId).length
10161
+ previousMessageCount: chunkLXG6VL6R_cjs.getSessionMessages(inputs.agentId).length
10093
10162
  });
10094
10163
  }
10095
10164
  await inputs.runPreHook(userText);
@@ -10101,8 +10170,8 @@ async function executeSendLocked(inputs, message, options) {
10101
10170
  userText,
10102
10171
  sendOptions: options
10103
10172
  });
10104
- const priorMessages = [...chunkDVP3YMDA_cjs.getSessionMessages(inputs.agentId)];
10105
- chunkDVP3YMDA_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
10173
+ const priorMessages = [...chunkLXG6VL6R_cjs.getSessionMessages(inputs.agentId)];
10174
+ chunkLXG6VL6R_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
10106
10175
  await persistMemoryFactIfWritePrompt(inputs.workspaceCwd, inputs.options.memory, userText);
10107
10176
  const memoryFacts = await readMemoryForSend(inputs.workspaceCwd, inputs.options.memory, userText);
10108
10177
  const memoryTools = void 0;
@@ -10415,7 +10484,7 @@ var LocalAgent = class {
10415
10484
  );
10416
10485
  await acquireLeaseIfPossible(this.sessionStore, this.agentId);
10417
10486
  try {
10418
- await chunkDVP3YMDA_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
10487
+ await chunkLXG6VL6R_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
10419
10488
  await this.personalityStore.hydrate(this.agentId);
10420
10489
  } catch (err) {
10421
10490
  await releaseLeaseIfPossible(this.sessionStore, this.agentId);
@@ -10759,22 +10828,22 @@ async function maybeInjectHandoffTools(options) {
10759
10828
  };
10760
10829
  }
10761
10830
  function keyWillFlowToProvider(apiKey, provider) {
10762
- if (chunk4UYHP6NF_cjs.isFixtureApiKey(apiKey)) return false;
10763
- if (chunk4UYHP6NF_cjs.getConfiguredBaseUrl() !== void 0) return false;
10831
+ if (chunkSNVYOX46_cjs.isFixtureApiKey(apiKey)) return false;
10832
+ if (chunkSNVYOX46_cjs.getConfiguredBaseUrl() !== void 0) return false;
10764
10833
  if (provider === void 0) return false;
10765
- const profile = chunkLO6LIUZ6_cjs.getProviderProfile(provider);
10834
+ const profile = chunkR5UQL2R5_cjs.getProviderProfile(provider);
10766
10835
  if (profile === void 0) return false;
10767
10836
  return profile.authType !== "none";
10768
10837
  }
10769
10838
  function missingApiKeyMessage() {
10770
- const present = chunk4UYHP6NF_cjs.presentProviderCredentialEnvVars();
10839
+ const present = chunkSNVYOX46_cjs.presentProviderCredentialEnvVars();
10771
10840
  const base = `Missing API key \u2014 set ${chunkRNXXYF22_cjs.API_KEY_ENV_VAR}, or pass \`apiKey\` to Agent.create()`;
10772
10841
  if (present.length === 0) return `${base}.`;
10773
10842
  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]}, ... })\`.`;
10774
10843
  }
10775
10844
  function providerNeedsCallerKey(provider) {
10776
10845
  if (provider === void 0) return true;
10777
- const profile = chunkLO6LIUZ6_cjs.getProviderProfile(provider);
10846
+ const profile = chunkR5UQL2R5_cjs.getProviderProfile(provider);
10778
10847
  if (profile === void 0) return true;
10779
10848
  return profile.authType === "api_key";
10780
10849
  }
@@ -10787,7 +10856,7 @@ async function createLocalAgent(options) {
10787
10856
  }
10788
10857
  } else {
10789
10858
  const willFlowToProvider = keyWillFlowToProvider(apiKey, provider);
10790
- const shape = chunk4UYHP6NF_cjs.validateApiKeyShape(apiKey, {
10859
+ const shape = chunkSNVYOX46_cjs.validateApiKeyShape(apiKey, {
10791
10860
  strict: willFlowToProvider,
10792
10861
  ...willFlowToProvider ? { provider } : {}
10793
10862
  });
@@ -10806,15 +10875,15 @@ async function createCloudAgent(options) {
10806
10875
  code: "missing_api_key"
10807
10876
  });
10808
10877
  }
10809
- const shape = chunk4UYHP6NF_cjs.validateApiKeyShape(apiKey);
10878
+ const shape = chunkSNVYOX46_cjs.validateApiKeyShape(apiKey);
10810
10879
  if (shape.malformed) {
10811
10880
  throw new chunkCEGU5AVD_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
10812
10881
  }
10813
- const baseUrl = chunk4UYHP6NF_cjs.getConfiguredBaseUrl();
10882
+ const baseUrl = chunkSNVYOX46_cjs.getConfiguredBaseUrl();
10814
10883
  if (baseUrl === void 0) {
10815
10884
  return new CloudAgent(options);
10816
10885
  }
10817
- const response = await chunk4UYHP6NF_cjs.httpRequest("/v1/agents", {
10886
+ const response = await chunkSNVYOX46_cjs.httpRequest("/v1/agents", {
10818
10887
  apiKey,
10819
10888
  method: "POST",
10820
10889
  body: {
@@ -10839,7 +10908,7 @@ function resolveAgentPersistenceCwd(options) {
10839
10908
  return process.cwd();
10840
10909
  }
10841
10910
  async function rehydrateExistingAgent(agentId, existing, options) {
10842
- await chunk4UYHP6NF_cjs.discoverProviderPlugins();
10911
+ await chunkSNVYOX46_cjs.discoverProviderPlugins();
10843
10912
  await validateRehydratedAgent(agentId, existing);
10844
10913
  const mergedLocal = options.local !== void 0 && existing.options.local !== void 0 ? { ...existing.options.local, ...options.local } : options.local ?? existing.options.local;
10845
10914
  const mergedMemory = mergeResumedMemory(existing.options.memory, options.memory);
@@ -10999,7 +11068,7 @@ var Agent = class _Agent {
10999
11068
  pluginCount: enabledPluginNames(options.plugins).length
11000
11069
  });
11001
11070
  try {
11002
- await chunk4UYHP6NF_cjs.discoverProviderPlugins();
11071
+ await chunkSNVYOX46_cjs.discoverProviderPlugins();
11003
11072
  const agent = await runCreateUnderSpan(options, span);
11004
11073
  return agent;
11005
11074
  } catch (err) {
@@ -11297,9 +11366,9 @@ var Agent = class _Agent {
11297
11366
  */
11298
11367
  static async compact(agentId, options = {}) {
11299
11368
  const reg = await requireLocalAgent(agentId, "compact");
11300
- const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-B7P6EU3Z.cjs');
11369
+ const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-D2MQDB6G.cjs');
11301
11370
  const { cwd, model, store } = await openLocalStore(reg);
11302
- return chunkDVP3YMDA_cjs.enqueueSessionWrite(
11371
+ return chunkLXG6VL6R_cjs.enqueueSessionWrite(
11303
11372
  cwd,
11304
11373
  agentId,
11305
11374
  () => compactSessionTranscript({
@@ -11327,7 +11396,7 @@ var Agent = class _Agent {
11327
11396
  */
11328
11397
  static async injectSessionTurn(agentId, turn) {
11329
11398
  const reg = await requireLocalAgent(agentId, "injectSessionTurn");
11330
- const { injectSessionTurn } = await import('./inject-session-WOH7TPDX.cjs');
11399
+ const { injectSessionTurn } = await import('./inject-session-3ICZIJ2N.cjs');
11331
11400
  const { cwd, model, store } = await openLocalStore(reg);
11332
11401
  await injectSessionTurn({
11333
11402
  store,
@@ -11498,5 +11567,5 @@ exports.managedSettingsPathFor = managedSettingsPathFor;
11498
11567
  exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
11499
11568
  exports.readManagedSettings = readManagedSettings;
11500
11569
  exports.resolveSessionDir = resolveSessionDir;
11501
- //# sourceMappingURL=chunk-KL7ZUMK3.cjs.map
11502
- //# sourceMappingURL=chunk-KL7ZUMK3.cjs.map
11570
+ //# sourceMappingURL=chunk-2WY2OFSC.cjs.map
11571
+ //# sourceMappingURL=chunk-2WY2OFSC.cjs.map