@librechat/agents 3.4.7 → 3.5.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 (1026) hide show
  1. package/dist/cjs/agents/AgentContext.cjs +0 -356
  2. package/dist/cjs/agents/AgentContext.cjs.map +1 -1
  3. package/dist/cjs/agents/projection.cjs +0 -9
  4. package/dist/cjs/agents/projection.cjs.map +1 -1
  5. package/dist/cjs/common/constants.cjs +0 -26
  6. package/dist/cjs/common/constants.cjs.map +1 -1
  7. package/dist/cjs/common/enum.cjs +0 -85
  8. package/dist/cjs/common/enum.cjs.map +1 -1
  9. package/dist/cjs/events.cjs +0 -14
  10. package/dist/cjs/events.cjs.map +1 -1
  11. package/dist/cjs/graphs/Graph.cjs +1 -909
  12. package/dist/cjs/graphs/Graph.cjs.map +1 -1
  13. package/dist/cjs/graphs/MultiAgentGraph.cjs +7 -272
  14. package/dist/cjs/graphs/MultiAgentGraph.cjs.map +1 -1
  15. package/dist/cjs/graphs/applyGraphRuntimeConfig.cjs.map +1 -1
  16. package/dist/cjs/graphs/createGraph.cjs.map +1 -1
  17. package/dist/cjs/hitl/askUserQuestion.cjs +0 -53
  18. package/dist/cjs/hitl/askUserQuestion.cjs.map +1 -1
  19. package/dist/cjs/hitl/askUserQuestions.cjs +0 -20
  20. package/dist/cjs/hitl/askUserQuestions.cjs.map +1 -1
  21. package/dist/cjs/hitl/askUserQuestionsInterrupt.cjs +0 -6
  22. package/dist/cjs/hitl/askUserQuestionsInterrupt.cjs.map +1 -1
  23. package/dist/cjs/hooks/HookRegistry.cjs +0 -127
  24. package/dist/cjs/hooks/HookRegistry.cjs.map +1 -1
  25. package/dist/cjs/hooks/createToolPolicyHook.cjs +0 -38
  26. package/dist/cjs/hooks/createToolPolicyHook.cjs.map +1 -1
  27. package/dist/cjs/hooks/createWorkspacePolicyHook.cjs +0 -77
  28. package/dist/cjs/hooks/createWorkspacePolicyHook.cjs.map +1 -1
  29. package/dist/cjs/hooks/executeHooks.cjs +0 -79
  30. package/dist/cjs/hooks/executeHooks.cjs.map +1 -1
  31. package/dist/cjs/hooks/index.cjs +0 -16
  32. package/dist/cjs/hooks/index.cjs.map +1 -1
  33. package/dist/cjs/hooks/matchers.cjs +0 -104
  34. package/dist/cjs/hooks/matchers.cjs.map +1 -1
  35. package/dist/cjs/hooks/types.cjs +0 -8
  36. package/dist/cjs/hooks/types.cjs.map +1 -1
  37. package/dist/cjs/instrumentation.cjs +0 -14
  38. package/dist/cjs/instrumentation.cjs.map +1 -1
  39. package/dist/cjs/langfuse.cjs +0 -75
  40. package/dist/cjs/langfuse.cjs.map +1 -1
  41. package/dist/cjs/langfuseConfig.cjs.map +1 -1
  42. package/dist/cjs/langfuseRuntimeContext.cjs +0 -13
  43. package/dist/cjs/langfuseRuntimeContext.cjs.map +1 -1
  44. package/dist/cjs/langfuseRuntimeScope.cjs +0 -4
  45. package/dist/cjs/langfuseRuntimeScope.cjs.map +1 -1
  46. package/dist/cjs/langfuseSpanRegistry.cjs +0 -28
  47. package/dist/cjs/langfuseSpanRegistry.cjs.map +1 -1
  48. package/dist/cjs/langfuseToolOutputTracing.cjs +0 -3
  49. package/dist/cjs/langfuseToolOutputTracing.cjs.map +1 -1
  50. package/dist/cjs/langfuseTraceShaping.cjs +0 -74
  51. package/dist/cjs/langfuseTraceShaping.cjs.map +1 -1
  52. package/dist/cjs/llm/anthropic/index.cjs +0 -3
  53. package/dist/cjs/llm/anthropic/index.cjs.map +1 -1
  54. package/dist/cjs/llm/anthropic/types.cjs.map +1 -1
  55. package/dist/cjs/llm/anthropic/utils/message_inputs.cjs +1 -111
  56. package/dist/cjs/llm/anthropic/utils/message_inputs.cjs.map +1 -1
  57. package/dist/cjs/llm/anthropic/utils/message_outputs.cjs +0 -1
  58. package/dist/cjs/llm/anthropic/utils/message_outputs.cjs.map +1 -1
  59. package/dist/cjs/llm/anthropic/utils/stream_events.cjs +0 -8
  60. package/dist/cjs/llm/anthropic/utils/stream_events.cjs.map +1 -1
  61. package/dist/cjs/llm/anthropic/utils/tools.cjs.map +1 -1
  62. package/dist/cjs/llm/bedrock/cachePoints.cjs.map +1 -1
  63. package/dist/cjs/llm/bedrock/index.cjs +1 -95
  64. package/dist/cjs/llm/bedrock/index.cjs.map +1 -1
  65. package/dist/cjs/llm/bedrock/toolCache.cjs.map +1 -1
  66. package/dist/cjs/llm/bedrock/utils/message_inputs.cjs +0 -78
  67. package/dist/cjs/llm/bedrock/utils/message_inputs.cjs.map +1 -1
  68. package/dist/cjs/llm/bedrock/utils/message_outputs.cjs +0 -24
  69. package/dist/cjs/llm/bedrock/utils/message_outputs.cjs.map +1 -1
  70. package/dist/cjs/llm/contextOverflowRecovery.cjs +0 -62
  71. package/dist/cjs/llm/contextOverflowRecovery.cjs.map +1 -1
  72. package/dist/cjs/llm/fake.cjs.map +1 -1
  73. package/dist/cjs/llm/google/index.cjs +2 -21
  74. package/dist/cjs/llm/google/index.cjs.map +1 -1
  75. package/dist/cjs/llm/google/utils/common.cjs +0 -35
  76. package/dist/cjs/llm/google/utils/common.cjs.map +1 -1
  77. package/dist/cjs/llm/init.cjs +0 -9
  78. package/dist/cjs/llm/init.cjs.map +1 -1
  79. package/dist/cjs/llm/invoke.cjs +1 -270
  80. package/dist/cjs/llm/invoke.cjs.map +1 -1
  81. package/dist/cjs/llm/mistral/index.cjs.map +1 -1
  82. package/dist/cjs/llm/openai/index.cjs +0 -99
  83. package/dist/cjs/llm/openai/index.cjs.map +1 -1
  84. package/dist/cjs/llm/openai/streamMetadata.cjs +0 -21
  85. package/dist/cjs/llm/openai/streamMetadata.cjs.map +1 -1
  86. package/dist/cjs/llm/openai/utils/index.cjs.map +1 -1
  87. package/dist/cjs/llm/openrouter/index.cjs +0 -1
  88. package/dist/cjs/llm/openrouter/index.cjs.map +1 -1
  89. package/dist/cjs/llm/openrouter/toolCache.cjs +0 -6
  90. package/dist/cjs/llm/openrouter/toolCache.cjs.map +1 -1
  91. package/dist/cjs/llm/preempt.cjs +0 -75
  92. package/dist/cjs/llm/preempt.cjs.map +1 -1
  93. package/dist/cjs/llm/providers.cjs.map +1 -1
  94. package/dist/cjs/llm/request.cjs +0 -10
  95. package/dist/cjs/llm/request.cjs.map +1 -1
  96. package/dist/cjs/llm/stream/chunkAdapters.cjs +0 -62
  97. package/dist/cjs/llm/stream/chunkAdapters.cjs.map +1 -1
  98. package/dist/cjs/llm/stream/smoother.cjs +0 -58
  99. package/dist/cjs/llm/stream/smoother.cjs.map +1 -1
  100. package/dist/cjs/llm/streamLimits.cjs +4 -293
  101. package/dist/cjs/llm/streamLimits.cjs.map +1 -1
  102. package/dist/cjs/llm/truncation.cjs +0 -36
  103. package/dist/cjs/llm/truncation.cjs.map +1 -1
  104. package/dist/cjs/llm/vertexai/index.cjs +0 -330
  105. package/dist/cjs/llm/vertexai/index.cjs.map +1 -1
  106. package/dist/cjs/messages/alternation.cjs +0 -43
  107. package/dist/cjs/messages/alternation.cjs.map +1 -1
  108. package/dist/cjs/messages/anthropicToolCache.cjs +0 -45
  109. package/dist/cjs/messages/anthropicToolCache.cjs.map +1 -1
  110. package/dist/cjs/messages/assistantPhase.cjs +0 -12
  111. package/dist/cjs/messages/assistantPhase.cjs.map +1 -1
  112. package/dist/cjs/messages/budget.cjs +0 -9
  113. package/dist/cjs/messages/budget.cjs.map +1 -1
  114. package/dist/cjs/messages/cache.cjs +0 -172
  115. package/dist/cjs/messages/cache.cjs.map +1 -1
  116. package/dist/cjs/messages/content.cjs +0 -9
  117. package/dist/cjs/messages/content.cjs.map +1 -1
  118. package/dist/cjs/messages/contextPruning.cjs +0 -15
  119. package/dist/cjs/messages/contextPruning.cjs.map +1 -1
  120. package/dist/cjs/messages/contextPruningSettings.cjs +0 -3
  121. package/dist/cjs/messages/contextPruningSettings.cjs.map +1 -1
  122. package/dist/cjs/messages/core.cjs +0 -48
  123. package/dist/cjs/messages/core.cjs.map +1 -1
  124. package/dist/cjs/messages/format.cjs +1 -345
  125. package/dist/cjs/messages/format.cjs.map +1 -1
  126. package/dist/cjs/messages/handoffCue.cjs +0 -36
  127. package/dist/cjs/messages/handoffCue.cjs.map +1 -1
  128. package/dist/cjs/messages/ids.cjs.map +1 -1
  129. package/dist/cjs/messages/injected.cjs +0 -33
  130. package/dist/cjs/messages/injected.cjs.map +1 -1
  131. package/dist/cjs/messages/langchain.cjs +0 -14
  132. package/dist/cjs/messages/langchain.cjs.map +1 -1
  133. package/dist/cjs/messages/prune.cjs +1 -184
  134. package/dist/cjs/messages/prune.cjs.map +1 -1
  135. package/dist/cjs/messages/recency.cjs +0 -32
  136. package/dist/cjs/messages/recency.cjs.map +1 -1
  137. package/dist/cjs/messages/reducer.cjs +0 -30
  138. package/dist/cjs/messages/reducer.cjs.map +1 -1
  139. package/dist/cjs/messages/tools.cjs +0 -14
  140. package/dist/cjs/messages/tools.cjs.map +1 -1
  141. package/dist/cjs/openai/index.cjs.map +1 -1
  142. package/dist/cjs/prompts/activityLabel.cjs +9 -79
  143. package/dist/cjs/prompts/activityLabel.cjs.map +1 -1
  144. package/dist/cjs/responses/index.cjs.map +1 -1
  145. package/dist/cjs/run.cjs +2 -538
  146. package/dist/cjs/run.cjs.map +1 -1
  147. package/dist/cjs/session/AgentSession.cjs +1 -17
  148. package/dist/cjs/session/AgentSession.cjs.map +1 -1
  149. package/dist/cjs/session/JsonlSessionStore.cjs.map +1 -1
  150. package/dist/cjs/session/handlers.cjs +0 -7
  151. package/dist/cjs/session/handlers.cjs.map +1 -1
  152. package/dist/cjs/session/ids.cjs.map +1 -1
  153. package/dist/cjs/session/messageSerialization.cjs +0 -4
  154. package/dist/cjs/session/messageSerialization.cjs.map +1 -1
  155. package/dist/cjs/stream.cjs +1 -93
  156. package/dist/cjs/stream.cjs.map +1 -1
  157. package/dist/cjs/summarization/index.cjs +0 -27
  158. package/dist/cjs/summarization/index.cjs.map +1 -1
  159. package/dist/cjs/summarization/node.cjs +0 -273
  160. package/dist/cjs/summarization/node.cjs.map +1 -1
  161. package/dist/cjs/tools/BashExecutor.cjs +0 -35
  162. package/dist/cjs/tools/BashExecutor.cjs.map +1 -1
  163. package/dist/cjs/tools/BashProgrammaticToolCalling.cjs +0 -24
  164. package/dist/cjs/tools/BashProgrammaticToolCalling.cjs.map +1 -1
  165. package/dist/cjs/tools/Calculator.cjs.map +1 -1
  166. package/dist/cjs/tools/CodeExecutor.cjs +0 -13
  167. package/dist/cjs/tools/CodeExecutor.cjs.map +1 -1
  168. package/dist/cjs/tools/CodeSessionFileSummary.cjs.map +1 -1
  169. package/dist/cjs/tools/ProgrammaticToolCalling.cjs +0 -101
  170. package/dist/cjs/tools/ProgrammaticToolCalling.cjs.map +1 -1
  171. package/dist/cjs/tools/ReadFile.cjs.map +1 -1
  172. package/dist/cjs/tools/SkillTool.cjs +0 -5
  173. package/dist/cjs/tools/SkillTool.cjs.map +1 -1
  174. package/dist/cjs/tools/SubagentTool.cjs +0 -10
  175. package/dist/cjs/tools/SubagentTool.cjs.map +1 -1
  176. package/dist/cjs/tools/ToolNode.cjs +6 -1038
  177. package/dist/cjs/tools/ToolNode.cjs.map +1 -1
  178. package/dist/cjs/tools/ToolSearch.cjs +0 -179
  179. package/dist/cjs/tools/ToolSearch.cjs.map +1 -1
  180. package/dist/cjs/tools/cloudflare/CloudflareBridgeRuntime.cjs.map +1 -1
  181. package/dist/cjs/tools/cloudflare/CloudflareProgrammaticToolCalling.cjs.map +1 -1
  182. package/dist/cjs/tools/cloudflare/CloudflareSandboxExecutionEngine.cjs +0 -39
  183. package/dist/cjs/tools/cloudflare/CloudflareSandboxExecutionEngine.cjs.map +1 -1
  184. package/dist/cjs/tools/cloudflare/CloudflareSandboxTools.cjs.map +1 -1
  185. package/dist/cjs/tools/eagerEventExecution.cjs +0 -6
  186. package/dist/cjs/tools/eagerEventExecution.cjs.map +1 -1
  187. package/dist/cjs/tools/handlers.cjs +1 -41
  188. package/dist/cjs/tools/handlers.cjs.map +1 -1
  189. package/dist/cjs/tools/intentArg.cjs +1 -132
  190. package/dist/cjs/tools/intentArg.cjs.map +1 -1
  191. package/dist/cjs/tools/local/CompileCheckTool.cjs +0 -25
  192. package/dist/cjs/tools/local/CompileCheckTool.cjs.map +1 -1
  193. package/dist/cjs/tools/local/FileCheckpointer.cjs +0 -23
  194. package/dist/cjs/tools/local/FileCheckpointer.cjs.map +1 -1
  195. package/dist/cjs/tools/local/LocalCodingTools.cjs +0 -80
  196. package/dist/cjs/tools/local/LocalCodingTools.cjs.map +1 -1
  197. package/dist/cjs/tools/local/LocalExecutionEngine.cjs +0 -126
  198. package/dist/cjs/tools/local/LocalExecutionEngine.cjs.map +1 -1
  199. package/dist/cjs/tools/local/LocalExecutionTools.cjs.map +1 -1
  200. package/dist/cjs/tools/local/LocalProgrammaticToolCalling.cjs +0 -12
  201. package/dist/cjs/tools/local/LocalProgrammaticToolCalling.cjs.map +1 -1
  202. package/dist/cjs/tools/local/attachments.cjs +0 -44
  203. package/dist/cjs/tools/local/attachments.cjs.map +1 -1
  204. package/dist/cjs/tools/local/bashAst.cjs +0 -16
  205. package/dist/cjs/tools/local/bashAst.cjs.map +1 -1
  206. package/dist/cjs/tools/local/editStrategies.cjs +0 -14
  207. package/dist/cjs/tools/local/editStrategies.cjs.map +1 -1
  208. package/dist/cjs/tools/local/resolveLocalExecutionTools.cjs.map +1 -1
  209. package/dist/cjs/tools/local/syntaxCheck.cjs +0 -31
  210. package/dist/cjs/tools/local/syntaxCheck.cjs.map +1 -1
  211. package/dist/cjs/tools/local/textEncoding.cjs +0 -11
  212. package/dist/cjs/tools/local/textEncoding.cjs.map +1 -1
  213. package/dist/cjs/tools/local/workspaceFS.cjs +0 -33
  214. package/dist/cjs/tools/local/workspaceFS.cjs.map +1 -1
  215. package/dist/cjs/tools/ptcTimeout.cjs.map +1 -1
  216. package/dist/cjs/tools/schema.cjs +0 -8
  217. package/dist/cjs/tools/schema.cjs.map +1 -1
  218. package/dist/cjs/tools/search/anthropic.cjs +0 -9
  219. package/dist/cjs/tools/search/anthropic.cjs.map +1 -1
  220. package/dist/cjs/tools/search/content.cjs.map +1 -1
  221. package/dist/cjs/tools/search/crw-scraper.cjs +0 -33
  222. package/dist/cjs/tools/search/crw-scraper.cjs.map +1 -1
  223. package/dist/cjs/tools/search/crw-search.cjs +0 -2
  224. package/dist/cjs/tools/search/crw-search.cjs.map +1 -1
  225. package/dist/cjs/tools/search/firecrawl.cjs +0 -25
  226. package/dist/cjs/tools/search/firecrawl.cjs.map +1 -1
  227. package/dist/cjs/tools/search/format.cjs +0 -30
  228. package/dist/cjs/tools/search/format.cjs.map +1 -1
  229. package/dist/cjs/tools/search/highlights.cjs +0 -16
  230. package/dist/cjs/tools/search/highlights.cjs.map +1 -1
  231. package/dist/cjs/tools/search/keenable-scraper.cjs +0 -8
  232. package/dist/cjs/tools/search/keenable-scraper.cjs.map +1 -1
  233. package/dist/cjs/tools/search/keenable-search.cjs +0 -7
  234. package/dist/cjs/tools/search/keenable-search.cjs.map +1 -1
  235. package/dist/cjs/tools/search/rerankers.cjs +0 -35
  236. package/dist/cjs/tools/search/rerankers.cjs.map +1 -1
  237. package/dist/cjs/tools/search/schema.cjs +0 -1
  238. package/dist/cjs/tools/search/schema.cjs.map +1 -1
  239. package/dist/cjs/tools/search/search.cjs +1 -14
  240. package/dist/cjs/tools/search/search.cjs.map +1 -1
  241. package/dist/cjs/tools/search/serper-scraper.cjs +0 -46
  242. package/dist/cjs/tools/search/serper-scraper.cjs.map +1 -1
  243. package/dist/cjs/tools/search/tavily-scraper.cjs.map +1 -1
  244. package/dist/cjs/tools/search/tavily-search.cjs.map +1 -1
  245. package/dist/cjs/tools/search/tool.cjs +0 -25
  246. package/dist/cjs/tools/search/tool.cjs.map +1 -1
  247. package/dist/cjs/tools/search/utils.cjs +0 -8
  248. package/dist/cjs/tools/search/utils.cjs.map +1 -1
  249. package/dist/cjs/tools/skillCatalog.cjs +0 -6
  250. package/dist/cjs/tools/skillCatalog.cjs.map +1 -1
  251. package/dist/cjs/tools/streamedToolCallSeals.cjs +0 -6
  252. package/dist/cjs/tools/streamedToolCallSeals.cjs.map +1 -1
  253. package/dist/cjs/tools/subagent/SubagentExecutionRegistry.cjs +0 -2
  254. package/dist/cjs/tools/subagent/SubagentExecutionRegistry.cjs.map +1 -1
  255. package/dist/cjs/tools/subagent/SubagentExecutor.cjs +3 -213
  256. package/dist/cjs/tools/subagent/SubagentExecutor.cjs.map +1 -1
  257. package/dist/cjs/tools/subagent/SubagentReplay.cjs.map +1 -1
  258. package/dist/cjs/tools/subagent/childGraphConfig.cjs +0 -4
  259. package/dist/cjs/tools/subagent/childGraphConfig.cjs.map +1 -1
  260. package/dist/cjs/tools/subagent/runtimeLimits.cjs.map +1 -1
  261. package/dist/cjs/tools/toolOutputReferences.cjs +1 -322
  262. package/dist/cjs/tools/toolOutputReferences.cjs.map +1 -1
  263. package/dist/cjs/types/hitl.cjs +0 -5
  264. package/dist/cjs/types/hitl.cjs.map +1 -1
  265. package/dist/cjs/utils/callbacks.cjs.map +1 -1
  266. package/dist/cjs/utils/errors.cjs +14 -165
  267. package/dist/cjs/utils/errors.cjs.map +1 -1
  268. package/dist/cjs/utils/events.cjs +0 -10
  269. package/dist/cjs/utils/events.cjs.map +1 -1
  270. package/dist/cjs/utils/graph.cjs.map +1 -1
  271. package/dist/cjs/utils/handlers.cjs +0 -3
  272. package/dist/cjs/utils/handlers.cjs.map +1 -1
  273. package/dist/cjs/utils/llm.cjs +0 -1
  274. package/dist/cjs/utils/llm.cjs.map +1 -1
  275. package/dist/cjs/utils/misc.cjs +0 -16
  276. package/dist/cjs/utils/misc.cjs.map +1 -1
  277. package/dist/cjs/utils/proxy.cjs +0 -26
  278. package/dist/cjs/utils/proxy.cjs.map +1 -1
  279. package/dist/cjs/utils/run.cjs +0 -6
  280. package/dist/cjs/utils/run.cjs.map +1 -1
  281. package/dist/cjs/utils/schema.cjs +0 -5
  282. package/dist/cjs/utils/schema.cjs.map +1 -1
  283. package/dist/cjs/utils/title.cjs +0 -6
  284. package/dist/cjs/utils/title.cjs.map +1 -1
  285. package/dist/cjs/utils/tokens.cjs +0 -113
  286. package/dist/cjs/utils/tokens.cjs.map +1 -1
  287. package/dist/cjs/utils/toolContent.cjs +0 -41
  288. package/dist/cjs/utils/toolContent.cjs.map +1 -1
  289. package/dist/cjs/utils/truncation.cjs +0 -61
  290. package/dist/cjs/utils/truncation.cjs.map +1 -1
  291. package/dist/esm/agents/AgentContext.mjs +0 -356
  292. package/dist/esm/agents/AgentContext.mjs.map +1 -1
  293. package/dist/esm/agents/projection.mjs +0 -9
  294. package/dist/esm/agents/projection.mjs.map +1 -1
  295. package/dist/esm/common/constants.mjs +0 -26
  296. package/dist/esm/common/constants.mjs.map +1 -1
  297. package/dist/esm/common/enum.mjs +0 -85
  298. package/dist/esm/common/enum.mjs.map +1 -1
  299. package/dist/esm/events.mjs +0 -14
  300. package/dist/esm/events.mjs.map +1 -1
  301. package/dist/esm/graphs/Graph.mjs +1 -909
  302. package/dist/esm/graphs/Graph.mjs.map +1 -1
  303. package/dist/esm/graphs/MultiAgentGraph.mjs +7 -272
  304. package/dist/esm/graphs/MultiAgentGraph.mjs.map +1 -1
  305. package/dist/esm/graphs/applyGraphRuntimeConfig.mjs.map +1 -1
  306. package/dist/esm/graphs/createGraph.mjs.map +1 -1
  307. package/dist/esm/hitl/askUserQuestion.mjs +0 -53
  308. package/dist/esm/hitl/askUserQuestion.mjs.map +1 -1
  309. package/dist/esm/hitl/askUserQuestions.mjs +0 -20
  310. package/dist/esm/hitl/askUserQuestions.mjs.map +1 -1
  311. package/dist/esm/hitl/askUserQuestionsInterrupt.mjs +0 -6
  312. package/dist/esm/hitl/askUserQuestionsInterrupt.mjs.map +1 -1
  313. package/dist/esm/hooks/HookRegistry.mjs +0 -127
  314. package/dist/esm/hooks/HookRegistry.mjs.map +1 -1
  315. package/dist/esm/hooks/createToolPolicyHook.mjs +0 -38
  316. package/dist/esm/hooks/createToolPolicyHook.mjs.map +1 -1
  317. package/dist/esm/hooks/createWorkspacePolicyHook.mjs +0 -77
  318. package/dist/esm/hooks/createWorkspacePolicyHook.mjs.map +1 -1
  319. package/dist/esm/hooks/executeHooks.mjs +0 -79
  320. package/dist/esm/hooks/executeHooks.mjs.map +1 -1
  321. package/dist/esm/hooks/index.mjs +0 -16
  322. package/dist/esm/hooks/index.mjs.map +1 -1
  323. package/dist/esm/hooks/matchers.mjs +0 -104
  324. package/dist/esm/hooks/matchers.mjs.map +1 -1
  325. package/dist/esm/hooks/types.mjs +0 -8
  326. package/dist/esm/hooks/types.mjs.map +1 -1
  327. package/dist/esm/instrumentation.mjs +0 -14
  328. package/dist/esm/instrumentation.mjs.map +1 -1
  329. package/dist/esm/langfuse.mjs +0 -75
  330. package/dist/esm/langfuse.mjs.map +1 -1
  331. package/dist/esm/langfuseConfig.mjs.map +1 -1
  332. package/dist/esm/langfuseRuntimeContext.mjs +0 -13
  333. package/dist/esm/langfuseRuntimeContext.mjs.map +1 -1
  334. package/dist/esm/langfuseRuntimeScope.mjs +0 -4
  335. package/dist/esm/langfuseRuntimeScope.mjs.map +1 -1
  336. package/dist/esm/langfuseSpanRegistry.mjs +0 -28
  337. package/dist/esm/langfuseSpanRegistry.mjs.map +1 -1
  338. package/dist/esm/langfuseToolOutputTracing.mjs +0 -3
  339. package/dist/esm/langfuseToolOutputTracing.mjs.map +1 -1
  340. package/dist/esm/langfuseTraceShaping.mjs +0 -74
  341. package/dist/esm/langfuseTraceShaping.mjs.map +1 -1
  342. package/dist/esm/llm/anthropic/index.mjs +0 -3
  343. package/dist/esm/llm/anthropic/index.mjs.map +1 -1
  344. package/dist/esm/llm/anthropic/types.mjs.map +1 -1
  345. package/dist/esm/llm/anthropic/utils/message_inputs.mjs +1 -111
  346. package/dist/esm/llm/anthropic/utils/message_inputs.mjs.map +1 -1
  347. package/dist/esm/llm/anthropic/utils/message_outputs.mjs +0 -1
  348. package/dist/esm/llm/anthropic/utils/message_outputs.mjs.map +1 -1
  349. package/dist/esm/llm/anthropic/utils/stream_events.mjs +0 -8
  350. package/dist/esm/llm/anthropic/utils/stream_events.mjs.map +1 -1
  351. package/dist/esm/llm/anthropic/utils/tools.mjs.map +1 -1
  352. package/dist/esm/llm/bedrock/cachePoints.mjs.map +1 -1
  353. package/dist/esm/llm/bedrock/index.mjs +1 -95
  354. package/dist/esm/llm/bedrock/index.mjs.map +1 -1
  355. package/dist/esm/llm/bedrock/toolCache.mjs.map +1 -1
  356. package/dist/esm/llm/bedrock/utils/message_inputs.mjs +0 -78
  357. package/dist/esm/llm/bedrock/utils/message_inputs.mjs.map +1 -1
  358. package/dist/esm/llm/bedrock/utils/message_outputs.mjs +0 -24
  359. package/dist/esm/llm/bedrock/utils/message_outputs.mjs.map +1 -1
  360. package/dist/esm/llm/contextOverflowRecovery.mjs +0 -62
  361. package/dist/esm/llm/contextOverflowRecovery.mjs.map +1 -1
  362. package/dist/esm/llm/fake.mjs.map +1 -1
  363. package/dist/esm/llm/google/index.mjs +2 -21
  364. package/dist/esm/llm/google/index.mjs.map +1 -1
  365. package/dist/esm/llm/google/utils/common.mjs +0 -35
  366. package/dist/esm/llm/google/utils/common.mjs.map +1 -1
  367. package/dist/esm/llm/init.mjs +0 -9
  368. package/dist/esm/llm/init.mjs.map +1 -1
  369. package/dist/esm/llm/invoke.mjs +1 -270
  370. package/dist/esm/llm/invoke.mjs.map +1 -1
  371. package/dist/esm/llm/mistral/index.mjs.map +1 -1
  372. package/dist/esm/llm/openai/index.mjs +0 -99
  373. package/dist/esm/llm/openai/index.mjs.map +1 -1
  374. package/dist/esm/llm/openai/streamMetadata.mjs +0 -21
  375. package/dist/esm/llm/openai/streamMetadata.mjs.map +1 -1
  376. package/dist/esm/llm/openai/utils/index.mjs.map +1 -1
  377. package/dist/esm/llm/openrouter/index.mjs +0 -1
  378. package/dist/esm/llm/openrouter/index.mjs.map +1 -1
  379. package/dist/esm/llm/openrouter/toolCache.mjs +0 -6
  380. package/dist/esm/llm/openrouter/toolCache.mjs.map +1 -1
  381. package/dist/esm/llm/preempt.mjs +0 -75
  382. package/dist/esm/llm/preempt.mjs.map +1 -1
  383. package/dist/esm/llm/providers.mjs.map +1 -1
  384. package/dist/esm/llm/request.mjs +0 -10
  385. package/dist/esm/llm/request.mjs.map +1 -1
  386. package/dist/esm/llm/stream/chunkAdapters.mjs +0 -62
  387. package/dist/esm/llm/stream/chunkAdapters.mjs.map +1 -1
  388. package/dist/esm/llm/stream/smoother.mjs +0 -58
  389. package/dist/esm/llm/stream/smoother.mjs.map +1 -1
  390. package/dist/esm/llm/streamLimits.mjs +4 -293
  391. package/dist/esm/llm/streamLimits.mjs.map +1 -1
  392. package/dist/esm/llm/truncation.mjs +0 -36
  393. package/dist/esm/llm/truncation.mjs.map +1 -1
  394. package/dist/esm/llm/vertexai/index.mjs +0 -330
  395. package/dist/esm/llm/vertexai/index.mjs.map +1 -1
  396. package/dist/esm/messages/alternation.mjs +0 -43
  397. package/dist/esm/messages/alternation.mjs.map +1 -1
  398. package/dist/esm/messages/anthropicToolCache.mjs +0 -45
  399. package/dist/esm/messages/anthropicToolCache.mjs.map +1 -1
  400. package/dist/esm/messages/assistantPhase.mjs +0 -12
  401. package/dist/esm/messages/assistantPhase.mjs.map +1 -1
  402. package/dist/esm/messages/budget.mjs +0 -9
  403. package/dist/esm/messages/budget.mjs.map +1 -1
  404. package/dist/esm/messages/cache.mjs +0 -172
  405. package/dist/esm/messages/cache.mjs.map +1 -1
  406. package/dist/esm/messages/content.mjs +0 -9
  407. package/dist/esm/messages/content.mjs.map +1 -1
  408. package/dist/esm/messages/contextPruning.mjs +0 -15
  409. package/dist/esm/messages/contextPruning.mjs.map +1 -1
  410. package/dist/esm/messages/contextPruningSettings.mjs +0 -3
  411. package/dist/esm/messages/contextPruningSettings.mjs.map +1 -1
  412. package/dist/esm/messages/core.mjs +0 -48
  413. package/dist/esm/messages/core.mjs.map +1 -1
  414. package/dist/esm/messages/format.mjs +1 -345
  415. package/dist/esm/messages/format.mjs.map +1 -1
  416. package/dist/esm/messages/handoffCue.mjs +0 -36
  417. package/dist/esm/messages/handoffCue.mjs.map +1 -1
  418. package/dist/esm/messages/ids.mjs.map +1 -1
  419. package/dist/esm/messages/injected.mjs +0 -33
  420. package/dist/esm/messages/injected.mjs.map +1 -1
  421. package/dist/esm/messages/langchain.mjs +0 -14
  422. package/dist/esm/messages/langchain.mjs.map +1 -1
  423. package/dist/esm/messages/prune.mjs +1 -184
  424. package/dist/esm/messages/prune.mjs.map +1 -1
  425. package/dist/esm/messages/recency.mjs +0 -32
  426. package/dist/esm/messages/recency.mjs.map +1 -1
  427. package/dist/esm/messages/reducer.mjs +0 -30
  428. package/dist/esm/messages/reducer.mjs.map +1 -1
  429. package/dist/esm/messages/tools.mjs +0 -14
  430. package/dist/esm/messages/tools.mjs.map +1 -1
  431. package/dist/esm/openai/index.mjs.map +1 -1
  432. package/dist/esm/prompts/activityLabel.mjs +9 -79
  433. package/dist/esm/prompts/activityLabel.mjs.map +1 -1
  434. package/dist/esm/responses/index.mjs.map +1 -1
  435. package/dist/esm/run.mjs +2 -538
  436. package/dist/esm/run.mjs.map +1 -1
  437. package/dist/esm/session/AgentSession.mjs +1 -17
  438. package/dist/esm/session/AgentSession.mjs.map +1 -1
  439. package/dist/esm/session/JsonlSessionStore.mjs.map +1 -1
  440. package/dist/esm/session/handlers.mjs +0 -7
  441. package/dist/esm/session/handlers.mjs.map +1 -1
  442. package/dist/esm/session/ids.mjs.map +1 -1
  443. package/dist/esm/session/messageSerialization.mjs +0 -4
  444. package/dist/esm/session/messageSerialization.mjs.map +1 -1
  445. package/dist/esm/stream.mjs +1 -93
  446. package/dist/esm/stream.mjs.map +1 -1
  447. package/dist/esm/summarization/index.mjs +0 -27
  448. package/dist/esm/summarization/index.mjs.map +1 -1
  449. package/dist/esm/summarization/node.mjs +0 -273
  450. package/dist/esm/summarization/node.mjs.map +1 -1
  451. package/dist/esm/tools/BashExecutor.mjs +0 -35
  452. package/dist/esm/tools/BashExecutor.mjs.map +1 -1
  453. package/dist/esm/tools/BashProgrammaticToolCalling.mjs +0 -24
  454. package/dist/esm/tools/BashProgrammaticToolCalling.mjs.map +1 -1
  455. package/dist/esm/tools/Calculator.mjs.map +1 -1
  456. package/dist/esm/tools/CodeExecutor.mjs +0 -13
  457. package/dist/esm/tools/CodeExecutor.mjs.map +1 -1
  458. package/dist/esm/tools/CodeSessionFileSummary.mjs.map +1 -1
  459. package/dist/esm/tools/ProgrammaticToolCalling.mjs +0 -101
  460. package/dist/esm/tools/ProgrammaticToolCalling.mjs.map +1 -1
  461. package/dist/esm/tools/ReadFile.mjs.map +1 -1
  462. package/dist/esm/tools/SkillTool.mjs +0 -5
  463. package/dist/esm/tools/SkillTool.mjs.map +1 -1
  464. package/dist/esm/tools/SubagentTool.mjs +0 -10
  465. package/dist/esm/tools/SubagentTool.mjs.map +1 -1
  466. package/dist/esm/tools/ToolNode.mjs +6 -1038
  467. package/dist/esm/tools/ToolNode.mjs.map +1 -1
  468. package/dist/esm/tools/ToolSearch.mjs +0 -179
  469. package/dist/esm/tools/ToolSearch.mjs.map +1 -1
  470. package/dist/esm/tools/cloudflare/CloudflareBridgeRuntime.mjs.map +1 -1
  471. package/dist/esm/tools/cloudflare/CloudflareProgrammaticToolCalling.mjs.map +1 -1
  472. package/dist/esm/tools/cloudflare/CloudflareSandboxExecutionEngine.mjs +0 -39
  473. package/dist/esm/tools/cloudflare/CloudflareSandboxExecutionEngine.mjs.map +1 -1
  474. package/dist/esm/tools/cloudflare/CloudflareSandboxTools.mjs.map +1 -1
  475. package/dist/esm/tools/eagerEventExecution.mjs +0 -6
  476. package/dist/esm/tools/eagerEventExecution.mjs.map +1 -1
  477. package/dist/esm/tools/handlers.mjs +1 -41
  478. package/dist/esm/tools/handlers.mjs.map +1 -1
  479. package/dist/esm/tools/intentArg.mjs +1 -132
  480. package/dist/esm/tools/intentArg.mjs.map +1 -1
  481. package/dist/esm/tools/local/CompileCheckTool.mjs +0 -25
  482. package/dist/esm/tools/local/CompileCheckTool.mjs.map +1 -1
  483. package/dist/esm/tools/local/FileCheckpointer.mjs +0 -23
  484. package/dist/esm/tools/local/FileCheckpointer.mjs.map +1 -1
  485. package/dist/esm/tools/local/LocalCodingTools.mjs +0 -80
  486. package/dist/esm/tools/local/LocalCodingTools.mjs.map +1 -1
  487. package/dist/esm/tools/local/LocalExecutionEngine.mjs +0 -126
  488. package/dist/esm/tools/local/LocalExecutionEngine.mjs.map +1 -1
  489. package/dist/esm/tools/local/LocalExecutionTools.mjs.map +1 -1
  490. package/dist/esm/tools/local/LocalProgrammaticToolCalling.mjs +0 -12
  491. package/dist/esm/tools/local/LocalProgrammaticToolCalling.mjs.map +1 -1
  492. package/dist/esm/tools/local/attachments.mjs +0 -44
  493. package/dist/esm/tools/local/attachments.mjs.map +1 -1
  494. package/dist/esm/tools/local/bashAst.mjs +0 -16
  495. package/dist/esm/tools/local/bashAst.mjs.map +1 -1
  496. package/dist/esm/tools/local/editStrategies.mjs +0 -14
  497. package/dist/esm/tools/local/editStrategies.mjs.map +1 -1
  498. package/dist/esm/tools/local/resolveLocalExecutionTools.mjs.map +1 -1
  499. package/dist/esm/tools/local/syntaxCheck.mjs +0 -31
  500. package/dist/esm/tools/local/syntaxCheck.mjs.map +1 -1
  501. package/dist/esm/tools/local/textEncoding.mjs +0 -11
  502. package/dist/esm/tools/local/textEncoding.mjs.map +1 -1
  503. package/dist/esm/tools/local/workspaceFS.mjs +0 -33
  504. package/dist/esm/tools/local/workspaceFS.mjs.map +1 -1
  505. package/dist/esm/tools/ptcTimeout.mjs.map +1 -1
  506. package/dist/esm/tools/schema.mjs +0 -8
  507. package/dist/esm/tools/schema.mjs.map +1 -1
  508. package/dist/esm/tools/search/anthropic.mjs +0 -9
  509. package/dist/esm/tools/search/anthropic.mjs.map +1 -1
  510. package/dist/esm/tools/search/content.mjs.map +1 -1
  511. package/dist/esm/tools/search/crw-scraper.mjs +0 -33
  512. package/dist/esm/tools/search/crw-scraper.mjs.map +1 -1
  513. package/dist/esm/tools/search/crw-search.mjs +0 -2
  514. package/dist/esm/tools/search/crw-search.mjs.map +1 -1
  515. package/dist/esm/tools/search/firecrawl.mjs +0 -25
  516. package/dist/esm/tools/search/firecrawl.mjs.map +1 -1
  517. package/dist/esm/tools/search/format.mjs +0 -30
  518. package/dist/esm/tools/search/format.mjs.map +1 -1
  519. package/dist/esm/tools/search/highlights.mjs +0 -16
  520. package/dist/esm/tools/search/highlights.mjs.map +1 -1
  521. package/dist/esm/tools/search/keenable-scraper.mjs +0 -8
  522. package/dist/esm/tools/search/keenable-scraper.mjs.map +1 -1
  523. package/dist/esm/tools/search/keenable-search.mjs +0 -7
  524. package/dist/esm/tools/search/keenable-search.mjs.map +1 -1
  525. package/dist/esm/tools/search/rerankers.mjs +0 -35
  526. package/dist/esm/tools/search/rerankers.mjs.map +1 -1
  527. package/dist/esm/tools/search/schema.mjs +0 -1
  528. package/dist/esm/tools/search/schema.mjs.map +1 -1
  529. package/dist/esm/tools/search/search.mjs +1 -14
  530. package/dist/esm/tools/search/search.mjs.map +1 -1
  531. package/dist/esm/tools/search/serper-scraper.mjs +0 -46
  532. package/dist/esm/tools/search/serper-scraper.mjs.map +1 -1
  533. package/dist/esm/tools/search/tavily-scraper.mjs.map +1 -1
  534. package/dist/esm/tools/search/tavily-search.mjs.map +1 -1
  535. package/dist/esm/tools/search/tool.mjs +0 -25
  536. package/dist/esm/tools/search/tool.mjs.map +1 -1
  537. package/dist/esm/tools/search/utils.mjs +0 -8
  538. package/dist/esm/tools/search/utils.mjs.map +1 -1
  539. package/dist/esm/tools/skillCatalog.mjs +0 -6
  540. package/dist/esm/tools/skillCatalog.mjs.map +1 -1
  541. package/dist/esm/tools/streamedToolCallSeals.mjs +0 -6
  542. package/dist/esm/tools/streamedToolCallSeals.mjs.map +1 -1
  543. package/dist/esm/tools/subagent/SubagentExecutionRegistry.mjs +0 -2
  544. package/dist/esm/tools/subagent/SubagentExecutionRegistry.mjs.map +1 -1
  545. package/dist/esm/tools/subagent/SubagentExecutor.mjs +3 -213
  546. package/dist/esm/tools/subagent/SubagentExecutor.mjs.map +1 -1
  547. package/dist/esm/tools/subagent/SubagentReplay.mjs.map +1 -1
  548. package/dist/esm/tools/subagent/childGraphConfig.mjs +0 -4
  549. package/dist/esm/tools/subagent/childGraphConfig.mjs.map +1 -1
  550. package/dist/esm/tools/subagent/runtimeLimits.mjs.map +1 -1
  551. package/dist/esm/tools/toolOutputReferences.mjs +1 -322
  552. package/dist/esm/tools/toolOutputReferences.mjs.map +1 -1
  553. package/dist/esm/types/hitl.mjs +0 -5
  554. package/dist/esm/types/hitl.mjs.map +1 -1
  555. package/dist/esm/utils/callbacks.mjs.map +1 -1
  556. package/dist/esm/utils/errors.mjs +14 -165
  557. package/dist/esm/utils/errors.mjs.map +1 -1
  558. package/dist/esm/utils/events.mjs +0 -10
  559. package/dist/esm/utils/events.mjs.map +1 -1
  560. package/dist/esm/utils/graph.mjs.map +1 -1
  561. package/dist/esm/utils/handlers.mjs +0 -3
  562. package/dist/esm/utils/handlers.mjs.map +1 -1
  563. package/dist/esm/utils/llm.mjs +0 -1
  564. package/dist/esm/utils/llm.mjs.map +1 -1
  565. package/dist/esm/utils/misc.mjs +0 -16
  566. package/dist/esm/utils/misc.mjs.map +1 -1
  567. package/dist/esm/utils/proxy.mjs +0 -26
  568. package/dist/esm/utils/proxy.mjs.map +1 -1
  569. package/dist/esm/utils/run.mjs +0 -6
  570. package/dist/esm/utils/run.mjs.map +1 -1
  571. package/dist/esm/utils/schema.mjs +0 -5
  572. package/dist/esm/utils/schema.mjs.map +1 -1
  573. package/dist/esm/utils/title.mjs +0 -6
  574. package/dist/esm/utils/title.mjs.map +1 -1
  575. package/dist/esm/utils/tokens.mjs +0 -113
  576. package/dist/esm/utils/tokens.mjs.map +1 -1
  577. package/dist/esm/utils/toolContent.mjs +0 -41
  578. package/dist/esm/utils/toolContent.mjs.map +1 -1
  579. package/dist/esm/utils/truncation.mjs +0 -61
  580. package/dist/esm/utils/truncation.mjs.map +1 -1
  581. package/dist/types/agents/AgentContext.d.ts +3 -3
  582. package/dist/types/agents/__tests__/promptCacheLiveHelpers.d.ts +3 -3
  583. package/dist/types/agents/projection.d.ts +1 -1
  584. package/dist/types/events.d.ts +2 -2
  585. package/dist/types/graphs/Graph.d.ts +11 -11
  586. package/dist/types/graphs/MultiAgentGraph.d.ts +2 -2
  587. package/dist/types/graphs/createGraph.d.ts +4 -4
  588. package/dist/types/graphs/graphFactory.d.ts +1 -1
  589. package/dist/types/hitl/askUserQuestion.d.ts +1 -1
  590. package/dist/types/hitl/askUserQuestions.d.ts +1 -1
  591. package/dist/types/hitl/askUserQuestionsInterrupt.d.ts +1 -1
  592. package/dist/types/hooks/types.d.ts +1 -1
  593. package/dist/types/instrumentation.d.ts +1 -1
  594. package/dist/types/langfuse.d.ts +3 -3
  595. package/dist/types/langfuseConfig.d.ts +2 -2
  596. package/dist/types/langfuseRuntimeContext.d.ts +1 -1
  597. package/dist/types/langfuseRuntimeScope.d.ts +2 -2
  598. package/dist/types/langfuseSpanRegistry.d.ts +1 -1
  599. package/dist/types/langfuseToolOutputTracing.d.ts +3 -3
  600. package/dist/types/llm/anthropic/index.d.ts +1 -1
  601. package/dist/types/llm/bedrock/index.d.ts +1 -1
  602. package/dist/types/llm/bedrock/toolCache.d.ts +2 -2
  603. package/dist/types/llm/contextOverflowRecovery.d.ts +2 -2
  604. package/dist/types/llm/google/index.d.ts +1 -1
  605. package/dist/types/llm/init.d.ts +2 -2
  606. package/dist/types/llm/invoke.d.ts +6 -6
  607. package/dist/types/llm/mistral/index.d.ts +1 -1
  608. package/dist/types/llm/openai/index.d.ts +2 -2
  609. package/dist/types/llm/openrouter/index.d.ts +2 -2
  610. package/dist/types/llm/openrouter/toolCache.d.ts +2 -2
  611. package/dist/types/llm/providers.d.ts +2 -2
  612. package/dist/types/llm/request.d.ts +2 -2
  613. package/dist/types/llm/stream/chunkAdapters.d.ts +1 -1
  614. package/dist/types/llm/streamLimits.d.ts +1 -1
  615. package/dist/types/llm/truncation.d.ts +1 -1
  616. package/dist/types/llm/vertexai/index.d.ts +1 -1
  617. package/dist/types/messages/alternation.d.ts +1 -1
  618. package/dist/types/messages/anthropicToolCache.d.ts +2 -2
  619. package/dist/types/messages/assistantPhase.d.ts +3 -3
  620. package/dist/types/messages/budget.d.ts +1 -1
  621. package/dist/types/messages/cache.d.ts +1 -1
  622. package/dist/types/messages/contextPruning.d.ts +2 -2
  623. package/dist/types/messages/core.d.ts +2 -2
  624. package/dist/types/messages/format.d.ts +2 -2
  625. package/dist/types/messages/ids.d.ts +2 -2
  626. package/dist/types/messages/injected.d.ts +1 -1
  627. package/dist/types/messages/langchain.d.ts +1 -1
  628. package/dist/types/messages/prune.d.ts +3 -3
  629. package/dist/types/openai/index.d.ts +1 -1
  630. package/dist/types/prompts/activityLabel.d.ts +2 -2
  631. package/dist/types/responses/index.d.ts +1 -1
  632. package/dist/types/run.d.ts +3 -3
  633. package/dist/types/session/handlers.d.ts +1 -1
  634. package/dist/types/session/types.d.ts +1 -1
  635. package/dist/types/stream.d.ts +4 -4
  636. package/dist/types/summarization/index.d.ts +1 -1
  637. package/dist/types/summarization/node.d.ts +6 -6
  638. package/dist/types/test/mockTools.d.ts +1 -1
  639. package/dist/types/tools/BashExecutor.d.ts +2 -2
  640. package/dist/types/tools/BashProgrammaticToolCalling.d.ts +2 -2
  641. package/dist/types/tools/CodeExecutor.d.ts +3 -3
  642. package/dist/types/tools/CodeSessionFileSummary.d.ts +1 -1
  643. package/dist/types/tools/ProgrammaticToolCalling.d.ts +2 -2
  644. package/dist/types/tools/ReadFile.d.ts +1 -1
  645. package/dist/types/tools/SkillTool.d.ts +1 -1
  646. package/dist/types/tools/SubagentTool.d.ts +3 -3
  647. package/dist/types/tools/ToolNode.d.ts +5 -5
  648. package/dist/types/tools/ToolSearch.d.ts +2 -2
  649. package/dist/types/tools/cloudflare/CloudflareBridgeRuntime.d.ts +1 -1
  650. package/dist/types/tools/cloudflare/CloudflareProgrammaticToolCalling.d.ts +1 -1
  651. package/dist/types/tools/cloudflare/CloudflareSandboxExecutionEngine.d.ts +2 -2
  652. package/dist/types/tools/cloudflare/CloudflareSandboxTools.d.ts +1 -1
  653. package/dist/types/tools/eagerEventExecution.d.ts +1 -1
  654. package/dist/types/tools/handlers.d.ts +3 -3
  655. package/dist/types/tools/intentArg.d.ts +1 -1
  656. package/dist/types/tools/local/CompileCheckTool.d.ts +2 -2
  657. package/dist/types/tools/local/FileCheckpointer.d.ts +1 -1
  658. package/dist/types/tools/local/LocalCodingTools.d.ts +2 -2
  659. package/dist/types/tools/local/LocalExecutionEngine.d.ts +1 -1
  660. package/dist/types/tools/local/LocalExecutionTools.d.ts +1 -1
  661. package/dist/types/tools/local/LocalProgrammaticToolCalling.d.ts +1 -1
  662. package/dist/types/tools/local/bashAst.d.ts +1 -1
  663. package/dist/types/tools/local/resolveLocalExecutionTools.d.ts +1 -1
  664. package/dist/types/tools/local/syntaxCheck.d.ts +1 -1
  665. package/dist/types/tools/ptcTimeout.d.ts +1 -1
  666. package/dist/types/tools/schema.d.ts +1 -1
  667. package/dist/types/tools/search/anthropic.d.ts +1 -1
  668. package/dist/types/tools/skillCatalog.d.ts +1 -1
  669. package/dist/types/tools/subagent/SubagentExecutor.d.ts +5 -5
  670. package/dist/types/tools/subagent/SubagentReplay.d.ts +3 -3
  671. package/dist/types/tools/subagent/childGraphConfig.d.ts +2 -2
  672. package/dist/types/types/activityLabel.d.ts +3 -3
  673. package/dist/types/types/graph.d.ts +7 -7
  674. package/dist/types/types/llm.d.ts +9 -9
  675. package/dist/types/types/run.d.ts +7 -7
  676. package/dist/types/types/stream.d.ts +5 -5
  677. package/dist/types/types/summarize.d.ts +2 -2
  678. package/dist/types/types/tools.d.ts +5 -5
  679. package/dist/types/utils/__tests__/fixtures/contextOverflowSignatures.d.ts +1 -1
  680. package/dist/types/utils/errors.d.ts +1 -1
  681. package/dist/types/utils/events.d.ts +1 -1
  682. package/dist/types/utils/handlers.d.ts +3 -3
  683. package/dist/types/utils/llm.d.ts +1 -1
  684. package/dist/types/utils/llmConfig.d.ts +1 -1
  685. package/dist/types/utils/title.d.ts +1 -1
  686. package/package.json +10 -3
  687. package/src/__tests__/stream.eagerArgsDivergence.test.ts +0 -911
  688. package/src/__tests__/stream.eagerEventExecution.test.ts +0 -5046
  689. package/src/__tests__/stream.streamLimits.test.ts +0 -1982
  690. package/src/agents/__tests__/AgentContext.anthropic.live.test.ts +0 -448
  691. package/src/agents/__tests__/AgentContext.bedrock.live.test.ts +0 -655
  692. package/src/agents/__tests__/AgentContext.openrouter.live.test.ts +0 -128
  693. package/src/agents/__tests__/AgentContext.overflow.test.ts +0 -205
  694. package/src/agents/__tests__/AgentContext.test.ts +0 -2425
  695. package/src/agents/__tests__/projection.test.ts +0 -73
  696. package/src/agents/__tests__/promptCacheLiveHelpers.ts +0 -175
  697. package/src/aggregator.test.ts +0 -1214
  698. package/src/graphs/__tests__/Graph.breakerLifecycle.test.ts +0 -273
  699. package/src/graphs/__tests__/Graph.closeRunStep.test.ts +0 -385
  700. package/src/graphs/__tests__/Graph.contextOverflow.test.ts +0 -1766
  701. package/src/graphs/__tests__/Graph.preemptSignal.test.ts +0 -126
  702. package/src/graphs/__tests__/Graph.reasoning.test.ts +0 -1717
  703. package/src/graphs/__tests__/Graph.subagentResumeState.test.ts +0 -80
  704. package/src/graphs/__tests__/MultiAgentGraph.test.ts +0 -177
  705. package/src/graphs/__tests__/composition.smoke.test.ts +0 -509
  706. package/src/graphs/__tests__/createGraph.test.ts +0 -206
  707. package/src/hooks/__tests__/HookRegistry.test.ts +0 -334
  708. package/src/hooks/__tests__/compactHooks.test.ts +0 -250
  709. package/src/hooks/__tests__/createToolPolicyHook.test.ts +0 -268
  710. package/src/hooks/__tests__/createWorkspacePolicyHook.test.ts +0 -405
  711. package/src/hooks/__tests__/executeHooks.test.ts +0 -1294
  712. package/src/hooks/__tests__/integration.test.ts +0 -337
  713. package/src/hooks/__tests__/matchers.test.ts +0 -238
  714. package/src/hooks/__tests__/preemptBoundary.test.ts +0 -152
  715. package/src/hooks/__tests__/toolHooks.test.ts +0 -669
  716. package/src/llm/__tests__/contextOverflowRecovery.test.ts +0 -401
  717. package/src/llm/__tests__/fallbackOverflow.test.ts +0 -287
  718. package/src/llm/anthropic/Jacob_Lee_Resume_2023.pdf +0 -0
  719. package/src/llm/anthropic/inherited-content-utils.spec.ts +0 -249
  720. package/src/llm/anthropic/inherited-stream-events.spec.ts +0 -1259
  721. package/src/llm/anthropic/inherited-strict.spec.ts +0 -302
  722. package/src/llm/anthropic/llm.spec.ts +0 -3394
  723. package/src/llm/anthropic/utils/cross-provider-reasoning.test.ts +0 -383
  724. package/src/llm/anthropic/utils/cross-provider-server-tools.test.ts +0 -110
  725. package/src/llm/anthropic/utils/server-tool-inputs.test.ts +0 -508
  726. package/src/llm/anthropic/utils/streaming-tool-input.test.ts +0 -361
  727. package/src/llm/anthropic/utils/stripPrefillCache.test.ts +0 -111
  728. package/src/llm/anthropic/utils/tool-id-normalization.test.ts +0 -287
  729. package/src/llm/bedrock/inherited-cache.spec.ts +0 -144
  730. package/src/llm/bedrock/inherited.spec.ts +0 -724
  731. package/src/llm/bedrock/llm.spec.ts +0 -1533
  732. package/src/llm/bedrock/streamSealDispatch.test.ts +0 -331
  733. package/src/llm/bedrock/toolCache.test.ts +0 -194
  734. package/src/llm/bedrock/utils/cross-provider-reasoning.test.ts +0 -131
  735. package/src/llm/bedrock/utils/cross-provider-server-tools.test.ts +0 -122
  736. package/src/llm/bedrock/utils/message_inputs.test.ts +0 -650
  737. package/src/llm/bedrock/utils/message_outputs.test.ts +0 -85
  738. package/src/llm/bedrock/utils/toolResultCachePoint.test.ts +0 -118
  739. package/src/llm/custom-chat-models.smoke.test.ts +0 -1966
  740. package/src/llm/google/data/gettysburg10.wav +0 -0
  741. package/src/llm/google/data/hotdog.jpg +0 -0
  742. package/src/llm/google/inherited-stream-events.spec.ts +0 -350
  743. package/src/llm/google/llm.spec.ts +0 -1388
  744. package/src/llm/google/streamSmoothing.test.ts +0 -121
  745. package/src/llm/google/utils/common.test.ts +0 -196
  746. package/src/llm/invoke.alternation.test.ts +0 -87
  747. package/src/llm/invoke.handoffCue.test.ts +0 -112
  748. package/src/llm/invoke.streamLimits.test.ts +0 -142
  749. package/src/llm/invoke.test.ts +0 -1198
  750. package/src/llm/mistral/streamSmoothing.test.ts +0 -97
  751. package/src/llm/openai/cacheWriteTokens.test.ts +0 -112
  752. package/src/llm/openai/contentBlocks.test.ts +0 -381
  753. package/src/llm/openai/deepseek.test.ts +0 -747
  754. package/src/llm/openai/inherited-deepseek.spec.ts +0 -347
  755. package/src/llm/openai/inherited-xai.spec.ts +0 -416
  756. package/src/llm/openai/llm.spec.ts +0 -1774
  757. package/src/llm/openai/managedRequests.test.ts +0 -182
  758. package/src/llm/openai/sequentialToolCallSeals.test.ts +0 -199
  759. package/src/llm/openai/streamMetadata.spec.ts +0 -86
  760. package/src/llm/openai/streamMetadataDedup.spec.ts +0 -166
  761. package/src/llm/openai/utils/isReasoningModel.test.ts +0 -90
  762. package/src/llm/openai/utils/messages.test.ts +0 -488
  763. package/src/llm/openrouter/reasoning.test.ts +0 -561
  764. package/src/llm/openrouter/toolCache.test.ts +0 -134
  765. package/src/llm/preempt.test.ts +0 -323
  766. package/src/llm/stream/chunkAdapters.test.ts +0 -202
  767. package/src/llm/stream/reassembly.test.ts +0 -241
  768. package/src/llm/stream/smoother.bench.test.ts +0 -155
  769. package/src/llm/stream/smoother.test.ts +0 -519
  770. package/src/llm/streamLimits.test.ts +0 -450
  771. package/src/llm/truncation.test.ts +0 -242
  772. package/src/llm/vertexai/fixThoughtSignatures.test.ts +0 -154
  773. package/src/llm/vertexai/inherited-stream-events.spec.ts +0 -271
  774. package/src/llm/vertexai/llm.spec.ts +0 -159
  775. package/src/llm/vertexai/repairUsageMetadata.test.ts +0 -54
  776. package/src/llm/vertexai/sealStreamedToolCalls.test.ts +0 -88
  777. package/src/llm/vertexai/streamSealDispatch.test.ts +0 -148
  778. package/src/llm/vertexai/streamSmoothing.test.ts +0 -109
  779. package/src/messages/__tests__/anthropicToolCache.test.ts +0 -339
  780. package/src/messages/__tests__/observationMasking.test.ts +0 -312
  781. package/src/messages/__tests__/recency.test.ts +0 -267
  782. package/src/messages/__tests__/tools.test.ts +0 -473
  783. package/src/messages/alternation.test.ts +0 -212
  784. package/src/messages/assistantPhase.test.ts +0 -75
  785. package/src/messages/cache.tail.test.ts +0 -533
  786. package/src/messages/cache.test.ts +0 -2166
  787. package/src/messages/content.test.ts +0 -362
  788. package/src/messages/contextPruning.test.ts +0 -184
  789. package/src/messages/ensureThinkingBlock.test.ts +0 -1427
  790. package/src/messages/foldToollessToolBlocks.test.ts +0 -596
  791. package/src/messages/formatAgentMessages.reducer.test.ts +0 -162
  792. package/src/messages/formatAgentMessages.skills.test.ts +0 -513
  793. package/src/messages/formatAgentMessages.steer.test.ts +0 -598
  794. package/src/messages/formatAgentMessages.test.ts +0 -8111
  795. package/src/messages/formatAgentMessages.tools.test.ts +0 -522
  796. package/src/messages/formatMessage.test.ts +0 -693
  797. package/src/messages/handoffCue.test.ts +0 -96
  798. package/src/messages/injected.test.ts +0 -107
  799. package/src/messages/labelContentByAgent.test.ts +0 -962
  800. package/src/messages/reducer.spec.ts +0 -32
  801. package/src/messages/shiftIndexTokenCountMap.test.ts +0 -81
  802. package/src/messages/tailCacheConversion.test.ts +0 -161
  803. package/src/openai/__tests__/openai.test.ts +0 -337
  804. package/src/responses/__tests__/responses.test.ts +0 -652
  805. package/src/scripts/abort.ts +0 -157
  806. package/src/scripts/activity-labels/captured.json +0 -56
  807. package/src/scripts/activity-labels/checks.cjs +0 -205
  808. package/src/scripts/activity-labels/corpus.cjs +0 -473
  809. package/src/scripts/activity-labels/report.cjs +0 -203
  810. package/src/scripts/activity-labels/rescore.cjs +0 -102
  811. package/src/scripts/activity-labels/run.ts +0 -705
  812. package/src/scripts/activity-labels/variants.ts +0 -71
  813. package/src/scripts/ant_web_search.ts +0 -159
  814. package/src/scripts/ant_web_search_edge_case.ts +0 -163
  815. package/src/scripts/ant_web_search_error_edge_case.ts +0 -149
  816. package/src/scripts/args.ts +0 -48
  817. package/src/scripts/bedrock-cache-debug.ts +0 -250
  818. package/src/scripts/bedrock-content-aggregation-test.ts +0 -266
  819. package/src/scripts/bedrock-merge-test.ts +0 -107
  820. package/src/scripts/bedrock-parallel-tools-test.ts +0 -204
  821. package/src/scripts/bench-prompt-cache.ts +0 -479
  822. package/src/scripts/caching.ts +0 -132
  823. package/src/scripts/cli.ts +0 -172
  824. package/src/scripts/cli2.ts +0 -133
  825. package/src/scripts/cli3.ts +0 -184
  826. package/src/scripts/cli4.ts +0 -191
  827. package/src/scripts/cli5.ts +0 -191
  828. package/src/scripts/code_exec.ts +0 -214
  829. package/src/scripts/code_exec_files.ts +0 -237
  830. package/src/scripts/code_exec_multi_session.ts +0 -237
  831. package/src/scripts/code_exec_ptc.ts +0 -335
  832. package/src/scripts/code_exec_session.ts +0 -283
  833. package/src/scripts/code_exec_simple.ts +0 -148
  834. package/src/scripts/compare_pi_vs_ours.ts +0 -1259
  835. package/src/scripts/content.ts +0 -139
  836. package/src/scripts/context-overflow-probe.ts +0 -997
  837. package/src/scripts/empty_input.ts +0 -137
  838. package/src/scripts/handoff-test.ts +0 -134
  839. package/src/scripts/local_engine.ts +0 -166
  840. package/src/scripts/local_engine_checkpointer.ts +0 -205
  841. package/src/scripts/local_engine_compile.ts +0 -263
  842. package/src/scripts/local_engine_hooks.ts +0 -226
  843. package/src/scripts/local_engine_image.ts +0 -201
  844. package/src/scripts/local_engine_ptc.ts +0 -151
  845. package/src/scripts/local_engine_workspace.ts +0 -258
  846. package/src/scripts/memory.ts +0 -107
  847. package/src/scripts/multi-agent-chain.ts +0 -332
  848. package/src/scripts/multi-agent-conditional.ts +0 -222
  849. package/src/scripts/multi-agent-document-review-chain.ts +0 -198
  850. package/src/scripts/multi-agent-hybrid-flow.ts +0 -311
  851. package/src/scripts/multi-agent-parallel-start.ts +0 -265
  852. package/src/scripts/multi-agent-parallel.ts +0 -395
  853. package/src/scripts/multi-agent-sequence.ts +0 -217
  854. package/src/scripts/multi-agent-subagent.ts +0 -246
  855. package/src/scripts/multi-agent-supervisor.ts +0 -366
  856. package/src/scripts/multi-agent-test.ts +0 -187
  857. package/src/scripts/openrouter_prompt_cache_live.ts +0 -310
  858. package/src/scripts/parallel-asymmetric-tools-test.ts +0 -275
  859. package/src/scripts/parallel-full-metadata-test.ts +0 -241
  860. package/src/scripts/parallel-tools-test.ts +0 -341
  861. package/src/scripts/preempt-probe.ts +0 -330
  862. package/src/scripts/preempt-scenarios.ts +0 -388
  863. package/src/scripts/programmatic_exec.ts +0 -387
  864. package/src/scripts/programmatic_exec_agent.ts +0 -232
  865. package/src/scripts/search.ts +0 -147
  866. package/src/scripts/sequential-full-metadata-test.ts +0 -198
  867. package/src/scripts/session_live.ts +0 -548
  868. package/src/scripts/simple.ts +0 -226
  869. package/src/scripts/single-agent-metadata-test.ts +0 -196
  870. package/src/scripts/stream.ts +0 -141
  871. package/src/scripts/subagent-configurable-inheritance.ts +0 -252
  872. package/src/scripts/subagent-event-driven-debug.ts +0 -190
  873. package/src/scripts/subagent-tools-debug.ts +0 -160
  874. package/src/scripts/subagent-usage-sink.ts +0 -176
  875. package/src/scripts/summarization-recency.ts +0 -462
  876. package/src/scripts/test-custom-prompt-key.ts +0 -145
  877. package/src/scripts/test-handoff-input.ts +0 -170
  878. package/src/scripts/test-handoff-preamble.ts +0 -278
  879. package/src/scripts/test-handoff-steering.ts +0 -430
  880. package/src/scripts/test-multi-agent-list-handoff.ts +0 -418
  881. package/src/scripts/test-parallel-agent-labeling.ts +0 -327
  882. package/src/scripts/test-parallel-handoffs.ts +0 -292
  883. package/src/scripts/test-thinking-handoff-bedrock.ts +0 -154
  884. package/src/scripts/test-thinking-handoff.ts +0 -156
  885. package/src/scripts/test-thinking-to-thinking-handoff-bedrock.ts +0 -166
  886. package/src/scripts/test-tool-before-handoff-role-order.ts +0 -276
  887. package/src/scripts/test-tools-before-handoff.ts +0 -222
  888. package/src/scripts/test_code_api.ts +0 -354
  889. package/src/scripts/thinking-bedrock.ts +0 -160
  890. package/src/scripts/thinking-vertexai.ts +0 -168
  891. package/src/scripts/thinking.ts +0 -172
  892. package/src/scripts/tool_search.ts +0 -153
  893. package/src/scripts/tools.ts +0 -163
  894. package/src/session/__tests__/JsonlSessionStore.test.ts +0 -1463
  895. package/src/session/__tests__/handlers.test.ts +0 -161
  896. package/src/specs/activity-label-observability.live.test.ts +0 -262
  897. package/src/specs/activity-label-observability.test.ts +0 -167
  898. package/src/specs/activity-label-prompt.test.ts +0 -359
  899. package/src/specs/activity-label-trace-seed.test.ts +0 -47
  900. package/src/specs/activity-phase-label.test.ts +0 -306
  901. package/src/specs/agent-handoffs.live.test.ts +0 -140
  902. package/src/specs/agent-handoffs.test.ts +0 -2465
  903. package/src/specs/anthropic.simple.test.ts +0 -453
  904. package/src/specs/ask-user-question-batch.test.ts +0 -289
  905. package/src/specs/ask-user-questions.live.test.ts +0 -185
  906. package/src/specs/ask-user-questions.test.ts +0 -293
  907. package/src/specs/azure.simple.test.ts +0 -502
  908. package/src/specs/bedrock-toolless.live.test.ts +0 -123
  909. package/src/specs/bedrock-truncation.live.test.ts +0 -191
  910. package/src/specs/cache.simple.test.ts +0 -416
  911. package/src/specs/context-accuracy.live.test.ts +0 -409
  912. package/src/specs/context-overflow-recovery.live.test.ts +0 -213
  913. package/src/specs/context-usage-event.test.ts +0 -117
  914. package/src/specs/context-usage.live.test.ts +0 -297
  915. package/src/specs/custom-event-await.test.ts +0 -304
  916. package/src/specs/deepseek.simple.test.ts +0 -290
  917. package/src/specs/deterministic-trace-id.test.ts +0 -43
  918. package/src/specs/discovered-tools.test.ts +0 -217
  919. package/src/specs/durability-checkpoint.integration.test.ts +0 -243
  920. package/src/specs/graph-subagent.live.test.ts +0 -242
  921. package/src/specs/graph-subagent.test.ts +0 -322
  922. package/src/specs/handoffCue.test.ts +0 -165
  923. package/src/specs/langfuse-callbacks.test.ts +0 -1578
  924. package/src/specs/langfuse-config.test.ts +0 -247
  925. package/src/specs/langfuse-instrumentation.test.ts +0 -393
  926. package/src/specs/langfuse-metadata.test.ts +0 -245
  927. package/src/specs/langfuse-routing.integration.test.ts +0 -844
  928. package/src/specs/langfuse-runtime-context.test.ts +0 -92
  929. package/src/specs/langfuse-span-registry.test.ts +0 -87
  930. package/src/specs/langfuse-tool-output-tracing.test.ts +0 -1858
  931. package/src/specs/langfuse-trace-shaping.test.ts +0 -591
  932. package/src/specs/moonshot.simple.test.ts +0 -367
  933. package/src/specs/multi-agent-summarization.test.ts +0 -396
  934. package/src/specs/openai.simple.test.ts +0 -315
  935. package/src/specs/openrouter.simple.test.ts +0 -275
  936. package/src/specs/preemptSeal.test.ts +0 -678
  937. package/src/specs/prune.test.ts +0 -3741
  938. package/src/specs/reasoning.test.ts +0 -201
  939. package/src/specs/run-step-timestamps.test.ts +0 -414
  940. package/src/specs/spec.utils.ts +0 -15
  941. package/src/specs/subagent.test.ts +0 -864
  942. package/src/specs/summarization-unit.test.ts +0 -973
  943. package/src/specs/summarization.test.ts +0 -3823
  944. package/src/specs/summarize-prune.test.ts +0 -376
  945. package/src/specs/thinking-handoff.test.ts +0 -621
  946. package/src/specs/thinking-prune.test.ts +0 -827
  947. package/src/specs/token-accounting-e2e.test.ts +0 -1034
  948. package/src/specs/token-accounting-pipeline.test.ts +0 -1008
  949. package/src/specs/token-distribution-edge-case.test.ts +0 -315
  950. package/src/specs/token-memoization.test.ts +0 -40
  951. package/src/specs/tokens.test.ts +0 -1000
  952. package/src/specs/tool-error-resume.test.ts +0 -194
  953. package/src/specs/tool-error.test.ts +0 -198
  954. package/src/specs/vllm-reasoning-toolcalls.test.ts +0 -340
  955. package/src/stream.dispatch.test.ts +0 -63
  956. package/src/stream.test.ts +0 -144
  957. package/src/summarization/__tests__/aggregator.test.ts +0 -236
  958. package/src/summarization/__tests__/node.test.ts +0 -1996
  959. package/src/summarization/__tests__/trigger.test.ts +0 -149
  960. package/src/summarization/chunkHandler.test.ts +0 -196
  961. package/src/test/mockTools.ts +0 -386
  962. package/src/tools/Calculator.test.ts +0 -278
  963. package/src/tools/__tests__/BashExecutor.test.ts +0 -108
  964. package/src/tools/__tests__/CloudflareSandboxExecution.test.ts +0 -939
  965. package/src/tools/__tests__/CodeApiAuthHeaders.test.ts +0 -858
  966. package/src/tools/__tests__/CodeExecutor.stateful.test.ts +0 -124
  967. package/src/tools/__tests__/LocalExecutionRoots.test.ts +0 -8
  968. package/src/tools/__tests__/LocalExecutionTools.test.ts +0 -2733
  969. package/src/tools/__tests__/ProgrammaticToolCalling.integration.test.ts +0 -318
  970. package/src/tools/__tests__/ProgrammaticToolCalling.test.ts +0 -1557
  971. package/src/tools/__tests__/ReadFile.test.ts +0 -44
  972. package/src/tools/__tests__/SkillTool.test.ts +0 -442
  973. package/src/tools/__tests__/SubagentExecutor.test.ts +0 -3728
  974. package/src/tools/__tests__/SubagentReplay.test.ts +0 -329
  975. package/src/tools/__tests__/SubagentTool.test.ts +0 -149
  976. package/src/tools/__tests__/ToolNode.breakerSignal.test.ts +0 -595
  977. package/src/tools/__tests__/ToolNode.eagerEventExecution.test.ts +0 -1191
  978. package/src/tools/__tests__/ToolNode.invalidToolCalls.test.ts +0 -757
  979. package/src/tools/__tests__/ToolNode.langfuse.test.ts +0 -57
  980. package/src/tools/__tests__/ToolNode.onResultCompletion.test.ts +0 -736
  981. package/src/tools/__tests__/ToolNode.outputReferences.test.ts +0 -1710
  982. package/src/tools/__tests__/ToolNode.runtimeState.test.ts +0 -120
  983. package/src/tools/__tests__/ToolNode.session.test.ts +0 -1352
  984. package/src/tools/__tests__/ToolNode.streamLimits.test.ts +0 -69
  985. package/src/tools/__tests__/ToolSearch.integration.test.ts +0 -161
  986. package/src/tools/__tests__/ToolSearch.test.ts +0 -1227
  987. package/src/tools/__tests__/annotateMessagesForLLM.test.ts +0 -561
  988. package/src/tools/__tests__/directToolHITLResumeScope.test.ts +0 -980
  989. package/src/tools/__tests__/directToolHooks.test.ts +0 -700
  990. package/src/tools/__tests__/eagerEventExecution.session.test.ts +0 -92
  991. package/src/tools/__tests__/handlers.test.ts +0 -997
  992. package/src/tools/__tests__/hitl.test.ts +0 -4663
  993. package/src/tools/__tests__/intentArg.test.ts +0 -357
  994. package/src/tools/__tests__/intentCoverage.test.ts +0 -139
  995. package/src/tools/__tests__/localToolNames.test.ts +0 -75
  996. package/src/tools/__tests__/skillCatalog.test.ts +0 -161
  997. package/src/tools/__tests__/subagentHooks.test.ts +0 -1651
  998. package/src/tools/__tests__/toolOutputReferences.test.ts +0 -515
  999. package/src/tools/__tests__/workspaceSeam.test.ts +0 -147
  1000. package/src/tools/local/__tests__/FileCheckpointer.test.ts +0 -162
  1001. package/src/tools/local/__tests__/editStrategies.test.ts +0 -134
  1002. package/src/tools/search/content.test.ts +0 -173
  1003. package/src/tools/search/crw.test.ts +0 -836
  1004. package/src/tools/search/format.test.ts +0 -242
  1005. package/src/tools/search/http-agent.test.ts +0 -133
  1006. package/src/tools/search/jina-reranker.test.ts +0 -306
  1007. package/src/tools/search/keenable-scraper.test.ts +0 -153
  1008. package/src/tools/search/keenable.test.ts +0 -183
  1009. package/src/tools/search/outcome.test.ts +0 -90
  1010. package/src/tools/search/output.md +0 -2775
  1011. package/src/tools/search/rag-api-reranker.test.ts +0 -891
  1012. package/src/tools/search/source-processing.test.ts +0 -516
  1013. package/src/tools/search/tavily.test.ts +0 -965
  1014. package/src/tools/search/test.html +0 -884
  1015. package/src/tools/search/test.md +0 -643
  1016. package/src/tools/subagent/__tests__/SubagentExecutionRegistry.test.ts +0 -637
  1017. package/src/tools/subagent/__tests__/SubagentExecutor.lazy.test.ts +0 -3054
  1018. package/src/tools/subagent/__tests__/childGraphConfig.test.ts +0 -521
  1019. package/src/utils/__tests__/apportion.test.ts +0 -32
  1020. package/src/utils/__tests__/errors.test.ts +0 -270
  1021. package/src/utils/__tests__/fixtures/contextOverflowSignatures.ts +0 -336
  1022. package/src/utils/__tests__/redactSecrets.test.ts +0 -56
  1023. package/src/utils/__tests__/truncation.test.ts +0 -66
  1024. package/src/utils/llm.test.ts +0 -18
  1025. package/src/utils/proxy.test.ts +0 -176
  1026. package/src/utils/toolContent.test.ts +0 -1432
