@dexto/core 1.12.1 → 1.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/dist/agent/DextoAgent.cjs +7 -0
  2. package/dist/agent/DextoAgent.d.ts +2 -5
  3. package/dist/agent/DextoAgent.d.ts.map +1 -1
  4. package/dist/agent/DextoAgent.js +7 -0
  5. package/dist/approval/index.cjs +4 -2
  6. package/dist/approval/index.d.ts +1 -1
  7. package/dist/approval/index.d.ts.map +1 -1
  8. package/dist/approval/index.js +3 -2
  9. package/dist/approval/manager.cjs +23 -4
  10. package/dist/approval/manager.d.ts +3 -2
  11. package/dist/approval/manager.d.ts.map +1 -1
  12. package/dist/approval/manager.js +21 -3
  13. package/dist/approval/schemas.cjs +5 -0
  14. package/dist/approval/schemas.d.ts +8 -0
  15. package/dist/approval/schemas.d.ts.map +1 -1
  16. package/dist/approval/schemas.js +5 -0
  17. package/dist/approval/types.d.ts +2 -2
  18. package/dist/approval/types.d.ts.map +1 -1
  19. package/dist/context/manager.cjs +34 -31
  20. package/dist/context/manager.d.ts +5 -6
  21. package/dist/context/manager.d.ts.map +1 -1
  22. package/dist/context/manager.js +36 -32
  23. package/dist/context/utils.cjs +6 -17
  24. package/dist/context/utils.d.ts +2 -0
  25. package/dist/context/utils.d.ts.map +1 -1
  26. package/dist/context/utils.js +5 -17
  27. package/dist/events/index.cjs +8 -0
  28. package/dist/events/index.d.ts +18 -5
  29. package/dist/events/index.d.ts.map +1 -1
  30. package/dist/events/index.js +8 -0
  31. package/dist/llm/executor/repeated-pruned-tool-calls.cjs +69 -0
  32. package/dist/llm/executor/repeated-pruned-tool-calls.d.ts +17 -0
  33. package/dist/llm/executor/repeated-pruned-tool-calls.d.ts.map +1 -0
  34. package/dist/llm/executor/repeated-pruned-tool-calls.js +46 -0
  35. package/dist/llm/executor/tool-output-spill.cjs +92 -0
  36. package/dist/llm/executor/tool-output-spill.d.ts +24 -0
  37. package/dist/llm/executor/tool-output-spill.d.ts.map +1 -0
  38. package/dist/llm/executor/tool-output-spill.js +65 -0
  39. package/dist/llm/executor/turn-executor.cjs +116 -35
  40. package/dist/llm/executor/turn-executor.d.ts +21 -5
  41. package/dist/llm/executor/turn-executor.d.ts.map +1 -1
  42. package/dist/llm/executor/turn-executor.js +122 -35
  43. package/dist/llm/services/factory.cjs +2 -1
  44. package/dist/llm/services/factory.d.ts +2 -1
  45. package/dist/llm/services/factory.d.ts.map +1 -1
  46. package/dist/llm/services/factory.js +2 -1
  47. package/dist/llm/services/vercel.cjs +2 -1
  48. package/dist/llm/services/vercel.d.ts +2 -1
  49. package/dist/llm/services/vercel.d.ts.map +1 -1
  50. package/dist/llm/services/vercel.js +2 -1
  51. package/dist/mcp/errors.cjs +9 -0
  52. package/dist/mcp/errors.d.ts +4 -0
  53. package/dist/mcp/errors.d.ts.map +1 -1
  54. package/dist/mcp/errors.js +9 -0
  55. package/dist/mcp/manager.cjs +79 -3
  56. package/dist/mcp/manager.d.ts +14 -7
  57. package/dist/mcp/manager.d.ts.map +1 -1
  58. package/dist/mcp/manager.js +79 -3
  59. package/dist/mcp/mcp-client.cjs +52 -62
  60. package/dist/mcp/mcp-client.d.ts.map +1 -1
  61. package/dist/mcp/mcp-client.js +54 -63
  62. package/dist/session/chat-session.cjs +1 -0
  63. package/dist/session/chat-session.d.ts +2 -0
  64. package/dist/session/chat-session.d.ts.map +1 -1
  65. package/dist/session/chat-session.js +1 -0
  66. package/dist/session/session-manager.cjs +16 -2
  67. package/dist/session/session-manager.d.ts +2 -0
  68. package/dist/session/session-manager.d.ts.map +1 -1
  69. package/dist/session/session-manager.js +16 -2
  70. package/dist/storage/index.cjs +2 -0
  71. package/dist/storage/index.d.ts +2 -1
  72. package/dist/storage/index.d.ts.map +1 -1
  73. package/dist/storage/index.js +2 -0
  74. package/dist/storage/stores/backend.cjs +26 -0
  75. package/dist/storage/stores/backend.d.ts +20 -0
  76. package/dist/storage/stores/backend.d.ts.map +1 -1
  77. package/dist/storage/stores/backend.js +25 -0
  78. package/dist/storage/stores/in-memory.cjs +20 -3
  79. package/dist/storage/stores/in-memory.d.ts +16 -0
  80. package/dist/storage/stores/in-memory.d.ts.map +1 -1
  81. package/dist/storage/stores/in-memory.js +18 -2
  82. package/dist/storage/stores/types.d.ts +3 -0
  83. package/dist/storage/stores/types.d.ts.map +1 -1
  84. package/dist/storage/tool-executions/types.cjs +12 -8
  85. package/dist/storage/tool-executions/types.d.ts +11 -2
  86. package/dist/storage/tool-executions/types.d.ts.map +1 -1
  87. package/dist/storage/tool-executions/types.js +12 -8
  88. package/dist/storage/tool-outputs/types.cjs +16 -0
  89. package/dist/storage/tool-outputs/types.d.ts +19 -0
  90. package/dist/storage/tool-outputs/types.d.ts.map +1 -0
  91. package/dist/storage/tool-outputs/types.js +0 -0
  92. package/dist/telemetry/decorators.cjs +47 -23
  93. package/dist/telemetry/decorators.d.ts +6 -0
  94. package/dist/telemetry/decorators.d.ts.map +1 -1
  95. package/dist/telemetry/decorators.js +47 -23
  96. package/dist/telemetry/operation-span.cjs +5 -2
  97. package/dist/telemetry/operation-span.d.ts +3 -0
  98. package/dist/telemetry/operation-span.d.ts.map +1 -1
  99. package/dist/telemetry/operation-span.js +5 -2
  100. package/dist/tools/activity.cjs +8 -0
  101. package/dist/tools/activity.d.ts +1 -0
  102. package/dist/tools/activity.d.ts.map +1 -1
  103. package/dist/tools/activity.js +8 -0
  104. package/dist/tools/approval/tool-approval-policy.cjs +11 -1
  105. package/dist/tools/approval/tool-approval-policy.d.ts +2 -2
  106. package/dist/tools/approval/tool-approval-policy.d.ts.map +1 -1
  107. package/dist/tools/approval/tool-approval-policy.js +11 -1
  108. package/dist/tools/identity.cjs +36 -0
  109. package/dist/tools/identity.d.ts +6 -0
  110. package/dist/tools/identity.d.ts.map +1 -0
  111. package/dist/tools/identity.js +13 -0
  112. package/dist/tools/index.cjs +2 -0
  113. package/dist/tools/index.d.ts +2 -1
  114. package/dist/tools/index.d.ts.map +1 -1
  115. package/dist/tools/index.js +4 -1
  116. package/dist/tools/presentation/tool-presentation.d.ts +5 -0
  117. package/dist/tools/presentation/tool-presentation.d.ts.map +1 -1
  118. package/dist/tools/schema-fingerprint.cjs +48 -0
  119. package/dist/tools/schema-fingerprint.d.ts +4 -0
  120. package/dist/tools/schema-fingerprint.d.ts.map +1 -0
  121. package/dist/tools/schema-fingerprint.js +25 -0
  122. package/dist/tools/schemas.cjs +3 -0
  123. package/dist/tools/schemas.d.ts +1 -0
  124. package/dist/tools/schemas.d.ts.map +1 -1
  125. package/dist/tools/schemas.js +2 -0
  126. package/dist/tools/tool-manager.cjs +199 -48
  127. package/dist/tools/tool-manager.d.ts +25 -11
  128. package/dist/tools/tool-manager.d.ts.map +1 -1
  129. package/dist/tools/tool-manager.js +199 -48
  130. package/dist/tools/tool-output-read.cjs +129 -0
  131. package/dist/tools/tool-output-read.d.ts +19 -0
  132. package/dist/tools/tool-output-read.d.ts.map +1 -0
  133. package/dist/tools/tool-output-read.js +106 -0
  134. package/dist/tools/types.d.ts +55 -0
  135. package/dist/tools/types.d.ts.map +1 -1
  136. package/dist/utils/schema.cjs +2 -2
  137. package/dist/utils/schema.d.ts +1 -1
  138. package/dist/utils/schema.d.ts.map +1 -1
  139. package/dist/utils/schema.js +2 -2
  140. package/dist/utils/service-initializer.cjs +4 -0
  141. package/dist/utils/service-initializer.d.ts +2 -0
  142. package/dist/utils/service-initializer.d.ts.map +1 -1
  143. package/dist/utils/service-initializer.js +4 -0
  144. package/dist/utils/stable-fingerprint.cjs +32 -0
  145. package/dist/utils/stable-fingerprint.d.ts +3 -0
  146. package/dist/utils/stable-fingerprint.d.ts.map +1 -0
  147. package/dist/utils/stable-fingerprint.js +9 -0
  148. package/package.json +9 -2
  149. package/dist/llm/executor/tool-output-truncator.cjs +0 -75
  150. package/dist/llm/executor/tool-output-truncator.d.ts +0 -27
  151. package/dist/llm/executor/tool-output-truncator.d.ts.map +0 -1
  152. package/dist/llm/executor/tool-output-truncator.js +0 -48
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var tool_output_spill_exports = {};
20
+ __export(tool_output_spill_exports, {
21
+ TOOL_OUTPUT_READ_TOOL_NAME: () => TOOL_OUTPUT_READ_TOOL_NAME,
22
+ planToolOutputSpills: () => planToolOutputSpills,
23
+ toolOutputBudget: () => toolOutputBudget,
24
+ toolResultText: () => toolResultText,
25
+ withToolOutputPreview: () => withToolOutputPreview
26
+ });
27
+ module.exports = __toCommonJS(tool_output_spill_exports);
28
+ const TOOL_OUTPUT_READ_TOOL_NAME = "tool_output_read";
29
+ const CHARS_PER_TOKEN = 4;
30
+ const MAX_INLINE_TOKENS = 25e3;
31
+ const INLINE_WINDOW_RATIO = 0.1;
32
+ const STEP_WINDOW_RATIO = 0.4;
33
+ const STEP_SPILL_PREVIEW_CHARS = 16e3;
34
+ const PREVIEW_HEAD_RATIO = 0.75;
35
+ function toolOutputBudget(maxInputTokens) {
36
+ return {
37
+ inlineCapChars: Math.min(MAX_INLINE_TOKENS, Math.floor(maxInputTokens * INLINE_WINDOW_RATIO)) * CHARS_PER_TOKEN,
38
+ stepBudgetChars: Math.floor(maxInputTokens * STEP_WINDOW_RATIO) * CHARS_PER_TOKEN
39
+ };
40
+ }
41
+ function toolResultText(result) {
42
+ return result.content.flatMap((part) => part.type === "text" ? [part.text] : []).join("\n");
43
+ }
44
+ function planToolOutputSpills(results, budget) {
45
+ const previewChars = /* @__PURE__ */ new Map();
46
+ let inlineChars = 0;
47
+ for (const result of results) {
48
+ if (result.textLength > budget.inlineCapChars) {
49
+ previewChars.set(result.toolCallId, budget.inlineCapChars);
50
+ inlineChars += budget.inlineCapChars;
51
+ } else {
52
+ inlineChars += result.textLength;
53
+ }
54
+ }
55
+ const stepPreviewChars = Math.min(budget.inlineCapChars, STEP_SPILL_PREVIEW_CHARS);
56
+ const largestFirst = results.filter((result) => !previewChars.has(result.toolCallId)).filter((result) => result.textLength > stepPreviewChars).sort((left, right) => right.textLength - left.textLength);
57
+ for (const result of largestFirst) {
58
+ if (inlineChars <= budget.stepBudgetChars) break;
59
+ previewChars.set(result.toolCallId, stepPreviewChars);
60
+ inlineChars -= result.textLength - stepPreviewChars;
61
+ }
62
+ return previewChars;
63
+ }
64
+ function withToolOutputPreview(result, fullText, previewChars) {
65
+ const headChars = Math.floor(previewChars * PREVIEW_HEAD_RATIO);
66
+ const tailChars = previewChars - headChars;
67
+ const id = result.meta.toolCallId;
68
+ const preview = `${fullText.slice(0, headChars)}
69
+
70
+ [Output truncated: showing the first ${headChars} and last ${tailChars} of ${fullText.length} characters. The full output is stored. Read any part with ${TOOL_OUTPUT_READ_TOOL_NAME}({ "id": "${id}", "offset": <line> }) or search it with ${TOOL_OUTPUT_READ_TOOL_NAME}({ "id": "${id}", "pattern": "<text>" }) instead of re-running the tool.]
71
+
72
+ ` + fullText.slice(fullText.length - tailChars);
73
+ const content = [];
74
+ let previewAdded = false;
75
+ for (const part of result.content) {
76
+ if (part.type !== "text") {
77
+ content.push(part);
78
+ } else if (!previewAdded) {
79
+ content.push({ type: "text", text: preview });
80
+ previewAdded = true;
81
+ }
82
+ }
83
+ return { ...result, content };
84
+ }
85
+ // Annotate the CommonJS export names for ESM import in node:
86
+ 0 && (module.exports = {
87
+ TOOL_OUTPUT_READ_TOOL_NAME,
88
+ planToolOutputSpills,
89
+ toolOutputBudget,
90
+ toolResultText,
91
+ withToolOutputPreview
92
+ });
@@ -0,0 +1,24 @@
1
+ import type { SanitizedToolResult } from '../../context/types.js';
2
+ /** The core tool that pages through stored tool output. */
3
+ export declare const TOOL_OUTPUT_READ_TOOL_NAME = "tool_output_read";
4
+ export interface ToolOutputBudget {
5
+ inlineCapChars: number;
6
+ stepBudgetChars: number;
7
+ }
8
+ export declare function toolOutputBudget(maxInputTokens: number): ToolOutputBudget;
9
+ export declare function toolResultText(result: SanitizedToolResult): string;
10
+ /**
11
+ * Decides which of one step's results to store outside history, and how much of each to keep
12
+ * inline. Every result over the inline cap is stored; if the rest still exceed the step budget,
13
+ * the largest are stored next (earlier calls first on ties) so the decision is deterministic.
14
+ */
15
+ export declare function planToolOutputSpills(results: ReadonlyArray<{
16
+ toolCallId: string;
17
+ textLength: number;
18
+ }>, budget: ToolOutputBudget): Map<string, number>;
19
+ /**
20
+ * Replaces a result's text parts with one head and tail preview of the full text, followed by a
21
+ * marker telling the model how to read the rest. Non-text parts are kept.
22
+ */
23
+ export declare function withToolOutputPreview(result: SanitizedToolResult, fullText: string, previewChars: number): SanitizedToolResult;
24
+ //# sourceMappingURL=tool-output-spill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-output-spill.d.ts","sourceRoot":"","sources":["../../../src/llm/executor/tool-output-spill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,2DAA2D;AAC3D,eAAO,MAAM,0BAA0B,qBAAqB,CAAC;AAY7D,MAAM,WAAW,gBAAgB;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,MAAM,GAAG,gBAAgB,CAOzE;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAElE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAChC,OAAO,EAAE,aAAa,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,EAClE,MAAM,EAAE,gBAAgB,GACzB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAsBrB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACjC,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GACrB,mBAAmB,CAqBrB"}
@@ -0,0 +1,65 @@
1
+ import "../../chunk-C6A6W6XS.js";
2
+ const TOOL_OUTPUT_READ_TOOL_NAME = "tool_output_read";
3
+ const CHARS_PER_TOKEN = 4;
4
+ const MAX_INLINE_TOKENS = 25e3;
5
+ const INLINE_WINDOW_RATIO = 0.1;
6
+ const STEP_WINDOW_RATIO = 0.4;
7
+ const STEP_SPILL_PREVIEW_CHARS = 16e3;
8
+ const PREVIEW_HEAD_RATIO = 0.75;
9
+ function toolOutputBudget(maxInputTokens) {
10
+ return {
11
+ inlineCapChars: Math.min(MAX_INLINE_TOKENS, Math.floor(maxInputTokens * INLINE_WINDOW_RATIO)) * CHARS_PER_TOKEN,
12
+ stepBudgetChars: Math.floor(maxInputTokens * STEP_WINDOW_RATIO) * CHARS_PER_TOKEN
13
+ };
14
+ }
15
+ function toolResultText(result) {
16
+ return result.content.flatMap((part) => part.type === "text" ? [part.text] : []).join("\n");
17
+ }
18
+ function planToolOutputSpills(results, budget) {
19
+ const previewChars = /* @__PURE__ */ new Map();
20
+ let inlineChars = 0;
21
+ for (const result of results) {
22
+ if (result.textLength > budget.inlineCapChars) {
23
+ previewChars.set(result.toolCallId, budget.inlineCapChars);
24
+ inlineChars += budget.inlineCapChars;
25
+ } else {
26
+ inlineChars += result.textLength;
27
+ }
28
+ }
29
+ const stepPreviewChars = Math.min(budget.inlineCapChars, STEP_SPILL_PREVIEW_CHARS);
30
+ const largestFirst = results.filter((result) => !previewChars.has(result.toolCallId)).filter((result) => result.textLength > stepPreviewChars).sort((left, right) => right.textLength - left.textLength);
31
+ for (const result of largestFirst) {
32
+ if (inlineChars <= budget.stepBudgetChars) break;
33
+ previewChars.set(result.toolCallId, stepPreviewChars);
34
+ inlineChars -= result.textLength - stepPreviewChars;
35
+ }
36
+ return previewChars;
37
+ }
38
+ function withToolOutputPreview(result, fullText, previewChars) {
39
+ const headChars = Math.floor(previewChars * PREVIEW_HEAD_RATIO);
40
+ const tailChars = previewChars - headChars;
41
+ const id = result.meta.toolCallId;
42
+ const preview = `${fullText.slice(0, headChars)}
43
+
44
+ [Output truncated: showing the first ${headChars} and last ${tailChars} of ${fullText.length} characters. The full output is stored. Read any part with ${TOOL_OUTPUT_READ_TOOL_NAME}({ "id": "${id}", "offset": <line> }) or search it with ${TOOL_OUTPUT_READ_TOOL_NAME}({ "id": "${id}", "pattern": "<text>" }) instead of re-running the tool.]
45
+
46
+ ` + fullText.slice(fullText.length - tailChars);
47
+ const content = [];
48
+ let previewAdded = false;
49
+ for (const part of result.content) {
50
+ if (part.type !== "text") {
51
+ content.push(part);
52
+ } else if (!previewAdded) {
53
+ content.push({ type: "text", text: preview });
54
+ previewAdded = true;
55
+ }
56
+ }
57
+ return { ...result, content };
58
+ }
59
+ export {
60
+ TOOL_OUTPUT_READ_TOOL_NAME,
61
+ planToolOutputSpills,
62
+ toolOutputBudget,
63
+ toolResultText,
64
+ withToolOutputPreview
65
+ };
@@ -39,7 +39,8 @@ var import_zod = require("zod");
39
39
  var import_api = require("@opentelemetry/api");
