@magpie-community/opencode-zen-free-auth 0.1.9 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,6 +19,12 @@ magpie plugin login opencode-zen-free
19
19
  ## Sign in
20
20
 
21
21
  Enter `public` in the key field. No personal API key is needed.
22
+
23
+ Whatever is typed in the key field, the plugin signs in with the one
24
+ shared `public` credential: a key made under your own OpenCode account
25
+ does nothing here, and several of them don't make several accounts. Your
26
+ own Zen keys go in magpie's built-in OpenCode Zen provider (or OpenCode's
27
+ `opencode` provider), which takes several keys.
22
28
  The credential is kept in OpenCode's `auth.json` or magpie's
23
29
  `plugin-auth.json`.
24
30
 
@@ -50,15 +56,18 @@ The agent's tools are preserved. Zen's models often call OpenCode's own
50
56
  tool names; such a call is given the agent's tool whose name differs only
51
57
  in case (`bash` to `Bash`), or else only in case and `_`/`-` (`todowrite`
52
58
  to `todo_write`, `webfetch` to `web_fetch`), when exactly one does. A
53
- call with no such tool (or with no name) is left out of the reply, and
54
- the reply's text says which name was left out; a turn whose every call
55
- was left out ends as an ordinary answer. Tools run in the agent.
59
+ call of a tool the agent has no spelling of (`psh` beside `pwsh`, `bedit`)
60
+ reaches the agent as the model called it, as with any other provider: the
61
+ agent answers it with its own unknown-tool error, and the model corrects
62
+ the name and goes on. Only a call with no name is left out, and the
63
+ reply's text says so; a turn whose every call was left out ends as an
64
+ ordinary answer. Tools run in the agent.
56
65
 
57
66
  Zen's free tier only answers a request that carries tools, so a request
58
67
  is sent with the five core OpenCode tools the agent doesn't declare
59
68
  itself (`bash`, `edit`, `glob`, `grep`, `read`), described as not
60
- available. A call of one of them the agent doesn't have is left out like
61
- any other.
69
+ available. A call of one of them the agent doesn't have reaches the agent
70
+ like any other.
62
71
 
63
72
  Now and then Zen closes a streamed Chat Completions reply before its
64
73
  `[DONE]`. When the reply has said something and no tool call of it is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-zen-free-auth",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "OpenCode Zen free models through the public credential, with native streaming protocols",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",
package/provider.mjs CHANGED
@@ -257,7 +257,7 @@ async function server(_input, options = {}) {
257
257
  methods: [
258
258
  {
259
259
  type: "api",
260
- label: "Zen 免费访问(密钥填写 public)",
260
+ label: "Zen 免费访问(密钥填 public;自己的 OpenCode Key 请加到内置的 OpenCode Zen)",
261
261
  placeholder: "public",
262
262
  async authorize() {
263
263
  return { type: "success", key: "public" };
package/tool-response.mjs CHANGED
@@ -48,8 +48,13 @@ function foldsTo(declared, key) {
48
48
  return folded;
49
49
  }
50
50
 
51
- // nameGuard answers the agent's name for a call, or null for a call of no
52
- // tool the agent has (a missing name included).
51
+ // nameGuard answers the agent's name for a call: the agent's spelling when
52
+ // one folds to it, else the name as the model wrote it. A call of a tool
53
+ // the agent doesn't have (bedit, psh, mcp__netcatcatty__unused) goes to the
54
+ // agent as called, like any other provider's: the agent answers it with
55
+ // its own unknown-tool error, and the model corrects the name and goes on
56
+ // (#209). Leaving it out ended an agent's turn as a plain answer. Only a
57
+ // call with no name answers null, and is left out.
53
58
  function nameGuard(policy) {
54
59
  const declared = new Set(policy.declared);
55
60
  const lower = (name) => name.toLowerCase();
@@ -61,16 +66,15 @@ function nameGuard(policy) {
61
66
  if (declared.has(name)) return name;
62
67
  const match =
63
68
  byCase.get(lower(name)) ?? (byCase.has(lower(name)) ? null : byShape.get(bare(name)));
64
- return match || null;
69
+ return match || name;
65
70
  };
66
71
  }
67
72
 
68
- // The models also call tools no agent has: bedit, bcp, ash, a mangled
69
- // mcp__netcatcatty__unused (#76). Such a call can't be run or named onto
70
- // one the agent has, and failing the reply for it threw away the whole
71
- // turn. It is left out instead, and the reply says so in its text, where
72
- // the agent's user and the model's next turn both read it. A reply left
73
- // with no call ends as a plain stop.
73
+ // A call with no name can't be answered by any agent, and failing the
74
+ // reply for it threw away the whole turn (#76). It is left out instead,
75
+ // and the reply says so in its text, where the agent's user and the
76
+ // model's next turn both read it. A reply left with no call ends as a
77
+ // plain stop.
74
78
  export function droppedNote(name) {
75
79
  return typeof name === "string" && name
76
80
  ? `(The model called a tool this agent doesn't have: ${JSON.stringify(name.slice(0, 128))}. The call was left out.)`