| 109 | } |
| 110 | |
| 111 | async getRuntime(id: string, resume?: "tail") { |
| 112 | try { |
| 113 | const handle = await this.#workspace.runtime.getExec(id, { |
| 114 | backend: "worker-javascript", |
| 115 | encoding: "utf8", |
| 116 | resume, |
| 117 | }); |
| 118 | return { ok: true as const, result: await handle.result() }; |
| 119 | } catch (error) { |
| 120 | return { |
| 121 | ok: false as const, |
| 122 | error: error instanceof Error ? error.message : String(error), |
| 123 | }; |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | killRuntime(id: string) { |
| 128 | return this.#workspace.runtime.killExec(id, { backend: "worker-javascript" }); |