diff --git a/packages/workbuddy/README.md b/packages/workbuddy/README.md index c20e610..d1a2a09 100644 --- a/packages/workbuddy/README.md +++ b/packages/workbuddy/README.md @@ -85,7 +85,10 @@ default one, as the app does. WorkBuddy refuses some agents' identity lines as an "unapproved channel" (11128), so those lines are reworded before a chat goes out. Since 0.1.27 -(#279) that includes DeepSeek Harness's opening line. +(#279) that includes DeepSeek Harness's opening line. A refusal of words +not reworded yet ends in a hint that names no one client (since 0.1.28): +WorkBuddy refused words in this client's prompt; use it from Hermes, +OpenCode or Pi, or add another provider to the group. The loader also translates OpenAI-compatible request spellings WorkBuddy doesn't take: `max_completion_tokens` becomes `max_tokens`, `developer` diff --git a/packages/workbuddy/index.mjs b/packages/workbuddy/index.mjs index 9b5b6cc..2f5316a 100644 --- a/packages/workbuddy/index.mjs +++ b/packages/workbuddy/index.mjs @@ -1699,11 +1699,15 @@ function makePlugin(site) { // REFUSED_HINT is what the user can do about WorkBuddy's "Illegal API // invocation from an unapproved channel": both builds answer it to a chat -// holding words of Codex's or Claude Code's own (magpie #182), whatever the -// headers. FLAGGED rewrites the ones known; this is for one it doesn't know. It ends the error's message, as magpie's built-in -// put it (provider.WBRefusedHint), so magpie's routing page says it apart. +// holding words they turn away, whatever the headers. Codex's and Claude +// Code's were the first (magpie #182), DeepSeek Harness's and Claude +// Desktop's came later (#279, #170), and WorkBuddy reads every message, so +// it names no client. FLAGGED rewrites the words known; this is for ones it +// doesn't know. It ends the error's message word for word as magpie's +// Routing page has it (WB_REFUSED in its routing client.js), which says it +// apart from WorkBuddy's own words. const REFUSED_HINT = - "WorkBuddy refuses chats from Codex and Claude Code (their system prompt); use it from Hermes, OpenCode or Pi, or add another provider to this group" + "WorkBuddy refused words in this client's prompt (most often its system prompt); use it from Hermes, OpenCode or Pi, or add another provider to this group" const REFUSED = /unapproved channel|illegal api invocation/i // RESTRICTED_HINT is what the user can do about WorkBuddy's 403 code 11140 diff --git a/packages/workbuddy/package.json b/packages/workbuddy/package.json index 910eedf..78d567d 100644 --- a/packages/workbuddy/package.json +++ b/packages/workbuddy/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-workbuddy-auth", - "version": "0.1.27", + "version": "0.1.28", "description": "OpenCode provider plugins for WorkBuddy's plans: WorkBuddy (CodeBuddy, copilot.tencent.com) and WorkBuddy AI (www.workbuddy.ai)", "type": "module", "main": "./index.mjs", diff --git a/packages/workbuddy/refused.test.mjs b/packages/workbuddy/refused.test.mjs index 1d38236..4045f17 100644 --- a/packages/workbuddy/refused.test.mjs +++ b/packages/workbuddy/refused.test.mjs @@ -1,6 +1,6 @@ -// WorkBuddy's refusal of Codex's and Claude Code's system prompt carries -// the hint magpie's built-in added (provider.WBRefusedHint), at the end of -// the message, where magpie's routing page looks for it. +// WorkBuddy's refusal of words in a client's prompt carries the hint +// magpie's Routing page knows (WB_REFUSED), at the end of the message, +// where the page looks for it. import { expect, test } from "bun:test" import { _internal } from "./index.mjs" @@ -12,6 +12,16 @@ test("the refusal ends in the hint", async () => { expect((await res.json()).error.message).toBe("Illegal API invocation from an unapproved channel — " + REFUSED_HINT) }) +test("the hint is magpie's word for word, and blames no one client", () => { + // magpie's Routing page splits it from WorkBuddy's words only when it + // matches exactly; DeepSeek Harness's and Claude Desktop's chats are + // refused too (#279, #170), so naming Codex and Claude Code misled them + expect(REFUSED_HINT).toBe( + "WorkBuddy refused words in this client's prompt (most often its system prompt); use it from Hermes, OpenCode or Pi, or add another provider to this group", + ) + expect(REFUSED_HINT).not.toMatch(/Codex|Claude/) +}) + test("credits exhausted error ends in the exhausted hint", async () => { const res = await explained( new Response(