@@ -38,8 +38,7 @@ vi.mock("./tools/gateway.js", () => ({
3838} ) ) ;
3939
4040let callGatewayTool : typeof import ( "./tools/gateway.js" ) . callGatewayTool ;
41- let registerExecApprovalRequest : typeof import ( "./bash-tools.exec-approval-request.js" ) . registerExecApprovalRequest ;
42- let registerExecApprovalRequestForHost : typeof import ( "./bash-tools.exec-approval-request.js" ) . registerExecApprovalRequestForHost ;
41+ let registerExecApprovalRequestForHostOrThrow : typeof import ( "./bash-tools.exec-approval-request.js" ) . registerExecApprovalRequestForHostOrThrow ;
4342
4443const initialProcessPlatform = Object . getOwnPropertyDescriptor ( process , "platform" ) ;
4544
@@ -75,7 +74,7 @@ function requireApprovalRequestPayload(callIndex: number): ApprovalRequestPayloa
7574describe ( "exec approval requests" , ( ) => {
7675 beforeAll ( async ( ) => {
7776 ( { callGatewayTool } = await import ( "./tools/gateway.js" ) ) ;
78- ( { registerExecApprovalRequest , registerExecApprovalRequestForHost } =
77+ ( { registerExecApprovalRequestForHostOrThrow } =
7978 await import ( "./bash-tools.exec-approval-request.js" ) ) ;
8079 } ) ;
8180
@@ -100,10 +99,10 @@ describe("exec approval requests", () => {
10099
101100 try {
102101 await expect (
103- registerExecApprovalRequest ( {
104- id : "approval-id" ,
102+ registerExecApprovalRequestForHostOrThrow ( {
103+ approvalId : "approval-id" ,
105104 command : "echo hi" ,
106- cwd : "/tmp" ,
105+ workdir : "/tmp" ,
107106 host : "gateway" ,
108107 security : "allowlist" ,
109108 ask : "on-miss" ,
@@ -124,10 +123,10 @@ describe("exec approval requests", () => {
124123
125124 try {
126125 await expect (
127- registerExecApprovalRequest ( {
128- id : "approval-id" ,
126+ registerExecApprovalRequestForHostOrThrow ( {
127+ approvalId : "approval-id" ,
129128 command : "echo hi" ,
130- cwd : "/tmp" ,
129+ workdir : "/tmp" ,
131130 host : "gateway" ,
132131 security : "allowlist" ,
133132 ask : "on-miss" ,
@@ -141,7 +140,7 @@ describe("exec approval requests", () => {
141140 it ( "adds command spans to host approval registration payloads" , async ( ) => {
142141 vi . mocked ( callGatewayTool ) . mockResolvedValue ( { id : "approval-id" , expiresAtMs : 1234 } ) ;
143142
144- await registerExecApprovalRequestForHost ( {
143+ await registerExecApprovalRequestForHostOrThrow ( {
145144 approvalId : "approval-id" ,
146145 command : 'ls | grep "stuff" | python -c \'print("hi")\'' ,
147146 commandHighlighting : true ,
@@ -163,7 +162,7 @@ describe("exec approval requests", () => {
163162 it ( "passes approval reviewer devices into host approval registration payloads" , async ( ) => {
164163 vi . mocked ( callGatewayTool ) . mockResolvedValue ( { id : "approval-id" , expiresAtMs : 1234 } ) ;
165164
166- await registerExecApprovalRequestForHost ( {
165+ await registerExecApprovalRequestForHostOrThrow ( {
167166 approvalId : "approval-id" ,
168167 command : "echo hi" ,
169168 approvalReviewerDeviceIds : [ "device-ios-reviewer" ] ,
@@ -180,7 +179,7 @@ describe("exec approval requests", () => {
180179 it ( "does not generate command spans by default" , async ( ) => {
181180 vi . mocked ( callGatewayTool ) . mockResolvedValue ( { id : "approval-id" , expiresAtMs : 1234 } ) ;
182181
183- await registerExecApprovalRequestForHost ( {
182+ await registerExecApprovalRequestForHostOrThrow ( {
184183 approvalId : "approval-id" ,
185184 command : 'ls | grep "stuff" | python -c \'print("hi")\'' ,
186185 workdir : "/tmp/project" ,
@@ -198,7 +197,7 @@ describe("exec approval requests", () => {
198197 it ( "does not generate command spans when command highlighting is disabled" , async ( ) => {
199198 vi . mocked ( callGatewayTool ) . mockResolvedValue ( { id : "approval-id" , expiresAtMs : 1234 } ) ;
200199
201- await registerExecApprovalRequestForHost ( {
200+ await registerExecApprovalRequestForHostOrThrow ( {
202201 approvalId : "approval-id" ,
203202 command : 'ls | grep "stuff" | python -c \'print("hi")\'' ,
204203 commandHighlighting : false ,
@@ -217,7 +216,7 @@ describe("exec approval requests", () => {
217216 it ( "uses system run plan command text for host approval explanations" , async ( ) => {
218217 vi . mocked ( callGatewayTool ) . mockResolvedValue ( { id : "approval-id" , expiresAtMs : 1234 } ) ;
219218
220- await registerExecApprovalRequestForHost ( {
219+ await registerExecApprovalRequestForHostOrThrow ( {
221220 approvalId : "approval-id" ,
222221 systemRunPlan : {
223222 argv : [ "node" , "-e" , "console.log(1)" ] ,
@@ -240,15 +239,15 @@ describe("exec approval requests", () => {
240239 it ( "omits generated command spans for unsupported shell wrapper languages" , async ( ) => {
241240 vi . mocked ( callGatewayTool ) . mockResolvedValue ( { id : "approval-id" , expiresAtMs : 1234 } ) ;
242241
243- await registerExecApprovalRequestForHost ( {
242+ await registerExecApprovalRequestForHostOrThrow ( {
244243 approvalId : "approval-id-powershell" ,
245244 command : 'pwsh -Command "Get-ChildItem"' ,
246245 workdir : "/tmp/project" ,
247246 host : "node" ,
248247 security : "allowlist" ,
249248 ask : "always" ,
250249 } ) ;
251- await registerExecApprovalRequestForHost ( {
250+ await registerExecApprovalRequestForHostOrThrow ( {
252251 approvalId : "approval-id-cmd" ,
253252 command : 'cmd.exe /d /s /c "dir"' ,
254253 workdir : "/tmp/project" ,
@@ -266,7 +265,7 @@ describe("exec approval requests", () => {
266265 setProcessPlatformForTest ( "win32" ) ;
267266 vi . mocked ( callGatewayTool ) . mockResolvedValue ( { id : "approval-id" , expiresAtMs : 1234 } ) ;
268267
269- await registerExecApprovalRequestForHost ( {
268+ await registerExecApprovalRequestForHostOrThrow ( {
270269 approvalId : "approval-id-powershell" ,
271270 command :
272271 'Set-Content -Path "windows-agent-proof.txt" -Value "WINDOWS_AGENT_EXEC_OK" -NoNewline' ,
@@ -284,7 +283,7 @@ describe("exec approval requests", () => {
284283 it ( "omits generated command spans for unsupported shell wrappers through system run carriers" , async ( ) => {
285284 vi . mocked ( callGatewayTool ) . mockResolvedValue ( { id : "approval-id" , expiresAtMs : 1234 } ) ;
286285
287- await registerExecApprovalRequestForHost ( {
286+ await registerExecApprovalRequestForHostOrThrow ( {
288287 approvalId : "approval-id-carrier" ,
289288 systemRunPlan : {
290289 argv : [ "timeout" , "5" , "pwsh" , "-Command" , "Get-ChildItem" ] ,
@@ -307,7 +306,7 @@ describe("exec approval requests", () => {
307306 it ( "keeps explicit command spans" , async ( ) => {
308307 vi . mocked ( callGatewayTool ) . mockResolvedValue ( { id : "approval-id" , expiresAtMs : 1234 } ) ;
309308
310- await registerExecApprovalRequestForHost ( {
309+ await registerExecApprovalRequestForHostOrThrow ( {
311310 approvalId : "approval-id" ,
312311 command : "echo hi" ,
313312 commandSpans : [ { startIndex : 0 , endIndex : 4 } ] ,
0 commit comments