pi-provider-qoder-cn 0.2.9 → 0.2.17

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.
package/README.md CHANGED
@@ -4,8 +4,11 @@ A [pi](https://shittycodingagent.ai/) provider extension for **Qoder CN** (`qode
4
4
  with a quota command and enterprise (VPC) endpoint support.
5
5
 
6
6
  This is a focused fork of [`pi-provider-qoder`](https://github.com/simonsmh/pi-provider-qoder)
7
- (MIT). It registers **only** the CN provider, so it can be installed alongside the
8
- upstream package without a provider-id collision.
7
+ (MIT). It registers **both** providers — `qoder-cn` (Domestic) and `qoder`
8
+ (Global) — each with its own credentials, model catalog, quota and check-in
9
+ commands. Because the ids overlap with the upstream package, installing both at
10
+ once double-registers them; pi resolves that field-by-field in `settings.json`
11
+ load order (last wins), so keep this package listed last or uninstall upstream.
9
12
 
10
13
  ```bash
11
14
  pi install npm:pi-provider-qoder-cn
@@ -16,24 +19,20 @@ pi install npm:pi-provider-qoder-cn
16
19
  | Feature | Upstream | This fork |
17
20
  |---|---|---|
18
21
  | Qoder CN provider (`qoder-cn`) | ✅ | ✅ |
19
- | Qoder Global provider (`qoder`) | ✅ | ➖ not registered (see below) |
20
- | `/qoder-cn.usage` quota command | ❌ | ✅ |
22
+ | Qoder Global provider (`qoder`) | ✅ | ✅ (Browser OAuth + PAT with self-healing refresh) |
23
+ | `/qoder-cn.usage` & `/qoder.usage` quota commands | ❌ | ✅ |
24
+ | `/qoder-cn.claim` & `/qoder.claim` daily check-in (100 Credits) | ❌ | ✅ |
25
+ | Seamless token refresh (deviceToken/refresh for drt- & PAT exchange) | ❌ (broken 403) | ✅ |
21
26
  | Enterprise (VPC) selection during `/login qoder-cn` | ❌ | ✅ |
22
27
  | Current CN model catalog (`qwen3.8-max` / `qwen3.8-flash`, …) | ❌ | ✅ |
23
28
  | Stable CN model ids for `enabledModels` | ❌ | ✅ |
24
29
 
25
- > **Why CN only?** Both packages would register a provider named `qoder-cn`, and
26
- > pi identifies providers by id. Registering only `qoder-cn` here means this
27
- > package and the upstream one can coexist. If both are installed, whichever is
28
- > listed last in `settings.json` wins for `qoder-cn` — so put this package last
29
- > to get the friendly ids and the quota command. Note that the upstream package
30
- > registers the global `qoder` provider too, but it only appears in
31
- > `--list-models` once global credentials exist.
32
- >
33
- > If you migrated from the upstream package, also remove the old local extension
34
- > directory if you have one, since a directory at
35
- > `~/.pi/agent/extensions/pi-provider-qoder/` registers `qoder-cn` as well.
36
- > Check with `pi list` and inspect `~/.pi/agent/extensions/`.
30
+ Both `qoder` (Global) and `qoder-cn` (Domestic) providers are registered.
31
+ - To use Global: run `/login qoder` and use `/model qoder/<id>`. Commands: `/qoder.usage`, `/qoder.claim`.
32
+ - To use CN: run `/login qoder-cn` and use `/model qoder-cn/<id>`. Commands: `/qoder-cn.usage`, `/qoder-cn.claim`.
33
+
34
+ > Check with `pi list` and inspect `~/.pi/agent/extensions/`: a leftover
35
+ > `pi-provider-qoder` extension directory registers the same provider ids.
37
36
  >
38
37
  > **Migrating from the upstream package:** model ids change from
39
38
  > `Qwen3.8-Flash` to `qwen3.8-flash`. Update `enabledModels` entries in
@@ -46,12 +45,41 @@ pi install npm:pi-provider-qoder-cn
46
45
  pi install npm:pi-provider-qoder-cn
47
46
  ```
48
47
 
49
- Then authenticate once:
48
+ ### Daily check-in on Global: zero desktop dependency
49
+
50
+ `/qoder.claim` works out of the box on Windows: this package vendors the
51
+ official Qoder device-attestation component (`bin/runtime-info.exe` +
52
+ `bin/sgsdk.dll`, ~7.8 MB, sha256-pinned in `bin/manifest.json`) because the
53
+ global gateway hides claim campaigns from requests without device attestation.
54
+ The component is invoked offline with your account id; its output is cached in
55
+ memory for 30 minutes.
56
+
57
+ - Override the component: set `QODER_UMID_EXE` to any `runtime-info.exe`
58
+ (e.g. a fresher copy from a newer desktop install — the same variable works
59
+ for the CN provider with environment code 0).
60
+ - Non-Windows hosts: the vendored binary is win32-x64 only; install the Qoder
61
+ desktop app for your platform and the resolver picks its component from the
62
+ standard install paths automatically.
63
+ - The component is © Qoder and redistributed verbatim; it is not executed
64
+ during `npm install`, only on demand by the claim/usage commands.
65
+
66
+ Then authenticate once — CN:
50
67
 
51
68
  ```text
52
69
  /login qoder-cn
53
70
  ```
54
71
 
72
+ Global (either browser OAuth — the login dialog opens `qoder.com/device/selectAccounts`
73
+ and the extension polls for the token — or a PAT):
74
+
75
+ ```text
76
+ /login qoder
77
+ ```
78
+
79
+ ```bash
80
+ export QODER_PERSONAL_ACCESS_TOKEN="<your global PAT>" # or QODER_API_KEY / QODER_PAT
81
+ ```
82
+
55
83
  CN supports a Personal Access Token rather than browser OAuth. Create one at
56
84
  <https://qoder.com.cn/account/integrations> and paste it when prompted, or export
57
85
  it before starting pi:
@@ -101,12 +129,41 @@ Notes:
101
129
  not reserve space for one it does not have.
102
130
  - Colour is suppressed automatically for a `NO_COLOR` environment, a dumb
103
131
  terminal, and any non-TTY output that is not the interactive UI.
132
+ - The gauge and the `%` column are derived from `used / total`, so they always
133
+ agree with the numbers on the same row. The API's own `percentage` field is a
134
+ 0-1 fraction (94% arrives as `0.94`) and is only used — scaled by 100 — when a
135
+ bucket comes back without numbers.
104
136
  - `Expires never` means the API reported the year-9999 sentinel, i.e. the
105
137
  allowance has no expiry date.
106
138
  - `Note plan quota is prorated` appears after a mid-cycle plan change.
107
139
  - The command uses the same stored token as chat requests, refreshing it first,
108
140
  so it reports the same quota the model is actually billed against.
109
141
 
142
+ ### `/qoder-cn.claim`
143
+
144
+ Daily check-in command to claim the 100 free Credits reward on Qoder CN personal
145
+ accounts without having to open the desktop GUI. The event refreshes daily at
146
+ **10:00 UTC+8 (Beijing time)** and grants Add-on Credits valid for 30 days.
147
+
148
+ ```text
149
+ /qoder-cn.claim
150
+ ```
151
+
152
+ If already claimed today, it reports the status idempotently without throwing:
153
+
154
+ ```text
155
+ ℹ️ 今日 100 Credits 已经领取过,无需重复操作
156
+ - 活动名称:每天领 100 Credits
157
+ - 额度说明:100 Credits(全模型通用资源包,30 天有效)
158
+ - 下次刷新:明日 10:00 UTC+8(距刷新约 22小时10分钟)
159
+ ```
160
+
161
+ Append `json` for the untouched API response:
162
+
163
+ ```text
164
+ /qoder-cn.claim json
165
+ ```
166
+
110
167
  ### Enterprise (VPC) endpoint support
111
168
 
112
169
  Enterprises on a private (VPC) deployment can select their endpoint directly
@@ -0,0 +1,17 @@
1
+ {
2
+ "note": "Vendored verbatim from the Qoder desktop app (resources/umid) so /qoder.claim and /qoder.usage work without a desktop install. Override with QODER_UMID_EXE. Copyright © Qoder — all rights reserved by Qoder/Alibaba.",
3
+ "vendoredAt": "2026-10-03",
4
+ "target": "win32-x64",
5
+ "files": [
6
+ {
7
+ "name": "runtime-info.exe",
8
+ "size": 480752,
9
+ "sha256": "e670a041fd0a451c51535ff1b042996737362a30aabd91a583ed92ca4c56e40b"
10
+ },
11
+ {
12
+ "name": "sgsdk.dll",
13
+ "size": 7358960,
14
+ "sha256": "37edce6dbdf087abb85cff7687c371268bb13f3eb22517826d665e083e109326"
15
+ }
16
+ ]
17
+ }
Binary file
package/bin/sgsdk.dll ADDED
Binary file