(project_slug: string, slug: string)
| 118 | } |
| 119 | |
| 120 | export function agentExistsInProject(project_slug: string, slug: string): boolean { |
| 121 | const agentId = `${project_slug}-${slug}`; |
| 122 | const dir = workspaceDirFor(agentId); |
| 123 | if (!existsSync(dir)) return false; |
| 124 | try { |
| 125 | // eslint-disable-next-line @typescript-eslint/no-require-imports |
| 126 | const { readdirSync } = require("node:fs") as typeof import("node:fs"); |
| 127 | return readdirSync(dir).length > 0; |
| 128 | } catch { |
| 129 | return true; |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | /** Cascade-delete an agent's workspace + sessions + scheduled jobs. */ |
| 134 | export async function cascadeDeleteAgent(agent_id: string, project_slug: string): Promise<void> { |
no test coverage detected