zen-free: declare keyless single-identity access (#205, LoKi)
Marks Zen Free's api method keyless and its auth single, so magpie's host (yetone/magpie#2695, 5871f02dd) signs it in with no key field and Sign in again instead of another account. authorize is unchanged; older hosts and OpenCode keep the public-key flow. Run at the PR head 29f0e9b38: bun test in packages/zen-free under a sandbox HOME, 175 pass, 0 fail. Checked against magpie main: host.js reads m.keyless (api method with authorize) and auth.single, the two fields this sets. Co-authored-by: LoKi <317300729+lokic7123-star@users.noreply.github.com>
This commit is contained in:
@@ -20,6 +20,11 @@ magpie plugin login opencode-zen-free
|
||||
|
||||
Enter `public` in the key field. No personal API key is needed.
|
||||
|
||||
Hosts supporting magpie's `keyless` and `single` auth metadata can enable
|
||||
this public identity without a key field and offer Sign in again instead
|
||||
of another account. Older hosts and OpenCode keep the public-key flow.
|
||||
Personal keys still belong to the built-in OpenCode Zen provider.
|
||||
|
||||
Whatever is typed in the key field, the plugin signs in with the one
|
||||
shared `public` credential: a key made under your own OpenCode account
|
||||
does nothing here, and several of them don't make several accounts. Your
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import {test,expect} from "bun:test"
|
||||
import {ZenFreePlugin} from "./index.mjs"
|
||||
|
||||
test("Zen Free declares one keyless public identity without changing authorize",async()=>{
|
||||
const hooks=await ZenFreePlugin({client:{auth:{set:async()=>{throw Error("unexpected auth write")}}}})
|
||||
expect(hooks.auth.single).toBe(true)
|
||||
expect(hooks.auth.methods[0].keyless).toBe(true)
|
||||
expect(await hooks.auth.methods[0].authorize({})).toEqual({type:"success",key:"public"})
|
||||
expect(await hooks.auth.methods[0].authorize({key:"personal-fixture"})).toEqual({type:"success",key:"public"})
|
||||
})
|
||||
@@ -252,11 +252,13 @@ async function server(_input, options = {}) {
|
||||
},
|
||||
auth: {
|
||||
provider: PROVIDER,
|
||||
single: true,
|
||||
icon: "https://opencode.ai/favicon-v3.ico",
|
||||
maxConcurrency: 2,
|
||||
methods: [
|
||||
{
|
||||
type: "api",
|
||||
keyless: true,
|
||||
label: "Zen 免费访问(密钥填 public;自己的 OpenCode Key 请加到内置的 OpenCode Zen)",
|
||||
placeholder: "public",
|
||||
async authorize() {
|
||||
|
||||
Reference in New Issue
Block a user