centaurus-cli 2.0.0
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/AUTH_FLOW.md +138 -0
- package/CONFIG_GUIDE.md +255 -0
- package/LICENSE +21 -0
- package/README.md +346 -0
- package/dist/ai/provider-factory.d.ts +6 -0
- package/dist/ai/provider-factory.d.ts.map +1 -0
- package/dist/ai/provider-factory.js +27 -0
- package/dist/ai/provider-factory.js.map +1 -0
- package/dist/ai/providers/base.d.ts +25 -0
- package/dist/ai/providers/base.d.ts.map +1 -0
- package/dist/ai/providers/base.js +9 -0
- package/dist/ai/providers/base.js.map +1 -0
- package/dist/ai/providers/gemini.d.ts +34 -0
- package/dist/ai/providers/gemini.d.ts.map +1 -0
- package/dist/ai/providers/gemini.js +146 -0
- package/dist/ai/providers/gemini.js.map +1 -0
- package/dist/ai/types.d.ts +20 -0
- package/dist/ai/types.d.ts.map +1 -0
- package/dist/ai/types.js +2 -0
- package/dist/ai/types.js.map +1 -0
- package/dist/cli-adapter.d.ts +78 -0
- package/dist/cli-adapter.d.ts.map +1 -0
- package/dist/cli-adapter.js +605 -0
- package/dist/cli-adapter.js.map +1 -0
- package/dist/commands/CommandParser.d.ts +27 -0
- package/dist/commands/CommandParser.d.ts.map +1 -0
- package/dist/commands/CommandParser.js +238 -0
- package/dist/commands/CommandParser.js.map +1 -0
- package/dist/config/ConfigManager.d.ts +59 -0
- package/dist/config/ConfigManager.d.ts.map +1 -0
- package/dist/config/ConfigManager.js +332 -0
- package/dist/config/ConfigManager.js.map +1 -0
- package/dist/config/defaultConfig.d.ts +82 -0
- package/dist/config/defaultConfig.d.ts.map +1 -0
- package/dist/config/defaultConfig.js +88 -0
- package/dist/config/defaultConfig.js.map +1 -0
- package/dist/config/manager.d.ts +60 -0
- package/dist/config/manager.d.ts.map +1 -0
- package/dist/config/manager.js +162 -0
- package/dist/config/manager.js.map +1 -0
- package/dist/config/types.d.ts +9 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +6 -0
- package/dist/config/types.js.map +1 -0
- package/dist/index-custom.d.ts +3 -0
- package/dist/index-custom.d.ts.map +1 -0
- package/dist/index-custom.js +65 -0
- package/dist/index-custom.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +102 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/system-prompt.d.ts +47 -0
- package/dist/prompts/system-prompt.d.ts.map +1 -0
- package/dist/prompts/system-prompt.js +378 -0
- package/dist/prompts/system-prompt.js.map +1 -0
- package/dist/providers/GoogleProvider.d.ts +26 -0
- package/dist/providers/GoogleProvider.d.ts.map +1 -0
- package/dist/providers/GoogleProvider.js +313 -0
- package/dist/providers/GoogleProvider.js.map +1 -0
- package/dist/providers/Provider.d.ts +114 -0
- package/dist/providers/Provider.d.ts.map +1 -0
- package/dist/providers/Provider.js +44 -0
- package/dist/providers/Provider.js.map +1 -0
- package/dist/services/api-client.d.ts +282 -0
- package/dist/services/api-client.d.ts.map +1 -0
- package/dist/services/api-client.js +339 -0
- package/dist/services/api-client.js.map +1 -0
- package/dist/services/auth-handler.d.ts +30 -0
- package/dist/services/auth-handler.d.ts.map +1 -0
- package/dist/services/auth-handler.js +210 -0
- package/dist/services/auth-handler.js.map +1 -0
- package/dist/services/conversation-manager.d.ts +73 -0
- package/dist/services/conversation-manager.d.ts.map +1 -0
- package/dist/services/conversation-manager.js +128 -0
- package/dist/services/conversation-manager.js.map +1 -0
- package/dist/tests/automated-verification.d.ts +27 -0
- package/dist/tests/automated-verification.d.ts.map +1 -0
- package/dist/tests/automated-verification.js +359 -0
- package/dist/tests/automated-verification.js.map +1 -0
- package/dist/tests/integration-tests.d.ts +50 -0
- package/dist/tests/integration-tests.d.ts.map +1 -0
- package/dist/tests/integration-tests.js +648 -0
- package/dist/tests/integration-tests.js.map +1 -0
- package/dist/tools/ToolRegistry.d.ts +44 -0
- package/dist/tools/ToolRegistry.d.ts.map +1 -0
- package/dist/tools/ToolRegistry.js +494 -0
- package/dist/tools/ToolRegistry.js.map +1 -0
- package/dist/tools/command.d.ts +4 -0
- package/dist/tools/command.d.ts.map +1 -0
- package/dist/tools/command.js +117 -0
- package/dist/tools/command.js.map +1 -0
- package/dist/tools/file-ops-test.d.ts +6 -0
- package/dist/tools/file-ops-test.d.ts.map +1 -0
- package/dist/tools/file-ops-test.js +197 -0
- package/dist/tools/file-ops-test.js.map +1 -0
- package/dist/tools/file-ops.d.ts +6 -0
- package/dist/tools/file-ops.d.ts.map +1 -0
- package/dist/tools/file-ops.js +189 -0
- package/dist/tools/file-ops.js.map +1 -0
- package/dist/tools/plan-mode.d.ts +53 -0
- package/dist/tools/plan-mode.d.ts.map +1 -0
- package/dist/tools/plan-mode.js +202 -0
- package/dist/tools/plan-mode.js.map +1 -0
- package/dist/tools/registry.d.ts +30 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +67 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/types.d.ts +34 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/web-search.d.ts +24 -0
- package/dist/tools/web-search.d.ts.map +1 -0
- package/dist/tools/web-search.js +194 -0
- package/dist/tools/web-search.js.map +1 -0
- package/dist/types/index.d.ts +32 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ui/DisplayHistory.d.ts +53 -0
- package/dist/ui/DisplayHistory.d.ts.map +1 -0
- package/dist/ui/DisplayHistory.js +82 -0
- package/dist/ui/DisplayHistory.js.map +1 -0
- package/dist/ui/clack-ui.d.ts +83 -0
- package/dist/ui/clack-ui.d.ts.map +1 -0
- package/dist/ui/clack-ui.js +304 -0
- package/dist/ui/clack-ui.js.map +1 -0
- package/dist/ui/components/App.d.ts +47 -0
- package/dist/ui/components/App.d.ts.map +1 -0
- package/dist/ui/components/App.js +389 -0
- package/dist/ui/components/App.js.map +1 -0
- package/dist/ui/components/AuthScreen.d.ts +8 -0
- package/dist/ui/components/AuthScreen.d.ts.map +1 -0
- package/dist/ui/components/AuthScreen.js +37 -0
- package/dist/ui/components/AuthScreen.js.map +1 -0
- package/dist/ui/components/AuthWelcomeScreen.d.ts +8 -0
- package/dist/ui/components/AuthWelcomeScreen.d.ts.map +1 -0
- package/dist/ui/components/AuthWelcomeScreen.js +34 -0
- package/dist/ui/components/AuthWelcomeScreen.js.map +1 -0
- package/dist/ui/components/CodeBlock.d.ts +9 -0
- package/dist/ui/components/CodeBlock.d.ts.map +1 -0
- package/dist/ui/components/CodeBlock.js +22 -0
- package/dist/ui/components/CodeBlock.js.map +1 -0
- package/dist/ui/components/ConfigViewer.d.ts +11 -0
- package/dist/ui/components/ConfigViewer.d.ts.map +1 -0
- package/dist/ui/components/ConfigViewer.js +27 -0
- package/dist/ui/components/ConfigViewer.js.map +1 -0
- package/dist/ui/components/ConfirmPrompt.d.ts +11 -0
- package/dist/ui/components/ConfirmPrompt.d.ts.map +1 -0
- package/dist/ui/components/ConfirmPrompt.js +55 -0
- package/dist/ui/components/ConfirmPrompt.js.map +1 -0
- package/dist/ui/components/DiffViewer.d.ts +8 -0
- package/dist/ui/components/DiffViewer.d.ts.map +1 -0
- package/dist/ui/components/DiffViewer.js +63 -0
- package/dist/ui/components/DiffViewer.js.map +1 -0
- package/dist/ui/components/DisplayItemRenderer.d.ts +18 -0
- package/dist/ui/components/DisplayItemRenderer.d.ts.map +1 -0
- package/dist/ui/components/DisplayItemRenderer.js +53 -0
- package/dist/ui/components/DisplayItemRenderer.js.map +1 -0
- package/dist/ui/components/DynamicMessage.d.ts +13 -0
- package/dist/ui/components/DynamicMessage.d.ts.map +1 -0
- package/dist/ui/components/DynamicMessage.js +27 -0
- package/dist/ui/components/DynamicMessage.js.map +1 -0
- package/dist/ui/components/ErrorBoundary.d.ts +16 -0
- package/dist/ui/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/ui/components/ErrorBoundary.js +25 -0
- package/dist/ui/components/ErrorBoundary.js.map +1 -0
- package/dist/ui/components/FileOperation.d.ts +10 -0
- package/dist/ui/components/FileOperation.d.ts.map +1 -0
- package/dist/ui/components/FileOperation.js +31 -0
- package/dist/ui/components/FileOperation.js.map +1 -0
- package/dist/ui/components/InputBox.d.ts +12 -0
- package/dist/ui/components/InputBox.d.ts.map +1 -0
- package/dist/ui/components/InputBox.js +50 -0
- package/dist/ui/components/InputBox.js.map +1 -0
- package/dist/ui/components/KeyboardHelp.d.ts +7 -0
- package/dist/ui/components/KeyboardHelp.d.ts.map +1 -0
- package/dist/ui/components/KeyboardHelp.js +25 -0
- package/dist/ui/components/KeyboardHelp.js.map +1 -0
- package/dist/ui/components/LoadingIndicator.d.ts +3 -0
- package/dist/ui/components/LoadingIndicator.d.ts.map +1 -0
- package/dist/ui/components/LoadingIndicator.js +25 -0
- package/dist/ui/components/LoadingIndicator.js.map +1 -0
- package/dist/ui/components/MarkdownRenderer.d.ts +8 -0
- package/dist/ui/components/MarkdownRenderer.d.ts.map +1 -0
- package/dist/ui/components/MarkdownRenderer.js +96 -0
- package/dist/ui/components/MarkdownRenderer.js.map +1 -0
- package/dist/ui/components/MessageBox.d.ts +10 -0
- package/dist/ui/components/MessageBox.d.ts.map +1 -0
- package/dist/ui/components/MessageBox.js +50 -0
- package/dist/ui/components/MessageBox.js.map +1 -0
- package/dist/ui/components/MessageDisplay.d.ts +8 -0
- package/dist/ui/components/MessageDisplay.d.ts.map +1 -0
- package/dist/ui/components/MessageDisplay.js +43 -0
- package/dist/ui/components/MessageDisplay.js.map +1 -0
- package/dist/ui/components/ScrollableContent.d.ts +7 -0
- package/dist/ui/components/ScrollableContent.d.ts.map +1 -0
- package/dist/ui/components/ScrollableContent.js +6 -0
- package/dist/ui/components/ScrollableContent.js.map +1 -0
- package/dist/ui/components/ScrollableMessageList.d.ts +10 -0
- package/dist/ui/components/ScrollableMessageList.d.ts.map +1 -0
- package/dist/ui/components/ScrollableMessageList.js +133 -0
- package/dist/ui/components/ScrollableMessageList.js.map +1 -0
- package/dist/ui/components/ScrollableScreen.d.ts +9 -0
- package/dist/ui/components/ScrollableScreen.d.ts.map +1 -0
- package/dist/ui/components/ScrollableScreen.js +22 -0
- package/dist/ui/components/ScrollableScreen.js.map +1 -0
- package/dist/ui/components/SelectPrompt.d.ts +12 -0
- package/dist/ui/components/SelectPrompt.d.ts.map +1 -0
- package/dist/ui/components/SelectPrompt.js +10 -0
- package/dist/ui/components/SelectPrompt.js.map +1 -0
- package/dist/ui/components/StaticMessageHistory.d.ts +14 -0
- package/dist/ui/components/StaticMessageHistory.d.ts.map +1 -0
- package/dist/ui/components/StaticMessageHistory.js +19 -0
- package/dist/ui/components/StaticMessageHistory.js.map +1 -0
- package/dist/ui/components/StatusBar.d.ts +10 -0
- package/dist/ui/components/StatusBar.d.ts.map +1 -0
- package/dist/ui/components/StatusBar.js +20 -0
- package/dist/ui/components/StatusBar.js.map +1 -0
- package/dist/ui/components/StreamingMessageDisplay.d.ts +13 -0
- package/dist/ui/components/StreamingMessageDisplay.d.ts.map +1 -0
- package/dist/ui/components/StreamingMessageDisplay.js +26 -0
- package/dist/ui/components/StreamingMessageDisplay.js.map +1 -0
- package/dist/ui/components/ToolExecutionMessage.d.ts +8 -0
- package/dist/ui/components/ToolExecutionMessage.d.ts.map +1 -0
- package/dist/ui/components/ToolExecutionMessage.js +189 -0
- package/dist/ui/components/ToolExecutionMessage.js.map +1 -0
- package/dist/ui/components/ToolExecutionStatus.d.ts +10 -0
- package/dist/ui/components/ToolExecutionStatus.d.ts.map +1 -0
- package/dist/ui/components/ToolExecutionStatus.js +65 -0
- package/dist/ui/components/ToolExecutionStatus.js.map +1 -0
- package/dist/ui/components/ToolResult.d.ts +10 -0
- package/dist/ui/components/ToolResult.d.ts.map +1 -0
- package/dist/ui/components/ToolResult.js +17 -0
- package/dist/ui/components/ToolResult.js.map +1 -0
- package/dist/ui/components/WelcomeBanner.d.ts +3 -0
- package/dist/ui/components/WelcomeBanner.d.ts.map +1 -0
- package/dist/ui/components/WelcomeBanner.js +28 -0
- package/dist/ui/components/WelcomeBanner.js.map +1 -0
- package/dist/ui/components/code-block.d.ts +10 -0
- package/dist/ui/components/code-block.d.ts.map +1 -0
- package/dist/ui/components/code-block.js +74 -0
- package/dist/ui/components/code-block.js.map +1 -0
- package/dist/ui/components/confirm-prompt.d.ts +12 -0
- package/dist/ui/components/confirm-prompt.d.ts.map +1 -0
- package/dist/ui/components/confirm-prompt.js +104 -0
- package/dist/ui/components/confirm-prompt.js.map +1 -0
- package/dist/ui/components/diff-viewer.d.ts +9 -0
- package/dist/ui/components/diff-viewer.d.ts.map +1 -0
- package/dist/ui/components/diff-viewer.js +57 -0
- package/dist/ui/components/diff-viewer.js.map +1 -0
- package/dist/ui/components/input-box.d.ts +18 -0
- package/dist/ui/components/input-box.d.ts.map +1 -0
- package/dist/ui/components/input-box.js +157 -0
- package/dist/ui/components/input-box.js.map +1 -0
- package/dist/ui/components/keyboard-help.d.ts +7 -0
- package/dist/ui/components/keyboard-help.d.ts.map +1 -0
- package/dist/ui/components/keyboard-help.js +43 -0
- package/dist/ui/components/keyboard-help.js.map +1 -0
- package/dist/ui/components/loading-indicator.d.ts +3 -0
- package/dist/ui/components/loading-indicator.d.ts.map +1 -0
- package/dist/ui/components/loading-indicator.js +42 -0
- package/dist/ui/components/loading-indicator.js.map +1 -0
- package/dist/ui/components/message-display.d.ts +7 -0
- package/dist/ui/components/message-display.d.ts.map +1 -0
- package/dist/ui/components/message-display.js +104 -0
- package/dist/ui/components/message-display.js.map +1 -0
- package/dist/ui/components/misc.d.ts +28 -0
- package/dist/ui/components/misc.d.ts.map +1 -0
- package/dist/ui/components/misc.js +128 -0
- package/dist/ui/components/misc.js.map +1 -0
- package/dist/ui/components/select-prompt.d.ts +13 -0
- package/dist/ui/components/select-prompt.d.ts.map +1 -0
- package/dist/ui/components/select-prompt.js +42 -0
- package/dist/ui/components/select-prompt.js.map +1 -0
- package/dist/ui/components/status-bar.d.ts +11 -0
- package/dist/ui/components/status-bar.d.ts.map +1 -0
- package/dist/ui/components/status-bar.js +47 -0
- package/dist/ui/components/status-bar.js.map +1 -0
- package/dist/ui/components/tool-execution.d.ts +3 -0
- package/dist/ui/components/tool-execution.d.ts.map +1 -0
- package/dist/ui/components/tool-execution.js +374 -0
- package/dist/ui/components/tool-execution.js.map +1 -0
- package/dist/ui/components/tool-result.d.ts +11 -0
- package/dist/ui/components/tool-result.d.ts.map +1 -0
- package/dist/ui/components/tool-result.js +58 -0
- package/dist/ui/components/tool-result.js.map +1 -0
- package/dist/ui/components/welcome-banner.d.ts +3 -0
- package/dist/ui/components/welcome-banner.d.ts.map +1 -0
- package/dist/ui/components/welcome-banner.js +46 -0
- package/dist/ui/components/welcome-banner.js.map +1 -0
- package/dist/ui/hooks/useDisplayHistory.d.ts +13 -0
- package/dist/ui/hooks/useDisplayHistory.d.ts.map +1 -0
- package/dist/ui/hooks/useDisplayHistory.js +45 -0
- package/dist/ui/hooks/useDisplayHistory.js.map +1 -0
- package/dist/ui/render-engine.d.ts +69 -0
- package/dist/ui/render-engine.d.ts.map +1 -0
- package/dist/ui/render-engine.js +197 -0
- package/dist/ui/render-engine.js.map +1 -0
- package/dist/ui/terminal/TerminalRenderer.d.ts +84 -0
- package/dist/ui/terminal/TerminalRenderer.d.ts.map +1 -0
- package/dist/ui/terminal/TerminalRenderer.js +154 -0
- package/dist/ui/terminal/TerminalRenderer.js.map +1 -0
- package/dist/ui/terminal/TerminalUI.d.ts +139 -0
- package/dist/ui/terminal/TerminalUI.d.ts.map +1 -0
- package/dist/ui/terminal/TerminalUI.js +430 -0
- package/dist/ui/terminal/TerminalUI.js.map +1 -0
- package/dist/ui/terminal/VirtualChatBuffer.d.ts +32 -0
- package/dist/ui/terminal/VirtualChatBuffer.d.ts.map +1 -0
- package/dist/ui/terminal/VirtualChatBuffer.js +37 -0
- package/dist/ui/terminal/VirtualChatBuffer.js.map +1 -0
- package/dist/ui/terminal-kit-base.d.ts +117 -0
- package/dist/ui/terminal-kit-base.d.ts.map +1 -0
- package/dist/ui/terminal-kit-base.js +188 -0
- package/dist/ui/terminal-kit-base.js.map +1 -0
- package/dist/utils/file.d.ts +21 -0
- package/dist/utils/file.d.ts.map +1 -0
- package/dist/utils/file.js +68 -0
- package/dist/utils/file.js.map +1 -0
- package/dist/utils/logger.d.ts +17 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +57 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/markdown-parser.d.ts +56 -0
- package/dist/utils/markdown-parser.d.ts.map +1 -0
- package/dist/utils/markdown-parser.js +307 -0
- package/dist/utils/markdown-parser.js.map +1 -0
- package/dist/utils/shell.d.ts +7 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +62 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/state.d.ts +13 -0
- package/dist/utils/state.d.ts.map +1 -0
- package/dist/utils/state.js +25 -0
- package/dist/utils/state.js.map +1 -0
- package/package.json +81 -0
- package/postinstall.js +46 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export interface ComponentRegion {
|
|
2
|
+
name: string;
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
zIndex: number;
|
|
8
|
+
dirty: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function registerComponent(name: string, width: number, height: number, options?: {
|
|
11
|
+
x?: number;
|
|
12
|
+
y?: number;
|
|
13
|
+
zIndex?: number;
|
|
14
|
+
}): ComponentRegion;
|
|
15
|
+
export declare function updateComponent(name: string, updates: Partial<ComponentRegion>): void;
|
|
16
|
+
export declare function markDirty(name: string): void;
|
|
17
|
+
export declare function clearComponent(name: string): void;
|
|
18
|
+
export declare function unregisterComponent(name: string): void;
|
|
19
|
+
export declare function getComponent(name: string): ComponentRegion | undefined;
|
|
20
|
+
export declare function resetLayout(): void;
|
|
21
|
+
export declare function getCurrentY(): number;
|
|
22
|
+
export declare function setCurrentY(y: number): void;
|
|
23
|
+
export declare function renderDirtyComponents(): void;
|
|
24
|
+
export declare function renderAll(): void;
|
|
25
|
+
export declare function clearScreen(): void;
|
|
26
|
+
export declare function getScrollOffset(): number;
|
|
27
|
+
export declare function setScrollOffset(offset: number): void;
|
|
28
|
+
export declare function setMaxScrollOffset(max: number): void;
|
|
29
|
+
export declare function scrollUp(lines?: number): void;
|
|
30
|
+
export declare function scrollDown(lines?: number): void;
|
|
31
|
+
export declare function scrollToTop(): void;
|
|
32
|
+
export declare function scrollToBottom(): void;
|
|
33
|
+
export interface InputState {
|
|
34
|
+
value: string;
|
|
35
|
+
cursorPosition: number;
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
}
|
|
38
|
+
export declare function getInputState(): InputState;
|
|
39
|
+
export declare function setInputState(state: Partial<InputState>): void;
|
|
40
|
+
export declare function clearInput(): void;
|
|
41
|
+
export interface RenderedMessage {
|
|
42
|
+
id: string;
|
|
43
|
+
y: number;
|
|
44
|
+
height: number;
|
|
45
|
+
}
|
|
46
|
+
export declare function registerRenderedMessage(id: string, y: number, height: number): void;
|
|
47
|
+
export declare function getRenderedMessage(id: string): RenderedMessage | undefined;
|
|
48
|
+
export declare function clearRenderedMessages(): void;
|
|
49
|
+
export declare function getVisibleMessageRange(totalMessages: number, viewportHeight: number): {
|
|
50
|
+
start: number;
|
|
51
|
+
end: number;
|
|
52
|
+
};
|
|
53
|
+
export declare function registerOverlay(name: string, x: number, y: number, width: number, height: number): void;
|
|
54
|
+
export declare function showOverlay(name: string): void;
|
|
55
|
+
export declare function hideOverlay(name: string): void;
|
|
56
|
+
export declare function isOverlayActive(name: string): boolean;
|
|
57
|
+
export declare function getTerminalSize(): {
|
|
58
|
+
width: number;
|
|
59
|
+
height: number;
|
|
60
|
+
};
|
|
61
|
+
export declare function calculateComponentDimensions(widthPercent: number, heightPercent: number, minWidth?: number, minHeight?: number): {
|
|
62
|
+
width: number;
|
|
63
|
+
height: number;
|
|
64
|
+
};
|
|
65
|
+
export declare function centerComponent(width: number, height: number): {
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=render-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-engine.d.ts","sourceRoot":"","sources":["../../src/ui/render-engine.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB;AAOD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;IAAE,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GACxD,eAAe,CAmBjB;AAGD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,QAM9E;AAGD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,QAKrC;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,QAM1C;AAGD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,QAM/C;AAGD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAEtE;AAGD,wBAAgB,WAAW,SAE1B;AAGD,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAGD,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,QAEp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M,EAAE,MAAM,QAGf;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,QAKvC;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,QAOvC;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAErD;AAGD,wBAAgB,eAAe,IAAI;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAKnE;AAGD,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,QAAQ,SAAK,EACb,SAAS,SAAI,GACZ;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAKnC;AAGD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAKvF"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { term, render as doRender, clearRegion } from './terminal-kit-base.js';
|
|
2
|
+
// Global state for component management
|
|
3
|
+
const components = new Map();
|
|
4
|
+
let currentY = 1; // Track vertical position for auto-layout
|
|
5
|
+
// Register a component region
|
|
6
|
+
export function registerComponent(name, width, height, options = {}) {
|
|
7
|
+
const region = {
|
|
8
|
+
name,
|
|
9
|
+
x: options.x ?? 1,
|
|
10
|
+
y: options.y ?? currentY,
|
|
11
|
+
width,
|
|
12
|
+
height,
|
|
13
|
+
zIndex: options.zIndex ?? 0,
|
|
14
|
+
dirty: true,
|
|
15
|
+
};
|
|
16
|
+
components.set(name, region);
|
|
17
|
+
// Auto-increment Y position for next component if not manually positioned
|
|
18
|
+
if (options.y === undefined) {
|
|
19
|
+
currentY += height;
|
|
20
|
+
}
|
|
21
|
+
return region;
|
|
22
|
+
}
|
|
23
|
+
// Update component region
|
|
24
|
+
export function updateComponent(name, updates) {
|
|
25
|
+
const component = components.get(name);
|
|
26
|
+
if (!component)
|
|
27
|
+
return;
|
|
28
|
+
Object.assign(component, updates);
|
|
29
|
+
component.dirty = true;
|
|
30
|
+
}
|
|
31
|
+
// Mark component as dirty (needs re-render)
|
|
32
|
+
export function markDirty(name) {
|
|
33
|
+
const component = components.get(name);
|
|
34
|
+
if (component) {
|
|
35
|
+
component.dirty = true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Clear component region
|
|
39
|
+
export function clearComponent(name) {
|
|
40
|
+
const component = components.get(name);
|
|
41
|
+
if (!component)
|
|
42
|
+
return;
|
|
43
|
+
clearRegion(component.x, component.y, component.width, component.height);
|
|
44
|
+
component.dirty = false;
|
|
45
|
+
}
|
|
46
|
+
// Unregister component
|
|
47
|
+
export function unregisterComponent(name) {
|
|
48
|
+
const component = components.get(name);
|
|
49
|
+
if (component) {
|
|
50
|
+
clearComponent(name);
|
|
51
|
+
components.delete(name);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Get component region
|
|
55
|
+
export function getComponent(name) {
|
|
56
|
+
return components.get(name);
|
|
57
|
+
}
|
|
58
|
+
// Reset vertical position (for re-layout)
|
|
59
|
+
export function resetLayout() {
|
|
60
|
+
currentY = 1;
|
|
61
|
+
}
|
|
62
|
+
// Get current Y position (for manual layout)
|
|
63
|
+
export function getCurrentY() {
|
|
64
|
+
return currentY;
|
|
65
|
+
}
|
|
66
|
+
// Set current Y position (for manual layout)
|
|
67
|
+
export function setCurrentY(y) {
|
|
68
|
+
currentY = y;
|
|
69
|
+
}
|
|
70
|
+
// Render all dirty components (sorted by z-index)
|
|
71
|
+
export function renderDirtyComponents() {
|
|
72
|
+
const dirtyComponents = Array.from(components.values())
|
|
73
|
+
.filter(c => c.dirty)
|
|
74
|
+
.sort((a, b) => a.zIndex - b.zIndex);
|
|
75
|
+
if (dirtyComponents.length > 0) {
|
|
76
|
+
doRender();
|
|
77
|
+
// Mark components as clean
|
|
78
|
+
dirtyComponents.forEach(c => {
|
|
79
|
+
c.dirty = false;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Force render all components
|
|
84
|
+
export function renderAll() {
|
|
85
|
+
components.forEach(c => {
|
|
86
|
+
c.dirty = true;
|
|
87
|
+
});
|
|
88
|
+
renderDirtyComponents();
|
|
89
|
+
}
|
|
90
|
+
// Clear entire screen and reset layout
|
|
91
|
+
export function clearScreen() {
|
|
92
|
+
term.clear();
|
|
93
|
+
clearRegion(1, 1, term.width, term.height);
|
|
94
|
+
resetLayout();
|
|
95
|
+
components.clear();
|
|
96
|
+
}
|
|
97
|
+
// Scroll management (for message history)
|
|
98
|
+
let scrollOffset = 0;
|
|
99
|
+
let maxScrollOffset = 0;
|
|
100
|
+
export function getScrollOffset() {
|
|
101
|
+
return scrollOffset;
|
|
102
|
+
}
|
|
103
|
+
export function setScrollOffset(offset) {
|
|
104
|
+
scrollOffset = Math.max(0, Math.min(offset, maxScrollOffset));
|
|
105
|
+
}
|
|
106
|
+
export function setMaxScrollOffset(max) {
|
|
107
|
+
maxScrollOffset = max;
|
|
108
|
+
}
|
|
109
|
+
export function scrollUp(lines = 1) {
|
|
110
|
+
setScrollOffset(scrollOffset - lines);
|
|
111
|
+
}
|
|
112
|
+
export function scrollDown(lines = 1) {
|
|
113
|
+
setScrollOffset(scrollOffset + lines);
|
|
114
|
+
}
|
|
115
|
+
export function scrollToTop() {
|
|
116
|
+
setScrollOffset(0);
|
|
117
|
+
}
|
|
118
|
+
export function scrollToBottom() {
|
|
119
|
+
setScrollOffset(maxScrollOffset);
|
|
120
|
+
}
|
|
121
|
+
let inputState = {
|
|
122
|
+
value: '',
|
|
123
|
+
cursorPosition: 0,
|
|
124
|
+
};
|
|
125
|
+
export function getInputState() {
|
|
126
|
+
return inputState;
|
|
127
|
+
}
|
|
128
|
+
export function setInputState(state) {
|
|
129
|
+
inputState = { ...inputState, ...state };
|
|
130
|
+
}
|
|
131
|
+
export function clearInput() {
|
|
132
|
+
inputState = {
|
|
133
|
+
value: '',
|
|
134
|
+
cursorPosition: 0,
|
|
135
|
+
placeholder: inputState.placeholder,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const renderedMessages = new Map();
|
|
139
|
+
export function registerRenderedMessage(id, y, height) {
|
|
140
|
+
renderedMessages.set(id, { id, y, height });
|
|
141
|
+
}
|
|
142
|
+
export function getRenderedMessage(id) {
|
|
143
|
+
return renderedMessages.get(id);
|
|
144
|
+
}
|
|
145
|
+
export function clearRenderedMessages() {
|
|
146
|
+
renderedMessages.clear();
|
|
147
|
+
}
|
|
148
|
+
// Calculate visible message range based on scroll
|
|
149
|
+
export function getVisibleMessageRange(totalMessages, viewportHeight) {
|
|
150
|
+
const messagesPerPage = Math.floor(viewportHeight / 3); // Assume ~3 lines per message
|
|
151
|
+
const totalPages = Math.ceil(totalMessages / messagesPerPage);
|
|
152
|
+
const start = Math.max(0, totalMessages - messagesPerPage - scrollOffset);
|
|
153
|
+
const end = Math.min(totalMessages, start + messagesPerPage);
|
|
154
|
+
return { start, end };
|
|
155
|
+
}
|
|
156
|
+
const overlays = new Map();
|
|
157
|
+
export function registerOverlay(name, x, y, width, height) {
|
|
158
|
+
overlays.set(name, { name, x, y, width, height, active: false });
|
|
159
|
+
}
|
|
160
|
+
export function showOverlay(name) {
|
|
161
|
+
const overlay = overlays.get(name);
|
|
162
|
+
if (overlay) {
|
|
163
|
+
overlay.active = true;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
export function hideOverlay(name) {
|
|
167
|
+
const overlay = overlays.get(name);
|
|
168
|
+
if (overlay) {
|
|
169
|
+
overlay.active = false;
|
|
170
|
+
// Clear overlay region
|
|
171
|
+
clearRegion(overlay.x, overlay.y, overlay.width, overlay.height);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
export function isOverlayActive(name) {
|
|
175
|
+
return overlays.get(name)?.active ?? false;
|
|
176
|
+
}
|
|
177
|
+
// Terminal dimensions helper
|
|
178
|
+
export function getTerminalSize() {
|
|
179
|
+
return {
|
|
180
|
+
width: term.width,
|
|
181
|
+
height: term.height,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
// Calculate component dimensions based on terminal size
|
|
185
|
+
export function calculateComponentDimensions(widthPercent, heightPercent, minWidth = 40, minHeight = 5) {
|
|
186
|
+
const width = Math.max(minWidth, Math.floor(term.width * widthPercent));
|
|
187
|
+
const height = Math.max(minHeight, Math.floor(term.height * heightPercent));
|
|
188
|
+
return { width, height };
|
|
189
|
+
}
|
|
190
|
+
// Center component on screen
|
|
191
|
+
export function centerComponent(width, height) {
|
|
192
|
+
return {
|
|
193
|
+
x: Math.max(1, Math.floor((term.width - width) / 2)),
|
|
194
|
+
y: Math.max(1, Math.floor((term.height - height) / 2)),
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=render-engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-engine.js","sourceRoot":"","sources":["../../src/ui/render-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAgB,MAAM,IAAI,QAAQ,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAa7F,wCAAwC;AACxC,MAAM,UAAU,GAAiC,IAAI,GAAG,EAAE,CAAC;AAC3D,IAAI,QAAQ,GAAG,CAAC,CAAC,CAAC,0CAA0C;AAE5D,8BAA8B;AAC9B,MAAM,UAAU,iBAAiB,CAC/B,IAAY,EACZ,KAAa,EACb,MAAc,EACd,UAAuD,EAAE;IAEzD,MAAM,MAAM,GAAoB;QAC9B,IAAI;QACJ,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;QACjB,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,QAAQ;QACxB,KAAK;QACL,MAAM;QACN,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,CAAC;QAC3B,KAAK,EAAE,IAAI;KACZ,CAAC;IAEF,UAAU,CAAC,GAAG,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EAAE,MAAM,EAAE,CAAC;AAC3B,CAAC;AAED,6BAA6B;AAC7B,MAAM,UAAU,eAAe,CAAC,KAAa,EAAE,MAAc;IAC3D,OAAO;QACL,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QACpD,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;KACvD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom Terminal Renderer
|
|
3
|
+
* Replaces Ink with direct terminal control for better performance and no duplication
|
|
4
|
+
*/
|
|
5
|
+
export interface TerminalLine {
|
|
6
|
+
content: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class TerminalRenderer {
|
|
10
|
+
private lines;
|
|
11
|
+
private cursorLine;
|
|
12
|
+
private inputLine;
|
|
13
|
+
private inputPrompt;
|
|
14
|
+
private statusLine;
|
|
15
|
+
private rl;
|
|
16
|
+
private stdout;
|
|
17
|
+
private stdin;
|
|
18
|
+
constructor();
|
|
19
|
+
/**
|
|
20
|
+
* Initialize the terminal
|
|
21
|
+
*/
|
|
22
|
+
init(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Clear the entire screen
|
|
25
|
+
*/
|
|
26
|
+
clearScreen(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Hide cursor
|
|
29
|
+
*/
|
|
30
|
+
hideCursor(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Show cursor
|
|
33
|
+
*/
|
|
34
|
+
showCursor(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Move cursor to specific position
|
|
37
|
+
*/
|
|
38
|
+
moveCursor(row: number, col: number): void;
|
|
39
|
+
/**
|
|
40
|
+
* Clear current line
|
|
41
|
+
*/
|
|
42
|
+
clearLine(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Add a line to the display buffer
|
|
45
|
+
*/
|
|
46
|
+
addLine(content: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* Set the status line (bottom bar)
|
|
49
|
+
*/
|
|
50
|
+
setStatusLine(content: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Set the input prompt
|
|
53
|
+
*/
|
|
54
|
+
setInputPrompt(prompt: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Render the entire screen
|
|
57
|
+
*/
|
|
58
|
+
render(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Render a new line of content (for messages, tool output, etc.)
|
|
61
|
+
*/
|
|
62
|
+
renderNewLine(content: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Update input line
|
|
65
|
+
*/
|
|
66
|
+
updateInput(input: string): void;
|
|
67
|
+
/**
|
|
68
|
+
* Clear all lines
|
|
69
|
+
*/
|
|
70
|
+
clearLines(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Get current input
|
|
73
|
+
*/
|
|
74
|
+
getInput(): string;
|
|
75
|
+
/**
|
|
76
|
+
* Clear input
|
|
77
|
+
*/
|
|
78
|
+
clearInput(): void;
|
|
79
|
+
/**
|
|
80
|
+
* Cleanup and restore terminal
|
|
81
|
+
*/
|
|
82
|
+
cleanup(): void;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=TerminalRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TerminalRenderer.d.ts","sourceRoot":"","sources":["../../../src/ui/terminal/TerminalRenderer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,EAAE,CAAqB;IAC/B,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,KAAK,CAAa;;IAiB1B;;OAEG;IACH,IAAI,IAAI,IAAI;IAUZ;;OAEG;IACH,WAAW,IAAI,IAAI;IAInB;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAI1C;;OAEG;IACH,SAAS,IAAI,IAAI;IAIjB;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI9B;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIpC;;OAEG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIpC;;OAEG;IACH,MAAM,IAAI,IAAI;IAqBd;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAcpC;;OAEG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKhC;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,OAAO,IAAI,IAAI;CAOhB"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom Terminal Renderer
|
|
3
|
+
* Replaces Ink with direct terminal control for better performance and no duplication
|
|
4
|
+
*/
|
|
5
|
+
import * as readline from 'readline';
|
|
6
|
+
export class TerminalRenderer {
|
|
7
|
+
lines = [];
|
|
8
|
+
cursorLine = 0;
|
|
9
|
+
inputLine = '';
|
|
10
|
+
inputPrompt = '> ';
|
|
11
|
+
statusLine = '';
|
|
12
|
+
rl;
|
|
13
|
+
stdout;
|
|
14
|
+
stdin;
|
|
15
|
+
constructor() {
|
|
16
|
+
this.stdout = process.stdout;
|
|
17
|
+
this.stdin = process.stdin;
|
|
18
|
+
// Create readline interface
|
|
19
|
+
this.rl = readline.createInterface({
|
|
20
|
+
input: this.stdin,
|
|
21
|
+
output: this.stdout,
|
|
22
|
+
terminal: true
|
|
23
|
+
});
|
|
24
|
+
// Hide cursor initially
|
|
25
|
+
this.hideCursor();
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Initialize the terminal
|
|
29
|
+
*/
|
|
30
|
+
init() {
|
|
31
|
+
// Clear screen
|
|
32
|
+
this.clearScreen();
|
|
33
|
+
// Enable raw mode for better control
|
|
34
|
+
if (this.stdin.isTTY) {
|
|
35
|
+
this.stdin.setRawMode(true);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Clear the entire screen
|
|
40
|
+
*/
|
|
41
|
+
clearScreen() {
|
|
42
|
+
this.stdout.write('\x1b[2J\x1b[H');
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Hide cursor
|
|
46
|
+
*/
|
|
47
|
+
hideCursor() {
|
|
48
|
+
this.stdout.write('\x1b[?25l');
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Show cursor
|
|
52
|
+
*/
|
|
53
|
+
showCursor() {
|
|
54
|
+
this.stdout.write('\x1b[?25h');
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Move cursor to specific position
|
|
58
|
+
*/
|
|
59
|
+
moveCursor(row, col) {
|
|
60
|
+
this.stdout.write(`\x1b[${row};${col}H`);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Clear current line
|
|
64
|
+
*/
|
|
65
|
+
clearLine() {
|
|
66
|
+
this.stdout.write('\x1b[2K');
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Add a line to the display buffer
|
|
70
|
+
*/
|
|
71
|
+
addLine(content) {
|
|
72
|
+
this.lines.push(content);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Set the status line (bottom bar)
|
|
76
|
+
*/
|
|
77
|
+
setStatusLine(content) {
|
|
78
|
+
this.statusLine = content;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Set the input prompt
|
|
82
|
+
*/
|
|
83
|
+
setInputPrompt(prompt) {
|
|
84
|
+
this.inputPrompt = prompt;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Render the entire screen
|
|
88
|
+
*/
|
|
89
|
+
render() {
|
|
90
|
+
const rows = this.stdout.rows || 24;
|
|
91
|
+
// Just update the status and input lines at the bottom
|
|
92
|
+
// Don't clear or redraw content - let it scroll naturally
|
|
93
|
+
// Render status line at bottom
|
|
94
|
+
this.moveCursor(rows - 1, 1);
|
|
95
|
+
this.clearLine();
|
|
96
|
+
this.stdout.write(this.statusLine);
|
|
97
|
+
// Render input line at very bottom
|
|
98
|
+
this.moveCursor(rows, 1);
|
|
99
|
+
this.clearLine();
|
|
100
|
+
this.stdout.write(this.inputPrompt + this.inputLine);
|
|
101
|
+
// Position cursor at end of input
|
|
102
|
+
this.moveCursor(rows, this.inputPrompt.length + this.inputLine.length + 1);
|
|
103
|
+
this.showCursor();
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Render a new line of content (for messages, tool output, etc.)
|
|
107
|
+
*/
|
|
108
|
+
renderNewLine(content) {
|
|
109
|
+
const rows = this.stdout.rows || 24;
|
|
110
|
+
// Move to line before status bar
|
|
111
|
+
this.moveCursor(rows - 2, 1);
|
|
112
|
+
this.clearLine();
|
|
113
|
+
// Write the content
|
|
114
|
+
this.stdout.write(content + '\n');
|
|
115
|
+
// Re-render status and input
|
|
116
|
+
this.render();
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Update input line
|
|
120
|
+
*/
|
|
121
|
+
updateInput(input) {
|
|
122
|
+
this.inputLine = input;
|
|
123
|
+
this.render();
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Clear all lines
|
|
127
|
+
*/
|
|
128
|
+
clearLines() {
|
|
129
|
+
this.lines = [];
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Get current input
|
|
133
|
+
*/
|
|
134
|
+
getInput() {
|
|
135
|
+
return this.inputLine;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Clear input
|
|
139
|
+
*/
|
|
140
|
+
clearInput() {
|
|
141
|
+
this.inputLine = '';
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Cleanup and restore terminal
|
|
145
|
+
*/
|
|
146
|
+
cleanup() {
|
|
147
|
+
this.showCursor();
|
|
148
|
+
if (this.stdin.isTTY) {
|
|
149
|
+
this.stdin.setRawMode(false);
|
|
150
|
+
}
|
|
151
|
+
this.rl.close();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=TerminalRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TerminalRenderer.js","sourceRoot":"","sources":["../../../src/ui/terminal/TerminalRenderer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAQrC,MAAM,OAAO,gBAAgB;IACnB,KAAK,GAAa,EAAE,CAAC;IACrB,UAAU,GAAW,CAAC,CAAC;IACvB,SAAS,GAAW,EAAE,CAAC;IACvB,WAAW,GAAW,IAAI,CAAC;IAC3B,UAAU,GAAW,EAAE,CAAC;IACxB,EAAE,CAAqB;IACvB,MAAM,CAAc;IACpB,KAAK,CAAa;IAE1B;QACE,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAqB,CAAC;QAC5C,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAmB,CAAC;QAE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,CAAC;QACvB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,UAAU;QACR,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,UAAU;QACR,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACrB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QACD,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal UI Manager
|
|
3
|
+
* Manages the UI state and rendering without React/Ink
|
|
4
|
+
*/
|
|
5
|
+
interface ApprovalRequest {
|
|
6
|
+
message: string;
|
|
7
|
+
risky: boolean;
|
|
8
|
+
preview?: {
|
|
9
|
+
type: 'code' | 'diff';
|
|
10
|
+
content: string;
|
|
11
|
+
language?: string;
|
|
12
|
+
};
|
|
13
|
+
resolve: (approved: boolean) => void;
|
|
14
|
+
}
|
|
15
|
+
interface PickerOptions {
|
|
16
|
+
message: string;
|
|
17
|
+
choices: Array<{
|
|
18
|
+
label: string;
|
|
19
|
+
value: string;
|
|
20
|
+
}>;
|
|
21
|
+
type: 'model' | 'provider';
|
|
22
|
+
}
|
|
23
|
+
interface PlanApprovalRequest {
|
|
24
|
+
tasks: string[];
|
|
25
|
+
question: string;
|
|
26
|
+
resolve: (approved: boolean) => void;
|
|
27
|
+
}
|
|
28
|
+
export declare class TerminalUI {
|
|
29
|
+
private renderer;
|
|
30
|
+
private screen;
|
|
31
|
+
private messageHistory;
|
|
32
|
+
private currentMessage;
|
|
33
|
+
private isLoading;
|
|
34
|
+
private loadingMessage;
|
|
35
|
+
private currentModel;
|
|
36
|
+
private planMode;
|
|
37
|
+
private autoAcceptMode;
|
|
38
|
+
private approvalRequest?;
|
|
39
|
+
private pickerOptions?;
|
|
40
|
+
private planApprovalRequest?;
|
|
41
|
+
private selectedPickerIndex;
|
|
42
|
+
private inputBuffer;
|
|
43
|
+
private onMessageCallback?;
|
|
44
|
+
private onPickerSelectionCallback?;
|
|
45
|
+
private onToggleAutoAcceptCallback?;
|
|
46
|
+
constructor(initialModel: string, initialPlanMode: boolean);
|
|
47
|
+
/**
|
|
48
|
+
* Initialize the UI
|
|
49
|
+
*/
|
|
50
|
+
init(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Render the welcome banner
|
|
53
|
+
*/
|
|
54
|
+
private renderBanner;
|
|
55
|
+
/**
|
|
56
|
+
* Update the status bar
|
|
57
|
+
*/
|
|
58
|
+
private updateStatusBar;
|
|
59
|
+
/**
|
|
60
|
+
* Setup input handling
|
|
61
|
+
*/
|
|
62
|
+
private setupInputHandling;
|
|
63
|
+
/**
|
|
64
|
+
* Handle chat screen input
|
|
65
|
+
*/
|
|
66
|
+
private handleChatInput;
|
|
67
|
+
/**
|
|
68
|
+
* Handle approval screen input
|
|
69
|
+
*/
|
|
70
|
+
private handleApprovalInput;
|
|
71
|
+
/**
|
|
72
|
+
* Handle picker screen input
|
|
73
|
+
*/
|
|
74
|
+
private handlePickerInput;
|
|
75
|
+
/**
|
|
76
|
+
* Handle plan approval input
|
|
77
|
+
*/
|
|
78
|
+
private handlePlanApprovalInput;
|
|
79
|
+
/**
|
|
80
|
+
* Add a user message
|
|
81
|
+
*/
|
|
82
|
+
private addUserMessage;
|
|
83
|
+
/**
|
|
84
|
+
* Add an assistant message
|
|
85
|
+
*/
|
|
86
|
+
addAssistantMessage(content: string): void;
|
|
87
|
+
/**
|
|
88
|
+
* Add a system message
|
|
89
|
+
*/
|
|
90
|
+
private addSystemMessage;
|
|
91
|
+
/**
|
|
92
|
+
* Add a tool execution message
|
|
93
|
+
*/
|
|
94
|
+
addToolMessage(toolName: string, status: 'executing' | 'completed' | 'error', details?: any): void;
|
|
95
|
+
/**
|
|
96
|
+
* Set loading state
|
|
97
|
+
*/
|
|
98
|
+
setLoading(loading: boolean, message?: string): void;
|
|
99
|
+
/**
|
|
100
|
+
* Show approval request
|
|
101
|
+
*/
|
|
102
|
+
showApprovalRequest(request: ApprovalRequest): void;
|
|
103
|
+
/**
|
|
104
|
+
* Show picker
|
|
105
|
+
*/
|
|
106
|
+
showPicker(options: PickerOptions): void;
|
|
107
|
+
/**
|
|
108
|
+
* Show plan approval
|
|
109
|
+
*/
|
|
110
|
+
showPlanApproval(request: PlanApprovalRequest): void;
|
|
111
|
+
/**
|
|
112
|
+
* Render chat screen
|
|
113
|
+
*/
|
|
114
|
+
private renderChatScreen;
|
|
115
|
+
/**
|
|
116
|
+
* Get tool emoji
|
|
117
|
+
*/
|
|
118
|
+
private getToolEmoji;
|
|
119
|
+
/**
|
|
120
|
+
* Get tool label
|
|
121
|
+
*/
|
|
122
|
+
private getToolLabel;
|
|
123
|
+
/**
|
|
124
|
+
* Format timestamp
|
|
125
|
+
*/
|
|
126
|
+
private formatTime;
|
|
127
|
+
/**
|
|
128
|
+
* Set callbacks
|
|
129
|
+
*/
|
|
130
|
+
setOnMessage(callback: (message: string) => Promise<void>): void;
|
|
131
|
+
setOnPickerSelection(callback: (value: string, type: 'model' | 'provider') => Promise<void>): void;
|
|
132
|
+
setOnToggleAutoAccept(callback: () => void): void;
|
|
133
|
+
/**
|
|
134
|
+
* Cleanup
|
|
135
|
+
*/
|
|
136
|
+
cleanup(): void;
|
|
137
|
+
}
|
|
138
|
+
export {};
|
|
139
|
+
//# sourceMappingURL=TerminalUI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TerminalUI.d.ts","sourceRoot":"","sources":["../../../src/ui/terminal/TerminalUI.ts"],"names":[],"m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