@tea-agent/loop-agent 0.14.0 → 0.16.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 (117) hide show
  1. package/AGENTS.md +1 -1
  2. package/CHANGELOG.md +98 -11
  3. package/README.md +24 -5
  4. package/dist/application/evaluation/alias.js +184 -0
  5. package/dist/application/evaluation/budget.js +192 -0
  6. package/dist/application/evaluation/campaign-hash.js +47 -0
  7. package/dist/application/evaluation/campaign-matrix.js +372 -0
  8. package/dist/application/evaluation/campaign-scorecard.js +135 -0
  9. package/dist/application/evaluation/campaign.js +370 -0
  10. package/dist/application/evaluation/candidate.js +23 -6
  11. package/dist/application/evaluation/corpus-hash.js +38 -0
  12. package/dist/application/evaluation/corpus.js +56 -0
  13. package/dist/application/evaluation/experiment.js +294 -0
  14. package/dist/application/evaluation/ignition.js +198 -0
  15. package/dist/application/evaluation/integrity-audit.js +162 -0
  16. package/dist/application/evaluation/outer-loop.js +132 -0
  17. package/dist/application/evaluation/pi-cell-executor.js +39 -0
  18. package/dist/application/evaluation/private-verifier.js +46 -0
  19. package/dist/application/evaluation/promotion-policy.js +151 -0
  20. package/dist/application/evaluation/proposer.js +98 -0
  21. package/dist/application/evaluation/types.js +522 -0
  22. package/dist/cli/command-definitions.js +19 -3
  23. package/dist/commands/eval.js +1176 -13
  24. package/dist/commands/init.js +4 -1
  25. package/dist/infrastructure/evaluation/alias-store.js +199 -0
  26. package/dist/infrastructure/evaluation/campaign-store.js +154 -0
  27. package/dist/infrastructure/evaluation/corpus-store.js +181 -0
  28. package/dist/infrastructure/evaluation/experiment-store.js +124 -0
  29. package/dist/infrastructure/evaluation/ignition-store.js +82 -0
  30. package/dist/infrastructure/evaluation/private-verifier-store.js +145 -0
  31. package/dist/infrastructure/evaluation/proposer-store.js +78 -0
  32. package/dist/worker/cli.js +6 -3
  33. package/dist/worker/delivery/final-verification.js +96 -8
  34. package/dist/worker/delivery/package.js +23 -4
  35. package/dist/worker/delivery/verification-bundle.js +521 -0
  36. package/dist/worker/feature/fullstack-validate.js +337 -0
  37. package/dist/worker/feature/profile-schema.js +44 -0
  38. package/dist/worker/feature/ready-plan-projection.js +1 -0
  39. package/dist/worker/feature/reducer.js +2 -0
  40. package/dist/worker/feature/review.js +106 -11
  41. package/dist/worker/materialize/harness-task-materializer.js +5 -0
  42. package/dist/worker/observability/read-model.js +7 -0
  43. package/dist/worker/observe/static/views/task.js +1 -0
  44. package/dist/worker/outcomes/adapters.js +144 -0
  45. package/dist/worker/outcomes/evidence-tokens.js +29 -0
  46. package/dist/worker/outcomes/gate.js +40 -0
  47. package/dist/worker/outcomes/projector.js +185 -0
  48. package/dist/worker/outcomes/registry.js +1 -0
  49. package/dist/worker/outcomes/store.js +131 -0
  50. package/dist/worker/outcomes/types.js +79 -0
  51. package/dist/worker/report/morning-report.js +4 -3
  52. package/dist/worker/run-task/run-task.js +85 -2
  53. package/dist/worker/runner/run-ready.js +32 -1
  54. package/dist/worker/task-graph/acceptance-schema.js +12 -0
  55. package/dist/worker/task-graph/ready-planner.js +131 -0
  56. package/dist/worker/task-graph/task-graph-schema.js +31 -0
  57. package/dist/worker/task-graph/validate.js +44 -4
  58. package/dist/worker/task-spec/schema.js +9 -0
  59. package/dist/worker/task-spec/validate.js +39 -0
  60. package/dist/worker/task-spec/workflow-routing.js +149 -0
  61. package/dist/workflows/dag/budget-enforcement.js +67 -0
  62. package/dist/workflows/dag/context-policy.js +137 -0
  63. package/dist/workflows/dag/init-hybrid.js +27 -11
  64. package/dist/workflows/dag/knowledge-curator.js +3 -0
  65. package/dist/workflows/dag/node-execution.js +11 -4
  66. package/dist/workflows/dag/prompt.js +1 -1
  67. package/dist/workflows/dag/runner.js +43 -16
  68. package/dist/workflows/dag/skill-snapshot.js +11 -7
  69. package/dist/workflows/dag/types.js +18 -0
  70. package/docs/README.md +1 -0
  71. package/docs/init-surface.manifest.json +7 -7
  72. package/docs/templates/branch-merge-report.md +0 -1
  73. package/docs/templates/evaluation/campaign-budget-v1.json +12 -0
  74. package/docs/templates/evaluation/campaign-dogfood-v0.json +24 -0
  75. package/docs/templates/evaluation/campaign-evidence-v1.json +44 -0
  76. package/docs/templates/evaluation/context-policy-baseline-v1.json +17 -0
  77. package/docs/templates/evaluation/context-policy-role-specialized-v1.json +28 -0
  78. package/docs/templates/evaluation/corpus-dogfood-v0.manifest.json +118 -0
  79. package/docs/templates/evaluation/matrix-dag-dry-run-v1.json +21 -0
  80. package/docs/templates/evaluation/matrix-fixture-v1.json +10 -0
  81. package/docs/templates/evaluation/private-verifier-dogfood-v0.json +16 -0
  82. package/docs/templates/product-line/AGENTS.md +1 -0
  83. package/docs/templates/product-line/README.md +17 -0
  84. package/docs/templates/product-line/acceptance.yaml +9 -0
  85. package/docs/templates/product-line/feature.yaml +11 -0
  86. package/docs/templates/product-line/task-graph.yaml +8 -0
  87. package/docs/templates/product-line/task.yaml +4 -0
  88. package/package.json +6 -16
  89. package/skills/browser-tools/SKILL.md +2 -2
  90. package/skills/frontend-design-review/references/review-checklist.md +27 -45
  91. package/skills/frontend-implementation/references/node-contracts.md +4 -4
  92. package/skills/frontend-review/SKILL.md +3 -1
  93. package/skills/frontend-review/references/review-findings.md +2 -1
  94. package/skills/frontend-verification/SKILL.md +3 -1
  95. package/skills/frontend-verification/references/verification-checklist.md +13 -22
  96. package/skills/loop-agent/references/hybrid-dag.md +1 -1
  97. package/docs/agent-dag-recovery-playbook.md +0 -195
  98. package/docs/agent-dag-runner.md +0 -67
  99. package/docs/cursor-prompt-sidecar.md +0 -36
  100. package/docs/decisions/README.md +0 -18
  101. package/docs/design/README.md +0 -167
  102. package/docs/development-principles.md +0 -73
  103. package/docs/exec-plans/README.md +0 -6
  104. package/docs/exec-plans/active/README.md +0 -13
  105. package/docs/exec-plans/completed/README.md +0 -108
  106. package/docs/feature-workflow.md +0 -414
  107. package/docs/loop-agent-harness.md +0 -142
  108. package/docs/production-readiness.md +0 -96
  109. package/docs/progress/README.md +0 -81
  110. package/docs/reports/README.md +0 -163
  111. package/docs/verification-matrix.md +0 -70
  112. package/scripts/check-product-line-docs.sh +0 -29
  113. package/scripts/check-task-pool-root.sh +0 -32
  114. package/scripts/kb-graph-incremental-prepare.sh +0 -5
  115. package/scripts/kb-graph-materialize.sh +0 -4
  116. package/scripts/kb-graph-promote.sh +0 -4
  117. package/scripts/kb-query.sh +0 -5
