feat: workspace aliases, tab groups of split panes, native path picker (v2.1.0)

- /api/workspaces and `agenthub workspace(s)` / `--workspace` as aliases of
  /api/lanes and `agenthub lanes` / `--lane`; old names print one stderr note.
  REPL `help lanes|workspace|workspaces` resolves through the aliases.
- A workspace holds up to ten sessions (slots 0-9); every console tab is a
  group of 1-4 split panes (PaneGroups, agenthub.workspace.paneLayout);
  parseGroups keeps the stored active tab when an earlier one is dropped.
- Browse button beside path fields: POST /api/lanes/pick-path opens the OS
  picker on the server's desktop — loopback only and no forwarding header
  (EREMOTE), a display failure is ENODIALOG not a Cancel, the dialog is
  killed when the request closes, a folder field falls back to the in-app
  browser on any failure.
- Changes rail counts chip, image viewer (/git/raw), status bar session
  counts and per-day cost (`date=` on /api/pricing/cost).
- /agenthub-open and /agenthub-doctor run from the INSTALLED build
  (supersededBy), doctor offers fixes behind two confirmations; plugin-open
  treats a locked bootstrap as non-fatal.
- New-terminal shell waits for the first attach (issue #55).
- repo-onboarding / debug-live-issue skills removed.
- OpenAPI: pick-path, lane/date on /pricing/cost, tool on /run/history,
  /api/workspaces mount.
This commit is contained in:
2026-10-06 11:31:26 +07:00
parent c067abc68f
commit 6c605849d8
104 changed files with 3478 additions and 1396 deletions
+46 -2
View File
@@ -58,7 +58,49 @@ describe("pty-run", () => {
assert.ok(newSessionCall.includes("opus"));
});
it("spawnRun names a split pane's session agenthub-lane-<id>-<slot>, and refuses a slot past 3", () => {
it("spawnShell starts the login shell only once the pane has its real size (issue #55)", async () => {
const calls = [];
tmux.__setExecImpl((args) => {
calls.push(args);
return "";
});
pty.spawnShell({ laneId: 43, cwd: "/tmp/repo" });
const call = calls.find((c) => c[0] === "new-session");
const argv = call.slice(call.indexOf("--") + 1);
assert.equal(argv[0], "sh");
assert.equal(argv[1], "-c");
// Run the wrapper with a stand-in shell and a fake `tmux` that reports no
// client until a flag file appears: the shell must wait for the attach,
// then start at once rather than at the 2 s cap.
const { spawn } = require("node:child_process");
const bin = fs.mkdtempSync(path.join(os.tmpdir(), "fake-tmux-"));
const flag = path.join(bin, "attached");
fs.writeFileSync(
path.join(bin, "tmux"),
`#!/bin/sh\n[ -e '${flag}' ] && echo 1 || echo 0\n`,
{ mode: 0o755 }
);
try {
const t0 = Date.now();
const child = spawn("sh", ["-c", argv[2]], {
env: { ...process.env, SHELL: "/bin/echo", PATH: `${bin}:${process.env.PATH}` },
});
let out = "";
let startedAt = 0;
child.stdout.on("data", (d) => {
out += d;
startedAt ||= Date.now() - t0;
});
setTimeout(() => fs.writeFileSync(flag, ""), 400);
await new Promise((r) => child.on("exit", r));
assert.equal(out.trim(), "-l");
assert.ok(startedAt >= 400 && startedAt < 1500, `shell started after ${startedAt} ms`);
} finally {
fs.rmSync(bin, { recursive: true, force: true });
}
});
it("spawnRun names a split pane's session agenthub-lane-<id>-<slot>, and refuses a slot past 9 (ten per workspace)", () => {
tmux.__setExecImpl((args) => {
if (args[0] === "has-session") {
const e = new Error("no such session");
@@ -72,8 +114,10 @@ describe("pty-run", () => {
assert.equal(handle.laneId, 42);
assert.equal(handle.slot, 2);
assert.equal(pty.laneIdFromRunId("agenthub-lane-42-2"), 42);
assert.equal(pty.spawnRun({ laneId: 42, slot: 9, cwd: "/tmp/repo" }).id, "agenthub-lane-42-9");
assert.equal(pty.laneIdFromRunId("agenthub-lane-42-9"), 42);
assert.throws(
() => pty.spawnRun({ laneId: 42, slot: 4, cwd: "/tmp/repo" }),
() => pty.spawnRun({ laneId: 42, slot: 10, cwd: "/tmp/repo" }),
(err) => err.code === "EBADSLOT"
);
});