@weave-os/router 0.2.22 → 0.2.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -76,6 +76,15 @@ are not a replacement for these plugin logins.
76
76
 
77
77
  ## Env overrides (self-host + tests)
78
78
 
79
+ - `WEAVE_OPENCODE_LLM_CLASSIFIER=1` — enroll only sessions created while this
80
+ plugin is running. The plugin stores a separate handshake UUID and router
81
+ ticket for each parent/child session under OpenCode's data directory. An
82
+ enrollment failure or missing new-session event blocks inference while the
83
+ opt-in is set; resume an older session with the opt-in unset. Classifier
84
+ sessions cannot compact or change router origins; start
85
+ a new session instead. Requires a router deployment with the exact release
86
+ and installation explicitly allowlisted. Deploy the router's non-retryable
87
+ client-failure response before enabling this opt-in on developer machines.
79
88
  - `WEAVE_CODEX_OAUTH_ISSUER` — OpenAI auth issuer.
80
89
  - `WEAVE_ANTHROPIC_OAUTH_AUTHORIZE` / `WEAVE_ANTHROPIC_OAUTH_TOKEN` — Anthropic
81
90
  OAuth authorize host / token endpoint.
@@ -0,0 +1,145 @@
1
+ import { mkdir, readFile, rename, unlink, writeFile } from "node:fs/promises"
2
+ import { homedir } from "node:os"
3
+ import { dirname, join } from "node:path"
4
+ import type { Session } from "@opencode-ai/sdk"
5
+
6
+ const SESSION_ID = /^[a-zA-Z0-9_-]{1,128}$/
7
+ export const CLASSIFIER_THREAD_HEADER = "X-Weave-Classifier-Thread"
8
+ export const CLASSIFIER_UNAVAILABLE_TICKET = "weave-classifier-unavailable"
9
+
10
+ interface SavedThread {
11
+ sessionID: string
12
+ newChatID: string
13
+ routerOrigin?: string
14
+ threadToken?: string
15
+ compacted?: boolean
16
+ }
17
+
18
+ function threadDirectory(): string {
19
+ const authFile = process.env.WEAVE_OPENCODE_AUTH_FILE ??
20
+ join(process.env.XDG_DATA_HOME ?? join(homedir(), ".local", "share"), "opencode", "auth.json")
21
+ return join(dirname(authFile), "weave-classifier-threads")
22
+ }
23
+
24
+ function threadPath(sessionID: string): string {
25
+ if (!SESSION_ID.test(sessionID)) throw new Error("Invalid OpenCode session identity")
26
+ return join(threadDirectory(), `${sessionID}.json`)
27
+ }
28
+
29
+ async function readThread(sessionID: string): Promise<SavedThread | undefined> {
30
+ let saved: string
31
+ try {
32
+ saved = await readFile(threadPath(sessionID), "utf8")
33
+ } catch (error) {
34
+ if ((error as NodeJS.ErrnoException).code === "ENOENT") return undefined
35
+ throw error
36
+ }
37
+ const parsed: unknown = JSON.parse(saved)
38
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("Invalid classifier enrollment state")
39
+ const thread = parsed as Partial<SavedThread>
40
+ if (thread.sessionID !== sessionID || typeof thread.newChatID !== "string" ||
41
+ !/^[0-9a-f-]{36}$/.test(thread.newChatID) ||
42
+ (thread.routerOrigin !== undefined && typeof thread.routerOrigin !== "string") ||
43
+ (thread.threadToken !== undefined && (typeof thread.threadToken !== "string" || !thread.threadToken || thread.threadToken.length > 4096)) ||
44
+ (thread.compacted !== undefined && typeof thread.compacted !== "boolean")) {
45
+ throw new Error("Invalid classifier enrollment state")
46
+ }
47
+ return thread as SavedThread
48
+ }
49
+
50
+ async function replaceThread(thread: SavedThread): Promise<void> {
51
+ const destination = threadPath(thread.sessionID)
52
+ const temporary = `${destination}.${crypto.randomUUID()}.tmp`
53
+ await writeFile(temporary, JSON.stringify(thread), { flag: "wx", mode: 0o600 })
54
+ try {
55
+ await rename(temporary, destination)
56
+ } catch (error) {
57
+ await unlink(temporary)
58
+ throw error
59
+ }
60
+ }
61
+
62
+ /** The session-created event is the only enrollment authority; a short request is not. */
63
+ export class ClassifierThreads {
64
+ private creations = new Map<string, Promise<void>>()
65
+ private handshakes = new Map<string, Promise<string | undefined>>()
66
+
67
+ async hasThread(sessionID: string): Promise<boolean> {
68
+ await this.creations.get(sessionID)
69
+ return (await readThread(sessionID)) !== undefined
70
+ }
71
+
72
+ created(session: Session): Promise<void> {
73
+ if (process.env.WEAVE_OPENCODE_LLM_CLASSIFIER !== "1") return Promise.resolve()
74
+ const sessionID = session.id
75
+ if (this.creations.has(sessionID)) return this.creations.get(sessionID)!
76
+ const creation = (async () => {
77
+ const path = threadPath(sessionID)
78
+ await mkdir(threadDirectory(), { recursive: true, mode: 0o700 })
79
+ try {
80
+ await writeFile(path, JSON.stringify({ sessionID, newChatID: crypto.randomUUID() }), { flag: "wx", mode: 0o600 })
81
+ } catch (error) {
82
+ if ((error as NodeJS.ErrnoException).code !== "EEXIST") throw error
83
+ await readThread(sessionID)
84
+ }
85
+ })()
86
+ this.creations.set(sessionID, creation)
87
+ return creation
88
+ }
89
+
90
+ compacted(sessionID: string): Promise<void> {
91
+ return this.updateCompacted(sessionID)
92
+ }
93
+
94
+ private async updateCompacted(sessionID: string): Promise<void> {
95
+ await this.creations.get(sessionID)
96
+ await this.handshakes.get(sessionID)?.catch(() => undefined)
97
+ const thread = await readThread(sessionID)
98
+ if (thread) await replaceThread({ ...thread, compacted: true })
99
+ }
100
+
101
+ async header(sessionID: string, routerOrigin: string, routerKey: string, agent?: string): Promise<Record<string, string>> {
102
+ await this.creations.get(sessionID)
103
+ if (agent === "title" || agent === "compaction") {
104
+ const ticket = await this.resolveTicket(sessionID, routerOrigin, routerKey, agent)
105
+ return ticket ? { [CLASSIFIER_THREAD_HEADER]: ticket } : {}
106
+ }
107
+ if (this.handshakes.has(sessionID)) {
108
+ const ticket = await this.handshakes.get(sessionID)!
109
+ return ticket ? { [CLASSIFIER_THREAD_HEADER]: ticket } : {}
110
+ }
111
+ const handshake = this.resolveTicket(sessionID, routerOrigin, routerKey, agent)
112
+ this.handshakes.set(sessionID, handshake)
113
+ try {
114
+ const ticket = await handshake
115
+ return ticket ? { [CLASSIFIER_THREAD_HEADER]: ticket } : {}
116
+ } finally {
117
+ if (this.handshakes.get(sessionID) === handshake) this.handshakes.delete(sessionID)
118
+ }
119
+ }
120
+
121
+ private async resolveTicket(sessionID: string, routerOrigin: string, routerKey: string, agent?: string): Promise<string | undefined> {
122
+ const thread = await readThread(sessionID)
123
+ if (!thread) return undefined
124
+ if (thread.compacted || (thread.routerOrigin && thread.routerOrigin !== routerOrigin)) {
125
+ throw new Error("Classifier session cannot continue after compaction or router change")
126
+ }
127
+ if (agent === "title") return undefined
128
+ if (agent === "compaction") throw new Error("Classifier sessions require complete history; compaction is unavailable")
129
+ if (thread.threadToken) return thread.threadToken
130
+ if (!routerKey) throw new Error("Classifier enrollment requires a router key")
131
+ const response = await fetch(`${routerOrigin}/v1/router/threads`, {
132
+ method: "POST", redirect: "error", signal: AbortSignal.timeout(10_000),
133
+ headers: { "X-Weave-Router-Key": routerKey, "X-App": "opencode", "Content-Type": "application/json" },
134
+ body: JSON.stringify({ new_chat_id: thread.newChatID }),
135
+ })
136
+ if (!response.ok) throw new Error(`Classifier enrollment returned HTTP ${response.status}`)
137
+ const ticket: unknown = await response.json()
138
+ if (ticket === null || typeof ticket !== "object" || !("thread_token" in ticket) ||
139
+ typeof ticket.thread_token !== "string" || !ticket.thread_token || ticket.thread_token.length > 4096) {
140
+ throw new Error("Invalid classifier enrollment response")
141
+ }
142
+ await replaceThread({ ...thread, routerOrigin, threadToken: ticket.thread_token })
143
+ return ticket.thread_token
144
+ }
145
+ }
@@ -38,13 +38,16 @@ import type { AssistantMessage, Message } from "@opencode-ai/sdk"
38
38
  import { readFile } from "node:fs/promises"
