mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-17 08:01:03 +00:00
fix: provide WebSocket impl for process terminal test on Node 20
Node 20 lacks globalThis.WebSocket. Add ws as a devDependency and pass it to connectProcessTerminalWebSocket in the integration test so CI no longer fails. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d8d0884d0a
commit
cf6622f062
3 changed files with 233 additions and 160 deletions
380
pnpm-lock.yaml
generated
380
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
|
|
@ -17,8 +17,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"acp-http-client": "workspace:*",
|
"@sandbox-agent/cli-shared": "workspace:*",
|
||||||
"@sandbox-agent/cli-shared": "workspace:*"
|
"acp-http-client": "workspace:*"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
|
|
@ -34,10 +34,12 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^22.0.0",
|
"@types/node": "^22.0.0",
|
||||||
|
"@types/ws": "^8.18.1",
|
||||||
"openapi-typescript": "^6.7.0",
|
"openapi-typescript": "^6.7.0",
|
||||||
"tsup": "^8.0.0",
|
"tsup": "^8.0.0",
|
||||||
"typescript": "^5.7.0",
|
"typescript": "^5.7.0",
|
||||||
"vitest": "^3.0.0"
|
"vitest": "^3.0.0",
|
||||||
|
"ws": "^8.19.0"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@sandbox-agent/cli": "workspace:*"
|
"@sandbox-agent/cli": "workspace:*"
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import {
|
||||||
} from "../src/index.ts";
|
} from "../src/index.ts";
|
||||||
import { spawnSandboxAgent, isNodeRuntime, type SandboxAgentSpawnHandle } from "../src/spawn.ts";
|
import { spawnSandboxAgent, isNodeRuntime, type SandboxAgentSpawnHandle } from "../src/spawn.ts";
|
||||||
import { prepareMockAgentDataHome } from "./helpers/mock-agent.ts";
|
import { prepareMockAgentDataHome } from "./helpers/mock-agent.ts";
|
||||||
|
import WebSocket from "ws";
|
||||||
|
|
||||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
|
|
@ -589,7 +590,9 @@ describe("Integration: TypeScript SDK flat session API", () => {
|
||||||
const wsUrl = sdk.buildProcessTerminalWebSocketUrl(ttyProcess.id);
|
const wsUrl = sdk.buildProcessTerminalWebSocketUrl(ttyProcess.id);
|
||||||
expect(wsUrl.startsWith("ws://") || wsUrl.startsWith("wss://")).toBe(true);
|
expect(wsUrl.startsWith("ws://") || wsUrl.startsWith("wss://")).toBe(true);
|
||||||
|
|
||||||
const ws = sdk.connectProcessTerminalWebSocket(ttyProcess.id);
|
const ws = sdk.connectProcessTerminalWebSocket(ttyProcess.id, {
|
||||||
|
WebSocket: WebSocket as unknown as typeof globalThis.WebSocket,
|
||||||
|
});
|
||||||
ws.binaryType = "arraybuffer";
|
ws.binaryType = "arraybuffer";
|
||||||
|
|
||||||
const socketTextFrames: string[] = [];
|
const socketTextFrames: string[] = [];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue