@vybestack/llxprt-ui 0.7.0-nightly.251211.5750c518a
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/PLAN-messages.md +681 -0
- package/PLAN.md +47 -0
- package/README.md +25 -0
- package/bun.lock +1024 -0
- package/dev-docs/ARCHITECTURE.md +178 -0
- package/dev-docs/CODE_ORGANIZATION.md +232 -0
- package/dev-docs/STANDARDS.md +235 -0
- package/dev-docs/UI_DESIGN.md +425 -0
- package/eslint.config.cjs +194 -0
- package/images/nui.png +0 -0
- package/llxprt.png +0 -0
- package/llxprt.svg +128 -0
- package/package.json +66 -0
- package/scripts/check-limits.ts +177 -0
- package/scripts/start.js +71 -0
- package/src/app.tsx +599 -0
- package/src/bootstrap.tsx +23 -0
- package/src/commands/AuthCommand.tsx +80 -0
- package/src/commands/ModelCommand.tsx +102 -0
- package/src/commands/ProviderCommand.tsx +103 -0
- package/src/commands/ThemeCommand.tsx +71 -0
- package/src/features/chat/history.ts +178 -0
- package/src/features/chat/index.ts +3 -0
- package/src/features/chat/persistentHistory.ts +102 -0
- package/src/features/chat/responder.ts +217 -0
- package/src/features/completion/completions.ts +161 -0
- package/src/features/completion/index.ts +3 -0
- package/src/features/completion/slash.test.ts +82 -0
- package/src/features/completion/slash.ts +248 -0
- package/src/features/completion/suggestions.test.ts +51 -0
- package/src/features/completion/suggestions.ts +112 -0
- package/src/features/config/configSession.test.ts +189 -0
- package/src/features/config/configSession.ts +179 -0
- package/src/features/config/index.ts +4 -0
- package/src/features/config/llxprtAdapter.integration.test.ts +202 -0
- package/src/features/config/llxprtAdapter.test.ts +139 -0
- package/src/features/config/llxprtAdapter.ts +257 -0
- package/src/features/config/llxprtCommands.test.ts +40 -0
- package/src/features/config/llxprtCommands.ts +35 -0
- package/src/features/config/llxprtConfig.test.ts +261 -0
- package/src/features/config/llxprtConfig.ts +418 -0
- package/src/features/theme/index.ts +2 -0
- package/src/features/theme/theme.test.ts +51 -0
- package/src/features/theme/theme.ts +105 -0
- package/src/features/theme/themeManager.ts +84 -0
- package/src/hooks/useAppCommands.ts +129 -0
- package/src/hooks/useApprovalKeyboard.ts +156 -0
- package/src/hooks/useChatStore.test.ts +112 -0
- package/src/hooks/useChatStore.ts +252 -0
- package/src/hooks/useInputManager.ts +99 -0
- package/src/hooks/useKeyboardHandlers.ts +130 -0
- package/src/hooks/useListNavigation.test.ts +166 -0
- package/src/hooks/useListNavigation.ts +62 -0
- package/src/hooks/usePersistentHistory.ts +94 -0
- package/src/hooks/useScrollManagement.ts +107 -0
- package/src/hooks/useSelectionClipboard.ts +48 -0
- package/src/hooks/useSessionManager.test.ts +85 -0
- package/src/hooks/useSessionManager.ts +101 -0
- package/src/hooks/useStreamingLifecycle.ts +71 -0
- package/src/hooks/useStreamingResponder.ts +401 -0
- package/src/hooks/useSuggestionSetup.ts +23 -0
- package/src/hooks/useToolApproval.test.ts +140 -0
- package/src/hooks/useToolApproval.ts +264 -0
- package/src/hooks/useToolScheduler.ts +432 -0
- package/src/index.ts +3 -0
- package/src/jsx.d.ts +11 -0
- package/src/lib/clipboard.ts +18 -0
- package/src/lib/logger.ts +107 -0
- package/src/lib/random.ts +5 -0
- package/src/main.tsx +13 -0
- package/src/test/mockTheme.ts +51 -0
- package/src/types/events.ts +87 -0
- package/src/types.ts +13 -0
- package/src/ui/components/ChatLayout.tsx +694 -0
- package/src/ui/components/CommandComponents.tsx +74 -0
- package/src/ui/components/DiffViewer.tsx +306 -0
- package/src/ui/components/FilterInput.test.ts +69 -0
- package/src/ui/components/FilterInput.tsx +62 -0
- package/src/ui/components/HeaderBar.tsx +137 -0
- package/src/ui/components/RadioSelect.test.ts +140 -0
- package/src/ui/components/RadioSelect.tsx +88 -0
- package/src/ui/components/SelectableList.test.ts +83 -0
- package/src/ui/components/SelectableList.tsx +35 -0
- package/src/ui/components/StatusBar.tsx +45 -0
- package/src/ui/components/SuggestionPanel.tsx +102 -0
- package/src/ui/components/messages/ModelMessage.tsx +14 -0
- package/src/ui/components/messages/SystemMessage.tsx +29 -0
- package/src/ui/components/messages/ThinkingMessage.tsx +14 -0
- package/src/ui/components/messages/UserMessage.tsx +26 -0
- package/src/ui/components/messages/index.ts +15 -0
- package/src/ui/components/messages/renderMessage.test.ts +49 -0
- package/src/ui/components/messages/renderMessage.tsx +43 -0
- package/src/ui/components/messages/types.test.ts +24 -0
- package/src/ui/components/messages/types.ts +36 -0
- package/src/ui/modals/AuthModal.tsx +106 -0
- package/src/ui/modals/ModalShell.tsx +60 -0
- package/src/ui/modals/SearchSelectModal.tsx +236 -0
- package/src/ui/modals/ThemeModal.tsx +204 -0
- package/src/ui/modals/ToolApprovalModal.test.ts +206 -0
- package/src/ui/modals/ToolApprovalModal.tsx +282 -0
- package/src/ui/modals/index.ts +20 -0
- package/src/ui/modals/modals.test.ts +26 -0
- package/src/ui/modals/types.ts +19 -0
- package/src/uicontext/Command.tsx +102 -0
- package/src/uicontext/Dialog.tsx +65 -0
- package/src/uicontext/index.ts +2 -0
- package/themes/ansi-light.json +59 -0
- package/themes/ansi.json +59 -0
- package/themes/atom-one-dark.json +59 -0
- package/themes/ayu-light.json +59 -0
- package/themes/ayu.json +59 -0
- package/themes/default-light.json +59 -0
- package/themes/default.json +59 -0
- package/themes/dracula.json +59 -0
- package/themes/github-dark.json +59 -0
- package/themes/github-light.json +59 -0
- package/themes/googlecode.json +59 -0
- package/themes/green-screen.json +59 -0
- package/themes/no-color.json +59 -0
- package/themes/shades-of-purple.json +59 -0
- package/themes/xcode.json +59 -0
- package/tsconfig.json +28 -0
- package/vitest.config.ts +10 -0
package/PLAN.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Plan: OpenTUI Chat Interface
|
|
2
|
+
|
|
3
|
+
## Goals
|
|
4
|
+
|
|
5
|
+
- Build a terminal chat UI using **OpenTUI React** (React flavor only) with four bands: Header (1–5 lines), Scrollback (dominant), Input (multiline 1–10 lines), Status (1–3 lines).
|
|
6
|
+
- Support streaming responses into scrollback; user can scroll during/after streaming without the viewport snapping.
|
|
7
|
+
- Echo user input into scrollback, then clear input; trigger mock streaming responder emitting 5–800 philosophical lines (existential/nihilistic/hedonistic/Camus/Nietzsche).
|
|
8
|
+
- Default header text: `New UI Demo 20251204`.
|
|
9
|
+
|
|
10
|
+
## Constraints & Quality Gates
|
|
11
|
+
|
|
12
|
+
- Strong typing; no `any`; no lint/ts-ignore comments or rule disables.
|
|
13
|
+
- Lint with strict TypeScript config; enforce rule for no-disable comments.
|
|
14
|
+
- Complexity/size thresholds:
|
|
15
|
+
- Cyclomatic (or similar): warn >15, error >30.
|
|
16
|
+
- File length: warn >800 lines, error >1200 lines.
|
|
17
|
+
- Function length: warn >80 lines, error >120 lines.
|
|
18
|
+
|
|
19
|
+
## Layout & Interaction
|
|
20
|
+
|
|
21
|
+
- Vertical layout: Header (top, fixed height within 1–5 lines, default text `New UI Demo 20251204`), Scrollback (fills remaining space), Input (bottom, grows up to 10 lines), Status (bottom-most or just below input within 1–3 lines).
|
|
22
|
+
- Scrollback view keeps a viewport offset; when user scrolls up, new stream lines append but viewport stays put until user jumps to bottom.
|
|
23
|
+
- Keybinds: scroll up/down, page up/down, jump to bottom, submit input; optional scroll-lock indicator in status.
|
|
24
|
+
|
|
25
|
+
## State Model
|
|
26
|
+
|
|
27
|
+
- Messages: role (user/system/stream), content as lines, timestamp, streaming flag.
|
|
28
|
+
- Scrollback: list of messages/lines, viewport offset, auto-follow boolean.
|
|
29
|
+
- Input: text buffer, cursor, line clamp to 1–10.
|
|
30
|
+
- Status: stream state (idle/streaming/done), scroll-lock indicator, prompt count (user submissions), responder word count, streaming vs waiting label.
|
|
31
|
+
|
|
32
|
+
## Implementation Steps
|
|
33
|
+
|
|
34
|
+
1. **Project setup**: initialize TypeScript OpenTUI React app; add strict tsconfig; add ESLint with no-disable enforcement and no-`any` rules; add scripts for lint/test. Configure complexity/file/function length rules to match thresholds.
|
|
35
|
+
2. **UI scaffold**: build OpenTUI layout with the four regions and sizing priorities; apply simple theme/colors; set default header text to `New UI Demo 20251204`.
|
|
36
|
+
3. **Input handling**: multiline input capture with submit; clamp to 1–10 lines; on submit, append user message to scrollback and clear buffer.
|
|
37
|
+
4. **Scrollback & viewport**: data structure to append lines/messages; render window based on viewport offset; auto-follow when at bottom; preserve viewport when user scrolls during streaming.
|
|
38
|
+
5. **Streaming mock**: generator producing 5–800 themed lines with small delays; append incrementally to scrollback; mark completion and update status.
|
|
39
|
+
6. **Status bar**: display stream state (streaming/waiting), scroll-lock indicator, prompt count, responder word count, and hints.
|
|
40
|
+
7. **Controls & UX**: keybinds for scroll/page, jump-to-bottom, submit; ensure redraws do not override manual scroll positions.
|
|
41
|
+
8. **Testing & checks**: add unit/interaction tests for input submission, streaming append, scroll-lock behavior, and status updates; run lint/complexity/size checks.
|
|
42
|
+
|
|
43
|
+
## Risks & Notes
|
|
44
|
+
|
|
45
|
+
- Keep functions/files within limits; refactor early to avoid threshold violations.
|
|
46
|
+
- Ensure streaming and scrollback updates are non-blocking to prevent UI freezes.
|
|
47
|
+
- No alternate UI libs; stay within OpenTUI primitives.\*\*\*
|
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# LLxprt Code – New UI Prototype
|
|
2
|
+
|
|
3
|
+
This repo is a prototype terminal UI for LLxprt Code built with OpenTUI (React). It exercises streaming chat, slash menu tooling, completions, modal dialogs, theming, and mock tool-call rendering so we can harden the experience before folding it into the main product.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Highlights
|
|
8
|
+
|
|
9
|
+
- Chat layout: header, scrollback, multi-line input, status bar; streaming responses, thinking lines, and mock tool calls (batch + streaming) with scrollable tool output.
|
|
10
|
+
- Slash/`@` completions: file fake service, slash commands with multi-level parameters, history navigation, and /theme dialog with theme previews (Green Screen and other LLxprt themes).
|
|
11
|
+
- Modals: reusable shell plus search/select dialogs for models/providers/themes and OAuth toggle dialog.
|
|
12
|
+
- Input ergonomics: Enter submits, modifier+Enter for newline, numpad Enter support, ESC to cancel stream or clear input, selection clipboard support.
|
|
13
|
+
- Theming: all colors pulled from JSON themes; Green Screen theme matches LLxprt’s retro palette.
|
|
14
|
+
- Header: OpenTUI image rendering support (kitty/iTerm2) for the LLxprt logo alongside title text.
|
|
15
|
+
|
|
16
|
+
## Running
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install
|
|
20
|
+
npm start # uses bun run src/main.tsx
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Notes
|
|
24
|
+
|
|
25
|
+
- Requires a terminal with OpenTUI graphics support (tested on iTerm2/kitty) for the logo image; falls back to text where images aren't supported.
|