dsh-workplan 2.1.5 → 2.2.7
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 +408 -1
- package/README.en.md +5 -2
- package/README.md +5 -2
- package/client.js +148 -3
- package/docs/dsh-workplan_T4_runtime.patch +508 -0
- package/docs/release-record-2.2.6-20261109-T5.md +64 -0
- package/docs/release-records/release-notes-2.2.6-T3.md +128 -0
- package/docs/release-records/release-steps-20261106.md +1 -1
- package/docs/release-records/version-freeze-20261109-T2.md +37 -0
- package/lib/client.js +148 -3
- package/lib/comm-format.js +17 -0
- package/lib/host.js +95 -17
- package/lib/notice-channel.js +290 -0
- package/lib/plan.js +668 -39
- package/lib/replan.js +35 -4
- package/lib/runtime.js +1918 -116
- package/lib/supersede.js +2 -2
- package/lib/understanding.js +8 -2
- package/lib/watchdog.js +52 -1
- package/package.json +3 -2
- package/scripts/repair-malformed-user-messages.mjs +312 -0
- package/src/client.ts +155 -2
- package/src/comm-format.ts +17 -0
- package/src/host.ts +90 -12
- package/src/notice-channel.ts +328 -0
- package/src/plan.ts +699 -30
- package/src/replan.ts +32 -1
- package/src/runtime.ts +1966 -118
- package/src/supersede.ts +2 -1
- package/src/understanding.ts +10 -2
- package/src/watchdog.ts +80 -1
- package/README.zh.md +0 -239
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# dsh-workplan v2.2.6 对外发布说明(T3 · 2026-11-09)
|
|
2
|
+
|
|
3
|
+
- 版本冻结依据:`docs/release-records/version-freeze-20261109-T2.md`(冻结版本 = **2.2.6**;已发布基准 2.1.5 / tag v2.1.5 / commit 6ed12d3)
|
|
4
|
+
- 本文所有数字与事实均回指既有归档证据,未新造任何数字;引用清单见文末「证据回指表」。
|
|
5
|
+
- 用途:§一 供 GitHub Release 页面正文直接粘贴;§二 供索引源(awesome-dsh-plugin)PR 与 tarball 更新;§三 为自检记录。
|
|
6
|
+
- 本文件只描述「准备就绪的发布内容」,不表述发布动作是否已发生;发布执行与状态由 T4/T5/T6/T7 产出。
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 一、GitHub Release 正文(tag:v2.2.6)
|
|
11
|
+
|
|
12
|
+
# dsh-workplan v2.2.6 — 三项修复:回放闭环、需求序列化、分解进度可见
|
|
13
|
+
|
|
14
|
+
**本版包含三项修复**,全部改动以锚点标记可追溯(`[2.2.6]` 标记 src 12 处 ↔ lib 12 处一一对应),并完成合并态统一回归(**666/666** 通过)。
|
|
15
|
+
|
|
16
|
+
## 1. D-1:重启回放丢弃人工改判的 closure 字段(起源 1.7.0,非 2.2.5 引入)
|
|
17
|
+
|
|
18
|
+
durable 的 `workplan-update` 自 1.11.0 起携带 closure,但 `reconstructFromSession` 的回放 patch 一直没把它传给 `applyStatus`:行停在 escalated 时,`status=done` 的改判被「非法闭环迁移 escalated→done」拒绝,整条 update 被裸 catch 吞掉,重启后「待指示」行永久卡死。本版补上 `closure: update.closure`,并把裸 catch 改为 `console.warn` 留痕(fail-closed 而非 fail-silent)。
|
|
19
|
+
|
|
20
|
+
红-绿验证:摘掉修复跑全量 → 651 项中恰好 1 失败(失败点=改判链 escalated→instructed→done→reported 必须完整回放);恢复修复 → 651/651 通过。
|
|
21
|
+
|
|
22
|
+
## 2. 跨部门需求落盘变 `[object Object]`(handoff 序列化)
|
|
23
|
+
|
|
24
|
+
- **现象**:子 Agent 以对象形提出的跨部门需求,入库时被隐式 `String(对象)` 整体转成字面量 `[object Object]`,部门信息一并丢失(实证:主计划 wp-db6de2f0 的 T1–T4 四条需求均为 `request="[object Object]"、department:null`)。
|
|
25
|
+
- **病根**:4 个写坏点(`src/plan.ts` `readEvidenceNeeds` / `mergeHandoffsFromNeeds` / `readEvidenceOptions`,`src/runtime.ts` escalate)。
|
|
26
|
+
- **修复**:全部改为对象感知的受控序列化——对象需求落盘为「部门:需求(用途)」可读文本 + 合法部门键;嵌套/循环引用兜底为循环引用安全、undefined 安全的受控 JSON;字符串路径逐字不变;历史损坏记录加载不抛错、存量逐字段不改写。
|
|
27
|
+
- **验证**:专项回归 **10/10**(对象原文一致 / 嵌套受控 JSON / 循环引用不抛错 / 历史记录不改写 / 幂等 / 全链路);坏模式 `String(item ?? '')` 在 src 与 lib 中 **0 命中**。
|
|
28
|
+
|
|
29
|
+
## 3. 任务自动分解期间界面零提示(进度可见性)
|
|
30
|
+
|
|
31
|
+
- **现象**:发任务后自动分解的几十秒到几分钟里界面毫无反应,分不清「在干活」「在重试」还是「卡死」。取证判定:分解全程插件零 `session.append`、零 `records.set`——侧栏 4 秒轮询与「正在安排」词汇早已存在,只是从未收到数据(断点层=未发出,插件层)。
|
|
32
|
+
- **修复**(零新组件、零新路由、零推送机制):
|
|
33
|
+
1. **进行中**:进入分解先写占位进度卡,侧栏 4 秒轮询内出现「正在安排」+「正在生成任务分解…」;
|
|
34
|
+
2. **重试中**:每次可重试失败,卡片追加「第 N 次尝试失败(原因码):真因;正在重试(约 X 秒后),第 (N+1)/3 次」,聊天通知每轮**至多 2 条**(第 3 次失败直接进降级文案);
|
|
35
|
+
3. **失败带真因**:3 次全败走降级横幅,逐次真因链截断 ≤120 字符、错误码(如 `ECONNREFUSED`)原样保留;
|
|
36
|
+
4. **等信息中**:澄清场景徽标不再回显原始键名 `clarify`(zh「等信息中」/ en "Waiting for info");
|
|
37
|
+
5. **用户中止**:全静默、不残留假「进行中」、不丢上一份终态进度。
|
|
38
|
+
- **验证**:专项回归 **5/5**(抖动重试文案 / 通知频率硬规则 / aborted 静默 / 真因截断 / 词汇键);重试语义零变化(`onProgress` 只读观察点)。
|
|
39
|
+
|
|
40
|
+
## 合并态统一回归(总判定 GO,产品级失败项 = 0)
|
|
41
|
+
|
|
42
|
+
- 产物一致性:构建前后双检哈希 15/15 + 根 client.js 一致;`npm run check` exit 0;
|
|
43
|
+
- 全量套件 **666/666**(= 661 + 5,计数精确吻合);
|
|
44
|
+
- 既有守卫与双向回归不回退:守卫 6/6、抖动正例 8/8 断言、AUTH 反例 4/4、cause 链 3/3、取消传播 3/3、真故障反例 7/7(1564–1678ms,与基线 1.454s 同量级带内)。
|
|
45
|
+
|
|
46
|
+
## 边界与已知事项(如实登记,不包装)
|
|
47
|
+
|
|
48
|
+
- 两项双缺陷修复的**生环境复验**待用户重启后执行(四态:进行中 / 重试中 / 失败带真因 / 等信息中);聊天通知能否在分解等待期间即时上屏属宿主运行态行为(H-1),侧栏卡片(4 秒轮询)为保底通道。
|
|
49
|
+
- wp-db6de2f0 四条历史损坏记录原文已从子会话日志提取留档,**可恢复**;存量数据一字不改。
|
|
50
|
+
- **D-3 未在本版修复**(轮次中途完成只存内存、重启丢当前计划状态):属轮次生命周期改造,建议下版专项处理;缓解:重要节点后不要立刻重启。
|
|
51
|
+
- 宿主侧三项深度改进(cause 透传、maxRetries 可配、直连流重试覆盖)随宿主发版落实;插件侧已前向兼容、不依赖。
|
|
52
|
+
- 2.1.5 → 2.2.6 之间各版的完整变更见 [CHANGELOG.md](CHANGELOG.md)。
|
|
53
|
+
|
|
54
|
+
## 安装
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm install dsh-workplan@2.2.6
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 二、索引源登记内容
|
|
63
|
+
|
|
64
|
+
索引源机制(沿用既有结论):上游索引仓库 `awesome-dsh-plugin`,文件 `data/plugins/abbaababa__dsh-workplan.yml`,仅含 7 个键、无 version/sha256 字段,版本由 `tarball` URL 隐含;上游 catalog 的 npm 包由上游 CI 定时从该仓库生成,提交 PR 不等于 npm 包立即更新。
|
|
65
|
+
|
|
66
|
+
### 2.1 tarball 行更新(本次只改 1 行)
|
|
67
|
+
|
|
68
|
+
旧值:
|
|
69
|
+
|
|
70
|
+
```yaml
|
|
71
|
+
tarball: https://github.com/abbaababa/dsh-workplan/releases/download/v2.1.5/dsh-workplan-2.1.5.tgz
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
新值(版本号与冻结值一致):
|
|
75
|
+
|
|
76
|
+
```yaml
|
|
77
|
+
tarball: https://github.com/abbaababa/dsh-workplan/releases/download/v2.2.6/dsh-workplan-2.2.6.tgz
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 2.2 PR 标题与正文模板
|
|
81
|
+
|
|
82
|
+
标题:
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
Update abbaababa__dsh-workplan to v2.2.6
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
正文:
|
|
89
|
+
|
|
90
|
+
```markdown
|
|
91
|
+
Bump dsh-workplan tarball from v2.1.5 to v2.2.6.
|
|
92
|
+
|
|
93
|
+
Release: https://github.com/abbaababa/dsh-workplan/releases/tag/v2.2.6
|
|
94
|
+
Highlights: replay keeps manual-adjudication closure across restart; cross-department handoff needs serialize as readable text instead of "[object Object]" (department key preserved); progress visibility during automatic task planning (planning card via 4s sidebar poll, retry notices with real cause chain, capped at 2 per round, "Waiting for info" badge).
|
|
95
|
+
No breaking changes.
|
|
96
|
+
Tests: 666/666 passing (`npm test`).
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 2.3 版本短描述(zh / en,供目录与展示用)
|
|
100
|
+
|
|
101
|
+
- zh:修复三项:重启后人工改判不再丢失(closure 回放);跨部门需求落盘不再变 `[object Object]`(可读文本+部门键,历史记录不改写);任务自动分解期间界面有进度(4 秒内侧栏进度卡、重试带真因且每轮至多 2 条通知、澄清徽标显示「等信息中」)。合并态回归 666/666。
|
|
102
|
+
- en: Three fixes: manual-adjudication closure survives restart replay; handoff needs serialize as readable "department: need (purpose)" text with the department key preserved instead of "[object Object]" (legacy broken records load untouched); progress visibility during automatic task planning (planning card via 4s sidebar poll, retry notices with real cause chain capped at 2 per round, "Waiting for info" badge). Merged-state suite 666/666.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 三、自检记录(A1–A3)
|
|
107
|
+
|
|
108
|
+
- **A1 版本号一致**:本文所有版本号均为 **2.2.6**(tag v2.2.6 / npm install dsh-workplan@2.2.6 / tarball URL v2.2.6),与 T2 冻结值一致;对比基准 2.1.5 亦与 T2 三处对照记录一致。自检命令:`grep -n "2\.2\.6\|2\.1\.5" docs/release-records/release-notes-2.2.6-T3.md`(结果见 T3 汇报)。
|
|
109
|
+
- **A2 数字可回指、未新造**:651(D-1 红绿)、10/10(序列化专项)、5/5(可见性专项)、666/666、15/15、6/6、8/8、4/4、3/3、7/7、1564–1678ms、1.454s、≤120 字符、至多 2 条、4 秒轮询、300s 窗口、12 处标记、四条历史记录——逐项出处见下表。
|
|
110
|
+
- **A3 无未经验证的收尾表述**:全文不含任何收尾性定论用语(如宣称发布动作已完成、宣称成品定稿);发布动作状态显式移交 T4–T7;生环境复验明确写为「待用户执行」。
|
|
111
|
+
|
|
112
|
+
### 证据回指表
|
|
113
|
+
|
|
114
|
+
| 文中数字/事实 | 出处 |
|
|
115
|
+
|---|---|
|
|
116
|
+
| 2.2.6 冻结 / 2.1.5 已发布基准 / 6ed12d3 / 12 处标记 / 666 待发布范围 | `docs/release-records/version-freeze-20261109-T2.md` §1–§4 |
|
|
117
|
+
| D-1 651 红绿 / closure 补丁 / console.warn | CHANGELOG.md 2.2.6 条目(既有,本版沿用);tests/runtime-replay.test.ts |
|
|
118
|
+
| `[object Object]` 现象 / W1–W4 点位 / wp-db6de2f0 四条 / 可恢复结论 | `_t1_dualdefect_rootcause_20261108/root-cause-and-boundary-report.md` §2.2/§2.3/§2.5 |
|
|
119
|
+
| 序列化修复点位与改法 / 10/10 / `String(item ?? '')` 0 命中 / `[2.2.6][T4]` 锚点 | `_t4_need_serialization_fix/fix-report.md` §二/§四 |
|
|
120
|
+
| 可见性四态文案 / 频率 ≤2 条 / ≤120 截断 / P-9 clarify / 零新组件 / 4 秒轮询 / 300s 窗口 / 重试语义零变化 | `_t5_visibility_impl_20261108/implementation-notes.md` §一/§二/§三 |
|
|
121
|
+
| 666/666 / 15/15 哈希 / 守卫 6/6 / 抖动 8/8 / AUTH 4/4 / cause 3/3 / 取消 3/3 / 真故障 7/7 / 1564–1678ms / 基线 1.454s / 偏差披露 | `_t6_dualfix_regression_20261108/T6_双修复回归测试报告.md` §一/§四/§五/§六 |
|
|
122
|
+
| 生环境复验四态 / H-1 / 通道 A 保底 / 宿主三项 H2 | `_t7_closure_20261108/结案说明与移交清单.md` §四/§二 |
|
|
123
|
+
| 索引源机制(awesome-dsh-plugin / 7 键 YAML / tarball 隐含版本 / CI 定时) | `_t11_release_20261102/index_entry_v1.11.0.md`(既有机制结论,机制未变) |
|
|
124
|
+
|
|
125
|
+
### 遗留提示(移交,不阻塞文案冻结)
|
|
126
|
+
|
|
127
|
+
- CHANGELOG.md 三处历史条目含本机用户目录绝对路径(T2 敏感初筛发现项::138/:180/:2233 附近),属既有条目,是否随发布提交改写由主 Agent/T4 决定;本 T3 新增文案未引入任何本机绝对路径。
|
|
128
|
+
- GitHub Release 资产名 `dsh-workplan-2.2.6.tgz` 为按既有 tarball 命名惯例(v1.11.0 同构)推导的约定值,实际资产名以 T4 发布脚本/T5 上传为准。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# dsh-workplan 发布流程梳理(T1 交付物)
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> 仓库根:`plugins/dsh-workplan`(相对工作区根;自身含 `.git`,工作区根不是 git 仓库)
|
|
4
4
|
> 当前版本:`2.1.3`(`package.json:3`、`package-lock.json:3,9`、`src/host.ts` 的 `meta.version`、CHANGELOG 顶部 `## 2.1.3 — 2026-11-06`)
|
|
5
5
|
> 本文所有命令均标注来源:RELEASING.md 章节、package.json scripts、.github/workflows/verify.yml,或前期对话(m00001)实测事实。
|
|
6
6
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# 版本与变更基准冻结清单(T2 · 2026-11-09)
|
|
2
|
+
|
|
3
|
+
采集时刻:2026-11-09T13:08+08:00;仓库:`/Users/open/Documents/Stocks/plugins/dsh-workplan`(`git rev-parse --show-toplevel` 确认为仓库根)。
|
|
4
|
+
|
|
5
|
+
## 1. 版本号三处对照(A1)
|
|
6
|
+
|
|
7
|
+
| 口径 | 结果 | 证据 |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| package.json `version` | **2.2.6** | `node -e require('./package.json')` → `dsh-workplan@2.2.6` |
|
|
10
|
+
| 构建产物/源码标记 | **2.2.6** | `src/host.ts:1574` `version: '2.2.6'`;`[2.2.6]` 标记 src 12 处(plan.ts 8 / runtime.ts 3 / understanding.ts 1),lib 对应 plan.js 8 / runtime.js 3 / understanding.js 1,一一对应 |
|
|
11
|
+
| 索引源 & npm 已发布版本 | **2.1.5** | 插件目录索引 `dsh-plugin-catalog/index.json`(unpkg 拉取,目录版本 2026.1109.17642)中 dsh-workplan 仅登记 versions=[2.1.5];npm registry dist-tags.latest=2.1.5 |
|
|
12
|
+
| CHANGELOG 顶部条目 | 2.2.6 — 2026-11-08 | `head CHANGELOG.md` |
|
|
13
|
+
|
|
14
|
+
**冻结结论:本次发布的「最新版本」= 2.2.6**。已发布基准为 2.1.5(tag v2.1.5,commit 6ed12d3),2.1.5 之后全部 2.2.x 内容目前只存在于**未提交的工作区**。
|
|
15
|
+
|
|
16
|
+
## 2. Git 基线与未提交变更(A2)
|
|
17
|
+
|
|
18
|
+
- 分支 `main`,HEAD `6ed12d32af03d22d5024eb1d9fbb1c20a7546781`(= tag v2.1.5 = 已发布基准)。
|
|
19
|
+
- 未提交变更:**30 个已跟踪文件修改 + 23 个未跟踪新文件**,含全部 2.2.x 源码(src/ 与 lib/ 10 组)、CHANGELOG.md、package.json/package-lock.json、13 个新测试、`release.sh`、`docs/release-records/*`、`src/notice-channel.ts` 等。
|
|
20
|
+
- **判定:包含**。版本号 2.2.6 只存在于未提交变更中,不提交则「发布 2.2.6」无从谈起——发布前必须先把这些变更作为 2.2.6 提交(该提交由发布脚本/T4-T5 执行,本清单已将其显式纳入范围,无静默纳入)。
|
|
21
|
+
- 构建产物新鲜度:T2 已执行 `npm run build`,build 后 lib/ 与当前 src 同源(编译成功、产物含 2.2.6 标记);发布脚本构建步骤再次构建即可保持同源。
|
|
22
|
+
- 遗留杂物:未跟踪 `dist-tests-t4/`、`handoff-need-serialization.test.ts`(根目录散件,tests/ 下已有同名)建议发布提交时不纳入或清理,由主 Agent 决定。
|
|
23
|
+
|
|
24
|
+
## 3. 敏感信息初筛(A3)
|
|
25
|
+
|
|
26
|
+
- 密钥类模式(sk-/ghp_/AKIA/api_key/password/token 硬编码)扫描变更范围内文件:**0 命中 → 通过**。
|
|
27
|
+
- 本地绝对路径 `/Users/open`:4 处命中——`CHANGELOG.md:138/180/2233`、`RELEASING.md:61`、`docs/release-records/release-steps-20261106.md:3`、`release.sh:271`(含 W5_ROOT_LOG 默认值)。均为机器路径/日志路径,**非凭证**,泄露面为「暴露本机用户目录结构」,风险低。结论:**通过,附发现项**——建议 T3/T4 在发布文案与脚本中把 `/Users/open/...` 改写为相对路径或 `$(pwd)` 占位;若不处理亦可接受(公开仓库历史中已有同类)。
|
|
28
|
+
- 远端:`origin = git@github.com:abbaababa/dsh-workplan.git`(SSH),与索引源登记的 `github.com/abbaababa/dsh-workplan` 一致。
|
|
29
|
+
|
|
30
|
+
## 4. 待发布内容清单(冻结范围)
|
|
31
|
+
|
|
32
|
+
以「发布提交 = 当前工作区全部变更(30 修改 + 22 有效新文件,剔除 §2 杂物 2 项)」为冻结范围,版本号 2.2.6,构建产物 lib/ + client.js 由发布脚本构建步骤生成。凭证与推送执行属 T1/T4/T5 结论,本清单不预设。
|
|
33
|
+
|
|
34
|
+
## 5. 待确认项(移交)
|
|
35
|
+
|
|
36
|
+
- 索引源提交协议(catalog 是第三方聚合索引,登记机制/是否需 PR 或自动同步 npm)→ T1/T6 结论。
|
|
37
|
+
- GitHub 凭证可用性(SSH key / gh CLI / token)→ T1 核查。
|
package/lib/client.js
CHANGED
|
@@ -69,6 +69,7 @@ window.__ModuleLoader__.load({
|
|
|
69
69
|
"phase": {
|
|
70
70
|
"pending": "还没开始",
|
|
71
71
|
"planning": "正在安排",
|
|
72
|
+
"clarify": "等信息中",
|
|
72
73
|
"executing": "正在做",
|
|
73
74
|
"integrating": "正在收尾",
|
|
74
75
|
"done": "已完成",
|
|
@@ -213,7 +214,27 @@ window.__ModuleLoader__.load({
|
|
|
213
214
|
"vizStageTitle": "分步进度",
|
|
214
215
|
"vizOverall": "总体进度",
|
|
215
216
|
"allPlansHint": "上面是当前各会话最新计划的合计;历史计划不在此汇总,下面每张卡片只统计本计划。",
|
|
216
|
-
"openHint": "打开左侧「任务进度」看完整安排。"
|
|
217
|
+
"openHint": "打开左侧「任务进度」看完整安排。",
|
|
218
|
+
"timeNegotiation": "时长协商",
|
|
219
|
+
"reasoningEffort": "推理等级",
|
|
220
|
+
"estimateMinutes": "预估时长",
|
|
221
|
+
"negotiatedCeiling": "协商上限",
|
|
222
|
+
"derived": "派生",
|
|
223
|
+
"negotiatedDeadline": "协商截止",
|
|
224
|
+
"startedAtLabel": "开始时间",
|
|
225
|
+
"remaining": "剩余",
|
|
226
|
+
"minutes": "分钟",
|
|
227
|
+
"seconds": "秒",
|
|
228
|
+
"timeExtensions": "延期记录",
|
|
229
|
+
"startNotice": "开工预告",
|
|
230
|
+
"timeWarning": "到点预警",
|
|
231
|
+
"pendingAdjudication": "待裁决",
|
|
232
|
+
"pendingAdjudicationHint": "到点后按安全兜底结算:等待主 Agent 决定延期 / 重试 / 接受。",
|
|
233
|
+
"noticeChannel": "预告通道",
|
|
234
|
+
"noticeChannelObserved": "已观测到送达",
|
|
235
|
+
"noticeChannelAwaiting": "等待观测",
|
|
236
|
+
"noticeChannelNotObserved": "未观测到送达",
|
|
237
|
+
"reason": "原因",
|
|
217
238
|
},
|
|
218
239
|
"en": {
|
|
219
240
|
"groupLive": "In progress",
|
|
@@ -266,6 +287,7 @@ window.__ModuleLoader__.load({
|
|
|
266
287
|
"phase": {
|
|
267
288
|
"pending": "Not started",
|
|
268
289
|
"planning": "Planning",
|
|
290
|
+
"clarify": "Waiting for info",
|
|
269
291
|
"executing": "In progress",
|
|
270
292
|
"integrating": "Wrapping up",
|
|
271
293
|
"done": "Done",
|
|
@@ -409,7 +431,27 @@ window.__ModuleLoader__.load({
|
|
|
409
431
|
"vizStageTitle": "Step progress",
|
|
410
432
|
"vizOverall": "Overall progress",
|
|
411
433
|
"allPlansHint": "These totals cover the latest plan in each live session; older plans are not included. Each card below counts only its own plan.",
|
|
412
|
-
"openHint": "Open “Task progress” on the left for the full plan."
|
|
434
|
+
"openHint": "Open “Task progress” on the left for the full plan.",
|
|
435
|
+
"timeNegotiation": "Time negotiation",
|
|
436
|
+
"reasoningEffort": "Reasoning effort",
|
|
437
|
+
"estimateMinutes": "Estimate",
|
|
438
|
+
"negotiatedCeiling": "Negotiated ceiling",
|
|
439
|
+
"derived": "derived",
|
|
440
|
+
"negotiatedDeadline": "Negotiated deadline",
|
|
441
|
+
"startedAtLabel": "Started at",
|
|
442
|
+
"remaining": "remaining",
|
|
443
|
+
"minutes": "min",
|
|
444
|
+
"seconds": "s",
|
|
445
|
+
"timeExtensions": "Extensions",
|
|
446
|
+
"startNotice": "Start notice",
|
|
447
|
+
"timeWarning": "Approaching deadline",
|
|
448
|
+
"pendingAdjudication": "Awaiting decision",
|
|
449
|
+
"pendingAdjudicationHint": "Safety fallback at the deadline: the main agent will decide whether to extend, retry, or accept.",
|
|
450
|
+
"noticeChannel": "Notice channel",
|
|
451
|
+
"noticeChannelObserved": "Delivery observed",
|
|
452
|
+
"noticeChannelAwaiting": "Awaiting observation",
|
|
453
|
+
"noticeChannelNotObserved": "Delivery not observed",
|
|
454
|
+
"reason": "reason",
|
|
413
455
|
}
|
|
414
456
|
};
|
|
415
457
|
function flattenLocale(source, prefix = '', out = {}) {
|
|
@@ -983,6 +1025,12 @@ window.__ModuleLoader__.load({
|
|
|
983
1025
|
.dsh-wp-subtask-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; color: var(--dsw-alias-label-secondary); font-size: 12px; }
|
|
984
1026
|
.dsh-wp-subtask-body { margin-top: 6px; }
|
|
985
1027
|
.dsh-wp-subtask-body > div { margin-top: 4px; }
|
|
1028
|
+
/* [2.2.0][T3/O-2a][O-3b][O-4c] 时长协商信息块:预估 / 协商上限 / 延期 / 开工预告 / 预警 / 通道。
|
|
1029
|
+
只做展示,全部由服务端状态行与计划定义提供;字段缺失时整块不渲染(降级不报错)。 */
|
|
1030
|
+
.dsh-wp-time { margin-top: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--dsw-alias-line-1, rgba(148,163,184,.22)); background: rgba(148,163,184,.06); }
|
|
1031
|
+
.dsh-wp-time-title { font-size: 12px; font-weight: 650; color: var(--dsw-alias-label-secondary, #475569); margin-bottom: 4px; }
|
|
1032
|
+
.dsh-wp-time-row { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--dsw-alias-label-primary, #0f172a); font-variant-numeric: tabular-nums; }
|
|
1033
|
+
.dsh-wp-time-note { margin: 4px 0 0; font-size: 12px; color: var(--dsw-alias-label-secondary, #475569); overflow-wrap: anywhere; }
|
|
986
1034
|
.dsh-wp-subtask-body p { margin-top: 2px; overflow-wrap: anywhere; }
|
|
987
1035
|
.dsh-wp-error-text { color: var(--dsw-alias-state-error-primary); overflow-wrap: anywhere; }
|
|
988
1036
|
.dsh-wp-muted { color: var(--dsw-alias-label-secondary); }
|
|
@@ -1111,6 +1159,11 @@ window.__ModuleLoader__.load({
|
|
|
1111
1159
|
const number = Number(value);
|
|
1112
1160
|
return Number.isFinite(number) ? Math.max(0, Math.min(100, Math.round(number))) : 0;
|
|
1113
1161
|
}
|
|
1162
|
+
/** 只接受有限正数;0/NaN/负数一律视为「没有这个字段」,用于展示层降级。 */
|
|
1163
|
+
function positiveNumber(value) {
|
|
1164
|
+
const number = Number(value);
|
|
1165
|
+
return Number.isFinite(number) && number > 0 ? number : null;
|
|
1166
|
+
}
|
|
1114
1167
|
function formatTime(value) {
|
|
1115
1168
|
if (!value)
|
|
1116
1169
|
return '';
|
|
@@ -1487,6 +1540,90 @@ window.__ModuleLoader__.load({
|
|
|
1487
1540
|
function ErrorBanner({ message, onRetry, t }) {
|
|
1488
1541
|
return h('div', { className: 'dsh-wp-banner dsh-wp-banner--error', role: 'alert' }, h('div', { className: 'dsh-wp-section-title' }, t('error')), h('div', { className: 'dsh-wp-error-text' }, message || t('noResult')), h('button', { type: 'button', className: 'dsh-wp-button', style: { marginTop: '8px' }, onClick: onRetry }, t('retry')));
|
|
1489
1542
|
}
|
|
1543
|
+
/*
|
|
1544
|
+
* [2.2.0][T3/O-2a][O-3b][O-4c] 看板:时长协商信息(T1 台账 A2 的可见入口)。
|
|
1545
|
+
*
|
|
1546
|
+
* 只展示服务端已经下发的计划字段与状态行字段:
|
|
1547
|
+
* - 计划定义:estimateMinutes(预估)、timeoutMs(协商上限)、reasoningEffort(推理等级);
|
|
1548
|
+
* - 状态行:startedAt/deadlineAt(协商截止)、timeJournal(延期/预告历史)、
|
|
1549
|
+
* timeNotice(开工预告)、timeWarning(到点预警)、noticeChannel(子→主通道是否送达)、
|
|
1550
|
+
* pendingAdjudication(到点后的待裁决标记)。
|
|
1551
|
+
*
|
|
1552
|
+
* 客户端不推导状态机、不补造字段:任何字段缺失就少显示一行;全部缺失整块不渲染,
|
|
1553
|
+
* 绝不出现 undefined / [object Object]。
|
|
1554
|
+
*/
|
|
1555
|
+
function TimeNegotiation({ item, subtask, t }) {
|
|
1556
|
+
const estimate = positiveNumber(subtask?.estimateMinutes);
|
|
1557
|
+
const deadlineAt = positiveNumber(item?.deadlineAt);
|
|
1558
|
+
const startedAt = positiveNumber(item?.startedAt);
|
|
1559
|
+
const journal = Array.isArray(item?.timeJournal) ? item.timeJournal : [];
|
|
1560
|
+
const extensions = journal
|
|
1561
|
+
.filter((entry) => entry?.action === 'extend' && positiveNumber(entry?.extendMs))
|
|
1562
|
+
.slice(-3);
|
|
1563
|
+
/*
|
|
1564
|
+
* [2.2.3][N2] D2「协商上限」结构性不可达:计划里没有 timeoutMs 时,
|
|
1565
|
+
* 用 deadlineAt - startedAt - 已延期 派生一个只读上限,明确标注“派生”,
|
|
1566
|
+
* 不写回计划、不把派生值冒充用户授权值。
|
|
1567
|
+
*/
|
|
1568
|
+
const extensionTotal = extensions.reduce((sum, entry) => sum + Number(positiveNumber(entry?.extendMs) ?? 0), 0);
|
|
1569
|
+
const declaredCeiling = positiveNumber(subtask?.timeoutMs);
|
|
1570
|
+
const derivedCeiling = !declaredCeiling && startedAt && deadlineAt
|
|
1571
|
+
? Math.max(0, deadlineAt - startedAt - extensionTotal)
|
|
1572
|
+
: null;
|
|
1573
|
+
const ceiling = declaredCeiling ?? derivedCeiling;
|
|
1574
|
+
const ceilingLabel = declaredCeiling ? t('negotiatedCeiling') : `${t('negotiatedCeiling')}(${t('derived')})`;
|
|
1575
|
+
const notice = item?.timeNotice && typeof item.timeNotice === 'object' ? item.timeNotice : null;
|
|
1576
|
+
const warning = item?.timeWarning && typeof item.timeWarning === 'object' ? item.timeWarning : null;
|
|
1577
|
+
const channel = item?.noticeChannel && typeof item.noticeChannel === 'object' ? item.noticeChannel : null;
|
|
1578
|
+
const pending = item?.pendingAdjudication === true;
|
|
1579
|
+
if (!estimate && !ceiling && !deadlineAt && !notice && !warning && !channel && !pending && extensions.length === 0) {
|
|
1580
|
+
return null;
|
|
1581
|
+
}
|
|
1582
|
+
const remainingMs = deadlineAt ? Math.max(0, deadlineAt - Date.now()) : null;
|
|
1583
|
+
const facts = [];
|
|
1584
|
+
if (estimate)
|
|
1585
|
+
facts.push(`${t('estimateMinutes')}:${estimate} ${t('minutes')}`);
|
|
1586
|
+
if (ceiling)
|
|
1587
|
+
facts.push(`${ceilingLabel}:${Math.round(ceiling / 60000)} ${t('minutes')}`);
|
|
1588
|
+
if (deadlineAt) {
|
|
1589
|
+
const left = remainingMs && remainingMs > 0
|
|
1590
|
+
? `(${t('remaining')} ${Math.max(1, Math.round(remainingMs / 60000))} ${t('minutes')})`
|
|
1591
|
+
: '';
|
|
1592
|
+
facts.push(`${t('negotiatedDeadline')}:${formatTime(deadlineAt)}${left}`);
|
|
1593
|
+
}
|
|
1594
|
+
const notes = [];
|
|
1595
|
+
if (notice) {
|
|
1596
|
+
const declared = positiveNumber(notice.declaredMinutes);
|
|
1597
|
+
const reason = typeof notice.reason === 'string' && notice.reason
|
|
1598
|
+
? `(${t('reason')}:${notice.reason.slice(0, 80)})`
|
|
1599
|
+
: '';
|
|
1600
|
+
notes.push(declared
|
|
1601
|
+
? `${t('startNotice')}:${declared} ${t('minutes')}${reason}`
|
|
1602
|
+
: `${t('startNotice')}${reason}`);
|
|
1603
|
+
}
|
|
1604
|
+
if (extensions.length > 0) {
|
|
1605
|
+
notes.push(`${t('timeExtensions')}:${extensions.map((entry) => `+${Math.round(Number(entry.extendMs) / 60000)} ${t('minutes')}`).join(';')}`);
|
|
1606
|
+
}
|
|
1607
|
+
if (warning) {
|
|
1608
|
+
const remaining = positiveNumber(warning.remainingMs);
|
|
1609
|
+
notes.push(`${t('timeWarning')}:${remaining
|
|
1610
|
+
? `${t('remaining')} ${Math.round(remaining / 1000)} ${t('seconds')}`
|
|
1611
|
+
: t('pendingAdjudication')}`);
|
|
1612
|
+
}
|
|
1613
|
+
if (channel) {
|
|
1614
|
+
const stateText = channel.state === 'observed' ? t('noticeChannelObserved')
|
|
1615
|
+
: channel.state === 'awaiting' ? t('noticeChannelAwaiting') : t('noticeChannelNotObserved');
|
|
1616
|
+
const reason = typeof channel.reason === 'string' && channel.reason
|
|
1617
|
+
? `(${t('reason')}:${channel.reason})`
|
|
1618
|
+
: '';
|
|
1619
|
+
notes.push(`${t('noticeChannel')}:${stateText}${reason}`);
|
|
1620
|
+
}
|
|
1621
|
+
if (pending)
|
|
1622
|
+
notes.push(`${t('pendingAdjudication')}:${t('pendingAdjudicationHint')}`);
|
|
1623
|
+
return h('div', { className: 'dsh-wp-time' }, h('div', { className: 'dsh-wp-time-title' }, t('timeNegotiation')), facts.length > 0
|
|
1624
|
+
? h('div', { className: 'dsh-wp-time-row' }, facts.map((fact, factIndex) => h('span', { key: String(factIndex) }, fact)))
|
|
1625
|
+
: null, notes.map((note, noteIndex) => h('p', { key: String(noteIndex), className: 'dsh-wp-time-note' }, note)));
|
|
1626
|
+
}
|
|
1490
1627
|
function SubtaskRow({ item, subtask, index, t }) {
|
|
1491
1628
|
const status = item?.status ?? 'pending';
|
|
1492
1629
|
/*
|
|
@@ -1537,7 +1674,15 @@ window.__ModuleLoader__.load({
|
|
|
1537
1674
|
const instructionOverdue = item?.instructionOverdue === true;
|
|
1538
1675
|
const tone = closure === 'replanned' ? 'idle' : toneOfStatus(status);
|
|
1539
1676
|
const pct = clampPct(item?.progress ?? 0);
|
|
1540
|
-
|
|
1677
|
+
/*
|
|
1678
|
+
* [2.2.7][T2/五档] UI Pill 白名单:与 plan.ts 的 REASONING_EFFORTS
|
|
1679
|
+
* (low / medium / high / xhigh / max)逐值同步。浏览器包无法 import
|
|
1680
|
+
* 宿主常量,此处为唯二事实源之一——漏改会让新档位在任务卡片上静默消失。
|
|
1681
|
+
*/
|
|
1682
|
+
const effort = typeof subtask?.reasoningEffort === 'string' && ['low', 'medium', 'high', 'xhigh', 'max'].includes(subtask.reasoningEffort)
|
|
1683
|
+
? subtask.reasoningEffort
|
|
1684
|
+
: null;
|
|
1685
|
+
return h('div', { className: `dsh-wp-subtask dsh-wp-tone-${tone}` }, h('div', { className: 'dsh-wp-subtask-head' }, h('div', { className: 'dsh-wp-subtask-title' }, `${workLabel(t, index)}:${subtask.title}`), closureLabel ? h(Pill, { tone: closureTone }, closureLabel) : null, instructionOverdue ? h(Pill, { tone: 'blocked' }, t('closureNoAck')) : null, h(Pill, { tone }, progressText(item, t))), h('div', { className: 'dsh-wp-subtask-meta' }, h('span', null, `${t('who')}:${deptName(t, subtask.department)} · ${subtask.role}`), effort ? h(Pill, { tone: 'idle' }, `${t('reasoningEffort')}:${effort}`) : null), h('div', { className: 'dsh-wp-subtask-body' }, h('p', null, h('strong', null, `${t('what')}:`), subtask.objective), h('div', null, h('strong', null, `${t('how')}:`), h(Bullets, { items: subtask.method })), h('div', null, h('strong', null, `${t('doneWhen')}:`), h(Bullets, { items: subtask.acceptance })), subtask.outputs?.length ? h('div', null, h('strong', null, `${t('willDeliver')}:`), h(Bullets, { items: subtask.outputs })) : null, subtask.dependsOn?.length ? h('p', { className: 'dsh-wp-muted' }, `${t('waitFor')}:先等前面的工作做完,才能开始这一步。`) : null), h(TimeNegotiation, { item, subtask, t }), status === 'in_progress' ? h(Progress, { value: pct, tone }) : null, status === 'in_progress' ? h('div', { className: 'dsh-wp-progress-meta' }, h('span', null, `${t('progressLabel')} ${pct}%`)) : null,
|
|
1541
1686
|
/*
|
|
1542
1687
|
* [1.11.0] 跨部门需求(用户 m00687):提出方、指派对象、答复都必须在
|
|
1543
1688
|
* 进度栏可见。否则用户只能从结果消息的一段文字里猜「这条需求谁在办、
|
package/lib/comm-format.js
CHANGED
|
@@ -54,6 +54,23 @@ export const COMM_FORMAT_SPEC = Object.freeze({
|
|
|
54
54
|
description: '不得编造、虚构或伪造任何证据、文件路径、命令输出或验收结果;无法确认的项目必须写 unverified',
|
|
55
55
|
rationale: '虚假证据一旦通过交付门禁,用户拿到的就是不可信的成品' }),
|
|
56
56
|
]),
|
|
57
|
+
/*
|
|
58
|
+
* [2.2.0][T3/O-2c] 结果块可选字段(方案 §2.4:「模板增加 timeSpentMinutes、
|
|
59
|
+
* finalEstimateMinutes 字段」;方案 §2.5:「时间字段纯 advisory:不参与可
|
|
60
|
+
* 交付判定,不加拒绝码」)。
|
|
61
|
+
*
|
|
62
|
+
* 纯增量:不属于 F1-F9 门禁条目(requirements 冻结不动、版本号不升),
|
|
63
|
+
* 缺失或不合法一律不判不合规——仅供用时回填与协商审计,adjudicateResult
|
|
64
|
+
* 以 readAdvisoryMinutes 透传。
|
|
65
|
+
*/
|
|
66
|
+
optionalFields: Object.freeze([
|
|
67
|
+
Object.freeze({ name: 'timeSpentMinutes', type: 'integer', unit: '分钟', required: false,
|
|
68
|
+
description: '实际耗时回填(完成即回报时如实填写;未知可省略)',
|
|
69
|
+
semantics: 'advisory:不参与可交付判定,缺失/非法不判不合规' }),
|
|
70
|
+
Object.freeze({ name: 'finalEstimateMinutes', type: 'integer', unit: '分钟', required: false,
|
|
71
|
+
description: '最终预估回填(与开工前预告不一致时以此为准,用于协商审计)',
|
|
72
|
+
semantics: 'advisory:不参与可交付判定,缺失/非法不判不合规' }),
|
|
73
|
+
]),
|
|
57
74
|
});
|
|
58
75
|
/**
|
|
59
76
|
* 对子 Agent 的证据块执行沟通交流格式合规检查(F1-F8 自动核验;F9 为诚信约束不自动判)。
|
package/lib/host.js
CHANGED
|
@@ -102,7 +102,13 @@ const PROMPT_SECTION = [
|
|
|
102
102
|
*/
|
|
103
103
|
'5. 「完成」只有一个判据:计划里全部子任务都是 done,**且** deliveryReady=true(每个 done 项 verification="structured"、acceptance 非空且逐项 result="pass"、无缺失产物)。用户取消 ≠ 完成:取消只停止执行,未完成项仍然是未完成。`dsh_workplan_dispatch` 返回 ok:true / complete:true 只表示调用成功或状态全 done,必须再看 deliveryReady 与 完成 X/Y;只要 deliveryReady=false 或还有 pending/blocked,就禁止 present 交付物、禁止写“已完成/最终版/已交付”、禁止给收尾性最终答复,必须先再次调用 dsh_workplan_dispatch 续跑剩余项。',
|
|
104
104
|
'6. 如果续跑被拒绝、受阻项无法恢复、证据补不齐、计划已取消但未完成,或用户要求先看中间结果:答复开头必须写「未完成:剩余 N 项(列出 ID)与原因」,正文只能按中间结果表述,不得包装成成品。取消不会给你交付许可。',
|
|
105
|
-
|
|
105
|
+
/*
|
|
106
|
+
* [2.2.0][T5/O-5a] E1:超时是安全兜底(防止任务无限运行),不是交付期限。
|
|
107
|
+
* 旧句把「每步 15 分钟」的规模参考写成硬性上限,等于对外承诺固定完成时间;
|
|
108
|
+
* 改为「协商上限+安全兜底」,并给出 extendMs 协商入口。安全概念与事故溯源
|
|
109
|
+
* (上方 1.8.7/1.8.13 注释)全部保留,不删。
|
|
110
|
+
*/
|
|
111
|
+
'7. 子任务的时间是「协商上限」+「安全兜底」,不是固定交付期限:规模参考 15 分钟量级(仅供参考、非承诺,实际时长由执行专家开工预告协商决定),整轮预算(默认 20 分钟)同样只是安全兜底,不是交付期限。子 Agent 接近上限时应先把已完成内容落盘并在结论里列出路径。任何「达到协商上限」「本轮预算用尽」都不等于「什么都没做」:状态里的 error 会列出「声明产物已在盘上」,必须先用文件核对;若产物已覆盖验收标准,用 dsh_workplan_update 复核改判,只补缺失部分再续跑,禁止无视盘上产物把整步重跑。确认需要更多时间时,主 Agent 可用 dsh_workplan_update 的 extendMs 协商放宽(放宽永远有界:累计超过初始协商上限的一倍即拒绝,转新轮续跑或转 escalate 请主 Agent/用户裁决)。',
|
|
106
112
|
'8. 出现「待指示」项(closure=escalated,左侧栏显示「待指示」并附问题摘录)时,必须在当轮处理:用 dsh_workplan_instruct 下发决定(投递到子会话并把该行恢复为执行中),或确认放弃后用 dsh_workplan_update 置 blocked。不要沉默略过,也不要把待指示当成普通失败——它是一条还没被回答的请示,会一直占着交付门禁。',
|
|
107
113
|
'9. 出现「已下发未响应」(ackOverdue)时,不要重复派发:先用 dsh_workplan_status 看该行 childId 与已等待时长,必要时用 dsh_workplan_followup 投递一次说明;超过硬超时仍未响应会记为 blocked(blockedKind=no-ack),可以再下发指示复活。',
|
|
108
114
|
/*
|
|
@@ -164,6 +170,7 @@ function createUpdateTool(runtime) {
|
|
|
164
170
|
+ '当主 Agent 核对子任务结果、发现完成不实或需要修正时使用。'
|
|
165
171
|
+ '把子任务标成 done 时,必须同时给出真实的 verification 与 acceptance(每项 result="pass"),'
|
|
166
172
|
+ '否则计划不会变成可交付状态(deliveryReady=false,present 会被拒绝)。'
|
|
173
|
+
+ '运行中的子任务需要更多时间时,传 extendMs(毫秒)即可协商放宽,不需要 force;放宽永远有界(累计 ≤ 初始协商上限 × 1),超出转新轮续跑或转 escalate 请主 Agent 裁决。'
|
|
167
174
|
+ '这些字段会写入会话日志,刷新/重启后仍然生效。',
|
|
168
175
|
parameters: {
|
|
169
176
|
type: 'object',
|
|
@@ -179,7 +186,7 @@ function createUpdateTool(runtime) {
|
|
|
179
186
|
status: {
|
|
180
187
|
type: 'string',
|
|
181
188
|
enum: ['pending', 'in_progress', 'done', 'blocked'],
|
|
182
|
-
description: '
|
|
189
|
+
description: '新的状态(普通改判必填;仅协商时限时可省略,改传 extendMs / timeNotice)。',
|
|
183
190
|
},
|
|
184
191
|
progress: {
|
|
185
192
|
type: 'integer',
|
|
@@ -253,8 +260,40 @@ function createUpdateTool(runtime) {
|
|
|
253
260
|
description: '待指示项(closure=escalated)的答复文本:与 status="in_progress" 一起使用,'
|
|
254
261
|
+ '会投递给子会话并把该行恢复为执行中。等价于 dsh_workplan_instruct。',
|
|
255
262
|
},
|
|
263
|
+
/*
|
|
264
|
+
* [2.2.0][T5/O-4c] 延期事务(方案 §2.2 / §5.4;D-28 教训:runtime 会读取的
|
|
265
|
+
* 字段必须在这里显式声明,additionalProperties:false 会让未声明参数被严格
|
|
266
|
+
* 宿主直接拒收)。extendMs 只推移协商截止并重置计时,不改状态判定,运行中
|
|
267
|
+
* 无需 force(TASK_RUNNING 的唯一豁免);放宽永远有界(累计 ≤ 初始协商
|
|
268
|
+
* 上限 × 1),超出由 runtime 拒绝并转「请主 Agent 裁决」。
|
|
269
|
+
*/
|
|
270
|
+
extendMs: {
|
|
271
|
+
type: 'integer',
|
|
272
|
+
description: '延期毫秒数(正整数,仅主 Agent 可用):只推移本子任务的协商截止并重置计时,'
|
|
273
|
+
+ '不改状态判定;运行中可用,不需要 force。除非另传 status,否则可省略 status。'
|
|
274
|
+
+ '放宽永远有界:累计延期 ≤ 初始协商上限的一倍,超出会被拒绝并提示转新轮续跑或转 escalate 请主 Agent 裁决。',
|
|
275
|
+
},
|
|
276
|
+
/*
|
|
277
|
+
* [2.2.0][T5/O-4c] O-2a 专家开工预告:{declaredMinutes, reason}。与 extendMs
|
|
278
|
+
* 同属「只记录、不改判定」的时限信息,运行中同样放行。
|
|
279
|
+
*/
|
|
280
|
+
timeNotice: {
|
|
281
|
+
type: 'object',
|
|
282
|
+
description: '专家开工预告(O-2a):{ declaredMinutes, reason },只记入协商流水,不改状态与判定。',
|
|
283
|
+
properties: {
|
|
284
|
+
declaredMinutes: { type: 'number', description: '预计完成本子任务的分钟数(仅供参考、非承诺)。' },
|
|
285
|
+
reason: { type: 'string', description: '预告理由(可选)。' },
|
|
286
|
+
},
|
|
287
|
+
required: ['declaredMinutes'],
|
|
288
|
+
additionalProperties: false,
|
|
289
|
+
},
|
|
256
290
|
},
|
|
257
|
-
|
|
291
|
+
/*
|
|
292
|
+
* [2.2.0][T5/O-4c] status 不再是无条件必填:纯延期/纯预告事务(只带
|
|
293
|
+
* extendMs / timeNotice)是合法调用,runtime 会按「不改判定只改时限/记录」
|
|
294
|
+
* 处理;普通改判缺 status 仍由 runtime 以 INVALID_STATUS 拒绝。
|
|
295
|
+
*/
|
|
296
|
+
required: ['subtaskId'],
|
|
258
297
|
additionalProperties: false,
|
|
259
298
|
},
|
|
260
299
|
output: {
|
|
@@ -1015,14 +1054,49 @@ function createStatusTool(runtime) {
|
|
|
1015
1054
|
+ (identity ? `(${identity})` : ''));
|
|
1016
1055
|
}
|
|
1017
1056
|
const running = result.running === true;
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1057
|
+
const planner = isRecord(result.planner) ? result.planner : null;
|
|
1058
|
+
const statuses = Array.isArray(result.statuses) ? result.statuses : [];
|
|
1059
|
+
/*
|
|
1060
|
+
* [2.2.3][N1] 模型可见面补齐:planner 与 noticeChannel 之前只进结构化
|
|
1061
|
+
* value,DSH 只把 render 文本写进对话,导致 D5/D1-b 结构性不可读。
|
|
1062
|
+
* 这里只做只读展示,不改变状态机;缺失字段不编造。
|
|
1063
|
+
*/
|
|
1064
|
+
const plannerLine = planner
|
|
1065
|
+
? `规划器:推理等级 ${String(planner.reasoningEffort ?? '未记录')}`
|
|
1066
|
+
+ `|来源 ${String(planner.reasoningEffortSource ?? '未记录')}`
|
|
1067
|
+
+ `|判定 ${String(planner.outcome ?? '未记录')}`
|
|
1068
|
+
+ (typeof planner.model === 'string' && planner.model ? `|模型 ${planner.model}` : '')
|
|
1069
|
+
: '';
|
|
1070
|
+
const channelLines = statuses
|
|
1071
|
+
.filter((item) => isRecord(item?.noticeChannel))
|
|
1072
|
+
.slice(0, 12)
|
|
1073
|
+
.map((item) => {
|
|
1074
|
+
const channel = item.noticeChannel;
|
|
1075
|
+
const at = Number(channel.at) > 0
|
|
1076
|
+
? new Date(Number(channel.at)).toLocaleString('zh-CN', { hour12: false })
|
|
1077
|
+
: '—';
|
|
1078
|
+
const observedAt = Number(channel.observedAt) > 0
|
|
1079
|
+
? new Date(Number(channel.observedAt)).toLocaleString('zh-CN', { hour12: false })
|
|
1080
|
+
: '—';
|
|
1081
|
+
return `${String(item.subtaskId ?? '')} 通道:${String(channel.state ?? '')}`
|
|
1082
|
+
+ `|target ${String(channel.target ?? '—')}`
|
|
1083
|
+
+ `|caller ${String(channel.caller ?? '—')}`
|
|
1084
|
+
+ `|at ${at}`
|
|
1085
|
+
+ `|observedAt ${observedAt}`
|
|
1086
|
+
+ `|reason ${String(channel.reason ?? '—')}`;
|
|
1087
|
+
});
|
|
1088
|
+
return textContent([
|
|
1089
|
+
`计划 ${String(result.planId ?? '')}|${running ? '执行中' : '未在执行'}`
|
|
1090
|
+
+ `|阶段:${phaseLabel(result.phase)}`
|
|
1091
|
+
+ `|完成 ${Number(stats.done ?? 0)}/${Number(stats.total ?? 0)},受阻 ${Number(stats.blocked ?? 0)}`
|
|
1092
|
+
+ `|${result.deliveryReady === true ? '可交付' : '未就绪'}`
|
|
1093
|
+
+ (running && Number(result.elapsedMs ?? 0) > 0
|
|
1094
|
+
? `|已 ${Math.round(Number(result.elapsedMs) / 1000)}s`
|
|
1095
|
+
: '')
|
|
1096
|
+
+ (identity ? `|${identity}` : ''),
|
|
1097
|
+
plannerLine,
|
|
1098
|
+
...channelLines,
|
|
1099
|
+
].filter(Boolean).join('\n'));
|
|
1026
1100
|
},
|
|
1027
1101
|
},
|
|
1028
1102
|
async execute(args, exec) {
|
|
@@ -1113,7 +1187,9 @@ function createDispatchTool(runtime) {
|
|
|
1113
1187
|
* call is killed while the dispatcher is still legitimately working and the
|
|
1114
1188
|
* plan looks stuck. Derive it from the resolved limits.
|
|
1115
1189
|
*/
|
|
1116
|
-
timeoutMs: Number(runtime?.limits?.totalTimeoutMs ??
|
|
1190
|
+
timeoutMs: Number(runtime?.limits?.totalTimeoutMs ?? 0) > 0
|
|
1191
|
+
? Number(runtime.limits.totalTimeoutMs) + 20000
|
|
1192
|
+
: 24 * 60 * 60 * 1000,
|
|
1117
1193
|
async execute(args, exec) {
|
|
1118
1194
|
const parsed = asObject(args) ?? {};
|
|
1119
1195
|
return runtime.dispatchTool(exec.agent, parsed, exec.signal);
|
|
@@ -1185,17 +1261,18 @@ function booleanSetting(configValue, envName) {
|
|
|
1185
1261
|
function settingEnv(envName) {
|
|
1186
1262
|
return typeof process !== 'undefined' ? process.env?.[envName] : undefined;
|
|
1187
1263
|
}
|
|
1188
|
-
function numericSetting(configValue, envName) {
|
|
1264
|
+
function numericSetting(configValue, envName, allowZero = false) {
|
|
1265
|
+
const positive = (value) => Number.isFinite(value) && (allowZero ? value >= 0 : value > 0);
|
|
1189
1266
|
if (configValue !== undefined && configValue !== null && configValue !== '') {
|
|
1190
1267
|
const numeric = Number(configValue);
|
|
1191
|
-
if (
|
|
1268
|
+
if (positive(numeric))
|
|
1192
1269
|
return numeric;
|
|
1193
1270
|
}
|
|
1194
1271
|
const raw = typeof process !== 'undefined' ? process.env?.[envName] : undefined;
|
|
1195
1272
|
if (raw === undefined || raw === '')
|
|
1196
1273
|
return undefined;
|
|
1197
1274
|
const numeric = Number(raw);
|
|
1198
|
-
return
|
|
1275
|
+
return positive(numeric) ? numeric : undefined;
|
|
1199
1276
|
}
|
|
1200
1277
|
/**
|
|
1201
1278
|
* Hard, tool-level guards. Kept as a pure function so the contracts can be
|
|
@@ -1230,9 +1307,10 @@ export function apply(ctx, config = {}) {
|
|
|
1230
1307
|
},
|
|
1231
1308
|
cwd: typeof config.cwd === 'string' ? config.cwd : undefined,
|
|
1232
1309
|
plannerTimeoutMs: numericSetting(config.plannerTimeoutMs, 'DSH_WORKPLAN_PLANNER_TIMEOUT_MS'),
|
|
1310
|
+
plannerIdleTimeoutMs: numericSetting(config.plannerIdleTimeoutMs, 'DSH_WORKPLAN_PLANNER_IDLE_TIMEOUT_MS'),
|
|
1233
1311
|
childTimeoutMs: numericSetting(config.childTimeoutMs, 'DSH_WORKPLAN_CHILD_TIMEOUT_MS'),
|
|
1234
1312
|
idleTimeoutMs: numericSetting(config.idleTimeoutMs, 'DSH_WORKPLAN_IDLE_TIMEOUT_MS'),
|
|
1235
|
-
totalTimeoutMs: numericSetting(config.totalTimeoutMs, 'DSH_WORKPLAN_TOTAL_TIMEOUT_MS'),
|
|
1313
|
+
totalTimeoutMs: numericSetting(config.totalTimeoutMs, 'DSH_WORKPLAN_TOTAL_TIMEOUT_MS', true),
|
|
1236
1314
|
maxResumes: numericSetting(config.maxResumes, 'DSH_WORKPLAN_MAX_RESUMES'),
|
|
1237
1315
|
/*
|
|
1238
1316
|
* [1.10.6] 三态解析:显式配置 > 显式环境变量 > 默认开启。
|
|
@@ -1364,7 +1442,7 @@ export function apply(ctx, config = {}) {
|
|
|
1364
1442
|
}
|
|
1365
1443
|
export const meta = {
|
|
1366
1444
|
name,
|
|
1367
|
-
version: '2.
|
|
1445
|
+
version: '2.2.7',
|
|
1368
1446
|
promptOrder: PROMPT_ORDER,
|
|
1369
1447
|
routes: ['/dsh-workplan/plans', '/dsh-workplan/vendor/chart.umd.js'],
|
|
1370
1448
|
};
|