@tea-agent/loop-agent 0.40.0-beta.1 → 0.40.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  ### 重点更新
6
6
 
7
+ - Worker 只读分析 workflow:TaskSpec 新增 `execution.workflow: backend-test-analysis`,映射到专用 `backend-test-analysis-dag`,只执行 Backend Test Analysis v2 生成、严格 JSON 物化、独立只读复核与静态收尾。该路径不进入 writer、动态扩展或测试执行,并显式声明 `revisionPolicy: replace-file` artifact 及其 consumer,可作为安全 artifact continuation 的真实 Worker parent。
8
+
7
9
  - 发布渠道:恢复 npm `beta` 作为 operator 显式手动预览渠道(`x.y.z-beta.N`,dist-tag 固定 `beta`,仅手动发布、不接入 CI、不可晋升 latest);`checkPublishPolicy` / `checkPromotePolicy` 与发布管理文档同步。
8
10
 
9
11
  - Worker-managed 产物派生继续(M7):Console 现在为 Worker-owned parent 生成 plan-hash-bound continuation authority,以 parent worker run + revision 确定性创建新的 child Worker/DAG、先占 Task Pool Running slot再调用 pinned sibling `loop-agent`,并在 spawn 前绑定 child run 供 interrupt 使用。成功 child 写入独立 `artifact-continuation` 审计 run/event、释放 lease,并保留原 parent Outcome/Delivery checkpoint;失败 fail closed。Console crash 发生在 terminal run record 写入前时,可由 immutable owner + child DAG lineage reconcile,已有 child 不会被第二请求覆盖或双启动。Writer/dynamic/budget/worktree 扩展仍保持 M8 阻断。
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "version": "0.40.0-beta.1",
4
- "gitSha": "a548be28ee02b5f147edd65d2766516e07ca308f",
5
- "builtAt": "2026-08-30T02:34:20.899Z"
3
+ "version": "0.40.0-beta.2",
4
+ "gitSha": "e0f4d38e3e1a8261a0d9b224757c10173def0cdb",
5
+ "builtAt": "2026-08-30T04:00:34.348Z"
6
6
  }
@@ -14,6 +14,7 @@ export const taskKindSchema = z.enum([
14
14
  "frontend-implementation",
15
15
  "frontend-test",
16
16
  "backend-test",
17
+ "backend-test-analysis",
17
18
  "knowledge-sync",
18
19
  "knowledge-graph-bootstrap",
19
20
  ]);
@@ -163,7 +164,7 @@ const taskConfigObjectSchema = z.object({
163
164
  taskId: z.string(),
164
165
  title: z.string(),
165
166
  sourceFiles: z.array(z.string()),
166
- /** standard: 本仓库需求实现;feature-study: 参考外部代码特性并在目标仓库落地;frontend-implementation: 前端实现 DAG;backend-test: 后端测试 DAG;knowledge-sync: 最终验证后回写测试知识库 DAG;knowledge-graph-bootstrap: AI 辅助业务知识图谱初始化 */
167
+ /** standard: 本仓库需求实现;feature-study: 参考外部代码特性并在目标仓库落地;frontend-implementation: 前端实现 DAG;frontend-test: 前端浏览器测试 DAG;backend-test-analysis: 只读后端测试分析 DAG;backend-test: 后端测试 DAG;knowledge-sync: 最终验证后回写测试知识库 DAG;knowledge-graph-bootstrap: AI 辅助业务知识图谱初始化 */
167
168
  taskKind: taskKindSchema.optional().default("standard"),
168
169
  /** true = taskKind 由人类显式选择(含显式 standard);DAG 路由必须尊重,不做语义改写。 */
169
170
  taskKindExplicit: z.boolean().optional(),
@@ -76,6 +76,7 @@ const SPECIAL_TEMPLATE_BY_TASK_KIND = {
76
76
  "frontend-implementation": "frontend-implementation",
77
77
  "frontend-test": "frontend-test-dag",
78
78
  "backend-test": "backend-test-dag",
79
+ "backend-test-analysis": "backend-test-analysis-dag",
79
80
  "knowledge-sync": "knowledge-sync-dag",
80
81
  "knowledge-graph-bootstrap": "knowledge-graph-bootstrap-dag",
81
82
  };
@@ -83,6 +84,7 @@ const TASK_KIND_ROUTING_REASON = {
83
84
  "frontend-implementation": 'taskKind "frontend-implementation" selects the dedicated frontend DAG template',
84
85
  "frontend-test": 'taskKind "frontend-test" selects the dedicated frontend test DAG template',
85
86
  "backend-test": 'taskKind "backend-test" selects the dedicated backend test DAG template',
87
+ "backend-test-analysis": 'taskKind "backend-test-analysis" selects the read-only backend test analysis DAG template',
86
88
  "knowledge-sync": 'taskKind "knowledge-sync" selects the dedicated knowledge-sync DAG template',
87
89
  "knowledge-graph-bootstrap": 'taskKind "knowledge-graph-bootstrap" selects the dedicated knowledge-graph bootstrap DAG template',
88
90
  };
@@ -90,6 +92,7 @@ const SPECIAL_REQUESTED_TEMPLATES = new Set([
90
92
  "frontend-implementation",
91
93
  "frontend-test-dag",
92
94
  "backend-test-dag",
95
+ "backend-test-analysis-dag",
93
96
  "knowledge-sync-dag",
94
97
  "knowledge-graph-bootstrap-dag",
95
98
  ]);
@@ -98,6 +98,24 @@ class FrontendImplementationAdapter {
98
98
  };
99
99
  }
100
100
  }
