@andyqiu/codeforge 0.5.7 → 0.5.9
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/agents/discover.md +14 -1
- package/commands/pause.md +4 -4
- package/dist/index.js +1879 -1633
- package/package.json +2 -2
- package/commands/autonomy.md +0 -91
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andyqiu/codeforge",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.9",
|
|
4
4
|
"description": "CodeForge — opencode 的零侵入扩展包",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"install:global": "bash ./install.sh --global",
|
|
53
53
|
"uninstall:local": "bash ./install.sh --uninstall",
|
|
54
54
|
"phase0:check": "node ./scripts/phase0-check.mjs",
|
|
55
|
-
"phase1:check": "node ./scripts/phase1-check.mjs",
|
|
55
|
+
"phase1:check": "node ./scripts/check-dist-built.mjs && node ./scripts/check-layer-deps.mjs && node ./scripts/phase1-check.mjs",
|
|
56
56
|
"phase15:check": "node ./scripts/phase15-check.mjs",
|
|
57
57
|
"v13:check": "node ./scripts/v13-check.mjs",
|
|
58
58
|
"phase2:check": "node ./scripts/phase2-check.mjs",
|
package/commands/autonomy.md
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: autonomy
|
|
3
|
-
description: 查看或切换当前 session 的自主度档位(step/semi/full/auto)
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
查看或切换当前 session 的自主执行模式(autonomy)。
|
|
7
|
-
|
|
8
|
-
## 用法
|
|
9
|
-
|
|
10
|
-
- `/autonomy` — 显示当前档位和 budget 状态
|
|
11
|
-
- `/autonomy step` — 每个工具调用都要确认
|
|
12
|
-
- `/autonomy semi` — 危险工具确认,安全工具自动(默认)
|
|
13
|
-
- `/autonomy full` — 全自动工具执行(reviewer APPROVE 后仍需 `/merge` 手动触发)
|
|
14
|
-
- `/autonomy auto` — 全自动 + APPROVE 自动 merge(**最小干预模式**)
|
|
15
|
-
- `/autonomy status` — **Phase 2.2** 显示实时状态(档位 / paused / 五维 budget / 全局今日 USD / block-pending)
|
|
16
|
-
|
|
17
|
-
## ⚠️ auto 模式须知
|
|
18
|
-
|
|
19
|
-
切到 `auto` 等同 plandex `auto` 档位 —— **最小干预**而非零干预:
|
|
20
|
-
|
|
21
|
-
- reviewer **APPROVE** 后自动合并,无需手动 `/merge`
|
|
22
|
-
- **双重验证**:必须 reviewer 摘要 Decision=APPROVE **且** `approval-store` 存在对应 APPROVE 记录,缺一不可
|
|
23
|
-
- 任一失败 → fail-safe(不 merge,emit `autonomous.decision.parse_error` event + toast)
|
|
24
|
-
- **REQUEST_CHANGES** 自动循环(≤ 3 次),仍由 codeforge agent 派 coder 修
|
|
25
|
-
- **BLOCK** 通过 channels 通知(需配置 `.codeforge/channels.json`)
|
|
26
|
-
- channels 全失败时 fallback 写 `<runtimeDir>/sessions/autonomous-blocks.ndjson`
|
|
27
|
-
- **Phase 2.2**:下次 session.start 时 session-recovery plugin 自动扫描并提示用户处理
|
|
28
|
-
- **仅根 session 生效**(子 session 一律跳过,防 orchestrator 嵌套)
|
|
29
|
-
|
|
30
|
-
### 默认预算上限(任一耗尽自动降回 semi)
|
|
31
|
-
|
|
32
|
-
| 维度 | 默认值 |
|
|
33
|
-
|---|---|
|
|
34
|
-
| 总 tokens | 50,000 |
|
|
35
|
-
| 总 USD | $3 |
|
|
36
|
-
| Wall clock | 30 分钟 |
|
|
37
|
-
| auto merge 次数 | 5 |
|
|
38
|
-
| REQUEST_CHANGES 循环 | 3 |
|
|
39
|
-
| **全局每日 USD(Phase 2)** | **$10**(跨 session 累计;env `CODEFORGE_AUTONOMY_GLOBAL_MAX_USD` 或 `.codeforge/autonomy.json::global_max_usd_per_day` 覆盖) |
|
|
40
|
-
|
|
41
|
-
### Phase 2.2 新增:stuck-detector
|
|
42
|
-
|
|
43
|
-
driver 在每次 reviewer 完成时喂 progress 信号:
|
|
44
|
-
- APPROVE → progress +1(任务推进)
|
|
45
|
-
- REQUEST_CHANGES → progress 0(无推进)
|
|
46
|
-
- BLOCK → progress -1(明显退步)
|
|
47
|
-
|
|
48
|
-
连续 5 轮无进展 → 自动降回 semi + emit `autonomous.stuck` channel event。
|
|
49
|
-
**用户 `/autonomy auto` 显式切回时自动 reset stuck 窗口**(清 stale 信号)。
|
|
50
|
-
|
|
51
|
-
### 逃生口
|
|
52
|
-
|
|
53
|
-
- `/pause` — 立刻退回 semi(不打断在途 merge)
|
|
54
|
-
- `/discard-session` — 不可逆,硬丢 worktree + branch
|
|
55
|
-
- budget 耗尽 — 自动降回 semi
|
|
56
|
-
- BLOCK — 强制通知 + 降档
|
|
57
|
-
- stuck 检测 — 5 轮无进展自动降档
|
|
58
|
-
|
|
59
|
-
## 行为对比
|
|
60
|
-
|
|
61
|
-
| 场景 | step | semi | full | auto |
|
|
62
|
-
|---|---|---|---|---|
|
|
63
|
-
| bash / edit 执行 | confirm | confirm | auto | auto |
|
|
64
|
-
| read / search 执行 | confirm | auto | auto | auto |
|
|
65
|
-
| reviewer APPROVE 后 | 手动 `/merge` | 手动 `/merge` | 手动 `/merge` | **自动 merge** |
|
|
66
|
-
| reviewer BLOCK 后 | 用户处理 | 用户处理 | 用户处理 | **channels 通知 + 降档** |
|
|
67
|
-
|
|
68
|
-
## 配置存储
|
|
69
|
-
|
|
70
|
-
- per-session:`<runtimeDir>/autonomy/<sessionId>.json`(withFileLock 跨进程并发安全)
|
|
71
|
-
- 全局每日 USD:`<runtimeDir>/autonomy/global-budget-<YYYY-MM-DD>.json`(withFileLock)
|
|
72
|
-
|
|
73
|
-
## 关联 ADR
|
|
74
|
-
|
|
75
|
-
- [autonomous-mode](../docs/adr/autonomous-mode.md) — 主 ADR(设计、双重验证、五维预算)
|
|
76
|
-
- [autonomy-global-budget](../docs/adr/autonomy-global-budget.md) — Phase 2 全局 USD 预算 + stuck-detector + block-pending 消费
|
|
77
|
-
- [plandex-three-autonomy-modes](../docs/adr/plandex-three-autonomy-modes.md) — 三档基线
|
|
78
|
-
- [worktree-session-isolation](../docs/adr/worktree-session-isolation.md) — merge 闭环
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
|
-
## /autonomy status 处理流程(Phase 2.2)
|
|
83
|
-
|
|
84
|
-
当用户输入 `/autonomy status`:
|
|
85
|
-
|
|
86
|
-
1. 调 `tools/autonomy-status.ts::getAutonomyStatus(<absRoot>, <sessionId>)` 拿 `AutonomyStatusReport`
|
|
87
|
-
2. 调 `renderAutonomyStatus(report)` 转 Markdown 文本
|
|
88
|
-
3. 直接输出渲染结果到对话(无需 toast / channels)
|
|
89
|
-
|
|
90
|
-
> 实现位置:`tools/autonomy-status.ts`(与 `tools/autonomy-mode.ts` 同款 ts 工具)。
|
|
91
|
-
> agent 通过 read + 内联调用使用,无需 opencode tool 注册(零侵入约束)。
|