@tea-agent/loop-agent 0.22.0 → 0.24.0

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 (103) hide show
  1. package/AGENTS.md +42 -108
  2. package/CHANGELOG.md +85 -0
  3. package/README.md +8 -5
  4. package/bin/agent-worker.js +0 -0
  5. package/dist/application/context-usage/skill-resolution-stats.js +263 -0
  6. package/dist/application/dag/generate-task-dag.js +17 -3
  7. package/dist/cli/command-definitions.js +8 -7
  8. package/dist/cli/program.js +17 -15
  9. package/dist/commands/doctor.js +269 -18
  10. package/dist/commands/init.js +101 -86
  11. package/dist/commands/stats.js +40 -11
  12. package/dist/executors/shell-executor.js +20 -7
  13. package/dist/shared/operator/capabilities.js +486 -3
  14. package/dist/worker/console/app-data.js +6 -0
  15. package/dist/worker/console/chat/artifact-card.js +23 -0
  16. package/dist/worker/console/chat/chat-event-store.js +495 -0
  17. package/dist/worker/console/chat/chat-ui-policy.js +25 -0
  18. package/dist/worker/console/chat/composer-draft-store.js +45 -0
  19. package/dist/worker/console/chat/context-panel.js +54 -0
  20. package/dist/worker/console/chat/contract-apply-receipt-store.js +174 -0
  21. package/dist/worker/console/chat/explore-tools.js +299 -0
  22. package/dist/worker/console/chat/human-gate-card.js +37 -0
  23. package/dist/worker/console/chat/instruction-skills.js +217 -0
  24. package/dist/worker/console/chat/interview-adapter.js +136 -0
  25. package/dist/worker/console/chat/model-resolver.js +106 -0
  26. package/dist/worker/console/chat/operation-card.js +23 -0
  27. package/dist/worker/console/chat/pi-console-config.js +158 -0
  28. package/dist/worker/console/chat/pi-runtime.js +1143 -0
  29. package/dist/worker/console/chat/repo-browser.js +140 -0
  30. package/dist/worker/console/chat/repo-walk.js +116 -0
  31. package/dist/worker/console/chat/resource-loader.js +67 -0
  32. package/dist/worker/console/chat/routes.js +1646 -0
  33. package/dist/worker/console/chat/runtime-context.js +24 -0
  34. package/dist/worker/console/chat/runtime-selection.js +37 -0
  35. package/dist/worker/console/chat/session-store.js +437 -0
  36. package/dist/worker/console/chat/shortcuts.js +15 -0
  37. package/dist/worker/console/chat/tool-adapter.js +125 -0
  38. package/dist/worker/console/chat/tools.js +195 -0
  39. package/dist/worker/console/chat/usage.js +37 -0
  40. package/dist/worker/console/chat/workspace-landing.js +56 -0
  41. package/dist/worker/console/dag-confirmation.js +42 -8
  42. package/dist/worker/console/human-gate-token.js +130 -0
  43. package/dist/worker/console/mutation-gate-receipt-store.js +184 -0
  44. package/dist/worker/console/operation-runner.js +6 -2
  45. package/dist/worker/console/operation-sse.js +26 -0
  46. package/dist/worker/console/operator-actions.js +420 -7
  47. package/dist/worker/console/server.js +68 -1
  48. package/dist/worker/console/static/assets/index-BTbrEHnO.css +1 -0
  49. package/dist/worker/console/static/assets/index-D9qLevoP.js +27 -0
  50. package/dist/worker/console/static/index.html +2 -2
  51. package/dist/worker/feature/profile-schema.js +1 -1
  52. package/dist/workflows/dag/backend-test-markdown-workflow.js +9 -5
  53. package/dist/workflows/dag/backend-test-result-contract.js +229 -0
  54. package/dist/workflows/dag/frontend-lint-baseline.js +4 -4
  55. package/dist/workflows/dag/init-hybrid.js +71 -22
  56. package/dist/workflows/dag/node-execution.js +38 -1
  57. package/dist/workflows/dag/output-protocol.js +89 -0
  58. package/dist/workflows/dag/prompt.js +35 -1
  59. package/dist/workflows/dag/recovery-recommendation.js +45 -0
  60. package/dist/workflows/dag/report.js +28 -1
  61. package/dist/workflows/dag/rerun-task.js +1 -1
  62. package/dist/workflows/dag/scheduler.js +9 -0
  63. package/dist/workflows/dag/types.js +12 -0
  64. package/dist/workflows/dag/validate.js +55 -0
  65. package/docs/README.md +73 -156
  66. package/docs/architecture/README.md +7 -6
  67. package/docs/architecture/dag-execution.md +2 -2
  68. package/docs/architecture/evolution.md +16 -14
  69. package/docs/architecture/system-overview.md +1 -1
  70. package/docs/architecture/worker-and-feature.md +3 -3
  71. package/docs/governance/README.md +15 -0
  72. package/docs/{harness-methodology-debugging.md → governance/harness-methodology-debugging.md} +27 -3
  73. package/docs/init-surface.manifest.json +22 -4
  74. package/docs/operations/README.md +12 -0
  75. package/docs/{local-development-environment.md → operations/local-development-environment.md} +1 -1
  76. package/docs/skills/vetted-skill-registry.md +23 -3
  77. package/docs/templates/README.md +55 -0
  78. package/docs/templates/backend-test-dag.json +2 -2
  79. package/docs/templates/evaluation/agents-map-slim-v1.candidate.json +9 -0
  80. package/docs/templates/evaluation/agents-map-slim-v1.md +87 -0
  81. package/docs/templates/evaluation/agents-map-verbose-v0.candidate.json +9 -0
  82. package/docs/templates/evaluation/agents-map-verbose-v0.md +153 -0
  83. package/docs/templates/hybrid-dag.json +1 -1
  84. package/docs/templates/progress-log.md +9 -2
  85. package/harness.json +4 -4
  86. package/package.json +5 -5
  87. package/scripts/kb-bootstrap-init-skeleton.sh +2 -2
  88. package/skills/agent-worker/SKILL.md +1 -1
  89. package/skills/grill-with-docs/SKILL.md +44 -52
  90. package/skills/grill-with-docs/adr-format.md +37 -26
  91. package/skills/grill-with-docs/context-format.md +18 -26
  92. package/skills/loop-agent/SKILL.md +28 -112
  93. package/skills/loop-agent/references/command-reference.md +9 -3
  94. package/skills/loop-agent/references/harness-policy.md +3 -3
  95. package/skills/loop-agent/references/hybrid-dag.md +1 -1
  96. package/skills/loop-agent/references/orchestrator-and-interventions.md +1 -1
  97. package/skills/loop-agent/references/task-workflow.md +2 -0
  98. package/skills/systematic-debugging/SKILL.md +20 -4
  99. package/skills/test-driven-development/SKILL.md +10 -3
  100. package/dist/worker/console/static/assets/index-CUDke82y.js +0 -18
  101. package/dist/worker/console/static/assets/index-wSEksVSO.css +0 -1
  102. /package/docs/{harness-methodology-tdd.md → governance/harness-methodology-tdd.md} +0 -0
  103. /package/docs/{harness-methodology-verification.md → governance/harness-methodology-verification.md} +0 -0
