mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-26 18:25:31 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4dc119df8 | ||
|
|
903b71180f |
@@ -96,6 +96,7 @@ jobs:
|
||||
publish-macos:
|
||||
needs: [create-release]
|
||||
if: ${{ always() && (needs.create-release.result == 'success' || needs.create-release.result == 'skipped') && ((github.event_name == 'workflow_dispatch' && (github.event.inputs.platform == 'all' || github.event.inputs.platform == 'macos')) || (github.event_name == 'push' && (startsWith(github.ref_name, 'v') || startsWith(github.ref_name, 'desktop-v') || startsWith(github.ref_name, 'desktop-macos-v')))) }}
|
||||
timeout-minutes: 45
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -181,7 +182,7 @@ jobs:
|
||||
npm run build:desktop "${build_args[@]}"
|
||||
|
||||
- name: Upload packaged smoke diagnostics
|
||||
if: failure()
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: desktop-smoke-macos-${{ matrix.electron_arch }}
|
||||
|
||||
@@ -15,7 +15,7 @@ Each live agent in `AgentManager` carries a `lastStatus` of `initializing`, `idl
|
||||
## Daemon restart recovery
|
||||
|
||||
Restart recovery is off by default. Enable `agents.resumeOnStartup` in host config or
|
||||
Host settings → Agents to resume interrupted agents after graceful shutdown or a crash. The daemon
|
||||
Settings → Host → Daemon to resume interrupted agents after graceful shutdown or a crash. The daemon
|
||||
reopens the saved provider conversation and settings, then sends `Resume working.`. Customize
|
||||
the prompt with `agents.resumePrompt` or the same settings page.
|
||||
Disabling recovery consumes pending intent; enabling it later does not revive old work.
|
||||
|
||||
@@ -32,6 +32,7 @@ import {
|
||||
waitForWorkspaceTabsVisible,
|
||||
} from "../support/helpers/workspace-tabs";
|
||||
import { getServerId } from "../support/helpers/server-id";
|
||||
import { openSettingsSection } from "../support/helpers/settings";
|
||||
import { buildHostWorkspaceRoute } from "@/utils/host-routes";
|
||||
import { WORKSPACE_DECK_MAX_MOUNTED_WORKSPACES } from "@/screens/workspace/workspace-deck-retention";
|
||||
import { delayBrowserAgentCreatedStatus } from "../support/helpers/new-workspace";
|
||||
@@ -350,6 +351,7 @@ async function selectSendBehaviorInSettings(
|
||||
behaviorLabel: string,
|
||||
stored: string,
|
||||
): Promise<void> {
|
||||
await openSettingsSection(page, "chat");
|
||||
await page.getByRole("button", { name: /^Default send: / }).click();
|
||||
await page.getByRole("menuitem", { name: behaviorLabel, exact: true }).click();
|
||||
await expect
|
||||
|
||||
@@ -272,13 +272,15 @@ test.describe("Agent profiles settings", () => {
|
||||
await test.step("switching Settings sections asks before discarding an edited draft", async () => {
|
||||
await fillAgentProfileName(page, "Unsaved sidebar edit");
|
||||
|
||||
await switchSettingsSectionWithConfirm(page, "Agents", "dismiss");
|
||||
await switchSettingsSectionWithConfirm(page, "Tools & prompts", "dismiss");
|
||||
await expect(page.getByTestId("agent-profile-drawer")).toBeVisible();
|
||||
await expectAgentProfileNameDraft(page, "Unsaved sidebar edit");
|
||||
|
||||
await switchSettingsSectionWithConfirm(page, "Agents", "accept");
|
||||
await switchSettingsSectionWithConfirm(page, "Tools & prompts", "accept");
|
||||
await expect(page.getByTestId("agent-profile-drawer")).toHaveCount(0, { timeout: 30_000 });
|
||||
await expect(page.getByTestId("settings-detail-header-title")).toHaveText("Agents");
|
||||
await expect(page.getByTestId("settings-detail-header-title")).toHaveText(
|
||||
"Tools & prompts",
|
||||
);
|
||||
});
|
||||
|
||||
await test.step("confirming browser Back leaves Agent profiles and discards the draft", async () => {
|
||||
|
||||
@@ -47,7 +47,7 @@ async function openHostOverview(page: Page, daemon: IsolatedHostDaemon): Promise
|
||||
endpoint: `127.0.0.1:${daemon.port}`,
|
||||
},
|
||||
]);
|
||||
await page.goto(`/settings/hosts/${daemon.serverId}/host`);
|
||||
await page.goto(`/settings/hosts/${daemon.serverId}/daemon`);
|
||||
await expect(page.getByText("Online", { exact: true })).toBeVisible();
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ async function expectHelpHostVersion(page: Page, serverId: string, version: stri
|
||||
async function openHostPage(page: Page, host: RestartableHostDaemon): Promise<void> {
|
||||
await openSettings(page);
|
||||
await selectSettingsHost(page, host.serverId);
|
||||
await openHostSection(page, host.serverId, "host");
|
||||
await openHostSection(page, host.serverId, "daemon");
|
||||
}
|
||||
|
||||
function hostIdentity(page: Page) {
|
||||
|
||||
@@ -13,8 +13,8 @@ async function openMetadataGenerationSettings(page: Page) {
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
await openSettingsHost(page, serverId);
|
||||
await openHostSection(page, serverId, "metadata");
|
||||
await expectSettingsHeader(page, "Metadata");
|
||||
await openHostSection(page, serverId, "workspaces");
|
||||
await expectSettingsHeader(page, "Workspaces");
|
||||
}
|
||||
|
||||
async function openManualMetadataModelPicker(page: Page) {
|
||||
|
||||
@@ -105,7 +105,7 @@ test("a new user is walked through setup once", async ({ page }, testInfo) => {
|
||||
await expectSetupStep(page, "Let agents use Paseo");
|
||||
await expect(paseoToolsSwitch(setupModal(page))).toBeChecked();
|
||||
await expect(
|
||||
setupModal(page).getByRole("switch", { name: "Orchestration skills", exact: true }),
|
||||
setupModal(page).getByRole("switch", { name: "Paseo skills", exact: true }),
|
||||
).toBeChecked();
|
||||
await page.screenshot({ path: testInfo.outputPath("4-orchestration.png") });
|
||||
});
|
||||
@@ -417,7 +417,7 @@ test("setup choices carry over to Settings and the phone step pairs over relay",
|
||||
await test.step("Finish closes setup and Settings shows the same Paseo tools value", async () => {
|
||||
await finishSetup(page);
|
||||
await page.locator('[data-testid="sidebar-settings"]:visible').first().click();
|
||||
await openSettingsHostSection(page, host.serverId, "agents");
|
||||
await openSettingsHostSection(page, host.serverId, "tools");
|
||||
await expect(paseoToolsSwitch(page)).toBeChecked();
|
||||
await page.screenshot({ path: testInfo.outputPath("7-settings-agents.png") });
|
||||
});
|
||||
@@ -439,7 +439,7 @@ test("with no skills picked, skills read as off and Continue moves on", async ({
|
||||
await chooseCustomSkills(page, []);
|
||||
await saveSkillSelection(page);
|
||||
const skillsSwitch = setupModal(page).getByRole("switch", {
|
||||
name: "Orchestration skills",
|
||||
name: "Paseo skills",
|
||||
exact: true,
|
||||
});
|
||||
await expect(skillsSwitch).not.toBeChecked();
|
||||
@@ -476,7 +476,7 @@ test("in the compact layout, Finish on Orchestration applies its switches", asyn
|
||||
await step("Let agents use Paseo");
|
||||
await expect(paseoToolsSwitch(page)).toBeChecked();
|
||||
// Skills are not installed, so leaving them off has nothing to apply.
|
||||
const skillsSwitch = page.getByRole("switch", { name: "Orchestration skills", exact: true });
|
||||
const skillsSwitch = page.getByRole("switch", { name: "Paseo skills", exact: true });
|
||||
await skillsSwitch.click();
|
||||
await expect(skillsSwitch).not.toBeChecked();
|
||||
gate.holdNextClientRequest("set_daemon_config_request");
|
||||
|
||||
@@ -33,7 +33,7 @@ function askAgain(page: Page) {
|
||||
|
||||
async function openFilesSettings(page: Page) {
|
||||
await openSettings(page);
|
||||
await openSettingsSection(page, "files");
|
||||
await openSettingsSection(page, "chat");
|
||||
await expect(page.getByTestId("file-panel-settings")).toBeVisible();
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ test("Settings > Files chooses which panel opens .md and asks again on request",
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await page.goto("/settings/files");
|
||||
await expect(markdownDropdown(page, PLUGIN_MARKDOWN_OPTION)).toBeVisible({ timeout: 30_000 });
|
||||
await askAgain(page).scrollIntoViewIfNeeded();
|
||||
await expect(askAgain(page)).toBeInViewport({ ratio: 1 });
|
||||
await capture(page, testInfo, "file-panel-settings-compact");
|
||||
await markdownDropdown(page, PLUGIN_MARKDOWN_OPTION).click();
|
||||
@@ -113,22 +114,20 @@ test("Settings > Files chooses which panel opens .md and asks again on request",
|
||||
}
|
||||
});
|
||||
|
||||
test("Settings > Files explains where file panels come from when no plugin adds one", async ({
|
||||
test("Settings > Chat & panes hides file panels when no plugin adds one", async ({
|
||||
page,
|
||||
}, testInfo) => {
|
||||
await page.setViewportSize({ width: 1280, height: 900 });
|
||||
await page.goto("/settings/files");
|
||||
const empty = page.getByTestId("file-panel-settings-empty");
|
||||
await expect(empty).toHaveText("File panels appear here when a plugin adds one", {
|
||||
timeout: 30_000,
|
||||
});
|
||||
await expect(page).toHaveURL(/\/settings\/chat$/);
|
||||
await expect(page.getByTestId("file-panel-settings")).toHaveCount(0);
|
||||
await capture(page, testInfo, "file-panel-settings-empty-wide");
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await expect(empty).toBeVisible();
|
||||
await expect(page.getByTestId("file-panel-settings")).toHaveCount(0);
|
||||
await capture(page, testInfo, "file-panel-settings-empty-compact");
|
||||
});
|
||||
|
||||
test("Settings > Files offers Source in place of a panel no host has, and forgets it", async ({
|
||||
test("Settings > Chat & panes offers Source in place of a panel no host has, and forgets it", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.addInitScript(() => {
|
||||
@@ -146,5 +145,5 @@ test("Settings > Files offers Source in place of a panel no host has, and forget
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(page.getByRole("menuitem", { name: SOURCE_OPTION })).toBeHidden();
|
||||
await row.getByRole("button", { name: "Ask again for .pdf", exact: true }).click();
|
||||
await expect(page.getByTestId("file-panel-settings-empty")).toBeVisible();
|
||||
await expect(page.getByTestId("file-panel-settings")).toHaveCount(0);
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import { test } from "../support/fixtures";
|
||||
import { gotoAppShell, openSettings } from "../support/helpers/app";
|
||||
import { renameHostFromSettings } from "../support/helpers/hosts";
|
||||
import { getServerId } from "../support/helpers/server-id";
|
||||
import { openHostSection, selectSettingsHost } from "../support/helpers/settings";
|
||||
import { openClientHostSettings } from "../support/helpers/settings";
|
||||
|
||||
const REGISTRY_KEY = "@paseo:daemon-registry";
|
||||
const SEED_NONCE_KEY = "@paseo:e2e-seed-nonce";
|
||||
@@ -87,8 +87,7 @@ test("saved hosts survive a registry entry this build can't read, and saving kee
|
||||
|
||||
await test.step("renaming a host keeps its password and the entries it can't read", async () => {
|
||||
await openSettings(page);
|
||||
await selectSettingsHost(page, OFFLINE_HOST.serverId);
|
||||
await openHostSection(page, OFFLINE_HOST.serverId, "host");
|
||||
await openClientHostSettings(page, OFFLINE_HOST.serverId);
|
||||
await renameHostFromSettings(page, "Renamed offline host");
|
||||
|
||||
await expect
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
expectProviderNotOnHost,
|
||||
expectProviderPageLoaded,
|
||||
gotoProviderPage,
|
||||
openClientHostSettings,
|
||||
openSettingsHost,
|
||||
openHostSection,
|
||||
expectHostLabelDisplayed,
|
||||
@@ -53,36 +54,30 @@ test.describe("Settings host page", () => {
|
||||
const port = getE2EDaemonPort();
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
await openSettingsHost(page, serverId);
|
||||
await test.step("connections section shows the seeded connection endpoint", async () => {
|
||||
await expectSettingsHeader(page, "Connections");
|
||||
await test.step("client host detail shows the seeded connection endpoint and label editor", async () => {
|
||||
await openClientHostSettings(page, serverId);
|
||||
await expectHostConnectionsCard(page, port);
|
||||
await expectHostLabelDisplayed(page);
|
||||
await clickEditHostLabel(page);
|
||||
await expectHostLabelEditMode(page, TEST_HOST_LABEL);
|
||||
await page.keyboard.press("Escape");
|
||||
});
|
||||
await test.step("agents section shows the inject MCP toggle", async () => {
|
||||
await openHostSection(page, serverId, "agents");
|
||||
await expectSettingsHeader(page, "Agents");
|
||||
await test.step("tools section shows the inject MCP toggle", async () => {
|
||||
await openHostSection(page, serverId, "tools");
|
||||
await expectSettingsHeader(page, "Tools & prompts");
|
||||
await expectHostInjectMcpCard(page);
|
||||
});
|
||||
await test.step("providers section shows the providers card", async () => {
|
||||
await expectHostProvidersCard(page, serverId);
|
||||
await expectSettingsHeader(page, "Providers");
|
||||
});
|
||||
await test.step("host section shows the host label and restart/remove action cards", async () => {
|
||||
await openHostSection(page, serverId, "host");
|
||||
await expectSettingsHeader(page, "Overview");
|
||||
await expectHostLabelDisplayed(page);
|
||||
await test.step("daemon section shows restart and client host shows remove", async () => {
|
||||
await openHostSection(page, serverId, "daemon");
|
||||
await expectSettingsHeader(page, "Daemon");
|
||||
await expectHostActionCards(page, serverId);
|
||||
});
|
||||
await test.step("clicking the label pencil reveals the inline editor", async () => {
|
||||
await openHostSection(page, serverId, "host");
|
||||
|
||||
await expectHostLabelDisplayed(page);
|
||||
await clickEditHostLabel(page);
|
||||
await expectHostLabelEditMode(page, TEST_HOST_LABEL);
|
||||
await page.keyboard.press("Escape");
|
||||
});
|
||||
await test.step("host section does not render daemon lifecycle controls for a remote daemon", async () => {
|
||||
await openHostSection(page, serverId, "host");
|
||||
await test.step("daemon section does not render daemon lifecycle controls for a remote daemon", async () => {
|
||||
await openHostSection(page, serverId, "daemon");
|
||||
|
||||
await expectHostNoDaemonLifecycleRow(page);
|
||||
});
|
||||
@@ -99,7 +94,7 @@ test.describe("Settings host page", () => {
|
||||
await page.reload();
|
||||
await openSettings(page);
|
||||
await openSettingsHost(page, outdatedDaemon.serverId);
|
||||
await openHostSection(page, outdatedDaemon.serverId, "host");
|
||||
await openHostSection(page, outdatedDaemon.serverId, "daemon");
|
||||
|
||||
page.once("dialog", (dialog) => dialog.accept());
|
||||
const updateButton = page.getByTestId("host-page-update-button");
|
||||
@@ -138,8 +133,7 @@ test.describe("Settings host page", () => {
|
||||
]);
|
||||
await page.reload();
|
||||
await openSettings(page);
|
||||
await selectSettingsHost(page, daemon.serverId);
|
||||
await openHostSection(page, daemon.serverId, "host");
|
||||
await openClientHostSettings(page, daemon.serverId);
|
||||
|
||||
await test.step("the host page shows the reason and the re-add guidance, with no password UI", async () => {
|
||||
await expectHostRejectedWithReAddGuidance(page, "Password required");
|
||||
@@ -149,7 +143,7 @@ test.describe("Settings host page", () => {
|
||||
await test.step("removing the host and adding it again with the password brings it online", async () => {
|
||||
await removeHostFromHostPage(page, daemon.serverId);
|
||||
await addDirectHostFromSettings(page, { host: "127.0.0.1", port: daemon.port, password });
|
||||
await openHostSection(page, daemon.serverId, "host");
|
||||
await openHostSection(page, daemon.serverId, "daemon");
|
||||
await expectHostOnlineWithoutError(page);
|
||||
});
|
||||
} finally {
|
||||
@@ -192,7 +186,7 @@ test.describe("Settings host page", () => {
|
||||
await page.reload();
|
||||
await openSettings(page);
|
||||
await selectSettingsHost(page, serverId);
|
||||
await openHostSection(page, serverId, "agents");
|
||||
await openHostSection(page, serverId, "daemon");
|
||||
};
|
||||
try {
|
||||
await test.step("idle agent release starts on and turns off", async () => {
|
||||
@@ -213,7 +207,7 @@ test.describe("Settings host page", () => {
|
||||
|
||||
await test.step("other hosts keep their own setting", async () => {
|
||||
await selectSettingsHost(page, primaryServerId);
|
||||
await openHostSection(page, primaryServerId, "agents");
|
||||
await openHostSection(page, primaryServerId, "daemon");
|
||||
await expectIdleAgentRelease(page, true);
|
||||
await expectLiveSavedSetting(false);
|
||||
});
|
||||
@@ -232,7 +226,7 @@ test.describe("Settings host page", () => {
|
||||
]);
|
||||
await page.reload();
|
||||
await openSettings(page);
|
||||
await openHostSection(page, daemon.serverId, "agents");
|
||||
await openHostSection(page, daemon.serverId, "daemon");
|
||||
await expectIdleAgentRelease(page, true);
|
||||
// A real filesystem failure, with the daemon and RPC path intact.
|
||||
await rename(configPath, `${configPath}.saved`);
|
||||
@@ -251,7 +245,7 @@ test.describe("Settings host page", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("navigating to /settings/hosts/[serverId] redirects to the connections section", async ({
|
||||
test("navigating to /settings/hosts/[serverId] redirects to the daemon section", async ({
|
||||
page,
|
||||
}) => {
|
||||
const serverId = getServerId();
|
||||
@@ -260,10 +254,9 @@ test.describe("Settings host page", () => {
|
||||
await page.goto(`/settings/hosts/${encodeURIComponent(serverId)}`);
|
||||
|
||||
await expectHostPageVisible(page, serverId);
|
||||
await expectSettingsHeader(page, "Connections");
|
||||
await openHostSection(page, serverId, "host");
|
||||
await expectHostLabelDisplayed(page);
|
||||
await expectSettingsHeader(page, "Daemon");
|
||||
await expectHostActionCards(page, serverId);
|
||||
await expectHostLabelDisplayed(page);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -286,7 +279,7 @@ test("restart recovery defaults off and persists opt-in and custom prompt", asyn
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
await openSettingsHost(page, serverId);
|
||||
await openHostSection(page, serverId, "agents");
|
||||
await openHostSection(page, serverId, "daemon");
|
||||
await expectRestartRecoveryEnabled(page, false);
|
||||
await setRestartRecoveryEnabled(page, true);
|
||||
await page.reload();
|
||||
@@ -354,12 +347,12 @@ test("sidebar Add host completes without navigating", async ({ page }) => {
|
||||
await expect(page.getByRole("button", { name: "Hosts", exact: true })).toBeVisible();
|
||||
});
|
||||
|
||||
test("Settings Add host opens the saved host Overview", async ({ page }) => {
|
||||
test("Settings Add host opens the saved host detail", async ({ page }) => {
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
await addDirectHostFromSettings(page, { host: "127.0.0.1", port: Number(getE2EDaemonPort()) });
|
||||
await expectSettingsHeader(page, "Overview");
|
||||
await expect(page).toHaveURL(new RegExp(`/settings/hosts/${getServerId()}/host$`));
|
||||
await expect(page.getByTestId("host-page-connections-card")).toBeVisible();
|
||||
await expect(page).toHaveURL(new RegExp(`/settings/device-hosts/${getServerId()}$`));
|
||||
});
|
||||
|
||||
test("New workspace Add host preserves the prompt after connecting", async ({ page }) => {
|
||||
|
||||
@@ -46,15 +46,15 @@ test.describe("Settings host selection", () => {
|
||||
|
||||
await openSettings(page);
|
||||
|
||||
await openSettingsHostSection(page, remoteDaemon.serverId, "connections");
|
||||
await openSettingsHostSection(page, remoteDaemon.serverId, "daemon");
|
||||
|
||||
await selectSettingsHost(page, getServerId());
|
||||
await openSettingsSection(page, "appearance");
|
||||
await openSettingsHostSection(page, getServerId(), "connections");
|
||||
await openSettingsHostSection(page, getServerId(), "daemon");
|
||||
|
||||
await clickSettingsBackToWorkspace(page);
|
||||
await openSettings(page);
|
||||
await openSettingsHostSection(page, remoteDaemon.serverId, "connections");
|
||||
await openSettingsHostSection(page, remoteDaemon.serverId, "daemon");
|
||||
} finally {
|
||||
await remoteWorkspace.cleanup().catch(() => undefined);
|
||||
await remoteDaemon.close().catch(() => undefined);
|
||||
|
||||
@@ -9,17 +9,17 @@ test("Settings language selector switches General labels", async ({ page }) => {
|
||||
await openSettings(page);
|
||||
await openSettingsSection(page, "general");
|
||||
|
||||
await expect(page.getByText("Default send", { exact: true }).first()).toBeVisible();
|
||||
await expect(page.getByText("Language", { exact: true }).first()).toBeVisible();
|
||||
|
||||
await page.getByRole("button", { name: "System", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: "简体中文 - Simplified Chinese", exact: true }).click();
|
||||
|
||||
await expect(page.getByText("默认发送", { exact: true }).first()).toBeVisible();
|
||||
await expect(page.getByText("语言", { exact: true }).first()).toBeVisible();
|
||||
|
||||
await page.getByRole("button", { name: "简体中文", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: "English - 英语", exact: true }).click();
|
||||
|
||||
await expect(page.getByText("Default send", { exact: true }).first()).toBeVisible();
|
||||
await expect(page.getByText("Language", { exact: true }).first()).toBeVisible();
|
||||
});
|
||||
|
||||
test("Settings language selector switches to Korean", async ({ page }) => {
|
||||
@@ -32,10 +32,10 @@ test("Settings language selector switches to Korean", async ({ page }) => {
|
||||
await page.getByRole("button", { name: "System", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: "한국어 - Korean", exact: true }).click();
|
||||
|
||||
await expect(page.getByText("기본 전송", { exact: true }).first()).toBeVisible();
|
||||
await expect(page.getByText("언어", { exact: true }).first()).toBeVisible();
|
||||
|
||||
await page.getByRole("button", { name: "한국어", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: "English - 영어", exact: true }).click();
|
||||
|
||||
await expect(page.getByText("Default send", { exact: true }).first()).toBeVisible();
|
||||
await expect(page.getByText("Language", { exact: true }).first()).toBeVisible();
|
||||
});
|
||||
|
||||
@@ -62,6 +62,7 @@ import {
|
||||
seedSavedSettingsHosts,
|
||||
selectSettingsHost,
|
||||
expectSettingsHostPickerLabel,
|
||||
openClientHostSettings,
|
||||
openSettingsHostSection,
|
||||
removeCurrentHostFromSettings,
|
||||
openSidebarHostPicker,
|
||||
@@ -176,28 +177,28 @@ test.describe("Settings sidebar scroll position", () => {
|
||||
}
|
||||
|
||||
const sidebar = page.getByTestId("settings-sidebar");
|
||||
const appScrollTop = await revealSettingsSidebarSection(page, "diagnostics");
|
||||
const appScrollTop = await revealSettingsSidebarSection(page, "about");
|
||||
await expect(sidebar.getByRole("button", { name: "About", exact: true })).toBeInViewport();
|
||||
|
||||
await openSettingsSection(page, "about");
|
||||
await expectAboutContent(page);
|
||||
await expectDiagnosticsContent(page);
|
||||
await expectSettingsSidebarScrollOffset(page, appScrollTop);
|
||||
|
||||
await openSettingsSection(page, "diagnostics");
|
||||
await expectDiagnosticsContent(page);
|
||||
await openSettingsSection(page, "shortcuts");
|
||||
await expectSettingsSidebarScrollOffset(page, appScrollTop);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Settings sidebar navigation", () => {
|
||||
test("the sidebar host row opens Overview in one click", async ({ page, withWorkspace }) => {
|
||||
test("the sidebar host row opens Daemon in one click", async ({ page, withWorkspace }) => {
|
||||
const workspace = await withWorkspace({ prefix: "sidebar-host-settings-" });
|
||||
await openWorkspace(page, workspace);
|
||||
await openSidebarHostPicker(page);
|
||||
await sidebarHostRowButton(page).click();
|
||||
|
||||
await expectAppRoute(page, buildSettingsHostSectionRoute(getServerId(), "host"));
|
||||
await expectAppRoute(page, buildSettingsHostSectionRoute(getServerId(), "daemon"));
|
||||
});
|
||||
|
||||
test("Enter opens the active sidebar host row", async ({ page, withWorkspace }) => {
|
||||
@@ -207,7 +208,7 @@ test.describe("Settings sidebar navigation", () => {
|
||||
await openSidebarHostPicker(page);
|
||||
await activateSidebarHostSettingsWithKeyboard(page);
|
||||
|
||||
await expectAppRoute(page, buildSettingsHostSectionRoute(getServerId(), "host"));
|
||||
await expectAppRoute(page, buildSettingsHostSectionRoute(getServerId(), "daemon"));
|
||||
});
|
||||
|
||||
test("opening Settings closes the composer model selector until it is opened again", async ({
|
||||
@@ -282,13 +283,10 @@ test.describe("Settings sidebar navigation", () => {
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
|
||||
await openSettingsSection(page, "diagnostics");
|
||||
await expectSettingsHeader(page, "Diagnostics");
|
||||
await expectDiagnosticsContent(page);
|
||||
|
||||
await openSettingsSection(page, "about");
|
||||
await expectSettingsHeader(page, "About");
|
||||
await expectAboutContent(page);
|
||||
await expectDiagnosticsContent(page);
|
||||
|
||||
await openSettingsSection(page, "general");
|
||||
await expectSettingsHeader(page, "General");
|
||||
@@ -313,18 +311,18 @@ test.describe("Settings sidebar navigation", () => {
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
await selectSettingsHost(page, secondaryServerId);
|
||||
await openSettingsHostSection(page, secondaryServerId, "connections");
|
||||
await openSettingsHostSection(page, secondaryServerId, "daemon");
|
||||
await openSettingsSection(page, "appearance");
|
||||
await expectSettingsHostPickerLabel(page, "Stable horse");
|
||||
await openSettingsSection(page, "general");
|
||||
await expectSettingsHostPickerLabel(page, "Stable horse");
|
||||
await openSettingsHostSection(page, secondaryServerId, "connections");
|
||||
await openSettingsHostSection(page, secondaryServerId, "daemon");
|
||||
await selectSettingsHost(page, primaryServerId);
|
||||
await openSettingsSection(page, "about");
|
||||
await expectSettingsHostPickerLabel(page, "First horse");
|
||||
});
|
||||
|
||||
test("/h/[serverId]/settings redirects to the host connections section", async ({ page }) => {
|
||||
test("/h/[serverId]/settings redirects to the host daemon section", async ({ page }) => {
|
||||
await gotoAppShell(page);
|
||||
await verifyLegacyHostSettingsRedirect(page);
|
||||
});
|
||||
@@ -528,12 +526,12 @@ test.describe("Settings — compact master-detail", () => {
|
||||
await gotoAppShell(page);
|
||||
await openCompactSettings(page, buildOpenProjectRoute());
|
||||
|
||||
await expectSettingsSidebarSections(page, ["general", "diagnostics", "about"]);
|
||||
await expectSettingsSidebarSections(page, ["general", "hosts", "about"]);
|
||||
await expectCompactSettingsList(page);
|
||||
|
||||
await test.step("open app details and return to the list", async () => {
|
||||
await openSettingsSection(page, "diagnostics");
|
||||
await expectAppRoute(page, buildSettingsSectionRoute("diagnostics"));
|
||||
await openSettingsSection(page, "about");
|
||||
await expectAppRoute(page, buildSettingsSectionRoute("about"));
|
||||
await expectDiagnosticsContent(page);
|
||||
await expectSettingsSidebarHidden(page);
|
||||
await expectSettingsBackButton(page);
|
||||
@@ -554,7 +552,7 @@ test.describe("Settings — compact master-detail", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("host picker settings opens Overview and backs through the settings list", async ({
|
||||
test("host picker settings opens Daemon and backs through the settings list", async ({
|
||||
page,
|
||||
withWorkspace,
|
||||
}) => {
|
||||
@@ -566,8 +564,8 @@ test.describe("Settings — compact master-detail", () => {
|
||||
await page.getByTestId("sidebar-hosts-trigger").click();
|
||||
await sidebarHostRowButton(page).click();
|
||||
|
||||
await expectAppRoute(page, buildSettingsHostSectionRoute(getServerId(), "host"));
|
||||
await expect(page.getByText("Overview", { exact: true })).toBeVisible();
|
||||
await expectAppRoute(page, buildSettingsHostSectionRoute(getServerId(), "daemon"));
|
||||
await expect(page.getByText("Daemon", { exact: true }).first()).toBeVisible();
|
||||
|
||||
await goBackInSettings(page);
|
||||
await expectCompactSettingsList(page);
|
||||
@@ -597,14 +595,14 @@ test.describe("Settings — compact master-detail", () => {
|
||||
await expectSettingsSidebarVisible(page);
|
||||
await expectSettingsHostPickerLabel(page, secondaryHostLabel);
|
||||
|
||||
await openSettingsHostSection(page, secondaryServerId, "connections");
|
||||
await openSettingsHostSection(page, secondaryServerId, "daemon");
|
||||
await goBackInSettings(page);
|
||||
await expectSettingsHostPickerLabel(page, secondaryHostLabel);
|
||||
|
||||
await openSettingsSection(page, "appearance");
|
||||
await goBackInSettings(page);
|
||||
await expectSettingsHostPickerLabel(page, secondaryHostLabel);
|
||||
await openSettingsHostSection(page, secondaryServerId, "connections");
|
||||
await openSettingsHostSection(page, secondaryServerId, "daemon");
|
||||
await goBackInSettings(page);
|
||||
await expectSettingsHostPickerLabel(page, secondaryHostLabel);
|
||||
});
|
||||
@@ -617,8 +615,9 @@ test.describe("Settings — compact master-detail", () => {
|
||||
|
||||
await openWorkspace(page, workspace);
|
||||
await openCompactSettings(page, buildHostWorkspaceRoute(getServerId(), workspace.workspaceId));
|
||||
await openSettingsHostSection(page, getServerId(), "host");
|
||||
await openClientHostSettings(page, getServerId());
|
||||
await removeCurrentHostFromSettings(page);
|
||||
await goBackInSettings(page);
|
||||
await closeCompactSettings(page);
|
||||
|
||||
await expect(page).toHaveURL(/\/welcome$/);
|
||||
|
||||
@@ -5,6 +5,7 @@ import { createMockIdleAgent, openWorkspaceWithAgents } from "../support/helpers
|
||||
import { waitForTabBar, expectAgentTabActive } from "../support/helpers/launcher";
|
||||
import { seedWorkspace } from "../support/helpers/seed-client";
|
||||
import { getServerId } from "../support/helpers/server-id";
|
||||
import { openSettingsSection } from "../support/helpers/settings";
|
||||
|
||||
async function pressSettingsToggleShortcut(page: import("@playwright/test").Page) {
|
||||
const modifier = process.platform === "darwin" ? "Meta" : "Control";
|
||||
@@ -134,6 +135,7 @@ test.describe("Settings toggle tab regression", () => {
|
||||
|
||||
await pressSettingsToggleShortcut(page);
|
||||
await expect(page).toHaveURL(/\/settings\/general$/);
|
||||
await openSettingsSection(page, "chat");
|
||||
|
||||
const defaultSendTrigger = page.getByRole("button", {
|
||||
name: "Default send: Steer",
|
||||
@@ -324,6 +326,7 @@ test("send shortcut selection persists and controls the composer", async ({ page
|
||||
});
|
||||
await test.step("choose the explicit modifier shortcut and retain it after reload", async () => {
|
||||
await pressSettingsToggleShortcut(page);
|
||||
await openSettingsSection(page, "chat");
|
||||
await expect(
|
||||
page.getByRole("button", { name: "Send shortcut: Enter", exact: true }),
|
||||
).toBeVisible();
|
||||
@@ -351,6 +354,7 @@ test("send shortcut selection persists and controls the composer", async ({ page
|
||||
});
|
||||
await test.step("switch back to Enter without changing the default send behavior", async () => {
|
||||
await pressSettingsToggleShortcut(page);
|
||||
await openSettingsSection(page, "chat");
|
||||
await selectSendingOption(page, "Send shortcut", "Enter");
|
||||
await pressSettingsToggleShortcut(page);
|
||||
await composer.fill("Shift still edits");
|
||||
@@ -375,6 +379,7 @@ for (const behavior of ["Steer", "Interrupt", "Queue"] as const) {
|
||||
await openAgentRoute(page, agent);
|
||||
await expect(page.getByRole("textbox", { name: "Message agent..." })).toBeVisible();
|
||||
await pressSettingsToggleShortcut(page);
|
||||
await openSettingsSection(page, "chat");
|
||||
await selectSendingOption(page, "Send shortcut", `${modifierLabel}+Enter`);
|
||||
await selectSendingOption(page, "Default send", behavior);
|
||||
await pressSettingsToggleShortcut(page);
|
||||
|
||||
@@ -175,7 +175,7 @@ test("searches keyboard shortcuts from the sidebar help menu", async ({ page })
|
||||
test("keeps diagnostics available from Settings after globalizing the sheet", async ({ page }) => {
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
await openSettingsSection(page, "diagnostics");
|
||||
await openSettingsSection(page, "about");
|
||||
|
||||
await page.getByRole("button", { name: "Run", exact: true }).click();
|
||||
await expectDiagnosticReport(page);
|
||||
|
||||
@@ -38,9 +38,6 @@ fill "id=\"direct-password-input\"" "${PASSWORD}"
|
||||
wait stable
|
||||
press "id=\"direct-host-submit\""
|
||||
wait stable
|
||||
open "${APP_ID}" "paseo://settings"
|
||||
wait "label=\"Connections\"" 10000
|
||||
press "label=\"Connections\""
|
||||
wait stable
|
||||
wait "id=\"host-page-connections-card\"" 30000
|
||||
open "${APP_ID}" "paseo://settings/hosts"
|
||||
wait "id=\"client-hosts-card\"" 15000
|
||||
screenshot "${OUT}/16-settings-connected.png"
|
||||
|
||||
@@ -134,9 +134,13 @@ export async function openAgentSkillsSettings(
|
||||
host: "127.0.0.1",
|
||||
port: sandbox.daemon.port,
|
||||
});
|
||||
if (options.compact) await goBackInSettings(page);
|
||||
if (options.compact) {
|
||||
// Adding a host opens its client host detail page; back once goes to Hosts, back again returns to the Settings root.
|
||||
await goBackInSettings(page);
|
||||
await goBackInSettings(page);
|
||||
}
|
||||
await selectSettingsHost(page, sandbox.daemon.serverId);
|
||||
await openHostSection(page, sandbox.daemon.serverId, "agents");
|
||||
await openHostSection(page, sandbox.daemon.serverId, "tools");
|
||||
await expect(page.getByTestId("host-agent-skills-card")).toBeVisible();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ export async function openDaemonOverview(page: Page, daemon: IsolatedHostDaemon)
|
||||
await page.reload();
|
||||
await openSettings(page);
|
||||
await openSettingsHost(page, daemon.serverId);
|
||||
await openHostSection(page, daemon.serverId, "host");
|
||||
await openHostSection(page, daemon.serverId, "daemon");
|
||||
}
|
||||
|
||||
export async function restartDaemonInSettings(
|
||||
|
||||
@@ -2,7 +2,7 @@ import { expect, type Page } from "@playwright/test";
|
||||
import { identityForeground, type IdentityColorName } from "@/styles/identity-colors";
|
||||
import { openSettings } from "./app";
|
||||
import { buildSeededHost } from "./daemon-registry";
|
||||
import { clickSettingsBackToWorkspace, openHostSection, selectSettingsHost } from "./settings";
|
||||
import { clickSettingsBackToWorkspace, openClientHostSettings } from "./settings";
|
||||
|
||||
const REGISTRY_KEY = "@paseo:daemon-registry";
|
||||
const SEED_NONCE_KEY = "@paseo:e2e-seed-nonce";
|
||||
@@ -170,8 +170,7 @@ export async function selectAllHostsFilter(page: Page): Promise<void> {
|
||||
|
||||
export async function openHostAppearanceSettings(page: Page, serverId: string): Promise<void> {
|
||||
await openSettings(page);
|
||||
await selectSettingsHost(page, serverId);
|
||||
await openHostSection(page, serverId, "host");
|
||||
await openClientHostSettings(page, serverId);
|
||||
await expect(page.getByTestId("host-appearance-preview")).toBeVisible({ timeout: 15_000 });
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import { buildCreateAgentPreferences, buildSeededHost, TEST_HOST_LABEL } from ".
|
||||
import { getServerId } from "./server-id";
|
||||
import { expectAppRoute } from "./route-assertions";
|
||||
import {
|
||||
buildClientHostSettingsRoute,
|
||||
buildSettingsHostSectionRoute,
|
||||
buildSettingsRoute,
|
||||
buildSettingsSectionRoute,
|
||||
@@ -47,36 +48,29 @@ interface SavedSettingsHostInput {
|
||||
|
||||
const SECTION_LABELS = {
|
||||
general: "General",
|
||||
chat: "Chat",
|
||||
hosts: "Hosts",
|
||||
appearance: "Appearance",
|
||||
sidebar: "Sidebar",
|
||||
editor: "Editor",
|
||||
files: "Files",
|
||||
terminal: "Terminal",
|
||||
browser: "Browser",
|
||||
chat: "Chat & panes",
|
||||
shortcuts: "Shortcuts",
|
||||
integrations: "Integrations",
|
||||
notifications: "Notifications",
|
||||
permissions: "Permissions",
|
||||
diagnostics: "Diagnostics",
|
||||
about: "About",
|
||||
} as const;
|
||||
|
||||
export type SettingsSection = keyof typeof SECTION_LABELS;
|
||||
|
||||
type HostSection =
|
||||
| "projects"
|
||||
| "connections"
|
||||
| "devices"
|
||||
| "agents"
|
||||
| "metadata"
|
||||
| "voice"
|
||||
| "workspaces"
|
||||
| "providers"
|
||||
| "agent-profiles"
|
||||
| "tools"
|
||||
| "projects"
|
||||
| "workspaces"
|
||||
| "voice"
|
||||
| "usage"
|
||||
| "terminals"
|
||||
| "plugins"
|
||||
| "host";
|
||||
| "devices"
|
||||
| "daemon";
|
||||
|
||||
export async function openSettingsSection(page: Page, section: SettingsSection): Promise<void> {
|
||||
const sidebar = page.getByTestId("settings-sidebar");
|
||||
@@ -199,14 +193,19 @@ export async function expectSettingsDetailScrollOffset(page: Page, offset: numbe
|
||||
await expect.poll(() => scrollBody.evaluate((node) => node.scrollTop)).toBe(offset);
|
||||
}
|
||||
|
||||
export async function openSettingsHost(page: Page, serverId: string): Promise<void> {
|
||||
// Host sections are now flat top-level rows under the Host group. Navigate by
|
||||
// clicking the Connections section row; the picker only matters when >1 host.
|
||||
await page.getByTestId("settings-host-section-connections").click();
|
||||
await expectHostSettingsUrl(page, serverId);
|
||||
export async function openClientHostSettings(page: Page, serverId: string): Promise<void> {
|
||||
await openSettingsSection(page, "hosts");
|
||||
await page.getByTestId(`client-host-row-${serverId}`).click();
|
||||
await expectAppRoute(page, buildClientHostSettingsRoute(serverId));
|
||||
await expect(page.getByTestId("host-page-connections-card")).toBeVisible();
|
||||
}
|
||||
|
||||
export async function openSettingsHost(page: Page, serverId: string): Promise<void> {
|
||||
await page.getByTestId("settings-host-section-daemon").click();
|
||||
await expectHostSettingsUrl(page, serverId);
|
||||
await expect(page.getByTestId("host-page-identity")).toBeVisible();
|
||||
}
|
||||
|
||||
export async function openSettingsHostSection(
|
||||
page: Page,
|
||||
serverId: string,
|
||||
@@ -368,7 +367,7 @@ export async function removeCurrentHostFromSettings(page: Page): Promise<void> {
|
||||
await page.getByTestId("host-page-remove-host-button").click();
|
||||
await expect(page.getByTestId("remove-host-confirm-modal")).toBeVisible();
|
||||
await page.getByTestId("remove-host-confirm").click();
|
||||
await expectAppRoute(page, buildSettingsRoute());
|
||||
await expectAppRoute(page, buildSettingsSectionRoute("hosts"));
|
||||
}
|
||||
|
||||
export async function expectSettingsBackButton(page: Page): Promise<void> {
|
||||
@@ -380,7 +379,7 @@ export async function clickSettingsBackToWorkspace(page: Page): Promise<void> {
|
||||
}
|
||||
|
||||
export async function expectHostSettingsUrl(page: Page, serverId: string): Promise<void> {
|
||||
await expectAppRoute(page, buildSettingsHostSectionRoute(serverId, "connections"));
|
||||
await expectAppRoute(page, buildSettingsHostSectionRoute(serverId, "daemon"));
|
||||
}
|
||||
|
||||
export async function verifyLegacyHostSettingsRedirect(page: Page): Promise<void> {
|
||||
@@ -450,7 +449,7 @@ export async function expectAboutContent(page: Page): Promise<void> {
|
||||
}
|
||||
|
||||
export async function expectGeneralContent(page: Page): Promise<void> {
|
||||
await expect(page.getByText("Default send", { exact: true }).first()).toBeVisible();
|
||||
await expect(page.getByText("Language", { exact: true }).first()).toBeVisible();
|
||||
}
|
||||
|
||||
export async function expectAppearanceContent(page: Page): Promise<void> {
|
||||
@@ -475,14 +474,7 @@ export async function expectHostLabelEditMode(page: Page, expectedLabel: string)
|
||||
export async function expectHostConnectionsCard(page: Page, port: string): Promise<void> {
|
||||
const card = page.getByTestId("host-page-connections-card");
|
||||
await expect(card).toBeVisible();
|
||||
// "Connections" appears three times on this page: the sidebar section row, the
|
||||
// detail header title, and the SettingsSection heading above the card. Match
|
||||
// the first to keep the heading assertion without tripping Playwright strict
|
||||
// mode.
|
||||
await expect(page.getByText("Connections", { exact: true }).first()).toBeVisible();
|
||||
await expect(
|
||||
card.getByText(new RegExp(`TCP \\((localhost|127\\.0\\.0\\.1):${port}\\)`)),
|
||||
).toBeVisible();
|
||||
await expect(card.getByText(new RegExp(`(localhost|127\\.0\\.0\\.1):${port}`))).toBeVisible();
|
||||
}
|
||||
|
||||
export async function expectHostInjectMcpCard(page: Page): Promise<void> {
|
||||
@@ -519,11 +511,11 @@ export async function openHostSection(
|
||||
}
|
||||
|
||||
export async function expectHostActionCards(page: Page, serverId: string): Promise<void> {
|
||||
// Restart + remove cards live on the Host section; providers moved to its
|
||||
// own Providers section (asserted via expectHostProvidersCard).
|
||||
await openSettingsHostSection(page, serverId, "host");
|
||||
// Restart lives on Daemon; removing the saved host lives on This device -> Hosts.
|
||||
await openSettingsHostSection(page, serverId, "daemon");
|
||||
await expect(page.getByTestId("host-page-restart-card")).toBeVisible();
|
||||
await expect(page.getByTestId("host-page-restart-button")).toBeVisible();
|
||||
await openClientHostSettings(page, serverId);
|
||||
await expect(page.getByTestId("host-page-remove-host-card")).toBeVisible();
|
||||
await expect(page.getByTestId("host-page-remove-host-button")).toBeVisible();
|
||||
}
|
||||
@@ -642,27 +634,30 @@ export async function expectRetiredSidebarSectionsAbsent(page: Page): Promise<vo
|
||||
const sidebar = page.getByTestId("settings-sidebar");
|
||||
await expect(sidebar).toBeVisible();
|
||||
|
||||
// App group rows remain top-level.
|
||||
// App group ("This device") rows remain top-level.
|
||||
await expect(sidebar.getByRole("button", { name: "General", exact: true })).toBeVisible();
|
||||
await expect(sidebar.getByRole("button", { name: "Diagnostics", exact: true })).toBeVisible();
|
||||
await expect(sidebar.getByRole("button", { name: "Hosts", exact: true })).toBeVisible();
|
||||
await expect(sidebar.getByRole("button", { name: "About", exact: true })).toBeVisible();
|
||||
await expect(sidebar.getByRole("button", { name: "Daemon", exact: true })).toHaveCount(0);
|
||||
await expect(sidebar.getByRole("button", { name: "Diagnostics", exact: true })).toHaveCount(0);
|
||||
|
||||
// Host group rows are now flat top-level sections (no drill-in).
|
||||
await expect(sidebar.getByTestId("settings-host-section-connections")).toBeVisible();
|
||||
await expect(sidebar.getByTestId("settings-host-section-projects")).toBeVisible();
|
||||
await expect(sidebar.getByTestId("settings-host-section-agents")).toBeVisible();
|
||||
await expect(sidebar.getByTestId("settings-host-section-workspaces")).toBeVisible();
|
||||
// Host group rows are daemon-scoped flat top-level sections.
|
||||
await expect(sidebar.getByTestId("settings-host-section-providers")).toBeVisible();
|
||||
await expect(sidebar.getByTestId("settings-host-section-agent-profiles")).toBeVisible();
|
||||
await expect(sidebar.getByTestId("settings-host-section-tools")).toBeVisible();
|
||||
await expect(sidebar.getByTestId("settings-host-section-projects")).toBeVisible();
|
||||
await expect(sidebar.getByTestId("settings-host-section-workspaces")).toBeVisible();
|
||||
await expect(sidebar.getByTestId("settings-host-section-usage")).toBeVisible();
|
||||
await expect(sidebar.getByTestId("settings-host-section-host")).toBeVisible();
|
||||
await expect(sidebar.getByTestId("settings-host-section-daemon")).toBeVisible();
|
||||
|
||||
// The old per-host entry rows are replaced by the host picker.
|
||||
// Retired host rows and old per-host entry rows are absent.
|
||||
await expect(sidebar.getByTestId("settings-host-section-connections")).toHaveCount(0);
|
||||
await expect(sidebar.getByTestId("settings-host-section-agents")).toHaveCount(0);
|
||||
await expect(sidebar.getByTestId("settings-host-section-metadata")).toHaveCount(0);
|
||||
await expect(sidebar.locator('[data-testid^="settings-host-entry-"]')).toHaveCount(0);
|
||||
}
|
||||
|
||||
export async function expectHostPageVisible(page: Page, _serverId: string): Promise<void> {
|
||||
await expect(page.getByTestId("host-page-connections-card")).toBeVisible();
|
||||
await expect(page.getByTestId("host-page-identity")).toBeVisible();
|
||||
}
|
||||
|
||||
export async function expectLocalHostEntryFirst(page: Page, _serverId: string): Promise<void> {
|
||||
@@ -698,7 +693,7 @@ export async function expectNoHostPasswordControls(page: Page): Promise<void> {
|
||||
export async function removeHostFromHostPage(page: Page, serverId: string): Promise<void> {
|
||||
await page.getByTestId("host-page-remove-host-button").click();
|
||||
await page.getByTestId("remove-host-confirm").click();
|
||||
await expect(page).not.toHaveURL(new RegExp(`/settings/hosts/${serverId}`));
|
||||
await expect(page).not.toHaveURL(new RegExp(`/settings/(hosts|device-hosts)/${serverId}`));
|
||||
}
|
||||
|
||||
export async function expectHostOnlineWithoutError(page: Page): Promise<void> {
|
||||
|
||||
@@ -925,12 +925,14 @@ function RootStack() {
|
||||
<Stack.Screen name="welcome" />
|
||||
<Stack.Screen name="settings/index" />
|
||||
<Stack.Screen name="settings/[section]" />
|
||||
<Stack.Screen name="settings/hosts/index" />
|
||||
<Stack.Screen name="new" />
|
||||
<Stack.Screen name="open-project" />
|
||||
<Stack.Screen name="sessions" />
|
||||
<Stack.Screen name="schedules" />
|
||||
</Stack.Protected>
|
||||
<Stack.Screen name="h/[serverId]" />
|
||||
<Stack.Screen name="settings/device-hosts/[serverId]" />
|
||||
<Stack.Screen name="settings/hosts/[serverId]/index" />
|
||||
<Stack.Screen name="settings/hosts/[serverId]/[hostSection]" />
|
||||
<Stack.Screen name="settings/hosts/[serverId]/plugins/[pluginId]/index" />
|
||||
|
||||
@@ -9,7 +9,9 @@ import { StartupSplashScreen } from "@/screens/startup-splash-screen";
|
||||
import {
|
||||
buildSettingsHostSectionRoute,
|
||||
buildSettingsRoute,
|
||||
buildSettingsSectionRoute,
|
||||
isSettingsSectionSlug,
|
||||
normalizeSettingsSectionSlug,
|
||||
type SettingsSectionSlug,
|
||||
} from "@/utils/host-routes";
|
||||
|
||||
@@ -28,7 +30,7 @@ function SettingsDaemonRedirect() {
|
||||
localDaemon.serverId !== null &&
|
||||
hosts.some((host) => host.serverId === localDaemon.serverId)
|
||||
) {
|
||||
return <Redirect href={buildSettingsHostSectionRoute(localDaemon.serverId, "host")} />;
|
||||
return <Redirect href={buildSettingsHostSectionRoute(localDaemon.serverId, "daemon")} />;
|
||||
}
|
||||
|
||||
return <Redirect href={buildSettingsRoute()} />;
|
||||
@@ -37,7 +39,8 @@ function SettingsDaemonRedirect() {
|
||||
export default function SettingsSectionRoute() {
|
||||
const params = useLocalSearchParams<{ section?: string }>();
|
||||
const rawSection = typeof params.section === "string" ? params.section : "";
|
||||
const section: SettingsSectionSlug = isSettingsSectionSlug(rawSection) ? rawSection : "general";
|
||||
const normalized = normalizeSettingsSectionSlug(rawSection);
|
||||
const section: SettingsSectionSlug = normalized ?? "general";
|
||||
const view = useMemo(() => ({ kind: "section" as const, section }), [section]);
|
||||
|
||||
// COMPAT(settingsDaemonRedirect): added 2026-07-08, remove after 2027-01-08.
|
||||
@@ -49,5 +52,9 @@ export default function SettingsSectionRoute() {
|
||||
);
|
||||
}
|
||||
|
||||
if (normalized && !isSettingsSectionSlug(rawSection)) {
|
||||
return <Redirect href={buildSettingsSectionRoute(normalized)} />;
|
||||
}
|
||||
|
||||
return <SettingsScreen view={view} />;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { Redirect, useLocalSearchParams } from "expo-router";
|
||||
import { useMemo } from "react";
|
||||
import { HostRouteBootstrapBoundary } from "@/components/host-route-bootstrap-boundary";
|
||||
import SettingsScreen from "@/screens/settings-screen";
|
||||
import { buildSettingsSectionRoute } from "@/utils/host-routes";
|
||||
|
||||
export default function SettingsDeviceHostDetailRoute() {
|
||||
const params = useLocalSearchParams<{ serverId?: string }>();
|
||||
const serverId = typeof params.serverId === "string" ? params.serverId.trim() : "";
|
||||
const view = useMemo(() => ({ kind: "clientHost" as const, serverId }), [serverId]);
|
||||
|
||||
if (!serverId) {
|
||||
return <Redirect href={buildSettingsSectionRoute("hosts")} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<HostRouteBootstrapBoundary>
|
||||
<SettingsScreen view={view} />
|
||||
</HostRouteBootstrapBoundary>
|
||||
);
|
||||
}
|
||||
@@ -2,17 +2,27 @@ import { Redirect, useLocalSearchParams } from "expo-router";
|
||||
import { useMemo } from "react";
|
||||
import { HostRouteBootstrapBoundary } from "@/components/host-route-bootstrap-boundary";
|
||||
import SettingsScreen from "@/screens/settings-screen";
|
||||
import { buildSettingsHostSectionRoute, normalizeHostSectionSlug } from "@/utils/host-routes";
|
||||
import {
|
||||
buildClientHostSettingsRoute,
|
||||
buildSettingsHostSectionRoute,
|
||||
isHostSectionSlug,
|
||||
normalizeHostSectionSlug,
|
||||
} from "@/utils/host-routes";
|
||||
|
||||
export default function SettingsHostSectionRoute() {
|
||||
const params = useLocalSearchParams<{ serverId?: string; hostSection?: string }>();
|
||||
const serverId = typeof params.serverId === "string" ? params.serverId.trim() : "";
|
||||
const rawSection = typeof params.hostSection === "string" ? params.hostSection : "";
|
||||
const section = normalizeHostSectionSlug(rawSection) ?? "connections";
|
||||
const normalized = normalizeHostSectionSlug(rawSection);
|
||||
const section = normalized ?? "daemon";
|
||||
const view = useMemo(() => ({ kind: "host" as const, serverId, section }), [serverId, section]);
|
||||
|
||||
if (rawSection === "pair-device" && serverId) {
|
||||
return <Redirect href={buildSettingsHostSectionRoute(serverId, "devices")} />;
|
||||
if (rawSection === "connections" && serverId) {
|
||||
return <Redirect href={buildClientHostSettingsRoute(serverId)} />;
|
||||
}
|
||||
|
||||
if (normalized && !isHostSectionSlug(rawSection) && serverId) {
|
||||
return <Redirect href={buildSettingsHostSectionRoute(serverId, normalized)} />;
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -9,5 +9,5 @@ export default function SettingsHostIndexRoute() {
|
||||
return <Redirect href={buildSettingsRoute()} />;
|
||||
}
|
||||
|
||||
return <Redirect href={buildSettingsHostSectionRoute(serverId, "connections")} />;
|
||||
return <Redirect href={buildSettingsHostSectionRoute(serverId, "daemon")} />;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import SettingsScreen from "@/screens/settings-screen";
|
||||
|
||||
const HOSTS_VIEW = { kind: "section" as const, section: "hosts" as const };
|
||||
|
||||
export default function SettingsHostsSectionRoute() {
|
||||
return <SettingsScreen view={HOSTS_VIEW} />;
|
||||
}
|
||||
@@ -227,7 +227,7 @@ export const LeftSidebar = memo(function LeftSidebar({
|
||||
openSettingsFromSidebar({
|
||||
workspace: activeWorkspace,
|
||||
isCompact: isCompactLayout,
|
||||
route: buildSettingsHostSectionRoute(serverId, "host"),
|
||||
route: buildSettingsHostSectionRoute(serverId, "daemon"),
|
||||
});
|
||||
},
|
||||
[activeWorkspace, isCompactLayout],
|
||||
|
||||
@@ -49,6 +49,7 @@ interface AppRowExtras {
|
||||
leading?: ReactNode;
|
||||
/** A page outside the app that helps with this row, drawn under the hint as "Label ↗". */
|
||||
link?: Pick<ExternalLinkProps, "href" | "label" | "accessibilityLabel">;
|
||||
errorTestID?: string;
|
||||
}
|
||||
|
||||
interface AppSettingsRowProps extends Omit<SettingsRowProps, "hint">, AppRowExtras {
|
||||
@@ -77,6 +78,7 @@ export function SettingsRow({
|
||||
hint,
|
||||
link,
|
||||
error,
|
||||
errorTestID,
|
||||
children,
|
||||
testID,
|
||||
}: AppSettingsRowProps) {
|
||||
@@ -95,7 +97,7 @@ export function SettingsRow({
|
||||
</View>
|
||||
) : null}
|
||||
{error ? (
|
||||
<Text accessibilityRole="alert" style={settingsStyles.rowError}>
|
||||
<Text accessibilityRole="alert" style={settingsStyles.rowError} testID={errorTestID}>
|
||||
{error}
|
||||
</Text>
|
||||
) : null}
|
||||
|
||||
@@ -37,7 +37,7 @@ export function useEnableBuiltInDaemonOption(): EnableBuiltInDaemonOption {
|
||||
void (async () => {
|
||||
const result = await enable();
|
||||
if (result?.kind === "enabled") {
|
||||
router.push(buildSettingsHostSectionRoute(result.newStatus.serverId, "host"));
|
||||
router.push(buildSettingsHostSectionRoute(result.newStatus.serverId, "daemon"));
|
||||
}
|
||||
})();
|
||||
}, [enable]);
|
||||
|
||||
@@ -2416,7 +2416,7 @@ export const ar: TranslationResources = {
|
||||
title: "إعدادات",
|
||||
loading: "جارٍ تحميل الإعدادات...",
|
||||
groups: {
|
||||
app: "برنامج",
|
||||
app: "هذا الجهاز",
|
||||
host: "Host",
|
||||
},
|
||||
hostPicker: {
|
||||
@@ -2434,7 +2434,9 @@ export const ar: TranslationResources = {
|
||||
groupInfo: "حول{{title}}",
|
||||
sections: {
|
||||
general: "عام",
|
||||
hosts: "المضيفون",
|
||||
chat: "الدردشة",
|
||||
chatAndPanes: "الدردشة والأجزاء",
|
||||
appearance: "مظهر",
|
||||
sidebar: "الشريط الجانبي",
|
||||
terminal: "الطرفية",
|
||||
@@ -2448,6 +2450,16 @@ export const ar: TranslationResources = {
|
||||
diagnostics: "التشخيص",
|
||||
about: "عن",
|
||||
},
|
||||
clientHosts: {
|
||||
title: "المضيفون المحفوظون",
|
||||
info: "المضيفون الذين يتصل بهم هذا الجهاز. الأسماء والأيقونات والشارات والمسارات هنا تؤثر على هذا الجهاز فقط.",
|
||||
backToHosts: "العودة إلى المضيفين",
|
||||
routesTitle: "كيف يتصل هذا الجهاز",
|
||||
routesInfo:
|
||||
"المسارات المحفوظة التي يستخدمها هذا الجهاز للوصول إلى هذا المضيف. يختار Paseo أسرع مسار متاح.",
|
||||
addRoute: "إضافة مسار",
|
||||
activeRoute: "نشط",
|
||||
},
|
||||
layout: en.settings.layout,
|
||||
editor: {
|
||||
title: "المحرر",
|
||||
@@ -2522,6 +2534,7 @@ export const ar: TranslationResources = {
|
||||
projects: "المشاريع",
|
||||
connections: "اتصالات",
|
||||
agents: "Agents",
|
||||
tools: "الأدوات والتعليمات",
|
||||
agentProfiles: "ملفات الوكيل",
|
||||
metadata: "البيانات الوصفية",
|
||||
voice: "الصوت",
|
||||
@@ -2531,6 +2544,7 @@ export const ar: TranslationResources = {
|
||||
terminals: "Terminals",
|
||||
plugins: "Plugins",
|
||||
host: "نظرة عامة",
|
||||
daemon: "الخدمة",
|
||||
},
|
||||
plugins: pluginSettings.ar,
|
||||
metadataGeneration: {
|
||||
@@ -3068,6 +3082,10 @@ export const ar: TranslationResources = {
|
||||
delete: "حذف المهارة",
|
||||
},
|
||||
},
|
||||
tools: {
|
||||
instructionsTitle: "التعليمات",
|
||||
toolsTitle: "أدوات الوكلاء",
|
||||
},
|
||||
orchestration: {
|
||||
title: "التنسيق",
|
||||
unavailable: "اتصل بهذا المضيف لإدارة التنسيق",
|
||||
@@ -3194,6 +3212,7 @@ export const ar: TranslationResources = {
|
||||
},
|
||||
},
|
||||
daemon: {
|
||||
runtimeTitle: "بيئة تشغيل الوكلاء",
|
||||
rename: {
|
||||
editLabel: "تحرير التسمية",
|
||||
title: "إعادة تسمية المضيف",
|
||||
|
||||
@@ -2410,7 +2410,7 @@ export const en = {
|
||||
title: "Settings",
|
||||
loading: "Loading settings...",
|
||||
groups: {
|
||||
app: "App",
|
||||
app: "This device",
|
||||
host: "Host",
|
||||
},
|
||||
hostPicker: {
|
||||
@@ -2428,7 +2428,9 @@ export const en = {
|
||||
groupInfo: "About {{title}}",
|
||||
sections: {
|
||||
general: "General",
|
||||
hosts: "Hosts",
|
||||
chat: "Chat",
|
||||
chatAndPanes: "Chat & panes",
|
||||
appearance: "Appearance",
|
||||
sidebar: "Sidebar",
|
||||
editor: "Editor",
|
||||
@@ -2442,6 +2444,16 @@ export const en = {
|
||||
diagnostics: "Diagnostics",
|
||||
about: "About",
|
||||
},
|
||||
clientHosts: {
|
||||
title: "Saved hosts",
|
||||
info: "Hosts this device connects to. Names, icons, badges, and routes here only affect this device.",
|
||||
backToHosts: "Back to hosts",
|
||||
routesTitle: "How this device connects",
|
||||
routesInfo:
|
||||
"Saved routes this device uses to reach this host. Paseo picks the fastest available route.",
|
||||
addRoute: "Add route",
|
||||
activeRoute: "Active",
|
||||
},
|
||||
layout: {
|
||||
openInSidePane: {
|
||||
title: "Open location",
|
||||
@@ -2555,6 +2567,7 @@ export const en = {
|
||||
projects: "Projects",
|
||||
connections: "Connections",
|
||||
agents: "Agents",
|
||||
tools: "Tools & prompts",
|
||||
agentProfiles: "Agent profiles",
|
||||
metadata: "Metadata",
|
||||
voice: "Voice",
|
||||
@@ -2564,6 +2577,7 @@ export const en = {
|
||||
terminals: "Terminals",
|
||||
plugins: "Plugins",
|
||||
host: "Overview",
|
||||
daemon: "Daemon",
|
||||
},
|
||||
plugins: {
|
||||
gallery: pluginGallery.en,
|
||||
@@ -3128,9 +3142,9 @@ export const en = {
|
||||
rowTitle: "Pair a device",
|
||||
},
|
||||
skills: {
|
||||
sectionTitle: "Orchestration skills",
|
||||
title: "Orchestration skills",
|
||||
description: "Teach your agents how to use Paseo tools",
|
||||
sectionTitle: "Skills",
|
||||
title: "Paseo skills",
|
||||
description: "Install bundled help, plugin, and orchestration skills",
|
||||
docs: "Skills",
|
||||
openDocs: "Open skills documentation",
|
||||
unavailable: "Connect to this host to manage orchestration skills",
|
||||
@@ -3168,6 +3182,10 @@ export const en = {
|
||||
delete: "Delete skill",
|
||||
},
|
||||
},
|
||||
tools: {
|
||||
instructionsTitle: "Instructions",
|
||||
toolsTitle: "Agent tools",
|
||||
},
|
||||
orchestration: {
|
||||
title: "Orchestration",
|
||||
unavailable: "Connect to this host to manage orchestration",
|
||||
@@ -3294,6 +3312,7 @@ export const en = {
|
||||
},
|
||||
},
|
||||
daemon: {
|
||||
runtimeTitle: "Agent runtime",
|
||||
rename: {
|
||||
editLabel: "Edit label",
|
||||
title: "Rename host",
|
||||
|
||||
@@ -2436,7 +2436,7 @@ export const es: TranslationResources = {
|
||||
title: "Ajustes",
|
||||
loading: "Cargando configuración...",
|
||||
groups: {
|
||||
app: "Aplicación",
|
||||
app: "Este dispositivo",
|
||||
host: "Host",
|
||||
},
|
||||
hostPicker: {
|
||||
@@ -2454,7 +2454,9 @@ export const es: TranslationResources = {
|
||||
groupInfo: "Acerca de{{title}}",
|
||||
sections: {
|
||||
general: "General",
|
||||
hosts: "Hosts",
|
||||
chat: "Chat",
|
||||
chatAndPanes: "Chat y paneles",
|
||||
appearance: "Apariencia",
|
||||
sidebar: "Barra lateral",
|
||||
terminal: "Terminal",
|
||||
@@ -2468,6 +2470,16 @@ export const es: TranslationResources = {
|
||||
diagnostics: "Diagnóstico",
|
||||
about: "Acerca de",
|
||||
},
|
||||
clientHosts: {
|
||||
title: "Hosts guardados",
|
||||
info: "Hosts a los que se conecta este dispositivo. Los nombres, iconos, insignias y rutas aquí solo afectan a este dispositivo.",
|
||||
backToHosts: "Volver a hosts",
|
||||
routesTitle: "Cómo se conecta este dispositivo",
|
||||
routesInfo:
|
||||
"Rutas guardadas que usa este dispositivo para llegar a este host. Paseo elige la más rápida disponible.",
|
||||
addRoute: "Añadir ruta",
|
||||
activeRoute: "Activa",
|
||||
},
|
||||
layout: en.settings.layout,
|
||||
editor: {
|
||||
title: "Editor",
|
||||
@@ -2544,6 +2556,7 @@ export const es: TranslationResources = {
|
||||
projects: "Proyectos",
|
||||
connections: "Conexiones",
|
||||
agents: "Agents",
|
||||
tools: "Herramientas e instrucciones",
|
||||
agentProfiles: "Perfiles de agente",
|
||||
metadata: "Metadatos",
|
||||
voice: "Voz",
|
||||
@@ -2553,6 +2566,7 @@ export const es: TranslationResources = {
|
||||
terminals: "Terminals",
|
||||
plugins: "Plugins",
|
||||
host: "Resumen",
|
||||
daemon: "Daemon",
|
||||
},
|
||||
plugins: pluginSettings.es,
|
||||
metadataGeneration: {
|
||||
@@ -3101,6 +3115,10 @@ export const es: TranslationResources = {
|
||||
delete: "Eliminar habilidad",
|
||||
},
|
||||
},
|
||||
tools: {
|
||||
instructionsTitle: "Instrucciones",
|
||||
toolsTitle: "Herramientas de agentes",
|
||||
},
|
||||
orchestration: {
|
||||
title: "Orquestación",
|
||||
unavailable: "Conéctese a este host para administrar la orquestación",
|
||||
@@ -3228,6 +3246,7 @@ export const es: TranslationResources = {
|
||||
},
|
||||
},
|
||||
daemon: {
|
||||
runtimeTitle: "Ejecución de agentes",
|
||||
rename: {
|
||||
editLabel: "Editar etiqueta",
|
||||
title: "Cambiar nombre de host",
|
||||
|
||||
@@ -2435,7 +2435,7 @@ export const fr: TranslationResources = {
|
||||
title: "Paramètres",
|
||||
loading: "Chargement des paramètres…",
|
||||
groups: {
|
||||
app: "Application",
|
||||
app: "Cet appareil",
|
||||
host: "Hôte",
|
||||
},
|
||||
hostPicker: {
|
||||
@@ -2453,7 +2453,9 @@ export const fr: TranslationResources = {
|
||||
groupInfo: "À propos de {{title}}",
|
||||
sections: {
|
||||
general: "Général",
|
||||
hosts: "Hôtes",
|
||||
chat: "Discussion",
|
||||
chatAndPanes: "Chat et panneaux",
|
||||
appearance: "Apparence",
|
||||
sidebar: "Barre latérale",
|
||||
terminal: "Terminal",
|
||||
@@ -2467,6 +2469,16 @@ export const fr: TranslationResources = {
|
||||
diagnostics: "Diagnostic",
|
||||
about: "À propos",
|
||||
},
|
||||
clientHosts: {
|
||||
title: "Hôtes enregistrés",
|
||||
info: "Hôtes auxquels cet appareil se connecte. Les noms, icônes, badges et routes ici ne concernent que cet appareil.",
|
||||
backToHosts: "Retour aux hôtes",
|
||||
routesTitle: "Comment cet appareil se connecte",
|
||||
routesInfo:
|
||||
"Routes enregistrées utilisées par cet appareil pour joindre cet hôte. Paseo choisit la plus rapide disponible.",
|
||||
addRoute: "Ajouter une route",
|
||||
activeRoute: "Active",
|
||||
},
|
||||
layout: en.settings.layout,
|
||||
editor: {
|
||||
title: "Éditeur",
|
||||
@@ -2544,6 +2556,7 @@ export const fr: TranslationResources = {
|
||||
projects: "Projets",
|
||||
connections: "Connexions",
|
||||
agents: "Agents",
|
||||
tools: "Outils et instructions",
|
||||
agentProfiles: "Profils d’agent",
|
||||
metadata: "Métadonnées",
|
||||
voice: "Voix",
|
||||
@@ -2553,6 +2566,7 @@ export const fr: TranslationResources = {
|
||||
terminals: "Terminaux",
|
||||
plugins: "Plugins",
|
||||
host: "Aperçu",
|
||||
daemon: "Daemon",
|
||||
},
|
||||
plugins: pluginSettings.fr,
|
||||
metadataGeneration: {
|
||||
@@ -3103,6 +3117,10 @@ export const fr: TranslationResources = {
|
||||
delete: "Supprimer le skill",
|
||||
},
|
||||
},
|
||||
tools: {
|
||||
instructionsTitle: "Instructions",
|
||||
toolsTitle: "Outils des agents",
|
||||
},
|
||||
orchestration: {
|
||||
title: "Orchestration",
|
||||
unavailable: "Connectez-vous à cet hôte pour gérer l’orchestration",
|
||||
@@ -3232,6 +3250,7 @@ export const fr: TranslationResources = {
|
||||
},
|
||||
},
|
||||
daemon: {
|
||||
runtimeTitle: "Exécution des agents",
|
||||
rename: {
|
||||
editLabel: "Modifier le libellé",
|
||||
title: "Renommer l’hôte",
|
||||
|
||||
@@ -2405,7 +2405,7 @@ export const ja: TranslationResources = {
|
||||
title: "設定",
|
||||
loading: "設定を読み込み中...",
|
||||
groups: {
|
||||
app: "アプリ",
|
||||
app: "このデバイス",
|
||||
host: "ホスト",
|
||||
},
|
||||
hostPicker: {
|
||||
@@ -2423,7 +2423,9 @@ export const ja: TranslationResources = {
|
||||
groupInfo: "{{title}}について",
|
||||
sections: {
|
||||
general: "一般",
|
||||
hosts: "ホスト",
|
||||
chat: "チャット",
|
||||
chatAndPanes: "チャットとペイン",
|
||||
appearance: "外観",
|
||||
sidebar: "サイドバー",
|
||||
terminal: "ターミナル",
|
||||
@@ -2437,6 +2439,16 @@ export const ja: TranslationResources = {
|
||||
diagnostics: "診断",
|
||||
about: "アプリ情報",
|
||||
},
|
||||
clientHosts: {
|
||||
title: "保存済みホスト",
|
||||
info: "このデバイスが接続するホストです。ここでの名前、アイコン、バッジ、経路はこのデバイスにのみ反映されます。",
|
||||
backToHosts: "ホスト一覧に戻る",
|
||||
routesTitle: "このデバイスの接続経路",
|
||||
routesInfo:
|
||||
"このデバイスがこのホストに到達するために保存された経路です。Paseoは利用可能な最速の経路を選びます。",
|
||||
addRoute: "経路を追加",
|
||||
activeRoute: "接続中",
|
||||
},
|
||||
layout: en.settings.layout,
|
||||
editor: {
|
||||
title: "エディター",
|
||||
@@ -2512,6 +2524,7 @@ export const ja: TranslationResources = {
|
||||
projects: "プロジェクト",
|
||||
connections: "接続",
|
||||
agents: "エージェント",
|
||||
tools: "ツールとプロンプト",
|
||||
agentProfiles: "エージェントプロファイル",
|
||||
metadata: "メタデータ",
|
||||
voice: "音声",
|
||||
@@ -2521,6 +2534,7 @@ export const ja: TranslationResources = {
|
||||
terminals: "ターミナル",
|
||||
plugins: "プラグイン",
|
||||
host: "概要",
|
||||
daemon: "デーモン",
|
||||
},
|
||||
plugins: pluginSettings.ja,
|
||||
metadataGeneration: {
|
||||
@@ -3063,6 +3077,10 @@ export const ja: TranslationResources = {
|
||||
delete: "スキルを削除",
|
||||
},
|
||||
},
|
||||
tools: {
|
||||
instructionsTitle: "指示",
|
||||
toolsTitle: "エージェントツール",
|
||||
},
|
||||
orchestration: {
|
||||
title: "オーケストレーション",
|
||||
unavailable: "オーケストレーションを管理するにはこのホストに接続してください",
|
||||
@@ -3191,6 +3209,7 @@ export const ja: TranslationResources = {
|
||||
},
|
||||
},
|
||||
daemon: {
|
||||
runtimeTitle: "エージェントランタイム",
|
||||
rename: {
|
||||
editLabel: "ラベルを編集",
|
||||
title: "ホストの名前を変更",
|
||||
|
||||
@@ -2392,7 +2392,7 @@ export const ko: TranslationResources = {
|
||||
title: "설정",
|
||||
loading: "설정 불러오는 중...",
|
||||
groups: {
|
||||
app: "앱",
|
||||
app: "이 기기",
|
||||
host: "호스트",
|
||||
},
|
||||
hostPicker: {
|
||||
@@ -2410,7 +2410,9 @@ export const ko: TranslationResources = {
|
||||
groupInfo: "{{title}} 정보",
|
||||
sections: {
|
||||
general: "일반",
|
||||
hosts: "호스트",
|
||||
chat: "채팅",
|
||||
chatAndPanes: "채팅 및 패널",
|
||||
appearance: "모양",
|
||||
sidebar: "사이드바",
|
||||
terminal: "터미널",
|
||||
@@ -2424,6 +2426,16 @@ export const ko: TranslationResources = {
|
||||
diagnostics: "진단",
|
||||
about: "정보",
|
||||
},
|
||||
clientHosts: {
|
||||
title: "저장된 호스트",
|
||||
info: "이 기기가 연결하는 호스트입니다. 이름, 아이콘, 배지 및 경로는 이 기기에만 적용됩니다.",
|
||||
backToHosts: "호스트로 돌아가기",
|
||||
routesTitle: "이 기기의 연결 방식",
|
||||
routesInfo:
|
||||
"이 기기가 이 호스트에 연결할 때 사용하는 저장된 경로입니다. Paseo가 가장 빠른 경로를 선택합니다.",
|
||||
addRoute: "경로 추가",
|
||||
activeRoute: "활성",
|
||||
},
|
||||
layout: en.settings.layout,
|
||||
editor: {
|
||||
title: "편집기",
|
||||
@@ -2498,6 +2510,7 @@ export const ko: TranslationResources = {
|
||||
projects: "프로젝트",
|
||||
connections: "연결",
|
||||
agents: "에이전트",
|
||||
tools: "도구 및 프롬프트",
|
||||
agentProfiles: "에이전트 프로필",
|
||||
metadata: "메타데이터",
|
||||
voice: "음성",
|
||||
@@ -2507,6 +2520,7 @@ export const ko: TranslationResources = {
|
||||
terminals: "터미널",
|
||||
plugins: "플러그인",
|
||||
host: "개요",
|
||||
daemon: "데몬",
|
||||
},
|
||||
plugins: pluginSettings.ko,
|
||||
metadataGeneration: {
|
||||
@@ -3047,6 +3061,10 @@ export const ko: TranslationResources = {
|
||||
delete: "스킬 삭제",
|
||||
},
|
||||
},
|
||||
tools: {
|
||||
instructionsTitle: "지침",
|
||||
toolsTitle: "에이전트 도구",
|
||||
},
|
||||
orchestration: {
|
||||
title: "오케스트레이션",
|
||||
unavailable: "오케스트레이션을 관리하려면 이 호스트에 연결하세요",
|
||||
@@ -3174,6 +3192,7 @@ export const ko: TranslationResources = {
|
||||
},
|
||||
},
|
||||
daemon: {
|
||||
runtimeTitle: "에이전트 런타임",
|
||||
rename: {
|
||||
editLabel: "레이블 편집",
|
||||
title: "호스트 이름 변경",
|
||||
|
||||
@@ -2420,7 +2420,7 @@ export const ptBR: TranslationResources = {
|
||||
title: "Configurações",
|
||||
loading: "Carregando configurações...",
|
||||
groups: {
|
||||
app: "App",
|
||||
app: "Este dispositivo",
|
||||
host: "Host",
|
||||
},
|
||||
hostPicker: {
|
||||
@@ -2438,7 +2438,9 @@ export const ptBR: TranslationResources = {
|
||||
groupInfo: "Sobre {{title}}",
|
||||
sections: {
|
||||
general: "Geral",
|
||||
hosts: "Hosts",
|
||||
chat: "Chat",
|
||||
chatAndPanes: "Chat e painéis",
|
||||
appearance: "Aparência",
|
||||
sidebar: "Barra lateral",
|
||||
terminal: "Terminal",
|
||||
@@ -2452,6 +2454,16 @@ export const ptBR: TranslationResources = {
|
||||
diagnostics: "Diagnósticos",
|
||||
about: "Sobre",
|
||||
},
|
||||
clientHosts: {
|
||||
title: "Hosts salvos",
|
||||
info: "Hosts aos quais este dispositivo se conecta. Nomes, ícones, selos e rotas aqui afetam apenas este dispositivo.",
|
||||
backToHosts: "Voltar para hosts",
|
||||
routesTitle: "Como este dispositivo se conecta",
|
||||
routesInfo:
|
||||
"Rotas salvas que este dispositivo usa para alcançar este host. O Paseo escolhe a mais rápida disponível.",
|
||||
addRoute: "Adicionar rota",
|
||||
activeRoute: "Ativa",
|
||||
},
|
||||
layout: en.settings.layout,
|
||||
editor: {
|
||||
title: "Editor",
|
||||
@@ -2529,6 +2541,7 @@ export const ptBR: TranslationResources = {
|
||||
projects: "Projetos",
|
||||
connections: "Conexões",
|
||||
agents: "Agentes",
|
||||
tools: "Ferramentas e instruções",
|
||||
agentProfiles: "Perfis de agente",
|
||||
metadata: "Metadados",
|
||||
voice: "Voz",
|
||||
@@ -2538,6 +2551,7 @@ export const ptBR: TranslationResources = {
|
||||
terminals: "Terminais",
|
||||
plugins: "Plugins",
|
||||
host: "Visão geral",
|
||||
daemon: "Daemon",
|
||||
},
|
||||
plugins: pluginSettings["pt-BR"],
|
||||
metadataGeneration: {
|
||||
@@ -3082,6 +3096,10 @@ export const ptBR: TranslationResources = {
|
||||
delete: "Excluir skill",
|
||||
},
|
||||
},
|
||||
tools: {
|
||||
instructionsTitle: "Instruções",
|
||||
toolsTitle: "Ferramentas de agentes",
|
||||
},
|
||||
orchestration: {
|
||||
title: "Orquestração",
|
||||
unavailable: "Conecte-se a este host para gerenciar a orquestração",
|
||||
@@ -3210,6 +3228,7 @@ export const ptBR: TranslationResources = {
|
||||
},
|
||||
},
|
||||
daemon: {
|
||||
runtimeTitle: "Execução de agentes",
|
||||
rename: {
|
||||
editLabel: "Editar rótulo",
|
||||
title: "Renomear host",
|
||||
|
||||
@@ -2421,7 +2421,7 @@ export const ru: TranslationResources = {
|
||||
title: "Настройки",
|
||||
loading: "Загрузка настроек...",
|
||||
groups: {
|
||||
app: "Приложение",
|
||||
app: "Это устройство",
|
||||
host: "Хост",
|
||||
},
|
||||
hostPicker: {
|
||||
@@ -2439,7 +2439,9 @@ export const ru: TranslationResources = {
|
||||
groupInfo: "О разделе «{{title}}»",
|
||||
sections: {
|
||||
general: "Основные",
|
||||
hosts: "Хосты",
|
||||
chat: "Чат",
|
||||
chatAndPanes: "Чат и панели",
|
||||
appearance: "Оформление",
|
||||
sidebar: "Боковая панель",
|
||||
terminal: "Терминал",
|
||||
@@ -2453,6 +2455,16 @@ export const ru: TranslationResources = {
|
||||
diagnostics: "Диагностика",
|
||||
about: "О приложении",
|
||||
},
|
||||
clientHosts: {
|
||||
title: "Сохранённые хосты",
|
||||
info: "Хосты, к которым подключается это устройство. Имена, значки, бейджи и маршруты здесь влияют только на это устройство.",
|
||||
backToHosts: "Назад к хостам",
|
||||
routesTitle: "Как подключается это устройство",
|
||||
routesInfo:
|
||||
"Сохранённые маршруты, по которым это устройство подключается к хосту. Paseo выбирает самый быстрый.",
|
||||
addRoute: "Добавить маршрут",
|
||||
activeRoute: "Активный",
|
||||
},
|
||||
layout: en.settings.layout,
|
||||
editor: {
|
||||
title: "Редактор",
|
||||
@@ -2529,6 +2541,7 @@ export const ru: TranslationResources = {
|
||||
projects: "Проекты",
|
||||
connections: "Подключения",
|
||||
agents: "Агенты",
|
||||
tools: "Инструменты и промпты",
|
||||
agentProfiles: "Профили агентов",
|
||||
metadata: "Метаданные",
|
||||
voice: "Голос",
|
||||
@@ -2538,6 +2551,7 @@ export const ru: TranslationResources = {
|
||||
terminals: "Терминалы",
|
||||
plugins: "Плагины",
|
||||
host: "Обзор",
|
||||
daemon: "Демон",
|
||||
},
|
||||
plugins: pluginSettings.ru,
|
||||
metadataGeneration: {
|
||||
@@ -3050,9 +3064,9 @@ export const ru: TranslationResources = {
|
||||
rowTitle: "Подключить устройство",
|
||||
},
|
||||
skills: {
|
||||
sectionTitle: "Навыки оркестрации",
|
||||
title: "Навыки оркестрации",
|
||||
description: "Научите агентов пользоваться инструментами Paseo",
|
||||
sectionTitle: "Навыки",
|
||||
title: "Навыки Paseo",
|
||||
description: "Установить встроенные навыки справки, плагинов и оркестрации",
|
||||
docs: "Навыки",
|
||||
openDocs: "Открыть документацию по навыкам",
|
||||
unavailable: "Подключитесь к этому хосту, чтобы управлять навыками оркестрации",
|
||||
@@ -3090,6 +3104,10 @@ export const ru: TranslationResources = {
|
||||
delete: "Удалить навык",
|
||||
},
|
||||
},
|
||||
tools: {
|
||||
instructionsTitle: "Инструкции",
|
||||
toolsTitle: "Инструменты агентов",
|
||||
},
|
||||
orchestration: {
|
||||
title: "Оркестрация",
|
||||
unavailable: "Подключитесь к этому хосту, чтобы управлять оркестрацией.",
|
||||
@@ -3218,6 +3236,7 @@ export const ru: TranslationResources = {
|
||||
},
|
||||
},
|
||||
daemon: {
|
||||
runtimeTitle: "Среда выполнения агентов",
|
||||
rename: {
|
||||
editLabel: "Изменить название",
|
||||
title: "Переименовать хост",
|
||||
|
||||
@@ -2357,7 +2357,7 @@ export const zhCN: TranslationResources = {
|
||||
title: "设置",
|
||||
loading: "正在加载设置...",
|
||||
groups: {
|
||||
app: "应用",
|
||||
app: "此设备",
|
||||
host: "主机",
|
||||
},
|
||||
hostPicker: {
|
||||
@@ -2375,7 +2375,9 @@ export const zhCN: TranslationResources = {
|
||||
groupInfo: "关于 {{title}}",
|
||||
sections: {
|
||||
general: "通用",
|
||||
hosts: "主机",
|
||||
chat: "聊天",
|
||||
chatAndPanes: "聊天与面板",
|
||||
appearance: "外观",
|
||||
sidebar: "侧边栏",
|
||||
terminal: "终端",
|
||||
@@ -2389,6 +2391,15 @@ export const zhCN: TranslationResources = {
|
||||
diagnostics: "诊断",
|
||||
about: "关于",
|
||||
},
|
||||
clientHosts: {
|
||||
title: "已保存的主机",
|
||||
info: "此设备连接的主机。这里的名称、图标、徽章和连接路径仅影响此设备。",
|
||||
backToHosts: "返回主机",
|
||||
routesTitle: "此设备的连接方式",
|
||||
routesInfo: "此设备连接到该主机的已保存路径。Paseo 会自动选择最快的可用路径。",
|
||||
addRoute: "添加路径",
|
||||
activeRoute: "当前使用",
|
||||
},
|
||||
layout: en.settings.layout,
|
||||
editor: {
|
||||
title: "编辑器",
|
||||
@@ -2463,6 +2474,7 @@ export const zhCN: TranslationResources = {
|
||||
projects: "项目",
|
||||
connections: "连接",
|
||||
agents: "Agents",
|
||||
tools: "工具与提示词",
|
||||
agentProfiles: "智能体配置文件",
|
||||
metadata: "元数据",
|
||||
voice: "语音",
|
||||
@@ -2472,6 +2484,7 @@ export const zhCN: TranslationResources = {
|
||||
terminals: "Terminals",
|
||||
plugins: "插件",
|
||||
host: "概览",
|
||||
daemon: "守护进程",
|
||||
},
|
||||
plugins: pluginSettings["zh-CN"],
|
||||
metadataGeneration: {
|
||||
@@ -3002,6 +3015,10 @@ export const zhCN: TranslationResources = {
|
||||
delete: "删除 skill",
|
||||
},
|
||||
},
|
||||
tools: {
|
||||
instructionsTitle: "指令",
|
||||
toolsTitle: "代理工具",
|
||||
},
|
||||
orchestration: {
|
||||
title: "编排",
|
||||
unavailable: "连接到这个 Host 以管理编排",
|
||||
@@ -3128,6 +3145,7 @@ export const zhCN: TranslationResources = {
|
||||
},
|
||||
},
|
||||
daemon: {
|
||||
runtimeTitle: "代理运行时",
|
||||
rename: {
|
||||
editLabel: "编辑标签",
|
||||
title: "重命名 Host",
|
||||
|
||||
@@ -4,12 +4,14 @@ import {
|
||||
navigateToLastWorkspace,
|
||||
} from "@/stores/navigation-active-workspace-store";
|
||||
import {
|
||||
buildClientHostSettingsRoute,
|
||||
buildOpenProjectRoute,
|
||||
buildProjectSettingsRoute,
|
||||
buildProjectsSettingsRoute,
|
||||
buildProviderSettingsRoute,
|
||||
buildSettingsHostSectionRoute,
|
||||
buildSettingsRoute,
|
||||
buildSettingsSectionRoute,
|
||||
type HostSectionSlug,
|
||||
type SettingsSectionSlug,
|
||||
} from "@/utils/host-routes";
|
||||
@@ -40,12 +42,17 @@ export type SettingsView =
|
||||
| { kind: "pluginListing"; serverId: string; listingId: string }
|
||||
| { kind: "root" }
|
||||
| { kind: "section"; section: SettingsSectionSlug }
|
||||
| { kind: "clientHost"; serverId: string }
|
||||
| { kind: "host"; serverId: string; section: HostSectionSlug }
|
||||
| { kind: "project"; serverId: string; projectId: string }
|
||||
| { kind: "provider"; serverId: string; providerId: string };
|
||||
|
||||
export function openHostOverview(serverId: string): void {
|
||||
router.push(buildSettingsHostSectionRoute(serverId, "host"));
|
||||
router.push(buildSettingsHostSectionRoute(serverId, "daemon"));
|
||||
}
|
||||
|
||||
export function openClientHostSettings(serverId: string): void {
|
||||
router.push(buildClientHostSettingsRoute(serverId));
|
||||
}
|
||||
|
||||
export function openProjectSettings(serverId: string, projectId: string): void {
|
||||
@@ -77,6 +84,7 @@ export function returnFromSettings(view: SettingsView): void {
|
||||
}
|
||||
|
||||
let parent: Href = buildSettingsRoute();
|
||||
if (view.kind === "clientHost") parent = buildSettingsSectionRoute("hosts");
|
||||
if (view.kind === "plugin" || view.kind === "pluginListing")
|
||||
parent = buildSettingsHostSectionRoute(view.serverId, "plugins");
|
||||
if (view.kind === "project") parent = buildProjectsSettingsRoute(view.serverId);
|
||||
|
||||
@@ -18,30 +18,24 @@ import {
|
||||
Settings,
|
||||
Palette,
|
||||
Server,
|
||||
Network,
|
||||
Bot,
|
||||
Boxes,
|
||||
Gauge,
|
||||
Keyboard,
|
||||
Stethoscope,
|
||||
Info,
|
||||
Bell,
|
||||
Shield,
|
||||
Puzzle,
|
||||
Plus,
|
||||
FolderOpen,
|
||||
FolderGit2,
|
||||
SquareTerminal,
|
||||
Code2,
|
||||
Files,
|
||||
Smartphone,
|
||||
Sparkles,
|
||||
Mic,
|
||||
Blocks,
|
||||
Globe,
|
||||
PanelLeft,
|
||||
MessageSquare,
|
||||
ChevronRight,
|
||||
Layers,
|
||||
Laptop,
|
||||
} from "lucide-react-native";
|
||||
import { DropdownTrigger } from "@/components/ui/dropdown-trigger";
|
||||
import { ComboboxTrigger } from "@/components/ui/combobox-trigger";
|
||||
@@ -61,8 +55,7 @@ import {
|
||||
type AppSettings,
|
||||
type Settings as EffectiveSettings,
|
||||
} from "@/hooks/use-settings";
|
||||
import { useHostRuntimeIsConnected, useHosts } from "@/runtime/host-runtime";
|
||||
import { useSessionStore } from "@/stores/session-store";
|
||||
import { useHosts } from "@/runtime/host-runtime";
|
||||
import {
|
||||
orderHostsLocalFirst,
|
||||
resolveActiveHostServerId,
|
||||
@@ -102,23 +95,22 @@ import {
|
||||
type SupportedLocale,
|
||||
} from "@/i18n/locales";
|
||||
import {
|
||||
HostConnectionsPage,
|
||||
HostDevicesPage,
|
||||
HostAgentsPage,
|
||||
HostToolsPage,
|
||||
HostAgentProfilesPage,
|
||||
HostSettingsPage,
|
||||
HostDaemonPage,
|
||||
HostWorkspacesPage,
|
||||
HostProvidersPage,
|
||||
HostUsagePage,
|
||||
HostWorkspacesPage,
|
||||
HostTerminalsPage,
|
||||
} from "@/screens/settings/host-page";
|
||||
import { ClientHostDetailPage, ClientHostsSection } from "@/screens/settings/client-hosts-page";
|
||||
import {
|
||||
PluginGalleryMenu,
|
||||
PluginGalleryPage,
|
||||
PluginPage,
|
||||
type PluginPageSubject,
|
||||
} from "@/plugins/gallery";
|
||||
import { MetadataGenerationPage } from "@/screens/settings/metadata-generation-page";
|
||||
import { HostVoicePage } from "@/screens/settings/voice/voice-page";
|
||||
import ProjectsScreen from "@/screens/projects-screen";
|
||||
import ProjectSettingsScreen from "@/screens/project-settings-screen";
|
||||
@@ -135,6 +127,7 @@ import {
|
||||
useEnableBuiltInDaemonOption,
|
||||
} from "@/desktop/hooks/use-enable-built-in-daemon-option";
|
||||
import {
|
||||
buildClientHostSettingsRoute,
|
||||
buildSettingsHostSectionRoute,
|
||||
buildSettingsSectionRoute,
|
||||
type HostSectionSlug,
|
||||
@@ -166,6 +159,7 @@ interface SidebarSectionItem {
|
||||
|
||||
const SIDEBAR_SECTION_ITEMS: SidebarSectionItem[] = [
|
||||
{ id: "general", labelKey: "settings.sections.general", icon: Settings },
|
||||
{ id: "hosts", labelKey: "settings.sections.hosts", icon: Laptop },
|
||||
{
|
||||
id: "appearance",
|
||||
labelKey: "settings.sections.appearance",
|
||||
@@ -178,28 +172,7 @@ const SIDEBAR_SECTION_ITEMS: SidebarSectionItem[] = [
|
||||
icon: PanelLeft,
|
||||
Content: SidebarNavSection,
|
||||
},
|
||||
{ id: "chat", labelKey: "settings.sections.chat", icon: MessageSquare, Content: ChatSection },
|
||||
{
|
||||
id: "terminal",
|
||||
labelKey: "settings.sections.terminal",
|
||||
icon: SquareTerminal,
|
||||
Content: TerminalSection,
|
||||
},
|
||||
{
|
||||
id: "browser",
|
||||
labelKey: "settings.sections.browser",
|
||||
icon: Globe,
|
||||
desktopOnly: true,
|
||||
Content: BrowserDataSection,
|
||||
},
|
||||
{
|
||||
id: "editor",
|
||||
labelKey: "settings.sections.editor",
|
||||
icon: Code2,
|
||||
webOnly: true,
|
||||
Content: EditorSection,
|
||||
},
|
||||
{ id: "files", labelKey: "settings.sections.files", icon: Files, Content: FilesSection },
|
||||
{ id: "chat", labelKey: "settings.sections.chatAndPanes", icon: MessageSquare },
|
||||
{
|
||||
id: "shortcuts",
|
||||
labelKey: "settings.sections.shortcuts",
|
||||
@@ -207,27 +180,11 @@ const SIDEBAR_SECTION_ITEMS: SidebarSectionItem[] = [
|
||||
hardwareKeyboardOnly: true,
|
||||
Content: KeyboardShortcutsSection,
|
||||
},
|
||||
{
|
||||
id: "integrations",
|
||||
labelKey: "settings.sections.integrations",
|
||||
icon: Puzzle,
|
||||
desktopOnly: true,
|
||||
Content: IntegrationsSection,
|
||||
},
|
||||
{
|
||||
id: "notifications",
|
||||
labelKey: "settings.sections.notifications",
|
||||
icon: Bell,
|
||||
Content: NotificationsSection,
|
||||
},
|
||||
{
|
||||
id: "permissions",
|
||||
labelKey: "settings.sections.permissions",
|
||||
icon: Shield,
|
||||
desktopOnly: true,
|
||||
Content: DesktopPermissionsSection,
|
||||
},
|
||||
{ id: "diagnostics", labelKey: "settings.sections.diagnostics", icon: Stethoscope },
|
||||
{ id: "about", labelKey: "settings.sections.about", icon: Info },
|
||||
];
|
||||
|
||||
@@ -247,53 +204,44 @@ interface HostSectionItem {
|
||||
}
|
||||
|
||||
const HOST_SECTION_ITEMS: HostSectionItem[] = [
|
||||
{ id: "host", labelKey: "settings.hostSections.host", icon: Server },
|
||||
{ id: "projects", labelKey: "settings.hostSections.projects", icon: FolderGit2 },
|
||||
{ id: "connections", labelKey: "settings.hostSections.connections", icon: Network },
|
||||
{ id: "devices", labelKey: "devices.title", icon: Smartphone },
|
||||
{ id: "agents", labelKey: "settings.hostSections.agents", icon: Bot },
|
||||
{ id: "agent-profiles", labelKey: "settings.hostSections.agentProfiles", icon: Layers },
|
||||
{ id: "metadata", labelKey: "settings.hostSections.metadata", icon: Sparkles },
|
||||
{ id: "voice", labelKey: "settings.hostSections.voice", icon: Mic },
|
||||
{ id: "workspaces", labelKey: "settings.hostSections.workspaces", icon: FolderGit2 },
|
||||
{ id: "providers", labelKey: "settings.hostSections.providers", icon: Boxes },
|
||||
{ id: "agent-profiles", labelKey: "settings.hostSections.agentProfiles", icon: Layers },
|
||||
{ id: "tools", labelKey: "settings.hostSections.tools", icon: Sparkles },
|
||||
{ id: "projects", labelKey: "settings.projects", icon: FolderOpen },
|
||||
{ id: "workspaces", labelKey: "settings.hostSections.workspaces", icon: FolderGit2 },
|
||||
{ id: "voice", labelKey: "settings.hostSections.voice", icon: Mic },
|
||||
{ id: "usage", labelKey: "settings.hostSections.usage", icon: Gauge },
|
||||
{ id: "terminals", labelKey: "settings.hostSections.terminals", icon: SquareTerminal },
|
||||
{ id: "plugins", labelKey: "settings.hostSections.plugins", icon: Blocks },
|
||||
{ id: "devices", labelKey: "devices.title", icon: Smartphone },
|
||||
{ id: "daemon", labelKey: "settings.hostSections.daemon", icon: Server },
|
||||
];
|
||||
|
||||
function renderHostSettingsContent(
|
||||
view: Extract<SettingsView, { kind: "host" }>,
|
||||
onHostRemoved: () => void,
|
||||
): ReactNode {
|
||||
function renderHostSettingsContent(view: Extract<SettingsView, { kind: "host" }>): ReactNode {
|
||||
switch (view.section) {
|
||||
case "projects":
|
||||
return <ProjectsScreen serverId={view.serverId} />;
|
||||
case "connections":
|
||||
return <HostConnectionsPage serverId={view.serverId} />;
|
||||
case "devices":
|
||||
return <HostDevicesPage serverId={view.serverId} />;
|
||||
case "agents":
|
||||
return <HostAgentsPage serverId={view.serverId} />;
|
||||
case "providers":
|
||||
return <HostProvidersPage serverId={view.serverId} />;
|
||||
case "agent-profiles":
|
||||
// Rendered directly in SettingsScreen so AgentProfilesPage owns its wide PageLayout + drawer split.
|
||||
return null;
|
||||
case "metadata":
|
||||
return <MetadataGenerationPage serverId={view.serverId} />;
|
||||
case "voice":
|
||||
return <HostVoicePage serverId={view.serverId} />;
|
||||
case "tools":
|
||||
return <HostToolsPage serverId={view.serverId} />;
|
||||
case "projects":
|
||||
return <ProjectsScreen serverId={view.serverId} />;
|
||||
case "workspaces":
|
||||
return <HostWorkspacesPage serverId={view.serverId} />;
|
||||
case "providers":
|
||||
return <HostProvidersPage serverId={view.serverId} />;
|
||||
case "voice":
|
||||
return <HostVoicePage serverId={view.serverId} />;
|
||||
case "usage":
|
||||
return <HostUsagePage serverId={view.serverId} />;
|
||||
case "terminals":
|
||||
return <HostTerminalsPage serverId={view.serverId} />;
|
||||
case "plugins":
|
||||
return <PluginGalleryPage serverId={view.serverId} />;
|
||||
case "host":
|
||||
return <HostSettingsPage serverId={view.serverId} onHostRemoved={onHostRemoved} />;
|
||||
case "devices":
|
||||
return <HostDevicesPage serverId={view.serverId} />;
|
||||
case "daemon":
|
||||
return <HostDaemonPage serverId={view.serverId} />;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,12 +423,12 @@ function DiagnosticsSection({
|
||||
}
|
||||
|
||||
interface AboutSectionProps {
|
||||
appVersion: string | null;
|
||||
appVersionText: string;
|
||||
isDesktopApp: boolean;
|
||||
diagnostics: DiagnosticsSectionProps;
|
||||
}
|
||||
|
||||
function AboutSection({ appVersion, appVersionText, isDesktopApp }: AboutSectionProps) {
|
||||
function AboutSection({ appVersionText, isDesktopApp, diagnostics }: AboutSectionProps) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<>
|
||||
@@ -497,7 +445,7 @@ function AboutSection({ appVersion, appVersionText, isDesktopApp }: AboutSection
|
||||
{isDesktopApp ? <DesktopAppUpdateRow /> : null}
|
||||
</View>
|
||||
</SettingsSection>
|
||||
<ConnectedHostsSection clientVersion={appVersion} />
|
||||
<DiagnosticsSection {...diagnostics} />
|
||||
<View style={styles.aboutCommunity}>
|
||||
<CommunityLinks />
|
||||
</View>
|
||||
@@ -532,88 +480,6 @@ function WhatsNewRow() {
|
||||
);
|
||||
}
|
||||
|
||||
function normalizeVersion(version: string | null | undefined): string | null {
|
||||
const trimmed = version?.trim();
|
||||
if (!trimmed) return null;
|
||||
return trimmed.replace(/^v/i, "");
|
||||
}
|
||||
|
||||
function ConnectedHostsSection({ clientVersion }: { clientVersion: string | null }) {
|
||||
const { t } = useTranslation();
|
||||
const hosts = useHosts();
|
||||
if (hosts.length === 0) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<SettingsSection title={t("settings.about.connectedHosts")}>
|
||||
<View style={settingsStyles.card}>
|
||||
{hosts.map((host, index) => (
|
||||
<HostVersionRow
|
||||
key={host.serverId}
|
||||
host={host}
|
||||
showBorder={index > 0}
|
||||
clientVersion={clientVersion}
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
</SettingsSection>
|
||||
);
|
||||
}
|
||||
|
||||
function HostVersionRow({
|
||||
host,
|
||||
showBorder,
|
||||
clientVersion,
|
||||
}: {
|
||||
host: HostProfile;
|
||||
showBorder: boolean;
|
||||
clientVersion: string | null;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const isConnected = useHostRuntimeIsConnected(host.serverId);
|
||||
const daemonVersion = useSessionStore(
|
||||
(state) => state.sessions[host.serverId]?.serverInfo?.version ?? null,
|
||||
);
|
||||
|
||||
const rowStyle = useMemo(
|
||||
() => [settingsStyles.row, showBorder && settingsStyles.rowBorder],
|
||||
[showBorder],
|
||||
);
|
||||
|
||||
const normalizedHost = normalizeVersion(daemonVersion);
|
||||
const normalizedClient = normalizeVersion(clientVersion);
|
||||
const isMismatch =
|
||||
normalizedHost !== null && normalizedClient !== null && normalizedHost !== normalizedClient;
|
||||
|
||||
let valueText: string;
|
||||
if (!isConnected) {
|
||||
valueText = t("settings.about.offline");
|
||||
} else if (normalizedHost) {
|
||||
valueText = formatVersionWithPrefix(normalizedHost);
|
||||
} else {
|
||||
valueText = "—";
|
||||
}
|
||||
|
||||
const valueStyle = useMemo(
|
||||
() => [styles.aboutValue, isMismatch && styles.aboutVersionMismatch],
|
||||
[isMismatch],
|
||||
);
|
||||
|
||||
return (
|
||||
<View style={rowStyle}>
|
||||
<View style={settingsStyles.rowContent}>
|
||||
<Text style={settingsStyles.rowTitle} numberOfLines={1}>
|
||||
{host.label}
|
||||
</Text>
|
||||
{isMismatch ? (
|
||||
<Text style={settingsStyles.rowHint}>{t("settings.about.versionDiffers")}</Text>
|
||||
) : null}
|
||||
</View>
|
||||
<Text style={valueStyle}>{valueText}</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
function getUpdateButtonLabel(
|
||||
t: TFunction,
|
||||
input: {
|
||||
@@ -901,6 +767,7 @@ function SidebarSectionButton({
|
||||
accessibilityRole="button"
|
||||
accessibilityState={accessibilityState}
|
||||
onPress={handlePress}
|
||||
testID={`settings-section-${itemId}`}
|
||||
style={isSelected ? selectedSidebarItemStyle : sidebarItemStyle}
|
||||
>
|
||||
<IconComponent
|
||||
@@ -1096,7 +963,12 @@ function SettingsSidebar({
|
||||
() => [{ flex: 1 }, isDesktop ? { paddingTop: insets.top } : null],
|
||||
[insets.top, isDesktop],
|
||||
);
|
||||
const selectedSectionId = view.kind === "section" ? view.section : null;
|
||||
let selectedSectionId: SettingsSectionSlug | null = null;
|
||||
if (view.kind === "section") {
|
||||
selectedSectionId = view.section;
|
||||
} else if (view.kind === "clientHost") {
|
||||
selectedSectionId = "hosts";
|
||||
}
|
||||
let selectedHostSection: HostSectionSlug | null = null;
|
||||
if (view.kind === "host") selectedHostSection = view.section;
|
||||
if (view.kind === "project") selectedHostSection = "projects";
|
||||
@@ -1312,7 +1184,8 @@ function SettingsDetailPane({
|
||||
}) {
|
||||
const isStandaloneAgentProfilesView = view.kind === "host" && view.section === "agent-profiles";
|
||||
const pageTitle =
|
||||
!isCompactLayout && (view.kind === "project" || view.kind === "provider")
|
||||
!isCompactLayout &&
|
||||
(view.kind === "project" || view.kind === "provider" || view.kind === "clientHost")
|
||||
? undefined
|
||||
: detailTitle;
|
||||
|
||||
@@ -1432,7 +1305,7 @@ export default function SettingsScreen({ view }: SettingsScreenProps) {
|
||||
const handleHostAdded = useCallback(
|
||||
(serverId: string) => {
|
||||
selectSettingsHost(serverId);
|
||||
const target = buildSettingsHostSectionRoute(serverId, "host");
|
||||
const target = buildClientHostSettingsRoute(serverId);
|
||||
if (isCompactLayout) {
|
||||
router.push(target);
|
||||
} else {
|
||||
@@ -1443,6 +1316,7 @@ export default function SettingsScreen({ view }: SettingsScreenProps) {
|
||||
);
|
||||
|
||||
const handleAddHost = useAddHost({ onAdded: handleHostAdded });
|
||||
const enableBuiltInDaemonOption = useEnableBuiltInDaemonOption();
|
||||
const { registerBeforeLeave, guardNavigation } = useSettingsBeforeLeaveGuard();
|
||||
|
||||
const navigateRoute = useCallback(
|
||||
@@ -1514,18 +1388,32 @@ export default function SettingsScreen({ view }: SettingsScreenProps) {
|
||||
[activeHostServerId, guardNavigation, handleAddHost, navigateRoute, view],
|
||||
);
|
||||
|
||||
const handleSelectClientHost = useCallback(
|
||||
(serverId: string) => {
|
||||
const target = buildClientHostSettingsRoute(serverId);
|
||||
guardNavigation(() => navigateRoute(target));
|
||||
},
|
||||
[guardNavigation, navigateRoute],
|
||||
);
|
||||
|
||||
const handleHostRemoved = useCallback(() => {
|
||||
const fallback = buildSettingsSectionRoute("general");
|
||||
const target = buildSettingsSectionRoute("hosts");
|
||||
if (isCompactLayout) {
|
||||
router.replace("/settings");
|
||||
router.dismissTo(target);
|
||||
} else {
|
||||
router.replace(fallback);
|
||||
router.replace(target);
|
||||
}
|
||||
}, [isCompactLayout, router]);
|
||||
|
||||
const handleBackFromDetail = useCallback(() => {
|
||||
guardNavigation(() => returnFromSettings(view));
|
||||
}, [guardNavigation, view]);
|
||||
guardNavigation(() => {
|
||||
if (view.kind === "clientHost" && !isCompactLayout) {
|
||||
router.replace(buildSettingsSectionRoute("hosts"));
|
||||
return;
|
||||
}
|
||||
returnFromSettings(view);
|
||||
});
|
||||
}, [guardNavigation, isCompactLayout, router, view]);
|
||||
|
||||
const handleBackToWorkspace = useCallback(() => {
|
||||
guardNavigation(() => returnFromSettings({ kind: "root" }));
|
||||
@@ -1553,6 +1441,9 @@ export default function SettingsScreen({ view }: SettingsScreenProps) {
|
||||
const item = SIDEBAR_SECTION_ITEMS.find((s) => s.id === view.section);
|
||||
return item ? t(item.labelKey) : undefined;
|
||||
}
|
||||
if (view.kind === "clientHost") {
|
||||
return t("settings.sections.hosts");
|
||||
}
|
||||
if (view.kind === "project") {
|
||||
return t("settings.projects");
|
||||
}
|
||||
@@ -1570,6 +1461,16 @@ export default function SettingsScreen({ view }: SettingsScreenProps) {
|
||||
// The gallery and a plugin's page share one width, so opening a plugin keeps the page edges put.
|
||||
const detailWidth = pluginGalleryServerId || pluginPage ? "wide" : "default";
|
||||
|
||||
const aboutDiagnostics = useMemo(
|
||||
() => ({
|
||||
voiceAudioEngine,
|
||||
isPlaybackTestRunning,
|
||||
playbackTestResult,
|
||||
handlePlaybackTest,
|
||||
}),
|
||||
[handlePlaybackTest, isPlaybackTestRunning, playbackTestResult, voiceAudioEngine],
|
||||
);
|
||||
|
||||
const content: ReactNode = (() => {
|
||||
if (pluginPage)
|
||||
return (
|
||||
@@ -1579,8 +1480,18 @@ export default function SettingsScreen({ view }: SettingsScreenProps) {
|
||||
onBack={handleBackFromDetail}
|
||||
/>
|
||||
);
|
||||
if (view.kind === "clientHost") {
|
||||
return (
|
||||
<ClientHostDetailPage
|
||||
serverId={view.serverId}
|
||||
onBack={handleBackFromDetail}
|
||||
onAddHost={handleAddHost}
|
||||
onHostRemoved={handleHostRemoved}
|
||||
/>
|
||||
);
|
||||
}
|
||||
if (view.kind === "host") {
|
||||
return renderHostSettingsContent(view, handleHostRemoved);
|
||||
return renderHostSettingsContent(view);
|
||||
}
|
||||
if (view.kind === "project") {
|
||||
return (
|
||||
@@ -1608,25 +1519,42 @@ export default function SettingsScreen({ view }: SettingsScreenProps) {
|
||||
return (
|
||||
<>
|
||||
<GeneralSection settings={settings} handleLanguageChange={handleLanguageChange} />
|
||||
<SendingSection />
|
||||
{isDesktopApp ? <OpenLocationSection /> : null}
|
||||
{isDesktopApp ? <IntegrationsSection /> : null}
|
||||
</>
|
||||
);
|
||||
case "diagnostics":
|
||||
case "hosts":
|
||||
return (
|
||||
<DiagnosticsSection
|
||||
voiceAudioEngine={voiceAudioEngine}
|
||||
isPlaybackTestRunning={isPlaybackTestRunning}
|
||||
playbackTestResult={playbackTestResult}
|
||||
handlePlaybackTest={handlePlaybackTest}
|
||||
<ClientHostsSection
|
||||
onSelectHost={handleSelectClientHost}
|
||||
onAddHost={handleAddHost}
|
||||
enableBuiltInDaemonOption={enableBuiltInDaemonOption}
|
||||
/>
|
||||
);
|
||||
case "chat":
|
||||
return (
|
||||
<>
|
||||
<SendingSection />
|
||||
<ChatSection />
|
||||
{isDesktopApp ? <OpenLocationSection /> : null}
|
||||
{isWeb ? <EditorSection /> : null}
|
||||
<TerminalSection />
|
||||
<FilesSection />
|
||||
{isDesktopApp ? <BrowserDataSection /> : null}
|
||||
</>
|
||||
);
|
||||
case "notifications":
|
||||
return (
|
||||
<>
|
||||
<NotificationsSection />
|
||||
{isDesktopApp ? <DesktopPermissionsSection /> : null}
|
||||
</>
|
||||
);
|
||||
case "about":
|
||||
return (
|
||||
<AboutSection
|
||||
appVersion={appVersion}
|
||||
appVersionText={appVersionText}
|
||||
isDesktopApp={isDesktopApp}
|
||||
diagnostics={aboutDiagnostics}
|
||||
/>
|
||||
);
|
||||
default:
|
||||
@@ -1726,9 +1654,6 @@ const styles = StyleSheet.create((theme) => ({
|
||||
color: theme.colors.foregroundMuted,
|
||||
fontSize: theme.fontSize.base,
|
||||
},
|
||||
aboutVersionMismatch: {
|
||||
color: theme.colors.palette.amber[500],
|
||||
},
|
||||
aboutErrorText: {
|
||||
color: theme.colors.palette.red[300],
|
||||
fontSize: theme.fontSize.sm,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import React, { useCallback } from "react";
|
||||
import React, { useCallback, useMemo } from "react";
|
||||
import { Text, View } from "react-native";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { SettingsRow } from "@/components/settings";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { useDaemonConfig } from "@/hooks/use-daemon-config";
|
||||
import { useHostRuntimeIsConnected } from "@/runtime/host-runtime";
|
||||
@@ -12,7 +13,7 @@ import {
|
||||
getBrowserToolsMutationViewState,
|
||||
} from "./browser-tools-config";
|
||||
|
||||
export function BrowserToolsOptInCard({ serverId }: { serverId: string }) {
|
||||
export function BrowserToolsRow({ serverId }: { serverId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const isConnected = useHostRuntimeIsConnected(serverId);
|
||||
const { config, patchConfig } = useDaemonConfig(serverId);
|
||||
@@ -38,33 +39,36 @@ export function BrowserToolsOptInCard({ serverId }: { serverId: string }) {
|
||||
[mutation],
|
||||
);
|
||||
|
||||
const hint = useMemo(
|
||||
() => (
|
||||
<View>
|
||||
<Text style={settingsStyles.rowHint}>{state.warning}</Text>
|
||||
{mutationView.loadingText ? (
|
||||
<Text style={settingsStyles.rowHint} testID="host-page-browser-tools-loading">
|
||||
{mutationView.loadingText}
|
||||
</Text>
|
||||
) : null}
|
||||
</View>
|
||||
),
|
||||
[mutationView.loadingText, state.warning],
|
||||
);
|
||||
|
||||
if (!state.isVisible) return null;
|
||||
|
||||
return (
|
||||
<View style={settingsStyles.card} testID="host-page-browser-tools-card">
|
||||
<View style={settingsStyles.row}>
|
||||
<View style={settingsStyles.rowContent}>
|
||||
<Text style={settingsStyles.rowTitle}>{state.title}</Text>
|
||||
<Text style={settingsStyles.rowHint}>{state.warning}</Text>
|
||||
{mutationView.loadingText ? (
|
||||
<Text style={settingsStyles.rowHint} testID="host-page-browser-tools-loading">
|
||||
{mutationView.loadingText}
|
||||
</Text>
|
||||
) : null}
|
||||
{mutationView.errorText ? (
|
||||
<Text style={settingsStyles.rowError} testID="host-page-browser-tools-error">
|
||||
{mutationView.errorText}
|
||||
</Text>
|
||||
) : null}
|
||||
</View>
|
||||
<Switch
|
||||
value={state.isEnabled}
|
||||
onValueChange={handleValueChange}
|
||||
disabled={mutationView.isSwitchDisabled}
|
||||
accessibilityLabel="Enable browser tools"
|
||||
testID="host-page-browser-tools-switch"
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
<SettingsRow
|
||||
label={state.title}
|
||||
hint={hint}
|
||||
error={mutationView.errorText ?? undefined}
|
||||
testID="host-page-browser-tools-card"
|
||||
>
|
||||
<Switch
|
||||
value={state.isEnabled}
|
||||
onValueChange={handleValueChange}
|
||||
disabled={mutationView.isSwitchDisabled}
|
||||
accessibilityLabel="Enable browser tools"
|
||||
testID="host-page-browser-tools-switch"
|
||||
/>
|
||||
</SettingsRow>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,705 @@
|
||||
import { Plus, Server, Trash2 } from "lucide-react-native";
|
||||
import type { TFunction } from "i18next";
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Alert, Text, View } from "react-native";
|
||||
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
||||
import { AdaptiveModalSheet, type SheetHeader } from "@/components/adaptive-modal-sheet";
|
||||
import { HostStatusDot } from "@/components/host-status-dot";
|
||||
import {
|
||||
SettingsAddRow,
|
||||
SettingsCard,
|
||||
SettingsDetailHeader,
|
||||
SettingsDetailRow,
|
||||
SettingsRow,
|
||||
SettingsSection,
|
||||
} from "@/components/settings";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { StatusBadge } from "@/components/ui/status-badge";
|
||||
import { useIsCompactFormFactor } from "@/constants/layout";
|
||||
import { startDesktopDaemon, stopDesktopDaemon } from "@/desktop/daemon/desktop-daemon";
|
||||
import type { EnableBuiltInDaemonOption } from "@/desktop/hooks/use-enable-built-in-daemon-option";
|
||||
import { useDaemonStatus } from "@/desktop/hooks/use-daemon-status";
|
||||
import { useDesktopSettings } from "@/desktop/settings/desktop-settings";
|
||||
import { useIsLocalDaemon, useLocalDaemonServerId } from "@/hooks/use-is-local-daemon";
|
||||
import { resolveHostIcon } from "@/hosts/appearance";
|
||||
import { describeActiveConnection, describeHostConnection } from "@/hosts/connection-display";
|
||||
import { HostIconGlyph } from "@/hosts/host-icon-glyph";
|
||||
import { useHostMutations, useHostRuntimeSnapshot, useHosts } from "@/runtime/host-runtime";
|
||||
import { HostAppearanceSection } from "@/screens/settings/host-appearance-section";
|
||||
import { HostConnectionError } from "@/screens/settings/host-page";
|
||||
import { useSessionStore } from "@/stores/session-store";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
import { ICON_SIZE, type Theme } from "@/styles/theme";
|
||||
import {
|
||||
orderHostsLocalFirst,
|
||||
type HostConnection,
|
||||
type HostProfile,
|
||||
} from "@/types/host-connection";
|
||||
import { formatLatency } from "@/utils/latency";
|
||||
|
||||
const ThemedPlus = withUnistyles(Plus);
|
||||
const ThemedServer = withUnistyles(Server);
|
||||
const ThemedTrash2 = withUnistyles(Trash2);
|
||||
|
||||
const mutedColorMapping = (theme: Theme) => ({ color: theme.colors.foregroundMuted });
|
||||
const destructiveColorMapping = (theme: Theme) => ({ color: theme.colors.destructive });
|
||||
|
||||
const addRouteIcon = <ThemedPlus size={ICON_SIZE.sm} uniProps={mutedColorMapping} />;
|
||||
const enableDaemonIcon = <ThemedServer size={ICON_SIZE.md} uniProps={mutedColorMapping} />;
|
||||
const removeHostIcon = <ThemedTrash2 size={ICON_SIZE.sm} uniProps={destructiveColorMapping} />;
|
||||
|
||||
function formatConnectionTitle(
|
||||
connection: HostConnection,
|
||||
isLocalHost: boolean,
|
||||
t: TFunction,
|
||||
): string {
|
||||
const described = describeHostConnection(connection, { isLocalHost });
|
||||
return t(`settings.host.connectionKinds.${described.kind}`);
|
||||
}
|
||||
|
||||
function formatConnectionEndpoint(
|
||||
connection: HostConnection,
|
||||
isLocalHost: boolean,
|
||||
hosts: readonly HostProfile[],
|
||||
): string | undefined {
|
||||
const described = describeHostConnection(connection, { isLocalHost });
|
||||
if (described.kind === "routed" && described.endpoint) {
|
||||
return hosts.find((host) => host.serverId === described.endpoint)?.label ?? described.endpoint;
|
||||
}
|
||||
return described.endpoint ?? undefined;
|
||||
}
|
||||
|
||||
function formatDaemonVersion(version: string | null): string | undefined {
|
||||
const trimmed = version?.trim();
|
||||
if (!trimmed) return undefined;
|
||||
return trimmed.startsWith("v") ? trimmed : `v${trimmed}`;
|
||||
}
|
||||
|
||||
function ClientHostListRow({
|
||||
host,
|
||||
isLocalHost,
|
||||
hosts,
|
||||
onSelectHost,
|
||||
}: {
|
||||
host: HostProfile;
|
||||
isLocalHost: boolean;
|
||||
hosts: readonly HostProfile[];
|
||||
onSelectHost: (serverId: string) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const snapshot = useHostRuntimeSnapshot(host.serverId);
|
||||
const serverInfo = useSessionStore((state) => state.sessions[host.serverId]?.serverInfo);
|
||||
const detectedMachineKind = serverInfo?.machineKind ?? null;
|
||||
const resolvedIcon = resolveHostIcon({ appearance: host.appearance, detectedMachineKind });
|
||||
|
||||
const handleOpen = useCallback(() => {
|
||||
onSelectHost(host.serverId);
|
||||
}, [host.serverId, onSelectHost]);
|
||||
|
||||
const status = snapshot?.connectionStatus;
|
||||
const activeConnection = snapshot?.activeConnection ?? null;
|
||||
const activeConnectionId = snapshot?.activeConnectionId;
|
||||
const activeProbe = activeConnectionId
|
||||
? snapshot?.probeByConnectionId.get(activeConnectionId)
|
||||
: undefined;
|
||||
const latencyMs =
|
||||
status === "online" && activeProbe?.status === "available" ? activeProbe.latencyMs : null;
|
||||
|
||||
const fallbackConnection = useMemo(() => {
|
||||
if (activeConnection || host.connections.length === 0) return null;
|
||||
if (host.preferredConnectionId) {
|
||||
const preferred = host.connections.find((c) => c.id === host.preferredConnectionId);
|
||||
if (preferred) return preferred;
|
||||
}
|
||||
return host.connections[0] ?? null;
|
||||
}, [activeConnection, host.connections, host.preferredConnectionId]);
|
||||
|
||||
const hint = useMemo(() => {
|
||||
let described: ReturnType<typeof describeHostConnection> | null = null;
|
||||
if (activeConnection) {
|
||||
described = describeActiveConnection(activeConnection, { isLocalHost });
|
||||
} else if (fallbackConnection) {
|
||||
described = describeHostConnection(fallbackConnection, { isLocalHost });
|
||||
}
|
||||
const parts: string[] = [];
|
||||
if (described) {
|
||||
parts.push(t(`settings.host.connectionKinds.${described.kind}`));
|
||||
if (described.endpoint) {
|
||||
const endpoint =
|
||||
described.kind === "routed"
|
||||
? (hosts.find((candidate) => candidate.serverId === described.endpoint)?.label ??
|
||||
described.endpoint)
|
||||
: described.endpoint;
|
||||
parts.push(endpoint);
|
||||
}
|
||||
}
|
||||
if (latencyMs !== null) {
|
||||
parts.push(formatLatency(latencyMs));
|
||||
}
|
||||
return parts.join(" · ") || undefined;
|
||||
}, [activeConnection, fallbackConnection, hosts, isLocalHost, latencyMs, t]);
|
||||
|
||||
let summary: string | undefined;
|
||||
if (status === "online") {
|
||||
summary = formatDaemonVersion(serverInfo?.version ?? null);
|
||||
} else if (status === "offline" || status === "error") {
|
||||
summary = t("settings.about.offline");
|
||||
}
|
||||
|
||||
const leading = useMemo(
|
||||
() => (
|
||||
<View style={styles.listLeading}>
|
||||
<HostStatusDot serverId={host.serverId} />
|
||||
<HostIconGlyph icon={resolvedIcon} color={host.appearance.color} size={ICON_SIZE.md} />
|
||||
</View>
|
||||
),
|
||||
[host.appearance.color, host.serverId, resolvedIcon],
|
||||
);
|
||||
|
||||
return (
|
||||
<SettingsDetailRow
|
||||
label={host.label}
|
||||
leading={leading}
|
||||
hint={hint}
|
||||
summary={summary}
|
||||
onPress={handleOpen}
|
||||
testID={`client-host-row-${host.serverId}`}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export function ClientHostsSection({
|
||||
onSelectHost,
|
||||
onAddHost,
|
||||
enableBuiltInDaemonOption,
|
||||
}: {
|
||||
onSelectHost: (serverId: string) => void;
|
||||
onAddHost: () => void;
|
||||
enableBuiltInDaemonOption: EnableBuiltInDaemonOption;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const hosts = useHosts();
|
||||
const localServerId = useLocalDaemonServerId();
|
||||
const sortedHosts = useMemo(
|
||||
() => orderHostsLocalFirst(hosts, localServerId),
|
||||
[hosts, localServerId],
|
||||
);
|
||||
|
||||
return (
|
||||
<SettingsSection
|
||||
title={t("settings.clientHosts.title")}
|
||||
info={t("settings.clientHosts.info")}
|
||||
testID="client-hosts-section"
|
||||
>
|
||||
<SettingsCard testID="client-hosts-card">
|
||||
{sortedHosts.map((host) => (
|
||||
<ClientHostListRow
|
||||
key={host.serverId}
|
||||
host={host}
|
||||
isLocalHost={host.serverId === localServerId}
|
||||
hosts={sortedHosts}
|
||||
onSelectHost={onSelectHost}
|
||||
/>
|
||||
))}
|
||||
<SettingsAddRow
|
||||
label={t("settings.addHost")}
|
||||
onPress={onAddHost}
|
||||
testID="client-hosts-add-row"
|
||||
/>
|
||||
{enableBuiltInDaemonOption.visible ? (
|
||||
<SettingsDetailRow
|
||||
label={t("settings.enableBuiltInDaemon")}
|
||||
leading={enableDaemonIcon}
|
||||
onPress={enableBuiltInDaemonOption.onPress}
|
||||
testID="client-hosts-enable-built-in-daemon"
|
||||
/>
|
||||
) : null}
|
||||
</SettingsCard>
|
||||
</SettingsSection>
|
||||
);
|
||||
}
|
||||
|
||||
function ClientHostRouteRow({
|
||||
connection,
|
||||
isActive,
|
||||
isLocalHost,
|
||||
hosts,
|
||||
latencyMs,
|
||||
latencyLoading,
|
||||
latencyError,
|
||||
onRemove,
|
||||
}: {
|
||||
connection: HostConnection;
|
||||
isActive: boolean;
|
||||
isLocalHost: boolean;
|
||||
hosts: readonly HostProfile[];
|
||||
latencyMs: number | null | undefined;
|
||||
latencyLoading: boolean;
|
||||
latencyError: boolean;
|
||||
onRemove: (connection: HostConnection) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const title = formatConnectionTitle(connection, isLocalHost, t);
|
||||
const endpoint = formatConnectionEndpoint(connection, isLocalHost, hosts);
|
||||
|
||||
const latencyText = (() => {
|
||||
if (latencyLoading) return "...";
|
||||
if (latencyError) return t("settings.host.connections.timeout");
|
||||
if (latencyMs != null) return formatLatency(latencyMs);
|
||||
return "—";
|
||||
})();
|
||||
|
||||
const handlePressRemove = useCallback(() => {
|
||||
onRemove(connection);
|
||||
}, [onRemove, connection]);
|
||||
|
||||
const activeBadge = useMemo(
|
||||
() =>
|
||||
isActive ? (
|
||||
<StatusBadge label={t("settings.clientHosts.activeRoute")} variant="success" />
|
||||
) : null,
|
||||
[isActive, t],
|
||||
);
|
||||
|
||||
return (
|
||||
<SettingsRow label={title} labelAccessory={activeBadge} hint={endpoint}>
|
||||
<View style={styles.routeTrailing}>
|
||||
<Text style={latencyError ? styles.latencyError : styles.latencyText}>{latencyText}</Text>
|
||||
<Button variant="ghost" textStyle={styles.destructiveText} onPress={handlePressRemove}>
|
||||
{t("settings.host.connections.removeAction")}
|
||||
</Button>
|
||||
</View>
|
||||
</SettingsRow>
|
||||
);
|
||||
}
|
||||
|
||||
function ClientHostRoutesSection({
|
||||
host,
|
||||
isLocalHost,
|
||||
onAddHost,
|
||||
}: {
|
||||
host: HostProfile;
|
||||
isLocalHost: boolean;
|
||||
onAddHost: () => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const hosts = useHosts();
|
||||
const { removeConnection } = useHostMutations();
|
||||
const snapshot = useHostRuntimeSnapshot(host.serverId);
|
||||
const probeByConnectionId = snapshot?.probeByConnectionId ?? new Map();
|
||||
const activeConnectionId = snapshot?.activeConnectionId ?? null;
|
||||
const [pendingRemoveConnection, setPendingRemoveConnection] = useState<{
|
||||
connectionId: string;
|
||||
title: string;
|
||||
} | null>(null);
|
||||
const [isRemovingConnection, setIsRemovingConnection] = useState(false);
|
||||
|
||||
const removeConnectionHeader = useMemo<SheetHeader>(
|
||||
() => ({ title: t("settings.host.connections.removeTitle") }),
|
||||
[t],
|
||||
);
|
||||
|
||||
const handleRequestRemove = useCallback(
|
||||
(connection: HostConnection) => {
|
||||
const kindLabel = formatConnectionTitle(connection, isLocalHost, t);
|
||||
const endpoint = formatConnectionEndpoint(connection, isLocalHost, hosts);
|
||||
setPendingRemoveConnection({
|
||||
connectionId: connection.id,
|
||||
title: endpoint ? `${kindLabel} (${endpoint})` : kindLabel,
|
||||
});
|
||||
},
|
||||
[hosts, isLocalHost, t],
|
||||
);
|
||||
|
||||
const handleCloseConfirm = useCallback(() => {
|
||||
if (isRemovingConnection) return;
|
||||
setPendingRemoveConnection(null);
|
||||
}, [isRemovingConnection]);
|
||||
|
||||
const handleCancelConfirm = useCallback(() => {
|
||||
setPendingRemoveConnection(null);
|
||||
}, []);
|
||||
|
||||
const handleConfirmRemove = useCallback(() => {
|
||||
if (!pendingRemoveConnection) return;
|
||||
const { connectionId } = pendingRemoveConnection;
|
||||
setIsRemovingConnection(true);
|
||||
void removeConnection(host.serverId, connectionId)
|
||||
.then(() => setPendingRemoveConnection(null))
|
||||
.catch((error) => {
|
||||
console.error("[ClientHostDetail] Failed to remove connection", error);
|
||||
Alert.alert(
|
||||
t("settings.host.connections.removeErrorTitle"),
|
||||
t("settings.host.connections.removeErrorMessage"),
|
||||
);
|
||||
})
|
||||
.finally(() => setIsRemovingConnection(false));
|
||||
}, [pendingRemoveConnection, removeConnection, host.serverId, t]);
|
||||
|
||||
const addRouteButton = useMemo(
|
||||
() => (
|
||||
<Button
|
||||
variant="ghost"
|
||||
leftIcon={addRouteIcon}
|
||||
onPress={onAddHost}
|
||||
testID="client-host-add-route"
|
||||
>
|
||||
{t("settings.clientHosts.addRoute")}
|
||||
</Button>
|
||||
),
|
||||
[onAddHost, t],
|
||||
);
|
||||
|
||||
return (
|
||||
<SettingsSection
|
||||
title={t("settings.clientHosts.routesTitle")}
|
||||
info={t("settings.clientHosts.routesInfo")}
|
||||
trailing={addRouteButton}
|
||||
>
|
||||
<SettingsCard testID="host-page-connections-card">
|
||||
{host.connections.map((conn) => {
|
||||
const probe = probeByConnectionId.get(conn.id);
|
||||
return (
|
||||
<ClientHostRouteRow
|
||||
key={conn.id}
|
||||
connection={conn}
|
||||
isActive={snapshot?.connectionStatus === "online" && activeConnectionId === conn.id}
|
||||
isLocalHost={isLocalHost}
|
||||
hosts={hosts}
|
||||
latencyMs={probe?.status === "available" ? probe.latencyMs : undefined}
|
||||
latencyLoading={!probe || probe.status === "pending"}
|
||||
latencyError={probe?.status === "unavailable"}
|
||||
onRemove={handleRequestRemove}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</SettingsCard>
|
||||
|
||||
{pendingRemoveConnection ? (
|
||||
<AdaptiveModalSheet
|
||||
header={removeConnectionHeader}
|
||||
visible
|
||||
onClose={handleCloseConfirm}
|
||||
testID="remove-connection-confirm-modal"
|
||||
>
|
||||
<Text style={styles.confirmText}>
|
||||
{t("settings.host.connections.removeMessage", {
|
||||
name: pendingRemoveConnection.title,
|
||||
})}
|
||||
</Text>
|
||||
<View style={styles.confirmActions}>
|
||||
<Button
|
||||
variant="secondary"
|
||||
style={FLEX_1_STYLE}
|
||||
onPress={handleCancelConfirm}
|
||||
disabled={isRemovingConnection}
|
||||
>
|
||||
{t("common.actions.cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="destructive"
|
||||
style={FLEX_1_STYLE}
|
||||
onPress={handleConfirmRemove}
|
||||
disabled={isRemovingConnection}
|
||||
testID="remove-connection-confirm"
|
||||
>
|
||||
{t("settings.host.connections.removeAction")}
|
||||
</Button>
|
||||
</View>
|
||||
</AdaptiveModalSheet>
|
||||
) : null}
|
||||
</SettingsSection>
|
||||
);
|
||||
}
|
||||
|
||||
function RemoveClientHostSection({
|
||||
host,
|
||||
isLocalDaemon,
|
||||
onRemoved,
|
||||
}: {
|
||||
host: HostProfile;
|
||||
isLocalDaemon: boolean;
|
||||
onRemoved?: () => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const { removeHost } = useHostMutations();
|
||||
const { updateSettings } = useDesktopSettings();
|
||||
const { data: daemonStatusData, setStatus } = useDaemonStatus();
|
||||
const [isConfirming, setIsConfirming] = useState(false);
|
||||
const [isRemoving, setIsRemoving] = useState(false);
|
||||
const daemonStatus = daemonStatusData?.status ?? null;
|
||||
const stopsOwnedDaemon = isLocalDaemon && daemonStatus?.ownedByDesktop === true;
|
||||
|
||||
const removeHostHeader = useMemo<SheetHeader>(
|
||||
() => ({
|
||||
title: stopsOwnedDaemon
|
||||
? t("settings.host.daemon.remove.localConfirmTitle")
|
||||
: t("settings.host.daemon.remove.title"),
|
||||
}),
|
||||
[stopsOwnedDaemon, t],
|
||||
);
|
||||
|
||||
const handleOpenConfirm = useCallback(() => setIsConfirming(true), []);
|
||||
const handleCloseConfirm = useCallback(() => {
|
||||
if (isRemoving) return;
|
||||
setIsConfirming(false);
|
||||
}, [isRemoving]);
|
||||
const handleCancel = useCallback(() => setIsConfirming(false), []);
|
||||
|
||||
const rollbackLocalhostRemoval = useCallback(
|
||||
async (shouldRestartDaemon: boolean) => {
|
||||
await updateSettings({ daemon: { manageBuiltInDaemon: true } });
|
||||
if (!shouldRestartDaemon) return;
|
||||
setStatus(await startDesktopDaemon());
|
||||
},
|
||||
[setStatus, updateSettings],
|
||||
);
|
||||
|
||||
const handleConfirmRemove = useCallback(() => {
|
||||
setIsRemoving(true);
|
||||
const remove = async () => {
|
||||
let didDisableDaemonManagement = false;
|
||||
let didStopDaemon = false;
|
||||
if (isLocalDaemon) {
|
||||
try {
|
||||
await updateSettings({ daemon: { manageBuiltInDaemon: false } });
|
||||
didDisableDaemonManagement = true;
|
||||
if (daemonStatus?.status === "running" && daemonStatus.ownedByDesktop) {
|
||||
setStatus(await stopDesktopDaemon("host_remove"));
|
||||
didStopDaemon = true;
|
||||
}
|
||||
await removeHost(host.serverId);
|
||||
} catch (error) {
|
||||
if (didDisableDaemonManagement) {
|
||||
try {
|
||||
await rollbackLocalhostRemoval(didStopDaemon);
|
||||
} catch (rollbackError) {
|
||||
console.error(
|
||||
"[ClientHostDetail] Failed to roll back localhost removal",
|
||||
rollbackError,
|
||||
);
|
||||
}
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
return;
|
||||
}
|
||||
await removeHost(host.serverId);
|
||||
};
|
||||
void remove()
|
||||
.then(() => {
|
||||
setIsConfirming(false);
|
||||
onRemoved?.();
|
||||
return;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("[ClientHostDetail] Failed to remove host", error);
|
||||
Alert.alert(
|
||||
t("settings.host.daemon.remove.errorTitle"),
|
||||
isLocalDaemon
|
||||
? t("settings.host.daemon.remove.localErrorMessage")
|
||||
: t("settings.host.daemon.remove.errorMessage"),
|
||||
);
|
||||
})
|
||||
.finally(() => setIsRemoving(false));
|
||||
}, [
|
||||
daemonStatus,
|
||||
host.serverId,
|
||||
isLocalDaemon,
|
||||
onRemoved,
|
||||
removeHost,
|
||||
rollbackLocalhostRemoval,
|
||||
setStatus,
|
||||
t,
|
||||
updateSettings,
|
||||
]);
|
||||
|
||||
return (
|
||||
<SettingsSection
|
||||
title={t("settings.host.daemon.dangerZone")}
|
||||
testID="host-page-remove-host-card"
|
||||
>
|
||||
<SettingsCard>
|
||||
<SettingsRow
|
||||
label={
|
||||
isLocalDaemon
|
||||
? t("settings.host.daemon.remove.localTitle")
|
||||
: t("settings.host.daemon.remove.title")
|
||||
}
|
||||
hint={
|
||||
stopsOwnedDaemon
|
||||
? t("settings.host.daemon.remove.localHint")
|
||||
: t("settings.host.daemon.remove.hint")
|
||||
}
|
||||
>
|
||||
<Button
|
||||
variant="outline"
|
||||
leftIcon={removeHostIcon}
|
||||
textStyle={styles.destructiveText}
|
||||
onPress={handleOpenConfirm}
|
||||
testID="host-page-remove-host-button"
|
||||
>
|
||||
{t("settings.host.connections.removeAction")}
|
||||
</Button>
|
||||
</SettingsRow>
|
||||
</SettingsCard>
|
||||
|
||||
{isConfirming ? (
|
||||
<AdaptiveModalSheet
|
||||
header={removeHostHeader}
|
||||
visible
|
||||
onClose={handleCloseConfirm}
|
||||
testID="remove-host-confirm-modal"
|
||||
>
|
||||
<Text style={styles.confirmText}>
|
||||
{stopsOwnedDaemon
|
||||
? t("settings.host.daemon.remove.localConfirmMessage")
|
||||
: t("settings.host.daemon.remove.confirmMessage", { name: host.label })}
|
||||
</Text>
|
||||
<View style={styles.confirmActions}>
|
||||
<Button
|
||||
variant="secondary"
|
||||
style={FLEX_1_STYLE}
|
||||
onPress={handleCancel}
|
||||
disabled={isRemoving}
|
||||
>
|
||||
{t("common.actions.cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="destructive"
|
||||
style={FLEX_1_STYLE}
|
||||
onPress={handleConfirmRemove}
|
||||
disabled={isRemoving}
|
||||
testID="remove-host-confirm"
|
||||
>
|
||||
{t("settings.host.connections.removeAction")}
|
||||
</Button>
|
||||
</View>
|
||||
</AdaptiveModalSheet>
|
||||
) : null}
|
||||
</SettingsSection>
|
||||
);
|
||||
}
|
||||
|
||||
export function ClientHostDetailPage({
|
||||
serverId,
|
||||
onBack,
|
||||
onAddHost,
|
||||
onHostRemoved,
|
||||
}: {
|
||||
serverId: string;
|
||||
onBack: () => void;
|
||||
onAddHost: () => void;
|
||||
onHostRemoved?: () => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const isCompact = useIsCompactFormFactor();
|
||||
const hosts = useHosts();
|
||||
const host = hosts.find((entry) => entry.serverId === serverId) ?? null;
|
||||
const isLocalDaemon = useIsLocalDaemon(serverId);
|
||||
const detectedMachineKind = useSessionStore(
|
||||
(state) => state.sessions[serverId]?.serverInfo?.machineKind ?? null,
|
||||
);
|
||||
|
||||
const parent = useMemo(
|
||||
() => ({
|
||||
label: t("settings.sections.hosts"),
|
||||
accessibilityLabel: t("settings.clientHosts.backToHosts"),
|
||||
onPress: onBack,
|
||||
testID: "client-host-detail-back",
|
||||
}),
|
||||
[onBack, t],
|
||||
);
|
||||
|
||||
const resolvedIcon = host
|
||||
? resolveHostIcon({ appearance: host.appearance, detectedMachineKind })
|
||||
: "server";
|
||||
|
||||
const icon = useMemo(
|
||||
() =>
|
||||
host ? (
|
||||
<HostIconGlyph
|
||||
icon={resolvedIcon}
|
||||
color={host.appearance.color}
|
||||
size={isCompact ? ICON_SIZE.md : ICON_SIZE.lg}
|
||||
/>
|
||||
) : undefined,
|
||||
[host, isCompact, resolvedIcon],
|
||||
);
|
||||
|
||||
if (!host) {
|
||||
return (
|
||||
<View testID="client-host-detail-page">
|
||||
<SettingsDetailHeader parent={parent} titleTestID="client-host-detail-title" />
|
||||
<View style={[settingsStyles.card, styles.emptyCard]}>
|
||||
<Text style={styles.emptyText}>{t("settings.host.notFound")}</Text>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<View testID="client-host-detail-page">
|
||||
<SettingsDetailHeader
|
||||
parent={parent}
|
||||
icon={icon}
|
||||
title={host.label}
|
||||
titleTestID="client-host-detail-title"
|
||||
/>
|
||||
<HostConnectionError serverId={serverId} />
|
||||
<ClientHostRoutesSection host={host} isLocalHost={isLocalDaemon} onAddHost={onAddHost} />
|
||||
<HostAppearanceSection host={host} />
|
||||
<RemoveClientHostSection
|
||||
host={host}
|
||||
isLocalDaemon={isLocalDaemon}
|
||||
onRemoved={onHostRemoved}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
listLeading: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[2],
|
||||
},
|
||||
routeTrailing: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[2],
|
||||
},
|
||||
latencyText: {
|
||||
fontSize: theme.fontSize.sm,
|
||||
color: theme.colors.foregroundMuted,
|
||||
fontVariant: ["tabular-nums"],
|
||||
},
|
||||
latencyError: {
|
||||
fontSize: theme.fontSize.sm,
|
||||
color: theme.colors.statusDanger,
|
||||
},
|
||||
destructiveText: {
|
||||
color: theme.colors.destructive,
|
||||
},
|
||||
confirmText: {
|
||||
color: theme.colors.foregroundMuted,
|
||||
fontSize: theme.fontSize.base,
|
||||
},
|
||||
confirmActions: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[2],
|
||||
marginTop: theme.spacing[4],
|
||||
},
|
||||
emptyCard: {
|
||||
padding: theme.spacing[4],
|
||||
alignItems: "center",
|
||||
},
|
||||
emptyText: {
|
||||
color: theme.colors.foregroundMuted,
|
||||
fontSize: theme.fontSize.base,
|
||||
},
|
||||
}));
|
||||
|
||||
const FLEX_1_STYLE = { flex: 1 };
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useCallback, useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import type { TFunction } from "i18next";
|
||||
import { Text, View } from "react-native";
|
||||
import { View } from "react-native";
|
||||
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
||||
import { SettingsCard, SettingsRow, SettingsSection } from "@/components/settings";
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -16,7 +16,6 @@ import {
|
||||
type FilePanelSettingsRow,
|
||||
} from "@/file-panels";
|
||||
import { PluginIconView } from "@/plugins/icons";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
import type { Theme } from "@/styles/theme";
|
||||
|
||||
const MENU_ICON_SIZE = 16;
|
||||
@@ -28,26 +27,21 @@ const mutedIconMapping = (theme: Theme) => ({ color: theme.colors.foregroundMute
|
||||
export function FilesSection() {
|
||||
const { t } = useTranslation();
|
||||
const { rows, choose, askAgain } = useFilePanelSettings();
|
||||
if (rows.length === 0) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<SettingsSection title={t("settings.files.title")} testID="file-panel-settings">
|
||||
{rows.length === 0 ? (
|
||||
<View style={settingsStyles.card} testID="file-panel-settings-empty">
|
||||
<View style={styles.emptyCard}>
|
||||
<Text style={styles.emptyText}>{t("settings.files.empty")}</Text>
|
||||
</View>
|
||||
</View>
|
||||
) : (
|
||||
<SettingsCard testID="file-panel-settings-card">
|
||||
{rows.map((row) => (
|
||||
<FilePanelSettingsRowView
|
||||
key={row.selectorKey}
|
||||
row={row}
|
||||
onChoose={choose}
|
||||
onAskAgain={askAgain}
|
||||
/>
|
||||
))}
|
||||
</SettingsCard>
|
||||
)}
|
||||
<SettingsCard testID="file-panel-settings-card">
|
||||
{rows.map((row) => (
|
||||
<FilePanelSettingsRowView
|
||||
key={row.selectorKey}
|
||||
row={row}
|
||||
onChoose={choose}
|
||||
onAskAgain={askAgain}
|
||||
/>
|
||||
))}
|
||||
</SettingsCard>
|
||||
</SettingsSection>
|
||||
);
|
||||
}
|
||||
@@ -153,12 +147,4 @@ const styles = StyleSheet.create((theme) => ({
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[2],
|
||||
},
|
||||
emptyCard: {
|
||||
padding: theme.spacing[4],
|
||||
alignItems: "center",
|
||||
},
|
||||
emptyText: {
|
||||
color: theme.colors.foregroundMuted,
|
||||
fontSize: theme.fontSize.base,
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -24,6 +24,7 @@ import { AgentProfilesPage, type AgentProfilesBeforeLeaveGuard } from "@/agent-p
|
||||
import { AgentSkillsSection } from "@/agent-skills";
|
||||
import { AdaptiveModalSheet, type SheetHeader } from "@/components/adaptive-modal-sheet";
|
||||
import { PageLayout } from "@/components/page-layout";
|
||||
import { SettingsCard, SettingsRow, SettingsSection } from "@/components/settings";
|
||||
import { SettingsTextAreaCard } from "@/components/settings-textarea";
|
||||
import { Alert as InlineAlert } from "@/components/ui/alert";
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -33,17 +34,14 @@ import {
|
||||
ProfileDraft,
|
||||
TerminalProfileEditModal,
|
||||
} from "@/screens/settings/terminal-profile-edit-modal";
|
||||
import { startDesktopDaemon, stopDesktopDaemon } from "@/desktop/daemon/desktop-daemon";
|
||||
import { LocalDaemonSection } from "@/desktop/components/desktop-updates-section";
|
||||
import { useDaemonStatus } from "@/desktop/hooks/use-daemon-status";
|
||||
import { useDesktopSettings } from "@/desktop/settings/desktop-settings";
|
||||
import { WaysToConnect } from "@/devices";
|
||||
import { useDaemonConfig } from "@/hooks/use-daemon-config";
|
||||
import { useIsLocalDaemon } from "@/hooks/use-is-local-daemon";
|
||||
import { useHostFeature } from "@/runtime/host-features";
|
||||
import {
|
||||
getHostRuntimeStore,
|
||||
isHostRuntimeConnected,
|
||||
useHostMutations,
|
||||
useHostRuntimeClient,
|
||||
useHostRuntimeIsConnected,
|
||||
useHostRuntimeSnapshot,
|
||||
@@ -52,8 +50,7 @@ import {
|
||||
import { ProviderList } from "@/provider-settings";
|
||||
import { openProviderSettings } from "@/navigation/settings-navigation";
|
||||
import { HostUsageSection } from "@/usage";
|
||||
import { HostAppearanceSection } from "@/screens/settings/host-appearance-section";
|
||||
import { SettingsSection } from "@/components/settings/headings/settings-section";
|
||||
import { MetadataGenerationPage } from "@/screens/settings/metadata-generation-page";
|
||||
import { useSessionStore } from "@/stores/session-store";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
import type { HostConnection, HostProfile } from "@/types/host-connection";
|
||||
@@ -61,14 +58,13 @@ import { confirmDialog } from "@/utils/confirm-dialog";
|
||||
import { isVersionMismatch } from "@/desktop/updates/desktop-updates";
|
||||
import { resolveAppVersion } from "@/utils/app-version";
|
||||
import { formatConnectionStatus, getConnectionStatusTone } from "@/utils/daemons";
|
||||
import { formatLatency } from "@/utils/latency";
|
||||
import { ICON_SIZE } from "@/styles/theme";
|
||||
import type { Theme } from "@/styles/theme";
|
||||
import { useProviderIcon } from "@/components/provider-icons";
|
||||
import { BrowserToolsOptInCard } from "./browser-tools-card";
|
||||
import { PaseoToolsCard } from "./paseo-tools-card";
|
||||
import { RestartRecoveryCard } from "./restart-recovery-card";
|
||||
import { IdleRuntimeCleanupCard } from "./idle-runtime-cleanup-card";
|
||||
import { BrowserToolsRow } from "./browser-tools-card";
|
||||
import { HostPaseoToolsRow } from "./paseo-tools-card";
|
||||
import { RestartRecoveryRow } from "./restart-recovery-card";
|
||||
import { IdleRuntimeCleanupRow } from "./idle-runtime-cleanup-card";
|
||||
import { restartDaemonFromSettings, updateDaemonFromSettings } from "./daemon-lifecycle";
|
||||
|
||||
const ThemedRestart = withUnistyles(RotateCw);
|
||||
@@ -109,20 +105,6 @@ const editProfileIcon = <ThemedProfilePencil size={ICON_SIZE.sm} uniProps={muted
|
||||
const removeProfileIcon = <ThemedTrash2 size={ICON_SIZE.sm} uniProps={destructiveColorMapping} />;
|
||||
const addProfileIcon = <ThemedPlus size={ICON_SIZE.sm} uniProps={mutedColorMapping} />;
|
||||
|
||||
function formatHostConnectionLabel(connection: HostConnection, t: TFunction): string {
|
||||
if (connection.type === "routed") return `Via ${connection.originServerId}`;
|
||||
if (connection.type === "relay") {
|
||||
return `${t("settings.host.badges.relay")} (${connection.relayEndpoint})`;
|
||||
}
|
||||
if (connection.type === "directSocket" || connection.type === "directPipe") {
|
||||
return `${t("settings.host.badges.local")} (${connection.path})`;
|
||||
}
|
||||
if (connection.type === "remoteSsh") {
|
||||
return `${t("settings.host.badges.remoteSsh")} (${connection.host})`;
|
||||
}
|
||||
return `TCP (${connection.endpoint})`;
|
||||
}
|
||||
|
||||
function formatActiveConnectionBadge(
|
||||
activeConnection: { type: HostConnection["type"]; display: string } | null,
|
||||
theme: ReturnType<typeof useUnistyles>["theme"],
|
||||
@@ -229,7 +211,7 @@ function HostStatusBadges({ serverId }: { serverId: string }) {
|
||||
);
|
||||
}
|
||||
|
||||
function HostConnectionError({ serverId }: { serverId: string }) {
|
||||
export function HostConnectionError({ serverId }: { serverId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const snapshot = useHostRuntimeSnapshot(serverId);
|
||||
const lastError = snapshot?.lastError ?? null;
|
||||
@@ -249,21 +231,6 @@ function HostConnectionError({ serverId }: { serverId: string }) {
|
||||
);
|
||||
}
|
||||
|
||||
export function HostConnectionsPage({ serverId }: { serverId: string }) {
|
||||
const host = useHostProfile(serverId);
|
||||
|
||||
if (!host) {
|
||||
return <HostNotFound />;
|
||||
}
|
||||
|
||||
return (
|
||||
<View>
|
||||
<HostConnectionError serverId={serverId} />
|
||||
<ConnectionsSection host={host} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export function HostDevicesPage({ serverId }: { serverId: string }) {
|
||||
const host = useHostProfile(serverId);
|
||||
|
||||
@@ -274,7 +241,7 @@ export function HostDevicesPage({ serverId }: { serverId: string }) {
|
||||
return <WaysToConnect serverId={serverId} />;
|
||||
}
|
||||
|
||||
export function HostAgentsPage({ serverId }: { serverId: string }) {
|
||||
export function HostToolsPage({ serverId }: { serverId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const host = useHostProfile(serverId);
|
||||
const isConnected = useHostRuntimeIsConnected(serverId);
|
||||
@@ -286,13 +253,19 @@ export function HostAgentsPage({ serverId }: { serverId: string }) {
|
||||
return (
|
||||
<View>
|
||||
{isConnected ? (
|
||||
<SettingsSection title={t("settings.hostSections.agents")}>
|
||||
<PaseoToolsCard serverId={serverId} />
|
||||
<BrowserToolsOptInCard serverId={serverId} />
|
||||
<AppendSystemPromptCard serverId={serverId} />
|
||||
<RestartRecoveryCard serverId={serverId} />
|
||||
<IdleRuntimeCleanupCard serverId={serverId} />
|
||||
</SettingsSection>
|
||||
<>
|
||||
<SettingsSection title={t("settings.host.tools.instructionsTitle")}>
|
||||
<SettingsCard>
|
||||
<AppendSystemPromptRow serverId={serverId} />
|
||||
</SettingsCard>
|
||||
</SettingsSection>
|
||||
<SettingsSection title={t("settings.host.tools.toolsTitle")}>
|
||||
<SettingsCard testID="host-page-inject-mcp-card">
|
||||
<HostPaseoToolsRow serverId={serverId} />
|
||||
<BrowserToolsRow serverId={serverId} />
|
||||
</SettingsCard>
|
||||
</SettingsSection>
|
||||
</>
|
||||
) : (
|
||||
<View style={[settingsStyles.card, styles.emptyCard]}>
|
||||
<Text style={styles.emptyText}>{t("settings.host.agents.unavailable")}</Text>
|
||||
@@ -347,10 +320,14 @@ export function HostWorkspacesPage({ serverId }: { serverId: string }) {
|
||||
|
||||
return (
|
||||
<View>
|
||||
<HostConnectionError serverId={serverId} />
|
||||
{isConnected ? (
|
||||
<SettingsSection title={t("settings.hostSections.workspaces")}>
|
||||
<AutoArchiveMergedWorkspacesCard serverId={serverId} />
|
||||
</SettingsSection>
|
||||
<>
|
||||
<SettingsSection title={t("settings.hostSections.workspaces")}>
|
||||
<AutoArchiveMergedWorkspacesCard serverId={serverId} />
|
||||
</SettingsSection>
|
||||
<MetadataGenerationPage serverId={serverId} />
|
||||
</>
|
||||
) : (
|
||||
<View style={[settingsStyles.card, styles.emptyCard]}>
|
||||
<Text style={styles.emptyText}>{t("settings.host.workspaces.unavailable")}</Text>
|
||||
@@ -392,13 +369,29 @@ export function HostUsagePage({ serverId }: { serverId: string }) {
|
||||
);
|
||||
}
|
||||
|
||||
export function HostSettingsPage({
|
||||
serverId,
|
||||
onHostRemoved,
|
||||
}: {
|
||||
serverId: string;
|
||||
onHostRemoved?: () => void;
|
||||
}) {
|
||||
function HostAgentRuntimeSection({ serverId }: { serverId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const isConnected = useHostRuntimeIsConnected(serverId);
|
||||
const supportsResume = useHostFeature(serverId, "resumeOnStartupSetting");
|
||||
const supportsIdleCleanup = useHostFeature(serverId, "idleRuntimeCleanupSetting");
|
||||
const { config } = useDaemonConfig(serverId);
|
||||
|
||||
if (!isConnected || !config || (!supportsResume && !supportsIdleCleanup)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<SettingsSection title={t("settings.host.daemon.runtimeTitle")}>
|
||||
<SettingsCard>
|
||||
{supportsResume ? <RestartRecoveryRow serverId={serverId} /> : null}
|
||||
{supportsIdleCleanup ? <IdleRuntimeCleanupRow serverId={serverId} /> : null}
|
||||
</SettingsCard>
|
||||
</SettingsSection>
|
||||
);
|
||||
}
|
||||
|
||||
export function HostDaemonPage({ serverId }: { serverId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const host = useHostProfile(serverId);
|
||||
const isLocalDaemon = useIsLocalDaemon(serverId);
|
||||
|
||||
@@ -411,178 +404,15 @@ export function HostSettingsPage({
|
||||
<HostStatusBadges serverId={serverId} />
|
||||
<HostConnectionError serverId={serverId} />
|
||||
|
||||
<HostAppearanceSection host={host} />
|
||||
|
||||
{isLocalDaemon ? <LocalDaemonSection /> : null}
|
||||
|
||||
{!isLocalDaemon ? <UpdateDaemonCard key={host.serverId} host={host} /> : null}
|
||||
|
||||
<RemoveHostSection host={host} isLocalDaemon={isLocalDaemon} onRemoved={onHostRemoved} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
<HostAgentRuntimeSection serverId={serverId} />
|
||||
|
||||
function ConnectionsSection({ host }: { host: HostProfile }) {
|
||||
const { t } = useTranslation();
|
||||
const { removeConnection } = useHostMutations();
|
||||
const snapshot = useHostRuntimeSnapshot(host.serverId);
|
||||
const probeByConnectionId = snapshot?.probeByConnectionId ?? new Map();
|
||||
const [pendingRemoveConnection, setPendingRemoveConnection] = useState<{
|
||||
connectionId: string;
|
||||
title: string;
|
||||
} | null>(null);
|
||||
const [isRemovingConnection, setIsRemovingConnection] = useState(false);
|
||||
const removeConnectionHeader = useMemo<SheetHeader>(
|
||||
() => ({ title: t("settings.host.connections.removeTitle") }),
|
||||
[t],
|
||||
);
|
||||
|
||||
const handleRequestRemove = useCallback(
|
||||
(connection: HostConnection) => {
|
||||
setPendingRemoveConnection({
|
||||
connectionId: connection.id,
|
||||
title: formatHostConnectionLabel(connection, t),
|
||||
});
|
||||
},
|
||||
[t],
|
||||
);
|
||||
|
||||
const handleCloseConfirm = useCallback(() => {
|
||||
if (isRemovingConnection) return;
|
||||
setPendingRemoveConnection(null);
|
||||
}, [isRemovingConnection]);
|
||||
|
||||
const handleCancelConfirm = useCallback(() => {
|
||||
setPendingRemoveConnection(null);
|
||||
}, []);
|
||||
|
||||
const handleConfirmRemove = useCallback(() => {
|
||||
if (!pendingRemoveConnection) return;
|
||||
const { connectionId } = pendingRemoveConnection;
|
||||
setIsRemovingConnection(true);
|
||||
void removeConnection(host.serverId, connectionId)
|
||||
.then(() => setPendingRemoveConnection(null))
|
||||
.catch((error) => {
|
||||
console.error("[HostPage] Failed to remove connection", error);
|
||||
Alert.alert(
|
||||
t("settings.host.connections.removeErrorTitle"),
|
||||
t("settings.host.connections.removeErrorMessage"),
|
||||
);
|
||||
})
|
||||
.finally(() => setIsRemovingConnection(false));
|
||||
}, [pendingRemoveConnection, removeConnection, host.serverId, t]);
|
||||
|
||||
return (
|
||||
<SettingsSection title={t("settings.host.connections.title")}>
|
||||
<View style={settingsStyles.card} testID="host-page-connections-card">
|
||||
{host.connections.map((conn, index) => {
|
||||
const probe = probeByConnectionId.get(conn.id);
|
||||
return (
|
||||
<ConnectionRow
|
||||
key={conn.id}
|
||||
connection={conn}
|
||||
showBorder={index > 0}
|
||||
latencyMs={probe?.status === "available" ? probe.latencyMs : undefined}
|
||||
latencyLoading={!probe || probe.status === "pending"}
|
||||
latencyError={probe?.status === "unavailable"}
|
||||
onRemove={handleRequestRemove}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
|
||||
{pendingRemoveConnection ? (
|
||||
<AdaptiveModalSheet
|
||||
header={removeConnectionHeader}
|
||||
visible
|
||||
onClose={handleCloseConfirm}
|
||||
testID="remove-connection-confirm-modal"
|
||||
>
|
||||
<Text style={styles.confirmText}>
|
||||
{t("settings.host.connections.removeMessage", {
|
||||
name: pendingRemoveConnection.title,
|
||||
})}
|
||||
</Text>
|
||||
<View style={styles.confirmActions}>
|
||||
<Button
|
||||
variant="secondary"
|
||||
style={FLEX_1_STYLE}
|
||||
onPress={handleCancelConfirm}
|
||||
disabled={isRemovingConnection}
|
||||
>
|
||||
{t("common.actions.cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="destructive"
|
||||
style={FLEX_1_STYLE}
|
||||
onPress={handleConfirmRemove}
|
||||
disabled={isRemovingConnection}
|
||||
testID="remove-connection-confirm"
|
||||
>
|
||||
{t("settings.host.connections.removeAction")}
|
||||
</Button>
|
||||
</View>
|
||||
</AdaptiveModalSheet>
|
||||
) : null}
|
||||
</SettingsSection>
|
||||
);
|
||||
}
|
||||
|
||||
function ConnectionRow({
|
||||
connection,
|
||||
showBorder,
|
||||
latencyMs,
|
||||
latencyLoading,
|
||||
latencyError,
|
||||
onRemove,
|
||||
}: {
|
||||
connection: HostConnection;
|
||||
showBorder: boolean;
|
||||
latencyMs: number | null | undefined;
|
||||
latencyLoading: boolean;
|
||||
latencyError: boolean;
|
||||
onRemove: (connection: HostConnection) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const { theme } = useUnistyles();
|
||||
const title = formatHostConnectionLabel(connection, t);
|
||||
|
||||
const latencyText = (() => {
|
||||
if (latencyLoading) return "...";
|
||||
if (latencyError) return t("settings.host.connections.timeout");
|
||||
if (latencyMs != null) return formatLatency(latencyMs);
|
||||
return "—";
|
||||
})();
|
||||
const latencyColor = latencyError ? theme.colors.palette.red[300] : theme.colors.foregroundMuted;
|
||||
|
||||
const handlePressRemove = useCallback(() => {
|
||||
onRemove(connection);
|
||||
}, [onRemove, connection]);
|
||||
|
||||
const rowStyle = useMemo(
|
||||
() => [settingsStyles.row, showBorder && settingsStyles.rowBorder],
|
||||
[showBorder],
|
||||
);
|
||||
const latencyTextStyle = useMemo(
|
||||
() => [styles.connectionLatency, { color: latencyColor }],
|
||||
[latencyColor],
|
||||
);
|
||||
const destructiveTextStyle = useMemo(
|
||||
() => ({ color: theme.colors.destructive }),
|
||||
[theme.colors.destructive],
|
||||
);
|
||||
|
||||
return (
|
||||
<View style={rowStyle}>
|
||||
<View style={settingsStyles.rowContent}>
|
||||
<Text style={settingsStyles.rowTitle} numberOfLines={1}>
|
||||
{title}
|
||||
</Text>
|
||||
</View>
|
||||
<Text style={latencyTextStyle}>{latencyText}</Text>
|
||||
<Button variant="ghost" textStyle={destructiveTextStyle} onPress={handlePressRemove}>
|
||||
{t("settings.host.connections.removeAction")}
|
||||
</Button>
|
||||
<SettingsSection title={t("settings.host.daemon.dangerZone")}>
|
||||
<RestartDaemonCard host={host} />
|
||||
</SettingsSection>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -1012,7 +842,7 @@ function EnableTerminalAgentHooksCard({ serverId }: { serverId: string }) {
|
||||
);
|
||||
}
|
||||
|
||||
function AppendSystemPromptCard({ serverId }: { serverId: string }) {
|
||||
function AppendSystemPromptRow({ serverId }: { serverId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const isConnected = useHostRuntimeIsConnected(serverId);
|
||||
const { config, patchConfig } = useDaemonConfig(serverId);
|
||||
@@ -1063,25 +893,15 @@ function AppendSystemPromptCard({ serverId }: { serverId: string }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<View style={settingsStyles.card} testID="host-page-append-system-prompt-card">
|
||||
<View style={settingsStyles.row}>
|
||||
<View style={settingsStyles.rowContent}>
|
||||
<Text style={settingsStyles.rowTitle}>
|
||||
{t("settings.host.orchestration.systemPrompt.title")}
|
||||
</Text>
|
||||
<Text style={settingsStyles.rowHint}>
|
||||
{t("settings.host.orchestration.systemPrompt.hint")}
|
||||
</Text>
|
||||
</View>
|
||||
<Button
|
||||
variant="outline"
|
||||
onPress={handleOpen}
|
||||
testID="host-page-append-system-prompt-edit"
|
||||
>
|
||||
{t("settings.host.orchestration.systemPrompt.edit")}
|
||||
</Button>
|
||||
</View>
|
||||
</View>
|
||||
<SettingsRow
|
||||
label={t("settings.host.orchestration.systemPrompt.title")}
|
||||
hint={t("settings.host.orchestration.systemPrompt.hint")}
|
||||
testID="host-page-append-system-prompt-card"
|
||||
>
|
||||
<Button variant="outline" onPress={handleOpen} testID="host-page-append-system-prompt-edit">
|
||||
{t("settings.host.orchestration.systemPrompt.edit")}
|
||||
</Button>
|
||||
</SettingsRow>
|
||||
|
||||
{isEditing ? (
|
||||
<AdaptiveModalSheet
|
||||
@@ -1124,185 +944,6 @@ function AppendSystemPromptCard({ serverId }: { serverId: string }) {
|
||||
);
|
||||
}
|
||||
|
||||
function RemoveHostSection({
|
||||
host,
|
||||
isLocalDaemon,
|
||||
onRemoved,
|
||||
}: {
|
||||
host: HostProfile;
|
||||
isLocalDaemon: boolean;
|
||||
onRemoved?: () => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const { theme } = useUnistyles();
|
||||
const { removeHost } = useHostMutations();
|
||||
const { updateSettings } = useDesktopSettings();
|
||||
const { data: daemonStatusData, setStatus } = useDaemonStatus();
|
||||
const [isConfirming, setIsConfirming] = useState(false);
|
||||
const [isRemoving, setIsRemoving] = useState(false);
|
||||
const daemonStatus = daemonStatusData?.status ?? null;
|
||||
const stopsOwnedDaemon = isLocalDaemon && daemonStatus?.ownedByDesktop === true;
|
||||
const removeHostHeader = useMemo<SheetHeader>(
|
||||
() => ({
|
||||
title: stopsOwnedDaemon
|
||||
? t("settings.host.daemon.remove.localConfirmTitle")
|
||||
: t("settings.host.daemon.remove.title"),
|
||||
}),
|
||||
[stopsOwnedDaemon, t],
|
||||
);
|
||||
|
||||
const destructiveTextStyle = useMemo(
|
||||
() => ({ color: theme.colors.destructive }),
|
||||
[theme.colors.destructive],
|
||||
);
|
||||
|
||||
const handleOpenConfirm = useCallback(() => setIsConfirming(true), []);
|
||||
const handleCloseConfirm = useCallback(() => {
|
||||
if (isRemoving) return;
|
||||
setIsConfirming(false);
|
||||
}, [isRemoving]);
|
||||
const handleCancel = useCallback(() => setIsConfirming(false), []);
|
||||
const rollbackLocalhostRemoval = useCallback(
|
||||
async (shouldRestartDaemon: boolean) => {
|
||||
await updateSettings({ daemon: { manageBuiltInDaemon: true } });
|
||||
if (!shouldRestartDaemon) {
|
||||
return;
|
||||
}
|
||||
setStatus(await startDesktopDaemon());
|
||||
},
|
||||
[setStatus, updateSettings],
|
||||
);
|
||||
const handleConfirmRemove = useCallback(() => {
|
||||
setIsRemoving(true);
|
||||
const remove = async () => {
|
||||
let didDisableDaemonManagement = false;
|
||||
let didStopDaemon = false;
|
||||
if (isLocalDaemon) {
|
||||
try {
|
||||
await updateSettings({ daemon: { manageBuiltInDaemon: false } });
|
||||
didDisableDaemonManagement = true;
|
||||
if (daemonStatus?.status === "running" && daemonStatus.ownedByDesktop) {
|
||||
setStatus(await stopDesktopDaemon("host_remove"));
|
||||
didStopDaemon = true;
|
||||
}
|
||||
await removeHost(host.serverId);
|
||||
} catch (error) {
|
||||
if (didDisableDaemonManagement) {
|
||||
try {
|
||||
await rollbackLocalhostRemoval(didStopDaemon);
|
||||
} catch (rollbackError) {
|
||||
console.error("[HostPage] Failed to roll back localhost removal", rollbackError);
|
||||
}
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
return;
|
||||
}
|
||||
await removeHost(host.serverId);
|
||||
};
|
||||
void remove()
|
||||
.then(() => {
|
||||
setIsConfirming(false);
|
||||
onRemoved?.();
|
||||
return;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("[HostPage] Failed to remove host", error);
|
||||
Alert.alert(
|
||||
t("settings.host.daemon.remove.errorTitle"),
|
||||
isLocalDaemon
|
||||
? t("settings.host.daemon.remove.localErrorMessage")
|
||||
: t("settings.host.daemon.remove.errorMessage"),
|
||||
);
|
||||
})
|
||||
.finally(() => setIsRemoving(false));
|
||||
}, [
|
||||
daemonStatus,
|
||||
host.serverId,
|
||||
isLocalDaemon,
|
||||
onRemoved,
|
||||
removeHost,
|
||||
rollbackLocalhostRemoval,
|
||||
setStatus,
|
||||
t,
|
||||
updateSettings,
|
||||
]);
|
||||
|
||||
const removeIcon = useMemo(
|
||||
() => <Trash2 size={theme.iconSize.sm} color={theme.colors.destructive} />,
|
||||
[theme.iconSize.sm, theme.colors.destructive],
|
||||
);
|
||||
|
||||
return (
|
||||
<SettingsSection
|
||||
title={t("settings.host.daemon.dangerZone")}
|
||||
testID="host-page-remove-host-card"
|
||||
>
|
||||
<RestartDaemonCard host={host} />
|
||||
|
||||
<View style={settingsStyles.card}>
|
||||
<View style={settingsStyles.row}>
|
||||
<View style={settingsStyles.rowContent}>
|
||||
<Text style={settingsStyles.rowTitle}>
|
||||
{isLocalDaemon
|
||||
? t("settings.host.daemon.remove.localTitle")
|
||||
: t("settings.host.daemon.remove.title")}
|
||||
</Text>
|
||||
<Text style={settingsStyles.rowHint}>
|
||||
{stopsOwnedDaemon
|
||||
? t("settings.host.daemon.remove.localHint")
|
||||
: t("settings.host.daemon.remove.hint")}
|
||||
</Text>
|
||||
</View>
|
||||
<Button
|
||||
variant="outline"
|
||||
leftIcon={removeIcon}
|
||||
textStyle={destructiveTextStyle}
|
||||
onPress={handleOpenConfirm}
|
||||
testID="host-page-remove-host-button"
|
||||
>
|
||||
{t("settings.host.connections.removeAction")}
|
||||
</Button>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{isConfirming ? (
|
||||
<AdaptiveModalSheet
|
||||
header={removeHostHeader}
|
||||
visible
|
||||
onClose={handleCloseConfirm}
|
||||
testID="remove-host-confirm-modal"
|
||||
>
|
||||
<Text style={styles.confirmText}>
|
||||
{stopsOwnedDaemon
|
||||
? t("settings.host.daemon.remove.localConfirmMessage")
|
||||
: t("settings.host.daemon.remove.confirmMessage", { name: host.label })}
|
||||
</Text>
|
||||
<View style={styles.confirmActions}>
|
||||
<Button
|
||||
variant="secondary"
|
||||
style={FLEX_1_STYLE}
|
||||
onPress={handleCancel}
|
||||
disabled={isRemoving}
|
||||
>
|
||||
{t("common.actions.cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="destructive"
|
||||
style={FLEX_1_STYLE}
|
||||
onPress={handleConfirmRemove}
|
||||
disabled={isRemoving}
|
||||
testID="remove-host-confirm"
|
||||
>
|
||||
{t("settings.host.connections.removeAction")}
|
||||
</Button>
|
||||
</View>
|
||||
</AdaptiveModalSheet>
|
||||
) : null}
|
||||
</SettingsSection>
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Terminal Profiles
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -1727,20 +1368,6 @@ const styles = StyleSheet.create((theme) => ({
|
||||
connectionError: {
|
||||
marginBottom: theme.spacing[6],
|
||||
},
|
||||
connectionLatency: {
|
||||
fontSize: theme.fontSize.base,
|
||||
marginRight: theme.spacing[2],
|
||||
},
|
||||
confirmText: {
|
||||
color: theme.colors.foregroundMuted,
|
||||
fontSize: theme.fontSize.base,
|
||||
},
|
||||
confirmActions: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[2],
|
||||
marginTop: theme.spacing[4],
|
||||
},
|
||||
appendPromptActions: {
|
||||
flexDirection: "row",
|
||||
justifyContent: "flex-end",
|
||||
@@ -1755,5 +1382,3 @@ const styles = StyleSheet.create((theme) => ({
|
||||
fontSize: theme.fontSize.base,
|
||||
},
|
||||
}));
|
||||
|
||||
const FLEX_1_STYLE = { flex: 1 };
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
import { useCallback } from "react";
|
||||
import { Text, View } from "react-native";
|
||||
import { useCallback, useMemo } from "react";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
import { SettingsInfoTip } from "@/components/settings/headings/settings-info-tip";
|
||||
import { SettingsInfoTip, SettingsRow } from "@/components/settings";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { useDaemonConfig } from "@/hooks/use-daemon-config";
|
||||
import { useHostFeature } from "@/runtime/host-features";
|
||||
import { useHostRuntimeIsConnected } from "@/runtime/host-runtime";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
|
||||
// Host-wide, persisted, and applied live by the daemon.
|
||||
export function IdleRuntimeCleanupCard({ serverId }: { serverId: string }) {
|
||||
export function IdleRuntimeCleanupRow({ serverId }: { serverId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const isConnected = useHostRuntimeIsConnected(serverId);
|
||||
const isSupported = useHostFeature(serverId, "idleRuntimeCleanupSetting");
|
||||
@@ -33,46 +30,34 @@ export function IdleRuntimeCleanupCard({ serverId }: { serverId: string }) {
|
||||
[mutation],
|
||||
);
|
||||
|
||||
const infoTip = useMemo(
|
||||
() => (
|
||||
<SettingsInfoTip
|
||||
title={t("settings.host.agents.idleRuntimeCleanup.title")}
|
||||
info={t("settings.host.agents.idleRuntimeCleanup.info")}
|
||||
/>
|
||||
),
|
||||
[t],
|
||||
);
|
||||
|
||||
if (!isConnected || !isSupported || !config) return null;
|
||||
|
||||
return (
|
||||
<View style={settingsStyles.card} testID="host-page-idle-runtime-cleanup-card">
|
||||
<View style={settingsStyles.row}>
|
||||
<View style={settingsStyles.rowContent}>
|
||||
<View style={styles.titleRow}>
|
||||
<Text style={settingsStyles.rowTitle}>
|
||||
{t("settings.host.agents.idleRuntimeCleanup.title")}
|
||||
</Text>
|
||||
<SettingsInfoTip
|
||||
title={t("settings.host.agents.idleRuntimeCleanup.title")}
|
||||
info={t("settings.host.agents.idleRuntimeCleanup.info")}
|
||||
/>
|
||||
</View>
|
||||
<Text style={settingsStyles.rowHint}>
|
||||
{t("settings.host.agents.idleRuntimeCleanup.hint")}
|
||||
</Text>
|
||||
{mutation.error ? (
|
||||
<Text style={settingsStyles.rowError} testID="host-page-idle-runtime-cleanup-error">
|
||||
{mutation.error.message}
|
||||
</Text>
|
||||
) : null}
|
||||
</View>
|
||||
<Switch
|
||||
value={config.idleRuntimeCleanup !== false}
|
||||
onValueChange={handleValueChange}
|
||||
disabled={mutation.isPending}
|
||||
accessibilityLabel={t("settings.host.agents.idleRuntimeCleanup.title")}
|
||||
testID="host-page-idle-runtime-cleanup-switch"
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
<SettingsRow
|
||||
label={t("settings.host.agents.idleRuntimeCleanup.title")}
|
||||
labelAccessory={infoTip}
|
||||
hint={t("settings.host.agents.idleRuntimeCleanup.hint")}
|
||||
error={mutation.error?.message}
|
||||
errorTestID="host-page-idle-runtime-cleanup-error"
|
||||
testID="host-page-idle-runtime-cleanup-card"
|
||||
>
|
||||
<Switch
|
||||
value={config.idleRuntimeCleanup !== false}
|
||||
onValueChange={handleValueChange}
|
||||
disabled={mutation.isPending}
|
||||
accessibilityLabel={t("settings.host.agents.idleRuntimeCleanup.title")}
|
||||
testID="host-page-idle-runtime-cleanup-switch"
|
||||
/>
|
||||
</SettingsRow>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
titleRow: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[2],
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { useCallback } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { SettingsCard, SettingsRow } from "@/components/settings";
|
||||
import { SettingsRow } from "@/components/settings";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { useDaemonConfig } from "@/hooks/use-daemon-config";
|
||||
import { useHostRuntimeIsConnected } from "@/runtime/host-runtime";
|
||||
|
||||
/** The host's "give agents Paseo tools" switch, bound to the host's config. */
|
||||
export function PaseoToolsCard({ serverId }: { serverId: string }) {
|
||||
/** The host's "give agents Paseo tools" row, bound to the host's config, for composing inside a SettingsCard. */
|
||||
export function HostPaseoToolsRow({ serverId }: { serverId: string }) {
|
||||
const isConnected = useHostRuntimeIsConnected(serverId);
|
||||
const { config, patchConfig } = useDaemonConfig(serverId);
|
||||
|
||||
@@ -20,12 +20,10 @@ export function PaseoToolsCard({ serverId }: { serverId: string }) {
|
||||
if (!isConnected) return null;
|
||||
|
||||
return (
|
||||
<SettingsCard testID="host-page-inject-mcp-card">
|
||||
<PaseoToolsRow
|
||||
value={config?.mcp.injectIntoAgents !== false}
|
||||
onValueChange={handleValueChange}
|
||||
/>
|
||||
</SettingsCard>
|
||||
<PaseoToolsRow
|
||||
value={config?.mcp.injectIntoAgents !== false}
|
||||
onValueChange={handleValueChange}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useTranslation } from "react-i18next";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
import { AdaptiveModalSheet, type SheetHeader } from "@/components/adaptive-modal-sheet";
|
||||
import { SettingsTextAreaCard } from "@/components/settings-textarea";
|
||||
import { SettingsInfoTip } from "@/components/settings/headings/settings-info-tip";
|
||||
import { SettingsInfoTip, SettingsRow } from "@/components/settings";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { useDaemonConfig } from "@/hooks/use-daemon-config";
|
||||
@@ -16,7 +16,7 @@ import { settingsStyles } from "@/styles/settings";
|
||||
const DEFAULT_RESUME_PROMPT = "Resume working.";
|
||||
|
||||
// COMPAT(restartRecovery): added in v0.14.0, remove gate after 2027-04-28.
|
||||
export function RestartRecoveryCard({ serverId }: { serverId: string }) {
|
||||
export function RestartRecoveryRow({ serverId }: { serverId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const isConnected = useHostRuntimeIsConnected(serverId);
|
||||
const isSupported = useHostFeature(serverId, "resumeOnStartupSetting");
|
||||
@@ -57,53 +57,48 @@ export function RestartRecoveryCard({ serverId }: { serverId: string }) {
|
||||
[mutation],
|
||||
);
|
||||
|
||||
const infoTip = useMemo(
|
||||
() => (
|
||||
<SettingsInfoTip
|
||||
title={t("settings.host.agents.resumeOnStartup.title")}
|
||||
info={t("settings.host.agents.resumeOnStartup.info")}
|
||||
/>
|
||||
),
|
||||
[t],
|
||||
);
|
||||
|
||||
if (!isConnected || !isSupported || !config) return null;
|
||||
|
||||
const isEnabled = config.resumeOnStartup === true;
|
||||
|
||||
return (
|
||||
<>
|
||||
<View style={settingsStyles.card} testID="host-page-restart-recovery-card">
|
||||
<View style={settingsStyles.row}>
|
||||
<View style={settingsStyles.rowContent}>
|
||||
<View style={styles.titleRow}>
|
||||
<Text style={settingsStyles.rowTitle}>
|
||||
{t("settings.host.agents.resumeOnStartup.title")}
|
||||
</Text>
|
||||
<SettingsInfoTip
|
||||
title={t("settings.host.agents.resumeOnStartup.title")}
|
||||
info={t("settings.host.agents.resumeOnStartup.info")}
|
||||
/>
|
||||
</View>
|
||||
<Text style={settingsStyles.rowHint}>
|
||||
{t("settings.host.agents.resumeOnStartup.hint")}
|
||||
</Text>
|
||||
{mutation.error && !isEditing ? (
|
||||
<Text style={settingsStyles.rowError} testID="host-page-restart-recovery-error">
|
||||
{mutation.error.message}
|
||||
</Text>
|
||||
) : null}
|
||||
</View>
|
||||
<View style={styles.trailing}>
|
||||
<Button
|
||||
variant="outline"
|
||||
onPress={handleOpen}
|
||||
disabled={!isEnabled || mutation.isPending}
|
||||
accessibilityLabel={t("settings.host.agents.resumeOnStartup.editAccessibilityLabel")}
|
||||
testID="host-page-restart-recovery-edit"
|
||||
>
|
||||
{t("settings.host.agents.resumeOnStartup.edit")}
|
||||
</Button>
|
||||
<Switch
|
||||
value={isEnabled}
|
||||
onValueChange={handleValueChange}
|
||||
disabled={mutation.isPending}
|
||||
accessibilityLabel={t("settings.host.agents.resumeOnStartup.title")}
|
||||
testID="host-page-restart-recovery-switch"
|
||||
/>
|
||||
</View>
|
||||
<SettingsRow
|
||||
label={t("settings.host.agents.resumeOnStartup.title")}
|
||||
labelAccessory={infoTip}
|
||||
hint={t("settings.host.agents.resumeOnStartup.hint")}
|
||||
error={mutation.error && !isEditing ? mutation.error.message : undefined}
|
||||
testID="host-page-restart-recovery-card"
|
||||
>
|
||||
<View style={styles.trailing}>
|
||||
<Button
|
||||
variant="outline"
|
||||
onPress={handleOpen}
|
||||
disabled={!isEnabled || mutation.isPending}
|
||||
accessibilityLabel={t("settings.host.agents.resumeOnStartup.editAccessibilityLabel")}
|
||||
testID="host-page-restart-recovery-edit"
|
||||
>
|
||||
{t("settings.host.agents.resumeOnStartup.edit")}
|
||||
</Button>
|
||||
<Switch
|
||||
value={isEnabled}
|
||||
onValueChange={handleValueChange}
|
||||
disabled={mutation.isPending}
|
||||
accessibilityLabel={t("settings.host.agents.resumeOnStartup.title")}
|
||||
testID="host-page-restart-recovery-switch"
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
</SettingsRow>
|
||||
|
||||
{isEditing ? (
|
||||
<ResumePromptSheet
|
||||
@@ -179,11 +174,6 @@ function ResumePromptSheet({
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
titleRow: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[2],
|
||||
},
|
||||
trailing: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
|
||||
@@ -14,8 +14,10 @@ import {
|
||||
decodeWorkspaceIdFromPathSegment,
|
||||
encodeFilePathForPathSegment,
|
||||
encodeWorkspaceIdForPathSegment,
|
||||
buildClientHostSettingsRoute,
|
||||
isSettingsSectionSlug,
|
||||
normalizeHostSectionSlug,
|
||||
normalizeSettingsSectionSlug,
|
||||
normalizeProjectSettingsRouteId,
|
||||
buildProviderSettingsRoute,
|
||||
parseHostAgentRouteFromPathname,
|
||||
@@ -245,27 +247,46 @@ describe("global routes", () => {
|
||||
|
||||
describe("host settings section slugs", () => {
|
||||
it("keeps current host settings sections", () => {
|
||||
expect(normalizeHostSectionSlug("connections")).toBe("connections");
|
||||
expect(normalizeHostSectionSlug("devices")).toBe("devices");
|
||||
expect(normalizeHostSectionSlug("pair-device")).toBe("devices");
|
||||
expect(normalizeHostSectionSlug("agents")).toBe("agents");
|
||||
expect(normalizeHostSectionSlug("metadata")).toBe("metadata");
|
||||
expect(normalizeHostSectionSlug("workspaces")).toBe("workspaces");
|
||||
expect(normalizeHostSectionSlug("projects")).toBe("projects");
|
||||
expect(normalizeHostSectionSlug("providers")).toBe("providers");
|
||||
expect(normalizeHostSectionSlug("agent-profiles")).toBe("agent-profiles");
|
||||
expect(normalizeHostSectionSlug("tools")).toBe("tools");
|
||||
expect(normalizeHostSectionSlug("projects")).toBe("projects");
|
||||
expect(normalizeHostSectionSlug("workspaces")).toBe("workspaces");
|
||||
expect(normalizeHostSectionSlug("voice")).toBe("voice");
|
||||
expect(normalizeHostSectionSlug("usage")).toBe("usage");
|
||||
expect(normalizeHostSectionSlug("host")).toBe("host");
|
||||
expect(normalizeHostSectionSlug("terminals")).toBe("terminals");
|
||||
expect(normalizeHostSectionSlug("plugins")).toBe("plugins");
|
||||
expect(normalizeHostSectionSlug("devices")).toBe("devices");
|
||||
expect(normalizeHostSectionSlug("daemon")).toBe("daemon");
|
||||
});
|
||||
|
||||
it("maps old host settings sections to their new names", () => {
|
||||
expect(normalizeHostSectionSlug("orchestration")).toBe("agents");
|
||||
expect(normalizeHostSectionSlug("daemon")).toBe("host");
|
||||
expect(normalizeHostSectionSlug("pair-device")).toBe("devices");
|
||||
expect(normalizeHostSectionSlug("agents")).toBe("tools");
|
||||
expect(normalizeHostSectionSlug("orchestration")).toBe("tools");
|
||||
expect(normalizeHostSectionSlug("metadata")).toBe("workspaces");
|
||||
expect(normalizeHostSectionSlug("host")).toBe("daemon");
|
||||
});
|
||||
});
|
||||
|
||||
describe("settings section slugs", () => {
|
||||
it("includes desktop notification settings", () => {
|
||||
it("includes consolidated app settings sections", () => {
|
||||
expect(isSettingsSectionSlug("general")).toBe(true);
|
||||
expect(isSettingsSectionSlug("hosts")).toBe(true);
|
||||
expect(isSettingsSectionSlug("chat")).toBe(true);
|
||||
expect(isSettingsSectionSlug("notifications")).toBe(true);
|
||||
expect(isSettingsSectionSlug("about")).toBe(true);
|
||||
expect(buildClientHostSettingsRoute("host a")).toBe("/settings/device-hosts/host%20a");
|
||||
});
|
||||
|
||||
it("maps legacy app settings sections to their consolidated sections", () => {
|
||||
expect(normalizeSettingsSectionSlug("terminal")).toBe("chat");
|
||||
expect(normalizeSettingsSectionSlug("browser")).toBe("chat");
|
||||
expect(normalizeSettingsSectionSlug("editor")).toBe("chat");
|
||||
expect(normalizeSettingsSectionSlug("files")).toBe("chat");
|
||||
expect(normalizeSettingsSectionSlug("integrations")).toBe("general");
|
||||
expect(normalizeSettingsSectionSlug("permissions")).toBe("notifications");
|
||||
expect(normalizeSettingsSectionSlug("diagnostics")).toBe("about");
|
||||
});
|
||||
|
||||
it("no longer treats daemon as a valid app-level settings section", () => {
|
||||
|
||||
@@ -491,49 +491,60 @@ export function resolveKnownHostRoute(input: {
|
||||
|
||||
export const SETTINGS_SECTION_SLUGS = [
|
||||
"general",
|
||||
"hosts",
|
||||
"appearance",
|
||||
"sidebar",
|
||||
"chat",
|
||||
"terminal",
|
||||
"browser",
|
||||
"editor",
|
||||
"files",
|
||||
"shortcuts",
|
||||
"integrations",
|
||||
"notifications",
|
||||
"permissions",
|
||||
"diagnostics",
|
||||
"about",
|
||||
] as const;
|
||||
|
||||
export type SettingsSectionSlug = (typeof SETTINGS_SECTION_SLUGS)[number];
|
||||
|
||||
const LEGACY_SETTINGS_SECTION_SLUGS: Record<string, SettingsSectionSlug> = {
|
||||
terminal: "chat",
|
||||
browser: "chat",
|
||||
editor: "chat",
|
||||
files: "chat",
|
||||
integrations: "general",
|
||||
permissions: "notifications",
|
||||
diagnostics: "about",
|
||||
};
|
||||
|
||||
export function isSettingsSectionSlug(value: string): value is SettingsSectionSlug {
|
||||
return (SETTINGS_SECTION_SLUGS as readonly string[]).includes(value);
|
||||
}
|
||||
|
||||
export function normalizeSettingsSectionSlug(value: string): SettingsSectionSlug | null {
|
||||
if (isSettingsSectionSlug(value)) {
|
||||
return value;
|
||||
}
|
||||
return LEGACY_SETTINGS_SECTION_SLUGS[value] ?? null;
|
||||
}
|
||||
|
||||
export const HOST_SECTION_SLUGS = [
|
||||
"projects",
|
||||
"connections",
|
||||
"devices",
|
||||
"agents",
|
||||
"agent-profiles",
|
||||
"metadata",
|
||||
"voice",
|
||||
"workspaces",
|
||||
"providers",
|
||||
"agent-profiles",
|
||||
"tools",
|
||||
"projects",
|
||||
"workspaces",
|
||||
"voice",
|
||||
"usage",
|
||||
"terminals",
|
||||
"plugins",
|
||||
"host",
|
||||
"devices",
|
||||
"daemon",
|
||||
] as const;
|
||||
|
||||
export type HostSectionSlug = (typeof HOST_SECTION_SLUGS)[number];
|
||||
|
||||
const LEGACY_HOST_SECTION_SLUGS: Record<string, HostSectionSlug> = {
|
||||
"pair-device": "devices",
|
||||
orchestration: "agents",
|
||||
daemon: "host",
|
||||
agents: "tools",
|
||||
orchestration: "tools",
|
||||
metadata: "workspaces",
|
||||
host: "daemon",
|
||||
};
|
||||
|
||||
export function isHostSectionSlug(value: string): value is HostSectionSlug {
|
||||
@@ -555,6 +566,14 @@ export function buildSettingsSectionRoute(section: SettingsSectionSlug) {
|
||||
return `/settings/${section}` as const;
|
||||
}
|
||||
|
||||
export function buildClientHostSettingsRoute(serverId: string) {
|
||||
const normalized = trimNonEmpty(serverId);
|
||||
if (!normalized) {
|
||||
throw new Error("buildClientHostSettingsRoute requires a non-empty serverId");
|
||||
}
|
||||
return `/settings/device-hosts/${encodeSegment(normalized)}` as const;
|
||||
}
|
||||
|
||||
export function buildSettingsHostRoute(serverId: string) {
|
||||
const normalized = trimNonEmpty(serverId);
|
||||
if (!normalized) {
|
||||
|
||||
@@ -11,6 +11,8 @@ const assert = require("node:assert/strict");
|
||||
|
||||
const EXECUTABLE_NAME = "Paseo";
|
||||
const SMOKE_TIMEOUT_MS = 60_000;
|
||||
const DAEMON_STATUS_CALL_TIMEOUT_MS = 10_000;
|
||||
const ARTIFACT_PAGE_TIMEOUT_MS = 5_000;
|
||||
const EXIT_TIMEOUT_MS = 10_000;
|
||||
const TERMINAL_CAPTURE_ATTEMPTS = 20;
|
||||
const TERMINAL_CAPTURE_INTERVAL_MS = 500;
|
||||
@@ -291,14 +293,122 @@ function readIfExists(filePath) {
|
||||
return fs.existsSync(filePath) ? fs.readFileSync(filePath, "utf8") : null;
|
||||
}
|
||||
|
||||
function formatLogs({ stdout, stderr, userData, daemonHome }) {
|
||||
function captureProcessList() {
|
||||
if (process.platform === "win32") {
|
||||
return null;
|
||||
}
|
||||
|
||||
const result = spawnSync("ps", ["-axo", "pid,ppid,%cpu,%mem,rss,state,comm,args"], {
|
||||
encoding: "utf8",
|
||||
timeout: 10_000,
|
||||
});
|
||||
if (result.error) {
|
||||
return `<ps error: ${result.error.message}>`;
|
||||
}
|
||||
if (result.status !== 0) {
|
||||
return `<ps exited ${result.status}: ${result.stderr.trim() || "<empty>"}>`;
|
||||
}
|
||||
return result.stdout.trim();
|
||||
}
|
||||
|
||||
function captureVmStat() {
|
||||
if (process.platform !== "darwin") {
|
||||
return null;
|
||||
}
|
||||
|
||||
const result = spawnSync("vm_stat", [], {
|
||||
encoding: "utf8",
|
||||
timeout: 10_000,
|
||||
});
|
||||
if (result.error) {
|
||||
return `<vm_stat error: ${result.error.message}>`;
|
||||
}
|
||||
if (result.status !== 0) {
|
||||
return `<vm_stat exited ${result.status}: ${result.stderr.trim() || "<empty>"}>`;
|
||||
}
|
||||
return result.stdout.trim();
|
||||
}
|
||||
|
||||
function extractPaseoElectronPids(processList) {
|
||||
if (!processList) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const pids = [];
|
||||
for (const line of processList.split(/\r?\n/).slice(1)) {
|
||||
if (!line.includes("Paseo.app/Contents/")) {
|
||||
continue;
|
||||
}
|
||||
const match = line.trim().match(/^(\d+)\s+/);
|
||||
if (match) {
|
||||
pids.push(Number(match[1]));
|
||||
}
|
||||
}
|
||||
return pids.slice(0, 6);
|
||||
}
|
||||
|
||||
function captureDarwinSamples(artifactDir, processList) {
|
||||
if (process.platform !== "darwin") {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const pid of extractPaseoElectronPids(processList)) {
|
||||
const result = spawnSync("sample", [String(pid), "1"], {
|
||||
encoding: "utf8",
|
||||
timeout: 10_000,
|
||||
});
|
||||
const output = result.error
|
||||
? `<sample error for pid ${pid}: ${result.error.message}>`
|
||||
: [result.stdout, result.stderr].filter(Boolean).join("\n");
|
||||
fs.writeFileSync(path.join(artifactDir, `sample-${pid}.txt`), `${output}\n`);
|
||||
}
|
||||
}
|
||||
|
||||
function filterRelevantProcesses(processList) {
|
||||
if (!processList) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const lines = processList.split(/\r?\n/);
|
||||
const header = lines[0] ?? "";
|
||||
const matching = lines.slice(1).filter((line) => /paseo|node/i.test(line));
|
||||
return [header, ...matching].filter(Boolean).join("\n") || "<none>";
|
||||
}
|
||||
|
||||
function raceWithTimeout(promise, timeoutMs, label) {
|
||||
// Prevent unhandled rejections if the inner promise rejects after the timeout wins.
|
||||
promise.catch(() => undefined);
|
||||
let timer = null;
|
||||
const timeoutPromise = new Promise((_, reject) => {
|
||||
timer = setTimeout(() => {
|
||||
reject(new Error(`${label} timed out after ${timeoutMs}ms`));
|
||||
}, timeoutMs);
|
||||
});
|
||||
return Promise.race([promise, timeoutPromise]).finally(() => {
|
||||
if (timer !== null) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function formatLogs({
|
||||
stdout,
|
||||
stderr,
|
||||
userData,
|
||||
daemonHome,
|
||||
processList = captureProcessList(),
|
||||
vmStat = captureVmStat(),
|
||||
}) {
|
||||
const desktopLog = readIfExists(path.join(userData, "logs", "main.log"));
|
||||
const daemonLog = readIfExists(path.join(daemonHome, "daemon.log"));
|
||||
const relevantProcesses = filterRelevantProcesses(processList);
|
||||
return [
|
||||
`App stdout:\n${stdout.join("").trim() || "<empty>"}`,
|
||||
`App stderr:\n${stderr.join("").trim() || "<empty>"}`,
|
||||
`Desktop log:\n${desktopLog?.trim() || "<missing>"}`,
|
||||
`Daemon log:\n${daemonLog?.trim() || "<missing>"}`,
|
||||
`Live processes (paseo|node):\n${relevantProcesses || "<unavailable>"}`,
|
||||
...(vmStat !== null ? [`vm_stat:\n${vmStat}`] : []),
|
||||
].join("\n\n");
|
||||
}
|
||||
|
||||
@@ -308,6 +418,8 @@ async function writeSmokeArtifacts({ page, stdout, stderr, userData, daemonHome,
|
||||
return;
|
||||
}
|
||||
|
||||
const processList = captureProcessList();
|
||||
const vmStat = captureVmStat();
|
||||
fs.mkdirSync(artifactDir, { recursive: true });
|
||||
fs.writeFileSync(
|
||||
path.join(artifactDir, error ? "failure.txt" : "success.txt"),
|
||||
@@ -317,10 +429,21 @@ async function writeSmokeArtifacts({ page, stdout, stderr, userData, daemonHome,
|
||||
stderr,
|
||||
userData,
|
||||
daemonHome,
|
||||
processList,
|
||||
vmStat,
|
||||
},
|
||||
)}\n`,
|
||||
);
|
||||
|
||||
if (processList !== null) {
|
||||
fs.writeFileSync(path.join(artifactDir, "ps.txt"), `${processList}\n`);
|
||||
}
|
||||
if (vmStat !== null) {
|
||||
fs.writeFileSync(path.join(artifactDir, "vm_stat.txt"), `${vmStat}\n`);
|
||||
}
|
||||
if (error) {
|
||||
captureDarwinSamples(artifactDir, processList);
|
||||
}
|
||||
const desktopLog = readIfExists(path.join(userData, "logs", "main.log"));
|
||||
if (desktopLog !== null) {
|
||||
fs.writeFileSync(path.join(artifactDir, "desktop-main.log"), desktopLog);
|
||||
@@ -331,8 +454,8 @@ async function writeSmokeArtifacts({ page, stdout, stderr, userData, daemonHome,
|
||||
}
|
||||
|
||||
if (page) {
|
||||
const renderer = await page
|
||||
.evaluate(() => ({
|
||||
const renderer = await raceWithTimeout(
|
||||
page.evaluate(() => ({
|
||||
url: window.location.href,
|
||||
title: document.title,
|
||||
rootChildCount: document.querySelector("#root")?.childElementCount ?? 0,
|
||||
@@ -341,15 +464,19 @@ async function writeSmokeArtifacts({ page, stdout, stderr, userData, daemonHome,
|
||||
typeof window.paseoDesktop === "object" && window.paseoDesktop !== null
|
||||
? Object.keys(window.paseoDesktop)
|
||||
: [],
|
||||
}))
|
||||
.catch((evaluationError) => ({ evaluationError: String(evaluationError) }));
|
||||
})),
|
||||
ARTIFACT_PAGE_TIMEOUT_MS,
|
||||
"renderer artifact capture",
|
||||
).catch((evaluationError) => ({ evaluationError: String(evaluationError) }));
|
||||
fs.writeFileSync(
|
||||
path.join(artifactDir, "renderer.json"),
|
||||
`${JSON.stringify(renderer, null, 2)}\n`,
|
||||
);
|
||||
await page
|
||||
.screenshot({ path: path.join(artifactDir, "renderer.png"), fullPage: true })
|
||||
.catch(() => undefined);
|
||||
await raceWithTimeout(
|
||||
page.screenshot({ path: path.join(artifactDir, "renderer.png"), fullPage: true }),
|
||||
ARTIFACT_PAGE_TIMEOUT_MS,
|
||||
"renderer screenshot capture",
|
||||
).catch(() => undefined);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,10 +632,24 @@ async function waitForRendererStartedDaemon({
|
||||
}) {
|
||||
let lastStatus = null;
|
||||
let lastError = null;
|
||||
let loggedFirstOutcome = false;
|
||||
let attempt = 0;
|
||||
|
||||
while (Date.now() < deadline) {
|
||||
attempt += 1;
|
||||
const callTimeoutMs = Math.min(DAEMON_STATUS_CALL_TIMEOUT_MS, remainingTime(deadline));
|
||||
try {
|
||||
lastStatus = await page.evaluate(() => window.paseoDesktop.invoke("desktop_daemon_status"));
|
||||
lastStatus = await raceWithTimeout(
|
||||
page.evaluate(() => window.paseoDesktop.invoke("desktop_daemon_status")),
|
||||
callTimeoutMs,
|
||||
"desktop_daemon_status",
|
||||
);
|
||||
if (!loggedFirstOutcome) {
|
||||
loggedFirstOutcome = true;
|
||||
console.log(
|
||||
`Packaged desktop smoke: first desktop_daemon_status response (attempt ${attempt}): ${JSON.stringify(lastStatus)}`,
|
||||
);
|
||||
}
|
||||
if (
|
||||
lastStatus?.status === "running" &&
|
||||
lastStatus.desktopManaged === true &&
|
||||
@@ -522,8 +663,16 @@ async function waitForRendererStartedDaemon({
|
||||
}
|
||||
} catch (error) {
|
||||
lastError = error;
|
||||
if (!loggedFirstOutcome || String(error).includes("timed out")) {
|
||||
loggedFirstOutcome = true;
|
||||
console.warn(
|
||||
`Packaged desktop smoke: desktop_daemon_status attempt ${attempt} failed: ${error}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
if (Date.now() < deadline) {
|
||||
await delay(Math.min(250, remainingTime(deadline)));
|
||||
}
|
||||
await delay(250);
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
|
||||
@@ -8,29 +8,23 @@ const MAX_TRANSIENT_DETACHED_PANES = 2;
|
||||
|
||||
const SETTINGS_DESTINATIONS = [
|
||||
"General",
|
||||
"Hosts",
|
||||
"Appearance",
|
||||
"Sidebar",
|
||||
"Chat",
|
||||
"Terminal",
|
||||
"Browser",
|
||||
"Editor",
|
||||
"Chat & panes",
|
||||
"Shortcuts",
|
||||
"Integrations",
|
||||
"Notifications",
|
||||
"Permissions",
|
||||
"Diagnostics",
|
||||
"About",
|
||||
"Overview",
|
||||
"Projects",
|
||||
"Connections",
|
||||
"Devices",
|
||||
"Agents",
|
||||
"Metadata",
|
||||
"Workspaces",
|
||||
"Providers",
|
||||
"Tools & prompts",
|
||||
"Projects",
|
||||
"Workspaces",
|
||||
"Voice",
|
||||
"Usage",
|
||||
"Terminals",
|
||||
"Plugins",
|
||||
"Devices",
|
||||
"Daemon",
|
||||
];
|
||||
|
||||
function assert(condition, message) {
|
||||
|
||||
@@ -412,9 +412,7 @@ export async function waitForDirectoryDialog(
|
||||
export async function openDesktopSettings(page: Page, serverId: string): Promise<void> {
|
||||
await openSettings(page);
|
||||
await openSettingsHost(page, serverId);
|
||||
// The daemon-lifecycle card moved to the Host section in the flat-settings
|
||||
// layout; navigate there before asserting it.
|
||||
await openSettingsHostSection(page, serverId, "host");
|
||||
await openSettingsHostSection(page, serverId, "daemon");
|
||||
await expect(page.getByTestId("host-page-daemon-lifecycle-card")).toBeVisible({
|
||||
timeout: 15_000,
|
||||
});
|
||||
|
||||
@@ -39,7 +39,7 @@ test.describe("Desktop updates", () => {
|
||||
await page.reload();
|
||||
await openSettings(page);
|
||||
await openSettingsHost(page, desktopManagedOutdatedDaemon.serverId);
|
||||
await openHostSection(page, desktopManagedOutdatedDaemon.serverId, "host");
|
||||
await openHostSection(page, desktopManagedOutdatedDaemon.serverId, "daemon");
|
||||
|
||||
const updateCard = page.getByTestId("host-page-update-card");
|
||||
await expect(updateCard).toBeVisible();
|
||||
|
||||
@@ -88,4 +88,34 @@ describe("external CLI", () => {
|
||||
localDaemon: "running",
|
||||
});
|
||||
});
|
||||
|
||||
it("terminates and rejects when an external CLI subprocess hangs past the timeout", async () => {
|
||||
vi.useFakeTimers();
|
||||
try {
|
||||
const kill = vi.fn();
|
||||
const child = new EventEmitter() as EventEmitter & {
|
||||
stdout: EventEmitter;
|
||||
stderr: EventEmitter;
|
||||
kill: typeof kill;
|
||||
};
|
||||
child.stdout = new EventEmitter();
|
||||
child.stderr = new EventEmitter();
|
||||
child.kill = kill;
|
||||
mocks.spawnProcess.mockReturnValueOnce(child);
|
||||
|
||||
const pending = runExternalCliJsonCommand(["daemon", "status", "--json"]);
|
||||
const assertion = expect(pending).rejects.toThrow(
|
||||
"CLI command timed out after 15000ms: daemon status --json",
|
||||
);
|
||||
|
||||
await vi.advanceTimersByTimeAsync(15_000);
|
||||
await assertion;
|
||||
expect(kill).toHaveBeenCalledWith("SIGTERM");
|
||||
|
||||
await vi.advanceTimersByTimeAsync(2_000);
|
||||
expect(kill).toHaveBeenCalledWith("SIGKILL");
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -38,8 +38,13 @@ function createExternalCliInvocation(args: string[]): NodeEntrypointInvocation {
|
||||
});
|
||||
}
|
||||
|
||||
const DEFAULT_EXTERNAL_CLI_TIMEOUT_MS = 15_000;
|
||||
const EXTERNAL_CLI_KILL_GRACE_MS = 2_000;
|
||||
|
||||
function spawnExternalCli(
|
||||
invocation: NodeEntrypointInvocation,
|
||||
args: string[],
|
||||
timeoutMs = DEFAULT_EXTERNAL_CLI_TIMEOUT_MS,
|
||||
): Promise<{ stdout: string; stderr: string; exitCode: number | null }> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const child = spawnProcess(invocation.command, invocation.args, {
|
||||
@@ -50,6 +55,44 @@ function spawnExternalCli(
|
||||
|
||||
let stdout = "";
|
||||
let stderr = "";
|
||||
let settled = false;
|
||||
let killTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
const cleanupTimers = () => {
|
||||
clearTimeout(timeoutTimer);
|
||||
if (killTimer !== null) {
|
||||
clearTimeout(killTimer);
|
||||
killTimer = null;
|
||||
}
|
||||
};
|
||||
|
||||
const timeoutTimer = setTimeout(() => {
|
||||
if (settled) {
|
||||
return;
|
||||
}
|
||||
settled = true;
|
||||
log.warn("[desktop external-cli]", "CLI command timed out", {
|
||||
args,
|
||||
timeoutMs,
|
||||
command: invocation.command,
|
||||
stdout: stdout.trim().slice(0, 500),
|
||||
stderr: stderr.trim().slice(0, 500),
|
||||
});
|
||||
try {
|
||||
child.kill("SIGTERM");
|
||||
} catch {
|
||||
// Ignore kill failures if the process already exited.
|
||||
}
|
||||
killTimer = setTimeout(() => {
|
||||
try {
|
||||
child.kill("SIGKILL");
|
||||
} catch {
|
||||
// Ignore kill failures if the process already exited.
|
||||
}
|
||||
}, EXTERNAL_CLI_KILL_GRACE_MS);
|
||||
killTimer.unref?.();
|
||||
reject(new Error(`CLI command timed out after ${timeoutMs}ms: ${args.join(" ")}`));
|
||||
}, timeoutMs);
|
||||
|
||||
child.stdout!.on("data", (data: Buffer) => {
|
||||
stdout += data.toString();
|
||||
@@ -58,8 +101,21 @@ function spawnExternalCli(
|
||||
stderr += data.toString();
|
||||
});
|
||||
|
||||
child.on("error", reject);
|
||||
child.on("error", (error) => {
|
||||
if (settled) {
|
||||
return;
|
||||
}
|
||||
settled = true;
|
||||
cleanupTimers();
|
||||
reject(error);
|
||||
});
|
||||
child.on("close", (exitCode) => {
|
||||
if (settled) {
|
||||
cleanupTimers();
|
||||
return;
|
||||
}
|
||||
settled = true;
|
||||
cleanupTimers();
|
||||
resolve({ stdout, stderr, exitCode });
|
||||
});
|
||||
});
|
||||
@@ -79,7 +135,7 @@ function externalCliFailureMessage(
|
||||
|
||||
export async function runExternalCliTextCommand(args: string[]): Promise<string> {
|
||||
const invocation = createExternalCliInvocation(args);
|
||||
const result = await spawnExternalCli(invocation);
|
||||
const result = await spawnExternalCli(invocation, args);
|
||||
|
||||
if (result.exitCode !== 0) {
|
||||
const stderr = result.stderr.trim();
|
||||
@@ -98,7 +154,7 @@ export async function runExternalCliTextCommand(args: string[]): Promise<string>
|
||||
|
||||
export async function runExternalCliJsonCommand(args: string[]): Promise<unknown> {
|
||||
const invocation = createExternalCliInvocation(args);
|
||||
const result = await spawnExternalCli(invocation);
|
||||
const result = await spawnExternalCli(invocation, args);
|
||||
|
||||
if (result.exitCode !== 0) {
|
||||
const stderr = result.stderr.trim();
|
||||
|
||||
@@ -84,6 +84,7 @@ import {
|
||||
resolveStagingUserId,
|
||||
runElectronQuitAndInstall,
|
||||
shouldInstallAppUpdateOnQuit,
|
||||
shouldUseWindowProgressBar,
|
||||
} from "./auto-updater";
|
||||
|
||||
describe("checkForAppUpdate", () => {
|
||||
@@ -160,43 +161,109 @@ describe("checkForAppUpdate", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("forwards download-progress to window progress bars and renderer events", async () => {
|
||||
it("forwards download-progress to window progress bars on non-darwin platforms and avoids idle clears", async () => {
|
||||
const platformSpy = vi.spyOn(process, "platform", "get").mockReturnValue("linux");
|
||||
const setProgressBar = vi.fn();
|
||||
const send = vi.fn();
|
||||
getAllWindowsMock.mockReturnValue([
|
||||
{ isDestroyed: () => false, setProgressBar, webContents: { send } },
|
||||
]);
|
||||
autoUpdaterMock.checkForUpdates.mockResolvedValueOnce({
|
||||
isUpdateAvailable: true,
|
||||
updateInfo: { version: "1.2.6" },
|
||||
});
|
||||
try {
|
||||
getAllWindowsMock.mockReturnValue([
|
||||
{ isDestroyed: () => false, setProgressBar, webContents: { send } },
|
||||
]);
|
||||
autoUpdaterMock.checkForUpdates.mockResolvedValueOnce({
|
||||
isUpdateAvailable: true,
|
||||
updateInfo: { version: "1.2.6" },
|
||||
});
|
||||
|
||||
await checkForAppUpdate({
|
||||
currentVersion: "1.2.3",
|
||||
releaseChannel: "stable",
|
||||
intent: "automatic",
|
||||
autoDownload: true,
|
||||
});
|
||||
autoUpdaterMock.handlers.get("download-progress")?.({
|
||||
percent: 42,
|
||||
transferred: 420,
|
||||
total: 1000,
|
||||
bytesPerSecond: 100,
|
||||
});
|
||||
await checkForAppUpdate({
|
||||
currentVersion: "1.2.3",
|
||||
releaseChannel: "stable",
|
||||
intent: "automatic",
|
||||
autoDownload: true,
|
||||
});
|
||||
expect(setProgressBar).not.toHaveBeenCalled();
|
||||
|
||||
expect(setProgressBar).toHaveBeenCalledWith(0.42);
|
||||
expect(send).toHaveBeenCalledWith("paseo:event:app-update-download-progress", {
|
||||
version: "1.2.6",
|
||||
percent: 42,
|
||||
transferred: 420,
|
||||
total: 1000,
|
||||
bytesPerSecond: 100,
|
||||
});
|
||||
autoUpdaterMock.handlers.get("download-progress")?.({
|
||||
percent: 42,
|
||||
transferred: 420,
|
||||
total: 1000,
|
||||
bytesPerSecond: 100,
|
||||
});
|
||||
|
||||
autoUpdaterMock.handlers.get("update-downloaded")?.({ version: "1.2.6" });
|
||||
expect(setProgressBar).toHaveBeenLastCalledWith(-1);
|
||||
expect(send).toHaveBeenLastCalledWith("paseo:event:app-update-download-progress", null);
|
||||
getAllWindowsMock.mockReturnValue([]);
|
||||
expect(setProgressBar).toHaveBeenCalledWith(0.42);
|
||||
expect(send).toHaveBeenCalledWith("paseo:event:app-update-download-progress", {
|
||||
version: "1.2.6",
|
||||
percent: 42,
|
||||
transferred: 420,
|
||||
total: 1000,
|
||||
bytesPerSecond: 100,
|
||||
});
|
||||
|
||||
autoUpdaterMock.handlers.get("update-downloaded")?.({ version: "1.2.6" });
|
||||
expect(setProgressBar).toHaveBeenLastCalledWith(-1);
|
||||
expect(setProgressBar).toHaveBeenCalledTimes(2);
|
||||
expect(send).toHaveBeenLastCalledWith("paseo:event:app-update-download-progress", null);
|
||||
|
||||
// A subsequent idle clear (e.g., switching channels) must not call setProgressBar(-1) again.
|
||||
autoUpdaterMock.checkForUpdates.mockResolvedValueOnce({
|
||||
isUpdateAvailable: false,
|
||||
updateInfo: { version: "1.2.3" },
|
||||
});
|
||||
await checkForAppUpdate({
|
||||
currentVersion: "1.2.3",
|
||||
releaseChannel: "beta",
|
||||
intent: "manual",
|
||||
});
|
||||
expect(setProgressBar).toHaveBeenCalledTimes(2);
|
||||
} finally {
|
||||
getAllWindowsMock.mockReturnValue([]);
|
||||
platformSpy.mockRestore();
|
||||
}
|
||||
});
|
||||
|
||||
it("skips window progress bars on darwin while still forwarding renderer events", async () => {
|
||||
expect(shouldUseWindowProgressBar("darwin")).toBe(false);
|
||||
expect(shouldUseWindowProgressBar("win32")).toBe(true);
|
||||
expect(shouldUseWindowProgressBar("linux")).toBe(true);
|
||||
|
||||
const platformSpy = vi.spyOn(process, "platform", "get").mockReturnValue("darwin");
|
||||
const setProgressBar = vi.fn();
|
||||
const send = vi.fn();
|
||||
try {
|
||||
getAllWindowsMock.mockReturnValue([
|
||||
{ isDestroyed: () => false, setProgressBar, webContents: { send } },
|
||||
]);
|
||||
autoUpdaterMock.checkForUpdates.mockResolvedValueOnce({
|
||||
isUpdateAvailable: true,
|
||||
updateInfo: { version: "1.2.11" },
|
||||
});
|
||||
|
||||
await checkForAppUpdate({
|
||||
currentVersion: "1.2.3",
|
||||
releaseChannel: "stable",
|
||||
intent: "automatic",
|
||||
autoDownload: true,
|
||||
});
|
||||
autoUpdaterMock.handlers.get("download-progress")?.({
|
||||
percent: 55,
|
||||
transferred: 550,
|
||||
total: 1000,
|
||||
bytesPerSecond: 100,
|
||||
});
|
||||
autoUpdaterMock.handlers.get("update-downloaded")?.({ version: "1.2.11" });
|
||||
|
||||
expect(setProgressBar).not.toHaveBeenCalled();
|
||||
expect(send).toHaveBeenCalledWith("paseo:event:app-update-download-progress", {
|
||||
version: "1.2.11",
|
||||
percent: 55,
|
||||
transferred: 550,
|
||||
total: 1000,
|
||||
bytesPerSecond: 100,
|
||||
});
|
||||
expect(send).toHaveBeenLastCalledWith("paseo:event:app-update-download-progress", null);
|
||||
} finally {
|
||||
getAllWindowsMock.mockReturnValue([]);
|
||||
platformSpy.mockRestore();
|
||||
}
|
||||
});
|
||||
|
||||
it("gates automatic checks and autoDownload from desktop settings and falls back to automatic on read failure", async () => {
|
||||
@@ -253,40 +320,45 @@ describe("checkForAppUpdate", () => {
|
||||
});
|
||||
|
||||
it("does not fail update events when setProgressBar throws", async () => {
|
||||
const platformSpy = vi.spyOn(process, "platform", "get").mockReturnValue("linux");
|
||||
const send = vi.fn();
|
||||
getAllWindowsMock.mockReturnValue([
|
||||
{
|
||||
isDestroyed: () => false,
|
||||
setProgressBar: () => {
|
||||
throw new Error("unsupported desktop environment");
|
||||
try {
|
||||
getAllWindowsMock.mockReturnValue([
|
||||
{
|
||||
isDestroyed: () => false,
|
||||
setProgressBar: () => {
|
||||
throw new Error("unsupported desktop environment");
|
||||
},
|
||||
webContents: { send },
|
||||
},
|
||||
webContents: { send },
|
||||
},
|
||||
]);
|
||||
autoUpdaterMock.checkForUpdates.mockResolvedValueOnce({
|
||||
isUpdateAvailable: true,
|
||||
updateInfo: { version: "1.2.7" },
|
||||
});
|
||||
|
||||
await checkForAppUpdate({
|
||||
currentVersion: "1.2.3",
|
||||
releaseChannel: "stable",
|
||||
intent: "automatic",
|
||||
autoDownload: true,
|
||||
});
|
||||
expect(() => {
|
||||
autoUpdaterMock.handlers.get("download-progress")?.({
|
||||
percent: 50,
|
||||
transferred: 50,
|
||||
total: 100,
|
||||
bytesPerSecond: 10,
|
||||
]);
|
||||
autoUpdaterMock.checkForUpdates.mockResolvedValueOnce({
|
||||
isUpdateAvailable: true,
|
||||
updateInfo: { version: "1.2.7" },
|
||||
});
|
||||
}).not.toThrow();
|
||||
expect(send).toHaveBeenCalledWith(
|
||||
"paseo:event:app-update-download-progress",
|
||||
expect.objectContaining({ version: "1.2.7", percent: 50 }),
|
||||
);
|
||||
getAllWindowsMock.mockReturnValue([]);
|
||||
|
||||
await checkForAppUpdate({
|
||||
currentVersion: "1.2.3",
|
||||
releaseChannel: "stable",
|
||||
intent: "automatic",
|
||||
autoDownload: true,
|
||||
});
|
||||
expect(() => {
|
||||
autoUpdaterMock.handlers.get("download-progress")?.({
|
||||
percent: 50,
|
||||
transferred: 50,
|
||||
total: 100,
|
||||
bytesPerSecond: 10,
|
||||
});
|
||||
}).not.toThrow();
|
||||
expect(send).toHaveBeenCalledWith(
|
||||
"paseo:event:app-update-download-progress",
|
||||
expect.objectContaining({ version: "1.2.7", percent: 50 }),
|
||||
);
|
||||
} finally {
|
||||
getAllWindowsMock.mockReturnValue([]);
|
||||
platformSpy.mockRestore();
|
||||
}
|
||||
});
|
||||
|
||||
it("reports a failure when quitAndInstall emits an installer error and returns normally", async () => {
|
||||
|
||||
@@ -132,6 +132,14 @@ export function shouldInstallAppUpdateOnQuit(input: {
|
||||
}
|
||||
|
||||
const APP_UPDATE_DOWNLOAD_PROGRESS_EVENT = "paseo:event:app-update-download-progress";
|
||||
const activeProgressBarWindows = new WeakSet<BrowserWindow>();
|
||||
|
||||
// macOS 26 Intel under Electron 44 wedges the main process and leaks gigabytes of
|
||||
// IOSurfaces in VizCompositorThread when BrowserWindow.setProgressBar() touches the
|
||||
// Dock tile. In-app download progress still updates via APP_UPDATE_DOWNLOAD_PROGRESS_EVENT.
|
||||
export function shouldUseWindowProgressBar(platform: NodeJS.Platform): boolean {
|
||||
return platform !== "darwin";
|
||||
}
|
||||
|
||||
function resolveProgressBarValue(progress: AppUpdateDownloadProgress | null): number {
|
||||
if (progress === null) return -1;
|
||||
@@ -141,12 +149,22 @@ function resolveProgressBarValue(progress: AppUpdateDownloadProgress | null): nu
|
||||
|
||||
function broadcastDownloadProgress(progress: AppUpdateDownloadProgress | null): void {
|
||||
const normalizedBar = resolveProgressBarValue(progress);
|
||||
const useWindowProgressBar = shouldUseWindowProgressBar(process.platform);
|
||||
for (const win of BrowserWindow.getAllWindows()) {
|
||||
if (win.isDestroyed()) continue;
|
||||
try {
|
||||
win.setProgressBar(normalizedBar);
|
||||
} catch {
|
||||
// Progress bar support is optional across desktop environments.
|
||||
const shouldUpdateProgressBar =
|
||||
useWindowProgressBar && (progress !== null || activeProgressBarWindows.has(win));
|
||||
if (shouldUpdateProgressBar) {
|
||||
try {
|
||||
win.setProgressBar(normalizedBar);
|
||||
if (progress === null) {
|
||||
activeProgressBarWindows.delete(win);
|
||||
} else {
|
||||
activeProgressBarWindows.add(win);
|
||||
}
|
||||
} catch {
|
||||
// Progress bar support is optional across desktop environments.
|
||||
}
|
||||
}
|
||||
try {
|
||||
win.webContents.send(APP_UPDATE_DOWNLOAD_PROGRESS_EVENT, progress);
|
||||
|
||||
@@ -15,7 +15,7 @@ Save the settings you use together as a named profile. Choose **UI work**, **Pla
|
||||
|
||||
## Create a profile
|
||||
|
||||
1. Open **Settings → your host → Agents → Agent profiles**.
|
||||
1. Open **Settings → Host → Agent profiles**.
|
||||
2. Select **New profile** and give it a name, such as **UI work**.
|
||||
3. Choose its provider, model, mode, thinking level, and any available features.
|
||||
4. Fill in **When to use** with the kind of work this profile should handle.
|
||||
|
||||
@@ -13,7 +13,7 @@ nav: Agent 配置
|
||||
|
||||
## 创建配置 {#create-a-profile}
|
||||
|
||||
1. 打开 **设置 → 你的主机 → Agents → Agent 配置**。
|
||||
1. 打开 **设置 → 主机 → Agent 配置**。
|
||||
2. 选择 **新建配置**,并为它命名,例如 **UI 工作**。
|
||||
3. 选择它的 Provider、模型、模式、思考级别以及任何可用的功能。
|
||||
4. 在 **适用场景** 中填写这个配置应该处理的工作类型。
|
||||
|
||||
@@ -25,7 +25,7 @@ Because you share the browser with the agent, you can watch it work — and step
|
||||
|
||||
Browser tools are off by default. Turn them on per host:
|
||||
|
||||
- **In the app:** open **Settings → your host → Agents** and turn on **Browser tools**.
|
||||
- **In the app:** open **Settings → Host → Tools & prompts** and turn on **Browser tools**.
|
||||
- **In `config.json`** (`~/.paseo/config.json`):
|
||||
|
||||
```json
|
||||
|
||||
@@ -23,7 +23,7 @@ Paseo 中的 Agent 可以操作真实的浏览器标签页,也就是你在 Pas
|
||||
|
||||
浏览器工具默认关闭。按主机开启:
|
||||
|
||||
- **在应用中**:打开 **设置 → 你的主机 → Agents**,开启 **Browser tools**。
|
||||
- **在应用中**:打开 **设置 → 主机 → 工具与提示词**,开启 **Browser tools**。
|
||||
- **在 `config.json` 中**(`~/.paseo/config.json`):
|
||||
|
||||
```json
|
||||
|
||||
@@ -101,7 +101,7 @@ See [Providers](/docs/providers) for the mental model and [Supported providers](
|
||||
|
||||
Paseo releases resumable idle agent processes after one hour when its daemon baseline allows
|
||||
cleanup and any implemented provider check agrees. Your next prompt resumes the same conversation. Disable this
|
||||
for the entire host by turning off **Release idle agents** in **Settings → your host → Agents**, or with:
|
||||
for the entire host by turning off **Release idle agents** in **Settings → Host → Daemon**, or with:
|
||||
|
||||
```json
|
||||
{ "agents": { "idleRuntimeCleanup": false } }
|
||||
|
||||
@@ -96,7 +96,7 @@ Agent Provider,包括 Paseo 自带的一等 Provider 和你在 `agents.provide
|
||||
|
||||
## 空闲运行时 {#idle-runtimes}
|
||||
|
||||
当 daemon 的基础条件允许清理,且 Provider 已实现的安全检查也允许时,Paseo 会在可恢复的 Agent 空闲一小时后释放其进程。你的下一条提示词会恢复同一个会话。要为整个主机禁用此功能,请在 **设置 → 你的主机 → Agents** 中关闭 **释放空闲 Agent**,或设置:
|
||||
当 daemon 的基础条件允许清理,且 Provider 已实现的安全检查也允许时,Paseo 会在可恢复的 Agent 空闲一小时后释放其进程。你的下一条提示词会恢复同一个会话。要为整个主机禁用此功能,请在 **设置 → 主机 → 守护进程** 中关闭 **释放空闲 Agent**,或设置:
|
||||
|
||||
```json
|
||||
{ "agents": { "idleRuntimeCleanup": false } }
|
||||
|
||||
@@ -40,7 +40,7 @@ Every failure is written to `$PASEO_HOME/daemon.log` (`~/.paseo/daemon.log` by d
|
||||
|
||||
## Choose a model
|
||||
|
||||
Open **Settings → Host → Metadata** and select **Automatic** or **Manual**. In Manual mode, pick the model Paseo uses. Choosing a model replaces the first entry in `agents.metadataGeneration.providers` and preserves the rest of the list. Switching back to Automatic clears the list.
|
||||
Open **Settings → Host → Workspaces** and select **Automatic** or **Manual**. In Manual mode, pick the model Paseo uses. Choosing a model replaces the first entry in `agents.metadataGeneration.providers` and preserves the rest of the list. Switching back to Automatic clears the list.
|
||||
|
||||
## Configure a custom fallback order
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ Paseo 有两种模式。**自动** 是默认模式,无需任何配置。**手
|
||||
|
||||
## 选择模型 {#choose-a-model}
|
||||
|
||||
打开 **设置 → 主机 → 元数据**,选择 **自动** 或 **手动**。在手动模式下,选择 Paseo 使用的模型。选择模型会替换 `agents.metadataGeneration.providers` 中的第一项,并保留列表的其余部分。切换回自动会清空该列表。
|
||||
打开 **设置 → 主机 → Workspaces**,选择 **自动** 或 **手动**。在手动模式下,选择 Paseo 使用的模型。选择模型会替换 `agents.metadataGeneration.providers` 中的第一项,并保留列表的其余部分。切换回自动会清空该列表。
|
||||
|
||||
## 配置自定义的回退顺序 {#configure-a-custom-fallback-order}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ Use built-in Paseo tools or the CLI. Both let an agent launch and coordinate wor
|
||||
|
||||
Enable Paseo tools so agents running inside Paseo can manage agents and workspaces on their host directly.
|
||||
|
||||
1. Open **Settings → your host → Agents**.
|
||||
1. Open **Settings → Host → Tools & prompts**.
|
||||
2. Turn on **Enable Paseo tools**. Tool injection is off by default.
|
||||
3. Start a new agent, or reload an existing agent so it receives the tools.
|
||||
4. Ask:
|
||||
|
||||
@@ -30,7 +30,7 @@ Paseo 让你的编程 Agent 协调其他 Agent,把工作分配到不同的 Pro
|
||||
|
||||
启用 Paseo 工具后,在 Paseo 中运行的 Agent 可以直接管理其主机上的 Agent 和工作区。
|
||||
|
||||
1. 打开 **设置 → 你的主机 → Agents**。
|
||||
1. 打开 **设置 → 主机 → 工具与提示词**。
|
||||
2. 打开 **启用 Paseo tools**。工具注入默认关闭。
|
||||
3. 启动一个新的 Agent,或重新加载已有的 Agent,让它获得这些工具。
|
||||
4. 提出要求:
|
||||
|
||||
@@ -2044,13 +2044,13 @@ export default function contribute(client: PluginClientContext) {
|
||||
`addFilePanel` takes a `PluginFilePanelContribution` and returns an idempotent cleanup function.
|
||||
Paseo also removes the registration when the client entry is unloaded.
|
||||
|
||||
| Field | Required | Meaning |
|
||||
| ----------- | -------- | ------------------------------------------------------------------------ |
|
||||
| `id` | Yes | Plugin-local ID matching `^[a-z][a-z0-9-]*$`. |
|
||||
| `title` | Yes | Non-empty label in the picker, the Open with menu, and Settings > Files. |
|
||||
| `icon` | Yes | Lucide name, `{ svg }`, or component. See [Icons](#icons). |
|
||||
| `files` | Yes | `{ extensions: readonly string[]; filenames?: readonly string[] }`. |
|
||||
| `Component` | Yes | Component receiving `PluginFilePanelProps`. |
|
||||
| Field | Required | Meaning |
|
||||
| ----------- | -------- | --------------------------------------------------------------------------------------- |
|
||||
| `id` | Yes | Plugin-local ID matching `^[a-z][a-z0-9-]*$`. |
|
||||
| `title` | Yes | Non-empty label in the picker, the Open with menu, and Settings → Chat & panes → Files. |
|
||||
| `icon` | Yes | Lucide name, `{ svg }`, or component. See [Icons](#icons). |
|
||||
| `files` | Yes | `{ extensions: readonly string[]; filenames?: readonly string[] }`. |
|
||||
| `Component` | Yes | Component receiving `PluginFilePanelProps`. |
|
||||
|
||||
Extensions have no leading dot and match without case sensitivity. Filenames match the exact
|
||||
basename, including case. Selectors contain no paths, globs, or wildcards. Use `extensions: []`
|
||||
@@ -2169,7 +2169,7 @@ matches an exact filename, the choice applies to that basename instead. An unava
|
||||
is ignored on that host and retained for hosts where its panel is installed.
|
||||
|
||||
Users choose a panel three ways: the picker on first open, **Open with…** in the tab menu, and
|
||||
**Settings > Files**. Open with switches the current tab and wins over the remembered association
|
||||
**Settings → Chat & panes → Files** (shown when a plugin registers a file panel). Open with switches the current tab and wins over the remembered association
|
||||
for this tab until it is retargeted; its **Always use** remembers the shown panel. Opening a file
|
||||
at a line, from a link or a search result, switches the tab to its built-in panel, which shows the
|
||||
line in its Source view. Files with no candidate show **Binary preview unavailable**; binary files
|
||||
|
||||
@@ -1690,13 +1690,13 @@ export default function contribute(client: PluginClientContext) {
|
||||
|
||||
`addFilePanel` 接收一个 `PluginFilePanelContribution`,并返回一个幂等的清理函数。客户端入口被卸载时,Paseo 也会移除该注册。
|
||||
|
||||
| 字段 | 必填 | 含义 |
|
||||
| ----------- | ---- | -------------------------------------------------------------------- |
|
||||
| `id` | 是 | 插件内唯一的 ID,匹配 `^[a-z][a-z0-9-]*$`。 |
|
||||
| `title` | 是 | 显示在选择器、**打开方式…** 菜单和 **设置 > 文件** 中的非空标签。 |
|
||||
| `icon` | 是 | Lucide 名称、`{ svg }` 或组件。参见[图标](#icons)。 |
|
||||
| `files` | 是 | `{ extensions: readonly string[]; filenames?: readonly string[] }`。 |
|
||||
| `Component` | 是 | 接收 `PluginFilePanelProps` 的组件。 |
|
||||
| 字段 | 必填 | 含义 |
|
||||
| ----------- | ---- | ------------------------------------------------------------------------------ |
|
||||
| `id` | 是 | 插件内唯一的 ID,匹配 `^[a-z][a-z0-9-]*$`。 |
|
||||
| `title` | 是 | 显示在选择器、**打开方式…** 菜单和 **设置 → 聊天与面板 → 文件** 中的非空标签。 |
|
||||
| `icon` | 是 | Lucide 名称、`{ svg }` 或组件。参见[图标](#icons)。 |
|
||||
| `files` | 是 | `{ extensions: readonly string[]; filenames?: readonly string[] }`。 |
|
||||
| `Component` | 是 | 接收 `PluginFilePanelProps` 的组件。 |
|
||||
|
||||
扩展名不带前导点,匹配时不区分大小写。文件名按完整的 basename 匹配,区分大小写。选择器不包含路径、glob 或通配符。只按文件名选择时,请使用 `extensions: []`。至少需要一个扩展名或文件名。
|
||||
|
||||
@@ -1777,7 +1777,7 @@ hook 的重新读取会采用磁盘上的版本,因此下一次写入会覆盖
|
||||
|
||||
**不再询问** 会在此设备上为该扩展名记住这个选择。当某个候选面板匹配了确切的文件名时,该选择改为应用于那个 basename。不可用的关联在该主机上会被忽略,并为安装了其面板的主机保留。
|
||||
|
||||
用户有三种方式选择面板:第一次打开时的选择器、标签页菜单中的 **打开方式…**,以及 **设置 > 文件**。打开方式会切换当前标签页,并且对于这个标签页优先于记住的关联,直到标签页被重新定向;其中的 **始终用于** 会记住当前显示的面板。从链接或搜索结果在某一行打开文件时,标签页会切换到它的内置面板,并在源代码视图中显示该行。没有候选面板的文件显示 **二进制预览不可用**;二进制文件没有源代码面板。
|
||||
用户有三种方式选择面板:第一次打开时的选择器、标签页菜单中的 **打开方式…**,以及 **设置 → 聊天与面板 → 文件**(有插件注册文件面板时显示)。打开方式会切换当前标签页,并且对于这个标签页优先于记住的关联,直到标签页被重新定向;其中的 **始终用于** 会记住当前显示的面板。从链接或搜索结果在某一行打开文件时,标签页会切换到它的内置面板,并在源代码视图中显示该行。没有候选面板的文件显示 **二进制预览不可用**;二进制文件没有源代码面板。
|
||||
|
||||
### DocumentFrame {#documentframe}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ Paseo checks Chromium sandbox availability each time the desktop app launches on
|
||||
|
||||
AppImage and extracted tar archives launch with Chromium's sandbox disabled when neither is available. Use the `.deb` or `.rpm` package if you require Chromium process isolation. Passing `--no-sandbox` explicitly disables it.
|
||||
|
||||
Open **Settings → Diagnostics → App Diagnostics** to check the sandbox state and reason. The [desktop log](/docs/troubleshooting#reading-the-logs) records the same decision.
|
||||
Open **Settings → About → App diagnostic** to check the sandbox state and reason. The [desktop log](/docs/troubleshooting#reading-the-logs) records the same decision.
|
||||
|
||||
## Agent authentication
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ Compose 和反向代理的示例见 [Docker](/docs/docker)。
|
||||
|
||||
当两者都不可用时,AppImage 和解压后的 tar 包会在禁用 Chromium 沙盒的情况下启动。如果你需要 Chromium 进程隔离,请使用 `.deb` 或 `.rpm` 软件包。显式传入 `--no-sandbox` 会禁用沙盒。
|
||||
|
||||
打开 **设置 → 诊断 → App diagnostic** 查看沙盒状态及原因。[桌面日志](/docs/troubleshooting#reading-the-logs)也会记录同样的决定。
|
||||
打开 **设置 → 关于 → App diagnostic** 查看沙盒状态及原因。[桌面日志](/docs/troubleshooting#reading-the-logs)也会记录同样的决定。
|
||||
|
||||
## Agent 身份验证 {#agent-authentication}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ Skills give your agents reusable instructions for delegation, handoffs, and revi
|
||||
|
||||
## Installation
|
||||
|
||||
- **In Paseo:** Open **Settings → your host → Agents → Orchestration skills** and choose which skills to install on that host.
|
||||
- **In Paseo:** Open **Settings → Host → Tools & prompts → Paseo skills** and choose which skills to install on that host.
|
||||
- **From the terminal:** Run `npx skills add getpaseo/paseo` on the machine where your agents run.
|
||||
|
||||
Use the same settings card to update or uninstall skills. The host also refreshes selected installed Paseo skills on startup.
|
||||
|
||||
@@ -17,7 +17,7 @@ nav: 技能
|
||||
|
||||
## 安装 {#installation}
|
||||
|
||||
- **在 Paseo 中**:打开 **设置 → 你的主机 → Agents → 编排 skills**,选择要在该主机上安装的技能。
|
||||
- **在 Paseo 中**:打开 **设置 → 主机 → 工具与提示词 → Paseo skills**,选择要在该主机上安装的技能。
|
||||
- **在终端中**:在运行 Agent 的机器上执行 `npx skills add getpaseo/paseo`。
|
||||
|
||||
使用同一张设置卡片更新或卸载技能。主机启动时也会刷新已选择安装的 Paseo 技能。
|
||||
|
||||
@@ -57,7 +57,7 @@ If the command is not found:
|
||||
1. Install the [Codex CLI](https://developers.openai.com/codex/cli).
|
||||
2. Sign in with `codex login` or an API key.
|
||||
3. If the Paseo daemon was already running when you installed the CLI, restart Paseo.
|
||||
4. In Paseo, open **Settings → Hosts → your host → Providers → Codex** and select **Refresh**.
|
||||
4. In Paseo, open **Settings → Host → Providers → Codex** and select **Refresh**.
|
||||
|
||||
Codex becomes available once Paseo can find and start the `codex` command.
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ where.exe codex
|
||||
1. 安装 [Codex CLI](https://developers.openai.com/codex/cli)。
|
||||
2. 使用 `codex login` 或 API key 登录。
|
||||
3. 如果安装 CLI 时 Paseo 的 daemon 已在运行,请重启 Paseo。
|
||||
4. 在 Paseo 中打开 **设置 → Hosts → 你的主机 → Providers → Codex**,然后选择 **刷新**。
|
||||
4. 在 Paseo 中打开 **设置 → 主机 → Providers → Codex**,然后选择 **刷新**。
|
||||
|
||||
当 Paseo 能找到并启动 `codex` 命令后,Codex 就会变为可用。
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ Add fx from Settings in Paseo before you start an agent.
|
||||
|
||||
1. [Install fx](https://fx.sh/docs/getting-started/installation) on your daemon host.
|
||||
2. [Connect fx to a model provider](https://fx.sh/docs/getting-started/authentication), such as with `fx login`.
|
||||
3. In Paseo, open **Settings → Hosts → your host → Providers**, select **+ Provider**, find **fx**, and select **Add**.
|
||||
3. In Paseo, open **Settings → Host → Providers**, select **+ Provider**, find **fx**, and select **Add**.
|
||||
|
||||
Until fx has credentials, Paseo shows the sign-in message from fx. If `fx` is outside your daemon PATH, use a [command override](/docs/custom-providers#custom-binary) and keep `acp` in the arguments.
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ Paseo 通过你已安装的 `fx` CLI 提供的 Agent Client Protocol(`fx acp`
|
||||
|
||||
1. 在 daemon 主机上[安装 fx](https://fx.sh/docs/getting-started/installation)。
|
||||
2. [为 fx 连接一个模型提供方](https://fx.sh/docs/getting-started/authentication),例如运行 `fx login`。
|
||||
3. 在 Paseo 中打开 **设置 → Hosts → 你的主机 → Providers**,选择 **+ Provider**,找到 **fx**,然后选择 **添加**。
|
||||
3. 在 Paseo 中打开 **设置 → 主机 → Providers**,选择 **+ Provider**,找到 **fx**,然后选择 **添加**。
|
||||
|
||||
在 fx 拿到凭据之前,Paseo 会显示 fx 给出的登录提示。如果 `fx` 不在 daemon 的 PATH 中,请使用[命令覆盖](/docs/custom-providers#custom-binary),并在参数中保留 `acp`。
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ Add Hoplite from Settings in Paseo before you start an agent.
|
||||
|
||||
1. Install the [Hoplite CLI](https://hoplite.sh/docs/cli) on your daemon host.
|
||||
2. Run `hoplite login` in a terminal.
|
||||
3. In Paseo, open **Settings → Hosts → your host → Providers**, select **+ Provider**, find **Hoplite**, and select **Add**.
|
||||
3. In Paseo, open **Settings → Host → Providers**, select **+ Provider**, find **Hoplite**, and select **Add**.
|
||||
|
||||
See [Hoplite's ACP guide](https://hoplite.sh/docs/cli/acp) for authentication and project setup. If `hoplite` is outside your daemon PATH, use a [command override](/docs/custom-providers#custom-binary) and keep `acp` in the arguments.
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ Paseo 通过你已安装的 `hoplite` CLI 提供的 Agent Client Protocol(`hop
|
||||
|
||||
1. 在 daemon 主机上安装 [Hoplite CLI](https://hoplite.sh/docs/cli)。
|
||||
2. 在终端中运行 `hoplite login`。
|
||||
3. 在 Paseo 中打开 **设置 → Hosts → 你的主机 → Providers**,选择 **+ Provider**,找到 **Hoplite**,然后选择 **添加**。
|
||||
3. 在 Paseo 中打开 **设置 → 主机 → Providers**,选择 **+ Provider**,找到 **Hoplite**,然后选择 **添加**。
|
||||
|
||||
认证和项目设置见 [Hoplite 的 ACP 指南](https://hoplite.sh/docs/cli/acp)。如果 `hoplite` 不在 daemon 的 PATH 中,请使用[命令覆盖](/docs/custom-providers#custom-binary),并在参数中保留 `acp`。
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ Paseo runs any agent that speaks the [Agent Client Protocol](https://agentclient
|
||||
To add one from the catalog:
|
||||
|
||||
1. If the agent does not launch through `npx` or `uvx`, install its CLI on your daemon host.
|
||||
2. Open **Settings → Hosts → your host → Providers** in Paseo.
|
||||
2. Open **Settings → Host → Providers** in Paseo.
|
||||
3. Select **+ Provider**, find the agent, and select **Add**.
|
||||
|
||||
Entries that launch through `npx` or `uvx` need only that tool on your daemon host. If a CLI is missing, the provider page shows **Not installed**, and **Install** opens its install instructions.
|
||||
|
||||
@@ -30,7 +30,7 @@ Paseo 可以运行任何使用 [Agent Client Protocol](https://agentclientprotoc
|
||||
从目录添加其中一个:
|
||||
|
||||
1. 如果该 Agent 不是通过 `npx` 或 `uvx` 启动的,请先在 daemon 主机上安装它的 CLI。
|
||||
2. 在 Paseo 中打开 **设置 → Hosts → 你的主机 → Providers**。
|
||||
2. 在 Paseo 中打开 **设置 → 主机 → Providers**。
|
||||
3. 选择 **+ Provider**,找到该 Agent,然后选择 **添加**。
|
||||
|
||||
通过 `npx` 或 `uvx` 启动的条目只需要 daemon 主机上有该工具。如果缺少 CLI,Provider 页面会显示 **未安装**,选择 **安装** 会打开它的安装说明。
|
||||
|
||||
@@ -15,7 +15,7 @@ Paseo runs Oh My Pi (OMP) through your installed `omp` CLI. It uses your existin
|
||||
Oh My Pi is built into Paseo and off by default.
|
||||
|
||||
1. Install [Oh My Pi](https://github.com/can1357/oh-my-pi) on your daemon host, and make sure that `omp` runs in a terminal.
|
||||
2. In Paseo, open **Settings → Hosts → your host → Providers** and turn on **Oh My Pi**.
|
||||
2. In Paseo, open **Settings → Host → Providers** and turn on **Oh My Pi**.
|
||||
3. Choose **Oh My Pi** when you start an agent.
|
||||
|
||||
If `omp` is outside your daemon PATH, use a [command override](/docs/custom-providers#custom-binary). You can also enable `omp` in `~/.paseo/config.json` under `agents.providers.omp`. To run a second OMP profile with its own settings, see [OMP profiles](https://github.com/getpaseo/paseo/blob/main/docs/custom-providers.md#omp-profiles-and-pi-compatible-forks) on GitHub.
|
||||
|
||||
@@ -13,7 +13,7 @@ Paseo 通过你已安装的 `omp` CLI 运行 Oh My Pi(OMP)。它使用你现
|
||||
Oh My Pi 内置于 Paseo,默认关闭。
|
||||
|
||||
1. 在 daemon 主机上安装 [Oh My Pi](https://github.com/can1357/oh-my-pi),并确认 `omp` 可以在终端中运行。
|
||||
2. 在 Paseo 中打开 **设置 → Hosts → 你的主机 → Providers**,然后启用 **Oh My Pi**。
|
||||
2. 在 Paseo 中打开 **设置 → 主机 → Providers**,然后启用 **Oh My Pi**。
|
||||
3. 启动 Agent 时选择 **Oh My Pi**。
|
||||
|
||||
如果 `omp` 不在 daemon 的 PATH 中,请使用[命令覆盖](/docs/custom-providers#custom-binary)。你也可以在 `~/.paseo/config.json` 的 `agents.providers.omp` 下启用 `omp`。如需运行带有独立设置的第二个 OMP 配置,请参见 GitHub 上的 [OMP profiles](https://github.com/getpaseo/paseo/blob/main/docs/custom-providers.md#omp-profiles-and-pi-compatible-forks)。
|
||||
|
||||
@@ -107,7 +107,7 @@ paseo reload
|
||||
|
||||
Paseo applies runtime-safe settings and names any paths that require a restart. Invalid JSON or a schema error applies nothing; fix the reported error and run the command again. If a launch environment variable or flag owns a changed setting, reload reports it separately.
|
||||
|
||||
Run `paseo daemon restart` only when reload requests it. In the app, open **Settings → your host → Overview** and use **Restart daemon**. Running agents keep going, and clients reconnect automatically.
|
||||
Run `paseo daemon restart` only when reload requests it. In the app, open **Settings → Host → Daemon** and use **Restart daemon**. Running agents keep going, and clients reconnect automatically.
|
||||
|
||||
## Still stuck?
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ paseo reload
|
||||
|
||||
Paseo 会应用可以在运行时安全生效的设置,并列出需要重启的路径。JSON 无效或 schema 错误时,不会应用任何内容;修复报告的错误后再次运行该命令。如果某个改动的设置由启动时的环境变量或参数决定,reload 会单独报告它。
|
||||
|
||||
只有当 reload 要求时才运行 `paseo daemon restart`。在应用中,打开 **设置 → 你的主机 → 概览** 并使用 **重启 Daemon**。正在运行的 Agent 会继续运行,客户端会自动重连。
|
||||
只有当 reload 要求时才运行 `paseo daemon restart`。在应用中,打开 **设置 → 主机 → 守护进程** 并使用 **重启 Daemon**。正在运行的 Agent 会继续运行,客户端会自动重连。
|
||||
|
||||
## 仍然无法解决? {#still-stuck}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user