@kylecheng3146/agent-ops 0.1.6 → 0.1.8

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 (43) hide show
  1. package/README.md +27 -0
  2. package/dist/packages/cli/src/args.js +47 -0
  3. package/dist/packages/cli/src/bin.js +74 -25
  4. package/dist/packages/cli/src/cli.js +13 -1
  5. package/dist/packages/cli/src/commands/init.js +4 -1
  6. package/dist/packages/cli/src/commands/review.js +371 -27
  7. package/dist/packages/cli/src/commands/task.js +4 -1
  8. package/dist/packages/cli/src/commands/verify.js +13 -1
  9. package/dist/packages/cli/src/version.js +1 -1
  10. package/dist/packages/cli/src/wizard.js +62 -3
  11. package/dist/runtime/src/config/merge.js +17 -2
  12. package/dist/runtime/src/contracts.js +1 -1
  13. package/dist/runtime/src/install/doctor.js +42 -1
  14. package/dist/runtime/src/install/plan.js +11 -5
  15. package/dist/runtime/src/review/execute.js +180 -0
  16. package/dist/runtime/src/review/extract.js +69 -0
  17. package/dist/runtime/src/review/invocation.js +116 -0
  18. package/dist/runtime/src/review/packet.js +42 -5
  19. package/dist/runtime/src/review/probe.js +72 -0
  20. package/dist/runtime/src/review/render.js +62 -0
  21. package/dist/runtime/src/review/report.js +183 -0
  22. package/dist/runtime/src/review/result.js +2 -2
  23. package/dist/runtime/src/review/roles.js +35 -0
  24. package/dist/runtime/src/review/runner.js +98 -12
  25. package/dist/runtime/src/review/scope.js +123 -0
  26. package/dist/runtime/src/schema/validate.js +80 -0
  27. package/dist/runtime/src/task/service.js +46 -1
  28. package/dist/runtime/src/task/store.js +16 -4
  29. package/dist/runtime/src/verify/change-surface.js +38 -2
  30. package/dist/runtime/src/verify/command-executor.js +4 -1
  31. package/dist/runtime/src/verify/evidence.js +36 -0
  32. package/dist/runtime/src/verify/scope.js +1 -2
  33. package/dist/runtime/src/verify/service.js +66 -9
  34. package/dist/runtime/src/verify/source-fingerprint.js +49 -0
  35. package/dist/runtime/src/verify/spawn.js +9 -3
  36. package/docs/en/guides/configuration.md +68 -0
  37. package/docs/en/spec/review.md +37 -4
  38. package/docs/zh-TW/guides/configuration.md +60 -0
  39. package/docs/zh-TW/spec/review.md +33 -3
  40. package/package.json +1 -1
  41. package/schemas/config.schema.json +29 -0
  42. package/schemas/evidence.schema.json +16 -1
  43. package/schemas/review-report.schema.json +48 -0
@@ -27,6 +27,66 @@ harness surface 並套用選定的 target policy;若不是 managed default,
27
27
  Claude 與 Codex lifecycle support 為 `supported`,OpenCode 從 app initialization
28
28
  開始,因此誠實標示為 `degraded`。
29
29
 
