| 91 | // Runner is the concrete implementation today; the interface keeps |
| 92 | // that dependency out of the wire contract. |
| 93 | export interface ShellRPC { |
| 94 | // Spawn a command in the container. Returns an id (caller- |
| 95 | // supplied or runner-minted) and a ReadableStream of ExecEvents. |
| 96 | // Capnweb streams handle backpressure end-to-end; consumer-side |
| 97 | // slowness propagates to the spawned process via the kernel pipe. |
| 98 | exec(input: { |
| 99 | command: string; |
| 100 | cwd?: string; |
| 101 | id?: string; |
| 102 | // Per-call timeout in milliseconds. Past this duration the |
| 103 | // container sends SIGTERM (then SIGKILL after a short grace). |
| 104 | // 0 disables the timeout. Omit to use the runner's default |
| 105 | // (typically 320_000). |
| 106 | timeoutMs?: number; |
| 107 | // Environment variables inherited by this command only. |
| 108 | env?: Record<string, string>; |
| 109 | // Standard input bytes fed to the command. |
| 110 | stdin?: Uint8Array; |
| 111 | }): Promise<{ |
| 112 | id: string; |
| 113 | events: ReadableStream<ExecEvent>; |
| 114 | }>; |
| 115 | |
| 116 | // Reattach to an in-flight or recently-completed exec by id. |
| 117 | // Pass `after` to resume from a known seq; "tail" yields only |
| 118 | // future events; omit to receive every event from the start. |
| 119 | getExec(input: { id: string; after?: number | "tail" }): Promise<{ |
| 120 | id: string; |
| 121 | events: ReadableStream<ExecEvent>; |
| 122 | }>; |
| 123 | |
| 124 | // Signal a running exec. No-op once the process has exited. |
| 125 | killExec(input: { |
| 126 | id: string; |
| 127 | signal?: "SIGTERM" | "SIGKILL" | "SIGINT" | "SIGHUP"; |
| 128 | }): Promise<void>; |
| 129 | |
| 130 | // Release the event log for a completed exec. Future getExec on |
| 131 | // the same id throws ENOENT. |
| 132 | disposeExec(input: { id: string }): Promise<void>; |
| 133 | } |
| 134 | |
| 135 | // Composite stub. The wire serves one of these per session; the |
| 136 | // two halves are independently testable. Host-side callers reach |
no outgoing calls
no test coverage detected