mirror of
https://github.com/Gitlawb/openclaude.git
synced 2026-08-24 02:34:15 -05:00
main
35
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
1e56d4e7b2 |
feat(providers): add focused LLMTR hybrid gateway (#2150)
* feat: add LLMTR hybrid gateway * feat: support LLMTR_API_KEY * fix: allow LLMTR provider env files * fix: protect LLMTR credential routing * fix: protect LLMTR profile credentials * fix: complete LLMTR env lifecycle * fix: select LLMTR model before client setup * fix: address LLMTR review findings * fix: route LLMTR auxiliary models correctly * fix: complete LLMTR credential boundaries * fix: clear persisted LLMTR startup keys * fix: normalize LLMTR generic credentials * fix: scope LLMTR credential support * fix: align LLMTR credential boundaries * fix: close LLMTR credential boundaries * fix: clear stale LLMTR auth state * fix: clear persisted LLMTR credentials * fix: complete LLMTR setup contracts * fix: close LLMTR lifecycle gaps * fix(providers): close LLMTR credential boundaries * fix(providers): preserve saved LLMTR profile keys |
||
|
|
084bc53463 |
feat(gateway): add Concentrate AI provider with dynamic model discovery (#2140)
* feat(gateway): add Concentrate AI provider with dynamic model discovery * fix(concentrate): prompt for Concentrate API key in /provider instead of pre-filling OPENAI_API_KEY * docs(concentrate): remove standalone setup guide to match other gateways * fix(concentrate): dedicated-credential-only routing, env-only identity, and credential isolation - Make Concentrate dedicatedCredentialsOnly so ambient OPENAI_API_KEY is never forwarded. Only CONCENTRATE_API_KEY authenticates the route. - Resolve Concentrate env-only route identity from CONCENTRATE_API_KEY, CONCENTRATE_BASE_URL, CONCENTRATE_MODEL, or a Concentrate-shaped OPENAI_BASE_URL. - Mirror the dedicated credential into OPENAI_API_KEY only after the route identity is established and only for the canonical /v1 inference endpoint. - Add Concentrate support to --provider concentrate, saved profiles, startup env rebuild, and .env allowlist. - Add regression tests for env-only, flag, saved-profile, and client routing. - Fix adjacent ApiSmart keyless profile leaking string 'undefined' into OPENAI_API_KEY and extend the first providerProfiles test timeout for the now-slower fresh module import. * fix(concentrate): protect credentials on noncanonical urls * fix(concentrate): drop legacy keys on retargeted profiles * fix(concentrate): remove legacy generic keys on proxies * fix(concentrate): reject noncanonical credential routes * fix(concentrate): validate env-only credentials * fix(concentrate): align env-only route validation * fix(concentrate): clear headers before client setup * test(validation): isolate Concentrate model env * fix(concentrate): honor provider precedence and model defaults * test(concentrate): cover model resolution precedence * fix(concentrate): preserve legacy model fallback * fix(concentrate): normalize early model selection * fix(concentrate): validate and select rejected models safely * fix(concentrate): reset stale route state * fix(concentrate): preserve proxy profile capabilities |
||
|
|
ea655163d3 |
feat(zai): expand Coding Plan catalog support (#2127)
* feat(zai): expand Coding Plan catalog support Signed-off-by: chioarub <chioarub@gmail.com> * fix(zai): use supported low reasoning mode Signed-off-by: chioarub <chioarub@gmail.com> --------- Signed-off-by: chioarub <chioarub@gmail.com> |
||
|
|
8f81e48f0e |
feat: add LongCat as first-class OpenAI-compatible provider (#1986)
* feat: add LongCat as first-class OpenAI-compatible provider
Register LongCat-2.0 in the integration catalog with LONGCAT_API_KEY auth,
/provider preset support, and zai-compatible thinking controls that emit
thinking:{type} while stripping unverified reasoning_effort fields.
* fix: complete LongCat provider integration
* fix: complete LongCat provider integration
* test: isolate LongCat provider environment
* test: isolate LongCat environment in provider tests
* test: isolate LongCat environment in route tests
* test: isolate LongCat environment in utility tests
* fix: harden LongCat provider integration
* fix: complete LongCat transport support
* fix: keep LongCat requests text-only
* fix: normalize LongCat endpoint URLs
* fix: reject malformed LongCat base URLs
* fix: harden LongCat text-only transport
* fix: scope LongCat transport hardening
* fix: scope generic OpenAI credentials by route
* fix: preserve required provider API formats
* fix: align LongCat with documented tool support
* fix: harden LongCat environment routing
* fix: enable LongCat tool calling
* Revert "fix: enable LongCat tool calling"
This reverts commit
|
||
|
|
3808d19da4 |
fix(api): enforce API_TIMEOUT_MS for OpenAI-compatible headers (#1940)
* fix(api): enforce API_TIMEOUT_MS for OpenAI-compatible headers * test(api): cover Copilot responses fallback deadlines * fix(api): redact secrets in timeout URL paths * fix(api): harden Copilot response deadlines * fix(api): prevent header-timeout request replay * fix(api): harden timeout cleanup and redaction * fix(api): redact encoded transport credentials * fix(api): harden deadline retries and URL redaction * fix(api): preserve aborted fetch reasons * fix(api): preserve caller abort reasons * test(api): clear caller abort timer * docs(api): clarify API_TIMEOUT_MS transport scope * docs(api): explain timeout env loading * fix(api): reset deadline for proxy retries * fix(api): type deadline fetch adapter * fix(api): honor abort cleanup and request signals * fix(api): do not block proxy retries on body cancellation --------- Co-authored-by: jatmn <the@jat.mn> |
||
|
|
de76950f60 |
feat(provider): route GPT-5.6 models to the OpenAI Responses API (#1961)
* feat(provider): route GPT-5.6 models to the OpenAI Responses API
GPT-5.4/5.5/5.6 (incl. gpt-5.6-sol/terra/luna) reject function tools +
reasoning_effort on /v1/chat/completions, so an agent CLI (which always
sends tools) can't use them. Add a model+base predicate
(modelRequiresResponsesApi) that auto-selects the existing /v1/responses
transport for these models on api.openai.com and Azure OpenAI hosts.
Precedence: explicit responses/responses_compat > catalog
requiredApiFormat > explicit chat_completions > predicate > default. The
gpt-5.6 catalog entries deliberately set no requiredApiFormat so the
chat_completions escape hatch works for them. Register the gpt-5.6
descriptors and openai-vendor catalog entries (with reasoning metadata so
buildResponsesBody emits nested reasoning.effort).
Also fix a latent bug: the responses branch of buildRequestUrl emitted a
bare ${base}/responses and skipped Azure handling, so a forced/auto
responses route 404'd on Azure. It now mirrors buildChatCompletionsUrl —
deployment-style bases get the deployment path + api-version, bases
already containing /deployments/ keep their path and gain api-version,
while the modern Azure v1 surface (.../openai/v1) is preserved as
${base}/responses.
* fix(provider): honor OPENAI_AZURE_STYLE in the responses gate and use the Azure v1 responses surface
CodeRabbit review on #1961: the responses auto-route gate only checked
hostnames, ignoring the OPENAI_AZURE_STYLE override the shim honors for
custom/private Azure endpoints (APIM-fronted, private link). The Azure
detection is now a single shared predicate (isAzureStyleBaseUrl) used by
both the gate and the shim: OPENAI_AZURE_STYLE truthiness first, then
hostname matching.
Per Microsoft's docs, the Responses API exists only on the Azure v1
surface ({resource}/openai/v1/responses, model in the request body, no
api-version, no deployment-scoped form), so buildResponsesUrl now
normalizes any Azure-style base to that surface instead of mirroring the
chat builder's deployment-path + api-version form, which built endpoints
that do not exist.
https://learn.microsoft.com/en-us/azure/foundry/openai/how-to/responses
* fix(provider): address maintainer review on GPT-5.6 responses routing
Narrows the responses auto-route to verified variants (gpt-5.4/5.5/5.6
minus -mini/-nano, two-digit minors deliberately unmatched), corrects the
gpt-5.6 context window to 1,050,000 per the OpenAI model pages, documents
OPENAI_AZURE_STYLE's routing effect in .env.example, and hardens
buildResponsesUrl normalization (trailing-slash strip, stacked Azure
suffixes stripped until stable). Also pins --max-concurrency=1 on the
default test script and adds direct coverage for isAzureStyleBaseUrl, the
override-driven responses URL, and the gpt-5.6 catalog metadata.
* test(provider): pin responses predicate behavior for patch and suffixed ids
Pins gpt-5.4.1 (patch of a verified family, routed), gpt-5.41 (two-digit
minor read, not routed), and gpt-5.6-mini-high (mini variant, not routed)
so the predicate's edge behavior is asserted rather than implied.
* fix(provider): responses-contract test, regional OpenAI hosts, Azure deployment docs, env allowlist
Updates the providerOverride gpt-5.4 effort test to the Responses contract
the auto-route now sends (nested reasoning.effort, /responses URL); widens
the auto-route host check to OpenAI-controlled *.api.openai.com regional
endpoints; documents and regression-tests the explicit
OPENAI_API_FORMAT=responses path for arbitrary Azure deployment names; and
allows OPENAI_AZURE_STYLE through the --provider-env-file allowlist.
* fix(provider): narrow responses auto-route to verified minors and carry GPT-5.6 reasoning metadata on Azure
Narrows the model-name auto-route predicate from gpt-5.[4-9] to gpt-5.[4-6]
so unverified future minors (5.7/5.8/5.9) are not auto-routed, and syncs the
comment plus the two remaining "5.4+" phrasings in .env.example.
Fixes GPT-5.6 reasoning metadata on Azure and regional OpenAI bases: those
hosts resolve to route 'custom' (empty catalog), so resolveCatalogReasoningMetadata
returned undefined and the request dropped its default 'high' effort and the
reasoning.encrypted_content include. It now falls back to the openai vendor
catalog by model name on route 'custom', so gpt-5.6 carries its advertised
default 'high' and xhigh instead of incidental legacy controls.
* fix(provider): gate the custom-route reasoning fallback to verified OpenAI/Azure bases
The round-3 custom-route fallback also fired for arbitrary OpenAI-compatible
gateways (which resolve to route 'custom' too), injecting a default
reasoning_effort:high on a chat_completions request those gateways may reject
— a behavior change on third-party gateways the PR promised not to make.
Gate the fallback on baseUrlSupportsResponsesAutoRoute (the same verified
OpenAI/Azure surfaces the Responses auto-route uses), threading the request
base via the reasoning context (process.env fallback for the upstream path).
* test(provider): isolate OPENAI_API_BASE/OPENAI_AZURE_STYLE in the gpt-5.6 reasoning tests
The Azure/regional/gateway reasoning tests snapshot-restored only
CLAUDE_CODE_USE_OPENAI/OPENAI_BASE_URL/OPENAI_API_KEY. A leaked
OPENAI_AZURE_STYLE from another test would make isAzureStyleBaseUrl treat
the gateway base as Azure-style, firing the fallback and flipping the
'no injected default' assertion. Snapshot both keys and delete them before
each test's setup so a leaked value cannot corrupt the result.
* fix: preserve GPT-5.6 fallback and Azure routing
* fix: cover GPT-5.6 Azure edge cases
* fix: cover GPT-5 forced chat tools
* fix(provider): narrow Azure-style responses routing
* fix(provider): isolate agent overrides from Azure mode
* fix(provider): isolate override reasoning from Azure mode
* fix(provider): isolate override API format
* fix(provider): preserve responses effort routing
* fix(provider): restore safe context and clear Azure mode
* fix(provider): preserve Azure routing state
* fix(provider): preserve Azure profile routing
* fix(provider): preserve automatic Responses routing in profiles
---------
Co-authored-by: jatmn <the@jat.mn>
|
||
|
|
46e80568be |
fix(provider): support custom Anthropic bearer auth (#1929)
* fix(provider): support custom Anthropic bearer auth * feat(provider): add custom Anthropic profile flow * fix(provider): restore custom Anthropic tokens on startup * fix(provider): preserve custom Anthropic env setup * fix(provider): clear stale custom Anthropic tokens * fix(provider): preserve custom Anthropic API-key env setup * fix(provider): cover custom Anthropic auth routing * test(api): isolate custom Anthropic client routing * test(api): cache-bust client provider imports * feat(provider): clarify custom provider presets * fix(provider): address custom Anthropic review feedback * fix(provider): preserve custom Anthropic headers * fix(provider): require custom Anthropic token * fix(provider): isolate custom Anthropic credentials * fix(provider): guard custom Anthropic setup * fix(provider): complete custom Anthropic integration * fix(provider): classify custom Anthropic proxies * fix(provider): gate proxy cache extensions * fix(provider): preserve custom Anthropic isolation * fix(provider): retain direct proxy model option * fix(provider): honor custom endpoint boundaries * fix(provider): keep proxy credentials local * fix(provider): disable proxy fast mode * fix(provider): preserve first-party route identity * fix(provider): isolate custom Anthropic endpoints * fix(provider): gate remaining first-party features * fix(provider): isolate custom Anthropic proxy features * test(web-search): make Brave timeout mock abort-aware * fix(provider): address custom Anthropic review feedback * test(provider): cover first-party beta gates * fix(provider): complete custom Anthropic isolation * fix(provider): complete custom Anthropic routing * fix(provider): address custom Anthropic review followups * fix(provider): close custom Anthropic review gaps * test(provider): keep custom Anthropic mock helpers isolated * test(provider): isolate model options gateway mocks * fix(provider): stabilize custom Anthropic model option display * fix(provider): address remaining review threads * fix(provider): synchronize active profile persistence * fix(provider): preserve custom Anthropic API key auth * fix(provider): avoid forwarding inherited Anthropic keys * fix(provider): guard custom auth selection * fix(provider): require first-party Anthropic port * test(web-search): avoid duplicate shared lock * fix(provider): resolve remaining review findings * fix(provider): harden custom Anthropic routing * fix(provider): simplify Anthropic thinking gate * fix(provider): preserve custom proxy routing and secret permissions * fix(mcp): isolate Claude.ai config cache by provider * fix(model): keep custom endpoints out of first-party UX * fix(provider): scope Opus off switch to Anthropic * fix(provider): disable tool search for custom proxies * fix(provider): close custom Anthropic review gaps * fix(provider): reject Anthropic staging custom profiles * fix(webfetch): classify custom Anthropic endpoints * fix(provider): block bearer auth at Anthropic origin * fix(provider): keep custom auth off staging OAuth * test(provider): strengthen auth regression coverage |
||
|
|
ae9a765fb5 | fix(env): align WebSearch and Ollama env docs (#1904) | ||
|
|
8369f2018e |
feat(provider): add AI/ML API provider (#863)
* feat(provider): add AI/ML API integration Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(provider): preserve bootstrap model fallback * fix(provider): complete aimlapi env-only routing * test(provider): keep first-run preset assertions visible * fix(provider): align aimlapi attribution and setup docs * fix(provider): use aimlapi rebate attribution headers * fix(provider): report current integration version * fix(provider): prioritize dedicated aimlapi credentials * fix(provider): complete AI/ML API attribution headers --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: Lookoff123 <bataryshkinairina@gmail.com> |
||
|
|
985984b9ff |
feat(ClinePass): add gateway provider with usage support (#1818)
* feat(integrations): add ClinePass gateway provider with usage support Adds ClinePass (https://cline.bot) as an OpenAI-compatible gateway provider. Gateway - New descriptor at src/integrations/gateways/clinepass.ts with 10 static models. - Uses wireFormat: 'reasoning_effort' and full granular levels (low/medium/high/xhigh) so each model can expose reasoning controls consistent with Atlas Cloud. - Dedicated credentials only: requires CLINE_API_KEY and ignores stale OPENAI_API_KEY. - Generated integration artifacts updated via bun run integrations:generate. /usage support - New service module under src/services/api/clinepassUsage/ for types, fetching, and normalizing the ClinePass usage-limits response. - New UI component src/components/Settings/ClinePassUsage.tsx rendered by Usage.tsx. - Displays 5-hour, weekly, and monthly usage progress bars with longer progress bars. Provider profile fixes - routeMetadata.ts now resolves the active provider from the saved profile even when CLAUDE_CODE_PROVIDER_PROFILE_ENV_APPLIED is not yet set, so /usage works immediately after switching providers with /provider. - providerProfile.ts / providerProfiles.ts learn CLINE_API_KEY so saved profiles apply the ClinePass credential alongside the OpenAI-compatible env vars. Tests & docs - Updated ProviderManager.test.tsx and compatibility.test.ts for the new preset. - Added routeMetadata.test.ts cases for ClinePass and generic profile fallback. - Added clinepassUsage.test.ts for payload normalization and row building. - Updated .env.example and README.md with CLINE_API_KEY instructions. Validation - bun run typecheck - bun run build - bun run test:provider (964 pass) - bun run check (5331 pass; 1 unrelated Windows file-mode failure in branch.test.ts) * fixup: wire CLINE_API_KEY/CLINE_API_MODEL into runtime routing and profile persistence - Add 'clinepass' to the ProviderProfile union so saved profiles can use it. - Add CLINE_API_KEY to PROFILE_ENV_KEYS so profile switching clears stale keys. - routeMetadata.ts: env-only CLINE_API_KEY now selects the clinepass route; other env-only intents treat CLINE_API_KEY as a competing credential. Added isClinePassBaseUrl/getClinePassBaseUrlOverride and activeProfileBaseUrl option to resolveActiveRouteIdFromEnv so custom/unknown profiles targeting api.cline.bot resolve correctly. - providerConfig.ts: resolveProviderRequest now reads CLINE_API_MODEL when CLINE_API_KEY is present and defaults the base URL to https://api.cline.bot/api/v1. - providerProfiles.ts: CLINE_API_KEY is mirrored into startup/profile env for clinepass and custom profiles at api.cline.bot, and is checked in isProcessEnvAlignedWithProfile. - parse.ts: toIsoDate drops invalid resetsAt values instead of echoing them. - Add fetchClinePassUsage tests covering auth, headers, non-OK responses, and errors. - Add routeMetadata and providerConfig regression tests for ClinePass env/model wiring. - Add providerProfiles tests for CLINE_API_KEY propagation in apply/env and startup persistence. - Remove extra blank line in .env.example. Validation: - bun run typecheck - bun run build - bun run test:provider (972 pass) - bun run check (5346 pass; 1 unrelated Windows file-mode failure in branch.test.ts) * fixup: address PR review findings for ClinePass env routing and profile persistence - routeMetadata.ts: Let the concrete OPENAI_BASE_URL match win before falling back to activeProfileProvider / activeProfileBaseUrl. Prevents a saved ClinePass profile from overriding an explicit CLAUDE_CODE_USE_OPENAI env pointing at another gateway. - providerConfig.ts: Gate the ClinePass model branch behind !isGithubMode so a stale CLINE_API_KEY/CLINE_API_MODEL does not override GitHub Copilot model selection. - providerProfiles.ts: Introduce isClinePassProfile() predicate that uses route resolution (routeId === 'clinepass' || baseUrl includes api.cline.bot) and share it across live application, alignment, and startup persistence paths so saved ClinePass profiles keep the dedicated credential consistently even with non-default base URLs. - Add regression tests covering all three findings. Validation: - bun run typecheck - bun run build - bun run test:provider (973 pass) * fixup: use hostname-based ClinePass detection in providerProfiles Replace includes('api.cline.bot') substring matching with isClinePassBaseUrl which validates the exact hostname via URL parsing, preventing spoofed hosts like api.cline.bot.evil.example from triggering CLINE_API_KEY mirroring. Validation: - bun run typecheck - bun run build - bun run test:provider (973 pass) * fixup: gate ClinePass model selection on resolved base URL Move base URL resolution before model selection in resolveProviderRequest so effectiveClinePassMode is only active when no explicit non-ClinePass base URL is set via options.baseUrl, OPENAI_BASE_URL, or OPENAI_API_BASE. Previously CLINE_API_KEY=cp-key + CLINE_API_MODEL=cline-pass/qwen3.7-max + OPENAI_BASE_URL=https://api.openai.com/v1 would return requestedModel=cline-pass/qwen3.7-max with baseUrl=https://api.openai.com/v1, sending a ClinePass model ID to a non-Cline provider. Now the resolver returns the correct OPENAI_MODEL and OpenAI base URL in that scenario, and only uses ClinePass model/default-base when the resolved base URL is absent or actually api.cline.bot. Added regression tests for: - CLINE_API_KEY + CLINE_API_MODEL + explicit OPENAI_BASE_URL - CLINE_API_KEY + CLINE_API_MODEL + explicit baseUrl option - CLINE_API_KEY + CLINE_API_MODEL with no base URL (ClinePass default) Validation: - bun run typecheck - bun run build - bun run test:provider (976 pass) * fixup: default ClinePass model for blank env Treat whitespace-only CLINE_API_MODEL as unset so OPENAI_MODEL can still provide the ClinePass model override. When CLINE_API_KEY selects ClinePass without any model env, fall back to the ClinePass route default instead of the generic codexplan alias. Validation: - timeout 600 bun test src/services/api/providerConfig.test.ts - timeout 600 bun test src/services/api/clinepassUsage.test.ts src/integrations/routeMetadata.test.ts src/services/api/providerConfig.test.ts src/utils/providerProfiles.test.ts src/integrations/compatibility.test.ts src/components/ProviderManager.test.tsx - timeout 600 bun test src/services/api/providerConfig.test.ts src/services/api/client.test.ts src/integrations/routeMetadata.test.ts src/integrations/runtimeMetadata.test.ts src/services/api/clinepassUsage.test.ts src/services/api/minimaxUsage.test.ts src/utils/providerProfiles.test.ts - timeout 600 bun run integrations:check - timeout 600 bun run typecheck - timeout 600 bun run build - timeout 600 bun run security:pr-scan - git diff --check origin/main...HEAD |
||
|
|
618e901dd8 |
fix(hicap): improve model catalog and effort routing (#1790)
* Improve Hicap model catalog and effort routing Update the Hicap gateway default to claude-opus-4.8 and add verified static catalog entries for DeepSeek V4 Pro, GLM 5.2, GPT-5.4, GPT-5.5, Grok 4.3, Kimi K2.7 Code, and MiniMax M3 with context, output, reasoning, and transport metadata. Force Hicap GPT-5.4/GPT-5.5 through the Responses transport when chat completions would reject reasoning_effort, and shape GLM 5.2 requests with the Z.AI-compatible thinking/tool-streaming behavior. Canonicalize discovered route aliases against static catalog entries so GLM and other aliased models do not duplicate or restart with the wrong API model, while preserving the session-level /model contract without mutating provider profile model lists. Merge static route catalog options with scoped/profile OpenAI-compatible discovery caches and ignore stale legacy OpenAI model caches for env-only Hicap routes. Add focused Atlas Cloud and OpenRouter regressions so these catalog changes do not break other gateways. Validation run locally: bun test --timeout 10000 --feature=UNATTENDED_RETRY src/utils/providerProfiles.test.ts src/utils/model/modelOptions.gateways.test.ts src/utils/model/modelOptions.hicap.test.ts src/utils/model/modelOptions.xiaomi-mimo.test.ts src/utils/model/modelOptions.github.test.ts; bun test --timeout 15000 --feature=UNATTENDED_RETRY src/commands/model/model.test.tsx src/commands/provider/provider.test.tsx src/services/api/client.test.ts; bun test --timeout 10000 --feature=UNATTENDED_RETRY src/services/api/providerConfig.test.ts src/services/api/providerConfig.local.test.ts src/integrations/runtimeMetadata.test.ts src/integrations/compatibility.test.ts src/integrations/routeMetadata.test.ts src/utils/providerFlag.test.ts src/utils/providerValidation.test.ts src/utils/effort.codex.test.ts; bun run typecheck; git diff --check. * Address Hicap PR review findings Rename the discovered model helper to reflect production use, seed ModelPicker focus from the canonical option value, normalize focused/selected picker aliases through the option list, and simplify requested API format support logic. Validation: bun test src/components/ModelPicker.test.tsx src/services/api/bootstrap.test.ts src/services/api/providerConfig.test.ts src/services/api/providerConfig.local.test.ts; bun run typecheck * Fix Hicap catalog id responses routing Resolve route catalog aliases before OpenAI shim runtime/support checks so Hicap catalog ids such as hicap-gpt-5.5 are probed as gpt-5.5 and keep their required Responses API transport. Validation: bun test src/services/api/providerConfig.local.test.ts src/services/api/providerConfig.test.ts src/services/api/openaiShim.test.ts; bun run typecheck * Add bootstrap regression for Hicap errored discovery Exercise fetchLocalOpenAIModelOptions with an errored Hicap discovery result so canonical catalog option mapping and duplicate removal are covered at the bootstrap payload level. Validation: bun test src/services/api/bootstrap.test.ts; bun run typecheck |
||
|
|
dd4c4abc81 |
feat(api): add OpenAI-compatible credential pool failover (#1706)
* feat(api): rotate OpenAI credential pools * fix(api): align pooled credential discovery * fix(cache-probe): preserve GitHub credential precedence * fix(provider): honor pooled OpenAI fallbacks * fix(provider): validate pooled profile credential labels * fix(api): harden OpenAI credential pool handling Reject placeholder values in pooled OpenAI credentials before requests, discovery, diagnostics, and profile generation can use them. Normalize pooled credentials to a single usable key for model discovery, runtime cache partitions, cache probing, and NVIDIA NIM cache lookups. Preserve documented profile precedence by letting live shell credentials override saved pools, carrying OpenCode fallback pools through launch, and redacting individual pool members in profile display. Add regression coverage for pooled credential validation, profile launch/rebuild behavior, discovery/cache callers, diagnostics, provider autodetect, and shim failover semantics. * fix(provider): cover pooled key recommendation path Import the pooled OpenAI credential validator in provider-recommend and split invalid credentials from unset credentials in user guidance. Add a script-level regression that runs the OpenAI recommendation path with OPENAI_API_KEYS so the ts-nocheck script cannot regress with runtime ReferenceErrors. Scrub pooled OpenAI keys before xAI OAuth profile env construction and loosen the invalid-pool discovery test to assert auth header absence instead of exact header shape. * fix(tests): stabilize rebased provider checks * fix(provider): address pooled credential review findings * test(api): cover opencode go credential failover * fix(provider): share OpenAI credential usability checks * fix(provider): respect pooled credential precedence * fix(model): preserve pooled discovery credential precedence * fix(model): fall back from unusable pooled discovery keys |
||
|
|
b581bd9ece |
feat(zai): add GLM-5.2 support (#1689)
* feat(zai): add GLM-5.2 thinking support * fix(provider): derive GHE Copilot URL from base URL * fix(zai): gate GLM reasoning effort by model |
||
|
|
2aad6fc93e |
feat(config): add OPENCLAUDE_CONFIG_DIR override (#1683)
* feat(config): add OPENCLAUDE_CONFIG_DIR env var as preferred alias for CLAUDE_CONFIG_DIR (#454) The legacy CLAUDE_CONFIG_DIR name was the only way to point openclaude at a non-default config home, which leaked Anthropic branding for a fork that has otherwise rebranded to OpenClaude. Add OPENCLAUDE_CONFIG_DIR as the preferred name. CLAUDE_CONFIG_DIR continues to work for backward compatibility; when both are set with different values, OPENCLAUDE_CONFIG_DIR wins and a one-time warning is logged. - src/utils/envUtils.ts: introduce resolveConfigDirEnv() that picks OPENCLAUDE_CONFIG_DIR over CLAUDE_CONFIG_DIR and emits a conflict warning. Memoize cache key now tracks both env vars so changing either invalidates the cached result. - src/utils/env.ts: getGlobalClaudeFile() previously read CLAUDE_CONFIG_DIR directly, missing the new alias. Route through resolveConfigDirEnv() so the global config file path follows the same precedence. - src/utils/secureStorage/macOsKeychainHelpers.ts: the "is default dir" check used by keychain service-name scoping now considers both env vars. - src/utils/swarm/spawnUtils.ts: forward OPENCLAUDE_CONFIG_DIR to teammate processes alongside the legacy var. - src/utils/openclaudePaths.test.ts: +6 unit tests covering the new alias, fallthrough, conflict warning, and resolveConfigDirEnv() in isolation. - .env.example: document both env vars and the precedence rule. Verified locally on Linux: with only OPENCLAUDE_CONFIG_DIR set, with only CLAUDE_CONFIG_DIR set (legacy still works), with both set matching (silent), with both set conflicting (warn once + OPENCLAUDE wins), with neither set (default ~/.openclaude). Memo cache invalidates across 4 sequential env transitions. Built dist/cli.mjs honors the new var and emits the conflict warning to the user. * Fix config-dir warning and docs review findings Only mark the config-dir conflict warning as emitted when a warning callback actually receives it, add coverage for warn-once and silent callers, and update web configuration docs for OPENCLAUDE_CONFIG_DIR precedence. # Conflicts: # web/src/data/configuration.ts * Align configuration docs with openclaude paths Update the configuration page settings-file table to point default users at .openclaude settings and keybindings paths, matching the new config home behavior. * Align keybindings docs with openclaude config home Update the keybindings page, keybindings docs data, and skill index to point default users at ~/.openclaude/keybindings.json. * Align skill and hook labels with openclaude paths Update bundled config/keybindings skill prompts, public skills docs, hook/trust labels, and the user memory selector to use the active OpenClaude config home paths. # Conflicts: # src/components/TrustDialog/utils.ts # src/components/hooks/SelectEventMode.tsx # src/skills/bundled/updateConfig.ts # src/utils/hooks/hooksSettings.ts * Resolve config-home paths dynamically in skill prompts Use runtime settings/keybindings path helpers for bundled skill prompts and the restricted-hooks banner so custom OPENCLAUDE_CONFIG_DIR values are reflected in user-facing guidance. * Update active command prompts for openclaude paths Point statusline, setup/onboarding prompts, plugin messages, and the external user-memory warning at the active OpenClaude settings and memory paths. # Conflicts: # src/commands/auto-fix.ts # src/commands/onboard-github/onboard-github.tsx # src/commands/plugin/ManagePlugins.tsx # src/commands/statusline.tsx * Fix remaining config path review findings * Cover dynamic config paths in UI and storage tests * Fix config path smoke failures after rebase * Fix remaining config path review findings --------- Co-authored-by: gnanam1990 <gnanasekaran.sekareee@gmail.com> |
||
|
|
5af6f95c46 |
feat(config): add explicit provider env-file loading (#1668)
* feat(config): add explicit provider env-file loading * fix(config): handle escaped quotes in provider env files * fix(config): polish env-file parser review feedback * fix(config): preserve provider env-file precedence * test(config): cover provider env-file precedence * fix(config): preserve provider env-file values * fix(config): allow documented env-file setup vars * fix(config): preserve provider flag precedence |
||
|
|
822eff39d1 |
fix(copilot): limit sub-agent concurrency to reduce Premium Request usage (#678) (#1534)
* fix(copilot): limit sub-agent concurrency to reduce Premium Request usage (#678) * fix(copilot): enforce sub-agent concurrency cap at Agent invocation level AgentTool.isConcurrencySafe() now returns false when getCopilotMaxConcurrentSubagents() > 0, preventing the tool scheduler from batching multiple Agent calls together. This ensures at most one sub-agent runs at a time when the cap is active. Previously, AgentTool was always concurrency-safe, allowing the scheduler's runToolsConcurrently to batch multiple Agent calls from a single assistant message — bypassing the documented MAX_SUBAGENTS cap. Add comprehensive copilotOptimization unit tests. * fix(copilot): enforce cap for any positive value and honor OPTIMIZATION_DISABLED - shouldForceSyncSubagentsInCopilotMode: gate on > 0 instead of === 1 so any configured cap (2, 3, ..., 10) forces serial execution - isConcurrencySafe: early-return true when OPTIMIZATION_DISABLED is set - Update log message to reflect any-cap behavior * fix(copilot): align scheduler with launch path, fix mock leak - isConcurrencySafe now uses shouldForceSyncSubagentsInCopilotMode() instead of raw cap check, matching the launch path at line 447 - Add afterAll(mock.restore) to copilotOptimization.test.ts to prevent providers.js mock leaking to AgentTool routing tests * fix(copilot): clarify MAX_SUBAGENTS semantics and fix remediation hint log - Document that only MAX_SUBAGENTS=0 and =1 are enforced; values 2-10 have no runtime effect. - Fix the log remediation hint to depend on the actual cause: MAX=0 suppresses sub-agents entirely (not just forces sync), FORCE_SYNC=1 requires unsetting the flag, and MAX>=1 requires ALLOW_SUBAGENTS=1 to restore parallel execution. * docs(env): document GITHUB_COPILOT_* tuning vars in .env.example The Copilot Premium Request optimization introduces four env vars (GITHUB_COPILOT_MAX_SUBAGENTS, GITHUB_COPILOT_ALLOW_SUBAGENTS, GITHUB_COPILOT_FORCE_SYNC_SUBAGENTS, GITHUB_COPILOT_OPTIMIZATION_DISABLED) that change how sub-agents run for CLAUDE_CODE_USE_GITHUB=1 sessions. Previously these were documented only in source comments, which made them undiscoverable for users affected by the new default. Add them to the GitHub Models section (Option 4) of .env.example with descriptions of each var's effect and default value, addressing the reviewer ask to put the new default behavior in user-facing docs. * fix(copilot): telemetry reflects final async mode; docs in README Address outstanding review gaps for #1534: 1. Telemetry is_async/isAsync now uses the final shouldRunAsync value computed once at the top of the function (was duplicating the partial expression, omitting isCoordinator/forceAsync/assistantForceAsync/ proactiveModule signals that contribute to the launch decision). 2. The shouldSuppressSubagentsInCopilotMode() throw now happens before the event log (so a suppressed-agent error isn't followed by a misleading 'is_async: true' event). 3. isCoordinator, forceAsync, assistantForceAsync are now computed once alongside forceSyncCopilot instead of being declared inline later. 4. README: add GitHub Copilot sub-agent optimization subsection under Provider Notes, with the env var table mirroring the .env.example entry (default behavior, cap semantics, all-opt-out). The doc comment in copilotOptimization.ts L16-29 already explains MAX_SUBAGENTS=0/1 enforcement; the test at L186-191 is consistent with the current implementation (positive cap = synchronous). Skipped: getEffectiveConcurrencyCap() in toolOrchestration.ts (the function no longer exists in the current code; the bot's review was based on an earlier version). * fix(copilot): skip <BackgroundHint /> when forced sync When forceSyncCopilot is true the task can no longer be backgrounded (registerAgentForeground is skipped at L918), but the background hint UI was still rendered once the progress threshold elapsed. That advertises a non-existent affordance on every long-running Copilot sub-agent, which is confusing for users. Gate the hint on the same !forceSyncCopilot condition as the foreground registration. Address the CodeRabbit P2 on round 6. * test(copilot): use spyOn instead of mock.module to avoid partial-mock leak CodeRabbit P2 review on round 7 found the copilotOptimization test registered mock.module('./model/providers.js', () => ({ only 4 exports })) which removed all other exports of providers.ts. Downstream tests in the same CI process (e.g. withRetry, domainCheck, apiPreconnect, agent) that import symbols like isFirstPartyAnthropicBaseUrl would then fail with 'Export named ... not found in module' errors. Switch to spyOn() on the real providers module's getAPIProvider. The real module's other exports remain available, and the spy is torn down via mockRestore() in afterEach. Also drop the cache-busting dynamic-import pattern: the spy persists across the static import, so the test no longer needs a fresh module per test. Also fix README P3: the earlier PowerShell heredoc introduced a TAB (0x09) and Form Feed (0x0C) in place of 't' and 'f' in the new Copilot section, rendering 'tengu_agent_tool_selected' as 'engu_...' and 'false' as 'alse'. Rewrite the line with proper 't' and 'f' characters and add backticks for code formatting (was unformatted plain text). Skipped: P2 scheduler-boundary coverage (CodeRabbit round 6 item). That requires driving multiple Agent tool-use blocks through the scheduler in AgentTool/StreamingToolExecutor, which is a larger change than the current PR's scope. * test(copilot): add FORCE_SYNC overrides ALLOW_SUBAGENTS precedence test CodeRabbit round 9: add a test that pins the precedence between GITHUB_COPILOT_FORCE_SYNC_SUBAGENTS=1 and GITHUB_COPILOT_ALLOW_SUBAGENTS=1. The user explicitly asking for synchronous execution must win over the softer "I'm fine with the cap" opt-out. A future reordering of the checks in shouldForceSyncSubagentsInCopilotMode() would silently allow parallel Copilot sub-agent launches when the user asked for sync; this test locks the precedence. Verified locally: 23/23 pass (was 22/22 before adding this test). * fix(copilot): address jatmn round 11 P2/P3 and add scheduler-boundary coverage This commit addresses the latest human + bot review feedback on #1534 across three findings: 1. **P3: Update GitHub Copilot comment in github.ts to use billing-cycle wording.** The previous comment hard-coded "per month (300 for Copilot Free)" — a calendar quota the runtime doesn't own. Mirror the wording from src/utils/copilotOptimization.ts: "per billing cycle, with the exact quota set by the user's Copilot plan." Same docstring shape across both files now. 2. **P2: Add afterEach cleanup to copilotOptimization.test.ts.** Captured the GITHUB_COPILOT_* env vars at module top-level and restore them in afterEach. Previously only beforeEach deleted them, so the precedence test (which sets FORCE_SYNC=1 + ALLOW_SUBAGENTS=1) left those values in process.env after the file completed. Verified by `bun test src/utils/copilotOptimization.test.ts ../copilot-env-probe.test.ts`: before the fix, the probe test sees FORCE_SYNC=1 leaked. After the fix, the probe sees the original env. This is the round 11 P2 review item from jatmn. 3. **P2: Add scheduler-boundary regression test.** New file src/tools/AgentTool/AgentTool.copilotScheduling.test.ts pins the launch↔scheduler alignment by calling `AgentTool.isConcurrencySafe()` directly under each Copilot flag combination. Seven matrix rows: OPTIMIZATION_DISABLED=1, default cap=1, cap=2, ALLOW_SUBAGENTS=1, FORCE_SYNC=1 alone, FORCE_SYNC=1 + ALLOW_SUBAGENTS=1 (precedence), cap=0 (suppressed). A future reorder of the helpers in copilotOptimization.ts that breaks the precedence would fail FORCE_SYNC + ALLOW_SUBAGENTS, locking the launch/scheduling alignment. This is the round 9 / round 11 P2 review item from CodeRabbit + jatmn that has been deferred across multiple rounds. The test uses spyOn on providers.getAPIProvider to control the provider state, then imports AgentTool via cache-busting (?copilotScheduling=... query string) — the same pattern as AgentTool.routing.test.ts. Per-test timeout of 30s absorbs the ~16s one-time AgentTool module load (subsequent tests are sub-1ms because the module is cached after the first beforeAll import). All three changes are verified locally: - `bun test src/utils/copilotOptimization.test.ts` — 23/23 pass - `bun test src/tools/AgentTool/AgentTool.copilotScheduling.test.ts` — 7/7 pass - `bun test --max-concurrency=1` of both files together — 30/30 pass * test(copilot): move per-test timeout to 3rd arg (bun:test API) * fix(copilot): let FORCE_SYNC override MAX_SUBAGENTS=0 + add scheduler-boundary test Two review findings: 1. FORCE_SYNC vs suppression: shouldSuppressSubagentsInCopilotMode() returned true for MAX_SUBAGENTS=0 before FORCE_SYNC was consulted, so GITHUB_COPILOT_MAX_SUBAGENTS=0 + GITHUB_COPILOT_FORCE_SYNC_SUBAGENTS=1 threw "Sub-agents are disabled" instead of running them synchronously, contradicting the documented behavior. FORCE_SYNC (like ALLOW_SUBAGENTS) now bypasses the =0 suppression; docs clarified accordingly. 2. Scheduler-boundary coverage: the existing tests only called isConcurrencySafe() directly. Added a regression that drives multiple Agent tool-use blocks through the real batching path (partitionToolCalls, now exposed via _test): forced-sync splits them into serial single-block batches, ALLOW_SUBAGENTS coalesces them into one concurrent batch. Catches a future divergence between launch and scheduling policy for multiple Agent blocks in one assistant message. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> |
||
|
|
0b24b60ce9 |
feat(provider): add Fireworks AI as official OpenAI-compatible provider (#1590)
* feat(provider): add Fireworks AI as official OpenAI-compatible provider
Includes vendor descriptor, brand descriptor (276 models), model
descriptors (full + merged), routing metadata, env auto-detection,
profile support, client defaults, and docs.
* test: add focused regression tests for Fireworks AI auth and routing
- Add 7 env-only routing tests in client.test.ts (shim routing,
stale model replacement, base URL override, shim option cleanup,
non-Fireworks override ignored, priority with MiniMax, Bedrock yield)
- Add FIREWORKS_API_KEY auto-detection test in providerAutoDetect.test.ts
- Add profile apply/persistence/env-drift tests in providerProfiles.test.ts
- Fix FIREWORKS_API_KEY propagation in strictEnv early return path
* fix: address reviewer comments on Fireworks integration
- Remove OPENAI_API_KEY exclusion so Fireworks cred wins over stale OpenAI key
- Fix TS type error in test by using String() wrapper
- Add Fireworks to detection priority comment in providerAutoDetect.ts
- Add useFireworksEnvOnlyProvider to shim condition for pattern consistency
- Replace loose .includes('fireworks.ai') with isFireworksBaseUrl() exact hostname check
* fix: add explicit case 'fireworks' in applyProviderFlag for credential precedence
- Add 'fireworks' to PREFERRED_PROVIDER_ORDER
- Add case 'fireworks' with dedicated key winning pattern (mirrors atlas-cloud)
- Add FIREWORKS_API_KEY to copiedOpenAIKeyProvider detection so stale
keys are cleaned up when switching away from Fireworks
* fix: guard fireworks defaultModel assignment against 'undefined' string coercion
* fix: remove leftover conflict marker in providerProfiles.ts
* docs(fireworks): add JSDoc to Fireworks functions for coderabbit docstring coverage
Adds JSDoc annotations to isFireworksBaseUrl, getFireworksBaseUrlOverride,
hasFireworksEnvOnlyProviderIntent, isFireworksModelName, and
applyFireworksEnvOnlyDefaults.
* fix(fireworks): cross-check NEARAI_API_KEY in env-only intent functions
hasNearaiEnvOnlyProviderIntent and hasFireworksEnvOnlyProviderIntent were
missing mutual cross-checks. When both NEARAI_API_KEY and FIREWORKS_API_KEY
are set, neither excludes the other, and nearai silently wins by ordering.
Adding !hasNonEmptyEnvValue(processEnv.FIREWORKS_API_KEY) to the nearai intent
and !hasNonEmptyEnvValue(processEnv.NEARAI_API_KEY) to the fireworks intent
ensures both return false, forcing explicit provider selection.
* fix(fireworks): fix typo in JSDoc — OPENAI_API_API_BASE -> OPENAI_API_BASE
* fix(fireworks): remove merge artifact and preserve no-key auth headers
- src/utils/providerAutoDetect.ts: remove leftover ======= conflict
marker and stale duplicate priority lines
- src/utils/providerProfiles.ts: preserve apiFormat, authHeader,
authScheme, authHeaderValue in the no-key OpenAI-compatible
fallback path so saved Responses mode / custom auth config
survives restart
* fix: Fireworks env-only startup preservation and MIMO priority comment
- Add FIREWORKS_API_KEY check to hasConcreteProviderSelection() so env-only
Fireworks setup is not overwritten by Gitlawb Opengateway default
- Add regression test verifying FIREWORKS_API_KEY survives no-profile startup
- Fix providerAutoDetect.ts priority comment to include MIMO_API_KEY (position 8)
and renumber subsequent entries to match actual detection order
* fix: also preserve env-only NEAR AI startup in hasConcreteProviderSelection()
* fix: remove duplicate Fireworks model descriptor, add FIREWORKS_API_KEY to test env cleanup
* fix: move duplicate model check to generation-time, add OPENAI_AUTH_* env cleanup to test harness
---------
Co-authored-by: Gravirei <gravirei@users.noreply.github.com>
|
||
|
|
eacc7d8fac |
feat: add NEAR AI provider integration (#1594)
* feat: add NEAR AI provider integration
- Create vendor, brand, and model descriptors for NEAR AI (22 models)
- Add NEAR AI to route metadata, client, provider auto-detect, and profiles
- Update compatibility tests and ProviderManager test PRESET_ORDER
- Add README and docs entries for NEAR AI provider
- Update .env.example with NEAR AI configuration
* fix: address CodeRabbit review comments
- Fix .env.example: change 'Option N' to 'Option 11' in quick reference
- Narrow isNearaiModelName to use explicit NearAI model prefixes instead of broad includes('/')
- Add NEARAI_API_KEY propagation in strictEnv startup path
* fix: align NEAR AI validation host matching with wildcard subdomain routing
- Add *.completions.near.ai to matchBaseUrlHosts in vendor descriptor
- Add matchHostnameAgainstRouteHosts helper with wildcard (*.) prefix support
- Use helper in both resolveRouteIdFromBaseUrl and getRuntimeValidationTarget
- Add regression test for qwen35-122b.completions.near.ai TEE endpoint
- Add NEARAI_API_KEY to test env cleanup list
* fix: align Near AI integration with env-only provider best practices
- Replace loose .includes('near.ai') with isNearaiBaseUrl() in providerProfiles.ts
for exact hostname validation (all 4 instances)
- Add NEARAI_API_KEY to copiedOpenAIKeyProvider detection in providerFlag.ts
- Add case 'nearai' to applyProviderFlag switch with dedicated key precedence
- Add 'nearai' to PREFERRED_PROVIDER_ORDER
- Add useNearaiEnvOnlyProvider to OpenAI shim condition in client.ts
- Remove OPENAI_API_KEY exclusion from hasNearaiEnvOnlyProviderIntent (dedicated
key wins over stale generic key, consistent with xAI pattern)
- Update detection priority comment in providerAutoDetect.ts to include
MIMO_API_KEY, XAI_API_KEY, and NEARAI_API_KEY
* fix: add exact completions.near.ai host to isNearaiBaseUrl
* fix: add higher-precedence provider key exclusions to hasNearaiEnvOnlyProviderIntent
* fix: add OPENAI_API_KEY and MINIMAX_API_KEY exclusions to hasNearaiEnvOnlyProviderIntent
* fix(near-ai): don't let stale OPENAI_API_KEY suppress Near AI routing
---------
Co-authored-by: Gravirei <gravirei@users.noreply.github.com>
|
||
|
|
d02c10b399 |
feat: configure API retry backoff (#370) (#1095)
* feat: configure API retry backoff Add OpenClaude-branded retry controls for retryable API failures. - Replace the old CLAUDE_CODE_MAX_RETRIES config with OPENCLAUDE_MAX_RETRIES - Allow OPENCLAUDE_MAX_RETRIES=0 to disable retries after the initial request - Cap retry attempts at 100 and invalid values fall back to the default of 10 - Add OPENCLAUDE_RETRY_DELAY_MS to configure the exponential backoff base for APIs that omit Retry-After - Keep Retry-After precedence over configured retry delay - Document both settings in .env.example and advanced setup docs - Add focused retry configuration tests for defaults, invalid values, caps, zero retries, configured delay, and Retry-After precedence Validation: - bun test src/services/api/withRetry.test.ts - bun run build * Honor legacy max retries env var Add compatibility fallback from CLAUDE_CODE_MAX_RETRIES when OPENCLAUDE_MAX_RETRIES is unset. Document the deprecated fallback and cover precedence behavior in retry configuration tests. --------- Co-authored-by: JATMN <12479882+jatmn@users.noreply.github.com> |
||
|
|
b3dc674dbe |
fix: route MiniMax compacting through Anthropic-compatible API (#1154)
* fix: route MiniMax through Anthropic-compatible API Switch MiniMax provider setup away from the OpenAI-compatible shim and onto the Anthropic-compatible endpoint. Update env-only, provider flag, and saved profile paths to use ANTHROPIC_* while preserving legacy OPENAI_MODEL as a migration fallback. Adjust MiniMax M2 context metadata so shared descriptors use the gateway-safe 196608 window and the direct MiniMax catalog overrides to the documented 204800 window. Extend runtime context lookup to anthropic-proxy routes so compact budgeting uses the direct provider metadata. Update MiniMax client, provider profile, provider flag, context, and auto-compact tests for the Anthropic-compatible route and provider-specific compact limits. * test: cover MiniMax provider manager paths Update ProviderManager test fixtures so MiniMax uses the Anthropic-compatible endpoint instead of the old OpenAI-compatible /v1 endpoint. Add coverage for the /provider add flow to assert MiniMax saves provider=minimax, endpoint https://api.minimax.io/anthropic, and displays the Anthropic-compatible API provider type. Add edit-flow coverage to ensure existing MiniMax profiles remain on the Anthropic-compatible provider path and continue hiding OpenAI-only advanced fields. * test: isolate MiniMax env-only coverage Harden MiniMax client and compact tests against ambient CI provider env such as OPENAI_API_KEY, ANTHROPIC_BASE_URL, and provider-profile markers. The compact budget test now explicitly clears competing provider flags before asserting direct MiniMax metadata, preventing CI-level OpenAI credentials from masking env-only MiniMax route detection. * test: reset provider env inside MiniMax client cases Make each env-only MiniMax client test clear competing provider flags, OpenAI/XAI keys, Anthropic env, and saved-profile markers before setting MINIMAX_API_KEY. This keeps the Anthropic-compatible MiniMax route assertions independent of CI-level process env that can otherwise mask env-only provider detection in the full serial suite. * fix: honor explicit MiniMax routing intent Route MiniMax env-only requests by explicit MiniMax model/base intent even when generic OpenAI-compatible environment variables are present, while preserving non-MiniMax base URL conflicts. Use the resolved MiniMax env-only path for Anthropic SDK key selection so stale provider classification or Bun module mocks cannot fall back to an Anthropic test key. Harden MiniMax compact coverage against leaked env overrides and prior autoCompact module mocks, and cover the ambient OpenAI/XAI env regression. * test: clean up compression autoCompact mocks Restore Bun module mocks after compression test files so their deterministic autoCompact window does not leak into later compact tests in full-suite order. Verified the MiniMax compact regression now passes after the compression suites and in the full local test log. * test: avoid autoCompact module mocks in compression tests Replace the compression suites' top-level Bun module mocks for autoCompact/config with real test config and env controls. This avoids Bun 1.3.11 leaking a mocked effective context window into the later MiniMax compact test in full-suite order. Verified compression-before-compact and MiniMax focused suites pass locally. * test: allow capped MiniMax compact reservation CI enables the output-token slot-reservation cap, so MiniMax's direct 204,800 context can produce a 196,800 effective compact window instead of the uncapped 184,800. Keep the test focused on direct MiniMax context metadata while accepting either reservation state. * fix: address MiniMax review findings Treat env-only provider routes such as direct MiniMax as complete startup provider selections so saved profiles do not override explicit MINIMAX_API_KEY/ANTHROPIC_* env. Stop advertising direct MiniMax benchmark support through the OpenAI-compatible benchmark path, and add regression coverage for the unsupported direct MiniMax benchmark env. * fix: classify MiniMax profile startup correctly Recognize MiniMax when /provider loads it through the Anthropic-compatible env shape using ANTHROPIC_BASE_URL, ANTHROPIC_MODEL, and ANTHROPIC_API_KEY. Label MiniMax correctly on the startup screen and skip the Anthropic custom-key approval prompt when the resolved provider is not using the Anthropic account flow. Add regressions for route metadata, legacy provider classification, account-flow bypass, and startup display for Anthropic-compatible MiniMax profiles. * fix: include Anthropic key in provider secret source Allow MiniMax profile redaction to include ANTHROPIC_API_KEY in the SecretValueSource type used by sanitizeProviderConfigValue. This fixes the PR-specific TS2353 reported by review while keeping the MiniMax Anthropic-compatible key alias redacted alongside MINIMAX_API_KEY. Validation: bun test --max-concurrency=1 src\utils\providerProfiles.test.ts src\utils\providerFlag.test.ts src\utils\model\providers.test.ts src\integrations\routeMetadata.test.ts; bun run typecheck still has existing repo-wide errors, with no providerProfile.ts matches. * test: stabilize tool history compression smoke Add a narrow compression-enabled override for tests so the compression suites do not depend on shared global config state from the full Bun runner. Pass explicit effective context windows in direct compression tests and use catalog-backed models in shim compression tests to avoid env-capped tier drift. Verified with focused compression tests, full bun test --max-concurrency=1, and bun run build. * test: stabilize Orama corruption recovery assertion Verify the quarantined corrupted Orama file from the actual persistence directory returned by getOramaPersistencePath, instead of assuming the config-dir projects root used by the full CI runner. Verified with the failing KnowledgeGraph stress test, compression smoke suites, full bun test --max-concurrency=1, and bun run build. * fix: refresh MiniMax compact branch Merge upstream/main into fix/minimax-compact so PR #1154 is current with the target branch. Also fix two branch-local FetchType test casts that surfaced during typecheck scanning of the MiniMax/xAI fallback tests. Validation: bun test --max-concurrency=1 src/utils/providerProfiles.test.ts src/utils/providerFlag.test.ts src/utils/model/providers.test.ts src/integrations/routeMetadata.test.ts src/services/api/client.test.ts src/services/compact/autoCompact.test.ts src/utils/model/benchmark.test.ts; bun run build. |
||
|
|
402cd3dbe8 |
feat(websearch): add first-class Brave adapter; fix Google + Brave presets; restore Exa snippets (#1044)
This PR addresses three real bugs in WebSearch's provider layer plus adds Brave
as a first-class adapter so users with a BRAVE_API_KEY get auto-detection +
auto-chain inclusion (matching the ergonomics of TAVILY_API_KEY, EXA_API_KEY,
etc.).
## 1. New: Brave first-class adapter
`providers/brave.ts` — auto-detects `BRAVE_API_KEY`, slots into the auto chain
between Jina and Bing. Sends the bare token in `X-Subscription-Token` per
Brave's API contract. Mirrors the structure of `tavily.ts` / `bing.ts`.
Brave runs an independent web index (~30B pages), making it a useful
non-Google, non-Bing fallback. Bing's hosted API was sunsetted in Aug 2025
for new users, so Brave is a more practical default fallback in 2026.
## 2. Bug fix: Brave preset sent malformed auth header
The `WEB_PROVIDER=brave` preset in `custom.ts` declared
`authHeader: 'X-Subscription-Token'` but no `authScheme`, so the default
`'Bearer'` scheme prefix kicked in, producing:
X-Subscription-Token: Bearer <token> ← wrong, returns 401
Brave's API expects:
X-Subscription-Token: <token> ← bare token, no scheme
Fix: declare `authScheme: ''` on the preset; update
`buildAuthHeadersForPreset` to emit a bare token (no leading space) when the
scheme is empty.
## 3. Bug fix: Google preset never worked
`WEB_PROVIDER=google` was wired with `Authorization: Bearer <key>`, but the
Google Custom Search JSON API does not support Bearer auth. It requires:
- `?key=<API_KEY>` as a query param
- `?cx=<ENGINE_ID>` as a query param (Programmable Search Engine ID)
The preset previously had no slot for the engine ID at all, so any user
trying `WEB_PROVIDER=google` hit a 400/401 immediately.
Fix: extend `ProviderPreset` with two minimal fields — `authQueryParam` (key
goes in URL, not header) and `envQueryParams` (additional URL params sourced
from env vars). Rewire the `google` preset to use them; reading
`GOOGLE_CSE_ID` for `cx`.
A clear error fires fast if either `WEB_KEY` or `GOOGLE_CSE_ID` is missing,
instead of silently producing a 400 from upstream.
> Note: Google has announced the Custom Search JSON API will be discontinued
> on 2027-01-01 and is closed to new customers. The fix unbreaks existing
> users for the remaining ~8 months; the README includes a sunset notice and
> recommends Brave/Tavily/Exa for new setups.
## 4. Bug fix: Exa results had empty descriptions
`providers/exa.ts` never passed `contents` in the request body. Per the Exa
docs (https://docs.exa.ai/reference/search-api-guide-for-coding-agents):
> Use `highlights` for agent workflows. Highlights return 10x fewer
> tokens with the most relevant excerpts.
Without `contents: { highlights: true }`, the Exa response includes only
`{title, url, id, ...}` — no `text`, no `highlights`, no `summary`. The
adapter was then mapping `r.snippet ?? r.text` (neither field exists in the
default response shape), so every Exa hit came back with
`description: undefined`. Tavily/Brave/DDG all return snippets — Exa was
silently degraded.
Fix: request `contents: { highlights: true }` in the body, and map
`results[].highlights[]` (an array of strings) into the description by
joining up to 3 excerpts with ` … `. Falls back to `text` when present, then
`undefined` if neither field is populated.
## Tests
105 / 105 pass in `src/tools/WebSearchTool/providers/`:
- `providers/brave.test.ts` (new) — 7 tests: auth header, mapping,
domain filters, error paths
- `providers/exa.test.ts` (new) — 9 tests: contents request shape,
highlights mapping, fallback
chain, error paths
- `providers/custom.test.ts` (extended) — 6 new tests covering
`authScheme: ''` (Brave preset),
`authQueryParam` suppression
(Google preset), GOOGLE_CSE_ID +
WEB_KEY fail-fast errors, full
request shape via mocked fetch
205 / 205 pass across `src/tools/`. tsc clean for changed files.
## Docs
- `README_SEARCH_PROVIDERS.md` — promotes `BRAVE_API_KEY` to first-class,
documents `GOOGLE_CSE_ID` + sunset notice, fixes the provider table,
updates the auto-chain priority list and mode list
- `.env.example` — adds `BRAVE_API_KEY` line, documents `GOOGLE_CSE_ID`
requirement + sunset notice, updates auto-chain priority comment
## Migration / behavior changes
- `WEB_PROVIDER=google` users must now set `GOOGLE_CSE_ID` (was previously
unable to function at all, so this is a strict improvement).
- `WEB_PROVIDER=brave` users with `WEB_AUTH_SCHEME=""` workarounds can
drop the workaround — the preset now emits a bare token by default.
- Brave joins the auto-chain priority order
(firecrawl → tavily → exa → you → jina → **brave** → bing → mojeek →
linkup → ddg).
|
||
|
|
a133e7631a |
feat: support self-hosted Firecrawl via FIRECRAWL_API_URL (#949)
* feat: support self-hosted Firecrawl via FIRECRAWL_API_URL Adds FIRECRAWL_API_URL env var to enable self-hosted Firecrawl instances. Both WebFetchTool and firecrawl search provider now check for either FIRECRAWL_API_KEY (cloud) or FIRECRAWL_API_URL (self-hosted). The FirecrawlClient accepts apiUrl for custom endpoints. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: remove incorrect non-null assertion on FIRECRAWL_API_KEY Passing undefined to FirecrawlClient.apiKey is correct when using FIRECRAWL_API_URL without an API key. Also adds regression tests for isConfigured() covering all four env combinations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: trigger CI --------- Co-authored-by: Kunthawat Greethong <kunthawat@gmailcom> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
884746dbe9 |
Provider: Add Hicap gateway provider (#979)
* Add Hicap provider and gateway auth presets * Fix Hicap compatibility preset coverage * Authenticate ripgrep download in PR checks * Use Opus 4.7 as Hicap default * Address Hicap review feedback * Address provider review blockers * Clarify gateway header UI docs * Remove Hicap endpoint from README |
||
|
|
b471745fb1 |
Registry-Based Integration Architecture for Providers, Gateways, and Models (#910)
* setting up
* updated plan with missing notes for discovery cache
* build out inital checklist and planning adjustments
* Phase 1A-1D
* Fix descriptor-backed provider profile routing
- preserve GitHub, Bedrock, and Vertex runtime flags during profile activation\n- serialize descriptor-backed startup profiles into legacy-compatible persisted kinds\n- add regression coverage for activation, restart round-trip, and saved-profile switching\n- guard integration registration so repeated imports stay idempotent in tests
* feat: finish phase 1 provider descriptor routing
Complete the Phase 1E CLI/usage migration work and the Phase 1F verification pass for descriptor-backed providers.
Details:
- derive valid --provider values from descriptor registry and compatibility mappings instead of a fixed list
- preserve special CLI semantics for ollama and minimax while allowing descriptor-backed OpenAI-compatible routes such as deepseek and openrouter to pick up descriptor base URLs
- add getUsageDescriptor() so /usage resolves vendor/gateway metadata and follows usage delegation
- switch Settings Usage rendering to descriptor-backed usage resolution for Anthropic, MiniMax, and neutral unsupported fallbacks
- make integration loading idempotent via ensureIntegrationsLoaded() so registry-backed helpers survive tests that clear the registry
- fix compatibility mapping for mistral so the preset routes through vendorId=openai with gatewayId=mistral rather than a nonexistent direct vendor route
- harden provider profile and startup tests so descriptor-backed providers, legacy OpenAI startup files, and unknown stored providers round-trip correctly
- remove a stale ollama model mock that was leaking across the full model test suite
- update plan/progress.md with the current 1E complete / 1F in-progress verification state and the note that repo-wide typecheck failures are pre-existing outside this migration slice
Verification:
- bun test src/commands/usage/index.test.ts src/integrations/compatibility.test.ts src/utils/providerFlag.test.ts src/utils/providerProfiles.test.ts src/utils/providerProfile.test.ts src/utils/model/modelCache.test.ts src/integrations/index.test.ts src/integrations/registry.test.ts
- filtered bun run typecheck output for the files changed in this branch is clean
* Phase 2 planning
* feat: complete phase 2A validation and discovery cache
* fix: address review findings for phase 2 cache and validation
Fixes the follow-up review issues from the Phase 2A / 2A.5 work.
Completed work:
- made discovery cache stale entries reachable through getCachedModels(..., { includeStale: true }) while keeping fresh-by-default behavior unchanged
- kept recordDiscoveryError stale-data preservation useful to later /model consumers by exposing stale and error-only entries through the public helper API
- extended descriptor-backed validation routing metadata with host alias matching support
- updated MiniMax validation routing to recognize both api.minimax.io and api.minimax.chat endpoints
- added regression coverage for stale cache reads, error-only cache entries, and MiniMax chat-host validation
- updated progress.md notes so the recorded 2A.5 helper behavior matches the implementation
* feat: complete phase 2B discovery and readiness migration
Implement descriptor-backed discovery and readiness routing for Phase 2B.
Highlights:
- add src/integrations/discoveryService.ts to execute declarative catalog.discovery configs with shared discovery-cache integration
- add hybrid merge behavior so curated descriptor catalog entries stay ahead of discovered duplicates
- add typed startup readiness metadata via ReadinessProbeKind and wire gateway descriptors for ollama, atomic-chat, lmstudio, and openrouter
- export probeOllamaModelCatalog() so discovery can distinguish unreachable Ollama from reachable-but-empty catalogs
- migrate ProviderManager and /provider flows to probeRouteReadiness() while preserving existing Ollama messaging
- route bootstrap local model discovery through descriptor-backed discovery for recognized local routes, while keeping legacy fallback for generic custom endpoints
- add resolveDiscoveryRouteIdFromBaseUrl() so bootstrap can share descriptor-backed discovery and local provider labels
- preserve explicit provider env precedence during applySavedProfileToCurrentSession() after focused verification exposed the regression
- update plan/progress.md to mark Phase 2B complete and record the verification notes
Verification:
- bun test src/integrations/discoveryService.test.ts
- bun test src/components/ProviderManager.test.tsx
- bun test src/commands/provider/provider.test.tsx
- bun test src/utils/providerDiscovery.test.ts src/integrations/registry.test.ts src/integrations/index.test.ts
- filtered bun run typecheck for the touched 2B files returned FILTER_CLEAN
* feat: complete phase 2c provider metadata migration
Finish the Phase 2C runtime metadata adoption work on cheeky-cooking-moon.
Provider UI metadata:
- add shared route metadata and provider preset UI metadata helpers
- move preset labels/defaults, route type labels, and custom-header capability checks onto descriptor-backed lookups
- update ProviderManager and /provider summaries/setup copy to read shared descriptor metadata instead of bespoke switches
- extend local gateway descriptors with default model metadata used by the shared UI helpers
Model discovery UX:
- add route catalog option builders for descriptor-backed /model rendering
- update /model to resolve the active route, read cached route catalogs before rendering, and trigger background refresh when cached discovery is stale
- add /model refresh plus in-picker refresh via modelPicker:refresh and the r keybinding
- clear discovery cache on manual refresh and surface non-blocking loading/success/stale-error states in ModelPicker
- keep descriptor-backed dynamic and hybrid routes on the shared discovery cache service
Verification and hardening:
- fix combined test pollution by isolating /model test module imports and using real OpenRouter descriptor metadata during shared runs
- update progress.md to mark Phase 2C complete with verification notes
- verified with bun test for provider profiles, ProviderManager, /provider, /model, discovery cache, and provider validation suites
* feat: complete phase 2d runtime provider alignment
Align descriptor-backed runtime provider behavior with the legacy APIProvider surface so active routes, OpenAI shim behavior, and resume handling all resolve through the same metadata path.
Add runtimeMetadata.ts to centralize active route detection, OpenAI shim overrides, and native-format inference. Update provider resolution to map descriptor-backed routes onto legacy provider categories while preserving existing compatibility fallbacks for Foundry, NVIDIA NIM, MiniMax, GitHub, Bedrock, and Vertex.
Move request-shaping rules onto descriptor metadata for DeepSeek, Moonshot, Kimi Code, Gemini, Mistral, GitHub, and local gateways, including reasoning_content preservation, deepseek-compatible thinking payloads, max_tokens field selection, and store field stripping. Treat GitHub Claude native transport as Anthropic-native during conversation recovery so thinking blocks survive resume flows.
Extend focused tests for provider resolution, OpenAI shim request shaping, and conversation recovery, and update phase tracking notes in progress.md to mark 2D complete with verification details.
* feat: complete phase 2e drift audit
Complete the Phase 2E verification and drift-audit packet for the descriptor migration branch.
Add representative provider-summary coverage for descriptor-backed OpenRouter routing plus Gemini and Mistral current-provider summaries in src/commands/provider/provider.test.tsx. Extend ProviderManager coverage with first-run Atomic Chat discovery-backed setup and a regression test proving the set-active picker now uses descriptor-backed provider-type labels.
Replace stale saved-profile picker wording in ProviderManager so saved profiles no longer collapse to a coarse anthropic/openai-compatible split and instead render the route's descriptor-backed provider type label.
Add plan/phase-2e-drift-audit.md documenting the remaining intentional switch sites and non-switch provider branches across provider summaries, active-route detection, OpenAI shim env remapping, auth/header exceptions, and conversation recovery. Update plan/progress.md to mark Phase 2 and 2E complete on-branch, record focused verification, and note the follow-up hardening completed during audit review.
Verification completed during this packet: bun test src/components/ProviderManager.test.tsx src/commands/provider/provider.test.tsx src/utils/providerValidation.test.ts src/integrations/discoveryService.test.ts src/commands/model/model.test.tsx and bun test src/utils/providerDiscovery.test.ts src/utils/model/providers.test.ts src/services/api/openaiShim.test.ts src/utils/conversationRecovery.test.ts. Filtered typecheck output still shows pre-existing baseline noise in src/services/api/openaiShim.ts and src/utils/conversationRecovery.ts only.
* fix: close phase 2 provider parity follow-through
Complete the skipped provider-surface follow-up discovered during the post-Phase-2 review.
- add focused status coverage for NVIDIA NIM and MiniMax sessions
- add Mistral entries to legacy teammate/model compatibility configs
- fill deprecation placeholders for the widened APIProvider surface
- add focused regression tests for status and teammate fallbacks
- update the Phase 2 drift audit and progress tracker with the compatibility-bridge notes and Phase 3 staging context
* phase 3 planning
* refactor: start phase 3a dead-switch cleanup
Begin the Phase 3 cleanup pass with the metadata-only dead-switch removals that are safe to land independently on cheeky-cooking-moon.
Completed work:
- updated plan/progress.md to move Phase 3 and Phase 3A into IN_PROGRESS, added slice-level checklists, and recorded what remains intentionally deferred to later packets
- removed duplicated OpenAI-compatible status-display branches in src/utils/status.tsx by routing openai/codex/nvidia-nim/minimax through shared metadata helpers
- replaced the pure transport-kind label switch in src/integrations/routeMetadata.ts with shared label metadata
- replaced the pure provider-label switch in src/components/CostThresholdDialog.tsx with a shared provider-label map
- added focused regression coverage in src/utils/status.test.ts, src/integrations/routeMetadata.test.ts, and src/components/CostThresholdDialog.test.ts
Verification:
- bun test src/utils/status.test.ts src/utils/swarm/teammateModel.test.ts src/utils/model/providers.test.ts
- bun test src/integrations/routeMetadata.test.ts src/utils/status.test.ts src/components/CostThresholdDialog.test.ts src/utils/model/providers.test.ts
- filtered bun run typecheck for the touched status/routeMetadata/CostThresholdDialog files returned FILTER_CLEAN
* refactor: complete phase 3b and 3c cleanup
Complete the uncommitted Phase 3B compatibility rename work and the Phase 3C env-shaping consolidation on cheeky-cooking-moon.
Phase 3B:
- introduce LegacyAPIProvider while keeping APIProvider as the public compatibility alias
- introduce LegacyProviderModelConfig and LEGACY_PROVIDER_MODEL_CONFIGS while keeping ModelConfig and ALL_MODEL_CONFIGS as compatibility exports
- switch modelStrings, deprecation helpers, and provider profile compatibility naming onto the legacy/compatibility terminology
Phase 3C:
- add shared managed-env clear/apply helpers in providerProfile.ts and route buildLaunchEnv through the shared compatibility env shaper
- route applyProviderProfileToProcessEnv through the same compatibility env shaper so config-backed profiles and startup/session env construction stay aligned
- preserve explicit exception behavior for github, mistral, bedrock, vertex, bankr aliasing, MiniMax fallback detection, and NVIDIA NIM mode markers
- reduce createOpenAIShimClient to the remaining credential alias hydration that resolveProviderRequest does not already cover
- fix applySavedProfileToCurrentSession so saved-profile switching can move away from stale GitHub env selections
- add regression coverage for NVIDIA NIM env stamping and stale Codex-managed env clearing
- update progress.md to mark Phase 3B and 3C complete on branch and record the verification notes
Verification:
- bun test src/utils/model/providers.test.ts src/utils/providerProfiles.test.ts src/utils/swarm/teammateModel.test.ts src/utils/status.test.ts
- bun test src/utils/providerProfile.test.ts src/utils/providerProfiles.test.ts src/services/api/openaiShim.test.ts
- filtered bun run typecheck confirmed no new hits in providerProfile.ts or providerProfiles.ts; remaining openaiShim.ts hits are existing repo baseline debt
* docs: complete phase 3d audit and architecture note
Complete the Phase 3D final audit/documentation packet on cheeky-cooking-moon.
Work completed:
- add plan/phase-3d-final-audit.md with the final post-Phase-3 inventory of remaining provider-specific runtime branches
- classify the remaining exceptions as intentional long-term runtime differences or temporary env/config compatibility bridges
- confirm the audit did not uncover new missed runtime migration work that requires additional Phase 3 code changes
- add docs/architecture/integrations.md to document the descriptor-first architecture, current constraints, known exceptions, and follow-on guidance for future cleanup
- update plan/progress.md to mark Phase 3D complete on branch, mark 3C merged on branch, and point the tracker at Phase 4A next
Key exception categories documented:
- github dual-mode transport behavior
- mistral dedicated route/runtime shaping
- bedrock/vertex/foundry native Anthropic-family paths
- Azure and Bankr request-auth/header differences
- Gemini, DeepSeek, and Moonshot/Kimi OpenAI-shim quirks
- MiniMax dedicated usage handling
- native web-search gating
- env-only MiniMax and NVIDIA NIM compatibility fallbacks
- env/config compatibility bridges such as route detection, --provider shaping, and startup/provider summaries
Notes:
- this packet is branch-local audit/documentation work only; no runtime code paths were changed
- no new tests were required for the audit/doc pass
* docs: stage phase 4 tracker and codex profile guard
Add the Phase 4 documentation/reference-samples plan to progress.md in the same packet/checkpoint structure as earlier phases, and reconcile the Phase 3 tracker summary with the completed cleanup state. Also fix applySavedProfileToCurrentSession so Codex saved-profile activation does not overwrite an already explicit live provider selection, while still clearing stale profile-managed markers when needed.
* docs: complete phase 4a and 4b guides
Expand the integrations architecture note with descriptor authoring, routing-contract, transport-boundary, and compatibility-layer guidance. Add overview and glossary docs under docs/integrations/, plus new how-to guides for adding vendors and gateways with one-file and two-file patterns, discovery cache guidance, token-field guidance, and compatibility follow-through. Update progress.md to mark Phase 4 in progress, Phase 4A complete, and Phase 4B complete with notes about the new docs structure and guide outputs.
* docs: complete phase 4 integration docs
Add the remaining descriptor contributor guides for models, anthropic proxies, and /usage support.
Add a reference sample pack and a common-pitfalls checklist, update the integrations overview, and reconcile plan/progress.md so Phase 4 is marked complete on cheeky-cooking-moon with the current implementation boundaries called out explicitly.
* docs: reconcile tracker waivers and checkpoints
Update plan/progress.md to formally waive the remaining repo-wide typecheck item for Phase 1F as pre-existing debt outside the descriptor migration scope, and mark the Phase 4 branch-local checkpoints as landed on cheeky-cooking-moon with the corresponding commit references.
* Align Z.AI merge fallout with descriptors
Reviewed the upstream main merge against plan/cheeky-cooking-moon.md and removed drift from the old switch/helper-based Z.AI provider path.
Moved Z.AI reasoning, context-window, and max-output metadata into the descriptor route catalog so thinking support can read catalog capabilities instead of URL/model helper checks.
Removed the standalone src/utils/zaiProvider.ts helper and updated startup/provider-discovery labeling to resolve known direct routes through descriptor route metadata.
Simplified --provider handling for Z.AI by letting descriptor defaults provide the base URL and default model through the generic OpenAI-compatible provider branch.
Updated startup and provider-discovery tests for descriptor-backed labels, added Z.AI descriptor-label coverage, and documented the post-main-merge reconciliation in plan/progress.md.
Verification before commit: bun test src/utils/providerFlag.test.ts src/utils/providerProfiles.test.ts src/utils/thinking.test.ts src/components/StartupScreen.test.ts src/utils/providerDiscovery.test.ts; bun test src/integrations/compatibility.test.ts src/integrations/index.test.ts src/integrations/registry.test.ts src/services/api/openaiShim.test.ts; git diff --check.
* fix: restore descriptor migration behavior and isolate provider tests
Restore the descriptor-era Anthropic/OpenAI boundary during conversation recovery by threading the legacy provider category into usesAnthropicNativeMessageFormat instead of relying on ambient env-only route detection.
Harden branch-added provider-facing tests so they do not inherit leaked bun mock.module state from neighboring suites. Status, thinking, teammate fallback, and GitHub model options tests now restore mocks and/or import fresh modules under explicit provider context.
Update bugfix assertions to validate the descriptor-backed openaiShim contract for removeBodyFields/store stripping instead of the pre-refactor inline conditionals.
Validation:
- focused status/thinking/conversationRecovery/bugfix suites pass
- full bun test --max-concurrency=1 is down to the existing conversationArc perf benchmark failure only
- bun run smoke
- bun run build
- npm pack
* fix: close descriptor review drift and provider regressions
Address the follow-up review against plan/cheeky-cooking-moon.md by fixing the remaining runtime drift and locking the behavior with focused coverage.
Completed work:
- make NVIDIA NIM descriptor-backed auth consistent across validation, --provider env shaping, and openaiShim request auth so NVIDIA_API_KEY works without requiring OPENAI_API_KEY
- resolve /usage from the active descriptor route instead of collapsing most OpenAI-compatible providers into the legacy openai bucket
- honor discoveryRefreshMode in /model so manual, on-open, background-if-stale, and startup catalogs no longer behave identically
- clarify docs/progress notes so the branch no longer overstates one-file additive onboarding while loader and preset/UI compatibility surfaces are still manual
Verification:
- bun test src/services/api/openaiShim.test.ts src/utils/providerValidation.test.ts src/utils/providerFlag.test.ts src/utils/model/providers.test.ts src/commands/usage/index.test.ts src/commands/model/model.test.tsx
* docs(plan): require descriptor-native gateway onboarding closure
Investigated the current descriptor onboarding flow and documented the remaining manual choke points in the loader, preset compatibility mapping, provider UI metadata, and handwritten preset typing.
Tighten cheeky-cooking-moon so additive onboarding is a hard requirement, add Phase 3E for descriptor-native onboarding closure, and update the progress tracker to reflect that follow-up work instead of treating the branch as fully complete.
* feat(integrations): close descriptor-native onboarding
Implement the Phase 3E generated-artifact workflow for integration onboarding.
- add integration artifact generation and check scripts
- generate loader inventory, preset manifest, and preset type from descriptors
- move preset participation onto descriptor preset metadata for preset-facing vendors and gateways
- derive compatibility and provider UI metadata from the generated manifest
- remove descriptor-level preset ordering and sort presets by description with standard alphanumeric ordering
- pin the custom preset to the bottom automatically in generated ordering
- add validation for duplicate preset ids and incomplete preset metadata
- add generator tests for representative gateway and direct-vendor onboarding
- refresh ProviderManager tests for generated preset ordering
- update architecture/how-to/reference docs and progress tracking for the new regeneration workflow
* Fix provider profile and discovery drift
Honor route-specific auth env vars across descriptor-backed OpenAI-compatible routes by centralizing credential resolution and using it in validation, bootstrap, discovery, and the OpenAI shim.
Persist Anthropic startup fallbacks as native anthropic profiles and restore them correctly at startup so the legacy startup file stays aligned with the active provider.
Wire discoveryRefreshMode='startup' into startup and provider activation flows, with LM Studio as a live startup-refresh example, and add regression coverage for validation, startup env shaping, discovery refresh, and shim auth handling.
* Pin Anthropic provider preset to the top
Keep the existing custom gateway preset pinned to the bottom while moving the Anthropic preset ahead of the description-sorted remainder.
Regenerate the integration preset manifest/order and extend the artifact generator coverage to lock in both ordering rules.
Validation: bun test src/integrations/artifactGenerator.test.ts src/components/ConsoleOAuthFlow.test.tsx; bun run build
* docs: refresh integration and setup guides
Update the new descriptor-era integration docs so they read as current contributor guidance instead of rollout notes, and align the authoring examples with the actual runtime metadata flow.
Highlights:
- add a CONTRIBUTING.md pointer to the integration overview and focused how-to guides
- remove branch/phase-specific wording from the integration docs
- fix OpenAI-compatible header guidance to use transportConfig.openaiShim headers and custom-header flags
- clarify anthropic proxy onboarding around generated loader support
- refresh advanced setup with current Codex, Gemini, Mistral, and profile-launch details
- fix LiteLLM /provider instructions and clarify local no-auth behavior
- tighten quick-start and non-technical cross-links so users can find the advanced provider docs
* fix: close descriptor integration drift
Apply descriptor-backed static headers to OpenAI-compatible request execution and model discovery, preserving request-specific header precedence.
Allow Gemini profile launch with API key, access-token, or ADC credentials, and align Gemini fallback defaults with the descriptor/docs default model.
Add regression coverage for descriptor header propagation, Gemini defaults, and discovery auth/header behavior.
* post-phase follow-up task added
* Fix xAI merge follow-ups
Route env-only XAI_API_KEY sessions through the OpenAI-compatible shim using descriptor-backed xAI defaults, and map the xAI key into OPENAI_API_KEY for shim auth.
Hydrate legacy profile: xai startup env with xAI descriptor defaults, preserving XAI_API_KEY and OpenAI-compatible launch behavior.
Update progress tracking for post-merge xAI descriptor inventory and clarify that profile-owned custom headers remain open despite adjacent auth/static-header plumbing.
Add regression coverage for env-only xAI client routing, legacy xAI launch env, shell key precedence, and the Gemini/OpenAI client test isolation issue.
* Complete profile custom headers follow-up
Add persisted provider-profile customHeaders support with shared parsing and sanitization for compact Name: value input. Reject malformed and reserved auth/internal headers before saving or applying profile-owned headers.
Expose a descriptor-gated /provider custom headers step, preserve headers during profile edit/update, and apply supported profile headers through ANTHROPIC_CUSTOM_HEADERS for active env and startup fallback profiles.
Propagate profile headers into descriptor discovery refresh and bootstrap model discovery while preserving descriptor/profile/auth merge order. Add focused regression coverage and mark the progress tracker packet complete.
* Allow api-key custom provider headers
Permit api-key in /provider custom header input and preserve it when OpenAI-compatible shim requests are built. This is intentional for gateway providers that require an api-key header in addition to, or instead of, standard bearer auth.
Keep managed credential headers protected by continuing to reject/strip authorization and x-api-key, plus Anthropic/Claude-owned headers. Add parser, profile env, and outgoing request coverage for the intended behavior.
* fix: restore API mode picker for OpenAI-compatible profiles
Use descriptor transport metadata instead of the legacy provider id when deciding whether provider profiles support OpenAI-compatible options. This restores the Chat Completions vs Responses picker for the Custom OpenAI-compatible preset after it moved to the descriptor-backed custom route.
Preserve apiFormat and custom auth header profile fields for all routes whose transportConfig.kind is openai-compatible, so selecting Responses is saved and applied as OPENAI_API_FORMAT=responses.
Tests: bun test src/components/ProviderManager.test.tsx; bun test src/utils/providerProfiles.test.ts; bun run build; bun run smoke
* fix: respect explicit provider routing with xAI env
Ensure env-only XAI_API_KEY fallback does not take over when Bedrock, Vertex, or Foundry has been explicitly selected. This preserves native transport routing while still allowing bare xAI env setup to use the OpenAI-compatible shim.
Restore api-key to the managed custom-header blocklist now that /provider exposes the API mode/auth-header controls for OpenAI-compatible profiles. The shim and provider override paths strip api-key again, while OPENAI_AUTH_HEADER=api-key remains available for explicit auth configuration.
Tests: bun test src/services/api/client.test.ts src/utils/providerCustomHeaders.test.ts src/utils/providerProfiles.test.ts src/services/api/openaiShim.test.ts; bun run build; bun run integrations:check; bun run smoke
* docs: fix integration drift
Align integration and setup docs with the current implementation.
- show model descriptor examples as array default exports, matching the generated MODEL_DESCRIPTOR_GROUPS loader contract
- document provider-scoped model env vars instead of implying OPENAI_MODEL globally overrides ANTHROPIC_MODEL
- clarify generated provider preset ordering: anthropic first, custom last, description-sorted middle entries
- update LiteLLM examples and /provider guidance to use the /v1 OpenAI-compatible base URL
Verification: bun run integrations:check
* Fix provider discovery cache isolation
* Stabilize provider env tests
* Stabilize provider test isolation
Completed work:
- Isolated GitHub model option tests from cached availableModels settings.
- Isolated startup discovery tests from live process.env provider flag races.
- Mocked teammate provider fallback tests at the provider helper boundary.
- Moved cost threshold provider labels into a pure helper for deterministic tests while preserving runtime active-provider behavior.
Validation:
- bun test src/components/CostThresholdDialog.test.ts src/integrations/discoveryService.test.ts src/utils/model src/utils/swarm
- bun run build
- bun run smoke
* test: isolate startup screen model settings
Clear the session settings cache and persisted global model around StartupScreen provider-detection tests.
This prevents earlier provider/model suites from leaking saved non-Anthropic models into the default Anthropic startup assertions.
Verified with: bun test src/components/StartupScreen.test.ts src/integrations/discoveryService.test.ts src/utils/model/modelOptions.github.test.ts
Full bun test now only fails the unrelated Conversation Arc sub-millisecond performance benchmark.
* test: isolate route discovery and github model options
Restore Bun module mocks around discoveryService tests before loading fresh route-discovery modules.
Pin the GitHub model-options test to a complete providers.js mock so cached provider mocks from other suites cannot hide Copilot options.
Verified with: bun test src/integrations/discoveryService.test.ts src/utils/model/modelOptions.github.test.ts
Also ran full bun test; only the unrelated Conversation Arc sub-millisecond performance benchmark fails locally.
* test: avoid startup discovery cache collision
Use the 127.0.0.1 LM Studio alias in refreshStartupDiscoveryForActiveRoute so it still resolves the active route from env but does not share the cache partition with the preceding startup refresh test.
This keeps the assertion on network refresh stable under Bun 1.3.11 serialized runs.
Verified with: bun test --max-concurrency=1 src/integrations/discoveryService.test.ts src/utils/model/modelOptions.github.test.ts
Also ran full bun test --max-concurrency=1; only the unrelated Conversation Arc perf benchmark fails locally.
* fix: isolate OpenAI-compatible route credentials
Restrict OpenAI-compatible shim auth to provider overrides, resolved route credentials, or explicit OPENAI_API_KEY instead of ambient provider-specific secrets.
Remove NVIDIA and Bankr compatibility fallbacks that could promote provider-specific API keys into unrelated OpenAI-compatible routes. Preserve Bankr base URL/model compatibility before route credential resolution so Bankr still resolves through descriptor credentials.
Clear stale NVIDIA_NIM and copied OPENAI_API_KEY values when switching away from NVIDIA NIM, Bankr, or xAI provider flags to avoid carrying provider secrets across route boundaries.
Add regressions for stale NVIDIA, MiniMax, and Bankr keys not leaking into OpenRouter-style routes, plus provider-flag cleanup for copied NVIDIA/Bankr/xAI keys.
Validation: bun test src/services/api/openaiShim.test.ts; bun test src/utils/providerFlag.test.ts; bun run build; bun run smoke.
* fix: guard model discovery privacy paths
Suppress descriptor and legacy model discovery while essential-only traffic mode is active.
Use the partitioned discovery cache key for /model cache reads, stale checks, and manual refresh clears, including route-specific credentials and custom headers.
Partition legacy local OpenAI additional model caches by credentials and routing headers to avoid catalog reuse across profiles.
Add coverage for OpenRouter route credentials, descriptor privacy suppression, legacy discovery privacy suppression, and local cache scope partitioning.
* Fix artifact checks and knowledge graph persistence
Normalize generated integration artifact comparisons so Windows line endings do not make checked-in artifacts appear stale.
Skip knowledge graph entity persistence when re-adding an existing entity with identical attributes, avoiding repeated disk writes during automatic fact extraction and restoring the conversation arc performance benchmark.
Verified with bun test src/integrations/artifactGenerator.test.ts --max-concurrency=1, bun test src/utils/conversationArc.perf.test.ts --max-concurrency=1, and bun test --max-concurrency=1.
* test: isolate privacy discovery cache path
The descriptor discovery privacy test could observe stale OpenRouter cache data populated by an earlier test and receive source=stale-cache instead of static. Use a test-specific API key so the privacy assertion gets its own discovery cache partition while still verifying that nonessential traffic disables network discovery.
Verified with bun test src/integrations/discoveryService.test.ts --max-concurrency=1 and bun test --max-concurrency=1.
* test: accept cached privacy discovery result
* test: set privacy gate before discovery import
* test: prevent discovery privacy mock bleed
Guard descriptor model discovery directly on CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC so nonessential traffic stays disabled even if the privacyLevel module is mocked in-process.
Reduce broad fastMode test mocks for shared modules and use real state/config test hooks, preventing Bun module mock namespaces from leaking into discovery and /model tests.
Verified with bun test src/utils/fastMode.test.ts src/utils/model/openaiModelDiscovery.test.ts src/integrations/discoveryService.test.ts src/commands/model/model.test.tsx --max-concurrency=1 and bun test --max-concurrency=1.
* test: prevent discovery privacy mock bleed
Add an env-level fallback guard to descriptor model discovery so disabled nonessential traffic cannot be bypassed by stale mocked privacy helpers.
Tighten the fastMode regression tests by setting real bootstrap/config state only after the tested module is imported, avoiding broad module mocks that can leak into unrelated discovery tests or behave differently under Bun in CI.
Verified with focused discovery/fastMode/model suites and the full serial bun test suite.
* fix: harden fast mode test isolation
Ignore non-string GrowthBook values when resolving the fast mode unavailable reason so boolean flag payloads cannot surface as false.
Make the affected regression tests install explicit provider mocks for their own scenarios and reset env state, preventing stale provider mocks from changing fastMode and conversation recovery behavior across the serial Bun test run.
* test: harden fast mode module mocks
Expand the fastMode GrowthBook and provider test mocks so later imports in the same Bun test process can resolve the named exports they expect. This prevents order-sensitive failures when model command tests run after fast mode tests.\n\nVerified with: bun test --max-concurrency=1
* feat: consolidate integration runtime metadata
Move OpenAI-compatible model runtime limits into descriptor-backed brand and model metadata, adding Gemini, GLM, MiniMax, Mistral, Nemotron, xAI, and OpenAI-compatible alias descriptor groups. Update generated integration artifacts, route catalog option handling, thinking capability lookup, and docs to use modelDescriptorId-backed runtime metadata.
Split OpenAI shim capability flags into supportsApiFormatSelection and supportsAuthHeaders, and update provider profile sanitization, ProviderManager forms, descriptor validation, and integration authoring docs so fixed routes do not preserve unsupported API format or auth-header settings.
Harden env-only MiniMax and xAI routing. Resolve shared route intent before client setup, reject conflicting OpenAI base URLs, preserve provider-specific base overrides, sanitize stale OpenAI shim knobs, copy provider credentials intentionally, and keep legacy provider labels, context windows, max output limits, model lists, and provider switching aligned.
Refresh MiniMax defaults and catalog entries, add descriptor-backed runtime limits for migrated models, preserve external OpenAI limit overrides, and add regression coverage for env-only MiniMax/xAI, provider-profile capability stripping, route catalog options, copied credential cleanup, and context/runtime limit detection.
Verification performed: bun test src/utils/providerFlag.test.ts; bun test src/services/api/client.test.ts src/utils/model/providers.test.ts src/integrations/routeMetadata.test.ts; bun test src/utils/context.test.ts src/utils/thinking.test.ts src/services/compact/autoCompact.test.ts; bun test src/integrations/routeMetadata.test.ts src/services/api/client.test.ts src/utils/model/providers.test.ts src/utils/providerValidation.test.ts src/integrations/index.test.ts src/utils/status.test.ts; bun run build; bun run smoke.
* test: isolate provider env in conversation recovery
Snapshot and restore all provider-selection environment variables used by the GitHub native Claude resume test instead of only restoring the GitHub flag and OPENAI_MODEL.
The full single-concurrency suite exposed that earlier tests can leave higher-priority provider flags in process.env, causing deserializeMessages to resolve a non-GitHub provider and strip thinking blocks even though the test intended to exercise GitHub native Claude transport.
The test now clears provider routing env before setting CLAUDE_CODE_USE_GITHUB=1 and OPENAI_MODEL=claude-sonnet-4-6, then restores the original env values in afterEach.
Verification: bun test src/utils/conversationRecovery.test.ts; bun test --max-concurrency=1.
* test: isolate conversation recovery provider state
* test: pin conversation recovery provider mock
* test: isolate knowledge graph persistence
* fix: make knowledge graph reset synchronous
* test: restore integration registry after unit tests
* remove plans dir
* delete plans
* Fix provider routing test failures
Restore the missing first-party Anthropic auth routing imports used by getAnthropicClient so OpenAI-compatible provider client creation no longer throws at runtime.
Keep GitHub provider resolution from inheriting OPENAI_API_FORMAT=responses so GitHub GPT-4 and gpt-5-mini models continue to use chat completions while Codex-flavored models still route to responses.
Reset OPENAI_API_FORMAT in the affected API provider tests to prevent environment leakage across serial Bun test runs.
Verified with: bun test --max-concurrency=1
* fix: restore provider-specific model routing
Resolve generic OpenAI-compatible profiles by their known descriptor base URLs so saved MiniMax, xAI, NVIDIA NIM, OpenRouter, and DeepSeek profiles use the correct route catalogs instead of the generic OpenAI model list.
Fix MiniMax defaults and display handling so provider-specific model IDs are not rendered as Claude Opus defaults, add current MiniMax M2.7 options, and cover the regressions with focused route/model tests.
Also clean up descriptor follow-ups from review: remove the dead OpenAI shim store-strip fallback list, preserve gateway vendor IDs for Bedrock/Vertex/GitHub profile resolution, and keep the ModelPicker compiled-form changes in this PR.
* test: cover provider precedence review fixes
Remove import-time ANTHROPIC_BASE_URL and ANTHROPIC_MODEL reads from the Anthropic descriptor so descriptor defaults stay static and live env handling remains in preset metadata.
Add getAPIProvider precedence coverage documenting that explicit Gemini/OpenAI flags beat env-only MiniMax API key inference.
Add a regression check to keep the removed openaiShim hardcoded descriptor route fallback list from returning.
---------
Co-authored-by: TechBrewBoss <dash@hicap.ai>
|
||
|
|
6dedffe5ff |
Add OpenAI responses mode and custom auth headers (#906)
* Add OpenAI profile responses and custom auth header support * Fix knowledge graph config reference in query loop * Address OpenAI profile review edge cases * Remove unused getGlobalConfig import Delete an unused import of getGlobalConfig from src/query.ts. This cleans up dead code and avoids unused-import lint warnings; no functional behavior changes. * Address follow-up OpenAI profile review comments * Refine OpenAI responses auth review fixes * Fix custom auth header default scheme |
||
|
|
a0d657ee18 |
feat(zai): add Z.AI GLM Coding Plan provider preset (#896)
* feat(zai): add Z.AI GLM Coding Plan provider preset Add dedicated Z.AI provider support for the GLM Coding Plan, enabling use of GLM-5.1, GLM-5-Turbo, GLM-4.7, and GLM-4.5-Air models through the OpenAI-compatible shim with proper thinking mode (reasoning_content), max_tokens handling, and context window sizing. * fix(zai): unify GLM max output token limits across casing variants glm-5/glm-4.7 had conservative 16K max output while GLM-5/GLM-4.7 had 131K. Use consistent Z.AI coding plan limits for all GLM variants. * fix(zai): restore DashScope GLM limits, enable GLM thinking support - Restore lowercase glm-5/glm-4.7 to 16_384 max output (DashScope limits) while keeping Z.AI coding plan high limits on uppercase GLM-* keys only - Add GLM model support to modelSupportsThinking() so reasoning_content is enabled when using GLM-5.x/GLM-4.7 models on Z.AI * fix(zai): tighten GLM regexes, fix misleading context window comment - Use precise regex in thinking.ts: exact GLM model matches only, no false positives on glm-50/glm-4, includes glm-4.5-air - Use uppercase-only match in StartupScreen rawModel fallback so DashScope lowercase glm-* models aren't mislabeled as Z.AI - Clarify context window comment: lowercase glm-5.1/glm-5-turbo/ glm-4.5-air are Z.AI-specific aliases, not DashScope * fix(zai): scope GLM detection to Z.AI * improve readability of max_completion_tokens check Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> |
||
|
|
9e23c2bec4 |
feat(api): expose cache metrics in REPL + normalize across providers (#813)
* feat(api): expose cache metrics in REPL + /cache-stats command * fix(api): normalize Kimi/DeepSeek/Gemini cache fields through shim layer * test(api): cover /cache-stats rendering + fix CacheMetrics docstring drift * fix(api): always reset cache turn counter + include date in /cache-stats rows * refactor(api): unify shim usage builder + add cost-tracker wiring test * fix(api): classify private-IP/self-hosted OpenAI endpoints as N/A instead of cold * fix(api): require colon guard on IPv6 ULA prefix to avoid public-host over-match * perf(api): ring buffer for cache history + hit rate clamp + .localhost TLD * fix(api): null guards on formatters + document Codex Responses API shape * fix(api): defensive start-of-turn reset + config gate fallback + env var docs * fix(api): trust forwarded cache data on self-hosted URLs (data-driven) * refactor(api): delegate streaming Responses usage to shared makeUsage helper |
||
|
|
ff2a380723 |
Add DeepSeek V4 flash/pro support and DeepSeek thinking compatibility (#877)
* Add DeepSeek V4 support and thinking compatibility * Fix DeepSeek profile persistence regression * Align multi-model handling with openai-multi-model |
||
|
|
b750e9e97d |
fix: make OpenAI fallback context window configurable + support external model lookup (#861)
* fix: make OpenAI fallback context window configurable and support external lookup table Unknown OpenAI-compatible models fell back to a hardcoded 128k constant, causing auto-compact to fire prematurely on models with larger windows (issue #635 follow-up). Two escape hatches are added without touching the built-in table: - CLAUDE_CODE_OPENAI_FALLBACK_CONTEXT_WINDOW (number): overrides the 128k default for all unknown models. - CLAUDE_CODE_OPENAI_CONTEXT_WINDOWS (JSON object): per-model overrides that take precedence over the built-in OPENAI_CONTEXT_WINDOWS table; supports the same provider-qualified and prefix-matching lookup as the built-in path. - CLAUDE_CODE_OPENAI_MAX_OUTPUT_TOKENS (JSON object): same pattern for output token limits. This lets operators deploy new or private models without patching openaiContextWindows.ts on every model release. * docs: add new OpenAI context window env vars to .env.example Document CLAUDE_CODE_OPENAI_FALLBACK_CONTEXT_WINDOW, CLAUDE_CODE_OPENAI_CONTEXT_WINDOWS, and CLAUDE_CODE_OPENAI_MAX_OUTPUT_TOKENS with usage examples. Addresses reviewer feedback on PR #861. --------- Co-authored-by: opencode <dev@example.com> |
||
|
|
28de94df5d |
feat: add OPENCLAUDE_DISABLE_TOOL_REMINDERS env var to suppress hidden tool-output reminders (#837)
Gates three injection sites behind OPENCLAUDE_DISABLE_TOOL_REMINDERS: - FileReadTool cyber-risk mitigation reminder (appended to every Read result when the model is not in MITIGATION_EXEMPT_MODELS) - todo_reminder attachment for TodoWrite usage - task_reminder attachment for TaskCreate/TaskUpdate usage All three reminders are model-only side-channel instructions the user cannot see today. Users who want full transparency over what the model receives can now opt out without patching dist/cli.mjs on every upgrade. Default behavior is unchanged when the flag is unset. Closes #809 |
||
|
|
4d559c9135 |
docs(env): document OPENCLAUDE_DISABLE_STRICT_TOOLS in .env.example (#826)
Code support was merged in #770 but the .env.example entry was missed, leaving users without a discoverable way to find the flag. Closes #737 |
||
|
|
51191d6132 |
feat: add NVIDIA NIM and MiniMax provider support (#552)
* feat: add NVIDIA NIM and MiniMax provider support - Add nvidia-nim and minimax to --provider CLI flag - Add model discovery for NVIDIA NIM (160+ models) and MiniMax - Update /model picker to show provider-specific models - Fix provider detection in startup banner - Update .env.example with new provider options Supported providers: - NVIDIA NIM: https://integrate.api.nvidia.com/v1 - MiniMax: https://api.minimax.io/v1 * fix: resolve conflict in StartupScreen (keep NVIDIA/MiniMax + add Codex detection) * fix: resolve providerProfile conflict (add imports from main, keep NVIDIA/MiniMax) * fix: revert providerSecrets to match main (NVIDIA/MiniMax handled elsewhere) * fix: add context window entries for NVIDIA NIM and new MiniMax models * fix: use GLM-5 as NVIDIA NIM default and MiniMax-M2.5 for consistency * fix: address remaining review items - add GLM/Kimi context entries, max output tokens, fix .env.example, revert to Nemotron default * fix: filter NVIDIA NIM picker to chat/instruct models only, set provider-specific API keys from saved profiles * chore: add more NVIDIA NIM context window entries for popular models * fix: address remaining non-blocking items - fix base model, clear provider API keys on profile switch |
||
|
|
4ad6bc50c1 |
refactor: provider adapter system + 7 new search providers (bug-fixed) (#512)
* refactor: provider adapter system + 7 new search providers Architecture: - Each search backend is a small adapter implementing SearchProvider - 12 providers: custom, tavily, exa, you, jina, bing, mojeek, linkup, firecrawl, duckduckgo + native - WEB_SEARCH_PROVIDER controls selection: auto (fallback chain) or specific provider - Auth always in headers, never in query strings Bug fixes from review feedback: - Fix applyDomainFilters catch block: keep hits with malformed URLs on blocked_domains (can't confirm blocked), drop on allowed_domains (can't confirm allowed) - Add safeHostname() helper: safely extract hostname from URLs without throwing - Replace unsafe new URL(r.url).hostname in 7 providers with safeHostname() - Remove dead code: buildAllHeaders, buildAuthHeaders, parseExtraHeaders from types.ts - Fix WEB_PARMS typo: consistently use WEB_QUERY_PARAM everywhere - AbortSignal forwarded to fetch() in all 12 providers - DuckDuckGo: wrap dynamic import in try/catch for graceful error - Exa: remove double domain filtering (server-side already) - runSearch(): aggregate all provider errors instead of throwing only the last one - Retry logic: check numeric status code directly, retry 5xx/network, skip 4xx Test coverage (44 tests, all passing): - types.test.ts: safeHostname, normalizeHit, applyDomainFilters (20 tests) - index.test.ts: getProviderMode, getProviderChain, getAvailableProviders (13 tests) - custom.test.ts: extractHits flexible response parsing (11 tests) Co-authored-by: FluxLuFFy <195792511+FluxLuFFy@users.noreply.github.com> * security: add guardrails to custom search provider (Option B) - HTTPS-only by default (opt-out: WEB_CUSTOM_ALLOW_HTTP=true) - Private/localhost IPs blocked by default (opt-out: WEB_CUSTOM_ALLOW_PRIVATE=true) - Header allowlist: only known-safe headers allowed unless WEB_CUSTOM_ALLOW_ARBITRARY_HEADERS=true - Configurable timeout in seconds (WEB_CUSTOM_TIMEOUT_SEC, default 15) - Configurable POST body limit (WEB_CUSTOM_MAX_BODY_KB, default 300) - Removed max URL size restriction - Audit log warning on first custom search call - Updated .env.example and README_SEARCH_PROVIDERS.md with all new options * fix: remove custom provider from auto chain (Option 1) Remove customProvider from the auto fallback chain so it is only available when WEB_SEARCH_PROVIDER=custom is explicitly selected. Changes: - Remove customProvider from ALL_PROVIDERS array in providers/index.ts - Add 3 new tests verifying custom is excluded from auto chain - Update README_SEARCH_PROVIDERS.md: auto priority, mode table, note - Update .env.example: auto priority comment, custom mode annotation All 47 tests pass (44 existing + 3 new). Co-Authored-By: @Vasanthdev2004 * fix: address review blockers (routing, abort, config check, domain matching) 1. Native/Codex routing precedence in auto mode shouldUseAdapterProvider() now checks if native/first-party/vertex/foundry or Codex paths are available before falling back to adapter providers. Auto mode: native paths take precedence; adapter is fallback only. 2. AbortError stops provider chain immediately runSearch() now checks for AbortError/aborted signal before continuing the fallback chain. Cancelled searches don't create extra outbound requests. 3. Explicit provider mode fails fast on missing credentials runSearch() validates isConfigured() for explicit modes before attempting requests. Throws clear error: 'Search provider "X" is not configured.' 4. Domain filter exact-or-subdomain matching (fixes suffix collision) New hostMatchesDomain() helper: exact match or .subdomain match. badexample.com no longer matches example.com. 5. Tests: 56 pass (9 new) covering all 4 fixes Co-Authored-By: @Vasanthdev2004 --------- Co-authored-by: Claude Fix <fix@openclaude.local> Co-authored-by: FluxLuFFy <195792511+FluxLuFFy@users.noreply.github.com> Co-authored-by: bot <bot@openclaw.ai> |
||
|
|
0fd0026a76 |
feat: (Extension of #175) added cross-platform system-wide environment variable setup guide for all providers (#185)
* added Instructions to env example to allow openclaude to be used system wide * added suggested .env.example changes I added the suggested .env.example changes suggested earlier within the pr thread |
||
|
|
7095abb837 |
feat: add .env.example with all provider configurations
New contributors had to hunt through README and source files to find required environment variables. This adds a single reference file at repo root covering all supported providers with placeholder values, inline comments, and sensible defaults. Providers covered: - Anthropic (default) - OpenAI - Google Gemini - GitHub Models - Ollama (local) - AWS Bedrock - Google Vertex AI Also includes optional tuning vars: CLAUDE_CODE_MAX_RETRIES, CLAUDE_CODE_UNATTENDED_RETRY, OPENCLAUDE_ENABLE_EXTENDED_KEYS, OPENCLAUDE_DISABLE_CO_AUTHORED_BY, API_TIMEOUT_MS, CLAUDE_DEBUG. Updated .gitignore to add !.env.example exception so the template is not suppressed by the existing .env.* rule. Closes #175 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |