dsh-rwkv-plugin 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +50 -2
- package/cordis.patch.yml +59 -0
- package/lib/client.js +3148 -0
- package/lib/client.js.map +7 -0
- package/lib/index.js +6294 -0
- package/lib/index.js.map +7 -0
- package/lib/line-edit.js +1423 -0
- package/lib/line-edit.js.map +7 -0
- package/lib/todo.js +610 -0
- package/lib/todo.js.map +7 -0
- package/package.json +72 -4
- package/scripts/build.mjs +77 -0
- package/scripts/headless.ts +279 -0
- package/scripts/link-dsh.sh +31 -0
- package/scripts/relay-e2e.mjs +157 -0
- package/scripts/smoke.ts +116 -0
- package/scripts/state.ts +39 -0
- package/scripts/tokenizer-parity.ts +107 -0
- package/scripts/trace-stats.ts +33 -0
- package/src/adapter.ts +388 -0
- package/src/backend/generator.ts +221 -0
- package/src/backend/irwkv.ts +117 -0
- package/src/backend/lightning.ts +228 -0
- package/src/backend/stream.ts +97 -0
- package/src/client/AdapterPicker.tsx +264 -0
- package/src/client/DeveloperPanel.tsx +403 -0
- package/src/client/FoldNode.tsx +82 -0
- package/src/client/ModelCard.tsx +230 -0
- package/src/client/RwkvSettings.tsx +265 -0
- package/src/client/Segment.tsx +15 -0
- package/src/client/StatePicker.tsx +248 -0
- package/src/client/TraceFrames.tsx +462 -0
- package/src/client/TraceView.tsx +77 -0
- package/src/client/WirePanel.tsx +566 -0
- package/src/client/fields.tsx +362 -0
- package/src/client/index.tsx +109 -0
- package/src/client/styles.ts +277 -0
- package/src/client/traces-api.ts +222 -0
- package/src/client/url.ts +20 -0
- package/src/core/agent.ts +586 -0
- package/src/core/defaults.ts +51 -0
- package/src/core/dsh-prompt.ts +32 -0
- package/src/core/edit-modes/index.ts +108 -0
- package/src/core/edit-modes/line-edit.ts +793 -0
- package/src/core/edit-modes/literal.ts +26 -0
- package/src/core/edit-modes/shared.ts +213 -0
- package/src/core/edit-modes/tolerant.ts +558 -0
- package/src/core/fold-pairs.ts +407 -0
- package/src/core/fold-window.ts +563 -0
- package/src/core/line-edit.ts +33 -0
- package/src/core/parse.ts +290 -0
- package/src/core/policy.ts +500 -0
- package/src/core/prompt.ts +220 -0
- package/src/core/relay.ts +400 -0
- package/src/core/step-gates.ts +371 -0
- package/src/core/time-zone.ts +32 -0
- package/src/core/todo-state.ts +227 -0
- package/src/core/tolerant-edit.ts +14 -0
- package/src/core/tool-mappings.ts +209 -0
- package/src/core/tool-repairs.ts +255 -0
- package/src/core/tools.ts +162 -0
- package/src/core/worklist.ts +606 -0
- package/src/dsh-host.ts +48 -0
- package/src/edit-modes/folded-read-guard.ts +32 -0
- package/src/edit-modes/index.ts +26 -0
- package/src/edit-modes/line-edit.ts +154 -0
- package/src/edit-modes/literal.ts +9 -0
- package/src/edit-modes/observations.ts +234 -0
- package/src/edit-modes/syntax-check.ts +226 -0
- package/src/edit-modes/tolerant.ts +232 -0
- package/src/folded-read-guard.ts +6 -0
- package/src/history.ts +163 -0
- package/src/index.ts +287 -0
- package/src/line-edit.ts +15 -0
- package/src/live-wire.ts +133 -0
- package/src/paths.ts +91 -0
- package/src/relay-store.ts +59 -0
- package/src/result-budget.ts +225 -0
- package/src/routes.ts +324 -0
- package/src/session-setup.ts +150 -0
- package/src/syntax-check.ts +2 -0
- package/src/todo.ts +328 -0
- package/src/tokenizer.ts +48 -0
- package/src/tolerant-edit.ts +2 -0
- package/src/trace-stats.ts +225 -0
- package/src/traces.ts +289 -0
- package/vendor/rwkv-tokenizer/NOTICE.md +26 -0
- package/vendor/rwkv-tokenizer/package.json +5 -0
- package/vendor/rwkv-tokenizer/rwkv_tokenizer.d.ts +11 -0
- package/vendor/rwkv-tokenizer/rwkv_tokenizer.js +280 -0
- package/vendor/rwkv-tokenizer/rwkv_tokenizer_bg.wasm +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 No-22-Github
|
|
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
CHANGED
|
@@ -1,3 +1,51 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-rwkv-plugin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
把 RWKV-7 G1 续写模型接入 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(DSH),注册 `rwkv` 模型提供方(主 Agent 或 `rwkv_agent` 子 Agent)。会话、工具、沙箱与审批仍由 DSH 管理,插件只负责「对话消息 ↔ 整段文本」的翻译、格式解析与兜底策略,不持久化业务状态。
|
|
4
|
+
|
|
5
|
+
## 快速安装与开发命令
|
|
6
|
+
|
|
7
|
+
> 需要 DSH **0.2.2-alpha.3+**(源码编译与联调细节见 [INSTALL.md](INSTALL.md))。
|
|
8
|
+
|
|
9
|
+
- **DSH 桌面端安装**:侧栏**插件 → 添加插件**,填入 `github:No-22-Github/dsh-rwkv-plugin`,安装后启用;在**设置 → RWKV Agent** 添加后端地址与模型即可。
|
|
10
|
+
- **本地开发与验证**:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm run typecheck # 类型检查(tsc --noEmit)
|
|
14
|
+
npm run build # 构建 bundle 到 lib/
|
|
15
|
+
npm test # 运行全部单元测试(node --test test/*.test.ts)
|
|
16
|
+
npm run headless # headless 评测入口
|
|
17
|
+
npm run smoke # 冒烟检查
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 核心配置简表
|
|
21
|
+
|
|
22
|
+
配置可在「设置 → RWKV Agent」中调整,保存即生效(默认值定义于 `src/core/defaults.ts`):
|
|
23
|
+
|
|
24
|
+
| 配置项 | 默认值 | 说明 |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| **后端与权重** | `rwkv_lightning` / `iRWKV` | 支持可选请求级 `adapterId` 与上传初始 `stateId`(服务重启需重传)。 |
|
|
27
|
+
| **采样预设** | `agent-fast` | `temperature=0.5`、`topP=0.7`、`topK=65536`、适度惩罚;DSH 仅覆盖温度。 |
|
|
28
|
+
| **编辑模式** | `tolerant` | 可选 `tolerant`(容错 `edit`)、`line-edit`(语义锚点批量 `edit_lines`)、`literal`。 |
|
|
29
|
+
| **上下文管理** | `auto-fold`(v2) | 历史轮立即压缩至 `≤2k`,当前轮 `13.5k→9k` 原地遮蔽;可选 `worklist` / `relay` / `full`。 |
|
|
30
|
+
| **单轮步数 / 重试** | `maxSteps=15` | 连续失败封禁 `2` 次、格式重问 `2` 次;超限后撤工具强制收尾。 |
|
|
31
|
+
| **兜底开关** | `outputRepairs` / `guards` 全开 | 开发者区可关闭两者以测模型原样能力,并查看 `rwkv-trace.jsonl` 统计。 |
|
|
32
|
+
|
|
33
|
+
## 已知边界
|
|
34
|
+
|
|
35
|
+
- 单步仅调一个工具,不支持并行工具调用。
|
|
36
|
+
- 不走 DSH 内置压缩;图片与附件转为 `[image]` / `[file]` 占位符。
|
|
37
|
+
- **改任何会影响模型所见提示词的代码,必须同步重新生成训练数据**(训练管线直接 import 本插件源码)。
|
|
38
|
+
|
|
39
|
+
## 文档导航
|
|
40
|
+
|
|
41
|
+
完整设计与排查文档已按 L1/L2 分层整理,请从 **[docs/INDEX.md](docs/INDEX.md)** 按需查阅:
|
|
42
|
+
|
|
43
|
+
- 架构总览与数据流:[docs/how-it-works.md](docs/how-it-works.md)
|
|
44
|
+
- 提示词格式与解析兜底:[docs/wire-and-prompt.md](docs/wire-and-prompt.md)
|
|
45
|
+
- 三种编辑模式与语法闸门:[docs/edit-modes.md](docs/edit-modes.md)
|
|
46
|
+
- 上下文管理与防盲改:[docs/context-modes.md](docs/context-modes.md)
|
|
47
|
+
- 完整提示词样例:[docs/examples/README.md](docs/examples/README.md)
|
|
48
|
+
|
|
49
|
+
## 致谢与许可
|
|
50
|
+
|
|
51
|
+
基于 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(MIT)、[RWKV](https://github.com/BlinkDL/RWKV-LM)(Apache-2.0)、[rwkv-tokenizer](https://github.com/cahya-wirawan/rwkv-tokenizer)(MIT OR Apache-2.0)与 [rwkv-tokenizer-go](https://github.com/No-22-Github/rwkv-tokenizer-go)(Apache-2.0)。本项目以 [MIT](LICENSE) 发布。
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Bundle layer applied when this package is installed into a profile
|
|
2
|
+
# (Desktop: Plugins → Add plugin; CLI: `dsh plugin add`). It starts with no
|
|
3
|
+
# models: add your endpoints in Settings → RWKV Agent. `rwkv_agent` uses the model
|
|
4
|
+
# id `default`, which resolves to the first configured model.
|
|
5
|
+
- insert:
|
|
6
|
+
- id: rwkv-llm
|
|
7
|
+
name: dsh-rwkv-plugin
|
|
8
|
+
config:
|
|
9
|
+
providers: [rwkv]
|
|
10
|
+
models: []
|
|
11
|
+
|
|
12
|
+
- id: preset-rwkv
|
|
13
|
+
name: '@deepseek-ai/dsh-agent-preset'
|
|
14
|
+
config:
|
|
15
|
+
id: rwkv
|
|
16
|
+
name: RWKV Agent
|
|
17
|
+
description: 专为 RWKV-7 G1 模型准备:默认容错编辑(edit)+ 历史思考留空 + 自动折叠上下文(Auto-Fold),并按配置支持切换 edit_lines 或状态化工单。
|
|
18
|
+
order: 9
|
|
19
|
+
plugins:
|
|
20
|
+
# Same persona as the Standard preset.
|
|
21
|
+
- id: persona
|
|
22
|
+
name: '@deepseek-ai/dsh-persona'
|
|
23
|
+
config:
|
|
24
|
+
prefix: You are a coding agent powered by the {{model}} model.
|
|
25
|
+
- id: tool-bash
|
|
26
|
+
name: '@deepseek-ai/dsh-tool-bash'
|
|
27
|
+
disabled: !!js process.platform === 'win32'
|
|
28
|
+
- id: tool-fs
|
|
29
|
+
name: '@deepseek-ai/dsh-tool-fs'
|
|
30
|
+
config:
|
|
31
|
+
applyPatch: false
|
|
32
|
+
# Line-number edits (edit_lines) instead of literal old_string copy;
|
|
33
|
+
# the RWKV catalog then hides `edit` (core/tools.ts buildCatalog).
|
|
34
|
+
# Same plugin the headless / eval / teacher entry points mount.
|
|
35
|
+
- id: rwkv-edit-lines
|
|
36
|
+
name: dsh-rwkv-plugin/line-edit
|
|
37
|
+
# Stateful work list (`todo_plan` / `todo_update`); hidden unless
|
|
38
|
+
# `historyMode: worklist` is selected in settings.
|
|
39
|
+
- id: rwkv-todo
|
|
40
|
+
name: dsh-rwkv-plugin/todo
|
|
41
|
+
- id: tool-fs-search
|
|
42
|
+
name: '@deepseek-ai/dsh-tool-fs-search'
|
|
43
|
+
config:
|
|
44
|
+
sampleOverCapGlobResults: false
|
|
45
|
+
- id: tool-web
|
|
46
|
+
name: '@deepseek-ai/dsh-tool-web'
|
|
47
|
+
config:
|
|
48
|
+
fetch: true
|
|
49
|
+
searchTimeoutMs: 60000
|
|
50
|
+
|
|
51
|
+
- id: tool-rwkv-agent
|
|
52
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
53
|
+
config:
|
|
54
|
+
provider: spawn
|
|
55
|
+
toolName: rwkv_agent
|
|
56
|
+
agentPreset: rwkv
|
|
57
|
+
agentOptions:
|
|
58
|
+
provider: rwkv
|
|
59
|
+
model: default
|