helloagents 3.0.7 → 3.0.9-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +6 -6
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +65 -58
- package/README_CN.md +60 -53
- package/bootstrap-lite.md +46 -28
- package/bootstrap.md +51 -34
- package/gemini-extension.json +1 -1
- package/package.json +12 -2
- package/scripts/capability-registry.mjs +9 -9
- package/scripts/cli-codex-config.mjs +49 -55
- package/scripts/cli-codex.mjs +69 -77
- package/scripts/cli-doctor.mjs +26 -18
- package/scripts/cli-host-detect.mjs +18 -2
- package/scripts/cli-messages.mjs +1 -1
- package/scripts/cli-toml.mjs +30 -0
- package/scripts/delivery-gate.mjs +5 -4
- package/scripts/guard-rules.mjs +26 -1
- package/scripts/guard.mjs +43 -14
- package/scripts/notify-context.mjs +30 -33
- package/scripts/notify-route.mjs +5 -2
- package/scripts/notify-source.mjs +3 -60
- package/scripts/notify.mjs +43 -11
- package/scripts/project-storage.mjs +107 -15
- package/scripts/session-token.mjs +73 -0
- package/scripts/turn-state.mjs +173 -0
- package/scripts/workflow-core.mjs +19 -11
- package/scripts/workflow-plan-files.mjs +17 -6
- package/scripts/workflow-recommendation.mjs +14 -14
- package/scripts/workflow-state.mjs +14 -14
- package/skills/_meta/SKILL.md +1 -1
- package/skills/commands/auto/SKILL.md +24 -9
- package/skills/commands/build/SKILL.md +4 -4
- package/skills/commands/clean/SKILL.md +3 -3
- package/skills/commands/commit/SKILL.md +1 -1
- package/skills/commands/help/SKILL.md +3 -3
- package/skills/commands/idea/SKILL.md +2 -2
- package/skills/commands/init/SKILL.md +13 -8
- package/skills/commands/loop/SKILL.md +4 -4
- package/skills/commands/plan/SKILL.md +13 -11
- package/skills/commands/prd/SKILL.md +10 -8
- package/skills/commands/verify/SKILL.md +5 -5
- package/skills/commands/wiki/SKILL.md +9 -11
- package/skills/hello-review/SKILL.md +1 -1
- package/skills/hello-subagent/SKILL.md +3 -2
- package/skills/hello-ui/SKILL.md +13 -13
- package/skills/hello-verify/SKILL.md +6 -5
- package/skills/helloagents/SKILL.md +17 -12
package/bootstrap.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
在受限 CLI(如工作区限制导致家目录不可读)中,确需读取但失败时必须明确说明,并按默认值或当前已知设置执行;禁止静默回退或假装读取成功。
|
|
11
11
|
|
|
12
12
|
## 编码原则
|
|
13
|
-
-
|
|
13
|
+
- 代码是唯一判断依据,文档与代码不一致时以代码为准
|
|
14
14
|
- 代码体积控制:
|
|
15
15
|
- 预警阈值(超过后必须评估是否拆分):文件/类 300 行,函数/方法 40 行
|
|
16
16
|
- 强制拆分阈值(超过后必须在完成功能后按职责拆分):文件/类 400 行,函数/方法 60 行
|
|
@@ -46,17 +46,17 @@
|
|
|
46
46
|
- 不确定的技术选型主动查阅最新文档和社区最佳实践,不依赖旧版本知识
|
|
47
47
|
- 项目已有技术栈、设计系统或方案包时必须遵循既有决策
|
|
48
48
|
|
|
49
|
-
### UI
|
|
50
|
-
|
|
49
|
+
### UI 质量基线(涉及视觉/交互任务时,全阶段生效)
|
|
50
|
+
任务涉及界面视觉、交互体验、页面结构、组件外观、信息呈现或设计需求时,统一遵循以下基线;适用于标准模式、标准模式+已激活项目与全局模式。
|
|
51
51
|
纯逻辑修复、纯文案修改、纯数据处理、纯后端实现等不涉及视觉/交互变化的任务,不触发本节;项目已有更高优先级的 UI 契约时,只用本节兜底,不得覆盖上层决策。
|
|
52
52
|
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
53
|
+
- 先判断本次视觉变更是延续既有风格、演进式优化还是探索性方案,再形成简短但明确的内部设计简报:界面目的、目标用户与场景、主要视口、情绪方向、记忆点;不得直接滑入泛化风格标签或模型默认审美
|
|
54
|
+
- 已有项目优先复用现有组件、token、品牌资产、内容语气与交互模式;先建立最小设计系统:至少明确背景/表面/正文/弱化/强调/语义色,以及 display/headline/body/caption 等排版角色;缺少关键设计上下文时明确说明,不凭空发明视觉语言
|
|
55
|
+
- 使用真实内容与真实信息层级,不使用 Lorem ipsum、泛化营销套话或无意义占位图;不为撑满页面编造统计、图标、区块或伪功能;缺少素材时使用明确占位或请求补充,不低质量仿制
|
|
56
56
|
- 结构必须有清晰层级与节奏:每个区块只承担一个核心职责;主界面或首屏形成完整构图;默认克制卡片、徽章、分隔线和装饰元素的滥用
|
|
57
57
|
- 交互必须覆盖关键状态:加载、空、错误、成功、禁用、危险态;动效只服务于引导、反馈和层级切换,不做无意义噪音
|
|
58
58
|
- 可用性必须同步达标:响应式/自适应、可访问性、可见焦点、键盘可达、触控/点击目标、减弱动效偏好,不能在视觉升级时牺牲可用性
|
|
59
|
-
-
|
|
59
|
+
- 若宿主已有浏览器或截图能力,尽早检查关键视口与交互状态;否则至少基于代码与结构做一次明确的视觉自检,确认实现与设计意图一致
|
|
60
60
|
|
|
61
61
|
仅保留以下必要反模式下限:
|
|
62
62
|
- 默认紫白渐变、白底卡片堆砌、Inter/Roboto/Arial 等默认字体栈、emoji 当图标、纯色平背景
|
|
@@ -89,8 +89,16 @@
|
|
|
89
89
|
- 不允许吞掉错误:捕获的异常必须处理或上报,不能空 catch 后继续
|
|
90
90
|
|
|
91
91
|
## 输出格式
|
|
92
|
-
|
|
93
|
-
当 output_format 为
|
|
92
|
+
适用条件:
|
|
93
|
+
- 当 `helloagents.json` 的 `output_format` 为 `true` 时,主代理仅可在本轮最后一条、且确认**不再继续调用工具、不再继续执行**的**收尾消息**中使用输出格式。
|
|
94
|
+
- 若某个 skill 在本轮明确要求输出停顿、确认或总结,也仅当该消息同时是**本轮最终收尾消息**时,才可使用输出格式。
|
|
95
|
+
|
|
96
|
+
排除条件:
|
|
97
|
+
- 当 `output_format` 为 `false` 时,所有回复保持自然输出,不得使用输出格式。
|
|
98
|
+
- 以下内容一律视为中间输出,必须自然输出,不得使用输出格式:流式输出阶段的可见文本、思考/进度说明、工具调用前的说明、工具执行中的状态汇报,以及任何发出后仍会继续调用工具或继续执行的回复。
|
|
99
|
+
- 子代理在任何场景下都不得使用输出格式。
|
|
100
|
+
|
|
101
|
+
输出格式:
|
|
94
102
|
|
|
95
103
|
{图标}【HelloAGENTS】- {状态描述}
|
|
96
104
|
{空一行}
|
|
@@ -98,11 +106,19 @@
|
|
|
98
106
|
{空一行}
|
|
99
107
|
🔄 下一步: {下一步状态或动作}
|
|
100
108
|
|
|
101
|
-
|
|
109
|
+
图标:💡直接响应 | ⚡快速执行 | 🔵规划流程 | ✅完成 | ❓等待输入 | ⚠️警告 | ❌错误
|
|
110
|
+
|
|
111
|
+
使用约束:
|
|
112
|
+
- 状态图标与收尾内容必须一致。等待用户输入、确认、授权或补充信息时,只能使用 `❓等待输入`;仅在本轮执行已完成且不再等待用户输入时,才能使用 `✅完成`。
|
|
113
|
+
- `🔄 下一步` 必须填写当前最合适的下一步动作。若存在自然后续动作,直接给出明确引导;若当前任务已完整结束且确无合理后续,可填写“当前任务已完成,等待您的下一步指示。”
|
|
114
|
+
- 禁止在主体内容或 `🔄 下一步` 中加入无意义的客套、邀约、重复确认、能力陈述或空泛建议;不得把可直接给出的后续动作改写成条件式能力表述或询问句。
|
|
102
115
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
116
|
+
### 收尾状态信号
|
|
117
|
+
- 为避免运行时从自然语言、图标或格式反推“完成 / 等待输入”,主代理在本轮最终收尾前必须先调用 `scripts/turn-state.mjs write`
|
|
118
|
+
- 本轮已完成且不再等待用户输入 → 写 `kind=complete`、`role=main`
|
|
119
|
+
- 因阻塞判定等待用户输入、确认、授权或补充信息 → 写 `kind=waiting`、`role=main`
|
|
120
|
+
- 因错误、缺少前置条件或外部依赖而本轮停下 → 写 `kind=blocked`、`role=main`
|
|
121
|
+
- 子代理不得写 turn-state;子代理结束只直接返回结果,不为主代理代写完成态
|
|
106
122
|
|
|
107
123
|
## 交互规则
|
|
108
124
|
|
|
@@ -139,7 +155,7 @@
|
|
|
139
155
|
以下情况才构成中途停下并请求用户输入的正当理由:
|
|
140
156
|
- 需求存在影响执行结果的真实歧义
|
|
141
157
|
- 缺少继续执行所必需的信息、文件、路径或凭据
|
|
142
|
-
-
|
|
158
|
+
- 将产生外部副作用,但本轮尚未获得对应授权
|
|
143
159
|
- 操作属于高风险或不可逆,按安全规则必须确认
|
|
144
160
|
除上述情况外,默认继续执行,不以“建议下一步”替代实际推进。
|
|
145
161
|
|
|
@@ -167,7 +183,7 @@
|
|
|
167
183
|
- 结构化规划 / 新功能 / 新项目 → `~plan`
|
|
168
184
|
- 完整产品规格 → `~prd`
|
|
169
185
|
- 审查 / 执行验证 → `~verify`
|
|
170
|
-
-
|
|
186
|
+
- 不确定或希望端到端自动推进时由 `~auto` 自动编排
|
|
171
187
|
|
|
172
188
|
当前项目只要已建立 `.helloagents/`(例如执行过 `~wiki`、`~init`,或已进入项目级连续流程),就按项目级完整流程执行。
|
|
173
189
|
|
|
@@ -181,10 +197,13 @@
|
|
|
181
197
|
|
|
182
198
|
### 3. PLAN — 规划与上下文准备
|
|
183
199
|
根据 skills/ 目录下各 hello-* 技能的 SKILL.md frontmatter(name + description),标记本次任务可能需要的技能(不读取文件内容,仅记录名称)。
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
200
|
+
路径定义:`{HELLOAGENTS_READ_ROOT}` = 本轮已确定的 HelloAGENTS 读取根目录
|
|
201
|
+
先确定当前技能根目录:
|
|
202
|
+
- 优先使用当前上下文中已注入的“本轮 HelloAGENTS 读取根目录”
|
|
203
|
+
- 若当前上下文未注入,则将当前宿主 home 目录下的 `helloagents/` 链接作为 `{HELLOAGENTS_READ_ROOT}`
|
|
204
|
+
- 已激活项目或全局模式下,技能是否需要使用由当前已加载 AGENTS 规则决定;不要因此额外探测项目目录里的 HelloAGENTS skills 路径
|
|
205
|
+
路径确定一次即可,不预读、不扫描整个目录,也不重复探测同一路径。
|
|
206
|
+
hello-* 技能读取路径:`{HELLOAGENTS_READ_ROOT}/skills/{技能名}/SKILL.md`
|
|
188
207
|
|
|
189
208
|
命令职责:
|
|
190
209
|
- `~plan` 生成 `requirements.md`、`plan.md`、`tasks.md`、`contract.json`
|
|
@@ -217,7 +236,7 @@ hello-* 技能查找路径(按优先级,找到即停):
|
|
|
217
236
|
### 6. CONSOLIDATE — 状态、沉淀与归档
|
|
218
237
|
所有任务:
|
|
219
238
|
- 有方案包且准备报告完成 → 优先调用 `scripts/closeout-state.mjs write` 写 `.helloagents/.ralph-closeout.json`,记录“需求覆盖”和“交付清单”;每项写明 `PASS` / `BLOCKED` 与简要摘要,再进入最终交付
|
|
220
|
-
- `STATE.md`
|
|
239
|
+
- `STATE.md` 维护:按上文“流程状态”中的适用边界执行。属于“强制创建并持续更新”范围时,重写当前 `STATE.md`(始终使用当前项目存储中的 `state_path`;“正在做什么”更新为已完成,清空关键上下文 / 下一步 / 阻塞项);属于“已有则更新”范围时,仅在文件已存在时重写;属于“不创建”范围时不生成此文件
|
|
221
240
|
- 有方案包且任务已完成 → 将整个 `plans/{feature}/` 目录归档到 `.helloagents/archive/YYYY-MM/`,并更新 `archive/_index.md`。清理临时文件(`loop-results.tsv`、`.ralph-breaker.json`、`.ralph-verify.json`、`.ralph-review.json`、`.ralph-closeout.json`)
|
|
222
241
|
- 按 `kb_create_mode` 同步知识库(0=关闭 / 1=已激活项目或全局模式中编码自动 / 2=已激活项目或全局模式中始终):
|
|
223
242
|
- `.helloagents/` 不存在则按 templates/ 创建知识库文件(`context.md`、`guidelines.md`、`verify.yaml`、`CHANGELOG.md`、`modules/`)
|
|
@@ -236,23 +255,21 @@ hello-* 技能查找路径(按优先级,找到即停):
|
|
|
236
255
|
- 必须进入规划(不可跳过):新项目 / 新应用 / 从零构建 / 涉及 3+ 文件的新功能 / 架构级变更
|
|
237
256
|
- 创意探索、显式验证/审查、完整规格等其他分流,均按 ROUTE / TIER 的命令映射执行
|
|
238
257
|
- `~do` 是 `~build` 的兼容别名;`~design` 是 `~plan` 的兼容别名;`~review` 是 `~verify` 的兼容别名
|
|
239
|
-
- `~command` 路由:用户输入 `~xxx` 时,立即读取对应的 SKILL.md
|
|
240
|
-
1. {CWD}/skills/helloagents/skills/commands/{name}/SKILL.md
|
|
241
|
-
2. 当前已加载 HelloAGENTS 包根目录下的 skills/commands/{name}/SKILL.md
|
|
258
|
+
- `~command` 路由:用户输入 `~xxx` 时,立即读取对应的 SKILL.md 并按其流程执行,不要自行探索或猜测。若当前上下文已解析出具体命令技能文件路径,直接使用它;否则按上文相同的技能根目录规则确定,确定根目录后读取其中的 `skills/commands/{name}/SKILL.md`。不要额外探测项目目录里的 HelloAGENTS skills 路径,也不要扫描整个目录或对同一命令重复探测多个路径。
|
|
242
259
|
|
|
243
260
|
## .helloagents/ 目录
|
|
244
261
|
路径: {CWD}/.helloagents/
|
|
245
262
|
所有文件的创建和更新必须按 templates/ 目录中对应模板的格式执行,不可自由发挥格式。
|
|
246
263
|
说明:
|
|
247
|
-
- `.helloagents/`
|
|
264
|
+
- `.helloagents/` 表示项目级存储路径,也是 standby 模式的激活信号
|
|
248
265
|
- `STATE.md`、`.ralph-*.json`、`loop-results.tsv` 等运行态文件始终保留在项目本地 `.helloagents/`
|
|
249
|
-
-
|
|
266
|
+
- 当前 `STATE.md` 只认当前项目存储中的 `state_path`;支持会话标识时,它会落在 `.helloagents/sessions/{branch}/{session}/STATE.md`,未提供稳定会话标识时则落到 `.helloagents/sessions/{branch}/default/STATE.md`
|
|
267
|
+
- 若 helloagents.json 中 `project_store_mode = "repo-shared"`,`context.md`、`guidelines.md`、`CHANGELOG.md`、`verify.yaml`、`DESIGN.md`、`modules/`、`plans/`、`archive/` 改按当前上下文中已注入的“当前项目存储”/“项目知识/方案目录”解析;未注入具体路径时,按当前存储模式自行解析,不要假定这些文件一定实际位于当前工作树中
|
|
250
268
|
templates/ 查找路径(按优先级;首次确定模板根目录后,本轮复用):
|
|
251
|
-
|
|
252
|
-
2. 当前已加载 HelloAGENTS 包根目录下的 templates/
|
|
269
|
+
按上文相同的技能根目录规则确定;确定根目录后读取其中的 `templates/`。
|
|
253
270
|
|
|
254
271
|
### 流程状态(不受 kb_create_mode 控制,始终可写)
|
|
255
|
-
- STATE.md — ≤70
|
|
272
|
+
- STATE.md — ≤70 行,项目级恢复快照。它只用于恢复“上次做到哪里”,不是主线任务的唯一判断依据;当前用户消息、显式命令、活跃方案包 / PRD、代码与验证证据优先于 STATE.md
|
|
256
273
|
内容:主线目标、正在做什么、关键上下文(决策/变更/假设)、下一步(具体可执行动作含文件路径)、阻塞项
|
|
257
274
|
适用边界:
|
|
258
275
|
- 强制创建并持续更新:`~wiki`、`~init`、`~plan`、`~build`、`~auto`、`~prd`、`~loop`,以及进入统一执行流程/已激活项目的连续任务
|
|
@@ -291,20 +308,20 @@ templates/ 查找路径(按优先级;首次确定模板根目录后,本轮
|
|
|
291
308
|
|
|
292
309
|
## 项目上下文
|
|
293
310
|
|
|
294
|
-
|
|
311
|
+
主线判断依据优先级:
|
|
295
312
|
1. 当前用户最新消息、显式 `~command`、本轮已确认的范围与结论
|
|
296
313
|
2. 当前活跃方案包 / PRD、代码与验证证据
|
|
297
|
-
3.
|
|
314
|
+
3. 当前 `STATE.md`(始终取当前项目存储中的 `state_path`;恢复快照,只用于补齐最近进度)
|
|
298
315
|
4. 其他知识沉淀与历史归档
|
|
299
316
|
|
|
300
317
|
### .helloagents/ 文件读取优先级
|
|
301
318
|
以下文件在任务需要时按需读取,按优先级分层:
|
|
302
319
|
说明:
|
|
303
|
-
- Tier 1 的 `STATE.md`
|
|
304
|
-
- Tier 2 / Tier 3 中的 `.helloagents/...`
|
|
320
|
+
- Tier 1 的 `STATE.md` 始终读取当前项目存储中的 `state_path`
|
|
321
|
+
- Tier 2 / Tier 3 中的 `.helloagents/...` 路径默认按项目级存储路径解析;`project_store_mode=repo-shared` 时按共享知识/方案目录解析
|
|
305
322
|
|
|
306
323
|
Tier 1 — 恢复当前链路时优先读取:
|
|
307
|
-
-
|
|
324
|
+
- 当前 `STATE.md` → 恢复快照(始终取当前项目存储中的 `state_path`;先确认当前消息仍是同一任务,再用它找回最近进度)
|
|
308
325
|
|
|
309
326
|
Tier 2 — 理解项目时读取:
|
|
310
327
|
- .helloagents/context.md → 项目架构、技术栈、目录结构、模块索引
|
|
@@ -318,7 +335,7 @@ Tier 3 — 深入特定模块时读取:
|
|
|
318
335
|
- .helloagents/archive/ → 历史方案归档
|
|
319
336
|
|
|
320
337
|
### 项目文件
|
|
321
|
-
|
|
338
|
+
根据知识库中的架构描述和模块索引,结合当前任务需求,按需读取相关的项目源码、配置和资源文件。不要一次性读取整个项目,先通过知识库了解项目结构,再有针对性地读取需要的文件。不要把项目级规则文件(`AGENTS.md`、`CLAUDE.md`、`.gemini/GEMINI.md`)当作普通项目文件重复读取。
|
|
322
339
|
|
|
323
340
|
## 状态符号
|
|
324
341
|
任务状态: [ ] 待办 | [√] 完成 | [X] 取消 | [-] 跳过
|
package/gemini-extension.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "helloagents",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.9-beta.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "HelloAGENTS — The orchestration kernel that makes any AI CLI smarter. Adds intelligent routing, quality verification (Ralph Loop), safety guards, and notifications.",
|
|
6
6
|
"author": "HelloWind",
|
|
@@ -36,7 +36,17 @@
|
|
|
36
36
|
".claude-plugin/",
|
|
37
37
|
".codex-plugin/"
|
|
38
38
|
],
|
|
39
|
-
"keywords": [
|
|
39
|
+
"keywords": [
|
|
40
|
+
"ai",
|
|
41
|
+
"agent",
|
|
42
|
+
"claude",
|
|
43
|
+
"codex",
|
|
44
|
+
"cli",
|
|
45
|
+
"orchestration",
|
|
46
|
+
"subagent",
|
|
47
|
+
"hooks",
|
|
48
|
+
"skills"
|
|
49
|
+
],
|
|
40
50
|
"engines": {
|
|
41
51
|
"node": ">=18"
|
|
42
52
|
}
|
|
@@ -8,9 +8,9 @@ function getPrimaryPlan(snapshot) {
|
|
|
8
8
|
return snapshot.activePlans[0] || snapshot.plans[0] || null
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export function selectCapabilities({ cwd, skillName = '' }) {
|
|
12
|
-
const snapshot = getWorkflowSnapshot(cwd)
|
|
13
|
-
const recommendation = getWorkflowRecommendation(cwd)
|
|
11
|
+
export function selectCapabilities({ cwd, skillName = '', options = {} }) {
|
|
12
|
+
const snapshot = getWorkflowSnapshot(cwd, options)
|
|
13
|
+
const recommendation = getWorkflowRecommendation(cwd, options)
|
|
14
14
|
const plan = getPrimaryPlan(snapshot)
|
|
15
15
|
const advisorRequirement = getAdvisorRequirement(plan?.contract)
|
|
16
16
|
const visualRequirement = getVisualValidationRequirement(plan?.contract)
|
|
@@ -19,15 +19,15 @@ export function selectCapabilities({ cwd, skillName = '' }) {
|
|
|
19
19
|
if (skillName === 'plan' || skillName === 'prd' || recommendation?.nextCommand === 'plan') {
|
|
20
20
|
capabilities.push({
|
|
21
21
|
id: 'plan-contract',
|
|
22
|
-
description: '
|
|
22
|
+
description: '结构化契约:仅在规划/PRD 场景使用 `scripts/plan-contract.mjs write` 写 `contract.json`,不要只把验证路径留在自然语言说明里。',
|
|
23
23
|
})
|
|
24
24
|
}
|
|
25
25
|
if (advisorRequirement.required) {
|
|
26
26
|
capabilities.push({
|
|
27
27
|
id: 'advisor-artifact',
|
|
28
28
|
description: advisorRequirement.styleRequired
|
|
29
|
-
? '风格 advisor:当前 UI
|
|
30
|
-
: '独立 advisor
|
|
29
|
+
? '风格 advisor:当前 UI 契约要求进入收尾前复查设计方向,并复用 `.helloagents/.ralph-advisor.json` 记录 reason、focus、consultedSources 与结论。'
|
|
30
|
+
: '独立 advisor:当前契约要求进入收尾前写 `.helloagents/.ralph-advisor.json`,记录 advisor reason、focus、consultedSources 与结论。',
|
|
31
31
|
})
|
|
32
32
|
}
|
|
33
33
|
if (plan?.contract?.verifyMode === 'review-first') {
|
|
@@ -45,15 +45,15 @@ export function selectCapabilities({ cwd, skillName = '' }) {
|
|
|
45
45
|
if (visualRequirement.required) {
|
|
46
46
|
capabilities.push({
|
|
47
47
|
id: 'visual-evaluator',
|
|
48
|
-
description: '视觉验收:当前 UI
|
|
48
|
+
description: '视觉验收:当前 UI 契约要求进入收尾前写 `.helloagents/.ralph-visual.json`,记录 tooling、screensChecked、statesChecked、status 与 summary。',
|
|
49
49
|
})
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
return capabilities
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
export function buildCapabilityHint({ cwd, skillName = '' }) {
|
|
56
|
-
const capabilities = selectCapabilities({ cwd, skillName })
|
|
55
|
+
export function buildCapabilityHint({ cwd, skillName = '', options = {} }) {
|
|
56
|
+
const capabilities = selectCapabilities({ cwd, skillName, options })
|
|
57
57
|
if (capabilities.length === 0) return ''
|
|
58
58
|
return `按需能力:${capabilities.map((entry) => `${entry.id}=${entry.description}`).join(' ')}`
|
|
59
59
|
}
|
|
@@ -1,32 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
readCodexBackup,
|
|
4
|
-
removeCodexBackup,
|
|
5
|
-
} from './cli-codex-backup.mjs'
|
|
6
|
-
import { safeWrite } from './cli-utils.mjs'
|
|
7
|
-
import {
|
|
8
|
-
ensureTopLevelTomlBlock,
|
|
9
|
-
readTopLevelTomlBlock,
|
|
2
|
+
prependTopLevelTomlBlocks,
|
|
10
3
|
removeTopLevelTomlBlock,
|
|
11
4
|
stripTomlSection,
|
|
12
|
-
upsertTopLevelTomlBlock,
|
|
13
5
|
} from './cli-toml.mjs'
|
|
14
6
|
|
|
15
7
|
export const CODEX_PLUGIN_CONFIG_HEADER = '[plugins."helloagents@local-plugins"]'
|
|
16
8
|
export const CODEX_MANAGED_TOML_COMMENT = '# helloagents-managed'
|
|
17
|
-
const CODEX_DEVELOPER_INSTRUCTIONS_BACKUP_BASENAME = 'developer_instructions'
|
|
18
|
-
|
|
19
|
-
export const CODEX_DEVELOPER_INSTRUCTIONS = `CRITICAL: These are HelloAGENTS global defaults for Codex. Use them as the baseline for main-agent behavior. Spawned sub-agents should focus on the delegated task unless they are explicitly required to follow main-agent-only workflow.
|
|
20
|
-
If the current workspace contains a project-level AGENTS.md or other repo-specific instructions, treat those as the more specific and authoritative instructions. Use these global defaults only where they do not conflict. Standby/global behavior is determined by the active workspace instructions, not by this global default block.
|
|
21
|
-
If work was already in progress and earlier context was compressed, first restore the active project state from the most relevant project state files or other project-local context artifacts, then continue from the actual interruption point without restarting the workflow or repeating completed steps.`
|
|
22
|
-
|
|
23
|
-
export function isManagedCodexStandbyInstructionPath(normalized = '') {
|
|
24
|
-
return /\/\.codex\/helloagents\/bootstrap-lite\.md/i.test(normalized)
|
|
25
|
-
}
|
|
26
9
|
|
|
27
|
-
|
|
28
|
-
return
|
|
29
|
-
|| /\/plugins\/helloagents\/bootstrap\.md/i.test(normalized)
|
|
10
|
+
function normalizePath(value = '') {
|
|
11
|
+
return String(value || '').replace(/\\/g, '/')
|
|
30
12
|
}
|
|
31
13
|
|
|
32
14
|
export function upsertCodexPluginConfig(text) {
|
|
@@ -40,61 +22,73 @@ export function removeCodexPluginConfig(text) {
|
|
|
40
22
|
}
|
|
41
23
|
|
|
42
24
|
export function isManagedCodexModelInstruction(line = '') {
|
|
43
|
-
const normalized = String(line || '').replace(/\\/g, '/')
|
|
44
25
|
return line.includes('model_instructions_file')
|
|
45
|
-
&& (
|
|
46
|
-
line.includes(CODEX_MANAGED_TOML_COMMENT)
|
|
47
|
-
|| isManagedCodexStandbyInstructionPath(normalized)
|
|
48
|
-
|| isManagedCodexGlobalInstructionPath(normalized)
|
|
49
|
-
)
|
|
26
|
+
&& line.includes(CODEX_MANAGED_TOML_COMMENT)
|
|
50
27
|
}
|
|
51
28
|
|
|
52
29
|
export function isManagedCodexNotify(line = '') {
|
|
53
|
-
return line.includes('codex-notify')
|
|
30
|
+
return line.includes('codex-notify')
|
|
54
31
|
}
|
|
55
32
|
|
|
56
33
|
export function isManagedCodexBackupInstruction(line = '') {
|
|
57
34
|
return line.includes(CODEX_MANAGED_TOML_COMMENT)
|
|
58
35
|
}
|
|
59
36
|
|
|
60
|
-
function
|
|
61
|
-
return
|
|
37
|
+
export function isManagedCodexHooks(line = '') {
|
|
38
|
+
return /^\s*codex_hooks\s*=\s*true(?:\s+#.*)?\s*$/i.test(String(line || ''))
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function formatManagedCodexModelInstructionsValue(filePath) {
|
|
42
|
+
return `"${normalizePath(filePath)}" ${CODEX_MANAGED_TOML_COMMENT}`
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function formatManagedCodexModelInstructionsLine(filePath) {
|
|
46
|
+
return `model_instructions_file = ${formatManagedCodexModelInstructionsValue(filePath)}`
|
|
62
47
|
}
|
|
63
48
|
|
|
64
|
-
function
|
|
65
|
-
|
|
66
|
-
safeWrite(createTimestampedBackupPath(configPath, CODEX_DEVELOPER_INSTRUCTIONS_BACKUP_BASENAME), `${existingBlock}\n`)
|
|
49
|
+
function formatManagedCodexNotifyValue(notifyScriptPath) {
|
|
50
|
+
return `["node", "${normalizePath(notifyScriptPath)}", "codex-notify"]`
|
|
67
51
|
}
|
|
68
52
|
|
|
69
|
-
function
|
|
70
|
-
|
|
71
|
-
if (!normalized.startsWith('developer_instructions =')) return ''
|
|
72
|
-
if (normalized.includes(CODEX_DEVELOPER_INSTRUCTIONS)) return ''
|
|
73
|
-
return normalized
|
|
53
|
+
function formatManagedCodexNotifyLine(notifyScriptPath) {
|
|
54
|
+
return `notify = ${formatManagedCodexNotifyValue(notifyScriptPath)}`
|
|
74
55
|
}
|
|
75
56
|
|
|
76
|
-
function
|
|
77
|
-
|
|
78
|
-
|
|
57
|
+
function removeTopLevelLinesBeingReplaced(toml, lines) {
|
|
58
|
+
let next = toml
|
|
59
|
+
|
|
60
|
+
for (const line of lines.map((value) => String(value || '').trim()).filter(Boolean)) {
|
|
61
|
+
const key = line.slice(0, line.indexOf('=')).trim()
|
|
62
|
+
if (!key) continue
|
|
63
|
+
next = removeTopLevelTomlBlock(next, key)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return next
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function upsertOrderedCodexTopLevelLines(toml, lines) {
|
|
70
|
+
return prependTopLevelTomlBlocks(
|
|
71
|
+
removeTopLevelLinesBeingReplaced(toml, lines),
|
|
72
|
+
lines,
|
|
79
73
|
)
|
|
80
74
|
}
|
|
81
75
|
|
|
82
|
-
function
|
|
83
|
-
|
|
76
|
+
export function installCodexModelInstructions(toml, filePath) {
|
|
77
|
+
return upsertOrderedCodexTopLevelLines(toml, [
|
|
78
|
+
formatManagedCodexModelInstructionsLine(filePath),
|
|
79
|
+
])
|
|
84
80
|
}
|
|
85
81
|
|
|
86
|
-
export function
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
export function installCodexManagedTopLevelConfig(toml, { modelInstructionsPath, notifyScriptPath }) {
|
|
83
|
+
return upsertOrderedCodexTopLevelLines(toml, [
|
|
84
|
+
formatManagedCodexModelInstructionsLine(modelInstructionsPath),
|
|
85
|
+
formatManagedCodexNotifyLine(notifyScriptPath),
|
|
86
|
+
])
|
|
90
87
|
}
|
|
91
88
|
|
|
92
|
-
export function
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
next = ensureTopLevelTomlBlock(next, 'developer_instructions', backupDeveloperInstructions)
|
|
98
|
-
removeCodexDeveloperInstructionsBackup(configPath)
|
|
99
|
-
return next
|
|
89
|
+
export function restoreCodexTopLevelConfig(toml, { modelInstructionsLine = '', notifyLine = '' }) {
|
|
90
|
+
return upsertOrderedCodexTopLevelLines(toml, [
|
|
91
|
+
modelInstructionsLine,
|
|
92
|
+
notifyLine,
|
|
93
|
+
])
|
|
100
94
|
}
|