39
39
  import { homedir } from "node:os"
40
40
  import { join } from "node:path"
41
+ import { CLASSIFIER_THREAD_HEADER, CLASSIFIER_UNAVAILABLE_TICKET, ClassifierThreads } from "./classifier-thread.ts"
41
42
  import { rewriteDirectiveParts } from "./directives.ts"
42
43
 
43
44
  // ---- ChatGPT (Codex) OAuth -------------------------------------------------
44
45
  const CHATGPT_CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann"
45
46
  // Overridable for self-hosted OpenAI auth proxies and for tests (mirrors the
46
47
  // bundled codex plugin's `options.issuer`).
47
- const CHATGPT_ISSUER = process.env.WEAVE_CODEX_OAUTH_ISSUER ?? "https://auth.openai.com"
48
+ function chatGPTIssuer(): string {
49
+ return process.env.WEAVE_CODEX_OAUTH_ISSUER ?? "https://auth.openai.com"
50
+ }
48
51
  const OAUTH_PORT = 1455
49
52
  const OAUTH_TIMEOUT_MS = 5 * 60 * 1000
50
53
  const OAUTH_POLLING_SAFETY_MARGIN_MS = 3000
@@ -57,7 +60,9 @@ const ACCESS_TOKEN_REFRESH_MARGIN_MS = 60 * 1000
57
60
  // bearer; the router applies the Bearer + oauth beta header on the upstream leg.
