feat: workspace frontend integration (PR-4)

- Add workspace_id parameter to createInstance API client
- Wire WorkspacesPage 'Start Tool' modal to createInstance + startInstance
- Pass workspace_id when creating instance from workspace page
- TypeScript + eslint clean
This commit is contained in:
2026-05-31 23:30:09 +02:00
parent 986091ac56
commit 5bba2bbd92
2 changed files with 23 additions and 4 deletions
+20 -3
View File
@@ -7,6 +7,7 @@ import { useWorkspaceActions } from "../hooks/use-workspace-actions";
import { WorkspaceCard } from "../components/workspace-card";
import { WorkspaceCreateForm } from "../components/workspace-create-form";
import { StartToolModal } from "../components/start-tool-modal";
import { createInstance, startInstance } from "../api/sessions";
import type { Workspace } from "../types/workspace";
export function WorkspacesPage() {
@@ -36,9 +37,25 @@ export function WorkspacesPage() {
const handleStartTool = async (toolTypeId: string, configProfileId?: string) => {
if (!startWorkspace) return;
// TODO: Call instance creation API with workspace_id
console.log("Start tool", { toolTypeId, configProfileId, workspace: startWorkspace.id });
setStartWorkspace(null);
try {
const instance = await createInstance(
projectId,
repoId,
toolTypeId,
`${startWorkspace.name} - ${toolTypeId}`,
undefined,
undefined,
undefined,
configProfileId,
[],
startWorkspace.id
);
await startInstance(projectId, repoId, instance.id, configProfileId);
setStartWorkspace(null);
await refresh();
} catch (err) {
alert(err instanceof Error ? err.message : "Failed to start tool");
}
};
return (