@mars-sea/dsh-commandcode-provider 0.3.0 → 0.4.1
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/CHANGELOG.md +14 -0
- package/README.md +8 -3
- package/README.zh-CN.md +8 -3
- package/assets/screenshots/settings-page.png +0 -0
- package/lib/client.js +669 -8
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +149 -6
- package/lib/index.js +384 -21
- package/lib/index.js.map +1 -1
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.4.1] - 2026-08-18
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- **Synced with the official command-code@1.27.1 CLI** (upstream moved from 1.26.0 → 1.27.0 → 1.27.1). `COMMAND_CODE_CLI_VERSION` is now `1.27.1`, sent as `x-command-code-version` on every request. The only user-visible upstream change is **GPT-5.6 Sol** (added in command-code@1.27.0, "50% off in GOAT and above"): it is a GOAT-tier model, so `KNOWN_PLANS` now maps `gpt-5.6-sol` to `goat` (was `pro`) — GOAT accounts will now see it in the picker instead of having it filtered out. Re-verified every other snapshot against the official sources with no changes: `KNOWN_EFFORTS` (identical to the 1.27.1 `ZA` table), `KNOWN_IMAGE_MODELS` (the docs registry's Vision set is unchanged and includes Sol), `KNOWN_THINKING_MODELS`, `KNOWN_SUBSCRIPTION_PLANS` (the `Nn`/`$n` plan maps are untouched), `KNOWN_DEALS` (the pricing page lists no Sol deal — its "50% off" is not a `KNOWN_DEALS` entry), and `KNOWN_PEAK_PRICING` (DeepSeek V4 Pro/Flash, 01–04 & 06–10 UTC). Wire protocol, endpoints, and auth flow are unchanged in the 1.27.x bundle.
|
|
12
|
+
|
|
13
|
+
## [0.4.0] - 2026-08-17
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **The settings page now shows a live "Account usage" card** (Settings → **Command Code**) with the same facts the `/commandcode` command prints — account name, request totals with success rate, spend, token in/out, monthly/purchased/free credits, and the 5-hour and weekly window limits as progress bars with reset times and exceeded markers. The report is produced Host-side (the browser never holds the API key) and crosses to the page through a new Typert Remote endpoint `commandcode/report`: the Host half registers a `commandcodeUsage` service plus a strict invocation descriptor on the `typert` registry (riding an optional inject, so profiles without the web stack are unaffected), and the client half mounts the shared contribution on `ctx.remote` (resolving the `remote.commandcode` namespace through a dynamic scoped inject, since cordis only serves a fiber the services it declares and the namespace exists only after the mount) and renders the result as a native card — stat tiles and CSS progress bars, not markdown. The card fetches automatically once a key is configured, refetches after a landed save (the key or endpoint may have changed), and offers a manual refresh; a failure (no key, unreachable host, or an older Host half) renders an inline error with the card's previous data retained. The shared wire contract (`src/usage-wire.ts`) — a hand-rolled strict result schema plus the single descriptor object both halves register — is covered by new tests in `tests/usage-wire.test.ts`, and the fetch-lifecycle controller by `tests/usage-client.test.ts`.
|
|
18
|
+
- **The usage report now includes the account's subscription plan**, fetched from `/alpha/billing/subscriptions` (org-scoped like the official CLI, with the `credits.planId` fallback the CLI also uses) and shown as a plan badge (Go / GOAT / Pro / Max / Provider / Ultra / Teams Pro) in the card header — plus the billing period end in the card footer and a `📦 套餐` line in the `/commandcode` command output. Plan ids resolve through a new `KNOWN_SUBSCRIPTION_PLANS` snapshot + `subscriptionPlanInfo()` (longest-prefix matching, mirroring the CLI's `getPlanInfo`), synced from the CLI bundle's plan table; a non-`active` subscription status surfaces as a badge next to the plan name.
|
|
19
|
+
- **The model picker now hides models above the account's subscription tier.** `listModels()` filters the catalog through `modelVisibleInPlan()` using billing facts from one cached `/alpha/billing/credits` call (`credits.planId` + balances, 5-minute TTL). The filter mirrors the official CLI's access model — **any positive on-demand credit balance unlocks every model** — and fails open at every uncertainty (billing endpoint down, unknown plan, unmapped model), so a stale plugin never hides a usable model; the server remains the final gate (`403 MODEL_NOT_IN_PLAN`). The catalog itself is never filtered (`resolveModel` still serves every model), and a new **"Hide out-of-plan models" toggle on the settings page** (the `filterModelsByPlan` section field) restores the full list.
|
|
20
|
+
|
|
7
21
|
## [0.3.0] - 2026-08-17
|
|
8
22
|
|
|
9
23
|
### Added
|
package/README.md
CHANGED
|
@@ -10,17 +10,18 @@
|
|
|
10
10
|
[](https://opensource.org/licenses/MIT)
|
|
11
11
|
[](https://www.npmjs.com/package/@mars-sea/dsh-commandcode-provider)
|
|
12
12
|
|
|
13
|
-
Unofficial [DeepSeek Harness](https://deepseek-harness.github.io/deepseek-harness/) LLM provider plugin for **Command Code**, ported from [pi-commandcode-provider](https://github.com/patlux/pi-commandcode-provider) (MIT). It registers a `commandcode` provider whose requests are translated to Command Code's Provider API (`POST /alpha/generate`, reverse-engineered by the pi plugin, `command-code@1.
|
|
13
|
+
Unofficial [DeepSeek Harness](https://deepseek-harness.github.io/deepseek-harness/) LLM provider plugin for **Command Code**, ported from [pi-commandcode-provider](https://github.com/patlux/pi-commandcode-provider) (MIT). It registers a `commandcode` provider whose requests are translated to Command Code's Provider API (`POST /alpha/generate`, reverse-engineered by the pi plugin, `command-code@1.27.1`).
|
|
14
14
|
|
|
15
15
|
> This is a community integration. You need your own Command Code account and API key or subscription, and Command Code's terms apply. This project is not affiliated with Command Code, Inc.
|
|
16
16
|
|
|
17
17
|
## What you get
|
|
18
18
|
|
|
19
19
|
- **Plugin bundle** installable into any dsh profile with `dsh plugin add`, plus a **`commandcode` provider route** with a live catalog (`GET {apiBase}/provider/v1/models`, cached at `~/.commandcode/models-cache.json`).
|
|
20
|
-
- **Dedicated "Command Code" settings page** (Settings → **Command Code**) with an **API-key field
|
|
20
|
+
- **Dedicated "Command Code" settings page** (Settings → **Command Code**) with an **API-key field**, connection knobs (API base, working directory, request/stream timeouts), a **live "Account usage" card** (stats, credits, window-limit bars, subscription plan badge) and a **Hide out-of-plan models** toggle. The key is stored through the dsh credentials service; connection fields land in the `llm-commandcode` section and apply to the very next request, no restart.
|
|
21
21
|
- **API key resolution order**: `config.apiKey` → credential ref `apiKeyEnv` (default `COMMANDCODE_API_KEY`) → launch environment → the official CLI auth file (`~/.commandcode/auth.json`, from `command-code login`).
|
|
22
22
|
- **Model-picker annotations**: every model shows the **minimum plan** that includes it (`KNOWN_PLANS`), an **active deal** or `FREE` badge (`KNOWN_DEALS`, expiry-aware so lapsed discounts hide themselves), the **current peak/off-peak state** (`Peak`/`Half`) for time-of-day-priced models, an **`Image`** marker for Vision models, and the **context window** (`1M` / `256K` / `262K`) — e.g. *"Go · 50% off · Image · 1M"*, *"Go · Half · 1M"*. The list is **sorted by plan tier** (Go → GOAT → Pro → Provider/Max), so the models your plan can use lead the picker.
|
|
23
|
-
- **
|
|
23
|
+
- **Plan-aware picker filtering**: the picker **hides models above your subscription tier** outright (resolved live from your account's billing state). It fails open — an unreachable billing endpoint, an unknown plan, or a positive on-demand credit balance (which the official CLI treats as unlocking every model) all keep the full catalog visible — and the server stays the final gate. Set **Hide out-of-plan models** off on the settings page (or `filterModelsByPlan: false` in the `llm-commandcode` settings section) to always list every model.
|
|
24
|
+
- **Reasoning-effort support** for models the official catalog marks as such (`KNOWN_EFFORTS`, matching `command-code@1.27.1`); reasoning models without effort levels still think automatically, exactly like the official CLI.
|
|
24
25
|
- **Image input for Vision-capable models** (sent in the official wire format via the dsh attachment service); text-only models refuse images loudly (`UNSUPPORTED_CONTENT`) rather than dropping them.
|
|
25
26
|
|
|
26
27
|
<img src="assets/screenshots/model-picker.png" alt="Model picker with plan, deal, image and context annotations" width="250">
|
|
@@ -142,6 +143,10 @@ Each endpoint degrades independently — a temporary failure of one leaves the r
|
|
|
142
143
|
|
|
143
144
|
**Settings → Command Code** is the primary surface: an **API-key** field (stored in `$DSH_HOME/.credentials.yaml` via the credentials service; write-only, reports whether a key is set), plus **API base URL**, **working directory**, and **request/stream timeout** fields, all written to the `llm-commandcode` section. The catalog is browsable without a key. The **working directory** is optional — leave it blank and the placeholder shows the process cwd it resolves to.
|
|
144
145
|
|
|
146
|
+
Once a key is configured, the page header shows a live **Account usage** card — the same account, spend, credit, and window-limit facts as `/commandcode`, plus your subscription plan badge and billing period end — fetched Host-side (the key never leaves it) and rendered natively:
|
|
147
|
+
|
|
148
|
+
<img src="assets/screenshots/settings-page.png" alt="Command Code settings page with the account usage card" width="640">
|
|
149
|
+
|
|
145
150
|
The same knobs live in `$DSH_HOME/settings.yaml` (per-request overrides, no restart):
|
|
146
151
|
|
|
147
152
|
```yaml
|
package/README.zh-CN.md
CHANGED
|
@@ -10,17 +10,18 @@
|
|
|
10
10
|
[](https://opensource.org/licenses/MIT)
|
|
11
11
|
[](https://www.npmjs.com/package/@mars-sea/dsh-commandcode-provider)
|
|
12
12
|
|
|
13
|
-
非官方 [DeepSeek Harness](https://deepseek-harness.github.io/deepseek-harness/) 的 LLM provider 插件,用于 **Command Code**,移植自 [pi-commandcode-provider](https://github.com/patlux/pi-commandcode-provider)(MIT 协议)。它注册了一个 `commandcode` provider,将请求转换为 Command Code 的 Provider API(`POST /alpha/generate`,由 pi 插件逆向工程,对应 `command-code@1.
|
|
13
|
+
非官方 [DeepSeek Harness](https://deepseek-harness.github.io/deepseek-harness/) 的 LLM provider 插件,用于 **Command Code**,移植自 [pi-commandcode-provider](https://github.com/patlux/pi-commandcode-provider)(MIT 协议)。它注册了一个 `commandcode` provider,将请求转换为 Command Code 的 Provider API(`POST /alpha/generate`,由 pi 插件逆向工程,对应 `command-code@1.27.1`)。
|
|
14
14
|
|
|
15
15
|
> 这是一个社区集成。你需要自己的 Command Code 账号、API key 或订阅,并遵守 Command Code 的服务条款。本项目与 Command Code, Inc. 无关。
|
|
16
16
|
|
|
17
17
|
## 功能一览
|
|
18
18
|
|
|
19
19
|
- **插件包**:可通过 `dsh plugin add` 安装到任意 dsh 配置,并提供 **`commandcode` provider 路由**,带实时模型目录(`GET {apiBase}/provider/v1/models`,缓存于 `~/.commandcode/models-cache.json`)。
|
|
20
|
-
- **专属"Command Code"设置页**(设置 → **Command Code**),带 **API key
|
|
20
|
+
- **专属"Command Code"设置页**(设置 → **Command Code**),带 **API key 输入框**、连接参数(API 地址、工作目录、请求/流超时)、**实时「账户用量」卡片**(统计、额度、窗口进度条、订阅套餐徽章)以及**「隐藏套餐外模型」开关**。密钥通过 dsh 凭据服务存储;连接参数写入 `llm-commandcode` 设置段,对下一次请求即刻生效,无需重启。
|
|
21
21
|
- **API key 解析顺序**:`config.apiKey` → 凭据引用 `apiKeyEnv`(默认 `COMMANDCODE_API_KEY`)→ 启动环境变量 → 官方 CLI 认证文件(`~/.commandcode/auth.json`,由 `command-code login` 写入)。
|
|
22
22
|
- **模型选择器标注**:每个模型显示包含它的**最低套餐**(`KNOWN_PLANS`)、**活动折扣**或 `FREE` 徽章(`KNOWN_DEALS`,到期自动隐藏已失效折扣)、峰谷定价模型的**当前时段状态**(`Peak`/`Half`,按当前 UTC 小时动态判断)、Vision 模型的 **`Image`** 标记,以及**上下文长度**(`1M` / `256K` / `262K`)——例如 *"Go · 50% off · Image · 1M"*、*"Go · Half · 1M"*。列表**按套餐排序**(Go → GOAT → Pro → Provider/Max),你当前套餐能用的模型总是排在最前。
|
|
23
|
-
-
|
|
23
|
+
- **按套餐过滤选择器**:选择器会**直接隐藏超出你订阅套餐的模型**(根据账户账单状态实时判断)。全程失败开放——账单接口不可用、套餐未知,或账户持有按需余额(官方 CLI 视为解锁全部模型)时都显示完整目录——服务端仍是最终闸门。在设置页关闭「隐藏套餐外模型」开关(或在 `llm-commandcode` 设置段中设 `filterModelsByPlan: false`)可始终列出全部模型。
|
|
24
|
+
- **推理强度(reasoning-effort)支持**:针对官方目录标为推理模型的模型(`KNOWN_EFFORTS`,与 `command-code@1.27.1` 一致);没有可选档位但仍支持思考的模型会自动思考,与官方 CLI 行为完全一致。
|
|
24
25
|
- **支持视觉模型的图片输入**(通过 dsh 附件服务、以官方 wire 格式发送);纯文本模型会明确拒绝图片(`UNSUPPORTED_CONTENT`)而非静默丢弃。
|
|
25
26
|
|
|
26
27
|
<img src="assets/screenshots/model-picker.png" alt="带套餐、折扣、图片与上下文标注的模型选择器" width="250">
|
|
@@ -142,6 +143,10 @@ dsh web
|
|
|
142
143
|
|
|
143
144
|
**设置 → Command Code** 是主要配置入口:**API key** 输入框(通过凭据服务存储在 `$DSH_HOME/.credentials.yaml`,只写不回显,并显示是否已配置),以及 **API 地址**、**工作目录**、**请求/流超时**字段,全部写入 `llm-commandcode` 设置段。没有 key 也可以浏览模型目录。**工作目录可选**——留空即可,占位符会显示它实际使用的进程 cwd。
|
|
144
145
|
|
|
146
|
+
配置好 key 后,页面顶部会显示实时**「账户用量」卡片**——与 `/commandcode` 相同的账户、花费、额度与窗口限制信息,外加订阅套餐徽章和账期截止——数据在宿主端获取(key 不会离开宿主),并以原生 UI 渲染:
|
|
147
|
+
|
|
148
|
+
<img src="assets/screenshots/settings-page.png" alt="Command Code 设置页面(含账户用量卡片)" width="640">
|
|
149
|
+
|
|
145
150
|
同一组选项也位于 `$DSH_HOME/settings.yaml`(按请求覆盖,无需重启):
|
|
146
151
|
|
|
147
152
|
```yaml
|
|
Binary file
|