@excitedjs/dreamux 0.26.0-beta.265 → 0.26.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 (494) hide show
  1. package/CHANGELOG.json +393 -0
  2. package/CHANGELOG.md +71 -1
  3. package/README.md +47 -34
  4. package/dist/admin/client.js +18 -7
  5. package/dist/admin/client.js.map +1 -1
  6. package/dist/admin/socket.js +15 -104
  7. package/dist/admin/socket.js.map +1 -1
  8. package/dist/agent-runtime/capabilities.js +4 -17
  9. package/dist/agent-runtime/capabilities.js.map +1 -1
  10. package/dist/agent-runtime/catalog.js.map +1 -1
  11. package/dist/agent-runtime/external-provider.js.map +1 -1
  12. package/dist/agent-runtime/host-context.js +1 -12
  13. package/dist/agent-runtime/host-context.js.map +1 -1
  14. package/dist/agent-runtime/host-paths.js +1 -1
  15. package/dist/agent-runtime/host-paths.js.map +1 -1
  16. package/dist/agent-runtime/index.js +7 -0
  17. package/dist/agent-runtime/index.js.map +1 -1
  18. package/dist/agent-runtime/skill-sources.js +23 -6
  19. package/dist/agent-runtime/skill-sources.js.map +1 -1
  20. package/dist/channel/catalog.js.map +1 -1
  21. package/dist/channel/external-channel-provider.js.map +1 -1
  22. package/dist/cli/commands/daemon.js +5 -8
  23. package/dist/cli/commands/daemon.js.map +1 -1
  24. package/dist/cli/commands/dispatcher.js +11 -15
  25. package/dist/cli/commands/dispatcher.js.map +1 -1
  26. package/dist/cli/commands/index.js +4 -4
  27. package/dist/cli/commands/index.js.map +1 -1
  28. package/dist/cli/commands/mcp.js +2 -4
  29. package/dist/cli/commands/mcp.js.map +1 -1
  30. package/dist/cli/commands/onboard.js +0 -4
  31. package/dist/cli/commands/onboard.js.map +1 -1
  32. package/dist/cli/commands/parse.js +1 -1
  33. package/dist/cli/commands/parse.js.map +1 -1
  34. package/dist/cli/commands/serve.js +3 -2
  35. package/dist/cli/commands/serve.js.map +1 -1
  36. package/dist/cli/commands/status.js +3 -3
  37. package/dist/cli/commands/status.js.map +1 -1
  38. package/dist/cli/commands/types.js +25 -3
  39. package/dist/cli/commands/types.js.map +1 -1
  40. package/dist/cli/commands/uninstall.js +2 -8
  41. package/dist/cli/commands/uninstall.js.map +1 -1
  42. package/dist/cli/doctor-plugins.js +44 -0
  43. package/dist/cli/doctor-plugins.js.map +1 -0
  44. package/dist/cli/doctor-types.js +2 -0
  45. package/dist/cli/doctor-types.js.map +1 -0
  46. package/dist/cli/doctor.js +48 -125
  47. package/dist/cli/doctor.js.map +1 -1
  48. package/dist/cli/dreamux.js +2 -30
  49. package/dist/cli/dreamux.js.map +1 -1
  50. package/dist/cli/server.js +55 -70
  51. package/dist/cli/server.js.map +1 -1
  52. package/dist/command/errors.js +43 -2
  53. package/dist/command/errors.js.map +1 -1
  54. package/dist/command/host.js +10 -17
  55. package/dist/command/host.js.map +1 -1
  56. package/dist/command/payload.js +0 -9
  57. package/dist/command/payload.js.map +1 -1
  58. package/dist/command/port.js +0 -4
  59. package/dist/command/port.js.map +1 -1
  60. package/dist/command/registry.js +0 -4
  61. package/dist/command/registry.js.map +1 -1
  62. package/dist/command/schema.js.map +1 -1
  63. package/dist/command/types.js.map +1 -0
  64. package/dist/command/validate.js +22 -41
  65. package/dist/command/validate.js.map +1 -1
  66. package/dist/config/commands.js +46 -0
  67. package/dist/config/commands.js.map +1 -0
  68. package/dist/config/config.js +155 -169
  69. package/dist/config/config.js.map +1 -1
  70. package/dist/config/load.js +138 -0
  71. package/dist/config/load.js.map +1 -0
  72. package/dist/config/service.js +196 -0
  73. package/dist/config/service.js.map +1 -0
  74. package/dist/daemon/{service-control.js → control.js} +15 -16
  75. package/dist/daemon/control.js.map +1 -0
  76. package/dist/daemon/environment.js +353 -0
  77. package/dist/daemon/environment.js.map +1 -0
  78. package/dist/daemon/host.js +16 -0
  79. package/dist/daemon/host.js.map +1 -0
  80. package/dist/daemon/install.js +167 -69
  81. package/dist/daemon/install.js.map +1 -1
  82. package/dist/daemon/status.js +87 -0
  83. package/dist/daemon/status.js.map +1 -0
  84. package/dist/{cli/service-status-parse.js → daemon/unit.js} +90 -12
  85. package/dist/daemon/unit.js.map +1 -0
  86. package/dist/{service/mcp/descriptor.js → mcp/launch.js} +3 -7
  87. package/dist/mcp/launch.js.map +1 -0
  88. package/dist/mcp/server.js +9 -5
  89. package/dist/mcp/server.js.map +1 -1
  90. package/dist/mcp/shim.js +18 -16
  91. package/dist/mcp/shim.js.map +1 -1
  92. package/dist/onboard/config-files.js +12 -26
  93. package/dist/onboard/config-files.js.map +1 -1
  94. package/dist/onboard/run.js +47 -66
  95. package/dist/onboard/run.js.map +1 -1
  96. package/dist/onboard/uninstall.js +59 -42
  97. package/dist/onboard/uninstall.js.map +1 -1
  98. package/dist/onboard/wizard.js +33 -18
  99. package/dist/onboard/wizard.js.map +1 -1
  100. package/dist/{onboard/commands.js → platform/command-runner.js} +7 -3
  101. package/dist/platform/command-runner.js.map +1 -0
  102. package/dist/platform/deduplicate.js +32 -0
  103. package/dist/platform/deduplicate.js.map +1 -0
  104. package/dist/{state → platform}/dispatcher-id.js +1 -1
  105. package/dist/platform/dispatcher-id.js.map +1 -0
  106. package/dist/platform/errors.js +23 -23
  107. package/dist/platform/errors.js.map +1 -1
  108. package/dist/{onboard/ledger.js → platform/file-ledger.js} +13 -38
  109. package/dist/platform/file-ledger.js.map +1 -0
  110. package/dist/platform/history-page.js +62 -0
  111. package/dist/platform/history-page.js.map +1 -0
  112. package/dist/platform/in-flight-work.js.map +1 -0
  113. package/dist/platform/instance-lock.js +95 -0
  114. package/dist/platform/instance-lock.js.map +1 -0
  115. package/dist/platform/json-value.js +26 -15
  116. package/dist/platform/json-value.js.map +1 -1
  117. package/dist/platform/jsonl.js.map +1 -1
  118. package/dist/platform/logger.js +5 -5
  119. package/dist/platform/logger.js.map +1 -1
  120. package/dist/platform/package-bin.js +3 -1
  121. package/dist/platform/package-bin.js.map +1 -1
  122. package/dist/platform/paths.js +42 -69
  123. package/dist/platform/paths.js.map +1 -1
  124. package/dist/platform/runtime-sockets.js +7 -2
  125. package/dist/platform/runtime-sockets.js.map +1 -1
  126. package/dist/platform/serial-queue.js +22 -0
  127. package/dist/platform/serial-queue.js.map +1 -0
  128. package/dist/platform/shutdown-errors.js.map +1 -0
  129. package/dist/platform/work-fence.js +30 -0
  130. package/dist/platform/work-fence.js.map +1 -0
  131. package/dist/plugin/hooks.js +407 -0
  132. package/dist/plugin/hooks.js.map +1 -0
  133. package/dist/plugin/host.js +97 -0
  134. package/dist/plugin/host.js.map +1 -0
  135. package/dist/plugin/loader.js +250 -0
  136. package/dist/plugin/loader.js.map +1 -0
  137. package/dist/provider-diagnostics.js +12 -8
  138. package/dist/provider-diagnostics.js.map +1 -1
  139. package/dist/registry/builtins.js +49 -45
  140. package/dist/registry/builtins.js.map +1 -1
  141. package/dist/registry/index.js +10 -2
  142. package/dist/registry/index.js.map +1 -1
  143. package/dist/registry/provider-loader.js +41 -61
  144. package/dist/registry/provider-loader.js.map +1 -1
  145. package/dist/registry/provider-ref.js.map +1 -1
  146. package/dist/registry/registry.js +14 -22
  147. package/dist/registry/registry.js.map +1 -1
  148. package/dist/{command/catalog.js → server/command-catalog.js} +14 -5
  149. package/dist/server/command-catalog.js.map +1 -0
  150. package/dist/server/command-host.js +2 -0
  151. package/dist/server/command-host.js.map +1 -0
  152. package/dist/server-commands.js +1 -1
  153. package/dist/server-commands.js.map +1 -1
  154. package/dist/server.js +70 -129
  155. package/dist/server.js.map +1 -1
  156. package/dist/service/{agent-entity/activity-reader.js → agent/activity.js} +86 -34
  157. package/dist/service/agent/activity.js.map +1 -0
  158. package/dist/service/{teammate-service/admission-ledger.js → agent/admission.js} +66 -1
  159. package/dist/service/agent/admission.js.map +1 -0
  160. package/dist/service/{channel-submission.js → agent/channel-submission.js} +5 -5
  161. package/dist/service/agent/channel-submission.js.map +1 -0
  162. package/dist/service/{teammate-collection → agent}/commands.js +38 -50
  163. package/dist/service/agent/commands.js.map +1 -0
  164. package/dist/service/{teammate-service → agent}/completion-renderer.js +30 -5
  165. package/dist/service/agent/completion-renderer.js.map +1 -0
  166. package/dist/service/agent/errors.js.map +1 -0
  167. package/dist/service/agent/factory.js +78 -0
  168. package/dist/service/agent/factory.js.map +1 -0
  169. package/dist/service/{agent-entity/types.js → agent/identity.js} +28 -34
  170. package/dist/service/agent/identity.js.map +1 -0
  171. package/dist/service/agent/index.js +769 -0
  172. package/dist/service/agent/index.js.map +1 -0
  173. package/dist/service/agent/mcp.js +420 -0
  174. package/dist/service/agent/mcp.js.map +1 -0
  175. package/dist/service/agent/records.js +74 -0
  176. package/dist/service/agent/records.js.map +1 -0
  177. package/dist/service/agent/requests.js +172 -0
  178. package/dist/service/agent/requests.js.map +1 -0
  179. package/dist/service/{teammate-service/runtime-owner.js → agent/runtime-generation.js} +81 -79
  180. package/dist/service/agent/runtime-generation.js.map +1 -0
  181. package/dist/service/agent/runtime-id.js +22 -0
  182. package/dist/service/agent/runtime-id.js.map +1 -0
  183. package/dist/service/{agent-entity → agent}/runtime-state.js +33 -40
  184. package/dist/service/agent/runtime-state.js.map +1 -0
  185. package/dist/service/agent/service-types.js +28 -0
  186. package/dist/service/agent/service-types.js.map +1 -0
  187. package/dist/service/{teammate-service/index.js → agent/service.js} +236 -102
  188. package/dist/service/agent/service.js.map +1 -0
  189. package/dist/service/{agent-entity/identity-store.js → agent/store.js} +175 -96
  190. package/dist/service/agent/store.js.map +1 -0
  191. package/dist/service/agent/submission.js.map +1 -0
  192. package/dist/service/{teammate-collection → agent}/system-prompt.js +7 -3
  193. package/dist/service/agent/system-prompt.js.map +1 -0
  194. package/dist/service/agent/turn.js +89 -0
  195. package/dist/service/agent/turn.js.map +1 -0
  196. package/dist/service/agent/types.js.map +1 -0
  197. package/dist/service/channel-service/commands.js +7 -3
  198. package/dist/service/channel-service/commands.js.map +1 -1
  199. package/dist/{channel → service/channel-service}/core-port.js +6 -5
  200. package/dist/service/channel-service/core-port.js.map +1 -0
  201. package/dist/service/channel-service/index.js +211 -93
  202. package/dist/service/channel-service/index.js.map +1 -1
  203. package/dist/service/channel-service/mcp-delegate.js +8 -9
  204. package/dist/service/channel-service/mcp-delegate.js.map +1 -1
  205. package/dist/service/completion-router/index.js +27 -27
  206. package/dist/service/completion-router/index.js.map +1 -1
  207. package/dist/{channel → service/dispatcher-core-events}/conversation-projection.js +9 -7
  208. package/dist/service/dispatcher-core-events/conversation-projection.js.map +1 -0
  209. package/dist/service/dispatcher-core-events/index.js +76 -68
  210. package/dist/service/dispatcher-core-events/index.js.map +1 -1
  211. package/dist/service/dispatcher-core-events/seal.js +1 -24
  212. package/dist/service/dispatcher-core-events/seal.js.map +1 -1
  213. package/dist/service/dispatcher-service/agent.js +267 -45
  214. package/dist/service/dispatcher-service/agent.js.map +1 -1
  215. package/dist/service/dispatcher-service/base-prompt.js +2 -2
  216. package/dist/service/dispatcher-service/base-prompt.js.map +1 -1
  217. package/dist/service/dispatcher-service/index.js +139 -378
  218. package/dist/service/dispatcher-service/index.js.map +1 -1
  219. package/dist/service/dispatcher-service/lifecycle.js +230 -0
  220. package/dist/service/dispatcher-service/lifecycle.js.map +1 -0
  221. package/dist/{daemon → service/dispatcher-service}/restart-intent.js +17 -38
  222. package/dist/service/dispatcher-service/restart-intent.js.map +1 -0
  223. package/dist/service/dispatcher-workspace.js +10 -23
  224. package/dist/service/dispatcher-workspace.js.map +1 -1
  225. package/dist/service/dispatchers/commands.js +30 -31
  226. package/dist/service/dispatchers/commands.js.map +1 -1
  227. package/dist/service/dispatchers/index.js +92 -64
  228. package/dist/service/dispatchers/index.js.map +1 -1
  229. package/dist/service/index.js +2 -2
  230. package/dist/service/index.js.map +1 -1
  231. package/dist/{mcp → service/mcp}/catalog.js +11 -48
  232. package/dist/service/mcp/catalog.js.map +1 -0
  233. package/dist/service/mcp/commands.js +3 -3
  234. package/dist/service/mcp/commands.js.map +1 -1
  235. package/dist/service/mcp/dispatch-reminders.js +1 -1
  236. package/dist/service/mcp/dispatch-reminders.js.map +1 -1
  237. package/dist/service/mcp/identity-version.js +14 -0
  238. package/dist/service/mcp/identity-version.js.map +1 -1
  239. package/dist/service/mcp/leases.js +12 -33
  240. package/dist/service/mcp/leases.js.map +1 -1
  241. package/dist/service/mcp/tool-metadata.js +15 -76
  242. package/dist/service/mcp/tool-metadata.js.map +1 -1
  243. package/dist/service/name-allocator.js +2 -3
  244. package/dist/service/name-allocator.js.map +1 -1
  245. package/dist/service/scheduler/commands.js +7 -19
  246. package/dist/service/scheduler/commands.js.map +1 -1
  247. package/dist/service/scheduler/errors.js +1 -1
  248. package/dist/service/scheduler/errors.js.map +1 -1
  249. package/dist/service/scheduler/{service.js → index.js} +175 -142
  250. package/dist/service/scheduler/index.js.map +1 -0
  251. package/dist/service/scheduler/{mcp-delegate.js → mcp.js} +61 -58
  252. package/dist/service/scheduler/mcp.js.map +1 -0
  253. package/dist/service/scheduler/requests.js +60 -0
  254. package/dist/service/scheduler/requests.js.map +1 -0
  255. package/dist/service/scheduler/store.js +183 -151
  256. package/dist/service/scheduler/store.js.map +1 -1
  257. package/dist/service/scheduler/types.js +1 -33
  258. package/dist/service/scheduler/types.js.map +1 -1
  259. package/dist/service/{team-collection → team}/commands.js +45 -59
  260. package/dist/service/team/commands.js.map +1 -0
  261. package/dist/service/{team-collection → team}/create-request.js +8 -20
  262. package/dist/service/team/create-request.js.map +1 -0
  263. package/dist/service/{team-collection → team}/errors.js +7 -10
  264. package/dist/service/team/errors.js.map +1 -0
  265. package/dist/service/team/index.js +817 -0
  266. package/dist/service/team/index.js.map +1 -0
  267. package/dist/service/team/leader-mcp.js +42 -0
  268. package/dist/service/team/leader-mcp.js.map +1 -0
  269. package/dist/service/team/leader.js +157 -0
  270. package/dist/service/team/leader.js.map +1 -0
  271. package/dist/service/team/mcp.js +328 -0
  272. package/dist/service/team/mcp.js.map +1 -0
  273. package/dist/service/{team-collection/types.js → team/requests.js} +64 -15
  274. package/dist/service/team/requests.js.map +1 -0
  275. package/dist/service/team/service.js +903 -0
  276. package/dist/service/team/service.js.map +1 -0
  277. package/dist/service/team/store.js +373 -0
  278. package/dist/service/team/store.js.map +1 -0
  279. package/dist/service/team/team-summary.js.map +1 -0
  280. package/dist/service/team/teams-port.js +2 -0
  281. package/dist/service/team/teams-port.js.map +1 -0
  282. package/dist/service/team/types.js +22 -0
  283. package/dist/service/team/types.js.map +1 -0
  284. package/dist/service/workflow-service/commands.js +5 -6
  285. package/dist/service/workflow-service/commands.js.map +1 -1
  286. package/dist/service/workflow-service/errors.js +2 -0
  287. package/dist/service/workflow-service/errors.js.map +1 -1
  288. package/dist/service/workflow-service/index.js +80 -112
  289. package/dist/service/workflow-service/index.js.map +1 -1
  290. package/dist/service/workflow-service/journal.js +90 -6
  291. package/dist/service/workflow-service/journal.js.map +1 -1
  292. package/dist/service/workflow-service/limits.js +20 -9
  293. package/dist/service/workflow-service/limits.js.map +1 -1
  294. package/dist/service/workflow-service/mcp.js +171 -0
  295. package/dist/service/workflow-service/mcp.js.map +1 -0
  296. package/dist/service/workflow-service/protocol.js +72 -1
  297. package/dist/service/workflow-service/protocol.js.map +1 -1
  298. package/dist/service/workflow-service/requests.js +70 -0
  299. package/dist/service/workflow-service/requests.js.map +1 -0
  300. package/dist/service/workflow-service/run.js +258 -145
  301. package/dist/service/workflow-service/run.js.map +1 -1
  302. package/dist/service/workflow-service/runner-process.js +0 -19
  303. package/dist/service/workflow-service/runner-process.js.map +1 -1
  304. package/dist/service/workflow-service/runner.js +6 -30
  305. package/dist/service/workflow-service/runner.js.map +1 -1
  306. package/dist/service/workflow-service/script-compiler.js +7 -9
  307. package/dist/service/workflow-service/script-compiler.js.map +1 -1
  308. package/dist/service/workflow-service/{run-support.js → semaphore.js} +1 -30
  309. package/dist/service/workflow-service/semaphore.js.map +1 -0
  310. package/dist/service/workflow-service/store.js +105 -25
  311. package/dist/service/workflow-service/store.js.map +1 -1
  312. package/dist/service/workflow-service/types.js +1 -77
  313. package/dist/service/workflow-service/types.js.map +1 -1
  314. package/dist/service/worktree/manager.js +29 -62
  315. package/dist/service/worktree/manager.js.map +1 -1
  316. package/dist/service/worktree/paths.js +4 -1
  317. package/dist/service/worktree/paths.js.map +1 -1
  318. package/dist/service/worktree/repo-request.js +38 -14
  319. package/dist/service/worktree/repo-request.js.map +1 -1
  320. package/dist/service/worktree/types.js +2 -0
  321. package/dist/service/worktree/types.js.map +1 -0
  322. package/dist/service/worktree/workspaces.js +27 -34
  323. package/dist/service/worktree/workspaces.js.map +1 -1
  324. package/package.json +13 -8
  325. package/skills/dispatcher/dreamux-maintenance/SKILL.md +5 -4
  326. package/skills/dispatcher/dreamux-maintenance/references/builtin-bootstrap.md +50 -0
  327. package/skills/dispatcher/dreamux-maintenance/references/builtin-codex.md +4 -5
  328. package/skills/dispatcher/dreamux-maintenance/references/builtin-feishu.md +69 -11
  329. package/skills/dispatcher/dreamux-maintenance/references/config-envelope.md +77 -12
  330. package/skills/dispatcher/dreamux-maintenance/references/feishu-access-v3.md +39 -24
  331. package/skills/dispatcher/dreamux-maintenance/references/service-lifecycle.md +105 -37
  332. package/dist/channel/conversation-projection.js.map +0 -1
  333. package/dist/channel/core-port.js.map +0 -1
  334. package/dist/cli/server-ctl.js +0 -163
  335. package/dist/cli/server-ctl.js.map +0 -1
  336. package/dist/cli/service-status-parse.js.map +0 -1
  337. package/dist/command/catalog.js.map +0 -1
  338. package/dist/config/config-helpers.js +0 -100
  339. package/dist/config/config-helpers.js.map +0 -1
  340. package/dist/daemon/restart-intent.js.map +0 -1
  341. package/dist/daemon/service-control.js.map +0 -1
  342. package/dist/mcp/catalog.js.map +0 -1
  343. package/dist/mcp/failure-text.js +0 -46
  344. package/dist/mcp/failure-text.js.map +0 -1
  345. package/dist/onboard/commands.js.map +0 -1
  346. package/dist/onboard/ledger.js.map +0 -1
  347. package/dist/onboard/service-node.js +0 -183
  348. package/dist/onboard/service-node.js.map +0 -1
  349. package/dist/onboard/service.js +0 -310
  350. package/dist/onboard/service.js.map +0 -1
  351. package/dist/platform/atomic-write.js +0 -63
  352. package/dist/platform/atomic-write.js.map +0 -1
  353. package/dist/platform/error-info.js +0 -11
  354. package/dist/platform/error-info.js.map +0 -1
  355. package/dist/platform/json-document-store.js +0 -54
  356. package/dist/platform/json-document-store.js.map +0 -1
  357. package/dist/service/agent-entity/activity-errors.js +0 -71
  358. package/dist/service/agent-entity/activity-errors.js.map +0 -1
  359. package/dist/service/agent-entity/activity-reader.js.map +0 -1
  360. package/dist/service/agent-entity/agent-config.js +0 -48
  361. package/dist/service/agent-entity/agent-config.js.map +0 -1
  362. package/dist/service/agent-entity/history-query.js +0 -60
  363. package/dist/service/agent-entity/history-query.js.map +0 -1
  364. package/dist/service/agent-entity/identity-store.js.map +0 -1
  365. package/dist/service/agent-entity/read-helpers.js +0 -172
  366. package/dist/service/agent-entity/read-helpers.js.map +0 -1
  367. package/dist/service/agent-entity/runtime-profile.js +0 -53
  368. package/dist/service/agent-entity/runtime-profile.js.map +0 -1
  369. package/dist/service/agent-entity/runtime-state.js.map +0 -1
  370. package/dist/service/agent-entity/types.js.map +0 -1
  371. package/dist/service/channel-service/mcp-delegates.js +0 -21
  372. package/dist/service/channel-service/mcp-delegates.js.map +0 -1
  373. package/dist/service/channel-service/types.js.map +0 -1
  374. package/dist/service/channel-submission.js.map +0 -1
  375. package/dist/service/closed-fact.js +0 -49
  376. package/dist/service/closed-fact.js.map +0 -1
  377. package/dist/service/deduplicate.js +0 -42
  378. package/dist/service/deduplicate.js.map +0 -1
  379. package/dist/service/dispatcher-core-events/scoped-source.js +0 -59
  380. package/dist/service/dispatcher-core-events/scoped-source.js.map +0 -1
  381. package/dist/service/dispatcher-service/dispatcher-workflows.js +0 -50
  382. package/dist/service/dispatcher-service/dispatcher-workflows.js.map +0 -1
  383. package/dist/service/dispatcher-service/identity.js +0 -97
  384. package/dist/service/dispatcher-service/identity.js.map +0 -1
  385. package/dist/service/dispatcher-service/inbound-task-drain.js +0 -37
  386. package/dist/service/dispatcher-service/inbound-task-drain.js.map +0 -1
  387. package/dist/service/dispatcher-service/input-source-lifecycle.js +0 -312
  388. package/dist/service/dispatcher-service/input-source-lifecycle.js.map +0 -1
  389. package/dist/service/dispatcher-service/input-source-start-rollback.js +0 -53
  390. package/dist/service/dispatcher-service/input-source-start-rollback.js.map +0 -1
  391. package/dist/service/dispatcher-service/mcp-delegates.js +0 -67
  392. package/dist/service/dispatcher-service/mcp-delegates.js.map +0 -1
  393. package/dist/service/dispatcher-service/restart-notice.js +0 -27
  394. package/dist/service/dispatcher-service/restart-notice.js.map +0 -1
  395. package/dist/service/dispatcher-service/runnable-channel.js +0 -13
  396. package/dist/service/dispatcher-service/runnable-channel.js.map +0 -1
  397. package/dist/service/dispatcher-service/runtime-helpers.js +0 -11
  398. package/dist/service/dispatcher-service/runtime-helpers.js.map +0 -1
  399. package/dist/service/dispatcher-service/runtime-status.js +0 -35
  400. package/dist/service/dispatcher-service/runtime-status.js.map +0 -1
  401. package/dist/service/dispatcher-service/team-leader-handle.js +0 -29
  402. package/dist/service/dispatcher-service/team-leader-handle.js.map +0 -1
  403. package/dist/service/dispatcher-service/team-runtime-stop.js +0 -13
  404. package/dist/service/dispatcher-service/team-runtime-stop.js.map +0 -1
  405. package/dist/service/dispatcher-service/teammate-ops.js +0 -14
  406. package/dist/service/dispatcher-service/teammate-ops.js.map +0 -1
  407. package/dist/service/frozen-snapshot.js +0 -16
  408. package/dist/service/frozen-snapshot.js.map +0 -1
  409. package/dist/service/in-flight-work.js.map +0 -1
  410. package/dist/service/legacy-state.js +0 -119
  411. package/dist/service/legacy-state.js.map +0 -1
  412. package/dist/service/mcp/descriptor.js.map +0 -1
  413. package/dist/service/scheduler/mcp-delegate.js.map +0 -1
  414. package/dist/service/scheduler/service.js.map +0 -1
  415. package/dist/service/serial-queue.js +0 -64
  416. package/dist/service/serial-queue.js.map +0 -1
  417. package/dist/service/shutdown-errors.js.map +0 -1
  418. package/dist/service/team-collection/commands.js.map +0 -1
  419. package/dist/service/team-collection/create-request.js.map +0 -1
  420. package/dist/service/team-collection/errors.js.map +0 -1
  421. package/dist/service/team-collection/index.js +0 -304
  422. package/dist/service/team-collection/index.js.map +0 -1
  423. package/dist/service/team-collection/mcp-delegate.js +0 -389
  424. package/dist/service/team-collection/mcp-delegate.js.map +0 -1
  425. package/dist/service/team-collection/read-helpers.js +0 -66
  426. package/dist/service/team-collection/read-helpers.js.map +0 -1
  427. package/dist/service/team-collection/read-model.js +0 -120
  428. package/dist/service/team-collection/read-model.js.map +0 -1
  429. package/dist/service/team-collection/roster-reader.js +0 -52
  430. package/dist/service/team-collection/roster-reader.js.map +0 -1
  431. package/dist/service/team-collection/runtime-registry.js +0 -369
  432. package/dist/service/team-collection/runtime-registry.js.map +0 -1
  433. package/dist/service/team-collection/store.js +0 -320
  434. package/dist/service/team-collection/store.js.map +0 -1
  435. package/dist/service/team-collection/types.js.map +0 -1
  436. package/dist/service/team-collection/worktree-cleanup.js +0 -45
  437. package/dist/service/team-collection/worktree-cleanup.js.map +0 -1
  438. package/dist/service/team-service/closing.js +0 -279
  439. package/dist/service/team-service/closing.js.map +0 -1
  440. package/dist/service/team-service/collaborators.js +0 -82
  441. package/dist/service/team-service/collaborators.js.map +0 -1
  442. package/dist/service/team-service/completion-targets.js +0 -72
  443. package/dist/service/team-service/completion-targets.js.map +0 -1
  444. package/dist/service/team-service/index.js +0 -559
  445. package/dist/service/team-service/index.js.map +0 -1
  446. package/dist/service/team-service/leader-agent.js +0 -170
  447. package/dist/service/team-service/leader-agent.js.map +0 -1
  448. package/dist/service/team-service/roster-projection.js +0 -69
  449. package/dist/service/team-service/roster-projection.js.map +0 -1
  450. package/dist/service/team-service/team-summary.js.map +0 -1
  451. package/dist/service/team-service/types.js +0 -61
  452. package/dist/service/team-service/types.js.map +0 -1
  453. package/dist/service/teammate-collection/commands.js.map +0 -1
  454. package/dist/service/teammate-collection/dissolve-members.js +0 -44
  455. package/dist/service/teammate-collection/dissolve-members.js.map +0 -1
  456. package/dist/service/teammate-collection/errors.js.map +0 -1
  457. package/dist/service/teammate-collection/index.js +0 -497
  458. package/dist/service/teammate-collection/index.js.map +0 -1
  459. package/dist/service/teammate-collection/mcp-delegate.js +0 -210
  460. package/dist/service/teammate-collection/mcp-delegate.js.map +0 -1
  461. package/dist/service/teammate-collection/mcp-tool-descriptors.js +0 -421
  462. package/dist/service/teammate-collection/mcp-tool-descriptors.js.map +0 -1
  463. package/dist/service/teammate-collection/system-prompt.js.map +0 -1
  464. package/dist/service/teammate-collection/types.js.map +0 -1
  465. package/dist/service/teammate-service/admission-ledger.js.map +0 -1
  466. package/dist/service/teammate-service/completion-renderer.js.map +0 -1
  467. package/dist/service/teammate-service/factory.js +0 -5
  468. package/dist/service/teammate-service/factory.js.map +0 -1
  469. package/dist/service/teammate-service/index.js.map +0 -1
  470. package/dist/service/teammate-service/runtime-owner.js.map +0 -1
  471. package/dist/service/teammate-service/submission.js.map +0 -1
  472. package/dist/service/teammate-service/turn-coordinator.js +0 -93
  473. package/dist/service/teammate-service/turn-coordinator.js.map +0 -1
  474. package/dist/service/teammate-service/turn-recording.js +0 -178
  475. package/dist/service/teammate-service/turn-recording.js.map +0 -1
  476. package/dist/service/teammate-service/types.js +0 -12
  477. package/dist/service/teammate-service/types.js.map +0 -1
  478. package/dist/service/workflow-service/agent-policy.js +0 -6
  479. package/dist/service/workflow-service/agent-policy.js.map +0 -1
  480. package/dist/service/workflow-service/json-args.js +0 -72
  481. package/dist/service/workflow-service/json-args.js.map +0 -1
  482. package/dist/service/workflow-service/run-support.js.map +0 -1
  483. package/dist/service/workflow-service/run-terminal.js +0 -111
  484. package/dist/service/workflow-service/run-terminal.js.map +0 -1
  485. package/dist/state/dispatcher-id.js.map +0 -1
  486. package/dist/state/dispatcher-store.js +0 -73
  487. package/dist/state/dispatcher-store.js.map +0 -1
  488. /package/dist/{service/channel-service → command}/types.js +0 -0
  489. /package/dist/{service → platform}/in-flight-work.js +0 -0
  490. /package/dist/{service → platform}/shutdown-errors.js +0 -0
  491. /package/dist/service/{teammate-collection → agent}/errors.js +0 -0
  492. /package/dist/service/{teammate-service → agent}/submission.js +0 -0
  493. /package/dist/service/{teammate-collection → agent}/types.js +0 -0
  494. /package/dist/service/{team-service → team}/team-summary.js +0 -0
