@@ -3,6 +3,7 @@ import { resolvePluginTools } from "../plugins/tools.js";
33import type { GatewayMessageChannel } from "../utils/message-channel.js" ;
44import { resolveSessionAgentId } from "./agent-scope.js" ;
55import type { SandboxFsBridge } from "./sandbox/fs-bridge.js" ;
6+ import type { SpawnedToolContext } from "./spawned-context.js" ;
67import type { ToolFsPolicy } from "./tool-fs-policy.js" ;
78import { createAgentsListTool } from "./tools/agents-list-tool.js" ;
89import { createBrowserTool } from "./tools/browser-tool.js" ;
@@ -24,57 +25,52 @@ import { createTtsTool } from "./tools/tts-tool.js";
2425import { createWebFetchTool , createWebSearchTool } from "./tools/web-tools.js" ;
2526import { resolveWorkspaceRoot } from "./workspace-dir.js" ;
2627
27- export function createOpenClawTools ( options ?: {
28- sandboxBrowserBridgeUrl ?: string ;
29- allowHostBrowserControl ?: boolean ;
30- agentSessionKey ?: string ;
31- agentChannel ?: GatewayMessageChannel ;
32- agentAccountId ?: string ;
33- /** Delivery target (e.g. telegram:group:123:topic:456) for topic/thread routing. */
34- agentTo ?: string ;
35- /** Thread/topic identifier for routing replies to the originating thread. */
36- agentThreadId ?: string | number ;
37- /** Group id for channel-level tool policy inheritance. */
38- agentGroupId ?: string | null ;
39- /** Group channel label for channel-level tool policy inheritance. */
40- agentGroupChannel ?: string | null ;
41- /** Group space label for channel-level tool policy inheritance. */
42- agentGroupSpace ?: string | null ;
43- agentDir ?: string ;
44- sandboxRoot ?: string ;
45- sandboxFsBridge ?: SandboxFsBridge ;
46- fsPolicy ?: ToolFsPolicy ;
47- workspaceDir ?: string ;
48- sandboxed ?: boolean ;
49- config ?: OpenClawConfig ;
50- pluginToolAllowlist ?: string [ ] ;
51- /** Current channel ID for auto-threading (Slack). */
52- currentChannelId ?: string ;
53- /** Current thread timestamp for auto-threading (Slack). */
54- currentThreadTs ?: string ;
55- /** Current inbound message id for action fallbacks (e.g. Telegram react). */
56- currentMessageId ?: string | number ;
57- /** Reply-to mode for Slack auto-threading. */
58- replyToMode ?: "off" | "first" | "all" ;
59- /** Mutable ref to track if a reply was sent (for "first" mode). */
60- hasRepliedRef ?: { value : boolean } ;
61- /** If true, the model has native vision capability */
62- modelHasVision ?: boolean ;
63- /** If true, nodes action="invoke" can call media-returning commands directly. */
64- allowMediaInvokeCommands ?: boolean ;
65- /** Explicit agent ID override for cron/hook sessions. */
66- requesterAgentIdOverride ?: string ;
67- /** Require explicit message targets (no implicit last-route sends). */
68- requireExplicitMessageTarget ?: boolean ;
69- /** If true, omit the message tool from the tool list. */
70- disableMessageTool ?: boolean ;
71- /** Trusted sender id from inbound context (not tool args). */
72- requesterSenderId ?: string | null ;
73- /** Whether the requesting sender is an owner. */
74- senderIsOwner ?: boolean ;
75- /** Ephemeral session UUID — regenerated on /new and /reset. */
76- sessionId ?: string ;
77- } ) : AnyAgentTool [ ] {
28+ export function createOpenClawTools (
29+ options ?: {
30+ sandboxBrowserBridgeUrl ?: string ;
31+ allowHostBrowserControl ?: boolean ;
32+ agentSessionKey ?: string ;
33+ agentChannel ?: GatewayMessageChannel ;
34+ agentAccountId ?: string ;
35+ /** Delivery target (e.g. telegram:group:123:topic:456) for topic/thread routing. */
36+ agentTo ?: string ;
37+ /** Thread/topic identifier for routing replies to the originating thread. */
38+ agentThreadId ?: string | number ;
39+ agentDir ?: string ;
40+ sandboxRoot ?: string ;
41+ sandboxFsBridge ?: SandboxFsBridge ;
42+ fsPolicy ?: ToolFsPolicy ;
43+ sandboxed ?: boolean ;
44+ config ?: OpenClawConfig ;
45+ pluginToolAllowlist ?: string [ ] ;
46+ /** Current channel ID for auto-threading (Slack). */
47+ currentChannelId ?: string ;
48+ /** Current thread timestamp for auto-threading (Slack). */
49+ currentThreadTs ?: string ;
50+ /** Current inbound message id for action fallbacks (e.g. Telegram react). */
51+ currentMessageId ?: string | number ;
52+ /** Reply-to mode for Slack auto-threading. */
53+ replyToMode ?: "off" | "first" | "all" ;
54+ /** Mutable ref to track if a reply was sent (for "first" mode). */
55+ hasRepliedRef ?: { value : boolean } ;
56+ /** If true, the model has native vision capability */
57+ modelHasVision ?: boolean ;
58+ /** If true, nodes action="invoke" can call media-returning commands directly. */
59+ allowMediaInvokeCommands ?: boolean ;
60+ /** Explicit agent ID override for cron/hook sessions. */
61+ requesterAgentIdOverride ?: string ;
62+ /** Require explicit message targets (no implicit last-route sends). */
63+ requireExplicitMessageTarget ?: boolean ;
64+ /** If true, omit the message tool from the tool list. */
65+ disableMessageTool ?: boolean ;
66+ /** Trusted sender id from inbound context (not tool args). */
67+ requesterSenderId ?: string | null ;
68+ /** Whether the requesting sender is an owner. */
69+ senderIsOwner ?: boolean ;
70+ /** Ephemeral session UUID — regenerated on /new and /reset. */
71+ sessionId ?: string ;
72+ } & SpawnedToolContext ,
73+ ) : AnyAgentTool [ ] {
7874 const workspaceDir = resolveWorkspaceRoot ( options ?. workspaceDir ) ;
7975 const imageTool = options ?. agentDir ?. trim ( )
8076 ? createImageTool ( {
0 commit comments