doukui 0.0.0-stage → 0.3.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/LICENSE +21 -0
- package/README.en.md +42 -0
- package/README.md +147 -2
- package/bin/commands/build.js +178 -0
- package/bin/commands/config.js +88 -0
- package/bin/commands/help.js +83 -0
- package/bin/commands/init.js +194 -0
- package/bin/commands/install.js +202 -0
- package/bin/commands/interactive.js +352 -0
- package/bin/commands/list.js +108 -0
- package/bin/commands/loop-server.js +357 -0
- package/bin/commands/loop.js +1398 -0
- package/bin/commands/migrate.js +120 -0
- package/bin/commands/setup-global.js +81 -0
- package/bin/commands/status.js +140 -0
- package/bin/commands/team-cleanup.js +190 -0
- package/bin/commands/validate-config.js +35 -0
- package/bin/commands/validate.js +21 -0
- package/bin/commands/version.js +22 -0
- package/bin/context.js +143 -0
- package/bin/doukui.js +216 -0
- package/package.json +47 -4
- package/plugins/contracts/capabilities.js +268 -0
- package/plugins/contracts/checkresult-schema.json +75 -0
- package/plugins/contracts/config-schema.json +179 -0
- package/plugins/contracts/plugin-interface.js +262 -0
- package/plugins/contracts/plugin-schema.json +104 -0
- package/plugins/core/hook-session-start/index.js +281 -0
- package/plugins/core/hook-session-start/plugin.json +7 -0
- package/plugins/core/hook-skill-gate/index.js +661 -0
- package/plugins/core/hook-skill-gate/plugin.json +12 -0
- package/plugins/core/provider-loop-engine/index.js +1397 -0
- package/plugins/core/provider-loop-engine/plugin.json +15 -0
- package/plugins/core/provider-memory-store/index.js +510 -0
- package/plugins/core/provider-memory-store/plugin.json +9 -0
- package/plugins/core/provider-role-registry/index.js +376 -0
- package/plugins/core/provider-role-registry/plugin.json +9 -0
- package/plugins/core/provider-state-store/index.js +244 -0
- package/plugins/core/provider-state-store/plugin.json +9 -0
- package/plugins/core/provider-watchdog/assets/daemon-config.template.json +32 -0
- package/plugins/core/provider-watchdog/assets/lib/watchdog-multi-window.js +676 -0
- package/plugins/core/provider-watchdog/assets/watchdog.js +754 -0
- package/plugins/core/provider-watchdog/index.js +151 -0
- package/plugins/core/provider-watchdog/plugin.json +13 -0
- package/plugins/core/skill-agent-dispatcher/cleanup-reference.md +214 -0
- package/plugins/core/skill-agent-dispatcher/daemon-helpers-reference.md +249 -0
- package/plugins/core/skill-agent-dispatcher/plugin.json +13 -0
- package/plugins/core/skill-agent-dispatcher/roles-reference.md +253 -0
- package/plugins/core/skill-agent-dispatcher/skill.md +1291 -0
- package/plugins/core/skill-agentic-loop/plugin.json +20 -0
- package/plugins/core/skill-agentic-loop/skill.md +572 -0
- package/plugins/core/skill-batch-task-creator/plugin.json +15 -0
- package/plugins/core/skill-batch-task-creator/skill.md +620 -0
- package/plugins/core/skill-checklist/plugin.json +10 -0
- package/plugins/core/skill-checklist/skill.md +171 -0
- package/plugins/core/skill-completion-report/plugin.json +10 -0
- package/plugins/core/skill-completion-report/skill.md +331 -0
- package/plugins/core/skill-doukui-plan/plugin.json +15 -0
- package/plugins/core/skill-doukui-plan/skill.md +233 -0
- package/plugins/core/skill-doukui-sync/plugin.json +10 -0
- package/plugins/core/skill-doukui-sync/skill.md +76 -0
- package/plugins/core/skill-experience-logger/plugin.json +10 -0
- package/plugins/core/skill-experience-logger/skill.md +235 -0
- package/plugins/core/skill-human-checkpoint/plugin.json +10 -0
- package/plugins/core/skill-human-checkpoint/skill.md +194 -0
- package/plugins/core/skill-progress-tracker/plugin.json +10 -0
- package/plugins/core/skill-progress-tracker/skill.md +228 -0
- package/plugins/core/skill-role-manager/plugin.json +10 -0
- package/plugins/core/skill-role-manager/skill.md +252 -0
- package/plugins/core/skill-split-work-package/plugin.json +15 -0
- package/plugins/core/skill-split-work-package/skill.md +441 -0
- package/plugins/core/skill-task-archive/plugin.json +10 -0
- package/plugins/core/skill-task-archive/skill.md +116 -0
- package/plugins/core/skill-task-creator/plugin.json +15 -0
- package/plugins/core/skill-task-creator/skill.md +886 -0
- package/plugins/core/skill-team-cleanup/plugin.json +10 -0
- package/plugins/core/skill-team-cleanup/skill.md +266 -0
- package/plugins/core/skill-watchdog-manager/plugin.json +10 -0
- package/plugins/core/skill-watchdog-manager/skill.md +143 -0
- package/plugins/core/skill-workflow-orchestrator/plugin.json +13 -0
- package/plugins/core/skill-workflow-orchestrator/skill.md +273 -0
- package/plugins/core/validator-doc-sync/index.js +248 -0
- package/plugins/core/validator-doc-sync/plugin.json +12 -0
- package/plugins/core/validator-work-package/index.js +300 -0
- package/plugins/core/validator-work-package/plugin.json +12 -0
- package/plugins/plugin-registry.json +186 -0
- package/plugins/runtime/agent-def-generator.js +150 -0
- package/plugins/runtime/audit-logger.js +311 -0
- package/plugins/runtime/build-cli.js +89 -0
- package/plugins/runtime/checkresult-validator.js +131 -0
- package/plugins/runtime/claude-md-injector.js +159 -0
- package/plugins/runtime/cleanup-utils.js +293 -0
- package/plugins/runtime/config-manager.js +317 -0
- package/plugins/runtime/config-validator.js +320 -0
- package/plugins/runtime/context-window.js +81 -0
- package/plugins/runtime/event-bus.js +207 -0
- package/plugins/runtime/executor-claude.js +828 -0
- package/plugins/runtime/executor-default.js +448 -0
- package/plugins/runtime/executor-local.js +178 -0
- package/plugins/runtime/executor-sdk.js +390 -0
- package/plugins/runtime/harness-build.js +1037 -0
- package/plugins/runtime/hook-dispatcher.js +315 -0
- package/plugins/runtime/logger.js +192 -0
- package/plugins/runtime/loop-actuator.js +292 -0
- package/plugins/runtime/loop-coordinator.js +347 -0
- package/plugins/runtime/loop-defaults.js +29 -0
- package/plugins/runtime/loop-dispatch-batch.js +247 -0
- package/plugins/runtime/loop-executor.js +120 -0
- package/plugins/runtime/loop-report.js +327 -0
- package/plugins/runtime/loop-server-core.js +750 -0
- package/plugins/runtime/loop-snapshot.js +581 -0
- package/plugins/runtime/loop-trace.js +242 -0
- package/plugins/runtime/loop-worktree.js +404 -0
- package/plugins/runtime/manifest-resolver.js +457 -0
- package/plugins/runtime/multi-window-coordinator.js +560 -0
- package/plugins/runtime/objective-verifier.js +136 -0
- package/plugins/runtime/plan-reader.js +763 -0
- package/plugins/runtime/plugin-loader.js +798 -0
- package/plugins/runtime/plugin-trust.js +182 -0
- package/plugins/runtime/plugin-validator.js +491 -0
- package/plugins/runtime/provider-failover.js +114 -0
- package/plugins/runtime/provider-resolver.js +342 -0
- package/plugins/runtime/reflection-evaluator.js +540 -0
- package/plugins/runtime/resolve-plugin-path.js +297 -0
- package/plugins/runtime/safe-path.js +119 -0
- package/plugins/runtime/sandbox-context.js +235 -0
- package/plugins/runtime/sandbox-manager.js +609 -0
- package/plugins/runtime/sandbox-worker.js +215 -0
- package/plugins/runtime/settings-merger.js +172 -0
- package/plugins/runtime/state-store.js +527 -0
- package/plugins/runtime/team-cleanup.js +497 -0
- package/plugins/runtime/text-tokenize.js +25 -0
- package/plugins/runtime/validator-pipeline.js +475 -0
- package/plugins/runtime/yaml-parser.js +692 -0
- package/templates/harness-config.yaml +388 -0
|
@@ -0,0 +1,1291 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: skill-agent-dispatcher
|
|
3
|
+
description: "Use when user says \"批量执行\", \"并行执行\", \"调度子代理\", or needs to execute multiple work packages using Agent subagents. Analyzes dependencies and dispatches tasks in parallel or sequential order."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Agent Dispatcher (Implicit Session Team 版)
|
|
7
|
+
|
|
8
|
+
基于 **Claude Code implicit session team** 机制的子代理批量任务调度技能,支持角色赋能和记忆注入。
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
**触发词**:
|
|
13
|
+
- "批量执行" / "并行执行"
|
|
14
|
+
- "调度子代理" / "派发任务"
|
|
15
|
+
- "执行工作包 WP-XXX, WP-YYY"
|
|
16
|
+
- "开始批量任务"
|
|
17
|
+
|
|
18
|
+
## Quick Reference
|
|
19
|
+
|
|
20
|
+
| 场景 | 执行方式 |
|
|
21
|
+
|------|----------|
|
|
22
|
+
| 无依赖的多个工作包 | 并行执行 (每 WP 一个专用 Teamee) |
|
|
23
|
+
| 有依赖链的工作包 | blockedBy 阻塞 + 依赖解除后按需创建 Teamee |
|
|
24
|
+
| 混合依赖 | 监控循环动态创建 + 即时销毁 |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 团队机制现状 (🔴 必读)
|
|
29
|
+
|
|
30
|
+
Claude Code harness 已升级到 **implicit single-team 模式**。本 skill 的运行前提已变化,阅读下表后再进入后续步骤:
|
|
31
|
+
|
|
32
|
+
| 维度 | 旧(显式 Agent Teams) | 新(implicit session team) |
|
|
33
|
+
|------|----------------------|---------------------------|
|
|
34
|
+
| 团队创建 | Lead 调 `TeamCreate` 显式命名团队 | ❌ 工具已移除;每个 session 自动有一个 implicit team(`session-xxx`),subagent 自动加入 |
|
|
35
|
+
| Agent 调用的 `team_name` 参数 | 必传,绑定到显式团队 | ❌ `Deprecated; ignored`;subagent 自动加入 implicit session team,文档不再传此参数 |
|
|
36
|
+
| 协作能力(并行 spawn + SendMessage + 共享 Task List) | 由显式团队提供 | ✅ **仍由 implicit session team 提供,未丢失** |
|
|
37
|
+
| 失去的能力 | — | 仅"显式命名团队管理":TeamCreate 命名、TeamDelete、按 `batch-xxx` 管理团队目录 |
|
|
38
|
+
|
|
39
|
+
**本 skill 中 `team_name` 变量的重新定义**:
|
|
40
|
+
- `team_name` **不再是 harness 团队名**(不再驱动 TeamCreate,不再作为 Agent 参数)。
|
|
41
|
+
- `team_name` 现在是 **Lead 内部的"批次逻辑标签"**,仍用于:
|
|
42
|
+
- 状态文件 `dispatcher-state.json` 的 `team_name` 字段(标识"这批执行")
|
|
43
|
+
- 心跳 `heartbeat.json` 的 `session_id` / `team_name` 字段(供守护进程监控)
|
|
44
|
+
- 执行报告的批次标识
|
|
45
|
+
- idle 检测里 `assignment.team_name == team_name` 的批次一致性校验
|
|
46
|
+
- 实际的 harness 团队由 session 自动分配,Lead 无需也无法干预。
|
|
47
|
+
|
|
48
|
+
**清理流程的相应调整**:
|
|
49
|
+
- 当前 session 的 implicit team 随 session 结束自动清理,**无需 TeamDelete**(工具也不存在)。
|
|
50
|
+
- `team-cleanup` CLI 保留,定位调整为**清理历史残留的显式/UUID 团队目录**(如旧的 `cybershop-wp101`、UUID 命名团队),而非清理当前 session team。
|
|
51
|
+
- session team 目录若需提前释放,仍可由 `team-cleanup` CLI 物理删除目录(CLI 内部直接走文件系统删除,**不调 TeamDelete**,见 cleanup-reference.md)。
|
|
52
|
+
|
|
53
|
+
**关于 Teamee Prompt 模板**: `roles-reference.md` 的 Prompt 模板仍含历史措辞(`团队名称: {team_name}`、`shutdown_request` 响应协议帧)。Lead 实际构建 prompt 时以 `build_single_task_prompt()` 行为为准——Teamee 一经 spawn 自动加入 implicit session team,无需注入 harness 团队名;销毁走逻辑销毁(markTeameeDestroyed),不发 shutdown 协议帧。
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Architecture
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
61
|
+
│ Team Lead (主 Agent) │
|
|
62
|
+
│ │
|
|
63
|
+
│ 1. 解析工作包 → 分析依赖 │
|
|
64
|
+
│ 2. 初始化批次标签 team_name (Lead 内部逻辑标识) │
|
|
65
|
+
│ 3. TaskCreate 创建任务 + 设置 blockedBy │
|
|
66
|
+
│ 4. 角色匹配 → 预计算每个 WP 的角色和记忆 │
|
|
67
|
+
│ 5. 监控循环: │
|
|
68
|
+
│ - 检测 newly-unblocked 任务 → 按需创建专用 Teamee (1:1) │
|
|
69
|
+
│ - 检测已完成的任务 → 即时销毁对应 Teamee │
|
|
70
|
+
│ - 维护映射表 {task_id → teamee_name} │
|
|
71
|
+
│ 6. 全部完成后逻辑销毁 + 可选 team-cleanup 清理历史残留 │
|
|
72
|
+
│ 7. 经验提取 + completion-report │
|
|
73
|
+
└─────────────────────────────────────────────────────────────┘
|
|
74
|
+
│
|
|
75
|
+
┌─────────────────────┼─────────────────────┐
|
|
76
|
+
▼ ▼ ▼
|
|
77
|
+
┌──────────┐ ┌──────────┐ ┌──────────┐
|
|
78
|
+
│ Teamee A │ │ Teamee B │ │ Teamee C │
|
|
79
|
+
│ WP-037 │ │ WP-038 │ │ WP-039 │
|
|
80
|
+
│ (或四位如 │ │ WP-1038 │ │ WP-1039 │)
|
|
81
|
+
│ 专用绑定 │ │ 专用绑定 │ │ 专用绑定 │
|
|
82
|
+
└────┬─────┘ └────┬─────┘ └────┬─────┘
|
|
83
|
+
│ 已完成 │ 执行中 │ blockedBy #2
|
|
84
|
+
│ 即时销毁 │ │ 等待创建
|
|
85
|
+
▼ ▼ ▼
|
|
86
|
+
┌───────────────────────────────┐
|
|
87
|
+
│ 共享 Task List │
|
|
88
|
+
│ Task #1: WP-037 (completed) │
|
|
89
|
+
│ Task #2: WP-038 (in_progress)│
|
|
90
|
+
│ Task #3: WP-039 (blockedBy #2)│
|
|
91
|
+
└───────────────────────────────┘
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## SendMessage 使用规范 (🔴 必须遵守)
|
|
97
|
+
|
|
98
|
+
**所有 SendMessage 调用必须遵循以下规则:**
|
|
99
|
+
|
|
100
|
+
1. **🔴 SendMessage 绝不携带任何 protocol frame**(`shutdown_request` / `shutdown_response` / `permission` / `mode` / `plan` 的 JSON)。
|
|
101
|
+
Claude Code harness 工具层对含 protocol frame 的 message 做字符串拦截,直接报错:
|
|
102
|
+
`message text must not be a teammate protocol frame`。
|
|
103
|
+
这不是本项目代码能绕过的——**根本不要尝试用 SendMessage 发 protocol frame**。
|
|
104
|
+
|
|
105
|
+
2. **SendMessage 只用于纯文本状态沟通**,且**必须带 summary 参数**(5-10 词预览):
|
|
106
|
+
```
|
|
107
|
+
# ✅ 纯文本状态,带 summary
|
|
108
|
+
SendMessage(
|
|
109
|
+
to=target,
|
|
110
|
+
summary="Task 1 status update",
|
|
111
|
+
message="Task #1 已完成进度 50%"
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
# ❌ 任何 protocol frame 作为 message 都被拦截
|
|
115
|
+
SendMessage(to=target, message={"type": "shutdown_request", ...})
|
|
116
|
+
SendMessage(to=target, summary="...", message={"type": "shutdown_response", ...})
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
3. **Teamee 销毁走逻辑销毁**,不依赖任何协议帧:
|
|
120
|
+
```
|
|
121
|
+
# ✅ 逻辑销毁:从映射表移除,in-process Teamee 随 session 自然终止
|
|
122
|
+
markTeameeDestroyed(teamee_map, task_id)
|
|
123
|
+
```
|
|
124
|
+
销毁后**无需**等待响应、**无需**发送 shutdown。
|
|
125
|
+
|
|
126
|
+
4. **历史残留团队目录清理走确定性 CLI**(按需执行,非批末强制):
|
|
127
|
+
```
|
|
128
|
+
node bin/doukui.js team-cleanup <residual_team_name> --force
|
|
129
|
+
```
|
|
130
|
+
该 CLI 封装跨平台 `fs.rmSync` + 安全校验,绕过 harness Bash 权限系统。注意:当前 session 的 implicit team 随 session 自动清理,本 CLI 仅用于清理**历史残留**的显式/UUID 团队目录(如旧 batch-xxx、cybershop-wp101 等)。CLI 内部直接走文件系统删除,**不调用 TeamDelete**(工具已移除)。
|
|
131
|
+
|
|
132
|
+
**原则**:SendMessage 是**纯文本沟通通道**;Teamee 生命周期管理(销毁/清理)走**逻辑销毁 + CLI**,两者解耦。
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Flow
|
|
137
|
+
|
|
138
|
+
```dot
|
|
139
|
+
digraph dispatcher_v3 {
|
|
140
|
+
rankdir=TB;
|
|
141
|
+
|
|
142
|
+
// 准备阶段
|
|
143
|
+
"解析工作包清单" [shape=box];
|
|
144
|
+
"分析依赖关系" [shape=box];
|
|
145
|
+
"检测循环依赖" [shape=diamond];
|
|
146
|
+
|
|
147
|
+
// 团队创建
|
|
148
|
+
"初始化批次标签 team_name" [shape=box, style=filled, fillcolor=lightblue];
|
|
149
|
+
"TaskCreate 创建任务" [shape=box, style=filled, fillcolor=lightblue];
|
|
150
|
+
"设置 blockedBy 依赖" [shape=box];
|
|
151
|
+
|
|
152
|
+
// 角色匹配
|
|
153
|
+
"角色匹配 (预计算)" [shape=box, style=filled, fillcolor=lightyellow];
|
|
154
|
+
"读取角色定义" [shape=box];
|
|
155
|
+
"注入专属记忆" [shape=box];
|
|
156
|
+
|
|
157
|
+
// 监控循环
|
|
158
|
+
"监控循环: TaskList" [shape=diamond, style=filled, fillcolor=orange];
|
|
159
|
+
"检测 newly-unblocked 任务" [shape=box];
|
|
160
|
+
"为可用任务创建专用 Teamee" [shape=box, style=filled, fillcolor=orange];
|
|
161
|
+
"预分配 owner (TaskUpdate)" [shape=box];
|
|
162
|
+
"Teamee 执行单一任务" [shape=box];
|
|
163
|
+
"TaskUpdate 标记 completed" [shape=box];
|
|
164
|
+
|
|
165
|
+
// 即时销毁(逻辑销毁,无协议帧)
|
|
166
|
+
"检测已完成任务" [shape=box];
|
|
167
|
+
"从映射表移除(逻辑销毁)" [shape=box];
|
|
168
|
+
|
|
169
|
+
// 循环判断
|
|
170
|
+
"所有任务 completed?" [shape=diamond];
|
|
171
|
+
"超时?" [shape=diamond];
|
|
172
|
+
|
|
173
|
+
// 收尾
|
|
174
|
+
"逻辑销毁残留 + 可选 team-cleanup CLI" [shape=box];
|
|
175
|
+
"经验提取" [shape=box, style=filled, fillcolor=lightgreen];
|
|
176
|
+
"生成执行报告" [shape=box];
|
|
177
|
+
|
|
178
|
+
// 流程连接
|
|
179
|
+
"解析工作包清单" -> "分析依赖关系";
|
|
180
|
+
"分析依赖关系" -> "检测循环依赖";
|
|
181
|
+
"检测循环依赖" -> "初始化批次标签 team_name" [label="无循环"];
|
|
182
|
+
"检测循环依赖" -> "报错退出" [label="有循环", style=dashed];
|
|
183
|
+
|
|
184
|
+
"初始化批次标签 team_name" -> "TaskCreate 创建任务";
|
|
185
|
+
"TaskCreate 创建任务" -> "设置 blockedBy 依赖";
|
|
186
|
+
"设置 blockedBy 依赖" -> "角色匹配 (预计算)";
|
|
187
|
+
|
|
188
|
+
"角色匹配 (预计算)" -> "读取角色定义";
|
|
189
|
+
"读取角色定义" -> "注入专属记忆";
|
|
190
|
+
"注入专属记忆" -> "监控循环: TaskList";
|
|
191
|
+
|
|
192
|
+
"监控循环: TaskList" -> "检测 newly-unblocked 任务";
|
|
193
|
+
"检测 newly-unblocked 任务" -> "为可用任务创建专用 Teamee" [label="有可用任务"];
|
|
194
|
+
"为可用任务创建专用 Teamee" -> "预分配 owner (TaskUpdate)";
|
|
195
|
+
"预分配 owner (TaskUpdate)" -> "Teamee 执行单一任务";
|
|
196
|
+
"Teamee 执行单一任务" -> "TaskUpdate 标记 completed";
|
|
197
|
+
|
|
198
|
+
"监控循环: TaskList" -> "检测已完成任务";
|
|
199
|
+
"检测已完成任务" -> "从映射表移除(逻辑销毁)" [label="有新完成"];
|
|
200
|
+
|
|
201
|
+
"监控循环: TaskList" -> "所有任务 completed?";
|
|
202
|
+
"所有任务 completed?" -> "逻辑销毁残留 + 可选 team-cleanup CLI" [label="是"];
|
|
203
|
+
"所有任务 completed?" -> "超时?" [label="否"];
|
|
204
|
+
"超时?" -> "监控循环: TaskList" [label="否"];
|
|
205
|
+
"超时?" -> "逻辑销毁残留 + 可选 team-cleanup CLI" [label="是"];
|
|
206
|
+
|
|
207
|
+
"逻辑销毁残留 + 可选 team-cleanup CLI" -> "经验提取";
|
|
208
|
+
"经验提取" -> "生成执行报告";
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Step-by-Step Implementation
|
|
215
|
+
|
|
216
|
+
### Step 1: 解析工作包 + 分析依赖
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
1. 读取 task.md 获取下一个可用 WP 编号
|
|
220
|
+
2. 提取待执行工作包的依赖关系
|
|
221
|
+
3. 构建依赖图,检测循环依赖
|
|
222
|
+
4. 确定执行顺序(拓扑排序)
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Step 2: 初始化批次标签 team_name
|
|
226
|
+
|
|
227
|
+
> ⚠️ **语义变更(implicit session team 模式)**: `team_name` **不再调用 TeamCreate**(工具已移除),也**不再作为 Agent 调用的参数**(harness 已忽略)。它现在只是 Lead 内部的"批次逻辑标签",用于状态文件、心跳、执行报告标识"这批执行"。实际团队由 harness 自动分配 implicit session team。
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
# Lead 内部变量赋值(无工具调用)
|
|
231
|
+
team_name = "batch-{YYYYMMDD}-{work-package-ids}" # 批次逻辑标签,非 harness 团队名
|
|
232
|
+
# 实际 harness 团队是 implicit session-xxx,由 session 自动分配,Lead 无需也无法干预
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**命名规范(批次标签,仅用于标识/可读性)**:
|
|
236
|
+
- 单工作包: `batch-20260314-WP073` / `batch-20260314-WP1073`
|
|
237
|
+
- 批量工作包: `batch-20260314-WP073-075` / `batch-20260314-WP1073-1075`
|
|
238
|
+
|
|
239
|
+
**此标签的使用位置**:
|
|
240
|
+
- 写入 `dispatcher-state.json` / `heartbeat.json`(见 Step 6.5)
|
|
241
|
+
- idle 检测的批次一致性校验 `assignment.team_name == team_name`(见 Phase D2-idle)
|
|
242
|
+
- 执行报告的批次标识(见 Execution Report)
|
|
243
|
+
|
|
244
|
+
**不使用此标签的位置**:
|
|
245
|
+
- ❌ 不作为 `Agent(team_name=...)` 参数(harness 已忽略)
|
|
246
|
+
- ❌ 不驱动 TeamCreate(工具已移除)
|
|
247
|
+
- ❌ 不作为 team-cleanup CLI 的目标(team-cleanup 用于历史残留,当前 session team 自动清理)
|
|
248
|
+
|
|
249
|
+
### Step 3: 创建任务 + 设置依赖
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
# 为每个工作包创建 Task
|
|
253
|
+
|
|
254
|
+
TaskCreate:
|
|
255
|
+
subject: "WP-037: 凝视区域形状升级"
|
|
256
|
+
description: |
|
|
257
|
+
## 📖 必读:工作包文档
|
|
258
|
+
|
|
259
|
+
**执行前请先阅读工作包文档获取完整上下文:**
|
|
260
|
+
- 文档路径: `docs/wp/WP-037.md`
|
|
261
|
+
- 包含: 问题分析、实施计划、关键文件、验收标准
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
{工作包简要描述}
|
|
266
|
+
status: pending
|
|
267
|
+
|
|
268
|
+
# 设置依赖关系
|
|
269
|
+
TaskUpdate:
|
|
270
|
+
taskId: "{依赖任务的 ID}"
|
|
271
|
+
addBlockedBy: ["{被依赖任务的 ID}"]
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
**⚠️ 重要**: description 必须包含工作包文档路径,让 Subagent 知道从哪里获取完整上下文!
|
|
275
|
+
|
|
276
|
+
### Step 4-5: 角色匹配 + 记忆准备
|
|
277
|
+
|
|
278
|
+
**📖 在执行此步骤前,读取角色与记忆参考文档:**
|
|
279
|
+
```
|
|
280
|
+
Read("plugins/core/skill-agent-dispatcher/roles-reference.md")
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
该文档包含:
|
|
284
|
+
- **Step 4**: 角色匹配算法(关键词/任务类型/模块标签加权评分)
|
|
285
|
+
- **Step 5**: 预计算角色和记忆的完整流程
|
|
286
|
+
- **角色赋能系统**: 核心角色表、领域角色表、角色文件位置
|
|
287
|
+
- **记忆注入机制**: 经验提取逻辑、动态数量、回退机制
|
|
288
|
+
- **经验沉淀闭环**: 执行完成后的经验提取流程
|
|
289
|
+
|
|
290
|
+
### Step 6: 初始创建 Teamee(首次可用任务)
|
|
291
|
+
|
|
292
|
+
<HARD-GATE>
|
|
293
|
+
Step 5 完成后,立即检查有哪些任务的 blockedBy 已满足。
|
|
294
|
+
为每个 initially-unblocked 的任务创建专用 Teamee。
|
|
295
|
+
不可跳过此步骤!
|
|
296
|
+
</HARD-GATE>
|
|
297
|
+
|
|
298
|
+
**⚠️ 重要**: 必须使用 `general-purpose` subagent_type!
|
|
299
|
+
|
|
300
|
+
不要使用 `Explore` 或其他只读 agent 类型,因为它们没有 Write/Edit/Bash 工具,
|
|
301
|
+
无法完成实现工作(写代码、改文件、跑测试)。
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
# 初始化映射表
|
|
305
|
+
teamee_map = {} # {task_id: teamee_name}
|
|
306
|
+
|
|
307
|
+
# 检查哪些任务在初始时就没有阻塞
|
|
308
|
+
tasks = TaskList()
|
|
309
|
+
for task in tasks:
|
|
310
|
+
if task.status == "pending" and is_unblocked(task):
|
|
311
|
+
# 从预计算结果获取角色信息
|
|
312
|
+
assignment = wp_assignments[task.id]
|
|
313
|
+
|
|
314
|
+
# 生成唯一的 Teamee 名称(包含 task_id 和 role)
|
|
315
|
+
teamee_name = f"{assignment.role_id}-t{task.id}"
|
|
316
|
+
|
|
317
|
+
# 预分配 owner
|
|
318
|
+
TaskUpdate(taskId=task.id, owner=teamee_name)
|
|
319
|
+
|
|
320
|
+
# 创建专用 Teamee(自动加入 implicit session team,无需 team_name 参数)
|
|
321
|
+
Agent(
|
|
322
|
+
name=teamee_name,
|
|
323
|
+
subagent_type="general-purpose", # 必须使用 general-purpose
|
|
324
|
+
prompt=build_single_task_prompt(
|
|
325
|
+
teamee_name=teamee_name,
|
|
326
|
+
task_id=task.id,
|
|
327
|
+
role_prompt=assignment.role_prompt,
|
|
328
|
+
memories=assignment.memories,
|
|
329
|
+
wp_doc_path=assignment.wp_doc_path
|
|
330
|
+
)
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
# 记录映射关系
|
|
334
|
+
teamee_map[task.id] = teamee_name
|
|
335
|
+
|
|
336
|
+
# ---- 1:1 映射验证 ----
|
|
337
|
+
all_tasks_verify = TaskList()
|
|
338
|
+
unblocked_verify = [t for t in all_tasks_verify if t.status == "pending" and is_unblocked(t)]
|
|
339
|
+
if len(teamee_map) != len(unblocked_verify):
|
|
340
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
341
|
+
# 输出: "⚠️ 验证失败: 有 {len(unblocked_verify)} 个已解除阻塞的 WP 但只创建了 {len(teamee_map)} 个 Teamee"
|
|
342
|
+
# 输出: "❌ 这可能意味着某些 WP 被错误合并。请检查以上步骤是否严格遵循 1:1 映射规则。"
|
|
343
|
+
else:
|
|
344
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
345
|
+
# 输出: "✅ 1:1 映射验证通过: {len(teamee_map)} 个 Teamee 对应 {len(unblocked_verify)} 个已解除阻塞的 WP"
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
**为什么不能用 Explore agent**:
|
|
349
|
+
- Explore agent 的工具集: `All tools except Agent, ExitPlanMode, Edit, Write, NotebookEdit`
|
|
350
|
+
- 没有 Write/Edit/Bash = 无法完成实现工作(不能写代码、改文件、跑测试)
|
|
351
|
+
- Teamee 的核心职责是实现 WP,只读 agent 无法胜任
|
|
352
|
+
|
|
353
|
+
### Step 6.5: 监控循环 (🔴 关键步骤 — 动态创建 + 即时销毁)
|
|
354
|
+
|
|
355
|
+
<HARD-GATE>
|
|
356
|
+
Lead Agent 必须进入监控循环,不可跳过!
|
|
357
|
+
此循环负责:
|
|
358
|
+
1. 检测 newly-unblocked 任务 → 按需创建专用 Teamee
|
|
359
|
+
2. 检测已完成任务 → 即时销毁对应 Teamee
|
|
360
|
+
3. 判断全部完成 → 退出循环
|
|
361
|
+
这是保证资源及时释放和依赖正确解析的核心机制。
|
|
362
|
+
</HARD-GATE>
|
|
363
|
+
|
|
364
|
+
```
|
|
365
|
+
# Lead Agent 监控循环
|
|
366
|
+
|
|
367
|
+
# ⚠️ 监控循环 Teamee 销毁规则 (🔴 必须遵守):
|
|
368
|
+
# 1. 任务完成 → 调 markTeameeDestroyed(teamee_map, task_id) 逻辑销毁(无协议帧)
|
|
369
|
+
# 2. SendMessage 仅用于纯文本状态沟通(必须带 summary),绝不携带 protocol frame
|
|
370
|
+
# 3. 任何 protocol frame(shutdown/permission/mode/plan JSON)禁止,harness 会拦截报错
|
|
371
|
+
|
|
372
|
+
loop_interval = 30 # 秒
|
|
373
|
+
max_wait_time = 7200 # 2 小时
|
|
374
|
+
|
|
375
|
+
# ---- 状态持久化初始化 (防上下文压缩丢失) ----
|
|
376
|
+
state_file = ".claude-daemon/dispatcher-state.json"
|
|
377
|
+
heartbeat_file = ".claude-daemon/heartbeat.json"
|
|
378
|
+
daemon_actions_file = ".claude-daemon/daemon-actions.json"
|
|
379
|
+
|
|
380
|
+
# ---- 多窗口环境检测 ----
|
|
381
|
+
# 当 DOUKUI_MULTI_WINDOW_SESSION 和 DOUKUI_WINDOW_ID 环境变量同时存在时,
|
|
382
|
+
# 将状态文件写入 windows/{window_id}/ 子目录,支持协调器聚合
|
|
383
|
+
multi_window_session = env("DOUKUI_MULTI_WINDOW_SESSION")
|
|
384
|
+
window_id = env("DOUKUI_WINDOW_ID")
|
|
385
|
+
is_multi_window = bool(multi_window_session and window_id)
|
|
386
|
+
|
|
387
|
+
if is_multi_window:
|
|
388
|
+
state_dir = f".claude-daemon/windows/{window_id}"
|
|
389
|
+
ensure_dir(state_dir)
|
|
390
|
+
state_file = f"{state_dir}/state.json"
|
|
391
|
+
heartbeat_file = f"{state_dir}/heartbeat.json"
|
|
392
|
+
|
|
393
|
+
# 检查是否存在已有状态文件(上下文压缩后恢复)
|
|
394
|
+
if file_exists(state_file):
|
|
395
|
+
try:
|
|
396
|
+
existing_state = json_loads(Read(file_path=state_file))
|
|
397
|
+
except Exception as e:
|
|
398
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
399
|
+
# 输出: "⚠️ 状态文件解析失败,使用默认初始状态: {e}"
|
|
400
|
+
existing_state = {}
|
|
401
|
+
if existing_state.get("status") == "monitoring":
|
|
402
|
+
# 从文件恢复状态(上下文压缩后重新进入时走此分支)
|
|
403
|
+
team_name = existing_state["team_name"]
|
|
404
|
+
teamee_map = existing_state["teamee_map"]
|
|
405
|
+
wp_assignments = existing_state["wp_assignments"]
|
|
406
|
+
loop_iteration = existing_state["loop_iteration"]
|
|
407
|
+
start_time = parse_iso8601(existing_state["start_time"])
|
|
408
|
+
processed_action_ids = existing_state["processed_action_ids"]
|
|
409
|
+
max_batch_size = existing_state.get("max_batch_size", 5)
|
|
410
|
+
current_batch = existing_state.get("current_batch", [])
|
|
411
|
+
pending_batches = existing_state.get("pending_batches", [])
|
|
412
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
413
|
+
# 输出: "从状态文件恢复: {len(teamee_map)} 个活跃 Teamee, 迭代 {loop_iteration}"
|
|
414
|
+
else:
|
|
415
|
+
# 状态文件存在但已完成,正常初始化
|
|
416
|
+
pass
|
|
417
|
+
|
|
418
|
+
# 首次初始化守护进程相关状态
|
|
419
|
+
loop_iteration = loop_iteration if 'loop_iteration' in locals() else 0
|
|
420
|
+
processed_action_ids = processed_action_ids if 'processed_action_ids' in locals() else []
|
|
421
|
+
|
|
422
|
+
# ---- 批量大小控制参数 ----
|
|
423
|
+
max_batch_size = get_config("agent_dispatcher.max_batch_size", default=5)
|
|
424
|
+
current_batch = current_batch if 'current_batch' in locals() else []
|
|
425
|
+
pending_batches = pending_batches if 'pending_batches' in locals() else []
|
|
426
|
+
|
|
427
|
+
# 首次写入状态文件
|
|
428
|
+
initial_state = {
|
|
429
|
+
"team_name": "{team_name}",
|
|
430
|
+
"teamee_map": teamee_map if 'teamee_map' in locals() else {},
|
|
431
|
+
"wp_assignments": wp_assignments if 'wp_assignments' in locals() else {},
|
|
432
|
+
"start_time": now_iso8601(),
|
|
433
|
+
"loop_iteration": loop_iteration,
|
|
434
|
+
"processed_action_ids": processed_action_ids,
|
|
435
|
+
"total_tasks": len(tasks) if 'tasks' in locals() else 0,
|
|
436
|
+
"status": "monitoring",
|
|
437
|
+
"max_batch_size": max_batch_size,
|
|
438
|
+
"current_batch": current_batch,
|
|
439
|
+
"pending_batches": pending_batches,
|
|
440
|
+
"global_pause_flag": False
|
|
441
|
+
}
|
|
442
|
+
Write(file_path=state_file, content=json_dumps(initial_state))
|
|
443
|
+
|
|
444
|
+
start_time = start_time if 'start_time' in locals() else now()
|
|
445
|
+
while (now() - start_time) < max_wait_time:
|
|
446
|
+
loop_iteration += 1
|
|
447
|
+
|
|
448
|
+
# ---- Phase 0: 从状态文件恢复关键变量 (防上下文压缩) ----
|
|
449
|
+
if file_exists(state_file):
|
|
450
|
+
try:
|
|
451
|
+
state = json_loads(Read(file_path=state_file))
|
|
452
|
+
except Exception as e:
|
|
453
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
454
|
+
# 输出: "⚠️ 状态文件解析失败,使用当前内存状态继续: {e}"
|
|
455
|
+
state = {}
|
|
456
|
+
team_name = state.get("team_name", team_name)
|
|
457
|
+
teamee_map = state.get("teamee_map", teamee_map)
|
|
458
|
+
wp_assignments = state.get("wp_assignments", wp_assignments)
|
|
459
|
+
start_time = parse_iso8601(state["start_time"]) if state.get("start_time") else start_time
|
|
460
|
+
loop_iteration = state.get("loop_iteration", loop_iteration)
|
|
461
|
+
processed_action_ids = state.get("processed_action_ids", processed_action_ids)
|
|
462
|
+
max_batch_size = state.get("max_batch_size", max_batch_size)
|
|
463
|
+
current_batch = state.get("current_batch", current_batch)
|
|
464
|
+
pending_batches = state.get("pending_batches", pending_batches)
|
|
465
|
+
global_pause_flag = state.get("global_pause_flag", False)
|
|
466
|
+
|
|
467
|
+
# ---- Phase 0.1: 多窗口阶段信号检查 ----
|
|
468
|
+
# 读取 multi-window-session.json,检查当前窗口的阶段是否就绪
|
|
469
|
+
if is_multi_window:
|
|
470
|
+
session_file = ".claude-daemon/multi-window-session.json"
|
|
471
|
+
try:
|
|
472
|
+
session_data = json_loads(Read(file_path=session_file))
|
|
473
|
+
except Exception:
|
|
474
|
+
session_data = None
|
|
475
|
+
|
|
476
|
+
if session_data:
|
|
477
|
+
my_stage = None
|
|
478
|
+
for s in session_data.get("stages", []):
|
|
479
|
+
if window_id in s.get("windows", []):
|
|
480
|
+
my_stage = s
|
|
481
|
+
break
|
|
482
|
+
|
|
483
|
+
if my_stage:
|
|
484
|
+
if my_stage.get("status") == "pending":
|
|
485
|
+
# 当前阶段未就绪,跳过本轮 Teamee 创建
|
|
486
|
+
# ── 状态输出 ──
|
|
487
|
+
# 输出: "⏸ 窗口 {window_id} 阶段 {my_stage['stage_id']} 尚未就绪,等待阶段信号"
|
|
488
|
+
pass # 跳过后续 Phase C 创建逻辑(通过标志控制)
|
|
489
|
+
elif my_stage.get("status") == "completed":
|
|
490
|
+
# 当前阶段已完成,检查是否有下一阶段
|
|
491
|
+
next_stage = None
|
|
492
|
+
for s in session_data.get("stages", []):
|
|
493
|
+
if s.get("stage_id") == my_stage.get("stage_id") + 1:
|
|
494
|
+
next_stage = s
|
|
495
|
+
break
|
|
496
|
+
if next_stage and next_stage.get("status") == "active":
|
|
497
|
+
# 切换到下一阶段的任务
|
|
498
|
+
assigned_wps = next_stage.get("work_packages", assigned_wps)
|
|
499
|
+
current_stage = next_stage.get("stage_id", current_stage)
|
|
500
|
+
# ── 状态输出 ──
|
|
501
|
+
# 输出: "🔄 窗口 {window_id} 切换到阶段 {next_stage['stage_id']}: {next_stage.get('name', '')}"
|
|
502
|
+
|
|
503
|
+
# ---- Phase A: 获取任务状态 ----
|
|
504
|
+
tasks = TaskList()
|
|
505
|
+
|
|
506
|
+
# ---- Phase A.1: 写入守护进程心跳 (DISP-001) ----
|
|
507
|
+
# 每轮监控循环迭代写入心跳文件,供外部守护进程监控
|
|
508
|
+
heartbeat_data = {
|
|
509
|
+
"session_id": "{team_name}",
|
|
510
|
+
"pid": get_process_pid(), # 通过 Bash `echo $$` 或 process.pid 获取
|
|
511
|
+
"team_name": "{team_name}",
|
|
512
|
+
"loop_iteration": loop_iteration,
|
|
513
|
+
"total_tasks": len(tasks),
|
|
514
|
+
"completed_tasks": count(t.status == "completed" for t in tasks),
|
|
515
|
+
"in_progress_tasks": count(t.status == "in_progress" for t in tasks),
|
|
516
|
+
"pending_tasks": count(t.status == "pending" for t in tasks),
|
|
517
|
+
"last_update": now_iso8601(),
|
|
518
|
+
"status": "monitoring" # monitoring / shutting_down / completed
|
|
519
|
+
}
|
|
520
|
+
# 多窗口模式下增加 window_id 字段
|
|
521
|
+
if is_multi_window:
|
|
522
|
+
heartbeat_data["window_id"] = window_id
|
|
523
|
+
Write(file_path=heartbeat_file, content=json_dumps(heartbeat_data))
|
|
524
|
+
|
|
525
|
+
# ---- Phase B: 逻辑销毁已完成的 Teamee(无协议帧) ----
|
|
526
|
+
for task in tasks:
|
|
527
|
+
if task.status == "completed" and task.id in teamee_map:
|
|
528
|
+
teamee_name = teamee_map[task.id]
|
|
529
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
530
|
+
# 输出: "任务 {task.id} 已完成,逻辑销毁 Teamee: {teamee_name}"
|
|
531
|
+
|
|
532
|
+
# B1. 逻辑销毁:从映射表移除(不发任何协议帧;in-process Teamee 随 session 终止)
|
|
533
|
+
markTeameeDestroyed(teamee_map, task.id)
|
|
534
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
535
|
+
# 输出: "逻辑销毁 Teamee: {teamee_name}(映射已移除)"
|
|
536
|
+
|
|
537
|
+
# B2. 更新任务状态文件 (DISP-002)
|
|
538
|
+
# Teamee 完成后更新对应的 task-{id}.json 文件
|
|
539
|
+
update_task_file(task.id, status="completed")
|
|
540
|
+
|
|
541
|
+
# ---- Phase B.5: 状态持久化写回 (teamee_map 变更) ----
|
|
542
|
+
state_payload_b5 = {
|
|
543
|
+
"team_name": team_name,
|
|
544
|
+
"teamee_map": teamee_map,
|
|
545
|
+
"wp_assignments": wp_assignments,
|
|
546
|
+
"start_time": start_time.isoformat() if hasattr(start_time, 'isoformat') else start_time,
|
|
547
|
+
"loop_iteration": loop_iteration,
|
|
548
|
+
"processed_action_ids": processed_action_ids,
|
|
549
|
+
"total_tasks": len(tasks),
|
|
550
|
+
"status": "monitoring",
|
|
551
|
+
"max_batch_size": max_batch_size,
|
|
552
|
+
"current_batch": current_batch,
|
|
553
|
+
"pending_batches": pending_batches,
|
|
554
|
+
"global_pause_flag": global_pause_flag
|
|
555
|
+
}
|
|
556
|
+
if is_multi_window:
|
|
557
|
+
state_payload_b5["window_id"] = window_id
|
|
558
|
+
state_payload_b5["session_id"] = multi_window_session
|
|
559
|
+
Write(file_path=state_file, content=json_dumps(state_payload_b5))
|
|
560
|
+
|
|
561
|
+
# ---- Phase C: 按需创建 Teamee 处理 newly-unblocked 任务 ----
|
|
562
|
+
# C0. 读取并发配置,计算当前时段的并发上限
|
|
563
|
+
concurrency_config = get_config("agent_dispatcher.concurrency")
|
|
564
|
+
max_concurrent = get_max_concurrent(concurrency_config, now())
|
|
565
|
+
active_count = len(teamee_map)
|
|
566
|
+
|
|
567
|
+
# ---- C0.2 批量大小控制 ----
|
|
568
|
+
# 收集本轮可创建的 unblocked 任务,按 max_batch_size 分批
|
|
569
|
+
unblocked_candidates = sorted([t for t in tasks if t.status == "pending" and t.owner == "" and is_unblocked(t) and t.id not in teamee_map], key=lambda t: t.id)
|
|
570
|
+
# 如果当前批次有活跃任务,不创建新批次(等当前批次完成)
|
|
571
|
+
current_batch_active = any(tid in teamee_map for tid in current_batch) if current_batch else False
|
|
572
|
+
|
|
573
|
+
if unblocked_candidates and not current_batch_active:
|
|
574
|
+
# 取前 max_batch_size 个作为当前批次
|
|
575
|
+
current_batch = [t.id for t in unblocked_candidates[:max_batch_size]]
|
|
576
|
+
overflow = unblocked_candidates[max_batch_size:]
|
|
577
|
+
if overflow:
|
|
578
|
+
pending_batches.extend([t.id for t in overflow])
|
|
579
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
580
|
+
# 输出: "批量控制: 当前批次 {len(current_batch)} 个任务, 待处理批次 {len(pending_batches)} 个任务"
|
|
581
|
+
|
|
582
|
+
for task in tasks:
|
|
583
|
+
if task.status == "pending" and task.owner == "" and is_unblocked(task):
|
|
584
|
+
# C0.1 并发检查:活跃 Teamee 数已达上限,跳过创建
|
|
585
|
+
if active_count >= max_concurrent:
|
|
586
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
587
|
+
# 输出: "并发上限 {max_concurrent} 已达,任务 {task.id} 保持 pending"
|
|
588
|
+
continue
|
|
589
|
+
|
|
590
|
+
# C0.3 批量控制:只处理当前批次内的任务
|
|
591
|
+
if current_batch and task.id not in current_batch:
|
|
592
|
+
continue
|
|
593
|
+
|
|
594
|
+
# C1. 检查是否已有映射(防止重复创建)
|
|
595
|
+
if task.id in teamee_map:
|
|
596
|
+
continue
|
|
597
|
+
|
|
598
|
+
# C2. 从预计算结果获取角色信息
|
|
599
|
+
assignment = wp_assignments[task.id]
|
|
600
|
+
teamee_name = f"{assignment.role_id}-t{task.id}"
|
|
601
|
+
|
|
602
|
+
# C3. 预分配 owner
|
|
603
|
+
TaskUpdate(taskId=task.id, owner=teamee_name)
|
|
604
|
+
|
|
605
|
+
# C4. 创建专用 Teamee(自动加入 implicit session team,无需 team_name 参数)
|
|
606
|
+
Agent(
|
|
607
|
+
name=teamee_name,
|
|
608
|
+
subagent_type="general-purpose",
|
|
609
|
+
prompt=build_single_task_prompt(
|
|
610
|
+
teamee_name=teamee_name,
|
|
611
|
+
task_id=task.id,
|
|
612
|
+
role_prompt=assignment.role_prompt,
|
|
613
|
+
memories=assignment.memories,
|
|
614
|
+
wp_doc_path=assignment.wp_doc_path
|
|
615
|
+
)
|
|
616
|
+
)
|
|
617
|
+
|
|
618
|
+
# C5. 记录映射关系
|
|
619
|
+
teamee_map[task.id] = teamee_name
|
|
620
|
+
active_count += 1
|
|
621
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
622
|
+
# 输出: "为任务 {task.id} 创建专用 Teamee: {teamee_name}"
|
|
623
|
+
|
|
624
|
+
# C6. 创建任务状态文件 (DISP-002)
|
|
625
|
+
# Teamee 创建后初始化对应的 task-{id}.json 文件
|
|
626
|
+
create_task_file(
|
|
627
|
+
task_id=task.id,
|
|
628
|
+
wp_id=assignment.wp_id,
|
|
629
|
+
teamee_name=teamee_name,
|
|
630
|
+
status="in_progress",
|
|
631
|
+
complexity_score=assignment.complexity_score
|
|
632
|
+
)
|
|
633
|
+
|
|
634
|
+
# ---- Phase C.5: 状态持久化写回 (teamee_map 变更) ----
|
|
635
|
+
state_payload_c5 = {
|
|
636
|
+
"team_name": team_name,
|
|
637
|
+
"teamee_map": teamee_map,
|
|
638
|
+
"wp_assignments": wp_assignments,
|
|
639
|
+
"start_time": start_time.isoformat() if hasattr(start_time, 'isoformat') else start_time,
|
|
640
|
+
"loop_iteration": loop_iteration,
|
|
641
|
+
"processed_action_ids": processed_action_ids,
|
|
642
|
+
"total_tasks": len(tasks),
|
|
643
|
+
"status": "monitoring",
|
|
644
|
+
"max_batch_size": max_batch_size,
|
|
645
|
+
"current_batch": current_batch,
|
|
646
|
+
"pending_batches": pending_batches,
|
|
647
|
+
"global_pause_flag": global_pause_flag
|
|
648
|
+
}
|
|
649
|
+
if is_multi_window:
|
|
650
|
+
state_payload_c5["window_id"] = window_id
|
|
651
|
+
state_payload_c5["session_id"] = multi_window_session
|
|
652
|
+
Write(file_path=state_file, content=json_dumps(state_payload_c5))
|
|
653
|
+
|
|
654
|
+
# ---- Phase D.1: 读取守护进程指令 (DISP-003) ----
|
|
655
|
+
# 在判断退出条件前,读取守护进程下发的指令
|
|
656
|
+
daemon_actions_path = ".claude-daemon/daemon-actions.json"
|
|
657
|
+
if file_exists(daemon_actions_path):
|
|
658
|
+
actions_data = Read(file_path=daemon_actions_path)
|
|
659
|
+
try:
|
|
660
|
+
actions = json_loads(actions_data).get("actions", [])
|
|
661
|
+
except Exception as e:
|
|
662
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
663
|
+
# 输出: "⚠️ 守护进程指令文件解析失败,跳过本轮指令: {e}"
|
|
664
|
+
actions = []
|
|
665
|
+
|
|
666
|
+
for action in actions:
|
|
667
|
+
# 检查指令是否已被处理
|
|
668
|
+
if action.get("id") in processed_action_ids:
|
|
669
|
+
continue
|
|
670
|
+
|
|
671
|
+
target_task_id = action.get("target_task")
|
|
672
|
+
action_type = action.get("action")
|
|
673
|
+
strategy = action.get("strategy", "full_restart")
|
|
674
|
+
reason = action.get("reason", "")
|
|
675
|
+
# 读取 Agentic Loop 下发的失败项明细(refine 通道,WP-176-6):
|
|
676
|
+
# 来源 skill-agentic-loop Step 4.2 的 dispatchTarget.failingDrivers,
|
|
677
|
+
# 每项 {wpId, category, item, reason};仅 retry/resplit 有值,dispatch 首次执行为空。
|
|
678
|
+
failing_drivers = action.get("failing_drivers", [])
|
|
679
|
+
|
|
680
|
+
if action_type == "restart":
|
|
681
|
+
# 重启指令: 逻辑销毁旧 Teamee → 创建新 Teamee
|
|
682
|
+
if target_task_id in teamee_map:
|
|
683
|
+
old_teamee = teamee_map[target_task_id]
|
|
684
|
+
|
|
685
|
+
# D1a. 逻辑销毁旧 Teamee(无协议帧)
|
|
686
|
+
markTeameeDestroyed(teamee_map, target_task_id)
|
|
687
|
+
|
|
688
|
+
# D1b. 根据策略创建新 Teamee
|
|
689
|
+
# 🔴 两种策略都注入 failing_drivers(refine 通道,WP-176-6):
|
|
690
|
+
# 让承接重做的 Teamee 知道"重点修哪些失败项",而非盲目原样重做。
|
|
691
|
+
assignment = wp_assignments[target_task_id]
|
|
692
|
+
new_teamee_name = f"{assignment.role_id}-t{target_task_id}-retry"
|
|
693
|
+
|
|
694
|
+
if strategy == "checkpoint_resume":
|
|
695
|
+
# 复杂任务: 注入已完成文件上下文 + 失败项重点修复段
|
|
696
|
+
context = action.get("context", {})
|
|
697
|
+
prompt = build_resume_prompt(
|
|
698
|
+
teamee_name=new_teamee_name,
|
|
699
|
+
task_id=target_task_id,
|
|
700
|
+
role_prompt=assignment.role_prompt,
|
|
701
|
+
completed_files=context.get("completed_files", []),
|
|
702
|
+
remaining=context.get("remaining", []),
|
|
703
|
+
failing_drivers=failing_drivers
|
|
704
|
+
)
|
|
705
|
+
else: # full_restart
|
|
706
|
+
# 简单任务: 从头执行(仍注入失败项重点修复段,区分 retry 与首次 dispatch)
|
|
707
|
+
prompt = build_refine_prompt(
|
|
708
|
+
teamee_name=new_teamee_name,
|
|
709
|
+
task_id=target_task_id,
|
|
710
|
+
role_prompt=assignment.role_prompt,
|
|
711
|
+
memories=assignment.memories,
|
|
712
|
+
wp_doc_path=assignment.wp_doc_path,
|
|
713
|
+
failing_drivers=failing_drivers
|
|
714
|
+
)
|
|
715
|
+
|
|
716
|
+
# D1c. 创建新 Teamee(自动加入 implicit session team,无需 team_name 参数)
|
|
717
|
+
Agent(
|
|
718
|
+
name=new_teamee_name,
|
|
719
|
+
subagent_type="general-purpose",
|
|
720
|
+
prompt=prompt
|
|
721
|
+
)
|
|
722
|
+
teamee_map[target_task_id] = new_teamee_name
|
|
723
|
+
|
|
724
|
+
# D1d. 更新重试计数
|
|
725
|
+
update_task_file(target_task_id, increment_retry=True)
|
|
726
|
+
|
|
727
|
+
# 标记指令已处理
|
|
728
|
+
processed_action_ids.append(action.get("id"))
|
|
729
|
+
|
|
730
|
+
elif action_type == "abort":
|
|
731
|
+
# 中止单个任务
|
|
732
|
+
if target_task_id in teamee_map:
|
|
733
|
+
teamee_name = teamee_map[target_task_id]
|
|
734
|
+
# 逻辑销毁(无协议帧)
|
|
735
|
+
markTeameeDestroyed(teamee_map, target_task_id)
|
|
736
|
+
update_task_file(target_task_id, status="failed")
|
|
737
|
+
processed_action_ids.append(action.get("id"))
|
|
738
|
+
|
|
739
|
+
elif action_type == "pause":
|
|
740
|
+
# 暂停创建新 Teamee(已有 Teamee 继续运行)
|
|
741
|
+
global_pause_flag = True
|
|
742
|
+
processed_action_ids.append(action.get("id"))
|
|
743
|
+
|
|
744
|
+
elif action_type == "abort_all":
|
|
745
|
+
# 全局中止: 逻辑销毁所有 Teamee,终止监控循环(无协议帧)
|
|
746
|
+
for task_id in list(teamee_map.keys()):
|
|
747
|
+
markTeameeDestroyed(teamee_map, task_id)
|
|
748
|
+
teamee_map.clear()
|
|
749
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
750
|
+
# 输出: "收到 abort_all 指令,终止监控循环"
|
|
751
|
+
processed_action_ids.append(action.get("id"))
|
|
752
|
+
break # 跳出监控循环
|
|
753
|
+
|
|
754
|
+
# D1e. 回写已处理的 iteration
|
|
755
|
+
if actions:
|
|
756
|
+
Write(file_path=daemon_actions_path, content=json_dumps({
|
|
757
|
+
"actions": [a for a in actions if a.get("id") not in processed_action_ids],
|
|
758
|
+
"last_processed_iteration": loop_iteration
|
|
759
|
+
}))
|
|
760
|
+
|
|
761
|
+
# ---- Phase D.5: 状态持久化写回 (processed_action_ids 变更) ----
|
|
762
|
+
state_payload_d5 = {
|
|
763
|
+
"team_name": team_name,
|
|
764
|
+
"teamee_map": teamee_map,
|
|
765
|
+
"wp_assignments": wp_assignments,
|
|
766
|
+
"start_time": start_time.isoformat() if hasattr(start_time, 'isoformat') else start_time,
|
|
767
|
+
"loop_iteration": loop_iteration,
|
|
768
|
+
"processed_action_ids": processed_action_ids,
|
|
769
|
+
"total_tasks": len(tasks),
|
|
770
|
+
"status": "monitoring",
|
|
771
|
+
"max_batch_size": max_batch_size,
|
|
772
|
+
"current_batch": current_batch,
|
|
773
|
+
"pending_batches": pending_batches,
|
|
774
|
+
"global_pause_flag": global_pause_flag
|
|
775
|
+
}
|
|
776
|
+
if is_multi_window:
|
|
777
|
+
state_payload_d5["window_id"] = window_id
|
|
778
|
+
state_payload_d5["session_id"] = multi_window_session
|
|
779
|
+
Write(file_path=state_file, content=json_dumps(state_payload_d5))
|
|
780
|
+
|
|
781
|
+
# ---- Phase D: 判断退出条件 ----
|
|
782
|
+
completed = count(status == "completed")
|
|
783
|
+
total = len(tasks)
|
|
784
|
+
|
|
785
|
+
if completed == total:
|
|
786
|
+
# 写入最终心跳 (DISP-001): 状态为 completed
|
|
787
|
+
heartbeat_data["status"] = "completed"
|
|
788
|
+
if is_multi_window:
|
|
789
|
+
heartbeat_data["window_id"] = window_id
|
|
790
|
+
Write(file_path=heartbeat_file, content=json_dumps(heartbeat_data))
|
|
791
|
+
# 写入最终状态文件
|
|
792
|
+
final_state = {
|
|
793
|
+
"team_name": team_name,
|
|
794
|
+
"teamee_map": teamee_map,
|
|
795
|
+
"wp_assignments": wp_assignments,
|
|
796
|
+
"start_time": start_time.isoformat() if hasattr(start_time, 'isoformat') else start_time,
|
|
797
|
+
"loop_iteration": loop_iteration,
|
|
798
|
+
"processed_action_ids": processed_action_ids,
|
|
799
|
+
"total_tasks": len(tasks),
|
|
800
|
+
"status": "completed",
|
|
801
|
+
"max_batch_size": max_batch_size,
|
|
802
|
+
"current_batch": current_batch,
|
|
803
|
+
"pending_batches": pending_batches
|
|
804
|
+
}
|
|
805
|
+
if is_multi_window:
|
|
806
|
+
final_state["window_id"] = window_id
|
|
807
|
+
final_state["session_id"] = multi_window_session
|
|
808
|
+
Write(file_path=state_file, content=json_dumps(final_state))
|
|
809
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
810
|
+
# 输出: "所有任务完成,退出监控循环"
|
|
811
|
+
break
|
|
812
|
+
|
|
813
|
+
# Phase D2: 异常检测
|
|
814
|
+
in_progress = count(status == "in_progress")
|
|
815
|
+
pending = count(status == "pending")
|
|
816
|
+
if pending > 0 and in_progress == 0 and len(teamee_map) == 0:
|
|
817
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
818
|
+
# 输出: "异常: 有待处理任务但无活跃 Teamee 且无映射"
|
|
819
|
+
break
|
|
820
|
+
|
|
821
|
+
# Phase D2-idle: idle 不执行检测(teamee_map 非空但 Task 长时间未推进)
|
|
822
|
+
# 与上方 len(teamee_map)==0 分支并列,互不替换。覆盖 WP-181 失效模式:
|
|
823
|
+
# Teamee 已 spawn 进映射表,但 Task 停在 pending、产物未生成、Teamee idle 不执行。
|
|
824
|
+
# 此时 len(teamee_map) != 0,原异常分支不触发,监控循环只能 sleep 到超时,
|
|
825
|
+
# Lead 处于"无指引"状态会被诱导直接接手——本分支禁止此行为(见 HARD-GATE 红线)。
|
|
826
|
+
#
|
|
827
|
+
# WP-183-2-impl F1-F4 联动修复:
|
|
828
|
+
# - F1: idle 产物判定改为弱信号(task 状态文件 last_update 长时间未变 + 无新增 progress_marker),
|
|
829
|
+
# 因 WP 文档体系当前无"预期产物路径"声明字段(assignment 亦无该字段),引入新字段会扩大
|
|
830
|
+
# 改动范围且与运行时不符,故降级并标注 TODO。expected_product_path() 伪函数见下方定义。
|
|
831
|
+
# - F2: idle 计时起点从任务状态文件 read_task_file(task_id)["started_at"] 读取——TaskList 的
|
|
832
|
+
# task 对象无 assigned_at/started_at 字段,原 fallback 链 task.assigned_at 恒 None。
|
|
833
|
+
# - F3: 催促去重位 idle_nudge_sent(任务状态文件),Step 1 前检查,已催促则跳过直接进 Step 2-3。
|
|
834
|
+
# - F4: 重 spawn 后 update_task_file(reset_started_at=True) 刷新 started_at + 重置 idle_nudge_sent,
|
|
835
|
+
# 新 Teamee 获得完整 idle_threshold 窗口。F3+F4 联动才能阻断"spawn 即判定 idle→每轮自愈→熔断"死亡螺旋。
|
|
836
|
+
idle_threshold = loop_interval * 2 # 建议取 loop_interval 的 2-3 倍或显式配置项
|
|
837
|
+
for task_id, teamee_name in list(teamee_map.items()):
|
|
838
|
+
task = find_by_id(tasks, task_id)
|
|
839
|
+
if task is None:
|
|
840
|
+
continue
|
|
841
|
+
# 双验证:TaskList(status 仍 pending/in_progress 未推进)+ 产物/进度弱信号
|
|
842
|
+
# 不只看 idle_notification(后者仅表示轮次结束,不代表做了任何工作)。
|
|
843
|
+
task_file = read_task_file(task_id) # F2: 权威时间源来自任务状态文件,非 TaskList task 对象
|
|
844
|
+
product_exists = Glob(expected_product_path(task)) # F1: 预期产物路径,见下方函数定义(无声明时返回 None 触发弱信号)
|
|
845
|
+
task_stalled = task.status in ("pending", "in_progress") and not product_exists
|
|
846
|
+
# F2: idle 计时起点 = 任务状态文件 started_at(TaskList task 对象无此字段)。
|
|
847
|
+
# 缺失时回退到 last_update,再缺失回退到 start_time(监控循环起点)。
|
|
848
|
+
assigned_at = task_file.get("started_at") or task_file.get("last_update") or start_time
|
|
849
|
+
# F3 去重位:本 idle 窗口内是否已催促过(重 spawn 后由 Step 4 重置)
|
|
850
|
+
idle_nudge_sent = task_file.get("idle_nudge_sent", False)
|
|
851
|
+
if task_stalled and (now() - assigned_at) >= idle_threshold:
|
|
852
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
853
|
+
# 输出: "⚠️ idle 检测: Teamee {teamee_name} (task {task_id}) 停滞 {idle_seconds}s 未推进产物,进入自愈流程"
|
|
854
|
+
# 进入自愈流程(Phase D2-idle-heal),绝不 Lead 接手
|
|
855
|
+
# ---- Phase D2-idle-heal: 自愈流程 ----
|
|
856
|
+
# Step 1: ≤1 次 SendMessage 催促验证(不空转多次催促,催促无效即认定失效)
|
|
857
|
+
# F3 去重 + 催促生效窗口:本 idle 窗口内仅催促一次,催促后给 Teamee 至少一个
|
|
858
|
+
# idle_threshold 窗口响应——首轮只催促(设 idle_nudge_sent=True)并结束本轮自愈,
|
|
859
|
+
# 不立即重 spawn;下一轮若仍 idle 且已催促,才跳过催促进入 Step 2-4 重 spawn。
|
|
860
|
+
# 缺失去重位/催促窗口会导致每轮重复催促 + 立即重 spawn,数轮内耗尽 max_retries 熔断。
|
|
861
|
+
if not idle_nudge_sent:
|
|
862
|
+
SendMessage(
|
|
863
|
+
to=teamee_name,
|
|
864
|
+
summary="idle 检测催促,请立即执行任务",
|
|
865
|
+
message=f"检测到任务 {task_id} 长时间未推进。请立即开始执行 WP 文档中的任务,完成后用 SendMessage 向 team-lead 发送完成报告。"
|
|
866
|
+
)
|
|
867
|
+
update_task_file(task_id, set_idle_nudge=True) # F3: 标记本窗口已催促
|
|
868
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
869
|
+
# 输出: "idle 自愈: task {task_id} 首轮催促已发,给 Teamee 一个 idle_threshold 窗口响应,本轮不重 spawn"
|
|
870
|
+
continue # 结束本轮自愈,下一轮若仍 idle 且已催促才进 Step 2-4
|
|
871
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
872
|
+
# 输出: "idle 自愈: task {task_id} 本窗口已催促过仍无推进,跳过催促直接进 Step 2-4 重 spawn"
|
|
873
|
+
# Step 2: 验证 spawn 参数(定位根因,避免原样重 spawn 仍 idle)
|
|
874
|
+
assignment = wp_assignments[task_id]
|
|
875
|
+
spawn_params_ok = (
|
|
876
|
+
assignment.subagent_type == "general-purpose"
|
|
877
|
+
and assignment.team_name == team_name
|
|
878
|
+
and task_id in assignment.prompt
|
|
879
|
+
and assignment.wp_doc_path in assignment.prompt
|
|
880
|
+
and "SendMessage" in assignment.prompt # prompt 须要求完成报告用 SendMessage
|
|
881
|
+
)
|
|
882
|
+
if not spawn_params_ok:
|
|
883
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
884
|
+
# 输出: "spawn 参数异常 (subagent_type/批次标签 team_name/prompt 完整性),将在重 spawn 时修正"
|
|
885
|
+
pass
|
|
886
|
+
# Step 3: 仍不执行 → 逻辑销毁旧 Teamee(无协议帧)
|
|
887
|
+
markTeameeDestroyed(teamee_map, task_id)
|
|
888
|
+
# Step 4: 检查 retry_count < max_retries → 重新 spawn(复用 636-710 restart 重 spawn 逻辑)
|
|
889
|
+
# 复用 idle 检测顶部已读取的 task_file(read_task_file 结果),避免重复 IO
|
|
890
|
+
retry_count = task_file.get("retry_count", 0)
|
|
891
|
+
max_retries = task_file.get("max_retries", 3)
|
|
892
|
+
if retry_count < max_retries:
|
|
893
|
+
# 重新 spawn 专用 Teamee(递增 retry_count),复用 restart 守护进程指令段的重 spawn 逻辑
|
|
894
|
+
new_teamee_name = f"{assignment.role_id}-t{task_id}-idle-retry"
|
|
895
|
+
prompt = build_refine_prompt(
|
|
896
|
+
teamee_name=new_teamee_name,
|
|
897
|
+
task_id=task_id,
|
|
898
|
+
role_prompt=assignment.role_prompt,
|
|
899
|
+
memories=assignment.memories,
|
|
900
|
+
wp_doc_path=assignment.wp_doc_path,
|
|
901
|
+
failing_drivers=[] # idle 重 spawn 非失败项修复,failing_drivers 为空
|
|
902
|
+
)
|
|
903
|
+
Agent( # 自动加入 implicit session team,无需 team_name 参数
|
|
904
|
+
name=new_teamee_name,
|
|
905
|
+
subagent_type="general-purpose",
|
|
906
|
+
prompt=prompt
|
|
907
|
+
)
|
|
908
|
+
teamee_map[task_id] = new_teamee_name
|
|
909
|
+
# F3+F4 联动:递增 retry_count + 刷新 started_at(F4,新 Teamee 获得完整 idle_threshold 窗口)
|
|
910
|
+
# + 重置 idle_nudge_sent=False(F3,新 Teamee 重新获得一次催促机会)。
|
|
911
|
+
# 单独刷新 started_at 而不重置去重位 → 新窗口仍无法催促;单独重置去重位而不刷新 started_at
|
|
912
|
+
# → 新 Teamee 一出生即满足 idle 阈值又被判定 idle。两者必须同一次调用完成(阻断死亡螺旋)。
|
|
913
|
+
update_task_file(
|
|
914
|
+
task_id,
|
|
915
|
+
increment_retry=True,
|
|
916
|
+
reset_started_at=True, # F4
|
|
917
|
+
set_idle_nudge=False # F3
|
|
918
|
+
)
|
|
919
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
920
|
+
# 输出: "idle 自愈: task {task_id} 重新 spawn 为 {new_teamee_name} (retry {retry_count+1}/{max_retries}),已刷新 started_at + 重置催促去重位"
|
|
921
|
+
else:
|
|
922
|
+
# Step 5: 超限 → 熔断,绝不 Lead 接手,转 Step 7 清理
|
|
923
|
+
TaskUpdate(taskId=task_id, status="failed")
|
|
924
|
+
update_task_file(task_id, status="failed")
|
|
925
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
926
|
+
# 输出: "🔴 idle 自愈超限: task {task_id} 重试 {retry_count}/{max_retries} 仍 idle,熔断标记 failed,绝不 Lead 接手,转 Step 7 清理"
|
|
927
|
+
|
|
928
|
+
# Phase D3: 批次自动加载 — 当前批次全部完成后从 pending_batches 加载下一批
|
|
929
|
+
if current_batch and len(teamee_map) == 0:
|
|
930
|
+
batch_completed = all(
|
|
931
|
+
find_by_id(tasks, tid).status == "completed" for tid in current_batch
|
|
932
|
+
if find_by_id(tasks, tid)
|
|
933
|
+
)
|
|
934
|
+
if batch_completed and pending_batches:
|
|
935
|
+
next_batch_size = min(max_batch_size, len(pending_batches))
|
|
936
|
+
current_batch = pending_batches[:next_batch_size]
|
|
937
|
+
pending_batches = pending_batches[next_batch_size:]
|
|
938
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
939
|
+
# 输出: "当前批次完成,自动加载下一批: {len(current_batch)} 个任务, 剩余 {len(pending_batches)} 个"
|
|
940
|
+
# 写回状态文件保存批次进度
|
|
941
|
+
state_payload_batch = {
|
|
942
|
+
"team_name": team_name,
|
|
943
|
+
"teamee_map": teamee_map,
|
|
944
|
+
"wp_assignments": wp_assignments,
|
|
945
|
+
"start_time": start_time.isoformat() if hasattr(start_time, 'isoformat') else start_time,
|
|
946
|
+
"loop_iteration": loop_iteration,
|
|
947
|
+
"processed_action_ids": processed_action_ids,
|
|
948
|
+
"total_tasks": len(tasks),
|
|
949
|
+
"status": "monitoring",
|
|
950
|
+
"max_batch_size": max_batch_size,
|
|
951
|
+
"current_batch": current_batch,
|
|
952
|
+
"pending_batches": pending_batches,
|
|
953
|
+
"global_pause_flag": global_pause_flag
|
|
954
|
+
}
|
|
955
|
+
if is_multi_window:
|
|
956
|
+
state_payload_batch["window_id"] = window_id
|
|
957
|
+
state_payload_batch["session_id"] = multi_window_session
|
|
958
|
+
Write(file_path=state_file, content=json_dumps(state_payload_batch))
|
|
959
|
+
|
|
960
|
+
sleep(loop_interval)
|
|
961
|
+
|
|
962
|
+
# 超时处理
|
|
963
|
+
if (now() - start_time) >= max_wait_time:
|
|
964
|
+
# 写入最终心跳 (DISP-001): 状态为 shutting_down
|
|
965
|
+
heartbeat_data["status"] = "shutting_down"
|
|
966
|
+
if is_multi_window:
|
|
967
|
+
heartbeat_data["window_id"] = window_id
|
|
968
|
+
Write(file_path=heartbeat_file, content=json_dumps(heartbeat_data))
|
|
969
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
970
|
+
# 输出: "监控超时,强制执行清理"
|
|
971
|
+
# 逻辑销毁所有残留 Teamee(无协议帧)
|
|
972
|
+
remaining_count = len(teamee_map)
|
|
973
|
+
for task_id in list(teamee_map.keys()):
|
|
974
|
+
markTeameeDestroyed(teamee_map, task_id)
|
|
975
|
+
# ── 状态输出(直接文本输出,禁止使用 SendMessage)──
|
|
976
|
+
# 输出: "监控超时,已逻辑销毁 {remaining_count} 个残留 Teamee,转入 Step 7 目录清理"
|
|
977
|
+
```
|
|
978
|
+
|
|
979
|
+
**上下文恢复协议**:
|
|
980
|
+
|
|
981
|
+
如果监控循环因上下文压缩(auto-compact)而中断,执行以下步骤恢复:
|
|
982
|
+
|
|
983
|
+
```
|
|
984
|
+
1. Read(".claude-daemon/dispatcher-state.json")
|
|
985
|
+
- 如果文件不存在: 说明首次运行或已清理,从头开始
|
|
986
|
+
- 如果文件存在且 status == "completed": 执行已完成,无需恢复
|
|
987
|
+
- 如果文件存在且 status == "monitoring": 进入恢复流程
|
|
988
|
+
|
|
989
|
+
2. 从文件恢复所有状态变量:
|
|
990
|
+
state = json_loads(Read(file_path=".claude-daemon/dispatcher-state.json"))
|
|
991
|
+
team_name = state["team_name"]
|
|
992
|
+
teamee_map = state["teamee_map"]
|
|
993
|
+
wp_assignments = state["wp_assignments"]
|
|
994
|
+
start_time = parse_iso8601(state["start_time"])
|
|
995
|
+
loop_iteration = state["loop_iteration"]
|
|
996
|
+
processed_action_ids = state["processed_action_ids"]
|
|
997
|
+
max_batch_size = state.get("max_batch_size", 5)
|
|
998
|
+
current_batch = state.get("current_batch", [])
|
|
999
|
+
pending_batches = state.get("pending_batches", [])
|
|
1000
|
+
|
|
1001
|
+
3. 验证恢复有效性:
|
|
1002
|
+
- 检查 team 配置是否仍然有效
|
|
1003
|
+
- 检查 teamee_map 中的 teamee 是否仍然活跃
|
|
1004
|
+
- 如果某个 teamee 已不存在,从映射表中移除
|
|
1005
|
+
|
|
1006
|
+
4. 继续监控循环(从恢复的 loop_iteration + 1 开始)
|
|
1007
|
+
```
|
|
1008
|
+
|
|
1009
|
+
**辅助函数 — 判断任务是否已解除阻塞**:
|
|
1010
|
+
```
|
|
1011
|
+
def is_unblocked(task):
|
|
1012
|
+
"""检查任务的所有 blockedBy 依赖是否都已满足"""
|
|
1013
|
+
if not task.blockedBy:
|
|
1014
|
+
return True
|
|
1015
|
+
all_tasks = TaskList()
|
|
1016
|
+
for blocker_id in task.blockedBy:
|
|
1017
|
+
blocker = find_by_id(all_tasks, blocker_id)
|
|
1018
|
+
if blocker.status != "completed":
|
|
1019
|
+
return False
|
|
1020
|
+
return True
|
|
1021
|
+
```
|
|
1022
|
+
|
|
1023
|
+
**辅助函数 — 并发控制**(Phase C 使用):
|
|
1024
|
+
```
|
|
1025
|
+
def get_max_concurrent(config, current_time):
|
|
1026
|
+
"""根据当前时间匹配 schedule,返回对应并发上限"""
|
|
1027
|
+
if not config or not config.get("schedules"):
|
|
1028
|
+
return config.get("default_max", 6) if config else 6
|
|
1029
|
+
|
|
1030
|
+
current_hhmm = current_time.strftime("%H:%M")
|
|
1031
|
+
for schedule in config["schedules"]:
|
|
1032
|
+
start = schedule["time_range"]["start"]
|
|
1033
|
+
end = schedule["time_range"]["end"]
|
|
1034
|
+
if is_time_in_range(current_hhmm, start, end):
|
|
1035
|
+
return schedule["max_concurrent"]
|
|
1036
|
+
|
|
1037
|
+
return config.get("default_max", 6)
|
|
1038
|
+
|
|
1039
|
+
def is_time_in_range(current, start, end):
|
|
1040
|
+
"""判断当前时间是否在范围内,支持跨午夜"""
|
|
1041
|
+
if start <= end:
|
|
1042
|
+
return start <= current < end
|
|
1043
|
+
else: # 跨午夜,如 22:00-06:00
|
|
1044
|
+
return current >= start or current < end
|
|
1045
|
+
```
|
|
1046
|
+
|
|
1047
|
+
**监控循环关键特性**:
|
|
1048
|
+
- **Phase B (即时销毁)** 在 Phase C (创建) 之前执行,确保资源先释放再分配
|
|
1049
|
+
- 每次循环都检查 `teamee_map` 防止重复创建/重复销毁
|
|
1050
|
+
- 异常检测同时检查 `teamee_map` 是否为空,避免误判
|
|
1051
|
+
|
|
1052
|
+
---
|
|
1053
|
+
|
|
1054
|
+
### Step 6.6: 守护进程辅助函数 (DISP-001/002/003)
|
|
1055
|
+
|
|
1056
|
+
守护进程集成的辅助函数(get_process_pid / now_iso8601 / create_task_file / 心跳写入等 DISP-001/002/003 全套实现)已外移至按需参考:
|
|
1057
|
+
|
|
1058
|
+
**执行守护进程集成步骤前,先 Read `daemon-helpers-reference.md`**(与 roles-reference.md 同级的渐进式加载约定)。监控循环本身(Step 6.5)不依赖本参考——仅实现 daemon 集成时加载。
|
|
1059
|
+
|
|
1060
|
+
### Step 7: 清理(逻辑销毁 + 历史残留目录可选清理)
|
|
1061
|
+
|
|
1062
|
+
> ⚠️ **implicit session team 模式下的清理语义**:
|
|
1063
|
+
> - **当前 session 的 implicit team 随 session 结束自动清理,无需 TeamDelete**(工具也已移除)。
|
|
1064
|
+
> - Lead 在 Step 6.5 已通过 `markTeameeDestroyed` 完成所有 Teamee 的逻辑销毁(映射表已空)。
|
|
1065
|
+
> - 本步骤主要职责:① 确认 `teamee_map` 已空;② 可选地用 `team-cleanup` CLI 清理**历史残留**的显式/UUID 团队目录(如旧的 `cybershop-wp101`),**而非当前 session team**。
|
|
1066
|
+
|
|
1067
|
+
**📖 在执行此步骤前,读取清理参考文档:**
|
|
1068
|
+
```
|
|
1069
|
+
Read("plugins/core/skill-agent-dispatcher/cleanup-reference.md")
|
|
1070
|
+
```
|
|
1071
|
+
|
|
1072
|
+
该文档包含:
|
|
1073
|
+
- **权限要求**: Bash 工具权限配置建议
|
|
1074
|
+
- **Step 7a-7h**: 完整清理流程(安全检查 → 逻辑销毁 → team-cleanup CLI → 验证)
|
|
1075
|
+
- **Error Handling**: 循环依赖、Teamee 失败、超时等错误处理
|
|
1076
|
+
- **Cleanup Guarantee**: 清理保障矩阵
|
|
1077
|
+
|
|
1078
|
+
---
|
|
1079
|
+
|
|
1080
|
+
## Teamee Prompt 模板
|
|
1081
|
+
|
|
1082
|
+
**📖 在创建 Teamee 时(Step 6 / Step 6.5),读取 Prompt 模板参考文档:**
|
|
1083
|
+
```
|
|
1084
|
+
Read("plugins/core/skill-agent-dispatcher/roles-reference.md")
|
|
1085
|
+
```
|
|
1086
|
+
|
|
1087
|
+
`roles-reference.md` 底部包含完整的 Teamee Prompt 模板,用于 `build_single_task_prompt()` 构建。
|
|
1088
|
+
模板要点:1:1 任务绑定、工作包文档优先阅读、完成后等待 shutdown_request、状态同步必须执行。
|
|
1089
|
+
|
|
1090
|
+
---
|
|
1091
|
+
|
|
1092
|
+
## 共享上下文机制
|
|
1093
|
+
|
|
1094
|
+
### 自动共享 (无需干预)
|
|
1095
|
+
|
|
1096
|
+
| 资源 | 共享方式 |
|
|
1097
|
+
|------|----------|
|
|
1098
|
+
| `CLAUDE.md` | 所有 Teamee 自动加载 |
|
|
1099
|
+
| Skills | 继承 Lead 的 skills |
|
|
1100
|
+
| MCP Servers | 共享相同的 MCP 配置 |
|
|
1101
|
+
| 项目代码 | 共享同一工作目录 |
|
|
1102
|
+
|
|
1103
|
+
### 主动共享 (通过 SendMessage)
|
|
1104
|
+
|
|
1105
|
+
> 注:Teamee 一经 spawn **自动加入 implicit session team**,无需 Lead 显式分配团队——SendMessage 与共享 Task List 的协作能力由 implicit session team 提供,未受 harness 团队机制变更影响。
|
|
1106
|
+
|
|
1107
|
+
| 消息类型 | 格式 | 用途 |
|
|
1108
|
+
|----------|------|------|
|
|
1109
|
+
| `shutdown_request` | (deprecated) | Lead 不再发 shutdown_request;harness 拦截含 protocol frame 的 SendMessage message |
|
|
1110
|
+
| `shutdown_response` | (deprecated) | 同上;Teamee 状态同步改为 TaskUpdate(completed) → Lead 检测 → markTeameeDestroyed → 批末 team-cleanup CLI |
|
|
1111
|
+
| 纯文本状态 | string + summary | Teamee 间/向 Lead 的进度沟通(唯一允许的 SendMessage 用途) |
|
|
1112
|
+
|
|
1113
|
+
---
|
|
1114
|
+
|
|
1115
|
+
## Dependency Analysis
|
|
1116
|
+
|
|
1117
|
+
### 依赖图构建
|
|
1118
|
+
|
|
1119
|
+
1. **读取工作包清单** - 获取所有待执行工作包
|
|
1120
|
+
2. **解析依赖声明** - 提取 `依赖: WP-XXX` 信息
|
|
1121
|
+
3. **构建有向图** - 节点=工作包,边=依赖关系
|
|
1122
|
+
4. **拓扑排序** - 确定执行顺序
|
|
1123
|
+
5. **检测循环依赖** - 如有循环则报错
|
|
1124
|
+
|
|
1125
|
+
### 循环依赖检测
|
|
1126
|
+
|
|
1127
|
+
```
|
|
1128
|
+
❌ 检测到循环依赖: WP-037 → WP-038 → WP-039 → WP-037
|
|
1129
|
+
(四位编号示例: WP-1037 → WP-1038 → WP-1039 → WP-1037)
|
|
1130
|
+
请手动解除依赖关系后重试。
|
|
1131
|
+
```
|
|
1132
|
+
|
|
1133
|
+
### 依赖分析输出规范
|
|
1134
|
+
|
|
1135
|
+
**⚠️ 依赖分析的输出必须且只能包含以下信息:**
|
|
1136
|
+
|
|
1137
|
+
1. 每个 WP 的 `blockedBy` 依赖关系(来自 WP 文档声明)
|
|
1138
|
+
2. 拓扑排序后的执行批次(哪些可以并行、哪些必须串行)
|
|
1139
|
+
3. 循环依赖检测结果
|
|
1140
|
+
|
|
1141
|
+
**禁止输出的内容:**
|
|
1142
|
+
- ❌ 各 WP 修改的文件列表或文件重叠分析
|
|
1143
|
+
- ❌ "WP-XXX~YYY 修改同一文件" 之类的陈述
|
|
1144
|
+
- ❌ 基于文件重叠的调度建议
|
|
1145
|
+
|
|
1146
|
+
**原因**: 文件冲突评估不属于 dispatcher 职责。如果 WP 之间需要串行,应在 WP 创建阶段通过 blockedBy 声明。
|
|
1147
|
+
|
|
1148
|
+
---
|
|
1149
|
+
|
|
1150
|
+
## File Conflict Policy
|
|
1151
|
+
|
|
1152
|
+
### 核心规则:1:1 映射不受文件冲突影响
|
|
1153
|
+
|
|
1154
|
+
| 规则 | 说明 |
|
|
1155
|
+
|------|------|
|
|
1156
|
+
| **绝对禁止** | 不得因多个 WP 修改同一文件而合并为单 agent |
|
|
1157
|
+
| **绝对禁止** | 不得自行添加基于文件重叠的 blockedBy 依赖 |
|
|
1158
|
+
| **唯一依据** | blockedBy 只来自 WP 文档中声明的依赖关系 |
|
|
1159
|
+
|
|
1160
|
+
### 正确处理方式
|
|
1161
|
+
|
|
1162
|
+
场景:WP-023, WP-024, WP-025 都修改 file.java,且都依赖 WP-022
|
|
1163
|
+
|
|
1164
|
+
- ❌ 错误:将 WP-023~025 合并到一个 agent 顺序执行
|
|
1165
|
+
- ✅ 正确:WP 创建阶段没有互相依赖 → 并行执行,每 WP 一个 Teamee
|
|
1166
|
+
- ✅ 正确:如果需要串行 → 回到 WP 创建阶段添加 blockedBy(WP-024 blockedBy WP-023)
|
|
1167
|
+
|
|
1168
|
+
### Forbidden Thoughts(文件冲突相关)
|
|
1169
|
+
|
|
1170
|
+
| Thought | Reality |
|
|
1171
|
+
|---------|---------|
|
|
1172
|
+
| "它们修改同一文件,应该合并" | ❌ 1:1 规则是绝对的,禁止合并 |
|
|
1173
|
+
| "并行编辑同一文件会冲突" | ❌ 这不是 dispatcher 应该关心的问题 |
|
|
1174
|
+
| "我应该为它们添加隐式依赖" | ❌ blockedBy 只来自 WP 文档声明 |
|
|
1175
|
+
| "出于安全考虑,应该串行执行" | ❌ 安全性由 WP 设计者负责,不由 dispatcher 覆盖 |
|
|
1176
|
+
|
|
1177
|
+
---
|
|
1178
|
+
|
|
1179
|
+
## Execution Report
|
|
1180
|
+
|
|
1181
|
+
批量执行完成后生成汇总报告,存放到 `docs/reports/` 目录。
|
|
1182
|
+
|
|
1183
|
+
### 报告命名规范
|
|
1184
|
+
|
|
1185
|
+
```
|
|
1186
|
+
docs/reports/{YYYY-MM-DD}_{工作包列表}_execution_report.md
|
|
1187
|
+
```
|
|
1188
|
+
|
|
1189
|
+
### 报告内容模板
|
|
1190
|
+
|
|
1191
|
+
```markdown
|
|
1192
|
+
# 批量执行报告
|
|
1193
|
+
|
|
1194
|
+
## 基本信息
|
|
1195
|
+
- 批次标签 (team_name): batch-20260314-WP073-075
|
|
1196
|
+
- 执行日期: 2026-03-14
|
|
1197
|
+
- 工作包: WP-073, WP-074, WP-075
|
|
1198
|
+
|
|
1199
|
+
## 执行总览
|
|
1200
|
+
|
|
1201
|
+
| Task ID | 工作包 | 角色 | 状态 | 依赖 | 说明 |
|
|
1202
|
+
|---------|--------|------|------|------|------|
|
|
1203
|
+
| #1 | WP-073 | godot-scene-expert | ✅ 完成 | - | - |
|
|
1204
|
+
| #2 | WP-074 | godot-script-expert | ✅ 完成 | #1 | - |
|
|
1205
|
+
| #3 | WP-075 | combat-ai-expert | ✅ 完成 | #2 | - |
|
|
1206
|
+
|
|
1207
|
+
## 详细结果
|
|
1208
|
+
(每个 WP 的执行者、子任务完成情况、文件变更)
|
|
1209
|
+
|
|
1210
|
+
## 📁 文件变更汇总
|
|
1211
|
+
新增: X 个 / 修改: Y 个 / 测试: Z 个
|
|
1212
|
+
|
|
1213
|
+
## 💡 新增经验
|
|
1214
|
+
(如有新经验,已写入角色专属库)
|
|
1215
|
+
|
|
1216
|
+
---
|
|
1217
|
+
报告生成时间: {timestamp}
|
|
1218
|
+
```
|
|
1219
|
+
|
|
1220
|
+
---
|
|
1221
|
+
|
|
1222
|
+
## 拆分工作包执行支持
|
|
1223
|
+
|
|
1224
|
+
当工作包有子工作包时,agent-dispatcher 会自动识别并按依赖调度。
|
|
1225
|
+
|
|
1226
|
+
### 执行流程
|
|
1227
|
+
|
|
1228
|
+
```
|
|
1229
|
+
1. 读取父工作包文档 (docs/wp/WP-XXX.md)
|
|
1230
|
+
2. 检测拆分模式 (simple/standard/fine-grained)
|
|
1231
|
+
3. 解析子工作包列表 + 依赖关系
|
|
1232
|
+
4. 创建 Task List 任务 + 设置 blockedBy
|
|
1233
|
+
5. 角色匹配 → 分配角色
|
|
1234
|
+
6. 按依赖顺序调度执行
|
|
1235
|
+
7. 验证关卡: verify 失败 → 停止后续; verify 通过 → 继续
|
|
1236
|
+
```
|
|
1237
|
+
|
|
1238
|
+
### 拆分模式处理
|
|
1239
|
+
|
|
1240
|
+
| 模式 | 处理方式 |
|
|
1241
|
+
|------|----------|
|
|
1242
|
+
| **simple** | 不拆分,直接作为单个任务调度 |
|
|
1243
|
+
| **standard** | 4 个子任务: impl → test → verify → review(依赖链) |
|
|
1244
|
+
| **fine-grained** | 按模块拆分多个 impl,每个独立 test,最后统一 verify + review |
|
|
1245
|
+
|
|
1246
|
+
---
|
|
1247
|
+
|
|
1248
|
+
## Integration with Other Skills
|
|
1249
|
+
|
|
1250
|
+
| Skill | 集成点 |
|
|
1251
|
+
|-------|--------|
|
|
1252
|
+
| `role-manager` | 查看角色、手动匹配 |
|
|
1253
|
+
| `human-checkpoint` | 批量执行前确认执行计划 |
|
|
1254
|
+
| `completion-report` | 批量执行后生成报告 |
|
|
1255
|
+
| `checklist` | 每个工作包完成后检查 |
|
|
1256
|
+
| `experience-logger` | 批量执行后记录经验 |
|
|
1257
|
+
| `task-creator` | 支持拆分工作包创建 |
|
|
1258
|
+
| `batch-task-creator` | 支持批量拆分 |
|
|
1259
|
+
|
|
1260
|
+
---
|
|
1261
|
+
|
|
1262
|
+
## Important
|
|
1263
|
+
|
|
1264
|
+
1. **implicit session team 自动提供协作能力** - 每个 session 自动有 implicit team,subagent 自动加入,共享 Task List + SendMessage 协作能力随之可用,**无需 TeamCreate**(工具已移除)。`team_name` 变量降级为 Lead 内部批次标签,不再驱动团队创建。
|
|
1265
|
+
2. **blockedBy 自动阻塞** - 依赖机制由 Task List 自动处理
|
|
1266
|
+
3. **Lead 按需分配 (1:1)** - 每个 WP 由 Lead 创建专用 Teamee 并预分配,禁止一个 Teamee 处理多个 WP
|
|
1267
|
+
4. **逻辑销毁 + 批末清理** - Teamee 完成后立即从映射表移除(markTeameeDestroyed,无协议帧);目录级清理在批末统一执行(team-cleanup CLI)
|
|
1268
|
+
5. **角色匹配提升质量** - 专业角色比通用代理更高效
|
|
1269
|
+
6. **记忆注入避免踩坑** - 从历史经验中学习
|
|
1270
|
+
7. **经验沉淀形成闭环** - 每次执行都让角色更聪明
|
|
1271
|
+
8. **🔴 Teamee 逻辑销毁是强制的,目录清理按需** - 无论成功/失败/超时,Lead 都必须通过 `markTeameeDestroyed` 清空 `teamee_map`(Step 6.5/Step 7 已保证);当前 session 的 implicit team 随 session 自动清理,**无需 TeamDelete**(工具已移除)。`team-cleanup` CLI 仅用于清理**历史残留**的显式/UUID 团队目录,定位为可选的运维清理工具。
|
|
1272
|
+
9. **🔴 监控循环不可跳过** - Lead 必须进入 Step 6.5 监控循环,负责动态创建和即时销毁
|
|
1273
|
+
10. **🔴 文件冲突不得触发合并** - 即使多个 WP 修改同一文件,也必须每 WP 一个 Teamee。blockedBy 依赖只以 WP 文档声明为准,禁止自行添加隐式依赖
|
|
1274
|
+
|
|
1275
|
+
---
|
|
1276
|
+
|
|
1277
|
+
<HARD-GATE>
|
|
1278
|
+
🔴 Lead 禁止直接接手执行 WP 内容(绝对红线,无任何例外)
|
|
1279
|
+
|
|
1280
|
+
无论任务多轻量、素材多齐备、是否线性链、有无并行收益,Lead 不得直接
|
|
1281
|
+
写 WP 产物(代码/文档/报告)。Teamee spawn 成功但 idle 不执行时,只能
|
|
1282
|
+
在 Teamee 机制内处理:
|
|
1283
|
+
- Phase D2-idle 检测触发 → ≤1 次 SendMessage 催促 → 排查 spawn 参数
|
|
1284
|
+
→ markTeameeDestroyed + retry_count < max_retries 时重新 spawn
|
|
1285
|
+
→ 超限熔断 TaskUpdate(status="failed")
|
|
1286
|
+
- 绝不 fallback 到 Lead 自己写产物(无任何 Lead 接手分支)
|
|
1287
|
+
|
|
1288
|
+
WP-181 的 Lead 接手完成是被用户明确否决的反例,不得作为先例引用。
|
|
1289
|
+
依据:记忆 teamee-spawn-idle-no-execution("绝对禁止 Lead 接手")、
|
|
1290
|
+
记忆 teamee-report-needs-sendmessage(Teamee 报告须用 SendMessage)
|
|
1291
|
+
</HARD-GATE>
|