@tea-agent/loop-agent 0.10.0 → 0.11.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 (166) hide show
  1. package/AGENTS.md +10 -2
  2. package/CHANGELOG.md +67 -25
  3. package/README.md +82 -11
  4. package/dist/application/dag/args.js +1 -12
  5. package/dist/application/dag/generate-task-dag.js +23 -2
  6. package/dist/application/dag/run-dag.js +1 -27
  7. package/dist/application/dag/validate-dag.js +2 -2
  8. package/dist/application/loop/run-action.js +0 -4
  9. package/dist/cli/command-definitions.js +44 -16
  10. package/dist/cli/program.js +40 -23
  11. package/dist/cli/update/notifier.js +117 -0
  12. package/dist/cli/update/npm-client.js +151 -0
  13. package/dist/cli/update/policy.js +58 -0
  14. package/dist/cli/update/state.js +68 -0
  15. package/dist/cli.js +33 -0
  16. package/dist/commands/cursor-prompt.js +42 -82
  17. package/dist/commands/dag-approve.js +36 -0
  18. package/dist/commands/delegate.js +75 -77
  19. package/dist/commands/doctor.js +0 -18
  20. package/dist/commands/init.js +476 -91
  21. package/dist/commands/instructions.js +7 -10
  22. package/dist/commands/loop.js +4 -20
  23. package/dist/commands/plan.js +50 -0
  24. package/dist/executors/config-core.js +0 -51
  25. package/dist/executors/dag-pi-executor.js +1 -1
  26. package/dist/executors/dag.js +0 -1
  27. package/dist/executors/index.js +0 -2
  28. package/dist/executors/model-routing.js +9 -9
  29. package/dist/executors/shell-executor.js +1 -1
  30. package/dist/governance/checks.js +6 -3
  31. package/dist/governance/exec-plans.js +545 -0
  32. package/dist/governance/manifest-types.js +24 -2
  33. package/dist/infrastructure/harness/loop-action-store.js +0 -3
  34. package/dist/records/harvest.js +2 -23
  35. package/dist/records/one-shot-runs.js +1 -1
  36. package/dist/shared/artifacts-core.js +24 -5
  37. package/dist/shared/output-truncation.js +37 -0
  38. package/dist/shared/package-metadata.js +353 -0
  39. package/dist/{executors/cursor-executor.js → sidecars/cursor-prompt/executor.js} +2 -42
  40. package/dist/sidecars/cursor-prompt/index.js +3 -0
  41. package/dist/sidecars/cursor-prompt/stream.js +121 -0
  42. package/dist/task/config-types.js +28 -12
  43. package/dist/task/delegate.js +9 -21
  44. package/dist/task/runtime.js +1 -2
  45. package/dist/worker/cli.js +29 -2
  46. package/dist/worker/delivery/final-verification.js +47 -11
  47. package/dist/worker/delivery/package.js +63 -10
  48. package/dist/worker/feature/run.js +60 -8
  49. package/dist/worker/loop-agent/loop-agent-client.js +329 -126
  50. package/dist/worker/observability/read-model.js +27 -1
  51. package/dist/worker/observe/static/app.js +326 -45
  52. package/dist/worker/observe/static/index.html +1 -1
  53. package/dist/worker/observe/static/styles.css +5 -4
  54. package/dist/worker/preflight.js +49 -1
  55. package/dist/worker/run-task/run-task.js +22 -12
  56. package/dist/worker/runner/run-ready.js +76 -12
  57. package/dist/worker/task-spec/schema.js +0 -1
  58. package/dist/workflows/dag/convergence/controller.js +1 -1
  59. package/dist/workflows/dag/executor-registry.js +0 -2
  60. package/dist/workflows/dag/init-hybrid.js +402 -25
  61. package/dist/workflows/dag/node-execution.js +61 -7
  62. package/dist/workflows/dag/runner.js +45 -17
  63. package/dist/workflows/dag/scheduler.js +7 -2
  64. package/dist/workflows/dag/sdd-embedded.js +128 -0
  65. package/dist/workflows/dag/skill-instructions.js +5 -4
  66. package/dist/workflows/dag/skill-snapshot.js +527 -0
  67. package/dist/workflows/dag/types.js +42 -9
  68. package/dist/workflows/dag/validate.js +5 -8
  69. package/dist/workflows/loop/actions/dag-action.js +0 -2
  70. package/dist/workflows/loop/actions/shared.js +1 -1
  71. package/dist/workflows/loop/actions.js +14 -31
  72. package/dist/workflows/loop/benchmark.js +1 -1
  73. package/dist/workflows/loop/index.js +1 -1
  74. package/dist/workflows/loop/policy/auto-policy.js +22 -14
  75. package/dist/workflows/loop/policy/path-patterns.js +13 -0
  76. package/docs/README.md +36 -33
  77. package/docs/agent-dag-recovery-playbook.md +1 -1
  78. package/docs/agent-dag-runner.md +2 -2
  79. package/docs/architecture/README.md +26 -0
  80. package/docs/architecture/dag-execution.md +134 -0
  81. package/docs/architecture/evolution.md +52 -0
  82. package/docs/architecture/facts-and-state.md +58 -0
  83. package/docs/architecture/runtime-boundaries.md +45 -17
  84. package/docs/architecture/system-overview.md +93 -0
  85. package/docs/architecture/worker-and-feature.md +81 -0
  86. package/docs/cursor-prompt-sidecar.md +36 -0
  87. package/docs/decisions/README.md +13 -1
  88. package/docs/design/README.md +42 -21
  89. package/docs/development-principles.md +2 -2
  90. package/docs/exec-plans/active/README.md +2 -2
  91. package/docs/exec-plans/completed/README.md +12 -0
  92. package/docs/feature-workflow.md +50 -4
  93. package/docs/harness-methodology-debugging.md +1 -1
  94. package/docs/harness-methodology-tdd.md +3 -3
  95. package/docs/init-surface.manifest.json +60 -25
  96. package/docs/loop-agent-harness.md +28 -4
  97. package/docs/progress/README.md +32 -1
  98. package/docs/reports/README.md +84 -18
  99. package/docs/skills/README.md +2 -1
  100. package/docs/skills/vetted-skill-registry.md +2 -1
  101. package/docs/templates/agent-dag-report.schema.json +6 -6
  102. package/docs/templates/agent-dag.base.json +0 -5
  103. package/docs/templates/agent-dag.final-verification.json +0 -5
  104. package/docs/templates/agent-dag.schema.json +1 -2
  105. package/docs/templates/agent-dag.supervised-implementation.json +1 -6
  106. package/docs/templates/frontend-design-contract.md +33 -0
  107. package/docs/templates/frontend-task-constraints.md +25 -0
  108. package/docs/templates/frontend-task-requirement.md +61 -0
  109. package/docs/templates/harness.schema.json +10 -12
  110. package/docs/templates/hybrid-dag.json +1 -6
  111. package/docs/templates/interactive-ui-round2-experiment.md +1 -1
  112. package/docs/templates/product-line/task.yaml +0 -1
  113. package/docs/templates/project-start-checklist.md +2 -2
  114. package/docs/templates/worker-dogfood-evidence.md +28 -0
  115. package/docs/templates/worker-dogfood-setup.md +20 -0
  116. package/docs/verification-matrix.md +10 -0
  117. package/examples/decision-gate-agent-dag.json +87 -33
  118. package/examples/example-dag.json +0 -5
  119. package/examples/hybrid-loop-agent-dag.json +0 -5
  120. package/harness.json +7 -15
  121. package/package.json +22 -46
  122. package/scripts/check-product-line-docs.sh +10 -7
  123. package/skills/agent-worker/SKILL.md +37 -0
  124. package/skills/agent-worker/references/agent-worker-operator.md +43 -0
  125. package/skills/frontend-design-review/SKILL.md +59 -0
  126. package/skills/frontend-design-review/references/review-checklist.md +37 -0
  127. package/skills/frontend-implementation/SKILL.md +51 -0
  128. package/skills/frontend-implementation/references/code-standards.md +34 -0
  129. package/skills/frontend-implementation/references/design-spec.md +46 -0
  130. package/skills/frontend-implementation/references/node-contracts.md +32 -0
  131. package/skills/frontend-review/SKILL.md +53 -0
  132. package/skills/frontend-review/references/review-findings.md +42 -0
  133. package/skills/frontend-verification/SKILL.md +40 -0
  134. package/skills/frontend-verification/references/verification-checklist.md +56 -0
  135. package/skills/grill-me/SKILL.md +10 -0
  136. package/skills/grill-with-docs/SKILL.md +88 -0
  137. package/skills/grill-with-docs/adr-format.md +47 -0
  138. package/skills/grill-with-docs/context-format.md +60 -0
  139. package/skills/loop-agent/SKILL.md +11 -9
  140. package/skills/loop-agent/references/command-reference.md +13 -15
  141. package/skills/loop-agent/references/docs-converge.md +126 -0
  142. package/skills/loop-agent/references/harness-policy.md +7 -7
  143. package/skills/loop-agent/references/hybrid-dag.md +15 -18
  144. package/skills/loop-agent/references/long-running-loop.md +4 -6
  145. package/skills/loop-agent/references/multi-worktree.md +6 -6
  146. package/skills/loop-agent/references/orchestrator-and-interventions.md +3 -3
  147. package/skills/loop-agent/references/pi-subagent-assisted-mode.md +14 -11
  148. package/skills/loop-agent/references/task-workflow.md +1 -1
  149. package/skills/using-git-worktrees/SKILL.md +215 -0
  150. package/dist/commands/cursor-worker.js +0 -43
  151. package/dist/cursor-worker-entry.js +0 -8
  152. package/dist/executors/cursor-artifacts.js +0 -33
  153. package/dist/executors/cursor-execution-log.js +0 -81
  154. package/dist/executors/cursor-executor-artifacts.js +0 -134
  155. package/dist/executors/cursor-run.js +0 -115
  156. package/dist/executors/cursor-tool.js +0 -94
  157. package/dist/executors/cursor-worker-client.js +0 -223
  158. package/dist/executors/cursor-worker-protocol.js +0 -18
  159. package/dist/executors/cursor-worker-server.js +0 -54
  160. package/dist/executors/cursor-worker.js +0 -3
  161. package/dist/executors/cursor.js +0 -6
  162. package/dist/executors/dag-cursor-executor.js +0 -87
  163. package/dist/workflows/loop/actions/cursor-fix.js +0 -191
  164. package/dist/workflows/loop/policy/cursor-fix-policy.js +0 -31
  165. package/docs/cursor-executor-usage.md +0 -25
  166. package/docs/dynamic-workflow-dag-engine-roadmap.md +0 -1749
