@comma-agents/tui 2.0.0-rc.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/LICENSE +21 -0
- package/README.md +10 -0
- package/dist/App/App.d.ts +24 -0
- package/dist/App/App.theme.d.ts +12 -0
- package/dist/App/App.types.d.ts +8 -0
- package/dist/App/index.d.ts +4 -0
- package/dist/Theme/DefineTheme.d.ts +53 -0
- package/dist/Theme/Theme.d.ts +11 -0
- package/dist/Theme/Theme.types.d.ts +100 -0
- package/dist/Theme/index.d.ts +9 -0
- package/dist/Theme/themes/dark.d.ts +14 -0
- package/dist/Theme/themes/dracula.d.ts +9 -0
- package/dist/Theme/themes/index.d.ts +25 -0
- package/dist/Theme/themes/light.d.ts +10 -0
- package/dist/Theme/themes/solarized-dark.d.ts +9 -0
- package/dist/Theme/useTheme/index.d.ts +3 -0
- package/dist/Theme/useTheme/useTheme.context.d.ts +31 -0
- package/dist/Theme/useTheme/useTheme.d.ts +11 -0
- package/dist/Theme/useTheme/useTheme.types.d.ts +10 -0
- package/dist/components/BorderedPanel/BorderedPanel.d.ts +70 -0
- package/dist/components/BorderedPanel/BorderedPanel.theme.d.ts +59 -0
- package/dist/components/BorderedPanel/index.d.ts +4 -0
- package/dist/components/Button/Button.d.ts +69 -0
- package/dist/components/Button/Button.theme.d.ts +50 -0
- package/dist/components/Button/Button.types.d.ts +9 -0
- package/dist/components/Button/index.d.ts +4 -0
- package/dist/components/ChatTextArea/ChatTextArea.d.ts +85 -0
- package/dist/components/ChatTextArea/ChatTextArea.theme.d.ts +34 -0
- package/dist/components/ChatTextArea/index.d.ts +2 -0
- package/dist/components/CodeView/CodeView.constants.d.ts +9 -0
- package/dist/components/CodeView/CodeView.d.ts +23 -0
- package/dist/components/CodeView/CodeView.theme.d.ts +26 -0
- package/dist/components/CodeView/index.d.ts +4 -0
- package/dist/components/CommandPalette/CommandPalette.constants.d.ts +8 -0
- package/dist/components/CommandPalette/CommandPalette.d.ts +62 -0
- package/dist/components/CommandPalette/CommandPalette.theme.d.ts +50 -0
- package/dist/components/CommandPalette/CommandPalette.types.d.ts +50 -0
- package/dist/components/CommandPalette/CommandPalette.utils.d.ts +6 -0
- package/dist/components/CommandPalette/index.d.ts +5 -0
- package/dist/components/CommandPalette/pages/HelpPage/HelpPage.constants.d.ts +2 -0
- package/dist/components/CommandPalette/pages/HelpPage/HelpPage.d.ts +12 -0
- package/dist/components/CommandPalette/pages/HelpPage/HelpPage.types.d.ts +5 -0
- package/dist/components/CommandPalette/pages/HelpPage/index.d.ts +3 -0
- package/dist/components/CommandPalette/pages/ListProvidersPage/ListProvidersPage.d.ts +42 -0
- package/dist/components/CommandPalette/pages/ListProvidersPage/index.d.ts +1 -0
- package/dist/components/CommandPalette/pages/RegisteredProvidersPage/RegisteredProvidersPage.constants.d.ts +3 -0
- package/dist/components/CommandPalette/pages/RegisteredProvidersPage/RegisteredProvidersPage.d.ts +40 -0
- package/dist/components/CommandPalette/pages/RegisteredProvidersPage/RegisteredProvidersPage.types.d.ts +13 -0
- package/dist/components/CommandPalette/pages/RegisteredProvidersPage/RegisteredProvidersPage.utils.d.ts +9 -0
- package/dist/components/CommandPalette/pages/RegisteredProvidersPage/index.d.ts +2 -0
- package/dist/components/CommandPalette/pages/RunPickerPage/RunPickerPage.constants.d.ts +3 -0
- package/dist/components/CommandPalette/pages/RunPickerPage/RunPickerPage.d.ts +31 -0
- package/dist/components/CommandPalette/pages/RunPickerPage/RunPickerPage.types.d.ts +8 -0
- package/dist/components/CommandPalette/pages/RunPickerPage/RunPickerPage.utils.d.ts +7 -0
- package/dist/components/CommandPalette/pages/RunPickerPage/index.d.ts +3 -0
- package/dist/components/CommandPalette/pages/SettingsPage/SettingsPage.d.ts +24 -0
- package/dist/components/CommandPalette/pages/SettingsPage/index.d.ts +2 -0
- package/dist/components/Frame/Frame.d.ts +48 -0
- package/dist/components/Frame/Frame.theme.d.ts +52 -0
- package/dist/components/Frame/index.d.ts +4 -0
- package/dist/components/Hide/Hide.d.ts +20 -0
- package/dist/components/Hide/Hide.types.d.ts +12 -0
- package/dist/components/Hide/index.d.ts +2 -0
- package/dist/components/MessageList/AgentMessage/AgentMessage.d.ts +71 -0
- package/dist/components/MessageList/AgentMessage/index.d.ts +2 -0
- package/dist/components/MessageList/ContextUsageModal/ContextUsageModal.constants.d.ts +2 -0
- package/dist/components/MessageList/ContextUsageModal/ContextUsageModal.d.ts +9 -0
- package/dist/components/MessageList/ContextUsageModal/ContextUsageModal.types.d.ts +12 -0
- package/dist/components/MessageList/ContextUsageModal/index.d.ts +4 -0
- package/dist/components/MessageList/MarkdownView/MarkdownView.constants.d.ts +51 -0
- package/dist/components/MessageList/MarkdownView/MarkdownView.d.ts +34 -0
- package/dist/components/MessageList/MarkdownView/MarkdownView.theme.d.ts +89 -0
- package/dist/components/MessageList/MarkdownView/MarkdownView.types.d.ts +96 -0
- package/dist/components/MessageList/MarkdownView/MarkdownView.utils.d.ts +58 -0
- package/dist/components/MessageList/MarkdownView/index.d.ts +6 -0
- package/dist/components/MessageList/MessageList.d.ts +20 -0
- package/dist/components/MessageList/MessageList.theme.d.ts +170 -0
- package/dist/components/MessageList/MessageList.types.d.ts +26 -0
- package/dist/components/MessageList/OutputModal/OutputModal.constants.d.ts +22 -0
- package/dist/components/MessageList/OutputModal/OutputModal.d.ts +37 -0
- package/dist/components/MessageList/OutputModal/OutputModal.theme.d.ts +68 -0
- package/dist/components/MessageList/OutputModal/OutputModal.types.d.ts +56 -0
- package/dist/components/MessageList/OutputModal/OutputModal.utils.d.ts +3 -0
- package/dist/components/MessageList/OutputModal/index.d.ts +6 -0
- package/dist/components/MessageList/SpawnedStrategyView/SpawnedStrategyView.d.ts +47 -0
- package/dist/components/MessageList/SpawnedStrategyView/SpawnedStrategyView.theme.d.ts +58 -0
- package/dist/components/MessageList/SpawnedStrategyView/index.d.ts +4 -0
- package/dist/components/MessageList/SystemMessage/SystemMessage.d.ts +21 -0
- package/dist/components/MessageList/SystemMessage/index.d.ts +2 -0
- package/dist/components/MessageList/ToolCallView/ToolCallView.constants.d.ts +42 -0
- package/dist/components/MessageList/ToolCallView/ToolCallView.d.ts +71 -0
- package/dist/components/MessageList/ToolCallView/ToolCallView.theme.d.ts +47 -0
- package/dist/components/MessageList/ToolCallView/ToolCallView.types.d.ts +60 -0
- package/dist/components/MessageList/ToolCallView/ToolCallView.utils.d.ts +40 -0
- package/dist/components/MessageList/ToolCallView/index.d.ts +8 -0
- package/dist/components/MessageList/UserMessage/UserMessage.d.ts +25 -0
- package/dist/components/MessageList/UserMessage/index.d.ts +2 -0
- package/dist/components/MessageList/index.d.ts +14 -0
- package/dist/components/Modal/Modal.d.ts +64 -0
- package/dist/components/Modal/Modal.theme.d.ts +29 -0
- package/dist/components/Modal/index.d.ts +4 -0
- package/dist/components/MouseProvider/MouseContext.d.ts +36 -0
- package/dist/components/MouseProvider/MouseProvider.d.ts +20 -0
- package/dist/components/MouseProvider/index.d.ts +4 -0
- package/dist/components/PermissionPrompt/PermissionPrompt.d.ts +33 -0
- package/dist/components/PermissionPrompt/index.d.ts +2 -0
- package/dist/components/QuestionPrompt/QuestionPrompt.d.ts +4 -0
- package/dist/components/QuestionPrompt/QuestionPrompt.types.d.ts +18 -0
- package/dist/components/QuestionPrompt/index.d.ts +2 -0
- package/dist/components/ScrollableList/ScrollableList.d.ts +33 -0
- package/dist/components/ScrollableList/ScrollableList.theme.d.ts +33 -0
- package/dist/components/ScrollableList/ScrollableList.types.d.ts +66 -0
- package/dist/components/ScrollableList/index.d.ts +4 -0
- package/dist/components/ScrollableView/ScrollableView.d.ts +34 -0
- package/dist/components/ScrollableView/ScrollableView.theme.d.ts +34 -0
- package/dist/components/ScrollableView/ScrollableView.types.d.ts +113 -0
- package/dist/components/ScrollableView/index.d.ts +4 -0
- package/dist/components/Scrollbar/Scrollbar.d.ts +21 -0
- package/dist/components/Scrollbar/Scrollbar.theme.d.ts +16 -0
- package/dist/components/Scrollbar/Scrollbar.types.d.ts +27 -0
- package/dist/components/Scrollbar/Scrollbar.utils.d.ts +21 -0
- package/dist/components/Scrollbar/index.d.ts +4 -0
- package/dist/components/SearchInput/SearchInput.d.ts +22 -0
- package/dist/components/SearchInput/SearchInput.theme.d.ts +30 -0
- package/dist/components/SearchInput/SearchInput.types.d.ts +25 -0
- package/dist/components/SearchInput/SearchInput.utils.d.ts +22 -0
- package/dist/components/SearchInput/index.d.ts +5 -0
- package/dist/components/Separator/Separator.d.ts +39 -0
- package/dist/components/Separator/Separator.theme.d.ts +22 -0
- package/dist/components/Separator/index.d.ts +4 -0
- package/dist/components/StatusBar/StatusBar.d.ts +4 -0
- package/dist/components/StatusBar/StatusBar.theme.d.ts +35 -0
- package/dist/components/StatusBar/StatusBar.types.d.ts +24 -0
- package/dist/components/StatusBar/index.d.ts +2 -0
- package/dist/components/TextAreaInput/TextAreaInput.d.ts +68 -0
- package/dist/components/TextAreaInput/TextAreaInput.theme.d.ts +14 -0
- package/dist/components/TextAreaInput/TextAreaInput.utils.d.ts +69 -0
- package/dist/components/TextAreaInput/index.d.ts +2 -0
- package/dist/components/TitleIcon/TitleIcon.d.ts +13 -0
- package/dist/components/TitleIcon/TitleIcon.theme.d.ts +19 -0
- package/dist/components/TitleIcon/index.d.ts +1 -0
- package/dist/components/index.d.ts +61 -0
- package/dist/hooks/index.d.ts +27 -0
- package/dist/hooks/useBreakpoint/index.d.ts +2 -0
- package/dist/hooks/useBreakpoint/useBreakpoint.d.ts +15 -0
- package/dist/hooks/useBreakpoint/useBreakpoint.types.d.ts +18 -0
- package/dist/hooks/useChat/index.d.ts +22 -0
- package/dist/hooks/useChat/useChat.context.d.ts +7 -0
- package/dist/hooks/useChat/useChat.d.ts +11 -0
- package/dist/hooks/useChat/useChat.types.d.ts +209 -0
- package/dist/hooks/useChat/useChat.utils.d.ts +18 -0
- package/dist/hooks/useChat/useChatActions.d.ts +10 -0
- package/dist/hooks/useChat/useChatAgentMessages/index.d.ts +1 -0
- package/dist/hooks/useChat/useChatAgentMessages/useChatAgentMessages.d.ts +2 -0
- package/dist/hooks/useChat/useChatInputRequests/index.d.ts +2 -0
- package/dist/hooks/useChat/useChatInputRequests/useChatInputRequests.d.ts +3 -0
- package/dist/hooks/useChat/useChatInputRequests/useChatInputRequests.types.d.ts +4 -0
- package/dist/hooks/useChat/useChatLifecycle.d.ts +5 -0
- package/dist/hooks/useChat/useChatPermissionRequests/index.d.ts +2 -0
- package/dist/hooks/useChat/useChatPermissionRequests/useChatPermissionRequestSubscriptions.d.ts +2 -0
- package/dist/hooks/useChat/useChatPermissionRequests/useChatPermissionRequests.d.ts +3 -0
- package/dist/hooks/useChat/useChatPermissionRequests/useChatPermissionRequests.types.d.ts +4 -0
- package/dist/hooks/useChat/useChatQuestionRequests/index.d.ts +2 -0
- package/dist/hooks/useChat/useChatQuestionRequests/useChatQuestionRequestSubscriptions.d.ts +2 -0
- package/dist/hooks/useChat/useChatQuestionRequests/useChatQuestionRequests.d.ts +3 -0
- package/dist/hooks/useChat/useChatQuestionRequests/useChatQuestionRequests.types.d.ts +4 -0
- package/dist/hooks/useChat/useChatRunLifecycle/index.d.ts +2 -0
- package/dist/hooks/useChat/useChatRunLifecycle/useChatRunLifecycle.d.ts +3 -0
- package/dist/hooks/useChat/useChatRunLifecycle/useChatRunLifecycle.types.d.ts +11 -0
- package/dist/hooks/useChat/useChatRunLifecycle/useChatRunLifecycleSubscriptions.d.ts +2 -0
- package/dist/hooks/useChat/useChatRunStore/index.d.ts +1 -0
- package/dist/hooks/useChat/useChatRunStore/useChatRunStore.d.ts +3 -0
- package/dist/hooks/useChat/useChatRuns.d.ts +10 -0
- package/dist/hooks/useChat/useChatState.d.ts +17 -0
- package/dist/hooks/useChat/useChatSteering/index.d.ts +2 -0
- package/dist/hooks/useChat/useChatSteering/useChatSteering.d.ts +3 -0
- package/dist/hooks/useChat/useChatSteering/useChatSteering.types.d.ts +4 -0
- package/dist/hooks/useChat/useChatStepMessages/index.d.ts +1 -0
- package/dist/hooks/useChat/useChatStepMessages/useChatStepMessages.d.ts +2 -0
- package/dist/hooks/useChat/usePersistedRunList/index.d.ts +2 -0
- package/dist/hooks/useChat/usePersistedRunList/usePersistedRunList.d.ts +3 -0
- package/dist/hooks/useChat/usePersistedRunList/usePersistedRunList.types.d.ts +5 -0
- package/dist/hooks/useDaemon/index.d.ts +6 -0
- package/dist/hooks/useDaemon/useDaemon.context.d.ts +18 -0
- package/dist/hooks/useDaemon/useDaemon.d.ts +7 -0
- package/dist/hooks/useDaemon/useDaemon.types.d.ts +62 -0
- package/dist/hooks/useDaemon/useDaemonCommand/index.d.ts +2 -0
- package/dist/hooks/useDaemon/useDaemonCommand/useDaemonCommand.d.ts +20 -0
- package/dist/hooks/useDaemon/useDaemonCommand/useDaemonCommand.types.d.ts +28 -0
- package/dist/hooks/useDaemon/useDaemonSubscription/index.d.ts +1 -0
- package/dist/hooks/useDaemon/useDaemonSubscription/useDaemonSubscription.d.ts +18 -0
- package/dist/hooks/useDebugRender/index.d.ts +2 -0
- package/dist/hooks/useDebugRender/useDebugRender.constants.d.ts +18 -0
- package/dist/hooks/useDebugRender/useDebugRender.d.ts +35 -0
- package/dist/hooks/useDebugRender/useDebugRender.types.d.ts +60 -0
- package/dist/hooks/useDebugRender/useDebugRender.utils.d.ts +34 -0
- package/dist/hooks/useLogs/index.d.ts +3 -0
- package/dist/hooks/useLogs/logStore.d.ts +18 -0
- package/dist/hooks/useLogs/useLogs.constants.d.ts +2 -0
- package/dist/hooks/useLogs/useLogs.d.ts +15 -0
- package/dist/hooks/useLogs/useLogs.types.d.ts +47 -0
- package/dist/hooks/useLogs/useLogs.utils.d.ts +13 -0
- package/dist/hooks/useModal/index.d.ts +3 -0
- package/dist/hooks/useModal/useModal.context.d.ts +20 -0
- package/dist/hooks/useModal/useModal.d.ts +22 -0
- package/dist/hooks/useModal/useModal.types.d.ts +49 -0
- package/dist/hooks/useMouse/index.d.ts +2 -0
- package/dist/hooks/useMouse/useMouse.types.d.ts +43 -0
- package/dist/hooks/useMouse/useMouse.utils.d.ts +30 -0
- package/dist/hooks/useMouseClick/index.d.ts +2 -0
- package/dist/hooks/useMouseClick/useMouseClick.d.ts +23 -0
- package/dist/hooks/useMouseClick/useMouseClick.types.d.ts +28 -0
- package/dist/hooks/useMouseHover/index.d.ts +2 -0
- package/dist/hooks/useMouseHover/useMouseHover.d.ts +25 -0
- package/dist/hooks/useMouseHover/useMouseHover.types.d.ts +38 -0
- package/dist/hooks/useMouseWheelScroll/index.d.ts +2 -0
- package/dist/hooks/useMouseWheelScroll/useMouseWheelScroll.d.ts +28 -0
- package/dist/hooks/useMouseWheelScroll/useMouseWheelScroll.types.d.ts +32 -0
- package/dist/hooks/useRegion/index.d.ts +3 -0
- package/dist/hooks/useRegion/useRegion.d.ts +21 -0
- package/dist/hooks/useRegion/useRegion.types.d.ts +41 -0
- package/dist/hooks/useRegion/useRegion.utils.d.ts +51 -0
- package/dist/hooks/useStrategies/useStrategies.d.ts +10 -0
- package/dist/hooks/useToolSpinner/index.d.ts +1 -0
- package/dist/hooks/useToolSpinner/useToolSpinner.d.ts +28 -0
- package/dist/hooks/useUserConfig/index.d.ts +4 -0
- package/dist/hooks/useUserConfig/useUserConfig.constants.d.ts +17 -0
- package/dist/hooks/useUserConfig/useUserConfig.context.d.ts +9 -0
- package/dist/hooks/useUserConfig/useUserConfig.d.ts +9 -0
- package/dist/hooks/useUserConfig/useUserConfig.types.d.ts +30 -0
- package/dist/hooks/useUserConfig/useUserConfig.utils.d.ts +19 -0
- package/dist/hooks/useWebSocket/index.d.ts +2 -0
- package/dist/hooks/useWebSocket/useWebSocket.d.ts +17 -0
- package/dist/hooks/useWebSocket/useWebSocket.types.d.ts +27 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +10592 -0
- package/dist/main.js +10655 -0
- package/dist/pages/ChatPage/ChatPage.constants.d.ts +2 -0
- package/dist/pages/ChatPage/ChatPage.d.ts +25 -0
- package/dist/pages/ChatPage/ChatPage.theme.d.ts +56 -0
- package/dist/pages/ChatPage/index.d.ts +4 -0
- package/dist/pages/IntroPage/IntroPage.d.ts +14 -0
- package/dist/pages/IntroPage/IntroPage.theme.d.ts +13 -0
- package/dist/pages/IntroPage/index.d.ts +4 -0
- package/dist/pages/LogsPage/LogsPage.d.ts +14 -0
- package/dist/pages/LogsPage/LogsPage.theme.d.ts +49 -0
- package/dist/pages/LogsPage/LogsPage.utils.d.ts +5 -0
- package/dist/pages/LogsPage/index.d.ts +4 -0
- package/dist/pages/SpawnedStrategyPage/SpawnedStrategyPage.d.ts +12 -0
- package/dist/pages/SpawnedStrategyPage/index.d.ts +2 -0
- package/dist/run-tui.d.ts +12 -0
- package/dist/run-tui.types.d.ts +12 -0
- package/dist/utils/debug.d.ts +12 -0
- package/dist/utils/mouseEscape.d.ts +29 -0
- package/dist/utils/yogaLayout.d.ts +32 -0
- package/package.json +66 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { FrameTheme } from "./Frame.theme";
|
|
3
|
+
/** Definition of a single tab in the Frame header. */
|
|
4
|
+
export interface TabDefinition {
|
|
5
|
+
/** Route path this tab navigates to (e.g. "/chat"). */
|
|
6
|
+
readonly path: string;
|
|
7
|
+
/** Display label for the tab. */
|
|
8
|
+
readonly label: string;
|
|
9
|
+
/** Alt+number shortcut hint (e.g. "Alt+1"). */
|
|
10
|
+
readonly shortcut: string;
|
|
11
|
+
}
|
|
12
|
+
export interface FrameProps {
|
|
13
|
+
/**
|
|
14
|
+
* The route path of the currently active tab. Should match one of the
|
|
15
|
+
* `path` values in `tabs`. Used to highlight the correct tab header.
|
|
16
|
+
*/
|
|
17
|
+
readonly activeTabPath: string;
|
|
18
|
+
/** Tab definitions to render in the header. */
|
|
19
|
+
readonly tabs: readonly TabDefinition[];
|
|
20
|
+
/** Called when the user selects a tab (by keyboard or click). */
|
|
21
|
+
readonly onTabSelect: (path: string) => void;
|
|
22
|
+
/** Content to render in the body area (the active page). */
|
|
23
|
+
readonly children: React.ReactNode;
|
|
24
|
+
/** Content rendered at the bottom of the frame (pinned). */
|
|
25
|
+
readonly footer?: React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
export declare function Frame({ activeTabPath, tabs, onTabSelect, children, footer, }: FrameProps): React.ReactElement;
|
|
28
|
+
export interface FrameRenderProps {
|
|
29
|
+
/** Resolved theme style objects. */
|
|
30
|
+
readonly theme: FrameTheme;
|
|
31
|
+
/** Route path of the currently active tab. */
|
|
32
|
+
readonly activeTabPath: string;
|
|
33
|
+
/** Tab definitions to render in the header. */
|
|
34
|
+
readonly tabs: readonly TabDefinition[];
|
|
35
|
+
/** Terminal height in rows, used to size the root container. */
|
|
36
|
+
readonly terminalHeight: number;
|
|
37
|
+
/** Terminal width in columns, used to size the root container. */
|
|
38
|
+
readonly terminalWidth: number;
|
|
39
|
+
/** Called when a tab is selected. */
|
|
40
|
+
readonly onTabSelect: (path: string) => void;
|
|
41
|
+
/** Content to render in the body area. */
|
|
42
|
+
readonly children: React.ReactNode;
|
|
43
|
+
/** Content rendered at the bottom of the frame (pinned). */
|
|
44
|
+
readonly footer?: React.ReactNode;
|
|
45
|
+
/** Debug render ref to attach to root Box. */
|
|
46
|
+
readonly debugRef?: React.Ref<import("ink").DOMElement>;
|
|
47
|
+
}
|
|
48
|
+
export declare function FrameRender({ theme, activeTabPath, tabs, terminalHeight, terminalWidth, onTabSelect, children, footer, debugRef, }: FrameRenderProps): React.ReactElement;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** Spread-ready style objects for the Frame component. */
|
|
2
|
+
export interface FrameTheme {
|
|
3
|
+
/** Root container (column layout). Height is set dynamically by the container. */
|
|
4
|
+
readonly root: {
|
|
5
|
+
readonly flexDirection: "column";
|
|
6
|
+
readonly backgroundColor: string;
|
|
7
|
+
};
|
|
8
|
+
/** Tab bar container. */
|
|
9
|
+
readonly tabBar: {
|
|
10
|
+
readonly flexDirection: "row";
|
|
11
|
+
readonly gap: number;
|
|
12
|
+
readonly paddingX: number;
|
|
13
|
+
readonly marginBottom: number;
|
|
14
|
+
};
|
|
15
|
+
/** Style for an active tab label. */
|
|
16
|
+
readonly activeTab: {
|
|
17
|
+
readonly bold: boolean;
|
|
18
|
+
readonly color: string;
|
|
19
|
+
readonly underline: boolean;
|
|
20
|
+
};
|
|
21
|
+
/** Style for an inactive tab label. */
|
|
22
|
+
readonly inactiveTab: {
|
|
23
|
+
readonly dimColor: boolean;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Style applied (merged on top of the active/inactive style) when the
|
|
27
|
+
* pointer is hovering over a tab. Only sets the visual highlight —
|
|
28
|
+
* underline / bold come from the base style.
|
|
29
|
+
*/
|
|
30
|
+
readonly hoveredTab: {
|
|
31
|
+
readonly color: string;
|
|
32
|
+
readonly bold: boolean;
|
|
33
|
+
};
|
|
34
|
+
/** Style for the tab shortcut hint (e.g. "Alt+1"). */
|
|
35
|
+
readonly tabHint: {
|
|
36
|
+
readonly dimColor: boolean;
|
|
37
|
+
};
|
|
38
|
+
/** Content area below the tab bar (grows to fill available space). */
|
|
39
|
+
readonly content: {
|
|
40
|
+
readonly flexDirection: "column";
|
|
41
|
+
readonly flexGrow: number;
|
|
42
|
+
};
|
|
43
|
+
/** Footer area pinned to the bottom of the frame. */
|
|
44
|
+
readonly footer: {
|
|
45
|
+
readonly flexDirection: "column";
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Returns themed style objects for the Frame component.
|
|
50
|
+
* Consumes global tokens via `useTheme()`.
|
|
51
|
+
*/
|
|
52
|
+
export declare function useFrameTheme(): FrameTheme;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { HideProps } from "./Hide.types";
|
|
3
|
+
/**
|
|
4
|
+
* Conditionally hide children based on terminal width.
|
|
5
|
+
*
|
|
6
|
+
* Accepts either a named breakpoint (`"sm"`, `"md"`, etc.) or a raw
|
|
7
|
+
* column count for both `below` and `above` props.
|
|
8
|
+
*
|
|
9
|
+
* @param props - Visibility conditions and children.
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <Hide below="md">
|
|
13
|
+
* <DetailedSidebar />
|
|
14
|
+
* </Hide>
|
|
15
|
+
* <Hide below={128}>
|
|
16
|
+
* <TitleLogo />
|
|
17
|
+
* </Hide>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function Hide({ below, above, children }: HideProps): React.ReactNode;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BreakpointName } from "../../Theme";
|
|
2
|
+
/** A breakpoint name or a specific column width. */
|
|
3
|
+
export type BreakpointOrColumns = BreakpointName | number;
|
|
4
|
+
/** Props for the `Hide` component. */
|
|
5
|
+
export interface HideProps {
|
|
6
|
+
/** Hide children when terminal width is below this breakpoint or column count. */
|
|
7
|
+
readonly below?: BreakpointOrColumns;
|
|
8
|
+
/** Hide children when terminal width is at or above this breakpoint or column count. */
|
|
9
|
+
readonly above?: BreakpointOrColumns;
|
|
10
|
+
/** Child content to conditionally render. */
|
|
11
|
+
readonly children: React.ReactNode;
|
|
12
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ChatMessage, MessageSegment } from "../../../hooks/useChat/useChat.types";
|
|
3
|
+
import { useMessageListTheme } from "../MessageList.theme";
|
|
4
|
+
import type { GroupedChatMessage } from "../MessageList.types";
|
|
5
|
+
/**
|
|
6
|
+
* Truncate long tool-call argument blobs so they fit a single visual line.
|
|
7
|
+
*/
|
|
8
|
+
export declare const MAX_TOOL_ARGS_PREVIEW_LENGTH = 200;
|
|
9
|
+
export interface AgentMessageProps {
|
|
10
|
+
/** Display name of the agent (e.g. "planner", "builder"). */
|
|
11
|
+
readonly sender: string;
|
|
12
|
+
/**
|
|
13
|
+
* Ordered body segments. When omitted, `fallbackText` is rendered as a
|
|
14
|
+
* single text segment so the component still works for legacy/simple
|
|
15
|
+
* messages that don't yet emit segmented events.
|
|
16
|
+
*/
|
|
17
|
+
readonly segments?: readonly MessageSegment[];
|
|
18
|
+
/** Plain text body used when `segments` is empty or undefined. */
|
|
19
|
+
readonly fallbackText: string;
|
|
20
|
+
/** Whether the message is still receiving streaming events. */
|
|
21
|
+
readonly streaming: boolean;
|
|
22
|
+
/** Provider/model identifier used for this call. */
|
|
23
|
+
readonly model?: string;
|
|
24
|
+
/** Maximum model context tokens, when known. */
|
|
25
|
+
readonly contextWindow?: number;
|
|
26
|
+
/** Final model-step context usage. */
|
|
27
|
+
readonly contextUsage?: ChatMessage["contextUsage"];
|
|
28
|
+
/** Call start timestamp in milliseconds. */
|
|
29
|
+
readonly startedAt: number;
|
|
30
|
+
/** Call completion timestamp in milliseconds. */
|
|
31
|
+
readonly completedAt?: number;
|
|
32
|
+
/** Messages emitted by `launch_strategy` calls inside this agent message. */
|
|
33
|
+
readonly subMessages?: readonly GroupedChatMessage[];
|
|
34
|
+
/** Opens a spawned strategy transcript in its dedicated page. */
|
|
35
|
+
readonly onOpenSubStrategy?: (toolCallId: string) => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Renders a single agent message with rich, ordered body segments.
|
|
39
|
+
*
|
|
40
|
+
* Each segment kind (text, tool-call, tool-result, thinking)
|
|
41
|
+
* gets its own visual treatment so that the user can distinguish the
|
|
42
|
+
* agent's prose from its tool invocations and reasoning at a glance.
|
|
43
|
+
*/
|
|
44
|
+
export declare function AgentMessage({ sender, segments, fallbackText, streaming, model, contextWindow, contextUsage, startedAt, completedAt, subMessages, onOpenSubStrategy, }: AgentMessageProps): React.ReactElement;
|
|
45
|
+
export interface AgentMessageRenderProps {
|
|
46
|
+
/** Resolved MessageList theme styles. */
|
|
47
|
+
readonly theme: ReturnType<typeof useMessageListTheme>;
|
|
48
|
+
/** Display name of the agent. */
|
|
49
|
+
readonly sender: string;
|
|
50
|
+
/** Ordered body segments. */
|
|
51
|
+
readonly segments: readonly MessageSegment[];
|
|
52
|
+
/** Whether the message is still receiving streaming events. */
|
|
53
|
+
readonly streaming: boolean;
|
|
54
|
+
readonly model?: string;
|
|
55
|
+
readonly contextWindow?: number;
|
|
56
|
+
readonly contextUsage?: ChatMessage["contextUsage"];
|
|
57
|
+
readonly startedAt: number;
|
|
58
|
+
readonly completedAt?: number;
|
|
59
|
+
/** Messages emitted by `launch_strategy` calls inside this agent message. */
|
|
60
|
+
readonly subMessages: readonly GroupedChatMessage[];
|
|
61
|
+
/** Opens a spawned strategy transcript in its dedicated page. */
|
|
62
|
+
readonly onOpenSubStrategy?: (toolCallId: string) => void;
|
|
63
|
+
}
|
|
64
|
+
export declare function AgentMessageRender({ theme, sender, segments, streaming, model, contextWindow, contextUsage, startedAt, completedAt, subMessages, onOpenSubStrategy, }: AgentMessageRenderProps): React.ReactElement;
|
|
65
|
+
/**
|
|
66
|
+
* Trim long argument blobs to a single-line preview suffixed with ellipsis.
|
|
67
|
+
*
|
|
68
|
+
* Exported so the row-height estimator can compute heights against the
|
|
69
|
+
* exact same string the renderer will draw.
|
|
70
|
+
*/
|
|
71
|
+
export declare function truncatePreview(value: string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ContextUsageModalPayload } from "./ContextUsageModal.types";
|
|
3
|
+
/** Modal showing the detailed token breakdown behind the context meter. */
|
|
4
|
+
export declare function ContextUsageModal(): React.ReactElement | null;
|
|
5
|
+
export interface ContextUsageModalRenderProps {
|
|
6
|
+
/** Context usage details to render. */
|
|
7
|
+
readonly payload: ContextUsageModalPayload;
|
|
8
|
+
}
|
|
9
|
+
export declare function ContextUsageModalRender({ payload, }: ContextUsageModalRenderProps): React.ReactElement;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ContextUsageWire } from "@comma-agents/daemon";
|
|
2
|
+
/** Payload carried when opening the context usage details modal. */
|
|
3
|
+
export interface ContextUsageModalPayload {
|
|
4
|
+
/** Agent name shown in the modal title. */
|
|
5
|
+
readonly agentName: string;
|
|
6
|
+
/** Provider/model identifier used for the agent call. */
|
|
7
|
+
readonly model?: string;
|
|
8
|
+
/** Maximum context window for the model, when known. */
|
|
9
|
+
readonly contextWindow?: number;
|
|
10
|
+
/** Final model-step context usage to display. */
|
|
11
|
+
readonly contextUsage: ContextUsageWire;
|
|
12
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { ContextUsageModalRenderProps } from "./ContextUsageModal";
|
|
2
|
+
export { ContextUsageModal, ContextUsageModalRender, } from "./ContextUsageModal";
|
|
3
|
+
export { CONTEXT_USAGE_MODAL_ID } from "./ContextUsageModal.constants";
|
|
4
|
+
export type { ContextUsageModalPayload } from "./ContextUsageModal.types";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Heading prefix glyph rendered before the heading text. Mirrors how
|
|
3
|
+
* shells display headings (e.g. `# h1`) so users recognise the level
|
|
4
|
+
* without relying on font weight alone.
|
|
5
|
+
*
|
|
6
|
+
* The `#` count matches the heading depth (1..6).
|
|
7
|
+
*/
|
|
8
|
+
export declare const HEADING_PREFIX_CHAR = "#";
|
|
9
|
+
/**
|
|
10
|
+
* Bullet glyph for unordered lists. Single cell wide for predictable
|
|
11
|
+
* column alignment when the row estimator counts wrapped widths.
|
|
12
|
+
*/
|
|
13
|
+
export declare const UNORDERED_LIST_BULLET = "\u2022";
|
|
14
|
+
/**
|
|
15
|
+
* Indent applied per nesting level for nested lists. Two spaces matches
|
|
16
|
+
* the source-text indent used by `marked`'s loose tokenizer and keeps
|
|
17
|
+
* arithmetic with the row estimator simple.
|
|
18
|
+
*/
|
|
19
|
+
export declare const LIST_INDENT_PER_LEVEL = 2;
|
|
20
|
+
/**
|
|
21
|
+
* Glyph drawn at the head of every blockquote line. Vertical bar is
|
|
22
|
+
* the most readable terminal-safe blockquote marker.
|
|
23
|
+
*/
|
|
24
|
+
export declare const BLOCKQUOTE_PREFIX = "\u2502 ";
|
|
25
|
+
/**
|
|
26
|
+
* Glyph used to render `<hr>` markdown. Repeated to a sensible width;
|
|
27
|
+
* the renderer picks the actual repetition count based on the viewport.
|
|
28
|
+
*/
|
|
29
|
+
export declare const HORIZONTAL_RULE_CHAR = "\u2500";
|
|
30
|
+
/**
|
|
31
|
+
* Default character width for the horizontal rule when the renderer is
|
|
32
|
+
* not provided a viewport width. Matches the global
|
|
33
|
+
* {@link Theme.separator.width} fallback in `theme.ts`.
|
|
34
|
+
*/
|
|
35
|
+
export declare const HORIZONTAL_RULE_DEFAULT_WIDTH = 60;
|
|
36
|
+
/**
|
|
37
|
+
* Number of trailing rendered lines to keep when summarising a
|
|
38
|
+
* `thinking` segment in the agent message. Anything earlier is
|
|
39
|
+
* truncated and replaced with a `\u2026` ellipsis line.
|
|
40
|
+
*
|
|
41
|
+
* Five lines is a compromise between giving the user a sense of the
|
|
42
|
+
* agent's reasoning shape and keeping long deliberations from
|
|
43
|
+
* dominating the viewport.
|
|
44
|
+
*/
|
|
45
|
+
export declare const THINKING_TRUNCATION_LINE_COUNT = 5;
|
|
46
|
+
/**
|
|
47
|
+
* Single-character ellipsis appended to truncated thinking output.
|
|
48
|
+
* Matches the rest of the codebase (`AgentMessage.tsx`,
|
|
49
|
+
* `ToolCallView.constants.ts`).
|
|
50
|
+
*/
|
|
51
|
+
export declare const THINKING_ELLIPSIS_LINE = "\u2026";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { MarkdownViewProps, MarkdownViewRenderProps } from "./MarkdownView.types";
|
|
3
|
+
import { inlineSpansToPlainText } from "./MarkdownView.utils";
|
|
4
|
+
/**
|
|
5
|
+
* Render a Markdown source string as themed Ink elements.
|
|
6
|
+
*
|
|
7
|
+
* Lex-and-render: the source is re-tokenised on every render so
|
|
8
|
+
* streaming agent output (which appends to the same string between
|
|
9
|
+
* frames) renders as soon as new tokens close. `marked` auto-finalises
|
|
10
|
+
* unfinished fences/lists, so partial output never visually corrupts —
|
|
11
|
+
* the worst case is a paragraph that flips into a code-block once the
|
|
12
|
+
* trailing fence arrives.
|
|
13
|
+
*
|
|
14
|
+
* Component is intentionally render-pure beyond the lex step so it
|
|
15
|
+
* can be measured by `ScrollableView` via Ink's headless `measureLayout`
|
|
16
|
+
* without producing different output than the live render.
|
|
17
|
+
*/
|
|
18
|
+
export declare function MarkdownView({ markdown, width, }: MarkdownViewProps): React.ReactElement;
|
|
19
|
+
/**
|
|
20
|
+
* Pure render half of {@link MarkdownView}.
|
|
21
|
+
*
|
|
22
|
+
* Split out so unit tests can drive the renderer with a hand-crafted
|
|
23
|
+
* block tree and a stub theme without having to round-trip through the
|
|
24
|
+
* `marked` lexer. Same pattern as
|
|
25
|
+
* {@link import("../../CodeView").CodeViewRender} and
|
|
26
|
+
* {@link import("../ToolCallView").ToolCallViewRender}.
|
|
27
|
+
*/
|
|
28
|
+
export declare function MarkdownViewRender({ blocks, theme, width, }: MarkdownViewRenderProps): React.ReactElement;
|
|
29
|
+
/**
|
|
30
|
+
* Convenience re-export so `AgentMessage`'s row estimator can pick up
|
|
31
|
+
* the same plain-text projection the renderer uses for tables and
|
|
32
|
+
* tests without depending on the utils file directly.
|
|
33
|
+
*/
|
|
34
|
+
export { inlineSpansToPlainText };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { type ThemeOf } from "../../../Theme";
|
|
2
|
+
/** Memoized themed style objects for the {@link MarkdownView} component. */
|
|
3
|
+
export declare const useMarkdownViewTheme: () => {
|
|
4
|
+
/** Outer container wrapping the entire rendered document. */
|
|
5
|
+
root: {
|
|
6
|
+
flexDirection: "column";
|
|
7
|
+
};
|
|
8
|
+
/** Container for a paragraph block. */
|
|
9
|
+
paragraph: {
|
|
10
|
+
flexDirection: "column";
|
|
11
|
+
};
|
|
12
|
+
/** Container row for a single list item. */
|
|
13
|
+
listItemRow: {
|
|
14
|
+
flexDirection: "row";
|
|
15
|
+
};
|
|
16
|
+
/** Bullet / ordinal column at the start of a list-item row. */
|
|
17
|
+
listMarker: {
|
|
18
|
+
color: string;
|
|
19
|
+
bold: boolean;
|
|
20
|
+
};
|
|
21
|
+
/** Inner column used to stack the item's content + nested blocks. */
|
|
22
|
+
listItemContent: {
|
|
23
|
+
flexDirection: "column";
|
|
24
|
+
};
|
|
25
|
+
/** Container for a blockquote (vertical-bar prefix is part of every line). */
|
|
26
|
+
blockquote: {
|
|
27
|
+
flexDirection: "column";
|
|
28
|
+
};
|
|
29
|
+
/** Style of the leading vertical-bar marker on each blockquote line. */
|
|
30
|
+
blockquoteMarker: {
|
|
31
|
+
color: string;
|
|
32
|
+
dimColor: boolean;
|
|
33
|
+
};
|
|
34
|
+
/** Heading text style; depth is applied by the renderer via the depth prefix. */
|
|
35
|
+
heading: {
|
|
36
|
+
bold: boolean;
|
|
37
|
+
color: string;
|
|
38
|
+
};
|
|
39
|
+
/** Faint heading prefix (e.g. `## `) so the depth is unambiguous. */
|
|
40
|
+
headingPrefix: {
|
|
41
|
+
dimColor: boolean;
|
|
42
|
+
color: string;
|
|
43
|
+
};
|
|
44
|
+
/** Inline `code` span style. */
|
|
45
|
+
inlineCode: {
|
|
46
|
+
color: string;
|
|
47
|
+
};
|
|
48
|
+
/** Inline `[text](url)` link text style. */
|
|
49
|
+
linkText: {
|
|
50
|
+
color: string;
|
|
51
|
+
underline: true;
|
|
52
|
+
};
|
|
53
|
+
/** Inline link's `(url)` companion style — dimmer than the text. */
|
|
54
|
+
linkUrl: {
|
|
55
|
+
color: string;
|
|
56
|
+
dimColor: boolean;
|
|
57
|
+
};
|
|
58
|
+
/** Strong / bold inline style. */
|
|
59
|
+
strong: {
|
|
60
|
+
bold: true;
|
|
61
|
+
};
|
|
62
|
+
/** Emphasised / italic inline style. */
|
|
63
|
+
em: {
|
|
64
|
+
italic: true;
|
|
65
|
+
};
|
|
66
|
+
/** Container around a horizontal rule. */
|
|
67
|
+
horizontalRule: {
|
|
68
|
+
flexDirection: "row";
|
|
69
|
+
};
|
|
70
|
+
/** Style of the horizontal rule glyph. */
|
|
71
|
+
horizontalRuleText: {
|
|
72
|
+
dimColor: boolean;
|
|
73
|
+
color: string;
|
|
74
|
+
};
|
|
75
|
+
/** Container around a rendered cli-table block. */
|
|
76
|
+
table: {
|
|
77
|
+
flexDirection: "column";
|
|
78
|
+
};
|
|
79
|
+
/** Style of the cli-table text payload. */
|
|
80
|
+
tableText: {
|
|
81
|
+
color: string;
|
|
82
|
+
};
|
|
83
|
+
/** Wrapper for plain paragraph text. */
|
|
84
|
+
paragraphText: {
|
|
85
|
+
wrap: "wrap";
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
/** Resolved style object shape returned by {@link useMarkdownViewTheme}. */
|
|
89
|
+
export type MarkdownViewTheme = ThemeOf<typeof useMarkdownViewTheme>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { BundledLanguage } from "shiki/langs";
|
|
2
|
+
import type { MarkdownViewTheme } from "./MarkdownView.theme";
|
|
3
|
+
/**
|
|
4
|
+
* Inline span — a leaf or one level of nested formatting that lives
|
|
5
|
+
* inside a single line of flowing text (paragraph, heading, list item,
|
|
6
|
+
* blockquote, table cell).
|
|
7
|
+
*
|
|
8
|
+
* The renderer flattens these into a single Ink `<Text>` element with
|
|
9
|
+
* nested `<Text>` style fragments, which is the only nesting Ink
|
|
10
|
+
* supports for inline styling.
|
|
11
|
+
*/
|
|
12
|
+
export type MdInline = {
|
|
13
|
+
readonly kind: "text";
|
|
14
|
+
readonly value: string;
|
|
15
|
+
} | {
|
|
16
|
+
readonly kind: "strong";
|
|
17
|
+
readonly children: readonly MdInline[];
|
|
18
|
+
} | {
|
|
19
|
+
readonly kind: "em";
|
|
20
|
+
readonly children: readonly MdInline[];
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: "code";
|
|
23
|
+
readonly value: string;
|
|
24
|
+
} | {
|
|
25
|
+
readonly kind: "link";
|
|
26
|
+
readonly text: string;
|
|
27
|
+
readonly href: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Block-level node — top-level entity in the rendered Markdown
|
|
31
|
+
* document. Each block becomes one or more Ink `<Box>`/`<Text>`
|
|
32
|
+
* elements, separated by a single blank row from its neighbour.
|
|
33
|
+
*/
|
|
34
|
+
export type MdBlock = {
|
|
35
|
+
readonly kind: "paragraph";
|
|
36
|
+
readonly children: readonly MdInline[];
|
|
37
|
+
} | {
|
|
38
|
+
readonly kind: "heading";
|
|
39
|
+
/** Heading depth, clamped to `1..6` to match Markdown spec. */
|
|
40
|
+
readonly depth: 1 | 2 | 3 | 4 | 5 | 6;
|
|
41
|
+
readonly children: readonly MdInline[];
|
|
42
|
+
} | {
|
|
43
|
+
readonly kind: "list";
|
|
44
|
+
readonly ordered: boolean;
|
|
45
|
+
/** 1-based starting index for ordered lists; ignored when `!ordered`. */
|
|
46
|
+
readonly start: number;
|
|
47
|
+
readonly items: readonly MdListItem[];
|
|
48
|
+
} | {
|
|
49
|
+
readonly kind: "blockquote";
|
|
50
|
+
readonly children: readonly MdBlock[];
|
|
51
|
+
} | {
|
|
52
|
+
readonly kind: "code";
|
|
53
|
+
/** Raw source text of the fenced block (no surrounding fences). */
|
|
54
|
+
readonly value: string;
|
|
55
|
+
/** Language identifier as written after the opening fence; may be empty. */
|
|
56
|
+
readonly language: string;
|
|
57
|
+
} | {
|
|
58
|
+
readonly kind: "table";
|
|
59
|
+
readonly header: readonly (readonly MdInline[])[];
|
|
60
|
+
readonly rows: readonly (readonly (readonly MdInline[])[])[];
|
|
61
|
+
} | {
|
|
62
|
+
readonly kind: "hr";
|
|
63
|
+
};
|
|
64
|
+
/** A single list item (may itself contain nested blocks). */
|
|
65
|
+
export interface MdListItem {
|
|
66
|
+
/** Inline content of the item's first line. */
|
|
67
|
+
readonly children: readonly MdInline[];
|
|
68
|
+
/** Nested blocks (e.g. a sub-list) rendered indented under the item. */
|
|
69
|
+
readonly nested: readonly MdBlock[];
|
|
70
|
+
}
|
|
71
|
+
/** Props for the {@link MarkdownView} container. */
|
|
72
|
+
export interface MarkdownViewProps {
|
|
73
|
+
/** Raw Markdown source. */
|
|
74
|
+
readonly markdown: string;
|
|
75
|
+
/**
|
|
76
|
+
* Optional override for the column width used to size the horizontal
|
|
77
|
+
* rule and the table layout. Defaults to
|
|
78
|
+
* {@link HORIZONTAL_RULE_DEFAULT_WIDTH}.
|
|
79
|
+
*/
|
|
80
|
+
readonly width?: number;
|
|
81
|
+
}
|
|
82
|
+
/** Props for the pure {@link MarkdownViewRender} function. */
|
|
83
|
+
export interface MarkdownViewRenderProps {
|
|
84
|
+
/** Block tree to render. */
|
|
85
|
+
readonly blocks: readonly MdBlock[];
|
|
86
|
+
/** Resolved theme styles. */
|
|
87
|
+
readonly theme: MarkdownViewTheme;
|
|
88
|
+
/** Effective column width for layout-sensitive blocks (hr, table). */
|
|
89
|
+
readonly width: number;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Re-export of shiki's bundled language union so the table-renderer's
|
|
93
|
+
* fenced-code dispatch can advertise its accepted set without each
|
|
94
|
+
* call site importing shiki directly.
|
|
95
|
+
*/
|
|
96
|
+
export type FencedLanguage = BundledLanguage;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { MdBlock, MdInline } from "./MarkdownView.types";
|
|
2
|
+
/**
|
|
3
|
+
* Convert raw Markdown source into our normalized
|
|
4
|
+
* {@link MdBlock} tree.
|
|
5
|
+
*
|
|
6
|
+
* `marked` is invoked in lexer-only mode — we never call `marked.parse`
|
|
7
|
+
* because we don't want HTML output, we want a renderable AST. Unknown
|
|
8
|
+
* or unsupported token types collapse into a paragraph containing
|
|
9
|
+
* their `raw` text so nothing is silently dropped from the rendered
|
|
10
|
+
* message.
|
|
11
|
+
*
|
|
12
|
+
* The function is pure and synchronous — same input always produces
|
|
13
|
+
* the same output. It's safe to invoke on every render even while a
|
|
14
|
+
* segment is streaming because `marked.lexer` is fast (microseconds
|
|
15
|
+
* for typical chat messages) and auto-closes incomplete fenced blocks
|
|
16
|
+
* by emitting them as code tokens.
|
|
17
|
+
*/
|
|
18
|
+
export declare function tokenizeMarkdown(source: string): readonly MdBlock[];
|
|
19
|
+
/**
|
|
20
|
+
* Flatten an inline span tree into its plain-text content.
|
|
21
|
+
*
|
|
22
|
+
* Used for:
|
|
23
|
+
* - table cells, where `cli-table3` measures column widths against the
|
|
24
|
+
* plain content (style escapes break its width math);
|
|
25
|
+
* - the row-height estimator, which counts wrapped widths against the
|
|
26
|
+
* same characters the renderer will draw.
|
|
27
|
+
*
|
|
28
|
+
* Links are rendered as `text (url)` to match the inline renderer's
|
|
29
|
+
* decision (see {@link MarkdownViewProps}).
|
|
30
|
+
*/
|
|
31
|
+
export declare function inlineSpansToPlainText(spans: readonly MdInline[]): string;
|
|
32
|
+
/**
|
|
33
|
+
* Render a parsed Markdown table to a single ASCII string suitable for
|
|
34
|
+
* a single Ink `<Text>` element. Column widths and borders are
|
|
35
|
+
* delegated to `cli-table3` which sizes each column to its widest
|
|
36
|
+
* cell. The output is plain (no shell colours) so Ink's line-wrap
|
|
37
|
+
* stays accurate.
|
|
38
|
+
*/
|
|
39
|
+
export declare function renderTableToText(header: readonly (readonly MdInline[])[], rows: readonly (readonly (readonly MdInline[])[])[]): string;
|
|
40
|
+
/**
|
|
41
|
+
* Truncate `text` to its last {@link THINKING_TRUNCATION_LINE_COUNT}
|
|
42
|
+
* lines, prepending an ellipsis line to indicate truncation occurred.
|
|
43
|
+
*
|
|
44
|
+
* Operates on already-rendered lines (i.e. post-Markdown layout). When
|
|
45
|
+
* the input has fewer lines than the cap the original string is
|
|
46
|
+
* returned unchanged so short reasoning passes don't grow an extra
|
|
47
|
+
* marker line.
|
|
48
|
+
*
|
|
49
|
+
* Pure — no allocation when the input fits.
|
|
50
|
+
*/
|
|
51
|
+
export declare function truncateToLastNLines(text: string, lineCount: number): string;
|
|
52
|
+
/**
|
|
53
|
+
* Convenience wrapper around {@link truncateToLastNLines} bound to the
|
|
54
|
+
* Phase-2 default cap. Exists so call sites read declaratively
|
|
55
|
+
* (`truncateThinking(text)`) and the constant stays a single source
|
|
56
|
+
* of truth.
|
|
57
|
+
*/
|
|
58
|
+
export declare function truncateThinking(text: string): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { MarkdownView, MarkdownViewRender } from "./MarkdownView";
|
|
2
|
+
export { HEADING_PREFIX_CHAR, HORIZONTAL_RULE_CHAR, HORIZONTAL_RULE_DEFAULT_WIDTH, LIST_INDENT_PER_LEVEL, THINKING_ELLIPSIS_LINE, THINKING_TRUNCATION_LINE_COUNT, UNORDERED_LIST_BULLET, } from "./MarkdownView.constants";
|
|
3
|
+
export type { MarkdownViewTheme } from "./MarkdownView.theme";
|
|
4
|
+
export { useMarkdownViewTheme } from "./MarkdownView.theme";
|
|
5
|
+
export type { MarkdownViewProps, MarkdownViewRenderProps, MdBlock, MdInline, MdListItem, } from "./MarkdownView.types";
|
|
6
|
+
export { inlineSpansToPlainText, renderTableToText, tokenizeMarkdown, truncateThinking, truncateToLastNLines, } from "./MarkdownView.utils";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ChatMessage } from "../../hooks/useChat/useChat.types";
|
|
3
|
+
import type { GroupedChatMessage, MessageListProps, MessageListRenderProps } from "./MessageList.types";
|
|
4
|
+
/**
|
|
5
|
+
* Scrollable, role-dispatching message list.
|
|
6
|
+
*
|
|
7
|
+
* Wraps `ScrollableView` so the user can scroll back through history with
|
|
8
|
+
* the mouse wheel. The list auto-pins to the latest message until the user
|
|
9
|
+
* scrolls up; once they scroll back down to the bottom, auto-pin re-engages
|
|
10
|
+
* — standard chat behavior. There is no concept of a "selected" message,
|
|
11
|
+
* so keyboard arrow-key navigation is intentionally absent.
|
|
12
|
+
*/
|
|
13
|
+
export declare function MessageList({ messages, onOpenSubStrategy, }: MessageListProps): React.ReactElement;
|
|
14
|
+
export declare function MessageListRender({ messages, debugRef, containerProps, emptyStateProps, emptyStateTextProps, onOpenSubStrategy, }: MessageListRenderProps): React.ReactElement;
|
|
15
|
+
/** Build a nested message tree from `parentToolCallId` lineage metadata. */
|
|
16
|
+
export declare function groupSubStrategyMessages(messages: readonly ChatMessage[]): readonly GroupedChatMessage[];
|
|
17
|
+
/** Return only messages emitted by a launch call and its nested launches. */
|
|
18
|
+
export declare function selectSubStrategyMessages(messages: readonly ChatMessage[], toolCallId: string): readonly ChatMessage[];
|
|
19
|
+
/** Resolve the strategy name advertised by a launch tool call. */
|
|
20
|
+
export declare function findSubStrategyName(messages: readonly ChatMessage[], toolCallId: string): string;
|