@@ -21,6 +21,19 @@ NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
21
21
 
22
22
  若尚未完成 Phase 1,不得提出 fixes。
23
23
 
24
+ ## Feedback Loop Gate(Phase 1 之前)
25
+
26
+ 在列假设、读大段代码或改文件之前,先建立一条**快速、确定性、Agent 可运行**的 pass/fail 信号。完整优先级与手段见 governance 下的 `harness-methodology-debugging.md`。
27
+
28
+ 可执行清单:
29
+
30
+ 1. 选最小回路:失败测试 → HTTP/CLI/浏览器脚本 → fixture/snapshot → 一次性 harness → bisect/differential → 结构化 HITL。
31
+ 2. 跑一次,确认有可重复的 exit code / 断言结果。
32
+ 3. 间歇性问题:先提高复现率,再进入根因调查。
33
+ 4. **无回路 → STOP**:请求环境、artifact 或临时插桩许可;不要猜。
34
+
35
+ Verifier 角色只提供诊断与证据,不得越过 writer `writeSet` / `allowedPaths` 直接修复。
36
+
24
37
  ## When to Use
25
38
 
26
39
  用于 ANY technical issue:
@@ -45,11 +58,11 @@ NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
45
58
 
46
59
  ## The Four Phases
47
60
 
48
- 进入下一阶段前 MUST 完成每一 phase。
61
+ 进入下一阶段前 MUST 完成每一 phase。反馈回路是地基,不是第五 phase
49
62
 
