f2eb56c6bbde1300dddc402861b59cd4e45e0215
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
eaa71168a2 |
import: OpenCode's ids for vendors magpie has a preset at the same address come in on it (#2405)
openCodePresets held 19 of OpenCode's provider ids. 15 more are at the
address of a magpie preset, and the import picker listed each as
skipped, "it has no base URL", which isn't so: zhipuai, zai, alibaba,
alibaba-cn, minimax, modelscope, kilo, cline-pass, kimi-code-plan-cn,
kimi-code-plan-global, stepfun-step-plan, stepfun-ai-step-plan,
volcengine-coding-plan, alibaba-token-plan-cn and tencent-token-plan.
Each now comes in on its preset, the way openai's key does.
Left out, where auth.json says nothing to pick a region by: the coding
plan ids of Zhipu, Z.ai, MiniMax and Tencent, the pay-as-you-go ids of
plan-first presets (stepfun, stepfun-ai, volcengine), and the Xiaomi
MiMo token plans, served by a plugin now.
Patch by ggbdpq (Discord gua2100), as posted in #2405. Review: each of
the 15 targets' default endpoints was printed from Preset() at this
tree and matches the host models.dev gives the id (zhipu and zai
default to the pay-as-you-go paas/v4, volcengine to api/coding/v3,
stepfun and stepfun-cn to step_plan, tencent-cloud to plan/v3), so no
key is sent to a host OpenCode wouldn't send it to. No preset added.
Run (sandbox HOME, at origin/main
|
||
|
|
37fec12409 |
import: OpenCode's keys come in from its auth.json, Go's on OpenCode Go (@hu_xiaomi on X)
@hu_xiaomi on X asked whether magpie could pick up OpenCode Go's API key
by itself. OpenCode keeps what `opencode auth login` signs in to in
auth.json, in $XDG_DATA_HOME/opencode (~/.local/share/opencode when that
is unset, on Windows too). Its format and path were checked against
anomalyco/opencode v1.19.0, packages/opencode/src/auth/index.ts.
- OpenCode is now a source in the import picker (appReaders,
import_opencode.go). An "api" key comes in on the magpie preset with
the same id: opencode-go on OpenCode Go, opencode (Zen) on OpenCode
Zen, and a vendor's key (openai, anthropic, deepseek, openrouter, ...)
on that vendor's preset, the same way Alma's almaPresets work.
- auth.json keeps no address beside a key, so a key for a provider with
no preset is listed and skipped ("it has no base URL"). Sign-ins
(oauth: Claude Pro/Max, Copilot; wellknown: an enterprise server's
token) are listed and skipped with the reason the picker already
translates. No new GUI strings.
- OpenCode is read only when the user opens the picker. The Providers
page's automatic discovery leaves it out (DiscoverSources, the `asked`
flag), because the file holds every sign-in OpenCode has. magpie never
writes to it. OPENCODE_AUTH_CONTENT is not read.
- presetAt: the first preset at a host won even when a later one matched
the URL exactly. OpenCode Zen and Go share opencode.ai, so a Zen key
would have landed on Go. An exact match now wins.
- importSources: a source whose stat fails with anything but not-exist
(a folder magpie can't search) is found with an error, which means
unknown. Before, it read as "Not found".
- The picker's tab shows OpenCode's own mark (icons/opencode.svg).
- docs/reference.md describes the source.
Not added: an "use the key OpenCode has" offer in the OpenCode Go add
sheet, because no other app has one there (no sibling to follow).
Run (macOS, go1.26.8, worktree at
|