dsh-kingdom 2.0.0 → 3.1.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/ASSETS_NOTICE.md +22 -22
- package/README.md +244 -243
- package/THIRD_PARTY_NOTICES.md +92 -92
- package/docs/DSH-KINGDOM-3.0-ANNOUNCEMENT.md +13 -0
- package/docs/V2.0-RELEASE-NOTES.md +30 -30
- package/docs/V2.0-USER-GUIDE.md +74 -74
- package/docs/V3.0-RELEASE-NOTES.md +21 -0
- package/docs/V3.0-USER-GUIDE.md +33 -0
- package/docs/V3.1-RELEASE-NOTES.md +72 -0
- package/lib/core/binding.js +2 -0
- package/lib/core/binding.js.map +1 -1
- package/lib/core/db.js +546 -546
- package/lib/core/delivery-ack.js +1356 -0
- package/lib/core/delivery-ack.js.map +1 -0
- package/lib/core/delivery-change.js +1237 -0
- package/lib/core/delivery-change.js.map +1 -0
- package/lib/core/owner-window.js +592 -11
- package/lib/core/owner-window.js.map +1 -1
- package/lib/core/task-service.js +144 -5
- package/lib/core/task-service.js.map +1 -1
- package/lib/gui/assets/characters/chancellor-idle.svg +67 -67
- package/lib/gui/assets/characters/chancellor-sleeping.svg +67 -67
- package/lib/gui/assets/characters/chancellor-thinking.svg +67 -67
- package/lib/gui/assets/characters/chancellor-working.svg +67 -67
- package/lib/gui/assets/characters/knight-redraw-r1-idle.svg +67 -67
- package/lib/gui/assets/characters/knight-redraw-r1-sleeping.svg +67 -67
- package/lib/gui/assets/characters/knight-redraw-r1-thinking.svg +67 -67
- package/lib/gui/assets/characters/knight-redraw-r1-working.svg +67 -67
- package/lib/gui/assets/characters/supervisor-idle.svg +67 -67
- package/lib/gui/assets/characters/supervisor-sleeping.svg +67 -67
- package/lib/gui/assets/characters/supervisor-thinking.svg +67 -67
- package/lib/gui/assets/characters/supervisor-working.svg +67 -67
- package/lib/gui/console-app.js +7 -1
- package/lib/gui/console-app.js.map +1 -1
- package/lib/gui/contract.js +6 -0
- package/lib/gui/contract.js.map +1 -1
- package/lib/gui/owner-control.js +114 -4
- package/lib/gui/owner-control.js.map +1 -1
- package/lib/gui/owner-ui.js +604 -183
- package/lib/gui/owner-ui.js.map +1 -1
- package/lib/gui/server.js +109 -109
- package/lib/gui/snapshot.js +127 -4
- package/lib/gui/snapshot.js.map +1 -1
- package/lib/gui/visual-assets.js +37 -21
- package/lib/gui/visual-assets.js.map +1 -1
- package/lib/gui/visual-system.js +269 -269
- package/lib/gui/workbench-ui.js +537 -136
- package/lib/gui/workbench-ui.js.map +1 -1
- package/lib/gui/workbench.js +123 -0
- package/lib/gui/workbench.js.map +1 -1
- package/lib/index.js +338 -26
- package/lib/index.js.map +1 -1
- package/lib/types/core/binding.d.ts +15 -0
- package/lib/types/core/delivery-ack.d.ts +688 -0
- package/lib/types/core/delivery-change.d.ts +381 -0
- package/lib/types/core/owner-window.d.ts +235 -2
- package/lib/types/core/task-service.d.ts +22 -0
- package/lib/types/gui/contract.d.ts +153 -1
- package/lib/types/gui/owner-control.d.ts +61 -1
- package/lib/types/gui/snapshot.d.ts +8 -0
- package/lib/types/gui/visual-assets.d.ts +16 -0
- package/lib/types/gui/workbench.d.ts +47 -1
- package/lib/types/index.d.ts +49 -0
- package/lib/types/worker/governed-executor.d.ts +15 -0
- package/lib/worker/governed-executor.js +21 -0
- package/lib/worker/governed-executor.js.map +1 -1
- package/package.json +79 -75
package/ASSETS_NOTICE.md
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
# Asset notice
|
|
2
|
-
|
|
3
|
-
The twelve character SVG files shipped under `lib/gui/assets/characters/`
|
|
4
|
-
are original works created by the project Owner. They contain no third-party
|
|
5
|
-
artwork and are distributed as part of dsh-Kingdom under
|
|
6
|
-
AGPL-3.0-or-later. On 2026-09-08 the Owner expressly authorized a shape and
|
|
7
|
-
continuous-motion revision of these characters. The current twelve SVGs and
|
|
8
|
-
their authoring source `scripts/art/generate-characters.mjs` are that revision,
|
|
9
|
-
retaining the original role identities and palette. They contain no copied
|
|
10
|
-
third-party artwork and remain under AGPL-3.0-or-later.
|
|
11
|
-
|
|
12
|
-
The gate-and-organization brand mark and empty-state illustration in
|
|
13
|
-
`src/gui/visual-assets.ts` are original geometric SVG artwork created for the
|
|
14
|
-
2026-09-08 Kingdom console visual upgrade. The five-step governance flow's
|
|
15
|
-
composition and explanatory text are original to this upgrade. These additions
|
|
16
|
-
are distributed under AGPL-3.0-or-later as part of dsh-Kingdom. They do not
|
|
17
|
-
replace the separately maintained character artwork.
|
|
18
|
-
|
|
19
|
-
The flow and shared GUI controls use the separately attributed Lucide SVG icon
|
|
20
|
-
subset documented in `THIRD_PARTY_NOTICES.md`. No third-party artwork is included
|
|
21
|
-
in the new gate-and-organization mark or empty-state illustration. The static
|
|
22
|
-
illustrations do not represent live bindings, permissions, or task progress.
|
|
1
|
+
# Asset notice
|
|
2
|
+
|
|
3
|
+
The twelve character SVG files shipped under `lib/gui/assets/characters/`
|
|
4
|
+
are original works created by the project Owner. They contain no third-party
|
|
5
|
+
artwork and are distributed as part of dsh-Kingdom under
|
|
6
|
+
AGPL-3.0-or-later. On 2026-09-08 the Owner expressly authorized a shape and
|
|
7
|
+
continuous-motion revision of these characters. The current twelve SVGs and
|
|
8
|
+
their authoring source `scripts/art/generate-characters.mjs` are that revision,
|
|
9
|
+
retaining the original role identities and palette. They contain no copied
|
|
10
|
+
third-party artwork and remain under AGPL-3.0-or-later.
|
|
11
|
+
|
|
12
|
+
The gate-and-organization brand mark and empty-state illustration in
|
|
13
|
+
`src/gui/visual-assets.ts` are original geometric SVG artwork created for the
|
|
14
|
+
2026-09-08 Kingdom console visual upgrade. The five-step governance flow's
|
|
15
|
+
composition and explanatory text are original to this upgrade. These additions
|
|
16
|
+
are distributed under AGPL-3.0-or-later as part of dsh-Kingdom. They do not
|
|
17
|
+
replace the separately maintained character artwork.
|
|
18
|
+
|
|
19
|
+
The flow and shared GUI controls use the separately attributed Lucide SVG icon
|
|
20
|
+
subset documented in `THIRD_PARTY_NOTICES.md`. No third-party artwork is included
|
|
21
|
+
in the new gate-and-organization mark or empty-state illustration. The static
|
|
22
|
+
illustrations do not represent live bindings, permissions, or task progress.
|
package/README.md
CHANGED
|
@@ -1,243 +1,244 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
# 🏰 dsh-Kingdom
|
|
4
|
-
|
|
5
|
-
**在 DeepSeek Harness 里,装一个插件,拥有一个自己的 Agent 王国。**
|
|
6
|
-
|
|
7
|
-
[](https://github.com/lusblead/dsh-Kingdom/actions/workflows/ci.yml)
|
|
8
|
-
[](LICENSE)
|
|
10
|
-
[](#1-前置要求)
|
|
11
|
-
[](#1-前置要求)
|
|
12
|
-
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## 这是什么?
|
|
18
|
-
|
|
19
|
-
2.0
|
|
20
|
-
|
|
21
|
-
**dsh-Kingdom 是一个 DeepSeek Harness(DSH)插件**:产品目标是在不另行部署外部服务、独立数据库或单独 GUI 前端的前提下,在 DSH 中**创建并运行一个属于自己的最小王国**——
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
```text
|
|
25
|
-
你:初始化王国
|
|
26
|
-
DSH:已创建王国「My Kingdom」,你成为 Owner
|
|
27
|
-
|
|
28
|
-
你:给当前项目建一个 RAG 研发领
|
|
29
|
-
DSH:已创建领地「RAG 研发领」
|
|
30
|
-
|
|
31
|
-
你:让 Chancellor 把"检查测试情况"规划成任务,Supervisor 派给 Worker,
|
|
32
|
-
再通过 `kingdom_start_task_governed` 执行并验收
|
|
33
|
-
DSH:任务 CREATED → ASSIGNED → RUNNING → REVIEW → DONE ✅
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
**插件实现本地持久化语义**:角色、领地、任务和验收记录写入本地 SQLite;正式数据库迁移仍须按对应版本的迁移边界执行。
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## ✨ 核心特性
|
|
41
|
-
|
|
42
|
-
| 特性 | 说明 |
|
|
43
|
-
|---|---|
|
|
44
|
-
| 🚀 **零门槛安装** | 发布后的一个 tgz + 一条命令;内置 GUI 随 `lib/**` 交付,无需独立前端 |
|
|
45
|
-
| 🏛 **完整角色体系** | Owner / Chancellor / Supervisor / Worker,角色与 Session / 模型解耦 |
|
|
46
|
-
| 📋 **治理闭环语义** | 规划 → 分配 → 独立执行 → 验收,任务状态全程留痕 |
|
|
47
|
-
| ⚖️ **Claim ≠ Fact** | **Worker 说自己完成了 ≠ 任务完成**——完成权只在 Supervisor,代码强制,不是口头约定 |
|
|
48
|
-
|
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
`
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
|
113
|
-
|
|
114
|
-
|
|
|
115
|
-
|
|
|
116
|
-
|
|
|
117
|
-
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
>
|
|
124
|
-
>
|
|
125
|
-
>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
-
|
|
179
|
-
-
|
|
180
|
-
-
|
|
181
|
-
-
|
|
182
|
-
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
|
195
|
-
|
|
196
|
-
| 0.
|
|
197
|
-
| 0.
|
|
198
|
-
| 0.
|
|
199
|
-
| 0.
|
|
200
|
-
| 0.
|
|
201
|
-
| 0.
|
|
202
|
-
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
- [
|
|
213
|
-
- [
|
|
214
|
-
- [
|
|
215
|
-
- [
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
npm
|
|
224
|
-
npm
|
|
225
|
-
|
|
226
|
-
node scripts/
|
|
227
|
-
node scripts/
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# 🏰 dsh-Kingdom
|
|
4
|
+
|
|
5
|
+
**在 DeepSeek Harness 里,装一个插件,拥有一个自己的 Agent 王国。**
|
|
6
|
+
|
|
7
|
+
[](https://github.com/lusblead/dsh-Kingdom/actions/workflows/ci.yml)
|
|
8
|
+
[](docs/V3.1-RELEASE-NOTES.md)
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
[](#1-前置要求)
|
|
11
|
+
[](#1-前置要求)
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 这是什么?
|
|
18
|
+
|
|
19
|
+
3.0.0 在已有 2.0 个人工作台之上,加入 Owner 交付清单:逐条查看、知悉、核对主管确认的改动证据,并就具体条目向接受交付的主管提问。交付由 Owner 主动查看,宰相目前不会自动上报。查看 [3.0 使用指南](docs/V3.0-USER-GUIDE.md)、[版本说明与验证范围](docs/V3.0-RELEASE-NOTES.md) 和 [功能介绍](docs/DSH-KINGDOM-3.0-ANNOUNCEMENT.md)。这轮功能曾在仍标为 2.0.0 的本地开发包中提前安装验证;3.0.0 候选尚未在 npm/GitHub Releases 发布。已有任务、协作、用量与软预算能力见 [2.0 指南](docs/V2.0-USER-GUIDE.md)。
|
|
20
|
+
|
|
21
|
+
**dsh-Kingdom 是一个 DeepSeek Harness(DSH)插件**:产品目标是在不另行部署外部服务、独立数据库或单独 GUI 前端的前提下,在 DSH 中**创建并运行一个属于自己的最小王国**——
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
你:初始化王国
|
|
26
|
+
DSH:已创建王国「My Kingdom」,你成为 Owner
|
|
27
|
+
|
|
28
|
+
你:给当前项目建一个 RAG 研发领
|
|
29
|
+
DSH:已创建领地「RAG 研发领」
|
|
30
|
+
|
|
31
|
+
你:让 Chancellor 把"检查测试情况"规划成任务,Supervisor 派给 Worker,
|
|
32
|
+
再通过 `kingdom_start_task_governed` 执行并验收
|
|
33
|
+
DSH:任务 CREATED → ASSIGNED → RUNNING → REVIEW → DONE ✅
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**插件实现本地持久化语义**:角色、领地、任务和验收记录写入本地 SQLite;正式数据库迁移仍须按对应版本的迁移边界执行。
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## ✨ 核心特性
|
|
41
|
+
|
|
42
|
+
| 特性 | 说明 |
|
|
43
|
+
|---|---|
|
|
44
|
+
| 🚀 **零门槛安装** | 发布后的一个 tgz + 一条命令;内置 GUI 随 `lib/**` 交付,无需独立前端 |
|
|
45
|
+
| 🏛 **完整角色体系** | Owner / Chancellor / Supervisor / Worker,角色与 Session / 模型解耦 |
|
|
46
|
+
| 📋 **治理闭环语义** | 规划 → 分配 → 独立执行 → 验收,任务状态全程留痕 |
|
|
47
|
+
| ⚖️ **Claim ≠ Fact** | **Worker 说自己完成了 ≠ 任务完成**——完成权只在 Supervisor,代码强制,不是口头约定 |
|
|
48
|
+
| 👁️ **Owner 逐条知悉与提问**(3.0) | 交付摘要和细项独立呈现;知悉只记录 Owner 声明已知道该内容版本,不代替质量认可或任务完成;问题记在接受该交付的主管名下,待其主动读取并回复 |
|
|
49
|
+
| 🧾 **改动证据**(3.0) | 主管确认属于本交付的文件改动可展开查看,包括有界的未提交差异快照;标明证据级别,不把 Git 时间窗口误称为 Worker 作者证明 |
|
|
50
|
+
| 👷 **Persistent Governed Worker** | 候选源码的 canonical headless 路径使用 `kingdom_start_task_governed`:Worker 绑定长期 DSH Session,结果结构化返回并经 Capability/Lease 治理 |
|
|
51
|
+
| 🔁 **返工留痕** | governed REWORK 复用同一 Worker Persistent Session;每次尝试(attempt)都有独立 Lease/Execution 记录 |
|
|
52
|
+
| 💾 **持久化与恢复语义** | 状态写入本地 SQLite;真实 DSH 重启恢复与正式数据库本轮未验证(`NOT_RUN`) |
|
|
53
|
+
| 🔄 **换届与会话归属**(v0.4) | `kingdom_unbind_role` 解绑 / `kingdom_bind_session` 把角色绑到**独立会话**;`session-bound` 模式下只有被绑定会话能行使职权 |
|
|
54
|
+
| 🪪 **会话身份预留字段**(v0.4) | 角色可携带 `model_name` / `agent_name` / `session_meta`(JSON 扩展槽)——现在不必填,未来完整会话逐步填满 |
|
|
55
|
+
| 🎛 **内置本地 GUI**(v1.0) | 直接执行 `/kingdom gui` 打开操作台,进行会话绑定的任务规划、指派、持久治理执行与审查;Owner 配置仍只走 direct Slash |
|
|
56
|
+
| 👑 **Persistent Governed Worker**(v0.8) | Worker 拥有**长期 DSH Session**(REWORK 唤醒同一 Worker);Session ↔ Territory Affinity 不可改绑;每次执行经 **Capability Gate**(仅 GRANTED+ENFORCED 才 dispatch,Runtime 无法 enforce → **DENIED + zero execution**);**Execution Lease** 互斥 + **Dispatch Intent**(crash 可 reconcile,不盲发);terminal 证据来自事件链,**Runtime 跑完 ≠ Task DONE**(Claim → Supervisor 裁定链不变)。这是 canonical headless 路径 |
|
|
57
|
+
| 🛡️ **Fail-closed 能力治理**(v0.8) | 无自授 / 超 Ceiling / scope 外 / 部分 policy 一律拒绝;approval=never 禁扩权;workspace 外写真实拒绝;RECOVERING 状态如实显示,禁止显示成 Done |
|
|
58
|
+
| 🧩 **Legacy 兼容**(v0.8) | `kingdom_start_task` 仅在用户明确选择时作为 `LEGACY_COMPAT` one-shot 入口;不会作为默认路径、错误恢复建议或 persistent 失败 fallback |
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 🚀 快速开始
|
|
63
|
+
|
|
64
|
+
### 1. 前置要求
|
|
65
|
+
|
|
66
|
+
- **DeepSeek Harness(dsh)**:本版 peer 声明覆盖 `0.1.5-rc` 与 `0.1.7-0` 两条线;构建与回归在 CLI `0.1.5-rc.1` / 主要组件 `0.1.5-rc.2` 上完成,`0.1.7-rc.2` 的实机加载已于 2026-09-28 验证(无 bundle 跳过,见 [3.1 版本说明](docs/V3.1-RELEASE-NOTES.md))。旧宿主请继续使用对应旧版插件
|
|
67
|
+
- **Node.js** ≥ `22.19`(内置 SQLite,插件零原生依赖)
|
|
68
|
+
- 一个可用的模型 API key(Worker 执行需要)
|
|
69
|
+
|
|
70
|
+
### 2. 安装 v3.1.0
|
|
71
|
+
|
|
72
|
+
本版以 GitHub [Releases](https://github.com/lusblead/dsh-Kingdom/releases) 与 npm 为公开入口;若当前环境还取不到已发布包,可从源码构建取得准确的 `dsh-kingdom-3.1.0.tgz`,核对包与本机备份后,再在自己的 DSH Web profile 安装:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
dsh plugin --profile web add ./dsh-kingdom-3.1.0.tgz
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
安装后重启 Web profile 才会加载新包。不要将本地候选的版本号当作 npm 或 GitHub Releases 已可下载的证据。
|
|
79
|
+
|
|
80
|
+
内置 GUI 随 `lib/**` 包含在 tgz 中,不需要额外 GUI zip:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
/kingdom gui # 激活短期本地控制会话并打开内置操作台
|
|
84
|
+
/kingdom status # 也可以从 DSH 会话查看王国真实状态
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Owner 是本机人类操作者,不是 Agent 或 Session。管理操作可由用户直接键入
|
|
88
|
+
exact `/kingdom` Slash,或从 `/kingdom owner.gui` 准确激活的独立短时管理窗口完成;`OWNER.session_id` 永远保持 `null`。Chancellor、Supervisor、
|
|
89
|
+
Worker 才使用真实 DSH caller session 的会话绑定(`session-bound`)角色平面;历史
|
|
90
|
+
`declarative / local-demo` 语义不能解锁产品写入。
|
|
91
|
+
|
|
92
|
+
### 3. 用 GUI 完成最小治理闭环
|
|
93
|
+
|
|
94
|
+
1. 先由人类通过 direct `/kingdom` Slash 或准确激活的人类管理窗口完成初始化、能力上限、领地、角色/会话与 Worker 执行方案配置;具体步骤见 [首次使用](docs/V2.0-USER-GUIDE.md#第一次使用)。
|
|
95
|
+
2. 在本地 DSH 会话直接键入 exact `/kingdom gui`;若本机浏览器完成带 ticket 的导航,一次性入口兑换后会重定向到干净的 `/console`。若本机打开请求失败,控制会话虽已激活,但命令只显示不含 ticket 的干净 `/console` 参考地址;该地址不能完成一次性兑换,不要手工拼接或复用启动值,直接重新执行 `/kingdom gui`。
|
|
96
|
+
3. 日常工作台用于会话绑定操作与只读观察:Chancellor 会话规划任务;任务领地的 Supervisor 会话负责指派、选择 Host 提供的沙箱模式、启动与审查。设置页可进入独立人类管理页面。切换角色职权时要从对应真实 DSH 会话重新激活,不能由浏览器自报身份。
|
|
97
|
+
4. Worker 输出只会进入待审状态 `REVIEW`。Supervisor 选择接受 `ACCEPT` 后才进入 `DONE`;返工 `REWORK` 回到 `RUNNING` 并保留同一 Assignment,判定失败 `FAIL` 进入 `FAILED`。不用时执行 `/kingdom gui stop` 撤销控制会话并关闭本地 server。
|
|
98
|
+
|
|
99
|
+
Owner 专属 JSON Slash 命令只接受单个 object envelope;未知字段、额外 token、重复字段和
|
|
100
|
+
`OWNER.session_id` 改绑会在写入前拒绝。独立 GUI/HTTP 不能自行取得 Authority;只有 direct
|
|
101
|
+
`/kingdom gui` 激活闭包内的短期控制会话才可能执行日常角色操作,浏览器 payload 不能提交
|
|
102
|
+
principal/session/Owner capability。
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 🛠 工具一览
|
|
107
|
+
|
|
108
|
+
| 阶段 | 工具 |
|
|
109
|
+
|---|---|
|
|
110
|
+
| 王国基础 | **`/kingdom init`**(Owner direct)· `kingdom_status`(只读) |
|
|
111
|
+
| 领地 | **`/kingdom territory.* <JSON>`**(Owner direct)· `kingdom_list_territories`(只读) |
|
|
112
|
+
| 角色 | **`/kingdom role.* <JSON>`**(Owner direct)· `kingdom_list_bindings`(只读) |
|
|
113
|
+
| 能力治理 | **`/kingdom ceiling <JSON>`**(Owner direct) |
|
|
114
|
+
| 任务治理 | `kingdom_plan_task` · `kingdom_assign_task` · **`kingdom_start_task_governed`(CANONICAL HEADLESS)** · `kingdom_review_task` · `kingdom_list_tasks` |
|
|
115
|
+
| 显式兼容 | `kingdom_start_task`(`LEGACY_COMPAT` one-shot;必须传 `legacy_opt_in=true`,仅用户明确选择,不自动 fallback) |
|
|
116
|
+
| 执行控制 | `kingdom_execution_control` |
|
|
117
|
+
| GUI | **`/kingdom gui`**(打开)· **`/kingdom gui stop`**(撤销并关闭)· `kingdom_snapshot` · `kingdom_task_detail` |
|
|
118
|
+
|
|
119
|
+
> **领地删除(v0.5.1)**:`/kingdom territory.delete <JSON>` 遵循治理语义——
|
|
120
|
+
> 领地下存在任务(任意状态)时**默认拒绝**;传 `force=true` 才级联删除:未终态任务统一标记 `FAILED`、
|
|
121
|
+
> 活跃执行终止,`TERRITORY_DELETED` / `TASK_FAILED` 事件留痕;`DONE`/`FAILED` 终态任务不篡改。
|
|
122
|
+
|
|
123
|
+
> **Owner Ceiling(v0.8)**:在任何 governed start 前,用户直接执行
|
|
124
|
+
> `/kingdom ceiling {"ceiling":{"filesystem.write":true,"tool:pwsh":true}}`。
|
|
125
|
+
> `ceiling` 不是 Agent Grant,不能由 Tool 参数或 `exec.agent.session.id` 代替;未配置或越过
|
|
126
|
+
> Ceiling 仍由既有 Capability Gate 拒绝并完成 Lease cleanup。清空 Ceiling 只会保持 fail-closed。
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## 🧠 它如何保证"治理是真的"?
|
|
131
|
+
|
|
132
|
+
这是 dsh-Kingdom 与其他 Agent 编排工具最根本的区别:
|
|
133
|
+
|
|
134
|
+
```text
|
|
135
|
+
Worker 交回结果 ──→ 这是一条 Claim(自述),只进 REVIEW
|
|
136
|
+
↓
|
|
137
|
+
Supervisor ACCEPT ──→ DONE(组织事实)
|
|
138
|
+
Supervisor REWORK ──→ 返工(同一 Worker Persistent Session)
|
|
139
|
+
Supervisor FAIL ──→ FAILED(组织事实)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
- **Worker 没有"完成"的权力**:它没有上报结果的工具,结果经宿主接收后落库,任务永远停在 `REVIEW`。
|
|
143
|
+
- **没有任何工具能把任务直接置为 DONE**——DONE 唯一入口是 Supervisor 的 ACCEPT。
|
|
144
|
+
- **即使是 Worker 自称失败**,任务也只到 REVIEW;FAILED 只能是 Supervisor 裁定,或宿主观察到执行器客观失败(启动失败/异常退出)。
|
|
145
|
+
- 每次执行(attempt)都记入 `worker_results`,返工历史完整可查。
|
|
146
|
+
|
|
147
|
+
> **一句话:模型可以提出动作,但只有程序决定状态。**
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## 📁 数据与存储
|
|
152
|
+
|
|
153
|
+
| 项目 | 说明 |
|
|
154
|
+
|---|---|
|
|
155
|
+
| `~/.dsh/kingdom/kingdom.db` | 王国全部数据(SQLite,自包含) |
|
|
156
|
+
| Schema v4 | 在既有王国、领地、角色、任务、呈报、执行与事件之外,包含 Assignment、Affinity、Capability Decision、Lease 与 Dispatch 等治理账本 |
|
|
157
|
+
|
|
158
|
+
全新库或尚无王国数据的库可直接建立 v4;已有 v3 库默认保持 v3,不会自动迁移。只有经过 Formal DB Migration Gate 明确放行后才可迁移;未迁移时 GUI governed plan 与 governed start 均 fail-closed。本文档施工没有读取、迁移或验证正式数据库(`NOT_RUN`),不能据此声称旧库兼容或迁移通过。
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## 🎛 GUI(王国操作台)
|
|
163
|
+
|
|
164
|
+
GUI 已内置在插件中,不需要下载或启动第二个前端项目。直接在本地 DSH 会话执行:
|
|
165
|
+
|
|
166
|
+
```text
|
|
167
|
+
/kingdom gui
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
插件只绑定 `127.0.0.1`,按实际监听端口生成一次性短期启动值,并请求本机浏览器打开 Console。启动值只兑换一次,随后重定向到干净的 `/console`;写请求还须通过 HttpOnly `SameSite=Strict` Cookie、CSRF、唯一 request id、精确 Origin 与单一在途请求检查。GUI/HTTP 本身没有 Authority,也不能构造 Owner 或角色身份。
|
|
171
|
+
|
|
172
|
+
### 操作台能力
|
|
173
|
+
|
|
174
|
+
- 首页就是无外层边框的“王国地图”:默认森林墨绿主题,可切换四种主题;领地颜色随主题区分,人物卡片按任务状态显示不同状态色。
|
|
175
|
+
- “管理中心”和“王国账本”是独立页面。首页只保留组织结构和一个主输入框;在输入框键入 `/` 可选择领地并发起常用任务,复杂技术信息放在展开详情中。
|
|
176
|
+
- 四类证据分别是治理事实(`GOVERNANCE_FACT`)、运行观察(`RUNTIME_OBSERVATION`)、执行者呈报(`WORKER_CLAIM`)与派生解释(`DERIVED_EXPLANATION`),不能压成一条“总体成功”。
|
|
177
|
+
- 日常主链是规划→指派→持久治理执行→呈报进入 `REVIEW`→Supervisor 裁决 `ACCEPT/REWORK/FAIL/HANDOFF`;持久路径失败不会自动降级到 `LEGACY_COMPAT`。
|
|
178
|
+
- Owner 专属动作始终不可执行(`executable=false / DIRECT_SLASH_REQUIRED`)。带状态 GET 需要有效本地控制 Cookie 或已配置 bearer;内部 `readContext` 来自 direct 激活时捕获的 Session,不接受浏览器自报,也不序列化到响应。
|
|
179
|
+
- 对 `GOVERNED_PERSISTENT`,暂停、恢复、终止当前都不可执行。合法生命周期候选在会话、Supervisor、scope、Host 与命令覆盖检查通过后,投影返回 `executable=false / GOVERNED_RUNTIME_CONTROL_UNAVAILABLE`;其他状态可能不列动作或先显示更早的拒绝原因。命令名称存在不代表可验证的 Runtime control seam 已实现。
|
|
180
|
+
- 未结算的持久治理 Execution 会在访问 Runtime/Session/Lease 前阻止新 attempt;对已有 Dispatch 关联的不可判定恢复路径,Dispatch、Lease、Execution 原子进入 `RECOVERING`,不改 Task、不自动重试或伪造终态。
|
|
181
|
+
- 事件与投影 payload 经过递归、有界脱敏,但这不是提交秘密的许可。
|
|
182
|
+
- 证据必须分层读取:静态源码/测试只是前置;fake Runtime、headless 浏览器、桌面真实连续交互、真实 DSH/Provider 是不同证据层级,不能互相替代。
|
|
183
|
+
> v1.0 GUI 的王国地图、管理中心、王国账本、任务→执行→审查、Authority 与恢复口径见
|
|
184
|
+
> [v1.0 GUI 快速开始](docs/v1.0/GUI_QUICK_START.md)。
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## 🗺 路线图
|
|
189
|
+
|
|
190
|
+
| 版本 | 内容 | 状态 |
|
|
191
|
+
|---|---|---|
|
|
192
|
+
| 0.1.x | 王国基础:初始化/领地/角色绑定/重启恢复 | ✅ 已发布 |
|
|
193
|
+
| 0.2.x | 任务治理闭环:plan/assign/execute/review + **Claim ≠ Fact** | ✅ 已发布 |
|
|
194
|
+
| 0.3.x | 执行生命周期 + GUI 适配层 + 热插拔加固 | ✅ 已发布 |
|
|
195
|
+
| 0.4.x | **换届与会话归属**:unbind/bind_session、会话身份预留字段、session-bound 强制校验、init 引导 | ✅ 已发布 |
|
|
196
|
+
| 0.5.x | **领地删除**(拒绝优先 + force 级联 + 事件留痕)、GUI 删除控制、市场收录 | ✅ 已发布 |
|
|
197
|
+
| 0.8.0 | Persistent Governed Worker、Capability/Lease/Dispatch/Recovery | ✅ 已发布 |
|
|
198
|
+
| 0.9.0-alpha.1 | 内置可操作 GUI 最小闭环 | 本地源码阶段,尚未发布 |
|
|
199
|
+
| 1.0.0 | 王国地图、管理中心、王国账本、移交、沙箱与诚实的执行控制投影 | ✅ 已发布 |
|
|
200
|
+
| 2.0.0 | 个人工作台、人类管理窗口、有界协作、用量与软预算、恢复约束 | 上一版本;发布状态以 Releases 为准 |
|
|
201
|
+
| 3.0.0 | Owner 交付清单、逐条知悉、主管确认的改动证据、条目问答 | 随 3.1.0 一并发布 |
|
|
202
|
+
| 3.1.0 | DSH 0.1.7 兼容(peer 分线声明)、无 live Agent 会话可绑定席位、`session_evidence` 证据字段 | 当前版本;发布状态以 Releases 为准 |
|
|
203
|
+
|
|
204
|
+
> 已发布版本与市场更新状态以 [Releases](https://github.com/lusblead/dsh-Kingdom/releases) 为准(发布流程见 [RELEASE.md](RELEASE.md))。
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## 📖 文档
|
|
209
|
+
|
|
210
|
+
- [3.1 版本说明](docs/V3.1-RELEASE-NOTES.md) — DSH 0.1.7 兼容范围与无 live Agent 会话的席位绑定
|
|
211
|
+
- [3.0 使用指南](docs/V3.0-USER-GUIDE.md) — 交付清单、知悉、查看改动与条目问答
|
|
212
|
+
- [3.0 版本说明](docs/V3.0-RELEASE-NOTES.md) — 新增内容及实际验证范围
|
|
213
|
+
- [3.0 功能介绍](docs/DSH-KINGDOM-3.0-ANNOUNCEMENT.md) — 面向使用者的文章草稿
|
|
214
|
+
- [2.0 使用指南](docs/V2.0-USER-GUIDE.md) — 上一版本的日常任务、协作与恢复
|
|
215
|
+
- [v1.0 GUI 快速开始](docs/v1.0/GUI_QUICK_START.md) — 历史版本参考
|
|
216
|
+
- [LICENSE](LICENSE) — AGPL-3.0-or-later
|
|
217
|
+
|
|
218
|
+
## 🤝 参与贡献
|
|
219
|
+
|
|
220
|
+
欢迎提交 Issue / PR。克隆源码后安装锁定依赖并构建;单元测试使用隔离夹具,不读取个人数据库或调用付费模型:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
npm ci --registry=https://registry.npmjs.org
|
|
224
|
+
npm run typecheck
|
|
225
|
+
npm test
|
|
226
|
+
node scripts/p2-smoke.mjs # 当前治理与恢复测试
|
|
227
|
+
node scripts/p3-smoke.mjs # 当前 GUI 与人类管理窗口测试
|
|
228
|
+
node scripts/hotplug-audit.mjs # 服务释放、撤销与恢复测试
|
|
229
|
+
npm pack # 从当前源码重新构建并打包
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## 📜 许可证
|
|
233
|
+
|
|
234
|
+
[AGPL-3.0-or-later](LICENSE) © 2026 lusblead。v0.8.0 及更早版本保持其发布时的 BSD-3-Clause 许可。
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
<div align="center">
|
|
239
|
+
|
|
240
|
+
**Unofficial project, independently developed and maintained by community members.**
|
|
241
|
+
|
|
242
|
+
*DSH · Agent Kingdom · Multi-agent governance*
|
|
243
|
+
|
|
244
|
+
</div>
|