shennian 0.5.0 → 0.5.1

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 (336) hide show
  1. package/README.md +2 -2
  2. package/dist/publish-build-manifest.json +157 -107
  3. package/dist/src/agents/acp/capability-cache.js +2 -2
  4. package/dist/src/agents/acp/catalog.js +2 -2
  5. package/dist/src/agents/acp/manifests.js +2 -2
  6. package/dist/src/agents/claude.js +8 -6
  7. package/dist/src/agents/codex.js +2 -2
  8. package/dist/src/agents/command-spec.js +4 -4
  9. package/dist/src/agents/cursor.js +1 -1
  10. package/dist/src/agents/custom-recovery-conformance.js +2 -2
  11. package/dist/src/agents/gemini.js +1 -1
  12. package/dist/src/agents/model-registry/service.js +1 -1
  13. package/dist/src/agents/openclaw.js +2 -2
  14. package/dist/src/agents/opencode.js +1 -1
  15. package/dist/src/agents/pi-coding-agent.js +4 -4
  16. package/dist/src/agents/pi-session-ownership.js +2 -2
  17. package/dist/src/agents/spawn-errors.js +1 -0
  18. package/dist/src/agents/windows-agent-paths.js +1 -0
  19. package/dist/src/commands/agent-readiness.js +2 -2
  20. package/dist/src/commands/daemon-service-spec.js +1 -1
  21. package/dist/src/commands/daemon.js +6 -6
  22. package/dist/src/commands/queue.js +1 -0
  23. package/dist/src/commands/room.js +3 -3
  24. package/dist/src/config/index.js +2 -2
  25. package/dist/src/fs/atomic-rename.js +1 -0
  26. package/dist/src/index.js +3 -3
  27. package/dist/src/native-fusion/claude-entry-parser.js +7 -0
  28. package/dist/src/native-fusion/local-repository.js +2 -2
  29. package/dist/src/native-fusion/native-source-deletions.js +2 -2
  30. package/dist/src/native-fusion/parsers.js +1 -3
  31. package/dist/src/native-fusion/state.js +2 -2
  32. package/dist/src/personal-sync/epoch.js +2 -2
  33. package/dist/src/personal-sync/identity.js +2 -2
  34. package/dist/src/relay/client.js +1 -1
  35. package/dist/src/room/activation-service.js +6 -6
  36. package/dist/src/room/attachment-cache.js +2 -2
  37. package/dist/src/room/host-session-observations.js +2 -2
  38. package/dist/src/room/managed-context.js +1 -1
  39. package/dist/src/room/managed-room-ipc.js +2 -2
  40. package/dist/src/room/mirror-sync-service.js +1 -1
  41. package/dist/src/room/public-attachment-cache.js +2 -2
  42. package/dist/src/room/room-error-guidance.js +1 -0
  43. package/dist/src/room/session-registry.js +2 -2
  44. package/dist/src/security/managed-agent-policy.js +1 -1
  45. package/dist/src/security/managed-agent-runtime.js +1 -1
  46. package/dist/src/session/attachment-transfer-store.js +2 -2
  47. package/dist/src/session/canonical-store.js +5 -5
  48. package/dist/src/session/deletion-sync-state.js +2 -2
  49. package/dist/src/session/handlers/chat-adapter-config.js +1 -1
  50. package/dist/src/session/handlers/chat-events.js +2 -2
  51. package/dist/src/session/handlers/chat-recovery.js +1 -1
  52. package/dist/src/session/handlers/chat.js +1 -1
  53. package/dist/src/session/manager.js +1 -1
  54. package/dist/src/session/native-cleanup-outbox.js +2 -2
  55. package/dist/src/session/queue-diagnostics.js +1 -0
  56. package/dist/src/session/queue-dispatch-failure.js +1 -0
  57. package/dist/src/session/queue-helpers.js +5 -5
  58. package/dist/src/session/queue-retry.js +1 -1
  59. package/dist/src/session/queue-storage.js +2 -2
  60. package/dist/src/session/queue.js +1 -1
  61. package/dist/src/session/room-reply-notice.js +1 -0
  62. package/dist/src/session/run-recovery/journal.js +2 -2
  63. package/dist/src/session/run-stall.js +1 -0
  64. package/dist/src/session/store.js +2 -2
  65. package/dist/src/session/tool-detail-store.js +2 -2
  66. package/node_modules/@shennian/wire/dist/agent-capabilities.js +1 -1
  67. package/node_modules/@shennian/wire/dist/agent-workspace.js +1 -144
  68. package/node_modules/@shennian/wire/dist/envelope.js +1 -1
  69. package/node_modules/@shennian/wire/dist/events.js +1 -1
  70. package/node_modules/@shennian/wire/dist/external-message-format.js +3 -70
  71. package/node_modules/@shennian/wire/dist/frames.js +1 -1
  72. package/node_modules/@shennian/wire/dist/fs.js +2 -7
  73. package/node_modules/@shennian/wire/dist/index.js +1 -21
  74. package/node_modules/@shennian/wire/dist/machine.js +1 -1
  75. package/node_modules/@shennian/wire/dist/message-payload.js +8 -307
  76. package/node_modules/@shennian/wire/dist/methods.js +1 -3
  77. package/node_modules/@shennian/wire/dist/native-session.js +1 -1
  78. package/node_modules/@shennian/wire/dist/project-fs.js +1 -462
  79. package/node_modules/@shennian/wire/dist/project-path.js +1 -25
  80. package/node_modules/@shennian/wire/dist/project.js +1 -3
  81. package/node_modules/@shennian/wire/dist/relay-connectivity.js +1 -29
  82. package/node_modules/@shennian/wire/dist/room.js +1 -20
  83. package/node_modules/@shennian/wire/dist/schedule.js +1 -1
  84. package/node_modules/@shennian/wire/dist/session-sync.js +1 -123
  85. package/node_modules/@shennian/wire/dist/session.js +1 -60
  86. package/node_modules/@shennian/wire/dist/tool-detail.js +1 -9
  87. package/node_modules/@shennian/wire/dist/voice-chief.js +1 -3
  88. package/package.json +3 -8
  89. package/dist/bin/shennian.d.ts +0 -2
  90. package/dist/src/agent-env.d.ts +0 -44
  91. package/dist/src/agents/acp/adapter.d.ts +0 -82
  92. package/dist/src/agents/acp/auth-state.d.ts +0 -3
  93. package/dist/src/agents/acp/auth.d.ts +0 -7
  94. package/dist/src/agents/acp/capability-cache.d.ts +0 -14
  95. package/dist/src/agents/acp/catalog.d.ts +0 -11
  96. package/dist/src/agents/acp/client-services.d.ts +0 -37
  97. package/dist/src/agents/acp/discovery.d.ts +0 -10
  98. package/dist/src/agents/acp/events.d.ts +0 -4
  99. package/dist/src/agents/acp/manifests.d.ts +0 -63
  100. package/dist/src/agents/acp/metrics.d.ts +0 -24
  101. package/dist/src/agents/acp/package-commands.d.ts +0 -4
  102. package/dist/src/agents/acp/process-client.d.ts +0 -41
  103. package/dist/src/agents/acp/process-tree.d.ts +0 -2
  104. package/dist/src/agents/acp/types.d.ts +0 -31
  105. package/dist/src/agents/acp/watcher.d.ts +0 -22
  106. package/dist/src/agents/adapter.d.ts +0 -180
  107. package/dist/src/agents/auth-status.d.ts +0 -4
  108. package/dist/src/agents/claude-managed-permissions.d.ts +0 -33
  109. package/dist/src/agents/claude.d.ts +0 -69
  110. package/dist/src/agents/codex-managed-permissions.d.ts +0 -32
  111. package/dist/src/agents/codex-managed-room-tools.d.ts +0 -41
  112. package/dist/src/agents/codex-protocol.d.ts +0 -103
  113. package/dist/src/agents/codex-runtime.d.ts +0 -91
  114. package/dist/src/agents/codex-utils.d.ts +0 -29
  115. package/dist/src/agents/codex.d.ts +0 -59
  116. package/dist/src/agents/command-spec.d.ts +0 -55
  117. package/dist/src/agents/config-status.d.ts +0 -18
  118. package/dist/src/agents/cursor-managed-permissions.d.ts +0 -28
  119. package/dist/src/agents/cursor.d.ts +0 -44
  120. package/dist/src/agents/custom-managed-runtime.d.ts +0 -37
  121. package/dist/src/agents/custom-recovery-conformance.d.ts +0 -2
  122. package/dist/src/agents/custom.d.ts +0 -62
  123. package/dist/src/agents/detect.d.ts +0 -23
  124. package/dist/src/agents/event-terminal-gate.d.ts +0 -16
  125. package/dist/src/agents/external-channel-instructions.d.ts +0 -4
  126. package/dist/src/agents/gemini.d.ts +0 -32
  127. package/dist/src/agents/manager.d.ts +0 -57
  128. package/dist/src/agents/model-registry/cache.d.ts +0 -4
  129. package/dist/src/agents/model-registry/discovery.d.ts +0 -4
  130. package/dist/src/agents/model-registry/opencode-api.d.ts +0 -2
  131. package/dist/src/agents/model-registry/parsers.d.ts +0 -20
  132. package/dist/src/agents/model-registry/runner.d.ts +0 -6
  133. package/dist/src/agents/model-registry/service.d.ts +0 -10
  134. package/dist/src/agents/model-registry/types.d.ts +0 -39
  135. package/dist/src/agents/model-registry.d.ts +0 -17
  136. package/dist/src/agents/native-capabilities.d.ts +0 -10
  137. package/dist/src/agents/openclaw.d.ts +0 -29
  138. package/dist/src/agents/opencode-managed-permissions.d.ts +0 -25
  139. package/dist/src/agents/opencode.d.ts +0 -46
  140. package/dist/src/agents/pi-coding-agent-managed-permissions.d.ts +0 -7
  141. package/dist/src/agents/pi-coding-agent.d.ts +0 -63
  142. package/dist/src/agents/pi-managed-extension.d.ts +0 -12
  143. package/dist/src/agents/pi-managed-model-broker.d.ts +0 -27
  144. package/dist/src/agents/pi-rpc-client.d.ts +0 -31
  145. package/dist/src/agents/pi-session-ownership.d.ts +0 -2
  146. package/dist/src/agents/platform-instructions.d.ts +0 -5
  147. package/dist/src/agents/runtime-compatibility.d.ts +0 -11
  148. package/dist/src/agents/workbuddy-managed-permissions.d.ts +0 -37
  149. package/dist/src/agents/workbuddy.d.ts +0 -63
  150. package/dist/src/commands/agent-readiness.d.ts +0 -17
  151. package/dist/src/commands/agent.d.ts +0 -2
  152. package/dist/src/commands/daemon-instance-lock.d.ts +0 -21
  153. package/dist/src/commands/daemon-process.d.ts +0 -6
  154. package/dist/src/commands/daemon-service-spec.d.ts +0 -26
  155. package/dist/src/commands/daemon-start-wait.d.ts +0 -9
  156. package/dist/src/commands/daemon-state.d.ts +0 -57
  157. package/dist/src/commands/daemon-windows.d.ts +0 -33
  158. package/dist/src/commands/daemon.d.ts +0 -67
  159. package/dist/src/commands/integration.d.ts +0 -3
  160. package/dist/src/commands/logout.d.ts +0 -3
  161. package/dist/src/commands/manager.d.ts +0 -2
  162. package/dist/src/commands/pair-authorization.d.ts +0 -3
  163. package/dist/src/commands/pair-browser.d.ts +0 -44
  164. package/dist/src/commands/pair-qr.d.ts +0 -4
  165. package/dist/src/commands/pair.d.ts +0 -19
  166. package/dist/src/commands/room.d.ts +0 -16
  167. package/dist/src/commands/runtime.d.ts +0 -2
  168. package/dist/src/commands/schedule.d.ts +0 -2
  169. package/dist/src/commands/tools.d.ts +0 -2
  170. package/dist/src/commands/upgrade.d.ts +0 -31
  171. package/dist/src/commands/worker.d.ts +0 -11
  172. package/dist/src/config/index.d.ts +0 -58
  173. package/dist/src/daemon-ipc/agent-readiness.d.ts +0 -15
  174. package/dist/src/daemon-ipc/client.d.ts +0 -8
  175. package/dist/src/daemon-ipc/control.d.ts +0 -16
  176. package/dist/src/daemon-ipc/json.d.ts +0 -3
  177. package/dist/src/daemon-ipc/paths.d.ts +0 -15
  178. package/dist/src/daemon-ipc/protocol.d.ts +0 -31
  179. package/dist/src/daemon-ipc/secret.d.ts +0 -3
  180. package/dist/src/daemon-ipc/server.d.ts +0 -20
  181. package/dist/src/daemon-log.d.ts +0 -9
  182. package/dist/src/env-path.d.ts +0 -15
  183. package/dist/src/fs/boundary.d.ts +0 -23
  184. package/dist/src/fs/handler.d.ts +0 -26
  185. package/dist/src/fs/security.d.ts +0 -2
  186. package/dist/src/fs/text-decoder.d.ts +0 -10
  187. package/dist/src/index.d.ts +0 -1
  188. package/dist/src/log-redaction.d.ts +0 -4
  189. package/dist/src/log-reporter.d.ts +0 -41
  190. package/dist/src/manager/prompt.d.ts +0 -2
  191. package/dist/src/manager/registry.d.ts +0 -184
  192. package/dist/src/manager/retired-external-channel-compat.d.ts +0 -78
  193. package/dist/src/manager/runtime.d.ts +0 -90
  194. package/dist/src/manager/worker-ipc.d.ts +0 -28
  195. package/dist/src/manager/worker-markdown.d.ts +0 -10
  196. package/dist/src/native-fusion/codex-files.d.ts +0 -10
  197. package/dist/src/native-fusion/codex-message-parser.d.ts +0 -9
  198. package/dist/src/native-fusion/codex-parser.d.ts +0 -8
  199. package/dist/src/native-fusion/codex-user-input.d.ts +0 -11
  200. package/dist/src/native-fusion/config.d.ts +0 -1
  201. package/dist/src/native-fusion/file-identity.d.ts +0 -9
  202. package/dist/src/native-fusion/file-watcher.d.ts +0 -26
  203. package/dist/src/native-fusion/local-repository.d.ts +0 -90
  204. package/dist/src/native-fusion/native-source-deletions.d.ts +0 -47
  205. package/dist/src/native-fusion/opencode-parser.d.ts +0 -29
  206. package/dist/src/native-fusion/parser-common.d.ts +0 -35
  207. package/dist/src/native-fusion/parsers.d.ts +0 -13
  208. package/dist/src/native-fusion/service.d.ts +0 -64
  209. package/dist/src/native-fusion/session-header.d.ts +0 -13
  210. package/dist/src/native-fusion/session-native-sources.d.ts +0 -24
  211. package/dist/src/native-fusion/source-visibility-audit.d.ts +0 -16
  212. package/dist/src/native-fusion/source-visibility.d.ts +0 -25
  213. package/dist/src/native-fusion/state.d.ts +0 -4
  214. package/dist/src/native-fusion/types.d.ts +0 -82
  215. package/dist/src/personal-sync/epoch.d.ts +0 -17
  216. package/dist/src/personal-sync/identity.d.ts +0 -1
  217. package/dist/src/personal-sync/machine-authority.d.ts +0 -12
  218. package/dist/src/personal-sync/metrics.d.ts +0 -25
  219. package/dist/src/personal-sync/paths.d.ts +0 -5
  220. package/dist/src/region.d.ts +0 -15
  221. package/dist/src/relay/client.d.ts +0 -81
  222. package/dist/src/room/activation-audit.d.ts +0 -15
  223. package/dist/src/room/activation-policy.d.ts +0 -8
  224. package/dist/src/room/activation-service.d.ts +0 -77
  225. package/dist/src/room/attachment-cache.d.ts +0 -44
  226. package/dist/src/room/attachment-upload.d.ts +0 -20
  227. package/dist/src/room/device-authorization-client.d.ts +0 -91
  228. package/dist/src/room/host-session-observations.d.ts +0 -54
  229. package/dist/src/room/invite-bootstrap.d.ts +0 -49
  230. package/dist/src/room/invite-qr.d.ts +0 -6
  231. package/dist/src/room/live-delivery.d.ts +0 -5
  232. package/dist/src/room/managed-context.d.ts +0 -49
  233. package/dist/src/room/managed-prompt-composer.d.ts +0 -47
  234. package/dist/src/room/managed-room-binding.d.ts +0 -69
  235. package/dist/src/room/managed-room-ipc.d.ts +0 -65
  236. package/dist/src/room/mirror-sync-service.d.ts +0 -49
  237. package/dist/src/room/public-attachment-cache.d.ts +0 -34
  238. package/dist/src/room/public-room-client.d.ts +0 -37
  239. package/dist/src/room/registration-authority.d.ts +0 -4
  240. package/dist/src/room/room-action-client-types.d.ts +0 -137
  241. package/dist/src/room/room-action-client.d.ts +0 -116
  242. package/dist/src/room/room-binding-client.d.ts +0 -62
  243. package/dist/src/room/session-registry.d.ts +0 -158
  244. package/dist/src/runtime-distribution.d.ts +0 -7
  245. package/dist/src/schedules/personal-context.d.ts +0 -2
  246. package/dist/src/schedules/server-client.d.ts +0 -19
  247. package/dist/src/security/managed-agent-credential-paths.d.ts +0 -6
  248. package/dist/src/security/managed-agent-executable.d.ts +0 -19
  249. package/dist/src/security/managed-agent-policy.d.ts +0 -66
  250. package/dist/src/security/managed-agent-runtime.d.ts +0 -44
  251. package/dist/src/session/archive-zip.d.ts +0 -10
  252. package/dist/src/session/attachment-reference.d.ts +0 -2
  253. package/dist/src/session/attachment-transfer-store.d.ts +0 -45
  254. package/dist/src/session/canonical-store.d.ts +0 -104
  255. package/dist/src/session/deletion-sync-state.d.ts +0 -20
  256. package/dist/src/session/deletion-sync-validation.d.ts +0 -2
  257. package/dist/src/session/deletion-synchronizer.d.ts +0 -9
  258. package/dist/src/session/handlers/agent-capabilities.d.ts +0 -3
  259. package/dist/src/session/handlers/agent-config.d.ts +0 -7
  260. package/dist/src/session/handlers/agent-control.d.ts +0 -4
  261. package/dist/src/session/handlers/agent-workspace-validation.d.ts +0 -28
  262. package/dist/src/session/handlers/agents.d.ts +0 -11
  263. package/dist/src/session/handlers/chat-adapter-config.d.ts +0 -11
  264. package/dist/src/session/handlers/chat-context.d.ts +0 -31
  265. package/dist/src/session/handlers/chat-events.d.ts +0 -5
  266. package/dist/src/session/handlers/chat-recovery.d.ts +0 -4
  267. package/dist/src/session/handlers/chat-session-lifecycle.d.ts +0 -9
  268. package/dist/src/session/handlers/chat.d.ts +0 -6
  269. package/dist/src/session/handlers/control.d.ts +0 -5
  270. package/dist/src/session/handlers/fs.d.ts +0 -14
  271. package/dist/src/session/handlers/message-status.d.ts +0 -3
  272. package/dist/src/session/handlers/pi-validation-session.d.ts +0 -7
  273. package/dist/src/session/handlers/project-fs.d.ts +0 -11
  274. package/dist/src/session/handlers/remote-access.d.ts +0 -4
  275. package/dist/src/session/handlers/room-managed.d.ts +0 -6
  276. package/dist/src/session/handlers/session-refresh.d.ts +0 -3
  277. package/dist/src/session/handlers/title.d.ts +0 -3
  278. package/dist/src/session/handlers/tool-detail.d.ts +0 -3
  279. package/dist/src/session/handlers/voice-window.d.ts +0 -3
  280. package/dist/src/session/history-subscriptions.d.ts +0 -29
  281. package/dist/src/session/index-publisher.d.ts +0 -3
  282. package/dist/src/session/manager-event-authority.d.ts +0 -3
  283. package/dist/src/session/manager.d.ts +0 -95
  284. package/dist/src/session/native-cleanup-outbox.d.ts +0 -64
  285. package/dist/src/session/native-session-lifecycle.d.ts +0 -56
  286. package/dist/src/session/project-fs-store.d.ts +0 -43
  287. package/dist/src/session/projection.d.ts +0 -3
  288. package/dist/src/session/queue-control.d.ts +0 -27
  289. package/dist/src/session/queue-helpers.d.ts +0 -20
  290. package/dist/src/session/queue-message.d.ts +0 -35
  291. package/dist/src/session/queue-retry.d.ts +0 -11
  292. package/dist/src/session/queue-storage.d.ts +0 -8
  293. package/dist/src/session/queue-types.d.ts +0 -31
  294. package/dist/src/session/queue.d.ts +0 -73
  295. package/dist/src/session/queued-chat-dispatch.d.ts +0 -12
  296. package/dist/src/session/run-recovery/barrier.d.ts +0 -12
  297. package/dist/src/session/run-recovery/coordinator.d.ts +0 -32
  298. package/dist/src/session/run-recovery/journal.d.ts +0 -30
  299. package/dist/src/session/run-recovery/schema.d.ts +0 -48
  300. package/dist/src/session/store.d.ts +0 -128
  301. package/dist/src/session/tool-detail-store.d.ts +0 -17
  302. package/dist/src/session/turn-trigger.d.ts +0 -43
  303. package/dist/src/session/types.d.ts +0 -93
  304. package/dist/src/tools/markdown-to-pdf.d.ts +0 -42
  305. package/dist/src/upgrade/channel.d.ts +0 -5
  306. package/dist/src/upgrade/distribution.d.ts +0 -21
  307. package/dist/src/upgrade/engine.d.ts +0 -104
  308. package/dist/src/upgrade/scheduler.d.ts +0 -60
  309. package/dist/src/upgrade/updater-bootstrap.d.ts +0 -12
  310. package/dist/src/upgrade/updater-launcher.d.ts +0 -37
  311. package/dist/src/upgrade/updater-protocol.d.ts +0 -40
  312. package/dist/src/upgrade/updater-service-entry.d.ts +0 -7
  313. package/dist/src/upgrade/updater-worker.d.ts +0 -57
  314. package/dist/src/windows-shell.d.ts +0 -6
  315. package/node_modules/@shennian/wire/dist/agent-capabilities.d.ts +0 -16
  316. package/node_modules/@shennian/wire/dist/agent-workspace.d.ts +0 -133
  317. package/node_modules/@shennian/wire/dist/envelope.d.ts +0 -7
  318. package/node_modules/@shennian/wire/dist/events.d.ts +0 -125
  319. package/node_modules/@shennian/wire/dist/external-message-format.d.ts +0 -37
  320. package/node_modules/@shennian/wire/dist/frames.d.ts +0 -33
  321. package/node_modules/@shennian/wire/dist/fs.d.ts +0 -107
  322. package/node_modules/@shennian/wire/dist/index.d.ts +0 -21
  323. package/node_modules/@shennian/wire/dist/machine.d.ts +0 -160
  324. package/node_modules/@shennian/wire/dist/message-payload.d.ts +0 -71
  325. package/node_modules/@shennian/wire/dist/methods.d.ts +0 -5
  326. package/node_modules/@shennian/wire/dist/native-session.d.ts +0 -20
  327. package/node_modules/@shennian/wire/dist/project-fs.d.ts +0 -146
  328. package/node_modules/@shennian/wire/dist/project-path.d.ts +0 -4
  329. package/node_modules/@shennian/wire/dist/project.d.ts +0 -16
  330. package/node_modules/@shennian/wire/dist/relay-connectivity.d.ts +0 -30
  331. package/node_modules/@shennian/wire/dist/room.d.ts +0 -190
  332. package/node_modules/@shennian/wire/dist/schedule.d.ts +0 -37
  333. package/node_modules/@shennian/wire/dist/session-sync.d.ts +0 -406
  334. package/node_modules/@shennian/wire/dist/session.d.ts +0 -465
  335. package/node_modules/@shennian/wire/dist/tool-detail.d.ts +0 -38
  336. package/node_modules/@shennian/wire/dist/voice-chief.d.ts +0 -116
