huskies: merge 775

This commit is contained in:
dave
2026-04-28 12:19:49 +00:00
parent e9ed58502a
commit b7db6d6aae
10 changed files with 139 additions and 46 deletions
+17 -6
View File
@@ -152,11 +152,22 @@ export const gatewayApi = {
return rpc.result!;
},
/// Switch the active project.
switchProject(project: string): Promise<{ ok: boolean; error?: string }> {
return gatewayRequest<{ ok: boolean; error?: string }>(
"/api/gateway/switch",
{ method: "POST", body: JSON.stringify({ project }) },
);
/// Switch the active project via the MCP switch_project tool.
async switchProject(project: string): Promise<{ ok: boolean; error?: string }> {
const res = await fetch("/mcp", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "tools/call",
params: { name: "switch_project", arguments: { project } },
}),
});
const data = await res.json();
if (data.error) {
return { ok: false, error: data.error.message ?? String(data.error) };
}
return { ok: true };
},
};