@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,5 +1,5 @@
1
1
  import { submit, emitRunEvent } from './chunk-HWMGR3HA.js';
2
- import { enqueueSessionWrite, hydrateSession, persistTurnToTranscript, flushSessionWrites, appendSessionMessage, getSessionMessages, discardSession, clearSession } from './chunk-XOYNB3YN.js';
2
+ import { enqueueSessionWrite, hydrateSession, persistTurnToTranscript, flushSessionWrites, appendSessionMessage, getSessionMessages, discardSession, clearSession } from './chunk-3ONIVO2I.js';
3
3
  import { IndexManager } from './chunk-2C24NSNV.js';
4
4
  import { currentPersonalityContext, warnPersonalitySwitchInsideFork } from './chunk-HJ2LV464.js';
5
5
  import { extractCodePlugins, isCodePlugin } from './chunk-2SFBB54R.js';
@@ -7,7 +7,7 @@ import { createOpenAiCompatibleRuntime } from './chunk-H7G65PNI.js';
7
7
  import { persistActiveMemoryTranscript } from './chunk-QK2ERTO3.js';
8
8
  import { resolveMaxFacts, writeSessionSummary, resolveMemoryRoot, MEMORY_KINDS, appendFact, readFacts, legacyMemoryJsonPath, memoryMdPath, appendFactToMarkdown } from './chunk-DF77RBF4.js';
9
9
  import { FsSessionStore } from './chunk-AB4OPJLD.js';
10
- import { discoverProviderPlugins, validateApiKeyShape, getConfiguredBaseUrl, httpRequest, isFixtureApiKey, presentProviderCredentialEnvVars, readTrustArray, buildDefaultSummarizer, shouldUseRealLocalRuntime, parseSseStream, CircuitBreaker, trustFilePath, resolveRunProvider, mergeExplicitApiKey, resolveProviderChain, abortError, tryFirstEvent, relayStream, renderToolResultContentText } from './chunk-2PRGRYEQ.js';
10
+ import { discoverProviderPlugins, validateApiKeyShape, getConfiguredBaseUrl, httpRequest, isFixtureApiKey, presentProviderCredentialEnvVars, readTrustArray, buildDefaultSummarizer, shouldUseRealLocalRuntime, parseSseStream, CircuitBreaker, trustFilePath, resolveRunProvider, mergeExplicitApiKey, resolveProviderChain, abortError, tryFirstEvent, relayStream, renderToolResultContentText } from './chunk-ZOL3L4EH.js';
11
11
  import { resolveChildEnv } from './chunk-HKCKOAIO.js';
12
12
  import { DEFAULT_MAX_BYTES_PER_FILE, runDiscovery, truncateWithMarker } from './chunk-KCM3RMKR.js';
13
13
  import { warnFailureOnce, loadHookConfig, warnOnce } from './chunk-XJ3WU5CZ.js';
@@ -16,7 +16,7 @@ import { toJsonSchema } from './chunk-7I5Z3UBJ.js';
16
16
  import { sanitizeToolInput } from './chunk-FJWQP6EE.js';
17
17
  import { withInheritedSubAgentCredentials, subAgentToolsFromDefinitions } from './chunk-VZGE7NAI.js';
18
18
  import { setAgentFacade } from './chunk-6X6ID4MO.js';
19
- import { escapeBlockBody, buildSkillsBlock, discoverSkills, stripSkillFrontmatter } from './chunk-NHOEXFZT.js';
19
+ import { escapeBlockBody, buildSkillsBlock, discoverSkills, stripSkillFrontmatter } from './chunk-2HXTNVLM.js';
20
20
  import { withToolWhitelist, checkToolWhitelist } from './chunk-SAGRF4IB.js';
21
21
  import { validateArtifactPath, PathTraversalError, safePathJoin } from './chunk-PKRPV3R7.js';
22
22
  import { insideRoot, atOrInsideRoot } from './chunk-UKMBRMGT.js';