40
40
  var import_utils = require("../../context/utils.js");
41
41
  var import_stream_processor = require("./stream-processor.js");
42
- var import_tool_output_truncator = require("./tool-output-truncator.js");
42
+ var import_tool_output_spill = require("./tool-output-spill.js");
43
+ var import_repeated_pruned_tool_calls = require("./repeated-pruned-tool-calls.js");
43
44
  var import_provider_options = require("./provider-options.js");
44
45
  var import_types = require("../../logger/v2/types.js");
45
46
  var import_operation_span = require("../../telemetry/operation-span.js");
@@ -48,7 +49,7 @@ var import_error_conversion = require("../../utils/error-conversion.js");
48
49
  var import_codex_base_url = require("../providers/codex-base-url.js");
49
50
  var import_tool_definitions = require("./tool-definitions.js");
50
51
  var import_model_request_diagnostics = require("./model-request-diagnostics.js");
51
- var import_types3 = require("../../approval/types.js");
52
+ var import_manager2 = require("../../approval/manager.js");
52
53
  var import_content_audit = require("../../context/content-audit.js");
53
54
  var import_content_clone = require("../../context/content-clone.js");
54
55
  const MCP_TOOL_PREFIX = "mcp--";
@@ -101,15 +102,26 @@ const ProviderOptionsStateSchema = import_zod.z.record(
101
102
  const JsonSchemaStateSchema = import_zod.z.custom(
102
103
  (value) => typeof value === "object" && value !== null && !Array.isArray(value)
103
104
  );
105
+ const ToolAnnotationsStateSchema = import_zod.z.object({
106
+ title: import_zod.z.string().optional(),
107
+ readOnlyHint: import_zod.z.boolean().optional(),
108
+ destructiveHint: import_zod.z.boolean().optional(),
109
+ idempotentHint: import_zod.z.boolean().optional(),
110
+ openWorldHint: import_zod.z.boolean().optional()
111
+ }).catchall(JsonValueSchema);
104
112
  const ToolSetEntryStateSchema = import_zod.z.object({
105
113
  name: import_zod.z.string().optional(),
106
114
  description: import_zod.z.string().optional(),
107
115
  parameters: JsonSchemaStateSchema,
116
+ outputSchema: JsonSchemaStateSchema.optional(),
117
+ annotations: ToolAnnotationsStateSchema.optional(),
108
118
  _meta: import_zod.z.record(import_zod.z.string(), JsonValueSchema).optional()
109
119
  }).strict().transform((parsed) => {
110
120
  const tool = { parameters: parsed.parameters };
111
121
  if (parsed.name !== void 0) tool.name = parsed.name;
112
122
  if (parsed.description !== void 0) tool.description = parsed.description;
123
+ if (parsed.outputSchema !== void 0) tool.outputSchema = parsed.outputSchema;
124
+ if (parsed.annotations !== void 0) tool.annotations = parsed.annotations;
113
125
  if (parsed._meta !== void 0) tool._meta = parsed._meta;
114
126
  return tool;
115
127
  });
@@ -957,7 +969,10 @@ class TurnExecutor {
957
969
  await this.injectQueuedMessages(coalesced);
958
970
  }
959
971
  }
