@magpie-community/opencode-zen-free-auth 0.1.12 → 0.1.14
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 +5 -0
- package/package.json +1 -1
- package/provider.mjs +2 -0
- package/tool-response.mjs +8 -0
package/README.md
CHANGED
|
@@ -20,6 +20,11 @@ magpie plugin login opencode-zen-free
|
|
|
20
20
|
|
|
21
21
|
Enter `public` in the key field. No personal API key is needed.
|
|
22
22
|
|
|
23
|
+
Hosts supporting magpie's `keyless` and `single` auth metadata can enable
|
|
24
|
+
this public identity without a key field and offer Sign in again instead
|
|
25
|
+
of another account. Older hosts and OpenCode keep the public-key flow.
|
|
26
|
+
Personal keys still belong to the built-in OpenCode Zen provider.
|
|
27
|
+
|
|
23
28
|
Whatever is typed in the key field, the plugin signs in with the one
|
|
24
29
|
shared `public` credential: a key made under your own OpenCode account
|
|
25
30
|
does nothing here, and several of them don't make several accounts. Your
|
package/package.json
CHANGED
package/provider.mjs
CHANGED
|
@@ -252,11 +252,13 @@ async function server(_input, options = {}) {
|
|
|
252
252
|
},
|
|
253
253
|
auth: {
|
|
254
254
|
provider: PROVIDER,
|
|
255
|
+
single: true,
|
|
255
256
|
icon: "https://opencode.ai/favicon-v3.ico",
|
|
256
257
|
maxConcurrency: 2,
|
|
257
258
|
methods: [
|
|
258
259
|
{
|
|
259
260
|
type: "api",
|
|
261
|
+
keyless: true,
|
|
260
262
|
label: "Zen 免费访问(密钥填 public;自己的 OpenCode Key 请加到内置的 OpenCode Zen)",
|
|
261
263
|
placeholder: "public",
|
|
262
264
|
async authorize() {
|
package/tool-response.mjs
CHANGED
|
@@ -345,6 +345,14 @@ function chatBuffer(checkName) {
|
|
|
345
345
|
const index = position(fragment.index);
|
|
346
346
|
const previous = state.calls.get(index) ?? { index, function: {} };
|
|
347
347
|
const value = { ...previous, ...fragment, index, function: previous.function };
|
|
348
|
+
// 空 ID 片段不应抹掉已缓存的有效 ID,同时允许首次 ID 后续到达。
|
|
349
|
+
if (
|
|
350
|
+
typeof previous.id === "string" &&
|
|
351
|
+
previous.id.length > 0 &&
|
|
352
|
+
(fragment.id == null || fragment.id === "")
|
|
353
|
+
) {
|
|
354
|
+
value.id = previous.id;
|
|
355
|
+
}
|
|
348
356
|
if (fragment.function != null) appendFunction(value.function, fragment.function);
|
|
349
357
|
state.calls.set(index, value);
|
|
350
358
|
}
|