@@ -1,68 +1,16 @@
1
1
  //#region src/tools/intentArg.ts
2
- /** Argument carrying the model-authored label for a tool call. */
3
2
  const INTENT_ARG = "intent";
4
- /**
5
- * Opening words of {@link INTENT_DESCRIPTION}, and the discriminator that
6
- * tells the injected LABEL apart from a tool's own business parameter that
7
- * merely shares the name `intent`.
8
- *
9
- * Exported because host applications reimplement the same strip/sanitize
10
- * passes and would otherwise duplicate this as a string literal: if the two
11
- * copies drift, the host silently stops recognizing SDK-native labels and
12
- * fails OPEN (labels stay in schemas, opt-outs stop working) with no error.
13
- * Any edit to the description must preserve this prefix verbatim.
14
- */
15
3
  const INTENT_LABEL_MARKER = "ALWAYS write this field FIRST";
16
- /**
17
- * Model-facing instruction for the injected `intent` property.
18
- *
19
- * Deliberately terse — it is repeated on every opted-in tool schema, on every
20
- * request, so each sentence is paid for many times over. What remains is
21
- * load-bearing: first-position placement (the entire streaming mechanism),
22
- * the one-sentence present-progressive form, who reads it, and the sibling
23
- * rule, without which models emit identical labels for parallel calls to one
24
- * tool and defeat the feature's headline case.
25
- */
26
4
  const INTENT_DESCRIPTION = `${INTENT_LABEL_MARKER}, before any other argument. One present-progressive sentence saying what THIS call is about to do: "Searching for OAuth handling in the callback router". Shown to the user as this call's live status. Never name the tool. Sibling calls to one tool must differ.`;