58
61
  const ANTHROPIC_CLIENT_ID = "9d1c250a-e61b-44d9-88ed-5944d1962f5e"
59
62
  const ANTHROPIC_AUTHORIZE_BASE = process.env.WEAVE_ANTHROPIC_OAUTH_AUTHORIZE ?? "https://claude.ai"
60
- const ANTHROPIC_TOKEN_URL = process.env.WEAVE_ANTHROPIC_OAUTH_TOKEN ?? "https://console.anthropic.com/v1/oauth/token"
63
+ function anthropicTokenURL(): string {
64
+ return process.env.WEAVE_ANTHROPIC_OAUTH_TOKEN ?? "https://console.anthropic.com/v1/oauth/token"
65
+ }
61
66
  const ANTHROPIC_REDIRECT_URI = "https://console.anthropic.com/oauth/code/callback"
62
67
  const ANTHROPIC_SCOPE = "org:create_api_key user:profile user:inference"
63
68
 
@@ -177,11 +182,11 @@ function buildAuthorizeUrl(redirectUri: string, pkce: PkceCodes, state: string):
177
182
  state,
178
183
  originator: "codex_cli_ts",
179
184
  })
180
- return `${CHATGPT_ISSUER}/oauth/authorize?${params.toString()}`
185
+ return `${chatGPTIssuer()}/oauth/authorize?${params.toString()}`
181
186
  }
182
187
 
