Update workspace and app changes

This commit is contained in:
Mohamed Boudra
2026-03-07 19:09:00 +07:00
parent 1d1c7058f1
commit 7d76da3249
40 changed files with 2693 additions and 976 deletions
+39 -2
View File
@@ -399,12 +399,46 @@ export function buildHostAgentsRoute(serverId: string): string {
return `${base}/agents`;
}
export function buildHostNewAgentRoute(serverId: string): string {
export function buildHostNewAgentRoute(
serverId: string,
options?: {
workingDir?: string;
provider?: string;
modeId?: string;
model?: string;
thinkingOptionId?: string;
worktreeMode?: "create" | "attach";
}
): string {
const base = buildHostRootRoute(serverId);
if (base === "/") {
return "/";
}
return `${base}/new-agent`;
const searchParams = new URLSearchParams();
const entries: Array<[string, string | undefined]> = [
["workingDir", options?.workingDir],
["provider", options?.provider],
["modeId", options?.modeId],
["model", options?.model],
["thinkingOptionId", options?.thinkingOptionId],
["worktreeMode", options?.worktreeMode],
];
for (const [key, value] of entries) {
const normalized = trimNonEmpty(value);
if (normalized) {
searchParams.set(key, normalized);
}
}
const search = searchParams.toString();
return search ? `${base}/new-agent?${search}` : `${base}/new-agent`;
}
export function buildHostOpenProjectRoute(serverId: string): string {
const base = buildHostRootRoute(serverId);
if (base === "/") {
return "/";
}
return `${base}/open-project`;
}
export function buildHostSettingsRoute(serverId: string): string {
@@ -435,6 +469,9 @@ export function mapPathnameToServer(
if (suffix.startsWith("new-agent")) {
return `${base}/new-agent`;
}
if (suffix.startsWith("open-project")) {
return `${base}/open-project`;
}
const workspaceRoute = parseHostWorkspaceRouteFromPathname(pathname);
if (workspaceRoute) {
const workspacePath = buildHostWorkspaceRoute(