@@ -12,7 +12,7 @@ import { PermissionV2 } from "@opencode-ai/core/permission"
1212import { AppProcess } from "@opencode-ai/core/process"
1313import { AbsolutePath } from "@opencode-ai/core/schema"
1414import { SessionV2 } from "@opencode-ai/core/session"
15- import { BashTool } from "@opencode-ai/core/tool/bash "
15+ import { TerminalTool } from "@opencode-ai/core/tool/terminal "
1616import { ToolRegistry } from "@opencode-ai/core/tool/registry"
1717import { location } from "./fixture/location"
1818import { tmpdir } from "./fixture/tmpdir"
@@ -102,7 +102,7 @@ const withTool = <A, E, R>(
102102 )
103103 const mutation = LocationMutation . layer . pipe ( Layer . provide ( filesystem ) , Layer . provide ( activeLocation ) )
104104 const registry = ToolRegistry . defaultLayer . pipe ( Layer . provide ( permission ) )
105- const bash = BashTool . layer . pipe (
105+ const bash = TerminalTool . layer . pipe (
106106 Layer . provide ( registry ) ,
107107 Layer . provide ( permission ) ,
108108 Layer . provide ( mutation ) ,
@@ -115,15 +115,15 @@ const withTool = <A, E, R>(
115115 } ) . pipe ( Effect . provide ( Layer . mergeAll ( registry , bash ) ) )
116116}
117117
118- const call = ( input : typeof BashTool . Input . Type , id = "call-bash" ) => ( {
118+ const call = ( input : typeof TerminalTool . Input . Type , id = "call-bash" ) => ( {
119119 sessionID,
120120 ...toolIdentity ,
121- call : { type : "tool-call" as const , id, name : "bash " , input } ,
121+ call : { type : "tool-call" as const , id, name : "terminal " , input } ,
122122} )
123123
124124const it = testEffect ( Layer . empty )
125125
126- describe ( "BashTool " , ( ) => {
126+ describe ( "TerminalTool " , ( ) => {
127127 it . live ( "registers and returns structured successful output from the active Location" , ( ) =>
128128 Effect . acquireUseRelease (
129129 Effect . promise ( ( ) => tmpdir ( ) ) ,
@@ -132,9 +132,9 @@ describe("BashTool", () => {
132132 return withTool ( tmp . path , ( registry ) =>
133133 Effect . gen ( function * ( ) {
134134 const definitions = yield * toolDefinitions ( registry )
135- expect ( definitions . map ( ( tool ) => tool . name ) ) . toEqual ( [ "bash " ] )
135+ expect ( definitions . map ( ( tool ) => tool . name ) ) . toEqual ( [ "terminal " ] )
136136 expect ( definitions [ 0 ] ?. inputSchema ) . not . toHaveProperty ( "properties.background" )
137- expect ( yield * toolDefinitions ( registry , [ { action : "bash " , resource : "*" , effect : "deny" } ] ) ) . toEqual ( [ ] )
137+ expect ( yield * toolDefinitions ( registry , [ { action : "terminal " , resource : "*" , effect : "deny" } ] ) ) . toEqual ( [ ] )
138138 expect (
139139 yield * settleTool ( registry , call ( { command : "pwd" , description : "Print working directory" } ) ) ,
140140 ) . toEqual ( {
@@ -152,10 +152,10 @@ describe("BashTool", () => {
152152 } )
153153 expect ( runs ) . toMatchObject ( [ { command : "pwd" , cwd : realpathSync ( tmp . path ) } ] )
154154 expect ( runs [ 0 ] ?. options ) . toMatchObject ( {
155- maxOutputBytes : BashTool . MAX_CAPTURE_BYTES ,
156- maxErrorBytes : BashTool . MAX_CAPTURE_BYTES ,
155+ maxOutputBytes : TerminalTool . MAX_CAPTURE_BYTES ,
156+ maxErrorBytes : TerminalTool . MAX_CAPTURE_BYTES ,
157157 } )
158- expect ( assertions ) . toMatchObject ( [ { sessionID, action : "bash " , resources : [ "pwd" ] , save : [ "pwd" ] } ] )
158+ expect ( assertions ) . toMatchObject ( [ { sessionID, action : "terminal " , resources : [ "pwd" ] , save : [ "pwd" ] } ] )
159159 } ) ,
160160 )
161161 } ,
@@ -188,7 +188,7 @@ describe("BashTool", () => {
188188 reset ( )
189189 const workdir = path . join ( tmp . path , "src" )
190190 afterPermission = ( input ) =>
191- input . action === "bash "
191+ input . action === "terminal "
192192 ? Effect . promise ( async ( ) => {
193193 await fs . rm ( workdir , { recursive : true } )
194194 await fs . writeFile ( workdir , "not a directory" )
@@ -201,7 +201,7 @@ describe("BashTool", () => {
201201 Effect . andThen (
202202 Effect . sync ( ( ) => {
203203 expect ( runs ) . toEqual ( [ ] )
204- expect ( assertions . map ( ( input ) => input . action ) ) . toEqual ( [ "bash " ] )
204+ expect ( assertions . map ( ( input ) => input . action ) ) . toEqual ( [ "terminal " ] )
205205 } ) ,
206206 ) ,
207207 )
@@ -249,7 +249,7 @@ describe("BashTool", () => {
249249 ) . pipe (
250250 Effect . andThen (
251251 Effect . sync ( ( ) => {
252- expect ( assertions . map ( ( item ) => item . action ) ) . toEqual ( [ "external_directory" , "bash " ] )
252+ expect ( assertions . map ( ( item ) => item . action ) ) . toEqual ( [ "external_directory" , "terminal " ] )
253253 expect ( assertions [ 0 ] ) . toMatchObject ( {
254254 resources : [ path . join ( realpathSync ( outside . path ) , "*" ) . replaceAll ( "\\" , "/" ) ] ,
255255 } )
@@ -281,7 +281,7 @@ describe("BashTool", () => {
281281 reset ( )
282282 denyAction = "bash"
283283 yield * withTool ( active . path , ( registry ) => executeTool ( registry , call ( { command : "pwd" } ) ) )
284- expect ( assertions . map ( ( item ) => item . action ) ) . toEqual ( [ "bash " ] )
284+ expect ( assertions . map ( ( item ) => item . action ) ) . toEqual ( [ "terminal " ] )
285285 expect ( runs ) . toEqual ( [ ] )
286286 } ) ,
287287 ( [ active , outside ] ) =>
@@ -301,7 +301,7 @@ describe("BashTool", () => {
301301 return withTool ( active . path , ( registry ) => settleTool ( registry , call ( { command : `cat ${ target } ` } ) ) ) . pipe (
302302 Effect . andThen ( ( settled ) =>
303303 Effect . sync ( ( ) => {
304- expect ( assertions . map ( ( item ) => item . action ) ) . toEqual ( [ "bash " ] )
304+ expect ( assertions . map ( ( item ) => item . action ) ) . toEqual ( [ "terminal " ] )
305305 expect ( runs ) . toHaveLength ( 1 )
306306 expect ( settled . output ?. structured ) . toMatchObject ( {
307307 warnings : [
@@ -399,7 +399,7 @@ describe("BashTool", () => {
399399} )
400400
401401test ( "keeps locked deferred parity TODOs visible" , async ( ) => {
402- const source = await fs . readFile ( new URL ( "../src/tool/bash .ts" , import . meta. url ) , "utf8" )
402+ const source = await fs . readFile ( new URL ( "../src/tool/terminal .ts" , import . meta. url ) , "utf8" )
403403 for ( const todo of [
404404 "Port tree-sitter bash / PowerShell parser-based approval reduction." ,
405405 "Port BashArity reusable command-prefix approvals." ,
0 commit comments