diff --git a/.opencode/opencode.jsonc b/.opencode/opencode.jsonc index 8f7a03ddd4..078eb4a999 100644 --- a/.opencode/opencode.jsonc +++ b/.opencode/opencode.jsonc @@ -1169,7 +1169,11 @@ "instanceOf": "google", "name": "Google AI Studio (Gemini Free - muse project)", "options": { - "baseURL": "https://generativelanguage.googleapis.com/v1beta" + "baseURL": "https://generativelanguage.googleapis.com/v1beta", + "endpoints": { + "decision": { "kind": "google-decisions", "path": "/decisions" }, + "embed": { "kind": "google-embed", "path": "/models/{model}:embedContent" } + } } }, // gen-lang project -- Drew-supplied key 2026-11-16. @@ -1180,7 +1184,11 @@ "instanceOf": "google", "name": "Google AI Studio (Gemini Free - gen-lang project)", "options": { - "baseURL": "https://generativelanguage.googleapis.com/v1beta" + "baseURL": "https://generativelanguage.googleapis.com/v1beta", + "endpoints": { + "decision": { "kind": "google-decisions", "path": "/decisions" }, + "embed": { "kind": "google-embed", "path": "/models/{model}:embedContent" } + } } }, // personal project -- Drew-supplied key 2026-11-16. @@ -1191,7 +1199,11 @@ "instanceOf": "google", "name": "Google AI Studio (Gemini Free - personal project)", "options": { - "baseURL": "https://generativelanguage.googleapis.com/v1beta" + "baseURL": "https://generativelanguage.googleapis.com/v1beta", + "endpoints": { + "decision": { "kind": "google-decisions", "path": "/decisions" }, + "embed": { "kind": "google-embed", "path": "/models/{model}:embedContent" } + } } }, // Drew project -- Drew-supplied key 2026-11-16. @@ -1202,7 +1214,11 @@ "instanceOf": "google", "name": "Google AI Studio (Gemini Free - Drew project)", "options": { - "baseURL": "https://generativelanguage.googleapis.com/v1beta" + "baseURL": "https://generativelanguage.googleapis.com/v1beta", + "endpoints": { + "decision": { "kind": "google-decisions", "path": "/decisions" }, + "embed": { "kind": "google-embed", "path": "/models/{model}:embedContent" } + } } }, // developing-today project -- the PAYG door, grouped as @@ -2602,6 +2618,37 @@ "opencode-mem@latest", "opencode-auto-continue@https://github.com/developing-today/opencode-auto-continue/archive/refs/tags/latest.tar.gz" ], + // Model designations (2026-11-23, code#13675): purpose + + // capability policy keyed by bare model id, the same + // top-level-policy pattern as model_route_windows inside + // experimental below. A designated model may be seated ONLY in + // pools whose declared "purpose" (a model_routes field, absent = + // chat) is in its purposes list; an absent entry is legacy + // unrestricted. Closed vocabularies -- purposes: chat, decision, + // embed, rerank, recommend, transcribe, speak, guard; + // capabilities: visual, pdf, audio-in, audio-bidir, tts, stt. + // Enforced by bin/check-opencode-route-rules.mjs over EVERY pool + // in model_routes (not only the four tiers): a designated model + // without chat can never resolve into a chat-purpose pool, which + // mechanises the systemone decision-only convention. + // Groq TTS note (2026-11-23): playai-tts is NOT designated or + // seated -- it is absent from the groq provider catalog above + // (Groq shut PlayAI TTS down; the catalog's TTS shelf is the + // Canopy Labs Orpheus pair designated here instead). + "model_designations": { + "jev-1.13-free": { "purposes": ["decision"] }, + "jev-1.13": { "purposes": ["decision"] }, + "gpt-6-luna-decision": { "purposes": ["decision"] }, + "gemini-decision-1": { "purposes": ["decision"] }, + "gemini-embedding-2": { "purposes": ["embed"] }, + "gemini-embedding-001": { "purposes": ["embed"] }, + "whisper-large-v3": { "purposes": ["transcribe"], "capabilities": ["stt", "audio-in"] }, + "whisper-large-v3-turbo": { "purposes": ["transcribe"], "capabilities": ["stt", "audio-in"] }, + "canopylabs/orpheus-v1-english": { "purposes": ["speak"], "capabilities": ["tts"] }, + "canopylabs/orpheus-arabic-saudi": { "purposes": ["speak"], "capabilities": ["tts"] }, + "meta-llama/llama-prompt-guard-2-22m": { "purposes": ["guard"] }, + "meta-llama/llama-prompt-guard-2-86m": { "purposes": ["guard"] } + }, "experimental": { "provider_routes": { // openai-plan (2026-11-01): the ChatGPT pair as ONE provider @@ -3842,6 +3889,7 @@ }, "systemone": { "name": "System One - decision models (NOT a chat pool)", + "purpose": "decision", // NEW 2026-11-14 (Drew): the decision-model pool. System-1 // models answer typed questions (noul/choice/score) over a // state payload — they are NOT chat models and chat calls to @@ -3856,6 +3904,20 @@ // "systemone" 2026-11-15 (Drew, direct order) to match the // endpoint spelling (/v1/systemone). The mill design // supplement calls the same pool "decision". + // Wired 2026-11-23 (code#13675): the pool now declares + // "purpose": "decision" and the decision-only convention is + // checker-enforced via model_designations (jev-1.13-free + // and gemini-decision-1 are designated decision-only, so + // neither can resolve into a chat-purpose pool). Second leg + // is Gemini Decision 1 through the google-free provider + // route -- the four free projects multiply the free daily + // bucket (~10k decisions/day per project). Endpoint + + // model id live-probed 2026-11-23 before seating: POST + // https://generativelanguage.googleapis.com/v1beta/decisions + // with the muse project key returned 200 with a noul + // answer (evidence on code#13675). The google.* aliases + // carry the native endpoint descriptors (options.endpoints) + // for this leg. The paid Zen legs below stay OFF. // Paid legs — OFF by Drew's ruling 2026-11-14, kept here in // paste-ready form. To enable, add to targets: // "zen-plans/jev-1.13", @@ -3866,12 +3928,91 @@ // "zen-plans/gpt-6-luna-decision": 3, // "zen-plans/gemini-decision-1": 3 "targets": [ - "zen-plans/jev-1.13-free" + "zen-plans/jev-1.13-free", + "google-free/gemini-decision-1" + ], + "selection": "round-robin", + "autonomy": "rules", + "weights": { + "zen-plans/jev-1.13-free": 3, + "google-free/gemini-decision-1": 3 + } + }, + "gemini-embed-plan": { + "name": "Gemini Embedding - plan providers", + "purpose": "embed", + // NEW 2026-11-23 (code#13675): the embedding pool, so the + // embeddings endpoint has a real route. Both models are + // designated embed-only in model_designations and ride the + // google-free provider route (the four free projects); + // the google.* aliases carry the native google-embed + // endpoint descriptor (:embedContent) for this pool. + "targets": [ + "google-free/gemini-embedding-2", + "google-free/gemini-embedding-001" + ], + "selection": "round-robin", + "autonomy": "rules", + "weights": { + "google-free/gemini-embedding-2": 3, + "google-free/gemini-embedding-001": 3 + } + }, + "stt-plan": { + "name": "Speech-to-text (Whisper on Groq) - plan providers", + "purpose": "transcribe", + // NEW 2026-11-23 (code#13675): Groq's Whisper shelf, + // designated transcribe-only in model_designations + // (capabilities stt + audio-in; ids verified against the + // groq provider catalog above). NOT a chat pool. + "targets": [ + "groq/whisper-large-v3", + "groq/whisper-large-v3-turbo" + ], + "selection": "round-robin", + "autonomy": "rules", + "weights": { + "groq/whisper-large-v3": 3, + "groq/whisper-large-v3-turbo": 3 + } + }, + "tts-plan": { + "name": "Text-to-speech (Orpheus on Groq) - plan providers", + "purpose": "speak", + // NEW 2026-11-23 (code#13675): Groq's TTS shelf, + // designated speak-only in model_designations (capability + // tts). playai-tts is NOT seated: it is absent from the + // groq provider catalog above (Groq shut PlayAI TTS down); + // the catalog's verified TTS models are the Canopy Labs + // Orpheus pair seated here. NOT a chat pool. + "targets": [ + "groq/canopylabs/orpheus-v1-english", + "groq/canopylabs/orpheus-arabic-saudi" + ], + "selection": "round-robin", + "autonomy": "rules", + "weights": { + "groq/canopylabs/orpheus-v1-english": 3, + "groq/canopylabs/orpheus-arabic-saudi": 3 + } + }, + "prompt-guard-plan": { + "name": "Prompt Guard (Groq) - plan providers", + "purpose": "guard", + // NEW 2026-11-23 (code#13675): Groq's prompt-guard shelf, + // designated guard-only in model_designations (ids are the + // catalog's meta-llama/llama-prompt-guard-2-* entries, + // verified against the groq provider catalog above). + // NOT a chat pool. + "targets": [ + "groq/meta-llama/llama-prompt-guard-2-22m", + "groq/meta-llama/llama-prompt-guard-2-86m" ], "selection": "round-robin", "autonomy": "rules", "weights": { - "zen-plans/jev-1.13-free": 3 + "groq/meta-llama/llama-prompt-guard-2-22m": 3, + "groq/meta-llama/llama-prompt-guard-2-86m": 3 } }, "mimo-flash-plan": { diff --git a/bin/check-opencode-route-rules.mjs b/bin/check-opencode-route-rules.mjs index b969a08264..09ddd16ecf 100644 --- a/bin/check-opencode-route-rules.mjs +++ b/bin/check-opencode-route-rules.mjs @@ -15,6 +15,14 @@ import { isMeteredModel } from './check-opencode-metered-providers.mjs'; export const DEFAULT_CONFIG = '.opencode/opencode.jsonc'; export const REQUIRED_TIERS = ['scout', 'workhorse', 'specialist', 'summit']; +// Purpose designations (code#13675, 2026-11-23): closed vocabularies +// for the top-level model_designations registry and for pool-level +// "purpose" fields on model_routes entries (absent purpose = chat). +export const DESIGNATION_PURPOSES = [ + 'chat', 'decision', 'embed', 'rerank', 'recommend', 'transcribe', 'speak', 'guard', +]; +export const DESIGNATION_CAPABILITIES = ['visual', 'pdf', 'audio-in', 'audio-bidir', 'tts', 'stt']; + // Class-level fallback layout (Drew 2026-11-13; full table in // .opencode/route-fallbacks.md). Semantics: a class route's own regular // chain always runs first and completely; the fallback targets appended @@ -467,6 +475,93 @@ export function inspectRouteRules(config) { addIssue(issue); } + // Purpose designations (code#13675, 2026-11-23): walk EVERY pool in + // model_routes (not only the four tiers), resolving targets with the + // same resolver as the tier pass (provider-route expansion and + // instanceOf catalog following included), and enforce: + // (a) a leaf whose model id has a designation must have the pool's + // purpose in its purposes list; + // (b) purposes/capabilities values (designation entries and pool + // purpose fields) must be in the closed vocabularies above; + // (c) a model designated without chat must never resolve into a + // chat-purpose pool -- rule (a) applied to chat pools, which + // mechanises the systemone decision-only convention. + const designations = activeMap(config, 'model_designations'); + if (designations !== undefined && designations !== null) { + if (!isObject(designations)) { + addIssue('designation: "model_designations" must be an object keyed by bare model id'); + } else { + const purposeSet = new Set(DESIGNATION_PURPOSES); + const capabilitySet = new Set(DESIGNATION_CAPABILITIES); + for (const [modelId, entry] of Object.entries(designations)) { + if (!isObject(entry)) { + addIssue(`designation: model "${modelId}" designation must be an object with purposes/capabilities lists`); + continue; + } + if (!Array.isArray(entry.purposes) || entry.purposes.length === 0) { + addIssue(`designation: model "${modelId}" must declare a non-empty purposes list`); + } else { + for (const purpose of entry.purposes) { + if (!purposeSet.has(purpose)) { + addIssue( + `designation: model "${modelId}" has unknown purpose ${JSON.stringify(purpose)} (closed vocabulary: ${DESIGNATION_PURPOSES.join(', ')})`, + ); + } + } + } + if (entry.capabilities !== undefined) { + if (!Array.isArray(entry.capabilities)) { + addIssue(`designation: model "${modelId}" capabilities must be a list`); + } else { + for (const capability of entry.capabilities) { + if (!capabilitySet.has(capability)) { + addIssue( + `designation: model "${modelId}" has unknown capability ${JSON.stringify(capability)} (closed vocabulary: ${DESIGNATION_CAPABILITIES.join(', ')})`, + ); + } + } + } + } + } + + if (isObject(modelRoutes)) { + // Resolving non-tier pools can surface ordinary resolver + // findings (missing tracked models, windows, cycles) that the + // tier pass deliberately does not judge for pools it never + // reaches. This pass judges designations only, so resolver + // findings first raised here are pruned below; designation + // findings keep the "designation:" prefix. + const issuesBeforeWalk = new Set(issues); + for (const [poolName, route] of Object.entries(modelRoutes)) { + if (!isObject(route)) continue; + const poolPurpose = route.purpose ?? 'chat'; + if (!purposeSet.has(poolPurpose)) { + addIssue( + `designation: pool "${poolName}" declares unknown purpose ${JSON.stringify(route.purpose)} (closed vocabulary: ${DESIGNATION_PURPOSES.join(', ')})`, + ); + continue; + } + const candidates = resolve(`opencode-route/${poolName}`, null, poolName, poolName, [], new Set()); + for (const candidate of candidates) { + const entry = designations[candidate.model]; + if (!isObject(entry) || !Array.isArray(entry.purposes)) continue; + if (!entry.purposes.includes(poolPurpose)) { + addIssue( + `designation: model "${candidate.model}" is designated for [${entry.purposes.join(', ')}] but resolves into pool "${poolName}" (purpose "${poolPurpose}") via ${candidate.trace}`, + ); + } + } + } + for (let index = issues.length - 1; index >= 0; index -= 1) { + if (!issuesBeforeWalk.has(issues[index]) && !issues[index].startsWith('designation:')) { + issueSet.delete(issues[index]); + issues.splice(index, 1); + } + } + } + } + } + return { tiers, issues }; } @@ -525,4 +620,4 @@ if (isMain) { console.error(`[route-rules] ${error?.message ?? error}`); process.exitCode = 2; } -} +} \ No newline at end of file diff --git a/bin/check-opencode-route-rules.test.mjs b/bin/check-opencode-route-rules.test.mjs index 9445188cf1..d983614d3b 100644 --- a/bin/check-opencode-route-rules.test.mjs +++ b/bin/check-opencode-route-rules.test.mjs @@ -293,3 +293,88 @@ test('fallback escalation walk fires when the chain loops without reaching speci `expected an escalation walk issue, got: ${JSON.stringify(issues)}`, ); }); +// --- purpose designations (code#13675, 2026-11-23) --- + +function configWithDesignations() { + const config = configWith(); + config.model_designations = { + 'decision-bot': { purposes: ['decision'] }, + 'embed-bot': { purposes: ['embed'] }, + 'stt-bot': { purposes: ['transcribe'], capabilities: ['stt', 'audio-in'] }, + }; + const routes = config.experimental.model_routes; + routes.deciders = { purpose: 'decision', targets: ['free/decision-bot#low'] }; + routes.embedders = { purpose: 'embed', targets: ['free/embed-bot#low'] }; + routes.transcribers = { purpose: 'transcribe', targets: ['free/stt-bot#low'] }; + return config; +} + +test('designated models pass when seated only in pools of their purpose', () => { + const result = inspectRouteRules(configWithDesignations()); + assert.deepEqual(result.issues, []); +}); + +test('designation rule fires when a designated model is seated in a pool of another purpose', () => { + const config = configWithDesignations(); + config.experimental.model_routes.embedders.targets = ['free/decision-bot#low']; + const issues = inspectRouteRules(config).issues; + assert.ok( + issues.some((issue) => issue.includes('designation:') && issue.includes('"decision-bot"') && issue.includes('"embedders"')), + `expected a designation issue for decision-bot in embedders, got: ${JSON.stringify(issues)}`, + ); +}); + +test('a model designated without chat never resolves into a chat-purpose pool (systemone convention)', () => { + const config = configWithDesignations(); + // scout is a chat-purpose tier (no purpose field = chat). + config.experimental.model_routes.scout.targets = ['good/model#low', 'free/embed-bot#low']; + const issues = inspectRouteRules(config).issues; + assert.ok( + issues.some((issue) => issue.includes('designation:') && issue.includes('"embed-bot"') && issue.includes('"scout"') && issue.includes('purpose "chat"')), + `expected a designation issue for embed-bot in scout, got: ${JSON.stringify(issues)}`, + ); +}); + +test('designation rule follows provider-route expansion into pools', () => { + const config = configWithDesignations(); + config.provider.good.models['decision-bot'] = { variants: { low: {} } }; + config.experimental.model_routes.deciders.targets = ['plan/decision-bot#low']; + assert.deepEqual(inspectRouteRules(config).issues, []); + config.experimental.model_routes.workhorse.targets = ['plan/decision-bot#low']; + const issues = inspectRouteRules(config).issues; + assert.ok( + issues.some((issue) => issue.includes('designation:') && issue.includes('"decision-bot"') && issue.includes('"workhorse"')), + `expected a designation issue for decision-bot in workhorse, got: ${JSON.stringify(issues)}`, + ); +}); + +test('unknown designation purposes and capabilities are flagged', () => { + const config = configWithDesignations(); + config.model_designations['decision-bot'] = { purposes: ['decision', 'fly'] }; + config.model_designations['stt-bot'] = { purposes: ['transcribe'], capabilities: ['stt', 'wings'] }; + const issues = inspectRouteRules(config).issues; + assert.ok(issues.some((issue) => issue.includes('unknown purpose "fly"')), `got: ${JSON.stringify(issues)}`); + assert.ok(issues.some((issue) => issue.includes('unknown capability "wings"')), `got: ${JSON.stringify(issues)}`); +}); + +test('an unknown pool purpose is flagged', () => { + const config = configWithDesignations(); + config.experimental.model_routes.deciders.purpose = 'teleport'; + const issues = inspectRouteRules(config).issues; + assert.ok( + issues.some((issue) => issue.includes('designation:') && issue.includes('"deciders"') && issue.includes('unknown purpose "teleport"')), + `expected an unknown-purpose issue for deciders, got: ${JSON.stringify(issues)}`, + ); +}); + +test('designations may also live under experimental like the other route maps', () => { + const config = configWithDesignations(); + config.experimental.model_designations = config.model_designations; + delete config.model_designations; + config.experimental.model_routes.scout.targets = ['good/model#low', 'free/decision-bot#low']; + const issues = inspectRouteRules(config).issues; + assert.ok( + issues.some((issue) => issue.includes('designation:') && issue.includes('"decision-bot"') && issue.includes('"scout"')), + `expected a designation issue via experimental.model_designations, got: ${JSON.stringify(issues)}`, + ); +});