@tea-agent/loop-agent 0.29.3 → 0.31.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/CHANGELOG.md +60 -0
- package/dist/executors/dag-pi-executor.js +18 -6
- package/dist/worker/observability/dag-execution-trajectory.js +591 -0
- package/dist/worker/observability/read-model.js +258 -31
- package/dist/worker/observe/dag-node-execution-output.js +180 -0
- package/dist/worker/observe/routes.js +53 -6
- package/dist/worker/observe/static/dag-edge-routing.js +368 -0
- package/dist/worker/observe/static/dag-history-labels.js +95 -0
- package/dist/worker/observe/static/dag-layout.d.ts +12 -7
- package/dist/worker/observe/static/dag-layout.js +101 -21
- package/dist/worker/observe/static/favicon.svg +37 -0
- package/dist/worker/observe/static/format.js +31 -1
- package/dist/worker/observe/static/index.html +1 -1
- package/dist/worker/observe/static/state.js +102 -0
- package/dist/worker/observe/static/styles.css +267 -7
- package/dist/worker/observe/static/views/dag-graph.js +414 -154
- package/dist/worker/observe/static/views/dag-inspector.js +478 -27
- package/dist/worker/observe/static/views/dag-trajectory.js +313 -0
- package/dist/worker/observe/static/views/dag.js +20 -3
- package/dist/workflows/dag/backend-test-writer-completeness.js +398 -26
- package/dist/workflows/dag/dynamic-runtime/map.js +10 -4
- package/dist/workflows/dag/init-hybrid.js +228 -229
- package/dist/workflows/dag/node-execution.js +13 -2
- package/dist/workflows/dag/types.js +21 -7
- package/docs/architecture/README.md +4 -0
- package/docs/architecture/dag-execution.md +1 -1
- package/docs/architecture/worker-and-feature.md +1 -1
- package/docs/governance/README.md +3 -0
- package/docs/operations/README.md +1 -0
- package/docs/templates/backend-test-dag.json +664 -460
- package/docs/templates/frontend-test-dag.json +1 -1
- package/harness.json +2 -2
- package/package.json +3 -2
- package/scripts/kb-bootstrap-init-skeleton.sh +1 -1
|
@@ -126,7 +126,7 @@ export function buildNodePrompt(spec, task, upstream, options) {
|
|
|
126
126
|
convergenceFeedback: options?.convergenceFeedback,
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
function buildAttemptPrompt(task, basePrompt, attemptNumber, previousFailureCategory, previousProtocolReason, recoveryTargetPaths) {
|
|
129
|
+
function buildAttemptPrompt(task, basePrompt, attemptNumber, previousFailureCategory, previousProtocolReason, recoveryTargetPaths, recoveryDiagnostics) {
|
|
130
130
|
if (attemptNumber <= 1)
|
|
131
131
|
return basePrompt;
|
|
132
132
|
if (previousFailureCategory === "protocol-invalid" &&
|
|
@@ -152,6 +152,7 @@ function buildAttemptPrompt(task, basePrompt, attemptNumber, previousFailureCate
|
|
|
152
152
|
maxAttempts,
|
|
153
153
|
reason: "T4",
|
|
154
154
|
targetPaths: recoveryTargetPaths,
|
|
155
|
+
diagnostics: recoveryDiagnostics,
|
|
155
156
|
}),
|
|
156
157
|
].join("\n");
|
|
157
158
|
}
|
|
@@ -180,6 +181,7 @@ function buildAttemptPrompt(task, basePrompt, attemptNumber, previousFailureCate
|
|
|
180
181
|
maxAttempts,
|
|
181
182
|
reason: "T3_or_T5",
|
|
182
183
|
targetPaths: recoveryTargetPaths,
|
|
184
|
+
diagnostics: recoveryDiagnostics,
|
|
183
185
|
}),
|
|
184
186
|
].join("\n");
|
|
185
187
|
}
|
|
@@ -636,12 +638,21 @@ export async function executeDagNode(input) {
|
|
|
636
638
|
// or when no progress facts exist yet (no-op).
|
|
637
639
|
const recoveryProgress = await loadBackendTestWriterProgressForRetry(runDir, task.id);
|
|
638
640
|
const recoveryTargetPaths = recoveryProgress?.targetPaths;
|
|
641
|
+
// Fold per-path structural reasons (e.g. T5 "case heading at wrong
|
|
642
|
+
// level") into the retry prompt so the model fixes the exact defect
|
|
643
|
+
// instead of guessing from a generic hint.
|
|
644
|
+
const recoveryDiagnostics = recoveryProgress?.issues
|
|
645
|
+
?.filter((i) => !!i.path && i.recoverable)
|
|
646
|
+
.reduce((acc, i) => {
|
|
647
|
+
(acc[i.path] ??= []).push(i.detail);
|
|
648
|
+
return acc;
|
|
649
|
+
}, {});
|
|
639
650
|
result = await executeNode({
|
|
640
651
|
task,
|
|
641
652
|
cwd,
|
|
642
653
|
model,
|
|
643
654
|
...(thinking ? { thinking } : {}),
|
|
644
|
-
prompt: buildAttemptPrompt(task, prompt, attemptNumber, previousFailureCategory, previousProtocolReason, recoveryTargetPaths),
|
|
655
|
+
prompt: buildAttemptPrompt(task, prompt, attemptNumber, previousFailureCategory, previousProtocolReason, recoveryTargetPaths, recoveryDiagnostics),
|
|
645
656
|
attempt: attemptNumber,
|
|
646
657
|
reportActivity,
|
|
647
658
|
timeoutMs: livenessPolicy.absoluteMaxWallClockMs,
|
|
@@ -326,6 +326,20 @@ export const dagWritePolicySchema = z.enum([
|
|
|
326
326
|
]);
|
|
327
327
|
/** Git/post-diff write guard intensity for exclusive Pi writers. */
|
|
328
328
|
export const dagWriteGuardPolicySchema = z.enum(["full", "tools-only"]);
|
|
329
|
+
/**
|
|
330
|
+
* Fail-closed outcome/diff consistency contract for bounded Pi writers.
|
|
331
|
+
* The writer must begin with IMPLEMENTATION_OUTCOME: changed,
|
|
332
|
+
* already-satisfied, or blocked; the executor checks it against the
|
|
333
|
+
* run-attributed diff. Declared before the dynamic child schema so the
|
|
334
|
+
* child writerOutcomePolicy optional field can reuse it without a TDZ.
|
|
335
|
+
*/
|
|
336
|
+
export const dagWriterOutcomePolicySchema = z
|
|
337
|
+
.object({
|
|
338
|
+
type: z.literal("implementation-outcome-v1"),
|
|
339
|
+
/** Generation writers may forbid already-satisfied/no-diff completion. */
|
|
340
|
+
requireChangedFiles: z.boolean().optional(),
|
|
341
|
+
})
|
|
342
|
+
.strict();
|
|
329
343
|
export const contextPolicyIdSchema = z.enum([
|
|
330
344
|
"baseline-v1",
|
|
331
345
|
"role-specialized-v1",
|
|
@@ -512,7 +526,14 @@ export const dagDynamicExpansionChildTaskSchema = z.object({
|
|
|
512
526
|
allowedPaths: z.array(z.string()).optional().default([]),
|
|
513
527
|
forbiddenPaths: z.array(z.string()).optional().default([]),
|
|
514
528
|
writeSet: z.array(z.string()).optional(),
|
|
529
|
+
/**
|
|
530
|
+
* Materialized-child pass-through fields for bounded Pi writer children
|
|
531
|
+
* (backend-test md/pytest case sharding). All optional so legacy
|
|
532
|
+
* read-only/frontend map children (which never set these) keep parsing.
|
|
533
|
+
*/
|
|
534
|
+
writerOutcomePolicy: dagWriterOutcomePolicySchema.optional(),
|
|
515
535
|
writeGuardPolicy: dagWriteGuardPolicySchema.optional(),
|
|
536
|
+
retryPolicy: dagRetryPolicySchema.optional(),
|
|
516
537
|
});
|
|
517
538
|
export const dagDynamicExpansionSchema = z.object({
|
|
518
539
|
type: z.enum(["map_agent", "verify_agent"]),
|
|
@@ -603,13 +624,6 @@ export const dagDecisionGateSchema = z.object({
|
|
|
603
624
|
schemaVersion: z.literal(1).optional(),
|
|
604
625
|
mode: dagDecisionGateModeSchema.optional().default("record-only"),
|
|
605
626
|
});
|
|
606
|
-
export const dagWriterOutcomePolicySchema = z
|
|
607
|
-
.object({
|
|
608
|
-
type: z.literal("implementation-outcome-v1"),
|
|
609
|
-
/** Generation writers may forbid already-satisfied/no-diff completion. */
|
|
610
|
-
requireChangedFiles: z.boolean().optional(),
|
|
611
|
-
})
|
|
612
|
-
.strict();
|
|
613
627
|
/**
|
|
614
628
|
* The final supervised audit is the sole runtime write authority for its
|
|
615
629
|
* writer. `allowedPaths` remains a ceiling; it is never a writer fallback.
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
5. `worker-and-feature.md` — agent-worker 子进程边界、controller identity、Task Pool、Feature、Observe 与 Console。
|
|
16
16
|
6. `facts-and-state.md` — `.harness/` 各根目录、canonical facts、derived read models 与不可变规则。
|
|
17
17
|
7. `evolution.md` — 当前已实现能力 vs 第 3–6 月未来方向(明确标注规划/未实现)。
|
|
18
|
+
8. `state-and-failure-taxonomy.md` — Task Pool、DAG、Loop 与报告共用的 canonical 状态/失败分类。
|
|
19
|
+
9. `taskspec-to-loop-agent-mapping.md` / `.yaml` — TaskSpec 到 worker/runtime 的兼容合同与机器可读镜像。
|
|
20
|
+
10. `knowledge-graph-and-query-spec.md` — 业务知识图谱、knowledge-links 与查询协议。
|
|
21
|
+
11. `testing-knowledge-base-impl-spec.md` — 测试知识库 schema、ID、读写矩阵和校验规则。
|
|
18
22
|
|
|
19
23
|
## 事实与规划的区分
|
|
20
24
|
|
|
@@ -44,7 +44,7 @@ src/commands/dag-validate.ts runDagValidate
|
|
|
44
44
|
### 专用 taskKind 与模板选择(架构摘要)
|
|
45
45
|
|
|
46
46
|
- `initHybridDagFromTask` 按 `task.json.taskKind`(及前端需求自动分类)选择专用拓扑:`frontend-implementation`、`frontend-test`、`backend-test`、`knowledge-sync`、`knowledge-graph-bootstrap` 等;默认 `standard` 走 governance profile 通用实现链。
|
|
47
|
-
- **backend-test(0.17.x)**:Markdown-first 固定短链(环境硬门 → Markdown 用例/Review → 单次 pytest + HTML → 报告与 L-5);不在本页展开节点清单,见 `docs/
|
|
47
|
+
- **backend-test(0.17.x)**:Markdown-first 固定短链(环境硬门 → Markdown 用例/Review → 单次 pytest + HTML → 报告与 L-5);不在本页展开节点清单,见 `docs/runtime/backend-test-workflow.md` 与 completed markdown-first plan。
|
|
48
48
|
- 专用模板不是新的 governance profile:风险等级仍由 profile 规则判断;写边界仍受 `allowedPaths` / `forbiddenPaths` / `writeSet` 约束。
|
|
49
49
|
|
|
50
50
|
## rank 调度
|
|
@@ -62,7 +62,7 @@ controller identity 与 DAG skill snapshot 是两个不同冻结层(前者跨
|
|
|
62
62
|
- schema/validate:`src/worker/task-spec/{schema,validate}.ts`。
|
|
63
63
|
- 校验验收条件、依赖、验证命令;`agent-worker task validate-feature` 等用之。
|
|
64
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`。
|
|
65
|
-
- 文档映射镜像:`docs/
|
|
65
|
+
- 文档映射镜像:`docs/architecture/taskspec-to-loop-agent-mapping.md`(runtime 真源仍在 `src/worker/` 与 materialize 路径)。
|
|
66
66
|
|
|
67
67
|
### Task Pool
|
|
68
68
|
|
|
@@ -11,5 +11,8 @@
|
|
|
11
11
|
- [`harness-methodology-verification.md`](harness-methodology-verification.md):如何用新鲜命令结果支持完成声明。
|
|
12
12
|
- [`harness-methodology-debugging.md`](harness-methodology-debugging.md):系统化定位故障,不用猜测代替证据。
|
|
13
13
|
- [`document-review-policy.md`](document-review-policy.md):文档 freshness、`reviewTier` 与 `lastReviewed` 更新边界。
|
|
14
|
+
- [`lightweight-github-collaboration.md`](lightweight-github-collaboration.md):短分支、简短 PR、CI 与 Squash Merge 的轻量协作规则。
|
|
15
|
+
- [`研发模式.md`](研发模式.md):Feature 团队推进、交付和知识回写方法论。
|
|
16
|
+
- [`腾讯实践对当前项目的指引.md`](腾讯实践对当前项目的指引.md):外部工程实践与本仓库治理/能力边界的映射。
|
|
14
17
|
|
|
15
18
|
架构事实见 [`../architecture/README.md`](../architecture/README.md),运行手册见 [`../runtime/README.md`](../runtime/README.md),日常维护操作见 [`../operations/README.md`](../operations/README.md)。
|
|
@@ -8,5 +8,6 @@
|
|
|
8
8
|
- [`branch-merge-guideline.md`](branch-merge-guideline.md):按风险选择合并模式并留下 source-SHA 证据。
|
|
9
9
|
- [`github-collaboration.md`](github-collaboration.md):仓库内 GitHub 协作约定及自动/人工发布通道。
|
|
10
10
|
- [`production-readiness.md`](production-readiness.md):交付前的生产就绪判断。
|
|
11
|
+
- [`backend-test-jacoco-coverage.md`](backend-test-jacoco-coverage.md):Java 被测服务挂载 JaCoCo tcpserver agent 的 Maven、`java -jar` 与 Docker 操作手册。
|
|
11
12
|
|
|
12
13
|
验证命令仍以 [`../governance/verification-matrix.md`](../governance/verification-matrix.md) 为准。
|