@magpie-community/opencode-qoder-auth 0.2.64 → 0.2.65

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.
Files changed (3) hide show
  1. package/README.md +3 -0
  2. package/index.mjs +8 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -162,6 +162,9 @@ itself.
162
162
  reasoning and usage.
163
163
  - Tool calls Qoder writes as XML or JSON in its text become tool calls.
164
164
  Tool calls it sends the OpenAI way keep Qoder's id.
165
+ - Two calls sent the OpenAI way at one index, each with its own id, are
166
+ two calls (since 0.2.65, #930). A piece with no id, or the open call's
167
+ id, is more of the open call.
165
168
  - A call sent the OpenAI way that never gets its function name is never
166
169
  sent on, and its arguments go nowhere (since 0.2.51, #579). If nothing
167
170
  of the answer came before it, the request is sent once more; a second
package/index.mjs CHANGED
@@ -2224,6 +2224,7 @@ async function* events(body, tools = []) {
2224
2224
  const a = new Splitter(tools)
2225
2225
  let index = -1 // the tool call being given
2226
2226
  const native = new Map() // upstream index -> call and its output index
2227
+ const begun = [] // every native call, one an index has moved past too
2227
2228
  // one piece of the split text as an event: a call, text, or a call that
2228
2229
  // can't be read, which ends the turn as a 502
2229
2230
  const piece = (f) =>
@@ -2281,9 +2282,14 @@ async function* events(body, tools = []) {
2281
2282
  const args = tc.function?.arguments ?? ""
2282
2283
  if (!tc.id && !name && !args) continue
2283
2284
  let call = native.get(i)
2284
- if (!call) {
2285
+ // A new id at an index already in use is a new call: Qoder Ultimate
2286
+ // has sent two calls at index 0, and the second's arguments ran
2287
+ // into the first's as {"a"}{"b"} (plugins#930). No id, or the same
2288
+ // one, is the open call going on.
2289
+ if (!call || (tc.id && call.id && tc.id !== call.id)) {
2285
2290
  call = { id: "", args: "" }
2286
2291
  native.set(i, call)
2292
+ begun.push(call)
2287
2293
  }
2288
2294
  if (tc.id) call.id = tc.id
2289
2295
  if (call.index === undefined) {
@@ -2331,7 +2337,7 @@ async function* events(body, tools = []) {
2331
2337
  // text, reasoning and named calls already given are kept: qoder-cn's
2332
2338
  // qfmodel did this now and then, and the whole turn failed with an
2333
2339
  // error the client didn't retry (plugins#579).
2334
- const nameless = [...native.values()].filter((call) => call.index === undefined).length
2340
+ const nameless = begun.filter((call) => call.index === undefined).length
2335
2341
  if (nameless && !said) {
2336
2342
  yield { error: { status: 502, message: NAMELESS, nameless: true } }
2337
2343
  return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-qoder-auth",
3
- "version": "0.2.64",
3
+ "version": "0.2.65",
4
4
  "description": "Qoder and QwenWork (千问办公) subscriptions in OpenCode and magpie: qoder.com, qoder.cn, gateway.qwenwork.cn and the enterprise flagship, VPC and dedicated domains",
5
5
  "type": "module",
6
6
  "main": "./opencode.mjs",