GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — chore: sync 11 low-risk upstream provider/reliability fixes from anom… · Draugur-AI/opencode@cd0bd27

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • bun.lock
  • package.json
  • packages
    • core/test
      • provider-groq.test.ts
      • provider-mistral.test.ts
      • provider-xai-responses.test.ts
    • opencode
      • src
        • plugin/github-copilot
          • models.ts
        • provider
          • transform.ts
        • session
          • retry.ts
          • system.ts
      • test
        • plugin
          • github-copilot-models.test.ts
        • provider
          • provider.test.ts
          • transform.test.ts
        • session
          • retry.test.ts
          • system.test.ts
    • ui/src/theme/themes
      • oc-2.json
    • web/src/content/docs
      • ecosystem.mdx
      • github.mdx
      • providers.mdx
  • patches
    • @ai-sdk%[email protected]
    • @ai-sdk%[email protected]
    • @ai-sdk%[email protected]
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎bun.lock‎

Copy file name to clipboardExpand all lines: bun.lock
+1Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎package.json‎

Copy file name to clipboardExpand all lines: package.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@
159159
"@modelcontextprotocol/[email protected]": "patches/@modelcontextprotocol%[email protected]",
160160
"[email protected]": "patches/[email protected]",
161161
"@tanstack/[email protected]": "patches/@tanstack%[email protected]",
162-
"@ai-sdk/[email protected]": "patches/@ai-sdk%[email protected]"
162+
"@ai-sdk/[email protected]": "patches/@ai-sdk%[email protected]",
163+
"@ai-sdk/[email protected]": "patches/@ai-sdk%[email protected]"
163164
}
164165
}
Collapse file

‎packages/core/test/provider-groq.test.ts‎

Copy file name to clipboard
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { createGroq } from "@ai-sdk/groq"
2+
import { expect, test } from "bun:test"
3+
4+
test("Groq passes through unknown reasoning effort", async () => {
5+
let body: Record<string, unknown> | undefined
6+
const mockFetch = Object.assign(
7+
async (_input: Parameters<typeof fetch>[0], init?: RequestInit) => {
8+
body = JSON.parse(String(init?.body))
9+
return Response.json({
10+
id: "response-1",
11+
created: 0,
12+
model: "openai/gpt-oss-120b",
13+
object: "chat.completion",
14+
choices: [{ index: 0, message: { role: "assistant", content: "Hello" }, finish_reason: "stop" }],
15+
usage: { prompt_tokens: 1, completion_tokens: 1, total_tokens: 2 },
16+
})
17+
},
18+
{ preconnect: fetch.preconnect },
19+
)
20+
const model = createGroq({ apiKey: "test", fetch: mockFetch })("openai/gpt-oss-120b")
21+
22+
await model.doGenerate({
23+
prompt: [{ role: "user", content: [{ type: "text", text: "Hello" }] }],
24+
providerOptions: { groq: { reasoningEffort: "custom" } },
25+
})
26+
27+
expect(body?.reasoning_effort).toBe("custom")
28+
})
Collapse file

‎packages/core/test/provider-mistral.test.ts‎

Copy file name to clipboardExpand all lines: packages/core/test/provider-mistral.test.ts
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,32 @@ test("Mistral sends promptCacheKey as prompt_cache_key", async () => {
2727
expect(body?.prompt_cache_key).toBe("session-123")
2828
})
2929

