forked from farhoodlabs/paperclip
Add workspace runtime controls
Expose project and execution workspace runtime defaults, control endpoints, startup recovery, and operator UI for start/stop/restart flows. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { ExecutionWorkspace, ExecutionWorkspaceCloseReadiness } from "@paperclipai/shared";
|
||||
import type { ExecutionWorkspace, ExecutionWorkspaceCloseReadiness, WorkspaceOperation } from "@paperclipai/shared";
|
||||
import { api } from "./client";
|
||||
|
||||
export const executionWorkspacesApi = {
|
||||
@@ -24,5 +24,12 @@ export const executionWorkspacesApi = {
|
||||
get: (id: string) => api.get<ExecutionWorkspace>(`/execution-workspaces/${id}`),
|
||||
getCloseReadiness: (id: string) =>
|
||||
api.get<ExecutionWorkspaceCloseReadiness>(`/execution-workspaces/${id}/close-readiness`),
|
||||
listWorkspaceOperations: (id: string) =>
|
||||
api.get<WorkspaceOperation[]>(`/execution-workspaces/${id}/workspace-operations`),
|
||||
controlRuntimeServices: (id: string, action: "start" | "stop" | "restart") =>
|
||||
api.post<{ workspace: ExecutionWorkspace; operation: WorkspaceOperation }>(
|
||||
`/execution-workspaces/${id}/runtime-services/${action}`,
|
||||
{},
|
||||
),
|
||||
update: (id: string, data: Record<string, unknown>) => api.patch<ExecutionWorkspace>(`/execution-workspaces/${id}`, data),
|
||||
};
|
||||
|
||||
+11
-1
@@ -1,4 +1,4 @@
|
||||
import type { Project, ProjectWorkspace } from "@paperclipai/shared";
|
||||
import type { Project, ProjectWorkspace, WorkspaceOperation } from "@paperclipai/shared";
|
||||
import { api } from "./client";
|
||||
|
||||
function withCompanyScope(path: string, companyId?: string) {
|
||||
@@ -27,6 +27,16 @@ export const projectsApi = {
|
||||
projectPath(projectId, companyId, `/workspaces/${encodeURIComponent(workspaceId)}`),
|
||||
data,
|
||||
),
|
||||
controlWorkspaceRuntimeServices: (
|
||||
projectId: string,
|
||||
workspaceId: string,
|
||||
action: "start" | "stop" | "restart",
|
||||
companyId?: string,
|
||||
) =>
|
||||
api.post<{ workspace: ProjectWorkspace; operation: WorkspaceOperation }>(
|
||||
projectPath(projectId, companyId, `/workspaces/${encodeURIComponent(workspaceId)}/runtime-services/${action}`),
|
||||
{},
|
||||
),
|
||||
removeWorkspace: (projectId: string, workspaceId: string, companyId?: string) =>
|
||||
api.delete<ProjectWorkspace>(projectPath(projectId, companyId, `/workspaces/${encodeURIComponent(workspaceId)}`)),
|
||||
remove: (id: string, companyId?: string) => api.delete<Project>(projectPath(id, companyId)),
|
||||
|
||||
Reference in New Issue
Block a user