@tea-agent/loop-agent 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +157 -157
- package/CHANGELOG.md +116 -305
- package/README.md +357 -334
- package/bin/agent-worker.js +22 -22
- package/bin/loop-agent.js +21 -21
- package/dist/commands/cursor-prompt.js +6 -6
- package/dist/commands/init.js +505 -505
- package/dist/commands/loop-benchmark.js +11 -11
- package/dist/commands/pi-reuse-benchmark.js +16 -16
- package/dist/executors/pi-event-serializer.js +33 -11
- package/dist/sidecars/cursor-prompt/executor.js +1 -1
- package/dist/task/runtime.js +27 -27
- package/dist/worker/observe/spec-evidence.js +19 -10
- package/dist/worker/observe/static/api.js +46 -46
- package/dist/worker/observe/static/app.js +151 -150
- package/dist/worker/observe/static/constants.js +156 -148
- package/dist/worker/observe/static/copy.js +67 -67
- package/dist/worker/observe/static/dag-helpers.js +201 -172
- package/dist/worker/observe/static/dag-layout.d.ts +31 -31
- package/dist/worker/observe/static/dag-layout.js +83 -83
- package/dist/worker/observe/static/dag-model.js +72 -72
- package/dist/worker/observe/static/dom.js +122 -122
- package/dist/worker/observe/static/format-pool.d.ts +71 -0
- package/dist/worker/observe/static/format-pool.js +134 -67
- package/dist/worker/observe/static/format.js +317 -292
- package/dist/worker/observe/static/index.html +350 -308
- package/dist/worker/observe/static/kpi.js +100 -94
- package/dist/worker/observe/static/markdown-render.js +124 -0
- package/dist/worker/observe/static/relations.js +133 -133
- package/dist/worker/observe/static/router.js +93 -93
- package/dist/worker/observe/static/run-processing.js +148 -148
- package/dist/worker/observe/static/shell-chrome.js +74 -68
- package/dist/worker/observe/static/state.js +273 -267
- package/dist/worker/observe/static/styles.css +2504 -1902
- package/dist/worker/observe/static/views/batch.js +227 -227
- package/dist/worker/observe/static/views/dag-graph.js +172 -172
- package/dist/worker/observe/static/views/dag-inspector.js +530 -627
- package/dist/worker/observe/static/views/dag.js +371 -371
- package/dist/worker/observe/static/views/dashboard.js +86 -100
- package/dist/worker/observe/static/views/failures.js +143 -143
- package/dist/worker/observe/static/views/feature.js +492 -492
- package/dist/worker/observe/static/views/pool.js +708 -350
- package/dist/worker/observe/static/views/run.js +453 -453
- package/dist/worker/observe/static/views/session-timeline.js +771 -219
- package/dist/worker/observe/static/views/shell.js +7 -7
- package/dist/worker/observe/static/views/task.js +314 -314
- package/dist/worker/observe/static/views/timeline.js +163 -163
- package/dist/workflows/dag/canvas-observer.js +275 -275
- package/dist/workflows/dag/init-hybrid.js +27 -11
- package/docs/README.md +106 -104
- package/docs/architecture/README.md +26 -26
- package/docs/architecture/dag-execution.md +140 -140
- package/docs/architecture/evolution.md +54 -54
- package/docs/architecture/facts-and-state.md +71 -71
- package/docs/architecture/runtime-boundaries.md +191 -191
- package/docs/architecture/system-overview.md +93 -93
- package/docs/architecture/worker-and-feature.md +85 -85
- package/docs/harness-methodology-debugging.md +153 -153
- package/docs/harness-methodology-tdd.md +130 -130
- package/docs/harness-methodology-verification.md +27 -27
- package/docs/init-surface.manifest.json +304 -307
- package/docs/skills/README.md +7 -7
- package/docs/skills/vetted-skill-registry.md +29 -29
- package/docs/templates/adr.md +60 -60
- package/docs/templates/agent-dag-authority-surface-audit.prompt.md +94 -94
- package/docs/templates/agent-dag-decision-envelope.schema.json +213 -213
- package/docs/templates/agent-dag-decision-gate-dogfood-report.md +117 -117
- package/docs/templates/agent-dag-decision-gate.prompt.md +246 -246
- package/docs/templates/agent-dag-process-supervisor.prompt.md +98 -98
- package/docs/templates/agent-dag-report.schema.json +473 -473
- package/docs/templates/agent-dag-review-verdict.prompt.md +68 -68
- package/docs/templates/agent-dag.base.json +190 -190
- package/docs/templates/agent-dag.final-verification.json +185 -185
- package/docs/templates/agent-dag.schema.json +411 -411
- package/docs/templates/agent-dag.supervised-implementation.json +620 -620
- package/docs/templates/backend-test-analysis.schema.json +44 -44
- package/docs/templates/backend-test-case-manifest.schema.json +190 -190
- package/docs/templates/backend-test-dag.classify.prompt.md +75 -75
- package/docs/templates/backend-test-dag.generate-pytest.prompt.md +204 -204
- package/docs/templates/backend-test-dag.json +559 -559
- package/docs/templates/backend-test-dag.retrospect.prompt.md +139 -139
- package/docs/templates/backend-test-dag.review-cases.prompt.md +83 -83
- package/docs/templates/backend-test-execution.schema.json +133 -133
- package/docs/templates/backend-test-result.schema.json +99 -99
- package/docs/templates/branch-merge-report.md +0 -1
- package/docs/templates/exec-plan.md +64 -64
- package/docs/templates/feature-spec.md +53 -53
- package/docs/templates/frontend-design-contract.md +42 -42
- package/docs/templates/frontend-eval/fixtures/failures/01-type-build-error.md +17 -17
- package/docs/templates/frontend-eval/fixtures/failures/02-unit-component-test-fail.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/03-fixture-schema-drift.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/04-missing-loading-empty-error-state.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/05-forbidden-write-writeset-expansion.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/06-unapproved-dependency-add.md +16 -16
- package/docs/templates/frontend-eval/fixtures/failures/07-mock-production-on.md +21 -21
- package/docs/templates/frontend-eval/fixtures/functional/01-simple-component-style.md +29 -29
- package/docs/templates/frontend-eval/fixtures/functional/02-form-validation.md +28 -28
- package/docs/templates/frontend-eval/fixtures/functional/03-list-detail-page.md +28 -28
- package/docs/templates/frontend-eval/fixtures/functional/04-api-mock.md +29 -29
- package/docs/templates/frontend-eval/fixtures/functional/05-permission-auth-gated-ui.md +27 -27
- package/docs/templates/frontend-eval/fixtures/functional/06-ssr-server-client-boundary.md +28 -28
- package/docs/templates/frontend-eval/fixtures/functional/07-shared-public-component-api.md +28 -28
- package/docs/templates/frontend-eval/fixtures/functional/08-pure-local-no-remote.md +27 -27
- package/docs/templates/frontend-eval/metrics.md +138 -138
- package/docs/templates/frontend-eval/smoke-targets.md +53 -53
- package/docs/templates/frontend-implementation-contract.schema.json +27 -27
- package/docs/templates/frontend-task-constraints.md +35 -35
- package/docs/templates/frontend-task-requirement.md +70 -70
- package/docs/templates/frontend-test-dag.generate-cases.prompt.md +5 -5
- package/docs/templates/frontend-test-dag.json +23 -23
- package/docs/templates/frontend-test-dag.retrieve-context.prompt.md +3 -3
- package/docs/templates/frontend-test-dag.retrospect.prompt.md +3 -3
- package/docs/templates/frontend-test-dag.review-cases.prompt.md +3 -3
- package/docs/templates/frontend-test-dag.review-execution.prompt.md +3 -3
- package/docs/templates/harness.schema.json +221 -221
- package/docs/templates/hybrid-dag.json +188 -188
- package/docs/templates/init-evolution-review.md +35 -35
- package/docs/templates/interactive-ui-round2-experiment.md +66 -66
- package/docs/templates/knowledge-graph-bootstrap-dag.json +118 -118
- package/docs/templates/knowledge-sync-dag.json +178 -178
- package/docs/templates/knowledge-sync-draft.schema.json +71 -71
- package/docs/templates/product-line/AGENTS.md +8 -8
- package/docs/templates/product-line/README.md +9 -9
- package/docs/templates/product-line/acceptance.yaml +14 -14
- package/docs/templates/product-line/closeout.yaml +9 -9
- package/docs/templates/product-line/design.md +13 -13
- package/docs/templates/product-line/links.md +10 -10
- package/docs/templates/product-line/requirement.md +17 -17
- package/docs/templates/product-line/task-graph.yaml +15 -15
- package/docs/templates/product-line/task.yaml +64 -64
- package/docs/templates/product-line/test-plan.md +7 -7
- package/docs/templates/production-readiness-checklist.md +57 -57
- package/docs/templates/progress-log.md +17 -17
- package/docs/templates/project-start-checklist.md +9 -9
- package/docs/templates/qa-report.md +48 -48
- package/docs/templates/sprint-contract.md +29 -29
- package/docs/templates/worker-dogfood-evidence.md +80 -80
- package/docs/templates/worker-dogfood-setup.md +68 -68
- package/examples/decision-gate-agent-dag.json +173 -173
- package/examples/example-dag.json +46 -46
- package/examples/hybrid-loop-agent-dag.json +188 -188
- package/harness.json +66 -66
- package/package.json +78 -52
- package/scripts/kb-bootstrap-init-skeleton.sh +240 -240
- package/scripts/kb-graph-incremental-prepare.mjs +386 -386
- package/scripts/kb-graph-materialize.mjs +105 -105
- package/scripts/kb-graph-promote.mjs +164 -164
- package/scripts/kb-query.mjs +554 -554
- package/skills/agent-worker/SKILL.md +39 -39
- package/skills/agent-worker/references/agent-worker-operator.md +60 -60
- package/skills/ai-engineering-context/SKILL.md +48 -48
- package/skills/analyze-product-dependencies/SKILL.md +67 -67
- package/skills/analyze-product-dependencies/agents/openai.yaml +4 -4
- package/skills/analyze-product-dependencies/references/api-documentation-schema.md +30 -30
- package/skills/analyze-product-dependencies/references/dependency-analysis-schema.md +28 -28
- package/skills/analyze-product-dependencies/references/example.md +76 -76
- package/skills/analyze-product-dependencies/references/forward-test-cases.md +35 -35
- package/skills/analyze-product-dependencies/references/input-contract.md +11 -11
- package/skills/analyze-product-dependencies/references/scouting-rules.md +61 -61
- package/skills/analyze-product-dependencies/scripts/test-validators.mjs +267 -267
- package/skills/analyze-product-dependencies/scripts/validate-api-documentation.mjs +101 -101
- package/skills/analyze-product-dependencies/scripts/validate-dependency-analysis.mjs +142 -142
- package/skills/analyze-product-dependencies/scripts/validate-product-requirement-input.mjs +76 -76
- package/skills/analyze-product-dependencies/scripts/validation-helpers.mjs +146 -146
- package/skills/analyze-product-requirements/SKILL.md +90 -90
- package/skills/analyze-product-requirements/agents/openai.yaml +4 -4
- package/skills/analyze-product-requirements/references/acceptance-criteria.md +91 -91
- package/skills/analyze-product-requirements/references/clarification-and-knowledge.md +56 -56
- package/skills/analyze-product-requirements/references/example.md +86 -86
- package/skills/analyze-product-requirements/references/forward-test-cases.md +66 -66
- package/skills/analyze-product-requirements/references/product-analysis-schema.md +32 -32
- package/skills/analyze-product-requirements/references/product-requirement-schema.md +33 -33
- package/skills/analyze-product-requirements/references/requirement-clarification-schema.md +35 -35
- package/skills/analyze-product-requirements/scripts/test-validators.mjs +193 -193
- package/skills/analyze-product-requirements/scripts/validate-product-analysis.mjs +69 -69
- package/skills/analyze-product-requirements/scripts/validate-product-requirement.mjs +97 -97
- package/skills/analyze-product-requirements/scripts/validate-requirement-clarification.mjs +98 -98
- package/skills/analyze-product-requirements/scripts/validation-helpers.mjs +156 -156
- package/skills/browser-tools/SKILL.md +196 -196
- package/skills/browser-tools/browser-content.js +103 -103
- package/skills/browser-tools/browser-cookies.js +35 -35
- package/skills/browser-tools/browser-eval.js +53 -53
- package/skills/browser-tools/browser-hn-scraper.js +108 -108
- package/skills/browser-tools/browser-nav.js +44 -44
- package/skills/browser-tools/browser-pick.js +162 -162
- package/skills/browser-tools/browser-screenshot.js +34 -34
- package/skills/browser-tools/browser-start.js +86 -86
- package/skills/browser-tools/package-lock.json +2556 -2556
- package/skills/browser-tools/package.json +19 -19
- package/skills/code-review-core/SKILL.md +20 -20
- package/skills/codebase-scout/SKILL.md +19 -19
- package/skills/frontend-design-review/SKILL.md +66 -66
- package/skills/frontend-design-review/references/review-checklist.md +40 -58
- package/skills/frontend-implementation/SKILL.md +49 -49
- package/skills/frontend-implementation/references/code-standards.md +32 -32
- package/skills/frontend-implementation/references/design-spec.md +46 -46
- package/skills/frontend-implementation/references/node-contracts.md +27 -27
- package/skills/frontend-review/SKILL.md +61 -59
- package/skills/frontend-review/references/review-findings.md +48 -47
- package/skills/frontend-verification/SKILL.md +55 -53
- package/skills/frontend-verification/references/verification-checklist.md +59 -68
- package/skills/grill-me/SKILL.md +10 -10
- package/skills/grill-with-docs/SKILL.md +88 -88
- package/skills/grill-with-docs/adr-format.md +47 -47
- package/skills/grill-with-docs/context-format.md +60 -60
- package/skills/init-capability-evolution/SKILL.md +70 -70
- package/skills/loop-agent/SKILL.md +151 -151
- package/skills/loop-agent/references/README.md +67 -67
- package/skills/loop-agent/references/command-reference.md +527 -527
- package/skills/loop-agent/references/docs-converge.md +126 -126
- package/skills/loop-agent/references/harness-policy.md +263 -263
- package/skills/loop-agent/references/hybrid-dag.md +243 -243
- package/skills/loop-agent/references/learned/README.md +21 -21
- package/skills/loop-agent/references/long-running-loop.md +57 -57
- package/skills/loop-agent/references/model-routing.md +36 -36
- package/skills/loop-agent/references/multi-worktree.md +54 -54
- package/skills/loop-agent/references/one-shot-runs.md +85 -85
- package/skills/loop-agent/references/orchestrator-and-interventions.md +169 -169
- package/skills/loop-agent/references/pi-prompt.md +23 -23
- package/skills/loop-agent/references/pi-subagent-assisted-mode.md +84 -84
- package/skills/loop-agent/references/post-implementation-and-patterns.md +44 -44
- package/skills/loop-agent/references/task-workflow.md +89 -89
- package/skills/loop-agent/references/verification-and-failure-handling.md +141 -141
- package/skills/playwright-cli/SKILL.md +420 -420
- package/skills/playwright-cli/references/element-attributes.md +23 -23
- package/skills/playwright-cli/references/playwright-tests.md +39 -39
- package/skills/playwright-cli/references/request-mocking.md +87 -87
- package/skills/playwright-cli/references/running-code.md +241 -241
- package/skills/playwright-cli/references/session-management.md +225 -225
- package/skills/playwright-cli/references/storage-state.md +275 -275
- package/skills/playwright-cli/references/test-generation.md +433 -433
- package/skills/playwright-cli/references/tracing.md +139 -139
- package/skills/playwright-cli/references/video-recording.md +143 -143
- package/skills/playwright-cli-case-generator/SKILL.md +74 -74
- package/skills/requesting-code-review/SKILL.md +101 -101
- package/skills/requesting-code-review/code-reviewer.md +168 -168
- package/skills/systematic-debugging/CREATION-LOG.md +119 -119
- package/skills/systematic-debugging/SKILL.md +296 -296
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -158
- package/skills/systematic-debugging/condition-based-waiting.md +115 -115
- package/skills/systematic-debugging/defense-in-depth.md +122 -122
- package/skills/systematic-debugging/find-polluter.sh +63 -63
- package/skills/systematic-debugging/root-cause-tracing.md +169 -169
- package/skills/systematic-debugging/test-academic.md +14 -14
- package/skills/systematic-debugging/test-pressure-1.md +58 -58
- package/skills/systematic-debugging/test-pressure-2.md +68 -68
- package/skills/systematic-debugging/test-pressure-3.md +69 -69
- package/skills/test-driven-development/SKILL.md +20 -20
- package/skills/using-git-worktrees/SKILL.md +215 -215
- package/skills/verification-before-completion/SKILL.md +154 -154
- package/skills/webapp-testing/SKILL.md +19 -19
- package/docs/agent-dag-recovery-playbook.md +0 -195
- package/docs/agent-dag-runner.md +0 -67
- package/docs/cursor-prompt-sidecar.md +0 -36
- package/docs/decisions/README.md +0 -18
- package/docs/design/README.md +0 -167
- package/docs/development-principles.md +0 -73
- package/docs/exec-plans/README.md +0 -6
- package/docs/exec-plans/active/README.md +0 -12
- package/docs/exec-plans/completed/README.md +0 -107
- package/docs/feature-workflow.md +0 -414
- package/docs/loop-agent-harness.md +0 -142
- package/docs/production-readiness.md +0 -96
- package/docs/progress/README.md +0 -80
- package/docs/reports/README.md +0 -159
- package/docs/verification-matrix.md +0 -70
- package/scripts/check-product-line-docs.sh +0 -29
- package/scripts/check-task-pool-root.sh +0 -32
- package/scripts/kb-graph-incremental-prepare.sh +0 -5
- package/scripts/kb-graph-materialize.sh +0 -4
- package/scripts/kb-graph-promote.sh +0 -4
- package/scripts/kb-query.sh +0 -5
|
@@ -1,191 +1,191 @@
|
|
|
1
|
-
# Runtime Boundaries
|
|
2
|
-
|
|
3
|
-
本文定义 loop-agent 各 runtime 层的 module interface、允许的依赖方向,以及治理检查 hook。目标是把命令、文档、import 架构、controller identity 与 run-owned execution facts 收敛为可机器校验的边界契约。
|
|
4
|
-
|
|
5
|
-
## 分层概览
|
|
6
|
-
|
|
7
|
-
```text
|
|
8
|
-
Skill layer
|
|
9
|
-
├─ DAG/runtime 入口策略(.agents/skills/loop-agent/)
|
|
10
|
-
└─ Feature/Task Pool 外层 operator 路由(.agents/skills/agent-worker/)
|
|
11
|
-
|
|
12
|
-
CLI layer (src/cli/)
|
|
13
|
-
└─ argv 解析、adapter 解析、调用 application / command handler、格式化输出
|
|
14
|
-
|
|
15
|
-
Application layer (src/application/,逐步引入)
|
|
16
|
-
└─ 一次用户意图的 typed use-case interface,供 CLI、Loop、Workflow 复用
|
|
17
|
-
|
|
18
|
-
Workflow runtime (src/workflows/)
|
|
19
|
-
└─ DAG / Dynamic / Loop 核心执行规则;不应依赖 commands
|
|
20
|
-
|
|
21
|
-
Executors (src/executors/)
|
|
22
|
-
└─ Pi / Shell / Static 等受治理外部工具适配;不应依赖 commands 或 CLI formatting
|
|
23
|
-
|
|
24
|
-
Sidecars (src/sidecars/)
|
|
25
|
-
└─ 显式手工 one-shot 工具(如 cursor-prompt);不得被 workflows/application/task/worker 依赖
|
|
26
|
-
|
|
27
|
-
Worker adapter (src/worker/)
|
|
28
|
-
└─ 产品线 TaskSpec / Task Pool / Observe 本地适配;冻结已发布 loop-agent controller identity,
|
|
29
|
-
以绝对子进程 launch spec 调用 CLI,不得 in-process import CLI、commands 或 application
|
|
30
|
-
|
|
31
|
-
Infrastructure / Store (src/infrastructure/,逐步引入)
|
|
32
|
-
└─ .harness 文件系统副作用、run lifecycle、原子写入规则
|
|
33
|
-
|
|
34
|
-
Governance (scripts/check-*.sh, src/governance/)
|
|
35
|
-
└─ 防止 command registry、skill entry、import architecture 漂移
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## 各层职责
|
|
39
|
-
|
|
40
|
-
### Skill layer
|
|
41
|
-
|
|
42
|
-
- **位置**:`.agents/skills/loop-agent/**` 与 `.agents/skills/agent-worker/**`
|
|
43
|
-
- **职责**:`loop-agent` skill 定义单个 DAG/runtime 工作的入口、硬规则与 reference 路由;`agent-worker` skill 只定义 Feature Packet、TaskSpec、Task Pool、controller pinning、自举 release train 与失败恢复的外层 operator 路由。
|
|
44
|
-
- **路由边界**:DAG leaf node 不得递归启动 `agent-worker`;`agent-worker` 不得加入 `DEFAULT_SKILLS_BY_ROLE`,也不实现 executor、scheduler、prompt 或 write guard。
|
|
45
|
-
- **禁止**:在入口 skill 中重复维护 CLI command 列表或与 `src/cli/catalog.ts` 冲突的事实源。
|
|
46
|
-
|
|
47
|
-
### CLI layer
|
|
48
|
-
|
|
49
|
-
- **位置**:`src/cli.ts`、`src/cli/**`
|
|
50
|
-
- **职责**:解析全局 flag(如 `--repo-root`)、解析 top-level / subcommand、调用 command handler、输出 help / JSON / Markdown。
|
|
51
|
-
- **允许依赖**:`src/commands/**`(handler wiring)、`src/adapters/**`、`src/shared/**`、逐步引入的 `src/application/**`。
|
|
52
|
-
- **禁止**:在 router 中维护与 catalog 独立的 command 事实源(Phase 1 整改目标)。
|
|
53
|
-
|
|
54
|
-
### Application layer
|
|
55
|
-
|
|
56
|
-
- **位置**:`src/application/**`(按计划逐步引入)
|
|
57
|
-
- **职责**:封装一次用户意图的 typed result(如 validate DAG、run DAG、report),供 CLI 与 workflow runtime 共用。
|
|
58
|
-
- **允许依赖**:`src/workflows/**`、`src/infrastructure/**`、`src/task/**`、`src/records/**`。
|
|
59
|
-
- **禁止**:直接承担 CLI formatting 或 argv 解析。
|
|
60
|
-
|
|
61
|
-
### Workflow runtime
|
|
62
|
-
|
|
63
|
-
- **位置**:`src/workflows/dag/**`、`src/workflows/dynamic/**`、`src/workflows/loop/**`
|
|
64
|
-
- **职责**:DAG spec 校验与执行、dynamic workflow 编译与 expansion、Loop 状态机与 action 编排;新 DAG run 在任何节点执行前创建 run-owned resolved skill profile snapshot,并在普通节点、dynamic child、approve/resume 路径执行 integrity gate。
|
|
65
|
-
- **skill snapshot 契约**:snapshot ref 使用 run-relative `.runtime/skill-snapshot.json` 与原始 bytes SHA-256;ref、artifact、profile 或 binding 不一致时 fail closed,不允许回退 live skill resolution。旧 run 只有在 ref 与 artifact 都不存在时,才可在 resume 前标记为 `legacy-resume-backfill` 并冻结剩余节点。
|
|
66
|
-
- **允许依赖**:`src/executors/**`、`src/task/**`、`src/records/**`、`src/shared/**`、application use-case(目标态)。
|
|
67
|
-
- **禁止**:`import` 来自 `src/commands/**`(见下方过渡例外)。
|
|
68
|
-
|
|
69
|
-
### Executors
|
|
70
|
-
|
|
71
|
-
- **位置**:`src/executors/**`
|
|
72
|
-
- **职责**:封装 Pi SDK、shell 执行、static 输出与 write guard。受治理 Agent runtime 只有 Pi。
|
|
73
|
-
- **允许依赖**:`src/shared/**`、外部 SDK(不含 `@cursor/sdk`)。
|
|
74
|
-
- **禁止**:依赖 `src/commands/**`、CLI 输出格式,或 import `src/sidecars/**` / `@cursor/sdk`。
|
|
75
|
-
|
|
76
|
-
### Sidecars
|
|
77
|
-
|
|
78
|
-
- **位置**:`src/sidecars/cursor-prompt/**`
|
|
79
|
-
- **职责**:`cursor-prompt` one-shot 手工干预;仅在显式调用时动态加载 `@cursor/sdk`。
|
|
80
|
-
- **禁止**:被 `src/workflows/**`、`src/application/**`、`src/task/**`、`src/worker/**` 或普通 `src/executors/**` import。
|
|
81
|
-
|
|
82
|
-
### Worker adapter
|
|
83
|
-
|
|
84
|
-
- **位置**:`src/worker/**`,独立 `agent-worker` CLI 为 `src/worker/cli.ts`。
|
|
85
|
-
- **职责**:TaskSpec 校验与物化、Task Pool batch/retry/morning report under `.harness/task-pool/`、失败路由,以及只读 Observe 事件/快照/UI;实际 DAG 执行通过 `LoopAgentClient` 启动已发布的 `loop-agent` 子进程。自 0.8.0 起该目录是唯一受支持的 Task Pool runtime root,旧路径不读取、不迁移、不合并、不重映射。
|
|
86
|
-
- **controller identity**:写入型 Feature/batch/Task/final verification 在任何目标仓库或 Task Pool 状态写入前解析并冻结 schemaVersion 1 identity,包括 package name/version、绝对 entry/real entry、直接可执行 launch spec、binary SHA-256 和覆盖 `package.json`、`bin/**`、`dist/**`、`.agents/skills/**` 的 portable fingerprint。expected version/fingerprint 不匹配时 fail-fast;后续 spawn 不重新查询 PATH。
|
|
87
|
-
- **证据传播**:canonical Worker record、Task Pool run、batch/Feature、QA/final evidence 可选携带同一 identity;只有所有相关层都省略 identity 时才按 legacy evidence 接受,部分缺失或锚点不一致会拒绝。
|
|
88
|
-
- **允许依赖**:TaskSpec、Task Pool、observability、Node filesystem/path 与明确的 shared/task contract;它不是第二套 executor 或 DAG kernel。
|
|
89
|
-
- **禁止**:in-process import `src/cli/**`、`src/commands/**` 或 `src/application/**`。
|
|
90
|
-
|
|
91
|
-
### Infrastructure / Store
|
|
92
|
-
|
|
93
|
-
- **位置**:`src/infrastructure/harness/**`(按计划逐步引入);过渡期部分逻辑仍在 `src/workflows/dag/lifecycle.ts`、`src/records/**`。
|
|
94
|
-
- **职责**:`.harness/tasks`、`.harness/dag-runs`、`.harness/runs`、loop state 的集中读写;completed run facts 只读约束。DAG run 自有的 `.runtime/skill-snapshot.json` 随 lifecycle 目录整体迁移,state 只保存相对 ref 和 hash,不保存 active/paused/completed 绝对路径。
|
|
95
|
-
- **DAG recovery mutation**:`dag reconcile-run` 是显式 operator 边界;默认仅检查,只有给出 action + reason 且 runner 已证明停止时才能保存原始快照、写 terminal reconciliation facts 并迁移 lifecycle。Observe、status 和 doctor 始终只读。
|
|
96
|
-
- **禁止**:把 raw path mutation 扩散给 runner、loop action 或 command handler。
|
|
97
|
-
|
|
98
|
-
### Governance
|
|
99
|
-
|
|
100
|
-
- **位置**:`scripts/check-repo.sh` 及子脚本、`src/governance/**`、相关 Vitest。
|
|
101
|
-
- **职责**:在 CI / in-flight DAG 中检测文档链接、exec plan 状态、架构 import、command registry 漂移、两个公共 skill entry 与 init/package surface 完整性。源码仓库另提供 `scripts/self-host-canary.mjs` 作为 repo-maintainer candidate takeover 证据入口;它不属于发布 package surface。
|
|
102
|
-
|
|
103
|
-
## 允许的依赖方向
|
|
104
|
-
|
|
105
|
-
```text
|
|
106
|
-
Skill (docs) ──advisory──> CLI catalog / command-reference(人类可读,机器 drift check)
|
|
107
|
-
|
|
108
|
-
CLI ──────────> Application (目标态)
|
|
109
|
-
CLI ──────────> Commands (handler 薄层)
|
|
110
|
-
Commands ──────────> Application / Workflows / Infrastructure
|
|
111
|
-
|
|
112
|
-
Workflow runtime ──────────> Executors / Task / Records / Application (目标态)
|
|
113
|
-
Workflow runtime ──X──> Commands (目标态禁止;见过渡例外)
|
|
114
|
-
|
|
115
|
-
Executors ──────────> Shared / 外部 SDK
|
|
116
|
-
Executors ──X──> Commands / CLI
|
|
117
|
-
|
|
118
|
-
Worker adapter ──────────> TaskSpec / Task Pool / observability / 子进程 CLI contract
|
|
119
|
-
Worker adapter ──X──> Commands / CLI / Application(in-process)
|
|
120
|
-
|
|
121
|
-
Application ──────────> Workflows / Infrastructure / Task / Records
|
|
122
|
-
Application ──X──> CLI formatting
|
|
123
|
-
|
|
124
|
-
Infrastructure ──────────> Shared / node:fs
|
|
125
|
-
Runner / Loop ──(迁移中)──> 逐步改为仅经 Store / Application
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
## 版本化自举边界
|
|
129
|
-
|
|
130
|
-
版本化自举包含两个不同的冻结层,不能用其中一个替代另一个:
|
|
131
|
-
|
|
132
|
-
| 层 | 冻结对象 | 生命周期 | 权威证据 |
|
|
133
|
-
|---|---|---|---|
|
|
134
|
-
| Controller identity | 实际发布包、entry/realEntry、launch spec、binary hash、portable package fingerprint | Feature/batch/Task/final verification | Worker、Task Pool、batch/Feature、QA/final evidence 中的 `controllerIdentity` |
|
|
135
|
-
| DAG skill snapshot | 某个 run 实际注入 prompt 的 ordered skill profiles、learned flag、budgets 与 dynamic bindings | 单个 DAG run,包括 pause/resume | `state.skillSnapshotRef` + `<runDir>/.runtime/skill-snapshot.json` |
|
|
136
|
-
|
|
137
|
-
源码仓库的 deterministic candidate canary 是第三类、只读/确定性接棒证据:候选 tarball 安装到隔离 slot,两个 bin 从包内绝对入口启动,PATH 中放置 controller fallback trap,并只执行 Feature dry-run 与 static/shell DAG。它必须证明 `piExecutorObserved=false`、`modelExecutorObserved=false` 和 `featureExecutedTasks=[]`,因此不能被描述为 live Pi takeover,也不承担 candidate-package Pi skill source resolution 证明;snapshot 定向测试和真实 DAG evidence 单独承担后者。
|
|
138
|
-
|
|
139
|
-
**规则摘要**
|
|
140
|
-
|
|
141
|
-
| From | May import | Must not import |
|
|
142
|
-
|------|------------|-----------------|
|
|
143
|
-
| `src/commands/**` | application, workflows, infrastructure, task, records, executors, shared | — |
|
|
144
|
-
| `src/workflows/**` | executors, task, records, shared, application(目标) | `src/commands/**` |
|
|
145
|
-
| `src/executors/**` | shared, 外部 SDK | `src/commands/**`, `src/cli/**` |
|
|
146
|
-
| `src/worker/**` | worker-local modules, task contracts, shared, Node APIs | `src/commands/**`, `src/cli/**`, `src/application/**` |
|
|
147
|
-
| `src/cli/**` | commands, adapters, shared, application(目标) | — |
|
|
148
|
-
| `.agents/skills/**` | (Markdown 引用,非 TS import) | 运行时 TS 模块 |
|
|
149
|
-
|
|
150
|
-
## 已知过渡耦合
|
|
151
|
-
|
|
152
|
-
当前没有允许的 `src/workflows/**` / `src/executors/**` forbidden import,也没有允许的 `src/worker/**` → `src/{cli,commands,application}/**` TypeScript import。
|
|
153
|
-
|
|
154
|
-
`scripts/check-architecture-boundaries.sh` 的 transitional allowlist 保持为空。任何新增的 `workflows/executors/worker` forbidden import 必须导致检查 **exit 1**;如果未来确有临时例外,必须先写入 active exec plan,说明移除时间和验证门禁。
|
|
155
|
-
|
|
156
|
-
## Governance 钩子
|
|
157
|
-
|
|
158
|
-
以下脚本由 `scripts/check-repo.sh` 调用(Phase 0 起):
|
|
159
|
-
|
|
160
|
-
| Script | 检查内容 | 失败条件 |
|
|
161
|
-
|--------|----------|----------|
|
|
162
|
-
| `scripts/check-architecture-boundaries.sh` | workflow/executor forbidden import,及 Worker → CLI/commands/application import | 新的未 allowlist violation |
|
|
163
|
-
| `scripts/check-command-registry-drift.sh` | `command-reference.md` 中的 top-level command vs `src/cli/catalog.ts` | 文档引用未注册 command |
|
|
164
|
-
| `scripts/check-exec-plan-index-sync.sh` | `ai_workspace/loop-agent/exec-plans/{active,completed}` 目录文件 vs 对应 `README.md` 索引 | 任一 plan 文件未在索引登记 |
|
|
165
|
-
| `scripts/check-skill-entry.sh` | `loop-agent` / `agent-worker` 的 frontmatter、required references、入口行数与 operator trigger vocabulary | 任一公共 skill 缺失、reference/trigger 漂移或入口超过 hard limit |
|
|
166
|
-
|
|
167
|
-
版本化自举相关 exec plan:`ai_workspace/loop-agent/exec-plans/active/2026-07-13-versioned-self-hosting-bootstrap.md`。
|
|
168
|
-
|
|
169
|
-
`src/governance/exec-plans.ts` 是 exec-plan 创建、完成与索引校验的共享 TypeScript 事实源:`plan create`/`plan complete`/`plan check` 与 `dag run-task` 前置校验都调用它。`scripts/check-exec-plan-index-sync.sh` 是独立的 shell 最终防线,与 TypeScript checker 并存;两者均不删除或弱化。
|
|
170
|
-
|
|
171
|
-
### 验证命令
|
|
172
|
-
|
|
173
|
-
```bash
|
|
174
|
-
bash scripts/check-repo.sh
|
|
175
|
-
bash scripts/check-architecture-boundaries.sh
|
|
176
|
-
bash scripts/check-command-registry-drift.sh
|
|
177
|
-
bash scripts/check-skill-entry.sh
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
Runtime 变更另需 `npm run typecheck` 及对应 targeted Vitest(见 exec plan 各 Phase 验证关口)。
|
|
181
|
-
|
|
182
|
-
## 演进里程碑
|
|
183
|
-
|
|
184
|
-
| Phase | 边界变化 |
|
|
185
|
-
|-------|----------|
|
|
186
|
-
| 0(当前) | 文档 + 机器 guard;已知 loop/actions.ts 耦合 advisory |
|
|
187
|
-
| 1 | CLI command definition 单源 |
|
|
188
|
-
| 2 | Skill entry 瘦身 + frontmatter references |
|
|
189
|
-
| 3 | DAG application use-case;Loop 开始脱离 command JSON |
|
|
190
|
-
| 6 | `workflows → commands` import check 已从 advisory 改为 **fail** |
|
|
191
|
-
| 7 | Harness Store / Repository 集中 `.harness` 副作用 |
|
|
1
|
+
# Runtime Boundaries
|
|
2
|
+
|
|
3
|
+
本文定义 loop-agent 各 runtime 层的 module interface、允许的依赖方向,以及治理检查 hook。目标是把命令、文档、import 架构、controller identity 与 run-owned execution facts 收敛为可机器校验的边界契约。
|
|
4
|
+
|
|
5
|
+
## 分层概览
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
Skill layer
|
|
9
|
+
├─ DAG/runtime 入口策略(.agents/skills/loop-agent/)
|
|
10
|
+
└─ Feature/Task Pool 外层 operator 路由(.agents/skills/agent-worker/)
|
|
11
|
+
|
|
12
|
+
CLI layer (src/cli/)
|
|
13
|
+
└─ argv 解析、adapter 解析、调用 application / command handler、格式化输出
|
|
14
|
+
|
|
15
|
+
Application layer (src/application/,逐步引入)
|
|
16
|
+
└─ 一次用户意图的 typed use-case interface,供 CLI、Loop、Workflow 复用
|
|
17
|
+
|
|
18
|
+
Workflow runtime (src/workflows/)
|
|
19
|
+
└─ DAG / Dynamic / Loop 核心执行规则;不应依赖 commands
|
|
20
|
+
|
|
21
|
+
Executors (src/executors/)
|
|
22
|
+
└─ Pi / Shell / Static 等受治理外部工具适配;不应依赖 commands 或 CLI formatting
|
|
23
|
+
|
|
24
|
+
Sidecars (src/sidecars/)
|
|
25
|
+
└─ 显式手工 one-shot 工具(如 cursor-prompt);不得被 workflows/application/task/worker 依赖
|
|
26
|
+
|
|
27
|
+
Worker adapter (src/worker/)
|
|
28
|
+
└─ 产品线 TaskSpec / Task Pool / Observe 本地适配;冻结已发布 loop-agent controller identity,
|
|
29
|
+
以绝对子进程 launch spec 调用 CLI,不得 in-process import CLI、commands 或 application
|
|
30
|
+
|
|
31
|
+
Infrastructure / Store (src/infrastructure/,逐步引入)
|
|
32
|
+
└─ .harness 文件系统副作用、run lifecycle、原子写入规则
|
|
33
|
+
|
|
34
|
+
Governance (scripts/check-*.sh, src/governance/)
|
|
35
|
+
└─ 防止 command registry、skill entry、import architecture 漂移
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## 各层职责
|
|
39
|
+
|
|
40
|
+
### Skill layer
|
|
41
|
+
|
|
42
|
+
- **位置**:`.agents/skills/loop-agent/**` 与 `.agents/skills/agent-worker/**`
|
|
43
|
+
- **职责**:`loop-agent` skill 定义单个 DAG/runtime 工作的入口、硬规则与 reference 路由;`agent-worker` skill 只定义 Feature Packet、TaskSpec、Task Pool、controller pinning、自举 release train 与失败恢复的外层 operator 路由。
|
|
44
|
+
- **路由边界**:DAG leaf node 不得递归启动 `agent-worker`;`agent-worker` 不得加入 `DEFAULT_SKILLS_BY_ROLE`,也不实现 executor、scheduler、prompt 或 write guard。
|
|
45
|
+
- **禁止**:在入口 skill 中重复维护 CLI command 列表或与 `src/cli/catalog.ts` 冲突的事实源。
|
|
46
|
+
|
|
47
|
+
### CLI layer
|
|
48
|
+
|
|
49
|
+
- **位置**:`src/cli.ts`、`src/cli/**`
|
|
50
|
+
- **职责**:解析全局 flag(如 `--repo-root`)、解析 top-level / subcommand、调用 command handler、输出 help / JSON / Markdown。
|
|
51
|
+
- **允许依赖**:`src/commands/**`(handler wiring)、`src/adapters/**`、`src/shared/**`、逐步引入的 `src/application/**`。
|
|
52
|
+
- **禁止**:在 router 中维护与 catalog 独立的 command 事实源(Phase 1 整改目标)。
|
|
53
|
+
|
|
54
|
+
### Application layer
|
|
55
|
+
|
|
56
|
+
- **位置**:`src/application/**`(按计划逐步引入)
|
|
57
|
+
- **职责**:封装一次用户意图的 typed result(如 validate DAG、run DAG、report),供 CLI 与 workflow runtime 共用。
|
|
58
|
+
- **允许依赖**:`src/workflows/**`、`src/infrastructure/**`、`src/task/**`、`src/records/**`。
|
|
59
|
+
- **禁止**:直接承担 CLI formatting 或 argv 解析。
|
|
60
|
+
|
|
61
|
+
### Workflow runtime
|
|
62
|
+
|
|
63
|
+
- **位置**:`src/workflows/dag/**`、`src/workflows/dynamic/**`、`src/workflows/loop/**`
|
|
64
|
+
- **职责**:DAG spec 校验与执行、dynamic workflow 编译与 expansion、Loop 状态机与 action 编排;新 DAG run 在任何节点执行前创建 run-owned resolved skill profile snapshot,并在普通节点、dynamic child、approve/resume 路径执行 integrity gate。
|
|
65
|
+
- **skill snapshot 契约**:snapshot ref 使用 run-relative `.runtime/skill-snapshot.json` 与原始 bytes SHA-256;ref、artifact、profile 或 binding 不一致时 fail closed,不允许回退 live skill resolution。旧 run 只有在 ref 与 artifact 都不存在时,才可在 resume 前标记为 `legacy-resume-backfill` 并冻结剩余节点。
|
|
66
|
+
- **允许依赖**:`src/executors/**`、`src/task/**`、`src/records/**`、`src/shared/**`、application use-case(目标态)。
|
|
67
|
+
- **禁止**:`import` 来自 `src/commands/**`(见下方过渡例外)。
|
|
68
|
+
|
|
69
|
+
### Executors
|
|
70
|
+
|
|
71
|
+
- **位置**:`src/executors/**`
|
|
72
|
+
- **职责**:封装 Pi SDK、shell 执行、static 输出与 write guard。受治理 Agent runtime 只有 Pi。
|
|
73
|
+
- **允许依赖**:`src/shared/**`、外部 SDK(不含 `@cursor/sdk`)。
|
|
74
|
+
- **禁止**:依赖 `src/commands/**`、CLI 输出格式,或 import `src/sidecars/**` / `@cursor/sdk`。
|
|
75
|
+
|
|
76
|
+
### Sidecars
|
|
77
|
+
|
|
78
|
+
- **位置**:`src/sidecars/cursor-prompt/**`
|
|
79
|
+
- **职责**:`cursor-prompt` one-shot 手工干预;仅在显式调用时动态加载 `@cursor/sdk`。
|
|
80
|
+
- **禁止**:被 `src/workflows/**`、`src/application/**`、`src/task/**`、`src/worker/**` 或普通 `src/executors/**` import。
|
|
81
|
+
|
|
82
|
+
### Worker adapter
|
|
83
|
+
|
|
84
|
+
- **位置**:`src/worker/**`,独立 `agent-worker` CLI 为 `src/worker/cli.ts`。
|
|
85
|
+
- **职责**:TaskSpec 校验与物化、Task Pool batch/retry/morning report under `.harness/task-pool/`、失败路由,以及只读 Observe 事件/快照/UI;实际 DAG 执行通过 `LoopAgentClient` 启动已发布的 `loop-agent` 子进程。自 0.8.0 起该目录是唯一受支持的 Task Pool runtime root,旧路径不读取、不迁移、不合并、不重映射。
|
|
86
|
+
- **controller identity**:写入型 Feature/batch/Task/final verification 在任何目标仓库或 Task Pool 状态写入前解析并冻结 schemaVersion 1 identity,包括 package name/version、绝对 entry/real entry、直接可执行 launch spec、binary SHA-256 和覆盖 `package.json`、`bin/**`、`dist/**`、`.agents/skills/**` 的 portable fingerprint。expected version/fingerprint 不匹配时 fail-fast;后续 spawn 不重新查询 PATH。
|
|
87
|
+
- **证据传播**:canonical Worker record、Task Pool run、batch/Feature、QA/final evidence 可选携带同一 identity;只有所有相关层都省略 identity 时才按 legacy evidence 接受,部分缺失或锚点不一致会拒绝。
|
|
88
|
+
- **允许依赖**:TaskSpec、Task Pool、observability、Node filesystem/path 与明确的 shared/task contract;它不是第二套 executor 或 DAG kernel。
|
|
89
|
+
- **禁止**:in-process import `src/cli/**`、`src/commands/**` 或 `src/application/**`。
|
|
90
|
+
|
|
91
|
+
### Infrastructure / Store
|
|
92
|
+
|
|
93
|
+
- **位置**:`src/infrastructure/harness/**`(按计划逐步引入);过渡期部分逻辑仍在 `src/workflows/dag/lifecycle.ts`、`src/records/**`。
|
|
94
|
+
- **职责**:`.harness/tasks`、`.harness/dag-runs`、`.harness/runs`、loop state 的集中读写;completed run facts 只读约束。DAG run 自有的 `.runtime/skill-snapshot.json` 随 lifecycle 目录整体迁移,state 只保存相对 ref 和 hash,不保存 active/paused/completed 绝对路径。
|
|
95
|
+
- **DAG recovery mutation**:`dag reconcile-run` 是显式 operator 边界;默认仅检查,只有给出 action + reason 且 runner 已证明停止时才能保存原始快照、写 terminal reconciliation facts 并迁移 lifecycle。Observe、status 和 doctor 始终只读。
|
|
96
|
+
- **禁止**:把 raw path mutation 扩散给 runner、loop action 或 command handler。
|
|
97
|
+
|
|
98
|
+
### Governance
|
|
99
|
+
|
|
100
|
+
- **位置**:`scripts/check-repo.sh` 及子脚本、`src/governance/**`、相关 Vitest。
|
|
101
|
+
- **职责**:在 CI / in-flight DAG 中检测文档链接、exec plan 状态、架构 import、command registry 漂移、两个公共 skill entry 与 init/package surface 完整性。源码仓库另提供 `scripts/self-host-canary.mjs` 作为 repo-maintainer candidate takeover 证据入口;它不属于发布 package surface。
|
|
102
|
+
|
|
103
|
+
## 允许的依赖方向
|
|
104
|
+
|
|
105
|
+
```text
|
|
106
|
+
Skill (docs) ──advisory──> CLI catalog / command-reference(人类可读,机器 drift check)
|
|
107
|
+
|
|
108
|
+
CLI ──────────> Application (目标态)
|
|
109
|
+
CLI ──────────> Commands (handler 薄层)
|
|
110
|
+
Commands ──────────> Application / Workflows / Infrastructure
|
|
111
|
+
|
|
112
|
+
Workflow runtime ──────────> Executors / Task / Records / Application (目标态)
|
|
113
|
+
Workflow runtime ──X──> Commands (目标态禁止;见过渡例外)
|
|
114
|
+
|
|
115
|
+
Executors ──────────> Shared / 外部 SDK
|
|
116
|
+
Executors ──X──> Commands / CLI
|
|
117
|
+
|
|
118
|
+
Worker adapter ──────────> TaskSpec / Task Pool / observability / 子进程 CLI contract
|
|
119
|
+
Worker adapter ──X──> Commands / CLI / Application(in-process)
|
|
120
|
+
|
|
121
|
+
Application ──────────> Workflows / Infrastructure / Task / Records
|
|
122
|
+
Application ──X──> CLI formatting
|
|
123
|
+
|
|
124
|
+
Infrastructure ──────────> Shared / node:fs
|
|
125
|
+
Runner / Loop ──(迁移中)──> 逐步改为仅经 Store / Application
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## 版本化自举边界
|
|
129
|
+
|
|
130
|
+
版本化自举包含两个不同的冻结层,不能用其中一个替代另一个:
|
|
131
|
+
|
|
132
|
+
| 层 | 冻结对象 | 生命周期 | 权威证据 |
|
|
133
|
+
|---|---|---|---|
|
|
134
|
+
| Controller identity | 实际发布包、entry/realEntry、launch spec、binary hash、portable package fingerprint | Feature/batch/Task/final verification | Worker、Task Pool、batch/Feature、QA/final evidence 中的 `controllerIdentity` |
|
|
135
|
+
| DAG skill snapshot | 某个 run 实际注入 prompt 的 ordered skill profiles、learned flag、budgets 与 dynamic bindings | 单个 DAG run,包括 pause/resume | `state.skillSnapshotRef` + `<runDir>/.runtime/skill-snapshot.json` |
|
|
136
|
+
|
|
137
|
+
源码仓库的 deterministic candidate canary 是第三类、只读/确定性接棒证据:候选 tarball 安装到隔离 slot,两个 bin 从包内绝对入口启动,PATH 中放置 controller fallback trap,并只执行 Feature dry-run 与 static/shell DAG。它必须证明 `piExecutorObserved=false`、`modelExecutorObserved=false` 和 `featureExecutedTasks=[]`,因此不能被描述为 live Pi takeover,也不承担 candidate-package Pi skill source resolution 证明;snapshot 定向测试和真实 DAG evidence 单独承担后者。
|
|
138
|
+
|
|
139
|
+
**规则摘要**
|
|
140
|
+
|
|
141
|
+
| From | May import | Must not import |
|
|
142
|
+
|------|------------|-----------------|
|
|
143
|
+
| `src/commands/**` | application, workflows, infrastructure, task, records, executors, shared | — |
|
|
144
|
+
| `src/workflows/**` | executors, task, records, shared, application(目标) | `src/commands/**` |
|
|
145
|
+
| `src/executors/**` | shared, 外部 SDK | `src/commands/**`, `src/cli/**` |
|
|
146
|
+
| `src/worker/**` | worker-local modules, task contracts, shared, Node APIs | `src/commands/**`, `src/cli/**`, `src/application/**` |
|
|
147
|
+
| `src/cli/**` | commands, adapters, shared, application(目标) | — |
|
|
148
|
+
| `.agents/skills/**` | (Markdown 引用,非 TS import) | 运行时 TS 模块 |
|
|
149
|
+
|
|
150
|
+
## 已知过渡耦合
|
|
151
|
+
|
|
152
|
+
当前没有允许的 `src/workflows/**` / `src/executors/**` forbidden import,也没有允许的 `src/worker/**` → `src/{cli,commands,application}/**` TypeScript import。
|
|
153
|
+
|
|
154
|
+
`scripts/check-architecture-boundaries.sh` 的 transitional allowlist 保持为空。任何新增的 `workflows/executors/worker` forbidden import 必须导致检查 **exit 1**;如果未来确有临时例外,必须先写入 active exec plan,说明移除时间和验证门禁。
|
|
155
|
+
|
|
156
|
+
## Governance 钩子
|
|
157
|
+
|
|
158
|
+
以下脚本由 `scripts/check-repo.sh` 调用(Phase 0 起):
|
|
159
|
+
|
|
160
|
+
| Script | 检查内容 | 失败条件 |
|
|
161
|
+
|--------|----------|----------|
|
|
162
|
+
| `scripts/check-architecture-boundaries.sh` | workflow/executor forbidden import,及 Worker → CLI/commands/application import | 新的未 allowlist violation |
|
|
163
|
+
| `scripts/check-command-registry-drift.sh` | `command-reference.md` 中的 top-level command vs `src/cli/catalog.ts` | 文档引用未注册 command |
|
|
164
|
+
| `scripts/check-exec-plan-index-sync.sh` | `ai_workspace/loop-agent/exec-plans/{active,completed}` 目录文件 vs 对应 `README.md` 索引 | 任一 plan 文件未在索引登记 |
|
|
165
|
+
| `scripts/check-skill-entry.sh` | `loop-agent` / `agent-worker` 的 frontmatter、required references、入口行数与 operator trigger vocabulary | 任一公共 skill 缺失、reference/trigger 漂移或入口超过 hard limit |
|
|
166
|
+
|
|
167
|
+
版本化自举相关 exec plan:`ai_workspace/loop-agent/exec-plans/active/2026-07-13-versioned-self-hosting-bootstrap.md`。
|
|
168
|
+
|
|
169
|
+
`src/governance/exec-plans.ts` 是 exec-plan 创建、完成与索引校验的共享 TypeScript 事实源:`plan create`/`plan complete`/`plan check` 与 `dag run-task` 前置校验都调用它。`scripts/check-exec-plan-index-sync.sh` 是独立的 shell 最终防线,与 TypeScript checker 并存;两者均不删除或弱化。
|
|
170
|
+
|
|
171
|
+
### 验证命令
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
bash scripts/check-repo.sh
|
|
175
|
+
bash scripts/check-architecture-boundaries.sh
|
|
176
|
+
bash scripts/check-command-registry-drift.sh
|
|
177
|
+
bash scripts/check-skill-entry.sh
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Runtime 变更另需 `npm run typecheck` 及对应 targeted Vitest(见 exec plan 各 Phase 验证关口)。
|
|
181
|
+
|
|
182
|
+
## 演进里程碑
|
|
183
|
+
|
|
184
|
+
| Phase | 边界变化 |
|
|
185
|
+
|-------|----------|
|
|
186
|
+
| 0(当前) | 文档 + 机器 guard;已知 loop/actions.ts 耦合 advisory |
|
|
187
|
+
| 1 | CLI command definition 单源 |
|
|
188
|
+
| 2 | Skill entry 瘦身 + frontmatter references |
|
|
189
|
+
| 3 | DAG application use-case;Loop 开始脱离 command JSON |
|
|
190
|
+
| 6 | `workflows → commands` import check 已从 advisory 改为 **fail** |
|
|
191
|
+
| 7 | Harness Store / Repository 集中 `.harness` 副作用 |
|
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
# 系统全景
|
|
2
|
-
|
|
3
|
-
本页用一张全景图说明 loop-agent、agent-worker、治理层与外部系统的关系。依赖方向、import 边界与 governance hook 是契约级事实,权威源是 `runtime-boundaries.md`(本页只交叉引用,不复制)。
|
|
4
|
-
|
|
5
|
-
## 两个 CLI 二进制
|
|
6
|
-
|
|
7
|
-
发布包 `@tea-agent/loop-agent` 提供两个入口(见 `package.json` `bin`):
|
|
8
|
-
|
|
9
|
-
| 二进制 | 入口 | 角色 |
|
|
10
|
-
| --- | --- | --- |
|
|
11
|
-
| `loop-agent` | `bin/loop-agent.js` → `src/cli.ts` | 仓库级 AI coding 任务运行时与治理控制器 |
|
|
12
|
-
| `agent-worker` | `bin/agent-worker.js` → `src/worker/cli.ts` | 产品线 TaskSpec / Feature / Task Pool / Observe 外层适配 |
|
|
13
|
-
|
|
14
|
-
两个二进制是独立进程,不共享 in-process runtime。`agent-worker` 真正执行 DAG 时通过已发布的 `loop-agent` 子进程调用(详见 `worker-and-feature.md`)。
|
|
15
|
-
|
|
16
|
-
## 分层概览(交叉引用)
|
|
17
|
-
|
|
18
|
-
完整分层图、各层职责、允许/禁止的 import 方向见 `runtime-boundaries.md` §分层概览 与 §各层职责。一句话摘要:
|
|
19
|
-
|
|
20
|
-
```text
|
|
21
|
-
Skill layer .agents/skills/loop-agent、.agents/skills/agent-worker(Markdown,非 TS import)
|
|
22
|
-
CLI layer src/cli/ — argv 解析、调用 application/handler、格式化输出
|
|
23
|
-
Application src/application/ — typed use-case(validate/run/generate DAG 等)
|
|
24
|
-
Workflow runtime src/workflows/ — DAG / Dynamic / Loop 核心执行规则
|
|
25
|
-
Executors src/executors/ — Pi / shell / static 受治理外部工具适配
|
|
26
|
-
Sidecars src/sidecars/cursor-prompt — 显式手工 one-shot;不得被 workflow 自动依赖
|
|
27
|
-
Worker adapter src/worker/ — 产品线适配 + Observe;子进程调用已发布 loop-agent
|
|
28
|
-
Infrastructure src/infrastructure/ — .harness 副作用、run lifecycle、原子写入
|
|
29
|
-
Governance scripts/check-*.sh、src/governance/ — 防漂移机器校验
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## 两条入口路径
|
|
33
|
-
|
|
34
|
-
### 直接任务路径
|
|
35
|
-
|
|
36
|
-
```text
|
|
37
|
-
人类 / 主 agent
|
|
38
|
-
│ 写任务源与执行约束(.harness/tasks/<taskId>/source)
|
|
39
|
-
▼
|
|
40
|
-
loop-agent(runtime + 治理控制器)
|
|
41
|
-
│ dag run-task / validate / run-dag / report / doctor / reconcile-run
|
|
42
|
-
▼
|
|
43
|
-
workflow runtime(调度 Pi / shell / static 节点)
|
|
44
|
-
│ 证据落入 .harness/dag-runs/{active,paused,completed}/<runId>/
|
|
45
|
-
└─ report / doctor / promote / closeout 读取并投影证据
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### 产品线 Feature 路径
|
|
49
|
-
|
|
50
|
-
```text
|
|
51
|
-
人类 / 外部调度器
|
|
52
|
-
→ agent-worker(TaskSpec / Feature / Task Pool)
|
|
53
|
-
→ 冻结 controller identity
|
|
54
|
-
→ spawn 已发布 loop-agent 子进程
|
|
55
|
-
→ 同一 DAG runtime 与 executor registry
|
|
56
|
-
→ DAG facts + Task Pool records
|
|
57
|
-
→ Feature review / morning report / Observe(派生只读视图)
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
`agent-worker` 位于核心 runtime 的**上游调用侧**,不是 DAG 执行完成后的必经下游。Observe 可以在任一路径后读取现有事实,但不会改变执行结果。
|
|
61
|
-
|
|
62
|
-
## 外部边界
|
|
63
|
-
|
|
64
|
-
- npm 发布包:`@tea-agent/loop-agent`,包含两个 bin 与静态能力资料。
|
|
65
|
-
- 目标仓库:`loop-agent init` 投影语言无关治理资料;源码仓库专用架构文档只随包可读,不默认投影。
|
|
66
|
-
- 本地文件系统:`.harness/` 保存运行态事实;Git 工作树保存代码、治理文档与长期交接资料。
|
|
67
|
-
- 远程 Git/PR/CI、云 Worker 与云 Task Pool 当前不是核心 runtime 的已实现内置边界,见 `evolution.md`。
|
|
68
|
-
|
|
69
|
-
## 治理层入口
|
|
70
|
-
|
|
71
|
-
治理检查是机器校验,不是文档约定。主入口:
|
|
72
|
-
|
|
73
|
-
- `scripts/check-repo.sh` — 聚合入口,CI / in-flight DAG 均调它。
|
|
74
|
-
- 子脚本:`scripts/check-architecture-boundaries.sh`(import 边界)、`scripts/check-command-registry-drift.sh`(command registry)、`scripts/check-skill-entry.sh`(公共 skill entry)、`scripts/check-doc-index.sh` / `scripts/check-doc-links.sh`(文档链接)、`scripts/check-init-surface.sh`(package/init surface 契约)、`scripts/check-init-evolution-needed.sh`(高影响变更需报告)。
|
|
75
|
-
- `src/governance/**` — 治理逻辑与相关 Vitest。
|
|
76
|
-
- `scripts/self-host-canary.mjs` — 源码仓库的 deterministic candidate takeover 证据入口;**不**属于发布 package surface。
|
|
77
|
-
|
|
78
|
-
完整的 governance hook 表(哪个脚本检查什么、失败条件)见 `runtime-boundaries.md` §Governance 钩子。
|
|
79
|
-
|
|
80
|
-
## 受治理 Agent runtime = Pi-only
|
|
81
|
-
|
|
82
|
-
自 0.10.0 起受治理 Agent runtime 硬切为 Pi-only(ADR 0001)。DAG 中 `dagNodeExecutorSchema = z.enum(["pi","shell","static"])`;`executor: "cursor"` 会抛 `CURSOR_DAG_EXECUTOR_REMOVED_ERROR`。`cursor-prompt` 仅保留为显式手工 one-shot sidecar,不进入 Loop auto-execute 或 Delegate 自动写入。详见 `dag-execution.md` 与 `runtime-boundaries.md` §Executors / §Sidecars。
|
|
83
|
-
|
|
84
|
-
## 运行态 vs 治理资料 vs 用法文档
|
|
85
|
-
|
|
86
|
-
| 位置 | 内容 | 权威性质 |
|
|
87
|
-
| --- | --- | --- |
|
|
88
|
-
| `.harness/` | 任务、DAG run、one-shot run、Task Pool、live state | 运行态事实(canonical + derived) |
|
|
89
|
-
| 根目录 `ai_workspace/loop-agent/` | 原则、边界、计划、报告、模板 | 治理权威 |
|
|
90
|
-
| `website/docs/` | 使用者/贡献者导读与操作说明 | 用法双树 |
|
|
91
|
-
| `.agents/skills/` | agent 可加载的入口与 reference | 运行时可加载 |
|
|
92
|
-
|
|
93
|
-
`.harness/` 内部哪些可写、哪些只读、哪些是 derived,详见 `facts-and-state.md`。
|
|
1
|
+
# 系统全景
|
|
2
|
+
|
|
3
|
+
本页用一张全景图说明 loop-agent、agent-worker、治理层与外部系统的关系。依赖方向、import 边界与 governance hook 是契约级事实,权威源是 `runtime-boundaries.md`(本页只交叉引用,不复制)。
|
|
4
|
+
|
|
5
|
+
## 两个 CLI 二进制
|
|
6
|
+
|
|
7
|
+
发布包 `@tea-agent/loop-agent` 提供两个入口(见 `package.json` `bin`):
|
|
8
|
+
|
|
9
|
+
| 二进制 | 入口 | 角色 |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| `loop-agent` | `bin/loop-agent.js` → `src/cli.ts` | 仓库级 AI coding 任务运行时与治理控制器 |
|
|
12
|
+
| `agent-worker` | `bin/agent-worker.js` → `src/worker/cli.ts` | 产品线 TaskSpec / Feature / Task Pool / Observe 外层适配 |
|
|
13
|
+
|
|
14
|
+
两个二进制是独立进程,不共享 in-process runtime。`agent-worker` 真正执行 DAG 时通过已发布的 `loop-agent` 子进程调用(详见 `worker-and-feature.md`)。
|
|
15
|
+
|
|
16
|
+
## 分层概览(交叉引用)
|
|
17
|
+
|
|
18
|
+
完整分层图、各层职责、允许/禁止的 import 方向见 `runtime-boundaries.md` §分层概览 与 §各层职责。一句话摘要:
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
Skill layer .agents/skills/loop-agent、.agents/skills/agent-worker(Markdown,非 TS import)
|
|
22
|
+
CLI layer src/cli/ — argv 解析、调用 application/handler、格式化输出
|
|
23
|
+
Application src/application/ — typed use-case(validate/run/generate DAG 等)
|
|
24
|
+
Workflow runtime src/workflows/ — DAG / Dynamic / Loop 核心执行规则
|
|
25
|
+
Executors src/executors/ — Pi / shell / static 受治理外部工具适配
|
|
26
|
+
Sidecars src/sidecars/cursor-prompt — 显式手工 one-shot;不得被 workflow 自动依赖
|
|
27
|
+
Worker adapter src/worker/ — 产品线适配 + Observe;子进程调用已发布 loop-agent
|
|
28
|
+
Infrastructure src/infrastructure/ — .harness 副作用、run lifecycle、原子写入
|
|
29
|
+
Governance scripts/check-*.sh、src/governance/ — 防漂移机器校验
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## 两条入口路径
|
|
33
|
+
|
|
34
|
+
### 直接任务路径
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
人类 / 主 agent
|
|
38
|
+
│ 写任务源与执行约束(.harness/tasks/<taskId>/source)
|
|
39
|
+
▼
|
|
40
|
+
loop-agent(runtime + 治理控制器)
|
|
41
|
+
│ dag run-task / validate / run-dag / report / doctor / reconcile-run
|
|
42
|
+
▼
|
|
43
|
+
workflow runtime(调度 Pi / shell / static 节点)
|
|
44
|
+
│ 证据落入 .harness/dag-runs/{active,paused,completed}/<runId>/
|
|
45
|
+
└─ report / doctor / promote / closeout 读取并投影证据
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 产品线 Feature 路径
|
|
49
|
+
|
|
50
|
+
```text
|
|
51
|
+
人类 / 外部调度器
|
|
52
|
+
→ agent-worker(TaskSpec / Feature / Task Pool)
|
|
53
|
+
→ 冻结 controller identity
|
|
54
|
+
→ spawn 已发布 loop-agent 子进程
|
|
55
|
+
→ 同一 DAG runtime 与 executor registry
|
|
56
|
+
→ DAG facts + Task Pool records
|
|
57
|
+
→ Feature review / morning report / Observe(派生只读视图)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`agent-worker` 位于核心 runtime 的**上游调用侧**,不是 DAG 执行完成后的必经下游。Observe 可以在任一路径后读取现有事实,但不会改变执行结果。
|
|
61
|
+
|
|
62
|
+
## 外部边界
|
|
63
|
+
|
|
64
|
+
- npm 发布包:`@tea-agent/loop-agent`,包含两个 bin 与静态能力资料。
|
|
65
|
+
- 目标仓库:`loop-agent init` 投影语言无关治理资料;源码仓库专用架构文档只随包可读,不默认投影。
|
|
66
|
+
- 本地文件系统:`.harness/` 保存运行态事实;Git 工作树保存代码、治理文档与长期交接资料。
|
|
67
|
+
- 远程 Git/PR/CI、云 Worker 与云 Task Pool 当前不是核心 runtime 的已实现内置边界,见 `evolution.md`。
|
|
68
|
+
|
|
69
|
+
## 治理层入口
|
|
70
|
+
|
|
71
|
+
治理检查是机器校验,不是文档约定。主入口:
|
|
72
|
+
|
|
73
|
+
- `scripts/check-repo.sh` — 聚合入口,CI / in-flight DAG 均调它。
|
|
74
|
+
- 子脚本:`scripts/check-architecture-boundaries.sh`(import 边界)、`scripts/check-command-registry-drift.sh`(command registry)、`scripts/check-skill-entry.sh`(公共 skill entry)、`scripts/check-doc-index.sh` / `scripts/check-doc-links.sh`(文档链接)、`scripts/check-init-surface.sh`(package/init surface 契约)、`scripts/check-init-evolution-needed.sh`(高影响变更需报告)。
|
|
75
|
+
- `src/governance/**` — 治理逻辑与相关 Vitest。
|
|
76
|
+
- `scripts/self-host-canary.mjs` — 源码仓库的 deterministic candidate takeover 证据入口;**不**属于发布 package surface。
|
|
77
|
+
|
|
78
|
+
完整的 governance hook 表(哪个脚本检查什么、失败条件)见 `runtime-boundaries.md` §Governance 钩子。
|
|
79
|
+
|
|
80
|
+
## 受治理 Agent runtime = Pi-only
|
|
81
|
+
|
|
82
|
+
自 0.10.0 起受治理 Agent runtime 硬切为 Pi-only(ADR 0001)。DAG 中 `dagNodeExecutorSchema = z.enum(["pi","shell","static"])`;`executor: "cursor"` 会抛 `CURSOR_DAG_EXECUTOR_REMOVED_ERROR`。`cursor-prompt` 仅保留为显式手工 one-shot sidecar,不进入 Loop auto-execute 或 Delegate 自动写入。详见 `dag-execution.md` 与 `runtime-boundaries.md` §Executors / §Sidecars。
|
|
83
|
+
|
|
84
|
+
## 运行态 vs 治理资料 vs 用法文档
|
|
85
|
+
|
|
86
|
+
| 位置 | 内容 | 权威性质 |
|
|
87
|
+
| --- | --- | --- |
|
|
88
|
+
| `.harness/` | 任务、DAG run、one-shot run、Task Pool、live state | 运行态事实(canonical + derived) |
|
|
89
|
+
| 根目录 `ai_workspace/loop-agent/` | 原则、边界、计划、报告、模板 | 治理权威 |
|
|
90
|
+
| `website/docs/` | 使用者/贡献者导读与操作说明 | 用法双树 |
|
|
91
|
+
| `.agents/skills/` | agent 可加载的入口与 reference | 运行时可加载 |
|
|
92
|
+
|
|
93
|
+
`.harness/` 内部哪些可写、哪些只读、哪些是 derived,详见 `facts-and-state.md`。
|