helloagents 3.0.18-beta.1 → 3.0.19-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/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +17 -9
- package/README_CN.md +17 -9
- package/bootstrap-lite.md +11 -11
- package/bootstrap.md +12 -15
- package/cli.mjs +2 -0
- package/gemini-extension.json +1 -1
- package/hooks/hooks-codex.json +40 -0
- package/package.json +1 -1
- package/scripts/cli-codex-config.mjs +143 -0
- package/scripts/cli-codex-goals.mjs +114 -0
- package/scripts/cli-codex.mjs +42 -0
- package/scripts/cli-doctor-codex.mjs +208 -0
- package/scripts/cli-doctor.mjs +3 -112
- package/scripts/cli-messages.mjs +5 -0
- package/scripts/notify-payload.mjs +58 -0
- package/scripts/notify.mjs +60 -14
- package/scripts/runtime-artifacts.mjs +20 -4
- package/scripts/runtime-context.mjs +60 -2
- package/scripts/runtime-scope.mjs +2 -1
- package/scripts/runtime-ttl.mjs +7 -0
- package/scripts/session-token.mjs +1 -0
- package/scripts/turn-state.mjs +1 -1
- package/scripts/workflow-plan-files.mjs +1 -1
- package/skills/commands/auto/SKILL.md +4 -2
- package/skills/commands/build/SKILL.md +3 -1
- package/skills/commands/loop/SKILL.md +3 -1
- package/skills/commands/plan/SKILL.md +4 -1
- package/skills/commands/prd/SKILL.md +1 -0
- package/skills/commands/test/SKILL.md +2 -1
- package/skills/commands/verify/SKILL.md +3 -1
- package/skills/helloagents/SKILL.md +1 -1
- package/templates/plans/tasks.md +3 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "helloagents",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.19-beta.1",
|
|
4
4
|
"description": "HelloAGENTS — The orchestration kernel that makes any AI CLI smarter. Adds intelligent routing, quality verification (Ralph Loop), safety guards, and notifications.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "HelloWind",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "helloagents",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.19-beta.1",
|
|
4
4
|
"description": "HelloAGENTS — Quality-driven orchestration kernel for AI CLIs with intelligent routing, quality verification (Ralph Loop), safety guards, and notifications.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "HelloWind",
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
**A workflow layer for AI coding CLIs: skills, project knowledge, delivery checks, safer config writes, and resumable execution.**
|
|
10
10
|
|
|
11
|
-
[](./package.json)
|
|
12
12
|
[](https://www.npmjs.com/package/helloagents)
|
|
13
13
|
[](./package.json)
|
|
14
14
|
[](./skills)
|
|
@@ -179,6 +179,8 @@ For `~prd`, HelloAGENTS also creates PRD files such as:
|
|
|
179
179
|
|
|
180
180
|
`contract.json` is used by the workflow to decide verification scope, reviewer/tester focus, optional advisor checks, and optional visual validation.
|
|
181
181
|
|
|
182
|
+
`tasks.md` also includes a Codex `/goal` entry. For long-running Codex work, use that prepared entry instead of giving `/goal` a raw product document. HelloAGENTS keeps `/goal` as Codex-native continuation and budget control, while plan files, task boundaries, verification, and closeout remain controlled by HelloAGENTS.
|
|
183
|
+
|
|
182
184
|
### 5) State and recovery
|
|
183
185
|
|
|
184
186
|
Long tasks need a small recovery snapshot, but one shared state file is not safe enough for concurrent work.
|
|
@@ -288,6 +290,8 @@ helloagents switch-branch beta
|
|
|
288
290
|
helloagents switch-branch beta claude --global
|
|
289
291
|
helloagents doctor
|
|
290
292
|
helloagents doctor codex --json
|
|
293
|
+
helloagents codex goals status
|
|
294
|
+
helloagents codex goals enable
|
|
291
295
|
```
|
|
292
296
|
|
|
293
297
|
Supported targets:
|
|
@@ -303,7 +307,7 @@ If you omit `--standby` or `--global`, HelloAGENTS first reuses the tracked/dete
|
|
|
303
307
|
|
|
304
308
|
Use these when you do not want to depend on the `helloagents` binary being available during package updates. In `HELLOAGENTS=target[:mode]`, target can be `all`, `claude`, `gemini`, or `codex`; mode can be `standby` or `global`, and defaults to `standby`.
|
|
305
309
|
|
|
306
|
-
Host configs use the stable `helloagents-js.cmd` entrypoint and runtime root `~/.helloagents/helloagents`, so Node global package paths can change without breaking managed hooks or Codex `notify`.
|
|
310
|
+
Host configs use the stable `helloagents-js.cmd` entrypoint and runtime root `~/.helloagents/helloagents`, so Node global package paths can change without breaking managed hooks or Codex `notify`. Codex hooks use standalone `~/.codex/hooks.json` instead of adding large hook blocks to `config.toml`.
|
|
307
311
|
|
|
308
312
|
#### npm commands
|
|
309
313
|
|
|
@@ -421,7 +425,7 @@ npm uninstall -g helloagents
|
|
|
421
425
|
|-----|--------------------------|------------------|
|
|
422
426
|
| Claude Code | `~/.claude/CLAUDE.md`, `~/.claude/settings.json`, `~/.claude/helloagents -> ~/.helloagents/helloagents` | removes managed marker block, HelloAGENTS hooks/permissions, and symlink |
|
|
423
427
|
| Gemini CLI | `~/.gemini/GEMINI.md`, `~/.gemini/settings.json`, `~/.gemini/helloagents -> ~/.helloagents/helloagents` | removes managed marker block, HelloAGENTS hooks, and symlink |
|
|
424
|
-
| Codex CLI | `~/.codex/AGENTS.md`, `~/.codex/config.toml`, `~/.codex/helloagents -> ~/.helloagents/helloagents`, managed backups | removes managed marker block, managed config keys, symlink, and the latest managed backup |
|
|
428
|
+
| Codex CLI | `~/.codex/AGENTS.md`, `~/.codex/config.toml`, `~/.codex/hooks.json`, `~/.codex/helloagents -> ~/.helloagents/helloagents`, managed backups | removes managed marker block, managed config keys, managed hooks, symlink, and the latest managed backup |
|
|
425
429
|
|
|
426
430
|
### Global mode files
|
|
427
431
|
|
|
@@ -429,7 +433,7 @@ npm uninstall -g helloagents
|
|
|
429
433
|
|-----|----------------|----------------|
|
|
430
434
|
| Claude Code | native plugin install | managed by Claude Code plugin system |
|
|
431
435
|
| Gemini CLI | native extension install | managed by Gemini extension system |
|
|
432
|
-
| Codex CLI | native local-plugin chain | `~/.agents/plugins/marketplace.json`, `~/plugins/helloagents/`, `~/.codex/plugins/cache/local-plugins/helloagents/local/`, `~/.codex/config.toml`, `~/.codex/helloagents -> ~/plugins/helloagents` |
|
|
436
|
+
| Codex CLI | native local-plugin chain | `~/.agents/plugins/marketplace.json`, `~/plugins/helloagents/`, `~/.codex/plugins/cache/local-plugins/helloagents/local/`, `~/.codex/config.toml`, `~/.codex/hooks.json`, `~/.codex/helloagents -> ~/plugins/helloagents` |
|
|
433
437
|
|
|
434
438
|
In global mode, HelloAGENTS now attempts the host-native install commands automatically. If a host command is unavailable, run the same commands manually:
|
|
435
439
|
|
|
@@ -631,9 +635,12 @@ Codex is rules-file driven by default.
|
|
|
631
635
|
- standby writes `~/.codex/AGENTS.md`
|
|
632
636
|
- standby writes a managed `model_instructions_file = "~/.codex/AGENTS.md"`
|
|
633
637
|
- standby writes a managed `notify = ["helloagents-js.cmd", "codex-notify"]` command for closeout notification
|
|
638
|
+
- standby writes silent Codex hooks to `~/.codex/hooks.json`
|
|
634
639
|
- standby creates `~/.codex/helloagents -> ~/.helloagents/helloagents`
|
|
635
|
-
- global mode installs the native local-plugin chain
|
|
636
|
-
-
|
|
640
|
+
- global mode installs the native local-plugin chain and also loads silent hooks from `~/.codex/hooks.json`
|
|
641
|
+
- Codex hooks only synchronize runtime state and enforce Stop gates; they do not inject bootstrap or route text through hook output
|
|
642
|
+
- `/goal` remains Codex-native. Enable it explicitly with `helloagents codex goals enable` when long-running plan execution is needed
|
|
643
|
+
- Goal-aware commands resume from `tasks.md`, `contract.json`, and `state_path`; they do not create goals automatically or mark them complete before HelloAGENTS verification and closeout
|
|
637
644
|
|
|
638
645
|
## Verification
|
|
639
646
|
|
|
@@ -647,7 +654,8 @@ The current test suite covers:
|
|
|
647
654
|
|
|
648
655
|
- install, update, uninstall, cleanup, and mode switching
|
|
649
656
|
- Claude, Gemini, and Codex config merge and restore behavior
|
|
650
|
-
- Codex managed `model_instructions_file`, `notify`, local plugin, marketplace, and cache behavior
|
|
657
|
+
- Codex managed `model_instructions_file`, `notify`, `hooks.json`, local plugin, marketplace, and cache behavior
|
|
658
|
+
- Codex `/goal` feature toggles, long-running route context, and goal-aware command contracts
|
|
651
659
|
- `helloagents doctor`
|
|
652
660
|
- project storage and `repo-shared` behavior
|
|
653
661
|
- session-scoped `state_path`, runtime signals, and evidence
|
|
@@ -681,9 +689,9 @@ Use `~init` when you also want project-level rule files and project-level HelloA
|
|
|
681
689
|
|
|
682
690
|
`global` applies full rules broadly. Claude and Gemini use native plugin/extension installs. Codex uses the local-plugin path.
|
|
683
691
|
|
|
684
|
-
###
|
|
692
|
+
### Do Codex hooks show injected content?
|
|
685
693
|
|
|
686
|
-
|
|
694
|
+
No bootstrap or route text is injected through hooks. HelloAGENTS Codex hooks only write runtime state and enforce Stop gates; successful hooks stay quiet, while blocked or failed hooks show the necessary reason.
|
|
687
695
|
|
|
688
696
|
### Can I turn off notifications or guard checks?
|
|
689
697
|
|
package/README_CN.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
**面向 AI 编码 CLI 的工作流层:技能、知识库、交付检查、更安全的配置写入,以及可恢复的执行流程。**
|
|
10
10
|
|
|
11
|
-
[](./package.json)
|
|
12
12
|
[](https://www.npmjs.com/package/helloagents)
|
|
13
13
|
[](./package.json)
|
|
14
14
|
[](./skills)
|
|
@@ -179,6 +179,8 @@ HelloAGENTS 可以在 `.helloagents/` 下创建和维护项目知识库。
|
|
|
179
179
|
|
|
180
180
|
`contract.json` 会影响验证范围、reviewer/tester 关注点、可选 advisor 检查和可选视觉验收。
|
|
181
181
|
|
|
182
|
+
`tasks.md` 还会保留 Codex `/goal` 执行入口。长程 Codex 任务应使用这个已拆分入口,不要把原始产品文档直接交给 `/goal`。HelloAGENTS 保持 `/goal` 的 Codex 原生定位,只把它作为续跑和预算控制;方案文件、任务边界、验证与收尾仍由 HelloAGENTS 负责。
|
|
183
|
+
|
|
182
184
|
### 5)状态与恢复
|
|
183
185
|
|
|
184
186
|
长任务需要一个小型恢复快照,但多个对话共用一个状态文件并不安全。
|
|
@@ -288,6 +290,8 @@ helloagents switch-branch beta
|
|
|
288
290
|
helloagents switch-branch beta claude --global
|
|
289
291
|
helloagents doctor
|
|
290
292
|
helloagents doctor codex --json
|
|
293
|
+
helloagents codex goals status
|
|
294
|
+
helloagents codex goals enable
|
|
291
295
|
```
|
|
292
296
|
|
|
293
297
|
支持的目标:
|
|
@@ -303,7 +307,7 @@ helloagents doctor codex --json
|
|
|
303
307
|
|
|
304
308
|
当你不想依赖更新过程中的 `helloagents` 可执行文件时,用 npm 或一键脚本。`HELLOAGENTS=目标[:模式]` 中,目标支持 `all`、`claude`、`gemini`、`codex`;模式支持 `standby`、`global`,省略时默认 `standby`。
|
|
305
309
|
|
|
306
|
-
宿主配置使用稳定的 `helloagents-js.cmd` 入口和运行根目录 `~/.helloagents/helloagents`,Node 全局包路径变化不会破坏受管 hooks 或 Codex `notify
|
|
310
|
+
宿主配置使用稳定的 `helloagents-js.cmd` 入口和运行根目录 `~/.helloagents/helloagents`,Node 全局包路径变化不会破坏受管 hooks 或 Codex `notify`。Codex hooks 使用独立 `~/.codex/hooks.json`,不把大段配置写入 `config.toml`。
|
|
307
311
|
|
|
308
312
|
#### npm 命令
|
|
309
313
|
|
|
@@ -421,7 +425,7 @@ npm uninstall -g helloagents
|
|
|
421
425
|
|-----|------------------|----------|
|
|
422
426
|
| Claude Code | `~/.claude/CLAUDE.md`、`~/.claude/settings.json`、`~/.claude/helloagents -> ~/.helloagents/helloagents` | 删除受管标记块、HelloAGENTS hooks / 权限和符号链接 |
|
|
423
427
|
| Gemini CLI | `~/.gemini/GEMINI.md`、`~/.gemini/settings.json`、`~/.gemini/helloagents -> ~/.helloagents/helloagents` | 删除受管标记块、HelloAGENTS hooks 和符号链接 |
|
|
424
|
-
| Codex CLI | `~/.codex/AGENTS.md`、`~/.codex/config.toml`、`~/.codex/helloagents -> ~/.helloagents/helloagents`、受管备份 |
|
|
428
|
+
| Codex CLI | `~/.codex/AGENTS.md`、`~/.codex/config.toml`、`~/.codex/hooks.json`、`~/.codex/helloagents -> ~/.helloagents/helloagents`、受管备份 | 删除受管标记块、受管配置键、受管 hooks、符号链接和最近一次受管备份 |
|
|
425
429
|
|
|
426
430
|
### 全局模式文件
|
|
427
431
|
|
|
@@ -429,7 +433,7 @@ npm uninstall -g helloagents
|
|
|
429
433
|
|-----|----------|----------|
|
|
430
434
|
| Claude Code | 原生插件安装 | 由 Claude Code 插件系统管理 |
|
|
431
435
|
| Gemini CLI | 原生扩展安装 | 由 Gemini 扩展系统管理 |
|
|
432
|
-
| Codex CLI | 原生本地插件流程 | `~/.agents/plugins/marketplace.json`、`~/plugins/helloagents/`、`~/.codex/plugins/cache/local-plugins/helloagents/local/`、`~/.codex/config.toml`、`~/.codex/helloagents -> ~/plugins/helloagents` |
|
|
436
|
+
| Codex CLI | 原生本地插件流程 | `~/.agents/plugins/marketplace.json`、`~/plugins/helloagents/`、`~/.codex/plugins/cache/local-plugins/helloagents/local/`、`~/.codex/config.toml`、`~/.codex/hooks.json`、`~/.codex/helloagents -> ~/plugins/helloagents` |
|
|
433
437
|
|
|
434
438
|
全局模式下,HelloAGENTS 会自动尝试宿主原生命令。若宿主命令不可用,再手动执行:
|
|
435
439
|
|
|
@@ -633,9 +637,12 @@ Codex 默认走规则文件驱动。
|
|
|
633
637
|
- 标准模式写入 `~/.codex/AGENTS.md`
|
|
634
638
|
- 标准模式写入受管 `model_instructions_file = "~/.codex/AGENTS.md"`
|
|
635
639
|
- 标准模式写入受管 `notify = ["helloagents-js.cmd", "codex-notify"]` 命令用于收尾通知
|
|
640
|
+
- 标准模式把静默 Codex hooks 写入 `~/.codex/hooks.json`
|
|
636
641
|
- 标准模式创建 `~/.codex/helloagents -> ~/.helloagents/helloagents`
|
|
637
|
-
-
|
|
638
|
-
-
|
|
642
|
+
- 全局模式安装原生本地插件流程,并同样用 `~/.codex/hooks.json` 加载静默 hooks
|
|
643
|
+
- Codex hooks 只做静默运行态同步和 Stop 门禁,不通过 hook 注入 bootstrap 或路由说明
|
|
644
|
+
- `/goal` 保持 Codex 原生能力;需要长程执行时,用 `helloagents codex goals enable` 显式启用
|
|
645
|
+
- 感知 goal 的命令从 `tasks.md`、`contract.json` 和 `state_path` 恢复;不会自动创建 goal,也不会在 HelloAGENTS 验证和收尾前标记完成
|
|
639
646
|
|
|
640
647
|
## 验证
|
|
641
648
|
|
|
@@ -649,7 +656,8 @@ npm test
|
|
|
649
656
|
|
|
650
657
|
- 安装、更新、卸载、清理和模式切换
|
|
651
658
|
- Claude、Gemini、Codex 的配置合并与恢复
|
|
652
|
-
- Codex 受管 `model_instructions_file`、`notify`、本地插件、marketplace 和缓存行为
|
|
659
|
+
- Codex 受管 `model_instructions_file`、`notify`、`hooks.json`、本地插件、marketplace 和缓存行为
|
|
660
|
+
- Codex `/goal` 功能开关、长程路由上下文和 goal 感知命令契约
|
|
653
661
|
- `helloagents doctor`
|
|
654
662
|
- 项目存储和 `repo-shared`
|
|
655
663
|
- 会话级 `state_path`、运行态信号和证据
|
|
@@ -683,9 +691,9 @@ npm test
|
|
|
683
691
|
|
|
684
692
|
`global` 默认更广泛地启用完整规则。Claude 和 Gemini 使用原生插件 / 扩展;Codex 使用本地插件路径。
|
|
685
693
|
|
|
686
|
-
###
|
|
694
|
+
### Codex hooks 会显示注入内容吗?
|
|
687
695
|
|
|
688
|
-
|
|
696
|
+
不会显示 bootstrap 或路由说明。HelloAGENTS 的 Codex hooks 只写运行态和执行 Stop 门禁,成功路径返回静默结果;只有阻塞或错误时显示必要原因。
|
|
689
697
|
|
|
690
698
|
### 可以关闭通知或 Guard 吗?
|
|
691
699
|
|
package/bootstrap-lite.md
CHANGED
|
@@ -35,9 +35,8 @@
|
|
|
35
35
|
- 同一概念前后用语保持一致;先给结论再给细节,避免同义反复、重复解释和堆砌近义句
|
|
36
36
|
|
|
37
37
|
### 完整交付(强制)
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
- 直接推进:可直接继续执行时直接继续,不用“下一步建议”代替实际执行
|
|
38
|
+
- 一次做完:用户需求明确且已获得执行授权时,必须持续执行到完成;只有符合下文“阻塞判定”的情况,才可中途停下
|
|
39
|
+
- 直接推进:用户已明确同意方案、修改方向或继续执行时,直接执行;不得把可执行动作改写为建议、可选项、等待确认,也不用“下一步建议”代替实际执行
|
|
41
40
|
|
|
42
41
|
### 技术选型原则(全阶段生效)
|
|
43
42
|
选择技术栈时,遵循以下思维框架而非固定方案:
|
|
@@ -116,8 +115,8 @@
|
|
|
116
115
|
图标:💡直接响应 | ⚡快速执行 | 🔵规划流程 | ✅完成 | ❓等待输入 | ⚠️警告 | ❌错误
|
|
117
116
|
|
|
118
117
|
使用约束:
|
|
119
|
-
- 首行必须保留 `【HelloAGENTS】` 和连字符
|
|
120
|
-
- `🔄 下一步`
|
|
118
|
+
- 首行必须保留 `【HelloAGENTS】` 和连字符 `-`,不得省略;状态图标与收尾内容必须一致。正文仍在等待用户输入、确认、授权或补充信息(含确认是否执行已给出的方案或修改)时,只能使用 `❓等待输入`;仅在本轮执行已完成且不存在待确认动作时,才能使用 `✅完成`。
|
|
119
|
+
- `🔄 下一步` 必须写真正的下一步动作,不写单纯当前状态或条件式能力表述。若正在等待确认,写清待确认动作;若仍有已授权且可继续执行的动作,不得收尾,必须继续执行;若当前任务已完整结束且确无合理后续,可填写“当前任务已完成;无后续动作。”
|
|
121
120
|
|
|
122
121
|
### 收尾状态信号
|
|
123
122
|
- `turn-state` 只在运行时必须识别本轮“完成 / 等待输入 / 阻塞”时写入;普通问候、普通问答、T0 只读分析和一次性解释不调用
|
|
@@ -127,7 +126,7 @@
|
|
|
127
126
|
- 因阻塞判定等待用户输入、确认、授权或补充信息(含未授权的外部副作用确认) → 写 `kind=waiting`、`role=main`,并同时写 `reasonCategory` 与 `reason`
|
|
128
127
|
- 因错误、缺少前置条件或外部依赖而本轮停下 → 写 `kind=blocked`、`role=main`,并同时写 `reasonCategory` 与 `reason`
|
|
129
128
|
- `reasonCategory` 只允许:`ambiguity`、`missing-input`、`missing-file`、`missing-credential`、`unauthorized-side-effect`、`high-risk-confirmation`、`external-dependency`、`error`
|
|
130
|
-
- 显式 `~auto` / `~loop` 下,`waiting` / `blocked` 还必须写入 `blocker.target`、`blocker.evidence`、`blocker.requiredAction
|
|
129
|
+
- 显式 `~auto` / `~loop` 下,`waiting` / `blocked` 还必须写入 `blocker.target`、`blocker.evidence`、`blocker.requiredAction`;阶段汇报、单轮探测完成、路线调整或“下一步建议”不构成停下理由
|
|
131
130
|
- 子代理不得写 turn-state;子代理结束只直接返回结果,不为主代理代写完成态
|
|
132
131
|
|
|
133
132
|
## 交互规则
|
|
@@ -135,7 +134,7 @@
|
|
|
135
134
|
### 选择确认
|
|
136
135
|
需要用户选择或确认时:
|
|
137
136
|
- 确认必须对应当前阻塞执行的唯一决策,不得用确认替代本可直接执行的步骤
|
|
138
|
-
-
|
|
137
|
+
- 已获得明确同意时,不再追加确认环节
|
|
139
138
|
- 每次只问一个问题,偏好选择题,根据用户回答动态决定下一个问题
|
|
140
139
|
- 需要同时确认多个相关类别时,用"— "前缀标题标明类别,编号从 1 开始连续不重置
|
|
141
140
|
- 推荐选项标注(推荐)并给出理由
|
|
@@ -167,7 +166,7 @@
|
|
|
167
166
|
- 缺少继续执行所必需的信息、文件、路径或凭据
|
|
168
167
|
- 将产生外部副作用,但本轮尚未获得对应授权(含等待确认是否实施已给方案)
|
|
169
168
|
- 操作属于高风险或不可逆,按安全规则必须确认
|
|
170
|
-
|
|
169
|
+
除上述情况外,默认继续执行。
|
|
171
170
|
|
|
172
171
|
### 结构化输出
|
|
173
172
|
以下内容使用结构化格式并逐项换行显示,不压缩为一行或一段:
|
|
@@ -180,14 +179,15 @@
|
|
|
180
179
|
|
|
181
180
|
## 交付分层(Delivery Tier)
|
|
182
181
|
- `T0` — 只读分析、创意探索、方案比较 → 自然响应或 `~idea`
|
|
183
|
-
- `T1` —
|
|
184
|
-
- `T2` —
|
|
182
|
+
- `T1` — 低风险小改动、明确实现、显式验证、单文件或局部改动 → 直接执行或 `~build` / `~verify`
|
|
183
|
+
- `T2` — 新项目、从零构建、3+ 文件新功能、架构级变更或需要结构化产物 → `~plan` 或 `~auto`
|
|
185
184
|
- `T3` — 高风险或不可逆操作(权限、安全、支付、数据库、生产发布等)→ 先 `~plan` / `~prd`,再 `~build` / `~verify`
|
|
186
185
|
|
|
187
186
|
## 完成约束
|
|
188
187
|
- 未激活项目且未进入方案包 / `contract.json` / 证据文件时,声称完成前必须完成与任务类型匹配的必要检查;无法执行的检查必须明确说明,不得直接宣称完成
|
|
189
188
|
- 当前项目已激活,或已存在方案包 / `contract.json` / 证据文件时,以完整流程、对应 skill 与运行时交付约束为准,不得降级为本节
|
|
190
189
|
- 只读分析、创意探索、方案比较、中间进度和阻塞汇报不适用本节
|
|
190
|
+
- Codex `/goal` 只作为外层长程续跑与预算控制;HelloAGENTS 仍负责方案、执行、验证和收尾。若 active goal 的目标已全部完成,先完成 HelloAGENTS 验证、delivery gate 与本地版本检查点,再调用 `update_goal` 标记 complete;不得因预算接近耗尽、单轮结束或准备停下而标记 complete
|
|
191
191
|
- 本地版本检查点:非只读任务完成验证且产生工作区变更时,最终收尾前自动执行本地提交。先检查 `git status --short`;若不是 git 仓库或无变更则跳过。若发现 `.env`、密钥、凭据、明显不应提交的大文件或二进制产物,停止提交并说明风险;否则执行 `git add -A`,使用当前回复语言生成简洁 conventional commit message 后执行 `git commit`。不自动远程 `git push`,除非用户明确要求
|
|
192
192
|
|
|
193
193
|
## 路由
|
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
- 宿主固定链接(Codex `~/.codex/helloagents`、Claude `~/.claude/helloagents`、Gemini `~/.gemini/helloagents`)只作为兼容别名,不作为优先探测路径
|
|
201
201
|
- 仍无法确定时,明确说明缺少 HelloAGENTS 读取根目录;不要递归扫描 `$HOME`、`Downloads`、项目目录或旧版本目录
|
|
202
202
|
确定根目录后读取其中的 `skills/commands/{name}/SKILL.md`;标准模式下即使项目目录存在本地 HelloAGENTS skills,也不要读取项目路径。不要扫描整个目录,也不要对同一命令重复探测多个路径。
|
|
203
|
-
|
|
203
|
+
包内脚本优先使用稳定命令入口;涉及 turn-state 时按“收尾状态信号”执行。
|
|
204
204
|
|
|
205
205
|
## .helloagents/ 目录
|
|
206
206
|
路径: {CWD}/.helloagents/
|
package/bootstrap.md
CHANGED
|
@@ -35,9 +35,8 @@
|
|
|
35
35
|
- 同一概念前后用语保持一致;先给结论再给细节,避免同义反复、重复解释和堆砌近义句
|
|
36
36
|
|
|
37
37
|
### 完整交付(强制)
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
- 直接推进:可直接继续执行时直接继续,不用“下一步建议”代替实际执行
|
|
38
|
+
- 一次做完:用户需求明确且已获得执行授权时,必须持续执行到完成;只有符合下文“阻塞判定”的情况,才可中途停下
|
|
39
|
+
- 直接推进:用户已明确同意方案、修改方向或继续执行时,直接执行;不得把可执行动作改写为建议、可选项、等待确认,也不用“下一步建议”代替实际执行
|
|
41
40
|
|
|
42
41
|
### 技术选型原则(全阶段生效)
|
|
43
42
|
选择技术栈时,遵循以下思维框架而非固定方案:
|
|
@@ -116,8 +115,8 @@
|
|
|
116
115
|
图标:💡直接响应 | ⚡快速执行 | 🔵规划流程 | ✅完成 | ❓等待输入 | ⚠️警告 | ❌错误
|
|
117
116
|
|
|
118
117
|
使用约束:
|
|
119
|
-
- 首行必须保留 `【HelloAGENTS】` 和连字符
|
|
120
|
-
- `🔄 下一步`
|
|
118
|
+
- 首行必须保留 `【HelloAGENTS】` 和连字符 `-`,不得省略;状态图标与收尾内容必须一致。正文仍在等待用户输入、确认、授权或补充信息(含确认是否执行已给出的方案或修改)时,只能使用 `❓等待输入`;仅在本轮执行已完成且不存在待确认动作时,才能使用 `✅完成`。
|
|
119
|
+
- `🔄 下一步` 必须写真正的下一步动作,不写单纯当前状态或条件式能力表述。若正在等待确认,写清待确认动作;若仍有已授权且可继续执行的动作,不得收尾,必须继续执行;若当前任务已完整结束且确无合理后续,可填写“当前任务已完成;无后续动作。”
|
|
121
120
|
|
|
122
121
|
### 收尾状态信号
|
|
123
122
|
- `turn-state` 只在运行时必须识别本轮“完成 / 等待输入 / 阻塞”时写入;普通问候、普通问答、T0 只读分析和一次性解释不调用
|
|
@@ -127,7 +126,7 @@
|
|
|
127
126
|
- 因阻塞判定等待用户输入、确认、授权或补充信息(含未授权的外部副作用确认) → 写 `kind=waiting`、`role=main`,并同时写 `reasonCategory` 与 `reason`
|
|
128
127
|
- 因错误、缺少前置条件或外部依赖而本轮停下 → 写 `kind=blocked`、`role=main`,并同时写 `reasonCategory` 与 `reason`
|
|
129
128
|
- `reasonCategory` 只允许:`ambiguity`、`missing-input`、`missing-file`、`missing-credential`、`unauthorized-side-effect`、`high-risk-confirmation`、`external-dependency`、`error`
|
|
130
|
-
- 显式 `~auto` / `~loop` 下,`waiting` / `blocked` 还必须写入 `blocker.target`、`blocker.evidence`、`blocker.requiredAction
|
|
129
|
+
- 显式 `~auto` / `~loop` 下,`waiting` / `blocked` 还必须写入 `blocker.target`、`blocker.evidence`、`blocker.requiredAction`;阶段汇报、单轮探测完成、路线调整或“下一步建议”不构成停下理由
|
|
131
130
|
- 子代理不得写 turn-state;子代理结束只直接返回结果,不为主代理代写完成态
|
|
132
131
|
|
|
133
132
|
## 交互规则
|
|
@@ -135,7 +134,7 @@
|
|
|
135
134
|
### 选择确认
|
|
136
135
|
需要用户选择或确认时:
|
|
137
136
|
- 确认必须对应当前阻塞执行的唯一决策,不得用确认替代本可直接执行的步骤
|
|
138
|
-
-
|
|
137
|
+
- 已获得明确同意时,不再追加确认环节
|
|
139
138
|
- 每次只问一个问题,偏好选择题,根据用户回答动态决定下一个问题
|
|
140
139
|
- 需要同时确认多个相关类别时,用"— "前缀标题标明类别,编号从 1 开始连续不重置
|
|
141
140
|
- 推荐选项标注(推荐)并给出理由
|
|
@@ -167,7 +166,7 @@
|
|
|
167
166
|
- 缺少继续执行所必需的信息、文件、路径或凭据
|
|
168
167
|
- 将产生外部副作用,但本轮尚未获得对应授权(含等待确认是否实施已给方案)
|
|
169
168
|
- 操作属于高风险或不可逆,按安全规则必须确认
|
|
170
|
-
|
|
169
|
+
除上述情况外,默认继续执行。
|
|
171
170
|
|
|
172
171
|
### 结构化输出
|
|
173
172
|
以下内容使用结构化格式并逐项换行显示,不压缩为一行或一段:
|
|
@@ -184,8 +183,8 @@
|
|
|
184
183
|
先判断任务类型、风险等级、是否需要结构化产物,再决定进入哪条路径:
|
|
185
184
|
- 交付分层(Delivery Tier):
|
|
186
185
|
- `T0` — 只读分析、创意探索、方案比较 → 自然响应或 `~idea`
|
|
187
|
-
- `T1` —
|
|
188
|
-
- `T2` —
|
|
186
|
+
- `T1` — 低风险小改动、明确实现、显式验证、单文件或局部改动 → 直接执行或 `~build` / `~verify`
|
|
187
|
+
- `T2` — 新项目、从零构建、3+ 文件新功能、架构级变更或需要结构化产物 → `~plan` 或 `~auto`
|
|
189
188
|
- `T3` — 高风险或不可逆操作(权限、安全、支付、数据库、生产发布等)→ 先 `~plan` / `~prd`,再 `~build` / `~verify`,必要时单独确认
|
|
190
189
|
- 创意探索 / 方案比较 → `~idea`
|
|
191
190
|
- 明确实现 / 小范围修复 → `~build`
|
|
@@ -216,7 +215,7 @@
|
|
|
216
215
|
- 已激活项目或全局模式下,技能是否需要使用由当前已加载 AGENTS 规则决定;不要因此额外探测项目目录里的 HelloAGENTS skills 路径
|
|
217
216
|
路径确定一次即可,不预读、不扫描整个目录,也不重复探测同一路径。
|
|
218
217
|
hello-* 技能读取路径:`{HELLOAGENTS_READ_ROOT}/skills/{技能名}/SKILL.md`
|
|
219
|
-
|
|
218
|
+
包内脚本优先使用稳定命令入口;涉及 turn-state 时按“收尾状态信号”执行。
|
|
220
219
|
|
|
221
220
|
命令职责:
|
|
222
221
|
- `~plan` 生成 `requirements.md`、`plan.md`、`tasks.md`、`contract.json`
|
|
@@ -235,7 +234,7 @@ hello-* 技能读取路径:`{HELLOAGENTS_READ_ROOT}/skills/{技能名}/SKILL.m
|
|
|
235
234
|
- 每次编辑后主动跑确定性检查(lint / typecheck),不等到最后
|
|
236
235
|
- 遵循已读取技能的实现规范
|
|
237
236
|
|
|
238
|
-
|
|
237
|
+
遇到符合“阻塞判定”且无法自行解除的问题(依赖缺失、关键指令不清、验证反复失败等)时才停下;能继续定位或修复时继续推进。
|
|
239
238
|
|
|
240
239
|
### 5. VERIFY — 审查与验证
|
|
241
240
|
编码任务:
|
|
@@ -262,12 +261,10 @@ hello-* 技能读取路径:`{HELLOAGENTS_READ_ROOT}/skills/{技能名}/SKILL.m
|
|
|
262
261
|
- 未进入 VERIFY / CONSOLIDATE 的路径,声称完成前必须完成与任务类型匹配的必要检查;无法执行的检查必须明确说明,不得直接宣称完成
|
|
263
262
|
- 已激活 `hello-*` 技能或存在方案包 / `contract.json` / 证据文件时,以对应 skill、方案包契约与 VERIFY / CONSOLIDATE 为准,不得降级为本节
|
|
264
263
|
- 只读分析、创意探索、方案比较、中间进度和阻塞汇报不适用本节
|
|
264
|
+
- Codex `/goal` 只作为外层长程续跑与预算控制;HelloAGENTS 仍负责方案、执行、验证和收尾。若 active goal 的目标已全部完成,先完成 HelloAGENTS 验证、delivery gate 与本地版本检查点,再调用 `update_goal` 标记 complete;不得因预算接近耗尽、单轮结束或准备停下而标记 complete
|
|
265
265
|
|
|
266
266
|
## 路由
|
|
267
267
|
- 默认按上文“统一执行流程 / ROUTE / TIER”选路;除显式 `~command` 外,不另起独立路由规则
|
|
268
|
-
- 简单任务(单文件修改/明确修复/小调整/已有代码的局部改动)→ 直接执行(⚡)
|
|
269
|
-
- 必须进入规划(不可跳过):新项目 / 新应用 / 从零构建 / 涉及 3+ 文件的新功能 / 架构级变更
|
|
270
|
-
- 创意探索、显式验证/审查、完整规格等其他分流,均按 ROUTE / TIER 的命令映射执行
|
|
271
268
|
- `~do` 是 `~build` 的兼容别名;`~design` 是 `~plan` 的兼容别名;`~review` 是 `~verify` 的兼容别名
|
|
272
269
|
- `~command` 路由:用户输入 `~xxx` 时,立即读取对应的 SKILL.md 并按其流程执行,不要自行探索或猜测。若当前上下文已解析出具体命令技能文件路径,直接使用它;否则按上文相同的技能根目录规则确定,确定根目录后读取其中的 `skills/commands/{name}/SKILL.md`。不要额外探测项目目录里的 HelloAGENTS skills 路径,也不要扫描整个目录或对同一命令重复探测多个路径。
|
|
273
270
|
|
package/cli.mjs
CHANGED
|
@@ -176,6 +176,8 @@ if (cmd === 'codex-notify') {
|
|
|
176
176
|
runRuntimeScript('guard.mjs', argv.slice(1))
|
|
177
177
|
} else if (cmd === 'ralph-loop') {
|
|
178
178
|
runRuntimeScript('ralph-loop.mjs', argv.slice(1))
|
|
179
|
+
} else if (cmd === 'codex' && argv[1] === 'goals') {
|
|
180
|
+
runRuntimeScript('cli-codex-goals.mjs', argv.slice(2))
|
|
179
181
|
} else if (cmd === 'postinstall') {
|
|
180
182
|
printPostinstallMessage()
|
|
181
183
|
if (shouldDeployFromEnv()) {
|
package/gemini-extension.json
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"SessionStart": [
|
|
4
|
+
{
|
|
5
|
+
"matcher": "",
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "node \"${PLUGIN_ROOT}/scripts/notify.mjs\" inject --codex --silent",
|
|
10
|
+
"timeout": 10
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"UserPromptSubmit": [
|
|
16
|
+
{
|
|
17
|
+
"matcher": "",
|
|
18
|
+
"hooks": [
|
|
19
|
+
{
|
|
20
|
+
"type": "command",
|
|
21
|
+
"command": "node \"${PLUGIN_ROOT}/scripts/notify.mjs\" route --codex --silent",
|
|
22
|
+
"timeout": 5
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"Stop": [
|
|
28
|
+
{
|
|
29
|
+
"matcher": "",
|
|
30
|
+
"hooks": [
|
|
31
|
+
{
|
|
32
|
+
"type": "command",
|
|
33
|
+
"command": "node \"${PLUGIN_ROOT}/scripts/notify.mjs\" stop --codex",
|
|
34
|
+
"timeout": 120
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "helloagents",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.19-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",
|
|
@@ -1,19 +1,89 @@
|
|
|
1
1
|
import {
|
|
2
|
+
isTomlTableHeader,
|
|
3
|
+
normalizeToml,
|
|
2
4
|
prependTopLevelTomlBlocks,
|
|
3
5
|
removeTopLevelTomlBlock,
|
|
4
6
|
stripTomlSection,
|
|
5
7
|
} from './cli-toml.mjs'
|
|
6
8
|
|
|
7
9
|
export const CODEX_PLUGIN_CONFIG_HEADER = '[plugins."helloagents@local-plugins"]'
|
|
10
|
+
export const CODEX_FEATURES_HEADER = '[features]'
|
|
8
11
|
export const CODEX_MANAGED_TOML_COMMENT = '# helloagents-managed'
|
|
9
12
|
export const CODEX_MANAGED_MODEL_INSTRUCTIONS_PATH = '~/.codex/AGENTS.md'
|
|
10
13
|
export const CODEX_MANAGED_NOTIFY_COMMAND = 'helloagents-js.cmd'
|
|
11
14
|
export const CODEX_MANAGED_NOTIFY_VALUE = `["${CODEX_MANAGED_NOTIFY_COMMAND}", "codex-notify"]`
|
|
15
|
+
export const CODEX_HOOKS_FEATURE_KEY = 'hooks'
|
|
16
|
+
export const CODEX_LEGACY_HOOKS_FEATURE_KEY = 'codex_hooks'
|
|
17
|
+
export const CODEX_GOALS_FEATURE_KEY = 'goals'
|
|
18
|
+
export const CODEX_MANAGED_GOALS_FEATURE_LINE = `${CODEX_GOALS_FEATURE_KEY} = true ${CODEX_MANAGED_TOML_COMMENT}`
|
|
19
|
+
export const CODEX_MANAGED_GOALS_DISABLED_LINE = `${CODEX_GOALS_FEATURE_KEY} = false ${CODEX_MANAGED_TOML_COMMENT}`
|
|
12
20
|
|
|
13
21
|
function normalizePath(value = '') {
|
|
14
22
|
return String(value || '').replace(/\\/g, '/')
|
|
15
23
|
}
|
|
16
24
|
|
|
25
|
+
function splitTomlLines(text = '') {
|
|
26
|
+
return String(text || '').replace(/\r\n/g, '\n').split('\n')
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function findSectionBounds(lines, headerLine) {
|
|
30
|
+
const start = lines.findIndex((line) => line.trim() === headerLine)
|
|
31
|
+
if (start < 0) return { start: -1, end: -1 }
|
|
32
|
+
|
|
33
|
+
let end = lines.length
|
|
34
|
+
for (let index = start + 1; index < lines.length; index += 1) {
|
|
35
|
+
if (isTomlTableHeader(lines[index])) {
|
|
36
|
+
end = index
|
|
37
|
+
break
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return { start, end }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function findSectionKeyIndex(lines, bounds, key) {
|
|
44
|
+
if (bounds.start < 0) return -1
|
|
45
|
+
for (let index = bounds.start + 1; index < bounds.end; index += 1) {
|
|
46
|
+
if (lines[index].trim().startsWith(`${key} =`)) return index
|
|
47
|
+
}
|
|
48
|
+
return -1
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function upsertTomlSectionLine(text, headerLine, key, line) {
|
|
52
|
+
const lines = splitTomlLines(text)
|
|
53
|
+
const bounds = findSectionBounds(lines, headerLine)
|
|
54
|
+
if (bounds.start < 0) {
|
|
55
|
+
const base = String(text || '').trimEnd()
|
|
56
|
+
const block = `${headerLine}\n${line}`
|
|
57
|
+
return normalizeToml(base ? `${base}\n\n${block}` : block)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const keyIndex = findSectionKeyIndex(lines, bounds, key)
|
|
61
|
+
if (keyIndex >= 0) lines[keyIndex] = line
|
|
62
|
+
else {
|
|
63
|
+
let insertIndex = bounds.end
|
|
64
|
+
while (insertIndex > bounds.start + 1 && !lines[insertIndex - 1].trim()) insertIndex -= 1
|
|
65
|
+
lines.splice(insertIndex, 0, line)
|
|
66
|
+
}
|
|
67
|
+
return normalizeToml(lines.join('\n'))
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function removeTomlSectionLine(text, headerLine, key, shouldRemove) {
|
|
71
|
+
const lines = splitTomlLines(text)
|
|
72
|
+
const bounds = findSectionBounds(lines, headerLine)
|
|
73
|
+
const keyIndex = findSectionKeyIndex(lines, bounds, key)
|
|
74
|
+
if (keyIndex < 0 || !shouldRemove(lines[keyIndex].trim())) return normalizeToml(text)
|
|
75
|
+
|
|
76
|
+
lines.splice(keyIndex, 1)
|
|
77
|
+
const nextBounds = findSectionBounds(lines, headerLine)
|
|
78
|
+
const sectionLines = nextBounds.start < 0
|
|
79
|
+
? []
|
|
80
|
+
: lines.slice(nextBounds.start + 1, nextBounds.end).filter((entry) => entry.trim())
|
|
81
|
+
if (nextBounds.start >= 0 && sectionLines.length === 0) {
|
|
82
|
+
lines.splice(nextBounds.start, 1)
|
|
83
|
+
}
|
|
84
|
+
return normalizeToml(lines.join('\n'))
|
|
85
|
+
}
|
|
86
|
+
|
|
17
87
|
export function upsertCodexPluginConfig(text) {
|
|
18
88
|
const stripped = stripTomlSection(text, CODEX_PLUGIN_CONFIG_HEADER).text.trimEnd()
|
|
19
89
|
const block = `${CODEX_PLUGIN_CONFIG_HEADER}\nenabled = true`
|
|
@@ -24,6 +94,62 @@ export function removeCodexPluginConfig(text) {
|
|
|
24
94
|
return stripTomlSection(text, CODEX_PLUGIN_CONFIG_HEADER).text
|
|
25
95
|
}
|
|
26
96
|
|
|
97
|
+
export function readCodexHooksFeatureLine(text) {
|
|
98
|
+
return readCodexFeatureLine(text, CODEX_HOOKS_FEATURE_KEY)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function readLegacyCodexHooksFeatureLine(text) {
|
|
102
|
+
return readCodexFeatureLine(text, CODEX_LEGACY_HOOKS_FEATURE_KEY)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function readCodexGoalsFeatureLine(text) {
|
|
106
|
+
return readCodexFeatureLine(text, CODEX_GOALS_FEATURE_KEY)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function readCodexFeatureLine(text, key) {
|
|
110
|
+
const lines = splitTomlLines(text)
|
|
111
|
+
const bounds = findSectionBounds(lines, CODEX_FEATURES_HEADER)
|
|
112
|
+
const keyIndex = findSectionKeyIndex(lines, bounds, key)
|
|
113
|
+
return keyIndex >= 0 ? lines[keyIndex].trim() : ''
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function setCodexGoalsFeatureConfig(text, enabled = true) {
|
|
117
|
+
return upsertTomlSectionLine(
|
|
118
|
+
text,
|
|
119
|
+
CODEX_FEATURES_HEADER,
|
|
120
|
+
CODEX_GOALS_FEATURE_KEY,
|
|
121
|
+
enabled ? CODEX_MANAGED_GOALS_FEATURE_LINE : CODEX_MANAGED_GOALS_DISABLED_LINE,
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export function removeCodexGoalsFeatureConfig(text) {
|
|
126
|
+
return removeTomlSectionLine(
|
|
127
|
+
text,
|
|
128
|
+
CODEX_FEATURES_HEADER,
|
|
129
|
+
CODEX_GOALS_FEATURE_KEY,
|
|
130
|
+
isManagedCodexGoalsFeature,
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function removeLegacyManagedCodexHooksFeatureConfig(text) {
|
|
135
|
+
return removeTomlSectionLine(
|
|
136
|
+
text,
|
|
137
|
+
CODEX_FEATURES_HEADER,
|
|
138
|
+
CODEX_LEGACY_HOOKS_FEATURE_KEY,
|
|
139
|
+
isManagedLegacyCodexHooksFeature,
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function restoreCodexGoalsFeatureConfig(text, { codexGoalsLine = '' } = {}) {
|
|
144
|
+
if (!codexGoalsLine) return normalizeToml(text)
|
|
145
|
+
return upsertTomlSectionLine(
|
|
146
|
+
text,
|
|
147
|
+
CODEX_FEATURES_HEADER,
|
|
148
|
+
CODEX_GOALS_FEATURE_KEY,
|
|
149
|
+
codexGoalsLine,
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
|
|
27
153
|
export function isManagedCodexModelInstruction(line = '') {
|
|
28
154
|
return line.includes('model_instructions_file')
|
|
29
155
|
&& line.includes(CODEX_MANAGED_TOML_COMMENT)
|
|
@@ -34,6 +160,23 @@ export function isManagedCodexNotify(line = '') {
|
|
|
34
160
|
return value.includes(CODEX_MANAGED_NOTIFY_VALUE)
|
|
35
161
|
}
|
|
36
162
|
|
|
163
|
+
function isManagedFeatureLine(line = '', key = '') {
|
|
164
|
+
return new RegExp(`^\\s*${key}\\s*=`).test(String(line || ''))
|
|
165
|
+
&& String(line || '').includes(CODEX_MANAGED_TOML_COMMENT)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function isManagedCodexHooksFeature(line = '') {
|
|
169
|
+
return isManagedFeatureLine(line, CODEX_HOOKS_FEATURE_KEY)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export function isManagedLegacyCodexHooksFeature(line = '') {
|
|
173
|
+
return isManagedFeatureLine(line, CODEX_LEGACY_HOOKS_FEATURE_KEY)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function isManagedCodexGoalsFeature(line = '') {
|
|
177
|
+
return isManagedFeatureLine(line, CODEX_GOALS_FEATURE_KEY)
|
|
178
|
+
}
|
|
179
|
+
|
|
37
180
|
export function isManagedCodexBackupInstruction(line = '') {
|
|
38
181
|
return line.includes(CODEX_MANAGED_TOML_COMMENT)
|
|
39
182
|
}
|