@machina.ai/cell-cli 1.8.2-rc1 → 1.11.0-rc1
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/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/package.json +8 -7
- package/dist/src/commands/extensions/disable.js +8 -5
- package/dist/src/commands/extensions/disable.js.map +1 -1
- package/dist/src/commands/extensions/enable.js +8 -6
- package/dist/src/commands/extensions/enable.js.map +1 -1
- package/dist/src/commands/extensions/examples/context/GEMINI.md +9 -3
- package/dist/src/commands/extensions/examples/mcp-server/example.d.ts +6 -0
- package/dist/src/commands/extensions/examples/mcp-server/example.js +46 -0
- package/dist/src/commands/extensions/examples/mcp-server/example.js.map +1 -0
- package/dist/src/commands/extensions/install.d.ts +2 -0
- package/dist/src/commands/extensions/install.js +25 -5
- package/dist/src/commands/extensions/install.js.map +1 -1
- package/dist/src/commands/extensions/install.test.js +9 -9
- package/dist/src/commands/extensions/install.test.js.map +1 -1
- package/dist/src/commands/extensions/link.js +5 -4
- package/dist/src/commands/extensions/link.js.map +1 -1
- package/dist/src/commands/extensions/list.js +7 -5
- package/dist/src/commands/extensions/list.js.map +1 -1
- package/dist/src/commands/extensions/new.js +14 -20
- package/dist/src/commands/extensions/new.js.map +1 -1
- package/dist/src/commands/extensions/uninstall.js +4 -3
- package/dist/src/commands/extensions/uninstall.js.map +1 -1
- package/dist/src/commands/extensions/update.js +18 -22
- package/dist/src/commands/extensions/update.js.map +1 -1
- package/dist/src/commands/mcp/add.js +7 -4
- package/dist/src/commands/mcp/add.js.map +1 -1
- package/dist/src/commands/mcp/add.test.d.ts +6 -0
- package/dist/src/commands/mcp/add.test.js +244 -0
- package/dist/src/commands/mcp/add.test.js.map +1 -0
- package/dist/src/commands/mcp/list.js +11 -9
- package/dist/src/commands/mcp/list.js.map +1 -1
- package/dist/src/commands/mcp/list.test.d.ts +6 -0
- package/dist/src/commands/mcp/list.test.js +118 -0
- package/dist/src/commands/mcp/list.test.js.map +1 -0
- package/dist/src/commands/mcp/remove.js +3 -2
- package/dist/src/commands/mcp/remove.js.map +1 -1
- package/dist/src/commands/mcp/remove.test.d.ts +6 -0
- package/dist/src/commands/mcp/remove.test.js +175 -0
- package/dist/src/commands/mcp/remove.test.js.map +1 -0
- package/dist/src/commands/mcp.test.d.ts +6 -0
- package/dist/src/commands/mcp.test.js +62 -0
- package/dist/src/commands/mcp.test.js.map +1 -0
- package/dist/src/config/auth.js +3 -1
- package/dist/src/config/auth.js.map +1 -1
- package/dist/src/config/config.d.ts +4 -16
- package/dist/src/config/config.integration.test.d.ts +6 -0
- package/dist/src/config/config.integration.test.js +321 -0
- package/dist/src/config/config.integration.test.js.map +1 -0
- package/dist/src/config/config.js +80 -105
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.d.ts +6 -0
- package/dist/src/config/config.test.js +1949 -0
- package/dist/src/config/config.test.js.map +1 -0
- package/dist/src/config/extension.d.ts +19 -27
- package/dist/src/config/extension.js +159 -139
- package/dist/src/config/extension.js.map +1 -1
- package/dist/src/config/extension.test.d.ts +6 -0
- package/dist/src/config/extension.test.js +1088 -0
- package/dist/src/config/extension.test.js.map +1 -0
- package/dist/src/config/extensions/extensionEnablement.d.ts +3 -3
- package/dist/src/config/extensions/extensionEnablement.js +5 -5
- package/dist/src/config/extensions/extensionEnablement.js.map +1 -1
- package/dist/src/config/extensions/extensionEnablement.test.js +26 -22
- package/dist/src/config/extensions/extensionEnablement.test.js.map +1 -1
- package/dist/src/config/extensions/github.d.ts +23 -7
- package/dist/src/config/extensions/github.js +139 -88
- package/dist/src/config/extensions/github.js.map +1 -1
- package/dist/src/config/extensions/github.test.js +74 -22
- package/dist/src/config/extensions/github.test.js.map +1 -1
- package/dist/src/config/extensions/github_fetch.d.ts +7 -0
- package/dist/src/config/extensions/github_fetch.js +34 -0
- package/dist/src/config/extensions/github_fetch.js.map +1 -0
- package/dist/src/config/extensions/update.d.ts +5 -4
- package/dist/src/config/extensions/update.js +23 -16
- package/dist/src/config/extensions/update.js.map +1 -1
- package/dist/src/config/extensions/update.test.js +57 -57
- package/dist/src/config/extensions/update.test.js.map +1 -1
- package/dist/src/config/extensions/variableSchema.d.ts +2 -0
- package/dist/src/config/extensions/variableSchema.js.map +1 -1
- package/dist/src/config/keyBindings.d.ts +2 -1
- package/dist/src/config/keyBindings.js +5 -3
- package/dist/src/config/keyBindings.js.map +1 -1
- package/dist/src/config/policy.d.ts +3 -2
- package/dist/src/config/policy.js +33 -24
- package/dist/src/config/policy.js.map +1 -1
- package/dist/src/config/policy.test.js +60 -36
- package/dist/src/config/policy.test.js.map +1 -1
- package/dist/src/config/sandboxConfig.d.ts +0 -1
- package/dist/src/config/sandboxConfig.js +1 -3
- package/dist/src/config/sandboxConfig.js.map +1 -1
- package/dist/src/config/settings.d.ts +10 -1
- package/dist/src/config/settings.js +24 -9
- package/dist/src/config/settings.js.map +1 -1
- package/dist/src/config/settings.test.d.ts +6 -0
- package/dist/src/config/settings.test.js +1941 -0
- package/dist/src/config/settings.test.js.map +1 -0
- package/dist/src/config/settingsSchema.d.ts +124 -3
- package/dist/src/config/settingsSchema.js +125 -4
- package/dist/src/config/settingsSchema.js.map +1 -1
- package/dist/src/config/trustedFolders.d.ts +0 -1
- package/dist/src/config/trustedFolders.js +2 -3
- package/dist/src/config/trustedFolders.js.map +1 -1
- package/dist/src/gemini.js +46 -33
- package/dist/src/gemini.js.map +1 -1
- package/dist/src/gemini.test.js +62 -19
- package/dist/src/gemini.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/generated/git-commit.js.map +1 -1
- package/dist/src/nonInteractiveCli.js +105 -4
- package/dist/src/nonInteractiveCli.js.map +1 -1
- package/dist/src/nonInteractiveCli.test.d.ts +6 -0
- package/dist/src/nonInteractiveCli.test.js +741 -0
- package/dist/src/nonInteractiveCli.test.js.map +1 -0
- package/dist/src/nonInteractiveCliCommands.js +2 -3
- package/dist/src/nonInteractiveCliCommands.js.map +1 -1
- package/dist/src/services/BuiltinCommandLoader.js +3 -0
- package/dist/src/services/BuiltinCommandLoader.js.map +1 -1
- package/dist/src/services/BuiltinCommandLoader.test.js +37 -0
- package/dist/src/services/BuiltinCommandLoader.test.js.map +1 -1
- package/dist/src/services/CommandService.js +2 -1
- package/dist/src/services/CommandService.js.map +1 -1
- package/dist/src/services/FileCommandLoader.d.ts +1 -1
- package/dist/src/services/FileCommandLoader.js +4 -4
- package/dist/src/services/FileCommandLoader.js.map +1 -1
- package/dist/src/services/FileCommandLoader.test.d.ts +6 -0
- package/dist/src/services/FileCommandLoader.test.js +971 -0
- package/dist/src/services/FileCommandLoader.test.js.map +1 -0
- package/dist/src/services/prompt-processors/argumentProcessor.test.d.ts +6 -0
- package/dist/src/services/prompt-processors/argumentProcessor.test.js +40 -0
- package/dist/src/services/prompt-processors/argumentProcessor.test.js.map +1 -0
- package/dist/src/services/prompt-processors/atFileProcessor.js +3 -2
- package/dist/src/services/prompt-processors/atFileProcessor.js.map +1 -1
- package/dist/src/services/prompt-processors/shellProcessor.js +1 -1
- package/dist/src/services/prompt-processors/shellProcessor.js.map +1 -1
- package/dist/src/services/prompt-processors/shellProcessor.test.d.ts +6 -0
- package/dist/src/services/prompt-processors/shellProcessor.test.js +482 -0
- package/dist/src/services/prompt-processors/shellProcessor.test.js.map +1 -0
- package/dist/src/test-utils/render.d.ts +12 -4
- package/dist/src/test-utils/render.js +56 -2
- package/dist/src/test-utils/render.js.map +1 -1
- package/dist/src/ui/App.js +1 -17
- package/dist/src/ui/App.js.map +1 -1
- package/dist/src/ui/App.test.d.ts +6 -0
- package/dist/src/ui/App.test.js +110 -0
- package/dist/src/ui/App.test.js.map +1 -0
- package/dist/src/ui/AppContainer.js +69 -39
- package/dist/src/ui/AppContainer.js.map +1 -1
- package/dist/src/ui/AppContainer.test.js +35 -9
- package/dist/src/ui/AppContainer.test.js.map +1 -1
- package/dist/src/ui/auth/AuthDialog.d.ts +1 -1
- package/dist/src/ui/auth/AuthDialog.js +5 -3
- package/dist/src/ui/auth/AuthDialog.js.map +1 -1
- package/dist/src/ui/auth/AuthInProgress.js +2 -2
- package/dist/src/ui/auth/AuthInProgress.js.map +1 -1
- package/dist/src/ui/auth/useAuth.d.ts +1 -1
- package/dist/src/ui/auth/useAuth.js +5 -3
- package/dist/src/ui/auth/useAuth.js.map +1 -1
- package/dist/src/ui/commands/aboutCommand.js +1 -1
- package/dist/src/ui/commands/aboutCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/aboutCommand.test.js +130 -0
- package/dist/src/ui/commands/aboutCommand.test.js.map +1 -0
- package/dist/src/ui/commands/authCommand.js +1 -1
- package/dist/src/ui/commands/authCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/authCommand.test.js +30 -0
- package/dist/src/ui/commands/authCommand.test.js.map +1 -0
- package/dist/src/ui/commands/bugCommand.js +1 -1
- package/dist/src/ui/commands/bugCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/bugCommand.test.js +105 -0
- package/dist/src/ui/commands/bugCommand.test.js.map +1 -0
- package/dist/src/ui/commands/chatCommand.js +8 -25
- package/dist/src/ui/commands/chatCommand.js.map +1 -1
- package/dist/src/ui/commands/chatCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/chatCommand.test.js +555 -0
- package/dist/src/ui/commands/chatCommand.test.js.map +1 -0
- package/dist/src/ui/commands/clearCommand.js +1 -1
- package/dist/src/ui/commands/clearCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/clearCommand.test.js +76 -0
- package/dist/src/ui/commands/clearCommand.test.js.map +1 -0
- package/dist/src/ui/commands/compressCommand.js +1 -1
- package/dist/src/ui/commands/compressCommand.js.map +1 -1
- package/dist/src/ui/commands/compressCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/compressCommand.test.js +98 -0
- package/dist/src/ui/commands/compressCommand.test.js.map +1 -0
- package/dist/src/ui/commands/copyCommand.js +2 -1
- package/dist/src/ui/commands/copyCommand.js.map +1 -1
- package/dist/src/ui/commands/copyCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/copyCommand.test.js +242 -0
- package/dist/src/ui/commands/copyCommand.test.js.map +1 -0
- package/dist/src/ui/commands/corgiCommand.js +1 -1
- package/dist/src/ui/commands/corgiCommand.js.map +1 -1
- package/dist/src/ui/commands/corgiCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/corgiCommand.test.js +28 -0
- package/dist/src/ui/commands/corgiCommand.test.js.map +1 -0
- package/dist/src/ui/commands/directoryCommand.js +1 -1
- package/dist/src/ui/commands/directoryCommand.js.map +1 -1
- package/dist/src/ui/commands/directoryCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/directoryCommand.test.js +144 -0
- package/dist/src/ui/commands/directoryCommand.test.js.map +1 -0
- package/dist/src/ui/commands/docsCommand.js +1 -1
- package/dist/src/ui/commands/docsCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/docsCommand.test.js +72 -0
- package/dist/src/ui/commands/docsCommand.test.js.map +1 -0
- package/dist/src/ui/commands/editorCommand.js +1 -1
- package/dist/src/ui/commands/editorCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/editorCommand.test.js +27 -0
- package/dist/src/ui/commands/editorCommand.test.js.map +1 -0
- package/dist/src/ui/commands/extensionsCommand.js +30 -32
- package/dist/src/ui/commands/extensionsCommand.js.map +1 -1
- package/dist/src/ui/commands/extensionsCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/extensionsCommand.test.js +244 -0
- package/dist/src/ui/commands/extensionsCommand.test.js.map +1 -0
- package/dist/src/ui/commands/helpCommand.js +1 -1
- package/dist/src/ui/commands/helpCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/helpCommand.test.js +42 -0
- package/dist/src/ui/commands/helpCommand.test.js.map +1 -0
- package/dist/src/ui/commands/ideCommand.js +6 -6
- package/dist/src/ui/commands/ideCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/ideCommand.test.js +205 -0
- package/dist/src/ui/commands/ideCommand.test.js.map +1 -0
- package/dist/src/ui/commands/initCommand.js +1 -1
- package/dist/src/ui/commands/initCommand.js.map +1 -1
- package/dist/src/ui/commands/initCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/initCommand.test.js +80 -0
- package/dist/src/ui/commands/initCommand.test.js.map +1 -0
- package/dist/src/ui/commands/mcpCommand.js +98 -88
- package/dist/src/ui/commands/mcpCommand.js.map +1 -1
- package/dist/src/ui/commands/mcpCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/mcpCommand.test.js +148 -0
- package/dist/src/ui/commands/mcpCommand.test.js.map +1 -0
- package/dist/src/ui/commands/memoryCommand.js +27 -9
- package/dist/src/ui/commands/memoryCommand.js.map +1 -1
- package/dist/src/ui/commands/memoryCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/memoryCommand.test.js +266 -0
- package/dist/src/ui/commands/memoryCommand.test.js.map +1 -0
- package/dist/src/ui/commands/privacyCommand.js +1 -1
- package/dist/src/ui/commands/privacyCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/privacyCommand.test.js +32 -0
- package/dist/src/ui/commands/privacyCommand.test.js.map +1 -0
- package/dist/src/ui/commands/profileCommand.d.ts +7 -0
- package/dist/src/ui/commands/profileCommand.js +23 -0
- package/dist/src/ui/commands/profileCommand.js.map +1 -0
- package/dist/src/ui/commands/quitCommand.js +1 -1
- package/dist/src/ui/commands/quitCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/quitCommand.test.js +50 -0
- package/dist/src/ui/commands/quitCommand.test.js.map +1 -0
- package/dist/src/ui/commands/restoreCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/restoreCommand.test.js +190 -0
- package/dist/src/ui/commands/restoreCommand.test.js.map +1 -0
- package/dist/src/ui/commands/settingsCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/settingsCommand.test.js +30 -0
- package/dist/src/ui/commands/settingsCommand.test.js.map +1 -0
- package/dist/src/ui/commands/setupGithubCommand.js +4 -3
- package/dist/src/ui/commands/setupGithubCommand.js.map +1 -1
- package/dist/src/ui/commands/statsCommand.js +3 -3
- package/dist/src/ui/commands/statsCommand.js.map +1 -1
- package/dist/src/ui/commands/statsCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/statsCommand.test.js +53 -0
- package/dist/src/ui/commands/statsCommand.test.js.map +1 -0
- package/dist/src/ui/commands/terminalSetupCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/terminalSetupCommand.test.js +66 -0
- package/dist/src/ui/commands/terminalSetupCommand.test.js.map +1 -0
- package/dist/src/ui/commands/themeCommand.js +1 -1
- package/dist/src/ui/commands/themeCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/themeCommand.test.js +32 -0
- package/dist/src/ui/commands/themeCommand.test.js.map +1 -0
- package/dist/src/ui/commands/toolsCommand.js +1 -1
- package/dist/src/ui/commands/toolsCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/toolsCommand.test.js +100 -0
- package/dist/src/ui/commands/toolsCommand.test.js.map +1 -0
- package/dist/src/ui/commands/types.d.ts +2 -0
- package/dist/src/ui/commands/types.js.map +1 -1
- package/dist/src/ui/commands/vimCommand.js +1 -1
- package/dist/src/ui/components/AnsiOutput.d.ts +1 -0
- package/dist/src/ui/components/AnsiOutput.js +5 -5
- package/dist/src/ui/components/AnsiOutput.js.map +1 -1
- package/dist/src/ui/components/AnsiOutput.test.js +6 -6
- package/dist/src/ui/components/AnsiOutput.test.js.map +1 -1
- package/dist/src/ui/components/AsciiArt.d.ts +3 -3
- package/dist/src/ui/components/AsciiArt.js +3 -3
- package/dist/src/ui/components/CliSpinner.d.ts +10 -0
- package/dist/src/ui/components/CliSpinner.js +20 -0
- package/dist/src/ui/components/CliSpinner.js.map +1 -0
- package/dist/src/ui/components/Composer.js +8 -9
- package/dist/src/ui/components/Composer.js.map +1 -1
- package/dist/src/ui/components/Composer.test.js +16 -1
- package/dist/src/ui/components/Composer.test.js.map +1 -1
- package/dist/src/ui/components/ContextSummaryDisplay.d.ts +0 -1
- package/dist/src/ui/components/ContextSummaryDisplay.js +4 -14
- package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -1
- package/dist/src/ui/components/ContextSummaryDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/ContextSummaryDisplay.test.js +66 -0
- package/dist/src/ui/components/ContextSummaryDisplay.test.js.map +1 -0
- package/dist/src/ui/components/DebugProfiler.d.ts +18 -0
- package/dist/src/ui/components/DebugProfiler.js +158 -12
- package/dist/src/ui/components/DebugProfiler.js.map +1 -1
- package/dist/src/ui/components/DebugProfiler.test.d.ts +6 -0
- package/dist/src/ui/components/DebugProfiler.test.js +140 -0
- package/dist/src/ui/components/DebugProfiler.test.js.map +1 -0
- package/dist/src/ui/components/DialogManager.js +1 -5
- package/dist/src/ui/components/DialogManager.js.map +1 -1
- package/dist/src/ui/components/EditorSettingsDialog.js +1 -1
- package/dist/src/ui/components/EditorSettingsDialog.js.map +1 -1
- package/dist/src/ui/components/FolderTrustDialog.js +9 -5
- package/dist/src/ui/components/FolderTrustDialog.js.map +1 -1
- package/dist/src/ui/components/FolderTrustDialog.test.js +14 -14
- package/dist/src/ui/components/FolderTrustDialog.test.js.map +1 -1
- package/dist/src/ui/components/Footer.js +7 -6
- package/dist/src/ui/components/Footer.js.map +1 -1
- package/dist/src/ui/components/Footer.test.d.ts +6 -0
- package/dist/src/ui/components/Footer.test.js +231 -0
- package/dist/src/ui/components/Footer.test.js.map +1 -0
- package/dist/src/ui/components/GeminiRespondingSpinner.js +2 -2
- package/dist/src/ui/components/GeminiRespondingSpinner.js.map +1 -1
- package/dist/src/ui/components/Help.js +1 -1
- package/dist/src/ui/components/Help.js.map +1 -1
- package/dist/src/ui/components/HistoryItemDisplay.js +2 -1
- package/dist/src/ui/components/HistoryItemDisplay.js.map +1 -1
- package/dist/src/ui/components/InputPrompt.d.ts +11 -1
- package/dist/src/ui/components/InputPrompt.js +103 -29
- package/dist/src/ui/components/InputPrompt.js.map +1 -1
- package/dist/src/ui/components/InputPrompt.test.d.ts +6 -0
- package/dist/src/ui/components/InputPrompt.test.js +1737 -0
- package/dist/src/ui/components/InputPrompt.test.js.map +1 -0
- package/dist/src/ui/components/MainContent.js +1 -1
- package/dist/src/ui/components/MainContent.js.map +1 -1
- package/dist/src/ui/components/ModelStatsDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/ModelStatsDisplay.test.js +285 -0
- package/dist/src/ui/components/ModelStatsDisplay.test.js.map +1 -0
- package/dist/src/ui/components/Notifications.js +12 -4
- package/dist/src/ui/components/Notifications.js.map +1 -1
- package/dist/src/ui/components/PermissionsModifyTrustDialog.js +22 -18
- package/dist/src/ui/components/PermissionsModifyTrustDialog.js.map +1 -1
- package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js +10 -2
- package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js.map +1 -1
- package/dist/src/ui/components/QueuedMessageDisplay.js +3 -3
- package/dist/src/ui/components/QueuedMessageDisplay.js.map +1 -1
- package/dist/src/ui/components/QueuedMessageDisplay.test.js +4 -0
- package/dist/src/ui/components/QueuedMessageDisplay.test.js.map +1 -1
- package/dist/src/ui/components/RawMarkdownIndicator.d.ts +7 -0
- package/dist/src/ui/components/RawMarkdownIndicator.js +8 -0
- package/dist/src/ui/components/RawMarkdownIndicator.js.map +1 -0
- package/dist/src/ui/components/SessionSummaryDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/SessionSummaryDisplay.test.js +74 -0
- package/dist/src/ui/components/SessionSummaryDisplay.test.js.map +1 -0
- package/dist/src/ui/components/SettingsDialog.js +12 -11
- package/dist/src/ui/components/SettingsDialog.js.map +1 -1
- package/dist/src/ui/components/SettingsDialog.test.js +190 -77
- package/dist/src/ui/components/SettingsDialog.test.js.map +1 -1
- package/dist/src/ui/components/StatsDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/StatsDisplay.test.js +351 -0
- package/dist/src/ui/components/StatsDisplay.test.js.map +1 -0
- package/dist/src/ui/components/ThemeDialog.d.ts +4 -2
- package/dist/src/ui/components/ThemeDialog.js +3 -3
- package/dist/src/ui/components/ThemeDialog.js.map +1 -1
- package/dist/src/ui/components/ThemeDialog.test.js +13 -0
- package/dist/src/ui/components/ThemeDialog.test.js.map +1 -1
- package/dist/src/ui/components/ToolStatsDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/ToolStatsDisplay.test.js +227 -0
- package/dist/src/ui/components/ToolStatsDisplay.test.js.map +1 -0
- package/dist/src/ui/components/messages/CompressionMessage.js +3 -3
- package/dist/src/ui/components/messages/CompressionMessage.js.map +1 -1
- package/dist/src/ui/components/messages/GeminiMessage.js +3 -1
- package/dist/src/ui/components/messages/GeminiMessage.js.map +1 -1
- package/dist/src/ui/components/messages/GeminiMessage.test.d.ts +6 -0
- package/dist/src/ui/components/messages/GeminiMessage.test.js +35 -0
- package/dist/src/ui/components/messages/GeminiMessage.test.js.map +1 -0
- package/dist/src/ui/components/messages/GeminiMessageContent.js +3 -1
- package/dist/src/ui/components/messages/GeminiMessageContent.js.map +1 -1
- package/dist/src/ui/components/messages/Todo.d.ts +7 -0
- package/dist/src/ui/components/messages/Todo.js +69 -0
- package/dist/src/ui/components/messages/Todo.js.map +1 -0
- package/dist/src/ui/components/messages/Todo.test.d.ts +6 -0
- package/dist/src/ui/components/messages/Todo.test.js +102 -0
- package/dist/src/ui/components/messages/Todo.test.js.map +1 -0
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js +1 -1
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -1
- package/dist/src/ui/components/messages/ToolGroupMessage.js +2 -2
- package/dist/src/ui/components/messages/ToolGroupMessage.js.map +1 -1
- package/dist/src/ui/components/messages/ToolMessage.js +9 -4
- package/dist/src/ui/components/messages/ToolMessage.js.map +1 -1
- package/dist/src/ui/components/messages/ToolMessage.test.js +2 -2
- package/dist/src/ui/components/messages/ToolMessage.test.js.map +1 -1
- package/dist/src/ui/components/messages/ToolMessageRawMarkdown.test.d.ts +6 -0
- package/dist/src/ui/components/messages/ToolMessageRawMarkdown.test.js +30 -0
- package/dist/src/ui/components/messages/ToolMessageRawMarkdown.test.js.map +1 -0
- package/dist/src/ui/components/messages/UserShellMessage.js +1 -1
- package/dist/src/ui/components/messages/UserShellMessage.js.map +1 -1
- package/dist/src/ui/components/shared/BaseSelectionList.test.js +33 -24
- package/dist/src/ui/components/shared/BaseSelectionList.test.js.map +1 -1
- package/dist/src/ui/components/shared/text-buffer.js +1 -1
- package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
- package/dist/src/ui/components/shared/text-buffer.test.d.ts +6 -0
- package/dist/src/ui/components/shared/text-buffer.test.js +1578 -0
- package/dist/src/ui/components/shared/text-buffer.test.js.map +1 -0
- package/dist/src/ui/components/shared/vim-buffer-actions.test.d.ts +6 -0
- package/dist/src/ui/components/shared/vim-buffer-actions.test.js +951 -0
- package/dist/src/ui/components/shared/vim-buffer-actions.test.js.map +1 -0
- package/dist/src/ui/components/views/ChatList.d.ts +12 -0
- package/dist/src/ui/components/views/ChatList.js +17 -0
- package/dist/src/ui/components/views/ChatList.js.map +1 -0
- package/dist/src/ui/components/views/ChatList.test.d.ts +6 -0
- package/dist/src/ui/components/views/ChatList.test.js +42 -0
- package/dist/src/ui/components/views/ChatList.test.js.map +1 -0
- package/dist/src/ui/components/views/ExtensionsList.js +3 -4
- package/dist/src/ui/components/views/ExtensionsList.js.map +1 -1
- package/dist/src/ui/components/views/ExtensionsList.test.js +2 -9
- package/dist/src/ui/components/views/ExtensionsList.test.js.map +1 -1
- package/dist/src/ui/components/views/McpStatus.d.ts +0 -1
- package/dist/src/ui/components/views/McpStatus.js +4 -4
- package/dist/src/ui/components/views/McpStatus.js.map +1 -1
- package/dist/src/ui/components/views/McpStatus.test.js +0 -5
- package/dist/src/ui/components/views/McpStatus.test.js.map +1 -1
- package/dist/src/ui/components/views/ToolsList.test.js +4 -4
- package/dist/src/ui/components/views/ToolsList.test.js.map +1 -1
- package/dist/src/ui/contexts/KeypressContext.d.ts +1 -0
- package/dist/src/ui/contexts/KeypressContext.js +219 -53
- package/dist/src/ui/contexts/KeypressContext.js.map +1 -1
- package/dist/src/ui/contexts/KeypressContext.test.js +536 -10
- package/dist/src/ui/contexts/KeypressContext.test.js.map +1 -1
- package/dist/src/ui/contexts/SessionContext.test.d.ts +6 -0
- package/dist/src/ui/contexts/SessionContext.test.js +177 -0
- package/dist/src/ui/contexts/SessionContext.test.js.map +1 -0
- package/dist/src/ui/contexts/UIActionsContext.d.ts +5 -4
- package/dist/src/ui/contexts/UIActionsContext.js.map +1 -1
- package/dist/src/ui/contexts/UIStateContext.d.ts +6 -4
- package/dist/src/ui/contexts/UIStateContext.js.map +1 -1
- package/dist/src/ui/hooks/atCommandProcessor.js +2 -2
- package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/shellCommandProcessor.js +5 -7
- package/dist/src/ui/hooks/shellCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/shellCommandProcessor.test.js +19 -32
- package/dist/src/ui/hooks/shellCommandProcessor.test.js.map +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.d.ts +2 -1
- package/dist/src/ui/hooks/slashCommandProcessor.js +11 -7
- package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.test.d.ts +6 -0
- package/dist/src/ui/hooks/slashCommandProcessor.test.js +779 -0
- package/dist/src/ui/hooks/slashCommandProcessor.test.js.map +1 -0
- package/dist/src/ui/hooks/useAtCompletion.js +2 -2
- package/dist/src/ui/hooks/useAtCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useAtCompletion.test.d.ts +6 -0
- package/dist/src/ui/hooks/useAtCompletion.test.js +385 -0
- package/dist/src/ui/hooks/useAtCompletion.test.js.map +1 -0
- package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js +0 -1
- package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js.map +1 -1
- package/dist/src/ui/hooks/useCommandCompletion.d.ts +1 -1
- package/dist/src/ui/hooks/useCommandCompletion.js +5 -3
- package/dist/src/ui/hooks/useCommandCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useCommandCompletion.test.d.ts +6 -0
- package/dist/src/ui/hooks/useCommandCompletion.test.js +375 -0
- package/dist/src/ui/hooks/useCommandCompletion.test.js.map +1 -0
- package/dist/src/ui/hooks/useConsoleMessages.test.d.ts +6 -0
- package/dist/src/ui/hooks/useConsoleMessages.test.js +110 -0
- package/dist/src/ui/hooks/useConsoleMessages.test.js.map +1 -0
- package/dist/src/ui/hooks/useExtensionUpdates.d.ts +2 -1
- package/dist/src/ui/hooks/useExtensionUpdates.js +71 -19
- package/dist/src/ui/hooks/useExtensionUpdates.js.map +1 -1
- package/dist/src/ui/hooks/useExtensionUpdates.test.js +28 -13
- package/dist/src/ui/hooks/useExtensionUpdates.test.js.map +1 -1
- package/dist/src/ui/hooks/useFlickerDetector.d.ts +14 -0
- package/dist/src/ui/hooks/useFlickerDetector.js +37 -0
- package/dist/src/ui/hooks/useFlickerDetector.js.map +1 -0
- package/dist/src/ui/hooks/useFlickerDetector.test.d.ts +6 -0
- package/dist/src/ui/hooks/useFlickerDetector.test.js +102 -0
- package/dist/src/ui/hooks/useFlickerDetector.test.js.map +1 -0
- package/dist/src/ui/hooks/useFocus.test.d.ts +6 -0
- package/dist/src/ui/hooks/useFocus.test.js +115 -0
- package/dist/src/ui/hooks/useFocus.test.js.map +1 -0
- package/dist/src/ui/hooks/useFolderTrust.d.ts +2 -1
- package/dist/src/ui/hooks/useFolderTrust.js +12 -3
- package/dist/src/ui/hooks/useFolderTrust.js.map +1 -1
- package/dist/src/ui/hooks/useFolderTrust.test.d.ts +6 -0
- package/dist/src/ui/hooks/useFolderTrust.test.js +164 -0
- package/dist/src/ui/hooks/useFolderTrust.test.js.map +1 -0
- package/dist/src/ui/hooks/useGeminiStream.js +95 -56
- package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
- package/dist/src/ui/hooks/useGeminiStream.test.d.ts +6 -0
- package/dist/src/ui/hooks/useGeminiStream.test.js +1971 -0
- package/dist/src/ui/hooks/useGeminiStream.test.js.map +1 -0
- package/dist/src/ui/hooks/useHistoryManager.js +3 -3
- package/dist/src/ui/hooks/useHistoryManager.js.map +1 -1
- package/dist/src/ui/hooks/useInputHistoryStore.js +2 -1
- package/dist/src/ui/hooks/useInputHistoryStore.js.map +1 -1
- package/dist/src/ui/hooks/useKeypress.test.d.ts +6 -0
- package/dist/src/ui/hooks/useKeypress.test.js +234 -0
- package/dist/src/ui/hooks/useKeypress.test.js.map +1 -0
- package/dist/src/ui/hooks/useLoadingIndicator.test.js +5 -0
- package/dist/src/ui/hooks/useLoadingIndicator.test.js.map +1 -1
- package/dist/src/ui/hooks/useMessageQueue.d.ts +1 -0
- package/dist/src/ui/hooks/useMessageQueue.js +14 -0
- package/dist/src/ui/hooks/useMessageQueue.js.map +1 -1
- package/dist/src/ui/hooks/useMessageQueue.test.js +121 -0
- package/dist/src/ui/hooks/useMessageQueue.test.js.map +1 -1
- package/dist/src/ui/hooks/usePhraseCycler.d.ts +1 -0
- package/dist/src/ui/hooks/usePhraseCycler.js +157 -5
- package/dist/src/ui/hooks/usePhraseCycler.js.map +1 -1
- package/dist/src/ui/hooks/usePhraseCycler.test.d.ts +6 -0
- package/dist/src/ui/hooks/usePhraseCycler.test.js +155 -0
- package/dist/src/ui/hooks/usePhraseCycler.test.js.map +1 -0
- package/dist/src/ui/hooks/useReactToolScheduler.js +2 -2
- package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -1
- package/dist/src/ui/hooks/useSelectionList.js +50 -23
- package/dist/src/ui/hooks/useSelectionList.js.map +1 -1
- package/dist/src/ui/hooks/useSelectionList.test.js +24 -0
- package/dist/src/ui/hooks/useSelectionList.test.js.map +1 -1
- package/dist/src/ui/hooks/useShellHistory.test.js +16 -10
- package/dist/src/ui/hooks/useShellHistory.test.js.map +1 -1
- package/dist/src/ui/hooks/useShowMemoryCommand.d.ts +1 -1
- package/dist/src/ui/hooks/useShowMemoryCommand.js +4 -3
- package/dist/src/ui/hooks/useShowMemoryCommand.js.map +1 -1
- package/dist/src/ui/hooks/useSlashCompletion.js +2 -1
- package/dist/src/ui/hooks/useSlashCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useTerminalSize.js +2 -3
- package/dist/src/ui/hooks/useTerminalSize.js.map +1 -1
- package/dist/src/ui/hooks/useThemeCommand.d.ts +2 -1
- package/dist/src/ui/hooks/useThemeCommand.js +6 -0
- package/dist/src/ui/hooks/useThemeCommand.js.map +1 -1
- package/dist/src/ui/hooks/useToolScheduler.test.js +3 -0
- package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -1
- package/dist/src/ui/hooks/vim.js +2 -1
- package/dist/src/ui/hooks/vim.js.map +1 -1
- package/dist/src/ui/hooks/vim.test.d.ts +6 -0
- package/dist/src/ui/hooks/vim.test.js +1389 -0
- package/dist/src/ui/hooks/vim.test.js.map +1 -0
- package/dist/src/ui/keyMatchers.test.js +9 -3
- package/dist/src/ui/keyMatchers.test.js.map +1 -1
- package/dist/src/ui/layouts/DefaultAppLayout.d.ts +1 -3
- package/dist/src/ui/layouts/DefaultAppLayout.js +5 -2
- package/dist/src/ui/layouts/DefaultAppLayout.js.map +1 -1
- package/dist/src/ui/layouts/ScreenReaderAppLayout.js +4 -1
- package/dist/src/ui/layouts/ScreenReaderAppLayout.js.map +1 -1
- package/dist/src/ui/noninteractive/nonInteractiveUi.js +1 -0
- package/dist/src/ui/noninteractive/nonInteractiveUi.js.map +1 -1
- package/dist/src/ui/state/extensions.d.ts +22 -3
- package/dist/src/ui/state/extensions.js +26 -4
- package/dist/src/ui/state/extensions.js.map +1 -1
- package/dist/src/ui/themes/color-utils.js +2 -1
- package/dist/src/ui/themes/color-utils.js.map +1 -1
- package/dist/src/ui/themes/theme-manager.js +8 -7
- package/dist/src/ui/themes/theme-manager.js.map +1 -1
- package/dist/src/ui/themes/theme.test.d.ts +6 -0
- package/dist/src/ui/themes/theme.test.js +85 -0
- package/dist/src/ui/themes/theme.test.js.map +1 -0
- package/dist/src/ui/types.d.ts +11 -3
- package/dist/src/ui/types.js +1 -0
- package/dist/src/ui/types.js.map +1 -1
- package/dist/src/ui/utils/CodeColorizer.d.ts +1 -1
- package/dist/src/ui/utils/CodeColorizer.js +4 -2
- package/dist/src/ui/utils/CodeColorizer.js.map +1 -1
- package/dist/src/ui/utils/MarkdownDisplay.d.ts +1 -0
- package/dist/src/ui/utils/MarkdownDisplay.js +8 -1
- package/dist/src/ui/utils/MarkdownDisplay.js.map +1 -1
- package/dist/src/ui/utils/commandUtils.js +20 -3
- package/dist/src/ui/utils/commandUtils.js.map +1 -1
- package/dist/src/ui/utils/commandUtils.test.js +61 -6
- package/dist/src/ui/utils/commandUtils.test.js.map +1 -1
- package/dist/src/ui/utils/computeStats.js +5 -2
- package/dist/src/ui/utils/computeStats.js.map +1 -1
- package/dist/src/ui/utils/computeStats.test.d.ts +6 -0
- package/dist/src/ui/utils/computeStats.test.js +262 -0
- package/dist/src/ui/utils/computeStats.test.js.map +1 -0
- package/dist/src/ui/utils/terminalSetup.js +3 -2
- package/dist/src/ui/utils/terminalSetup.js.map +1 -1
- package/dist/src/ui/utils/ui-sizing.d.ts +7 -0
- package/dist/src/ui/utils/ui-sizing.js +23 -0
- package/dist/src/ui/utils/ui-sizing.js.map +1 -0
- package/dist/src/ui/utils/updateCheck.d.ts +2 -1
- package/dist/src/ui/utils/updateCheck.js +6 -2
- package/dist/src/ui/utils/updateCheck.js.map +1 -1
- package/dist/src/ui/utils/updateCheck.test.js +25 -10
- package/dist/src/ui/utils/updateCheck.test.js.map +1 -1
- package/dist/src/utils/cleanup.test.d.ts +6 -0
- package/dist/src/utils/cleanup.test.js +49 -0
- package/dist/src/utils/cleanup.test.js.map +1 -0
- package/dist/src/utils/commentJson.js +95 -13
- package/dist/src/utils/commentJson.js.map +1 -1
- package/dist/src/utils/commentJson.test.js +161 -0
- package/dist/src/utils/commentJson.test.js.map +1 -1
- package/dist/src/utils/errors.d.ts +9 -3
- package/dist/src/utils/errors.js +87 -16
- package/dist/src/utils/errors.js.map +1 -1
- package/dist/src/utils/errors.test.js +40 -46
- package/dist/src/utils/errors.test.js.map +1 -1
- package/dist/src/utils/events.d.ts +2 -1
- package/dist/src/utils/events.js +1 -0
- package/dist/src/utils/events.js.map +1 -1
- package/dist/src/utils/gitUtils.js +3 -2
- package/dist/src/utils/gitUtils.js.map +1 -1
- package/dist/src/utils/handleAutoUpdate.js +4 -1
- package/dist/src/utils/handleAutoUpdate.js.map +1 -1
- package/dist/src/utils/handleAutoUpdate.test.d.ts +6 -0
- package/dist/src/utils/handleAutoUpdate.test.js +225 -0
- package/dist/src/utils/handleAutoUpdate.test.js.map +1 -0
- package/dist/src/utils/installationInfo.d.ts +1 -0
- package/dist/src/utils/installationInfo.js +4 -2
- package/dist/src/utils/installationInfo.js.map +1 -1
- package/dist/src/utils/installationInfo.test.js +8 -4
- package/dist/src/utils/installationInfo.test.js.map +1 -1
- package/dist/src/utils/readStdin.js +2 -1
- package/dist/src/utils/readStdin.js.map +1 -1
- package/dist/src/utils/sandbox-macos-permissive-open.sb +2 -0
- package/dist/src/utils/sandbox.js +20 -20
- package/dist/src/utils/sandbox.js.map +1 -1
- package/dist/src/utils/sessionCleanup.d.ts +22 -0
- package/dist/src/utils/sessionCleanup.integration.test.d.ts +6 -0
- package/dist/src/utils/sessionCleanup.integration.test.js +182 -0
- package/dist/src/utils/sessionCleanup.integration.test.js.map +1 -0
- package/dist/src/utils/sessionCleanup.js +214 -0
- package/dist/src/utils/sessionCleanup.js.map +1 -0
- package/dist/src/utils/sessionCleanup.test.d.ts +6 -0
- package/dist/src/utils/sessionCleanup.test.js +1232 -0
- package/dist/src/utils/sessionCleanup.test.js.map +1 -0
- package/dist/src/utils/sessionUtils.d.ts +37 -0
- package/dist/src/utils/sessionUtils.js +71 -0
- package/dist/src/utils/sessionUtils.js.map +1 -0
- package/dist/src/utils/startupWarnings.test.d.ts +6 -0
- package/dist/src/utils/startupWarnings.test.js +61 -0
- package/dist/src/utils/startupWarnings.test.js.map +1 -0
- package/dist/src/validateNonInterActiveAuth.js +8 -9
- package/dist/src/validateNonInterActiveAuth.js.map +1 -1
- package/dist/src/zed-integration/acp.js +1 -2
- package/dist/src/zed-integration/acp.js.map +1 -1
- package/dist/src/zed-integration/schema.d.ts +176 -176
- package/dist/src/zed-integration/zedIntegration.d.ts +2 -3
- package/dist/src/zed-integration/zedIntegration.js +12 -33
- package/dist/src/zed-integration/zedIntegration.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -6
- package/dist/src/ui/components/WorkspaceMigrationDialog.d.ts +0 -11
- package/dist/src/ui/components/WorkspaceMigrationDialog.js +0 -44
- package/dist/src/ui/components/WorkspaceMigrationDialog.js.map +0 -1
- package/dist/src/ui/hooks/useWorkspaceMigration.d.ts +0 -13
- package/dist/src/ui/hooks/useWorkspaceMigration.js +0 -54
- package/dist/src/ui/hooks/useWorkspaceMigration.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { renderHook, act, waitFor } from '@testing-library/react';
|
|
3
3
|
import { vi } from 'vitest';
|
|
4
|
-
import { KeypressProvider, useKeypressContext, DRAG_COMPLETION_TIMEOUT_MS,
|
|
4
|
+
import { KeypressProvider, useKeypressContext, DRAG_COMPLETION_TIMEOUT_MS, KITTY_SEQUENCE_TIMEOUT_MS,
|
|
5
5
|
// CSI_END_O,
|
|
6
6
|
// SS3_END,
|
|
7
7
|
SINGLE_QUOTE, DOUBLE_QUOTE, } from './KeypressContext.js';
|
|
@@ -43,7 +43,7 @@ class MockStdin extends EventEmitter {
|
|
|
43
43
|
describe('KeypressContext - Kitty Protocol', () => {
|
|
44
44
|
let stdin;
|
|
45
45
|
const mockSetRawMode = vi.fn();
|
|
46
|
-
const wrapper = ({ children, kittyProtocolEnabled = true, }) => (_jsx(KeypressProvider, { kittyProtocolEnabled: kittyProtocolEnabled, children: children }));
|
|
46
|
+
const wrapper = ({ children, kittyProtocolEnabled = true, }) => (_jsx(KeypressProvider, { kittyProtocolEnabled: kittyProtocolEnabled ?? false, children: children }));
|
|
47
47
|
beforeEach(() => {
|
|
48
48
|
vi.clearAllMocks();
|
|
49
49
|
stdin = new MockStdin();
|
|
@@ -323,11 +323,11 @@ describe('KeypressContext - Kitty Protocol', () => {
|
|
|
323
323
|
act(() => {
|
|
324
324
|
stdin.sendKittySequence('\x1b[27u');
|
|
325
325
|
});
|
|
326
|
-
expect(consoleLogSpy).toHaveBeenCalledWith('[DEBUG] Kitty buffer accumulating:', expect.stringContaining('
|
|
326
|
+
expect(consoleLogSpy).toHaveBeenCalledWith('[DEBUG] Kitty buffer accumulating:', expect.stringContaining('"\\u001b[27u"'));
|
|
327
327
|
const parsedCall = consoleLogSpy.mock.calls.find((args) => typeof args[0] === 'string' &&
|
|
328
328
|
args[0].includes('[DEBUG] Kitty sequence parsed successfully'));
|
|
329
329
|
expect(parsedCall).toBeTruthy();
|
|
330
|
-
expect(parsedCall?.[1]).toEqual(expect.stringContaining('
|
|
330
|
+
expect(parsedCall?.[1]).toEqual(expect.stringContaining('\\u001b[27u'));
|
|
331
331
|
});
|
|
332
332
|
it('should log kitty buffer overflow when debugKeystrokeLogging is true', async () => {
|
|
333
333
|
const keyHandler = vi.fn();
|
|
@@ -336,10 +336,10 @@ describe('KeypressContext - Kitty Protocol', () => {
|
|
|
336
336
|
act(() => {
|
|
337
337
|
result.current.subscribe(keyHandler);
|
|
338
338
|
});
|
|
339
|
-
// Send
|
|
340
|
-
const
|
|
339
|
+
// Send a long sequence starting with a valid kitty prefix to trigger overflow
|
|
340
|
+
const longSequence = '\x1b[1;' + '1'.repeat(100);
|
|
341
341
|
act(() => {
|
|
342
|
-
stdin.sendKittySequence(
|
|
342
|
+
stdin.sendKittySequence(longSequence);
|
|
343
343
|
});
|
|
344
344
|
expect(consoleLogSpy).toHaveBeenCalledWith('[DEBUG] Kitty buffer overflow, clearing:', expect.any(String));
|
|
345
345
|
});
|
|
@@ -396,9 +396,9 @@ describe('KeypressContext - Kitty Protocol', () => {
|
|
|
396
396
|
});
|
|
397
397
|
});
|
|
398
398
|
// Verify debug logging for accumulation
|
|
399
|
-
expect(consoleLogSpy).toHaveBeenCalledWith('[DEBUG] Kitty buffer accumulating:', sequence);
|
|
399
|
+
expect(consoleLogSpy).toHaveBeenCalledWith('[DEBUG] Kitty buffer accumulating:', JSON.stringify(sequence));
|
|
400
400
|
// Verify warning for char codes
|
|
401
|
-
expect(consoleWarnSpy).toHaveBeenCalledWith('Kitty sequence buffer has
|
|
401
|
+
expect(consoleWarnSpy).toHaveBeenCalledWith('Kitty sequence buffer has content:', JSON.stringify(sequence));
|
|
402
402
|
});
|
|
403
403
|
});
|
|
404
404
|
describe('Parameterized functional keys', () => {
|
|
@@ -502,7 +502,7 @@ describe('KeypressContext - Kitty Protocol', () => {
|
|
|
502
502
|
describe('Drag and Drop Handling', () => {
|
|
503
503
|
let stdin;
|
|
504
504
|
const mockSetRawMode = vi.fn();
|
|
505
|
-
const wrapper = ({ children }) => (_jsx(KeypressProvider, { kittyProtocolEnabled:
|
|
505
|
+
const wrapper = ({ children, kittyProtocolEnabled = true, }) => (_jsx(KeypressProvider, { kittyProtocolEnabled: kittyProtocolEnabled, children: children }));
|
|
506
506
|
beforeEach(() => {
|
|
507
507
|
vi.clearAllMocks();
|
|
508
508
|
vi.useFakeTimers();
|
|
@@ -668,4 +668,530 @@ describe('Drag and Drop Handling', () => {
|
|
|
668
668
|
});
|
|
669
669
|
});
|
|
670
670
|
});
|
|
671
|
+
describe('Kitty Sequence Parsing', () => {
|
|
672
|
+
let stdin;
|
|
673
|
+
const mockSetRawMode = vi.fn();
|
|
674
|
+
const wrapper = ({ children, kittyProtocolEnabled = true, }) => (_jsx(KeypressProvider, { kittyProtocolEnabled: kittyProtocolEnabled, children: children }));
|
|
675
|
+
beforeEach(() => {
|
|
676
|
+
vi.clearAllMocks();
|
|
677
|
+
vi.useFakeTimers();
|
|
678
|
+
stdin = new MockStdin();
|
|
679
|
+
useStdin.mockReturnValue({
|
|
680
|
+
stdin,
|
|
681
|
+
setRawMode: mockSetRawMode,
|
|
682
|
+
});
|
|
683
|
+
});
|
|
684
|
+
afterEach(() => {
|
|
685
|
+
vi.useRealTimers();
|
|
686
|
+
});
|
|
687
|
+
// Terminals to test
|
|
688
|
+
const terminals = ['iTerm2', 'Ghostty', 'MacTerminal', 'VSCodeTerminal'];
|
|
689
|
+
// Key mappings: letter -> [keycode, accented character, shouldHaveMeta]
|
|
690
|
+
// Note: µ (mu) is sent with meta:false on iTerm2/VSCode
|
|
691
|
+
const keys = {
|
|
692
|
+
a: [97, 'å', true],
|
|
693
|
+
o: [111, 'ø', true],
|
|
694
|
+
m: [109, 'µ', false],
|
|
695
|
+
};
|
|
696
|
+
it.each(terminals.flatMap((terminal) => Object.entries(keys).map(([key, [keycode, accentedChar, shouldHaveMeta]]) => {
|
|
697
|
+
if (terminal === 'Ghostty') {
|
|
698
|
+
// Ghostty uses kitty protocol sequences
|
|
699
|
+
return {
|
|
700
|
+
terminal,
|
|
701
|
+
key,
|
|
702
|
+
kittySequence: `\x1b[${keycode};3u`,
|
|
703
|
+
expected: {
|
|
704
|
+
name: key,
|
|
705
|
+
ctrl: false,
|
|
706
|
+
meta: true,
|
|
707
|
+
shift: false,
|
|
708
|
+
paste: false,
|
|
709
|
+
kittyProtocol: true,
|
|
710
|
+
},
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
else if (terminal === 'MacTerminal') {
|
|
714
|
+
// Mac Terminal sends ESC + letter
|
|
715
|
+
return {
|
|
716
|
+
terminal,
|
|
717
|
+
key,
|
|
718
|
+
kitty: false,
|
|
719
|
+
input: {
|
|
720
|
+
sequence: `\x1b${key}`,
|
|
721
|
+
name: key,
|
|
722
|
+
ctrl: false,
|
|
723
|
+
meta: true,
|
|
724
|
+
shift: false,
|
|
725
|
+
paste: false,
|
|
726
|
+
},
|
|
727
|
+
expected: {
|
|
728
|
+
sequence: `\x1b${key}`,
|
|
729
|
+
name: key,
|
|
730
|
+
ctrl: false,
|
|
731
|
+
meta: true,
|
|
732
|
+
shift: false,
|
|
733
|
+
paste: false,
|
|
734
|
+
},
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
else {
|
|
738
|
+
// iTerm2 and VSCode send accented characters (å, ø, µ)
|
|
739
|
+
// Note: µ comes with meta:false but gets converted to m with meta:true
|
|
740
|
+
return {
|
|
741
|
+
terminal,
|
|
742
|
+
key,
|
|
743
|
+
input: {
|
|
744
|
+
name: key,
|
|
745
|
+
ctrl: false,
|
|
746
|
+
meta: shouldHaveMeta,
|
|
747
|
+
shift: false,
|
|
748
|
+
paste: false,
|
|
749
|
+
sequence: accentedChar,
|
|
750
|
+
},
|
|
751
|
+
expected: {
|
|
752
|
+
name: key,
|
|
753
|
+
ctrl: false,
|
|
754
|
+
meta: true, // Always expect meta:true after conversion
|
|
755
|
+
shift: false,
|
|
756
|
+
paste: false,
|
|
757
|
+
sequence: accentedChar,
|
|
758
|
+
},
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
})))('should handle Alt+$key in $terminal', ({ kittySequence, input, expected, kitty = true, }) => {
|
|
762
|
+
const keyHandler = vi.fn();
|
|
763
|
+
const testWrapper = ({ children }) => (_jsx(KeypressProvider, { kittyProtocolEnabled: kitty, children: children }));
|
|
764
|
+
const { result } = renderHook(() => useKeypressContext(), {
|
|
765
|
+
wrapper: testWrapper,
|
|
766
|
+
});
|
|
767
|
+
act(() => result.current.subscribe(keyHandler));
|
|
768
|
+
if (kittySequence) {
|
|
769
|
+
act(() => stdin.sendKittySequence(kittySequence));
|
|
770
|
+
}
|
|
771
|
+
else if (input) {
|
|
772
|
+
act(() => stdin.pressKey(input));
|
|
773
|
+
}
|
|
774
|
+
expect(keyHandler).toHaveBeenCalledWith(expect.objectContaining(expected));
|
|
775
|
+
});
|
|
776
|
+
describe('Backslash key handling', () => {
|
|
777
|
+
beforeEach(() => {
|
|
778
|
+
vi.useFakeTimers();
|
|
779
|
+
});
|
|
780
|
+
afterEach(() => {
|
|
781
|
+
vi.useRealTimers();
|
|
782
|
+
});
|
|
783
|
+
it('should treat backslash as a regular keystroke', () => {
|
|
784
|
+
const keyHandler = vi.fn();
|
|
785
|
+
const { result } = renderHook(() => useKeypressContext(), { wrapper });
|
|
786
|
+
act(() => result.current.subscribe(keyHandler));
|
|
787
|
+
act(() => stdin.pressKey({
|
|
788
|
+
name: undefined,
|
|
789
|
+
ctrl: false,
|
|
790
|
+
meta: false,
|
|
791
|
+
shift: false,
|
|
792
|
+
paste: false,
|
|
793
|
+
sequence: '\\',
|
|
794
|
+
}));
|
|
795
|
+
// Advance timers to trigger the backslash timeout
|
|
796
|
+
act(() => {
|
|
797
|
+
vi.runAllTimers();
|
|
798
|
+
});
|
|
799
|
+
expect(keyHandler).toHaveBeenCalledWith(expect.objectContaining({
|
|
800
|
+
sequence: '\\',
|
|
801
|
+
meta: false,
|
|
802
|
+
}));
|
|
803
|
+
});
|
|
804
|
+
});
|
|
805
|
+
it('should timeout and flush incomplete kitty sequences after 50ms', async () => {
|
|
806
|
+
const keyHandler = vi.fn();
|
|
807
|
+
const { result } = renderHook(() => useKeypressContext(), { wrapper });
|
|
808
|
+
act(() => {
|
|
809
|
+
result.current.subscribe(keyHandler);
|
|
810
|
+
});
|
|
811
|
+
// Send incomplete kitty sequence
|
|
812
|
+
act(() => {
|
|
813
|
+
stdin.pressKey({
|
|
814
|
+
name: undefined,
|
|
815
|
+
ctrl: false,
|
|
816
|
+
meta: false,
|
|
817
|
+
shift: false,
|
|
818
|
+
paste: false,
|
|
819
|
+
sequence: '\x1b[1;',
|
|
820
|
+
});
|
|
821
|
+
});
|
|
822
|
+
// Should not broadcast immediately
|
|
823
|
+
expect(keyHandler).not.toHaveBeenCalled();
|
|
824
|
+
// Advance time just before timeout
|
|
825
|
+
act(() => {
|
|
826
|
+
vi.advanceTimersByTime(KITTY_SEQUENCE_TIMEOUT_MS - 5);
|
|
827
|
+
});
|
|
828
|
+
// Still shouldn't broadcast
|
|
829
|
+
expect(keyHandler).not.toHaveBeenCalled();
|
|
830
|
+
// Advance past timeout
|
|
831
|
+
act(() => {
|
|
832
|
+
vi.advanceTimersByTime(10);
|
|
833
|
+
});
|
|
834
|
+
// Should now broadcast the incomplete sequence as regular input
|
|
835
|
+
expect(keyHandler).toHaveBeenCalledWith(expect.objectContaining({
|
|
836
|
+
name: '',
|
|
837
|
+
sequence: '\x1b[1;',
|
|
838
|
+
paste: false,
|
|
839
|
+
}));
|
|
840
|
+
});
|
|
841
|
+
it('should immediately flush non-kitty CSI sequences', async () => {
|
|
842
|
+
const keyHandler = vi.fn();
|
|
843
|
+
const { result } = renderHook(() => useKeypressContext(), { wrapper });
|
|
844
|
+
act(() => {
|
|
845
|
+
result.current.subscribe(keyHandler);
|
|
846
|
+
});
|
|
847
|
+
// Send a CSI sequence that doesn't match kitty patterns
|
|
848
|
+
// ESC[m is SGR reset, not a kitty sequence
|
|
849
|
+
act(() => {
|
|
850
|
+
stdin.pressKey({
|
|
851
|
+
name: undefined,
|
|
852
|
+
ctrl: false,
|
|
853
|
+
meta: false,
|
|
854
|
+
shift: false,
|
|
855
|
+
paste: false,
|
|
856
|
+
sequence: '\x1b[m',
|
|
857
|
+
});
|
|
858
|
+
});
|
|
859
|
+
// Should broadcast immediately as it's not a valid kitty pattern
|
|
860
|
+
expect(keyHandler).toHaveBeenCalledWith(expect.objectContaining({
|
|
861
|
+
name: '',
|
|
862
|
+
sequence: '\x1b[m',
|
|
863
|
+
paste: false,
|
|
864
|
+
}));
|
|
865
|
+
});
|
|
866
|
+
it('should parse valid kitty sequences immediately when complete', async () => {
|
|
867
|
+
const keyHandler = vi.fn();
|
|
868
|
+
const { result } = renderHook(() => useKeypressContext(), { wrapper });
|
|
869
|
+
act(() => {
|
|
870
|
+
result.current.subscribe(keyHandler);
|
|
871
|
+
});
|
|
872
|
+
// Send complete kitty sequence for Ctrl+A
|
|
873
|
+
act(() => {
|
|
874
|
+
stdin.pressKey({
|
|
875
|
+
name: undefined,
|
|
876
|
+
ctrl: false,
|
|
877
|
+
meta: false,
|
|
878
|
+
shift: false,
|
|
879
|
+
paste: false,
|
|
880
|
+
sequence: '\x1b[97;5u',
|
|
881
|
+
});
|
|
882
|
+
});
|
|
883
|
+
// Should parse and broadcast immediately
|
|
884
|
+
expect(keyHandler).toHaveBeenCalledWith(expect.objectContaining({
|
|
885
|
+
name: 'a',
|
|
886
|
+
ctrl: true,
|
|
887
|
+
kittyProtocol: true,
|
|
888
|
+
}));
|
|
889
|
+
});
|
|
890
|
+
it('should handle batched kitty sequences correctly', async () => {
|
|
891
|
+
const keyHandler = vi.fn();
|
|
892
|
+
const { result } = renderHook(() => useKeypressContext(), { wrapper });
|
|
893
|
+
act(() => {
|
|
894
|
+
result.current.subscribe(keyHandler);
|
|
895
|
+
});
|
|
896
|
+
// Send multiple kitty sequences at once
|
|
897
|
+
act(() => {
|
|
898
|
+
stdin.pressKey({
|
|
899
|
+
name: undefined,
|
|
900
|
+
ctrl: false,
|
|
901
|
+
meta: false,
|
|
902
|
+
shift: false,
|
|
903
|
+
paste: false,
|
|
904
|
+
sequence: '\x1b[97;5u\x1b[98;5u', // Ctrl+a followed by Ctrl+b
|
|
905
|
+
});
|
|
906
|
+
});
|
|
907
|
+
// Should parse both sequences
|
|
908
|
+
expect(keyHandler).toHaveBeenCalledTimes(2);
|
|
909
|
+
expect(keyHandler).toHaveBeenNthCalledWith(1, expect.objectContaining({
|
|
910
|
+
name: 'a',
|
|
911
|
+
ctrl: true,
|
|
912
|
+
kittyProtocol: true,
|
|
913
|
+
}));
|
|
914
|
+
expect(keyHandler).toHaveBeenNthCalledWith(2, expect.objectContaining({
|
|
915
|
+
name: 'b',
|
|
916
|
+
ctrl: true,
|
|
917
|
+
kittyProtocol: true,
|
|
918
|
+
}));
|
|
919
|
+
});
|
|
920
|
+
it('should clear kitty buffer and timeout on Ctrl+C', async () => {
|
|
921
|
+
const keyHandler = vi.fn();
|
|
922
|
+
const { result } = renderHook(() => useKeypressContext(), { wrapper });
|
|
923
|
+
act(() => {
|
|
924
|
+
result.current.subscribe(keyHandler);
|
|
925
|
+
});
|
|
926
|
+
// Send incomplete kitty sequence
|
|
927
|
+
act(() => {
|
|
928
|
+
stdin.pressKey({
|
|
929
|
+
name: undefined,
|
|
930
|
+
ctrl: false,
|
|
931
|
+
meta: false,
|
|
932
|
+
shift: false,
|
|
933
|
+
paste: false,
|
|
934
|
+
sequence: '\x1b[1;',
|
|
935
|
+
});
|
|
936
|
+
});
|
|
937
|
+
// Press Ctrl+C
|
|
938
|
+
act(() => {
|
|
939
|
+
stdin.pressKey({
|
|
940
|
+
name: 'c',
|
|
941
|
+
ctrl: true,
|
|
942
|
+
meta: false,
|
|
943
|
+
shift: false,
|
|
944
|
+
paste: false,
|
|
945
|
+
sequence: '\x03',
|
|
946
|
+
});
|
|
947
|
+
});
|
|
948
|
+
// Advance past timeout
|
|
949
|
+
act(() => {
|
|
950
|
+
vi.advanceTimersByTime(KITTY_SEQUENCE_TIMEOUT_MS + 10);
|
|
951
|
+
});
|
|
952
|
+
// Should only have received Ctrl+C, not the incomplete sequence
|
|
953
|
+
expect(keyHandler).toHaveBeenCalledTimes(1);
|
|
954
|
+
expect(keyHandler).toHaveBeenCalledWith(expect.objectContaining({
|
|
955
|
+
name: 'c',
|
|
956
|
+
ctrl: true,
|
|
957
|
+
}));
|
|
958
|
+
});
|
|
959
|
+
it('should handle mixed valid and invalid sequences', async () => {
|
|
960
|
+
const keyHandler = vi.fn();
|
|
961
|
+
const { result } = renderHook(() => useKeypressContext(), { wrapper });
|
|
962
|
+
act(() => {
|
|
963
|
+
result.current.subscribe(keyHandler);
|
|
964
|
+
});
|
|
965
|
+
// Send valid kitty sequence followed by invalid CSI
|
|
966
|
+
act(() => {
|
|
967
|
+
stdin.pressKey({
|
|
968
|
+
name: undefined,
|
|
969
|
+
ctrl: false,
|
|
970
|
+
meta: false,
|
|
971
|
+
shift: false,
|
|
972
|
+
paste: false,
|
|
973
|
+
sequence: '\x1b[13u\x1b[!', // Valid enter, then invalid sequence
|
|
974
|
+
});
|
|
975
|
+
});
|
|
976
|
+
// Should parse valid sequence and flush invalid immediately
|
|
977
|
+
expect(keyHandler).toHaveBeenCalledTimes(2);
|
|
978
|
+
expect(keyHandler).toHaveBeenNthCalledWith(1, expect.objectContaining({
|
|
979
|
+
name: 'return',
|
|
980
|
+
kittyProtocol: true,
|
|
981
|
+
}));
|
|
982
|
+
expect(keyHandler).toHaveBeenNthCalledWith(2, expect.objectContaining({
|
|
983
|
+
name: '',
|
|
984
|
+
sequence: '\x1b[!',
|
|
985
|
+
}));
|
|
986
|
+
});
|
|
987
|
+
it('should not buffer sequences when kitty protocol is disabled', async () => {
|
|
988
|
+
const keyHandler = vi.fn();
|
|
989
|
+
const { result } = renderHook(() => useKeypressContext(), {
|
|
990
|
+
wrapper: ({ children }) => wrapper({ children, kittyProtocolEnabled: false }),
|
|
991
|
+
});
|
|
992
|
+
act(() => {
|
|
993
|
+
result.current.subscribe(keyHandler);
|
|
994
|
+
});
|
|
995
|
+
// Send what would be a kitty sequence
|
|
996
|
+
act(() => {
|
|
997
|
+
stdin.pressKey({
|
|
998
|
+
name: undefined,
|
|
999
|
+
ctrl: false,
|
|
1000
|
+
meta: false,
|
|
1001
|
+
shift: false,
|
|
1002
|
+
paste: false,
|
|
1003
|
+
sequence: '\x1b[13u',
|
|
1004
|
+
});
|
|
1005
|
+
});
|
|
1006
|
+
// Should pass through without parsing
|
|
1007
|
+
expect(keyHandler).toHaveBeenCalledWith(expect.objectContaining({
|
|
1008
|
+
sequence: '\x1b[13u',
|
|
1009
|
+
}));
|
|
1010
|
+
expect(keyHandler).not.toHaveBeenCalledWith(expect.objectContaining({
|
|
1011
|
+
name: 'return',
|
|
1012
|
+
kittyProtocol: true,
|
|
1013
|
+
}));
|
|
1014
|
+
});
|
|
1015
|
+
it('should handle sequences arriving character by character', async () => {
|
|
1016
|
+
vi.useRealTimers(); // Required for correct buffering timing.
|
|
1017
|
+
const keyHandler = vi.fn();
|
|
1018
|
+
const { result } = renderHook(() => useKeypressContext(), { wrapper });
|
|
1019
|
+
act(() => {
|
|
1020
|
+
result.current.subscribe(keyHandler);
|
|
1021
|
+
});
|
|
1022
|
+
// Send kitty sequence character by character
|
|
1023
|
+
const sequence = '\x1b[27u'; // Escape key
|
|
1024
|
+
for (const char of sequence) {
|
|
1025
|
+
act(() => {
|
|
1026
|
+
stdin.emit('data', Buffer.from(char));
|
|
1027
|
+
});
|
|
1028
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
1029
|
+
}
|
|
1030
|
+
// Should parse once complete
|
|
1031
|
+
await waitFor(() => {
|
|
1032
|
+
expect(keyHandler).toHaveBeenCalledWith(expect.objectContaining({
|
|
1033
|
+
name: 'escape',
|
|
1034
|
+
kittyProtocol: true,
|
|
1035
|
+
}));
|
|
1036
|
+
});
|
|
1037
|
+
});
|
|
1038
|
+
it('should reset timeout when new input arrives', async () => {
|
|
1039
|
+
const keyHandler = vi.fn();
|
|
1040
|
+
const { result } = renderHook(() => useKeypressContext(), { wrapper });
|
|
1041
|
+
act(() => {
|
|
1042
|
+
result.current.subscribe(keyHandler);
|
|
1043
|
+
});
|
|
1044
|
+
// Start incomplete sequence
|
|
1045
|
+
act(() => {
|
|
1046
|
+
stdin.pressKey({
|
|
1047
|
+
name: undefined,
|
|
1048
|
+
ctrl: false,
|
|
1049
|
+
meta: false,
|
|
1050
|
+
shift: false,
|
|
1051
|
+
paste: false,
|
|
1052
|
+
sequence: '\x1b[1',
|
|
1053
|
+
});
|
|
1054
|
+
});
|
|
1055
|
+
// Advance time partway
|
|
1056
|
+
act(() => {
|
|
1057
|
+
vi.advanceTimersByTime(30);
|
|
1058
|
+
});
|
|
1059
|
+
// Add more to sequence
|
|
1060
|
+
act(() => {
|
|
1061
|
+
stdin.pressKey({
|
|
1062
|
+
name: undefined,
|
|
1063
|
+
ctrl: false,
|
|
1064
|
+
meta: false,
|
|
1065
|
+
shift: false,
|
|
1066
|
+
paste: false,
|
|
1067
|
+
sequence: '3',
|
|
1068
|
+
});
|
|
1069
|
+
});
|
|
1070
|
+
// Advance time from the first timeout point
|
|
1071
|
+
act(() => {
|
|
1072
|
+
vi.advanceTimersByTime(25);
|
|
1073
|
+
});
|
|
1074
|
+
// Should not have timed out yet (timeout restarted)
|
|
1075
|
+
expect(keyHandler).not.toHaveBeenCalled();
|
|
1076
|
+
// Complete the sequence
|
|
1077
|
+
act(() => {
|
|
1078
|
+
stdin.pressKey({
|
|
1079
|
+
name: undefined,
|
|
1080
|
+
ctrl: false,
|
|
1081
|
+
meta: false,
|
|
1082
|
+
shift: false,
|
|
1083
|
+
paste: false,
|
|
1084
|
+
sequence: 'u',
|
|
1085
|
+
});
|
|
1086
|
+
});
|
|
1087
|
+
// Should now parse as complete enter key
|
|
1088
|
+
expect(keyHandler).toHaveBeenCalledWith(expect.objectContaining({
|
|
1089
|
+
name: 'return',
|
|
1090
|
+
kittyProtocol: true,
|
|
1091
|
+
}));
|
|
1092
|
+
});
|
|
1093
|
+
it('should flush incomplete kitty sequence on FOCUS_IN event', async () => {
|
|
1094
|
+
const keyHandler = vi.fn();
|
|
1095
|
+
const { result } = renderHook(() => useKeypressContext(), { wrapper });
|
|
1096
|
+
act(() => {
|
|
1097
|
+
result.current.subscribe(keyHandler);
|
|
1098
|
+
});
|
|
1099
|
+
// Send incomplete kitty sequence
|
|
1100
|
+
act(() => {
|
|
1101
|
+
stdin.pressKey({
|
|
1102
|
+
sequence: '\x1b[1;',
|
|
1103
|
+
});
|
|
1104
|
+
});
|
|
1105
|
+
// Incomplete sequence should be buffered, not broadcast
|
|
1106
|
+
expect(keyHandler).not.toHaveBeenCalled();
|
|
1107
|
+
// Send FOCUS_IN event
|
|
1108
|
+
const FOCUS_IN = '\x1b[I';
|
|
1109
|
+
act(() => {
|
|
1110
|
+
stdin.pressKey({
|
|
1111
|
+
sequence: FOCUS_IN,
|
|
1112
|
+
});
|
|
1113
|
+
});
|
|
1114
|
+
// The buffered sequence should be flushed
|
|
1115
|
+
expect(keyHandler).toHaveBeenCalledTimes(1);
|
|
1116
|
+
expect(keyHandler).toHaveBeenCalledWith(expect.objectContaining({
|
|
1117
|
+
name: '',
|
|
1118
|
+
sequence: '\x1b[1;',
|
|
1119
|
+
paste: false,
|
|
1120
|
+
}));
|
|
1121
|
+
});
|
|
1122
|
+
it('should flush incomplete kitty sequence on FOCUS_OUT event', async () => {
|
|
1123
|
+
const keyHandler = vi.fn();
|
|
1124
|
+
const { result } = renderHook(() => useKeypressContext(), { wrapper });
|
|
1125
|
+
act(() => {
|
|
1126
|
+
result.current.subscribe(keyHandler);
|
|
1127
|
+
});
|
|
1128
|
+
// Send incomplete kitty sequence
|
|
1129
|
+
act(() => {
|
|
1130
|
+
stdin.pressKey({
|
|
1131
|
+
sequence: '\x1b[1;',
|
|
1132
|
+
});
|
|
1133
|
+
});
|
|
1134
|
+
// Incomplete sequence should be buffered, not broadcast
|
|
1135
|
+
expect(keyHandler).not.toHaveBeenCalled();
|
|
1136
|
+
// Send FOCUS_OUT event
|
|
1137
|
+
const FOCUS_OUT = '\x1b[O';
|
|
1138
|
+
act(() => {
|
|
1139
|
+
stdin.pressKey({
|
|
1140
|
+
sequence: FOCUS_OUT,
|
|
1141
|
+
});
|
|
1142
|
+
});
|
|
1143
|
+
// The buffered sequence should be flushed
|
|
1144
|
+
expect(keyHandler).toHaveBeenCalledTimes(1);
|
|
1145
|
+
expect(keyHandler).toHaveBeenCalledWith(expect.objectContaining({
|
|
1146
|
+
name: '',
|
|
1147
|
+
sequence: '\x1b[1;',
|
|
1148
|
+
paste: false,
|
|
1149
|
+
}));
|
|
1150
|
+
});
|
|
1151
|
+
it('should flush incomplete kitty sequence on paste event', async () => {
|
|
1152
|
+
vi.useFakeTimers();
|
|
1153
|
+
const keyHandler = vi.fn();
|
|
1154
|
+
const { result } = renderHook(() => useKeypressContext(), { wrapper });
|
|
1155
|
+
act(() => {
|
|
1156
|
+
result.current.subscribe(keyHandler);
|
|
1157
|
+
});
|
|
1158
|
+
// Send incomplete kitty sequence
|
|
1159
|
+
act(() => {
|
|
1160
|
+
stdin.pressKey({
|
|
1161
|
+
sequence: '\x1b[1;',
|
|
1162
|
+
});
|
|
1163
|
+
});
|
|
1164
|
+
// Incomplete sequence should be buffered, not broadcast
|
|
1165
|
+
expect(keyHandler).not.toHaveBeenCalled();
|
|
1166
|
+
// Send paste start sequence
|
|
1167
|
+
const PASTE_MODE_PREFIX = `\x1b[200~`;
|
|
1168
|
+
act(() => {
|
|
1169
|
+
stdin.emit('data', Buffer.from(PASTE_MODE_PREFIX));
|
|
1170
|
+
});
|
|
1171
|
+
// The buffered sequence should be flushed
|
|
1172
|
+
expect(keyHandler).toHaveBeenCalledTimes(1);
|
|
1173
|
+
expect(keyHandler).toHaveBeenCalledWith(expect.objectContaining({
|
|
1174
|
+
name: '',
|
|
1175
|
+
sequence: '\x1b[1;',
|
|
1176
|
+
paste: false,
|
|
1177
|
+
}));
|
|
1178
|
+
// Now send some paste content and end paste to make sure paste still works
|
|
1179
|
+
const pastedText = 'hello';
|
|
1180
|
+
const PASTE_MODE_SUFFIX = `\x1b[201~`;
|
|
1181
|
+
act(() => {
|
|
1182
|
+
stdin.emit('data', Buffer.from(pastedText));
|
|
1183
|
+
stdin.emit('data', Buffer.from(PASTE_MODE_SUFFIX));
|
|
1184
|
+
});
|
|
1185
|
+
act(() => {
|
|
1186
|
+
vi.runAllTimers();
|
|
1187
|
+
});
|
|
1188
|
+
// The paste event should be broadcast
|
|
1189
|
+
expect(keyHandler).toHaveBeenCalledTimes(2);
|
|
1190
|
+
expect(keyHandler).toHaveBeenNthCalledWith(2, expect.objectContaining({
|
|
1191
|
+
paste: true,
|
|
1192
|
+
sequence: pastedText,
|
|
1193
|
+
}));
|
|
1194
|
+
vi.useRealTimers();
|
|
1195
|
+
});
|
|
1196
|
+
});
|
|
671
1197
|
//# sourceMappingURL=KeypressContext.test.js.map
|