@tea-agent/loop-agent 0.4.0 → 0.6.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 (67) hide show
  1. package/AGENTS.md +2 -2
  2. package/CHANGELOG.md +48 -38
  3. package/README.md +3 -3
  4. package/dist/application/dag/args.js +9 -1
  5. package/dist/application/dag/run-dag.js +16 -2
  6. package/dist/application/dag/validate-dag.js +14 -1
  7. package/dist/cli/command-definitions.js +22 -4
  8. package/dist/cli/help.js +3 -2
  9. package/dist/cli/program.js +7 -5
  10. package/dist/commands/import-prd.js +76 -0
  11. package/dist/commands/init.js +230 -32
  12. package/dist/commands/instructions.js +90 -58
  13. package/dist/executors/config-core.js +3 -2
  14. package/dist/executors/dag-pi-executor.js +1 -0
  15. package/dist/executors/model-routing.js +43 -0
  16. package/dist/executors/pi-sdk-executor.js +63 -1
  17. package/dist/governance/manifest-types.js +9 -1
  18. package/dist/shared/preview.js +39 -0
  19. package/dist/task/source-references.js +221 -0
  20. package/dist/worker/cli.js +62 -1
  21. package/dist/worker/loop-agent/loop-agent-client.js +97 -5
  22. package/dist/worker/materialize/harness-task-materializer.js +162 -5
  23. package/dist/worker/observability/event-store.js +82 -0
  24. package/dist/worker/observability/events.js +79 -0
  25. package/dist/worker/observability/progress-composite.js +33 -0
  26. package/dist/worker/observability/read-model.js +1013 -0
  27. package/dist/worker/observability/snapshot-store.js +43 -0
  28. package/dist/worker/observability/types.js +1 -0
  29. package/dist/worker/observe/paths.js +64 -0
  30. package/dist/worker/observe/routes.js +423 -0
  31. package/dist/worker/observe/server.js +61 -0
  32. package/dist/worker/observe/static/app.js +1419 -0
  33. package/dist/worker/observe/static/index.html +63 -0
  34. package/dist/worker/observe/static/styles.css +613 -0
  35. package/dist/worker/pool/failure-routing.js +41 -6
  36. package/dist/worker/pool/run-store.js +59 -1
  37. package/dist/worker/progress-reporter.js +0 -18
  38. package/dist/worker/run-task/run-task.js +327 -92
  39. package/dist/worker/runner/run-ready.js +112 -4
  40. package/dist/workflows/dag/event-observer.js +132 -0
  41. package/dist/workflows/dag/init-hybrid.js +150 -26
  42. package/dist/workflows/dag/observer-compose.js +52 -0
  43. package/dist/workflows/dag/skill-instructions.js +4 -0
  44. package/dist/workflows/dag/types.js +1 -1
  45. package/dist/workflows/dag/validate.js +3 -2
  46. package/docs/README.md +2 -0
  47. package/docs/architecture/runtime-boundaries.md +18 -3
  48. package/docs/design/README.md +22 -9
  49. package/docs/exec-plans/active/README.md +6 -1
  50. package/docs/exec-plans/completed/README.md +12 -0
  51. package/docs/init-surface.manifest.json +32 -2
  52. package/docs/loop-agent-harness.md +13 -0
  53. package/docs/reports/README.md +4 -0
  54. package/docs/templates/agent-dag.base.json +1 -1
  55. package/docs/templates/agent-dag.final-verification.json +1 -1
  56. package/docs/templates/agent-dag.supervised-implementation.json +1 -1
  57. package/docs/templates/hybrid-dag.json +1 -1
  58. package/docs/templates/worker-dogfood-evidence.md +52 -0
  59. package/docs/templates/worker-dogfood-setup.md +48 -0
  60. package/examples/example-dag.json +1 -1
  61. package/examples/hybrid-loop-agent-dag.json +1 -1
  62. package/harness.json +5 -29
  63. package/package.json +6 -6
  64. package/skills/loop-agent/SKILL.md +5 -3
  65. package/skills/loop-agent/references/command-reference.md +12 -3
  66. package/skills/loop-agent/references/harness-policy.md +7 -3
  67. package/skills/loop-agent/references/task-workflow.md +8 -3
@@ -428,7 +428,7 @@ function validateDecisionGateTaskConfig(task, issues) {
428
428
  });
429
429
  }
430
430
  }
