The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | /** |
| 2 | * Bun-backed implementation of Effect's `Terminal` service. |
| 3 | * |
| 4 | * This module reuses the shared Node terminal implementation for Bun. `make` |
| 5 | * creates a scoped process-backed `Terminal` service, and `layer` provides the |
| 6 | * default terminal service with the standard quit behavior for key input. |
| 7 | * |
| 8 | * @stability unstable |
| 9 | * @since 4.0.0 |
| 10 | */ |
| 11 | import * as NodeTerminal from "@effect/platform-node-shared/NodeTerminal" |
| 12 | import type { Effect } from "effect/Effect" |
| 13 | import type { Layer } from "effect/Layer" |
| 14 | import type { Scope } from "effect/Scope" |
| 15 | import type { Terminal, UserInput } from "effect/Terminal" |
| 16 | |
| 17 | /** |
| 18 | * Creates a scoped `Terminal` service backed by process stdin/stdout. |
| 19 | * By default, Esc, Ctrl+C, and Ctrl+D end key input. Supply `shouldQuit` to |
| 20 | * override these quit keys. |
| 21 | * |
| 22 | * @stability unstable |
| 23 | * @category constructors |
| 24 | * @since 4.0.0 |
| 25 | */ |
| 26 | export const make: (shouldQuit?: (input: UserInput) => boolean) => Effect<Terminal, never, Scope> = NodeTerminal.make |
| 27 | |
| 28 | /** |
| 29 | * Provides the default process-backed `Terminal` service, ending key input on |
| 30 | * bare Esc, Ctrl+C, or Ctrl+D. |
| 31 | * |
| 32 | * @stability unstable |
| 33 | * @category layers |
| 34 | * @since 4.0.0 |
| 35 | */ |
| 36 | export const layer: Layer<Terminal> = NodeTerminal.layer |