Commit Graph
3181 Commits
Author SHA1 Message Date
yetone a3d59eee01 cursor: a model's name no longer says its context, a grey 1M beside it does (Leo on Discord: Cursor 模型的展示名仍保留上游文本中的 1M) — Cursor names its large models "Claude Opus 5.5 1M", and magpie showed that as the name while it already kept the 1M as the model's context. The name now leaves it out ("(1M)" too); a name that would then be another model's ("GPT-5.5 Mini (1M)" beside "GPT-5.5 Mini") keeps it, as that is what tells them apart. Ids, efforts and the Cursor id each request goes to are unchanged, and a name the user gave still wins. So the context still shows, a model holding a million tokens or more has a small grey 1M by its name in the provider's models, the gateway's list and the model picker. Tested with a fake Cursor list in a sandbox magpie web, dark and light 2026-09-29 13:26:16 +08:00
yetone 73af4c282c gui: a click never moves the page, held for every view in one place (为什么点击一个控件总会滚到页面顶部,能否从根上解决) — picking Live after a day emptied the requests' list, the page got shorter than where the reader was, and the browser pulled it up; any code could also call scrollOnPurpose() and scroll on a redraw, a tab switch or a filter. Now what the reader clicks stays where it is on the screen for the next 4s: the element clicked, or once it's drawn again its nearest neighbour or parent, is held in place against content above it changing, and when content below it shrinks, room is kept at the view's foot (a .view-room spacer, gone once the reader scrolls back up) so the page isn't clamped. Code scrolls only with scrollOnPurpose(e) given the reader's own event, and without one the scroll is refused. The wheel, touch, keys and dragging are the reader's and scroll as before. The Routing page's days stay reachable with no live requests, and the library tabs no longer reset to the top. New click-scroll.test.cjs (Live/day switching with the view scrolled to its end, a jump, growth, redraws and helpers with no event, a scroll asked for, the room kept and removed, the wheel) passes 12/12 on Chromium and WebKit; the old code fails it (picking Live moved the page 294px); menu-scroll 22/22 2026-09-29 13:22:00 +08:00
yetone 58b676663b claude: its sign-in is read from the keychain under its account, as Claude Code reads it (@taresky: claude auth status loggedIn, the keychain item there, magpie still said not signed in) — magpie asked for "Claude Code-credentials" by service alone, and with more than one item for it (one an earlier sign-in left, say) the keychain may hand back one that isn't the sign-in in use; now it asks under $USER first, as Claude Code does, and by service alone only when that finds none that reads 2026-09-29 13:08:36 +08:00
Zhaofeng 89d8a59f15 codex: guide sealed subagent handoffs to supported models (#188) 2026-09-29 13:06:14 +08:00
yetone 21cc3d7647 providers: Kiro is a subscription added in magpie, signed in on Kiro's own page (Image #21: 为什么在订阅列表里看不到Kiro订阅) — Kiro was used through kiro-cli's or the Kiro IDE's sign-in, or a key, so it had no card among the subscriptions and no way to sign in from magpie. It now has a card, and signing in opens app.kiro.dev as the IDE does: Google and GitHub are exchanged with Kiro's auth service, Builder ID and Identity Center go on to AWS with a client registered for magpie, and the sign-in is kept in magpie's own kiro-auth-token.json, refreshed there, and used ahead of kiro-cli's and the IDE's, which are left as they were. A company's own identity provider is still kiro-cli's (kiro-cli login), and the sign-in says so. Tested with a fake Kiro and AWS (Google, Builder ID, a stale answer, an external IdP) and against the live page, token and register endpoints; not yet with a real Kiro account 2026-09-29 13:01:09 +08:00
yetone 1d6b415a68 providers: a saved Claude account left out says which check found no sign-in (@taresky: Claude 账号不显示, cc cli works) — on a Mac the note named only ~/.claude/.credentials.json, where Claude Code never keeps its sign-in there, so every cause read the same. Now it says whether no "Claude Code-credentials" could be read from the keychain (and nothing at that file), the credentials are there but claude auth status says no one is signed in, or neither ~/.claude.json nor the CLI names the account 2026-09-29 12:56:58 +08:00
yetone b1d4bca90f routing: picking Live or a day keeps the page where it is, and a list with no requests says what it is for (Image #59) — a day or Live picked in the requests' bar picked its first request as a click on a request does, which brings the stage at the top into view, so every switch sent the reader up to the top and back down; the stage now comes into view only for a request picked in the list. With no requests, the list is a quiet note (none since magpie started: each request an agent sends shows who answered it, why and each try; earlier ones are under the days) in place of an empty box, and the accounts and keys column, tallying nothing, is left out. Checked in a stub magpie web with the day's history: scroll stays put over five switches (it moved before), dark 2026-09-29 12:43:50 +08:00
yetone 233b463d3a devin: Devin's models are offered as their families, with the effort picked as any model's is (蓝猫 on Discord: 能不能让 devin 也走 model + effort) — Devin writes the effort into its ids (54 families, 625 ids, most swe-2-high, …_MEDIUM), and magpie listed them all. Each family is now one model with the efforts its variants are at, lowest first, and the gateway asks Devin for the variant at the effort asked for, or the nearest the family has; a variant that is no effort (a 1M window, -high-fast) stays a model of its own. A variant already picked stays offered and goes to Devin as it is, and its effort is the one its id says, so the trace shows medium for a Medium variant rather than the max the request asked. Tested with a fake Devin list: families, picked variants, the variant chosen, the efforts and windows offered 2026-09-29 12:35:34 +08:00
yetone 15aef1c584 providers: Bedrock's Anthropic endpoint is sent its key as x-api-key alone, and GPT-6 is in its models (#176: Endpoint test failed) — magpie sent a Bedrock key on /anthropic/v1/messages as both x-api-key and a Bearer, as it does for compatible vendors, and Bedrock turns away a request with both; it now gets x-api-key alone, as AWS's own Messages sample sends it, and chat completions keep the Bearer. The preset's models gain GPT-6 Astra, Sol and Luna as their global. inference profiles, which every commercial region routes (they have no in-region id on bedrock-runtime); gpt-oss stays in-region, which ap-southeast-1 doesn't serve. Tested with a fake Bedrock through the gateway and the endpoint test: without the change both headers arrive; not yet against a real Bedrock key 2026-09-29 12:17:34 +08:00
yetone e4375ce967 gateway: a tool's schema reaches Antigravity with only the keywords it takes (#187: Unknown name "exclusiveMinimum") — Antigravity refuses a request whose function declarations carry a JSON Schema keyword outside its subset, and magpie cut out only the ones it knew of, so zcode's and dsh's tools, whose numbers have exclusiveMinimum, were refused with 400 on every turn. Now each schema keeps only type, description, nullable, enum, properties, required, items, the bounds and pattern, and propertyOrdering, anything else left out; an exclusive bound given as a number becomes the inclusive one when there is none. Tested on a schema with exclusive bounds, format, title, uniqueItems, contains, dependentRequired and not 2026-09-29 12:12:45 +08:00
yetone 03dbde12d0 accounts: after a Codex switch, magpie says when Codex's background service is still on the account before, and restarts it when asked (vincentzhang on Discord) — Codex CLI can keep an app-server running (codex app-server --managed-daemon) that reads the sign-in once, when it starts, so sessions opened after a switch still ran on the account before. When a switch changes the account while such a daemon runs, Codex's account list shows that it is still signed in as the one before, with Later and Restart; Restart runs codex app-server daemon restart for the Codex home magpie signs in through, which ends the Codex sessions on it, so magpie never does it unasked. magpie accounts switch codex prints the same hint and the command. The notice goes when the daemon restarts or stops, or Codex is switched back. Only a codex program's app-server with --managed-daemon counts: the ChatGPT app's codex and other apps' app-servers don't. Tested with a fake codex and a fake daemon in a sandbox magpie web; the real codex 0.155 has the restart command 2026-09-29 11:59:57 +08:00
yetone 3bc3de79d9 usage: the panel says whether its rings are used or left, and a model named free is marked free (#184, #185) — the panel's usage groups carry a USED/LEFT (已用/剩余) pill on their header that turns every ring as a click on a ring does, and lights a moment when it turns, so the turn is seen; a model whose id or name has "free" as a word (OpenRouter's foo/bar:free, free-model, Qwen3 Free, not freedom-7b) gets the green FREE badge in the provider's model chips, the model picker, the Gateway's model rows and the import preview, titled "free: so its name says". Checked in a sandbox magpie web, light and dark, English and Chinese 2026-09-29 11:57:06 +08:00
yetone 976ae3f45b gateway: Claude Code's body reaches a relay as it sent it, but for the model's name (#179: packy: 您的请求体疑似被篡改) — swapping the model re-encoded the whole body, so its fields went out sorted and its <, > and & as \u003c escapes, and a Claude model's request without thinking gained thinking off; a relay that only lets Claude Code in (packy) took that for a body tampered with. The model is now replaced where it stands and nothing else is touched, a Claude model's request is not given thinking off (Anthropic's models think only when asked), and a model that thinks by default (DeepSeek) has it added at the end with the rest left as sent; other rewrites no longer escape <, > and &. Tested with two requests captured from Claude Code 2.1.284 in a sandbox (85 KB with its tools and system prompt): through the gateway to a keyed Anthropic provider they arrive byte for byte as Claude Code sent them; not yet against packy 2026-09-29 11:47:43 +08:00
yetone c348903159 workbuddy: a chat with no system prompt is sent with one (Jerry lee on Discord: 没有 system 消息时报 first message is not system prompt) — WorkBuddy refuses a chat whose first message isn't the system prompt, which scripts and plain chat clients often send; such a chat now starts with a neutral "You are a helpful assistant.", the rest of the body kept as it was, and one that already starts with a system prompt goes as it is. The comment on WorkBuddy AI's client headers no longer says they fixed "unapproved channel": that answer comes from Claude Code's and Codex's own system prompts (#182). Tested on the account's request body, through the provider as signed in 2026-09-29 11:40:00 +08:00
yetone d287a05161 providers: Amazon Bedrock, with a Bedrock API key (#176: 增加 AWS Bedrock 作为 model provider) — Bedrock's runtime serves Claude on Anthropic's messages at /anthropic/v1/messages and the other models on chat completions at /openai/v1, both taking a Bedrock API key (AWS_BEARER_TOKEN_BEDROCK) with no SigV4, so a vendor preset reaches it: pick one of ten regions and paste the key. Claude ids (anthropic.claude…) go on messages only, the rest on chat only, for the preset and for any provider at a bedrock-runtime host; the runtime has no /models, so the preset's list (Claude as global. inference profiles, plus gpt-oss, Qwen3 Coder, DeepSeek, Kimi, GLM and MiniMax) is it, and a profile kept in one geography (apac., us., eu.…) is typed in by hand and takes its context size from the model it names. The region selector scrolls where its regions don't fit. Tested against a fake Bedrock through the gateway (apac.anthropic.claude-opus-5-5 on /anthropic/v1/messages with x-api-key, gpt-oss on /openai/v1/chat/completions with the Bearer key) and in a sandbox magpie web; not yet against real AWS 2026-09-29 11:29:43 +08:00
yetone 6b546aa81d gemini: 3.8 Flash asked of an account it isn't rolled out to goes as that account's Flash (蒙面人 on Discord: 502 错误 for gemini/gemini-3.8-flash) — the list magpie falls back on has 3.8 Flash and 3.5 Flash Lite, and a model picked from it went to Code Assist under that id whatever the account's experiments said; now, as Gemini CLI would, 3.8 Flash goes as gemini-3-flash and 3.5 Flash Lite as gemini-3.1-flash-lite where they aren't rolled out. Tested against a fake Code Assist 2026-09-29 11:04:46 +08:00
yetone 63b131c1d7 tray: a reset next week shows its date, and the panel keeps one height across its tabs (#181: 重置次数那个地方现在是固定显示周一,但实际不是本周一; #124: 从方案切换到用量,一下子面板就变大了) — a reset time or reset credit's expiry within 7 days showed a bare weekday, so on a Tuesday next Monday read as this week's; now a weekday is shown only for later this week (Monday to Sunday), else the date (10月5日 12:21). The tray panel was as tall as the tab showing; it is now as tall as its tallest tab (capped as before), so switching tabs doesn't resize it, and a short tab leaves room. Checked with Playwright in Chromium and WebKit with the clock on Tuesday 09-29: 10月5日 12:21前有效, and one height on every tab with one account and with five 2026-09-29 11:04:46 +08:00
yetone 6e7546337b grok: Grok Build is found on Windows where its installer puts it (#180: the Grok Build installer finished, but magpie can't find it) — magpie looked for ~/.grok/bin/grok, without .exe, and then only at the first grok on PATH, which on Windows may be another (an npm grok.cmd). Now it looks at GROK_BIN_DIR, the grok home's bin and ~/.grok/bin (grok.exe on Windows), then every folder on PATH and on the registry's PATH, which has what was installed since magpie started, taking a grok there only under a .grok folder; the install-first error gives the PowerShell command on Windows. Tested the order and names of the places looked at, and which grok is taken, in a fake home 2026-09-29 11:04:46 +08:00
yetone 57bcccc980 gateway: Claude Code's own headers reach a key+URL Anthropic provider (#179: 403 packy: This API endpoint is only accessible via the official Claude CLI) — magpie sent Claude Code's request on with only anthropic-version and anthropic-beta and its own User-Agent, so a relay that serves only Claude Code, telling it by claude-cli/ and x-app, refused it. Now a request from Claude Code to a provider without an account goes on with its User-Agent, x-app, anthropic-*, X-Stainless-* and x-claude-code-* headers and ?beta=true as it sent them; its key to magpie never does, the provider's own is set. Tested against a fake upstream: the headers and query arrive, the provider's key and not magpie's, another agent still goes as magpie 2026-09-29 11:04:45 +08:00
yetone 207042dd78 claude: the signed-in account is one account, and one out of quota hands over to the next (#177) — the account Claude Code is signed in to was named one way as a provider and another as a saved login, so it was served twice and its limits weren't found under its name; and claude auth status was asked with magpie's own ANTHROPIC_BASE_URL/token in the environment, telling of those rather than the sign-in. Now both go by ~/.claude.json's email (with the org), the CLI's email when that has none, and the status is asked without magpie's wiring. A turn the CLI ends with an error result (out of quota, rate limited) ends the reply there instead of waiting on, and a non-streamed one answers 429 for quota words, so another account takes over as in a stream. Tested: the account named as its login, the quota result ending the reply, another account taking over 2026-09-29 10:50:39 +08:00
yetone 69a14800d9 warmup: a window that hasn't started is started, and started again after a try that didn't take (#178) — the warm-up only acted on a window with a reset time, so a Codex or Claude account whose 5-hour window had never started (no reset time, nothing used) was never warmed. Now a window the usage reads as not started, or one the agent's windows should have but the reading lacks, is due at once when idle; a try that leaves it unstarted is tried again after 15 minutes, doubling to 4 hours; reading the usage and seeing a window not started kicks the warm-up rather than waiting its 10-minute round, and a warm-up forgets the cached usage so the new window shows. Tested with the repro of the issue, the backoff, and the kick 2026-09-29 10:50:39 +08:00
yetone 7047716de6 gemini: a Gemini CLI account lists the models Gemini CLI 0.61 offers it, Gemini 3.8 Flash among them (蒙面人 on Discord: 请问,这个不显示 Gemini 3.8 吗??) — magpie's list was Gemini CLI's of some versions ago, and the models it fetched were the account's quota buckets, which name models by Code Assist's ids (gemini-3-flash) and never 3.8 Flash. Now, as the CLI does, magpie asks Code Assist which experiments the account is in (listExperiments, at most hourly) and offers what the CLI's /model would: 3.1 Pro Preview or 3 Pro Preview, 3 Flash Preview (previews only with quota for one), 3.8 Flash where Google has rolled it out and 3.5 Flash where not, 3.5 or 3.1 Flash Lite likewise, 2.5 Pro and 2.5 Flash Lite; a request goes out under the id the CLI sends (3.5 Flash as gemini-3-flash, or as gemini-3.8-flash once rolled out), and quota buckets are shown under the models listed. The list magpie falls back on has 3.8 Flash, 3.5 Flash and 3.5 Flash Lite, and no longer the retired 3.1 Flash Lite Preview; magpie says it is Gemini CLI 0.61.0. Tested against a fake Code Assist with the experiments off, rolled out, and without Pro or preview access 2026-09-29 10:43:23 +08:00
yetone 2715696138 workbuddy: WorkBuddy AI chats carry the rest of the headers its own client sends (lightyear, Jerry lee on Discord: deepseek flash 提示 API error:400 workbuddy AI : illegal API invocation from an unapproved channel) — on the international build deepseek-v4.1-flash was refused as "from an unapproved channel" while GPT and Claude answered. WorkBuddy AI's desktop app lists what its /v2/chat/completions gateway needs ("x-requested-with 是网关的准入约定"), and its CLI sends the same on every chat: X-Requested-With: XMLHttpRequest, X-Agent-Intent: craft, X-Agent-Type: main, X-IDE-Name and X-IDE-Version, and conversation, message and request ids; magpie sent none of them. WorkBuddy AI chats now carry them; the China build, which serves that model already, is left as it was. Tested against a fake gateway that the headers and ids go out; not yet checked against WorkBuddy AI itself 2026-09-29 10:43:22 +08:00
yetone c286c218e3 routing: a group's intent classifier can be a routing group, failing over as any request to it does (lantern2077 on Discord: 意图分类模型能否也选择路由组?现在只能选择单个模型,缺乏回退保障) — the classifier was one model, and when it was down no intent matched. It can now be group/<id>, asked through magpie as before, so its first model failing the next is asked. A group can't be its own classifier, one that classifies for another can't be removed until that one chooses another, a rename carries over, and a classifier's own call asks no classifier in turn, so two groups classifying with each other don't loop. The GUI and TUI pickers list the other groups. Tested: the classifier group's first model 500s and the next answers and the rule matches; two groups set to classify with each other finish at once; checked in a sandbox magpie web that the picker lists Cls and not the group being edited, and via the CLI that self-classifying and removing a classifier group are refused 2026-09-29 10:25:41 +08:00
yetone 1963f7f262 providers: a provider's editor lists its image models under its models (Raven on Discord: 同样的 baseurl 和 key,识别不出来里面的 image 生图模型,cc 那边可以) — an image model isn't one an agent chats with, so it was never among a provider's Models chips, and nothing in the editor said magpie had seen gpt-image-1 in the vendor's list. Under Models an Image models row now lists them, as chips that can't be picked, saying the one that draws is chosen in Settings → Images. Tested with a fake vendor listing gpt-5.5, gpt-image-1 and flux-1-schnell; checked in a sandbox magpie web that the editor shows gpt-5.5 under Models and the other two under Image models 2026-09-29 10:17:30 +08:00
yetone 40fc5a8d87 panel: the tray panel stops at 560 points tall, not 720, and the rest scrolls in it (#124: 托盘图标这里 体验优化~用量这里 一下子弹出来多大一个框) — with several subscription accounts the Usage tab grew the panel to 720 points, most of a 1080p screen, dropping down from the tray as a big box; the panel now stops at 560 and the accounts scroll under the tabs, the footer staying put, as they already did past 720 2026-09-29 10:15:13 +08:00
yetone 034da2b693 providers: one that only draws images says how many image models it has, not "no models exposed" (#124: 供应商里面img模型读不出来,只有在设置里面可以看到) — an image model isn't one an agent picks, so a provider whose list had only image models read "no models exposed" under Providers although Settings → Image generation drew with them. Its row now reads 2 image models. Checked in a sandbox magpie web with a custom provider whose /v1/models lists gpt-image-1 and flux-1-schnell 2026-09-29 10:04:30 +08:00
yetone 93d74d2b81 workbuddy: requests are streamed to it, Test's too (#124: 测试 400 · Non-stream chat request is currently not supported, 对话正常的) — WorkBuddy refuses any request that doesn't stream, so its Test, a small non-streaming request, failed with 400 while agents, which stream, answered. A WorkBuddy account is now a backend that only streams: Test sends it stream:true, and the gateway streams it a client's non-streaming request and gives the client one answer, as it does Codex's and Google's. Tested: Test's request to such a backend streams on each endpoint, and a non-streaming chat request through the gateway to a fake upstream that refuses one comes back as one chat.completion 2026-09-29 10:01:21 +08:00
yetone 67480a037b accounts: WorkBuddy's daily check-in (签到) done for each WorkBuddy (China) account, when Settings says to (zhanglolo on Discord: 能不能加个 WorkBuddy 自动签到) — while WorkBuddy's check-in event runs, an account is given credits a day for pressing 签到 in the app. Settings has Check in to WorkBuddy daily (off by default, shown while a WorkBuddy China account is signed in): the gateway asks the event's status for each account and claims when it runs and today's isn't in, once a Beijing day; an answer holds for the day (claimed, already in, not eligible, the event over), no answer is tried again after 30 minutes. What came of it is kept by site and account id in workbuddy-checkin.json and shown under the setting. magpie accounts checkin [--json] does it now. WorkBuddy AI (international) has no event and is left alone. Tested with a fake WorkBuddy API; checked the row in a sandbox magpie web 2026-09-29 09:56:46 +08:00
yetone ea20c2db59 providers: Xiaomi MiMo is a preset, its Token Plan in China, Singapore or Europe or pay as you go (#174 供应商没有小米Mimo的) — MiMo could only be added as a custom provider with its base URL typed in. Now Xiaomi MiMo is under Vendors: a Token Plan's tp- key goes to its region's host (token-plan-cn / -sgp / -ams.xiaomimimo.com), pay as you go to api.xiaomimimo.com, each with chat completions and Responses at /v1 and Anthropic messages at /anthropic, as MiMo's Token Plan page gives them; its models from models.dev's xiaomi-token-plan-cn and xiaomi until Refresh asks MiMo. Checked in a sandbox HOME: the preset added on the Singapore plan lists 9 models, and Test reached all three endpoints of each host, answering 401 Invalid API Key to a made-up key (a wrong path is 404) 2026-09-29 09:46:22 +08:00
yetone 35ced89666 provider: a vendor's refusal is shown in its own words, not a bare 400 Bad Request (Mrhe525 on #124: WorkBuddy 和 WorkBuddy AI 测试都 400 错误,积分都是有的) — an error body was read only for an OpenAI/Anthropic-style error or message, or shown as it was when under 200 bytes; Tencent's {code, msg} (WorkBuddy's endpoints) and any longer body were dropped, so the provider editor's Test and the error an agent got said only "400 Bad Request", nothing of why. msg is now read too, and a body in no known shape is shown collapsed to one line and cut at 300 characters; an HTML page still says nothing. Tested: {code, msg}, a long JSON body, an HTML page and an empty body 2026-09-29 09:38:33 +08:00
yetone 860292fcc0 routing: a row answering another request says so, not "answering…" under this one's header (yonghe on Discord: 这个调用已经失败/结束,这里还是显示回答中) — the stage shows the rows of every request an agent has in flight, so when Claude Code's Sonnet side request failed while its Opus answer went on, the Opus row stood under the Sonnet route's header saying 回答中, as if that failed request were still answering. A row whose try belongs to a request other than the one the header and log tell of now says "answering another request…" (在回答另一个请求…); with several agents on the stage the wire's colour already tells whose it is. Checked in a sandbox magpie web with a slow and a fast model on one fake upstream: while the slow one streamed and the fast one had answered, the slow row read answering another request… under the fast one's header 2026-09-29 09:27:52 +08:00
yetone a46a6bb2ec providers: a custom provider named in Chinese is added under its site's name, and a second one beside it (mamba on Discord: 供应商里面自己添加第三方URL只能加一个吗,第二个会提示id重复) — a provider's id is its name slugged to Latin letters and digits, so a name such as 中转站 slugged to nothing and Add was refused ("provider id must be lowercase letters, digits and dashes, not \"\""). Now such a name takes its id from the host of its URL, api. and www. and the .com left off (api.relay-one.com is relay-one), and one on an IP address or localhost-like address is custom; a taken id moves on to relay-one-2 as before, and a second 中转站 is named 中转站 2. Tested: two 中转站 on one host, one on a host with a port, one on 127.0.0.1 and one on [::1] each added under its own id; checked in a sandbox magpie web that 中转站 is added beside another custom provider 2026-09-29 09:17:47 +08:00
yetone 3c043f7b2b settings: About's Community row links the GitHub repo beside Discord (#124: 这里能不能再加上tg群或者github的仓库链接,dis根本没啥人用感觉) — a GitHub button, next to Join Discord, opens github.com/yetone/magpie, where issues are filed and the code is; the row now says questions, ideas and feedback go on Discord or GitHub. There is no Telegram group, so none is linked. Checked in a sandbox magpie web, light and dark, and hovered 2026-09-29 08:36:10 +08:00
Charan Rathore ff4f730d0e gateway: keep one Chat choice when translating, including relay indexes (#168)
* gateway: keep only first Chat choice when translating

* gateway: test multi-choice stream keeps choice zero

Add test to ensure translation keeps first choice intact.

* gateway: follow the first observed choice index, accept string indexes

Updated the chatDecoder struct to include choice as a string and modified the handling of the index in the decode method to support various formats.

* gateway: test relay index forms and interleaved choices

Refactor comments for clarity and update test cases to ensure proper handling of choice indices in chat translation.

* gateway: follow the first observed choice index, accept string indexes

Refactor chat handling by removing unused types and functions. Introduce new functions for processing chat responses and tool calls.

* gateway: restore chat.go translation content

Refactor chat handling to support new request structure and improve parsing logic.

* gateway: keep the first readable Chat choice index in translation

Updated tool message handling to include images in user messages. Enhanced the tool result message format to include image URLs and additional notes about returned images.

* gateway: test readable, missing and malformed choice indexes
2026-09-29 04:39:52 +08:00
Charan Rathore 0b31315a47 gateway: 400 when a required tool choice leaves nothing callable (#169)
* gateway: 400 when a required choice has no callable tools

Added validation to ensure required tool choice is callable.

* gateway: force a single Gemini name only when it survives

Added conditions to ensure tool choice is set correctly based on allowed function names and tool availability.

* gateway: test required-choice allowlist rejection

* gateway: reject an allowlist that filters out every tool in shared parse

Refactor request parsing to handle required tool choices and improve error handling.

* gemini: narrow the required-tools guard to Responses allowed_tools and ANY allowedFunctionNames

Updated the logic for function calling modes to include 'VALIDATED' alongside 'ANY'. Adjusted comments for clarity regarding allowed function declarations.

* gateway: cover required-tool and filtered-empty allowlist rejections
2026-09-29 04:39:49 +08:00
Charan Rathore 42a13798bc gateway: keep Gemini affinity when the first turn omits role (#171)
* gateway: treat an omitted Gemini role as user for affinity

Add support for Gemini content handling and role omission.

* gateway: test roleless first-turn Gemini affinity

Added tests for role-less content handling and explicit user selection in conversation IDs.
2026-09-29 04:14:50 +08:00
Charan Rathore 42a39fdedf gateway: filter Gemini VALIDATED allowedFunctionNames on translated routes (#170)
* gateway: filter Gemini VALIDATED allowedFunctionNames

Updated function calling logic to accommodate both ANY and VALIDATED modes, allowing for named function declarations.

* gateway: test VALIDATED allowed-name filtering
2026-09-29 04:14:46 +08:00
yetone 504b470f12 gateway: images a tool returned reach a Chat model after the tool messages (charan-rathore in #167: Claude Code's tool_result images were dropped on the way to Chat Completions)
A tool result holding images, as Claude Code's screenshot tools and its Read of a .png send it (an Anthropic tool_result with image blocks) or as a Responses function_call_output with input_image parts, lost its images whenever the request was translated: the result was read as its text only, so a Chat model was told "Read shot.png" and never shown it, and a result that was only an image came through empty. #167 turned such a request away with a 400; now the images go through. The shared request keeps a tool result's images beside its text. Chat's tool messages hold text only, so a tool message says "[The tool returned an image; it follows in the next message.]" after its text, and the images go right after the run of tool messages, each result's labelled with the tool and call it came from ("[From the result of Read (tool call toolu_1):]"), as image_url parts (a data: URL for inline ones). When the user's own message comes next, as Claude Code's system reminder beside a result does, the images open that message rather than being a second user message in a row, which some models' chat templates turn away; otherwise they are a user message of their own, before the assistant's next turn. Tool messages still directly follow the assistant's tool_calls. An Anthropic upstream gets the images inside its tool_result, a Responses one in the function_call_output's output list, Code Assist as inlineData after the functionResponse, as Gemini CLI sends a file it read; Kiro, Cursor and Devin take the text as before. A model that can't see still has each image described in its place before translating, so nothing follows its tool message.

Tested end to end against fake upstreams: Claude Code's tool_use then a tool_result of text and a base64 PNG to a Chat model that sees (with and without the user's text after it), two parallel results with three images (base64 and a URL) giving tool, tool, then one user message with all three labelled, a screenshot from an older turn kept before the assistant's answer, Codex's function_call_output with input_image to Chat, Claude Code to a Responses provider, and a text-only model still given the description in the tool message. The four Chat tests fail without the change. go build, vet and the gateway tests pass; windows and linux (CGO off) build.
2026-09-29 03:44:28 +08:00
Charan Rathore bdf3d11f50 gateway: hash Gemini contents for the session-affinity fallback ID (#165)
* gateway: hash Gemini contents for the session-affinity fallback

Add Contents field to JSON structure and update item selection logic.

* gateway: test conversationID reads Gemini contents

* gateway: test Gemini session affinity keeps the provider key

Add test for Gemini client session affinity behavior.
2026-09-29 03:40:00 +08:00
Charan Rathore 3b6ea8b589 gateway: clear 400 for Responses images named by file_id on translated routes (#166)
* gateway: 400 on translated Responses images named by file_id

Add error handling for unportable current image in translate function.

* gateway: keep native file_id passthrough, reject on translation

Added hasUnportableCurrentImage function to check for images without a portable source.

* gateway: test Responses file_id image handling
2026-09-29 03:38:54 +08:00
Charan Rathore 995edc135d gateway: honor allowed-tool subsets from Gemini ANY and Responses allowed_tools (#164)
* gateway: honor Gemini ANY allowedFunctionNames subsets

Add support for allowed function names in ANY requests.

* gateway: honor Responses allowed_tools subsets

* gateway: test Gemini allowedFunctionNames filtering

* gateway: test Responses allowed_tools filtering
2026-09-29 03:38:21 +08:00
yetone e330cb815d workbuddy: a model the plan serves free says so (这个应该是Workbuddy国际版免费的模型,要不要在模型名字后面加上一个免费标记?) — WorkBuddy's product config gives each model the credits a request costs, as its own picker shows them: WorkBuddy AI's deepseek-v4.1-flash is "x0.00", its -sg twin "x0.03", GPT-5.5 "x1.00". A model at x0.00 (or 0) is now Free in the catalog, and carries it to the provider editor's model chips and every agent's model picker, where it has a green 免费/free badge after its name ("free: it doesn't use the plan's credits" on hover); a rate that can't be read is not free. Both WorkBuddy sites, as they share the config. A list fetched before this has no rates: Refresh in the editor asks again. Checked: the credits parse (x0.00, 0 free; x0.03, x1.00, none not), and the badge on a chip and in the picker in the sandbox, dark 2026-09-29 03:02:34 +08:00
yetone b2744c417e gateway: the package's tests no longer write routes to disk behind their backs (修一下CI里routing目录没清理的测试失败) — a done route was saved by a goroutine of its own, which could still be writing $XDG_CONFIG_HOME/magpie/routing when the test that made it had ended, so TempDir's cleanup failed with 'unlinkat …/magpie/routing: directory not empty' (TestCodexOwnModelRefusalPassesThrough, TestFallbackWhenOutOfQuota/overloaded, TestCodexOwnModelTraced on macOS CI). Saving done routes is now behind keepRoutes, on in magpie and off in the gateway's TestMain; the history's own tests call saveRoute themselves. Ran the gateway tests four times and the whole suite 2026-09-29 02:56:17 +08:00
yetone efed707066 providers: a provider can be switched off, kept with its keys but out of every agent's list (希望服务商可以有一个开关按钮,关闭后不再写入模型) — a provider whose quota ran out could only be removed, losing its key and settings, or left in, its models still written into the agents and requests still sent to it. Now each provider (a signed-in account too) has a switch on its row in Providers and in its editor's header; off, the row is dimmed and says Switched off (已关闭), its models leave the catalog, so the model lists magpie writes into agents' files are rewritten without them as after any provider edit, and it is left out of routing groups, fallbacks, the Automatic image, vision and search picks, the routing pools and balance and usage polling. A request naming one of its models is answered 404 saying the provider is switched off in Magpie, not that the model is unknown. Switched on, all of it comes back. Saving the provider from its editor keeps it off; magpie provider off|on <id> and the TUI's o do the same. Tested: an off provider's models are not in the catalog or served, a group with it routes to the member left, a fallback to it is not tried, a request for it is refused as switched off, and turned on it is listed and answers again; an account's off is kept. Checked the Providers page in a sandbox HOME in light and dark: switching a row off and on, the editor's switch and its note 2026-09-29 02:49:36 +08:00
yetone cdbd2250f6 providers: AIHubMix's GPT Image 2 and 2.5 can be picked to draw (我记得AI Hub Mix是有GPT Image 2以及GPT Image 2.5模型的,为什么选不到呢?) — AIHubMix's /v1/models, asked with a key, lists only its Gemini image models, though the same key draws with gpt-image-1/2/2.5 and the rest; its public catalog (aihubmix.com/api/v1/models) lists them all. Now when an AIHubMix provider's list is fetched, the image models of that catalog join it as drawing (Settings → Images, never offered to agents to chat with); Ideogram's V_2, DESCRIBE and UPSCALE are left out. Checked in a sandbox HOME against the real AIHubMix: after a refresh the picker has aihubmix/gpt-image-2, gpt-image-2.5-flare and 2.5-sunburst among 46 of its image models, and gpt-image-2 and gpt-image-2.5-flare each drew a 1024² PNG through the gateway 2026-09-29 02:37:58 +08:00
yetone ad9536af70 gateway: an empty reasoning_content is left out of a relayed Chat stream, so Qoder reads a WorkBuddy reply as one message, not a word to a line (lml on Discord: 在Qoder CN里面使用Workbuddy里面的模型的话,它这个输出不对) — WorkBuddy's endpoint (copilot.tencent.com/v2) goes on sending "reasoning_content": "" in every delta once the model has done thinking. Its own CLI ignores an empty one after the thinking is over (codebuddy.js: !(this.thinkingBlockCompleted&&""===ec.reasoning_content)), and Cline copes, but Qoder CN 1.1.64 takes each for the thinking starting again and each piece of text after it for a new message, so "hi" was answered one word to a line. A Chat stream magpie relays as it is now has an empty reasoning_content taken out of each delta; it says nothing, and any other line goes on byte for byte, split reads put back into whole lines first. Tested with a scripted Chat upstream streaming WorkBuddy's shape: the agent gets the thinking, the text, finish_reason and usage, and no empty reasoning_content (the test fails without the change); lines split every 7 bytes come out whole 2026-09-29 02:35:51 +08:00
yetone 04f82010a4 gui: the image model pickers keep routing groups in one group, as an agent's picker does (重大bug,这里为什么都是重复的icon?) — Settings → Images put each routing group in a group named after itself, so the picker's rail had a button for every one of them, each with its first member's icon: with 31 groups, rows of the same OpenRouter, AIHubMix, Claude Code, Codex and Copilot icons. A model without a provider of its own (a routing group) is now under Routing groups, one rail button with the fan, then one per provider. Automatic and Off, the picker's own choices, stay above the routing groups, which every model picker puts first. Checked with the live Settings' 31 groups and their providers: the rail is All, Favorites, Routing groups, OpenRouter, DeepSeek, 鱼鱼连线, AiHubMix, Claude Code, Codex, Copilot… once each, in light and dark 2026-09-29 02:34:01 +08:00
yetone d730192cc0 gui: the header's view switch is small again, and in dark mode a faint track with a lighter thumb (深色模式下,这一坨像膏药一样…以前我记得是挺精致的) — dc3f691 made its tabs 30px with 13.5px text, not asked for by anyone but by a loop tick that had just enlarged the profile chips after a Discord request; they are 24px and 12.5px again, as they were. In dark mode its track was --pill (#2d2d33), a solid slab lighter than the window, and the thumb on the view shown --card (#232327), darker than the track, so the switch read as a grey plaster with a dent in it. It now has tokens of its own: light as before (pill track, white thumb with its shadow); dark a track of white at 4.5% and a thumb of white at 10% with a hairline top highlight. Checked in the window in light and dark 2026-09-29 02:29:47 +08:00
yetone 4cc32dbcb0 routing: every request's route is kept on disk, for a day long gone to be looked at and replayed, with retention (历史中的路由记录是不是都应该保存下来,方便用户去回放?…这种历史记录会特别大,应该有自动的retention) — the trace holds only the last 60 routes, and only since the gateway started. Now each route, once done, is appended to ~/.config/magpie/routing/YYYY-MM-DD.jsonl; a day that is over is gzipped, days older than 30 are dropped, then the oldest until all of it fits 200 MB (today is never dropped), checked at most hourly. Route ids start at the time the gateway started, so they don't repeat across runs. /api/gateway/history?day= gives the days kept with their counts and a day's routes (its latest 2000). The Requests list has a chip per day (实时, 今天 3, 昨天, …): a day's requests can be picked, looked at, replayed all, or replayed from one on (从这里重放), with the real-time clock as before. Checked in a sandbox HOME against real DeepSeek: three requests written to the day's file, the gateway restarted, the list showed 今天 3 with them, 从这里重放 played them at 02:19:46 · 第 1/3, stop and 实时 came back to live 2026-09-29 02:22:35 +08:00