- Serve each computer to its owner under /computers/<id>/ (HTTP and websockets proxied to the AIO sandbox) and show it in a shared ComputerView with browser, terminal and code modes, opened from the computers modal or a take-over button in the thread. - ask_user_to_take_over lets a bot hand a computer to the user for a login or captcha; the message gets a take-over button and needs-you, and the viewer hands it back with a chat message. - While a task runs the thread shows "<bot> is working..." with the task's latest step; steps read as plain words, not tool names. - A coordinator with no workers no longer claims to delegate, and bots describe started tasks in the first person. Co-Authored-By: Claude Opus 5.5 <[email protected]>
25 lines
1.1 KiB
TypeScript
25 lines
1.1 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import parseComputerProxyPath from "./parse-computer-proxy-path";
|
|
|
|
describe("parseComputerProxyPath", () => {
|
|
test("splits the computer id from the path on it", () => {
|
|
expect(parseComputerProxyPath({ pathname: "/computers/3/v1/shell/ws" })).toEqual({
|
|
computer_id: 3,
|
|
prefix: "/computers/3",
|
|
rest: "v1/shell/ws",
|
|
});
|
|
});
|
|
|
|
test("takes the computer's root with or without a slash", () => {
|
|
expect(parseComputerProxyPath({ pathname: "/computers/3" })?.rest).toBe("");
|
|
expect(parseComputerProxyPath({ pathname: "/computers/3/" })?.rest).toBe("");
|
|
});
|
|
|
|
test("ignores anything else", () => {
|
|
expect(parseComputerProxyPath({ pathname: "/computers" })).toBeNull();
|
|
expect(parseComputerProxyPath({ pathname: "/computers/x/terminal" })).toBeNull();
|
|
expect(parseComputerProxyPath({ pathname: "/computers/0/terminal" })).toBeNull();
|
|
expect(parseComputerProxyPath({ pathname: "/computersx/3" })).toBeNull();
|
|
});
|
|
});
|