dsh-taskboard 0.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.
Files changed (49) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +169 -0
  3. package/cordis.patch.yml +12 -0
  4. package/lib/client.js +2085 -0
  5. package/lib/host/execution.js +189 -0
  6. package/lib/host/execution.js.map +1 -0
  7. package/lib/host/protocol-text.js +37 -0
  8. package/lib/host/protocol-text.js.map +1 -0
  9. package/lib/host/routes.js +369 -0
  10. package/lib/host/routes.js.map +1 -0
  11. package/lib/host/scheduler.js +91 -0
  12. package/lib/host/scheduler.js.map +1 -0
  13. package/lib/host/sdk.js +145 -0
  14. package/lib/host/sdk.js.map +1 -0
  15. package/lib/host/store.js +112 -0
  16. package/lib/host/store.js.map +1 -0
  17. package/lib/host/tools.js +620 -0
  18. package/lib/host/tools.js.map +1 -0
  19. package/lib/index.js +91 -0
  20. package/lib/index.js.map +1 -0
  21. package/lib/invariant.js +22 -0
  22. package/lib/invariant.js.map +1 -0
  23. package/lib/shared/api.js +9 -0
  24. package/lib/shared/api.js.map +1 -0
  25. package/lib/shared/protocol.js +279 -0
  26. package/lib/shared/protocol.js.map +1 -0
  27. package/package.json +74 -0
  28. package/src/client/api.ts +90 -0
  29. package/src/client/board/NewTaskModal.tsx +8 -0
  30. package/src/client/board/TaskBoard.tsx +184 -0
  31. package/src/client/board/TaskCard.tsx +61 -0
  32. package/src/client/board/TaskDetail.tsx +210 -0
  33. package/src/client/board/TaskFormModal.tsx +257 -0
  34. package/src/client/board-mount.tsx +92 -0
  35. package/src/client/controller.ts +241 -0
  36. package/src/client/index.ts +87 -0
  37. package/src/client/sidebar-entry.ts +165 -0
  38. package/src/client/styles.ts +391 -0
  39. package/src/host/execution.ts +244 -0
  40. package/src/host/protocol-text.ts +37 -0
  41. package/src/host/routes.ts +387 -0
  42. package/src/host/scheduler.ts +107 -0
  43. package/src/host/sdk.ts +200 -0
  44. package/src/host/store.ts +139 -0
  45. package/src/host/tools.ts +631 -0
  46. package/src/index.ts +124 -0
  47. package/src/invariant.ts +22 -0
  48. package/src/shared/api.ts +98 -0
  49. package/src/shared/protocol.ts +475 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 cloader
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,169 @@
1
+ # dsh-taskboard
2
+
3
+ DeepSeek Harness(DSH)的 **Agent 任务看板插件**:人把工作拆成卡片挂上看板,agent 会话通过 `taskboard_*` 工具认领、推进、评论、移交,人最终验收。双向协作,不是单向 todo 列表。
4
+
5
+ ```
6
+ 人在 GUI 建卡(选项目/紧急度/模型/执行方式)
7
+
8
+
9
+ 看板 ◄──SSE 实时刷新──┐
10
+ │ │ agent 会话内:
11
+ [手动执行/定时触发] │ taskboard_get / comment_add / move
12
+ │ ▼
13
+ ▼ 卡片 → in_progress →(实现+自验)→ in_review
14
+ 在任务项目里新建会话 agent 到此为止,永远到不了 done
15
+ (指定模型,干净上下文)
16
+
17
+
18
+ 人在看板上确认 → done(唯一入口)
19
+ ```
20
+
21
+ ## 功能特性
22
+
23
+ **Host 侧(agent 工具 + 台账 + 调度)**
24
+
25
+ - **8 个 `taskboard_*` 工具**:任何会话中的 agent 都能查板、建卡、认领、移卡、评论、软删除
26
+ - **任务挂项目**:项目直接映射 DSH workspace,零新实体;认领(todo→in_progress)校验调用会话归属,跨项目认领被拒
27
+ - **紧急度三色**:urgent 红 / normal 紫 / relaxed 蓝,贯穿卡片、筛选、详情
28
+ - **每任务可固定模型**:执行时创建会话即生效;未指定走部署默认模型
29
+ - **两种执行方式**:认领制(项目内会话认领)或定时执行(host 侧 cron,关掉浏览器照样跑,错过窗口跳过不补跑)
30
+ - **一键真实执行**:手动「执行」在任务项目内新建全新会话(干净上下文)提交任务 prompt,回合结算记入执行记录
31
+ - **乐观并发**:所有写操作带 `ifVersion`,冲突返回 `version_conflict`
32
+ - **完整归因**:每次变更记录 actor(user / agent+sessionId),评论区分作者
33
+ - **host 权威台账**:`~/.dsh/dsh-taskboard.json` 原子持久化,全局 revision 单调递增,SSE 推送 + 断线全量对账
34
+
35
+ **协议硬闸(代码级强制,不靠 prompt 自觉)**
36
+
37
+ - agent 移卡到 `done` 一律 `forbidden` —— 完成只能由人在 GUI 确认
38
+ - 认领要求会话 cwd 解析到任务所属 workspace(跨项目 = `workspace_mismatch`)
39
+ - 任务被某 agent 会话持有期间,其他会话不可抢占(任何移动 `forbidden`)
40
+ - agent 不可篡改任务的 model / execution 配置(归创建者/用户所有)
41
+
42
+ **Client 侧(看板 UI)**
43
+
44
+ - **五列看板**:待规划 / 待办 / 进行中 / 待验收 / 已完成;blocked 角标不占列;canceled / archived / 已删除收进「其它任务」页
45
+ - **筛选栏**:项目下拉 + 紧急度三色 chip 多选
46
+ - **任务卡片**:紧急度左缘色条、模型 / ⏰ 定时(下次运行时间)/ 受阻 / 最近执行结果角标、评论计数;backlog ↔ todo 拖拽
47
+ - **新建 / 编辑任务弹窗**(`TaskFormModal`,新建与编辑共用):
48
+ - 头部图标 + 副标题、双列网格表单、底部实时校验提示 + 操作按钮
49
+ - 紧急度色点卡片三选(各带副提示)、执行方式分段选择(认领制 / 定时)
50
+ - Cron 预设 chip 高亮选中,**实时校验**(非法表达式红框)+ **下次运行时间预览**(与 host 调度器同一套纯函数)
51
+ - 模型下拉读运行时已配置目录,「默认模型」为第一项
52
+ - Esc 关闭、自动聚焦标题、保存提示版本变化
53
+ - **任务编辑**:详情面板「✎ 编辑」回填全部字段;GUI 作为 owner surface 可改标题 / 描述 / Prompt / 紧急度 / **项目改绑** / 执行方式 / 模型(含清除回默认)
54
+ - **详情面板**:状态流转(done 二次确认)、受阻标记、用户/agent 气泡评论流、执行记录时间线(结果/耗时/会话短 id/错误摘要)、危险区(软删除→物理清除需确认)
55
+ - **主题适配**:全部颜色走外壳 `--dsw-alias-*` 设计令牌,浅色 / 深色主题与皮肤自动跟随
56
+
57
+ ## 核心概念
58
+
59
+ | 概念 | 说明 |
60
+ |---|---|
61
+ | 项目 | 直接映射 DSH workspace(无新实体)。任务创建时必须选一个 |
62
+ | 紧急度 | `urgent` 红 / `normal` 紫 / `relaxed` 蓝,看板列内以色条区分,支持筛选 |
63
+ | 状态机 | `backlog → todo → in_progress → in_review → done`,旁路 `canceled` / `archived`;`blocked` 是布尔标记不是状态 |
64
+ | 执行方式 | `claim`(项目内会话认领)或 `scheduled`(host 侧 cron 定时触发) |
65
+ | 模型 | 每任务可固定 `{provider, model}`;执行时应用到新建会话,未指定用部署默认模型 |
66
+ | 乐观并发 | 所有写操作带 `ifVersion`,冲突返回 `version_conflict`(重读再试一次即可) |
67
+ | 归因 | 每次变更记录 actor(user / agent+sessionId),评论挂 threadId |
68
+
69
+ ## Agent 工具(8 个)
70
+
71
+ | 工具 | 作用 |
72
+ |---|---|
73
+ | `taskboard_list` | 按项目/状态/紧急度过滤列卡(开始工作前先看) |
74
+ | `taskboard_get` | 读单卡全文(描述/prompt/评论/版本) |
75
+ | `taskboard_create` | 建卡(需要 agent 身份) |
76
+ | `taskboard_update` | 改标题/描述/prompt/紧急度/blocked(带 ifVersion) |
77
+ | `taskboard_move` | 移动状态(带 ifVersion;**代码级拒绝 agent 移到 done**) |
78
+ | `taskboard_comment_add` | 追加进度/报告评论 |
79
+ | `taskboard_comments` | 列评论(先读再决定开工) |
80
+ | `taskboard_delete` | 软删除(agent 只能标记,人在 GUI 清除) |
81
+
82
+ Agent 工作流协议(随插件注入 system prompt):开工先查板 → 先读后动 → 先认领再干活 → 冲突只重试一次 → 自验后移 in_review 留评论 → `done` 永远由人确认 → backlog 未授权不执行 → model/execution 只读。
83
+
84
+ ## 执行链路
85
+
86
+ 手动「执行」按钮或 cron 到期都走同一条路:
87
+
88
+ 1. 卡片置 `in_progress`,台账追加 execution 记录(`running`);
89
+ 2. 在任务项目目录里新建全新会话(干净上下文),带任务固定模型或部署默认模型;
90
+ 3. 会话 attach 到 workspace(GUI 项目会话列表可见、可回链);
91
+ 4. 任务 prompt 作为普通用户消息提交,消息头带任务 ID 与状态说明;
92
+ 5. 回合结算:成功 → `succeeded`;回合错误 → `failed`(错误入台账)。
93
+
94
+ 调度器每分钟 tick;到期任务先顺延 `nextRunAt` 再触发;错过超过 5 分钟的窗口跳过不补跑。
95
+
96
+ ## 安装
97
+
98
+ **GitHub 源安装**(收录 [awesome-dsh-plugin 精选列表](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin)后,dshmarket 市场里的一键安装走的也是这条路):
99
+
100
+ ```bash
101
+ dsh plugin --profile <name> add github:cloader/dsh-taskboard
102
+ ```
103
+
104
+ > 构建产物 `lib/` 已随仓库提交:安装即用,无本地构建、无构建脚本授权(`allowBuilds`)。
105
+
106
+ **npm 裸名安装**(需先将包发布到 npm;同样是预构建,免构建授权):
107
+
108
+ ```bash
109
+ dsh plugin --profile <name> add dsh-taskboard
110
+ ```
111
+
112
+ 本地 link 开发:profile 的 `package.json`:
113
+
114
+ ```json
115
+ {
116
+ "dependencies": {
117
+ "dsh-taskboard": "link:D:/path/to/dsh-taskboard"
118
+ },
119
+ "dsh": {
120
+ "profile": {
121
+ "bundles": [
122
+ "@deepseek-ai/dsh-base",
123
+ "@deepseek-ai/dsh-web-app",
124
+ "dsh-taskboard"
125
+ ]
126
+ }
127
+ }
128
+ }
129
+ ```
130
+
131
+ 然后 `dsh plugin --profile <name> add link:D:/path/to/dsh-taskboard`。
132
+
133
+ > ⚠️ 官方 `@deepseek-ai/dsh-*` 包只写进 `bundles` 列表,**不要** `plugin add` 进 profile dependencies(会引发 SDK 双实例遮蔽,详见项目根 README 的踩坑记录)。
134
+
135
+ host 侧改动需重启 `dsh web`;client 侧改动 rebuild 后刷新页面。
136
+
137
+ ## 开发
138
+
139
+ ```bash
140
+ npm install
141
+ npm run build # tsdown 双构建:host ESM + client CJS(wrap-client.mjs 包装)
142
+ npm test # vitest 41 项(protocol/tools/execution/routes/client)
143
+ npm run typecheck
144
+ ```
145
+
146
+ ## 架构
147
+
148
+ ```
149
+ src/
150
+ shared/protocol.ts # 状态机/紧急度/cron/记录类型(host+client 共享)
151
+ shared/api.ts # HTTP/SSE 线上契约
152
+ host/
153
+ store.ts # 台账:串行 mutate、原子持久化、订阅
154
+ tools.ts # 8 个 taskboard_* 工具 + 代码级协议闸
155
+ sdk.ts # SDK 兼容层(零运行时官方包 import)
156
+ protocol-text.ts # agent 工作流协议 systemPrompt section
157
+ execution.ts # 执行服务(新会话/模型/结算)
158
+ scheduler.ts # host 侧 cron tick
159
+ routes.ts # JSON + SSE HTTP 面
160
+ client/
161
+ index.ts # 注入入口(connection)
162
+ api.ts controller.ts # fetch/SSE + useSyncExternalStore 状态源
163
+ board/*.tsx # 看板视图(五列/筛选/卡片/详情/新建·编辑弹窗 TaskFormModal)
164
+ sidebar-entry.ts board-mount.tsx styles.ts
165
+ tests/ # vitest:protocol/tools/execution/routes/client + smoke-host
166
+ e2e/ # dev-server 手工验证脚本(P0–P4,见 tests/e2e/README.md)
167
+ ```
168
+
169
+ License: Apache-2.0
@@ -0,0 +1,12 @@
1
+ # dsh-taskboard bundle patch: inserts the plugin row into the web
2
+ # profile roster. Applied as a profile bundle layer (the `dsh.bundle.patch`
3
+ # manifest field) over dsh-base; activate with
4
+ # `dsh plugin --profile <name> add link:<path-to-this-package>`.
5
+ #
6
+ # The row is a bare plugin by package name: the node half (exports ".") runs
7
+ # in the host process (tools, ledger, routes, scheduler, protocol section),
8
+ # and the `dsh.client` declaration in package.json makes the browser half
9
+ # (exports "./client", served at /plugins/<id>/client.js) load in the web GUI.
10
+ - insert:
11
+ - id: dsh-taskboard
12
+ name: dsh-taskboard