@goodandready/dsh-clinebot 0.2.1 → 0.3.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 CHANGED
@@ -5,6 +5,32 @@ All notable changes to `@goodandready/dsh-clinebot` will be documented in this f
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.1] - 2026-09-07
9
+
10
+ ### Fixed
11
+ - **Style Isolation Attribute**: Added `data-dsh-plugin="dsh-clinebot"` (`style.dataset.dshPlugin`) to dynamically injected CSS tag in `lib/client.js`, protecting styles from cleanup during neighbor plugin HMR and profile updates.
12
+
13
+ ## [0.3.0] - 2026-09-05
14
+
15
+ ### Added
16
+ - **Dynamic Subscription Models Sync**: Added integration with official ClinePass plan endpoint (`GET /api/v1/users/me/plan` -> `features.included`). Models available under the user's subscription plan are parsed dynamically, mapped with fallback IDs, and synced directly to DSH provider configuration without requiring manual updates.
17
+ - **Strict Real Provider Catalog**: Replaced manual custom model entry forms with one-click dynamic synchronization (`POST /dsh-clinebot/models/sync` and UI sync button), eliminating out-of-sync manual model entries and guaranteeing 100% provider alignment.
18
+ - **Rolling Window Quota Exhaustion Warnings**: Added real-time threshold detection and prominent UI warning banners when the 5-hour rolling limit reaches 80% (warning, amber) and 95% (exhausted, red), complete with dynamic countdowns to reset.
19
+ - **Session Metrics & Usage Tracking**: Added in-memory session telemetry displaying total requests executed, estimated prompt/completion/total tokens, last roundtrip latency, and timestamp of the last request in a dedicated UI metrics card.
20
+ - **Extended `/cline` Slash-Command**: Slash-command now outputs quota warning banners and active session metrics (total calls, tokens, last request) alongside rolling window progress bars.
21
+ - **Canonical Deployment Script**: Added `deploy.sh` script conforming to dhsplugins standard for automated profile installation and service restart (Issue #3).
22
+
23
+ ### Fixed
24
+ - **Slot Registration Smell**: Fixed dual unconditional slot registration: plugin card now registers primarily in `settings.plugin.item`, with graceful fallback to `settings.section` if not declared (Issue #5).
25
+ - **Settings Snapshot Status & Reactivity**: Integrated reactive `ctx.settingsScope` binding with `useSyncExternalStore`, checking snapshot status (`ready`, `loading`, `unavailable`) and propagating edits via `scope.set()` (Issue #6).
26
+ - **Slot Locales**: Attached `locale: NS` to slot options and registered localized dictionaries with `ctx.locale.register()` (Issue #7).
27
+ - **Button Hover State**: Fixed CSS button hover visibility regression on primary action buttons.
28
+
29
+ ## [0.2.1] - 2026-09-05
30
+
31
+ ### Fixed
32
+ - **Client Bundle Inject Compatibility**: Resolved client-side inject bundle loading for DSH web profile runtime.
33
+
8
34
  ## [0.2.0] - 2026-09-04
9
35
 
10
36
  ### Added
package/README.md CHANGED
@@ -38,11 +38,13 @@ Integrating ClinePass into DeepSeek Harness (DSH) natively poses key challenges:
38
38
 
39
39
  **`@goodandready/dsh-clinebot`** provides a complete solution:
40
40
  * 🖥️ **Dedicated Settings Page**: Full-width page in DSH Settings (`Settings → ClineBot`).
41
+ * 🔄 **Dynamic Subscription Model Sync**: Automatically pulls real models included in your ClinePass plan directly from `GET /api/v1/users/me/plan` with one-click DSH provider sync.
42
+ * ⚠️ **Quota Exhaustion Alerts**: Real-time visual warning banners when 5-hour rolling limit reaches 80% (warning) and 95% (exhausted), complete with countdown to reset.
43
+ * 📈 **Session Metrics Telemetry**: Live dashboard tracking request counts, token consumption estimates, latency, and last-request timestamp.
41
44
  * 📊 **Live Quota Dashboard**: Visual progress bars for 5-hour rolling limits and weekly windows from the official `GET /users/me/plan/usage-limits` API.
42
45
  * 🔑 **In-UI Key Storage**: Paste your API key directly in the UI; it is saved securely via `ctx.credentials.set()` into `~/.dsh/.credentials.yaml`.
43
46
  * 🎯 **Model Picker Management**: Granular checkboxes to choose which models appear in the chat picker.
44
- * ➕ **Add Custom Models**: Add newly released ClinePass models directly from the UI without waiting for plugin updates.
45
- * 💬 **Slash-Command `/cline`**: Check quota, limits, latency, and active model directly from the DSH chat console.
47
+ * 💬 **Slash-Command `/cline`**: Check quota, limits, warnings, session metrics, latency, and active model directly from the DSH chat console.
46
48
 
47
49
  ---
48
50
 
@@ -52,15 +54,16 @@ Integrating ClinePass into DeepSeek Harness (DSH) natively poses key challenges:
52
54
  graph LR
53
55
  subgraph UI [DSH Web Interface]
54
56
  Page["Dedicated Page (Settings -> ClineBot)"]
55
- QuotaBar["5-Hour & Weekly Progress Bars"]
57
+ QuotaBar["5-Hour & Weekly Progress Bars & Warning Banner"]
56
58
  KeyInput["Direct Key Paste & Save"]
57
- ModelPick["Model Picker Controls & Custom Models"]
59
+ ModelPick["Dynamic Model Sync & Picker Controls"]
60
+ StatsCard["Session Metrics Telemetry"]
58
61
  end
59
62
 
60
63
  subgraph PluginHost [dsh-clinebot Host Runtime]
61
64
  HttpEndpoints["API: /api/plugins/dsh-clinebot/*"]
62
65
  ClientCore["lib/cline-client.js"]
63
- ModelCatalog["lib/models.js (Curated + Custom)"]
66
+ ModelCatalog["lib/models.js (Curated + Dynamic Plan)"]
64
67
  SlashCmd["Command: /cline"]
65
68
  end
66
69
 
@@ -72,17 +75,19 @@ graph LR
72
75
  subgraph Upstream [Cline Cloud]
73
76
  ClinePass["api.cline.bot/api/v1/chat/completions"]
74
77
  ClineQuota["api.cline.bot/api/v1/users/me/plan/usage-limits"]
78
+ ClinePlan["api.cline.bot/api/v1/users/me/plan"]
75
79
  end
76
80
 
77
81
  Page -->|GET /status & /usage| HttpEndpoints
78
82
  KeyInput -->|POST /save-key| HttpEndpoints
79
- ModelPick -->|POST /register & /models| HttpEndpoints
83
+ ModelPick -->|POST /models/sync| HttpEndpoints
80
84
  HttpEndpoints --> Credentials
81
85
  HttpEndpoints --> ClientCore
82
86
  ClientCore --> ModelCatalog
83
87
  HttpEndpoints -->|Atomic Mutate| PiAi
84
88
  ClientCore -->|Chat| ClinePass
85
89
  ClientCore -->|Usage Limits| ClineQuota
90
+ ClientCore -->|Plan Features| ClinePlan
86
91
  ```
87
92
 
88
93
  ---
@@ -90,16 +95,17 @@ graph LR
90
95
  ## ✨ Features & Module Breakdown
91
96
 
92
97
  * **`lib/models.js`**:
93
- Manages the curated catalog (11 built-in models) and user-added custom models (`getAllModels`, `validateCustomModel`).
98
+ Manages the curated catalog (11 built-in models) and dynamically parses subscription plan models (`parsePlanIncludedModels`, `getAllModels`, `getDynamicModels`).
94
99
  * **`lib/cline-client.js`**:
95
- * `fetchUsageLimits`: queries `GET /users/me/plan/usage-limits` and `GET /users/me` with in-memory caching.
100
+ * `fetchUsageLimits`: queries `GET /users/me/plan/usage-limits`, `GET /users/me/plan`, and `GET /users/me` with in-memory caching.
101
+ * `sessionStats` / `recordSessionRequest`: in-memory telemetry recording requests count, tokens, latency, and timestamps.
96
102
  * `saveCredentialKey`: writes credentials directly into `~/.dsh/.credentials.yaml`.
97
- * `smokeChat`: tests latency via non-streaming ping.
103
+ * `smokeChat`: tests latency via non-streaming ping and updates session metrics.
98
104
  * `buildPiAiProvider`: builds the DSH `llm-pi-ai` structure (`api: 'openai-completions'`).
99
105
  * **`lib/index.js`**:
100
- Cordis service module managing routes, credentials, and registering the `/cline` slash command.
106
+ Cordis service module managing routes (including `POST /dsh-clinebot/models/sync`), quota warnings threshold evaluation, credentials, and registering the `/cline` slash command.
101
107
  * **`lib/client.js`**:
102
- Full-featured dedicated Settings section (`settings.section`, order 28) and plugin accordion (`settings.plugin.item`).
108
+ Full-featured dedicated Settings section (`settings.section`, order 28) with live quota bars, exhaustion warning banner, session metrics telemetry card, one-click plan sync button, and plugin accordion (`settings.plugin.item`).
103
109
 
104
110
  ---
105
111
 
@@ -115,7 +121,7 @@ Restart your DeepSeek Harness instance and refresh the browser.
115
121
 
116
122
  ## 💬 Slash-Command `/cline`
117
123
 
118
- From any DSH chat session, type `/cline` to inspect quota and status:
124
+ From any DSH chat session, type `/cline` to inspect quota, warning alerts, and session telemetry:
119
125
 
120
126
  ```text
121
127
  ### 🤖 ClinePass Status (ClinePass ($9.99/mo))
@@ -126,6 +132,11 @@ From any DSH chat session, type `/cline` to inspect quota and status:
126
132
  ⏱ 5-Hour Window: [████░░░░░░] 42% (resets: 18:00)
127
133
  📅 Weekly Window: [██████░░░░] 60% (resets: Sep 8)
128
134
  * Account: `developer@example.com`
135
+
136
+ 📈 Session Metrics:
137
+ * Requests: 14 calls
138
+ * Tokens: ~8,450 (Prompt: 6,100 | Completion: 2,350)
139
+ * Last Latency: 210 ms
129
140
  ```
130
141
 
131
142
  ---
@@ -147,7 +158,7 @@ dsh-clinebot:
147
158
  - cline-pass/deepseek-v4-pro
148
159
  - cline-pass/kimi-k3
149
160
  - cline-pass/qwen3.7-max
150
- customModels: []
161
+ dynamicModels: []
151
162
  ```
152
163
 
153
164
  ### Configuration Parameters
@@ -161,7 +172,7 @@ dsh-clinebot:
161
172
  | `timeoutMs` | `number` | `15000` | HTTP request timeout in milliseconds |
162
173
  | `smokeTimeoutMs` | `number` | `25000` | Smoke test latency ping timeout |
163
174
  | `enabledModels` | `array` | `[...]` | List of models exposed in the DSH chat picker |
164
- | `customModels` | `array` | `[]` | User-defined custom model entries |
175
+ | `dynamicModels` | `array` | `[]` | Dynamic models automatically synced from the official plan |
165
176
 
166
177
  ---
167
178
 
package/docs/README.ru.md CHANGED
@@ -38,11 +38,13 @@
38
38
 
39
39
  Плагин **`@goodandready/dsh-clinebot`** решает эти задачи «из коробки»:
40
40
  * 🖥️ **Отдельная страница в Настройках**: собственная полноэкранная страница в меню Настроек DSH (`Настройки → ClineBot`).
41
- * 📊 **Дашборд лимитов подписки (Usage)**: наглядные прогресс-бары расхода 5-часового и недельного скользящего окна из официального API `GET /users/me/plan/usage-limits` с таймером сброса.
41
+ * 🔄 **Динамическая синхронизация моделей подписки**: автоматическое получение реального списка моделей из `GET /api/v1/users/me/plan` и мгновенное обновление провайдера DSH в один клик.
42
+ * ⚠️ **Предупреждения об исчерпании квоты**: баннеры предупреждения при достижении 80% (внимание) и 95% (исчерпано) 5-часового лимита с таймером сброса.
43
+ * 📈 **Метрики сессии**: учет количества запросов, расчетных токенов (Prompt / Completion), задержки и времени последнего вызова.
44
+ * 📊 **Дашборд лимитов подписки (Usage)**: наглядные прогресс-бары расхода 5-часового и недельного скользящего окна из официального API `GET /users/me/plan/usage-limits`.
42
45
  * 🔑 **Сохранение ключа прямо из UI**: поле ввода ключа с маскировкой; сохранение напрямую в системный сервис `credentials` (`~/.dsh/.credentials.yaml`) без ручной правки файлов на сервере.
43
46
  * 🎯 **Управление моделями в пикере**: включение/выключение отображения конкретных моделей в диалогах чата.
44
- * ➕ **Добавление кастомных моделей**: форма добавления новых моделей подписки (ID, имя, контекст, Vision) без необходимости ждать обновления плагина.
45
- * 💬 **Слэш-команда `/cline` в чате**: просмотр остатка квот, задержки и активной модели прямо из чата.
47
+ * 💬 **Слэш-команда `/cline` в чате**: просмотр остатка квот, предупреждений, статистики сессии, задержки и активной модели прямо из чата.
46
48
 
47
49
  ---
48
50
 
@@ -52,15 +54,16 @@
52
54
  graph LR
53
55
  subgraph UI [Интерфейс DSH]
54
56
  Page["Отдельная страница (Настройки -> ClineBot)"]
55
- QuotaBar["Прогресс-бары 5h и недельного лимита"]
57
+ QuotaBar["Прогресс-бары 5h и недельного лимита + Баннер предупреждений"]
56
58
  KeyInput["Ввод и сохранение API-ключа"]
57
- ModelPick["Управление пикером и новые модели"]
59
+ ModelPick["Динамическая синхронизация моделей и пикер"]
60
+ StatsCard["Метрики и статистика текущей сессии"]
58
61
  end
59
62
 
60
63
  subgraph PluginHost [Хост-часть dsh-clinebot]
61
64
  HttpEndpoints["API: /api/plugins/dsh-clinebot/*"]
62
65
  ClientCore["lib/cline-client.js"]
63
- ModelCatalog["lib/models.js (Встроенные + Кастомные)"]
66
+ ModelCatalog["lib/models.js (Встроенные + Динамические из плана)"]
64
67
  SlashCmd["Слэш-команда: /cline"]
65
68
  end
66
69
 
@@ -72,31 +75,34 @@ graph LR
72
75
  subgraph Upstream [Сервер Cline]
73
76
  ClinePass["api.cline.bot/api/v1/chat/completions"]
74
77
  ClineQuota["api.cline.bot/api/v1/users/me/plan/usage-limits"]
78
+ ClinePlan["api.cline.bot/api/v1/users/me/plan"]
75
79
  end
76
80
 
77
81
  Page -->|GET /status & /usage| HttpEndpoints
78
82
  KeyInput -->|POST /save-key| HttpEndpoints
79
- ModelPick -->|POST /register & /models| HttpEndpoints
83
+ ModelPick -->|POST /models/sync| HttpEndpoints
80
84
  HttpEndpoints --> Credentials
81
85
  HttpEndpoints --> ClientCore
82
86
  ClientCore --> ModelCatalog
83
87
  HttpEndpoints -->|Атомарная мутация| PiAi
84
88
  ClientCore -->|Чат| ClinePass
85
89
  ClientCore -->|Квоты| ClineQuota
90
+ ClientCore -->|Тарифный план| ClinePlan
86
91
  ```
87
92
 
88
93
  ---
89
94
 
90
95
  ## ✨ Структура модулей и возможности
91
96
 
92
- * **`lib/models.js`**: каталог встроенных моделей ClinePass (11 моделей) и управление пользовательскими моделями (`getAllModels`, `validateCustomModel`).
97
+ * **`lib/models.js`**: каталог встроенных моделей ClinePass (11 моделей) и парсер моделей подписки (`parsePlanIncludedModels`, `getAllModels`, `getDynamicModels`).
93
98
  * **`lib/cline-client.js`**:
94
- * `fetchUsageLimits`: опрос `GET /users/me/plan/usage-limits` и `GET /users/me` с кэшированием в памяти.
99
+ * `fetchUsageLimits`: параллельный опрос `GET /users/me/plan/usage-limits`, `GET /users/me/plan` и `GET /users/me` с кэшированием в памяти.
100
+ * `sessionStats` / `recordSessionRequest`: счетчики сессии (запросы, токены, задержка, время).
95
101
  * `saveCredentialKey`: атомарная запись ключей в `~/.dsh/.credentials.yaml`.
96
- * `smokeChat`: замер задержки и тестовый пинг.
102
+ * `smokeChat`: замер задержки и тестовый пинг с фиксацией статистики.
97
103
  * `buildPiAiProvider`: генерация конфигурации провайдера для `llm-pi-ai` (`api: 'openai-completions'`).
98
- * **`lib/index.js`**: сервис Cordis, регистрация системных маршрутов и слэш-команды `/cline`.
99
- * **`lib/client.js`**: полнофункциональный раздел настроек (`settings.section`, order 28) и аккордеон плагина (`settings.plugin.item`).
104
+ * **`lib/index.js`**: сервис Cordis, регистрация системных маршрутов (включая `/dsh-clinebot/models/sync`), расчет порогов предупреждения квоты и слэш-команды `/cline`.
105
+ * **`lib/client.js`**: полнофункциональный раздел настроек (`settings.section`, order 28) с баннерами предупреждений, карточкой статистики сессии, кнопкой синхронизации моделей плана и аккордеоном плагина (`settings.plugin.item`).
100
106
 
101
107
  ---
102
108
 
@@ -112,7 +118,7 @@ dsh plugin --profile web add @goodandready/dsh-clinebot
112
118
 
113
119
  ## 💬 Слэш-команда `/cline` в чате
114
120
 
115
- В любой сессии чата введите команду `/cline` для проверки остатка лимитов:
121
+ В любой сессии чата введите команду `/cline` для проверки остатка лимитов, предупреждений и статистики:
116
122
 
117
123
  ```text
118
124
  ### 🤖 ClinePass Status (ClinePass ($9.99/mo))
@@ -123,6 +129,11 @@ dsh plugin --profile web add @goodandready/dsh-clinebot
123
129
  ⏱ 5-часовое окно: [████░░░░░░] 42% (сброс: 18:00)
124
130
  📅 Недельное окно: [██████░░░░] 60% (сброс: 08.09)
125
131
  * Аккаунт: `developer@example.com`
132
+
133
+ 📈 Статистика текущей сессии:
134
+ * Запросов: 14 вызовов
135
+ * Токены: ~8,450 (Промпт: 6,100 | Ответ: 2,350)
136
+ * Задержка последнего ответа: 210 мс
126
137
  ```
127
138
 
128
139
  ---
@@ -142,7 +153,7 @@ dsh-clinebot:
142
153
  - cline-pass/deepseek-v4-pro
143
154
  - cline-pass/kimi-k3
144
155
  - cline-pass/qwen3.7-max
145
- customModels: []
156
+ dynamicModels: []
146
157
  ```
147
158
 
148
159
  ### Параметры конфигурации
@@ -156,7 +167,7 @@ dsh-clinebot:
156
167
  | `timeoutMs` | `number` | `15000` | Таймаут HTTP-запросов (мс) |
157
168
  | `smokeTimeoutMs` | `number` | `25000` | Таймаут тестового пинга (мс) |
158
169
  | `enabledModels` | `array` | `[...]` | Список моделей, активных в селекторе чата |
159
- | `customModels` | `array` | `[]` | Пользовательские модели, добавленные через интерфейс |
170
+ | `dynamicModels` | `array` | `[]` | Динамические модели, автоматически синхронизированные из тарифа |
160
171
 
161
172
  ---
162
173
 
package/docs/README.zh.md CHANGED
@@ -38,11 +38,13 @@
38
38
 
39
39
  **`@goodandready/dsh-clinebot`** 完美解决以上痛点:
40
40
  * 🖥️ **专属设置大页**:在 DSH 设置中提供全宽独立页面(`设置 → ClineBot`)。
41
+ * 🔄 **订阅模型动态同步**:从官方 `GET /api/v1/users/me/plan` 自动提取真实包含模型,一键原子级同步至 DSH 提供商配置,无需等待插件更新。
42
+ * ⚠️ **额度耗尽实时预警**:当 5 小时滑动窗口达到 80%(警告黄色)和 95%(即将耗尽红色)时展示醒目预警横幅与重置倒计时。
43
+ * 📈 **会话统计与指标看板**:实时追踪请求调用次数、预估 Token(Prompt / Completion)、最近延迟及最后调用时间。
41
44
  * 📊 **实时用量仪表盘**:调用官方 `GET /users/me/plan/usage-limits` API,实时渲染 5 小时与每周额度进度条及重置倒计时。
42
45
  * 🔑 **界面直存密钥**:在 UI 中直接粘贴 API 密钥,通过 `ctx.credentials.set()` 自动安全保存至 `~/.dsh/.credentials.yaml`。
43
46
  * 🎯 **模型选择器管理**:支持勾选开启/关闭特定模型在聊天选择器中的显示。
44
- * ➕ **自定义新模型**:支持直接在界面新增官方新推出的模型(ID、名称、上下文、Vision),无需等待插件发版。
45
- * 💬 **聊天斜杠指令 `/cline`**:在任意聊天框快速查询当前配额、网络延迟与活跃模型。
47
+ * 💬 **聊天斜杠指令 `/cline`**:在任意聊天框快速查询当前配额、预警横幅、会话指标统计、网络延迟与活跃模型。
46
48
 
47
49
  ---
48
50
 
@@ -52,15 +54,16 @@
52
54
  graph LR
53
55
  subgraph UI [DSH Web 前端界面]
54
56
  Page["独立配置页 (设置 -> ClineBot)"]
55
- QuotaBar["5小时与每周额度进度条"]
57
+ QuotaBar["5小时与每周额度进度条 + 额度预警横幅"]
56
58
  KeyInput["API 密钥直填与安全保存"]
57
- ModelPick["模型选择器管控与自定义模型"]
59
+ ModelPick["模型动态同步与选择器管控"]
60
+ StatsCard["会话指标监控看板"]
58
61
  end
59
62
 
60
63
  subgraph PluginHost [dsh-clinebot 宿主运行环境]
61
64
  HttpEndpoints["API 路由: /api/plugins/dsh-clinebot/*"]
62
65
  ClientCore["lib/cline-client.js"]
63
- ModelCatalog["lib/models.js (内置精选 + 用户自定义)"]
66
+ ModelCatalog["lib/models.js (内置精选 + 动态订阅解析)"]
64
67
  SlashCmd["斜杠指令: /cline"]
65
68
  end
66
69
 
@@ -72,31 +75,34 @@ graph LR
72
75
  subgraph Upstream [Cline 官方云端]
73
76
  ClinePass["api.cline.bot/api/v1/chat/completions"]
74
77
  ClineQuota["api.cline.bot/api/v1/users/me/plan/usage-limits"]
78
+ ClinePlan["api.cline.bot/api/v1/users/me/plan"]
75
79
  end
76
80
 
77
81
  Page -->|GET /status & /usage| HttpEndpoints
78
82
  KeyInput -->|POST /save-key| HttpEndpoints
79
- ModelPick -->|POST /register & /models| HttpEndpoints
83
+ ModelPick -->|POST /models/sync| HttpEndpoints
80
84
  HttpEndpoints --> Credentials
81
85
  HttpEndpoints --> ClientCore
82
86
  ClientCore --> ModelCatalog
83
87
  HttpEndpoints -->|原子级写入| PiAi
84
88
  ClientCore -->|模型对话| ClinePass
85
89
  ClientCore -->|额度查询| ClineQuota
90
+ ClientCore -->|套餐信息| ClinePlan
86
91
  ```
87
92
 
88
93
  ---
89
94
 
90
95
  ## ✨ 核心模块与功能
91
96
 
92
- * **`lib/models.js`**:管理 11 款官方精选内置模型以及用户自定义模型(`getAllModels`, `validateCustomModel`)。
97
+ * **`lib/models.js`**:管理 11 款官方精选内置模型以及套餐模型动态解析器(`parsePlanIncludedModels`, `getAllModels`, `getDynamicModels`)。
93
98
  * **`lib/cline-client.js`**:
94
- * `fetchUsageLimits`:高效轮询 `GET /users/me/plan/usage-limits` 与 `GET /users/me` 并进行内存缓存。
99
+ * `fetchUsageLimits`:高效并发轮询 `GET /users/me/plan/usage-limits`、`GET /users/me/plan` 与 `GET /users/me` 并进行内存缓存。
100
+ * `sessionStats` / `recordSessionRequest`:内存级会话度量记录器(请求次数、Token 估算、延迟、时间戳)。
95
101
  * `saveCredentialKey`:将密钥安全写入 `~/.dsh/.credentials.yaml`。
96
- * `smokeChat`:毫秒级网络探活与非流式延迟测试。
102
+ * `smokeChat`:毫秒级网络探活与非流式延迟测试,并记录会话指标。
97
103
  * `buildPiAiProvider`:构建 DSH `llm-pi-ai` 兼容的服务商定义 (`api: 'openai-completions'`)。
98
- * **`lib/index.js`**:Cordis 插件主生命周期服务,注册后端 REST API 路由与 `/cline` 聊天斜杠指令。
99
- * **`lib/client.js`**:前端设置面板(`settings.section` 序号 28)与插件折叠卡片。
104
+ * **`lib/index.js`**:Cordis 插件主生命周期服务,注册后端 REST API 路由(含 `/dsh-clinebot/models/sync`)、额度预警计算与 `/cline` 聊天斜杠指令。
105
+ * **`lib/client.js`**:前端设置面板(`settings.section` 序号 28),内含预警横幅、会话指标卡片、一键模型同步按钮及插件折叠卡片。
100
106
 
101
107
  ---
102
108
 
@@ -114,7 +120,7 @@ dsh plugin --profile web add @goodandready/dsh-clinebot
114
120
 
115
121
  ## 💬 聊天斜杠指令 `/cline`
116
122
 
117
- 在任何聊天会话中输入 `/cline` 即可即时检查配额:
123
+ 在任何聊天会话中输入 `/cline` 即可即时检查配额、预警状态与会话指标:
118
124
 
119
125
  ```text
120
126
  ### 🤖 ClinePass Status (ClinePass ($9.99/mo))
@@ -125,6 +131,11 @@ dsh plugin --profile web add @goodandready/dsh-clinebot
125
131
  ⏱ 5 小时窗口: [████░░░░░░] 42% (重置时间: 18:00)
126
132
  📅 每周窗口: [██████░░░░] 60% (重置时间: 09月08日)
127
133
  * 绑定账号: `developer@example.com`
134
+
135
+ 📈 当前会话统计:
136
+ * 请求次数: 14 次
137
+ * Token 估算: ~8,450 (Prompt: 6,100 | Completion: 2,350)
138
+ * 最近延迟: 210 ms
128
139
  ```
129
140
 
130
141
  ---
@@ -144,7 +155,7 @@ dsh-clinebot:
144
155
  - cline-pass/deepseek-v4-pro
145
156
  - cline-pass/kimi-k3
146
157
  - cline-pass/qwen3.7-max
147
- customModels: []
158
+ dynamicModels: []
148
159
  ```
149
160
 
150
161
  ### 配置参数说明
@@ -158,7 +169,7 @@ dsh-clinebot:
158
169
  | `timeoutMs` | `number` | `15000` | HTTP 请求超时时间(毫秒) |
159
170
  | `smokeTimeoutMs` | `number` | `25000` | 探活测试超时时间(毫秒) |
160
171
  | `enabledModels` | `array` | `[...]` | 允许在聊天下拉框中显示的可用模型列表 |
161
- | `customModels` | `array` | `[]` | 用户在界面中自定义新增的模型定义列表 |
172
+ | `dynamicModels` | `array` | `[]` | 从官方套餐中自动同步的动态模型列表 |
162
173
 
163
174
  ---
164
175
 
@@ -13,8 +13,12 @@ The plugin consists of two runtime boundaries conforming to DSH authoring standa
13
13
 
14
14
  ### 2.2 Client Runtime (`lib/client.js`)
15
15
  * Self-registering module via `window.__ModuleLoader__.load({ id: '@goodandready/dsh-clinebot', factory })`.
16
- * Slots into `settings.plugin.item` (primary) and `settings.section` (fallback).
16
+ * Injects `['slots', 'locale', 'settingsScope']`.
17
+ * Slots into `settings.plugin.item` (primary) with `key: NS` and `locale: NS`, and graceful fallback to `settings.section` if not declared.
18
+ * Registers localized `en` and `ru` dictionaries via `ctx.locale.register()`.
19
+ * Reactive binding via `ctx.settingsScope.bind({ namespace: NS })` with `useSyncExternalStore` guarding against `unavailable` / `loading` snapshot states.
17
20
  * Uses native design tokens (`--dsw-alias-...`) with full dark/light theme support.
21
+ * Injects isolated style tag tagged with `data-dsh-plugin="dsh-clinebot"`.
18
22
 
19
23
  ```mermaid
20
24
  graph LR