@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.
- package/dist/cjs/agents/AgentContext.cjs +0 -356
- package/dist/cjs/agents/AgentContext.cjs.map +1 -1
- package/dist/cjs/agents/projection.cjs +0 -9
- package/dist/cjs/agents/projection.cjs.map +1 -1
- package/dist/cjs/common/constants.cjs +0 -26
- package/dist/cjs/common/constants.cjs.map +1 -1
- package/dist/cjs/common/enum.cjs +0 -85
- package/dist/cjs/common/enum.cjs.map +1 -1
- package/dist/cjs/events.cjs +0 -14
- package/dist/cjs/events.cjs.map +1 -1
- package/dist/cjs/graphs/Graph.cjs +1 -909
- package/dist/cjs/graphs/Graph.cjs.map +1 -1
- package/dist/cjs/graphs/MultiAgentGraph.cjs +7 -272
- package/dist/cjs/graphs/MultiAgentGraph.cjs.map +1 -1
- package/dist/cjs/graphs/applyGraphRuntimeConfig.cjs.map +1 -1
- package/dist/cjs/graphs/createGraph.cjs.map +1 -1
- package/dist/cjs/hitl/askUserQuestion.cjs +0 -53
- package/dist/cjs/hitl/askUserQuestion.cjs.map +1 -1
- package/dist/cjs/hitl/askUserQuestions.cjs +0 -20
- package/dist/cjs/hitl/askUserQuestions.cjs.map +1 -1
- package/dist/cjs/hitl/askUserQuestionsInterrupt.cjs +0 -6
- package/dist/cjs/hitl/askUserQuestionsInterrupt.cjs.map +1 -1
- package/dist/cjs/hooks/HookRegistry.cjs +0 -127
- package/dist/cjs/hooks/HookRegistry.cjs.map +1 -1
- package/dist/cjs/hooks/createToolPolicyHook.cjs +0 -38
- package/dist/cjs/hooks/createToolPolicyHook.cjs.map +1 -1
- package/dist/cjs/hooks/createWorkspacePolicyHook.cjs +0 -77
- package/dist/cjs/hooks/createWorkspacePolicyHook.cjs.map +1 -1
- package/dist/cjs/hooks/executeHooks.cjs +0 -79
- package/dist/cjs/hooks/executeHooks.cjs.map +1 -1
- package/dist/cjs/hooks/index.cjs +0 -16
- package/dist/cjs/hooks/index.cjs.map +1 -1
- package/dist/cjs/hooks/matchers.cjs +0 -104
- package/dist/cjs/hooks/matchers.cjs.map +1 -1
- package/dist/cjs/hooks/types.cjs +0 -8
- package/dist/cjs/hooks/types.cjs.map +1 -1
- package/dist/cjs/instrumentation.cjs +0 -14
- package/dist/cjs/instrumentation.cjs.map +1 -1
- package/dist/cjs/langfuse.cjs +0 -75
- package/dist/cjs/langfuse.cjs.map +1 -1
- package/dist/cjs/langfuseConfig.cjs.map +1 -1
- package/dist/cjs/langfuseRuntimeContext.cjs +0 -13
- package/dist/cjs/langfuseRuntimeContext.cjs.map +1 -1
- package/dist/cjs/langfuseRuntimeScope.cjs +0 -4
- package/dist/cjs/langfuseRuntimeScope.cjs.map +1 -1
- package/dist/cjs/langfuseSpanRegistry.cjs +0 -28
- package/dist/cjs/langfuseSpanRegistry.cjs.map +1 -1
- package/dist/cjs/langfuseToolOutputTracing.cjs +0 -3
- package/dist/cjs/langfuseToolOutputTracing.cjs.map +1 -1
- package/dist/cjs/langfuseTraceShaping.cjs +0 -74
- package/dist/cjs/langfuseTraceShaping.cjs.map +1 -1
- package/dist/cjs/llm/anthropic/index.cjs +0 -3
- package/dist/cjs/llm/anthropic/index.cjs.map +1 -1
- package/dist/cjs/llm/anthropic/types.cjs.map +1 -1
- package/dist/cjs/llm/anthropic/utils/message_inputs.cjs +1 -111
- package/dist/cjs/llm/anthropic/utils/message_inputs.cjs.map +1 -1
- package/dist/cjs/llm/anthropic/utils/message_outputs.cjs +0 -1
- package/dist/cjs/llm/anthropic/utils/message_outputs.cjs.map +1 -1
- package/dist/cjs/llm/anthropic/utils/stream_events.cjs +0 -8
- package/dist/cjs/llm/anthropic/utils/stream_events.cjs.map +1 -1
- package/dist/cjs/llm/anthropic/utils/tools.cjs.map +1 -1
- package/dist/cjs/llm/bedrock/cachePoints.cjs.map +1 -1
- package/dist/cjs/llm/bedrock/index.cjs +1 -95
- package/dist/cjs/llm/bedrock/index.cjs.map +1 -1
- package/dist/cjs/llm/bedrock/toolCache.cjs.map +1 -1
- package/dist/cjs/llm/bedrock/utils/message_inputs.cjs +0 -78
- package/dist/cjs/llm/bedrock/utils/message_inputs.cjs.map +1 -1
- package/dist/cjs/llm/bedrock/utils/message_outputs.cjs +0 -24
- package/dist/cjs/llm/bedrock/utils/message_outputs.cjs.map +1 -1
- package/dist/cjs/llm/contextOverflowRecovery.cjs +0 -62
- package/dist/cjs/llm/contextOverflowRecovery.cjs.map +1 -1
- package/dist/cjs/llm/fake.cjs.map +1 -1
- package/dist/cjs/llm/google/index.cjs +2 -21
- package/dist/cjs/llm/google/index.cjs.map +1 -1
- package/dist/cjs/llm/google/utils/common.cjs +0 -35
- package/dist/cjs/llm/google/utils/common.cjs.map +1 -1
- package/dist/cjs/llm/init.cjs +0 -9
- package/dist/cjs/llm/init.cjs.map +1 -1
- package/dist/cjs/llm/invoke.cjs +1 -270
- package/dist/cjs/llm/invoke.cjs.map +1 -1
- package/dist/cjs/llm/mistral/index.cjs.map +1 -1
- package/dist/cjs/llm/openai/index.cjs +0 -99
- package/dist/cjs/llm/openai/index.cjs.map +1 -1
- package/dist/cjs/llm/openai/streamMetadata.cjs +0 -21
- package/dist/cjs/llm/openai/streamMetadata.cjs.map +1 -1
- package/dist/cjs/llm/openai/utils/index.cjs.map +1 -1
- package/dist/cjs/llm/openrouter/index.cjs +0 -1
- package/dist/cjs/llm/openrouter/index.cjs.map +1 -1
- package/dist/cjs/llm/openrouter/toolCache.cjs +0 -6
- package/dist/cjs/llm/openrouter/toolCache.cjs.map +1 -1
- package/dist/cjs/llm/preempt.cjs +0 -75
- package/dist/cjs/llm/preempt.cjs.map +1 -1
- package/dist/cjs/llm/providers.cjs.map +1 -1
- package/dist/cjs/llm/request.cjs +0 -10
- package/dist/cjs/llm/request.cjs.map +1 -1
- package/dist/cjs/llm/stream/chunkAdapters.cjs +0 -62
- package/dist/cjs/llm/stream/chunkAdapters.cjs.map +1 -1
- package/dist/cjs/llm/stream/smoother.cjs +0 -58
- package/dist/cjs/llm/stream/smoother.cjs.map +1 -1
- package/dist/cjs/llm/streamLimits.cjs +4 -293
- package/dist/cjs/llm/streamLimits.cjs.map +1 -1
- package/dist/cjs/llm/truncation.cjs +0 -36
- package/dist/cjs/llm/truncation.cjs.map +1 -1
- package/dist/cjs/llm/vertexai/index.cjs +0 -330
- package/dist/cjs/llm/vertexai/index.cjs.map +1 -1
- package/dist/cjs/messages/alternation.cjs +0 -43
- package/dist/cjs/messages/alternation.cjs.map +1 -1
- package/dist/cjs/messages/anthropicToolCache.cjs +0 -45
- package/dist/cjs/messages/anthropicToolCache.cjs.map +1 -1
- package/dist/cjs/messages/assistantPhase.cjs +0 -12
- package/dist/cjs/messages/assistantPhase.cjs.map +1 -1
- package/dist/cjs/messages/budget.cjs +0 -9
- package/dist/cjs/messages/budget.cjs.map +1 -1
- package/dist/cjs/messages/cache.cjs +0 -172
- package/dist/cjs/messages/cache.cjs.map +1 -1
- package/dist/cjs/messages/content.cjs +0 -9
- package/dist/cjs/messages/content.cjs.map +1 -1
- package/dist/cjs/messages/contextPruning.cjs +0 -15
- package/dist/cjs/messages/contextPruning.cjs.map +1 -1
- package/dist/cjs/messages/contextPruningSettings.cjs +0 -3
- package/dist/cjs/messages/contextPruningSettings.cjs.map +1 -1
- package/dist/cjs/messages/core.cjs +0 -48
- package/dist/cjs/messages/core.cjs.map +1 -1
- package/dist/cjs/messages/format.cjs +1 -345
- package/dist/cjs/messages/format.cjs.map +1 -1
- package/dist/cjs/messages/handoffCue.cjs +0 -36
- package/dist/cjs/messages/handoffCue.cjs.map +1 -1
- package/dist/cjs/messages/ids.cjs.map +1 -1
- package/dist/cjs/messages/injected.cjs +0 -33
- package/dist/cjs/messages/injected.cjs.map +1 -1
- package/dist/cjs/messages/langchain.cjs +0 -14
- package/dist/cjs/messages/langchain.cjs.map +1 -1
- package/dist/cjs/messages/prune.cjs +1 -184
- package/dist/cjs/messages/prune.cjs.map +1 -1
- package/dist/cjs/messages/recency.cjs +0 -32
- package/dist/cjs/messages/recency.cjs.map +1 -1
- package/dist/cjs/messages/reducer.cjs +0 -30
- package/dist/cjs/messages/reducer.cjs.map +1 -1
- package/dist/cjs/messages/tools.cjs +0 -14
- package/dist/cjs/messages/tools.cjs.map +1 -1
- package/dist/cjs/openai/index.cjs.map +1 -1
- package/dist/cjs/prompts/activityLabel.cjs +9 -79
- package/dist/cjs/prompts/activityLabel.cjs.map +1 -1
- package/dist/cjs/responses/index.cjs.map +1 -1
- package/dist/cjs/run.cjs +2 -538
- package/dist/cjs/run.cjs.map +1 -1
- package/dist/cjs/session/AgentSession.cjs +1 -17
- package/dist/cjs/session/AgentSession.cjs.map +1 -1
- package/dist/cjs/session/JsonlSessionStore.cjs.map +1 -1
- package/dist/cjs/session/handlers.cjs +0 -7
- package/dist/cjs/session/handlers.cjs.map +1 -1
- package/dist/cjs/session/ids.cjs.map +1 -1
- package/dist/cjs/session/messageSerialization.cjs +0 -4
- package/dist/cjs/session/messageSerialization.cjs.map +1 -1
- package/dist/cjs/stream.cjs +1 -93
- package/dist/cjs/stream.cjs.map +1 -1
- package/dist/cjs/summarization/index.cjs +0 -27
- package/dist/cjs/summarization/index.cjs.map +1 -1
- package/dist/cjs/summarization/node.cjs +0 -273
- package/dist/cjs/summarization/node.cjs.map +1 -1
- package/dist/cjs/tools/BashExecutor.cjs +0 -35
- package/dist/cjs/tools/BashExecutor.cjs.map +1 -1
- package/dist/cjs/tools/BashProgrammaticToolCalling.cjs +0 -24
- package/dist/cjs/tools/BashProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/Calculator.cjs.map +1 -1
- package/dist/cjs/tools/CodeExecutor.cjs +0 -13
- package/dist/cjs/tools/CodeExecutor.cjs.map +1 -1
- package/dist/cjs/tools/CodeSessionFileSummary.cjs.map +1 -1
- package/dist/cjs/tools/ProgrammaticToolCalling.cjs +0 -101
- package/dist/cjs/tools/ProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/ReadFile.cjs.map +1 -1
- package/dist/cjs/tools/SkillTool.cjs +0 -5
- package/dist/cjs/tools/SkillTool.cjs.map +1 -1
- package/dist/cjs/tools/SubagentTool.cjs +0 -10
- package/dist/cjs/tools/SubagentTool.cjs.map +1 -1
- package/dist/cjs/tools/ToolNode.cjs +6 -1038
- package/dist/cjs/tools/ToolNode.cjs.map +1 -1
- package/dist/cjs/tools/ToolSearch.cjs +0 -179
- package/dist/cjs/tools/ToolSearch.cjs.map +1 -1
- package/dist/cjs/tools/cloudflare/CloudflareBridgeRuntime.cjs.map +1 -1
- package/dist/cjs/tools/cloudflare/CloudflareProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/cloudflare/CloudflareSandboxExecutionEngine.cjs +0 -39
- package/dist/cjs/tools/cloudflare/CloudflareSandboxExecutionEngine.cjs.map +1 -1
- package/dist/cjs/tools/cloudflare/CloudflareSandboxTools.cjs.map +1 -1
- package/dist/cjs/tools/eagerEventExecution.cjs +0 -6
- package/dist/cjs/tools/eagerEventExecution.cjs.map +1 -1
- package/dist/cjs/tools/handlers.cjs +1 -41
- package/dist/cjs/tools/handlers.cjs.map +1 -1
- package/dist/cjs/tools/intentArg.cjs +1 -132
- package/dist/cjs/tools/intentArg.cjs.map +1 -1
- package/dist/cjs/tools/local/CompileCheckTool.cjs +0 -25
- package/dist/cjs/tools/local/CompileCheckTool.cjs.map +1 -1
- package/dist/cjs/tools/local/FileCheckpointer.cjs +0 -23
- package/dist/cjs/tools/local/FileCheckpointer.cjs.map +1 -1
- package/dist/cjs/tools/local/LocalCodingTools.cjs +0 -80
- package/dist/cjs/tools/local/LocalCodingTools.cjs.map +1 -1
- package/dist/cjs/tools/local/LocalExecutionEngine.cjs +0 -126
- package/dist/cjs/tools/local/LocalExecutionEngine.cjs.map +1 -1
- package/dist/cjs/tools/local/LocalExecutionTools.cjs.map +1 -1
- package/dist/cjs/tools/local/LocalProgrammaticToolCalling.cjs +0 -12
- package/dist/cjs/tools/local/LocalProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/local/attachments.cjs +0 -44
- package/dist/cjs/tools/local/attachments.cjs.map +1 -1
- package/dist/cjs/tools/local/bashAst.cjs +0 -16
- package/dist/cjs/tools/local/bashAst.cjs.map +1 -1
- package/dist/cjs/tools/local/editStrategies.cjs +0 -14
- package/dist/cjs/tools/local/editStrategies.cjs.map +1 -1
- package/dist/cjs/tools/local/resolveLocalExecutionTools.cjs.map +1 -1
- package/dist/cjs/tools/local/syntaxCheck.cjs +0 -31
- package/dist/cjs/tools/local/syntaxCheck.cjs.map +1 -1
- package/dist/cjs/tools/local/textEncoding.cjs +0 -11
- package/dist/cjs/tools/local/textEncoding.cjs.map +1 -1
- package/dist/cjs/tools/local/workspaceFS.cjs +0 -33
- package/dist/cjs/tools/local/workspaceFS.cjs.map +1 -1
- package/dist/cjs/tools/ptcTimeout.cjs.map +1 -1
- package/dist/cjs/tools/schema.cjs +0 -8
- package/dist/cjs/tools/schema.cjs.map +1 -1
- package/dist/cjs/tools/search/anthropic.cjs +0 -9
- package/dist/cjs/tools/search/anthropic.cjs.map +1 -1
- package/dist/cjs/tools/search/content.cjs.map +1 -1
- package/dist/cjs/tools/search/crw-scraper.cjs +0 -33
- package/dist/cjs/tools/search/crw-scraper.cjs.map +1 -1
- package/dist/cjs/tools/search/crw-search.cjs +0 -2
- package/dist/cjs/tools/search/crw-search.cjs.map +1 -1
- package/dist/cjs/tools/search/firecrawl.cjs +0 -25
- package/dist/cjs/tools/search/firecrawl.cjs.map +1 -1
- package/dist/cjs/tools/search/format.cjs +0 -30
- package/dist/cjs/tools/search/format.cjs.map +1 -1
- package/dist/cjs/tools/search/highlights.cjs +0 -16
- package/dist/cjs/tools/search/highlights.cjs.map +1 -1
- package/dist/cjs/tools/search/keenable-scraper.cjs +0 -8
- package/dist/cjs/tools/search/keenable-scraper.cjs.map +1 -1
- package/dist/cjs/tools/search/keenable-search.cjs +0 -7
- package/dist/cjs/tools/search/keenable-search.cjs.map +1 -1
- package/dist/cjs/tools/search/rerankers.cjs +0 -35
- package/dist/cjs/tools/search/rerankers.cjs.map +1 -1
- package/dist/cjs/tools/search/schema.cjs +0 -1
- package/dist/cjs/tools/search/schema.cjs.map +1 -1
- package/dist/cjs/tools/search/search.cjs +1 -14
- package/dist/cjs/tools/search/search.cjs.map +1 -1
- package/dist/cjs/tools/search/serper-scraper.cjs +0 -46
- package/dist/cjs/tools/search/serper-scraper.cjs.map +1 -1
- package/dist/cjs/tools/search/tavily-scraper.cjs.map +1 -1
- package/dist/cjs/tools/search/tavily-search.cjs.map +1 -1
- package/dist/cjs/tools/search/tool.cjs +0 -25
- package/dist/cjs/tools/search/tool.cjs.map +1 -1
- package/dist/cjs/tools/search/utils.cjs +0 -8
- package/dist/cjs/tools/search/utils.cjs.map +1 -1
- package/dist/cjs/tools/skillCatalog.cjs +0 -6
- package/dist/cjs/tools/skillCatalog.cjs.map +1 -1
- package/dist/cjs/tools/streamedToolCallSeals.cjs +0 -6
- package/dist/cjs/tools/streamedToolCallSeals.cjs.map +1 -1
- package/dist/cjs/tools/subagent/SubagentExecutionRegistry.cjs +0 -2
- package/dist/cjs/tools/subagent/SubagentExecutionRegistry.cjs.map +1 -1
- package/dist/cjs/tools/subagent/SubagentExecutor.cjs +3 -213
- package/dist/cjs/tools/subagent/SubagentExecutor.cjs.map +1 -1
- package/dist/cjs/tools/subagent/SubagentReplay.cjs.map +1 -1
- package/dist/cjs/tools/subagent/childGraphConfig.cjs +0 -4
- package/dist/cjs/tools/subagent/childGraphConfig.cjs.map +1 -1
- package/dist/cjs/tools/subagent/runtimeLimits.cjs.map +1 -1
- package/dist/cjs/tools/toolOutputReferences.cjs +1 -322
- package/dist/cjs/tools/toolOutputReferences.cjs.map +1 -1
- package/dist/cjs/types/hitl.cjs +0 -5
- package/dist/cjs/types/hitl.cjs.map +1 -1
- package/dist/cjs/utils/callbacks.cjs.map +1 -1
- package/dist/cjs/utils/errors.cjs +14 -165
- package/dist/cjs/utils/errors.cjs.map +1 -1
- package/dist/cjs/utils/events.cjs +0 -10
- package/dist/cjs/utils/events.cjs.map +1 -1
- package/dist/cjs/utils/graph.cjs.map +1 -1
- package/dist/cjs/utils/handlers.cjs +0 -3
- package/dist/cjs/utils/handlers.cjs.map +1 -1
- package/dist/cjs/utils/llm.cjs +0 -1
- package/dist/cjs/utils/llm.cjs.map +1 -1
- package/dist/cjs/utils/misc.cjs +0 -16
- package/dist/cjs/utils/misc.cjs.map +1 -1
- package/dist/cjs/utils/proxy.cjs +0 -26
- package/dist/cjs/utils/proxy.cjs.map +1 -1
- package/dist/cjs/utils/run.cjs +0 -6
- package/dist/cjs/utils/run.cjs.map +1 -1
- package/dist/cjs/utils/schema.cjs +0 -5
- package/dist/cjs/utils/schema.cjs.map +1 -1
- package/dist/cjs/utils/title.cjs +0 -6
- package/dist/cjs/utils/title.cjs.map +1 -1
- package/dist/cjs/utils/tokens.cjs +0 -113
- package/dist/cjs/utils/tokens.cjs.map +1 -1
- package/dist/cjs/utils/toolContent.cjs +0 -41
- package/dist/cjs/utils/toolContent.cjs.map +1 -1
- package/dist/cjs/utils/truncation.cjs +0 -61
- package/dist/cjs/utils/truncation.cjs.map +1 -1
- package/dist/esm/agents/AgentContext.mjs +0 -356
- package/dist/esm/agents/AgentContext.mjs.map +1 -1
- package/dist/esm/agents/projection.mjs +0 -9
- package/dist/esm/agents/projection.mjs.map +1 -1
- package/dist/esm/common/constants.mjs +0 -26
- package/dist/esm/common/constants.mjs.map +1 -1
- package/dist/esm/common/enum.mjs +0 -85
- package/dist/esm/common/enum.mjs.map +1 -1
- package/dist/esm/events.mjs +0 -14
- package/dist/esm/events.mjs.map +1 -1
- package/dist/esm/graphs/Graph.mjs +1 -909
- package/dist/esm/graphs/Graph.mjs.map +1 -1
- package/dist/esm/graphs/MultiAgentGraph.mjs +7 -272
- package/dist/esm/graphs/MultiAgentGraph.mjs.map +1 -1
- package/dist/esm/graphs/applyGraphRuntimeConfig.mjs.map +1 -1
- package/dist/esm/graphs/createGraph.mjs.map +1 -1
- package/dist/esm/hitl/askUserQuestion.mjs +0 -53
- package/dist/esm/hitl/askUserQuestion.mjs.map +1 -1
- package/dist/esm/hitl/askUserQuestions.mjs +0 -20
- package/dist/esm/hitl/askUserQuestions.mjs.map +1 -1
- package/dist/esm/hitl/askUserQuestionsInterrupt.mjs +0 -6
- package/dist/esm/hitl/askUserQuestionsInterrupt.mjs.map +1 -1
- package/dist/esm/hooks/HookRegistry.mjs +0 -127
- package/dist/esm/hooks/HookRegistry.mjs.map +1 -1
- package/dist/esm/hooks/createToolPolicyHook.mjs +0 -38
- package/dist/esm/hooks/createToolPolicyHook.mjs.map +1 -1
- package/dist/esm/hooks/createWorkspacePolicyHook.mjs +0 -77
- package/dist/esm/hooks/createWorkspacePolicyHook.mjs.map +1 -1
- package/dist/esm/hooks/executeHooks.mjs +0 -79
- package/dist/esm/hooks/executeHooks.mjs.map +1 -1
- package/dist/esm/hooks/index.mjs +0 -16
- package/dist/esm/hooks/index.mjs.map +1 -1
- package/dist/esm/hooks/matchers.mjs +0 -104
- package/dist/esm/hooks/matchers.mjs.map +1 -1
- package/dist/esm/hooks/types.mjs +0 -8
- package/dist/esm/hooks/types.mjs.map +1 -1
- package/dist/esm/instrumentation.mjs +0 -14
- package/dist/esm/instrumentation.mjs.map +1 -1
- package/dist/esm/langfuse.mjs +0 -75
- package/dist/esm/langfuse.mjs.map +1 -1
- package/dist/esm/langfuseConfig.mjs.map +1 -1
- package/dist/esm/langfuseRuntimeContext.mjs +0 -13
- package/dist/esm/langfuseRuntimeContext.mjs.map +1 -1
- package/dist/esm/langfuseRuntimeScope.mjs +0 -4
- package/dist/esm/langfuseRuntimeScope.mjs.map +1 -1
- package/dist/esm/langfuseSpanRegistry.mjs +0 -28
- package/dist/esm/langfuseSpanRegistry.mjs.map +1 -1
- package/dist/esm/langfuseToolOutputTracing.mjs +0 -3
- package/dist/esm/langfuseToolOutputTracing.mjs.map +1 -1
- package/dist/esm/langfuseTraceShaping.mjs +0 -74
- package/dist/esm/langfuseTraceShaping.mjs.map +1 -1
- package/dist/esm/llm/anthropic/index.mjs +0 -3
- package/dist/esm/llm/anthropic/index.mjs.map +1 -1
- package/dist/esm/llm/anthropic/types.mjs.map +1 -1
- package/dist/esm/llm/anthropic/utils/message_inputs.mjs +1 -111
- package/dist/esm/llm/anthropic/utils/message_inputs.mjs.map +1 -1
- package/dist/esm/llm/anthropic/utils/message_outputs.mjs +0 -1
- package/dist/esm/llm/anthropic/utils/message_outputs.mjs.map +1 -1
- package/dist/esm/llm/anthropic/utils/stream_events.mjs +0 -8
- package/dist/esm/llm/anthropic/utils/stream_events.mjs.map +1 -1
- package/dist/esm/llm/anthropic/utils/tools.mjs.map +1 -1
- package/dist/esm/llm/bedrock/cachePoints.mjs.map +1 -1
- package/dist/esm/llm/bedrock/index.mjs +1 -95
- package/dist/esm/llm/bedrock/index.mjs.map +1 -1
- package/dist/esm/llm/bedrock/toolCache.mjs.map +1 -1
- package/dist/esm/llm/bedrock/utils/message_inputs.mjs +0 -78
- package/dist/esm/llm/bedrock/utils/message_inputs.mjs.map +1 -1
- package/dist/esm/llm/bedrock/utils/message_outputs.mjs +0 -24
- package/dist/esm/llm/bedrock/utils/message_outputs.mjs.map +1 -1
- package/dist/esm/llm/contextOverflowRecovery.mjs +0 -62
- package/dist/esm/llm/contextOverflowRecovery.mjs.map +1 -1
- package/dist/esm/llm/fake.mjs.map +1 -1
- package/dist/esm/llm/google/index.mjs +2 -21
- package/dist/esm/llm/google/index.mjs.map +1 -1
- package/dist/esm/llm/google/utils/common.mjs +0 -35
- package/dist/esm/llm/google/utils/common.mjs.map +1 -1
- package/dist/esm/llm/init.mjs +0 -9
- package/dist/esm/llm/init.mjs.map +1 -1
- package/dist/esm/llm/invoke.mjs +1 -270
- package/dist/esm/llm/invoke.mjs.map +1 -1
- package/dist/esm/llm/mistral/index.mjs.map +1 -1
- package/dist/esm/llm/openai/index.mjs +0 -99
- package/dist/esm/llm/openai/index.mjs.map +1 -1
- package/dist/esm/llm/openai/streamMetadata.mjs +0 -21
- package/dist/esm/llm/openai/streamMetadata.mjs.map +1 -1
- package/dist/esm/llm/openai/utils/index.mjs.map +1 -1
- package/dist/esm/llm/openrouter/index.mjs +0 -1
- package/dist/esm/llm/openrouter/index.mjs.map +1 -1
- package/dist/esm/llm/openrouter/toolCache.mjs +0 -6
- package/dist/esm/llm/openrouter/toolCache.mjs.map +1 -1
- package/dist/esm/llm/preempt.mjs +0 -75
- package/dist/esm/llm/preempt.mjs.map +1 -1
- package/dist/esm/llm/providers.mjs.map +1 -1
- package/dist/esm/llm/request.mjs +0 -10
- package/dist/esm/llm/request.mjs.map +1 -1
- package/dist/esm/llm/stream/chunkAdapters.mjs +0 -62
- package/dist/esm/llm/stream/chunkAdapters.mjs.map +1 -1
- package/dist/esm/llm/stream/smoother.mjs +0 -58
- package/dist/esm/llm/stream/smoother.mjs.map +1 -1
- package/dist/esm/llm/streamLimits.mjs +4 -293
- package/dist/esm/llm/streamLimits.mjs.map +1 -1
- package/dist/esm/llm/truncation.mjs +0 -36
- package/dist/esm/llm/truncation.mjs.map +1 -1
- package/dist/esm/llm/vertexai/index.mjs +0 -330
- package/dist/esm/llm/vertexai/index.mjs.map +1 -1
- package/dist/esm/messages/alternation.mjs +0 -43
- package/dist/esm/messages/alternation.mjs.map +1 -1
- package/dist/esm/messages/anthropicToolCache.mjs +0 -45
- package/dist/esm/messages/anthropicToolCache.mjs.map +1 -1
- package/dist/esm/messages/assistantPhase.mjs +0 -12
- package/dist/esm/messages/assistantPhase.mjs.map +1 -1
- package/dist/esm/messages/budget.mjs +0 -9
- package/dist/esm/messages/budget.mjs.map +1 -1
- package/dist/esm/messages/cache.mjs +0 -172
- package/dist/esm/messages/cache.mjs.map +1 -1
- package/dist/esm/messages/content.mjs +0 -9
- package/dist/esm/messages/content.mjs.map +1 -1
- package/dist/esm/messages/contextPruning.mjs +0 -15
- package/dist/esm/messages/contextPruning.mjs.map +1 -1
- package/dist/esm/messages/contextPruningSettings.mjs +0 -3
- package/dist/esm/messages/contextPruningSettings.mjs.map +1 -1
- package/dist/esm/messages/core.mjs +0 -48
- package/dist/esm/messages/core.mjs.map +1 -1
- package/dist/esm/messages/format.mjs +1 -345
- package/dist/esm/messages/format.mjs.map +1 -1
- package/dist/esm/messages/handoffCue.mjs +0 -36
- package/dist/esm/messages/handoffCue.mjs.map +1 -1
- package/dist/esm/messages/ids.mjs.map +1 -1
- package/dist/esm/messages/injected.mjs +0 -33
- package/dist/esm/messages/injected.mjs.map +1 -1
- package/dist/esm/messages/langchain.mjs +0 -14
- package/dist/esm/messages/langchain.mjs.map +1 -1
- package/dist/esm/messages/prune.mjs +1 -184
- package/dist/esm/messages/prune.mjs.map +1 -1
- package/dist/esm/messages/recency.mjs +0 -32
- package/dist/esm/messages/recency.mjs.map +1 -1
- package/dist/esm/messages/reducer.mjs +0 -30
- package/dist/esm/messages/reducer.mjs.map +1 -1
- package/dist/esm/messages/tools.mjs +0 -14
- package/dist/esm/messages/tools.mjs.map +1 -1
- package/dist/esm/openai/index.mjs.map +1 -1
- package/dist/esm/prompts/activityLabel.mjs +9 -79
- package/dist/esm/prompts/activityLabel.mjs.map +1 -1
- package/dist/esm/responses/index.mjs.map +1 -1
- package/dist/esm/run.mjs +2 -538
- package/dist/esm/run.mjs.map +1 -1
- package/dist/esm/session/AgentSession.mjs +1 -17
- package/dist/esm/session/AgentSession.mjs.map +1 -1
- package/dist/esm/session/JsonlSessionStore.mjs.map +1 -1
- package/dist/esm/session/handlers.mjs +0 -7
- package/dist/esm/session/handlers.mjs.map +1 -1
- package/dist/esm/session/ids.mjs.map +1 -1
- package/dist/esm/session/messageSerialization.mjs +0 -4
- package/dist/esm/session/messageSerialization.mjs.map +1 -1
- package/dist/esm/stream.mjs +1 -93
- package/dist/esm/stream.mjs.map +1 -1
- package/dist/esm/summarization/index.mjs +0 -27
- package/dist/esm/summarization/index.mjs.map +1 -1
- package/dist/esm/summarization/node.mjs +0 -273
- package/dist/esm/summarization/node.mjs.map +1 -1
- package/dist/esm/tools/BashExecutor.mjs +0 -35
- package/dist/esm/tools/BashExecutor.mjs.map +1 -1
- package/dist/esm/tools/BashProgrammaticToolCalling.mjs +0 -24
- package/dist/esm/tools/BashProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/Calculator.mjs.map +1 -1
- package/dist/esm/tools/CodeExecutor.mjs +0 -13
- package/dist/esm/tools/CodeExecutor.mjs.map +1 -1
- package/dist/esm/tools/CodeSessionFileSummary.mjs.map +1 -1
- package/dist/esm/tools/ProgrammaticToolCalling.mjs +0 -101
- package/dist/esm/tools/ProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/ReadFile.mjs.map +1 -1
- package/dist/esm/tools/SkillTool.mjs +0 -5
- package/dist/esm/tools/SkillTool.mjs.map +1 -1
- package/dist/esm/tools/SubagentTool.mjs +0 -10
- package/dist/esm/tools/SubagentTool.mjs.map +1 -1
- package/dist/esm/tools/ToolNode.mjs +6 -1038
- package/dist/esm/tools/ToolNode.mjs.map +1 -1
- package/dist/esm/tools/ToolSearch.mjs +0 -179
- package/dist/esm/tools/ToolSearch.mjs.map +1 -1
- package/dist/esm/tools/cloudflare/CloudflareBridgeRuntime.mjs.map +1 -1
- package/dist/esm/tools/cloudflare/CloudflareProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/cloudflare/CloudflareSandboxExecutionEngine.mjs +0 -39
- package/dist/esm/tools/cloudflare/CloudflareSandboxExecutionEngine.mjs.map +1 -1
- package/dist/esm/tools/cloudflare/CloudflareSandboxTools.mjs.map +1 -1
- package/dist/esm/tools/eagerEventExecution.mjs +0 -6
- package/dist/esm/tools/eagerEventExecution.mjs.map +1 -1
- package/dist/esm/tools/handlers.mjs +1 -41
- package/dist/esm/tools/handlers.mjs.map +1 -1
- package/dist/esm/tools/intentArg.mjs +1 -132
- package/dist/esm/tools/intentArg.mjs.map +1 -1
- package/dist/esm/tools/local/CompileCheckTool.mjs +0 -25
- package/dist/esm/tools/local/CompileCheckTool.mjs.map +1 -1
- package/dist/esm/tools/local/FileCheckpointer.mjs +0 -23
- package/dist/esm/tools/local/FileCheckpointer.mjs.map +1 -1
- package/dist/esm/tools/local/LocalCodingTools.mjs +0 -80
- package/dist/esm/tools/local/LocalCodingTools.mjs.map +1 -1
- package/dist/esm/tools/local/LocalExecutionEngine.mjs +0 -126
- package/dist/esm/tools/local/LocalExecutionEngine.mjs.map +1 -1
- package/dist/esm/tools/local/LocalExecutionTools.mjs.map +1 -1
- package/dist/esm/tools/local/LocalProgrammaticToolCalling.mjs +0 -12
- package/dist/esm/tools/local/LocalProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/local/attachments.mjs +0 -44
- package/dist/esm/tools/local/attachments.mjs.map +1 -1
- package/dist/esm/tools/local/bashAst.mjs +0 -16
- package/dist/esm/tools/local/bashAst.mjs.map +1 -1
- package/dist/esm/tools/local/editStrategies.mjs +0 -14
- package/dist/esm/tools/local/editStrategies.mjs.map +1 -1
- package/dist/esm/tools/local/resolveLocalExecutionTools.mjs.map +1 -1
- package/dist/esm/tools/local/syntaxCheck.mjs +0 -31
- package/dist/esm/tools/local/syntaxCheck.mjs.map +1 -1
- package/dist/esm/tools/local/textEncoding.mjs +0 -11
- package/dist/esm/tools/local/textEncoding.mjs.map +1 -1
- package/dist/esm/tools/local/workspaceFS.mjs +0 -33
- package/dist/esm/tools/local/workspaceFS.mjs.map +1 -1
- package/dist/esm/tools/ptcTimeout.mjs.map +1 -1
- package/dist/esm/tools/schema.mjs +0 -8
- package/dist/esm/tools/schema.mjs.map +1 -1
- package/dist/esm/tools/search/anthropic.mjs +0 -9
- package/dist/esm/tools/search/anthropic.mjs.map +1 -1
- package/dist/esm/tools/search/content.mjs.map +1 -1
- package/dist/esm/tools/search/crw-scraper.mjs +0 -33
- package/dist/esm/tools/search/crw-scraper.mjs.map +1 -1
- package/dist/esm/tools/search/crw-search.mjs +0 -2
- package/dist/esm/tools/search/crw-search.mjs.map +1 -1
- package/dist/esm/tools/search/firecrawl.mjs +0 -25
- package/dist/esm/tools/search/firecrawl.mjs.map +1 -1
- package/dist/esm/tools/search/format.mjs +0 -30
- package/dist/esm/tools/search/format.mjs.map +1 -1
- package/dist/esm/tools/search/highlights.mjs +0 -16
- package/dist/esm/tools/search/highlights.mjs.map +1 -1
- package/dist/esm/tools/search/keenable-scraper.mjs +0 -8
- package/dist/esm/tools/search/keenable-scraper.mjs.map +1 -1
- package/dist/esm/tools/search/keenable-search.mjs +0 -7
- package/dist/esm/tools/search/keenable-search.mjs.map +1 -1
- package/dist/esm/tools/search/rerankers.mjs +0 -35
- package/dist/esm/tools/search/rerankers.mjs.map +1 -1
- package/dist/esm/tools/search/schema.mjs +0 -1
- package/dist/esm/tools/search/schema.mjs.map +1 -1
- package/dist/esm/tools/search/search.mjs +1 -14
- package/dist/esm/tools/search/search.mjs.map +1 -1
- package/dist/esm/tools/search/serper-scraper.mjs +0 -46
- package/dist/esm/tools/search/serper-scraper.mjs.map +1 -1
- package/dist/esm/tools/search/tavily-scraper.mjs.map +1 -1
- package/dist/esm/tools/search/tavily-search.mjs.map +1 -1
- package/dist/esm/tools/search/tool.mjs +0 -25
- package/dist/esm/tools/search/tool.mjs.map +1 -1
- package/dist/esm/tools/search/utils.mjs +0 -8
- package/dist/esm/tools/search/utils.mjs.map +1 -1
- package/dist/esm/tools/skillCatalog.mjs +0 -6
- package/dist/esm/tools/skillCatalog.mjs.map +1 -1
- package/dist/esm/tools/streamedToolCallSeals.mjs +0 -6
- package/dist/esm/tools/streamedToolCallSeals.mjs.map +1 -1
- package/dist/esm/tools/subagent/SubagentExecutionRegistry.mjs +0 -2
- package/dist/esm/tools/subagent/SubagentExecutionRegistry.mjs.map +1 -1
- package/dist/esm/tools/subagent/SubagentExecutor.mjs +3 -213
- package/dist/esm/tools/subagent/SubagentExecutor.mjs.map +1 -1
- package/dist/esm/tools/subagent/SubagentReplay.mjs.map +1 -1
- package/dist/esm/tools/subagent/childGraphConfig.mjs +0 -4
- package/dist/esm/tools/subagent/childGraphConfig.mjs.map +1 -1
- package/dist/esm/tools/subagent/runtimeLimits.mjs.map +1 -1
- package/dist/esm/tools/toolOutputReferences.mjs +1 -322
- package/dist/esm/tools/toolOutputReferences.mjs.map +1 -1
- package/dist/esm/types/hitl.mjs +0 -5
- package/dist/esm/types/hitl.mjs.map +1 -1
- package/dist/esm/utils/callbacks.mjs.map +1 -1
- package/dist/esm/utils/errors.mjs +14 -165
- package/dist/esm/utils/errors.mjs.map +1 -1
- package/dist/esm/utils/events.mjs +0 -10
- package/dist/esm/utils/events.mjs.map +1 -1
- package/dist/esm/utils/graph.mjs.map +1 -1
- package/dist/esm/utils/handlers.mjs +0 -3
- package/dist/esm/utils/handlers.mjs.map +1 -1
- package/dist/esm/utils/llm.mjs +0 -1
- package/dist/esm/utils/llm.mjs.map +1 -1
- package/dist/esm/utils/misc.mjs +0 -16
- package/dist/esm/utils/misc.mjs.map +1 -1
- package/dist/esm/utils/proxy.mjs +0 -26
- package/dist/esm/utils/proxy.mjs.map +1 -1
- package/dist/esm/utils/run.mjs +0 -6
- package/dist/esm/utils/run.mjs.map +1 -1
- package/dist/esm/utils/schema.mjs +0 -5
- package/dist/esm/utils/schema.mjs.map +1 -1
- package/dist/esm/utils/title.mjs +0 -6
- package/dist/esm/utils/title.mjs.map +1 -1
- package/dist/esm/utils/tokens.mjs +0 -113
- package/dist/esm/utils/tokens.mjs.map +1 -1
- package/dist/esm/utils/toolContent.mjs +0 -41
- package/dist/esm/utils/toolContent.mjs.map +1 -1
- package/dist/esm/utils/truncation.mjs +0 -61
- package/dist/esm/utils/truncation.mjs.map +1 -1
- package/dist/types/agents/AgentContext.d.ts +3 -3
- package/dist/types/agents/__tests__/promptCacheLiveHelpers.d.ts +3 -3
- package/dist/types/agents/projection.d.ts +1 -1
- package/dist/types/events.d.ts +2 -2
- package/dist/types/graphs/Graph.d.ts +11 -11
- package/dist/types/graphs/MultiAgentGraph.d.ts +2 -2
- package/dist/types/graphs/createGraph.d.ts +4 -4
- package/dist/types/graphs/graphFactory.d.ts +1 -1
- package/dist/types/hitl/askUserQuestion.d.ts +1 -1
- package/dist/types/hitl/askUserQuestions.d.ts +1 -1
- package/dist/types/hitl/askUserQuestionsInterrupt.d.ts +1 -1
- package/dist/types/hooks/types.d.ts +1 -1
- package/dist/types/instrumentation.d.ts +1 -1
- package/dist/types/langfuse.d.ts +3 -3
- package/dist/types/langfuseConfig.d.ts +2 -2
- package/dist/types/langfuseRuntimeContext.d.ts +1 -1
- package/dist/types/langfuseRuntimeScope.d.ts +2 -2
- package/dist/types/langfuseSpanRegistry.d.ts +1 -1
- package/dist/types/langfuseToolOutputTracing.d.ts +3 -3
- package/dist/types/llm/anthropic/index.d.ts +1 -1
- package/dist/types/llm/bedrock/index.d.ts +1 -1
- package/dist/types/llm/bedrock/toolCache.d.ts +2 -2
- package/dist/types/llm/contextOverflowRecovery.d.ts +2 -2
- package/dist/types/llm/google/index.d.ts +1 -1
- package/dist/types/llm/init.d.ts +2 -2
- package/dist/types/llm/invoke.d.ts +6 -6
- package/dist/types/llm/mistral/index.d.ts +1 -1
- package/dist/types/llm/openai/index.d.ts +2 -2
- package/dist/types/llm/openrouter/index.d.ts +2 -2
- package/dist/types/llm/openrouter/toolCache.d.ts +2 -2
- package/dist/types/llm/providers.d.ts +2 -2
- package/dist/types/llm/request.d.ts +2 -2
- package/dist/types/llm/stream/chunkAdapters.d.ts +1 -1
- package/dist/types/llm/streamLimits.d.ts +1 -1
- package/dist/types/llm/truncation.d.ts +1 -1
- package/dist/types/llm/vertexai/index.d.ts +1 -1
- package/dist/types/messages/alternation.d.ts +1 -1
- package/dist/types/messages/anthropicToolCache.d.ts +2 -2
- package/dist/types/messages/assistantPhase.d.ts +3 -3
- package/dist/types/messages/budget.d.ts +1 -1
- package/dist/types/messages/cache.d.ts +1 -1
- package/dist/types/messages/contextPruning.d.ts +2 -2
- package/dist/types/messages/core.d.ts +2 -2
- package/dist/types/messages/format.d.ts +2 -2
- package/dist/types/messages/ids.d.ts +2 -2
- package/dist/types/messages/injected.d.ts +1 -1
- package/dist/types/messages/langchain.d.ts +1 -1
- package/dist/types/messages/prune.d.ts +3 -3
- package/dist/types/openai/index.d.ts +1 -1
- package/dist/types/prompts/activityLabel.d.ts +2 -2
- package/dist/types/responses/index.d.ts +1 -1
- package/dist/types/run.d.ts +3 -3
- package/dist/types/session/handlers.d.ts +1 -1
- package/dist/types/session/types.d.ts +1 -1
- package/dist/types/stream.d.ts +4 -4
- package/dist/types/summarization/index.d.ts +1 -1
- package/dist/types/summarization/node.d.ts +6 -6
- package/dist/types/test/mockTools.d.ts +1 -1
- package/dist/types/tools/BashExecutor.d.ts +2 -2
- package/dist/types/tools/BashProgrammaticToolCalling.d.ts +2 -2
- package/dist/types/tools/CodeExecutor.d.ts +3 -3
- package/dist/types/tools/CodeSessionFileSummary.d.ts +1 -1
- package/dist/types/tools/ProgrammaticToolCalling.d.ts +2 -2
- package/dist/types/tools/ReadFile.d.ts +1 -1
- package/dist/types/tools/SkillTool.d.ts +1 -1
- package/dist/types/tools/SubagentTool.d.ts +3 -3
- package/dist/types/tools/ToolNode.d.ts +5 -5
- package/dist/types/tools/ToolSearch.d.ts +2 -2
- package/dist/types/tools/cloudflare/CloudflareBridgeRuntime.d.ts +1 -1
- package/dist/types/tools/cloudflare/CloudflareProgrammaticToolCalling.d.ts +1 -1
- package/dist/types/tools/cloudflare/CloudflareSandboxExecutionEngine.d.ts +2 -2
- package/dist/types/tools/cloudflare/CloudflareSandboxTools.d.ts +1 -1
- package/dist/types/tools/eagerEventExecution.d.ts +1 -1
- package/dist/types/tools/handlers.d.ts +3 -3
- package/dist/types/tools/intentArg.d.ts +1 -1
- package/dist/types/tools/local/CompileCheckTool.d.ts +2 -2
- package/dist/types/tools/local/FileCheckpointer.d.ts +1 -1
- package/dist/types/tools/local/LocalCodingTools.d.ts +2 -2
- package/dist/types/tools/local/LocalExecutionEngine.d.ts +1 -1
- package/dist/types/tools/local/LocalExecutionTools.d.ts +1 -1
- package/dist/types/tools/local/LocalProgrammaticToolCalling.d.ts +1 -1
- package/dist/types/tools/local/bashAst.d.ts +1 -1
- package/dist/types/tools/local/resolveLocalExecutionTools.d.ts +1 -1
- package/dist/types/tools/local/syntaxCheck.d.ts +1 -1
- package/dist/types/tools/ptcTimeout.d.ts +1 -1
- package/dist/types/tools/schema.d.ts +1 -1
- package/dist/types/tools/search/anthropic.d.ts +1 -1
- package/dist/types/tools/skillCatalog.d.ts +1 -1
- package/dist/types/tools/subagent/SubagentExecutor.d.ts +5 -5
- package/dist/types/tools/subagent/SubagentReplay.d.ts +3 -3
- package/dist/types/tools/subagent/childGraphConfig.d.ts +2 -2
- package/dist/types/types/activityLabel.d.ts +3 -3
- package/dist/types/types/graph.d.ts +7 -7
- package/dist/types/types/llm.d.ts +9 -9
- package/dist/types/types/run.d.ts +7 -7
- package/dist/types/types/stream.d.ts +5 -5
- package/dist/types/types/summarize.d.ts +2 -2
- package/dist/types/types/tools.d.ts +5 -5
- package/dist/types/utils/__tests__/fixtures/contextOverflowSignatures.d.ts +1 -1
- package/dist/types/utils/errors.d.ts +1 -1
- package/dist/types/utils/events.d.ts +1 -1
- package/dist/types/utils/handlers.d.ts +3 -3
- package/dist/types/utils/llm.d.ts +1 -1
- package/dist/types/utils/llmConfig.d.ts +1 -1
- package/dist/types/utils/title.d.ts +1 -1
- package/package.json +10 -3
- package/src/__tests__/stream.eagerArgsDivergence.test.ts +0 -911
- package/src/__tests__/stream.eagerEventExecution.test.ts +0 -5046
- package/src/__tests__/stream.streamLimits.test.ts +0 -1982
- package/src/agents/__tests__/AgentContext.anthropic.live.test.ts +0 -448
- package/src/agents/__tests__/AgentContext.bedrock.live.test.ts +0 -655
- package/src/agents/__tests__/AgentContext.openrouter.live.test.ts +0 -128
- package/src/agents/__tests__/AgentContext.overflow.test.ts +0 -205
- package/src/agents/__tests__/AgentContext.test.ts +0 -2425
- package/src/agents/__tests__/projection.test.ts +0 -73
- package/src/agents/__tests__/promptCacheLiveHelpers.ts +0 -175
- package/src/aggregator.test.ts +0 -1214
- package/src/graphs/__tests__/Graph.breakerLifecycle.test.ts +0 -273
- package/src/graphs/__tests__/Graph.closeRunStep.test.ts +0 -385
- package/src/graphs/__tests__/Graph.contextOverflow.test.ts +0 -1766
- package/src/graphs/__tests__/Graph.preemptSignal.test.ts +0 -126
- package/src/graphs/__tests__/Graph.reasoning.test.ts +0 -1717
- package/src/graphs/__tests__/Graph.subagentResumeState.test.ts +0 -80
- package/src/graphs/__tests__/MultiAgentGraph.test.ts +0 -177
- package/src/graphs/__tests__/composition.smoke.test.ts +0 -509
- package/src/graphs/__tests__/createGraph.test.ts +0 -206
- package/src/hooks/__tests__/HookRegistry.test.ts +0 -334
- package/src/hooks/__tests__/compactHooks.test.ts +0 -250
- package/src/hooks/__tests__/createToolPolicyHook.test.ts +0 -268
- package/src/hooks/__tests__/createWorkspacePolicyHook.test.ts +0 -405
- package/src/hooks/__tests__/executeHooks.test.ts +0 -1294
- package/src/hooks/__tests__/integration.test.ts +0 -337
- package/src/hooks/__tests__/matchers.test.ts +0 -238
- package/src/hooks/__tests__/preemptBoundary.test.ts +0 -152
- package/src/hooks/__tests__/toolHooks.test.ts +0 -669
- package/src/llm/__tests__/contextOverflowRecovery.test.ts +0 -401
- package/src/llm/__tests__/fallbackOverflow.test.ts +0 -287
- package/src/llm/anthropic/Jacob_Lee_Resume_2023.pdf +0 -0
- package/src/llm/anthropic/inherited-content-utils.spec.ts +0 -249
- package/src/llm/anthropic/inherited-stream-events.spec.ts +0 -1259
- package/src/llm/anthropic/inherited-strict.spec.ts +0 -302
- package/src/llm/anthropic/llm.spec.ts +0 -3394
- package/src/llm/anthropic/utils/cross-provider-reasoning.test.ts +0 -383
- package/src/llm/anthropic/utils/cross-provider-server-tools.test.ts +0 -110
- package/src/llm/anthropic/utils/server-tool-inputs.test.ts +0 -508
- package/src/llm/anthropic/utils/streaming-tool-input.test.ts +0 -361
- package/src/llm/anthropic/utils/stripPrefillCache.test.ts +0 -111
- package/src/llm/anthropic/utils/tool-id-normalization.test.ts +0 -287
- package/src/llm/bedrock/inherited-cache.spec.ts +0 -144
- package/src/llm/bedrock/inherited.spec.ts +0 -724
- package/src/llm/bedrock/llm.spec.ts +0 -1533
- package/src/llm/bedrock/streamSealDispatch.test.ts +0 -331
- package/src/llm/bedrock/toolCache.test.ts +0 -194
- package/src/llm/bedrock/utils/cross-provider-reasoning.test.ts +0 -131
- package/src/llm/bedrock/utils/cross-provider-server-tools.test.ts +0 -122
- package/src/llm/bedrock/utils/message_inputs.test.ts +0 -650
- package/src/llm/bedrock/utils/message_outputs.test.ts +0 -85
- package/src/llm/bedrock/utils/toolResultCachePoint.test.ts +0 -118
- package/src/llm/custom-chat-models.smoke.test.ts +0 -1966
- package/src/llm/google/data/gettysburg10.wav +0 -0
- package/src/llm/google/data/hotdog.jpg +0 -0
- package/src/llm/google/inherited-stream-events.spec.ts +0 -350
- package/src/llm/google/llm.spec.ts +0 -1388
- package/src/llm/google/streamSmoothing.test.ts +0 -121
- package/src/llm/google/utils/common.test.ts +0 -196
- package/src/llm/invoke.alternation.test.ts +0 -87
- package/src/llm/invoke.handoffCue.test.ts +0 -112
- package/src/llm/invoke.streamLimits.test.ts +0 -142
- package/src/llm/invoke.test.ts +0 -1198
- package/src/llm/mistral/streamSmoothing.test.ts +0 -97
- package/src/llm/openai/cacheWriteTokens.test.ts +0 -112
- package/src/llm/openai/contentBlocks.test.ts +0 -381
- package/src/llm/openai/deepseek.test.ts +0 -747
- package/src/llm/openai/inherited-deepseek.spec.ts +0 -347
- package/src/llm/openai/inherited-xai.spec.ts +0 -416
- package/src/llm/openai/llm.spec.ts +0 -1774
- package/src/llm/openai/managedRequests.test.ts +0 -182
- package/src/llm/openai/sequentialToolCallSeals.test.ts +0 -199
- package/src/llm/openai/streamMetadata.spec.ts +0 -86
- package/src/llm/openai/streamMetadataDedup.spec.ts +0 -166
- package/src/llm/openai/utils/isReasoningModel.test.ts +0 -90
- package/src/llm/openai/utils/messages.test.ts +0 -488
- package/src/llm/openrouter/reasoning.test.ts +0 -561
- package/src/llm/openrouter/toolCache.test.ts +0 -134
- package/src/llm/preempt.test.ts +0 -323
- package/src/llm/stream/chunkAdapters.test.ts +0 -202
- package/src/llm/stream/reassembly.test.ts +0 -241
- package/src/llm/stream/smoother.bench.test.ts +0 -155
- package/src/llm/stream/smoother.test.ts +0 -519
- package/src/llm/streamLimits.test.ts +0 -450
- package/src/llm/truncation.test.ts +0 -242
- package/src/llm/vertexai/fixThoughtSignatures.test.ts +0 -154
- package/src/llm/vertexai/inherited-stream-events.spec.ts +0 -271
- package/src/llm/vertexai/llm.spec.ts +0 -159
- package/src/llm/vertexai/repairUsageMetadata.test.ts +0 -54
- package/src/llm/vertexai/sealStreamedToolCalls.test.ts +0 -88
- package/src/llm/vertexai/streamSealDispatch.test.ts +0 -148
- package/src/llm/vertexai/streamSmoothing.test.ts +0 -109
- package/src/messages/__tests__/anthropicToolCache.test.ts +0 -339
- package/src/messages/__tests__/observationMasking.test.ts +0 -312
- package/src/messages/__tests__/recency.test.ts +0 -267
- package/src/messages/__tests__/tools.test.ts +0 -473
- package/src/messages/alternation.test.ts +0 -212
- package/src/messages/assistantPhase.test.ts +0 -75
- package/src/messages/cache.tail.test.ts +0 -533
- package/src/messages/cache.test.ts +0 -2166
- package/src/messages/content.test.ts +0 -362
- package/src/messages/contextPruning.test.ts +0 -184
- package/src/messages/ensureThinkingBlock.test.ts +0 -1427
- package/src/messages/foldToollessToolBlocks.test.ts +0 -596
- package/src/messages/formatAgentMessages.reducer.test.ts +0 -162
- package/src/messages/formatAgentMessages.skills.test.ts +0 -513
- package/src/messages/formatAgentMessages.steer.test.ts +0 -598
- package/src/messages/formatAgentMessages.test.ts +0 -8111
- package/src/messages/formatAgentMessages.tools.test.ts +0 -522
- package/src/messages/formatMessage.test.ts +0 -693
- package/src/messages/handoffCue.test.ts +0 -96
- package/src/messages/injected.test.ts +0 -107
- package/src/messages/labelContentByAgent.test.ts +0 -962
- package/src/messages/reducer.spec.ts +0 -32
- package/src/messages/shiftIndexTokenCountMap.test.ts +0 -81
- package/src/messages/tailCacheConversion.test.ts +0 -161
- package/src/openai/__tests__/openai.test.ts +0 -337
- package/src/responses/__tests__/responses.test.ts +0 -652
- package/src/scripts/abort.ts +0 -157
- package/src/scripts/activity-labels/captured.json +0 -56
- package/src/scripts/activity-labels/checks.cjs +0 -205
- package/src/scripts/activity-labels/corpus.cjs +0 -473
- package/src/scripts/activity-labels/report.cjs +0 -203
- package/src/scripts/activity-labels/rescore.cjs +0 -102
- package/src/scripts/activity-labels/run.ts +0 -705
- package/src/scripts/activity-labels/variants.ts +0 -71
- package/src/scripts/ant_web_search.ts +0 -159
- package/src/scripts/ant_web_search_edge_case.ts +0 -163
- package/src/scripts/ant_web_search_error_edge_case.ts +0 -149
- package/src/scripts/args.ts +0 -48
- package/src/scripts/bedrock-cache-debug.ts +0 -250
- package/src/scripts/bedrock-content-aggregation-test.ts +0 -266
- package/src/scripts/bedrock-merge-test.ts +0 -107
- package/src/scripts/bedrock-parallel-tools-test.ts +0 -204
- package/src/scripts/bench-prompt-cache.ts +0 -479
- package/src/scripts/caching.ts +0 -132
- package/src/scripts/cli.ts +0 -172
- package/src/scripts/cli2.ts +0 -133
- package/src/scripts/cli3.ts +0 -184
- package/src/scripts/cli4.ts +0 -191
- package/src/scripts/cli5.ts +0 -191
- package/src/scripts/code_exec.ts +0 -214
- package/src/scripts/code_exec_files.ts +0 -237
- package/src/scripts/code_exec_multi_session.ts +0 -237
- package/src/scripts/code_exec_ptc.ts +0 -335
- package/src/scripts/code_exec_session.ts +0 -283
- package/src/scripts/code_exec_simple.ts +0 -148
- package/src/scripts/compare_pi_vs_ours.ts +0 -1259
- package/src/scripts/content.ts +0 -139
- package/src/scripts/context-overflow-probe.ts +0 -997
- package/src/scripts/empty_input.ts +0 -137
- package/src/scripts/handoff-test.ts +0 -134
- package/src/scripts/local_engine.ts +0 -166
- package/src/scripts/local_engine_checkpointer.ts +0 -205
- package/src/scripts/local_engine_compile.ts +0 -263
- package/src/scripts/local_engine_hooks.ts +0 -226
- package/src/scripts/local_engine_image.ts +0 -201
- package/src/scripts/local_engine_ptc.ts +0 -151
- package/src/scripts/local_engine_workspace.ts +0 -258
- package/src/scripts/memory.ts +0 -107
- package/src/scripts/multi-agent-chain.ts +0 -332
- package/src/scripts/multi-agent-conditional.ts +0 -222
- package/src/scripts/multi-agent-document-review-chain.ts +0 -198
- package/src/scripts/multi-agent-hybrid-flow.ts +0 -311
- package/src/scripts/multi-agent-parallel-start.ts +0 -265
- package/src/scripts/multi-agent-parallel.ts +0 -395
- package/src/scripts/multi-agent-sequence.ts +0 -217
- package/src/scripts/multi-agent-subagent.ts +0 -246
- package/src/scripts/multi-agent-supervisor.ts +0 -366
- package/src/scripts/multi-agent-test.ts +0 -187
- package/src/scripts/openrouter_prompt_cache_live.ts +0 -310
- package/src/scripts/parallel-asymmetric-tools-test.ts +0 -275
- package/src/scripts/parallel-full-metadata-test.ts +0 -241
- package/src/scripts/parallel-tools-test.ts +0 -341
- package/src/scripts/preempt-probe.ts +0 -330
- package/src/scripts/preempt-scenarios.ts +0 -388
- package/src/scripts/programmatic_exec.ts +0 -387
- package/src/scripts/programmatic_exec_agent.ts +0 -232
- package/src/scripts/search.ts +0 -147
- package/src/scripts/sequential-full-metadata-test.ts +0 -198
- package/src/scripts/session_live.ts +0 -548
- package/src/scripts/simple.ts +0 -226
- package/src/scripts/single-agent-metadata-test.ts +0 -196
- package/src/scripts/stream.ts +0 -141
- package/src/scripts/subagent-configurable-inheritance.ts +0 -252
- package/src/scripts/subagent-event-driven-debug.ts +0 -190
- package/src/scripts/subagent-tools-debug.ts +0 -160
- package/src/scripts/subagent-usage-sink.ts +0 -176
- package/src/scripts/summarization-recency.ts +0 -462
- package/src/scripts/test-custom-prompt-key.ts +0 -145
- package/src/scripts/test-handoff-input.ts +0 -170
- package/src/scripts/test-handoff-preamble.ts +0 -278
- package/src/scripts/test-handoff-steering.ts +0 -430
- package/src/scripts/test-multi-agent-list-handoff.ts +0 -418
- package/src/scripts/test-parallel-agent-labeling.ts +0 -327
- package/src/scripts/test-parallel-handoffs.ts +0 -292
- package/src/scripts/test-thinking-handoff-bedrock.ts +0 -154
- package/src/scripts/test-thinking-handoff.ts +0 -156
- package/src/scripts/test-thinking-to-thinking-handoff-bedrock.ts +0 -166
- package/src/scripts/test-tool-before-handoff-role-order.ts +0 -276
- package/src/scripts/test-tools-before-handoff.ts +0 -222
- package/src/scripts/test_code_api.ts +0 -354
- package/src/scripts/thinking-bedrock.ts +0 -160
- package/src/scripts/thinking-vertexai.ts +0 -168
- package/src/scripts/thinking.ts +0 -172
- package/src/scripts/tool_search.ts +0 -153
- package/src/scripts/tools.ts +0 -163
- package/src/session/__tests__/JsonlSessionStore.test.ts +0 -1463
- package/src/session/__tests__/handlers.test.ts +0 -161
- package/src/specs/activity-label-observability.live.test.ts +0 -262
- package/src/specs/activity-label-observability.test.ts +0 -167
- package/src/specs/activity-label-prompt.test.ts +0 -359
- package/src/specs/activity-label-trace-seed.test.ts +0 -47
- package/src/specs/activity-phase-label.test.ts +0 -306
- package/src/specs/agent-handoffs.live.test.ts +0 -140
- package/src/specs/agent-handoffs.test.ts +0 -2465
- package/src/specs/anthropic.simple.test.ts +0 -453
- package/src/specs/ask-user-question-batch.test.ts +0 -289
- package/src/specs/ask-user-questions.live.test.ts +0 -185
- package/src/specs/ask-user-questions.test.ts +0 -293
- package/src/specs/azure.simple.test.ts +0 -502
- package/src/specs/bedrock-toolless.live.test.ts +0 -123
- package/src/specs/bedrock-truncation.live.test.ts +0 -191
- package/src/specs/cache.simple.test.ts +0 -416
- package/src/specs/context-accuracy.live.test.ts +0 -409
- package/src/specs/context-overflow-recovery.live.test.ts +0 -213
- package/src/specs/context-usage-event.test.ts +0 -117
- package/src/specs/context-usage.live.test.ts +0 -297
- package/src/specs/custom-event-await.test.ts +0 -304
- package/src/specs/deepseek.simple.test.ts +0 -290
- package/src/specs/deterministic-trace-id.test.ts +0 -43
- package/src/specs/discovered-tools.test.ts +0 -217
- package/src/specs/durability-checkpoint.integration.test.ts +0 -243
- package/src/specs/graph-subagent.live.test.ts +0 -242
- package/src/specs/graph-subagent.test.ts +0 -322
- package/src/specs/handoffCue.test.ts +0 -165
- package/src/specs/langfuse-callbacks.test.ts +0 -1578
- package/src/specs/langfuse-config.test.ts +0 -247
- package/src/specs/langfuse-instrumentation.test.ts +0 -393
- package/src/specs/langfuse-metadata.test.ts +0 -245
- package/src/specs/langfuse-routing.integration.test.ts +0 -844
- package/src/specs/langfuse-runtime-context.test.ts +0 -92
- package/src/specs/langfuse-span-registry.test.ts +0 -87
- package/src/specs/langfuse-tool-output-tracing.test.ts +0 -1858
- package/src/specs/langfuse-trace-shaping.test.ts +0 -591
- package/src/specs/moonshot.simple.test.ts +0 -367
- package/src/specs/multi-agent-summarization.test.ts +0 -396
- package/src/specs/openai.simple.test.ts +0 -315
- package/src/specs/openrouter.simple.test.ts +0 -275
- package/src/specs/preemptSeal.test.ts +0 -678
- package/src/specs/prune.test.ts +0 -3741
- package/src/specs/reasoning.test.ts +0 -201
- package/src/specs/run-step-timestamps.test.ts +0 -414
- package/src/specs/spec.utils.ts +0 -15
- package/src/specs/subagent.test.ts +0 -864
- package/src/specs/summarization-unit.test.ts +0 -973
- package/src/specs/summarization.test.ts +0 -3823
- package/src/specs/summarize-prune.test.ts +0 -376
- package/src/specs/thinking-handoff.test.ts +0 -621
- package/src/specs/thinking-prune.test.ts +0 -827
- package/src/specs/token-accounting-e2e.test.ts +0 -1034
- package/src/specs/token-accounting-pipeline.test.ts +0 -1008
- package/src/specs/token-distribution-edge-case.test.ts +0 -315
- package/src/specs/token-memoization.test.ts +0 -40
- package/src/specs/tokens.test.ts +0 -1000
- package/src/specs/tool-error-resume.test.ts +0 -194
- package/src/specs/tool-error.test.ts +0 -198
- package/src/specs/vllm-reasoning-toolcalls.test.ts +0 -340
- package/src/stream.dispatch.test.ts +0 -63
- package/src/stream.test.ts +0 -144
- package/src/summarization/__tests__/aggregator.test.ts +0 -236
- package/src/summarization/__tests__/node.test.ts +0 -1996
- package/src/summarization/__tests__/trigger.test.ts +0 -149
- package/src/summarization/chunkHandler.test.ts +0 -196
- package/src/test/mockTools.ts +0 -386
- package/src/tools/Calculator.test.ts +0 -278
- package/src/tools/__tests__/BashExecutor.test.ts +0 -108
- package/src/tools/__tests__/CloudflareSandboxExecution.test.ts +0 -939
- package/src/tools/__tests__/CodeApiAuthHeaders.test.ts +0 -858
- package/src/tools/__tests__/CodeExecutor.stateful.test.ts +0 -124
- package/src/tools/__tests__/LocalExecutionRoots.test.ts +0 -8
- package/src/tools/__tests__/LocalExecutionTools.test.ts +0 -2733
- package/src/tools/__tests__/ProgrammaticToolCalling.integration.test.ts +0 -318
- package/src/tools/__tests__/ProgrammaticToolCalling.test.ts +0 -1557
- package/src/tools/__tests__/ReadFile.test.ts +0 -44
- package/src/tools/__tests__/SkillTool.test.ts +0 -442
- package/src/tools/__tests__/SubagentExecutor.test.ts +0 -3728
- package/src/tools/__tests__/SubagentReplay.test.ts +0 -329
- package/src/tools/__tests__/SubagentTool.test.ts +0 -149
- package/src/tools/__tests__/ToolNode.breakerSignal.test.ts +0 -595
- package/src/tools/__tests__/ToolNode.eagerEventExecution.test.ts +0 -1191
- package/src/tools/__tests__/ToolNode.invalidToolCalls.test.ts +0 -757
- package/src/tools/__tests__/ToolNode.langfuse.test.ts +0 -57
- package/src/tools/__tests__/ToolNode.onResultCompletion.test.ts +0 -736
- package/src/tools/__tests__/ToolNode.outputReferences.test.ts +0 -1710
- package/src/tools/__tests__/ToolNode.runtimeState.test.ts +0 -120
- package/src/tools/__tests__/ToolNode.session.test.ts +0 -1352
- package/src/tools/__tests__/ToolNode.streamLimits.test.ts +0 -69
- package/src/tools/__tests__/ToolSearch.integration.test.ts +0 -161
- package/src/tools/__tests__/ToolSearch.test.ts +0 -1227
- package/src/tools/__tests__/annotateMessagesForLLM.test.ts +0 -561
- package/src/tools/__tests__/directToolHITLResumeScope.test.ts +0 -980
- package/src/tools/__tests__/directToolHooks.test.ts +0 -700
- package/src/tools/__tests__/eagerEventExecution.session.test.ts +0 -92
- package/src/tools/__tests__/handlers.test.ts +0 -997
- package/src/tools/__tests__/hitl.test.ts +0 -4663
- package/src/tools/__tests__/intentArg.test.ts +0 -357
- package/src/tools/__tests__/intentCoverage.test.ts +0 -139
- package/src/tools/__tests__/localToolNames.test.ts +0 -75
- package/src/tools/__tests__/skillCatalog.test.ts +0 -161
- package/src/tools/__tests__/subagentHooks.test.ts +0 -1651
- package/src/tools/__tests__/toolOutputReferences.test.ts +0 -515
- package/src/tools/__tests__/workspaceSeam.test.ts +0 -147
- package/src/tools/local/__tests__/FileCheckpointer.test.ts +0 -162
- package/src/tools/local/__tests__/editStrategies.test.ts +0 -134
- package/src/tools/search/content.test.ts +0 -173
- package/src/tools/search/crw.test.ts +0 -836
- package/src/tools/search/format.test.ts +0 -242
- package/src/tools/search/http-agent.test.ts +0 -133
- package/src/tools/search/jina-reranker.test.ts +0 -306
- package/src/tools/search/keenable-scraper.test.ts +0 -153
- package/src/tools/search/keenable.test.ts +0 -183
- package/src/tools/search/outcome.test.ts +0 -90
- package/src/tools/search/output.md +0 -2775
- package/src/tools/search/rag-api-reranker.test.ts +0 -891
- package/src/tools/search/source-processing.test.ts +0 -516
- package/src/tools/search/tavily.test.ts +0 -965
- package/src/tools/search/test.html +0 -884
- package/src/tools/search/test.md +0 -643
- package/src/tools/subagent/__tests__/SubagentExecutionRegistry.test.ts +0 -637
- package/src/tools/subagent/__tests__/SubagentExecutor.lazy.test.ts +0 -3054
- package/src/tools/subagent/__tests__/childGraphConfig.test.ts +0 -521
- package/src/utils/__tests__/apportion.test.ts +0 -32
- package/src/utils/__tests__/errors.test.ts +0 -270
- package/src/utils/__tests__/fixtures/contextOverflowSignatures.ts +0 -336
- package/src/utils/__tests__/redactSecrets.test.ts +0 -56
- package/src/utils/__tests__/truncation.test.ts +0 -66
- package/src/utils/llm.test.ts +0 -18
- package/src/utils/proxy.test.ts +0 -176
- package/src/utils/toolContent.test.ts +0 -1432
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalCodingTools.cjs","names":["withIntent","truncateLocalOutput","runPostEditSyntaxCheck","path","encodeFile","isWorkspaceClientTimeoutError","getWorkspaceFS","resolveWorkspacePathSafe","classifyAttachment","imageAttachmentContent","decodeFile","diff","locateEdit","applyEdit","getSpawn","spawnLocalProcess","input","createLocalFileCheckpointer","createCompileCheckTool","createLocalBashExecutionTool","createLocalCodeExecutionTool","createLocalProgrammaticToolCallingTool","createLocalBashProgrammaticToolCallingTool","createCompileCheckToolDefinition"],"sources":["../../../../src/tools/local/LocalCodingTools.ts"],"sourcesContent":["import { basename, dirname } from 'path';\nimport { createTwoFilesPatch } from 'diff';\nimport { tool } from '@langchain/core/tools';\nimport type { DynamicStructuredTool } from '@langchain/core/tools';\nimport type * as t from '@/types';\nimport {\n createLocalBashProgrammaticToolCallingTool,\n createLocalProgrammaticToolCallingTool,\n} from './LocalProgrammaticToolCalling';\nimport {\n getSpawn,\n getWorkspaceFS,\n resolveWorkspacePathSafe,\n spawnLocalProcess,\n truncateLocalOutput,\n} from './LocalExecutionEngine';\nimport {\n createLocalBashExecutionTool,\n createLocalCodeExecutionTool,\n} from './LocalExecutionTools';\nimport {\n createCompileCheckTool,\n createCompileCheckToolDefinition,\n} from './CompileCheckTool';\nimport { classifyAttachment, imageAttachmentContent } from './attachments';\nimport { createLocalFileCheckpointer } from './FileCheckpointer';\nimport { isWorkspaceClientTimeoutError } from './workspaceFS';\nimport { applyEdit, locateEdit } from './editStrategies';\nimport { decodeFile, encodeFile } from './textEncoding';\nimport { runPostEditSyntaxCheck } from './syntaxCheck';\nimport { withIntent } from '@/tools/intentArg';\nimport { Constants } from '@/common';\n\nconst MAX_READ_CHARS = 256000;\nconst DEFAULT_MAX_RESULTS = 200;\nconst DEFAULT_MAX_READ_BYTES = 10 * 1024 * 1024;\nconst BINARY_DETECTION_BYTES = 8000;\n\n/**\n * Tool name aliases retained for back-compat with consumers that imported\n * the per-file `Local*ToolName` constants. The canonical names live on\n * `Constants.*` (see `src/common/enum.ts`); these aliases just point at\n * them so a typo upstream gets caught at the type level.\n */\nexport const LocalWriteFileToolName = Constants.WRITE_FILE;\nexport const LocalEditFileToolName = Constants.EDIT_FILE;\nexport const LocalGrepSearchToolName = Constants.GREP_SEARCH;\nexport const LocalGlobSearchToolName = Constants.GLOB_SEARCH;\nexport const LocalListDirectoryToolName = Constants.LIST_DIRECTORY;\n\nexport const LocalReadFileToolSchema: t.JsonSchemaType = withIntent({\n type: 'object',\n properties: {\n path: {\n type: 'string',\n description:\n 'Path to a local file, relative to the configured cwd unless absolute paths are allowed.',\n },\n offset: {\n type: 'integer',\n description: 'Optional 1-indexed line offset for large files.',\n },\n limit: {\n type: 'integer',\n description: 'Optional maximum number of lines to return.',\n },\n },\n required: ['path'],\n});\n\nexport const LocalWriteFileToolSchema: t.JsonSchemaType = withIntent({\n type: 'object',\n properties: {\n path: {\n type: 'string',\n description:\n 'Path to write, relative to the configured cwd unless absolute paths are allowed.',\n },\n content: {\n type: 'string',\n description: 'Complete file contents to write.',\n },\n },\n required: ['path', 'content'],\n});\n\nexport const LocalEditFileToolSchema: t.JsonSchemaType = withIntent({\n type: 'object',\n properties: {\n path: {\n type: 'string',\n description:\n 'Path to edit, relative to the configured cwd unless absolute paths are allowed.',\n },\n old_text: {\n type: 'string',\n description: 'Exact text to replace. Must appear exactly once.',\n },\n new_text: {\n type: 'string',\n description: 'Replacement text.',\n },\n edits: {\n type: 'array',\n description:\n 'Optional batch of exact replacements. Each old_text must appear exactly once in the original file.',\n items: {\n type: 'object',\n properties: {\n old_text: { type: 'string' },\n new_text: { type: 'string' },\n },\n required: ['old_text', 'new_text'],\n },\n },\n },\n required: ['path'],\n});\n\nexport const LocalGrepSearchToolSchema: t.JsonSchemaType = withIntent({\n type: 'object',\n properties: {\n pattern: {\n type: 'string',\n description: 'Regex pattern to search for.',\n },\n path: {\n type: 'string',\n description: 'Directory or file to search. Defaults to cwd.',\n },\n glob: {\n type: 'string',\n description: 'Optional file glob passed to rg -g.',\n },\n max_results: {\n type: 'integer',\n description: 'Maximum matching lines to return.',\n },\n },\n required: ['pattern'],\n});\n\nexport const LocalGlobSearchToolSchema: t.JsonSchemaType = withIntent({\n type: 'object',\n properties: {\n pattern: {\n type: 'string',\n description: 'File glob pattern, for example \"src/**/*.ts\".',\n },\n path: {\n type: 'string',\n description: 'Directory to search. Defaults to cwd.',\n },\n max_results: {\n type: 'integer',\n description: 'Maximum file paths to return.',\n },\n },\n required: ['pattern'],\n});\n\nexport const LocalListDirectoryToolSchema: t.JsonSchemaType = withIntent({\n type: 'object',\n properties: {\n path: {\n type: 'string',\n description: 'Directory to list. Defaults to cwd.',\n },\n },\n});\n\nfunction lineWindow(\n content: string,\n offset?: number,\n limit?: number\n): { text: string; truncated: boolean } {\n const start = Math.max((offset ?? 1) - 1, 0);\n // Avoid splitting the whole file when the caller asked for a small\n // window. For a 10 MB file with `offset: 1, limit: 10`, the prior\n // `content.split('\\n')` allocated millions of strings to throw all\n // but 10 away. We walk newline indices directly: O(start + limit)\n // instead of O(file). When `limit` is omitted, fall back to the\n // simple split — it's the same amount of work either way.\n if (limit == null || limit <= 0) {\n const lines = content.split('\\n');\n const selected = lines.slice(start);\n const numbered = selected\n .map(\n (line, index) =>\n `${String(start + index + 1).padStart(6, ' ')}\\t${line}`\n )\n .join('\\n');\n return {\n text: truncateLocalOutput(numbered, MAX_READ_CHARS),\n truncated: numbered.length > MAX_READ_CHARS,\n };\n }\n // Walk to the start line by counting newlines.\n let cursor = 0;\n for (let i = 0; i < start; i++) {\n const next = content.indexOf('\\n', cursor);\n if (next === -1) {\n // File has fewer lines than `offset` — return empty window.\n return { text: '', truncated: false };\n }\n cursor = next + 1;\n }\n // Collect up to `limit` lines from `cursor`.\n const out: string[] = [];\n let pos = cursor;\n let exhausted = true;\n for (let k = 0; k < limit; k++) {\n const next = content.indexOf('\\n', pos);\n if (next === -1) {\n out.push(content.slice(pos));\n break;\n }\n out.push(content.slice(pos, next));\n pos = next + 1;\n if (k === limit - 1 && pos < content.length) {\n exhausted = false;\n }\n }\n const numbered = out\n .map(\n (text, index) => `${String(start + index + 1).padStart(6, ' ')}\\t${text}`\n )\n .join('\\n');\n return {\n text: truncateLocalOutput(numbered, MAX_READ_CHARS),\n truncated: !exhausted || numbered.length > MAX_READ_CHARS,\n };\n}\n\nconst MAX_DIFF_CHARS = 4000;\n\ntype SyntaxRun =\n | {\n mode: 'auto' | 'strict';\n outcome: import('./syntaxCheck').SyntaxCheckOutcome;\n }\n | undefined;\n\nasync function maybeRunSyntaxCheck(\n path: string,\n config: t.LocalExecutionConfig\n): Promise<SyntaxRun> {\n const mode = config.postEditSyntaxCheck ?? 'off';\n if (mode === 'off') return undefined;\n const outcome = await runPostEditSyntaxCheck(path, config);\n if (outcome == null) return undefined;\n return { mode, outcome };\n}\n\nfunction appendSyntaxCheckSummary(base: string, run: SyntaxRun): string {\n if (run == null) return base;\n if (run.outcome.ok) return base;\n const banner =\n run.mode === 'strict'\n ? `\\n\\n[syntax-check FAILED via ${run.outcome.checker}]\\n`\n : `\\n\\n[syntax-check warning via ${run.outcome.checker}]\\n`;\n return `${base}${banner}${run.outcome.output}`;\n}\n\n/**\n * Revert a write_file/edit_file mutation in `postEditSyntaxCheck:\n * 'strict'` mode after the post-write syntax check failed. Strict\n * mode advertises a safety gate, so leaving the corrupted file on\n * disk + throwing is a half-broken contract — the model \"reacts\" to\n * the error but the next call sees broken on-disk state. Codex P2\n * [49]. Best-effort: a swallowed error here means the workspace is\n * still in the bad post-write state, but we still throw the\n * original syntax-check error so the caller knows.\n *\n * - If the file existed pre-write: restore the previous bytes with\n * the original encoding.\n * - If the file is brand-new: unlink it.\n */\nasync function revertStrictWrite(\n fs: import('./workspaceFS').WorkspaceFS,\n path: string,\n existed: boolean,\n before: string,\n encoding: { text: string; hasBom: boolean; newline: '\\n' | '\\r\\n' }\n): Promise<void> {\n try {\n if (existed) {\n // encodeFile uses encoding.{hasBom,newline} to restore the\n // on-disk shape; the `text` field is overridden by the\n // explicit `before` arg we pass in.\n await fs.writeFile(\n path,\n encodeFile(before, { ...encoding, text: before }),\n 'utf8'\n );\n } else {\n await fs.unlink(path);\n }\n } catch (error) {\n // A timed-out revert leaves the rejected write on disk — the caller would\n // otherwise claim \"reverted to pre-write state\" while the bad bytes remain.\n // Surface it; for other failures stay best-effort (caller sees the original\n // syntax error).\n if (isWorkspaceClientTimeoutError(error)) {\n throw error;\n }\n }\n}\n\nfunction summariseDiff(\n filePath: string,\n before: string,\n after: string\n): string {\n if (before === after) {\n return '(no textual changes)';\n }\n const name = basename(filePath);\n const patch = createTwoFilesPatch(name, name, before, after, '', '', {\n context: 3,\n });\n if (patch.length <= MAX_DIFF_CHARS) {\n return patch;\n }\n return (\n patch.slice(0, MAX_DIFF_CHARS) +\n `\\n[... diff truncated, ${patch.length - MAX_DIFF_CHARS} more chars ...]`\n );\n}\n\nfunction normalizeEdits(input: {\n old_text?: string;\n new_text?: string;\n edits?: Array<{ old_text?: string; new_text?: string }>;\n}): Array<{ oldText: string; newText: string }> {\n const edits = Array.isArray(input.edits)\n ? input.edits.map((edit) => ({\n oldText: edit.old_text ?? '',\n newText: edit.new_text ?? '',\n }))\n : [];\n\n if (input.old_text != null || input.new_text != null) {\n edits.push({\n oldText: input.old_text ?? '',\n newText: input.new_text ?? '',\n });\n }\n\n return edits;\n}\n\nfunction toolDefinition(\n name: string,\n description: string,\n parameters: t.JsonSchemaType\n): t.LCTool {\n return {\n name,\n description,\n parameters,\n allowed_callers: ['direct', 'code_execution'],\n responseFormat: Constants.CONTENT_AND_ARTIFACT,\n toolType: 'builtin',\n };\n}\n\nasync function looksBinary(\n path: string,\n fs: import('./workspaceFS').WorkspaceFS\n): Promise<boolean> {\n let handle;\n try {\n handle = await fs.open(path, 'r');\n const sample = Buffer.alloc(BINARY_DETECTION_BYTES);\n const { bytesRead } = await handle.read(\n sample,\n 0,\n BINARY_DETECTION_BYTES,\n 0\n );\n for (let i = 0; i < bytesRead; i++) {\n if (sample[i] === 0) {\n return true;\n }\n }\n return false;\n } finally {\n await handle?.close();\n }\n}\n\nconst DEFAULT_MAX_ATTACHMENT_BYTES = 5 * 1024 * 1024;\n\nexport function createLocalReadFileTool(\n config: t.LocalExecutionConfig = {}\n): DynamicStructuredTool {\n const fs = getWorkspaceFS(config);\n return tool(\n async (rawInput) => {\n const input = rawInput as {\n path: string;\n offset?: number;\n limit?: number;\n };\n const path = await resolveWorkspacePathSafe(\n input.path,\n config,\n 'read'\n );\n const fileStat = await fs.stat(path);\n if (!fileStat.isFile()) {\n throw new Error(`Path is not a file: ${input.path}`);\n }\n const maxBytes = Math.max(\n config.maxReadBytes ?? DEFAULT_MAX_READ_BYTES,\n 1\n );\n if (fileStat.size > maxBytes) {\n const stub = `File is ${fileStat.size} bytes, exceeds the ${maxBytes}-byte read cap. Read a slice via bash (e.g. head/sed) or raise local.maxReadBytes.`;\n return [stub, { path, bytes: fileStat.size, truncated: true }];\n }\n\n if (await looksBinary(path, fs)) {\n const attachmentMode = config.attachReadAttachments ?? 'off';\n if (attachmentMode !== 'off') {\n const attachment = await classifyAttachment({\n path,\n bytes: fileStat.size,\n mode: attachmentMode,\n maxBytes: config.maxAttachmentBytes ?? DEFAULT_MAX_ATTACHMENT_BYTES,\n // Route through the configured WorkspaceFS so a custom\n // engine sees the same path semantics as `read_file`\n // itself (manual review finding F).\n fs,\n });\n if (attachment.kind === 'image') {\n return [\n imageAttachmentContent(path, attachment),\n {\n path,\n bytes: fileStat.size,\n mime: attachment.mime,\n attachment: 'image',\n },\n ];\n }\n if (attachment.kind === 'pdf') {\n return [\n [\n {\n type: 'text',\n text: `Read ${path} (application/pdf, ${fileStat.size} bytes). PDF attached as base64 data URL; vision-capable models that accept PDF will render it.`,\n },\n {\n type: 'image_url',\n image_url: { url: attachment.dataUrl },\n },\n ],\n {\n path,\n bytes: fileStat.size,\n mime: attachment.mime,\n attachment: 'pdf',\n },\n ];\n }\n if (attachment.kind === 'oversize') {\n return [\n `Refusing to embed ${attachment.mime} attachment (${attachment.bytes} bytes exceeds ${attachment.maxBytes}-byte cap).`,\n {\n path,\n bytes: fileStat.size,\n mime: attachment.mime,\n attachment: 'oversize',\n },\n ];\n }\n if (attachment.kind === 'binary') {\n return [\n `Refusing to read binary file (${fileStat.size} bytes, ${attachment.mime}): ${path}`,\n {\n path,\n bytes: fileStat.size,\n mime: attachment.mime,\n binary: true,\n },\n ];\n }\n // text-or-unknown falls through to the text-read path below.\n } else {\n return [\n `Refusing to read binary file (${fileStat.size} bytes): ${path}`,\n { path, bytes: fileStat.size, binary: true },\n ];\n }\n }\n\n const content = await fs.readFile(path, 'utf8');\n const result = lineWindow(content, input.offset, input.limit);\n return [\n result.truncated ? `${result.text}\\n[truncated]` : result.text,\n { path, bytes: fileStat.size },\n ];\n },\n {\n name: Constants.READ_FILE,\n description:\n 'Read a local text file from the configured working directory with line numbers. ' +\n 'When `attachReadAttachments` is enabled (e.g. images-only), reading an image returns an ' +\n '`image_url` content block so vision-capable models can see the file directly.',\n schema: LocalReadFileToolSchema,\n responseFormat: Constants.CONTENT_AND_ARTIFACT,\n }\n );\n}\n\nexport function createLocalWriteFileTool(\n config: t.LocalExecutionConfig = {},\n checkpointer?: t.LocalFileCheckpointer\n): DynamicStructuredTool {\n const fs = getWorkspaceFS(config);\n return tool(\n async (rawInput) => {\n const input = rawInput as { path: string; content: string };\n if (config.readOnly === true) {\n throw new Error('write_file is blocked in read-only local mode.');\n }\n const path = await resolveWorkspacePathSafe(\n input.path,\n config,\n 'write'\n );\n if (checkpointer != null) {\n await checkpointer.captureBeforeWrite(path);\n }\n\n let before = '';\n let encoding = { text: '', hasBom: false, newline: '\\n' as const } as\n | ReturnType<typeof decodeFile>\n | { text: string; hasBom: false; newline: '\\n' };\n let existed = false;\n try {\n const raw = await fs.readFile(path, 'utf8');\n const decoded = decodeFile(raw);\n before = decoded.text;\n encoding = decoded;\n existed = true;\n } catch (error) {\n // A stalled-RPC timeout is NOT \"file absent\" — treating it as such would\n // overwrite an existing file with fresh content. Surface it instead.\n if (isWorkspaceClientTimeoutError(error)) {\n throw error;\n }\n existed = false;\n }\n\n await fs.mkdir(dirname(path), { recursive: true });\n const finalText = encodeFile(input.content, encoding);\n await fs.writeFile(path, finalText, 'utf8');\n\n let syntax;\n try {\n syntax = await maybeRunSyntaxCheck(path, config);\n } catch (error) {\n // A validation-read timeout must still honor strict mode's revert\n // contract: restore the pre-write state before surfacing (best-effort —\n // the revert may itself time out on the same stalled container).\n if (\n isWorkspaceClientTimeoutError(error) &&\n config.postEditSyntaxCheck === 'strict'\n ) {\n await revertStrictWrite(fs, path, existed, before, encoding);\n }\n throw error;\n }\n\n const diff = existed\n ? summariseDiff(path, before, input.content)\n : `(new file, ${input.content.length} chars)`;\n const baseSummary = existed\n ? `Overwrote ${path} (${input.content.length} chars). Diff:\\n${diff}`\n : `Created ${path} (${input.content.length} chars).`;\n const summary = appendSyntaxCheckSummary(baseSummary, syntax);\n if (syntax?.outcome.ok === false && syntax.mode === 'strict') {\n // Roll back the write so strict mode is an actual gate, not\n // \"fail the call AND leave the corrupted file on disk\".\n // Codex P2 [49].\n await revertStrictWrite(fs, path, existed, before, encoding);\n throw new Error(\n `write_file syntax check failed (${syntax.outcome.checker}); reverted to pre-write state.\\n${syntax.outcome.output}`\n );\n }\n return [\n summary,\n {\n path,\n bytes: finalText.length,\n new_file: !existed,\n newline: encoding.newline === '\\r\\n' ? 'CRLF' : 'LF',\n had_bom: encoding.hasBom,\n ...(syntax != null && syntax.outcome.ok === false\n ? { syntax_error: syntax.outcome.checker }\n : {}),\n },\n ];\n },\n {\n name: LocalWriteFileToolName,\n description:\n 'Create or overwrite a local text file in the configured working directory. ' +\n 'Preserves the existing BOM and line endings when overwriting; defaults to LF without BOM for new files. ' +\n 'Returns a unified diff of the changes when overwriting.',\n schema: LocalWriteFileToolSchema,\n responseFormat: Constants.CONTENT_AND_ARTIFACT,\n }\n );\n}\n\nexport function createLocalEditFileTool(\n config: t.LocalExecutionConfig = {},\n checkpointer?: t.LocalFileCheckpointer\n): DynamicStructuredTool {\n const fs = getWorkspaceFS(config);\n return tool(\n async (rawInput) => {\n const input = rawInput as {\n path: string;\n old_text?: string;\n new_text?: string;\n edits?: Array<{ old_text?: string; new_text?: string }>;\n };\n if (config.readOnly === true) {\n throw new Error('edit_file is blocked in read-only local mode.');\n }\n const edits = normalizeEdits(input);\n if (edits.length === 0) {\n throw new Error('edit_file requires old_text/new_text or edits[].');\n }\n\n const path = await resolveWorkspacePathSafe(\n input.path,\n config,\n 'write'\n );\n const raw = await fs.readFile(path, 'utf8');\n const encoding = decodeFile(raw);\n const original = encoding.text;\n\n let next = original;\n const strategiesUsed: string[] = [];\n for (let i = 0; i < edits.length; i++) {\n const edit = edits[i];\n const match = locateEdit(next, edit.oldText);\n if (match == null) {\n throw new Error(\n `Edit ${i + 1}/${edits.length}: could not locate old_text in ${input.path}. ` +\n 'Tried exact, line-trimmed, whitespace-normalized, and indentation-flexible matching. ' +\n 'Re-read the file and copy the literal lines.'\n );\n }\n strategiesUsed.push(match.strategy);\n next = applyEdit(next, match, edit.newText);\n }\n\n if (checkpointer != null) {\n await checkpointer.captureBeforeWrite(path);\n }\n const finalText = encodeFile(next, encoding);\n await fs.writeFile(path, finalText, 'utf8');\n\n let syntax;\n try {\n syntax = await maybeRunSyntaxCheck(path, config);\n } catch (error) {\n // As in write_file: a validation-read timeout still triggers strict\n // mode's revert (edit_file always operates on an existing file).\n if (\n isWorkspaceClientTimeoutError(error) &&\n config.postEditSyntaxCheck === 'strict'\n ) {\n await revertStrictWrite(fs, path, true, original, encoding);\n }\n throw error;\n }\n\n const diff = summariseDiff(path, original, next);\n const fuzzy = strategiesUsed.some((s) => s !== 'exact');\n const baseSummary =\n `Applied ${edits.length} edit(s) to ${path}` +\n (fuzzy ? ` (strategies: ${strategiesUsed.join(', ')})` : '') +\n `. Diff:\\n${diff}`;\n const summary = appendSyntaxCheckSummary(baseSummary, syntax);\n if (syntax?.outcome.ok === false && syntax.mode === 'strict') {\n // Restore the pre-edit bytes so strict mode is an actual\n // gate (Codex P2 [49]). edit_file always operates on an\n // existing file, so `existed = true` here.\n await revertStrictWrite(fs, path, true, original, encoding);\n throw new Error(\n `edit_file syntax check failed (${syntax.outcome.checker}); reverted to pre-edit state.\\n${syntax.outcome.output}`\n );\n }\n return [\n summary,\n {\n path,\n edits: edits.length,\n strategies: strategiesUsed,\n newline: encoding.newline === '\\r\\n' ? 'CRLF' : 'LF',\n had_bom: encoding.hasBom,\n ...(syntax != null && syntax.outcome.ok === false\n ? { syntax_error: syntax.outcome.checker }\n : {}),\n },\n ];\n },\n {\n name: LocalEditFileToolName,\n description:\n 'Apply exact text replacements to a local file. The matcher tries exact, line-trimmed, whitespace-normalized, and indentation-flexible strategies in order so common LLM whitespace mistakes are recoverable. Each old_text must still match exactly one location. Returns a unified diff of the changes.',\n schema: LocalEditFileToolSchema,\n responseFormat: Constants.CONTENT_AND_ARTIFACT,\n }\n );\n}\n\n/**\n * Ripgrep availability cache, keyed on the *effective execution\n * backend* — whatever function `getSpawn(config)` returns. Without\n * the backend key, a Run that probes `rg` over Node's\n * `child_process.spawn` would poison subsequent Runs whose\n * `local.exec.spawn` routes to a remote sandbox or container that\n * doesn't have rg installed: the cached `true` would skip the probe,\n * the rg invocation would throw, and the Node fallback wouldn't be\n * reached. Per-backend caching avoids that without paying for a\n * spawn-per-search.\n */\n// Per-backend × per-env cache. Codex P1 #34 — keying by spawn\n// backend alone misses the case where two Runs share a backend but\n// vary `local.env` (especially PATH). Stale cache then claims `rg`\n// is available, the rg path runs, and the spawn fails with ENOENT\n// instead of falling back to the Node walker. The inner Map is\n// keyed by a stable JSON hash of the effective env so each unique\n// env gets its own probe.\nlet ripgrepAvailabilityByBackend = new WeakMap<\n t.LocalSpawn,\n Map<string, Promise<boolean>>\n>();\n\nfunction envCacheKey(env: NodeJS.ProcessEnv | undefined): string {\n // PATH is the only env entry that affects command lookup, but\n // hashing the whole env keeps the key correct for hosts that\n // vary anything else relevant. Stable JSON via sorted keys so\n // {A:1,B:2} and {B:2,A:1} produce the same hash.\n if (env == null) return '';\n const sorted: Record<string, string | undefined> = {};\n for (const k of Object.keys(env).sort()) {\n sorted[k] = env[k];\n }\n return JSON.stringify(sorted);\n}\n\nasync function isRipgrepAvailable(\n config: t.LocalExecutionConfig\n): Promise<boolean> {\n const backend = getSpawn(config);\n let envMap = ripgrepAvailabilityByBackend.get(backend);\n if (envMap == null) {\n envMap = new Map();\n ripgrepAvailabilityByBackend.set(backend, envMap);\n }\n const envKey = envCacheKey(config.env);\n let probePromise = envMap.get(envKey);\n if (probePromise == null) {\n probePromise = spawnLocalProcess(\n 'rg',\n ['--version'],\n { ...config, timeoutMs: 5000, sandbox: { enabled: false } },\n { internal: true }\n )\n .then((probe) => probe.exitCode === 0)\n .catch(() => false);\n envMap.set(envKey, probePromise);\n }\n return probePromise;\n}\n\n/**\n * Test-only reset hook. Clears the ripgrep-availability cache so\n * tests can swap in mocked spawn backends and reprobe deterministically.\n *\n * @internal Not part of the public SDK surface; the leading underscore\n * and `@internal` tag together signal that consumers should not call\n * this. Tests import it via the module path directly.\n */\nexport function _resetRipgrepCacheForTests(): void {\n ripgrepAvailabilityByBackend = new WeakMap();\n}\n\n// Skipped by the Node-fallback walker (used when ripgrep is\n// unavailable). Covers common build outputs, virtualenvs, and\n// caches so a `grep_search`/`glob_search` on a large monorepo or a\n// Python project with `.venv/` doesn't read every file under those\n// trees. ripgrep itself respects .gitignore so it doesn't need this\n// list. Audit follow-up from the comprehensive review (finding #3).\nconst SKIP_DIRS = new Set([\n '.git',\n '.svn',\n '.hg',\n 'node_modules',\n '.next',\n '.nuxt',\n '.cache',\n '.parcel-cache',\n '.turbo',\n 'dist',\n 'build',\n 'out',\n 'target',\n 'vendor',\n 'coverage',\n '.nyc_output',\n '__pycache__',\n '.venv',\n 'venv',\n 'env',\n '.tox',\n '.mypy_cache',\n '.pytest_cache',\n '.ruff_cache',\n]);\n\nfunction globToRegExp(pattern: string): RegExp {\n let result = '^';\n for (let i = 0; i < pattern.length; i++) {\n const c = pattern[i];\n if (c === '*') {\n if (pattern[i + 1] === '*') {\n result += '.*';\n i += 1;\n if (pattern[i + 1] === '/') {\n i += 1;\n }\n } else {\n result += '[^/]*';\n }\n } else if (c === '?') {\n result += '[^/]';\n } else if ('.+^$|(){}[]\\\\'.includes(c)) {\n result += '\\\\' + c;\n } else {\n result += c;\n }\n }\n result += '$';\n return new RegExp(result);\n}\n\nasync function* walkFiles(\n root: string,\n fs: import('./workspaceFS').WorkspaceFS\n): AsyncGenerator<string> {\n const stack: string[] = [root];\n while (stack.length > 0) {\n const dir = stack.pop() as string;\n let entries;\n try {\n entries = await fs.readdir(dir, { withFileTypes: true });\n } catch (error) {\n // A stalled-RPC timeout must surface, not be silently skipped as an\n // unreadable directory — that would corrupt search results (\"no matches\").\n if (isWorkspaceClientTimeoutError(error)) {\n throw error;\n }\n continue;\n }\n for (const entry of entries) {\n if (entry.name.startsWith('.git') || SKIP_DIRS.has(entry.name)) {\n continue;\n }\n const full = `${dir}/${entry.name}`;\n if (entry.isDirectory()) {\n stack.push(full);\n } else if (entry.isFile()) {\n yield full;\n }\n }\n }\n}\n\n/**\n * Catastrophic-backtracking guardrails for the fallback grep path.\n *\n * Without ripgrep we run the model-supplied pattern through Node's\n * `RegExp` engine, which uses a backtracking implementation. Patterns\n * with nested unbounded quantifiers (`(a+)+`, `(.*)*`, etc.) can\n * monopolise the event loop for arbitrary wall-clock time on\n * pathological input, and `setTimeout` cannot interrupt a synchronous\n * `RegExp.exec`. Manual review (finding D) flagged this as a real DoS.\n *\n * Mitigations applied here, in order of severity:\n * 1. Cap pattern length so an obviously oversize regex is rejected\n * before compile.\n * 2. Reject patterns that contain a nested unbounded quantifier of\n * the form `(...+|*)([+*]|{n,})` — the standard pathological\n * shape. Still a heuristic (not a full safety proof), but blocks\n * every common DoS construction we've seen in coding-agent logs.\n * 3. Wall-clock budget for the overall search: each file's regex\n * pass is checked against a deadline; once exceeded the search\n * bails with a partial result. Doesn't interrupt a stuck\n * `exec()` call, but stops a slow pattern from making the whole\n * Run hang once the first hung file finishes.\n *\n * Hosts that need bulletproof regex safety should install `rg` —\n * ripgrep uses RE2 internally and has no backtracking.\n */\nconst MAX_FALLBACK_PATTERN_LENGTH = 1024;\nconst FALLBACK_GREP_BUDGET_MS = 5000;\n// Per-file byte cap. Codex P2 #41 — without it, the whole-file\n// `readFile` + `split('\\n')` for a multi-GB log is an unbounded\n// allocation that the wall-clock budget (checked between files)\n// can't interrupt. Hosts that need to grep large files should\n// install ripgrep.\nconst FALLBACK_GREP_MAX_FILE_BYTES = 5 * 1024 * 1024;\n\n/**\n * Heuristic: walks `pattern` to find any `(<contents>)<quant>` where\n * `<contents>` itself has an unbounded quantifier. Catches the\n * classic `(a+)+` form AND the double-nested `((a+)+)` form (which a\n * single-pass regex misses because `[^)]*` stops at the first inner\n * close-paren). Misses sufficiently obfuscated cases — bulletproof\n * ReDoS detection requires a real parser. The 5 s wall-clock budget\n * is the hard backstop for anything this slip past.\n */\nfunction hasNestedUnboundedQuantifier(pattern: string): boolean {\n for (let i = 1; i < pattern.length - 1; i++) {\n if (pattern[i] !== ')') continue;\n if (pattern[i - 1] === '\\\\') continue;\n const next = pattern[i + 1];\n if (next !== '+' && next !== '*' && next !== '{') continue;\n // Walk back to find the matching opening paren (respecting depth\n // and `\\(` escapes).\n let depth = 1;\n let j = i - 1;\n while (j >= 0) {\n const c = pattern[j];\n const escaped = j > 0 && pattern[j - 1] === '\\\\';\n if (!escaped) {\n if (c === ')') depth++;\n else if (c === '(') {\n depth--;\n if (depth === 0) break;\n }\n }\n j--;\n }\n if (j < 0) continue;\n const inner = pattern.slice(j + 1, i);\n if (/(?<!\\\\)[+*]/.test(inner)) return true;\n }\n return false;\n}\n\nclass FallbackGrepError extends Error {\n readonly kind: 'pattern-too-long' | 'unsafe-pattern' | 'invalid-pattern';\n constructor(\n kind: 'pattern-too-long' | 'unsafe-pattern' | 'invalid-pattern',\n message: string\n ) {\n super(message);\n this.kind = kind;\n }\n}\n\nfunction compileFallbackRegex(pattern: string): RegExp {\n if (pattern.length > MAX_FALLBACK_PATTERN_LENGTH) {\n throw new FallbackGrepError(\n 'pattern-too-long',\n `Pattern exceeds ${MAX_FALLBACK_PATTERN_LENGTH}-char fallback cap (install ripgrep for unbounded patterns).`\n );\n }\n if (hasNestedUnboundedQuantifier(pattern)) {\n throw new FallbackGrepError(\n 'unsafe-pattern',\n 'Pattern contains a nested unbounded quantifier (e.g. `(a+)+` or `((a+)+)`) which can cause catastrophic backtracking in the Node fallback. Install ripgrep for RE2-safe matching.'\n );\n }\n try {\n return new RegExp(pattern);\n } catch (e) {\n throw new FallbackGrepError(\n 'invalid-pattern',\n `Invalid regex: ${(e as Error).message}`\n );\n }\n}\n\n/** Structured return so callers can count matches separately from\n * diagnostic skip-sentinels (Codex P2 [43]). */\ntype FallbackGrepResult = { matches: string[]; skipped: string[] };\n\n/** Renders fallback-grep output: real matches first, skip diagnostics appended. */\nfunction formatFallbackGrepDisplay(result: FallbackGrepResult): string {\n if (result.matches.length > 0) {\n return [...result.matches, ...result.skipped].join('\\n');\n }\n if (result.skipped.length > 0) {\n return result.skipped.join('\\n');\n }\n return 'No matches found.';\n}\n\nasync function fallbackGrep(\n root: string,\n pattern: string,\n globFilter: string | undefined,\n maxResults: number,\n fs: import('./workspaceFS').WorkspaceFS\n): Promise<FallbackGrepResult> {\n const rx = compileFallbackRegex(pattern);\n const deadline = Date.now() + FALLBACK_GREP_BUDGET_MS;\n const globRx =\n globFilter != null && globFilter !== ''\n ? globToRegExp(globFilter)\n : undefined;\n const matches: string[] = [];\n // Track skipped (oversize) files separately so they don't consume\n // the maxResults budget. Codex P2 [43]: round 14's fix pushed skip\n // sentinels into `matches`, so a directory of one oversize non-\n // matching file falsely reported `matches: 1`, and enough\n // oversize files could fill the budget before any real match was\n // scanned. Now diagnostics are appended after real matches and\n // independent of the budget.\n const skippedDiagnostics: string[] = [];\n for await (const file of walkFiles(root, fs)) {\n if (Date.now() > deadline) {\n // Wall-clock budget exceeded — return partial results rather\n // than letting a slow pattern hang the Run.\n return { matches, skipped: skippedDiagnostics };\n }\n if (globRx != null) {\n const rel = file.startsWith(root + '/')\n ? file.slice(root.length + 1)\n : file;\n if (!globRx.test(rel)) {\n continue;\n }\n }\n // Skip files larger than the per-file cap and remember them as\n // diagnostics (NOT as matches). Codex P2 [41]: pre-fix\n // `fs.readFile` then `.split('\\n')` allocated the whole file +\n // an array of every line, which a single multi-GB log could\n // turn into an OOM even after the regex DoS guards.\n let stat;\n try {\n stat = await fs.stat(file);\n } catch (error) {\n // A stalled-RPC timeout must surface, not be skipped — skipping a file can\n // report \"no matches\" even when the (unreadable-due-to-stall) file matched.\n if (isWorkspaceClientTimeoutError(error)) {\n throw error;\n }\n continue;\n }\n if (stat.size > FALLBACK_GREP_MAX_FILE_BYTES) {\n skippedDiagnostics.push(\n `${file}:0:[skipped: file > ${FALLBACK_GREP_MAX_FILE_BYTES} bytes; install ripgrep for unbounded grep]`\n );\n continue;\n }\n let content;\n try {\n content = await fs.readFile(file, 'utf8');\n } catch (error) {\n // As above: a client-timeout means a stalled read, not an unreadable file.\n if (isWorkspaceClientTimeoutError(error)) {\n throw error;\n }\n continue;\n }\n if (content.includes('\\0')) {\n continue;\n }\n // Re-check the deadline AFTER the read — a slow disk on one\n // file can blow the budget without us noticing.\n if (Date.now() > deadline) {\n return { matches, skipped: skippedDiagnostics };\n }\n const lines = content.split('\\n');\n for (let i = 0; i < lines.length; i++) {\n if (rx.test(lines[i])) {\n matches.push(`${file}:${i + 1}:${lines[i]}`);\n if (matches.length >= maxResults) {\n return { matches, skipped: skippedDiagnostics };\n }\n }\n }\n }\n return { matches, skipped: skippedDiagnostics };\n}\n\nasync function fallbackGlob(\n root: string,\n pattern: string,\n maxResults: number,\n fs: import('./workspaceFS').WorkspaceFS\n): Promise<string[]> {\n const rx = globToRegExp(pattern);\n const out: string[] = [];\n for await (const file of walkFiles(root, fs)) {\n const rel = file.startsWith(root + '/')\n ? file.slice(root.length + 1)\n : file;\n if (rx.test(rel)) {\n out.push(file);\n if (out.length >= maxResults) {\n break;\n }\n }\n }\n return out;\n}\n\nexport function createLocalGrepSearchTool(\n config: t.LocalExecutionConfig = {}\n): DynamicStructuredTool {\n const fs = getWorkspaceFS(config);\n return tool(\n async (rawInput) => {\n const input = rawInput as {\n pattern: string;\n path?: string;\n glob?: string;\n max_results?: number;\n };\n const target = await resolveWorkspacePathSafe(\n input.path ?? '.',\n config,\n 'read'\n );\n const maxResults = Math.max(input.max_results ?? DEFAULT_MAX_RESULTS, 1);\n\n if (await isRipgrepAvailable(config)) {\n // Pass the pattern through `-e` so dash-prefixed patterns\n // like `-foo` are treated as the search regex, not as a\n // (probably-unknown) flag. `rg --help` explicitly requires\n // `-e/--regexp` (or `--`) for that case. Same trick avoids\n // any future flag-conflict if a user query happens to look\n // like an rg long option.\n const args = [\n '--line-number',\n '--column',\n '--hidden',\n '--glob',\n '!.git/**',\n ...(input.glob != null && input.glob !== ''\n ? ['--glob', input.glob]\n : []),\n '-e',\n input.pattern,\n target,\n ];\n const result = await spawnLocalProcess('rg', args, {\n ...config,\n timeoutMs: config.timeoutMs ?? 30000,\n });\n // ripgrep exit codes:\n // 0 → at least one match\n // 1 → no matches (clean — \"No matches found.\")\n // 2 → real error (bad regex, unreadable target, etc.)\n // Without this branch (Codex P2 #23 — same fix shape glob_search\n // got from P2 #13), exit-2 errors silently mapped to\n // `matches: 0`, so the agent treated tooling failures as a\n // genuine absence of matches.\n if (\n result.timedOut ||\n (result.exitCode != null && result.exitCode > 1)\n ) {\n const detail = result.stderr.trim() || `rg exited ${result.exitCode}`;\n return [\n `grep_search failed: ${detail}`,\n {\n matches: 0,\n engine: 'ripgrep',\n error: detail,\n exitCode: result.exitCode,\n },\n ];\n }\n const lines = result.stdout\n .split('\\n')\n .filter(Boolean)\n .slice(0, maxResults);\n const output =\n lines.length > 0\n ? lines.join('\\n')\n : result.stderr.trim() || 'No matches found.';\n return [output, { matches: lines.length, engine: 'ripgrep' }];\n }\n\n try {\n const { matches, skipped } = await fallbackGrep(\n target,\n input.pattern,\n input.glob,\n maxResults,\n fs\n );\n // Artifact count: ONLY real matches (Codex P2 [43] —\n // skip sentinels used to inflate the count and the budget).\n const display = formatFallbackGrepDisplay({ matches, skipped });\n return [\n display,\n {\n matches: matches.length,\n skipped: skipped.length,\n engine: 'node-fallback',\n },\n ];\n } catch (e) {\n if (e instanceof FallbackGrepError) {\n return [\n `grep_search refused the pattern: ${e.message}`,\n {\n matches: 0,\n engine: 'node-fallback',\n error: e.message,\n kind: e.kind,\n },\n ];\n }\n throw e;\n }\n },\n {\n name: LocalGrepSearchToolName,\n description:\n 'Search local files for a regex pattern (ripgrep when available, Node fallback otherwise).',\n schema: LocalGrepSearchToolSchema,\n responseFormat: Constants.CONTENT_AND_ARTIFACT,\n }\n );\n}\n\nexport function createLocalGlobSearchTool(\n config: t.LocalExecutionConfig = {}\n): DynamicStructuredTool {\n const fs = getWorkspaceFS(config);\n return tool(\n async (rawInput) => {\n const input = rawInput as {\n pattern: string;\n path?: string;\n max_results?: number;\n };\n const target = await resolveWorkspacePathSafe(\n input.path ?? '.',\n config,\n 'read'\n );\n const maxResults = Math.max(input.max_results ?? DEFAULT_MAX_RESULTS, 1);\n\n if (await isRipgrepAvailable(config)) {\n const result = await spawnLocalProcess(\n 'rg',\n [\n '--files',\n '--hidden',\n '--glob',\n '!.git/**',\n '--glob',\n input.pattern,\n target,\n ],\n { ...config, timeoutMs: config.timeoutMs ?? 30000 }\n );\n // rg --files exit codes:\n // 0 → at least one file matched\n // 1 → no files matched (clean — \"No files found.\")\n // 2 → real error (bad glob, unreadable target, etc.)\n // Without this branch, exit-2 errors used to silently map to\n // \"No files found.\" — the agent then treats a tooling failure\n // as a real absence of matches.\n if (\n result.timedOut ||\n (result.exitCode != null && result.exitCode > 1)\n ) {\n const detail = result.stderr.trim() || `rg exited ${result.exitCode}`;\n return [\n `glob_search failed: ${detail}`,\n {\n files: [],\n engine: 'ripgrep',\n error: detail,\n exitCode: result.exitCode,\n },\n ];\n }\n const lines = result.stdout\n .split('\\n')\n .filter(Boolean)\n .slice(0, maxResults);\n return [\n lines.length > 0 ? lines.join('\\n') : 'No files found.',\n { files: lines, engine: 'ripgrep' },\n ];\n }\n\n const files = await fallbackGlob(target, input.pattern, maxResults, fs);\n return [\n files.length > 0 ? files.join('\\n') : 'No files found.',\n { files, engine: 'node-fallback' },\n ];\n },\n {\n name: LocalGlobSearchToolName,\n description:\n 'Find local files matching a glob pattern (ripgrep when available, Node fallback otherwise).',\n schema: LocalGlobSearchToolSchema,\n responseFormat: Constants.CONTENT_AND_ARTIFACT,\n }\n );\n}\n\nexport function createLocalListDirectoryTool(\n config: t.LocalExecutionConfig = {}\n): DynamicStructuredTool {\n const fs = getWorkspaceFS(config);\n return tool(\n async (rawInput) => {\n const input = rawInput as { path?: string };\n const path = await resolveWorkspacePathSafe(\n input.path ?? '.',\n config,\n 'read'\n );\n const entries = await fs.readdir(path, { withFileTypes: true });\n const output = entries\n .map(\n (entry) => `${entry.isDirectory() ? 'dir ' : 'file'}\\t${entry.name}`\n )\n .join('\\n');\n return [output || 'Directory is empty.', { path, count: entries.length }];\n },\n {\n name: LocalListDirectoryToolName,\n description: 'List files and directories in a local directory.',\n schema: LocalListDirectoryToolSchema,\n responseFormat: Constants.CONTENT_AND_ARTIFACT,\n }\n );\n}\n\nexport type LocalCodingToolBundle = {\n tools: DynamicStructuredTool[];\n /**\n * Present when `config.fileCheckpointing === true` or a `checkpointer`\n * was passed in. Callers can call `rewind()` to restore captured\n * pre-write contents.\n */\n checkpointer?: t.LocalFileCheckpointer;\n};\n\nexport function createLocalCodingTools(\n config: t.LocalExecutionConfig = {},\n options: { checkpointer?: t.LocalFileCheckpointer } = {}\n): DynamicStructuredTool[] {\n const checkpointer =\n options.checkpointer ??\n (config.fileCheckpointing === true\n ? createLocalFileCheckpointer({ fs: config.exec?.fs })\n : undefined);\n return [\n createLocalReadFileTool(config),\n createLocalWriteFileTool(config, checkpointer),\n createLocalEditFileTool(config, checkpointer),\n createLocalGrepSearchTool(config),\n createLocalGlobSearchTool(config),\n createLocalListDirectoryTool(config),\n createCompileCheckTool(config),\n createLocalBashExecutionTool({ config }),\n createLocalCodeExecutionTool(config),\n createLocalProgrammaticToolCallingTool(config),\n createLocalBashProgrammaticToolCallingTool(config),\n ];\n}\n\n/**\n * Variant of `createLocalCodingTools` that returns the bundle alongside\n * the file checkpointer so callers can later call\n * `bundle.checkpointer?.rewind()`.\n */\nexport function createLocalCodingToolBundle(\n config: t.LocalExecutionConfig = {},\n options: { checkpointer?: t.LocalFileCheckpointer } = {}\n): LocalCodingToolBundle {\n const checkpointer =\n options.checkpointer ??\n (config.fileCheckpointing === true\n ? createLocalFileCheckpointer({ fs: config.exec?.fs })\n : undefined);\n return {\n tools: createLocalCodingTools(config, { checkpointer }),\n checkpointer,\n };\n}\n\nexport function createLocalCodingToolDefinitions(): t.LCTool[] {\n return [\n toolDefinition(\n Constants.READ_FILE,\n 'Read a local text file from the configured working directory with line numbers.',\n LocalReadFileToolSchema as t.JsonSchemaType\n ),\n toolDefinition(\n LocalWriteFileToolName,\n 'Create or overwrite a local text file in the configured working directory.',\n LocalWriteFileToolSchema as t.JsonSchemaType\n ),\n toolDefinition(\n LocalEditFileToolName,\n 'Apply exact text replacements to a local file.',\n LocalEditFileToolSchema as t.JsonSchemaType\n ),\n toolDefinition(\n LocalGrepSearchToolName,\n 'Search local files with ripgrep and return matching lines.',\n LocalGrepSearchToolSchema as t.JsonSchemaType\n ),\n toolDefinition(\n LocalGlobSearchToolName,\n 'Find local files matching a glob pattern.',\n LocalGlobSearchToolSchema as t.JsonSchemaType\n ),\n toolDefinition(\n LocalListDirectoryToolName,\n 'List files and directories in a local directory.',\n LocalListDirectoryToolSchema as t.JsonSchemaType\n ),\n createCompileCheckToolDefinition(),\n ];\n}\n\nexport function createLocalCodingToolRegistry(): t.LCToolRegistry {\n return new Map(\n createLocalCodingToolDefinitions().map((definition) => [\n definition.name,\n definition,\n ])\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiCA,MAAM,iBAAiB;AACvB,MAAM,sBAAsB;AAC5B,MAAM,yBAAyB,KAAK,OAAO;AAC3C,MAAM,yBAAyB;;;;;;;AAQ/B,MAAa,yBAAA;AACb,MAAa,wBAAA;AACb,MAAa,0BAAA;AACb,MAAa,0BAAA;AACb,MAAa,6BAAA;AAEb,MAAa,0BAA4CA,kBAAAA,WAAW;CAClE,MAAM;CACN,YAAY;EACV,MAAM;GACJ,MAAM;GACN,aACE;EACJ;EACA,QAAQ;GACN,MAAM;GACN,aAAa;EACf;EACA,OAAO;GACL,MAAM;GACN,aAAa;EACf;CACF;CACA,UAAU,CAAC,MAAM;AACnB,CAAC;AAED,MAAa,2BAA6CA,kBAAAA,WAAW;CACnE,MAAM;CACN,YAAY;EACV,MAAM;GACJ,MAAM;GACN,aACE;EACJ;EACA,SAAS;GACP,MAAM;GACN,aAAa;EACf;CACF;CACA,UAAU,CAAC,QAAQ,SAAS;AAC9B,CAAC;AAED,MAAa,0BAA4CA,kBAAAA,WAAW;CAClE,MAAM;CACN,YAAY;EACV,MAAM;GACJ,MAAM;GACN,aACE;EACJ;EACA,UAAU;GACR,MAAM;GACN,aAAa;EACf;EACA,UAAU;GACR,MAAM;GACN,aAAa;EACf;EACA,OAAO;GACL,MAAM;GACN,aACE;GACF,OAAO;IACL,MAAM;IACN,YAAY;KACV,UAAU,EAAE,MAAM,SAAS;KAC3B,UAAU,EAAE,MAAM,SAAS;IAC7B;IACA,UAAU,CAAC,YAAY,UAAU;GACnC;EACF;CACF;CACA,UAAU,CAAC,MAAM;AACnB,CAAC;AAED,MAAa,4BAA8CA,kBAAAA,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AC1Bc,yBAAAA,4BAA4B,EAAE,IAAI,OAAO,MAAM,GAAG,CAAC,IACnD,KAAA;CACN,OAAO;EACL,wBAAwB,MAAM;EAC9B,yBAAyB,QAAQ,YAAY;EAC7C,wBAAwB,QAAQ,YAAY;EAC5C,0BAA0B,MAAM;EAChC,0BAA0B,MAAM;EAChC,6BAA6B,MAAM;EACnCC,yBAAAA,uBAAuB,MAAM;EAC7BC,4BAAAA,6BAA6B,EAAE,OAAO,CAAC;EACvCC,4BAAAA,6BAA6B,MAAM;EACnCC,qCAAAA,uCAAuC,MAAM;EAC7CC,qCAAAA,2CAA2C,MAAM;CACnD;AACF;;;;;;AAOA,SAAgB,4BACd,SAAiC,CAAC,GAClC,UAAsD,CAAC,GAChC;CACvB,MAAM,eACJ,QAAQ,iBACP,OAAO,sBAAsB,OAC1BL,yBAAAA,4BAA4B,EAAE,IAAI,OAAO,MAAM,GAAG,CAAC,IACnD,KAAA;CACN,OAAO;EACL,OAAO,uBAAuB,QAAQ,EAAE,aAAa,CAAC;EACtD;CACF;AACF;AAEA,SAAgB,mCAA+C;CAC7D,OAAO;EACL,eAAA,aAEE,mFACA,uBACF;EACA,eACE,wBACA,8EACA,wBACF;EACA,eACE,uBACA,kDACA,uBACF;EACA,eACE,yBACA,8DACA,yBACF;EACA,eACE,yBACA,6CACA,yBACF;EACA,eACE,4BACA,oDACA,4BACF;EACAM,yBAAAA,iCAAiC;CACnC;AACF;AAEA,SAAgB,gCAAkD;CAChE,OAAO,IAAI,IACT,iCAAiC,CAAC,CAAC,KAAK,eAAe,CACrD,WAAW,MACX,UACF,CAAC,CACH;AACF"}
|
|
1
|
+
{"version":3,"file":"LocalCodingTools.cjs","names":["withIntent","truncateLocalOutput","runPostEditSyntaxCheck","path","encodeFile","isWorkspaceClientTimeoutError","getWorkspaceFS","resolveWorkspacePathSafe","classifyAttachment","imageAttachmentContent","decodeFile","diff","locateEdit","applyEdit","getSpawn","spawnLocalProcess","input","createLocalFileCheckpointer","createCompileCheckTool","createLocalBashExecutionTool","createLocalCodeExecutionTool","createLocalProgrammaticToolCallingTool","createLocalBashProgrammaticToolCallingTool","createCompileCheckToolDefinition"],"sources":["../../../../src/tools/local/LocalCodingTools.ts"],"mappings":";;;;;;;;;;;;;;;;;AAiCA,MAAM,iBAAiB;AACvB,MAAM,sBAAsB;AAC5B,MAAM,yBAAyB,KAAK,OAAO;AAC3C,MAAM,yBAAyB;AAQ/B,MAAa,yBAAA;AACb,MAAa,wBAAA;AACb,MAAa,0BAAA;AACb,MAAa,0BAAA;AACb,MAAa,6BAAA;AAEb,MAAa,0BAA4CA,kBAAAA,WAAW;CAClE,MAAM;CACN,YAAY;EACV,MAAM;GACJ,MAAM;GACN,aACE;EACJ;EACA,QAAQ;GACN,MAAM;GACN,aAAa;EACf;EACA,OAAO;GACL,MAAM;GACN,aAAa;EACf;CACF;CACA,UAAU,CAAC,MAAM;AACnB,CAAC;AAED,MAAa,2BAA6CA,kBAAAA,WAAW;CACnE,MAAM;CACN,YAAY;EACV,MAAM;GACJ,MAAM;GACN,aACE;EACJ;EACA,SAAS;GACP,MAAM;GACN,aAAa;EACf;CACF;CACA,UAAU,CAAC,QAAQ,SAAS;AAC9B,CAAC;AAED,MAAa,0BAA4CA,kBAAAA,WAAW;CAClE,MAAM;CACN,YAAY;EACV,MAAM;GACJ,MAAM;GACN,aACE;EACJ;EACA,UAAU;GACR,MAAM;GACN,aAAa;EACf;EACA,UAAU;GACR,MAAM;GACN,aAAa;EACf;EACA,OAAO;GACL,MAAM;GACN,aACE;GACF,OAAO;IACL,MAAM;IACN,YAAY;KACV,UAAU,EAAE,MAAM,SAAS;KAC3B,UAAU,EAAE,MAAM,SAAS;IAC7B;IACA,UAAU,CAAC,YAAY,UAAU;GACnC;EACF;CACF;CACA,UAAU,CAAC,MAAM;AACnB,CAAC;AAED,MAAa,4BAA8CA,kBAAAA,WAAW;CACpE,MAAM;CACN,YAAY;EACV,SAAS;GACP,MAAM;GACN,aAAa;EACf;EACA,M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YAAY;EAC5C,0BAA0B,MAAM;EAChC,0BAA0B,MAAM;EAChC,6BAA6B,MAAM;EACnCC,yBAAAA,uBAAuB,MAAM;EAC7BC,4BAAAA,6BAA6B,EAAE,OAAO,CAAC;EACvCC,4BAAAA,6BAA6B,MAAM;EACnCC,qCAAAA,uCAAuC,MAAM;EAC7CC,qCAAAA,2CAA2C,MAAM;CACnD;AACF;AAOA,SAAgB,4BACd,SAAiC,CAAC,GAClC,UAAsD,CAAC,GAChC;CACvB,MAAM,eACJ,QAAQ,iBACP,OAAO,sBAAsB,OAC1BL,yBAAAA,4BAA4B,EAAE,IAAI,OAAO,MAAM,GAAG,CAAC,IACnD,KAAA;CACN,OAAO;EACL,OAAO,uBAAuB,QAAQ,EAAE,aAAa,CAAC;EACtD;CACF;AACF;AAEA,SAAgB,mCAA+C;CAC7D,OAAO;EACL,eAAA,aAEE,mFACA,uBACF;EACA,eACE,wBACA,8EACA,wBACF;EACA,eACE,uBACA,kDACA,uBACF;EACA,eACE,yBACA,8DACA,yBACF;EACA,eACE,yBACA,6CACA,yBACF;EACA,eACE,4BACA,oDACA,4BACF;EACAM,yBAAAA,iCAAiC;CACnC;AACF;AAEA,SAAgB,gCAAkD;CAChE,OAAO,IAAI,IACT,iCAAiC,CAAC,CAAC,KAAK,eAAe,CACrD,WAAW,MACX,UACF,CAAC,CACH;AACF"}
|
|
@@ -9,12 +9,6 @@ let fs = require("fs");
|
|
|
9
9
|
//#region src/tools/local/LocalExecutionEngine.ts
|
|
10
10
|
const DEFAULT_TIMEOUT_MS = 6e4;
|
|
11
11
|
const DEFAULT_MAX_OUTPUT_CHARS = 2e5;
|
|
12
|
-
/**
|
|
13
|
-
* Hard cap on total stdout+stderr bytes a child process can stream
|
|
14
|
-
* before we kill its process tree. Independent from `maxOutputChars`
|
|
15
|
-
* (which only affects what the *model* sees) — this is the OOM
|
|
16
|
-
* backstop. Configurable via `local.maxSpawnedBytes`.
|
|
17
|
-
*/
|
|
18
12
|
const DEFAULT_MAX_SPAWNED_BYTES = 50 * 1024 * 1024;
|
|
19
13
|
const DEFAULT_LOCAL_SESSION_ID = "local";
|
|
20
14
|
const DEFAULT_SHELL = process.platform === "win32" ? "bash.exe" : "bash";
|
|
@@ -27,21 +21,6 @@ const dangerousCommandPatterns = [
|
|
|
27
21
|
new RegExp(`\\bchown\\s+-R\\s+[^;&|]+\\s+(?:--\\s+)?${DESTRUCTIVE_TARGET}(?:$|\\s|[;&|])`),
|
|
28
22
|
/:\s*\(\s*\)\s*\{\s*:\s*\|\s*:\s*&\s*\}\s*;\s*:/
|
|
29
23
|
];
|
|
30
|
-
/**
|
|
31
|
-
* Companion patterns that look for destructive targets *inside*
|
|
32
|
-
* matching quote pairs. These are checked against the ORIGINAL
|
|
33
|
-
* command (not the post-quote-strip `normalized` form), because
|
|
34
|
-
* `stripQuotedContent` blanks the contents of quoted spans —
|
|
35
|
-
* which would otherwise let `rm -rf "/"` and friends slip past
|
|
36
|
-
* `dangerousCommandPatterns`.
|
|
37
|
-
*
|
|
38
|
-
* Kept as a separate list so we don't pay false-positive cost on
|
|
39
|
-
* benign uses like `echo "rm -rf /"` (the print case): each pattern
|
|
40
|
-
* here REQUIRES a quote *around the destructive path argument*, not
|
|
41
|
-
* just a quote *somewhere* in the command. `echo "rm -rf /"` has
|
|
42
|
-
* `/` outside of any quote-pair-around-the-path (the quotes wrap
|
|
43
|
-
* the whole `rm -rf /` text), so it doesn't match here either.
|
|
44
|
-
*/
|
|
45
24
|
const quotedDestructivePatterns = [
|
|
46
25
|
new RegExp(`\\brm\\s+(?:-[^\\s]*[rf][^\\s]*\\s+){1,3}(?:--\\s+)?["']${DESTRUCTIVE_TARGET}["']`),
|
|
47
26
|
new RegExp(`\\bchmod\\s+-R\\s+(?:777|a\\+w)\\s+(?:--\\s+)?["']${DESTRUCTIVE_TARGET}["']`),
|
|
@@ -53,12 +32,6 @@ const nestedShellDestructivePatterns = [
|
|
|
53
32
|
/* @__PURE__ */ new RegExp("(?:(?:ba|z|da|k)?sh|eval)\\s+(?:-l?c\\s+)?[\"'][^\"']*\\bchown\\s+-R\\s+[^;&|]+\\s+(?:--\\s+)?(?:\\/|~|\\$\\{?HOME\\}?|\\.)")
|
|
54
33
|
];
|
|
55
34
|
const mutatingCommandPattern = /\b(?:rm|mv|cp|touch|mkdir|rmdir|ln|truncate|tee|sed\s+-i|perl\s+-pi|python(?:3)?\s+-c|node\s+-e|npm\s+(?:install|ci|update|publish)|pnpm\s+(?:install|update|publish)|yarn\s+(?:install|add|publish)|git\s+(?:add|commit|checkout|switch|reset|clean|rebase|merge|push|pull|stash|tag|branch)|chmod|chown)\b|(?:^|[^<])>\s*[^&]|\bcat\s+[^|;&]*>\s*/;
|
|
56
|
-
/**
|
|
57
|
-
* POSIX convention: `128 + signum` when a process is killed by a
|
|
58
|
-
* signal. Maps the common signals; unknown ones default to 1 so the
|
|
59
|
-
* caller still sees a non-zero (failed) exit. Only used when Node's
|
|
60
|
-
* `close` event reports `exitCode === null` (true signal kill).
|
|
61
|
-
*/
|
|
62
35
|
const SIGNAL_TO_EXIT_CODE = {
|
|
63
36
|
SIGHUP: 129,
|
|
64
37
|
SIGINT: 130,
|
|
@@ -93,15 +66,6 @@ function resolveLocalExecutionConfig(config) {
|
|
|
93
66
|
function getLocalCwd(config) {
|
|
94
67
|
return (0, path.resolve)(config?.workspace?.root ?? config?.cwd ?? process.cwd());
|
|
95
68
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Resolves the effective workspace boundary: a list of absolute roots
|
|
98
|
-
* that file operations are allowed to touch. The first entry is always
|
|
99
|
-
* the canonical root (`getLocalCwd`); subsequent entries come from
|
|
100
|
-
* `workspace.additionalRoots` when provided.
|
|
101
|
-
*
|
|
102
|
-
* Returns plain absolute paths — callers symlink-resolve when they
|
|
103
|
-
* need realpath equality (see `resolveWorkspacePathSafe`).
|
|
104
|
-
*/
|
|
105
69
|
function getWorkspaceRoots(config) {
|
|
106
70
|
const root = getLocalCwd(config);
|
|
107
71
|
const extras = config?.workspace?.additionalRoots ?? [];
|
|
@@ -117,28 +81,12 @@ function getWorkspaceRoots(config) {
|
|
|
117
81
|
}
|
|
118
82
|
return out;
|
|
119
83
|
}
|
|
120
|
-
/**
|
|
121
|
-
* Pluggable spawn resolver. Honours `local.exec.spawn` first, falls
|
|
122
|
-
* back to the legacy top-level `local.spawn`, then to Node's
|
|
123
|
-
* `child_process.spawn`. Centralised so engine swapping is one knob.
|
|
124
|
-
*/
|
|
125
84
|
function getSpawn(config) {
|
|
126
85
|
return config?.exec?.spawn ?? config?.spawn ?? child_process.spawn;
|
|
127
86
|
}
|
|
128
|
-
/**
|
|
129
|
-
* Pluggable filesystem resolver. Honours `local.exec.fs`, falls back
|
|
130
|
-
* to the Node-host implementation. A future remote engine supplies
|
|
131
|
-
* its own implementation here and inherits every file-touching tool.
|
|
132
|
-
*/
|
|
133
87
|
function getWorkspaceFS(config) {
|
|
134
88
|
return config?.exec?.fs ?? require_workspaceFS.nodeWorkspaceFS;
|
|
135
89
|
}
|
|
136
|
-
/**
|
|
137
|
-
* Resolves the workspace boundary for *write* operations. Honours
|
|
138
|
-
* `workspace.allowWriteOutside` (and the deprecated
|
|
139
|
-
* `allowOutsideWorkspace`) by returning `null`, which the path-safety
|
|
140
|
-
* helpers interpret as "skip the write clamp".
|
|
141
|
-
*/
|
|
142
90
|
function getWriteRoots(config = {}) {
|
|
143
91
|
const granular = config.workspace?.allowWriteOutside;
|
|
144
92
|
if (granular === true) return null;
|
|
@@ -146,11 +94,6 @@ function getWriteRoots(config = {}) {
|
|
|
146
94
|
if (config.allowOutsideWorkspace === true) return null;
|
|
147
95
|
return getWorkspaceRoots(config);
|
|
148
96
|
}
|
|
149
|
-
/**
|
|
150
|
-
* Resolves the workspace boundary for *read* operations. Honours
|
|
151
|
-
* `workspace.allowReadOutside` (and the deprecated
|
|
152
|
-
* `allowOutsideWorkspace`) by returning `null`.
|
|
153
|
-
*/
|
|
154
97
|
function getReadRoots(config = {}) {
|
|
155
98
|
const granular = config.workspace?.allowReadOutside;
|
|
156
99
|
if (granular === true) return null;
|
|
@@ -164,7 +107,6 @@ function getLocalSessionId(config) {
|
|
|
164
107
|
}
|
|
165
108
|
const missingSandboxRuntimeMessage = ["Local sandbox is enabled, but @anthropic-ai/sandbox-runtime is not installed.", "Install it with `npm install @anthropic-ai/sandbox-runtime`, or disable local sandboxing with `local.sandbox.enabled: false`."].join(" ");
|
|
166
109
|
const sandboxRuntimePackage = "@anthropic-ai/sandbox-runtime";
|
|
167
|
-
/** Lazy-loads the ESM-only sandbox runtime only when sandboxing is enabled. */
|
|
168
110
|
function loadSandboxRuntime() {
|
|
169
111
|
sandboxRuntimePromise ??= import(sandboxRuntimePackage);
|
|
170
112
|
return sandboxRuntimePromise;
|
|
@@ -178,11 +120,6 @@ function maybeWarnSandboxOff(config) {
|
|
|
178
120
|
sandboxOffWarned = true;
|
|
179
121
|
console.warn("[@librechat/agents] Local execution engine is running without @anthropic-ai/sandbox-runtime wrapping. The agent has full access to the host filesystem and network. Set toolExecution.local.sandbox.enabled = true to opt into process sandboxing.");
|
|
180
122
|
}
|
|
181
|
-
/**
|
|
182
|
-
* Test-only reset hook for the sandbox-off warning latch.
|
|
183
|
-
*
|
|
184
|
-
* @internal Not part of the public SDK surface.
|
|
185
|
-
*/
|
|
186
123
|
function _resetLocalEngineWarningsForTests() {
|
|
187
124
|
sandboxOffWarned = false;
|
|
188
125
|
}
|
|
@@ -306,13 +243,6 @@ async function ensureSandbox(config, cwd) {
|
|
|
306
243
|
sandboxConfigKey = nextKey;
|
|
307
244
|
return runtime.SandboxManager;
|
|
308
245
|
}
|
|
309
|
-
/**
|
|
310
|
-
* Loopback addresses the in-process programmatic-tool bridge listens
|
|
311
|
-
* on (`LocalProgrammaticToolCalling.ts` binds 127.0.0.1). Sandboxed
|
|
312
|
-
* code launched by `run_tools_with_code` / `run_tools_with_bash` HTTPs
|
|
313
|
-
* back to that address — without the entries below, the bridge is
|
|
314
|
-
* silently blocked under sandbox.
|
|
315
|
-
*/
|
|
316
246
|
const BRIDGE_LOOPBACK_HOSTS = [
|
|
317
247
|
"127.0.0.1",
|
|
318
248
|
"localhost",
|
|
@@ -480,35 +410,7 @@ async function executeLocalBash(command, config = {}) {
|
|
|
480
410
|
if (!validation.valid) throw new Error(validation.errors.join("\n"));
|
|
481
411
|
return spawnLocalProcess(config.shell ?? DEFAULT_SHELL, ["-lc", command], config);
|
|
482
412
|
}
|
|
483
|
-
/**
|
|
484
|
-
* Variant of `executeLocalBash` that exposes `args` as positional
|
|
485
|
-
* shell parameters (`$1`, `$2`, …). Mirrors what the other runtimes
|
|
486
|
-
* do in `getRuntimeCommand`. Uses the standard `bash -c <code> --
|
|
487
|
-
* arg0 arg1 …` form: the `--` becomes `$0`, then `args[0]` is `$1`
|
|
488
|
-
* and so on. Same AST validation as the no-args path.
|
|
489
|
-
*
|
|
490
|
-
* Used by both the `execute_code`/`lang:'bash'` path AND the
|
|
491
|
-
* `bash_tool` factory so the schema's `args` contract works
|
|
492
|
-
* identically in both surfaces.
|
|
493
|
-
*/
|
|
494
|
-
/**
|
|
495
|
-
* Matches a single arg that, on its own, references a protected
|
|
496
|
-
* location (`/`, `~`, `$HOME`, `${HOME}`, `.`, with optional trailing
|
|
497
|
-
* slash, wildcard, or dot-glob suffix). Used to spot the
|
|
498
|
-
* `command: 'rm -rf "$1"', args: ['/']` shape where the destructive
|
|
499
|
-
* target is moved into a positional arg to evade the command regex.
|
|
500
|
-
* Codex P1 [45], extended for dot-glob in Codex P1 [47] (mirrors the
|
|
501
|
-
* `DESTRUCTIVE_TARGET` suffix matrix exactly).
|
|
502
|
-
*/
|
|
503
413
|
const PROTECTED_TARGET_ARG_RE = /^(?:\/|~|\$\{?HOME\}?|\.)(?:\/?\.?\*|\/)?$/;
|
|
504
|
-
/**
|
|
505
|
-
* Mutating-op recognizer for the args check. Conservative: only the
|
|
506
|
-
* three operations the destructive-command guard already covers
|
|
507
|
-
* directly (`rm -rf …`, `chmod -R …`, `chown -R …`). Other shell
|
|
508
|
-
* builtins might mutate state (`mv`, `cp` over an existing file,
|
|
509
|
-
* etc.) but the destructive guard doesn't try to catch those today,
|
|
510
|
-
* so we don't widen here either.
|
|
511
|
-
*/
|
|
512
414
|
const DESTRUCTIVE_OP_IN_COMMAND_RE = /\b(?:rm\s+-[^\s]*[rf]|chmod\s+-R|chown\s+-R)\b/;
|
|
513
415
|
async function executeLocalBashWithArgs(command, args, config = {}) {
|
|
514
416
|
const validation = await validateBashCommand(command, config);
|
|
@@ -633,15 +535,6 @@ function getRuntimeCommand(lang, tempDir, code, args = [], shellOverride) {
|
|
|
633
535
|
function configShell() {
|
|
634
536
|
return process.platform === "win32" ? "bash.exe" : "bash";
|
|
635
537
|
}
|
|
636
|
-
/**
|
|
637
|
-
* How long after SIGTERM we wait before escalating to SIGKILL. A
|
|
638
|
-
* cooperative process gets a graceful chance to flush + clean up;
|
|
639
|
-
* a process that ignores or traps SIGTERM (`trap '' TERM`) gets
|
|
640
|
-
* killed unconditionally so timeoutMs / maxSpawnedBytes can't be
|
|
641
|
-
* defeated by a hostile script. Codex P1 #28 — pre-fix the spawn
|
|
642
|
-
* promise would never resolve in that case and the entire tool run
|
|
643
|
-
* would hang past the advertised timeout.
|
|
644
|
-
*/
|
|
645
538
|
const SIGKILL_ESCALATION_MS = 2e3;
|
|
646
539
|
function sigterm(child) {
|
|
647
540
|
if (child.pid == null) {
|
|
@@ -710,18 +603,6 @@ async function realpathOrSelf(absolutePath, realpathImpl = fs_promises.realpath)
|
|
|
710
603
|
return absolutePath;
|
|
711
604
|
}
|
|
712
605
|
}
|
|
713
|
-
/**
|
|
714
|
-
* Resolves the realpath of `absolutePath`, falling back to the nearest
|
|
715
|
-
* existing ancestor when the target itself does not yet exist (so the
|
|
716
|
-
* containment check still works for `write_file` to a brand-new path).
|
|
717
|
-
*
|
|
718
|
-
* Codex P2 #38: takes the realpath impl as a parameter so callers
|
|
719
|
-
* can route through `WorkspaceFS.realpath` when a custom engine is
|
|
720
|
-
* configured. Pre-fix, host `fs/promises.realpath` would fail on a
|
|
721
|
-
* remote/in-memory FS path and silently fall back to lexical
|
|
722
|
-
* containment, leaving the symlink-escape clamp ineffective on
|
|
723
|
-
* non-default engines.
|
|
724
|
-
*/
|
|
725
606
|
async function realpathOfPathOrAncestor(absolutePath, realpathImpl = fs_promises.realpath) {
|
|
726
607
|
let current = absolutePath;
|
|
727
608
|
let suffix = "";
|
|
@@ -736,13 +617,6 @@ async function realpathOfPathOrAncestor(absolutePath, realpathImpl = fs_promises
|
|
|
736
617
|
current = parent;
|
|
737
618
|
}
|
|
738
619
|
}
|
|
739
|
-
/**
|
|
740
|
-
* Resolves a workspace path AND follows any symlinks before checking
|
|
741
|
-
* containment, so a symlink inside the workspace pointing outside is
|
|
742
|
-
* rejected even though the lexical path looks safe. Handles paths that
|
|
743
|
-
* don't yet exist (e.g. write_file targets) by realpath-resolving the
|
|
744
|
-
* nearest existing ancestor and re-attaching the unresolved suffix.
|
|
745
|
-
*/
|
|
746
620
|
async function resolveWorkspacePathSafe(filePath, config = {}, intent = "write") {
|
|
747
621
|
const lexical = resolveWorkspacePath(filePath, config, intent);
|
|
748
622
|
const roots = intent === "write" ? getWriteRoots(config) : getReadRoots(config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalExecutionEngine.cjs","names":["spawn","nodeWorkspaceFS","bashAstFindingsToErrors","runBashAstChecks","realpath"],"sources":["../../../../src/tools/local/LocalExecutionEngine.ts"],"sourcesContent":["import { tmpdir } from 'os';\nimport { spawn } from 'child_process';\nimport { createWriteStream } from 'fs';\nimport { createHash, randomUUID } from 'crypto';\nimport { isAbsolute, relative, resolve } from 'path';\nimport { mkdir, realpath, rm, writeFile } from 'fs/promises';\nimport type { ChildProcess } from 'child_process';\nimport type { WorkspaceFS } from './workspaceFS';\nimport type * as t from '@/types';\nimport { runBashAstChecks, bashAstFindingsToErrors } from './bashAst';\nimport { nodeWorkspaceFS } from './workspaceFS';\n\nconst DEFAULT_TIMEOUT_MS = 60000;\nconst DEFAULT_MAX_OUTPUT_CHARS = 200000;\n/**\n * Hard cap on total stdout+stderr bytes a child process can stream\n * before we kill its process tree. Independent from `maxOutputChars`\n * (which only affects what the *model* sees) — this is the OOM\n * backstop. Configurable via `local.maxSpawnedBytes`.\n */\nconst DEFAULT_MAX_SPAWNED_BYTES = 50 * 1024 * 1024;\nconst DEFAULT_LOCAL_SESSION_ID = 'local';\nconst DEFAULT_SHELL = process.platform === 'win32' ? 'bash.exe' : 'bash';\n\n// `(?:--\\s+)?` before each destructive-target alternation: GNU/BSD\n// utilities accept `--` as an end-of-options marker, so `rm -rf -- /`\n// is identical in effect to `rm -rf /` but pre-fix it slipped past\n// the guard because the regex required the path to follow option\n// flags directly. Codex P1 #20.\n// `DESTRUCTIVE_TARGET` is the canonical \"protected location\" pattern:\n// matches `/`, `~`, `$HOME`, `${HOME}`, `.`, each optionally followed\n// by a trailing-slash and/or wildcard glob suffix. The suffix matrix:\n// '' — `$HOME` (round 14)\n// '/' — `$HOME/` (round 14, Codex P1 [37])\n// '*' — `$HOME*` (round 15, Codex P1 [42])\n// '/*' — `$HOME/*` (round 15, Codex P1 [42])\n// '.*' — `$HOME.*` (round 17, Codex P1 [47])\n// '/.*' — `$HOME/.*` (round 17, Codex P1 [47]) — the\n// dot-glob form deletes all dotfiles under the protected\n// root, just as destructive as `/*` but the prior matrix\n// missed it.\n// Suffix expression: `(?:\\/?\\.?\\*|\\/)?` — one of:\n// `\\/?\\.?\\*` → `*`, `.*`, `/*`, `/.*`\n// `\\/` → `/`\n// (empty) → bare base\nconst DESTRUCTIVE_TARGET = '(?:\\\\/|~|\\\\$\\\\{?HOME\\\\}?|\\\\.)(?:\\\\/?\\\\.?\\\\*|\\\\/)?';\n\nconst dangerousCommandPatterns: ReadonlyArray<RegExp> = [\n new RegExp(\n `\\\\brm\\\\s+(?:-[^\\\\s]*[rf][^\\\\s]*\\\\s+|-[^\\\\s]*[r][^\\\\s]*\\\\s+-[^\\\\s]*[f][^\\\\s]*\\\\s+)(?:--\\\\s+)?${DESTRUCTIVE_TARGET}\\\\s*(?:$|[;&|])`\n ),\n /\\b(?:mkfs|mkswap|fdisk|parted|diskutil)\\b/,\n /\\bdd\\s+[^;&|]*\\bof=\\/dev\\//,\n new RegExp(\n `\\\\bchmod\\\\s+-R\\\\s+(?:777|a\\\\+w)\\\\s+(?:--\\\\s+)?${DESTRUCTIVE_TARGET}(?:$|\\\\s|[;&|])`\n ),\n new RegExp(\n `\\\\bchown\\\\s+-R\\\\s+[^;&|]+\\\\s+(?:--\\\\s+)?${DESTRUCTIVE_TARGET}(?:$|\\\\s|[;&|])`\n ),\n /:\\s*\\(\\s*\\)\\s*\\{\\s*:\\s*\\|\\s*:\\s*&\\s*\\}\\s*;\\s*:/,\n];\n\n/**\n * Companion patterns that look for destructive targets *inside*\n * matching quote pairs. These are checked against the ORIGINAL\n * command (not the post-quote-strip `normalized` form), because\n * `stripQuotedContent` blanks the contents of quoted spans —\n * which would otherwise let `rm -rf \"/\"` and friends slip past\n * `dangerousCommandPatterns`.\n *\n * Kept as a separate list so we don't pay false-positive cost on\n * benign uses like `echo \"rm -rf /\"` (the print case): each pattern\n * here REQUIRES a quote *around the destructive path argument*, not\n * just a quote *somewhere* in the command. `echo \"rm -rf /\"` has\n * `/` outside of any quote-pair-around-the-path (the quotes wrap\n * the whole `rm -rf /` text), so it doesn't match here either.\n */\n// Quoted variant uses the same DESTRUCTIVE_TARGET (which accepts an\n// optional trailing slash) so `rm -rf \"$HOME/\"` and `rm -rf \"~/\"`\n// don't slip past. Codex P1 #37.\nconst quotedDestructivePatterns: ReadonlyArray<RegExp> = [\n new RegExp(\n `\\\\brm\\\\s+(?:-[^\\\\s]*[rf][^\\\\s]*\\\\s+){1,3}(?:--\\\\s+)?[\"']${DESTRUCTIVE_TARGET}[\"']`\n ),\n new RegExp(\n `\\\\bchmod\\\\s+-R\\\\s+(?:777|a\\\\+w)\\\\s+(?:--\\\\s+)?[\"']${DESTRUCTIVE_TARGET}[\"']`\n ),\n new RegExp(\n `\\\\bchown\\\\s+-R\\\\s+[^;&|]+\\\\s+(?:--\\\\s+)?[\"']${DESTRUCTIVE_TARGET}[\"']`\n ),\n];\n\n/**\n * Catches destructive operations smuggled inside a nested shell or\n * `eval` call, e.g. `bash -lc \"rm -rf $HOME\"` — the outer command\n * looks benign (`bash -lc \"...\"`) and the destructive `rm` lives\n * inside the quoted payload that `stripQuotedContent` blanks out.\n * Comprehensive review (manual finding C) flagged this as a real\n * bypass of the otherwise-correct quote-strip-then-match approach.\n *\n * Run against the ORIGINAL command (quotes intact) so the inside of\n * the nested-shell payload is visible. Conservative: matches only\n * the same operation set as `dangerousCommandPatterns` (rm -rf,\n * chmod -R 777, chown -R) when they appear inside a `<shell> -[l]?c\n * \"...\"` or `eval \"...\"` payload.\n */\nconst NESTED_SHELL_PREFIX = '(?:(?:ba|z|da|k)?sh|eval)\\\\s+(?:-l?c\\\\s+)?';\nconst nestedShellDestructivePatterns: ReadonlyArray<RegExp> = [\n new RegExp(\n NESTED_SHELL_PREFIX +\n '[\"\\'][^\"\\']*\\\\brm\\\\s+-[^\\\\s\"\\']*[rf][^\\\\s\"\\']*\\\\s+(?:--\\\\s+)?(?:\\\\/|~|\\\\$\\\\{?HOME\\\\}?|\\\\.)'\n ),\n new RegExp(\n NESTED_SHELL_PREFIX +\n '[\"\\'][^\"\\']*\\\\bchmod\\\\s+-R\\\\s+(?:777|a\\\\+w)\\\\s+(?:--\\\\s+)?(?:\\\\/|~|\\\\$\\\\{?HOME\\\\}?|\\\\.)'\n ),\n new RegExp(\n NESTED_SHELL_PREFIX +\n '[\"\\'][^\"\\']*\\\\bchown\\\\s+-R\\\\s+[^;&|]+\\\\s+(?:--\\\\s+)?(?:\\\\/|~|\\\\$\\\\{?HOME\\\\}?|\\\\.)'\n ),\n];\n\nconst mutatingCommandPattern =\n /\\b(?:rm|mv|cp|touch|mkdir|rmdir|ln|truncate|tee|sed\\s+-i|perl\\s+-pi|python(?:3)?\\s+-c|node\\s+-e|npm\\s+(?:install|ci|update|publish)|pnpm\\s+(?:install|update|publish)|yarn\\s+(?:install|add|publish)|git\\s+(?:add|commit|checkout|switch|reset|clean|rebase|merge|push|pull|stash|tag|branch)|chmod|chown)\\b|(?:^|[^<])>\\s*[^&]|\\bcat\\s+[^|;&]*>\\s*/;\n\ntype SpawnResult = {\n stdout: string;\n stderr: string;\n exitCode: number | null;\n timedOut: boolean;\n /**\n * True when the process was force-killed because total streamed bytes\n * exceeded `maxSpawnedBytes`. Distinct from `timedOut`. Without this\n * flag, callers (`bash_tool`, `execute_code`, etc.) would see a\n * SIGKILL'd process with `exitCode: null` and treat it as success\n * (Codex P1 — runaway commands like `yes` or noisy builds silently\n * looked successful even though their output was truncated).\n */\n overflowKilled?: boolean;\n /**\n * Signal name (e.g. `'SIGKILL'`, `'SIGSEGV'`) when the process was\n * terminated by a signal. Distinct from the overflow-kill path:\n * this captures `kill -9 $$` from inside the script, native crashes,\n * OS OOM killer, etc. Without this, signal-killed processes\n * reported `exitCode: null` and looked like clean runs (Codex P2 —\n * generalization of the overflow-kill fix). When present, the\n * exitCode field is also synthesized to `128 + signum` per the\n * POSIX convention so non-null-exit-code consumers see a failure.\n */\n signal?: string;\n /** Path to the full untruncated stdout/stderr when output exceeded `maxOutputChars`. */\n fullOutputPath?: string;\n};\n\n/**\n * POSIX convention: `128 + signum` when a process is killed by a\n * signal. Maps the common signals; unknown ones default to 1 so the\n * caller still sees a non-zero (failed) exit. Only used when Node's\n * `close` event reports `exitCode === null` (true signal kill).\n */\nconst SIGNAL_TO_EXIT_CODE: Record<string, number> = {\n SIGHUP: 129,\n SIGINT: 130,\n SIGQUIT: 131,\n SIGILL: 132,\n SIGTRAP: 133,\n SIGABRT: 134,\n SIGBUS: 135,\n SIGFPE: 136,\n SIGKILL: 137,\n SIGUSR1: 138,\n SIGSEGV: 139,\n SIGUSR2: 140,\n SIGPIPE: 141,\n SIGALRM: 142,\n SIGTERM: 143,\n};\nfunction exitCodeForSignal(signal: string | null): number {\n if (signal == null) return 1;\n return SIGNAL_TO_EXIT_CODE[signal] ?? 1;\n}\n\ntype RuntimeCommand = {\n command: string;\n args: string[];\n fileName: string;\n source?: string;\n};\n\ntype SandboxManagerType = {\n checkDependencies(): { errors: string[] };\n initialize(config: BuiltSandboxRuntimeConfig): Promise<void>;\n reset(): Promise<void>;\n wrapWithSandbox(command: string): Promise<string>;\n};\n\ntype SandboxRuntimeModule = {\n getDefaultWritePaths(): string[];\n SandboxManager: SandboxManagerType;\n};\n\nlet sandboxConfigKey: string | undefined;\nlet sandboxInitialized = false;\nlet sandboxRuntimePromise: Promise<SandboxRuntimeModule> | undefined;\n\nexport type BashValidationResult = {\n valid: boolean;\n errors: string[];\n warnings: string[];\n};\n\nfunction isToolExecutionConfig(\n config: t.ToolExecutionConfig | t.LocalExecutionConfig\n): config is t.ToolExecutionConfig {\n return 'engine' in config || 'local' in config;\n}\n\nexport function resolveLocalExecutionConfig(\n config?: t.ToolExecutionConfig | t.LocalExecutionConfig\n): t.LocalExecutionConfig {\n if (config != null && isToolExecutionConfig(config)) {\n return config.local ?? {};\n }\n return config ?? {};\n}\n\nexport function getLocalCwd(config?: t.LocalExecutionConfig): string {\n return resolve(config?.workspace?.root ?? config?.cwd ?? process.cwd());\n}\n\n/**\n * Resolves the effective workspace boundary: a list of absolute roots\n * that file operations are allowed to touch. The first entry is always\n * the canonical root (`getLocalCwd`); subsequent entries come from\n * `workspace.additionalRoots` when provided.\n *\n * Returns plain absolute paths — callers symlink-resolve when they\n * need realpath equality (see `resolveWorkspacePathSafe`).\n */\nexport function getWorkspaceRoots(config?: t.LocalExecutionConfig): string[] {\n const root = getLocalCwd(config);\n const extras = config?.workspace?.additionalRoots ?? [];\n if (extras.length === 0) return [root];\n const seen = new Set<string>([root]);\n const out: string[] = [root];\n for (const extra of extras) {\n // Relative `additionalRoots` entries are anchored to the\n // workspace root (so monorepo configs like\n // `additionalRoots: ['../shared']` resolve to a sibling of\n // `root` rather than to `process.cwd()/../shared`, which would\n // mean something completely different on a server with a\n // different cwd).\n const abs = isAbsolute(extra) ? resolve(extra) : resolve(root, extra);\n if (!seen.has(abs)) {\n seen.add(abs);\n out.push(abs);\n }\n }\n return out;\n}\n\n/**\n * Pluggable spawn resolver. Honours `local.exec.spawn` first, falls\n * back to the legacy top-level `local.spawn`, then to Node's\n * `child_process.spawn`. Centralised so engine swapping is one knob.\n */\nexport function getSpawn(config?: t.LocalExecutionConfig): t.LocalSpawn {\n return (config?.exec?.spawn ?? config?.spawn ?? spawn) as t.LocalSpawn;\n}\n\n/**\n * Pluggable filesystem resolver. Honours `local.exec.fs`, falls back\n * to the Node-host implementation. A future remote engine supplies\n * its own implementation here and inherits every file-touching tool.\n */\nexport function getWorkspaceFS(config?: t.LocalExecutionConfig): WorkspaceFS {\n return config?.exec?.fs ?? nodeWorkspaceFS;\n}\n\n/**\n * Resolves the workspace boundary for *write* operations. Honours\n * `workspace.allowWriteOutside` (and the deprecated\n * `allowOutsideWorkspace`) by returning `null`, which the path-safety\n * helpers interpret as \"skip the write clamp\".\n */\nexport function getWriteRoots(\n config: t.LocalExecutionConfig = {}\n): string[] | null {\n // Granular flag wins over the legacy one when explicitly set\n // (true OR false) — otherwise a host tightening access during\n // migration (`allowOutsideWorkspace: true, workspace.\n // allowWriteOutside: false`) would still get the loose behavior\n // because the legacy flag short-circuited the OR. Codex P1 #36.\n const granular = config.workspace?.allowWriteOutside;\n if (granular === true) return null;\n if (granular === false) return getWorkspaceRoots(config);\n if (config.allowOutsideWorkspace === true) return null;\n return getWorkspaceRoots(config);\n}\n\n/**\n * Resolves the workspace boundary for *read* operations. Honours\n * `workspace.allowReadOutside` (and the deprecated\n * `allowOutsideWorkspace`) by returning `null`.\n */\nexport function getReadRoots(\n config: t.LocalExecutionConfig = {}\n): string[] | null {\n // Same precedence as getWriteRoots: granular flag is authoritative\n // when set, legacy flag is the fallback. Codex P1 #36.\n const granular = config.workspace?.allowReadOutside;\n if (granular === true) return null;\n if (granular === false) return getWorkspaceRoots(config);\n if (config.allowOutsideWorkspace === true) return null;\n return getWorkspaceRoots(config);\n}\n\nexport function getLocalSessionId(config?: t.LocalExecutionConfig): string {\n const cwd = getLocalCwd(config);\n const digest = createHash('sha1').update(cwd).digest('hex').slice(0, 12);\n return `${DEFAULT_LOCAL_SESSION_ID}:${digest}`;\n}\n\nconst missingSandboxRuntimeMessage = [\n 'Local sandbox is enabled, but @anthropic-ai/sandbox-runtime is not installed.',\n 'Install it with `npm install @anthropic-ai/sandbox-runtime`, or disable local sandboxing with `local.sandbox.enabled: false`.',\n].join(' ');\nconst sandboxRuntimePackage = '@anthropic-ai/sandbox-runtime';\n\n/** Lazy-loads the ESM-only sandbox runtime only when sandboxing is enabled. */\nfunction loadSandboxRuntime(): Promise<SandboxRuntimeModule> {\n sandboxRuntimePromise ??= import(\n sandboxRuntimePackage\n ) as Promise<SandboxRuntimeModule>;\n return sandboxRuntimePromise;\n}\n\nfunction shouldUseLocalSandbox(config: t.LocalExecutionConfig): boolean {\n return config.sandbox?.enabled === true;\n}\n\nlet sandboxOffWarned = false;\n\nfunction maybeWarnSandboxOff(config: t.LocalExecutionConfig): void {\n if (\n sandboxOffWarned ||\n shouldUseLocalSandbox(config) ||\n config.exec?.sandboxed === true\n ) {\n return;\n }\n sandboxOffWarned = true;\n // eslint-disable-next-line no-console\n console.warn(\n '[@librechat/agents] Local execution engine is running without ' +\n '@anthropic-ai/sandbox-runtime wrapping. The agent has full access to ' +\n 'the host filesystem and network. Set toolExecution.local.sandbox.enabled ' +\n '= true to opt into process sandboxing.'\n );\n}\n\n/**\n * Test-only reset hook for the sandbox-off warning latch.\n *\n * @internal Not part of the public SDK surface.\n */\nexport function _resetLocalEngineWarningsForTests(): void {\n sandboxOffWarned = false;\n}\n\nexport function truncateLocalOutput(\n value: string,\n maxChars = DEFAULT_MAX_OUTPUT_CHARS\n): string {\n if (value.length <= maxChars) {\n return value;\n }\n const head = Math.floor(maxChars * 0.6);\n const tail = maxChars - head;\n const omitted = value.length - maxChars;\n return `${value.slice(0, head)}\\n\\n[... ${omitted} characters truncated ...]\\n\\n${value.slice(\n value.length - tail\n )}`;\n}\n\nfunction stripQuotedContent(command: string): string {\n let output = '';\n let quote: '\"' | '\\'' | '`' | undefined;\n let escaped = false;\n\n for (let i = 0; i < command.length; i++) {\n const char = command[i];\n\n if (escaped) {\n escaped = false;\n output += ' ';\n continue;\n }\n\n if (char === '\\\\') {\n escaped = true;\n output += ' ';\n continue;\n }\n\n if (quote != null) {\n if (char === quote) {\n quote = undefined;\n }\n output += ' ';\n continue;\n }\n\n if (char === '\"' || char === '\\'' || char === '`') {\n quote = char;\n output += ' ';\n continue;\n }\n\n if (char === '#') {\n while (i < command.length && command[i] !== '\\n') {\n output += ' ';\n i++;\n }\n output += '\\n';\n continue;\n }\n\n output += char;\n }\n\n return output;\n}\n\nexport async function validateBashCommand(\n command: string,\n config: t.LocalExecutionConfig = {}\n): Promise<BashValidationResult> {\n const errors: string[] = [];\n const warnings: string[] = [];\n const normalized = stripQuotedContent(command);\n\n if (command.trim() === '') {\n errors.push('Command is empty.');\n }\n\n if (command.includes('\\0')) {\n errors.push('Command contains a NUL byte.');\n }\n\n if (config.allowDangerousCommands !== true) {\n let blocked = false;\n // Strip-then-match for the bare-form patterns (avoids false\n // positives where the destructive text is buried inside a\n // string the user is just printing).\n for (const pattern of dangerousCommandPatterns) {\n if (pattern.test(normalized)) {\n errors.push('Command matches a destructive command pattern.');\n blocked = true;\n break;\n }\n }\n // Original-form pass for patterns that REQUIRE matching quote\n // pairs around a destructive path. Without this, `rm -rf \"/\"`\n // and `chmod -R 777 \"/\"` slip past the strip-then-match pass\n // because their destructive target is inside quotes.\n if (!blocked) {\n for (const pattern of quotedDestructivePatterns) {\n if (pattern.test(command)) {\n errors.push(\n 'Command matches a destructive command pattern (quoted target).'\n );\n blocked = true;\n break;\n }\n }\n }\n if (!blocked) {\n for (const pattern of nestedShellDestructivePatterns) {\n if (pattern.test(command)) {\n errors.push(\n 'Command matches a destructive command pattern (nested shell payload).'\n );\n break;\n }\n }\n }\n }\n\n const bashAstMode = config.bashAst ?? 'off';\n if (bashAstMode !== 'off' && config.allowDangerousCommands !== true) {\n const findings = runBashAstChecks(normalized, bashAstMode);\n const split = bashAstFindingsToErrors(findings);\n errors.push(...split.errors);\n warnings.push(...split.warnings);\n }\n\n if (config.readOnly === true && mutatingCommandPattern.test(normalized)) {\n errors.push(\n 'Command appears to mutate files or repository state in read-only local mode.'\n );\n }\n\n // Use the same shell the actual execution path will use. Hard-coding\n // DEFAULT_SHELL here would reject perfectly valid commands when the\n // host configures `local.shell` to a non-bash binary (or when the\n // runtime doesn't have bash installed at all but does have e.g. zsh).\n const syntaxShell = config.shell ?? DEFAULT_SHELL;\n const syntax = await spawnLocalProcess(\n syntaxShell,\n ['-n', '-c', command],\n {\n ...config,\n timeoutMs: Math.min(config.timeoutMs ?? DEFAULT_TIMEOUT_MS, 5000),\n sandbox: { enabled: false },\n },\n { internal: true }\n ).catch(\n (error: Error): SpawnResult => ({\n stdout: '',\n stderr: error.message,\n exitCode: 1,\n timedOut: false,\n })\n );\n\n if (syntax.exitCode !== 0) {\n errors.push(\n syntax.stderr.trim() === ''\n ? 'Command failed shell syntax validation.'\n : `Command failed shell syntax validation: ${syntax.stderr.trim()}`\n );\n }\n\n if (/\\bsudo\\b/.test(normalized)) {\n warnings.push('Command requests elevated privileges with sudo.');\n }\n\n return {\n valid: errors.length === 0,\n errors,\n warnings,\n };\n}\n\nasync function ensureSandbox(\n config: t.LocalExecutionConfig,\n cwd: string\n): Promise<SandboxManagerType | undefined> {\n if (!shouldUseLocalSandbox(config)) {\n return undefined;\n }\n\n const runtime = await loadSandboxRuntime().catch((error: Error) => {\n throw new Error(`${missingSandboxRuntimeMessage} Cause: ${error.message}`);\n });\n\n const runtimeConfig = buildSandboxRuntimeConfig(\n config,\n cwd,\n runtime.getDefaultWritePaths\n );\n const nextKey = JSON.stringify(runtimeConfig);\n\n if (sandboxInitialized && sandboxConfigKey === nextKey) {\n return runtime.SandboxManager;\n }\n\n const dependencyCheck = runtime.SandboxManager.checkDependencies();\n if (dependencyCheck.errors.length > 0) {\n if (config.sandbox?.failIfUnavailable === true) {\n throw new Error(\n `Local sandbox requested but unavailable: ${dependencyCheck.errors.join('; ')}`\n );\n }\n return undefined;\n }\n\n if (sandboxInitialized) {\n await runtime.SandboxManager.reset();\n }\n\n await runtime.SandboxManager.initialize(runtimeConfig);\n sandboxInitialized = true;\n sandboxConfigKey = nextKey;\n return runtime.SandboxManager;\n}\n\n/**\n * Loopback addresses the in-process programmatic-tool bridge listens\n * on (`LocalProgrammaticToolCalling.ts` binds 127.0.0.1). Sandboxed\n * code launched by `run_tools_with_code` / `run_tools_with_bash` HTTPs\n * back to that address — without the entries below, the bridge is\n * silently blocked under sandbox.\n */\nconst BRIDGE_LOOPBACK_HOSTS = ['127.0.0.1', 'localhost', '::1'] as const;\n\n/**\n * Structural shape of the sandbox-runtime config we hand to\n * `SandboxManager.initialize()`. Intentionally NOT typed as the peer\n * `SandboxRuntimeConfig` from `@anthropic-ai/sandbox-runtime`: that\n * package is an OPTIONAL peer dep, and exporting a function whose\n * return type references it would make our generated `.d.ts` import\n * a module the consumer may not have installed (Codex P1 #22 — type-\n * checking would fail with `Cannot find module\n * '@anthropic-ai/sandbox-runtime'` for any host that doesn't enable\n * local sandboxing). The shape here is a structural subset; assignable\n * to the real `SandboxRuntimeConfig` at the one runtime call site.\n *\n * @internal\n */\nexport interface BuiltSandboxRuntimeConfig {\n network: {\n allowedDomains: string[];\n deniedDomains: string[];\n allowUnixSockets?: string[];\n allowAllUnixSockets?: boolean;\n allowLocalBinding?: boolean;\n allowMachLookup?: string[];\n };\n filesystem: {\n denyRead: string[];\n allowRead?: string[];\n allowWrite: string[];\n denyWrite: string[];\n allowGitConfig?: boolean;\n };\n}\n\nexport function buildSandboxRuntimeConfig(\n config: t.LocalExecutionConfig,\n cwd: string,\n getDefaultWritePaths: () => string[]\n): BuiltSandboxRuntimeConfig {\n const sandbox = config.sandbox;\n // Seed allowedDomains with loopback so the programmatic-tool bridge\n // works under sandbox. If the host explicitly denied a loopback\n // entry via `deniedDomains`, respect that and skip seeding it.\n const userAllowed = sandbox?.network?.allowedDomains ?? [];\n const denied = new Set(sandbox?.network?.deniedDomains ?? []);\n const seededLoopback = BRIDGE_LOOPBACK_HOSTS.filter(\n (host) => !denied.has(host) && !userAllowed.includes(host)\n );\n const allowedDomains = [...seededLoopback, ...userAllowed];\n // Mirror the file-tools workspace boundary: anything in\n // `additionalRoots` counts as in-workspace, so sandboxed shell/code\n // can write there too. Without this, file_tools can resolve a\n // sibling-root path but `bash`/`execute_code` is denied write\n // access — confusing divergence flagged in Codex P2 #15.\n const workspaceWriteRoots =\n config.workspace?.additionalRoots != null\n ? getWorkspaceRoots(config)\n : [cwd];\n return {\n network: {\n allowedDomains,\n deniedDomains: sandbox?.network?.deniedDomains ?? [],\n ...(sandbox?.network?.allowUnixSockets != null && {\n allowUnixSockets: sandbox.network.allowUnixSockets,\n }),\n ...(sandbox?.network?.allowAllUnixSockets != null && {\n allowAllUnixSockets: sandbox.network.allowAllUnixSockets,\n }),\n ...(sandbox?.network?.allowLocalBinding != null && {\n allowLocalBinding: sandbox.network.allowLocalBinding,\n }),\n ...(sandbox?.network?.allowMachLookup != null && {\n allowMachLookup: sandbox.network.allowMachLookup,\n }),\n },\n filesystem: {\n denyRead: sandbox?.filesystem?.denyRead ?? [],\n allowRead: sandbox?.filesystem?.allowRead,\n allowWrite: sandbox?.filesystem?.allowWrite ?? [\n ...workspaceWriteRoots,\n ...getDefaultWritePaths(),\n ],\n denyWrite: sandbox?.filesystem?.denyWrite ?? [\n '.env',\n '.env.*',\n '.git/config',\n '.git/hooks/**',\n ],\n allowGitConfig: sandbox?.filesystem?.allowGitConfig,\n },\n };\n}\n\n/**\n * Internal options for {@link spawnLocalProcess} that we don't want\n * exposed on the public `LocalExecutionConfig` type.\n *\n * @internal\n */\nexport interface SpawnLocalProcessOptions {\n /**\n * When true, suppress the \"sandbox is off\" warning AND its latch\n * for this spawn. Use for SDK-internal probes (`bash -n` syntax\n * preflight, `rg --version`, etc.) that intentionally run with\n * the sandbox forced off — the warning is noise for those, and\n * letting the latch flip would hide the warning when a *real*\n * unsandboxed execution happens later in the same process.\n */\n internal?: boolean;\n}\n\nexport const LOCAL_SPAWN_TIMEOUT_MS = Symbol('librechat.localSpawn.timeoutMs');\n\nexport async function spawnLocalProcess(\n command: string,\n args: string[],\n config: t.LocalExecutionConfig = {},\n options?: SpawnLocalProcessOptions\n): Promise<SpawnResult> {\n const cwd = getLocalCwd(config);\n const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const maxOutputChars = config.maxOutputChars ?? DEFAULT_MAX_OUTPUT_CHARS;\n // Streaming caps. Local tools execute arbitrary shell/code, so a noisy\n // command (`yes`, `cat /dev/urandom | base64`, a verbose build) could\n // accumulate gigabytes in memory before hitting the post-close cap.\n // We bound in-memory per-stream and spill the rest to disk; we also\n // hard-kill the child once total streamed bytes pass `maxSpawnedBytes`\n // so a process producing unbounded output gets stopped instead of\n // letting the host OOM.\n const inMemoryCapBytes = maxOutputChars * 2;\n const hardKillBytes = config.maxSpawnedBytes ?? DEFAULT_MAX_SPAWNED_BYTES;\n const sandboxManager = await ensureSandbox(config, cwd);\n // Internal probes (validateBashCommand syntax preflight,\n // isRipgrepAvailable, syntax-check probe cache priming) pass\n // `internal: true` so they don't emit a misleading \"sandbox is\n // off\" warning AND don't flip `sandboxOffWarned = true`. Without\n // this Codex P2 path: a run with `sandbox.enabled: true` would\n // see a false warning from the syntax preflight, and the latch\n // flip would suppress the warning in a *later* truly-unsandboxed\n // run — exactly the scenario operators need to see.\n if (sandboxManager == null && options?.internal !== true) {\n maybeWarnSandboxOff(config);\n }\n let spawnCommand = command;\n let spawnArgs = args;\n\n if (sandboxManager != null) {\n const rendered = [command, ...args.map(shellQuote)].join(' ');\n const sandboxed = await sandboxManager.wrapWithSandbox(rendered);\n spawnCommand = config.shell ?? DEFAULT_SHELL;\n spawnArgs = ['-lc', sandboxed];\n }\n\n const launcher = getSpawn(config);\n return new Promise<SpawnResult>((resolveResult, reject) => {\n const spawnOptions: import('child_process').SpawnOptions = {\n cwd,\n detached: process.platform !== 'win32',\n env: { ...process.env, ...(config.env ?? {}) },\n stdio: ['ignore', 'pipe', 'pipe'],\n };\n Object.defineProperty(spawnOptions, LOCAL_SPAWN_TIMEOUT_MS, {\n value: timeoutMs,\n });\n const child = launcher(spawnCommand, spawnArgs, spawnOptions);\n\n let stdout = '';\n let stderr = '';\n let totalSpawnedBytes = 0;\n let overflowKilled = false;\n let spillStream: import('fs').WriteStream | undefined;\n let spillPath: string | undefined;\n let settled = false;\n let timedOut = false;\n let timeout: NodeJS.Timeout | undefined;\n\n const ensureSpill = (): void => {\n if (spillStream != null) return;\n // Lazy-open the temp file the first time a stream's in-memory\n // buffer overflows. Seed it with everything we've buffered so\n // the file holds the FULL output (not just the post-cap tail).\n // Uses the static `createWriteStream` import — `require('fs')`\n // would throw `ReferenceError: require is not defined` in ESM\n // consumers (this package ships both `dist/cjs` and `dist/esm`).\n spillPath = resolve(tmpdir(), `lc-local-output-${randomUUID()}.txt`);\n spillStream = createWriteStream(spillPath);\n spillStream.write('===== stdout =====\\n');\n spillStream.write(stdout);\n spillStream.write('\\n===== stderr =====\\n');\n spillStream.write(stderr);\n spillStream.write('\\n===== overflow stream begins here =====\\n');\n };\n\n const handleChunk = (buf: Buffer, kind: 'stdout' | 'stderr'): void => {\n totalSpawnedBytes += buf.length;\n // hardKillBytes <= 0 means \"no cap\" per the public config contract\n // (see LocalExecutionConfig.maxSpawnedBytes). Skip the kill check\n // entirely in that case so a single byte doesn't terminate the run.\n if (\n hardKillBytes > 0 &&\n totalSpawnedBytes > hardKillBytes &&\n !overflowKilled\n ) {\n overflowKilled = true;\n killProcessTree(child);\n return;\n }\n const current = kind === 'stdout' ? stdout : stderr;\n if (current.length < inMemoryCapBytes) {\n const text = buf.toString('utf8');\n if (kind === 'stdout') stdout += text;\n else stderr += text;\n if (current.length + text.length >= inMemoryCapBytes) {\n ensureSpill();\n }\n } else {\n ensureSpill();\n spillStream!.write(`[${kind}] `);\n spillStream!.write(buf);\n }\n };\n\n const finish = (result: SpawnResult): void => {\n if (settled) {\n return;\n }\n settled = true;\n if (timeout != null) {\n clearTimeout(timeout);\n }\n const finalize = (): void => {\n const truncated = {\n stdout: truncateLocalOutput(result.stdout, maxOutputChars),\n stderr: truncateLocalOutput(result.stderr, maxOutputChars),\n };\n resolveResult({\n ...result,\n ...truncated,\n ...(spillPath != null ? { fullOutputPath: spillPath } : {}),\n });\n };\n if (spillStream == null) {\n finalize();\n return;\n }\n // Wait for the temp file to flush before reporting the path.\n // Otherwise the model sees `full_output_path: …` for a file\n // that's still being written.\n spillStream.end(() => finalize());\n };\n\n const fail = (error: Error): void => {\n if (settled) {\n return;\n }\n settled = true;\n if (timeout != null) {\n clearTimeout(timeout);\n }\n if (spillStream != null) {\n spillStream.end();\n }\n reject(error);\n };\n\n if (timeoutMs > 0) {\n timeout = setTimeout(() => {\n timedOut = true;\n killProcessTree(child);\n }, timeoutMs);\n }\n\n child.stdout.on('data', (chunk: Buffer) => {\n handleChunk(chunk, 'stdout');\n });\n\n child.stderr.on('data', (chunk: Buffer) => {\n handleChunk(chunk, 'stderr');\n });\n\n child.on('error', fail);\n\n child.on('close', (exitCode, signal) => {\n // Synthesize a non-zero exit code whenever the process exited\n // by signal — Node reports `exitCode: null` in that case and\n // the formatter only prints non-null exit codes, so signal\n // kills (overflow guard, `kill -9 $$` from inside the script,\n // native crashes, OS OOM killer, …) would otherwise look like\n // successful runs (Codex P1 + Codex P2). Overflow path keeps\n // its 137 (SIGKILL) for compatibility; other signals map per\n // POSIX `128 + signum`.\n let finalExit: number | null = exitCode;\n if (finalExit == null) {\n if (overflowKilled) {\n finalExit = 137;\n } else if (signal != null) {\n finalExit = exitCodeForSignal(signal);\n }\n }\n finish({\n stdout,\n stderr,\n exitCode: finalExit,\n timedOut,\n ...(overflowKilled ? { overflowKilled: true } : {}),\n ...(signal != null ? { signal } : {}),\n });\n });\n });\n}\n\nexport async function executeLocalBash(\n command: string,\n config: t.LocalExecutionConfig = {}\n): Promise<SpawnResult> {\n const validation = await validateBashCommand(command, config);\n if (!validation.valid) {\n throw new Error(validation.errors.join('\\n'));\n }\n const shell = config.shell ?? DEFAULT_SHELL;\n return spawnLocalProcess(shell, ['-lc', command], config);\n}\n\n/**\n * Variant of `executeLocalBash` that exposes `args` as positional\n * shell parameters (`$1`, `$2`, …). Mirrors what the other runtimes\n * do in `getRuntimeCommand`. Uses the standard `bash -c <code> --\n * arg0 arg1 …` form: the `--` becomes `$0`, then `args[0]` is `$1`\n * and so on. Same AST validation as the no-args path.\n *\n * Used by both the `execute_code`/`lang:'bash'` path AND the\n * `bash_tool` factory so the schema's `args` contract works\n * identically in both surfaces.\n */\n/**\n * Matches a single arg that, on its own, references a protected\n * location (`/`, `~`, `$HOME`, `${HOME}`, `.`, with optional trailing\n * slash, wildcard, or dot-glob suffix). Used to spot the\n * `command: 'rm -rf \"$1\"', args: ['/']` shape where the destructive\n * target is moved into a positional arg to evade the command regex.\n * Codex P1 [45], extended for dot-glob in Codex P1 [47] (mirrors the\n * `DESTRUCTIVE_TARGET` suffix matrix exactly).\n */\nconst PROTECTED_TARGET_ARG_RE = /^(?:\\/|~|\\$\\{?HOME\\}?|\\.)(?:\\/?\\.?\\*|\\/)?$/;\n\n/**\n * Mutating-op recognizer for the args check. Conservative: only the\n * three operations the destructive-command guard already covers\n * directly (`rm -rf …`, `chmod -R …`, `chown -R …`). Other shell\n * builtins might mutate state (`mv`, `cp` over an existing file,\n * etc.) but the destructive guard doesn't try to catch those today,\n * so we don't widen here either.\n */\nconst DESTRUCTIVE_OP_IN_COMMAND_RE =\n /\\b(?:rm\\s+-[^\\s]*[rf]|chmod\\s+-R|chown\\s+-R)\\b/;\n\nexport async function executeLocalBashWithArgs(\n command: string,\n args: readonly string[],\n config: t.LocalExecutionConfig = {}\n): Promise<SpawnResult> {\n const validation = await validateBashCommand(command, config);\n if (!validation.valid) {\n throw new Error(validation.errors.join('\\n'));\n }\n // Per-arg protected-target check (Codex P1 [45]). The command\n // regex can't see `$1`/`$@` substitutions at runtime — `command:\n // 'rm -rf \"$1\"', args: ['/']` would expand to `rm -rf '/'` inside\n // bash but the validator only saw `rm -rf \"$1\"` (no destructive\n // target). Block when (a) the command contains a destructive op\n // AND (b) at least one arg matches the protected-target shape.\n // Skipped when allowDangerousCommands is true (host-opted-in).\n if (\n args.length > 0 &&\n config.allowDangerousCommands !== true &&\n DESTRUCTIVE_OP_IN_COMMAND_RE.test(command)\n ) {\n const offending = args.find((a) => PROTECTED_TARGET_ARG_RE.test(a));\n if (offending !== undefined) {\n throw new Error(\n `Command matches a destructive command pattern (protected target \"${offending}\" passed via positional arg).`\n );\n }\n }\n const shell = config.shell ?? DEFAULT_SHELL;\n return spawnLocalProcess(shell, ['-lc', command, '--', ...args], config);\n}\n\nexport async function executeLocalCode(\n input: {\n lang: string;\n code: string;\n args?: string[];\n },\n config: t.LocalExecutionConfig = {}\n): Promise<SpawnResult> {\n if (input.lang === 'bash') {\n // Append `args` as positional parameters via the standard\n // `bash -c <code> -- <args...>` form so `$1`, `$2`, … inside\n // `code` resolve correctly. Honours the same args contract the\n // other runtimes (py, js, …) already support.\n if (input.args != null && input.args.length > 0) {\n return executeLocalBashWithArgs(input.code, input.args, config);\n }\n return executeLocalBash(input.code, config);\n }\n\n const tempDir = resolve(tmpdir(), `lc-local-${randomUUID()}`);\n await mkdir(tempDir, { recursive: true });\n\n try {\n const runtime = getRuntimeCommand(\n input.lang,\n tempDir,\n input.code,\n input.args,\n config.shell\n );\n if (runtime.source != null) {\n await writeFile(\n resolve(tempDir, runtime.fileName),\n runtime.source,\n 'utf8'\n );\n }\n return await spawnLocalProcess(runtime.command, runtime.args, config);\n } finally {\n await rm(tempDir, { recursive: true, force: true });\n }\n}\n\nfunction getRuntimeCommand(\n lang: string,\n tempDir: string,\n code: string,\n args: string[] = [],\n // Override for the shell used by compile-style runtimes (`rs`,\n // `c`, `cpp`, `java`, `d`, `f90`). Threads `local.shell` so a host\n // that doesn't have bash (or wants `/bin/sh` / zsh) can still\n // execute these languages — Codex P2 #29: the bare-bash hardcode\n // mirrored the same gap that Codex P1 #6 fixed for the syntax\n // preflight, but had been missed for these runtime invocations.\n shellOverride?: string\n): RuntimeCommand {\n const fileFor = (name: string): string => resolve(tempDir, name);\n const shell = shellOverride ?? configShell();\n\n switch (lang) {\n case 'py':\n return {\n command: 'python3',\n args: [fileFor('main.py'), ...args],\n fileName: 'main.py',\n source: code,\n };\n case 'js':\n return {\n command: 'node',\n args: [fileFor('main.js'), ...args],\n fileName: 'main.js',\n source: code,\n };\n case 'ts':\n return {\n command: 'npx',\n args: ['--no-install', 'tsx', fileFor('main.ts'), ...args],\n fileName: 'main.ts',\n source: code,\n };\n case 'php':\n return {\n command: 'php',\n args: [fileFor('main.php'), ...args],\n fileName: 'main.php',\n source: code,\n };\n case 'go':\n return {\n command: 'go',\n args: ['run', fileFor('main.go'), ...args],\n fileName: 'main.go',\n source: code,\n };\n case 'rs':\n return {\n command: shell,\n args: [\n '-lc',\n `rustc ${shellQuote(fileFor('main.rs'))} -o ${shellQuote(\n fileFor('main-rs')\n )} && ${shellQuote(fileFor('main-rs'))} ${args.map(shellQuote).join(' ')}`,\n ],\n fileName: 'main.rs',\n source: code,\n };\n case 'c':\n return {\n command: shell,\n args: [\n '-lc',\n `cc ${shellQuote(fileFor('main.c'))} -o ${shellQuote(\n fileFor('main-c')\n )} && ${shellQuote(fileFor('main-c'))} ${args.map(shellQuote).join(' ')}`,\n ],\n fileName: 'main.c',\n source: code,\n };\n case 'cpp':\n return {\n command: shell,\n args: [\n '-lc',\n `c++ ${shellQuote(fileFor('main.cpp'))} -o ${shellQuote(\n fileFor('main-cpp')\n )} && ${shellQuote(fileFor('main-cpp'))} ${args.map(shellQuote).join(' ')}`,\n ],\n fileName: 'main.cpp',\n source: code,\n };\n case 'java':\n return {\n command: shell,\n args: [\n '-lc',\n `javac ${shellQuote(fileFor('Main.java'))} && java -cp ${shellQuote(\n tempDir\n )} Main ${args.map(shellQuote).join(' ')}`,\n ],\n fileName: 'Main.java',\n source: code,\n };\n case 'r':\n return {\n command: 'Rscript',\n args: [fileFor('main.R'), ...args],\n fileName: 'main.R',\n source: code,\n };\n case 'd':\n return {\n command: shell,\n args: [\n '-lc',\n `dmd ${shellQuote(fileFor('main.d'))} -of=${shellQuote(\n fileFor('main-d')\n )} && ${shellQuote(fileFor('main-d'))} ${args.map(shellQuote).join(' ')}`,\n ],\n fileName: 'main.d',\n source: code,\n };\n case 'f90':\n return {\n command: shell,\n args: [\n '-lc',\n `gfortran ${shellQuote(fileFor('main.f90'))} -o ${shellQuote(\n fileFor('main-f90')\n )} && ${shellQuote(fileFor('main-f90'))} ${args.map(shellQuote).join(' ')}`,\n ],\n fileName: 'main.f90',\n source: code,\n };\n default:\n throw new Error(`Unsupported local runtime: ${lang}`);\n }\n}\n\nfunction configShell(): string {\n return process.platform === 'win32' ? 'bash.exe' : 'bash';\n}\n\n/**\n * How long after SIGTERM we wait before escalating to SIGKILL. A\n * cooperative process gets a graceful chance to flush + clean up;\n * a process that ignores or traps SIGTERM (`trap '' TERM`) gets\n * killed unconditionally so timeoutMs / maxSpawnedBytes can't be\n * defeated by a hostile script. Codex P1 #28 — pre-fix the spawn\n * promise would never resolve in that case and the entire tool run\n * would hang past the advertised timeout.\n */\nconst SIGKILL_ESCALATION_MS = 2000;\n\nfunction sigterm(child: ChildProcess): void {\n if (child.pid == null) {\n child.kill('SIGTERM');\n return;\n }\n try {\n if (process.platform === 'win32') {\n child.kill('SIGTERM');\n return;\n }\n process.kill(-child.pid, 'SIGTERM');\n } catch {\n child.kill('SIGTERM');\n }\n}\n\nfunction sigkill(child: ChildProcess): void {\n if (child.exitCode != null || child.signalCode != null) return;\n if (child.pid == null) {\n child.kill('SIGKILL');\n return;\n }\n try {\n if (process.platform === 'win32') {\n child.kill('SIGKILL');\n return;\n }\n process.kill(-child.pid, 'SIGKILL');\n } catch {\n try {\n child.kill('SIGKILL');\n } catch {\n /* already dead */\n }\n }\n}\n\nfunction killProcessTree(child: ChildProcess): void {\n sigterm(child);\n // Escalate to SIGKILL if the child is still alive after the grace\n // window. Use unref() so the timer doesn't keep the Node process\n // alive past the parent's natural exit.\n const escalation = setTimeout(() => sigkill(child), SIGKILL_ESCALATION_MS);\n escalation.unref();\n child.once('close', () => clearTimeout(escalation));\n}\n\nexport function shellQuote(value: string): string {\n if (value === '') {\n return '\\'\\'';\n }\n if (/^[A-Za-z0-9_/:=.,@%+-]+$/.test(value)) {\n return value;\n }\n return `'${value.replace(/'/g, '\\'\\\\\\'\\'')}'`;\n}\n\nexport function resolveWorkspacePath(\n filePath: string,\n config: t.LocalExecutionConfig = {},\n intent: 'read' | 'write' = 'write'\n): string {\n const cwd = getLocalCwd(config);\n const absolutePath = isAbsolute(filePath)\n ? resolve(filePath)\n : resolve(cwd, filePath);\n\n const roots =\n intent === 'write' ? getWriteRoots(config) : getReadRoots(config);\n if (roots == null) return absolutePath; // explicit allow-outside\n\n if (absolutePath === cwd || isInsideAnyRoot(absolutePath, roots)) {\n return absolutePath;\n }\n throw new Error(`Path is outside the local workspace: ${filePath}`);\n}\n\nfunction isInsideAnyRoot(absolutePath: string, roots: string[]): boolean {\n for (const root of roots) {\n if (absolutePath === root) return true;\n const rel = relative(root, absolutePath);\n if (!rel.startsWith('..') && !isAbsolute(rel)) return true;\n }\n return false;\n}\n\ntype RealpathFn = (p: string) => Promise<string>;\n\nasync function realpathOrSelf(\n absolutePath: string,\n realpathImpl: RealpathFn = realpath\n): Promise<string> {\n try {\n return await realpathImpl(absolutePath);\n } catch {\n return absolutePath;\n }\n}\n\n/**\n * Resolves the realpath of `absolutePath`, falling back to the nearest\n * existing ancestor when the target itself does not yet exist (so the\n * containment check still works for `write_file` to a brand-new path).\n *\n * Codex P2 #38: takes the realpath impl as a parameter so callers\n * can route through `WorkspaceFS.realpath` when a custom engine is\n * configured. Pre-fix, host `fs/promises.realpath` would fail on a\n * remote/in-memory FS path and silently fall back to lexical\n * containment, leaving the symlink-escape clamp ineffective on\n * non-default engines.\n */\nasync function realpathOfPathOrAncestor(\n absolutePath: string,\n realpathImpl: RealpathFn = realpath\n): Promise<string> {\n let current = absolutePath;\n let suffix = '';\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n while (true) {\n try {\n const real = await realpathImpl(current);\n return suffix === '' ? real : resolve(real, suffix);\n } catch {\n const parent = resolve(current, '..');\n if (parent === current) {\n return absolutePath;\n }\n const base = current.slice(parent.length + 1);\n suffix = suffix === '' ? base : `${base}/${suffix}`;\n current = parent;\n }\n }\n}\n\n/**\n * Resolves a workspace path AND follows any symlinks before checking\n * containment, so a symlink inside the workspace pointing outside is\n * rejected even though the lexical path looks safe. Handles paths that\n * don't yet exist (e.g. write_file targets) by realpath-resolving the\n * nearest existing ancestor and re-attaching the unresolved suffix.\n */\nexport async function resolveWorkspacePathSafe(\n filePath: string,\n config: t.LocalExecutionConfig = {},\n intent: 'read' | 'write' = 'write'\n): Promise<string> {\n const lexical = resolveWorkspacePath(filePath, config, intent);\n const roots =\n intent === 'write' ? getWriteRoots(config) : getReadRoots(config);\n if (roots == null) {\n return lexical;\n }\n // Route realpath through the configured WorkspaceFS so a custom\n // engine (in-memory, remote) gets the same symlink-escape clamp\n // the host-fs path gets. Codex P2 #38: pre-fix the host realpath\n // would fail on a non-default FS path and silently fall back to\n // lexical containment, leaving the clamp ineffective.\n const fsRealpath: RealpathFn = (p) => getWorkspaceFS(config).realpath(p);\n const realRoots = await Promise.all(\n roots.map((r) => realpathOrSelf(r, fsRealpath))\n );\n const realPath = await realpathOfPathOrAncestor(lexical, fsRealpath);\n if (isInsideAnyRoot(realPath, realRoots)) {\n return lexical;\n }\n throw new Error(\n `Path is outside the local workspace (symlink escape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AA,KAAA,QAAA,CAAe,MAAM,MAAM;CACpD,QAAQ;EACN,MAAM,UAAA,GAAA,KAAA,QAAA,CAAiB,SAAS,IAAI;EACpC,IAAI,WAAW,SACb,OAAO;EAET,MAAM,OAAO,QAAQ,MAAM,OAAO,SAAS,CAAC;EAC5C,SAAS,WAAW,KAAK,OAAO,GAAG,KAAK,GAAG;EAC3C,UAAU;CACZ;AAEJ;;;;;;;;AASA,eAAsB,yBACpB,UACA,SAAiC,CAAC,GAClC,SAA2B,SACV;CACjB,MAAM,UAAU,qBAAqB,UAAU,QAAQ,MAAM;CAC7D,MAAM,QACJ,WAAW,UAAU,cAAc,MAAM,IAAI,aAAa,MAAM;CAClE,IAAI,SAAS,MACX,OAAO;CAOT,MAAM,cAA0B,MAAM,eAAe,MAAM,CAAC,CAAC,SAAS,CAAC;CACvE,MAAM,YAAY,MAAM,QAAQ,IAC9B,MAAM,KAAK,MAAM,eAAe,GAAG,UAAU,CAAC,CAChD;CAEA,IAAI,gBAAgB,MADG,yBAAyB,SAAS,UAAU,GACrC,SAAS,GACrC,OAAO;CAET,MAAM,IAAI,MACR,yDAAyD,UAC3D;AACF"}
|
|
1
|
+
{"version":3,"file":"LocalExecutionEngine.cjs","names":["spawn","nodeWorkspaceFS","bashAstFindingsToErrors","runBashAstChecks","realpath"],"sources":["../../../../src/tools/local/LocalExecutionEngine.ts"],"mappings":";;;;;;;;;AAYA,MAAM,qBAAqB;AAC3B,MAAM,2BAA2B;AAOjC,MAAM,4BAA4B,KAAK,OAAO;AAC9C,MAAM,2BAA2B;AACjC,MAAM,gBAAgB,QAAQ,aAAa,UAAU,aAAa;AAuBlE,MAAM,qBAAqB;AAE3B,MAAM,2BAAkD;CACtD,IAAI,OACF,+FAA+F,mBAAmB,gBACpH;CACA;CACA;CACA,IAAI,OACF,iDAAiD,mBAAmB,gBACtE;CACA,IAAI,OACF,2CAA2C,mBAAmB,gBAChE;CACA;AACF;AAoBA,MAAM,4BAAmD;CACvD,IAAI,OACF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