101
+ /**
102
+ * `backend-test-analysis` — read-only requirements/API analysis. It produces
103
+ * the strict Backend Test Analysis v2 contract without claiming that tests or
104
+ * a real integration ran.
105
+ */
106
+ class BackendTestAnalysisAdapter {
107
+ workflow = "backend-test-analysis";
108
+ project(input) {
109
+ return {
110
+ artifacts: [
111
+ ...canonicalArtifacts(input),
112
+ ...structuredArtifactsFromReport(input.dagReportRun),
113
+ ],
114
+ acceptanceCoverage: [...input.acceptanceRefs],
115
+ integrationStatus: { mock: false, real: false },
116
+ };
117
+ }
118
+ }
101
119
  /**
102
120
  * `backend-test` — generates + executes backend tests. Integration status is
103
121
  * `real: true` only when the report completed (a real test execution); mock is
@@ -139,6 +157,7 @@ class FrontendTestAdapter {
139
157
  const ADAPTERS = new Map([
140
158
  ["agent-dag", new AgentDagAdapter()],
141
159
  ["frontend-implementation", new FrontendImplementationAdapter()],
160
+ ["backend-test-analysis", new BackendTestAnalysisAdapter()],
142
161
  ["backend-test", new BackendTestAdapter()],
143
162
  ["frontend-test", new FrontendTestAdapter()],
144
163
  ]);
@@ -24,6 +24,7 @@ export const outcomeFailureCategorySchema = z.enum([
24
24
  export const OUTCOME_WORKFLOWS = [
25
25
  "agent-dag",
26
26
  "frontend-implementation",
27
+ "backend-test-analysis",
27
28
  "backend-test",
28
29
  "frontend-test",
29
30
  ];
@@ -11,6 +11,7 @@ export const workflowSchema = z.enum([
11
11
  "agent-dag",
12
12
  "frontend-implementation",
13
13
  "backend-test",
14
+ "backend-test-analysis",
14
15
  "frontend-test",
15
16
  ]);
16
17
  /**
@@ -23,6 +24,7 @@ export const WORKFLOW_TASK_KIND = {
23
24
  "agent-dag": "standard",
24
25
  "frontend-implementation": "frontend-implementation",
25
26
  "backend-test": "backend-test",
27
+ "backend-test-analysis": "backend-test-analysis",
26
28
  "frontend-test": "frontend-test",
27
29
  };
28
30
  /**
@@ -48,7 +50,7 @@ export function legacyDefaultWorkflow(type) {
48
50
  }
49
51
  /** Migration guidance surfaced whenever a legacy QA type lacks an explicit workflow. */
50
52
  export const LEGACY_QA_MIGRATION_GUIDANCE = "Legacy qa-casegen/qa-testcode/qa-execute tasks no longer auto-select a backend or frontend workflow. " +
51
- "Add `execution.workflow` with one of: agent-dag, frontend-implementation, backend-test, frontend-test. " +
53
+ "Add `execution.workflow` with one of: agent-dag, frontend-implementation, backend-test-analysis, backend-test, frontend-test. " +
52
54
  "Use backend-test for backend-only test generation/execution, frontend-test for browser/UI tests, " +
53
55
  "or agent-dag when the QA task is a generic agent study.";
