@magpie-community/opencode-trae-auth 0.1.12 → 0.1.13

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 (2) hide show
  1. package/index.mjs +15 -0
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -557,6 +557,11 @@ class TextTools {
557
557
  const m = this.buf.match(LEFTOVER)
558
558
  if (m) this.buf = this.buf.slice(m[0].length)
559
559
  if (!this.buf || (!end && MARKS.some((k) => k.startsWith(this.buf)))) break
560
+ // a tag cut short at the end (</), after the others: dropped too
561
+ if (end && this.buf.length > 1 && MARKS.some((k) => k.startsWith(this.buf.trimEnd()))) {
562
+ this.buf = ""
563
+ break
564
+ }
560
565
  this.after = false
561
566
  }
562
567
  const i = this.buf.indexOf(OPEN)
@@ -597,6 +602,16 @@ class TextTools {
597
602
  continue
598
603
  }
599
604
  const o = objectEnd(this.buf, i + OPEN.length)
605
+ const inner = this.buf.slice(i + OPEN.length).trimStart()
606
+ if (inner.startsWith("<") || (end && !inner)) {
607
+ // no JSON in it: DeepSeek's own invoke, or only the closes of one
608
+ // (magpie#823 again); the opener is dropped and what follows read
609
+ // as it is
610
+ text += this.buf.slice(0, i)
611
+ this.buf = inner
612
+ this.after = true
613
+ continue
614
+ }
600
615
  const v = o > 0 ? looseJSON(this.buf.slice(i + OPEN.length, o)) : null
601
616
  if (v?.name) {
602
617
  text += this.buf.slice(0, i)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-trae-auth",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "OpenCode provider plugin for Trae CN (trae.cn): your Trae CN account's models, free tier included, with Trae's own browser sign-in",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",