* test: cover Windows provider snapshot cwd updates * fix: normalize Windows provider snapshot paths * fix: preserve Claude history path candidates * fix: match Claude project paths on Windows
35 lines
1.2 KiB
TypeScript
35 lines
1.2 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[];
|
|
}) {
|
|
const normalizedCwd = normalizeProvidersSnapshotCwd(input.cwd);
|
|
return {
|
|
...(normalizedCwd ? { cwd: normalizedCwd } : {}),
|
|
...(input.providers ? { providers: input.providers } : {}),
|
|
};
|
|
}
|
|
|
|
export function isProvidersSnapshotHomeScope(cwd?: string | null): boolean {
|
|
return normalizeProvidersSnapshotCwd(cwd) === null;
|
|
}
|