@nexus-cortex/tui 4.47.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 +202 -0
- package/NOTICE +2 -0
- package/README.md +13 -0
- package/bin/cli-full.js +23 -0
- package/bin/cortex-ui.js +26 -0
- package/bin/ink-ui.js +108 -0
- package/bin/launcher-dev.js +266 -0
- package/bin/launcher.js +516 -0
- package/dist/commands/agent/InteractiveAgentMenu.d.ts +100 -0
- package/dist/commands/agent/InteractiveAgentMenu.d.ts.map +1 -0
- package/dist/commands/agent/InteractiveAgentMenu.js +909 -0
- package/dist/commands/agent/InteractiveAgentMenu.js.map +1 -0
- package/dist/commands/agent/index.d.ts +55 -0
- package/dist/commands/agent/index.d.ts.map +1 -0
- package/dist/commands/agent/index.js +714 -0
- package/dist/commands/agent/index.js.map +1 -0
- package/dist/commands/chat/interactive.d.ts +13 -0
- package/dist/commands/chat/interactive.d.ts.map +1 -0
- package/dist/commands/chat/interactive.js +2055 -0
- package/dist/commands/chat/interactive.js.map +1 -0
- package/dist/commands/system-message/EditorLauncher.d.ts +65 -0
- package/dist/commands/system-message/EditorLauncher.d.ts.map +1 -0
- package/dist/commands/system-message/EditorLauncher.js +143 -0
- package/dist/commands/system-message/EditorLauncher.js.map +1 -0
- package/dist/commands/system-message/InlineEditor.d.ts +23 -0
- package/dist/commands/system-message/InlineEditor.d.ts.map +1 -0
- package/dist/commands/system-message/InlineEditor.js +225 -0
- package/dist/commands/system-message/InlineEditor.js.map +1 -0
- package/dist/commands/system-message/InteractiveMenu.d.ts +76 -0
- package/dist/commands/system-message/InteractiveMenu.d.ts.map +1 -0
- package/dist/commands/system-message/InteractiveMenu.js +979 -0
- package/dist/commands/system-message/InteractiveMenu.js.map +1 -0
- package/dist/commands/system-message/index.d.ts +56 -0
- package/dist/commands/system-message/index.d.ts.map +1 -0
- package/dist/commands/system-message/index.js +694 -0
- package/dist/commands/system-message/index.js.map +1 -0
- package/dist/commands/ui/artifacts.d.ts +14 -0
- package/dist/commands/ui/artifacts.d.ts.map +1 -0
- package/dist/commands/ui/artifacts.js +22 -0
- package/dist/commands/ui/artifacts.js.map +1 -0
- package/dist/commands/ui/config.d.ts +12 -0
- package/dist/commands/ui/config.d.ts.map +1 -0
- package/dist/commands/ui/config.js +26 -0
- package/dist/commands/ui/config.js.map +1 -0
- package/dist/commands/ui/context.d.ts +16 -0
- package/dist/commands/ui/context.d.ts.map +1 -0
- package/dist/commands/ui/context.js +28 -0
- package/dist/commands/ui/context.js.map +1 -0
- package/dist/commands/ui/middleware.d.ts +14 -0
- package/dist/commands/ui/middleware.d.ts.map +1 -0
- package/dist/commands/ui/middleware.js +22 -0
- package/dist/commands/ui/middleware.js.map +1 -0
- package/dist/commands/ui/models.d.ts +14 -0
- package/dist/commands/ui/models.d.ts.map +1 -0
- package/dist/commands/ui/models.js +50 -0
- package/dist/commands/ui/models.js.map +1 -0
- package/dist/commands/ui/permissions.d.ts +14 -0
- package/dist/commands/ui/permissions.d.ts.map +1 -0
- package/dist/commands/ui/permissions.js +22 -0
- package/dist/commands/ui/permissions.js.map +1 -0
- package/dist/commands/ui/sessions.d.ts +13 -0
- package/dist/commands/ui/sessions.d.ts.map +1 -0
- package/dist/commands/ui/sessions.js +45 -0
- package/dist/commands/ui/sessions.js.map +1 -0
- package/dist/commands/ui/system-messages.d.ts +5 -0
- package/dist/commands/ui/system-messages.d.ts.map +1 -0
- package/dist/commands/ui/system-messages.js +19 -0
- package/dist/commands/ui/system-messages.js.map +1 -0
- package/dist/commands/ui/themes.d.ts +12 -0
- package/dist/commands/ui/themes.d.ts.map +1 -0
- package/dist/commands/ui/themes.js +40 -0
- package/dist/commands/ui/themes.js.map +1 -0
- package/dist/commands/ui/tmux.d.ts +5 -0
- package/dist/commands/ui/tmux.d.ts.map +1 -0
- package/dist/commands/ui/tmux.js +19 -0
- package/dist/commands/ui/tmux.js.map +1 -0
- package/dist/cortex.d.ts +12 -0
- package/dist/cortex.d.ts.map +1 -0
- package/dist/cortex.js +320 -0
- package/dist/cortex.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +112 -0
- package/dist/index.js.map +1 -0
- package/dist/ink-ui/CortexApp.d.ts +28 -0
- package/dist/ink-ui/CortexApp.d.ts.map +1 -0
- package/dist/ink-ui/CortexApp.js +2291 -0
- package/dist/ink-ui/CortexApp.js.map +1 -0
- package/dist/ink-ui/SimpleInputBuffer.d.ts +63 -0
- package/dist/ink-ui/SimpleInputBuffer.d.ts.map +1 -0
- package/dist/ink-ui/SimpleInputBuffer.js +369 -0
- package/dist/ink-ui/SimpleInputBuffer.js.map +1 -0
- package/dist/ink-ui/commands/slashCommands.d.ts +40 -0
- package/dist/ink-ui/commands/slashCommands.d.ts.map +1 -0
- package/dist/ink-ui/commands/slashCommands.js +111 -0
- package/dist/ink-ui/commands/slashCommands.js.map +1 -0
- package/dist/ink-ui/commands/types.d.ts +161 -0
- package/dist/ink-ui/commands/types.d.ts.map +1 -0
- package/dist/ink-ui/commands/types.js +12 -0
- package/dist/ink-ui/commands/types.js.map +1 -0
- package/dist/ink-ui/components/ApprovalDialog.d.ts +21 -0
- package/dist/ink-ui/components/ApprovalDialog.d.ts.map +1 -0
- package/dist/ink-ui/components/ApprovalDialog.js +81 -0
- package/dist/ink-ui/components/ApprovalDialog.js.map +1 -0
- package/dist/ink-ui/components/CommandSuggestions.d.ts +19 -0
- package/dist/ink-ui/components/CommandSuggestions.d.ts.map +1 -0
- package/dist/ink-ui/components/CommandSuggestions.js +36 -0
- package/dist/ink-ui/components/CommandSuggestions.js.map +1 -0
- package/dist/ink-ui/components/DiffPreview.d.ts +60 -0
- package/dist/ink-ui/components/DiffPreview.d.ts.map +1 -0
- package/dist/ink-ui/components/DiffPreview.js +195 -0
- package/dist/ink-ui/components/DiffPreview.js.map +1 -0
- package/dist/ink-ui/components/DocumentPreview.d.ts +50 -0
- package/dist/ink-ui/components/DocumentPreview.d.ts.map +1 -0
- package/dist/ink-ui/components/DocumentPreview.js +92 -0
- package/dist/ink-ui/components/DocumentPreview.js.map +1 -0
- package/dist/ink-ui/components/MarkdownText.d.ts +27 -0
- package/dist/ink-ui/components/MarkdownText.d.ts.map +1 -0
- package/dist/ink-ui/components/MarkdownText.js +342 -0
- package/dist/ink-ui/components/MarkdownText.js.map +1 -0
- package/dist/ink-ui/components/MenuRenderer.d.ts +26 -0
- package/dist/ink-ui/components/MenuRenderer.d.ts.map +1 -0
- package/dist/ink-ui/components/MenuRenderer.js +264 -0
- package/dist/ink-ui/components/MenuRenderer.js.map +1 -0
- package/dist/ink-ui/components/ModelPickerDialog.d.ts +33 -0
- package/dist/ink-ui/components/ModelPickerDialog.d.ts.map +1 -0
- package/dist/ink-ui/components/ModelPickerDialog.js +98 -0
- package/dist/ink-ui/components/ModelPickerDialog.js.map +1 -0
- package/dist/ink-ui/components/StreamDisplay.d.ts +31 -0
- package/dist/ink-ui/components/StreamDisplay.d.ts.map +1 -0
- package/dist/ink-ui/components/StreamDisplay.js +573 -0
- package/dist/ink-ui/components/StreamDisplay.js.map +1 -0
- package/dist/ink-ui/components/SubAgentPanel.d.ts +98 -0
- package/dist/ink-ui/components/SubAgentPanel.d.ts.map +1 -0
- package/dist/ink-ui/components/SubAgentPanel.js +155 -0
- package/dist/ink-ui/components/SubAgentPanel.js.map +1 -0
- package/dist/ink-ui/components/ThinkingDisplay.d.ts +46 -0
- package/dist/ink-ui/components/ThinkingDisplay.d.ts.map +1 -0
- package/dist/ink-ui/components/ThinkingDisplay.js +176 -0
- package/dist/ink-ui/components/ThinkingDisplay.js.map +1 -0
- package/dist/ink-ui/components/ToolCallDisplay.d.ts +51 -0
- package/dist/ink-ui/components/ToolCallDisplay.d.ts.map +1 -0
- package/dist/ink-ui/components/ToolCallDisplay.js +378 -0
- package/dist/ink-ui/components/ToolCallDisplay.js.map +1 -0
- package/dist/ink-ui/components/WritePreview.d.ts +42 -0
- package/dist/ink-ui/components/WritePreview.d.ts.map +1 -0
- package/dist/ink-ui/components/WritePreview.js +100 -0
- package/dist/ink-ui/components/WritePreview.js.map +1 -0
- package/dist/ink-ui/contexts/KeypressContext.d.ts +32 -0
- package/dist/ink-ui/contexts/KeypressContext.d.ts.map +1 -0
- package/dist/ink-ui/contexts/KeypressContext.js +529 -0
- package/dist/ink-ui/contexts/KeypressContext.js.map +1 -0
- package/dist/ink-ui/contexts/SessionContext.d.ts +46 -0
- package/dist/ink-ui/contexts/SessionContext.d.ts.map +1 -0
- package/dist/ink-ui/contexts/SessionContext.js +162 -0
- package/dist/ink-ui/contexts/SessionContext.js.map +1 -0
- package/dist/ink-ui/core-stubs.d.ts +270 -0
- package/dist/ink-ui/core-stubs.d.ts.map +1 -0
- package/dist/ink-ui/core-stubs.js +276 -0
- package/dist/ink-ui/core-stubs.js.map +1 -0
- package/dist/ink-ui/cortex-types.d.ts +214 -0
- package/dist/ink-ui/cortex-types.d.ts.map +1 -0
- package/dist/ink-ui/cortex-types.js +52 -0
- package/dist/ink-ui/cortex-types.js.map +1 -0
- package/dist/ink-ui/hooks/useCortexStream.d.ts +75 -0
- package/dist/ink-ui/hooks/useCortexStream.d.ts.map +1 -0
- package/dist/ink-ui/hooks/useCortexStream.js +518 -0
- package/dist/ink-ui/hooks/useCortexStream.js.map +1 -0
- package/dist/ink-ui/hooks/useFocus.d.ts +11 -0
- package/dist/ink-ui/hooks/useFocus.d.ts.map +1 -0
- package/dist/ink-ui/hooks/useFocus.js +51 -0
- package/dist/ink-ui/hooks/useFocus.js.map +1 -0
- package/dist/ink-ui/hooks/useHistoryManager.d.ts +23 -0
- package/dist/ink-ui/hooks/useHistoryManager.d.ts.map +1 -0
- package/dist/ink-ui/hooks/useHistoryManager.js +63 -0
- package/dist/ink-ui/hooks/useHistoryManager.js.map +1 -0
- package/dist/ink-ui/hooks/useKeypress.d.ts +18 -0
- package/dist/ink-ui/hooks/useKeypress.d.ts.map +1 -0
- package/dist/ink-ui/hooks/useKeypress.js +27 -0
- package/dist/ink-ui/hooks/useKeypress.js.map +1 -0
- package/dist/ink-ui/hooks/useReactApprovalHandler.d.ts +74 -0
- package/dist/ink-ui/hooks/useReactApprovalHandler.d.ts.map +1 -0
- package/dist/ink-ui/hooks/useReactApprovalHandler.js +83 -0
- package/dist/ink-ui/hooks/useReactApprovalHandler.js.map +1 -0
- package/dist/ink-ui/hooks/useTerminalSize.d.ts +10 -0
- package/dist/ink-ui/hooks/useTerminalSize.d.ts.map +1 -0
- package/dist/ink-ui/hooks/useTerminalSize.js +28 -0
- package/dist/ink-ui/hooks/useTerminalSize.js.map +1 -0
- package/dist/ink-ui/semantic-colors.d.ts +8 -0
- package/dist/ink-ui/semantic-colors.d.ts.map +1 -0
- package/dist/ink-ui/semantic-colors.js +24 -0
- package/dist/ink-ui/semantic-colors.js.map +1 -0
- package/dist/ink-ui/state/extensions.d.ts +68 -0
- package/dist/ink-ui/state/extensions.d.ts.map +1 -0
- package/dist/ink-ui/state/extensions.js +97 -0
- package/dist/ink-ui/state/extensions.js.map +1 -0
- package/dist/ink-ui/themes/ansi-light.d.ts +8 -0
- package/dist/ink-ui/themes/ansi-light.d.ts.map +1 -0
- package/dist/ink-ui/themes/ansi-light.js +143 -0
- package/dist/ink-ui/themes/ansi-light.js.map +1 -0
- package/dist/ink-ui/themes/ansi.d.ts +8 -0
- package/dist/ink-ui/themes/ansi.d.ts.map +1 -0
- package/dist/ink-ui/themes/ansi.js +153 -0
- package/dist/ink-ui/themes/ansi.js.map +1 -0
- package/dist/ink-ui/themes/atom-one-dark.d.ts +8 -0
- package/dist/ink-ui/themes/atom-one-dark.d.ts.map +1 -0
- package/dist/ink-ui/themes/atom-one-dark.js +140 -0
- package/dist/ink-ui/themes/atom-one-dark.js.map +1 -0
- package/dist/ink-ui/themes/ayu-light.d.ts +8 -0
- package/dist/ink-ui/themes/ayu-light.d.ts.map +1 -0
- package/dist/ink-ui/themes/ayu-light.js +132 -0
- package/dist/ink-ui/themes/ayu-light.js.map +1 -0
- package/dist/ink-ui/themes/ayu.d.ts +8 -0
- package/dist/ink-ui/themes/ayu.d.ts.map +1 -0
- package/dist/ink-ui/themes/ayu.js +106 -0
- package/dist/ink-ui/themes/ayu.js.map +1 -0
- package/dist/ink-ui/themes/color-utils.d.ts +23 -0
- package/dist/ink-ui/themes/color-utils.d.ts.map +1 -0
- package/dist/ink-ui/themes/color-utils.js +237 -0
- package/dist/ink-ui/themes/color-utils.js.map +1 -0
- package/dist/ink-ui/themes/default-light.d.ts +8 -0
- package/dist/ink-ui/themes/default-light.d.ts.map +1 -0
- package/dist/ink-ui/themes/default-light.js +100 -0
- package/dist/ink-ui/themes/default-light.js.map +1 -0
- package/dist/ink-ui/themes/default.d.ts +8 -0
- package/dist/ink-ui/themes/default.d.ts.map +1 -0
- package/dist/ink-ui/themes/default.js +143 -0
- package/dist/ink-ui/themes/default.js.map +1 -0
- package/dist/ink-ui/themes/dracula.d.ts +8 -0
- package/dist/ink-ui/themes/dracula.d.ts.map +1 -0
- package/dist/ink-ui/themes/dracula.js +117 -0
- package/dist/ink-ui/themes/dracula.js.map +1 -0
- package/dist/ink-ui/themes/github-dark.d.ts +8 -0
- package/dist/ink-ui/themes/github-dark.d.ts.map +1 -0
- package/dist/ink-ui/themes/github-dark.js +140 -0
- package/dist/ink-ui/themes/github-dark.js.map +1 -0
- package/dist/ink-ui/themes/github-light.d.ts +8 -0
- package/dist/ink-ui/themes/github-light.d.ts.map +1 -0
- package/dist/ink-ui/themes/github-light.js +142 -0
- package/dist/ink-ui/themes/github-light.js.map +1 -0
- package/dist/ink-ui/themes/googlecode.d.ts +8 -0
- package/dist/ink-ui/themes/googlecode.d.ts.map +1 -0
- package/dist/ink-ui/themes/googlecode.js +139 -0
- package/dist/ink-ui/themes/googlecode.js.map +1 -0
- package/dist/ink-ui/themes/no-color.d.ts +8 -0
- package/dist/ink-ui/themes/no-color.d.ts.map +1 -0
- package/dist/ink-ui/themes/no-color.js +118 -0
- package/dist/ink-ui/themes/no-color.js.map +1 -0
- package/dist/ink-ui/themes/semantic-tokens.d.ts +40 -0
- package/dist/ink-ui/themes/semantic-tokens.d.ts.map +1 -0
- package/dist/ink-ui/themes/semantic-tokens.js +100 -0
- package/dist/ink-ui/themes/semantic-tokens.js.map +1 -0
- package/dist/ink-ui/themes/shades-of-purple.d.ts +12 -0
- package/dist/ink-ui/themes/shades-of-purple.d.ts.map +1 -0
- package/dist/ink-ui/themes/shades-of-purple.js +306 -0
- package/dist/ink-ui/themes/shades-of-purple.js.map +1 -0
- package/dist/ink-ui/themes/theme-manager.d.ts +67 -0
- package/dist/ink-ui/themes/theme-manager.d.ts.map +1 -0
- package/dist/ink-ui/themes/theme-manager.js +263 -0
- package/dist/ink-ui/themes/theme-manager.js.map +1 -0
- package/dist/ink-ui/themes/theme.d.ts +134 -0
- package/dist/ink-ui/themes/theme.d.ts.map +1 -0
- package/dist/ink-ui/themes/theme.js +390 -0
- package/dist/ink-ui/themes/theme.js.map +1 -0
- package/dist/ink-ui/themes/xcode.d.ts +8 -0
- package/dist/ink-ui/themes/xcode.d.ts.map +1 -0
- package/dist/ink-ui/themes/xcode.js +147 -0
- package/dist/ink-ui/themes/xcode.js.map +1 -0
- package/dist/ink-ui/types.d.ts +306 -0
- package/dist/ink-ui/types.d.ts.map +1 -0
- package/dist/ink-ui/types.js +65 -0
- package/dist/ink-ui/types.js.map +1 -0
- package/dist/ink-ui/utils/input.d.ts +18 -0
- package/dist/ink-ui/utils/input.d.ts.map +1 -0
- package/dist/ink-ui/utils/input.js +51 -0
- package/dist/ink-ui/utils/input.js.map +1 -0
- package/dist/ink-ui/utils/mouse.d.ts +33 -0
- package/dist/ink-ui/utils/mouse.d.ts.map +1 -0
- package/dist/ink-ui/utils/mouse.js +182 -0
- package/dist/ink-ui/utils/mouse.js.map +1 -0
- package/dist/services/BuiltinCommandLoader.d.ts +21 -0
- package/dist/services/BuiltinCommandLoader.d.ts.map +1 -0
- package/dist/services/BuiltinCommandLoader.js +182 -0
- package/dist/services/BuiltinCommandLoader.js.map +1 -0
- package/dist/services/CommandService.d.ts +39 -0
- package/dist/services/CommandService.d.ts.map +1 -0
- package/dist/services/CommandService.js +49 -0
- package/dist/services/CommandService.js.map +1 -0
- package/dist/services/FileCommandLoader.d.ts +16 -0
- package/dist/services/FileCommandLoader.d.ts.map +1 -0
- package/dist/services/FileCommandLoader.js +19 -0
- package/dist/services/FileCommandLoader.js.map +1 -0
- package/dist/services/McpPromptLoader.d.ts +16 -0
- package/dist/services/McpPromptLoader.d.ts.map +1 -0
- package/dist/services/McpPromptLoader.js +19 -0
- package/dist/services/McpPromptLoader.js.map +1 -0
- package/dist/services/index.d.ts +8 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +8 -0
- package/dist/services/index.js.map +1 -0
- package/dist/ui/ChalkMenuRenderer.d.ts +22 -0
- package/dist/ui/ChalkMenuRenderer.d.ts.map +1 -0
- package/dist/ui/ChalkMenuRenderer.js +478 -0
- package/dist/ui/ChalkMenuRenderer.js.map +1 -0
- package/dist/ui/ChalkModelPicker.d.ts +20 -0
- package/dist/ui/ChalkModelPicker.d.ts.map +1 -0
- package/dist/ui/ChalkModelPicker.js +363 -0
- package/dist/ui/ChalkModelPicker.js.map +1 -0
- package/dist/ui/ChalkThemePicker.d.ts +20 -0
- package/dist/ui/ChalkThemePicker.d.ts.map +1 -0
- package/dist/ui/ChalkThemePicker.js +370 -0
- package/dist/ui/ChalkThemePicker.js.map +1 -0
- package/dist/ui/InkApprovalDialog.d.ts +8 -0
- package/dist/ui/InkApprovalDialog.d.ts.map +1 -0
- package/dist/ui/InkApprovalDialog.js +25 -0
- package/dist/ui/InkApprovalDialog.js.map +1 -0
- package/dist/ui/InkCommandPalette.d.ts +43 -0
- package/dist/ui/InkCommandPalette.d.ts.map +1 -0
- package/dist/ui/InkCommandPalette.js +105 -0
- package/dist/ui/InkCommandPalette.js.map +1 -0
- package/dist/ui/InkConfigMenu.d.ts +24 -0
- package/dist/ui/InkConfigMenu.d.ts.map +1 -0
- package/dist/ui/InkConfigMenu.js +259 -0
- package/dist/ui/InkConfigMenu.js.map +1 -0
- package/dist/ui/InkHelp.d.ts +25 -0
- package/dist/ui/InkHelp.d.ts.map +1 -0
- package/dist/ui/InkHelp.js +55 -0
- package/dist/ui/InkHelp.js.map +1 -0
- package/dist/ui/InkMenuPicker.d.ts +19 -0
- package/dist/ui/InkMenuPicker.d.ts.map +1 -0
- package/dist/ui/InkMenuPicker.js +33 -0
- package/dist/ui/InkMenuPicker.js.map +1 -0
- package/dist/ui/InkModelPicker.d.ts +23 -0
- package/dist/ui/InkModelPicker.d.ts.map +1 -0
- package/dist/ui/InkModelPicker.js +53 -0
- package/dist/ui/InkModelPicker.js.map +1 -0
- package/dist/ui/PersistentInput.d.ts +91 -0
- package/dist/ui/PersistentInput.d.ts.map +1 -0
- package/dist/ui/PersistentInput.js +283 -0
- package/dist/ui/PersistentInput.js.map +1 -0
- package/dist/ui/RawInput.d.ts +27 -0
- package/dist/ui/RawInput.d.ts.map +1 -0
- package/dist/ui/RawInput.js +731 -0
- package/dist/ui/RawInput.js.map +1 -0
- package/dist/ui/SlashCommandAutocomplete.d.ts +94 -0
- package/dist/ui/SlashCommandAutocomplete.d.ts.map +1 -0
- package/dist/ui/SlashCommandAutocomplete.js +274 -0
- package/dist/ui/SlashCommandAutocomplete.js.map +1 -0
- package/dist/ui/SplashScreen.d.ts +76 -0
- package/dist/ui/SplashScreen.d.ts.map +1 -0
- package/dist/ui/SplashScreen.js +316 -0
- package/dist/ui/SplashScreen.js.map +1 -0
- package/dist/ui/components/ArtifactDashboard.d.ts +16 -0
- package/dist/ui/components/ArtifactDashboard.d.ts.map +1 -0
- package/dist/ui/components/ArtifactDashboard.js +102 -0
- package/dist/ui/components/ArtifactDashboard.js.map +1 -0
- package/dist/ui/components/ChatInput.d.ts +36 -0
- package/dist/ui/components/ChatInput.d.ts.map +1 -0
- package/dist/ui/components/ChatInput.js +11 -0
- package/dist/ui/components/ChatInput.js.map +1 -0
- package/dist/ui/components/ConfigWizard.d.ts +17 -0
- package/dist/ui/components/ConfigWizard.d.ts.map +1 -0
- package/dist/ui/components/ConfigWizard.js +134 -0
- package/dist/ui/components/ConfigWizard.js.map +1 -0
- package/dist/ui/components/ContextViewer.d.ts +18 -0
- package/dist/ui/components/ContextViewer.d.ts.map +1 -0
- package/dist/ui/components/ContextViewer.js +85 -0
- package/dist/ui/components/ContextViewer.js.map +1 -0
- package/dist/ui/components/MiddlewareDashboard.d.ts +16 -0
- package/dist/ui/components/MiddlewareDashboard.d.ts.map +1 -0
- package/dist/ui/components/MiddlewareDashboard.js +98 -0
- package/dist/ui/components/MiddlewareDashboard.js.map +1 -0
- package/dist/ui/components/ModelPicker.d.ts +24 -0
- package/dist/ui/components/ModelPicker.d.ts.map +1 -0
- package/dist/ui/components/ModelPicker.js +96 -0
- package/dist/ui/components/ModelPicker.js.map +1 -0
- package/dist/ui/components/MultiLineInput.d.ts +27 -0
- package/dist/ui/components/MultiLineInput.d.ts.map +1 -0
- package/dist/ui/components/MultiLineInput.js +182 -0
- package/dist/ui/components/MultiLineInput.js.map +1 -0
- package/dist/ui/components/PermissionsBrowser.d.ts +16 -0
- package/dist/ui/components/PermissionsBrowser.d.ts.map +1 -0
- package/dist/ui/components/PermissionsBrowser.js +110 -0
- package/dist/ui/components/PermissionsBrowser.js.map +1 -0
- package/dist/ui/components/SessionBrowser.d.ts +19 -0
- package/dist/ui/components/SessionBrowser.d.ts.map +1 -0
- package/dist/ui/components/SessionBrowser.js +66 -0
- package/dist/ui/components/SessionBrowser.js.map +1 -0
- package/dist/ui/components/StatusBar.d.ts +32 -0
- package/dist/ui/components/StatusBar.d.ts.map +1 -0
- package/dist/ui/components/StatusBar.js +27 -0
- package/dist/ui/components/StatusBar.js.map +1 -0
- package/dist/ui/components/SystemMessageBrowser.d.ts +11 -0
- package/dist/ui/components/SystemMessageBrowser.d.ts.map +1 -0
- package/dist/ui/components/SystemMessageBrowser.js +106 -0
- package/dist/ui/components/SystemMessageBrowser.js.map +1 -0
- package/dist/ui/components/ThemePicker.d.ts +11 -0
- package/dist/ui/components/ThemePicker.d.ts.map +1 -0
- package/dist/ui/components/ThemePicker.js +62 -0
- package/dist/ui/components/ThemePicker.js.map +1 -0
- package/dist/ui/components/TmuxBrowser.d.ts +11 -0
- package/dist/ui/components/TmuxBrowser.d.ts.map +1 -0
- package/dist/ui/components/TmuxBrowser.js +85 -0
- package/dist/ui/components/TmuxBrowser.js.map +1 -0
- package/dist/ui/components/index.d.ts +22 -0
- package/dist/ui/components/index.d.ts.map +1 -0
- package/dist/ui/components/index.js +21 -0
- package/dist/ui/components/index.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { ReactNode } from 'react';
|
|
7
|
+
import type { Content, PartListUnion } from '../core-stubs.js';
|
|
8
|
+
import type { HistoryItemWithoutId, HistoryItem, ConfirmationRequest } from '../types.js';
|
|
9
|
+
import type { Config, GitService, Logger } from '../core-stubs.js';
|
|
10
|
+
import type { LoadedSettings } from '@nexus-cortex/cli/dist/config/settings.js';
|
|
11
|
+
import type { UseHistoryManagerReturn } from '../hooks/useHistoryManager.js';
|
|
12
|
+
import type { SessionStatsState } from '../contexts/SessionContext.js';
|
|
13
|
+
import type { ExtensionUpdateAction, ExtensionUpdateStatus } from '../state/extensions.js';
|
|
14
|
+
export interface CommandContext {
|
|
15
|
+
invocation?: {
|
|
16
|
+
/** The raw, untrimmed input string from the user. */
|
|
17
|
+
raw: string;
|
|
18
|
+
/** The primary name of the command that was matched. */
|
|
19
|
+
name: string;
|
|
20
|
+
/** The arguments string that follows the command name. */
|
|
21
|
+
args: string;
|
|
22
|
+
};
|
|
23
|
+
services: {
|
|
24
|
+
config: Config | null;
|
|
25
|
+
settings: LoadedSettings;
|
|
26
|
+
git: GitService | undefined;
|
|
27
|
+
logger: Logger;
|
|
28
|
+
};
|
|
29
|
+
ui: {
|
|
30
|
+
/** Adds a new item to the history display. */
|
|
31
|
+
addItem: UseHistoryManagerReturn['addItem'];
|
|
32
|
+
/** Clears all history items and the console screen. */
|
|
33
|
+
clear: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* Sets the transient debug message displayed in the application footer in debug mode.
|
|
36
|
+
*/
|
|
37
|
+
setDebugMessage: (message: string) => void;
|
|
38
|
+
/** The currently pending history item, if any. */
|
|
39
|
+
pendingItem: HistoryItemWithoutId | null;
|
|
40
|
+
/**
|
|
41
|
+
* Sets a pending item in the history, which is useful for indicating
|
|
42
|
+
* that a long-running operation is in progress.
|
|
43
|
+
*
|
|
44
|
+
* @param item The history item to display as pending, or `null` to clear.
|
|
45
|
+
*/
|
|
46
|
+
setPendingItem: (item: HistoryItemWithoutId | null) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Loads a new set of history items, replacing the current history.
|
|
49
|
+
*
|
|
50
|
+
* @param history The array of history items to load.
|
|
51
|
+
*/
|
|
52
|
+
loadHistory: UseHistoryManagerReturn['loadHistory'];
|
|
53
|
+
/** Toggles a special display mode. */
|
|
54
|
+
toggleCorgiMode: () => void;
|
|
55
|
+
toggleDebugProfiler: () => void;
|
|
56
|
+
toggleVimEnabled: () => Promise<boolean>;
|
|
57
|
+
reloadCommands: () => void;
|
|
58
|
+
extensionsUpdateState: Map<string, ExtensionUpdateStatus>;
|
|
59
|
+
dispatchExtensionStateUpdate: (action: ExtensionUpdateAction) => void;
|
|
60
|
+
addConfirmUpdateExtensionRequest: (value: ConfirmationRequest) => void;
|
|
61
|
+
removeComponent: () => void;
|
|
62
|
+
};
|
|
63
|
+
session: {
|
|
64
|
+
stats: SessionStatsState;
|
|
65
|
+
/** A transient list of shell commands the user has approved for this session. */
|
|
66
|
+
sessionShellAllowlist: Set<string>;
|
|
67
|
+
};
|
|
68
|
+
overwriteConfirmed?: boolean;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The return type for a command action that results in scheduling a tool call.
|
|
72
|
+
*/
|
|
73
|
+
export interface ToolActionReturn {
|
|
74
|
+
type: 'tool';
|
|
75
|
+
toolName: string;
|
|
76
|
+
toolArgs: Record<string, unknown>;
|
|
77
|
+
}
|
|
78
|
+
/** The return type for a command action that results in the app quitting. */
|
|
79
|
+
export interface QuitActionReturn {
|
|
80
|
+
type: 'quit';
|
|
81
|
+
messages: HistoryItem[];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The return type for a command action that results in a simple message
|
|
85
|
+
* being displayed to the user.
|
|
86
|
+
*/
|
|
87
|
+
export interface MessageActionReturn {
|
|
88
|
+
type: 'message';
|
|
89
|
+
messageType: 'info' | 'error';
|
|
90
|
+
content: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The return type for a command action that needs to open a dialog.
|
|
94
|
+
*/
|
|
95
|
+
export interface OpenDialogActionReturn {
|
|
96
|
+
type: 'dialog';
|
|
97
|
+
props?: Record<string, unknown>;
|
|
98
|
+
dialog: 'help' | 'auth' | 'theme' | 'editor' | 'privacy' | 'settings' | 'sessionBrowser' | 'model' | 'permissions';
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The return type for a command action that results in replacing
|
|
102
|
+
* the entire conversation history.
|
|
103
|
+
*/
|
|
104
|
+
export interface LoadHistoryActionReturn {
|
|
105
|
+
type: 'load_history';
|
|
106
|
+
history: HistoryItemWithoutId[];
|
|
107
|
+
clientHistory: Content[];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The return type for a command action that should immediately submit
|
|
111
|
+
* content as a prompt to the Gemini model.
|
|
112
|
+
*/
|
|
113
|
+
export interface SubmitPromptActionReturn {
|
|
114
|
+
type: 'submit_prompt';
|
|
115
|
+
content: PartListUnion;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The return type for a command action that needs to pause and request
|
|
119
|
+
* confirmation for a set of shell commands before proceeding.
|
|
120
|
+
*/
|
|
121
|
+
export interface ConfirmShellCommandsActionReturn {
|
|
122
|
+
type: 'confirm_shell_commands';
|
|
123
|
+
/** The list of shell commands that require user confirmation. */
|
|
124
|
+
commandsToConfirm: string[];
|
|
125
|
+
/** The original invocation context to be re-run after confirmation. */
|
|
126
|
+
originalInvocation: {
|
|
127
|
+
raw: string;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
export interface ConfirmActionReturn {
|
|
131
|
+
type: 'confirm_action';
|
|
132
|
+
/** The React node to display as the confirmation prompt. */
|
|
133
|
+
prompt: ReactNode;
|
|
134
|
+
/** The original invocation context to be re-run after confirmation. */
|
|
135
|
+
originalInvocation: {
|
|
136
|
+
raw: string;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export interface OpenCustomDialogActionReturn {
|
|
140
|
+
type: 'custom_dialog';
|
|
141
|
+
component: ReactNode;
|
|
142
|
+
}
|
|
143
|
+
export type SlashCommandActionReturn = ToolActionReturn | MessageActionReturn | QuitActionReturn | OpenDialogActionReturn | LoadHistoryActionReturn | SubmitPromptActionReturn | ConfirmShellCommandsActionReturn | ConfirmActionReturn | OpenCustomDialogActionReturn;
|
|
144
|
+
export declare enum CommandKind {
|
|
145
|
+
BUILT_IN = "built-in",
|
|
146
|
+
FILE = "file",
|
|
147
|
+
MCP_PROMPT = "mcp-prompt"
|
|
148
|
+
}
|
|
149
|
+
export interface SlashCommand {
|
|
150
|
+
name: string;
|
|
151
|
+
altNames?: string[];
|
|
152
|
+
description: string;
|
|
153
|
+
hidden?: boolean;
|
|
154
|
+
kind: CommandKind;
|
|
155
|
+
extensionName?: string;
|
|
156
|
+
extensionId?: string;
|
|
157
|
+
action?: (context: CommandContext, args: string) => void | SlashCommandActionReturn | Promise<void | SlashCommandActionReturn>;
|
|
158
|
+
completion?: (context: CommandContext, partialArg: string) => Promise<string[]> | string[];
|
|
159
|
+
subCommands?: SlashCommand[];
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/ink-ui/commands/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,EACV,oBAAoB,EACpB,WAAW,EACX,mBAAmB,EACpB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,cAAc;IAE7B,UAAU,CAAC,EAAE;QACX,qDAAqD;QACrD,GAAG,EAAE,MAAM,CAAC;QACZ,wDAAwD;QACxD,IAAI,EAAE,MAAM,CAAC;QACb,0DAA0D;QAC1D,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IAEF,QAAQ,EAAE;QAER,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,QAAQ,EAAE,cAAc,CAAC;QACzB,GAAG,EAAE,UAAU,GAAG,SAAS,CAAC;QAC5B,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IAEF,EAAE,EAAE;QACF,8CAA8C;QAC9C,OAAO,EAAE,uBAAuB,CAAC,SAAS,CAAC,CAAC;QAC5C,uDAAuD;QACvD,KAAK,EAAE,MAAM,IAAI,CAAC;QAClB;;WAEG;QACH,eAAe,E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BAAY,WAAW;IACrB,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,UAAU,eAAe;CAC1B;AAGD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,IAAI,EAAE,WAAW,CAAC;IAGlB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,MAAM,CAAC,EAAE,CACP,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,MAAM,KAEV,IAAI,GACJ,wBAAwB,GACxB,OAAO,CAAC,IAAI,GAAG,wBAAwB,CAAC,CAAC;IAG7C,UAAU,CAAC,EAAE,CACX,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC;IAElC,WAAW,CAAC,EAAE,YAAY,EAAE,CAAC;CAC9B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export var CommandKind;
|
|
7
|
+
(function (CommandKind) {
|
|
8
|
+
CommandKind["BUILT_IN"] = "built-in";
|
|
9
|
+
CommandKind["FILE"] = "file";
|
|
10
|
+
CommandKind["MCP_PROMPT"] = "mcp-prompt";
|
|
11
|
+
})(CommandKind || (CommandKind = {}));
|
|
12
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/ink-ui/commands/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAyLH,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,oCAAqB,CAAA;IACrB,4BAAa,CAAA;IACb,wCAAyB,CAAA;AAC3B,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Approval Dialog Component
|
|
3
|
+
*
|
|
4
|
+
* Renders a permission confirmation dialog for tool operations.
|
|
5
|
+
* Shows tool name, file path, and action buttons.
|
|
6
|
+
* For Edit tools, shows a diff preview before the approval options.
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import type { PendingApproval } from '../hooks/useReactApprovalHandler.js';
|
|
10
|
+
export interface ApprovalDialogProps {
|
|
11
|
+
pendingApproval: PendingApproval;
|
|
12
|
+
onApprove: () => void;
|
|
13
|
+
onDeny: () => void;
|
|
14
|
+
onApproveAndYolo: () => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Approval Dialog Component
|
|
18
|
+
*/
|
|
19
|
+
export declare const ApprovalDialog: React.FC<ApprovalDialogProps>;
|
|
20
|
+
export default ApprovalDialog;
|
|
21
|
+
//# sourceMappingURL=ApprovalDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApprovalDialog.d.ts","sourceRoot":"","sources":["../../../src/ink-ui/components/ApprovalDialog.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAG3E,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,eAAe,CAAC;IACjC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B;AA2CD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAyGxD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text, useInput } from 'ink';
|
|
3
|
+
import { Colors } from '@nexus-cortex/cli/dist/themes/colors.js';
|
|
4
|
+
/**
|
|
5
|
+
* Extract a display-friendly file name from tool input
|
|
6
|
+
*/
|
|
7
|
+
function extractFileName(toolInput) {
|
|
8
|
+
if (toolInput?.file_path) {
|
|
9
|
+
const parts = toolInput.file_path.split('/');
|
|
10
|
+
return parts[parts.length - 1] || toolInput.file_path;
|
|
11
|
+
}
|
|
12
|
+
if (toolInput?.path) {
|
|
13
|
+
const parts = toolInput.path.split('/');
|
|
14
|
+
return parts[parts.length - 1] || toolInput.path;
|
|
15
|
+
}
|
|
16
|
+
if (toolInput?.command) {
|
|
17
|
+
// For bash commands, show first part
|
|
18
|
+
const cmd = toolInput.command.split(' ')[0];
|
|
19
|
+
return cmd || 'command';
|
|
20
|
+
}
|
|
21
|
+
return 'operation';
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get action verb based on tool name
|
|
25
|
+
*/
|
|
26
|
+
function getActionVerb(toolName) {
|
|
27
|
+
switch (toolName) {
|
|
28
|
+
case 'Write':
|
|
29
|
+
return 'create';
|
|
30
|
+
case 'Edit':
|
|
31
|
+
return 'edit';
|
|
32
|
+
case 'Read':
|
|
33
|
+
return 'read';
|
|
34
|
+
case 'Bash':
|
|
35
|
+
return 'run';
|
|
36
|
+
case 'Glob':
|
|
37
|
+
case 'Grep':
|
|
38
|
+
return 'search';
|
|
39
|
+
default:
|
|
40
|
+
return 'execute';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Approval Dialog Component
|
|
45
|
+
*/
|
|
46
|
+
export const ApprovalDialog = ({ pendingApproval, onApprove, onDeny, onApproveAndYolo, }) => {
|
|
47
|
+
const { request } = pendingApproval;
|
|
48
|
+
const fileName = extractFileName(request.toolInput);
|
|
49
|
+
const actionVerb = getActionVerb(request.toolName);
|
|
50
|
+
// Handle keyboard input
|
|
51
|
+
useInput((input, key) => {
|
|
52
|
+
// 1 or y = approve
|
|
53
|
+
if (input === '1' || input === 'y' || input === 'Y') {
|
|
54
|
+
onApprove();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
// 2 or a = approve and enable YOLO
|
|
58
|
+
if (input === '2' || input === 'a' || input === 'A') {
|
|
59
|
+
onApproveAndYolo();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
// 3 or n or ESC = deny
|
|
63
|
+
if (input === '3' || input === 'n' || input === 'N' || key.escape) {
|
|
64
|
+
onDeny();
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
// Shift+Tab = approve and toggle YOLO
|
|
68
|
+
if (key.tab && key.shift) {
|
|
69
|
+
onApproveAndYolo();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
// Enter = approve (default action)
|
|
73
|
+
if (key.return) {
|
|
74
|
+
onApprove();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: Colors.AccentYellow, paddingX: 2, paddingY: 1, marginY: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: Colors.AccentYellow, bold: true, children: "\u26A0 Permission Required" }) }), _jsx(Box, { marginBottom: 1, children: _jsxs(Text, { children: ["Do you want to", ' ', _jsx(Text, { color: Colors.AccentCyan, children: actionVerb }), ' ', _jsx(Text, { color: Colors.White, bold: true, children: fileName }), "?"] }) }), _jsxs(Box, { marginBottom: 1, flexDirection: "column", children: [_jsxs(Text, { dimColor: true, children: ["Tool: ", request.toolName] }), request.toolInput?.file_path && (_jsxs(Text, { dimColor: true, children: ["Path: ", request.toolInput.file_path] })), request.toolInput?.command && (_jsxs(Text, { dimColor: true, children: ["Command: ", request.toolInput.command.substring(0, 80), request.toolInput.command.length > 80 ? '...' : ''] })), request.reason && (_jsxs(Text, { dimColor: true, children: ["Reason: ", request.reason] }))] }), _jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: [_jsx(Text, { color: Colors.AccentGreen, children: "\u276F 1." }), " Yes"] }), _jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: " 2." }), " Yes, auto-approve all (shift+tab)"] }), _jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: " 3." }), " No, skip (esc)"] })] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, italic: true, children: "Press 1/2/3, y/n, Enter, or Esc" }) })] }));
|
|
79
|
+
};
|
|
80
|
+
export default ApprovalDialog;
|
|
81
|
+
//# sourceMappingURL=ApprovalDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApprovalDialog.js","sourceRoot":"","sources":["../../../src/ink-ui/components/ApprovalDialog.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,yCAAyC,CAAC;AASjE;;GAEG;AACH,SAAS,eAAe,CAAC,SAAc;IACrC,IAAI,SAAS,EAAE,SAAS,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7C,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,SAAS,CAAC,SAAS,CAAC;IACxD,CAAC;IACD,IAAI,SAAS,EAAE,IAAI,EAAE,CAAC;QACpB,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxC,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC;IACnD,CAAC;IACD,IAAI,SAAS,EAAE,OAAO,EAAE,CAAC;QACvB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IAAQ,CAC1D,EACA,OAAO,CAAC,SAAS,EAAE,OAAO,IAAI,CAC7B,MAAC,IAAI,IAAC,QAAQ,gCAAW,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAQ,CAChI,EACA,OAAO,CAAC,MAAM,IAAI,CACjB,MAAC,IAAI,IAAC,QAAQ,+BAAU,OAAO,CAAC,MAAM,IAAQ,CAC/C,IACG,EAGN,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,aACzB,MAAC,IAAI,eACH,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,WAAW,0BAAa,YACvC,EACP,MAAC,IAAI,eACH,KAAC,IAAI,IAAC,QAAQ,2BAAY,0CACrB,EACP,MAAC,IAAI,eACH,KAAC,IAAI,IAAC,QAAQ,2BAAY,uBACrB,IACH,EAGN,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,KAAC,IAAI,IAAC,QAAQ,QAAC,MAAM,sDAEd,GACH,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CommandSuggestions - Autocomplete dropdown for slash commands
|
|
3
|
+
*
|
|
4
|
+
* Displays fuzzy-matched command suggestions as user types.
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { FlatCommand } from '../commands/slashCommands.js';
|
|
8
|
+
export interface CommandSuggestionsProps {
|
|
9
|
+
suggestions: FlatCommand[];
|
|
10
|
+
selectedIndex: number;
|
|
11
|
+
maxVisible?: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* CommandSuggestions - Dropdown showing matching slash commands
|
|
15
|
+
* Shows items with scroll indicators for navigating the full list
|
|
16
|
+
*/
|
|
17
|
+
export declare const CommandSuggestions: React.FC<CommandSuggestionsProps>;
|
|
18
|
+
export default CommandSuggestions;
|
|
19
|
+
//# sourceMappingURL=CommandSuggestions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandSuggestions.d.ts","sourceRoot":"","sources":["../../../src/ink-ui/components/CommandSuggestions.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEhE,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,WAAW,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAcD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAmGhE,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { Colors } from '@nexus-cortex/cli/dist/themes/colors.js';
|
|
4
|
+
/**
|
|
5
|
+
* Category icons
|
|
6
|
+
*/
|
|
7
|
+
const categoryIcons = {
|
|
8
|
+
core: '⚡',
|
|
9
|
+
model: '',
|
|
10
|
+
session: '',
|
|
11
|
+
config: '⚙',
|
|
12
|
+
tools: '',
|
|
13
|
+
mcp: '',
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* CommandSuggestions - Dropdown showing matching slash commands
|
|
17
|
+
* Shows items with scroll indicators for navigating the full list
|
|
18
|
+
*/
|
|
19
|
+
export const CommandSuggestions = ({ suggestions, selectedIndex, maxVisible = 8, }) => {
|
|
20
|
+
if (suggestions.length === 0) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
// Calculate scroll offset to keep selected item visible
|
|
24
|
+
const scrollOffset = Math.max(0, Math.min(selectedIndex - Math.floor(maxVisible / 2), suggestions.length - maxVisible));
|
|
25
|
+
const visibleSuggestions = suggestions.slice(scrollOffset, scrollOffset + maxVisible);
|
|
26
|
+
const showUpArrow = scrollOffset > 0;
|
|
27
|
+
const showDownArrow = scrollOffset + maxVisible < suggestions.length;
|
|
28
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: Colors.AccentCyan, paddingX: 1, marginBottom: 1, children: [_jsx(Box, { marginBottom: 0, children: _jsxs(Text, { dimColor: true, children: ["Commands (", suggestions.length, ")"] }) }), showUpArrow && (_jsx(Box, { children: _jsx(Text, { dimColor: true, children: " \u25B2 more" }) })), visibleSuggestions.map((suggestion, index) => {
|
|
29
|
+
const actualIndex = scrollOffset + index;
|
|
30
|
+
const isSelected = actualIndex === selectedIndex;
|
|
31
|
+
const icon = categoryIcons[suggestion.category] || '•';
|
|
32
|
+
return (_jsxs(Box, { flexDirection: "row", children: [_jsx(Text, { color: isSelected ? Colors.AccentCyan : undefined, children: isSelected ? '❯' : ' ' }), _jsxs(Text, { children: [" ", icon, " "] }), _jsx(Box, { width: 20, children: _jsx(Text, { color: isSelected ? Colors.AccentCyan : Colors.AccentGreen, bold: isSelected, children: suggestion.fullPath }) }), _jsx(Box, { flexGrow: 1, children: _jsx(Text, { color: isSelected ? Colors.Foreground : Colors.Gray, wrap: "truncate", children: suggestion.description }) })] }, suggestion.fullPath));
|
|
33
|
+
}), showDownArrow && (_jsx(Box, { children: _jsx(Text, { dimColor: true, children: " \u25BC more" }) })), _jsx(Box, { marginTop: 0, borderStyle: undefined, children: _jsx(Text, { dimColor: true, children: "\u2191\u2193 select \u2022 Tab complete \u2022 Enter execute \u2022 Esc close" }) })] }));
|
|
34
|
+
};
|
|
35
|
+
export default CommandSuggestions;
|
|
36
|
+
//# sourceMappingURL=CommandSuggestions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandSuggestions.js","sourceRoot":"","sources":["../../../src/ink-ui/components/CommandSuggestions.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,yCAAyC,CAAC;AASjE;;GAEG;AACH,MAAM,aAAa,GAA2B;IAC5C,IAAI,EAAE,GAAG;IACT,KAAK,EAAE,EAAE;IACT,OAAO,EAAE,EAAE;IACX,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,EAAE;IACT,GAAG,EAAE,EAAE;CACR,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAsC,CAAC,EACpE,WAAW,EACX,aAAa,EACb,UAAU,GAAG,CAAC,GACf,EAAE,EAAE;IACH,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,wDAAwD;IACxD,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CACvC,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,EAC1C,WAAW,CAAC,MAAM,GAAG,UAAU,CAChC,CAAC,CAAC;IAEH,MAAM,kBAAkB,GAAG,WAAW,CAAC,KAAK,CAC1C,YAAY,EACZ,YAAY,GAAG,UAAU,CAC1B,CAAC;IAEF,MAAM,WAAW,GAAG,YAAY,GAAG,CAAC,CAAC;IACrC,MAAM,aAAa,GAAG,YAAY,GAAG,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC;IAErE,OAAO,CACL,MAAC,GAAG,IACF,aAAa,EAAC,QAAQ,EACtB,WAAW,EAAC,QAAQ,EACpB,WAAW,EAAE,MAAM,CAAC,UAAU,EAC9B,QAAQ,EAAE,CAAC,EACX,YAAY,EAAE,CAAC,aAGf,KAAC,GAAG,IAAC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AAC,QAAQ,oCAAgB,GAC1B,CACP,EAGD,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,EAAE,WAAW,EAAE,SAAS,YACvC,KAAC,IAAI,IAAC,QAAQ,oGAEP,GACH,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DiffPreview - Standalone diff preview component for Edit tool results
|
|
3
|
+
*
|
|
4
|
+
* A simplified diff renderer that doesn't depend on Gemini CLI contexts.
|
|
5
|
+
* Shows file edits with proper + / - coloring.
|
|
6
|
+
*
|
|
7
|
+
* Uses shared DiffParser from @nexus-cortex/core for parsing unified diffs.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
export interface DiffPreviewProps {
|
|
11
|
+
/** Path to the file being edited */
|
|
12
|
+
filePath: string;
|
|
13
|
+
/** Original text being replaced */
|
|
14
|
+
oldString: string;
|
|
15
|
+
/** New text replacing the old string */
|
|
16
|
+
newString: string;
|
|
17
|
+
/** Terminal width for proper wrapping */
|
|
18
|
+
terminalWidth?: number;
|
|
19
|
+
/** Whether to show in compact mode */
|
|
20
|
+
compact?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* DiffPreview component for displaying Edit tool changes
|
|
24
|
+
*/
|
|
25
|
+
export declare const DiffPreview: React.FC<DiffPreviewProps>;
|
|
26
|
+
/**
|
|
27
|
+
* Compact inline diff for tool call display
|
|
28
|
+
*/
|
|
29
|
+
export declare const InlineDiffSummary: React.FC<{
|
|
30
|
+
filePath: string;
|
|
31
|
+
oldString: string;
|
|
32
|
+
newString: string;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Props for UnifiedDiffDisplay
|
|
36
|
+
*/
|
|
37
|
+
export interface UnifiedDiffDisplayProps {
|
|
38
|
+
/** The unified diff string from metadata.diff */
|
|
39
|
+
diffString: string;
|
|
40
|
+
/** Path to the file that was edited */
|
|
41
|
+
filePath?: string;
|
|
42
|
+
/** Terminal width for proper wrapping */
|
|
43
|
+
terminalWidth?: number;
|
|
44
|
+
/** Whether to show in compact mode */
|
|
45
|
+
compact?: boolean;
|
|
46
|
+
/** File statistics from metadata */
|
|
47
|
+
fileStats?: {
|
|
48
|
+
occurrences?: number;
|
|
49
|
+
operation?: string;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* UnifiedDiffDisplay - Renders a unified diff string (from Edit tool result metadata)
|
|
54
|
+
*
|
|
55
|
+
* This component displays the actual diff that was applied, not a preview.
|
|
56
|
+
* Shows "Applied" header and success indicator.
|
|
57
|
+
*/
|
|
58
|
+
export declare const UnifiedDiffDisplay: React.FC<UnifiedDiffDisplayProps>;
|
|
59
|
+
export default DiffPreview;
|
|
60
|
+
//# sourceMappingURL=DiffPreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DiffPreview.d.ts","sourceRoot":"","sources":["../../../src/ink-ui/components/DiffPreview.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAUvC,MAAM,WAAW,gBAAgB;IAC/B,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AA4HD;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAqDlD,CAAC;AA+CF;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAWA,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oCAAoC;IACpC,SAAS,CAAC,EAAE;QACV,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA8DhE,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* DiffPreview - Standalone diff preview component for Edit tool results
|
|
4
|
+
*
|
|
5
|
+
* A simplified diff renderer that doesn't depend on Gemini CLI contexts.
|
|
6
|
+
* Shows file edits with proper + / - coloring.
|
|
7
|
+
*
|
|
8
|
+
* Uses shared DiffParser from @nexus-cortex/core for parsing unified diffs.
|
|
9
|
+
*/
|
|
10
|
+
import { useMemo } from 'react';
|
|
11
|
+
import { Box, Text } from 'ink';
|
|
12
|
+
import { Colors } from '@nexus-cortex/cli/dist/themes/colors.js';
|
|
13
|
+
import * as Diff from 'diff';
|
|
14
|
+
import { parseUnifiedDiff as coreParseUnifiedDiff, } from '@nexus-cortex/core';
|
|
15
|
+
/**
|
|
16
|
+
* Convert core DiffLine type to React component format
|
|
17
|
+
*/
|
|
18
|
+
function adaptCoreDiffLine(line) {
|
|
19
|
+
return {
|
|
20
|
+
type: line.type === 'added' ? 'add' : line.type === 'removed' ? 'remove' : 'context',
|
|
21
|
+
content: line.content,
|
|
22
|
+
lineNumber: line.lineNumber,
|
|
23
|
+
oldLineNumber: line.oldLineNumber,
|
|
24
|
+
newLineNumber: line.newLineNumber,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Convert a ParsedDiff from core to React DiffLine array
|
|
29
|
+
*/
|
|
30
|
+
function adaptParsedDiff(parsed) {
|
|
31
|
+
const result = [];
|
|
32
|
+
for (const chunk of parsed.chunks) {
|
|
33
|
+
for (const line of chunk.contextBefore) {
|
|
34
|
+
result.push(adaptCoreDiffLine(line));
|
|
35
|
+
}
|
|
36
|
+
for (const line of chunk.changes) {
|
|
37
|
+
result.push(adaptCoreDiffLine(line));
|
|
38
|
+
}
|
|
39
|
+
for (const line of chunk.contextAfter) {
|
|
40
|
+
result.push(adaptCoreDiffLine(line));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Parse unified diff and extract lines with context
|
|
47
|
+
* Uses the shared DiffParser from core, then adapts to React format
|
|
48
|
+
*/
|
|
49
|
+
function parseUnifiedDiff(oldStr, newStr) {
|
|
50
|
+
try {
|
|
51
|
+
// Generate unified diff with context using the diff library
|
|
52
|
+
const patch = Diff.createPatch('file', oldStr, newStr, 'Original', 'Modified', { context: 3 });
|
|
53
|
+
// Use the shared parser from core
|
|
54
|
+
const parsed = coreParseUnifiedDiff(patch, 'file');
|
|
55
|
+
if (parsed) {
|
|
56
|
+
return adaptParsedDiff(parsed);
|
|
57
|
+
}
|
|
58
|
+
// Fallback to simple diff if core parser returns null
|
|
59
|
+
return generateSimpleFallbackDiff(oldStr, newStr);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
// Fallback to simple diff if unified diff fails
|
|
63
|
+
return generateSimpleFallbackDiff(oldStr, newStr);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Fallback simple diff for when unified diff fails
|
|
68
|
+
*/
|
|
69
|
+
function generateSimpleFallbackDiff(oldStr, newStr) {
|
|
70
|
+
const oldLines = oldStr.split('\n');
|
|
71
|
+
const newLines = newStr.split('\n');
|
|
72
|
+
const result = [];
|
|
73
|
+
const maxLines = Math.max(oldLines.length, newLines.length);
|
|
74
|
+
let lineNumber = 1;
|
|
75
|
+
for (let i = 0; i < maxLines; i++) {
|
|
76
|
+
const oldLine = oldLines[i];
|
|
77
|
+
const newLine = newLines[i];
|
|
78
|
+
if (oldLine === undefined && newLine !== undefined) {
|
|
79
|
+
result.push({ type: 'add', content: newLine, lineNumber: lineNumber++ });
|
|
80
|
+
}
|
|
81
|
+
else if (oldLine !== undefined && newLine === undefined) {
|
|
82
|
+
result.push({ type: 'remove', content: oldLine, lineNumber: lineNumber++ });
|
|
83
|
+
}
|
|
84
|
+
else if (oldLine !== newLine) {
|
|
85
|
+
if (oldLine !== undefined) {
|
|
86
|
+
result.push({ type: 'remove', content: oldLine, lineNumber: lineNumber++ });
|
|
87
|
+
}
|
|
88
|
+
if (newLine !== undefined) {
|
|
89
|
+
result.push({ type: 'add', content: newLine, lineNumber: lineNumber++ });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else if (oldLine !== undefined) {
|
|
93
|
+
result.push({ type: 'context', content: oldLine, lineNumber: lineNumber++ });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Truncate path for display
|
|
100
|
+
*/
|
|
101
|
+
function truncatePath(path, maxLength) {
|
|
102
|
+
if (path.length <= maxLength)
|
|
103
|
+
return path;
|
|
104
|
+
const parts = path.split('/');
|
|
105
|
+
if (parts.length <= 2)
|
|
106
|
+
return '...' + path.slice(-maxLength + 3);
|
|
107
|
+
// Show last parts
|
|
108
|
+
const lastTwo = parts.slice(-2).join('/');
|
|
109
|
+
if (lastTwo.length + 4 <= maxLength) {
|
|
110
|
+
return '.../' + lastTwo;
|
|
111
|
+
}
|
|
112
|
+
const lastPart = parts[parts.length - 1] || path;
|
|
113
|
+
return '...' + lastPart.slice(-maxLength + 3);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* DiffPreview component for displaying Edit tool changes
|
|
117
|
+
*/
|
|
118
|
+
export const DiffPreview = ({ filePath, oldString, newString, terminalWidth = 80, compact = false, }) => {
|
|
119
|
+
const diffLines = useMemo(() => {
|
|
120
|
+
return parseUnifiedDiff(oldString, newString);
|
|
121
|
+
}, [oldString, newString]);
|
|
122
|
+
// Count changes
|
|
123
|
+
const addCount = diffLines.filter((l) => l.type === 'add').length;
|
|
124
|
+
const removeCount = diffLines.filter((l) => l.type === 'remove').length;
|
|
125
|
+
// Calculate display width
|
|
126
|
+
const contentWidth = Math.max(terminalWidth - 8, 40);
|
|
127
|
+
const displayPath = truncatePath(filePath, contentWidth - 10);
|
|
128
|
+
// For compact mode, just show summary
|
|
129
|
+
if (compact) {
|
|
130
|
+
return (_jsxs(Box, { flexDirection: "row", children: [_jsx(Text, { color: Colors.AccentYellow, children: "Edit: " }), _jsx(Text, { dimColor: true, children: displayPath }), _jsx(Text, { children: " " }), _jsxs(Text, { color: Colors.AccentGreen, children: ["+", addCount] }), _jsx(Text, { dimColor: true, children: "/" }), _jsxs(Text, { color: Colors.AccentRed, children: ["-", removeCount] })] }));
|
|
131
|
+
}
|
|
132
|
+
return (_jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [_jsxs(Box, { children: [_jsx(Text, { color: Colors.AccentYellow, children: "Edit: " }), _jsx(Text, { color: Colors.White, children: displayPath }), _jsx(Text, { dimColor: true, children: " " }), _jsxs(Text, { color: Colors.AccentGreen, children: ["+", addCount] }), _jsx(Text, { dimColor: true, children: "/" }), _jsxs(Text, { color: Colors.AccentRed, children: ["-", removeCount] })] }), _jsx(Box, { flexDirection: "column", marginLeft: 2, children: diffLines.map((line, index) => (_jsx(DiffLineDisplay, { line: line }, index))) })] }));
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Single diff line display
|
|
136
|
+
*/
|
|
137
|
+
const DiffLineDisplay = ({ line }) => {
|
|
138
|
+
let lineNumStr;
|
|
139
|
+
let displayContent;
|
|
140
|
+
switch (line.type) {
|
|
141
|
+
case 'add':
|
|
142
|
+
lineNumStr = line.newLineNumber ? line.newLineNumber.toString().padStart(4, ' ') : ' ';
|
|
143
|
+
displayContent = (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: lineNumStr }), _jsxs(Text, { backgroundColor: "#2d5016", color: Colors.White, children: ["+ ", line.content] })] }));
|
|
144
|
+
break;
|
|
145
|
+
case 'remove':
|
|
146
|
+
lineNumStr = line.oldLineNumber ? line.oldLineNumber.toString().padStart(4, ' ') : ' ';
|
|
147
|
+
displayContent = (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: lineNumStr }), _jsxs(Text, { backgroundColor: "#5d1a1a", color: Colors.White, children: ["- ", line.content] })] }));
|
|
148
|
+
break;
|
|
149
|
+
case 'context':
|
|
150
|
+
lineNumStr = line.oldLineNumber ? line.oldLineNumber.toString().padStart(4, ' ') : ' ';
|
|
151
|
+
displayContent = (_jsx(Box, { children: _jsxs(Text, { dimColor: true, children: [lineNumStr, " ", line.content] }) }));
|
|
152
|
+
break;
|
|
153
|
+
default:
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
return displayContent;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Compact inline diff for tool call display
|
|
160
|
+
*/
|
|
161
|
+
export const InlineDiffSummary = ({ filePath, oldString, newString }) => {
|
|
162
|
+
const oldLineCount = oldString.split('\n').length;
|
|
163
|
+
const newLineCount = newString.split('\n').length;
|
|
164
|
+
return (_jsxs(Box, { children: [_jsx(Text, { color: Colors.AccentYellow, children: "Edit " }), _jsx(Text, { dimColor: true, children: truncatePath(filePath, 40) }), _jsxs(Text, { dimColor: true, children: [" (", oldLineCount, " \u2192 ", newLineCount, " lines)"] })] }));
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* UnifiedDiffDisplay - Renders a unified diff string (from Edit tool result metadata)
|
|
168
|
+
*
|
|
169
|
+
* This component displays the actual diff that was applied, not a preview.
|
|
170
|
+
* Shows "Applied" header and success indicator.
|
|
171
|
+
*/
|
|
172
|
+
export const UnifiedDiffDisplay = ({ diffString, filePath = 'file', terminalWidth = 80, compact = false, fileStats, }) => {
|
|
173
|
+
const diffLines = useMemo(() => {
|
|
174
|
+
// Use the shared parser from core and adapt to React format
|
|
175
|
+
const parsed = coreParseUnifiedDiff(diffString, filePath);
|
|
176
|
+
return parsed ? adaptParsedDiff(parsed) : [];
|
|
177
|
+
}, [diffString, filePath]);
|
|
178
|
+
// Count changes
|
|
179
|
+
const addCount = diffLines.filter((l) => l.type === 'add').length;
|
|
180
|
+
const removeCount = diffLines.filter((l) => l.type === 'remove').length;
|
|
181
|
+
// Calculate display width
|
|
182
|
+
const contentWidth = Math.max(terminalWidth - 8, 40);
|
|
183
|
+
const displayPath = truncatePath(filePath, contentWidth - 10);
|
|
184
|
+
// Build occurrences text
|
|
185
|
+
const occurrencesText = fileStats?.occurrences
|
|
186
|
+
? ` (${fileStats.occurrences} replacement${fileStats.occurrences > 1 ? 's' : ''})`
|
|
187
|
+
: '';
|
|
188
|
+
// For compact mode, just show summary
|
|
189
|
+
if (compact) {
|
|
190
|
+
return (_jsxs(Box, { flexDirection: "row", children: [_jsx(Text, { color: Colors.AccentGreen, children: "\u2713 " }), _jsx(Text, { color: Colors.White, children: displayPath }), _jsx(Text, { children: " " }), _jsxs(Text, { color: Colors.AccentGreen, children: ["+", addCount] }), _jsx(Text, { dimColor: true, children: "/" }), _jsxs(Text, { color: Colors.AccentRed, children: ["-", removeCount] }), _jsx(Text, { dimColor: true, children: occurrencesText })] }));
|
|
191
|
+
}
|
|
192
|
+
return (_jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [_jsxs(Box, { children: [_jsx(Text, { color: Colors.AccentGreen, children: "\u2713 " }), _jsx(Text, { color: Colors.White, children: displayPath }), _jsx(Text, { dimColor: true, children: " " }), _jsxs(Text, { color: Colors.AccentGreen, children: ["+", addCount] }), _jsx(Text, { dimColor: true, children: "/" }), _jsxs(Text, { color: Colors.AccentRed, children: ["-", removeCount] }), _jsx(Text, { dimColor: true, children: occurrencesText })] }), _jsx(Box, { flexDirection: "column", marginLeft: 2, children: diffLines.map((line, index) => (_jsx(DiffLineDisplay, { line: line }, index))) })] }));
|
|
193
|
+
};
|
|
194
|
+
export default DiffPreview;
|
|
195
|
+
//# sourceMappingURL=DiffPreview.js.map
|