@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,74 @@
|
|
|
1
|
+
# Spawn、命名与堆叠分支
|
|
2
|
+
|
|
3
|
+
创建新 worktree,或对堆叠分支执行 `rebase/retarget` 时读取。接管已有树使用 `adopt`,不加载本文件。
|
|
4
|
+
|
|
5
|
+
## 命名门禁
|
|
6
|
+
|
|
7
|
+
1. task 是至少两个连字符分词的 lowercase semantic slug,如 `ci-gate-hardening`。
|
|
8
|
+
2. 禁止纯编号、UUID、hash、日期或无业务语义缩写。
|
|
9
|
+
3. 可见 branch/path 包含完整 host 与 task;trace UUID/session ID 只进入 metadata。
|
|
10
|
+
4. `spawn` 回显的 task、branch、path、base 必须符合 primary Profile,不一致即停止。
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
agentkit worktree spawn ci-gate-hardening \
|
|
14
|
+
--agent codex --agent-id <real-thread-id> \
|
|
15
|
+
--owner <human-owner> --purpose "加固 CI 门禁" --codegraph auto
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
CodeGraph 在交互 TTY 中保留原生进度;Agent、CI 和其他非 TTY 调用捕获其 stdout/stderr,成功时只输出
|
|
19
|
+
manager 的一行摘要,失败时只返回有界错误,避免 ANSI 进度条占满工具上下文。
|
|
20
|
+
|
|
21
|
+
`agent-id` 必须来自宿主真实 session/thread/task ID,不得编造。相同会话已有其他树时,先按
|
|
22
|
+
[delivery-identity.md](delivery-identity.md) 判断复用、并存或替代。
|
|
23
|
+
|
|
24
|
+
## Root 与 branch
|
|
25
|
+
|
|
26
|
+
无 Profile 时:base 按 remote HEAD、`origin/main`、`origin/master`、upstream、HEAD 依次选择;branch
|
|
27
|
+
为 `{host}/{task}`;root 按 `--root`、`WORKTREE_ROOT`、Profile、用户 worktree 目录依次选择。
|
|
28
|
+
|
|
29
|
+
- 显式 root 不可写时 fail-closed。
|
|
30
|
+
- 只有零配置默认 root 因权限或只读文件系统不可写时,才降级到仓库同级 `.worktrees` 或平台临时目录;
|
|
31
|
+
降级写入 record,临时目录标记 `EPHEMERAL`。
|
|
32
|
+
- manager 在创建 branch 前认领 root;`git worktree add` 失败后,只有能证明新 branch 未挂载且 tip
|
|
33
|
+
等于 base 才删除空 branch,否则 `KEEP + 原因`。
|
|
34
|
+
- local branch 已存在但没有匹配的 active record 时返回 `BRANCH_ALREADY_EXISTS`,不继承旧 tip。
|
|
35
|
+
|
|
36
|
+
## 非默认 base 与堆叠关系
|
|
37
|
+
|
|
38
|
+
依赖未合入分支时必须给出理由:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
agentkit worktree spawn api-contract-followup \
|
|
42
|
+
--agent codex --agent-id <real-thread-id> \
|
|
43
|
+
--purpose "基于契约分支实现客户端" \
|
|
44
|
+
--base origin/agent/api-contract \
|
|
45
|
+
--base-reason "依赖未合入契约"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
父分支前进后禁止在 feature 树手工 rebase。冻结 live HEAD,由 manager 原子撤防 watcher、刷新 base、
|
|
49
|
+
保存父 worktree 关系并开启新 ownership epoch:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
agentkit worktree rebase api-contract-followup \
|
|
53
|
+
--onto origin/agent/api-contract \
|
|
54
|
+
--expected-head <current-full-head> --reason "吸收父分支最新契约"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
冲突时只人工编辑并 `git add`;继续只需 `rebase <selector> --continue`,intent 中已有 onto、原始 HEAD
|
|
58
|
+
和 reason。为兼容旧调用可重复提供原参数,但提供时必须一致;放弃用 `rebase <selector> --abort`。
|
|
59
|
+
pending 时 `artifact/touch/handoff/submit/watch` 全部 fail-closed。成功后旧 Artifact、MR head 与 watcher
|
|
60
|
+
失效,push 新 HEAD 后重新登记评审边界。
|
|
61
|
+
|
|
62
|
+
已经处于 `ready_for_review` 且 watcher 发现 target 前进时,不手工串联上述步骤;使用
|
|
63
|
+
`refresh-review <selector>`,完整 push/rearm 与恢复语义见 [review-lifecycle.md](review-lifecycle.md)。
|
|
64
|
+
|
|
65
|
+
历史已包含新目标时只更新 attribution:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
agentkit worktree retarget api-contract-followup \
|
|
69
|
+
--base origin/main --expected-head <current-full-head> \
|
|
70
|
+
--reason "父分支已合入,MR 改指 main"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`retarget` 要求新 base 是 live HEAD 祖先;否则使用 `rebase`。portable core 不会假装已修改远端 MR
|
|
74
|
+
target,provider/UI 更新后才能重新武装 watcher。
|