@@ -48,7 +48,7 @@ import {
4848 createWriteTool ,
4949 type ReadToolDetails ,
5050 type ReadToolTruncationDetails ,
51- } from "./sessions/index.js" ;
51+ } from "./sessions/tools/ index.js" ;
5252import { sanitizeToolResultImages } from "./tool-images.js" ;
5353
5454// NOTE(steipete): Upstream read now does file-magic MIME detection; we keep the wrapper
@@ -890,8 +890,10 @@ type SandboxToolParams = {
890890} ;
891891
892892/** Create a sandbox-backed read tool with OpenClaw result normalization. */
893- export function createSandboxedReadTool ( params : SandboxToolParams ) {
894- const base = createReadTool ( params . root , {
893+ export function createSandboxedReadTool (
894+ params : SandboxToolParams & { createTool ?: typeof createReadTool } ,
895+ ) {
896+ const base = ( params . createTool ?? createReadTool ) ( params . root , {
895897 operations : createSandboxReadOperations ( params ) ,
896898 } ) as unknown as AnyAgentTool ;
897899 return createOpenClawReadTool ( base , {
@@ -901,16 +903,20 @@ export function createSandboxedReadTool(params: SandboxToolParams) {
901903}
902904
903905/** Create a sandbox-backed write tool with required-parameter validation. */
904- export function createSandboxedWriteTool ( params : SandboxToolParams ) {
905- const base = createWriteTool ( params . root , {
906+ export function createSandboxedWriteTool (
907+ params : SandboxToolParams & { createTool ?: typeof createWriteTool } ,
908+ ) {
909+ const base = ( params . createTool ?? createWriteTool ) ( params . root , {
906910 operations : createSandboxWriteOperations ( params ) ,
907911 } ) as unknown as AnyAgentTool ;
908912 return wrapToolParamValidation ( base , REQUIRED_PARAM_GROUPS . write ) ;
909913}
910914
911915/** Create a sandbox-backed edit tool with required-parameter validation. */
912- export function createSandboxedEditTool ( params : SandboxToolParams ) {
913- const base = createEditTool ( params . root , {
916+ export function createSandboxedEditTool (
917+ params : SandboxToolParams & { createTool ?: typeof createEditTool } ,
918+ ) {
919+ const base = ( params . createTool ?? createEditTool ) ( params . root , {
914920 operations : createSandboxEditOperations ( params ) ,
915921 } ) as unknown as AnyAgentTool ;
916922 return wrapToolParamValidation ( base , REQUIRED_PARAM_GROUPS . edit ) ;
@@ -922,9 +928,10 @@ export function createHostWorkspaceWriteTool(
922928 options ?: {
923929 workspaceOnly ?: boolean ;
924930 memoryWriteProvenance ?: MemoryWriteProvenanceObserver ;
931+ createTool ?: typeof createWriteTool ;
925932 } ,
926933) {
927- const base = createWriteTool ( root , {
934+ const base = ( options ?. createTool ?? createWriteTool ) ( root , {
928935 operations : createHostWriteOperations ( root , options ) ,
929936 } ) as unknown as AnyAgentTool ;
930937 return wrapToolParamValidation ( base , REQUIRED_PARAM_GROUPS . write ) ;
@@ -936,9 +943,10 @@ export function createHostWorkspaceEditTool(
936943 options ?: {
937944 workspaceOnly ?: boolean ;
938945 memoryWriteProvenance ?: MemoryWriteProvenanceObserver ;
946+ createTool ?: typeof createEditTool ;
939947 } ,
940948) {
941- const base = createEditTool ( root , {
949+ const base = ( options ?. createTool ?? createEditTool ) ( root , {
942950 operations : createHostEditOperations ( root , options ) ,
943951 } ) as unknown as AnyAgentTool ;
944952 return wrapToolParamValidation ( base , REQUIRED_PARAM_GROUPS . edit ) ;
0 commit comments