fix(frontend): scope linked-server pickers to the canonical project and stabilize the model pill

Sheet, desktop rail and session-page dialog resolve the same canonical remote project, reuse the page's session cache and hold the all-directories search while it resolves. Deleting the open session keeps ?repoTab=. Context usage keeps its identity between streaming flushes so ModelQuickSelect skips re-renders, the location prefetch waits for repo data, and dialog and bottom sheet share one return-focus hook. Picker route parsing, remote project query options and the local new-session button are shared.
This commit is contained in:
Chris Scott committed 2026-10-23 23:01:19 -04:00
1 parent 52aeb7780f
commit bd746574e8
28 files changed
+827 -181

No files matched your search

+17
View File
@@ -68,6 +68,23 @@ export function remoteProjectName(project: OpenCodeProject): string {
return project.name?.trim() || getDirectoryName(project.canonical)
}
/**
* Finds the project that owns a directory, matching its canonical directory and anything nested
* inside it.
*
* @param projects Projects of the server that owns the directory.
* @param directory Directory whose owning project is resolved.
* @returns The owning project, or undefined when the directory belongs to none of them.
*/
export function findRemoteProjectForDirectory(
projects: OpenCodeProject[],
directory: string,
): OpenCodeProject | undefined {
return projects.find(
(project) => directory === project.canonical || directory.startsWith(`${project.canonical}/`),
)
}
export type VcsInfo = Awaited<ReturnType<OpenCodeApi['vcs']['get']>>['data']
export type VcsFileStatus = Awaited<ReturnType<OpenCodeApi['vcs']['status']>>['data'][number]