@@ -29,18 +29,18 @@ import { loadSubagents, pluginBundleDirs } from './chunk-RN3XDZGS.js';
29
29
  import { reportUndeclaredSources, theokitConfigRoot, undefinedVariablesIn, getTheokitHome, adapterForConfigPath, adaptersForSurface, projectConfigRoots, pluginBundleRoots } from './chunk-YMVTUV5K.js';
30
30
  import { readWorkspaceDir, parseSimpleYaml } from './chunk-Q7UG242V.js';
31
31
  import { resolveEffectiveContextWindow, CONTEXT_WINDOW_FLOOR, CONTEXT_WINDOW_MARGIN } from './chunk-SZQFCHU6.js';
32
- import { isAnthropicFamilyModel } from './chunk-2SFLLOMN.js';
32
+ import { isAnthropicFamilyModel } from './chunk-NVQSBRG6.js';
33
33
  import { parseModelId } from './chunk-R7WIIPUR.js';
34
- import { getProviderProfile } from './chunk-NKQVLWDF.js';
35
- import { getCatalogModelInfo, isPatchedModelKey } from './chunk-5HSMH2ZZ.js';
34
+ import { getProviderProfile } from './chunk-ULEK4OM4.js';
35
+ import { getCatalogModelInfo, isPatchedModelKey } from './chunk-CJN5CEI3.js';
36
36
  import { globalSingleton } from './chunk-AGACYRJ2.js';
37
37
  import { boundFetch } from './chunk-Q7GYMXVC.js';
38
38
  import { AgentRunError, coerceToKnownAgentRunErrorCode, UnknownAgentError, ConfigurationError, AuthenticationError, AgentDisposedError, UnsupportedRunOperationError, NetworkError, TheokitAgentError } from './chunk-TNFOU6SB.js';
39
39
  import { diag, resolveApiKey, API_KEY_ENV_VAR, redactSecrets, diagFailure } from './chunk-3OY6H3I7.js';
40
40
  import { stat, mkdir, readFile, readdir, access, unlink } from 'fs/promises';
41
41
  import { randomUUID, createHash } from 'crypto';
42
- import { join, dirname, isAbsolute, resolve, relative } from 'path';
43
- import { existsSync, readFileSync, realpathSync } from 'fs';
42
+ import { join, dirname, isAbsolute, delimiter, resolve, relative } from 'path';
43
+ import { existsSync, readFileSync, realpathSync, accessSync, constants } from 'fs';
44
44
  import { platform } from 'process';
45
45
  import { spawn } from 'child_process';
46
46
  import { pathToFileURL } from 'url';
