mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-21 07:45:38 +00:00
Compare commits
29
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36dbeb1943 | ||
|
|
d6fa19f2d5 | ||
|
|
1d3e2e7804 | ||
|
|
19a7c33881 | ||
|
|
afb78c5f8c | ||
|
|
6be18380d7 | ||
|
|
3eb22ce65d | ||
|
|
37b138b126 | ||
|
|
d1a38073e3 | ||
|
|
4d7b578bbd | ||
|
|
41b65254e9 | ||
|
|
609ef901c9 | ||
|
|
57d1a61bad | ||
|
|
d64d45a00b | ||
|
|
b0d0c40a27 | ||
|
|
7a590f6c44 | ||
|
|
fa5d915364 | ||
|
|
a15c8af302 | ||
|
|
37a513ea3d | ||
|
|
35bc541bda | ||
|
|
f34aa469c5 | ||
|
|
ef00b7fc41 | ||
|
|
750be237e3 | ||
|
|
c7e000bb1a | ||
|
|
576048ebb8 | ||
|
|
fd579a249a | ||
|
|
2c69f5a5d2 | ||
|
|
78a7508e3d | ||
|
|
0d436b1ae6 |
+2
-7
@@ -582,17 +582,12 @@ host, kinds, and ids. Opening a cached workspace uses exact workspace and projec
|
||||
directory scan. One invalid row is deleted and returned as a miss without affecting other rows.
|
||||
An invalid directory row and its affected checkpoint cursor are repaired in one transaction, so a
|
||||
later launch cannot accept a checkpoint for a partial baseline. Directory changes and their
|
||||
checkpoint are also applied in one transaction. A stored checkpoint carries a version. When a writer
|
||||
bug could have stored a checkpoint without its directory, bump the version: older checkpoints are
|
||||
rejected on read, cached rows still paint, and each host re-syncs its directory once. Reads wait for
|
||||
accepted changes to reach storage,
|
||||
checkpoint are also applied in one transaction. Reads wait for accepted changes to reach storage,
|
||||
then retry only when a requested row changes during the read. Unrelated agent streams do not
|
||||
invalidate the read. Directory baseline replacements and host removal or renaming still invalidate
|
||||
the affected reads.
|
||||
|
||||
The cache is capped at 32 MiB and evicts whole hosts in least-recently-written order. After an
|
||||
eviction, only a baseline replacement stores that host's directory again. Mutations queued around
|
||||
the eviction are dropped when they are written, so a checkpoint never outlives its rows. Budget
|
||||
The cache is capped at 32 MiB and evicts whole hosts in least-recently-written order. Budget
|
||||
bookkeeping may scan opaque row sizes during a deferred write, never during host registry startup or
|
||||
before a requested cache row can paint. The row store is not encrypted. A cached timeline can contain
|
||||
source code, prompts, and tool output; encrypted-at-rest storage is a separate security decision.
|
||||
|
||||
Generated
+10
@@ -6651,6 +6651,15 @@
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource-variable/plus-jakarta-sans": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/plus-jakarta-sans/-/plus-jakarta-sans-5.3.0.tgz",
|
||||
"integrity": "sha512-/l/4r0yyWK9JzAlmA0LiYgGgmJe/Gswt4jTJEzr5QhJfwMbvJZDmYWyW0M4X7yCK69BajMVlV/Lx8g7WDc1+sw==",
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@getpaseo/app": {
|
||||
"resolved": "packages/app",
|
||||
"link": true
|
||||
@@ -41479,6 +41488,7 @@
|
||||
"@cloudflare/vite-plugin": "^1.29.1",
|
||||
"@cloudflare/workers-types": "^4.20260317.1",
|
||||
"@fontsource-variable/geist": "^5.3.0",
|
||||
"@fontsource-variable/plus-jakarta-sans": "^5.3.0",
|
||||
"@getpaseo/protocol": "*",
|
||||
"@tanstack/react-router": "^1.170.16",
|
||||
"@tanstack/react-start": "^1.168.26",
|
||||
|
||||
@@ -1,149 +0,0 @@
|
||||
import { test, expect, type Page } from "../support/fixtures";
|
||||
import { gotoAppShell } from "../support/helpers/app";
|
||||
import { seedWorkspace, type SeededWorkspace } from "../support/helpers/seed-client";
|
||||
import { selectSidebarStatusGrouping } from "../support/helpers/sidebar";
|
||||
import {
|
||||
createGatedTeardown,
|
||||
pressArchiveShortcut,
|
||||
workspaceRow,
|
||||
} from "../support/helpers/workspace-archive-undo";
|
||||
|
||||
// The archive shortcut used to be registered by the sidebar row itself, so it did nothing whenever
|
||||
// the row was unmounted — a collapsed project section being the common case. It now lives in a
|
||||
// single always-mounted handler keyed on the active route selection, like the pin shortcut.
|
||||
// Returns the workspace route, so the test can assert archiving redirected off it.
|
||||
async function openWorkspace(page: Page, workspaceId: string): Promise<string> {
|
||||
const row = workspaceRow(page, workspaceId);
|
||||
await expect(row).toBeVisible({ timeout: 30_000 });
|
||||
await row.click();
|
||||
await expect(page).toHaveURL((url) => url.pathname.endsWith(`/workspace/${workspaceId}`), {
|
||||
timeout: 30_000,
|
||||
});
|
||||
return page.url();
|
||||
}
|
||||
|
||||
async function collapseProjectSection(page: Page, project: SeededWorkspace): Promise<void> {
|
||||
const header = page
|
||||
.locator('[data-testid^="sidebar-project-row-"]')
|
||||
.filter({ hasText: project.projectDisplayName });
|
||||
await expect(header).toHaveCount(1, { timeout: 30_000 });
|
||||
|
||||
await header.click();
|
||||
await expect(workspaceRow(page, project.workspaceId)).toHaveCount(0, { timeout: 10_000 });
|
||||
}
|
||||
|
||||
async function collapseStatusGroupContaining(page: Page, workspaceId: string): Promise<void> {
|
||||
const rows = page
|
||||
.locator('[data-testid^="sidebar-status-group-rows-"]')
|
||||
.filter({ has: workspaceRow(page, workspaceId) });
|
||||
await expect(rows).toHaveCount(1, { timeout: 30_000 });
|
||||
|
||||
const rowsTestId = await rows.getAttribute("data-testid");
|
||||
const bucket = rowsTestId?.replace("sidebar-status-group-rows-", "");
|
||||
expect(bucket).toBeTruthy();
|
||||
|
||||
await page.getByTestId(`sidebar-status-group-${bucket}`).click();
|
||||
await expect(workspaceRow(page, workspaceId)).toHaveCount(0, { timeout: 10_000 });
|
||||
}
|
||||
|
||||
async function expectArchived(page: Page, workspace: SeededWorkspace, workspaceUrl: string) {
|
||||
await expect(page).not.toHaveURL(workspaceUrl);
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const { entries } = await workspace.client.fetchWorkspaces();
|
||||
return entries.some((entry) => entry.id === workspace.workspaceId);
|
||||
})
|
||||
.toBe(false);
|
||||
}
|
||||
|
||||
test.describe("Archive workspace shortcut", () => {
|
||||
test("archives the active workspace while its row is rendered", async ({ page }) => {
|
||||
const workspace = await seedWorkspace({ repoPrefix: "archive-shortcut-expanded-" });
|
||||
|
||||
try {
|
||||
await gotoAppShell(page);
|
||||
const workspaceUrl = await openWorkspace(page, workspace.workspaceId);
|
||||
|
||||
await pressArchiveShortcut(page);
|
||||
|
||||
await expectArchived(page, workspace, workspaceUrl);
|
||||
} finally {
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("archives the active workspace while its project section is collapsed", async ({ page }) => {
|
||||
const workspace = await seedWorkspace({ repoPrefix: "archive-shortcut-collapsed-" });
|
||||
|
||||
try {
|
||||
await gotoAppShell(page);
|
||||
const workspaceUrl = await openWorkspace(page, workspace.workspaceId);
|
||||
await collapseProjectSection(page, workspace);
|
||||
|
||||
await pressArchiveShortcut(page);
|
||||
|
||||
await expectArchived(page, workspace, workspaceUrl);
|
||||
} finally {
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("archives the active workspace while its status group is collapsed", async ({ page }) => {
|
||||
const workspace = await seedWorkspace({ repoPrefix: "archive-shortcut-status-" });
|
||||
|
||||
try {
|
||||
await gotoAppShell(page);
|
||||
const workspaceUrl = await openWorkspace(page, workspace.workspaceId);
|
||||
await selectSidebarStatusGrouping(page);
|
||||
await expect(page.getByTestId("sidebar-status-list-scroll")).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
await collapseStatusGroupContaining(page, workspace.workspaceId);
|
||||
|
||||
await pressArchiveShortcut(page);
|
||||
|
||||
await expectArchived(page, workspace, workspaceUrl);
|
||||
} finally {
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("archives a different workspace while the first worktree is still tearing down", async ({
|
||||
page,
|
||||
}) => {
|
||||
const teardown = createGatedTeardown();
|
||||
const project = await seedWorkspace({
|
||||
repoPrefix: "archive-shortcut-teardown-",
|
||||
repo: { paseoConfig: teardown.paseoConfig },
|
||||
});
|
||||
const next = await seedWorkspace({ repoPrefix: "archive-shortcut-next-" });
|
||||
|
||||
try {
|
||||
const { workspace: worktree, error } = await project.client.createWorkspace({
|
||||
source: {
|
||||
kind: "worktree",
|
||||
cwd: project.repoPath,
|
||||
worktreeSlug: "archive-shortcut-teardown",
|
||||
},
|
||||
});
|
||||
if (!worktree) throw new Error(error ?? "Could not seed the worktree");
|
||||
await gotoAppShell(page);
|
||||
|
||||
await test.step("start the first archive and wait for its teardown", async () => {
|
||||
await openWorkspace(page, worktree.id);
|
||||
await pressArchiveShortcut(page);
|
||||
await teardown.expectStarted();
|
||||
});
|
||||
|
||||
await test.step("archive the second workspace before the first archive finishes", async () => {
|
||||
const workspaceUrl = await openWorkspace(page, next.workspaceId);
|
||||
await pressArchiveShortcut(page);
|
||||
await expectArchived(page, next, workspaceUrl);
|
||||
});
|
||||
} finally {
|
||||
teardown.release();
|
||||
await project.cleanup();
|
||||
await next.cleanup();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -206,14 +206,13 @@ async function simulateDamagedLegacyDirectoryCache(
|
||||
return;
|
||||
}
|
||||
const stored = JSON.parse(checkpoint.payload);
|
||||
// Read the cursors from whichever version wrote them, then store them as version 1:
|
||||
// the format whose writer could keep a checkpoint after evicting the rows it describes.
|
||||
const cursors = typeof stored.version === "number" ? stored.cursors : stored;
|
||||
if (!cursors?.workspaces?.generation) {
|
||||
// Accept either writer so this fixture also reproduces on the unfixed client.
|
||||
const cursors = stored.version === 1 ? stored.cursors : stored;
|
||||
if (!cursors.workspaces?.generation) {
|
||||
transaction.abort();
|
||||
return;
|
||||
}
|
||||
store.put({ ...checkpoint, payload: JSON.stringify({ version: 1, cursors }) });
|
||||
store.put({ ...checkpoint, payload: JSON.stringify(cursors) });
|
||||
for (const row of rows) {
|
||||
if (
|
||||
row.serverId === serverId &&
|
||||
|
||||
@@ -503,34 +503,6 @@ test.describe("terminal history with a finger", () => {
|
||||
await expectMouseWheelScrollsHistory(page);
|
||||
});
|
||||
|
||||
test("finger scrolling leaves terminal input unfocused until a tap", async ({ page }) => {
|
||||
await openPhoneTerminalHistory(page);
|
||||
await blurTerminalInput(page);
|
||||
|
||||
await expectSingleFingerScroll(page, 24);
|
||||
await expect(input(page)).not.toBeFocused();
|
||||
await expectSingleFingerScroll(page, 1);
|
||||
await expect(input(page)).not.toBeFocused();
|
||||
|
||||
await tapTerminalScreen(page);
|
||||
await expect(input(page)).toBeFocused();
|
||||
});
|
||||
|
||||
test("finger scrolling keeps a floating keyboard's input focused", async ({ page }) => {
|
||||
await openPhoneTerminalHistory(page);
|
||||
await tapTerminalScreen(page);
|
||||
await expect(input(page)).toBeFocused();
|
||||
|
||||
// A floating keyboard leaves the visual viewport unchanged.
|
||||
await expectSingleFingerScroll(page, 24);
|
||||
await expect(input(page)).toBeFocused();
|
||||
await expect(input(page)).toHaveAttribute("virtualkeyboardpolicy", "manual");
|
||||
|
||||
// Android Back also leaves the input focused. A tap restores automatic keyboard opening.
|
||||
await tapTerminalScreen(page);
|
||||
await expect(input(page)).not.toHaveAttribute("virtualkeyboardpolicy");
|
||||
});
|
||||
|
||||
for (const mode of ["alternate", "mouse"] as const) {
|
||||
test(`preserves finger navigation in ${mode} input mode`, async ({ page }) => {
|
||||
await openPhoneInputCapture(page, mode);
|
||||
@@ -559,26 +531,6 @@ async function openPhoneTerminalHistory(page: Page) {
|
||||
});
|
||||
await openPhoneTerminal(page);
|
||||
await expect.poll(() => getTerminalBufferText(page)).toContain("HISTORY_150");
|
||||
await expect
|
||||
.poll(() => page.evaluate(() => window.__paseoTerminal!.buffer.active.baseY))
|
||||
.toBeGreaterThan(0);
|
||||
await page.evaluate(() => window.__paseoTerminal!.scrollToBottom());
|
||||
await expect.poll(() => viewport(page)).toBeGreaterThan(0);
|
||||
}
|
||||
|
||||
function terminalScreen(page: Page) {
|
||||
return page.getByTestId("terminal-surface").filter({ visible: true }).locator(".xterm-screen");
|
||||
}
|
||||
|
||||
async function tapTerminalScreen(page: Page) {
|
||||
const box = await terminalScreen(page).boundingBox();
|
||||
expect(box).not.toBeNull();
|
||||
await page.touchscreen.tap(box!.x + box!.width / 2, box!.y + box!.height / 3);
|
||||
}
|
||||
|
||||
async function blurTerminalInput(page: Page) {
|
||||
await input(page).evaluate((element) => element.blur());
|
||||
await expect(input(page)).not.toBeFocused();
|
||||
}
|
||||
|
||||
async function openPhoneInputCapture(page: Page, mode: "alternate" | "mouse") {
|
||||
@@ -618,20 +570,6 @@ async function openPhoneTerminal(page: Page) {
|
||||
await page.getByTestId(`sidebar-workspace-row-${getServerId()}:${harness.workspaceId}`).click();
|
||||
await expect(page.getByRole("textbox", { name: "Terminal input" })).toBeVisible();
|
||||
await expect(page.getByTestId("terminal-surface").filter({ visible: true })).toBeVisible();
|
||||
// The terminal stays mounted while the sidebar's closing backdrop still intercepts input.
|
||||
await expect
|
||||
.poll(() =>
|
||||
page
|
||||
.getByTestId("terminal-surface")
|
||||
.filter({ visible: true })
|
||||
.evaluate((root) => {
|
||||
const box = root.querySelector(".xterm-screen")!.getBoundingClientRect();
|
||||
return root.contains(
|
||||
document.elementFromPoint(box.x + box.width / 2, box.y + box.height / 3),
|
||||
);
|
||||
}),
|
||||
)
|
||||
.toBe(true);
|
||||
}
|
||||
|
||||
async function expectMouseWheelScrollsHistory(page: Page) {
|
||||
|
||||
@@ -2,14 +2,13 @@ import { tmpdir } from "node:os";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import path from "node:path";
|
||||
import type { Page } from "@playwright/test";
|
||||
import type { UsageReport, UsageReportEntry } from "@getpaseo/protocol/messages";
|
||||
import type { UsageReportEntry } from "@getpaseo/protocol/messages";
|
||||
import { expect, test } from "../support/fixtures";
|
||||
import { gotoAppShell, openSettings } from "../support/helpers/app";
|
||||
import { addConnectedHostAndReload } from "../support/helpers/hosts";
|
||||
import { startIsolatedHostDaemon } from "../support/helpers/isolated-host-daemon";
|
||||
import { openSettingsSection } from "../support/helpers/settings";
|
||||
import { gate } from "../support/helpers/context-window";
|
||||
import { installDaemonWebSocketGate } from "../support/helpers/daemon-websocket-gate";
|
||||
import { getServerId } from "../support/helpers/server-id";
|
||||
import { seedSidebarFooterPreferences } from "../support/helpers/sidebar-nav-settings";
|
||||
import {
|
||||
@@ -46,7 +45,6 @@ import {
|
||||
refreshAllUsage,
|
||||
togglePin,
|
||||
usageItem,
|
||||
usageModal,
|
||||
} from "../support/helpers/usage-sidebar-item";
|
||||
|
||||
const emptyHome = path.join(tmpdir(), `paseo-usage-empty-${randomUUID()}`);
|
||||
@@ -867,106 +865,6 @@ test("open usage clocks advance without refreshing or reopening", async ({ page
|
||||
}
|
||||
});
|
||||
|
||||
test("Refresh all keeps quota visible and restores the forecast after a timeout", async ({
|
||||
page,
|
||||
}) => {
|
||||
const reading = new Date();
|
||||
const login = await installLoginUsage(usageReading(reading, 40));
|
||||
try {
|
||||
const transport = await installDaemonWebSocketGate(page);
|
||||
await openCompactUsageWithClock(page, reading);
|
||||
await expectQuota(page, "40% used", /runs out in /);
|
||||
|
||||
await timeOutUsageRefresh(page, transport);
|
||||
await expectQuota(page, "40% used", null);
|
||||
await expectUsageRefreshError(page).toBeVisible();
|
||||
|
||||
await login.setReport(usageReading(reading, 10));
|
||||
transport.releaseHeldClientRequest();
|
||||
await refreshAllUsage(page);
|
||||
await expectQuota(page, "10% used", "~50% left at reset");
|
||||
await expectUsageRefreshError(page).toBeHidden();
|
||||
} finally {
|
||||
await login.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("a card refresh timeout is visible alongside a newer quota forecast", async ({ page }) => {
|
||||
const reading = new Date();
|
||||
const login = await installLoginUsage(usageReading(reading, 40));
|
||||
try {
|
||||
const transport = await installDaemonWebSocketGate(page);
|
||||
await openCompactUsageWithClock(page, reading);
|
||||
await expectQuota(page, "40% used", /runs out in /);
|
||||
|
||||
await delayCardRefreshResponse(page, transport);
|
||||
await login.setReport(usageReading(reading, 10));
|
||||
await refreshAllUsage(page);
|
||||
await expectQuota(page, "10% used", "~50% left at reset");
|
||||
|
||||
await advanceUsageClock(page, 61_000);
|
||||
await expectUsageRefreshError(page).toBeVisible();
|
||||
await expectQuota(page, "10% used", "~50% left at reset");
|
||||
} finally {
|
||||
await login.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
function expectUsageRefreshError(page: Page) {
|
||||
return expect(usageModal(page).getByText("Unable to refresh usage", { exact: true }));
|
||||
}
|
||||
|
||||
async function delayCardRefreshResponse(
|
||||
page: Page,
|
||||
transport: Awaited<ReturnType<typeof installDaemonWebSocketGate>>,
|
||||
) {
|
||||
await expect(page.getByRole("button", { name: "Refresh all", exact: true })).toBeEnabled();
|
||||
transport.holdNextServerMessage("usage.list_reports.response");
|
||||
await refreshLoginUsage(page);
|
||||
await transport.waitForHeldServerMessage("usage.list_reports.response");
|
||||
}
|
||||
|
||||
function usageReading(observed: Date, usedPct: number): UsageReport {
|
||||
return {
|
||||
status: "available",
|
||||
observedAt: observed.toISOString(),
|
||||
windows: [
|
||||
{
|
||||
id: "session",
|
||||
label: "Session",
|
||||
usedPct,
|
||||
durationSeconds: 18_000,
|
||||
resetsAt: new Date(observed.getTime() + 4 * 3_600_000).toISOString(),
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
async function expectQuota(page: Page, amount: string, forecast: string | RegExp | null) {
|
||||
const usage = usageModal(page);
|
||||
await expect(usage.getByText(amount, { exact: true })).toBeVisible();
|
||||
await expect(usage.getByText(/^resets in /)).toBeVisible();
|
||||
if (forecast === null) {
|
||||
await expect(usage.getByText(/^runs out in /)).toBeHidden();
|
||||
return;
|
||||
}
|
||||
await expect(usage.getByText(forecast)).toBeVisible();
|
||||
}
|
||||
|
||||
async function timeOutUsageRefresh(
|
||||
page: Page,
|
||||
transport: Awaited<ReturnType<typeof installDaemonWebSocketGate>>,
|
||||
) {
|
||||
const refresh = page.getByRole("button", { name: "Refresh all", exact: true });
|
||||
await expect(refresh).toBeEnabled();
|
||||
transport.holdNextClientRequest("usage.list_reports.request");
|
||||
await refreshAllUsage(page);
|
||||
await transport.waitForHeldClientRequest();
|
||||
await expect(refresh).toBeDisabled();
|
||||
await advanceUsageClock(page, 61_000);
|
||||
await expect(refresh).toBeEnabled();
|
||||
}
|
||||
|
||||
async function openCompactUsageWithClock(page: Page, now: Date) {
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await page.clock.install({ time: now });
|
||||
|
||||
@@ -318,37 +318,6 @@ test.describe("Workspace archive undo", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("archives a restored workspace while its undo is queued", async ({ page }) => {
|
||||
const teardown = createGatedTeardown();
|
||||
const repo = await createTempGitRepo("archive-undo-archive-", {
|
||||
paseoConfig: teardown.paseoConfig,
|
||||
});
|
||||
|
||||
try {
|
||||
await openProjectViaDaemon(client, repo.path);
|
||||
const worktree = await createWorktreeViaDaemon(client, {
|
||||
cwd: repo.path,
|
||||
slug: "archive-undo-archive",
|
||||
});
|
||||
worktreeDirectories.add(worktree.workspaceDirectory);
|
||||
await gotoAppShell(page);
|
||||
await archiveFromRowButton(page, worktree.workspaceId);
|
||||
await teardown.expectStarted();
|
||||
|
||||
await undoButton(page).click();
|
||||
await workspaceRow(page, worktree.workspaceId).click();
|
||||
await expect(page).toHaveURL(new RegExp(`/workspace/${worktree.workspaceId}$`));
|
||||
|
||||
await pressArchiveShortcut(page);
|
||||
await expectWorkspaceAbsentFromSidebar(page, worktree.workspaceId);
|
||||
teardown.release();
|
||||
await expectDirectoryPresence(worktree.workspaceDirectory, false);
|
||||
} finally {
|
||||
teardown.release();
|
||||
await repo.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("Cmd/Ctrl+Z without an archive to undo leaves the sidebar alone", async ({ page }) => {
|
||||
const worktree = await seedWorktree(page, "archive-undo-none");
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import {
|
||||
} from "../support/helpers/sidebar";
|
||||
import { createTempGitRepo } from "../support/helpers/workspace";
|
||||
import {
|
||||
pressArchiveShortcut,
|
||||
rowArchiveButton,
|
||||
undoButton,
|
||||
workspaceRow,
|
||||
@@ -99,18 +98,6 @@ async function clickRowArchiveButton(page: Page, workspaceId: string): Promise<v
|
||||
await rowArchiveButton(page, workspaceId).click();
|
||||
}
|
||||
|
||||
async function cycleThemeAndWaitForSidebar(page: Page, workspaceId: string): Promise<void> {
|
||||
const rowBeforeThemeChange = await workspaceRow(page, workspaceId).elementHandle();
|
||||
if (!rowBeforeThemeChange)
|
||||
throw new Error("The workspace row must be mounted before cycling the theme");
|
||||
await page.keyboard.press("ControlOrMeta+Alt+t");
|
||||
await expect
|
||||
.poll(() => rowBeforeThemeChange.evaluate((element) => element.isConnected), {
|
||||
message: "the sidebar remounts after the theme changes",
|
||||
})
|
||||
.toBe(false);
|
||||
}
|
||||
|
||||
interface SessionEnvelope {
|
||||
type?: unknown;
|
||||
message?: {
|
||||
@@ -224,28 +211,18 @@ async function relayDaemon(
|
||||
* Holds the app's next checkout status request for `directory` once armed, so a test can act
|
||||
* while the archive waits for the host's answer.
|
||||
*/
|
||||
async function holdCheckoutStatusRequest(
|
||||
page: Page,
|
||||
worktree: { workspaceDirectory: string; workspaceId: string },
|
||||
) {
|
||||
async function holdCheckoutStatusRequest(page: Page, directory: string) {
|
||||
let armed = false;
|
||||
let held: (() => void) | null = null;
|
||||
let archiveRequests = 0;
|
||||
await page.routeWebSocket(daemonWsRoutePattern(), (browser) => {
|
||||
const server = browser.connectToServer();
|
||||
browser.onMessage((message) => {
|
||||
const request = typeof message === "string" ? parseSessionEnvelope(message)?.message : null;
|
||||
if (
|
||||
request?.type === "archive_workspace_request" &&
|
||||
request.workspaceId === worktree.workspaceId
|
||||
) {
|
||||
archiveRequests += 1;
|
||||
}
|
||||
if (
|
||||
armed &&
|
||||
!held &&
|
||||
request?.type === "checkout_status_request" &&
|
||||
request.cwd === worktree.workspaceDirectory
|
||||
request.cwd === directory
|
||||
) {
|
||||
held = () => server.send(message);
|
||||
return;
|
||||
@@ -259,7 +236,6 @@ async function holdCheckoutStatusRequest(
|
||||
armed = true;
|
||||
},
|
||||
waitForHeld: () => expect.poll(() => held !== null).toBe(true),
|
||||
archiveRequests: () => archiveRequests,
|
||||
release: () => {
|
||||
if (!held) throw new Error("No checkout status request is held");
|
||||
held();
|
||||
@@ -412,7 +388,7 @@ test.describe("Workspace archive risk warning for worktree backing", () => {
|
||||
): Promise<string> {
|
||||
const serverId = getServerId();
|
||||
const worktree = await createWorktree(slug);
|
||||
const statusRequest = await holdCheckoutStatusRequest(page, worktree);
|
||||
const statusRequest = await holdCheckoutStatusRequest(page, worktree.workspaceDirectory);
|
||||
await openSidebarRow(page, worktree.workspaceId);
|
||||
await workspaceRow(page, worktree.workspaceId).click();
|
||||
await expectAppRoute(page, buildHostWorkspaceRoute(serverId, worktree.workspaceId));
|
||||
@@ -456,82 +432,6 @@ test.describe("Workspace archive risk warning for worktree backing", () => {
|
||||
await expectAppRoute(page, openedRoute);
|
||||
});
|
||||
|
||||
async function openWorktreeWithCheckoutHeld(page: Page, slug: string) {
|
||||
const worktree = await createWorktree(slug);
|
||||
const statusRequest = await holdCheckoutStatusRequest(page, worktree);
|
||||
// Opening the workspace can start a checkout read that the archive reuses.
|
||||
statusRequest.arm();
|
||||
await openSidebarRow(page, worktree.workspaceId);
|
||||
await workspaceRow(page, worktree.workspaceId).click();
|
||||
await expectAppRoute(page, buildHostWorkspaceRoute(getServerId(), worktree.workspaceId));
|
||||
return { worktree, statusRequest };
|
||||
}
|
||||
|
||||
test("the archive shortcut works in another workspace while a checkout check is pending", async ({
|
||||
page,
|
||||
}) => {
|
||||
const { worktree, statusRequest } = await openWorktreeWithCheckoutHeld(
|
||||
page,
|
||||
"archive-risk-switch-shortcut",
|
||||
);
|
||||
|
||||
await pressArchiveShortcut(page);
|
||||
await statusRequest.waitForHeld();
|
||||
try {
|
||||
const otherWorkspaceId = worktree.project.workspaceId;
|
||||
await workspaceRow(page, otherWorkspaceId).click();
|
||||
await expectAppRoute(page, buildHostWorkspaceRoute(getServerId(), otherWorkspaceId));
|
||||
|
||||
await pressArchiveShortcut(page);
|
||||
await expect.poll(() => hostListsWorkspace(otherWorkspaceId)).toBe(false);
|
||||
} finally {
|
||||
statusRequest.release();
|
||||
}
|
||||
await expect.poll(() => hostListsWorkspace(worktree.workspaceId)).toBe(false);
|
||||
});
|
||||
|
||||
test("the row button and shortcut send one archive for the same worktree", async ({ page }) => {
|
||||
const { worktree, statusRequest } = await openWorktreeWithCheckoutHeld(
|
||||
page,
|
||||
"archive-risk-repeat-shortcut",
|
||||
);
|
||||
|
||||
await clickRowArchiveButton(page, worktree.workspaceId);
|
||||
await statusRequest.waitForHeld();
|
||||
try {
|
||||
await pressArchiveShortcut(page);
|
||||
} finally {
|
||||
statusRequest.release();
|
||||
}
|
||||
|
||||
await expect.poll(() => hostListsWorkspace(worktree.workspaceId)).toBe(false);
|
||||
expect(statusRequest.archiveRequests()).toBe(1);
|
||||
});
|
||||
|
||||
test("keeps the newly opened workspace after a theme change during an archive check", async ({
|
||||
page,
|
||||
}) => {
|
||||
const { worktree, statusRequest } = await openWorktreeWithCheckoutHeld(
|
||||
page,
|
||||
"archive-risk-theme",
|
||||
);
|
||||
|
||||
await pressArchiveShortcut(page);
|
||||
await statusRequest.waitForHeld();
|
||||
const otherWorkspaceId = worktree.project.workspaceId;
|
||||
const otherRoute = buildHostWorkspaceRoute(getServerId(), otherWorkspaceId);
|
||||
try {
|
||||
await cycleThemeAndWaitForSidebar(page, otherWorkspaceId);
|
||||
await workspaceRow(page, otherWorkspaceId).click();
|
||||
await expectAppRoute(page, otherRoute);
|
||||
} finally {
|
||||
statusRequest.release();
|
||||
}
|
||||
|
||||
await expect.poll(() => hostListsWorkspace(worktree.workspaceId)).toBe(false);
|
||||
await expectAppRoute(page, otherRoute);
|
||||
});
|
||||
|
||||
test("archiving the open worktree from its git actions leaves it for a new workspace", async ({
|
||||
page,
|
||||
}) => {
|
||||
|
||||
@@ -185,15 +185,13 @@ function onLogin(report: UsageReportEntry, login: string): UsageReportEntry {
|
||||
}
|
||||
|
||||
export function expiredLogin(report: UsageReportEntry): UsageReportEntry {
|
||||
const fetchedAt = Date.now();
|
||||
return {
|
||||
...report,
|
||||
fetchedAt: new Date(fetchedAt).toISOString(),
|
||||
report: {
|
||||
status: "unavailable",
|
||||
problem: {
|
||||
kind: "expired",
|
||||
expiresAt: new Date(fetchedAt - 2 * 60 * 60_000).toISOString(),
|
||||
expiresAt: new Date(Date.now() - 2 * 60 * 60_000).toISOString(),
|
||||
refreshedBy: "claude",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -54,7 +54,6 @@ import { WindowSidebarMenuToggle } from "@/components/headers/sidebar-menu-toggl
|
||||
import { DesktopWindowControls } from "@/components/desktop/window-controls";
|
||||
import { SidebarModelProvider } from "@/components/sidebar/sidebar-model";
|
||||
import { WorkspacePinShortcutHandler } from "@/components/workspace-pin-shortcut-handler";
|
||||
import { WorkspaceArchiveShortcutHandler } from "@/components/workspace-archive-shortcut-handler";
|
||||
import { WorkspaceRenameHost } from "@/components/workspace-rename-host";
|
||||
import { WorkspaceArchiveUndoShortcutHost } from "@/workspace/archive-undo";
|
||||
import { WorkspaceExplorerOpenGesture } from "@/mobile-panels/explorer-open-gesture";
|
||||
@@ -538,7 +537,6 @@ function AppContainer({ children, chromeEnabled: chromeEnabledOverride }: AppCon
|
||||
<View style={layoutStyles.surfaceFill}>
|
||||
{workspaceChrome}
|
||||
<AddHostFlowHost />
|
||||
<WorkspaceArchiveShortcutHandler />
|
||||
<AppearanceStyleBoundary>
|
||||
{!isCompactLayout && appChromeLayout.sidebarToggleOwner === "window" ? (
|
||||
<WindowChromeRegion corners="top-left">
|
||||
|
||||
@@ -128,6 +128,7 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip
|
||||
import { Shortcut } from "@/components/ui/shortcut";
|
||||
import type { ShortcutKey } from "@/utils/format-shortcut";
|
||||
import { useShortcutKeys } from "@/hooks/use-shortcut-keys";
|
||||
import { useKeyboardActionHandler } from "@/hooks/use-keyboard-action-handler";
|
||||
import { useWorkspaceReadState } from "@/hooks/use-workspace-read-state";
|
||||
import type { PrHint } from "@/git/use-pr-status-query";
|
||||
import {
|
||||
@@ -1297,6 +1298,17 @@ function WorkspaceRowWithMenu({
|
||||
});
|
||||
}, [markUnread, toast]);
|
||||
|
||||
useKeyboardActionHandler({
|
||||
handlerId: `workspace-archive-${workspace.workspaceKey}`,
|
||||
actions: ["workspace.archive"],
|
||||
enabled: selected && !isArchiving,
|
||||
priority: 0,
|
||||
handle: () => {
|
||||
handleArchive();
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<WorkspaceRowInner
|
||||
|
||||
@@ -42,6 +42,7 @@ import { redirectIfArchivingActiveWorkspace } from "@/utils/sidebar-workspace-ar
|
||||
import { useWorkspaceArchive } from "@/workspace/use-workspace-archive";
|
||||
import type { ShortcutKey } from "@/utils/format-shortcut";
|
||||
import { useShortcutKeys } from "@/hooks/use-shortcut-keys";
|
||||
import { useKeyboardActionHandler } from "@/hooks/use-keyboard-action-handler";
|
||||
import { useWorkspaceReadState } from "@/hooks/use-workspace-read-state";
|
||||
import {
|
||||
SidebarWorkspaceRowFrame,
|
||||
@@ -701,6 +702,17 @@ function StatusWorkspaceRowWithMenu({
|
||||
});
|
||||
}, [markUnread, toast]);
|
||||
|
||||
useKeyboardActionHandler({
|
||||
handlerId: `workspace-archive-${workspace.workspaceKey}`,
|
||||
actions: ["workspace.archive"],
|
||||
enabled: selected && !isArchiving,
|
||||
priority: 0,
|
||||
handle: () => {
|
||||
handleArchive();
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<StatusWorkspaceRowInner
|
||||
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
useRef,
|
||||
type CSSProperties,
|
||||
type MouseEvent as ReactMouseEvent,
|
||||
type PointerEvent as ReactPointerEvent,
|
||||
type Ref,
|
||||
} from "react";
|
||||
import type { DOMProps } from "expo/dom";
|
||||
@@ -64,12 +63,6 @@ const HOST_DIV_STYLE: CSSProperties = {
|
||||
paddingRight: 0,
|
||||
};
|
||||
|
||||
interface TerminalTouchFocus {
|
||||
pointerId: number;
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
function buildXtermThemeKey(theme: ITheme): string {
|
||||
const values: Array<string> = [
|
||||
theme.background,
|
||||
@@ -560,46 +553,10 @@ export default function TerminalEmulator({
|
||||
});
|
||||
}, []);
|
||||
|
||||
const touchFocusRef = useRef<TerminalTouchFocus | null>(null);
|
||||
|
||||
const handleRootPointerDown = useCallback(
|
||||
(event: ReactPointerEvent) => {
|
||||
onFocus?.();
|
||||
touchFocusRef.current = null;
|
||||
if (event.pointerType !== "touch") {
|
||||
runtimeRef.current?.focus();
|
||||
return;
|
||||
}
|
||||
// Focusing before a touch becomes a tap opens the keyboard during a scroll.
|
||||
if (event.isPrimary) {
|
||||
touchFocusRef.current = {
|
||||
pointerId: event.pointerId,
|
||||
x: event.clientX,
|
||||
y: event.clientY,
|
||||
};
|
||||
}
|
||||
},
|
||||
[onFocus],
|
||||
);
|
||||
|
||||
const handleRootPointerMove = useCallback((event: ReactPointerEvent) => {
|
||||
const touch = touchFocusRef.current;
|
||||
if (touch?.pointerId !== event.pointerId) return;
|
||||
if (Math.hypot(event.clientX - touch.x, event.clientY - touch.y) > 8) {
|
||||
touchFocusRef.current = null;
|
||||
runtimeRef.current?.suppressAutomaticKeyboard();
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleRootPointerUp = useCallback((event: ReactPointerEvent) => {
|
||||
const touch = touchFocusRef.current;
|
||||
touchFocusRef.current = null;
|
||||
if (touch?.pointerId === event.pointerId) runtimeRef.current?.focus();
|
||||
}, []);
|
||||
|
||||
const handleRootPointerCancel = useCallback(() => {
|
||||
touchFocusRef.current = null;
|
||||
}, []);
|
||||
const handleRootPointerDown = useCallback(() => {
|
||||
onFocus?.();
|
||||
runtimeRef.current?.focus();
|
||||
}, [onFocus]);
|
||||
|
||||
const handleRootContextMenu = useCallback(
|
||||
(event: ReactMouseEvent) => {
|
||||
@@ -631,9 +588,6 @@ export default function TerminalEmulator({
|
||||
data-terminal-scrollbar-root="true"
|
||||
style={rootDivStyle}
|
||||
onPointerDown={handleRootPointerDown}
|
||||
onPointerMove={handleRootPointerMove}
|
||||
onPointerUp={handleRootPointerUp}
|
||||
onPointerCancel={handleRootPointerCancel}
|
||||
onContextMenu={handleRootContextMenu}
|
||||
>
|
||||
<div ref={hostRef} style={HOST_DIV_STYLE} />
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import { useGlobalWorkspaceArchiveAction } from "@/hooks/use-global-workspace-archive-action";
|
||||
|
||||
// Headless host for the archive shortcut, kept out of the root layout for the same reason as
|
||||
// WorkspacePinShortcutHandler: the hook subscribes to the active workspace's fields.
|
||||
export function WorkspaceArchiveShortcutHandler() {
|
||||
useGlobalWorkspaceArchiveAction();
|
||||
return null;
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
import { useCallback } from "react";
|
||||
import { useKeyboardActionHandler } from "@/hooks/use-keyboard-action-handler";
|
||||
import type { KeyboardActionId } from "@/keyboard/keyboard-action-dispatcher";
|
||||
import { useActiveWorkspaceSelection } from "@/stores/navigation-active-workspace-store";
|
||||
import { useWorkspaceFields } from "@/stores/session-store-hooks";
|
||||
import { redirectIfArchivingActiveWorkspace } from "@/utils/sidebar-workspace-archive-redirect";
|
||||
import { useWorkspaceArchive } from "@/workspace/use-workspace-archive";
|
||||
import { isWorkspaceListed, type WorkspaceArchiveTarget } from "@/workspace/workspace-archive";
|
||||
|
||||
const WORKSPACE_ARCHIVE_ACTIONS: readonly KeyboardActionId[] = ["workspace.archive"];
|
||||
|
||||
// The archive shortcut used to live on the sidebar row, so it did nothing whenever the row was not
|
||||
// rendered — a collapsed project or status group, a collapsed Pinned section, or focus mode. Like
|
||||
// the pin shortcut (see use-global-workspace-pin-action.ts), it is one registration keyed on the
|
||||
// active route selection.
|
||||
export function useGlobalWorkspaceArchiveAction() {
|
||||
const selection = useActiveWorkspaceSelection();
|
||||
const serverId = selection?.serverId ?? null;
|
||||
const routeWorkspaceId = selection?.workspaceId ?? null;
|
||||
// `id` is the descriptor id, not the route id; see use-global-workspace-pin-action.ts.
|
||||
const fields = useWorkspaceFields(serverId, routeWorkspaceId, (workspace) => ({
|
||||
id: workspace.id,
|
||||
workspaceKind: workspace.workspaceKind,
|
||||
workspaceDirectory: workspace.workspaceDirectory,
|
||||
name: workspace.name,
|
||||
archivingAt: workspace.archivingAt,
|
||||
diffStat: workspace.diffStat,
|
||||
}));
|
||||
|
||||
// useWorkspaceArchive calls the latest render's callback, so `activeWorkspaceId` is whatever is
|
||||
// routed when the archive starts, after any confirmation. It is the descriptor id, which is what
|
||||
// the redirect compares against.
|
||||
const activeWorkspaceId = fields?.id ?? null;
|
||||
const redirectAfterArchive = useCallback(
|
||||
(workspace: WorkspaceArchiveTarget) => {
|
||||
redirectIfArchivingActiveWorkspace({
|
||||
...workspace,
|
||||
activeWorkspaceSelection:
|
||||
serverId && activeWorkspaceId ? { serverId, workspaceId: activeWorkspaceId } : null,
|
||||
});
|
||||
},
|
||||
[activeWorkspaceId, serverId],
|
||||
);
|
||||
|
||||
const archiveController = useWorkspaceArchive({
|
||||
serverId: serverId ?? "",
|
||||
workspaceId: fields?.id ?? "",
|
||||
workspaceKind: fields?.workspaceKind ?? "directory",
|
||||
workspaceDirectory: fields?.workspaceDirectory ?? "",
|
||||
name: fields?.name ?? "",
|
||||
diffStat: fields?.diffStat,
|
||||
onArchiveStarted: redirectAfterArchive,
|
||||
});
|
||||
|
||||
const canArchive = fields !== null && fields.archivingAt === null;
|
||||
|
||||
const handle = useCallback(() => {
|
||||
if (!canArchive || !serverId) {
|
||||
return false;
|
||||
}
|
||||
// Archiving hides its target immediately. Read the store in case the shortcut
|
||||
// runs again before React renders that update.
|
||||
if (!isWorkspaceListed({ serverId, workspaceId: fields.id })) {
|
||||
return false;
|
||||
}
|
||||
archiveController.archive();
|
||||
return true;
|
||||
}, [archiveController, canArchive, fields, serverId]);
|
||||
|
||||
useKeyboardActionHandler({
|
||||
handlerId: "workspace-archive-global",
|
||||
actions: WORKSPACE_ARCHIVE_ACTIONS,
|
||||
enabled: canArchive,
|
||||
priority: 0,
|
||||
handle,
|
||||
});
|
||||
}
|
||||
@@ -2323,9 +2323,6 @@ export const ar: TranslationResources = {
|
||||
resetsIn: "تتم إعادة التعيين خلال {{duration}}",
|
||||
resetsAtWeekday: "{{weekday}} {{time}}",
|
||||
resetsAtDate: "{{date}}، {{time}}",
|
||||
projectedLeftAtReset: "نحو {{percentage}} متبقية عند إعادة التعيين",
|
||||
limitReached: "تم بلوغ الحد",
|
||||
mayHaveRunOut: "ربما نفدت الحصة",
|
||||
runsOutNow: "ينفد الآن",
|
||||
runsOutIn: "ينفد خلال {{duration}}",
|
||||
justNow: "الآن",
|
||||
|
||||
@@ -2333,9 +2333,6 @@ export const en = {
|
||||
resetsIn: "resets in {{duration}}",
|
||||
resetsAtWeekday: "{{weekday}} {{time}}",
|
||||
resetsAtDate: "{{date}}, {{time}}",
|
||||
projectedLeftAtReset: "~{{percentage}} left at reset",
|
||||
limitReached: "Limit reached",
|
||||
mayHaveRunOut: "May have run out",
|
||||
runsOutNow: "runs out now",
|
||||
runsOutIn: "runs out in {{duration}}",
|
||||
justNow: "just now",
|
||||
|
||||
@@ -2354,9 +2354,6 @@ export const es: TranslationResources = {
|
||||
resetsIn: "se restablece en {{duration}}",
|
||||
resetsAtWeekday: "{{weekday}} {{time}}",
|
||||
resetsAtDate: "{{date}}, {{time}}",
|
||||
projectedLeftAtReset: "~{{percentage}} restante al restablecerse",
|
||||
limitReached: "Límite alcanzado",
|
||||
mayHaveRunOut: "Puede que ya se haya agotado",
|
||||
runsOutNow: "se agota ahora",
|
||||
runsOutIn: "se agota en {{duration}}",
|
||||
justNow: "ahora mismo",
|
||||
|
||||
@@ -2355,9 +2355,6 @@ export const fr: TranslationResources = {
|
||||
resetsIn: "se réinitialise dans {{duration}}",
|
||||
resetsAtWeekday: "{{weekday}} {{time}}",
|
||||
resetsAtDate: "{{date}}, {{time}}",
|
||||
projectedLeftAtReset: "~{{percentage}} restant à la réinitialisation",
|
||||
limitReached: "Limite atteinte",
|
||||
mayHaveRunOut: "Le quota est peut-être épuisé",
|
||||
runsOutNow: "s’épuise maintenant",
|
||||
runsOutIn: "s’épuise dans {{duration}}",
|
||||
justNow: "à l’instant",
|
||||
|
||||
@@ -2328,9 +2328,6 @@ export const ja: TranslationResources = {
|
||||
resetsIn: "{{duration}}後にリセット",
|
||||
resetsAtWeekday: "{{weekday}} {{time}}",
|
||||
resetsAtDate: "{{date}} {{time}}",
|
||||
projectedLeftAtReset: "リセット時に約{{percentage}}残る見込み",
|
||||
limitReached: "上限に達しました",
|
||||
mayHaveRunOut: "上限に達した可能性があります",
|
||||
runsOutNow: "まもなく上限に到達",
|
||||
runsOutIn: "{{duration}}後に上限に到達",
|
||||
justNow: "たった今",
|
||||
|
||||
@@ -2316,9 +2316,6 @@ export const ko: TranslationResources = {
|
||||
resetsIn: "{{duration}} 후 재설정",
|
||||
resetsAtWeekday: "{{weekday}} {{time}}",
|
||||
resetsAtDate: "{{date}} {{time}}",
|
||||
projectedLeftAtReset: "초기화 시 약 {{percentage}} 남을 예정",
|
||||
limitReached: "한도에 도달함",
|
||||
mayHaveRunOut: "한도를 소진했을 수 있음",
|
||||
runsOutNow: "지금 한도에 도달",
|
||||
runsOutIn: "{{duration}} 후 한도에 도달",
|
||||
justNow: "방금",
|
||||
|
||||
@@ -2339,9 +2339,6 @@ export const ptBR: TranslationResources = {
|
||||
resetsIn: "redefine em {{duration}}",
|
||||
resetsAtWeekday: "{{weekday}} {{time}}",
|
||||
resetsAtDate: "{{date}}, {{time}}",
|
||||
projectedLeftAtReset: "~{{percentage}} restará na renovação",
|
||||
limitReached: "Limite atingido",
|
||||
mayHaveRunOut: "A cota pode ter se esgotado",
|
||||
runsOutNow: "esgota agora",
|
||||
runsOutIn: "esgota em {{duration}}",
|
||||
justNow: "agora mesmo",
|
||||
|
||||
@@ -2341,9 +2341,6 @@ export const ru: TranslationResources = {
|
||||
resetsIn: "сброс через {{duration}}",
|
||||
resetsAtWeekday: "{{weekday}} {{time}}",
|
||||
resetsAtDate: "{{date}}, {{time}}",
|
||||
projectedLeftAtReset: "К сбросу останется ~{{percentage}}",
|
||||
limitReached: "Лимит исчерпан",
|
||||
mayHaveRunOut: "Лимит мог уже исчерпаться",
|
||||
runsOutNow: "закончится сейчас",
|
||||
runsOutIn: "закончится через {{duration}}",
|
||||
justNow: "только что",
|
||||
|
||||
@@ -2282,9 +2282,6 @@ export const zhCN: TranslationResources = {
|
||||
resetsIn: "将在 {{duration}}后重置",
|
||||
resetsAtWeekday: "{{weekday}} {{time}}",
|
||||
resetsAtDate: "{{date}} {{time}}",
|
||||
projectedLeftAtReset: "重置时约剩余 {{percentage}}",
|
||||
limitReached: "已达到上限",
|
||||
mayHaveRunOut: "额度可能已用完",
|
||||
runsOutNow: "即将用尽",
|
||||
runsOutIn: "将在 {{duration}}后用尽",
|
||||
justNow: "刚刚",
|
||||
|
||||
@@ -10,10 +10,7 @@ import type {
|
||||
DaemonClient,
|
||||
WorkspaceLabelListPayload,
|
||||
} from "@getpaseo/client/internal/daemon-client";
|
||||
import type {
|
||||
SessionOutboundMessage,
|
||||
WorkspaceDescriptorPayload,
|
||||
} from "@getpaseo/protocol/messages";
|
||||
import type { SessionOutboundMessage } from "@getpaseo/protocol/messages";
|
||||
import {
|
||||
normalizeProjectDescriptor,
|
||||
normalizeWorkspaceDescriptor,
|
||||
@@ -1670,187 +1667,6 @@ it("fills every cached workspace beneath live updates received during the SQLite
|
||||
database.close();
|
||||
});
|
||||
|
||||
/**
|
||||
* A host whose cache was damaged before the eviction fix: workspaces survived, project rows did not,
|
||||
* and a version 1 checkpoint still claims the project directory is current. The daemon holds
|
||||
* projects A and B; renaming A is its update at `renameSeq`.
|
||||
*/
|
||||
async function createDamagedLegacyProjectDirectory(serverId: string, renameSeq: number) {
|
||||
serverIds.add(serverId);
|
||||
const { cache, database, storage, reopen, holdRead } = createSqliteCache();
|
||||
cache.setHosts([serverId]);
|
||||
const workspacePayload = (id: string, projectId: string): WorkspaceDescriptorPayload => ({
|
||||
id,
|
||||
projectId,
|
||||
projectDisplayName: projectId,
|
||||
projectRootPath: `/repo/${projectId}`,
|
||||
workspaceDirectory: `/repo/${projectId}`,
|
||||
projectKind: "git",
|
||||
workspaceKind: "local_checkout",
|
||||
name: id,
|
||||
status: "done",
|
||||
statusEnteredAt: null,
|
||||
activityAt: null,
|
||||
archivingAt: null,
|
||||
diffStat: null,
|
||||
scripts: [],
|
||||
});
|
||||
const project = (projectId: string, projectDisplayName: string) => ({
|
||||
projectId,
|
||||
projectDisplayName,
|
||||
projectRootPath: `/repo/${projectId}`,
|
||||
projectKind: "git" as const,
|
||||
});
|
||||
const workspaceEntries = [workspacePayload("wa", "A"), workspacePayload("wb", "B")];
|
||||
cache.replaceDirectoryBaseline(serverId, {
|
||||
agents: new Map(),
|
||||
workspaces: new Map(
|
||||
workspaceEntries.map((entry) => [entry.id, normalizeWorkspaceDescriptor(entry)]),
|
||||
),
|
||||
projects: new Map(),
|
||||
});
|
||||
await cache.flush();
|
||||
await storage.apply({
|
||||
deletes: [],
|
||||
upserts: [
|
||||
{
|
||||
serverId,
|
||||
kind: "checkpoint",
|
||||
id: "singleton",
|
||||
payload: JSON.stringify({
|
||||
version: 1,
|
||||
cursors: { projects: { generation: "g", afterSeq: renameSeq - 1 } },
|
||||
}),
|
||||
},
|
||||
],
|
||||
});
|
||||
const reopened = reopen();
|
||||
reopened.setHosts([serverId]);
|
||||
const client = new FakeDirectoryClient();
|
||||
let failNextProjectRequest = false;
|
||||
client.listProjects = async (options?: unknown): Promise<ProjectListResult> => {
|
||||
client.lastProjectOptions = options;
|
||||
if (failNextProjectRequest) {
|
||||
failNextProjectRequest = false;
|
||||
throw new Error("Request timed out");
|
||||
}
|
||||
const resumesAfterRename =
|
||||
(options as { sync?: { afterSeq?: number } } | undefined)?.sync?.afterSeq === renameSeq;
|
||||
return resumesAfterRename
|
||||
? {
|
||||
requestId: "projects",
|
||||
projects: [],
|
||||
sync: { generation: "g", headSeq: renameSeq, mode: "changes", removals: [] },
|
||||
}
|
||||
: {
|
||||
requestId: "projects",
|
||||
projects: [project("A", "Renamed"), project("B", "B")],
|
||||
sync: { generation: "g", headSeq: renameSeq, mode: "snapshot", removals: [] },
|
||||
};
|
||||
};
|
||||
client.fetchWorkspaces = async (): Promise<WorkspaceFetchResult> => ({
|
||||
requestId: "workspaces",
|
||||
entries: workspaceEntries,
|
||||
emptyProjects: [],
|
||||
pageInfo: { hasMore: false, nextCursor: null, prevCursor: null },
|
||||
sync: { generation: "g", headSeq: 2, mode: "snapshot", removals: [] },
|
||||
});
|
||||
const directory = new DirectorySync(
|
||||
serverId,
|
||||
{
|
||||
onAgentStoppedRunning: () => {},
|
||||
markAgentLoading: () => {},
|
||||
markAgentReady: () => {},
|
||||
markAgentError: () => {},
|
||||
},
|
||||
reopened,
|
||||
);
|
||||
const store = useSessionStore.getState();
|
||||
store.initializeSession(serverId, client as unknown as DaemonClient, 1);
|
||||
store.updateSessionServerInfo(serverId, {
|
||||
serverId,
|
||||
hostname: null,
|
||||
version: "test",
|
||||
features: { workspaceMultiplicity: true, directorySync: true, projectList: true },
|
||||
});
|
||||
directory.connectionChanged({
|
||||
client: client as unknown as DaemonClient,
|
||||
status: "online",
|
||||
source: { clientGeneration: 1, connectionEpoch: 1 },
|
||||
});
|
||||
return {
|
||||
client,
|
||||
directory,
|
||||
holdRead,
|
||||
failNextProjectRequest: () => {
|
||||
failNextProjectRequest = true;
|
||||
},
|
||||
renameProjectA: () =>
|
||||
client.emit({
|
||||
type: "project.update",
|
||||
payload: {
|
||||
kind: "upsert",
|
||||
project: project("A", "Renamed"),
|
||||
generation: "g",
|
||||
seq: renameSeq,
|
||||
},
|
||||
}),
|
||||
sessionProjectIds: () =>
|
||||
[...useSessionStore.getState().sessions[serverId].projects.keys()].sort(),
|
||||
persistedProjectIds: async () => {
|
||||
await reopened.flush();
|
||||
const restarted = reopen();
|
||||
restarted.setHosts([serverId]);
|
||||
return [...(await restarted.readDirectory(serverId)).projects.keys()].sort();
|
||||
},
|
||||
close: async () => {
|
||||
directory.dispose();
|
||||
await reopened.flush();
|
||||
database.close();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
it("re-syncs every project when a project update lands while an untrusted cache loads", async () => {
|
||||
const damaged = await createDamagedLegacyProjectDirectory("untrusted-checkpoint-race", 6);
|
||||
try {
|
||||
let renamed = false;
|
||||
damaged.holdRead(async () => {
|
||||
if (renamed) return;
|
||||
renamed = true;
|
||||
damaged.renameProjectA();
|
||||
});
|
||||
|
||||
damaged.directory.setDemand({}, true);
|
||||
await damaged.directory.refreshDemand();
|
||||
|
||||
expect(renamed).toBe(true);
|
||||
expect(damaged.client.lastProjectOptions).toEqual({ sync: {} });
|
||||
expect(damaged.sessionProjectIds()).toEqual(["A", "B"]);
|
||||
expect(await damaged.persistedProjectIds()).toEqual(["A", "B"]);
|
||||
} finally {
|
||||
await damaged.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("re-syncs every project when a project update lands after the first sync fails", async () => {
|
||||
const damaged = await createDamagedLegacyProjectDirectory("failed-first-sync", 3);
|
||||
try {
|
||||
damaged.failNextProjectRequest();
|
||||
damaged.directory.setDemand({}, true);
|
||||
await expect(damaged.directory.refreshDemand()).rejects.toThrow("Request timed out");
|
||||
|
||||
damaged.renameProjectA();
|
||||
await damaged.directory.refreshDemand();
|
||||
|
||||
expect(damaged.client.lastProjectOptions).toEqual({ sync: {} });
|
||||
expect(damaged.sessionProjectIds()).toEqual(["A", "B"]);
|
||||
expect(await damaged.persistedProjectIds()).toEqual(["A", "B"]);
|
||||
} finally {
|
||||
await damaged.close();
|
||||
}
|
||||
});
|
||||
|
||||
function createWorkspaceLabelDirectory(serverId: string) {
|
||||
const { client, directory } = createDirectory(serverId, { workspaceLabels: true });
|
||||
const store = useSessionStore.getState();
|
||||
|
||||
@@ -288,7 +288,7 @@ export class DirectorySync {
|
||||
this.revision += 1;
|
||||
if (this.agentTransactions.record(source, delta)) return;
|
||||
this.agents.applyDelta(delta);
|
||||
if (this.extendsRefreshedBaseline(source)) this.noteLiveCursor("agents", delta);
|
||||
this.noteLiveCursor("agents", delta);
|
||||
this.persistCheckpoint();
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ export class DirectorySync {
|
||||
this.workspaceRevision += 1;
|
||||
if (this.workspaceTransactions.record(source, delta)) return;
|
||||
this.applyWorkspaceDelta(delta);
|
||||
if (delta.kind !== "script_status" && this.extendsRefreshedBaseline(source))
|
||||
if (delta.kind !== "script_status")
|
||||
this.noteLiveCursor(
|
||||
"projectId" in delta || "project" in delta ? "projects" : "workspaces",
|
||||
delta,
|
||||
@@ -308,20 +308,6 @@ export class DirectorySync {
|
||||
this.persistCheckpoint();
|
||||
}
|
||||
|
||||
/**
|
||||
* A live event's sequence covers everything before it only when a refresh completed on the
|
||||
* subscriptions that delivered it. Before that (first sync still pending or failed) or after
|
||||
* they lapse, the client may have missed earlier changes, so the event updates rows but leaves
|
||||
* the cursor where the next refresh can still fetch what was missed.
|
||||
*/
|
||||
private extendsRefreshedBaseline(source: DirectorySourceToken): boolean {
|
||||
const refreshed = this.satisfiedDemandSource;
|
||||
return (
|
||||
refreshed?.clientGeneration === source.clientGeneration &&
|
||||
refreshed.connectionEpoch === source.connectionEpoch
|
||||
);
|
||||
}
|
||||
|
||||
private observeDirectoryEvents(): void {
|
||||
if (this.eventSubscription) return;
|
||||
const { client, source } = this.requireOnline();
|
||||
@@ -580,16 +566,24 @@ export class DirectorySync {
|
||||
input: { subscribe?: boolean } | undefined,
|
||||
loadDirectoryCache: boolean,
|
||||
): Promise<void> {
|
||||
if (loadDirectoryCache) {
|
||||
this.primeWorkspaceTransactionForCacheLoad();
|
||||
await this.loadCachedDirectory();
|
||||
}
|
||||
if (loadDirectoryCache) await this.loadCachedDirectory();
|
||||
const onlineConnection = this.getOnlineConnection();
|
||||
if (!onlineConnection) return;
|
||||
const { client, source } = onlineConnection;
|
||||
const transaction = this.workspaceTransactions.begin(source, () =>
|
||||
this.createWorkspaceRefreshSnapshot(),
|
||||
);
|
||||
const transaction = this.workspaceTransactions.begin(source, () => {
|
||||
const baseline = this.workspaces.snapshot();
|
||||
return {
|
||||
workspaces: new Map(baseline.workspaces),
|
||||
projects: new Map(baseline.projects),
|
||||
// Cache hydration can advance the live replica while these requests await responses.
|
||||
// Every page must use the cursors belonging to the maps captured here.
|
||||
requestCursors: { ...this.cursors },
|
||||
syncCursors: {},
|
||||
syncModes: {},
|
||||
touchedWorkspaceIds: new Set(),
|
||||
touchedProjectIds: new Set(),
|
||||
};
|
||||
});
|
||||
try {
|
||||
await this.waitForSessionMetadata(client, source);
|
||||
const serverInfo = useSessionStore.getState().sessions[this.serverId]?.serverInfo;
|
||||
@@ -813,31 +807,6 @@ export class DirectorySync {
|
||||
}));
|
||||
}
|
||||
|
||||
// Updates that arrive before a refresh completes have no trusted baseline to advance from.
|
||||
// Holding them keeps their cursor out of the cache until the refresh they are applied over.
|
||||
private primeWorkspaceTransactionForCacheLoad(): void {
|
||||
const connection = this.getOnlineConnection();
|
||||
if (!connection) return;
|
||||
this.workspaceTransactions.begin(connection.source, () =>
|
||||
this.createWorkspaceRefreshSnapshot(),
|
||||
);
|
||||
}
|
||||
|
||||
private createWorkspaceRefreshSnapshot(): WorkspaceRefreshSnapshot {
|
||||
const baseline = this.workspaces.snapshot();
|
||||
return {
|
||||
workspaces: new Map(baseline.workspaces),
|
||||
projects: new Map(baseline.projects),
|
||||
// Cache hydration can advance the live replica while these requests await responses.
|
||||
// Every page must use the cursors belonging to the maps captured here.
|
||||
requestCursors: { ...this.cursors },
|
||||
syncCursors: {},
|
||||
syncModes: {},
|
||||
touchedWorkspaceIds: new Set(),
|
||||
touchedProjectIds: new Set(),
|
||||
};
|
||||
}
|
||||
|
||||
private supportsDirectorySync(): boolean {
|
||||
return (
|
||||
useSessionStore.getState().sessions[this.serverId]?.serverInfo?.features?.directorySync ===
|
||||
|
||||
@@ -37,9 +37,6 @@ class MemoryStorage implements ReplicaRowStore {
|
||||
onRead: (() => void) | null = null;
|
||||
/** Throws once a read goes past this count, so a non-terminating read loop fails the test. */
|
||||
readLimit: number | null = null;
|
||||
/** Awaited before the store lists every row or deletes a host, so a test can interleave there. */
|
||||
beforeReadAll: (() => Promise<void>) | null = null;
|
||||
beforeDeleteHost: (() => Promise<void>) | null = null;
|
||||
|
||||
private key(row: Pick<ReplicaRow, "serverId" | "kind" | "id">): string {
|
||||
return `${row.serverId}:${row.kind}:${row.id}`;
|
||||
@@ -71,7 +68,6 @@ class MemoryStorage implements ReplicaRowStore {
|
||||
}
|
||||
|
||||
async readAll(): Promise<ReplicaHostRows[]> {
|
||||
await this.beforeReadAll?.();
|
||||
const hosts = new Map<string, ReplicaRow[]>();
|
||||
for (const row of this.rows.values()) {
|
||||
const rows = hosts.get(row.serverId) ?? [];
|
||||
@@ -95,7 +91,6 @@ class MemoryStorage implements ReplicaRowStore {
|
||||
}
|
||||
|
||||
async deleteHost(serverId: string): Promise<void> {
|
||||
await this.beforeDeleteHost?.();
|
||||
for (const [key, row] of this.rows) if (row.serverId === serverId) this.rows.delete(key);
|
||||
}
|
||||
|
||||
@@ -441,49 +436,40 @@ describe("ReplicaCache", () => {
|
||||
await expectLegacyWorkspaceRefresh(cached);
|
||||
});
|
||||
|
||||
it.each([
|
||||
["before the baseline fix", (checkpoint: DirectoryCheckpoint): unknown => checkpoint],
|
||||
[
|
||||
"before the eviction fix",
|
||||
(checkpoint: DirectoryCheckpoint): unknown => ({ version: 1, cursors: checkpoint }),
|
||||
],
|
||||
])(
|
||||
"rejects checkpoints written %s without discarding cached rows or timelines",
|
||||
async (_era, legacyPayload) => {
|
||||
const storage = new MemoryStorage();
|
||||
const writer = createCache(storage);
|
||||
const baseline = directory();
|
||||
writer.replaceDirectoryBaseline(SERVER_ID, baseline);
|
||||
writer.commitTimeline(SERVER_ID, "agent-1", timeline());
|
||||
await writer.flush();
|
||||
await storage.apply({
|
||||
deletes: [],
|
||||
upserts: [
|
||||
{
|
||||
serverId: SERVER_ID,
|
||||
kind: "checkpoint",
|
||||
id: "singleton",
|
||||
payload: JSON.stringify(legacyPayload(baseline.checkpoint)),
|
||||
},
|
||||
],
|
||||
});
|
||||
it("rejects pre-baseline-fix checkpoints without discarding cached rows or timelines", async () => {
|
||||
const storage = new MemoryStorage();
|
||||
const writer = createCache(storage);
|
||||
const baseline = directory();
|
||||
writer.replaceDirectoryBaseline(SERVER_ID, baseline);
|
||||
writer.commitTimeline(SERVER_ID, "agent-1", timeline());
|
||||
await writer.flush();
|
||||
await storage.apply({
|
||||
deletes: [],
|
||||
upserts: [
|
||||
{
|
||||
serverId: SERVER_ID,
|
||||
kind: "checkpoint",
|
||||
id: "singleton",
|
||||
payload: JSON.stringify(baseline.checkpoint),
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const reader = createCache(storage);
|
||||
const restored = await reader.readDirectory(SERVER_ID);
|
||||
expect(restored.checkpoint).toBeUndefined();
|
||||
expect([...restored.workspaces.keys()]).toEqual([...baseline.workspaces.keys()]);
|
||||
expect([...restored.projects.keys()]).toEqual([...baseline.projects.keys()]);
|
||||
expect([...restored.agents.keys()]).toEqual([...baseline.agents.keys()]);
|
||||
expect(await reader.readTimeline(SERVER_ID, "agent-1")).toEqual(timeline());
|
||||
expect(await storage.read(SERVER_ID, ["checkpoint"])).toEqual([]);
|
||||
const reader = createCache(storage);
|
||||
const restored = await reader.readDirectory(SERVER_ID);
|
||||
expect(restored.checkpoint).toBeUndefined();
|
||||
expect([...restored.workspaces.keys()]).toEqual([...baseline.workspaces.keys()]);
|
||||
expect([...restored.projects.keys()]).toEqual([...baseline.projects.keys()]);
|
||||
expect([...restored.agents.keys()]).toEqual([...baseline.agents.keys()]);
|
||||
expect(await reader.readTimeline(SERVER_ID, "agent-1")).toEqual(timeline());
|
||||
expect(await storage.read(SERVER_ID, ["checkpoint"])).toEqual([]);
|
||||
|
||||
reader.replaceDirectoryBaseline(SERVER_ID, baseline);
|
||||
await reader.flush();
|
||||
expect((await createCache(storage).readDirectory(SERVER_ID)).checkpoint).toEqual(
|
||||
baseline.checkpoint,
|
||||
);
|
||||
},
|
||||
);
|
||||
reader.replaceDirectoryBaseline(SERVER_ID, baseline);
|
||||
await reader.flush();
|
||||
expect((await createCache(storage).readDirectory(SERVER_ID)).checkpoint).toEqual(
|
||||
baseline.checkpoint,
|
||||
);
|
||||
});
|
||||
|
||||
it("does nothing until an owner explicitly commits data", async () => {
|
||||
const storage = new MemoryStorage();
|
||||
@@ -1116,113 +1102,6 @@ describe("ReplicaCache", () => {
|
||||
).toEqual(["agent", "checkpoint", "project", "workspace"]);
|
||||
});
|
||||
|
||||
it.each(["beforeReadAll", "beforeDeleteHost"] as const)(
|
||||
"stores no checkpoint for a host evicted after its update was queued (%s)",
|
||||
async (pausePoint) => {
|
||||
const storage = new MemoryStorage();
|
||||
const previousSession = new ReplicaCache(storage, noLegacyCleanup);
|
||||
previousSession.setHosts([SERVER_ID, "other-host"]);
|
||||
previousSession.replaceDirectoryBaseline(SERVER_ID, directory());
|
||||
previousSession.replaceDirectoryBaseline("other-host", directory());
|
||||
await previousSession.flush();
|
||||
|
||||
const cache = new ReplicaCache(storage, { ...noLegacyCleanup, maxBytes: 8_192 });
|
||||
cache.setHosts([SERVER_ID, "other-host"]);
|
||||
const paused = deferred();
|
||||
const resume = deferred();
|
||||
storage[pausePoint] = async () => {
|
||||
storage[pausePoint] = null;
|
||||
paused.resolve();
|
||||
await resume.promise;
|
||||
};
|
||||
// Larger than the whole budget, so this persist evicts both hosts.
|
||||
cache.commitTimeline(SERVER_ID, "agent-1", timeline("x".repeat(16_384)));
|
||||
const eviction = cache.flush();
|
||||
await paused.promise;
|
||||
cache.commitDirectoryMutations(SERVER_ID, [], { agents: { generation: "g", afterSeq: 13 } });
|
||||
resume.resolve();
|
||||
await eviction;
|
||||
await cache.flush();
|
||||
|
||||
const restored = await createCache(storage).readDirectory(SERVER_ID);
|
||||
expect(restored.agents.size).toBe(0);
|
||||
expect(restored.checkpoint).toBeUndefined();
|
||||
},
|
||||
);
|
||||
|
||||
it("stores no checkpoint for a host evicted while a malformed row is repaired", async () => {
|
||||
const { storage } = await cacheWithoutBackgroundVisibility();
|
||||
const reader = createCache(storage, 8_192);
|
||||
storage.onRead = () => {
|
||||
if (!storage.reads.at(-1)?.kinds.includes("checkpoint")) return;
|
||||
storage.onRead = null;
|
||||
// Larger than the whole budget, so this persist evicts the host before the repair writes.
|
||||
reader.commitTimeline(SERVER_ID, "agent-1", timeline("x".repeat(16_384)));
|
||||
void reader.flush();
|
||||
};
|
||||
|
||||
expect(await reader.readWorkspace(SERVER_ID, "workspace-1")).toBeUndefined();
|
||||
await reader.flush();
|
||||
|
||||
const restored = await createCache(storage).readDirectory(SERVER_ID);
|
||||
expect(restored.projects.size).toBe(0);
|
||||
expect(restored.checkpoint).toBeUndefined();
|
||||
});
|
||||
|
||||
it("repairs a malformed row's cursor when the overlapping eviction fails", async () => {
|
||||
const { storage } = await cacheWithoutBackgroundVisibility();
|
||||
const reader = createCache(storage, 8_192);
|
||||
storage.onRead = () => {
|
||||
if (!storage.reads.at(-1)?.kinds.includes("checkpoint")) return;
|
||||
storage.onRead = null;
|
||||
storage.beforeDeleteHost = async () => {
|
||||
storage.beforeDeleteHost = null;
|
||||
throw new Error("Eviction aborted");
|
||||
};
|
||||
reader.commitTimeline(SERVER_ID, "agent-1", timeline("x".repeat(16_384)));
|
||||
void reader.flush();
|
||||
};
|
||||
|
||||
expect(await reader.readWorkspace(SERVER_ID, "workspace-1")).toBeUndefined();
|
||||
// A newer timeline fits the budget, so no later eviction clears the checkpoint.
|
||||
reader.commitTimeline(SERVER_ID, "agent-1", timeline());
|
||||
await reader.flush();
|
||||
|
||||
const restored = await createCache(storage).readDirectory(SERVER_ID);
|
||||
expect(restored.workspaces.size).toBe(0);
|
||||
expect(restored.checkpoint).toEqual({
|
||||
agents: { generation: "g", afterSeq: 12 },
|
||||
projects: { generation: "g", afterSeq: 4 },
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps an update queued behind the baseline that rebuilds an evicted host", async () => {
|
||||
const storage = new MemoryStorage();
|
||||
const cache = new ReplicaCache(storage, { ...noLegacyCleanup, maxBytes: 2_500 });
|
||||
cache.setHosts([SERVER_ID, "other-host"]);
|
||||
const baseline = directory();
|
||||
cache.replaceDirectoryBaseline(SERVER_ID, baseline);
|
||||
await cache.flush();
|
||||
cache.replaceDirectoryBaseline("other-host", baseline);
|
||||
await cache.flush();
|
||||
expect((await cache.readDirectory(SERVER_ID)).agents.size).toBe(0);
|
||||
|
||||
const renamed = { ...agent(), title: "Renamed agent" };
|
||||
cache.replaceDirectoryBaseline(SERVER_ID, baseline);
|
||||
cache.commitDirectoryMutations(
|
||||
SERVER_ID,
|
||||
[{ kind: "agent", type: "upsert", id: renamed.id, value: renamed }],
|
||||
{ agents: { generation: "g", afterSeq: 13 } },
|
||||
);
|
||||
await cache.flush();
|
||||
cache.commitDirectoryMutations(SERVER_ID, [], { agents: { generation: "g", afterSeq: 14 } });
|
||||
await cache.flush();
|
||||
|
||||
const restored = await createCache(storage).readDirectory(SERVER_ID);
|
||||
expect(restored.checkpoint).toEqual({ agents: { generation: "g", afterSeq: 14 } });
|
||||
expect(restored.agents.get(renamed.id)?.title).toBe("Renamed agent");
|
||||
});
|
||||
|
||||
it("runs legacy cleanup once when storage is first used", async () => {
|
||||
const storage = new MemoryStorage();
|
||||
const cache = new ReplicaCache(storage, {
|
||||
|
||||
@@ -397,19 +397,15 @@ const DirectoryCheckpointSchema = z.strictObject({
|
||||
agents: DirectoryCursorSchema.optional(),
|
||||
});
|
||||
|
||||
// A checkpoint is trusted only when this version wrote it. Earlier writers could store one for a
|
||||
// directory the cache no longer held: unversioned ones after an overlapping refresh, version 1
|
||||
// after an eviction. Rejecting them revalidates directory contents once without evicting cached
|
||||
// rows or timelines.
|
||||
const DIRECTORY_CHECKPOINT_VERSION = 2;
|
||||
|
||||
// Old checkpoints could describe a baseline that an overlapping refresh had discarded.
|
||||
// Revalidate directory contents once without evicting cached rows or timelines.
|
||||
const StoredDirectoryCheckpointSchema = z.strictObject({
|
||||
version: z.literal(DIRECTORY_CHECKPOINT_VERSION),
|
||||
version: z.literal(1),
|
||||
cursors: DirectoryCheckpointSchema,
|
||||
});
|
||||
|
||||
function serializeDirectoryCheckpoint(cursors: DirectoryCheckpoint) {
|
||||
return { version: DIRECTORY_CHECKPOINT_VERSION, cursors };
|
||||
return { version: 1 as const, cursors };
|
||||
}
|
||||
|
||||
function deserializeDirectoryCheckpoint(payload: string): DirectoryCheckpoint {
|
||||
@@ -972,7 +968,6 @@ export class ReplicaCache {
|
||||
private pendingUpserts = new Map<string, StructuredReplicaUpsert>();
|
||||
private pendingDeletes = new Map<string, ReplicaRowKey>();
|
||||
private pendingBaselines = new Set<string>();
|
||||
// Hosts whose stored directory was evicted. Only a baseline stores their directory again.
|
||||
private readonly invalidatedHosts = new Set<string>();
|
||||
private readonly maxBytes: number;
|
||||
private totalBytes = 0;
|
||||
@@ -1114,7 +1109,11 @@ export class ReplicaCache {
|
||||
private async deleteInvalidRow(row: ReplicaRow): Promise<void> {
|
||||
const invalidEntity = directoryEntityForRow(row);
|
||||
if (!invalidEntity) {
|
||||
await this.applyRepair(row.serverId, { upserts: [], deletes: [row] });
|
||||
const changes = { upserts: [], deletes: [row] } satisfies ReplicaRowChanges;
|
||||
await this.queueOperation(async () => {
|
||||
await this.rowStore.apply(changes);
|
||||
this.applyStoredChanges(changes);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1145,7 +1144,10 @@ export class ReplicaCache {
|
||||
]
|
||||
: [],
|
||||
};
|
||||
await this.applyRepair(row.serverId, changes);
|
||||
await this.queueOperation(async () => {
|
||||
await this.rowStore.apply(changes);
|
||||
this.applyStoredChanges(changes);
|
||||
});
|
||||
}
|
||||
|
||||
private async repairInvalidDirectoryRows(
|
||||
@@ -1168,16 +1170,9 @@ export class ReplicaCache {
|
||||
]
|
||||
: [],
|
||||
};
|
||||
await this.applyRepair(serverId, changes);
|
||||
}
|
||||
|
||||
// A repair is queued behind writes that can evict its host. If one did, the host has no
|
||||
// directory left for the repaired checkpoint to describe, so only the deletes still apply.
|
||||
private applyRepair(serverId: string, changes: ReplicaRowChanges): Promise<void> {
|
||||
return this.queueOperation(async () => {
|
||||
const applied = this.invalidatedHosts.has(serverId) ? { ...changes, upserts: [] } : changes;
|
||||
await this.rowStore.apply(applied);
|
||||
this.applyStoredChanges(applied);
|
||||
await this.queueOperation(async () => {
|
||||
await this.rowStore.apply(changes);
|
||||
this.applyStoredChanges(changes);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1187,6 +1182,7 @@ export class ReplicaCache {
|
||||
checkpoint?: DirectoryCheckpoint,
|
||||
): void {
|
||||
if (!this.activeServerIds.has(serverId)) return;
|
||||
if (this.invalidatedHosts.has(serverId)) return;
|
||||
for (const mutation of mutations) {
|
||||
if (mutation.type === "delete") {
|
||||
this.queueEntityDelete(serverId, mutation.kind, mutation.id);
|
||||
@@ -1416,17 +1412,9 @@ export class ReplicaCache {
|
||||
}
|
||||
|
||||
private materializePendingChanges(pending: PendingReplicaChanges): ReplicaRowChanges {
|
||||
// Decided here, inside the serialized write, because eviction happens there too. A mutation
|
||||
// queued before its host was evicted would otherwise store a checkpoint without its directory.
|
||||
const isStorable = (row: ReplicaRowKey): boolean =>
|
||||
row.kind === "timeline" ||
|
||||
!this.invalidatedHosts.has(row.serverId) ||
|
||||
pending.baselines.has(row.serverId);
|
||||
const deletes = new Map(
|
||||
pending.deletes.filter(isStorable).map((row) => [pendingRowKey(row), row]),
|
||||
);
|
||||
const deletes = new Map(pending.deletes.map((row) => [pendingRowKey(row), row]));
|
||||
const upserts: ReplicaRow[] = [];
|
||||
for (const upsert of pending.upserts.filter(isStorable)) {
|
||||
for (const upsert of pending.upserts) {
|
||||
const row = this.materializeUpsert(upsert);
|
||||
if (row) upserts.push(row);
|
||||
else deletes.set(pendingRowKey(upsert), upsert);
|
||||
@@ -1575,10 +1563,8 @@ export class ReplicaCache {
|
||||
projectedTotal -= bytes;
|
||||
projectedBytes.delete(serverId);
|
||||
evicted.add(serverId);
|
||||
if (this.storedRows.has(serverId)) await this.rowStore.deleteHost(serverId);
|
||||
// Only after the delete commits: a failed eviction leaves the rows stored, and writers that
|
||||
// check this set must keep their checkpoint in step with those rows.
|
||||
this.invalidatedHosts.add(serverId);
|
||||
if (this.storedRows.has(serverId)) await this.rowStore.deleteHost(serverId);
|
||||
this.removeStoredHost(serverId);
|
||||
}
|
||||
|
||||
|
||||
@@ -1053,19 +1053,12 @@ export class TerminalEmulatorRuntime {
|
||||
if (!terminal) {
|
||||
return;
|
||||
}
|
||||
terminal.textarea?.removeAttribute("virtualkeyboardpolicy");
|
||||
if (input?.forceRefocus) {
|
||||
terminal.blur();
|
||||
}
|
||||
terminal.focus();
|
||||
}
|
||||
|
||||
suppressAutomaticKeyboard(): void {
|
||||
// Android Chrome can reopen the keyboard during a drag after Back leaves the input
|
||||
// focused. Manual policy prevents that without closing an already open keyboard.
|
||||
this.terminal?.textarea?.setAttribute("virtualkeyboardpolicy", "manual");
|
||||
}
|
||||
|
||||
blur(): void {
|
||||
this.terminal?.blur();
|
||||
}
|
||||
|
||||
@@ -92,14 +92,13 @@ test("visible catch-up settles before hidden open chats start fetching", async (
|
||||
world.sync.dispose();
|
||||
});
|
||||
|
||||
test("a failed visible catch-up with a parked gap releases hidden chats without retrying", async () => {
|
||||
test("a failed visible catch-up releases hidden chats without bypassing its error", async () => {
|
||||
const world = new TimelineWorld();
|
||||
world.openedEarlier(["a-hidden"]);
|
||||
world.sync.replaceVisibleAgentIds("pane", ["z-visible"]);
|
||||
world.sync.setConnected(true);
|
||||
(await world.nextMembership()).succeed();
|
||||
const visible = await world.nextFetch("z-visible");
|
||||
world.sync.recoverGap("z-visible", { epoch: "epoch-z-visible", endSeq: 1 });
|
||||
world.expectNoPendingFetch();
|
||||
visible.fail("temporarily unavailable");
|
||||
const hidden = await world.nextFetch("a-hidden");
|
||||
@@ -128,63 +127,6 @@ test("switching chats promotes the newly visible catch-up while another visible
|
||||
world.sync.dispose();
|
||||
});
|
||||
|
||||
test("reconnect drains hidden chats two at a time after the visible chat settles", async () => {
|
||||
const world = new TimelineWorld();
|
||||
const hidden = Array.from({ length: 15 }, (_, index) => `hidden-${10 + index}`);
|
||||
world.openedEarlier(hidden);
|
||||
world.show("pane", ["visible"]);
|
||||
world.sync.setConnected(true);
|
||||
(await world.nextMembership()).succeed();
|
||||
const beforeDisconnect = await world.nextFetch("visible");
|
||||
world.sync.setConnected(false);
|
||||
beforeDisconnect.respond({ hasNewer: false });
|
||||
world.sync.setConnected(true);
|
||||
(await world.nextMembership()).succeed();
|
||||
const visible = await world.nextFetch("visible");
|
||||
world.expectNoPendingFetch();
|
||||
visible.respond({ hasNewer: false });
|
||||
const first = await world.nextFetch(hidden[0]);
|
||||
let current = await world.nextFetch(hidden[1]);
|
||||
world.expectNoPendingFetch();
|
||||
|
||||
first.fail("timeline request timed out");
|
||||
for (const agentId of hidden.slice(2)) {
|
||||
const next = await world.nextFetch(agentId);
|
||||
world.expectNoPendingFetch();
|
||||
current.respond({ hasNewer: false });
|
||||
current = next;
|
||||
}
|
||||
current.respond({ hasNewer: false });
|
||||
await vi.waitFor(() => {
|
||||
expect(world.sync.getAgentTimelineStatus(hidden[0])).toBe("error");
|
||||
for (const agentId of hidden.slice(1)) {
|
||||
expect(world.sync.getAgentTimelineStatus(agentId)).toBe("ready");
|
||||
}
|
||||
});
|
||||
world.expectNoPendingFetch();
|
||||
world.sync.dispose();
|
||||
});
|
||||
|
||||
test("focusing a queued chat starts it while both hidden catch-ups are running", async () => {
|
||||
const world = new TimelineWorld();
|
||||
world.openedEarlier(["hidden-a", "hidden-b", "next-visible"]);
|
||||
world.show("pane", ["visible"]);
|
||||
world.sync.setConnected(true);
|
||||
(await world.nextMembership()).succeed();
|
||||
(await world.nextFetch("visible")).respond({ hasNewer: false });
|
||||
const first = await world.nextFetch("hidden-a");
|
||||
const second = await world.nextFetch("hidden-b");
|
||||
world.expectNoPendingFetch();
|
||||
|
||||
world.show("pane", ["next-visible"]);
|
||||
expect(world.pendingFetchCount).toBe(1);
|
||||
(await world.nextFetch("next-visible")).respond({ hasNewer: false });
|
||||
await vi.waitFor(() => expect(world.sync.getAgentTimelineStatus("next-visible")).toBe("ready"));
|
||||
first.respond({ hasNewer: false });
|
||||
second.respond({ hasNewer: false });
|
||||
world.sync.dispose();
|
||||
});
|
||||
|
||||
class TimelineWorld {
|
||||
constructor(
|
||||
private readonly observeMembership?: ViewedTimelineSyncPorts["observe"],
|
||||
@@ -499,7 +441,7 @@ test("a gap absorbed by a running tail is recovered after the tail completes", a
|
||||
await vi.waitFor(() => expect(world.sync.getAgentTimelineStatus("agent-a")).toBe("ready"));
|
||||
});
|
||||
|
||||
test("a parked gap pages forward from the coverage established by the running tail", async () => {
|
||||
test("a gap parked behind a running tail resumes after the rows that tail applied", async () => {
|
||||
const world = new TimelineWorld();
|
||||
world.sync.setConnected(true);
|
||||
world.sync.replaceVisibleAgentIds("workspace", ["agent-a"]);
|
||||
@@ -518,13 +460,7 @@ test("a parked gap pages forward from the coverage established by the running ta
|
||||
projection: "projected",
|
||||
wholeTurns: true,
|
||||
});
|
||||
recovery.respond({ hasNewer: true, seq: 47 });
|
||||
const followUp = await world.nextFetch("agent-a");
|
||||
expect(followUp.request).toMatchObject({
|
||||
direction: "after",
|
||||
cursor: { epoch: "epoch-agent-a", seq: 47 },
|
||||
});
|
||||
followUp.respond({ hasNewer: false, seq: 55 });
|
||||
recovery.respond({ hasNewer: false, seq: 7 });
|
||||
await vi.waitFor(() => expect(world.sync.getAgentTimelineStatus("agent-a")).toBe("ready"));
|
||||
world.sync.dispose();
|
||||
});
|
||||
@@ -1005,51 +941,14 @@ test("redeclaring unchanged visibility does not bypass catch-up error", async ()
|
||||
await world.nextError();
|
||||
|
||||
world.sync.replaceVisibleAgentIds("workspace", ["agent-a"]);
|
||||
world.sync.setActive(false);
|
||||
world.sync.setActive(true);
|
||||
|
||||
world.expectNoPendingMembership();
|
||||
world.expectNoPendingFetch();
|
||||
expect(world.sync.getAgentTimelineStatus("agent-a")).toBe("error");
|
||||
});
|
||||
|
||||
test.each(["refocusing", "foregrounding"])(
|
||||
"%s retries a timed-out visible timeline once",
|
||||
async (trigger) => {
|
||||
const world = new TimelineWorld();
|
||||
world.show("pane", ["agent-a"]);
|
||||
world.sync.setConnected(true);
|
||||
(await world.nextMembership()).succeed();
|
||||
(await world.nextFetch("agent-a")).fail("timeline request timed out");
|
||||
await world.nextError();
|
||||
expect(world.sync.getAgentTimelineStatus("agent-a")).toBe("error");
|
||||
|
||||
const revisit = () => {
|
||||
if (trigger === "refocusing") {
|
||||
world.show("pane", []);
|
||||
world.show("pane", ["agent-a"]);
|
||||
} else {
|
||||
world.sync.setActive(false);
|
||||
world.sync.setActive(true);
|
||||
}
|
||||
};
|
||||
revisit();
|
||||
expect(world.pendingFetchCount).toBe(1);
|
||||
expect(world.sync.getAgentTimelineStatus("agent-a")).toBe("pending");
|
||||
(await world.nextFetch("agent-a")).fail("timeline request timed out again");
|
||||
await vi.waitFor(() => expect(world.errors).toHaveLength(2));
|
||||
expect(world.sync.getAgentTimelineStatus("agent-a")).toBe("error");
|
||||
world.show("pane", ["agent-a"]);
|
||||
world.sync.setActive(true);
|
||||
world.expectNoPendingFetch();
|
||||
|
||||
revisit();
|
||||
(await world.nextFetch("agent-a")).respond({ hasNewer: false });
|
||||
await vi.waitFor(() => expect(world.sync.getAgentTimelineStatus("agent-a")).toBe("ready"));
|
||||
expect(world.sync.getAgentTimelineError("agent-a")).toBeNull();
|
||||
world.expectNoPendingMembership();
|
||||
world.sync.dispose();
|
||||
},
|
||||
);
|
||||
|
||||
test("a manual retry that fails returns to the error state", async () => {
|
||||
const world = new TimelineWorld();
|
||||
world.sync.setConnected(true);
|
||||
@@ -1069,37 +968,6 @@ test("a manual retry that fails returns to the error state", async () => {
|
||||
await vi.waitFor(() => expect(world.sync.getAgentTimelineStatus("agent-a")).toBe("error"));
|
||||
});
|
||||
|
||||
test("refocusing during a membership update retries a reconnect without replaying the backlog", async () => {
|
||||
const world = freshnessWorld();
|
||||
world.cursors.set("agent-a", { epoch: "epoch-agent-a", endSeq: 42 });
|
||||
world.show("pane", ["agent-a"]);
|
||||
world.sync.setConnected(true);
|
||||
(await world.nextMembership()).succeed({ "agent-a": "current" });
|
||||
await vi.waitFor(() => expect(world.sync.getAgentTimelineStatus("agent-a")).toBe("ready"));
|
||||
|
||||
world.sync.setConnected(false);
|
||||
world.sync.setConnected(true);
|
||||
(await world.nextMembership()).succeed({ "agent-a": "behind" });
|
||||
const failed = await world.nextFetch("agent-a");
|
||||
expect(failed.request.direction).toBe("after");
|
||||
failed.fail("timeline request timed out");
|
||||
await world.nextError();
|
||||
|
||||
world.show("pane", ["agent-b"]);
|
||||
const membership = await world.nextMembership();
|
||||
world.show("pane", ["agent-a"]);
|
||||
expect(world.pendingFetchCount).toBe(1);
|
||||
const retry = await world.nextFetch("agent-a");
|
||||
expect(retry.request).toEqual(failed.request);
|
||||
membership.succeed();
|
||||
retry.respond({ hasNewer: true, seq: 82 });
|
||||
const tail = await world.nextFetch("agent-a");
|
||||
expect(tail.request.direction).toBe("tail");
|
||||
tail.respond({ hasNewer: false });
|
||||
await vi.waitFor(() => expect(world.sync.getAgentTimelineStatus("agent-a")).toBe("ready"));
|
||||
world.sync.dispose();
|
||||
});
|
||||
|
||||
test("gap recovery supersedes completed catch-up and pages through the current tail", async () => {
|
||||
const world = new TimelineWorld();
|
||||
world.sync.setConnected(true);
|
||||
|
||||
@@ -545,27 +545,12 @@ export function createViewedTimelineOwner(input: {
|
||||
};
|
||||
}
|
||||
|
||||
const MAX_HIDDEN_CATCH_UPS = 2;
|
||||
|
||||
type CatchUpStatus = "running" | "complete" | "error";
|
||||
|
||||
interface CatchUpRequest {
|
||||
page: ProjectedTimelineForwardFetchPlan;
|
||||
kind: "resume" | "gap";
|
||||
}
|
||||
|
||||
interface CatchUpState {
|
||||
generation: number;
|
||||
status: CatchUpStatus;
|
||||
request?: CatchUpRequest;
|
||||
}
|
||||
|
||||
function planCatchUpRequest(
|
||||
request: CatchUpRequest | undefined,
|
||||
applied: { epoch: string; endSeq: number } | undefined,
|
||||
): CatchUpRequest {
|
||||
if (!request) return { page: planTimelineResumeFetch(applied), kind: "resume" };
|
||||
return { ...request, page: planTimelineCatchUpPastApplied(request.page, applied) };
|
||||
request?: ProjectedTimelineForwardFetchPlan;
|
||||
}
|
||||
|
||||
function isSameCatchUpRequest(
|
||||
@@ -588,11 +573,11 @@ function decideCatchUp(input: {
|
||||
if (input.supersede) {
|
||||
if (
|
||||
input.current.status === "running" &&
|
||||
isSameCatchUpRequest(input.current.request?.page, input.request)
|
||||
isSameCatchUpRequest(input.current.request, input.request)
|
||||
) {
|
||||
return "keep";
|
||||
}
|
||||
if (input.current.status === "running" && input.current.request?.page.direction === "tail") {
|
||||
if (input.current.status === "running" && input.current.request?.direction === "tail") {
|
||||
return "keep-and-park";
|
||||
}
|
||||
return "replace";
|
||||
@@ -612,11 +597,9 @@ export function createViewedTimelineSync(ports: ViewedTimelineSyncPorts): Viewed
|
||||
const sources = new Map<string, string[]>();
|
||||
const catchUps = new Map<string, CatchUpState>();
|
||||
const catchUpGenerations = new Map<string, number>();
|
||||
// Fetches can outlive their catch-up generation when superseded or when a tab closes.
|
||||
const inFlightCatchUps = new Set<{ agentId: string }>();
|
||||
// Authoritative fetch owed but not runnable yet: disconnected, unacknowledged, or queued.
|
||||
// Authoritative fetch owed but not runnable yet: disconnected, unacknowledged, or parked.
|
||||
// Membership acknowledgement and catch-up completion drain parked requests.
|
||||
const pendingCatchUps = new Map<string, CatchUpRequest>();
|
||||
const pendingCatchUps = new Map<string, ProjectedTimelineForwardFetchPlan>();
|
||||
const visibilityCatchUpPending = new Set<string>();
|
||||
const visibilityCatchUpErrors = new Map<string, string>();
|
||||
// A user-initiated retry owes a pending state until it settles.
|
||||
@@ -740,16 +723,16 @@ export function createViewedTimelineSync(ports: ViewedTimelineSyncPorts): Viewed
|
||||
const fetchUntilCurrent = async (
|
||||
agentId: string,
|
||||
generation: number,
|
||||
request: CatchUpRequest,
|
||||
request: ProjectedTimelineForwardFetchPlan,
|
||||
fallbackToLatestTailOnOverflow: boolean,
|
||||
): Promise<void> => {
|
||||
if (!ownsCatchUp(agentId, generation)) return;
|
||||
|
||||
try {
|
||||
const page = await ports.fetchPage(agentId, request.page);
|
||||
const page = await ports.fetchPage(agentId, request);
|
||||
if (!ownsCatchUp(agentId, generation)) return;
|
||||
if (page.hasNewer && page.endCursor) {
|
||||
if (request.page.direction === "after" && fallbackToLatestTailOnOverflow) {
|
||||
if (fallbackToLatestTailOnOverflow) {
|
||||
await ports.fetchLatestTail(agentId);
|
||||
if (!ownsCatchUp(agentId, generation)) return;
|
||||
catchUps.set(agentId, { generation, status: "complete" });
|
||||
@@ -759,13 +742,10 @@ export function createViewedTimelineSync(ports: ViewedTimelineSyncPorts): Viewed
|
||||
await fetchUntilCurrent(
|
||||
agentId,
|
||||
generation,
|
||||
{
|
||||
...request,
|
||||
page: planTimelineCatchUpPastApplied(
|
||||
planTimelineCatchUpAfter(page.endCursor),
|
||||
ports.readCursor(agentId),
|
||||
),
|
||||
},
|
||||
planTimelineCatchUpPastApplied(
|
||||
planTimelineCatchUpAfter(page.endCursor),
|
||||
ports.readCursor(agentId),
|
||||
),
|
||||
false,
|
||||
);
|
||||
return;
|
||||
@@ -774,15 +754,20 @@ export function createViewedTimelineSync(ports: ViewedTimelineSyncPorts): Viewed
|
||||
throw new Error(`Timeline page for ${agentId} hasNewer without an end cursor`);
|
||||
}
|
||||
catchUps.set(agentId, { generation, status: "complete" });
|
||||
if (!pendingCatchUps.has(agentId)) setVisibilityCatchUpReady(agentId);
|
||||
const pendingCatchUp = pendingCatchUps.get(agentId);
|
||||
if (pendingCatchUp) {
|
||||
startCatchUp(agentId, { request: pendingCatchUp, supersede: true });
|
||||
return;
|
||||
}
|
||||
setVisibilityCatchUpReady(agentId);
|
||||
} catch (error) {
|
||||
if (catchUps.get(agentId)?.generation === generation) {
|
||||
// The parked follow-up belongs to the failed attempt. A retry owns the next request.
|
||||
pendingCatchUps.delete(agentId);
|
||||
catchUps.set(agentId, { generation, status: "error", request });
|
||||
setVisibilityCatchUpError([agentId], error);
|
||||
ports.reportError(error);
|
||||
}
|
||||
} finally {
|
||||
startAcknowledgedCatchUps();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -813,29 +798,23 @@ export function createViewedTimelineSync(ports: ViewedTimelineSyncPorts): Viewed
|
||||
);
|
||||
};
|
||||
|
||||
const hiddenCatchUpSlotsAreFull = (agentId: string) => {
|
||||
const visible = new Set(visibleAgentIds());
|
||||
if (visible.has(agentId)) return false;
|
||||
let hidden = 0;
|
||||
for (const attempt of inFlightCatchUps) {
|
||||
if (!visible.has(attempt.agentId)) hidden += 1;
|
||||
}
|
||||
return hidden >= MAX_HIDDEN_CATCH_UPS;
|
||||
};
|
||||
|
||||
const startCatchUp = (
|
||||
agentId: string,
|
||||
options: {
|
||||
request?: CatchUpRequest;
|
||||
request?: ProjectedTimelineForwardFetchPlan;
|
||||
supersede?: boolean;
|
||||
} = {},
|
||||
) => {
|
||||
const { request, supersede = false } = options;
|
||||
if (
|
||||
freshnessChecks.has(agentId) ||
|
||||
!canCatchUp(agentId) ||
|
||||
shouldWaitForVisibleCatchUp(agentId)
|
||||
) {
|
||||
if (freshnessChecks.has(agentId)) {
|
||||
if (request) pendingCatchUps.set(agentId, request);
|
||||
return;
|
||||
}
|
||||
if (!canCatchUp(agentId)) {
|
||||
if (request) pendingCatchUps.set(agentId, request);
|
||||
return;
|
||||
}
|
||||
if (shouldWaitForVisibleCatchUp(agentId)) {
|
||||
if (request) pendingCatchUps.set(agentId, request);
|
||||
return;
|
||||
}
|
||||
@@ -845,9 +824,11 @@ export function createViewedTimelineSync(ports: ViewedTimelineSyncPorts): Viewed
|
||||
return;
|
||||
}
|
||||
const applied = ports.readCursor(agentId);
|
||||
const nextRequest = planCatchUpRequest(request, applied);
|
||||
const nextRequest = request
|
||||
? planTimelineCatchUpPastApplied(request, applied)
|
||||
: planTimelineResumeFetch(applied);
|
||||
const current = catchUps.get(agentId);
|
||||
const decision = decideCatchUp({ current, request: nextRequest.page, supersede });
|
||||
const decision = decideCatchUp({ current, request: nextRequest, supersede });
|
||||
if (decision === "keep-and-park") {
|
||||
pendingCatchUps.set(agentId, nextRequest);
|
||||
return;
|
||||
@@ -855,31 +836,18 @@ export function createViewedTimelineSync(ports: ViewedTimelineSyncPorts): Viewed
|
||||
if (decision === "keep") {
|
||||
return;
|
||||
}
|
||||
if (hiddenCatchUpSlotsAreFull(agentId)) {
|
||||
if (request) pendingCatchUps.set(agentId, request);
|
||||
return;
|
||||
}
|
||||
const generation = (catchUpGenerations.get(agentId) ?? 0) + 1;
|
||||
catchUpGenerations.set(agentId, generation);
|
||||
catchUps.set(agentId, { generation, status: "running", request: nextRequest });
|
||||
pendingCatchUps.delete(agentId);
|
||||
const attempt = { agentId };
|
||||
inFlightCatchUps.add(attempt);
|
||||
if (current?.status === "error" && !manualRetries.has(agentId)) {
|
||||
visibilityCatchUpErrors.delete(agentId);
|
||||
markCatchUpOwed(agentId);
|
||||
notifyListeners();
|
||||
}
|
||||
// A queued gap uses the coverage available when its fetch starts.
|
||||
// A gap recovery pages forward to keep the coverage it extends. Without coverage there is
|
||||
// nothing to keep, so an overflowing page falls back to the latest tail, as a resume does.
|
||||
void fetchUntilCurrent(
|
||||
agentId,
|
||||
generation,
|
||||
nextRequest,
|
||||
nextRequest.kind === "resume" || !applied,
|
||||
).finally(() => {
|
||||
inFlightCatchUps.delete(attempt);
|
||||
startAcknowledgedCatchUps();
|
||||
});
|
||||
nextRequest.direction === "after" && (request === undefined || applied === undefined),
|
||||
);
|
||||
};
|
||||
|
||||
const startAcknowledgedCatchUps = () => {
|
||||
@@ -891,8 +859,9 @@ export function createViewedTimelineSync(ports: ViewedTimelineSyncPorts): Viewed
|
||||
for (const agentId of ordered) {
|
||||
const pendingCatchUp = pendingCatchUps.get(agentId);
|
||||
const current = catchUps.get(agentId);
|
||||
// A running tail owns its parked gap. A failed catch-up can only have a queued retry.
|
||||
if (current?.status === "running" || (current && !pendingCatchUp)) continue;
|
||||
// Completion of a different chat must not bypass a failed chat's error or
|
||||
// supersede an in-flight tail that owns its parked gap recovery.
|
||||
if (current && !(current.status === "complete" && pendingCatchUp)) continue;
|
||||
startCatchUp(agentId, {
|
||||
request: pendingCatchUp,
|
||||
supersede: Boolean(pendingCatchUp),
|
||||
@@ -900,13 +869,6 @@ export function createViewedTimelineSync(ports: ViewedTimelineSyncPorts): Viewed
|
||||
}
|
||||
};
|
||||
|
||||
const retryFailedCatchUp = (agentId: string) => {
|
||||
const catchUp = catchUps.get(agentId);
|
||||
if (catchUp?.status === "error") {
|
||||
startCatchUp(agentId, { request: catchUp.request, supersede: true });
|
||||
}
|
||||
};
|
||||
|
||||
const membershipIsSettled = (requested: string[]) =>
|
||||
!membershipNeedsRetry &&
|
||||
!freshnessCheckOwed &&
|
||||
@@ -1013,7 +975,9 @@ export function createViewedTimelineSync(ports: ViewedTimelineSyncPorts): Viewed
|
||||
void reconcileMembership();
|
||||
return;
|
||||
}
|
||||
retryFailedCatchUp(agentId);
|
||||
if (catchUp?.status === "error") {
|
||||
startCatchUp(agentId, { request: catchUp.request, supersede: true });
|
||||
}
|
||||
};
|
||||
|
||||
const commitDesiredMembership = (
|
||||
@@ -1104,17 +1068,11 @@ export function createViewedTimelineSync(ports: ViewedTimelineSyncPorts): Viewed
|
||||
publishVisibleMembership();
|
||||
},
|
||||
replaceVisibleAgentIds(sourceId, agentIds) {
|
||||
const previouslyVisible = new Set(visibleAgentIds());
|
||||
const normalized = normalizeAgentIds(agentIds);
|
||||
if (normalized.length === 0) sources.delete(sourceId);
|
||||
else sources.set(sourceId, normalized);
|
||||
rememberOpenedAgentIds(normalized);
|
||||
publishVisibleMembership();
|
||||
if (active) {
|
||||
for (const agentId of normalized) {
|
||||
if (!previouslyVisible.has(agentId)) retryFailedCatchUp(agentId);
|
||||
}
|
||||
}
|
||||
startAcknowledgedCatchUps();
|
||||
},
|
||||
setActive(nextActive) {
|
||||
@@ -1127,10 +1085,7 @@ export function createViewedTimelineSync(ports: ViewedTimelineSyncPorts): Viewed
|
||||
}
|
||||
const canCheck = connected && ports.canCheckFreshness();
|
||||
for (const agentId of visibleAgentIds()) {
|
||||
if (visibilityCatchUpErrors.has(agentId)) {
|
||||
retryFailedCatchUp(agentId);
|
||||
continue;
|
||||
}
|
||||
if (visibilityCatchUpErrors.has(agentId)) continue;
|
||||
markCatchUpOwed(agentId);
|
||||
if (
|
||||
canCheck &&
|
||||
@@ -1177,10 +1132,7 @@ export function createViewedTimelineSync(ports: ViewedTimelineSyncPorts): Viewed
|
||||
recoverGap(agentId, cursor) {
|
||||
if (!isDesired(agentId) || catchUps.get(agentId)?.status === "error") return;
|
||||
startCatchUp(agentId, {
|
||||
request: {
|
||||
page: planTimelineCatchUpAfter({ epoch: cursor.epoch, seq: cursor.endSeq }),
|
||||
kind: "gap",
|
||||
},
|
||||
request: planTimelineCatchUpAfter({ epoch: cursor.epoch, seq: cursor.endSeq }),
|
||||
supersede: true,
|
||||
});
|
||||
},
|
||||
|
||||
@@ -32,7 +32,6 @@ it("translates mounted usage rows when the language changes", async () => {
|
||||
<>
|
||||
<UsageWindowBar
|
||||
window={window}
|
||||
forecastAt={null}
|
||||
displayAs="used"
|
||||
pinnable={false}
|
||||
pinned={false}
|
||||
@@ -52,44 +51,3 @@ it("translates mounted usage rows when the language changes", async () => {
|
||||
expect(container.textContent).toContain("セッション70% 使用済み");
|
||||
expect(container.textContent).toContain("クレジット");
|
||||
});
|
||||
|
||||
const narrowReadingMs = Date.now();
|
||||
const narrowForecastAt = new Date(narrowReadingMs).toISOString();
|
||||
const narrowWindow: UsageWindow = {
|
||||
id: "weekly",
|
||||
label: "Weekly",
|
||||
usedPct: 0.2,
|
||||
durationSeconds: 604_800,
|
||||
resetsAt: new Date(narrowReadingMs + 165.5 * 3_600_000).toISOString(),
|
||||
};
|
||||
|
||||
it("keeps the French reset countdown and forecast apart in a narrow card", async () => {
|
||||
await i18n.changeLanguage("fr");
|
||||
container.style.width = "272px";
|
||||
act(() =>
|
||||
root.render(
|
||||
<UsageWindowBar
|
||||
window={narrowWindow}
|
||||
forecastAt={narrowForecastAt}
|
||||
displayAs="used"
|
||||
pinnable={false}
|
||||
pinned={false}
|
||||
onTogglePin={ignorePin}
|
||||
pinLabel=""
|
||||
pinTestID=""
|
||||
/>,
|
||||
),
|
||||
);
|
||||
|
||||
function textBounds(prefix: string) {
|
||||
const element = Array.from(container.querySelectorAll("*")).find(
|
||||
(node) => node.childElementCount === 0 && node.textContent.startsWith(prefix),
|
||||
);
|
||||
expect(element).toBeDefined();
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(element!);
|
||||
return range.getBoundingClientRect();
|
||||
}
|
||||
|
||||
expect(textBounds("se réinitialise").right).toBeLessThan(textBounds("~").left);
|
||||
});
|
||||
|
||||
@@ -70,7 +70,7 @@ export function UsageCard({
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const isCompact = useIsCompactFormFactor();
|
||||
const { refresh, refreshState } = useReportRefresh(serverId, entry, agentId);
|
||||
const { refresh, refreshState } = useReportRefresh(serverId, entry.id, agentId);
|
||||
// Where there is no hover the freshness is printed on the card; elsewhere the Refresh tooltip.
|
||||
const showsFreshnessInline = isNative || isCompact || !refreshable;
|
||||
const usage = entry.report;
|
||||
@@ -176,7 +176,7 @@ function UsageCardBody({
|
||||
refreshState: UsageRefresh;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const { windows, balances, details, retained, successfulAt, forecastAt, messages } = report;
|
||||
const { windows, balances, details, retained, successfulAt, messages } = report;
|
||||
const footer = entry.account.label ?? null;
|
||||
return (
|
||||
<>
|
||||
@@ -194,7 +194,6 @@ function UsageCardBody({
|
||||
entry={entry}
|
||||
window={window}
|
||||
retained={retained}
|
||||
forecastAt={forecastAt}
|
||||
display={display}
|
||||
pinnable={pinnable}
|
||||
/>
|
||||
@@ -268,10 +267,8 @@ function CardWindowBar({
|
||||
display,
|
||||
pinnable,
|
||||
retained,
|
||||
forecastAt,
|
||||
}: {
|
||||
retained: boolean;
|
||||
forecastAt: string | null;
|
||||
entry: UsageReportEntry;
|
||||
window: UsageWindow;
|
||||
display: UsageDisplay;
|
||||
@@ -288,7 +285,6 @@ function CardWindowBar({
|
||||
<UsageWindowBar
|
||||
window={window}
|
||||
retained={retained}
|
||||
forecastAt={forecastAt}
|
||||
displayAs={display.displayAs}
|
||||
pinnable={pinnable}
|
||||
pinned={display.isPinned(pin)}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { afterEach, describe, expect, it } from "vitest";
|
||||
import { i18n } from "@/i18n/i18next";
|
||||
import {
|
||||
resolveUsageReport,
|
||||
markUsageRefreshFailure,
|
||||
displayPercent,
|
||||
resolveAgentUsageView,
|
||||
replaceReport,
|
||||
@@ -83,7 +82,7 @@ describe("resolveUsageView", () => {
|
||||
expect(resolveUsageView({ ...base, query: undefined })).toEqual({ kind: "loading" });
|
||||
expect(
|
||||
resolveUsageView({ ...base, query: { data: [], error: null, isFetching: true } }),
|
||||
).toEqual({ kind: "ready", reports: [], isRefreshing: true, refreshFailed: false });
|
||||
).toEqual({ kind: "ready", reports: [], isRefreshing: true });
|
||||
expect(
|
||||
resolveUsageView({
|
||||
...base,
|
||||
@@ -91,19 +90,6 @@ describe("resolveUsageView", () => {
|
||||
}),
|
||||
).toEqual({ kind: "error", message: "boom" });
|
||||
});
|
||||
|
||||
it("shows a failed Refresh all alongside the reports still on screen", () => {
|
||||
const reports = [entry({})];
|
||||
expect(
|
||||
resolveUsageView({
|
||||
hostLabel: "Laptop",
|
||||
isConnected: true,
|
||||
supportsUsage: true,
|
||||
query: ready(reports),
|
||||
refreshState: "failed",
|
||||
}),
|
||||
).toEqual({ kind: "ready", reports, isRefreshing: false, refreshFailed: true });
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -217,12 +203,15 @@ describe("displayPercent", () => {
|
||||
|
||||
describe("resolveUsageRefresh", () => {
|
||||
it("is pending while a refresh runs, even after an earlier failure", () => {
|
||||
expect(resolveUsageRefresh({ isPending: true, isError: true })).toBe("pending");
|
||||
expect(resolveUsageRefresh({ isPending: true, error: new Error("boom") })).toBe("pending");
|
||||
});
|
||||
|
||||
it("reports the request outcome independently of the reading", () => {
|
||||
expect(resolveUsageRefresh({ isPending: false, isError: true })).toBe("failed");
|
||||
expect(resolveUsageRefresh({ isPending: false, isError: false })).toBe("idle");
|
||||
it("is failed after a refresh errors", () => {
|
||||
expect(resolveUsageRefresh({ isPending: false, error: new Error("boom") })).toBe("failed");
|
||||
});
|
||||
|
||||
it("is idle before and after a successful refresh", () => {
|
||||
expect(resolveUsageRefresh({ isPending: false, error: null })).toBe("idle");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -363,7 +352,6 @@ it("resolves retained usage and successful time without inventing old-daemon his
|
||||
details: [],
|
||||
planLabel: null,
|
||||
successfulAt: success.fetchedAt,
|
||||
forecastAt: null,
|
||||
retained: true,
|
||||
messages: ["Rate limited"],
|
||||
});
|
||||
@@ -373,7 +361,6 @@ it("resolves retained usage and successful time without inventing old-daemon his
|
||||
details: [],
|
||||
planLabel: null,
|
||||
successfulAt: null,
|
||||
forecastAt: null,
|
||||
retained: false,
|
||||
messages: ["Rate limited"],
|
||||
});
|
||||
@@ -383,48 +370,11 @@ it("resolves retained usage and successful time without inventing old-daemon his
|
||||
details: [],
|
||||
planLabel: null,
|
||||
successfulAt: success.fetchedAt,
|
||||
forecastAt: success.fetchedAt,
|
||||
retained: false,
|
||||
messages: [],
|
||||
});
|
||||
});
|
||||
|
||||
it("uses the quota observation time for pace and keeps the reading after a failed request", () => {
|
||||
const success = entry({ windows: [{ id: "weekly", label: "Weekly", usedPct: 42 }] });
|
||||
if (success.report.status !== "available") throw new Error("fixture must be available");
|
||||
const observedAt = success.fetchedAt;
|
||||
const successfulAt = "2026-01-01T00:15:00.000Z";
|
||||
const report = { ...success, successfulAt, report: { ...success.report, observedAt } };
|
||||
expect(resolveUsageReport(report, i18n.t)).toMatchObject({
|
||||
successfulAt,
|
||||
forecastAt: observedAt,
|
||||
});
|
||||
expect(resolveUsageReport({ ...report, forecastStale: true }, i18n.t)).toMatchObject({
|
||||
windows: success.report.windows,
|
||||
successfulAt,
|
||||
forecastAt: null,
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps cached quota and hides its forecast when Refresh all fails before a new report arrives", () => {
|
||||
const before = entry({ windows: [{ id: "weekly", label: "Weekly", usedPct: 42 }] });
|
||||
const other = entry({ sourceId: "other" });
|
||||
const refreshedAt = "2026-01-01T00:06:00.000Z";
|
||||
const streamed = { ...other, fetchedAt: refreshedAt };
|
||||
const attempted = [before, other];
|
||||
const failed = markUsageRefreshFailure([before, streamed], attempted)!;
|
||||
|
||||
expect(resolveUsageReport(failed[0]!, i18n.t)).toMatchObject({
|
||||
forecastAt: null,
|
||||
windows: before.report.status === "available" ? before.report.windows : [],
|
||||
});
|
||||
expect(resolveUsageReport(failed[1]!, i18n.t).forecastAt).toBe(refreshedAt);
|
||||
expect(resolveUsageReport(upsertReport(failed, before)[0]!, i18n.t).forecastAt).toBeNull();
|
||||
|
||||
const retried = settleReports(failed, [{ ...before, fetchedAt: refreshedAt }, streamed]);
|
||||
expect(resolveUsageReport(retried[0]!, i18n.t).forecastAt).toBe(refreshedAt);
|
||||
});
|
||||
|
||||
it("orders failed polls by attempt time even when successful data is older", () => {
|
||||
const success = entry({});
|
||||
if (success.report.status !== "available") throw new Error("fixture must be available");
|
||||
|
||||
@@ -38,31 +38,18 @@ export function usageWindowRowLabel(input: {
|
||||
return `${input.pinLabel}, ${summary}`;
|
||||
}
|
||||
|
||||
/** The outcome of a user-requested usage refresh. */
|
||||
/** A user-requested refresh of one report. The previous report stays on screen throughout. */
|
||||
export type UsageRefresh = "idle" | "pending" | "failed";
|
||||
|
||||
export function resolveUsageRefresh(mutation: {
|
||||
isPending: boolean;
|
||||
isError: boolean;
|
||||
error: unknown;
|
||||
}): UsageRefresh {
|
||||
if (mutation.isPending) return "pending";
|
||||
if (mutation.isError) return "failed";
|
||||
if (mutation.error) return "failed";
|
||||
return "idle";
|
||||
}
|
||||
|
||||
/** Keep quota readings after a failed refresh and attach the outcome to the readings it targeted. */
|
||||
export function markUsageRefreshFailure(
|
||||
current: UsageReportEntry[] | undefined,
|
||||
attempted: readonly UsageReportEntry[],
|
||||
): UsageReportEntry[] | undefined {
|
||||
const attemptedAt = new Map(attempted.map((entry) => [entry.id, entry.fetchedAt]));
|
||||
return current?.map((entry) =>
|
||||
attemptedAt.get(entry.id) === entry.fetchedAt && !entry.forecastStale
|
||||
? { ...entry, forecastStale: true }
|
||||
: entry,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* A host's report list with one report swapped for its refreshed copy, in place.
|
||||
* `null` means the daemon no longer knows the ID, so the report leaves the list.
|
||||
@@ -73,9 +60,7 @@ export function replaceReport(
|
||||
refreshed: UsageReportEntry | null,
|
||||
): UsageReportEntry[] {
|
||||
if (!refreshed) return reports.filter((report) => report.id !== reportId);
|
||||
return reports.map((report) =>
|
||||
report.id === reportId ? laterFetched(report, refreshed) : report,
|
||||
);
|
||||
return reports.map((report) => (report.id === reportId ? refreshed : report));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,9 +68,7 @@ export function replaceReport(
|
||||
* started, so a Refresh that lands while it streams is newer than what the request still delivers.
|
||||
*/
|
||||
function laterFetched(shown: UsageReportEntry, arriving: UsageReportEntry): UsageReportEntry {
|
||||
const shownAt = Date.parse(shown.fetchedAt);
|
||||
const arrivingAt = Date.parse(arriving.fetchedAt);
|
||||
return shownAt > arrivingAt || (shownAt === arrivingAt && shown.forecastStale) ? shown : arriving;
|
||||
return Date.parse(shown.fetchedAt) > Date.parse(arriving.fetchedAt) ? shown : arriving;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,11 +117,10 @@ export function resolveUsageView(
|
||||
isConnected: boolean;
|
||||
supportsUsage: boolean;
|
||||
query: UsageQueryState | undefined;
|
||||
refreshState?: UsageRefresh;
|
||||
},
|
||||
t: TFunction = i18n.t,
|
||||
): UsageView {
|
||||
const { hostLabel, isConnected, supportsUsage, query, refreshState } = input;
|
||||
const { hostLabel, isConnected, supportsUsage, query } = input;
|
||||
if (!isConnected)
|
||||
return {
|
||||
kind: "unavailable",
|
||||
@@ -153,12 +135,7 @@ export function resolveUsageView(
|
||||
if (input.enabled === false)
|
||||
return { kind: "off", message: t("providerUsage.off", { host: hostLabel }) };
|
||||
if (query?.data) {
|
||||
return {
|
||||
kind: "ready",
|
||||
reports: query.data,
|
||||
isRefreshing: query.isFetching || refreshState === "pending",
|
||||
refreshFailed: refreshState === "failed",
|
||||
};
|
||||
return { kind: "ready", reports: query.data, isRefreshing: query.isFetching };
|
||||
}
|
||||
if (query?.error) {
|
||||
return {
|
||||
@@ -273,12 +250,7 @@ export function resolveUsageReport(entry: UsageReportEntry, t: TFunction) {
|
||||
// COMPAT(usageLoginErrors): added in v0.11.0, remove after 2027-04-05 once daemon floor >= v0.11.0.
|
||||
else messages.push(usageProblemText(entry.report, t));
|
||||
}
|
||||
const forecastAt =
|
||||
snapshot && !snapshot.retained && !entry.forecastStale
|
||||
? (snapshot.report.observedAt ?? snapshot.successfulAt)
|
||||
: null;
|
||||
return {
|
||||
forecastAt,
|
||||
windows: snapshot?.report.windows ?? [],
|
||||
balances: snapshot?.report.balances ?? [],
|
||||
details: snapshot?.report.details ?? [],
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { usagePace } from "./pace";
|
||||
import type { UsageWindow } from "./types";
|
||||
|
||||
const day = "2026-11-20T";
|
||||
const reading = (time: string) => `${day}${time}:00.000Z`;
|
||||
const window: UsageWindow = {
|
||||
id: "five_hour",
|
||||
label: "Session",
|
||||
durationSeconds: 18_000,
|
||||
usedPct: 65,
|
||||
resetsAt: reading("15:00"),
|
||||
};
|
||||
|
||||
describe("usage pace", () => {
|
||||
it("projects the limit from the sample time and keeps it fixed between readings", () => {
|
||||
const sampledAt = reading("12:00");
|
||||
const estimate = { kind: "runsOut", at: `${day}13:04:36.923Z` };
|
||||
expect(usagePace(window, sampledAt, Date.parse(sampledAt))).toEqual(estimate);
|
||||
expect(usagePace(window, sampledAt, Date.parse(reading("12:30")))).toEqual(estimate);
|
||||
});
|
||||
|
||||
it("updates after a later reading and works with a remaining percentage", () => {
|
||||
const close = reading("13:30");
|
||||
const safe = reading("14:00");
|
||||
const forecast = usagePace(window, close, Date.parse(close));
|
||||
expect(forecast.kind).toBe("remaining");
|
||||
if (forecast.kind === "remaining") expect(forecast.remainingAtResetPct).toBeCloseTo(7.14);
|
||||
expect(
|
||||
usagePace({ ...window, usedPct: undefined, remainingPct: 35 }, safe, Date.parse(safe)),
|
||||
).toEqual({ kind: "remaining", remainingAtResetPct: 18.75 });
|
||||
});
|
||||
|
||||
it("only forecasts with timing and an active, usable reading", () => {
|
||||
const sampledAt = reading("12:00");
|
||||
const now = Date.parse(sampledAt);
|
||||
expect(usagePace({ ...window, durationSeconds: undefined }, sampledAt, now)).toEqual({
|
||||
kind: "unknown",
|
||||
});
|
||||
expect(usagePace(window, null, now)).toEqual({ kind: "unknown" });
|
||||
expect(usagePace(window, reading("10:01"), now)).toEqual({ kind: "unknown" });
|
||||
expect(usagePace(window, sampledAt, Date.parse(window.resetsAt!))).toEqual({ kind: "unknown" });
|
||||
expect(usagePace({ ...window, usedPct: 100 }, sampledAt, now)).toEqual({ kind: "reached" });
|
||||
});
|
||||
});
|
||||
@@ -1,45 +0,0 @@
|
||||
import { usedPercent } from "./model";
|
||||
import type { UsageWindow } from "./types";
|
||||
|
||||
type UsagePace =
|
||||
| { kind: "unknown" }
|
||||
| { kind: "reached" }
|
||||
| { kind: "runsOut"; at: string }
|
||||
| { kind: "remaining"; remainingAtResetPct: number };
|
||||
|
||||
/** Estimate from the window's average pace as of the reading. The clock only expires the estimate. */
|
||||
export function usagePace(window: UsageWindow, observedAt: string | null, now: number): UsagePace {
|
||||
if (observedAt === null) return { kind: "unknown" };
|
||||
const reset = Date.parse(window.resetsAt ?? "");
|
||||
if (reset <= now) return { kind: "unknown" };
|
||||
|
||||
const used = usedPercent(window);
|
||||
if (used != null && used >= 100) return { kind: "reached" };
|
||||
|
||||
const supplied = window.runsOutAt;
|
||||
const suppliedAt = Date.parse(supplied ?? "");
|
||||
if (supplied && Number.isFinite(suppliedAt) && (!Number.isFinite(reset) || suppliedAt < reset)) {
|
||||
return { kind: "runsOut", at: supplied };
|
||||
}
|
||||
|
||||
const duration = (window.durationSeconds ?? 0) * 1_000;
|
||||
const sampled = Date.parse(observedAt);
|
||||
const elapsed = sampled - (reset - duration);
|
||||
if (
|
||||
used == null ||
|
||||
!Number.isFinite(used) ||
|
||||
used < 0 ||
|
||||
!Number.isFinite(elapsed) ||
|
||||
sampled >= reset ||
|
||||
elapsed < Math.max(60_000, duration * 0.01)
|
||||
) {
|
||||
return { kind: "unknown" };
|
||||
}
|
||||
|
||||
const projectedAtReset = (used / elapsed) * duration;
|
||||
if (projectedAtReset > 100) {
|
||||
const runsOut = sampled + ((100 - used) / used) * elapsed;
|
||||
return { kind: "runsOut", at: new Date(runsOut).toISOString() };
|
||||
}
|
||||
return { kind: "remaining", remainingAtResetPct: 100 - projectedAtReset };
|
||||
}
|
||||
@@ -20,7 +20,6 @@ import { useSessionStore, type SessionState } from "@/stores/session-store";
|
||||
import { useUsageSetting } from "./setting";
|
||||
import { usageCopy } from "./copy";
|
||||
import {
|
||||
markUsageRefreshFailure,
|
||||
replaceReport,
|
||||
resolveAgentUsageView,
|
||||
resolveUsageRefresh,
|
||||
@@ -98,32 +97,17 @@ async function streamReports(input: {
|
||||
return settleReports(queryClient.getQueryData<UsageReportEntry[]>(queryKey), reports);
|
||||
}
|
||||
|
||||
async function listReports(
|
||||
function listReports(
|
||||
queryClient: QueryClient,
|
||||
serverId: string,
|
||||
forceRefresh = false,
|
||||
): Promise<UsageReportEntry[]> {
|
||||
const queryKey = usageReportsQueryKey(serverId);
|
||||
const attempted = queryClient.getQueryData<UsageReportEntry[]>(queryKey) ?? [];
|
||||
try {
|
||||
return await streamReports({ queryClient, queryKey, serverId, forceRefresh });
|
||||
} catch (error) {
|
||||
recordUsageRefreshFailure(queryClient, queryKey, attempted);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
function recordUsageRefreshFailure(
|
||||
queryClient: QueryClient,
|
||||
queryKey: QueryKey,
|
||||
attempted: readonly UsageReportEntry[],
|
||||
): void {
|
||||
const { dataUpdatedAt } = queryClient.getQueryState(queryKey) ?? {};
|
||||
queryClient.setQueryData<UsageReportEntry[]>(
|
||||
queryKey,
|
||||
(current) => markUsageRefreshFailure(current, attempted),
|
||||
{ updatedAt: dataUpdatedAt },
|
||||
);
|
||||
return streamReports({
|
||||
queryClient,
|
||||
queryKey: usageReportsQueryKey(serverId),
|
||||
serverId,
|
||||
forceRefresh,
|
||||
});
|
||||
}
|
||||
|
||||
async function getReport(
|
||||
@@ -174,12 +158,9 @@ export function useHostUsage(serverId: string): { view: UsageView; refresh: () =
|
||||
dataShape: "value",
|
||||
staleTimeMs: REPORTS_STALE_TIME_MS,
|
||||
});
|
||||
const mutation = useMutation({
|
||||
mutationKey: [...usageReportsQueryKey(serverId), "refresh"],
|
||||
mutationFn: (hostId: string) => refreshReports(queryClient, hostId),
|
||||
});
|
||||
const { mutate, variables } = mutation;
|
||||
const refresh = useCallback(() => mutate(serverId), [mutate, serverId]);
|
||||
const refresh = useCallback(() => {
|
||||
void refreshReports(queryClient, serverId).catch(() => undefined);
|
||||
}, [queryClient, serverId]);
|
||||
const { t } = useTranslation();
|
||||
const hostLabel = useHosts().find((host) => host.serverId === serverId)?.label ?? serverId;
|
||||
const view = resolveUsageView(
|
||||
@@ -189,7 +170,6 @@ export function useHostUsage(serverId: string): { view: UsageView; refresh: () =
|
||||
isConnected,
|
||||
supportsUsage: isSupported,
|
||||
query: toQueryState(query),
|
||||
refreshState: variables === serverId ? resolveUsageRefresh(mutation) : "idle",
|
||||
},
|
||||
t,
|
||||
);
|
||||
@@ -285,26 +265,23 @@ export function useUsageHosts(): UsageHost[] {
|
||||
*/
|
||||
export function useReportRefresh(
|
||||
serverId: string,
|
||||
entry: UsageReportEntry,
|
||||
reportId: string,
|
||||
agentId?: string,
|
||||
): { refresh: () => void; refreshState: UsageRefresh } {
|
||||
const queryClient = useQueryClient();
|
||||
const usageScopeKey = useAgentUsageScopeKey(serverId, agentId);
|
||||
const queryKey =
|
||||
agentId === undefined
|
||||
? usageReportsQueryKey(serverId)
|
||||
: agentUsageQueryKey(serverId, agentId, usageScopeKey);
|
||||
const mutation = useMutation({
|
||||
mutationKey: [...queryKey, "refresh", entry.id],
|
||||
mutationFn: (attempted: UsageReportEntry) => getReport(serverId, attempted.id, true, agentId),
|
||||
onSuccess: (report, attempted) => {
|
||||
queryClient.setQueryData<UsageReportEntry[]>(queryKey, (reports) =>
|
||||
reports ? replaceReport(reports, attempted.id, report) : reports,
|
||||
mutationFn: () => getReport(serverId, reportId, true, agentId),
|
||||
onSuccess: (report) => {
|
||||
queryClient.setQueryData<UsageReportEntry[]>(
|
||||
agentId === undefined
|
||||
? usageReportsQueryKey(serverId)
|
||||
: agentUsageQueryKey(serverId, agentId, usageScopeKey),
|
||||
(reports) => (reports ? replaceReport(reports, reportId, report) : reports),
|
||||
);
|
||||
},
|
||||
onError: (_error, attempted) => recordUsageRefreshFailure(queryClient, queryKey, [attempted]),
|
||||
});
|
||||
const { mutate } = mutation;
|
||||
const refresh = useCallback(() => mutate(entry), [mutate, entry]);
|
||||
const refresh = useCallback(() => mutate(), [mutate]);
|
||||
return { refresh, refreshState: resolveUsageRefresh(mutation) };
|
||||
}
|
||||
|
||||
@@ -3,21 +3,24 @@ import { StyleSheet } from "react-native-unistyles";
|
||||
|
||||
/**
|
||||
* The reset data of a window or balance: the countdown first, then the exact time. When the line
|
||||
* is too narrow the exact time truncates and the countdown wraps within its column.
|
||||
* is too narrow the exact time gives way (truncates) and the countdown stays whole.
|
||||
*/
|
||||
export function UsageResetLine({
|
||||
countdown,
|
||||
exactTime,
|
||||
atRisk = false,
|
||||
testID,
|
||||
}: {
|
||||
countdown: string | null;
|
||||
exactTime: string | null;
|
||||
/** The countdown is a runs-out warning rather than a reset. */
|
||||
atRisk?: boolean;
|
||||
testID?: string;
|
||||
}) {
|
||||
if (!countdown) return null;
|
||||
return (
|
||||
<View style={styles.line} testID={testID}>
|
||||
<Text style={[styles.text, styles.countdown]}>{countdown}</Text>
|
||||
<Text style={atRisk ? styles.atRisk : styles.text}>{countdown}</Text>
|
||||
{exactTime ? (
|
||||
<Text style={[styles.text, styles.exactTime]} numberOfLines={1} ellipsizeMode="tail">
|
||||
{`\u00a0·\u00a0${exactTime}`}
|
||||
@@ -28,13 +31,18 @@ export function UsageResetLine({
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
line: { flexDirection: "row", alignItems: "baseline" },
|
||||
line: { flexDirection: "row", alignItems: "center" },
|
||||
text: {
|
||||
flexShrink: 0,
|
||||
color: theme.colors.foregroundMuted,
|
||||
fontSize: theme.fontSize.sm,
|
||||
fontWeight: theme.fontWeight.normal,
|
||||
},
|
||||
countdown: { maxWidth: "100%" },
|
||||
exactTime: { flexShrink: 1, minWidth: 0 },
|
||||
atRisk: {
|
||||
flexShrink: 0,
|
||||
color: theme.colors.statusDanger,
|
||||
fontSize: theme.fontSize.sm,
|
||||
fontWeight: theme.fontWeight.normal,
|
||||
},
|
||||
exactTime: { flexShrink: 1 },
|
||||
}));
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
import type {
|
||||
ProviderUsageTone,
|
||||
UsageReportEntry as WireUsageReportEntry,
|
||||
} from "@getpaseo/protocol/messages";
|
||||
import type { ProviderUsageTone, UsageReportEntry } from "@getpaseo/protocol/messages";
|
||||
|
||||
export interface UsageReportEntry extends WireUsageReportEntry {
|
||||
/** A refresh failed while this reading was cached. */
|
||||
forecastStale?: true;
|
||||
}
|
||||
export type { UsageReportEntry };
|
||||
export type UsageReport = UsageReportEntry["report"];
|
||||
export type UsageTone = ProviderUsageTone;
|
||||
export type AvailableUsageReport = Extract<UsageReport, { status: "available" }>;
|
||||
@@ -20,4 +14,4 @@ export type UsageView =
|
||||
| { kind: "unavailable"; message: string }
|
||||
| { kind: "loading" }
|
||||
| { kind: "error"; message: string }
|
||||
| { kind: "ready"; reports: UsageReportEntry[]; isRefreshing: boolean; refreshFailed: boolean };
|
||||
| { kind: "ready"; reports: UsageReportEntry[]; isRefreshing: boolean };
|
||||
|
||||
@@ -84,18 +84,11 @@ export function UsageBody({
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={styles.reports}>
|
||||
{view.refreshFailed ? (
|
||||
<Alert size="sm" variant="error" title={t("providerUsage.refreshFailed")} />
|
||||
) : null}
|
||||
{view.reports.length === 0 ? (
|
||||
<UsageMessage text={t("providerUsage.empty")} />
|
||||
) : (
|
||||
<UsageList serverId={serverId} reports={view.reports} display={display} />
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
if (view.reports.length === 0) {
|
||||
return <UsageMessage text={t("providerUsage.empty")} />;
|
||||
}
|
||||
|
||||
return <UsageList serverId={serverId} reports={view.reports} display={display} />;
|
||||
}
|
||||
|
||||
export function UsageMessage({ text }: { text: string }) {
|
||||
@@ -107,7 +100,6 @@ export function UsageMessage({ text }: { text: string }) {
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
reports: { gap: theme.spacing[3] },
|
||||
emptyCard: {
|
||||
padding: theme.spacing[4],
|
||||
alignItems: "center",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { TFunction } from "i18next";
|
||||
import { Pin } from "lucide-react-native";
|
||||
import { useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -7,7 +6,6 @@ import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import {
|
||||
formatDisplayPct,
|
||||
formatPct,
|
||||
formatProviderUsageLabel,
|
||||
formatResetLabel,
|
||||
formatResetTime,
|
||||
@@ -15,9 +13,9 @@ import {
|
||||
} from "./format";
|
||||
import { UsageMeter } from "./meter";
|
||||
import { displayPercent, usageWindowRowLabel } from "./model";
|
||||
import { usagePace } from "./pace";
|
||||
import { UsageResetLine } from "./reset-line";
|
||||
import type { UsageDisplayAs } from "./preferences";
|
||||
import { windowTone } from "./tone";
|
||||
import type { UsageTone, UsageWindow } from "./types";
|
||||
import { useRelativeTimeTick } from "./use-relative-time-tick";
|
||||
|
||||
@@ -30,10 +28,8 @@ export function UsageWindowBar({
|
||||
pinLabel,
|
||||
pinTestID,
|
||||
retained = false,
|
||||
forecastAt,
|
||||
}: {
|
||||
retained?: boolean;
|
||||
forecastAt: string | null;
|
||||
window: UsageWindow;
|
||||
displayAs: UsageDisplayAs;
|
||||
/** Whether the row pins the window to the sidebar. When false the row is a plain bar. */
|
||||
@@ -46,11 +42,19 @@ export function UsageWindowBar({
|
||||
}) {
|
||||
const { t, i18n } = useTranslation();
|
||||
const shownPct = displayPercent(window, displayAs);
|
||||
const tone = windowTone(window);
|
||||
|
||||
const now = useRelativeTimeTick({ enabled: window.runsOutAt != null || window.resetsAt != null });
|
||||
const pace = usagePace(window, forecastAt, now);
|
||||
const forecast = formatPace(pace, now, t);
|
||||
const countdown = formatResetLabel(window.resetsAt, retained, now, t);
|
||||
const exactTime = formatResetTime(window.resetsAt, now, t);
|
||||
const isAtRisk =
|
||||
window.runsOutAt != null &&
|
||||
window.shortfallPct != null &&
|
||||
(!retained || Date.parse(window.runsOutAt) > now);
|
||||
const countdown = isAtRisk
|
||||
? formatRunsOutLabel(window.runsOutAt, now, t)
|
||||
: formatResetLabel(window.resetsAt, retained, now, t);
|
||||
// The exact time belongs to the reset; beside a runs-out warning it would read as the moment
|
||||
// the quota runs out.
|
||||
const exactTime = isAtRisk ? null : formatResetTime(window.resetsAt, now, t);
|
||||
|
||||
const value =
|
||||
shownPct != null ? formatDisplayPct(shownPct, displayAs, i18n.resolvedLanguage, t) : "—";
|
||||
@@ -60,8 +64,9 @@ export function UsageWindowBar({
|
||||
value,
|
||||
countdown,
|
||||
exactTime,
|
||||
forecast,
|
||||
isAtRisk,
|
||||
percent: shownPct ?? 0,
|
||||
tone,
|
||||
pinned,
|
||||
};
|
||||
|
||||
@@ -81,7 +86,7 @@ export function UsageWindowBar({
|
||||
accessibilityLabel={usageWindowRowLabel({
|
||||
pinLabel,
|
||||
value,
|
||||
trailing: [countdown, exactTime, forecast?.label].filter(Boolean).join(" · "),
|
||||
trailing: [countdown, exactTime].filter(Boolean).join(" · "),
|
||||
})}
|
||||
accessibilityState={accessibilityState}
|
||||
aria-checked={pinned}
|
||||
@@ -98,8 +103,9 @@ function WindowRowContent({
|
||||
value,
|
||||
countdown,
|
||||
exactTime,
|
||||
forecast,
|
||||
isAtRisk,
|
||||
percent,
|
||||
tone,
|
||||
pinnable,
|
||||
pinned,
|
||||
}: {
|
||||
@@ -107,8 +113,9 @@ function WindowRowContent({
|
||||
value: string;
|
||||
countdown: string | null;
|
||||
exactTime: string | null;
|
||||
forecast: PaceLabel | null;
|
||||
isAtRisk: boolean;
|
||||
percent: number;
|
||||
tone: UsageTone;
|
||||
pinnable: boolean;
|
||||
pinned: boolean;
|
||||
}) {
|
||||
@@ -123,51 +130,12 @@ function WindowRowContent({
|
||||
</Text>
|
||||
{pinnable ? <UsagePinGlyph pinned={pinned} /> : null}
|
||||
</View>
|
||||
<UsageMeter percent={percent} tone={forecast?.tone ?? "default"} />
|
||||
{countdown || forecast ? (
|
||||
<View style={styles.timingRow}>
|
||||
<View style={styles.resetTiming}>
|
||||
<UsageResetLine countdown={countdown} exactTime={exactTime} />
|
||||
</View>
|
||||
{forecast ? <Text style={styles.forecast(forecast.tone)}>{forecast.label}</Text> : null}
|
||||
</View>
|
||||
) : null}
|
||||
<UsageMeter percent={percent} tone={tone} />
|
||||
<UsageResetLine countdown={countdown} exactTime={exactTime} atRisk={isAtRisk} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
interface PaceLabel {
|
||||
label: string;
|
||||
tone: UsageTone;
|
||||
}
|
||||
|
||||
function formatPace(
|
||||
pace: ReturnType<typeof usagePace>,
|
||||
now: number,
|
||||
t: TFunction,
|
||||
): PaceLabel | null {
|
||||
switch (pace.kind) {
|
||||
case "reached":
|
||||
return { label: t("providerUsage.timing.limitReached"), tone: "danger" };
|
||||
case "runsOut": {
|
||||
const label =
|
||||
Date.parse(pace.at) <= now
|
||||
? t("providerUsage.timing.mayHaveRunOut")
|
||||
: formatRunsOutLabel(pace.at, now, t);
|
||||
return label ? { label, tone: "danger" } : null;
|
||||
}
|
||||
case "remaining":
|
||||
return {
|
||||
label: t("providerUsage.timing.projectedLeftAtReset", {
|
||||
percentage: formatPct(pace.remainingAtResetPct),
|
||||
}),
|
||||
tone: pace.remainingAtResetPct <= 10 ? "warning" : "default",
|
||||
};
|
||||
case "unknown":
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
const ThemedPin = withUnistyles(Pin);
|
||||
|
||||
function UsagePinGlyph({ pinned }: { pinned: boolean }) {
|
||||
@@ -199,23 +167,6 @@ function UsagePinGlyph({ pinned }: { pinned: boolean }) {
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
timingRow: {
|
||||
flexDirection: "row",
|
||||
alignItems: "flex-start",
|
||||
gap: theme.spacing[2],
|
||||
},
|
||||
resetTiming: { flex: 1, minWidth: 0 },
|
||||
forecast: (tone: UsageTone) => ({
|
||||
color: {
|
||||
danger: theme.colors.statusDanger,
|
||||
warning: theme.colors.statusWarning,
|
||||
default: theme.colors.foregroundMuted,
|
||||
ok: theme.colors.statusSuccess,
|
||||
}[tone],
|
||||
fontSize: theme.fontSize.sm,
|
||||
maxWidth: "50%",
|
||||
textAlign: "right",
|
||||
}),
|
||||
row: { gap: 3, paddingVertical: theme.spacing[1.5] },
|
||||
pin: { width: 12, alignItems: "center" },
|
||||
tooltipText: { color: theme.colors.popoverForeground, fontSize: theme.fontSize.sm },
|
||||
|
||||
@@ -14,7 +14,6 @@ import { buildWorkspaceTabPersistenceKey } from "@/workspace-tabs/model";
|
||||
import { archiveWorkspaceWithUndo, supportsWorkspaceArchiveUndo } from "@/workspace/archive-undo";
|
||||
import {
|
||||
archiveWorkspaceOptimistically,
|
||||
runWorkspaceArchiveAttempt,
|
||||
type WorkspaceArchiveTarget,
|
||||
} from "@/workspace/workspace-archive";
|
||||
|
||||
@@ -57,6 +56,7 @@ export function useWorkspaceArchive(input: ArchiveWorkspaceInput): WorkspaceArch
|
||||
} = input;
|
||||
const { t } = useTranslation();
|
||||
const toast = useToast();
|
||||
const confirmingRef = useRef(false);
|
||||
// The archive starts after the host answers and you confirm. By then you may have opened another
|
||||
// workspace, so the redirect reads the selection from the latest render.
|
||||
const onArchiveStartedRef = useRef(onArchiveStarted);
|
||||
@@ -119,12 +119,26 @@ export function useWorkspaceArchive(input: ArchiveWorkspaceInput): WorkspaceArch
|
||||
}, [diffStat, name, serverId, t, toast, warningLabels, workspaceDirectory]);
|
||||
|
||||
const archive = useCallback(() => {
|
||||
void runWorkspaceArchiveAttempt({
|
||||
workspace: { serverId, workspaceId },
|
||||
confirm: workspaceKind === "worktree" ? confirmWorktreeArchive : undefined,
|
||||
archive: archiveWorkspaceRecord,
|
||||
});
|
||||
}, [archiveWorkspaceRecord, confirmWorktreeArchive, serverId, workspaceId, workspaceKind]);
|
||||
// A second press while the host answers or the warning is open would ask twice.
|
||||
if (confirmingRef.current) {
|
||||
return;
|
||||
}
|
||||
void (async () => {
|
||||
if (workspaceKind === "worktree") {
|
||||
confirmingRef.current = true;
|
||||
let confirmed: boolean;
|
||||
try {
|
||||
confirmed = await confirmWorktreeArchive();
|
||||
} finally {
|
||||
confirmingRef.current = false;
|
||||
}
|
||||
if (!confirmed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
await archiveWorkspaceRecord();
|
||||
})();
|
||||
}, [archiveWorkspaceRecord, confirmWorktreeArchive, workspaceKind]);
|
||||
|
||||
return {
|
||||
archive,
|
||||
|
||||
@@ -17,30 +17,6 @@ export interface WorkspaceArchiveTarget {
|
||||
workspaceId: string;
|
||||
}
|
||||
|
||||
const pendingArchiveAttempts = new Set<string>();
|
||||
|
||||
/** Checks and starts one archive at a time for a workspace. */
|
||||
export async function runWorkspaceArchiveAttempt(input: {
|
||||
workspace: WorkspaceArchiveTarget;
|
||||
confirm?: () => Promise<boolean>;
|
||||
archive: () => Promise<void>;
|
||||
}): Promise<void> {
|
||||
const { serverId, workspaceId } = input.workspace;
|
||||
const key = JSON.stringify([serverId, workspaceId]);
|
||||
if (pendingArchiveAttempts.has(key)) return;
|
||||
|
||||
pendingArchiveAttempts.add(key);
|
||||
try {
|
||||
if (input.confirm && !(await input.confirm())) return;
|
||||
if (!isWorkspaceListed(input.workspace)) return;
|
||||
// Archive hides the row synchronously. Undo can restore it and start a new
|
||||
// archive while the previous daemon request is still settling.
|
||||
return input.archive();
|
||||
} finally {
|
||||
pendingArchiveAttempts.delete(key);
|
||||
}
|
||||
}
|
||||
|
||||
interface WorkspaceArchiveClient {
|
||||
archiveWorkspace: (workspaceId: string) => Promise<{ error: string | null; canceled?: boolean }>;
|
||||
}
|
||||
|
||||
@@ -89,9 +89,6 @@ export async function createAcpProviderConnection(
|
||||
if (probe.agentCapabilities.loadSession) {
|
||||
supportedCapabilities.push("session.persistence");
|
||||
}
|
||||
if (options.acpOptions?.deferTurnOnRunningTools) {
|
||||
supportedCapabilities.push("prompt.steer");
|
||||
}
|
||||
await probe.close();
|
||||
const capabilities = negotiateProviderCapabilities(request.capabilities, supportedCapabilities);
|
||||
const listeners = new Set<(event: ProviderEvent) => void>();
|
||||
@@ -217,13 +214,10 @@ async function dispatch(input: ProviderInput, state: AcpConnectionState): Promis
|
||||
await mutateSession(session, () => session.runtime.prompt(input));
|
||||
return;
|
||||
}
|
||||
case "session.interrupt": {
|
||||
const session = requireSession(state, input.sessionId);
|
||||
const retired = await session.runtime.interrupt();
|
||||
case "session.interrupt":
|
||||
await requireSession(state, input.sessionId).runtime.interrupt();
|
||||
state.emit({ type: "request.completed", requestId: input.requestId });
|
||||
if (retired) retireSession(state, input.sessionId);
|
||||
return;
|
||||
}
|
||||
case "session.permission":
|
||||
requireSession(state, input.sessionId).runtime.respondToPermission(
|
||||
input.permissionId,
|
||||
@@ -310,12 +304,6 @@ async function listSessions(
|
||||
}
|
||||
}
|
||||
|
||||
function retireSession(state: AcpConnectionState, sessionId: string): void {
|
||||
if (state.sessions.delete(sessionId)) {
|
||||
state.emit({ type: "session.closed", sessionId });
|
||||
}
|
||||
}
|
||||
|
||||
async function openSession(
|
||||
input: Extract<ProviderInput, { type: "session.open" }>,
|
||||
state: AcpConnectionState,
|
||||
@@ -329,7 +317,6 @@ async function openSession(
|
||||
cwd: input.config.cwd,
|
||||
env: input.config.env,
|
||||
emit: state.emit,
|
||||
onRetired: () => retireSession(state, input.sessionId),
|
||||
});
|
||||
try {
|
||||
const capabilities = await runtime.open(input, state.capabilities);
|
||||
@@ -371,7 +358,6 @@ interface StartRuntimeOptions {
|
||||
cwd?: string;
|
||||
env: Readonly<Record<string, string>>;
|
||||
emit(event: ProviderEvent): void;
|
||||
onRetired?: () => void;
|
||||
}
|
||||
|
||||
interface PendingPermission {
|
||||
@@ -380,33 +366,6 @@ interface PendingPermission {
|
||||
resolve(response: RequestPermissionResponse): void;
|
||||
}
|
||||
|
||||
type DeferredTurnOutcome =
|
||||
| { type: "complete"; terminalizeTools: boolean }
|
||||
| { type: "cancel" }
|
||||
| { type: "fail"; error: { message: string } };
|
||||
|
||||
interface DeferredTurnState {
|
||||
timer: ReturnType<typeof setTimeout> | null;
|
||||
resolve(outcome: DeferredTurnOutcome): void;
|
||||
}
|
||||
|
||||
type DeferredReplyState = "idle" | "open" | "settled_with_open_tools" | "settled";
|
||||
|
||||
interface ActivePrompt {
|
||||
turnId: string;
|
||||
settled: Promise<void>;
|
||||
cancelling: boolean;
|
||||
wirePromptsInFlight: number;
|
||||
wirePromptLane: Promise<void>;
|
||||
lastPromptResponseWireSeq: number | null;
|
||||
crossedEndTurn: boolean;
|
||||
replyState: DeferredReplyState;
|
||||
deferred: DeferredTurnState | null;
|
||||
}
|
||||
|
||||
const DEFAULT_DEFERRED_SETTLE_DELAY_MS = 500;
|
||||
const DEFAULT_DEFERRED_QUIET_LIMIT_MS = 120_000;
|
||||
|
||||
class AcpRuntime {
|
||||
readonly connection: ClientSideConnection;
|
||||
agentCapabilities: AgentCapabilities = {};
|
||||
@@ -415,8 +374,6 @@ class AcpRuntime {
|
||||
private emit: (event: ProviderEvent) => void;
|
||||
private readonly messages = new Map<string, string>();
|
||||
private readonly toolCalls = new Map<string, AcpToolCallSnapshot>();
|
||||
private readonly liveOpenToolIds = new Set<string>();
|
||||
private readonly canceledToolCallIds = new Set<string>();
|
||||
// Running tool rows published by transformers; the turn's terminal closes any left open.
|
||||
private readonly vendorToolCalls = new Map<string, ToolCallTimelineItem>();
|
||||
private readonly pendingCompactions = new Set<string>();
|
||||
@@ -444,33 +401,21 @@ class AcpRuntime {
|
||||
private replayWindow: "replay" | "skip" | null = null;
|
||||
private lastLoadUpdateAt = 0;
|
||||
private closing = false;
|
||||
private closePromise: Promise<void> | null = null;
|
||||
private deferredRetirement: Promise<boolean> | null = null;
|
||||
private deferredFinalized = false;
|
||||
private processFailed = false;
|
||||
private configTransaction = false;
|
||||
private stagedTransformerConfig: ProviderConfigState | null = null;
|
||||
private readonly closeConnector: (options?: {
|
||||
force?: boolean;
|
||||
timeoutMs?: number;
|
||||
}) => Promise<void>;
|
||||
private readonly whenConnectorClosed: () => Promise<void> | null;
|
||||
private readonly closeConnector: () => Promise<void>;
|
||||
private notificationLane: Promise<void> = Promise.resolve();
|
||||
private incomingWireSeq = 0;
|
||||
private readonly sessionUpdateWireSeqs: number[] = [];
|
||||
private autoAccept = false;
|
||||
private activePrompt: ActivePrompt | null = null;
|
||||
private activePrompt: { turnId: string; settled: Promise<void>; cancelling: boolean } | null =
|
||||
null;
|
||||
private lastUsage: ProviderUsage = {};
|
||||
|
||||
static async start(options: StartRuntimeOptions): Promise<AcpRuntime> {
|
||||
let child: ChildProcessWithoutNullStreams | null = null;
|
||||
let spawnFailure: Promise<never> | null = null;
|
||||
let stream: Stream;
|
||||
let closeConnector: (options?: {
|
||||
force?: boolean;
|
||||
timeoutMs?: number;
|
||||
}) => Promise<void> = async () => {};
|
||||
let whenConnectorClosed: () => Promise<void> | null = () => null;
|
||||
let closeConnector = async () => {};
|
||||
if (options.options.command) {
|
||||
// COMPAT(pluginProviderLaunch): added in v0.10.0, remove after 2027-03-29 once plugin host floor >= v0.10.0.
|
||||
// Standalone callers and older hosts do not send a daemon-resolved launch.
|
||||
@@ -493,9 +438,8 @@ class AcpRuntime {
|
||||
const owned = ownConnectorStream(await options.options.connector());
|
||||
stream = owned.stream;
|
||||
closeConnector = owned.close;
|
||||
whenConnectorClosed = owned.whenClosed;
|
||||
}
|
||||
const runtime = new AcpRuntime(stream, child, closeConnector, whenConnectorClosed, options);
|
||||
const runtime = new AcpRuntime(stream, child, closeConnector, options);
|
||||
try {
|
||||
const initialize = withTimeout(
|
||||
runtime.call(
|
||||
@@ -522,51 +466,41 @@ class AcpRuntime {
|
||||
private constructor(
|
||||
stream: Stream,
|
||||
child: ChildProcessWithoutNullStreams | null,
|
||||
closeConnector: (options?: { force?: boolean; timeoutMs?: number }) => Promise<void>,
|
||||
whenConnectorClosed: () => Promise<void> | null,
|
||||
closeConnector: () => Promise<void>,
|
||||
private readonly options: StartRuntimeOptions,
|
||||
) {
|
||||
this.child = child;
|
||||
this.closeConnector = closeConnector;
|
||||
this.whenConnectorClosed = whenConnectorClosed;
|
||||
this.emit = options.emit;
|
||||
this.transformers = options.options.transformers ?? [];
|
||||
const client: Client = {
|
||||
requestPermission: (request) => this.requestPermission(request),
|
||||
sessionUpdate: (notification) => {
|
||||
const wireSeq = this.sessionUpdateWireSeqs.shift() ?? ++this.incomingWireSeq;
|
||||
return this.enqueueNotification(() => this.sessionUpdate(notification, wireSeq));
|
||||
},
|
||||
sessionUpdate: (notification) =>
|
||||
this.enqueueNotification(() => this.sessionUpdate(notification)),
|
||||
};
|
||||
this.connection = new ClientSideConnection(
|
||||
() => client,
|
||||
routeIncomingMessages(
|
||||
stream,
|
||||
(method, params) => this.vendorNotification(method, params),
|
||||
(message) => this.observeWireMessage(message),
|
||||
),
|
||||
routeVendorNotifications(stream, (method, params) => this.vendorNotification(method, params)),
|
||||
);
|
||||
if (!child) void this.connection.closed.then(() => this.handleUnexpectedTransportClose());
|
||||
child?.on("error", (error) => {
|
||||
const message = describeError(error);
|
||||
this.processFailed = true;
|
||||
this.settlePendingWork(message);
|
||||
this.settlePendingWork();
|
||||
if (this.closing || !this.nativeSessionId) return;
|
||||
this.emit({
|
||||
type: "session.runtime_failed",
|
||||
sessionId: this.options.boundarySessionId,
|
||||
error: { message },
|
||||
error: { message: describeError(error) },
|
||||
});
|
||||
});
|
||||
child?.once("close", (code, signal) => {
|
||||
if (this.closing || this.processFailed || !this.nativeSessionId) return;
|
||||
const message = `ACP process exited (${signal ?? code ?? "unknown"})`;
|
||||
this.processFailed = true;
|
||||
this.settlePendingWork(message);
|
||||
this.settlePendingWork();
|
||||
this.emit({
|
||||
type: "session.runtime_failed",
|
||||
sessionId: this.options.boundarySessionId,
|
||||
error: { message },
|
||||
error: { message: `ACP process exited (${signal ?? code ?? "unknown"})` },
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -675,31 +609,10 @@ class AcpRuntime {
|
||||
}
|
||||
|
||||
async prompt(input: Extract<ProviderInput, { type: "session.prompt" }>): Promise<void> {
|
||||
if (this.closing || this.processFailed || this.deferredRetirement) {
|
||||
throw new Error("ACP session is closed");
|
||||
}
|
||||
if (input.prompt.delivery === "steer") {
|
||||
this.steerDeferredPrompt(input);
|
||||
return;
|
||||
}
|
||||
const active = this.activePrompt;
|
||||
if (active) {
|
||||
if (active.deferred && active.wirePromptsInFlight === 0) {
|
||||
// Wire session/prompt already resolved; finish the deferred turn without sending
|
||||
// session/cancel so running background tools stay alive into the follow-up turn.
|
||||
this.finishDeferredTurn(active, { type: "complete", terminalizeTools: false });
|
||||
} else {
|
||||
const retired = await this.interrupt();
|
||||
if (retired) {
|
||||
// Notify caller that the session closed before failing the replacement prompt.
|
||||
this.options.onRetired?.();
|
||||
throw new Error("ACP session retired after stopping deferred background work");
|
||||
}
|
||||
}
|
||||
await this.interrupt();
|
||||
await active.settled;
|
||||
if (this.closing || this.processFailed || this.deferredRetirement) {
|
||||
throw new Error("ACP session is closed");
|
||||
}
|
||||
}
|
||||
const prompt = toAcpPrompt(input.prompt);
|
||||
this.replayWindow = null;
|
||||
@@ -730,17 +643,6 @@ class AcpRuntime {
|
||||
turnId,
|
||||
state: "started",
|
||||
});
|
||||
const activePrompt: ActivePrompt = {
|
||||
turnId,
|
||||
settled: Promise.resolve(),
|
||||
cancelling: false,
|
||||
wirePromptsInFlight: 1,
|
||||
wirePromptLane: Promise.resolve(),
|
||||
lastPromptResponseWireSeq: null,
|
||||
crossedEndTurn: false,
|
||||
replyState: "idle",
|
||||
deferred: null,
|
||||
};
|
||||
// The SDK dispatches notifications without awaiting them, so the prompt response can resolve
|
||||
// while earlier session updates are still queued. Apply them before the turn ends.
|
||||
const settled = this.call(
|
||||
@@ -748,7 +650,6 @@ class AcpRuntime {
|
||||
).then(
|
||||
async (response): Promise<void> => {
|
||||
await this.drainNotifications();
|
||||
activePrompt.wirePromptsInFlight -= 1;
|
||||
if (response.usage) {
|
||||
this.lastUsage = {
|
||||
...this.lastUsage,
|
||||
@@ -764,95 +665,47 @@ class AcpRuntime {
|
||||
});
|
||||
}
|
||||
const state = response.stopReason === "cancelled" ? "canceled" : "completed";
|
||||
if (response.stopReason === "end_turn" && this.shouldDeferTurn(activePrompt)) {
|
||||
await this.settleDeferredPrompt(activePrompt);
|
||||
return undefined;
|
||||
}
|
||||
this.finishPromptTurn(turnId, state);
|
||||
this.fallbackChunkIds.clear();
|
||||
this.terminalizeTransientItems(state);
|
||||
this.finishTurnPermissions(turnId);
|
||||
this.emit({
|
||||
type: "session.turn",
|
||||
sessionId: this.options.boundarySessionId,
|
||||
turnId,
|
||||
state,
|
||||
});
|
||||
return undefined;
|
||||
},
|
||||
async (error): Promise<void> => {
|
||||
await this.drainNotifications();
|
||||
activePrompt.wirePromptsInFlight -= 1;
|
||||
this.finishPromptTurn(turnId, "failed", { message: describeError(error) });
|
||||
this.fallbackChunkIds.clear();
|
||||
this.terminalizeTransientItems("failed");
|
||||
this.finishTurnPermissions(turnId);
|
||||
this.emit({
|
||||
type: "session.turn",
|
||||
sessionId: this.options.boundarySessionId,
|
||||
turnId,
|
||||
state: "failed",
|
||||
error: { message: describeError(error) },
|
||||
});
|
||||
return undefined;
|
||||
},
|
||||
);
|
||||
activePrompt.settled = settled;
|
||||
this.activePrompt = activePrompt;
|
||||
this.activePrompt = { turnId, settled, cancelling: false };
|
||||
void settled.finally(() => {
|
||||
if (this.activePrompt?.turnId === turnId) this.activePrompt = null;
|
||||
});
|
||||
}
|
||||
|
||||
async interrupt(): Promise<boolean> {
|
||||
if (this.deferredRetirement) return this.deferredRetirement;
|
||||
async interrupt(): Promise<void> {
|
||||
const active = this.activePrompt;
|
||||
const deferredTurnId = active?.deferred ? active.turnId : null;
|
||||
if (active && deferredTurnId) {
|
||||
const retirement = this.retireDeferredTurn(active, deferredTurnId).catch((error) => {
|
||||
if (this.deferredRetirement === retirement) this.deferredRetirement = null;
|
||||
throw error;
|
||||
});
|
||||
this.deferredRetirement = retirement;
|
||||
return retirement;
|
||||
}
|
||||
if (active) active.cancelling = true;
|
||||
try {
|
||||
await this.call(this.connection.cancel({ sessionId: this.nativeSessionId }));
|
||||
} finally {
|
||||
// An agent may wait for its outstanding permission replies before ending the prompt.
|
||||
if (active) {
|
||||
this.finishTurnPermissions(active.turnId);
|
||||
}
|
||||
if (active) this.finishTurnPermissions(active.turnId);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private finalizeDeferredTurn(deferredTurnId: string, emitRetired: boolean): void {
|
||||
if (this.deferredFinalized) return;
|
||||
this.deferredFinalized = true;
|
||||
this.finishPromptTurn(deferredTurnId, "canceled", undefined, {
|
||||
suppressTrailingToolEcho: true,
|
||||
});
|
||||
if (emitRetired) this.options.onRetired?.();
|
||||
}
|
||||
|
||||
private async retireDeferredTurn(active: ActivePrompt, deferredTurnId: string): Promise<boolean> {
|
||||
active.cancelling = true;
|
||||
// Record open tools owned by Stop before writing session/cancel so any failure
|
||||
// update arriving during cancel preserves their canceled state.
|
||||
for (const id of this.liveOpenToolIds) this.canceledToolCallIds.add(id);
|
||||
let cancelTimedOut = false;
|
||||
if (!this.closing) {
|
||||
try {
|
||||
await withTimeout(
|
||||
this.call(this.connection.cancel({ sessionId: this.nativeSessionId })),
|
||||
1_000,
|
||||
`ACP session ${this.nativeSessionId} did not accept cancel`,
|
||||
);
|
||||
} catch {
|
||||
cancelTimedOut = true;
|
||||
} finally {
|
||||
// An agent may wait for its outstanding permission replies before ending the prompt.
|
||||
this.finishTurnPermissions(active.turnId);
|
||||
}
|
||||
}
|
||||
// ACP v1 has no response or end boundary for session/cancel once session/prompt
|
||||
// already returned. Close the process first while the turn still appears running,
|
||||
// then emit the canceled turn synchronously before request.completed and session.closed
|
||||
// so queued work and config changes immediately observe the retired session.
|
||||
try {
|
||||
await this.close({ force: cancelTimedOut, timeoutMs: 1_000 });
|
||||
} catch (error) {
|
||||
void this.whenConnectorClosed()?.then(
|
||||
() => this.finalizeDeferredTurn(deferredTurnId, true),
|
||||
() => undefined,
|
||||
);
|
||||
throw error;
|
||||
}
|
||||
this.finalizeDeferredTurn(deferredTurnId, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
listSessions(cwd?: string) {
|
||||
@@ -905,7 +758,6 @@ class AcpRuntime {
|
||||
sessionId: this.options.boundarySessionId,
|
||||
permissionId,
|
||||
});
|
||||
if (this.activePrompt?.deferred) this.scheduleDeferredSettle();
|
||||
}
|
||||
|
||||
async configure(
|
||||
@@ -981,20 +833,11 @@ class AcpRuntime {
|
||||
await this.close();
|
||||
}
|
||||
|
||||
close(options?: { force?: boolean; timeoutMs?: number }): Promise<void> {
|
||||
if (this.closePromise) return this.closePromise;
|
||||
async close(): Promise<void> {
|
||||
if (this.closing) return;
|
||||
this.closing = true;
|
||||
const promise = this.closeInternal(options).catch((error) => {
|
||||
if (this.closePromise === promise) this.closePromise = null;
|
||||
throw error;
|
||||
});
|
||||
this.closePromise = promise;
|
||||
return promise;
|
||||
}
|
||||
|
||||
private async closeInternal(options?: { force?: boolean; timeoutMs?: number }): Promise<void> {
|
||||
this.settlePendingWork();
|
||||
await this.closeConnector(options);
|
||||
await this.closeConnector();
|
||||
const child = this.child;
|
||||
if (!child || this.processFailed) return;
|
||||
if (child.exitCode !== null || child.signalCode !== null) return;
|
||||
@@ -1223,7 +1066,6 @@ class AcpRuntime {
|
||||
const permissionId = `permission:${request.toolCall.toolCallId}`;
|
||||
return new Promise((resolve) => {
|
||||
this.permissions.set(permissionId, { request, resolve, turnId: this.activePrompt?.turnId });
|
||||
if (this.activePrompt?.deferred) this.scheduleDeferredSettle();
|
||||
this.emit({
|
||||
type: "session.permission",
|
||||
sessionId: this.options.boundarySessionId,
|
||||
@@ -1243,31 +1085,7 @@ class AcpRuntime {
|
||||
});
|
||||
}
|
||||
|
||||
private observeWireMessage(message: unknown): void {
|
||||
if (typeof message !== "object" || message === null) return;
|
||||
const record = message as Record<string, unknown>;
|
||||
if (record.method === "session/update") {
|
||||
this.sessionUpdateWireSeqs.push(++this.incomingWireSeq);
|
||||
return;
|
||||
}
|
||||
if (
|
||||
!("method" in record) &&
|
||||
"id" in record &&
|
||||
typeof record.result === "object" &&
|
||||
record.result !== null &&
|
||||
typeof (record.result as Record<string, unknown>).stopReason === "string" &&
|
||||
this.activePrompt &&
|
||||
this.activePrompt.lastPromptResponseWireSeq === null
|
||||
) {
|
||||
this.activePrompt.lastPromptResponseWireSeq = ++this.incomingWireSeq;
|
||||
}
|
||||
}
|
||||
|
||||
private isPostWirePrompt(active: ActivePrompt, wireSeq: number): boolean {
|
||||
return active.lastPromptResponseWireSeq !== null && wireSeq > active.lastPromptResponseWireSeq;
|
||||
}
|
||||
|
||||
private sessionUpdate(notification: SessionNotification, wireSeq: number): void {
|
||||
private sessionUpdate(notification: SessionNotification): void {
|
||||
if (notification.sessionId !== this.nativeSessionId) return;
|
||||
if (this.replayWindow) this.lastLoadUpdateAt = performance.now();
|
||||
if (this.replayWindow === "skip") {
|
||||
@@ -1278,7 +1096,7 @@ class AcpRuntime {
|
||||
update.sessionUpdate === "current_mode_update" ||
|
||||
update.sessionUpdate === "usage_update"
|
||||
) {
|
||||
this.reduceStateUpdate(update, wireSeq);
|
||||
this.reduceStateUpdate(update);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1289,10 +1107,10 @@ class AcpRuntime {
|
||||
this.reduceUserMessageChunk(notification.update);
|
||||
return;
|
||||
}
|
||||
this.reduceUpdate(notification.update, wireSeq);
|
||||
this.reduceUpdate(notification.update);
|
||||
}
|
||||
|
||||
private reduceUpdate(update: SessionUpdate, wireSeq: number): void {
|
||||
private reduceUpdate(update: SessionUpdate): void {
|
||||
if (
|
||||
update.sessionUpdate === "agent_message_chunk" ||
|
||||
update.sessionUpdate === "agent_thought_chunk" ||
|
||||
@@ -1326,16 +1144,15 @@ class AcpRuntime {
|
||||
: {}),
|
||||
},
|
||||
});
|
||||
this.noteDeferredChunk(update.sessionUpdate, wireSeq);
|
||||
return;
|
||||
}
|
||||
if (update.sessionUpdate === "tool_call" || update.sessionUpdate === "tool_call_update") {
|
||||
if (update.sessionUpdate === "tool_call") this.fallbackChunkIds.clear();
|
||||
this.reduceToolCall(update, wireSeq);
|
||||
this.reduceToolCall(update);
|
||||
return;
|
||||
}
|
||||
if (update.sessionUpdate === "plan") this.fallbackChunkIds.clear();
|
||||
this.reduceStateUpdate(update, wireSeq);
|
||||
this.reduceStateUpdate(update);
|
||||
}
|
||||
|
||||
// Historical user messages arrive only as replayed chunks; a live prompt
|
||||
@@ -1379,7 +1196,7 @@ class AcpRuntime {
|
||||
return id;
|
||||
}
|
||||
|
||||
private reduceStateUpdate(update: SessionUpdate, wireSeq: number): void {
|
||||
private reduceStateUpdate(update: SessionUpdate): void {
|
||||
if (update.sessionUpdate === "plan") {
|
||||
this.emit({
|
||||
type: "timeline.item",
|
||||
@@ -1436,7 +1253,6 @@ class AcpRuntime {
|
||||
sessionId: this.options.boundarySessionId,
|
||||
usage: this.lastUsage,
|
||||
});
|
||||
this.noteDeferredUsageUpdate(wireSeq);
|
||||
return;
|
||||
}
|
||||
if (update.sessionUpdate === "compaction_update") {
|
||||
@@ -1451,20 +1267,12 @@ class AcpRuntime {
|
||||
status: update.status === "completed" ? "completed" : "loading",
|
||||
},
|
||||
});
|
||||
if (this.activePrompt?.deferred) this.scheduleDeferredSettle();
|
||||
}
|
||||
}
|
||||
|
||||
private terminalizeTransientItems(
|
||||
state: "completed" | "failed" | "canceled",
|
||||
options?: { preserveQualifyingOpenTools?: boolean; suppressTrailingToolEcho?: boolean },
|
||||
): void {
|
||||
const preserve = options?.preserveQualifyingOpenTools === true;
|
||||
private terminalizeTransientItems(state: "completed" | "failed" | "canceled"): void {
|
||||
for (const [id, snapshot] of this.toolCalls) {
|
||||
if (snapshot.status !== "pending" && snapshot.status !== "in_progress") continue;
|
||||
if (preserve && this.liveOpenToolIds.has(id) && this.toolKeepsTurnOpen(snapshot)) continue;
|
||||
this.liveOpenToolIds.delete(id);
|
||||
if (options?.suppressTrailingToolEcho) this.canceledToolCallIds.add(id);
|
||||
const completed: AcpToolCallSnapshot = {
|
||||
...snapshot,
|
||||
status: state === "completed" ? "completed" : "failed",
|
||||
@@ -1494,42 +1302,18 @@ class AcpRuntime {
|
||||
this.pendingCompactions.clear();
|
||||
}
|
||||
|
||||
private reduceToolCall(
|
||||
update: Extract<SessionUpdate, { sessionUpdate: "tool_call" | "tool_call_update" }>,
|
||||
wireSeq: number,
|
||||
): void {
|
||||
if (
|
||||
update.sessionUpdate === "tool_call_update" &&
|
||||
this.canceledToolCallIds.has(update.toolCallId)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
if (update.sessionUpdate === "tool_call") {
|
||||
this.canceledToolCallIds.delete(update.toolCallId);
|
||||
}
|
||||
private reduceToolCall(update: ToolCall | ToolCallUpdate): void {
|
||||
const current = this.toolCalls.get(update.toolCallId);
|
||||
const wasOpenQualifying =
|
||||
current !== undefined &&
|
||||
this.liveOpenToolIds.has(current.id) &&
|
||||
this.toolKeepsTurnOpen(current);
|
||||
let snapshot = mergeToolCallSnapshot(update, current);
|
||||
const context = { sessionId: this.options.boundarySessionId };
|
||||
for (const transformer of this.transformers)
|
||||
snapshot = transformer.toolCall?.(snapshot, context) ?? snapshot;
|
||||
this.toolCalls.set(snapshot.id, snapshot);
|
||||
const isOpen = snapshot.status === "pending" || snapshot.status === "in_progress";
|
||||
if (this.replayWindow === null) {
|
||||
if (isOpen) this.liveOpenToolIds.add(snapshot.id);
|
||||
else this.liveOpenToolIds.delete(snapshot.id);
|
||||
}
|
||||
this.emit({
|
||||
type: "timeline.item",
|
||||
sessionId: this.options.boundarySessionId,
|
||||
item: toolTimelineItem(snapshot),
|
||||
});
|
||||
const isOpenQualifying =
|
||||
this.liveOpenToolIds.has(snapshot.id) && this.toolKeepsTurnOpen(snapshot);
|
||||
this.noteDeferredToolTransition(wasOpenQualifying, isOpenQualifying, isOpen, snapshot, wireSeq);
|
||||
}
|
||||
|
||||
private vendorNotification(method: string, params: unknown): void {
|
||||
@@ -1592,306 +1376,25 @@ class AcpRuntime {
|
||||
|
||||
private handleUnexpectedTransportClose(): void {
|
||||
if (this.closing || this.processFailed) return;
|
||||
const message = "ACP transport closed unexpectedly";
|
||||
this.processFailed = true;
|
||||
this.settlePendingWork(message);
|
||||
this.settlePendingWork();
|
||||
if (!this.nativeSessionId) return;
|
||||
this.emit({
|
||||
type: "session.runtime_failed",
|
||||
sessionId: this.options.boundarySessionId,
|
||||
error: { message },
|
||||
error: { message: "ACP transport closed unexpectedly" },
|
||||
});
|
||||
}
|
||||
|
||||
private settlePendingWork(failureMessage?: string): void {
|
||||
private settlePendingWork(): void {
|
||||
for (const permission of this.permissions.values()) {
|
||||
permission.resolve({ outcome: { outcome: "cancelled" } });
|
||||
}
|
||||
this.permissions.clear();
|
||||
if (this.activePrompt?.deferred) {
|
||||
this.finishDeferredTurn(
|
||||
this.activePrompt,
|
||||
failureMessage ? { type: "fail", error: { message: failureMessage } } : { type: "cancel" },
|
||||
);
|
||||
}
|
||||
this.commandWaiter?.();
|
||||
this.commandWaiter = null;
|
||||
}
|
||||
|
||||
private finishPromptTurn(
|
||||
turnId: string,
|
||||
state: "completed" | "failed" | "canceled",
|
||||
error?: { message: string },
|
||||
options?: { preserveQualifyingOpenTools?: boolean; suppressTrailingToolEcho?: boolean },
|
||||
): void {
|
||||
this.fallbackChunkIds.clear();
|
||||
this.terminalizeTransientItems(state, options);
|
||||
this.finishTurnPermissions(turnId);
|
||||
if (state === "failed") {
|
||||
this.emit({
|
||||
type: "session.turn",
|
||||
sessionId: this.options.boundarySessionId,
|
||||
turnId,
|
||||
state,
|
||||
error: error ?? { message: "ACP turn failed" },
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.emit({
|
||||
type: "session.turn",
|
||||
sessionId: this.options.boundarySessionId,
|
||||
turnId,
|
||||
state,
|
||||
});
|
||||
}
|
||||
|
||||
private steerDeferredPrompt(input: Extract<ProviderInput, { type: "session.prompt" }>): void {
|
||||
const active = this.activePrompt;
|
||||
const deferred = active?.deferred;
|
||||
if (!active || !deferred || active.cancelling || this.closing || this.processFailed) {
|
||||
this.emit({
|
||||
type: "session.prompt_result",
|
||||
sessionId: this.options.boundarySessionId,
|
||||
clientMessageId: input.prompt.clientMessageId,
|
||||
result: {
|
||||
type: "failed",
|
||||
error: {
|
||||
message: "ACP session can only steer while waiting on deferred background tools",
|
||||
},
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (input.prompt.clearPendingPermissions) {
|
||||
this.finishTurnPermissions(active.turnId);
|
||||
}
|
||||
const prompt = toAcpPrompt(input.prompt);
|
||||
active.wirePromptsInFlight += 1;
|
||||
this.scheduleDeferredSettle();
|
||||
this.replayWindow = null;
|
||||
this.fallbackChunkIds.clear();
|
||||
this.emit({
|
||||
type: "timeline.item",
|
||||
sessionId: this.options.boundarySessionId,
|
||||
item: {
|
||||
type: "user_message",
|
||||
id: input.prompt.clientMessageId,
|
||||
text: prompt
|
||||
.filter((part) => part.type === "text")
|
||||
.map((part) => part.text)
|
||||
.join("\n"),
|
||||
clientMessageId: input.prompt.clientMessageId,
|
||||
},
|
||||
});
|
||||
this.emit({
|
||||
type: "session.prompt_result",
|
||||
sessionId: this.options.boundarySessionId,
|
||||
clientMessageId: input.prompt.clientMessageId,
|
||||
result: { type: "steer", turnId: active.turnId },
|
||||
});
|
||||
const runSteer = async (): Promise<void> => {
|
||||
try {
|
||||
if (
|
||||
this.closing ||
|
||||
this.processFailed ||
|
||||
active.cancelling ||
|
||||
active.deferred !== deferred
|
||||
) {
|
||||
return;
|
||||
}
|
||||
this.fallbackChunkIds.clear();
|
||||
active.lastPromptResponseWireSeq = null;
|
||||
if (active.replyState === "settled_with_open_tools") active.replyState = "idle";
|
||||
const response = await this.call(
|
||||
this.connection.prompt({ sessionId: this.nativeSessionId, prompt }),
|
||||
);
|
||||
await this.drainNotifications();
|
||||
if (this.closing || this.deferredRetirement || active.deferred !== deferred) return;
|
||||
if (response.usage) {
|
||||
this.lastUsage = {
|
||||
...this.lastUsage,
|
||||
inputTokens: response.usage.inputTokens,
|
||||
outputTokens: response.usage.outputTokens,
|
||||
cachedInputTokens: response.usage.cachedReadTokens ?? undefined,
|
||||
};
|
||||
this.emit({
|
||||
type: "session.usage",
|
||||
sessionId: this.options.boundarySessionId,
|
||||
turnId: active.turnId,
|
||||
usage: this.lastUsage,
|
||||
});
|
||||
}
|
||||
if (response.stopReason === "cancelled") {
|
||||
this.finishDeferredTurn(active, { type: "cancel" });
|
||||
return;
|
||||
}
|
||||
if (response.stopReason !== "end_turn" && active.wirePromptsInFlight === 1) {
|
||||
this.finishDeferredTurn(active, { type: "complete", terminalizeTools: true });
|
||||
}
|
||||
} catch (error) {
|
||||
await this.drainNotifications();
|
||||
if (this.closing || this.deferredRetirement || active.deferred !== deferred) return;
|
||||
if (this.processFailed) {
|
||||
this.finishDeferredTurn(active, {
|
||||
type: "fail",
|
||||
error: { message: describeError(error) },
|
||||
});
|
||||
} else {
|
||||
this.emit({
|
||||
type: "session.notice",
|
||||
sessionId: this.options.boundarySessionId,
|
||||
notice: {
|
||||
id: `acp:steer-error:${input.prompt.clientMessageId}`,
|
||||
severity: "error",
|
||||
title: "Follow-up prompt failed",
|
||||
description: describeError(error),
|
||||
},
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
if (active.lastPromptResponseWireSeq === null) {
|
||||
active.lastPromptResponseWireSeq = this.incomingWireSeq;
|
||||
}
|
||||
active.wirePromptsInFlight -= 1;
|
||||
this.scheduleDeferredSettle();
|
||||
}
|
||||
};
|
||||
active.wirePromptLane = active.wirePromptLane.then(runSteer);
|
||||
}
|
||||
|
||||
private async settleDeferredPrompt(active: ActivePrompt): Promise<void> {
|
||||
this.fallbackChunkIds.clear();
|
||||
const outcome = await new Promise<DeferredTurnOutcome>((resolve) => {
|
||||
active.deferred = { timer: null, resolve };
|
||||
this.scheduleDeferredSettle();
|
||||
});
|
||||
if (this.closing || this.deferredRetirement) return;
|
||||
if (outcome.type === "fail") {
|
||||
this.finishPromptTurn(active.turnId, "failed", outcome.error);
|
||||
return;
|
||||
}
|
||||
this.finishPromptTurn(
|
||||
active.turnId,
|
||||
outcome.type === "cancel" ? "canceled" : "completed",
|
||||
undefined,
|
||||
{
|
||||
preserveQualifyingOpenTools: outcome.type === "complete" && !outcome.terminalizeTools,
|
||||
suppressTrailingToolEcho: outcome.type === "cancel",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
private toolKeepsTurnOpen(snapshot: AcpToolCallSnapshot): boolean {
|
||||
const defer = this.options.options.acpOptions?.deferTurnOnRunningTools;
|
||||
if (!defer) return false;
|
||||
return defer.keepsTurnOpen ? defer.keepsTurnOpen(snapshot) : true;
|
||||
}
|
||||
|
||||
private hasQualifyingOpenTools(): boolean {
|
||||
for (const id of this.liveOpenToolIds) {
|
||||
const snapshot = this.toolCalls.get(id);
|
||||
if (snapshot && this.toolKeepsTurnOpen(snapshot)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private hasDeferredBlockers(): boolean {
|
||||
return (
|
||||
(this.activePrompt?.wirePromptsInFlight ?? 0) > 0 ||
|
||||
this.hasQualifyingOpenTools() ||
|
||||
this.permissions.size > 0 ||
|
||||
this.pendingCompactions.size > 0
|
||||
);
|
||||
}
|
||||
|
||||
private shouldDeferTurn(active: ActivePrompt): boolean {
|
||||
if (!this.options.options.acpOptions?.deferTurnOnRunningTools) return false;
|
||||
if (active.cancelling || this.closing || this.processFailed) return false;
|
||||
return this.hasQualifyingOpenTools() || active.crossedEndTurn;
|
||||
}
|
||||
|
||||
private finishDeferredTurn(active: ActivePrompt, outcome: DeferredTurnOutcome): void {
|
||||
const deferred = active.deferred;
|
||||
if (!deferred) return;
|
||||
if (deferred.timer) clearTimeout(deferred.timer);
|
||||
active.deferred = null;
|
||||
deferred.resolve(outcome);
|
||||
}
|
||||
|
||||
private noteDeferredToolTransition(
|
||||
wasOpenQualifying: boolean,
|
||||
isOpenQualifying: boolean,
|
||||
isOpen: boolean,
|
||||
snapshot: AcpToolCallSnapshot,
|
||||
wireSeq: number,
|
||||
): void {
|
||||
const active = this.activePrompt;
|
||||
if (!active || wasOpenQualifying === isOpenQualifying) return;
|
||||
if (!active.deferred && !this.isPostWirePrompt(active, wireSeq)) return;
|
||||
if (!active.deferred && wasOpenQualifying && !isOpen && this.toolKeepsTurnOpen(snapshot)) {
|
||||
active.crossedEndTurn = true;
|
||||
}
|
||||
if (isOpenQualifying) active.replyState = "idle";
|
||||
if (active.deferred) this.scheduleDeferredSettle();
|
||||
}
|
||||
|
||||
private noteDeferredChunk(
|
||||
kind: "agent_message_chunk" | "agent_thought_chunk",
|
||||
wireSeq: number,
|
||||
): void {
|
||||
const active = this.activePrompt;
|
||||
if (!active || !this.isPostWirePrompt(active, wireSeq)) return;
|
||||
if (kind === "agent_message_chunk") active.replyState = "open";
|
||||
else if (active.replyState !== "open") active.replyState = "idle";
|
||||
if (active.deferred) this.scheduleDeferredSettle();
|
||||
}
|
||||
|
||||
private noteDeferredUsageUpdate(wireSeq: number): void {
|
||||
const active = this.activePrompt;
|
||||
if (!active || !this.isPostWirePrompt(active, wireSeq) || active.replyState !== "open") return;
|
||||
active.replyState = this.hasQualifyingOpenTools() ? "settled_with_open_tools" : "settled";
|
||||
if (active.deferred) this.scheduleDeferredSettle();
|
||||
}
|
||||
|
||||
private scheduleDeferredSettle(): void {
|
||||
const active = this.activePrompt;
|
||||
const deferred = active?.deferred;
|
||||
const config = this.options.options.acpOptions?.deferTurnOnRunningTools;
|
||||
if (!active || !deferred || !config || active.cancelling) return;
|
||||
if (deferred.timer) {
|
||||
clearTimeout(deferred.timer);
|
||||
deferred.timer = null;
|
||||
}
|
||||
if (this.hasDeferredBlockers()) return;
|
||||
const settled =
|
||||
active.replyState === "settled" || active.replyState === "settled_with_open_tools";
|
||||
const delayMs = settled
|
||||
? (config.settleDelayMs ?? DEFAULT_DEFERRED_SETTLE_DELAY_MS)
|
||||
: (config.quietLimitMs ?? DEFAULT_DEFERRED_QUIET_LIMIT_MS);
|
||||
deferred.timer = setTimeout(() => {
|
||||
deferred.timer = null;
|
||||
void this.trySettleDeferredTurn(active, deferred);
|
||||
}, delayMs);
|
||||
}
|
||||
|
||||
private async trySettleDeferredTurn(
|
||||
active: ActivePrompt,
|
||||
deferred: DeferredTurnState,
|
||||
): Promise<void> {
|
||||
await this.drainNotifications();
|
||||
if (
|
||||
this.closing ||
|
||||
this.processFailed ||
|
||||
active.cancelling ||
|
||||
active.deferred !== deferred ||
|
||||
deferred.timer !== null ||
|
||||
this.hasDeferredBlockers()
|
||||
) {
|
||||
return;
|
||||
}
|
||||
this.finishDeferredTurn(active, { type: "complete", terminalizeTools: true });
|
||||
}
|
||||
|
||||
private waitForInitialCommands(): Promise<void> {
|
||||
if (this.receivedInitialCommands) return Promise.resolve();
|
||||
const timeoutMs = this.options.options.acpOptions?.initialCommandsTimeoutMs ?? 1_000;
|
||||
@@ -1918,10 +1421,9 @@ class AcpRuntime {
|
||||
}
|
||||
}
|
||||
|
||||
function routeIncomingMessages(
|
||||
function routeVendorNotifications(
|
||||
stream: Stream,
|
||||
receiveVendor: (method: string, params: unknown) => void,
|
||||
observeWire: (message: unknown) => void,
|
||||
receive: (method: string, params: unknown) => void,
|
||||
): Stream {
|
||||
const clientMethods = new Set<string>(Object.values(CLIENT_METHODS));
|
||||
return {
|
||||
@@ -1933,14 +1435,11 @@ function routeIncomingMessages(
|
||||
// The SDK dispatches extensions asynchronously and can resolve a later response first.
|
||||
// Run synchronous vendor transforms in wire order, inside the configuration transaction.
|
||||
try {
|
||||
receiveVendor(message.method, message.params);
|
||||
receive(message.method, message.params);
|
||||
} catch (error) {
|
||||
console.error("Error handling ACP vendor notification", error);
|
||||
}
|
||||
} else {
|
||||
observeWire(message);
|
||||
controller.enqueue(message);
|
||||
}
|
||||
} else controller.enqueue(message);
|
||||
},
|
||||
}),
|
||||
),
|
||||
@@ -1971,12 +1470,11 @@ function permissionOptionBehavior(
|
||||
|
||||
function ownConnectorStream(source: Stream): {
|
||||
stream: Stream;
|
||||
close(options?: { force?: boolean; timeoutMs?: number }): Promise<void>;
|
||||
whenClosed(): Promise<void> | null;
|
||||
close(): Promise<void>;
|
||||
} {
|
||||
const reader = source.readable.getReader();
|
||||
const writer = source.writable.getWriter();
|
||||
let closing: Promise<void> | null = null;
|
||||
let closed = false;
|
||||
const stream: Stream = {
|
||||
readable: new ReadableStream({
|
||||
async pull(controller) {
|
||||
@@ -1998,29 +1496,13 @@ function ownConnectorStream(source: Stream): {
|
||||
};
|
||||
return {
|
||||
stream,
|
||||
whenClosed: () => closing,
|
||||
async close(options?: { force?: boolean; timeoutMs?: number }) {
|
||||
if (!closing) {
|
||||
const closeWrite = options?.force
|
||||
? writer.abort(new Error("Paseo aborted the ACP connector"))
|
||||
: writer.close();
|
||||
closing = Promise.allSettled([
|
||||
reader.cancel(new Error("Paseo closed the ACP connector")),
|
||||
closeWrite,
|
||||
]).then((results) => {
|
||||
if (options?.timeoutMs === undefined) return undefined;
|
||||
const rejected = results.find(
|
||||
(result): result is PromiseRejectedResult => result.status === "rejected",
|
||||
);
|
||||
if (rejected) throw rejected.reason;
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
if (options?.timeoutMs !== undefined) {
|
||||
await withTimeout(closing, options.timeoutMs, "ACP connector did not close");
|
||||
} else {
|
||||
await closing.catch(() => undefined);
|
||||
}
|
||||
async close() {
|
||||
if (closed) return;
|
||||
closed = true;
|
||||
await Promise.allSettled([
|
||||
reader.cancel(new Error("Paseo closed the ACP connector")),
|
||||
writer.close(),
|
||||
]);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -53,18 +53,6 @@ export interface AcpOptions {
|
||||
initialCommandsTimeoutMs?: number;
|
||||
/** Allow delayed session/load updates before publishing the session as ready. */
|
||||
loadReplayQuietPeriodMs?: number;
|
||||
/**
|
||||
* Keep a turn open after `end_turn` while qualifying tool calls are still running,
|
||||
* settling once those tools finish and the agent finishes its follow-up reply.
|
||||
*/
|
||||
deferTurnOnRunningTools?: {
|
||||
/** Delay after `usage_update` closes a follow-up reply before settling. Defaults to 500ms. */
|
||||
settleDelayMs?: number;
|
||||
/** Quiet limit after qualifying tools finish if no reply settles via `usage_update`. Defaults to 120_000ms. */
|
||||
quietLimitMs?: number;
|
||||
/** Predicate deciding whether an open tool call keeps the turn open. Defaults to all running tools. */
|
||||
keepsTurnOpen?: (toolCall: AcpToolCallSnapshot) => boolean;
|
||||
};
|
||||
/** An unattended mode that approves ACP allow-once requests in the specified native mode. */
|
||||
autoAcceptMode?: {
|
||||
mode: Omit<ProviderMode, "isUnattended">;
|
||||
|
||||
@@ -96,12 +96,12 @@ test.each([
|
||||
])(
|
||||
"duration %s owns the window's identity and both names",
|
||||
(durationSeconds, id, label, shortLabel) => {
|
||||
const window = windowFromReportedDuration({
|
||||
durationSeconds: durationSeconds as number | null,
|
||||
unknown: { id: "primary", label: "Primary limit", shortLabel: "" },
|
||||
utilizationPct: 11,
|
||||
});
|
||||
expect(window).toMatchObject({ id, label, shortLabel, usedPct: 11 });
|
||||
expect(window.durationSeconds).toBe(durationSeconds ?? undefined);
|
||||
expect(
|
||||
windowFromReportedDuration({
|
||||
durationSeconds: durationSeconds as number | null,
|
||||
unknown: { id: "primary", label: "Primary limit", shortLabel: "" },
|
||||
utilizationPct: 11,
|
||||
}),
|
||||
).toMatchObject({ id, label, shortLabel, usedPct: 11 });
|
||||
},
|
||||
);
|
||||
|
||||
@@ -16,8 +16,6 @@ export interface UsageWindow {
|
||||
usedPct?: number | null;
|
||||
remainingPct?: number | null;
|
||||
resetsAt?: string | null;
|
||||
/** Full length of the quota window when known. */
|
||||
durationSeconds?: number;
|
||||
runsOutAt?: string | null;
|
||||
shortfallPct?: number | null;
|
||||
tone?: "default" | "ok" | "warning" | "danger";
|
||||
@@ -50,8 +48,6 @@ export type UsageReport =
|
||||
| {
|
||||
status: "available";
|
||||
planLabel?: string;
|
||||
/** When the provider measured the quota, if the report returns a previous reading. */
|
||||
observedAt?: string;
|
||||
windows: UsageWindow[];
|
||||
balances?: UsageBalance[];
|
||||
details?: UsageDetail[];
|
||||
@@ -100,7 +96,6 @@ export function windowFromUsedPct(input: {
|
||||
shortLabel?: string;
|
||||
summary?: boolean;
|
||||
utilizationPct: number | null | undefined;
|
||||
durationSeconds?: number;
|
||||
resetsAt?: string | null;
|
||||
tone?: UsageWindow["tone"];
|
||||
}): UsageWindow {
|
||||
@@ -112,7 +107,6 @@ export function windowFromUsedPct(input: {
|
||||
remainingPct: usedPct === null ? null : Math.max(0, 100 - usedPct),
|
||||
resetsAt: input.resetsAt ?? null,
|
||||
};
|
||||
if (input.durationSeconds !== undefined) window.durationSeconds = input.durationSeconds;
|
||||
if (input.shortLabel !== undefined) window.shortLabel = input.shortLabel;
|
||||
if (input.summary) window.summary = true;
|
||||
if (input.tone) window.tone = input.tone;
|
||||
@@ -135,10 +129,11 @@ export function windowFromReportedDuration(input: {
|
||||
summary?: boolean;
|
||||
tone?: UsageWindow["tone"];
|
||||
}): UsageWindow {
|
||||
const reported = input.durationSeconds;
|
||||
const duration =
|
||||
reported !== null && Number.isFinite(reported) && reported > 0 ? reported : undefined;
|
||||
const name = duration === undefined ? input.unknown : durationWindowName(duration);
|
||||
const duration = input.durationSeconds;
|
||||
const name =
|
||||
duration !== null && Number.isFinite(duration) && duration > 0
|
||||
? durationWindowName(duration)
|
||||
: input.unknown;
|
||||
const scope = input.scope;
|
||||
return windowFromUsedPct({
|
||||
id: scope ? `${scope.id}:${name.id}` : name.id,
|
||||
@@ -147,7 +142,6 @@ export function windowFromReportedDuration(input: {
|
||||
? `${scope.label}${name.shortLabel ? ` ${name.shortLabel}` : ""}`
|
||||
: name.shortLabel,
|
||||
utilizationPct: input.utilizationPct,
|
||||
durationSeconds: duration,
|
||||
resetsAt: input.resetsAt,
|
||||
summary: input.summary,
|
||||
tone: input.tone,
|
||||
|
||||
@@ -6992,7 +6992,6 @@ export const ProviderUsageWindowSchema = z.object({
|
||||
usedPct: z.number().nullable().optional(),
|
||||
remainingPct: z.number().nullable().optional(),
|
||||
resetsAt: z.string().nullable().optional(),
|
||||
durationSeconds: z.number().optional(),
|
||||
runsOutAt: z.string().nullable().optional(),
|
||||
shortfallPct: z.number().nullable().optional(),
|
||||
tone: ProviderUsageToneSchema.optional(),
|
||||
@@ -7055,7 +7054,6 @@ export const UsageProblemSchema = z.discriminatedUnion("kind", [
|
||||
const AvailableUsageReportSchema = z.object({
|
||||
status: z.literal("available"),
|
||||
planLabel: z.string().optional(),
|
||||
observedAt: z.string().optional(),
|
||||
windows: z.array(ProviderUsageWindowSchema),
|
||||
balances: z.array(ProviderUsageBalanceSchema).optional(),
|
||||
details: z.array(ProviderUsageDetailSchema).optional(),
|
||||
|
||||
@@ -881,7 +881,6 @@ export class AgentManager {
|
||||
>();
|
||||
private readonly collectingRuntimes = new Set<string>();
|
||||
private readonly lifecycleMutationTails = new Map<string, Promise<void>>();
|
||||
private readonly pendingCancellations = new Map<string, Promise<unknown>>();
|
||||
private readonly agentStreamCoalescer: AgentStreamCoalescer;
|
||||
private mcpBaseUrl: string | null;
|
||||
private readonly mcpAuthToken: string | null;
|
||||
@@ -2464,83 +2463,80 @@ export class AgentManager {
|
||||
// reload or close; providers do no sequencing of their own.
|
||||
|
||||
async setAgentMode(agentId: string, modeId: string): Promise<AgentProviderNotice | null> {
|
||||
return this.runLifecycleMutation(agentId, () =>
|
||||
this.withLiveInteractiveSessionUnlocked(agentId, async (agent) => {
|
||||
const notice = (await agent.session.setMode(modeId)) ?? null;
|
||||
await this.drainSessionEvents(agentId);
|
||||
const currentMode = (await agent.session.getCurrentMode()) ?? modeId;
|
||||
agent.config.modeId = currentMode ?? undefined;
|
||||
agent.currentModeId = currentMode;
|
||||
// Update runtimeInfo to reflect the new mode
|
||||
if (agent.runtimeInfo) {
|
||||
agent.runtimeInfo = { ...agent.runtimeInfo, modeId: currentMode };
|
||||
}
|
||||
this.touchUpdatedAt(agent);
|
||||
this.emitState(agent);
|
||||
return notice;
|
||||
}),
|
||||
);
|
||||
return this.runLifecycleMutation(agentId, async () => {
|
||||
const agent = await this.ensureInteractiveSessionUnlocked(agentId);
|
||||
const notice = (await agent.session.setMode(modeId)) ?? null;
|
||||
await this.drainSessionEvents(agentId);
|
||||
const currentMode = (await agent.session.getCurrentMode()) ?? modeId;
|
||||
agent.config.modeId = currentMode ?? undefined;
|
||||
agent.currentModeId = currentMode;
|
||||
// Update runtimeInfo to reflect the new mode
|
||||
if (agent.runtimeInfo) {
|
||||
agent.runtimeInfo = { ...agent.runtimeInfo, modeId: currentMode };
|
||||
}
|
||||
this.touchUpdatedAt(agent);
|
||||
this.emitState(agent);
|
||||
return notice;
|
||||
});
|
||||
}
|
||||
|
||||
async setAgentModel(agentId: string, modelId: string | null): Promise<void> {
|
||||
return this.runLifecycleMutation(agentId, () =>
|
||||
this.withLiveInteractiveSessionUnlocked(agentId, async (agent) => {
|
||||
const normalizedModelId =
|
||||
typeof modelId === "string" && modelId.trim().length > 0 ? modelId : null;
|
||||
return this.runLifecycleMutation(agentId, async () => {
|
||||
const agent = await this.ensureInteractiveSessionUnlocked(agentId);
|
||||
const normalizedModelId =
|
||||
typeof modelId === "string" && modelId.trim().length > 0 ? modelId : null;
|
||||
|
||||
const selection = await agent.session.setModel?.(normalizedModelId);
|
||||
await this.drainSessionEvents(agentId);
|
||||
const selection = await agent.session.setModel?.(normalizedModelId);
|
||||
await this.drainSessionEvents(agentId);
|
||||
|
||||
// A reset clears the preference even when the provider retains its active model.
|
||||
let effectiveModelId = normalizedModelId;
|
||||
if (normalizedModelId !== null && selection) effectiveModelId = selection.model;
|
||||
// A reset clears the preference even when the provider retains its active model.
|
||||
let effectiveModelId = normalizedModelId;
|
||||
if (normalizedModelId !== null && selection) effectiveModelId = selection.model;
|
||||
|
||||
agent.config.model = effectiveModelId ?? undefined;
|
||||
if (agent.runtimeInfo) {
|
||||
agent.runtimeInfo = { ...agent.runtimeInfo, model: effectiveModelId };
|
||||
}
|
||||
this.refreshSessionPersistence(agent);
|
||||
this.touchUpdatedAt(agent);
|
||||
this.emitState(agent);
|
||||
}),
|
||||
);
|
||||
agent.config.model = effectiveModelId ?? undefined;
|
||||
if (agent.runtimeInfo) {
|
||||
agent.runtimeInfo = { ...agent.runtimeInfo, model: effectiveModelId };
|
||||
}
|
||||
this.refreshSessionPersistence(agent);
|
||||
this.touchUpdatedAt(agent);
|
||||
this.emitState(agent);
|
||||
});
|
||||
}
|
||||
|
||||
async setAgentThinkingOption(
|
||||
agentId: string,
|
||||
thinkingOptionId: string | null,
|
||||
): Promise<AgentProviderNotice | null> {
|
||||
return this.runLifecycleMutation(agentId, () =>
|
||||
this.withLiveInteractiveSessionUnlocked(agentId, async (agent) => {
|
||||
const normalizedThinkingOptionId =
|
||||
typeof thinkingOptionId === "string" && thinkingOptionId.trim().length > 0
|
||||
? thinkingOptionId
|
||||
: null;
|
||||
return this.runLifecycleMutation(agentId, async () => {
|
||||
const agent = await this.ensureInteractiveSessionUnlocked(agentId);
|
||||
const normalizedThinkingOptionId =
|
||||
typeof thinkingOptionId === "string" && thinkingOptionId.trim().length > 0
|
||||
? thinkingOptionId
|
||||
: null;
|
||||
|
||||
let notice: AgentProviderNotice | null = null;
|
||||
if (agent.session.setThinkingOption) {
|
||||
notice = (await agent.session.setThinkingOption(normalizedThinkingOptionId)) ?? null;
|
||||
}
|
||||
await this.drainSessionEvents(agentId);
|
||||
let notice: AgentProviderNotice | null = null;
|
||||
if (agent.session.setThinkingOption) {
|
||||
notice = (await agent.session.setThinkingOption(normalizedThinkingOptionId)) ?? null;
|
||||
}
|
||||
await this.drainSessionEvents(agentId);
|
||||
|
||||
let effectiveThinkingOptionId = normalizedThinkingOptionId;
|
||||
const runtimeInfo = await agent.session.getRuntimeInfo();
|
||||
if (runtimeInfo.thinkingOptionId !== undefined) {
|
||||
effectiveThinkingOptionId = runtimeInfo.thinkingOptionId;
|
||||
}
|
||||
let effectiveThinkingOptionId = normalizedThinkingOptionId;
|
||||
const runtimeInfo = await agent.session.getRuntimeInfo();
|
||||
if (runtimeInfo.thinkingOptionId !== undefined) {
|
||||
effectiveThinkingOptionId = runtimeInfo.thinkingOptionId;
|
||||
}
|
||||
|
||||
agent.config.thinkingOptionId = effectiveThinkingOptionId ?? undefined;
|
||||
if (agent.runtimeInfo) {
|
||||
agent.runtimeInfo = {
|
||||
...agent.runtimeInfo,
|
||||
thinkingOptionId: effectiveThinkingOptionId,
|
||||
};
|
||||
}
|
||||
this.touchUpdatedAt(agent);
|
||||
this.emitState(agent);
|
||||
return notice;
|
||||
}),
|
||||
);
|
||||
agent.config.thinkingOptionId = effectiveThinkingOptionId ?? undefined;
|
||||
if (agent.runtimeInfo) {
|
||||
agent.runtimeInfo = {
|
||||
...agent.runtimeInfo,
|
||||
thinkingOptionId: effectiveThinkingOptionId,
|
||||
};
|
||||
}
|
||||
this.touchUpdatedAt(agent);
|
||||
this.emitState(agent);
|
||||
return notice;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2550,45 +2546,42 @@ export class AgentManager {
|
||||
* one step once the provider accepts. Patches to one agent run one at a time, in arrival order.
|
||||
*/
|
||||
async setAgentOptions(agentId: string, requested: ProviderOptionsPatch): Promise<void> {
|
||||
return this.runLifecycleMutation(agentId, () =>
|
||||
this.withLiveInteractiveSessionUnlocked(agentId, async (agent) => {
|
||||
const patch = this.convertLegacyOptions(agent.provider, requested);
|
||||
let ended: ProviderOptionsPatch = {};
|
||||
let sent: ProviderOptionsPatch = {};
|
||||
if (Object.keys(patch).length > 0) {
|
||||
// A provider that cannot apply options to a running agent must not store them either.
|
||||
if (!agent.session.applyOptions) {
|
||||
throw new ProviderOptionsValidationError(
|
||||
agent.provider,
|
||||
Object.keys(patch).map((key) => ({
|
||||
path: [key],
|
||||
message: "cannot change on a running session; it applies when the agent is opened",
|
||||
})),
|
||||
);
|
||||
}
|
||||
const set = Object.fromEntries(
|
||||
Object.entries(patch).filter(([, value]) => value != null),
|
||||
return this.runLifecycleMutation(agentId, async () => {
|
||||
const agent = await this.ensureInteractiveSessionUnlocked(agentId);
|
||||
const patch = this.convertLegacyOptions(agent.provider, requested);
|
||||
let ended: ProviderOptionsPatch = {};
|
||||
let sent: ProviderOptionsPatch = {};
|
||||
if (Object.keys(patch).length > 0) {
|
||||
// A provider that cannot apply options to a running agent must not store them either.
|
||||
if (!agent.session.applyOptions) {
|
||||
throw new ProviderOptionsValidationError(
|
||||
agent.provider,
|
||||
Object.keys(patch).map((key) => ({
|
||||
path: [key],
|
||||
message: "cannot change on a running session; it applies when the agent is opened",
|
||||
})),
|
||||
);
|
||||
const resolved = this.effectiveOptionsFor(agent.provider, set);
|
||||
sent = Object.fromEntries(Object.keys(patch).map((key) => [key, resolved[key] ?? null]));
|
||||
const modelBefore = agent.runtimeInfo?.model;
|
||||
ended = (await agent.session.applyOptions(sent)) ?? {};
|
||||
// Changes the provider made on its own while applying are older than its final answer.
|
||||
await this.drainSessionEvents(agentId);
|
||||
await this.refreshRuntimeInfo(agent, { emit: false });
|
||||
// An option can choose the model too, as an fx connection does. Reopening the agent on
|
||||
// the earlier preference would send that model to the new connection.
|
||||
const modelAfter = agent.runtimeInfo?.model;
|
||||
if (agent.config.model && modelAfter && modelAfter !== modelBefore) {
|
||||
agent.config.model = modelAfter;
|
||||
}
|
||||
}
|
||||
this.storeOptionsPatch({ agent, patch: { ...patch, ...ended } });
|
||||
this.updateEffectiveOptions({ agent, sent, reported: ended });
|
||||
this.touchUpdatedAt(agent);
|
||||
this.emitState(agent);
|
||||
}),
|
||||
);
|
||||
const set = Object.fromEntries(Object.entries(patch).filter(([, value]) => value != null));
|
||||
const resolved = this.effectiveOptionsFor(agent.provider, set);
|
||||
sent = Object.fromEntries(Object.keys(patch).map((key) => [key, resolved[key] ?? null]));
|
||||
const modelBefore = agent.runtimeInfo?.model;
|
||||
ended = (await agent.session.applyOptions(sent)) ?? {};
|
||||
// Changes the provider made on its own while applying are older than its final answer.
|
||||
await this.drainSessionEvents(agentId);
|
||||
await this.refreshRuntimeInfo(agent, { emit: false });
|
||||
// An option can choose the model too, as an fx connection does. Reopening the agent on
|
||||
// the earlier preference would send that model to the new connection.
|
||||
const modelAfter = agent.runtimeInfo?.model;
|
||||
if (agent.config.model && modelAfter && modelAfter !== modelBefore) {
|
||||
agent.config.model = modelAfter;
|
||||
}
|
||||
}
|
||||
this.storeOptionsPatch({ agent, patch: { ...patch, ...ended } });
|
||||
this.updateEffectiveOptions({ agent, sent, reported: ended });
|
||||
this.touchUpdatedAt(agent);
|
||||
this.emitState(agent);
|
||||
});
|
||||
}
|
||||
|
||||
/** The config as the opened session left it: its own difference from the options it was given. */
|
||||
@@ -3274,33 +3267,6 @@ export class AgentManager {
|
||||
return this.requireSessionAgent(agentId);
|
||||
}
|
||||
|
||||
/** Inside the agent's lane: transparently reopens a retired plugin session before applying config. */
|
||||
private async withLiveInteractiveSessionUnlocked<T>(
|
||||
agentId: string,
|
||||
operation: (agent: ActiveManagedAgent) => Promise<T>,
|
||||
): Promise<T> {
|
||||
const pendingCancellation = this.pendingCancellations.get(agentId);
|
||||
if (pendingCancellation) {
|
||||
await this.waitWithTimeout({
|
||||
operation: pendingCancellation.then(
|
||||
() => undefined,
|
||||
() => undefined,
|
||||
),
|
||||
timeoutMs: this.rescueTimeouts.interruptSessionMs,
|
||||
});
|
||||
}
|
||||
const agent = await this.ensureInteractiveSessionUnlocked(agentId);
|
||||
try {
|
||||
return await operation(agent);
|
||||
} catch (error) {
|
||||
if (!isStaleProviderSessionError(error)) throw error;
|
||||
await this.runs.getPendingRun(agentId)?.settledPromise.catch(() => undefined);
|
||||
if (this.hasInFlightRun(agentId)) throw error;
|
||||
await this.trackAgentRegistrationOperation(this.reloadAgentSessionInternal(agentId));
|
||||
return await operation(this.requireSessionAgent(agentId));
|
||||
}
|
||||
}
|
||||
|
||||
private async *streamAfterHistoryLoad(
|
||||
agentId: string,
|
||||
prompt: AgentPromptInput,
|
||||
@@ -3959,18 +3925,10 @@ export class AgentManager {
|
||||
}
|
||||
|
||||
async cancelAgentRun(agentId: string): Promise<AgentRunCancellationResult> {
|
||||
const cancellation = this.runForegroundMutation(agentId, () => {
|
||||
return this.runForegroundMutation(agentId, () => {
|
||||
this.requireSessionAgent(agentId).pendingReplacement = false;
|
||||
return this.cancelAgentRunNow(agentId);
|
||||
});
|
||||
this.pendingCancellations.set(agentId, cancellation);
|
||||
try {
|
||||
return await cancellation;
|
||||
} finally {
|
||||
if (this.pendingCancellations.get(agentId) === cancellation) {
|
||||
this.pendingCancellations.delete(agentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async cancelAgentRunNow(agentId: string): Promise<AgentRunCancellationResult> {
|
||||
|
||||
@@ -6,7 +6,6 @@ import { createIdleRuntimeCleanup } from "./idle-runtime-cleanup/index.js";
|
||||
import { relative } from "node:path";
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { runAcpProvider, type AcpStreamMessage } from "@getpaseo/plugin/server/acp";
|
||||
import type {
|
||||
ProviderConnection,
|
||||
ProviderLaunch,
|
||||
@@ -14,7 +13,6 @@ import type {
|
||||
ProviderInput,
|
||||
ProviderRegistration,
|
||||
} from "@getpaseo/plugin/server/provider";
|
||||
import { sendPreparedPromptToAgent } from "./agent-prompt.js";
|
||||
import { setImmediate as nextTurn } from "node:timers/promises";
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { createTestLogger } from "../../test-utils/test-logger.js";
|
||||
@@ -2816,592 +2814,3 @@ test("resumes a goose session saved by the generic ACP provider", async () => {
|
||||
await plugins.shutdown();
|
||||
}
|
||||
});
|
||||
|
||||
test("preserves a deferred ACP background job on steer and cancels it on explicit Stop through AgentManager", async () => {
|
||||
const logger = createTestLogger();
|
||||
const home = await mkdtemp(join(tmpdir(), "paseo-acp-deferred-daemon-"));
|
||||
const storage = new AgentStorage(join(home, "agents"), logger);
|
||||
let cancelCount = 0;
|
||||
let promptCount = 0;
|
||||
let currentMode = "default";
|
||||
let notifyAgent: ((message: AcpStreamMessage) => void) | null = null;
|
||||
let holdNextPrompt: ((release: () => void) => void) | null = null;
|
||||
const modeConfig = () => [
|
||||
{
|
||||
id: "mode",
|
||||
name: "Mode",
|
||||
category: "mode",
|
||||
type: "select",
|
||||
currentValue: currentMode,
|
||||
options: [
|
||||
{ value: "default", name: "Default" },
|
||||
{ value: "plan", name: "Plan" },
|
||||
],
|
||||
},
|
||||
];
|
||||
const registration = runAcpProvider({
|
||||
id: "deferred-acp-daemon",
|
||||
label: "Deferred ACP Daemon",
|
||||
acpOptions: {
|
||||
deferTurnOnRunningTools: { settleDelayMs: 25, quietLimitMs: 1_000 },
|
||||
},
|
||||
connector() {
|
||||
let controller!: ReadableStreamDefaultController<AcpStreamMessage>;
|
||||
const readable = new ReadableStream<AcpStreamMessage>({
|
||||
start(ctrl) {
|
||||
controller = ctrl;
|
||||
},
|
||||
});
|
||||
const send = (message: AcpStreamMessage) => controller.enqueue(message);
|
||||
notifyAgent = send;
|
||||
const writable = new WritableStream<AcpStreamMessage>({
|
||||
write(message) {
|
||||
if (!("method" in message)) return;
|
||||
if (message.method === "session/cancel") {
|
||||
cancelCount += 1;
|
||||
return;
|
||||
}
|
||||
if (!("id" in message)) return;
|
||||
if (message.method === "initialize") {
|
||||
send({
|
||||
jsonrpc: "2.0",
|
||||
id: message.id,
|
||||
result: { protocolVersion: 1, agentCapabilities: { loadSession: true } },
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (message.method === "session/new") {
|
||||
send({
|
||||
jsonrpc: "2.0",
|
||||
id: message.id,
|
||||
result: { sessionId: "acp-s1", configOptions: modeConfig() },
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (message.method === "session/load") {
|
||||
send({ jsonrpc: "2.0", id: message.id, result: { configOptions: modeConfig() } });
|
||||
return;
|
||||
}
|
||||
if (message.method === "session/set_config_option") {
|
||||
const params = message.params as { value?: string } | undefined;
|
||||
if (typeof params?.value === "string") currentMode = params.value;
|
||||
send({ jsonrpc: "2.0", id: message.id, result: { configOptions: modeConfig() } });
|
||||
return;
|
||||
}
|
||||
if (message.method === "session/prompt") {
|
||||
promptCount += 1;
|
||||
if (promptCount === 1) {
|
||||
send({
|
||||
jsonrpc: "2.0",
|
||||
method: "session/update",
|
||||
params: {
|
||||
sessionId: "acp-s1",
|
||||
update: {
|
||||
sessionUpdate: "tool_call",
|
||||
toolCallId: "bg-job-1",
|
||||
name: "run_command",
|
||||
title: "Background job",
|
||||
status: "in_progress",
|
||||
},
|
||||
},
|
||||
});
|
||||
} else if (promptCount === 2) {
|
||||
send({
|
||||
jsonrpc: "2.0",
|
||||
method: "session/update",
|
||||
params: {
|
||||
sessionId: "acp-s1",
|
||||
update: {
|
||||
sessionUpdate: "agent_message_chunk",
|
||||
content: { type: "text", text: "Steered reply" },
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
send({
|
||||
jsonrpc: "2.0",
|
||||
method: "session/update",
|
||||
params: {
|
||||
sessionId: "acp-s1",
|
||||
update: {
|
||||
sessionUpdate: "tool_call",
|
||||
toolCallId: "bg-job-2",
|
||||
name: "run_command",
|
||||
title: "Cancelable job",
|
||||
status: "in_progress",
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
if (holdNextPrompt) {
|
||||
const hook = holdNextPrompt;
|
||||
holdNextPrompt = null;
|
||||
hook(() =>
|
||||
send({ jsonrpc: "2.0", id: message.id, result: { stopReason: "cancelled" } }),
|
||||
);
|
||||
return;
|
||||
}
|
||||
send({ jsonrpc: "2.0", id: message.id, result: { stopReason: "end_turn" } });
|
||||
return;
|
||||
}
|
||||
if (message.method === "session/close") {
|
||||
send({ jsonrpc: "2.0", id: message.id, result: {} });
|
||||
}
|
||||
},
|
||||
});
|
||||
return { readable, writable };
|
||||
},
|
||||
});
|
||||
const plugins = new PluginAgentClientRegistry(logger);
|
||||
plugins.replace([registration]);
|
||||
const manager = new AgentManager({ clients: plugins.clients(), registry: storage, logger });
|
||||
try {
|
||||
const agent = await manager.createAgent({ provider: registration.id, cwd: home }, undefined, {
|
||||
workspaceId: undefined,
|
||||
});
|
||||
const first = await sendPreparedPromptToAgent({
|
||||
agentManager: manager,
|
||||
agentStorage: storage,
|
||||
agentId: agent.id,
|
||||
prompt: "start background job",
|
||||
logger,
|
||||
});
|
||||
expect(first.disposition).toBe("turn_started");
|
||||
if (first.disposition === "turn_started") await first.started;
|
||||
await new Promise((resolve) => setTimeout(resolve, 40));
|
||||
expect(manager.getAgent(agent.id)?.lifecycle).toBe("running");
|
||||
|
||||
// Follow-up steer through AgentManager preserves the background job without session/cancel.
|
||||
const followUp = await sendPreparedPromptToAgent({
|
||||
agentManager: manager,
|
||||
agentStorage: storage,
|
||||
agentId: agent.id,
|
||||
prompt: "still working?",
|
||||
activeTurnBehavior: "steer",
|
||||
logger,
|
||||
});
|
||||
expect(followUp.disposition).toBe("steered");
|
||||
expect(cancelCount).toBe(0);
|
||||
await new Promise((resolve) => setTimeout(resolve, 40));
|
||||
expect(manager.getAgent(agent.id)?.lifecycle).toBe("running");
|
||||
|
||||
// Completing the job + reply + usage_update settles the turn cleanly.
|
||||
notifyAgent!({
|
||||
jsonrpc: "2.0",
|
||||
method: "session/update",
|
||||
params: {
|
||||
sessionId: "acp-s1",
|
||||
update: { sessionUpdate: "tool_call_update", toolCallId: "bg-job-1", status: "completed" },
|
||||
},
|
||||
});
|
||||
notifyAgent!({
|
||||
jsonrpc: "2.0",
|
||||
method: "session/update",
|
||||
params: {
|
||||
sessionId: "acp-s1",
|
||||
update: {
|
||||
sessionUpdate: "agent_message_chunk",
|
||||
content: { type: "text", text: "Background job finished." },
|
||||
},
|
||||
},
|
||||
});
|
||||
notifyAgent!({
|
||||
jsonrpc: "2.0",
|
||||
method: "session/update",
|
||||
params: {
|
||||
sessionId: "acp-s1",
|
||||
update: { sessionUpdate: "usage_update", used: 120, size: 1000 },
|
||||
},
|
||||
});
|
||||
await expect.poll(() => manager.getAgent(agent.id)?.lifecycle, { timeout: 3_000 }).toBe("idle");
|
||||
expect(cancelCount).toBe(0);
|
||||
|
||||
// Start a second deferred job, send two steers while steer 1 waits on ACP, and press Stop.
|
||||
let heldSteerResponse: (() => void) | null = null;
|
||||
const second = await sendPreparedPromptToAgent({
|
||||
agentManager: manager,
|
||||
agentStorage: storage,
|
||||
agentId: agent.id,
|
||||
prompt: "start cancelable job",
|
||||
logger,
|
||||
});
|
||||
if (second.disposition === "turn_started") await second.started;
|
||||
await new Promise((resolve) => setTimeout(resolve, 40));
|
||||
expect(manager.getAgent(agent.id)?.lifecycle).toBe("running");
|
||||
|
||||
// Hold the next steer prompt so Stop races with a queued second steer.
|
||||
holdNextPrompt = (release) => {
|
||||
heldSteerResponse = release;
|
||||
};
|
||||
const steerOne = await sendPreparedPromptToAgent({
|
||||
agentManager: manager,
|
||||
agentStorage: storage,
|
||||
agentId: agent.id,
|
||||
prompt: "held steer 1",
|
||||
activeTurnBehavior: "steer",
|
||||
logger,
|
||||
});
|
||||
expect(steerOne.disposition).toBe("steered");
|
||||
const steerTwo = await sendPreparedPromptToAgent({
|
||||
agentManager: manager,
|
||||
agentStorage: storage,
|
||||
agentId: agent.id,
|
||||
prompt: "queued steer 2",
|
||||
activeTurnBehavior: "steer",
|
||||
logger,
|
||||
});
|
||||
expect(steerTwo.disposition).toBe("steered");
|
||||
await expect.poll(() => heldSteerResponse).not.toBeNull();
|
||||
const promptsBeforeStop = promptCount;
|
||||
|
||||
// Stop must send session/cancel immediately, retire the deferred session cleanly,
|
||||
// and never dispatch the queued steer 2 to ACP.
|
||||
await manager.cancelAgentRun(agent.id);
|
||||
expect(cancelCount).toBe(1);
|
||||
await expect.poll(() => manager.getAgent(agent.id)?.lifecycle, { timeout: 3_000 }).toBe("idle");
|
||||
expect(promptCount).toBe(promptsBeforeStop);
|
||||
|
||||
// Changing mode immediately after stopping a deferred turn must transparently reopen the session.
|
||||
await manager.setAgentMode(agent.id, "plan");
|
||||
expect(manager.getAgent(agent.id)?.currentModeId).toBe("plan");
|
||||
expect(currentMode).toBe("plan");
|
||||
} finally {
|
||||
await Promise.all(manager.listAgents().map((item) => manager.closeAgent(item.id)));
|
||||
await plugins.shutdown();
|
||||
await storage.flush();
|
||||
await rm(home, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("reopens cleanly for mode changes and follow-up sends initiated while Stop is closing a slow ACP process", async () => {
|
||||
const logger = createTestLogger();
|
||||
const home = await mkdtemp(join(tmpdir(), "paseo-acp-slow-stop-"));
|
||||
const storage = new AgentStorage(join(home, "agents"), logger);
|
||||
const script = join(home, "slow-stop-agent.cjs");
|
||||
const { writeFile } = await import("node:fs/promises");
|
||||
await writeFile(
|
||||
script,
|
||||
`
|
||||
const { createInterface } = require("node:readline");
|
||||
const send = (msg) => process.stdout.write(JSON.stringify({ jsonrpc: "2.0", ...msg }) + "\\n");
|
||||
let mode = "default";
|
||||
const configOptions = () => [{
|
||||
id: "mode", name: "Mode", category: "mode", type: "select", currentValue: mode,
|
||||
options: [{ value: "default", name: "Default" }, { value: "plan", name: "Plan" }],
|
||||
}];
|
||||
process.on("SIGTERM", () => {
|
||||
setTimeout(() => process.exit(0), 250);
|
||||
});
|
||||
createInterface({ input: process.stdin }).on("line", (line) => {
|
||||
const msg = JSON.parse(line);
|
||||
if (msg.method === "initialize") {
|
||||
send({ id: msg.id, result: { protocolVersion: 1, agentCapabilities: { loadSession: true } } });
|
||||
} else if (msg.method === "session/new") {
|
||||
send({ id: msg.id, result: { sessionId: "slow-s1", configOptions: configOptions() } });
|
||||
} else if (msg.method === "session/load") {
|
||||
send({ id: msg.id, result: { configOptions: configOptions() } });
|
||||
} else if (msg.method === "session/set_config_option") {
|
||||
if (msg.params && typeof msg.params.value === "string") mode = msg.params.value;
|
||||
send({ id: msg.id, result: { configOptions: configOptions() } });
|
||||
} else if (msg.method === "session/prompt") {
|
||||
const text = msg.params?.prompt?.[0]?.text ?? "";
|
||||
if (text.includes("start bg")) {
|
||||
send({ method: "session/update", params: { sessionId: "slow-s1", update: {
|
||||
sessionUpdate: "tool_call", toolCallId: "slow-bg-1", name: "run_command",
|
||||
title: "Slow bg job", status: "in_progress",
|
||||
} } });
|
||||
} else {
|
||||
send({ method: "session/update", params: { sessionId: "slow-s1", update: {
|
||||
sessionUpdate: "agent_message_chunk", content: { type: "text", text: "After stop reply" },
|
||||
} } });
|
||||
}
|
||||
send({ id: msg.id, result: { stopReason: "end_turn" } });
|
||||
} else if (msg.method === "session/close") {
|
||||
send({ id: msg.id, result: {} });
|
||||
}
|
||||
});
|
||||
`,
|
||||
);
|
||||
const registration = runAcpProvider({
|
||||
id: "slow-stop-acp",
|
||||
label: "Slow Stop ACP",
|
||||
command: [process.execPath, script],
|
||||
acpOptions: {
|
||||
deferTurnOnRunningTools: { settleDelayMs: 25, quietLimitMs: 1_000 },
|
||||
},
|
||||
});
|
||||
const plugins = new PluginAgentClientRegistry(logger);
|
||||
plugins.replace([registration]);
|
||||
const manager = new AgentManager({ clients: plugins.clients(), registry: storage, logger });
|
||||
try {
|
||||
const agent = await manager.createAgent({ provider: registration.id, cwd: home }, undefined, {
|
||||
workspaceId: undefined,
|
||||
});
|
||||
const first = await sendPreparedPromptToAgent({
|
||||
agentManager: manager,
|
||||
agentStorage: storage,
|
||||
agentId: agent.id,
|
||||
prompt: "start bg",
|
||||
logger,
|
||||
});
|
||||
if (first.disposition === "turn_started") await first.started;
|
||||
await new Promise((resolve) => setTimeout(resolve, 40));
|
||||
expect(manager.getAgent(agent.id)?.lifecycle).toBe("running");
|
||||
|
||||
// Start Stop (takes 250ms to terminate the child on SIGTERM) and trigger a mode change mid-shutdown.
|
||||
const stopPromise = manager.cancelAgentRun(agent.id);
|
||||
await new Promise((resolve) => setTimeout(resolve, 50));
|
||||
const modePromise = manager.setAgentMode(agent.id, "plan");
|
||||
await Promise.all([stopPromise, modePromise]);
|
||||
expect(manager.getAgent(agent.id)?.currentModeId).toBe("plan");
|
||||
expect(manager.getAgent(agent.id)?.lifecycle).toBe("idle");
|
||||
|
||||
// A follow-up prompt immediately after Stop + mode change succeeds cleanly.
|
||||
const next = await sendPreparedPromptToAgent({
|
||||
agentManager: manager,
|
||||
agentStorage: storage,
|
||||
agentId: agent.id,
|
||||
prompt: "fresh prompt",
|
||||
logger,
|
||||
});
|
||||
expect(next.disposition).toBe("turn_started");
|
||||
if (next.disposition === "turn_started") await next.started;
|
||||
await expect.poll(() => manager.getAgent(agent.id)?.lifecycle, { timeout: 3_000 }).toBe("idle");
|
||||
} finally {
|
||||
await Promise.all(manager.listAgents().map((item) => manager.closeAgent(item.id)));
|
||||
await plugins.shutdown();
|
||||
await storage.flush();
|
||||
await rm(home, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("does not block mode changes after a plugin refuses Stop by ignoring session.interrupt", async () => {
|
||||
const logger = createTestLogger();
|
||||
let currentMode = "code";
|
||||
const harness = createProviderHarness({
|
||||
async handleInput(input, emit) {
|
||||
if (input.type === "session.open") {
|
||||
emit({
|
||||
type: "session.opened",
|
||||
requestId: input.requestId,
|
||||
sessionId: input.sessionId,
|
||||
capabilities: ["prompt.message", "session.interrupt", "session.configure"],
|
||||
restoration: "core",
|
||||
title: input.config.title,
|
||||
cwd: input.config.cwd,
|
||||
});
|
||||
emit({
|
||||
type: "session.config",
|
||||
sessionId: input.sessionId,
|
||||
config: {
|
||||
mode: currentMode,
|
||||
modes: [
|
||||
{ id: "code", label: "Code" },
|
||||
{ id: "plan", label: "Plan" },
|
||||
],
|
||||
models: [],
|
||||
thinkingOptions: [],
|
||||
},
|
||||
});
|
||||
emit({ type: "session.ready", requestId: input.requestId, sessionId: input.sessionId });
|
||||
return true;
|
||||
}
|
||||
if (input.type === "session.prompt") {
|
||||
emit({
|
||||
type: "session.prompt_result",
|
||||
sessionId: input.sessionId,
|
||||
clientMessageId: input.prompt.clientMessageId,
|
||||
result: { type: "turn", turnId: "hung-turn" },
|
||||
});
|
||||
emit({
|
||||
type: "session.turn",
|
||||
sessionId: input.sessionId,
|
||||
turnId: "hung-turn",
|
||||
state: "started",
|
||||
});
|
||||
return true;
|
||||
}
|
||||
if (input.type === "session.interrupt") {
|
||||
// Intentionally never acknowledge session.interrupt.
|
||||
return true;
|
||||
}
|
||||
if (input.type === "session.configure") {
|
||||
if (input.changes.mode) currentMode = input.changes.mode;
|
||||
emit({
|
||||
type: "session.config",
|
||||
sessionId: input.sessionId,
|
||||
config: {
|
||||
mode: currentMode,
|
||||
modes: [
|
||||
{ id: "code", label: "Code" },
|
||||
{ id: "plan", label: "Plan" },
|
||||
],
|
||||
models: [],
|
||||
thinkingOptions: [],
|
||||
},
|
||||
});
|
||||
emit({ type: "request.completed", requestId: input.requestId });
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
});
|
||||
const plugins = new PluginAgentClientRegistry(logger);
|
||||
plugins.replace([harness.registration]);
|
||||
const registry = buildProviderRegistry(logger, { pluginProviders: plugins.definitions() });
|
||||
const manager = new AgentManager({
|
||||
logger,
|
||||
clients: { "plugin-direct": registry["plugin-direct"].createClient(logger) },
|
||||
providerDefinitions: { "plugin-direct": registry["plugin-direct"] },
|
||||
rescueTimeouts: { interruptSessionMs: 50 },
|
||||
});
|
||||
try {
|
||||
const agent = await manager.createAgent(
|
||||
{ provider: "plugin-direct", cwd: tmpdir() },
|
||||
undefined,
|
||||
{ workspaceId: undefined },
|
||||
);
|
||||
const stream = manager.streamAgent(agent.id, "start");
|
||||
void stream.next();
|
||||
await expect
|
||||
.poll(() => manager.getAgent(agent.id)?.lifecycle, { timeout: 2_000 })
|
||||
.toBe("running");
|
||||
|
||||
const cancelResult = await manager.cancelAgentRun(agent.id);
|
||||
expect(cancelResult.status).toBe("refused");
|
||||
|
||||
// Settings change must not hang behind the unacknowledged session.interrupt.
|
||||
await manager.setAgentMode(agent.id, "plan");
|
||||
expect(manager.getAgent(agent.id)?.currentModeId).toBe("plan");
|
||||
} finally {
|
||||
await Promise.all(manager.listAgents().map((item) => manager.closeAgent(item.id)));
|
||||
await plugins.shutdown();
|
||||
}
|
||||
});
|
||||
|
||||
test("bounds settings wait when Stop is queued behind an unanswered steer", async () => {
|
||||
const logger = createTestLogger();
|
||||
let currentMode = "code";
|
||||
let releaseSteer: (() => void) | null = null;
|
||||
const harness = createProviderHarness({
|
||||
capabilities: ["prompt.message", "prompt.steer", "session.interrupt", "session.configure"],
|
||||
async handleInput(input, emit) {
|
||||
if (input.type === "session.open") {
|
||||
emit({
|
||||
type: "session.opened",
|
||||
requestId: input.requestId,
|
||||
sessionId: input.sessionId,
|
||||
capabilities: [
|
||||
"prompt.message",
|
||||
"prompt.steer",
|
||||
"session.interrupt",
|
||||
"session.configure",
|
||||
],
|
||||
restoration: "core",
|
||||
title: input.config.title,
|
||||
cwd: input.config.cwd,
|
||||
});
|
||||
emit({
|
||||
type: "session.config",
|
||||
sessionId: input.sessionId,
|
||||
config: {
|
||||
mode: currentMode,
|
||||
modes: [
|
||||
{ id: "code", label: "Code" },
|
||||
{ id: "plan", label: "Plan" },
|
||||
],
|
||||
models: [],
|
||||
thinkingOptions: [],
|
||||
},
|
||||
});
|
||||
emit({ type: "session.ready", requestId: input.requestId, sessionId: input.sessionId });
|
||||
return true;
|
||||
}
|
||||
if (input.type === "session.prompt") {
|
||||
if (input.prompt.delivery === "steer") {
|
||||
releaseSteer = () =>
|
||||
emit({
|
||||
type: "session.prompt_result",
|
||||
sessionId: input.sessionId,
|
||||
clientMessageId: input.prompt.clientMessageId,
|
||||
result: { type: "steer", turnId: "steer-turn" },
|
||||
});
|
||||
return true;
|
||||
}
|
||||
emit({
|
||||
type: "session.prompt_result",
|
||||
sessionId: input.sessionId,
|
||||
clientMessageId: input.prompt.clientMessageId,
|
||||
result: { type: "turn", turnId: "steer-turn" },
|
||||
});
|
||||
emit({
|
||||
type: "session.turn",
|
||||
sessionId: input.sessionId,
|
||||
turnId: "steer-turn",
|
||||
state: "started",
|
||||
});
|
||||
return true;
|
||||
}
|
||||
if (input.type === "session.interrupt") {
|
||||
return true;
|
||||
}
|
||||
if (input.type === "session.configure") {
|
||||
if (input.changes.mode) currentMode = input.changes.mode;
|
||||
emit({
|
||||
type: "session.config",
|
||||
sessionId: input.sessionId,
|
||||
config: {
|
||||
mode: currentMode,
|
||||
modes: [
|
||||
{ id: "code", label: "Code" },
|
||||
{ id: "plan", label: "Plan" },
|
||||
],
|
||||
models: [],
|
||||
thinkingOptions: [],
|
||||
},
|
||||
});
|
||||
emit({ type: "request.completed", requestId: input.requestId });
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
});
|
||||
const plugins = new PluginAgentClientRegistry(logger);
|
||||
plugins.replace([harness.registration]);
|
||||
const registry = buildProviderRegistry(logger, { pluginProviders: plugins.definitions() });
|
||||
const manager = new AgentManager({
|
||||
logger,
|
||||
clients: { "plugin-direct": registry["plugin-direct"].createClient(logger) },
|
||||
providerDefinitions: { "plugin-direct": registry["plugin-direct"] },
|
||||
rescueTimeouts: { interruptSessionMs: 50 },
|
||||
});
|
||||
try {
|
||||
const agent = await manager.createAgent(
|
||||
{ provider: "plugin-direct", cwd: tmpdir() },
|
||||
undefined,
|
||||
{ workspaceId: undefined },
|
||||
);
|
||||
const stream = manager.streamAgent(agent.id, "start");
|
||||
void stream.next();
|
||||
await expect
|
||||
.poll(() => manager.getAgent(agent.id)?.lifecycle, { timeout: 2_000 })
|
||||
.toBe("running");
|
||||
|
||||
// Start an unanswered steer, queue Stop behind it, then change mode.
|
||||
const steerPromise = manager.steerAgentRun(agent.id, "unanswered steer").catch(() => undefined);
|
||||
await new Promise((resolve) => setTimeout(resolve, 20));
|
||||
const stopPromise = manager.cancelAgentRun(agent.id);
|
||||
await new Promise((resolve) => setTimeout(resolve, 10));
|
||||
|
||||
// Mode change must complete within the bounded interrupt timeout even while Stop is queued.
|
||||
await manager.setAgentMode(agent.id, "plan");
|
||||
expect(manager.getAgent(agent.id)?.currentModeId).toBe("plan");
|
||||
|
||||
releaseSteer?.();
|
||||
await Promise.all([steerPromise, stopPromise]);
|
||||
} finally {
|
||||
releaseSteer?.();
|
||||
await Promise.all(manager.listAgents().map((item) => manager.closeAgent(item.id)));
|
||||
await plugins.shutdown();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -739,7 +739,6 @@ class ProviderRuntimeSession {
|
||||
}
|
||||
|
||||
async configure(changes: ProviderConfigChanges): Promise<void> {
|
||||
if (this.terminal) throw new StaleProviderSessionError(this.id);
|
||||
const input: Extract<ProviderInput, { type: "session.configure" }> = {
|
||||
type: "session.configure",
|
||||
requestId: randomUUID(),
|
||||
|
||||
@@ -99,74 +99,6 @@ describe("ClaudeAgentSession persisted history load", () => {
|
||||
rmSync(tempRoot, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
test("resumes many records within a chunk-sized event-loop turn budget", async () => {
|
||||
const count = 3_072;
|
||||
const text = "🙂".repeat(128);
|
||||
const entries = Array.from({ length: count }, (_, index) =>
|
||||
JSON.stringify({ type: "assistant", message: { content: `${index}:${text}` } }),
|
||||
);
|
||||
entries.splice(count / 2, 0, JSON.stringify({ type: "system", subtype: "compact_boundary" }));
|
||||
mkdirSync(path.dirname(transcriptPath()), { recursive: true });
|
||||
writeFileSync(transcriptPath(), entries.join("\n"));
|
||||
|
||||
let turns = 0;
|
||||
let ticker: NodeJS.Immediate;
|
||||
function tick() {
|
||||
turns++;
|
||||
const deadline = performance.now() + 2;
|
||||
while (performance.now() < deadline) {}
|
||||
ticker = setImmediate(tick);
|
||||
}
|
||||
ticker = setImmediate(tick);
|
||||
|
||||
const session = await resume().finally(() => clearImmediate(ticker));
|
||||
|
||||
try {
|
||||
const messages = [];
|
||||
for await (const event of session.streamHistory()) {
|
||||
if (event.type === "timeline" && event.item.type === "assistant_message") {
|
||||
messages.push(event.item.text);
|
||||
}
|
||||
}
|
||||
expect(messages).toEqual(Array.from({ length: count }, (_, index) => `${index}:${text}`));
|
||||
expect(turns).toBeLessThan(count);
|
||||
} finally {
|
||||
await session.close();
|
||||
}
|
||||
}, 30_000);
|
||||
|
||||
test("yields during replay of a dense window with an expensive consumer", async () => {
|
||||
const file = transcriptPath();
|
||||
const count = 500;
|
||||
const record = JSON.stringify({ type: "assistant", message: { content: "saved reply" } });
|
||||
mkdirSync(path.dirname(file), { recursive: true });
|
||||
writeFileSync(file, (record + "\n").repeat(count));
|
||||
|
||||
await withClaudeReplayHistory(file, async (history) => {
|
||||
let turns = 0;
|
||||
let ticker: NodeJS.Immediate | undefined;
|
||||
function tick() {
|
||||
turns++;
|
||||
ticker = setImmediate(tick);
|
||||
}
|
||||
|
||||
let entries = 0;
|
||||
try {
|
||||
for await (const _entry of history.parentEntries) {
|
||||
// Start counting after the read so only yields within the window count.
|
||||
ticker ??= setImmediate(tick);
|
||||
const deadline = performance.now() + 1;
|
||||
while (performance.now() < deadline) {}
|
||||
entries++;
|
||||
}
|
||||
} finally {
|
||||
if (ticker) clearImmediate(ticker);
|
||||
}
|
||||
expect(entries).toBe(count);
|
||||
expect(turns).toBeGreaterThanOrEqual(20);
|
||||
});
|
||||
});
|
||||
|
||||
test("serves unrelated health requests while resuming 32 MiB of ordered history", async () => {
|
||||
const startedAt = performance.now();
|
||||
mkdirSync(path.dirname(transcriptPath()), { recursive: true });
|
||||
@@ -768,75 +700,6 @@ describe("ClaudeAgentSession persisted history load", () => {
|
||||
},
|
||||
);
|
||||
|
||||
test.each(["return", "throw"])(
|
||||
"replays oversized records and closes every source after callback %s",
|
||||
async (exit) => {
|
||||
const parent = transcriptPath();
|
||||
const directory = path.join(parent.slice(0, -".jsonl".length), "subagents");
|
||||
const child = path.join(directory, "agent-child.jsonl");
|
||||
const workflow = path.join(directory, "workflows", "wf_test", "agent-child.jsonl");
|
||||
const notification = {
|
||||
type: "system",
|
||||
subtype: "task_notification",
|
||||
task_id: "task-id",
|
||||
status: "completed",
|
||||
};
|
||||
const result = {
|
||||
type: "user",
|
||||
message: {
|
||||
content: [
|
||||
{ type: "tool_result", tool_use_id: "tool-id", content: "é".repeat(600 * 1024) },
|
||||
],
|
||||
},
|
||||
};
|
||||
const parentRecords = [notification, result, notification];
|
||||
const childRecords = parentRecords.map((entry) => ({
|
||||
...entry,
|
||||
isSidechain: true,
|
||||
agentId: "child",
|
||||
}));
|
||||
mkdirSync(path.dirname(workflow), { recursive: true });
|
||||
writeFileSync(parent, parentRecords.map((entry) => JSON.stringify(entry)).join("\n"));
|
||||
writeFileSync(child, childRecords.map((entry) => JSON.stringify(entry)).join("\n"));
|
||||
writeFileSync(workflow, childRecords.map((entry) => JSON.stringify(entry)).join("\n"));
|
||||
|
||||
const sources: AsyncIterable<unknown>[] = [];
|
||||
const failure = new Error("consumer failed");
|
||||
const replay = withClaudeReplayHistory(parent, async (history) => {
|
||||
const parentEntries = await Array.fromAsync(history.parentEntries);
|
||||
const firstId = expect.stringMatching(/^task_notification_.*_1$/);
|
||||
const secondId = expect.stringMatching(/^task_notification_.*_2$/);
|
||||
expect(parentEntries).toEqual([
|
||||
{ ...notification, notificationId: firstId },
|
||||
result,
|
||||
{ ...notification, notificationId: secondId },
|
||||
]);
|
||||
const [first, , last] = parentEntries;
|
||||
const childEntries = history.subagents[0]!.entries;
|
||||
const workflowEntries = history.workflowEntriesByRunId.get("wf_test")!;
|
||||
sources.push(history.parentEntries, childEntries, workflowEntries);
|
||||
const expectedChildEntries = [
|
||||
{ ...childRecords[0], notificationId: first!.notificationId },
|
||||
childRecords[1],
|
||||
{ ...childRecords[2], notificationId: last!.notificationId },
|
||||
];
|
||||
expect(await Array.fromAsync(childEntries)).toEqual(expectedChildEntries);
|
||||
expect(await Array.fromAsync(workflowEntries)).toEqual(expectedChildEntries);
|
||||
expect(await Array.fromAsync(history.parentEntries)).toEqual(parentEntries);
|
||||
if (exit === "throw") throw failure;
|
||||
});
|
||||
if (exit === "throw") await expect(replay).rejects.toBe(failure);
|
||||
else await replay;
|
||||
|
||||
// Reading again probes whether replay released each descriptor when the callback ended.
|
||||
for (const source of sources) {
|
||||
await expect(source[Symbol.asyncIterator]().next()).rejects.toMatchObject({
|
||||
code: "EBADF",
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
// chmod does not remove read access on Windows, or for root.
|
||||
test.skipIf(process.platform === "win32" || process.getuid?.() === 0)(
|
||||
"logs a warning with the error when Claude's project folders cannot be listed",
|
||||
|
||||
@@ -878,12 +878,11 @@ describe("ClaudeAgentSession persisted subagent replay", () => {
|
||||
const text = "é🙂".repeat(30_000);
|
||||
const historyDir = claudeProjectDirSync(cwd, { configDir });
|
||||
mkdirSync(historyDir, { recursive: true });
|
||||
const first = parentEntry([{ type: "text", text }]);
|
||||
// Put the first byte of é at the end of a 1 MiB read.
|
||||
const padding = " ".repeat(1024 * 1024 - 1 - first.indexOf(text));
|
||||
writeFileSync(
|
||||
path.join(historyDir, "replay-session.jsonl"),
|
||||
padding + first + "\r\nnot json\r\n" + parentEntry([{ type: "text", text: "final row" }]),
|
||||
parentEntry([{ type: "text", text }]) +
|
||||
"\r\nnot json\r\n" +
|
||||
parentEntry([{ type: "text", text: "final row" }]),
|
||||
);
|
||||
const events = await replayEvents();
|
||||
expect(events.filter((event) => event.type === "timeline").map((event) => event.item)).toEqual([
|
||||
|
||||
-28
@@ -41,34 +41,6 @@ function parentEntries(
|
||||
}
|
||||
|
||||
describe("Claude workflow replay", () => {
|
||||
it("skips parent history when there are no workflow summaries", async () => {
|
||||
const entries = {
|
||||
[Symbol.iterator](): Iterator<ClaudeWorkflowParentEntry> {
|
||||
throw new Error("parent history must not be read");
|
||||
},
|
||||
};
|
||||
await expect(
|
||||
observeReplayWorkflows({ workflows: [], parentEntries: entries }),
|
||||
).resolves.toEqual([]);
|
||||
});
|
||||
|
||||
it("links workflow results from a single traversal, including results before their calls", async () => {
|
||||
const [call, result] = parentEntries();
|
||||
const entries = (async function* () {
|
||||
yield result!;
|
||||
yield call!;
|
||||
})();
|
||||
const observations = await observeReplayWorkflows({
|
||||
workflows: [{ runId: RUN_ID, status: "completed" }],
|
||||
parentEntries: entries,
|
||||
});
|
||||
expect(observations).toEqual([
|
||||
{ kind: "declared", id: TOOL_CALL_ID, toolCallId: TOOL_CALL_ID, title: "Workflow" },
|
||||
{ kind: "subtitle", id: TOOL_CALL_ID, subtitle: "Workflow" },
|
||||
{ kind: "status", id: TOOL_CALL_ID, status: "completed" },
|
||||
]);
|
||||
});
|
||||
|
||||
it("parses the persisted run summary observed from Claude Code 2.1.220", async () => {
|
||||
expect(
|
||||
parseClaudeWorkflowRun(
|
||||
|
||||
+17
-18
@@ -55,9 +55,7 @@ export async function observeReplayWorkflows(input: {
|
||||
>;
|
||||
convertEntry?: (entry: ClaudeReplayEntry) => AgentTimelineItem[] | Promise<AgentTimelineItem[]>;
|
||||
}): Promise<SubagentObservation[]> {
|
||||
if (input.workflows.length === 0) return [];
|
||||
const runIds = new Set(input.workflows.map((workflow) => workflow.runId));
|
||||
const toolCallIdByRunId = await readWorkflowLinks(input.parentEntries, runIds);
|
||||
const toolCallIdByRunId = await readWorkflowLinks(input.parentEntries);
|
||||
const observations: SubagentObservation[] = [];
|
||||
|
||||
for (const workflow of input.workflows) {
|
||||
@@ -157,33 +155,34 @@ async function observeWorkflowTimeline(input: {
|
||||
|
||||
async function readWorkflowLinks(
|
||||
entries: Iterable<ClaudeWorkflowParentEntry> | AsyncIterable<ClaudeWorkflowParentEntry>,
|
||||
runIds: ReadonlySet<string>,
|
||||
): Promise<Map<string, string>> {
|
||||
const workflowToolCallIds = new Set<string>();
|
||||
const results: { runId: string; toolCallId: string }[] = [];
|
||||
const toolCallIdByRunId = new Map<string, string>();
|
||||
|
||||
for await (const entry of entries) {
|
||||
const content = entry.message?.content;
|
||||
if (!Array.isArray(content)) continue;
|
||||
for (const value of content) {
|
||||
const block = toRecord(value);
|
||||
if (block?.type === "tool_use" && block.name === "Workflow") {
|
||||
const id = readString(block.id);
|
||||
if (id) workflowToolCallIds.add(id);
|
||||
}
|
||||
if (block?.type !== "tool_result") continue;
|
||||
const toolCallId = readString(block.tool_use_id);
|
||||
if (!toolCallId) continue;
|
||||
const runId = readRunId(block.content);
|
||||
if (runId && runIds.has(runId)) results.push({ runId, toolCallId });
|
||||
if (block?.type !== "tool_use" || block.name !== "Workflow") continue;
|
||||
const id = readString(block.id);
|
||||
if (id) workflowToolCallIds.add(id);
|
||||
}
|
||||
}
|
||||
|
||||
// Resolve IDs in result order after all calls are known, even if a result precedes its call.
|
||||
const toolCallIdByRunId = new Map<string, string>();
|
||||
for (const { runId, toolCallId } of results) {
|
||||
if (workflowToolCallIds.has(toolCallId)) toolCallIdByRunId.set(runId, toolCallId);
|
||||
for await (const entry of entries) {
|
||||
const content = entry.message?.content;
|
||||
if (!Array.isArray(content)) continue;
|
||||
for (const value of content) {
|
||||
const block = toRecord(value);
|
||||
if (block?.type !== "tool_result") continue;
|
||||
const toolCallId = readString(block.tool_use_id);
|
||||
if (!toolCallId || !workflowToolCallIds.has(toolCallId)) continue;
|
||||
const runId = readRunId(block.content);
|
||||
if (runId) toolCallIdByRunId.set(runId, toolCallId);
|
||||
}
|
||||
}
|
||||
|
||||
return toolCallIdByRunId;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,10 +13,6 @@ import {
|
||||
type ClaudeWorkflowRun,
|
||||
} from "./subagents/workflow-replay-source.js";
|
||||
|
||||
const READ_CHUNK_BYTES = 1024 * 1024;
|
||||
// Async iteration between reads uses microtasks, including work inside the consumer.
|
||||
const REPLAY_SLICE_MS = 10;
|
||||
|
||||
interface TranscriptEntry extends ClaudeReplayEntry {
|
||||
isSidechain?: unknown;
|
||||
}
|
||||
@@ -47,18 +43,13 @@ async function* locatedRecords(
|
||||
let pieces: Buffer[] = [];
|
||||
let length = 0;
|
||||
while (remaining > 0) {
|
||||
const buffer = Buffer.allocUnsafe(Math.min(READ_CHUNK_BYTES, remaining));
|
||||
const buffer = Buffer.allocUnsafe(Math.min(64 * 1024, remaining));
|
||||
const { bytesRead: count } = await fd.read(buffer, 0, buffer.length, null);
|
||||
if (count === 0) break;
|
||||
remaining -= count;
|
||||
let sliceStartedAt = performance.now();
|
||||
let start = 0;
|
||||
let end: number;
|
||||
while ((end = buffer.indexOf(10, start)) !== -1 && end < count) {
|
||||
if (performance.now() - sliceStartedAt >= REPLAY_SLICE_MS) {
|
||||
await setImmediate();
|
||||
sliceStartedAt = performance.now();
|
||||
}
|
||||
pieces.push(buffer.subarray(start, end));
|
||||
length += end - start;
|
||||
const entry = parseRecord(Buffer.concat(pieces, length).toString("utf8"));
|
||||
@@ -74,6 +65,8 @@ async function* locatedRecords(
|
||||
if (entry) yield { entry, location };
|
||||
start = end + 1;
|
||||
}
|
||||
// Bound parsing work as well as IO; microtasks alone do not service timers or sockets.
|
||||
await setImmediate();
|
||||
if (start < count) {
|
||||
pieces.push(buffer.subarray(start, count));
|
||||
length += count - start;
|
||||
@@ -103,52 +96,27 @@ function indexedRecords(
|
||||
},
|
||||
};
|
||||
async function* readEntries(): AsyncGenerator<TranscriptEntry> {
|
||||
const chunk = Buffer.allocUnsafe(READ_CHUNK_BYTES);
|
||||
let window: { file: string; offset: number; bytes: Buffer } | undefined;
|
||||
let sliceStartedAt = performance.now();
|
||||
for (const location of locations) {
|
||||
if (
|
||||
window?.file !== location.file ||
|
||||
location.offset < window.offset ||
|
||||
location.offset + location.length > window.offset + window.bytes.length
|
||||
) {
|
||||
const fd = descriptors.get(location.file)!;
|
||||
const buffer = location.length > chunk.length ? Buffer.allocUnsafe(location.length) : chunk;
|
||||
// Read ahead from the next indexed record. The index still owns selection and order,
|
||||
// including sparse sidechains and workflow records sorted across files.
|
||||
window = {
|
||||
file: location.file,
|
||||
offset: location.offset,
|
||||
bytes: await readRecordWindow(fd, buffer, location),
|
||||
};
|
||||
sliceStartedAt = performance.now();
|
||||
const fd = descriptors.get(location.file)!;
|
||||
const buffer = Buffer.allocUnsafe(location.length);
|
||||
let read = 0;
|
||||
while (read < buffer.length) {
|
||||
const { bytesRead: count } = await fd.read(
|
||||
buffer,
|
||||
read,
|
||||
buffer.length - read,
|
||||
location.offset + read,
|
||||
);
|
||||
if (count === 0)
|
||||
throw new Error(`Claude transcript was truncated during replay: ${location.file}`);
|
||||
read += count;
|
||||
}
|
||||
if (performance.now() - sliceStartedAt >= REPLAY_SLICE_MS) {
|
||||
await setImmediate();
|
||||
sliceStartedAt = performance.now();
|
||||
}
|
||||
const start = location.offset - window.offset;
|
||||
const entry = parseRecord(window.bytes.toString("utf8", start, start + location.length));
|
||||
const entry = parseRecord(buffer.toString("utf8"));
|
||||
if (entry) yield entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function readRecordWindow(
|
||||
fd: FileHandle,
|
||||
buffer: Buffer,
|
||||
location: RecordLocation,
|
||||
): Promise<Buffer> {
|
||||
let read = 0;
|
||||
while (read < location.length) {
|
||||
const { bytesRead } = await fd.read(buffer, read, buffer.length - read, location.offset + read);
|
||||
if (bytesRead === 0)
|
||||
throw new Error(`Claude transcript was truncated during replay: ${location.file}`);
|
||||
read += bytesRead;
|
||||
}
|
||||
return buffer.subarray(0, read);
|
||||
}
|
||||
|
||||
function isToolResult(entry: TranscriptEntry): boolean {
|
||||
return (
|
||||
Array.isArray(entry.message?.content) &&
|
||||
|
||||
@@ -1,13 +1,4 @@
|
||||
import {
|
||||
existsSync,
|
||||
mkdtempSync,
|
||||
readFileSync,
|
||||
rmSync,
|
||||
statSync,
|
||||
symlinkSync,
|
||||
writeFileSync,
|
||||
} from "node:fs";
|
||||
import os from "node:os";
|
||||
import { existsSync, rmSync, statSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
@@ -31,30 +22,3 @@ describe.skipIf(process.platform === "win32")("materializeProviderImage", () =>
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test.skipIf(process.platform === "win32")(
|
||||
"replaces a cached attachment directory turned into a symlink",
|
||||
async () => {
|
||||
const image = { data: "c3ltbGluayByZWdyZXNzaW9u", mimeType: "image/png" };
|
||||
const first = await materializeProviderImage(image);
|
||||
const dir = path.dirname(first.path);
|
||||
const target = mkdtempSync(path.join(os.tmpdir(), "paseo-image-symlink-test-"));
|
||||
let replacement: string | undefined;
|
||||
try {
|
||||
rmSync(dir, { recursive: true });
|
||||
// Populate the target to exercise validation before accepting a cache hit.
|
||||
writeFileSync(path.join(target, path.basename(first.path)), "symlink target");
|
||||
symlinkSync(target, dir, "dir");
|
||||
|
||||
const second = await materializeProviderImage(image);
|
||||
replacement = path.dirname(second.path);
|
||||
expect(replacement).not.toBe(dir);
|
||||
expect(path.basename(replacement)).toMatch(/^paseo-attachments-/);
|
||||
expect(readFileSync(second.path, "utf8")).toBe("symlink regression");
|
||||
} finally {
|
||||
if (replacement && replacement !== dir) rmSync(replacement, { recursive: true });
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
rmSync(target, { recursive: true, force: true });
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { AsyncLocalStorage, createHook } from "node:async_hooks";
|
||||
import { existsSync, rmSync, statSync, readFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import MarkdownIt from "markdown-it";
|
||||
@@ -212,7 +211,7 @@ test("64 MiB materialization leaves the event loop responsive and preserves byte
|
||||
});
|
||||
|
||||
test("preserves base64 decoding across whitespace and chunk boundaries", async () => {
|
||||
const bytes = Buffer.alloc(1024 * 1024, 123);
|
||||
const bytes = Buffer.alloc(512 * 1024, 123);
|
||||
const base64 = bytes.toString("base64");
|
||||
const data = base64.match(/.{1,77}/g)!.join("\n");
|
||||
const result = await materializeProviderImage({ data, mimeType: "image/png" });
|
||||
@@ -248,114 +247,3 @@ test("simultaneous requests for the same content share the published file", asyn
|
||||
expect(results[0]).toEqual(results[1]);
|
||||
expect(readFileSync(results[0].path).toString()).toBe("concurrent dedupe fixture");
|
||||
});
|
||||
|
||||
test("a small image finishes before an earlier distinct 64 MiB image", async () => {
|
||||
const largeData = Buffer.alloc(64 * 1024 * 1024, 42).toString("base64");
|
||||
const smallData = Buffer.from("live image during large replay").toString("base64");
|
||||
const completionOrder: string[] = [];
|
||||
const large = materializeProviderImage({ data: largeData, mimeType: "image/png" }).then(
|
||||
(image) => {
|
||||
completionOrder.push("large");
|
||||
return image;
|
||||
},
|
||||
);
|
||||
const small = materializeProviderImage({ data: smallData, mimeType: "image/png" }).then(
|
||||
(image) => {
|
||||
completionOrder.push("small");
|
||||
return image;
|
||||
},
|
||||
);
|
||||
const images = await Promise.all([large, small]);
|
||||
for (const image of images) rmSync(image.path, { force: true });
|
||||
expect(completionOrder).toEqual(["small", "large"]);
|
||||
});
|
||||
|
||||
test("publishing small distinct images stays within eight event-loop turns per image", async () => {
|
||||
const count = 20;
|
||||
const materializing = new AsyncLocalStorage<boolean>();
|
||||
let turn = 0;
|
||||
let lastActiveTurn = -1;
|
||||
let activeTurns = 0;
|
||||
const hook = createHook({
|
||||
before() {
|
||||
// A spinning immediate can tick many times while a filesystem worker is
|
||||
// still running. Count only turns that advance the materializations.
|
||||
if (materializing.getStore() && turn !== lastActiveTurn) {
|
||||
lastActiveTurn = turn;
|
||||
activeTurns++;
|
||||
}
|
||||
},
|
||||
});
|
||||
let probe = setImmediate(function tick() {
|
||||
turn++;
|
||||
probe = setImmediate(tick);
|
||||
});
|
||||
const images: string[] = [];
|
||||
hook.enable();
|
||||
try {
|
||||
await materializing.run(true, async () => {
|
||||
for (let index = 0; index < count; index++) {
|
||||
const data = Buffer.from(`small attachment ${index}`).toString("base64");
|
||||
const image = await materializeProviderImage({ data, mimeType: "image/png" });
|
||||
images.push(image.path);
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
hook.disable();
|
||||
clearImmediate(probe);
|
||||
for (const image of images) rmSync(image, { force: true });
|
||||
}
|
||||
expect(activeTurns).toBeLessThanOrEqual(8 * count);
|
||||
});
|
||||
|
||||
test("six concurrent 8 MiB images share the main-thread CPU budget", async () => {
|
||||
const inputs = Array.from({ length: 6 }, (_, index) => ({
|
||||
data: Buffer.alloc(8 * 1024 * 1024, index + 1).toString("base64"),
|
||||
mimeType: "image/png",
|
||||
}));
|
||||
const threadCpuMs = () => {
|
||||
const { user, system } = process.threadCpuUsage();
|
||||
return (user + system) / 1000;
|
||||
};
|
||||
let previous = threadCpuMs();
|
||||
let longest = 0;
|
||||
const probe = setInterval(() => {
|
||||
const now = threadCpuMs();
|
||||
longest = Math.max(longest, now - previous);
|
||||
previous = now;
|
||||
}, 1);
|
||||
try {
|
||||
const images = await Promise.all(inputs.map(materializeProviderImage));
|
||||
await new Promise((resolve) => setTimeout(resolve, 5));
|
||||
for (const image of images) rmSync(image.path, { force: true });
|
||||
expect(longest).toBeLessThan(50);
|
||||
} finally {
|
||||
clearInterval(probe);
|
||||
}
|
||||
});
|
||||
|
||||
test("a busy event loop does not spend the image decode budget", async () => {
|
||||
const count = 8;
|
||||
let turns = 0;
|
||||
let probe = setImmediate(function tick() {
|
||||
turns++;
|
||||
// Simulate unrelated work that exceeds a 10 ms decode slice.
|
||||
const end = performance.now() + 20;
|
||||
while (performance.now() < end) {
|
||||
// Keep this event-loop turn busy.
|
||||
}
|
||||
probe = setImmediate(tick);
|
||||
});
|
||||
const paths: string[] = [];
|
||||
try {
|
||||
for (let index = 0; index < count; index++) {
|
||||
const data = Buffer.from(`attachment on a busy loop ${index}`).toString("base64");
|
||||
const image = await materializeProviderImage({ data, mimeType: "image/png" });
|
||||
paths.push(image.path);
|
||||
}
|
||||
} finally {
|
||||
clearImmediate(probe);
|
||||
for (const image of paths) rmSync(image, { force: true });
|
||||
}
|
||||
expect(turns).toBeLessThanOrEqual(7 * count);
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createHash, randomUUID } from "node:crypto";
|
||||
import { createHash } from "node:crypto";
|
||||
import * as fs from "node:fs/promises";
|
||||
import { setImmediate } from "node:timers/promises";
|
||||
import os from "node:os";
|
||||
@@ -23,26 +23,28 @@ const PROVIDER_IMAGE_ATTACHMENT_DIR_PREFIX = `${PROVIDER_IMAGE_ATTACHMENT_DIR}-`
|
||||
const PRIVATE_ATTACHMENT_DIR_MODE = 0o700;
|
||||
const MATERIALIZED_IMAGE_FILE_MODE = 0o600;
|
||||
|
||||
let attachmentDirectory: Promise<string> | undefined;
|
||||
const pendingWrites = new Map<string, Promise<MaterializedProviderImage>>();
|
||||
let materializedImageAttachmentDir: string | null = null;
|
||||
// Serialize materializations: one decoder and one file operation at a time, including
|
||||
// concurrent history replay and live turns. A rejected operation must not poison the queue.
|
||||
let pendingMaterialization: Promise<unknown> = Promise.resolve();
|
||||
|
||||
function getMaterializedImageAttachmentDir(): Promise<string> {
|
||||
attachmentDirectory ??= createAttachmentDirectory().catch((error) => {
|
||||
attachmentDirectory = undefined;
|
||||
throw error;
|
||||
});
|
||||
return attachmentDirectory;
|
||||
}
|
||||
|
||||
async function createAttachmentDirectory(): Promise<string> {
|
||||
const dir = await fs.mkdtemp(path.join(os.tmpdir(), PROVIDER_IMAGE_ATTACHMENT_DIR_PREFIX));
|
||||
await fs.chmod(dir, PRIVATE_ATTACHMENT_DIR_MODE);
|
||||
return dir;
|
||||
}
|
||||
|
||||
function isMissingPath(error: unknown): boolean {
|
||||
const code = (error as NodeJS.ErrnoException).code;
|
||||
return code === "ENOENT" || code === "ENOTDIR";
|
||||
async function getMaterializedImageAttachmentDir(): Promise<string> {
|
||||
if (materializedImageAttachmentDir) {
|
||||
try {
|
||||
const stats = await fs.lstat(materializedImageAttachmentDir);
|
||||
if (stats.isDirectory()) {
|
||||
await fs.chmod(materializedImageAttachmentDir, PRIVATE_ATTACHMENT_DIR_MODE);
|
||||
return materializedImageAttachmentDir;
|
||||
}
|
||||
} catch {
|
||||
/* Temp storage may have been removed between turns. */
|
||||
}
|
||||
}
|
||||
materializedImageAttachmentDir = await fs.mkdtemp(
|
||||
path.join(os.tmpdir(), PROVIDER_IMAGE_ATTACHMENT_DIR_PREFIX),
|
||||
);
|
||||
await fs.chmod(materializedImageAttachmentDir, PRIVATE_ATTACHMENT_DIR_MODE);
|
||||
return materializedImageAttachmentDir;
|
||||
}
|
||||
|
||||
function getImageExtension(mimeType: string): string {
|
||||
@@ -67,18 +69,18 @@ function getImageExtension(mimeType: string): string {
|
||||
// 128 MiB admits the measured 64 MiB fixture with headroom while bounding disk
|
||||
// and decoding per image. This is materialization admission, not a wire schema limit.
|
||||
export const MAX_PROVIDER_IMAGE_BYTES = 128 * 1024 * 1024;
|
||||
const BASE64_CHUNK_CHARACTERS = 1024 * 1024; // Multiple of four; decode units stay aligned.
|
||||
const DECODE_SLICE_MS = 10;
|
||||
let decodeBudgetMs = DECODE_SLICE_MS;
|
||||
let pendingDecodeYield: Promise<void> | undefined;
|
||||
const BASE64_CHUNK_CHARACTERS = 256 * 1024; // Multiple of four; decode units stay aligned.
|
||||
|
||||
async function refillDecodeBudget(): Promise<void> {
|
||||
await setImmediate();
|
||||
decodeBudgetMs = DECODE_SLICE_MS;
|
||||
pendingDecodeYield = undefined;
|
||||
export function materializeProviderImage(image: {
|
||||
data: string;
|
||||
mimeType: string | null;
|
||||
}): Promise<MaterializedProviderImage> {
|
||||
const result = pendingMaterialization.then(() => materializeImage(image));
|
||||
pendingMaterialization = result.catch(() => {});
|
||||
return result;
|
||||
}
|
||||
|
||||
export async function materializeProviderImage(image: {
|
||||
async function materializeImage(image: {
|
||||
data: string;
|
||||
mimeType: string | null;
|
||||
}): Promise<MaterializedProviderImage> {
|
||||
@@ -101,74 +103,32 @@ export async function materializeProviderImage(image: {
|
||||
}
|
||||
const hash = createHash("sha256");
|
||||
for await (const bytes of decodeImage(data)) hash.update(bytes);
|
||||
const filename = `${hash.digest("hex")}.${getImageExtension(mimeType)}`;
|
||||
const directory = getMaterializedImageAttachmentDir();
|
||||
const dir = await directory;
|
||||
const dir = await getMaterializedImageAttachmentDir();
|
||||
const filePath = path.join(dir, `${hash.digest("hex")}.${getImageExtension(mimeType)}`);
|
||||
try {
|
||||
return await materializeInDirectory(dir, filename, data);
|
||||
await fs.stat(filePath);
|
||||
return { path: filePath };
|
||||
} catch (error) {
|
||||
if (!isMissingPath(error)) throw error;
|
||||
// Other requests may have already replaced the directory after the same deletion.
|
||||
if (attachmentDirectory === directory) attachmentDirectory = undefined;
|
||||
const replacement = await getMaterializedImageAttachmentDir();
|
||||
return materializeInDirectory(replacement, filename, data);
|
||||
if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
|
||||
}
|
||||
}
|
||||
|
||||
function materializeInDirectory(
|
||||
dir: string,
|
||||
filename: string,
|
||||
data: string,
|
||||
): Promise<MaterializedProviderImage> {
|
||||
const filePath = path.join(dir, filename);
|
||||
const pending = pendingWrites.get(filePath);
|
||||
if (pending) return pending;
|
||||
|
||||
const write = publishImage(dir, filePath, data).finally(() => {
|
||||
pendingWrites.delete(filePath);
|
||||
});
|
||||
pendingWrites.set(filePath, write);
|
||||
return write;
|
||||
}
|
||||
|
||||
async function publishImage(
|
||||
dir: string,
|
||||
filePath: string,
|
||||
data: string,
|
||||
): Promise<MaterializedProviderImage> {
|
||||
const [directory, existing] = await Promise.allSettled([fs.lstat(dir), fs.stat(filePath)]);
|
||||
if (directory.status === "rejected") throw directory.reason;
|
||||
const stats = directory.value;
|
||||
const uid = process.platform === "win32" ? undefined : process.getuid?.();
|
||||
if (
|
||||
!stats.isDirectory() ||
|
||||
(uid !== undefined && (stats.uid !== uid || (stats.mode & 0o077) !== 0))
|
||||
) {
|
||||
throw Object.assign(new Error("Private image attachment directory is unavailable"), {
|
||||
code: "ENOENT",
|
||||
});
|
||||
}
|
||||
if (existing.status === "fulfilled") return { path: filePath };
|
||||
if (!isMissingPath(existing.reason)) throw existing.reason;
|
||||
|
||||
const stagingPath = path.join(dir, `.pending-${randomUUID()}`);
|
||||
const file = await fs.open(stagingPath, "wx", MATERIALIZED_IMAGE_FILE_MODE);
|
||||
const staging = await fs.mkdtemp(path.join(dir, ".pending-"));
|
||||
const stagingPath = path.join(staging, "image");
|
||||
try {
|
||||
await fs.chmod(staging, PRIVATE_ATTACHMENT_DIR_MODE);
|
||||
const file = await fs.open(stagingPath, "wx", MATERIALIZED_IMAGE_FILE_MODE);
|
||||
try {
|
||||
// Restore owner permissions if the umask masked them at open.
|
||||
await file.chmod(MATERIALIZED_IMAGE_FILE_MODE);
|
||||
// Decode again only for new content, retaining one chunk at a time.
|
||||
// Decode again only for a new hash. This bounds retained memory to one chunk
|
||||
// and performs no writes at all for repeated content, including history replay.
|
||||
for await (const bytes of decodeImage(data)) await file.writeFile(bytes);
|
||||
} finally {
|
||||
await file.close();
|
||||
}
|
||||
await fs.rename(stagingPath, filePath);
|
||||
return { path: filePath };
|
||||
} catch (error) {
|
||||
await fs.unlink(stagingPath).catch((cleanupError) => {
|
||||
if (!isMissingPath(cleanupError)) throw cleanupError;
|
||||
});
|
||||
throw error;
|
||||
} finally {
|
||||
await fs.rm(staging, { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,13 +136,6 @@ async function* decodeImage(data: string): AsyncGenerator<Buffer> {
|
||||
let carry = "";
|
||||
let decodedBytes = 0;
|
||||
for (let offset = 0; offset < data.length; offset += BASE64_CHUNK_CHARACTERS) {
|
||||
let pause = pendingDecodeYield;
|
||||
while (pause) {
|
||||
await pause;
|
||||
pause = pendingDecodeYield;
|
||||
}
|
||||
// Charge synchronous work across decoders. File I/O and idle time leave the budget intact.
|
||||
const startedAt = performance.now();
|
||||
// Buffer.from ignores non-base64 characters. Carry incomplete quartets so
|
||||
// line-wrapped payloads decode identically across chunk boundaries.
|
||||
const chunk =
|
||||
@@ -191,13 +144,12 @@ async function* decodeImage(data: string): AsyncGenerator<Buffer> {
|
||||
const finalChunk = offset + BASE64_CHUNK_CHARACTERS >= data.length || chunk.includes("=");
|
||||
const end = finalChunk ? chunk.length : chunk.length - (chunk.length % 4);
|
||||
const bytes = Buffer.from(chunk.slice(0, end), "base64");
|
||||
decodeBudgetMs -= performance.now() - startedAt;
|
||||
if (decodeBudgetMs <= 0) pendingDecodeYield = refillDecodeBudget();
|
||||
carry = chunk.slice(end);
|
||||
decodedBytes += bytes.length;
|
||||
if (decodedBytes > MAX_PROVIDER_IMAGE_BYTES)
|
||||
throw new Error("Image attachment exceeds size limit");
|
||||
yield bytes;
|
||||
await setImmediate();
|
||||
if (finalChunk) break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
import copy from "../src/i18n/resources/en.json" with { type: "json" };
|
||||
import { expect, test, waitForHydration, type Page } from "./fixtures";
|
||||
|
||||
async function openHub(page: Page, width = 1024) {
|
||||
await page.setViewportSize({ width, height: 900 });
|
||||
await page.goto("/hub");
|
||||
await expect(page.getByRole("heading", { name: "Paseo Hub", level: 1 })).toBeVisible();
|
||||
}
|
||||
|
||||
async function tabIntoNextPreview(page: Page) {
|
||||
await waitForHydration(page);
|
||||
await page.getByRole("tab", { name: /^Slack/ }).focus();
|
||||
await page.keyboard.press("ArrowRight");
|
||||
await page.keyboard.press("Tab");
|
||||
}
|
||||
|
||||
async function readPreviewOnFocus(page: Page) {
|
||||
return page.getByRole("tabpanel").evaluateHandle((panel) => {
|
||||
const atFocus = { label: "" };
|
||||
panel.addEventListener(
|
||||
"focus",
|
||||
() => {
|
||||
atFocus.label = panel.querySelector('[role="img"]')?.getAttribute("aria-label") ?? "";
|
||||
},
|
||||
{ once: true },
|
||||
);
|
||||
return atFocus;
|
||||
});
|
||||
}
|
||||
|
||||
async function useLargerText(page: Page) {
|
||||
await page.addStyleTag({ content: "html { font-size: 125%; }" });
|
||||
}
|
||||
|
||||
async function expectSourceLabelFits(page: Page, name: string, text = name) {
|
||||
const label = page.getByRole("tab", { name }).getByText(text, { exact: true });
|
||||
await expect(label).toBeVisible();
|
||||
expect(await label.evaluate((element) => element.scrollWidth <= element.clientWidth)).toBe(true);
|
||||
}
|
||||
|
||||
async function expectPreviewRowsFit(page: Page, source: string, ...rows: string[]) {
|
||||
const name = new RegExp(`^${source}`);
|
||||
await page.getByRole("tab", { name }).click();
|
||||
const preview = page.getByRole("tabpanel", { name });
|
||||
await preview.scrollIntoViewIfNeeded();
|
||||
for (const row of rows) {
|
||||
const text = preview.getByText(row, { exact: true }).filter({ visible: true });
|
||||
await expect(text).toBeInViewport({ ratio: 1 });
|
||||
expect(await text.evaluate((element) => element.scrollWidth <= element.clientWidth)).toBe(true);
|
||||
}
|
||||
}
|
||||
|
||||
async function focusProSeatHelp(page: Page) {
|
||||
const pro = page
|
||||
.getByRole("article")
|
||||
.filter({ has: page.getByRole("heading", { name: "Pro", exact: true }) });
|
||||
const help = pro.getByLabel(/^Seats are Hub members/).locator("..");
|
||||
await help.scrollIntoViewIfNeeded();
|
||||
await help.focus();
|
||||
return pro.getByRole("tooltip");
|
||||
}
|
||||
|
||||
test("Hub fits a viewport narrower than its page frame", async ({ page }) => {
|
||||
await openHub(page);
|
||||
const { contentWidth, viewportWidth } = await page.evaluate(() => ({
|
||||
contentWidth: document.documentElement.scrollWidth,
|
||||
viewportWidth: document.documentElement.clientWidth,
|
||||
}));
|
||||
expect(contentWidth).toBeLessThanOrEqual(viewportWidth);
|
||||
});
|
||||
|
||||
for (const width of [320, 768, 1024]) {
|
||||
test(`the complete Pro seat explanation is visible on keyboard focus at ${width}px`, async ({
|
||||
page,
|
||||
}) => {
|
||||
test.skip(Boolean(process.env.WEBSITE_TEST_URL), "Requires the Hub plans fixture");
|
||||
await openHub(page, width);
|
||||
const tooltip = await focusProSeatHelp(page);
|
||||
await expect(tooltip).toContainText("do not count as seats");
|
||||
await expect(tooltip).toBeInViewport({ ratio: 1 });
|
||||
});
|
||||
}
|
||||
|
||||
test("the Slack starter forwards the mention and declares a thread reply", async ({ page }) => {
|
||||
await openHub(page);
|
||||
const starter = page.locator("pre").filter({ hasText: "name: slack-help" });
|
||||
await expect(starter).toContainText("${{ paseo.prompt }}");
|
||||
await expect(starter).toContainText("hub.reply");
|
||||
await expect(starter).toContainText("slack.reply:");
|
||||
});
|
||||
|
||||
test("keyboard focus enters the selected preview with its current content", async ({ page }) => {
|
||||
await openHub(page);
|
||||
const atFocus = await readPreviewOnFocus(page);
|
||||
await tabIntoNextPreview(page);
|
||||
await expect(page.getByRole("tabpanel", { name: /^GitHub/ })).toBeFocused();
|
||||
expect((await atFocus.jsonValue()).label).toMatch(/^GitHub issue/);
|
||||
});
|
||||
|
||||
test("source names fit on a narrow phone", async ({ page }) => {
|
||||
await openHub(page, 320);
|
||||
await expectSourceLabelFits(page, "Schedules");
|
||||
await expectSourceLabelFits(page, "Webhooks");
|
||||
});
|
||||
|
||||
test("source names remain readable with larger text on a phone", async ({ page }) => {
|
||||
await openHub(page, 375);
|
||||
await useLargerText(page);
|
||||
for (const name of ["GitHub", "Discord", "Schedules", "Webhooks"]) {
|
||||
await expectSourceLabelFits(page, name);
|
||||
}
|
||||
});
|
||||
|
||||
test("desktop source descriptions fit with larger text", async ({ page }) => {
|
||||
await openHub(page, 1280);
|
||||
await useLargerText(page);
|
||||
for (const { name, description } of Object.values(copy.hub.sources)) {
|
||||
await expectSourceLabelFits(page, name, description);
|
||||
}
|
||||
});
|
||||
|
||||
test("Hub previews have room for their final rows with larger text", async ({ page }) => {
|
||||
await page.emulateMedia({ reducedMotion: "reduce" });
|
||||
await openHub(page, 1280);
|
||||
await useLargerText(page);
|
||||
await waitForHydration(page);
|
||||
await expectPreviewRowsFit(page, "GitHub", "Open in Paseo");
|
||||
await expectPreviewRowsFit(page, "Discord", "Message #engineering");
|
||||
});
|
||||
|
||||
test("preview results fit on a narrow phone with larger text", async ({ page }) => {
|
||||
await page.emulateMedia({ reducedMotion: "reduce" });
|
||||
await openHub(page, 320);
|
||||
await useLargerText(page);
|
||||
await waitForHydration(page);
|
||||
await expectPreviewRowsFit(page, "Discord", "Fix stale worktrees", "getpaseo/paseo#2825");
|
||||
await expectPreviewRowsFit(page, "Schedules", "tests passed");
|
||||
});
|
||||
@@ -9,6 +9,12 @@ async function chooseLanguage(page: Page, language: string) {
|
||||
await page.getByRole("menuitemradio", { name: language }).click();
|
||||
}
|
||||
|
||||
async function selectHubSourceTab(page: Page, name: string | RegExp) {
|
||||
const tab = page.getByRole("tab", { name });
|
||||
await tab.click();
|
||||
await expect(tab).toHaveAttribute("aria-selected", "true");
|
||||
}
|
||||
|
||||
async function withPageScriptsHeld(page: Page, run: (release: () => void) => Promise<void>) {
|
||||
let releaseScripts!: () => void;
|
||||
const scriptsReleased = new Promise<void>((resolve) => {
|
||||
@@ -109,59 +115,70 @@ test("switches language on the same page, keeping the query and then every link"
|
||||
await expect(page.locator("html")).toHaveAttribute("lang", "en");
|
||||
});
|
||||
|
||||
async function openHubDoc(page: Page, prefix: string, slug: string, heading: string) {
|
||||
await page.goto(`${prefix}/docs/hub/${slug}`);
|
||||
await expect(page.getByRole("heading", { name: heading, level: 1 })).toBeVisible();
|
||||
}
|
||||
|
||||
async function expectHubDocRedirect(
|
||||
page: Page,
|
||||
prefix: string,
|
||||
legacySlug: string,
|
||||
slug: string,
|
||||
heading: string,
|
||||
) {
|
||||
await page.goto(`${prefix}/docs/hub/${legacySlug}`);
|
||||
await expect(page).toHaveURL(`${prefix}/docs/hub/${slug}`);
|
||||
await expect(page.getByRole("heading", { name: heading, level: 1 })).toBeVisible();
|
||||
}
|
||||
|
||||
for (const { locale, prefix, linear, linearApp, webhooks, triggers, reference } of [
|
||||
for (const {
|
||||
locale,
|
||||
prefix,
|
||||
linearTab,
|
||||
linearDocsLink,
|
||||
linearTriggerHeading,
|
||||
linearAppLink,
|
||||
linearAppHeading,
|
||||
webhooksTab,
|
||||
webhooksDocsLink,
|
||||
webhooksHeading,
|
||||
} of [
|
||||
{
|
||||
locale: "English",
|
||||
prefix: "",
|
||||
linear: "Linear triggers",
|
||||
linearApp: "Linear for Hub",
|
||||
webhooks: "Inbound webhooks",
|
||||
triggers: "Triggers",
|
||||
reference: "Trigger YAML reference",
|
||||
linearTab: /^Linear\b/,
|
||||
linearDocsLink: "Read Linear docs",
|
||||
linearTriggerHeading: "Linear triggers",
|
||||
linearAppLink: "Linear app",
|
||||
linearAppHeading: "Linear for Hub",
|
||||
webhooksTab: /^Webhooks\b/,
|
||||
webhooksDocsLink: "Read Webhooks docs",
|
||||
webhooksHeading: "Inbound webhooks",
|
||||
},
|
||||
{
|
||||
locale: "Simplified Chinese",
|
||||
locale: "Chinese",
|
||||
prefix: "/zh-CN",
|
||||
linear: "Linear 触发器",
|
||||
linearApp: "为 Hub 配置 Linear",
|
||||
webhooks: "入站 webhook",
|
||||
triggers: "触发器",
|
||||
reference: "触发器 YAML 参考",
|
||||
linearTab: /^Linear\b/,
|
||||
linearDocsLink: "阅读 Linear 文档",
|
||||
linearTriggerHeading: "Linear 触发器",
|
||||
linearAppLink: "Linear 应用",
|
||||
linearAppHeading: "为 Hub 配置 Linear",
|
||||
webhooksTab: /^Webhook\b/,
|
||||
webhooksDocsLink: "阅读 Webhook 文档",
|
||||
webhooksHeading: "入站 webhook",
|
||||
},
|
||||
]) {
|
||||
test(`opens ${locale} Hub guides and redirects legacy bookmarks`, async ({ page }) => {
|
||||
await test.step("opens direct links to the new guides", async () => {
|
||||
await openHubDoc(page, prefix, "triggers/linear", linear);
|
||||
await openHubDoc(page, prefix, "self-hosting/linear-app", linearApp);
|
||||
await openHubDoc(page, prefix, "triggers/webhooks", webhooks);
|
||||
test(`navigates from the ${locale} Hub showcase to Linear and Webhook docs`, async ({ page }) => {
|
||||
await page.goto(`${prefix}/hub`);
|
||||
|
||||
await test.step("opens Linear trigger docs and Linear app setup", async () => {
|
||||
await selectHubSourceTab(page, linearTab);
|
||||
const triggerLink = page.getByRole("link", { name: linearDocsLink, exact: true });
|
||||
await expect(triggerLink).toHaveAttribute("href", `${prefix}/docs/hub/triggers/linear`);
|
||||
await triggerLink.click();
|
||||
await expect(
|
||||
page.getByRole("heading", { name: linearTriggerHeading, level: 1 }),
|
||||
).toBeVisible();
|
||||
await expect(page.getByText("linear.comment_created", { exact: true }).first()).toBeVisible();
|
||||
|
||||
const appLink = page.locator("main").getByRole("link", { name: linearAppLink, exact: true });
|
||||
await expect(appLink).toHaveAttribute("href", `${prefix}/docs/hub/self-hosting/linear-app`);
|
||||
await appLink.click();
|
||||
await expect(page.getByRole("heading", { name: linearAppHeading, level: 1 })).toBeVisible();
|
||||
});
|
||||
|
||||
await test.step("redirects legacy guides within the same language", async () => {
|
||||
await expectHubDocRedirect(page, prefix, "workflows", "triggers", triggers);
|
||||
await expectHubDocRedirect(
|
||||
page,
|
||||
prefix,
|
||||
"configuration/hub-yml",
|
||||
"configuration/reference",
|
||||
reference,
|
||||
);
|
||||
await test.step("opens Webhooks trigger docs from the Hub showcase", async () => {
|
||||
await page.goto(`${prefix}/hub`);
|
||||
await selectHubSourceTab(page, webhooksTab);
|
||||
const webhookLink = page.getByRole("link", { name: webhooksDocsLink, exact: true });
|
||||
await expect(webhookLink).toHaveAttribute("href", `${prefix}/docs/hub/triggers/webhooks`);
|
||||
await webhookLink.click();
|
||||
await expect(page.getByRole("heading", { name: webhooksHeading, level: 1 })).toBeVisible();
|
||||
await expect(page.getByText("webhook.received", { exact: true }).first()).toBeVisible();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ test("the opening scene waits until most of the mockup is on screen", async ({ p
|
||||
});
|
||||
|
||||
test("the opening scene starts in a window shorter than most of the mockup", async ({ page }) => {
|
||||
await openHomepage(page, { width: 1400, height: 400 });
|
||||
await openHomepage(page, { width: 1400, height: 320 });
|
||||
const mockup = page.getByRole("img", { name: desktopName, exact: true });
|
||||
const request = mockup.getByText("Fix the issues labeled ready, one worktree each.");
|
||||
await mockup.scrollIntoViewIfNeeded();
|
||||
|
||||
@@ -586,6 +586,7 @@ test.describe("registry fixture layout", () => {
|
||||
] as const) {
|
||||
await page.setViewportSize({ width, height: 720 });
|
||||
await page.goto("/plugins/omercnet/dracula");
|
||||
await expectPageWithinViewport(page);
|
||||
const three = page.getByRole("link", { name: /^Dracula (screenshot|video) \d$/ });
|
||||
const shares = await three.evaluateAll(visibleShares);
|
||||
expect(shares.map((share) => (share > 0.1 && share < 0.5 ? "peeks" : share))).toEqual(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { createServer } from "node:http";
|
||||
import registry from "./registry.fixture.json" with { type: "json" };
|
||||
import hubPlans from "../src/hub-plans.fixture.json" with { type: "json" };
|
||||
|
||||
import securityPlugin from "./overview.fixture.json" with { type: "json" };
|
||||
|
||||
@@ -13,6 +14,10 @@ securityPlugin.readme +=
|
||||
// Serve the published registry contract so SSR and browser navigation use the same data.
|
||||
createServer((request, response) => {
|
||||
response.setHeader("Content-Type", "application/json");
|
||||
if (request.url === "/hub-plans") {
|
||||
response.end(JSON.stringify(hubPlans));
|
||||
return;
|
||||
}
|
||||
if (request.url === "/index.json") {
|
||||
response.end(JSON.stringify(registry));
|
||||
return;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"@cloudflare/vite-plugin": "^1.29.1",
|
||||
"@cloudflare/workers-types": "^4.20260317.1",
|
||||
"@fontsource-variable/geist": "^5.3.0",
|
||||
"@fontsource-variable/plus-jakarta-sans": "^5.3.0",
|
||||
"@getpaseo/protocol": "*",
|
||||
"@tanstack/react-router": "^1.170.16",
|
||||
"@tanstack/react-start": "^1.168.26",
|
||||
|
||||
@@ -31,6 +31,7 @@ export default defineConfig({
|
||||
),
|
||||
CLOUDFLARE_INCLUDE_PROCESS_ENV: "true",
|
||||
PLUGINS_REGISTRY_URL: "http://127.0.0.1:8188",
|
||||
VITE_HUB_PLANS_URL: "http://127.0.0.1:8188/hub-plans",
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { useLoaderData } from "@tanstack/react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { LandingPage } from "~/components/landing-page";
|
||||
import { type AgentPageSlug, getAgentPage } from "~/data/agent-pages";
|
||||
import { getTranslator, routeLocale } from "~/i18n";
|
||||
import { pageMeta } from "~/meta";
|
||||
import { getPluginCount } from "~/plugins";
|
||||
|
||||
export function agentRouteOptions(slug: AgentPageSlug) {
|
||||
return {
|
||||
@@ -16,10 +18,18 @@ export function agentRouteOptions(slug: AgentPageSlug) {
|
||||
locale,
|
||||
});
|
||||
},
|
||||
loader: async () => ({ pluginCount: await getPluginCount() }),
|
||||
component: function AgentLandingPage() {
|
||||
const { t } = useTranslation();
|
||||
const data = useLoaderData({ strict: false }) as { pluginCount?: number | null } | undefined;
|
||||
const page = getAgentPage(slug, t);
|
||||
return <LandingPage title={page.title} subtitle={page.subtitle} />;
|
||||
return (
|
||||
<LandingPage
|
||||
title={page.title}
|
||||
subtitle={page.subtitle}
|
||||
pluginCount={data?.pluginCount ?? null}
|
||||
/>
|
||||
);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -45,6 +45,20 @@ export function SlackIcon(props: React.SVGProps<SVGSVGElement>) {
|
||||
);
|
||||
}
|
||||
|
||||
export function LinearIcon(props: React.SVGProps<SVGSVGElement>) {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
aria-hidden="true"
|
||||
{...props}
|
||||
>
|
||||
<path d="M2.886 4.18A11.982 11.982 0 0 1 11.99 0C18.624 0 24 5.376 24 12.009c0 3.64-1.62 6.903-4.18 9.105L2.887 4.18ZM1.817 5.626l16.556 16.556c-.524.33-1.075.62-1.65.866L.951 7.277c.247-.575.537-1.126.866-1.65ZM.322 9.163l14.515 14.515c-.71.172-1.443.282-2.195.322L0 11.358a12 12 0 0 1 .322-2.195Zm-.17 4.862 9.823 9.824a12.02 12.02 0 0 1-9.824-9.824Z" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
export function OpenCollectiveIcon(props: React.SVGProps<SVGSVGElement>) {
|
||||
return (
|
||||
<svg
|
||||
|
||||
@@ -2,15 +2,25 @@ import type { ReactNode } from "react";
|
||||
|
||||
export function FAQItem({ question, children }: { question: string; children: ReactNode }) {
|
||||
return (
|
||||
<details className="group">
|
||||
<summary className="font-medium text-sm cursor-pointer list-none grid grid-cols-[1.25rem_1fr] items-baseline">
|
||||
<span className="font-mono text-lg leading-none text-white/40 group-open:hidden">+</span>
|
||||
<span className="font-mono text-lg leading-none text-white/40 hidden group-open:inline">
|
||||
<details className="group py-5 first:pt-4 last:pb-4">
|
||||
<summary className="flex cursor-pointer list-none items-baseline justify-between gap-6 text-[15px] font-medium text-white/90 transition-colors hover:text-white">
|
||||
<span>{question}</span>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="shrink-0 font-mono text-base leading-none text-white/40 transition-colors group-hover:text-white/70 group-open:hidden"
|
||||
>
|
||||
+
|
||||
</span>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="hidden shrink-0 font-mono text-base leading-none text-accent-text group-open:inline"
|
||||
>
|
||||
−
|
||||
</span>
|
||||
{question}
|
||||
</summary>
|
||||
<div className="text-sm text-muted-foreground space-y-2 mt-2 pl-5 prose">{children}</div>
|
||||
<div className="prose mt-3 max-w-2xl space-y-2.5 text-sm leading-relaxed text-muted-foreground">
|
||||
{children}
|
||||
</div>
|
||||
</details>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
import { Check, CornerDownRight, GitPullRequest, Hash, PlusCircle } from "lucide-react";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { DiscordIcon } from "~/components/brand-icons";
|
||||
import {
|
||||
MoAvatar,
|
||||
MockupStageWindow,
|
||||
MockupStep,
|
||||
OpenInPaseoChip,
|
||||
PaseoBotAvatar,
|
||||
type SourceMockupProps,
|
||||
WindowTrafficLights,
|
||||
} from "./shared";
|
||||
|
||||
const DISCORD_CHANNELS = ["general", "engineering", "bugs", "releases"] as const;
|
||||
|
||||
const STEP_DELAYS = {
|
||||
userMention: 0.06,
|
||||
threadStart: 0.55,
|
||||
botWorking: 1.05,
|
||||
botDone: 1.7,
|
||||
} as const;
|
||||
|
||||
const DISCORD_COMPONENTS = {
|
||||
mention: (
|
||||
<span className="rounded-[3px] bg-[#5865F2]/30 px-1 py-[0.5px] font-medium text-[#C9CDFB]">
|
||||
@paseo-bot
|
||||
</span>
|
||||
),
|
||||
host: (
|
||||
<span className="rounded-[3px] bg-[#1E1F22] px-1.5 py-[1px] font-mono text-[11px] text-[#DBDEE1]" />
|
||||
),
|
||||
issue: <span className="font-mono text-[12px] text-[#00A8FC]">#2799</span>,
|
||||
};
|
||||
|
||||
export function DiscordSourceMockup({ active, reduceMotion }: SourceMockupProps) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<MockupStageWindow
|
||||
ariaLabel={t("hub.demo.discord.alt")}
|
||||
active={active}
|
||||
reduceMotion={reduceMotion}
|
||||
className="border-[#3F4147] bg-[#313338]"
|
||||
>
|
||||
<DiscordChrome />
|
||||
|
||||
<div className="grid min-h-0 flex-1 grid-cols-1 md:grid-cols-[164px_minmax(0,1fr)]">
|
||||
<DiscordSidebar />
|
||||
<div className="flex min-h-0 min-w-0 flex-col bg-[#313338]">
|
||||
<DiscordChannelHeader />
|
||||
<DiscordMessageFeed />
|
||||
<DiscordComposer />
|
||||
</div>
|
||||
</div>
|
||||
</MockupStageWindow>
|
||||
);
|
||||
}
|
||||
|
||||
function DiscordMessageFeed() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="flex-1 space-y-3 px-4 py-3">
|
||||
<MockupStep delay={STEP_DELAYS.userMention}>
|
||||
<DiscordMessage author="mo" time={t("hub.demo.discord.time1")}>
|
||||
<p>
|
||||
<Trans i18nKey="hub.demo.discord.userPrompt" components={DISCORD_COMPONENTS} />
|
||||
</p>
|
||||
</DiscordMessage>
|
||||
</MockupStep>
|
||||
|
||||
<MockupStep
|
||||
delay={STEP_DELAYS.threadStart}
|
||||
className="flex items-start gap-2 pl-2 text-[11.5px] text-[#949BA4]"
|
||||
>
|
||||
<CornerDownRight className="h-3.5 w-3.5 shrink-0 text-[#949BA4]" aria-hidden="true" />
|
||||
<p>
|
||||
<span className="font-medium text-[#F2F3F5]">paseo-bot</span>{" "}
|
||||
{t("hub.demo.discord.startedThread")}{" "}
|
||||
<span className="font-semibold text-[#F2F3F5]">{t("hub.demo.discord.threadTitle")}</span>
|
||||
</p>
|
||||
</MockupStep>
|
||||
|
||||
<div className="ml-3 space-y-3 border-l-2 border-[#4E5058] pl-3.5">
|
||||
<MockupStep delay={STEP_DELAYS.botWorking}>
|
||||
<DiscordMessage author="paseo-bot" time={t("hub.demo.discord.time1")} bot>
|
||||
<p className="text-[#DBDEE1]">
|
||||
<Trans i18nKey="hub.demo.discord.botStarted" components={DISCORD_COMPONENTS} />
|
||||
</p>
|
||||
</DiscordMessage>
|
||||
</MockupStep>
|
||||
|
||||
<MockupStep delay={STEP_DELAYS.botDone}>
|
||||
<DiscordMessage author="paseo-bot" time={t("hub.demo.discord.time2")} bot>
|
||||
<p className="text-[#DBDEE1]">{t("hub.demo.discord.botFinished")}</p>
|
||||
<DiscordPrEmbed />
|
||||
</DiscordMessage>
|
||||
</MockupStep>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function DiscordPrEmbed() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="mt-2 space-y-2">
|
||||
<div className="rounded-[4px] border-l-[4px] border-[#2BAC76] bg-[#2B2D31] px-3 py-2.5">
|
||||
<div className="flex items-center gap-1.5 text-[12px] font-semibold text-[#00A8FC]">
|
||||
<GitPullRequest className="h-3.5 w-3.5 shrink-0 text-[#2BAC76]" aria-hidden="true" />
|
||||
<span>getpaseo/paseo#2825</span>
|
||||
</div>
|
||||
<p className="mt-0.5 text-[12px] text-[#DBDEE1]">
|
||||
fix(worktree): prune orphaned branches on close
|
||||
</p>
|
||||
<div className="mt-2 grid grid-cols-3 gap-2 text-[11px]">
|
||||
<div>
|
||||
<p className="font-semibold text-[#B5BAC1]">{t("hub.demo.discord.fieldHost")}</p>
|
||||
<p className="font-mono text-[#DBDEE1]">devbox</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="font-semibold text-[#B5BAC1]">{t("hub.demo.discord.fieldDiff")}</p>
|
||||
<p className="font-mono text-[#DBDEE1]">+46 -12</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="font-semibold text-[#B5BAC1]">{t("hub.demo.discord.fieldChecks")}</p>
|
||||
<p className="inline-flex items-center gap-1 text-[#57F287]">
|
||||
<Check className="h-3 w-3" aria-hidden="true" />
|
||||
{t("hub.demo.shared.testsPassed")}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<OpenInPaseoChip variant="discord" />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function DiscordComposer() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div
|
||||
aria-hidden="true"
|
||||
className="mx-4 mt-auto mb-3 flex items-center gap-2.5 rounded-[8px] bg-[#383A40] px-3 py-2 text-[12.5px] text-[#80848E]"
|
||||
>
|
||||
<PlusCircle className="h-4 w-4 shrink-0 text-[#B5BAC1]" />
|
||||
<span className="truncate">{t("hub.demo.discord.composerPlaceholder")}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function DiscordChrome() {
|
||||
return (
|
||||
<div className="flex h-9 shrink-0 items-center justify-between border-b border-[#1E1F22] bg-[#1E1F22] px-3.5">
|
||||
<div className="flex items-center gap-3">
|
||||
<WindowTrafficLights />
|
||||
<span className="text-[12px] font-semibold text-[#B5BAC1]">Discord</span>
|
||||
</div>
|
||||
<DiscordIcon className="h-3.5 w-3.5 text-[#5865F2]" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function DiscordSidebar() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<aside
|
||||
aria-hidden="true"
|
||||
className="hidden flex-col border-r border-[#1F2023] bg-[#2B2D31] md:flex"
|
||||
>
|
||||
<div className="border-b border-[#1F2023] px-3.5 py-2.5 text-[13.5px] font-bold text-[#F2F3F5]">
|
||||
Paseo
|
||||
</div>
|
||||
<div className="space-y-0.5 px-2 py-3 text-[12.5px]">
|
||||
<p className="px-2 pb-1 text-[10.5px] font-semibold uppercase tracking-wide text-[#949BA4]">
|
||||
{t("hub.demo.discord.textChannels")}
|
||||
</p>
|
||||
{DISCORD_CHANNELS.map((channel) => (
|
||||
<div key={channel}>
|
||||
<div
|
||||
className={`flex items-center gap-1.5 rounded-[5px] px-2 py-1 ${
|
||||
channel === "engineering"
|
||||
? "bg-[#404249] font-medium text-[#F2F3F5]"
|
||||
: "text-[#949BA4]"
|
||||
}`}
|
||||
>
|
||||
<Hash className="h-3.5 w-3.5 shrink-0 opacity-75" />
|
||||
<span className="truncate">{channel}</span>
|
||||
</div>
|
||||
{channel === "engineering" ? (
|
||||
<div className="mt-0.5 ml-3 flex items-center gap-1.5 border-l border-[#4E5058] py-1 pl-2 text-[11.5px] text-[#DBDEE1]">
|
||||
<span className="truncate">{t("hub.demo.discord.threadTitle")}</span>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
|
||||
function DiscordChannelHeader() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="flex shrink-0 items-center justify-between gap-3 border-b border-[#26282C] px-4 py-2">
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
<Hash className="h-4 w-4 shrink-0 text-[#80848E]" aria-hidden="true" />
|
||||
<span className="text-[14px] font-semibold text-[#F2F3F5]">engineering</span>
|
||||
<span className="hidden h-3.5 w-px bg-[#3F4147] sm:inline-block" aria-hidden="true" />
|
||||
<span className="hidden truncate text-[11.5px] text-[#949BA4] sm:inline">
|
||||
{t("hub.demo.discord.channelTopic")}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function DiscordMessage({
|
||||
author,
|
||||
time,
|
||||
bot,
|
||||
children,
|
||||
}: {
|
||||
author: string;
|
||||
time: string;
|
||||
bot?: boolean;
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="flex items-start gap-2.5">
|
||||
{bot ? (
|
||||
<PaseoBotAvatar size="md" rounded="rounded-full" className="mt-0.5" />
|
||||
) : (
|
||||
<MoAvatar size="md" rounded="rounded-full" className="mt-0.5" />
|
||||
)}
|
||||
<div className="min-w-0 flex-1 space-y-0.5">
|
||||
<div className="flex flex-wrap items-center gap-1.5">
|
||||
<span className="text-[13.5px] font-semibold text-[#F2F3F5]">{author}</span>
|
||||
{bot ? (
|
||||
<span className="inline-flex items-center gap-0.5 rounded-[3px] bg-[#5865F2] px-1.5 py-[1px] text-[9.5px] font-semibold uppercase tracking-wide text-white">
|
||||
<Check className="h-2.5 w-2.5" aria-hidden="true" />
|
||||
{t("hub.demo.shared.appBadge")}
|
||||
</span>
|
||||
) : null}
|
||||
<span className="text-[11px] text-[#949BA4]">{time}</span>
|
||||
</div>
|
||||
<div className="text-[13px] leading-[1.45] text-[#DBDEE1]">{children}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
import { Check, CircleDot, GitPullRequest, Tag } from "lucide-react";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { GitHubIcon } from "~/components/brand-icons";
|
||||
import {
|
||||
MoAvatar,
|
||||
MockupStageWindow,
|
||||
MockupStep,
|
||||
OpenInPaseoChip,
|
||||
PaseoBotAvatar,
|
||||
type SourceMockupProps,
|
||||
WindowTrafficLights,
|
||||
} from "./shared";
|
||||
|
||||
const STEP_DELAYS = {
|
||||
issue: 0.06,
|
||||
labelEvent: 0.55,
|
||||
botReply: 1.2,
|
||||
checks: 1.85,
|
||||
} as const;
|
||||
|
||||
const GH_COMPONENTS = {
|
||||
mention: <span className="font-semibold text-[#58A6FF]">@paseo-bot</span>,
|
||||
host: (
|
||||
<span className="rounded-[4px] border border-[#30363D] bg-[#161B22] px-1.5 py-[1px] font-mono text-[11px] text-[#E6EDF3]" />
|
||||
),
|
||||
pr: <span className="font-medium text-[#58A6FF] underline decoration-[#58A6FF]/40" />,
|
||||
code: (
|
||||
<code className="rounded-[4px] bg-[#21262D] px-1.5 py-[1px] font-mono text-[11.5px] text-[#E6EDF3]" />
|
||||
),
|
||||
};
|
||||
|
||||
const CHECK_NAMES = ["typecheck", "vitest", "lint", "build"] as const;
|
||||
|
||||
export function GitHubSourceMockup({ active, reduceMotion }: SourceMockupProps) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<MockupStageWindow
|
||||
ariaLabel={t("hub.demo.github.alt")}
|
||||
active={active}
|
||||
reduceMotion={reduceMotion}
|
||||
className="border-[#30363D] bg-[#0D1117]"
|
||||
>
|
||||
<GitHubChrome />
|
||||
<GitHubIssueHeader />
|
||||
<div className="grid min-h-0 flex-1 grid-cols-1 sm:grid-cols-[minmax(0,1fr)_156px]">
|
||||
<GitHubTimeline />
|
||||
<GitHubSidebar />
|
||||
</div>
|
||||
</MockupStageWindow>
|
||||
);
|
||||
}
|
||||
|
||||
function GitHubTimeline() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="relative space-y-3 px-4 py-3.5">
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="pointer-events-none absolute top-11 bottom-6 left-[27px] w-[2px] bg-[#21262D]"
|
||||
/>
|
||||
|
||||
<MockupStep delay={STEP_DELAYS.issue} className="relative">
|
||||
<GitHubComment
|
||||
author="mo"
|
||||
badge={t("hub.demo.github.authorBadge")}
|
||||
timestamp={t("hub.demo.github.openedAgo")}
|
||||
>
|
||||
<p>
|
||||
<Trans i18nKey="hub.demo.github.issueBody" components={GH_COMPONENTS} />
|
||||
</p>
|
||||
</GitHubComment>
|
||||
</MockupStep>
|
||||
|
||||
<MockupStep
|
||||
delay={STEP_DELAYS.labelEvent}
|
||||
className="relative flex items-center gap-2.5 pl-1"
|
||||
>
|
||||
<span className="relative z-10 flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-[#30363D] bg-[#161B22] text-[#8B949E]">
|
||||
<Tag className="h-3 w-3" aria-hidden="true" />
|
||||
</span>
|
||||
<div className="flex flex-wrap items-center gap-1.5 text-[11.5px] text-[#8B949E]">
|
||||
<span className="font-semibold text-[#E6EDF3]">mo</span>
|
||||
<span>{t("hub.demo.github.addedLabel")}</span>
|
||||
<span className="rounded-full border border-[#20744A]/60 bg-[#20744A]/20 px-2 py-[1px] font-mono text-[10.5px] font-medium text-[#6CB17B]">
|
||||
paseo
|
||||
</span>
|
||||
<span>·</span>
|
||||
<span>{t("hub.demo.github.startedOn")}</span>
|
||||
</div>
|
||||
</MockupStep>
|
||||
|
||||
<MockupStep delay={STEP_DELAYS.botReply} className="relative">
|
||||
<GitHubComment
|
||||
author="paseo-bot"
|
||||
badge={t("hub.demo.github.botBadge")}
|
||||
timestamp={t("hub.demo.github.repliedAgo")}
|
||||
bot
|
||||
>
|
||||
<p>
|
||||
<Trans i18nKey="hub.demo.github.botReply" components={GH_COMPONENTS} />
|
||||
</p>
|
||||
<GitHubPrSummaryCard />
|
||||
</GitHubComment>
|
||||
</MockupStep>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function GitHubPrSummaryCard() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<MockupStep
|
||||
delay={STEP_DELAYS.checks}
|
||||
className="mt-2.5 overflow-hidden rounded-md border border-[#30363D] bg-[#0D1117]"
|
||||
>
|
||||
<div className="flex flex-wrap items-center justify-between gap-2 border-b border-[#21262D] bg-[#161B22] px-3 py-2">
|
||||
<div className="flex min-w-0 items-center gap-1.5">
|
||||
<GitPullRequest className="h-3.5 w-3.5 shrink-0 text-[#3FB950]" aria-hidden="true" />
|
||||
<span className="text-[12px] font-semibold text-[#E6EDF3]">
|
||||
fix(terminal): drain PTY write queue under burst
|
||||
</span>
|
||||
<span className="font-mono text-[11px] text-[#8B949E]">#2819</span>
|
||||
</div>
|
||||
<span className="shrink-0 font-mono text-[11px]">
|
||||
<span className="text-[#3FB950]">+84</span> <span className="text-[#F85149]">-19</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap items-center justify-between gap-2 px-3 py-2">
|
||||
<div className="flex flex-wrap items-center gap-1.5">
|
||||
<span className="inline-flex items-center gap-1 text-[11.5px] font-medium text-[#3FB950]">
|
||||
<Check className="h-3.5 w-3.5" aria-hidden="true" />
|
||||
{t("hub.demo.github.checksPassed")}
|
||||
</span>
|
||||
<span className="hidden items-center gap-1 sm:inline-flex">
|
||||
{CHECK_NAMES.map((name) => (
|
||||
<span
|
||||
key={name}
|
||||
className="rounded border border-[#30363D] bg-[#161B22] px-1.5 py-[1px] font-mono text-[10px] text-[#8B949E]"
|
||||
>
|
||||
{name}
|
||||
</span>
|
||||
))}
|
||||
</span>
|
||||
</div>
|
||||
<OpenInPaseoChip variant="brand" />
|
||||
</div>
|
||||
</MockupStep>
|
||||
);
|
||||
}
|
||||
|
||||
function GitHubChrome() {
|
||||
return (
|
||||
<div className="flex h-9 shrink-0 items-center justify-between border-b border-[#21262D] bg-[#010409] px-3.5">
|
||||
<div className="flex items-center gap-3">
|
||||
<WindowTrafficLights />
|
||||
<div className="flex items-center gap-1.5 text-[12px] text-[#8B949E]">
|
||||
<GitHubIcon className="h-3.5 w-3.5 text-[#E6EDF3]" />
|
||||
<span>getpaseo</span>
|
||||
<span className="text-[#484F58]">/</span>
|
||||
<span className="font-semibold text-[#E6EDF3]">paseo</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="hidden items-center gap-4 text-[11.5px] text-[#8B949E] sm:flex"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<span className="relative py-2 font-medium text-[#E6EDF3]">
|
||||
Issues
|
||||
<span className="absolute right-0 -bottom-[3px] left-0 h-[2px] rounded-full bg-[#F78166]" />
|
||||
</span>
|
||||
<span>Pull requests</span>
|
||||
<span>Actions</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function GitHubIssueHeader() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="shrink-0 border-b border-[#21262D] px-4 py-3">
|
||||
<div className="flex flex-wrap items-baseline gap-x-2 gap-y-1">
|
||||
<h4 className="text-[15px] font-semibold text-[#E6EDF3]">
|
||||
{t("hub.demo.github.issueTitle")}
|
||||
</h4>
|
||||
<span className="font-mono text-[14px] text-[#8B949E]">#2811</span>
|
||||
</div>
|
||||
<div className="mt-1.5 flex flex-wrap items-center gap-2 text-[11.5px] text-[#8B949E]">
|
||||
<span className="inline-flex items-center gap-1 rounded-full bg-[#238636] px-2.5 py-0.5 text-[11px] font-semibold text-white">
|
||||
<CircleDot className="h-3 w-3" aria-hidden="true" />
|
||||
Open
|
||||
</span>
|
||||
<span>
|
||||
<strong className="font-semibold text-[#E6EDF3]">mo</strong>{" "}
|
||||
{t("hub.demo.github.issueMeta")}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function GitHubComment({
|
||||
author,
|
||||
badge,
|
||||
timestamp,
|
||||
bot,
|
||||
children,
|
||||
}: {
|
||||
author: string;
|
||||
badge: string;
|
||||
timestamp: string;
|
||||
bot?: boolean;
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<div className="flex items-start gap-2.5">
|
||||
{bot ? (
|
||||
<PaseoBotAvatar size="sm" rounded="rounded-full" className="relative z-10 mt-0.5 h-7 w-7" />
|
||||
) : (
|
||||
<MoAvatar size="sm" rounded="rounded-full" className="relative z-10 mt-0.5 h-7 w-7" />
|
||||
)}
|
||||
<div className="min-w-0 flex-1 overflow-hidden rounded-md border border-[#30363D] bg-[#0D1117]">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2 border-b border-[#21262D] bg-[#161B22] px-3 py-1.5 text-[11.5px]">
|
||||
<div className="flex items-center gap-1.5">
|
||||
<span className="font-semibold text-[#E6EDF3]">{author}</span>
|
||||
<span className="rounded-full border border-[#30363D] px-1.5 py-[0.5px] text-[10px] font-medium text-[#8B949E]">
|
||||
{badge}
|
||||
</span>
|
||||
</div>
|
||||
<span className="text-[11px] text-[#8B949E]">{timestamp}</span>
|
||||
</div>
|
||||
<div className="px-3 py-2.5 text-[12.5px] leading-[1.5] text-[#C9D1D9]">{children}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function GitHubSidebar() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<aside
|
||||
aria-hidden="true"
|
||||
className="hidden flex-col gap-3.5 border-l border-[#21262D] px-3.5 py-3.5 text-[11.5px] sm:flex"
|
||||
>
|
||||
<div className="space-y-1.5 border-b border-[#21262D] pb-3">
|
||||
<p className="font-medium text-[#8B949E]">{t("hub.demo.github.assignees")}</p>
|
||||
<div className="flex items-center gap-1.5 text-[#E6EDF3]">
|
||||
<PaseoBotAvatar size="xs" rounded="rounded-full" />
|
||||
<span className="font-medium">paseo-bot</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-1.5 border-b border-[#21262D] pb-3">
|
||||
<p className="font-medium text-[#8B949E]">{t("hub.demo.github.labels")}</p>
|
||||
<div className="flex flex-wrap gap-1">
|
||||
<span className="rounded-full border border-[#F85149]/40 bg-[#F85149]/15 px-2 py-[1px] text-[10.5px] font-medium text-[#FF7B72]">
|
||||
bug
|
||||
</span>
|
||||
<span className="rounded-full border border-[#D29922]/40 bg-[#D29922]/15 px-2 py-[1px] text-[10.5px] font-medium text-[#E3B341]">
|
||||
p0
|
||||
</span>
|
||||
<span className="rounded-full border border-[#20744A]/60 bg-[#20744A]/20 px-2 py-[1px] text-[10.5px] font-medium text-[#6CB17B]">
|
||||
paseo
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-1.5 border-b border-[#21262D] pb-3">
|
||||
<p className="font-medium text-[#8B949E]">{t("hub.demo.github.development")}</p>
|
||||
<div className="flex items-center gap-1.5 text-[#58A6FF]">
|
||||
<GitPullRequest className="h-3.5 w-3.5 shrink-0 text-[#3FB950]" />
|
||||
<span className="font-mono text-[11.5px]">#2819</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-1">
|
||||
<p className="font-medium text-[#8B949E]">{t("hub.demo.github.daemon")}</p>
|
||||
<span className="inline-block rounded border border-[#30363D] bg-[#161B22] px-1.5 py-0.5 font-mono text-[11px] text-[#E6EDF3]">
|
||||
macbook-pro
|
||||
</span>
|
||||
</div>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
import { useInView, useReducedMotion } from "framer-motion";
|
||||
import { ArrowRight } from "lucide-react";
|
||||
import * as React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
HUB_TRIGGER_SOURCES,
|
||||
type HubTriggerSource,
|
||||
type HubTriggerSourceId,
|
||||
} from "~/components/hub-flow";
|
||||
import { useLocalizePath } from "~/i18n";
|
||||
import { DiscordSourceMockup } from "./discord-mockup";
|
||||
import { GitHubSourceMockup } from "./github-mockup";
|
||||
import { LinearSourceMockup } from "./linear-mockup";
|
||||
import { SchedulesSourceMockup } from "./schedules-mockup";
|
||||
import type { SourceMockupProps } from "./shared";
|
||||
import { SlackSourceMockup } from "./slack-mockup";
|
||||
import { WebhooksSourceMockup } from "./webhooks-mockup";
|
||||
|
||||
const SHOWCASE_ORDER: readonly HubTriggerSourceId[] = [
|
||||
"slack",
|
||||
"github",
|
||||
"linear",
|
||||
"discord",
|
||||
"schedules",
|
||||
"webhooks",
|
||||
];
|
||||
|
||||
const SOURCE_DOC_PATHS: Record<HubTriggerSourceId, string> = {
|
||||
slack: "/docs/hub/triggers/slack",
|
||||
github: "/docs/hub/triggers/github",
|
||||
linear: "/docs/hub/triggers/linear",
|
||||
discord: "/docs/hub/triggers/discord",
|
||||
schedules: "/docs/hub/triggers/schedules",
|
||||
webhooks: "/docs/hub/triggers/webhooks",
|
||||
};
|
||||
|
||||
const SHOWCASE_SOURCES: readonly HubTriggerSource[] = SHOWCASE_ORDER.map((id) => {
|
||||
const source = HUB_TRIGGER_SOURCES.find((item) => item.id === id);
|
||||
if (!source) {
|
||||
throw new Error(`Missing Hub trigger source metadata for "${id}"`);
|
||||
}
|
||||
return source;
|
||||
});
|
||||
|
||||
const SOURCE_MOCKUPS: Record<HubTriggerSourceId, React.ComponentType<SourceMockupProps>> = {
|
||||
slack: SlackSourceMockup,
|
||||
github: GitHubSourceMockup,
|
||||
linear: LinearSourceMockup,
|
||||
discord: DiscordSourceMockup,
|
||||
schedules: SchedulesSourceMockup,
|
||||
webhooks: WebhooksSourceMockup,
|
||||
};
|
||||
|
||||
const STAGE_IN_VIEW_OPTIONS = { once: true, margin: "-60px" } as const;
|
||||
const PANEL_ID = "hub-source-panel";
|
||||
|
||||
/**
|
||||
* Interactive split showcase for Paseo Hub automation sources:
|
||||
* left clickable pills on desktop (compact pill grid on mobile) paired with a fixed-height
|
||||
* right stage that swaps between authentic, animated dark-mode mockups with zero layout shift.
|
||||
*/
|
||||
export function HubAutomationsShowcase() {
|
||||
const { t } = useTranslation();
|
||||
const localize = useLocalizePath();
|
||||
const reduceMotion = useReducedMotion() === true;
|
||||
const [selected, setSelected] = React.useState<HubTriggerSourceId>("slack");
|
||||
const stageRef = React.useRef<HTMLDivElement | null>(null);
|
||||
const tabRefs = React.useRef<Partial<Record<HubTriggerSourceId, HTMLButtonElement | null>>>({});
|
||||
const isInView = useInView(stageRef, STAGE_IN_VIEW_OPTIONS);
|
||||
|
||||
const ActiveMockup = SOURCE_MOCKUPS[selected];
|
||||
|
||||
const registerTabRef = React.useCallback(
|
||||
(id: HubTriggerSourceId, node: HTMLButtonElement | null) => {
|
||||
tabRefs.current[id] = node;
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
const handleNavigate = React.useCallback((index: number, key: string): boolean => {
|
||||
let nextIndex: number | null = null;
|
||||
if (key === "ArrowDown" || key === "ArrowRight") {
|
||||
nextIndex = (index + 1) % SHOWCASE_SOURCES.length;
|
||||
} else if (key === "ArrowUp" || key === "ArrowLeft") {
|
||||
nextIndex = (index - 1 + SHOWCASE_SOURCES.length) % SHOWCASE_SOURCES.length;
|
||||
} else if (key === "Home") {
|
||||
nextIndex = 0;
|
||||
} else if (key === "End") {
|
||||
nextIndex = SHOWCASE_SOURCES.length - 1;
|
||||
}
|
||||
if (nextIndex === null) return false;
|
||||
const nextId = SHOWCASE_SOURCES[nextIndex].id;
|
||||
setSelected(nextId);
|
||||
tabRefs.current[nextId]?.focus();
|
||||
return true;
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="grid items-start gap-6 lg:grid-cols-[292px_minmax(0,1fr)] lg:gap-6">
|
||||
<div className="space-y-2.5">
|
||||
<div
|
||||
role="tablist"
|
||||
aria-label={t("hub.demo.shared.tablistLabel")}
|
||||
className="grid grid-cols-2 gap-1.5 min-[375px]:grid-cols-3 sm:gap-2 lg:flex lg:flex-col lg:gap-1.5"
|
||||
>
|
||||
{SHOWCASE_SOURCES.map((source, index) => (
|
||||
<SourceTabButton
|
||||
key={source.id}
|
||||
source={source}
|
||||
index={index}
|
||||
isSelected={source.id === selected}
|
||||
onSelect={setSelected}
|
||||
onNavigate={handleNavigate}
|
||||
registerRef={registerTabRef}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<p className="text-xs text-muted-foreground lg:hidden">
|
||||
{t(`hub.sources.${selected}.description`)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<figure ref={stageRef} className="min-w-0 space-y-3">
|
||||
<div
|
||||
role="tabpanel"
|
||||
id={PANEL_ID}
|
||||
aria-labelledby={`hub-source-tab-${selected}`}
|
||||
tabIndex={0}
|
||||
className="relative focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent-text lg:h-[33rem]"
|
||||
>
|
||||
<ActiveMockup active={isInView} reduceMotion={reduceMotion} />
|
||||
</div>
|
||||
|
||||
<figcaption className="flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1.5 min-h-[1.25rem] text-sm text-muted-foreground">
|
||||
<span>{t(`hub.demo.${selected}.caption`)}</span>
|
||||
<a
|
||||
href={localize(SOURCE_DOC_PATHS[selected])}
|
||||
className="inline-flex shrink-0 items-center gap-1.5 text-sm text-white/75 transition-colors hover:text-accent-text"
|
||||
>
|
||||
{t("hub.demo.shared.docsLink", { source: t(`hub.sources.${selected}.name`) })}
|
||||
<ArrowRight className="h-3.5 w-3.5" aria-hidden="true" />
|
||||
</a>
|
||||
</figcaption>
|
||||
</figure>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function SourceTabButton({
|
||||
source,
|
||||
index,
|
||||
isSelected,
|
||||
onSelect,
|
||||
onNavigate,
|
||||
registerRef,
|
||||
}: {
|
||||
source: HubTriggerSource;
|
||||
index: number;
|
||||
isSelected: boolean;
|
||||
onSelect: (id: HubTriggerSourceId) => void;
|
||||
onNavigate: (index: number, key: string) => boolean;
|
||||
registerRef: (id: HubTriggerSourceId, node: HTMLButtonElement | null) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const { id, Icon } = source;
|
||||
|
||||
const setRef = React.useCallback(
|
||||
(node: HTMLButtonElement | null) => {
|
||||
registerRef(id, node);
|
||||
},
|
||||
[id, registerRef],
|
||||
);
|
||||
|
||||
const handleClick = React.useCallback(() => {
|
||||
onSelect(id);
|
||||
}, [id, onSelect]);
|
||||
|
||||
const handleKeyDown = React.useCallback(
|
||||
(event: React.KeyboardEvent<HTMLButtonElement>) => {
|
||||
if (onNavigate(index, event.key)) {
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
[index, onNavigate],
|
||||
);
|
||||
|
||||
return (
|
||||
<button
|
||||
ref={setRef}
|
||||
type="button"
|
||||
role="tab"
|
||||
id={`hub-source-tab-${id}`}
|
||||
aria-selected={isSelected}
|
||||
aria-controls={PANEL_ID}
|
||||
tabIndex={isSelected ? 0 : -1}
|
||||
onClick={handleClick}
|
||||
onKeyDown={handleKeyDown}
|
||||
className={`group flex min-h-[42px] cursor-pointer items-center justify-center gap-2 rounded-xl border px-2.5 py-2 text-left transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent-text lg:min-h-0 lg:items-start lg:justify-start lg:gap-3 lg:px-3.5 lg:py-3 ${
|
||||
isSelected
|
||||
? "border-brand-green/55 bg-brand-green/[0.13] text-white"
|
||||
: "border-white/[0.07] bg-white/[0.015] text-white/70 hover:border-white/[0.14] hover:bg-white/[0.035] hover:text-white/90 lg:border-transparent lg:bg-transparent"
|
||||
}`}
|
||||
>
|
||||
<span
|
||||
className={`shrink-0 transition-colors lg:mt-0.5 ${
|
||||
isSelected ? "text-accent-text" : "text-white/55 group-hover:text-white/80"
|
||||
}`}
|
||||
>
|
||||
<Icon className="h-4 w-4 lg:h-[18px] lg:w-[18px]" />
|
||||
</span>
|
||||
|
||||
<span className="min-w-0 flex-1">
|
||||
<span
|
||||
className={`block text-xs leading-5 font-medium wrap-anywhere lg:text-sm ${
|
||||
isSelected ? "text-white" : "text-white/80 group-hover:text-white"
|
||||
}`}
|
||||
>
|
||||
{t(`hub.sources.${id}.name`)}
|
||||
</span>
|
||||
<span
|
||||
className={`mt-0.5 hidden text-xs leading-4 wrap-anywhere lg:block ${
|
||||
isSelected ? "text-white/65" : "text-muted-foreground"
|
||||
}`}
|
||||
>
|
||||
{t(`hub.sources.${id}.description`)}
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { HubAutomationsShowcase } from "./hub-automations-showcase";
|
||||
@@ -0,0 +1,242 @@
|
||||
import { Check, ChevronRight, GitPullRequest, SignalHigh } from "lucide-react";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { LinearIcon } from "~/components/brand-icons";
|
||||
import {
|
||||
MoAvatar,
|
||||
MockupStageWindow,
|
||||
MockupStep,
|
||||
OpenInPaseoChip,
|
||||
PaseoBotAvatar,
|
||||
type SourceMockupProps,
|
||||
WindowTrafficLights,
|
||||
} from "./shared";
|
||||
|
||||
const STEP_DELAYS = {
|
||||
assigned: 0.08,
|
||||
running: 0.65,
|
||||
comment: 1.35,
|
||||
} as const;
|
||||
|
||||
const LINEAR_COMPONENTS = {
|
||||
host: (
|
||||
<span className="rounded bg-[#22252E] px-1.5 py-[1px] font-mono text-[11px] text-[#E3E6F0]" />
|
||||
),
|
||||
code: (
|
||||
<code className="rounded bg-[#22252E] px-1.5 py-[1px] font-mono text-[11px] text-[#C5CCDF]" />
|
||||
),
|
||||
};
|
||||
|
||||
export function LinearSourceMockup({ active, reduceMotion }: SourceMockupProps) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<MockupStageWindow
|
||||
ariaLabel={t("hub.demo.linear.alt")}
|
||||
active={active}
|
||||
reduceMotion={reduceMotion}
|
||||
className="border-[#262932] bg-[#111318]"
|
||||
>
|
||||
<LinearChrome />
|
||||
|
||||
<div className="grid min-h-0 flex-1 grid-cols-1 sm:grid-cols-[minmax(0,1fr)_172px]">
|
||||
<LinearIssuePane />
|
||||
<LinearPropertiesSidebar />
|
||||
</div>
|
||||
</MockupStageWindow>
|
||||
);
|
||||
}
|
||||
|
||||
function LinearIssuePane() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="flex min-h-0 flex-col px-5 py-4">
|
||||
<div className="space-y-1.5 border-b border-[#22252E] pb-3.5">
|
||||
<p className="font-mono text-[11.5px] text-[#8A8F9E]">PAS-418</p>
|
||||
<h4 className="text-[16px] font-semibold tracking-[-0.01em] text-[#F1F3F8]">
|
||||
{t("hub.demo.linear.issueTitle")}
|
||||
</h4>
|
||||
<p className="text-[12.5px] leading-relaxed text-[#9DA3B4]">
|
||||
{t("hub.demo.linear.issueDescription")}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<LinearActivityFeed />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function LinearActivityFeed() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="mt-3.5 flex-1 space-y-3">
|
||||
<p className="text-[11px] font-medium uppercase tracking-wider text-[#6D7385]">
|
||||
{t("hub.demo.linear.activity")}
|
||||
</p>
|
||||
|
||||
<MockupStep
|
||||
delay={STEP_DELAYS.assigned}
|
||||
className="flex items-center gap-2 text-[12px] text-[#9DA3B4]"
|
||||
>
|
||||
<MoAvatar size="xs" rounded="rounded-full" />
|
||||
<span className="min-w-0">
|
||||
<strong className="font-medium text-[#ECEEF4]">mo</strong>{" "}
|
||||
{t("hub.demo.linear.assignedEvent")}{" "}
|
||||
<strong className="font-medium text-[#ECEEF4]">paseo-bot</strong>
|
||||
</span>
|
||||
<span className="ml-auto shrink-0 text-[11px] text-[#6D7385]">11m</span>
|
||||
</MockupStep>
|
||||
|
||||
<LinearRunStatusRow />
|
||||
<LinearBotCommentCard />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function LinearRunStatusRow() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<MockupStep
|
||||
delay={STEP_DELAYS.running}
|
||||
className="flex items-center gap-2.5 rounded-lg border border-[#242834] bg-[#171A21] px-3 py-2 text-[12px]"
|
||||
>
|
||||
<PaseoBotAvatar size="sm" rounded="rounded-full" />
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="flex flex-wrap items-center gap-1.5">
|
||||
<span className="font-medium text-[#ECEEF4]">paseo-bot</span>
|
||||
<span className="text-[#6D7385]">·</span>
|
||||
<span className="text-[#9DA3B4]">
|
||||
<Trans i18nKey="hub.demo.linear.runningOn" components={LINEAR_COMPONENTS} />
|
||||
</span>
|
||||
</div>
|
||||
<p className="mt-0.5 font-mono text-[11px] wrap-anywhere text-[#7D8599]">
|
||||
{t("hub.demo.linear.traceLine")}
|
||||
</p>
|
||||
</div>
|
||||
<Check className="h-3.5 w-3.5 shrink-0 text-[#6CB17B]" aria-hidden="true" />
|
||||
</MockupStep>
|
||||
);
|
||||
}
|
||||
|
||||
function LinearBotCommentCard() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<MockupStep
|
||||
delay={STEP_DELAYS.comment}
|
||||
className="rounded-lg border border-[#262A36] bg-[#161820] p-3.5"
|
||||
>
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<PaseoBotAvatar size="sm" rounded="rounded-full" />
|
||||
<span className="text-[12.5px] font-semibold text-[#F1F3F8]">paseo-bot</span>
|
||||
<span className="rounded bg-[#252936] px-1.5 py-[1px] text-[10px] font-medium uppercase tracking-wide text-[#9DA3B4]">
|
||||
{t("hub.demo.shared.appBadge")}
|
||||
</span>
|
||||
</div>
|
||||
<span className="text-[11px] text-[#6D7385]">6m</span>
|
||||
</div>
|
||||
|
||||
<p className="mt-2 text-[12.5px] leading-[1.5] text-[#C5CCDF]">
|
||||
<Trans i18nKey="hub.demo.linear.botSummary" components={LINEAR_COMPONENTS} />
|
||||
</p>
|
||||
|
||||
<div className="mt-3 flex flex-wrap items-center justify-between gap-2 border-t border-[#242834] pt-2.5">
|
||||
<span className="inline-flex items-center gap-1.5 rounded-md border border-[#2A2F3D] bg-[#1C1F2A] px-2 py-1 font-mono text-[11px] text-[#C5CCDF]">
|
||||
<GitPullRequest className="h-3 w-3 text-[#6CB17B]" aria-hidden="true" />
|
||||
<span>#2822</span>
|
||||
<span className="text-[#6CB17B]">· {t("hub.demo.shared.testsPassed")}</span>
|
||||
</span>
|
||||
<OpenInPaseoChip variant="brand" />
|
||||
</div>
|
||||
</MockupStep>
|
||||
);
|
||||
}
|
||||
|
||||
function LinearChrome() {
|
||||
return (
|
||||
<div className="flex h-9 shrink-0 items-center justify-between border-b border-[#22252E] bg-[#15171E] px-3.5">
|
||||
<div className="flex items-center gap-3">
|
||||
<WindowTrafficLights />
|
||||
<div className="flex items-center gap-1 text-[11.5px] text-[#8A8F9E]">
|
||||
<LinearIcon className="h-3.5 w-3.5 text-[#5E6AD2]" />
|
||||
<span>Paseo</span>
|
||||
<ChevronRight className="h-3 w-3 text-[#555B6E]" aria-hidden="true" />
|
||||
<span>Core</span>
|
||||
<ChevronRight className="h-3 w-3 text-[#555B6E]" aria-hidden="true" />
|
||||
<span className="font-mono text-[#E3E6F0]">PAS-418</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span className="hidden rounded-full border border-[#5E6AD2]/35 bg-[#5E6AD2]/15 px-2 py-0.5 text-[10.5px] font-medium text-[#A4ACEE] sm:inline-block">
|
||||
Cycle 14
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function LinearPropertiesSidebar() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<aside
|
||||
aria-hidden="true"
|
||||
className="hidden flex-col gap-3.5 border-l border-[#22252E] bg-[#13151B] px-3.5 py-4 text-[11.5px] sm:flex"
|
||||
>
|
||||
<p className="text-[11px] font-medium text-[#6D7385]">{t("hub.demo.linear.properties")}</p>
|
||||
|
||||
<LinearPropRow label={t("hub.demo.linear.status")}>
|
||||
<span className="inline-flex items-center gap-1.5 text-[#ECEEF4]">
|
||||
<span className="h-2.5 w-2.5 rounded-full border-2 border-[#6CB17B] bg-[#6CB17B]/35" />
|
||||
<span>In Review</span>
|
||||
</span>
|
||||
</LinearPropRow>
|
||||
|
||||
<LinearPropRow label={t("hub.demo.linear.priority")}>
|
||||
<span className="inline-flex items-center gap-1.5 text-[#ECEEF4]">
|
||||
<SignalHigh className="h-3.5 w-3.5 text-[#F2994A]" />
|
||||
<span>High</span>
|
||||
</span>
|
||||
</LinearPropRow>
|
||||
|
||||
<LinearPropRow label={t("hub.demo.linear.assignee")}>
|
||||
<span className="inline-flex items-center gap-1.5 text-[#ECEEF4]">
|
||||
<PaseoBotAvatar size="xs" rounded="rounded-full" />
|
||||
<span>paseo-bot</span>
|
||||
</span>
|
||||
</LinearPropRow>
|
||||
|
||||
<LinearPropRow label={t("hub.demo.linear.creator")}>
|
||||
<span className="inline-flex items-center gap-1.5 text-[#ECEEF4]">
|
||||
<MoAvatar size="xs" rounded="rounded-full" />
|
||||
<span>mo</span>
|
||||
</span>
|
||||
</LinearPropRow>
|
||||
|
||||
<LinearPropRow label={t("hub.demo.linear.labels")}>
|
||||
<div className="flex flex-wrap gap-1">
|
||||
<span className="inline-flex items-center gap-1 rounded-full border border-[#2A2F3D] bg-[#1A1D26] px-2 py-[1px] text-[10.5px] text-[#C5CCDF]">
|
||||
<span className="h-1.5 w-1.5 rounded-full bg-[#5E6AD2]" />
|
||||
mobile
|
||||
</span>
|
||||
<span className="inline-flex items-center gap-1 rounded-full border border-[#2A2F3D] bg-[#1A1D26] px-2 py-[1px] text-[10.5px] text-[#C5CCDF]">
|
||||
<span className="h-1.5 w-1.5 rounded-full bg-[#6CB17B]" />
|
||||
relay
|
||||
</span>
|
||||
</div>
|
||||
</LinearPropRow>
|
||||
|
||||
<LinearPropRow label={t("hub.demo.linear.daemon")}>
|
||||
<span className="rounded border border-[#2A2F3D] bg-[#1A1D26] px-1.5 py-0.5 font-mono text-[10.5px] text-[#C5CCDF]">
|
||||
devbox
|
||||
</span>
|
||||
</LinearPropRow>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
|
||||
function LinearPropRow({ label, children }: { label: string; children: React.ReactNode }) {
|
||||
return (
|
||||
<div className="space-y-1">
|
||||
<p className="text-[10.5px] text-[#6D7385]">{label}</p>
|
||||
<div>{children}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
import { Check, Clock, GitPullRequest, Hash, TrendingDown } from "lucide-react";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import {
|
||||
MockupStageWindow,
|
||||
MockupStep,
|
||||
OpenInPaseoChip,
|
||||
PaseoBotAvatar,
|
||||
type SourceMockupProps,
|
||||
WindowTrafficLights,
|
||||
} from "./shared";
|
||||
import { SlackColorMark } from "./slack-mockup";
|
||||
|
||||
const STEP_DELAYS = {
|
||||
triggered: 0.06,
|
||||
prOpened: 0.7,
|
||||
slackDigest: 1.4,
|
||||
} as const;
|
||||
|
||||
const SCHEDULE_COMPONENTS = {
|
||||
code: (
|
||||
<code className="rounded bg-white/[0.07] px-1.5 py-[1px] font-mono text-[11px] text-white/90" />
|
||||
),
|
||||
pr: <span className="font-medium text-[#1D9BD1] underline decoration-[#1D9BD1]/40" />,
|
||||
strong: <strong className="font-semibold text-white" />,
|
||||
};
|
||||
|
||||
export function SchedulesSourceMockup({ active, reduceMotion }: SourceMockupProps) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<MockupStageWindow
|
||||
ariaLabel={t("hub.demo.schedules.alt")}
|
||||
active={active}
|
||||
reduceMotion={reduceMotion}
|
||||
className="border-white/[0.1] bg-[#121716]"
|
||||
>
|
||||
<ScheduleChrome />
|
||||
<ScheduleHeaderBar />
|
||||
<div className="flex flex-1 flex-col justify-between gap-3 px-4 py-3.5">
|
||||
<ScheduleStepsList />
|
||||
<ScheduleImpactMetrics />
|
||||
<ScheduleSlackDigestCard />
|
||||
</div>
|
||||
</MockupStageWindow>
|
||||
);
|
||||
}
|
||||
|
||||
function ScheduleChrome() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="flex min-h-9 shrink-0 items-center justify-between gap-2 border-b border-white/[0.07] bg-[#0D1211] px-3.5 py-1">
|
||||
<div className="flex min-w-0 items-center gap-3">
|
||||
<WindowTrafficLights />
|
||||
<div className="flex min-w-0 items-center gap-1.5 font-mono text-[11.5px] text-white/65">
|
||||
<Clock className="h-3.5 w-3.5 shrink-0 text-accent-text" aria-hidden="true" />
|
||||
<span className="wrap-anywhere">.paseo/triggers/daily-ci-optimizer.yml</span>
|
||||
</div>
|
||||
</div>
|
||||
<span className="inline-flex shrink-0 items-center gap-1.5 rounded-full border border-brand-green/50 bg-brand-green/20 px-2 py-0.5 text-[10.5px] font-medium text-accent-text">
|
||||
<span className="h-1.5 w-1.5 rounded-full bg-[#35C264]" />
|
||||
{t("hub.demo.schedules.active")}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function ScheduleHeaderBar() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-white/[0.07] bg-white/[0.02] px-4 py-2.5">
|
||||
<div>
|
||||
<h4 className="text-[14px] font-semibold text-white/95">
|
||||
{t("hub.demo.schedules.jobTitle")}
|
||||
</h4>
|
||||
<p className="text-[11.5px] text-white/55">{t("hub.demo.schedules.cadence")}</p>
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center gap-1.5 font-mono text-[11px]">
|
||||
<span className="rounded border border-white/10 bg-[#0D1211] px-2 py-0.5 text-accent-text">
|
||||
0 7 * * 1-5
|
||||
</span>
|
||||
<span className="rounded border border-white/10 bg-[#0D1211] px-2 py-0.5 text-white/70">
|
||||
devbox · Claude Code
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function ScheduleStepsList() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<MockupStep delay={STEP_DELAYS.triggered} className="flex items-start gap-2.5">
|
||||
<span className="mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-brand-green/45 bg-brand-green/15 text-accent-text">
|
||||
<Check className="h-3.5 w-3.5" aria-hidden="true" />
|
||||
</span>
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="flex items-center justify-between gap-2 text-[12px]">
|
||||
<span className="font-medium text-white/90">{t("hub.demo.schedules.step1Title")}</span>
|
||||
<span className="font-mono text-[11px] text-white/40">7:00 AM</span>
|
||||
</div>
|
||||
<p className="mt-0.5 text-[12px] leading-relaxed text-white/65">
|
||||
<Trans i18nKey="hub.demo.schedules.step1Detail" components={SCHEDULE_COMPONENTS} />
|
||||
</p>
|
||||
</div>
|
||||
</MockupStep>
|
||||
|
||||
<MockupStep delay={STEP_DELAYS.prOpened} className="flex items-start gap-2.5">
|
||||
<span className="mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-brand-green/45 bg-brand-green/15 text-accent-text">
|
||||
<GitPullRequest className="h-3.5 w-3.5" aria-hidden="true" />
|
||||
</span>
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="flex items-center justify-between gap-2 text-[12px]">
|
||||
<span className="font-medium text-white/90">{t("hub.demo.schedules.step2Title")}</span>
|
||||
<span className="font-mono text-[11px] text-white/40">7:04 AM</span>
|
||||
</div>
|
||||
<SchedulePrPill />
|
||||
</div>
|
||||
</MockupStep>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function SchedulePrPill() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="mt-1.5 flex flex-wrap items-center justify-between gap-2 rounded-lg border border-white/[0.08] bg-[#171E1D] px-3 py-2">
|
||||
<div className="flex min-w-0 items-center gap-1.5 text-[12px]">
|
||||
<span className="font-medium text-white/90">
|
||||
perf(ci): cache cargo target & stabilize e2e wait
|
||||
</span>
|
||||
<span className="font-mono text-[11px] text-white/45">#2831</span>
|
||||
</div>
|
||||
<div className="flex min-w-0 flex-wrap items-center gap-1.5 font-mono text-[10.5px]">
|
||||
<span className="inline-flex items-center gap-1 rounded bg-[#2BAC76]/15 px-1.5 py-0.5 text-[#6CB17B]">
|
||||
<TrendingDown className="h-3 w-3" aria-hidden="true" />
|
||||
CI -38%
|
||||
</span>
|
||||
<span className="inline-flex items-center gap-1 rounded border border-white/10 bg-white/[0.04] px-1.5 py-0.5 text-white/70">
|
||||
<Check className="h-3 w-3 text-[#6CB17B]" aria-hidden="true" />
|
||||
{t("hub.demo.shared.testsPassed")}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function ScheduleImpactMetrics() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<MockupStep
|
||||
delay={1.05}
|
||||
className="grid grid-cols-3 divide-x divide-white/[0.07] overflow-hidden rounded-lg border border-white/[0.07] bg-white/[0.02]"
|
||||
>
|
||||
<div className="px-3 py-2">
|
||||
<p className="text-[10.5px] text-white/45">{t("hub.demo.schedules.metricRuntime")}</p>
|
||||
<p className="mt-0.5 font-mono text-[12px] font-medium text-accent-text">7m 12s → 4m 28s</p>
|
||||
</div>
|
||||
<div className="px-3 py-2">
|
||||
<p className="text-[10.5px] text-white/45">{t("hub.demo.schedules.metricFlake")}</p>
|
||||
<p className="mt-0.5 font-mono text-[12px] font-medium text-accent-text">18% → 0%</p>
|
||||
</div>
|
||||
<div className="px-3 py-2">
|
||||
<p className="text-[10.5px] text-white/45">{t("hub.demo.schedules.metricCache")}</p>
|
||||
<p className="mt-0.5 font-mono text-[12px] font-medium text-white/85">94% hit</p>
|
||||
</div>
|
||||
</MockupStep>
|
||||
);
|
||||
}
|
||||
|
||||
function ScheduleSlackDigestCard() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<MockupStep
|
||||
delay={STEP_DELAYS.slackDigest}
|
||||
className="overflow-hidden rounded-lg border border-[#35373B] bg-[#1A1D21]"
|
||||
>
|
||||
<div className="flex items-center justify-between border-b border-[#2C2D30] bg-[#14161A] px-3 py-1.5 text-[11px] text-[#ABABAD]">
|
||||
<span className="inline-flex items-center gap-1.5 font-medium text-[#E5E7EB]">
|
||||
<SlackColorMark className="h-3 w-3" />
|
||||
<Hash className="h-3 w-3 text-[#ABABAD]" aria-hidden="true" />
|
||||
engineering
|
||||
</span>
|
||||
<span>{t("hub.demo.schedules.slackPosted")}</span>
|
||||
</div>
|
||||
|
||||
<div className="flex items-start gap-2.5 px-3.5 py-3">
|
||||
<PaseoBotAvatar size="sm" className="mt-0.5 h-8 w-8" />
|
||||
<div className="min-w-0 flex-1 space-y-1.5">
|
||||
<div className="flex items-center gap-1.5">
|
||||
<span className="text-[13px] font-bold text-[#F8F8F8]">paseo-bot</span>
|
||||
<span className="rounded-[3px] bg-[#2C2D30] px-1.5 py-[1px] text-[9.5px] font-semibold uppercase tracking-wide text-[#ABABAD]">
|
||||
{t("hub.demo.shared.appBadge")}
|
||||
</span>
|
||||
<span className="text-[11px] text-[#ABABAD]">7:05 AM</span>
|
||||
</div>
|
||||
<p className="text-[12.5px] leading-[1.45] text-[#D1D2D3]">
|
||||
<Trans i18nKey="hub.demo.schedules.slackSummary" components={SCHEDULE_COMPONENTS} />
|
||||
</p>
|
||||
<div className="flex flex-wrap items-center gap-2 pt-0.5">
|
||||
<OpenInPaseoChip variant="slack" />
|
||||
<span className="text-[11px] text-[#ABABAD]">{t("hub.demo.schedules.notifiedMo")}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</MockupStep>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
import { motion, type Variants } from "framer-motion";
|
||||
import type * as React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { PaseoMark } from "~/components/paseo-brand";
|
||||
|
||||
export interface SourceMockupProps {
|
||||
/** Whether the section is visible or reduced motion is requested. */
|
||||
active: boolean;
|
||||
reduceMotion: boolean;
|
||||
}
|
||||
|
||||
export const STEP_VARIANTS: Variants = {
|
||||
hidden: { opacity: 0, y: 6 },
|
||||
shown: (delay: number) => ({
|
||||
opacity: 1,
|
||||
y: 0,
|
||||
transition: { delay, duration: 0.32, ease: "easeOut" },
|
||||
}),
|
||||
};
|
||||
|
||||
type AvatarSize = "xs" | "sm" | "md";
|
||||
|
||||
const AVATAR_DIM: Record<AvatarSize, string> = {
|
||||
xs: "h-4 w-4",
|
||||
sm: "h-6 w-6",
|
||||
md: "h-8 w-8 sm:h-9 sm:w-9",
|
||||
};
|
||||
|
||||
const AVATAR_PX: Record<AvatarSize, number> = {
|
||||
xs: 16,
|
||||
sm: 24,
|
||||
md: 36,
|
||||
};
|
||||
|
||||
const BOT_ICON_DIM: Record<AvatarSize, string> = {
|
||||
xs: "h-2.5 w-2.5",
|
||||
sm: "h-3.5 w-3.5",
|
||||
md: "h-4 w-4 sm:h-5 sm:w-5",
|
||||
};
|
||||
|
||||
type OpenChipVariant = "brand" | "slack" | "discord" | "subtle";
|
||||
|
||||
const OPEN_CHIP_STYLES: Record<OpenChipVariant, string> = {
|
||||
brand: "bg-[#20744A] text-white",
|
||||
slack: "bg-[#007A5A] text-white",
|
||||
discord: "bg-[#248046] text-white",
|
||||
subtle: "border border-brand-green/50 bg-brand-green/20 text-[#9FE0B0]",
|
||||
};
|
||||
|
||||
export function MockupStep({
|
||||
delay,
|
||||
className,
|
||||
children,
|
||||
}: {
|
||||
delay: number;
|
||||
className?: string;
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<motion.div variants={STEP_VARIANTS} custom={delay} className={className}>
|
||||
{children}
|
||||
</motion.div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Animated root container for a single source mockup. Keeps outer dimensions locked to the stage
|
||||
* so switching tabs or stepping through animations never shifts page layout.
|
||||
*/
|
||||
export function MockupStageWindow({
|
||||
ariaLabel,
|
||||
active,
|
||||
reduceMotion,
|
||||
className = "",
|
||||
children,
|
||||
}: {
|
||||
ariaLabel: string;
|
||||
active: boolean;
|
||||
reduceMotion: boolean;
|
||||
className?: string;
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<motion.div
|
||||
role="img"
|
||||
aria-label={ariaLabel}
|
||||
initial={reduceMotion ? "shown" : "hidden"}
|
||||
animate={reduceMotion || active ? "shown" : "hidden"}
|
||||
className={`flex h-full flex-col overflow-hidden rounded-xl border wrap-anywhere shadow-[0_24px_64px_-24px_rgba(0,0,0,0.75)] ${className}`}
|
||||
>
|
||||
{children}
|
||||
</motion.div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Mo's photo avatar used consistently across all source mockups. */
|
||||
export function MoAvatar({
|
||||
size = "md",
|
||||
rounded = "rounded-[6px]",
|
||||
className = "",
|
||||
}: {
|
||||
size?: AvatarSize;
|
||||
rounded?: string;
|
||||
className?: string;
|
||||
}) {
|
||||
const px = AVATAR_PX[size];
|
||||
return (
|
||||
<img
|
||||
src="/9viSwGkz_400x400.jpg"
|
||||
alt=""
|
||||
width={px}
|
||||
height={px}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className={`shrink-0 object-cover ${AVATAR_DIM[size]} ${rounded} ${className}`}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Paseo bot avatar using the canonical Paseo butterfly mark (`PaseoMark`).
|
||||
* Used consistently for `paseo-bot` across Slack, GitHub, Linear, Discord, Schedules, and Webhooks.
|
||||
*/
|
||||
export function PaseoBotAvatar({
|
||||
size = "md",
|
||||
rounded = "rounded-[6px]",
|
||||
className = "",
|
||||
}: {
|
||||
size?: AvatarSize;
|
||||
rounded?: string;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className={`inline-flex shrink-0 items-center justify-center border border-white/14 bg-[#101615] ${AVATAR_DIM[size]} ${rounded} ${className}`}
|
||||
>
|
||||
<PaseoMark className={`${BOT_ICON_DIM[size]} text-white`} />
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
/** Consistent "Open in Paseo" action chip rendered inside source mockups. */
|
||||
export function OpenInPaseoChip({ variant = "brand" }: { variant?: OpenChipVariant }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<span
|
||||
className={`inline-flex items-center gap-1.5 rounded-[5px] px-2.5 py-1 text-[11.5px] font-medium ${OPEN_CHIP_STYLES[variant]}`}
|
||||
>
|
||||
<PaseoMark className="h-3.5 w-3.5 shrink-0 text-current" />
|
||||
<span>{t("hub.demo.shared.openInPaseo")}</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
/** macOS-style window traffic lights for desktop-style mockup headers. */
|
||||
export function WindowTrafficLights() {
|
||||
return (
|
||||
<div className="flex items-center gap-1.5" aria-hidden="true">
|
||||
<span className="h-2.5 w-2.5 rounded-full bg-[#FF5F57]/85" />
|
||||
<span className="h-2.5 w-2.5 rounded-full bg-[#FEBC2E]/85" />
|
||||
<span className="h-2.5 w-2.5 rounded-full bg-[#28C840]/85" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,380 @@
|
||||
import { motion, type Variants } from "framer-motion";
|
||||
import {
|
||||
AtSign,
|
||||
Check,
|
||||
ChevronDown,
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
Code,
|
||||
GitPullRequest,
|
||||
Hash,
|
||||
Plus,
|
||||
Search,
|
||||
SendHorizontal,
|
||||
SquarePen,
|
||||
} from "lucide-react";
|
||||
import type { ReactNode } from "react";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { PaseoMark } from "~/components/paseo-brand";
|
||||
import {
|
||||
MoAvatar,
|
||||
MockupStageWindow,
|
||||
MockupStep,
|
||||
OpenInPaseoChip,
|
||||
PaseoBotAvatar,
|
||||
type SourceMockupProps,
|
||||
WindowTrafficLights,
|
||||
} from "./shared";
|
||||
|
||||
const DEMO_ISSUES = [
|
||||
{ id: "#2811", title: "Terminal output drops under load" },
|
||||
{ id: "#2804", title: "Relay reconnect loop on Android after sleep" },
|
||||
{ id: "#2799", title: "Worktree cleanup leaves stale branches" },
|
||||
] as const;
|
||||
|
||||
const SIDEBAR_CHANNELS = ["general", "engineering", "incidents", "releases"] as const;
|
||||
|
||||
const STEP_DELAYS = {
|
||||
firstPrompt: 0.06,
|
||||
firstReply: 0.65,
|
||||
followUp: 1.35,
|
||||
finalReply: 2.05,
|
||||
} as const;
|
||||
|
||||
const TYPING_VARIANTS: Variants = {
|
||||
hidden: { opacity: 0 },
|
||||
shown: {
|
||||
opacity: [0, 1, 1, 0, 0, 1, 1, 0],
|
||||
transition: {
|
||||
duration: 2.4,
|
||||
times: [0, 0.08, 0.24, 0.28, 0.56, 0.62, 0.84, 0.9],
|
||||
ease: "linear",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const SLACK_COMPONENTS = {
|
||||
mention: <SlackMention />,
|
||||
host: (
|
||||
<span className="rounded-[3px] border border-white/10 bg-[#222529] px-1.5 py-[1px] font-mono text-[11.5px] text-[#E8912D]" />
|
||||
),
|
||||
pr: <span className="font-medium text-[#1D9BD1] underline decoration-[#1D9BD1]/40" />,
|
||||
};
|
||||
|
||||
export function SlackSourceMockup({ active, reduceMotion }: SourceMockupProps) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<MockupStageWindow
|
||||
ariaLabel={t("hub.demo.slack.alt")}
|
||||
active={active}
|
||||
reduceMotion={reduceMotion}
|
||||
className="border-[#35373B] bg-[#1A1D21]"
|
||||
>
|
||||
<SlackWindowChrome />
|
||||
<div className="grid min-h-0 flex-1 grid-cols-1 md:grid-cols-[164px_minmax(0,1fr)]">
|
||||
<SlackSidebar />
|
||||
<div className="flex min-h-0 min-w-0 flex-col bg-[#1A1D21]">
|
||||
<SlackChannelHeader />
|
||||
<SlackMessageFeed />
|
||||
<SlackComposer />
|
||||
<SlackTypingStatus reduced={reduceMotion} />
|
||||
</div>
|
||||
</div>
|
||||
</MockupStageWindow>
|
||||
);
|
||||
}
|
||||
|
||||
function SlackWindowChrome() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="flex h-9 shrink-0 items-center justify-between border-b border-[#2C2D30] bg-[#121016] px-3.5">
|
||||
<div className="flex items-center gap-3">
|
||||
<WindowTrafficLights />
|
||||
<div className="hidden items-center gap-1 text-[#ABABAD]/60 sm:flex" aria-hidden="true">
|
||||
<ChevronLeft className="h-3.5 w-3.5" />
|
||||
<ChevronRight className="h-3.5 w-3.5" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex h-6 w-44 items-center gap-1.5 rounded-[5px] bg-white/[0.08] px-2.5 text-[11px] text-[#ABABAD] sm:w-56">
|
||||
<Search className="h-3 w-3 shrink-0 text-[#ABABAD]/75" aria-hidden="true" />
|
||||
<span className="truncate">{t("hub.demo.slack.searchPlaceholder")}</span>
|
||||
</div>
|
||||
|
||||
<SlackColorMark className="h-3.5 w-3.5 shrink-0" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function SlackSidebar() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<aside
|
||||
aria-hidden="true"
|
||||
className="hidden flex-col border-r border-[#2C2D30] bg-[#19171D] md:flex"
|
||||
>
|
||||
<div className="flex items-center justify-between border-b border-white/[0.07] px-3 py-2.5">
|
||||
<div className="flex items-center gap-1 text-[13.5px] font-bold text-[#F8F8F8]">
|
||||
<span>Paseo</span>
|
||||
<ChevronDown className="h-3.5 w-3.5 text-[#ABABAD]" />
|
||||
</div>
|
||||
<SquarePen className="h-3.5 w-3.5 text-[#ABABAD]" />
|
||||
</div>
|
||||
|
||||
<div className="space-y-4 px-2 py-3 text-[12.5px]">
|
||||
<div className="space-y-0.5">
|
||||
<p className="px-2 pb-1 text-[11px] font-medium text-[#ABABAD]/75">
|
||||
{t("hub.demo.slack.channels")}
|
||||
</p>
|
||||
{SIDEBAR_CHANNELS.map((channel) => (
|
||||
<div
|
||||
key={channel}
|
||||
className={`flex items-center gap-1.5 rounded-[6px] px-2 py-1 ${
|
||||
channel === "engineering" ? "bg-[#1164A3] font-medium text-white" : "text-[#ABABAD]"
|
||||
}`}
|
||||
>
|
||||
<Hash className="h-3.5 w-3.5 shrink-0 opacity-80" />
|
||||
<span className="truncate">{channel}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="space-y-0.5">
|
||||
<p className="px-2 pb-1 text-[11px] font-medium text-[#ABABAD]/75">
|
||||
{t("hub.demo.slack.apps")}
|
||||
</p>
|
||||
<div className="flex items-center gap-2 rounded-[6px] px-2 py-1 text-[#D1D2D3]">
|
||||
<span className="relative flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] bg-[#101615] ring-1 ring-white/15">
|
||||
<PaseoMark className="h-2.5 w-2.5 text-white" />
|
||||
<span className="absolute -right-0.5 -bottom-0.5 h-1.5 w-1.5 rounded-full bg-[#2BAC76] ring-1 ring-[#19171D]" />
|
||||
</span>
|
||||
<span className="truncate">paseo-bot</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
|
||||
function SlackChannelHeader() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="flex shrink-0 items-center justify-between gap-3 border-b border-[#2C2D30] px-4 py-2">
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
<div className="flex items-center gap-1 text-[14px] font-bold text-[#F8F8F8]">
|
||||
<Hash className="h-3.5 w-3.5 shrink-0 text-[#D1D2D3]" aria-hidden="true" />
|
||||
<span>engineering</span>
|
||||
</div>
|
||||
<span className="hidden truncate text-[11.5px] text-[#ABABAD] sm:inline">
|
||||
{t("hub.demo.slack.channelTopic")}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div
|
||||
aria-hidden="true"
|
||||
className="flex shrink-0 items-center gap-1.5 rounded-[5px] border border-[#35373B] px-2 py-0.5 text-[11px] text-[#ABABAD]"
|
||||
>
|
||||
<div className="flex -space-x-1">
|
||||
<MoAvatar size="xs" rounded="rounded-[3px]" className="ring-1 ring-[#1A1D21]" />
|
||||
<span className="flex h-4 w-4 items-center justify-center rounded-[3px] bg-[#101615] ring-1 ring-[#1A1D21]">
|
||||
<PaseoMark className="h-2.5 w-2.5 text-white" />
|
||||
</span>
|
||||
</div>
|
||||
<span className="tabular-nums">4</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function SlackMessageFeed() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="flex-1 space-y-2.5 px-4 py-2.5">
|
||||
<MockupStep delay={STEP_DELAYS.firstPrompt}>
|
||||
<SlackMessage author="mo" time="9:41 AM">
|
||||
<p>
|
||||
<Trans i18nKey="hub.demo.slack.showIssues" components={SLACK_COMPONENTS} />
|
||||
</p>
|
||||
</SlackMessage>
|
||||
</MockupStep>
|
||||
|
||||
<div className="ml-2.5 sm:ml-3.5">
|
||||
<MockupStep
|
||||
delay={STEP_DELAYS.firstReply}
|
||||
className="space-y-1.5 border-l-2 border-[#2C2D30] pb-2.5 pl-3 sm:pl-3.5"
|
||||
>
|
||||
<div className="flex items-center gap-2 text-[11px]">
|
||||
<span className="font-medium text-[#1D9BD1]">{t("hub.demo.slack.threadReplies")}</span>
|
||||
<span className="h-px flex-1 bg-[#2C2D30]" aria-hidden="true" />
|
||||
</div>
|
||||
|
||||
<SlackMessage author="paseo-bot" time="9:41 AM" bot>
|
||||
<p>{t("hub.demo.slack.issuesOpen")}</p>
|
||||
<ul className="mt-1 space-y-0.5 border-l-[3px] border-[#36C5F0] pl-2.5 text-[12px]">
|
||||
{DEMO_ISSUES.map((issue) => (
|
||||
<li key={issue.id} className="flex flex-wrap items-baseline gap-x-1.5">
|
||||
<span className="font-mono text-[11.5px] font-medium text-[#1D9BD1]">
|
||||
{issue.id}
|
||||
</span>
|
||||
<span className="text-[#D1D2D3]">{issue.title}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</SlackMessage>
|
||||
</MockupStep>
|
||||
|
||||
<MockupStep
|
||||
delay={STEP_DELAYS.followUp}
|
||||
className="border-l-2 border-[#2C2D30] pb-2.5 pl-3 sm:pl-3.5"
|
||||
>
|
||||
<SlackMessage author="mo" time="9:43 AM">
|
||||
<p>
|
||||
<Trans i18nKey="hub.demo.slack.createPr" components={SLACK_COMPONENTS} />
|
||||
</p>
|
||||
</SlackMessage>
|
||||
</MockupStep>
|
||||
|
||||
<MockupStep
|
||||
delay={STEP_DELAYS.finalReply}
|
||||
className="border-l-2 border-[#2C2D30] pl-3 sm:pl-3.5"
|
||||
>
|
||||
<SlackMessage author="paseo-bot" time="9:48 AM" bot>
|
||||
<p>
|
||||
<Trans i18nKey="hub.demo.slack.ranOn" components={SLACK_COMPONENTS} />
|
||||
</p>
|
||||
<SlackPrAttachment />
|
||||
</SlackMessage>
|
||||
</MockupStep>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function SlackPrAttachment() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="mt-1.5 space-y-1.5 border-l-[3px] border-[#2BAC76] pl-2.5">
|
||||
<div className="flex flex-wrap items-center gap-1.5">
|
||||
<span className="inline-flex items-center gap-1 rounded-[4px] bg-[#2BAC76]/15 px-2 py-0.5 font-mono text-[11px] text-[#4CD99B]">
|
||||
<GitPullRequest className="h-3 w-3" aria-hidden="true" />
|
||||
{t("hub.demo.slack.filesChanged")}
|
||||
</span>
|
||||
<span className="inline-flex items-center gap-1 rounded-[4px] border border-[#35373B] bg-[#222529] px-2 py-0.5 font-mono text-[11px] text-[#ABABAD]">
|
||||
<Check className="h-3 w-3 text-[#2BAC76]" aria-hidden="true" />
|
||||
{t("hub.demo.shared.testsPassed")}
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<OpenInPaseoChip variant="slack" />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function SlackMessage({
|
||||
author,
|
||||
time,
|
||||
bot,
|
||||
children,
|
||||
}: {
|
||||
author: string;
|
||||
time: string;
|
||||
bot?: boolean;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="flex items-start gap-2.5">
|
||||
{bot ? (
|
||||
<PaseoBotAvatar size="sm" className="mt-0.5 h-8 w-8" />
|
||||
) : (
|
||||
<MoAvatar size="sm" className="mt-0.5 h-8 w-8" />
|
||||
)}
|
||||
<div className="min-w-0 flex-1 space-y-0.5">
|
||||
<div className="flex flex-wrap items-center gap-1.5">
|
||||
<span className="text-[13px] font-bold text-[#F8F8F8]">{author}</span>
|
||||
{bot ? (
|
||||
<span className="rounded-[3px] bg-[#2C2D30] px-1.5 py-[1px] text-[9.5px] font-semibold uppercase tracking-wide text-[#ABABAD]">
|
||||
{t("hub.demo.shared.appBadge")}
|
||||
</span>
|
||||
) : null}
|
||||
<span className="text-[10.5px] text-[#ABABAD]">{time}</span>
|
||||
</div>
|
||||
<div className="text-[12.5px] leading-[1.42] text-[#D1D2D3]">{children}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function SlackMention() {
|
||||
return (
|
||||
<span className="rounded-[3px] bg-[#1D9BD1]/20 px-1 py-[1px] font-medium text-[#1D9BD1]">
|
||||
@paseo-bot
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
function SlackComposer() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div
|
||||
aria-hidden="true"
|
||||
className="mx-4 mt-auto rounded-[8px] border border-[#35373B] bg-[#222529]"
|
||||
>
|
||||
<div className="px-3 py-1.5 text-[12.5px] text-[#ABABAD]/70">
|
||||
{t("hub.demo.slack.composerPlaceholder")}
|
||||
</div>
|
||||
<div className="flex items-center justify-between border-t border-white/[0.06] px-2.5 py-1">
|
||||
<div className="flex items-center gap-2.5 text-[#ABABAD]/60">
|
||||
<Plus className="h-3.5 w-3.5" />
|
||||
<AtSign className="h-3.5 w-3.5" />
|
||||
<Code className="h-3.5 w-3.5" />
|
||||
</div>
|
||||
<span className="inline-flex h-5 w-6 items-center justify-center rounded-[4px] bg-[#007A5A]/80 text-white">
|
||||
<SendHorizontal className="h-3 w-3" />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function SlackTypingStatus({ reduced }: { reduced: boolean }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div aria-hidden="true" className="flex h-6 shrink-0 items-center px-4 pb-1">
|
||||
{reduced ? null : (
|
||||
<motion.span
|
||||
variants={TYPING_VARIANTS}
|
||||
className="inline-flex items-center gap-1.5 text-[11px] text-[#ABABAD]"
|
||||
>
|
||||
<span className="h-1.5 w-1.5 animate-pulse rounded-full bg-[#2BAC76]" />
|
||||
{t("hub.demo.slack.typing")}
|
||||
</motion.span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function SlackColorMark(props: React.SVGProps<SVGSVGElement>) {
|
||||
return (
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" {...props}>
|
||||
<path
|
||||
fill="#E01E5A"
|
||||
d="M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313z"
|
||||
/>
|
||||
<path
|
||||
fill="#36C5F0"
|
||||
d="M8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312z"
|
||||
/>
|
||||
<path
|
||||
fill="#2EB67D"
|
||||
d="M18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312z"
|
||||
/>
|
||||
<path
|
||||
fill="#ECB22E"
|
||||
d="M15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
import { ArrowDown, Check, Terminal, Webhook } from "lucide-react";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import {
|
||||
MockupStageWindow,
|
||||
MockupStep,
|
||||
OpenInPaseoChip,
|
||||
PaseoBotAvatar,
|
||||
type SourceMockupProps,
|
||||
WindowTrafficLights,
|
||||
} from "./shared";
|
||||
|
||||
const STEP_DELAYS = {
|
||||
curl: 0.06,
|
||||
response: 0.65,
|
||||
runCard: 1.25,
|
||||
} as const;
|
||||
|
||||
const WEBHOOK_ID = "wh_4PCfLx4q46HniZpIeiThI4BmNC4zHGFY";
|
||||
const RUN_ID = "0197e5d2-a70c-4ad0-b7aa-a29154a6bc72";
|
||||
const ACCEPTED_RESPONSE = JSON.stringify({ status: "accepted", runId: RUN_ID });
|
||||
|
||||
const WEBHOOK_COMPONENTS = {
|
||||
code: <code className="font-mono text-[11px] text-white/90" />,
|
||||
pr: <span className="font-mono text-[#6CB17B]">#2834</span>,
|
||||
};
|
||||
|
||||
export function WebhooksSourceMockup({ active, reduceMotion }: SourceMockupProps) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<MockupStageWindow
|
||||
ariaLabel={t("hub.demo.webhooks.alt")}
|
||||
active={active}
|
||||
reduceMotion={reduceMotion}
|
||||
className="border-white/[0.1] bg-[#0C1110]"
|
||||
>
|
||||
<WebhookTerminalChrome />
|
||||
|
||||
<div className="flex flex-1 flex-col justify-between gap-2.5 p-4">
|
||||
<div className="space-y-3">
|
||||
<WebhookCurlBlock />
|
||||
<WebhookResponseBlock />
|
||||
</div>
|
||||
<WebhookRouteConnector />
|
||||
<WebhookRunCard />
|
||||
</div>
|
||||
</MockupStageWindow>
|
||||
);
|
||||
}
|
||||
|
||||
function WebhookTerminalChrome() {
|
||||
return (
|
||||
<div className="flex h-9 shrink-0 items-center justify-between gap-2 border-b border-white/[0.08] bg-[#131918] px-3.5">
|
||||
<div className="flex min-w-0 items-center gap-3">
|
||||
<WindowTrafficLights />
|
||||
<span className="inline-flex min-w-0 items-center gap-1.5 truncate font-mono text-[11.5px] text-white/65">
|
||||
<Terminal className="h-3.5 w-3.5 shrink-0 text-white/45" aria-hidden="true" />
|
||||
<span className="truncate">mo@devbox — zsh</span>
|
||||
</span>
|
||||
</div>
|
||||
<span className="hidden shrink-0 items-center gap-1.5 rounded border border-white/10 bg-white/[0.04] px-2 py-0.5 font-mono text-[10.5px] text-accent-text sm:inline-flex">
|
||||
<Webhook className="h-3 w-3" aria-hidden="true" />
|
||||
POST /webhooks/{WEBHOOK_ID}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function WebhookRouteConnector() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<MockupStep delay={0.95} className="flex items-center gap-2.5 px-1 text-[11px] text-white/45">
|
||||
<span className="h-px flex-1 bg-white/[0.07]" aria-hidden="true" />
|
||||
<span className="inline-flex items-center gap-1.5 font-mono text-accent-text/90">
|
||||
<ArrowDown className="h-3 w-3" aria-hidden="true" />
|
||||
{t("hub.demo.webhooks.routedLine")}
|
||||
</span>
|
||||
<span className="h-px flex-1 bg-white/[0.07]" aria-hidden="true" />
|
||||
</MockupStep>
|
||||
);
|
||||
}
|
||||
|
||||
function WebhookCurlBlock() {
|
||||
return (
|
||||
<MockupStep delay={STEP_DELAYS.curl}>
|
||||
<pre className="font-mono text-[11.5px] leading-[1.6] wrap-anywhere whitespace-pre-wrap text-white/80">
|
||||
<code>
|
||||
<span className="select-none text-accent-text">$ </span>
|
||||
<span className="text-white">curl</span> <span className="text-sky-300/90">-X POST</span>{" "}
|
||||
<span className="text-emerald-300/90">
|
||||
https://hub.paseo.sh/webhooks/
|
||||
<wbr />
|
||||
{WEBHOOK_ID}
|
||||
</span>{" "}
|
||||
<span className="text-white/35">\</span>
|
||||
{"\n"}
|
||||
{" "}
|
||||
<span className="text-sky-300/90">-H</span>{" "}
|
||||
<span className="text-amber-200/85">
|
||||
"Authorization: Bearer $WEBHOOK_TOKEN"
|
||||
</span>{" "}
|
||||
<span className="text-white/35">\</span>
|
||||
{"\n"}
|
||||
{" "}
|
||||
<span className="text-sky-300/90">-H</span>{" "}
|
||||
<span className="text-amber-200/85">"Content-Type: application/json"</span>{" "}
|
||||
<span className="text-white/35">\</span>
|
||||
{"\n"}
|
||||
{" "}
|
||||
<span className="text-sky-300/90">-d</span>{" "}
|
||||
<span className="text-white/75">
|
||||
'{"error":"ECONNRESET"}'
|
||||
</span>
|
||||
</code>
|
||||
</pre>
|
||||
</MockupStep>
|
||||
);
|
||||
}
|
||||
|
||||
function WebhookResponseBlock() {
|
||||
return (
|
||||
<MockupStep
|
||||
delay={STEP_DELAYS.response}
|
||||
className="rounded-lg border border-brand-green/35 bg-brand-green/[0.08] px-3 py-2 font-mono text-[11.5px] leading-[1.55]"
|
||||
>
|
||||
<div className="flex items-center gap-2 text-[#6CB17B]">
|
||||
<span className="font-semibold">HTTP/2 202 Accepted</span>
|
||||
<span className="text-white/35">·</span>
|
||||
<span className="text-white/55">42ms</span>
|
||||
</div>
|
||||
<div className="mt-0.5 wrap-anywhere text-white/80">{ACCEPTED_RESPONSE}</div>
|
||||
</MockupStep>
|
||||
);
|
||||
}
|
||||
|
||||
function WebhookRunCard() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<MockupStep
|
||||
delay={STEP_DELAYS.runCard}
|
||||
className="rounded-lg border border-white/[0.09] bg-[#141B19] p-3.5"
|
||||
>
|
||||
<div className="flex flex-wrap items-center justify-between gap-2 border-b border-white/[0.07] pb-2.5">
|
||||
<div className="flex items-center gap-2">
|
||||
<PaseoBotAvatar size="sm" />
|
||||
<div>
|
||||
<div className="flex items-center gap-1.5 text-[12.5px]">
|
||||
<span className="font-semibold text-white/95">paseo-bot</span>
|
||||
<span className="font-mono text-[11px] text-white/45">{RUN_ID.slice(0, 8)}…</span>
|
||||
</div>
|
||||
<p className="text-[11px] text-white/55">{t("hub.demo.webhooks.runMeta")}</p>
|
||||
</div>
|
||||
</div>
|
||||
<span className="inline-flex items-center gap-1.5 rounded-full border border-brand-green/50 bg-brand-green/20 px-2 py-0.5 text-[10.5px] font-medium text-accent-text">
|
||||
<span className="h-1.5 w-1.5 rounded-full bg-[#35C264]" />
|
||||
{t("hub.demo.webhooks.statusDone")}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<ul className="mt-2.5 space-y-1.5 text-[12px] text-white/75">
|
||||
<li className="flex items-start gap-2">
|
||||
<Check className="mt-0.5 h-3.5 w-3.5 shrink-0 text-accent-text" aria-hidden="true" />
|
||||
<span>
|
||||
<Trans i18nKey="hub.demo.webhooks.trace1" components={WEBHOOK_COMPONENTS} />
|
||||
</span>
|
||||
</li>
|
||||
<li className="flex items-start gap-2">
|
||||
<Check className="mt-0.5 h-3.5 w-3.5 shrink-0 text-accent-text" aria-hidden="true" />
|
||||
<span>
|
||||
<Trans i18nKey="hub.demo.webhooks.trace2" components={WEBHOOK_COMPONENTS} />
|
||||
</span>
|
||||
</li>
|
||||
<li className="flex items-start gap-2">
|
||||
<Check className="mt-0.5 h-3.5 w-3.5 shrink-0 text-accent-text" aria-hidden="true" />
|
||||
<span>
|
||||
<Trans i18nKey="hub.demo.webhooks.trace3" components={WEBHOOK_COMPONENTS} />
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div className="mt-3 flex flex-wrap items-center justify-between gap-2 border-t border-white/[0.07] pt-2.5">
|
||||
<OpenInPaseoChip variant="brand" />
|
||||
<span className="font-mono text-[11px] text-white/45">
|
||||
{t("hub.demo.webhooks.triggeredBy")}
|
||||
</span>
|
||||
</div>
|
||||
</MockupStep>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
import { ArrowDown, ArrowRight, Clock, Webhook } from "lucide-react";
|
||||
import type * as React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { ClaudeCodeIcon, CodexIcon, OpenCodeIcon } from "~/components/agent-icons";
|
||||
import { DiscordIcon, GitHubIcon, LinearIcon, SlackIcon } from "~/components/brand-icons";
|
||||
import { HubLockup, PaseoMark } from "~/components/paseo-brand";
|
||||
|
||||
export type HubTriggerSourceId =
|
||||
| "github"
|
||||
| "linear"
|
||||
| "slack"
|
||||
| "discord"
|
||||
| "schedules"
|
||||
| "webhooks";
|
||||
|
||||
export interface HubTriggerSource {
|
||||
id: HubTriggerSourceId;
|
||||
Icon: React.ComponentType<{ className?: string }>;
|
||||
}
|
||||
|
||||
/** The six automation sources Hub accepts, shared by the homepage and /hub. */
|
||||
export const HUB_TRIGGER_SOURCES: readonly HubTriggerSource[] = [
|
||||
{ id: "github", Icon: GitHubIcon },
|
||||
{ id: "linear", Icon: LinearIcon },
|
||||
{ id: "slack", Icon: SlackIcon },
|
||||
{ id: "discord", Icon: DiscordIcon },
|
||||
{ id: "schedules", Icon: Clock },
|
||||
{ id: "webhooks", Icon: Webhook },
|
||||
] as const;
|
||||
|
||||
/** Examples of agent harnesses on connected daemons. */
|
||||
export const HUB_AGENT_HARNESSES = [
|
||||
{ name: "Claude Code", Icon: ClaudeCodeIcon },
|
||||
{ name: "Codex", Icon: CodexIcon },
|
||||
{ name: "OpenCode", Icon: OpenCodeIcon },
|
||||
] as const;
|
||||
|
||||
const DIAGRAM_DAEMONS = [
|
||||
{ name: "MacBook Pro", agents: HUB_AGENT_HARNESSES },
|
||||
{ name: "Hetzner VM", agents: HUB_AGENT_HARNESSES },
|
||||
] as const;
|
||||
|
||||
const DIAGRAM_CLIENTS = ["desktop", "web", "mobile", "cli"] as const;
|
||||
|
||||
/** Compact flow diagram for the homepage Paseo Hub section, sitting directly on the page background. */
|
||||
export function HubLandingFlow() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="grid items-center gap-5 lg:grid-cols-[minmax(0,1fr)_auto_minmax(0,12rem)_auto_minmax(0,1fr)]">
|
||||
<div className="space-y-2.5">
|
||||
<p className="text-[11px] uppercase tracking-wide text-white/35">
|
||||
{t("landing.hubSection.flowTriggers")}
|
||||
</p>
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
{HUB_TRIGGER_SOURCES.map(({ id, Icon }) => (
|
||||
<div
|
||||
key={id}
|
||||
className="flex items-center gap-2 rounded-lg border border-white/10 bg-white/[0.03] px-3 py-2"
|
||||
>
|
||||
<Icon className="h-3.5 w-3.5 shrink-0 text-white/70" />
|
||||
<span className="truncate text-xs font-medium text-white/85">
|
||||
{t(`hub.sources.${id}.name`)}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<FlowArrow />
|
||||
|
||||
<div className="rounded-xl border border-brand-green/50 bg-brand-green/[0.12] px-5 py-5 text-center">
|
||||
<p className="flex justify-center">
|
||||
<HubLockup className="h-5 w-auto text-foreground" />
|
||||
<span className="sr-only">{t("hub.shape.hub")}</span>
|
||||
</p>
|
||||
<p className="mt-2 text-xs text-white/70">{t("hub.shape.hubHosting")}</p>
|
||||
</div>
|
||||
|
||||
<FlowArrow />
|
||||
|
||||
<div className="space-y-2.5">
|
||||
<p className="text-[11px] uppercase tracking-wide text-white/35">
|
||||
{t("landing.hubSection.flowDaemons")}
|
||||
</p>
|
||||
<div className="space-y-2">
|
||||
{DIAGRAM_DAEMONS.map((daemon) => (
|
||||
<CompactDaemonRow key={daemon.name} name={daemon.name} agents={daemon.agents} />
|
||||
))}
|
||||
<div className="flex items-center gap-2 rounded-lg border border-dashed border-white/10 bg-white/[0.015] px-3 py-2 text-xs text-white/60">
|
||||
<PaseoMark className="h-3.5 w-3.5 shrink-0 text-white/75" />
|
||||
<span className="truncate">{t("landing.hubSection.flowOpenSession")}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function CompactDaemonRow({
|
||||
name,
|
||||
agents,
|
||||
}: {
|
||||
name: string;
|
||||
agents: readonly { name: string; Icon: React.ComponentType<{ className?: string }> }[];
|
||||
}) {
|
||||
return (
|
||||
<div className="flex items-center justify-between gap-2 rounded-lg border border-white/10 bg-white/[0.03] px-3 py-2">
|
||||
<span className="flex min-w-0 items-center gap-2">
|
||||
<MachineIcon className="h-4 w-4 shrink-0 text-white/60" />
|
||||
<span className="truncate text-xs font-medium text-white/85">{name}</span>
|
||||
</span>
|
||||
<span className="flex shrink-0 items-center gap-1.5 text-white/45">
|
||||
{agents.map(({ name: agentName, Icon }) => (
|
||||
<span key={agentName} title={agentName}>
|
||||
<Icon className="h-3.5 w-3.5" />
|
||||
</span>
|
||||
))}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Full vertical infrastructure diagram for the /hub page. */
|
||||
export function HubArchitectureDiagram() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="rounded-xl border border-white/[0.08] bg-white/[0.015] p-6 md:p-8">
|
||||
<div className="flex flex-col items-center">
|
||||
<DiagramRow label={t("hub.shape.triggersRow")}>
|
||||
{HUB_TRIGGER_SOURCES.map(({ id, Icon }) => (
|
||||
<DiagramCard key={id} Icon={Icon} name={t(`hub.sources.${id}.name`)} />
|
||||
))}
|
||||
</DiagramRow>
|
||||
|
||||
<Connector label={t("hub.shape.webhooks")} />
|
||||
|
||||
<div className="w-full max-w-xs rounded-xl border border-brand-green/50 bg-brand-green/[0.12] px-6 py-5 text-center">
|
||||
<p className="flex justify-center">
|
||||
<HubLockup className="h-[22px] w-auto text-foreground" />
|
||||
<span className="sr-only">{t("hub.shape.hub")}</span>
|
||||
</p>
|
||||
<p className="mt-1.5 text-xs text-white/70">{t("hub.shape.hubHosting")}</p>
|
||||
</div>
|
||||
|
||||
<Connector label={t("hub.shape.sameRpcs")} />
|
||||
|
||||
<DiagramRow label={t("hub.shape.daemonsRow")}>
|
||||
{DIAGRAM_DAEMONS.map((daemon) => (
|
||||
<div
|
||||
key={daemon.name}
|
||||
className="flex items-center gap-3 rounded-xl border border-white/10 bg-white/[0.03] px-4 py-3"
|
||||
>
|
||||
<span className="text-white/70">
|
||||
<MachineIcon className="h-5 w-5" />
|
||||
</span>
|
||||
<span className="text-sm font-medium">{daemon.name}</span>
|
||||
<span className="flex items-center gap-2 border-l border-white/10 pl-3 text-white/45">
|
||||
{daemon.agents.map(({ name, Icon }) => (
|
||||
<span key={name} title={name}>
|
||||
<Icon className="h-4 w-4" />
|
||||
</span>
|
||||
))}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</DiagramRow>
|
||||
|
||||
<Connector label={t("hub.shape.directOrRelay")} />
|
||||
|
||||
<DiagramRow label={t("hub.shape.appsRow")}>
|
||||
{DIAGRAM_CLIENTS.map((client) => (
|
||||
<DiagramCard key={client} name={t(`hub.shape.${client}`)} />
|
||||
))}
|
||||
</DiagramRow>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function FlowArrow() {
|
||||
return (
|
||||
<div className="flex items-center justify-center text-white/30" aria-hidden="true">
|
||||
<ArrowRight className="hidden h-4 w-4 lg:block" />
|
||||
<ArrowDown className="h-4 w-4 lg:hidden" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function DiagramRow({ label, children }: { label: string; children: React.ReactNode }) {
|
||||
return (
|
||||
<div className="w-full space-y-2.5">
|
||||
<p className="text-center text-xs uppercase tracking-wide text-white/30">{label}</p>
|
||||
<div className="flex flex-wrap justify-center gap-2.5">{children}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function DiagramCard({
|
||||
name,
|
||||
Icon,
|
||||
}: {
|
||||
name: string;
|
||||
Icon?: React.ComponentType<{ className?: string }>;
|
||||
}) {
|
||||
return (
|
||||
<div className="flex items-center gap-2 rounded-xl border border-white/10 bg-white/[0.03] px-3.5 py-2.5">
|
||||
{Icon ? (
|
||||
<span className="text-white/70">
|
||||
<Icon className="h-4 w-4" />
|
||||
</span>
|
||||
) : null}
|
||||
<span className="text-sm font-medium">{name}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function Connector({ label }: { label: string }) {
|
||||
return (
|
||||
<div className="flex flex-col items-center gap-2 py-4">
|
||||
<div className="h-5 w-px border-l border-dashed border-white/25" />
|
||||
<p className="text-center text-[11px] text-white/35">{label}</p>
|
||||
<div className="h-5 w-px border-l border-dashed border-white/25" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function MachineIcon({ className }: { className?: string }) {
|
||||
return (
|
||||
<svg
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="1.5"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
aria-hidden="true"
|
||||
className={className}
|
||||
>
|
||||
<rect x="2" y="2" width="20" height="8" rx="2" />
|
||||
<rect x="2" y="14" width="20" height="8" rx="2" />
|
||||
<circle cx="6" cy="6" r="1" />
|
||||
<circle cx="6" cy="18" r="1" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -88,8 +88,15 @@ import {
|
||||
OpenCodeIcon,
|
||||
PiIcon,
|
||||
} from "~/components/agent-icons";
|
||||
import { DiscordIcon, GitHubIcon, SlackIcon } from "~/components/brand-icons";
|
||||
import { PaseoHubMark } from "~/components/paseo-brand";
|
||||
import { HubLandingFlow } from "~/components/hub-flow";
|
||||
import {
|
||||
ChapterBand,
|
||||
ChapterDivider,
|
||||
HairlineGrid,
|
||||
PageHeaderBand,
|
||||
SectionOpener,
|
||||
} from "~/components/page-frame";
|
||||
import { PaseoHubLockup, PaseoHubMark, PaseoMark } from "~/components/paseo-brand";
|
||||
import {
|
||||
MobileChat,
|
||||
MobileDiff,
|
||||
@@ -100,78 +107,146 @@ import {
|
||||
} from "~/components/mockup";
|
||||
import { FAQItem } from "~/components/faq-item";
|
||||
import { SiteFooter } from "~/components/site-footer";
|
||||
import { SponsorSection, SponsorsSection } from "~/components/sponsorship";
|
||||
import { SiteHeader } from "~/components/site-header";
|
||||
import { HomepageSponsorsSection } from "~/components/sponsorship";
|
||||
import "~/styles.css";
|
||||
|
||||
interface LandingPageProps {
|
||||
title: React.ReactNode;
|
||||
subtitle: React.ReactNode;
|
||||
pluginCount?: number | null;
|
||||
showHubEyebrow?: boolean;
|
||||
}
|
||||
|
||||
export function LandingPage({ title, subtitle }: LandingPageProps) {
|
||||
export function LandingPage({
|
||||
title,
|
||||
subtitle,
|
||||
pluginCount = null,
|
||||
showHubEyebrow = false,
|
||||
}: LandingPageProps) {
|
||||
return (
|
||||
<CursorFieldProvider>
|
||||
{/* Hero section with background image */}
|
||||
<div className="relative bg-cover bg-center bg-no-repeat">
|
||||
<div className="relative px-6 pt-4 pb-10 md:px-32 md:pt-6 md:pb-12 max-w-7xl mx-auto">
|
||||
<Nav />
|
||||
<Hero title={title} subtitle={subtitle} />
|
||||
<GetStarted />
|
||||
</div>
|
||||
<div className="min-h-screen bg-background">
|
||||
<PageHeaderBand />
|
||||
|
||||
{/* Mockup - inside hero so it's above the gradient, positioned to overflow into black section */}
|
||||
<motion.div
|
||||
initial={FADE_IN_UP_40}
|
||||
animate={FADE_IN}
|
||||
transition={EASE_OUT_08_DELAY_05}
|
||||
className="relative px-6 md:px-8 pt-4 md:pt-8 pb-8 md:pb-16"
|
||||
>
|
||||
<div className="max-w-7xl mx-auto">
|
||||
<HeroMockup />
|
||||
</div>
|
||||
</motion.div>
|
||||
</div>
|
||||
<main>
|
||||
{/* Opening bookend: centered hero, interactive desktop mockup, and phone trio */}
|
||||
<ChapterBand spacing="none" ruled={false} ticks={false} framed={false}>
|
||||
<div className="pt-12 pb-8 md:pt-16 md:pb-10">
|
||||
<Hero title={title} subtitle={subtitle} showHubEyebrow={showHubEyebrow} />
|
||||
<GetStarted />
|
||||
</div>
|
||||
|
||||
{/* Phone showcase */}
|
||||
<PhoneShowcase />
|
||||
<motion.div
|
||||
initial={FADE_IN_UP_40}
|
||||
animate={FADE_IN}
|
||||
transition={EASE_OUT_08_DELAY_05}
|
||||
className="relative pt-4 pb-10 md:pt-6 md:pb-14"
|
||||
>
|
||||
<div>
|
||||
<HeroMockup />
|
||||
</div>
|
||||
</motion.div>
|
||||
|
||||
{/* Content section */}
|
||||
<div className="landing-content bg-background">
|
||||
<main className="p-6 md:p-20 md:pt-40 max-w-5xl mx-auto">
|
||||
<div className="space-y-24">
|
||||
<PhoneShowcase />
|
||||
</ChapterBand>
|
||||
|
||||
{/* Chapter 1: Community proof */}
|
||||
<ChapterBand spacing="compact">
|
||||
<SocialProofWall />
|
||||
<MultiProviderSection />
|
||||
<TurnkeySection />
|
||||
<ExtensibleSection />
|
||||
<AutomationSection />
|
||||
<SponsorsSection placement="page" />
|
||||
<SponsorSection />
|
||||
<PhilosophySection />
|
||||
</ChapterBand>
|
||||
|
||||
{/* Chapter 2: The product (Providers, Deployment, Extensibility, Automation) */}
|
||||
<ChapterBand spacing="none">
|
||||
<div className="py-16 md:py-20">
|
||||
<MultiProviderSection />
|
||||
</div>
|
||||
<ChapterDivider />
|
||||
<div className="py-16 md:py-20">
|
||||
<TurnkeySection />
|
||||
</div>
|
||||
<ChapterDivider />
|
||||
<div className="py-16 md:py-20">
|
||||
<ExtensibleSection pluginCount={pluginCount} />
|
||||
</div>
|
||||
<ChapterDivider />
|
||||
<div className="py-16 md:py-20">
|
||||
<AutomationSection />
|
||||
</div>
|
||||
</ChapterBand>
|
||||
|
||||
{/* Chapter 3: Paseo Hub */}
|
||||
<ChapterBand spacing="chapter" tint="subtle">
|
||||
<HubSection />
|
||||
</ChapterBand>
|
||||
|
||||
{/* Chapter 4: Open source philosophy and consolidated sponsorship */}
|
||||
<ChapterBand spacing="none">
|
||||
<div className="py-16 md:py-20">
|
||||
<PhilosophySection />
|
||||
</div>
|
||||
<ChapterDivider />
|
||||
<div className="py-16 md:py-20">
|
||||
<HomepageSponsorsSection />
|
||||
</div>
|
||||
</ChapterBand>
|
||||
|
||||
{/* Chapter 5: FAQ */}
|
||||
<ChapterBand spacing="section">
|
||||
<FAQ />
|
||||
</div>
|
||||
</ChapterBand>
|
||||
|
||||
{/* Closing bookend: centered download CTA */}
|
||||
<ChapterBand spacing="chapter" tint="subtle">
|
||||
<ClosingCtaSection />
|
||||
</ChapterBand>
|
||||
</main>
|
||||
<SiteFooter sponsors={false} />
|
||||
|
||||
<SiteFooter width="default" sponsors={false} />
|
||||
</div>
|
||||
</CursorFieldProvider>
|
||||
);
|
||||
}
|
||||
|
||||
function Nav() {
|
||||
function Hero({
|
||||
title,
|
||||
subtitle,
|
||||
showHubEyebrow = false,
|
||||
}: {
|
||||
title: React.ReactNode;
|
||||
subtitle: React.ReactNode;
|
||||
showHubEyebrow?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<nav className="mb-20 md:mb-24">
|
||||
<SiteHeader />
|
||||
</nav>
|
||||
<div className="space-y-6 text-center">
|
||||
{showHubEyebrow ? <HubHeroEyebrow /> : null}
|
||||
<h1 className="font-display text-4xl font-semibold tracking-[-0.025em] leading-[1.02] md:text-6xl">
|
||||
{title}
|
||||
</h1>
|
||||
<p className="mx-auto max-w-lg text-base leading-relaxed text-white/70 md:text-lg">
|
||||
{subtitle}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function Hero({ title, subtitle }: { title: React.ReactNode; subtitle: React.ReactNode }) {
|
||||
function HubHeroEyebrow() {
|
||||
const { t } = useTranslation();
|
||||
const localize = useLocalizePath();
|
||||
return (
|
||||
<div className="space-y-6 text-center">
|
||||
<h1 className="text-4xl md:text-6xl font-medium tracking-tight leading-[0.95]">{title}</h1>
|
||||
<p className="text-base leading-relaxed text-white/70 md:text-lg max-w-lg mx-auto">
|
||||
{subtitle}
|
||||
</p>
|
||||
<div className="flex justify-center">
|
||||
<a
|
||||
href={localize("/hub")}
|
||||
className="group inline-flex max-w-full items-center gap-2 whitespace-nowrap rounded-full border border-white/10 bg-white/[0.04] px-3 py-1 text-xs text-white/75 transition-colors hover:border-white/20 hover:bg-white/[0.08] hover:text-white"
|
||||
>
|
||||
<PaseoHubMark className="h-3.5 w-3.5 shrink-0 text-white/90" />
|
||||
<span className="font-medium text-white/90">{t("landing.hubEyebrow.product")}</span>
|
||||
<span aria-hidden="true" className="h-3 w-px shrink-0 bg-white/15" />
|
||||
<span className="truncate text-white/65">{t("landing.hubEyebrow.label")}</span>
|
||||
<ArrowRight
|
||||
aria-hidden="true"
|
||||
className="h-3.5 w-3.5 shrink-0 text-white/45 transition-transform group-hover:translate-x-0.5 group-hover:text-white/80"
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -301,12 +376,14 @@ function AgentBadge({ name, Icon }: (typeof FEATURED_AGENTS)[number]) {
|
||||
}
|
||||
|
||||
function FeatureSection({
|
||||
eyebrow,
|
||||
title,
|
||||
description,
|
||||
badge,
|
||||
links,
|
||||
children,
|
||||
}: {
|
||||
eyebrow?: string;
|
||||
title: string;
|
||||
description: string;
|
||||
badge?: string;
|
||||
@@ -320,54 +397,18 @@ function FeatureSection({
|
||||
viewport={VIEWPORT_60}
|
||||
transition={EASE_OUT_05}
|
||||
>
|
||||
<SectionTitle title={title} description={description} badge={badge} links={links} />
|
||||
<SectionOpener
|
||||
eyebrow={eyebrow}
|
||||
title={title}
|
||||
description={description}
|
||||
badge={badge}
|
||||
links={links}
|
||||
/>
|
||||
{children}
|
||||
</motion.section>
|
||||
);
|
||||
}
|
||||
|
||||
function SectionTitle({
|
||||
title,
|
||||
description,
|
||||
badge,
|
||||
links,
|
||||
}: {
|
||||
title: string;
|
||||
description: string;
|
||||
badge?: string;
|
||||
links?: ReadonlyArray<{ href: string; label: string }>;
|
||||
}) {
|
||||
return (
|
||||
<div className="mb-12 space-y-2">
|
||||
<div className="flex items-center gap-3">
|
||||
<h2 className="text-3xl font-medium">{title}</h2>
|
||||
{badge && (
|
||||
<span className="rounded-full bg-emerald-400/10 px-2 py-1 text-xs text-emerald-300">
|
||||
{badge}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-base text-pretty text-muted-foreground max-w-lg">{description}</p>
|
||||
{links ? (
|
||||
<div className="flex flex-wrap gap-x-4 gap-y-1 pt-1 text-xs">
|
||||
{links.map((link) => (
|
||||
<a
|
||||
key={link.href}
|
||||
href={link.href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1 text-extra-muted-foreground transition-colors hover:text-muted-foreground"
|
||||
>
|
||||
{link.label}
|
||||
<ExternalLink className="h-3 w-3" />
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function SocialProofWall() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
@@ -377,7 +418,7 @@ function SocialProofWall() {
|
||||
viewport={VIEWPORT_60}
|
||||
transition={EASE_OUT_05}
|
||||
>
|
||||
<SectionTitle
|
||||
<SectionOpener
|
||||
title={t("landing.socialProof.title")}
|
||||
description={t("landing.socialProof.description")}
|
||||
/>
|
||||
@@ -424,7 +465,7 @@ function SocialProofCard({ tweet, inert }: { tweet: SocialProofTweet; inert?: bo
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
tabIndex={inert ? -1 : undefined}
|
||||
className="group flex h-[154px] w-[320px] shrink-0 flex-col justify-between overflow-hidden rounded-2xl border border-white/10 bg-white/[0.03] p-4 transition-colors hover:border-white/20 hover:bg-white/[0.05] md:w-[420px]"
|
||||
className="group flex h-[154px] w-[300px] shrink-0 flex-col justify-between overflow-hidden rounded-xl border border-white/[0.08] bg-white/[0.02] p-4 transition-colors hover:border-white/20 hover:bg-white/[0.04] md:w-[380px]"
|
||||
aria-label={t("landing.socialProof.readPost", { name: tweet.name })}
|
||||
>
|
||||
<div>
|
||||
@@ -453,30 +494,34 @@ function MultiProviderSection() {
|
||||
const localize = useLocalizePath();
|
||||
return (
|
||||
<FeatureSection
|
||||
eyebrow={t("landing.eyebrows.providers")}
|
||||
title={t("landing.providers.title")}
|
||||
description={t("landing.providers.description")}
|
||||
>
|
||||
<div className="grid grid-cols-2 gap-2 sm:grid-cols-3 sm:gap-4">
|
||||
<HairlineGrid columns="2-3">
|
||||
{FEATURED_AGENTS.map((agent) => (
|
||||
<div
|
||||
key={agent.name}
|
||||
className="flex items-center justify-center gap-2 rounded-xl border border-white/10 bg-white/[0.03] px-3 py-3 sm:gap-3 sm:px-5 sm:py-4"
|
||||
className="flex items-center gap-3 bg-background px-5 py-4 transition-colors hover:bg-white/[0.025] sm:px-6 sm:py-5"
|
||||
>
|
||||
<span className="shrink-0 text-white/80">
|
||||
<agent.Icon className="h-5 w-5 sm:h-7 sm:w-7" />
|
||||
<agent.Icon className="h-5 w-5 sm:h-6 sm:w-6" />
|
||||
</span>
|
||||
<span className="truncate text-sm font-medium text-white/90 sm:text-base">
|
||||
{agent.name}
|
||||
</span>
|
||||
<span className="truncate text-sm font-medium sm:text-base">{agent.name}</span>
|
||||
</div>
|
||||
))}
|
||||
<a
|
||||
href={localize("/agents")}
|
||||
className="flex items-center justify-center gap-2 rounded-xl border border-dashed border-white/10 bg-white/[0.01] px-3 py-3 text-white/50 hover:text-white/80 hover:border-white/20 hover:bg-white/[0.03] transition-colors sm:gap-3 sm:px-5 sm:py-4"
|
||||
className="flex items-center justify-between gap-2 bg-background px-5 py-4 text-white/55 transition-colors hover:bg-white/[0.025] hover:text-accent-text sm:px-6 sm:py-5"
|
||||
>
|
||||
<span className="text-sm font-medium sm:text-base">
|
||||
{t("common.more", { count: ADDITIONAL_AGENT_COUNT })}
|
||||
</span>
|
||||
<ArrowRight className="h-4 w-4 shrink-0" aria-hidden="true" />
|
||||
</a>
|
||||
</div>
|
||||
</HairlineGrid>
|
||||
</FeatureSection>
|
||||
);
|
||||
}
|
||||
@@ -489,13 +534,15 @@ function TurnkeySection() {
|
||||
title={t("landing.runAnywhere.title")}
|
||||
description={t("landing.runAnywhere.description")}
|
||||
>
|
||||
<div className="space-y-8">
|
||||
<ProductLead
|
||||
icon={Monitor}
|
||||
title={t("landing.runAnywhere.desktopTitle")}
|
||||
description={t("landing.runAnywhere.desktopDescription")}
|
||||
/>
|
||||
<div className="grid gap-4 md:grid-cols-3">
|
||||
<div className="overflow-hidden rounded-xl border border-white/[0.08] bg-white/[0.08]">
|
||||
<div className="bg-background p-6 md:p-7">
|
||||
<ProductLead
|
||||
icon={Monitor}
|
||||
title={t("landing.runAnywhere.desktopTitle")}
|
||||
description={t("landing.runAnywhere.desktopDescription")}
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-px border-t border-white/[0.08] md:grid-cols-3">
|
||||
<TurnkeyExtensionCard
|
||||
icon={Smartphone}
|
||||
title={t("landing.runAnywhere.mobileTitle")}
|
||||
@@ -517,7 +564,6 @@ function TurnkeySection() {
|
||||
ctaHref={localize("/hub")}
|
||||
ctaLabel={t("landing.runAnywhere.teamsCta")}
|
||||
ctaIcon={PASEO_HUB_CTA_ICON}
|
||||
showIntegrationIcons
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -534,7 +580,6 @@ function TurnkeyExtensionCard({
|
||||
ctaHref,
|
||||
ctaLabel,
|
||||
ctaIcon,
|
||||
showIntegrationIcons = false,
|
||||
}: {
|
||||
icon: LucideIcon;
|
||||
title: string;
|
||||
@@ -542,34 +587,22 @@ function TurnkeyExtensionCard({
|
||||
ctaHref: string;
|
||||
ctaLabel: string;
|
||||
ctaIcon?: React.ReactNode;
|
||||
showIntegrationIcons?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<FeatureCard icon={Icon} title={title} description={description}>
|
||||
<div className="flex items-center justify-between">
|
||||
<a
|
||||
href={ctaHref}
|
||||
className="inline-flex items-center gap-1.5 rounded-full bg-foreground px-2.5 py-1.5 text-xs text-background transition-colors hover:bg-foreground/90"
|
||||
>
|
||||
{ctaIcon}
|
||||
{ctaLabel}
|
||||
<ArrowRight className="h-3.5 w-3.5" />
|
||||
</a>
|
||||
{showIntegrationIcons ? INTEGRATION_ICONS : null}
|
||||
</div>
|
||||
</FeatureCard>
|
||||
<FeatureCell icon={Icon} title={title} description={description}>
|
||||
<a
|
||||
href={ctaHref}
|
||||
className="inline-flex items-center gap-1.5 rounded-full bg-foreground px-3 py-1.5 text-xs font-medium text-background transition-colors hover:bg-foreground/90"
|
||||
>
|
||||
{ctaIcon}
|
||||
{ctaLabel}
|
||||
<ArrowRight className="h-3.5 w-3.5" />
|
||||
</a>
|
||||
</FeatureCell>
|
||||
);
|
||||
}
|
||||
|
||||
const INTEGRATION_ICONS = (
|
||||
<span className="flex items-center gap-2 text-extra-muted-foreground">
|
||||
<GitHubIcon className="h-4 w-4" />
|
||||
<SlackIcon className="h-4 w-4" />
|
||||
<DiscordIcon className="h-4 w-4" />
|
||||
</span>
|
||||
);
|
||||
|
||||
/** The lead product of a section: an icon tile and title on the page background. */
|
||||
/** The lead product of a section: an icon tile and title. */
|
||||
function ProductLead({
|
||||
icon: Icon,
|
||||
title,
|
||||
@@ -584,13 +617,13 @@ function ProductLead({
|
||||
return (
|
||||
<div className="flex flex-col gap-6 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="rounded-xl border border-white/10 bg-white/[0.06] p-3 text-muted-foreground">
|
||||
<Icon className="h-6 w-6" strokeWidth={1.5} />
|
||||
<div className="rounded-lg border border-white/[0.08] bg-white/[0.04] p-3 text-accent-text">
|
||||
<Icon className="h-5 w-5" strokeWidth={1.5} />
|
||||
</div>
|
||||
<div className="space-y-0.5">
|
||||
<h3 className="text-xl font-medium text-white/90">{title}</h3>
|
||||
<h3 className="text-lg font-medium text-white/95">{title}</h3>
|
||||
{description ? (
|
||||
<p className="text-sm leading-relaxed text-white/50">{description}</p>
|
||||
<p className="text-sm leading-relaxed text-white/55">{description}</p>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
@@ -599,8 +632,8 @@ function ProductLead({
|
||||
);
|
||||
}
|
||||
|
||||
/** A small card: icon and title on one line, the blurb below, an optional action last. */
|
||||
function FeatureCard({
|
||||
/** A hairline grid cell: icon and title on one line, the blurb below, an optional action last. */
|
||||
function FeatureCell({
|
||||
icon: Icon,
|
||||
title,
|
||||
description,
|
||||
@@ -612,12 +645,12 @@ function FeatureCard({
|
||||
children?: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<div className="flex flex-col rounded-xl border border-white/10 bg-white/[0.025] p-5">
|
||||
<div className="flex items-center gap-3">
|
||||
<Icon className="h-5 w-5 shrink-0 text-extra-muted-foreground" strokeWidth={1.5} />
|
||||
<h3 className="font-medium text-white/85">{title}</h3>
|
||||
<div className="flex flex-col bg-background p-6">
|
||||
<div className="flex items-center gap-2.5">
|
||||
<Icon className="h-4 w-4 shrink-0 text-accent-text" strokeWidth={1.5} />
|
||||
<h3 className="text-sm font-medium text-white/90">{title}</h3>
|
||||
</div>
|
||||
<p className="mt-3 text-sm leading-relaxed text-white/45">{description}</p>
|
||||
<p className="mt-2.5 text-sm leading-relaxed text-white/55">{description}</p>
|
||||
{children ? <div className="mt-auto pt-5">{children}</div> : null}
|
||||
</div>
|
||||
);
|
||||
@@ -654,8 +687,11 @@ function AutomationSection() {
|
||||
description={t("landing.automation.description")}
|
||||
links={links}
|
||||
>
|
||||
<div className="grid gap-4 md:grid-cols-[14rem_minmax(0,1fr)]">
|
||||
<div className="grid self-start gap-2" role="tablist">
|
||||
<div className="grid gap-px overflow-hidden rounded-xl border border-white/[0.08] bg-white/[0.08] md:grid-cols-[15rem_minmax(0,1fr)]">
|
||||
<div
|
||||
className="grid grid-cols-3 gap-px bg-white/[0.08] md:grid-cols-1 md:content-start md:bg-background"
|
||||
role="tablist"
|
||||
>
|
||||
{AUTOMATION_OPTIONS.map((option) => (
|
||||
<AutomationSelector
|
||||
key={option.kind}
|
||||
@@ -690,17 +726,22 @@ function AutomationSelector({
|
||||
role="tab"
|
||||
aria-selected={active}
|
||||
onClick={handleClick}
|
||||
className={`flex items-center gap-3 rounded-xl border p-3 text-left transition-colors md:block md:p-4 ${
|
||||
className={`cursor-pointer border-b-2 p-3.5 text-left transition-colors md:border-b md:border-b-white/[0.07] md:border-l-2 md:p-5 ${
|
||||
active
|
||||
? "border-white/20 bg-white/[0.07]"
|
||||
: "border-white/10 bg-white/[0.025] hover:border-white/15 hover:bg-white/[0.04]"
|
||||
? "border-b-brand-green bg-white/[0.045] md:border-l-brand-green"
|
||||
: "border-b-transparent bg-background hover:bg-white/[0.025] md:border-l-transparent"
|
||||
}`}
|
||||
>
|
||||
<div className="flex shrink-0 items-center gap-2 text-muted-foreground md:mb-1">
|
||||
<Icon className="h-3 w-3" strokeWidth={1.5} />
|
||||
<span className="text-[10px]">{option.label}</span>
|
||||
<div className="flex shrink-0 items-center gap-2 font-mono md:mb-1.5">
|
||||
<Icon
|
||||
className={`h-3.5 w-3.5 ${active ? "text-accent-text" : "text-muted-foreground"}`}
|
||||
strokeWidth={1.5}
|
||||
/>
|
||||
<span className={`text-[11px] ${active ? "text-accent-text" : "text-muted-foreground"}`}>
|
||||
{option.label}
|
||||
</span>
|
||||
</div>
|
||||
<p className="text-xs leading-snug text-white/85 md:text-sm">
|
||||
<p className="mt-1 text-xs leading-snug text-white/85 md:mt-0 md:text-sm">
|
||||
{t(`landing.automation.${option.kind}Caption`)}
|
||||
</p>
|
||||
</button>
|
||||
@@ -711,7 +752,7 @@ function AutomationDetail({ kind }: { kind: AutomationKind }) {
|
||||
return (
|
||||
<div
|
||||
role="tabpanel"
|
||||
className="min-h-80 min-w-0 overflow-hidden rounded-xl border border-white/10 bg-black/20 p-5 md:h-[26rem] md:p-6"
|
||||
className="min-h-80 min-w-0 overflow-hidden bg-[#0c1110] p-5 md:h-[26rem] md:p-6"
|
||||
>
|
||||
{kind === "mcp" ? <McpAutomationTranscript /> : null}
|
||||
{kind === "cli" ? <CliAutomationExample /> : null}
|
||||
@@ -860,37 +901,82 @@ function SdkAutomationExample() {
|
||||
);
|
||||
}
|
||||
|
||||
function ExtensibleSection() {
|
||||
function HubSection() {
|
||||
const { t } = useTranslation();
|
||||
const localize = useLocalizePath();
|
||||
return (
|
||||
<motion.section
|
||||
initial={FADE_IN_UP}
|
||||
whileInView={FADE_IN}
|
||||
viewport={VIEWPORT_60}
|
||||
transition={EASE_OUT_05}
|
||||
aria-labelledby="hub-section-heading"
|
||||
>
|
||||
<div className="mb-10 space-y-3 md:mb-12">
|
||||
<h2 id="hub-section-heading">
|
||||
<PaseoHubLockup size="display" className="h-9 w-auto text-foreground md:h-11" />
|
||||
<span className="sr-only">{t("hub.title")}</span>
|
||||
</h2>
|
||||
<p className="max-w-xl text-base text-pretty text-muted-foreground">
|
||||
{t("landing.hubSection.description")}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-8">
|
||||
<HubLandingFlow />
|
||||
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<a href={localize("/hub")} className={PRIMARY_CTA_CLASS}>
|
||||
{t("landing.hubSection.exploreCta")}
|
||||
<ArrowRight className="h-4 w-4" aria-hidden="true" />
|
||||
</a>
|
||||
<a href={localize("/docs/hub")} className={SECONDARY_CTA_CLASS}>
|
||||
{t("landing.hubSection.docsCta")}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</motion.section>
|
||||
);
|
||||
}
|
||||
|
||||
function ExtensibleSection({ pluginCount }: { pluginCount?: number | null }) {
|
||||
const { t } = useTranslation();
|
||||
const pluginActions = React.useMemo(() => <PluginActions />, []);
|
||||
const libraryTitle =
|
||||
pluginCount && pluginCount > 0
|
||||
? t("landing.plugins.libraryTitleCount", { count: pluginCount })
|
||||
: t("landing.plugins.libraryTitle");
|
||||
return (
|
||||
<FeatureSection
|
||||
eyebrow={t("landing.eyebrows.plugins")}
|
||||
title={t("landing.plugins.title")}
|
||||
description={t("landing.plugins.description")}
|
||||
>
|
||||
<div className="space-y-12">
|
||||
<div className="space-y-6">
|
||||
<SelfModifyDemo />
|
||||
<div className="space-y-6">
|
||||
<ProductLead
|
||||
icon={Puzzle}
|
||||
title={t("landing.plugins.libraryTitle")}
|
||||
description={t("landing.plugins.libraryDescription")}
|
||||
actions={pluginActions}
|
||||
/>
|
||||
<PluginCategoryLinks />
|
||||
</div>
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<p className="text-sm text-white/45">{t("landing.plugins.license")}</p>
|
||||
<a
|
||||
href="https://github.com/getpaseo/paseo"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex shrink-0 items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground"
|
||||
>
|
||||
<GitFork className="h-4 w-4" strokeWidth={1.5} />
|
||||
{t("landing.plugins.fork")}
|
||||
<ExternalLink className="h-3.5 w-3.5 opacity-70" />
|
||||
</a>
|
||||
<div className="overflow-hidden rounded-xl border border-white/[0.08] bg-white/[0.08]">
|
||||
<div className="space-y-5 bg-background p-6">
|
||||
<ProductLead
|
||||
icon={Puzzle}
|
||||
title={libraryTitle}
|
||||
description={t("landing.plugins.libraryDescription")}
|
||||
actions={pluginActions}
|
||||
/>
|
||||
<PluginCategoryLinks />
|
||||
</div>
|
||||
<div className="flex flex-col gap-3 border-t border-white/[0.08] bg-background px-6 py-4 sm:flex-row sm:items-center sm:justify-between">
|
||||
<p className="text-sm text-white/50">{t("landing.plugins.license")}</p>
|
||||
<a
|
||||
href="https://github.com/getpaseo/paseo"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex shrink-0 items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-accent-text"
|
||||
>
|
||||
<GitFork className="h-4 w-4" strokeWidth={1.5} />
|
||||
{t("landing.plugins.fork")}
|
||||
<ExternalLink className="h-3.5 w-3.5 opacity-70" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</FeatureSection>
|
||||
@@ -956,7 +1042,7 @@ function SelfModifyDemo() {
|
||||
initial={reduceMotion ? "shown" : "hidden"}
|
||||
whileInView="shown"
|
||||
viewport={VIEWPORT_60}
|
||||
className="grid min-h-[22rem] grid-cols-[minmax(0,1fr)] overflow-hidden rounded-xl border border-white/10 bg-black/20 md:grid-cols-[minmax(0,1fr)_17rem]"
|
||||
className="grid min-h-[22rem] grid-cols-[minmax(0,1fr)] overflow-hidden rounded-xl border border-white/[0.08] bg-[#0c1110] md:grid-cols-[minmax(0,1fr)_17rem]"
|
||||
>
|
||||
<div className="space-y-5 p-5 md:p-6">
|
||||
<DemoItem step={DEMO_STEPS.prompt}>
|
||||
@@ -1087,43 +1173,50 @@ function PhilosophySection() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<FeatureSection
|
||||
eyebrow={t("landing.eyebrows.openSource")}
|
||||
title={t("landing.philosophy.title")}
|
||||
description={t("landing.philosophy.description")}
|
||||
>
|
||||
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
||||
<HairlineGrid columns="3">
|
||||
{PRINCIPLES.map((principle) => (
|
||||
<FeatureCard
|
||||
<FeatureCell
|
||||
key={principle.key}
|
||||
icon={principle.icon}
|
||||
title={t(`landing.philosophy.${principle.key}Title`)}
|
||||
description={t(`landing.philosophy.${principle.key}Description`)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</HairlineGrid>
|
||||
</FeatureSection>
|
||||
);
|
||||
}
|
||||
|
||||
function DownloadActions() {
|
||||
const platform = useVisitorPlatform();
|
||||
return (
|
||||
<div className="mx-auto flex flex-col items-center gap-3 sm:flex-row sm:justify-center">
|
||||
{isMobilePlatform(platform) ? (
|
||||
<StoreButton platform={platform} />
|
||||
) : (
|
||||
<DesktopDownloadButton platform={platform} />
|
||||
)}
|
||||
<div className="flex items-center justify-center gap-3">
|
||||
{isMobilePlatform(platform) ? <DesktopAppLink /> : <StoreIconLinks />}
|
||||
<ServerInstallButton />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function GetStarted() {
|
||||
const { t } = useTranslation();
|
||||
const localize = useLocalizePath();
|
||||
const platform = useVisitorPlatform();
|
||||
return (
|
||||
<div className="pt-10">
|
||||
<div className="pt-8">
|
||||
{/* The primary call to action owns its own row on phones so the small icon
|
||||
buttons never wrap and orphan one of themselves onto a line alone. It
|
||||
still hugs its label rather than stretching across the row. */}
|
||||
<div className="mx-auto flex flex-col items-center gap-3 sm:flex-row sm:justify-center">
|
||||
{isMobilePlatform(platform) ? (
|
||||
<StoreButton platform={platform} />
|
||||
) : (
|
||||
<DesktopDownloadButton platform={platform} />
|
||||
)}
|
||||
<div className="flex items-center justify-center gap-3">
|
||||
{isMobilePlatform(platform) ? <DesktopAppLink /> : <StoreIconLinks />}
|
||||
<ServerInstallButton />
|
||||
</div>
|
||||
</div>
|
||||
<DownloadActions />
|
||||
<div className="flex flex-wrap items-center justify-center gap-x-2 gap-y-1 pt-6">
|
||||
<span className="text-xs text-muted-foreground">{t("landing.getStarted.supports")}</span>
|
||||
<div className="flex items-center gap-1">
|
||||
@@ -1133,7 +1226,7 @@ function GetStarted() {
|
||||
</div>
|
||||
<a
|
||||
href={localize("/agents")}
|
||||
className="whitespace-nowrap text-xs text-muted-foreground hover:text-foreground transition-colors"
|
||||
className="whitespace-nowrap text-xs text-muted-foreground transition-colors hover:text-foreground"
|
||||
>
|
||||
{t("common.more", { count: ADDITIONAL_AGENT_COUNT })}
|
||||
</a>
|
||||
@@ -1142,6 +1235,28 @@ function GetStarted() {
|
||||
);
|
||||
}
|
||||
|
||||
function ClosingCtaSection() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<section aria-labelledby="closing-cta-heading" className="text-center">
|
||||
<div className="mb-6 flex justify-center">
|
||||
<span className="inline-flex h-12 w-12 items-center justify-center rounded-xl border border-brand-green/40 bg-brand-green/15 text-accent-text">
|
||||
<PaseoMark className="h-6 w-6" />
|
||||
</span>
|
||||
</div>
|
||||
<SectionOpener
|
||||
align="center"
|
||||
eyebrow={t("landing.closingCta.eyebrow")}
|
||||
headingId="closing-cta-heading"
|
||||
title={t("landing.closingCta.title")}
|
||||
description={t("landing.closingCta.description")}
|
||||
className="mb-8"
|
||||
/>
|
||||
<DownloadActions />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
const PRIMARY_CTA_CLASS =
|
||||
"inline-flex items-center justify-center gap-2 rounded-lg bg-foreground px-4 py-2.5 text-sm font-medium text-background hover:bg-foreground/90 transition-colors";
|
||||
const SECONDARY_CTA_CLASS =
|
||||
@@ -1285,7 +1400,7 @@ function PhoneShowcase() {
|
||||
const textAnimate = React.useMemo(() => (textInView ? FADE_IN : {}), [textInView]);
|
||||
|
||||
return (
|
||||
<div ref={containerRef} className="flex flex-col items-center pt-4 pb-16 gap-20">
|
||||
<div ref={containerRef} className="flex flex-col items-center gap-14 pt-2 pb-12 md:pb-16">
|
||||
{/* Arrow + text */}
|
||||
<motion.div
|
||||
initial={FADE_IN_UP_TINY}
|
||||
@@ -1397,21 +1512,26 @@ function FAQ() {
|
||||
[localize],
|
||||
);
|
||||
return (
|
||||
<motion.div
|
||||
<motion.section
|
||||
initial={FADE_IN_UP}
|
||||
whileInView={FADE_IN}
|
||||
viewport={VIEWPORT_60}
|
||||
transition={EASE_OUT_05}
|
||||
className="space-y-6"
|
||||
aria-labelledby="home-faq-heading"
|
||||
className="grid items-start gap-10 lg:grid-cols-[minmax(0,17rem)_minmax(0,1fr)] lg:gap-16"
|
||||
>
|
||||
<h2 className="text-3xl font-medium">{t("landing.faq.title")}</h2>
|
||||
<div className="space-y-6">
|
||||
<SectionOpener
|
||||
headingId="home-faq-heading"
|
||||
title={t("landing.faq.title")}
|
||||
className="mb-0 self-start"
|
||||
/>
|
||||
<div className="divide-y divide-white/[0.08] border-y border-white/[0.08]">
|
||||
{FAQ_ENTRIES.map((entry) => (
|
||||
<FAQItem key={entry} question={t(`landing.faq.${entry}Question`)}>
|
||||
<Trans i18nKey={`landing.faq.${entry}Answer`} components={links} />
|
||||
</FAQItem>
|
||||
))}
|
||||
</div>
|
||||
</motion.div>
|
||||
</motion.section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
import { ExternalLink } from "lucide-react";
|
||||
import type * as React from "react";
|
||||
import { SiteHeader } from "~/components/site-header";
|
||||
|
||||
/** Shared outer container width. Uses a transparent md:border-x when unframed to avoid a 1px shift. */
|
||||
export const PAGE_CONTAINER_CLASS =
|
||||
"mx-auto w-full max-w-[1160px] md:border-x md:border-transparent";
|
||||
|
||||
/** Shared outer rail width and vertical hairlines across marketing pages. */
|
||||
export const PAGE_RAIL_CLASS = "mx-auto w-full max-w-[1160px] md:border-x md:border-white/[0.07]";
|
||||
|
||||
/** Shared inner horizontal padding so every page element shares one left/right rail. */
|
||||
export const PAGE_INSET_CLASS = "px-5 sm:px-8 md:px-14";
|
||||
|
||||
/** Extend scrollable content from the mobile inset to the viewport edges. */
|
||||
export const MOBILE_PAGE_BLEED_CLASS = "-mx-5 px-5";
|
||||
|
||||
/** Full-width header band locking logo and navigation to the same (x, y) across pages. */
|
||||
export function PageHeaderBand({ framed = false }: { framed?: boolean }) {
|
||||
return (
|
||||
<div className={framed ? "border-b border-white/[0.07]" : ""}>
|
||||
<div
|
||||
className={`${framed ? PAGE_RAIL_CLASS : PAGE_CONTAINER_CLASS} ${PAGE_INSET_CLASS} py-4 md:py-5`}
|
||||
>
|
||||
<SiteHeader />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const BAND_PADDING = {
|
||||
chapter: "py-16 md:py-24",
|
||||
section: "py-14 md:py-20",
|
||||
compact: "py-12 md:py-16",
|
||||
hero: "pt-12 pb-14 md:pt-16 md:pb-20",
|
||||
none: "",
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* A full-width architectural band separated by a 1px horizontal hairline with quiet crosshair
|
||||
* ticks where the horizontal rule meets the vertical frame rails.
|
||||
*/
|
||||
export function ChapterBand({
|
||||
children,
|
||||
spacing = "chapter",
|
||||
ruled = true,
|
||||
ticks = true,
|
||||
framed = true,
|
||||
tint = "none",
|
||||
className = "",
|
||||
id,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
spacing?: keyof typeof BAND_PADDING;
|
||||
ruled?: boolean;
|
||||
ticks?: boolean;
|
||||
framed?: boolean;
|
||||
tint?: "none" | "subtle";
|
||||
className?: string;
|
||||
id?: string;
|
||||
}) {
|
||||
return (
|
||||
<div
|
||||
id={id}
|
||||
className={`overflow-x-clip ${ruled ? "border-t border-white/[0.07]" : ""} ${
|
||||
tint === "subtle" ? "bg-white/[0.014]" : ""
|
||||
} ${className}`}
|
||||
>
|
||||
<div
|
||||
className={`relative ${framed ? PAGE_RAIL_CLASS : PAGE_CONTAINER_CLASS} ${PAGE_INSET_CLASS} ${BAND_PADDING[spacing]}`}
|
||||
>
|
||||
{ruled && ticks && framed ? <RailIntersectionTicks /> : null}
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Quiet 9px hairlines centered on the left and right vertical rail intersections. */
|
||||
function RailIntersectionTicks() {
|
||||
return (
|
||||
<>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="pointer-events-none absolute -top-[4.5px] -left-[4.5px] hidden h-[9px] w-[9px] md:block"
|
||||
>
|
||||
<span className="absolute top-1/2 left-0 h-px w-full -translate-y-1/2 bg-white/25" />
|
||||
<span className="absolute top-0 left-1/2 h-full w-px -translate-x-1/2 bg-white/25" />
|
||||
</span>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="pointer-events-none absolute -top-[4.5px] -right-[4.5px] hidden h-[9px] w-[9px] md:block"
|
||||
>
|
||||
<span className="absolute top-1/2 left-0 h-px w-full -translate-y-1/2 bg-white/25" />
|
||||
<span className="absolute top-0 left-1/2 h-full w-px -translate-x-1/2 bg-white/25" />
|
||||
</span>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
/** Internal sub-section divider inside a multi-part chapter, staying inside the frame rails. */
|
||||
export function ChapterDivider({ className = "" }: { className?: string }) {
|
||||
return (
|
||||
<div
|
||||
aria-hidden="true"
|
||||
className={`-mx-5 border-t border-white/[0.07] sm:-mx-8 md:-mx-14 ${className}`}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unified section opener used across `/` and `/hub`:
|
||||
* mono uppercase green eyebrow -> commanding 44px H2 -> concise lede + optional external links.
|
||||
*/
|
||||
export function SectionOpener({
|
||||
eyebrow,
|
||||
title,
|
||||
mutedLead,
|
||||
description,
|
||||
headingId,
|
||||
badge,
|
||||
links,
|
||||
actions,
|
||||
align = "left",
|
||||
className = "mb-10 md:mb-12",
|
||||
}: {
|
||||
eyebrow?: string;
|
||||
title: React.ReactNode;
|
||||
mutedLead?: string;
|
||||
description?: React.ReactNode;
|
||||
headingId?: string;
|
||||
badge?: string;
|
||||
links?: ReadonlyArray<{ href: string; label: string }>;
|
||||
actions?: React.ReactNode;
|
||||
align?: "left" | "center";
|
||||
className?: string;
|
||||
}) {
|
||||
const centered = align === "center";
|
||||
return (
|
||||
<div
|
||||
className={`${className} ${
|
||||
centered
|
||||
? "mx-auto max-w-2xl text-center"
|
||||
: "flex flex-col gap-5 md:flex-row md:items-end md:justify-between"
|
||||
}`}
|
||||
>
|
||||
<div className={`space-y-3 ${centered ? "" : "max-w-2xl"}`}>
|
||||
{eyebrow ? (
|
||||
<p className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-accent-text">
|
||||
{eyebrow}
|
||||
</p>
|
||||
) : null}
|
||||
<div className={`flex flex-wrap items-center gap-3 ${centered ? "justify-center" : ""}`}>
|
||||
<h2
|
||||
id={headingId}
|
||||
className="font-display text-3xl font-semibold tracking-[-0.025em] leading-[1.1] text-foreground sm:text-4xl md:text-[42px]"
|
||||
>
|
||||
{mutedLead ? (
|
||||
<>
|
||||
<span className="text-white/45">{mutedLead}</span>{" "}
|
||||
</>
|
||||
) : null}
|
||||
{title}
|
||||
</h2>
|
||||
{badge ? (
|
||||
<span className="rounded-full border border-brand-green/40 bg-brand-green/20 px-2.5 py-0.5 text-xs text-accent-text">
|
||||
{badge}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
{description ? (
|
||||
<p
|
||||
className={`text-base leading-relaxed text-pretty text-muted-foreground ${
|
||||
centered ? "mx-auto max-w-lg" : "max-w-xl"
|
||||
}`}
|
||||
>
|
||||
{description}
|
||||
</p>
|
||||
) : null}
|
||||
{links && links.length > 0 ? (
|
||||
<div className="flex flex-wrap gap-x-5 gap-y-1.5 pt-1 text-xs">
|
||||
{links.map((link) => (
|
||||
<a
|
||||
key={link.href}
|
||||
href={link.href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1 font-mono text-white/55 transition-colors hover:text-accent-text"
|
||||
>
|
||||
{link.label}
|
||||
<ExternalLink className="h-3 w-3" />
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
{actions ? <div className="flex shrink-0 flex-wrap items-center gap-3">{actions}</div> : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const GRID_COLUMNS = {
|
||||
"2": "grid-cols-1 lg:grid-cols-2",
|
||||
"3": "grid-cols-1 md:grid-cols-3",
|
||||
"2-3": "grid-cols-2 sm:grid-cols-3",
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* Hairline-divided shared-border cell grid. Uses 1px background gap so interior hairlines never
|
||||
* double up across responsive column counts.
|
||||
*/
|
||||
export function HairlineGrid({
|
||||
children,
|
||||
columns = "3",
|
||||
className = "",
|
||||
clipContents = true,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
columns?: keyof typeof GRID_COLUMNS;
|
||||
className?: string;
|
||||
clipContents?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<div
|
||||
className={`grid gap-px rounded-xl border border-white/[0.08] bg-white/[0.08] ${clipContents ? "overflow-hidden" : ""} ${GRID_COLUMNS[columns]} ${className}`}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -50,6 +50,16 @@ describe("paseo brand assets", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("tightens symbol-to-wordmark spacing for display-scale lockups while keeping canonical paths", () => {
|
||||
const html = renderToStaticMarkup(<PaseoHubLockup size="display" className="h-12 w-auto" />);
|
||||
const canonical = readFileSync(path.join(BRAND_ROOT, "lockups/paseo-hub-white.svg"), "utf8");
|
||||
|
||||
expect(html).toContain('viewBox="0 0 798 144"');
|
||||
expect(html).toContain('width="798"');
|
||||
expect(html).toContain('transform="translate(-44 0)"');
|
||||
expect(extractPathData(html)).toEqual(extractPathData(canonical));
|
||||
});
|
||||
|
||||
it("keeps public/logo.svg and public/favicon.svg aligned with assets/brand", () => {
|
||||
const canonicalPaseo = readFileSync(path.join(BRAND_ROOT, "marks/paseo-white.svg"), "utf8");
|
||||
const publicLogo = readFileSync(path.join(WEBSITE_PUBLIC, "logo.svg"), "utf8");
|
||||
|
||||
@@ -99,22 +99,34 @@ function BrandMark({ asset, props }: { asset: ParsedMark; props: React.SVGProps<
|
||||
);
|
||||
}
|
||||
|
||||
function BrandLockup({
|
||||
asset,
|
||||
props,
|
||||
}: {
|
||||
asset: ParsedLockup;
|
||||
props: React.SVGProps<SVGSVGElement>;
|
||||
}) {
|
||||
/**
|
||||
* Optical horizontal tightening (in 144-unit lockup coordinates) for display-scale lockups.
|
||||
* Canonical lockups have a ~91-unit ink-to-ink gap calibrated for ~18–22px header sizes; at
|
||||
* 36–48px display sizes that gap reads ~25–30px wide, so `size="display"` pulls the wordmark
|
||||
* 44 units closer (~14–16px visual gap, ~1/3 of the mark width) and trims the viewBox to match.
|
||||
*/
|
||||
const DISPLAY_GAP_TIGHTEN_UNITS = 44;
|
||||
|
||||
export interface BrandLockupProps extends React.SVGProps<SVGSVGElement> {
|
||||
/** Optical spacing scale: `"default"` for small UI/header lockups, `"display"` for large headings. */
|
||||
size?: "default" | "display";
|
||||
}
|
||||
|
||||
function BrandLockup({ asset, props }: { asset: ParsedLockup; props: BrandLockupProps }) {
|
||||
const { size = "default", ...svgProps } = props;
|
||||
const tighten = size === "display" ? DISPLAY_GAP_TIGHTEN_UNITS : 0;
|
||||
const width = asset.width - tighten;
|
||||
const viewBox = tighten > 0 ? `0 0 ${width} ${asset.height}` : asset.viewBox;
|
||||
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width={asset.width}
|
||||
width={width}
|
||||
height={asset.height}
|
||||
viewBox={asset.viewBox}
|
||||
viewBox={viewBox}
|
||||
fill="none"
|
||||
aria-hidden="true"
|
||||
{...props}
|
||||
{...svgProps}
|
||||
>
|
||||
<path
|
||||
d={asset.path}
|
||||
@@ -123,7 +135,11 @@ function BrandLockup({
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
<path d={asset.wordmarkPath} fill="currentColor" />
|
||||
<path
|
||||
d={asset.wordmarkPath}
|
||||
fill="currentColor"
|
||||
transform={tighten > 0 ? `translate(-${tighten} 0)` : undefined}
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -139,16 +155,16 @@ export function PaseoHubMark(props: React.SVGProps<SVGSVGElement>) {
|
||||
}
|
||||
|
||||
/** Canonical Paseo lockup (butterfly mark at 94% optical scale + Plus Jakarta Sans SemiBold). */
|
||||
export function PaseoLockup(props: React.SVGProps<SVGSVGElement>) {
|
||||
export function PaseoLockup(props: BrandLockupProps) {
|
||||
return <BrandLockup asset={PASEO_LOCKUP} props={props} />;
|
||||
}
|
||||
|
||||
/** Canonical Paseo Hub lockup (flower mark + Plus Jakarta Sans SemiBold). */
|
||||
export function PaseoHubLockup(props: React.SVGProps<SVGSVGElement>) {
|
||||
export function PaseoHubLockup(props: BrandLockupProps) {
|
||||
return <BrandLockup asset={PASEO_HUB_LOCKUP} props={props} />;
|
||||
}
|
||||
|
||||
/** Canonical Hub lockup (flower mark + "Hub"), used where Paseo is already on screen. */
|
||||
export function HubLockup(props: React.SVGProps<SVGSVGElement>) {
|
||||
export function HubLockup(props: BrandLockupProps) {
|
||||
return <BrandLockup asset={HUB_LOCKUP} props={props} />;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { PLUGINS_LINKED } from "~/plugins/launch";
|
||||
import { PAGE_INSET_CLASS, PAGE_RAIL_CLASS } from "~/components/page-frame";
|
||||
import { SponsorsSection } from "~/components/sponsorship";
|
||||
import { getAlternativePages } from "~/data/alternative-pages";
|
||||
import { appStoreUrl, playStoreUrl, webAppUrl } from "~/downloads";
|
||||
import { SponsorsSection } from "~/components/sponsorship";
|
||||
import { useLocale, useLocalizePath } from "~/i18n";
|
||||
import { PLUGINS_LINKED } from "~/plugins/launch";
|
||||
|
||||
interface SiteFooterProps {
|
||||
width?: "default" | "prose" | "wide";
|
||||
@@ -11,13 +12,17 @@ interface SiteFooterProps {
|
||||
sponsors?: boolean;
|
||||
}
|
||||
|
||||
const WIDTH_CLASSES: Record<NonNullable<SiteFooterProps["width"]>, string> = {
|
||||
const NON_DEFAULT_WIDTH_CLASSES: Record<
|
||||
Exclude<NonNullable<SiteFooterProps["width"]>, "default">,
|
||||
string
|
||||
> = {
|
||||
prose: "max-w-prose p-6 md:p-12 md:pt-0",
|
||||
default: "max-w-5xl p-6 md:p-20 md:pt-0",
|
||||
wide: "max-w-7xl p-6 md:p-20 md:pt-0",
|
||||
};
|
||||
|
||||
const LINK_CLASS = "block text-muted-foreground hover:text-foreground transition-colors";
|
||||
const LINK_CLASS = "block text-muted-foreground transition-colors hover:text-foreground";
|
||||
const COLUMN_HEADING_CLASS =
|
||||
"font-mono text-[11px] uppercase tracking-[0.12em] text-extra-muted-foreground";
|
||||
|
||||
function ExternalLink({ href, children }: { href: string; children: React.ReactNode }) {
|
||||
return (
|
||||
@@ -31,72 +36,91 @@ export function SiteFooter({ width = "default", sponsors = true }: SiteFooterPro
|
||||
const { t } = useTranslation();
|
||||
const locale = useLocale();
|
||||
const localize = useLocalizePath();
|
||||
const widthClasses = WIDTH_CLASSES[width];
|
||||
const alternatives = getAlternativePages(locale);
|
||||
const page = (path: string, label: string) => (
|
||||
<a href={localize(path)} className={LINK_CLASS}>
|
||||
{label}
|
||||
</a>
|
||||
);
|
||||
return (
|
||||
<footer className={`${widthClasses} mx-auto mt-12 md:mt-16`}>
|
||||
{sponsors ? <SponsorsSection placement="footer" /> : null}
|
||||
<div className="border-t border-white/10 pt-8 pb-4 grid grid-cols-2 sm:grid-cols-5 gap-8 text-sm">
|
||||
<div className="space-y-3">
|
||||
<p className="text-extra-muted-foreground">{t("footer.product")}</p>
|
||||
<div className="space-y-2">
|
||||
{page("/blog", t("footer.blog"))}
|
||||
{page("/docs", t("footer.docs"))}
|
||||
{PLUGINS_LINKED && page("/plugins", t("footer.plugins"))}
|
||||
{page("/changelog", t("footer.changelog"))}
|
||||
{page("/hub", t("footer.hub"))}
|
||||
{page("/docs/cli", t("footer.cli"))}
|
||||
{page("/privacy", t("footer.privacy"))}
|
||||
{page("/terms", t("footer.terms"))}
|
||||
{page("/sponsor", t("footer.sponsor"))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
<p className="text-extra-muted-foreground">{t("footer.agents")}</p>
|
||||
<div className="space-y-2">
|
||||
{page("/claude-code", "Claude Code")}
|
||||
{page("/codex", "Codex")}
|
||||
{page("/opencode", "OpenCode")}
|
||||
{page("/antigravity", "Antigravity")}
|
||||
{page("/muse-code", "Muse Code")}
|
||||
{page("/agents", t("footer.allProviders"))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
<p className="text-extra-muted-foreground">{t("footer.alternatives")}</p>
|
||||
<div className="space-y-2">
|
||||
{alternatives.map((alternative) => (
|
||||
<a key={alternative.slug} href={localize(alternative.href)} className={LINK_CLASS}>
|
||||
{alternative.name}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
<p className="text-extra-muted-foreground">{t("footer.community")}</p>
|
||||
<div className="space-y-2">
|
||||
<ExternalLink href="https://discord.gg/jz8T2uahpH">Discord</ExternalLink>
|
||||
<ExternalLink href="https://www.reddit.com/r/PaseoAI/">Reddit</ExternalLink>
|
||||
<ExternalLink href="https://github.com/getpaseo/paseo">GitHub</ExternalLink>
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
<p className="text-extra-muted-foreground">{t("footer.download")}</p>
|
||||
<div className="space-y-2">
|
||||
<ExternalLink href={appStoreUrl}>App Store</ExternalLink>
|
||||
<ExternalLink href={playStoreUrl}>Google Play</ExternalLink>
|
||||
<ExternalLink href="https://github.com/getpaseo/paseo/releases">
|
||||
{t("footer.desktop")}
|
||||
</ExternalLink>
|
||||
<ExternalLink href={webAppUrl}>{t("footer.webApp")}</ExternalLink>
|
||||
</div>
|
||||
|
||||
const columns = (
|
||||
<div className="grid grid-cols-2 gap-8 text-sm sm:grid-cols-5">
|
||||
<div className="space-y-3">
|
||||
<p className={COLUMN_HEADING_CLASS}>{t("footer.product")}</p>
|
||||
<div className="space-y-2">
|
||||
{page("/blog", t("footer.blog"))}
|
||||
{page("/docs", t("footer.docs"))}
|
||||
{PLUGINS_LINKED && page("/plugins", t("footer.plugins"))}
|
||||
{page("/changelog", t("footer.changelog"))}
|
||||
{page("/hub", t("footer.hub"))}
|
||||
{page("/docs/cli", t("footer.cli"))}
|
||||
{page("/privacy", t("footer.privacy"))}
|
||||
{page("/terms", t("footer.terms"))}
|
||||
{page("/sponsor", t("footer.sponsor"))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
<p className={COLUMN_HEADING_CLASS}>{t("footer.agents")}</p>
|
||||
<div className="space-y-2">
|
||||
{page("/claude-code", "Claude Code")}
|
||||
{page("/codex", "Codex")}
|
||||
{page("/opencode", "OpenCode")}
|
||||
{page("/antigravity", "Antigravity")}
|
||||
{page("/muse-code", "Muse Code")}
|
||||
{page("/agents", t("footer.allProviders"))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
<p className={COLUMN_HEADING_CLASS}>{t("footer.alternatives")}</p>
|
||||
<div className="space-y-2">
|
||||
{alternatives.map((alternative) => (
|
||||
<a key={alternative.slug} href={localize(alternative.href)} className={LINK_CLASS}>
|
||||
{alternative.name}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
<p className={COLUMN_HEADING_CLASS}>{t("footer.community")}</p>
|
||||
<div className="space-y-2">
|
||||
<ExternalLink href="https://discord.gg/jz8T2uahpH">Discord</ExternalLink>
|
||||
<ExternalLink href="https://www.reddit.com/r/PaseoAI/">Reddit</ExternalLink>
|
||||
<ExternalLink href="https://github.com/getpaseo/paseo">GitHub</ExternalLink>
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
<p className={COLUMN_HEADING_CLASS}>{t("footer.download")}</p>
|
||||
<div className="space-y-2">
|
||||
<ExternalLink href={appStoreUrl}>App Store</ExternalLink>
|
||||
<ExternalLink href={playStoreUrl}>Google Play</ExternalLink>
|
||||
<ExternalLink href="https://github.com/getpaseo/paseo/releases">
|
||||
{t("footer.desktop")}
|
||||
</ExternalLink>
|
||||
<ExternalLink href={webAppUrl}>{t("footer.webApp")}</ExternalLink>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
if (width === "default") {
|
||||
return (
|
||||
<footer className="border-t border-white/[0.07]">
|
||||
{sponsors ? (
|
||||
<div className="border-b border-white/[0.07]">
|
||||
<div className={`${PAGE_RAIL_CLASS} ${PAGE_INSET_CLASS}`}>
|
||||
<SponsorsSection placement="footer" />
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
<div className={`${PAGE_RAIL_CLASS} ${PAGE_INSET_CLASS} py-12 md:py-14`}>{columns}</div>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<footer className={`${NON_DEFAULT_WIDTH_CLASSES[width]} mx-auto mt-12 md:mt-16`}>
|
||||
{sponsors ? <SponsorsSection placement="footer" /> : null}
|
||||
<div className="border-t border-white/10 pt-8 pb-4">{columns}</div>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ export function SiteHeader() {
|
||||
>
|
||||
<PaseoLockup className="h-[22px] w-auto" />
|
||||
</a>
|
||||
<div className="flex flex-wrap items-center justify-center gap-4">
|
||||
<nav className="flex flex-wrap items-center justify-center gap-4">
|
||||
{PLUGINS_LINKED && (
|
||||
<a href={localize("/plugins")} className={NAV_LINK_CLASS}>
|
||||
{t("nav.plugins")}
|
||||
@@ -63,7 +63,7 @@ export function SiteHeader() {
|
||||
<GitHubIcon width="18" height="18" />
|
||||
{stars && <span className="text-sm">{stars}</span>}
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { PAGE_INSET_CLASS, PAGE_RAIL_CLASS, PageHeaderBand } from "~/components/page-frame";
|
||||
import { SiteFooter } from "~/components/site-footer";
|
||||
import { SiteHeader } from "~/components/site-header";
|
||||
|
||||
@@ -7,18 +8,26 @@ interface SiteShellProps {
|
||||
width: "default" | "prose" | "wide";
|
||||
}
|
||||
|
||||
const MAIN_CLASSES: Record<SiteShellProps["width"], string> = {
|
||||
const MAIN_CLASSES: Record<Exclude<SiteShellProps["width"], "default">, string> = {
|
||||
prose: "max-w-prose p-6 md:p-12 mx-auto",
|
||||
default: "max-w-5xl p-6 md:p-20 mx-auto",
|
||||
wide: "max-w-7xl p-6 md:p-20 mx-auto",
|
||||
};
|
||||
|
||||
export function SiteShell({ children, width }: SiteShellProps) {
|
||||
const mainClasses = MAIN_CLASSES[width];
|
||||
if (width === "default") {
|
||||
return (
|
||||
<div className="min-h-screen bg-background">
|
||||
<PageHeaderBand framed />
|
||||
<main className={`${PAGE_RAIL_CLASS} ${PAGE_INSET_CLASS} py-14 md:py-20`}>{children}</main>
|
||||
<SiteFooter width="default" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-background">
|
||||
<main className={mainClasses}>
|
||||
<div className="mb-20">
|
||||
<main className={MAIN_CLASSES[width]}>
|
||||
<div className="mb-16">
|
||||
<SiteHeader />
|
||||
</div>
|
||||
{children}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { ArrowRight, Check, ExternalLink, Heart } from "lucide-react";
|
||||
import * as React from "react";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { useLocalizePath } from "~/i18n";
|
||||
import { BuyMeACoffeeIcon, GitHubIcon, OpenCollectiveIcon } from "~/components/brand-icons";
|
||||
import { HairlineGrid, SectionOpener } from "~/components/page-frame";
|
||||
import {
|
||||
BUY_ME_A_COFFEE_URL,
|
||||
GITHUB_SPONSORS_URL,
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
openSpotCount,
|
||||
sponsorHref,
|
||||
} from "~/data/sponsors";
|
||||
import { useLocalizePath } from "~/i18n";
|
||||
|
||||
function SectionHeading({
|
||||
as: Heading,
|
||||
@@ -27,11 +28,13 @@ function SectionHeading({
|
||||
badge?: string;
|
||||
}) {
|
||||
return (
|
||||
<div className="mb-12 space-y-2">
|
||||
<div className="mb-10 space-y-2.5">
|
||||
<div className="flex items-center gap-3">
|
||||
<Heading className="text-3xl font-medium tracking-tight">{title}</Heading>
|
||||
<Heading className="font-display text-3xl font-semibold tracking-[-0.025em] md:text-[42px]">
|
||||
{title}
|
||||
</Heading>
|
||||
{badge ? (
|
||||
<span className="rounded-full bg-emerald-400/10 px-2 py-1 text-xs text-emerald-300">
|
||||
<span className="rounded-full border border-brand-green/40 bg-brand-green/20 px-2.5 py-0.5 text-xs text-accent-text">
|
||||
{badge}
|
||||
</span>
|
||||
) : null}
|
||||
@@ -55,7 +58,7 @@ const MAINTAINER_COMPONENTS = {
|
||||
};
|
||||
|
||||
const MAINTAINER_SIGNATURE = (
|
||||
<p className="text-white/50">
|
||||
<p className="text-sm text-white/50">
|
||||
<Trans i18nKey="sponsor.maintainer" components={MAINTAINER_COMPONENTS} />
|
||||
</p>
|
||||
);
|
||||
@@ -141,26 +144,28 @@ export function BackingOptions() {
|
||||
[localize, t],
|
||||
);
|
||||
return (
|
||||
<div className="grid gap-3 md:grid-cols-2">
|
||||
<HairlineGrid columns="2">
|
||||
{options.map((option) => (
|
||||
<a
|
||||
key={option.href}
|
||||
href={option.href}
|
||||
{...(option.external ? { target: "_blank", rel: "noopener noreferrer" } : {})}
|
||||
className="flex items-center gap-4 rounded-xl border border-white/10 bg-white/[0.02] p-4 transition-colors hover:border-white/20 hover:bg-white/[0.05]"
|
||||
className="group flex items-center justify-between gap-4 bg-background px-5 py-4 transition-colors hover:bg-white/[0.03]"
|
||||
>
|
||||
<option.icon className="h-6 w-6 shrink-0 text-white/60" />
|
||||
<p className="flex items-center gap-1.5 font-medium text-white">
|
||||
{option.name}
|
||||
{option.external ? (
|
||||
<ExternalLink className="h-3.5 w-3.5 text-white/40" />
|
||||
) : (
|
||||
<ArrowRight className="h-3.5 w-3.5 text-white/40" />
|
||||
)}
|
||||
</p>
|
||||
<span className="flex items-center gap-3.5">
|
||||
<option.icon className="h-5 w-5 shrink-0 text-white/60 transition-colors group-hover:text-white/90" />
|
||||
<span className="text-sm font-medium text-white/90 group-hover:text-white">
|
||||
{option.name}
|
||||
</span>
|
||||
</span>
|
||||
{option.external ? (
|
||||
<ExternalLink className="h-3.5 w-3.5 shrink-0 text-white/35 transition-colors group-hover:text-accent-text" />
|
||||
) : (
|
||||
<ArrowRight className="h-3.5 w-3.5 shrink-0 text-white/35 transition-colors group-hover:text-accent-text" />
|
||||
)}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</HairlineGrid>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -184,7 +189,7 @@ export function SponsorSpotSection() {
|
||||
<ul className="grid max-w-2xl gap-3 text-white/70">
|
||||
{SPOT_FEATURES.map((feature) => (
|
||||
<li key={feature} className="flex items-start gap-2.5">
|
||||
<Check aria-hidden="true" className="mt-1 size-4 shrink-0 text-emerald-300" />
|
||||
<Check aria-hidden="true" className="mt-1 size-4 shrink-0 text-accent-text" />
|
||||
<span>{t(`sponsor.company.${feature}`)}</span>
|
||||
</li>
|
||||
))}
|
||||
@@ -193,7 +198,7 @@ export function SponsorSpotSection() {
|
||||
{open > 0 ? (
|
||||
<a
|
||||
href={SPONSOR_SPOT_CHECKOUT_URL}
|
||||
className="inline-flex items-center rounded-md bg-white px-5 py-2.5 text-sm font-medium text-black transition-colors hover:bg-white/90"
|
||||
className="inline-flex items-center rounded-lg bg-foreground px-5 py-2.5 text-sm font-medium text-background transition-colors hover:bg-foreground/90"
|
||||
>
|
||||
{t("sponsor.becomeSponsor")}
|
||||
</a>
|
||||
@@ -224,15 +229,72 @@ export function SponsorPaseoSection() {
|
||||
);
|
||||
}
|
||||
|
||||
/** Homepage: a short version of the note with the same links as /sponsor. */
|
||||
/** Standalone short sponsor note + backing options (used on /download/thanks). */
|
||||
export function SponsorSection() {
|
||||
const { t } = useTranslation();
|
||||
const hubLink = useHubLinkComponents();
|
||||
return (
|
||||
<section>
|
||||
<SectionHeading as="h2" title={t("sponsor.title")} />
|
||||
<div className="space-y-10">
|
||||
<div className="max-w-2xl space-y-5 leading-relaxed text-white/70">
|
||||
<div className="space-y-8">
|
||||
<div className="max-w-2xl space-y-4 text-sm leading-relaxed text-white/70">
|
||||
<p>{t("sponsor.note.independent")}</p>
|
||||
<p>{t("sponsor.shortNote.maintained")}</p>
|
||||
<p>
|
||||
<Trans i18nKey="sponsor.shortNote.selfFunded" components={hubLink} />
|
||||
</p>
|
||||
{MAINTAINER_SIGNATURE}
|
||||
</div>
|
||||
<BackingOptions />
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Consolidated homepage Sponsors + Sponsor Paseo section.
|
||||
* Keeps `aria-labelledby="sponsors-heading"` with heading text "Sponsors" so the Sponsors region
|
||||
* contract stays intact while unifying the logo row, founder note, and backing options into one
|
||||
* coherent chapter.
|
||||
*/
|
||||
export function HomepageSponsorsSection() {
|
||||
const { t } = useTranslation();
|
||||
const localize = useLocalizePath();
|
||||
const hubLink = useHubLinkComponents();
|
||||
const open = openSpotCount();
|
||||
|
||||
return (
|
||||
<section aria-labelledby="sponsors-heading">
|
||||
<SectionOpener headingId="sponsors-heading" title={t("sponsor.sponsors")} className="mb-10" />
|
||||
|
||||
<ul className="flex flex-wrap items-center gap-x-14 gap-y-8">
|
||||
{SPONSORS.map((sponsor) => (
|
||||
<li key={sponsor.url}>
|
||||
<a
|
||||
href={sponsorHref(sponsor, "website")}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="block"
|
||||
>
|
||||
<img src={sponsor.logo.onDark} alt={sponsor.name} className="h-12 w-auto" />
|
||||
</a>
|
||||
<p className="mt-2 text-sm text-white/55">{sponsor.description}</p>
|
||||
</li>
|
||||
))}
|
||||
{open > 0 ? (
|
||||
<li>
|
||||
<a
|
||||
href={localize("/sponsor#spot")}
|
||||
className="inline-flex h-11 items-center rounded-lg border border-dashed border-white/15 px-4 text-sm text-white/50 transition-colors hover:border-white/30 hover:text-white/80"
|
||||
>
|
||||
{t("sponsor.becomeSponsor")}
|
||||
</a>
|
||||
</li>
|
||||
) : null}
|
||||
</ul>
|
||||
|
||||
<div className="mt-10 grid gap-10 border-t border-white/[0.07] pt-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] lg:items-start">
|
||||
<div className="space-y-4 text-sm leading-relaxed text-white/70">
|
||||
<p>{t("sponsor.note.independent")}</p>
|
||||
<p>{t("sponsor.shortNote.maintained")}</p>
|
||||
<p>
|
||||
@@ -257,18 +319,19 @@ const SPONSORS_PLACEMENTS = {
|
||||
button: "h-12 px-5 text-sm",
|
||||
},
|
||||
footer: {
|
||||
section: "space-y-5 border-t border-white/10 py-8",
|
||||
heading: "gap-1.5 text-sm text-extra-muted-foreground",
|
||||
section: "space-y-5 py-8",
|
||||
heading:
|
||||
"gap-1.5 font-mono text-[11px] uppercase tracking-[0.12em] text-extra-muted-foreground",
|
||||
heart: "size-3",
|
||||
link: "opacity-85 transition-opacity hover:opacity-100",
|
||||
logo: "h-10",
|
||||
logo: "h-9",
|
||||
description: "mt-1.5 text-xs text-white/45",
|
||||
button: "h-9 px-3.5 text-sm",
|
||||
button: "h-9 px-3.5 text-xs",
|
||||
},
|
||||
} as const;
|
||||
|
||||
interface SponsorsSectionProps {
|
||||
/** `page` is a homepage section; `footer` is the band above other pages' footers. */
|
||||
/** `page` is a standalone section; `footer` is the band above other pages' footers. */
|
||||
placement: keyof typeof SPONSORS_PLACEMENTS;
|
||||
}
|
||||
|
||||
@@ -313,7 +376,7 @@ export function SponsorsSection({ placement }: SponsorsSectionProps) {
|
||||
<li>
|
||||
<a
|
||||
href={localize("/sponsor#spot")}
|
||||
className={`inline-flex items-center rounded-md border border-dashed border-white/15 text-white/45 transition-colors hover:border-white/30 hover:text-white/75 ${style.button}`}
|
||||
className={`inline-flex items-center rounded-lg border border-dashed border-white/15 text-white/45 transition-colors hover:border-white/30 hover:text-white/75 ${style.button}`}
|
||||
>
|
||||
{t("sponsor.becomeSponsor")}
|
||||
</a>
|
||||
|
||||
@@ -43,25 +43,38 @@ async function writeCachedValue<T>(
|
||||
);
|
||||
}
|
||||
|
||||
export async function getBlockingColdCache<T>({
|
||||
context,
|
||||
key,
|
||||
isValue,
|
||||
fetchFresh,
|
||||
}: {
|
||||
interface CacheOptions<T> {
|
||||
context: WebsiteCacheContext;
|
||||
key: string;
|
||||
isValue: Validator<T>;
|
||||
fetchFresh: () => Promise<T>;
|
||||
}): Promise<T> {
|
||||
}
|
||||
|
||||
function refreshInBackground<T>({ context, key, fetchFresh }: CacheOptions<T>): void {
|
||||
context.waitUntil(
|
||||
fetchFresh()
|
||||
.then((fresh) => writeCachedValue(context.cache, key, fresh))
|
||||
.catch(() => undefined),
|
||||
);
|
||||
}
|
||||
|
||||
/** Return the cached value, warming the cache in the background when it is empty or stale. */
|
||||
export async function getNonBlockingColdCache<T>(options: CacheOptions<T>): Promise<T | null> {
|
||||
const { context, key, isValue } = options;
|
||||
if (!context.cache) return null;
|
||||
const cached = await readCachedValue(context.cache, key, isValue);
|
||||
if (!cached || Date.now() - cached.fetchedAt > GITHUB_CACHE_TTL_MS) {
|
||||
refreshInBackground(options);
|
||||
}
|
||||
return cached?.value ?? null;
|
||||
}
|
||||
|
||||
export async function getBlockingColdCache<T>(options: CacheOptions<T>): Promise<T> {
|
||||
const { context, key, isValue, fetchFresh } = options;
|
||||
const cached = await readCachedValue(context.cache, key, isValue);
|
||||
if (cached) {
|
||||
if (Date.now() - cached.fetchedAt > GITHUB_CACHE_TTL_MS) {
|
||||
context.waitUntil(
|
||||
fetchFresh()
|
||||
.then((fresh) => writeCachedValue(context.cache, key, fresh))
|
||||
.catch(() => undefined),
|
||||
);
|
||||
refreshInBackground(options);
|
||||
}
|
||||
return cached.value;
|
||||
}
|
||||
|
||||
@@ -348,6 +348,20 @@
|
||||
"intro": "Paseo supports many agents natively. It also runs any <acp>ACP agent</acp>, and you can add new providers with <plugins>plugins</plugins>."
|
||||
},
|
||||
"landing": {
|
||||
"hubEyebrow": {
|
||||
"product": "Paseo Hub",
|
||||
"label": "Automations on your machines"
|
||||
},
|
||||
"eyebrows": {
|
||||
"providers": "Providers",
|
||||
"plugins": "Plugins",
|
||||
"openSource": "Open source"
|
||||
},
|
||||
"closingCta": {
|
||||
"eyebrow": "Get started",
|
||||
"title": "Your agents, on every screen.",
|
||||
"description": "Download the desktop app or run the daemon on any machine. Open source under Apache 2.0."
|
||||
},
|
||||
"socialProof": {
|
||||
"title": "Loved by developers",
|
||||
"description": "See what developers are saying about Paseo",
|
||||
@@ -369,9 +383,17 @@
|
||||
"remoteDescription": "Run Paseo on a home lab, or a cloud machine",
|
||||
"remoteCta": "Docs",
|
||||
"teamsTitle": "Teams and triggers",
|
||||
"teamsDescription": "Share access or start work from GitHub, Slack, and Discord",
|
||||
"teamsDescription": "Share daemons with your team and automate runs with Paseo Hub",
|
||||
"teamsCta": "Paseo Hub"
|
||||
},
|
||||
"hubSection": {
|
||||
"description": "Run agents on your machines from GitHub, Linear, Slack, Discord, schedules, or webhooks.",
|
||||
"flowTriggers": "Trigger sources",
|
||||
"flowDaemons": "Your connected daemons",
|
||||
"flowOpenSession": "Open live session in Paseo",
|
||||
"exploreCta": "Explore Paseo Hub",
|
||||
"docsCta": "Self-host docs"
|
||||
},
|
||||
"automation": {
|
||||
"title": "Built for automation",
|
||||
"description": "Use MCP, the CLI, or the TypeScript SDK to automate Paseo",
|
||||
@@ -393,7 +415,9 @@
|
||||
"plan": "I'll build it as a local plugin and install it.",
|
||||
"done": "Review queue is in your sidebar.",
|
||||
"panelTitle": "Review queue",
|
||||
"libraryTitle": "400+ community plugins",
|
||||
"libraryTitle": "Community plugins",
|
||||
"libraryTitleCount_one": "{{count}} community plugin",
|
||||
"libraryTitleCount_other": "{{count}} community plugins",
|
||||
"libraryDescription": "Built by developers on the same plugin API your agents use",
|
||||
"browse": "Browse plugins",
|
||||
"docs": "Plugin docs",
|
||||
@@ -580,25 +604,213 @@
|
||||
"reddit": "Workflows and questions."
|
||||
},
|
||||
"hub": {
|
||||
"metaTitle": "Paseo Hub - GitHub, Slack, and Discord triggers",
|
||||
"metaDescription": "Run Paseo Hub yourself and start agents on your own machines from GitHub, Slack, and Discord.",
|
||||
"metaTitle": "Paseo Hub - Agent automations on your machines",
|
||||
"metaDescription": "Automate the agents on your Paseo daemons from GitHub, Linear, Slack, Discord, schedules, and webhooks. Self-host Hub or use the hosted service.",
|
||||
"title": "Paseo Hub",
|
||||
"intro": "An optional service that sits above your daemons and gives them extra capabilities.",
|
||||
"runIt": "Run it yourself or use the hosted service.",
|
||||
"intro": "Automate coding agents and share daemons across your team. Every run executes on your own machines.",
|
||||
"runIt": "Run it yourself under Apache 2.0 or use the hosted service.",
|
||||
"hero": {
|
||||
"getStarted": "Get started",
|
||||
"selfHost": "Self-host"
|
||||
},
|
||||
"eyebrows": {
|
||||
"architecture": "Architecture",
|
||||
"pricing": "Pricing"
|
||||
},
|
||||
"automations": {
|
||||
"title": "Automations from every source",
|
||||
"description": "Triggers watch for events across your tools and start agents on your connected daemons."
|
||||
},
|
||||
"sources": {
|
||||
"github": {
|
||||
"name": "GitHub",
|
||||
"description": "Issues, pull requests, and comments."
|
||||
},
|
||||
"linear": {
|
||||
"name": "Linear",
|
||||
"description": "Issues, assignments, and comments."
|
||||
},
|
||||
"slack": {
|
||||
"name": "Slack",
|
||||
"description": "Mentions in channels and threads."
|
||||
},
|
||||
"discord": {
|
||||
"name": "Discord",
|
||||
"description": "Mentions in channels and threads."
|
||||
},
|
||||
"schedules": {
|
||||
"name": "Schedules",
|
||||
"description": "Recurring runs in your timezone."
|
||||
},
|
||||
"webhooks": {
|
||||
"name": "Webhooks",
|
||||
"description": "Events from any service or script."
|
||||
}
|
||||
},
|
||||
"demo": {
|
||||
"shared": {
|
||||
"tablistLabel": "Automation source previews",
|
||||
"openInPaseo": "Open in Paseo",
|
||||
"testsPassed": "tests passed",
|
||||
"appBadge": "APP",
|
||||
"docsLink": "Read {{source}} docs"
|
||||
},
|
||||
"slack": {
|
||||
"alt": "Slack thread in #engineering showing mo mentioning @paseo-bot to list P0 issues and open a pull request",
|
||||
"searchPlaceholder": "Search Paseo",
|
||||
"channels": "Channels",
|
||||
"apps": "Apps",
|
||||
"channelTopic": "Core daemon, mobile & Hub",
|
||||
"threadReplies": "3 replies",
|
||||
"typing": "paseo-bot is typing...",
|
||||
"composerPlaceholder": "Reply...",
|
||||
"showIssues": "<mention/> show me the latest P0 issues",
|
||||
"issuesOpen": "Three P0 issues are open:",
|
||||
"createPr": "<mention/> create a pull request for the first one",
|
||||
"ranOn": "Continued on <host>macbook-pro</host>. Opened <pr>getpaseo/paseo#1234</pr> with a fix for the terminal writes.",
|
||||
"filesChanged": "3 files changed",
|
||||
"caption": "Reply in the same thread to steer the running agent, or open the session in Paseo."
|
||||
},
|
||||
"github": {
|
||||
"alt": "GitHub issue #2811 showing mo labeling an issue and paseo-bot opening pull request #2819 with passing checks",
|
||||
"issueTitle": "Terminal output drops under sustained load",
|
||||
"issueMeta": "opened this issue 14 minutes ago · 2 comments",
|
||||
"authorBadge": "Owner",
|
||||
"botBadge": "bot",
|
||||
"openedAgo": "14 minutes ago",
|
||||
"repliedAgo": "9 minutes ago",
|
||||
"issueBody": "Fast output bursts drop frames when the PTY buffer fills up. <mention/> reproduce this and open a fix.",
|
||||
"addedLabel": "added the",
|
||||
"startedOn": "paseo-bot started on macbook-pro",
|
||||
"botReply": "Reproduced with a 64 KB burst test on <host>macbook-pro</host> and opened <pr>#2819</pr> to bound and drain the write queue.",
|
||||
"checksPassed": "All 4 checks passed",
|
||||
"assignees": "Assignees",
|
||||
"labels": "Labels",
|
||||
"development": "Development",
|
||||
"daemon": "Daemon",
|
||||
"caption": "Label an issue or comment to start an agent on your daemon and open a pull request."
|
||||
},
|
||||
"linear": {
|
||||
"alt": "Linear issue PAS-418 assigned to paseo-bot, running on devbox and linking pull request #2822",
|
||||
"issueTitle": "Relay reconnect loop on Android after sleep",
|
||||
"issueDescription": "After the phone wakes from Doze mode, the relay socket retries every 200ms without backoff.",
|
||||
"activity": "Activity",
|
||||
"assignedEvent": "assigned this issue to",
|
||||
"runningOn": "Ran on <host>devbox</host> · Codex",
|
||||
"traceLine": "Read relay/reconnect.ts, added jittered backoff and wake reset",
|
||||
"botSummary": "Added exponential backoff with a wake-state reset in <code>relay/reconnect.ts</code> and regression tests. Pull request is ready for review.",
|
||||
"properties": "Properties",
|
||||
"status": "Status",
|
||||
"priority": "Priority",
|
||||
"assignee": "Assignee",
|
||||
"creator": "Creator",
|
||||
"labels": "Labels",
|
||||
"daemon": "Daemon",
|
||||
"caption": "Assign an issue to start an agent on your daemon and link the pull request back."
|
||||
},
|
||||
"discord": {
|
||||
"alt": "Discord channel #engineering showing mo mentioning @paseo-bot and receiving a thread reply with pull request #2825",
|
||||
"textChannels": "Text channels",
|
||||
"channelTopic": "Daemon & CLI engineering",
|
||||
"threadTitle": "Fix stale worktrees",
|
||||
"time1": "Today at 10:12 AM",
|
||||
"time2": "Today at 10:16 AM",
|
||||
"userPrompt": "<mention/> fix the stale worktree branch cleanup bug from <issue/>",
|
||||
"startedThread": "started a thread:",
|
||||
"botStarted": "Running on <host>devbox</host> with OpenCode. Checking worktree close hooks.",
|
||||
"botFinished": "Pruned orphaned branches when an agent workspace closes and added a test.",
|
||||
"fieldHost": "Host",
|
||||
"fieldDiff": "Changes",
|
||||
"fieldChecks": "Checks",
|
||||
"composerPlaceholder": "Message #engineering",
|
||||
"caption": "Mention @paseo-bot in a channel to run an agent in a thread and report back."
|
||||
},
|
||||
"schedules": {
|
||||
"alt": "Daily CI optimizer schedule running at 7:00 AM on devbox, opening pull request #2831 and posting a summary to Slack",
|
||||
"active": "Active",
|
||||
"jobTitle": "Daily CI optimizer",
|
||||
"cadence": "Weekdays at 7:00 AM America/New_York",
|
||||
"step1Title": "Scheduled run #42 analyzed the last 24h of CI",
|
||||
"step1Detail": "Found <code>website-e2e</code> flaking in 18% of runs and cold Rust builds adding 2m 40s.",
|
||||
"step2Title": "Opened pull request on devbox",
|
||||
"metricRuntime": "Avg workflow",
|
||||
"metricFlake": "e2e flake rate",
|
||||
"metricCache": "Cargo cache",
|
||||
"slackPosted": "Posted to Slack",
|
||||
"slackSummary": "Morning CI report: cut average workflow time from <strong>7m 12s</strong> to <strong>4m 28s</strong> and fixed the e2e flake in <pr>#2831</pr>.",
|
||||
"notifiedMo": "cc @mo",
|
||||
"caption": "Run agents on a schedule in your timezone, open pull requests, and post to Slack."
|
||||
},
|
||||
"webhooks": {
|
||||
"alt": "A terminal shows a webhook POST. Hub returns 202 Accepted and starts a Codex run on devbox.",
|
||||
"runMeta": "devbox · Codex · getpaseo/paseo",
|
||||
"statusDone": "PR opened",
|
||||
"trace1": "Checked out <code>v0.19.4</code> in an isolated worktree",
|
||||
"trace2": "Traced <code>ECONNRESET</code> to idle keepalive timeout in <code>relay/server.ts</code>",
|
||||
"trace3": "Opened <pr/> with fix and regression test, all checks passed",
|
||||
"triggeredBy": "webhook · sentry-alert",
|
||||
"routedLine": "Hub routed to devbox · 118ms",
|
||||
"caption": "Send a POST request from any script or service to start an agent on your daemon."
|
||||
}
|
||||
},
|
||||
"authoring": {
|
||||
"title": "Configure in the dashboard or ship as code",
|
||||
"description": "Set up triggers in the browser or commit YAML files to your repository and deploy from the CLI.",
|
||||
"dashboardTitle": "Dashboard and run activity",
|
||||
"dashboardDescription": "Pick a daemon and working directory in the browser. Hub checks which providers, models, and modes the daemon offers as you configure a trigger.",
|
||||
"triggersLabel": "Triggers:",
|
||||
"triggersText": "Create, edit, or pause automations in form or YAML view.",
|
||||
"validationLabel": "Live checks:",
|
||||
"validationText": "See which providers, models, and modes the connected daemon offers.",
|
||||
"activityLabel": "Run activity:",
|
||||
"activityText": "Inspect deliveries, routing outcomes, outputs, and errors.",
|
||||
"docsLink": "Read configuration docs"
|
||||
},
|
||||
"shape": {
|
||||
"title": "Shared with your team, locked to your machines",
|
||||
"description": "Hub connects to the daemons you already run. Your team shares triggers and history while your code stays on your machines.",
|
||||
"triggersRow": "Automation sources",
|
||||
"webhooks": "webhooks, mentions, and schedules",
|
||||
"hub": "Hub",
|
||||
"hubHosting": "Self-hosted or hosted",
|
||||
"sameRpcs": "the same RPCs the app and CLI use",
|
||||
"daemonsRow": "Your connected daemons",
|
||||
"directOrRelay": "direct connection or encrypted relay",
|
||||
"appsRow": "Paseo clients",
|
||||
"desktop": "Desktop",
|
||||
"web": "Web",
|
||||
"mobile": "Mobile",
|
||||
"cli": "CLI"
|
||||
},
|
||||
"guardrails": {
|
||||
"optInTitle": "Opt-in execution",
|
||||
"optInDescription": "The <code>hub.execute</code> permission is off by default on every daemon and granted per machine.",
|
||||
"scopedTitle": "Scoped triggers",
|
||||
"scopedDescription": "Event triggers support sender allowlists and resource filters. You can set GitHub permissions for each step and scope the Slack and Discord tools.",
|
||||
"visibilityTitle": "Team visibility",
|
||||
"visibilityDescription": "Owners, admins, and members share daemons, triggers, run history, and routing outcomes."
|
||||
},
|
||||
"agents": {
|
||||
"title": "Runs the agents you already have",
|
||||
"description": "Hub discovers the providers on each connected Paseo daemon. You can run Claude Code, Codex, OpenCode, Pi, and custom providers, including those from plugins."
|
||||
},
|
||||
"pricing": {
|
||||
"title": "Choose how to run Hub",
|
||||
"unavailable": "The plan comparison is temporarily unavailable.",
|
||||
"selfHost": "Self-host Hub",
|
||||
"title": "Self-host or hosted",
|
||||
"seatNote": "Run the open-source Hub yourself under Apache 2.0 or use the hosted service. Hub dashboard members and pending invitations count as seats.",
|
||||
"unavailable": "The hosted plan comparison is temporarily unavailable.",
|
||||
"selfHost": "Self-host docs",
|
||||
"selfHosted": "Self-hosted",
|
||||
"free": "Free",
|
||||
"openSource": "/ open source",
|
||||
"openSource": "/ Apache 2.0",
|
||||
"getStarted": "Get started",
|
||||
"operateHub": "You operate Hub",
|
||||
"operateHub": "Run with <code>npx @getpaseo/hub</code> or Docker Compose",
|
||||
"allSources": "GitHub, Linear, Slack, Discord, schedules, and webhooks",
|
||||
"managedSources": "GitHub, Linear, Slack, Discord, schedules, and webhooks",
|
||||
"ownApps": "Provider apps you create and control",
|
||||
"openSourceFeature": "Open source",
|
||||
"openSourceFeature": "Apache 2.0 open source",
|
||||
"unlimitedRuns": "Unlimited agent runs",
|
||||
"runsPerMonth": "{{value}} agent runs a month",
|
||||
"unlimitedUnits": "Unlimited {{unit}}s",
|
||||
"noSeatCap": "No seat cap",
|
||||
"units_one": "{{value}} {{unit}}",
|
||||
"units_other": "{{value}} {{unit}}s",
|
||||
"perMonth": "/ month",
|
||||
@@ -607,71 +819,32 @@
|
||||
"perUnitMonths": "per {{unit}} / {{count}} months",
|
||||
"seat": "seat"
|
||||
},
|
||||
"triggers": {
|
||||
"title": "Triggers, running on your machines",
|
||||
"description": "Mention the bot in GitHub, Slack, or Discord and an agent starts on your daemon.",
|
||||
"github": "Issues, PRs, and reviews.",
|
||||
"slack": "Channels and threads.",
|
||||
"discord": "Channels and threads."
|
||||
},
|
||||
"demo": {
|
||||
"showIssues": "<mention/> show me the latest P0 issues",
|
||||
"issuesOpen": "Three P0 issues are open:",
|
||||
"createPr": "<mention/> create a pull request for the first one",
|
||||
"ranOn": "Ran on <host>macbook-pro</host>. Opened <pr>getpaseo/paseo#1234</pr> with a fix for the terminal writes.",
|
||||
"filesChanged": "3 files changed",
|
||||
"testsPassed": "tests passed",
|
||||
"bot": "Bot",
|
||||
"caption": "The agent ran on your daemon, with your keys."
|
||||
},
|
||||
"agents": {
|
||||
"title": "Runs the agents you already have",
|
||||
"description": "The Hub ships no agent of its own, so your team works with the providers, subscriptions, and skills already configured on your daemons."
|
||||
},
|
||||
"shape": {
|
||||
"title": "Works with your existing infrastructure",
|
||||
"description": "The Hub connects to the daemons you already run, and your apps keep connecting to those same daemons.",
|
||||
"triggersRow": "Triggers and teammates",
|
||||
"yourTeam": "Your team",
|
||||
"futureIntegrations": "Future integrations",
|
||||
"webhooks": "webhooks and mentions",
|
||||
"hub": "Hub",
|
||||
"hubHosting": "Self-hosted or managed",
|
||||
"sameRpcs": "the same RPCs the app and CLI use",
|
||||
"daemonsRow": "Your daemons",
|
||||
"directOrRelay": "direct connection or relay",
|
||||
"appsRow": "Paseo apps",
|
||||
"desktop": "Desktop",
|
||||
"web": "Web",
|
||||
"mobile": "Mobile",
|
||||
"cli": "CLI"
|
||||
},
|
||||
"faq": {
|
||||
"title": "FAQ",
|
||||
"whatQuestion": "What is the Hub?",
|
||||
"whatAnswer": "A separate service that sits above your Paseo daemons. You connect one or more daemons to it and it gives them GitHub, Slack, and Discord triggers, with collaboration features planned. Paseo works fully without it.",
|
||||
"separateQuestion": "Why is it a separate service instead of part of the daemon?",
|
||||
"separateAnswer1": "The daemon stays one lean executable on one machine. The Hub talks to daemons over the same RPCs the app and the CLI use, so anyone can build their own hub on top of Paseo.",
|
||||
"separateAnswer2": "It also has a different job. The Hub is meant to be exposed to the internet, shared with a team, and run multi-tenant. None of that belongs in a single machine daemon.",
|
||||
"whatQuestion": "What is Paseo Hub?",
|
||||
"whatAnswer": "Paseo Hub is a separate service that sits above your Paseo daemons. Connect one or more daemons to automate agent runs from GitHub, Linear, Slack, Discord, schedules, and webhooks, and share them with your team. Paseo works on its own without Hub.",
|
||||
"separateQuestion": "Why is Hub a separate service instead of part of the daemon?",
|
||||
"separateAnswer1": "The daemon stays a single process on one machine. Hub talks to daemons over the same RPCs that the app and CLI use, so anyone can build another service on top of Paseo.",
|
||||
"separateAnswer2": "Hub also has a different job. It receives public webhooks, handles team access, and runs multi-tenant. None of that belongs inside a single-machine daemon.",
|
||||
"selfHostQuestion": "Can I run it myself?",
|
||||
"selfHostAnswer": "Yes. Run <code>npx @getpaseo/hub</code> and complete setup in the browser. The source is available on <github>GitHub</github>, and the <guide>self-hosting guide</guide> covers more involved deployments.",
|
||||
"selfHostAnswer": "Yes. Run <code>npx @getpaseo/hub</code> or start it with Docker Compose and finish setup in your browser. The Apache 2.0 source is on <github>GitHub</github>, and the <guide>self-hosting guide</guide> covers production deployments.",
|
||||
"needQuestion": "What do I need to run it?",
|
||||
"needAnswer": "Node.js and a running Paseo daemon. Hub guides you through connecting the provider apps you want.",
|
||||
"needAnswer": "You need Node.js or Docker and a running Paseo daemon. Hub walks you through connecting your daemons and provider apps.",
|
||||
"hostedQuestion": "Is there a hosted version?",
|
||||
"hostedAnswer": "Yes. The hosted service runs the same Hub software you can self-host.",
|
||||
"plannedQuestion": "What else is planned?",
|
||||
"plannedIntro": "Not built yet, listed so you know where this is going.",
|
||||
"plannedProvisioning": "Provisioning daemons for your team",
|
||||
"plannedSharing": "Sharing settings and skills across a team",
|
||||
"plannedIntegrations": "More integrations",
|
||||
"hostedAnswer": "Yes. The <hosted>hosted service</hosted> runs the same open-source Hub software that you can self-host. Hub dashboard members and pending invitations count as seats.",
|
||||
"codeQuestion": "Can Hub run code on my machines?",
|
||||
"codeAnswer": "Only on daemons where you grant the <code>hub.execute</code> permission. Enrolling a daemon does not enable execution by default, and you can revoke the permission from the machine at any time.",
|
||||
"moveQuestion": "Do I have to move my team to a new tool?",
|
||||
"moveAnswer": "No. The Hub works in the Slack or Discord your team already uses, and on the daemons you already run. When the work gets serious you switch to the Paseo app on those same daemons.",
|
||||
"moveAnswer": "No. Hub runs from GitHub, Linear, Slack, Discord, schedules, and webhooks on the daemons you already use. When you want to inspect or steer a run directly, open the live session in Paseo on desktop or mobile.",
|
||||
"agentsQuestion": "Which agents does it run?",
|
||||
"agentsAnswer": "Whichever ones your daemons have configured, with your own subscriptions and skills. The Hub ships no agent of its own.",
|
||||
"codeQuestion": "Can the Hub run code on my machines?",
|
||||
"codeAnswer": "Yes, on the daemons you connect to it and nowhere else. That is the whole point of triggers, and it's why access to the beta stays small and trusted.",
|
||||
"accessQuestion": "How do I get access?",
|
||||
"accessAnswer": "You can self-host today or <hosted>sign in to Hosted Hub</hosted> for a free account. When you want more agent runs or more seats, upgrade from Billing inside Hub."
|
||||
"agentsAnswer": "Hub runs the providers configured on your connected Paseo daemons, including custom providers from plugins. Agents use the subscriptions, models, and skills on those machines.",
|
||||
"plannedQuestion": "What else is planned?",
|
||||
"plannedIntro": "These capabilities are not built yet, and are listed so you know where Hub is heading.",
|
||||
"plannedProvisioning": "Provisioning remote daemons for your team",
|
||||
"plannedSharing": "Sharing settings and skills across a team",
|
||||
"plannedIntegrations": "Additional provider integrations",
|
||||
"accessQuestion": "How do I get started?",
|
||||
"accessAnswer": "Self-host Hub with <code>npx @getpaseo/hub</code> or <hosted>sign in to hosted Hub</hosted> with a free account. Upgrade from Billing inside Hub when you need more runs or seats."
|
||||
}
|
||||
},
|
||||
"changelog": {
|
||||
|
||||
@@ -348,6 +348,20 @@
|
||||
"intro": "Paseo 原生支持许多 Agent,还可以运行任何 <acp>ACP Agent</acp>,你也可以通过<plugins>插件</plugins>添加新的 Provider。"
|
||||
},
|
||||
"landing": {
|
||||
"hubEyebrow": {
|
||||
"product": "Paseo Hub",
|
||||
"label": "在你自己的机器上自动化运行"
|
||||
},
|
||||
"eyebrows": {
|
||||
"providers": "Provider",
|
||||
"plugins": "插件",
|
||||
"openSource": "开源理念"
|
||||
},
|
||||
"closingCta": {
|
||||
"eyebrow": "开始使用",
|
||||
"title": "你的 Agent,在每块屏幕上。",
|
||||
"description": "下载桌面应用,或在任意机器上运行 daemon。基于 Apache 2.0 开源。"
|
||||
},
|
||||
"socialProof": {
|
||||
"title": "深受开发者喜爱",
|
||||
"description": "看看开发者们怎么评价 Paseo",
|
||||
@@ -369,9 +383,17 @@
|
||||
"remoteDescription": "在家庭实验室或云主机上运行 Paseo",
|
||||
"remoteCta": "文档",
|
||||
"teamsTitle": "团队与触发器",
|
||||
"teamsDescription": "共享访问权限,或从 GitHub、Slack 和 Discord 发起工作",
|
||||
"teamsDescription": "通过 Paseo Hub 与团队共享 daemon 并自动化运行 Agent",
|
||||
"teamsCta": "Paseo Hub"
|
||||
},
|
||||
"hubSection": {
|
||||
"description": "通过 GitHub、Linear、Slack、Discord、定时任务或 webhook 在你的机器上运行 Agent。",
|
||||
"flowTriggers": "触发来源",
|
||||
"flowDaemons": "已连接的 daemon",
|
||||
"flowOpenSession": "在 Paseo 中打开实时会话",
|
||||
"exploreCta": "了解 Paseo Hub",
|
||||
"docsCta": "自托管文档"
|
||||
},
|
||||
"automation": {
|
||||
"title": "为自动化而生",
|
||||
"description": "使用 MCP、CLI 或 TypeScript SDK 自动化 Paseo",
|
||||
@@ -393,7 +415,9 @@
|
||||
"plan": "我会把它做成本地插件并安装。",
|
||||
"done": "审查队列已出现在你的侧边栏。",
|
||||
"panelTitle": "审查队列",
|
||||
"libraryTitle": "400 多个社区插件",
|
||||
"libraryTitle": "社区插件",
|
||||
"libraryTitleCount_one": "{{count}} 个社区插件",
|
||||
"libraryTitleCount_other": "{{count}} 个社区插件",
|
||||
"libraryDescription": "开发者用的是和你的 Agent 相同的插件 API",
|
||||
"browse": "浏览插件",
|
||||
"docs": "插件文档",
|
||||
@@ -580,25 +604,213 @@
|
||||
"reddit": "工作流与问答。"
|
||||
},
|
||||
"hub": {
|
||||
"metaTitle": "Paseo Hub - GitHub、Slack 和 Discord 触发器",
|
||||
"metaDescription": "自行运行 Paseo Hub,从 GitHub、Slack 和 Discord 在你自己的机器上启动 Agent。",
|
||||
"metaTitle": "Paseo Hub - 在你的机器上自动化运行 Agent",
|
||||
"metaDescription": "通过 GitHub、Linear、Slack、Discord、定时任务和 webhook,在你的 Paseo daemon 上自动运行 Agent。你可以自托管 Hub 或使用托管服务。",
|
||||
"title": "Paseo Hub",
|
||||
"intro": "一个可选服务,位于你的 daemon 之上,为它们提供额外能力。",
|
||||
"runIt": "可以自行运行,也可以使用托管服务。",
|
||||
"intro": "自动化运行编程 Agent,并与团队共享 daemon。每次运行都在你自己的机器上执行。",
|
||||
"runIt": "可基于 Apache 2.0 自托管运行,也可以使用托管服务。",
|
||||
"hero": {
|
||||
"getStarted": "开始使用",
|
||||
"selfHost": "自托管"
|
||||
},
|
||||
"eyebrows": {
|
||||
"architecture": "架构",
|
||||
"pricing": "定价"
|
||||
},
|
||||
"automations": {
|
||||
"title": "来自各类来源的自动化",
|
||||
"description": "触发器监听你各类工具中的事件,并在已连接的 daemon 上启动 Agent。"
|
||||
},
|
||||
"sources": {
|
||||
"github": {
|
||||
"name": "GitHub",
|
||||
"description": "Issue、PR 和评论。"
|
||||
},
|
||||
"linear": {
|
||||
"name": "Linear",
|
||||
"description": "Issue、分配和评论。"
|
||||
},
|
||||
"slack": {
|
||||
"name": "Slack",
|
||||
"description": "频道和讨论串中的提及。"
|
||||
},
|
||||
"discord": {
|
||||
"name": "Discord",
|
||||
"description": "频道和讨论串中的提及。"
|
||||
},
|
||||
"schedules": {
|
||||
"name": "定时任务",
|
||||
"description": "按你的时区定时运行。"
|
||||
},
|
||||
"webhooks": {
|
||||
"name": "Webhook",
|
||||
"description": "来自任意服务或脚本的事件。"
|
||||
}
|
||||
},
|
||||
"demo": {
|
||||
"shared": {
|
||||
"tablistLabel": "自动化来源预览",
|
||||
"openInPaseo": "在 Paseo 中打开",
|
||||
"testsPassed": "测试通过",
|
||||
"appBadge": "APP",
|
||||
"docsLink": "阅读 {{source}} 文档"
|
||||
},
|
||||
"slack": {
|
||||
"alt": "#engineering 中的 Slack 讨论串,展示 mo 提及 @paseo-bot 查看 P0 issue 并创建 PR",
|
||||
"searchPlaceholder": "搜索 Paseo",
|
||||
"channels": "频道",
|
||||
"apps": "应用",
|
||||
"channelTopic": "核心 daemon、移动端与 Hub",
|
||||
"threadReplies": "3 条回复",
|
||||
"typing": "paseo-bot 正在输入...",
|
||||
"composerPlaceholder": "回复...",
|
||||
"showIssues": "<mention/> 给我看看最新的 P0 issue",
|
||||
"issuesOpen": "目前有 3 个未关闭的 P0 issue:",
|
||||
"createPr": "<mention/> 为第一个创建一个 PR",
|
||||
"ranOn": "已在 <host>macbook-pro</host> 上继续运行。已创建 <pr>getpaseo/paseo#1234</pr>,修复了终端写入问题。",
|
||||
"filesChanged": "3 个文件已更改",
|
||||
"caption": "在同一讨论串中回复即可继续引导 Agent,或随时在 Paseo 中打开会话。"
|
||||
},
|
||||
"github": {
|
||||
"alt": "GitHub issue #2811,展示 mo 添加标签后 paseo-bot 创建 PR #2819 并通过全部检查",
|
||||
"issueTitle": "高负载下终端输出丢帧",
|
||||
"issueMeta": "于 14 分钟前创建此 issue · 2 条评论",
|
||||
"authorBadge": "Owner",
|
||||
"botBadge": "bot",
|
||||
"openedAgo": "14 分钟前",
|
||||
"repliedAgo": "9 分钟前",
|
||||
"issueBody": "PTY 缓冲区写满时,突发输出会丢失帧。<mention/> 复现这个问题并提交修复。",
|
||||
"addedLabel": "添加了标签",
|
||||
"startedOn": "paseo-bot 已在 macbook-pro 上启动",
|
||||
"botReply": "已在 <host>macbook-pro</host> 上通过 64 KB 突发测试复现,并创建 <pr>#2819</pr> 限制并排空写入队列。",
|
||||
"checksPassed": "全部 4 项检查已通过",
|
||||
"assignees": "负责人",
|
||||
"labels": "标签",
|
||||
"development": "开发关联",
|
||||
"daemon": "daemon",
|
||||
"caption": "添加 issue 标签或发表评论,即可在你的 daemon 上启动 Agent 并创建 PR。"
|
||||
},
|
||||
"linear": {
|
||||
"alt": "Linear issue PAS-418 分配给 paseo-bot 后在 devbox 上运行并关联 PR #2822",
|
||||
"issueTitle": "Android 休眠唤醒后中继陷入重连循环",
|
||||
"issueDescription": "手机从 Doze 模式唤醒后,中继套接字每 200ms 重试一次且没有退避。",
|
||||
"activity": "动态",
|
||||
"assignedEvent": "将此 issue 分配给了",
|
||||
"runningOn": "已在 <host>devbox</host> 上运行 · Codex",
|
||||
"traceLine": "已读取 relay/reconnect.ts,添加带抖动的退避和唤醒重置",
|
||||
"botSummary": "已在 <code>relay/reconnect.ts</code> 中添加指数退避与唤醒状态重置,并补充了回归测试。PR 已准备好等待审查。",
|
||||
"properties": "属性",
|
||||
"status": "状态",
|
||||
"priority": "优先级",
|
||||
"assignee": "负责人",
|
||||
"creator": "创建者",
|
||||
"labels": "标签",
|
||||
"daemon": "daemon",
|
||||
"caption": "将 issue 分配给 Agent,即可在你的 daemon 上运行修复并把 PR 关联回来。"
|
||||
},
|
||||
"discord": {
|
||||
"alt": "Discord 频道 #engineering,展示 mo 提及 @paseo-bot 后在讨论串中收到 PR #2825",
|
||||
"textChannels": "文字频道",
|
||||
"channelTopic": "daemon 与 CLI 工程",
|
||||
"threadTitle": "修复残留 worktree",
|
||||
"time1": "今天 10:12",
|
||||
"time2": "今天 10:16",
|
||||
"userPrompt": "<mention/> 修复 <issue/> 里残留 worktree 分支未清理的问题",
|
||||
"startedThread": "发起了讨论串:",
|
||||
"botStarted": "正在 <host>devbox</host> 上使用 OpenCode 运行,正在检查 worktree 关闭钩子。",
|
||||
"botFinished": "已在 Agent 工作区关闭时自动清理孤立分支,并添加了测试。",
|
||||
"fieldHost": "主机",
|
||||
"fieldDiff": "改动",
|
||||
"fieldChecks": "检查",
|
||||
"composerPlaceholder": "发送消息到 #engineering",
|
||||
"caption": "在频道中提及 @paseo-bot,即可在讨论串里启动 Agent 并回传结果。"
|
||||
},
|
||||
"schedules": {
|
||||
"alt": "每日 CI 优化定时任务在上午 7:00 于 devbox 上运行,创建 PR #2831 并在 Slack 发布摘要",
|
||||
"active": "运行中",
|
||||
"jobTitle": "每日 CI 优化",
|
||||
"cadence": "工作日 7:00 America/New_York",
|
||||
"step1Title": "定时运行 #42 分析了过去 24 小时的 CI",
|
||||
"step1Detail": "发现 <code>website-e2e</code> 有 18% 的概率不稳定,且冷启动 Rust 构建增加了 2m 40s。",
|
||||
"step2Title": "已在 devbox 上创建 PR",
|
||||
"metricRuntime": "平均耗时",
|
||||
"metricFlake": "e2e 不稳定率",
|
||||
"metricCache": "Cargo 缓存",
|
||||
"slackPosted": "已发送到 Slack",
|
||||
"slackSummary": "早间 CI 报告:将平均 workflow 耗时从 <strong>7m 12s</strong> 降至 <strong>4m 28s</strong>,并在 <pr>#2831</pr> 中修复了 e2e 不稳定问题。",
|
||||
"notifiedMo": "抄送 @mo",
|
||||
"caption": "按你的时区定时运行 Agent,自动创建 PR 并将摘要发送到 Slack。"
|
||||
},
|
||||
"webhooks": {
|
||||
"alt": "终端发送 webhook POST 请求。Hub 返回 202 Accepted 并在 devbox 上启动 Codex 运行。",
|
||||
"runMeta": "devbox · Codex · getpaseo/paseo",
|
||||
"statusDone": "已创建 PR",
|
||||
"trace1": "已在独立 worktree 中检出 <code>v0.19.4</code>",
|
||||
"trace2": "定位到 <code>ECONNRESET</code> 来自 <code>relay/server.ts</code> 的空闲 keepalive 超时",
|
||||
"trace3": "已创建 <pr/> 并附带修复与回归测试,全部检查已通过",
|
||||
"triggeredBy": "webhook · sentry-alert",
|
||||
"routedLine": "Hub 已路由到 devbox · 118ms",
|
||||
"caption": "从任意脚本或服务发送 POST 请求,即可立即在你的 daemon 上启动 Agent。"
|
||||
}
|
||||
},
|
||||
"authoring": {
|
||||
"title": "在仪表盘配置,或以代码方式部署",
|
||||
"description": "在浏览器中设置触发器,或将 YAML 文件提交到仓库并通过 CLI 部署。",
|
||||
"dashboardTitle": "仪表盘与运行活动",
|
||||
"dashboardDescription": "在浏览器中选择 daemon 和工作目录。配置触发器时,Hub 会检查该 daemon 提供哪些 Provider、模型和模式。",
|
||||
"triggersLabel": "触发器:",
|
||||
"triggersText": "在表单或 YAML 视图中创建、编辑或暂停自动化。",
|
||||
"validationLabel": "实时校验:",
|
||||
"validationText": "查看已连接的 daemon 提供的 Provider、模型和模式。",
|
||||
"activityLabel": "运行活动:",
|
||||
"activityText": "查看事件投递、路由结果、输出和错误。",
|
||||
"docsLink": "阅读配置文档"
|
||||
},
|
||||
"shape": {
|
||||
"title": "与团队共享,锁定在你的机器上",
|
||||
"description": "Hub 连接到你已在运行的 daemon。团队共享触发器与运行历史,你的代码留在你自己的机器上。",
|
||||
"triggersRow": "自动化来源",
|
||||
"webhooks": "webhook、提及与定时任务",
|
||||
"hub": "Hub",
|
||||
"hubHosting": "自托管或托管",
|
||||
"sameRpcs": "与应用和 CLI 相同的 RPC",
|
||||
"daemonsRow": "已连接的 daemon",
|
||||
"directOrRelay": "直连或端到端加密中继",
|
||||
"appsRow": "Paseo 客户端",
|
||||
"desktop": "桌面端",
|
||||
"web": "网页端",
|
||||
"mobile": "移动端",
|
||||
"cli": "CLI"
|
||||
},
|
||||
"guardrails": {
|
||||
"optInTitle": "主动授权执行",
|
||||
"optInDescription": "每个 daemon 的 <code>hub.execute</code> 权限默认关闭,按机器单独授予。",
|
||||
"scopedTitle": "受控触发范围",
|
||||
"scopedDescription": "事件触发器支持发送者白名单和资源过滤。你可以为每个步骤设置 GitHub 权限,也可以限制 Slack 和 Discord 工具的使用范围。",
|
||||
"visibilityTitle": "团队可见性",
|
||||
"visibilityDescription": "所有者、管理员和成员共享 daemon、触发器、运行历史和路由结果。"
|
||||
},
|
||||
"agents": {
|
||||
"title": "运行你已有的 Agent",
|
||||
"description": "Hub 会发现每个已连接的 Paseo daemon 上的 Provider。你可以运行 Claude Code、Codex、OpenCode、Pi 和自定义 Provider,包括插件提供的 Provider。"
|
||||
},
|
||||
"pricing": {
|
||||
"title": "选择 Hub 的运行方式",
|
||||
"unavailable": "方案对比暂时不可用。",
|
||||
"selfHost": "自托管 Hub",
|
||||
"title": "自托管或托管",
|
||||
"seatNote": "你可以按 Apache 2.0 许可自行运行开源 Hub,或使用托管服务。Hub 仪表盘成员和待接受的邀请都计入席位。",
|
||||
"unavailable": "托管方案对比暂时不可用。",
|
||||
"selfHost": "自托管文档",
|
||||
"selfHosted": "自托管",
|
||||
"free": "免费",
|
||||
"openSource": "/ 开源",
|
||||
"openSource": "/ Apache 2.0",
|
||||
"getStarted": "开始使用",
|
||||
"operateHub": "由你运营 Hub",
|
||||
"operateHub": "通过 <code>npx @getpaseo/hub</code> 或 Docker Compose 运行",
|
||||
"allSources": "GitHub、Linear、Slack、Discord、定时任务与 webhook",
|
||||
"managedSources": "GitHub、Linear、Slack、Discord、定时任务与 webhook",
|
||||
"ownApps": "由你创建和控制的 Provider 应用",
|
||||
"openSourceFeature": "开源",
|
||||
"openSourceFeature": "Apache 2.0 开源",
|
||||
"unlimitedRuns": "无限次 Agent 运行",
|
||||
"runsPerMonth": "每月 {{value}} 次 Agent 运行",
|
||||
"unlimitedUnits": "无限{{unit}}",
|
||||
"noSeatCap": "无席位上限",
|
||||
"units_one": "{{value}} 个{{unit}}",
|
||||
"units_other": "{{value}} 个{{unit}}",
|
||||
"perMonth": "/ 月",
|
||||
@@ -607,71 +819,32 @@
|
||||
"perUnitMonths": "每{{unit}} / {{count}} 个月",
|
||||
"seat": "席位"
|
||||
},
|
||||
"triggers": {
|
||||
"title": "触发器,运行在你的机器上",
|
||||
"description": "在 GitHub、Slack 或 Discord 中提及机器人,就会在你的 daemon 上启动一个 Agent。",
|
||||
"github": "Issue、PR 和代码审查。",
|
||||
"slack": "频道和讨论串。",
|
||||
"discord": "频道和讨论串。"
|
||||
},
|
||||
"demo": {
|
||||
"showIssues": "<mention/> 给我看看最新的 P0 issue",
|
||||
"issuesOpen": "目前有三个未关闭的 P0 issue:",
|
||||
"createPr": "<mention/> 为第一个创建一个拉取请求",
|
||||
"ranOn": "已在 <host>macbook-pro</host> 上运行。已创建 <pr>getpaseo/paseo#1234</pr>,修复了终端写入问题。",
|
||||
"filesChanged": "3 个文件已更改",
|
||||
"testsPassed": "测试通过",
|
||||
"bot": "机器人",
|
||||
"caption": "Agent 在你的 daemon 上运行,使用你的密钥。"
|
||||
},
|
||||
"agents": {
|
||||
"title": "运行你已有的 Agent",
|
||||
"description": "Hub 本身不附带任何 Agent,因此你的团队使用的是 daemon 上已配置好的 Provider、订阅和技能。"
|
||||
},
|
||||
"shape": {
|
||||
"title": "适配你现有的基础设施",
|
||||
"description": "Hub 连接到你已在运行的 daemon,你的应用也继续连接这些 daemon。",
|
||||
"triggersRow": "触发器和团队成员",
|
||||
"yourTeam": "你的团队",
|
||||
"futureIntegrations": "未来的集成",
|
||||
"webhooks": "webhook 和提及",
|
||||
"hub": "Hub",
|
||||
"hubHosting": "自托管或托管",
|
||||
"sameRpcs": "与应用和 CLI 相同的 RPC",
|
||||
"daemonsRow": "你的 daemon",
|
||||
"directOrRelay": "直连或中继",
|
||||
"appsRow": "Paseo 应用",
|
||||
"desktop": "桌面端",
|
||||
"web": "网页端",
|
||||
"mobile": "移动端",
|
||||
"cli": "CLI"
|
||||
},
|
||||
"faq": {
|
||||
"title": "常见问题",
|
||||
"whatQuestion": "Hub 是什么?",
|
||||
"whatAnswer": "一个独立的服务,位于你的 Paseo daemon 之上。你把一个或多个 daemon 连接到它,它就为这些 daemon 提供 GitHub、Slack 和 Discord 触发器,协作功能也在计划中。没有它,Paseo 也能完整工作。",
|
||||
"separateQuestion": "为什么它是独立服务,而不是 daemon 的一部分?",
|
||||
"separateAnswer1": "daemon 保持为单台机器上的一个精简可执行程序。Hub 通过与应用和 CLI 相同的 RPC 与 daemon 通信,所以任何人都可以基于 Paseo 构建自己的 hub。",
|
||||
"separateAnswer2": "它的职责也不同。Hub 需要暴露在互联网上、与团队共享,并以多租户方式运行。这些都不属于单机 daemon 的职责。",
|
||||
"whatQuestion": "Paseo Hub 是什么?",
|
||||
"whatAnswer": "Paseo Hub 是位于你的 Paseo daemon 之上的独立服务。连接一个或多个 daemon 后,可以通过 GitHub、Linear、Slack、Discord、定时任务和 webhook 自动化运行 Agent,并与团队共享。没有 Hub,Paseo 也能独立工作。",
|
||||
"separateQuestion": "为什么 Hub 是独立服务,而不是 daemon 的一部分?",
|
||||
"separateAnswer1": "daemon 保持为单台机器上的单一进程。Hub 通过与应用和 CLI 相同的 RPC 与 daemon 通信,所以任何人都可以基于 Paseo 构建自己的服务。",
|
||||
"separateAnswer2": "Hub 的职责也不同。它接收公网 webhook、管理团队访问并以多租户方式运行,这些都不属于单机 daemon。",
|
||||
"selfHostQuestion": "我可以自己运行吗?",
|
||||
"selfHostAnswer": "可以。运行 <code>npx @getpaseo/hub</code>,然后在浏览器中完成设置。源代码在 <github>GitHub</github> 上,更复杂的部署请参阅<guide>自托管指南</guide>。",
|
||||
"selfHostAnswer": "可以。运行 <code>npx @getpaseo/hub</code> 或使用 Docker Compose 启动,然后在浏览器中完成设置。Apache 2.0 源代码在 <github>GitHub</github> 上,生产部署请参阅<guide>自托管指南</guide>。",
|
||||
"needQuestion": "运行它需要什么?",
|
||||
"needAnswer": "Node.js 和一个正在运行的 Paseo daemon。Hub 会引导你连接需要的 Provider 应用。",
|
||||
"needAnswer": "需要 Node.js 或 Docker,以及一个正在运行的 Paseo daemon。Hub 会引导你连接 daemon 和 Provider 应用。",
|
||||
"hostedQuestion": "有托管版本吗?",
|
||||
"hostedAnswer": "有。托管服务运行的就是你可以自托管的同一套 Hub 软件。",
|
||||
"plannedQuestion": "还计划了什么?",
|
||||
"plannedIntro": "以下尚未实现,列出来是为了让你了解方向。",
|
||||
"plannedProvisioning": "为团队预配 daemon",
|
||||
"plannedSharing": "在团队内共享设置和技能",
|
||||
"plannedIntegrations": "更多集成",
|
||||
"moveQuestion": "我需要把团队迁移到新工具吗?",
|
||||
"moveAnswer": "不需要。Hub 在你团队已在使用的 Slack 或 Discord 中工作,运行在你已有的 daemon 上。工作变得复杂时,你可以在同样的 daemon 上切换到 Paseo 应用。",
|
||||
"agentsQuestion": "它运行哪些 Agent?",
|
||||
"agentsAnswer": "你的 daemon 上配置了哪些就运行哪些,使用你自己的订阅和技能。Hub 本身不附带任何 Agent。",
|
||||
"hostedAnswer": "有。<hosted>托管服务</hosted>运行的就是你可以自托管的同一套开源 Hub 软件。Hub 仪表盘成员和待接受的邀请都计入席位。",
|
||||
"codeQuestion": "Hub 能在我的机器上运行代码吗?",
|
||||
"codeAnswer": "能,但仅限于你连接到它的 daemon,其他地方都不行。这正是触发器的意义,也是测试版访问范围保持小而可信的原因。",
|
||||
"accessQuestion": "如何获得访问权限?",
|
||||
"accessAnswer": "你现在就可以自托管,或<hosted>登录托管版 Hub</hosted> 获取免费账户。需要更多 Agent 运行次数或更多席位时,可在 Hub 内的账单页面升级。"
|
||||
"codeAnswer": "只能在授予了 <code>hub.execute</code> 权限的 daemon 上运行。注册 daemon 默认不会开启执行权限,你可以随时在本机撤销该权限。",
|
||||
"moveQuestion": "我需要把团队迁移到新工具吗?",
|
||||
"moveAnswer": "不需要。Hub 通过 GitHub、Linear、Slack、Discord、定时任务和 webhook 在你已有的 daemon 上运行。需要直接查看或引导运行时,在桌面端或移动端的 Paseo 中打开实时会话即可。",
|
||||
"agentsQuestion": "它运行哪些 Agent?",
|
||||
"agentsAnswer": "Hub 运行已连接的 Paseo daemon 上配置的 Provider,包括插件提供的自定义 Provider。Agent 使用这些机器上的订阅、模型和技能。",
|
||||
"plannedQuestion": "还计划了什么?",
|
||||
"plannedIntro": "以下能力尚未实现,列出来是为了让你了解 Hub 的方向。",
|
||||
"plannedProvisioning": "为团队预配远程 daemon",
|
||||
"plannedSharing": "在团队内共享设置和技能",
|
||||
"plannedIntegrations": "更多 Provider 集成",
|
||||
"accessQuestion": "如何开始使用?",
|
||||
"accessAnswer": "运行 <code>npx @getpaseo/hub</code> 自托管 Hub,或<hosted>登录托管版 Hub</hosted> 获取免费账户。需要更多运行次数或席位时,可在 Hub 内的账单页面升级。"
|
||||
}
|
||||
},
|
||||
"changelog": {
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export * from "./registry";
|
||||
export { getRegistry, getRegistryPlugin } from "./loader";
|
||||
export { getPluginCount, getRegistry, getRegistryPlugin } from "./loader";
|
||||
|
||||
@@ -3,6 +3,7 @@ import { env } from "cloudflare:workers";
|
||||
import { getWebsiteCacheContext } from "~/cloudflare-cache";
|
||||
import {
|
||||
loadInstallCounts,
|
||||
loadPluginCount,
|
||||
loadRegistryIndex,
|
||||
loadRegistryPlugin,
|
||||
type RegistryEnvironment,
|
||||
@@ -28,3 +29,8 @@ export const getRegistry = createServerFn({ method: "GET" }).handler(async () =>
|
||||
export const getRegistryPlugin = createServerFn({ method: "GET" })
|
||||
.validator((id: string) => id)
|
||||
.handler(({ data }) => loadRegistryPlugin(registryBase(), data, getWebsiteCacheContext()));
|
||||
|
||||
/** Listed plugin count from the cached registry index. */
|
||||
export const getPluginCount = createServerFn({ method: "GET" }).handler(() =>
|
||||
loadPluginCount(registryBase(), getWebsiteCacheContext()),
|
||||
);
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
useState,
|
||||
} from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { MOBILE_PAGE_BLEED_CLASS } from "~/components/page-frame";
|
||||
|
||||
const TILE_CLASS =
|
||||
"relative block aspect-video w-[85%] flex-shrink-0 overflow-hidden rounded-xl border border-white/10 bg-white/[0.03] sm:w-[60%]";
|
||||
@@ -80,7 +81,9 @@ export function MediaGallery({ name, media }: { name: string; media: string[] })
|
||||
const tileClass = items.length > 2 ? PEEKING_TILE_CLASS : FILLING_TILE_CLASS;
|
||||
return (
|
||||
<>
|
||||
<div className="-mx-6 mt-10 flex gap-3 overflow-x-auto px-6 md:mx-0 md:px-0">
|
||||
<div
|
||||
className={`${MOBILE_PAGE_BLEED_CLASS} mt-10 flex gap-3 overflow-x-auto sm:-mx-8 sm:px-8 md:mx-0 md:px-0`}
|
||||
>
|
||||
{entries.map((entry) =>
|
||||
typeof entry === "string" ? (
|
||||
<p key={entry}>{entry}</p>
|
||||
|
||||
@@ -5,7 +5,11 @@ import {
|
||||
} from "@getpaseo/protocol/plugin-registry";
|
||||
import { languageAlternates, LOCALES, localizePath } from "~/i18n";
|
||||
import { SITE_ORIGIN } from "~/meta";
|
||||
import { getBlockingColdCache, type WebsiteCacheContext } from "../github-cache";
|
||||
import {
|
||||
getBlockingColdCache,
|
||||
getNonBlockingColdCache,
|
||||
type WebsiteCacheContext,
|
||||
} from "../github-cache";
|
||||
import { handlePluginThumbnailRequest } from "./thumbnails";
|
||||
import { CATEGORIES } from "./categories";
|
||||
import { type InstallCounts, readInstallCounts, recordClientInstall } from "./installs";
|
||||
@@ -19,14 +23,29 @@ async function documentAt(base: string, path: string): Promise<unknown> {
|
||||
if (!response.ok) throw new Error(`Plugin registry returned ${response.status}`);
|
||||
return response.json();
|
||||
}
|
||||
export function loadRegistryIndex(base: string, context: WebsiteCacheContext) {
|
||||
return getBlockingColdCache({
|
||||
function registryIndexCache(base: string, context: WebsiteCacheContext) {
|
||||
return {
|
||||
context,
|
||||
key: `plugins:index:v1:${base}`,
|
||||
isValue: (value): value is ReturnType<typeof PluginRegistryIndexSchema.parse> =>
|
||||
isValue: (value: unknown): value is ReturnType<typeof PluginRegistryIndexSchema.parse> =>
|
||||
PluginRegistryIndexSchema.safeParse(value).success,
|
||||
fetchFresh: async () => PluginRegistryIndexSchema.parse(await documentAt(base, "index.json")),
|
||||
});
|
||||
};
|
||||
}
|
||||
export function loadRegistryIndex(base: string, context: WebsiteCacheContext) {
|
||||
return getBlockingColdCache(registryIndexCache(base, context));
|
||||
}
|
||||
/** Count of listed plugins from the cached registry index. */
|
||||
export async function loadPluginCount(
|
||||
base: string,
|
||||
context: WebsiteCacheContext,
|
||||
): Promise<number | null> {
|
||||
try {
|
||||
const index = await getNonBlockingColdCache(registryIndexCache(base, context));
|
||||
return index?.plugins.length ?? null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/** Install counts per window for every listed plugin, refreshed with the index cache. */
|
||||
export async function loadInstallCounts(base: string, context: WebsiteCacheContext) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createHash } from "node:crypto";
|
||||
import { createServer } from "node:http";
|
||||
import { createServer, type ServerResponse } from "node:http";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getTranslator } from "~/i18n";
|
||||
import {
|
||||
@@ -19,7 +19,12 @@ import {
|
||||
updatedAgo,
|
||||
} from "./registry";
|
||||
import { readInstallCounts, recordInstall } from "./installs";
|
||||
import { handlePluginRegistryRequest, loadRegistryIndex, loadRegistryPlugin } from "./published";
|
||||
import {
|
||||
handlePluginRegistryRequest,
|
||||
loadPluginCount,
|
||||
loadRegistryIndex,
|
||||
loadRegistryPlugin,
|
||||
} from "./published";
|
||||
const plugin: Plugin = {
|
||||
id: "acme/example",
|
||||
name: "Example",
|
||||
@@ -372,6 +377,63 @@ describe("plugin registry", () => {
|
||||
expect(at("https://gitlab.com/acme/example")).toBeUndefined();
|
||||
expect(at("javascript:alert(1)")).toBeUndefined();
|
||||
});
|
||||
|
||||
it("reads the listed plugin count from the registry index and falls back to null on errors", async () => {
|
||||
const context = { cache: seededIndex(), waitUntil: () => undefined };
|
||||
expect(await loadPluginCount("https://registry.example.test", context)).toBe(1);
|
||||
|
||||
const server = createServer((_request, response) => {
|
||||
response.statusCode = 503;
|
||||
response.end("unavailable");
|
||||
});
|
||||
await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve));
|
||||
const address = server.address();
|
||||
if (!address || typeof address === "string") throw new Error("Expected numeric port");
|
||||
try {
|
||||
const count = await loadPluginCount(`http://127.0.0.1:${address.port}`, {
|
||||
cache: memoryKv(),
|
||||
waitUntil: () => undefined,
|
||||
});
|
||||
expect(count).toBeNull();
|
||||
} finally {
|
||||
server.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("returns a cold landing-page count before the registry responds and warms the shared index", async () => {
|
||||
const index = {
|
||||
schemaVersion: 1,
|
||||
registry: { name: "Test", url: "https://registry.example.test" },
|
||||
categories: [],
|
||||
plugins: [plugin],
|
||||
featured: [],
|
||||
generatedAt: "2026-10-03",
|
||||
};
|
||||
const server = createServer();
|
||||
const requested = new Promise<ServerResponse>((resolve) => {
|
||||
server.once("request", (_request, response) => resolve(response));
|
||||
});
|
||||
await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve));
|
||||
const address = server.address();
|
||||
if (!address || typeof address === "string") throw new Error("Expected numeric port");
|
||||
const base = `http://127.0.0.1:${address.port}`;
|
||||
const pending: Promise<unknown>[] = [];
|
||||
const context = {
|
||||
cache: memoryKv(),
|
||||
waitUntil: (promise: Promise<unknown>) => pending.push(promise),
|
||||
};
|
||||
const count = loadPluginCount(base, context);
|
||||
try {
|
||||
expect(await Promise.race([count, requested.then(() => "waiting on registry")])).toBeNull();
|
||||
const response = await requested;
|
||||
response.end(JSON.stringify(index));
|
||||
await Promise.all(pending);
|
||||
expect(await loadPluginCount(base, context)).toBe(1);
|
||||
} finally {
|
||||
server.closeAllConnections();
|
||||
await new Promise<void>((resolve) => server.close(() => resolve()));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/** A cache holding a fresh registry index with `plugin`, so no request reaches the registry. */
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import { Check, CircleHelp } from "lucide-react";
|
||||
import {
|
||||
ArrowRight,
|
||||
Check,
|
||||
CircleHelp,
|
||||
Filter,
|
||||
ShieldCheck,
|
||||
SlidersHorizontal,
|
||||
Users,
|
||||
} from "lucide-react";
|
||||
import * as React from "react";
|
||||
import type { ReactNode } from "react";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import type { TFunction } from "i18next";
|
||||
import {
|
||||
ClaudeCodeIcon,
|
||||
CodexIcon,
|
||||
CursorIcon,
|
||||
OpenCodeIcon,
|
||||
PiIcon,
|
||||
} from "~/components/agent-icons";
|
||||
import { DiscordIcon, GitHubIcon, SlackIcon } from "~/components/brand-icons";
|
||||
import { HubLockup, PaseoHubLockup, PaseoHubMark } from "~/components/paseo-brand";
|
||||
import { AGENT_PAGES } from "~/data/agent-pages";
|
||||
import { FAQItem } from "~/components/faq-item";
|
||||
import { SiteShell } from "~/components/site-shell";
|
||||
import { HubAutomationsShowcase } from "~/components/hub-automations";
|
||||
import { HUB_AGENT_HARNESSES, HubArchitectureDiagram } from "~/components/hub-flow";
|
||||
import { ChapterBand, HairlineGrid, PageHeaderBand, SectionOpener } from "~/components/page-frame";
|
||||
import { PaseoHubLockup } from "~/components/paseo-brand";
|
||||
import { SiteFooter } from "~/components/site-footer";
|
||||
import {
|
||||
billingUnitLabel,
|
||||
formatPlanPrice,
|
||||
@@ -58,68 +60,340 @@ export const Route = createFileRoute("/{-$locale}/hub")({
|
||||
const HOSTED_HUB_URL = "https://hub.paseo.sh";
|
||||
|
||||
const LINK_CLASS = "underline hover:text-white/80";
|
||||
const PRIMARY_CTA_CLASS =
|
||||
"inline-flex items-center justify-center gap-2 rounded-lg bg-foreground px-4 py-2.5 text-sm font-medium text-background transition-colors hover:bg-foreground/90";
|
||||
const SECONDARY_CTA_CLASS =
|
||||
"inline-flex items-center justify-center gap-2 rounded-lg border border-white/12 px-4 py-2.5 text-sm text-white/85 transition-colors hover:bg-white/10 hover:text-white";
|
||||
|
||||
function Hub() {
|
||||
const { t } = useTranslation();
|
||||
const { plans } = Route.useLoaderData();
|
||||
return (
|
||||
<SiteShell width="default">
|
||||
<h1 className="mb-5">
|
||||
<PaseoHubLockup className="h-9 md:h-10 w-auto text-foreground" />
|
||||
<div className="min-h-screen bg-background">
|
||||
<PageHeaderBand />
|
||||
<main>
|
||||
<ChapterBand spacing="hero" ruled={false} ticks={false} framed={false}>
|
||||
<HubHero />
|
||||
</ChapterBand>
|
||||
|
||||
<ChapterBand spacing="section">
|
||||
<AutomationsSection />
|
||||
</ChapterBand>
|
||||
|
||||
<ChapterBand spacing="section">
|
||||
<AuthoringSection />
|
||||
</ChapterBand>
|
||||
|
||||
<ChapterBand spacing="section">
|
||||
<InfrastructureSection />
|
||||
</ChapterBand>
|
||||
|
||||
<ChapterBand spacing="compact">
|
||||
<AgentsSection />
|
||||
</ChapterBand>
|
||||
|
||||
<ChapterBand spacing="section" tint="subtle">
|
||||
<PricingSection plans={plans} />
|
||||
</ChapterBand>
|
||||
|
||||
<ChapterBand spacing="section">
|
||||
<FaqSection />
|
||||
</ChapterBand>
|
||||
</main>
|
||||
<SiteFooter width="default" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function HubHero() {
|
||||
const { t } = useTranslation();
|
||||
const localize = useLocalizePath();
|
||||
return (
|
||||
<header className="space-y-6">
|
||||
<h1>
|
||||
<PaseoHubLockup size="display" className="h-10 w-auto text-foreground md:h-12" />
|
||||
<span className="sr-only">{t("hub.title")}</span>
|
||||
</h1>
|
||||
<p className="text-lg text-white/70 leading-relaxed max-w-2xl">{t("hub.intro")}</p>
|
||||
<p className="text-white/40 text-sm mt-3">{t("hub.runIt")}</p>
|
||||
|
||||
<div className="space-y-20 mt-16">
|
||||
<Triggers />
|
||||
<Agents />
|
||||
<Shape />
|
||||
<Pricing plans={plans} />
|
||||
<FaqSection />
|
||||
<p className="max-w-2xl text-lg leading-relaxed text-white/70">{t("hub.intro")}</p>
|
||||
<div className="flex flex-wrap items-center gap-3 pt-1">
|
||||
<a href={HOSTED_HUB_URL} className={PRIMARY_CTA_CLASS}>
|
||||
{t("hub.hero.getStarted")}
|
||||
<ArrowRight className="h-4 w-4" aria-hidden="true" />
|
||||
</a>
|
||||
<a href={localize("/docs/hub")} className={SECONDARY_CTA_CLASS}>
|
||||
{t("hub.hero.selfHost")}
|
||||
</a>
|
||||
</div>
|
||||
</SiteShell>
|
||||
<p className="text-sm text-white/45">{t("hub.runIt")}</p>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
function AutomationsSection() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<section aria-labelledby="automations-heading">
|
||||
<SectionOpener
|
||||
headingId="automations-heading"
|
||||
title={t("hub.automations.title")}
|
||||
description={t("hub.automations.description")}
|
||||
/>
|
||||
<HubAutomationsShowcase />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
const DASHBOARD_ITEMS = ["triggers", "validation", "activity"] as const;
|
||||
|
||||
function AuthoringSection() {
|
||||
const { t } = useTranslation();
|
||||
const localize = useLocalizePath();
|
||||
return (
|
||||
<section aria-labelledby="authoring-heading">
|
||||
<SectionOpener
|
||||
headingId="authoring-heading"
|
||||
title={t("hub.authoring.title")}
|
||||
description={t("hub.authoring.description")}
|
||||
/>
|
||||
|
||||
<HairlineGrid columns="2">
|
||||
<AuthoringDashboardCard docsHref={localize("/docs/hub/configuration")} />
|
||||
<AuthoringYamlCard />
|
||||
</HairlineGrid>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
function AuthoringDashboardCard({ docsHref }: { docsHref: string }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="flex flex-col justify-between gap-6 bg-background p-6">
|
||||
<div className="space-y-5">
|
||||
<div className="flex items-center gap-2.5">
|
||||
<SlidersHorizontal className="h-4 w-4 text-accent-text" strokeWidth={1.5} />
|
||||
<h3 className="text-base font-medium text-white/90">
|
||||
{t("hub.authoring.dashboardTitle")}
|
||||
</h3>
|
||||
</div>
|
||||
<p className="text-sm leading-relaxed text-white/65">
|
||||
{t("hub.authoring.dashboardDescription")}
|
||||
</p>
|
||||
<ul className="space-y-3 border-t border-white/[0.08] pt-4">
|
||||
{DASHBOARD_ITEMS.map((item) => (
|
||||
<li key={item} className="flex items-start gap-2.5 text-sm">
|
||||
<Check aria-hidden="true" className="mt-0.5 size-4 shrink-0 text-accent-text" />
|
||||
<span className="text-white/75">
|
||||
<span className="font-medium text-white/90">{t(`hub.authoring.${item}Label`)}</span>{" "}
|
||||
<span className="text-white/55">{t(`hub.authoring.${item}Text`)}</span>
|
||||
</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<a
|
||||
href={docsHref}
|
||||
className="inline-flex items-center gap-1.5 text-sm text-white/75 transition-colors hover:text-accent-text"
|
||||
>
|
||||
{t("hub.authoring.docsLink")}
|
||||
<ArrowRight className="h-3.5 w-3.5" aria-hidden="true" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function AuthoringYamlCard() {
|
||||
return (
|
||||
<div className="flex flex-col bg-[#0c1110]">
|
||||
<div className="flex items-center justify-between border-b border-white/[0.08] bg-white/[0.02] px-5 py-3">
|
||||
<span className="font-mono text-xs text-white/70">.paseo/triggers/slack-help.yml</span>
|
||||
<span className="rounded border border-white/10 px-1.5 py-0.5 font-mono text-[10px] text-white/40">
|
||||
YAML
|
||||
</span>
|
||||
</div>
|
||||
<pre className="flex-1 overflow-x-auto p-5 font-mono text-[12px] leading-6 text-white/75">
|
||||
<YamlLine k="name" v="slack-help" />
|
||||
<YamlKey k="on" />
|
||||
<YamlKey k="slack.mention" indent={2} />
|
||||
<YamlLine k="connection" v="acme-slack" indent={4} />
|
||||
<YamlKey k="filters" indent={4} />
|
||||
<YamlLine k="from_users" v="[U01234567]" indent={6} />
|
||||
<YamlKey k="run" />
|
||||
<YamlKey k="target" indent={2} />
|
||||
<YamlLine k="daemon" v="devbox" indent={4} />
|
||||
<YamlLine k="cwd" v="/workspace/app" indent={4} />
|
||||
<YamlKey k="agent" indent={2} />
|
||||
<YamlLine k="provider" v="codex" indent={4} />
|
||||
<YamlLine k="mode" v="full-access" indent={4} />
|
||||
<YamlLine k="continuation" v="{ mode: conversation }" indent={2} />
|
||||
<YamlLine k="prompt" v="|" indent={2} />
|
||||
<span className="block text-emerald-300/80">
|
||||
{" Answer with hub.reply, then call hub.finish_execution."}
|
||||
</span>
|
||||
<span className="block text-emerald-300/80">{" <user-prompt>"}</span>
|
||||
<span className="block text-emerald-300/80">{" ${{ paseo.prompt }}"}</span>
|
||||
<span className="block text-emerald-300/80">{" </user-prompt>"}</span>
|
||||
<YamlKey k="outputs" indent={2} />
|
||||
<YamlKey k="slack.reply" indent={4} />
|
||||
<YamlLine k="max" v="1" indent={6} />
|
||||
<YamlLine k="required" v="true" indent={6} />
|
||||
</pre>
|
||||
<div className="space-y-1 border-t border-white/[0.08] bg-white/[0.02] px-5 py-3.5 font-mono text-xs text-white/65">
|
||||
<div>
|
||||
<span className="select-none text-white/30">$ </span>
|
||||
<span className="text-white/90">paseo hub deploy</span>{" "}
|
||||
<span className="text-sky-300/80">--dry-run</span>
|
||||
</div>
|
||||
<div>
|
||||
<span className="select-none text-white/30">$ </span>
|
||||
<span className="text-white/90">paseo hub deploy</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function YamlKey({ k, indent = 0 }: { k: string; indent?: number }) {
|
||||
return (
|
||||
<span className="block">
|
||||
{" ".repeat(indent)}
|
||||
<span className="text-sky-300/80">{k}</span>
|
||||
<span className="text-white/35">:</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
function YamlLine({ k, v, indent = 0 }: { k: string; v: string; indent?: number }) {
|
||||
return (
|
||||
<span className="block">
|
||||
{" ".repeat(indent)}
|
||||
<span className="text-sky-300/80">{k}</span>
|
||||
<span className="text-white/35">: </span>
|
||||
<span className="text-emerald-300/80">{v}</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
const GUARDRAILS = [
|
||||
{ key: "optIn", Icon: ShieldCheck },
|
||||
{ key: "scoped", Icon: Filter },
|
||||
{ key: "visibility", Icon: Users },
|
||||
] as const;
|
||||
|
||||
const GUARDRAIL_CODE_COMPONENTS = {
|
||||
code: <code className="font-mono text-xs text-white/80" />,
|
||||
};
|
||||
|
||||
function InfrastructureSection() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<section aria-labelledby="infrastructure-heading">
|
||||
<SectionOpener
|
||||
eyebrow={t("hub.eyebrows.architecture")}
|
||||
headingId="infrastructure-heading"
|
||||
title={t("hub.shape.title")}
|
||||
description={t("hub.shape.description")}
|
||||
/>
|
||||
|
||||
<div className="space-y-6">
|
||||
<HubArchitectureDiagram />
|
||||
|
||||
<HairlineGrid columns="3">
|
||||
{GUARDRAILS.map(({ key, Icon }) => (
|
||||
<div key={key} className="space-y-2.5 bg-background p-6">
|
||||
<div className="flex items-center gap-2.5">
|
||||
<Icon className="h-4 w-4 shrink-0 text-accent-text" strokeWidth={1.5} />
|
||||
<h3 className="text-sm font-medium text-white/90">
|
||||
{t(`hub.guardrails.${key}Title`)}
|
||||
</h3>
|
||||
</div>
|
||||
<p className="text-sm leading-relaxed text-white/60">
|
||||
<Trans
|
||||
i18nKey={`hub.guardrails.${key}Description`}
|
||||
components={GUARDRAIL_CODE_COMPONENTS}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
))}
|
||||
</HairlineGrid>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
function AgentsSection() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<section aria-labelledby="agents-heading">
|
||||
<SectionOpener
|
||||
headingId="agents-heading"
|
||||
title={t("hub.agents.title")}
|
||||
description={t("hub.agents.description")}
|
||||
/>
|
||||
<HairlineGrid columns="3">
|
||||
{HUB_AGENT_HARNESSES.map(({ name, Icon }) => (
|
||||
<div key={name} className="flex items-center gap-3 bg-background px-5 py-4">
|
||||
<span className="text-white/80">
|
||||
<Icon className="h-5 w-5" />
|
||||
</span>
|
||||
<span className="text-sm font-medium text-white/90">{name}</span>
|
||||
</div>
|
||||
))}
|
||||
</HairlineGrid>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
interface PlanFeature {
|
||||
key: string;
|
||||
label: string;
|
||||
label: ReactNode;
|
||||
tooltip: string | null;
|
||||
}
|
||||
|
||||
const SELF_HOSTED_FEATURES = [
|
||||
{ key: "operate-hub", labelKey: "operateHub" },
|
||||
{ key: "own-apps", labelKey: "ownApps" },
|
||||
{ key: "open-source", labelKey: "openSourceFeature" },
|
||||
] as const;
|
||||
const PRICING_CODE_COMPONENTS = {
|
||||
code: <code className="font-mono text-xs text-white/85" />,
|
||||
};
|
||||
|
||||
function Pricing({ plans }: { plans: HubPlans | null }) {
|
||||
function PricingSection({ plans }: { plans: HubPlans | null }) {
|
||||
const { t } = useTranslation();
|
||||
const locale = useLocale();
|
||||
const localize = useLocalizePath();
|
||||
const selfHostedFeatures = React.useMemo(
|
||||
() =>
|
||||
SELF_HOSTED_FEATURES.map((feature) => ({
|
||||
key: feature.key,
|
||||
label: t(`hub.pricing.${feature.labelKey}`),
|
||||
const selfHostedFeatures = React.useMemo<readonly PlanFeature[]>(
|
||||
() => [
|
||||
{
|
||||
key: "operate-hub",
|
||||
label: <Trans i18nKey="hub.pricing.operateHub" components={PRICING_CODE_COMPONENTS} />,
|
||||
tooltip: null,
|
||||
})),
|
||||
},
|
||||
{
|
||||
key: "all-sources",
|
||||
label: t("hub.pricing.allSources"),
|
||||
tooltip: null,
|
||||
},
|
||||
{
|
||||
key: "own-apps",
|
||||
label: t("hub.pricing.ownApps"),
|
||||
tooltip: null,
|
||||
},
|
||||
{
|
||||
key: "open-source",
|
||||
label: t("hub.pricing.openSourceFeature"),
|
||||
tooltip: null,
|
||||
},
|
||||
],
|
||||
[t],
|
||||
);
|
||||
|
||||
if (plans === null) {
|
||||
return (
|
||||
<section className="space-y-6" aria-labelledby="pricing-heading">
|
||||
<div className="space-y-2">
|
||||
<h2 id="pricing-heading" className="text-xl font-medium">
|
||||
{t("hub.pricing.title")}
|
||||
</h2>
|
||||
<p className="max-w-2xl leading-relaxed text-white/70">{t("hub.pricing.unavailable")}</p>
|
||||
</div>
|
||||
<a
|
||||
href={localize("/docs/hub/quickstart")}
|
||||
className="inline-block rounded-md border border-white/15 px-4 py-2 text-sm font-medium text-white/80 transition-colors hover:border-white/25 hover:text-white"
|
||||
>
|
||||
<section aria-labelledby="pricing-heading">
|
||||
<SectionOpener
|
||||
eyebrow={t("hub.eyebrows.pricing")}
|
||||
headingId="pricing-heading"
|
||||
title={t("hub.pricing.title")}
|
||||
description={t("hub.pricing.unavailable")}
|
||||
/>
|
||||
<a href={localize("/docs/hub/self-hosting")} className={SECONDARY_CTA_CLASS}>
|
||||
{t("hub.pricing.selfHost")}
|
||||
</a>
|
||||
</section>
|
||||
@@ -127,18 +401,21 @@ function Pricing({ plans }: { plans: HubPlans | null }) {
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="space-y-6" aria-labelledby="pricing-heading">
|
||||
<h2 id="pricing-heading" className="text-xl font-medium">
|
||||
{t("hub.pricing.title")}
|
||||
</h2>
|
||||
<div className="grid gap-4 md:grid-cols-3">
|
||||
<section aria-labelledby="pricing-heading">
|
||||
<SectionOpener
|
||||
eyebrow={t("hub.eyebrows.pricing")}
|
||||
headingId="pricing-heading"
|
||||
title={t("hub.pricing.title")}
|
||||
description={t("hub.pricing.seatNote")}
|
||||
/>
|
||||
<HairlineGrid columns="3" clipContents={false}>
|
||||
<PlanCard
|
||||
name={t("hub.pricing.selfHosted")}
|
||||
price={t("hub.pricing.free")}
|
||||
priceQualifier={t("hub.pricing.openSource")}
|
||||
priceTooltip={null}
|
||||
features={selfHostedFeatures}
|
||||
actionHref={localize("/docs/hub/quickstart")}
|
||||
actionHref={localize("/docs/hub/self-hosting")}
|
||||
actionLabel={t("hub.pricing.selfHost")}
|
||||
/>
|
||||
<PlanCard
|
||||
@@ -160,14 +437,15 @@ function Pricing({ plans }: { plans: HubPlans | null }) {
|
||||
actionLabel={t("hub.pricing.getStarted")}
|
||||
featured
|
||||
/>
|
||||
</div>
|
||||
</HairlineGrid>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The figures the plan includes, ahead of the prose the catalog wrote for it. Hub serves plan
|
||||
* names, feature labels and tooltips in English, so those show as the catalog wrote them.
|
||||
* names, feature labels and tooltips in English, so those show as the catalog wrote them, except
|
||||
* the trigger summary key which maps to the current source list on this site.
|
||||
*/
|
||||
function planFeatures(plan: HubPlanOffer, t: TFunction, locale: Locale): readonly PlanFeature[] {
|
||||
return [
|
||||
@@ -181,7 +459,10 @@ function planFeatures(plan: HubPlanOffer, t: TFunction, locale: Locale): readonl
|
||||
label: formatSeats(plan.included.seats, billingUnitLabel(plan, t), t, locale),
|
||||
tooltip: null,
|
||||
},
|
||||
...plan.features,
|
||||
...plan.features.map((feature) => ({
|
||||
...feature,
|
||||
label: feature.key === "managed-triggers" ? t("hub.pricing.managedSources") : feature.label,
|
||||
})),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -194,7 +475,7 @@ function formatAllowance(executionsPerMonth: number | null, t: TFunction, locale
|
||||
}
|
||||
|
||||
function formatSeats(seats: number | null, unit: string, t: TFunction, locale: Locale): string {
|
||||
if (seats === null) return t("hub.pricing.unlimitedUnits", { unit });
|
||||
if (seats === null) return t("hub.pricing.noSeatCap");
|
||||
return t("hub.pricing.units", { count: seats, value: formatNumber(seats, locale), unit });
|
||||
}
|
||||
|
||||
@@ -219,30 +500,34 @@ function PlanCard({
|
||||
}) {
|
||||
return (
|
||||
<article
|
||||
className={`flex flex-col rounded-2xl border p-6 ${featured ? "border-white/25 bg-white/[0.06]" : "border-white/10 bg-white/[0.02]"}`}
|
||||
className={`flex flex-col p-6 first:rounded-t-[inherit] last:rounded-b-[inherit] md:p-7 md:first:rounded-tr-none md:first:rounded-bl-[inherit] md:last:rounded-tr-[inherit] md:last:rounded-bl-none ${featured ? "bg-brand-green/[0.08]" : "bg-background"}`}
|
||||
>
|
||||
<h3 className="text-xl font-medium">{name}</h3>
|
||||
<div className="mt-6 flex items-end gap-2">
|
||||
<h3 className="text-lg font-medium text-white/90">{name}</h3>
|
||||
<div className="relative mt-5 flex items-end gap-2">
|
||||
<span className="text-4xl font-medium tracking-tight">{price}</span>
|
||||
<span className="mb-1 inline-flex items-center gap-1 text-sm text-white/45">
|
||||
{priceQualifier}
|
||||
{priceTooltip !== null && <InfoTip text={priceTooltip} />}
|
||||
{priceTooltip !== null ? <InfoTip text={priceTooltip} /> : null}
|
||||
</span>
|
||||
</div>
|
||||
{features.length > 0 && (
|
||||
{features.length > 0 ? (
|
||||
<ul className="mt-6 grid flex-1 content-start gap-3 text-sm text-white/70">
|
||||
{features.map((feature) => (
|
||||
<li key={feature.key} className="flex items-start gap-2.5">
|
||||
<Check aria-hidden="true" className="mt-0.5 size-4 shrink-0 text-emerald-300" />
|
||||
<li key={feature.key} className="relative flex items-start gap-2.5">
|
||||
<Check aria-hidden="true" className="mt-0.5 size-4 shrink-0 text-accent-text" />
|
||||
<span>{feature.label}</span>
|
||||
{feature.tooltip !== null && <InfoTip text={feature.tooltip} />}
|
||||
{feature.tooltip !== null ? <InfoTip text={feature.tooltip} /> : null}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
) : null}
|
||||
<a
|
||||
href={actionHref}
|
||||
className={`rounded-md px-4 py-2 text-center text-sm font-medium transition-colors mt-8 ${featured ? "bg-white text-black hover:bg-white/90" : "border border-white/15 text-white/80 hover:border-white/25 hover:text-white"}`}
|
||||
className={`mt-8 rounded-lg px-4 py-2.5 text-center text-sm font-medium transition-colors ${
|
||||
featured
|
||||
? "bg-foreground text-background hover:bg-foreground/90"
|
||||
: "border border-white/15 text-white/85 hover:border-white/25 hover:bg-white/[0.04] hover:text-white"
|
||||
}`}
|
||||
>
|
||||
{actionLabel}
|
||||
</a>
|
||||
@@ -252,11 +537,11 @@ function PlanCard({
|
||||
|
||||
function InfoTip({ text }: { text: string }) {
|
||||
return (
|
||||
<span className="group relative inline-flex shrink-0" tabIndex={0}>
|
||||
<span className="group inline-flex shrink-0" tabIndex={0}>
|
||||
<CircleHelp aria-label={text} className="size-3.5 text-white/35" />
|
||||
<span
|
||||
role="tooltip"
|
||||
className="pointer-events-none absolute bottom-full left-1/2 z-10 mb-2 hidden w-56 -translate-x-1/2 rounded-md border border-white/10 bg-[#17201f] px-3 py-2 text-xs leading-relaxed text-white/75 shadow-xl group-hover:block group-focus:block"
|
||||
className="pointer-events-none absolute bottom-full left-0 z-10 mb-2 hidden w-full max-w-56 rounded-md border border-white/10 bg-[#17201f] px-3 py-2 text-xs leading-relaxed text-white/75 shadow-xl group-hover:block group-focus:block"
|
||||
>
|
||||
{text}
|
||||
</span>
|
||||
@@ -264,325 +549,15 @@ function InfoTip({ text }: { text: string }) {
|
||||
);
|
||||
}
|
||||
|
||||
const TRIGGER_SURFACES = [
|
||||
{ name: "GitHub", icon: <GitHubIcon className="h-6 w-6" />, body: "github" },
|
||||
{ name: "Slack", icon: <SlackIcon className="h-6 w-6" />, body: "slack" },
|
||||
{ name: "Discord", icon: <DiscordIcon className="h-6 w-6" />, body: "discord" },
|
||||
] as const;
|
||||
|
||||
function Triggers() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<section className="space-y-6">
|
||||
<h2 className="text-xl font-medium">{t("hub.triggers.title")}</h2>
|
||||
<p className="text-white/70 leading-relaxed max-w-2xl">{t("hub.triggers.description")}</p>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-3 gap-4">
|
||||
{TRIGGER_SURFACES.map((surface) => (
|
||||
<div
|
||||
key={surface.name}
|
||||
className="flex items-center gap-3 rounded-xl border border-white/10 bg-white/[0.03] px-5 py-4"
|
||||
>
|
||||
<span className="text-white/80">{surface.icon}</span>
|
||||
<span className="min-w-0">
|
||||
<span className="block font-medium">{surface.name}</span>
|
||||
<span className="block text-xs text-muted-foreground">
|
||||
{t(`hub.triggers.${surface.body}`)}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<DiscordDemo />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
const DEMO_ISSUES = [
|
||||
{ id: "#2811", title: "Terminal output drops under load" },
|
||||
{ id: "#2804", title: "Relay reconnect loop on Android after sleep" },
|
||||
{ id: "#2799", title: "Worktree cleanup leaves stale branches" },
|
||||
];
|
||||
|
||||
const DEMO_COMPONENTS = {
|
||||
mention: <Mention />,
|
||||
host: <span className="font-mono text-white/50" />,
|
||||
pr: <span className="text-white/80 underline decoration-white/20" />,
|
||||
};
|
||||
|
||||
function DiscordDemo() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<figure className="space-y-3">
|
||||
<div className="overflow-hidden rounded-2xl border border-white/10 bg-white/[0.02]">
|
||||
<div className="flex items-center gap-2 border-b border-white/10 bg-white/[0.03] px-5 py-3">
|
||||
<DiscordIcon className="h-4 w-4 text-white/40" />
|
||||
<span className="font-mono text-xs text-white/50">#engineering</span>
|
||||
</div>
|
||||
<div className="space-y-5 p-5">
|
||||
<DemoMessage author="moboudra" time="09:41">
|
||||
<p>
|
||||
<Trans i18nKey="hub.demo.showIssues" components={DEMO_COMPONENTS} />
|
||||
</p>
|
||||
</DemoMessage>
|
||||
|
||||
<DemoMessage author="paseo-bot" time="09:41" bot>
|
||||
<p>{t("hub.demo.issuesOpen")}</p>
|
||||
<ul className="space-y-1">
|
||||
{DEMO_ISSUES.map((issue) => (
|
||||
<li key={issue.id} className="flex gap-2">
|
||||
<span className="font-mono text-white/40">{issue.id}</span>
|
||||
<span>{issue.title}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</DemoMessage>
|
||||
|
||||
<DemoMessage author="moboudra" time="09:43">
|
||||
<p>
|
||||
<Trans i18nKey="hub.demo.createPr" components={DEMO_COMPONENTS} />
|
||||
</p>
|
||||
</DemoMessage>
|
||||
|
||||
<DemoMessage author="paseo-bot" time="09:48" bot>
|
||||
<p>
|
||||
<Trans i18nKey="hub.demo.ranOn" components={DEMO_COMPONENTS} />
|
||||
</p>
|
||||
<div className="flex flex-wrap items-center gap-2 pt-1">
|
||||
<span className="rounded-full bg-emerald-400/10 px-2 py-1 text-xs text-emerald-300">
|
||||
{t("hub.demo.filesChanged")}
|
||||
</span>
|
||||
<span className="rounded-full border border-white/10 px-2 py-1 text-xs text-white/40">
|
||||
{t("hub.demo.testsPassed")}
|
||||
</span>
|
||||
</div>
|
||||
</DemoMessage>
|
||||
</div>
|
||||
</div>
|
||||
<figcaption className="text-sm text-muted-foreground">{t("hub.demo.caption")}</figcaption>
|
||||
</figure>
|
||||
);
|
||||
}
|
||||
|
||||
function Mention() {
|
||||
return <span className="rounded bg-indigo-400/15 px-1 py-0.5 text-indigo-200">@paseo-bot</span>;
|
||||
}
|
||||
|
||||
function DemoMessage({
|
||||
author,
|
||||
time,
|
||||
bot,
|
||||
children,
|
||||
}: {
|
||||
author: string;
|
||||
time: string;
|
||||
bot?: boolean;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="flex gap-3">
|
||||
<div className="flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full border border-white/10 bg-white/[0.06]">
|
||||
{bot ? (
|
||||
<PaseoHubMark className="h-5 w-5 text-white" />
|
||||
) : (
|
||||
<span className="text-xs font-medium text-white/60">M</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="min-w-0 space-y-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-sm font-medium text-white/90">{author}</span>
|
||||
{bot && (
|
||||
<span className="rounded bg-indigo-400/15 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-indigo-200">
|
||||
{t("hub.demo.bot")}
|
||||
</span>
|
||||
)}
|
||||
<span className="text-xs text-white/25">{time}</span>
|
||||
</div>
|
||||
<div className="space-y-2 text-sm text-white/70 leading-relaxed">{children}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const AGENT_LOGOS = [
|
||||
{ name: "Claude Code", icon: <ClaudeCodeIcon className="h-6 w-6" /> },
|
||||
{ name: "Codex", icon: <CodexIcon className="h-6 w-6" /> },
|
||||
{ name: "OpenCode", icon: <OpenCodeIcon className="h-6 w-6" /> },
|
||||
{ name: "Cursor", icon: <CursorIcon className="h-6 w-6" /> },
|
||||
{ name: "Pi", icon: <PiIcon className="h-6 w-6" /> },
|
||||
];
|
||||
|
||||
const MORE_AGENT_COUNT = AGENT_PAGES.length - AGENT_LOGOS.length;
|
||||
|
||||
function Agents() {
|
||||
const { t } = useTranslation();
|
||||
const localize = useLocalizePath();
|
||||
return (
|
||||
<section className="space-y-6">
|
||||
<h2 className="text-xl font-medium">{t("hub.agents.title")}</h2>
|
||||
<p className="text-white/70 leading-relaxed max-w-2xl">{t("hub.agents.description")}</p>
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
{AGENT_LOGOS.map((agent) => (
|
||||
<div
|
||||
key={agent.name}
|
||||
className="flex items-center gap-2.5 rounded-xl border border-white/10 bg-white/[0.03] px-4 py-3"
|
||||
>
|
||||
<span className="text-white/80">{agent.icon}</span>
|
||||
<span className="text-sm font-medium">{agent.name}</span>
|
||||
</div>
|
||||
))}
|
||||
<a
|
||||
href={localize("/agents")}
|
||||
className="rounded-xl border border-dashed border-white/10 bg-white/[0.01] px-4 py-3 text-sm font-medium text-white/50 hover:text-white/80 hover:border-white/20 transition-colors"
|
||||
>
|
||||
{t("common.more", { count: MORE_AGENT_COUNT })}
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
const DIAGRAM_SURFACES = [
|
||||
{ name: "GitHub", icon: <GitHubIcon className="h-5 w-5" /> },
|
||||
{ name: "Slack", icon: <SlackIcon className="h-5 w-5" /> },
|
||||
{ name: "Discord", icon: <DiscordIcon className="h-5 w-5" /> },
|
||||
];
|
||||
|
||||
const CLAUDE_MARK = { name: "Claude Code", icon: <ClaudeCodeIcon className="h-4 w-4" /> };
|
||||
const CODEX_MARK = { name: "Codex", icon: <CodexIcon className="h-4 w-4" /> };
|
||||
const OPENCODE_MARK = { name: "OpenCode", icon: <OpenCodeIcon className="h-4 w-4" /> };
|
||||
const PI_MARK = { name: "Pi", icon: <PiIcon className="h-4 w-4" /> };
|
||||
|
||||
const DIAGRAM_DAEMONS = [
|
||||
{ name: "MacBook Pro", agents: [CLAUDE_MARK, CODEX_MARK, OPENCODE_MARK] },
|
||||
{ name: "Hetzner VM", agents: [CLAUDE_MARK, PI_MARK] },
|
||||
];
|
||||
|
||||
const DIAGRAM_CLIENTS = ["desktop", "web", "mobile", "cli"] as const;
|
||||
|
||||
function Shape() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<section className="space-y-6">
|
||||
<h2 className="text-xl font-medium">{t("hub.shape.title")}</h2>
|
||||
<p className="text-white/70 leading-relaxed max-w-2xl">{t("hub.shape.description")}</p>
|
||||
|
||||
<div className="rounded-2xl border border-white/10 bg-white/[0.02] p-6 md:p-8">
|
||||
<div className="flex flex-col items-center">
|
||||
<DiagramRow label={t("hub.shape.triggersRow")}>
|
||||
{DIAGRAM_SURFACES.map((surface) => (
|
||||
<DiagramCard key={surface.name} icon={surface.icon} name={surface.name} />
|
||||
))}
|
||||
<DiagramCard name={t("hub.shape.yourTeam")} />
|
||||
<div className="flex items-center justify-center rounded-xl border border-dashed border-white/10 bg-white/[0.01] px-4 py-3 text-sm text-white/30">
|
||||
{t("hub.shape.futureIntegrations")}
|
||||
</div>
|
||||
</DiagramRow>
|
||||
|
||||
<Connector label={t("hub.shape.webhooks")} />
|
||||
|
||||
<div className="w-full max-w-xs rounded-xl border border-white/20 bg-white/[0.06] px-6 py-5 text-center">
|
||||
<p className="flex justify-center">
|
||||
<HubLockup className="h-[22px] w-auto text-foreground" />
|
||||
<span className="sr-only">{t("hub.shape.hub")}</span>
|
||||
</p>
|
||||
<p className="text-xs text-muted-foreground mt-1.5">{t("hub.shape.hubHosting")}</p>
|
||||
</div>
|
||||
|
||||
<Connector label={t("hub.shape.sameRpcs")} />
|
||||
|
||||
<DiagramRow label={t("hub.shape.daemonsRow")}>
|
||||
{DIAGRAM_DAEMONS.map((daemon) => (
|
||||
<div
|
||||
key={daemon.name}
|
||||
className="flex items-center gap-3 rounded-xl border border-white/10 bg-white/[0.03] px-4 py-3"
|
||||
>
|
||||
<span className="text-white/70">
|
||||
<MachineIcon />
|
||||
</span>
|
||||
<span className="text-sm font-medium">{daemon.name}</span>
|
||||
<span className="flex items-center gap-2 border-l border-white/10 pl-3 text-white/40">
|
||||
{daemon.agents.map((agent) => (
|
||||
<span key={agent.name} title={agent.name}>
|
||||
{agent.icon}
|
||||
</span>
|
||||
))}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</DiagramRow>
|
||||
|
||||
<Connector label={t("hub.shape.directOrRelay")} />
|
||||
|
||||
<DiagramRow label={t("hub.shape.appsRow")}>
|
||||
{DIAGRAM_CLIENTS.map((client) => (
|
||||
<DiagramCard key={client} name={t(`hub.shape.${client}`)} />
|
||||
))}
|
||||
</DiagramRow>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
function DiagramRow({ label, children }: { label: string; children: ReactNode }) {
|
||||
return (
|
||||
<div className="w-full space-y-2">
|
||||
<p className="text-center text-xs uppercase tracking-wide text-white/25">{label}</p>
|
||||
<div className="flex flex-wrap justify-center gap-3">{children}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function DiagramCard({ name, icon }: { name: string; icon?: ReactNode }) {
|
||||
return (
|
||||
<div className="flex items-center gap-2.5 rounded-xl border border-white/10 bg-white/[0.03] px-4 py-3">
|
||||
{icon && <span className="text-white/70">{icon}</span>}
|
||||
<span className="text-sm font-medium">{name}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function Connector({ label }: { label: string }) {
|
||||
return (
|
||||
<div className="flex flex-col items-center gap-2 py-4">
|
||||
<div className="h-5 w-px border-l border-dashed border-white/25" />
|
||||
<p className="text-center text-[11px] text-white/30">{label}</p>
|
||||
<div className="h-5 w-px border-l border-dashed border-white/25" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function MachineIcon() {
|
||||
return (
|
||||
<svg
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="1.5"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<rect x="2" y="2" width="20" height="8" rx="2" />
|
||||
<rect x="2" y="14" width="20" height="8" rx="2" />
|
||||
<circle cx="6" cy="6" r="1" />
|
||||
<circle cx="6" cy="18" r="1" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
const SIMPLE_FAQ_ENTRIES = ["need", "hosted"] as const;
|
||||
const LATER_FAQ_ENTRIES = ["move", "agents", "code"] as const;
|
||||
const SIMPLE_FAQ_ENTRIES = ["need"] as const;
|
||||
const LATER_FAQ_ENTRIES = ["move", "agents"] as const;
|
||||
|
||||
function FaqSection() {
|
||||
const { t } = useTranslation();
|
||||
const localize = useLocalizePath();
|
||||
const links = React.useMemo(
|
||||
() => ({
|
||||
code: <code />,
|
||||
code: <code className="font-mono text-xs text-white/80" />,
|
||||
github: <a href="https://github.com/getpaseo/hub" className={LINK_CLASS} />,
|
||||
guide: <a href={localize("/docs/hub/self-hosting")} className={LINK_CLASS} />,
|
||||
hosted: <a href={HOSTED_HUB_URL} className={LINK_CLASS} />,
|
||||
@@ -590,9 +565,16 @@ function FaqSection() {
|
||||
[localize],
|
||||
);
|
||||
return (
|
||||
<section className="space-y-6">
|
||||
<h2 className="text-3xl font-medium">{t("hub.faq.title")}</h2>
|
||||
<div className="space-y-6">
|
||||
<section
|
||||
aria-labelledby="faq-heading"
|
||||
className="grid items-start gap-10 lg:grid-cols-[minmax(0,17rem)_minmax(0,1fr)] lg:gap-16"
|
||||
>
|
||||
<SectionOpener
|
||||
headingId="faq-heading"
|
||||
title={t("hub.faq.title")}
|
||||
className="mb-0 self-start"
|
||||
/>
|
||||
<div className="divide-y divide-white/[0.08] border-y border-white/[0.08]">
|
||||
<FAQItem question={t("hub.faq.whatQuestion")}>{t("hub.faq.whatAnswer")}</FAQItem>
|
||||
<FAQItem question={t("hub.faq.separateQuestion")}>
|
||||
<p>{t("hub.faq.separateAnswer1")}</p>
|
||||
@@ -606,6 +588,17 @@ function FaqSection() {
|
||||
{t(`hub.faq.${entry}Answer`)}
|
||||
</FAQItem>
|
||||
))}
|
||||
<FAQItem question={t("hub.faq.hostedQuestion")}>
|
||||
<Trans i18nKey="hub.faq.hostedAnswer" components={links} />
|
||||
</FAQItem>
|
||||
<FAQItem question={t("hub.faq.codeQuestion")}>
|
||||
<Trans i18nKey="hub.faq.codeAnswer" components={links} />
|
||||
</FAQItem>
|
||||
{LATER_FAQ_ENTRIES.map((entry) => (
|
||||
<FAQItem key={entry} question={t(`hub.faq.${entry}Question`)}>
|
||||
{t(`hub.faq.${entry}Answer`)}
|
||||
</FAQItem>
|
||||
))}
|
||||
<FAQItem question={t("hub.faq.plannedQuestion")}>
|
||||
<p>{t("hub.faq.plannedIntro")}</p>
|
||||
<ul className="list-disc space-y-1 pl-5">
|
||||
@@ -614,11 +607,6 @@ function FaqSection() {
|
||||
<li>{t("hub.faq.plannedIntegrations")}</li>
|
||||
</ul>
|
||||
</FAQItem>
|
||||
{LATER_FAQ_ENTRIES.map((entry) => (
|
||||
<FAQItem key={entry} question={t(`hub.faq.${entry}Question`)}>
|
||||
{t(`hub.faq.${entry}Answer`)}
|
||||
</FAQItem>
|
||||
))}
|
||||
<FAQItem question={t("hub.faq.accessQuestion")}>
|
||||
<Trans i18nKey="hub.faq.accessAnswer" components={links} />
|
||||
</FAQItem>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Trans } from "react-i18next";
|
||||
import { LandingPage } from "~/components/landing-page";
|
||||
import { getTranslator, routeLocale } from "~/i18n";
|
||||
import { pageMeta } from "~/meta";
|
||||
import { getPluginCount } from "~/plugins";
|
||||
|
||||
export const Route = createFileRoute("/{-$locale}/")({
|
||||
head: ({ params }) => {
|
||||
@@ -15,6 +16,7 @@ export const Route = createFileRoute("/{-$locale}/")({
|
||||
locale,
|
||||
});
|
||||
},
|
||||
loader: async () => ({ pluginCount: await getPluginCount() }),
|
||||
component: Home,
|
||||
});
|
||||
|
||||
@@ -32,5 +34,6 @@ const SUBTITLE = (
|
||||
);
|
||||
|
||||
function Home() {
|
||||
return <LandingPage title={TITLE} subtitle={SUBTITLE} />;
|
||||
const { pluginCount } = Route.useLoaderData();
|
||||
return <LandingPage title={TITLE} subtitle={SUBTITLE} pluginCount={pluginCount} showHubEyebrow />;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
} from "lucide-react";
|
||||
import { useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { MOBILE_PAGE_BLEED_CLASS } from "~/components/page-frame";
|
||||
import { SiteShell } from "~/components/site-shell";
|
||||
import { getTranslator, localizePath, routeLocale, useLocalizePath } from "~/i18n";
|
||||
import { pageMeta } from "~/meta";
|
||||
@@ -66,8 +67,7 @@ const CATEGORY_ICONS: Record<CategorySlug, LucideIcon> = {
|
||||
};
|
||||
|
||||
// Card sections: a swipeable row on phones, a grid from `sm` up.
|
||||
const CARD_ROW_CLASS =
|
||||
"-mx-6 flex gap-4 overflow-x-auto px-6 pb-1 *:w-[70%] *:flex-shrink-0 sm:mx-0 sm:grid sm:grid-cols-2 sm:px-0 sm:*:w-auto lg:grid-cols-4";
|
||||
const CARD_ROW_CLASS = `${MOBILE_PAGE_BLEED_CLASS} flex gap-4 overflow-x-auto pb-1 *:w-[70%] *:flex-shrink-0 sm:mx-0 sm:grid sm:grid-cols-2 sm:px-0 sm:*:w-auto lg:grid-cols-4`;
|
||||
const SEE_ALL_CLASS =
|
||||
"inline-flex items-center gap-0.5 text-sm text-muted-foreground transition-colors hover:text-foreground";
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user