50
63
  ### Phase 1: Root Cause Investigation
51
64
 
52
- **在尝试 ANY fix 之前:**
65
+ **在尝试 ANY fix 之前(且已有反馈回路):**
53
66
 
54
67
  1. **Read Error Messages Carefully**
55
68
  - 不要跳过 errors 或 warnings
@@ -215,6 +228,7 @@ NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
215
228
  ## Red Flags - STOP and Follow Process
216
229
 
217
230
  若发现自己想:
231
+ - "No pass/fail loop yet — just read code and guess"
218
232
  - "Quick fix for now, investigate later"
219
233
  - "Just try changing X and see if it works"
220
234
  - "Add multiple changes, run tests"
@@ -227,7 +241,7 @@ NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
227
241
  - **"One more fix attempt" (when already tried 2+)**
228
242
  - **Each fix reveals new problem in different place**
229
243
 
230
- **ALL of these mean: STOP. Return to Phase 1.**
244
+ **ALL of these mean: STOP. Return to feedback loop / Phase 1.**
231
245
 
232
246
  **If 3+ fixes failed:** Question the architecture (see Phase 4.5)
233
247
 
@@ -259,6 +273,7 @@ NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
259
273
 
260
274
  | Phase | Key Activities | Success Criteria |
261
275
  |-------|---------------|------------------|
276
+ | **0. Feedback Loop** | Build fast deterministic pass/fail signal | Repeatable command + exit code |
262
277
  | **1. Root Cause** | Read errors, reproduce, check changes, gather evidence | Understand WHAT and WHY |
263
278
  | **2. Pattern** | Find working examples, compare | Identify differences |
264
279
  | **3. Hypothesis** | Form theory, test minimally | Confirmed or new hypothesis |
@@ -284,8 +299,9 @@ NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
284
299
  - **`condition-based-waiting.md`** — 用 condition polling 替代 arbitrary timeouts
285
300
 
286
301
  **Related principles:**
287
- - **RED-GREEN-REFACTOR**(见 `ai_workspace/loop-agent/harness-methodology-tdd.md`)— 用于 creating failing test case(Phase 4, Step 1)
302
+ - **RED-GREEN-REFACTOR**(见 `harness.json.governanceRoot` 下 `harness-methodology-tdd.md`)— 用于 creating failing test case(Phase 4, Step 1)
288
303
  - **Verification discipline** — 宣称 success 前 verify fix worked。Run verification command,读 output,THEN claim result。
304
+ - **Feedback loop**(见同目录 `harness-methodology-debugging.md`)— Phase 1 前的 pass/fail 地基。
289
305
 
290
306
  ## Real-World Impact
291
307
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: test-driven-development
3
- description: 用于需要回归覆盖的行为变更与 bug 修复。保持小循环:写失败测试 → 变绿 → 仅在 green 后 refactor
3
+ description: 用于需要回归覆盖的行为变更与 bug 修复。保持小循环:写失败测试 → 变绿 → 仅在 green 后 refactor。禁止水平批处理。
4
4
  ---
5
5
 
6
6
  # Test-Driven Development
@@ -10,11 +10,18 @@ description: 用于需要回归覆盖的行为变更与 bug 修复。保持小
10
10
  ## 规则
11
11
 
12
12
  - 行为是新增或已损坏时,在 production code 之前写或更新聚焦测试。
13
- - 运行聚焦测试,确认因预期原因失败。
14
- - 做最小实现变更使测试变绿。
13
+ - 运行聚焦测试,确认因预期原因失败(RED)。
14
+ - 做最小实现变更使测试变绿(GREEN)。
15
15
  - refactor 仅在 green 之后,且仍在同一 bounded write set 内。
16
16
  - 能测真实本地 module 时,不要用 broad mock。
17
17
 
18
+ ## 垂直切片:一测试一实现
19
+
20
+ - 循环是:**一个行为测试 → 最小实现 → 验证通过 → 下一个行为**。
21
+ - **禁止**「先批量写完所有测试(全部 RED),再批量实现(全部 GREEN)」的水平切片。
22
+ - 每个行为切片必须有独立验收标准与可运行的验证命令。
23
+ - 纯文档 / 机械迁移工作不强制新增测试;行为变更与 bug 修复必须走上述循环。
24
+
18
25
  ## Output
19
26
 
20
27
  报告 red 命令、green 命令,以及仍需要的 broader verification。