zcode-acp-server 0.40.1 → 0.41.0
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 +3 -3
- package/README.zh-CN.md +1 -1
- package/dist/bin/quota.d.ts +1 -1
- package/dist/bin/quota.d.ts.map +1 -1
- package/dist/bin/quota.js +28 -17
- package/dist/bin/quota.js.map +1 -1
- package/dist/code-fingerprint.json +2 -2
- package/dist/config/user-config.d.ts +10 -0
- package/dist/config/user-config.d.ts.map +1 -1
- package/dist/config/user-config.js +31 -4
- package/dist/config/user-config.js.map +1 -1
- package/dist/handlers/account.d.ts +21 -6
- package/dist/handlers/account.d.ts.map +1 -1
- package/dist/handlers/account.js +25 -8
- package/dist/handlers/account.js.map +1 -1
- package/dist/quota/combined.d.ts +13 -9
- package/dist/quota/combined.d.ts.map +1 -1
- package/dist/quota/combined.js +54 -29
- package/dist/quota/combined.js.map +1 -1
- package/dist/quota/ollama-cloud/cache.d.ts +16 -0
- package/dist/quota/ollama-cloud/cache.d.ts.map +1 -0
- package/dist/quota/ollama-cloud/cache.js +30 -0
- package/dist/quota/ollama-cloud/cache.js.map +1 -0
- package/dist/quota/ollama-cloud/client.d.ts +23 -0
- package/dist/quota/ollama-cloud/client.d.ts.map +1 -0
- package/dist/quota/ollama-cloud/client.js +33 -0
- package/dist/quota/ollama-cloud/client.js.map +1 -0
- package/dist/quota/ollama-cloud/config.d.ts +25 -0
- package/dist/quota/ollama-cloud/config.d.ts.map +1 -0
- package/dist/quota/ollama-cloud/config.js +31 -0
- package/dist/quota/ollama-cloud/config.js.map +1 -0
- package/dist/quota/ollama-cloud/format.d.ts +28 -0
- package/dist/quota/ollama-cloud/format.d.ts.map +1 -0
- package/dist/quota/ollama-cloud/format.js +53 -0
- package/dist/quota/ollama-cloud/format.js.map +1 -0
- package/dist/quota/ollama-cloud/index.d.ts +27 -0
- package/dist/quota/ollama-cloud/index.d.ts.map +1 -0
- package/dist/quota/ollama-cloud/index.js +91 -0
- package/dist/quota/ollama-cloud/index.js.map +1 -0
- package/dist/quota/ollama-cloud/types.d.ts +44 -0
- package/dist/quota/ollama-cloud/types.d.ts.map +1 -0
- package/dist/quota/ollama-cloud/types.js +15 -0
- package/dist/quota/ollama-cloud/types.js.map +1 -0
- package/dist/quota/opencode-go/config.d.ts +11 -11
- package/dist/quota/opencode-go/config.js +11 -11
- package/dist/quota/opencode-go/index.d.ts.map +1 -1
- package/dist/quota/opencode-go/index.js +16 -7
- package/dist/quota/opencode-go/index.js.map +1 -1
- package/docs/CLI.md +45 -13
- package/docs/REMOTE-CLIENTS.md +16 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/quota/opencode-go/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG9C,wDAAwD;AACxD,MAAM,YAAY,GAAG,oBAAoB,CAAC;AAC1C,MAAM,aAAa,GAAG,UAAU,CAAC;AAEjC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/quota/opencode-go/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAA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EAAE;iBACtB,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,GAAG,CAAC,8BAA8B,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACjF,MAAM,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;IACnC,CAAC;IAED,SAAS,CAAC,MAAM,CAAC,CAAC;IAClB,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,0CAA0C;AAC1C,OAAO,EAAE,UAAU,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
|
package/docs/CLI.md
CHANGED
|
@@ -49,20 +49,22 @@ handshake) — that is what CI smoke-tests.
|
|
|
49
49
|
## Quota cards
|
|
50
50
|
|
|
51
51
|
Check plan usage from the terminal — no editor or running server needed. By
|
|
52
|
-
default it shows
|
|
53
|
-
pass a provider to focus on one.
|
|
52
|
+
default it shows **GLM Coding Plan**, **Opencode Go**, and **Ollama Cloud**
|
|
53
|
+
(when configured) in one card; pass a provider to focus on one.
|
|
54
54
|
|
|
55
55
|
GLM credentials are read from `~/.zcode/v2/config.json`. Opencode Go
|
|
56
56
|
credentials come from environment variables (the dashboard needs a browser
|
|
57
|
-
cookie — see [Opencode Go setup](#opencode-go-setup) below).
|
|
57
|
+
cookie — see [Opencode Go setup](#opencode-go-setup) below). Ollama Cloud
|
|
58
|
+
needs an API key — see [Ollama Cloud setup](#ollama-cloud-setup) below.
|
|
58
59
|
|
|
59
60
|
```bash
|
|
60
|
-
#
|
|
61
|
+
# All configured providers (default): GLM + Opencode Go + Ollama Cloud
|
|
61
62
|
zcode-acp quota
|
|
62
63
|
|
|
63
64
|
# Focus on one provider
|
|
64
65
|
zcode-acp quota glm # GLM Coding Plan only
|
|
65
66
|
zcode-acp quota go # Opencode Go only (rolling + weekly + monthly)
|
|
67
|
+
zcode-acp quota oc # Ollama Cloud only (5h + weekly)
|
|
66
68
|
|
|
67
69
|
# Live monitor: clear the screen and refresh every 30s (default)
|
|
68
70
|
zcode-acp quota -w
|
|
@@ -96,21 +98,28 @@ node dist/cli.js quota -w
|
|
|
96
98
|
|
|
97
99
|
Opencode Go has no JSON API for subscription usage — the CLI scrapes the
|
|
98
100
|
authenticated dashboard at `opencode.ai/workspace/<id>/go`, so it needs your
|
|
99
|
-
browser `auth` cookie. Credentials are read from
|
|
100
|
-
field-by-field
|
|
101
|
-
file:
|
|
101
|
+
browser `auth` cookie. Credentials are read from three sources, **merged
|
|
102
|
+
field-by-field, highest precedence first**:
|
|
102
103
|
|
|
103
|
-
- **
|
|
104
|
-
|
|
105
|
-
you're done.
|
|
104
|
+
- **Our config file** (`~/.config/zcode-acp/config.json`, `quota` section —
|
|
105
|
+
the preferred home):
|
|
106
106
|
```json
|
|
107
|
-
{ "
|
|
107
|
+
{ "quota": {
|
|
108
|
+
"opencodeGoWorkspaceId": "wrk_your_workspace_id",
|
|
109
|
+
"opencodeGoAuthCookie": "Fe26.2**your_cookie_value"
|
|
110
|
+
} }
|
|
108
111
|
```
|
|
109
|
-
- **Environment variables** (override the
|
|
112
|
+
- **Environment variables** (override the legacy file below):
|
|
110
113
|
```bash
|
|
111
114
|
export OPENCODE_GO_WORKSPACE_ID="wrk_your_workspace_id"
|
|
112
115
|
export OPENCODE_GO_AUTH_COOKIE="Fe26.2**your_cookie_value"
|
|
113
116
|
```
|
|
117
|
+
- **Legacy config file**: `~/.pi/agent/opencode-go.json` — same convention as
|
|
118
|
+
the `@beyona/pi-zai-usage` Pi extension, kept so existing setups keep
|
|
119
|
+
working unchanged.
|
|
120
|
+
```json
|
|
121
|
+
{ "workspaceId": "wrk_your_workspace_id", "authCookie": "Fe26.2**your_cookie_value" }
|
|
122
|
+
```
|
|
114
123
|
|
|
115
124
|
How to get the values:
|
|
116
125
|
|
|
@@ -121,9 +130,32 @@ How to get the values:
|
|
|
121
130
|
`opencode.ai` → copy the value of the cookie named `auth` (it starts with
|
|
122
131
|
`Fe26.2**`).
|
|
123
132
|
|
|
124
|
-
Without credentials, the default
|
|
133
|
+
Without credentials, the default multi-provider mode silently shows GLM only
|
|
125
134
|
(no error). Running `zcode-acp quota go` without credentials prints a setup hint.
|
|
126
135
|
|
|
136
|
+
## Ollama Cloud setup
|
|
137
|
+
|
|
138
|
+
Ollama Cloud exposes an (undocumented) usage endpoint at
|
|
139
|
+
`ollama.com/api/usage` that the CLI queries with your API key. Create a key
|
|
140
|
+
at [cloud.ollama.ai](https://cloud.ollama.ai) → API keys. The key comes from
|
|
141
|
+
two sources, with the **config file taking precedence** over the environment
|
|
142
|
+
variable:
|
|
143
|
+
|
|
144
|
+
- **Config file** (`~/.config/zcode-acp/config.json`, `quota` section):
|
|
145
|
+
```json
|
|
146
|
+
{ "quota": { "ollamaApiKey": "your_ollama_api_key" } }
|
|
147
|
+
```
|
|
148
|
+
- **Environment variable** (fallback / one-off override):
|
|
149
|
+
```bash
|
|
150
|
+
export OLLAMA_API_KEY="your_ollama_api_key"
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
The card shows whatever usage windows the account's plan exposes — legacy
|
|
154
|
+
plans get `5h` + `Week` bars, current credit plans get a `Month` bar (the
|
|
155
|
+
server returns fractions only, no reset timestamps). Without a key, the
|
|
156
|
+
default mode silently skips the Ollama section; `zcode-acp quota oc` without
|
|
157
|
+
a key prints a setup hint.
|
|
158
|
+
|
|
127
159
|
## Hub and server subcommands
|
|
128
160
|
|
|
129
161
|
`zcode-acp hub` runs the remote-access hub daemon manually (normally
|
package/docs/REMOTE-CLIENTS.md
CHANGED
|
@@ -329,8 +329,8 @@ Fetch once after attach and on demand; quota changes are slow, there is no
|
|
|
329
329
|
push.
|
|
330
330
|
|
|
331
331
|
Both channels return the same payload, mirroring the `zcode-acp quota` CLI card's
|
|
332
|
-
data model — one GLM section
|
|
333
|
-
reproduce the CLI layout exactly:
|
|
332
|
+
data model — one GLM section, one Opencode Go section, and one Ollama Cloud
|
|
333
|
+
section — so clients can reproduce the CLI layout exactly:
|
|
334
334
|
|
|
335
335
|
```json
|
|
336
336
|
→ { "id": 7, "method": "account/usage_stats", "params": {} }
|
|
@@ -354,6 +354,13 @@ reproduce the CLI layout exactly:
|
|
|
354
354
|
{ "key": "weekly", "label": "Week", "usagePercent": 25,
|
|
355
355
|
"resetsAt": 1724071200000 }
|
|
356
356
|
]
|
|
357
|
+
},
|
|
358
|
+
"ollama": {
|
|
359
|
+
"kind": "success",
|
|
360
|
+
"windows": [
|
|
361
|
+
{ "key": "session", "label": "5h", "usagePercent": 31 },
|
|
362
|
+
{ "key": "weekly", "label": "Week", "usagePercent": 67.5 }
|
|
363
|
+
]
|
|
357
364
|
}
|
|
358
365
|
} }
|
|
359
366
|
```
|
|
@@ -369,6 +376,13 @@ reproduce the CLI layout exactly:
|
|
|
369
376
|
countdown is resolved to an absolute `resetsAt` (epoch ms). `not_configured`
|
|
370
377
|
means the user never set OpenCode Go credentials — omit the section, like
|
|
371
378
|
the CLI does.
|
|
379
|
+
- `ollama` (`kind`: `success` | `not_configured` | `auth_error` |
|
|
380
|
+
`unavailable`): on success, `windows` carries whichever entries the
|
|
381
|
+
account's plan exposes — legacy plans: `session` (`5h`) + `weekly`
|
|
382
|
+
(`Week`); current credit plans: `monthly` (`Month`) — each with
|
|
383
|
+
`usagePercent` (0–100). There is no `resetsAt` — ollama.com exposes no
|
|
384
|
+
reset timestamps. `not_configured` means no Ollama API key is set — omit
|
|
385
|
+
the section, like the CLI does.
|
|
372
386
|
- Provider failures are per-section `kind` strings, not JSON-RPC errors —
|
|
373
387
|
render the same status line the CLI would (e.g. auth expired) and retry
|
|
374
388
|
later. Only transport-level failures reject the request.
|