54
56
  export class WorkflowRoutingError extends Error {
@@ -120,10 +122,13 @@ export function validateWorkflowCompatibility(taskSpec) {
120
122
  }
121
123
  const issues = [];
122
124
  const type = taskSpec.type;
123
- if (type === "backend-feature" && explicit !== "agent-dag" && explicit !== "backend-test") {
125
+ if (type === "backend-feature" &&
126
+ explicit !== "agent-dag" &&
127
+ explicit !== "backend-test-analysis" &&
128
+ explicit !== "backend-test") {
124
129
  issues.push({
125
130
  code: "workflow-type-incompatible",
126
- message: `backend-feature is incompatible with workflow "${explicit}" (expected agent-dag or backend-test)`,
131
+ message: `backend-feature is incompatible with workflow "${explicit}" (expected agent-dag, backend-test-analysis, or backend-test)`,
127
132
  path: "execution.workflow",
128
133
  });
129
134
  }
@@ -4077,6 +4077,84 @@ const BACKEND_TEST_SKILLS_BY_ROLE = {
4077
4077
  verifier: ["verification-before-completion", "systematic-debugging"],
4078
4078
  closeout: ["loop-agent", "verification-before-completion"],
4079
4079
  };
4080
+ /**
4081
+ * Read-only Worker workflow for producing a revision-eligible Backend Test
4082
+ * Analysis v2 contract without crossing into test generation or execution.
4083
+ * The explicit consumer keeps artifact lineage meaningful for safe
4084
+ * continuation: replacing the contract reruns review + deterministic closeout
4085
+ * only.
4086
+ */
4087
+ function buildBackendTestAnalysisHybridDag(sources) {
4088
+ const analysis = buildAnalyzeInputsNode(sources);
4089
+ const contract = buildBackendTestAnalysisContractGateNode(sources);
4090
+ const review = {
4091
+ id: "review-backend-test-analysis-pi",
4092
+ depends_on: [contract.id],
4093
+ role: "reviewer",
4094
+ executor: "pi",
4095
+ complexity: "LOW",
4096
+ writePolicy: "read-only",
4097
+ allowedPaths: commonReadOnlyPaths(sources),
4098
+ forbiddenPaths: commonForbiddenPaths(sources),
4099
+ outputContract: "Concise Markdown review of the validated Backend Test Analysis v2 contract, covering source binding, explicit requirement coverage, evidence gaps, risks, and downstream readiness. No file writes.",
4100
+ subtask_prompt: [
4101
+ "Review the validated run-owned `contracts/backend-test-analysis.json` artifact.",
4102
+ "Treat that structured artifact as the authoritative analysis contract; do not substitute the producer's assistant prose.",
4103
+ "Check that every explicit AC/REQ/BR is represented by acceptanceCriteria or an evidenceGap, source references are precise, and unknown behavior remains an evidence gap rather than an invented requirement.",
4104
+ "Summarize source-binding integrity, coverage, risks, evidence gaps, and whether the contract is ready for a later backend-test generation workflow.",
4105
+ "Read-only: do not modify code, docs, artifacts, or repository files.",
4106
+ ].join("\n\n"),
4107
+ };
4108
+ const closeout = {
4109
+ id: "backend-test-analysis-closeout-static",
4110
+ depends_on: [review.id],
4111
+ role: "closeout",
4112
+ executor: "static",
4113
+ complexity: "LOW",
4114
+ writePolicy: "none",
4115
+ allowedPaths: [],
4116
+ forbiddenPaths: commonForbiddenPaths(sources),
4117
+ outputContract: "Deterministic handoff pointing to the validated analysis contract and its independent read-only review.",
4118
+ subtask_prompt: "Close the read-only analysis workflow after the structured contract and review both succeed.",
4119
+ static: {
4120
+ resultMarkdown: [
4121
+ "# Backend-test analysis closeout",
4122
+ "",
4123
+ "Validated contract: `contracts/backend-test-analysis.json`.",
4124
+ "Independent review: `review-backend-test-analysis-pi`.",
4125
+ ].join("\n"),
4126
+ },
4127
+ };
4128
+ const spec = {
4129
+ version: 3,
4130
+ title: `Backend test analysis DAG: ${sources.taskConfig.title}`,
4131
+ runtimeContract: GENERATED_DAG_RUNTIME_CONTRACT,
4132
+ outputLanguage: sources.outputLanguage ?? DEFAULT_DAG_OUTPUT_LANGUAGE,
4133
+ objective: extractObjective(sources.requirementMarkdown, sources.taskConfig.title),
4134
+ successCriteria: [
4135
+ "A strict Backend Test Analysis v2 contract is materialized with immutable source binding",
4136
+ "Every explicit requirement is covered or preserved as an evidence gap",
4137
+ "An independent read-only review consumes the validated structured artifact",
4138
+ ],
4139
+ globalConstraints: [
4140
+ ...sources.taskConfig.hardConstraints,
4141
+ "This workflow is analysis-only: no repository writer, dynamic expansion, test generation, or test execution is allowed.",
4142
+ ],
4143
+ defaults: {
4144
+ ...BACKEND_TEST_DEFAULTS,
4145
+ contextProfile: sources.taskConfig.contextProfile,
4146
+ },
4147
+ skillsByRole: BACKEND_TEST_SKILLS_BY_ROLE,
4148
+ executorModels: sources.executorModelMatrix ?? DEFAULT_DAG_EXECUTOR_MODELS,
4149
+ verifyStrategy: resolveDagVerifyStrategy(sources.taskConfig),
4150
+ tasks: [analysis, contract, review, closeout],
4151
+ };
4152
+ applyDefaultReadOnlyRetryPolicy(spec);
4153
+ stampGeneratedArtifactBindings(spec);
4154
+ parseDagSpec(spec);
4155
+ assertValidDagSpec(spec);
4156
+ return spec;
4157
+ }
4080
4158
  /**
4081
4159
  * Plan D: gap-fill incremental DAG (mode=gap-fill).
4082
4160
  *
@@ -6784,6 +6862,8 @@ async function buildHybridDagForTemplate(sources, template, options = {}) {
6784
6862
  }
6785
6863
  else if (template === "frontend-test-dag")
6786
6864
  spec = buildFrontendTestHybridDag(sources);
6865
+ else if (template === "backend-test-analysis-dag")
6866
+ spec = buildBackendTestAnalysisHybridDag(sources);
6787
6867
  else if (template === "backend-test-dag")
6788
6868
  spec = await buildBackendTestHybridDag(sources);
6789
6869
  else if (template === "knowledge-sync-dag")
@@ -6828,6 +6908,7 @@ async function buildHybridDagForTemplate(sources, template, options = {}) {
6828
6908
  const GOVERNANCE_DISALLOWED_TEMPLATES = new Set([
6829
6909
  "frontend-implementation",
6830
6910
  "frontend-test-dag",
6911
+ "backend-test-analysis-dag",
6831
6912
  "backend-test-dag",
6832
6913
  "knowledge-sync-dag",
6833
6914
  "knowledge-graph-bootstrap-dag",
@@ -61,7 +61,7 @@ controller identity 与 DAG skill snapshot 是两个不同冻结层(前者跨
61
61
 
62
62
  - schema/validate:`src/worker/task-spec/{schema,validate}.ts`。
63
63
  - 校验验收条件、依赖、验证命令;`agent-worker task validate-feature` 等用之。
64
- - **0.16.0+**:可选 `execution.workflow` 映射到 loop-agent `taskKind`(如 agent-dag / frontend-implementation / backend-test / frontend-test);typed Task Outcome 与 artifact-aware Ready 门禁见 completed `2026-07-19-taskspec-workflow-routing.md`。
64
+ - **0.16.0+**:可选 `execution.workflow` 映射到 loop-agent `taskKind`(agent-dag / frontend-implementation / backend-test-analysis / backend-test / frontend-test);`backend-test-analysis` 只读生成严格 analysis artifact,不执行测试;typed Task Outcome 与 artifact-aware Ready 门禁见 completed `2026-07-19-taskspec-workflow-routing.md`。
65
65
  - 文档映射镜像:`docs/architecture/taskspec-to-loop-agent-mapping.md`(runtime 真源仍在 `src/worker/` 与 materialize 路径)。
66
66
 
67
67
  ### Task Pool
@@ -31,7 +31,7 @@ constraints:
31
31
  hard_constraints:
32
32
  - Do not access production secrets
33
33
  # Explicit runtime workflow → taskKind. For fullstack-v1 packets this should be set
34
- # on every TaskSpec. Allowed: agent-dag | frontend-implementation | backend-test | frontend-test
34
+ # on every TaskSpec. Allowed: agent-dag | frontend-implementation | backend-test-analysis | backend-test | frontend-test
35
35
  execution:
36
36
  workflow: agent-dag
37
37
  verify:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tea-agent/loop-agent",
3
- "version": "0.40.0-beta.1",
3
+ "version": "0.40.0-beta.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "loop-agent": "bin/loop-agent.js",