30
+ ### 外部 review 目標
31
+
32
+ `agent-ops review` 可以呼叫另一個 agent CLI 來審查你的工作。預設關閉 ——
33
+ 缺少 `reviewRoles` 欄位、缺少 `--review-target` 旗標、互動式問題的預設值,
34
+ 三者都代表關閉。在 `agent-ops init` 時啟用,或手動設定:
35
+
36
+ ```json
37
+ {
38
+ "reviewRoles": [
39
+ { "role": "independent-review", "targets": ["claude"] }
40
+ ]
41
+ }
42
+ ```
43
+
44
+ `targets` 是**有序的後備鏈**。每次 review 都鎖定 staged/unstaged/untracked
45
+ 變更(或乾淨的 `--base <ref>...HEAD`),並要求必要驗證的最新 PASS evidence;
46
+ 完整原生 schema report 會顯示給人看,但不會持久化。
47
+
48
+ 每次嘗試都從新的暫存 cwd 與最小環境啟動。目前只有 Claude 具備完整的
49
+ context-isolation 合約,能自動執行:
50
+
51
+ | 目標 | 呼叫方式 | 唯讀 |
52
+ | --- | --- | --- |
53
+ | `codex` | `codex exec` | 保留設定;`capability-unavailable` |
54
+ | `agy`(Antigravity)| `agy -p` | 保留設定;`capability-unavailable` |
55
+ | `claude` | `claude -p` | `--permission-mode plan --safe-mode` |
56
+
57
+ `opencode` **不是** review 目標,即使它是支援的 harness。它的 `--agent plan`
58
+ 會被判定為 subagent 而遭拒,並靜默退回可寫入的 agent,因此無法滿足唯讀前置
59
+ 條件。沒有唯讀旗標的目標會被跳過,不會在無沙箱狀態下執行。
60
+
61
+ 只有在「根本沒審到」時才換下一家 —— 執行檔不存在、spawn 失敗、或逾時
62
+ (每個目標預設 120 秒,可用 `timeoutMs` 覆寫)。`FAIL` 判定是**終局**:
63
+ 拿到真實判定後絕不再試下一家,否則就變成自動化的 review shopping。
64
+ 無法解析的輸出同樣終局,因為那代表 prompt 約定或 CLI 版本不合,該浮出來修。
65
+
66
+ 若 host 是 Claude Code(`CLAUDECODE` 已設定),`claude` 會被移到鏈尾。
67
+ 當它是唯一設定的目標時仍會執行,並附上 `reviewer == host` 警告。
68
+
69
+ criterion 描述來自當前 session 綁定的 task,所以 review 需要已附加、且建立時的
70
+ policy 設定仍相同的 task;`--criterion` 用來篩選 id。請先執行
71
+ `agent-ops verify`:必要 evidence 若失敗、過期或來源不符,review 會在 model 呼叫前停止。
72
+ 僅 compact PASS evidence 會以 `review:<target>:` 附加;完整人類可讀 report 是暫存的。
73
+ 已完成的 task 絕不改寫。
74
+
75
+ 每次執行 review 仍需 `--yes`:init 的勾選決定「允許哪些目標」,
76
+ `--yes` 決定「現在是否要花錢」。
77
+
78
+ 因為不從 stderr 嗅探認證狀態,未登入的 CLI 會表現為一次 review 失敗。
79
+ 用以下指令診斷:
80
+
81
+ ```bash
82
+ agent-ops doctor # 只驗執行檔存在:零 token、零網路
83
+ agent-ops doctor --check-auth # 每個目標一次真實 print 呼叫
84
+ ```
85
+
86
+ `--check-auth` 是專屬旗標;`--yes` 對 doctor 維持惰性。doctor 只回報該做什麼,
87
+ 不會代為修復:所有目標都經由互動式 OAuth 認證,因此沒有 `--fix`。
88
+ 請自行執行 `<target> login`。
89
+
30
90
  ### Project-local loop profile
31
91
 
32
92
  `--profile loop` 是明確 opt-in 的 project-scope profile。請選擇 `codex`、
@@ -24,10 +24,40 @@ English source version: 2026-07-23. Revalidate: when the English specification c
24
24
 
25
25
  ## REVIEW-HARNESS-001
26
26
 
27
- 即使 installation 支援多個 harness,一次 review invocation MUST 解析成恰好一個 concrete harness
27
+ 即使 installation 支援多個 harness,一次 review invocation MUST 解析成恰好一個 concrete review target
28
28
 
29
29
  - Trigger: 使用 harness selection 執行 `review`。
