feat(web): panneau Fichiers — navigation projet + téléchargements fichier/dossier ZIP — #211

This commit is contained in:
2026-08-15 10:38:53 +02:00
parent bb1fdecf7c
commit 79fc3d184d
22 changed files with 1648 additions and 78 deletions

View File

@ -37,6 +37,7 @@ import type {
OpenCodeProviderCatalogEntry,
PermissionSet,
Project,
ProjectFileListing,
ProjectMcpToolPermissions,
ProjectPermissions,
ProjectWorkState,
@ -100,6 +101,37 @@ export class HttpProjectGateway implements ProjectGateway {
async updateProjectContext(projectId: string, content: string): Promise<void> {
await this.http.invoke("update_project_context", { request: { projectId, content } });
}
listProjectFiles(projectId: string, path: string): Promise<ProjectFileListing> {
return this.http.request<ProjectFileListing>(
"GET",
projectFilesPath("/api/project-files", projectId, path),
undefined,
"project files listing",
);
}
downloadProjectFile(projectId: string, path: string): Promise<void> {
return this.http.download(
projectFilesPath("/api/project-files/download-file", projectId, path),
projectFileDownloadName(path, "download"),
"project file download",
);
}
downloadProjectDirectory(projectId: string, path: string): Promise<void> {
return this.http.download(
projectFilesPath("/api/project-files/download-directory", projectId, path),
`${projectFileDownloadName(path, "project")}.zip`,
"project directory download",
);
}
}
function projectFilesPath(endpoint: string, projectId: string, path: string): string {
const params = new URLSearchParams({ projectId, path });
return `${endpoint}?${params.toString()}`;
}
function projectFileDownloadName(path: string, fallback: string): string {
return path.split("/").filter(Boolean).at(-1) ?? fallback;
}
export class HttpLayoutGateway implements LayoutGateway {