27
- /**
28
- * Canonical (frozen) shape of the injected property. Always embed a COPY
29
- * (`{ ...INTENT_PROPERTY }`): LangChain's JSON-schema validator stamps a
30
- * `__absolute_uri__` marker onto every subschema it dereferences, which
31
- * throws on a frozen object — and a single shared instance would be stamped
32
- * with one schema's URI while embedded in many.
33
- */
34
5
  const INTENT_PROPERTY = Object.freeze({
35
6
  type: "string",
36
7
  description: INTENT_DESCRIPTION
37
8
  });
38
- /**
39
- * Discriminates the intent LABEL property from a tool's own business
40
- * parameter that merely shares the name: the label contract always opens
41
- * with the same instruction. Removal/sanitize passes must never strip a
42
- * parameter the tool actually needs.
43
- */
44
9
  function isIntentLabelProperty(property) {
45
10
  if (property == null || typeof property !== "object") return false;
46
11
  const record = property;
47
12
  return record.type === "string" && typeof record.description === "string" && record.description.startsWith("ALWAYS write this field FIRST");
48
13
  }
49
- /**
50
- * Returns a copy of `parameters` without the injected intent LABEL — the
51
- * opt-out for consumers that render no status label and should not pay for
52
- * the property.
53
- *
54
- * The SDK's native schemas carry the label unconditionally, so without this
55
- * an embedder has no lever at all: `withIntent` is applied at module scope.
56
- * Marker-guarded, so a tool's own business parameter named `intent` is never
57
- * removed. Returns the input unchanged when there is nothing to strip.
58
- *
59
- * `required` is pruned alongside the property: a schema that lists `intent`
60
- * as required (strict-mode normalization does exactly that, since OpenAI
61
- * strict function schemas require every property to appear in `required`)
62
- * would otherwise be left naming a property it no longer declares, which is
63
- * invalid JSON Schema and gets rejected by the provider instead of quietly
64
- * opting out.
65
- */
66
14
  function withoutIntent(parameters) {
67
15
  const props = parameters?.properties;
68
16
  if (parameters == null || props == null || !isIntentLabelProperty(props["intent"])) return parameters;
@@ -78,13 +26,6 @@ function withoutIntent(parameters) {
78
26
  }
79
27
  return next;
80
28
  }
