| 285 | }); |
| 286 | |
| 287 | const completePausedResult = async ( |
| 288 | client: Client, |
| 289 | initial: ToolCallResult, |
| 290 | ): Promise<Record<string, unknown>> => { |
| 291 | let result = initial; |
| 292 | for (let attempt = 0; attempt < 5; attempt++) { |
| 293 | if (result.isError) { |
| 294 | fail(`tool returned isError: ${JSON.stringify(result.content)}`); |
| 295 | } |
| 296 | |
| 297 | const structured = result.structuredContent; |
| 298 | if (!isRecord(structured)) { |
| 299 | fail(`tool returned no structured content: ${JSON.stringify(result.content)}`); |
| 300 | } |
| 301 | const structuredRecord = structured as Record<string, unknown>; |
| 302 | |
| 303 | if (structuredRecord.status !== "waiting_for_interaction") { |
| 304 | return structuredRecord; |
| 305 | } |
| 306 | |
| 307 | const executionId = structuredRecord.executionId; |
| 308 | if (typeof executionId !== "string" || executionId.length === 0) { |
| 309 | fail(`paused result missing executionId: ${JSON.stringify(structuredRecord)}`); |
| 310 | } |
| 311 | |
| 312 | console.log(`[smoke-sidecar] auto-accepting paused execution ${executionId}`); |
| 313 | result = await client.callTool({ |
| 314 | name: "resume", |
| 315 | arguments: { executionId, action: "accept", content: "{}" }, |
| 316 | }); |
| 317 | } |
| 318 | |
| 319 | return fail("execute still paused after 5 resume attempts"); |
| 320 | }; |
| 321 | |
| 322 | const main = async () => { |
| 323 | if (!(await Bun.file(BINARY).exists())) { |