dsh-tree-task-flow 0.3.0 → 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/README.md +23 -16
- package/config.example.yml +27 -0
- package/cordis.patch.yml +4 -3
- package/lib/commands.js +7 -7
- package/lib/http.js +1 -1
- package/lib/index.js +9 -7
- package/package.json +2 -2
- package/enable.example.yml +0 -4
package/README.md
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
**目标 → 任务 → 子任务**三级树,每个节点完成时由模型提交结果,插件随即把这个节点的
|
|
5
5
|
**执行过程**从上下文里折叠掉,只留下那条结果。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**安装即启用**:`dsh plugin add` 之后就生效,不需要再改任何配置。
|
|
8
|
+
不想用的时候,在 profile 里写一句 `enabled: false` 就能关掉,关掉后一个字节都不碰会话。
|
|
8
9
|
|
|
9
10
|
## 它解决什么
|
|
10
11
|
|
|
@@ -81,41 +82,47 @@
|
|
|
81
82
|
|
|
82
83
|
需要 Node.js 22.19 以上,以及能运行 `dsh`。
|
|
83
84
|
|
|
85
|
+
**从 npm 安装**:
|
|
86
|
+
|
|
87
|
+
```powershell
|
|
88
|
+
dsh plugin --profile web add dsh-tree-task-flow
|
|
89
|
+
```
|
|
90
|
+
|
|
84
91
|
**从源码目录安装**(装成 `link:`,改完源码重启即生效)。把仓库克隆到任意目录,
|
|
85
92
|
然后指向那个目录:
|
|
86
93
|
|
|
87
94
|
```powershell
|
|
88
95
|
dsh plugin --profile web add <插件目录>
|
|
89
|
-
dsh --profile web --dump-config # 输出里应出现 task-tree 这一行
|
|
90
96
|
```
|
|
91
97
|
|
|
92
|
-
|
|
98
|
+
`dsh plugin add` 会把包加进 profile 的 `dsh.profile.bundles`,而本包自带的
|
|
99
|
+
`cordis.patch.yml`(由 `package.json` 的 `dsh.bundle.patch` 指定)会顺势把
|
|
100
|
+
`task-tree` 这一行插进插件列表——**装上即启用,不需要再改任何配置**。装完可以核对:
|
|
93
101
|
|
|
94
102
|
```powershell
|
|
95
|
-
dsh
|
|
103
|
+
dsh --profile web --dump-config # 输出里应出现 task-tree 这一行,且不带 config
|
|
96
104
|
```
|
|
97
105
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
## 启用
|
|
106
|
+
**必须重启 `dsh web` 才生效**——运行中的会话不追溯,新工具要在新会话里才会出现。
|
|
101
107
|
|
|
102
|
-
|
|
108
|
+
## 关闭
|
|
103
109
|
|
|
104
|
-
|
|
110
|
+
不想要了,除了 `dsh plugin remove` 卸掉,也可以只把它关掉。在
|
|
111
|
+
`$DSH_HOME/profiles/<名字>/cordis.patch.yml` 里写:
|
|
105
112
|
|
|
106
113
|
```yaml
|
|
107
114
|
- id: task-tree
|
|
108
115
|
config:
|
|
109
|
-
enabled:
|
|
116
|
+
enabled: false
|
|
110
117
|
```
|
|
111
118
|
|
|
112
|
-
然后重启 `dsh web`。仓库里的 `
|
|
119
|
+
然后重启 `dsh web`。仓库里的 `config.example.yml` 有可以直接抄的完整版本。
|
|
113
120
|
|
|
114
121
|
> ⚠️ profile 这一层按行覆盖时 `config` 是**整体替换**,不是逐字段深合并——
|
|
115
122
|
> 覆盖时要把想保留的字段一起写全,没写的会走插件默认值(见下面的配置表)。
|
|
116
123
|
|
|
117
|
-
|
|
118
|
-
不挂暂停闸门。只留一条 `/task-tree`
|
|
124
|
+
关掉之后插件**一个字节都不碰会话**:不注册工具、不加提示词段落、不折叠、不续行、
|
|
125
|
+
不挂暂停闸门。只留一条 `/task-tree` 命令,让你确认它是被关掉的以及怎么打开。
|
|
119
126
|
|
|
120
127
|
## 界面
|
|
121
128
|
|
|
@@ -137,7 +144,7 @@ dsh plugin --profile web add dsh-tree-task-flow
|
|
|
137
144
|
**没有计划的会话一个像素都不占**——读不到计划就返回 `null`,不会平白挤掉内置的
|
|
138
145
|
待办与目标条目。
|
|
139
146
|
|
|
140
|
-
开关不在界面上,在 profile 的 `cordis.patch.yml`
|
|
147
|
+
开关不在界面上,在 profile 的 `cordis.patch.yml` 里(见上面的「关闭」一节)。
|
|
141
148
|
|
|
142
149
|
## 命令
|
|
143
150
|
|
|
@@ -158,7 +165,7 @@ dsh plugin --profile web add dsh-tree-task-flow
|
|
|
158
165
|
|
|
159
166
|
| 字段 | 默认 | 说明 |
|
|
160
167
|
|---|---|---|
|
|
161
|
-
| `enabled` | `
|
|
168
|
+
| `enabled` | `true` | 总开关;**装上即启用**,写 `false` 关掉 |
|
|
162
169
|
| `autoContinue` | `false` | 模型停下时是否自动续行 |
|
|
163
170
|
| `maxAutoRounds` | `5` | 连续自动续行的轮次上限 |
|
|
164
171
|
| `promptOrder` | `1800` | 工具说明段落的排序 |
|
|
@@ -263,7 +270,7 @@ dsh plugin --profile web add dsh-tree-task-flow
|
|
|
263
270
|
真去物化 `client.js`、真调一次 `apply`、真渲染一遍条目。
|
|
264
271
|
|
|
265
272
|
```powershell
|
|
266
|
-
node verify-entry.mjs #
|
|
273
|
+
node verify-entry.mjs # 入口装配:默认(安装即启用)/ 显式关闭两条路径各注册了什么
|
|
267
274
|
node verify-tools.mjs # 工具层:schema、result 必填、三级约束
|
|
268
275
|
node verify-region.mjs # 折叠行为:游标推进、降级追加、检查点提示
|
|
269
276
|
node verify-plan.mjs # 计划树纯逻辑:状态流转、自动完成、丢弃级联
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# 这个文件只是示例,插件不需要它——**安装即启用**,装完就能用。
|
|
2
|
+
#
|
|
3
|
+
# 想改默认值时,把下面这段抄进 profile 自己的 cordis.patch.yml
|
|
4
|
+
# (通常是 $DSH_HOME/profiles/<名字>/cordis.patch.yml):
|
|
5
|
+
#
|
|
6
|
+
# - id: task-tree
|
|
7
|
+
# config:
|
|
8
|
+
# enabled: false
|
|
9
|
+
#
|
|
10
|
+
# ⚠️ 同 id 的 config 是**整体替换**,不是逐字段深合并:写进去的字段会一次性顶掉
|
|
11
|
+
# 整份默认配置,没写的字段回落到 `lib/index.js` 的 DEFAULT_CONFIG。所以要改
|
|
12
|
+
# 哪一项就把想保留的项一起写全。
|
|
13
|
+
- id: task-tree
|
|
14
|
+
config:
|
|
15
|
+
# 总开关。默认 true(装上即启用);写 false 就一句话关掉,
|
|
16
|
+
# 关掉后插件不注册工具、不加提示词、不折叠上下文、不续行,一个字节都不碰会话。
|
|
17
|
+
enabled: true
|
|
18
|
+
# 模型停下时是否自动续行。默认 false —— 开着意味着 agent 一空下来就被再推一把,
|
|
19
|
+
# 会出现「按下停止却停不下来」,所以它从不默认打开。
|
|
20
|
+
autoContinue: false
|
|
21
|
+
# 连续自动续行的轮次上限,达到就停;只有真人发言才重置配额。
|
|
22
|
+
maxAutoRounds: 5
|
|
23
|
+
# 工具说明段落的排序。1800 落在内置的 TOOL_PTY(1700) 与 TOOL_WEB_SEARCH(2000)
|
|
24
|
+
# 之间的空档,不与任何内置段落撞号。
|
|
25
|
+
promptOrder: 1800
|
|
26
|
+
# 插件状态目录;null 表示 $DSH_HOME/dsh-task-tree。
|
|
27
|
+
rootDir: null
|
package/cordis.patch.yml
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
#
|
|
3
3
|
# package.json 的 dsh.bundle.patch 指向本文件,因此安装成 bundle 后,
|
|
4
4
|
# 这一层会自动挂进 `dsh.profile.bundles` 配置栈(优先级低于 profile 自身的
|
|
5
|
-
# cordis.patch.yml
|
|
5
|
+
# cordis.patch.yml)。安装这个动作本身就把插件行插好了——**装上即启用**,
|
|
6
|
+
# 不需要再改任何配置。
|
|
6
7
|
#
|
|
7
|
-
# 这里刻意不写 config,全部走 lib/index.js 里的 DEFAULT_CONFIG
|
|
8
|
+
# 这里刻意不写 config,全部走 lib/index.js 里的 DEFAULT_CONFIG(enabled 默认 true)。
|
|
8
9
|
# 要临时关掉或改默认值,请在 profile 自己的 cordis.patch.yml 里覆盖这一行。
|
|
9
10
|
#
|
|
10
11
|
# ⚠️ 同 id 的 config 是**整体替换**,不是逐字段深合并——覆盖时要把需要的
|
|
11
12
|
# 字段一次写全。可覆盖的字段见 DEFAULT_CONFIG:
|
|
12
13
|
#
|
|
13
|
-
# enabled 总开关 默认 false
|
|
14
|
+
# enabled 总开关 默认 true(写 false 关掉)
|
|
14
15
|
# autoContinue 是否允许自动续行 默认 false(开着会让人停不下来)
|
|
15
16
|
# maxAutoRounds 连续自动续行轮次上限 默认 5
|
|
16
17
|
# promptOrder 工具说明段顺序 默认 1800
|
package/lib/commands.js
CHANGED
|
@@ -20,10 +20,10 @@ const USAGE = [
|
|
|
20
20
|
"/task-tree reset 清掉本会话的计划树",
|
|
21
21
|
].join("\n");
|
|
22
22
|
|
|
23
|
-
/**
|
|
23
|
+
/** 插件被配置关掉时唯一要说的话:现在是关的,以及怎么打开。 */
|
|
24
24
|
const DISABLED_NOTE =
|
|
25
|
-
"dsh-tree-task-flow
|
|
26
|
-
"
|
|
25
|
+
"dsh-tree-task-flow 已被配置**关闭**(config 里 enabled 不是 true):它没有注册工具," +
|
|
26
|
+
"也不会折叠任何上下文。要打开请在 profile 的 cordis.patch.yml 里把 enabled 设为 true。";
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* 把检查点那句话拼出来。措辞与 `plan.js` 的检查点提示一致。
|
|
@@ -45,7 +45,7 @@ function checkpointLines(checkpoint) {
|
|
|
45
45
|
*
|
|
46
46
|
* @param ctx - 挂载本行的 Cordis 上下文。
|
|
47
47
|
* @param options - `{ store, cfg, pause, enabled }`;`pause` 是 `registerPause`
|
|
48
|
-
*
|
|
48
|
+
* 返回的控制接口,被关闭时是 null。
|
|
49
49
|
*/
|
|
50
50
|
export function registerCommands(ctx, { store, cfg, pause = null, enabled = false }) {
|
|
51
51
|
// 和 tools 一样,命令服务不是每个部署都有;用 get 探测而不是写进 inject。
|
|
@@ -72,12 +72,12 @@ export function registerCommands(ctx, { store, cfg, pause = null, enabled = fals
|
|
|
72
72
|
return { kind: "success", text: enabled === true ? USAGE : `${DISABLED_NOTE}\n\n${USAGE}` };
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
//
|
|
76
|
-
//
|
|
75
|
+
// 被关闭时插件没有注册工具,也就不会有计划树;除了确认关闭状态,
|
|
76
|
+
// 其余动词一概不执行——关掉的插件一个字节都不该碰会话。
|
|
77
77
|
if (enabled !== true && verb !== "status") {
|
|
78
78
|
return {
|
|
79
79
|
kind: "error",
|
|
80
|
-
text: `${DISABLED_NOTE}\n\n
|
|
80
|
+
text: `${DISABLED_NOTE}\n\n关闭状态下只有 /task-tree status 与 /task-tree help 可用。`,
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
|
package/lib/http.js
CHANGED
|
@@ -101,7 +101,7 @@ function afterWrite(plan) {
|
|
|
101
101
|
* 注册全部面板接口。
|
|
102
102
|
*
|
|
103
103
|
* @param ctx - 挂载本行的 Cordis 上下文。
|
|
104
|
-
* @param options - `{ store, autoContinue, pause }
|
|
104
|
+
* @param options - `{ store, autoContinue, pause }`;插件被关闭时后两者是 null。
|
|
105
105
|
*/
|
|
106
106
|
export function registerHttp(ctx, { store, autoContinue, pause = null }) {
|
|
107
107
|
ctx.inject(["webServer"], (host) => {
|
package/lib/index.js
CHANGED
|
@@ -43,11 +43,13 @@ export const DEFAULT_CONFIG = {
|
|
|
43
43
|
/**
|
|
44
44
|
* 总开关。
|
|
45
45
|
*
|
|
46
|
-
* ★
|
|
47
|
-
*
|
|
48
|
-
*
|
|
46
|
+
* ★ **默认开启**:装上就用。安装这个插件本身就是用户点的头,
|
|
47
|
+
* 再让每个人去改一遍 profile 配置没有道理。
|
|
48
|
+
*
|
|
49
|
+
* 想关掉就在 profile 的 `cordis.patch.yml` 里显式写 `enabled: false`——
|
|
50
|
+
* 关掉之后它一个字节都不碰会话(见下面 apply 里的分支)。
|
|
49
51
|
*/
|
|
50
|
-
enabled:
|
|
52
|
+
enabled: true,
|
|
51
53
|
/**
|
|
52
54
|
* 是否允许在模型停下时自动续行。
|
|
53
55
|
*
|
|
@@ -75,8 +77,8 @@ export function apply(ctx, config) {
|
|
|
75
77
|
const root = cfg.rootDir ?? defaultRoot();
|
|
76
78
|
const store = createStore(root);
|
|
77
79
|
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
+
// 被显式关掉时,一个字节都不碰会话:不注册工具、不加提示词段落、不折叠上下文、
|
|
81
|
+
// 不续行——只留一条命令,让人能确认"装了但被关掉了"以及怎么打开。
|
|
80
82
|
if (cfg.enabled !== true) {
|
|
81
83
|
registerCommands(ctx, { store, cfg, pause: null, enabled: false });
|
|
82
84
|
// 条目接口照挂:客户端条目与 enabled 无关,照样会来读。读不到计划它就返回
|
|
@@ -84,7 +86,7 @@ export function apply(ctx, config) {
|
|
|
84
86
|
// 只读插件自己的状态目录,不碰任何会话。
|
|
85
87
|
registerHttp(ctx, { store, autoContinue: null, pause: null });
|
|
86
88
|
ctx.logger?.warn?.(
|
|
87
|
-
"dsh-tree-task-flow:
|
|
89
|
+
"dsh-tree-task-flow: 已按配置关闭(enabled=false)。要打开请在 profile 的 cordis.patch.yml 里把它设为 true。",
|
|
88
90
|
);
|
|
89
91
|
return;
|
|
90
92
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-tree-task-flow",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "树形任务流:把多步任务组织成目标→任务→子任务三级树,节点完成时由 AI 提交结果,插件随即把该节点的执行过程从上下文里折叠掉,只留下结果。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"lib",
|
|
14
14
|
"client.js",
|
|
15
15
|
"cordis.patch.yml",
|
|
16
|
-
"
|
|
16
|
+
"config.example.yml",
|
|
17
17
|
"README.md"
|
|
18
18
|
],
|
|
19
19
|
"dsh": {
|
package/enable.example.yml
DELETED