@ckanner/flywheel 0.33.1 → 0.34.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.
Files changed (148) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +1 -0
  3. package/README.zh-CN.md +2 -0
  4. package/THIRD_PARTY_NOTICES.md +5 -1
  5. package/bin/flywheel-kimi-native-worker.js +5 -0
  6. package/bin/flywheel.js +8 -1
  7. package/bin/runtime.js +5 -1
  8. package/dist/bridge.mjs +89 -7
  9. package/dist/claude-code-pro-bridge.mjs +55 -6
  10. package/dist/client.js +40 -5
  11. package/dist/codex-pro-bridge.mjs +12 -5
  12. package/dist/control.mjs +1 -1
  13. package/dist/kimi-native-bridge.mjs +429 -0
  14. package/dist/kimi-native-runtime.mjs +233 -0
  15. package/dist/kimi-native-worker.mjs +77 -0
  16. package/dist/kimi-tower-candidate.mjs +227 -0
  17. package/dist/machine-worker.mjs +39 -5
  18. package/dist/managed-lcu.mjs +223 -0
  19. package/dist/native-doctor.mjs +36 -0
  20. package/dist/native-jobs.mjs +72 -0
  21. package/dist/native-policy.mjs +371 -0
  22. package/dist/native-resources.mjs +144 -0
  23. package/dist/native.mjs +251 -0
  24. package/dist/policy.mjs +13 -3
  25. package/dist/prewarm.mjs +4 -1
  26. package/dist/protocol.mjs +8 -1
  27. package/dist/worker.mjs +16 -9
  28. package/docs/README.md +9 -0
  29. package/docs/README.zh-CN.md +3 -0
  30. package/docs/design.md +33 -11
  31. package/docs/en/claude-code-pro.md +2 -2
  32. package/docs/en/configuration.md +17 -5
  33. package/docs/en/contributing.md +5 -3
  34. package/docs/en/getting-started.md +2 -2
  35. package/docs/en/model-policy.md +2 -2
  36. package/docs/en/native-capabilities.md +185 -0
  37. package/docs/en/releasing.md +2 -2
  38. package/docs/en/session-recovery.md +2 -2
  39. package/docs/plans/2026-11-13-native-harness-capabilities.en.md +258 -0
  40. package/docs/plans/2026-11-13-native-harness-capabilities.md +276 -0
  41. package/docs/plans/README.md +1 -0
  42. package/docs/validation/2026-11-14-desktop-native-configuration.md +128 -0
  43. package/docs/validation/2026-11-14-native-harness-implementation.md +215 -0
  44. package/docs/validation/2026-11-14-published-companions.md +15 -0
  45. package/docs/validation/2026-11-14-release-0.33.1.md +78 -0
  46. package/docs/validation/README.md +3 -0
  47. package/docs/validation/evidence/2026-11-14-native-harness-candidate.json +255 -0
  48. package/docs/validation/evidence/2026-11-14-native-harness-sessions.json +6009 -0
  49. package/docs/validation/evidence/2026-11-14-native-harness-tower-candidate.json +192 -0
  50. package/docs/zh-CN/claude-code-pro.md +2 -2
  51. package/docs/zh-CN/configuration.md +21 -8
  52. package/docs/zh-CN/contributing.md +5 -3
  53. package/docs/zh-CN/getting-started.md +2 -2
  54. package/docs/zh-CN/model-policy.md +2 -2
  55. package/docs/zh-CN/native-capabilities.md +184 -0
  56. package/docs/zh-CN/releasing.md +2 -2
  57. package/docs/zh-CN/session-recovery.md +1 -1
  58. package/native/darwin-amd64/flywheel +0 -0
  59. package/native/darwin-arm64/flywheel +0 -0
  60. package/native/linux-amd64/flywheel +0 -0
  61. package/native/linux-arm64/flywheel +0 -0
  62. package/native/manifest.json +9 -9
  63. package/node_modules/dsh-preset-generator/CHANGELOG.md +77 -0
  64. package/node_modules/dsh-preset-generator/LICENSE +21 -0
  65. package/node_modules/dsh-preset-generator/README.md +149 -0
  66. package/node_modules/dsh-preset-generator/docs/README.zh.md +95 -0
  67. package/node_modules/dsh-preset-generator/package.json +43 -0
  68. package/node_modules/dsh-preset-generator/src/composition.mjs +150 -0
  69. package/node_modules/dsh-preset-generator/src/gen-presets.mjs +367 -0
  70. package/node_modules/dsh-preset-generator/src/policy.mjs +17 -0
  71. package/node_modules/dsh-subagent-codex-pro/CHANGELOG.md +16 -1
  72. package/node_modules/dsh-subagent-codex-pro/README.md +57 -4
  73. package/node_modules/dsh-subagent-codex-pro/assets/native-client.js +118 -0
  74. package/node_modules/dsh-subagent-codex-pro/cordis.patch.yml +6 -0
  75. package/node_modules/dsh-subagent-codex-pro/docs/README.zh.md +49 -2
  76. package/node_modules/dsh-subagent-codex-pro/docs/machine-lifecycle-validation.md +1 -1
  77. package/node_modules/dsh-subagent-codex-pro/docs/machine-lifecycle.md +1 -1
  78. package/node_modules/dsh-subagent-codex-pro/docs/machine-lifecycle.zh.md +1 -1
  79. package/node_modules/dsh-subagent-codex-pro/docs/machine.md +2 -2
  80. package/node_modules/dsh-subagent-codex-pro/docs/native-capabilities.md +254 -0
  81. package/node_modules/dsh-subagent-codex-pro/docs/native-capabilities.zh.md +180 -0
  82. package/node_modules/dsh-subagent-codex-pro/lib/config.js +56 -0
  83. package/node_modules/dsh-subagent-codex-pro/lib/config.js.map +1 -0
  84. package/node_modules/dsh-subagent-codex-pro/lib/desktop-native.js +109 -0
  85. package/node_modules/dsh-subagent-codex-pro/lib/desktop-native.js.map +1 -0
  86. package/node_modules/dsh-subagent-codex-pro/lib/dsh-types.js +3 -4
  87. package/node_modules/dsh-subagent-codex-pro/lib/dsh-types.js.map +1 -1
  88. package/node_modules/dsh-subagent-codex-pro/lib/index.js +64 -15
  89. package/node_modules/dsh-subagent-codex-pro/lib/index.js.map +1 -1
  90. package/node_modules/dsh-subagent-codex-pro/lib/jobs.js +6 -2
  91. package/node_modules/dsh-subagent-codex-pro/lib/jobs.js.map +1 -1
  92. package/node_modules/dsh-subagent-codex-pro/lib/machine-cli.js +2 -2
  93. package/node_modules/dsh-subagent-codex-pro/lib/machine-cli.js.map +1 -1
  94. package/node_modules/dsh-subagent-codex-pro/lib/machine-local.js +5 -2
  95. package/node_modules/dsh-subagent-codex-pro/lib/machine-local.js.map +1 -1
  96. package/node_modules/dsh-subagent-codex-pro/lib/machine-supervision.js +11 -0
  97. package/node_modules/dsh-subagent-codex-pro/lib/machine-supervision.js.map +1 -1
  98. package/node_modules/dsh-subagent-codex-pro/lib/machine-supervisor.js +1 -0
  99. package/node_modules/dsh-subagent-codex-pro/lib/machine-supervisor.js.map +1 -1
  100. package/node_modules/dsh-subagent-codex-pro/lib/machine.js +20 -3
  101. package/node_modules/dsh-subagent-codex-pro/lib/machine.js.map +1 -1
  102. package/node_modules/dsh-subagent-codex-pro/lib/native.js +297 -0
  103. package/node_modules/dsh-subagent-codex-pro/lib/native.js.map +1 -0
  104. package/node_modules/dsh-subagent-codex-pro/lib/process-guardian.js +11 -1
  105. package/node_modules/dsh-subagent-codex-pro/lib/process-guardian.js.map +1 -1
  106. package/node_modules/dsh-subagent-codex-pro/lib/run.js +19 -1
  107. package/node_modules/dsh-subagent-codex-pro/lib/run.js.map +1 -1
  108. package/node_modules/dsh-subagent-codex-pro/lib/tool.js +123 -57
  109. package/node_modules/dsh-subagent-codex-pro/lib/tool.js.map +1 -1
  110. package/node_modules/dsh-subagent-codex-pro/lib/types/config.d.ts +31 -0
  111. package/node_modules/dsh-subagent-codex-pro/lib/types/config.d.ts.map +1 -0
  112. package/node_modules/dsh-subagent-codex-pro/lib/types/desktop-native.d.ts +30 -0
  113. package/node_modules/dsh-subagent-codex-pro/lib/types/desktop-native.d.ts.map +1 -0
  114. package/node_modules/dsh-subagent-codex-pro/lib/types/dsh-types.d.ts +7 -5
  115. package/node_modules/dsh-subagent-codex-pro/lib/types/dsh-types.d.ts.map +1 -1
  116. package/node_modules/dsh-subagent-codex-pro/lib/types/index.d.ts +31 -0
  117. package/node_modules/dsh-subagent-codex-pro/lib/types/index.d.ts.map +1 -1
  118. package/node_modules/dsh-subagent-codex-pro/lib/types/jobs.d.ts +2 -0
  119. package/node_modules/dsh-subagent-codex-pro/lib/types/jobs.d.ts.map +1 -1
  120. package/node_modules/dsh-subagent-codex-pro/lib/types/machine-local.d.ts.map +1 -1
  121. package/node_modules/dsh-subagent-codex-pro/lib/types/machine-supervision.d.ts.map +1 -1
  122. package/node_modules/dsh-subagent-codex-pro/lib/types/machine.d.ts +7 -0
  123. package/node_modules/dsh-subagent-codex-pro/lib/types/machine.d.ts.map +1 -1
  124. package/node_modules/dsh-subagent-codex-pro/lib/types/native.d.ts +120 -0
  125. package/node_modules/dsh-subagent-codex-pro/lib/types/native.d.ts.map +1 -0
  126. package/node_modules/dsh-subagent-codex-pro/lib/types/run.d.ts +11 -0
  127. package/node_modules/dsh-subagent-codex-pro/lib/types/run.d.ts.map +1 -1
  128. package/node_modules/dsh-subagent-codex-pro/lib/types/tool.d.ts +11 -0
  129. package/node_modules/dsh-subagent-codex-pro/lib/types/tool.d.ts.map +1 -1
  130. package/node_modules/dsh-subagent-codex-pro/lib/types/wire.d.ts +7 -1
  131. package/node_modules/dsh-subagent-codex-pro/lib/types/wire.d.ts.map +1 -1
  132. package/node_modules/dsh-subagent-codex-pro/lib/wire.js +34 -6
  133. package/node_modules/dsh-subagent-codex-pro/lib/wire.js.map +1 -1
  134. package/node_modules/dsh-subagent-codex-pro/package.json +28 -4
  135. package/npm/install.js +2 -2
  136. package/package.json +25 -10
  137. package/plugins/dsh/KIMI_NATIVE_PROTOCOL.en.md +76 -0
  138. package/plugins/dsh/KIMI_NATIVE_PROTOCOL.md +76 -0
  139. package/plugins/dsh/PROTOCOL.md +149 -17
  140. package/plugins/dsh/README.md +15 -12
  141. package/plugins/dsh/README.zh-CN.md +8 -8
  142. package/plugins/dsh/THIRD_PARTY_NOTICES.md +5 -1
  143. package/plugins/dsh/vendor/README.md +40 -11
  144. package/plugins/dsh/vendor/chatgpt.json +21 -0
  145. package/plugins/dsh/vendor/claude-code-pro.json +21 -0
  146. package/plugins/dsh/vendor/codex-pro.json +13 -8
  147. package/plugins/dsh/vendor/lcu.json +21 -0
  148. package/plugins/dsh/vendor/preset-generator.json +16 -0
