Turns on no-unsafe-enum-comparison, no-base-to-string,
no-redundant-type-constituents, and restrict-template-expressions.
Fixes all 24 violations across 13 source files.
* feat: refactor GitHubCopilotChatModel to support tool calling
Refactored GitHubCopilotChatModel from BaseChatModel to ChatOpenAICompletions
to enable bindTools() for Agent Mode tool calling support.
Key changes:
- Extend ChatOpenAICompletions instead of BaseChatModel for native tool support
- Override _streamResponseChunks to fix Copilot-specific streaming issues:
1. Missing delta.role when proxying Claude models (defaults to "assistant")
2. Non-string delta.content arrays from Claude (normalized to string)
- Use public convertCompletionsDeltaToBaseMessageChunk API (not deprecated method)
- Inject Copilot auth via configuration.fetch wrapper with 401/403 retry
- Export COPILOT_API_BASE and add public token management wrappers
* fix: improve type safety and retry logic in GitHubCopilotChatModel
- Replace loose `[key: string]: any` params interface with type derived
from ChatOpenAICompletions constructor fields for proper type checking
- Limit auth retry to 401 only (not 403) to match GitHubCopilotProvider
behavior and avoid useless token refresh on permanent permission errors
- Replace 80-line _streamResponseChunks fork with minimal
_convertCompletionsDeltaToBaseMessageChunk override
- Remove unused imports (BaseChatModelParams, AIMessageChunk, etc.)
* refactor: remove dead code from GitHubCopilotProvider after ChatOpenAICompletions migration
Chat completions are now handled by GitHubCopilotChatModel (extends
ChatOpenAICompletions) with auth injected via configuration.fetch.
The old Provider-level request methods and their supporting types
are no longer referenced anywhere.
Removed:
- sendChatMessage, sendChatMessageStream, executeWithTokenRetry methods
- CopilotChatResponse, CopilotStreamChunk, CopilotRequestOptions interfaces
- CHAT_COMPLETIONS_URL, HTTP_STATUS_MESSAGES constants
- Unused imports: createParser, ParsedEvent, ReconnectInterval, FetchImplementation
* feat: add model policy terms UI, update Copilot headers, and fix review issues
- Update Copilot request headers to latest VSCode versions
- Cache model policy terms and surface activation guidance on 400 errors
- Extend GitHubCopilotModel interface with billing/policy/endpoint fields
- Show verification error with parsed Markdown links in ModelImporter
- Fix unused logInfo import, guard Request instanceof check,
case-insensitive "not supported" match, clear policy cache on resetAuth
* chore: translate Chinese comments to English and apply formatting
- Translate all Chinese comments in replaceGuard.ts to English for consistency
- Apply Prettier formatting to 33 files
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: add unit tests for Quick Ask core modules
Add comprehensive tests for:
- replaceGuard.ts: validation logic, error messages, MapPos and Highlight strategies
- persistentHighlight.ts: CM6 state field, range mapping, show/hide behavior
- quickCommandPrompts.ts: placeholder appending logic
64 new test cases covering edge cases like:
- Leaf/editor/file change detection
- Document bounds validation
- Content change detection
- Range mapping through document changes
- Case-insensitive placeholder detection
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add GitHub Copilot integration with improved robustness
- Add GitHub Copilot as new LLM provider with OAuth device flow
- Implement GitHubCopilotProvider for token management and API calls
- Implement GitHubCopilotChatModel as LangChain BaseChatModel adapter
- Add GitHubCopilotAuth UI component for OAuth authentication
- Extract reusable ModelImporter component from ApiKeyDialog
Improvements:
- Use authGeneration counter to prevent race conditions on reset
- Add token validation and expires_at type handling (s/ms/string)
- Add MAX_REFRESH_ATTEMPTS to prevent infinite refresh loops
- Add try/catch/finally for robust error handling in ModelImporter
- Clean up AbortController lifecycle in polling operations
* fix: reset model list when provider credentials change
- Add credentialVersion prop to ModelImporter for detecting key changes
- Clear cached models when credentialVersion changes (not just isReady)
- Pass API key/token as credentialVersion in ApiKeyDialog and GitHubCopilotAuth
- This ensures model list refreshes when rotating keys (non-empty to non-empty)
* fix: treat Copilot access token as valid credential
Check both githubCopilotToken and githubCopilotAccessToken when
validating credentials. This allows the model to work when OAuth
succeeds but fetchCopilotToken fails, since getValidCopilotToken()
can still refresh using the access token.