Unified · Split
| @@ -21,8 +21,6 @@ import { ServerConfig } from "../../config"; · 20 unmodified lines | ||
| 21 | 21 | import { |
| 22 | 22 | ShellCandidate, |
| 23 | 23 | TerminalManager, |
| 24 | − TerminalManagerEvents, | |
| 25 | − TerminalManagerOptions, | |
| 26 | 24 | TerminalManagerShape, |
| 27 | 25 | TerminalSessionState, |
| 28 | 26 | TerminalStartInput, |
| @@ -270,6 +268,19 @@ function normalizedRuntimeEnv( · 241 unmodified lines | ||
| 270 | 268 | return Object.fromEntries(entries.toSorted(([left], [right]) => left.localeCompare(right))); |
| 271 | 269 | } |
| 272 | 270 | |
| 271 | +interface TerminalManagerEvents { | |
| 272 | + event: [event: TerminalEvent]; | |
| 273 | +} | |
| 274 | + | |
| 275 | +interface TerminalManagerOptions { | |
| 276 | + logsDir?: string; | |
| 277 | + historyLineLimit?: number; | |
| 278 | + ptyAdapter: PtyAdapterShape; | |
| 279 | + shellResolver?: () => string; | |
| 280 | + subprocessChecker?: TerminalSubprocessChecker; | |
| 281 | + subprocessPollIntervalMs?: number; | |
| 282 | +} | |
| 283 | + | |
| 273 | 284 | export class TerminalManagerRuntime extends EventEmitter<TerminalManagerEvents> { |
| 274 | 285 | private readonly sessions = new Map<string, TerminalSessionState>(); |
| 275 | 286 | private readonly logsDir: string; |
| @@ -8,15 +8,9 @@ import { · 7 unmodified lines | ||
| 8 | 8 | TerminalSessionStatus, |
| 9 | 9 | TerminalWriteInput, |
| 10 | 10 | } from "@t3tools/contracts"; |
| 11 | −import { PtyAdapterShape, PtyProcess } from "./PTY"; | |
| 11 | +import { PtyProcess } from "./PTY"; | |
| 12 | 12 | import { Effect, ServiceMap } from "effect"; |
| 13 | 13 | |
| 14 | −type TerminalSubprocessChecker = (terminalPid: number) => Promise<boolean>; | |
| 15 | − | |
| 16 | −export interface TerminalManagerEvents { | |
| 17 | − event: [event: TerminalEvent]; | |
| 18 | −} | |
| 19 | − | |
| 20 | 14 | export interface TerminalSessionState { |
| 21 | 15 | threadId: string; |
| 22 | 16 | terminalId: string; |
| @@ -46,15 +40,6 @@ export interface TerminalStartInput extends TerminalOpenInput { · 23 unmodified lines | ||
| 46 | 40 | rows: number; |
| 47 | 41 | } |
| 48 | 42 | |
| 49 | −export interface TerminalManagerOptions { | |
| 50 | − logsDir?: string; | |
| 51 | − historyLineLimit?: number; | |
| 52 | − ptyAdapter: PtyAdapterShape; | |
| 53 | − shellResolver?: () => string; | |
| 54 | − subprocessChecker?: TerminalSubprocessChecker; | |
| 55 | − subprocessPollIntervalMs?: number; | |
| 56 | −} | |
| 57 | − | |
| 58 | 43 | export interface TerminalManagerShape { |
| 59 | 44 | readonly open: (input: TerminalOpenInput) => Effect.Effect<TerminalSessionSnapshot, unknown>; |
| 60 | 45 | readonly write: (input: TerminalWriteInput) => Effect.Effect<void, unknown>; |