catpaw 0.2.2: out of credits is a 402 with the purchase link, not an answer (#933)

Out of credits, 妙手's gateway answers the turn HTTP 200 with the
sentence "当前余额不足以完成本次操作。[去购买更多](https://credit.catpaw.meituan.com/#/plan),
即可继续使用全部功能。" as the assistant's text, in frames with no error
field and no model / modelDisplayName. The plugin only read `error`, so
the agent got the sentence as the model's answer (and with tools, the
forced-tool retry spent a second turn on it).

Now a frame that names no model and whose text, before anything was
streamed, starts with "当前余额不足以完成本次操作" is the credit gate:
the request fails 402 with {type: insufficient_quota, code:
insufficient_credits, help_url, upstream_message}, the message with the
markdown link spelled out as "去购买更多 (https://…)". magpie's gateway
reads a 402 as failCredit: the account rests for credit and the next
one is tried, not counted as broken. A head that could still grow into
the sentence ("当前", "当前余额") is held until it does or doesn't; a
model's answer quoting the sentence names its model and passes as text.
"余额不足" in a round's msg, an SSE error frame or a non-200 body is a
402 too.

Streaming requests now wait for the conversation's first event (up to
10s) before answering, so the 402, and a round or turn's bare 429 / 401,
go out as their own status instead of an error chunk inside a 200. A
slower turn streams as before. The bare 429 now says it is 妙手's rate
limit with Retry-After: 45 (the reporter saw a ~41s cool-down), the
bare 401 that the sign-in has expired; both keep the step and status.

The fixture (testdata/issue-933.json) is the reporter's frames as the
issue quotes them; the elided finishing frame is filled in, and the
model fields of a normal answer are made up (the issue doesn't quote
their values).

Run in WSL (magpie-desktop) via wsl-run at this tree:
- bun test packages/catpaw: 73 pass, 0 fail
- bun scripts/check.mjs: exit 0, catpaw ✓

Broken by hand, each red, then restored:
- no gate throw: 4 of the new tests red (both 402 paths, tools, split)
- gate without the no-model condition: the quoting test red
- plain stream not primed: 402-before-streaming, split and 429 red
- tool stream not primed: the tools 402 and the 401 test red
- held head never flushed: the held-head test red
- 429 not mapped: the 429 test red

Not tried: no real CatPaw account, so neither the gate nor the bare
429/401 was met against the real gateway; the 409/400 mapping the
issue suggests for "会话未在执行中" is not done.