960
- await this.pruneOldToolOutputs();
972
+ const modelHistory = await this.contextManager.getModelHistory();
973
+ this.reportRepeatedPrunedToolCalls(modelHistory);
974
+ const { preparedHistory: visibleHistory } = await this.contextManager.prepareModelHistory();
975
+ await this.pruneOldToolOutputs(visibleHistory);
961
976
  let systemPrompt = await (0, import_operation_span.recordOperationSpan)(
962
977
  {
963
978
  name: "system_prompt.build",
@@ -1364,10 +1379,21 @@ class TurnExecutor {
1364
1379
  )
1365
1380
  )
1366
1381
  );
1382
+ const sanitizedResults = await Promise.all(
1383
+ toolCalls.map((toolCall, index) => {
1384
+ const executionResult = executionResults[index];
1385
+ if (executionResult === void 0) {
1386
+ throw new Error("Tool call result count must match emitted tool call count");
1387
+ }
1388
+ return this.sanitizeModelToolResult(toolCall, executionResult);
1389
+ })
1390
+ );
1391
+ const modelResults = await this.storeOversizedToolOutputs(toolCalls, sanitizedResults);
1367
1392
  for (let index = 0; index < toolCalls.length; index += 1) {
1368
1393
  const toolCall = toolCalls[index];
1369
1394
  const executionResult = executionResults[index];
1370
- if (toolCall === void 0 || executionResult === void 0) {
1395
+ const modelResult = modelResults[index];
1396
+ if (toolCall === void 0 || executionResult === void 0 || modelResult === void 0) {
1371
1397
  throw new Error("Tool call result count must match emitted tool call count");
1372
1398
  }
1373
1399
  await (0, import_operation_span.recordOperationSpan)(
@@ -1380,7 +1406,7 @@ class TurnExecutor {
1380
1406
  "tool.success": this.isToolExecutionSuccessful(executionResult)
1381
1407
  }
1382
1408
  },
1383
- () => this.persistModelToolResult(toolCall, executionResult),
1409
+ () => this.persistModelToolResult(toolCall, executionResult, modelResult),
1384
1410
  this.logger
1385
1411
  );
1386
1412
  }
