diff options
| author | Adam Malczewski <[email protected]> | 2026-05-24 13:24:04 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-05-24 13:24:04 +0900 |
| commit | 399e1509b93b9f3c56142f94b8fb2c30c2dedb2f (patch) | |
| tree | d67f18f5cca91a66e3146cbd2f48920571768e23 /packages/frontend/src/lib/components/KeyUsage.svelte | |
| parent | 997b00034435440d412f955e05e53f09bae83f9e (diff) | |
| download | dispatch-399e1509b93b9f3c56142f94b8fb2c30c2dedb2f.tar.gz dispatch-399e1509b93b9f3c56142f94b8fb2c30c2dedb2f.zip | |
fix: prompt caching, OpenCode Go MiniMax/Qwen support, Opus 4.7 thinking, SDK compat
- Implement Anthropic prompt caching: first system message + last 2 non-system messages get cache_control: ephemeral, mirroring OpenCode's applyCaching strategy. Move system prompt inline into messages array so providerOptions can attach.
- Add opencode-anthropic provider variant routing MiniMax/Qwen models through the /messages endpoint with x-api-key auth, distinct from the Claude OAuth flow's Bearer auth and Claude Code mimicry.
- Split isAnthropic into isClaudeOAuth (billing header, mcp_ tool prefix, thinking config) and usesAnthropicSDK (cache markers) so non-OAuth Anthropic-format gateways get the right treatment.
- Pin @ai-sdk/anthropic to ^1.2.12: v3 returns LanguageModelV3-spec models that ai v4's streamText rejects at runtime ('AI SDK 4 only supports models that implement specification version v1'). Drop unnecessary V1 casts.
- Restore Opus 4.7 extended thinking by rewriting the outgoing /messages body in the Claude OAuth fetch interceptor: inject thinking: { type: 'adaptive' } (v1 SDK can't emit it), strip temperature/top_p/top_k (Anthropic rejects them with thinking enabled). Gated on max_tokens > 4096 so effort=none still works.
- Bump MAX_STEPS from 10 to 50 to align with AI SDK's stepCountIs(20) default and reduce mid-task halts.
- Fix pre-existing typecheck errors in agent-manager.ts (entry/nextEntry narrowing), app.ts (agentModels body field), KeyUsage.svelte (m guards), and a TS2742 in provider.ts via explicit ModelFactory return type.
- buildFallbackSequence now always returns at least one entry so processMessage runs the agent loop even without keyId/modelId (fixes 4 broken agent-manager tests).
Diffstat (limited to 'packages/frontend/src/lib/components/KeyUsage.svelte')
| -rw-r--r-- | packages/frontend/src/lib/components/KeyUsage.svelte | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/packages/frontend/src/lib/components/KeyUsage.svelte b/packages/frontend/src/lib/components/KeyUsage.svelte index 96a4b08..00d179e 100644 --- a/packages/frontend/src/lib/components/KeyUsage.svelte +++ b/packages/frontend/src/lib/components/KeyUsage.svelte @@ -440,13 +440,13 @@ function hasBucketData(bucket: UsageBucket | undefined): boolean { <span class="text-xs text-base-content/50">Models</span> <span class="text-xs font-mono">{entry.data.models.length} available</span> </div> - {#if m.rpm > 0} + {#if m && m.rpm > 0} <div class="flex items-center justify-between"> <span class="text-xs text-base-content/50">RPM</span> <span class="text-xs font-mono">{m.rpm}</span> </div> {/if} - {#if m.requestsPerDay > 0} + {#if m && m.requestsPerDay > 0} <div class="flex items-center justify-between"> <span class="text-xs text-base-content/50">RPD</span> <span class="text-xs font-mono">{m.requestsPerDay.toLocaleString()}</span> |