30
- - Action: 從 `codex`、`claude` 或 `opencode` 中選一個;multi-harness installation 與 review execution 分開處理。
30
+ - Action: 從 `codex`、`agy` 或 `claude` 中選一個;multi-harness installation 與 review execution 分開處理。
31
31
  - Evidence: argument parsing 會拒絕 review 使用 `all`、`both` 或逗號分隔的多 harness 值。
32
- - Positive: `review --harness opencode` 解析成一個 harness
32
+ - Positive: `review --harness claude` 解析成一個 target
33
33
  - Negative: `讓一次 review invocation 隱式跑過所有已安裝 harness。`
34
+
35
+ ## REVIEW-READONLY-001
36
+
37
+ review target MUST 以其自身的唯讀機制啟動;沒有唯讀機制的 target MUST 被跳過,而非在無沙箱狀態下執行。
38
+
39
+ - Trigger: 為已設定的 target 組建 review invocation。
40
+ - Action: 傳入 `-s read-only`(codex)、`--sandbox --mode plan`(agy)或 `--permission-mode plan`(claude);其餘 target 視為不合格。
41
+ - Evidence: spawn 出的 argv 含該 target 的唯讀旗標。
42
+ - Positive: `opencode 不是 review target:--agent plan 會靜默退回可寫入的 agent。`
43
+ - Negative: `信任 prompt 能阻止審查者修改檔案。`
44
+
45
+ ## REVIEW-CHAIN-001
46
+
47
+ 已設定的 targets 組成有序後備鏈,MUST 僅在「沒有審到」時換下一家,且 MUST NOT 在取得判定後繼續往下試。
48
+
49
+ - Trigger: 某個已設定的 target 不存在、spawn 失敗或逾時。
50
+ - Action: 試下一個 target;遇到 PASS、FAIL 或無法解析的輸出即停止並回報該結果。
51
+ - Evidence: spawn 次數等於判定之前的失敗次數。
52
+ - Positive: `codex 的 FAIL 是終局;不會再問 agy 第二意見。`
53
+ - Negative: `FAIL 之後改試其他 target,直到有人回報 PASS。`
54
+
55
+ ## REVIEW-CONTRACT-001
56
+
57
+ 違反回覆約定的回應 MUST 回報為 NOT_RUN,而非 FAIL。
58
+
59
+ - Trigger: 審查者遺漏、重複或憑空新增 criterion,或給出空白 evidence。
60
+ - Action: 以 reason `unparseable-output` 回報 `NOT_RUN`,不寫入任何 evidence,並保留 FAIL 表示「經審查判定不合格」。
61
+ - Evidence: 結果的 reason 能區分協議違規與判定結果。
62
+ - Positive: `NOT_RUN:unparseable-output;缺少一條 criterion。`
63
+ - Negative: `因為模型的 JSON 格式錯誤就記錄一次失敗的審查。`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kylecheng3146/agent-ops",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Evidence-driven development loops for Codex, Claude Code, and opencode",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -23,6 +23,35 @@
23
23
  "enum": ["core", "advisory", "guardrails", "loop"]
24
24
  }
25
25
  },
26
+ "reviewRoles": {
27
+ "type": "array",
28
+ "items": {
29
+ "type": "object",
30
+ "additionalProperties": false,
31
+ "required": ["role", "targets"],
32
+ "properties": {
33
+ "role": {
34
+ "enum": [
35
+ "mechanical",
36
+ "implementation",
37
+ "deep-reasoning",
38
+ "independent-review"
39
+ ]
40
+ },
41
+ "targets": {
42
+ "type": "array",
43
+ "minItems": 1,
44
+ "uniqueItems": true,
45
+ "items": {
46
+ "enum": ["codex", "agy", "claude"]
47
+ }
48
+ },
49
+ "model": { "type": "string", "minLength": 1 },
50
+ "effort": { "type": "string", "minLength": 1 },
51
+ "timeoutMs": { "type": "integer", "minimum": 1 }
52
+ }
53
+ }
54
+ },
26
55
  "verification": {
27
56
  "type": "object",
28
57
  "additionalProperties": false,
@@ -15,13 +15,16 @@
15
15
  "startedAt",
16
16
  "finishedAt",
17
17
  "exitCode",
18
+ "status",
19
+ "failureClass",
20
+ "sourceFingerprint",
18
21
  "testCount",
19
22
  "toolVersions",
20
23
  "configHash"
21
24
  ],
