@gitkraken/core-gitlens 0.5.110 → 0.5.111
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/CHANGELOG.md +16 -1
- package/dist/git/cache.d.ts +111 -6
- package/dist/git/cache.d.ts.map +1 -1
- package/dist/git/cache.js +312 -43
- package/dist/git/cache.js.map +1 -1
- package/dist/git/context.d.ts +11 -0
- package/dist/git/context.d.ts.map +1 -1
- package/dist/git/context.js.map +1 -1
- package/dist/git/models/fileStatus.d.ts +1 -0
- package/dist/git/models/fileStatus.d.ts.map +1 -1
- package/dist/git/models/fileStatus.js +1 -0
- package/dist/git/models/fileStatus.js.map +1 -1
- package/dist/git/models/issue.d.ts +4 -0
- package/dist/git/models/issue.d.ts.map +1 -1
- package/dist/git/models/mergeConflicts.d.ts +2 -0
- package/dist/git/models/mergeConflicts.d.ts.map +1 -1
- package/dist/git/models/pullRequest.d.ts +38 -2
- package/dist/git/models/pullRequest.d.ts.map +1 -1
- package/dist/git/models/pullRequest.js +12 -1
- package/dist/git/models/pullRequest.js.map +1 -1
- package/dist/git/models/repository.d.ts +32 -5
- package/dist/git/models/repository.d.ts.map +1 -1
- package/dist/git/models/repository.js +58 -12
- package/dist/git/models/repository.js.map +1 -1
- package/dist/git/models/statusFile.d.ts.map +1 -1
- package/dist/git/models/statusFile.js +3 -0
- package/dist/git/models/statusFile.js.map +1 -1
- package/dist/git/providers/branches.d.ts +2 -0
- package/dist/git/providers/branches.d.ts.map +1 -1
- package/dist/git/providers/commits.d.ts +8 -0
- package/dist/git/providers/commits.d.ts.map +1 -1
- package/dist/git/providers/config.d.ts +19 -1
- package/dist/git/providers/config.d.ts.map +1 -1
- package/dist/git/providers/operations.d.ts +1 -0
- package/dist/git/providers/operations.d.ts.map +1 -1
- package/dist/git/providers/pausedOperations.d.ts +2 -0
- package/dist/git/providers/pausedOperations.d.ts.map +1 -1
- package/dist/git/providers/status.d.ts +1 -0
- package/dist/git/providers/status.d.ts.map +1 -1
- package/dist/git/utils/config.utils.d.ts +3 -0
- package/dist/git/utils/config.utils.d.ts.map +1 -0
- package/dist/git/utils/config.utils.js +8 -0
- package/dist/git/utils/config.utils.js.map +1 -0
- package/dist/git/utils/issue.utils.d.ts.map +1 -1
- package/dist/git/utils/issue.utils.js +2 -0
- package/dist/git/utils/issue.utils.js.map +1 -1
- package/dist/git/utils/pausedOperationStatus.utils.d.ts +14 -0
- package/dist/git/utils/pausedOperationStatus.utils.d.ts.map +1 -1
- package/dist/git/utils/pausedOperationStatus.utils.js +23 -0
- package/dist/git/utils/pausedOperationStatus.utils.js.map +1 -1
- package/dist/git/utils/pullRequest.utils.d.ts +14 -1
- package/dist/git/utils/pullRequest.utils.d.ts.map +1 -1
- package/dist/git/utils/pullRequest.utils.js +31 -0
- package/dist/git/utils/pullRequest.utils.js.map +1 -1
- package/dist/git/watching/changeEvent.d.ts +6 -1
- package/dist/git/watching/changeEvent.d.ts.map +1 -1
- package/dist/git/watching/classifyChange.d.ts.map +1 -1
- package/dist/git/watching/classifyChange.js +14 -1
- package/dist/git/watching/classifyChange.js.map +1 -1
- package/dist/git/watching/watchService.d.ts.map +1 -1
- package/dist/git/watching/watchService.js +18 -3
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git/watching/watchSession.d.ts +8 -1
- package/dist/git/watching/watchSession.d.ts.map +1 -1
- package/dist/git/watching/watchSession.js +38 -6
- package/dist/git/watching/watchSession.js.map +1 -1
- package/dist/git/watching/watcherPatterns.d.ts +2 -2
- package/dist/git/watching/watcherPatterns.d.ts.map +1 -1
- package/dist/git/watching/watcherPatterns.js +1 -1
- package/dist/git/watching/watcherPatterns.js.map +1 -1
- package/dist/git-cli/exec/git.d.ts +1 -1
- package/dist/git-cli/exec/git.d.ts.map +1 -1
- package/dist/git-cli/exec/git.js +13 -3
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +19 -0
- package/dist/git-cli/providers/branches.d.ts.map +1 -1
- package/dist/git-cli/providers/branches.js +282 -78
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/commits.d.ts +4 -0
- package/dist/git-cli/providers/commits.d.ts.map +1 -1
- package/dist/git-cli/providers/commits.js +84 -11
- package/dist/git-cli/providers/commits.js.map +1 -1
- package/dist/git-cli/providers/config.d.ts +42 -0
- package/dist/git-cli/providers/config.d.ts.map +1 -1
- package/dist/git-cli/providers/config.js +186 -5
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/contributors.d.ts.map +1 -1
- package/dist/git-cli/providers/contributors.js +1 -1
- package/dist/git-cli/providers/contributors.js.map +1 -1
- package/dist/git-cli/providers/graph.d.ts +2 -2
- package/dist/git-cli/providers/graph.d.ts.map +1 -1
- package/dist/git-cli/providers/graph.js +27 -9
- package/dist/git-cli/providers/graph.js.map +1 -1
- package/dist/git-cli/providers/operations.d.ts.map +1 -1
- package/dist/git-cli/providers/operations.js +40 -12
- package/dist/git-cli/providers/operations.js.map +1 -1
- package/dist/git-cli/providers/pausedOperations.d.ts +5 -0
- package/dist/git-cli/providers/pausedOperations.d.ts.map +1 -1
- package/dist/git-cli/providers/pausedOperations.js +87 -16
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/refs.d.ts +5 -3
- package/dist/git-cli/providers/refs.d.ts.map +1 -1
- package/dist/git-cli/providers/refs.js +33 -4
- package/dist/git-cli/providers/refs.js.map +1 -1
- package/dist/git-cli/providers/status.d.ts +1 -0
- package/dist/git-cli/providers/status.d.ts.map +1 -1
- package/dist/git-cli/providers/status.js +18 -3
- package/dist/git-cli/providers/status.js.map +1 -1
- package/dist/git-cli/providers/worktrees.d.ts.map +1 -1
- package/dist/git-cli/providers/worktrees.js +4 -0
- package/dist/git-cli/providers/worktrees.js.map +1 -1
- package/dist/git-cli/service.d.ts.map +1 -1
- package/dist/git-cli/service.js.map +1 -1
- package/dist/plus/agents/providers/claudeCodeProvider.d.ts +39 -1
- package/dist/plus/agents/providers/claudeCodeProvider.d.ts.map +1 -1
- package/dist/plus/agents/providers/claudeCodeProvider.js +978 -71
- package/dist/plus/agents/providers/claudeCodeProvider.js.map +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.d.ts +24 -2
- package/dist/plus/agents/providers/claudeCodeTranscript.d.ts.map +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.js +84 -9
- package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
- package/dist/plus/agents/types.d.ts +37 -2
- package/dist/plus/agents/types.d.ts.map +1 -1
- package/dist/plus/agents/types.js +2 -0
- package/dist/plus/agents/types.js.map +1 -1
- package/dist/plus/ai/errors.d.ts +10 -0
- package/dist/plus/ai/errors.d.ts.map +1 -1
- package/dist/plus/ai/errors.js +29 -0
- package/dist/plus/ai/errors.js.map +1 -1
- package/dist/plus/ai/models/model.d.ts +4 -0
- package/dist/plus/ai/models/model.d.ts.map +1 -1
- package/dist/plus/ai/models/model.js +51 -6
- package/dist/plus/ai/models/model.js.map +1 -1
- package/dist/plus/ai/models/promptTemplates.d.ts +1 -1
- package/dist/plus/ai/models/promptTemplates.d.ts.map +1 -1
- package/dist/plus/ai/models/provider.d.ts +60 -2
- package/dist/plus/ai/models/provider.d.ts.map +1 -1
- package/dist/plus/ai/prompts.d.ts +12 -0
- package/dist/plus/ai/prompts.d.ts.map +1 -1
- package/dist/plus/ai/prompts.js +177 -61
- package/dist/plus/ai/prompts.js.map +1 -1
- package/dist/plus/ai/providers/anthropicProvider.d.ts +10 -2
- package/dist/plus/ai/providers/anthropicProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/anthropicProvider.js +139 -46
- package/dist/plus/ai/providers/anthropicProvider.js.map +1 -1
- package/dist/plus/ai/providers/deepSeekProvider.d.ts +2 -0
- package/dist/plus/ai/providers/deepSeekProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/deepSeekProvider.js +10 -21
- package/dist/plus/ai/providers/deepSeekProvider.js.map +1 -1
- package/dist/plus/ai/providers/geminiProvider.d.ts +1 -0
- package/dist/plus/ai/providers/geminiProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/geminiProvider.js +19 -0
- package/dist/plus/ai/providers/geminiProvider.js.map +1 -1
- package/dist/plus/ai/providers/gitkrakenProvider.d.ts +5 -1
- package/dist/plus/ai/providers/gitkrakenProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/gitkrakenProvider.js +118 -3
- package/dist/plus/ai/providers/gitkrakenProvider.js.map +1 -1
- package/dist/plus/ai/providers/huggingFaceProvider.d.ts +1 -0
- package/dist/plus/ai/providers/huggingFaceProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/huggingFaceProvider.js +5 -0
- package/dist/plus/ai/providers/huggingFaceProvider.js.map +1 -1
- package/dist/plus/ai/providers/mistralProvider.d.ts +3 -1
- package/dist/plus/ai/providers/mistralProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/mistralProvider.js +99 -19
- package/dist/plus/ai/providers/mistralProvider.js.map +1 -1
- package/dist/plus/ai/providers/ollamaProvider.d.ts +4 -3
- package/dist/plus/ai/providers/ollamaProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/ollamaProvider.js +38 -3
- package/dist/plus/ai/providers/ollamaProvider.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProvider.d.ts +1 -0
- package/dist/plus/ai/providers/openAICompatibleProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProvider.js +4 -0
- package/dist/plus/ai/providers/openAICompatibleProvider.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.d.ts +154 -5
- package/dist/plus/ai/providers/openAICompatibleProviderBase.d.ts.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js +259 -10
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js.map +1 -1
- package/dist/plus/ai/providers/openRouterProvider.d.ts +4 -0
- package/dist/plus/ai/providers/openRouterProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/openRouterProvider.js +9 -0
- package/dist/plus/ai/providers/openRouterProvider.js.map +1 -1
- package/dist/plus/ai/providers/openaiProvider.d.ts +1 -0
- package/dist/plus/ai/providers/openaiProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/openaiProvider.js +1 -0
- package/dist/plus/ai/providers/openaiProvider.js.map +1 -1
- package/dist/plus/ai/providers/responseFormatCache.d.ts +8 -0
- package/dist/plus/ai/providers/responseFormatCache.d.ts.map +1 -0
- package/dist/plus/ai/providers/responseFormatCache.js +25 -0
- package/dist/plus/ai/providers/responseFormatCache.js.map +1 -0
- package/dist/plus/ai/providers/xaiProvider.d.ts +1 -0
- package/dist/plus/ai/providers/xaiProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/xaiProvider.js +10 -1
- package/dist/plus/ai/providers/xaiProvider.js.map +1 -1
- package/dist/plus/ai/utils/ai.utils.d.ts +3 -0
- package/dist/plus/ai/utils/ai.utils.d.ts.map +1 -1
- package/dist/plus/ai/utils/ai.utils.js +13 -0
- package/dist/plus/ai/utils/ai.utils.js.map +1 -1
- package/dist/plus/ai/utils/results.utils.d.ts +16 -2
- package/dist/plus/ai/utils/results.utils.d.ts.map +1 -1
- package/dist/plus/ai/utils/results.utils.js +204 -28
- package/dist/plus/ai/utils/results.utils.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +55 -0
- package/dist/plus/git-github/api/github.d.ts.map +1 -1
- package/dist/plus/git-github/api/github.js +177 -4
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/models.d.ts +16 -0
- package/dist/plus/git-github/models.d.ts.map +1 -1
- package/dist/plus/git-github/models.js +29 -3
- package/dist/plus/git-github/models.js.map +1 -1
- package/dist/plus/git-github/providers/github/status.d.ts +1 -0
- package/dist/plus/git-github/providers/github/status.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/status.js.map +1 -1
- package/dist/plus/integrations/context.d.ts +4 -0
- package/dist/plus/integrations/context.d.ts.map +1 -1
- package/dist/plus/integrations/index.d.ts.map +1 -1
- package/dist/plus/integrations/index.js +2 -0
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +6 -3
- package/dist/plus/integrations/models/gitHostIntegration.d.ts.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.js +12 -2
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +3 -1
- package/dist/plus/integrations/models/integration.d.ts.map +1 -1
- package/dist/plus/integrations/models/integration.js +2 -2
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/providers/accounts.d.ts.map +1 -1
- package/dist/plus/integrations/providers/accounts.js +4 -0
- package/dist/plus/integrations/providers/accounts.js.map +1 -1
- package/dist/plus/integrations/providers/azure/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/azure/models.js +3 -0
- package/dist/plus/integrations/providers/azure/models.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.js +1 -0
- package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +14 -2
- package/dist/plus/integrations/providers/github.d.ts.map +1 -1
- package/dist/plus/integrations/providers/github.js +55 -3
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab.d.ts.map +1 -1
- package/dist/plus/integrations/providers/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/models.js +30 -4
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/reads/broaden.d.ts.map +1 -1
- package/dist/plus/integrations/reads/broaden.js +6 -1
- package/dist/plus/integrations/reads/broaden.js.map +1 -1
- package/dist/plus/integrations/reads/drains.d.ts.map +1 -1
- package/dist/plus/integrations/reads/drains.js +7 -4
- package/dist/plus/integrations/reads/drains.js.map +1 -1
- package/dist/plus/integrations/reads/hierarchy.d.ts.map +1 -1
- package/dist/plus/integrations/reads/hierarchy.js +3 -1
- package/dist/plus/integrations/reads/hierarchy.js.map +1 -1
- package/dist/plus/integrations/reads/issueTracker.d.ts.map +1 -1
- package/dist/plus/integrations/reads/issueTracker.js +8 -3
- package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
- package/dist/plus/integrations/reads/issues.d.ts.map +1 -1
- package/dist/plus/integrations/reads/issues.js +9 -4
- package/dist/plus/integrations/reads/issues.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequests.d.ts.map +1 -1
- package/dist/plus/integrations/reads/pullRequests.js +9 -4
- package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
- package/dist/utils/env/browser/base64.d.ts +1 -1
- package/dist/utils/env/browser/base64.d.ts.map +1 -1
- package/dist/utils/env/node/base64.d.ts +1 -1
- package/dist/utils/env/node/base64.d.ts.map +1 -1
- package/dist/utils/env/node/base64.js +2 -0
- package/dist/utils/env/node/base64.js.map +1 -1
- package/dist/utils/keys/chord.d.ts +52 -0
- package/dist/utils/keys/chord.d.ts.map +1 -0
- package/dist/utils/keys/chord.js +135 -0
- package/dist/utils/keys/chord.js.map +1 -0
- package/dist/utils/keys/keybinding.d.ts +53 -0
- package/dist/utils/keys/keybinding.d.ts.map +1 -0
- package/dist/utils/keys/keybinding.js +58 -0
- package/dist/utils/keys/keybinding.js.map +1 -0
- package/dist/utils/path.d.ts +11 -0
- package/dist/utils/path.d.ts.map +1 -1
- package/dist/utils/path.js +13 -0
- package/dist/utils/path.js.map +1 -1
- package/package.json +13 -5
- package/src/git/cache.ts +383 -47
- package/src/git/context.ts +11 -0
- package/src/git/models/fileStatus.ts +1 -0
- package/src/git/models/issue.ts +4 -0
- package/src/git/models/mergeConflicts.ts +3 -2
- package/src/git/models/pullRequest.ts +33 -1
- package/src/git/models/repository.ts +58 -17
- package/src/git/models/statusFile.ts +3 -0
- package/src/git/providers/branches.ts +6 -0
- package/src/git/providers/commits.ts +11 -0
- package/src/git/providers/config.ts +18 -0
- package/src/git/providers/operations.ts +1 -0
- package/src/git/providers/pausedOperations.ts +2 -0
- package/src/git/providers/status.ts +1 -0
- package/src/git/utils/config.utils.ts +8 -0
- package/src/git/utils/issue.utils.ts +2 -0
- package/src/git/utils/pausedOperationStatus.utils.ts +28 -0
- package/src/git/utils/pullRequest.utils.ts +36 -0
- package/src/git/watching/changeEvent.ts +6 -1
- package/src/git/watching/classifyChange.ts +15 -1
- package/src/git/watching/watchService.ts +20 -3
- package/src/git/watching/watchSession.ts +41 -6
- package/src/git/watching/watcherPatterns.ts +1 -1
- package/src/git-cli/exec/git.ts +13 -3
- package/src/git-cli/providers/branches.ts +384 -132
- package/src/git-cli/providers/commits.ts +106 -15
- package/src/git-cli/providers/config.ts +229 -8
- package/src/git-cli/providers/contributors.ts +5 -1
- package/src/git-cli/providers/graph.ts +26 -13
- package/src/git-cli/providers/operations.ts +45 -20
- package/src/git-cli/providers/pausedOperations.ts +109 -17
- package/src/git-cli/providers/refs.ts +33 -3
- package/src/git-cli/providers/status.ts +25 -4
- package/src/git-cli/providers/worktrees.ts +5 -0
- package/src/git-cli/service.ts +0 -1
- package/src/plus/agents/providers/claudeCodeProvider.ts +1130 -87
- package/src/plus/agents/providers/claudeCodeTranscript.ts +95 -9
- package/src/plus/agents/types.ts +46 -2
- package/src/plus/ai/errors.ts +30 -0
- package/src/plus/ai/models/model.ts +56 -6
- package/src/plus/ai/models/promptTemplates.ts +1 -1
- package/src/plus/ai/models/provider.ts +69 -2
- package/src/plus/ai/prompts.ts +186 -61
- package/src/plus/ai/providers/anthropicProvider.ts +155 -47
- package/src/plus/ai/providers/deepSeekProvider.ts +11 -21
- package/src/plus/ai/providers/geminiProvider.ts +19 -0
- package/src/plus/ai/providers/gitkrakenProvider.ts +126 -3
- package/src/plus/ai/providers/huggingFaceProvider.ts +6 -0
- package/src/plus/ai/providers/mistralProvider.ts +102 -19
- package/src/plus/ai/providers/ollamaProvider.ts +55 -4
- package/src/plus/ai/providers/openAICompatibleProvider.ts +5 -0
- package/src/plus/ai/providers/openAICompatibleProviderBase.ts +360 -17
- package/src/plus/ai/providers/openRouterProvider.ts +17 -0
- package/src/plus/ai/providers/openaiProvider.ts +1 -0
- package/src/plus/ai/providers/responseFormatCache.ts +39 -0
- package/src/plus/ai/providers/xaiProvider.ts +10 -1
- package/src/plus/ai/utils/ai.utils.ts +14 -0
- package/src/plus/ai/utils/results.utils.ts +255 -31
- package/src/plus/git-github/api/github.ts +291 -7
- package/src/plus/git-github/models.ts +48 -2
- package/src/plus/git-github/providers/github/status.ts +1 -0
- package/src/plus/integrations/context.ts +4 -0
- package/src/plus/integrations/index.ts +2 -0
- package/src/plus/integrations/models/gitHostIntegration.ts +25 -2
- package/src/plus/integrations/models/integration.ts +23 -13
- package/src/plus/integrations/providers/accounts.ts +4 -0
- package/src/plus/integrations/providers/azure/models.ts +3 -0
- package/src/plus/integrations/providers/bitbucket/models.ts +1 -0
- package/src/plus/integrations/providers/github.ts +85 -1
- package/src/plus/integrations/providers/gitlab.ts +2 -10
- package/src/plus/integrations/providers/models.ts +36 -4
- package/src/plus/integrations/reads/broaden.ts +6 -1
- package/src/plus/integrations/reads/drains.ts +7 -4
- package/src/plus/integrations/reads/hierarchy.ts +3 -1
- package/src/plus/integrations/reads/issueTracker.ts +9 -3
- package/src/plus/integrations/reads/issues.ts +9 -4
- package/src/plus/integrations/reads/pullRequests.ts +9 -4
- package/src/utils/env/browser/base64.ts +1 -1
- package/src/utils/env/node/base64.ts +3 -1
- package/src/utils/keys/chord.ts +184 -0
- package/src/utils/keys/keybinding.ts +116 -0
- package/src/utils/path.ts +14 -0
|
@@ -2,16 +2,66 @@ import type { UnifiedDisposable } from '../../../utils/disposable.js';
|
|
|
2
2
|
import type { Event } from '../../../utils/event.js';
|
|
3
3
|
import type { AIProviders } from '../constants.js';
|
|
4
4
|
import type { AIActionType, AIModel } from './model.js';
|
|
5
|
-
export type AIChatMessageRole = 'assistant' | 'system' | 'user';
|
|
5
|
+
export type AIChatMessageRole = 'assistant' | 'system' | 'tool' | 'user';
|
|
6
|
+
/** A tool the model may call. `parameters` is a JSON Schema object — it maps to OpenAI's
|
|
7
|
+
* `function.parameters` and Anthropic's `input_schema` unchanged. */
|
|
8
|
+
export interface AIToolDefinition {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly description: string;
|
|
11
|
+
readonly parameters: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export interface AIToolCall {
|
|
14
|
+
readonly id: string;
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly args: Record<string, unknown>;
|
|
17
|
+
/** Opaque provider reasoning token (the GitKraken proxy's `thought_signature`), base64-encoded.
|
|
18
|
+
* Must be echoed back on the next turn's assistant message or Anthropic rejects the tool result. */
|
|
19
|
+
readonly providerSignature?: string;
|
|
20
|
+
}
|
|
6
21
|
export type AISystemChatMessage = AIChatMessage<'system'>;
|
|
7
22
|
export interface AIChatMessage<T extends AIChatMessageRole = 'assistant' | 'user'> {
|
|
8
23
|
role: T;
|
|
9
24
|
content: string;
|
|
25
|
+
/** Tool calls this assistant turn requested. Only sent to providers with `supportsTools`. */
|
|
26
|
+
toolCalls?: readonly AIToolCall[];
|
|
27
|
+
/** On `tool`-role messages, the {@link AIToolCall.id} this result answers. */
|
|
28
|
+
toolCallId?: string;
|
|
29
|
+
/** On `tool`-role messages, the name of the tool that produced this result. */
|
|
30
|
+
toolName?: string;
|
|
10
31
|
}
|
|
32
|
+
export type JSONSchemaType = 'object' | 'array' | 'string' | 'number' | 'integer' | 'boolean' | 'null';
|
|
33
|
+
/** Portable JSON Schema subset accepted by every capable provider (OpenAI strict, Azure, Anthropic,
|
|
34
|
+
* Gemini, Mistral, xAI, Ollama). Keep schemas within it: object root, `additionalProperties: false`
|
|
35
|
+
* on every object, every property in `required` (model optionals as `['x', 'null']` unions), and no
|
|
36
|
+
* pattern/format/min/max/recursion. */
|
|
37
|
+
export type JSONSchema = {
|
|
38
|
+
readonly type: JSONSchemaType | readonly JSONSchemaType[];
|
|
39
|
+
readonly description?: string;
|
|
40
|
+
readonly properties?: Readonly<Record<string, JSONSchema>>;
|
|
41
|
+
readonly required?: readonly string[];
|
|
42
|
+
readonly items?: JSONSchema;
|
|
43
|
+
readonly enum?: readonly string[];
|
|
44
|
+
readonly additionalProperties?: boolean;
|
|
45
|
+
};
|
|
46
|
+
/** Canonical response format, shaped like OpenAI's `response_format.json_schema`; providers
|
|
47
|
+
* translate it (the OpenAI envelope is always sent `strict: true`) */
|
|
48
|
+
export type AIResponseFormat = {
|
|
49
|
+
/** OpenAI-envelope only ([a-zA-Z0-9_-], ≤64 chars); Anthropic/Ollama drop it */
|
|
50
|
+
readonly name: string;
|
|
51
|
+
readonly schema: JSONSchema;
|
|
52
|
+
};
|
|
53
|
+
export type AIFinishReason = 'length' | 'content_filter' | 'refusal';
|
|
11
54
|
export interface AIProviderResponse<T> {
|
|
12
55
|
readonly id: string;
|
|
13
56
|
readonly content: string;
|
|
14
57
|
readonly model: AIModel;
|
|
58
|
+
/** Abnormal completion only (truncated/filtered/refused); undefined on a normal stop */
|
|
59
|
+
readonly finishReason?: AIFinishReason;
|
|
60
|
+
/** Tool calls the model requested. Present only when `tools` were sent and the model used them. */
|
|
61
|
+
readonly toolCalls?: readonly AIToolCall[];
|
|
62
|
+
/** Set when the request was retried without tools because the provider rejected them, so the
|
|
63
|
+
* caller can stop offering tools for the rest of the session. */
|
|
64
|
+
readonly toolsRejected?: boolean;
|
|
15
65
|
readonly usage?: {
|
|
16
66
|
readonly promptTokens?: number;
|
|
17
67
|
readonly completionTokens?: number;
|
|
@@ -31,11 +81,14 @@ export type AIProviderResult<T> = {
|
|
|
31
81
|
export interface AIProvider<Provider extends AIProviders = AIProviders> extends UnifiedDisposable {
|
|
32
82
|
readonly id: Provider;
|
|
33
83
|
readonly name: string;
|
|
84
|
+
/** Whether this provider's wire format carries tool definitions, tool calls, and tool results.
|
|
85
|
+
* Providers that omit it never receive tool-shaped messages — callers fall back to text-only. */
|
|
86
|
+
readonly supportsTools?: boolean;
|
|
34
87
|
onDidChange?: Event<void>;
|
|
35
88
|
configured(silent: boolean): Promise<boolean>;
|
|
36
89
|
getApiKey(silent: boolean): Promise<string | undefined>;
|
|
37
90
|
getModels(): Promise<readonly AIModel<Provider>[]>;
|
|
38
|
-
sendRequest<T extends AIActionType>(action: T, model: AIModel<Provider>, apiKey: string, getMessages: (maxInputTokens: number, retries: number) => Promise<AIChatMessage[]>, options: {
|
|
91
|
+
sendRequest<T extends AIActionType>(action: T, model: AIModel<Provider>, apiKey: string, getMessages: (maxInputTokens: number, retries: number) => Promise<AIChatMessage<AIChatMessageRole>[]>, options: {
|
|
39
92
|
signal: AbortSignal;
|
|
40
93
|
modelOptions?: {
|
|
41
94
|
outputTokens?: number;
|
|
@@ -44,6 +97,11 @@ export interface AIProvider<Provider extends AIProviders = AIProviders> extends
|
|
|
44
97
|
/** Opaque session ID the GitKraken provider sends as `GK-Conversation-ID` so the backend
|
|
45
98
|
* charges its per-feature fee once per session; ignored by all other providers. */
|
|
46
99
|
conversationId?: string;
|
|
100
|
+
/** Schema for the provider to enforce natively when the model supports it; providers
|
|
101
|
+
* without support ignore it and the prompt's JSON description carries the load. */
|
|
102
|
+
responseFormat?: AIResponseFormat;
|
|
103
|
+
/** Tools to advertise to the model. Only passed to providers with `supportsTools`. */
|
|
104
|
+
tools?: readonly AIToolDefinition[];
|
|
47
105
|
}): Promise<AIProviderResponse<void> | undefined>;
|
|
48
106
|
}
|
|
49
107
|
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../src/plus/ai/models/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,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C,MAAM,GAAG,SAAS,CAAC,CAAC;IACxD,SAAS,IAAI,OAAO,CAAC,SAAS,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACnD,WAAW,CAAC,CAAC,SAAS,YAAY,EACjC,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,EACxB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAAC,EAAE,CAAC,EACrG,OAAO,EAAE;QACR,MAAM,EAAE,WAAW,CAAC;QACpB,YAAY,CAAC,EAAE;YAAE,YAAY,CAAC,EAAE,MAAM,CAAC;YAAC,WAAW,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAC/D;4FACoF;QACpF,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB;4FACoF;QACpF,cAAc,CAAC,EAAE,gBAAgB,CAAC;QAClC,sFAAsF;QACtF,KAAK,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;KACpC,GACC,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;CACjD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PromptTemplate } from './models/promptTemplates.js';
|
|
2
|
+
import type { AIResponseFormat } from './models/provider.js';
|
|
2
3
|
export declare const generateCommitMessage: PromptTemplate<'generate-commitMessage'>;
|
|
3
4
|
export declare const generateCreatePullRequest: PromptTemplate<'generate-create-pullRequest'>;
|
|
4
5
|
export declare const generateStashMessage: PromptTemplate<'generate-stashMessage'>;
|
|
@@ -6,10 +7,21 @@ export declare const generateCreateCloudPatch: PromptTemplate<'generate-create-c
|
|
|
6
7
|
export declare const explainChanges: PromptTemplate<'explain-changes'>;
|
|
7
8
|
export declare const generateChangelog: PromptTemplate<'generate-changelog'>;
|
|
8
9
|
export declare const generateSearchQuery: PromptTemplate<'generate-searchQuery'>;
|
|
10
|
+
/** Example output block shared by the {@link generateCommits} template and its structural-retry prompt */
|
|
11
|
+
export declare const generateCommitsExampleJson = "{\n \"commits\": [\n {\n \"message\": \"[commit message here]\",\n \"explanation\": \"[detailed explanation of changes here]\",\n \"hunks\": [{\"hunk\": [index from hunk_map]}, {\"hunk\": [index from hunk_map]}]\n }\n ]\n}";
|
|
9
12
|
export declare const generateCommits: PromptTemplate<'generate-commits'>;
|
|
13
|
+
/** Schema counterpart of the {@link generateCommits} template's described output shape */
|
|
14
|
+
export declare const generateCommitsSchema: AIResponseFormat;
|
|
10
15
|
export declare const startWorkFromIssue: PromptTemplate<'start-work-issue'>;
|
|
11
16
|
export declare const reviewPullRequest: PromptTemplate<'start-review-pullRequest'>;
|
|
12
17
|
export declare const reviewChanges: PromptTemplate<'review-changes'>;
|
|
18
|
+
/** Schema counterpart of the {@link reviewChanges} template's output shape */
|
|
19
|
+
export declare const reviewResultSchema: AIResponseFormat;
|
|
20
|
+
/** Schema counterpart of the {@link reviewOverview} template — the manifest-only pass has no diffs,
|
|
21
|
+
* so the grammar itself forbids findings (the template mandates `"findings": null`) */
|
|
22
|
+
export declare const reviewOverviewSchema: AIResponseFormat;
|
|
23
|
+
/** Schema counterpart of the {@link reviewDetail} template's output shape */
|
|
24
|
+
export declare const reviewDetailSchema: AIResponseFormat;
|
|
13
25
|
export declare const reviewOverview: PromptTemplate<'review-overview'>;
|
|
14
26
|
export declare const reviewRefine: PromptTemplate<'review-refine'>;
|
|
15
27
|
export declare const addressReviewFindings: PromptTemplate<'address-review-findings'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/plus/ai/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/plus/ai/prompts.ts"],"names":[],"mappings":"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AO,MAAM,YAAY,EAAE,cAAc,CAAC,eAAe,CAcxD,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,yBAAyB,CAsB3E,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,eAAe,CAqDxD,CAAC"}
|
package/dist/plus/ai/prompts.js
CHANGED
|
@@ -317,8 +317,18 @@ User Query: \${query}
|
|
|
317
317
|
|
|
318
318
|
Convert the user's natural language query into the appropriate search operators. Return only the search query string without any explanatory text. If the query cannot be converted to search operators, return the original query as a message search. For complex temporal expressions that might be ambiguous, prefer simpler, more reliable relative date formats.`,
|
|
319
319
|
};
|
|
320
|
+
/** Example output block shared by the {@link generateCommits} template and its structural-retry prompt */
|
|
321
|
+
export const generateCommitsExampleJson = `{
|
|
322
|
+
"commits": [
|
|
323
|
+
{
|
|
324
|
+
"message": "[commit message here]",
|
|
325
|
+
"explanation": "[detailed explanation of changes here]",
|
|
326
|
+
"hunks": [{"hunk": [index from hunk_map]}, {"hunk": [index from hunk_map]}]
|
|
327
|
+
}
|
|
328
|
+
]
|
|
329
|
+
}`;
|
|
320
330
|
export const generateCommits = {
|
|
321
|
-
id: 'generate-
|
|
331
|
+
id: 'generate-commits_v3',
|
|
322
332
|
variables: ['hunks', 'existingCommits', 'commitMessages', 'hunkMap', 'instructions'],
|
|
323
333
|
template: `You are an advanced AI programming assistant tasked with organizing code changes into commits. Your goal is to create a complete set of commits that are related, grouped logically, atomic, and easy to review. You will be working with individual code hunks and may have some existing commits that already have hunks assigned.
|
|
324
334
|
|
|
@@ -383,22 +393,14 @@ Follow these guidelines:
|
|
|
383
393
|
|
|
384
394
|
8. Write a detailed explanation for each commit (separate from the commit message), walking through the changes in further detail as if explaining them to a reviewer.
|
|
385
395
|
|
|
386
|
-
Output your complete commit organization as a JSON
|
|
396
|
+
Output your complete commit organization as a single JSON object with a "commits" property. The "commits" property is an array where each commit is an object with the following properties:
|
|
387
397
|
- "message": A string containing the commit message
|
|
388
398
|
- "explanation": A string with a detailed explanation of the changes in the commit. Note that this is separate from the commit message and provides more detail than in the message itself.
|
|
389
399
|
- "hunks": An array of objects, each representing a hunk in the commit. Each hunk object should have:
|
|
390
400
|
- "hunk": The hunk index (number) from the hunk_map
|
|
391
401
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
[
|
|
395
|
-
{
|
|
396
|
-
"message": "[commit message here]",
|
|
397
|
-
"explanation": "[detailed explanation of changes here]",
|
|
398
|
-
"hunks": [{"hunk": [index from hunk_map]}, {"hunk": [index from hunk_map]}]
|
|
399
|
-
}
|
|
400
|
-
]
|
|
401
|
-
</output>
|
|
402
|
+
Example output structure:
|
|
403
|
+
${generateCommitsExampleJson}
|
|
402
404
|
|
|
403
405
|
Remember:
|
|
404
406
|
- Text in [] brackets above should be replaced with your own text, not including the brackets
|
|
@@ -409,9 +411,41 @@ Remember:
|
|
|
409
411
|
|
|
410
412
|
\${instructions}
|
|
411
413
|
|
|
412
|
-
Now, proceed with your analysis and organization of the commits. Return only the
|
|
414
|
+
Now, proceed with your analysis and organization of the commits. Return only the JSON object and no other text — no code fences, no XML tags, and no explanatory text.
|
|
413
415
|
`,
|
|
414
416
|
};
|
|
417
|
+
/** Schema counterpart of the {@link generateCommits} template's described output shape */
|
|
418
|
+
export const generateCommitsSchema = {
|
|
419
|
+
name: 'generate_commits',
|
|
420
|
+
schema: {
|
|
421
|
+
type: 'object',
|
|
422
|
+
additionalProperties: false,
|
|
423
|
+
required: ['commits'],
|
|
424
|
+
properties: {
|
|
425
|
+
commits: {
|
|
426
|
+
type: 'array',
|
|
427
|
+
items: {
|
|
428
|
+
type: 'object',
|
|
429
|
+
additionalProperties: false,
|
|
430
|
+
required: ['message', 'explanation', 'hunks'],
|
|
431
|
+
properties: {
|
|
432
|
+
message: { type: 'string', description: 'The commit message' },
|
|
433
|
+
explanation: { type: 'string', description: 'Detailed explanation of the changes' },
|
|
434
|
+
hunks: {
|
|
435
|
+
type: 'array',
|
|
436
|
+
items: {
|
|
437
|
+
type: 'object',
|
|
438
|
+
additionalProperties: false,
|
|
439
|
+
required: ['hunk'],
|
|
440
|
+
properties: { hunk: { type: 'integer', description: 'Hunk index from the hunk_map' } },
|
|
441
|
+
},
|
|
442
|
+
},
|
|
443
|
+
},
|
|
444
|
+
},
|
|
445
|
+
},
|
|
446
|
+
},
|
|
447
|
+
},
|
|
448
|
+
};
|
|
415
449
|
export const startWorkFromIssue = {
|
|
416
450
|
id: 'start-work-issue',
|
|
417
451
|
variables: ['issue', 'instructions'],
|
|
@@ -467,8 +501,10 @@ You can use GitKraken MCP tools to gather additional context about the repositor
|
|
|
467
501
|
|
|
468
502
|
Now, proceed with your analysis and provide a comprehensive review of the PR. Return only the relevant information without any additional text.`,
|
|
469
503
|
};
|
|
504
|
+
// Shared by the reviewChanges and reviewDetail templates so line-citation rules can't drift apart
|
|
505
|
+
const lineCitationGuidance = `- For "lines", copy the "start" and "end" numbers from the \`[NNNNN]\` annotations of the specific lines your finding concerns. Do not count, infer, or estimate — use only the annotated numbers. Removed lines (blank brackets \`[ ]\`) cannot be cited; pick the nearest surrounding new-file line instead. Anchor the range tightly to the lines the finding actually concerns; do not span an entire hunk. If a finding is not tied to specific lines, set "lines" to null; if not tied to a single file, set "file" to null`;
|
|
470
506
|
export const reviewChanges = {
|
|
471
|
-
id: 'review-
|
|
507
|
+
id: 'review-changes_v2',
|
|
472
508
|
variables: ['diff', 'message', 'context', 'instructions'],
|
|
473
509
|
template: `You are an expert code reviewer analyzing a set of code changes. Your goal is to identify meaningful issues — bugs, logic errors, security vulnerabilities, missing error handling, and potential regressions — while ignoring style preferences and linter-level concerns. Focus on problems a careful human reviewer would catch.
|
|
474
510
|
|
|
@@ -489,39 +525,111 @@ Author's description of the changes:
|
|
|
489
525
|
Related work items (known pull requests and issues for this change set). Use these for *intent*: what the change is trying to accomplish. They are not authoritative spec — if a finding contradicts the stated intent, flag it rather than defer to it. May be empty.
|
|
490
526
|
\${context}
|
|
491
527
|
|
|
492
|
-
Produce a structured review
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
A concise 1-3 sentence summary of what these changes do and their overall quality. Note any systemic concerns.
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
528
|
+
Produce a structured review as a single JSON object with this exact structure:
|
|
529
|
+
|
|
530
|
+
{
|
|
531
|
+
"overview": "A concise 1-3 sentence summary of what these changes do and their overall quality. Note any systemic concerns.",
|
|
532
|
+
"focusAreas": [
|
|
533
|
+
{
|
|
534
|
+
"label": "Short title of the concern (under 60 chars)",
|
|
535
|
+
"rationale": "Why this matters — what could go wrong or what is suboptimal",
|
|
536
|
+
"severity": "critical|warning|suggestion",
|
|
537
|
+
"files": ["path/to/file.ts"],
|
|
538
|
+
"findings": [
|
|
539
|
+
{
|
|
540
|
+
"severity": "critical|warning|suggestion",
|
|
541
|
+
"title": "Specific issue title",
|
|
542
|
+
"description": "Clear explanation of the problem and how to address it",
|
|
543
|
+
"file": "path/to/file.ts",
|
|
544
|
+
"lines": { "start": 42, "end": 45 }
|
|
545
|
+
}
|
|
546
|
+
]
|
|
547
|
+
}
|
|
548
|
+
]
|
|
549
|
+
}
|
|
509
550
|
|
|
510
551
|
Guidelines:
|
|
511
552
|
- Severity levels: "critical" = bugs, security issues, data loss risks; "warning" = logic concerns, missing error handling, potential regressions; "suggestion" = improvements, maintainability, performance
|
|
512
553
|
- Group related findings into focus areas by theme, not by file
|
|
513
|
-
- If changes look correct and well-structured, say so in the overview and
|
|
554
|
+
- If changes look correct and well-structured, say so in the overview and use an empty "focusAreas" array
|
|
514
555
|
- 3-5 high-quality findings are better than 15 low-quality ones
|
|
515
|
-
|
|
556
|
+
${lineCitationGuidance}
|
|
516
557
|
- Do not flag style issues, naming preferences, or things a linter would catch
|
|
517
558
|
- Base conclusions only on the code shown — do not speculate about unseen code
|
|
518
559
|
|
|
519
560
|
\${instructions}
|
|
520
561
|
|
|
521
|
-
Review the changes and
|
|
562
|
+
Review the changes and return only the JSON object above — no other text, no code fences.`,
|
|
563
|
+
};
|
|
564
|
+
// Nullable so the same schema passes OpenAI strict mode (all properties required, optionals as
|
|
565
|
+
// null-unions) and Anthropic's structured outputs (which allow optionals natively)
|
|
566
|
+
const reviewFindingSchema = {
|
|
567
|
+
type: 'object',
|
|
568
|
+
additionalProperties: false,
|
|
569
|
+
required: ['severity', 'title', 'description', 'file', 'lines'],
|
|
570
|
+
properties: {
|
|
571
|
+
severity: { type: 'string', enum: ['critical', 'warning', 'suggestion'] },
|
|
572
|
+
title: { type: 'string' },
|
|
573
|
+
description: { type: 'string' },
|
|
574
|
+
file: { type: ['string', 'null'] },
|
|
575
|
+
lines: {
|
|
576
|
+
type: ['object', 'null'],
|
|
577
|
+
additionalProperties: false,
|
|
578
|
+
required: ['start', 'end'],
|
|
579
|
+
properties: { start: { type: 'integer' }, end: { type: 'integer' } },
|
|
580
|
+
},
|
|
581
|
+
},
|
|
582
|
+
};
|
|
583
|
+
function buildReviewResultSchema(name, findings) {
|
|
584
|
+
return {
|
|
585
|
+
name: name,
|
|
586
|
+
schema: {
|
|
587
|
+
type: 'object',
|
|
588
|
+
additionalProperties: false,
|
|
589
|
+
required: ['overview', 'focusAreas'],
|
|
590
|
+
properties: {
|
|
591
|
+
overview: { type: 'string' },
|
|
592
|
+
focusAreas: {
|
|
593
|
+
type: 'array',
|
|
594
|
+
items: {
|
|
595
|
+
type: 'object',
|
|
596
|
+
additionalProperties: false,
|
|
597
|
+
required: ['label', 'rationale', 'severity', 'files', 'findings'],
|
|
598
|
+
properties: {
|
|
599
|
+
label: { type: 'string' },
|
|
600
|
+
rationale: { type: 'string' },
|
|
601
|
+
severity: { type: 'string', enum: ['critical', 'warning', 'suggestion'] },
|
|
602
|
+
files: { type: 'array', items: { type: 'string' } },
|
|
603
|
+
findings: findings,
|
|
604
|
+
},
|
|
605
|
+
},
|
|
606
|
+
},
|
|
607
|
+
},
|
|
608
|
+
},
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
/** Schema counterpart of the {@link reviewChanges} template's output shape */
|
|
612
|
+
export const reviewResultSchema = buildReviewResultSchema('review_result', {
|
|
613
|
+
type: ['array', 'null'],
|
|
614
|
+
items: reviewFindingSchema,
|
|
615
|
+
});
|
|
616
|
+
/** Schema counterpart of the {@link reviewOverview} template — the manifest-only pass has no diffs,
|
|
617
|
+
* so the grammar itself forbids findings (the template mandates `"findings": null`) */
|
|
618
|
+
export const reviewOverviewSchema = buildReviewResultSchema('review_overview', { type: 'null' });
|
|
619
|
+
/** Schema counterpart of the {@link reviewDetail} template's output shape */
|
|
620
|
+
export const reviewDetailSchema = {
|
|
621
|
+
name: 'review_detail',
|
|
622
|
+
schema: {
|
|
623
|
+
type: 'object',
|
|
624
|
+
additionalProperties: false,
|
|
625
|
+
required: ['findings'],
|
|
626
|
+
properties: {
|
|
627
|
+
findings: { type: 'array', items: reviewFindingSchema },
|
|
628
|
+
},
|
|
629
|
+
},
|
|
522
630
|
};
|
|
523
631
|
export const reviewOverview = {
|
|
524
|
-
id: 'review-
|
|
632
|
+
id: 'review-overview_v2',
|
|
525
633
|
variables: ['files', 'message', 'context', 'instructions'],
|
|
526
634
|
template: `You are an expert code reviewer performing an initial assessment of a set of code changes. You are given a file manifest (not full diffs) — use the file paths, change types, and line counts to identify which areas deserve closer inspection.
|
|
527
635
|
|
|
@@ -538,31 +646,34 @@ Author's description of the changes:
|
|
|
538
646
|
Related work items (known pull requests and issues for this change set). Use these for *intent* — what the change is trying to accomplish — when ranking which areas deserve closer review. May be empty.
|
|
539
647
|
\${context}
|
|
540
648
|
|
|
541
|
-
Produce a structured assessment
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
A concise 1-3 sentence summary of the scope and nature of these changes based on the file manifest and description.
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
649
|
+
Produce a structured assessment as a single JSON object with this exact structure:
|
|
650
|
+
|
|
651
|
+
{
|
|
652
|
+
"overview": "A concise 1-3 sentence summary of the scope and nature of these changes based on the file manifest and description.",
|
|
653
|
+
"focusAreas": [
|
|
654
|
+
{
|
|
655
|
+
"label": "Short title of the area to inspect (under 60 chars)",
|
|
656
|
+
"rationale": "Why this area deserves closer review — based on the types of files changed, the volume of changes, and potential risk",
|
|
657
|
+
"severity": "critical|warning|suggestion",
|
|
658
|
+
"files": ["path/to/file.ts"],
|
|
659
|
+
"findings": null
|
|
660
|
+
}
|
|
661
|
+
]
|
|
662
|
+
}
|
|
552
663
|
|
|
553
664
|
Guidelines:
|
|
554
665
|
- Severity reflects potential risk: "critical" = security-sensitive files, auth/crypto/payment paths, database migrations; "warning" = core logic changes, API changes, large modifications; "suggestion" = refactoring, config changes, documentation
|
|
555
666
|
- Rank focus areas from highest to lowest risk
|
|
556
667
|
- Group related files into focus areas by theme
|
|
557
668
|
- Include 2-6 focus areas. If changes are very simple, fewer is fine
|
|
558
|
-
-
|
|
669
|
+
- Always set "findings" to null — findings come in a later pass when full diffs are available
|
|
559
670
|
|
|
560
671
|
\${instructions}
|
|
561
672
|
|
|
562
|
-
Assess the changes and
|
|
673
|
+
Assess the changes and return only the JSON object above — no other text, no code fences.`,
|
|
563
674
|
};
|
|
564
675
|
export const reviewRefine = {
|
|
565
|
-
id: 'review-
|
|
676
|
+
id: 'review-refine_v2',
|
|
566
677
|
variables: ['instructions'],
|
|
567
678
|
template: `The user has follow-up guidance for the review you produced above. Produce an updated review that incorporates it:
|
|
568
679
|
- Keep prior findings that remain valid — do not drop them just because the guidance doesn't mention them
|
|
@@ -574,7 +685,7 @@ export const reviewRefine = {
|
|
|
574
685
|
\${instructions}
|
|
575
686
|
</~~instructions~~>
|
|
576
687
|
|
|
577
|
-
Produce the full updated review in the same
|
|
688
|
+
Produce the full updated review as a single JSON object in the same structure as your previous response. Return only the JSON object — no other text, no code fences.`,
|
|
578
689
|
};
|
|
579
690
|
export const addressReviewFindings = {
|
|
580
691
|
id: 'address-review-findings',
|
|
@@ -600,7 +711,7 @@ Guidelines:
|
|
|
600
711
|
\${instructions}`,
|
|
601
712
|
};
|
|
602
713
|
export const reviewDetail = {
|
|
603
|
-
id: 'review-
|
|
714
|
+
id: 'review-detail_v2',
|
|
604
715
|
variables: ['diff', 'overview', 'message', 'focusArea', 'context', 'instructions'],
|
|
605
716
|
template: `You are an expert code reviewer performing a detailed inspection of specific files that were flagged for closer review. You have the context from an initial overview assessment.
|
|
606
717
|
|
|
@@ -628,24 +739,29 @@ Code changes for the files in this focus area (Git diff format). Each non-header
|
|
|
628
739
|
\${diff}
|
|
629
740
|
</~~diff~~>
|
|
630
741
|
|
|
631
|
-
Produce detailed findings
|
|
742
|
+
Produce detailed findings as a single JSON object with this exact structure:
|
|
632
743
|
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
744
|
+
{
|
|
745
|
+
"findings": [
|
|
746
|
+
{
|
|
747
|
+
"severity": "critical|warning|suggestion",
|
|
748
|
+
"title": "Specific issue title",
|
|
749
|
+
"description": "Clear explanation of the problem and how to address it",
|
|
750
|
+
"file": "path/to/file.ts",
|
|
751
|
+
"lines": { "start": 42, "end": 45 }
|
|
752
|
+
}
|
|
753
|
+
]
|
|
754
|
+
}
|
|
639
755
|
|
|
640
756
|
Guidelines:
|
|
641
757
|
- Severity: "critical" = bugs, security, data loss; "warning" = logic concerns, error handling, regressions; "suggestion" = improvements, maintainability
|
|
642
|
-
|
|
758
|
+
${lineCitationGuidance}
|
|
643
759
|
- Be concrete — explain what the problem is and how to fix it
|
|
644
|
-
- If the code in this area looks correct, return
|
|
760
|
+
- If the code in this area looks correct, return {"findings": []}
|
|
645
761
|
- Do not flag style issues or things a linter would catch
|
|
646
762
|
|
|
647
763
|
\${instructions}
|
|
648
764
|
|
|
649
|
-
Inspect the diff for this focus area and
|
|
765
|
+
Inspect the diff for this focus area and return only the JSON object above — no other text, no code fences.`,
|
|
650
766
|
};
|
|
651
767
|
//# sourceMappingURL=prompts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/plus/ai/prompts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/plus/ai/prompts.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,qBAAqB,GAA6C;IAC9E,EAAE,EAAE,2BAA2B;IAC/B,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,cAAc,CAAC;IAC9C,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4IA6CiI;CAC3I,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAkD;IACvF,EAAE,EAAE,gCAAgC;IACpC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,CAAC;IACtD,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uKAkD4J;CACtK,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAA4C;IAC5E,EAAE,EAAE,0BAA0B;IAC9B,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,cAAc,CAAC;IAC9C,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;iHA0BsG;CAChH,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAiD;IACrF,EAAE,EAAE,+BAA+B;IACnC,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,cAAc,CAAC;IAC9C,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mJA0CwI;CAClJ,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAsC;I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,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0FAuC+E;CACzF,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAoC;IAC5D,EAAE,EAAE,kBAAkB;IACtB,SAAS,EAAE,CAAC,cAAc,CAAC;IAC3B,QAAQ,EAAE;;;;;;;;;;sKAU2J;CACrK,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAA8C;IAC/E,EAAE,EAAE,yBAAyB;IAC7B,SAAS,EAAE,CAAC,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,CAAC;IAC1E,QAAQ,EAAE;;;;;;;;;;;;;;;;;;iBAkBM;CAChB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAoC;IAC5D,EAAE,EAAE,kBAAkB;IACtB,SAAS,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,CAAC;IAClF,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CT,oBAAoB;;;;;;;4GAOsF;CAC3G,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { anthropicProviderDescriptor as provider } from '../constants.js';
|
|
2
2
|
import type { AIActionType, AIModel } from '../models/model.js';
|
|
3
|
-
import type { AIChatMessage, AIChatMessageRole } from '../models/provider.js';
|
|
3
|
+
import type { AIChatMessage, AIChatMessageRole, AIResponseFormat, AIToolDefinition } from '../models/provider.js';
|
|
4
|
+
import type { ChatCompletionRequest } from './openAICompatibleProviderBase.js';
|
|
4
5
|
import { OpenAICompatibleProviderBase } from './openAICompatibleProviderBase.js';
|
|
5
6
|
export declare class AnthropicProvider extends OpenAICompatibleProviderBase<typeof provider.id> {
|
|
6
7
|
readonly id: "anthropic";
|
|
7
8
|
readonly name: string;
|
|
9
|
+
readonly supportsTools = true;
|
|
8
10
|
protected readonly descriptor: import("../models/model.js").AIProviderDescriptor<"anthropic">;
|
|
9
11
|
protected readonly config: {
|
|
10
12
|
keyUrl: string;
|
|
@@ -12,15 +14,21 @@ export declare class AnthropicProvider extends OpenAICompatibleProviderBase<type
|
|
|
12
14
|
};
|
|
13
15
|
getModels(): Promise<readonly AIModel<typeof provider.id>[]>;
|
|
14
16
|
protected getUrl(_model: AIModel<typeof provider.id>): string;
|
|
17
|
+
protected applyResponseFormat(request: ChatCompletionRequest, _model: AIModel<typeof provider.id>, responseFormat: AIResponseFormat): void;
|
|
15
18
|
protected getHeaders<TAction extends AIActionType>(_action: TAction, apiKey: string, _model: AIModel<typeof provider.id>, _url: string): Record<string, string>;
|
|
16
19
|
protected fetchCore<TAction extends AIActionType>(action: TAction, model: AIModel<typeof provider.id>, apiKey: string, request: object, signal: AbortSignal | undefined): Promise<Response>;
|
|
17
20
|
protected extractSystemPrompt(messages: AIChatMessage<AIChatMessageRole>[]): {
|
|
18
21
|
messages: AIChatMessage<AIChatMessageRole>[];
|
|
19
22
|
system?: string;
|
|
20
23
|
};
|
|
21
|
-
protected handleFetchFailure<TAction extends AIActionType>(rsp: Response, action: TAction, model: AIModel<typeof provider.id>, retries: number, maxInputTokens: number): Promise<{
|
|
24
|
+
protected handleFetchFailure<TAction extends AIActionType>(rsp: Response, action: TAction, model: AIModel<typeof provider.id>, retries: number, maxInputTokens: number, body?: string, sentTools?: boolean): Promise<{
|
|
22
25
|
retry: true;
|
|
23
26
|
maxInputTokens: number;
|
|
27
|
+
withoutTools?: boolean;
|
|
24
28
|
}>;
|
|
29
|
+
protected serializeTools(tools: readonly AIToolDefinition[]): {
|
|
30
|
+
tools: unknown[];
|
|
31
|
+
};
|
|
32
|
+
protected serializeMessages(messages: AIChatMessage<AIChatMessageRole>[]): unknown[];
|
|
25
33
|
}
|
|
26
34
|
//# sourceMappingURL=anthropicProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropicProvider.d.ts","sourceRoot":"","sources":["../../../../src/plus/ai/providers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