Files
loki/scripts/test/fleet-context.ts
Cato 0e6cb86dd4 feat(terminal): PTY/Loki split with Ask vs Inject (#746)
Terminal is a ~60/40 PTY and Loki rail on the same run id Watch
follows. The rail shows phase, stall, and next action from run
events — not a log dump — with Ask vs Inject into this session,
PTY-byte ack after inject, and Grok/Cursor/Antigravity when quota
dies. Mobile opens the same rail as a bottom sheet. Empty Terminal
names Fleet Runner vs Kitty. Implement's Terminal link carries ?run=.
2026-09-16 12:33:22 -07:00

36 lines
1.5 KiB
TypeScript

import { fleetSurfaceHref, projectFromFleetRoute } from "@/lib/fleet-context";
const project = "BiasLens alpha";
if (fleetSurfaceHref("profile", project) !== "/projects?project=BiasLens%20alpha") {
throw new Error("profile deep link");
}
if (fleetSurfaceHref("chat", project) !== "/loki?project=BiasLens%20alpha") {
throw new Error("chat deep link");
}
if (fleetSurfaceHref("control", project) !== "/control?focus=BiasLens%20alpha") {
throw new Error("control deep link");
}
if (fleetSurfaceHref("terminal", project) !== "/terminal?project=BiasLens%20alpha") {
throw new Error("terminal deep link");
}
if (
fleetSurfaceHref("terminal", project, "cloud", "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") !==
"/terminal?project=BiasLens%20alpha&source=cloud&run=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
) {
throw new Error("terminal run deep link");
}
if (projectFromFleetRoute("/terminal", new URLSearchParams("project=BiasLens")) !== "BiasLens") {
throw new Error("terminal route context");
}
if (projectFromFleetRoute("/terminal", new URLSearchParams("tab=BiasLens")) !== "BiasLens") {
throw new Error("legacy terminal route context");
}
if (projectFromFleetRoute("/projects", new URLSearchParams("project=BiasLens+alpha")) !== project) {
throw new Error("profile route context");
}
if (projectFromFleetRoute("/projects", new URLSearchParams("open=123")) !== null) {
throw new Error("catalog must not masquerade as workspace context");
}
console.log("✓ fleet-context tests passed");