@kylecheng3146/agent-ops 0.1.18 → 0.1.20

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.
Files changed (39) hide show
  1. package/README.md +16 -9
  2. package/dist/packages/cli/src/bin.js +59 -9
  3. package/dist/packages/cli/src/cli.js +1 -1
  4. package/dist/packages/cli/src/commands/init.js +39 -9
  5. package/dist/packages/cli/src/commands/review.js +3 -0
  6. package/dist/packages/cli/src/commands/uninstall.js +20 -3
  7. package/dist/packages/cli/src/ui.js +3 -1
  8. package/dist/packages/cli/src/wizard.js +12 -6
  9. package/dist/runtime/src/adapters/agy/config.js +105 -0
  10. package/dist/runtime/src/adapters/agy/events.js +27 -0
  11. package/dist/runtime/src/adapters/agy/input.js +30 -0
  12. package/dist/runtime/src/adapters/agy/output.js +24 -0
  13. package/dist/runtime/src/adapters/agy/surfaces.js +9 -0
  14. package/dist/runtime/src/fs/managed-block.js +23 -10
  15. package/dist/runtime/src/install/codex-loop.js +6 -2
  16. package/dist/runtime/src/install/doctor.js +15 -0
  17. package/dist/runtime/src/install/harness.js +52 -1
  18. package/dist/runtime/src/install/hooks.js +6 -1
  19. package/dist/runtime/src/install/ownership.js +12 -8
  20. package/dist/runtime/src/install/plan.js +2 -2
  21. package/dist/runtime/src/install/probes.js +61 -0
  22. package/dist/runtime/src/install/surface-inspection.js +10 -1
  23. package/dist/runtime/src/install/uninstall.js +337 -6
  24. package/dist/runtime/src/review/execute.js +23 -20
  25. package/dist/runtime/src/review/extract.js +5 -11
  26. package/dist/runtime/src/review/render.js +6 -1
  27. package/dist/runtime/src/review/roles.js +4 -0
  28. package/dist/runtime/src/review/runner.js +7 -0
  29. package/dist/runtime/src/schema/validate.js +2 -2
  30. package/docs/en/guides/configuration.md +22 -6
  31. package/docs/en/spec/README.md +5 -2
  32. package/docs/en/spec/harness-adapters.md +20 -9
  33. package/docs/en/spec/review.md +6 -0
  34. package/docs/zh-TW/guides/configuration.md +20 -6
  35. package/docs/zh-TW/spec/README.md +4 -2
  36. package/docs/zh-TW/spec/harness-adapters.md +18 -10
  37. package/docs/zh-TW/spec/review.md +5 -0
  38. package/package.json +2 -2
  39. package/schemas/manifest.schema.json +2 -2