30+
test("Mistral passes through unknown reasoning effort", async () => {
31+
let body: Record<string, unknown> | undefined
32+
const mockFetch = Object.assign(
33+
async (_input: Parameters<typeof fetch>[0], init?: RequestInit) => {
34+
body = JSON.parse(String(init?.body))
35+
return Response.json({
36+
id: "response-1",
37+
created: 0,
38+
model: "mistral-large-latest",
39+
object: "chat.completion",
40+
choices: [{ index: 0, message: { role: "assistant", content: "Hello" }, finish_reason: "stop" }],
41+
usage: { prompt_tokens: 1, completion_tokens: 1, total_tokens: 2 },
42+
})
43+
},
44+
{ preconnect: fetch.preconnect },
45+
)
46+
const model = createMistral({ apiKey: "test", fetch: mockFetch })("mistral-large-latest")
47+
48+
await model.doGenerate({
49+
prompt: [{ role: "user", content: [{ type: "text", text: "Hello" }] }],
50+
providerOptions: { mistral: { reasoningEffort: "custom" } },
51+
})
52+
53+
expect(body?.reasoning_effort).toBe("custom")
54+
})
55+
3056
test("Mistral round-trips native reasoning in assistant history", async () => {
3157
let body: { messages?: unknown[] } | undefined
3258
const mockFetch = Object.assign(
Collapse file

‎packages/core/test/provider-xai-responses.test.ts‎

Copy file name to clipboardExpand all lines: packages/core/test/provider-xai-responses.test.ts
+53Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,56 @@ test("xAI Responses sends promptCacheKey as prompt_cache_key", async () => {
3030

3131
expect(body?.prompt_cache_key).toBe("session-123")
3232
})
33+
34+
test("xAI Responses passes through xhigh reasoning effort", async () => {
35+
let body: Record<string, unknown> | undefined
36+
const mockFetch = Object.assign(
37+
async (_input: Parameters<typeof fetch>[0], init?: RequestInit) => {
38+
body = JSON.parse(String(init?.body))
39+
return Response.json({
40+
id: "response-1",
41+
created_at: 0,
42+
model: "grok-4",
43+
object: "response",
44+
output: [],
45+
usage: { input_tokens: 1, output_tokens: 0 },
46+
status: "completed",
47+
})
48+
},
49+
{ preconnect: fetch.preconnect },
50+
)
51+
const model = createXai({ apiKey: "test", fetch: mockFetch }).responses("grok-4")
52+
53+
await model.doGenerate({
54+
prompt: [{ role: "user", content: [{ type: "text", text: "Hello" }] }],
55+
providerOptions: { xai: { reasoningEffort: "xhigh" } },
56+
})
57+
58+
expect(body?.reasoning).toEqual({ effort: "xhigh" })
59+
})
60+
61+
test("xAI Chat passes through xhigh reasoning effort", async () => {
62+
let body: Record<string, unknown> | undefined
63+
const mockFetch = Object.assign(
64+
async (_input: Parameters<typeof fetch>[0], init?: RequestInit) => {
65+
body = JSON.parse(String(init?.body))
66+
return Response.json({
67+
id: "chat-1",
68+
created: 0,
69+
model: "grok-4",
70+
object: "chat.completion",
71+
choices: [{ index: 0, message: { role: "assistant", content: "Hello" }, finish_reason: "stop" }],
72+
usage: { prompt_tokens: 1, completion_tokens: 1, total_tokens: 2 },
73+
})
74+
},
75+
{ preconnect: fetch.preconnect },
76+
)
77+
const model = createXai({ apiKey: "test", fetch: mockFetch }).chat("grok-4")
78+
79+
await model.doGenerate({
80+
prompt: [{ role: "user", content: [{ type: "text", text: "Hello" }] }],
81+
providerOptions: { xai: { reasoningEffort: "xhigh" } },
82+
})
83+
84+
expect(body?.reasoning_effort).toBe("xhigh")
85+
})
Collapse file

‎packages/opencode/src/plugin/github-copilot/models.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/plugin/github-copilot/models.ts
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ function build(key: string, remote: SelectableItem, url: string, prev?: Model):
8888
const image =
8989
(remote.capabilities.supports.vision ?? false) ||
9090
(remote.capabilities.limits.vision?.supported_media_types ?? []).some((item) => item.startsWith("image/"))
91+
const pdf =
92+
(remote.capabilities.supports.vision ?? false) &&
93+
(remote.capabilities.limits.vision?.supported_media_types?.includes("application/pdf") ?? false)
9194

9295
const isMsgApi = remote.supported_endpoints?.includes("/v1/messages")
9396
const endpoint: CopilotEndpoint | undefined = isMsgApi
@@ -127,7 +130,7 @@ function build(key: string, remote: SelectableItem, url: string, prev?: Model):
127130
audio: false,
128131
image,
129132
video: false,
130-
pdf: false,
133+
pdf,
131134
},
132135
output: {
133136
text: true,
Collapse file

‎packages/opencode/src/provider/transform.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/provider/transform.ts
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ function sdkKey(npm: string): string | undefined {
8484
return "gateway"
8585
case "@openrouter/ai-sdk-provider":
8686
return "openrouter"
87+
case "merge-gateway-ai-sdk-provider":
88+
return "mergeGateway"
8789
case "ai-gateway-provider":
8890
// ai-gateway-provider/unified wraps createOpenAICompatible({ name: "Unified" }),
8991
// and @ai-sdk/openai-compatible parses compatibleOptions from one of
@@ -551,6 +553,12 @@ export function topP(model: Provider.Model) {
551553
if (["minimax-m2", "kimi-k2.5", "kimi-k2p5", "kimi-k2-5"].some((s) => id.includes(s))) {
552554
return 0.95
553555
}
556+
if (
557+
["deepseek-v4-flash-0731", "deepseek-v4-flash:0731"].some((name) => id.includes(name)) ||
558+
(id.includes("deepseek-v4-flash") && (model.providerID === "deepseek" || model.providerID.startsWith("opencode")))
559+
) {
560+
return 0.95
561+
}
554562
return undefined
555563
}
556564

@@ -1766,6 +1774,7 @@ function reasoningEffort(model: Provider.Model, effort: string) {
17661774
case "@ai-sdk/togetherai":
17671775
case "venice-ai-sdk-provider":
17681776
case "ai-gateway-provider":
1777+
case "merge-gateway-ai-sdk-provider":
17691778
return { reasoningEffort: effort }
17701779
case "@ai-sdk/cohere":
17711780
case "@ai-sdk/perplexity":
Collapse file

‎packages/opencode/src/session/retry.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/session/retry.ts
+11-3Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ export type Retryable = {
2525

2626
export const RETRY_INITIAL_DELAY = 2000
2727
export const RETRY_BACKOFF_FACTOR = 2
28+
export const RETRY_JITTER_FACTOR = 0.25
2829
export const RETRY_MAX_DELAY_NO_HEADERS = 30_000 // 30 seconds
2930
export const RETRY_MAX_DELAY = 2_147_483_647 // max 32-bit signed integer for setTimeout
31+
export const RETRY_MAX_RETRIES = 5
3032

3133
const RETRYABLE_MESSAGE_PATTERNS = [
3234
/429|500|502|503|504|524/i,
@@ -41,7 +43,7 @@ function cap(ms: number) {
4143
return Math.min(ms, RETRY_MAX_DELAY)
4244
}
4345

44-
export function delay(attempt: number, error?: SessionV1.APIError) {
46+
export function delay(attempt: number, error?: SessionV1.APIError, random = Math.random()) {
4547
if (error) {
4648
const headers = error.data.responseHeaders
4749
if (headers) {
@@ -67,11 +69,16 @@ export function delay(attempt: number, error?: SessionV1.APIError) {
6769
}
6870
}
6971

70-
return cap(RETRY_INITIAL_DELAY * Math.pow(RETRY_BACKOFF_FACTOR, attempt - 1))
72+
return cap(exponential(attempt, random))
7173
}
7274
}
7375

74-
return cap(Math.min(RETRY_INITIAL_DELAY * Math.pow(RETRY_BACKOFF_FACTOR, attempt - 1), RETRY_MAX_DELAY_NO_HEADERS))
76+
return cap(Math.min(exponential(attempt, random), RETRY_MAX_DELAY_NO_HEADERS))
77+
}
78+
79+
function exponential(attempt: number, random: number) {
80+
const base = RETRY_INITIAL_DELAY * Math.pow(RETRY_BACKOFF_FACTOR, attempt - 1)
81+
return Math.ceil(base + base * RETRY_JITTER_FACTOR * random)
7582
}
7683

7784
export function retryable(error: Err, provider: string) {
@@ -182,6 +189,7 @@ export function policy(opts: {
182189
const error = opts.parse(meta.input)
183190
const retry = retryable(error, opts.provider)
184191
if (!retry) return Cause.done(meta.attempt)
192+
if (meta.attempt > RETRY_MAX_RETRIES) return Cause.done(meta.attempt)
185193
return Effect.gen(function* () {
186194
const wait = delay(meta.attempt, SessionV1.APIError.isInstance(error) ? error : undefined)
187195
const now = yield* Clock.currentTimeMillis
Collapse file

‎packages/opencode/src/session/system.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/session/system.ts
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ export function provider(model: Provider.Model) {
4747
if (model.api.id.includes("gemini-")) return [PROMPT_GEMINI]
4848
if (model.api.id.includes("claude")) return [PROMPT_ANTHROPIC]
4949
if (model.api.id.toLowerCase().includes("trinity")) return [PROMPT_TRINITY]
50-
if (model.api.id.toLowerCase().includes("kimi")) return [PROMPT_KIMI]
50+
if (
51+
model.api.id.toLowerCase().includes("kimi") ||
52+
["kimi-for-coding", "moonshotai", "moonshotai-cn"].includes(model.providerID)
53+
)
54+
return [PROMPT_KIMI]
5155
return [PROMPT_DEFAULT]
5256
}
5357

Collapse file

‎packages/opencode/test/plugin/github-copilot-models.test.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/test/plugin/github-copilot-models.test.ts
+68Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,74 @@ test("converts Copilot AIC token prices to USD per million tokens", async () =>
187187
expect(models["ignored-non-chat-record"]).toBeUndefined()
188188
})
189189

190+
test("detects PDF input support when vision and media type are advertised", async () => {
191+
globalThis.fetch = mock(() =>
192+
Promise.resolve(
193+
new Response(
194+
JSON.stringify({
195+
data: [
196+
{
197+
model_picker_enabled: true,
198+
id: "pdf-model",
199+
name: "PDF Model",
200+
version: "pdf-model-2026-06-01",
201+
capabilities: {
202+
family: "pdf-model",
203+
limits: {
204+
max_context_window_tokens: 128000,
205+
max_output_tokens: 16384,
206+
max_prompt_tokens: 128000,
207+
vision: {
208+
max_prompt_image_size: 10000000,
209+
max_prompt_images: 10,
210+
supported_media_types: ["application/pdf"],
211+
},
212+
},
213+
supports: {
214+
streaming: true,
215+
vision: true,
216+
tool_calls: true,
217+
},
218+
},
219+
},
220+
{
221+
model_picker_enabled: true,
222+
id: "vision-only-model",
223+
name: "Vision Only Model",
224+
version: "vision-only-model-2026-06-01",
225+
capabilities: {
226+
family: "vision-only-model",
227+
limits: {
228+
max_context_window_tokens: 128000,
229+
max_output_tokens: 16384,
230+
max_prompt_tokens: 128000,
231+
vision: {
232+
max_prompt_image_size: 10000000,
233+
max_prompt_images: 10,
234+
supported_media_types: ["image/png"],
235+
},
236+
},
237+
supports: {
238+
streaming: true,
239+
vision: true,
240+
tool_calls: true,
241+
},
242+
},
243+
},
244+
],
245+
}),
246+
{ status: 200 },
247+
),
248+
),
249+
) as unknown as typeof fetch
250+
251+
const models = (await CopilotModels.get("https://api.githubcopilot.com")).models
252+
const model = models["pdf-model"]
253+
254+
expect(model.capabilities.input.pdf).toBe(true)
255+
expect(models["vision-only-model"].capabilities.input.pdf).toBe(false)
256+
})
257+
190258
test("uses zero cost when Copilot reports a zero billing batch size", async () => {
191259
globalThis.fetch = mock(() =>
192260
Promise.resolve(

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.