package/CHANGELOG.md CHANGED
@@ -1,6 +1,76 @@
1
1
  # Change Log - @excitedjs/dreamux
2
2
 
3
- This log was last generated on Thu, 10 Sep 2026 04:59:50 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 09 Oct 2026 03:05:18 GMT and should not be manually modified.
4
+
5
+ ## 0.26.0
6
+ Fri, 09 Oct 2026 03:05:18 GMT
7
+
8
+ ### Minor changes
9
+
10
+ - The Dispatcher Agent has its own Commands. `dispatcher.submit` submits one turn to the addressed Dispatcher's own Agent and `dispatcher.interrupt` interrupts it; both address that Dispatcher through the caller context, like every other Command in the namespace, and both are reachable over `admin.sock` and a Channel's in-process port. `team.submit` and `team.interrupt` now require `team_name`: a Team Command names exactly one Team, and a call that omits the name is answered `BAD_REQUEST` by schema validation before any Agent is reached, instead of silently reaching the Dispatcher Agent. A caller that relied on the omission calls the Dispatcher Command instead. The two submit Commands share one reader for the Channel-facing payload (`service/channel-submission.ts`), which owns the attribute, text, reminder, and `source_id` rules once and fixes the `channel` provenance for both, and `DispatcherService.interrupt(teamId | null)` splits into `interruptAgent()` and `interruptTeamLeader(teamId)` to match.
11
+ - Support ultrathink through native Codex effort parameters, restore ordinary effort on the next ordinary submission, and pass submission text through unchanged. Busy input follows native Codex timing.
12
+ - BREAKING: `dispatchers[].cwd` is now required and must be a non-empty string on every Dispatcher entry, enabled or not; a config without it fails to load with an error naming the Dispatcher id. Rebuild: add "cwd": "<absolute dir>" to every dispatchers[] entry that lacks it.
13
+ - Refuse new Workflow TeamMate construction after its Team or Dispatcher starts closing, before allocating a name, workspace, identity, or launch hooks; preserve already-admitted construction cleanup and lock finalization.
14
+ - Default omitted dispatcher workspace policies and new onboarding to false; preserve explicit values. Repository-free work uses the dispatcher cwd unless isolation is enabled.
15
+ - Load plugins from an optional top-level `plugins[]` in `config.json` (`builtin:<id>` or `npm:<package>[#export]` refs, each a string or `{ ref, config }`); existing configs load unchanged. Plugins can contribute providers addressed as `builtin:<name>`, append instructions and skill roots to Dispatcher and TeamLeader launches, and react to Team creation; a failing plugin hook is logged and skipped. `dreamux doctor` lists loaded plugins and plugin load failures. Ships the built-in, opt-in `builtin:bootstrap` plugin, which injects `.workspace/identity.md` and `user.md` from the Dispatcher cwd.
16
+ - Redact tool call invocations and arguments in the conversation projection. Secret masking and workspace/home path renaming now apply to every displayed member of a tool call, and a call's structured payloads are redacted by walking the JSON value, so a secret written into a nested object or a multi-line .env is masked and the payload is still valid JSON. The redaction rules themselves moved to @excitedjs/dreamux-utils, where the host logger and config display now share one list of secret key names; the logger previously missed api_key, private_key, and client_secret.
17
+ - Code organization refactor stage 6d: scheduler/service.ts renamed to index.ts and scheduler/mcp-delegate.ts to mcp.ts (matching the agent/team/workflow-service per-domain template); a new requests.ts holds the request readers and result projections previously split across types.ts and store.ts, which is now persistence-only; the dead dispatcherId option/parameter was dropped from CronJobStore and detectLegacyCronJobStore; the fire path was consolidated onto one store read per fire plus a pure advanceJob/impure rearm pair (a one-shot job whose dispatch throws is now disabled immediately instead of staying enabled with a stale next_run_at until the next start()); and SchedulerService now implements SchedulerCommands directly, with TeamService composing its own closing fence directly into the admit closure it passes at construction instead of wrapping the public command surface in a second, Team-scoped object.
18
+ - Codex and Claude Code now load exactly like the built-in Feishu plugin: both are always-loaded plugins that contribute their Agent Runtime provider, instead of a core-side static builtin-provider registry pre-registering their descriptors ahead of the provider loader importing their package. No behavior change for a default install: both still register under builtin:codex / builtin:claude-code before agents[] is resolved, and a config naming an unmapped builtin:<ref> still fails loud with the same UnknownBuiltinProviderPackageError it always has. `dreamux uninstall`'s directory-safety guard also no longer hard-codes ~/.codex and ~/.claude: it now builds the same always-loaded plugin registry and asks each registered Agent Runtime provider for its own operatorStateRoot, so a provider added or removed by future plugin work is protected (or not) automatically. The protected paths for a default install are unchanged.
19
+ - BREAKING: code organization refactor stage 8c, item 1: `DREAMUX_CONFIG_DIR` is deleted, and so is `dreamux onboard`'s `--config-dir` option; `dreamux uninstall --config-dir` is deleted too, by inference — it has nothing left to relocate once `config.json` is root-derived. `config.json` now always lives at `<DREAMUX_ROOT>/config.json` (default `~/.dreamux/config.json`, unchanged only for an install that set neither `DREAMUX_CONFIG_DIR` nor `DREAMUX_ROOT`); the managed-service unit now writes `DREAMUX_ROOT` instead of `DREAMUX_CONFIG_DIR`, taking the value from the environment of the process that runs `dreamux daemon install` or `dreamux onboard` (`~/.dreamux` when unset); `dreamux uninstall` now also removes the whole root directory itself, not just its contents. Before this change `DREAMUX_ROOT` relocated only state, run, cache and logs, `config.json` came from `DREAMUX_CONFIG_DIR` or `~/.dreamux`, and the managed-service unit that `dreamux daemon install` wrote carried no `DREAMUX_ROOT`, so a managed service ran with `.dreamux` under its `HOME` as its root unless its environment supplied a `DREAMUX_ROOT` by another route (a unit drop-in, an environment file, or the service manager's own environment). Scenario 1: an install that set `DREAMUX_CONFIG_DIR` to a path other than the root it ran with — after upgrade `DREAMUX_CONFIG_DIR` is silently ignored, so the daemon looks for `config.json` under the root instead of the operator's configured directory. If no `config.json` exists there, the daemon fails on an ordinary missing-file error that never mentions `DREAMUX_CONFIG_DIR` or what moved, and the unit's `Restart=on-failure` loops; if a `config.json` already exists there (for example from an earlier default-path `dreamux onboard`), the daemon starts silently against that unrelated file instead. Scenario 2: an operator who exports `DREAMUX_ROOT` in their shell (profile, direnv, a foreground `dreamux serve`) while `config.json` stayed in `DREAMUX_CONFIG_DIR` or `~/.dreamux` — `dreamux serve` and `dreamux daemon install` run from that shell now look for `config.json` under the exported root and fail on the same missing-file error (`dreamux doctor` reports it); and if the operator moves `config.json` there and re-runs `dreamux daemon install`, the shell's root is written into the unit, so the service moves to a root it never used: its durable state (dispatcher identities, Teams, Workflow runs, `access.json`) stays behind in the old root and the service comes up on a root that holds none of it. Rebuild: keep the root the old service actually used — do not assume it is the `DREAMUX_ROOT` your shell exports. (1) Find that root from the environment the old daemon actually ran with. For a managed service, read it from the running process (on Linux `tr '\0' '\n' < /proc/$(systemctl --user show -p MainPID --value dreamux)/environ | grep -E '^(DREAMUX_ROOT|HOME)='`) or, when it is not running, from everything that defines that environment: the installed unit and any drop-ins (`systemctl --user cat dreamux`), any `EnvironmentFile` they name, and the user manager's own environment (`systemctl --user show-environment`); on macOS, the plist `~/Library/LaunchAgents/dev.excited.dreamux.plist` and `launchctl print gui/$(id -u)/dev.excited.dreamux`. A unit written by an earlier build has no `DREAMUX_ROOT` entry of its own, so unless one of those sources supplies it the root is `.dreamux` under the service's `HOME` (normally `~/.dreamux`). A foreground `dreamux serve` used the `DREAMUX_ROOT` of the shell that started it, else `~/.dreamux`. Confirm the root by checking that `<root>/state/` holds your dispatcher directories. (2) Put `config.json` at `<that root>/config.json`: move it from the old service's `DREAMUX_CONFIG_DIR` path (found the same way) when that names another directory (keep mode 0600, create parent directories as needed); there is nothing to move when it already sits in that root. (3) Re-run `dreamux daemon install` (or `dreamux onboard` again) from a shell whose `DREAMUX_ROOT` is that same root — or unset, when the root is `~/.dreamux` — so the unit is rewritten with the right `DREAMUX_ROOT`, then run `dreamux daemon restart`. For a foreground `dreamux serve`, export the same root in the shell that starts it. Only a deliberate change of root moves durable state: with the service stopped, move the old root's `state/` to `<new root>/state/` (`run/` is volatile, `cache/` is rebuildable, and `logs/` is diagnostics, so none of them needs to move) and `config.json` to `<new root>/config.json`, then do step (3) with `DREAMUX_ROOT` set to the new root; without the `state/` move the service starts on empty state.
20
+ - PR #455 review round: `plugin/loader.ts`'s `constructPlugin` now validates a factory-returned plugin `name` against a safe single-segment pattern (1-64 ASCII letters/digits/dot/underscore/dash, starting with a letter or digit) and fails loading with `PluginLoadError` otherwise. `pluginStateDir` now uses `name` verbatim as the `state/plugins/<name>` directory segment instead of running it through the lossy teammate-name sanitizer, which mapped both `@acme/tool` and the unrelated `_acme_tool` to `state/plugins/_acme_tool` and passed `.`/`..` through unchanged (resolving up out of `state/plugins/`). Every built-in plugin name already conforms; a third-party `npm:` plugin whose factory returns a name outside this pattern now fails `dreamux serve` at load instead of silently sharing or escaping another plugin's state directory.
21
+ - PR #455 review round, two scheduler fixes. `CronJobStore.parseCronJob` no longer fails loud on a leftover `deliver` field on an old cron-jobs.json job row: like the existing `dispatcher_id` tolerance, it is now an ordinary unknown field under the persisted-shape policy, ignored on load and dropped the next time that job is rewritten; `dreamux doctor` no longer names a store file for carrying it. Separately, a missed cron fire's rearm write no longer derives its `{ enabled, next_run_at }` write from the in-memory job snapshot `SchedulerService` captured before the fire; `CronJobStore.applyMissed` now derives that write from the row as it stands at write time, inside the store's own serialized update, so a `cron.update` committed while a fire's submission was in flight can no longer be silently overwritten by a stale missed-outcome write.
22
+ - Core no longer rejects an Agent Runtime activity record whose `occurredAt` timestamp string is longer than 64 characters. This was the last provider-output length cap left over from R28 ("Core no longer re-validates an Agent Runtime provider's activity page against a byte/char/cursor-length budget", refactor-code-org-s2a-04); the provider's own bounds are the only bound now.
23
+ - A `plugins[]` object entry (`{ ref, config }`) now follows the same persisted-shape policy (R21) as the rest of config.json: an unrecognized key alongside `ref`/`config` is tolerated and ignored instead of refusing `dreamux serve`. A missing `ref` still fails loading.
24
+ - `dreamux uninstall` follows the existing next behavior: dry-run checks existence and reports planned removal without enumerating root contents or writing files; actual uninstall recursively removes the entire DREAMUX_ROOT, including other files and directories inside it. The foreign-retention predictor is removed. Results report removed or missing; permission and other filesystem errors still propagate, including after a successful preview. Normalized removal paths inside or containing a provider-derived operator runtime home are refused before any service mutation. Physical symlink aliases are not resolved. Current root addressing and service removal order remain unchanged.
25
+ - `workflow_status` and `workflow_list` no longer serve a finished run's record from a stale in-memory cache for the rest of the dispatcher's process lifetime. The scope's `WorkflowRunStore` now releases a run's cached store once its owning run settles (or once a crash-recovery pass finds it already terminal), and reads finished records one-shot from disk afterward, so a hand edit to a finished run's record.json is now reflected.
26
+ - A provider ref listed under the wrong kind in config.json (for example a `builtin:codex` agent-runtime provider referenced from a `channels[]` entry) now fails config validation with a `RuleViolation` naming the actual and expected kind, instead of the provider package loader's own contract error. This follows from built-in providers now registering their descriptor and implementation together as always-loaded plugins (R9): the mismatch is caught once, in config validation, for both built-in and `npm:` provider refs. No behavior change for a correctly configured install.
27
+ - Code organization refactor stage 2a, item 3: cron jobs are no longer capped at 128 per dispatcher/Team owner. The cap had no named failure scenario. Old cron stores are unaffected.
28
+ - Code organization refactor stage 2a, item 4: Core no longer re-validates an Agent Runtime provider's activity page against a byte/char/cursor-length budget, or a provider's declared capabilities against a tag-count/length or publicConfig size bound. The provider's own bounds are the only bound now.
29
+ - Code organization refactor stage 2a, item 5: the `dispatcher.start` Command and the `dispatcher start` server-ctl CLI verb are removed. Every configured, enabled Dispatcher already starts automatically when the daemon starts; there was no supported way to stop one independently and restart it in-process to begin with.
30
+ - Code organization refactor stage 2a, item 12 (R47): `dreamux serve` no longer runs its startup pre-flight that aggregated every dispatcher's pre-#233 leftover state and removed cron stores and aborted the whole process before the admin socket opened, and `dreamux doctor` no longer reports a dispatcher's leftover state as a row. A stale `channel-bindings.json`/`collaboration-spaces.json` at the dispatcher root, a pre-#233 flat `teammate/`/`team/` leaf (`records`, `turns`, `identities`, `history`, `sessions.jsonl`, `ledger`), or an agent identity record still carrying a removed field (`checkpoint`, `checkpoint_kind`, `session_ref`, `display_name`, `close_status`) are now silently ignored rather than triggering a fail-loud rebuild instruction. This is not `BREAKING:`: nothing an operator relied on to start stops working — the opposite failure mode (refusing to start) is what's removed. A cron store with an unrecognized version and an identity still keyed by the pre-#148 `provider_ref` format still raise a named error when actually read (a dispatcher's scheduler start, `dreamux doctor`'s unchanged cron rows), but that failure is no longer aggregated into a whole-process startup refusal — it now fails only the one dispatcher whose store or identity is affected, the same as any other per-dispatcher start failure.
31
+ - Code organization refactor stage 4b item 1: moved AgentIdentityStore and AgentEntityCollectionStore onto TransactionalStore, deleted AgentRuntimeStateStore's own mutation tail in favor of the store's serialized update, and fixed four second-authority duplicate-reader sites (dispatcher-root identity shared between Dispatchers and DispatcherService, TeammateCollection.mustIdentity, reprepareDeletedManagedWorktree's nested-update pattern, and TeammateCollection.buildEntity minting a second, never-loaded AgentIdentityStore instead of reusing the one that created or read the entity). AgentIdentityStoreBinding no longer carries onPersisted; every create/update/upsert call now threads it explicitly. Named behavior change: a name lookup for a live TeamMate (mustIdentity) now answers from that TeamMate's own live identity instead of a fresh file read, so it can no longer race a runtime that just committed a status transition; record.json's shape is unchanged.
32
+ - Code organization refactor stage 4b item 2: moved TeamStore onto a per-Team TransactionalStore, replacing its exclusive-write-plus-readback create path with a load-decide-write inside the store's own serialized queue and its manual write queue with the store's tail. TeamService now holds its Team's TransactionalStore handle directly instead of a caller-refreshed record field, and the Team read model answers leader_state from a live TeamService's own in-memory identity before falling back to a one-shot file read. record.json's shape, TeamStore's/TeamService's public methods, and Command/MCP-visible behavior are unchanged; only the anti-resurrection mechanism moved from 'merge against disk' to 'one in-memory owner per Team, merging against its committed value' (already an accepted operator ruling, 2026-09-19).
33
+ - Code organization refactor stage 4b item 3: moved CronJobStore onto a single TransactionalStore<CronJobFile>, inlining the version-mismatch/missing-file-default check that JsonDocumentStore used to run. Dropped the operator-only nested `action` Command field from scheduler.cron.create/update. Its former `action.prompt` was consumed as the scheduled submission text; the Commands now take the same text as top-level `prompt`, while persisted jobs keep their internal `action.prompt` and stopped writing `dispatcher_id` in scheduler.cron.list/create/update/delete results, the cron_* MCP tool results, and newly written cron-jobs.json job rows; a leftover dispatcher_id on an old file now loads as an ordinary unknown field under the persisted-shape policy (tolerate unknown fields, reject only wrong types and missing fields) instead of being required and cross-checked against the store's own dispatcher id. Old cron-jobs.json files carrying either field still load. Named behavior change: deleting a Team's cron store file on dissolve now loads the file first (TransactionalStore.remove()'s own contract), so a cron-jobs.json that fails its version/shape check at that exact moment now fails the delete too, instead of always succeeding via a direct unlink(); this is one more of dissolve's ordinary collected cleanup-step failures, handled the same way as any other resource that would not close.
34
+ - Code organization refactor stage 4b item 4: moved WorkflowRunStore onto a per-run TransactionalStore<WorkflowRunRecord | null>, inlining the version-mismatch/missing-file-default check that JsonDocumentStore used to run, and moved WorkflowJournal.create onto dreamux-utils' publishFileExclusive. run.ts keeps mutating its working draft before each persistence point; the queue that used to serialize those writes is gone (each run's own TransactionalStore now serializes them), but the reclassification of a failed journal/store write into WorkflowPersistenceError (which executeAgent's catch depends on to tell a storage failure apart from an ordinary agent failure) is preserved under a renamed helper. Named behavior change: WorkflowRun.snapshot(), which backs workflow_status/workflow_list for a live run, now returns the run's last committed (written) value instead of the in-progress in-memory draft between a mutation and the write that persists it. Freshness here was already documented as unspecified, so this narrows rather than changes the contract, but it is a real, observable difference from today's snapshot timing. record.json's shape, the journal's shape, and every public method signature are unchanged. `this.record.x = …` in-place mutation and `AgentCall.record` as a live alias into `this.record.agents[]` were both kept as they were, rather than becoming a pure builder passed to `store.update()` and an index respectively; traced for data loss (each write clones at commit time and every store now serializes on its own `TransactionalStore` queue) and found none.
35
+ - Code organization refactor stage 4b item 5: config.json now tolerates unknown top-level, dispatchers[], channels[], agents[], and dispatchers[].workspace keys instead of rejecting them; wrong types and missing required fields are still rejected. Per R21's tolerate-unknown-fields policy, this also removes every remaining named rejection of a retired config.json key: the top-level codex block, dispatchers[].runtime, the dispatchers[].feishu/.codex legacy-shape pre-check, and channels[].collaborationSpace are no longer special-cased and now load as ordinary tolerated unknown fields like any other retired key.
36
+ - Code organization refactor stage 4c: added two Commands, config.agents.get and config.agents.replace, reachable through admin.sock and any Channel's in-process invoke port like every other Command. config.agents.get returns the current agents[] in file shape with every secret-named value emptied; config.agents.replace validates and writes a whole new agents[] array, matched to the existing one by id (submitting an empty secret-named value keeps the stored value). A replace takes effect for the next runtime launch only — a runtime already running keeps what it launched with. The first replace re-serializes config.json with two-space indentation and the submitted agent order; other values, and dispatchers[], are written unchanged. Neither Command is dispatcher-scoped, and dispatchers[] still has no Command. No persisted-format change.
37
+ - team.history's grep filter now ignores leading/trailing whitespace in the search term, matching teammate.history's existing behavior.
38
+ - Code organization refactor stage 6a item 2a: renamed the class service/agent/service.ts's TeammateService -> AgentService and service/agent/runtime-generation.ts's TeammateRuntimeOwner -> RuntimeGeneration (propagated to every consumer's type-only imports across the package, e.g. dispatcher-service/ and team-service/; service/agent/factory.ts is left on the old name, since converting it into the per-dispatcher AgentServiceFactory is stage 6a item 2b). This one class now serves three roles (the Dispatcher's own Agent, a Team's leader, and an ordinary TeamMate) but hardcoded 'TeamMate' in every thrown-error message regardless of which role it was closing, locking, or starting; a Team's leader.close() (dissolve) or a Dispatcher agent's runtime-generation failure produced a wrong 'TeamMate ...' message. Added agentRoleNoun(role, name) (service/agent/service-types.ts, to avoid a service.ts <-> runtime-generation.ts import cycle) and used it at every such error message in these two files, so a Dispatcher agent now reads 'the Dispatcher agent ...' and a Team's leader reads 'Team leader "<name>" ...'. Most of an ordinary TeamMate's own wording is unchanged (byte-identical, same JSON.stringify(name) quoting); four messages that previously named 'TeamMate' without the entity's name now include it for every role, including teammate, as a byproduct of routing through the one shared helper: the close-note validation message (this is also a real fix, not just wording -- close() runs on a Team's leader too on dissolve, per team-service/closing.ts, so the pre-existing text was already wrong there), the two closed-with-no-closed_at invariant-violation messages, and the stale-lock-token invariant-violation message. Also deleted two dead-by-construction fields: ownsWorktreeOnClose (its condition, restricted to the three real construction sites, was already exactly implied by identity.worktree.mode === 'managed' && identity.worktree.cleanup === 'delete-on-close' alone -- the Dispatcher agent and every Team leader are always worktree.mode 'reuse-cwd', and a Team-scoped TeamMate's spawn path always forces a reuse-cwd shared workspace, so the flag never disagreed with the identity's own facts since it was introduced) and assertIdentityScope plus runtime-id.ts's three assert*Scope helper functions (the identity was already read by a store scoped to the correct directory by the owner that materialized it, so re-checking scope on every ensureStarted() call had no failure scenario construction-time scoping doesn't already rule out). No persisted format, public API, or MCP/Command contract changed.
39
+ - Code organization refactor stage 6a item 3: the completion notice the Dispatcher's own agent receives after one of its Team's leaders settles a team.create-with-prompt turn (R16, deliverCompletionToDispatcher) always read 'TeamMate <name> has finished its task,' misdescribing a Team leader as a TeamMate. Added role: TeammateRole to TeammateCompletionFact (service/completion-router/index.ts) and threaded the producing AgentService's own role (fixed for its lifetime, passed once into EntityTurnCoordinatorOptions at construction) through service/agent/turn.ts's fact construction. service/agent/completion-renderer.ts's teammateStatusLine now words the sentence by the producer's actual role: a Team leader completion reads 'Team leader <name> has finished its task.' (and failed/stopped variants); an ordinary TeamMate completion, the only other role a delivered completion is produced by today, is unchanged. The Dispatcher-role branch is exhaustive but currently unreached -- the Dispatcher's own agent never attaches a completion-delivery closure to its own turns today, so 'The Dispatcher agent has finished its task.' is not yet observable, but is now correctly worded for when it is. workflowStatusLine is untouched. No persisted format, public API, or MCP/Command contract changed.
40
+ - Code organization refactor stage 6a item 4: deleted TeammateRuntimeOwnerCallbacks, the function-valued dependency bag RuntimeGeneration used to reach back into AgentService's private phase field via isActive()/markClosing(). RuntimeGeneration.ensureStarted() now takes no phase callback and simply resolves once the runtime is live or throws; it no longer self-aborts mid-launch. AgentService now owns the race check itself through one new private method, ensureRuntimeStarted(), used by every one of its three callers of runtimeGeneration.ensureStarted() (admitToRuntime, activate(), the locked Workflow submit path): it checks this.phase itself before calling ensureStarted() (replacing the old pre-lease isActive() check) and again immediately after ensureStarted() resolves, stopping the runtime and reporting not-active itself when a close raced and won the awaited start (replacing the old post-start isActive() self-abort). The one case that used to call markClosing() — startFromRecord's rollback branch where the rollback's own runtime.stop() also fails after a native start failure — now has RuntimeGeneration throw a new named error, RuntimeTerminationUnproven (an AggregateError subclass carrying the same start/stop failure pair), which ensureRuntimeStarted() catches to set AgentService's own phase to 'closing' before rethrowing; this is the mutation every caller previously got for free via the callback, so centralizing it is what keeps a runtime whose termination could not be proven from being handed out by a later ensureStarted() call, which treats any non-null runtime handle as already live and never re-examines it. Internal control-flow refactor moving which class owns a phase decision. One caller-visible admission-outcome shape changed for the narrow start-races-close window: a submission that used to reject with an 'is closing' Error now resolves as an ordinary {status:'stopped'} TurnAdmission (the same shape a submission to an already-stopped recipient always gets), so its display reason becomes 'the agent runtime is not running' instead of the old message text. The issue #63 non-blocking submit ordering (runtime.submit fires synchronously before being handed to the admission continuation queue) is untouched.
41
+ - Code organization refactor stage 6b item 2 (R48): deleted the team.hooks.created plugin hook end-to-end, together with its background scheduling (fireCreated), its InFlightWork-backed in-flight tracking, and the Dispatcher shutdown drain that awaited it. A plugin that tapped this hook loses it; nothing in this tree taps it today, and Dispatcher shutdown no longer waits on it.
42
+ - Fixed a bug: team.create with a prompt, called through admin.sock or a Channel's team.create Command, no longer pushes the leader's first-turn completion back to the Dispatcher Agent -- only the Dispatcher's own team MCP create tool call does now, matching the deliverCompletionToDispatcher contract team.submit has always had. DispatcherService.createTeam, TeamCollection.createFromRequest/createAtCandidate, and TeamService.createNew all take an explicit deliverCompletionToDispatcher boolean threaded the same way teamId/payloadHash already thread through; service/team/commands.ts's create.execute() passes false, service/team/mcp.ts's create() (the Dispatcher's own MCP call) passes true. initial-prompt.ts's submitInitialLeaderPrompt is folded into TeamService.createNew, which now calls submitToLeader(...) directly and checks the returned TurnAdmission itself, so the initial turn runs through the same admit-fenced submission path (and the same completion-initiator wiring) as every later turn; resolveTeamLeaderCompletionDelivery (completion-targets.ts) is deleted as the second initiator-to-delivery mapping it duplicated. TeamLeaderCompletionTargets itself, used for a Team's own members' completions reporting to the leader, is unrelated and unchanged.
43
+ - Code organization refactor stage 6b item 6 (R10): rewrote TeamClosing's dissolve/close sequence. TeamClosingDeps drops the leader()/closeLeaderForDissolve() callback pair; dissolve(input, leader), abandonCreation(input, leader), and stopForHost(leader) now all take the TeamLeader as a plain AgentService | null value, read once by TeamService (its own leader_ field) at each call site instead of asked for through a callback. stopChildRuntimesForDissolve and the child-stopping half of stopRuntimesForDissolve are unified as stopChildrenForDissolve() and stopAllForDissolve(leader), both still built on the one shared, non-throwing stopChildRuntimes(failures) helper so a member-stop failure and a leader-stop failure still aggregate into one thrown error exactly as today; closeResources (now closeChildren) drops its own redundant repeat of workflows.closeAdmission()/stopAll() and scheduler.stop() -- both were already covered, idempotently, by stopAllForDissolve immediately before it, so the repeat inside closeResources answered nothing new. abandonCreation's adoptDurableLeader callback is removed: TeamService.createNew's own catch adopts an orphaned durable leader itself, before calling abandonCreation, and passes the result as the leader argument; a failure during that adoption attempt is now logged rather than folded into the thrown AggregateError alongside the original creation-failure cause. The number, order, and gating of every worktree assessment, the dissolve refusal contract, the dissolve receipt shape, and team.closed timing are unchanged. TeamService forgets this.leader_ (checked once, after closing.dissolve() settles) whenever the new AgentService.isSafeToForget() is true, not only once AgentService.isRetired() confirms the close's own durable write also landed: a leader whose close() fully released runtime authority (stopRuntime() succeeded) but whose identity write then failed is still forgotten and rebuilt fresh from disk on next use, matching the pre-refactor unconditional pre-close null. isSafeToForget() stays false for the different case of an unproven runtime termination (a failed start whose own rollback stop could not prove the native runtime dead), because that runtime might still be alive and must not be silently forgotten. A leader whose close was never reached at all (an earlier stop or assessment refused first) is left live and reusable exactly as before.
44
+ - workflow.run and the workflow_run MCP tool now report BAD_REQUEST instead of INTERNAL for an empty resolved script, a scriptPath that is not a regular file, or a scriptPath over the read-size cap -- each is the caller's own mistake, not a server failure. Missing script/scriptPath and an out-of-range max_concurrency already reported BAD_REQUEST and are unaffected.
45
+ - dispatcher.submit and team.submit now report SUBMIT_FAILED / SUBMIT_AMBIGUOUS instead of TEAM_SUBMIT_FAILED / TEAM_SUBMIT_AMBIGUOUS for a failed or ambiguous submission. The shared submit receipt covers both callers, and a Dispatcher's own Agent submission has no Team involved, so the wire code no longer names Team.
46
+ - A dispatcher's own admission gate and its workflow-run admission check now report SERVER_SHUTTING_DOWN instead of INTERNAL when they refuse a request, matching the code the process-wide shutdown fence and a dispatcher's Channel port already reported for their own closed-scope refusals.
47
+ - ChannelService.closeAll() now collects and reports every channel session's close failure instead of logging and swallowing it. A Dispatcher's own close already wraps this call in its aggregate shutdown-failure collector, so a channel provider's close() throwing during a dispatcher stop or the daemon's graceful shutdown now surfaces as a shutdown failure where it was previously silent.
48
+ - dispatcher.status's status field and each dispatcher.list entry's status field now always report the runtime vocabulary (declared/starting/ready/degraded/stopping/stopped). Previously dispatcher.list reported the identity vocabulary (starting/running/degraded/closed/stopped) for both a live and a cold dispatcher, and dispatcher.status mixed the two: the runtime vocabulary while live, the identity vocabulary while cold. A caller branching on 'running' or 'closed' needs to branch on 'ready' or 'stopped' instead. Two cases that previously reported 'stopped' now report 'declared': a dispatcher with no persisted identity yet, and a materialized dispatcher whose agent is built but has never activated its runtime in this process (previously this fell back to the persisted identity's status, which could be stale after a crash).
49
+ - team.status already refused during a dispatcher stop; team.history and team.list now refuse the same way (SERVER_SHUTTING_DOWN) instead of answering from a Team's stale records. All three are per-Team operational reads and are now gated uniformly; dispatcher.list, dispatcher.status, and channel.list are unaffected and remain observable through a stop.
50
+ - TeammateCollection now takes its admission fence at construction and gates every TeammateOps verb (spawn/send/close/list/status/history/last/getCapabilities) internally, uniformly, instead of wrapping only the three mutating verbs at the dispatcher-service boundary. A dispatcher-root teammate.list/.status/.history/.last call now refuses with SERVER_SHUTTING_DOWN during a Dispatcher stop instead of answering from stale records; a Team-scoped one now refuses with TEAM_CLOSED during that Team's dissolve, and with SERVER_SHUTTING_DOWN during a Dispatcher stop, instead of always answering. dispatcher-service/teammate-ops.ts is deleted; DispatcherService.teammates returns the collection directly.
51
+ - The `dreamux dispatcher start` CLI verb is removed (R11: no in-process restart after a dispatcher has closed). It never reached a working code path (no `'start'` case existed on the server-side dispatcher-control method resolver), but its removal is a CLI surface change an operator's script could still reference. `dreamux dispatcher status`/`list` are unaffected.
52
+ - A dispatcher's shutdown stops Workflows, each Team, each materialized TeamMate runtime, and the dispatcher's own Agent runtime, joins every already-admitted operation, then repeats that same runtime sweep once more before closing Channels last. The sweep runs before the admitted-work join as well as after: an admitted call can itself be starting a runtime with no timeout of its own, so joining first would wait on exactly the runtime the sweep exists to stop, and stopping it first is what makes that runtime's own teardown unblock the join. The second, post-join pass catches a pre-fence admission that only starts - or, since a runtime stop fences an entity's admission for its own convergence only and never durably closes it, revives - a runtime after the first pass already read past that entity. Separately, TeammateCollection's and TeamCollection's own entity-construction paths check the dispatcher's closing fact the instant they register a brand-new entity and self-close its runtime immediately, preempting a spawned TeamMate's first submission outright (a Team's leader can already have taken its first prompt by the time the collection notices, so it only stops that runtime as soon as it can) - a different race, from a new entity's own construction, than the two-pass sweep covers.
53
+ - Code organization refactor stage 6f, item 2 (R48): wired the new Dispatcher.hooks.teammateLaunch hook through TeammateCollection.buildEntity (the one construction path behind spawn, createLocked, and reopen), the dispatcher-root and Team-scoped TeammateCollections, and the TeamMate system prompt, so a plugin can now append instructions and skill sources to every ordinary TeamMate's launch the same way it already can for the Dispatcher and a TeamLeader.
54
+ - Code organization refactor stage 6f, item 3 (R48): wired the new Dispatcher.hooks.createTeam hook into TeamCollection.createFromRequest, which now runs it on a non-replay team.create request's own wire-shaped params before doing the repo/skill-source translation admin.sock and the Team MCP delegate used to each do for themselves; both callers now build one TeamCreateCommand and forward it unchanged.
55
+ - Code organization refactor stage 6f, item 4 (R50): added platform/paths.ts's pluginStateDir(name), a host-owned per-plugin durable state directory under state/plugins/<name>/, and wired it into every plugin's server(host) call as ServerHost.stateDir. Purely additive; no existing path moves or changes shape.
56
+ - Code organization refactor stage 6f, item 1 (R52): renamed the Dispatcher hook object's beforeLaunch key to launch and the Team hook object's beforeTeamLeaderLaunch key to leaderLaunch, following the matching dreamux-types rename. Internal wiring (DispatcherAgentOptions, TeamLeaderForTeamDeps, tapable debug-name labels) renamed to match; no ownership or firing-site change.
57
+ - Code organization refactor stage 7, item 9: `dreamux serve` now runs `cli/server.ts`'s `runServe()` in-process instead of spawning `dist/cli/server.js` as a child process, and `dreamux status` / `dreamux dispatcher list` / `dreamux dispatcher status` now call the admin socket in-process through `admin/client.ts`'s `adminJsonInvoker` instead of spawning the deleted `server-ctl` entry; `cli/server-ctl.ts` is removed. Two small, verified output differences on failure paths: (1) when the admin socket is absent or refuses the connection, the status/dispatcher commands now report `TRANSPORT_ERROR` carrying Node's own socket error (e.g. `dreamux: admin socket connection to <path> failed - connect ENOENT <path>`) instead of the old bespoke `dreamux: cannot reach admin socket at <path> — is the server running?` sentence, matching the TRANSPORT_ERROR behavior the 0.24.0 CHANGELOG already documents for every other admin caller; a Command-level failure (the server ran and refused the request) still prints the unchanged `error: [code] message` line, and the exit code (1) is unchanged in both cases. These two commands are also now subject to the shared 10-second admin-socket request timeout instead of waiting indefinitely. (2) A `dreamux serve` startup failure now prints `dreamux: <message>` through the CLI's own top-level error handler instead of the old child process's `[server] fatal: <error with stack>` line, no stack included; verified for a missing/invalid config.json (rejects with `Error`/`RuleViolation`) and a failing plugin `server` hook (wrapped as `PluginLoadError`, also an `Error`), both of which keep exit code 1 unchanged, matching every other Dreamux failure's `Error`-subclass contract. `dreamux serve --help`'s old usage text (config path, `DREAMUX_CONFIG_DIR`, run/state/logs roots, plugin ref grammar) is dropped rather than carried into the new implementation: it was already unreachable through the `dreamux` CLI, which answers `--help` before ever invoking a serve handler, and that content already lives in `.agents/domains/state-config-and-files.md` and the `dreamux-maintenance` skill's `config-envelope.md` reference.
58
+ - Code organization refactor stage 7, item 7 (R14): the teammate.spawn and teammate.submit Commands now reject an empty prompt, a blank agent_runtime, or a blank intent with BAD_REQUEST, matching what the equivalent TeamMate MCP tools already reject. The MCP tools' own behavior is unchanged.
59
+ - Code organization refactor stage 7, item 5 (R20): the teammate.spawn and team.create Commands no longer accept repo.slug (already true of the equivalent MCP tools since 0.25.0). The worktree directory and default branch already derive from the allocated entity name; existing worktrees and persisted state are unchanged.
60
+ - Move identity notifications, completion recipients, admission, role tools and command addressing to their actual owners. Remove dormant loader import, chmod, executable-directory probe, name/id, clock and Workflow runner construction overrides. Preserve real CLI logger/sweep extensions, channel-log creation timing and leader-tool refusal order; persisted formats and config require no migration.
61
+ - Plugin hook review fixes: a plugin's own interceptor added with `hook.intercept` — on `call`, `tap`, `loop`, `result`, `done`, `error`, or `register` — is guarded the same way a tap is, attributed to the plugin that registered it: on `dispatcher`, `team`, and a launch hook a throw is logged and skipped, and on `hooks.plugin.for(name)` a throw fails plugin loading with a clear error, so neither crashes `dreamux serve` or `dreamux doctor` — including a `done`/`error` interceptor on an async hook, which tapable invokes from a continuation an ordinary try/catch around the hook cannot see. Interceptor methods must be synchronous: an `async` one's rejection is logged at runtime and fails plugin loading on `hooks.plugin.for(name)` with an error naming the interceptor, and an `async` `register` leaves the tap unchanged. A launch-hook interceptor sees only an opaque, disconnected handle, never the internal launch draft, so it cannot add a skill root that skips the skill fence. An async plugin tap on the sync `dispatcher`/`team` hooks is logged and skipped, with no unhandled rejection risk. An async `server()` or `contribute()` fails loading with a clear error naming the plugin, so a tap registered after its first `await` is never silently lost. A `plugins[]` entry's `config` block for a plugin with no `config.read` is ignored, so `dreamux serve` starts.
62
+ - Revert #408 and restore the previous workspace and Team creation behavior.
63
+ - Project RuntimeActivity without reshaping, redacting text and structured JSON payloads while retaining native ids, timestamps, result and error separately. Publish and validate the four Core events with camelCase members and remove unused redacted flags.
64
+ - Project the new token.usage activity through the conversation projection as numeric counters with nothing to redact.
65
+
66
+ ### Patches
67
+
68
+ - Release fully retired Team stores and read historical records from disk while preserving live owners, queued writes and cleanup. Keep an admitted leader dissolve on that captured owner through its asynchronous precheck and detached cleanup, even when initial construction fails. Restore non-blocking Codex inbound and final-parent behavioral coverage with explicit native-model opt-in and separate auth-free protocol checks. Retain revocable event sources and skip display DTO production without an audience while preserving durable observations. Restore actual ESLint code-line limits and public package boundary assertions. Ignore non-Team inventory names without reading or altering their contents, and keep one construction record acquisition through workspace preparation and publication. Pure retained-record reads return the committed snapshot without waiting for unrelated queued writes; writer releases still drain their captured queues.
69
+ - `dreamux serve` now always exits on SIGTERM or SIGINT: a shutdown that fails is logged and the process exits with status 1, and a shutdown that has not settled by a fixed deadline is cut off and the process exits with status 1, where a failed shutdown used to leave the process running. Under systemd (`Restart=on-failure`), a failed or cut-off shutdown that was not requested through `systemctl stop` therefore restarts the service, and a runtime child process can outlive a daemon cut off this way, as after a manager kill. A value refused by config validation in an online config replace is now reported as a bad request rather than an internal failure. An unknown `builtin:` provider ref in a replace payload is classified the same way, and its message no longer reads as an external-provider load failure; `serve`, `doctor` and `onboard` print the same reworded message for such a ref. The `repo` input of Dispatcher `spawn` and Team `create` carries its field descriptions and length bounds, defined once beside the repo request reader; because the canonical `spawn` and `team.create` commands validate against that same schema, an empty or over-long repo path, base ref or branch is now rejected as a bad request over the admin socket and the Channel port as well. `last` on a running agent, including a TeamMate a `send` is still reopening, reads the provider, config and session of the runtime that is running instead of the current config. Two lifecycle fixes: a Workflow handle lock taken while an agent is created is released when that agent closes before the handle is handed over, and looking up an absent Team no longer leaves a store cached for that id.
70
+ - Preserve existing taps when a plugin register interceptor omits its result. Reject asynchronous plugin factories and config readers with attributed load errors while observing their rejections. Reject simultaneously loaded plugin names that differ only by ASCII case; preserve the spelling of individual names, API keys, and state paths.
71
+ - Bind fixed runtime context once and return persistence and cleanup operations to their owning services.
72
+ - Team dissolve now writes the record closed immediately after its worktree precheck passes, then destroys every child service (Workflows, scheduler, members, leader) and reclaims the worktree as best-effort steps behind that commit, instead of stopping and closing children first and writing closed last. A member that dirties the managed worktree after the precheck no longer refuses the dissolve: the Team still closes, and a non-forced cleanup then only keeps the directory instead of removing it. A process that dies after the closed record lands now leaves the Team durably closed with whatever children the destroy pass had not yet reached, rather than reopening it. Persisted record shapes are unchanged.
73
+ - A workflow status/list read or a cron list made while its dispatcher is stopping or its Team is dissolving is now refused instead of answered: WorkflowService and SchedulerService fence those reads behind the same admission gate their mutations already crossed. A leader-scoped mutation racing both a dispatcher stop and a Team dissolve at the same time now reports TeamClosedError instead of ServerShuttingDownError, now that the TeamLeader handle is assembled from surfaces that already fence themselves instead of forwarding through 12 hand-written closures. Internally, several resources a parent used to build and hand down (the Workflow journal, the Agent admission ledger, the per-Team record handle) are now built by the module that owns them instead; persisted record and config shapes are unchanged.
4
74
 
5
75
  ## 0.25.0
6
76
  Thu, 10 Sep 2026 04:59:50 GMT
package/README.md CHANGED
@@ -274,12 +274,7 @@ default used to initialize a missing `~/.dreamux/state/<id>/access.json` is:
274
274
  "require_mention": true
275
275
  },
276
276
  "allow_users": [],
277
- "pending": {},
278
- "observed_chats": [],
279
- "warnings": [],
280
- "last_gate": {
281
- "at": 0
282
- }
277
+ "pending": {}
283
278
  }
284
279
  ```
285
280
 
@@ -287,10 +282,9 @@ default used to initialize a missing `~/.dreamux/state/<id>/access.json` is:
287
282
  `dm_policy`, `group.policy`, `group.allow_chats`, and
288
283
  `group.require_mention` are operator policy. `allow_users` is shared authority:
289
284
  live pairing/Owner approval may append it, and a quiesced operator may maintain
290
- it. `pending`, `observed_chats`, `warnings`, and `last_gate` are Channel-owned
291
- runtime ledger fields. Add real chat or sender ids only through the quiesced
292
- field-specific maintenance workflow below; the secure default grants neither
293
- chat nor sender authority.
285
+ it. `pending` is a Channel-owned runtime ledger field. Add real chat or sender
286
+ ids only through the quiesced field-specific maintenance workflow below; the
287
+ secure default grants neither chat nor sender authority.
294
288
 
295
289
  For human group messages, `group.require_mention` runs first and `block` drops
296
290
  all human traffic. Under `allowlist`, an unlisted chat drops and a listed chat
@@ -307,12 +301,16 @@ Before deploying, review every non-empty `allow_chats` entry under both
307
301
  be trusted and whose passive known-bot observation should remain enabled.
308
302
 
309
303
  The access path is always `~/.dreamux/state/<id>/access.json`;
310
- `DREAMUX_CONFIG_DIR` and `dreamux config path` affect `config.json` only. For a
311
- manual access edit, fully stop the owning Dispatcher, confirm it stopped,
304
+ `DREAMUX_ROOT` is the one relocation variable for both `config.json` and
305
+ `access.json`; `dreamux config path` still names `config.json` only. For a
306
+ manual access edit, stop the daemon, confirm the process exited,
312
307
  re-read after stop, apply only the requested policy/shared-authority fields via
313
308
  an owner-only sibling temporary file and atomic replacement at mode `0600`,
314
309
  validate the complete current V3 shape without printing values, and then start
315
- the Dispatcher. Preserve `version` and all Channel-owned ledger fields exactly.
310
+ the daemon. Preserve `version` and the `pending` ledger field exactly. Never
311
+ edit the file while the daemon runs: the running Channel holds the file in
312
+ memory and its next write (a pairing request or an owner approval, for example)
313
+ replaces the whole file, discarding the edit.
316
314
  A missing file after confirmed stop is valid current state: start from the full
317
315
  secure V3 default shown above, create a missing state directory at `0700`, and
318
316
  atomically create the first `0600` file. This is initialization, not a rebuild.
@@ -418,29 +416,44 @@ their own config and visible-reply tools.
418
416
  node common/scripts/install-run-rush.js test
419
417
  ```
420
418
 
421
- - `tests/smoke.test.ts` — fake-Codex dispatcher behavior: access gate,
422
- per-message turn/start inbound submission, process-local dedupe, MCP
423
- reply-only outbound, thread resume, app-server restart behavior, and
424
- approval fail-fast.
419
+ - `tests/channel-service.test.ts`, `tests/channel-input-format.test.ts` and
420
+ `tests/entity-turn-owner.test.ts` — Channel lifecycle, neutral inbound
421
+ rendering and turn ownership with controlled provider fixtures.
425
422
  - `tests/bin-launcher.test.ts` — real launcher behavior from arbitrary cwd and
426
423
  through symlinks.
427
- - `tests/doctor.test.ts` — standalone doctor checks for config, Codex home,
428
- services, provider-owned runtime binaries, and dispatcher workspace skill
429
- state.
430
- - `tests/agent-runtime-provider.test.ts`, `tests/channel-provider.test.ts`,
431
- `tests/registry.test.ts`, and `tests/provider-ref.test.ts` — provider ref,
432
- registry, Channel provider, and Agent Runtime provider coverage.
433
- - `tests/teammate-ledger.test.ts`, `tests/teammate-delivery.test.ts`, and
434
- `tests/teammate-mcp.test.ts` — server-hosted TeamMate state, delivery, retry,
435
- and retrieval coverage.
436
- - `tests/codex-live.test.ts` — real Codex app-server compatibility checks,
437
- plus the issue #63 mid-turn model gate. Set `DREAMUX_SKIP_LIVE_CODEX=1` only
438
- when no Codex binary is available locally. Public CI loud-skips the model
439
- gate unless `DREAMUX_RUN_LIVE_MODEL_GATE=1` is set in an environment with
440
- usable Codex model auth.
441
- - `tests/claude-code-live.test.ts` — opt-in Claude Code live contract. Set
442
- `DREAMUX_RUN_LIVE_CLAUDE_CODE=1` only in an environment with a usable
443
- `claude` binary and auth.
424
+ - `tests/doctor-plugins.test.ts`, `tests/onboard.test.ts` and
425
+ `tests/uninstall.test.ts` — provider diagnostics, onboarding, existence-only
426
+ uninstall previews and recursive removal of the whole Dreamux root, including
427
+ other files inside it. Preview changes no files and does not enumerate root
428
+ contents; actual filesystem removal errors still propagate. After path
429
+ normalization, a removal path inside or containing a provider-derived
430
+ operator home is refused before changing the service. Physical symlink
431
+ aliases are not resolved.
432
+ - `tests/official-provider-entries.test.ts`, `tests/plugin-loader.test.ts` and
433
+ `tests/provider-ref.test.ts` — package defaults, plugin contributions and
434
+ configured provider references.
435
+ - `tests/teammate-completion-lifecycle.test.ts`,
436
+ `tests/completion-delivery-owners.test.ts` and
437
+ `tests/mcp-delegate-catalog.test.ts` — actual service completion owners and
438
+ MCP tool reachability, with controlled runtimes.
439
+ - `tests/codex-live.test.ts` — installed-version and real app-server
440
+ initialization/thread compatibility with an empty home and no model auth.
441
+ Missing Codex fails unless `DREAMUX_SKIP_LIVE_CODEX=1` explicitly excludes
442
+ live checks for an environment without Codex.
443
+ - `tests/codex-inbound-live.test.ts`, `tests/codex-native-contracts-live.test.ts`
444
+ and `tests/codex-activity-live.test.ts` — six native model cases for issue #63
445
+ non-blocking inbound, effort, resume, structured output and live activity.
446
+ These require `DREAMUX_RUN_LIVE_MODEL_GATE=1` and usable model auth in both
447
+ local and CI runs. The default auth-free run explicitly excludes them and
448
+ does not certify their contracts. The inbound gate uses real Codex and MCP
449
+ with fake Feishu platform IO.
450
+ Provider constructors and defaults use public package entries. Native RPC,
451
+ protocol types, version/initialization probes and Feishu bot IO interception
452
+ retain test-only internal imports because no public instrumentation seam
453
+ exposes these facts. Provider changes must preserve those live assertions.
454
+ - `../agent-runtime/claude-code/tests/` contains Claude runtime, session and
455
+ RPC tests using synthetic protocol and subprocess fixtures. These tests do
456
+ not certify authenticated Claude model behavior.
444
457
 
445
458
  ## License
446
459
 
@@ -13,23 +13,34 @@
13
13
  * only this side can observe.
14
14
  */
15
15
  import { connect } from 'node:net';
16
- import { errorMessage, TransportError } from '../platform/errors.js';
16
+ import { errorMessage } from '@excitedjs/dreamux-utils';
17
+ import { TransportError } from '../platform/errors.js';
17
18
  import { adminSocketPath as defaultAdminSocketPath } from '../platform/paths.js';
18
- /** A failure the SERVER reported, carrying the server's own stable code. */
19
+ /**
20
+ * A failure the SERVER reported, carrying the server's own stable code.
21
+ *
22
+ * Structurally exactly `command/errors.ts`'s `CommandFailure`: `action` is
23
+ * typed as an exact optional `string`, matching that interface's `action?:
24
+ * string` field. A constructor parameter property typed `action?: string`
25
+ * would instead give the field the type an optional *parameter* has inside
26
+ * the constructor body, `string | undefined`, which `exactOptionalPropertyTypes`
27
+ * rejects where a `CommandFailure` is expected — so the field is declared and
28
+ * conditionally assigned by hand instead.
29
+ */
19
30
  export class AdminClientError extends Error {
20
31
  code;
21
- action;
22
- constructor(code, message,
23
32
  /**
24
33
  * The next step the failure stated for itself, when it stated one. Absent
25
34
  * means the failure never authored one, so a caller renders the code and
26
35
  * the message alone.
27
36
  */
28
- action) {
37
+ action;
38
+ constructor(code, message, action) {
29
39
  super(message);
30
- this.code = code;
31
- this.action = action;
32
40
  this.name = 'AdminClientError';
41
+ this.code = code;
42
+ if (action !== undefined)
43
+ this.action = action;
33
44
  }
34
45
  }
35
46
  const DEFAULT_TIMEOUT_MS = 10_000;
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/admin/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,OAAO,EAAe,MAAM,UAAU,CAAC;AAIhD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,eAAe,IAAI,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAQjF,4EAA4E;AAC5E,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAEvB;IAOA;IARlB,YACkB,IAAY,EAC5B,OAAe;IACf;;;;OAIG;IACa,MAAe;QAE/B,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the in-process Channel invoker does, which is where bounding,
13
13
  * schema validation, and shutdown admission happen for both.
14
14
  */
15
+ import { chmod, rm } from 'node:fs/promises';
15
16
  import { createServer } from 'node:net';
16
- import { chmod, readFile, rm, writeFile } from 'node:fs/promises';
17
17
  import { dirname } from 'node:path';
18
- import { ensureOwnerOnlyDir } from '@excitedjs/dreamux-utils';
18
+ import { ensureOwnerOnlyDir, errorInfo } from '@excitedjs/dreamux-utils';
19
19
  import { DreamuxError, TransportError, ValidationError, commandFailure, } from '../command/errors.js';
20
- import { errorInfo } from '../platform/error-info.js';
21
- /**
22
- * Max attempts to reclaim a stale pidfile before yielding to a competitor.
23
- * Mirrors claudemux's instance-lock policy.
24
- */
25
- const RECLAIM_ATTEMPTS = 3;
20
+ import { acquireInstanceLock, defaultIsPidAlive, readPidFile, releaseInstanceLock, } from '../platform/instance-lock.js';
21
+ import { adminSocketLockPath } from '../platform/paths.js';
26
22
  export function createAdminSocketServer(server, socketPath, options = {}) {
27
- const chmodFn = options.chmodFn ?? chmod;
28
23
  const isAlive = options.isPidAlive ?? defaultIsPidAlive;
29
24
  const myPid = options.selfPid ?? process.pid;
30
- const lockPath = `${socketPath}.lock`;
25
+ const lockPath = adminSocketLockPath(socketPath);
31
26
  let netServer = null;
32
27
  let holdLock = false;
33
28
  return {
@@ -40,13 +35,14 @@ export function createAdminSocketServer(server, socketPath, options = {}) {
40
35
  // (probe, cleanup, bind) behind a pidfile that's created with the
41
36
  // exclusive `wx` flag — atomic at the filesystem level. Once we
42
37
  // hold it, nobody else can be inside this start() concurrently.
43
- // Stale pidfiles (dead holder) are reclaimed up to RECLAIM_ATTEMPTS
44
- // times; a live holder always loses the race.
38
+ // Stale pidfiles (dead holder) are reclaimed up to a bounded number of
39
+ // times (`platform/instance-lock.ts`); a live holder always loses the
40
+ // race.
45
41
  // The socket + lock live under the volatile run root (issue #182),
46
42
  // which may not exist yet on a fresh install — create it owner-only, and
47
43
  // tighten it if a pre-existing run dir is group/world-traversable.
48
44
  await ensureOwnerOnlyDir(dirname(socketPath));
49
- await acquirePidLock(lockPath, myPid, isAlive);
45
+ await acquireInstanceLock(lockPath, myPid, isAlive);
50
46
  holdLock = true;
51
47
  try {
52
48
  // Lock is held — stale socket cleanup is now race-free.
@@ -57,9 +53,9 @@ export function createAdminSocketServer(server, socketPath, options = {}) {
57
53
  netServer.listen(socketPath, () => res());
58
54
  });
59
55
  // PR #3 review #2: chmod is a hard requirement, not best-effort —
60
- // a 0666 admin socket exposes server-ctl methods to every local user.
56
+ // a 0666 admin socket exposes every admin Command to every local user.
61
57
  try {
62
- await chmodFn(socketPath, 0o600);
58
+ await chmod(socketPath, 0o600);
63
59
  }
64
60
  catch (e) {
65
61
  const chmodErr = e instanceof Error ? e.message : String(e);
@@ -81,7 +77,7 @@ export function createAdminSocketServer(server, socketPath, options = {}) {
81
77
  catch {
82
78
  /* best-effort */
83
79
  }
84
- await releasePidLock(lockPath, myPid);
80
+ await releaseInstanceLock(lockPath, myPid);
85
81
  holdLock = false;
86
82
  throw err;
87
83
  }
@@ -98,98 +94,12 @@ export function createAdminSocketServer(server, socketPath, options = {}) {
98
94
  }
99
95
  }
100
96
  if (holdLock) {
101
- await releasePidLock(lockPath, myPid);
97
+ await releaseInstanceLock(lockPath, myPid);
102
98
  holdLock = false;
103
99
  }
104
100
  },
105
101
  };
106
102
  }
107
- /**
108
- * Acquire the single-instance pidfile lock.
109
- *
110
- * Atomic `wx` create races safely: two competing startups both attempt the
111
- * same call; one wins, one gets EEXIST. The loser then reads the holder's
112
- * PID and decides:
113
- * - alive holder → throw (split-brain prevention)
114
- * - dead holder → remove the stale file and retry the `wx` create
115
- *
116
- * RECLAIM_ATTEMPTS bounds the retry so a pathologically broken filesystem
117
- * doesn't spin forever.
118
- */
119
- async function acquirePidLock(lockPath, myPid, isAlive) {
120
- for (let attempt = 0; attempt < RECLAIM_ATTEMPTS; attempt++) {
121
- try {
122
- await writeFile(lockPath, `${myPid}\n`, { flag: 'wx', mode: 0o600 });
123
- return;
124
- }
125
- catch (err) {
126
- if (err.code !== 'EEXIST')
127
- throw err;
128
- }
129
- const holder = await readPidFile(lockPath);
130
- if (holder === myPid) {
131
- // Re-entrant — shouldn't happen in normal use, but treat as held.
132
- return;
133
- }
134
- if (holder !== null && isAlive(holder)) {
135
- throw new Error(`admin socket lockfile ${lockPath} is held by another live dreamux serve process (pid ${holder}). ` +
136
- 'Refusing to bind to avoid split-brain admin control. ' +
137
- 'Stop the other instance before starting a new one.');
138
- }
139
- // Stale lock (unreadable PID, or PID belongs to a dead process).
140
- // Remove and retry the exclusive create. A competitor reclaiming the
141
- // same stale file simply wins this round of `wx`, and we'll see *their*
142
- // live PID on the next iteration and bail out.
143
- try {
144
- await rm(lockPath, { force: true });
145
- }
146
- catch {
147
- /* concurrent reclaim — retry the wx open */
148
- }
149
- }
150
- throw new Error(`admin socket lockfile ${lockPath} could not be acquired after ${RECLAIM_ATTEMPTS} reclaim attempts; ` +
151
- 'a competitor is racing us. Retry after the other startup finishes.');
152
- }
153
- /**
154
- * Release the pidfile lock — but only if it still names us. A holder whose
155
- * file was already reclaimed by a competitor (e.g. we were paused long
156
- * enough for our PID to look dead) must not delete the new holder's lock.
157
- */
158
- async function releasePidLock(lockPath, myPid) {
159
- if ((await readPidFile(lockPath)) !== myPid)
160
- return;
161
- try {
162
- await rm(lockPath, { force: true });
163
- }
164
- catch {
165
- /* best-effort */
166
- }
167
- }
168
- async function readPidFile(path) {
169
- let txt;
170
- try {
171
- txt = (await readFile(path, 'utf8')).trim();
172
- }
173
- catch {
174
- return null;
175
- }
176
- if (txt === '')
177
- return null;
178
- const n = Number.parseInt(txt, 10);
179
- return Number.isInteger(n) && n > 0 ? n : null;
180
- }
181
- function defaultIsPidAlive(pid) {
182
- if (!Number.isInteger(pid) || pid <= 0)
183
- return false;
184
- try {
185
- process.kill(pid, 0);
186
- return true;
187
- }
188
- catch (e) {
189
- // EPERM means the process exists but we can't signal it (still alive).
190
- return e.code === 'EPERM';
191
- }
192
- }
193
103
  /**
194
104
  * Fail loud when a still-running OLD-version dreamux server holds the
195
105
  * pre-#182 admin socket lock (issue #182 PR-1, PR #183 review P1).
@@ -306,7 +216,8 @@ function reportedFailure(server, method, error) {
306
216
  */
307
217
  function adminInvocation(req) {
308
218
  const params = req.params;
309
- if (params !== undefined && (typeof params !== 'object' || Array.isArray(params))) {
219
+ if (params !== undefined &&
220
+ (typeof params !== 'object' || Array.isArray(params))) {
310
221
  throw new ValidationError("request 'params' must be an object");
311
222
  }
312
223
  const { dispatcher_id: dispatcherId, ...rest } = params ?? {};
@@ -1 +1 @@
1
- {"version":3,"file":"socket.js","sourceRoot":"","sources":["../../src/admin/socket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,YAAY,EAAyC,MAAM,UAAU,CAAC;AAC/E,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EACL,YAAY,EACZ,cAAc,EACd,eAAe,EACf,cAAc,GAEf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AA6BtD;;;GAGG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,MAAM,UAAU,uBAAuB,CACrC,MAAc,EACd,UAAkB,EAClB,UAA8B,EAAE;IAEhC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,KAAK,CAAC;IACzC,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,IAAI,iBAAiB,CAAC;IACxD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC;IAC7C,MAAM,QAAQ,GAAG,GAAG,UAAU,OAAO,CAAC;IACtC,IAAI,SAAS,GAA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E,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;IAC9D,IAAI,YAAY,KAAK,SAAS,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;QACnE,MAAM,IAAI,eAAe,CAAC,wCAAwC,CAAC,CAAC;IACtE,CAAC;IACD,OAAO;QACL,OAAO,EAAE;YACP,MAAM,EAAE,cAAc;YACtB,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACvE;QACD,uEAAuE;QACvE,wDAAwD;QACxD,OAAO,EAAE,IAA4B;KACtC,CAAC;AACJ,CAAC;AAED,SAAS,KAAK,CAAC,IAAY,EAAE,QAAuB;IAClD,IAAI,CAAC;QACH,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,iBAAiB;IACnB,CAAC;AACH,CAAC"}
@@ -8,15 +8,7 @@
8
8
  * cannot pass a valid object at load and return a different or invalid one when
9
9
  * the catalog later asks.
10
10
  */
11
- import { canonicalJsonValue, isPlainObject, JsonValueError, } from '../platform/json-value.js';
12
- /** Core's independent bounds on a provider's declared capabilities. */
13
- const MAX_TAGS = 32;
14
- const MAX_TAG_LENGTH = 64;
15
- const PUBLIC_CONFIG_BOUNDS = {
16
- maxDepth: 4,
17
- maxEntries: 32,
18
- maxBytes: 4096,
19
- };
11
+ import { canonicalJsonValue, isPlainObject, JSON_VALUE_UNBOUNDED, JsonValueError, } from '../platform/json-value.js';
20
12
  export class InvalidAgentRuntimeCapabilitiesError extends Error {
21
13
  providerRef;
22
14
  detail;
@@ -69,16 +61,11 @@ function normalizeTags(value, ref) {
69
61
  if (!Array.isArray(value)) {
70
62
  throw new InvalidAgentRuntimeCapabilitiesError(ref, 'tags must be an array');
71
63
  }
72
- if (value.length > MAX_TAGS) {
73
- throw new InvalidAgentRuntimeCapabilitiesError(ref, `tags may hold at most ${MAX_TAGS} entries`);
74
- }
75
64
  const seen = new Set();
76
65
  const tags = [];
77
66
  for (const entry of value) {
78
- if (typeof entry !== 'string' ||
79
- entry.length === 0 ||
80
- entry.length > MAX_TAG_LENGTH) {
81
- throw new InvalidAgentRuntimeCapabilitiesError(ref, `each tag must be a non-empty string of at most ${MAX_TAG_LENGTH} characters`);
67
+ if (typeof entry !== 'string' || entry.length === 0) {
68
+ throw new InvalidAgentRuntimeCapabilitiesError(ref, 'each tag must be a non-empty string');
82
69
  }
83
70
  // Declaration order is the provider's; duplicates are simply collapsed.
84
71
  if (seen.has(entry))
@@ -95,7 +82,7 @@ function normalizePublicConfig(value, ref) {
95
82
  throw new InvalidAgentRuntimeCapabilitiesError(ref, 'publicConfig must be an object when present');
96
83
  }
97
84
  try {
98
- return canonicalJsonValue(value, PUBLIC_CONFIG_BOUNDS);
85
+ return canonicalJsonValue(value, JSON_VALUE_UNBOUNDED);
99
86
  }
100
87
  catch (error) {
101
88
  if (error instanceof JsonValueError) {