431
- export function collectExecutorModelWarnings(spec) {
431
+ export function collectExecutorModelWarnings(spec, expectedMatrices = DEFAULT_DAG_EXECUTOR_MODELS) {
432
432
  const warnings = [];
433
433
  const executors = Object.keys(DEFAULT_DAG_EXECUTOR_MODELS);
434
434
  for (const executor of executors) {
@@ -436,11 +436,12 @@ export function collectExecutorModelWarnings(spec) {
436
436
  if (!actualByComplexity) {
437
437
  continue;
438
438
  }
439
+ const expectedByComplexity = expectedMatrices[executor] ?? DEFAULT_DAG_EXECUTOR_MODELS[executor];
439
440
  for (const [complexityKey, actual] of Object.entries(actualByComplexity)) {
440
441
  if (actual === undefined) {
441
442
  continue;
442
443
  }
443
- const expected = DEFAULT_DAG_EXECUTOR_MODELS[executor][complexityKey];
444
+ const expected = expectedByComplexity[complexityKey];
444
445
  if (actual !== expected) {
445
446
  warnings.push({
446
447
  executor,
package/docs/README.md CHANGED
@@ -51,6 +51,8 @@
51
51
  - `templates/exec-plan.md` — 非平凡工作的执行计划
52
52
  - `templates/progress-log.md` — 进度与交接日志
53
53
  - `templates/qa-report.md` — 验证与 QA 证据
54
+ - `templates/worker-dogfood-setup.md` — 发布控制器下的真实 Worker sample setup 与 retry 纪律
55
+ - `templates/worker-dogfood-evidence.md` — BE/FE/QA sample、Observe、morning report 与 coverage evidence 模板
54
56
  - `templates/production-readiness-checklist.md` — 低/中风险单仓库 DAG readiness 检查清单
55
57
  - `templates/init-evolution-review.md` — 初始化能力演化审查报告模板
56
58
  - `templates/adr.md` — 架构决策记录(ADR)
@@ -20,6 +20,10 @@ Workflow runtime (src/workflows/)
20
20
  Executors (src/executors/)
21
21
  └─ Cursor / Pi / Shell 等外部工具适配;不应依赖 commands 或 CLI formatting
22
22
 
23
+ Worker adapter (src/worker/)
24
+ └─ 产品线 TaskSpec / Task Pool / Observe 本地适配;以子进程调用已发布 loop-agent CLI,
25
+ 不得 in-process import CLI、commands 或 application
26
+
23
27
  Infrastructure / Store (src/infrastructure/,逐步引入)
24
28
  └─ .harness 文件系统副作用、run lifecycle、原子写入规则
25
29
 
@@ -63,6 +67,13 @@ Governance (scripts/check-*.sh, src/governance/)
63
67
  - **允许依赖**:`src/shared/**`、外部 SDK。
64
68
  - **禁止**:依赖 `src/commands/**` 或 CLI 输出格式。
65
69
 
70
+ ### Worker adapter
71
+
72
+ - **位置**:`src/worker/**`,独立 `agent-worker` CLI 为 `src/worker/cli.ts`。
73
+ - **职责**:TaskSpec 校验与物化、Task Pool batch/retry/morning report、失败路由,以及只读 Observe 事件/快照/UI;实际 DAG 执行通过 `LoopAgentClient` 启动已发布的 `loop-agent` 子进程。
74
+ - **允许依赖**:TaskSpec、Task Pool、observability、Node filesystem/path 与明确的 shared/task contract;它不是第二套 executor 或 DAG kernel。
75
+ - **禁止**:in-process import `src/cli/**`、`src/commands/**` 或 `src/application/**`。
76
+
66
77
  ### Infrastructure / Store
67
78
 
68
79
  - **位置**:`src/infrastructure/harness/**`(按计划逐步引入);过渡期部分逻辑仍在 `src/workflows/dag/lifecycle.ts`、`src/records/**`。
@@ -89,6 +100,9 @@ Workflow runtime ──X──> Commands (目标态禁止;见
89
100
  Executors ──────────> Shared / 外部 SDK
90
101
  Executors ──X──> Commands / CLI
91
102
 
103
+ Worker adapter ──────────> TaskSpec / Task Pool / observability / 子进程 CLI contract
104
+ Worker adapter ──X──> Commands / CLI / Application(in-process)
105
+
92
106
  Application ──────────> Workflows / Infrastructure / Task / Records
93
107
  Application ──X──> CLI formatting
94
108
 
@@ -103,14 +117,15 @@ Runner / Loop ──(迁移中)──> 逐步改为仅经 Store / Appli
103
117
  | `src/commands/**` | application, workflows, infrastructure, task, records, executors, shared | — |
104
118
  | `src/workflows/**` | executors, task, records, shared, application(目标) | `src/commands/**` |
105
119
  | `src/executors/**` | shared, 外部 SDK | `src/commands/**`, `src/cli/**` |
120
+ | `src/worker/**` | worker-local modules, task contracts, shared, Node APIs | `src/commands/**`, `src/cli/**`, `src/application/**` |
106
121
  | `src/cli/**` | commands, adapters, shared, application(目标) | — |
107
122
  | `skills/**` | (Markdown 引用,非 TS import) | 运行时 TS 模块 |
108
123
 
109
124
  ## 已知过渡耦合
110
125
 
111
- 当前没有允许的 `src/workflows/**` `src/executors/**` → `src/commands/**` TypeScript import。
126
+ 当前没有允许的 `src/workflows/**` / `src/executors/**` forbidden import,也没有允许的 `src/worker/**` → `src/{cli,commands,application}/**` TypeScript import。
112
127
 
113
- `scripts/check-architecture-boundaries.sh` 的 transitional allowlist 保持为空。任何新增的 `workflows/executors -> commands` import 必须导致检查 **exit 1**;如果未来确有临时例外,必须先写入 active exec plan,说明移除时间和验证门禁。
128
+ `scripts/check-architecture-boundaries.sh` 的 transitional allowlist 保持为空。任何新增的 `workflows/executors/worker` forbidden import 必须导致检查 **exit 1**;如果未来确有临时例外,必须先写入 active exec plan,说明移除时间和验证门禁。
114
129
 
115
130
  ## Governance 钩子
116
131
 
@@ -118,7 +133,7 @@ Runner / Loop ──(迁移中)──> 逐步改为仅经 Store / Appli
118
133
 
119
134
  | Script | 检查内容 | 失败条件 |
120
135
  |--------|----------|----------|
121
- | `scripts/check-architecture-boundaries.sh` | `workflows` / `executors``commands` import | 新的未 allowlist violation |
136
+ | `scripts/check-architecture-boundaries.sh` | workflow/executor forbidden import,及 Worker CLI/commands/application import | 新的未 allowlist violation |
122
137
  | `scripts/check-command-registry-drift.sh` | `command-reference.md` 中的 top-level command vs `src/cli/catalog.ts` | 文档引用未注册 command |
123
138
  | `scripts/check-skill-entry.sh` | `SKILL.md` reference 文件存在、行数阈值 | reference 缺失(fail);行数 > 220(warn) |
124
139
 
@@ -13,17 +13,29 @@
13
13
  | `六个月规划.md` | 六个月路线图与目标架构 |
14
14
  | `taskspec-to-loop-agent-mapping.md` | 将产品线 TaskSpec 适配为 `loop-agent` task 的契约 |
15
15
  | `state-and-failure-taxonomy.md` | 文档、Task Pool、DAG、Loop 共用的 canonical status 与 failure taxonomy |
16
+ | `observe-ui.md` | 已实现的 agent-worker 本地只读可观测 UI(事件流 / SSE / stale 诊断)设计、事件契约与验收边界 |
17
+ | `observe-ui-optimization.md` | 2026-07-10:**已实现** Observe UI 中文化、DAG-first 总览、进行中 DAG 置顶、read-model enrichment、Pi `session-events.jsonl` 落盘与过程时间线(UI-1~UI-9) |
18
+ | `archive/2026-07-10-下一阶段任务-功能开发完成.md` | 已归档:真实样本、失败硬化与 QA 闭环的功能性开发完成记录 |
16
19
 
17
- ## 当前实现边界
20
+ ## 命名约定(2026-07-09 起)
18
21
 
19
- `loop-agent` 当前拥有:仓库本地 harness、Agent DAG 生成/验证/执行、shell 验证、artifacts、reports、Loop state。它不是产品线 Task Pool、Orchestrator、docs-sync 服务、Git/CI 平台或 artifact store。
22
+ | 名称 | 含义 | 状态 |
23
+ |---|---|---|
24
+ | `loop-agent` | 仓库本地 runtime / 治理控制器 CLI | 已发布 |
25
+ | `agent-worker` | 产品线 TaskSpec 批处理适配层 CLI(`bin/agent-worker.js`) | 已发布(0.5.0) |
26
+ | `agent-platform` | 早期规划设想名;**不是**当前 CLI。若出现在六个月目标架构中,仅表示未来产品线 monorepo / 上层服务集合,不得写成可执行命令 |
20
27
 
21
- 设计文档使用两类 profile 名称:
28
+ 当前真实分层:
22
29
 
23
- - **Business task profiles**:`backend-feature`、`frontend-feature`、`qa-casegen`、`qa-testcode`、`reviewer-gate`
24
- - **`loop-agent dag run-task --profile` governance profiles**:`auto`、`minimal`、`standard`、`reviewed`、`supervised`
30
+ ```text
31
+ 产品线 docs / TaskSpec / TaskGraph
32
+ → agent-worker(本地批处理适配)
33
+ → loop-agent(runtime kernel)
34
+ → Cursor / Pi / shell / static
35
+ ```
36
+
37
+ 命令示例一律使用 `agent-worker`,不要再写 `agent-platform task ...`。
25
38
 
26
- 除非 CLI 显式扩展支持,否则不要把 business task profile 直接传给 `loop-agent dag run-task --profile`。用 `taskspec-to-loop-agent-mapping.md` 将 business profile 路由到当前 governance profile。
27
39
 
28
40
  ## 维护规则
29
41
 
@@ -31,6 +43,7 @@
31
43
 
32
44
  1. 保持 TaskSpec 字段、status 名称、failure category 与命令示例与契约文档一致
33
45
  2. 未来平台组件标为目标架构,除非已存在于 `src/` 或 `scripts/`
34
- 3. `src/task/config-types.ts` DAG profile routing 变更时更新 `taskspec-to-loop-agent-mapping.md`
35
- 4. DAG report category、Loop failure class Task Pool state 变更时更新 `state-and-failure-taxonomy.md`
36
- 5. 运行 `bash scripts/check-repo.sh`
46
+ 3. 当前 CLI 命令示例只用 `agent-worker` / `loop-agent`;`agent-platform` 仅可出现在“未来 monorepo/上层服务”语境,并显式标注未实现
47
+ 4. `src/task/config-types.ts`DAG profile routing 变更时更新 `taskspec-to-loop-agent-mapping.md`
48
+ 5. DAG report category、Loop failure class 或 Task Pool state 变更时更新 `state-and-failure-taxonomy.md`
49
+ 6. 运行 `bash scripts/check-repo.sh`
@@ -4,4 +4,9 @@
4
4
 
5
5
  源码仓库可在本 README 旁保留具体 active plan 文件。npm 包只携带本 README 作为目录契约,不复制 loop-agent 源码历史的 active plan;目标仓库自行生成 active plan。
6
6
 
7
- 当前没有 active plan。`2026-07-08-taskspec-worker-master.md` 的 7 个 step 已全部完成并归档到 `../completed/`。
7
+ `2026-07-08-taskspec-worker-master.md` 的 7 个 step 已全部完成并归档到 `../completed/`。
8
+
9
+ 当前没有 active execution plan 以外的进行中项。
10
+
11
+ - active:`2026-07-10-release-0.6.0-nightly-drill.md` — 发布 0.6.0,并用已发布控制器完成第 4 周首轮夜间 batch + 次日 morning report 决策闭环。
12
+ - 已归档:`../completed/2026-07-10-next-stage-worker-evidence.md` 及更早的 TaskSpec/OBS 计划。
@@ -7,6 +7,7 @@ npm 包携带本 README 作为目录契约。具体 completed plan 属于目标
7
7
  - [`2026-07-02-loop-agent-subject-restructure.md`](2026-07-02-loop-agent-subject-restructure.md) — 将原 `tools/code-agent` runtime 提升到仓库根、重命名为 `loop-agent`,移除旧 memory plugin 产品线
8
8
  - [`2026-07-04-remove-level1-fallback.md`](2026-07-04-remove-level1-fallback.md) — 移除历史顺序 Level 1 fallback,runtime、文档与 command surface 收敛到 DAG 执行
9
9
  - [`2026-07-04-runtime-boundary-remediation.md`](2026-07-04-runtime-boundary-remediation.md) — 整合 CLI/skill/runtime 边界,抽出 DAG/Loop runtime seam,集中 harness store/guard 策略
10
+ - [`2026-07-10-next-stage-worker-evidence.md`](2026-07-10-next-stage-worker-evidence.md) — Worker retry、EnvFailure、边界治理、初始化投影与真实 BE/FE/QA dogfood evidence 闭环
10
11
  - [`2026-07-04-dag-role-skill-alignment.md`](2026-07-04-dag-role-skill-alignment.md) — 对齐 DAG/Dynamic Workflow role 与 repo-local vetted skills,新增 strict skill audit
11
12
  - [`2026-07-06-production-readiness-hardening.md`](2026-07-06-production-readiness-hardening.md) — 冻结 Production Readiness v0.1,打磨 DAG 主路径 next steps、failure routing、doctor/report/failure handoff 与 dogfood 验证
12
13
  - [`2026-07-08-taskspec-schema-validate.md`](2026-07-08-taskspec-schema-validate.md) — 新增 TaskSpec v0.1 schema、三层校验器、risk→complexity 映射和 5 个 dogfood TaskSpec 样例
@@ -17,3 +18,14 @@ npm 包携带本 README 作为目录契约。具体 completed plan 属于目标
17
18
  - [`2026-07-08-run-task-pipeline-ring2.md`](2026-07-08-run-task-pipeline-ring2.md) — 新增 Worker run-task pipeline、task-local run record、成功/失败分流与 Ring 2 shell-only DAG success/failure smoke
18
19
  - [`2026-07-08-task-pool-morning-report.md`](2026-07-08-task-pool-morning-report.md) — 新增 Worker Task Pool JSONL/state store、failure routing、串行 batch run-ready 和 morning report
19
20
  - [`2026-07-08-taskspec-worker-master.md`](2026-07-08-taskspec-worker-master.md) — 完成 TaskSpec + Worker 7 步 master 编排,覆盖 schema、graph、profile、client、materialize、run-task、Task Pool 和 morning report
21
+ - [`2026-07-10-obs-001.md`](2026-07-10-obs-001.md) — WorkerEvent schema 与 append-only event/snapshot store
22
+ - [`2026-07-10-obs-002.md`](2026-07-10-obs-002.md) — LoopAgentClient 流式输出、heartbeat 与实时 artifact
23
+ - [`2026-07-10-obs-003.md`](2026-07-10-obs-003.md) — composite progress 与 Worker pipeline 事件打点
24
+ - [`2026-07-10-obs-004.md`](2026-07-10-obs-004.md) — observability snapshot read model
25
+ - [`2026-07-10-obs-005.md`](2026-07-10-obs-005.md) — 本地只读 observe HTTP/SSE server
26
+ - [`2026-07-10-obs-006.md`](2026-07-10-obs-006.md) — Dashboard、Batch Detail 与 Run Detail UI
27
+ - [`2026-07-10-obs-007.md`](2026-07-10-obs-007.md) — run-dag JSONL events 与 composite observer
28
+ - [`2026-07-10-obs-008.md`](2026-07-10-obs-008.md) — Worker DAG events 接线与 DAG Detail UI
29
+ - [`2026-07-10-obs-009.md`](2026-07-10-obs-009.md) — stale、quiet 与 timeout-risk 诊断
30
+ - [`2026-07-10-obs-010.md`](2026-07-10-obs-010.md) — Failure Inbox、文档、package surface 与 smoke 验证
31
+ - [`2026-07-10-observe-ui-review-remediation.md`](2026-07-10-observe-ui-review-remediation.md) — 修复 Observe UI 事件链路、历史 run 投影、artifact 安全边界与失败状态展示
@@ -14,6 +14,8 @@
14
14
  "docs/skills/vetted-skill-registry.md",
15
15
  "docs/templates/init-evolution-review.md",
16
16
  "docs/templates/production-readiness-checklist.md",
17
+ "docs/templates/worker-dogfood-setup.md",
18
+ "docs/templates/worker-dogfood-evidence.md",
17
19
  "docs/templates/agent-dag.schema.json",
18
20
  "examples/example-dag.json",
19
21
  "skills/loop-agent/SKILL.md",
@@ -31,6 +33,7 @@
31
33
  "initFullRequired": [
32
34
  "README.md",
33
35
  "AGENTS.md",
36
+ ".gitignore",
34
37
  "harness.json",
35
38
  "docs/README.md",
36
39
  "docs/development-principles.md",
@@ -39,6 +42,8 @@
39
42
  "docs/loop-agent-harness.md",
40
43
  "docs/templates/init-evolution-review.md",
41
44
  "docs/templates/production-readiness-checklist.md",
45
+ "docs/templates/worker-dogfood-setup.md",
46
+ "docs/templates/worker-dogfood-evidence.md",
42
47
  "scripts/check-repo.sh",
43
48
  "scripts/ci-governance.sh",
44
49
  "scripts/ci-tests.sh",
@@ -56,11 +61,23 @@
56
61
  "skills/test-driven-development/SKILL.md",
57
62
  "skills/code-review-core/SKILL.md",
58
63
  "skills/init-capability-evolution/SKILL.md",
59
- "skills/webapp-testing/SKILL.md"
64
+ "skills/webapp-testing/SKILL.md",
65
+ ".agents/skills/loop-agent/SKILL.md",
66
+ ".agents/skills/loop-agent/references/command-reference.md",
67
+ ".agents/skills/ai-engineering-context/SKILL.md",
68
+ ".agents/skills/verification-before-completion/SKILL.md",
69
+ ".agents/skills/systematic-debugging/SKILL.md",
70
+ ".agents/skills/requesting-code-review/SKILL.md",
71
+ ".agents/skills/codebase-scout/SKILL.md",
72
+ ".agents/skills/test-driven-development/SKILL.md",
73
+ ".agents/skills/code-review-core/SKILL.md",
74
+ ".agents/skills/init-capability-evolution/SKILL.md",
75
+ ".agents/skills/webapp-testing/SKILL.md"
60
76
  ],
61
77
  "initSurface": {
62
78
  "README.md": "managed-block",
63
79
  "AGENTS.md": "managed-block",
80
+ ".gitignore": "managed-block",
64
81
  "harness.json": "generated",
65
82
  "docs/README.md": "generated",
66
83
  "docs/development-principles.md": "generated",
@@ -69,6 +86,8 @@
69
86
  "docs/loop-agent-harness.md": "generated",
70
87
  "docs/templates/init-evolution-review.md": "copied",
71
88
  "docs/templates/production-readiness-checklist.md": "copied",
89
+ "docs/templates/worker-dogfood-setup.md": "copied",
90
+ "docs/templates/worker-dogfood-evidence.md": "copied",
72
91
  "scripts/check-repo.sh": "generated",
73
92
  "scripts/ci-governance.sh": "generated",
74
93
  "scripts/ci-tests.sh": "generated",
@@ -87,7 +106,18 @@
87
106
  "skills/test-driven-development/SKILL.md": "copied",
88
107
  "skills/code-review-core/SKILL.md": "copied",
89
108
  "skills/init-capability-evolution/SKILL.md": "copied",
90
- "skills/webapp-testing/SKILL.md": "copied"
109
+ "skills/webapp-testing/SKILL.md": "copied",
110
+ ".agents/skills/loop-agent/SKILL.md": "copied",
111
+ ".agents/skills/loop-agent/references/command-reference.md": "copied",
112
+ ".agents/skills/ai-engineering-context/SKILL.md": "copied",
113
+ ".agents/skills/verification-before-completion/SKILL.md": "copied",
114
+ ".agents/skills/systematic-debugging/SKILL.md": "copied",
115
+ ".agents/skills/requesting-code-review/SKILL.md": "copied",
116
+ ".agents/skills/codebase-scout/SKILL.md": "copied",
117
+ ".agents/skills/test-driven-development/SKILL.md": "copied",
118
+ ".agents/skills/code-review-core/SKILL.md": "copied",
119
+ ".agents/skills/init-capability-evolution/SKILL.md": "copied",
120
+ ".agents/skills/webapp-testing/SKILL.md": "copied"
91
121
  },
92
122
  "packageExcluded": [
93
123
  "docs/progress/20*.md",
@@ -9,6 +9,7 @@ loop-agent 提供结构化 agent 工作的本地 harness。
9
9
  - `.harness/runs/` — one-shot tool run 证据
10
10
  - `.harness/cache/` — 本地 runtime 缓存
11
11
  - `.harness/live/` — 瞬态 live-session 文件
12
+ - `.task-pool/` — `agent-worker` 的 Task Pool state、batch artifacts、failure handoffs 与 Observe events;它与 `.harness/` 分离,默认不提交
12
13
 
13
14
  ## Skill 指令
14
15
 
@@ -32,6 +33,18 @@ npm 包包含运行与说明 harness 所需的静态能力资产:`bin/`、`dis
32
33
  - `loop init`、`loop run`、`loop status`、`loop closeout`
33
34
  - `pi-prompt`、`cursor-prompt`
34
35
  - `docs audit`、`handoff check`、`spine audit`、`knowledge curate`
36
+ - `agent-worker task validate|explain-profile|retry`、`agent-worker batch run-ready`、`agent-worker report morning`、`agent-worker observe serve|snapshot`
37
+
38
+ ## Worker Retry
39
+
40
+ 失败 Task Pool task 必须显式 retry,不能删除旧 `.task-pool/runs/runs.jsonl` 或复用失败的 `workerRunId`:
41
+
42
+ ```bash
43
+ agent-worker task retry <task-id> --repo <target-repo> --reason "provider configuration corrected"
44
+ agent-worker batch run-ready --feature-dir <feature-dir> --repo <target-repo>
45
+ ```
46
+
47
+ `task retry` 只接受 `Failed` state,保留旧 run 和 failure handoff,并写入 `retryOfWorkerRunId`。下一次 `run-ready` 生成新的 `workerRunId`;`Blocked`、`Done` 或无 state 的 task 必须先由 operator 处理根因,不能盲目重试。
35
48
 
36
49
  ## 验证 Preset
37
50
 
@@ -3,3 +3,7 @@
3
3
  本目录存放验证、审计、benchmark 与 closeout 报告。
4
4
 
5
5
  - [`2026-07-12-production-readiness-hardening.md`](2026-07-12-production-readiness-hardening.md)
6
+ - [`2026-07-10-next-stage-dogfood-runs.md`](2026-07-10-next-stage-dogfood-runs.md) — 发布控制器下的 BE/FE/QA Worker 样本、retry 与 Observe 证据
7
+ - [`2026-07-10-init-evolution-review.md`](2026-07-10-init-evolution-review.md) — Worker 初始化投影演进审查
8
+ - [`2026-07-10-session-events-dogfood.md`](2026-07-10-session-events-dogfood.md) — Pi SDK DAG 新 run 产生非空 `session-events.jsonl` 与 Observe 过程时间线 API 证据
9
+ - [`2026-07-02-repository-analysis.md`](2026-07-02-repository-analysis.md) — 仓库能力基线分析(2026-07-10 再采样:0.5.0 + Observe UI 优化 UI-1~UI-9 / Unreleased)
@@ -60,7 +60,7 @@
60
60
  "cursor": {
61
61
  "LOW": "composer-2.5",
62
62
  "MED": "composer-2.5",
63
- "HIGH": "composer-2.5"
63
+ "HIGH": "gpt-5.5"
64
64
  },
65
65
  "pi": {
66
66
  "LOW": "gpt-5.3-codex-spark",
@@ -28,7 +28,7 @@
28
28
  "cursor": {
29
29
  "LOW": "composer-2.5",
30
30
  "MED": "composer-2.5",
31
- "HIGH": "composer-2.5"
31
+ "HIGH": "gpt-5.5"
32
32
  },
33
33
  "pi": {
34
34
  "LOW": "gpt-5.3-codex-spark",
@@ -76,7 +76,7 @@
76
76
  "cursor": {
77
77
  "LOW": "composer-2.5",
78
78
  "MED": "composer-2.5",
79
- "HIGH": "composer-2.5"
79
+ "HIGH": "gpt-5.5"
80
80
  },
81
81
  "pi": {
82
82
  "LOW": "gpt-5.3-codex-spark",
@@ -56,7 +56,7 @@
56
56
  "cursor": {
57
57
  "LOW": "composer-2.5",
58
58
  "MED": "composer-2.5",
59
- "HIGH": "composer-2.5"
59
+ "HIGH": "gpt-5.5"
60
60
  },
61
61
  "pi": {
62
62
  "LOW": "gpt-5.3-codex-spark",
@@ -0,0 +1,52 @@
1
+ # Worker Dogfood Evidence
2
+
3
+ ## Sample identity
4
+
5
+ | Field | Value |
6
+ |---|---|
7
+ | Date | |
8
+ | Feature / Task | |
9
+ | Target repo | disposable path or sanitized reference |
10
+ | Controller package/version | |
11
+ | Agent-worker package/version (same npm install) | |
12
+ | Provider/model / override | |
13
+ | Batch ID | |
14
+ | Worker run ID | |
15
+ | Retry of worker run ID | n/a / |
16
+
17
+ ## Baseline
18
+
19
+ - Baseline commit and `git status`:
20
+ - Existing failing behavior or missing capability:
21
+ - Preflight (`loop-agent --version`, `inspect`, `docs audit`, `check-repo`):
22
+
23
+ ## Run evidence
24
+
25
+ | Artifact | Path / link | Result |
26
+ |---|---|---|
27
+ | TaskSpec / source-doc copies | | |
28
+ | DAG spec | | |
29
+ | DAG report JSON / Markdown | | |
30
+ | shell verification | | |
31
+ | diff | | |
32
+ | closeout or Failure Handoff | | |
33
+ | morning report | | |
34
+ | Observe snapshot / events | | |
35
+
36
+ ## Acceptance and QA coverage
37
+
38
+ | Acceptance | Test case(s) | Test file / verification | Result |
39
+ |---|---|---|---|
40
+ | | | | |
41
+
42
+ ## Failure / retry (if applicable)
43
+
44
+ | Raw failure | Product-line category | Recommended follow-up | Root cause evidence | Retry result |
45
+ |---|---|---|---|---|
46
+ | | | | | |
47
+
48
+ ## Conclusion
49
+
50
+ - Verdict: pass / fail / blocked
51
+ - Review notes:
52
+ - Follow-up task(s):
@@ -0,0 +1,48 @@
1
+ # Worker Dogfood Setup Template
2
+
3
+ Use this template to create a disposable target repository for a real `agent-worker` sample. It is deliberately a target-repo recipe, not a substitute for product requirements.
4
+
5
+ ## Preconditions
6
+
7
+ - Install one published controller version and record it:
8
+
9
+ ```bash
10
+ npm install -g @tea-agent/loop-agent@<version>
11
+ npm list -g @tea-agent/loop-agent --depth=0
12
+ loop-agent --version
13
+ agent-worker --help
14
+ ```
15
+
16
+ - Create a clean, disposable target repository. Do not use `npm link`, `npm run dev`, or a workspace controller for a real-evidence run.
17
+ - 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
+
19
+ ## Setup checklist
20
+
21
+ - [ ] Target has a committed baseline and a passing `loop-agent init --profile full --merge` preflight.
22
+ - [ ] Existing test demonstrates the desired behavior is missing or unimplemented.
23
+ - [ ] TaskSpec has narrow `allowed_paths` and explicit `forbidden_paths`.
24
+ - [ ] Task Pool dependencies are either backed by real prior runs or intentionally recorded as pre-existing evidence.
25
+ - [ ] The chosen model/provider and `--pi-model` smoke override, if any, are recorded.
26
+
27
+ ## Execute
28
+
29
+ ```bash
30
+ agent-worker batch run-ready \
31
+ --feature-dir <feature-dir> \
32
+ --repo <target-repo> \
33
+ --limit 1 \
34
+ --check-repo \
35
+ [--pi-model <model>]
36
+
37
+ agent-worker observe snapshot --repo <target-repo> > <evidence-dir>/observe-snapshot.json
38
+ agent-worker report morning --repo <target-repo> --output <evidence-dir>/morning-report.md
39
+ ```
40
+
41
+ For a failed task, do not delete state or alter JSONL evidence. Fix the external/root cause, then make the retry explicit:
42
+
43
+ ```bash
44
+ agent-worker task retry <task-id> --repo <target-repo> --reason "<root cause corrected>"
45
+ agent-worker batch run-ready --feature-dir <feature-dir> --repo <target-repo> --limit 1 --check-repo
46
+ ```
47
+
48
+ The retry run must have a distinct `workerRunId` and retain `retryOfWorkerRunId` in its Task Pool evidence.
@@ -5,7 +5,7 @@
5
5
  "cursor": {
6
6
  "LOW": "composer-2.5",
7
7
  "MED": "composer-2.5",
8
- "HIGH": "composer-2.5"
8
+ "HIGH": "gpt-5.5"
9
9
  },
10
10
  "pi": {
11
11
  "LOW": "gpt-5.3-codex-spark",
@@ -57,7 +57,7 @@
57
57
  "cursor": {
58
58
  "LOW": "composer-2.5",
59
59
  "MED": "composer-2.5",
60
- "HIGH": "composer-2.5"
60
+ "HIGH": "gpt-5.5"
61
61
  },
62
62
  "pi": {
63
63
  "LOW": "gpt-5.3-codex-spark",
package/harness.json CHANGED
@@ -39,7 +39,8 @@
39
39
  "execPlansDir": "docs/exec-plans",
40
40
  "progressDir": "docs/progress",
41
41
  "reportsDir": "docs/reports",
42
- "decisionsDir": "docs/decisions"
42
+ "decisionsDir": "docs/decisions",
43
+ "taskPoolDir": ".task-pool"
43
44
  },
44
45
  "scripts": {
45
46
  "checkRepo": "scripts/check-repo.sh",
@@ -51,38 +52,13 @@
51
52
  "checkInitSurface": "scripts/check-init-surface.sh",
52
53
  "ci": "scripts/ci.sh"
53
54
  },
54
- "models": {
55
- "analyze": {
56
- "provider": "wizard-local",
57
- "model": "gpt-5.3-codex-spark",
58
- "timeoutMs": 1800000
59
- },
60
- "plan": {
61
- "provider": "wizard-local",
62
- "model": "gpt-5.3-codex-spark",
63
- "timeoutMs": 1800000
64
- },
65
- "implement": {
66
- "provider": "wizard-local",
67
- "model": "gpt-5.3-codex-spark",
68
- "timeoutMs": 1800000
69
- },
70
- "verify": {
71
- "provider": "wizard-local",
72
- "model": "gpt-5.3-codex-spark",
73
- "timeoutMs": 1800000
74
- },
75
- "retrospective": {
76
- "provider": "wizard-local",
77
- "model": "gpt-5.3-codex-spark",
78
- "timeoutMs": 1800000
79
- }
80
- },
81
55
  "executors": {
82
56
  "pi": {
83
57
  "description": "Pi planning, review, diagnosis, and bounded writing when DAG toolProfile=write",
84
58
  "defaultModel": "gpt-5.3-codex-spark",
85
- "requiresApiKey": ""
59
+ "LOW": "gpt-5.3-codex-spark",
60
+ "MED": "glm-5.2",
61
+ "HIGH": "gpt-5.5"
86
62
  },
87
63
  "cursor": {
88
64
  "description": "Cursor via @cursor/sdk (default model: account default)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tea-agent/loop-agent",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "loop-agent": "bin/loop-agent.js",
@@ -36,7 +36,7 @@
36
36
  "cursor": "node --import tsx/esm src/cli.ts cursor-prompt",
37
37
  "pi-prompt": "node --import tsx/esm src/cli.ts pi-prompt",
38
38
  "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
39
- "build": "npm run clean && tsc -p tsconfig.build.json",
39
+ "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});\"",
40
40
  "prepack": "npm run build",
41
41
  "prepublishOnly": "npm run typecheck && npm test && npm run build",
42
42
  "lint": "tsc --noEmit",
@@ -54,13 +54,13 @@
54
54
  },
55
55
  "optionalDependencies": {
56
56
  "@cursor/sdk": "^1.0.7",
57
- "@earendil-works/pi-coding-agent": "*",
58
- "@earendil-works/pi-ai": "*"
57
+ "@earendil-works/pi-ai": "*",
58
+ "@earendil-works/pi-coding-agent": "*"
59
59
  },
60
60
  "devDependencies": {
61
+ "@types/node": "^24.6.0",
61
62
  "tsx": "^4.20.6",
62
63
  "typescript": "^5.9.3",
63
- "vitest": "^3.2.4",
64
- "@types/node": "^24.6.0"
64
+ "vitest": "^3.2.4"
65
65
  }
66
66
  }
@@ -35,7 +35,9 @@ Shared loop-agent harness workflow 规则见 `references/harness-policy.md`。Re
35
35
 
36
36
  ```bash
37
37
  loop-agent new-task <task-id> "Task Title"
38
- # write <repo-root>/.harness/tasks/<task-id>/source/需求.md
38
+ # Prefer immutable original PRD first:
39
+ # loop-agent import-prd <task-id> --file <path-to-original-prd.md>
40
+ # write derived <repo-root>/.harness/tasks/<task-id>/source/需求.md
39
41
  # write <repo-root>/.harness/tasks/<task-id>/source/执行约束.md
40
42
 
41
43
  loop-agent dag run-task <task-id> --profile auto --strict-models --output <temp-dir>/<task-id>-dag.json
@@ -116,8 +118,8 @@ bounded writer 完成后,主会话必须独立复核;命令清单见 `refere
116
118
  ## Hard Rules
117
119
 
118
120
  1. One task = one bounded work chunk.
119
- 2. Source materials are mandatory: `source/需求.md` and `source/执行约束.md`.
120
- 3. Agent DAG is the implementation workflow.
121
+ 2. Source materials are mandatory: `source/需求.md` and `source/执行约束.md`. Prefer immutable originals under `source/references/` via `import-prd` or Worker `source_docs`; treat `需求.md` as a derived contract.
122
+ 3. Agent DAG is the implementation workflow. Review must three-way check references + derived source + implementation when originals exist.
121
123
  4. DAG `pi` executor stays read-only unless the node sets `toolProfile: "write"`; `pi-prompt` / `cursor-prompt` are full-capability one-shot helpers and must be bounded per call.
122
124
  5. Pi writer nodes and optional Cursor write execution must be bounded by explicit allowed / forbidden paths.
123
125
  6. Completed DAG and one-shot run facts are read-only.
@@ -114,6 +114,13 @@ loop-agent new-task <task-id> "Task Title"
114
114
 
115
115
  创建 `.harness/tasks/<task-id>/`,含 `source/`、`artifacts/`、`logs/` 及初始 state。
116
116
 
117
+ ### 导入原始 PRD(不可变事实源)
118
+ ```bash
119
+ loop-agent import-prd <task-id> --file docs/path/to-prd.md [--name requirement] [--json]
120
+ ```
121
+
122
+ 把用户原始 PRD **原样复制** 到 `.harness/tasks/<task-id>/source/references/`,并写入 `source/source-manifest.json`(含 SHA-256)与 `task.json.referenceDocs`。此步骤不调用模型、不改写内容。随后再写派生的 `source/需求.md` 执行契约;冲突时以 `source/references/*` 为准。
123
+
117
124
  ### Task action context / artifact instructions
118
125
  ```bash
119
126
  loop-agent status <task-id> --json
@@ -137,12 +144,14 @@ loop-agent closeout task <task-id>
137
144
  one-shot run evidence 位于 `.harness/runs/{active,completed,failed}/<run-id>/`。`cursor-prompt` 与 Pi `cursor` tool 会创建这类 run evidence;当前 `pi-prompt` 不创建 `.harness/runs/`。active 目录只应保留 live one-shot run,残留或 `.DS_Store` 等系统文件应清理。详见 `one-shot-runs.md`。
138
145
 
139
146
  ### 运行任何 step 前:准备 source materials
140
- `new-task` 之后,至少添加 `需求.md`:
147
+ `new-task` 之后,先归档原始 PRD,再写派生执行契约:
141
148
  ```bash
149
+ loop-agent import-prd <task-id> --file <path-to-original-prd.md>
150
+ # then write derived contract:
142
151
  mkdir -p <repo-root>/.harness/tasks/<task-id>/source
143
152
  cat > <repo-root>/.harness/tasks/<task-id>/source/需求.md
144
153
  ```
145
- 然后写明需求、目标范围与约束。
154
+ `需求.md` 写目标、范围、非目标与验收标准,并映射回 `source/references/*`;不要让 AI 直接改写原始 PRD。
146
155
 
147
156
  若 task 有硬约束(仅允许特定文件、禁止改动),另加:
148
157
  ```bash
@@ -370,7 +379,7 @@ agent-worker report morning --repo <repo-root> [--batch-run-id <id>] [--output <
370
379
 
371
380
  - TaskSpec 声明单个任务的业务上下文、`risk_level`、验收与 verify 边界;`risk_level` 被确定性映射到 task complexity。AcceptanceSpec / TaskGraphSpec 声明跨任务验收引用与依赖图,ready queue 决定可运行任务并检测未知依赖/环/文件一致性。
372
381
  - 业务 type(`backend-feature`/`frontend-feature`/`qa-testcode` 等)是产品线 profile,不能直接传给 `loop-agent dag run-task --profile`;Worker 会映射到 `auto`/`minimal`/`standard`/`reviewed`/`supervised`。
373
- - materializer 把 TaskSpec 物化为 `.harness/tasks/<task-id>` 后,Worker 调用 `dag run-task` / `dag validate` / `run-dag` / `dag report`。成功路径走 `promote-run` + `closeout task`;失败路径收集 `dag doctor` / `dag closeout-draft` evidence,写入目标 repo 的 `.task-pool/failure-handoffs/`(不写 `.harness/`,因为 `dag closeout-draft` 会拒绝在 completed facts 之外写入)。
382
+ - materializer 把 TaskSpec 物化为 `.harness/tasks/<task-id>`:`source_docs` 原样进入 `source/references/`,派生 `需求.md` 带权威声明、Source Docs/hash 追溯,以及 `acceptance_refs` 短摘要;随后 Worker 调用 `dag run-task` / `dag validate` / `run-dag` / `dag report`。review 节点须对照 references + 派生契约 + 实现。成功路径走 `promote-run` + `closeout task`;失败路径收集 `dag doctor` / `dag closeout-draft` evidence,写入目标 repo 的 `.task-pool/failure-handoffs/`(不写 `.harness/`,因为 `dag closeout-draft` 会拒绝在 completed facts 之外写入)。
374
383
  - Worker runtime state 落在目标 repo 的 `.task-pool/`(artifacts、JSONL/state、晨报、failure handoffs),与 `.harness/` 分离;`.task-pool/` 默认被 `.gitignore` 忽略。
375
384
  - preflight 在 `new-task` 前跑 `loop-agent --version`、`inspect`、`docs-audit`、`git status --short --branch`,可选 `--check-repo`。一次夜间批处理期间不升级控制器,记录实际 `loop-agent` 版本。
376
385
  - `batch run-ready` 默认在 stderr 输出人类可读进度(批次起止、每个 task 的阶段与耗时、report 决策),stdout 只保留最终 JSON,便于管道取用;加 `--quiet` 可关闭进度。