@@ -0,0 +1,61 @@
1
+ # 前端任务需求模板
2
+
3
+ ## 用户目标
4
+
5
+ TODO
6
+
7
+ ## 目标页面/组件/路由
8
+
9
+ TODO
10
+
11
+ ## 用户流程
12
+
13
+ TODO
14
+
15
+ ## 必须状态
16
+
17
+ ### loading
18
+
19
+ TODO
20
+
21
+ ### empty
22
+
23
+ TODO
24
+
25
+ ### error
26
+
27
+ TODO
28
+
29
+ ### success
30
+
31
+ TODO
32
+
33
+ ### disabled
34
+
35
+ TODO
36
+
37
+ ## 目标运行环境
38
+
39
+ ### desktop
40
+
41
+ TODO
42
+
43
+ ### mobile
44
+
45
+ TODO
46
+
47
+ ### tablet
48
+
49
+ TODO
50
+
51
+ ## 交互要求
52
+
53
+ TODO
54
+
55
+ ## 验收标准
56
+
57
+ TODO
58
+
59
+ ## 非目标
60
+
61
+ TODO
@@ -56,13 +56,13 @@
56
56
  "dag": {
57
57
  "type": "object",
58
58
  "additionalProperties": false,
59
- "properties": {
60
- "outputLanguage": {
61
- "enum": ["zh-CN", "en"],
62
- "description": "DAG agent 节点的默认输出语言。未配置时使用简体中文;代码、命令和机器契约不翻译。",
63
- "default": "zh-CN"
64
- },
65
- "defaultEntry": {
59
+ "properties": {
60
+ "outputLanguage": {
61
+ "enum": ["zh-CN", "en"],
62
+ "description": "DAG agent 节点的默认输出语言。未配置时使用简体中文;代码、命令和机器契约不翻译。",
63
+ "default": "zh-CN"
64
+ },
65
+ "defaultEntry": {
66
66
  "enum": ["dag run-task", "run-dag"],
67
67
  "description": "默认 DAG 入口,用于任务 DAG 生成或直接 DAG 执行。",
68
68
  "default": "dag run-task"
@@ -122,8 +122,7 @@
122
122
  "principles": { "type": ["string", "null"], "description": "开发原则文档。" },
123
123
  "workflow": { "type": ["string", "null"], "description": "功能工作流文档。" },
124
124
  "verificationMatrix": { "type": ["string", "null"], "description": "验证命令矩阵。" },
125
- "loopAgentHarness": { "type": ["string", "null"], "description": "harness runtime 指南。" },
126
- "cursorExecutorUsage": { "type": ["string", "null"], "description": "可选 Cursor executor 使用说明。" }
125
+ "loopAgentHarness": { "type": ["string", "null"], "description": "harness runtime 指南。" }
127
126
  }
128
127
  },
129
128
  "artifacts": {
@@ -176,11 +175,10 @@
176
175
  },
177
176
  "executors": {
178
177
  "type": "object",
179
- "description": "按 executor id 分组的执行器配置。已知 executor 包括 pi cursor;项目也可以添加本地 executor key。",
178
+ "description": "按 executor id 分组的执行器配置。受治理 runtime 仅支持 pi;Cursor 仅通过 cursor-prompt sidecar 使用,不得配置在 executors 中。",
180
179
  "additionalProperties": { "$ref": "#/$defs/executor" },
181
180
  "properties": {
182
- "pi": { "$ref": "#/$defs/executor" },
183
- "cursor": { "$ref": "#/$defs/executor" }
181
+ "pi": { "$ref": "#/$defs/executor" }
184
182
  }
185
183
  }
186
184
  },
@@ -19,7 +19,7 @@
19
19
  "Add depends_on only when a child truly needs upstream output; challenge single-chain topologies during review",
20
20
  "Same-rank exclusive writeSet entries must be disjoint",
21
21
  "exclusive implementer nodes must use narrow, concrete writeSet paths; never use ** or repo root",
22
- "Cursor remains an explicit optional executor; no-Cursor environments use Pi read-only scouts and Pi writer nodes with toolProfile=write",
22
+ "Use Pi read-only scouts and Pi writer nodes with toolProfile=write; Cursor is only available through the explicit cursor-prompt sidecar",
23
23
  "Read-only nodes must not write root artifacts/**; root artifacts/ is reserved for explicit exclusive write nodes"
24
24
  ],
25
25
  "defaults": {
@@ -53,11 +53,6 @@
53
53
  ]
54
54
  },
