@orkestrel/terminal 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +77 -0
- package/dist/src/core/index.cjs +1739 -0
- package/dist/src/core/index.cjs.map +1 -0
- package/dist/src/core/index.d.cts +1273 -0
- package/dist/src/core/index.d.ts +1273 -0
- package/dist/src/core/index.js +1651 -0
- package/dist/src/core/index.js.map +1 -0
- package/dist/src/server/index.cjs +478 -0
- package/dist/src/server/index.cjs.map +1 -0
- package/dist/src/server/index.d.cts +321 -0
- package/dist/src/server/index.d.ts +321 -0
- package/dist/src/server/index.js +458 -0
- package/dist/src/server/index.js.map +1 -0
- package/package.json +97 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Orkestrel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# @orkestrel/terminal
|
|
2
|
+
|
|
3
|
+
An interactive terminal-prompt toolkit for the `@orkestrel` line — six
|
|
4
|
+
prompt forms (`input`, `password`, `confirm`, `select`, `checkbox`,
|
|
5
|
+
`editor`) modelled as pure, event-free state machines, driven across three
|
|
6
|
+
symmetric surfaces: a headless `Prompt` broker that parks each call and
|
|
7
|
+
resolves it when answered, an SSE `PromptClient` bridge that dispatches a
|
|
8
|
+
remote prompt to a local terminal, and a raw-mode `Terminal` driver
|
|
9
|
+
(`node:readline` fallback when piped) that answers each prompt at this
|
|
10
|
+
machine's keyboard. Built to sit beside `@orkestrel/console` (the shared
|
|
11
|
+
style engine), `@orkestrel/contract`, `@orkestrel/emitter`, and
|
|
12
|
+
`@orkestrel/sse`, reusing all four as it takes shape.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install @orkestrel/terminal
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
|
|
22
|
+
- Node.js >= 24
|
|
23
|
+
- Core is ESM; the `./server` subpath ships dual ESM+CJS builds
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Park a prompt headlessly and answer it from elsewhere (an SSE transport, a
|
|
28
|
+
remote terminal):
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { createPrompt } from '@orkestrel/terminal'
|
|
32
|
+
|
|
33
|
+
const prompt = createPrompt()
|
|
34
|
+
prompt.emitter.on('pending', (pending) => send(pending)) // forward to a remote client
|
|
35
|
+
const name = await prompt.input({ message: 'Your name', validate: { required: true } })
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Drive the same six prompt forms locally at this machine's keyboard:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { createTerminal } from '@orkestrel/terminal/server'
|
|
42
|
+
|
|
43
|
+
const terminal = createTerminal()
|
|
44
|
+
const name = await terminal.input({ message: 'Your name' })
|
|
45
|
+
const proceed = await terminal.confirm({ message: 'Continue?', default: true })
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Bridge a remote broker's prompts to a local terminal over SSE:
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import { createPromptClient } from '@orkestrel/terminal'
|
|
52
|
+
import { createTerminal } from '@orkestrel/terminal/server'
|
|
53
|
+
|
|
54
|
+
const client = createPromptClient({
|
|
55
|
+
url: 'http://localhost:3000/prompts',
|
|
56
|
+
terminal: createTerminal(),
|
|
57
|
+
})
|
|
58
|
+
await client.connect()
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Guide
|
|
62
|
+
|
|
63
|
+
See [guides/src/terminal.md](./guides/src/terminal.md) for the full
|
|
64
|
+
documented surface — the six prompt forms, the headless broker, the SSE
|
|
65
|
+
bridge, and the raw-mode terminal driver.
|
|
66
|
+
|
|
67
|
+
## Package
|
|
68
|
+
|
|
69
|
+
Published as two entry points per the `exports` field in `package.json`:
|
|
70
|
+
`.` (the environment-agnostic core — the pure prompt reducers, the
|
|
71
|
+
`Prompt` broker, and the `PromptClient` bridge) and `./server` (the
|
|
72
|
+
Node-only `Terminal` driver). Core is ESM-only; `./server` ships dual
|
|
73
|
+
ESM+CJS builds.
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
MIT © [Orkestrel](https://github.com/orkestrel) — see [LICENSE](./LICENSE).
|