(runId, live)
| 180 | return found; |
| 181 | } |
| 182 | |
| 183 | async function handleLiveExec(runId, input) { |
| 184 | if (!input || typeof input.command !== "string" || !input.command || input.command.length > 1_000) throw new Error("command is required"); |
| 185 | const live = requireLiveWorkspace(runId); |
| 186 | const receipt = { type: "command", ...(await run(input.command, live.workspace, input.timeoutMs)) }; |
| 187 | return { ok: receipt.code === 0, receipt }; |
| 188 | } |
| 189 | |
| 190 | async function handleLiveRead(runId, path) { |
| 191 | const live = requireLiveWorkspace(runId); |
| 192 | const fullPath = assertSafePath(live.workspace, path); |
| 193 | return { ok: true, path, content: await readFile(fullPath, "utf8") }; |
| 194 | } |
| 195 | |
| 196 | async function handleLiveWrite(runId, input) { |
| 197 | if (!input || typeof input.path !== "string" || typeof input.content !== "string") throw new Error("path and content are required"); |
no test coverage detected