dsh-project-flow 0.0.0-stage → 0.8.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,189 @@
1
+ # 更新日志
2
+
3
+ dsh-project-flow 的版本变更。版本号遵循语义化版本。
4
+
5
+ ## 关于 0.3.0 到 0.8.0 之间的记录
6
+
7
+ 这段时间的版本号确实存在过,但**没有按版本留下发布记录**,原因是过程性的:
8
+
9
+ - 仓库(`D:\dsh-plugins\dsh-project-flow`)只在 2026-11-25 提交过 7 次,全部是 0.3.0 那天的;
10
+ - 之后 3300 多行改动一直留在工作区里没提交、没打 tag;
11
+ - 每次打包只是把 `package.json` 的 `version` 改个数字,没有同步写文档。
12
+
13
+ 所以下面这份历史是**从实物还原的**:每一段都指得出依据的文件(补丁、基线、文档、包),不是凭印象补的。凡是有实物能对上的,写清楚;对不上的,标明。
14
+
15
+ ---
16
+
17
+ ## [0.8.0] - 2026-12-03
18
+
19
+ 修状态栏、修账、修目录门控。全部是实测出来的。
20
+
21
+ ### 修复
22
+
23
+ **状态栏**
24
+
25
+ - **按钮点了报「命令没送到宿主」**:宿主 `commands.execute` 的返回值外面套了几层包装,客户端写死了其中一种形状,换一层就全错。现在一层层剥到出现 `kind` 为止;认不出形状时把实际的键报出来。
26
+ - **点状态栏,对话框里多一条看不懂的字**:状态栏原来每次刷新都先调一次 `/flow-panel` 命令「触发计算」,而命令服务每执行一次都会往会话里追加 `command/run` 和带 text 的 `command/done`,界面把它当消息渲染。现在状态栏只走 HTTP,一次命令都不调,`/flow-panel` 命令本身也已下线。
27
+ - **状态栏整块空白**:`workspaceFiles` 服务在有些 profile 里不存在,客户端读不到自己的工作目录。现在 HTTP 面板接口接受 `sid`,宿主自己反查。
28
+ - **`sid` 反查一直拿不到目录**:`agents` 没走 `ctx.inject` 声明,而 Cordis 对未声明的服务是「访问即抛」,包 try 也只会得到 `undefined`。改成声明注入,并加了不依赖任何服务的磁盘兜底(读 `session_projcache` 里的 `record.identity.cwd`,本机实测 40/40 可解)。
29
+ - **两条状态栏显示一样**:面板数据不区分「哪个项目是哪个会话开的」。现在按会话标记 `mine`。
30
+ - **状态栏串栏**:`lastPanelFull` 是整进程一份,谁最后算谁覆盖。改为按工作流根分开存。
31
+ - **停止按钮停错项目**:两个项目同时跑时取的是「第一个在跑的」。现在优先停自己这个会话发起的。
32
+ - **提示条残留**:清理只挂在「点切换按钮收起」一条路上,点 ×、按 Esc、点外面都不清。现在一开一收都清,未启用状态下干脆不渲染。
33
+
34
+ **账与费率**
35
+
36
+ - **静默挂死误判**:心跳只在「每阶结束」记一次,一阶跑过 900 秒就被判 `FAULT_SILENT_HANG`——哪怕子会话一直在吐 token。现在接到子会话的 `session/event` 上。
37
+ - **计费按最贵单价套总数**:`beginStage()` 从未被调用,守护器不知道每阶用什么模型,一律拿最贵兜底价乘全部 token,虚高数倍。改为按模型分账。
38
+ - **换模型就没法估预算**:原来只内置 3 个模型的价。新增 `prices.mjs`,装好即探测本机所有可用模型,四级定价。
39
+ - **价目表两处各算一套**、**汇率两处各写一个数**:统一到 `resolvePriceTable()` 和 `cnyRate`。
40
+ - **型号族规则误判**:`max` 命中「Mini**Max**-M2.5」,中档模型被估成顶配价。改成卡词边界。
41
+ - **上次工作目录被写脏**:`project-flow.last-root` 跑一次测试就写成临时目录。现在只记真的在「工作流」里、且不在临时区的路径;删掉了没人读的 `lastRoot()`。
42
+
43
+ **目录门控**
44
+
45
+ - **在默认工作区也能跑工作流**:配了绝对 `flowRoot` 时,在别处调 `project_run` / `project_resume` / `/flow` 会自动把工作目录挪过去,等于在用户工程目录旁边另起一个 `.project-flow`。现在一律拒绝并指出该去哪个目录;没配 `flowRoot` 的仍自动建目录。
46
+
47
+ ### 新增
48
+
49
+ - `prices.mjs`:四级定价(你配的 → 内置已知 → 型号族估算 → 最贵兜底),每档带 `confidence`。
50
+ - `project_estimate` 工具:开工前估整个流程要花多少人民币,返工增量单列。
51
+ - `/flow-cost`:看实际花了多少,带分模型表格。状态栏有「花费」按钮。
52
+ - `/flow-prices`:列出本机每个可用模型的费率与来源。状态栏有「费率」按钮。
53
+ - `/flow-set 价格 模型名 输入价 输出价`:用真实报价覆盖估算。
54
+ - 花费每阶落盘:`state.json` 新增 `cost` 字段。
55
+
56
+ ### 改进
57
+
58
+ - 状态栏报「工作流在哪」(`wherePath`),不再报会话目录。配置的 `flowRoot` 下面如果还有一层装着 `.project-flow` 的「工作流」,就指到那一层。
59
+ - 按钮成功后只显示一句「已执行 · 结果见会话日志」,正文留在会话日志。
60
+ - 去掉「面板」按键(返回 JSON,对用户没意义)。
61
+
62
+ ### 测试
63
+
64
+ 从 121 条增加到 150 条。新增 `prices.test.mjs`、`panel-buttons.test.mjs`、`concurrency-limit.test.mjs`、`session-cwd.test.mjs`、`flow-root.test.mjs`、`three-fixes.test.mjs`。修掉了 `project-flow-gate/watchdog.mjs` 是过期副本、20 条 watchdog 测试一直在验旧代码的问题。
65
+
66
+ ---
67
+
68
+ ## [0.7.9] - 2026-12-03
69
+
70
+ > 依据:`package.json` 里的 `version`、`project-flow-gate/index.js.baseline`(233,970 字节,2026-12-03 10:35)。
71
+
72
+ 0.6.0 之后的累计改动:相对 `index.js.chain.baseline` 增加 2106 行。实际内容按新增的顶层函数可还原为四块:
73
+
74
+ **目录门控**(`FLOW_DIR_NAME` / `FLOW_GATE_MODES` / `flowModeOf` / `flowRootOf` / `insideFlow` / `flowGateMessage` / `ensureFlowRoot` / `flowAncestor`)
75
+ 只在「工作流」目录里开工作模式;`flowRoot` 可配绝对路径;`flowGate` 可关。
76
+
77
+ **状态栏**(`panelStops` / `panelSnapshot` / `writePanelFile` / `watchRootOf` / `focusOf` / `mergeSignals`)
78
+ 会话标题栏里一格 chip,点开是浮层:四段全貌、三阶模型下拉、停止/继续按钮。
79
+
80
+ **自愈与续跑**(`buildResumePlan` / `pickResumable` / `explainStop` / `writeNextStep` / `diagnoseEmptyError` / `writeFileAtomic`)
81
+ 崩溃、重载、被杀之后按磁盘产物从中断那段接着跑,已经通过的段不重做。
82
+
83
+ **输入准备**(`CONTEXT_FILE` / `readRememberedContext` / `writeRememberedContext` / `splitRoute` / `PREVIEW_DIR` 相关)
84
+ 盲区结论跨会话记住;模型路由字符串拆成 provider + model;质检能看渲染图。
85
+
86
+ 同一天还修了 `verify-v4.mjs`(07:55)与 `client.js`(10:36)。
87
+
88
+ ---
89
+
90
+ ## [0.7.x] - 2026-12-02
91
+
92
+ > 依据:新增模块的文件时间戳,全部落在 2026-12-02。
93
+ > **版本号未确认**:这一天装到 0.7.9 之前的哪个中间版本号上,没有实物能对上,所以不写具体数字。
94
+
95
+ 这是加「外部能力」的一天,四个新模块:
96
+
97
+ | 文件 | 时间 | 作用 |
98
+ |---|---|---|
99
+ | `aesthetic.mjs` | 10:46 | 审美约束:按载体(PPT/网页/卡片/文档)注入排版规矩 |
100
+ | `aesthetic-seeds.mjs` | 11:07 | 内置版式骨架种子 |
101
+ | `aesthetic-library.mjs` | 11:08 | 版式库:采集、打分、按用过/过关排序 |
102
+ | `domains.mjs` | 11:24 | 行当包:按任务关键词识别领域,给该行当的交付物与验收项 |
103
+ | `desktop.mjs` | 11:56 | 桌面工具接入 |
104
+ | `evidence.mjs` | 19:44 | 证据包扩充(相对 11-30 版本) |
105
+ | `README.md` | 20:13 | 文档重写到 0.7 口径 |
106
+
107
+ 配套:`/flow-patterns`、`/flow-domain` 两条命令,`/flow-set 审美`、`/flow-set 领域` 两个开关。
108
+
109
+ ---
110
+
111
+ ## [0.6.0] - 2026-11-30
112
+
113
+ > 依据:`project-flow-gate/package.json.baseline` 里 `"version": "0.6.0"`(21:51);`docs/FEATURES.md` 页首写着「版本 0.6.0」;`project-flow-gate/功能全清单.md`(21:34)同名标注 0.6.0。
114
+
115
+ 这是核心功能定型的一版。0.6.0 的功能清单章节就是当时的实况:
116
+
117
+ ```
118
+ 零、工作流目录 一、流水线 二、状态机
119
+ 三、九个工具 四、十个命令 五、状态栏
120
+ 六、产物 七、完成证据包 八、三道闸(执行守护器)
121
+ 九、自愈 十、第 1 阶的门控 十一、配置
122
+ ```
123
+
124
+ 也就是说:**证据包、执行守护器、自愈、意图门控在 0.6.0 就已经齐了**,后面的 0.7 是在这上面加审美、领域和目录门控。
125
+
126
+ 同一天早些时候(08:06–08:53)做的三件事,都记在 `问题清单.md` 里:
127
+
128
+ 1. **证据包线上是坏的**:`watchdog.tokens` 取值器只加在工作区副本、没同步到装好的插件,`evidence` 字段永远是空字符串;24 条单测全绿是因为它们 import 的是副本。→ 修成 `watchdog-tokens.test.mjs`,并把测试改成验装好的那份。
129
+ 2. **同一错反复出现要熔断**:`RepeatBreaker` 按 `Execution_Log.md` 新增行计数,同一指纹 3 次即判死循环。
130
+ 3. **重建检查**:`rebuild-check.mjs`,确认打包产物能跑。
131
+
132
+ ---
133
+
134
+ ## [0.4.0] - 2026-11-26 至 11-30
135
+
136
+ > 依据:`apply-fixes.mjs` 第 500 行写着 `pkg.version = '0.4.0'`;`verify-deploy.mjs` 第 149 行有检查项「版本号跟着功能走(不低于 0.4.0)」。
137
+
138
+ 这一版做了两件结构性的事,都留下了完整补丁:
139
+
140
+ **一、五段改成四段**(`patch-v4.diff`,11-27 13:58)
141
+
142
+ ```
143
+ 1: '问意图' → '需求'
144
+ 4: '自检' → '质检'
145
+ 5: '验收' → 删除
146
+ ```
147
+
148
+ 原来第 1 段问意图、第 5 段出验收报告都在主对话;改成四段之后,第 1 段仍是主对话(子会话问不了用户),但没有独立的第 5 段验收,验收压进证据包。配套 `migrate-v4.mjs` 迁移旧的 `state.json`。
149
+
150
+ **二、意图门控**(`patch.diff`,11-26 20:06)
151
+
152
+ 引入 `gate.mjs`:`evaluateReadiness`、`guardToolCall`、`extractReadiness`、`buttonState`、`DIMENSION_KEYS`、`MIN_CONCLUSION_LENGTH`。就是现在那套「五格盲区必须有具体结论、写『已确认』三个字过不了检验」的硬门槛。
153
+
154
+ **三、执行守护器**(`patch-watchdog.diff`,11-27 15:14)
155
+
156
+ 引入 `Watchdog`:三道闸——次数熔断(同一错 3 次)、活性巡检(一段时间既没写文件也没 API 返回)、预算熔断(累计花费上限)。
157
+
158
+ ---
159
+
160
+ ## [0.3.0] - 2026-11-25
161
+
162
+ > 依据:git 提交 `7ad11c1`「初始提交:五段工作流插件 dsh-project-flow v0.3.0」;`D:\dsh-plugins\_release\dsh-project-flow-0.3.0.tgz`(122,112 字节)与同名 `.zip`;`docs/RELEASE-0.3.0.md`。
163
+
164
+ 首次公开版本,**五段**工作流:问意图 → 规划 → 实施 → 自检 → 验收。中间三段各开独立子会话,只传任务书不传过程。
165
+
166
+ 当天还有 6 个后续提交,都是发布相关的修补:
167
+
168
+ - 给 PowerShell 脚本补 UTF-8 BOM(5.1 读无 BOM 会按 GBK 解码,中文全乱)
169
+ - `push.ps1` 覆盖四种占位符写法
170
+ - 填入仓库地址 `LiuShi611/dsh-project-flow`
171
+ - 修掉三个「下载即跑」的缺陷,许可改为 PolyForm Small Business 1.0.0
172
+ - 打包只收 `docs/*.md` 与 `assets/*.png`
173
+ - 补 v0.3.0 发布说明
174
+
175
+ ---
176
+
177
+ ## 版本号对不上的地方
178
+
179
+ **0.5.0 没有任何实物。** 全盘搜过:gate 目录、插件目录、npm 缓存、pnpm store、git 全部引用,只有 0.3.0、0.4.0、0.6.0、0.7.9 四个字样。
180
+
181
+ 从时间上看,0.4.0 是 11-30 08:24 由 `apply-fixes.mjs` 写进去的,0.6.0 是同日 21:51 的 `package.json.baseline`。中间那半天做了证据包(08:06)、重建检查(08:53)、守护器重写(19:07)——如果 0.5.0 存在过,就在这个窗口里,但没留下任何痕迹,所以不能替它编内容。
182
+
183
+ ---
184
+
185
+ ## 从这一版起的规矩
186
+
187
+ 0.8.0 起,每个版本必须在 `CHANGELOG.md` 里有条目,且 `package.json` 的 `version` 与条目对应。发版前跑一遍测试套件(`project-flow-gate/run-all.mjs`)。
188
+
189
+ 仓库那边建议同时打 tag,这样历史是自带的、不靠人记。要我现在把当前状态提交并打 `v0.8.0` 吗?
package/LICENSE ADDED
@@ -0,0 +1,128 @@
1
+ Required Notice: Copyright © 2026 刘适 (Liu Shi)
2
+
3
+ dsh-project-flow 采用 PolyForm Small Business License 1.0.0。
4
+ 中文说明与商业授权联系方式见 docs/COMMERCIAL.md。
5
+
6
+ ---
7
+
8
+ # PolyForm Small Business License 1.0.0
9
+
10
+ <https://polyformproject.org/licenses/small-business/1.0.0>
11
+
12
+ ## Acceptance
13
+
14
+ In order to get any license under these terms, you must agree
15
+ to them as both strict obligations and conditions to all
16
+ your licenses.
17
+
18
+ ## Copyright License
19
+
20
+ The licensor grants you a copyright license for the
21
+ software to do everything you might do with the software
22
+ that would otherwise infringe the licensor's copyright
23
+ in it for any permitted purpose. However, you may
24
+ only distribute the software according to [Distribution
25
+ License](#distribution-license) and make changes or new works
26
+ based on the software according to [Changes and New Works
27
+ License](#changes-and-new-works-license).
28
+
29
+ ## Distribution License
30
+
31
+ The licensor grants you an additional copyright license
32
+ to distribute copies of the software. Your license
33
+ to distribute covers distributing the software with
34
+ changes and new works permitted by [Changes and New Works
35
+ License](#changes-and-new-works-license).
36
+
37
+ ## Notices
38
+
39
+ You must ensure that anyone who gets a copy of any part of
40
+ the software from you also gets a copy of these terms or the
41
+ URL for them above, as well as copies of any plain-text lines
42
+ beginning with `Required Notice:` that the licensor provided
43
+ with the software. For example:
44
+
45
+ > Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
46
+
47
+ ## Changes and New Works License
48
+
49
+ The licensor grants you an additional copyright license to
50
+ make changes and new works based on the software for any
51
+ permitted purpose.
52
+
53
+ ## Patent License
54
+
55
+ The licensor grants you a patent license for the software that
56
+ covers patent claims the licensor can license, or becomes able
57
+ to license, that you would infringe by using the software.
58
+
59
+ ## Fair Use
60
+
61
+ You may have "fair use" rights for the software under the
62
+ law. These terms do not limit them.
63
+
64
+ ## Small Business
65
+
66
+ Use of the software for the benefit of your company is use for
67
+ a permitted purpose if your company has fewer than 100 total
68
+ individuals working as employees and independent contractors,
69
+ and less than 1,000,000 USD (2019) total revenue in the prior
70
+ tax year. Adjust this revenue threshold for inflation according
71
+ to the United States Bureau of Labor Statistics' consumer price
72
+ index for all urban consumers, U.S. city average, for all items,
73
+ not seasonally adjusted, with 1982–1984=100 reference base.
74
+
75
+ ## No Other Rights
76
+
77
+ These terms do not allow you to sublicense or transfer any of
78
+ your licenses to anyone else, or prevent the licensor from
79
+ granting licenses to anyone else. These terms do not imply
80
+ any other licenses.
81
+
82
+ ## Patent Defense
83
+
84
+ If you make any written claim that the software infringes or
85
+ contributes to infringement of any patent, your patent license
86
+ for the software granted under these terms ends immediately. If
87
+ your company makes such a claim, your patent license ends
88
+ immediately for work on behalf of your company.
89
+
90
+ ## Violations
91
+
92
+ The first time you are notified in writing that you have
93
+ violated any of these terms, or done anything with the software
94
+ not covered by your licenses, your licenses can nonetheless
95
+ continue if you come into full compliance with these terms,
96
+ and take practical steps to correct past violations, within
97
+ 32 days of receiving notice. Otherwise, all your licenses
98
+ end immediately.
99
+
100
+ ## No Liability
101
+
102
+ ***As far as the law allows, the software comes as is, without
103
+ any warranty or condition, and the licensor will not be liable
104
+ to you for any damages arising out of these terms or the use
105
+ or nature of the software, under any kind of legal claim.***
106
+
107
+ ## Definitions
108
+
109
+ The **licensor** is the individual or entity offering these
110
+ terms, and the **software** is the software the licensor makes
111
+ available under these terms.
112
+
113
+ **You** refers to the individual or entity agreeing to these
114
+ terms.
115
+
116
+ **Your company** is any legal entity, sole proprietorship,
117
+ or other kind of organization that you work for, plus all
118
+ organizations that have control over, are under the control of,
119
+ or are under common control with that organization. **Control**
120
+ means ownership of substantially all the assets of an entity,
121
+ or the power to direct its management and policies by vote,
122
+ contract, or otherwise. Control can be direct or indirect.
123
+
124
+ **Your licenses** are all the licenses granted to you for the
125
+ software under these terms.
126
+
127
+ **Use** means anything you do with the software requiring one
128
+ of your licenses.