@@ -3163,34 +3163,57 @@ async function importEntry(candidate) {
3163
3163
  function isGeneralPlugin(value) {
3164
3164
  return isCodePlugin(value) && value.kind === "general" && typeof value.name === "string";
3165
3165
  }
3166
+ function executableExtensions() {
3167
+ return process.platform === "win32" ? ["", ...(process.env.PATHEXT ?? ".EXE;.CMD").split(";")] : [""];
3168
+ }
3169
+ function isExecutable(file) {
3170
+ try {
3171
+ accessSync(file, constants.X_OK);
3172
+ return true;
3173
+ } catch {
3174
+ return false;
3175
+ }
3176
+ }
3177
+ function binaryOnPath(bin) {
3178
+ if (bin.length === 0 || /[\\/]/.test(bin)) return false;
3179
+ const dirs = (process.env.PATH ?? "").split(delimiter).filter((dir) => dir.length > 0);
3180
+ return dirs.some(
3181
+ (dir) => executableExtensions().some((ext) => isExecutable(join(dir, bin + ext)))
3182
+ );
3183
+ }
3166
3184
  var SkillsManager = class {
3167
- constructor(cwd, _enabled, settingSourcesIncludeProject, skillsDir, inline, compatSources = []) {
3185
+ constructor(cwd, _enabled, settingSourcesIncludeProject, skillsDir, inline, compatSources = [], bundledDirs = []) {
3168
3186
  this.cwd = cwd;
3169
3187
  this.settingSourcesIncludeProject = settingSourcesIncludeProject;
3170
3188
  this.skillsDir = skillsDir;
3171
3189
  this.inline = inline;
3172
3190
  this.compatSources = compatSources;
3191
+ this.bundledDirs = bundledDirs;
3173
3192
  }
3174
3193
  cwd;
3175
3194
  settingSourcesIncludeProject;
3176
3195
  skillsDir;
3177
3196
  inline;
3178
3197
  compatSources;
3198
+ bundledDirs;
3179
3199
  skills = [];
3180
3200
  async initialize() {
3181
3201
  if (!this.settingSourcesIncludeProject) {
3182
- this.skills = this.mergeInline([]);
3202
+ this.skills = this.mergeInline(await this.discoverFrom(this.bundledDirs));
3183
3203
  return;
3184
3204
  }
3185
3205
  await this.refresh();
3186
3206
  }
3187
3207
  async refresh() {
3188
- const roots = this.skillsDir === void 0 ? [
3208
+ const ownRoots = this.skillsDir === void 0 ? [
3189
3209
  ...projectConfigRoots(this.cwd, this.compatSources, "skills").map(
3190
3210
  (root) => join(root, "skills")
3191
3211
  ),
3192
3212
  ...(await pluginBundleDirs(this.cwd, this.compatSources)).map((b) => join(b, "skills"))
3193
3213
  ] : [this.skillsDir];
3214
+ this.skills = this.mergeInline(await this.discoverFrom([...ownRoots, ...this.bundledDirs]));
3215
+ }
3216
+ async discoverFrom(roots) {
3194
3217
  const discovered = [];
3195
3218
  const seen = /* @__PURE__ */ new Set();
3196
3219
  for (const root of roots) {
@@ -3205,7 +3228,7 @@ var SkillsManager = class {
3205
3228
  discovered.push(skill);
3206
3229
  }
3207
3230
  }
3208
- this.skills = this.mergeInline(discovered);
3231
+ return discovered;
3209
3232
  }
3210
3233
  /** M22 — merge inline skills over discovered ones; inline wins on a name conflict. */
3211
3234
  mergeInline(discovered) {
@@ -3333,7 +3356,8 @@ async function resolveSendSkills(inputs, userText, memoryFacts) {
3333
3356
  inputs.settingSourcesIncludeProject,
3334
3357
  settings.skillsDir,
3335
3358
  settings.inline,
3336
- resolveCompatSources(inputs.options, inputs.workspaceCwd)
3359
+ resolveCompatSources(inputs.options, inputs.workspaceCwd),
3360
+ settings.bundledDirs
3337
3361
  );
3338
3362
  await manager.initialize();
3339
3363
  return { manager, autoInject: settings.autoInject ?? true };
@@ -3352,7 +3376,9 @@ async function buildSystemPromptContext(inputs, userText, memoryFacts, manager =
3352
3376
  // because a caller naming one has already made the decision this field keeps away from the
3353
3377
  // model. Widening it to execution would break the case the field is FOR — a side-effecting
3354
3378
  // skill a human may run and the model may not propose.
3355
- skills: skills.filter((skill) => skill.disableModelInvocation !== true).map((skill) => ({ name: skill.name, description: skill.description })),
3379
+ skills: skills.filter((skill) => skill.disableModelInvocation !== true).filter(
3380
+ (skill) => skill.requiresBins === void 0 || skill.requiresBins.every((bin) => binaryOnPath(bin))
3381
+ ).map((skill) => ({ name: skill.name, description: skill.description })),
3356
3382
  userMessage: userText,
3357
3383
  memory: memoryFacts.map((fact) => ({ text: fact.text }))
3358
3384
  };
@@ -4897,7 +4923,8 @@ function buildSkills(args, out) {
4897
4923
  staticSkills?.inline,
4898
4924
  // #524 — the same declaration the per-send manager reads. Omitting it here would make
4899
4925
  // `agent.skills` disagree with the system prompt about which skills exist.
4900
- resolveCompatSources(args.options, args.workspaceCwd)
4926
+ resolveCompatSources(args.options, args.workspaceCwd),
4927
+ staticSkills?.bundledDirs
4901
4928
  );
4902
4929
  const localSkills = out.skillsManager;
4903
4930
  out.skills = {
@@ -5964,6 +5991,42 @@ function stripThinkBlocks(content) {
5964
5991
  return { visible, thinking };
5965
5992
  }
5966
5993
 
5994
+ // src/internal/agent-loop/prune-tool-results.ts
5995
+ function stubFor(olderThanRounds) {
5996
+ return `[tool result pruned: older than ${olderThanRounds} rounds]`;
5997
+ }
5998
+ function carriesToolResult(message) {
5999
+ return message.content.some((part) => part.type === "tool_result");
6000
+ }
6001
+ function stubbed(message, stub) {
6002
+ const content = message.content.map(
6003
+ (part) => part.type === "tool_result" ? { ...part, content: stub } : part
6004
+ );
6005
+ return { ...message, content };
6006
+ }
6007
+ function pruneToolResultsForRequest(messages, options) {
6008
+ if (options === void 0) return messages;
6009
+ const stub = stubFor(options.olderThanRounds);
6010
+ const out = [...messages];
6011
+ let rounds = 0;
6012
+ for (let index = messages.length - 1; index >= 0; index -= 1) {
6013
+ const message = messages[index];
6014
+ if (!carriesToolResult(message)) continue;
6015
+ rounds += 1;
6016
+ if (rounds > options.olderThanRounds) out[index] = stubbed(message, stub);
6017
+ }
6018
+ return out;
6019
+ }
6020
+ function validatePruneToolResults(options) {
6021
+ if (options === void 0) return;
6022
+ const value = options.olderThanRounds;
6023
+ if (typeof value === "number" && Number.isInteger(value) && value >= 1) return;
6024
+ throw new ConfigurationError(
6025
+ `SendOptions.pruneToolResults.olderThanRounds must be an integer of at least 1, got ${String(value)}`,
6026
+ { code: "invalid_prune_tool_results" }
6027
+ );
6028
+ }
6029
+
5967
6030
  // src/internal/agent-loop/loop-llm-stream.ts
5968
6031
  function resolveSystemPromptWithMemoryAdditions(systemPrompt, additions) {
5969
6032
  if (additions === void 0 || additions.length === 0) return systemPrompt;
@@ -6052,7 +6115,8 @@ async function streamLlmTurn(inputs, ctx) {
6052
6115
  const key = derivePromptCacheKey(inputs.agentId);
6053
6116
  return key !== void 0 ? { promptCacheKey: key } : {};
6054
6117
  })(),
6055
- messages: ctx.messages,
6118
+ // B-564: the request gets a pruned copy; ctx.messages stays whole (the transcript is resent from it).
6119
+ messages: pruneToolResultsForRequest(ctx.messages, inputs.pruneToolResults),
6056
6120
  tools: ctx.tools.map(toLlmTool)
6057
6121
  },
6058
6122
  signal
@@ -7795,6 +7859,13 @@ function createRealLocalRun(options) {
7795
7859
  registerRun(handle);
7796
7860
  return handle;
7797
7861
  }
7862
+ function toolResultPolicyInputs(sendOptions) {
7863
+ return {
7864
+ ...sendOptions.perToolTimeoutMs !== void 0 ? { perToolTimeoutMs: sendOptions.perToolTimeoutMs } : {},
7865
+ ...sendOptions.toolResultGuard !== void 0 ? { toolResultGuard: sendOptions.toolResultGuard } : {},
7866
+ ...sendOptions.pruneToolResults !== void 0 ? { pruneToolResults: sendOptions.pruneToolResults } : {}
7867
+ };
7868
+ }
7798
7869
  function buildLoopInputs(options, runId, userText, userImages) {
7799
7870
  const maxIterations = options.sendOptions.maxIterations;
7800
7871
  if (maxIterations !== void 0 && (!Number.isInteger(maxIterations) || maxIterations < 1)) {
@@ -7803,6 +7874,7 @@ function buildLoopInputs(options, runId, userText, userImages) {
7803
7874
  { code: "invalid_max_iterations" }
7804
7875
  );
7805
7876
  }
7877
+ validatePruneToolResults(options.sendOptions.pruneToolResults);
7806
7878
  const { primary, effectiveModelId } = resolveRunProvider(options);
7807
7879
  const fallback = options.agentOptions.providers?.fallback;
7808
7880
  const apiKeys = mergeExplicitApiKey(
@@ -7872,10 +7944,7 @@ function buildLoopInputs(options, runId, userText, userImages) {
7872
7944
  ...options.sendOptions.context !== void 0 ? { context: options.sendOptions.context } : {},
7873
7945
  // SE2 — forward the opt-in typed runtime-event sink to the loop.
7874
7946
  ...options.sendOptions.onRunEvent !== void 0 ? { runEventSink: options.sendOptions.onRunEvent } : {},
7875
- // #58 / #57 — forward the per-tool timeout + tool-result guard so a consumer
7876
- // can enable them via SendOptions (not only internal AgentLoopInputs).
7877
- ...options.sendOptions.perToolTimeoutMs !== void 0 ? { perToolTimeoutMs: options.sendOptions.perToolTimeoutMs } : {},
7878
- ...options.sendOptions.toolResultGuard !== void 0 ? { toolResultGuard: options.sendOptions.toolResultGuard } : {},
7947
+ ...toolResultPolicyInputs(options.sendOptions),
7879
7948
  // M1-2: per-send iteration ceiling (validated above). The loop reads
7880
7949
  // inputs.maxIterations (default 8 when unset).
7881
7950
  ...maxIterations !== void 0 ? { maxIterations } : {},
@@ -11294,7 +11363,7 @@ var Agent = class _Agent {
11294
11363
  */
11295
11364
  static async compact(agentId, options = {}) {
11296
11365
  const reg = await requireLocalAgent(agentId, "compact");
11297
- const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-5HMX6KYT.js');
11366
+ const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-N2PPHQO6.js');
11298
11367
  const { cwd, model, store } = await openLocalStore(reg);
11299
11368
  return enqueueSessionWrite(
11300
11369
  cwd,
@@ -11324,7 +11393,7 @@ var Agent = class _Agent {
11324
11393
  */
11325
11394
  static async injectSessionTurn(agentId, turn) {
11326
11395
  const reg = await requireLocalAgent(agentId, "injectSessionTurn");
11327
- const { injectSessionTurn } = await import('./inject-session-75L3NCNL.js');
11396
+ const { injectSessionTurn } = await import('./inject-session-J26SHHIO.js');
11328
11397
  const { cwd, model, store } = await openLocalStore(reg);
11329
11398
  await injectSessionTurn({
11330
11399
  store,
@@ -11482,5 +11551,5 @@ async function openLocalStore(reg) {
11482
11551
  }
11483
11552
 
11484
11553
  export { Agent, AgentBuilder, DEFAULT_AGENTIC_MODEL_ID, MEMORY_EMBEDDING_ADAPTERS, Tool, ToolError, UsageAccumulator, computeCost, generateCronId, getPricingEntry, managedSettingsPathFor, openRouterMemoryEmbeddingProviderAdapter, readManagedSettings, resolveSessionDir };
11485
- //# sourceMappingURL=chunk-JX4LB6XO.js.map
11486
- //# sourceMappingURL=chunk-JX4LB6XO.js.map
11554
+ //# sourceMappingURL=chunk-GARVAUCU.js.map
11555
+ //# sourceMappingURL=chunk-GARVAUCU.js.map