@magpie-community/opencode-qoder-auth 0.2.60 → 0.2.61

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 +11 -2
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1478,6 +1478,15 @@ function modelConfig(m, thinking) {
1478
1478
  }
1479
1479
  }
1480
1480
 
1481
+ // The business record also names the model: Qoder's CLI (qodercli 1.1.82,
1482
+ // qoder-worker-runtime v3 → snn + model_key) puts the chosen model's key
1483
+ // there when a prompt starts, and the server attributes the call's billing
1484
+ // from it. Without it Qoder and Qoder CN booked the call as Auto whatever
1485
+ // model_config named (plugins#692, chansee97; the same shape as #638, where
1486
+ // the model_config fix of 0.2.54 did not change the billing). Qoder.app
1487
+ // 0.4.3 and QwenWork 1.0.46 build their record without it, so a site that
1488
+ // ships such a client says businessModelKey: false.
1489
+ //
1481
1490
  // qoderBody is the plaintext agent_chat_generation takes for a chat
1482
1491
  // completion request, for model m, in the session the agent named (named,
1483
1492
  // "" when none) and the task it is a call of (taskOf's, a new one when
@@ -1505,7 +1514,7 @@ function qoderBody(chat, m, named = "", task, site) {
1505
1514
  chat_record_id: request,
1506
1515
  session_id: session,
1507
1516
  parameters: params,
1508
- business: { product: site?.businessProduct ?? "app", version: site?.cosyVersion ?? COSY_VERSION, type: "agent", id: task.id, name: task.name ?? "", begin_at: task.begin, stage: task.answered ? "processing" : "start" },
1517
+ business: { product: site?.businessProduct ?? "app", version: site?.cosyVersion ?? COSY_VERSION, type: "agent", id: task.id, name: task.name ?? "", begin_at: task.begin, stage: task.answered ? "processing" : "start", ...(site?.businessModelKey === false ? {} : { model_key: m.key }) },
1509
1518
  agent_id: "agent_common",
1510
1519
  task_id: "common",
1511
1520
  session_type: site?.sessionType ?? "app",
@@ -2872,7 +2881,7 @@ const QWENWORK_COMMON = {
2872
2881
  deviceRefreshTarget: "c",
2873
2882
  clientHeaders: qwenworkClientHeaders,
2874
2883
  modelScene: "qwork", listAllModels: true,
2875
- clientType: "6", businessProduct: "qoder_work", sessionType: "qoder_work",
2884
+ clientType: "6", businessProduct: "qoder_work", sessionType: "qoder_work", businessModelKey: false,
2876
2885
  userInfoPath: "/api/v1/adapter/user/account-context?include=user,plan,quota,page,data_sharing",
2877
2886
  normalizeUser: v => (v?.data ?? v)?.user ?? (v?.data ?? v),
2878
2887
  pat: false, // no /api/v1/jobToken/exchange on gateway.qwenwork.cn
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-qoder-auth",
3
- "version": "0.2.60",
3
+ "version": "0.2.61",
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",