package/README.md CHANGED
@@ -6,9 +6,9 @@
6
6
  > - [CLI 设计哲学](../../docs/architecture/cli/design-philosophy.md) — CLI、Skill、daemon、身份与宿主适配边界
7
7
  > - [Daemon 架构](../../docs/architecture/cli/daemon.md) — 模块拓扑、数据流、守护进程
8
8
  > - [Agent Adapters](../../docs/architecture/cli/agent-adapters.md) — 5 种 agent 的适配与归一化
9
- > - [开源 Agent Protocol](../../docs/architecture/cli/agent-protocol.md) — 第三方 agent 接入协议
9
+ > - [Agent Protocol](../../docs/architecture/cli/agent-protocol.md) — 第三方 agent 接入协议
10
10
  >
11
- > **开源协议 & SDK** → [packages/agent-protocol/](../agent-protocol/)
11
+ > **Agent 协议 & SDK** → [packages/agent-protocol/](../agent-protocol/)
12
12
 
13
13
  ## 常用命令
14
14
 
@@ -2,7 +2,7 @@
2
2
  "schemaVersion": 1,
3
3
  "jsMinified": true,
4
4
  "minifier": "esbuild",
5
- "fileCount": 226,
5
+ "fileCount": 236,
6
6
  "files": [
7
7
  {
8
8
  "file": "bin/shennian.js",
@@ -31,13 +31,13 @@
31
31
  },
32
32
  {
33
33
  "file": "src/agents/acp/capability-cache.js",
34
- "beforeBytes": 2374,
35
- "afterBytes": 1411
34
+ "beforeBytes": 2445,
35
+ "afterBytes": 1464
36
36
  },
37
37
  {
38
38
  "file": "src/agents/acp/catalog.js",
39
- "beforeBytes": 5188,
40
- "afterBytes": 2657
39
+ "beforeBytes": 5259,
40
+ "afterBytes": 2710
41
41
  },
42
42
  {
43
43
  "file": "src/agents/acp/client-services.js",
@@ -56,8 +56,8 @@
56
56
  },
57
57
  {
58
58
  "file": "src/agents/acp/manifests.js",
59
- "beforeBytes": 4036,
60
- "afterBytes": 2299
59
+ "beforeBytes": 4107,
60
+ "afterBytes": 2352
61
61
  },
62
62
  {
63
63
  "file": "src/agents/acp/metrics.js",
@@ -106,8 +106,8 @@
106
106
  },
107
107
  {
108
108
  "file": "src/agents/claude.js",
109
- "beforeBytes": 19582,
110
- "afterBytes": 9365
109
+ "beforeBytes": 21692,
110
+ "afterBytes": 10167
111
111
  },
112
112
  {
113
113
  "file": "src/agents/codex-managed-permissions.js",
@@ -136,13 +136,13 @@
136
136
  },
137
137
  {
138
138
  "file": "src/agents/codex.js",
139
- "beforeBytes": 34652,
140
- "afterBytes": 18423
139
+ "beforeBytes": 35060,
140
+ "afterBytes": 18791
141
141
  },
142
142
  {
143
143
  "file": "src/agents/command-spec.js",
144
- "beforeBytes": 19955,
145
- "afterBytes": 9040
144
+ "beforeBytes": 21138,
145
+ "afterBytes": 9486
146
146
  },
147
147
  {
148
148
  "file": "src/agents/config-status.js",
@@ -156,8 +156,8 @@
156
156
  },
157
157
  {
158
158
  "file": "src/agents/cursor.js",
159
- "beforeBytes": 12731,
160
- "afterBytes": 6097
159
+ "beforeBytes": 12806,
160
+ "afterBytes": 6155
161
161
  },
162
162
  {
163
163
  "file": "src/agents/custom-managed-runtime.js",
@@ -166,8 +166,8 @@
166
166
  },
167
167
  {
168
168
  "file": "src/agents/custom-recovery-conformance.js",
169
- "beforeBytes": 1998,
170
- "afterBytes": 1084
169
+ "beforeBytes": 2066,
170
+ "afterBytes": 1134
171
171
  },
172
172
  {
173
173
  "file": "src/agents/custom.js",
@@ -191,8 +191,8 @@
191
191
  },
192
192
  {
193
193
  "file": "src/agents/gemini.js",
194
- "beforeBytes": 6353,
195
- "afterBytes": 3309
194
+ "beforeBytes": 6428,
195
+ "afterBytes": 3367
196
196
  },
197
197
  {
198
198
  "file": "src/agents/manager.js",
@@ -226,8 +226,8 @@
226
226
  },
227
227
  {
228
228
  "file": "src/agents/model-registry/service.js",
229
- "beforeBytes": 7401,
230
- "afterBytes": 2929
229
+ "beforeBytes": 8102,
230
+ "afterBytes": 3106
231
231
  },
232
232
  {
233
233
  "file": "src/agents/model-registry/types.js",
@@ -246,8 +246,8 @@
246
246
  },
247
247
  {
248
248
  "file": "src/agents/openclaw.js",
249
- "beforeBytes": 11104,
250
- "afterBytes": 4973
249
+ "beforeBytes": 11179,
250
+ "afterBytes": 5031
251
251
  },
252
252
  {
253
253
  "file": "src/agents/opencode-managed-permissions.js",
@@ -256,8 +256,8 @@
256
256
  },
257
257
  {
258
258
  "file": "src/agents/opencode.js",
259
- "beforeBytes": 13211,
260
- "afterBytes": 6927
259
+ "beforeBytes": 13286,
260
+ "afterBytes": 6985
261
261
  },
262
262
  {
263
263
  "file": "src/agents/pi-coding-agent-managed-permissions.js",
@@ -266,8 +266,8 @@
266
266
  },
267
267
  {
268
268
  "file": "src/agents/pi-coding-agent.js",
269
- "beforeBytes": 25531,
270
- "afterBytes": 13883
269
+ "beforeBytes": 26430,
270
+ "afterBytes": 14271
271
271
  },
272
272
  {
273
273
  "file": "src/agents/pi-managed-extension.js",
@@ -286,8 +286,8 @@
286
286
  },
287
287
  {
288
288
  "file": "src/agents/pi-session-ownership.js",
289
- "beforeBytes": 2329,
290
- "afterBytes": 1278
289
+ "beforeBytes": 2397,
290
+ "afterBytes": 1328
291
291
  },
292
292
  {
293
293
  "file": "src/agents/platform-instructions.js",
@@ -299,6 +299,16 @@
299
299
  "beforeBytes": 1587,
300
300
  "afterBytes": 732
301
301
  },
302
+ {
303
+ "file": "src/agents/spawn-errors.js",
304
+ "beforeBytes": 638,
305
+ "afterBytes": 201
306
+ },
307
+ {
308
+ "file": "src/agents/windows-agent-paths.js",
309
+ "beforeBytes": 4140,
310
+ "afterBytes": 2288
311
+ },
302
312
  {
303
313
  "file": "src/agents/workbuddy-managed-permissions.js",
304
314
  "beforeBytes": 13486,
@@ -311,8 +321,8 @@
311
321
  },
312
322
  {
313
323
  "file": "src/commands/agent-readiness.js",
314
- "beforeBytes": 3848,
315
- "afterBytes": 3118
324
+ "beforeBytes": 7032,
325
+ "afterBytes": 5639
316
326
  },
317
327
  {
318
328
  "file": "src/commands/agent.js",
@@ -331,8 +341,8 @@
331
341
  },
332
342
  {
333
343
  "file": "src/commands/daemon-service-spec.js",
334
- "beforeBytes": 3873,
335
- "afterBytes": 2332
344
+ "beforeBytes": 4008,
345
+ "afterBytes": 2436
336
346
  },
337
347
  {
338
348
  "file": "src/commands/daemon-start-wait.js",
@@ -351,8 +361,8 @@
351
361
  },
352
362
  {
353
363
  "file": "src/commands/daemon.js",
354
- "beforeBytes": 35833,
355
- "afterBytes": 17960
364
+ "beforeBytes": 35901,
365
+ "afterBytes": 18012
356
366
  },
357
367
  {
358
368
  "file": "src/commands/integration.js",
@@ -389,10 +399,15 @@
389
399
  "beforeBytes": 16512,
390
400
  "afterBytes": 9134
391
401
  },
402
+ {
403
+ "file": "src/commands/queue.js",
404
+ "beforeBytes": 1711,
405
+ "afterBytes": 1157
406
+ },
392
407
  {
393
408
  "file": "src/commands/room.js",
394
- "beforeBytes": 18311,
395
- "afterBytes": 10572
409
+ "beforeBytes": 18602,
410
+ "afterBytes": 10736
396
411
  },
397
412
  {
398
413
  "file": "src/commands/runtime.js",
@@ -421,8 +436,8 @@
421
436
  },
422
437
  {
423
438
  "file": "src/config/index.js",
424
- "beforeBytes": 2801,
425
- "afterBytes": 1662
439
+ "beforeBytes": 2869,
440
+ "afterBytes": 1712
426
441
  },
427
442
  {
428
443
  "file": "src/daemon-ipc/agent-readiness.js",
@@ -474,6 +489,11 @@
474
489
  "beforeBytes": 3337,
475
490
  "afterBytes": 1634
476
491
  },
492
+ {
493
+ "file": "src/fs/atomic-rename.js",
494
+ "beforeBytes": 1619,
495
+ "afterBytes": 407
496
+ },
477
497
  {
478
498
  "file": "src/fs/boundary.js",
479
499
  "beforeBytes": 7102,
@@ -496,8 +516,8 @@
496
516
  },
497
517
  {
498
518
  "file": "src/index.js",
499
- "beforeBytes": 41937,
500
- "afterBytes": 20803
519
+ "beforeBytes": 42379,
520
+ "afterBytes": 20999
501
521
  },
502
522
  {
503
523
  "file": "src/log-redaction.js",
@@ -539,6 +559,11 @@
539
559
  "beforeBytes": 1327,
540
560
  "afterBytes": 884
541
561
  },
562
+ {
563
+ "file": "src/native-fusion/claude-entry-parser.js",
564
+ "beforeBytes": 12235,
565
+ "afterBytes": 5313
566
+ },
542
567
  {
543
568
  "file": "src/native-fusion/codex-files.js",
544
569
  "beforeBytes": 4582,
@@ -576,13 +601,13 @@
576
601
  },
577
602
  {
578
603
  "file": "src/native-fusion/local-repository.js",
579
- "beforeBytes": 27624,
580
- "afterBytes": 13695
604
+ "beforeBytes": 28392,
605
+ "afterBytes": 13832
581
606
  },
582
607
  {
583
608
  "file": "src/native-fusion/native-source-deletions.js",
584
- "beforeBytes": 6821,
585
- "afterBytes": 3687
609
+ "beforeBytes": 6889,
610
+ "afterBytes": 3737
586
611
  },
587
612
  {
588
613
  "file": "src/native-fusion/opencode-parser.js",
@@ -596,8 +621,8 @@
596
621
  },
597
622
  {
598
623
  "file": "src/native-fusion/parsers.js",
599
- "beforeBytes": 6594,
600
- "afterBytes": 3602
624
+ "beforeBytes": 4626,
625
+ "afterBytes": 2785
601
626
  },
602
627
  {
603
628
  "file": "src/native-fusion/service.js",
@@ -626,8 +651,8 @@
626
651
  },
627
652
  {
628
653
  "file": "src/native-fusion/state.js",
629
- "beforeBytes": 5715,
630
- "afterBytes": 3080
654
+ "beforeBytes": 5783,
655
+ "afterBytes": 3130
631
656
  },
632
657
  {
633
658
  "file": "src/native-fusion/types.js",
@@ -636,13 +661,13 @@
636
661
  },
637
662
  {
638
663
  "file": "src/personal-sync/epoch.js",
639
- "beforeBytes": 8116,
640
- "afterBytes": 3955
664
+ "beforeBytes": 8184,
665
+ "afterBytes": 4005
641
666
  },
642
667
  {
643
668
  "file": "src/personal-sync/identity.js",
644
- "beforeBytes": 2427,
645
- "afterBytes": 1324
669
+ "beforeBytes": 2495,
670
+ "afterBytes": 1374
646
671
  },
647
672
  {
648
673
  "file": "src/personal-sync/machine-authority.js",
@@ -666,8 +691,8 @@
666
691
  },
667
692
  {
668
693
  "file": "src/relay/client.js",
669
- "beforeBytes": 18466,
670
- "afterBytes": 8826
694
+ "beforeBytes": 19773,
695
+ "afterBytes": 9589
671
696
  },
672
697
  {
673
698
  "file": "src/room/activation-audit.js",
@@ -681,13 +706,13 @@
681
706
  },
682
707
  {
683
708
  "file": "src/room/activation-service.js",
684
- "beforeBytes": 27631,
685
- "afterBytes": 14835
709
+ "beforeBytes": 28566,
710
+ "afterBytes": 15641
686
711
  },
687
712
  {
688
713
  "file": "src/room/attachment-cache.js",
689
- "beforeBytes": 13659,
690
- "afterBytes": 6480
714
+ "beforeBytes": 13733,
715
+ "afterBytes": 6519
691
716
  },
692
717
  {
693
718
  "file": "src/room/attachment-upload.js",
@@ -701,8 +726,8 @@
701
726
  },
702
727
  {
703
728
  "file": "src/room/host-session-observations.js",
704
- "beforeBytes": 9450,
705
- "afterBytes": 5170
729
+ "beforeBytes": 9518,
730
+ "afterBytes": 5220
706
731
  },
707
732
  {
708
733
  "file": "src/room/invite-bootstrap.js",
@@ -721,8 +746,8 @@
721
746
  },
722
747
  {
723
748
  "file": "src/room/managed-context.js",
724
- "beforeBytes": 4743,
725
- "afterBytes": 2662
749
+ "beforeBytes": 5441,
750
+ "afterBytes": 2760
726
751
  },
727
752
  {
728
753
  "file": "src/room/managed-prompt-composer.js",
@@ -736,18 +761,18 @@
736
761
  },
737
762
  {
738
763
  "file": "src/room/managed-room-ipc.js",
739
- "beforeBytes": 14796,
740
- "afterBytes": 7019
764
+ "beforeBytes": 15469,
765
+ "afterBytes": 7269
741
766
  },
742
767
  {
743
768
  "file": "src/room/mirror-sync-service.js",
744
- "beforeBytes": 11100,
745
- "afterBytes": 5019
769
+ "beforeBytes": 12115,
770
+ "afterBytes": 5558
746
771
  },
747
772
  {
748
773
  "file": "src/room/public-attachment-cache.js",
749
- "beforeBytes": 10361,
750
- "afterBytes": 5048
774
+ "beforeBytes": 10435,
775
+ "afterBytes": 5087
751
776
  },
752
777
  {
753
778
  "file": "src/room/public-room-client.js",
@@ -774,10 +799,15 @@
774
799
  "beforeBytes": 7086,
775
800
  "afterBytes": 4075
776
801
  },
802
+ {
803
+ "file": "src/room/room-error-guidance.js",
804
+ "beforeBytes": 3084,
805
+ "afterBytes": 2082
806
+ },
777
807
  {
778
808
  "file": "src/room/session-registry.js",
779
- "beforeBytes": 30575,
780
- "afterBytes": 17164
809
+ "beforeBytes": 30643,
810
+ "afterBytes": 17214
781
811
  },
782
812
  {
783
813
  "file": "src/runtime-distribution.js",
@@ -806,13 +836,13 @@
806
836
  },
807
837
  {
808
838
  "file": "src/security/managed-agent-policy.js",
809
- "beforeBytes": 7465,
810
- "afterBytes": 3578
839
+ "beforeBytes": 7684,
840
+ "afterBytes": 3719
811
841
  },
812
842
  {
813
843
  "file": "src/security/managed-agent-runtime.js",
814
- "beforeBytes": 6814,
815
- "afterBytes": 3251
844
+ "beforeBytes": 7393,
845
+ "afterBytes": 3348
816
846
  },
817
847
  {
818
848
  "file": "src/session/archive-zip.js",
@@ -826,18 +856,18 @@
826
856
  },
827
857
  {
828
858
  "file": "src/session/attachment-transfer-store.js",
829
- "beforeBytes": 18717,
830
- "afterBytes": 9372
859
+ "beforeBytes": 18791,
860
+ "afterBytes": 9414
831
861
  },
832
862
  {
833
863
  "file": "src/session/canonical-store.js",
834
- "beforeBytes": 31107,
835
- "afterBytes": 15127
864
+ "beforeBytes": 31181,
865
+ "afterBytes": 15168
836
866
  },
837
867
  {
838
868
  "file": "src/session/deletion-sync-state.js",
839
- "beforeBytes": 6026,
840
- "afterBytes": 3190
869
+ "beforeBytes": 6094,
870
+ "afterBytes": 3240
841
871
  },
842
872
  {
843
873
  "file": "src/session/deletion-sync-validation.js",
@@ -876,8 +906,8 @@
876
906
  },
877
907
  {
878
908
  "file": "src/session/handlers/chat-adapter-config.js",
879
- "beforeBytes": 2831,
880
- "afterBytes": 1159
909
+ "beforeBytes": 2897,
910
+ "afterBytes": 1207
881
911
  },
882
912
  {
883
913
  "file": "src/session/handlers/chat-context.js",
@@ -886,13 +916,13 @@
886
916
  },
887
917
  {
888
918
  "file": "src/session/handlers/chat-events.js",
889
- "beforeBytes": 16257,
890
- "afterBytes": 6965
919
+ "beforeBytes": 17576,
920
+ "afterBytes": 7241
891
921
  },
892
922
  {
893
923
  "file": "src/session/handlers/chat-recovery.js",
894
- "beforeBytes": 6525,
895
- "afterBytes": 3449
924
+ "beforeBytes": 6623,
925
+ "afterBytes": 3485
896
926
  },
897
927
  {
898
928
  "file": "src/session/handlers/chat-session-lifecycle.js",
@@ -901,8 +931,8 @@
901
931
  },
902
932
  {
903
933
  "file": "src/session/handlers/chat.js",
904
- "beforeBytes": 33163,
905
- "afterBytes": 13967
934
+ "beforeBytes": 35005,
935
+ "afterBytes": 14959
906
936
  },
907
937
  {
908
938
  "file": "src/session/handlers/control.js",
@@ -976,13 +1006,13 @@
976
1006
  },
977
1007
  {
978
1008
  "file": "src/session/manager.js",
979
- "beforeBytes": 39543,
980
- "afterBytes": 20725
1009
+ "beforeBytes": 40247,
1010
+ "afterBytes": 21132
981
1011
  },
982
1012
  {
983
1013
  "file": "src/session/native-cleanup-outbox.js",
984
- "beforeBytes": 10756,
985
- "afterBytes": 5526
1014
+ "beforeBytes": 10824,
1015
+ "afterBytes": 5576
986
1016
  },
987
1017
  {
988
1018
  "file": "src/session/native-session-lifecycle.js",
@@ -1004,10 +1034,20 @@
1004
1034
  "beforeBytes": 11508,
1005
1035
  "afterBytes": 5870
1006
1036
  },
1037
+ {
1038
+ "file": "src/session/queue-diagnostics.js",
1039
+ "beforeBytes": 2229,
1040
+ "afterBytes": 959
1041
+ },
1042
+ {
1043
+ "file": "src/session/queue-dispatch-failure.js",
1044
+ "beforeBytes": 10071,
1045
+ "afterBytes": 7679
1046
+ },
1007
1047
  {
1008
1048
  "file": "src/session/queue-helpers.js",
1009
- "beforeBytes": 8579,
1010
- "afterBytes": 4271
1049
+ "beforeBytes": 9055,
1050
+ "afterBytes": 4369
1011
1051
  },
1012
1052
  {
1013
1053
  "file": "src/session/queue-message.js",
@@ -1016,13 +1056,13 @@
1016
1056
  },
1017
1057
  {
1018
1058
  "file": "src/session/queue-retry.js",
1019
- "beforeBytes": 1253,
1020
- "afterBytes": 561
1059
+ "beforeBytes": 1302,
1060
+ "afterBytes": 588
1021
1061
  },
1022
1062
  {
1023
1063
  "file": "src/session/queue-storage.js",
1024
- "beforeBytes": 2362,
1025
- "afterBytes": 1166
1064
+ "beforeBytes": 2430,
1065
+ "afterBytes": 1216
1026
1066
  },
1027
1067
  {
1028
1068
  "file": "src/session/queue-types.js",
@@ -1031,14 +1071,19 @@
1031
1071
  },
1032
1072
  {
1033
1073
  "file": "src/session/queue.js",
1034
- "beforeBytes": 40411,
1035
- "afterBytes": 17823
1074
+ "beforeBytes": 40313,
1075
+ "afterBytes": 17923
1036
1076
  },
1037
1077
  {
1038
1078
  "file": "src/session/queued-chat-dispatch.js",
1039
1079
  "beforeBytes": 3189,
1040
1080
  "afterBytes": 1809
1041
1081
  },
1082
+ {
1083
+ "file": "src/session/room-reply-notice.js",
1084
+ "beforeBytes": 1984,
1085
+ "afterBytes": 1845
1086
+ },
1042
1087
  {
1043
1088
  "file": "src/session/run-recovery/barrier.js",
1044
1089
  "beforeBytes": 1061,
@@ -1051,23 +1096,28 @@
1051
1096
  },
1052
1097
  {
1053
1098
  "file": "src/session/run-recovery/journal.js",
1054
- "beforeBytes": 8713,
1055
- "afterBytes": 4267
1099
+ "beforeBytes": 8790,
1100
+ "afterBytes": 4309
1056
1101
  },
1057
1102
  {
1058
1103
  "file": "src/session/run-recovery/schema.js",
1059
1104
  "beforeBytes": 6647,
1060
1105
  "afterBytes": 4272
1061
1106
  },
1107
+ {
1108
+ "file": "src/session/run-stall.js",
1109
+ "beforeBytes": 2885,
1110
+ "afterBytes": 1668
1111
+ },
1062
1112
  {
1063
1113
  "file": "src/session/store.js",
1064
- "beforeBytes": 32798,
1065
- "afterBytes": 16719
1114
+ "beforeBytes": 32866,
1115
+ "afterBytes": 16769
1066
1116
  },
1067
1117
  {
1068
1118
  "file": "src/session/tool-detail-store.js",
1069
- "beforeBytes": 2906,
1070
- "afterBytes": 1429
1119
+ "beforeBytes": 2974,
1120
+ "afterBytes": 1479
1071
1121
  },
1072
1122
  {
1073
1123
  "file": "src/session/turn-trigger.js",
@@ -1,2 +1,2 @@
1
- import c from"node:crypto";import n from"node:fs";import l from"node:path";import{resolveShennianPath as r}from"../../config/index.js";const a="acp-capabilities-v1.json",m=2*1024*1024;function h(e){return e.executableIdentity?c.createHash("sha256").update(JSON.stringify({id:e.manifest.id,command:e.manifest.launch.command,args:e.manifest.launch.args??[],env:e.manifest.launch.env??{},clientCapabilities:e.manifest.clientCapabilities??{},platform:e.platform,catalogRevision:e.catalogRevision??"local",executable:e.executableIdentity})).digest("hex"):null}function b(e){return o().entries[e]??null}function C(e,t){const i=o();i.entries[e]=t;const s=Object.entries(i.entries).slice(-256);f({version:1,entries:Object.fromEntries(s)})}function v(){try{n.unlinkSync(r(a))}catch{}}function o(){try{const e=r(a);if(n.statSync(e).size>m)return{version:1,entries:{}};const t=JSON.parse(n.readFileSync(e,"utf8"));if(t.version!==1||!t.entries||typeof t.entries!="object")throw new Error("invalid");return t}catch{return{version:1,entries:{}}}}function f(e){const t=r(a);n.mkdirSync(l.dirname(t),{recursive:!0,mode:448});const i=`${t}.tmp-${process.pid}-${c.randomUUID()}`;try{n.writeFileSync(i,`${JSON.stringify(e)}
2
- `,{mode:384,flag:"wx"}),n.renameSync(i,t)}finally{try{n.unlinkSync(i)}catch{}}}export{h as buildAcpCapabilityCacheKey,v as clearAcpCapabilityCache,b as readAcpCapabilityCache,C as writeAcpCapabilityCache};
1
+ import c from"node:crypto";import r from"node:fs";import{renameSyncWithRetry as l}from"../../fs/atomic-rename.js";import m from"node:path";import{resolveShennianPath as i}from"../../config/index.js";const a="acp-capabilities-v1.json",f=2*1024*1024;function C(e){return e.executableIdentity?c.createHash("sha256").update(JSON.stringify({id:e.manifest.id,command:e.manifest.launch.command,args:e.manifest.launch.args??[],env:e.manifest.launch.env??{},clientCapabilities:e.manifest.clientCapabilities??{},platform:e.platform,catalogRevision:e.catalogRevision??"local",executable:e.executableIdentity})).digest("hex"):null}function v(e){return o().entries[e]??null}function S(e,t){const n=o();n.entries[e]=t;const s=Object.entries(n.entries).slice(-256);y({version:1,entries:Object.fromEntries(s)})}function g(){try{r.unlinkSync(i(a))}catch{}}function o(){try{const e=i(a);if(r.statSync(e).size>f)return{version:1,entries:{}};const t=JSON.parse(r.readFileSync(e,"utf8"));if(t.version!==1||!t.entries||typeof t.entries!="object")throw new Error("invalid");return t}catch{return{version:1,entries:{}}}}function y(e){const t=i(a);r.mkdirSync(m.dirname(t),{recursive:!0,mode:448});const n=`${t}.tmp-${process.pid}-${c.randomUUID()}`;try{r.writeFileSync(n,`${JSON.stringify(e)}
2
+ `,{mode:384,flag:"wx"}),l(n,t)}finally{try{r.unlinkSync(n)}catch{}}}export{C as buildAcpCapabilityCacheKey,g as clearAcpCapabilityCache,v as readAcpCapabilityCache,S as writeAcpCapabilityCache};
@@ -1,2 +1,2 @@
1
- import n from"node:fs";import u from"node:path";import{resolveShennianPath as f}from"../../config/index.js";import{deriveInstalledPackageCommands as g}from"./package-commands.js";const p="acp-registry-v1.json",s=2*1024*1024;async function S(a={}){const r=i();let e=null;return a.serverUrl&&a.authToken&&(e=await w(a).catch(()=>null),e&&(!r||Date.parse(e.fetchedAt)>=Date.parse(r.fetchedAt))?y(e):e&&r&&(e=r)),e??=r,!e||e.platform!==c()?{candidates:[]}:{revision:e.revision,candidates:e.candidates.flatMap(t=>t.duplicateOf?[]:[...new Set([...t.commands,...g({npm:t.npmPackage,uv:t.uvPackage})])].map(l=>({id:t.id,name:t.name,source:"registry",...t.website?{homepage:t.website}:{},...t.npmPackage||t.uvPackage?{packageHints:{...t.npmPackage?{npm:t.npmPackage}:{},...t.uvPackage?{uv:t.uvPackage}:{}}}:{},launch:{command:l,args:t.args}})))}}function c(){const a=process.platform==="win32"?"windows":process.platform==="darwin"?"darwin":"linux",r=process.arch==="arm64"?"aarch64":"x86_64";return`${a}-${r}`}async function w(a){const r=new AbortController,e=setTimeout(()=>r.abort(),5e3);try{const t=new URL("/api/acp/registry",a.serverUrl);t.searchParams.set("platform",c());const o=await(a.fetchImpl??fetch)(t,{headers:{authorization:`Bearer ${a.authToken}`,...i()?.revision?{"x-shennian-acp-revision":i().revision}:{}},signal:r.signal});if(!o.ok)throw new Error(`ACP catalog request failed (${o.status})`);if(Number(o.headers.get("content-length")??0)>s)throw new Error("ACP catalog exceeds size limit");const m=new Uint8Array(await o.arrayBuffer());if(m.byteLength>s)throw new Error("ACP catalog exceeds size limit");return h(JSON.parse(new TextDecoder().decode(m)))}finally{clearTimeout(e)}}function h(a){if(!a||typeof a!="object")throw new Error("Invalid ACP catalog");const r=a;if(!/^[a-z0-9]+-[a-f0-9]{16}$/.test(r.revision)||!/^[a-f0-9]{64}$/.test(r.digest)||Number.isNaN(Date.parse(r.fetchedAt))||r.platform!==c()||!Array.isArray(r.candidates))throw new Error("Invalid ACP catalog");for(const e of r.candidates)if(!/^[a-z][a-z0-9-]{0,63}$/.test(e.id)||!e.name||e.name.length>80||!Array.isArray(e.commands)||e.commands.some(t=>!/^[a-zA-Z0-9._-]{1,128}$/.test(t))||!Array.isArray(e.args))throw new Error("Invalid ACP catalog candidate");return r}function i(){try{const a=f(p);return n.statSync(a).size>s?null:h(JSON.parse(n.readFileSync(a,"utf8")))}catch{return null}}function y(a){const r=f(p);n.mkdirSync(u.dirname(r),{recursive:!0,mode:448});const e=`${r}.tmp-${process.pid}`;try{n.writeFileSync(e,`${JSON.stringify(a)}
2
- `,{mode:384,flag:"wx"}),n.renameSync(e,r)}finally{try{n.unlinkSync(e)}catch{}}}export{c as currentAcpPlatform,S as loadAcpCatalog};
1
+ import o from"node:fs";import{renameSyncWithRetry as u}from"../../fs/atomic-rename.js";import g from"node:path";import{resolveShennianPath as f}from"../../config/index.js";import{deriveInstalledPackageCommands as y}from"./package-commands.js";const p="acp-registry-v1.json",s=2*1024*1024;async function C(a={}){const r=i();let e=null;return a.serverUrl&&a.authToken&&(e=await w(a).catch(()=>null),e&&(!r||Date.parse(e.fetchedAt)>=Date.parse(r.fetchedAt))?d(e):e&&r&&(e=r)),e??=r,!e||e.platform!==c()?{candidates:[]}:{revision:e.revision,candidates:e.candidates.flatMap(t=>t.duplicateOf?[]:[...new Set([...t.commands,...y({npm:t.npmPackage,uv:t.uvPackage})])].map(l=>({id:t.id,name:t.name,source:"registry",...t.website?{homepage:t.website}:{},...t.npmPackage||t.uvPackage?{packageHints:{...t.npmPackage?{npm:t.npmPackage}:{},...t.uvPackage?{uv:t.uvPackage}:{}}}:{},launch:{command:l,args:t.args}})))}}function c(){const a=process.platform==="win32"?"windows":process.platform==="darwin"?"darwin":"linux",r=process.arch==="arm64"?"aarch64":"x86_64";return`${a}-${r}`}async function w(a){const r=new AbortController,e=setTimeout(()=>r.abort(),5e3);try{const t=new URL("/api/acp/registry",a.serverUrl);t.searchParams.set("platform",c());const n=await(a.fetchImpl??fetch)(t,{headers:{authorization:`Bearer ${a.authToken}`,...i()?.revision?{"x-shennian-acp-revision":i().revision}:{}},signal:r.signal});if(!n.ok)throw new Error(`ACP catalog request failed (${n.status})`);if(Number(n.headers.get("content-length")??0)>s)throw new Error("ACP catalog exceeds size limit");const m=new Uint8Array(await n.arrayBuffer());if(m.byteLength>s)throw new Error("ACP catalog exceeds size limit");return h(JSON.parse(new TextDecoder().decode(m)))}finally{clearTimeout(e)}}function h(a){if(!a||typeof a!="object")throw new Error("Invalid ACP catalog");const r=a;if(!/^[a-z0-9]+-[a-f0-9]{16}$/.test(r.revision)||!/^[a-f0-9]{64}$/.test(r.digest)||Number.isNaN(Date.parse(r.fetchedAt))||r.platform!==c()||!Array.isArray(r.candidates))throw new Error("Invalid ACP catalog");for(const e of r.candidates)if(!/^[a-z][a-z0-9-]{0,63}$/.test(e.id)||!e.name||e.name.length>80||!Array.isArray(e.commands)||e.commands.some(t=>!/^[a-zA-Z0-9._-]{1,128}$/.test(t))||!Array.isArray(e.args))throw new Error("Invalid ACP catalog candidate");return r}function i(){try{const a=f(p);return o.statSync(a).size>s?null:h(JSON.parse(o.readFileSync(a,"utf8")))}catch{return null}}function d(a){const r=f(p);o.mkdirSync(g.dirname(r),{recursive:!0,mode:448});const e=`${r}.tmp-${process.pid}`;try{o.writeFileSync(e,`${JSON.stringify(a)}
2
+ `,{mode:384,flag:"wx"}),u(e,r)}finally{try{o.unlinkSync(e)}catch{}}}export{c as currentAcpPlatform,C as loadAcpCatalog};
@@ -1,2 +1,2 @@
1
- import o from"node:fs";import c from"node:path";import{z as n}from"zod";import{resolveShennianPath as u}from"../../config/index.js";const w="https://shennian.net/schemas/acp-agent-manifest-v1.json",h="acp-agents.d",S=64*1024,f=n.object({schemaVersion:n.literal(1),id:n.string().regex(/^[a-z0-9][a-z0-9._-]{0,63}$/),name:n.string().trim().min(1).max(80),protocol:n.literal("acp"),command:n.string().trim().min(1).max(4096),args:n.array(n.string().max(4096)).max(64).default([]),enabled:n.boolean().default(!0),homepage:n.string().url().refine(t=>new URL(t).protocol==="https:").optional(),clientCapabilities:n.object({readTextFile:n.boolean().default(!1),writeTextFile:n.boolean().default(!1),terminal:n.boolean().default(!1)}).strict().optional()}).strict();function m(){return u(h)}function d(t){const e=f.parse(t);if(e.command.includes("\0")||e.args.some(i=>i.includes("\0")))throw new Error("ACP manifest command contains NUL");if(!c.isAbsolute(e.command)&&c.basename(e.command)!==e.command)throw new Error("ACP manifest command must be absolute or a plain command name");return e}function C(t=m()){let e;try{e=o.readdirSync(t).filter(s=>s.endsWith(".json")).sort()}catch{return[]}const i=[],r=new Set;for(const s of e){const l=c.join(t,s);try{const p=o.statSync(l);if(!p.isFile()||p.size>S)continue;const a=d(JSON.parse(o.readFileSync(l,"utf8")));if(!a.enabled||r.has(a.id))continue;r.add(a.id),i.push({id:a.id,name:a.name,homepage:a.homepage,source:"local",launch:{command:a.command,args:a.args},...a.clientCapabilities?{clientCapabilities:a.clientCapabilities}:{}})}catch{}}return i}function M(t,e=m()){const i=d(t);o.mkdirSync(e,{recursive:!0,mode:448}),process.platform!=="win32"&&o.chmodSync(e,448);const r=c.join(e,`${i.id}.json`),s=`${r}.tmp-${process.pid}`;try{o.writeFileSync(s,`${JSON.stringify(i,null,2)}
2
- `,{mode:384,flag:"wx"}),o.renameSync(s,r),process.platform!=="win32"&&o.chmodSync(r,384)}finally{try{o.unlinkSync(s)}catch{}}return r}function j(t,e=m()){const i=g(t);try{return o.unlinkSync(c.join(e,`${i}.json`)),!0}catch{return!1}}function g(t){return f.shape.id.parse(t)}export{h as ACP_MANIFEST_DIRECTORY,w as ACP_MANIFEST_SCHEMA_ID,m as getAcpManifestDirectory,C as readAcpManifests,j as removeAcpManifest,g as validateAcpId,d as validateAcpManifest,M as writeAcpManifest};
1
+ import i from"node:fs";import{renameSyncWithRetry as u}from"../../fs/atomic-rename.js";import c from"node:path";import{z as t}from"zod";import{resolveShennianPath as h}from"../../config/index.js";const M="https://shennian.net/schemas/acp-agent-manifest-v1.json",S="acp-agents.d",g=64*1024,f=t.object({schemaVersion:t.literal(1),id:t.string().regex(/^[a-z0-9][a-z0-9._-]{0,63}$/),name:t.string().trim().min(1).max(80),protocol:t.literal("acp"),command:t.string().trim().min(1).max(4096),args:t.array(t.string().max(4096)).max(64).default([]),enabled:t.boolean().default(!0),homepage:t.string().url().refine(n=>new URL(n).protocol==="https:").optional(),clientCapabilities:t.object({readTextFile:t.boolean().default(!1),writeTextFile:t.boolean().default(!1),terminal:t.boolean().default(!1)}).strict().optional()}).strict();function m(){return h(S)}function d(n){const e=f.parse(n);if(e.command.includes("\0")||e.args.some(o=>o.includes("\0")))throw new Error("ACP manifest command contains NUL");if(!c.isAbsolute(e.command)&&c.basename(e.command)!==e.command)throw new Error("ACP manifest command must be absolute or a plain command name");return e}function j(n=m()){let e;try{e=i.readdirSync(n).filter(s=>s.endsWith(".json")).sort()}catch{return[]}const o=[],r=new Set;for(const s of e){const l=c.join(n,s);try{const p=i.statSync(l);if(!p.isFile()||p.size>g)continue;const a=d(JSON.parse(i.readFileSync(l,"utf8")));if(!a.enabled||r.has(a.id))continue;r.add(a.id),o.push({id:a.id,name:a.name,homepage:a.homepage,source:"local",launch:{command:a.command,args:a.args},...a.clientCapabilities?{clientCapabilities:a.clientCapabilities}:{}})}catch{}}return o}function E(n,e=m()){const o=d(n);i.mkdirSync(e,{recursive:!0,mode:448}),process.platform!=="win32"&&i.chmodSync(e,448);const r=c.join(e,`${o.id}.json`),s=`${r}.tmp-${process.pid}`;try{i.writeFileSync(s,`${JSON.stringify(o,null,2)}
2
+ `,{mode:384,flag:"wx"}),u(s,r),process.platform!=="win32"&&i.chmodSync(r,384)}finally{try{i.unlinkSync(s)}catch{}}return r}function F(n,e=m()){const o=y(n);try{return i.unlinkSync(c.join(e,`${o}.json`)),!0}catch{return!1}}function y(n){return f.shape.id.parse(n)}export{S as ACP_MANIFEST_DIRECTORY,M as ACP_MANIFEST_SCHEMA_ID,m as getAcpManifestDirectory,j as readAcpManifests,F as removeAcpManifest,y as validateAcpId,d as validateAcpManifest,E as writeAcpManifest};