@cr1992/agentkit 1.0.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 +12 -0
- package/LICENSE +21 -0
- package/README.en.md +107 -0
- package/README.md +103 -0
- package/bin/agentkit.mjs +4 -0
- package/bin/cli.mjs +273 -0
- package/core/atomic-fs.mjs +23 -0
- package/core/cli-help.mjs +54 -0
- package/core/content-digest.mjs +66 -0
- package/core/digest.mjs +67 -0
- package/core/json-schema-lite.mjs +60 -0
- package/core/legacy-entry.mjs +37 -0
- package/core/reflection.mjs +142 -0
- package/core/runtime-bundle.mjs +101 -0
- package/docs/loop/embedded-review-adapter.md +41 -0
- package/docs/loop/loop-state-machine.md +43 -0
- package/docs/loop/recovery-and-fuses.md +34 -0
- package/docs/orchestrate/dispatch-contract.md +92 -0
- package/docs/orchestrate/failure-routing-and-recovery.md +46 -0
- package/docs/orchestrate/host-capability-cache.md +170 -0
- package/docs/orchestrate/isolation-fallback.md +18 -0
- package/docs/orchestrate/model-routing-config.md +186 -0
- package/docs/orchestrate/orchestration-runtime.md +261 -0
- package/docs/orchestrate/review-budget.md +90 -0
- package/docs/orchestrate/task-playbooks.md +85 -0
- package/docs/orchestrate/user-facing-reporting.md +14 -0
- package/docs/verify/evidence-schema.md +167 -0
- package/docs/verify/input-preparation.md +44 -0
- package/docs/verify/verification-protocol.md +76 -0
- package/docs/worktree/batch-integration.md +176 -0
- package/docs/worktree/delivery-identity.md +41 -0
- package/docs/worktree/profile.md +107 -0
- package/docs/worktree/reclaim-and-watch.md +96 -0
- package/docs/worktree/review-lifecycle.md +92 -0
- package/docs/worktree/spawn-and-stack.md +74 -0
- package/domains/loop/loop-runtime.mjs +1056 -0
- package/domains/orchestrate/contract-tool.mjs +169 -0
- package/domains/orchestrate/host_capability_cache.mjs +437 -0
- package/domains/orchestrate/orchestration-ledger.mjs +332 -0
- package/domains/orchestrate/orchestration-metadata.mjs +4 -0
- package/domains/orchestrate/orchestration-reflection.mjs +119 -0
- package/domains/orchestrate/resolve_model_policy.mjs +311 -0
- package/domains/orchestrate/review-budget.mjs +162 -0
- package/domains/orchestrate/worker-capability-preflight.mjs +227 -0
- package/domains/verify/verification-runtime.mjs +1638 -0
- package/domains/worktree/worktree-archive.mjs +135 -0
- package/domains/worktree/worktree-artifact.mjs +123 -0
- package/domains/worktree/worktree-batch-integrate.mjs +713 -0
- package/domains/worktree/worktree-batch-plan.mjs +198 -0
- package/domains/worktree/worktree-batch-result.mjs +241 -0
- package/domains/worktree/worktree-core.mjs +908 -0
- package/domains/worktree/worktree-doctor.mjs +493 -0
- package/domains/worktree/worktree-history.mjs +377 -0
- package/domains/worktree/worktree-learning.mjs +110 -0
- package/domains/worktree/worktree-lifecycle.mjs +786 -0
- package/domains/worktree/worktree-merge-preview.mjs +409 -0
- package/domains/worktree/worktree-mgr.mjs +261 -0
- package/domains/worktree/worktree-process.mjs +55 -0
- package/domains/worktree/worktree-profile.mjs +800 -0
- package/domains/worktree/worktree-provider-gitlab.mjs +59 -0
- package/domains/worktree/worktree-reclaim.mjs +683 -0
- package/domains/worktree/worktree-review-refresh.mjs +574 -0
- package/domains/worktree/worktree-review-watch.mjs +661 -0
- package/domains/worktree/worktree-scan.mjs +510 -0
- package/domains/worktree/worktree-trace-test-worker.mjs +23 -0
- package/domains/worktree/worktree-trace.mjs +478 -0
- package/manage-worktrees/SKILL.md +87 -0
- package/manage-worktrees/agents/openai.yaml +4 -0
- package/manage-worktrees/scripts/worktree-mgr.mjs +10 -0
- package/manage-worktrees/scripts/worktree-scan.mjs +10 -0
- package/orchestrate-subagents/SKILL.md +173 -0
- package/orchestrate-subagents/agents/openai.yaml +4 -0
- package/orchestrate-subagents/scripts/contract-tool.mjs +10 -0
- package/orchestrate-subagents/scripts/host_capability_cache.mjs +10 -0
- package/orchestrate-subagents/scripts/orchestration-ledger.mjs +10 -0
- package/orchestrate-subagents/scripts/orchestration-reflection.mjs +10 -0
- package/orchestrate-subagents/scripts/resolve_model_policy.mjs +10 -0
- package/orchestrate-subagents/scripts/review-budget.mjs +10 -0
- package/orchestrate-subagents/scripts/worker-capability-preflight.mjs +10 -0
- package/package.json +48 -0
- package/run-agent-verify-loop/SKILL.md +127 -0
- package/run-agent-verify-loop/agents/openai.yaml +4 -0
- package/run-agent-verify-loop/scripts/loop-runtime.mjs +10 -0
- package/schemas/artifact-ref-v1.schema.json +23 -0
- package/schemas/batch-result-v1.schema.json +138 -0
- package/schemas/controller-recheck-record-v1.schema.json +22 -0
- package/schemas/convergence-report-v1.schema.json +9 -0
- package/schemas/effective-worker-capability-v1.schema.json +36 -0
- package/schemas/embedded-verification-record-v1.schema.json +32 -0
- package/schemas/evidence-package-v1.schema.json +41 -0
- package/schemas/improvement-proposal-v1.schema.json +18 -0
- package/schemas/loop-state-v1.schema.json +34 -0
- package/schemas/model-policy-resolution-v1.schema.json +41 -0
- package/schemas/orchestration-ledger-v1.schema.json +110 -0
- package/schemas/reflection-record-v1.schema.json +24 -0
- package/schemas/review-result-v1.schema.json +37 -0
- package/schemas/task-contract-v1.schema.json +83 -0
- package/schemas/verification-profile-v1.schema.json +60 -0
- package/schemas/worker-capability-requirements-v1.schema.json +21 -0
- package/schemas/worktree-binding-v1.schema.json +14 -0
- package/shell-manifest.json +79 -0
- package/verify-agent-output/SKILL.md +119 -0
- package/verify-agent-output/agents/openai.yaml +4 -0
- package/verify-agent-output/scripts/verification-runtime.mjs +10 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": 1,
|
|
3
|
+
"package_name": "@cr1992/agentkit",
|
|
4
|
+
"package_version": "1.0.0",
|
|
5
|
+
"cli": {
|
|
6
|
+
"command": "agentkit",
|
|
7
|
+
"entry": "bin/agentkit.mjs"
|
|
8
|
+
},
|
|
9
|
+
"skills": {
|
|
10
|
+
"orchestrate-subagents": {
|
|
11
|
+
"domain": "orchestrate",
|
|
12
|
+
"shell": "orchestrate-subagents/SKILL.md",
|
|
13
|
+
"entries": {
|
|
14
|
+
"contract-tool.mjs": {
|
|
15
|
+
"target": "domains/orchestrate/contract-tool.mjs",
|
|
16
|
+
"mutates_state": false
|
|
17
|
+
},
|
|
18
|
+
"host_capability_cache.mjs": {
|
|
19
|
+
"target": "domains/orchestrate/host_capability_cache.mjs",
|
|
20
|
+
"read_only_commands": ["status"]
|
|
21
|
+
},
|
|
22
|
+
"orchestration-ledger.mjs": {
|
|
23
|
+
"target": "domains/orchestrate/orchestration-ledger.mjs",
|
|
24
|
+
"read_only_commands": ["batch-status", "status", "inspect", "doctor"]
|
|
25
|
+
},
|
|
26
|
+
"orchestration-reflection.mjs": {
|
|
27
|
+
"target": "domains/orchestrate/orchestration-reflection.mjs",
|
|
28
|
+
"read_only_commands": []
|
|
29
|
+
},
|
|
30
|
+
"resolve_model_policy.mjs": {
|
|
31
|
+
"target": "domains/orchestrate/resolve_model_policy.mjs",
|
|
32
|
+
"mutates_state": false
|
|
33
|
+
},
|
|
34
|
+
"review-budget.mjs": {
|
|
35
|
+
"target": "domains/orchestrate/review-budget.mjs",
|
|
36
|
+
"mutates_state": false
|
|
37
|
+
},
|
|
38
|
+
"worker-capability-preflight.mjs": {
|
|
39
|
+
"target": "domains/orchestrate/worker-capability-preflight.mjs",
|
|
40
|
+
"mutates_state": false
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"manage-worktrees": {
|
|
45
|
+
"domain": "worktree",
|
|
46
|
+
"shell": "manage-worktrees/SKILL.md",
|
|
47
|
+
"entries": {
|
|
48
|
+
"worktree-mgr.mjs": {
|
|
49
|
+
"target": "domains/worktree/worktree-mgr.mjs",
|
|
50
|
+
"read_only_commands": ["list", "plan-batch", "audit", "doctor", "binding", "artifact", "verify-artifact"]
|
|
51
|
+
},
|
|
52
|
+
"worktree-scan.mjs": {
|
|
53
|
+
"target": "domains/worktree/worktree-scan.mjs",
|
|
54
|
+
"mutates_state": false
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"verify-agent-output": {
|
|
59
|
+
"domain": "verify",
|
|
60
|
+
"shell": "verify-agent-output/SKILL.md",
|
|
61
|
+
"entries": {
|
|
62
|
+
"verification-runtime.mjs": {
|
|
63
|
+
"target": "domains/verify/verification-runtime.mjs",
|
|
64
|
+
"read_only_commands": ["scaffold", "prepare", "digest", "readiness", "preflight", "review-input", "review-bundle", "status", "inspect", "validate", "doctor"]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"run-agent-verify-loop": {
|
|
69
|
+
"domain": "loop",
|
|
70
|
+
"shell": "run-agent-verify-loop/SKILL.md",
|
|
71
|
+
"entries": {
|
|
72
|
+
"loop-runtime.mjs": {
|
|
73
|
+
"target": "domains/loop/loop-runtime.mjs",
|
|
74
|
+
"read_only_commands": ["status", "inspect", "validate", "doctor"]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verify-agent-output
|
|
3
|
+
description: "对冻结的单一 Git Artifact 执行一次独立验收,运行 L0、隔离 reviewer 证伪并生成 Evidence。当用户要求固定 commit/SHA 的一次性 review 时使用;多节点编排、自动修复和反复验收不适用。"
|
|
4
|
+
metadata:
|
|
5
|
+
requires:
|
|
6
|
+
bins: ["agentkit"]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# verify-agent-output:一次性独立验收
|
|
10
|
+
|
|
11
|
+
只验证一个冻结 Artifact 一次,不修改业务产物,不自动重试,也不宣布全局任务完成。
|
|
12
|
+
|
|
13
|
+
## 控制权与组合边界
|
|
14
|
+
|
|
15
|
+
- 当前会话或 `orchestrate-subagents` 担任 controller,负责目标、授权、provider 选择和最终完成判断。
|
|
16
|
+
- 本 Skill 只拥有 `smoke L0 → 独立 L1 → final L0 → Evidence` 状态机。
|
|
17
|
+
- 与 `manage-worktrees` 组合时消费其 Artifact Ref;没有时接受调用方提供的 clean pinned Git workdir。
|
|
18
|
+
- 与 `run-agent-verify-loop` 组合时只返回 Evidence;是否进入下一 iteration 由 Loop 决定。
|
|
19
|
+
- 单 Artifact、单 reviewer、只验一次时直接使用本 Skill,不为此启动全局 orchestrator。
|
|
20
|
+
- 分支仍在快速演进、review 后会立即修复时,不启动本 Skill。可以由 controller 派新上下文做迭代期
|
|
21
|
+
只读 review,但该结果只是 `controller_recheck` / advisory,不能冒充标准 Evidence 或
|
|
22
|
+
`independent_evidence`。RC、合入候选等终审边界先冻结唯一 Artifact,再运行本 Skill 全流程。
|
|
23
|
+
|
|
24
|
+
## 前置条件
|
|
25
|
+
|
|
26
|
+
controller 必须先提供:
|
|
27
|
+
|
|
28
|
+
1. 冻结的 JSON Task Contract,含稳定且唯一的 `acceptance[].contract_item_id`;
|
|
29
|
+
2. 冻结的 JSON Verification Profile,只使用 argv 数组定义 L0;
|
|
30
|
+
3. 精确 Git Artifact Ref:完整 `base_sha`、`artifact_sha`、object format 与 repository identity;
|
|
31
|
+
4. clean workdir,`HEAD == artifact_sha`;
|
|
32
|
+
5. 新上下文 reviewer,或由用户中继的第二会话。只有当前实现者上下文时停止,不得伪造独立验收。
|
|
33
|
+
|
|
34
|
+
详细 envelope 与字段规则见 [Evidence schema](../docs/verify/evidence-schema.md)。进入 L1 前必须完整读取
|
|
35
|
+
[验收协议](../docs/verify/verification-protocol.md)。
|
|
36
|
+
|
|
37
|
+
## 标准流程
|
|
38
|
+
|
|
39
|
+
输入已冻结时使用 happy path:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
agentkit verify capabilities
|
|
43
|
+
agentkit verify prepare-run \
|
|
44
|
+
--contract contract.json --profile profile.json --artifact artifact.json \
|
|
45
|
+
--workdir <clean-pinned-workdir> --state-root <repo-outside-state-root> \
|
|
46
|
+
--isolation-assurance host_reported
|
|
47
|
+
agentkit verify run-smoke --run <run-dir>
|
|
48
|
+
agentkit verify review-input --run <run-dir>
|
|
49
|
+
agentkit verify review-bundle \
|
|
50
|
+
--run <run-dir> --out review-bundle.json
|
|
51
|
+
agentkit verify record-review \
|
|
52
|
+
--run <run-dir> --stdin \
|
|
53
|
+
--verifier-run-id <opaque-id> --isolation-assurance host_reported
|
|
54
|
+
agentkit verify run-final --run <run-dir>
|
|
55
|
+
agentkit verify validate --run <run-dir>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
所有子命令支持 `--help`;写命令支持 `--expected-revision`。尚未准备输入、happy path 失败或需要完整
|
|
59
|
+
诊断时,先读 [输入准备与诊断命令](../docs/verify/input-preparation.md)。readiness/preflight 失败属于环境
|
|
60
|
+
前提,不得记录为 Artifact verdict。
|
|
61
|
+
|
|
62
|
+
## 状态与裁决
|
|
63
|
+
|
|
64
|
+
固定顺序:
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
initialized → smoke_passed → review_recorded → terminal
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
- smoke 失败:`fail`,不进入 L1;
|
|
71
|
+
- L1 `fail`:必须有可复现 finding,终止本次验证;
|
|
72
|
+
- L1 `undecidable`:终止并升级,不猜测、不自动重试;
|
|
73
|
+
- safety finding:`blocked_safety`,不能被其他检查抵消;
|
|
74
|
+
- L1 `no_defect_found` 后必须在同一 Artifact 执行 final L0;
|
|
75
|
+
- final 全绿才可输出 `pass`;`pass` 只表示 `completion_scope: verification_only`。
|
|
76
|
+
|
|
77
|
+
任何 Git 身份变化、dirty workdir、Skill 内容漂移、provider 不兼容或日志完整性错误进入 operational
|
|
78
|
+
`aborted`,不冒充 Artifact verdict。修复后创建新 run;不要原地续写旧 Evidence。
|
|
79
|
+
|
|
80
|
+
## 独立 reviewer
|
|
81
|
+
|
|
82
|
+
给 reviewer 的输入只包含 Contract、Profile 生成的验证入口、Artifact 和去除实现者叙事的 reviewer
|
|
83
|
+
view。不得传实现过程对话、“已经测试通过”等自述或期待通过的暗示。
|
|
84
|
+
|
|
85
|
+
`review-input` 顶层直接提供 `contract_digest` 与 `verification_profile_digest`,reviewer 不得从其他
|
|
86
|
+
文件补抄绑定元数据;`review-bundle` 在此之上补齐提示词、schema、权限与停止条件,是推荐的派发形式。reviewer 主动寻找不满足合同的证据,输出 Review Result v1。controller 负责把 reviewer 的 JSON 写入
|
|
87
|
+
`record-review --stdin`;runtime 在 reviewer 未提供 digest 时自动规范化并补上摘要。也可继续使用
|
|
88
|
+
`--review <file>` 保存显式中间件;两种输入互斥,stdin 有大小上限并拒绝交互式 TTY 等待。runtime
|
|
89
|
+
机械拒绝未知 acceptance ID、无证据 finding、无 forensics 的 `no_defect_found` 和 digest/binding
|
|
90
|
+
不匹配。
|
|
91
|
+
|
|
92
|
+
## Evidence 与恢复
|
|
93
|
+
|
|
94
|
+
- state root 默认放仓库外;仓库内落状态必须获得用户许可。
|
|
95
|
+
- runtime 先脱敏再持久化日志,按内容摘要 write-new,不保存原始未脱敏日志。
|
|
96
|
+
- event journal 是恢复真源;snapshot 丢失或落后时从最后一个完整 event 恢复。
|
|
97
|
+
- Evidence 绑定 Contract、Profile、repository、Artifact、reviewer provenance 和三阶段结果。
|
|
98
|
+
- `validate` 重算所有摘要;`doctor` 检查 journal、snapshot、Skill drift 与 Evidence 一致性。
|
|
99
|
+
|
|
100
|
+
## 信任边界
|
|
101
|
+
|
|
102
|
+
state root 只应由 controller/operator 与本 runtime 写入。event journal 的 digest chain 能发现部分、
|
|
103
|
+
追加、乱序和意外损坏,但不是签名或外部审计锚;能重写整个 state root 的 writer 可制造另一条自洽
|
|
104
|
+
历史。Review `challenge_nonce` 只拒绝未经修改的跨 run 重放,`host_reported` isolation assurance 是
|
|
105
|
+
调用方声明,不证明宿主隔离。safety 在当前冻结 run 内优先且不可抵消;同一 Artifact 跨新 run 的
|
|
106
|
+
安全记忆由上层台账或维护流程负责。L0 的 executable 与所有实际存在的 argv 文件参数都会冻结参数
|
|
107
|
+
路径、realpath 和内容;workdir 内参数还同时受 clean pinned Git Artifact 约束。
|
|
108
|
+
|
|
109
|
+
runtime 不派发 Agent、不创建 worktree、不运行 shell command string、不下载依赖,也不修改 Artifact。
|
|
110
|
+
|
|
111
|
+
## 反思与受控改进
|
|
112
|
+
|
|
113
|
+
只在漏检、误报、`undecidable`、runtime abort、用户纠正或协议冲突等事件出现时记录 Reflection;
|
|
114
|
+
普通成功步骤不做长复盘。每个 evidence ref 都必须能在 state 目录内重算摘要;无稳定证据的观察只能
|
|
115
|
+
标为 low confidence。Reflection 禁止保存 chain-of-thought,并在写盘前脱敏凭证与本地路径。
|
|
116
|
+
|
|
117
|
+
`propose-improvement` 只能基于当前 run 已登记且带证据的 Reflection,输出不可变
|
|
118
|
+
`lifecycle: proposed` 候选。它不能修改 Skill、Profile、Evidence、verdict 或当前运行状态语义。
|
|
119
|
+
具体命令使用 `record-reflection/propose-improvement --help`。
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// 1.x 兼容入口。本 Skill 的运行时已迁入 domains/verify/,此处只做固定转发,不含实现。
|
|
3
|
+
// 直接执行时行为与 domains/verify/verification-runtime.mjs 逐字节一致;被 import 时只透传导出。
|
|
4
|
+
import { forwardLegacyEntry } from '../../core/legacy-entry.mjs';
|
|
5
|
+
import { runCli } from '../../domains/verify/verification-runtime.mjs';
|
|
6
|
+
|
|
7
|
+
export * from '../../domains/verify/verification-runtime.mjs';
|
|
8
|
+
|
|
9
|
+
const status = forwardLegacyEntry(import.meta.url, runCli);
|
|
10
|
+
if (status !== undefined) process.exitCode = status;
|