@tea-agent/loop-agent 0.16.1 → 0.16.2

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 (31) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/executors/dag-pi-executor.js +4 -2
  3. package/dist/executors/pi-sdk-executor.js +66 -3
  4. package/dist/executors/shell-executor.js +212 -29
  5. package/dist/executors/shell-presets.js +12 -2
  6. package/dist/executors/shell-write-guard.js +20 -1
  7. package/dist/shared/git-progress.js +9 -2
  8. package/dist/worker/observability/read-model.js +56 -0
  9. package/dist/worker/observe/server.js +6 -3
  10. package/dist/workflows/dag/backend-test-analysis-contract.js +87 -30
  11. package/dist/workflows/dag/backend-test-case-manifest.js +71 -8
  12. package/dist/workflows/dag/backend-test-execution-contract.js +63 -11
  13. package/dist/workflows/dag/backend-test-repair-contract.js +94 -0
  14. package/dist/workflows/dag/backend-test-result-contract.js +6 -4
  15. package/dist/workflows/dag/backend-test-semantic-review-contract.js +36 -0
  16. package/dist/workflows/dag/dynamic-runtime/condition.js +1 -1
  17. package/dist/workflows/dag/dynamic-runtime/shared.js +42 -0
  18. package/dist/workflows/dag/failure-routing.js +1 -1
  19. package/dist/workflows/dag/frontend-implementation-contract.js +32 -16
  20. package/dist/workflows/dag/init-hybrid.js +591 -119
  21. package/dist/workflows/dag/lifecycle.js +33 -2
  22. package/dist/workflows/dag/scheduler.js +87 -17
  23. package/dist/workflows/dag/types.js +31 -0
  24. package/dist/workflows/dag/validate.js +20 -14
  25. package/docs/templates/agent-dag.schema.json +25 -2
  26. package/docs/templates/backend-test-analysis.schema.json +9 -16
  27. package/docs/templates/backend-test-dag.json +493 -197
  28. package/docs/templates/backend-test-dag.review-cases.prompt.md +10 -4
  29. package/docs/templates/backend-test-execution.schema.json +6 -1
  30. package/package.json +1 -1
  31. package/skills/loop-agent/references/hybrid-dag.md +4 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Purpose
4
4
 
5
- Use this prompt for a read-only **backend test case review** node: `executor: "pi"`, `role: "reviewer"`, `writePolicy: "read-only"`. The reviewer audits generated backend functional test cases for completeness, format compliance, and traceability to source requirements. Downstream `generate-backend-pytest-pi` depends on a `VERDICT: pass` to proceed.
5
+ Use this prompt for a read-only **backend test case review** node: `executor: "pi"`, `role: "reviewer"`, `writePolicy: "read-only"`. The reviewer audits generated backend functional test cases for completeness, format compliance, and traceability to source requirements. A first review may return `request-revision` to drive a single `revise-backend-cases-pi` pass; **final** review (`review-backend-cases-final-pi`) must emit `VERDICT: pass` before `generate-backend-pytest-pi`.
6
6
 
7
7
  Do **not** create `executor: reviewer`. Reviewer is a **role** on `executor: pi`.
8
8
 
@@ -56,7 +56,9 @@ Do NOT re-read source documents. Use the validated analysis artifact, case manif
56
56
  | **Boundary conditions** | Edge cases (empty input, max length, edge values) | Important |
57
57
  | **State transitions** | Illegal state changes covered | Important |
58
58
  | **Requirement traceability** | Each acceptance criterion (AC-xxx) maps to at least one test case ID (manifest coverageSummary or evidenceGaps) | Critical |
59
- | **Manifest consistency** | Markdown cases align with Case Manifest v1 caseId/acIds | Critical |
59
+ | **Manifest consistency** | Markdown case bodies **and** any AC matrix list the **same full** `BE-*` ids as Case Manifest v1 `caseId`→`acIds`. Never claim "all cases" / "全部用例" cover an AC unless every case maps that AC. | Critical |
60
+ | **Planned automation** | Missing `test_*.py` before generate-pytest is **Informational only**, not Critical | Informational |
61
+ | **Out-of-scope ACs** | Flyway / frontend e2e / `mvn test` etc. already in manifest `evidenceGaps` must not be treated as uncovered Critical | Informational |
60
62
  | **Case structure** | Each case has: ID, Title, Precondition, Steps, Expected Result | Important |
61
63
  | **No duplicate IDs** | All test case IDs are unique across files | Critical |
62
64
 
@@ -77,7 +79,11 @@ Do NOT re-read source documents. Use the validated analysis artifact, case manif
77
79
 
78
80
  ### Output Shape (after verdict line)
79
81
 
80
- 1. **Coverage Assessment** — table mapping each AC to covering test case IDs (or "uncovered").
82
+ 1. **Coverage Assessment** — table mapping each AC to covering **full** test case IDs (or "uncovered" / gap).
81
83
  2. **Findings** — bullet list tagged `Critical`, `Important`, or `Informational`.
82
84
  3. **Statistics** — total case count, positive/negative/boundary breakdown, module distribution.