183
188
  async function exchangeCodeForTokens(code: string, redirectUri: string, pkce: PkceCodes): Promise<TokenResponse> {
184
- const response = await fetch(`${CHATGPT_ISSUER}/oauth/token`, {
189
+ const response = await fetch(`${chatGPTIssuer()}/oauth/token`, {
185
190
  method: "POST",
186
191
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
187
192
  body: new URLSearchParams({
@@ -197,7 +202,7 @@ async function exchangeCodeForTokens(code: string, redirectUri: string, pkce: Pk
197
202
  }
198
203
 
199
204
  async function refreshAccessToken(refreshToken: string): Promise<TokenResponse> {
200
- const response = await fetch(`${CHATGPT_ISSUER}/oauth/token`, {
205
+ const response = await fetch(`${chatGPTIssuer()}/oauth/token`, {
201
206
  method: "POST",
202
207
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
203
208
  body: new URLSearchParams({
@@ -240,7 +245,7 @@ async function exchangeAnthropicCode(code: string, verifier: string): Promise<An
240
245
  throw new Error(`Expected the pasted code in "code#state" format; got: ${code.trim().slice(0, 24)}…`)
241
246
  }
242
247
  const [authCode, state] = code.trim().split("#")
243
- const response = await fetch(ANTHROPIC_TOKEN_URL, {
248
+ const response = await fetch(anthropicTokenURL(), {
244
249
  method: "POST",
245
250
  headers: { "Content-Type": "application/json" },
246
251
  body: JSON.stringify({
@@ -258,7 +263,7 @@ async function exchangeAnthropicCode(code: string, verifier: string): Promise<An
258
263
  }
259
264
 
260
265
  async function refreshAnthropicToken(refreshToken: string): Promise<AnthropicTokens> {
261
- const response = await fetch(ANTHROPIC_TOKEN_URL, {
266
+ const response = await fetch(anthropicTokenURL(), {
262
267
  method: "POST",
263
268
  headers: { "Content-Type": "application/json" },
264
269
  body: JSON.stringify({
@@ -459,6 +464,7 @@ function isCompletedWeaveAssistant(info: Message): info is AssistantMessage {
459
464
  }
460
465
 
461
466
  export const WeaveCodex: Plugin = async (input: PluginInput): Promise<Hooks> => {
467
+ const classifierThreads = new ClassifierThreads()
462
468
  const pendingRequestMessageIDs = new Map<string, string>()
463
469
  const routedModelIDsByMessage = new Map<string, string>()
464
470
  const toastedMessageIDs = new Set<string>()
@@ -467,6 +473,14 @@ export const WeaveCodex: Plugin = async (input: PluginInput): Promise<Hooks> =>
467
473
  rewriteDirectiveParts(output.parts)
468
474
  },
469
475
  event: async ({ event }) => {
476
+ if (event.type === "session.created") {
477
+ await classifierThreads.created(event.properties.info)
478
+ return
479
+ }
480
+ if (event.type === "session.compacted") {
481
+ await classifierThreads.compacted(event.properties.sessionID)
482
+ return
483
+ }
470
484
  if (event.type !== "message.updated") return
471
485
  const info = event.properties.info
472
486
  if (!isCompletedWeaveAssistant(info)) return
@@ -640,7 +654,7 @@ export const WeaveCodex: Plugin = async (input: PluginInput): Promise<Hooks> =>
640
654
  label: "ChatGPT Pro/Plus — pays for GPT/Codex turns (headless device code)",
641
655
  type: "oauth",
642
656
  authorize: async () => {
643
- const deviceResponse = await fetch(`${CHATGPT_ISSUER}/api/accounts/deviceauth/usercode`, {
657
+ const deviceResponse = await fetch(`${chatGPTIssuer()}/api/accounts/deviceauth/usercode`, {
644
658
  method: "POST",
645
659
  headers: { "Content-Type": "application/json", "User-Agent": USER_AGENT },
646
660
  body: JSON.stringify({ client_id: CHATGPT_CLIENT_ID }),
@@ -653,14 +667,14 @@ export const WeaveCodex: Plugin = async (input: PluginInput): Promise<Hooks> =>
653
667
  }
654
668
  const interval = Math.max(parseInt(deviceData.interval) || 5, 1) * 1000
655
669
  return {
656
- url: `${CHATGPT_ISSUER}/codex/device`,
670
+ url: `${chatGPTIssuer()}/codex/device`,
657
671
  instructions: `Enter code: ${deviceData.user_code}`,
658
672
  method: "auto" as const,
659
673
  async callback() {
660
674
  const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))
661
675
  const deadline = Date.now() + OAUTH_TIMEOUT_MS
662
676
  while (Date.now() < deadline) {
663
- const response = await fetch(`${CHATGPT_ISSUER}/api/accounts/deviceauth/token`, {
677
+ const response = await fetch(`${chatGPTIssuer()}/api/accounts/deviceauth/token`, {
664
678
  method: "POST",
665
679
  headers: { "Content-Type": "application/json", "User-Agent": USER_AGENT },
666
680
  body: JSON.stringify({
@@ -670,13 +684,13 @@ export const WeaveCodex: Plugin = async (input: PluginInput): Promise<Hooks> =>
670
684
  })
671
685
  if (response.ok) {
672
686
  const data = (await response.json()) as { authorization_code: string; code_verifier: string }
673
- const tokenResponse = await fetch(`${CHATGPT_ISSUER}/oauth/token`, {
687
+ const tokenResponse = await fetch(`${chatGPTIssuer()}/oauth/token`, {
674
688
  method: "POST",
675
689
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
676
690
  body: new URLSearchParams({
677
691
  grant_type: "authorization_code",
678
692
  code: data.authorization_code,
679
- redirect_uri: `${CHATGPT_ISSUER}/deviceauth/callback`,
693
+ redirect_uri: `${chatGPTIssuer()}/deviceauth/callback`,
680
694
  client_id: CHATGPT_CLIENT_ID,
681
695
  code_verifier: data.code_verifier,
682
696
  }).toString(),
@@ -706,6 +720,26 @@ export const WeaveCodex: Plugin = async (input: PluginInput): Promise<Hooks> =>
706
720
  // Scoped to our provider so other providers are untouched.
707
721
  "chat.headers": async (hookInput, output) => {
708
722
  if (hookInput.model.providerID !== PROVIDER_ID) return
723
+ if (hookInput.agent !== "title") {
724
+ // OpenCode swallows plugin hook exceptions. A failure must reach the
725
+ // router as an invalid ticket, never as an unticketed HMM request.
726
+ output.headers[CLASSIFIER_THREAD_HEADER] = CLASSIFIER_UNAVAILABLE_TICKET
727
+ try {
728
+ const enrolled = await classifierThreads.hasThread(hookInput.sessionID)
729
+ if (!enrolled && process.env.WEAVE_OPENCODE_LLM_CLASSIFIER !== "1") {
730
+ delete output.headers[CLASSIFIER_THREAD_HEADER]
731
+ } else {
732
+ if (!hookInput.provider?.options?.baseURL) throw new Error("Weave router origin unavailable")
733
+ const routerOrigin = new URL(hookInput.provider.options.baseURL).origin
734
+ const configuredHeaders = new Headers(hookInput.provider.options.headers as HeadersInit | undefined)
735
+ Object.assign(output.headers, await classifierThreads.header(hookInput.sessionID, routerOrigin,
736
+ configuredHeaders.get("X-Weave-Router-Key") ?? "", hookInput.agent))
737
+ }
738
+ } catch (error) {
739
+ console.error("Classifier enrollment blocked this OpenCode request", hookInput.sessionID,
740
+ error instanceof Error ? error.message : "unknown failure")
741
+ }
742
+ }
709
743
  output.headers["originator"] = "codex_cli_ts"
710
744
  output.headers["session-id"] = hookInput.sessionID
711
745
  const messageID = hookInput.message?.id
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weave-os/router",
3
- "version": "0.2.22",
3
+ "version": "0.2.24",
4
4
  "description": "One-command installer that points Claude Code, Codex, opencode, or pi at the Weave Router. For pi it also ships the routing extension, loaded via pi.extensions.",
5
5
  "bin": {
6
6
  "weave-router": "bin.js",
@@ -28,7 +28,8 @@
28
28
  "pi-router/",
29
29
  "opencode-weave/",
30
30
  "README.md",
31
- "LICENSE"
31
+ "LICENSE",
32
+ "NOTICE"
32
33
  ],
33
34
  "scripts": {
34
35
  "prepack": "node ./scripts/copy-installer.js"
@@ -66,7 +67,7 @@
66
67
  "directory": "install/npm"
67
68
  },
68
69
  "homepage": "https://workweave.ai",
69
- "license": "SEE LICENSE IN LICENSE",
70
+ "license": "Apache-2.0",
70
71
  "keywords": [
71
72
  "weave",
72
73
  "router",
@@ -7,7 +7,7 @@ export interface ModelPricing {
7
7
  cacheReadMultiplier: number;
8
8
  }
9
9
 
10
- export const PRICING_VERSION = "catalog-sha256:d1898e95669c5daf";
10
+ export const PRICING_VERSION = "catalog-sha256:ecb506fcec0b73ed";
11
11
 
12
12
  export const MODEL_PRICING: Readonly<Record<string, ModelPricing>> = Object.freeze({
13
13
  "claude-fable-5": { inputUsdPerMillion: 10, outputUsdPerMillion: 50, cacheReadMultiplier: 0.1 },
@@ -20,12 +20,14 @@ export const MODEL_PRICING: Readonly<Record<string, ModelPricing>> = Object.free
20
20
  "claude-opus-4-7": { inputUsdPerMillion: 5, outputUsdPerMillion: 25, cacheReadMultiplier: 0.1 },
21
21
  "claude-opus-4-8": { inputUsdPerMillion: 5, outputUsdPerMillion: 25, cacheReadMultiplier: 0.1 },
22
22
  "claude-opus-5": { inputUsdPerMillion: 5, outputUsdPerMillion: 25, cacheReadMultiplier: 0.1 },
23
+ "claude-opus-5-5": { inputUsdPerMillion: 4, outputUsdPerMillion: 20, cacheReadMultiplier: 0.05 },
23
24
  "claude-sonnet-4-5": { inputUsdPerMillion: 3, outputUsdPerMillion: 15, cacheReadMultiplier: 0.1 },
24
25
  "claude-sonnet-4-6": { inputUsdPerMillion: 3, outputUsdPerMillion: 15, cacheReadMultiplier: 0.1 },
25
26
  "claude-sonnet-5": { inputUsdPerMillion: 3, outputUsdPerMillion: 15, cacheReadMultiplier: 0.1 },
26
27
  "deepseek/deepseek-v4-flash": { inputUsdPerMillion: 0.1134, outputUsdPerMillion: 0.2791, cacheReadMultiplier: 0.2 },
27
28
  "deepseek/deepseek-v4-pro": { inputUsdPerMillion: 1.74, outputUsdPerMillion: 3.48, cacheReadMultiplier: 0.11494252873563218 },
28
29
  "deepseek/deepseek-v4-pro-0813": { inputUsdPerMillion: 1.74, outputUsdPerMillion: 3.48, cacheReadMultiplier: 0.11494252873563218 },
30
+ "deepseek/deepseek-v4.1-flash": { inputUsdPerMillion: 0.22, outputUsdPerMillion: 0.66, cacheReadMultiplier: 0.031818181818181815 },
29
31
  "gemini-2.0-flash": { inputUsdPerMillion: 0.1, outputUsdPerMillion: 0.4, cacheReadMultiplier: 0.25 },
30
32
  "gemini-2.0-flash-lite": { inputUsdPerMillion: 0.075, outputUsdPerMillion: 0.3, cacheReadMultiplier: 0.25 },
31
33
  "gemini-2.5-flash": { inputUsdPerMillion: 0.3, outputUsdPerMillion: 1.2, cacheReadMultiplier: 0.1 },
@@ -64,9 +66,12 @@ export const MODEL_PRICING: Readonly<Record<string, ModelPricing>> = Object.free
64
66
  "gpt-5.6-sol-pro": { inputUsdPerMillion: 4, outputUsdPerMillion: 20, cacheReadMultiplier: 0.1 },
65
67
  "gpt-5.6-terra": { inputUsdPerMillion: 2, outputUsdPerMillion: 12, cacheReadMultiplier: 0.1 },
66
68
  "gpt-6-astra": { inputUsdPerMillion: 10, outputUsdPerMillion: 50, cacheReadMultiplier: 0.1 },
69
+ "gpt-6-luna": { inputUsdPerMillion: 0.1, outputUsdPerMillion: 0.5, cacheReadMultiplier: 0.1 },
70
+ "gpt-6-sol": { inputUsdPerMillion: 2, outputUsdPerMillion: 10, cacheReadMultiplier: 0.1 },
67
71
  "grok-4.5": { inputUsdPerMillion: 2, outputUsdPerMillion: 6, cacheReadMultiplier: 0.25 },
68
72
  "grok-4.6": { inputUsdPerMillion: 2, outputUsdPerMillion: 6, cacheReadMultiplier: 0.25 },
69
73
  "grok-4.7": { inputUsdPerMillion: 2, outputUsdPerMillion: 6, cacheReadMultiplier: 0.25 },
74
+ "inclusionai/ling-3.0-flash": { inputUsdPerMillion: 0.06, outputUsdPerMillion: 0.18, cacheReadMultiplier: 0.2 },
70
75
  "minimax/minimax-m2.7": { inputUsdPerMillion: 0.3, outputUsdPerMillion: 1.2, cacheReadMultiplier: 0.2 },
71
76
  "minimax/minimax-m3": { inputUsdPerMillion: 0.3, outputUsdPerMillion: 1.2, cacheReadMultiplier: 0.2 },
72
77
  "mistralai/mistral-small-2603": { inputUsdPerMillion: 0.2, outputUsdPerMillion: 0.6, cacheReadMultiplier: 0.1 },
@@ -85,6 +90,8 @@ export const MODEL_PRICING: Readonly<Record<string, ModelPricing>> = Object.free
85
90
  "qwen/qwen3.7-plus": { inputUsdPerMillion: 0.4, outputUsdPerMillion: 1.6, cacheReadMultiplier: 0.2 },
86
91
  "qwen/qwen3.8-max": { inputUsdPerMillion: 2, outputUsdPerMillion: 6, cacheReadMultiplier: 0.125 },
87
92
  "xiaomi/mimo-v2.5-pro": { inputUsdPerMillion: 1, outputUsdPerMillion: 3, cacheReadMultiplier: 0.1 },
93
+ "xiaomi/mimo-v2.6-flash": { inputUsdPerMillion: 0.14, outputUsdPerMillion: 0.28, cacheReadMultiplier: 0.02 },
94
+ "xiaomi/mimo-v2.6-pro": { inputUsdPerMillion: 0.435, outputUsdPerMillion: 0.87, cacheReadMultiplier: 0.00827586 },
88
95
  "z-ai/glm-5": { inputUsdPerMillion: 1, outputUsdPerMillion: 3.2, cacheReadMultiplier: 0.2 },
89
96
  "z-ai/glm-5.1": { inputUsdPerMillion: 1.4, outputUsdPerMillion: 4.4, cacheReadMultiplier: 0.18571428571428572 },
90
97
  "z-ai/glm-5.2": { inputUsdPerMillion: 1.4, outputUsdPerMillion: 4.4, cacheReadMultiplier: 0.18571428571428572 },
package/uninstall.sh CHANGED
@@ -430,7 +430,10 @@ strip_codex_block() {
430
430
  in_weave_provider = 0
431
431
  }
432
432
  in_weave_provider { next }
433
+ !in_section && /^[[:space:]]*#[[:space:]]*model_provider[[:space:]]*=[[:space:]]*"weave".*weave-router: off/ { next }
434
+ !in_section && /^[[:space:]]*#[[:space:]]*model[[:space:]]*=[[:space:]]*"weave-auto".*weave-router: off/ { next }
433
435
  !in_section && /^[[:space:]]*model_provider[[:space:]]*=[[:space:]]*"weave"[[:space:]]*$/ { next }
436
+ !in_section && /^[[:space:]]*model[[:space:]]*=[[:space:]]*"weave-auto"[[:space:]]*$/ { next }
434
437
  { print }
435
438
  ' "$config_file" >"$tmp"
436
439
  mv "$tmp" "$config_file"
@@ -547,6 +550,11 @@ if [ "$target" = "opencode" ]; then
547
550
  refuse_if_symlink "$opencode_directives"
548
551
  rm -f "$opencode_directives"
549
552
  fi
553
+ opencode_classifier="$(dirname "$opencode_plugin")/classifier-thread.ts"
554
+ if [ -f "$opencode_classifier" ]; then
555
+ refuse_if_symlink "$opencode_classifier"
556
+ rm -f "$opencode_classifier"
557
+ fi
550
558
  rmdir "$opencode_dir/.weave" 2>/dev/null || true
551
559
  ok "Removed $opencode_plugin"
552
560
  fi