ac4af582301a4e8a29245dbba767eba31334ddf9
23
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
88b541a25c |
images: every pointer names Settings › Models › Images, where the page is
The image models moved under Settings › Models, but the Library's Magpie
Image sheet, the MCP server's instructions to agents, the gateway's
"no image model" errors, the video tool's text and the docs still sent
users to "Settings › Images", a tab that no longer exists (the scattered
settings audit after netube99 on X). Every user-facing string now names
Settings › Models › Images in en, zh, zh-TW, ja and de, as do the site's
Qwen docs (en, zh, ja), llms-full.txt, the subsystem pages and comments.
Run in the tree with this change and the rest of the audit's fixes
(mote, base
|
||
|
|
e0a7664b53 |
image: GPT Image 2.6's complexity and 2.5's quality xhigh/max go through
StarBits on X asked whether magpie draws with the newest GPT Image (v0.1.3055/3056). This follows it: the images API and both image MCPs take GPT Image 2.6's `complexity` (low, medium, high) and pass it on, and the tools' quality text names xhigh and max (GPT Image 2.5 and later). - draw.go: complexity is read from JSON and form bodies (drawingRead) and sent, as given, to an images API that takes OpenAI's fields: generations (JSON and form) and multipart edits. Not sent to a ChatGPT (Codex) account, Copilot, OpenRouter, WorkBuddy, Grok or Volcengine. Volcengine used to get an unread complexity through Extra; it is now read, so it no longer goes there. - A ChatGPT account's image backend ignores it. Tried with a real account today: complexity none, low and a bogus value drew alike, and quality high, xhigh and max all came back quality "low" at the same size and tokens. So its request stays the one Codex CLI sends. - image_mcp.go, imagemcp.go: a `complexity` argument, forwarded; quality text lists xhigh and max. Run on mote at this tree (rebased on origin/main |
||
|
|
f86dd7910a |
openrouter: list every image model from its Image API, and draw them there
iwinux on Discord: the OpenRouter image picker listed only Nano Banana,
GPT-5.4 Image 2, GPT-5 Image and GPT-5 Image Mini, and asked whether the
protocol was the reason. It wasn't. OpenRouter's GET /api/v1/models lists
only models whose output includes text (454 rows on 2026-11-06, 13 of them
with image output), and that was the only list magpie read. The models
that answer in images alone (FLUX, Seedream, Riverflow, Recraft, GPT
Image, Krea, MAI Image, Qwen Image, Grok Imagine, Hunyuan, Muse) are at
its Image API's GET /api/v1/images/models (63 rows, no key needed), and
every one of them is served by POST /api/v1/images, which magpie already
spoke for FLUX/Seedream/GPT Image ids.
- catalog: openrouter.ai's public drawer list is /images/models; each row
becomes a drawer with its output modalities, release date, name without
the "Vendor: " prefix, and image input when it takes one.
- gateway: a model that answers in images only goes to /images, so
Recraft, Riverflow, Krea, MAI, Muse and Hunyuan (ids ImagesAPI doesn't
know) no longer go to chat completions. A pixel size is sent as
aspect_ratio plus resolution (2K/4K by the long side), since no
/images endpoint lists size and Riverflow refuses one: a real request
with "size":"1024x1024" got 400 "Sourceful V2 does not support explicit
pixel sizes. Use resolution and aspect_ratio instead." A ratio goes as
aspect_ratio; anything else (auto) as size.
- Recraft's vector models answer image/svg+xml: saved as .svg in the
gateway and in the image MCP (its sibling extOf).
Not listed: openrouter/auto (a router that may answer with an image).
krea/k3-edit is listed but only edits. Image prices are not imported
(OpenRouter prices per image per endpoint). Existing users see the new
models after their next model-list fetch.
Run (mote, at this tree):
- go test -count=1 ./internal/provider/ ./internal/catalog/ ./internal/imagemcp/: ok
- go test -count=1 -run 'Draw|Image|OpenRouter|ViaFor|Aspect|Drawer' ./internal/gateway/: ok
- gofmt -l internal: nothing; go vet of the four packages for darwin,
GOOS=linux and GOOS=windows: ok
- Real: the worktree's binary in a sandbox HOME (magpie-wt/orimg-scratch,
only the owner's OpenRouter provider copied in), serve on 127.0.0.1:3471,
magpie sync: "openrouter (405)" and 63 drawers in its live list,
Riverflow, Recraft, FLUX, Krea, MAI among them. POST
/v1/images/generations openrouter/sourceful/riverflow-v2-fast at
1024x1024: a 1024x1024 WebP back (27KB, 4175 output tokens).
Broken by hand: without the /images/models catalog entry,
TestOpenRouterImageModelsComeFromItsImageAPI fails ("/images/models asked
0 times"); sending size as given, TestOpenRouterImageOnlyModelsDrawAtItsImageAPI
fails (size 1024x1024 sent, aspect_ratio missing).
Not tried: a real draw with Recraft vector (SVG), Krea, xAI or MAI
through magpie; the GUI picker itself with the longer list; Windows and
Linux runs of the tests (vet only).
Reported-by: iwinux
|
||
|
|
788057340b |
library: Magpie Image Recognition in Discover beside Magpie Image and Web Search (matrix0487 on Discord, #4653)
matrix0487 asked on Discord (#feedback) for all three of magpie's own MCP servers, image recognition, image generation and search, in the Library's Discover. Image generation and search were there; image recognition was an address to copy in Settings only (#4653). - `magpie mcp vision` (browsermcp.RunVision) relays stdio to the gateway's /mcp/magpie/vision, as `mcp search` does. analyze_image's relative image path is made one in the agent's folder on the way (imageFrom), since the gateway can't know where the agent runs; an absolute path, ~, a URL or a drive goes as written. - library: magpie-vision is a featured, opt-in server (no agents until picked), any binary's `mcp vision` is one server (serverKey), and it gets the 120s tool timeout (selfTimeout). - Settings › Models › Images: the Image recognition row has Give agents Magpie Image Recognition… / Turn on the Library, none with recognition off or in gateway mode. The three links are one helper, libWay, used by Image generation and Web search too (no budget raised: core 1,533,011 of 1,533,105). - Never a dead tool: Discover lists all three whatever is set up, and one that can't answer yet says why (gateway.OwnUnready, set by /api/library/market/servers as `unready`): a "Not set up yet" badge on its card with the reason as its title, and the reason in its sheet (nothing set up, or turned off in Settings / Plugins). It can still be added; its tools already answer with the same reason until then. - Strings in en, zh, zh-TW, ja, de; docs/subsystems/library.md. Run, all on mote (macOS 27) through mote-run, at this head's tree (rebased on |
||
|
|
b1fc435407 |
library: Magpie Web Search, magpie's search MCP server in Library › MCP (lutra_fs)
lutra_fs on Discord: magpie's search MCP shows in Settings › Models but not in Library › MCP servers. They were right. The gateway's web search MCP (/mcp/magpie/web-search) was only an address to copy in Settings › Models › Web search. It was never a Library server, so no agent could be given it from the Library, and the Library didn't list it. Change: - `magpie mcp search`: a stdio relay to the gateway's search MCP, made by widening browsermcp's Magpie Browser relay into a bridge with its own path, title and an optional session (search sends none, and has a 5 minute client). It takes no arguments. When magpie isn't running, it says "Magpie Web Search can't be reached: start magpie". - library: Magpie Web Search (magpie-web-search) is a featured, opt-in server beside Magpie Image and Magpie Browser. It is installed with no agents, so the user picks them in its sheet, and it switches per agent like any other row. Its command is the full binary path, and serverKey treats any binary's `mcp search` as the same server. Each agent's tool timeout is at least 120s. - Settings › Models › Web search › MCP server: under the address there is a "Give agents Magpie Web Search…" link that opens its Library sheet, or "Turn on the Library" while the Library is off, as Images does for Magpie Image. Gateway mode has no link. - The sheet's hint says where each search goes and what it costs. All strings are in en, zh, zh-TW, ja and de. - docs/subsystems/library.md names magpie's own servers and the new one. - An agent in WSL gets it through the MCP router, as Magpie Browser does. The image-only WSL side() is unchanged. - The sibling, Image recognition's MCP server, is still in Settings only. That is filed as #4653. Run, at this head (rebased on origin/main |
||
|
|
0e90572274 |
browser: Magpie Browser, agents use the user's own browser and its sign-ins
The owner asked for a browser-use MCP of magpie's own, so an agent's browser keeps working when Claude Code switches accounts, and asked that it act in the browser the user uses every day: a fresh Playwright profile is signed in to nothing. Magpie Browser is an MV3 extension (internal/browserext, ID dmlhojidlfnkgamkekjhacgkpanbkeko, pinned by its key) that the user loads once in Chrome, Edge, Arc, Brave or another Chromium browser. It holds a WebSocket to the gateway's /v1/magpie/browser/extension and carries out each tool call with chrome.debugger (the DevTools protocol) in the user's own tabs. The socket is taken only from this computer, with a loopback Host (no DNS rebinding) and the extension's own Origin; a page or another extension that connected in its place would be handed every call. Agents reach it at /mcp/magpie/browser (Streamable HTTP) or through `magpie mcp browser` (stdio), and the Library's MCP market lists it as Magpie Browser, opt-in. Like the image server it is magpie's own, but it is never served to another computer, shared and with a key or not, and never to a web page, since it acts as the user wherever they are signed in. 17 tools: navigate (url, back, forward, reload), snapshot (an accessibility tree with refs, interactive-only on ask), click, type, press, select, hover, drag, upload, scroll, wait (text, gone, seconds), dialog, evaluate, text, screenshot (page, full page, element; JPEG or PNG), console and tabs (list, new, select, close). Each agent session goes on in its own tab; a link that opens a tab is followed, and a dialog a click opens is said in the reply. The Library's sheet for it has Set up the extension…, which writes the extension to ~/.config/magpie/browser-extension pointed at this gateway and shows the folder, the three steps to load it, and whether the browser is connected, polled while the sheet is open. Run: - TestBrowserToolsInARealBrowser: the extension magpie writes, loaded in a real Chrome for Testing 141 (Playwright's chromium-1234, headless=new) with --load-extension, connects, and all 17 tools act in a real tab of a fixture site. Green on mote (macOS 27), on xiaomi-gpu (Windows 11, win-run) and in magpie-desktop (Ubuntu 24.04, wsl-run). Under a test HOME Chrome needs --use-mock-keychain / --password-store=basic, or the extension's storage waits on a keychain and it never connects. - go test ./internal/gateway -run 'Browser|ReadOnly|Image', ./internal/ browserext, ./internal/browsermcp, ./internal/library, ./internal/gui -run 'Library|Browser', ./internal/cli on mote. - GUI: library-browser-setup.test.cjs (new) in Chromium and WebKit, en, zh, zh-TW, ja, de, at 1100 and 420 wide: 22/22. With i18n-keys and every library*.test.cjs: 915 pass, 1 fail, i18n-keys' "Unmarked", red on main since |
||
|
|
b78b1de003 |
library: magpie-image is behind the MCP hub, saving into the calling agent's project
magpie-image was the one MCP server the hub left out, because it saves what it makes on disk and needs to know whose project that is. The hub now serves its tools like any other server's and tells it where the caller works: 1. the hub answers a tools/call as SSE and asks the agent roots/list on that stream (3s), as Claude Code answers; 2. else Codex's _meta x-codex-turn-metadata.workspaces (git repos only); 3. else the Codex thread's cwd from its session file (sessions.CodexThreadCwd), only with session consent; 4. else none, and the image goes to ~/Pictures/Magpie as before. The hub passes `magpie/roots` and `magpie/client` in the call's _meta; imagemcp saves into the first root and names the agent on its usage row. Its result carries `magpie/model`, which the hub's own usage row takes, so the row says which image model drew it. A WSL agent keeps magpie-image as its own entry (the hub can't reach a path inside the distro). docs/subsystems/mcp-hub.md (mcp-router.md after the next commit), gateway-routing.md and gateway-sessions.md say so. It is rebased on #4382 ( |
||
|
|
d5d72a82af |
imagemcp, davsync: slow-download tests leave room for growing the download's buffer (#3419)
TestFourKImageByURLIsSaved, TestStalledDownloadSaysWhereTheImageIs and
TestSlowTransferIsNotCutShort shorten a download watchdog to 1 s or
300 ms. Each watchdog is put back when bytes come, and the time it
counts includes this process storing them: FetchImage's buf.Write, and
the GET's io.ReadAll, which in Go 1.26 fills fresh chunks half the size
of what has come. At the real 60 s that is nothing. At 1 s and 300 ms
these went red here, beside a full suite on a Linux box, with the line
never stopped:
big_image_test.go:153: after 4.096s: image 1 was drawn but couldn't
be downloaded (nothing came for 1s, after 4.2 MB)
big_image_test.go:207: image 1 ... (nothing came for 300ms, after
8.2 MB), the 4K image that comes in full
big_image_test.go:207: image 1 ... (nothing came for 300ms, after
0.0 MB), the same
stall_test.go:180: slow download: the server sent and took nothing
for 1s (GET): the line or the server stopped (twice)
A probe beside a full suite wrote 256 KB pieces into a bytes.Buffer up
to 10 MB, as FetchImage does. Of 262,440 writes, 20 were held over
300 ms: 19 grew the buffer from 8 to 16 MB (up to 1.3 s), and one was a
fresh buffer's first write (2.7 s). A goroutine sleeping 10 ms beside
them woke at most 57 ms late, so the time went into the memory, not
into waiting to run. A second probe touched fresh memory: 16 MB was
held up to 454 ms, 4 MB up to 278 ms, 1 MB and 256 KB at most 1 ms.
Now:
- TestFourKImageByURLIsSaved: the stall is 5 s (was 1 s), and the 4K
image comes in 256 KB pieces 200 ms apart (was 100 ms), about 8 s,
so the download still outlasts the stall that plays #1576's 2-minute
cap. The check that it was the slow one is now "longer than the
stall" (was 3 s).
- TestStalledDownloadSaysWhereTheImageIs: the stall is 1 s (was
300 ms), the stuck server sends 1 MB before it stops (was 3 MB), and
the image that comes in full is the small png the other tests serve
(was the 9.8 MB 4K one, whose buffer the 8.2 MB red was growing).
- TestSlowTransferIsNotCutShort: the backup is 2 MB at 512 KB/s, 64 KB
every 125 ms (was 24 MB at 6.4 MB/s), still about 4 s each way under
the same 1 s watchdog; the largest fresh chunk the read back fills is
then under 1 MB.
What was run (tree 8e4ecb44, on
|
||
|
|
1bbaded622 |
usage: an agent's call to magpie's own MCP tools is a row of Requests
ferock (Discord) asked to see calls to magpie's MCP tools, such as magpie-image's generate_image, generate_video and generation_result, in Routing > Requests. Each tools/call to magpie's own MCP servers (image, vision, web search, tools and the Library hub) is now a row of the request log. The row has Source and Kind "mcp", the tool as its model, the server as its host, how long the call took, and its error if it failed. The provider and model it shows are those of the model requests the call made, collected through the request's context in appendUsage. generation_result names the model of the job it answers. The stdio Magpie Image server reports each call it answered to the gateway as "magpie/toolCalled". That report carries the tool, ms, model and error, never the prompt. The arguments are never stored at all, so there is nothing to mask. The rows go down the probe lane: they are listed, but no total, host list, budget or key limit counts them. The model requests a call made are rows of their own. In the GUI the row reuses the Requests list. It gets a muted "MCP" badge with a tooltip, the server beside the provider, and a Succeeded/Failed status. The Purpose filter gains "MCP tool" in every language. There is no new page, no <select> and no left border. The core scripts went over their budget with the new purpose. genpurposes now writes purposes.js as compact JSON, which makes the core 448 bytes smaller than main in all, and coreScriptBudget is lowered to the new total, 1,538,975. No room is added. Run on mote, at the rebased head: - gofmt -l: clean. go vet -tags nogui ./... with GOOS darwin, linux and windows: ok. - go test -tags nogui -timeout 45m: ./internal/usage, ./internal/imagemcp, ./internal/usageapi and ./internal/gui ok. internal/budget has no test files. ./internal/gateway (805s): every test ok except five Antigravity and Codex/Grok tests. They fail the same on a clean origin/main |
||
|
|
fd5c631cbe |
image mcp: generate_image and generate_video take the model to use (XYenon)
XYenon on Discord asked whether an agent can pick the model magpie's image/video MCP draws with. Both tools now take an optional `model`, as provider/model: - The schema lists the models that may be asked (the Settings default first, then each on provider's OfferedDrawers or Videomakers), only those the calling gateway key may use. Up to 40 of them form an enum; past that, the description names three. - Left out, the Settings default is used, as before. - A bare id only one provider has, a ChatGPT account's other GPT Image name (ListedDrawer), or a newer family model (drawsFamily, grokVideoFamily) is accepted. Anything else is a tool error naming the models the key may use, and nothing is drawn. It never falls back. - The chosen model goes into the images/videos request's `model`, so the APIs' own key check (keyHolds, keyModelError, #882) refuses one the key may not use: the same check /v1/images makes. - The stdio Magpie Image server copies the gateway's `model` property from its tools/list, and asks the hidden JSON-RPC method magpie/media_model which model a call means. An older gateway (-32601) passes the model through as named. - `magpie tool generate_image --model ...` works through the schema; the usage text says so. Docs: gateway-routing.md (image MCP section), reference.md. Run (mote, via mote-run, at this tree): - gofmt -l: clean. - go vet ./... for darwin, GOOS=linux -tags nogui, GOOS=windows: ok. - go test -count=1 -timeout 45m ./internal/gateway/ ./internal/imagemcp/ ./internal/cli/: ok. Broken by hand: with `req["model"] = ref` dropped in imageMCPDraw and imageMCPFilm, TestImageMCPDrawsWithTheModelAsked, TestImageMCPModelHeldToTheKey and TestImageMCPVideoModelAsked go red (the default was drawn instead); restored, they pass. Not tried: a real vendor account. The fakes are easeled's art provider and the fake Grok. GUI files not run: no GUI file changed. |
||
|
|
b2d005bf38 |
gateway: a MiniMax API key makes videos with H3 (_tigerqueen_05867)
A MiniMax API-key provider (api.minimax.io, api.minimaxi.com, api.minimax.cn) now lists MiniMax-H3, -H3-Highspeed, -H3-Lite and -H3-Max as video models. They are never in chat lists. generate_video and /v1/videos start a task at <host>/v2/video_generation, poll /v2/query/video_generation/<id> and hand back the MP4. The prompt, seconds (raised to each model's minimum and capped at 15), resolution (from Extra or size, clamped to the model), ratio, first and last frame and up to 9 reference images go through. /v1/videos now reads last_frame; MiniMax and a remote magpie pass it on, other videomakers ignore it. The MCP schema is unchanged. Failures say which one it is: a turned-away key (1004/2049/401), no pay-as-you-go balance (1008/402), refused input or output (1026/1027), a Token Plan key without H3 (2061/2068/2057, which moves on to the next key), or the rate limit. AutoVideomaker puts MiniMax last, so generate_video, which has no model argument, uses MiniMax-H3 only when nothing else makes videos. All of it is gated on a MiniMax host, so no other vendor changes. Run on mote at 798c8fd48 (base |
||
|
|
ea1f9492bc |
cli: magpie tools lists, and magpie tool calls, the tools magpie's MCP servers give agents (iwinux)
iwinux on Discord (#feedback) wanted magpie's image generation, image recognition and web search without going through an agent's MCP, and had written a Python script for generate_image. magpie now has it: magpie tools [<name>] magpie tool <name> [--<param> <value>…] [<words>…] [-o <file|folder>] [--json] Both ask the running gateway's own MCP servers (gateway.OwnMCPServers: image, vision, web-search, plugin tools) over HTTP, with the local token and the magpie-tool/1 User-Agent, so the tools, schemas, models from Settings and usage counting are the ones an agent gets. Nothing is started besides (#3318: the cases sit before startUp, beside mcp). - Parameters are read against the tool's inputSchema: types (integer, number, boolean, array given once per item, object as JSON), enum, - and _ alike, --p v or --p=v. The words left over are the tool's one required text, else its prompt. An unknown flag or parameter, a missing required one, a bad value, a value given twice or both words and the same --param are refused with "nothing was called"; no request is sent. - A file path a parameter takes (its description says file and path) is made absolute, since the gateway doesn't know the current folder. - --help prints toolUsage (static): help is handled before anything runs. - A still-being-made answer is waited on with generation_result (1s between asks, 30 min at most). The gateway's image server now says so in _meta too: usemagpie.ai/pending is the id, usemagpie.ai/files the files made ({url, inline}); an older gateway is read from its text. - Images and videos are saved through imagemcp.Target (now exported): -o file or folder, else the current folder named from the prompt, numbered when more than one, never over a file that is there; a file not inline is downloaded by its path from the gateway asked (the token goes nowhere else). --json prints the raw answer and saves nothing. - No magpie at the address: "magpie isn't running at <url>: open the app or run magpie serve". MAGPIE_GATEWAY=<url> points at another. Docs: usage lines in magpie help, docs/reference.md (Use), the gateway routing subsystem page (_meta and the CLI), README en/zh, site docs start page en/zh/ja. Tests (internal/cli/tool_cli_test.go, never the network; every test sets MAGPIE_GATEWAY to its own httptest server): - TestToolsListsTheServersTools, TestToolReadsParameters, TestToolRefusesWhatItDoesntKnowAndCallsNothing (no tools/call, no file), TestToolHelpCallsNothing (no request at all), TestToolSavesTheImage, TestToolWaitsOnWhatIsStillMade (pending _meta, then the old text form, download with the key from the gateway asked, not the URL's host), TestToolErrorIsSaid, TestToolSaysMagpieIsntRunning, TestToolDrawsThroughTheGateway (the real gateway.New().Handler() with a fake vendor: lists, draws, saves the vendor's PNG). - TestImageMCPDrawsAndServesTheImage, ...SlowDrawingIsWaitedOn and ...MakesVideos now check the _meta. Red on the old behaviour: with withMeta setting nothing (what main answers) all three fail ("_meta map[], want pending img_…"). - Broken by hand: dropping the unknown-parameter check makes TestToolRefuses… red (the --model call was made); saving an inline image by its URL instead makes TestToolSavesTheImage red. Both restored. - TestHelpOnEveryCommandDoesNothing covers tool and tools. Run with this change on origin/main |
||
|
|
402577c15a |
gateway: image generation is an MCP server on the gateway, /mcp/magpie/image
JonahFu on X runs magpie in Docker in gateway mode, so he has no Library and
no stdio Magpie Image server, while image recognition is an HTTP MCP server
on the gateway (/mcp/magpie/vision). Now image generation is one too, with
the stdio server's tools: generate_image, generate_video and
generation_result, drawing with Settings › Images › Image generation.
- image_mcp.go: served by serveMCP, so it is guarded as the vision server
is (local or a shared magpie's caller, a refused Origin 403, POST only,
the key's limit reserved per call). A drawing is s.images run in-process
on a clone of the request (caller and key kept), so routing, key models,
usage and the timeout setting are draw.go's own. It runs as a job (15
min at most); the tool answers within 20s or gives an id that
generation_result waits on. Images come back as MCP image content (5 MB
each at most) and at /mcp/magpie/image/files/<name>, kept in memory an
hour, 256 MB at most, readable only by the key that made them. Videos
go through videosCreate/videosGet in-process and are given as
/v1/videos/<id>/content. Image generation Off is a tool error naming
where to turn it on, before the arguments are read.
- Input images go through the vision server's reader, now mcpImageSrc
(vision_mcp.go), so a file path is read only for a local caller.
- The tool schemas live in the gateway (ImageToolProps, VideoToolProps,
ResultToolProps); internal/imagemcp takes them and adds only its path
argument. Its tools/list JSON was compared byte for byte with the old one.
- Settings › Models: #imageMcpRow under #visionMcpRow with the address and
a copy button; the gateway-mode Image generation sub now points at it.
en, zh, zh-TW, ja, de.
The two rows are drawn by one helper (mcpRow), which took the vision
row's own code, so the row costs 462 bytes of app.js.
- core_budget_test: appScriptBudget 1,321,336 -> 1,321,424 and
coreScriptBudget 1,528,525 -> 1,528,972, the exact sizes with the row,
with no room added (10-25). Nothing moved out: the row is Settings'
own, which the core draws.
- search-api.test.cjs: the new row pushed the search row partly below the
1400px window at 420px, where scrollIntoViewIfNeeded leaves it, and
magpie puts back a scroll the reader didn't make, so the test's
coordinate clicks missed. It now brings the whole row on screen with
the wheel and checks it is still there a second later. Red with the new
row before this, green after; green on origin/main's GUI either way.
- oneport_test knows ImageMCPPath and ImageMCPFiles (ClientPath covers
them).
Run (worktree at this commit, on origin/main
|
||
|
|
197849ad4d |
gateway: image generation's timeout is a setting, 1 to 60 minutes
neighbads on X: a slow image endpoint needed more than the fixed 5 minutes. Settings > Images > Image generation timeout (imageTimeout in settings.json, 5 when unset, 1 to 60 accepted, anything else a 400) now gives every drawing that long, on each route it takes: - drawTimeout() reads the setting; drawWithin marks the context as a drawing and sets its deadline. Error texts say the time it was given (givenTo), ModelScope's task polling too. - A marked drawing goes through a vendor transport with no ResponseHeaderTimeout (drawsApart), since an images API sends its headers only once it has drawn; everything else keeps the 10-minute upstreamHeaderWait, so a 30-minute setting isn't cut at 10. - An image answered as a link is downloaded within the same time (imageLongest, never under ImageLongest). - Videos keep 5 minutes per call (videoTimeout): a video is made between its calls, so the setting isn't theirs. - magpie mcp image waits on a call up to callLongest (2h1m, past the 60-minute bound twice over), since it may not read the settings (WSL); ToolTimeout, which agent configs carry, is unchanged. - The plugin path: Bun 1.4.2's fetch has no 5-minute cap (tried against a server answering after 330s), so nothing changes there. - api.go keeps the saved value when a page doesn't send imageTimeout; prefsKeep carries it on every other Settings save. GUI: a segmented row under Image generation (5, 10, 15, 30, 60 min; a value set by hand gets its own segment), in en, zh, zh-TW, ja and de. Three GUI tests clicked controls the new row pushed under the window's foot or past the viewport; they now wheel to them with reader.cjs's reach (disabled-models, search-api, refusal-retries-setting). searcher-pick checks the help has no title before reach's pointer passes over it (the app's mouseover sets one on cut-short text). Run, at |
||
|
|
ea3dee96a8 |
gateway: a URL magpie didn't choose is downloaded from public addresses only, wherever the request came from
|
||
|
|
f0dc9ea695 |
imagemcp, gateway: a 4K image a relay answers by URL is saved, and one that can't be downloaded is answered with its URL, not lost (#1576, david-zdw)
What the reporter saw: generate_image (magpie mcp image) failed on 4K and 2048x1152 with "image 1: context deadline exceeded" and "no image: context deadline exceeded", while the same request to /v1/images/generations came back in ~40 s, and usage.jsonl showed the upstream's 200. Their relay answers with a URL whatever response_format says. Two causes, one per error: - "image 1: context deadline exceeded" was generate_image's own download of the URL (imagemcp.download): 2 minutes for the whole of it, on http.DefaultTransport, which knows the global proxy but not a provider's own (#237). A 10 MB PNG that was still coming was cut, and the error dropped the URL of an image already drawn and paid for. Any earlier image of n was saved but not said either. - "no image: context deadline exceeded" (the usage log's 502s at 300002-300032 ms) was the gateway's drawTimeout (5 min) expiring while it read a vendor's answer that had already begun: sendWith passed the bare context error up. The vendor really took over 5 minutes there; this commit doesn't change that limit, it says what happened. What changed: - gateway: an images caller that asks response_format "b64_json" gets the image itself. One the vendor gave only a URL for is fetched by the gateway's own client, through the provider's proxy (p.Via), after the draw and outside drawTimeout. One that can't be fetched is answered by its URL, as before, never dropped. A caller that asks no format still gets the URL. Nothing is sent to the vendor differently. - gateway.FetchImage: an image download gives up when nothing has come for ImageStall (1 min) or it has taken ImageLongest (5 min), and says which and how much had come. A slow download goes on while it moves. The edits' fetchPicture uses it too. - gateway: a vendor that began answering but hadn't finished in drawTimeout is a 504 "<name> began answering after Ns (200 OK) but hadn't sent all of its answer in 5m0s", not a 502 "context deadline exceeded". - imagemcp: asks for b64_json; downloads a URL the gateway still hands it with FetchImage; an image it can't have is answered with the vendor's URL to download it from, beside the ones saved (an error only when none was). Its client to the gateway waits ToolTimeout (11 min), past the draw and the fetch together, not 6 minutes. What was run: - Reproduced on the old code: the new TestFourKImageByURLIsSaved (a real 3840x2160 PNG, 9.8 MB, served by URL in 256 KB pieces over ~4 s) with the old download's 2-minute cap scaled to 1 s fails with the reporter's exact "image 1: context deadline exceeded"; the stalled case fails the same way, with no URL in the error. - Broke each part by hand and watched its test go red: no inline fetch, fetch not through the provider's proxy, the bare deadline message, the stall timer not reset (a total cap again), a lost image ending the call, the MCP not asking b64_json. - go test ./internal/imagemcp/ ./internal/gateway/ ; the full go test -tags nogui ./... ; gofmt -l ; GOOS=linux and GOOS=windows go vet on both packages. - On the Windows box (Windows 11 x64): imagemcp.test.exe all passed, and gateway.test.exe for the new tests and the images/ModelScope tests. Not tried: the reporter's relay itself (never contacted), and a real 4K draw end to end. Why their URL took over 2 minutes from the MCP when their own download took 7.5 s isn't known from here: a provider proxy the MCP didn't use is one way it happens; a slow file host is another. Both are covered now. |
||
|
|
16539c2ea9 |
imagemcp: generate_video and the Magpie Image card name every video model the gateway makes videos with, not a Grok subscription alone (#1399)
shen-joe (#1399) wants images and videos from magpie in PI-Desktop and WorkBuddy. Neither app sends video generation to a custom provider: PI-Desktop has no video generation at all, and WorkBuddy's VideoGen/ImageGen post to copilot.tencent.com's /v2/videos|images/generations with the account token. So the way those agents get videos is Library → MCP → Magpie Image (`magpie mcp image`). Its generate_video tool told the agent it works only "with a Grok subscription signed in to Magpie (it has no other video model yet)", and the Library card said the same, while gateway.Videomakers also makes videos with a preset plan's videos (Volcengine Ark Agent Plan's Seedance), another magpie, and a custom provider whose model list marks video models (#1446). An agent reading that can tell a Seedance user they need Grok. - imagemcp.go: generate_video's description and the package doc name each kind of video model. - library/market.go: the Magpie Image card says "a video model set up in Magpie (Grok Imagine, Seedance)"; zh, zh-TW, ja and de follow. - Tests: TestVideoToolSaysEveryVideoModel and TestMagpieImageSaysVideoModels fail on the old text and pass now. Run: go test -tags nogui ./internal/imagemcp ./internal/library ./internal/gui ./internal/gateway (ok) and ./... (only TestNoCommandBypassesProc red, from |
||
|
|
c426994196 | library, imagemcp: magpie's own image server is given to agents in WSL, started through WSL's interop with the paths crossing over (#900, cjyrainbow) — on Windows the Library names magpie-image by this machine's binary ('D:\tools\Magpie\magpie-windows-amd64.exe' mcp image), and turning it on for "Codex · WSL Ubuntu" or "Claude Code · WSL Ubuntu" failed: a Windows program was refused for every agent in WSL. WSL's interop starts a Windows .exe from inside the distro, so magpie's own server (args mcp image, whatever its binary) is now written for an agent in WSL by the binary's path in the distro, asked of the distro itself (wslpath -u, so a custom automount root is followed; asked once in ten minutes; /mnt/<drive>/ when it can't be asked), with --wsl <distro>, --mount where the drives aren't under /mnt/, --home the distro's $HOME, and WSLENV naming the variables it is given (MAGPIE_ADDR), which a Windows program otherwise doesn't get. A distro whose interop is off (no WSLInterop in binfmt_misc) is told so: turn it on in /etc/wsl.conf. A user's own Windows program is still refused, as before: its paths and variables wouldn't cross over. A Linux magpie in the distro isn't looked for: the Windows one reaches the gateway at 127.0.0.1 and reads this machine's settings, the same version as the app, which a Linux one would need the gateway's address from inside WSL for. With --wsl, magpie mcp image opens the paths the agent gives (its roots, reference images, where to save, ~/) as the distro's — /home/me/x through \\wsl.localhost\<distro>\home\me\x (\\wsl$\ where that isn't), /mnt/c/x as C:\x — answers the saved paths as the distro's (/home/me/app/generated-images/…, /mnt/c/…), and with no project falls back to the distro's ~/Pictures/Magpie. Tested on the Windows 11 test box: in a WSL2 Ubuntu 24.04 distro the library's probe gave /mnt/c/…/magpie.exe and interop:on, and this build, started from the distro as the library writes it (the .exe's /mnt/c path, mcp image --wsl, MAGPIE_GATEWAY through WSLENV to a stand-in gateway in the distro), answered initialize and generate_image with a root of /home/yeton/m900proj: a relative path and an absolute reference image (sent as /v1/images/edits), ~/m900proj/home.png and /mnt/c/… were each saved there and answered as the distro's paths. TestWSLMagpieImage (the /mnt/d command, --wsl, WSLENV, nothing rewritten or asked again at the next sync, a custom mount, interop off as a problem) and TestLinuxHome in internal/library, TestWSLPaths in internal/imagemcp are new and fail without the change; TestWSLServers (npx.cmd still refused) passes. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass (internal/provider failed once under load and passes alone). | ||
|
|
21702d01ff |
Add German translation; harden paths against unset env vars (#770)
* Add German translation and harden paths against unset env vars Add a German locale to the GUI, tray menu, usage alerts and website home page, and refuse to start when the home folder is unset or relative so nothing is written under the working folder; the pi plugin no longer adopts the user's PI_CODING_AGENT_DIR, and an inherited APPIMAGE no longer selects portable mode. Scripts refuse to run from the wrong folder or empty a shared out folder, and a new internal/testenv sandboxes every test package from the user's real files, which also fixes the Claude picker and Termux installer tests on Windows. * Makefile: know magpie's folder by its go.mod, so paths with spaces work The check compared $(CURDIR) with $(dir $(abspath …)), which make splits on spaces, so a checkout under 'My Projects' or 'John Doe' refused every target. It now reads go.mod relative to the working folder and wants magpie's module there: make -C and a symlinked Makefile work, make -f from another folder still stops before any recipe runs. * i18n: German for the strings main added since, with a parity test 75 strings main added (group order, patterns, slow-start wait, usage caps, RTK savings …) get their German, and two that main dropped go. gui-de.test.cjs checks, as gui-ja does, that de has every zh string with its placeholders and tags, and that the window reads in German when picked or on a German system. * appdir: ignore relative folder variables when reading, keep them for children CheckEnv no longer unsets anything. magpie reads the XDG folders, APPDATA/LOCALAPPDATA and every agent's folder variable through appdir.Getenv/LookupEnv, which pass over a relative value; the environment stays as it is, so the agents magpie starts get the variable as the user set it. That covers what proc.UserPath lends from the login shell too, which is set after main's check and reached the desktop app unchecked. On Windows a path rooted on the current drive (\Users\x, Git Bash's /c/x) counts as usable, and magpie version and help answer without a home, before run makes any folder. * Sandbox the tests main added since internal/wslrun gets testenv's TestMain, and four tests main added that set HOME alone set their home with testenv.SetHome, so on Windows they don't read the runner's profile through USERPROFILE. * agentenv: PI_CONFIG_DIR and OPENCODE_DB take relative names on purpose omp puts $PI_CONFIG_DIR under the home and OpenCode a relative $OPENCODE_DB in its data folder, so neither depends on the working folder: appdir no longer passes them over. * i18n: German for the Library's multi-select and System One's decision API The 19 strings main added since (#791's skill multi-select, the decision API snippets) get their German; the one main replaced (four APIs → five APIs) goes. * appdir: tidy the import into magpie's group; say what Go makes of /c/x The appdir import joins the group of magpie's own imports where a file has one. rooted's comment now says that Go takes a Git Bash path like /c/x as \c\x on the current drive, not C:\x. |
||
|
|
01a7b55050 |
imagemcp: an image that takes longer than the agent gives a tool call is answered "still being made" before the agent gives up, and is saved all the same (#575: 图片生成的mcp经常遇到超时问题 — "Tool execution timed out after 30000ms" in one agent, "Error: Request timed out" in another; the agent then looked for the file, found none, and asked for the image again, and again timed out) — generate_image held its tools/call open until the gateway's image came back, and an image model (gpt-image at quality high, 1024x1536, through a subscription) often takes a minute or more, while agents give an MCP tool call as little as 30 s, the MCP SDK's default is 60 s, and only Codex and Goose have a timeout magpie writes for them (tool_timeout_sec, timeout). So the call was cut short, the generation went on unseen, and the agent's retry started another one that was cut short too. Now each generate_image and generate_video call runs as a job that goes on to its end whatever becomes of the call, and the call waits for it at most answerWithin (20 s, under the shortest of those limits): what is ready by then is answered as before (errors too); what is not is answered, not as an error, that it is still being made, where it will be saved, not to ask for it again, and an id for the new tool generation_result, which waits on the job the same 20 s at a time and answers its paths once it is saved. A call given a progressToken is sent notifications/progress every 5 s while it waits, for clients that wait longer on progress, and magpie mcp image waits for jobs still running when the agent closes it (up to ToolTimeout) so what is being made is saved. TestSlowImageAnswersBeforeTheAgentGivesUp (a gateway taking 700 ms against a 150 ms answerWithin: the call answers in time with an id and progress notifications, generation_result then answers the saved file, the gateway was asked once, an unknown id is a tool error) fails without the change (the call took 703 ms and answered only when the image was saved). go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui -count=1 ./... under a temp HOME pass (TestFXInState's known TempDir cleanup flake aside); go test -race ./internal/imagemcp passes.
|
||
|
|
0361189f9e | test: every package's tests pass on Windows, and none writes outside its sandbox (the user: 把 Windows 上那几个失败的测试修掉) — on a Windows box the suite failed in most packages, and the root package hung for 25 minutes. Tests set HOME, which os.UserHomeDir ignores on Windows (it reads USERPROFILE), so they read and wrote the runner's own home; each now sets USERPROFILE beside HOME, and Devin's, Goose's, Crush's and Claude Desktop's tests set APPDATA/LOCALAPPDATA, where those keep their files there. said() read the command's output only once it returned, and a pipe holds a few KB on Windows, so magpie model --help blocked forever; it reads while the command writes. Unix permission bits (the gateway key store's 0600 too), exec bits and symlinks Windows lacks are checked only off Windows; TOML strings hold Windows paths as literal strings, JSON as marshalled ones; a URL's path is compared as one. The provider and usage packages run in a home of their own (TestMain, as the gateway's already does), since a CLI's identity kept by a refresh still going when its test ended landed in the runner's ~/.config/magpie — and on a Mac in the user's own. Two product fixes came out of it: imagemcp took a file:///C:/… root or image for the path /C:/…, which doesn't exist on Windows, and now makes a Windows path of it (a host for a UNC share); and session discovery could keep a new Cowork session hidden on Linux, where a folder's mtime is a kernel tick and its size doesn't change, so an entry added within the tick of the last listing left both as they were — a listing made within 2s of its folder's last change is read again, as git does for racy files. TestFilePath and TestRacyDirectoryListedAgain fail without the change. On Windows 11 every package passes (32 of 32) and a run of each package in a fresh home leaves nothing in home, APPDATA or LOCALAPPDATA; on Linux (WSL) and macOS go test -tags nogui ./... passes. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build pass. | ||
|
|
f1906bca6a |
gateway: draw and film through a Grok subscription (Grok Imagine) (#360)
* gateway: draw through a Grok subscription (Grok Imagine) A Grok subscription (SuperGrok, X Premium+) could not draw: Drawers() returned nothing for it and draw() refused with "Grok (SuperGrok) can't draw: magpie draws only through an OpenAI-compatible API, and Grok (SuperGrok) has none". Grok Build's own image_gen / image_edit tools call the backend's Imagine API at <cli-chat-proxy.grok.com/v1>/images/generations and /images/edits with the CLI's sign-in, which magpie already uses for chat. - drawsGrok / grokDrawers: a Grok account draws with grok-imagine-image and grok-imagine-image-quality, like a ChatGPT account does with GPT Image - the Imagine API takes an aspect ratio, not a size or quality: size WIDTHxHEIGHT is matched to the nearest ratio it accepts (aspectAmong, aspectOf is unchanged); the image is asked for as base64 - an edit is JSON with the images as data URLs - a plan's images cost nothing extra, so AutoDrawer ranks Grok with ChatGPT (ChatGPT still wins a tie on release date) - provider.grokBase is exported as GrokBase, like CodexBase, for the test Tested against a real SuperGrok account through the gateway: generation, 16:9, the quality model and an edit. Video is not covered: the Grok CLI's video tools need zero data retention off or a storage bucket. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * gateway: film through a Grok subscription, and a generate_video tool for agents A Grok account that draws (c6578bc) can make videos too: Grok Imagine's video endpoints sit behind the same sign-in. The gateway speaks OpenAI's Videos API, so its SDK works as it is: POST /v1/videos, GET /v1/videos/{id}, GET /v1/videos/{id}/content. A request is taken on at once and polled; the id carries the provider and the vendor's request id, so nothing is kept in the gateway and a restart loses no video. Status is mapped (pending at 0% -> queued, pending -> in_progress, done -> completed, failed/expired -> failed, with why). seconds (1-15, the vendor's limit, which it says when exceeded), size (-> aspect ratio and 480p/720p/1080p by the shorter side), input_reference for image-to-video (URL, data URL, {image_url}, or a multipart file) and reference_images are taken; a model that isn't a Grok video model is refused by name. /content answers 409 until the video is ready. `magpie mcp image` lists a second tool, generate_video: it starts the video, waits (up to 10 minutes), saves the mp4 into the project (generated-videos/ unless path says where, never over a file) and says where, so an agent can animate an image it just drew by passing its path. Checked against a real SuperGrok account: text-to-video, image-to-video (input_reference), reference_images, both video models, the OpenAI Python SDK (videos.create/retrieve/download_content), the MCP tool end to end with two videos at once, and the error paths. Unit tests use a fake Grok upstream. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * gateway: videos follow the Settings' off switch, and an id can't change the vendor's path Review of the video change: - Image generation "off" turns off the video a request that names no model gets (videomaker, beside drawer), so generate_video says it is off too. - A video id is put in the vendor's URL with the account's token: its parts must be [A-Za-z0-9_-]+ (parseVideoID) and the vendor id is path-escaped, so video_grok.x%3Fa=1.1 and %2F answer 404 and ask the vendor nothing. - The id carries a short mark of the account that started it; after a switch the video says it was started with another account instead of the vendor's not-found. - generate_video waits up to ten minutes, and Codex gives a tool a minute: magpie-image's Codex entry gets tool_timeout_sec (Goose's timeout) of eleven minutes, the user's own value kept. - grok-imagine-video stops at 720p (the vendor turns 1080p away for it; 1.5 makes 1080p), so a 1080p size is asked at 720p there. - A model may be named without its provider (grok-imagine-video). - "seconds": 6.0 is 6; 6.5 is still refused. - completed_at is left out: the vendor doesn't say when a video finished, and a time made up at each poll changed each time. Checked against a real SuperGrok account: bare model name, seconds 2.0, 1080p on the base model asked at 720p (the mp4 is 1280x720), 1080p accepted on 1.5, both malformed ids, no completed_at. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * gateway: TestVideoModelByItsBareName asks its two models in a fixed order It checked the body of the second request the upstream got, but asked the two models by ranging over a map, so it failed about one run in seven (Ubuntu CI). Ask them from a slice. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * library: an installed magpie-image gets the longer tool timeout on the next sync magpie-image already ships, so many users have it in Codex and Goose as it was written before: no tool_timeout_sec in Codex, and the timeout: 300 every Goose server was given. syncMCP skipped an entry whose command, args and env were unchanged, so an upgrade left Codex at its one-minute default, and Goose kept 300 as if the user had chosen it. - mcpFile.behind says an entry lacks the timeout magpie gives the server now: Codex's tool_timeout_sec is missing, or Goose's timeout is still exactly the 300 magpie wrote. syncMCP rewrites such an entry; merged() doesn't keep that 300 as the user's. A value the user chose (any other number) is left alone. - Test: an entry as main wrote it is given 660 in both, one the user set stays, and a second sync changes nothing. It fails without the change ("changed []"). Also, from the review: - seconds is validated once in readFilming: a decimal number that is whole and at least 1 (hex, inf, nan, underscores, negatives and 0 are refused), and the object echoes 6 for 6.0. - imagemcp: Run's doc comment is above Run again. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> |
||
|
|
3ee4ebbf62 |
images: agents can generate and edit images with a model set in Magpie (让Magpie支持配置图像识别模型以及生图模型, part 2) — the gateway answers /v1/images/generations and /v1/images/edits for any model that draws: an images-API model (gpt-image-1, dall-e, imagen, a relay's) is sent the vendor's own images request (an edit as multipart, image[] per reference); a chat model that answers with images (OpenRouter's Nano Banana and GPT-5 Image, gpt-5-image) is asked with modalities ["image","text"], the size given as an aspect ratio, once per image asked for; Gemini's own image models over generateContent. Either way the answer is the images API's (b64_json with its mime_type, the model's text, usage), recorded in usage like any request. The model is Settings → Images → Image generation: Automatic (a model that draws among the providers set up, from the catalog's image-output models), Off, or any model; a request that names none is drawn by it, and with it Off is refused saying where to set one. Subscriptions draw nothing yet. magpie mcp image is a stdio MCP server with one tool, generate_image (prompt, size, n, path, reference_images): it asks the agent for its roots, saves each image in the project (assets/ by default, a name from the prompt, never over a file, the extension of what came back — a JPEG asked for as hero.png is hero.jpg), and says where; reference images are read from the project and sent as an edit. Its requests carry the agent's own name (claude-code/… magpie-image/1) so usage says which agent drew. Library → MCP servers → Discover has it as Magpie Image, opt-in: no agent is given it until picked, since every image costs what the model charges. Checked in a sandbox HOME against real vendors: OpenRouter's gemini-3.1-flash-lite-image drew a 3:2 magpie over MCP as Claude Code and edited it from the saved file as Codex (usage: claude, codex), AIHubMix's gpt-image-1 answered /v1/images/generations with a 1024² PNG; the Settings row and picker in light and dark, the Library card and its opt-in sheet
|