Repository navigation
Conversation
…m providers This commit implements comprehensive corporate networking support for custom AI provider connections: Features: - Auto-detection of proxy settings from environment variables and system settings (Windows registry, macOS scutil, Linux gsettings) - Interactive proxy authentication prompts (browser-like experience) - Support for custom CA certificate bundles with multiple certificates - Client certificate authentication (mutual TLS) - Secure credential caching (in-memory, 1-hour TTL) - Cross-platform compatibility (Windows, macOS, Linux) Implementation: - proxy-detection.ts: Auto-detect proxy from env vars, system settings, and interactive prompts - proxy-auth.ts: Handle 407 Proxy Auth Required responses with interactive credential prompts - corporate-fetch.ts: Main integration point combining proxy, TLS, and authentication - CORPORATE_INTEGRATION_EXAMPLE.md: Integration guide and configuration examples - CORPORATE_PROXY_FEATURE_SUMMARY.md: Feature overview and usage documentation Dependencies: - Added [email protected] for full Node.js-compatible HTTP client with proxy support Configuration schema extensions (to be integrated): - proxy: Auto-detect or explicit proxy URL - proxyAuth: Username/password for proxy authentication - tls.ca: Single file or array of CA certificate files (supports bundles) - tls.cert/key: Client certificate for mutual TLS - tls.rejectUnauthorized: Certificate validation control Environment variables supported: - HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, NO_PROXY (standard proxy vars) - NODE_EXTRA_CA_CERTS (standard certificate var) - Custom vars via {env:VAR} substitution Next steps: - Integrate into packages/opencode/src/provider/provider.ts getSDK() function - Update packages/opencode/src/config/config.ts provider options schema
…er system
This commit completes the integration of corporate networking features into the main provider system.
Changes to config.ts:
- Extended provider options schema to include proxy, proxyAuth, and tls configuration
- Added support for proxy: "auto" | string | false
- Added proxyAuth with username/password (supports {env:VAR} substitution)
- Added tls configuration for CA certificates (single file or array), client certificates, and validation control
- All new options are optional and backward compatible
Changes to provider.ts:
- Modified getSDK() function to detect when corporate networking is needed
- When proxy or tls options are present, uses createCorporateFetch() instead of standard fetch
- Preserves existing timeout-wrapped fetch for providers without corporate networking requirements
- Enables interactive proxy authentication prompts
- Backward compatible with existing provider configurations
Features now available:
✅ Auto-detect proxy from HTTP_PROXY/HTTPS_PROXY environment variables and system settings
✅ Interactive proxy authentication prompts (browser-like experience)
✅ Support for CA certificate bundles with multiple certificates
✅ Client certificate authentication (mutual TLS)
✅ Configurable certificate validation
✅ Full backward compatibility
Usage example:
```jsonc
{
"provider": {
"corporate-ai": {
"npm": "@ai-sdk/openai-compatible",
"api": "https://ai.company.com/v1",
"options": {
"apiKey": "{env:CORPORATE_AI_KEY}",
"proxy": "auto",
"tls": {
"ca": "/etc/ssl/certs/corporate-ca-bundle.crt"
}
}
}
}
}
```
Related files:
- proxy-detection.ts: Auto-detection logic
- proxy-auth.ts: Interactive authentication
- corporate-fetch.ts: Main integration point
- CORPORATE_INTEGRATION_EXAMPLE.md: Integration guide
- CORPORATE_PROXY_FEATURE_SUMMARY.md: Feature documentation
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.