@x-otto/tui 0.0.1-alpha.8 → 0.1.0-alpha.9

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Module Purpose
4
4
 
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 and the `@x-otto/keybindings` keypress system.
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
 
@@ -18,23 +18,23 @@ import { startTui } from '@x-otto/tui'
18
18
  const tui = await startTui({
19
19
  stdin: process.stdin,
20
20
  stdout: process.stdout,
21
- onMessage: async (msg) => { /* send to agent */ },
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
- await tui.dispose()
27
+ tui.lifecycle.stop()
28
28
  ```
29
29
 
30
30
  ## Core Features
31
31
 
32
32
  | Module | Function |
33
33
  | --------------- | ------------------------------------------------------- |
34
- | Store | Application state management (zustand-driven, useAppState / createStore) |
34
+ | Store | Application state management (zustand-driven, useAppState / makeStore) |
35
35
  | Input | Input stack: Cursor model + InputBuffer + History + Typeahead |
36
- | Messages | Message flow: StreamState + QueryGuard + Collapse + Diff |
37
- | Dialogs | Dialog arbitration: permission queue + Select state machine + dialog components |
36
+ | Messages | Message flow: stream commit/coalesce + QueryGuard + Collapse + Diff |
37
+ | Dialogs | Dialog arbitration: routed permission dialogs + Select state machine + dialog components |
38
38
  | Components | Common components: App / Welcome / StatusBar / Spinner / Button / DataList |
39
39
  | Term | Terminal primitives: BracketedPaste / OSC 8/52 / SyncFrame |
40
40
  | Theme | Color palette + icon glyphs + spinner frames + theme preset registry |
@@ -46,10 +46,8 @@ await tui.dispose()
46
46
 
47
47
  | Component | Function |
48
48
  | ------------------ | ----------------------------- |
49
- | BaseTextInput | Base text input (cursor/edit/paste) |
49
+ | TextInput | Text input (cursor/edit/paste) |
50
50
  | PromptInput | Main prompt input box |
51
- | PromptInputFooter | Input box status footer |
52
- | HistorySearchInput | History search input |
53
51
  | QueuedCommands | Queued command display |
54
52
 
55
53
  ## Message Rendering
@@ -57,37 +55,44 @@ await tui.dispose()
57
55
  | Component | Function |
58
56
  | ------------------ | ----------------------------- |
59
57
  | Message | Message container (role/collapse/branch) |
60
- | Markdown | Static Markdown rendering |
61
- | StreamingMarkdown | Streaming Markdown rendering (flicker-free) |
62
- | StructuredDiff | Structured diff rendering |
63
- | HighlightedCode | Syntax-highlighted code blocks |
64
- | ToolUseLoader | Tool call loading animation |
65
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 # TUI-local type stubs (no dependency on @x-otto/ai)
72
- theme.ts # THEME / PALETTE / FIGURES / SPINNER_FRAMES
73
- startTui.tsx # production entry point
74
- print-messages.ts # print mode
75
- compat.ts # backward-compatibility (legacy API shim)
76
- index.ts # barrel export
77
- store/ # application state management
78
- term/ # terminal primitives (paste/keys/OSC)
79
- input/ # input stack (Cursor/Buffer/History/Typeahead)
80
- messages/ # message flow (Stream/QueryGuard/Collapse/Diff)
81
- dialogs/ # dialogs (Permission/Select/Arbiter)
82
- components/ # common components (App/Welcome/StatusBar/Spinner)
83
- tests/ # 20 test files
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
94
  // State management
90
- export { createStore, useAppState }
95
+ export { useAppState, makeStore }
91
96
  export type { Store }
92
97
 
93
98
  // Terminal primitives
@@ -99,17 +104,18 @@ export { insertHistory, preWrapLine, displayWidth, guardScrollbackStdout }
99
104
  export { Cursor, MeasuredText, stringWidth }
100
105
  export { createInputBuffer, createInputHistory, createPasteStore }
101
106
  export { createCommandRegistry, getCommandSuggestions, applySlashCompletion }
102
- export { TextInput, PromptInput, QueuedCommands, HistorySearchInput }
107
+ export { TextInput, PromptInput, QueuedCommands }
103
108
  export type { InputBuffer, BufferEntry }
104
109
 
105
110
  // Message flow
106
- export { createStreamState, reduceStreamEvent, reduceStreamEvents }
111
+ export { safeCommitBoundary, initStreamCommit, streamCommitStep, makeCoalescer }
107
112
  export { createQueryGuard, collapseMessages, toggleCollapse, expandCollapsed }
108
- export { Markdown, Message, REPLRegion, StructuredDiff, ToolUseLoader, StreamingMarkdown }
113
+ export { Message, REPLRegion }
114
+ export { renderMessageLines, renderMarkdownToLines, preloadHighlighter, highlightBlock }
109
115
  export { registerPluginRenderers, clearPluginRenderers }
110
116
 
111
117
  // Dialogs
112
- export { createDialogArbiter, createPermissionQueue, createSelectState }
118
+ export { createSelectState }
113
119
  export { Select, PermissionDialogDialog, BashPermissionDialog, ConfirmDialog, AlertDialog, PromptDialog, MemoryDialog }
114
120
 
115
121
  // Components
@@ -124,9 +130,6 @@ export type { ThemePreset, ThemePresetInput, ThemePresetSelection, ThemeAppearan
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 }
@@ -147,4 +150,4 @@ pnpm --filter @x-otto/tui clean
147
150
 
148
151
  ## Related Packages
149
152
 
150
- `@x-otto/keybindings`
153
+ `@x-otto/interchange`, `@x-otto/session-contract`, `@x-otto/shared`, `@x-otto/env`