22
25
  "properties": {
23
26
  "schemaVersion": {
24
- "const": 1
27
+ "const": 2
25
28
  },
26
29
  "taskId": {
27
30
  "$ref": "#/$defs/id"
@@ -62,6 +65,18 @@
62
65
  "minimum": 0,
63
66
  "maximum": 9007199254740991
64
67
  },
68
+ "status": {
69
+ "enum": ["PASS", "FAIL", "UNKNOWN"]
70
+ },
71
+ "failureClass": {
72
+ "type": "string",
73
+ "minLength": 1,
74
+ "maxLength": 256,
75
+ "pattern": "^[^\\u0000]*$"
76
+ },
77
+ "sourceFingerprint": {
78
+ "$ref": "#/$defs/hash"
79
+ },
65
80
  "toolVersions": {
66
81
  "type": "object",
67
82
  "additionalProperties": {
@@ -0,0 +1,48 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/kylecheng3146/agent-ops/schemas/review-report.schema.json",
4
+ "title": "Agent Ops detailed independent review report",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["summary", "results", "findings", "residualRisks", "changedFilesInspected", "supportingFilesInspected"],
8
+ "properties": {
9
+ "summary": { "$ref": "#/$defs/text" },
10
+ "results": { "type": "array", "items": { "$ref": "#/$defs/result" } },
11
+ "findings": { "type": "array", "items": { "$ref": "#/$defs/finding" } },
12
+ "residualRisks": { "type": "array", "items": { "$ref": "#/$defs/text" } },
13
+ "changedFilesInspected": { "type": "array", "items": { "$ref": "#/$defs/path" }, "uniqueItems": true },
14
+ "supportingFilesInspected": { "type": "array", "items": { "$ref": "#/$defs/path" }, "uniqueItems": true }
15
+ },
16
+ "$defs": {
17
+ "text": { "type": "string", "minLength": 1, "maxLength": 16384, "pattern": "[^\\s\\u0000]" },
18
+ "path": { "type": "string", "minLength": 1, "maxLength": 4096, "pattern": "^(?!/)(?!.*\\\\)(?!.*(?:^|/)\\.\\.(?:/|$))[A-Za-z0-9._/-]+$" },
19
+ "result": {
20
+ "type": "object", "additionalProperties": false,
21
+ "required": ["criterionId", "status", "summary", "evidence"],
22
+ "properties": {
23
+ "criterionId": { "$ref": "#/$defs/text" },
24
+ "status": { "enum": ["PASS", "FAIL"] },
25
+ "summary": { "$ref": "#/$defs/text" },
26
+ "evidence": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/text" } }
27
+ }
28
+ },
29
+ "location": {
30
+ "type": "object", "additionalProperties": false, "required": ["path"],
31
+ "properties": { "path": { "$ref": "#/$defs/path" }, "line": { "type": "integer", "minimum": 1 } }
32
+ },
33
+ "finding": {
34
+ "type": "object", "additionalProperties": false,
35
+ "required": ["severity", "blocking", "title", "details", "locations", "evidence", "recommendation", "criterionIds"],
36
+ "properties": {
37
+ "severity": { "enum": ["critical", "important", "minor"] },
38
+ "blocking": { "type": "boolean" },
39
+ "title": { "$ref": "#/$defs/text" },
40
+ "details": { "$ref": "#/$defs/text" },
41
+ "locations": { "type": "array", "items": { "$ref": "#/$defs/location" } },
42
+ "evidence": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/text" } },
43
+ "recommendation": { "$ref": "#/$defs/text" },
44
+ "criterionIds": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/text" } }
45
+ }
46
+ }
47
+ }
48
+ }