@tea-agent/loop-agent 0.19.0 → 0.20.1-beta.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.
- package/CHANGELOG.md +19 -0
- package/dist/application/dag/generate-task-dag.js +12 -1
- package/dist/executors/shell-executor.js +189 -2
- package/dist/worker/observe/spec-evidence.js +33 -0
- package/dist/worker/observe/static/views/dag-inspector.js +67 -4
- package/dist/workflows/dag/backend-test-markdown-workflow.js +163 -41
- package/dist/workflows/dag/backend-test-result-contract.js +30 -7
- package/dist/workflows/dag/frontend-prewrite-gate.js +172 -0
- package/dist/workflows/dag/frontend-project-capability.js +6 -2
- package/dist/workflows/dag/frontend-repair.js +7 -1
- package/dist/workflows/dag/frontend-review-context.js +43 -0
- package/dist/workflows/dag/frontend-verification-trace.js +34 -15
- package/dist/workflows/dag/governance-profile.js +14 -6
- package/dist/workflows/dag/init-hybrid.js +144 -399
- package/dist/workflows/dag/types.js +33 -0
- package/dist/workflows/dag/validate.js +22 -1
- package/docs/README.md +1 -0
- package/docs/templates/agent-dag.schema.json +40 -0
- package/docs/templates/backend-test-dag.generate-pytest.prompt.md +23 -192
- package/docs/templates/backend-test-dag.json +8 -8
- package/docs/templates/backend-test-dag.review-cases.prompt.md +22 -75
- package/package.json +1 -1
- package/skills/frontend-design-review/SKILL.md +5 -3
- package/skills/frontend-design-review/references/review-checklist.md +3 -2
- package/skills/frontend-implementation/references/design-spec.md +16 -8
- package/skills/frontend-implementation/references/node-contracts.md +6 -8
- package/skills/frontend-review/SKILL.md +12 -9
- package/skills/frontend-review/references/review-findings.md +5 -1
- package/skills/frontend-verification/SKILL.md +5 -3
- package/skills/frontend-verification/references/verification-checklist.md +3 -2
- package/skills/loop-agent/references/hybrid-dag.md +2 -2
|
@@ -2,14 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
## Required Source Sequence
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
Knowledge base and `openspec/` are parallel specification sources:
|
|
6
|
+
|
|
7
|
+
1. Attempt the configured component/design knowledge-base query first when a
|
|
8
|
+
connector is available in the execution environment.
|
|
9
|
+
2. Regardless of knowledge-base success, failure, timeout, no match, or no
|
|
10
|
+
configuration, also recursively search the project root's exact `openspec/`
|
|
11
|
+
directory for index files and task-relevant specification content.
|
|
12
|
+
3. Treat relevant matches from both sources as the current project's
|
|
13
|
+
specification for this run.
|
|
14
|
+
4. Only then use component source, tokens, stories, tests, and pages as
|
|
15
|
+
non-normative repository fallback.
|
|
16
|
+
|
|
17
|
+
Never skip `openspec/` directly to neighboring-code conventions, even when a
|
|
18
|
+
knowledge-base query returned results. Report source conflicts instead of
|
|
19
|
+
combining them. Explicit task requirements remain the contract; flag conflicts
|
|
20
|
+
with knowledge-base or `openspec/` rules.
|
|
13
21
|
|
|
14
22
|
## Knowledge Base Connection — TODO
|
|
15
23
|
|
|
@@ -6,22 +6,20 @@ Pre-write nodes are read-only. Preserve IDs, labels, commands, language, require
|
|
|
6
6
|
|
|
7
7
|
- **`frontend-contract-pi`**: `Scope`, `Non-goals`, `Acceptance Criteria`, `UI States`, `Target Runtime Environment`, `Risks`, `Verification Expectations`. No guessed requirements.
|
|
8
8
|
- **`frontend-scout-pi`**: routes, components, tokens, data/API/Mock, scripts, tests, assets. Fact vs inference vs gap. Knowledge base first; else search+read `<repoRoot>/openspec/**` before repo fallback. Output stack, routes, components, styling, conventions, state/data, test entry points, reuse, risks.
|
|
9
|
-
- **`frontend-
|
|
10
|
-
|
|
11
|
-
Pi output mapping promotes the first explicitly labeled Mock strategy line ahead of any preamble, including common bullet, quote, inline-code, fullwidth-colon, `Mock strategy`, and split label/value drift, without inventing or replacing its value; missing, unlabeled, malformed, or blocked strategies still fail closed. Prefer native Mock; browser intercept only with existing e2e; request-adapter only for reversible local preview. Default `auto` may select `not-needed` when contract/scout evidence confirms no project Mock capability, without adding Mock files/deps, while keeping real requests default and recording the Real Integration Gap. Other `not-needed` cases need positive no-remote/stable-backend evidence; invalid when `frontendMock.policy=required`. `blocked` for missing/conflicting contracts, unsafe paths/deps, unread specs, production-default-on, unverifiable entrypoints. Output Mock Decision, API/spec/service evidence, backend readiness, selection evidence, endpoint/fixture matrix, activation, targets, production safety, verification plan, real-integration gap, blocking issues. Never invent fields, store secrets, comment real requests, import test mocks into production, or treat Mock as real integration. Gate uses `first-non-empty` only; never authorizes writes. Unsafe required contracts → no writer.
|
|
12
|
-
- **`frontend-plan-pi` + conditional design loop**: AC → steps, in-bound files, UI states, reuse, deps, activation/rollback, frozen verify entrypoints, real-integration gap. Initial `VERDICT: pass` uses the original plan directly. Only exact `VERDICT: request-revision` runs read-only plan revision plus final review; there is no `frontend-first-design-gate-shell` or pass-path `PASS_NO_REVISION_NEEDED` node. The effective final gate prefers final review when present, otherwise initial review, and only exact pass authorizes writes; malformed/missing/request-revision fails closed → replan/rerun (not dev-fix). The plan-pi prompt includes the complete `frontend-implementation-contract-v1` JSON Schema loaded from the loop-agent package `docs/templates/` path, plus deterministic source binding, risk level, and allowed implementation targets. The model does not need to search or guess contract fields; `schemaId`, `targetFiles`, `requirementCoverage` are explicitly forbidden.
|
|
9
|
+
- **`frontend-plan-pi` + conditional design loop**: AC → steps, in-bound files, UI states, reuse, deps, Mock/API strategy, activation/rollback, frozen verify entrypoints, real-integration gap, and exactly one `frontend-implementation-contract-v1` JSON object. Prefer native Mock; browser intercept only with existing e2e; request-adapter only for a reversible seam. `auto` may select `not-needed` when no project Mock capability exists, while keeping real requests default and recording the gap; `required` cannot. Initial design pass uses the original plan; only exact `request-revision` runs read-only revision plus final review. Small-risk runs one design review only.
|
|
10
|
+
- **`frontend-prewrite-gate-shell`**: the sole write authorization. Resolve effective plan/review, require exact pass, retain every REQ/BR/AC id, enforce Mock policy, validate schema/source binding, and materialize `contracts/frontend-implementation-contract.json`. Fallback is allowed only when a conditional primary is absent; an existing malformed primary fails closed. Generation-time blocked Mock produces one deterministic blocking shell node and no writer.
|
|
13
11
|
- **`frontend-implement-pi`**: sole exclusive writer. Stay in `writeSet`; real requests default-on; Mock reversible, dev/test-only, production-off. Atomic handler/intercept/adapter with consumer+tests. Stop on forbidden paths or guesses. Output changed files, behavior, UI states, styling notes, verification attempted, residual risks. Optional mock-verify when frozen; static+behavior always; behavior must prove page consumption. Skipped-Mock `not-needed` keeps real integration pending unless the real backend path has fresh evidence.
|
|
14
12
|
|
|
15
13
|
## Contract / trace / stages (M1–M2)
|
|
16
14
|
|
|
17
|
-
-
|
|
18
|
-
-
|
|
15
|
+
- `frontend-verify-assess-shell` runs Mock/static/behavior command groups, binds contract `verificationTargets` to command labels and file/symbol evidence, then writes `frontend-verification-trace.json` and `frontend-repair-assessment.json`. Browser/visual remain `not-run`.
|
|
16
|
+
- `frontend-review-context-shell` captures the real diff and combines contract, effective trace, repair assessment, and diff into `contracts/frontend-review-context.json`.
|
|
19
17
|
- Implement stages: (1) contract confirm (2) tests sync (3) component/UI (4) API/Mock (5) frozen checks (6) diff cleanup. Summary: Contract Ref, Changed Files, Requirements, UI States, Tests, Verification Attempts, Deviations, Residual Risks.
|
|
20
18
|
|
|
21
19
|
## Repair (M3)
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
Only `eligible=true` runs `frontend-repair-pi` (same writeSet as implement; no re-spec; max 1 attempt) and `frontend-reverify-shell`. No failure condition-skips both. Non-repairable contract/path/dependency/credential/deploy/spec-unclear failures fail closed.
|
|
24
22
|
|
|
25
23
|
## Risk & capability (M4–M6)
|
|
26
24
|
|
|
27
|
-
Deterministic risk (no model); high-risk beats small; supervised never small.
|
|
25
|
+
Deterministic risk (no model); high-risk beats small; supervised never small. Standard/high-risk contain 15 top-level nodes; small contains 13 by omitting revision and final review. Capability seed injects adapters; openspec/task sources outrank. A11y: static/component tools only when present; Browser a11y always not-run.
|
|
@@ -10,14 +10,11 @@ references:
|
|
|
10
10
|
# Frontend Review
|
|
11
11
|
|
|
12
12
|
Use for `frontend-review-pi`; read the findings guide first. Required inputs are
|
|
13
|
-
original task/reference material,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
exist, treat them as the authoritative actual diff—do not request revision solely for
|
|
19
|
-
"missing diff". Only force revision for a missing actual diff when both artifacts are
|
|
20
|
-
absent; never invent a diff from an implementation summary alone.
|
|
13
|
+
original task/reference material, effective plan/design branch, implementation summary,
|
|
14
|
+
and `contracts/frontend-review-context.json`. That canonical context binds the validated
|
|
15
|
+
implementation contract, effective initial-or-post-repair verification trace, repair
|
|
16
|
+
assessment, and run-owned actual diff. Treat its diff as authoritative; never invent a
|
|
17
|
+
diff from an implementation summary alone.
|
|
21
18
|
|
|
22
19
|
## Verdict Contract
|
|
23
20
|
|
|
@@ -37,7 +34,13 @@ required check, forbidden write, or unmet acceptance criterion forces revision.
|
|
|
37
34
|
and no false real-integration claim. `not-needed` needs applicable real/no-remote
|
|
38
35
|
evidence, or an explicit default-auto skipped-Mock rationale with the Real
|
|
39
36
|
Integration Gap preserved when no project Mock capability is confirmed.
|
|
40
|
-
- Component/design claims require traceable
|
|
37
|
+
- Component/design claims require traceable evidence from two parallel sources:
|
|
38
|
+
knowledge base and `<repoRoot>/openspec/**`. Query the knowledge-base connector
|
|
39
|
+
when available; regardless of result, also read `<repoRoot>/openspec/**`.
|
|
40
|
+
The connector format is TODO; never claim a query or fallback search without
|
|
41
|
+
evidence. Execute explicit `grep`/`find` to locate spec files and `read` to
|
|
42
|
+
load them before referencing their rules. Only successful `read` tool calls are
|
|
43
|
+
observable as "已读取规范文件" in the spec-evidence inspector.
|
|
41
44
|
- Treat shell exit status as authoritative. Do not edit files.
|
|
42
45
|
|
|
43
46
|
## Evidence And Output
|
|
@@ -11,7 +11,11 @@
|
|
|
11
11
|
- Cite tight file locations, exact commands/results, or named DAG artifacts.
|
|
12
12
|
- Never invent evidence; name the missing check. An implementation summary is not the actual diff.
|
|
13
13
|
- Failed required static/behavior verification is at least Important unless proven unrelated.
|
|
14
|
-
-
|
|
14
|
+
- Treat the knowledge base and `openspec/` as parallel sources. Record
|
|
15
|
+
connector/query, source ID/version, and retrieval time for knowledge-base
|
|
16
|
+
claims. Regardless of that result, evidence must show
|
|
17
|
+
`<repoRoot>/openspec/**` search terms and matched paths/headings; label
|
|
18
|
+
`openspec`, `repository fallback`, or `unavailable` accurately.
|
|
15
19
|
|
|
16
20
|
## Review Sequence
|
|
17
21
|
|
|
@@ -24,9 +24,11 @@ verdict/findings, and required browser, visual, manual, or knowledge evidence.
|
|
|
24
24
|
- Mock-backed behavior proves frontend rendering and state transitions only. It never
|
|
25
25
|
proves backend readiness, transport compatibility, or real API integration.
|
|
26
26
|
- Unavailable commands remain gaps.
|
|
27
|
-
- Resolve design evidence
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
- Resolve design evidence from two parallel sources: query the execution environment's
|
|
28
|
+
knowledge base connector when available; regardless of result, also read
|
|
29
|
+
`<repoRoot>/openspec/**` for index and task-relevant specification content.
|
|
30
|
+
The connector format remains TODO; never invent it. Applied `openspec` rules
|
|
31
|
+
from successful reads are available project evidence.
|
|
30
32
|
- Separate Mock service/handler checks from page consumption and record the
|
|
31
33
|
dev/test-only boundary; handler tests alone do not prove page use.
|
|
32
34
|
|
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|
## Design And Component Evidence
|
|
14
14
|
|
|
15
|
-
- Claims cite knowledge-base retrieval
|
|
16
|
-
|
|
15
|
+
- Claims cite two parallel sources: knowledge-base retrieval and
|
|
16
|
+
`<repoRoot>/openspec/**`.
|
|
17
|
+
- Evidence records query/source/time for knowledge base plus openspec search terms, paths, headings, and applied rules for both.
|
|
17
18
|
- Relevant `openspec/` matches satisfy source availability; missing both sources blocks explicit compliance or required design decisions.
|
|
18
19
|
|
|
19
20
|
## Status
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
|
|
17
17
|
对于默认 `standard` 任务,生成器根据标题、`source/需求.md` 和结构化 `allowedPaths` 做保守、确定性的需求分类。只有高置信的前端实现需求自动选择 `frontend-implementation` DAG;后端、前后端混合、明确排除前端或证据不足的需求继续使用 governance profile 选出的模板。分类不会把普通后端实现路由到 `backend-test`,也不会替换由显式 profile、`workflowPolicy` 或 supervised quality gate 选中的 supervised 模板。
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
前端专用链保留独立 contract/scout;plan 同时选择 Mock/API 策略并输出结构化 implementation contract。design initial pass 直接使用原计划,只有 request-revision 才运行 revision/final review;small-risk 只执行一次 design review。`frontend-prewrite-gate-shell` 合并生效 verdict、REQ/BR/AC 覆盖、Mock policy 和 contract 物化,是唯一写入授权。实现后 `frontend-verify-assess-shell` 合并 Mock/static/behavior/trace/assessment;只有 `eligible=true` 才运行同 writeSet 的 repair 和 `frontend-reverify-shell`。`frontend-review-context-shell` 绑定真实 diff 与有效验证证据后再 review/closeout。standard/high-risk 为 15 个顶层节点,small-risk 为 13;绿色路径执行 11 个节点、7 次 Pi。生成期 blocked Mock 只生成一个确定性阻塞节点且没有 writer。
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
> Backend-test Markdown-first:先由确定性环境 Shell 检查 clean env 中 Python/pytest、常见配置、conftest/fixture、test root、server entry 和 HTML renderer,失败时不消耗模型调用。随后 Pi
|
|
22
|
+
> Backend-test Markdown-first:先由确定性环境 Shell 检查 clean env 中 Python/pytest、常见配置、conftest/fixture、test root、server entry 和 HTML renderer,失败时不消耗模型调用。随后 Pi 生成中文 README 索引与模块用例卡片并独立 Review `testcase/md/**`,Shell 校验 Case ID、AC/source traceability、中文或历史英文分节、步骤、可断言预期与 secret 安全;pytest writer 仅转换最终 Markdown,不重读 `source/**`。traceability 同时支持模块级函数和 pytest 测试类方法;pytest 只运行一次,生成 JUnit,并把 Markdown 名称/场景/脚本映射与同一 JUnit 合成为逐条中文 self-contained HTML 主报告和 Markdown facts。最终 Pi 只解释事实并生成 Markdown 报告和 L-5 结论。active 流程不要求模型生成 backend-test 业务 JSON。
|
|
23
23
|
|
|
24
24
|
显式专用 `taskKind` 保持兼容并优先于任务源分类。`backend-test` 选择固定 **8 个真实顶层节点**的 Markdown-first DAG:环境硬门、Markdown cases、独立 Review/修订、Markdown gate、pytest 转换、确定性 traceability、单次 pytest + JUnit/HTML/facts、最终 Markdown 报告与 L-5。历史 JSON contract/materializer 可继续读取旧 DAG,但新 runtime/template 不再生成模型业务 JSON。`knowledge-sync` 与 `knowledge-graph-bootstrap` 继续通过各自显式 taskKind 选择知识回写/图谱开荒 DAG。治理等级仍由 `minimal|standard|reviewed|supervised` 推断。
|
|
25
25
|
|