81
- /**
82
- * Returns a copy of the parameters schema with `intent` prepended as the
83
- * FIRST property (object key order is insertion order and every provider
84
- * serializer preserves it — first key in the schema means first key in the
85
- * streamed input). Never mutates the input; no-op when the schema already
86
- * declares `intent`. The property is not added to `required`.
87
- */
88
29
  function withIntent(parameters) {
89
30
  const existingProps = parameters?.properties ?? {};
90
31
  if ("intent" in existingProps) return parameters;
@@ -97,10 +38,6 @@ function withIntent(parameters) {
97
38
  }
98
39
  };
99
40
  }
100
- /**
101
- * Coerces tool-call args to an object, parsing a stringified JSON object
102
- * (some providers deliver args as a string). Returns undefined otherwise.
103
- */
104
41
  function coerceArgsObject(args) {
105
42
  if (typeof args === "object" && args !== null && !Array.isArray(args)) return args;
106
43
  if (typeof args === "string" && args.trim().startsWith("{")) try {
@@ -110,68 +47,26 @@ function coerceArgsObject(args) {
110
47
  return;
111
48
  }
112
49
  }
113
- /**
114
- * Reads the model-authored intent from tool-call args (handles stringified
115
- * args). Returns undefined when absent, empty, or not a string.
116
- */
117
50
  function readIntent(args) {
118
51
  const value = coerceArgsObject(args)?.[INTENT_ARG];
119
52
  if (typeof value !== "string") return;
120
53
  const trimmed = value.trim();
121
54
  return trimmed === "" ? void 0 : trimmed;
122
55
  }
123
- /**
124
- * Returns the args without the `intent` key so downstream consumers that did
125
- * not declare it never receive it. Parses stringified JSON object args;
126
- * returns the value unchanged when the key is absent.
127
- */
128
56
  function stripIntent(args) {
129
57
  const obj = coerceArgsObject(args);
130
58
  if (!obj || !("intent" in obj)) return args;
131
59
  const { [INTENT_ARG]: _omit, ...rest } = obj;
132
60
  return rest;
133
61
  }
134
- /**
135
- * Resolves the settled label for a call from its model-authored `intent` and
136
- * the tool's result fields, in precedence order:
137
- *
138
- * 1. `outcome` — full replacement authored by the tool.
139
- * 2. `outcome_patch` — first occurrence of `from` in the intent replaced
140
- * with `to` (case-sensitive); no-op when `from` is absent or empty.
141
- * 3. Otherwise the intent is returned UNCHANGED.
142
- *
143
- * There is deliberately no mechanical present-progressive→past-tense rewrite.
144
- * Such a transform can only be a closed list of English verbs, which makes it
145
- * wrong in three ways at once: it never fires for the non-English labels this
146
- * feature expects (the model answers in the user's language), it fires for
147
- * some sibling calls and not others inside one group — "Searched…" beside
148
- * "Recording…" — and it quietly enumerates a vocabulary in a feature whose
149
- * premise is that the sentence is free-form. Completion is conveyed by UI
150
- * state (the shimmer stopping, the icon settling), which is language-neutral
151
- * and always consistent; a tool that wants past tense says so explicitly via
152
- * `outcome` or `outcome_patch`.
153
- *
154
- * Returns undefined when there is neither an intent nor an outcome, so
155
- * callers fall back to their default label. Pure and dependency-free — host
156
- * UIs needing identical logic can import or mirror it.
157
- */
158
62
  function applyOutcome(intent, result) {
159
63
  const outcome = result?.outcome;
160
64
  if (typeof outcome === "string" && outcome.trim() !== "") return outcome;
161
65
  if (intent == null || intent === "") return;
162
66
  const patch = result?.outcome_patch;
163
- if (patch != null && patch.from !== "" && intent.includes(patch.from))
164
- /** Replacement callback keeps `to` verbatim — a direct string second
165
- * argument would interpret `$&`/`$'`-style tokens in tool-authored
166
- * text (e.g. labels derived from shell syntax). */
167
- return intent.replace(patch.from, () => patch.to);
67
+ if (patch != null && patch.from !== "" && intent.includes(patch.from)) return intent.replace(patch.from, () => patch.to);
168
68
  return intent;
169
69
  }
170
- /**
171
- * Hard cap on an emitted outcome label. The label is a single progress line
172
- * in UI chrome; a tool that derives it from data (or a malformed patch)
173
- * must not be able to inflate completion events or persisted parts.
174
- */
175
70
  const MAX_OUTCOME_CHARS = 256;
176
71
  function boundOutcomeLabel(label) {
177
72
  if (label == null) return;
@@ -180,20 +75,6 @@ function boundOutcomeLabel(label) {
180
75
  if (singleLine.length <= MAX_OUTCOME_CHARS) return singleLine;
181
76
  return `${singleLine.slice(0, MAX_OUTCOME_CHARS - 1)}…`;
182
77
  }
183
- /**
184
- * Resolves the settled label to emit on a completion event: only when the
185
- * tool actually authored `outcome`/`outcome_patch` fields. Returns undefined
186
- * otherwise, so the wire never carries a label the host already has — a bare
187
- * intent needs no settled form, because it is displayed unchanged and the UI
188
- * conveys completion through its own state. Hosts must NOT rewrite it (see
189
- * {@link applyOutcome} for why a tense transform is deliberately absent). The
190
- * result is collapsed to a bounded single line before emission.
191
- *
192
- * For failed calls (`isError`), only tool-AUTHORED text may label the call:
193
- * an explicit `outcome`, or a patch whose `from` actually matches the intent.
194
- * An unmatched patch resolves to undefined rather than silently reusing the
195
- * in-flight intent, so a failure is never labelled as though it succeeded.
196
- */
197
78
  function resolveToolOutcome(args, fields, options) {
198
79
  if (fields == null || fields.outcome == null && fields.outcome_patch == null) return;
199
80
  if (options?.isError !== true) return boundOutcomeLabel(applyOutcome(readIntent(args), fields));
@@ -203,22 +84,10 @@ function resolveToolOutcome(args, fields, options) {
203
84
  const patch = fields.outcome_patch;
204
85
  if (intent != null && patch != null && patch.from !== "" && intent.includes(patch.from)) return boundOutcomeLabel(intent.replace(patch.from, () => patch.to));
205
86
  }
206
- /**
207
- * Reads the outcome fields off a tool-execution result: the typed
208
- * `outcome`/`outcome_patch` fields when present, else the artifact channel
209
- * (see {@link readOutcomeFields}) — so a `content_and_artifact` tool authors
210
- * its label the same way on the direct and event-driven paths.
211
- */
212
87
  function outcomeFieldsFromResult(result) {
213
88
  if (result.outcome != null || result.outcome_patch != null) return result;
214
89
  return readOutcomeFields(result.artifact);
215
90
  }
216
- /**
217
- * Extracts validated `outcome`/`outcome_patch` fields from an arbitrary
218
- * value — the artifact channel through which an in-process
219
- * `content_and_artifact` tool authors its settled label. Returns undefined
220
- * when neither field is usable.
221
- */
222
91
  function readOutcomeFields(source) {
223
92
  if (source == null || typeof source !== "object" || Array.isArray(source)) return;
224
93
  const record = source;
@@ -1 +1 @@
1
- {"version":3,"file":"intentArg.mjs","names":[],"sources":["../../../src/tools/intentArg.ts"],"sourcesContent":["/**\n * @fileoverview Tool intent labels.\n *\n * Lets a tool declare, as the FIRST property of its input schema, an `intent`\n * string: one model-authored sentence stating what that specific call is about\n * to do (\"Searching for OAuth handling in the callback router\"). Because the\n * property is first, it is the first key providers stream in the tool-call\n * args, so a host UI can render it as the call's live status label before the\n * rest of the args exist. When the call settles, {@link applyOutcome} edits\n * the sentence in place into its outcome form — a tool-supplied replacement\n * (`outcome`) or a tool-supplied span edit (`outcome_patch`). Absent either,\n * the label is left exactly as the model wrote it: completion is a UI state\n * (the shimmer stopping, the icon settling), not a tense change.\n *\n * The arg is always optional (never listed in `required`): the same schemas\n * are callable from programmatic tool calling, where no UI renders a label\n * and forcing generated code to fabricate one would be pure cost. Tool bodies\n * must call {@link stripIntent} before using their args so no tool receives a\n * parameter it did not declare.\n */\n\nimport type { JsonSchemaType, OutcomePatch } from '@/types';\n\n/** Argument carrying the model-authored label for a tool call. */\nexport const INTENT_ARG = 'intent';\n\n/**\n * Opening words of {@link INTENT_DESCRIPTION}, and the discriminator that\n * tells the injected LABEL apart from a tool's own business parameter that\n * merely shares the name `intent`.\n *\n * Exported because host applications reimplement the same strip/sanitize\n * passes and would otherwise duplicate this as a string literal: if the two\n * copies drift, the host silently stops recognizing SDK-native labels and\n * fails OPEN (labels stay in schemas, opt-outs stop working) with no error.\n * Any edit to the description must preserve this prefix verbatim.\n */\nexport const INTENT_LABEL_MARKER = 'ALWAYS write this field FIRST';\n\n/**\n * Model-facing instruction for the injected `intent` property.\n *\n * Deliberately terse — it is repeated on every opted-in tool schema, on every\n * request, so each sentence is paid for many times over. What remains is\n * load-bearing: first-position placement (the entire streaming mechanism),\n * the one-sentence present-progressive form, who reads it, and the sibling\n * rule, without which models emit identical labels for parallel calls to one\n * tool and defeat the feature's headline case.\n */\nexport const INTENT_DESCRIPTION =\n `${INTENT_LABEL_MARKER}, before any other argument. One present-progressive ` +\n 'sentence saying what THIS call is about to do: \"Searching for OAuth handling ' +\n 'in the callback router\". Shown to the user as this call\\'s live status. ' +\n 'Never name the tool. Sibling calls to one tool must differ.';\n\n/**\n * Canonical (frozen) shape of the injected property. Always embed a COPY\n * (`{ ...INTENT_PROPERTY }`): LangChain's JSON-schema validator stamps a\n * `__absolute_uri__` marker onto every subschema it dereferences, which\n * throws on a frozen object — and a single shared instance would be stamped\n * with one schema's URI while embedded in many.\n */\nexport const INTENT_PROPERTY: JsonSchemaType = Object.freeze<JsonSchemaType>({\n type: 'string',\n description: INTENT_DESCRIPTION,\n});\n\n/**\n * Discriminates the intent LABEL property from a tool's own business\n * parameter that merely shares the name: the label contract always opens\n * with the same instruction. Removal/sanitize passes must never strip a\n * parameter the tool actually needs.\n */\nexport function isIntentLabelProperty(property: unknown): boolean {\n if (property == null || typeof property !== 'object') {\n return false;\n }\n const record = property as { type?: unknown; description?: unknown };\n return (\n record.type === 'string' &&\n typeof record.description === 'string' &&\n record.description.startsWith(INTENT_LABEL_MARKER)\n );\n}\n\n/**\n * Schema shape accepted by {@link withoutIntent}.\n *\n * `required` is widened to `readonly string[]` because the SDK's own native\n * schemas are declared `as const` — their `required` is a readonly tuple, and\n * a mutable `string[]` parameter would reject the very schemas this helper\n * exists for (TS2345), forcing embedders to cast to use the advertised API.\n */\nexport type IntentStrippableSchema = Omit<JsonSchemaType, 'required'> & {\n required?: readonly string[];\n};\n\n/**\n * Returns a copy of `parameters` without the injected intent LABEL — the\n * opt-out for consumers that render no status label and should not pay for\n * the property.\n *\n * The SDK's native schemas carry the label unconditionally, so without this\n * an embedder has no lever at all: `withIntent` is applied at module scope.\n * Marker-guarded, so a tool's own business parameter named `intent` is never\n * removed. Returns the input unchanged when there is nothing to strip.\n *\n * `required` is pruned alongside the property: a schema that lists `intent`\n * as required (strict-mode normalization does exactly that, since OpenAI\n * strict function schemas require every property to appear in `required`)\n * would otherwise be left naming a property it no longer declares, which is\n * invalid JSON Schema and gets rejected by the provider instead of quietly\n * opting out.\n */\nexport function withoutIntent(parameters?: IntentStrippableSchema): JsonSchemaType | undefined {\n const props = parameters?.properties;\n if (parameters == null || props == null || !isIntentLabelProperty(props[INTENT_ARG])) {\n return parameters as JsonSchemaType | undefined;\n }\n const { [INTENT_ARG]: _omit, ...rest } = props;\n const next: JsonSchemaType = {\n ...(parameters as JsonSchemaType),\n properties: rest,\n };\n if (parameters.required != null) {\n const required = parameters.required.filter((key) => key !== INTENT_ARG);\n if (required.length > 0) {\n next.required = required;\n } else {\n delete next.required;\n }\n }\n return next;\n}\n\n/**\n * Returns a copy of the parameters schema with `intent` prepended as the\n * FIRST property (object key order is insertion order and every provider\n * serializer preserves it — first key in the schema means first key in the\n * streamed input). Never mutates the input; no-op when the schema already\n * declares `intent`. The property is not added to `required`.\n */\nexport function withIntent(parameters?: JsonSchemaType): JsonSchemaType {\n const existingProps = parameters?.properties ?? {};\n if (INTENT_ARG in existingProps) {\n return parameters as JsonSchemaType;\n }\n return {\n ...parameters,\n type: 'object',\n properties: { [INTENT_ARG]: { ...INTENT_PROPERTY }, ...existingProps },\n };\n}\n\n/**\n * Coerces tool-call args to an object, parsing a stringified JSON object\n * (some providers deliver args as a string). Returns undefined otherwise.\n */\nfunction coerceArgsObject(args: unknown): Record<string, unknown> | undefined {\n if (typeof args === 'object' && args !== null && !Array.isArray(args)) {\n return args as Record<string, unknown>;\n }\n if (typeof args === 'string' && args.trim().startsWith('{')) {\n try {\n const parsed = JSON.parse(args) as unknown;\n if (parsed != null && typeof parsed === 'object' && !Array.isArray(parsed)) {\n return parsed as Record<string, unknown>;\n }\n } catch {\n return undefined;\n }\n }\n return undefined;\n}\n\n/**\n * Reads the model-authored intent from tool-call args (handles stringified\n * args). Returns undefined when absent, empty, or not a string.\n */\nexport function readIntent(args: unknown): string | undefined {\n const value = coerceArgsObject(args)?.[INTENT_ARG];\n if (typeof value !== 'string') {\n return undefined;\n }\n const trimmed = value.trim();\n return trimmed === '' ? undefined : trimmed;\n}\n\n/**\n * Returns the args without the `intent` key so downstream consumers that did\n * not declare it never receive it. Parses stringified JSON object args;\n * returns the value unchanged when the key is absent.\n */\nexport function stripIntent(args: unknown): unknown {\n const obj = coerceArgsObject(args);\n if (!obj || !(INTENT_ARG in obj)) {\n return args;\n }\n const { [INTENT_ARG]: _omit, ...rest } = obj;\n return rest;\n}\n\n/**\n * Resolves the settled label for a call from its model-authored `intent` and\n * the tool's result fields, in precedence order:\n *\n * 1. `outcome` — full replacement authored by the tool.\n * 2. `outcome_patch` — first occurrence of `from` in the intent replaced\n * with `to` (case-sensitive); no-op when `from` is absent or empty.\n * 3. Otherwise the intent is returned UNCHANGED.\n *\n * There is deliberately no mechanical present-progressive→past-tense rewrite.\n * Such a transform can only be a closed list of English verbs, which makes it\n * wrong in three ways at once: it never fires for the non-English labels this\n * feature expects (the model answers in the user's language), it fires for\n * some sibling calls and not others inside one group — \"Searched…\" beside\n * \"Recording…\" — and it quietly enumerates a vocabulary in a feature whose\n * premise is that the sentence is free-form. Completion is conveyed by UI\n * state (the shimmer stopping, the icon settling), which is language-neutral\n * and always consistent; a tool that wants past tense says so explicitly via\n * `outcome` or `outcome_patch`.\n *\n * Returns undefined when there is neither an intent nor an outcome, so\n * callers fall back to their default label. Pure and dependency-free — host\n * UIs needing identical logic can import or mirror it.\n */\nexport function applyOutcome(\n intent: string | undefined,\n result?: { outcome?: string; outcome_patch?: OutcomePatch },\n): string | undefined {\n const outcome = result?.outcome;\n if (typeof outcome === 'string' && outcome.trim() !== '') {\n return outcome;\n }\n if (intent == null || intent === '') {\n return undefined;\n }\n const patch = result?.outcome_patch;\n if (patch != null && patch.from !== '' && intent.includes(patch.from)) {\n /** Replacement callback keeps `to` verbatim — a direct string second\n * argument would interpret `$&`/`$'`-style tokens in tool-authored\n * text (e.g. labels derived from shell syntax). */\n return intent.replace(patch.from, () => patch.to);\n }\n return intent;\n}\n\n/**\n * Hard cap on an emitted outcome label. The label is a single progress line\n * in UI chrome; a tool that derives it from data (or a malformed patch)\n * must not be able to inflate completion events or persisted parts.\n */\nconst MAX_OUTCOME_CHARS = 256;\n\nfunction boundOutcomeLabel(label: string | undefined): string | undefined {\n if (label == null) {\n return undefined;\n }\n const singleLine = label.replace(/\\s+/g, ' ').trim();\n if (singleLine === '') {\n return undefined;\n }\n if (singleLine.length <= MAX_OUTCOME_CHARS) {\n return singleLine;\n }\n return `${singleLine.slice(0, MAX_OUTCOME_CHARS - 1)}…`;\n}\n\n/**\n * Resolves the settled label to emit on a completion event: only when the\n * tool actually authored `outcome`/`outcome_patch` fields. Returns undefined\n * otherwise, so the wire never carries a label the host already has — a bare\n * intent needs no settled form, because it is displayed unchanged and the UI\n * conveys completion through its own state. Hosts must NOT rewrite it (see\n * {@link applyOutcome} for why a tense transform is deliberately absent). The\n * result is collapsed to a bounded single line before emission.\n *\n * For failed calls (`isError`), only tool-AUTHORED text may label the call:\n * an explicit `outcome`, or a patch whose `from` actually matches the intent.\n * An unmatched patch resolves to undefined rather than silently reusing the\n * in-flight intent, so a failure is never labelled as though it succeeded.\n */\nexport function resolveToolOutcome(\n args: unknown,\n fields?: { outcome?: string; outcome_patch?: OutcomePatch } | null,\n options?: { isError?: boolean },\n): string | undefined {\n if (fields == null || (fields.outcome == null && fields.outcome_patch == null)) {\n return undefined;\n }\n if (options?.isError !== true) {\n return boundOutcomeLabel(applyOutcome(readIntent(args), fields));\n }\n const outcome = fields.outcome;\n if (typeof outcome === 'string' && outcome.trim() !== '') {\n return boundOutcomeLabel(outcome);\n }\n const intent = readIntent(args);\n const patch = fields.outcome_patch;\n if (\n intent != null &&\n patch != null &&\n patch.from !== '' &&\n intent.includes(patch.from)\n ) {\n return boundOutcomeLabel(intent.replace(patch.from, () => patch.to));\n }\n return undefined;\n}\n\n/**\n * Reads the outcome fields off a tool-execution result: the typed\n * `outcome`/`outcome_patch` fields when present, else the artifact channel\n * (see {@link readOutcomeFields}) — so a `content_and_artifact` tool authors\n * its label the same way on the direct and event-driven paths.\n */\nexport function outcomeFieldsFromResult(result: {\n outcome?: string;\n outcome_patch?: OutcomePatch;\n artifact?: unknown;\n}): { outcome?: string; outcome_patch?: OutcomePatch } | undefined {\n if (result.outcome != null || result.outcome_patch != null) {\n return result;\n }\n return readOutcomeFields(result.artifact);\n}\n\n/**\n * Extracts validated `outcome`/`outcome_patch` fields from an arbitrary\n * value — the artifact channel through which an in-process\n * `content_and_artifact` tool authors its settled label. Returns undefined\n * when neither field is usable.\n */\nexport function readOutcomeFields(\n source: unknown,\n): { outcome?: string; outcome_patch?: OutcomePatch } | undefined {\n if (source == null || typeof source !== 'object' || Array.isArray(source)) {\n return undefined;\n }\n const record = source as Record<string, unknown>;\n const outcome =\n typeof record.outcome === 'string' && record.outcome.trim() !== ''\n ? record.outcome\n : undefined;\n let outcome_patch: OutcomePatch | undefined;\n const rawPatch = record.outcome_patch;\n if (rawPatch != null && typeof rawPatch === 'object' && !Array.isArray(rawPatch)) {\n const patch = rawPatch as Record<string, unknown>;\n if (typeof patch.from === 'string' && typeof patch.to === 'string') {\n outcome_patch = { from: patch.from, to: patch.to };\n }\n }\n if (outcome == null && outcome_patch == null) {\n return undefined;\n }\n return { outcome, outcome_patch };\n}\n"],"mappings":";;AAwBA,MAAa,aAAa;;;;;;;;;;;;AAa1B,MAAa,sBAAsB;;;;;;;;;;;AAYnC,MAAa,qBACX,GAAG,oBAAoB;;;;;;;;AAYzB,MAAa,kBAAkC,OAAO,OAAuB;CAC3E,MAAM;CACN,aAAa;AACf,CAAC;;;;;;;AAQD,SAAgB,sBAAsB,UAA4B;CAChE,IAAI,YAAY,QAAQ,OAAO,aAAa,UAC1C,OAAO;CAET,MAAM,SAAS;CACf,OACE,OAAO,SAAS,YAChB,OAAO,OAAO,gBAAgB,YAC9B,OAAO,YAAY,WAAA,+BAA8B;AAErD;;;;;;;;;;;;;;;;;;AA+BA,SAAgB,cAAc,YAAiE;CAC7F,MAAM,QAAQ,YAAY;CAC1B,IAAI,cAAc,QAAQ,SAAS,QAAQ,CAAC,sBAAsB,MAAA,SAAiB,GACjF,OAAO;CAET,MAAM,GAAG,aAAa,OAAO,GAAG,SAAS;CACzC,MAAM,OAAuB;EAC3B,GAAI;EACJ,YAAY;CACd;CACA,IAAI,WAAW,YAAY,MAAM;EAC/B,MAAM,WAAW,WAAW,SAAS,QAAQ,QAAQ,QAAQ,UAAU;EACvE,IAAI,SAAS,SAAS,GACpB,KAAK,WAAW;OAEhB,OAAO,KAAK;CAEhB;CACA,OAAO;AACT;;;;;;;;AASA,SAAgB,WAAW,YAA6C;CACtE,MAAM,gBAAgB,YAAY,cAAc,CAAC;CACjD,IAAA,YAAkB,eAChB,OAAO;CAET,OAAO;EACL,GAAG;EACH,MAAM;EACN,YAAY;IAAG,aAAa,EAAE,GAAG,gBAAgB;GAAG,GAAG;EAAc;CACvE;AACF;;;;;AAMA,SAAS,iBAAiB,MAAoD;CAC5E,IAAI,OAAO,SAAS,YAAY,SAAS,QAAQ,CAAC,MAAM,QAAQ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CAC9B,MAAM,QAAQ,OAAO;CACrB,IACE,UAAU,QACV,SAAS,QACT,MAAM,SAAS,MACf,OAAO,SAAS,MAAM,IAAI,GAE1B,OAAO,kBAAkB,OAAO,QAAQ,MAAM,YAAY,MAAM,EAAE,CAAC;AAGvE;AAQA,SAAgB,wBAAwB,QAI2B;CACjE,IAAI,OAAO,WAAW,QAAQ,OAAO,iBAAiB,MACpD,OAAO;CAET,OAAO,kBAAkB,OAAO,QAAQ;AAC1C;AAQA,SAAgB,kBACd,QACgE;CAChE,IAAI,UAAU,QAAQ,OAAO,WAAW,YAAY,MAAM,QAAQ,MAAM,GACtE;CAEF,MAAM,SAAS;CACf,MAAM,UACJ,OAAO,OAAO,YAAY,YAAY,OAAO,QAAQ,KAAK,MAAM,KAC5D,OAAO,UACP,KAAA;CACN,IAAI;CACJ,MAAM,WAAW,OAAO;CACxB,IAAI,YAAY,QAAQ,OAAO,aAAa,YAAY,CAAC,MAAM,QAAQ,QAAQ,GAAG;EAChF,MAAM,QAAQ;EACd,IAAI,OAAO,MAAM,SAAS,YAAY,OAAO,MAAM,OAAO,UACxD,gBAAgB;GAAE,MAAM,MAAM;GAAM,IAAI,MAAM;EAAG;CAErD;CACA,IAAI,WAAW,QAAQ,iBAAiB,MACtC;CAEF,OAAO;EAAE;EAAS;CAAc;AAClC"}
@@ -6,31 +6,6 @@ import { getLocalCwd, getWorkspaceFS, spawnLocalProcess, truncateLocalOutput, va
6
6
  import { tool } from "@langchain/core/tools";
7
7
  import { resolve } from "path";
8
8
  //#region src/tools/local/CompileCheckTool.ts
9
- /**
10
- * `compile_check` — a thin LLM-callable wrapper around the project's
11
- * standard typecheck/lint command. Lets the agent answer "did my
12
- * change break anything?" without us shipping a real LSP client.
13
- *
14
- * Auto-detection priority (first hit wins):
15
- *
16
- * 1. `local.compileCheck.command` — explicit override
17
- * 2. `tsconfig.json` → `npx --no-install tsc --noEmit`
18
- * 3. `package.json` with a typescript dep → same as 2
19
- * 4. `pyproject.toml` or `setup.py` / `setup.cfg`
20
- * with a dev dep on mypy → `python3 -m mypy .`
21
- * else → `python3 -m py_compile <every .py>`
22
- * (bounded by find-walk so node_modules
23
- * and `.venv` don't blow up)
24
- * 5. `Cargo.toml` → `cargo check --message-format=short`
25
- * 6. `go.mod` → `go vet ./...`
26
- * 7. otherwise → tells the agent there's
27
- * no detected toolchain.
28
- *
29
- * Output is the spawn process's stdout/stderr passed through
30
- * `truncateLocalOutput` so a 10MB tsc dump can't blow context. The
31
- * exit code is reported.
32
- */
33
- /** Back-compat alias; canonical name lives on `Constants.COMPILE_CHECK`. */
34
9
  const CompileCheckToolName = "compile_check";
35
10
  const CompileCheckSchema = withIntent({
36
11
  type: "object",
@@ -1 +1 @@
1
- {"version":3,"file":"CompileCheckTool.mjs","names":[],"sources":["../../../../src/tools/local/CompileCheckTool.ts"],"sourcesContent":["/**\n * `compile_check` — a thin LLM-callable wrapper around the project's\n * standard typecheck/lint command. Lets the agent answer \"did my\n * change break anything?\" without us shipping a real LSP client.\n *\n * Auto-detection priority (first hit wins):\n *\n * 1. `local.compileCheck.command` — explicit override\n * 2. `tsconfig.json` → `npx --no-install tsc --noEmit`\n * 3. `package.json` with a typescript dep → same as 2\n * 4. `pyproject.toml` or `setup.py` / `setup.cfg`\n * with a dev dep on mypy → `python3 -m mypy .`\n * else → `python3 -m py_compile <every .py>`\n * (bounded by find-walk so node_modules\n * and `.venv` don't blow up)\n * 5. `Cargo.toml` → `cargo check --message-format=short`\n * 6. `go.mod` → `go vet ./...`\n * 7. otherwise → tells the agent there's\n * no detected toolchain.\n *\n * Output is the spawn process's stdout/stderr passed through\n * `truncateLocalOutput` so a 10MB tsc dump can't blow context. The\n * exit code is reported.\n */\n\nimport { resolve } from 'path';\nimport { tool } from '@langchain/core/tools';\nimport type { DynamicStructuredTool } from '@langchain/core/tools';\nimport type { WorkspaceFS } from './workspaceFS';\nimport type * as t from '@/types';\nimport {\n getLocalCwd,\n getWorkspaceFS,\n spawnLocalProcess,\n truncateLocalOutput,\n validateBashCommand,\n} from './LocalExecutionEngine';\nimport { isWorkspaceClientTimeoutError } from './workspaceFS';\nimport { withIntent } from '@/tools/intentArg';\nimport { Constants } from '@/common';\n\n/** Back-compat alias; canonical name lives on `Constants.COMPILE_CHECK`. */\nexport const CompileCheckToolName = Constants.COMPILE_CHECK;\n\nconst CompileCheckSchema: t.JsonSchemaType = withIntent({\n type: 'object',\n properties: {\n command: {\n type: 'string',\n description:\n 'Optional explicit command to run instead of the auto-detected one. Runs verbatim from the local engine cwd; honours the standard sandbox/AST gate.',\n },\n timeout_ms: {\n type: 'integer',\n description:\n 'Optional timeout in milliseconds. Defaults to 120000 (2 min).',\n },\n },\n});\n\ntype DetectedKind =\n | 'typescript'\n | 'python-mypy'\n | 'python-compile'\n | 'rust'\n | 'go'\n | 'unknown';\n\ntype Detection = {\n kind: DetectedKind;\n command: string;\n reason: string;\n};\n\nasync function pathExists(fs: WorkspaceFS, p: string): Promise<boolean> {\n try {\n await fs.stat(p);\n return true;\n } catch (error) {\n // A stalled-RPC timeout is not \"absent\" — don't let it pick a weaker/wrong\n // toolchain after waiting through the backstop; surface it.\n if (isWorkspaceClientTimeoutError(error)) {\n throw error;\n }\n return false;\n }\n}\n\n// Probes for project markers via the configured WorkspaceFS so a Run\n// with `local.exec.fs` (in-memory or remote engine) detects the right\n// toolchain against the actual workspace — not the host filesystem.\n// Codex P1 #25.\nasync function detect(cwd: string, fs: WorkspaceFS): Promise<Detection> {\n if (await pathExists(fs, resolve(cwd, 'tsconfig.json'))) {\n return {\n kind: 'typescript',\n command: 'npx --no-install tsc --noEmit',\n reason: 'tsconfig.json present',\n };\n }\n if (await pathExists(fs, resolve(cwd, 'package.json'))) {\n const pkgRaw = await fs\n .readFile(resolve(cwd, 'package.json'), 'utf8')\n .catch((error) => {\n if (isWorkspaceClientTimeoutError(error)) {\n throw error;\n }\n return '';\n });\n if (pkgRaw.includes('\"typescript\"')) {\n return {\n kind: 'typescript',\n command: 'npx --no-install tsc --noEmit',\n reason: 'package.json declares typescript',\n };\n }\n }\n if (await pathExists(fs, resolve(cwd, 'Cargo.toml'))) {\n return {\n kind: 'rust',\n command: 'cargo check --message-format=short',\n reason: 'Cargo.toml present',\n };\n }\n if (await pathExists(fs, resolve(cwd, 'go.mod'))) {\n return {\n kind: 'go',\n command: 'go vet ./...',\n reason: 'go.mod present',\n };\n }\n if (\n (await pathExists(fs, resolve(cwd, 'pyproject.toml'))) ||\n (await pathExists(fs, resolve(cwd, 'setup.py'))) ||\n (await pathExists(fs, resolve(cwd, 'setup.cfg')))\n ) {\n const pyToml = await fs\n .readFile(resolve(cwd, 'pyproject.toml'), 'utf8')\n .catch((error) => {\n if (isWorkspaceClientTimeoutError(error)) {\n throw error;\n }\n return '';\n });\n if (pyToml.includes('mypy')) {\n return {\n kind: 'python-mypy',\n command: 'python3 -m mypy .',\n reason: 'pyproject.toml declares mypy',\n };\n }\n return {\n kind: 'python-compile',\n command:\n 'python3 -c \"import compileall, sys; sys.exit(0 if compileall.compile_dir(\\'.\\', quiet=1, rx=__import__(\\'re\\').compile(r\\'(node_modules|\\\\.venv|\\\\.git|build|dist)\\')) else 1)\"',\n reason: 'Python project (no mypy detected)',\n };\n }\n return {\n kind: 'unknown',\n command: '',\n reason:\n 'no recognised project marker (tsconfig.json, package.json[typescript], Cargo.toml, go.mod, pyproject.toml, setup.py)',\n };\n}\n\nconst DEFAULT_TIMEOUT_MS = 120_000;\n\nexport function createCompileCheckTool(\n config: t.LocalExecutionConfig = {}\n): DynamicStructuredTool {\n return tool(\n async (rawInput) => {\n const input = rawInput as {\n command?: string;\n timeout_ms?: number;\n };\n const cwd = getLocalCwd(config);\n const fs = getWorkspaceFS(config);\n const overrideCommand = input.command ?? config.compileCheck?.command;\n let detection: Detection;\n if (overrideCommand != null && overrideCommand.trim() !== '') {\n detection = {\n kind: 'unknown',\n command: overrideCommand,\n reason: 'explicit override',\n };\n } else {\n detection = await detect(cwd, fs);\n }\n\n if (detection.command === '') {\n const explainer = `compile_check: ${detection.reason}. Pass an explicit \\`command\\` (e.g. \\`npm run typecheck\\`) to override.`;\n return [\n explainer,\n {\n kind: detection.kind,\n ran: false,\n reason: detection.reason,\n cwd,\n },\n ];\n }\n\n // Codex P1 #21: route the resolved command through the same\n // safety gates the rest of the local engine uses. Without this\n // a host with `readOnly: true` (or relying on the destructive-\n // command guard) could be bypassed by passing a `command`\n // override to compile_check that performs writes/deletes.\n // Auto-detected commands (tsc/cargo/etc.) pass these gates\n // unchanged — the validation is only blocking for genuinely\n // mutating overrides.\n const validation = await validateBashCommand(detection.command, config);\n if (!validation.valid) {\n const explainer = `compile_check refused to run \\`${detection.command}\\`: ${validation.errors.join('; ')}`;\n return [\n explainer,\n {\n kind: detection.kind,\n ran: false,\n reason: validation.errors.join('; '),\n cwd,\n },\n ];\n }\n\n const timeoutMs =\n input.timeout_ms ??\n config.compileCheck?.timeoutMs ??\n DEFAULT_TIMEOUT_MS;\n const result = await spawnLocalProcess(\n config.shell ?? (process.platform === 'win32' ? 'bash.exe' : 'bash'),\n ['-lc', detection.command],\n {\n ...config,\n timeoutMs,\n maxOutputChars: config.maxOutputChars ?? 8000,\n }\n );\n\n const passed = result.exitCode === 0 && !result.timedOut;\n const headline = passed\n ? `compile_check (${detection.kind}) PASSED via \\`${detection.command}\\``\n : `compile_check (${detection.kind}) FAILED via \\`${detection.command}\\` ` +\n `(exit=${result.exitCode ?? 'unknown'}${result.timedOut ? ', timed_out=true' : ''})`;\n\n let body = '';\n if (result.stdout !== '') {\n body += `\\n\\nstdout:\\n${truncateLocalOutput(result.stdout, 4000)}`;\n }\n if (result.stderr !== '') {\n body += `\\n\\nstderr:\\n${truncateLocalOutput(result.stderr, 4000)}`;\n }\n if (result.fullOutputPath != null) {\n body += `\\n\\nfull_output_path: ${result.fullOutputPath}`;\n }\n const summary = `${headline}${body}\\n\\nworking_directory: ${cwd}\\nreason: ${detection.reason}`;\n\n return [\n summary,\n {\n kind: detection.kind,\n ran: true,\n passed,\n exit_code: result.exitCode,\n timed_out: result.timedOut,\n command: detection.command,\n cwd,\n },\n ];\n },\n {\n name: CompileCheckToolName,\n description:\n 'Run the project\\'s standard typecheck or lint pass and return its output. Auto-detects from project markers (tsconfig.json/package.json -> tsc; Cargo.toml -> cargo check; go.mod -> go vet; pyproject.toml -> mypy or py_compile). Pass `command` to override.',\n schema: CompileCheckSchema,\n responseFormat: Constants.CONTENT_AND_ARTIFACT,\n }\n );\n}\n\nexport function createCompileCheckToolDefinition(): t.LCTool {\n return {\n name: CompileCheckToolName,\n description:\n 'Run the project\\'s standard typecheck or lint pass and return its output.',\n parameters: CompileCheckSchema,\n allowed_callers: ['direct', 'code_execution'],\n responseFormat: Constants.CONTENT_AND_ARTIFACT,\n toolType: 'builtin',\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,uBAAA;AAEb,MAAM,qBAAuC,WAAW;CACtD,MAAM;CACN,YAAY;EACV,SAAS;GACP,MAAM;GACN,aACE;EACJ;EACA,YAAY;GACV,MAAM;GACN,aACE;EACJ;CACF;AACF,CAAC;AAgBD,eAAe,WAAW,IAAiB,GAA6B;CACtE,IAAI;EACF,MAAM,GAAG,KAAK,CAAC;EACf,OAAO;CACT,SAAS,OAAO;EAGd,IAAI,8BAA8B,KAAK,GACrC,MAAM;EAER,OAAO;CACT;AACF;AAMA,eAAe,OAAO,KAAa,IAAqC;CACtE,IAAI,MAAM,WAAW,IAAI,QAAQ,KAAK,eAAe,CAAC,GACpD,OAAO;EACL,MAAM;EACN,SAAS;EACT,QAAQ;CACV;CAEF,IAAI,MAAM,WAAW,IAAI,QAAQ,KAAK,cAAc,CAAC;OAS/C,MARiB,GAClB,SAAS,QAAQ,KAAK,cAAc,GAAG,MAAM,CAAC,CAC9C,OAAO,UAAU;GAChB,IAAI,8BAA8B,KAAK,GACrC,MAAM;GAER,OAAO;EACT,CAAC,EAAA,CACQ,SAAS,gBAAc,GAChC,OAAO;GACL,MAAM;G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EACA,UAAU;CACZ;AACF"}
1
+ {"version":3,"file":"CompileCheckTool.mjs","names":[],"sources":["../../../../src/tools/local/CompileCheckTool.ts"],"mappings":";;;;;;;;AA0CA,MAAa,uBAAA;AAEb,MAAM,qBAAuC,WAAW;CACtD,MAAM;CACN,YAAY;EACV,SAAS;GACP,MAAM;GACN,aACE;EACJ;EACA,YAAY;GACV,MAAM;GACN,aACE;EACJ;CACF;AACF,CAAC;AAgBD,eAAe,WAAW,IAAiB,GAA6B;CACtE,IAAI;EACF,MAAM,GAAG,KAAK,CAAC;EACf,OAAO;CACT,SAAS,OAAO;EAGd,IAAI,8BAA8B,KAAK,GACrC,MAAM;EAER,OAAO;CACT;AACF;AAMA,eAAe,OAAO,KAAa,IAAqC;CACtE,IAAI,MAAM,WAAW,IAAI,QAAQ,KAAK,eAAe,CAAC,GACpD,OAAO;EACL,MAAM;EACN,SAAS;EACT,QAAQ;CACV;CAEF,IAAI,MAAM,WAAW,IAAI,QAAQ,KAAK,cAAc,CAAC;OAS/C,MARiB,GAClB,SAAS,QAAQ,KAAK,cAAc,GAAG,MAAM,CAAC,CAC9C,OAAO,UAAU;GAChB,IAAI,8BAA8B,KAAK,GACrC,MAAM;GAER,OAAO;EACT,CAAC,EAAA,CACQ,SAAS,gBAAc,GAChC,OAAO;GACL,MAAM;GACN,SAAS;GACT,QAAQ;EACV;CAAA;CAGJ,IAAI,MAAM,WAAW,IAAI,QAAQ,KAAK,YAAY,CAAC,GACjD,OAAO;EACL,MAAM;EACN,SAAS;EACT,QAAQ;CACV;CAEF,IAAI,MAAM,WAAW,IAAI,QAAQ,KAAK,QAAQ,CAAC,GAC7C,OAAO;EACL,MAAM;EACN,SAAS;EACT,QAAQ;CACV;CAEF,IACG,MAAM,WAAW,IAAI,QAAQ,KAAK,gBAAgB,CAAC,KACnD,MAAM,WAAW,IAAI,QAAQ,KAAK,UAAU,CAAC,KAC7C,MAAM,WAAW,IAAI,QAAQ,KAAK,WAAW,CAAC,GAC/C;EASA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AO,kBAAkB;EAC3C,CACF;EAEA,MAAM,SAAS,OAAO,aAAa,KAAK,CAAC,OAAO;EAChD,MAAM,WAAW,SACb,kBAAkB,UAAU,KAAK,iBAAiB,UAAU,QAAQ,MACpE,kBAAkB,UAAU,KAAK,iBAAiB,UAAU,QAAQ,WAC3D,OAAO,YAAY,YAAY,OAAO,WAAW,qBAAqB,GAAG;EAEtF,IAAI,OAAO;EACX,IAAI,OAAO,WAAW,IACpB,QAAQ,gBAAgB,oBAAoB,OAAO,QAAQ,GAAI;EAEjE,IAAI,OAAO,WAAW,IACpB,QAAQ,gBAAgB,oBAAoB,OAAO,QAAQ,GAAI;EAEjE,IAAI,OAAO,kBAAkB,MAC3B,QAAQ,yBAAyB,OAAO;EAI1C,OAAO,CACL,GAHiB,WAAW,KAAK,yBAAyB,IAAI,YAAY,UAAU,UAIpF;GACE,MAAM,UAAU;GAChB,KAAK;GACL;GACA,WAAW,OAAO;GAClB,WAAW,OAAO;GAClB,SAAS,UAAU;GACnB;EACF,CACF;CACF,GACA;EACE,MAAM;EACN,aACE;EACF,QAAQ;EACR,gBAAA;CACF,CACF;AACF;AAEA,SAAgB,mCAA6C;CAC3D,OAAO;EACL,MAAM;EACN,aACE;EACF,YAAY;EACZ,iBAAiB,CAAC,UAAU,gBAAgB;EAC5C,gBAAA;EACA,UAAU;CACZ;AACF"}
@@ -1,23 +1,6 @@
1
1
  import { isWorkspaceClientTimeoutError, nodeWorkspaceFS } from "./workspaceFS.mjs";
2
2
  import { dirname } from "path";
3
3
  //#region src/tools/local/FileCheckpointer.ts
4
- /**
5
- * Per-Run snapshot store for write_file / edit_file. Captures the
6
- * pre-write byte content of every path the local engine is about to
7
- * mutate so a later `rewind()` can restore the working tree to its
8
- * original state. Notes:
9
- *
10
- * - Idempotent per path: subsequent captures preserve the first
11
- * snapshot (so rewind always restores the *original* content).
12
- * - Captures missing files as `{ kind: 'absent' }`; rewind deletes
13
- * those paths so created files are removed.
14
- * - In-memory: snapshots live for the lifetime of this instance and
15
- * are not persisted across processes. Tie the lifetime to a Run.
16
- * - Bounded by `maxBytesPerFile` (default 32 MiB) to bound memory.
17
- * A file larger than the cap is recorded but not snapshotted; the
18
- * rewind of that path is best-effort and the caller is told via
19
- * the result count not to trust it.
20
- */
21
4
  var LocalFileCheckpointerImpl = class {
22
5
  maxBytesPerFile;
23
6
  fs;
@@ -72,12 +55,6 @@ var LocalFileCheckpointerImpl = class {
72
55
  return [...this.snapshots.keys(), ...this.oversizePaths];
73
56
  }
74
57
  };
75
- /**
76
- * Convenience factory so callers don't have to reach for the impl
77
- * class directly. Accepts an optional `WorkspaceFS` so a host using a
78
- * non-default engine (remote sandbox, in-memory test FS, etc.) can
79
- * route the checkpointer through the same I/O.
80
- */
81
58
  function createLocalFileCheckpointer(options = {}) {
82
59
  return new LocalFileCheckpointerImpl(options.maxBytesPerFile, options.fs);
83
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FileCheckpointer.mjs","names":[],"sources":["../../../../src/tools/local/FileCheckpointer.ts"],"sourcesContent":["import { dirname } from 'path';\nimport type { WorkspaceFS } from './workspaceFS';\nimport type * as t from '@/types';\nimport { isWorkspaceClientTimeoutError, nodeWorkspaceFS } from './workspaceFS';\n\ntype Snapshot = { kind: 'absent' } | { kind: 'present'; content: Buffer };\n\n/**\n * Per-Run snapshot store for write_file / edit_file. Captures the\n * pre-write byte content of every path the local engine is about to\n * mutate so a later `rewind()` can restore the working tree to its\n * original state. Notes:\n *\n * - Idempotent per path: subsequent captures preserve the first\n * snapshot (so rewind always restores the *original* content).\n * - Captures missing files as `{ kind: 'absent' }`; rewind deletes\n * those paths so created files are removed.\n * - In-memory: snapshots live for the lifetime of this instance and\n * are not persisted across processes. Tie the lifetime to a Run.\n * - Bounded by `maxBytesPerFile` (default 32 MiB) to bound memory.\n * A file larger than the cap is recorded but not snapshotted; the\n * rewind of that path is best-effort and the caller is told via\n * the result count not to trust it.\n */\nexport class LocalFileCheckpointerImpl implements t.LocalFileCheckpointer {\n private snapshots = new Map<string, Snapshot>();\n private oversizePaths = new Set<string>();\n\n constructor(\n private readonly maxBytesPerFile: number = 32 * 1024 * 1024,\n private readonly fs: WorkspaceFS = nodeWorkspaceFS\n ) {}\n\n async captureBeforeWrite(absolutePath: string): Promise<void> {\n if (\n this.snapshots.has(absolutePath) ||\n this.oversizePaths.has(absolutePath)\n ) {\n return;\n }\n let info;\n try {\n info = await this.fs.stat(absolutePath);\n } catch (error) {\n // A stalled-RPC timeout is NOT \"file absent\" — snapshotting it as absent\n // would delete an existing file on revert. Surface it instead.\n if (isWorkspaceClientTimeoutError(error)) {\n throw error;\n }\n this.snapshots.set(absolutePath, { kind: 'absent' });\n return;\n }\n if (!info.isFile()) {\n return;\n }\n if (info.size > this.maxBytesPerFile) {\n this.oversizePaths.add(absolutePath);\n return;\n }\n const content = (await this.fs.readFile(absolutePath)) as Buffer;\n this.snapshots.set(absolutePath, { kind: 'present', content });\n }\n\n async rewind(): Promise<number> {\n let restored = 0;\n for (const [path, snapshot] of this.snapshots.entries()) {\n if (snapshot.kind === 'absent') {\n await this.fs.unlink(path).catch((error) => {\n // A timed-out delete did NOT happen — surface it rather than counting\n // the path as restored (which would falsely claim the workspace is\n // back to its pre-write state).\n if (isWorkspaceClientTimeoutError(error)) {\n throw error;\n }\n });\n restored++;\n continue;\n }\n try {\n await this.fs.mkdir(dirname(path), { recursive: true });\n await this.fs.writeFile(path, snapshot.content);\n restored++;\n } catch (error) {\n // A timed-out restore left the bad write in place — surface it.\n if (isWorkspaceClientTimeoutError(error)) {\n throw error;\n }\n // Best-effort: ignore individual restore failures so the rest\n // of the rewind continues.\n }\n }\n return restored;\n }\n\n capturedPaths(): string[] {\n return [...this.snapshots.keys(), ...this.oversizePaths];\n }\n}\n\n/**\n * Convenience factory so callers don't have to reach for the impl\n * class directly. Accepts an optional `WorkspaceFS` so a host using a\n * non-default engine (remote sandbox, in-memory test FS, etc.) can\n * route the checkpointer through the same I/O.\n */\nexport function createLocalFileCheckpointer(\n options: { maxBytesPerFile?: number; fs?: WorkspaceFS } = {}\n): t.LocalFileCheckpointer {\n return new LocalFileCheckpointerImpl(options.maxBytesPerFile, options.fs);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwBA,IAAa,4BAAb,MAA0E;CAKrD;CACA;CALnB,4BAAoB,IAAI,IAAsB;CAC9C,gCAAwB,IAAI,IAAY;CAExC,YACE,kBAA2C,KAAK,OAAO,MACvD,KAAmC,iBACnC;EAFiB,KAAA,kBAAA;EACA,KAAA,KAAA;CAChB;CAEH,MAAM,mBAAmB,cAAqC;EAC5D,IACE,KAAK,UAAU,IAAI,YAAY,KAC/B,KAAK,cAAc,IAAI,YAAY,GAEnC;EAEF,IAAI;EACJ,IAAI;GACF,OAAO,MAAM,KAAK,GAAG,KAAK,YAAY;EACxC,SAAS,OAAO;GAGd,IAAI,8BAA8B,KAAK,GACrC,MAAM;GAER,KAAK,UAAU,IAAI,cAAc,EAAE,MAAM,SAAS,CAAC;GACnD;EACF;EACA,IAAI,CAAC,KAAK,OAAO,GACf;EAEF,IAAI,KAAK,OAAO,KAAK,iBAAiB;GACpC,KAAK,cAAc,IAAI,YAAY;GACnC;EACF;EACA,MAAM,UAAW,MAAM,KAAK,GAAG,SAAS,YAAY;EACpD,KAAK,UAAU,IAAI,cAAc;GAAE,MAAM;GAAW;EAAQ,CAAC;CAC/D;CAEA,MAAM,SAA0B;EAC9B,IAAI,WAAW;EACf,KAAK,MAAM,CAAC,MAAM,aAAa,KAAK,UAAU,QAAQ,GAAG;GACvD,IAAI,SAAS,SAAS,UAAU;IAC9B,MAAM,KAAK,GAAG,OAAO,IAAI,CAAC,CAAC,OAAO,UAAU;KAI1C,IAAI,8BAA8B,KAAK,GACrC,MAAM;IAEV,CAAC;IACD;IACA;GACF;GACA,IAAI;IACF,MAAM,KAAK,GAAG,MAAM,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;IACtD,MAAM,KAAK,GAAG,UAAU,MAAM,SAAS,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,GAAG,OAAO,IAAI,CAAC,CAAC,OAAO,UAAU;KAI1C,IAAI,8BAA8B,KAAK,GACrC,MAAM;IAEV,CAAC;IACD;IACA;GACF;GACA,IAAI;IACF,MAAM,KAAK,GAAG,MAAM,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;IACtD,MAAM,KAAK,GAAG,UAAU,MAAM,SAAS,OAAO;IAC9C;GACF,SAAS,OAAO;IAEd,IAAI,8BAA8B,KAAK,GACrC,MAAM;GAIV;EACF;EACA,OAAO;CACT;CAEA,gBAA0B;EACxB,OAAO,CAAC,GAAG,KAAK,UAAU,KAAK,GAAG,GAAG,KAAK,aAAa;CACzD;AACF;AAQA,SAAgB,4BACd,UAA0D,CAAC,GAClC;CACzB,OAAO,IAAI,0BAA0B,QAAQ,iBAAiB,QAAQ,EAAE;AAC1E"}
@@ -19,12 +19,6 @@ const MAX_READ_CHARS = 256e3;
19
19
  const DEFAULT_MAX_RESULTS = 200;
20
20
  const DEFAULT_MAX_READ_BYTES = 10 * 1024 * 1024;
21
21
  const BINARY_DETECTION_BYTES = 8e3;
22
- /**
23
- * Tool name aliases retained for back-compat with consumers that imported
24
- * the per-file `Local*ToolName` constants. The canonical names live on
25
- * `Constants.*` (see `src/common/enum.ts`); these aliases just point at
26
- * them so a typo upstream gets caught at the type level.
27
- */
28
22
  const LocalWriteFileToolName = "write_file";
29
23
  const LocalEditFileToolName = "edit_file";
30
24
  const LocalGrepSearchToolName = "grep_search";
@@ -192,20 +186,6 @@ function appendSyntaxCheckSummary(base, run) {
192
186
  if (run.outcome.ok) return base;
193
187
  return `${base}${run.mode === "strict" ? `\n\n[syntax-check FAILED via ${run.outcome.checker}]\n` : `\n\n[syntax-check warning via ${run.outcome.checker}]\n`}${run.outcome.output}`;
194
188
  }
195
- /**
196
- * Revert a write_file/edit_file mutation in `postEditSyntaxCheck:
197
- * 'strict'` mode after the post-write syntax check failed. Strict
198
- * mode advertises a safety gate, so leaving the corrupted file on
199
- * disk + throwing is a half-broken contract — the model "reacts" to
200
- * the error but the next call sees broken on-disk state. Codex P2
201
- * [49]. Best-effort: a swallowed error here means the workspace is
202
- * still in the bad post-write state, but we still throw the
203
- * original syntax-check error so the caller knows.
204
- *
205
- * - If the file existed pre-write: restore the previous bytes with
206
- * the original encoding.
207
- * - If the file is brand-new: unlink it.
208
- */
209
189
  async function revertStrictWrite(fs, path, existed, before, encoding) {
210
190
  try {
211
191
  if (existed) await fs.writeFile(path, encodeFile(before, {
@@ -434,17 +414,6 @@ function createLocalEditFileTool(config = {}, checkpointer) {
434
414
  responseFormat: "content_and_artifact"
435
415
  });
436
416
  }
437
- /**
438
- * Ripgrep availability cache, keyed on the *effective execution
439
- * backend* — whatever function `getSpawn(config)` returns. Without
440
- * the backend key, a Run that probes `rg` over Node's
441
- * `child_process.spawn` would poison subsequent Runs whose
442
- * `local.exec.spawn` routes to a remote sandbox or container that
443
- * doesn't have rg installed: the cached `true` would skip the probe,
444
- * the rg invocation would throw, and the Node fallback wouldn't be
445
- * reached. Per-backend caching avoids that without paying for a
446
- * spawn-per-search.
447
- */
448
417
  let ripgrepAvailabilityByBackend = /* @__PURE__ */ new WeakMap();
449
418
  function envCacheKey(env) {
450
419
  if (env == null) return "";
@@ -471,14 +440,6 @@ async function isRipgrepAvailable(config) {
471
440
  }
472
441
  return probePromise;
473
442
  }
474
- /**
475
- * Test-only reset hook. Clears the ripgrep-availability cache so
476
- * tests can swap in mocked spawn backends and reprobe deterministically.
477
- *
478
- * @internal Not part of the public SDK surface; the leading underscore
479
- * and `@internal` tag together signal that consumers should not call
480
- * this. Tests import it via the module path directly.
481
- */
482
443
  function _resetRipgrepCacheForTests() {
483
444
  ripgrepAvailabilityByBackend = /* @__PURE__ */ new WeakMap();
484
445
  }
@@ -543,44 +504,9 @@ async function* walkFiles(root, fs) {
543
504
  }
544
505
  }
545
506
  }
546
- /**
547
- * Catastrophic-backtracking guardrails for the fallback grep path.
548
- *
549
- * Without ripgrep we run the model-supplied pattern through Node's
550
- * `RegExp` engine, which uses a backtracking implementation. Patterns
551
- * with nested unbounded quantifiers (`(a+)+`, `(.*)*`, etc.) can
552
- * monopolise the event loop for arbitrary wall-clock time on
553
- * pathological input, and `setTimeout` cannot interrupt a synchronous
554
- * `RegExp.exec`. Manual review (finding D) flagged this as a real DoS.
555
- *
556
- * Mitigations applied here, in order of severity:
557
- * 1. Cap pattern length so an obviously oversize regex is rejected
558
- * before compile.
559
- * 2. Reject patterns that contain a nested unbounded quantifier of
560
- * the form `(...+|*)([+*]|{n,})` — the standard pathological
561
- * shape. Still a heuristic (not a full safety proof), but blocks
562
- * every common DoS construction we've seen in coding-agent logs.
563
- * 3. Wall-clock budget for the overall search: each file's regex
564
- * pass is checked against a deadline; once exceeded the search
565
- * bails with a partial result. Doesn't interrupt a stuck
566
- * `exec()` call, but stops a slow pattern from making the whole
567
- * Run hang once the first hung file finishes.
568
- *
569
- * Hosts that need bulletproof regex safety should install `rg` —
570
- * ripgrep uses RE2 internally and has no backtracking.
571
- */
572
507
  const MAX_FALLBACK_PATTERN_LENGTH = 1024;
573
508
  const FALLBACK_GREP_BUDGET_MS = 5e3;
574
509
  const FALLBACK_GREP_MAX_FILE_BYTES = 5 * 1024 * 1024;
575
- /**
576
- * Heuristic: walks `pattern` to find any `(<contents>)<quant>` where
577
- * `<contents>` itself has an unbounded quantifier. Catches the
578
- * classic `(a+)+` form AND the double-nested `((a+)+)` form (which a
579
- * single-pass regex misses because `[^)]*` stops at the first inner
580
- * close-paren). Misses sufficiently obfuscated cases — bulletproof
581
- * ReDoS detection requires a real parser. The 5 s wall-clock budget
582
- * is the hard backstop for anything this slip past.
583
- */
584
510
  function hasNestedUnboundedQuantifier(pattern) {
585
511
  for (let i = 1; i < pattern.length - 1; i++) {
586
512
  if (pattern[i] !== ")") continue;
@@ -622,7 +548,6 @@ function compileFallbackRegex(pattern) {
622
548
  throw new FallbackGrepError("invalid-pattern", `Invalid regex: ${e.message}`);
623
549
  }
624
550
  }
625
- /** Renders fallback-grep output: real matches first, skip diagnostics appended. */
626
551
  function formatFallbackGrepDisplay(result) {
627
552
  if (result.matches.length > 0) return [...result.matches, ...result.skipped].join("\n");
628
553
  if (result.skipped.length > 0) return result.skipped.join("\n");
@@ -832,11 +757,6 @@ function createLocalCodingTools(config = {}, options = {}) {
832
757
  createLocalBashProgrammaticToolCallingTool(config)
833
758
  ];
834
759
  }
835
- /**
836
- * Variant of `createLocalCodingTools` that returns the bundle alongside
837
- * the file checkpointer so callers can later call
838
- * `bundle.checkpointer?.rewind()`.
839
- */
840
760
  function createLocalCodingToolBundle(config = {}, options = {}) {
841
761
  const checkpointer = options.checkpointer ?? (config.fileCheckpointing === true ? createLocalFileCheckpointer({ fs: config.exec?.fs }) : void 0);
842
762
  return {