Make provider catalogs compact and content-addressed so repeat launches can reuse the persisted snapshot instead of transferring it again. Remove eager global catalog loading and the stopped-agent defensive tail fetch, while keeping sequence-gap and reconnect recovery as the correctness paths. Add an opt-in production-ID Android profiling build for local startup traces.
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import type { AgentProvider } from "@getpaseo/protocol/agent-types";
|
|
import { normalizeWorkspacePath } from "@/utils/workspace-identity";
|
|
|
|
export const PROVIDERS_SNAPSHOT_QUERY_ROOT = "providersSnapshot";
|
|
|
|
export function normalizeProvidersSnapshotCwd(cwd?: string | null): string | null {
|
|
return normalizeWorkspacePath(cwd);
|
|
}
|
|
|
|
export function providersSnapshotQueryRoot(serverId: string | null) {
|
|
return [PROVIDERS_SNAPSHOT_QUERY_ROOT, serverId] as const;
|
|
}
|
|
|
|
export function providersSnapshotQueryKey(serverId: string | null, cwd?: string | null) {
|
|
const normalizedCwd = normalizeProvidersSnapshotCwd(cwd);
|
|
return normalizedCwd
|
|
? ([PROVIDERS_SNAPSHOT_QUERY_ROOT, serverId, "cwd", normalizedCwd] as const)
|
|
: ([PROVIDERS_SNAPSHOT_QUERY_ROOT, serverId, "home"] as const);
|
|
}
|
|
|
|
export function providersSnapshotRequestOptions(input: {
|
|
cwd?: string | null;
|
|
providers?: AgentProvider[];
|
|
ifNoneMatch?: string;
|
|
}) {
|
|
const normalizedCwd = normalizeProvidersSnapshotCwd(input.cwd);
|
|
return {
|
|
...(normalizedCwd ? { cwd: normalizedCwd } : {}),
|
|
...(input.providers ? { providers: input.providers } : {}),
|
|
...(input.ifNoneMatch ? { ifNoneMatch: input.ifNoneMatch } : {}),
|
|
};
|
|
}
|
|
|
|
export function isProvidersSnapshotHomeScope(cwd?: string | null): boolean {
|
|
return normalizeProvidersSnapshotCwd(cwd) === null;
|
|
}
|