mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-14 13:22:37 +00:00
* feat(server): let clients create internal agents The daemon's own branch-name and commit-message generators run as internal agents: never persisted, listed, flagged, announced, or seen by plugin lifecycle hooks. Nothing outside the daemon could ask for one, because the wire config schema strips `internal` and the agent.create transform re-pins it. A plugin that runs a one-turn helper per event therefore left an archived session in History every time. Add an optional `internal` flag to `create_agent_request` (inherited by `agent.create.request`), copy it onto the config in the session's create path, and skip provider session persistence for it like the generators do. The client SDK forwards the flag on both creation paths and gates it once on `server_info.features.internalAgents`. Two daemon paths assumed every agent is public and had to follow: `resolveAgentIdentifier` now accepts a live agent by exact id, since the id set it matched against came from listings that exclude internal agents and left `wait_for_finish` answering "Agent not found"; and archiving an internal agent now closes it without writing the record that `registry.applySnapshot` used to leave behind, so `autoArchive` does not accumulate hidden files on disk. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(server): keep internal agents whole through failure, archive, and wait Review follow-ups for internal agents: - A create that fails after the runtime is registered now closes the internal agent before rethrowing, so a hidden runtime cannot outlive the failed request. Public agents keep today's behaviour. - Archiving an internal agent cascades to attached children like any parent. cascadeArchiveChildren takes the parent record instead of reading it back from storage, where an internal agent never is. - The archived snapshot and last message of an internal agent stay readable by exact id for ten minutes, so create-then-waitForFinish returns the finished turn whether the wait lands before or after an auto-archive. Storage plays that role for public agents. - The internal-agent e2e scenarios live in the existing create_agent_request lifecycle suite rather than a new file. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(server): cascade to live internal children and keep a failed internal create's worktree until it closes Internal children never reach storage, so the parent archive cascade scans live agents for them as well. A failed internal create now clears the created id only after the runtime is archived, so worktree cleanup cannot delete the directory under a runtime that would not close. Stored agent payloads carry lastError, so a retained failed helper reports its error through wait_for_finish instead of the generic message. * feat(cli,mcp): expose internal agents and document --no-wait paseo run gains --internal and create_agent gains internal, both forwarded to the create request. --no-wait becomes the documented spelling for returning immediately, matching paseo send; --background and --detach stay as hidden aliases under COMPAT tags. * test: follow the --no-wait rename and stub getRetiredInternalAgent * feat: list internal agents on request and add internal workspaces Internal agents stay hidden by default, but a caller can now ask for them: `fetch_agents_request` takes `filter.includeInternal`, snapshots carry `internal: true`, and `paseo ls --internal` shows them in an INTERNAL column. The app never passes the flag. Workspaces get the same flag. `workspace.create.request` with `internal: true` persists a hidden workspace: listings, update subscriptions, sync reads, empty-project counting, open-by-path, MCP `list_workspaces`, and plugin workspace hooks all skip it unless the caller opts in with `filter.includeInternal`. Every agent created inside an internal workspace is internal and unpersisted; AgentManager applies that from the workspace id before the plugin hook so creators cannot opt out. Archive and shutdown enumerate internal agents so nothing inside an internal workspace outlives it. Surfaces: `paseo workspace create --internal`, `paseo workspace ls --internal`, `paseo run --internal --new-workspace`, MCP `create_workspace({ internal })`, SDK `workspaces.create({ internal })` and `list({ filter: { includeInternal } })`. Clients gate on `features.internalWorkspaces`. Co-Authored-By: Claude <noreply@anthropic.com> * feat(workspaces): add background visibility with inherited creation defaults * fix(cli): resolve workspace callers on the selected daemon * test(workspaces): keep caller integration coverage in server suite * test(cli): exercise workspace callers through CLI integration harness * test(mcp): remove obsolete execution flags from browser fixtures --------- Co-authored-by: marvin-ambrozio <marvin@gustavo.eng.br> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
149 lines
6.1 KiB
TypeScript
149 lines
6.1 KiB
TypeScript
import { test, expect, type Page } from "../support/fixtures";
|
|
import { gotoAppShell } from "../support/helpers/app";
|
|
import { seedWorkspace } from "../support/helpers/seed-client";
|
|
import { openAgentRoute } from "../support/helpers/mock-agent";
|
|
import { getServerId } from "../support/helpers/server-id";
|
|
|
|
function workspaceRowTestId(workspaceId: string): string {
|
|
return `sidebar-workspace-row-${getServerId()}:${workspaceId}`;
|
|
}
|
|
|
|
function workspaceRenameModalTestId(workspaceId: string, suffix: string): string {
|
|
return `sidebar-workspace-rename-modal-${getServerId()}:${workspaceId}-${suffix}`;
|
|
}
|
|
|
|
async function openRenameModal(page: Page, workspaceId: string) {
|
|
const serverId = getServerId();
|
|
const row = page.getByTestId(`sidebar-workspace-row-${serverId}:${workspaceId}`);
|
|
await expect(row).toBeVisible({ timeout: 30_000 });
|
|
await row.hover();
|
|
|
|
const kebab = page.getByTestId(`sidebar-workspace-kebab-${serverId}:${workspaceId}`);
|
|
await expect(kebab).toBeVisible({ timeout: 10_000 });
|
|
await kebab.click();
|
|
|
|
const renameItem = page.getByTestId(`sidebar-workspace-menu-rename-${serverId}:${workspaceId}`);
|
|
await expect(renameItem).toBeVisible({ timeout: 10_000 });
|
|
await renameItem.click();
|
|
|
|
const input = page.getByTestId(workspaceRenameModalTestId(workspaceId, "input"));
|
|
await expect(input).toBeVisible({ timeout: 10_000 });
|
|
return input;
|
|
}
|
|
|
|
// In Model B the workspace title is its identity: renaming sets a custom title
|
|
// layered over the derived branch/directory name, and reconciliation never
|
|
// touches it. The sidebar row shows the title verbatim — no branch mutation.
|
|
test.describe("Sidebar workspace rename", () => {
|
|
test("renaming via kebab sets a custom title that survives reload", async ({ page }) => {
|
|
const workspace = await seedWorkspace({ repoPrefix: "sidebar-rename-" });
|
|
|
|
try {
|
|
expect(workspace.workspaceName).toBe("main");
|
|
|
|
await gotoAppShell(page);
|
|
await expect(page.getByTestId(workspaceRowTestId(workspace.workspaceId))).toBeVisible({
|
|
timeout: 30_000,
|
|
});
|
|
|
|
const input = await openRenameModal(page, workspace.workspaceId);
|
|
await expect(input).toHaveValue("main");
|
|
|
|
const customTitle = "Payments Refactor";
|
|
await input.fill(customTitle);
|
|
await page.getByTestId(workspaceRenameModalTestId(workspace.workspaceId, "submit")).click();
|
|
|
|
await expect(input).toHaveCount(0, { timeout: 15_000 });
|
|
// The title is shown exactly as typed — not slugified into a branch name.
|
|
await expect(page.getByTestId(workspaceRowTestId(workspace.workspaceId))).toContainText(
|
|
customTitle,
|
|
{ timeout: 15_000 },
|
|
);
|
|
|
|
// The custom title is backing metadata on the workspace: a full reload
|
|
// re-resolves the descriptor from persistence and must not lose it. This
|
|
// exercises the same descriptor resolution reconciliation re-runs against,
|
|
// so a reconcile pass cannot overwrite the user's title either.
|
|
await page.reload();
|
|
await expect(page.getByTestId(workspaceRowTestId(workspace.workspaceId))).toContainText(
|
|
customTitle,
|
|
{ timeout: 30_000 },
|
|
);
|
|
} finally {
|
|
await workspace.cleanup();
|
|
}
|
|
});
|
|
});
|
|
|
|
async function toggleBackgroundWorkspaces(page: Page): Promise<void> {
|
|
await page.getByLabel("Display preferences", { exact: true }).click();
|
|
await page.getByRole("menuitem", { name: "Show background", exact: true }).click();
|
|
await page.keyboard.press("Escape");
|
|
}
|
|
|
|
async function expectWorkspaceInSidebar(page: Page, workspaceId: string): Promise<void> {
|
|
// Rows have no single accessible role: their nested title and actions share this container.
|
|
await expect(page.getByTestId(workspaceRowTestId(workspaceId))).toBeVisible({ timeout: 30_000 });
|
|
}
|
|
|
|
async function expectWorkspaceHidden(page: Page, workspaceId: string): Promise<void> {
|
|
await expect(page.getByTestId(workspaceRowTestId(workspaceId))).toHaveCount(0);
|
|
}
|
|
|
|
async function reconnectApp(page: Page): Promise<void> {
|
|
await page.reload();
|
|
await expect(page.getByLabel("Display preferences", { exact: true })).toBeVisible();
|
|
}
|
|
|
|
async function expectWorkerOpen(page: Page): Promise<void> {
|
|
await expect(page.getByRole("textbox", { name: "Message agent..." })).toBeEditable({
|
|
timeout: 30_000,
|
|
});
|
|
await expect(page.getByText("Background reviewer", { exact: true }).first()).toBeVisible();
|
|
await expect(page.getByText("Background review prompt", { exact: true }).first()).toBeVisible();
|
|
}
|
|
|
|
test("background workspace stays directly accessible across sidebar toggles and reconnect", async ({
|
|
page,
|
|
}, testInfo) => {
|
|
const workspace = await seedWorkspace({
|
|
repoPrefix: "sidebar-background-",
|
|
title: "Background review",
|
|
background: true,
|
|
});
|
|
try {
|
|
const worker = await workspace.client.createAgent({
|
|
provider: "mock",
|
|
cwd: workspace.repoPath,
|
|
workspaceId: workspace.workspaceId,
|
|
title: "Background reviewer",
|
|
initialPrompt: "Background review prompt",
|
|
model: "e2e-fast-stream",
|
|
modeId: "load-test",
|
|
});
|
|
await test.step("Default sidebar hides background work", async () => {
|
|
await gotoAppShell(page);
|
|
await expectWorkspaceHidden(page, workspace.workspaceId);
|
|
});
|
|
await test.step("Show background exposes the fully replicated workspace", async () => {
|
|
await toggleBackgroundWorkspaces(page);
|
|
await expectWorkspaceInSidebar(page, workspace.workspaceId);
|
|
await reconnectApp(page);
|
|
await expectWorkspaceInSidebar(page, workspace.workspaceId);
|
|
});
|
|
await test.step("Direct agent navigation survives hiding and reconnect", async () => {
|
|
await toggleBackgroundWorkspaces(page);
|
|
await expectWorkspaceHidden(page, workspace.workspaceId);
|
|
await openAgentRoute(page, { workspaceId: workspace.workspaceId, agentId: worker.id });
|
|
await expectWorkerOpen(page);
|
|
await expectWorkspaceHidden(page, workspace.workspaceId);
|
|
await reconnectApp(page);
|
|
await expectWorkerOpen(page);
|
|
await expectWorkspaceHidden(page, workspace.workspaceId);
|
|
await page.screenshot({ path: testInfo.outputPath("background-direct-open.png") });
|
|
});
|
|
} finally {
|
|
await workspace.cleanup();
|
|
}
|
|
});
|