@cr1992/agentkit 1.1.1 → 1.2.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 +108 -0
- package/README.en.md +2 -1
- package/README.md +2 -1
- package/bin/cli.mjs +229 -2
- package/core/contract-scaffold.mjs +37 -0
- package/core/contract-substance.mjs +134 -0
- package/core/ledger-pointer.mjs +210 -0
- package/docs/orchestrate/contract-interview.md +175 -0
- package/docs/orchestrate/orchestration-runtime.md +123 -5
- package/docs/verify/input-preparation.md +32 -1
- package/docs/verify/verification-protocol.md +3 -0
- package/docs/worktree/spawn-and-stack.md +20 -0
- package/domains/loop/loop-runtime.mjs +11 -3
- package/domains/orchestrate/contract-interview.mjs +448 -0
- package/domains/orchestrate/contract-tool.mjs +78 -6
- package/domains/orchestrate/orchestration-ledger.mjs +216 -24
- package/domains/orchestrate/orchestration-metadata.mjs +17 -1
- package/domains/verify/verification-runtime.mjs +37 -18
- package/domains/worktree/worktree-lifecycle.mjs +23 -1
- package/domains/worktree/worktree-mgr.mjs +8 -2
- package/manage-worktrees/SKILL.md +1 -1
- package/orchestrate-subagents/SKILL.md +6 -2
- package/package.json +3 -3
- package/schemas/ledger-pointer-v1.schema.json +16 -0
- package/schemas/orchestration-ledger-v1.schema.json +18 -1
- package/shell-manifest.json +1 -1
|
@@ -61,7 +61,7 @@ manager 的 trace/common-dir 状态只应由受信 operator/controller 与 runti
|
|
|
61
61
|
| 恢复/盘点 | `watch-service status` → `resume-all` → `list` → `doctor` | 常驻服务未安装时只报告并建议 `watch-service install`,不得用 `--no-watch` 顶替;`list/doctor` 只读;`UNTRACKED` 不等于无人使用;`EPHEMERAL` 优先 commit+push;任何 error 都暂停 `spawn/adopt` |
|
|
62
62
|
| 碰撞扫描 | `scan --target <paths>` | `COLLIDE`、范围不确定或重做昂贵时隔离;`CLEAR` 仅在 owner 明确且改动小时共享;低置信后缀匹配先人工核对路径基准 |
|
|
63
63
|
| 交付身份 | 选择复用/并存/替代 | branch、MR 或目录名不同不能单独证明独立交付;同一 agent 有存量树或需要替代时读交付身份(`agentkit docs worktree delivery-identity`) |
|
|
64
|
-
| 创建/接管 | `spawn <semantic-slug>` / `adopt <path>` | 使用真实 agent-id,不猜身份;task 至少两个 lowercase
|
|
64
|
+
| 创建/接管 | `spawn <semantic-slug>` / `adopt <path>` | 使用真实 agent-id,不猜身份;task 至少两个 lowercase 语义分词;属于某次编排时带 `--ledger <id>`,好让 `agentkit status` 收窄到那一个;base、root、堆叠、rebase/retarget 读创建与堆叠(`agentkit docs worktree spawn-and-stack`) |
|
|
65
65
|
| 更新/交接 | `touch` / `handoff` / `refresh-review` | `ready_for_review` 默认武装冻结 HEAD;handoff 只接受 clean、已 push 边界,禁止 stash 搬运;读评审生命周期(`agentkit docs worktree review-lifecycle`) |
|
|
66
66
|
| 审计/提交 | `audit` / `submit` | portable core 不决定 MR/PR 或直推策略;先服从目标仓规则,再原子登记 change request 与 watcher target |
|
|
67
67
|
| 批量集成 | `plan-batch` → `batch-integrate` → `batch-step` → `batch-result` | 同仓同 target:≥3 默认聚合,2 个仅在碰撞时;只合成冻结 SHA,不代跑门禁;合同/顺序/target 变化即重规划;读批量集成(`agentkit docs worktree batch-integration`) |
|
|
@@ -10,6 +10,7 @@ metadata:
|
|
|
10
10
|
|
|
11
11
|
提供宿主无关的拆解、派发、控制和验收协议。最强适配模型持续担任 controller,掌握
|
|
12
12
|
`Plan → Delegate → Observe → Re-plan → Verify → Finish`;不得派生另一个 agent 接管控制面或最终判断。
|
|
13
|
+
新会话冷启动或接手已有任务时先跑 `agentkit status`,找回本仓未终态的 ledger。
|
|
13
14
|
|
|
14
15
|
## 组合协议
|
|
15
16
|
|
|
@@ -40,7 +41,8 @@ controller 始终拥有闭环对象、完成标准、任务图、依赖/barrier
|
|
|
40
41
|
和最终答复时更新,无活跃 worker 明示为 0,不虚构百分比。字段与状态变换见
|
|
41
42
|
编排运行时(`agentkit docs orchestrate orchestration-runtime`)「派发台账的三张表」。台账也是回收清单:收口前
|
|
42
43
|
确认没有孤儿 worker/worktree/运行时资源。任务图与台账只写仓库外会话状态;完整档用 mechanical
|
|
43
|
-
ledger
|
|
44
|
+
ledger,闭环后 `agentkit orchestrate ledger close` 收口,放弃或升级后 drift 的用
|
|
45
|
+
`close --abandon --reason <text>`;轻量档用单一 JSON 快照,闭环后清理。
|
|
44
46
|
|
|
45
47
|
### 档位无关的有效能力预检
|
|
46
48
|
|
|
@@ -64,7 +66,9 @@ Reflection 使用 `agentkit orchestrate reflection record/propose`,通用 Skil
|
|
|
64
66
|
### 完整档机械台账工具
|
|
65
67
|
|
|
66
68
|
不满足轻量档时使用 `orchestration_mode: full`。先用 `agentkit contract normalize / validate / digest /
|
|
67
|
-
review-view / diff` 固定公共 Task Contract
|
|
69
|
+
review-view / diff` 固定公共 Task Contract——需求还没逼问成可冻结的契约时,先用
|
|
70
|
+
`agentkit contract interview-*` 访谈(`agentkit docs orchestrate contract-interview`)——再以仓库外
|
|
71
|
+
state root 初始化 `agentkit orchestrate ledger`。
|
|
68
72
|
脚本不直接派发 Agent,controller 把宿主回执写入 `dispatch-record`。节点必须选择
|
|
69
73
|
`worker_self_check`、`controller_recheck`、`independent_evidence`,只读 critic/scout 用
|
|
70
74
|
`not_applicable`;依赖/barrier 未通过不派下游。命令、schema、`--expected-revision`、state root 信任
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cr1992/agentkit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Agent engineering toolkit: orchestration, git worktree isolation, independent verification and bounded verify loops.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
},
|
|
18
18
|
"type": "module",
|
|
19
19
|
"bin": {
|
|
20
|
-
"agentkit": "
|
|
20
|
+
"agentkit": "bin/agentkit.mjs"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=22"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"validate": "node tools/validate-skills.mjs",
|
|
27
|
-
"test": "node tools/validate-skills.mjs && node --test tests/*.test.mjs domains/*/*.test.mjs scripts/*.test.mjs",
|
|
27
|
+
"test": "node tools/validate-skills.mjs && node --test tests/*.test.mjs domains/*/*.test.mjs scripts/*.test.mjs evals/*/tests/*.test.mjs",
|
|
28
28
|
"pack:check": "npm pack --dry-run"
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://agent-skills.local/schemas/ledger-pointer-v1.schema.json",
|
|
4
|
+
"title": "Ledger Pointer v1",
|
|
5
|
+
"description": "仓级 ledger 指针,落盘于 <git-common-dir>/agentkit/ledgers/<ledger_id>.json。只回答 ledger 在哪,不是任何状态的真源:state_root 之外的字段仅用于展示与交叉核对,判定一律回读 state root 的事件链。",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["schema_version", "ledger_id", "state_root", "contract_digest", "created_at"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"schema_version": { "const": 1 },
|
|
11
|
+
"ledger_id": { "type": "string", "minLength": 1, "pattern": "^[A-Za-z0-9._-]+$" },
|
|
12
|
+
"state_root": { "type": "string", "minLength": 1, "description": "ledger state root 的绝对路径;ledger 目录为 <state_root>/ledgers/<ledger_id>。" },
|
|
13
|
+
"contract_digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$", "description": "init 时冻结的 Task Contract 摘要,只用于展示与交叉核对。" },
|
|
14
|
+
"created_at": { "type": "string", "minLength": 1 }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://agent-skills.local/schemas/orchestration-ledger-v1.schema.json", "title": "Orchestration Ledger v1", "type": "object", "required": ["schema_version", "runtime_version", "ledger_id", "revision", "contract_digest", "nodes", "edges", "attachments", "batches", "reflection_refs", "improvement_proposal_refs", "skill_provenance", "created_at", "updated_at"], "properties": { "schema_version": { "const": 1 }, "runtime_version": { "type": "string" }, "ledger_id": { "type": "string" }, "revision": { "type": "integer" }, "contract_digest": { "type": "string" }, "nodes": { "type": "object", "additionalProperties": { "$ref": "#/$defs/node" } }, "edges": { "type": "array" }, "attachments": { "type": "array", "items": { "$ref": "#/$defs/attachment" } }, "batches": { "type": "object" }, "reflection_refs": { "type": "array" }, "improvement_proposal_refs": { "type": "array" }, "skill_provenance": { "type": "object" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" } }, "additionalProperties": false,
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://agent-skills.local/schemas/orchestration-ledger-v1.schema.json", "title": "Orchestration Ledger v1", "type": "object", "required": ["schema_version", "runtime_version", "ledger_id", "revision", "contract_digest", "nodes", "edges", "attachments", "batches", "reflection_refs", "improvement_proposal_refs", "skill_provenance", "created_at", "updated_at"], "properties": { "schema_version": { "const": 1 }, "runtime_version": { "type": "string" }, "ledger_id": { "type": "string" }, "revision": { "type": "integer" }, "contract_digest": { "type": "string" }, "nodes": { "type": "object", "additionalProperties": { "$ref": "#/$defs/node" } }, "edges": { "type": "array" }, "attachments": { "type": "array", "items": { "$ref": "#/$defs/attachment" } }, "batches": { "type": "object" }, "reflection_refs": { "type": "array" }, "improvement_proposal_refs": { "type": "array" }, "skill_provenance": { "type": "object" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" }, "lifecycle": { "$ref": "#/$defs/lifecycle" } }, "additionalProperties": false,
|
|
3
3
|
"$defs": {
|
|
4
|
+
"lifecycle": {
|
|
5
|
+
"description": "v1.2 新增的可选终态。缺省表示 ledger 仍然活跃;v1.1 及更早的快照没有这个字段,仍然合法。终态之后任务图冻结,只剩 record-reflection / propose-improvement / rebuild / doctor / status / inspect / batch-status。",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["state", "closed_at", "reason", "closed_by_content_digest", "skill_drift_at_close"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"state": { "enum": ["closed", "abandoned"] },
|
|
10
|
+
"closed_at": { "type": "string" },
|
|
11
|
+
"reason": { "description": "abandoned 必填非空;closed 固定为 null。", "type": ["string", "null"] },
|
|
12
|
+
"closed_by_content_digest": { "description": "写入终态事件时的 runtime 内容摘要;skill_drift_at_close 为 true 时它与 skill_provenance.content_digest 不同,标明这条终态由 drift 的 runtime 写入。", "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
|
|
13
|
+
"skill_drift_at_close": { "type": "boolean" }
|
|
14
|
+
},
|
|
15
|
+
"additionalProperties": false,
|
|
16
|
+
"allOf": [
|
|
17
|
+
{ "if": { "properties": { "state": { "const": "abandoned" } }, "required": ["state"] }, "then": { "properties": { "reason": { "type": "string", "minLength": 1 } } } },
|
|
18
|
+
{ "if": { "properties": { "state": { "const": "closed" } }, "required": ["state"] }, "then": { "properties": { "reason": { "type": "null" } } } }
|
|
19
|
+
]
|
|
20
|
+
},
|
|
4
21
|
"attachment": {
|
|
5
22
|
"type": "object",
|
|
6
23
|
"required": ["attachment_id", "node_id", "type", "digest", "ref"],
|