From e4023d9912821d6bf3e3e02902e8b6354dcf31dc Mon Sep 17 00:00:00 2001 From: yetone Date: Tue, 13 Oct 2026 23:29:39 +0800 Subject: [PATCH] factory 0.1.25: Haiku 5.5 and Mistral Large 4, in droid 0.240.0's picker, reach Factory through magpie (JL on Discord) JL (Windows, droid 0.240.0, Factory desktop 0.197.1, magpie 0.1.1226, plugin 0.1.24): droid and Factory desktop offer claude-haiku-5-5, droid through magpie didn't, as the plugin's model table didn't have it. How droid gets its models: its npm package (@factory/cli 0.240.0, the platform binary @factory/cli-darwin-arm64) bundles the model registry in bin/droid; the picker lists that registry (order `y`), gated by availableInCLI, unreleased, feature flags and legacy grouping. Diffing the registry of 0.233.0 (the release the plugin's table was last matched to) against 0.240.0 gives three new models: claude-haiku-5-5, mistral-large-4 and gpt-6-astra-ultrafast. - Haiku 5.5: Anthropic Messages, x-api-provider anthropic, context 872000 / output 128000 (contextLimits ce, as Sonnet 5.5 and Opus 5.5), efforts low..max (droid's "off" is the request without a level). - Mistral Large 4: generic chat completions, x-api-provider mistral, Droid Core (billingPool core), 524288 / 64000, images, effort high. - GPT-6 Astra Ultra Fast stays out: droid offers it only once the user has accepted Factory's high-cost terms (explicitOptInRequirement high_cost). models.test.mjs is new; its fixture (testdata/droid-0.240.0-models.txt) is the registry's own bytes: the picker order, the context helper and the three entries. It checks the two models as droid has them and that every model in droid's picker is offered or on a named list left out (router, Gemini, unreleased, opt-in, the older generations the plugin never offered). With the Haiku 5.5 line removed both tests fail. usage.test.mjs's Core list gains Mistral Large 4. Run: bun test in packages/factory (126 pass), bun scripts/check.mjs factory; a fake Factory saw /api/llm/a/v1/messages with x-api-provider anthropic for claude-haiku-5-5 and /api/llm/o/v1/chat/completions with mistral for mistral-large-4. Not tried against Factory itself (no Factory account here); droid itself was not run. --- packages/factory/README.md | 4 +- packages/factory/index.mjs | 7 +- packages/factory/models.test.mjs | 82 +++++++++++++++++++ packages/factory/package.json | 2 +- .../factory/testdata/droid-0.240.0-models.txt | 9 ++ packages/factory/usage.test.mjs | 2 +- 6 files changed, 101 insertions(+), 5 deletions(-) create mode 100644 packages/factory/models.test.mjs create mode 100644 packages/factory/testdata/droid-0.240.0-models.txt diff --git a/packages/factory/README.md b/packages/factory/README.md index 994995d..fa7f46c 100644 --- a/packages/factory/README.md +++ b/packages/factory/README.md @@ -63,9 +63,9 @@ Each model is served on the one API droid uses for it: | API | Models | |---|---| -| Anthropic Messages (`/api/llm/a`) | Fable 5.1, Fable 5, Opus 5.5, Opus 5, Opus 4.8, Sonnet 5.5, Sonnet 5, Sonnet 4.6, Haiku 4.5, MiniMax M2.7 | +| Anthropic Messages (`/api/llm/a`) | Fable 5.1, Fable 5, Opus 5.5, Opus 5, Opus 4.8, Sonnet 5.5, Sonnet 5, Sonnet 4.6, Haiku 5.5, Haiku 4.5, MiniMax M2.7 | | OpenAI Responses (`/api/llm/o/v1`) | GPT-6.1 Sol, GPT-6 Sol/Astra/Luna, GPT-5.6 Sol/Terra/Luna, GPT-5.5, GPT-5.4, GPT-5.3-Codex, Grok 4.7, Grok 4.6 | -| Chat completions (`/api/llm/o/v1`) | GLM-5.3, GLM-5.3-Flash, GLM-5.2, Kimi K3, DeepSeek V4.1 Flash, Qwen3.8 Max, MiniMax M3, Mistral Medium 3.5, Nemotron 3 Ultra | +| Chat completions (`/api/llm/o/v1`) | GLM-5.3, GLM-5.3-Flash, GLM-5.2, Kimi K3, DeepSeek V4.1 Flash, Qwen3.8 Max, MiniMax M3, Mistral Large 4, Mistral Medium 3.5, Nemotron 3 Ultra | Reasoning efforts are the variants droid offers for each model. DeepSeek V4.1 Flash, Kimi K3 and GLM-5.2 have `none`, droid's "off": they stop thinking. diff --git a/packages/factory/index.mjs b/packages/factory/index.mjs index 5b275b7..b3ee448 100644 --- a/packages/factory/index.mjs +++ b/packages/factory/index.mjs @@ -35,7 +35,10 @@ const E4 = ["low", "medium", "high", "xhigh"] // The models droid's /model picker offers, less Gemini's (sent on a route of // Factory's own) and auto (droid picks it client side): id, name, the wire // droid sends it on, the vendor it names in x-api-provider, context, output, -// reasoning efforts, images. +// reasoning efforts, images. Haiku 5.5 and Mistral Large 4 are droid +// 0.240.0's (models.test.mjs reads its registry); GPT-6 Astra Ultra Fast, +// new there too, stays out: droid offers it only after the user accepts +// Factory's high-cost terms for it (explicitOptInRequirement). const MODELS = [ ["claude-fable-5.1", "Fable 5.1", ANTHROPIC, "anthropic", 867000, 128000, E5, true], ["claude-fable-5", "Fable 5", ANTHROPIC, "anthropic", 867000, 128000, E5, true], @@ -45,6 +48,7 @@ const MODELS = [ ["claude-sonnet-5-5", "Sonnet 5.5", ANTHROPIC, "anthropic", 872000, 128000, E5, true], ["claude-sonnet-5", "Sonnet 5", ANTHROPIC, "anthropic", 872000, 128000, E5, true], ["claude-sonnet-4-6", "Sonnet 4.6", ANTHROPIC, "anthropic", 931000, 64000, ["low", "medium", "high", "max"], true], + ["claude-haiku-5-5", "Haiku 5.5", ANTHROPIC, "anthropic", 872000, 128000, E5, true], ["claude-haiku-4-5-20251001", "Haiku 4.5", ANTHROPIC, "anthropic", 0, 0, ["low", "medium", "high"], true], ["gpt-6.1-sol", "GPT-6.1 Sol", RESPONSES, "openai", 1050000, 128000, E5, true], ["gpt-6-sol", "GPT-6 Sol", RESPONSES, "openai", 1050000, 128000, E6, true], @@ -69,6 +73,7 @@ const MODELS = [ ["qwen3.8-max", "Qwen3.8 Max", CHAT, "fireworks", 262144, 131072, ["low", "medium", "xhigh"], false], ["minimax-m3", "MiniMax M3", CHAT, "fireworks", 512000, 64000, ["high"], true], ["minimax-m2.7", "MiniMax M2.7", ANTHROPIC, "fireworks", 196600, 64000, ["high"], false], + ["mistral-large-4", "Mistral Large 4", CHAT, "mistral", 524288, 64000, ["high"], true], ["mistral-medium-3.5", "Mistral Medium 3.5", CHAT, "mistral", 256000, 64000, ["high"], true], ["nemotron-3-ultra", "Nemotron 3 Ultra", CHAT, "baseten", 202000, 65536, ["high"], false], ].map(([id, name, wire, upstream, context, output, efforts, images]) => ({ id, name, wire, upstream, context, output, efforts, images })) diff --git a/packages/factory/models.test.mjs b/packages/factory/models.test.mjs new file mode 100644 index 0000000..c7e6ec1 --- /dev/null +++ b/packages/factory/models.test.mjs @@ -0,0 +1,82 @@ +// JL on magpie's Discord (droid 0.240.0, plugin 0.1.24): droid and Factory +// desktop offer Haiku 5.5, droid through magpie didn't. The cases are droid +// 0.240.0's own registry entries, saved byte for byte in testdata. +import { expect, test } from "bun:test" +import { readFileSync } from "node:fs" +import { FactoryAuthPlugin } from "./index.mjs" + +const DROID = readFileSync(new URL("./testdata/droid-0.240.0-models.txt", import.meta.url), "utf8") + +// entry is a model's registry text in the fixture. +function entry(id) { + const line = DROID.split("\n").find((l) => l.startsWith(`"${id}":{id:"${id}",`)) + if (!line) throw new Error(`${id} is not in the fixture`) + return line +} + +// limits reads an entry's context and output as the plugin states them: a +// total context for P(context, output), the input for R({…}) and te({…}). +function limits(text) { + let m = text.match(/contextLimits:P\((\d+),(\d+)\)/) + if (m) return { context: +m[1], output: +m[2] } + m = text.match(/contextLimits:R\(\{maxInputTokens:(\d+),maxOutputTokens:(\d+)\}\)/) + if (m) return { context: +m[1], output: +m[2] } + m = text.match(/contextLimits:(\w+),/) + const def = DROID.match(new RegExp(`^${m[1]}=te\\(\\{[^}]*maxInputTokens:(\\d+),maxOutputTokens:(\\d+)\\}\\)`, "m")) + return { context: +def[1], output: +def[2] } +} + +async function models() { + const hooks = await FactoryAuthPlugin({ client: { auth: { set: async () => {} } } }) + const cfg = { provider: {} } + await hooks.config(cfg) + return cfg.provider.factory.models +} + +test("Haiku 5.5 and Mistral Large 4 are offered as droid 0.240.0 has them", async () => { + const got = await models() + for (const id of ["claude-haiku-5-5", "mistral-large-4"]) { + const text = entry(id) + const m = got[id] + expect(m).toBeDefined() + expect(m.name).toBe(text.match(/,name:"([^"]+)"/)[1]) + expect(m.limit).toEqual(limits(text)) + // droid's "off" is the request without a level; the rest are variants + const efforts = JSON.parse(text.match(/reasoningEffort:\{supported:(\[[^\]]*\])/)[1]).filter((e) => e !== "off") + expect(Object.keys(m.variants)).toEqual(efforts) + } + expect(got["claude-haiku-5-5"].provider.npm).toBe("@ai-sdk/anthropic") + expect(got["claude-haiku-5-5"].provider.api).toBe("https://api.factory.ai/api/llm/a/v1") + expect(got["claude-haiku-5-5"].variants.medium).toEqual({ effort: "medium" }) + // Mistral Large 4 is on droid's generic chat completions, images on + expect(entry("mistral-large-4")).toContain('apiModelProvider:"generic-chat-completion-api"') + expect(entry("mistral-large-4")).toContain("images:!0") + expect(got["mistral-large-4"].provider.npm).toBe("@ai-sdk/openai-compatible") + expect(got["mistral-large-4"].attachment).toBe(true) +}) + +test("every model in droid 0.240.0's picker is offered, or left out for a reason", async () => { + const got = await models() + const picker = JSON.parse(DROID.match(/^var y=(\[[^\]]*\]);/m)[1]) + const reason = { + // droid picks these itself, client side + auto: "router", "auto-fast": "router", + // Gemini goes on a route of Factory's own + "gemini-3.1-pro-preview": "gemini", "gemini-3.8-flash": "gemini", "gemini-3.7-flash": "gemini", + "gemini-3.6-flash": "gemini", "gemini-3.5-flash": "gemini", "gemini-3-flash-preview": "gemini", + // not released (unreleased:!0) or not in the registry + "garnet-07-15": "unreleased", "atlas-07-21": "unreleased", "aster-07-15": "unreleased", inkling: "unreleased", + // asks the user to accept Factory's high-cost terms first + "gpt-6-astra-ultrafast": "opt-in", + // older generations the plugin has never offered, as before + "claude-opus-4-7": "older", "claude-opus-4-6": "older", "claude-opus-4-5-20251101": "older", + "claude-sonnet-4-5-20250929": "older", "gpt-5.5-pro": "older", "gpt-5.4-mini": "older", "gpt-5.2": "older", + "gpt-5.2-codex": "older", "gpt-5.1-codex-max": "older", "grok-4.5": "older", "kimi-k2.5": "older", + "glm-5.1": "older", "glm-5": "older", "glm-4.7": "older", + "deepseek-v4-flash-0731": "older", "deepseek-v4-pro": "older", + } + const missing = picker.filter((id) => !got[id] && !reason[id] && !/-fast$/.test(id)) + expect(missing).toEqual([]) + expect(entry("gpt-6-astra-ultrafast")).toContain('explicitOptInRequirement:{kind:"high_cost"') + expect(got["gpt-6-astra-ultrafast"]).toBeUndefined() +}) diff --git a/packages/factory/package.json b/packages/factory/package.json index aa2e01f..b9fe032 100644 --- a/packages/factory/package.json +++ b/packages/factory/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-factory-auth", - "version": "0.1.24", + "version": "0.1.25", "description": "Sign in to a Factory (Droid) subscription from OpenCode or magpie", "type": "module", "main": "./index.mjs", diff --git a/packages/factory/testdata/droid-0.240.0-models.txt b/packages/factory/testdata/droid-0.240.0-models.txt new file mode 100644 index 0000000..d54bf01 --- /dev/null +++ b/packages/factory/testdata/droid-0.240.0-models.txt @@ -0,0 +1,9 @@ +// Excerpts, byte for byte, of droid 0.240.0 (@factory/cli-darwin-arm64@0.240.0, +// bin/droid, its bundled model registry): the picker order, the context +// helpers, and the entries of the models new since 0.233.0. +var y=["auto","auto-fast","claude-fable-5.1","claude-fable-5","claude-opus-5-5","claude-opus-5-5-fast","claude-opus-5","claude-opus-5-fast","claude-opus-4-8","claude-opus-4-8-fast","claude-opus-4-7","claude-opus-4-7-fast","claude-opus-4-6","claude-opus-4-6-fast","claude-opus-4-5-20251101","claude-sonnet-5-5","claude-sonnet-5","claude-sonnet-4-6","claude-sonnet-4-5-20250929","claude-haiku-5-5","claude-haiku-4-5-20251001","gpt-6.1-sol","gpt-6-astra","gpt-6-astra-ultrafast","gpt-6-sol","gpt-6-luna","gpt-5.6-sol","gpt-5.6-sol-fast","gpt-5.6-terra","gpt-5.6-luna","gpt-5.5","gpt-5.5-fast","gpt-5.5-pro","gpt-5.4","gpt-5.4-fast","gpt-5.4-mini","gpt-5.4-mini-fast","gpt-5.3-codex","gpt-5.3-codex-fast","gpt-5.2","garnet-07-15","gemini-3.1-pro-preview","gemini-3.8-flash","gemini-3.7-flash","gemini-3.6-flash","gemini-3.5-flash","gemini-3-flash-preview","inkling","mistral-large-4","mistral-medium-3.5","glm-5.3-flash","glm-5.3","glm-5.2","glm-5.2-fast","kimi-k3","qwen3.8-max","nemotron-3-ultra","deepseek-v4.1-flash","deepseek-v4-flash-0731","deepseek-v4-pro","minimax-m3","grok-4.7","grok-4.6","grok-4.5","atlas-07-21","aster-07-15","minimax-m2.7","kimi-k2.5","gpt-5.2-codex","glm-5.1","glm-5","glm-4.7","gpt-5.1-codex-max"]; +ce=te({thinkingConsumesContext:!1,maxInputTokens:872000,maxOutputTokens:128000}) +function P(o,t){return R({maxInputTokens:o-t,maxOutputTokens:t})} +"claude-haiku-5-5":{id:"claude-haiku-5-5",name:"Haiku 5.5",shortName:"Haiku 5.5",provider:"anthropic",apiProviders:X,apiProviderConfig:{anthropic:{modelId:"claude-haiku-5-5"},vertex_anthropic:{modelId:"claude-haiku-5-5"},bedrock_anthropic:{modelId:"anthropic.claude-haiku-5-5"},azure_anthropic:{modelId:"claude-haiku-5-5"}},routingConfig:g.HAIKU_5_5,featureFlag:J.ClaudeHaiku55,reasoningEffort:{supported:["off","low","medium","high","xhigh","max"],default:"medium"},tier:"standard",pdf:!0,contextLimits:ce,thinking:(o)=>U(o,!0),compactThroughLatestSignedThinking:!0,supportsMidConversationToolChanges:!0,supportsMidConversationEffortChanges:!0,disabledForPilots:!1,cost:{tokenMultiplier:0.04,outputTokenMultiplier:5},matchPatterns:[/haiku[^a-z0-9]*5[.-]?5/i,/claude-haiku-5-5/i],newUntil:new Date("2026-10-12T00:00:00Z")} +"mistral-large-4":{id:"mistral-large-4",name:"Mistral Large 4",shortName:"Mistral Large 4",provider:"factory",apiModelProvider:"generic-chat-completion-api",apiProviders:["mistral"],apiProviderConfig:{mistral:{...Tt,modelId:"mistral-large-4"}},reasoningEffort:{supported:["off","high"],default:"high"},chatCompletionRequest:We(),tier:"standard",billingPool:"core",featureFlag:J.MistralLarge4,images:!0,pdf:!1,contextLimits:R({maxInputTokens:524288,maxOutputTokens:64000}),disabledForPilots:!1,cost:{tokenMultiplier:0.544,cacheReadTokenMultiplier:0.103,outputTokenMultiplier:3.08,promotions:[{discount:0.5,startsAt:new Date("2026-10-06T00:00:00Z"),expiresAt:new Date("2026-10-20T00:00:00Z"),label:"50% off, launch discount"}]},usesUSBasedInference:!1,regionOverrides:{eu:{apiProviders:["mistral"]},us:S},matchPatterns:[/mistral[^a-z0-9]*large[^a-z0-9]*4(?![.\d])/i],newUntil:new Date("2026-10-11T00:00:00Z")} +"gpt-6-astra-ultrafast":{id:"gpt-6-astra-ultrafast",name:"GPT-6 Astra Ultra Fast",shortName:"GPT-6 Astra Ultra Fast",provider:"openai",systemPromptReminders:["astra-autonomy"],apiProviders:["openai"],apiProviderConfig:{openai:{modelId:"gpt-6-astra"}},reasoningEffort:{supported:["low","medium","high","xhigh","max"],default:"medium"},tier:"premium",featureFlag:J.Gpt6AstraUltrafast,explicitOptInRequirement:{kind:"high_cost",modelFamily:"gpt-6-astra-ultrafast",tosVersion:gse},pdf:!0,supportsVerbosity:!0,supportsMidConversationToolChanges:!0,contextLimits:M,apiRequest:xi,disabledForPilots:!0,cost:{tokenMultiplier:24,outputTokenMultiplier:5},regionOverrides:{eu:{apiProviders:[]}},matchPatterns:[/gpt[^a-z0-9]*6[^a-z0-9]*astra[^a-z0-9]*ultra[^a-z0-9]*fast/i],newUntil:new Date("2026-10-05T00:00:00Z")} diff --git a/packages/factory/usage.test.mjs b/packages/factory/usage.test.mjs index b9ee192..dc624a1 100644 --- a/packages/factory/usage.test.mjs +++ b/packages/factory/usage.test.mjs @@ -20,7 +20,7 @@ const LIMITS = { extraUsageAllowed: true, } -const CORE = ["glm-5.3", "glm-5.3-flash", "glm-5.2", "kimi-k3", "deepseek-v4.1-flash", "qwen3.8-max", "minimax-m3", "minimax-m2.7", "mistral-medium-3.5", "nemotron-3-ultra"] +const CORE = ["glm-5.3", "glm-5.3-flash", "glm-5.2", "kimi-k3", "deepseek-v4.1-flash", "qwen3.8-max", "minimax-m3", "minimax-m2.7", "mistral-large-4", "mistral-medium-3.5", "nemotron-3-ultra"] const account = (over = {}) => ({ type: "oauth",