Reported-by: LIEGU0317
This commit is contained in:
yetone
2026-11-10 18:36:01 +08:00
parent 5292fc9f55
commit 3e18b1a20d
5 changed files with 292 additions and 17 deletions
+11
View File
@@ -22,6 +22,11 @@ export function fakeCatPaw() {
// cumulative frames (the tools tests use it to script a reply, then a
// forced-retry reply); empty → the default 你好 frames
turnFramesQueue: [],
// a turn's raw SSE body, played as is (plugins#933's literal frames)
turnRaw: null,
// bare statuses the real gateway answers with an empty body (429, 401)
roundStatus: 0,
turnStatus: 0,
// per-turn delay before the SSE starts (the keep-alive teardown test
// uses it to keep the stream open while the agent cancels)
turnDelayMs: 0,
@@ -51,6 +56,9 @@ export function fakeCatPaw() {
state.turns = 0
state.turnError = null
state.turnFramesQueue = []
state.turnRaw = null
state.roundStatus = 0
state.turnStatus = 0
state.turnDelayMs = 0
state.disabledSources = new Set(["CatPawCLI"])
state.turnBodies = []
@@ -124,6 +132,7 @@ export function fakeCatPaw() {
if (url.pathname === "/api/agent/conversation/round") {
state.rounds++
if (state.roundStatus) return new Response("", { status: state.roundStatus })
if (state.disabledSources.has(body.source)) return json(200, { code: 400, msg: `source 不存在或未启用: ${body.source}` })
if (body.source !== "CatX" || body.mode !== "CATX_APP") return json(400, { code: 400, msg: `source/mode wrong: ${body.source}/${body.mode}` })
state.conversations.push({ id: body.conversationId, modelType: body.modelType, prompt: body.message?.content?.[0]?.text ?? "", token: (req.headers.get("cookie") ?? "").match(/X-Passport-Token=([^;]+)/)?.[1] ?? "", permissionMode: body.permissionMode, source: body.source, mode: body.mode })
@@ -142,6 +151,8 @@ export function fakeCatPaw() {
const conv = state.conversations.at(-1)
if (body.source !== conv?.source || body.mode !== conv?.mode) return json(400, { code: 400, msg: `turn source/mode ${body.source}/${body.mode} differ from the round's` })
if (body.conversationId !== conv?.id) return json(400, { code: 400, msg: "turn for unknown conversation" })
if (state.turnStatus) return new Response("", { status: state.turnStatus })
if (state.turnRaw) return new Response(state.turnRaw, { headers: { "content-type": "text/event-stream" } })
if (state.turnError === "sse-error")
return new Response(`data: ${JSON.stringify({ error: { code: 500, message: "vendor broke" } })}\n\n`, { headers: { "content-type": "text/event-stream" } })
if (state.turnDelayMs) await new Promise((r) => setTimeout(r, state.turnDelayMs))
+131 -16
View File
@@ -175,8 +175,80 @@ const configModel = (id, m) => ({
// ── small helpers ──────────────────────────────────────────────────────────
const errorResponse = (status, message) =>
new Response(JSON.stringify({ error: { message } }), { status, headers: { "content-type": "application/json" } })
const errorResponse = (status, message, fields = {}, headers = {}) =>
new Response(JSON.stringify({ error: { message, ...fields } }), { status, headers: { "content-type": "application/json", ...headers } })
// Refused is a failure with the status the agent should see: out of credit
// a 402 (magpie rests the account for credit, not as broken), a rate limit
// a 429 with its wait, a lost sign-in a 401 — each with a sentence to read
class Refused extends Error {
constructor(status, message, fields = {}, headers = {}) {
super(message)
this.status = status
this.fields = fields
this.headers = headers
}
}
// the credit gate (plugins#933): out of credits, the gateway answers the turn
// HTTP 200 with this sentence as the assistant's text, in frames that name no
// model (every model's frame carries model / modelDisplayName)
const QUOTA_GATE = "当前余额不足以完成本次操作"
const PLAN_URL = "https://credit.catpaw.meituan.com/#/plan"
const modelless = (msg) => msg.model == null && msg.modelDisplayName == null
// the gate's sentence as a 402: markdown links spelled out, since most
// agents print the message as plain text and "[去购买更多](…)" loses its link
function outOfCredit(said) {
const upstream = String(said ?? "").trim()
const message = upstream.replace(/\[([^\]]*)\]\((https?:\/\/[^)\s]+)\)/g, "$1 ($2)") || "妙手余额不足"
const help = upstream.match(/https?:\/\/[^)\s]+/)?.[0] ?? PLAN_URL
return new Refused(402, message, { type: "insufficient_quota", code: "insufficient_credits", help_url: help, upstream_message: upstream })
}
// a step's HTTP refusal, readable: the gateway's 401 and 429 come bare
function stepRefused(step, status, text) {
const said = String(text ?? "").trim().slice(0, 500)
const head = `妙手 ${step} 失败:HTTP ${status}${said ? ` ${said}` : ""}`
if (status === 401) return new Refused(401, `${head}。妙手登录态已过期,请在妙手桌面端重新登录`, { type: "authentication_error" })
// the gateway's cool-down after about six conversations in a row was
// seen at ~41s (plugins#933)
if (status === 429)
return new Refused(429, `${head}。妙手限流:请求过于频繁,请稍等约 45 秒再试`, { type: "rate_limit_error", code: "rate_limited" }, { "retry-after": "45" })
if (status === 402 || said.includes("余额不足")) return outOfCredit(said || `妙手余额不足(${step} HTTP ${status})`)
return new Error(/^\s*</.test(said) ? head + NOT_JSON : head)
}
// the response for a failed conversation: a Refused as itself, anything
// else a 502 (a 401 when its words say so, as before)
function failResponse(e) {
if (e instanceof Refused) return errorResponse(e.status, e.message, e.fields, e.headers)
const message = friendlyUpstreamMessage(e)
return errorResponse(message.includes("401") ? 401 : 502, message)
}
// primed waits for a conversation's first event, up to ms, before the agent
// is answered: a refusal there (the credit gate, a 429) goes out as its own
// status instead of an error inside a 200 stream. A turn slower than that
// streams as before, and a later failure is an error chunk.
const PRIME_MS = 10_000
async function primed(gen, ms = PRIME_MS) {
const first = gen.next().then(
(v) => ({ v }),
(e) => ({ e }),
)
let timer
const won = await Promise.race([first, new Promise((r) => (timer = setTimeout(() => r(null), ms)))])
clearTimeout(timer)
if (won?.e) throw won.e
return (async function* () {
const r = won ?? (await first)
if (r.e) throw r.e
if (r.v.done) return
yield r.v.value
yield* gen
})()
}
async function bodyText(input, init) {
const b = init.body ?? (input instanceof Request ? await input.clone().text() : undefined)
@@ -492,10 +564,11 @@ function toolCallsFromText(text, tools, toolChoice) {
// the gateway sometimes answers with an HTML page (a WAF or a rate limit);
// surface that as what it is instead of a bare JSON parse error
const NOT_JSON = "(妙手网关返回了非 JSON 页面 —— 多为限流或临时故障;超大 prompt 也可能触发,稍等重试)"
function friendlyUpstreamMessage(e) {
const m = String(e?.message ?? e)
return /JSON Parse error|Unrecognized token|Unexpected token '<'/i.test(m) || /^\s*</.test(m)
? m + "(妙手网关返回了非 JSON 页面 —— 多为限流或临时故障;超大 prompt 也可能触发,稍等重试)"
? m + NOT_JSON
: m
}
@@ -526,9 +599,14 @@ async function* runConversation(token, chat, signal, modelType = modelTypeOf(cha
{ "m-spanid": "0.2", "m-spanname": "conversation.round" },
signal,
)
// the status first: a 429 or a WAF page is no JSON to parse
if (r1.status !== 200) throw stepRefused("round", r1.status, r1.text)
const r1j = JSON.parse(r1.text || "{}")
if (r1.status !== 200 || r1j.code !== 0)
throw new Error(`妙手 round 失败:HTTP ${r1.status} code=${r1j.code ?? "?"} msg=${r1j.msg ?? r1j.message ?? ""}`)
if (r1j.code !== 0) {
const said = String(r1j.msg ?? r1j.message ?? "")
if (said.includes("余额不足")) throw outOfCredit(said)
throw new Error(`妙手 round 失败:HTTP ${r1.status} code=${r1j.code ?? "?"} msg=${said}`)
}
// ② event: mark the conversation as running
const r2 = await gatewayPost(
@@ -538,7 +616,7 @@ async function* runConversation(token, chat, signal, modelType = modelTypeOf(cha
{ "m-spanid": "0.3", "m-spanname": "conversation.event" },
signal,
)
if (r2.status !== 200) throw new Error(`妙手 event 失败:HTTP ${r2.status}`)
if (r2.status !== 200) throw stepRefused("event", r2.status, r2.text)
// ③ turn: the SSE answer. Every frame's content is the whole text so far,
// so each is diffed against the last; the reply is yielded as deltas.
@@ -569,7 +647,7 @@ async function* runConversation(token, chat, signal, modelType = modelTypeOf(cha
// a shorter cap would cut them off mid-answer
signal: signal ?? AbortSignal.timeout(15 * 60e3),
})
if (res.status !== 200) throw new Error(`妙手 turn 失败:HTTP ${res.status} ${(await res.text().catch(() => "")).slice(0, 500)}`)
if (res.status !== 200) throw stepRefused("turn", res.status, await res.text().catch(() => ""))
if (!res.body) throw new Error("妙手 turn 返回了空流")
const decoder = new TextDecoder()
@@ -580,6 +658,14 @@ async function* runConversation(token, chat, signal, modelType = modelTypeOf(cha
let finalText = ""
let finalReasoning = ""
let frameCount = 0
// a head held as maybe the credit gate that never became it goes out
// before the end
function* held() {
if (finalText.length > prevText.length && finalText.startsWith(prevText)) {
yield { delta: finalText.slice(prevText.length) }
prevText = finalText
}
}
for (;;) {
const { done, value } = await reader.read()
if (done) break
@@ -590,6 +676,7 @@ async function* runConversation(token, chat, signal, modelType = modelTypeOf(cha
if (!line.startsWith("data:")) continue
const data = line.slice(5).trim()
if (data === "[DONE]") {
yield* held()
yield { done: true, text: finalText, reasoning: finalReasoning }
return
}
@@ -600,12 +687,28 @@ async function* runConversation(token, chat, signal, modelType = modelTypeOf(cha
continue
}
frameCount++
if (frame.error) throw new Error(`妙手 SSE 错误:code=${frame.error.code} msg=${frame.error.message || ""}`)
if (frame.error) {
const said = String(frame.error.message || "")
if (said.includes("余额不足")) throw outOfCredit(said)
throw new Error(`妙手 SSE 错误:code=${frame.error.code} msg=${said}`)
}
const msg = frame.message
if (!msg || !Array.isArray(msg.content)) continue
for (const c of msg.content) {
if (c.type !== "text") continue
const curText = c.text || ""
// the credit gate (plugins#933), judged only before any text went
// out and only in a frame that names no model: a model's answer
// quoting the sentence names its model. A head that could still
// grow into the sentence is held until it either does or doesn't.
if (prevText === "" && modelless(msg)) {
const head = curText.trimStart()
if (head.startsWith(QUOTA_GATE)) throw outOfCredit(curText)
if (head !== "" && QUOTA_GATE.startsWith(head)) {
finalText = curText
continue
}
}
if (curText.length > prevText.length) {
yield { delta: curText.slice(prevText.length) }
prevText = curText
@@ -622,6 +725,7 @@ async function* runConversation(token, chat, signal, modelType = modelTypeOf(cha
}
// the stream ended without [DONE]
if (finalText === "" && frameCount === 0) throw new Error("妙手 SSE 流结束但没有任何帧")
yield* held()
yield { done: true, text: finalText, reasoning: finalReasoning }
}
@@ -755,8 +859,7 @@ export async function CatPawAuthPlugin({ client } = {}) {
}
}
} catch (e) {
const message = friendlyUpstreamMessage(e)
return errorResponse(message.includes("401") ? 401 : 502, message)
return failResponse(e)
}
const message = {
role: "assistant",
@@ -782,6 +885,12 @@ export async function CatPawAuthPlugin({ client } = {}) {
// and prose flushes and streams live. The hold matters because
// a tool call split into content deltas can't be un-sent.
const forced = wantsTools && isToolChoiceRequired(chat.tool_choice)
let events
try {
events = await primed(runConversation(token, { ...chat, messages: baseMessages }, init.signal, spec?.type))
} catch (e) {
return failResponse(e)
}
const encoder = new TextEncoder()
const sse = (delta, finish, reasoningDelta) => {
const choices = [{ index: 0, delta: {}, finish_reason: finish ?? null }]
@@ -832,7 +941,7 @@ export async function CatPawAuthPlugin({ client } = {}) {
let fullText = ""
let calls = []
try {
for await (const ev of runConversation(token, { ...chat, messages: baseMessages }, init.signal, spec?.type)) {
for await (const ev of events) {
if (closed) return
if (ev.reasoningDelta) push(sse(null, null, ev.reasoningDelta))
if (ev.delta) {
@@ -883,7 +992,7 @@ export async function CatPawAuthPlugin({ client } = {}) {
push(sse(null, "stop"))
}
} catch (e) {
push(encoder.encode(`data: ${JSON.stringify({ error: { message: friendlyUpstreamMessage(e) } })}\n\n`))
push(encoder.encode(`data: ${JSON.stringify({ error: { message: friendlyUpstreamMessage(e), ...(e instanceof Refused ? e.fields : {}) } })}\n\n`))
push(doneFrame)
stop()
return
@@ -896,6 +1005,12 @@ export async function CatPawAuthPlugin({ client } = {}) {
}
if (chat.stream) {
let events
try {
events = await primed(runConversation(token, chat, init.signal, spec?.type))
} catch (e) {
return failResponse(e)
}
const encoder = new TextEncoder()
const chunk = (delta, finish, reasoningDelta) => {
const choices = [{ index: 0, delta: {}, finish_reason: finish ?? null }]
@@ -909,7 +1024,7 @@ export async function CatPawAuthPlugin({ client } = {}) {
async start(controller) {
controller.enqueue(chunk(null, null)) // the role frame
try {
for await (const ev of runConversation(token, chat, init.signal, spec?.type)) {
for await (const ev of events) {
if (ev.delta) controller.enqueue(chunk(ev.delta, null))
if (ev.reasoningDelta) controller.enqueue(chunk(null, null, ev.reasoningDelta))
if (ev.done) {
@@ -919,7 +1034,7 @@ export async function CatPawAuthPlugin({ client } = {}) {
}
} catch (e) {
controller.enqueue(
encoder.encode(`data: ${JSON.stringify({ error: { message: String(e?.message ?? e) } })}\n\n`),
encoder.encode(`data: ${JSON.stringify({ error: { message: String(e?.message ?? e), ...(e instanceof Refused ? e.fields : {}) } })}\n\n`),
)
controller.enqueue(encoder.encode("data: [DONE]\n\n"))
}
@@ -939,7 +1054,7 @@ export async function CatPawAuthPlugin({ client } = {}) {
}
}
} catch (e) {
return errorResponse(e?.message?.includes("401") ? 401 : 502, String(e?.message ?? e))
return failResponse(e)
}
return new Response(
JSON.stringify({
@@ -1178,4 +1293,4 @@ export async function CatPawAuthPlugin({ client } = {}) {
}
// for tests
export const _internal = { ID, BODY_IDENTITY, NAME, MODELS, modelTypeOf, buildPrompt, gatewayHeaders, gatewayHeadersForTest: gatewayHeaders, readAuth, authPath, configModel, liveModels, liveListFor, forgetLive: () => liveLists.clear() }
export const _internal = { ID, BODY_IDENTITY, NAME, MODELS, modelTypeOf, buildPrompt, gatewayHeaders, gatewayHeadersForTest: gatewayHeaders, readAuth, authPath, configModel, liveModels, liveListFor, primed, forgetLive: () => liveLists.clear() }
+139
View File
@@ -8,6 +8,7 @@ import { fakeCatPaw } from "./fake.mjs"
import capturedRound from "./testdata/captured-round.json"
import capturedTurn from "./testdata/captured-turn.json"
import issue605 from "./testdata/issue-605.json"
import issue933 from "./testdata/issue-933.json"
// every test runs against the fake upstream in fake.mjs: no network, no real
// token ever leaves this process. The upstream base is monkey-patched because
@@ -984,3 +985,141 @@ describe("helpers", () => {
expect(_internal.modelTypeOf("unknown")).toBe(77)
})
})
describe("out of credits (plugins#933)", () => {
const GATE = "当前余额不足以完成本次操作。[去购买更多](https://credit.catpaw.meituan.com/#/plan),即可继续使用全部功能。"
const literal = issue933.sse.join("\n\n") + "\n\n"
const ask = async (body) => {
const loader = await plugin.auth.loader(getAuth)
return loader.fetch(`${fake.url}/api/agent/chat/completions`, {
method: "POST",
body: JSON.stringify({ model: "glm-5.3-flash", messages: [{ role: "user", content: "hi" }], ...body }),
})
}
const tools = [{ type: "function", function: { name: "Bash", parameters: { type: "object", properties: { command: { type: "string" } }, required: ["command"] } } }]
const expectOutOfCredit = async (res) => {
expect(res.status).toBe(402)
const { error } = await res.json()
expect(error.type).toBe("insufficient_quota")
expect(error.code).toBe("insufficient_credits")
expect(error.help_url).toBe("https://credit.catpaw.meituan.com/#/plan")
expect(error.message).toBe("当前余额不足以完成本次操作。去购买更多 (https://credit.catpaw.meituan.com/#/plan),即可继续使用全部功能。")
expect(error.upstream_message).toBe(GATE)
}
// a stream's text as the agent reads it
const streamed = async (res) => {
let text = ""
for (const line of (await res.text()).split("\n")) {
if (!line.startsWith("data: ") || line === "data: [DONE]") continue
const j = JSON.parse(line.slice(6))
if (j.error) throw new Error(j.error.message)
text += j.choices[0].delta.content ?? ""
}
return text
}
test("the reporter's frames are a 402, not an answer (non-stream)", async () => {
fake.state.turnRaw = literal
await expectOutOfCredit(await ask({ stream: false }))
})
test("the reporter's frames are a 402 before anything streams", async () => {
fake.state.turnRaw = literal
await expectOutOfCredit(await ask({ stream: true }))
})
test("with tools, a 402 and no second turn (no forced-tool retry)", async () => {
fake.state.turnRaw = literal
await expectOutOfCredit(await ask({ stream: false, tools, tool_choice: "required" }))
expect(fake.state.turns).toBe(1)
fake.state.reset()
fake.state.turnRaw = literal
await expectOutOfCredit(await ask({ stream: true, tools }))
expect(fake.state.turns).toBe(1)
})
test("the sentence split over frames is still the gate", async () => {
fake.state.turnFramesQueue = [
[
{ message: { type: "assistant", content: [{ type: "text", text: "" }] } },
{ message: { type: "assistant", content: [{ type: "text", text: "当前余额" }] } },
{ message: { type: "assistant", content: [{ type: "text", text: "当前余额不足以完成" }] } },
{ message: { type: "assistant", content: [{ type: "text", text: GATE }] }, finished: true },
],
]
await expectOutOfCredit(await ask({ stream: true }))
})
test("a model's answer quoting the sentence is an answer", async () => {
const m = issue933.modelAnswer
fake.state.turnFramesQueue = [
[
{ message: { type: "assistant", ...m, content: [{ type: "text", text: "当前余额不足" }] } },
{ message: { type: "assistant", ...m, content: [{ type: "text", text: GATE }] } },
{ message: { type: "assistant", ...m, content: [{ type: "text", text: GATE + " 这是妙手的提示文案。" }] }, finished: true },
],
]
const res = await ask({ stream: true })
expect(res.status).toBe(200)
expect(await streamed(res)).toBe(GATE + " 这是妙手的提示文案。")
fake.state.turnFramesQueue = [[{ message: { type: "assistant", ...m, content: [{ type: "text", text: GATE }] }, finished: true }]]
const res2 = await ask({ stream: false })
expect(res2.status).toBe(200)
expect((await res2.json()).choices[0].message.content).toBe(GATE)
})
test("a head held as maybe the gate streams whole when it isn't", async () => {
fake.state.turnFramesQueue = [
[
{ message: { content: [{ type: "text", text: "当前" }] } },
{ message: { content: [{ type: "text", text: "当前余" }] } },
{ message: { content: [{ type: "text", text: "当前余下三项任务" }] } },
{ message: { content: [{ type: "text", text: "当前余下三项任务,先做第一项。" }] }, finished: true },
],
]
const res = await ask({ stream: true })
expect(res.status).toBe(200)
expect(await streamed(res)).toBe("当前余下三项任务,先做第一项。")
// a reply that is only such a head still goes out
fake.state.turnFramesQueue = [[{ message: { content: [{ type: "text", text: "当前" }] }, finished: true }]]
const res2 = await ask({ stream: true })
expect(await streamed(res2)).toBe("当前")
})
test("a bare 429 is a 429 with a wait and a sentence", async () => {
fake.state.roundStatus = 429
const res = await ask({ stream: true })
expect(res.status).toBe(429)
expect(res.headers.get("retry-after")).toBe("45")
const { error } = await res.json()
expect(error.type).toBe("rate_limit_error")
expect(error.message).toContain("妙手限流")
fake.state.reset()
fake.state.turnStatus = 429
expect((await ask({ stream: false })).status).toBe(429)
})
test("a bare 401 says the sign-in is gone", async () => {
fake.state.turnStatus = 401
const res = await ask({ stream: true, tools })
expect(res.status).toBe(401)
expect((await res.json()).error.message).toContain("请在妙手桌面端重新登录")
})
test("primed lets a slow turn stream as before", async () => {
async function* slow() {
await new Promise((r) => setTimeout(r, 50))
yield 1
yield 2
}
const got = []
for await (const v of await _internal.primed(slow(), 10)) got.push(v)
expect(got).toEqual([1, 2])
async function* lateFail() {
await new Promise((r) => setTimeout(r, 50))
throw new Error("late")
}
const it = await _internal.primed(lateFail(), 10)
await expect(it.next()).rejects.toThrow("late")
})
})
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@magpie-community/opencode-catpaw-auth",
"version": "0.2.1",
"version": "0.2.2",
"description": "OpenCode & Magpie provider plugin for Meituan's 妙手 CatPaw (ai.catpaw.meituan.com): web sign-in or the desktop client's saved credentials, chat through the round/event/turn protocol, models and credit balance",
"type": "module",
"main": "./opencode.mjs",
+10
View File
@@ -0,0 +1,10 @@
{
"note": "plugins#933 (LIEGU0317, magpie 0.1.3479, plugin 0.2.1, plan_free with availableCredits 0.00, glm-5.3-flashx = modelType 98): the turn's SSE frames as the issue quotes them, out of credits. HTTP 200, text/event-stream, no error field, and no model / modelDisplayName in any frame. Ids are \"...\" in the issue and kept so. The issue elides the finishing frame as {\"message\":{... \"finished\":true}}; it is filled in here as the cumulative message, finished. The reporter states that normal answer frames carry model and modelDisplayName; their values are not quoted, so modelAnswer's are made up.",
"sse": [
"data:{\"conversationId\":\"...\",\"message\":{\"type\":\"assistant\",\"messageId\":\"...\",\"status\":1,\"content\":[{\"type\":\"text\",\"text\":\"\"}],\"finished\":false}}",
"data:{\"conversationId\":\"...\",\"message\":{\"type\":\"assistant\",\"messageId\":\"...\",\"status\":1,\"content\":[{\"type\":\"text\",\"text\":\"当前余额不足以完成本次操作。[去购买更多](https://credit.catpaw.meituan.com/#/plan),即可继续使用全部功能。\"}],\"finished\":false}}",
"data:{\"conversationId\":\"...\",\"message\":{\"type\":\"assistant\",\"messageId\":\"...\",\"status\":1,\"content\":[{\"type\":\"text\",\"text\":\"当前余额不足以完成本次操作。[去购买更多](https://credit.catpaw.meituan.com/#/plan),即可继续使用全部功能。\"}],\"finished\":true}}",
"data:[DONE]"
],
"modelAnswer": { "model": "glm-5.3-flashx", "modelDisplayName": "GLM-5.3-FlashX" }
}