@@ -0,0 +1,76 @@
1
+ # Kimi 原生运行协议
2
+
3
+ [English](KIMI_NATIVE_PROTOCOL.en.md)
4
+
5
+ 本协议由 `kimi-native-worker.js` / `runKimiWorker()` 实现,供 Go 引擎选择 Kimi 原生 Agent、Swarm 或 Tower。普通 Kimi CLI 路径不受影响。Go 继续拥有角色循环、预算、边界检查、Review、提交和验收;原生子任务属于本次角色调用。
6
+
7
+ ## 入口与能力准入
8
+
9
+ Worker 从 stdin 接收一个 UTF-8 JSONL `start`,父进程继续保持 stdin 打开。EOF、SIGINT、SIGTERM、SIGHUP 都请求取消。stdout 仅有 protocol 1 的 `ready` / `event` / 最后一个 `result`。桥接函数只 emit ready/event,返回 result,由 CLI 输出一次。单个请求上限 1 MiB,单个输出帧上限 2 MiB。
10
+
11
+ ```js
12
+ {
13
+ type: 'start', protocol: 1, requestId: 'invocation-id',
14
+ cwd: '/physical/role-worktree', workspaceCwd: '/physical/project',
15
+ model: 'configured-model-alias', reasoningEffort: 'high',
16
+ permissionMode: 'danger-full-access', prompt: 'Role instructions', timeoutMs: 600000,
17
+ persistent: true, // sessionId 仅在恢复 Agent/Swarm 历史时传入
18
+ native: {
19
+ version: 1, mode: 'agent', // agent | swarm | tower
20
+ agents: { enabled: true },
21
+ agentProfile: 'agent' // 可选;Server 已发现的 profile 名称,不是 agent-file 路径
22
+ // tower: { branch: 'candidate-branch' } // 仅 tower 可用,branch 可省略
23
+ },
24
+ managed: {
25
+ version: 1, runId: '', invocationId: 'invocation-id',
26
+ role: 'execute', scope: 'packet-scope', candidateId: 'candidate-id',
27
+ channel: 'subscription', taskDir: '/physical/project/docs/task'
28
+ }
29
+ }
30
+ ```
31
+
32
+ `invocationId` 必须等于 `requestId`;`runId` 是必需的字符串,可以为空。未知 Start/native/managed 字段、非显式完整权限、无效目录、Tower sessionId,以及 `agents.maxConcurrent` 均拒绝。`maxConcurrent` 拒绝的原因是当前公开 API 不能保证整棵原生任务树的硬上限。Swarm/Tower 不接受 `agents.enabled:false`。
33
+
34
+ 每次调用启动前台 `kimi web --no-open --host 127.0.0.1 --port 0`。`FLYWHEEL_KIMI_BIN` 可以指定 CLI。登录和模型配置沿用 `KIMI_CODE_HOME`(否则 `~/.kimi-code`),不重写用户配置。Worker 从真实实例注册表核对本次 child PID、启动时间、loopback 端口,再使用已有 `server.token` 验证 `/meta` 的 server_id、认证、backend 和 WebSocket 支持。带 bearer token 的 CLI banner/stdout/stderr 不转发、不写入 receipt。
35
+
36
+ 准入读取并哈希实际 `/openapi.json` 和 `/asyncapi.json`,核对所需创建/配置/队列/环境/历史/关闭路由和订阅/任务生命周期消息。`:abort` 在上游 OpenAPI 中未完整投影,因此对尚未 dispatch 的本次空闲会话做实际幂等探测。最终还必须由实际 WS agent 状态确认 model、thinking、permission、plan/swarm/tower 标志,以及 REST local environment/cwd。只有这些事实吻合,`native.effective.matched` 才为 true。
37
+
38
+ `--doctor` 仅检查 CLI 可执行性及版本,返回 `inferenceTested:false`。它不能证明模式、账号、模型或 API 准入。旧的 `kimi server` 命令、SDK、named preset RPC 和任意 agent-file 加载均不是此接口。
39
+
40
+ ## 执行、完成、取消
41
+
42
+ 通过 WS 先订阅 `main`,以 `prompt_id` 关联实际 `user_message.prompt_ids` 和 HTTP 接受结果;两者到达顺序不限。首次 ordinal 是 **0**,新会话的历史基线是 **-1**。随后从 task/agent_refs 发现并订阅子 agent。子任务、队列、交互和整个会话 busy 状态共同决定完成;首个主 turn 结束不足以成功。Tower 的自动主 agent continuation 也必须结束。
43
+
44
+ `native.completion={confirmed,pendingIds}` 在 cleanup **之前**记录。成功必须先看到全部主 turn 完成、已观察子任务和 agent 空闲、队列为空、没有待回答交互,且最后的 REST/WS 对账一致。关闭阶段取消了子任务,不能将未完成的结果改成成功。receipt 保留实际 task/child ID、状态和模型。
45
+
46
+ 未预期的 approval/question 返回 `INTERACTION_REQUIRED`,不编造回答。断线、重新投影 conversation、未知 dispatch 不重发 prompt。取消先撤回 queued prompts,再中止主 turn、停止已观察任务并等待空闲;关闭 remote control 和本次 owned runtime 后,核对进程退出及已观察后代进程身份。所有清理受独立、有界 grace 约束。无法确认队列/子任务/进程已收束时,`settled` 与 `cleanup.confirmed` 都为 false。
47
+
48
+ Worker 继承 Go 的进程组,不创建逃逸的独立进程组。Go watchdog 继续拥有最终进程组清扫。receipt 的 `settled` 表示清理已确认;它不等于 role 成功,error/cancelled 也可 settled=true。
49
+
50
+ ## 结果、用量与恢复
51
+
52
+ 最终字段为 `protocol/requestId/type/status/settled/sessionId/text/usage/costUsd/native/lifecycle`,失败另含 `error.code/message`。`status` 为 ok/error/cancelled;`native.requested` 原样保留 Start.native,effective/observed 则记录实际准入事实、schema 摘要、会话绑定、当前 managed 身份、子任务、completion、cleanup 和 Tower candidate。
53
+
54
+ `lifecycle.protocol` 为 `kimi-server/v1`,携带 requestId/sessionId、`dispatch`(not-dispatched/dispatched/unknown)、`outcome`(completed/failed/cancelled/unknown)、cleanupConfirmed、resumeCandidate、resumeAccepted、usageStatus 和 turnId。
55
+
56
+ 用量只从公开 conversation 中实际结束的 model step 四项计数得到,完整时输出 `{input,output,cacheRead,cacheWrite,totalTokens}`;input 包含 input_other 与两种 cache input。`session.usage` 的占位零和 WS `context_tokens` 不作为本次账单。缺失步骤、未识别 child、compaction 或无法划定恢复 child 的历史边界时,顶层 usage=null;保留可归属的部分步骤事实。Tower 整树用量目前始终 unknown,costUsd 始终 null。未知值交给 Go 的既有预算停机策略。
57
+
58
+ Agent/Swarm 的持久历史绑定 taskDir、role、scope、channel、物理 cwd/workspace、model、effort、permission 和 native profile。runId/invocationId/candidateId 记入本次 receipt,不阻止同一角色在重启或返修后恢复。恢复历史只统计本次主 turn;复用旧 child 历史时不再次计入全部旧费用。不同角色或配置拒绝复用。
59
+
60
+ Tower 总是 fresh:显式 sessionId 拒绝;persistent=true 且无 sessionId 可以执行,但 resumeCandidate=false。本接口没有 durable recovery journal/ACK:`recover` 不受支持,不能用新 start 重跑一个 unknown invocation。
61
+
62
+ ## Tower 候选与导回
63
+
64
+ Tower 收到独立 `.git` 的仓库副本,不复用主仓 Git 管理目录;linked worktree 同样先转成独立仓库。源 HEAD、所有 tracked/unignored 内容、已有 dirty/untracked、删除、二进制、可执行位与符号链接都纳入快照。taskDir 在角色 worktree 外部时,另行哈希外部任务契约;该外部目录只接受普通文件与目录。源和外部契约合计最多 256 MiB;submodule/特殊文件拒绝。
65
+
66
+ 只排除真正该任务的运行文件:state.json 及其原子临时文件、metrics.jsonl、orchestrator.log/pid、锁、stop-request、`.control/`、`.sessions/`、`reports/native/`;spec、packet 等保留在指纹中。Tower 自己的 `.tower/` 管理数据不导回。
67
+
68
+ 入口将 cwd 解析为物理路径,同时保留调用者声明的目录别名。提交给模型的 prompt 会把这两种有路径边界的 source cwd 前缀映射到 candidate cwd,并添加候选目录说明;只扫描原始文本,不再次替换插入的候选路径。相似路径、URL(包括 query)、外部契约路径不替换。receipt 的 `observed.promptMapping` 记录规则、替换次数、原始/提交 prompt 摘要,以及声明、物理和候选目录。**这是独立 Git 候选工作目录,不是 OS 文件系统沙箱**:完整访问权限不因此变小;源内容或 HEAD 变化会使导回拒绝。
69
+
70
+ 只有 native completion 成功、cleanup confirmed 且 `managed.role==='execute'`,可信 adapter 才冻结 binary patch,再次精确核对源和外部契约、检查 patch 摘要、执行 `git apply --check`、二次快照检查、实际 apply 和结果一致性检查。非 Execute 仅交回候选。冲突、契约/HEAD 变化、patch 被改或后置条件不符会使 role 失败,并保留私有候选、源快照、patch 和 receipt。没有针对无关编辑器的全系统文件锁,也不宣称多文件 apply 是 OS 原子事务;Go 仍负责后续边界检查、验收和提交。
71
+
72
+ ## 已验证证据
73
+
74
+ `test/kimi-native.test.js` 使用真实本地 HTTP/WS 子进程验证三种模式、事件顺序、原生子任务、用量未知值、准入拒绝、取消、历史恢复、CLI lifeline、一次 final、token 不泄漏及 Tower 失败门禁;`test/kimi-tower-candidate.test.js` 使用实际 Git 验证 dirty/untracked/binary/link/mode/deletion、linked worktree、外部契约、候选冲突和 prompt 路径映射。测试不联系用户账号或模型;CLI 可执行性、真实账号准入和付费推理验证是不同的证据。
75
+
76
+ 实现依据是上游 `MoonshotAI/kimi-code` 提交 `f082f04a093a3e71a2263c5461d52507dc31f83a` 的 [Server API](https://github.com/MoonshotAI/kimi-code/blob/f082f04a093a3e71a2263c5461d52507dc31f83a/docs/en/reference/server-api.md)、[会话配置](https://github.com/MoonshotAI/kimi-code/blob/f082f04a093a3e71a2263c5461d52507dc31f83a/docs/en/reference/server-api-sessions.md)、[conversation/task 生命周期](https://github.com/MoonshotAI/kimi-code/blob/f082f04a093a3e71a2263c5461d52507dc31f83a/docs/en/reference/server-api-conversation.md)、[Tower](https://github.com/MoonshotAI/kimi-code/blob/f082f04a093a3e71a2263c5461d52507dc31f83a/docs/en/guides/tower.md)、[实例注册表](https://github.com/MoonshotAI/kimi-code/blob/f082f04a093a3e71a2263c5461d52507dc31f83a/packages/kap-server/src/instanceRegistry.ts)、[逐 batch Swarm 并发](https://github.com/MoonshotAI/kimi-code/blob/f082f04a093a3e71a2263c5461d52507dc31f83a/packages/agent-core-v2/src/features/swarm/session/agentRunBatch.ts) 和 [Tower 限流服务](https://github.com/MoonshotAI/kimi-code/blob/f082f04a093a3e71a2263c5461d52507dc31f83a/packages/agent-core-v2/src/features/tower/towerRateLimitService.ts)。安装现场仍以实际 API 探测为准。
@@ -1,6 +1,6 @@
1
- # Go ↔ DSH / Codex Pro / Claude Code Pro worker 协议
1
+ # Go ↔ DSH / Kimi / Codex Pro / Claude Code Pro worker 协议
2
2
 
3
- 此文件记录独立 worker 协议。前半部分对应 `internal/drivers/dsh.go` 与官方 DSH SDK worker;[Codex Pro 部分](#codex-pro-worker协议)对应 `internal/drivers/codex_pro.go` 和插件 machine API worker。Go 负责状态机、验收、费用上限及最终进程判断;worker 仅执行一次有边界的调用。两者之间只有本地 stdio,不开放 HTTP 端口。
3
+ 此文件记录独立 worker 协议。前半部分对应 `internal/drivers/dsh.go` 与官方 DSH SDK worker;[Codex Pro 部分](#codex-pro-worker协议)对应 `internal/drivers/codex_pro.go` 和插件 machine API worker。Go 负责状态机、验收、费用上限及最终进程判断;worker 仅执行一次有边界的调用。Go与worker之间使用本地stdio;Kimi native worker内部使用其拥有的loopback Server,见本文件原生扩展和Kimi专属协议。
4
4
 
5
5
  ## 启动与输入
6
6
 
@@ -19,6 +19,7 @@ Go 在工作目录启动 `flywheel-dsh-worker`,写入**一条** UTF-8 JSON 行
19
19
  | `timeoutMs` | 1–86,400,000,默认 1,800,000;涵盖权限准备、初始化、运行和关闭 |
20
20
  | `workspaceCwd` | 可选的稳定项目目录,必须存在并规范化。SDK 在该目录初始化 Session header,当前执行目录仍为 `cwd`;ready 必须回显匹配的项目目录。省略保留旧行为 |
21
21
  | `sessionTitle` | 可选的人类可读任务/角色标题;只给新 Session 设置,续接不覆盖现有标题 |
22
+ | `native` / `managed` | 版本化能力选项与Go生成的实际调用身份,见原生扩展 |
22
23
 
23
24
  项目归属与执行目录分离时,worker 在发送 prompt 前使用公开 working-directory 服务切换并核对当前目录;权限根仍如实记录 DSH 的 Session header 语义。当前 DSH 不支持将 `workspace-write` 沙箱根与项目目录独立设置,因此这类不同目录组合在派发前拒绝,不把权限改成 full access。`read-only` 与显式 full access 保留其实际权限。doctor 使用临时持久化根,清理后不留下新的用户会话。桌面 Workspace 登记只通过 Host 的公开注册表执行。
24
25
 
@@ -48,12 +49,12 @@ v2 拒绝缺失或 false 的 persistent;v1 不接受这些 v2 字段。版本
48
49
 
49
50
  worker 不搜索 `.app` 内部目录、不下载或更新 CLI、不复制桌面授权文件,也不读取或修改 Flywheel 的 `state.json`。Go 的凭证环境白名单仍是外层边界。
50
51
 
51
- worker 用 `dsh --profile <profile> --patch <临时覆盖文件>` 启动 DSH。覆盖文件在临时目录内、权限为 `0600`,结束后移除。DSH 子进程继承 Go 建立的 worker 进程组,禁止再为 SDK 创建 detached 组。覆盖禁用自主 goal/workflow/delegation、辅助模型调用及 `schedule`/`tool-schedule`;不修改用户 profile 或提醒存储。
52
+ worker 用 `dsh --profile <profile> --patch <临时覆盖文件>` 启动 DSH。覆盖文件在临时目录内、权限为 `0600`,结束后移除。DSH 子进程继承 Go 建立的 worker 进程组,禁止再为 SDK 创建 detached 组。未配置native时覆盖禁用自主goal/workflow/delegation、辅助模型调用及schedule;显式native按下文启用受管agents/Team/Workflow/Web/LCU,自主goal/schedule仍关闭。不修改用户profile或提醒存储。
52
53
 
53
54
  ## 输出帧
54
55
 
55
56
  每帧均回显请求的 `protocol`(1 或 2)及原 `requestId`。顺序是 `ready` → 零或多个
56
- `event` → 恰好一个 `result`;启动失败允许直接 `result`。v1 创建 Session 时的权限
57
+ `event`/`native-event` → 恰好一个 `result`;启动失败允许直接 `result`。v1 创建 Session 时的权限
57
58
  事件缓冲至 ready 之后;v2 admission 前的恢复事件不转发为本轮活动。
58
59
 
59
60
  ### ready:SDK 配置与权限握手已通过
@@ -83,7 +84,7 @@ v2 的 ready 另含 `persistent:true`、`resumed:boolean`;恢复时 sessionId
83
84
  {"protocol":1,"requestId":"call-123","type":"event","sessionId":"flywheel-uuid","event":{"seq":12,"type":"turn/end","data":{"turn":0,"reason":{"kind":"completed"}}}}
84
85
  ```
85
86
 
86
- 只转发该根 Session 的持久事件,按 `seq` 去重。SDK streaming usage 不作重复累加。意外出现根 Session 的子智能体启动时,立即失败并关闭 SDK;编排与委派由 Go 管理。
87
+ 普通 `event` 只转发该根 Session 的持久事件,按 `seq` 去重。SDK streaming usage 不作重复累加。未配置 `native` 时,根 Session 出现子智能体启动会立即失败并关闭 SDK。显式 `native` 的 owned children 由 `NativeTree` 归属和核对,通过 `native-event` 与终态回执报告;Go 继续管理角色调用与外层编排。
87
88
 
88
89
  恢复过程中重放的旧事件不进入当前 output/usage fold,也不触发 Go 的 OnEvent。
89
90
  worker 在 admission 后、发送本次 prompt 前重置 fold,只计当前调用新增的输出与用量。
@@ -185,8 +186,9 @@ Go 从正式 `Run` 开始独立执行调用 idle/wall 上限,预热不会延
185
186
  ```
186
187
 
187
188
  close、TTL、EOF、TERM/INT/HUP 均触发有界 shutdown。Go 发 close 后最多给外层 worker
188
- 三秒协议收尾窗口,再取消现有 watchdog 并等待其 TERM/KILL;SDK 原有两秒正常关闭
189
- 窗口不变,不等剩余模型 wall-time。尚未收到正式 start 的 worker
189
+ 三秒协议收尾窗口,再取消现有 watchdog 并等待其 TERM/KILL。SDK 未配置 `native` 时
190
+ 正常关闭宽限为两秒;显式 native/LCU 分别为 15/135 秒,Go 外层分别至少 20/145 秒,
191
+ 不等剩余模型 wall-time。尚未收到正式 start 的 worker
190
192
  在 SDK 关闭后,将 `terminal.json` 以 0600、独占、原子发布到指定证据目录,fsync 文件及目录后再输出
191
193
  `warm-result`。文件包含 protocol、warmId、binding、真实 workerPid、`dispatched:false`
192
194
  和 `cleanupConfirmed`;协议损坏或 SDK 清理未知不得为 true。发布的完整 JSON 文件
@@ -215,7 +217,7 @@ watchdog 已证明静止后清除当前 warm intent。崩溃恢复重新 fsync
215
217
 
216
218
  ## Codex Pro worker协议
217
219
 
218
- 公开入口为 `@ckanner/flywheel/codex-pro-worker`,可执行入口为 `flywheel-codex-pro-worker`。`FLYWHEEL_CODEX_PRO_WORKER` 允许显式覆盖;npm 启动器解析同一安装包内的 worker,不依靠碰巧可用的全局旧 worker。worker 实际导入 bundle 的已审查源码包 `dsh-subagent-codex-pro@0.9.0` 的 `./machine` API,严格检查包名、版本、machine protocol 1 及 lifecycle/recovery capabilities;源码来源见 `vendor/README.md`,不宣称该版本已在 registry 发布。Node 最低 22.18.0,仅支持 macOS/Linux。
220
+ 公开入口为 `@ckanner/flywheel/codex-pro-worker`,可执行入口为 `flywheel-codex-pro-worker`。`FLYWHEEL_CODEX_PRO_WORKER` 允许显式覆盖;npm 启动器解析同一安装包内的 worker,不依靠碰巧可用的全局旧 worker。worker 实际导入 bundle 的已审查源码包 `dsh-subagent-codex-pro@0.10.0` 的 `./machine` API,严格检查包名、版本、machine protocol 1 及 lifecycle/recovery capabilities;源码来源见 `vendor/README.md`,不宣称该版本已在 registry 发布。Node 最低 22.18.0,仅支持 macOS/Linux。
219
221
 
220
222
  ### 请求与父进程连接
221
223
 
@@ -232,7 +234,7 @@ v1 只接受这些字段;不接受 provider、resume、threadMode、threadId
232
234
  ```
233
235
 
234
236
  v2 拒绝 ephemeral、缺失模式和空/非法句柄;所有 progress/result 回显外层版本。
235
- 嵌套 adapter、machine 请求与原始 receipt 仍为协议 1,精确包版本仍为 0.9.0。
237
+ 嵌套 adapter、machine 请求与原始 receipt 仍为协议 1,精确包版本仍为 0.10.0。
236
238
  v1/v2 不启用有 ACK 的生命周期;主任务使用下面的 v3 接通公开 lifecycle/recovery。
237
239
 
238
240
  **这里与 DSH 旧单请求入口的 EOF 语义不同:Go 写入一行后保持 stdin 开放。** stdin 是父进程的存活连接;未完成前 EOF、读取错误或非法后续输入触发 AbortSignal,并等待插件有界清理。不能用 `echo … | worker` 的关闭 stdin 行为冒充正常调用。运行请求首行等待上限 10 秒;请求最多 1 MiB,machine 原始输出上限 1 MiB,序列化 progress 累计最多 1 MiB,完整终态帧最多 8 MiB。超限明确失败,不能裁掉回执后判成功。
@@ -248,7 +250,7 @@ v1/v2 不启用有 ACK 的生命周期;主任务使用下面的 v3 接通公
248
250
  最后恰好一个 result,字段结构如下,`receipt` 为插件实际完整对象:
249
251
 
250
252
  ```json
251
- {"protocol":1,"type":"result","requestId":"call-123","adapter":{"package":"dsh-subagent-codex-pro","version":"0.9.0","protocol":1},"receipt":null,"error":{"code":"INVALID_REQUEST","message":"启动请求未通过校验"}}
253
+ {"protocol":1,"type":"result","requestId":"call-123","adapter":{"package":"dsh-subagent-codex-pro","version":"0.10.0","protocol":1},"receipt":null,"error":{"code":"INVALID_REQUEST","message":"启动请求未通过校验"}}
252
254
  ```
253
255
 
254
256
  启动前不能获得 machine receipt 时为 null。运行已开始则即使失败也保留完整 receipt;`error` 非 null、重复/丢失 result、尾部垃圾、请求身份或 adapter 版本不符都不能成功。本通道没有 DSH `ready` 帧;v3 使用有类型的 `thread-ready` lifecycle 与 Go ACK。不能从普通 progress 文本虚构沙箱或实际 effort 证据。
@@ -257,7 +259,7 @@ Go 同时校验外层 worker 物理终态和插件 receipt:请求及 run/threa
257
259
 
258
260
  effort 的证据只可为 turn/start 请求接受,保留 `effectiveEffort:null`。usage 使用 `run` 增量,不能把 threadTotal 当成本次消耗;只有 complete 才记入可知预算,partial/unknown 原样存入 receipt 并增加未知调用计数。cached input/reasoning output 是总 input/output 的子项,不重复累加。订阅 costUSD 保持 null、costStatus 保持 unknown。receipt 没有实际 provider 时保持未知,不根据 channel 发明 provider。
259
261
 
260
- Go 由可信 receipt 生成 `codex-pro/0.9.0/worker-v1`、`worker-v2` 或 `worker-v3` 的 SessionOutcome。
262
+ Go 由可信 receipt 生成 `codex-pro/0.10.0/worker-v1`、`worker-v2` 或 `worker-v3` 的 SessionOutcome。
261
263
  只有正常 completed、cleanup 已确认且 persistent 的结果才具备 resumeCandidate;
262
264
  这是适配器证据支持的尝试资格,不是 rollout 已持久化的证明。显式恢复必须接受同一
263
265
  thread,requested/outcome/execution 的 thread 身份和 thread/start、thread/resume
@@ -278,7 +280,7 @@ worker 捕获 SIGINT/SIGTERM/SIGHUP,先取消并等待插件返回清理
278
280
  `flywheel-codex-pro-worker --doctor` 不读取 stdin,不调用 runMachine,不启动 app-server,仅导入并核验公开接口。成功返回单个 JSON:
279
281
 
280
282
  ```json
281
- {"protocol":1,"type":"doctor","package":"dsh-subagent-codex-pro","version":"0.9.0","machineProtocol":1,"available":true,"inferenceTested":false}
283
+ {"protocol":1,"type":"doctor","package":"dsh-subagent-codex-pro","version":"0.10.0","machineProtocol":1,"available":true,"inferenceTested":false}
282
284
  ```
283
285
 
284
286
  Go doctor 同时检查 Node 与 Codex 命令。包导入成功不证明账号、模型、完整策略或真实推理能力,`--probe` 也不会对 Codex Pro 发模型任务。
@@ -296,7 +298,7 @@ Go doctor 同时检查 Node 与 Codex 命令。包导入成功不证明账号、
296
298
  上游公开导出 `MACHINE_LIFECYCLE_VERSION=1`、`MACHINE_LIFECYCLE_CAPABILITIES`、`recoverMachine`。capabilities 必须声明 durableJournal/readOnlyRecovery;Codex 的 threadReadyBeforeDispatch=true,Claude=false。worker 原样传递有类型的事件,不解析文本补 ID:
297
299
 
298
300
  ```json
299
- {"type":"lifecycle","protocol":3,"requestId":"call-126","adapter":{"package":"dsh-subagent-codex-pro","version":"0.9.0","protocol":1},"lifecycle":{"lifecycleVersion":1,"type":"lifecycle","requestId":"call-126","runId":"native-run","sequence":2,"event":"dispatch-intent","threadId":"thread-id","turnId":null,"persistent":true,"configuration":null,"dispatch":"not-dispatched","outcome":"unknown","cleanupConfirmed":false}}
301
+ {"type":"lifecycle","protocol":3,"requestId":"call-126","adapter":{"package":"dsh-subagent-codex-pro","version":"0.10.0","protocol":1},"lifecycle":{"lifecycleVersion":1,"type":"lifecycle","requestId":"call-126","runId":"native-run","sequence":2,"event":"dispatch-intent","threadId":"thread-id","turnId":null,"persistent":true,"configuration":null,"dispatch":"not-dispatched","outcome":"unknown","cleanupConfirmed":false}}
300
302
  ```
301
303
 
302
304
  事件枚举为 thread-ready、dispatch-intent、dispatch-possible、turn-accepted、terminal、cleanup-confirmed;字段记录实际事实,示例中的 null 不是已确认配置。Go 校验 backend 能力、实际身份和合法状态演进。Codex thread-ready 携带完整实际 configuration,ACK 前核对;Claude init 只在 prompt 后出现,不能发明预派发 thread-ready 或真实 turn-accepted。
@@ -320,7 +322,7 @@ Go 原子保存、fsync 检查点和 state 后,才向仍开放的 stdin 写一
320
322
  `original` 仅为旧调用的非秘密绑定,不含 prompt、凭证或环境;不会解析旧 cwd、认证、启动 CLI 或调用 thread/resume。worker 只调用公开 `recoverMachine({protocol:1,requestId,runId,recoveryDirectory})`,返回:
321
323
 
322
324
  ```json
323
- {"type":"recovery","protocol":3,"requestId":"call-126","adapter":{"package":"dsh-subagent-codex-pro","version":"0.9.0","protocol":1},"recovery":{"protocol":1,"type":"recovery","requestId":"call-126","runId":"native-run","status":"pending","receipt":null,"lifecycle":null,"reason":"No durable terminal receipt is available"},"error":null}
325
+ {"type":"recovery","protocol":3,"requestId":"call-126","adapter":{"package":"dsh-subagent-codex-pro","version":"0.10.0","protocol":1},"recovery":{"protocol":1,"type":"recovery","requestId":"call-126","runId":"native-run","status":"pending","receipt":null,"lifecycle":null,"reason":"No durable terminal receipt is available"},"error":null}
324
326
  ```
325
327
 
326
328
  status 为 terminal/pending/unknown。只有 exact invocation 的完整 terminal 可继续核验;pending 不证明 process alive,错误不附带安全重放的 admission 证明。只读路径可重复且不产生新的模型调用。Go 还核对原 adapter 版本与 checkpoint 摘要;升级后不拿新版本解释不兼容的旧 journal。
@@ -331,7 +333,7 @@ cleanup-confirmed 的 Go ACK 前保存原候选、role guard 和 Execute report
331
333
 
332
334
  `flywheel-claude-code-pro-worker` 与 Codex 共用父 stdin lifeline、单请求、大小上限、
333
335
  信号转发与等待收尾的 transport,适配器及回执保持独立。optional peer 精确为
334
- `dsh-subagent-claude-code-pro@0.4.0`,公开导出 `MACHINE_PROTOCOL_VERSION=1`、
336
+ `dsh-subagent-claude-code-pro@0.5.0`,公开导出 `MACHINE_PROTOCOL_VERSION=1`、
335
337
  `parseMachineRequest`、`MachineInputError`、`runMachine`、`recoverMachine` 和 lifecycle version/capabilities。缺 peer 不影响未选择 Claude
336
338
  的流程;选中时在 machine 调用前报错,绝不改调 DSH、Codex 或另一版 CLI wrapper。
337
339
 
@@ -362,7 +364,7 @@ envelope 可额外带 `admission:{dispatched:false,cleanupConfirmed:true}`。Go
362
364
  进入调用后的缺失结果则保持 unknown,即使工作进程随后退出也不允许自动重放。
363
365
 
364
366
  `--doctor` 仅核验精确 peer 与导出,返回
365
- `{protocol:1,type:"doctor",package:"dsh-subagent-claude-code-pro",version:"0.4.0",machineProtocol:1,available:true,inferenceTested:false}`。
367
+ `{protocol:1,type:"doctor",package:"dsh-subagent-claude-code-pro",version:"0.5.0",machineProtocol:1,available:true,inferenceTested:false}`。
366
368
  不启动 Claude,不测试账号。完整用户入口见[中文](https://github.com/ckanner/flywheel/blob/main/docs/zh-CN/claude-code-pro.md)/
367
369
  [English](https://github.com/ckanner/flywheel/blob/main/docs/en/claude-code-pro.md)。
368
370
 
@@ -494,7 +496,7 @@ UI 写操作仍经过 `/flywheel`;结果未知时的显式 status 也保留日
494
496
  | `ready` | 本地 doctor 是否无阻断项;诊断未完成时为 `false` |
495
497
  | `authentication` | 固定 `unknown`,没有自动登录或真实模型请求 |
496
498
  | `prefix`、`paths` | 得到后才记录;paths 包含 CLI、原生二进制、DSH worker、codexProWorker 与生成的 launcher 的绝对路径 |
497
- | `adapter` | 实际导入通过后记录 Codex Pro 包名、精确 0.9.0、protocol 1 与 inferenceTested=false;不代表账号已就绪 |
499
+ | `adapter` | 实际导入通过后记录 Codex Pro 包名、精确 0.10.0、protocol 1 与 inferenceTested=false;不代表账号已就绪 |
498
500
  | `skills` | 安装成功时的数量及准确目录;每项结果保存在 skills 步骤的 `summary` |
499
501
  | `diagnostic` | 合法的完整本地 doctor 报告,包括失败检查项;不执行 `--probe` |
500
502
  | `error`、`cancelledBy` | 失败原因、可选取消信号;不是成功结果的一部分 |
@@ -607,3 +609,133 @@ session 请求经 `.control/session-request-*` 私有文件和内容摘要传给
607
609
  会话账本存储 v2 是旧引擎拒绝接管状态的兼容性栅栏。session policy-version 1、DSH worker v2、Pro worker v3 与 lifecycle/recovery 版本保持各自独立。
608
610
 
609
611
  远端写入绑定仓库、源 HEAD 和 base,检查项目记录与实际 fetch/push 目标。推送禁用隐式 tags、mirror 和 submodule 推送;合并不使用 admin 绕过。已创建/合并的结果先核对,已接收但未完成的合并请求保持 pending。GitHub CLI 的 [匹配 HEAD 语义](https://cli.github.com/manual/gh_pr_merge)与 [mergeStateStatus](https://docs.github.com/en/graphql/reference/pulls#mergestatestatus)为外部接口依据。
612
+
613
+ ## Native capability extension(0.34.0)
614
+
615
+ 本节是已实现的可选扩展,不替换既有 worker/lifecycle 版本。配置字段信源为
616
+ `templates/native-profiles.schema.json`,使用方法见[原生能力指南](https://github.com/ckanner/flywheel/blob/main/docs/zh-CN/native-capabilities.md)。
617
+
618
+ ### 请求与所有权
619
+
620
+ DSH v1/v2、Pro v1/v2/v3 Start 可带 `native` version 1 options;Kimi native 是单独
621
+ protocol 1 worker。Go 从实际绑定的 native-profile 取得 options,在保存 invocation
622
+ intent 后传入 managed:
623
+
624
+ ```json
625
+ {
626
+ "version": 1,
627
+ "runId": "run-001",
628
+ "invocationId": "call-001",
629
+ "role": "execute",
630
+ "scope": "M01-T01",
631
+ "candidateId": "candidate-digest",
632
+ "channel": "deepseek-account-sdk",
633
+ "taskDir": "/absolute/repo/docs/task"
634
+ }
635
+ ```
636
+
637
+ `invocationId` 必须等于外层 requestId,taskDir 是绝对目录;candidateId 可省略,
638
+ 空 runId 仅保留尚无 main-run 身份的既有调用语义。managed 不授予权限,不允许从
639
+ Start 注入 GUI lease,也不会被当成 model prompt 或 public Pro machine 字段。
640
+ DSH LCU 的 lease 由 worker 成功取得后内部加入。完整 native options 同时保存到
641
+ SessionConfiguration.nativeOptions;state schema 同步接受 nativeProfile/nativeOptions,
642
+ Pro recover.original.native 必须使用原调用内容。
643
+
644
+ ### DSH composition 与实际准入
645
+
646
+ `native:{version:1,preset:"daily"|"heavy",agents?,team?,workflows?,web?,lcu?}`。
647
+ Team/Workflow 要求 agents.enabled。模型仍来自实际 Start provider/model/effort,
648
+ 原生选项不改变账号。生成器固定 0.4.0,公开 `/composition` 产生 SDK global overlay;
649
+ 回执不宣称 named preset 已被公开 SDK 挂载。
650
+
651
+ 正式 prompt 前执行实际 TypeScript PTC probe,确认唯一模型工具 run_code、canonical
652
+ JSON/handles、多图与 deferred-context-v1 或 inspect-image-v1 输出。工具准入使用
653
+ 当前 Agent/model 的真实可用集合。旧未配置 native 的 Start 保留原禁止 delegation
654
+ 路径;显式 native 只开启对应受管树的工具,独立 goal/schedule/辅助标题与自动压缩
655
+ 不因此开启。
656
+
657
+ 本地 session.event/subagent 通知与公开 service 的 durable lifecycle journal共同
658
+ 确定 owned children,包含外部 provider activation。journal 每行含 version、
659
+ journalSequence、requestId、nonce、rootSessionId、invocationId/runId,最多4096条/2MiB。
660
+ root turn-stopping等待flush,关闭回执包含:
661
+
662
+ ```json
663
+ {
664
+ "version": 1,
665
+ "requestId": "call-001",
666
+ "nonce": "owned-random-nonce",
667
+ "cleanup": [],
668
+ "lcu": null,
669
+ "journal": {"complete": true, "events": 0, "bytes": 0}
670
+ }
671
+ ```
672
+
673
+ bytes包含每行末尾换行。worker核对连续序号、每行身份与最终完整性,拒绝symlink/
674
+ 非regular文件/超界与截断。journal不完整使调用失败并保持资源未知,不能只因SDK退出
675
+ 而释放GUI。普通native SDK关闭宽限15秒,LCU135秒;Go外层至少20/145秒。
676
+
677
+ LCU使用0.5.0公开 managed API,PTC工具名lcu_cua,程序对象cua。跨进程local-desktop
678
+ lease限制同时操作整台桌面;每次操作检查真实caller和epoch。媒体从实际AttachmentStore
679
+ 归档到task reports/native/invocation,保留captured和archive不同摘要,不能把图片存在
680
+ 当作模型送达。原生runtime的目标权限和用户交互仍保持其真实约束。
681
+
682
+ ### 观察、完成与清理
683
+
684
+ DSH native-event 使用外层 request/session 与 `event`;Pro native-event 使用严格
685
+ adapter 身份、原 managed 和 `native` 观察对象。所有事件只作观察,不是 lifecycle
686
+ ACK,不绕过 durable dispatch checkpoints。Kimi保留其本地server事件与连续订阅事实。
687
+
688
+ 各 native terminal 保留以下共同字段,具体有效配置和用量策略由harness定义:
689
+
690
+ | 字段 | 必须保持的语义 |
691
+ | --- | --- |
692
+ | version | 1 |
693
+ | requested | 与原始 native options JSON 等价;默认值不回填原请求 |
694
+ | effective | matched及实际来源;DSH行为probe、Codex config/read、Claude tools-only等不同事实 |
695
+ | observed / children | bounded、去重、可归属的实际事件和子任务身份 |
696
+ | usage | 计量方法、完整性及不能直接相加的原始证据 |
697
+ | completion | confirmed与pendingIds,在cleanup之前冻结 |
698
+ | cleanup | 本地process group/owned SDK tree/remote job等真实作用域与确认 |
699
+
700
+ root完成但child仍在运行时completion=false;清理取消child不能修改已冻结的完成事实。
701
+ 只有全部事实与外层进程终态相符才成功。未知用量保留null。Codex仅完整owned child
702
+ exclusive delta可加到root;Claude task snapshot不叠加;DSH external无计量、Kimi
703
+ compaction/旧child/Tower等保持未知。
704
+
705
+ ### Kimi native worker
706
+
707
+ 公开入口 `@ckanner/flywheel/kimi-native-worker`,可执行入口
708
+ `flywheel-kimi-native-worker`;Go覆盖变量 `FLYWHEEL_KIMI_NATIVE_WORKER`,CLI覆盖
709
+ `FLYWHEEL_KIMI_BIN`。账号环境使用真实 `KIMI_CODE_HOME`,不复制或更换授权。
710
+
711
+ Start protocol1带native/managed,permissionMode必须danger-full-access。worker
712
+ 拥有loopback Kimi Server的PID/registry/serverID,验证HTTP/WS schemas与有效配置。
713
+ SessionOutcome.protocol为kimi-server/v1;ready/event/result仍经过本地stdio。原始
714
+ HTTP/WS内部端口不向外开放。首turn ordinal=0合法;fresh baseline=-1。
715
+
716
+ mode为agent/swarm/tower,agentProfile可选。无法强制的agents.maxConcurrent明确拒绝。
717
+ Tower独立Git候选只允许Execute在完成/清理与source及外部契约检查后导回;不能作为OS
718
+ 沙箱,也不恢复旧Session。没有durable terminal的调用保持unknown,不声称支持Pro的
719
+ read-only journal recovery。详细字段、协议校验和fixtures见
720
+ [Kimi native protocol](KIMI_NATIVE_PROTOCOL.md)([English](KIMI_NATIVE_PROTOCOL.en.md))。
721
+
722
+ ### 独立 native jobs
723
+
724
+ npm入口 `flywheel native <codex-review|claude-review|claude-team|claude-recover|claude-control>
725
+ --request /absolute/request.json`,使用实际固定public API加绝对recoveryDirectory。
726
+ 输入为最多1MiB的regular NOFOLLOW JSON文件。正常返回一个原生JSON receipt,usage或
727
+ runtime错误保留既有公开结构;diagnostics到stderr。已取消返回130,失败/未知终态
728
+ 返回非零;这不是Go role verdict协议。
729
+
730
+ Codex native review要求fresh ephemeral thread且不进入角色native-profiles,因为
731
+ review/start不消费角色prompt。Claude远端review要求显式consent,使用no-post;
732
+ 本地进程退出不证明云端完成或取消。交互Team拥有独立tmuxserver/pane,控制及恢复按原
733
+ requestId/runId核对。恢复只使用已公开且可证明的事实,不重新派发未知副作用。
734
+
735
+ ### 无推理诊断
736
+
737
+ DSH `--native-doctor`只import固定generator composition与可选LCU managed API,输出
738
+ nativeVersion1、实际依赖可用性、inferenceTested:false、admissionTested:false;不创建
739
+ SDK/Agent/lease。启用native的DSH binding不复用legacy SDK probe作为原生准入结论。
740
+ Kimi `--doctor`检查本地worker接口;Pro要求公开manifest nativeVersion1。Go doctor
741
+ 按binding分别列native.manifest与native.admission,后者在实际worker调用前保持unknown。
@@ -65,9 +65,9 @@ provider, and tools. The reserved `desktop` profile cannot be used as a worker.
65
65
  |---|---|
66
66
  | DeepSeek Flash | DSH `deepseek-account` and explicit `deepseek-flash`; no additional API key is required for the standard shared account store |
67
67
  | DSH ChatGPT | Install and authorize the selected ChatGPT adapter in the SDK profile; changing the desktop chat model does not configure a worker |
68
- | Codex Pro | The worker imports `dsh-subagent-codex-pro/machine` from the pinned 0.9.0 package and uses the installed Codex CLI/login |
69
- | Kimi | Go invokes the native Kimi CLI with its own login; no ACP or parent-model delegation |
70
- | Claude Code Pro | Optional 0.4.0 peer and installed Claude CLI/login; no default loop selects it; follow the [adapter guide](https://github.com/ckanner/flywheel/blob/main/docs/en/claude-code-pro.md) |
68
+ | Codex Pro | The worker imports `dsh-subagent-codex-pro/machine` from the pinned 0.10.0 package and uses the installed Codex CLI/login |
69
+ | Kimi | Go uses the Kimi CLI by default, or its owned local Server worker for native Agent/Swarm/Tower; the same Kimi login applies |
70
+ | Claude Code Pro | Optional 0.5.0 peer and installed Claude CLI/login; no default loop selects it; follow the [adapter guide](https://github.com/ckanner/flywheel/blob/main/docs/en/claude-code-pro.md) |
71
71
 
72
72
  One documented ChatGPT adapter compatibility example is:
73
73
 
@@ -278,12 +278,13 @@ Actual policy is checked before prompting. Full access does not establish an
278
278
  OS sandbox or remove host static denials, account restrictions, or OS permissions.
279
279
  A Git worktree is also not a security sandbox.
280
280
 
281
- The temporary SDK overlay applies only to the independent worker. It disables
282
- recursive delegation, workflow drivers, automatic titles/compaction, scheduled
283
- input, and the entire web-tool package, including search and fetch. Full access
284
- does not restore these auxiliary-model/tool capabilities. Restoring them needs
285
- separate accounting, cancellation, and directory-ownership support. The overlay
286
- does not remove desktop tools or edit reminder storage.
281
+ The temporary SDK overlay applies only to the independent worker. An explicit
282
+ native-profile enables owned PTC subagents, Team, Workflow, Web and optional LCU;
283
+ without one, the existing tool policy remains in force. Automatic titles,
284
+ compaction, goals and scheduled input remain disabled. Full access alone does
285
+ not enable native capabilities. The overlay does not change desktop presets or
286
+ reminder storage. Use the [native guide](https://github.com/ckanner/flywheel/blob/main/docs/en/native-capabilities.md)
287
+ for configuration, receipts, Tower and independent native Review/Team jobs.
287
288
 
288
289
  Main-task Codex calls check the complete actual sandbox policy at `thread-ready`
289
290
  before Go acknowledges dispatch, then check the terminal receipt again.
@@ -293,11 +294,13 @@ print mode does not provide an OS sandbox that this adapter can promise.
293
294
 
294
295
  A successful result requires a trustworthy terminal receipt and confirmed
295
296
  process cleanup. An outer worker exit does not prove SDK or guardian cleanup.
296
- Graceful SDK shutdown allows two seconds for persistence/disposal before bounded
297
- TERM/KILL cleanup. Lost outcomes preserve evidence and block automatic replay.
297
+ Graceful SDK shutdown allows two seconds for ordinary calls, 15 seconds for
298
+ native calls and 135 seconds for LCU, with at least 20/145 seconds at the Go
299
+ boundary, before bounded TERM/KILL cleanup. Lost outcomes preserve evidence and block automatic replay.
298
300
  Missing usage and subscription dollar cost remain unknown, not zero. Complete
299
301
  worker histories are not automatically merged into the parent's DSH trajectory;
300
- images and attachments are not supported by these worker inputs.
302
+ public Pro inputs support explicit media/structured output, while formal Go
303
+ loops do not automatically inject archived images.
301
304
 
302
305
  ## Maintain and develop
303
306
 
@@ -54,9 +54,9 @@ DSH worker 默认使用独立 `sdk` profile。标准桌面与 SDK 在同一 `DSH
54
54
  |---|---|
55
55
  | DeepSeek Flash | DSH `deepseek-account`,明确指定 `deepseek-flash`;标准共享账号存储不需要额外 API key |
56
56
  | DSH ChatGPT | 在 SDK profile 安装并授权所选 ChatGPT 适配器;桌面对话模型不决定 worker 配置 |
57
- | Codex Pro | worker 导入固定 0.9.0 包的 `dsh-subagent-codex-pro/machine`,使用已安装 Codex CLI 和登录 |
57
+ | Codex Pro | worker 导入固定 0.10.0 包的 `dsh-subagent-codex-pro/machine`,使用已安装 Codex CLI 和登录 |
58
58
  | Kimi | Go 调用原生 Kimi CLI 及其登录;不使用 ACP 或父模型二次委派 |
59
- | Claude Code Pro | 可选 0.4.0 peer 和已安装 Claude CLI/登录;默认无阶段选它,详见[接入指南](https://github.com/ckanner/flywheel/blob/main/docs/zh-CN/claude-code-pro.md) |
59
+ | Claude Code Pro | 可选 0.5.0 peer 和已安装 Claude CLI/登录;默认无阶段选它,详见[接入指南](https://github.com/ckanner/flywheel/blob/main/docs/zh-CN/claude-code-pro.md) |
60
60
 
61
61
  一个已经记录的 ChatGPT 适配器兼容示例:
62
62
 
@@ -226,10 +226,10 @@ DSH worker 支持 read-only、workspace-write 和显式完全权限,审批设
226
226
  prompt 前检查。完全权限不代表 OS 沙箱,也不取消宿主静态拒绝、账号限制或
227
227
  操作系统权限;Git worktree 同样不是安全沙箱。
228
228
 
229
- 临时 SDK overlay 只作用于独立 worker,关闭递归委派、workflow 驱动、自动标题/
230
- 压缩、定时输入及整个 web-tool 包(搜索和抓取)。完全权限不会恢复这些额外模型/
231
- 工具能力;恢复它们需要另外支持计量、取消和目录归属。overlay 不移除桌面工具,
232
- 也不改写提醒存储。
229
+ 临时 SDK overlay 只作用于独立 worker。显式 native-profile 可启用受管 PTC 子 Agent、
230
+ Team、Workflow、Web 与可选 LCU;未选择时保留原工具策略。自动标题、压缩、goal与
231
+ 定时输入仍关闭,完全权限本身不会启用原生能力。overlay 不修改桌面 preset 和提醒。
232
+ 配置、回执、Tower 与独立 Review/Team 入口见[原生能力指南](https://github.com/ckanner/flywheel/blob/main/docs/zh-CN/native-capabilities.md)。
233
233
 
234
234
  主任务 Codex 调用在 `thread-ready` 时核对完整实际沙箱策略,Go 确认后才继续
235
235
  派发;终态回执再次检查。旧版/建议调用保留终态检查。Claude 的原生 init 在
@@ -237,9 +237,9 @@ prompt 之后,不能提供相同的预派发观察;Kimi print 模式也没
237
237
  的 OS 沙箱。
238
238
 
239
239
  成功结果需要可信终态回执和清理确认。外层 worker 退出不能证明 SDK 或 guardian
240
- 已清理。SDK 正常关闭保留两秒用于历史落盘和释放,再进入有界 TERM/KILL 收尾。
240
+ 已清理。普通SDK关闭保留两秒;native为15秒,LCU为135秒,Go外层相应不少于20/145秒,再进入有界TERM/KILL收尾。
241
241
  结果丢失时保留证据并阻断自动重放。缺失用量与订阅美元成本保持 unknown,不填零。
242
- 完整 worker 历史不会自动并入父会话轨迹;这些 worker 输入不支持图片和附件。
242
+ 完整worker历史不会自动并入父会话轨迹;公开Pro machine支持显式图片/结构化输出,正式Go loop不会自动注入所有归档截图。
243
243
 
244
244
  ## 维护与开发
245
245
 
@@ -39,4 +39,8 @@ SOFTWARE.
39
39
 
40
40
  ## Bundled Codex Pro public package
41
41
 
42
- This distribution bundles `dsh-subagent-codex-pro@0.9.0`, Copyright (c) 2026 ckanner, under the MIT License. Its complete license is retained at `node_modules/dsh-subagent-codex-pro/LICENSE` inside the packed plugin. Source identity and tarball integrity are recorded in `vendor/README.md` and `vendor/codex-pro.json` in the source repository. The bundled package is the upstream public machine API implementation, including its compiled supervisor; it contains no native Codex executable or user credentials.
42
+ This distribution bundles `dsh-subagent-codex-pro@0.10.0`, Copyright (c) 2026 ckanner, under the MIT License. Its complete license is retained at `node_modules/dsh-subagent-codex-pro/LICENSE` inside the packed plugin. Source identity and tarball integrity are recorded in `vendor/README.md` and `vendor/codex-pro.json` in the source repository. The bundled package is the upstream public machine API implementation, including its compiled supervisor; it contains no native Codex executable or user credentials.
43
+
44
+ ## Bundled PTC composition source
45
+
46
+ This distribution also bundles `dsh-preset-generator@0.4.0`, Copyright (c) 2026 ckanner, under the MIT License. Its original license remains at `node_modules/dsh-preset-generator/LICENSE`. The public composition module shares the desktop daily/heavy policy with the owned SDK worker. Source identity and actual tarball integrity are recorded in `vendor/preset-generator.json`; no DSH application resources, native executable or credentials are bundled.
@@ -1,17 +1,46 @@
1
- # Bundled public Codex Pro source candidate
1
+ # Verified companion packages
2
2
 
3
- Flywheel imports `dsh-subagent-codex-pro/machine` from the actual public package **0.9.0**. In the source checkout, this directory contains that package's reviewed npm tarball, not a replacement wrapper or a fabricated registry download.
3
+ Flywheel 0.34.0 keeps exact reviewed package bytes. Codex Pro, Claude Code Pro,
4
+ LCU and ChatGPT below have been verified against the public npm registry.
5
+ The private preset generator is intentionally bundled from its reviewed source;
6
+ it has no public npm release. Version, source tree, archive and installed content
7
+ remain separate identities.
4
8
 
5
- - Source: [37da3d75de32b809c4fb1a631ccc15191f3d87f9](https://github.com/ckanner/dsh-subagent-codex-pro/commit/37da3d75de32b809c4fb1a631ccc15191f3d87f9)
6
- - Source tree: `00df1042b0010dc37ce8ab6048f75a434325962c`
7
- - SHA-256: `4a86380fdde0d7f2673c4b1f2d5c8682cf61d6a4b83deb65eab8fe76f6032198`
8
- - npm integrity: `sha512-NtguC96kZVgKOMHv7kSiFVEZ4thjorHS1ZrNFQwbBLEBU2jOSWkFGlXk+BILPuxALUKkJJ4E1DSbA2+JG3gM0Q==`
9
- - Package license: MIT, Copyright (c) 2026 ckanner; the original `LICENSE` is present in the tarball and installed package.
9
+ | Package | Role | Source commit | Source tree | Record |
10
+ | --- | --- | --- | --- | --- |
11
+ | `dsh-subagent-codex-pro@0.10.0` | Bundled machine API | [29b388a28674](https://github.com/ckanner/dsh-subagent-codex-pro/commit/29b388a286748740b8bbbcbcdf0e5bf02038befa) | `47ab29706d2f8346dc600cf96144c7b43263091c` | [codex-pro.json](codex-pro.json) |
12
+ | `dsh-preset-generator@0.4.0` | Bundled private PTC composition | [3dc21791b1ef](https://github.com/ckanner/dsh-preset-generator/commit/3dc21791b1efe81bea9a26aa9e92ff2172b4f645) | `877ea728cad4d8ef4b21a691df2a03cfc9075efc` | [preset-generator.json](preset-generator.json) |
13
+ | `dsh-subagent-claude-code-pro@0.5.0` | Optional machine/native-jobs peer | [e559153123f5](https://github.com/ckanner/dsh-subagent-claude-code-pro/commit/e559153123f52a12c35b758633290cf6ebd4cf4b) | `49ab2543721295bf1c27bb4504a01b41c9acf9fc` | [claude-code-pro.json](claude-code-pro.json) |
14
+ | `dsh-plugin-lcu@0.5.0` | Optional managed desktop peer | [505e516cbc90](https://github.com/ckanner/dsh-plugin-lcu/commit/505e516cbc909556a7b9855a454202cc28b583a8) | `6256c2a947efec8812ae5e4e7e83c4d098ad1ee1` | [lcu.json](lcu.json) |
15
+ | `dsh-plugin-chatgpt@0.1.20` | DSH provider compatibility fixture | [40d8f885e7a3](https://github.com/ckanner/dsh-plugin-chatgpt/commit/40d8f885e7a386af5f441b356b9c68496a47b0e3) | `c8c4f4829a00b1917fd1aef8c4254e083a5b6180` | [chatgpt.json](chatgpt.json) |
10
16
 
11
- The source candidate adds lifecycle v1, durable acknowledgements, an independent supervisor journal, and read-only recovery. It has not been represented as a published registry version. The runtime dependency remains exactly `0.9.0`; the build-harness lock resolves `file:vendor/…tgz` and the root lock resolves `file:plugins/dsh/vendor/…tgz`, both with its actual integrity. `npm ci --ignore-scripts` materializes it, and `bundledDependencies` includes that package in Flywheel's complete tarball. A user installing the checked Flywheel candidate therefore does not need to download or assume the bytes of a registry `0.9.0` release. No native Codex executable, login data, or credentials are bundled.
17
+ Published-package records include the registry URL, exact integrity, SHA-256 and
18
+ verification timestamp. Their verification toolchain does not claim how the
19
+ publisher built the archive. The generator retains its original source-build
20
+ toolchain and `registryReleaseVerified:false`.
12
21
 
13
- The tarball was built with Node 24.22.1/npm 12.2.1 from the pinned tree, using the upstream lockfile, `npm run build`, and `npm pack --ignore-scripts`. Upstream public API, compiled supervisor, and clean npm-install tests cover these bytes. Flywheel additionally runs its real worker/Go bridge and actual single-package installation checks. The package manager uses the lock integrity; `codex-pro.json` records source provenance separately.
22
+ The published Codex and LCU tarballs match their earlier reviewed candidates
23
+ byte-for-byte. Claude 0.5.0 has identical file contents but different archive file
24
+ modes; the current tarball, lock and CI hash are the actual published bytes. npm
25
+ consumer installation normalizes its machine module to readable mode 0644.
26
+ ChatGPT 0.1.20 carries the reviewed image/tool-output changes; its earlier 0.1.19
27
+ source candidate differed only in package version, and is no longer the fixture.
28
+ Historical candidate identities remain in the dated validation records.
14
29
 
15
- Claude Code Pro **0.4.0** remains an optional peer and is not bundled. Its matching source candidate is [ec0b99176b67512f3ca1838ec2a349dcb0189214](https://github.com/ckanner/dsh-subagent-claude-code-pro/commit/ec0b99176b67512f3ca1838ec2a349dcb0189214), with tarball SHA-256 `125951f39d27a87072a9dc20c622a19089ad7ba84b69ba6228e1fbb03f46f581`. CI builds that immutable source, verifies the exact package hash, and installs it before running Claude-specific gates.
30
+ Codex Pro and the generator are exact bundled runtime dependencies. Both source
31
+ locks resolve the corresponding vendor tarballs with actual integrity. Claude
32
+ and LCU remain optional peers; only the private test harness installs them by
33
+ default. CI fetches the exact published Claude 0.5.0 tarball, verifies its SHA-256,
34
+ and supplies those same bytes to both OS jobs. ChatGPT is a provider fixture,
35
+ not an additional implicit model backend.
16
36
 
17
- This is source-candidate packaging. It neither publishes the upstream packages nor changes Flywheel's npm `latest` tag.
37
+ The machine entry points remain independent of optional desktop peers. Desktop
38
+ native settings belong to the desktop plugin; direct Flywheel workers use their
39
+ own frozen native profile. Installing a package in the desktop profile does not
40
+ make it available in the global worker resolution tree or upgrade the SDK profile.
41
+ See [native setup](https://github.com/ckanner/flywheel/blob/main/docs/en/native-capabilities.md) and
42
+ the [desktop validation record](../../../docs/validation/2026-11-14-desktop-native-configuration.md).
43
+
44
+ No native provider executable, credentials, or private DSH application resources
45
+ are bundled. Updating these records does not publish Flywheel or alter user
46
+ profiles.
@@ -0,0 +1,21 @@
1
+ {
2
+ "package": "dsh-plugin-chatgpt",
3
+ "version": "0.1.20",
4
+ "repository": "https://github.com/ckanner/dsh-plugin-chatgpt",
5
+ "sourceCommit": "40d8f885e7a386af5f441b356b9c68496a47b0e3",
6
+ "sourceTree": "c8c4f4829a00b1917fd1aef8c4254e083a5b6180",
7
+ "tarball": "dsh-plugin-chatgpt-0.1.20.tgz",
8
+ "sha256": "c83db328fcf79289cf4e7fcf72c412b6cbcebd55e52bc587cadd88eb41fe6ae2",
9
+ "integrity": "sha512-vG+BxRoIpet1Qna+2yTl/4bKzOUikhyaECwQvqlmlbbpdaqz5M4c3h5wIThuVY3akfXXnjSqf9a+9HPjeycSHw==",
10
+ "license": "MIT",
11
+ "registryReleaseVerified": true,
12
+ "registry": {
13
+ "tarball": "https://registry.npmjs.org/dsh-plugin-chatgpt/-/dsh-plugin-chatgpt-0.1.20.tgz",
14
+ "integrity": "sha512-vG+BxRoIpet1Qna+2yTl/4bKzOUikhyaECwQvqlmlbbpdaqz5M4c3h5wIThuVY3akfXXnjSqf9a+9HPjeycSHw==",
15
+ "verifiedAt": "2026-11-14T14:31:42.229804+00:00"
16
+ },
17
+ "verificationToolchain": {
18
+ "node": "24.22.1",
19
+ "npm": "12.2.1"
20
+ }
21
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "package": "dsh-subagent-claude-code-pro",
3
+ "version": "0.5.0",
4
+ "repository": "https://github.com/ckanner/dsh-subagent-claude-code-pro",
5
+ "sourceCommit": "e559153123f52a12c35b758633290cf6ebd4cf4b",
6
+ "sourceTree": "49ab2543721295bf1c27bb4504a01b41c9acf9fc",
7
+ "tarball": "dsh-subagent-claude-code-pro-0.5.0.tgz",
8
+ "sha256": "fb15e28f7216d6e49a6717bad2fd568d2e00e7724feaadafae54405fd7a7597d",
9
+ "integrity": "sha512-Rd5EsxHMhLi8e6P3bOMwFFO2GfKU73zTHqgNCx20MkkobRJ+QQDamd+12pSIQoSrFoAF9R+Ls50Mx8DcDGEzUA==",
10
+ "license": "MIT",
11
+ "registryReleaseVerified": true,
12
+ "registry": {
13
+ "tarball": "https://registry.npmjs.org/dsh-subagent-claude-code-pro/-/dsh-subagent-claude-code-pro-0.5.0.tgz",
14
+ "integrity": "sha512-Rd5EsxHMhLi8e6P3bOMwFFO2GfKU73zTHqgNCx20MkkobRJ+QQDamd+12pSIQoSrFoAF9R+Ls50Mx8DcDGEzUA==",
15
+ "verifiedAt": "2026-11-14T14:31:42.202800+00:00"
16
+ },
17
+ "verificationToolchain": {
18
+ "node": "24.22.1",
19
+ "npm": "12.2.1"
20
+ }
21
+ }