Spaces:
Paused
Paused
Download packages/shared/src/execution-workspace-guards.ts from GraziePrego/agent: direct link, hf CLI and curl.
- Browser
- Download file 934 Bytes
-
https://huggingface.co/spaces/GraziePrego/agent/resolve/main/packages/shared/src/execution-workspace-guards.ts
- Command line
-
hf download hf://spaces/GraziePrego/agent/packages/shared/src/execution-workspace-guards.ts
-
curl -L -o execution-workspace-guards.ts https://huggingface.co/spaces/GraziePrego/agent/resolve/main/packages/shared/src/execution-workspace-guards.ts
934 Bytes
| import type { ExecutionWorkspace } from "./types/workspace-runtime.js"; | |
| type ExecutionWorkspaceGuardTarget = Pick<ExecutionWorkspace, "closedAt" | "mode" | "name" | "status">; | |
| const CLOSED_EXECUTION_WORKSPACE_STATUSES = new Set<ExecutionWorkspace["status"]>(["archived", "cleanup_failed"]); | |
| export function isClosedIsolatedExecutionWorkspace( | |
| workspace: Pick<ExecutionWorkspaceGuardTarget, "closedAt" | "mode" | "status"> | null | undefined, | |
| ): boolean { | |
| if (!workspace) return false; | |
| if (workspace.mode !== "isolated_workspace") return false; | |
| return workspace.closedAt != null || CLOSED_EXECUTION_WORKSPACE_STATUSES.has(workspace.status); | |
| } | |
| export function getClosedIsolatedExecutionWorkspaceMessage( | |
| workspace: Pick<ExecutionWorkspaceGuardTarget, "name">, | |
| ): string { | |
| return `This issue is linked to the closed workspace "${workspace.name}". Move it to an open workspace before adding comments or resuming work.`; | |
| } | |