mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-04 23:44:41 +00:00
* Revert "Restore cached conversations before reconnecting (#4421)"
This reverts commit 1c51b52d07.
* fix(app): restore provider loading on native
* fix(app): preserve native navigators across appearance changes
Reapply the isolated appearance boundaries and native menu transform origin from #4421 so appearance hydration preserves native navigator and gesture host lifetimes.
* fix(app): retain cached baselines during live updates
Read the timeline concurrently with agent preparation and reconcile display-only cache rows beneath the live head using the existing reducer. Merge cached directory entries beneath live state while preserving the existing checkpoint race guard.
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
import type { FetchAgentsEntry } from "@getpaseo/client/internal/daemon-client";
|
|
import type { Agent } from "@/stores/session-store";
|
|
import { derivePendingPermissionKey, normalizeAgentSnapshot } from "@/utils/agent-snapshots";
|
|
import { resolveProjectPlacement } from "@/utils/project-placement";
|
|
import type { SessionOutboundMessage } from "@getpaseo/protocol/messages";
|
|
|
|
type AgentDirectoryFetchEntry = FetchAgentsEntry;
|
|
export type AgentDirectoryDelta = Extract<
|
|
SessionOutboundMessage,
|
|
{ type: "agent_update" }
|
|
>["payload"];
|
|
|
|
interface PendingPermissionEntry {
|
|
key: string;
|
|
agentId: string;
|
|
request: Agent["pendingPermissions"][number];
|
|
}
|
|
|
|
export function buildAgentDirectoryState(input: {
|
|
serverId: string;
|
|
entries: AgentDirectoryFetchEntry[];
|
|
}): {
|
|
agents: Map<string, Agent>;
|
|
pendingPermissions: Map<string, PendingPermissionEntry>;
|
|
} {
|
|
const agents = new Map<string, Agent>();
|
|
const pendingPermissions = new Map<string, PendingPermissionEntry>();
|
|
|
|
for (const entry of input.entries) {
|
|
const normalized = normalizeAgentSnapshot(entry.agent, input.serverId);
|
|
const projectPlacement = resolveProjectPlacement({
|
|
projectPlacement: entry.project,
|
|
cwd: normalized.cwd,
|
|
});
|
|
const agent: Agent = {
|
|
...normalized,
|
|
projectPlacement,
|
|
};
|
|
agents.set(agent.id, agent);
|
|
|
|
for (const request of agent.pendingPermissions) {
|
|
const key = derivePendingPermissionKey(agent.id, request);
|
|
pendingPermissions.set(key, { key, agentId: agent.id, request });
|
|
}
|
|
}
|
|
|
|
return { agents, pendingPermissions };
|
|
}
|