83
- 4. **Required revisions** (only when `request-revision`) — numbered items for the upstream generator to fix.
85
+ 4. **Required revisions** (only when `request-revision` on the **first** review) — numbered, concrete MD edits for `revise-backend-cases-pi` (fix matrices, acIds, full BE-* ids).
86
+
87
+ ### Final review note
88
+
89
+ When this prompt is used for `review-backend-cases-final-pi` after revision, still use the same checklist. Remaining Critical issues must yield `request-revision` (final gate will stop the DAG). Do not pass with unresolved MD↔manifest AC mismatches.
@@ -69,7 +69,12 @@
69
69
  "additionalProperties": false,
70
70
  "required": ["path", "description"],
71
71
  "properties": {
72
- "path": { "type": "string", "minLength": 1 },
72
+ "path": {
73
+ "type": "string",
74
+ "minLength": 1,
75
+ "pattern": "^/(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*//)(?!.*\\\\)[^?#]*$",
76
+ "description": "HTTP URL path on the target service for readiness probes (e.g. /api/health). Not a repository file path; must start with one /, use POSIX separators, and must not include duplicate slashes, dot segments, query, fragment, or scheme. Runtime trims surrounding whitespace before validating and materializing the normalized path."
77
+ },
73
78
  "description": { "type": "string", "minLength": 1 }
74
79
  }
75
80
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tea-agent/loop-agent",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "loop-agent": "bin/loop-agent.js",
@@ -18,7 +18,10 @@
18
18
 
19
19
  前端专用链在 `frontend-scout-pi` 后加入只读 `frontend-mock-assess-pi` 和确定性 contract gate,根据接口契约、后端就绪度、生成期能力 seed 与固化验证入口选择 `native|browser-intercept|request-adapter|not-needed|blocked`。策略直接传给 plan、两阶段 design review、唯一 writer、实现 review 和 closeout;真实请求保持默认,缺少契约、生产隔离、注释真实请求或显式 required 合同不完整时 gate 阻塞。可选 `frontendMock` 配置声明 `auto|required|disabled`、既有服务目录与专项命令;默认 `auto` 下没有已确认 Mock 能力时跳过 Mock 继续实现并保留真实联调缺口,不安全或不完整的显式 required 合同只生成无 writer 的评估链,有可信命令时才增加 `frontend-mock-verify-shell`。Mock-backed 证据只证明前端状态;跳过 Mock 且未调用后端时 closeout 报告 `Frontend status: locally-validated` 与 `Real integration: pending`。
20
20
 
21
- 显式专用 `taskKind` 保持兼容并优先于任务源分类,也不扩充 governance profile:`frontend-implementation` 显式选择前端实现 DAG,`frontend-test` 选择 FE-test RAG DAG,`backend-test` 选择后端测试 DAG,`knowledge-sync` 选择 Feature 测试知识回写 DAG,`knowledge-graph-bootstrap` 选择业务知识图谱开荒/增量 DAG。后端测试链为 `analyze-inputs-pi → backend-test-analysis-contract-shell → backend-test-environment-scout-pi → backend-test-execution-contract-shell → generate-backend-functional-cases-pi → emit-backend-case-manifest-pi → backend-test-case-manifest-shell → review-backend-cases-pi → review-backend-cases-gate-shell → generate-backend-pytest-pi → backend-test-traceability-gate-shell → execute-backend-pytest-shell → parse-backend-test-result-shell → classify-backend-test-result-pi → test-retrospect-pi → backend-test-outcome-gate-shell`。analysis/execution/case-manifest gate 写入 run-owned contracts;parse materialize Backend Test Result v1(`contracts/backend-test-result.json`)。Case Manifest 确定性校验 AC→case 覆盖;traceability gate 校验 generated file/symbol。execute 在非空 JUnit 下将 pytest exit 0/1 视为节点成功以便 always-run retrospect;`backend-test-outcome-gate-shell` 以 result.outcome 收口;retrospect 使用 manifest coverageSummary + Result v1,不得自造 coverage%。`evidenceGaps`、未知 framework、secret 值、路径穿越或 preflight 失败时后续 writer/execute 不启动。`knowledge-sync` 链必须绑定 `featureId`;图谱运维公共入口是 `loop-agent knowledge query|graph-init|graph-materialize|graph-promote|graph-incremental-prepare`。治理等级仍由既有 `minimal|standard|reviewed|supervised` 规则推断。
21
+
22
+ > Backend-test vNext:Analysis v2 明确 responseBody shape、ordering、field comparison/precision 与 sourceRefs,并兼容归一化 v1;pytest 生成后 traceability 会按真实 symbol 更新 generated Manifest 和 global/in-scope/cross-domain coverage,随后执行结构化语义 review,最多一次 testcase-only revision,final pass 后才运行 initial pytest。Observe snapshot 投影 initial/classification/repair/final/effective facts。
23
+
24
+ 显式专用 `taskKind` 保持兼容并优先于任务源分类。`backend-test` 选择固定 **24 个真实顶层节点**的后端测试 DAG:intake 双合同、cases+manifest、单次 case revision、pytest 生成与 semantic review、单次 semantic revision、initial execute+parse、classification+eligibility、单次 TestBug repair、final/effective Result、retrospective 和 outcome gate。三条可选分支由 fail-closed `runIf` 控制,不通过动态子节点隐藏数量;所有原有 contracts/JUnit/Result/traceability/repair safety artifacts 继续保留。`knowledge-sync` 与 `knowledge-graph-bootstrap` 继续通过各自显式 taskKind 选择知识回写/图谱开荒 DAG。治理等级仍由 `minimal|standard|reviewed|supervised` 推断。
22
25
 
23
26
  ### DAG workflow 层级
24
27