55
55
  "executorModels": {
56
- "cursor": {
57
- "LOW": "composer-2.5",
58
- "MED": "composer-2.5",
59
- "HIGH": "gpt-5.5"
60
- },
61
56
  "pi": {
62
57
  "LOW": "gpt-5.3-codex-spark",
63
58
  "MED": "glm-5.2",
@@ -15,7 +15,7 @@ bash scripts-local/setup-drill-round2-react.sh /tmp/drill-round2-react-target
15
15
  npm run build
16
16
  node scripts-local/prepare-round2-ui-experiment.mjs \
17
17
  /tmp/drill-round2-react-target \
18
- dogfood/features/F-2026-001/tasks/FE-001.yaml \
18
+ features/F-2026-001/tasks/FE-001.yaml \
19
19
  /tmp/round2-ui-experiment \
20
20
  loop-agent
21
21
  node scripts-local/build-round2-ui-variants.mjs \
@@ -50,7 +50,6 @@ loop_agent:
50
50
  profile_policy: mapped
51
51
  strict_models: true
52
52
  strict_governance: true
53
- no_cursor: false
54
53
  max_concurrent: 1
55
54
  outputs:
56
55
  required:
@@ -1,9 +1,9 @@
1
1
  # 项目开工检查清单
2
2
 
3
3
  - [ ] 确认 `pwd`
4
- - [ ] 阅读 `README.md`、`harness.json`、`docs/README.md`
4
+ - [ ] 阅读 `README.md`、`harness.json`,以及 `harness.json.governanceRoot` 指向的 `README.md`
5
5
  - [ ] 检查 `git status --short --branch`
6
6
  - [ ] 确定单一工作块
7
- - [ ] `docs/verification-matrix.md` 选择验证命令
7
+ - [ ] 从治理根目录下的 `verification-matrix.md` 选择验证命令
8
8
  - [ ] 保留无关用户变更
9
9
  - [ ] 非平凡工作时记录 handoff 证据
@@ -9,10 +9,16 @@
9
9
  | Target repo | disposable path or sanitized reference |
10
10
  | Controller package/version | |
11
11
  | Agent-worker package/version (same npm install) | |
12
+ | Controller requested entry / real entry | sanitized reference; keep machine-local absolute value in runtime evidence |
13
+ | Controller launch command / args prefix | sanitized reference |
14
+ | Controller binary SHA-256 | |
15
+ | Controller package fingerprint | `sha256:<hex>` |
16
+ | Expected controller version / fingerprint | n/a / exact values |
12
17
  | Provider/model / override | |
13
18
  | Batch ID | |
14
19
  | Worker run ID | |
15
20
  | Retry of worker run ID | n/a / |
21
+ | Candidate commit / tarball SHA-256 | n/a / |
16
22
 
17
23
  ## Baseline
18
24
 
@@ -27,11 +33,32 @@
27
33
  | TaskSpec / source-doc copies | | |
28
34
  | DAG spec | | |
29
35
  | DAG report JSON / Markdown | | |
36
+ | DAG skill snapshot ref / SHA-256 / mode | | |
30
37
  | shell verification | | |
31
38
  | diff | | |
32
39
  | closeout or Failure Handoff | | |
33
40
  | morning report | | |
34
41
  | Observe snapshot / events | | |
42
+ | Controller identity in Worker / Task Pool / batch / Feature evidence | | |
43
+
44
+ ## Candidate takeover evidence (if applicable)
45
+
46
+ | Field | Value / result |
47
+ |---|---|
48
+ | Candidate isolated slot containment | |
49
+ | `loop-agent` entry / binary SHA-256 / reported version | |
50
+ | `agent-worker` entry / binary SHA-256 / reported version | |
51
+ | Shared package fingerprint | |
52
+ | Full init / doctor / inspect / docs audit / target check-repo | |
53
+ | `agent-worker` skill and `.agents/skills` mirror hashes | |
54
+ | Feature validation / `feature run --dry-run` | |
55
+ | DAG executors | expected: `static`, `shell` only |
56
+ | PATH trap invocations | expected: none |
57
+ | Pi/model executor observed | expected: false; derive from actual DAG nodes |
58
+ | Feature dry-run executed tasks | expected: empty |
59
+ | Canary verdict / evidence path | |
60
+
61
+ Do not use a deterministic canary result as proof that live Pi/model/provider execution succeeded. Record run-owned skill snapshot evidence and any explicitly authorized live run separately.
35
62
 
36
63
  ## Acceptance and QA coverage
37
64
 
@@ -50,3 +77,4 @@
50
77
  - Verdict: pass / fail / blocked
51
78
  - Review notes:
52
79
  - Follow-up task(s):
80
+ - Evidence limitations (for example deterministic-only, no Pi executor/live takeover):
@@ -10,9 +10,11 @@ Use this template to create a disposable target repository for a real `agent-wor
10
10
  npm install -g @tea-agent/loop-agent@<version>
11
11
  npm list -g @tea-agent/loop-agent --depth=0
12
12
  loop-agent --version
13
+ agent-worker --version
13
14
  agent-worker --help
14
15
  ```
15
16
 
17
+ - Before any write-capable Worker command, resolve one controller identity for the batch. Record its package version, absolute launch entry, binary SHA-256, and portable package fingerprint. If the run is part of a release or self-hosting train, carry the expected version/fingerprint as explicit CLI gates.
16
18
  - Create a clean, disposable target repository. Do not use `npm link`, `npm run dev`, or a workspace controller for a real-evidence run.
17
19
  - Put requirement, acceptance, design, test plan, and QA case matrix next to the TaskSpec. `agent-worker` materializes immutable copies into the harness task source before DAG generation.
18
20
 
@@ -23,6 +25,8 @@ Use this template to create a disposable target repository for a real `agent-wor
23
25
  - [ ] TaskSpec has narrow `allowed_paths` and explicit `forbidden_paths`.
24
26
  - [ ] Task Pool dependencies are either backed by real prior runs or intentionally recorded as pre-existing evidence.
25
27
  - [ ] The chosen model/provider and `--pi-model` smoke override, if any, are recorded.
28
+ - [ ] `--loop-agent-bin` resolves to the intended published package, and expected controller version/fingerprint are recorded before target writes.
29
+ - [ ] If this is a self-hosting run, published N remains fixed for the whole batch; candidate N+1 is installed and verified in a separate slot.
26
30
 
27
31
  ## Execute
28
32
 
@@ -30,6 +34,9 @@ Use this template to create a disposable target repository for a real `agent-wor
30
34
  agent-worker batch run-ready \
31
35
  --feature-dir <feature-dir> \
32
36
  --repo <target-repo> \
37
+ --loop-agent-bin <published-loop-agent-entry> \
38
+ --expected-controller-version <version> \
39
+ --expected-controller-fingerprint <sha256:value> \
33
40
  --limit 1 \
34
41
  --check-repo \
35
42
  [--pi-model <model>]
@@ -46,3 +53,16 @@ agent-worker batch run-ready --feature-dir <feature-dir> --repo <target-repo> --
46
53
  ```
47
54
 
48
55
  The retry run must have a distinct `workerRunId` and retain `retryOfWorkerRunId` in its Task Pool evidence.
56
+
57
+ ## Versioned self-hosting takeover
58
+
59
+ From a source checkout, use the repo-maintainer deterministic canary after building or packing candidate N+1:
60
+
61
+ ```bash
62
+ npm run self-host:canary -- \
63
+ --deterministic \
64
+ --tarball <candidate.tgz> \
65
+ --output <candidate-canary-evidence.json>
66
+ ```
67
+
68
+ The deterministic canary must prove isolated-slot containment, both candidate bin identities, package fingerprint, full init/governance checks, a zero-execution Feature dry-run, static/shell-only observed DAG executors, and no PATH controller fallback. It does not claim to trap every possible Pi SDK/absolute path and does not replace a separately authorized live Pi run or the DAG skill-snapshot tests.
@@ -12,7 +12,12 @@
12
12
  | Follow-up 分类与事务 | `npx vitest run test/worker/follow-up test/worker/feature test/worker/pool test/worker/report test/worker/agent-worker-cli.test.ts` | `npm test` + `node bin/agent-worker.js task draft-followup --help` + `node bin/agent-worker.js feature approve-followup --help` |
13
13
  | Feature Git transaction | `npx vitest run test/worker/delivery test/worker/feature test/worker/runner test/worker/agent-worker-cli.test.ts` | `npm test` + `node bin/agent-worker.js feature run --help` + temporary Git repo smoke |
14
14
  | Final verification / Delivery / Closeout | `npx vitest run test/worker/delivery test/worker/closeout test/worker/feature test/worker/agent-worker-cli.test.ts` | `npm test` + verify-final/Delivery/Closeout CLI help + temporary Git repo evidence/hash/tamper/apply rollback smoke |
15
+ | Controller identity / pinning | `npx vitest run test/worker/package-metadata.test.ts test/worker/repo-preflight.test.ts test/worker/loop-agent-client.test.ts test/worker/run-task/run-task.test.ts test/worker/runner/run-ready.test.ts test/worker/feature/run.test.ts test/worker/delivery/final-verification.test.ts test/worker/delivery/package.test.ts test/worker/agent-worker-cli.test.ts` + `npm run typecheck` | `npm test` + build + 两个 CLI `--version` + 写入型命令 help |
16
+ | DAG resolved skill snapshot / resume | `npx vitest run test/dag-skill-snapshot.test.ts test/dag-approve-resume.test.ts` + `npm run typecheck` | `npm test` + snapshot tamper/pause-resume/dynamic profile smoke |
17
+ | Versioned self-hosting candidate canary | `npx vitest run test/self-host-canary.test.ts test/package-surface.test.ts` + `npm run build` | `npm run self-host:canary -- --deterministic --output <evidence.json>` + `npm pack --dry-run` |
18
+ | Public skill / init mirror surface | `bash scripts/check-skill-entry.sh` + `npx vitest run test/init-command.test.ts test/package-surface.test.ts` | 临时目标项目 full init + skill/mirror hash 对照 + `bash scripts/check-repo.sh` |
15
19
  | DAG 工作流 | 定向 DAG 测试 | `npm test` |
20
+ | 前端 DAG 模板 / 前端节点生成 | `npm run typecheck` + 定向 DAG 测试 | `npm test` + `bash scripts/check-repo.sh` |
16
21
  | Production readiness hardening | `bash scripts/check-repo.sh` + 定向 DAG/CLI 测试 | `bash scripts/ci.sh` + docs build + package smoke |
17
22
  | 脚本或 CI | 运行变更的脚本 | `bash scripts/ci.sh` |
18
23
  | Package / publish 入口 | `npm run build` + `node bin/loop-agent.js --help` | `npm pack --dry-run` |
@@ -27,10 +32,15 @@ npm run build
27
32
  bash scripts/check-repo.sh
28
33
  bash scripts/ci.sh
29
34
  node bin/loop-agent.js --help
35
+ node bin/loop-agent.js --version
36
+ node bin/agent-worker.js --version
30
37
  npm run dev -- --help
31
38
  npm pack --dry-run
39
+ npm run self-host:canary -- --deterministic --output <evidence.json>
32
40
  ```
33
41
 
42
+ deterministic self-host canary 必须只执行 static/shell DAG,并在 evidence 中证明 `piExecutorObserved=false`、`modelExecutorObserved=false`、`featureExecutedTasks=[]`、PATH controller trap 未触发且候选入口位于隔离 slot。它不证明 candidate Pi/model/provider 路径,也不替代 `test/dag-skill-snapshot.test.ts` 对候选 skill resolution、snapshot hash 和 resume 的验证。
43
+
34
44
  测试资源策略:`npm test` 会先运行可并行的纯测试,再串行运行会启动 CLI、`tsx` 或 Git 子进程的集成测试。纯测试根据 `os.availableParallelism()` 自适应使用 1 至 4 个 Worker;可用 `LOOP_AGENT_FAST_TEST_WORKERS` 在 CI 或受限机器上显式覆盖。传入测试文件时,例如 `npm test -- test/worker/observe/server.test.ts`,仍按常规 Vitest 方式只运行该范围,不会启动两阶段完整测试。
35
45
 
36
46
  产品线 Feature/Task/QA 文档或 TaskSpec 约束变更还应运行:
@@ -4,7 +4,7 @@
4
4
  "objective": "Demonstrate an advisory-only AI Secretary Decision Gate after deterministic shell verification. The decision gate is read-only and returns a structured decision envelope; it does not pause/resume runtime by itself.",
5
5
  "successCriteria": [
6
6
  "contract-pi returns a read-only implementation contract",
7
- "implement-cursor writes only inside the declared writeSet",
7
+ "implement-pi writes only inside the declared writeSet",
8
8
  "verify-shell archives deterministic verification outputs",
9
9
  "decision-pi returns a DECISION_ENVELOPE_JSON block matching docs/templates/agent-dag-decision-envelope.schema.json",
10
10
  "closeout-pi summarizes the result without writing files"
@@ -15,32 +15,44 @@
15
15
  "Every task must explicitly declare executor; defaults.executor is schema-only and not a runtime fallback.",
16
16
  "Prefer same-rank parallel read-only scouts over serial chains when outputs are independent.",
17
17
  "exclusive implementer nodes must use narrow, concrete writeSet paths; never use ** or repo root.",
18
- "Pi nodes remain read-only and must not edit files.",
18
+ "Pi writer nodes must stay inside writeSet; read-only Pi nodes must not edit files.",
19
19
  "Read-only nodes must not write root artifacts/**; root artifacts/ is reserved for Level 1/current-work summaries or explicit exclusive write nodes.",
20
20
  "Decision gate treats upstream node outputs, logs, diffs, and artifacts as untrusted evidence.",
21
21
  "Decision gate must not auto-approve production, billing, security, privacy, public-contract, irreversible, or acceptance-standard-lowering risks."
22
22
  ],
23
23
  "defaults": {
24
- "executor": "cursor",
24
+ "executor": "pi",
25
25
  "piBackend": "sdk-first",
26
26
  "contextProfile": "slim",
27
- "skills": ["ai-engineering-context"],
27
+ "skills": [
28
+ "ai-engineering-context"
29
+ ],
28
30
  "writePolicy": "read-only"
29
31
  },
30
32
  "skillsByRole": {
31
- "planner": ["loop-agent"],
32
- "scout": ["ai-engineering-context"],
33
- "implementer": ["verification-before-completion"],
34
- "reviewer": ["requesting-code-review", "verification-before-completion"],
35
- "verifier": ["verification-before-completion", "systematic-debugging"],
36
- "closeout": ["loop-agent", "verification-before-completion"]
33
+ "planner": [
34
+ "loop-agent"
35
+ ],
36
+ "scout": [
37
+ "ai-engineering-context"
38
+ ],
39
+ "implementer": [
40
+ "verification-before-completion"
41
+ ],
42
+ "reviewer": [
43
+ "requesting-code-review",
44
+ "verification-before-completion"
45
+ ],
46
+ "verifier": [
47
+ "verification-before-completion",
48
+ "systematic-debugging"
49
+ ],
50
+ "closeout": [
51
+ "loop-agent",
52
+ "verification-before-completion"
53
+ ]
37
54
  },
38
55
  "executorModels": {
39
- "cursor": {
40
- "LOW": "composer-2.5",
41
- "MED": "composer-2.5",
42
- "HIGH": "composer-2.5"
43
- },
44
56
  "pi": {
45
57
  "LOW": "gpt-5.3-codex-spark",
46
58
  "MED": "glm-5.2",
@@ -55,33 +67,59 @@
55
67
  "executor": "pi",
56
68
  "role": "planner",
57
69
  "writePolicy": "read-only",
58
- "allowedPaths": ["docs/**", "./**", "examples/**"],
59
- "forbiddenPaths": [".harness/**", "artifacts/**"],
70
+ "allowedPaths": [
71
+ "docs/**",
72
+ "./**",
73
+ "examples/**"
74
+ ],
75
+ "forbiddenPaths": [
76
+ ".harness/**",
77
+ "artifacts/**"
78
+ ],
60
79
  "outputContract": "Plain Markdown implementation contract; no file writes.",
61
80
  "subtask_prompt": "Read the DAG objective, success criteria, docs/loop-agent-harness.md, and docs/agent-dag-runner.md. Return a concise contract covering scope, write boundaries, risks, and verification expectations. Do not edit files."
62
81
  },
63
82
  {
64
- "id": "implement-cursor",
65
- "depends_on": ["contract-pi"],
83
+ "id": "implement-pi",
84
+ "depends_on": [
85
+ "contract-pi"
86
+ ],
66
87
  "complexity": "HIGH",
67
- "executor": "cursor",
88
+ "executor": "pi",
68
89
  "role": "implementer",
69
90
  "writePolicy": "exclusive",
70
- "writeSet": ["REPLACE/WITH/ALLOWED/PATH/**"],
71
- "allowedPaths": ["REPLACE/WITH/ALLOWED/PATH/**"],
72
- "forbiddenPaths": [".harness/**", "artifacts/**"],
91
+ "writeSet": [
92
+ "REPLACE/WITH/ALLOWED/PATH/**"
93
+ ],
94
+ "allowedPaths": [
95
+ "REPLACE/WITH/ALLOWED/PATH/**"
96
+ ],
97
+ "forbiddenPaths": [
98
+ ".harness/**",
99
+ "artifacts/**"
100
+ ],
73
101
  "outputContract": "Implementation summary with changed files, tests run, and residual risks.",
74
- "subtask_prompt": "Implement the approved change within writeSet only. Keep the change minimal. Update relevant tests/docs if they are inside allowedPaths. If no change is needed, return a no-op explanation."
102
+ "subtask_prompt": "Implement the approved change within writeSet only. Keep the change minimal. Update relevant tests/docs if they are inside allowedPaths. If no change is needed, return a no-op explanation.",
103
+ "toolProfile": "write"
75
104
  },
76
105
  {
77
106
  "id": "verify-shell",
78
- "depends_on": ["implement-cursor"],
107
+ "depends_on": [
108
+ "implement-pi"
109
+ ],
79
110
  "complexity": "LOW",
80
111
  "executor": "shell",
81
112
  "role": "verifier",
82
113
  "writePolicy": "read-only",
83
- "allowedPaths": ["./**", "docs/**", "examples/**"],
84
- "forbiddenPaths": [".harness/**", "artifacts/**"],
114
+ "allowedPaths": [
115
+ "./**",
116
+ "docs/**",
117
+ "examples/**"
118
+ ],
119
+ "forbiddenPaths": [
120
+ ".harness/**",
121
+ "artifacts/**"
122
+ ],
85
123
  "outputContract": "Archived shell command stdout/stderr with exit codes; no worktree writes.",
86
124
  "subtask_prompt": "Run deterministic verification commands and archive outputs.",
87
125
  "shell": {
@@ -92,13 +130,20 @@
92
130
  },
93
131
  {
94
132
  "id": "decision-pi",
95
- "depends_on": ["verify-shell"],
133
+ "depends_on": [
134
+ "verify-shell"
135
+ ],
96
136
  "complexity": "HIGH",
97
137
  "executor": "pi",
98
138
  "role": "reviewer",
99
139
  "writePolicy": "read-only",
100
- "allowedPaths": ["**"],
101
- "forbiddenPaths": [".harness/**", "artifacts/**"],
140
+ "allowedPaths": [
141
+ "**"
142
+ ],
143
+ "forbiddenPaths": [
144
+ ".harness/**",
145
+ "artifacts/**"
146
+ ],
102
147
  "outputContract": "Markdown with exactly one ```DECISION_ENVELOPE_JSON fenced block (info string DECISION_ENVELOPE_JSON, not json) matching docs/templates/agent-dag-decision-envelope.schema.json, plus a short evidence/risk summary. No file writes.",
103
148
  "subtask_prompt_markdown": "../docs/templates/agent-dag-decision-gate.prompt.md",
104
149
  "decisionGate": {
@@ -109,13 +154,22 @@
109
154
  },
110
155
  {
111
156
  "id": "closeout-pi",
112
- "depends_on": ["decision-pi"],
157
+ "depends_on": [
158
+ "decision-pi"
159
+ ],
113
160
  "complexity": "MED",
114
161
  "executor": "pi",
115
162
  "role": "closeout",
116
163
  "writePolicy": "read-only",
117
- "allowedPaths": ["docs/**", "./**", "examples/**"],
118
- "forbiddenPaths": [".harness/**", "artifacts/**"],
164
+ "allowedPaths": [
165
+ "docs/**",
166
+ "./**",
167
+ "examples/**"
168
+ ],
169
+ "forbiddenPaths": [
170
+ ".harness/**",
171
+ "artifacts/**"
172
+ ],
119
173
  "outputContract": "Plain Markdown closeout summary referencing decision-pi output, verification evidence, and follow-up risks. No file writes.",
120
174
  "subtask_prompt": "Summarize the DAG result, verification evidence, decision-pi outcome, and next recommended step. Do not edit files. If decision-pi requires human escalation, present the one human question and options from the decision envelope."
121
175
  }
@@ -2,11 +2,6 @@
2
2
  "version": 2,
3
3
  "title": "示例:审计并行 + 汇总串行",
4
4
  "executorModels": {
5
- "cursor": {
6
- "LOW": "composer-2.5",
7
- "MED": "composer-2.5",
8
- "HIGH": "gpt-5.5"
9
- },
10
5
  "pi": {
11
6
  "LOW": "gpt-5.3-codex-spark",
12
7
  "MED": "glm-5.2",
@@ -54,11 +54,6 @@
54
54
  ]
55
55
  },
56
56
  "executorModels": {
57
- "cursor": {
58
- "LOW": "composer-2.5",
59
- "MED": "composer-2.5",
60
- "HIGH": "gpt-5.5"
61
- },
62
57
  "pi": {
63
58
  "LOW": "gpt-5.3-codex-spark",
64
59
  "MED": "glm-5.2",
package/harness.json CHANGED
@@ -5,10 +5,10 @@
5
5
  "governanceRoot": "docs",
6
6
  "workflowPolicy": {
7
7
  "defaultImplementationWorkflow": "agent-dag",
8
- "dag": {
9
- "defaultEntry": "dag run-task",
10
- "outputLanguage": "zh-CN",
11
- "profileRouting": {
8
+ "dag": {
9
+ "defaultEntry": "dag run-task",
10
+ "outputLanguage": "zh-CN",
11
+ "profileRouting": {
12
12
  "minimal": "standard-dag",
13
13
  "standard": "standard-dag",
14
14
  "reviewed": "review-gated-dag",
@@ -33,8 +33,7 @@
33
33
  "principles": "docs/development-principles.md",
34
34
  "workflow": "docs/feature-workflow.md",
35
35
  "verificationMatrix": "docs/verification-matrix.md",
36
- "loopAgentHarness": "docs/loop-agent-harness.md",
37
- "cursorExecutorUsage": "docs/cursor-executor-usage.md"
36
+ "loopAgentHarness": "docs/loop-agent-harness.md"
38
37
  },
39
38
  "artifacts": {
40
39
  "templatesDir": "docs/templates",
@@ -59,16 +58,9 @@
59
58
  "executors": {
60
59
  "pi": {
61
60
  "description": "Pi planning, review, diagnosis, and bounded writing when DAG toolProfile=write",
62
- "defaultModel": "gpt-5.3-codex-spark",
63
61
  "LOW": "gpt-5.3-codex-spark",
64
- "MED": "glm-5.2",
65
- "HIGH": "gpt-5.5"
66
- },
67
- "cursor": {
68
- "description": "Cursor via @cursor/sdk (default model: account default)",
69
- "enabled": false,
70
- "defaultModel": "default",
71
- "requiresApiKey": "CURSOR_API_KEY"
62
+ "MED": "grok-4.5",
63
+ "HIGH": "gpt-5.6-sol"
72
64
  }
73
65
  }
74
66
  }
package/package.json CHANGED
@@ -1,38 +1,26 @@
1
1
  {
2
2
  "name": "@tea-agent/loop-agent",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "loop-agent": "bin/loop-agent.js",
7
7
  "agent-worker": "bin/agent-worker.js"
8
8
  },
9
9
  "files": [
10
- "AGENTS.md",
11
- "bin/",
12
- "dist/",
13
- "docs/*.md",
14
- "docs/architecture/runtime-boundaries.md",
15
- "docs/decisions/README.md",
16
- "docs/design/README.md",
17
- "docs/exec-plans/README.md",
18
- "docs/exec-plans/active/README.md",
19
- "docs/exec-plans/completed/README.md",
20
- "docs/init-surface.manifest.json",
21
- "docs/progress/README.md",
22
- "docs/reports/README.md",
23
- "docs/skills/",
24
- "docs/templates/",
25
- "examples/",
26
- "harness.json",
27
- "skills/",
28
- "scripts/check-product-line-docs.sh",
29
- "scripts/check-task-pool-root.sh",
30
- "README.md",
31
- "CHANGELOG.md"
10
+ "AGENTS.md", "bin/", "dist/", "docs/*.md", "docs/architecture/runtime-boundaries.md",
11
+ "docs/architecture/README.md",
12
+ "docs/architecture/system-overview.md",
13
+ "docs/architecture/dag-execution.md",
14
+ "docs/architecture/worker-and-feature.md",
15
+ "docs/architecture/facts-and-state.md",
16
+ "docs/architecture/evolution.md",
17
+ "docs/decisions/README.md", "docs/design/README.md", "docs/exec-plans/README.md",
18
+ "docs/exec-plans/active/README.md", "docs/exec-plans/completed/README.md",
19
+ "docs/init-surface.manifest.json", "docs/progress/README.md", "docs/reports/README.md",
20
+ "docs/skills/", "docs/templates/", "examples/", "harness.json", "skills/",
21
+ "scripts/check-product-line-docs.sh", "scripts/check-task-pool-root.sh", "README.md", "CHANGELOG.md"
32
22
  ],
33
- "publishConfig": {
34
- "access": "public"
35
- },
23
+ "publishConfig": { "access": "public" },
36
24
  "scripts": {
37
25
  "dev": "node --import tsx/esm src/cli.ts",
38
26
  "cursor": "node --import tsx/esm src/cli.ts cursor-prompt",
@@ -43,28 +31,16 @@
43
31
  "prepublishOnly": "npm run typecheck && npm test && npm run build",
44
32
  "lint": "tsc --noEmit",
45
33
  "typecheck": "tsc --noEmit",
46
- "test": "node scripts/run-tests.mjs",
47
- "test:fast": "vitest run --config vitest.fast.config.ts",
48
- "test:integration": "vitest run --config vitest.integration.config.ts",
34
+ "test": "node scripts/run-tests.mjs",
35
+ "test:fast": "vitest run --config vitest.fast.config.ts",
36
+ "test:integration": "vitest run --config vitest.integration.config.ts",
49
37
  "docs:dev": "npm --prefix website start",
50
38
  "docs:build": "npm --prefix website run build",
51
39
  "docs:serve": "npm --prefix website run serve",
52
- "smoke:stale-serial": "tsx scripts/smoke-stale-plan-serial.ts"
53
- },
54
- "dependencies": {
55
- "commander": "^12.1.0",
56
- "yaml": "^2.9.0",
57
- "zod": "^3.25.76"
58
- },
59
- "optionalDependencies": {
60
- "@cursor/sdk": "^1.0.7",
61
- "@earendil-works/pi-ai": "*",
62
- "@earendil-works/pi-coding-agent": "*"
40
+ "smoke:stale-serial": "node --import tsx/esm scripts/smoke-stale-plan-serial.ts",
41
+ "self-host:canary": "node scripts/self-host-canary.mjs"
63
42
  },
64
- "devDependencies": {
65
- "@types/node": "^24.6.0",
66
- "tsx": "^4.20.6",
67
- "typescript": "^5.9.3",
68
- "vitest": "^3.2.4"
69
- }
43
+ "dependencies": { "commander": "^12.1.0", "semver": "^7.8.5", "yaml": "^2.9.0", "zod": "^3.25.76" },
44
+ "optionalDependencies": { "@cursor/sdk": "^1.0.7", "@earendil-works/pi-ai": "*", "@earendil-works/pi-coding-agent": "*" },
45
+ "devDependencies": { "@types/node": "^24.6.0", "@types/semver": "^7.7.1", "tsx": "^4.20.6", "typescript": "^5.9.3", "vitest": "^3.2.4" }
70
46
  }