catpaw 0.2.0 (gcdong, #697): the conversation protocol takes one flattened
text prompt, so a request with tools was refused with 400. Tools now ride as
an injected instruction and the reply is parsed back into OpenAI tool_calls:
only a reply that is wholly the call JSON (bare object or one fenced block)
counts, unknown names and calls missing a required arg are dropped, a
drifted name case is matched back. A forced tool_choice (required / named)
gets one retry with the failed reply in the prompt; streaming holds the
whole reply in that case, otherwise only a JSON-shaped head is held and
prose streams live. Tool results ride as text. Images are still refused.
The keep-alive interval is cleared wherever the stream closes.
Run at the reviewed head f72226f2, on mote:
- bun test packages/catpaw: 53 pass.
- Squashed onto origin/main 075cd237: HOME=$(mktemp -d) bun test, 5418
pass, 19 skip, 0 fail across 403 files; bun scripts/check.mjs, 43 ok.
- CI run 41780109549: attempt 1 was the fork approval gate (action_required),
attempt 2 after approval: test and on-npm pass.
Broken by hand: deciding prose per chunk instead of holding the JSON head
turns "a call JSON split across cumulative frames" red (only it); dropping
halt() from push's catch turns the keep-alive teardown test red (only it).
Earlier rounds broke the forced hold, the whole-reply parse, the retry's
assistant turn and the required-arg check, each red.
Probed (throwaway tests, not committed): tool names like
mcp__srv__do.thing-x; fenced and bare-array forms; null, [], 42, a
non-array tool_calls, nulls in tool_calls, string arguments that aren't
JSON, a lone "{", a truncated fenced block and a call followed by prose all
come back as the literal text with finish stop, streamed or not; a forced
choice failing twice makes exactly 2 rounds; a forced streaming call split
over frames comes out as tool_calls with no content; tool_choice required
with no tools takes the plain path; the prompt names no magpie, plugin,
proxy or gateway.
Not tried: a real CatPaw account (the model's actual adherence to the JSON
instruction is unmeasured). The forced streaming retry's reasoning is not
emitted (the first turn's is); minor.
29 lines
769 B
JSON
29 lines
769 B
JSON
{
|
|
"name": "@magpie-community/opencode-catpaw-auth",
|
|
"version": "0.2.0",
|
|
"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",
|
|
"exports": { ".": "./opencode2.mjs" },
|
|
"files": [
|
|
"index.mjs",
|
|
"opencode.mjs",
|
|
"opencode2.mjs",
|
|
"README.md"
|
|
],
|
|
"keywords": [
|
|
"opencode",
|
|
"opencode-plugin",
|
|
"magpie",
|
|
"catpaw",
|
|
"meituan",
|
|
"妙手"
|
|
],
|
|
"license": "MIT",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/magpie-community/plugins.git",
|
|
"directory": "packages/catpaw"
|
|
}
|
|
}
|