ef852af986
- Replaced monolithic desktop native bindings and action batching with a modular cross-platform backend structure supporting Wayland, X11, macOS, and Win32. - Updated the computer tool schema and supervisor to execute persistent JavaScript script runs with timeout clamping and asynchronous tool calling. - Integrated accessibility (AX) tree snapshotting, node querying, and bounds-based hit testing across platform desktop layers. - Added native clipboard bindings and updated coding-agent prompts, renderers, and tests to validate script-based computer workflows.
45 lines
1.6 KiB
TypeScript
45 lines
1.6 KiB
TypeScript
import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test";
|
|
import { runCli } from "../src/cli";
|
|
import * as computerWorkerEntry from "../src/tools/computer/worker-entry";
|
|
|
|
// The worker-host re-entry seam dispatches any `__omp_worker_*` selector to
|
|
// `runWorkerEntrypoint`. An unrecognized selector must fail loudly rather than
|
|
// exit 0 with empty output, so a stale/mistyped selector cannot look healthy to
|
|
// a parent process or install smoke path (issue #5712).
|
|
describe("worker selector dispatch", () => {
|
|
beforeEach(() => {
|
|
process.exitCode = 0;
|
|
});
|
|
|
|
afterEach(() => {
|
|
vi.restoreAllMocks();
|
|
process.exitCode = 0;
|
|
});
|
|
|
|
it("fails with a nonzero exit and stderr error on an unknown selector", async () => {
|
|
const stderr = vi.spyOn(process.stderr, "write").mockImplementation(() => true);
|
|
|
|
await runCli(["__omp_worker_does_not_exist"]);
|
|
|
|
expect(process.exitCode).toBe(1);
|
|
expect(stderr).toHaveBeenCalledWith("Error: unknown worker selector: __omp_worker_does_not_exist\n");
|
|
});
|
|
|
|
it("leaves normal root flags untouched", async () => {
|
|
const stdout = vi.spyOn(process.stdout, "write").mockImplementation(() => true);
|
|
const stderr = vi.spyOn(process.stderr, "write").mockImplementation(() => true);
|
|
|
|
await runCli(["--version"]);
|
|
|
|
expect(process.exitCode).toBe(0);
|
|
expect(stdout).toHaveBeenCalled();
|
|
expect(stderr).not.toHaveBeenCalledWith(expect.stringContaining("unknown worker selector"));
|
|
});
|
|
});
|
|
|
|
describe("computer worker entry", () => {
|
|
it("is side-effect-free to import outside a worker and has no manual start hook", () => {
|
|
expect("startComputerWorker" in computerWorkerEntry).toBe(false);
|
|
});
|
|
});
|