@@ -6,7 +6,9 @@ documentation](https://bun.sh/docs/runtime/shell) on 2026-07-31. Codex and
6
6
  Claude Code loop-hook behavior was checked against their [Codex hook
7
7
  documentation](https://developers.openai.com/codex/config-advanced#hooks) and
8
8
  [Claude Code hook documentation](https://code.claude.com/docs/en/hooks) on
9
- 2026-08-03. Revalidate: when any vendor reference changes.
9
+ 2026-08-03. Agy hook behavior was checked against the [official Antigravity
10
+ hook documentation](https://antigravity.google/docs/hooks) on 2026-08-28.
11
+ Revalidate: when any vendor reference changes.
10
12
 
11
13
  ## HARNESS-ADAPTER-001
12
14
 
@@ -80,14 +82,17 @@ decoding, normalized events, native output encoding, and runtime-failure output.
80
82
  ## HARNESS-ADAPTER-006
81
83
 
82
84
  The project-local `loop` profile MUST be opt-in, project scoped, and use one
83
- shared runtime behind minimal Codex and Claude Code launchers. It MUST NOT copy
85
+ shared runtime behind minimal Codex and Claude Code launchers; agy uses its
86
+ native supported lifecycle subset and is reported as degraded. It MUST NOT copy
84
87
  policy into project-specific scripts or alter an ordinary permission request.
85
88
 
86
- - Trigger: A project selects `loop` with Codex, Claude Code, or both.
89
+ - Trigger: A project selects `loop` with agy, Codex, Claude Code, or any combination.
87
90
  - Action: Generate only the selected `.codex/hooks/agent-ops-loop.sh` and/or
88
91
  Claude's `.claude/hooks/agent-ops-loop.sh` plus
89
92
  `.claude/hooks/agent-ops-loop.ps1` launchers, register the documented loop
90
- lifecycle events except `Stop`, and preserve foreign hook groups. Block only
93
+ lifecycle events except `Stop`, and preserve foreign hook groups. For agy,
94
+ register only native `PreInvocation`/`PreToolUse(run_command)` hooks and do
95
+ not generate a shell launcher. Block only
91
96
  high-confidence literal credentials at `UserPromptSubmit` or Bash
92
97
  `PreToolUse`, and dangerous Bash commands at `PreToolUse`, using the documented native denial shape. Emit no
93
98
  decision for `PermissionRequest`, including escalated permissions.
@@ -99,11 +104,11 @@ policy into project-specific scripts or alter an ordinary permission request.
99
104
 
100
105
  The current registration matrix is intentionally asymmetric:
101
106
 
102
- | Capability | Codex | Claude Code | OpenCode |
103
- | --- | --- | --- | --- |
104
- | lifecycle-summary | supported | supported | degraded |
105
- | command-policy | unknown | supported | supported |
106
- | optional-stop-verify | unsupported | supported | degraded |
107
+ | Capability | agy | Codex | Claude Code | OpenCode |
108
+ | --- | --- | --- | --- | --- |
109
+ | lifecycle-summary | degraded | supported | supported | degraded |
110
+ | command-policy | supported | unknown | supported | supported |
111
+ | optional-stop-verify | degraded | unsupported | supported | degraded |
107
112
 
108
113
  For runtime-failure handling, only `command-policy` is fail-closed. Claude
109
114
  Code can emit its documented `PreToolUse` denial shape for a classified invalid
@@ -113,6 +118,12 @@ surface. Codex remains `unknown` and never emits a denial. Fixture tests assert
113
118
  these wire and plugin shapes only; they do not prove that a host honors a
114
119
  denial. Every `SessionStart` and `Stop` failure path remains fail-open.
115
120
 
121
+ The agy adapter uses project `AGENTS.md` routing alongside Codex and OpenCode;
122
+ at user scope it manages `.agent-ops/GEMINI.md` and a managed block in the
123
+ shared `.gemini/GEMINI.md` rule surface. Its native hooks use camelCase input,
124
+ return `decision: "deny"` for command-policy blocks, and never force a Stop
125
+ continuation. On Windows the generated command is invoked through `cmd /c`.
126
+
116
127
  Stop verification is explicit, trusted, report-only, and disabled by default.
117
128
  Every Stop result continues the native harness and may carry only bounded
118
129
  command evidence; it is never task-completion evidence.
@@ -42,6 +42,12 @@ without one MUST be skipped rather than run unsandboxed.
42
42
  - Positive: `agy receives sandboxed plan mode; opencode remains ineligible.`
43
43
  - Negative: `Trust the prompt to stop the reviewer from editing files.`
44
44
 
45
+ Every attempted review MUST run in a fresh session (`sessionIsolation:
46
+ "fresh"`) and in a disposable repository clone. The reviewer chain prefers a
47
+ different CLI from the hosting CLI; when no other usable target exists,
48
+ same-target fresh review is allowed but MUST render as `DEGRADED: isolated
49
+ self-review`. A resumed development session is never an independent review.
50
+
45
51
  ## REVIEW-CHAIN-001
46
52
 
47
53
  Configured targets form an ordered fallback chain that MUST advance only when
@@ -2,11 +2,11 @@
2
2
 
3
3
  保持 project 設定明確且分層。請刻意選擇 scope、harness 與 profile;不要從 `--yes` 推論 trust 或安全例外。
4
4
 
5
- 使用 `--harness all` 選取 Codex、Claude Code 與 opencode,或傳入
5
+ 使用 `--harness all` 選取 agy、Codex、Claude Code 與 opencode,或傳入
6
6
  `codex,opencode` 這類逗號分隔的子集。`both` 仍是 legacy Codex 加 Claude
7
7
  selection 的 input alias。
8
8
 
9
- Project Codex 與 opencode installation 共用 managed supplemental
9
+ Project agy、Codex 與 opencode installation 共用 managed supplemental
10
10
  `AGENTS.md` routing block 與 `.agent-ops/AGENTS.md` rules artifact。該 block
11
11
  只載入 managed baseline,並保留 project-specific instructions 的權威性。
12
12
  Claude 使用對應的 `CLAUDE.md` route 與 `.agent-ops/CLAUDE.md` artifact。Opencode 另外取得
@@ -14,8 +14,9 @@ agent-ops 擁有的 `.opencode/plugins/agent-ops.js`;不會修改 `opencode.js
14
14
  Plugin 使用安裝時的 absolute runtime path 產生,因此請透過
15
15
  `agent-ops update` 更新,不要手動編輯。
16
16
 
17
- User scope 下,Codex opencode routing file 分別位於 `.codex/` 與
18
- `.opencode/`;global opencode plugin 預設位於 `.config/opencode/plugins/`,
17
+ User scope 下,agy 使用 `.agent-ops/GEMINI.md` 與共用 Gemini surface
18
+ `.gemini/GEMINI.md`;Codex opencode routing file 分別位於 `.codex/` 與
19
+ `.opencode/`。Global opencode plugin 預設位於 `.config/opencode/plugins/`,
19
20
  若 `$XDG_CONFIG_HOME` 指向 managed user root 內的目錄,則改用
20
21
  `$XDG_CONFIG_HOME/opencode/plugins/`。若 OpenCode 設定了
21
22
  `$OPENCODE_CONFIG_DIR`,則 plugin 會放在其 `plugins/` 目錄。只有 profile
@@ -46,7 +47,7 @@ Claude 與 Codex lifecycle support 為 `supported`,OpenCode 從 app initializa
46
47
  `--task` 使用 task criteria,並要求必要驗證的最新 PASS evidence。完整 report
47
48
  會顯示給人看,PASS 後只持久化 source-fingerprint attestation。
48
49
 
49
- 每次嘗試都從新的暫存 cwd 與原生唯讀模式啟動。Claude 使用完整 safe-mode
50
+ 每次嘗試都從全新 session、一次性 repository clone 與原生唯讀模式啟動。Claude 使用完整 safe-mode
50
51
  隔離;Codex 與 Agy 為了支援既有 OAuth 登入而保留登入環境,因此 context
51
52
  隔離較弱。Agy 會取得一次性 clone,即使 sandboxed plan mode 寫入 cwd,也無法
52
53
  修改來源 repository:
@@ -57,6 +58,10 @@ Claude 與 Codex lifecycle support 為 `supported`,OpenCode 從 app initializa
57
58
  | `agy` | `agy --print <prompt>` | `--sandbox --mode plan` |
58
59
  | `claude` | `claude -p` | `--permission-mode plan --safe-mode` |
59
60
 
61
+ review chain 優先選擇不同於 hosting CLI 的 target。沒有其他可用 target 時,才允許
62
+ 全新的同 CLI session,但輸出會標示 `DEGRADED: isolated self-review`;不得 resume
63
+ 開發 session。
64
+
60
65
  `opencode` **不是** review 目標,即使它是支援的 harness。它的 `--agent plan`
61
66
  會被判定為 subagent 而遭拒,並靜默退回可寫入的 agent,因此無法滿足唯讀前置
62
67
  條件。沒有唯讀旗標的目標會被跳過,不會在無沙箱狀態下執行。
@@ -121,7 +126,12 @@ launcher。Codex 只會在 `.codex/config.toml` 不存在時建立它。首次
121
126
  `loop-state.md` 與 `loop-telemetry.jsonl`;並以 hash-commented `.gitignore`
122
127
  block 忽略這些 local file。
123
128
 
124
- Loop 會執行 `SessionStart`、`UserPromptSubmit`、`PreToolUse`、
129
+ agy 會安裝原生 `PreInvocation` 與 `PreToolUse(run_command)` 子集,doctor
130
+ 會將 loop 標示為 degraded。Project hook 位於 `.agents/hooks.json`,user hook
131
+ 位於 `.gemini/config/hooks.json`;user scope 會修改共享 Gemini rule surface
132
+ `.gemini/GEMINI.md`。機器可讀的 `/hooks` 診斷要求 agy 1.1.12 以上。
133
+
134
+ 完整 Codex/Claude loop 會執行 `SessionStart`、`UserPromptSubmit`、`PreToolUse`、
125
135
  `PermissionRequest`、`PostToolUse`、`PreCompact`、`PostCompact`、
126
136
  `SubagentStart` 與 `SubagentStop`,但永遠不加入 `Stop`。它只攔截
127
137
  high-confidence 的 literal secret prompt 或 Bash command,以及危險 Bash command
@@ -215,6 +225,10 @@ config-hash 與 timestamp evidence,且永遠不會完成 task。Config v1 會
215
225
  `agent-ops update --harness`;shared path 會繼續受管理,被移除 harness
216
226
  擁有的 artifact、marker 與 hook 則會被安全同步。
217
227
 
228
+ 若只要移除單一已整合 harness,可使用
229
+ `agent-ops uninstall --harness agy`(或其他已安裝 id)。剩餘 manifest 與
230
+ shared path 會保留;省略 `--harness` 才會移除整套 managed installation。
231
+
218
232
  使用舊版 canonical routing wording 的 installation 會由
219
233
  `agent-ops update` 遷移;若 managed block 曾被修改,指令會 fail closed,
220
234
  直到該變更被檢查。
@@ -2,8 +2,10 @@
2
2
 
3
3
  此目錄是英文規範的繁體中文導讀;規範 rule ID 以英文版本為準。
4
4
 
5
- Harness adapter 規則涵蓋 Codex、Claude Code 與 opencode。opencode 整合是
6
- 產生的 local plugin,不管理 `opencode.json`。
5
+ Harness adapter 規則涵蓋 agy、Codex、Claude Code 與 opencode。opencode 整合是
6
+ 產生的 local plugin,不管理 `opencode.json`。agy 在 project scope 共用
7
+ `AGENTS.md` routing、使用原生 hooks,對不足以完整支援 loop 的 lifecycle
8
+ 能力明確標示 degraded。
7
9
 
8
10
  Configuration 與 manifest 分開版本化。Config v1 會遷移為預設 disabled Stop
9
11
  verification 的 config v2;變更 capability 後必須執行經確認的 project
@@ -2,7 +2,7 @@
2
2
 
3
3
  English source version: 2026-08-03. Revalidate: when the English specification or any vendor reference changes.
4
4
 
5
- 本文件所述 OpenCode plugin 行為已於 2026-07-31 依據[官方 plugin 文件](https://opencode.ai/docs/plugins/)與[Bun shell 文件](https://bun.sh/docs/runtime/shell)檢查;Codex 與 Claude Code loop-hook 行為已於 2026-08-03 依據 [Codex hook 文件](https://developers.openai.com/codex/config-advanced#hooks) 與 [Claude Code hook 文件](https://code.claude.com/docs/en/hooks) 檢查。
5
+ 本文件所述 OpenCode plugin 行為已於 2026-07-31 依據[官方 plugin 文件](https://opencode.ai/docs/plugins/)與[Bun shell 文件](https://bun.sh/docs/runtime/shell)檢查;Codex 與 Claude Code loop-hook 行為已於 2026-08-03 依據 [Codex hook 文件](https://developers.openai.com/codex/config-advanced#hooks) 與 [Claude Code hook 文件](https://code.claude.com/docs/en/hooks) 檢查;agy hook 行為已於 2026-08-28 依據[官方 Antigravity hook 文件](https://antigravity.google/docs/hooks) 檢查。任何 vendor 參考變更時都必須重新驗證。
6
6
 
7
7
  ## HARNESS-ADAPTER-001
8
8
 
@@ -68,13 +68,15 @@ event、native output encode 與 runtime-failure output。
68
68
  ## HARNESS-ADAPTER-006
69
69
 
70
70
  Project-local `loop` profile MUST 是 opt-in、project scoped,並在最小的 Codex 與
71
- Claude Code launcher 後使用同一個 shared runtime。它 MUST NOT 將 policy 複製到
72
- project-specific script,也不得改變一般 permission request。
71
+ Claude Code launcher 後使用同一個 shared runtime;agy 使用原生支援的 lifecycle
72
+ 子集,並明確回報為 degraded。它 MUST NOT 將 policy 複製到 project-specific
73
+ script,也不得改變一般 permission request。
73
74
 
74
- - Trigger: Project 以 Codex、Claude Code 或兩者選擇 `loop`。
75
+ - Trigger: Project 以 agy、Codex、Claude Code 或任意組合選擇 `loop`。
75
76
  - Action: 只產生選定的 `.codex/hooks/agent-ops-loop.sh` 與/或 Claude 的
76
77
  `.claude/hooks/agent-ops-loop.sh`、`.claude/hooks/agent-ops-loop.ps1` launcher,註冊文件化的 loop lifecycle event
77
- (不含 `Stop`),並保留 foreign hook group。只在 `UserPromptSubmit` 或 Bash
78
+ (不含 `Stop`),並保留 foreign hook group。agy 只註冊原生
79
+ `PreInvocation`/`PreToolUse(run_command)` hook,不產生 shell launcher。只在 `UserPromptSubmit` 或 Bash
78
80
  `PreToolUse` 的 high-confidence literal credential,以及 `PreToolUse` 的危險 Bash command 時,使用
79
81
  文件化的 native denial shape 進行 blocking。對 `PermissionRequest`(包括
80
82
  escalated permission)不得輸出 decision。
@@ -86,11 +88,11 @@ project-specific script,也不得改變一般 permission request。
86
88
 
87
89
  目前 registration matrix 刻意不對稱:
88
90
 
89
- | Capability | Codex | Claude Code | OpenCode |
90
- | --- | --- | --- | --- |
91
- | lifecycle-summary | supported | supported | degraded |
92
- | command-policy | unknown | supported | supported |
93
- | optional-stop-verify | unsupported | supported | degraded |
91
+ | Capability | agy | Codex | Claude Code | OpenCode |
92
+ | --- | --- | --- | --- | --- |
93
+ | lifecycle-summary | degraded | supported | supported | degraded |
94
+ | command-policy | supported | unknown | supported | supported |
95
+ | optional-stop-verify | degraded | unsupported | supported | degraded |
94
96
 
95
97
  Runtime-failure 處理中,只有 `command-policy` 為 fail-closed。當已安裝的 config
96
98
  被分類為無效時,Claude Code 可輸出文件化的 `PreToolUse` denial shape;受管理的
@@ -99,6 +101,12 @@ denial 或 unavailable-runtime error。Codex 維持 `unknown` 且絕不輸出 de
99
101
  Fixture test 只斷言這些 wire 與 plugin shape;它們不證明 host 會實際遵守 denial。
100
102
  每個 `SessionStart` 與 `Stop` failure path 都維持 fail-open。
101
103
 
104
+ agy adapter 在 project scope 與 Codex、OpenCode 共用 `AGENTS.md` routing;user
105
+ scope 管理 `.agent-ops/GEMINI.md` 與 shared `.gemini/GEMINI.md` rule surface。
106
+ 其 native hook 使用 camelCase input,command-policy block 回傳
107
+ `decision: "deny"`,且不會強迫 Stop 繼續。在 Windows 透過 `cmd /c` 呼叫產生的
108
+ command。
109
+
102
110
  Stop verification 必須明確啟用、具備 trust、為 report-only 且預設 disabled。
103
111
  每個 Stop 結果都會讓 native harness 繼續,最多攜帶有界 command evidence,永遠
104
112
  不是 task-completion evidence。
@@ -42,6 +42,11 @@ review target MUST 以其自身的唯讀機制啟動;沒有唯讀機制的 tar
42
42
  - Positive: `agy 使用 sandboxed plan mode;opencode 仍不合格。`
43
43
  - Negative: `信任 prompt 能阻止審查者修改檔案。`
44
44
 
45
+ 每次 review 都 MUST 使用全新 session(`sessionIsolation: "fresh"`)並在
46
+ disposable repository clone 中執行。review chain 優先選擇不同於 hosting CLI 的
47
+ target;沒有其他可用 target 時,才允許同 CLI 的 fresh review,但輸出 MUST 明確
48
+ 標示 `DEGRADED: isolated self-review`。不得 resume 開發 session 作為獨立審查。
49
+
45
50
  ## REVIEW-CHAIN-001
46
51
 
47
52
  已設定的 targets 組成有序後備鏈,MUST 僅在「沒有審到」時換下一家,且 MUST NOT 在取得判定後繼續往下試。
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kylecheng3146/agent-ops",
3
- "version": "0.1.18",
4
- "description": "Evidence-driven development loops for Codex, Claude Code, and opencode",
3
+ "version": "0.1.20",
4
+ "description": "Evidence-driven development loops for agy, Codex, Claude Code, and opencode",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": "github:kylecheng3146/agent-ops",
@@ -17,7 +17,7 @@
17
17
  "minItems": 1,
18
18
  "uniqueItems": true,
19
19
  "items": {
20
- "enum": ["codex", "claude", "opencode"]
20
+ "enum": ["agy", "codex", "claude", "opencode"]
21
21
  }
22
22
  },
23
23
  "artifacts": {
@@ -127,7 +127,7 @@
127
127
  "$ref": "#/$defs/relativePath"
128
128
  },
129
129
  "harness": {
130
- "enum": ["codex", "claude"]
130
+ "enum": ["agy", "codex", "claude"]
131
131
  },
132
132
  "events": {
133
133
  "type": "array",