mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
* Merge workspaces across all hosts in the sidebar Replace per-host sidebar sections with a single merged project list. Projects that exist on multiple hosts (matched by projectKey) are collapsed into one row. Host identity is surfaced via: - A status-only footer pill showing online/offline host counts - Hover cards with a mandatory host row on every workspace entry - Subtitles showing the host name when a project spans >1 host - A host filter in the grouping dropdown (not a sidebar switcher) Order and group-mode stores migrated from per-server to global keys with zustand persist migrations. New-workspace screen now shows a merged project list with a host selector combobox. Key files: - workspace-structure.ts: merge algorithm by projectKey - sidebar-view-store.ts / sidebar-order-store.ts: global state - sidebar-workspace-list.tsx: context-based subtitle injection - new-workspace-screen.tsx: host selector in footer row * Add host filtering to the merged sidebar The sidebar now merges workspaces from every connected host, so a single global "active host" no longer fits. Host selection becomes explicit per action via a host chooser, and agent history pages across all hosts at once. Removes the active-host / active-server-id model and the all-agents-list hook that fed it. * Fix rebase fallout: translate archive host error, update stale workspace-key test archiveWorkspacesOptimistically used a raw "Host is not connected" string that the i18n completeness test forbids; route it through i18n.t with the existing hostDisconnected key. The selectors memoization test asserted un-prefixed workspace keys, but merged-sidebar keys are serverId-prefixed. * Fix sidebar review fallout * Address sidebar review followups * Fix sidebar workspace identity migration * Address sidebar review followups * Handle partial host history failures * Fix merged sidebar project removal and E2E drift * Restore history routes and project removal shape * Remove sidebar host context plumbing * Tighten sidebar status and host filter state * Keep new workspace project selection host-compatible * Migrate sidebar view storage * Streamline host selection flows * Update all-host history on archive * Fix empty project sidebar action Code regression: the main merge dropped the empty-project New workspace child row while keeping the empty project persistence contract. Restore the row using the project host target so the sidebar stays aligned with the no-host-selection model. * Fix Japanese shortcut translation key Stale-base integration: main added the Japanese locale after this branch added cycleAgentMode to the English shortcut help map. Merging main exposed the missing ja key in CI typecheck and resources.test. * Fix Playwright speech teardown race
103 lines
3.0 KiB
TypeScript
103 lines
3.0 KiB
TypeScript
import type { DaemonClient } from "@getpaseo/client/internal/daemon-client";
|
|
import { useSessionStore } from "@/stores/session-store";
|
|
import { selectHostFeature } from "@/runtime/host-features";
|
|
|
|
interface ProjectRemoveHost {
|
|
serverId: string;
|
|
}
|
|
|
|
export interface ProjectRemoveProject {
|
|
projectKey: string;
|
|
hosts: readonly ProjectRemoveHost[];
|
|
}
|
|
|
|
export interface ProjectRemoveTarget {
|
|
serverId: string;
|
|
}
|
|
|
|
export type ProjectRemoveReadiness =
|
|
| { kind: "ready"; targets: ProjectRemoveTarget[] }
|
|
| { kind: "needs_host_update"; serverIds: string[] };
|
|
|
|
export type ProjectRemoveOutcome =
|
|
| { kind: "removed"; serverIds: string[] }
|
|
| { kind: "host_disconnected"; serverIds: string[] }
|
|
| { kind: "failed"; serverIds: string[] };
|
|
|
|
type ProjectRemoveClient = Pick<DaemonClient, "removeProject">;
|
|
|
|
export function getProjectRemoveReadiness(input: {
|
|
project: ProjectRemoveProject;
|
|
supportsProjectRemove: (serverId: string) => boolean;
|
|
}): ProjectRemoveReadiness {
|
|
const unsupportedServerIds: string[] = [];
|
|
const targets: ProjectRemoveTarget[] = [];
|
|
|
|
for (const host of input.project.hosts) {
|
|
if (!input.supportsProjectRemove(host.serverId)) {
|
|
unsupportedServerIds.push(host.serverId);
|
|
continue;
|
|
}
|
|
targets.push({ serverId: host.serverId });
|
|
}
|
|
|
|
if (unsupportedServerIds.length > 0) {
|
|
return { kind: "needs_host_update", serverIds: unsupportedServerIds };
|
|
}
|
|
|
|
return { kind: "ready", targets };
|
|
}
|
|
|
|
export function getCurrentProjectRemoveReadiness(
|
|
project: ProjectRemoveProject,
|
|
): ProjectRemoveReadiness {
|
|
const sessionState = useSessionStore.getState();
|
|
return getProjectRemoveReadiness({
|
|
project,
|
|
supportsProjectRemove: (serverId) => selectHostFeature(sessionState, serverId, "projectRemove"),
|
|
});
|
|
}
|
|
|
|
export async function removeProjectFromHosts(input: {
|
|
projectKey: string;
|
|
targets: readonly ProjectRemoveTarget[];
|
|
getClient: (serverId: string) => ProjectRemoveClient | null;
|
|
}): Promise<ProjectRemoveOutcome> {
|
|
const clients: Array<{ serverId: string; client: ProjectRemoveClient }> = [];
|
|
const disconnectedServerIds: string[] = [];
|
|
|
|
for (const target of input.targets) {
|
|
const client = input.getClient(target.serverId);
|
|
if (!client) {
|
|
disconnectedServerIds.push(target.serverId);
|
|
continue;
|
|
}
|
|
clients.push({ serverId: target.serverId, client });
|
|
}
|
|
|
|
if (disconnectedServerIds.length > 0) {
|
|
return { kind: "host_disconnected", serverIds: disconnectedServerIds };
|
|
}
|
|
|
|
const results = await Promise.allSettled(
|
|
clients.map(async ({ client }) => {
|
|
await client.removeProject(input.projectKey);
|
|
}),
|
|
);
|
|
const failedServerIds: string[] = [];
|
|
for (const [index, result] of results.entries()) {
|
|
if (result.status === "rejected") {
|
|
const failed = clients[index];
|
|
if (failed) {
|
|
failedServerIds.push(failed.serverId);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (failedServerIds.length > 0) {
|
|
return { kind: "failed", serverIds: failedServerIds };
|
|
}
|
|
|
|
return { kind: "removed", serverIds: clients.map((entry) => entry.serverId) };
|
|
}
|