@x-otto/tui 0.0.1-alpha.2 → 0.0.1-alpha.20
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/README.md +76 -73
- package/dist/{Tabable-DDNOHe29.d.ts → Tabable-Mq_qCBz2.d.ts} +201 -52
- package/dist/Tabable-Mq_qCBz2.d.ts.map +1 -0
- package/dist/WizardDialog--TXB-Kkg.js +12 -0
- package/dist/WizardDialog--TXB-Kkg.js.map +1 -0
- package/dist/compat.d.ts +5 -0
- package/dist/compat.d.ts.map +1 -1
- package/dist/compat.js +1 -1
- package/dist/compat.js.map +1 -1
- package/dist/i18n-C1EsVod7.js +76 -0
- package/dist/i18n-C1EsVod7.js.map +1 -0
- package/dist/index.d.ts +89 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +125 -78
- package/dist/index.js.map +1 -1
- package/dist/standalone.d.ts +21 -1
- package/dist/standalone.d.ts.map +1 -1
- package/dist/standalone.js +1 -1
- package/dist/standalone.js.map +1 -1
- package/package.json +8 -7
- package/dist/Tabable-DDNOHe29.d.ts.map +0 -1
- package/dist/WizardDialog-BG-t6UJT.js +0 -10
- package/dist/WizardDialog-BG-t6UJT.js.map +0 -1
- package/dist/i18n-Dju4J1Q-.js +0 -76
- package/dist/i18n-Dju4J1Q-.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# @x-otto/tui
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Module Purpose
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The terminal UI application layer: a React + Ink component tree that provides streaming Markdown rendering, permission dialogs, input stack, message flow, and the full terminal interaction experience. Built on the npm `ink` v7 rendering engine, with keybinding, theme, and fuzzy-search systems living in-package (`src/keybindings`, `src/theme`, `src/search`).
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Installation
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
pnpm add @x-otto/tui
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Quick Start
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { startTui } from '@x-otto/tui'
|
|
@@ -18,125 +18,128 @@ import { startTui } from '@x-otto/tui'
|
|
|
18
18
|
const tui = await startTui({
|
|
19
19
|
stdin: process.stdin,
|
|
20
20
|
stdout: process.stdout,
|
|
21
|
-
|
|
21
|
+
onSubmit: (text) => { /* send to agent */ },
|
|
22
22
|
})
|
|
23
23
|
|
|
24
|
-
tui.pushMessage({ role: 'assistant', content: 'Hello! I am otto.' })
|
|
25
|
-
tui.showToast('Task completed')
|
|
24
|
+
tui.messages.pushMessage({ role: 'assistant', content: 'Hello! I am otto.' })
|
|
25
|
+
tui.info.showToast('Task completed', 'Done')
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
tui.lifecycle.stop()
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
##
|
|
30
|
+
## Core Features
|
|
31
31
|
|
|
32
|
-
|
|
|
32
|
+
| Module | Function |
|
|
33
33
|
| --------------- | ------------------------------------------------------- |
|
|
34
|
-
| Store |
|
|
35
|
-
| Input |
|
|
36
|
-
| Messages |
|
|
37
|
-
| Dialogs |
|
|
38
|
-
| Components |
|
|
39
|
-
| Term |
|
|
40
|
-
| Theme |
|
|
41
|
-
| i18n |
|
|
42
|
-
| startTui |
|
|
43
|
-
| printMessages |
|
|
44
|
-
|
|
45
|
-
##
|
|
46
|
-
|
|
47
|
-
|
|
|
34
|
+
| Store | Application state management (zustand-driven, useAppState / makeStore) |
|
|
35
|
+
| Input | Input stack: Cursor model + InputBuffer + History + Typeahead |
|
|
36
|
+
| Messages | Message flow: stream commit/coalesce + QueryGuard + Collapse + Diff |
|
|
37
|
+
| Dialogs | Dialog arbitration: routed permission dialogs + Select state machine + dialog components |
|
|
38
|
+
| Components | Common components: App / Welcome / StatusBar / Spinner / Button / DataList |
|
|
39
|
+
| Term | Terminal primitives: BracketedPaste / OSC 8/52 / SyncFrame |
|
|
40
|
+
| Theme | Color palette + icon glyphs + spinner frames + theme preset registry |
|
|
41
|
+
| i18n | Internationalization (i18next + react-i18next, zh/en) |
|
|
42
|
+
| startTui | Production entry point: launches the TUI main loop from stdin/WebSocket |
|
|
43
|
+
| printMessages | Non-interactive print mode (backward compatibility) |
|
|
44
|
+
|
|
45
|
+
## Input Stack
|
|
46
|
+
|
|
47
|
+
| Component | Function |
|
|
48
48
|
| ------------------ | ----------------------------- |
|
|
49
|
-
|
|
|
50
|
-
| PromptInput |
|
|
51
|
-
|
|
|
52
|
-
| HistorySearchInput | 历史搜索输入 |
|
|
53
|
-
| QueuedCommands | 排队命令显示 |
|
|
49
|
+
| TextInput | Text input (cursor/edit/paste) |
|
|
50
|
+
| PromptInput | Main prompt input box |
|
|
51
|
+
| QueuedCommands | Queued command display |
|
|
54
52
|
|
|
55
|
-
##
|
|
53
|
+
## Message Rendering
|
|
56
54
|
|
|
57
|
-
|
|
|
55
|
+
| Component | Function |
|
|
58
56
|
| ------------------ | ----------------------------- |
|
|
59
|
-
| Message |
|
|
60
|
-
|
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
| ToolUseLoader | 工具调用加载动画 |
|
|
65
|
-
| REPLRegion | REPL 消息区域容器 |
|
|
57
|
+
| Message | Message container (role/collapse/branch) |
|
|
58
|
+
| REPLRegion | REPL message region container |
|
|
59
|
+
| renderMessageLines | Line-based message rendering (streaming-aware) |
|
|
60
|
+
| renderMarkdownToLines | Markdown → ANSI line rendering |
|
|
61
|
+
| preloadHighlighter / highlightBlock | Syntax-highlighted code blocks |
|
|
66
62
|
|
|
67
|
-
##
|
|
63
|
+
## Directory Overview
|
|
68
64
|
|
|
69
65
|
```
|
|
70
66
|
src/
|
|
71
|
-
types.ts
|
|
72
|
-
theme.ts
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
67
|
+
types.ts # TUI-local type stubs (no dependency on @x-otto/ai)
|
|
68
|
+
theme.ts # THEME / PALETTE / FIGURES / SPINNER_FRAMES
|
|
69
|
+
main.ts # production entry point (startTui)
|
|
70
|
+
compat.ts # backward-compatibility (legacy API shim)
|
|
71
|
+
index.ts # barrel export
|
|
72
|
+
stores/ # application state (zustand: message/stream/task/context/...)
|
|
73
|
+
term/ # terminal primitives (paste/keys/OSC/sync/scrollback)
|
|
74
|
+
input/ # input stack (Cursor/Buffer/History/Typeahead)
|
|
75
|
+
messages/ # message flow (commit/QueryGuard/Collapse/Diff)
|
|
76
|
+
dialogs/ # dialogs (Permission/Select/Confirm/Alert/...)
|
|
77
|
+
components/ # common components (App/Welcome/StatusBar/Spinner)
|
|
78
|
+
panes/ # side panes (Context/Task/Subagents/Sigil/Schedule/...)
|
|
79
|
+
router/ + routes/ # router-driven views & modal routes (FocusBus/Router/Tabable)
|
|
80
|
+
overlays/ # overlay components
|
|
81
|
+
status-bar/ # status bar widgets (provider usage badge, background tasks)
|
|
82
|
+
keybindings/ # keybinding parsing & overrides
|
|
83
|
+
history/ # shell history parsing (zsh/bash/fish)
|
|
84
|
+
search/ # fuzzy search
|
|
85
|
+
sigil/ # #/@ sigil input completion
|
|
86
|
+
bootstrap/ # TuiHandle/TuiOptions types + session data-source bridges
|
|
87
|
+
app/ # App shell assembly (input/dialog/panel/status regions)
|
|
88
|
+
tests/ # 385 test files
|
|
84
89
|
```
|
|
85
90
|
|
|
86
|
-
##
|
|
91
|
+
## Public Exports
|
|
87
92
|
|
|
88
93
|
```ts
|
|
89
|
-
//
|
|
90
|
-
export {
|
|
94
|
+
// State management
|
|
95
|
+
export { useAppState, makeStore }
|
|
91
96
|
export type { Store }
|
|
92
97
|
|
|
93
|
-
//
|
|
98
|
+
// Terminal primitives
|
|
94
99
|
export { BracketedPasteHandler, parseExtendedKey }
|
|
95
100
|
export { osc8Hyperlink, osc8FilePath, osc52Write, beginSyncFrame, endSyncFrame, withSyncFrame }
|
|
96
101
|
export { insertHistory, preWrapLine, displayWidth, guardScrollbackStdout }
|
|
97
102
|
|
|
98
|
-
//
|
|
103
|
+
// Input stack
|
|
99
104
|
export { Cursor, MeasuredText, stringWidth }
|
|
100
105
|
export { createInputBuffer, createInputHistory, createPasteStore }
|
|
101
106
|
export { createCommandRegistry, getCommandSuggestions, applySlashCompletion }
|
|
102
|
-
export { TextInput, PromptInput, QueuedCommands
|
|
107
|
+
export { TextInput, PromptInput, QueuedCommands }
|
|
103
108
|
export type { InputBuffer, BufferEntry }
|
|
104
109
|
|
|
105
|
-
//
|
|
106
|
-
export {
|
|
110
|
+
// Message flow
|
|
111
|
+
export { safeCommitBoundary, initStreamCommit, streamCommitStep, makeCoalescer }
|
|
107
112
|
export { createQueryGuard, collapseMessages, toggleCollapse, expandCollapsed }
|
|
108
|
-
export {
|
|
113
|
+
export { Message, REPLRegion }
|
|
114
|
+
export { renderMessageLines, renderMarkdownToLines, preloadHighlighter, highlightBlock }
|
|
109
115
|
export { registerPluginRenderers, clearPluginRenderers }
|
|
110
116
|
|
|
111
|
-
//
|
|
112
|
-
export {
|
|
117
|
+
// Dialogs
|
|
118
|
+
export { createSelectState }
|
|
113
119
|
export { Select, PermissionDialogDialog, BashPermissionDialog, ConfirmDialog, AlertDialog, PromptDialog, MemoryDialog }
|
|
114
120
|
|
|
115
|
-
//
|
|
121
|
+
// Components
|
|
116
122
|
export { App, Home, Spinner, Button, DataList }
|
|
117
123
|
export type { ButtonProps, ButtonVariant, ButtonColor, DataListProps }
|
|
118
124
|
|
|
119
|
-
//
|
|
125
|
+
// Theme
|
|
120
126
|
export { THEME, PALETTE, STATUS, FIGURES, SPACING, LAYOUT, DIALOG_BORDER, PANEL_BORDER }
|
|
121
127
|
export { ThemeRegistry, createBuiltinThemeRegistry }
|
|
122
128
|
export type { ThemePreset, ThemePresetInput, ThemePresetSelection, ThemeAppearance }
|
|
123
129
|
|
|
124
|
-
//
|
|
130
|
+
// Search
|
|
125
131
|
export { rankCandidates, rankNamedItems, rankLabeledItems, createIncrementalSearcher }
|
|
126
132
|
|
|
127
|
-
// Inspect
|
|
128
|
-
export { createInspectorStore, InspectorPane, buildEventTree, buildToolList }
|
|
129
|
-
|
|
130
133
|
// i18n
|
|
131
134
|
export { detectLanguage, t, i18next, initI18n }
|
|
132
135
|
export type { Lang, LangMode }
|
|
133
136
|
|
|
134
|
-
//
|
|
137
|
+
// Entry points
|
|
135
138
|
export { startTui }
|
|
136
139
|
export { printMessages }
|
|
137
140
|
```
|
|
138
141
|
|
|
139
|
-
##
|
|
142
|
+
## Development Commands
|
|
140
143
|
|
|
141
144
|
```bash
|
|
142
145
|
pnpm --filter @x-otto/tui build
|
|
@@ -145,6 +148,6 @@ pnpm --filter @x-otto/tui test
|
|
|
145
148
|
pnpm --filter @x-otto/tui clean
|
|
146
149
|
```
|
|
147
150
|
|
|
148
|
-
##
|
|
151
|
+
## Related Packages
|
|
149
152
|
|
|
150
|
-
`@x-otto/
|
|
153
|
+
`@x-otto/interchange`, `@x-otto/session-contract`, `@x-otto/shared`, `@x-otto/env`
|