@machina.ai/cell-cli-core 1.0.13-rc9 → 1.0.21-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.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/package.json +12 -4
- package/dist/src/code_assist/converter.d.ts +6 -3
- package/dist/src/code_assist/converter.js +4 -2
- package/dist/src/code_assist/converter.js.map +1 -1
- package/dist/src/code_assist/converter.test.js +61 -11
- package/dist/src/code_assist/converter.test.js.map +1 -1
- package/dist/src/code_assist/oauth2.d.ts +1 -0
- package/dist/src/code_assist/oauth2.js +43 -18
- package/dist/src/code_assist/oauth2.js.map +1 -1
- package/dist/src/code_assist/oauth2.test.js +142 -9
- package/dist/src/code_assist/oauth2.test.js.map +1 -1
- package/dist/src/code_assist/server.d.ts +2 -2
- package/dist/src/code_assist/server.js +5 -5
- package/dist/src/code_assist/server.js.map +1 -1
- package/dist/src/code_assist/server.test.js +13 -10
- package/dist/src/code_assist/server.test.js.map +1 -1
- package/dist/src/code_assist/setup.js +49 -18
- package/dist/src/code_assist/setup.js.map +1 -1
- package/dist/src/code_assist/setup.test.js +115 -9
- package/dist/src/code_assist/setup.test.js.map +1 -1
- package/dist/src/config/config.d.ts +71 -13
- package/dist/src/config/config.js +154 -41
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +206 -21
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/config/flashFallback.test.js +19 -47
- package/dist/src/config/flashFallback.test.js.map +1 -1
- package/dist/src/config/models.d.ts +1 -0
- package/dist/src/config/models.js +1 -0
- package/dist/src/config/models.js.map +1 -1
- package/dist/src/core/client.d.ts +15 -16
- package/dist/src/core/client.js +247 -104
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +798 -49
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/contentGenerator.d.ts +2 -2
- package/dist/src/core/contentGenerator.js +23 -21
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/contentGenerator.test.js +30 -126
- package/dist/src/core/contentGenerator.test.js.map +1 -1
- package/dist/src/core/coreToolScheduler.d.ts +23 -10
- package/dist/src/core/coreToolScheduler.js +201 -77
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/coreToolScheduler.test.js +322 -94
- package/dist/src/core/coreToolScheduler.test.js.map +1 -1
- package/dist/src/core/geminiChat.d.ts +8 -6
- package/dist/src/core/geminiChat.js +49 -51
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +2 -2
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/core/geminiRequest.js +2 -37
- package/dist/src/core/geminiRequest.js.map +1 -1
- package/dist/src/core/logger.d.ts +24 -1
- package/dist/src/core/logger.js +128 -4
- package/dist/src/core/logger.js.map +1 -1
- package/dist/src/core/logger.test.js +157 -11
- package/dist/src/core/logger.test.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.d.ts +25 -0
- package/dist/src/core/loggingContentGenerator.js +95 -0
- package/dist/src/core/loggingContentGenerator.js.map +1 -0
- package/dist/src/core/nonInteractiveToolExecutor.js +39 -4
- package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -1
- package/dist/src/core/nonInteractiveToolExecutor.test.js +85 -62
- package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -1
- package/dist/src/core/prompts.js +43 -19
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/core/prompts.test.js +118 -1
- package/dist/src/core/prompts.test.js.map +1 -1
- package/dist/src/core/subagent.d.ts +230 -0
- package/dist/src/core/subagent.js +447 -0
- package/dist/src/core/subagent.js.map +1 -0
- package/dist/src/core/subagent.test.js +515 -0
- package/dist/src/core/subagent.test.js.map +1 -0
- package/dist/src/core/tokenLimits.js +1 -0
- package/dist/src/core/tokenLimits.js.map +1 -1
- package/dist/src/core/turn.d.ts +3 -0
- package/dist/src/core/turn.js +4 -0
- package/dist/src/core/turn.js.map +1 -1
- package/dist/src/core/turn.test.js +4 -0
- package/dist/src/core/turn.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +7 -0
- package/dist/src/generated/git-commit.js +10 -0
- package/dist/src/generated/git-commit.js.map +1 -0
- package/dist/src/ide/constants.d.ts +6 -0
- package/dist/src/ide/constants.js +7 -0
- package/dist/src/ide/constants.js.map +1 -0
- package/dist/src/ide/detect-ide.d.ts +20 -0
- package/dist/src/ide/detect-ide.js +86 -0
- package/dist/src/ide/detect-ide.js.map +1 -0
- package/dist/src/ide/detect-ide.test.js +65 -0
- package/dist/src/ide/detect-ide.test.js.map +1 -0
- package/dist/src/ide/ide-client.d.ts +63 -0
- package/dist/src/ide/ide-client.js +320 -0
- package/dist/src/ide/ide-client.js.map +1 -0
- package/dist/src/ide/ide-client.test.d.ts +6 -0
- package/dist/src/ide/ide-client.test.js +43 -0
- package/dist/src/ide/ide-client.test.js.map +1 -0
- package/dist/src/ide/ide-installer.d.ts +14 -0
- package/dist/src/ide/ide-installer.js +98 -0
- package/dist/src/ide/ide-installer.js.map +1 -0
- package/dist/src/ide/ide-installer.test.d.ts +6 -0
- package/dist/src/ide/ide-installer.test.js +53 -0
- package/dist/src/ide/ide-installer.test.js.map +1 -0
- package/dist/src/ide/ideContext.d.ts +374 -0
- package/dist/src/ide/ideContext.js +147 -0
- package/dist/src/ide/ideContext.js.map +1 -0
- package/dist/src/ide/ideContext.test.d.ts +6 -0
- package/dist/src/ide/ideContext.test.js +265 -0
- package/dist/src/ide/ideContext.test.js.map +1 -0
- package/dist/src/ide/process-utils.d.ts +14 -0
- package/dist/src/ide/process-utils.js +57 -0
- package/dist/src/ide/process-utils.js.map +1 -0
- package/dist/src/index.d.ts +17 -1
- package/dist/src/index.js +20 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/google-auth-provider.d.ts +23 -0
- package/dist/src/mcp/google-auth-provider.js +72 -0
- package/dist/src/mcp/google-auth-provider.js.map +1 -0
- package/dist/src/mcp/google-auth-provider.test.d.ts +6 -0
- package/dist/src/mcp/google-auth-provider.test.js +89 -0
- package/dist/src/mcp/google-auth-provider.test.js.map +1 -0
- package/dist/src/mcp/oauth-provider.d.ts +6 -2
- package/dist/src/mcp/oauth-provider.js +208 -53
- package/dist/src/mcp/oauth-provider.js.map +1 -1
- package/dist/src/mcp/oauth-provider.test.js +222 -70
- package/dist/src/mcp/oauth-provider.test.js.map +1 -1
- package/dist/src/mcp/oauth-token-storage.d.ts +3 -1
- package/dist/src/mcp/oauth-token-storage.js +3 -1
- package/dist/src/mcp/oauth-token-storage.js.map +1 -1
- package/dist/src/mcp/oauth-utils.d.ts +3 -1
- package/dist/src/mcp/oauth-utils.js +52 -14
- package/dist/src/mcp/oauth-utils.js.map +1 -1
- package/dist/src/mcp/oauth-utils.test.js +18 -3
- package/dist/src/mcp/oauth-utils.test.js.map +1 -1
- package/dist/src/mocks/msw.d.ts +6 -0
- package/dist/src/mocks/msw.js +8 -0
- package/dist/src/mocks/msw.js.map +1 -0
- package/dist/src/prompts/mcp-prompts.d.ts +8 -0
- package/dist/src/prompts/mcp-prompts.js +13 -0
- package/dist/src/prompts/mcp-prompts.js.map +1 -0
- package/dist/src/prompts/prompt-registry.d.ts +34 -0
- package/dist/src/prompts/prompt-registry.js +63 -0
- package/dist/src/prompts/prompt-registry.js.map +1 -0
- package/dist/src/services/chatRecordingService.d.ts +150 -0
- package/dist/src/services/chatRecordingService.js +318 -0
- package/dist/src/services/chatRecordingService.js.map +1 -0
- package/dist/src/services/chatRecordingService.test.d.ts +6 -0
- package/dist/src/services/chatRecordingService.test.js +288 -0
- package/dist/src/services/chatRecordingService.test.js.map +1 -0
- package/dist/src/services/fileDiscoveryService.test.js +101 -60
- package/dist/src/services/fileDiscoveryService.test.js.map +1 -1
- package/dist/src/services/fileSystemService.d.ts +31 -0
- package/dist/src/services/fileSystemService.js +18 -0
- package/dist/src/services/fileSystemService.js.map +1 -0
- package/dist/src/services/fileSystemService.test.d.ts +6 -0
- package/dist/src/services/fileSystemService.test.js +41 -0
- package/dist/src/services/fileSystemService.test.js.map +1 -0
- package/dist/src/services/gitService.test.js +67 -86
- package/dist/src/services/gitService.test.js.map +1 -1
- package/dist/src/services/loopDetectionService.d.ts +51 -5
- package/dist/src/services/loopDetectionService.js +152 -45
- package/dist/src/services/loopDetectionService.js.map +1 -1
- package/dist/src/services/loopDetectionService.test.js +286 -89
- package/dist/src/services/loopDetectionService.test.js.map +1 -1
- package/dist/src/services/shellExecutionService.d.ts +70 -0
- package/dist/src/services/shellExecutionService.js +175 -0
- package/dist/src/services/shellExecutionService.js.map +1 -0
- package/dist/src/services/shellExecutionService.test.d.ts +6 -0
- package/dist/src/services/shellExecutionService.test.js +282 -0
- package/dist/src/services/shellExecutionService.test.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +81 -9
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +356 -182
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +17 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +342 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +19 -2
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +51 -9
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
- package/dist/src/telemetry/constants.d.ts +4 -0
- package/dist/src/telemetry/constants.js +4 -0
- package/dist/src/telemetry/constants.js.map +1 -1
- package/dist/src/telemetry/file-exporters.d.ts +28 -0
- package/dist/src/telemetry/file-exporters.js +62 -0
- package/dist/src/telemetry/file-exporters.js.map +1 -0
- package/dist/src/telemetry/index.d.ts +2 -2
- package/dist/src/telemetry/index.js +2 -2
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/integration.test.circular.js +1 -0
- package/dist/src/telemetry/integration.test.circular.js.map +1 -1
- package/dist/src/telemetry/loggers.d.ts +6 -1
- package/dist/src/telemetry/loggers.js +87 -6
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/loggers.test.circular.js +9 -2
- package/dist/src/telemetry/loggers.test.circular.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +51 -11
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/metrics.d.ts +7 -2
- package/dist/src/telemetry/metrics.js +26 -6
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/metrics.test.js +81 -1
- package/dist/src/telemetry/metrics.test.js.map +1 -1
- package/dist/src/telemetry/sdk.d.ts +1 -1
- package/dist/src/telemetry/sdk.js +77 -30
- package/dist/src/telemetry/sdk.js.map +1 -1
- package/dist/src/telemetry/sdk.test.d.ts +6 -0
- package/dist/src/telemetry/sdk.test.js +82 -0
- package/dist/src/telemetry/sdk.test.js.map +1 -0
- package/dist/src/telemetry/telemetry.test.js +2 -2
- package/dist/src/telemetry/telemetry.test.js.map +1 -1
- package/dist/src/telemetry/tool-call-decision.d.ts +13 -0
- package/dist/src/telemetry/tool-call-decision.js +29 -0
- package/dist/src/telemetry/tool-call-decision.js.map +1 -0
- package/dist/src/telemetry/types.d.ts +74 -18
- package/dist/src/telemetry/types.js +110 -32
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.d.ts +8 -1
- package/dist/src/telemetry/uiTelemetry.js +17 -2
- package/dist/src/telemetry/uiTelemetry.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.test.js +60 -10
- package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
- package/dist/src/test-utils/config.d.ts +16 -0
- package/dist/src/test-utils/config.js +32 -0
- package/dist/src/test-utils/config.js.map +1 -0
- package/dist/src/test-utils/mockWorkspaceContext.d.ts +13 -0
- package/dist/src/test-utils/mockWorkspaceContext.js +24 -0
- package/dist/src/test-utils/mockWorkspaceContext.js.map +1 -0
- package/dist/src/test-utils/tools.d.ts +44 -0
- package/dist/src/test-utils/tools.js +105 -0
- package/dist/src/test-utils/tools.js.map +1 -0
- package/dist/src/tools/diffOptions.d.ts +2 -0
- package/dist/src/tools/diffOptions.js +28 -0
- package/dist/src/tools/diffOptions.js.map +1 -1
- package/dist/src/tools/diffOptions.test.d.ts +6 -0
- package/dist/src/tools/diffOptions.test.js +119 -0
- package/dist/src/tools/diffOptions.test.js.map +1 -0
- package/dist/src/tools/edit.d.ts +10 -34
- package/dist/src/tools/edit.js +171 -131
- package/dist/src/tools/edit.js.map +1 -1
- package/dist/src/tools/edit.test.js +220 -43
- package/dist/src/tools/edit.test.js.map +1 -1
- package/dist/src/tools/glob.d.ts +4 -11
- package/dist/src/tools/glob.js +129 -97
- package/dist/src/tools/glob.js.map +1 -1
- package/dist/src/tools/glob.test.js +73 -17
- package/dist/src/tools/glob.test.js.map +1 -1
- package/dist/src/tools/grep.d.ts +5 -37
- package/dist/src/tools/grep.js +175 -100
- package/dist/src/tools/grep.js.map +1 -1
- package/dist/src/tools/grep.test.js +112 -28
- package/dist/src/tools/grep.test.js.map +1 -1
- package/dist/src/tools/ls.d.ts +4 -23
- package/dist/src/tools/ls.js +77 -78
- package/dist/src/tools/ls.js.map +1 -1
- package/dist/src/tools/ls.test.d.ts +6 -0
- package/dist/src/tools/ls.test.js +384 -0
- package/dist/src/tools/ls.test.js.map +1 -0
- package/dist/src/tools/mcp-client-manager.d.ts +38 -0
- package/dist/src/tools/mcp-client-manager.js +74 -0
- package/dist/src/tools/mcp-client-manager.js.map +1 -0
- package/dist/src/tools/mcp-client-manager.test.d.ts +6 -0
- package/dist/src/tools/mcp-client-manager.test.js +39 -0
- package/dist/src/tools/mcp-client-manager.test.js.map +1 -0
- package/dist/src/tools/mcp-client.d.ts +86 -4
- package/dist/src/tools/mcp-client.js +730 -59
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-client.test.js +295 -22
- package/dist/src/tools/mcp-client.test.js.map +1 -1
- package/dist/src/tools/mcp-tool.d.ts +6 -13
- package/dist/src/tools/mcp-tool.js +163 -76
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/mcp-tool.test.js +400 -29
- package/dist/src/tools/mcp-tool.test.js.map +1 -1
- package/dist/src/tools/memoryTool.d.ts +14 -3
- package/dist/src/tools/memoryTool.js +159 -40
- package/dist/src/tools/memoryTool.js.map +1 -1
- package/dist/src/tools/memoryTool.test.js +116 -11
- package/dist/src/tools/memoryTool.test.js.map +1 -1
- package/dist/src/tools/modifiable-tool.d.ts +9 -6
- package/dist/src/tools/modifiable-tool.js +6 -3
- package/dist/src/tools/modifiable-tool.js.map +1 -1
- package/dist/src/tools/modifiable-tool.test.js +63 -74
- package/dist/src/tools/modifiable-tool.test.js.map +1 -1
- package/dist/src/tools/read-file.d.ts +4 -6
- package/dist/src/tools/read-file.js +100 -53
- package/dist/src/tools/read-file.js.map +1 -1
- package/dist/src/tools/read-file.test.js +238 -111
- package/dist/src/tools/read-file.test.js.map +1 -1
- package/dist/src/tools/read-many-files.d.ts +3 -6
- package/dist/src/tools/read-many-files.js +232 -157
- package/dist/src/tools/read-many-files.js.map +1 -1
- package/dist/src/tools/read-many-files.test.js +231 -34
- package/dist/src/tools/read-many-files.test.js.map +1 -1
- package/dist/src/tools/shell.d.ts +6 -28
- package/dist/src/tools/shell.js +249 -366
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/shell.test.js +305 -384
- package/dist/src/tools/shell.test.js.map +1 -1
- package/dist/src/tools/tool-error.d.ts +27 -0
- package/dist/src/tools/tool-error.js +32 -0
- package/dist/src/tools/tool-error.js.map +1 -0
- package/dist/src/tools/tool-registry.d.ts +38 -23
- package/dist/src/tools/tool-registry.js +127 -99
- package/dist/src/tools/tool-registry.js.map +1 -1
- package/dist/src/tools/tool-registry.test.js +37 -212
- package/dist/src/tools/tool-registry.test.js.map +1 -1
- package/dist/src/tools/tools.d.ts +145 -92
- package/dist/src/tools/tools.js +188 -61
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/src/tools/tools.test.d.ts +6 -0
- package/dist/src/tools/tools.test.js +206 -0
- package/dist/src/tools/tools.test.js.map +1 -0
- package/dist/src/tools/web-fetch.d.ts +4 -7
- package/dist/src/tools/web-fetch.js +58 -64
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/web-fetch.test.js +8 -4
- package/dist/src/tools/web-fetch.test.js.map +1 -1
- package/dist/src/tools/web-search.d.ts +4 -5
- package/dist/src/tools/web-search.js +47 -51
- package/dist/src/tools/web-search.js.map +1 -1
- package/dist/src/tools/web-search.test.d.ts +6 -0
- package/dist/src/tools/web-search.test.js +139 -0
- package/dist/src/tools/web-search.test.js.map +1 -0
- package/dist/src/tools/write-file.d.ts +20 -11
- package/dist/src/tools/write-file.js +198 -141
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/tools/write-file.test.js +190 -76
- package/dist/src/tools/write-file.test.js.map +1 -1
- package/dist/src/utils/bfsFileSearch.js +51 -27
- package/dist/src/utils/bfsFileSearch.js.map +1 -1
- package/dist/src/utils/bfsFileSearch.test.js +137 -136
- package/dist/src/utils/bfsFileSearch.test.js.map +1 -1
- package/dist/src/utils/browser.js +4 -3
- package/dist/src/utils/browser.js.map +1 -1
- package/dist/src/utils/editCorrector.js +23 -24
- package/dist/src/utils/editCorrector.js.map +1 -1
- package/dist/src/utils/editor.d.ts +2 -2
- package/dist/src/utils/editor.js +23 -6
- package/dist/src/utils/editor.js.map +1 -1
- package/dist/src/utils/editor.test.js +67 -15
- package/dist/src/utils/editor.test.js.map +1 -1
- package/dist/src/utils/environmentContext.d.ts +21 -0
- package/dist/src/utils/environmentContext.js +90 -0
- package/dist/src/utils/environmentContext.js.map +1 -0
- package/dist/src/utils/environmentContext.test.d.ts +6 -0
- package/dist/src/utils/environmentContext.test.js +140 -0
- package/dist/src/utils/environmentContext.test.js.map +1 -0
- package/dist/src/utils/errorParsing.d.ts +8 -0
- package/dist/src/utils/errorParsing.js +93 -0
- package/dist/src/utils/errorParsing.js.map +1 -0
- package/dist/src/utils/errorParsing.test.d.ts +6 -0
- package/dist/src/utils/errorParsing.test.js +172 -0
- package/dist/src/utils/errorParsing.test.js.map +1 -0
- package/dist/src/utils/errorReporting.d.ts +1 -1
- package/dist/src/utils/errorReporting.js +2 -2
- package/dist/src/utils/errorReporting.js.map +1 -1
- package/dist/src/utils/errorReporting.test.js +44 -38
- package/dist/src/utils/errorReporting.test.js.map +1 -1
- package/dist/src/utils/fileUtils.d.ts +9 -1
- package/dist/src/utils/fileUtils.js +27 -13
- package/dist/src/utils/fileUtils.js.map +1 -1
- package/dist/src/utils/fileUtils.test.js +61 -18
- package/dist/src/utils/fileUtils.test.js.map +1 -1
- package/dist/src/utils/filesearch/crawlCache.d.ts +25 -0
- package/dist/src/utils/filesearch/crawlCache.js +57 -0
- package/dist/src/utils/filesearch/crawlCache.js.map +1 -0
- package/dist/src/utils/filesearch/crawlCache.test.d.ts +6 -0
- package/dist/src/utils/filesearch/crawlCache.test.js +103 -0
- package/dist/src/utils/filesearch/crawlCache.test.js.map +1 -0
- package/dist/src/utils/filesearch/crawler.d.ts +15 -0
- package/dist/src/utils/filesearch/crawler.js +50 -0
- package/dist/src/utils/filesearch/crawler.js.map +1 -0
- package/dist/src/utils/filesearch/crawler.test.d.ts +6 -0
- package/dist/src/utils/filesearch/crawler.test.js +468 -0
- package/dist/src/utils/filesearch/crawler.test.js.map +1 -0
- package/dist/src/utils/filesearch/fileSearch.d.ts +37 -0
- package/dist/src/utils/filesearch/fileSearch.js +186 -0
- package/dist/src/utils/filesearch/fileSearch.js.map +1 -0
- package/dist/src/utils/filesearch/fileSearch.test.d.ts +6 -0
- package/dist/src/utils/filesearch/fileSearch.test.js +552 -0
- package/dist/src/utils/filesearch/fileSearch.test.js.map +1 -0
- package/dist/src/utils/filesearch/ignore.d.ts +42 -0
- package/dist/src/utils/filesearch/ignore.js +106 -0
- package/dist/src/utils/filesearch/ignore.js.map +1 -0
- package/dist/src/utils/filesearch/ignore.test.d.ts +6 -0
- package/dist/src/utils/filesearch/ignore.test.js +144 -0
- package/dist/src/utils/filesearch/ignore.test.js.map +1 -0
- package/dist/src/utils/filesearch/result-cache.d.ts +33 -0
- package/dist/src/utils/filesearch/result-cache.js +59 -0
- package/dist/src/utils/filesearch/result-cache.js.map +1 -0
- package/dist/src/utils/filesearch/result-cache.test.d.ts +6 -0
- package/dist/src/utils/filesearch/result-cache.test.js +46 -0
- package/dist/src/utils/filesearch/result-cache.test.js.map +1 -0
- package/dist/src/utils/flashFallback.integration.test.js +6 -0
- package/dist/src/utils/flashFallback.integration.test.js.map +1 -1
- package/dist/src/utils/formatters.d.ts +6 -0
- package/dist/src/utils/formatters.js +16 -0
- package/dist/src/utils/formatters.js.map +1 -0
- package/dist/src/utils/getFolderStructure.test.js +11 -13
- package/dist/src/utils/getFolderStructure.test.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.js +5 -11
- package/dist/src/utils/gitIgnoreParser.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.test.js +58 -61
- package/dist/src/utils/gitIgnoreParser.test.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.d.ts +1 -1
- package/dist/src/utils/memoryDiscovery.js +76 -83
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.test.js +122 -372
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.d.ts +19 -12
- package/dist/src/utils/memoryImportProcessor.js +240 -85
- package/dist/src/utils/memoryImportProcessor.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.test.js +593 -51
- package/dist/src/utils/memoryImportProcessor.test.js.map +1 -1
- package/dist/src/utils/nextSpeakerChecker.js +4 -25
- package/dist/src/utils/nextSpeakerChecker.js.map +1 -1
- package/dist/src/utils/partUtils.d.ts +14 -0
- package/dist/src/utils/partUtils.js +65 -0
- package/dist/src/utils/partUtils.js.map +1 -0
- package/dist/src/utils/partUtils.test.d.ts +6 -0
- package/dist/src/utils/partUtils.test.js +130 -0
- package/dist/src/utils/partUtils.test.js.map +1 -0
- package/dist/src/utils/paths.d.ts +18 -2
- package/dist/src/utils/paths.js +39 -7
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/paths.test.d.ts +6 -0
- package/dist/src/utils/paths.test.js +225 -0
- package/dist/src/utils/paths.test.js.map +1 -0
- package/dist/src/utils/quotaErrorDetection.d.ts +1 -5
- package/dist/src/utils/quotaErrorDetection.js.map +1 -1
- package/dist/src/utils/retry.d.ts +3 -0
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/utils/retry.test.js.map +1 -1
- package/dist/src/utils/schemaValidator.d.ts +1 -8
- package/dist/src/utils/schemaValidator.js +1 -32
- package/dist/src/utils/schemaValidator.js.map +1 -1
- package/dist/src/utils/secure-browser-launcher.d.ts +23 -0
- package/dist/src/utils/secure-browser-launcher.js +165 -0
- package/dist/src/utils/secure-browser-launcher.js.map +1 -0
- package/dist/src/utils/secure-browser-launcher.test.d.ts +6 -0
- package/dist/src/utils/secure-browser-launcher.test.js +149 -0
- package/dist/src/utils/secure-browser-launcher.test.js.map +1 -0
- package/dist/src/utils/shell-utils.d.ts +117 -0
- package/dist/src/utils/shell-utils.js +376 -0
- package/dist/src/utils/shell-utils.js.map +1 -0
- package/dist/src/utils/shell-utils.test.d.ts +6 -0
- package/dist/src/utils/shell-utils.test.js +328 -0
- package/dist/src/utils/shell-utils.test.js.map +1 -0
- package/dist/src/utils/summarizer.js +3 -32
- package/dist/src/utils/summarizer.js.map +1 -1
- package/dist/src/utils/systemEncoding.js +1 -1
- package/dist/src/utils/systemEncoding.js.map +1 -1
- package/dist/src/utils/systemEncoding.test.js +23 -23
- package/dist/src/utils/systemEncoding.test.js.map +1 -1
- package/dist/src/utils/textUtils.d.ts +13 -0
- package/dist/src/utils/textUtils.js +28 -0
- package/dist/src/utils/textUtils.js.map +1 -0
- package/dist/src/utils/user_account.js +58 -48
- package/dist/src/utils/user_account.js.map +1 -1
- package/dist/src/utils/user_account.test.js +76 -9
- package/dist/src/utils/user_account.test.js.map +1 -1
- package/dist/src/utils/workspaceContext.d.ts +66 -0
- package/dist/src/utils/workspaceContext.js +165 -0
- package/dist/src/utils/workspaceContext.js.map +1 -0
- package/dist/src/utils/workspaceContext.test.d.ts +6 -0
- package/dist/src/utils/workspaceContext.test.js +293 -0
- package/dist/src/utils/workspaceContext.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -3
- package/dist/src/core/geminiRequest.test.js +0 -72
- package/dist/src/core/geminiRequest.test.js.map +0 -1
- package/dist/src/core/modelCheck.d.ts +0 -14
- package/dist/src/core/modelCheck.js +0 -62
- package/dist/src/core/modelCheck.js.map +0 -1
- package/dist/src/services/ideContext.d.ts +0 -178
- package/dist/src/services/ideContext.js +0 -105
- package/dist/src/services/ideContext.js.map +0 -1
- package/dist/src/services/ideContext.test.js +0 -111
- package/dist/src/services/ideContext.test.js.map +0 -1
- /package/dist/src/core/{geminiRequest.test.d.ts → subagent.test.d.ts} +0 -0
- /package/dist/src/{services/ideContext.test.d.ts → ide/detect-ide.test.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@machina.ai/cell-cli-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.21-rc1",
|
|
4
4
|
"description": "Cell CLI Core",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,38 +20,49 @@
|
|
|
20
20
|
"dist"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@google/genai": "1.
|
|
23
|
+
"@google/genai": "1.13.0",
|
|
24
24
|
"@modelcontextprotocol/sdk": "^1.11.0",
|
|
25
25
|
"@opentelemetry/api": "^1.9.0",
|
|
26
26
|
"@opentelemetry/exporter-logs-otlp-grpc": "^0.52.0",
|
|
27
|
+
"@opentelemetry/exporter-logs-otlp-http": "^0.52.0",
|
|
27
28
|
"@opentelemetry/exporter-metrics-otlp-grpc": "^0.52.0",
|
|
29
|
+
"@opentelemetry/exporter-metrics-otlp-http": "^0.52.0",
|
|
28
30
|
"@opentelemetry/exporter-trace-otlp-grpc": "^0.52.0",
|
|
31
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.52.0",
|
|
29
32
|
"@opentelemetry/instrumentation-http": "^0.52.0",
|
|
30
33
|
"@opentelemetry/sdk-node": "^0.52.0",
|
|
31
34
|
"@types/glob": "^8.1.0",
|
|
32
35
|
"@types/html-to-text": "^9.0.4",
|
|
33
36
|
"ajv": "^8.17.1",
|
|
37
|
+
"chardet": "^2.1.0",
|
|
34
38
|
"diff": "^7.0.0",
|
|
35
39
|
"dotenv": "^17.1.0",
|
|
40
|
+
"fdir": "^6.4.6",
|
|
41
|
+
"fzf": "^0.5.2",
|
|
36
42
|
"glob": "^10.4.5",
|
|
37
43
|
"google-auth-library": "^9.11.0",
|
|
38
44
|
"html-to-text": "^9.0.5",
|
|
39
45
|
"https-proxy-agent": "^7.0.6",
|
|
40
46
|
"ignore": "^7.0.0",
|
|
47
|
+
"marked": "^15.0.12",
|
|
41
48
|
"micromatch": "^4.0.8",
|
|
49
|
+
"mnemonist": "^0.40.3",
|
|
42
50
|
"open": "^10.1.2",
|
|
51
|
+
"picomatch": "^4.0.1",
|
|
43
52
|
"shell-quote": "^1.8.3",
|
|
44
53
|
"simple-git": "^3.28.0",
|
|
45
54
|
"strip-ansi": "^7.1.0",
|
|
46
55
|
"undici": "^7.10.0",
|
|
47
56
|
"ws": "^8.18.0",
|
|
48
|
-
"
|
|
57
|
+
"@machina.ai/cell-cli-test-utils": "0.1.21-rc1"
|
|
49
58
|
},
|
|
50
59
|
"devDependencies": {
|
|
60
|
+
"@machina.ai/cell-cli-test-utils": "file:../test-utils",
|
|
51
61
|
"@types/diff": "^7.0.2",
|
|
52
62
|
"@types/dotenv": "^6.1.1",
|
|
53
63
|
"@types/micromatch": "^4.0.8",
|
|
54
64
|
"@types/minimatch": "^5.1.2",
|
|
65
|
+
"@types/picomatch": "^4.0.1",
|
|
55
66
|
"@types/ws": "^8.5.10",
|
|
56
67
|
"typescript": "^5.3.3",
|
|
57
68
|
"vitest": "^3.1.1"
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { describe, it, expect } from 'vitest';
|
|
7
|
-
import { partListUnionToString } from './geminiRequest.js';
|
|
8
|
-
describe('partListUnionToString', () => {
|
|
9
|
-
it('should return the string value if the input is a string', () => {
|
|
10
|
-
const result = partListUnionToString('hello');
|
|
11
|
-
expect(result).toBe('hello');
|
|
12
|
-
});
|
|
13
|
-
it('should return a concatenated string if the input is an array of strings', () => {
|
|
14
|
-
const result = partListUnionToString(['hello', ' ', 'world']);
|
|
15
|
-
expect(result).toBe('hello world');
|
|
16
|
-
});
|
|
17
|
-
it('should handle videoMetadata', () => {
|
|
18
|
-
const part = { videoMetadata: {} };
|
|
19
|
-
const result = partListUnionToString(part);
|
|
20
|
-
expect(result).toBe('[Video Metadata]');
|
|
21
|
-
});
|
|
22
|
-
it('should handle thought', () => {
|
|
23
|
-
const part = { thought: true };
|
|
24
|
-
const result = partListUnionToString(part);
|
|
25
|
-
expect(result).toBe('[Thought: true]');
|
|
26
|
-
});
|
|
27
|
-
it('should handle codeExecutionResult', () => {
|
|
28
|
-
const part = { codeExecutionResult: {} };
|
|
29
|
-
const result = partListUnionToString(part);
|
|
30
|
-
expect(result).toBe('[Code Execution Result]');
|
|
31
|
-
});
|
|
32
|
-
it('should handle executableCode', () => {
|
|
33
|
-
const part = { executableCode: {} };
|
|
34
|
-
const result = partListUnionToString(part);
|
|
35
|
-
expect(result).toBe('[Executable Code]');
|
|
36
|
-
});
|
|
37
|
-
it('should handle fileData', () => {
|
|
38
|
-
const part = {
|
|
39
|
-
fileData: { mimeType: 'text/plain', fileUri: 'file.txt' },
|
|
40
|
-
};
|
|
41
|
-
const result = partListUnionToString(part);
|
|
42
|
-
expect(result).toBe('[File Data]');
|
|
43
|
-
});
|
|
44
|
-
it('should handle functionCall', () => {
|
|
45
|
-
const part = { functionCall: { name: 'myFunction' } };
|
|
46
|
-
const result = partListUnionToString(part);
|
|
47
|
-
expect(result).toBe('[Function Call: myFunction]');
|
|
48
|
-
});
|
|
49
|
-
it('should handle functionResponse', () => {
|
|
50
|
-
const part = {
|
|
51
|
-
functionResponse: { name: 'myFunction', response: {} },
|
|
52
|
-
};
|
|
53
|
-
const result = partListUnionToString(part);
|
|
54
|
-
expect(result).toBe('[Function Response: myFunction]');
|
|
55
|
-
});
|
|
56
|
-
it('should handle inlineData', () => {
|
|
57
|
-
const part = { inlineData: { mimeType: 'image/png', data: '...' } };
|
|
58
|
-
const result = partListUnionToString(part);
|
|
59
|
-
expect(result).toBe('<image/png>');
|
|
60
|
-
});
|
|
61
|
-
it('should handle text', () => {
|
|
62
|
-
const part = { text: 'hello' };
|
|
63
|
-
const result = partListUnionToString(part);
|
|
64
|
-
expect(result).toBe('hello');
|
|
65
|
-
});
|
|
66
|
-
it('should return an empty string for an unknown part type', () => {
|
|
67
|
-
const part = {};
|
|
68
|
-
const result = partListUnionToString(part);
|
|
69
|
-
expect(result).toBe('');
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
//# sourceMappingURL=geminiRequest.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"geminiRequest.test.js","sourceRoot":"","sources":["../../../src/core/geminiRequest.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAA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AI,GAAS,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC1E,MAAM,MAAM,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAC5B,MAAM,IAAI,GAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAChE,MAAM,IAAI,GAAS,EAAE,CAAC;QACtB,MAAM,MAAM,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Checks if the default "pro" model is rate-limited and returns a fallback "flash"
|
|
8
|
-
* model if necessary. This function is designed to be silent.
|
|
9
|
-
* @param apiKey The API key to use for the check.
|
|
10
|
-
* @param currentConfiguredModel The model currently configured in settings.
|
|
11
|
-
* @returns An object indicating the model to use, whether a switch occurred,
|
|
12
|
-
* and the original model if a switch happened.
|
|
13
|
-
*/
|
|
14
|
-
export declare function getEffectiveModel(apiKey: string, currentConfiguredModel: string, proxy?: string): Promise<string>;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { setGlobalDispatcher, ProxyAgent } from 'undici';
|
|
7
|
-
import { DEFAULT_GEMINI_MODEL, DEFAULT_GEMINI_FLASH_MODEL, } from '../config/models.js';
|
|
8
|
-
/**
|
|
9
|
-
* Checks if the default "pro" model is rate-limited and returns a fallback "flash"
|
|
10
|
-
* model if necessary. This function is designed to be silent.
|
|
11
|
-
* @param apiKey The API key to use for the check.
|
|
12
|
-
* @param currentConfiguredModel The model currently configured in settings.
|
|
13
|
-
* @returns An object indicating the model to use, whether a switch occurred,
|
|
14
|
-
* and the original model if a switch happened.
|
|
15
|
-
*/
|
|
16
|
-
export async function getEffectiveModel(apiKey, currentConfiguredModel, proxy) {
|
|
17
|
-
if (currentConfiguredModel !== DEFAULT_GEMINI_MODEL) {
|
|
18
|
-
// Only check if the user is trying to use the specific pro model we want to fallback from.
|
|
19
|
-
return currentConfiguredModel;
|
|
20
|
-
}
|
|
21
|
-
const modelToTest = DEFAULT_GEMINI_MODEL;
|
|
22
|
-
const fallbackModel = DEFAULT_GEMINI_FLASH_MODEL;
|
|
23
|
-
const endpoint = `https://generativelanguage.googleapis.com/v1beta/models/${modelToTest}:generateContent`;
|
|
24
|
-
const body = JSON.stringify({
|
|
25
|
-
contents: [{ parts: [{ text: 'test' }] }],
|
|
26
|
-
generationConfig: {
|
|
27
|
-
maxOutputTokens: 1,
|
|
28
|
-
temperature: 0,
|
|
29
|
-
topK: 1,
|
|
30
|
-
thinkingConfig: { thinkingBudget: 128, includeThoughts: false },
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
const controller = new AbortController();
|
|
34
|
-
const timeoutId = setTimeout(() => controller.abort(), 2000); // 500ms timeout for the request
|
|
35
|
-
try {
|
|
36
|
-
if (proxy) {
|
|
37
|
-
setGlobalDispatcher(new ProxyAgent(proxy));
|
|
38
|
-
}
|
|
39
|
-
const response = await fetch(endpoint, {
|
|
40
|
-
method: 'POST',
|
|
41
|
-
headers: {
|
|
42
|
-
'Content-Type': 'application/json',
|
|
43
|
-
'x-goog-api-key': apiKey,
|
|
44
|
-
},
|
|
45
|
-
body,
|
|
46
|
-
signal: controller.signal,
|
|
47
|
-
});
|
|
48
|
-
clearTimeout(timeoutId);
|
|
49
|
-
if (response.status === 429) {
|
|
50
|
-
console.log(`[INFO] Your configured model (${modelToTest}) was temporarily unavailable. Switched to ${fallbackModel} for this session.`);
|
|
51
|
-
return fallbackModel;
|
|
52
|
-
}
|
|
53
|
-
// For any other case (success, other error codes), we stick to the original model.
|
|
54
|
-
return currentConfiguredModel;
|
|
55
|
-
}
|
|
56
|
-
catch (_error) {
|
|
57
|
-
clearTimeout(timeoutId);
|
|
58
|
-
// On timeout or any other fetch error, stick to the original model.
|
|
59
|
-
return currentConfiguredModel;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=modelCheck.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modelCheck.js","sourceRoot":"","sources":["../../../src/core/modelCheck.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EACL,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAc,EACd,sBAA8B,EAC9B,KAAc;IAEd,IAAI,sBAAsB,KAAK,oBAAoB,EAAE,CAAC;QACpD,2FAA2F;QAC3F,OAAO,sBAAsB,CAAC;IAChC,CAAC;IAED,MAAM,WAAW,GAAG,oBAAoB,CAAC;IACzC,MAAM,aAAa,GAAG,0BAA0B,CAAC;IACjD,MAAM,QAAQ,GAAG,2DAA2D,WAAW,kBAA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ACH,CAAC"}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { z } from 'zod';
|
|
7
|
-
/**
|
|
8
|
-
* The reserved server name for the IDE's MCP server.
|
|
9
|
-
*/
|
|
10
|
-
export declare const IDE_SERVER_NAME = "_ide_server";
|
|
11
|
-
/**
|
|
12
|
-
* Zod schema for validating a cursor position.
|
|
13
|
-
*/
|
|
14
|
-
export declare const CursorSchema: z.ZodObject<{
|
|
15
|
-
line: z.ZodNumber;
|
|
16
|
-
character: z.ZodNumber;
|
|
17
|
-
}, "strip", z.ZodTypeAny, {
|
|
18
|
-
line: number;
|
|
19
|
-
character: number;
|
|
20
|
-
}, {
|
|
21
|
-
line: number;
|
|
22
|
-
character: number;
|
|
23
|
-
}>;
|
|
24
|
-
export type Cursor = z.infer<typeof CursorSchema>;
|
|
25
|
-
/**
|
|
26
|
-
* Zod schema for validating an active file context from the IDE.
|
|
27
|
-
*/
|
|
28
|
-
export declare const OpenFilesSchema: z.ZodObject<{
|
|
29
|
-
activeFile: z.ZodString;
|
|
30
|
-
selectedText: z.ZodOptional<z.ZodString>;
|
|
31
|
-
cursor: z.ZodOptional<z.ZodObject<{
|
|
32
|
-
line: z.ZodNumber;
|
|
33
|
-
character: z.ZodNumber;
|
|
34
|
-
}, "strip", z.ZodTypeAny, {
|
|
35
|
-
line: number;
|
|
36
|
-
character: number;
|
|
37
|
-
}, {
|
|
38
|
-
line: number;
|
|
39
|
-
character: number;
|
|
40
|
-
}>>;
|
|
41
|
-
recentOpenFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
42
|
-
filePath: z.ZodString;
|
|
43
|
-
timestamp: z.ZodNumber;
|
|
44
|
-
}, "strip", z.ZodTypeAny, {
|
|
45
|
-
filePath: string;
|
|
46
|
-
timestamp: number;
|
|
47
|
-
}, {
|
|
48
|
-
filePath: string;
|
|
49
|
-
timestamp: number;
|
|
50
|
-
}>, "many">>;
|
|
51
|
-
}, "strip", z.ZodTypeAny, {
|
|
52
|
-
activeFile: string;
|
|
53
|
-
selectedText?: string | undefined;
|
|
54
|
-
cursor?: {
|
|
55
|
-
line: number;
|
|
56
|
-
character: number;
|
|
57
|
-
} | undefined;
|
|
58
|
-
recentOpenFiles?: {
|
|
59
|
-
filePath: string;
|
|
60
|
-
timestamp: number;
|
|
61
|
-
}[] | undefined;
|
|
62
|
-
}, {
|
|
63
|
-
activeFile: string;
|
|
64
|
-
selectedText?: string | undefined;
|
|
65
|
-
cursor?: {
|
|
66
|
-
line: number;
|
|
67
|
-
character: number;
|
|
68
|
-
} | undefined;
|
|
69
|
-
recentOpenFiles?: {
|
|
70
|
-
filePath: string;
|
|
71
|
-
timestamp: number;
|
|
72
|
-
}[] | undefined;
|
|
73
|
-
}>;
|
|
74
|
-
export type OpenFiles = z.infer<typeof OpenFilesSchema>;
|
|
75
|
-
/**
|
|
76
|
-
* Zod schema for validating the 'ide/openFilesChanged' notification from the IDE.
|
|
77
|
-
*/
|
|
78
|
-
export declare const OpenFilesNotificationSchema: z.ZodObject<{
|
|
79
|
-
method: z.ZodLiteral<"ide/openFilesChanged">;
|
|
80
|
-
params: z.ZodObject<{
|
|
81
|
-
activeFile: z.ZodString;
|
|
82
|
-
selectedText: z.ZodOptional<z.ZodString>;
|
|
83
|
-
cursor: z.ZodOptional<z.ZodObject<{
|
|
84
|
-
line: z.ZodNumber;
|
|
85
|
-
character: z.ZodNumber;
|
|
86
|
-
}, "strip", z.ZodTypeAny, {
|
|
87
|
-
line: number;
|
|
88
|
-
character: number;
|
|
89
|
-
}, {
|
|
90
|
-
line: number;
|
|
91
|
-
character: number;
|
|
92
|
-
}>>;
|
|
93
|
-
recentOpenFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
94
|
-
filePath: z.ZodString;
|
|
95
|
-
timestamp: z.ZodNumber;
|
|
96
|
-
}, "strip", z.ZodTypeAny, {
|
|
97
|
-
filePath: string;
|
|
98
|
-
timestamp: number;
|
|
99
|
-
}, {
|
|
100
|
-
filePath: string;
|
|
101
|
-
timestamp: number;
|
|
102
|
-
}>, "many">>;
|
|
103
|
-
}, "strip", z.ZodTypeAny, {
|
|
104
|
-
activeFile: string;
|
|
105
|
-
selectedText?: string | undefined;
|
|
106
|
-
cursor?: {
|
|
107
|
-
line: number;
|
|
108
|
-
character: number;
|
|
109
|
-
} | undefined;
|
|
110
|
-
recentOpenFiles?: {
|
|
111
|
-
filePath: string;
|
|
112
|
-
timestamp: number;
|
|
113
|
-
}[] | undefined;
|
|
114
|
-
}, {
|
|
115
|
-
activeFile: string;
|
|
116
|
-
selectedText?: string | undefined;
|
|
117
|
-
cursor?: {
|
|
118
|
-
line: number;
|
|
119
|
-
character: number;
|
|
120
|
-
} | undefined;
|
|
121
|
-
recentOpenFiles?: {
|
|
122
|
-
filePath: string;
|
|
123
|
-
timestamp: number;
|
|
124
|
-
}[] | undefined;
|
|
125
|
-
}>;
|
|
126
|
-
}, "strip", z.ZodTypeAny, {
|
|
127
|
-
method: "ide/openFilesChanged";
|
|
128
|
-
params: {
|
|
129
|
-
activeFile: string;
|
|
130
|
-
selectedText?: string | undefined;
|
|
131
|
-
cursor?: {
|
|
132
|
-
line: number;
|
|
133
|
-
character: number;
|
|
134
|
-
} | undefined;
|
|
135
|
-
recentOpenFiles?: {
|
|
136
|
-
filePath: string;
|
|
137
|
-
timestamp: number;
|
|
138
|
-
}[] | undefined;
|
|
139
|
-
};
|
|
140
|
-
}, {
|
|
141
|
-
method: "ide/openFilesChanged";
|
|
142
|
-
params: {
|
|
143
|
-
activeFile: string;
|
|
144
|
-
selectedText?: string | undefined;
|
|
145
|
-
cursor?: {
|
|
146
|
-
line: number;
|
|
147
|
-
character: number;
|
|
148
|
-
} | undefined;
|
|
149
|
-
recentOpenFiles?: {
|
|
150
|
-
filePath: string;
|
|
151
|
-
timestamp: number;
|
|
152
|
-
}[] | undefined;
|
|
153
|
-
};
|
|
154
|
-
}>;
|
|
155
|
-
type OpenFilesSubscriber = (openFiles: OpenFiles | undefined) => void;
|
|
156
|
-
/**
|
|
157
|
-
* Creates a new store for managing the IDE's active file context.
|
|
158
|
-
* This factory function encapsulates the state and logic, allowing for the creation
|
|
159
|
-
* of isolated instances, which is particularly useful for testing.
|
|
160
|
-
*
|
|
161
|
-
* @returns An object with methods to interact with the active file context.
|
|
162
|
-
*/
|
|
163
|
-
export declare function createIdeContextStore(): {
|
|
164
|
-
setOpenFilesContext: (newOpenFiles: OpenFiles) => void;
|
|
165
|
-
getOpenFilesContext: () => OpenFiles | undefined;
|
|
166
|
-
subscribeToOpenFiles: (subscriber: OpenFilesSubscriber) => () => void;
|
|
167
|
-
clearOpenFilesContext: () => void;
|
|
168
|
-
};
|
|
169
|
-
/**
|
|
170
|
-
* The default, shared instance of the IDE context store for the application.
|
|
171
|
-
*/
|
|
172
|
-
export declare const ideContext: {
|
|
173
|
-
setOpenFilesContext: (newOpenFiles: OpenFiles) => void;
|
|
174
|
-
getOpenFilesContext: () => OpenFiles | undefined;
|
|
175
|
-
subscribeToOpenFiles: (subscriber: OpenFilesSubscriber) => () => void;
|
|
176
|
-
clearOpenFilesContext: () => void;
|
|
177
|
-
};
|
|
178
|
-
export {};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { z } from 'zod';
|
|
7
|
-
/**
|
|
8
|
-
* The reserved server name for the IDE's MCP server.
|
|
9
|
-
*/
|
|
10
|
-
export const IDE_SERVER_NAME = '_ide_server';
|
|
11
|
-
/**
|
|
12
|
-
* Zod schema for validating a cursor position.
|
|
13
|
-
*/
|
|
14
|
-
export const CursorSchema = z.object({
|
|
15
|
-
line: z.number(),
|
|
16
|
-
character: z.number(),
|
|
17
|
-
});
|
|
18
|
-
/**
|
|
19
|
-
* Zod schema for validating an active file context from the IDE.
|
|
20
|
-
*/
|
|
21
|
-
export const OpenFilesSchema = z.object({
|
|
22
|
-
activeFile: z.string(),
|
|
23
|
-
selectedText: z.string().optional(),
|
|
24
|
-
cursor: CursorSchema.optional(),
|
|
25
|
-
recentOpenFiles: z
|
|
26
|
-
.array(z.object({
|
|
27
|
-
filePath: z.string(),
|
|
28
|
-
timestamp: z.number(),
|
|
29
|
-
}))
|
|
30
|
-
.optional(),
|
|
31
|
-
});
|
|
32
|
-
/**
|
|
33
|
-
* Zod schema for validating the 'ide/openFilesChanged' notification from the IDE.
|
|
34
|
-
*/
|
|
35
|
-
export const OpenFilesNotificationSchema = z.object({
|
|
36
|
-
method: z.literal('ide/openFilesChanged'),
|
|
37
|
-
params: OpenFilesSchema,
|
|
38
|
-
});
|
|
39
|
-
/**
|
|
40
|
-
* Creates a new store for managing the IDE's active file context.
|
|
41
|
-
* This factory function encapsulates the state and logic, allowing for the creation
|
|
42
|
-
* of isolated instances, which is particularly useful for testing.
|
|
43
|
-
*
|
|
44
|
-
* @returns An object with methods to interact with the active file context.
|
|
45
|
-
*/
|
|
46
|
-
export function createIdeContextStore() {
|
|
47
|
-
let openFilesContext = undefined;
|
|
48
|
-
const subscribers = new Set();
|
|
49
|
-
/**
|
|
50
|
-
* Notifies all registered subscribers about the current active file context.
|
|
51
|
-
*/
|
|
52
|
-
function notifySubscribers() {
|
|
53
|
-
for (const subscriber of subscribers) {
|
|
54
|
-
subscriber(openFilesContext);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Sets the active file context and notifies all registered subscribers of the change.
|
|
59
|
-
* @param newOpenFiles The new active file context from the IDE.
|
|
60
|
-
*/
|
|
61
|
-
function setOpenFilesContext(newOpenFiles) {
|
|
62
|
-
openFilesContext = newOpenFiles;
|
|
63
|
-
notifySubscribers();
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Clears the active file context and notifies all registered subscribers of the change.
|
|
67
|
-
*/
|
|
68
|
-
function clearOpenFilesContext() {
|
|
69
|
-
openFilesContext = undefined;
|
|
70
|
-
notifySubscribers();
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Retrieves the current active file context.
|
|
74
|
-
* @returns The `OpenFiles` object if a file is active; otherwise, `undefined`.
|
|
75
|
-
*/
|
|
76
|
-
function getOpenFilesContext() {
|
|
77
|
-
return openFilesContext;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Subscribes to changes in the active file context.
|
|
81
|
-
*
|
|
82
|
-
* When the active file context changes, the provided `subscriber` function will be called.
|
|
83
|
-
* Note: The subscriber is not called with the current value upon subscription.
|
|
84
|
-
*
|
|
85
|
-
* @param subscriber The function to be called when the active file context changes.
|
|
86
|
-
* @returns A function that, when called, will unsubscribe the provided subscriber.
|
|
87
|
-
*/
|
|
88
|
-
function subscribeToOpenFiles(subscriber) {
|
|
89
|
-
subscribers.add(subscriber);
|
|
90
|
-
return () => {
|
|
91
|
-
subscribers.delete(subscriber);
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
setOpenFilesContext,
|
|
96
|
-
getOpenFilesContext,
|
|
97
|
-
subscribeToOpenFiles,
|
|
98
|
-
clearOpenFilesContext,
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* The default, shared instance of the IDE context store for the application.
|
|
103
|
-
*/
|
|
104
|
-
export const ideContext = createIdeContextStore();
|
|
105
|
-
//# sourceMappingURL=ideContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ideContext.js","sourceRoot":"","sources":["../../../src/services/ideContext.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAC;AA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,iBAAiB,EAAE,CAAC;IACtB,CAAC;IAED;;;OAGG;IACH,SAAS,mBAAmB;QAC1B,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED;;;;;;;;OAQG;IACH,SAAS,oBAAoB,CAAC,UAA+B;QAC3D,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC5B,OAAO,GAAG,EAAE;YACV,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACjC,CAAC,CAAC;IACJ,CAAC;IAED,OAAO;QACL,mBAAmB;QACnB,mBAAmB;QACnB,oBAAoB;QACpB,qBAAqB;KACtB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,qBAAqB,EAAE,CAAC"}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
7
|
-
import { createIdeContextStore } from './ideContext.js';
|
|
8
|
-
describe('ideContext - Active File', () => {
|
|
9
|
-
let ideContext;
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
// Create a fresh, isolated instance for each test
|
|
12
|
-
ideContext = createIdeContextStore();
|
|
13
|
-
});
|
|
14
|
-
it('should return undefined initially for active file context', () => {
|
|
15
|
-
expect(ideContext.getOpenFilesContext()).toBeUndefined();
|
|
16
|
-
});
|
|
17
|
-
it('should set and retrieve the active file context', () => {
|
|
18
|
-
const testFile = {
|
|
19
|
-
activeFile: '/path/to/test/file.ts',
|
|
20
|
-
selectedText: '1234',
|
|
21
|
-
};
|
|
22
|
-
ideContext.setOpenFilesContext(testFile);
|
|
23
|
-
const activeFile = ideContext.getOpenFilesContext();
|
|
24
|
-
expect(activeFile).toEqual(testFile);
|
|
25
|
-
});
|
|
26
|
-
it('should update the active file context when called multiple times', () => {
|
|
27
|
-
const firstFile = {
|
|
28
|
-
activeFile: '/path/to/first.js',
|
|
29
|
-
selectedText: '1234',
|
|
30
|
-
};
|
|
31
|
-
ideContext.setOpenFilesContext(firstFile);
|
|
32
|
-
const secondFile = {
|
|
33
|
-
activeFile: '/path/to/second.py',
|
|
34
|
-
cursor: { line: 20, character: 30 },
|
|
35
|
-
};
|
|
36
|
-
ideContext.setOpenFilesContext(secondFile);
|
|
37
|
-
const activeFile = ideContext.getOpenFilesContext();
|
|
38
|
-
expect(activeFile).toEqual(secondFile);
|
|
39
|
-
});
|
|
40
|
-
it('should handle empty string for file path', () => {
|
|
41
|
-
const testFile = {
|
|
42
|
-
activeFile: '',
|
|
43
|
-
selectedText: '1234',
|
|
44
|
-
};
|
|
45
|
-
ideContext.setOpenFilesContext(testFile);
|
|
46
|
-
expect(ideContext.getOpenFilesContext()).toEqual(testFile);
|
|
47
|
-
});
|
|
48
|
-
it('should notify subscribers when active file context changes', () => {
|
|
49
|
-
const subscriber1 = vi.fn();
|
|
50
|
-
const subscriber2 = vi.fn();
|
|
51
|
-
ideContext.subscribeToOpenFiles(subscriber1);
|
|
52
|
-
ideContext.subscribeToOpenFiles(subscriber2);
|
|
53
|
-
const testFile = {
|
|
54
|
-
activeFile: '/path/to/subscribed.ts',
|
|
55
|
-
cursor: { line: 15, character: 25 },
|
|
56
|
-
};
|
|
57
|
-
ideContext.setOpenFilesContext(testFile);
|
|
58
|
-
expect(subscriber1).toHaveBeenCalledTimes(1);
|
|
59
|
-
expect(subscriber1).toHaveBeenCalledWith(testFile);
|
|
60
|
-
expect(subscriber2).toHaveBeenCalledTimes(1);
|
|
61
|
-
expect(subscriber2).toHaveBeenCalledWith(testFile);
|
|
62
|
-
// Test with another update
|
|
63
|
-
const newFile = {
|
|
64
|
-
activeFile: '/path/to/new.js',
|
|
65
|
-
selectedText: '1234',
|
|
66
|
-
};
|
|
67
|
-
ideContext.setOpenFilesContext(newFile);
|
|
68
|
-
expect(subscriber1).toHaveBeenCalledTimes(2);
|
|
69
|
-
expect(subscriber1).toHaveBeenCalledWith(newFile);
|
|
70
|
-
expect(subscriber2).toHaveBeenCalledTimes(2);
|
|
71
|
-
expect(subscriber2).toHaveBeenCalledWith(newFile);
|
|
72
|
-
});
|
|
73
|
-
it('should stop notifying a subscriber after unsubscribe', () => {
|
|
74
|
-
const subscriber1 = vi.fn();
|
|
75
|
-
const subscriber2 = vi.fn();
|
|
76
|
-
const unsubscribe1 = ideContext.subscribeToOpenFiles(subscriber1);
|
|
77
|
-
ideContext.subscribeToOpenFiles(subscriber2);
|
|
78
|
-
ideContext.setOpenFilesContext({
|
|
79
|
-
activeFile: '/path/to/file1.txt',
|
|
80
|
-
selectedText: '1234',
|
|
81
|
-
});
|
|
82
|
-
expect(subscriber1).toHaveBeenCalledTimes(1);
|
|
83
|
-
expect(subscriber2).toHaveBeenCalledTimes(1);
|
|
84
|
-
unsubscribe1();
|
|
85
|
-
ideContext.setOpenFilesContext({
|
|
86
|
-
activeFile: '/path/to/file2.txt',
|
|
87
|
-
selectedText: '1234',
|
|
88
|
-
});
|
|
89
|
-
expect(subscriber1).toHaveBeenCalledTimes(1); // Should not be called again
|
|
90
|
-
expect(subscriber2).toHaveBeenCalledTimes(2);
|
|
91
|
-
});
|
|
92
|
-
it('should allow the cursor to be optional', () => {
|
|
93
|
-
const testFile = {
|
|
94
|
-
activeFile: '/path/to/test/file.ts',
|
|
95
|
-
};
|
|
96
|
-
ideContext.setOpenFilesContext(testFile);
|
|
97
|
-
const activeFile = ideContext.getOpenFilesContext();
|
|
98
|
-
expect(activeFile).toEqual(testFile);
|
|
99
|
-
});
|
|
100
|
-
it('should clear the active file context', () => {
|
|
101
|
-
const testFile = {
|
|
102
|
-
activeFile: '/path/to/test/file.ts',
|
|
103
|
-
selectedText: '1234',
|
|
104
|
-
};
|
|
105
|
-
ideContext.setOpenFilesContext(testFile);
|
|
106
|
-
expect(ideContext.getOpenFilesContext()).toEqual(testFile);
|
|
107
|
-
ideContext.clearOpenFilesContext();
|
|
108
|
-
expect(ideContext.getOpenFilesContext()).toBeUndefined();
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
//# sourceMappingURL=ideContext.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ideContext.test.js","sourceRoot":"","sources":["../../../src/services/ideContext.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,IAAI,UAAoD,CAAC;IAEzD,UAAU,CAAC,GAAG,EAAE;QACd,kDAAkD;QAClD,UAAU,GAAG,qBAAqB,EAAE,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,MAAM,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,MAAM,QAAQ,GAAG;YACf,UAAU,EAAE,uBAAuB;YACnC,YAAY,EAAE,MAAM;SACrB,CAAC;QAEF,UAAU,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QAEzC,MAAM,UAAU,GAAG,UAAU,CAAC,mBAAmB,EAAE,CAAC;QACpD,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kEAAkE,EAAE,GAAG,EAAE;QAC1E,MAAM,SAAS,GAAG;YAChB,UAAU,EAAE,mBAAmB;YAC/B,YAAY,EAAE,MAAM;SACrB,CAAC;QACF,UAAU,CAAC,mBAAmB,CAAC,SAAS,CAAC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