@@ -5,11 +5,19 @@ nodes:
5
5
  task: BE-001.yaml
6
6
  type: backend-feature
7
7
  depends_on: []
8
+ # Optional artifact-aware edges (Ready Planner envelope-level gate):
9
+ # produces:
10
+ # - kind: backend-impl
11
+ # schemaId: backend-impl-v1
8
12
  - id: QA-001
9
13
  task: QA-001.yaml
10
14
  type: qa-execute
11
15
  depends_on:
12
16
  - BE-001
17
+ # consumes:
18
+ # - kind: backend-impl
19
+ # schemaId: backend-impl-v1
20
+ # producerTaskId: BE-001
13
21
  parallel_policy:
14
22
  max_parallel_tasks: 2
15
23
  disallow_same_file_parallel_writes: true
@@ -30,6 +30,10 @@ constraints:
30
30
  - <protected/path/**>
31
31
  hard_constraints:
32
32
  - Do not access production secrets
33
+ # Explicit runtime workflow → taskKind. For fullstack-v1 packets this should be set
34
+ # on every TaskSpec. Allowed: agent-dag | frontend-implementation | backend-test | frontend-test
35
+ execution:
36
+ workflow: agent-dag
33
37
  verify:
34
38
  preset: standard
35
39
  mode: serial
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tea-agent/loop-agent",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "loop-agent": "bin/loop-agent.js",
@@ -10,7 +10,10 @@
10
10
  "AGENTS.md",
11
11
  "bin/",
12
12
  "dist/",
13
- "docs/*.md",
13
+ "docs/README.md",
14
+ "docs/harness-methodology-tdd.md",
15
+ "docs/harness-methodology-verification.md",
16
+ "docs/harness-methodology-debugging.md",
14
17
  "docs/architecture/runtime-boundaries.md",
15
18
  "docs/architecture/README.md",
16
19
  "docs/architecture/system-overview.md",
@@ -18,29 +21,16 @@
18
21
  "docs/architecture/worker-and-feature.md",
19
22
  "docs/architecture/facts-and-state.md",
20
23
  "docs/architecture/evolution.md",
21
- "docs/decisions/README.md",
22
- "docs/design/README.md",
23
- "docs/exec-plans/README.md",
24
- "docs/exec-plans/active/README.md",
25
- "docs/exec-plans/completed/README.md",
26
24
  "docs/init-surface.manifest.json",
27
- "docs/progress/README.md",
28
- "docs/reports/README.md",
29
25
  "docs/skills/",
30
26
  "docs/templates/",
31
27
  "examples/",
32
28
  "harness.json",
33
29
  "skills/",
34
- "scripts/check-product-line-docs.sh",
35
- "scripts/check-task-pool-root.sh",
36
30
  "scripts/kb-bootstrap-init-skeleton.sh",
37
- "scripts/kb-query.sh",
38
31
  "scripts/kb-query.mjs",
39
- "scripts/kb-graph-materialize.sh",
40
32
  "scripts/kb-graph-materialize.mjs",
41
- "scripts/kb-graph-promote.sh",
42
33
  "scripts/kb-graph-promote.mjs",
43
- "scripts/kb-graph-incremental-prepare.sh",
44
34
  "scripts/kb-graph-incremental-prepare.mjs",
45
35
  "README.md",
46
36
  "CHANGELOG.md"
@@ -55,7 +45,7 @@
55
45
  "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
56
46
  "build": "npm run clean && tsc -p tsconfig.build.json && node -e \"const fs=require('node:fs');const p='dist/worker/observe/static';fs.mkdirSync(p,{recursive:true});fs.cpSync('src/worker/observe/static',p,{recursive:true});\"",
57
47
  "prepack": "npm run build",
58
- "prepublishOnly": "npm run typecheck && npm test && npm run build",
48
+ "prepublishOnly": "node scripts/check-npm-publish-policy.mjs && npm run typecheck && npm test && npm run build",
59
49
  "lint": "tsc --noEmit",
60
50
  "typecheck": "tsc --noEmit",
61
51
  "test": "node scripts/run-tests.mjs",
@@ -117,10 +117,10 @@ Wrap everything in an IIFE to run multi-statement code:
117
117
  // Multiple operations
118
118
  const data = document.querySelector('#target').textContent;
119
119
  const buttons = document.querySelectorAll('button');
120
-
120
+
121
121
  // Interactions
122
122
  buttons[0].click();
123
-
123
+
124
124
  // Return results
125
125
  return JSON.stringify({ data, buttonCount: buttons.length });
126
126
  })()
@@ -1,58 +1,40 @@
1
1
  # Frontend Design Review Checklist
2
2
 
3
- ## Requirement And State Coverage
3
+ ## Coverage
4
4
 
5
- - Target route/page/component and non-goals are clear.
6
- - Every acceptance criterion maps to steps, files, UI behavior, and verification.
7
- - Assumptions and unresolved ambiguity are explicit.
8
- - Applicable success, error, loading, empty, disabled, permission, retry, stale-response, and boundary states are handled or marked N/A.
5
+ - Route/component, non-goals, assumptions, and unresolved ambiguity are explicit.
6
+ - Each acceptance criterion maps to steps, files, UI behavior, states, and verification.
7
+ - Success/error/loading/empty/disabled/permission/retry/stale/boundary states are handled or N/A.
9
8
 
10
- ## Project And Knowledge Fit
9
+ ## Project Fit
11
10
 
12
- - Existing components, hooks, API helpers, mocks, schemas, router patterns, templates, tokens, and theme rules were considered.
13
- - Component/design choices cite knowledge-base or `openSpec/`; failed/empty knowledge-base queries recurse through `<repoRoot>/openSpec/**` first.
14
- - Evidence records source status, query terms, paths/headings, and conflicts.
15
- - Dependencies are authorized; paths fit allowed/write scope and avoid forbidden/generated files.
16
- - A required Mock-backed strategy reuses native support when proven, otherwise an
17
- existing browser-intercept/request-adapter seam; it maps endpoint/states to fixtures,
18
- stays in writer scope, and is off in production. `not-needed` adds none.
11
+ - Reuse components, hooks, API helpers, mocks, schemas, router patterns, tokens, and theme rules.
12
+ - Cite knowledge-base or `openSpec/`; failed/empty knowledge queries must search `<repoRoot>/openSpec/**`.
13
+ - Record source status, query terms, paths/headings, conflicts, authorized deps, and allowed paths.
19
14
 
20
- ## Interaction And Quality
15
+ ## Interaction / Quality
21
16
 
22
- - Actions, feedback, validation timing, navigation, persistence, and recovery are unambiguous.
23
- - Responsive and overflow behavior covers target environments.
24
- - Keyboard, focus, semantics, contrast, reduced motion, data lifecycle, cancellation, and error recovery are addressed when applicable.
17
+ - Actions, feedback, validation timing, navigation, persistence, recovery, responsive/overflow, focus/keyboard/semantics/contrast/reduced motion, cancellation, and data lifecycle are covered when applicable.
25
18
 
26
19
  ## Verification
27
20
 
28
- - Static and behavior commands are exact, discoverable, and deterministic.
29
- - Tests prove changed state logic and flows at repository-supported levels.
30
- - Browser/visual checks are required only by task intent or existing gates.
31
- - Every missing verification path is a blocker or disclosed risk.
32
- - Verification entrypoints are frozen; any Mock-specific command is generated only
33
- from trusted sources, and behavior separately proves page consumption.
34
-
35
- ## Mock Strategy Safety
36
-
37
- - The strategy protocol is valid and not `MOCK_STRATEGY: blocked`.
38
- - For Mock strategies, API fields and fixture states trace to contract evidence; gaps are explicit.
39
- - Selection follows repository capability: native mock first, browser interception
40
- for existing e2e, request adapter/injection for local preview.
41
- - The real request remains enabled by default; activation is explicit, reversible,
42
- local/test-only, and excluded from production behavior.
43
- - Verification uses only shell entrypoints fixed when the DAG was generated; the
44
- plan does not invent commands that shell nodes cannot execute.
45
- - Mock strategies include a production/default-real-path build with Mock off and
46
- Mock-backed behavior evidence. `not-needed` instead needs applicable real or
47
- no-remote behavior evidence.
48
- - Mock-backed checks prove frontend states only. Real integration remains pending
49
- until the actual backend path has fresh evidence.
21
+ - Static/behavior commands are exact, frozen, discoverable, and deterministic.
22
+ - Tests prove changed state and flows at supported levels; browser/visual only when task/gate requires.
23
+ - Missing required verification is a blocker; optional gaps are disclosed risks.
24
+
25
+ ## Mock Safety
26
+
27
+ - Strategy line is valid and not `MOCK_STRATEGY: blocked`.
28
+ - Mock API fields/states trace to contract evidence; gaps are explicit.
29
+ - Prefer native mock; browser intercept only for existing e2e; request adapter only for reversible local preview.
30
+ - Real request stays default; activation is explicit, reversible, local/test-only, and production-off.
31
+ - Plans use only DAG-frozen shell entrypoints.
32
+ - Mock strategies need default-real-path build with Mock off plus Mock-backed behavior evidence.
33
+ - `not-needed` needs real/no-remote evidence, or default-auto skipped-Mock rationale with Real Integration Gap preserved when no project Mock capability exists.
34
+ - Mock-backed checks prove frontend states only; real integration remains pending until actual backend evidence exists.
50
35
 
51
36
  ## Verdict Matrix
52
37
 
53
- - Coverage gap, unsafe scope, unauthorized dependency, unresolved required interaction, or missing required verification: request revision.
54
- - Missing knowledge-base evidence and skipped `openSpec/` fallback: request revision.
55
- - No relevant knowledge-base or `openSpec/` rule for a required decision: request revision.
56
- - Unsafe/missing mock strategy or mock evidence presented as real integration: request revision.
57
- - Knowledge-base unavailable but relevant `openSpec/` rules were applied: advisory connection gap, not a specification gap.
58
- - Optional cleanup that cannot affect acceptance: advisory.
38
+ - Request revision for coverage gaps, unsafe scope, unauthorized deps, unresolved required interaction, missing required verification, skipped `openSpec/` fallback, unsafe/missing Mock strategy, or Mock evidence presented as real integration.
39
+ - Knowledge-base unavailable but relevant `openSpec/` rules applied is advisory only.
40
+ - Optional cleanup that cannot affect acceptance is advisory.
@@ -6,11 +6,11 @@ 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-mock-assess-pi` + gate**: first non-empty line
10
- `MOCK_STRATEGY: native|browser-intercept|request-adapter|not-needed|blocked`
11
- Prefer native Mock; browser intercept only with existing e2e; request-adapter only for reversible local preview. `not-needed` needs 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.
9
+ - **`frontend-mock-assess-pi` + gate**: first non-empty line
10
+ `MOCK_STRATEGY: native|browser-intercept|request-adapter|not-needed|blocked`
11
+ 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
12
  - **`frontend-plan-pi` + design loop**: AC → steps, in-bound files, UI states, reuse, deps, activation/rollback, frozen verify entrypoints, real-integration gap. First gate: `VERDICT: pass|request-revision`. Pass may emit `PASS_NO_REVISION_NEEDED`; else full corrected plan without invented evidence. Final review rechecks plan/findings/revision/assessment/Mock safety. Only final `VERDICT: pass` authorizes writes; failure → replan/rerun (not dev-fix).
13
- - **`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.
13
+ - **`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
14
 
15
15
  ## Contract / trace / stages (M1–M2)
16
16
 
@@ -30,7 +30,9 @@ required check, forbidden write, or unmet acceptance criterion forces revision.
30
30
  - Inspect static, behavior, and available Mock-specific artifacts directly. For Mock
31
31
  strategies, compare the endpoint matrix, handler/fixture/adapter and consumer diff;
32
32
  require the real request as default, contract-aligned fixtures, production isolation,
33
- and no false real-integration claim. `not-needed` needs applicable real/no-remote evidence.
33
+ and no false real-integration claim. `not-needed` needs applicable real/no-remote
34
+ evidence, or an explicit default-auto skipped-Mock rationale with the Real
35
+ Integration Gap preserved when no project Mock capability is confirmed.
34
36
  - Component/design claims require traceable knowledge-base evidence or, after connection/query failure or no match, relevant `<repoRoot>/openSpec/**` evidence. The connector format is TODO; never claim a query or fallback search without evidence. Execute explicit `grep`/`find` to locate spec files and `read` to load them before referencing their rules. Only successful `read` tool calls are observable as "已读取规范文件" in the spec-evidence inspector.
35
37
  - Treat shell exit status as authoritative. Do not edit files.
36
38
 
@@ -43,5 +43,6 @@ Avoid vague advice. When no source location exists, cite the command or artifact
43
43
  - Changed files are authorized.
44
44
  - Criteria and applicable states have implementation and evidence.
45
45
  - Required Mock-backed behavior passed; any generated Mock-specific verification also
46
- passed; Mock is not enabled by default in production.
46
+ passed; Mock is not enabled by default in production. For default-auto skipped
47
+ Mock, the real request remains default and the Real Integration Gap is preserved.
47
48
  - Optional unavailable knowledge-base, browser, visual, or manual checks remain explicit risks.
@@ -45,7 +45,9 @@ Return Markdown headings:
45
45
  - `Follow-up`: concrete work or `None`.
46
46
 
47
47
  When the backend remains unavailable but required mock-backed checks pass, state
48
- `Frontend status: mock-validated` and `Real integration: pending`. Use a completed
48
+ `Frontend status: mock-validated` and `Real integration: pending`. When default
49
+ `auto` skipped Mock and no real API evidence passed, state
50
+ `Frontend status: locally-validated` and `Real integration: pending`. Use a completed
49
51
  `<task-id>-real-api-integration-verify` task before changing the latter to complete;
50
52
  the follow-up is explicit, not auto-created or auto-executed.
51
53
 
@@ -2,26 +2,19 @@
2
2
 
3
3
  ## Static And Behavior Evidence
4
4
 
5
- - Type/compile, lint/format, build, and schema/client checks ran when required.
6
- - Generated output was authorized.
7
- - Tests cover changed logic/flows and regressions.
8
- - Browser/e2e/manual evidence exists when explicitly required.
9
- - Selected-strategy behavior and applicable loading, empty, error, success, disabled,
10
- permission, retry, and boundary states have evidence from fixed DAG entrypoints.
11
- - When generated, Mock-specific verification checks service/handler/schema/fixtures;
12
- behavior evidence separately proves page consumption.
13
- - For Mock strategies, activation is explicit/non-production and a production/default-
14
- real-path build with Mock off confirms the real request remains default.
15
- - `not-needed` has positive readiness/no-remote evidence plus applicable real or
16
- no-remote behavior evidence. Mock-backed evidence remains frontend-only and never
17
- satisfies real API integration.
5
+ - Required type/compile, lint/format, build, schema/client, browser/e2e/manual checks ran.
6
+ - Generated output was authorized; tests cover changed logic, flows, and regressions.
7
+ - Fixed DAG entrypoints prove selected-strategy behavior and applicable loading/empty/error/success/disabled/permission/retry/boundary states.
8
+ - Mock-specific checks cover service/handler/schema/fixtures; behavior evidence separately proves page consumption.
9
+ - Mock activation is explicit/non-production; a default-real-path build with Mock off proves the real request remains default.
10
+ - `not-needed` has real/no-remote evidence, or default-auto skipped-Mock rationale with Real Integration Gap preserved when no project Mock capability exists.
11
+ - Mock-backed evidence is frontend-only and never satisfies real API integration.
18
12
 
19
13
  ## Design And Component Evidence
20
14
 
21
15
  - Claims cite knowledge-base retrieval or `<repoRoot>/openSpec/**` fallback.
22
- - Evidence records query/source/version/time or fallback search terms, paths, headings, and applied rules.
23
- - Relevant `openSpec/` matches become the current-project specification and satisfy source availability; only the knowledge-base connection remains unavailable.
24
- - Missing both sources blocks explicit compliance or an unresolved required design decision.
16
+ - Evidence records query/source/time or fallback search terms, paths, headings, and applied rules.
17
+ - Relevant `openSpec/` matches satisfy source availability; missing both sources blocks explicit compliance or required design decisions.
25
18
 
26
19
  ## Status
27
20
 
@@ -35,12 +28,11 @@ Only passed satisfies a required check. Other optional statuses remain disclosed
35
28
 
36
29
  ## Closeout Checks
37
30
 
38
- - List exact commands, source, exit status, and archived output/artifact when available.
39
- - Map every criterion to evidence or a named gap.
31
+ - List exact commands/source/exit status/artifacts; map every criterion to evidence or a named gap.
40
32
  - Record review verdict before completion.
41
33
  - Do not conflate static, behavior, browser/visual/manual, or knowledge-base proof.
42
- - If only mock evidence exists, report `Frontend status: mock-validated` and
43
- `Real integration: pending`, with the actual API verification as follow-up.
34
+ - If only Mock evidence exists, report `Frontend status: mock-validated` and `Real integration: pending`, with actual API verification follow-up.
35
+ - If default `auto` skipped Mock and no real API evidence exists, report `Frontend status: locally-validated` and `Real integration: pending`.
44
36
 
45
37
  ```markdown
46
38
  ## Changes
@@ -64,5 +56,4 @@ Only passed satisfies a required check. Other optional statuses remain disclosed
64
56
  - None.
65
57
  ```
66
58
 
67
- If review is not pass or a required check is not passed, describe the task as
68
- incomplete and list concrete follow-up.
59
+ If review is not pass or a required check is not passed, describe the task as incomplete and list concrete follow-up.
@@ -16,7 +16,7 @@
16
16
 
17
17
  对于默认 `standard` 任务,生成器根据标题、`source/需求.md` 和结构化 `allowedPaths` 做保守、确定性的需求分类。只有高置信的前端实现需求自动选择 `frontend-implementation` DAG;后端、前后端混合、明确排除前端或证据不足的需求继续使用 governance profile 选出的模板。分类不会把普通后端实现路由到 `backend-test`,也不会替换由显式 profile、`workflowPolicy` 或 supervised quality gate 选中的 supervised 模板。
18
18
 
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;真实请求保持默认,缺少契约、生产隔离或可执行验证时 gate 阻塞。可选 `frontendMock` 配置声明 `auto|required|disabled`、既有服务目录与专项命令;不安全或不完整的显式 required 合同只生成无 writer 的评估链,有可信命令时才增加 `frontend-mock-verify-shell`。Mock-backed 证据只证明前端状态;`not-needed` 需要真实或无远程接口行为证据。未调用后端时 closeout 报告 `Frontend status: mock-validated` 与 `Real integration: pending`。
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
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` 规则推断。
22
22
 
@@ -1,195 +0,0 @@
1
- # Agent DAG Recovery Playbook(恢复手册)
2
-
3
- > **关联**:[`agent-dag-runner.md`](agent-dag-runner.md)(CLI 与 run 语义)· [`templates/agent-dag-decision-gate.prompt.md`](templates/agent-dag-decision-gate.prompt.md)(Decision Gate 消费 recovery 证据)
4
-
5
- ## 定位
6
-
7
- Agent DAG **recovery planning 是只读、派生、advisory** 的。`dag report` 与 `buildDagDecisionGateEvidence()` 从 `.harness/dag-runs/` 的 canonical facts 聚合 `normalizedFailureCategory` → `recoveryRecommendation`,供人工或 Decision Gate prompt 消费。
8
-
9
- 中断后不要从上游摘要手工生成 impl-only DAG。先修复 `.harness/tasks/<task-id>/source/` 或计划,再对同一 task 重新执行 `dag run-task`、严格 `dag validate` 和新的 `run-dag`。新生成的完整 DAG 会重新冻结 `sourceBinding` 并经过 contract/scout/plan/gate;v3 孤立 writer 如果既无来源绑定、也无只读 planner 上游,会被 strict governance 拒绝。完整规则见 [`design/dag-source-binding-and-recovery.md`](design/dag-source-binding-and-recovery.md)。
10
-
11
- Production Readiness v0.1 在 normalized DAG category 之上增加 product-line routing。Report 与 doctor 输出应保留 raw DAG fact 并派生,不重写已完成 facts:
12
-
13
- ```text
14
- raw_failure_category
15
- dag_normalized_failure_category
16
- product_line_failure_category
17
- recommended_follow_up
18
- ```
19
-
20
- Product-line taxonomy 定义见 `ai_workspace/loop-agent/design/state-and-failure-taxonomy.md`。
21
-
22
- ### 前端设计门禁专用恢复路径
23
-
24
- 前端 DAG 的 design gate shell 失败(`frontend-first-design-gate-shell`、`frontend-final-design-gate-shell`、`frontend-design-gate-shell`)**不路由为 `ProductBug` / `dev-fix`**。此类失败固定路由为:
25
-
26
- - `productLineFailureCategory`: `ContractMismatch`
27
- - `recommendedFollowUp`: `frontend-plan-revision-and-rerun`
28
-
29
- 恢复动作由 `planDagRecovery` 根据实际的 `normalizedFailureCategory` 和 run status 决定(通常为 `rerun-after-fix` 或 `manual-review`),但 product-line 维度的分类确保 Task Pool 和 morning report 不会将其混入普通 bug backlog。
30
-
31
- **非目标(本 playbook 不覆盖、runner 不实现):**
32
-
33
- - 自动 retry / resume 节点执行
34
- - 修改 `completed/` 或 `paused/` 下的历史 run facts
35
- - 把 `autoRetryEligible` 当作 runtime 触发器
36
- - 仅凭 recovery 派生字段自动 approve Decision Gate
37
-
38
- ## 快速命令
39
-
40
- ```bash
41
- cd .
42
-
43
- # 全局 runtime 健康(active/paused/completed 摘要 + healthIssues;advisoryOnly)
44
- npm run dev -- dag doctor
45
-
46
- # 单 run 生命周期(approvalFlow、hasHumanApproval、nextRecommendedAction)
47
- npm run dev -- dag status --run-id <run-id>
48
-
49
- # 聚焦最新 paused run(--paused-latest ≡ --lifecycle paused --latest)
50
- npm run dev -- dag report --paused-latest [--json|--markdown]
51
-
52
- # 默认 compact Markdown 表格
53
- npm run dev -- dag report --run-id <run-id>
54
-
55
- # 机器可读 JSON(含 primaryFailure / primaryRecovery / downstreamSkippedNodes)
56
- npm run dev -- dag report --run-id <run-id> --json
57
-
58
- # 人类交接 Recovery Plan(四段结构化 Markdown)
59
- npm run dev -- dag report --run-id <run-id> --markdown
60
-
61
- # 过滤器
62
- npm run dev -- dag report --failed-only # 仅失败/需恢复
63
- npm run dev -- dag report --latest --failed-only # 最新一条需恢复 run
64
- npm run dev -- dag report --action retry-node # 按 primaryRecovery.action 筛选
65
- npm run dev -- dag report --lifecycle paused --action resume-or-reject
66
-
67
- # Decision Gate envelope dry-run(不 resume/retry;validate 无效时 exit 1)
68
- npm run dev -- dag decision inspect --run-id <run-id> [--node-id <node-id>]
69
- npm run dev -- dag decision validate --run-id <run-id> [--node-id <node-id>]
70
- ```
71
-
72
- ### Paused run operator 路径
73
-
74
- 1. `dag report --paused-latest --json` 或 `dag doctor` — 定位最新 paused run 与 `primaryRecovery`
75
- 2. `dag status --run-id <id>` — 读 `approvalFlow`、`escalationArtifactPath`、`pendingNodes`
76
- 3. (可选)`dag decision validate --run-id <id>` — envelope preflight
77
- 4. `dag approve --run-id <id> --option <option-id>` → `dag resume --run-id <id>`;或 `dag reject --run-id <id> --reason "..."`
78
-
79
- 精确 approval 顺序见 [`agent-dag-runner.md`](agent-dag-runner.md) §Paused lifecycle。
80
-
81
- Decision Gate prompt 侧:`buildDagDecisionGateEvidence()`(`./src/core/dag-decision-evidence.ts`)从 `DagRunReportEntry` 生成 prompt-friendly 摘要,字段与 JSON report 对齐,**不**写回 run state。
82
-
83
- ## `dag report --json` schema 锁定
84
-
85
- - **Schema 文件**:`ai_workspace/loop-agent/templates/agent-dag-report.schema.json`
86
- - **Envelope**:`{ schemaVersion: 1, runs: DagRunReportEntry[] }`
87
- - **稳定消费字段**(Decision Gate / tooling 应依赖):`primaryFailure`、`primaryRecovery`、`downstreamSkippedNodes`、`recoveryRecommendation`、`normalizedFailureCategory`;node 级 `decisionEnvelope`、`artifacts`;paused 级 `pausedByNodeId`、`pauseReason`
88
- - **测试**:`./test/dag-report.test.ts` §`dag report JSON schema contract` 对 fixture run 做 schema 校验
89
- - **变更策略**:breaking 字段变更须 bump `schemaVersion` 并同步 schema 文件与测试
90
-
91
- ## Recovery Action 枚举
92
-
93
- | Action | 含义 | 典型触发 |
94
- |--------|------|----------|
95
- | `none` | 无需恢复 | 成功完成 |
96
- | `monitor` | 进行中,等待结束 | `PENDING` / `RUNNING` |
97
- | `retry-node` | 修复瞬态条件后可重跑节点 | timeout;executor 瞬态(network/quota/rate-limit/unavailable) |
98
- | `rerun-after-fix` | 先修根因再重跑 | auth、validation、shell-command、static-error、非瞬态 executor |
99
- | `resume-or-reject` | 人工审批后继续或拒绝 | paused + decision-envelope / human-required |
100
- | `manual-review` | 人工审查后再定路径 | write-guard、human-rejected、unknown、非 paused 的 decision-envelope |
101
- | `inspect-upstream` | 先查上游失败 | SKIPPED 下游节点 |
102
- | `unknown` | 未映射类别(不应出现在正常派生路径) | 内部兜底 |
103
-
104
- ## Product-Line Routing v0.1
105
-
106
- | Product-line category | Default follow-up |
107
- |---|---|
108
- | `SpecUnclear` | `spec-clarification` |
109
- | `ContractMismatch` | `architecture-contract-fix` |
110
- | `ProductBug` | `dev-fix` |
111
- | `TestBug` | `qa-fix-test` |
112
- | `EnvFailure` | `env-fix` 或 retry verify |
113
- | `FlakyTest` | `flaky-test-analysis` |
114
- | `RiskyChange` | `human-review` / `architecture-review` |
115
- | `DependencyFailure` | unblock dependency |
116
- | `NeedsHuman` | `human-review` |
117
- | `Unknown` | human triage |
118
-
119
- ## 类别 → 动作 → operator 指引
120
-
121
- | Normalized category | Recovery action | Operator guidance | Anti-patterns |
122
- |---------------------|-----------------|-------------------|---------------|
123
- | `success` | `none` | 归档验收;按需 review artifacts | 对成功 run 发起 retry |
124
- | `timeout` | `retry-node` | 查日志/artifacts 确认瞬态;人工重跑节点 | 未查根因就循环重试;指望 runner 自动 retry |
125
- | `executor`(network/quota/rate-limit/unavailable) | `retry-node` | 等后端/配额恢复后重跑 | 把 auth/validation 误判为瞬态 executor |
126
- | `executor`(其他 raw) | `rerun-after-fix` | 查 executor.jsonl、node result | 盲目 retry 非瞬态 backend 错误 |
127
- | `auth` | `rerun-after-fix` | 更新 API key/凭证后重跑 | 在凭证未修复时 retry |
128
- | `write-guard` | `manual-review` | 审 writeSet/writePolicy、prompt、result.summary | read-only 节点写根 `artifacts/`;扩大 writeSet 掩盖违规 |
129
- | `validation` | `rerun-after-fix` | 修 schema/output/test 后再跑 | 跳过验证直接 approve |
130
- | `shell-command` | `rerun-after-fix` | 读 stdout/stderr、修命令或 repo 状态 | 只重跑 shell 不改命令 |
131
- | `static-error` | `rerun-after-fix` | 查 static config 与 emitted markdown | 当 LLM 节点 retry |
132
- | `decision-envelope`(paused) | `resume-or-reject` | `dag approve --run-id <id> --option <option-id>` / `dag reject --run-id <id> --reason "..."` → `dag resume --run-id <id>` | 未读 envelope 就 approve;用 recovery 字段单独 auto-approve |
133
- | `decision-envelope`(非 paused) | `manual-review` | 读 decision.envelope.json / validation artifact | 绕过 Decision Gate schema |
134
- | `human-required`(paused) | `resume-or-reject` | 提供人工输入 → approve/resume | 在 escalation 未解决时 resume |
135
- | `human-required`(非 paused) | `manual-review` | 读 human-escalation artifacts | 忽略 `requiresHuman` |
136
- | `human-rejected` | `manual-review` | 修订 contract/source;**新 run** | 对同一 contract 自动 retry |
137
- | `skipped` | `inspect-upstream` | 修上游 ERROR/SKIPPED 再考虑下游 | 直接 retry SKIPPED 节点 |
138
- | `unknown` | `manual-review` | 读 state.json、executor.jsonl、node artifacts | 假设 `autoRetryEligible` 会触发执行 |
139
-
140
- ## Handoff Recovery Plan 结构
141
-
142
- `dag report --markdown` 的 **Recovery Plan** 含四段(与 JSON 稳定字段一一对应):
143
-
144
- 1. **Primary Failure** — `primaryFailure`(node 或 run scope)
145
- 2. **Recovery Action** — `primaryRecovery`(action、summary、reason、flags、commandHint)
146
- 3. **Blocked Downstream / Skipped Nodes** — `downstreamSkippedNodes`
147
- 4. **Recommended Operator Action** — 面向 operator 的步骤摘要
148
-
149
- 保存 handoff 时重定向到平台临时目录或 `ai_workspace/loop-agent/reports/`,不要写入 `.harness/dag-runs/`。
150
-
151
- ## Decision Gate 消费约定
152
-
153
- 1. 优先 `dag report --json` 或 `buildDagDecisionGateEvidence()` 的 **verified** 派生摘要。
154
- 2. 映射到 `decision` / `nextAction` 须保守;recovery 证据是 **advisory only, not an execution directive**。
155
- 3. `autoRetryEligible: true` 仅表示「规划上可人工重试」,**不**触发 runner。
156
- 4. paused run 的人类路径仍是 M5 CLI:`dag approve --run-id <id> --option <option-id>` / `dag reject --run-id <id> --reason "..."` / `dag resume --run-id <id>`(见 [`agent-dag-runner.md`](agent-dag-runner.md) §Decision Gate)。
157
- 5. Envelope 干跑:`dag decision inspect|validate` 重解析 run facts;`validate` 无效时 exit 1;**不**写 artifact、**不** resume。
158
-
159
- ## Active stale run recovery(advisory detection)
160
-
161
- `dag doctor` 与 `dag status` 通过 `detectDagRunHealthIssues()` 检测 lifecycle 不一致,**不** mutate run facts。
162
-
163
- | Code | 典型场景 | operator 指引 |
164
- |------|----------|------------|
165
- | `terminal-in-active` | run 已完成但 `active/<run-id>/` 残留 | 对照 `completed/` canonical facts;手动 archive 或删除 stale 目录 |
166
- | `paused-in-active` | pause 后目录未迁至 `paused/` | `dag doctor` 诊断;修复 facts 后再 approve/resume |
167
- | `lifecycle-status-mismatch` | `paused/` 下 status 非 paused | 同上 |
168
- | `missing-approval-artifact` | approve 后 artifact 缺失 | 勿 resume;re-approve 或 restore artifact |
169
- | `non-terminal-in-completed` | completed 目录 status 异常 | manual-review only |
170
- | `run-id-mismatch` / `missing-state-json` | 目录损坏或命名错误 | Inspect;勿 auto-mutate completed facts |
171
-
172
- **Deferred runtime**:无 `dag recover apply` 或自动 cleanup;未来可能增加只读 `dag recover plan`(设计占位,未实现)。
173
-
174
- ## 事实源与边界
175
-
176
- | 类型 | 位置 | 规则 |
177
- |------|------|------|
178
- | Canonical run facts | `.harness/dag-runs/{active\|paused\|completed}/<run-id>/` | **只读**;report 不写回 |
179
- | 派生 report | stdout / 重定向文件 | 可随时再生 |
180
- | 工作块摘要 | 根 `artifacts/` | 非 per-run 历史;read-only DAG 节点不得写 |
181
-
182
- ## 验证
183
-
184
- ```bash
185
- cd . && npx vitest run \
186
- test/dag-report.test.ts \
187
- test/dag-recovery-recommendation.test.ts \
188
- test/dag-decision-gate-recovery-dogfood.test.ts \
189
- test/dag-decision-evidence.test.ts \
190
- test/dag-decision-envelope.test.ts \
191
- test/dag-approve-resume.test.ts \
192
- test/cli-contract.test.ts
193
- ```
194
-
195
- 实现细节与映射逻辑:`./src/core/dag-recovery-recommendation.ts`、`dag-report.ts`、`dag-decision-evidence.ts`。
@@ -1,67 +0,0 @@
1
- # Agent DAG Runner
2
-
3
- Agent DAG 是 loop-agent 的声明式编排 runtime。DAG 将工作拆为节点、按序执行 eligible ranks、记录 artifacts,并用 gate 做 review 与验证。
4
-
5
- ## 基本用法
6
-
7
- ```bash
8
- loop-agent dag run-task <task-id> --profile auto --strict-models --output <temp-dir>/<task-id>-dag.json
9
- loop-agent dag validate --dag <temp-dir>/<task-id>-dag.json --strict-models --strict-governance
10
- loop-agent run-dag --dag <temp-dir>/<task-id>-dag.json --cwd .
11
- ```
12
-
13
- `<temp-dir>` 为平台原生临时目录。Windows 上 `--output`、`--dag`、`--cwd` 的实际值用原生路径。
14
-
15
- ## Executors
16
-
17
- - `static`:确定性生成的 artifacts 或 notes
18
- - `shell`:验证与文件系统检查
19
- - `pi`:规划、review、诊断;节点设 `toolProfile: "write"` 时有界写入
20
-
21
- ## Retry (read-only Pi nodes)
22
-
23
- planner/scout/reviewer/verifier/closeout 角色的只读 Pi 节点可声明 opt-in `retryPolicy`,用于在同一 run 内有界重试模型连接中断、provider 限流、临时不可用或请求 timeout。生成器会为这些安全节点自动声明默认策略:总尝试次数 3(手工配置上限 5),指数退避,单次等待上限 30s。
24
-
25
- - 仅以下原始失败分类默认可重试:`timeout`、`network`、`rate-limit`、`unavailable`。
26
- - `quota`、`auth`、`invalid-output`、`write-guard`、`decision-envelope` 与未知失败不重试。`quota` 不是 rate limit,不会被自动重试。
27
- - 资格由确定性 helper 判断:仅 `writePolicy=read-only|none`(或 Pi 默认只读)的 planner/scout/reviewer/verifier/closeout 可用。supervisor、implementer、writer(`toolProfile=write` 或 `writePolicy=exclusive`)、docs-only、dynamic、shell、static 与 decision-gate 节点一律不重试,DAG validation 会拒绝其策略。
28
- - 每次 attempt 写入独立不可变证据(`<node-id>/attempt-<n>.json`,run-relative path),最终 node record 的 `attempts` 字段引用完整 attempt 历史;后一次成功不会覆盖前一次失败证据。
29
- - 重试期间复用同一 run、controller identity、skill snapshot、prompt、model 与上游输入。节点终态的 `durationMs`、`tokensUsed`、`parsedEvents` 聚合全部 attempts;退避等待会刷新 `lastActivityAt`,避免被误判为 node-quiet。当前退避会占用该节点所在的并发槽。
30
-
31
- 示例:
32
-
33
- ```json
34
- {
35
- "retryPolicy": {
36
- "maxAttempts": 3,
37
- "backoff": "exponential",
38
- "initialDelayMs": 2000,
39
- "maxDelayMs": 30000,
40
- "retryCategories": ["timeout", "network", "rate-limit", "unavailable"]
41
- }
42
- }
43
- ```
44
-
45
- 未声明 `retryPolicy` 的历史 DAG 行为不变(单次执行、无 `attempts` 字段,也不新增 attempt artifact)。
46
-
47
- ## Skills
48
-
49
- DAG spec 可声明 `defaults.skills`、`skillsByRole` 与节点级 `skills`。Runner 优先从目标项目 `.agents/skills/<skill-name>/SKILL.md` 解析本地指令,再回退到包内 `.agents/skills/`,并在各节点 `skills.json` artifact 中记录解析元数据。
50
-
51
- 执行前可用 `dag validate --strict-skills` 做 opt-in skill audit;该门禁会在 missing/error/truncated skill 或 unresolved reference 出现时失败。默认 role skill 应来自 `ai_workspace/loop-agent/.agents/skills/vetted-skill-registry.md` 中记录的 repo-local wrapper。
52
-
53
- 目标项目的 `loop-agent` skill 位于 `.agents/skills/loop-agent/SKILL.md`。loop-agent 源仓库和 npm 包内置版本仍位于 `.agents/skills/loop-agent/SKILL.md`;遗留根路径 `skill/SKILL.md` 仅为旧 worktree 保留兼容 fallback。
54
-
55
- ## Artifacts
56
-
57
- DAG artifacts 位于:
58
-
59
- ```text
60
- .harness/dag-runs/<state>/<run-id>/artifacts/<node-id>/
61
- ```
62
-
63
- 根目录 `artifacts/` 不是有效的默认 DAG artifact 位置。
64
-
65
- ## Shell Gates
66
-
67
- - `shell.verdictGate` 从注入的当前 run 目录读取 `$HARNESS_DAG_RUN_DIR/<fromNodeId>.json`;不应自行发现 active run paths。
@@ -1,36 +0,0 @@
1
- # cursor-prompt Sidecar
2
-
3
- `cursor-prompt` 是显式、手工触发的 one-shot sidecar。它不是受治理 Agent runtime,也不参与 DAG、Loop 自动写入、Delegate `--auto-run` 或 task writer 选择。
4
-
5
- ## 产品定位
6
-
7
- | 路径 | 角色 |
8
- |---|---|
9
- | Pi DAG (`implement-pi` / `repair-pi`) | 唯一受治理 Agent writer |
10
- | shell / static | 确定性验证与静态输出 |
11
- | `cursor-prompt` | 人工 one-shot 干预;成功不等于任务完成 |
12
-
13
- ## 用法
14
-
15
- ```bash
16
- loop-agent cursor-prompt --cwd . "bounded task prompt"
17
- loop-agent cursor-prompt --file <path>
18
- loop-agent cursor-prompt --stdin
19
- loop-agent cursor-prompt --model <id>
20
- loop-agent cursor-prompt --timeout <ms>
21
- loop-agent cursor-prompt --stream
22
- loop-agent cursor-prompt --list-models
23
- ```
24
-
25
- 调用时才加载 `@cursor/sdk`。缺少 SDK 或 `CURSOR_API_KEY` 时,只有这条命令失败;普通 Agent DAG / doctor / init 不要求 Cursor。
26
-
27
- ## 约束
28
-
29
- - 不读取 `harness.json` task config / DAG facts 作为授权来源。
30
- - 不复制 DAG `writeSet`、repair、resume 或 Loop auto-execute 能力。
31
- - 返回后由主会话检查 diff,并显式运行 shell verification。
32
- - one-shot evidence 写入 `.harness/runs/{active,completed,failed}`。
33
-
34
- ## 迁移说明
35
-
36
- 旧 `executor: "cursor"` DAG、`executors.cursor`、`loopAutoWritePolicy` 与 `cursor-fix` 已硬切删除。需要写入时请重新生成 Pi-only DAG,或仅在人工干预场景使用本 sidecar。