@@ -1449,7 +1475,7 @@ class TurnExecutor {
1449
1475
  if (approval.kind === "terminal") {
1450
1476
  return approval.modelVisibleResult;
1451
1477
  }
1452
- const decision = this.toApprovalDecisionInput(approval.response);
1478
+ const decision = (0, import_manager2.approvalResponseToDecisionInput)(approval.response);
1453
1479
  const applied = await this.toolManager.applyApprovalDecision(recorded, decision);
1454
1480
  if (applied.kind === "terminal") {
1455
1481
  return applied.modelVisibleResult;
@@ -1564,9 +1590,9 @@ class TurnExecutor {
1564
1590
  }
1565
1591
  return preparedCall.prepared.modelVisibleResult.presentationSnapshot ?? this.buildToolCallFallbackSnapshot(preparedCall.toolCall.toolName);
1566
1592
  }
1567
- async persistModelToolResult(toolCall, executionResult) {
1593
+ async sanitizeModelToolResult(toolCall, executionResult) {
1568
1594
  const success = this.isToolExecutionSuccessful(executionResult);
1569
- const sanitized = await (0, import_utils.sanitizeToolResult)(
1595
+ return await (0, import_utils.sanitizeToolResult)(
1570
1596
  executionResult.result,
1571
1597
  {
1572
1598
  artifactStore: this.resourceManager.getArtifactStore(),
@@ -1578,7 +1604,47 @@ class TurnExecutor {
1578
1604
  },
1579
1605
  this.logger
1580
1606
  );
1581
- const truncated = (0, import_tool_output_truncator.truncateToolResult)(sanitized);
1607
+ }
1608
+ /**
1609
+ * Keeps oversized tool output out of model history: the full text goes to the session's tool
1610
+ * output store and history keeps a head and tail preview that names `tool_output_read`. If
1611
+ * storing fails, the full text stays inline so nothing is lost.
1612
+ */
1613
+ async storeOversizedToolOutputs(toolCalls, results) {
1614
+ const texts = results.map(import_tool_output_spill.toolResultText);
1615
+ const previewChars = (0, import_tool_output_spill.planToolOutputSpills)(
1616
+ results.flatMap(
1617
+ (result, index) => (
1618
+ // A read of stored output is already bounded; storing it again could loop.
1619
+ toolCalls[index]?.toolName === import_tool_output_spill.TOOL_OUTPUT_READ_TOOL_NAME ? [] : [
1620
+ {
1621
+ toolCallId: result.meta.toolCallId,
1622
+ textLength: texts[index]?.length ?? 0
1623
+ }
1624
+ ]
1625
+ )
1626
+ ),
1627
+ (0, import_tool_output_spill.toolOutputBudget)(this.contextManager.getMaxInputTokens())
1628
+ );
1629
+ return await Promise.all(
1630
+ results.map(async (result, index) => {
1631
+ const chars = previewChars.get(result.meta.toolCallId);
1632
+ const text = texts[index];
1633
+ if (chars === void 0 || text === void 0) return result;
1634
+ try {
1635
+ await this.contextManager.saveToolOutput(result.meta.toolCallId, text);
1636
+ } catch (error) {
1637
+ this.logger.warn(
1638
+ `Failed to store tool output for ${result.meta.toolCallId}; keeping it inline: ${error instanceof Error ? error.message : String(error)}`
1639
+ );
1640
+ return result;
1641
+ }
1642
+ return (0, import_tool_output_spill.withToolOutputPreview)(result, text, chars);
1643
+ })
1644
+ );
1645
+ }
1646
+ async persistModelToolResult(toolCall, executionResult, truncated) {
1647
+ const success = this.isToolExecutionSuccessful(executionResult);
1582
1648
  const metadata = this.getToolExecutionMetadata(executionResult);
1583
1649
  const errorMessage = this.getToolExecutionErrorMessage(executionResult.result);
1584
1650
  await this.contextManager.addToolResult(
@@ -1639,24 +1705,6 @@ class TurnExecutor {
1639
1705
  toolCallId
1640
1706
  };
1641
1707
  }
1642
- toApprovalDecisionInput(response) {
1643
- if (response.status === import_types3.ApprovalStatus.APPROVED) {
1644
- return {
1645
- approvalId: response.approvalId,
1646
- status: import_types3.ApprovalStatus.APPROVED,
1647
- ...response.data !== void 0 ? { data: response.data } : {}
1648
- };
1649
- }
1650
- const status = response.status === import_types3.ApprovalStatus.DENIED ? import_types3.ApprovalStatus.DENIED : import_types3.ApprovalStatus.CANCELLED;
1651
- return {
1652
- approvalId: response.approvalId,
1653
- status,
1654
- ...response.reason !== void 0 ? { reason: response.reason } : {},
1655
- ...response.message !== void 0 ? { message: response.message } : {},
1656
- ...response.timeoutMs !== void 0 ? { timeoutMs: response.timeoutMs } : {},
1657
- ...response.data !== void 0 ? { data: response.data } : {}
1658
- };
1659
- }
1660
1708
  getToolExecutionMetadata(executionResult) {
1661
1709
  const metadata = {};
1662
1710
  if (executionResult.presentationSnapshot !== void 0) {
@@ -1698,12 +1746,42 @@ class TurnExecutor {
1698
1746
  };
1699
1747
  }
1700
1748
  /**
1701
- * Constants for pruning thresholds
1749
+ * Constants for pruning thresholds. The protected budget scales with the model's input
1750
+ * window so large-window models keep more recent tool output visible.
1702
1751
  */
1703
- static PRUNE_PROTECT = 4e4;
1704
- // Keep last 40K tokens of tool outputs
1752
+ static PRUNE_PROTECT_MIN = 4e4;
1753
+ // Always keep at least 40K tokens of tool outputs
1754
+ static PRUNE_PROTECT_WINDOW_RATIO = 0.3;
1755
+ // Or 30% of the input window, if larger
1705
1756
  static PRUNE_MINIMUM = 2e4;
1706
1757
  // Only prune if we can save 20K+
1758
+ getPruneProtectTokens() {
1759
+ return Math.max(
1760
+ TurnExecutor.PRUNE_PROTECT_MIN,
1761
+ Math.floor(
1762
+ this.contextManager.getMaxInputTokens() * TurnExecutor.PRUNE_PROTECT_WINDOW_RATIO
1763
+ )
1764
+ );
1765
+ }
1766
+ /**
1767
+ * Emits `context:pruned-tool-call-repeated` for each call in the latest assistant message that
1768
+ * repeats a call whose result was already pruned. This is a no-progress signal for hosts;
1769
+ * the executor never stops the run because of it.
1770
+ */
1771
+ reportRepeatedPrunedToolCalls(history) {
1772
+ for (const repeat of (0, import_repeated_pruned_tool_calls.findRepeatedPrunedToolCalls)(history)) {
1773
+ this.logger.warn(
1774
+ `Model repeated ${repeat.toolName} after its earlier result was pruned (${repeat.repeatCount}x)`
1775
+ );
1776
+ try {
1777
+ this.eventBus.emit("context:pruned-tool-call-repeated", repeat);
1778
+ } catch (error) {
1779
+ this.logger.warn(
1780
+ `A context:pruned-tool-call-repeated listener failed: ${error instanceof Error ? error.message : String(error)}`
1781
+ );
1782
+ }
1783
+ }
1784
+ }
1707
1785
  /**
1708
1786
  * Prunes old tool outputs by marking them with compactedAt timestamp.
1709
1787
  * Does NOT modify content - transformation happens at format time in
@@ -1713,24 +1791,27 @@ class TurnExecutor {
1713
1791
  * 1. Go backwards through history (most recent first)
1714
1792
  * 2. Stop at summary message (only process post-summary messages)
1715
1793
  * 3. Count tool message tokens
1716
- * 4. If total exceeds PRUNE_PROTECT, mark older ones for pruning
1717
- * 5. Only prune if savings exceed PRUNE_MINIMUM
1794
+ * 4. If total exceeds the protected budget, mark older ones for pruning
1795
+ * 5. Never prune results the model has not seen yet
1796
+ * 6. Only prune if savings exceed PRUNE_MINIMUM
1718
1797
  */
1719
- async pruneOldToolOutputs() {
1720
- const history = await this.contextManager.getModelHistory();
1798
+ async pruneOldToolOutputs(history) {
1799
+ const protectTokens = this.getPruneProtectTokens();
1721
1800
  let totalToolTokens = 0;
1722
1801
  let prunedTokens = 0;
1723
1802
  const toPrune = [];
1803
+ let seenByModel = false;
1724
1804
  for (let i = history.length - 1; i >= 0; i--) {
1725
1805
  const msg = history[i];
1726
1806
  if (!msg) continue;
1727
1807
  if (msg.metadata?.isSummary === true) break;
1808
+ if (msg.role === "assistant") seenByModel = true;
1728
1809
  if (msg.role !== "tool") continue;
1729
1810
  if (msg.compactedAt) continue;
1730
1811
  if (!Array.isArray(msg.content)) continue;
1731
1812
  const tokens = this.estimateToolTokens(msg.content);
1732
1813
  totalToolTokens += tokens;
1733
- if (totalToolTokens > TurnExecutor.PRUNE_PROTECT && msg.id) {
1814
+ if (seenByModel && totalToolTokens > protectTokens && msg.id) {
1734
1815
  prunedTokens += tokens;
1735
1816
  toPrune.push(msg.id);
1736
1817
  }
@@ -337,21 +337,36 @@ export declare class TurnExecutor {
337
337
  private cancelledToolResult;
338
338
  private failedToolResult;
339
339
  private getPreparedToolCallSnapshot;
340
+ private sanitizeModelToolResult;
341
+ /**
342
+ * Keeps oversized tool output out of model history: the full text goes to the session's tool
343
+ * output store and history keeps a head and tail preview that names `tool_output_read`. If
344
+ * storing fails, the full text stays inline so nothing is lost.
345
+ */
346
+ private storeOversizedToolOutputs;
340
347
  private persistModelToolResult;
341
348
  private emitToolCall;
342
349
  private resolveToolApprovalIdentity;
343
350
  private resolveModelToolExecutionIdentity;
344
- private toApprovalDecisionInput;
345
351
  private getToolExecutionMetadata;
346
352
  private isToolExecutionSuccessful;
347
353
  private getToolExecutionErrorMessage;
348
354
  private getToolCallInputForEvent;
349
355
  private buildToolCallFallbackSnapshot;
350
356
  /**
351
- * Constants for pruning thresholds
357
+ * Constants for pruning thresholds. The protected budget scales with the model's input
358
+ * window so large-window models keep more recent tool output visible.
352
359
  */
353
- private static readonly PRUNE_PROTECT;
360
+ private static readonly PRUNE_PROTECT_MIN;
361
+ private static readonly PRUNE_PROTECT_WINDOW_RATIO;
354
362
  private static readonly PRUNE_MINIMUM;
363
+ private getPruneProtectTokens;
364
+ /**
365
+ * Emits `context:pruned-tool-call-repeated` for each call in the latest assistant message that
366
+ * repeats a call whose result was already pruned. This is a no-progress signal for hosts;
367
+ * the executor never stops the run because of it.
368
+ */
369
+ private reportRepeatedPrunedToolCalls;
355
370
  /**
356
371
  * Prunes old tool outputs by marking them with compactedAt timestamp.
357
372
  * Does NOT modify content - transformation happens at format time in
@@ -361,8 +376,9 @@ export declare class TurnExecutor {
361
376
  * 1. Go backwards through history (most recent first)
362
377
  * 2. Stop at summary message (only process post-summary messages)
363
378
  * 3. Count tool message tokens
364
- * 4. If total exceeds PRUNE_PROTECT, mark older ones for pruning
365
- * 5. Only prune if savings exceed PRUNE_MINIMUM
379
+ * 4. If total exceeds the protected budget, mark older ones for pruning
380
+ * 5. Never prune results the model has not seen yet
381
+ * 6. Only prune if savings exceed PRUNE_MINIMUM
366
382
  */
367
383
  private pruneOldToolOutputs;
368
384
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"turn-executor.d.ts","sourceRoot":"","sources":["../../../src/llm/executor/turn-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EAMb,KAAK,YAAY,EAEpB,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAa,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAS1D,OAAO,EACH,WAAW,EAId,MAAM,6BA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