@goodandready/dsh-clinebot 0.2.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/CHANGELOG.md ADDED
@@ -0,0 +1,28 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@goodandready/dsh-clinebot` will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.2.0] - 2026-09-04
9
+
10
+ ### Added
11
+ - **Dedicated Settings Page**: Added standalone Settings section in DSH (`settings.section`, order 28, menu item **ClineBot**) alongside the compact plugin card (`settings.plugin.item`).
12
+ - **Quota & Usage Limits Dashboard**: Integrated real-time tracking of official ClinePass rolling windows (`GET /users/me/plan/usage-limits`):
13
+ - 5-hour rolling limit progress bar with countdown to window reset.
14
+ - Weekly limit progress bar with percentage remaining.
15
+ - User account email and monthly renewal cycle tracking.
16
+ - **In-UI Secure Key Storage**: Added field to paste API keys directly in the web UI, safely saving into DSH credentials storage (`~/.dsh/.credentials.yaml`) via `ctx.credentials.set(credentialRef(apiKeyEnv), key)`.
17
+ - **Custom Models Manager**: Added UI form to register new ClinePass models (ID, name, context size, Vision support) directly into the catalog without waiting for plugin updates.
18
+ - **Model Picker Management**: Granular checkboxes to enable/disable models exposed to the DSH chat picker, with quick filters ("All", "Vision Only", "Coding", "Recommended").
19
+ - **Slash-Command `/cline`**: Registered chat slash-command showing subscription status, quota progress bars, ping latency, and active model.
20
+ - Extended automated unit test suite (`test/cline-client.test.js`, `test/models.test.js`) with 9 tests covering usage limits, custom models, and credential storage.
21
+
22
+ ## [0.1.0] - 2026-09-04
23
+
24
+ ### Added
25
+ - Initial release of `@goodandready/dsh-clinebot`.
26
+ - Curated static catalogue for 11 official ClinePass open-weights models (`lib/models.js`).
27
+ - Native OpenAI-compatible client wrapper with health probes and latency-measuring smoke chat completions (`lib/cline-client.js`).
28
+ - Cordis service module injecting `settings`, `webServer`, and `credentials` with automatic DSH `llm-pi-ai` provider registration (`lib/index.js`).
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GooDAnDReaDY
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,153 @@
1
+ # 📦 @goodandready/dsh-clinebot
2
+
3
+ <div align="center">
4
+
5
+ <h3>Native ClineBot / ClinePass Provider Companion for DeepSeek Harness</h3>
6
+
7
+ <p align="center">
8
+ <a href="https://www.npmjs.com/package/@goodandready/dsh-clinebot"><img src="https://img.shields.io/npm/v/@goodandready/dsh-clinebot.svg?style=for-the-badge&color=6366f1&labelColor=1e1b4b" alt="npm version"></a>
9
+ <a href="LICENSE"><img src="https://img.shields.io/github/license/GooDAnDReaDY/dsh-clinebot.svg?style=for-the-badge&color=10b981&labelColor=064e3b" alt="license"></a>
10
+ <a href="https://github.com/topics/dsh-plugin"><img src="https://img.shields.io/badge/DSH-Plugin-8b5cf6.svg?style=for-the-badge&labelColor=2e1065" alt="DSH Plugin"></a>
11
+ <a href="https://nodejs.org"><img src="https://img.shields.io/badge/Node-20%2B-f59e0b.svg?style=for-the-badge&labelColor=451a03" alt="Node version"></a>
12
+ </p>
13
+
14
+ <!-- Author Showcase Link -->
15
+ <p align="center">
16
+ <a href="https://goodandready.app/"><img src="https://img.shields.io/badge/All_Author_Projects-goodandready.app-ff4500.svg?style=for-the-badge&logo=rocket&logoColor=white&labelColor=1a1a2e" alt="All Projects"></a>
17
+ </p>
18
+
19
+ <p align="center">
20
+ <a href="README.md"><b>🇬🇧 English</b></a> •
21
+ <a href="README.ru.md"><b>🇷🇺 Русский</b></a> •
22
+ <a href="README.zh.md"><b>🇨🇳 中文说明</b></a>
23
+ </p>
24
+
25
+ </div>
26
+
27
+ ---
28
+
29
+ ## ⚡ Overview & The Problem
30
+
31
+ **ClinePass** (`https://cline.bot`) is a flat-rate subscription service ($9.99/mo) providing developers with 2–5x higher rate limits across premier open-weights coding and reasoning models through a single OpenAI-compatible endpoint (`https://api.cline.bot/api/v1`).
32
+
33
+ Integrating ClinePass into DeepSeek Harness (DSH) natively poses key challenges:
34
+ 1. **No `/v1/models` Discovery**: `GET /v1/models` on `api.cline.bot` returns `404 Not Found`. Dynamic discovery fails silently or leaves the provider with 0 models.
35
+ 2. **Model Identifier Formats**: Models require the specific prefix `cline-pass/` (e.g. `cline-pass/deepseek-v4-flash`, `cline-pass/kimi-k3`).
36
+ 3. **Quota Tracking**: Rolling 5-hour and weekly limits need clear in-browser visualization.
37
+ 4. **Credential Security**: Storing API keys directly in plain settings is insecure.
38
+
39
+ **`@goodandready/dsh-clinebot`** provides a complete solution:
40
+ * 🖥️ **Dedicated Settings Page**: Full-width page in DSH Settings (`Settings → ClineBot`).
41
+ * 📊 **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
+ * 🔑 **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
+ * 🎯 **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.
46
+
47
+ ---
48
+
49
+ ## 🏛️ Architecture
50
+
51
+ ```mermaid
52
+ graph LR
53
+ subgraph UI [DSH Web Interface]
54
+ Page["Dedicated Page (Settings -> ClineBot)"]
55
+ QuotaBar["5-Hour & Weekly Progress Bars"]
56
+ KeyInput["Direct Key Paste & Save"]
57
+ ModelPick["Model Picker Controls & Custom Models"]
58
+ end
59
+
60
+ subgraph PluginHost [dsh-clinebot Host Runtime]
61
+ HttpEndpoints["API: /api/plugins/dsh-clinebot/*"]
62
+ ClientCore["lib/cline-client.js"]
63
+ ModelCatalog["lib/models.js (Curated + Custom)"]
64
+ SlashCmd["Command: /cline"]
65
+ end
66
+
67
+ subgraph DSHCore [DeepSeek Harness Services]
68
+ Credentials["Credentials Service (~/.dsh/.credentials.yaml)"]
69
+ PiAi["Settings: llm-pi-ai.providers.clinebot"]
70
+ end
71
+
72
+ subgraph Upstream [Cline Cloud]
73
+ ClinePass["api.cline.bot/api/v1/chat/completions"]
74
+ ClineQuota["api.cline.bot/api/v1/users/me/plan/usage-limits"]
75
+ end
76
+
77
+ Page -->|GET /status & /usage| HttpEndpoints
78
+ KeyInput -->|POST /save-key| HttpEndpoints
79
+ ModelPick -->|POST /register & /models| HttpEndpoints
80
+ HttpEndpoints --> Credentials
81
+ HttpEndpoints --> ClientCore
82
+ ClientCore --> ModelCatalog
83
+ HttpEndpoints -->|Atomic Mutate| PiAi
84
+ ClientCore -->|Chat| ClinePass
85
+ ClientCore -->|Usage Limits| ClineQuota
86
+ ```
87
+
88
+ ---
89
+
90
+ ## ✨ Features & Module Breakdown
91
+
92
+ * **`lib/models.js`**:
93
+ Manages the curated catalog (11 built-in models) and user-added custom models (`getAllModels`, `validateCustomModel`).
94
+ * **`lib/cline-client.js`**:
95
+ * `fetchUsageLimits`: queries `GET /users/me/plan/usage-limits` and `GET /users/me` with in-memory caching.
96
+ * `saveCredentialKey`: writes credentials directly into `~/.dsh/.credentials.yaml`.
97
+ * `smokeChat`: tests latency via non-streaming ping.
98
+ * `buildPiAiProvider`: builds the DSH `llm-pi-ai` structure (`api: 'openai-completions'`).
99
+ * **`lib/index.js`**:
100
+ Cordis service module managing routes, credentials, and registering the `/cline` slash command.
101
+ * **`lib/client.js`**:
102
+ Full-featured dedicated Settings section (`settings.section`, order 28) and plugin accordion (`settings.plugin.item`).
103
+
104
+ ---
105
+
106
+ ## 📦 Installation
107
+
108
+ ```bash
109
+ dsh plugin --profile web add @goodandready/dsh-clinebot
110
+ ```
111
+
112
+ ---
113
+
114
+ ## 💬 Slash-Command `/cline`
115
+
116
+ From any DSH chat session, type `/cline` to inspect quota:
117
+
118
+ ```text
119
+ ### 🤖 ClinePass Status (ClinePass ($9.99/mo))
120
+ * Пинг хоста: ✅ 210 мс
121
+ * Активный ключ: CLINEBOT_API_KEY (credentials)
122
+ * Модель по умолчанию: `cline-pass/deepseek-v4-flash`
123
+
124
+ ⏱ 5-часовое окно: [████░░░░░░] 42% (сброс: 18:00)
125
+ 📅 Недельное окно: [██████░░░░] 60% (сброс: 08.09)
126
+ * Аккаунт: `developer@example.com`
127
+ ```
128
+
129
+ ---
130
+
131
+ ## ⚙️ Configuration Reference (`settings.yaml`)
132
+
133
+ ```yaml
134
+ dsh-clinebot:
135
+ enabled: true
136
+ baseUrl: https://api.cline.bot/api/v1
137
+ apiKeyEnv: CLINEBOT_API_KEY
138
+ defaultModel: cline-pass/deepseek-v4-flash
139
+ timeoutMs: 15000
140
+ smokeTimeoutMs: 25000
141
+ enabledModels:
142
+ - cline-pass/deepseek-v4-flash
143
+ - cline-pass/deepseek-v4-pro
144
+ - cline-pass/kimi-k3
145
+ - cline-pass/qwen3.7-max
146
+ customModels: []
147
+ ```
148
+
149
+ ---
150
+
151
+ ## 📄 License
152
+
153
+ MIT © [GooDAnDReaDY](https://github.com/GooDAnDReaDY)
package/README.ru.md ADDED
@@ -0,0 +1,131 @@
1
+ # 📦 @goodandready/dsh-clinebot
2
+
3
+ <div align="center">
4
+
5
+ <h3>Нативное подключение провайдера ClineBot / ClinePass для DeepSeek Harness</h3>
6
+
7
+ <p align="center">
8
+ <a href="https://www.npmjs.com/package/@goodandready/dsh-clinebot"><img src="https://img.shields.io/npm/v/@goodandready/dsh-clinebot.svg?style=for-the-badge&color=6366f1&labelColor=1e1b4b" alt="npm version"></a>
9
+ <a href="LICENSE"><img src="https://img.shields.io/github/license/GooDAnDReaDY/dsh-clinebot.svg?style=for-the-badge&color=10b981&labelColor=064e3b" alt="license"></a>
10
+ <a href="https://github.com/topics/dsh-plugin"><img src="https://img.shields.io/badge/DSH-Plugin-8b5cf6.svg?style=for-the-badge&labelColor=2e1065" alt="DSH Plugin"></a>
11
+ <a href="https://nodejs.org"><img src="https://img.shields.io/badge/Node-20%2B-f59e0b.svg?style=for-the-badge&labelColor=451a03" alt="Node version"></a>
12
+ </p>
13
+
14
+ <!-- Обязательная кнопка перехода на витрину всех проектов -->
15
+ <p align="center">
16
+ <a href="https://goodandready.app/"><img src="https://img.shields.io/badge/Все_проекты_автора-goodandready.app-ff4500.svg?style=for-the-badge&logo=rocket&logoColor=white&labelColor=1a1a2e" alt="Все проекты автора"></a>
17
+ </p>
18
+
19
+ <p align="center">
20
+ <a href="README.md"><b>🇬🇧 English</b></a> •
21
+ <a href="README.ru.md"><b>🇷🇺 Русский</b></a> •
22
+ <a href="README.zh.md"><b>🇨🇳 中文说明</b></a>
23
+ </p>
24
+
25
+ </div>
26
+
27
+ ---
28
+
29
+ ## ⚡ Обзор и решаемая проблема
30
+
31
+ **ClinePass** (`https://cline.bot`) — сервис единой фиксированной подписки (\$9.99/мес), предоставляющий разработчикам повышенные лимиты (в 2–5 раз выше стандартных) на передовые open-weights модели программирования и рассуждений через единый OpenAI-совместимый интерфейс (`https://api.cline.bot/api/v1`).
32
+
33
+ Плагин **`@goodandready/dsh-clinebot`** обеспечивает полноценную интеграцию подписки в DeepSeek Harness:
34
+ * 🖥️ **Отдельная страница в Настройках**: собственная полноэкранная страница в меню Настроек DSH (`Настройки → ClineBot`).
35
+ * 📊 **Дашборд лимитов подписки (Usage)**: наглядные прогресс-бары расхода 5-часового и недельного скользящего окна из официального API `GET /users/me/plan/usage-limits` с таймером сброса.
36
+ * 🔑 **Сохранение ключа прямо из UI**: поле ввода ключа с маскировкой; сохранение напрямую в системный сервис `credentials` (`~/.dsh/.credentials.yaml`) без ручной правки файлов на сервере.
37
+ * 🎯 **Управление моделями в пикере**: включение/выключение отображения конкретных моделей в диалогах чата.
38
+ * ➕ **Добавление кастомных моделей**: форма добавления новых моделей подписки (ID, имя, контекст, Vision) без необходимости ждать обновления плагина.
39
+ * 💬 **Слэш-команда `/cline` в чате**: просмотр остатка квот, задержки и активной модели прямо из чата.
40
+
41
+ ---
42
+
43
+ ## 🏛️ Архитектура
44
+
45
+ ```mermaid
46
+ graph LR
47
+ subgraph UI [Интерфейс DSH]
48
+ Page["Отдельная страница (Настройки -> ClineBot)"]
49
+ QuotaBar["Прогресс-бары 5h и недельного лимита"]
50
+ KeyInput["Ввод и сохранение API-ключа"]
51
+ ModelPick["Управление пикером и новые модели"]
52
+ end
53
+
54
+ subgraph PluginHost [Хост-часть dsh-clinebot]
55
+ HttpEndpoints["API: /api/plugins/dsh-clinebot/*"]
56
+ ClientCore["lib/cline-client.js"]
57
+ ModelCatalog["lib/models.js (Встроенные + Кастомные)"]
58
+ SlashCmd["Слэш-команда: /cline"]
59
+ end
60
+
61
+ subgraph DSHCore [Сервисы DSH]
62
+ Credentials["Сервис credentials (~/.dsh/.credentials.yaml)"]
63
+ PiAi["Настройки: llm-pi-ai.providers.clinebot"]
64
+ end
65
+
66
+ subgraph Upstream [Сервер Cline]
67
+ ClinePass["api.cline.bot/api/v1/chat/completions"]
68
+ ClineQuota["api.cline.bot/api/v1/users/me/plan/usage-limits"]
69
+ end
70
+
71
+ Page -->|GET /status & /usage| HttpEndpoints
72
+ KeyInput -->|POST /save-key| HttpEndpoints
73
+ ModelPick -->|POST /register & /models| HttpEndpoints
74
+ HttpEndpoints --> Credentials
75
+ HttpEndpoints --> ClientCore
76
+ ClientCore --> ModelCatalog
77
+ HttpEndpoints -->|Атомарная мутация| PiAi
78
+ ClientCore -->|Чат| ClinePass
79
+ ClientCore -->|Квоты| ClineQuota
80
+ ```
81
+
82
+ ---
83
+
84
+ ## 📦 Быстрая установка
85
+
86
+ ```bash
87
+ dsh plugin --profile web add @goodandready/dsh-clinebot
88
+ ```
89
+
90
+ ---
91
+
92
+ ## 💬 Слэш-команда `/cline` в чате
93
+
94
+ В любой сессии чата введите команду `/cline` для проверки остатка лимитов:
95
+
96
+ ```text
97
+ ### 🤖 ClinePass Status (ClinePass ($9.99/mo))
98
+ * Пинг хоста: ✅ 210 мс
99
+ * Активный ключ: CLINEBOT_API_KEY (credentials)
100
+ * Модель по умолчанию: `cline-pass/deepseek-v4-flash`
101
+
102
+ ⏱ 5-часовое окно: [████░░░░░░] 42% (сброс: 18:00)
103
+ 📅 Недельное окно: [██████░░░░] 60% (сброс: 08.09)
104
+ * Аккаунт: `developer@example.com`
105
+ ```
106
+
107
+ ---
108
+
109
+ ## ⚙️ Таблица конфигурации (`settings.yaml`)
110
+
111
+ ```yaml
112
+ dsh-clinebot:
113
+ enabled: true
114
+ baseUrl: https://api.cline.bot/api/v1
115
+ apiKeyEnv: CLINEBOT_API_KEY
116
+ defaultModel: cline-pass/deepseek-v4-flash
117
+ timeoutMs: 15000
118
+ smokeTimeoutMs: 25000
119
+ enabledModels:
120
+ - cline-pass/deepseek-v4-flash
121
+ - cline-pass/deepseek-v4-pro
122
+ - cline-pass/kimi-k3
123
+ - cline-pass/qwen3.7-max
124
+ customModels: []
125
+ ```
126
+
127
+ ---
128
+
129
+ ## 📄 Лицензия
130
+
131
+ MIT © [GooDAnDReaDY](https://github.com/GooDAnDReaDY)
package/README.zh.md ADDED
@@ -0,0 +1,68 @@
1
+ # 📦 @goodandready/dsh-clinebot
2
+
3
+ <div align="center">
4
+
5
+ <h3>适用于 DeepSeek Harness 的 ClineBot / ClinePass 原生模型提供商伴侣插件</h3>
6
+
7
+ <p align="center">
8
+ <a href="https://www.npmjs.com/package/@goodandready/dsh-clinebot"><img src="https://img.shields.io/npm/v/@goodandready/dsh-clinebot.svg?style=for-the-badge&color=6366f1&labelColor=1e1b4b" alt="npm version"></a>
9
+ <a href="LICENSE"><img src="https://img.shields.io/github/license/GooDAnDReaDY/dsh-clinebot.svg?style=for-the-badge&color=10b981&labelColor=064e3b" alt="license"></a>
10
+ <a href="https://github.com/topics/dsh-plugin"><img src="https://img.shields.io/badge/DSH-Plugin-8b5cf6.svg?style=for-the-badge&labelColor=2e1065" alt="DSH Plugin"></a>
11
+ <a href="https://nodejs.org"><img src="https://img.shields.io/badge/Node-20%2B-f59e0b.svg?style=for-the-badge&labelColor=451a03" alt="Node version"></a>
12
+ </p>
13
+
14
+ <!-- 作者所有项目展示页面链接 -->
15
+ <p align="center">
16
+ <a href="https://goodandready.app/"><img src="https://img.shields.io/badge/作者所有开源项目-goodandready.app-ff4500.svg?style=for-the-badge&logo=rocket&logoColor=white&labelColor=1a1a2e" alt="所有项目"></a>
17
+ </p>
18
+
19
+ <p align="center">
20
+ <a href="README.md"><b>🇬🇧 English</b></a> •
21
+ <a href="README.ru.md"><b>🇷🇺 Русский</b></a> •
22
+ <a href="README.zh.md"><b>🇨🇳 中文说明</b></a>
23
+ </p>
24
+
25
+ </div>
26
+
27
+ ---
28
+
29
+ ## ⚡ 概述与解决的问题
30
+
31
+ **ClinePass** (`https://cline.bot`) 是一项固定月费(\$9.99/月)的高性价比订阅服务,为开发者提供主流开源代码模型与推理模型 2–5 倍的高并发调用限额,统一通过 OpenAI 兼容接口 (`https://api.cline.bot/api/v1`) 提供服务。
32
+
33
+ 在将 ClinePass 接入 DeepSeek Harness (DSH) 时存在以下挑战:
34
+ 1. **缺失 `/v1/models` 接口**:`api.cline.bot` 的 `GET /v1/models` 会直接返回 `404 Not Found`,导致动态模型同步失败。
35
+ 2. **专属模型前缀**:所有模型 ID 均需前缀 `cline-pass/`(如 `cline-pass/deepseek-v4-flash`, `cline-pass/kimi-k3`)。
36
+ 3. **安全凭据隔离**:禁止在明文配置中直接填写密钥。
37
+
38
+ **`@goodandready/dsh-clinebot`** 完美解决以上痛点:
39
+ * 🎯 内置包含全部 11 款官方 ClinePass 模型的静态精选目录。
40
+ * 🔐 深度集成 DSH `credentials` 服务 (`~/.dsh/.credentials.yaml`),凭据隔离无泄漏。
41
+ * 🔄 一键写入 DSH `llm-pi-ai` 模型注册表。
42
+ * 🩺 设置面板内置毫秒级延迟探测与 Smoke Test 测试生成。
43
+
44
+ ---
45
+
46
+ ## 📦 快速安装
47
+
48
+ 在活动的 DeepSeek Harness 配置中安装:
49
+
50
+ ```bash
51
+ dsh plugin --profile web add @goodandready/dsh-clinebot
52
+ ```
53
+
54
+ ---
55
+
56
+ ## 🔑 凭据配置
57
+
58
+ 在 DSH 凭据文件 (`~/.dsh/.credentials.yaml`) 中添加 ClinePass 密钥:
59
+
60
+ ```yaml
61
+ CLINEBOT_API_KEY: "your-clinepass-api-key"
62
+ ```
63
+
64
+ ---
65
+
66
+ ## 📄 许可证
67
+
68
+ MIT © [GooDAnDReaDY](https://github.com/GooDAnDReaDY)
@@ -0,0 +1,6 @@
1
+ # @goodandready/dsh-clinebot — ClineBot (ClinePass) companion for DSH.
2
+ # name must be the FULL package specifier (scoped).
3
+ - insert:
4
+ - id: dsh-clinebot
5
+ name: '@goodandready/dsh-clinebot'
6
+ config: {}