@machina.ai/cell-cli 1.0.17-rc1 → 1.0.21-rc2
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/package.json +10 -8
- package/dist/src/commands/mcp/add.d.ts +7 -0
- package/dist/src/commands/mcp/add.js +166 -0
- package/dist/src/commands/mcp/add.js.map +1 -0
- package/dist/src/commands/mcp/list.d.ts +8 -0
- package/dist/src/commands/mcp/list.js +110 -0
- package/dist/src/commands/mcp/list.js.map +1 -0
- package/dist/src/commands/mcp/remove.d.ts +7 -0
- package/dist/src/commands/mcp/remove.js +44 -0
- package/dist/src/commands/mcp/remove.js.map +1 -0
- package/dist/src/commands/mcp.d.ts +7 -0
- package/dist/src/commands/mcp.js +23 -0
- package/dist/src/commands/mcp.js.map +1 -0
- package/dist/src/config/auth.test.d.ts +6 -0
- package/dist/src/config/auth.test.js +28 -0
- package/dist/src/config/auth.test.js.map +1 -0
- package/dist/src/config/config.d.ts +3 -3
- package/dist/src/config/config.js +138 -69
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/keyBindings.d.ts +66 -0
- package/dist/src/config/keyBindings.js +141 -0
- package/dist/src/config/keyBindings.js.map +1 -0
- package/dist/src/config/keyBindings.test.d.ts +6 -0
- package/dist/src/config/keyBindings.test.js +51 -0
- package/dist/src/config/keyBindings.test.js.map +1 -0
- package/dist/src/config/sandboxConfig.js +3 -3
- package/dist/src/config/sandboxConfig.js.map +1 -1
- package/dist/src/config/settings.d.ts +3 -54
- package/dist/src/config/settings.js +58 -38
- package/dist/src/config/settings.js.map +1 -1
- package/dist/src/config/settingsSchema.d.ts +533 -0
- package/dist/src/config/settingsSchema.js +507 -0
- package/dist/src/config/settingsSchema.js.map +1 -0
- package/dist/src/config/settingsSchema.test.d.ts +6 -0
- package/dist/src/config/settingsSchema.test.js +195 -0
- package/dist/src/config/settingsSchema.test.js.map +1 -0
- package/dist/src/config/trustedFolders.d.ts +37 -0
- package/dist/src/config/trustedFolders.js +118 -0
- package/dist/src/config/trustedFolders.js.map +1 -0
- package/dist/src/config/trustedFolders.test.d.ts +6 -0
- package/dist/src/config/trustedFolders.test.js +160 -0
- package/dist/src/config/trustedFolders.test.js.map +1 -0
- package/dist/src/gemini.js +54 -37
- package/dist/src/gemini.js.map +1 -1
- package/dist/src/gemini.test.d.ts +6 -0
- package/dist/src/gemini.test.js +193 -0
- package/dist/src/gemini.test.js.map +1 -0
- package/dist/src/generated/git-commit.d.ts +2 -1
- package/dist/src/generated/git-commit.js +2 -1
- package/dist/src/generated/git-commit.js.map +1 -1
- package/dist/src/nonInteractiveCli.js +22 -17
- package/dist/src/nonInteractiveCli.js.map +1 -1
- package/dist/src/services/BuiltinCommandLoader.js +5 -2
- package/dist/src/services/BuiltinCommandLoader.js.map +1 -1
- package/dist/src/services/BuiltinCommandLoader.test.d.ts +6 -0
- package/dist/src/services/BuiltinCommandLoader.test.js +108 -0
- package/dist/src/services/BuiltinCommandLoader.test.js.map +1 -0
- package/dist/src/services/CommandService.test.d.ts +6 -0
- package/dist/src/services/CommandService.test.js +232 -0
- package/dist/src/services/CommandService.test.js.map +1 -0
- package/dist/src/services/FileCommandLoader.js +10 -8
- package/dist/src/services/FileCommandLoader.js.map +1 -1
- package/dist/src/services/McpPromptLoader.js +3 -3
- package/dist/src/services/McpPromptLoader.js.map +1 -1
- package/dist/src/services/prompt-processors/argumentProcessor.d.ts +2 -7
- package/dist/src/services/prompt-processors/argumentProcessor.js +2 -10
- package/dist/src/services/prompt-processors/argumentProcessor.js.map +1 -1
- package/dist/src/services/prompt-processors/shellProcessor.d.ts +16 -13
- package/dist/src/services/prompt-processors/shellProcessor.js +133 -40
- package/dist/src/services/prompt-processors/shellProcessor.js.map +1 -1
- package/dist/src/services/prompt-processors/types.d.ts +2 -0
- package/dist/src/services/prompt-processors/types.js +2 -0
- package/dist/src/services/prompt-processors/types.js.map +1 -1
- package/dist/src/test-utils/customMatchers.d.ts +14 -0
- package/dist/src/test-utils/customMatchers.js +46 -0
- package/dist/src/test-utils/customMatchers.js.map +1 -0
- package/dist/src/test-utils/mockCommandContext.d.ts +18 -0
- package/dist/src/test-utils/mockCommandContext.js +86 -0
- package/dist/src/test-utils/mockCommandContext.js.map +1 -0
- package/dist/src/test-utils/mockCommandContext.test.d.ts +6 -0
- package/dist/src/test-utils/mockCommandContext.test.js +51 -0
- package/dist/src/test-utils/mockCommandContext.test.js.map +1 -0
- package/dist/src/test-utils/render.d.ts +8 -0
- package/dist/src/test-utils/render.js +10 -0
- package/dist/src/test-utils/render.js.map +1 -0
- package/dist/src/ui/App.js +146 -37
- package/dist/src/ui/App.js.map +1 -1
- package/dist/src/ui/IdeIntegrationNudge.d.ts +16 -0
- package/dist/src/ui/IdeIntegrationNudge.js +52 -0
- package/dist/src/ui/IdeIntegrationNudge.js.map +1 -0
- package/dist/src/ui/commands/aboutCommand.js +9 -5
- package/dist/src/ui/commands/aboutCommand.js.map +1 -1
- package/dist/src/ui/commands/bugCommand.js +13 -5
- package/dist/src/ui/commands/bugCommand.js.map +1 -1
- package/dist/src/ui/commands/chatCommand.js +23 -6
- package/dist/src/ui/commands/chatCommand.js.map +1 -1
- package/dist/src/ui/commands/directoryCommand.js +2 -4
- package/dist/src/ui/commands/directoryCommand.js.map +1 -1
- package/dist/src/ui/commands/docsCommand.js +1 -1
- package/dist/src/ui/commands/docsCommand.js.map +1 -1
- package/dist/src/ui/commands/ideCommand.js +110 -42
- package/dist/src/ui/commands/ideCommand.js.map +1 -1
- package/dist/src/ui/commands/mcpCommand.js +7 -3
- package/dist/src/ui/commands/mcpCommand.js.map +1 -1
- package/dist/src/ui/commands/settingsCommand.d.ts +7 -0
- package/dist/src/ui/commands/settingsCommand.js +16 -0
- package/dist/src/ui/commands/settingsCommand.js.map +1 -0
- package/dist/src/ui/commands/setupGithubCommand.js +86 -19
- package/dist/src/ui/commands/setupGithubCommand.js.map +1 -1
- package/dist/src/ui/commands/setupGithubCommand.test.d.ts +6 -0
- package/dist/src/ui/commands/setupGithubCommand.test.js +74 -0
- package/dist/src/ui/commands/setupGithubCommand.test.js.map +1 -0
- package/dist/src/ui/commands/terminalSetupCommand.d.ts +13 -0
- package/dist/src/ui/commands/terminalSetupCommand.js +41 -0
- package/dist/src/ui/commands/terminalSetupCommand.js.map +1 -0
- package/dist/src/ui/commands/types.d.ts +14 -2
- package/dist/src/ui/commands/types.js.map +1 -1
- package/dist/src/ui/components/AboutBox.d.ts +1 -0
- package/dist/src/ui/components/AboutBox.js +1 -1
- package/dist/src/ui/components/AboutBox.js.map +1 -1
- package/dist/src/ui/components/AsciiArt.d.ts +2 -1
- package/dist/src/ui/components/AsciiArt.js +22 -11
- package/dist/src/ui/components/AsciiArt.js.map +1 -1
- package/dist/src/ui/components/AuthDialog.js +12 -6
- package/dist/src/ui/components/AuthDialog.js.map +1 -1
- package/dist/src/ui/components/AuthDialog.test.d.ts +6 -0
- package/dist/src/ui/components/AuthDialog.test.js +114 -0
- package/dist/src/ui/components/AuthDialog.test.js.map +1 -0
- package/dist/src/ui/components/AuthInProgress.js +5 -4
- package/dist/src/ui/components/AuthInProgress.js.map +1 -1
- package/dist/src/ui/components/ContextSummaryDisplay.js +22 -25
- package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -1
- package/dist/src/ui/components/ContextUsageDisplay.d.ts +9 -0
- package/dist/src/ui/components/ContextUsageDisplay.js +14 -0
- package/dist/src/ui/components/ContextUsageDisplay.js.map +1 -0
- package/dist/src/ui/components/DebugProfiler.js +5 -4
- package/dist/src/ui/components/DebugProfiler.js.map +1 -1
- package/dist/src/ui/components/EditorSettingsDialog.js +6 -5
- package/dist/src/ui/components/EditorSettingsDialog.js.map +1 -1
- package/dist/src/ui/components/FolderTrustDialog.d.ts +16 -0
- package/dist/src/ui/components/FolderTrustDialog.js +39 -0
- package/dist/src/ui/components/FolderTrustDialog.js.map +1 -0
- package/dist/src/ui/components/FolderTrustDialog.test.d.ts +6 -0
- package/dist/src/ui/components/FolderTrustDialog.test.js +26 -0
- package/dist/src/ui/components/FolderTrustDialog.test.js.map +1 -0
- package/dist/src/ui/components/Footer.d.ts +1 -0
- package/dist/src/ui/components/Footer.js +16 -6
- package/dist/src/ui/components/Footer.js.map +1 -1
- package/dist/src/ui/components/Header.d.ts +0 -1
- package/dist/src/ui/components/Header.js +13 -5
- package/dist/src/ui/components/Header.js.map +1 -1
- package/dist/src/ui/components/Header.test.d.ts +6 -0
- package/dist/src/ui/components/Header.test.js +44 -0
- package/dist/src/ui/components/Header.test.js.map +1 -0
- package/dist/src/ui/components/HistoryItemDisplay.js +1 -1
- package/dist/src/ui/components/HistoryItemDisplay.js.map +1 -1
- package/dist/src/ui/components/HistoryItemDisplay.test.d.ts +6 -0
- package/dist/src/ui/components/HistoryItemDisplay.test.js +91 -0
- package/dist/src/ui/components/HistoryItemDisplay.test.js.map +1 -0
- package/dist/src/ui/components/InputPrompt.d.ts +1 -0
- package/dist/src/ui/components/InputPrompt.js +98 -35
- package/dist/src/ui/components/InputPrompt.js.map +1 -1
- package/dist/src/ui/components/LoadingIndicator.js +10 -5
- package/dist/src/ui/components/LoadingIndicator.js.map +1 -1
- package/dist/src/ui/components/LoadingIndicator.test.d.ts +6 -0
- package/dist/src/ui/components/LoadingIndicator.test.js +190 -0
- package/dist/src/ui/components/LoadingIndicator.test.js.map +1 -0
- package/dist/src/ui/components/SettingsDialog.d.ts +14 -0
- package/dist/src/ui/components/SettingsDialog.js +519 -0
- package/dist/src/ui/components/SettingsDialog.js.map +1 -0
- package/dist/src/ui/components/SettingsDialog.test.d.ts +6 -0
- package/dist/src/ui/components/SettingsDialog.test.js +568 -0
- package/dist/src/ui/components/SettingsDialog.test.js.map +1 -0
- package/dist/src/ui/components/ShellConfirmationDialog.js +7 -5
- package/dist/src/ui/components/ShellConfirmationDialog.js.map +1 -1
- package/dist/src/ui/components/ShellConfirmationDialog.test.d.ts +6 -0
- package/dist/src/ui/components/ShellConfirmationDialog.test.js +40 -0
- package/dist/src/ui/components/ShellConfirmationDialog.test.js.map +1 -0
- package/dist/src/ui/components/StatsDisplay.js +8 -7
- package/dist/src/ui/components/StatsDisplay.js.map +1 -1
- package/dist/src/ui/components/SuggestionsDisplay.js +1 -1
- package/dist/src/ui/components/SuggestionsDisplay.js.map +1 -1
- package/dist/src/ui/components/ThemeDialog.js +10 -20
- package/dist/src/ui/components/ThemeDialog.js.map +1 -1
- package/dist/src/ui/components/messages/DiffRenderer.js +10 -1
- package/dist/src/ui/components/messages/DiffRenderer.js.map +1 -1
- package/dist/src/ui/components/messages/DiffRenderer.test.d.ts +6 -0
- package/dist/src/ui/components/messages/DiffRenderer.test.js +239 -0
- package/dist/src/ui/components/messages/DiffRenderer.test.js.map +1 -0
- package/dist/src/ui/components/messages/InfoMessage.js +2 -1
- package/dist/src/ui/components/messages/InfoMessage.js.map +1 -1
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js +36 -14
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -1
- package/dist/src/ui/components/messages/ToolConfirmationMessage.test.d.ts +6 -0
- package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js +37 -0
- package/dist/src/ui/components/messages/ToolConfirmationMessage.test.js.map +1 -0
- package/dist/src/ui/components/messages/ToolMessage.test.d.ts +6 -0
- package/dist/src/ui/components/messages/ToolMessage.test.js +118 -0
- package/dist/src/ui/components/messages/ToolMessage.test.js.map +1 -0
- package/dist/src/ui/components/shared/MaxSizedBox.js +1 -1
- package/dist/src/ui/components/shared/MaxSizedBox.js.map +1 -1
- package/dist/src/ui/components/shared/MaxSizedBox.test.d.ts +6 -0
- package/dist/src/ui/components/shared/MaxSizedBox.test.js +154 -0
- package/dist/src/ui/components/shared/MaxSizedBox.test.js.map +1 -0
- package/dist/src/ui/components/shared/RadioButtonSelect.js +11 -9
- package/dist/src/ui/components/shared/RadioButtonSelect.js.map +1 -1
- package/dist/src/ui/components/shared/RadioButtonSelect.test.d.ts +6 -0
- package/dist/src/ui/components/shared/RadioButtonSelect.test.js +111 -0
- package/dist/src/ui/components/shared/RadioButtonSelect.test.js.map +1 -0
- package/dist/src/ui/components/shared/text-buffer.d.ts +17 -4
- package/dist/src/ui/components/shared/text-buffer.js +262 -80
- package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
- package/dist/src/ui/components/shared/vim-buffer-actions.js +139 -152
- package/dist/src/ui/components/shared/vim-buffer-actions.js.map +1 -1
- package/dist/src/ui/contexts/KeypressContext.d.ts +30 -0
- package/dist/src/ui/contexts/KeypressContext.js +309 -0
- package/dist/src/ui/contexts/KeypressContext.js.map +1 -0
- package/dist/src/ui/contexts/KeypressContext.test.d.ts +6 -0
- package/dist/src/ui/contexts/KeypressContext.test.js +219 -0
- package/dist/src/ui/contexts/KeypressContext.test.js.map +1 -0
- package/dist/src/ui/contexts/SessionContext.d.ts +3 -0
- package/dist/src/ui/contexts/SessionContext.js +2 -1
- package/dist/src/ui/contexts/SessionContext.js.map +1 -1
- package/dist/src/ui/contexts/SettingsContext.d.ts +9 -0
- package/dist/src/ui/contexts/SettingsContext.js +15 -0
- package/dist/src/ui/contexts/SettingsContext.js.map +1 -0
- package/dist/src/ui/hooks/atCommandProcessor.js +16 -13
- package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/atCommandProcessor.test.d.ts +6 -0
- package/dist/src/ui/hooks/atCommandProcessor.test.js +809 -0
- package/dist/src/ui/hooks/atCommandProcessor.test.js.map +1 -0
- package/dist/src/ui/hooks/shellCommandProcessor.test.d.ts +6 -0
- package/dist/src/ui/hooks/shellCommandProcessor.test.js +328 -0
- package/dist/src/ui/hooks/shellCommandProcessor.test.js.map +1 -0
- package/dist/src/ui/hooks/slashCommandProcessor.d.ts +6 -2
- package/dist/src/ui/hooks/slashCommandProcessor.js +121 -57
- package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/useAtCompletion.d.ts +23 -0
- package/dist/src/ui/hooks/useAtCompletion.js +178 -0
- package/dist/src/ui/hooks/useAtCompletion.js.map +1 -0
- package/dist/src/ui/hooks/useAutoAcceptIndicator.js +5 -5
- package/dist/src/ui/hooks/useAutoAcceptIndicator.js.map +1 -1
- package/dist/src/ui/hooks/useAutoAcceptIndicator.test.d.ts +6 -0
- package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js +191 -0
- package/dist/src/ui/hooks/useAutoAcceptIndicator.test.js.map +1 -0
- package/dist/src/ui/hooks/useCommandCompletion.d.ts +6 -1
- package/dist/src/ui/hooks/useCommandCompletion.js +95 -383
- package/dist/src/ui/hooks/useCommandCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useEditorSettings.test.d.ts +6 -0
- package/dist/src/ui/hooks/useEditorSettings.test.js +164 -0
- package/dist/src/ui/hooks/useEditorSettings.test.js.map +1 -0
- package/dist/src/ui/hooks/useFocus.d.ts +4 -0
- package/dist/src/ui/hooks/useFocus.js +4 -4
- package/dist/src/ui/hooks/useFocus.js.map +1 -1
- package/dist/src/ui/hooks/useFolderTrust.d.ts +12 -0
- package/dist/src/ui/hooks/useFolderTrust.js +55 -0
- package/dist/src/ui/hooks/useFolderTrust.js.map +1 -0
- package/dist/src/ui/hooks/useGeminiStream.d.ts +2 -1
- package/dist/src/ui/hooks/useGeminiStream.js +35 -22
- package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
- package/dist/src/ui/hooks/useGitBranchName.test.d.ts +6 -0
- package/dist/src/ui/hooks/useGitBranchName.test.js +175 -0
- package/dist/src/ui/hooks/useGitBranchName.test.js.map +1 -0
- package/dist/src/ui/hooks/useHistoryManager.test.d.ts +6 -0
- package/dist/src/ui/hooks/useHistoryManager.test.js +171 -0
- package/dist/src/ui/hooks/useHistoryManager.test.js.map +1 -0
- package/dist/src/ui/hooks/useInputHistory.test.d.ts +6 -0
- package/dist/src/ui/hooks/useInputHistory.test.js +207 -0
- package/dist/src/ui/hooks/useInputHistory.test.js.map +1 -0
- package/dist/src/ui/hooks/useKeypress.d.ts +4 -16
- package/dist/src/ui/hooks/useKeypress.js +8 -140
- package/dist/src/ui/hooks/useKeypress.js.map +1 -1
- package/dist/src/ui/hooks/useKittyKeyboardProtocol.d.ts +15 -0
- package/dist/src/ui/hooks/useKittyKeyboardProtocol.js +20 -0
- package/dist/src/ui/hooks/useKittyKeyboardProtocol.js.map +1 -0
- package/dist/src/ui/hooks/useLoadingIndicator.test.d.ts +6 -0
- package/dist/src/ui/hooks/useLoadingIndicator.test.js +91 -0
- package/dist/src/ui/hooks/useLoadingIndicator.test.js.map +1 -0
- package/dist/src/ui/hooks/useMessageQueue.d.ts +22 -0
- package/dist/src/ui/hooks/useMessageQueue.js +49 -0
- package/dist/src/ui/hooks/useMessageQueue.js.map +1 -0
- package/dist/src/ui/hooks/useMessageQueue.test.d.ts +6 -0
- package/dist/src/ui/hooks/useMessageQueue.test.js +158 -0
- package/dist/src/ui/hooks/useMessageQueue.test.js.map +1 -0
- package/dist/src/ui/hooks/usePhraseCycler.js +2 -5
- package/dist/src/ui/hooks/usePhraseCycler.js.map +1 -1
- package/dist/src/ui/hooks/usePrivacySettings.js +6 -2
- package/dist/src/ui/hooks/usePrivacySettings.js.map +1 -1
- package/dist/src/ui/hooks/usePrivacySettings.test.d.ts +6 -0
- package/dist/src/ui/hooks/usePrivacySettings.test.js +154 -0
- package/dist/src/ui/hooks/usePrivacySettings.test.js.map +1 -0
- package/dist/src/ui/hooks/useReactToolScheduler.d.ts +1 -1
- package/dist/src/ui/hooks/useReactToolScheduler.js +18 -16
- package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -1
- package/dist/src/ui/hooks/useReverseSearchCompletion.js +4 -2
- package/dist/src/ui/hooks/useReverseSearchCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useReverseSearchCompletion.test.d.ts +6 -0
- package/dist/src/ui/hooks/useReverseSearchCompletion.test.js +163 -0
- package/dist/src/ui/hooks/useReverseSearchCompletion.test.js.map +1 -0
- package/dist/src/ui/hooks/useSettingsCommand.d.ts +10 -0
- package/dist/src/ui/hooks/useSettingsCommand.js +21 -0
- package/dist/src/ui/hooks/useSettingsCommand.js.map +1 -0
- package/dist/src/ui/hooks/useShellHistory.test.d.ts +6 -0
- package/dist/src/ui/hooks/useShellHistory.test.js +159 -0
- package/dist/src/ui/hooks/useShellHistory.test.js.map +1 -0
- package/dist/src/ui/hooks/useSlashCompletion.d.ts +20 -0
- package/dist/src/ui/hooks/useSlashCompletion.js +135 -0
- package/dist/src/ui/hooks/useSlashCompletion.js.map +1 -0
- package/dist/src/ui/hooks/useSlashCompletion.test.d.ts +6 -0
- package/dist/src/ui/hooks/useSlashCompletion.test.js +272 -0
- package/dist/src/ui/hooks/useSlashCompletion.test.js.map +1 -0
- package/dist/src/ui/hooks/useThemeCommand.js +1 -1
- package/dist/src/ui/hooks/useThemeCommand.js.map +1 -1
- package/dist/src/ui/hooks/useTimer.test.d.ts +6 -0
- package/dist/src/ui/hooks/useTimer.test.js +90 -0
- package/dist/src/ui/hooks/useTimer.test.js.map +1 -0
- package/dist/src/ui/hooks/useToolScheduler.test.d.ts +6 -0
- package/dist/src/ui/hooks/useToolScheduler.test.js +846 -0
- package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -0
- package/dist/src/ui/hooks/vim.js +13 -4
- package/dist/src/ui/hooks/vim.js.map +1 -1
- package/dist/src/ui/keyMatchers.d.ts +26 -0
- package/dist/src/ui/keyMatchers.js +68 -0
- package/dist/src/ui/keyMatchers.js.map +1 -0
- package/dist/src/ui/keyMatchers.test.d.ts +6 -0
- package/dist/src/ui/keyMatchers.test.js +276 -0
- package/dist/src/ui/keyMatchers.test.js.map +1 -0
- package/dist/src/ui/privacy/CloudFreePrivacyNotice.js +5 -4
- package/dist/src/ui/privacy/CloudFreePrivacyNotice.js.map +1 -1
- package/dist/src/ui/privacy/CloudPaidPrivacyNotice.js +5 -4
- package/dist/src/ui/privacy/CloudPaidPrivacyNotice.js.map +1 -1
- package/dist/src/ui/privacy/GeminiPrivacyNotice.js +5 -4
- package/dist/src/ui/privacy/GeminiPrivacyNotice.js.map +1 -1
- package/dist/src/ui/semantic-colors.d.ts +7 -0
- package/dist/src/ui/semantic-colors.js +24 -0
- package/dist/src/ui/semantic-colors.js.map +1 -0
- package/dist/src/ui/themes/ansi-light.js +2 -1
- package/dist/src/ui/themes/ansi-light.js.map +1 -1
- package/dist/src/ui/themes/ansi.js +2 -1
- package/dist/src/ui/themes/ansi.js.map +1 -1
- package/dist/src/ui/themes/atom-one-dark.js +2 -1
- package/dist/src/ui/themes/atom-one-dark.js.map +1 -1
- package/dist/src/ui/themes/ayu-light.js +2 -1
- package/dist/src/ui/themes/ayu-light.js.map +1 -1
- package/dist/src/ui/themes/ayu.js +2 -1
- package/dist/src/ui/themes/ayu.js.map +1 -1
- package/dist/src/ui/themes/color-utils.test.d.ts +6 -0
- package/dist/src/ui/themes/color-utils.test.js +197 -0
- package/dist/src/ui/themes/color-utils.test.js.map +1 -0
- package/dist/src/ui/themes/default-light.js +2 -1
- package/dist/src/ui/themes/default-light.js.map +1 -1
- package/dist/src/ui/themes/default.js +2 -1
- package/dist/src/ui/themes/default.js.map +1 -1
- package/dist/src/ui/themes/dracula.js +2 -1
- package/dist/src/ui/themes/dracula.js.map +1 -1
- package/dist/src/ui/themes/github-dark.js +2 -1
- package/dist/src/ui/themes/github-dark.js.map +1 -1
- package/dist/src/ui/themes/github-light.js +2 -1
- package/dist/src/ui/themes/github-light.js.map +1 -1
- package/dist/src/ui/themes/googlecode.js +2 -1
- package/dist/src/ui/themes/googlecode.js.map +1 -1
- package/dist/src/ui/themes/no-color.js +30 -1
- package/dist/src/ui/themes/no-color.js.map +1 -1
- package/dist/src/ui/themes/semantic-tokens.d.ts +37 -0
- package/dist/src/ui/themes/semantic-tokens.js +94 -0
- package/dist/src/ui/themes/semantic-tokens.js.map +1 -0
- package/dist/src/ui/themes/shades-of-purple.js +2 -1
- package/dist/src/ui/themes/shades-of-purple.js.map +1 -1
- package/dist/src/ui/themes/theme-manager.d.ts +6 -0
- package/dist/src/ui/themes/theme-manager.js +8 -1
- package/dist/src/ui/themes/theme-manager.js.map +1 -1
- package/dist/src/ui/themes/theme-manager.test.d.ts +6 -0
- package/dist/src/ui/themes/theme-manager.test.js +83 -0
- package/dist/src/ui/themes/theme-manager.test.js.map +1 -0
- package/dist/src/ui/themes/theme.d.ts +45 -2
- package/dist/src/ui/themes/theme.js +92 -107
- package/dist/src/ui/themes/theme.js.map +1 -1
- package/dist/src/ui/themes/xcode.js +2 -1
- package/dist/src/ui/themes/xcode.js.map +1 -1
- package/dist/src/ui/types.d.ts +3 -1
- package/dist/src/ui/types.js.map +1 -1
- package/dist/src/ui/utils/CodeColorizer.d.ts +2 -1
- package/dist/src/ui/utils/CodeColorizer.js +5 -4
- package/dist/src/ui/utils/CodeColorizer.js.map +1 -1
- package/dist/src/ui/utils/ConsolePatcher.d.ts +3 -1
- package/dist/src/ui/utils/ConsolePatcher.js +18 -8
- package/dist/src/ui/utils/ConsolePatcher.js.map +1 -1
- package/dist/src/ui/utils/InlineMarkdownRenderer.js +8 -1
- package/dist/src/ui/utils/InlineMarkdownRenderer.js.map +1 -1
- package/dist/src/ui/utils/MarkdownDisplay.js +4 -2
- package/dist/src/ui/utils/MarkdownDisplay.js.map +1 -1
- package/dist/src/ui/utils/MarkdownDisplay.test.d.ts +6 -0
- package/dist/src/ui/utils/MarkdownDisplay.test.js +151 -0
- package/dist/src/ui/utils/MarkdownDisplay.test.js.map +1 -0
- package/dist/src/ui/utils/clipboardUtils.test.d.ts +6 -0
- package/dist/src/ui/utils/clipboardUtils.test.js +65 -0
- package/dist/src/ui/utils/clipboardUtils.test.js.map +1 -0
- package/dist/src/ui/utils/commandUtils.d.ts +1 -0
- package/dist/src/ui/utils/commandUtils.js +22 -1
- package/dist/src/ui/utils/commandUtils.js.map +1 -1
- package/dist/src/ui/utils/commandUtils.test.d.ts +6 -0
- package/dist/src/ui/utils/commandUtils.test.js +294 -0
- package/dist/src/ui/utils/commandUtils.test.js.map +1 -0
- package/dist/src/ui/utils/computeStats.js +3 -1
- package/dist/src/ui/utils/computeStats.js.map +1 -1
- package/dist/src/ui/utils/displayUtils.test.d.ts +6 -0
- package/dist/src/ui/utils/displayUtils.test.js +42 -0
- package/dist/src/ui/utils/displayUtils.test.js.map +1 -0
- package/dist/src/ui/utils/formatters.test.d.ts +6 -0
- package/dist/src/ui/utils/formatters.test.js +56 -0
- package/dist/src/ui/utils/formatters.test.js.map +1 -0
- package/dist/src/ui/utils/isNarrowWidth.d.ts +6 -0
- package/dist/src/ui/utils/isNarrowWidth.js +9 -0
- package/dist/src/ui/utils/isNarrowWidth.js.map +1 -0
- package/dist/src/ui/utils/kittyProtocolDetector.d.ts +13 -0
- package/dist/src/ui/utils/kittyProtocolDetector.js +88 -0
- package/dist/src/ui/utils/kittyProtocolDetector.js.map +1 -0
- package/dist/src/ui/utils/markdownUtilities.test.d.ts +6 -0
- package/dist/src/ui/utils/markdownUtilities.test.js +42 -0
- package/dist/src/ui/utils/markdownUtilities.test.js.map +1 -0
- package/dist/src/ui/utils/platformConstants.d.ts +43 -0
- package/dist/src/ui/utils/platformConstants.js +44 -0
- package/dist/src/ui/utils/platformConstants.js.map +1 -0
- package/dist/src/ui/utils/terminalSetup.d.ts +30 -0
- package/dist/src/ui/utils/terminalSetup.js +281 -0
- package/dist/src/ui/utils/terminalSetup.js.map +1 -0
- package/dist/src/ui/utils/updateCheck.js +1 -1
- package/dist/src/ui/utils/updateCheck.js.map +1 -1
- package/dist/src/ui/utils/updateCheck.test.d.ts +6 -0
- package/dist/src/ui/utils/updateCheck.test.js +145 -0
- package/dist/src/ui/utils/updateCheck.test.js.map +1 -0
- package/dist/src/utils/checks.d.ts +19 -0
- package/dist/src/utils/checks.js +24 -0
- package/dist/src/utils/checks.js.map +1 -0
- package/dist/src/utils/cleanup.d.ts +2 -2
- package/dist/src/utils/cleanup.js +2 -2
- package/dist/src/utils/cleanup.js.map +1 -1
- package/dist/src/utils/dialogScopeUtils.d.ts +31 -0
- package/dist/src/utils/dialogScopeUtils.js +48 -0
- package/dist/src/utils/dialogScopeUtils.js.map +1 -0
- package/dist/src/utils/gitUtils.d.ts +21 -1
- package/dist/src/utils/gitUtils.js +68 -3
- package/dist/src/utils/gitUtils.js.map +1 -1
- package/dist/src/utils/gitUtils.test.d.ts +6 -0
- package/dist/src/utils/gitUtils.test.js +113 -0
- package/dist/src/utils/gitUtils.test.js.map +1 -0
- package/dist/src/utils/installationInfo.test.d.ts +6 -0
- package/dist/src/utils/installationInfo.test.js +242 -0
- package/dist/src/utils/installationInfo.test.js.map +1 -0
- package/dist/src/utils/readStdin.js +10 -0
- package/dist/src/utils/readStdin.js.map +1 -1
- package/dist/src/utils/sandbox.js +443 -420
- package/dist/src/utils/sandbox.js.map +1 -1
- package/dist/src/utils/settingsUtils.d.ts +134 -0
- package/dist/src/utils/settingsUtils.js +336 -0
- package/dist/src/utils/settingsUtils.js.map +1 -0
- package/dist/src/utils/settingsUtils.test.d.ts +6 -0
- package/dist/src/utils/settingsUtils.test.js +514 -0
- package/dist/src/utils/settingsUtils.test.js.map +1 -0
- package/dist/src/utils/userStartupWarnings.test.d.ts +6 -0
- package/dist/src/utils/userStartupWarnings.test.js +67 -0
- package/dist/src/utils/userStartupWarnings.test.js.map +1 -0
- package/dist/src/utils/version.js +1 -1
- package/dist/src/utils/version.js.map +1 -1
- package/dist/src/validateNonInterActiveAuth.js +3 -3
- package/dist/src/validateNonInterActiveAuth.js.map +1 -1
- package/dist/src/zed-integration/acp.d.ts +63 -0
- package/dist/src/{acp → zed-integration}/acp.js +76 -44
- package/dist/src/zed-integration/acp.js.map +1 -0
- package/dist/src/zed-integration/fileSystemService.d.ts +19 -0
- package/dist/src/zed-integration/fileSystemService.js +43 -0
- package/dist/src/zed-integration/fileSystemService.js.map +1 -0
- package/dist/src/zed-integration/schema.d.ts +11679 -0
- package/dist/src/zed-integration/schema.js +305 -0
- package/dist/src/zed-integration/schema.js.map +1 -0
- package/dist/src/zed-integration/zedIntegration.d.ts +10 -0
- package/dist/src/{acp/acpPeer.js → zed-integration/zedIntegration.js} +336 -169
- package/dist/src/zed-integration/zedIntegration.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -9
- package/dist/src/acp/acp.d.ts +0 -208
- package/dist/src/acp/acp.js.map +0 -1
- package/dist/src/acp/acpPeer.d.ts +0 -8
- package/dist/src/acp/acpPeer.js.map +0 -1
- package/dist/src/ui/components/IDEContextDetailDisplay.d.ts +0 -12
- package/dist/src/ui/components/IDEContextDetailDisplay.js +0 -12
- package/dist/src/ui/components/IDEContextDetailDisplay.js.map +0 -1
- package/dist/src/ui/utils/errorParsing.d.ts +0 -7
- package/dist/src/ui/utils/errorParsing.js +0 -90
- package/dist/src/ui/utils/errorParsing.js.map +0 -1
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { AuthType, logToolCall, convertToFunctionResponse, ToolConfirmationOutcome, clearCachedCredentialFile, isNodeError, getErrorMessage, isWithinRoot, getErrorStatus, } from '@machina.ai/cell-cli-core';
|
|
6
|
+
import { AuthType, logToolCall, convertToFunctionResponse, ToolConfirmationOutcome, clearCachedCredentialFile, isNodeError, getErrorMessage, isWithinRoot, getErrorStatus, MCPServerConfig, DiscoveredMCPTool, } from '@machina.ai/cell-cli-core';
|
|
7
7
|
import * as acp from './acp.js';
|
|
8
|
+
import { AcpFileSystemService } from './fileSystemService.js';
|
|
8
9
|
import { Readable, Writable } from 'node:stream';
|
|
9
10
|
import { SettingScope } from '../config/settings.js';
|
|
10
11
|
import * as fs from 'fs/promises';
|
|
11
12
|
import * as path from 'path';
|
|
12
|
-
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
import { randomUUID } from 'crypto';
|
|
15
|
+
import { loadCliConfig } from '../config/config.js';
|
|
16
|
+
export async function runZedIntegration(config, settings, extensions, argv) {
|
|
13
17
|
const stdout = Writable.toWeb(process.stdout);
|
|
14
18
|
const stdin = Readable.toWeb(process.stdin);
|
|
15
19
|
// Stdout is used to send messages to the client, so console.log/console.info
|
|
@@ -17,61 +21,144 @@ export async function runAcpPeer(config, settings) {
|
|
|
17
21
|
console.log = console.error;
|
|
18
22
|
console.info = console.error;
|
|
19
23
|
console.debug = console.error;
|
|
20
|
-
new acp.
|
|
24
|
+
new acp.AgentSideConnection((client) => new GeminiAgent(config, settings, extensions, argv, client), stdout, stdin);
|
|
21
25
|
}
|
|
22
26
|
class GeminiAgent {
|
|
23
27
|
config;
|
|
24
28
|
settings;
|
|
29
|
+
extensions;
|
|
30
|
+
argv;
|
|
25
31
|
client;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
constructor(config, settings, client) {
|
|
32
|
+
sessions = new Map();
|
|
33
|
+
clientCapabilities;
|
|
34
|
+
constructor(config, settings, extensions, argv, client) {
|
|
29
35
|
this.config = config;
|
|
30
36
|
this.settings = settings;
|
|
37
|
+
this.extensions = extensions;
|
|
38
|
+
this.argv = argv;
|
|
31
39
|
this.client = client;
|
|
32
40
|
}
|
|
33
|
-
async initialize(
|
|
41
|
+
async initialize(args) {
|
|
42
|
+
this.clientCapabilities = args.clientCapabilities;
|
|
43
|
+
const authMethods = [
|
|
44
|
+
{
|
|
45
|
+
id: AuthType.LOGIN_WITH_GOOGLE,
|
|
46
|
+
name: 'Log in with Google',
|
|
47
|
+
description: null,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: AuthType.USE_GEMINI,
|
|
51
|
+
name: 'Use Gemini API key',
|
|
52
|
+
description: 'Requires setting the `GEMINI_API_KEY` environment variable',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: AuthType.USE_VERTEX_AI,
|
|
56
|
+
name: 'Vertex AI',
|
|
57
|
+
description: null,
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
return {
|
|
61
|
+
protocolVersion: acp.PROTOCOL_VERSION,
|
|
62
|
+
authMethods,
|
|
63
|
+
agentCapabilities: {
|
|
64
|
+
loadSession: false,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
async authenticate({ methodId }) {
|
|
69
|
+
const method = z.nativeEnum(AuthType).parse(methodId);
|
|
70
|
+
await clearCachedCredentialFile();
|
|
71
|
+
await this.config.refreshAuth(method);
|
|
72
|
+
this.settings.setValue(SettingScope.User, 'selectedAuthType', method);
|
|
73
|
+
}
|
|
74
|
+
async newSession({ cwd, mcpServers, }) {
|
|
75
|
+
const sessionId = randomUUID();
|
|
76
|
+
const config = await this.newSessionConfig(sessionId, cwd, mcpServers);
|
|
34
77
|
let isAuthenticated = false;
|
|
35
78
|
if (this.settings.merged.selectedAuthType) {
|
|
36
79
|
try {
|
|
37
|
-
await
|
|
80
|
+
await config.refreshAuth(this.settings.merged.selectedAuthType);
|
|
38
81
|
isAuthenticated = true;
|
|
39
82
|
}
|
|
40
|
-
catch (
|
|
41
|
-
console.error(
|
|
83
|
+
catch (e) {
|
|
84
|
+
console.error(`Authentication failed: ${e}`);
|
|
42
85
|
}
|
|
43
86
|
}
|
|
44
|
-
|
|
87
|
+
if (!isAuthenticated) {
|
|
88
|
+
throw acp.RequestError.authRequired();
|
|
89
|
+
}
|
|
90
|
+
if (this.clientCapabilities?.fs) {
|
|
91
|
+
const acpFileSystemService = new AcpFileSystemService(this.client, sessionId, this.clientCapabilities.fs, config.getFileSystemService());
|
|
92
|
+
config.setFileSystemService(acpFileSystemService);
|
|
93
|
+
}
|
|
94
|
+
const geminiClient = config.getGeminiClient();
|
|
95
|
+
const chat = await geminiClient.startChat();
|
|
96
|
+
const session = new Session(sessionId, chat, config, this.client);
|
|
97
|
+
this.sessions.set(sessionId, session);
|
|
98
|
+
return {
|
|
99
|
+
sessionId,
|
|
100
|
+
};
|
|
45
101
|
}
|
|
46
|
-
async
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
102
|
+
async newSessionConfig(sessionId, cwd, mcpServers) {
|
|
103
|
+
const mergedMcpServers = { ...this.settings.merged.mcpServers };
|
|
104
|
+
for (const { command, args, env: rawEnv, name } of mcpServers) {
|
|
105
|
+
const env = {};
|
|
106
|
+
for (const { name: envName, value } of rawEnv) {
|
|
107
|
+
env[envName] = value;
|
|
108
|
+
}
|
|
109
|
+
mergedMcpServers[name] = new MCPServerConfig(command, args, env, cwd);
|
|
110
|
+
}
|
|
111
|
+
const settings = { ...this.settings.merged, mcpServers: mergedMcpServers };
|
|
112
|
+
const config = await loadCliConfig(settings, this.extensions, sessionId, this.argv, cwd);
|
|
113
|
+
await config.initialize();
|
|
114
|
+
return config;
|
|
115
|
+
}
|
|
116
|
+
async cancel(params) {
|
|
117
|
+
const session = this.sessions.get(params.sessionId);
|
|
118
|
+
if (!session) {
|
|
119
|
+
throw new Error(`Session not found: ${params.sessionId}`);
|
|
120
|
+
}
|
|
121
|
+
await session.cancelPendingPrompt();
|
|
122
|
+
}
|
|
123
|
+
async prompt(params) {
|
|
124
|
+
const session = this.sessions.get(params.sessionId);
|
|
125
|
+
if (!session) {
|
|
126
|
+
throw new Error(`Session not found: ${params.sessionId}`);
|
|
127
|
+
}
|
|
128
|
+
return session.prompt(params);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
class Session {
|
|
132
|
+
id;
|
|
133
|
+
chat;
|
|
134
|
+
config;
|
|
135
|
+
client;
|
|
136
|
+
pendingPrompt = null;
|
|
137
|
+
constructor(id, chat, config, client) {
|
|
138
|
+
this.id = id;
|
|
139
|
+
this.chat = chat;
|
|
140
|
+
this.config = config;
|
|
141
|
+
this.client = client;
|
|
50
142
|
}
|
|
51
|
-
async
|
|
52
|
-
if (!this.
|
|
143
|
+
async cancelPendingPrompt() {
|
|
144
|
+
if (!this.pendingPrompt) {
|
|
53
145
|
throw new Error('Not currently generating');
|
|
54
146
|
}
|
|
55
|
-
this.
|
|
56
|
-
|
|
147
|
+
this.pendingPrompt.abort();
|
|
148
|
+
this.pendingPrompt = null;
|
|
57
149
|
}
|
|
58
|
-
async
|
|
59
|
-
this.
|
|
150
|
+
async prompt(params) {
|
|
151
|
+
this.pendingPrompt?.abort();
|
|
60
152
|
const pendingSend = new AbortController();
|
|
61
|
-
this.
|
|
62
|
-
if (!this.chat) {
|
|
63
|
-
const geminiClient = this.config.getGeminiClient();
|
|
64
|
-
this.chat = await geminiClient.startChat();
|
|
65
|
-
}
|
|
153
|
+
this.pendingPrompt = pendingSend;
|
|
66
154
|
const promptId = Math.random().toString(16).slice(2);
|
|
67
155
|
const chat = this.chat;
|
|
68
|
-
const
|
|
69
|
-
const parts = await this.#resolveUserMessage(params, pendingSend.signal);
|
|
156
|
+
const parts = await this.#resolvePrompt(params.prompt, pendingSend.signal);
|
|
70
157
|
let nextMessage = { role: 'user', parts };
|
|
71
158
|
while (nextMessage !== null) {
|
|
72
159
|
if (pendingSend.signal.aborted) {
|
|
73
160
|
chat.addHistory(nextMessage);
|
|
74
|
-
return;
|
|
161
|
+
return { stopReason: 'cancelled' };
|
|
75
162
|
}
|
|
76
163
|
const functionCalls = [];
|
|
77
164
|
try {
|
|
@@ -79,17 +166,12 @@ class GeminiAgent {
|
|
|
79
166
|
message: nextMessage?.parts ?? [],
|
|
80
167
|
config: {
|
|
81
168
|
abortSignal: pendingSend.signal,
|
|
82
|
-
tools: [
|
|
83
|
-
{
|
|
84
|
-
functionDeclarations: toolRegistry.getFunctionDeclarations(),
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
169
|
},
|
|
88
170
|
}, promptId);
|
|
89
171
|
nextMessage = null;
|
|
90
172
|
for await (const resp of responseStream) {
|
|
91
173
|
if (pendingSend.signal.aborted) {
|
|
92
|
-
return;
|
|
174
|
+
return { stopReason: 'cancelled' };
|
|
93
175
|
}
|
|
94
176
|
if (resp.candidates && resp.candidates.length > 0) {
|
|
95
177
|
const candidate = resp.candidates[0];
|
|
@@ -97,10 +179,15 @@ class GeminiAgent {
|
|
|
97
179
|
if (!part.text) {
|
|
98
180
|
continue;
|
|
99
181
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
182
|
+
const content = {
|
|
183
|
+
type: 'text',
|
|
184
|
+
text: part.text,
|
|
185
|
+
};
|
|
186
|
+
this.sendUpdate({
|
|
187
|
+
sessionUpdate: part.thought
|
|
188
|
+
? 'agent_thought_chunk'
|
|
189
|
+
: 'agent_message_chunk',
|
|
190
|
+
content,
|
|
104
191
|
});
|
|
105
192
|
}
|
|
106
193
|
}
|
|
@@ -118,7 +205,7 @@ class GeminiAgent {
|
|
|
118
205
|
if (functionCalls.length > 0) {
|
|
119
206
|
const toolResponseParts = [];
|
|
120
207
|
for (const fc of functionCalls) {
|
|
121
|
-
const response = await this
|
|
208
|
+
const response = await this.runTool(pendingSend.signal, promptId, fc);
|
|
122
209
|
const parts = Array.isArray(response) ? response : [response];
|
|
123
210
|
for (const part of parts) {
|
|
124
211
|
if (typeof part === 'string') {
|
|
@@ -132,8 +219,16 @@ class GeminiAgent {
|
|
|
132
219
|
nextMessage = { role: 'user', parts: toolResponseParts };
|
|
133
220
|
}
|
|
134
221
|
}
|
|
222
|
+
return { stopReason: 'end_turn' };
|
|
223
|
+
}
|
|
224
|
+
async sendUpdate(update) {
|
|
225
|
+
const params = {
|
|
226
|
+
sessionId: this.id,
|
|
227
|
+
update,
|
|
228
|
+
};
|
|
229
|
+
await this.client.sessionUpdate(params);
|
|
135
230
|
}
|
|
136
|
-
async
|
|
231
|
+
async runTool(abortSignal, promptId, fc) {
|
|
137
232
|
const callId = fc.id ?? `${fc.name}-${Date.now()}`;
|
|
138
233
|
const args = (fc.args ?? {});
|
|
139
234
|
const startTime = Date.now();
|
|
@@ -148,6 +243,9 @@ class GeminiAgent {
|
|
|
148
243
|
duration_ms: durationMs,
|
|
149
244
|
success: false,
|
|
150
245
|
error: error.message,
|
|
246
|
+
tool_type: typeof tool !== 'undefined' && tool instanceof DiscoveredMCPTool
|
|
247
|
+
? 'mcp'
|
|
248
|
+
: 'native',
|
|
151
249
|
});
|
|
152
250
|
return [
|
|
153
251
|
{
|
|
@@ -167,58 +265,71 @@ class GeminiAgent {
|
|
|
167
265
|
if (!tool) {
|
|
168
266
|
return errorResponse(new Error(`Tool "${fc.name}" not found in registry.`));
|
|
169
267
|
}
|
|
170
|
-
|
|
171
|
-
const confirmationDetails = await
|
|
268
|
+
const invocation = tool.build(args);
|
|
269
|
+
const confirmationDetails = await invocation.shouldConfirmExecute(abortSignal);
|
|
172
270
|
if (confirmationDetails) {
|
|
173
|
-
|
|
271
|
+
const content = [];
|
|
174
272
|
if (confirmationDetails.type === 'edit') {
|
|
175
|
-
content
|
|
273
|
+
content.push({
|
|
176
274
|
type: 'diff',
|
|
177
275
|
path: confirmationDetails.fileName,
|
|
178
276
|
oldText: confirmationDetails.originalContent,
|
|
179
277
|
newText: confirmationDetails.newContent,
|
|
180
|
-
};
|
|
278
|
+
});
|
|
181
279
|
}
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
280
|
+
const params = {
|
|
281
|
+
sessionId: this.id,
|
|
282
|
+
options: toPermissionOptions(confirmationDetails),
|
|
283
|
+
toolCall: {
|
|
284
|
+
toolCallId: callId,
|
|
285
|
+
status: 'pending',
|
|
286
|
+
title: invocation.getDescription(),
|
|
287
|
+
content,
|
|
288
|
+
locations: invocation.toolLocations(),
|
|
289
|
+
kind: tool.kind,
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
const output = await this.client.requestPermission(params);
|
|
293
|
+
const outcome = output.outcome.outcome === 'cancelled'
|
|
294
|
+
? ToolConfirmationOutcome.Cancel
|
|
295
|
+
: z
|
|
296
|
+
.nativeEnum(ToolConfirmationOutcome)
|
|
297
|
+
.parse(output.outcome.optionId);
|
|
298
|
+
await confirmationDetails.onConfirm(outcome);
|
|
299
|
+
switch (outcome) {
|
|
300
|
+
case ToolConfirmationOutcome.Cancel:
|
|
194
301
|
return errorResponse(new Error(`Tool "${fc.name}" was canceled by the user.`));
|
|
195
|
-
case
|
|
196
|
-
case
|
|
197
|
-
case
|
|
198
|
-
case
|
|
302
|
+
case ToolConfirmationOutcome.ProceedOnce:
|
|
303
|
+
case ToolConfirmationOutcome.ProceedAlways:
|
|
304
|
+
case ToolConfirmationOutcome.ProceedAlwaysServer:
|
|
305
|
+
case ToolConfirmationOutcome.ProceedAlwaysTool:
|
|
306
|
+
case ToolConfirmationOutcome.ModifyWithEditor:
|
|
199
307
|
break;
|
|
200
308
|
default: {
|
|
201
|
-
const resultOutcome =
|
|
309
|
+
const resultOutcome = outcome;
|
|
202
310
|
throw new Error(`Unexpected: ${resultOutcome}`);
|
|
203
311
|
}
|
|
204
312
|
}
|
|
205
|
-
toolCallId = result.id;
|
|
206
313
|
}
|
|
207
314
|
else {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
315
|
+
await this.sendUpdate({
|
|
316
|
+
sessionUpdate: 'tool_call',
|
|
317
|
+
toolCallId: callId,
|
|
318
|
+
status: 'in_progress',
|
|
319
|
+
title: invocation.getDescription(),
|
|
320
|
+
content: [],
|
|
321
|
+
locations: invocation.toolLocations(),
|
|
322
|
+
kind: tool.kind,
|
|
212
323
|
});
|
|
213
|
-
toolCallId = result.id;
|
|
214
324
|
}
|
|
215
325
|
try {
|
|
216
|
-
const toolResult = await
|
|
217
|
-
const
|
|
218
|
-
await this.
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
326
|
+
const toolResult = await invocation.execute(abortSignal);
|
|
327
|
+
const content = toToolCallContent(toolResult);
|
|
328
|
+
await this.sendUpdate({
|
|
329
|
+
sessionUpdate: 'tool_call_update',
|
|
330
|
+
toolCallId: callId,
|
|
331
|
+
status: 'completed',
|
|
332
|
+
content: content ? [content] : [],
|
|
222
333
|
});
|
|
223
334
|
const durationMs = Date.now() - startTime;
|
|
224
335
|
logToolCall(this.config, {
|
|
@@ -229,30 +340,55 @@ class GeminiAgent {
|
|
|
229
340
|
duration_ms: durationMs,
|
|
230
341
|
success: true,
|
|
231
342
|
prompt_id: promptId,
|
|
343
|
+
tool_type: typeof tool !== 'undefined' && tool instanceof DiscoveredMCPTool
|
|
344
|
+
? 'mcp'
|
|
345
|
+
: 'native',
|
|
232
346
|
});
|
|
233
347
|
return convertToFunctionResponse(fc.name, callId, toolResult.llmContent);
|
|
234
348
|
}
|
|
235
349
|
catch (e) {
|
|
236
350
|
const error = e instanceof Error ? e : new Error(String(e));
|
|
237
|
-
await this.
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
351
|
+
await this.sendUpdate({
|
|
352
|
+
sessionUpdate: 'tool_call_update',
|
|
353
|
+
toolCallId: callId,
|
|
354
|
+
status: 'failed',
|
|
355
|
+
content: [
|
|
356
|
+
{ type: 'content', content: { type: 'text', text: error.message } },
|
|
357
|
+
],
|
|
241
358
|
});
|
|
242
359
|
return errorResponse(error);
|
|
243
360
|
}
|
|
244
361
|
}
|
|
245
|
-
async #
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
362
|
+
async #resolvePrompt(message, abortSignal) {
|
|
363
|
+
const parts = message.map((part) => {
|
|
364
|
+
switch (part.type) {
|
|
365
|
+
case 'text':
|
|
366
|
+
return { text: part.text };
|
|
367
|
+
case 'resource_link':
|
|
368
|
+
return {
|
|
369
|
+
fileData: {
|
|
370
|
+
mimeData: part.mimeType,
|
|
371
|
+
name: part.name,
|
|
372
|
+
fileUri: part.uri,
|
|
373
|
+
},
|
|
374
|
+
};
|
|
375
|
+
case 'resource': {
|
|
376
|
+
return {
|
|
377
|
+
fileData: {
|
|
378
|
+
mimeData: part.resource.mimeType,
|
|
379
|
+
name: part.resource.uri,
|
|
380
|
+
fileUri: part.resource.uri,
|
|
381
|
+
},
|
|
382
|
+
};
|
|
251
383
|
}
|
|
252
|
-
|
|
253
|
-
throw new Error(
|
|
384
|
+
default: {
|
|
385
|
+
throw new Error(`Unexpected chunk type: '${part.type}'`);
|
|
254
386
|
}
|
|
255
|
-
}
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
const atPathCommandParts = parts.filter((part) => 'fileData' in part);
|
|
390
|
+
if (atPathCommandParts.length === 0) {
|
|
391
|
+
return parts;
|
|
256
392
|
}
|
|
257
393
|
// Get centralized file discovery service
|
|
258
394
|
const fileDiscovery = this.config.getFileService();
|
|
@@ -268,7 +404,7 @@ class GeminiAgent {
|
|
|
268
404
|
throw new Error('Error: read_many_files tool not found.');
|
|
269
405
|
}
|
|
270
406
|
for (const atPathPart of atPathCommandParts) {
|
|
271
|
-
const pathName = atPathPart.
|
|
407
|
+
const pathName = atPathPart.fileData.fileUri;
|
|
272
408
|
// Check if path should be ignored by git
|
|
273
409
|
if (fileDiscovery.shouldGitIgnoreFile(pathName)) {
|
|
274
410
|
ignoredPaths.push(pathName);
|
|
@@ -288,23 +424,23 @@ class GeminiAgent {
|
|
|
288
424
|
currentPathSpec = pathName.endsWith('/')
|
|
289
425
|
? `${pathName}**`
|
|
290
426
|
: `${pathName}/**`;
|
|
291
|
-
this
|
|
427
|
+
this.debug(`Path ${pathName} resolved to directory, using glob: ${currentPathSpec}`);
|
|
292
428
|
}
|
|
293
429
|
else {
|
|
294
|
-
this
|
|
430
|
+
this.debug(`Path ${pathName} resolved to file: ${currentPathSpec}`);
|
|
295
431
|
}
|
|
296
432
|
resolvedSuccessfully = true;
|
|
297
433
|
}
|
|
298
434
|
else {
|
|
299
|
-
this
|
|
435
|
+
this.debug(`Path ${pathName} is outside the project directory. Skipping.`);
|
|
300
436
|
}
|
|
301
437
|
}
|
|
302
438
|
catch (error) {
|
|
303
439
|
if (isNodeError(error) && error.code === 'ENOENT') {
|
|
304
440
|
if (this.config.getEnableRecursiveFileSearch() && globTool) {
|
|
305
|
-
this
|
|
441
|
+
this.debug(`Path ${pathName} not found directly, attempting glob search.`);
|
|
306
442
|
try {
|
|
307
|
-
const globResult = await globTool.
|
|
443
|
+
const globResult = await globTool.buildAndExecute({
|
|
308
444
|
pattern: `**/*${pathName}*`,
|
|
309
445
|
path: this.config.getTargetDir(),
|
|
310
446
|
}, abortSignal);
|
|
@@ -316,15 +452,15 @@ class GeminiAgent {
|
|
|
316
452
|
if (lines.length > 1 && lines[1]) {
|
|
317
453
|
const firstMatchAbsolute = lines[1].trim();
|
|
318
454
|
currentPathSpec = path.relative(this.config.getTargetDir(), firstMatchAbsolute);
|
|
319
|
-
this
|
|
455
|
+
this.debug(`Glob search for ${pathName} found ${firstMatchAbsolute}, using relative path: ${currentPathSpec}`);
|
|
320
456
|
resolvedSuccessfully = true;
|
|
321
457
|
}
|
|
322
458
|
else {
|
|
323
|
-
this
|
|
459
|
+
this.debug(`Glob search for '**/*${pathName}*' did not return a usable path. Path ${pathName} will be skipped.`);
|
|
324
460
|
}
|
|
325
461
|
}
|
|
326
462
|
else {
|
|
327
|
-
this
|
|
463
|
+
this.debug(`Glob search for '**/*${pathName}*' found no files or an error. Path ${pathName} will be skipped.`);
|
|
328
464
|
}
|
|
329
465
|
}
|
|
330
466
|
catch (globError) {
|
|
@@ -332,7 +468,7 @@ class GeminiAgent {
|
|
|
332
468
|
}
|
|
333
469
|
}
|
|
334
470
|
else {
|
|
335
|
-
this
|
|
471
|
+
this.debug(`Glob tool not found. Path ${pathName} will be skipped.`);
|
|
336
472
|
}
|
|
337
473
|
}
|
|
338
474
|
else {
|
|
@@ -347,22 +483,23 @@ class GeminiAgent {
|
|
|
347
483
|
}
|
|
348
484
|
// Construct the initial part of the query for the LLM
|
|
349
485
|
let initialQueryText = '';
|
|
350
|
-
for (let i = 0; i <
|
|
351
|
-
const chunk =
|
|
486
|
+
for (let i = 0; i < parts.length; i++) {
|
|
487
|
+
const chunk = parts[i];
|
|
352
488
|
if ('text' in chunk) {
|
|
353
489
|
initialQueryText += chunk.text;
|
|
354
490
|
}
|
|
355
491
|
else {
|
|
356
492
|
// type === 'atPath'
|
|
357
|
-
const resolvedSpec = atPathToResolvedSpecMap.get(chunk.
|
|
493
|
+
const resolvedSpec = chunk.fileData && atPathToResolvedSpecMap.get(chunk.fileData.fileUri);
|
|
358
494
|
if (i > 0 &&
|
|
359
495
|
initialQueryText.length > 0 &&
|
|
360
496
|
!initialQueryText.endsWith(' ') &&
|
|
361
497
|
resolvedSpec) {
|
|
362
498
|
// Add space if previous part was text and didn't end with space, or if previous was @path
|
|
363
|
-
const prevPart =
|
|
499
|
+
const prevPart = parts[i - 1];
|
|
364
500
|
if ('text' in prevPart ||
|
|
365
|
-
('
|
|
501
|
+
('fileData' in prevPart &&
|
|
502
|
+
atPathToResolvedSpecMap.has(prevPart.fileData.fileUri))) {
|
|
366
503
|
initialQueryText += ' ';
|
|
367
504
|
}
|
|
368
505
|
}
|
|
@@ -375,10 +512,12 @@ class GeminiAgent {
|
|
|
375
512
|
if (i > 0 &&
|
|
376
513
|
initialQueryText.length > 0 &&
|
|
377
514
|
!initialQueryText.endsWith(' ') &&
|
|
378
|
-
!chunk.
|
|
515
|
+
!chunk.fileData?.fileUri.startsWith(' ')) {
|
|
379
516
|
initialQueryText += ' ';
|
|
380
517
|
}
|
|
381
|
-
|
|
518
|
+
if (chunk.fileData?.fileUri) {
|
|
519
|
+
initialQueryText += `@${chunk.fileData.fileUri}`;
|
|
520
|
+
}
|
|
382
521
|
}
|
|
383
522
|
}
|
|
384
523
|
}
|
|
@@ -386,7 +525,7 @@ class GeminiAgent {
|
|
|
386
525
|
// Inform user about ignored paths
|
|
387
526
|
if (ignoredPaths.length > 0) {
|
|
388
527
|
const ignoreType = respectGitIgnore ? 'git-ignored' : 'custom-ignored';
|
|
389
|
-
this
|
|
528
|
+
this.debug(`Ignored ${ignoredPaths.length} ${ignoreType} files: ${ignoredPaths.join(', ')}`);
|
|
390
529
|
}
|
|
391
530
|
// Fallback for lone "@" or completely invalid @-commands resulting in empty initialQueryText
|
|
392
531
|
if (pathSpecsToRead.length === 0) {
|
|
@@ -398,20 +537,31 @@ class GeminiAgent {
|
|
|
398
537
|
paths: pathSpecsToRead,
|
|
399
538
|
respectGitIgnore, // Use configuration setting
|
|
400
539
|
};
|
|
401
|
-
const
|
|
402
|
-
icon: readManyFilesTool.icon,
|
|
403
|
-
label: readManyFilesTool.getDescription(toolArgs),
|
|
404
|
-
});
|
|
540
|
+
const callId = `${readManyFilesTool.name}-${Date.now()}`;
|
|
405
541
|
try {
|
|
406
|
-
const
|
|
542
|
+
const invocation = readManyFilesTool.build(toolArgs);
|
|
543
|
+
await this.sendUpdate({
|
|
544
|
+
sessionUpdate: 'tool_call',
|
|
545
|
+
toolCallId: callId,
|
|
546
|
+
status: 'in_progress',
|
|
547
|
+
title: invocation.getDescription(),
|
|
548
|
+
content: [],
|
|
549
|
+
locations: invocation.toolLocations(),
|
|
550
|
+
kind: readManyFilesTool.kind,
|
|
551
|
+
});
|
|
552
|
+
const result = await invocation.execute(abortSignal);
|
|
407
553
|
const content = toToolCallContent(result) || {
|
|
408
|
-
type: '
|
|
409
|
-
|
|
554
|
+
type: 'content',
|
|
555
|
+
content: {
|
|
556
|
+
type: 'text',
|
|
557
|
+
text: `Successfully read: ${contentLabelsForDisplay.join(', ')}`,
|
|
558
|
+
},
|
|
410
559
|
};
|
|
411
|
-
await this.
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
560
|
+
await this.sendUpdate({
|
|
561
|
+
sessionUpdate: 'tool_call_update',
|
|
562
|
+
toolCallId: callId,
|
|
563
|
+
status: 'completed',
|
|
564
|
+
content: content ? [content] : [],
|
|
415
565
|
});
|
|
416
566
|
if (Array.isArray(result.llmContent)) {
|
|
417
567
|
const fileContentRegex = /^--- (.*?) ---\n\n([\s\S]*?)\n\n$/;
|
|
@@ -446,18 +596,24 @@ class GeminiAgent {
|
|
|
446
596
|
return processedQueryParts;
|
|
447
597
|
}
|
|
448
598
|
catch (error) {
|
|
449
|
-
await this.
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
599
|
+
await this.sendUpdate({
|
|
600
|
+
sessionUpdate: 'tool_call_update',
|
|
601
|
+
toolCallId: callId,
|
|
602
|
+
status: 'failed',
|
|
603
|
+
content: [
|
|
604
|
+
{
|
|
605
|
+
type: 'content',
|
|
606
|
+
content: {
|
|
607
|
+
type: 'text',
|
|
608
|
+
text: `Error reading files (${contentLabelsForDisplay.join(', ')}): ${getErrorMessage(error)}`,
|
|
609
|
+
},
|
|
610
|
+
},
|
|
611
|
+
],
|
|
456
612
|
});
|
|
457
613
|
throw error;
|
|
458
614
|
}
|
|
459
615
|
}
|
|
460
|
-
|
|
616
|
+
debug(msg) {
|
|
461
617
|
if (this.config.getDebugMode()) {
|
|
462
618
|
console.warn(msg);
|
|
463
619
|
}
|
|
@@ -467,8 +623,8 @@ function toToolCallContent(toolResult) {
|
|
|
467
623
|
if (toolResult.returnDisplay) {
|
|
468
624
|
if (typeof toolResult.returnDisplay === 'string') {
|
|
469
625
|
return {
|
|
470
|
-
type: '
|
|
471
|
-
|
|
626
|
+
type: 'content',
|
|
627
|
+
content: { type: 'text', text: toolResult.returnDisplay },
|
|
472
628
|
};
|
|
473
629
|
}
|
|
474
630
|
else {
|
|
@@ -484,54 +640,65 @@ function toToolCallContent(toolResult) {
|
|
|
484
640
|
return null;
|
|
485
641
|
}
|
|
486
642
|
}
|
|
487
|
-
|
|
488
|
-
|
|
643
|
+
const basicPermissionOptions = [
|
|
644
|
+
{
|
|
645
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
646
|
+
name: 'Allow',
|
|
647
|
+
kind: 'allow_once',
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
651
|
+
name: 'Reject',
|
|
652
|
+
kind: 'reject_once',
|
|
653
|
+
},
|
|
654
|
+
];
|
|
655
|
+
function toPermissionOptions(confirmation) {
|
|
656
|
+
switch (confirmation.type) {
|
|
489
657
|
case 'edit':
|
|
490
|
-
return
|
|
658
|
+
return [
|
|
659
|
+
{
|
|
660
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
661
|
+
name: 'Allow All Edits',
|
|
662
|
+
kind: 'allow_always',
|
|
663
|
+
},
|
|
664
|
+
...basicPermissionOptions,
|
|
665
|
+
];
|
|
491
666
|
case 'exec':
|
|
492
|
-
return
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
667
|
+
return [
|
|
668
|
+
{
|
|
669
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
670
|
+
name: `Always Allow ${confirmation.rootCommand}`,
|
|
671
|
+
kind: 'allow_always',
|
|
672
|
+
},
|
|
673
|
+
...basicPermissionOptions,
|
|
674
|
+
];
|
|
497
675
|
case 'mcp':
|
|
498
|
-
return
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
676
|
+
return [
|
|
677
|
+
{
|
|
678
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
|
|
679
|
+
name: `Always Allow ${confirmation.serverName}`,
|
|
680
|
+
kind: 'allow_always',
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
|
|
684
|
+
name: `Always Allow ${confirmation.toolName}`,
|
|
685
|
+
kind: 'allow_always',
|
|
686
|
+
},
|
|
687
|
+
...basicPermissionOptions,
|
|
688
|
+
];
|
|
504
689
|
case 'info':
|
|
505
|
-
return
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
const unreachable = confirmationDetails;
|
|
514
|
-
throw new Error(`Unexpected: ${unreachable}`);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
function toToolCallOutcome(outcome) {
|
|
519
|
-
switch (outcome) {
|
|
520
|
-
case 'allow':
|
|
521
|
-
return ToolConfirmationOutcome.ProceedOnce;
|
|
522
|
-
case 'alwaysAllow':
|
|
523
|
-
return ToolConfirmationOutcome.ProceedAlways;
|
|
524
|
-
case 'alwaysAllowMcpServer':
|
|
525
|
-
return ToolConfirmationOutcome.ProceedAlwaysServer;
|
|
526
|
-
case 'alwaysAllowTool':
|
|
527
|
-
return ToolConfirmationOutcome.ProceedAlwaysTool;
|
|
528
|
-
case 'reject':
|
|
529
|
-
case 'cancel':
|
|
530
|
-
return ToolConfirmationOutcome.Cancel;
|
|
690
|
+
return [
|
|
691
|
+
{
|
|
692
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
693
|
+
name: `Always Allow`,
|
|
694
|
+
kind: 'allow_always',
|
|
695
|
+
},
|
|
696
|
+
...basicPermissionOptions,
|
|
697
|
+
];
|
|
531
698
|
default: {
|
|
532
|
-
const unreachable =
|
|
699
|
+
const unreachable = confirmation;
|
|
533
700
|
throw new Error(`Unexpected: ${unreachable}`);
|
|
534
701
|
}
|
|
535
702
|
}
|
|
536
703
|
}
|
|
537
|
-
//# sourceMappingURL=
|
|
704
|
+
//# sourceMappingURL=zedIntegration.js.map
|