@abelxiaoxing/cadence 1.0.14 → 1.1.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/README.md +29 -13
- package/agents/contract-reviewer.md +2 -2
- package/agents/design-explorer.md +1 -1
- package/agents/diagnosis-worker.md +6 -3
- package/agents/implementation-worker.md +14 -9
- package/config/.env.example +5 -17
- package/config/routes.example.json +42 -0
- package/package.json +3 -3
- package/prompts/abel-design.md +150 -228
- package/prompts/abel-diagnose.md +37 -18
- package/prompts/abel-implement.md +111 -178
- package/prompts/abel-init.md +36 -33
- package/skills/abel-workflow/SKILL.md +156 -168
- package/src/apply-transaction.ts +1427 -0
- package/src/artifact-store.ts +204 -0
- package/src/child-session.ts +136 -17
- package/src/contracts.ts +105 -696
- package/src/control-contracts.ts +259 -0
- package/src/delivery-compiler.ts +1088 -0
- package/src/file-snapshot.ts +5 -0
- package/src/implement-graph.ts +11 -4
- package/src/index.ts +1465 -133
- package/src/isolation-backend.ts +269 -0
- package/src/packet-runtime.ts +533 -0
- package/src/parent-provider.ts +23 -4
- package/src/route-policy.ts +483 -0
- package/src/run-state.ts +393 -0
- package/src/run-store.ts +918 -0
- package/src/safe-path.ts +11 -0
- package/src/scoped-tools.ts +36 -0
- package/src/state-root.ts +215 -0
- package/src/subagent-activity.ts +526 -27
- package/src/submit-tool.ts +274 -0
- package/src/task-ledger.ts +1380 -0
- package/src/verification-capability.ts +529 -42
- package/src/worker-broker.ts +703 -0
- package/src/workflow-engine.ts +7391 -0
- package/src/workspace-store.ts +544 -0
- package/src/candidate-preflight.ts +0 -1618
- package/src/drain.ts +0 -20
- package/src/patch.ts +0 -505
- package/src/result-store.ts +0 -312
- package/src/runtime.ts +0 -2436
- package/src/scheduler.ts +0 -384
- package/src/subagent-endpoint.ts +0 -158
- package/src/worker.ts +0 -204
package/README.md
CHANGED
|
@@ -3,23 +3,33 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@abelxiaoxing/cadence)
|
|
4
4
|
[](https://github.com/abelxiaoxing/cadence)
|
|
5
5
|
|
|
6
|
-
**Cadence** 是一个面向
|
|
6
|
+
**Cadence** 是一个面向 Pi 的规范驱动四阶段工作流扩展包,内置可恢复的私有代理编排:
|
|
7
7
|
|
|
8
|
-
- `/abel-init [project-path]` —
|
|
9
|
-
- `/abel-design <requirement> | --change <change_name>` —
|
|
10
|
-
- `/abel-implement <change_name>` —
|
|
11
|
-
- `/abel-diagnose <problem-description>` —
|
|
8
|
+
- `/abel-init [project-path]` — 本地、固定顺序且幂等地初始化或安全修复 OpenSpec 与 AGENTS 托管索引,不派发子代理。
|
|
9
|
+
- `/abel-design <requirement> | --change <change_name>` — 使用有界只读证据包解决行为与技术决策,生成经 Gate A(WHAT)和 Gate B(HOW)批准的 canonical delivery;不启动实现 Worker,不运行产品测试,也不修改产品代码。
|
|
10
|
+
- `/abel-implement <change_name>` — 在私有不可变 revision 中执行已批准的 Red-Green-Refactor DAG,累计验证全部任务后才通过一次可恢复事务写入主工作区。
|
|
11
|
+
- `/abel-diagnose <problem-description>` — 独立执行“复现 → 证伪 → 失败回归 → 最小修复”,不充当 Implement 的失败路由。
|
|
12
12
|
|
|
13
13
|
包是独立的:单一仓库、单一清单、单一 lockfile,无 workspace、无参考仓库检出、不依赖任何外部 Subagent 包。
|
|
14
|
-
加载本包会注册一个私有扩展与四个包内专业 Agent;`abel_dispatch`
|
|
14
|
+
加载本包会注册一个私有扩展与四个包内专业 Agent;`abel_dispatch` 工具注册但保持未激活,只有用户显式调用且包来源验证通过的 Design、Implement 或 Diagnose prompt 才会激活它。
|
|
15
|
+
仓库中存在 Abel 文件、OpenSpec change、AGENTS 索引或普通文本都不会启动工作流;Init 也不会激活派发工具。
|
|
15
16
|
|
|
16
|
-
共享工作流规则统一收录于包内 `abel-workflow`
|
|
17
|
+
共享工作流规则统一收录于包内 `abel-workflow` Skill;其发现信息同样明确要求先有显式 `/abel-*` 调用。
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
Implement 只暴露 `start`、`status`、`resume`、`rebind`、`cancel` 和 `discard` 控制命令。
|
|
20
|
+
`status` 完全本地可用;相同 operation id 幂等重放,进程、会话或 Worker 更换后仍从 durable checkpoint 继续。
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
普通 artifact、错误 Red、transport、environment、stale、conflict、baseline 与验证失败都留在同一 Implement run 中恢复。
|
|
23
|
+
累计验证发现 introduced failure 时会自动重开责任任务做有界修复;自动预算耗尽后 `resume` 复用已有 baseline 和 phase facts。
|
|
24
|
+
只有继续工作确实需要新增行为、架构/策略、依赖、路径、资源、验证或 AGENTS 权限时才进入 `approval-needed`;结果不会携带返回 `/abel-design` 的阶段路由。
|
|
21
25
|
|
|
22
|
-
print、JSON 和 RPC
|
|
26
|
+
交互式 TUI、print、JSON 和 RPC 都以 durable semantic state 为准。
|
|
27
|
+
queued、connecting、waiting-first-response、running、validating、retrying、verifying、paused、approval-needed、applying 和 recovering 都不是完成;operation-cancelled 表示本次操作取消但 run 仍可恢复,discarded 与 rejected 是非成功终态。
|
|
28
|
+
只有最终 apply 与 post-apply verification 提交后的 `completed` 才显示成功。
|
|
29
|
+
|
|
30
|
+
私有 journal、artifact 与 change workspace 位于 consumer repository 之外的 owner-private state root。
|
|
31
|
+
暂停会保留最小结构化恢复事实;完成或显式 discard 后安全清理。
|
|
32
|
+
不会持久化凭据、环境值、原始 prompt、隐藏推理、完整子会话或原始模型输出。
|
|
23
33
|
|
|
24
34
|
## 安装(Install)
|
|
25
35
|
|
|
@@ -43,7 +53,13 @@ npm install -g @abelxiaoxing/cadence
|
|
|
43
53
|
- **本地包目录(local package directory)** — 将 Pi 指向本仓库的绝对路径或相对路径(absolute or relative path,例如 `./cadence`),Pi 发现同样的资源。
|
|
44
54
|
- **已安装 tarball 目录(installed tarball directory)** — 运行 `bun pm pack --destination <tmp>` 生成真实 tarball(.tgz),安装或解压到隔离目录后指向该目录;tarball 文件本身永远不会被当作本地包传给 Pi。
|
|
45
55
|
|
|
46
|
-
|
|
56
|
+
本包要求 Node.js `>=22.13.0`,以使用稳定可用的内置 `node:sqlite`;不从参考仓库源安装,也不维护 Pi 主机版本兼容矩阵。
|
|
57
|
+
|
|
58
|
+
## Worker 路由(Worker routes)
|
|
59
|
+
|
|
60
|
+
复制 [`config/routes.example.json`](config/routes.example.json) 到项目级 `.pi/cadence/routes.json` 或用户级 `~/.pi/agent/cadence/routes.json`。
|
|
61
|
+
项目文件按整文件优先;route 必须显式列入对应角色,custom route 只引用 `apiKeyEnv` 的变量名,不能把凭据值写进 JSON。
|
|
62
|
+
`rebind` 只能选择已获 policy 授权且能力匹配的 route,不会扩大任务边界。
|
|
47
63
|
|
|
48
64
|
## 跨项目验证合同(Cross-project verification)
|
|
49
65
|
|
|
@@ -108,8 +124,8 @@ bun run check:agents # AGENTS 索引校验
|
|
|
108
124
|
|
|
109
125
|
```sh
|
|
110
126
|
bun run verify # check && lint && test && pack:check(发布前全套校验)
|
|
111
|
-
bun run pack:check # 真实 tarball
|
|
112
|
-
bun run traceability:check #
|
|
127
|
+
bun run pack:check # 真实 tarball 53 成员清单校验
|
|
128
|
+
bun run traceability:check # 162 条 active Requirement/Scenario 引用精确解析且唯一归属
|
|
113
129
|
```
|
|
114
130
|
|
|
115
131
|
## 许可(License)
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
You are a package-owned read-only professional Agent for terminal and checkpoint review of approved design delivery.
|
|
4
4
|
|
|
5
|
-
You inspect the approved contracts, receipts, hashes, traceability, and task DAG ONLY through the scoped `read`, `grep`, `find`, and `ls` tools.
|
|
5
|
+
You inspect the approved contracts, canonical `ImplementPlan`, receipts, raw and canonical hashes, verification closure, traceability, and task DAG ONLY through the scoped `read`, `grep`, `find`, and `ls` tools.
|
|
6
6
|
You never write, mutate, or run validation.
|
|
7
7
|
|
|
8
8
|
Your output is a compact structured evidence object returned through `abel_submit_result`, containing the review identity, the exact artifact hashes you verified, suite-evidence status, and typed `delivery-invalid` or `approval-boundary` facts (empty when the delivery is sound).
|
|
9
9
|
|
|
10
10
|
You never patch product code, AGENTS files, or task state.
|
|
11
|
-
Review evidence is read-only; the parent resolves it without a stage selection or recovery recommendation from you.
|
|
11
|
+
Review evidence is read-only; the parent resolves it without a stage selection, Gate decision, or recovery recommendation from you.
|
|
@@ -6,7 +6,7 @@ You explore the repository ONLY through the scoped `read`, `grep`, `find`, and `
|
|
|
6
6
|
You have no shell, edit, Git, network, or validation capability, and you never create or modify files.
|
|
7
7
|
|
|
8
8
|
Call `abel_submit_result` exactly once with one structured object.
|
|
9
|
-
Do not emit a second submit, prose, or the
|
|
9
|
+
Do not emit a second submit, prose, or fields outside the declared Design evidence schema.
|
|
10
10
|
The object contains the matching `id`, `role: "design-explorer"`, `kind: "evidence"`, and:
|
|
11
11
|
|
|
12
12
|
- `packet_id` (exactly equal to the request id), `module_name`, `scope`, and
|
|
@@ -6,8 +6,11 @@ You collect evidence and falsify candidate root causes ONLY through the scoped `
|
|
|
6
6
|
You never write, execute commands, or run validation.
|
|
7
7
|
The fixed algorithm order is reproduce, falsify, failing-regression, then minimum-repair.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
An evidence packet submits exactly one compact structured evidence object through `abel_submit_result` with the reported symptoms, candidate causes, confirming or refuting citations, and a supported root-cause conclusion or an explicit evidence gap.
|
|
10
|
+
Only the parent may claim that command-based reproduction succeeded.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
A candidate packet submits exactly one complete unified diff: either the failing regression or, after the parent has verified that regression, the minimum repair.
|
|
13
|
+
It includes task identity, expected parent-owned verification, risks, and typed blockers, and never claims that it ran the verification.
|
|
12
14
|
|
|
13
|
-
You never invent a fix for an unverified root cause,
|
|
15
|
+
You never invent a fix for an unverified root cause, change behavior contracts, select another workflow stage, or prescribe parent recovery.
|
|
16
|
+
Scope-expanding repairs are reported as evidence for a user decision.
|
|
@@ -5,15 +5,20 @@ You are a package-owned read-only professional Agent for `abel-implement` task p
|
|
|
5
5
|
You explore the workspace ONLY through the scoped `read`, `grep`, `find`, and `ls` tools.
|
|
6
6
|
You never write the workspace, run validation, or execute commands.
|
|
7
7
|
|
|
8
|
-
Your output is a complete unified diff
|
|
8
|
+
Your output is a complete unified diff delivered through `abel_submit_result`:
|
|
9
9
|
|
|
10
|
-
- the
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
10
|
+
- copy the attempt-bound `candidateId` from the phase contract;
|
|
11
|
+
- submit the complete diff as one or more ordered `candidate-segment` calls
|
|
12
|
+
containing `candidateId`, a zero-based `sequence`, and raw `text`;
|
|
13
|
+
- after every byte of the diff has been submitted, make exactly one
|
|
14
|
+
`candidate-seal` call containing `candidateId`;
|
|
15
|
+
- never calculate or invent Base64 encodings, byte counts, or hashes; the
|
|
16
|
+
trusted submit tool computes them;
|
|
17
|
+
- the diff covers exactly the declared write set;
|
|
18
|
+
- preserve the expected parent-owned verification contract without claiming a result;
|
|
19
|
+
- use a typed `context-request` for bounded context, task splitting, or an
|
|
20
|
+
approval-boundary blocker instead of submitting a partial diff.
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
If the configured candidate limit is exceeded, the submit tool returns terminal typed `result-limit` with `limitBytes`; never continue with a partial or truncated diff.
|
|
18
23
|
The parent alone reviews, applies, and validates your diff.
|
|
19
|
-
You report candidate facts only and never select parent recovery, workflow
|
|
24
|
+
You report candidate facts only and never claim execution success, select parent recovery, choose a workflow stage, or control the task DAG.
|
package/config/.env.example
CHANGED
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
SUBAGENT_API_URL=
|
|
7
|
-
SUBAGENT_API_KEY=
|
|
8
|
-
SUBAGENT_MODEL=
|
|
9
|
-
# Optional dialect: openai-completions (default), openai-responses, or anthropic-messages.
|
|
10
|
-
# SUBAGENT_API=openai-completions
|
|
11
|
-
# Optional bounds; internal defaults are 256000 and 128000 respectively.
|
|
12
|
-
# SUBAGENT_CONTEXT_WINDOW=256000
|
|
13
|
-
# SUBAGENT_MAX_TOKENS=128000
|
|
14
|
-
|
|
15
|
-
# Per-role layers use the same six suffixes and override the global layer whole:
|
|
16
|
-
# SUBAGENT_<ROLE>_<SUFFIX>, where ROLE is DESIGN_EXPLORER, CONTRACT_REVIEWER,
|
|
17
|
-
# IMPLEMENTATION_WORKER, or DIAGNOSIS_WORKER. Partial/invalid layers fail closed.
|
|
1
|
+
# Worker routing is configured as one whole JSON policy at
|
|
2
|
+
# <project>/.pi/cadence/routes.json or ~/.pi/agent/cadence/routes.json.
|
|
3
|
+
# Copy routes.example.json and reference custom credentials by environment
|
|
4
|
+
# variable name; never place credential values in routes.json.
|
|
5
|
+
CADENCE_CUSTOM_WORKER_API_KEY=
|
|
18
6
|
|
|
19
7
|
# Context7 works anonymously with its default URL. Uncomment the API key for
|
|
20
8
|
# authenticated access, or the URL only when overriding the default endpoint.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"routes": {
|
|
4
|
+
"parent": {
|
|
5
|
+
"kind": "inherited",
|
|
6
|
+
"capabilities": {
|
|
7
|
+
"roles": [
|
|
8
|
+
"design-explorer",
|
|
9
|
+
"contract-reviewer",
|
|
10
|
+
"implementation-worker",
|
|
11
|
+
"diagnosis-worker"
|
|
12
|
+
],
|
|
13
|
+
"dialects": [
|
|
14
|
+
"openai-completions",
|
|
15
|
+
"openai-responses",
|
|
16
|
+
"anthropic-messages"
|
|
17
|
+
],
|
|
18
|
+
"contextWindow": 256000,
|
|
19
|
+
"maxTokens": 128000
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"custom-worker": {
|
|
23
|
+
"kind": "custom",
|
|
24
|
+
"url": "https://example.invalid/v1",
|
|
25
|
+
"model": "example-model",
|
|
26
|
+
"dialect": "openai-responses",
|
|
27
|
+
"apiKeyEnv": "CADENCE_CUSTOM_WORKER_API_KEY",
|
|
28
|
+
"capabilities": {
|
|
29
|
+
"roles": ["implementation-worker"],
|
|
30
|
+
"dialects": ["openai-responses"],
|
|
31
|
+
"contextWindow": 256000,
|
|
32
|
+
"maxTokens": 128000
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"roles": {
|
|
37
|
+
"design-explorer": ["parent"],
|
|
38
|
+
"contract-reviewer": ["parent"],
|
|
39
|
+
"implementation-worker": ["custom-worker", "parent"],
|
|
40
|
+
"diagnosis-worker": ["parent"]
|
|
41
|
+
}
|
|
42
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abelxiaoxing/cadence",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Four explicit Abel workflow prompts with stage-isolated design and diagnosis, durable resumable implementation, and package-owned professional Agents.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": ">=22"
|
|
8
|
+
"node": ">=22.13.0"
|
|
9
9
|
},
|
|
10
10
|
"keywords": [
|
|
11
11
|
"pi-package",
|