@magpie-community/opencode-qoder-auth 0.2.80 → 0.2.81

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 +5 -0
  2. package/index.mjs +13 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -121,6 +121,11 @@ itself.
121
121
  two sentences, `You are ZCode. You are an interactive agent` (since
122
122
  0.2.79, #1667): Qoder CN parks a request with the name and comma as
123
123
  written in the same queue. Qoder's own names stay as they are.
124
+ - Kimi Code's identity line, `You are Kimi Code, an interactive general AI
125
+ agent running on a user's computer.`, goes as `You are a coding agent, ...`
126
+ (since 0.2.81): Qoder CN puts a request whose system prompt opens with
127
+ that line in the same 10605 / p2 / `RESOURCE_LIMIT` queue. The rest of the
128
+ prompt and your messages go as written.
124
129
  - Messages become text and image blocks.
125
130
  - Tool calls and results become OpenAI tool turns. Images a tool returned
126
131
  follow in a user turn.
package/index.mjs CHANGED
@@ -113,6 +113,17 @@ const asAgentSDK = (text) => text.replace(CLAUDE_CODE_LINE, AGENT_SDK_LINE)
113
113
  const HARNESS_OPENER = /(\bYou are (?:an?|the)\s[^\n.,]{0,60}?\b(?:agent|assistant))\s+(powered by|running on|running in|built on|based on)\b/gi
114
114
  const harnessComma = (text) => text.replace(HARNESS_OPENER, "$1, $2")
115
115
 
116
+ // Qoder CN queues a request whose system prompt opens with Kimi Code's
117
+ // identity, "You are Kimi Code, an interactive general AI agent running on a
118
+ // user's computer.", in the same 10605 / p2 / RESOURCE_LIMIT hold as the
119
+ // DeepSeek Harness opener above: queueCount 0, serviceAvailable false, and
120
+ // the queue never moves. Kimi Code Desktop sends exactly that line (its
121
+ // profile.bind systemPrompt), so a Kimi K3.1 Pro call through Qoder CN never
122
+ // starts; the same request with a neutral opening answers at once. The match
123
+ // is the identity at the start of a line only, so later mentions of Kimi Code
124
+ // stay, and the user's own messages go as written.
125
+ const KIMI_CODE_OPENER = /(^|\n)([ \t]*)You\s+are\s+Kimi(?:\s+Code)?\b/gi
126
+ const neutralKimi = (text) => text.replace(KIMI_CODE_OPENER, "$1$2You are a coding agent")
116
127
  // Qoder CN parks a request in the same never-moving 10605 queue when its
117
128
  // system prompt holds another agent's name, as written, then a comma: "You
118
129
  // are ZCode, an interactive agent" (every ZCode request) and "You are
@@ -1607,7 +1618,7 @@ const APP_CHAT = { stream: true, chat_task: "FREE_INPUT", is_reply: true, is_ret
1607
1618
  // passes itself last.
1608
1619
  function qoderBody(chat, m, named = "", task, site) {
1609
1620
  const given = (chat.messages ?? []).filter((x) => x.role === "system" || x.role === "developer").map((x) => textOf(x.content)).filter(Boolean).join("\n\n")
1610
- const system = nameAlone(harnessComma(asAgentSDK(given)))
1621
+ const system = nameAlone(harnessComma(asAgentSDK(neutralKimi(given))))
1611
1622
  const tools = chat.tool_choice !== "none" ? (chat.tools ?? []).filter((t) => t?.type === "function" && t.function?.name) : []
1612
1623
  const baseSystem = site?.systemPrompt ?? QODER_SYS
1613
1624
  let sysText = system ? baseSystem + "\n\n" + system : baseSystem
@@ -4601,4 +4612,4 @@ export async function QwenWorkEnterpriseAuthPlugin({ client }) {
4601
4612
  export const protocol = { makePlugin, deviceSignIn, openapi, siteOf }
4602
4613
 
4603
4614
  // for tests
4604
- export const _internal = { spentOf, OUTPUT_CAPS, LEARNED_CAPS, outputCap, fetchListing, accountIdentity, deviceRefreshBody, qwenworkClientHeaders, freeView, maskPhone, phoneLabelOf, realEmailOf, orgOf, teamOf, cardNameOf, chatHeaders, machineOS, machineHostname, cosyHeaders, typedUnions, Splitter, campaignRuntime, RUNTIMES, campaignPage, campaignTarget, vpcInstance, vpcSite, dedicatedOrigin, dedicatedHost, dedicatedSite, lingmaRoots, lingmaDecode, lingmaSite, lingmaHeaders, LINGMA_MODELS, parseUsage, gfmt, when, failure, modelInfo, qoderBody, asAgentSDK, harnessComma, nameAlone, qoderMessages, kimiModel, cacheMarked, sessionOf, namedSession, taskOf, TASKS, TASK_MAX, TASK_IDLE, SESSION, SITES, decodeBody, events, QUEUE, queueState, queueReady }
4615
+ export const _internal = { spentOf, OUTPUT_CAPS, LEARNED_CAPS, outputCap, fetchListing, accountIdentity, deviceRefreshBody, qwenworkClientHeaders, freeView, maskPhone, phoneLabelOf, realEmailOf, orgOf, teamOf, cardNameOf, chatHeaders, machineOS, machineHostname, cosyHeaders, typedUnions, Splitter, campaignRuntime, RUNTIMES, campaignPage, campaignTarget, vpcInstance, vpcSite, dedicatedOrigin, dedicatedHost, dedicatedSite, lingmaRoots, lingmaDecode, lingmaSite, lingmaHeaders, LINGMA_MODELS, parseUsage, gfmt, when, failure, modelInfo, qoderBody, asAgentSDK, harnessComma, neutralKimi, nameAlone, qoderMessages, kimiModel, cacheMarked, sessionOf, namedSession, taskOf, TASKS, TASK_MAX, TASK_IDLE, SESSION, SITES, decodeBody, events, QUEUE, queueState, queueReady }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-qoder-auth",
3
- "version": "0.2.80",
3
+ "version": "0.2.81",
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",