aimux-cli 0.1.16 → 0.1.19

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 (357) hide show
  1. package/README.md +184 -67
  2. package/bin/aimux-dev +10 -0
  3. package/dist/agent-events.js +0 -1
  4. package/dist/agent-output-parser.js +0 -1
  5. package/dist/agent-prompt-delivery.js +0 -1
  6. package/dist/agent-tracker.js +0 -1
  7. package/dist/agent-watcher.js +0 -1
  8. package/dist/alert-display.d.ts +21 -0
  9. package/dist/alert-display.js +85 -0
  10. package/dist/atomic-write.js +0 -1
  11. package/dist/attachment-store.d.ts +0 -7
  12. package/dist/attachment-store.js +2 -87
  13. package/dist/builtin-metadata-watchers.js +4 -5
  14. package/dist/claude-hooks.d.ts +1 -0
  15. package/dist/claude-hooks.js +25 -1
  16. package/dist/config.d.ts +19 -13
  17. package/dist/config.js +28 -15
  18. package/dist/connection-targets.d.ts +8 -0
  19. package/dist/connection-targets.js +27 -0
  20. package/dist/context/compactor.js +0 -1
  21. package/dist/context/context-bridge.js +0 -1
  22. package/dist/context/context-file.js +0 -1
  23. package/dist/context/history.js +0 -1
  24. package/dist/credentials.d.ts +12 -0
  25. package/dist/credentials.js +48 -0
  26. package/dist/daemon.d.ts +23 -0
  27. package/dist/daemon.js +391 -67
  28. package/dist/dashboard/command-spec.js +0 -1
  29. package/dist/dashboard/feedback.js +0 -1
  30. package/dist/dashboard/index.d.ts +13 -10
  31. package/dist/dashboard/index.js +3 -27
  32. package/dist/dashboard/operation-failures.js +0 -1
  33. package/dist/dashboard/order.d.ts +22 -0
  34. package/dist/dashboard/order.js +54 -0
  35. package/dist/dashboard/pending-actions.d.ts +39 -10
  36. package/dist/dashboard/pending-actions.js +166 -37
  37. package/dist/dashboard/quick-jump.d.ts +2 -1
  38. package/dist/dashboard/quick-jump.js +7 -5
  39. package/dist/dashboard/runtime-evidence.js +0 -1
  40. package/dist/dashboard/session-actions.d.ts +4 -4
  41. package/dist/dashboard/session-actions.js +1 -2
  42. package/dist/dashboard/session-registry.d.ts +4 -3
  43. package/dist/dashboard/session-registry.js +16 -51
  44. package/dist/dashboard/sort.js +0 -1
  45. package/dist/dashboard/state.d.ts +1 -1
  46. package/dist/dashboard/state.js +0 -1
  47. package/dist/dashboard/targets.js +0 -1
  48. package/dist/dashboard/ui-state-store.d.ts +16 -1
  49. package/dist/dashboard/ui-state-store.js +73 -3
  50. package/dist/debug-state.d.ts +97 -0
  51. package/dist/debug-state.js +540 -0
  52. package/dist/debug.d.ts +38 -0
  53. package/dist/debug.js +219 -16
  54. package/dist/default-plugins/gh-pr-context.d.ts +2 -1
  55. package/dist/default-plugins/gh-pr-context.js +17 -12
  56. package/dist/default-plugins/transcript-length.js +15 -3
  57. package/dist/fast-control.js +37 -20
  58. package/dist/hotkeys.js +0 -1
  59. package/dist/http-client.js +31 -3
  60. package/dist/key-parser.js +0 -1
  61. package/dist/last-used.js +0 -1
  62. package/dist/local-ui-server.d.ts +22 -0
  63. package/dist/local-ui-server.js +185 -0
  64. package/dist/login-flow.d.ts +7 -0
  65. package/dist/login-flow.js +119 -0
  66. package/dist/main.js +821 -152
  67. package/dist/managed-launch-env.js +14 -1
  68. package/dist/metadata-server.d.ts +36 -36
  69. package/dist/metadata-server.js +638 -138
  70. package/dist/metadata-store.d.ts +4 -1
  71. package/dist/metadata-store.js +30 -3
  72. package/dist/multiplexer/agent-io-methods.d.ts +2 -10
  73. package/dist/multiplexer/agent-io-methods.js +12 -44
  74. package/dist/multiplexer/archives.js +8 -10
  75. package/dist/multiplexer/dashboard-actions-methods.js +0 -1
  76. package/dist/multiplexer/dashboard-control.js +45 -14
  77. package/dist/multiplexer/dashboard-interaction.d.ts +8 -2
  78. package/dist/multiplexer/dashboard-interaction.js +187 -29
  79. package/dist/multiplexer/dashboard-model.d.ts +10 -3
  80. package/dist/multiplexer/dashboard-model.js +417 -36
  81. package/dist/multiplexer/dashboard-ops.d.ts +9 -7
  82. package/dist/multiplexer/dashboard-ops.js +178 -69
  83. package/dist/multiplexer/dashboard-state-methods.d.ts +2 -1
  84. package/dist/multiplexer/dashboard-state-methods.js +3 -3
  85. package/dist/multiplexer/dashboard-tail-methods.d.ts +22 -10
  86. package/dist/multiplexer/dashboard-tail-methods.js +164 -48
  87. package/dist/multiplexer/dashboard-view-methods.d.ts +1 -1
  88. package/dist/multiplexer/dashboard-view-methods.js +23 -9
  89. package/dist/multiplexer/graveyard-view-model.d.ts +9 -1
  90. package/dist/multiplexer/graveyard-view-model.js +39 -1
  91. package/dist/multiplexer/index.d.ts +15 -12
  92. package/dist/multiplexer/index.js +64 -44
  93. package/dist/multiplexer/navigation.js +0 -1
  94. package/dist/multiplexer/notifications.js +107 -25
  95. package/dist/multiplexer/persistence-methods.d.ts +31 -4
  96. package/dist/multiplexer/persistence-methods.js +304 -309
  97. package/dist/multiplexer/runtime-lifecycle-methods.d.ts +8 -10
  98. package/dist/multiplexer/runtime-lifecycle-methods.js +104 -87
  99. package/dist/multiplexer/runtime-state.d.ts +8 -10
  100. package/dist/multiplexer/runtime-state.js +82 -146
  101. package/dist/multiplexer/runtime-sync.d.ts +2 -10
  102. package/dist/multiplexer/runtime-sync.js +3 -19
  103. package/dist/multiplexer/service-state-snapshot.d.ts +2 -4
  104. package/dist/multiplexer/service-state-snapshot.js +4 -52
  105. package/dist/multiplexer/services.d.ts +1 -0
  106. package/dist/multiplexer/services.js +55 -6
  107. package/dist/multiplexer/session-capture.d.ts +1 -0
  108. package/dist/multiplexer/session-capture.js +23 -0
  109. package/dist/multiplexer/session-launch.d.ts +4 -1
  110. package/dist/multiplexer/session-launch.js +152 -64
  111. package/dist/multiplexer/session-runtime-core.d.ts +8 -20
  112. package/dist/multiplexer/session-runtime-core.js +40 -136
  113. package/dist/multiplexer/subscreens.js +10 -4
  114. package/dist/multiplexer/tool-picker.js +0 -1
  115. package/dist/multiplexer/worktree-graveyard.d.ts +0 -1
  116. package/dist/multiplexer/worktree-graveyard.js +15 -17
  117. package/dist/multiplexer/worktrees.js +96 -41
  118. package/dist/notification-context.js +8 -5
  119. package/dist/notifications.js +163 -102
  120. package/dist/notify.d.ts +4 -0
  121. package/dist/notify.js +14 -1
  122. package/dist/orchestration-actions.js +0 -1
  123. package/dist/orchestration-routing.js +0 -1
  124. package/dist/orchestration.js +0 -1
  125. package/dist/osc-notifications.js +0 -1
  126. package/dist/paths.d.ts +32 -7
  127. package/dist/paths.js +82 -59
  128. package/dist/pending-actions.d.ts +5 -0
  129. package/dist/pending-actions.js +13 -0
  130. package/dist/plugin-runtime.js +9 -3
  131. package/dist/project-events.d.ts +1 -10
  132. package/dist/project-events.js +0 -11
  133. package/dist/project-scanner.d.ts +2 -3
  134. package/dist/project-scanner.js +58 -130
  135. package/dist/project-service-manifest.d.ts +1 -3
  136. package/dist/project-service-manifest.js +1 -4
  137. package/dist/recency.js +0 -1
  138. package/dist/recorder.js +0 -1
  139. package/dist/relay-client.d.ts +30 -0
  140. package/dist/relay-client.js +190 -0
  141. package/dist/remote-access.d.ts +16 -0
  142. package/dist/remote-access.js +90 -0
  143. package/dist/runtime-core/exchange-derived.d.ts +2 -0
  144. package/dist/runtime-core/exchange-derived.js +153 -0
  145. package/dist/runtime-core/exchange-import.d.ts +24 -0
  146. package/dist/runtime-core/exchange-import.js +317 -0
  147. package/dist/runtime-core/exchange-store.d.ts +157 -0
  148. package/dist/runtime-core/exchange-store.js +452 -0
  149. package/dist/runtime-core/topology-services.d.ts +38 -0
  150. package/dist/runtime-core/topology-services.js +170 -0
  151. package/dist/runtime-core/topology-sessions.d.ts +52 -0
  152. package/dist/runtime-core/topology-sessions.js +238 -0
  153. package/dist/runtime-core/topology-store.d.ts +171 -0
  154. package/dist/runtime-core/topology-store.js +419 -0
  155. package/dist/runtime-core/topology-worktrees.d.ts +60 -0
  156. package/dist/runtime-core/topology-worktrees.js +199 -0
  157. package/dist/runtime-migration.d.ts +69 -0
  158. package/dist/runtime-migration.js +398 -0
  159. package/dist/session-bootstrap.d.ts +8 -6
  160. package/dist/session-bootstrap.js +51 -159
  161. package/dist/session-runtime.d.ts +2 -0
  162. package/dist/session-runtime.js +1 -1
  163. package/dist/session-semantics.d.ts +12 -4
  164. package/dist/session-semantics.js +14 -1
  165. package/dist/shell-args.js +0 -1
  166. package/dist/shell-hooks.js +32 -11
  167. package/dist/shell-state.d.ts +2 -0
  168. package/dist/shell-state.js +26 -2
  169. package/dist/status-detector.js +0 -1
  170. package/dist/statusline-model.d.ts +10 -2
  171. package/dist/statusline-model.js +106 -31
  172. package/dist/task-workflow.d.ts +6 -9
  173. package/dist/task-workflow.js +37 -85
  174. package/dist/tasks.d.ts +6 -33
  175. package/dist/tasks.js +46 -89
  176. package/dist/team.d.ts +29 -0
  177. package/dist/team.js +40 -1
  178. package/dist/terminal-host.js +0 -1
  179. package/dist/threads.d.ts +6 -35
  180. package/dist/threads.js +89 -99
  181. package/dist/tmux/doctor.js +0 -1
  182. package/dist/tmux/inbox-popup.js +37 -16
  183. package/dist/tmux/runtime-manager.d.ts +3 -0
  184. package/dist/tmux/runtime-manager.js +21 -5
  185. package/dist/tmux/session-transport.js +0 -1
  186. package/dist/tmux/statusline-cache.js +0 -1
  187. package/dist/tmux/statusline.js +49 -10
  188. package/dist/tmux/switcher.js +0 -1
  189. package/dist/tmux/window-open.js +1 -3
  190. package/dist/tool-output-watchers.d.ts +0 -18
  191. package/dist/tool-output-watchers.js +0 -323
  192. package/dist/tui/render/box.js +0 -1
  193. package/dist/tui/render/text.js +0 -1
  194. package/dist/tui/screens/dashboard-renderers.js +37 -26
  195. package/dist/tui/screens/overlay-renderers.d.ts +2 -0
  196. package/dist/tui/screens/overlay-renderers.js +37 -2
  197. package/dist/tui/screens/subscreen-renderers.js +7 -1
  198. package/dist/workflow.js +0 -1
  199. package/dist/worktree.js +17 -1
  200. package/dist-ui/_expo/static/css/web-30453ede1678c16acb08b97e83e8646d.css +1 -0
  201. package/dist-ui/_expo/static/js/web/entry-477c745b2adc79367a4380ecf07d9ff6.js +14620 -0
  202. package/dist-ui/assets/assets/images/icon.a5413dcd2e811c9f2317d01a28118d8a.png +0 -0
  203. package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png +0 -0
  204. package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png +0 -0
  205. package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png +0 -0
  206. package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png +0 -0
  207. package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png +0 -0
  208. package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png +0 -0
  209. package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png +0 -0
  210. package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png +0 -0
  211. package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png +0 -0
  212. package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png +0 -0
  213. package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png +0 -0
  214. package/dist-ui/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png +0 -0
  215. package/dist-ui/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png +0 -0
  216. package/dist-ui/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png +0 -0
  217. package/dist-ui/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png +0 -0
  218. package/dist-ui/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png +0 -0
  219. package/dist-ui/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png +0 -0
  220. package/dist-ui/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png +0 -0
  221. package/dist-ui/favicon.ico +0 -0
  222. package/dist-ui/index.html +38 -0
  223. package/dist-ui/metadata.json +1 -0
  224. package/package.json +29 -12
  225. package/dist/agent-events.js.map +0 -1
  226. package/dist/agent-message-parts.d.ts +0 -17
  227. package/dist/agent-message-parts.js +0 -31
  228. package/dist/agent-message-parts.js.map +0 -1
  229. package/dist/agent-output-parser.js.map +0 -1
  230. package/dist/agent-prompt-delivery.js.map +0 -1
  231. package/dist/agent-tracker.js.map +0 -1
  232. package/dist/agent-watcher.js.map +0 -1
  233. package/dist/atomic-write.js.map +0 -1
  234. package/dist/attachment-store.js.map +0 -1
  235. package/dist/builtin-metadata-watchers.js.map +0 -1
  236. package/dist/claude-hooks.js.map +0 -1
  237. package/dist/config.js.map +0 -1
  238. package/dist/context/compactor.js.map +0 -1
  239. package/dist/context/context-bridge.js.map +0 -1
  240. package/dist/context/context-file.js.map +0 -1
  241. package/dist/context/history.js.map +0 -1
  242. package/dist/daemon.js.map +0 -1
  243. package/dist/dashboard/command-spec.js.map +0 -1
  244. package/dist/dashboard/feedback.js.map +0 -1
  245. package/dist/dashboard/index.js.map +0 -1
  246. package/dist/dashboard/operation-failures.js.map +0 -1
  247. package/dist/dashboard/pending-actions.js.map +0 -1
  248. package/dist/dashboard/quick-jump.js.map +0 -1
  249. package/dist/dashboard/runtime-evidence.js.map +0 -1
  250. package/dist/dashboard/session-actions.js.map +0 -1
  251. package/dist/dashboard/session-registry.js.map +0 -1
  252. package/dist/dashboard/sort.js.map +0 -1
  253. package/dist/dashboard/state.js.map +0 -1
  254. package/dist/dashboard/targets.js.map +0 -1
  255. package/dist/dashboard/ui-state-store.js.map +0 -1
  256. package/dist/debug.js.map +0 -1
  257. package/dist/default-plugins/gh-pr-context.js.map +0 -1
  258. package/dist/default-plugins/transcript-length.js.map +0 -1
  259. package/dist/fast-control.js.map +0 -1
  260. package/dist/hotkeys.js.map +0 -1
  261. package/dist/http-client.js.map +0 -1
  262. package/dist/instance-directory.d.ts +0 -32
  263. package/dist/instance-directory.js +0 -82
  264. package/dist/instance-directory.js.map +0 -1
  265. package/dist/instance-registry.d.ts +0 -39
  266. package/dist/instance-registry.js +0 -208
  267. package/dist/instance-registry.js.map +0 -1
  268. package/dist/key-parser.js.map +0 -1
  269. package/dist/last-used.js.map +0 -1
  270. package/dist/main.js.map +0 -1
  271. package/dist/managed-launch-env.js.map +0 -1
  272. package/dist/metadata-server.js.map +0 -1
  273. package/dist/metadata-store.js.map +0 -1
  274. package/dist/multiplexer/agent-io-methods.js.map +0 -1
  275. package/dist/multiplexer/archives.js.map +0 -1
  276. package/dist/multiplexer/dashboard-actions-methods.js.map +0 -1
  277. package/dist/multiplexer/dashboard-control.js.map +0 -1
  278. package/dist/multiplexer/dashboard-interaction.js.map +0 -1
  279. package/dist/multiplexer/dashboard-model.js.map +0 -1
  280. package/dist/multiplexer/dashboard-ops.js.map +0 -1
  281. package/dist/multiplexer/dashboard-state-methods.js.map +0 -1
  282. package/dist/multiplexer/dashboard-tail-methods.js.map +0 -1
  283. package/dist/multiplexer/dashboard-view-methods.js.map +0 -1
  284. package/dist/multiplexer/graveyard-view-model.js.map +0 -1
  285. package/dist/multiplexer/index.js.map +0 -1
  286. package/dist/multiplexer/navigation.js.map +0 -1
  287. package/dist/multiplexer/notifications.js.map +0 -1
  288. package/dist/multiplexer/persistence-methods.js.map +0 -1
  289. package/dist/multiplexer/runtime-lifecycle-methods.js.map +0 -1
  290. package/dist/multiplexer/runtime-state.js.map +0 -1
  291. package/dist/multiplexer/runtime-sync.js.map +0 -1
  292. package/dist/multiplexer/service-state-snapshot.js.map +0 -1
  293. package/dist/multiplexer/services.js.map +0 -1
  294. package/dist/multiplexer/session-actions.d.ts +0 -40
  295. package/dist/multiplexer/session-actions.js +0 -110
  296. package/dist/multiplexer/session-actions.js.map +0 -1
  297. package/dist/multiplexer/session-launch.js.map +0 -1
  298. package/dist/multiplexer/session-runtime-core.js.map +0 -1
  299. package/dist/multiplexer/subscreens.js.map +0 -1
  300. package/dist/multiplexer/tool-picker.js.map +0 -1
  301. package/dist/multiplexer/worktree-graveyard.js.map +0 -1
  302. package/dist/multiplexer/worktrees.js.map +0 -1
  303. package/dist/notification-context.js.map +0 -1
  304. package/dist/notifications.js.map +0 -1
  305. package/dist/notify.js.map +0 -1
  306. package/dist/orchestration-actions.js.map +0 -1
  307. package/dist/orchestration-dispatcher.d.ts +0 -25
  308. package/dist/orchestration-dispatcher.js +0 -59
  309. package/dist/orchestration-dispatcher.js.map +0 -1
  310. package/dist/orchestration-routing.js.map +0 -1
  311. package/dist/orchestration.js.map +0 -1
  312. package/dist/osc-notifications.js.map +0 -1
  313. package/dist/paths.js.map +0 -1
  314. package/dist/plugin-runtime.js.map +0 -1
  315. package/dist/project-events.js.map +0 -1
  316. package/dist/project-scanner.js.map +0 -1
  317. package/dist/project-service-manifest.js.map +0 -1
  318. package/dist/recency.js.map +0 -1
  319. package/dist/recorder.js.map +0 -1
  320. package/dist/session-bootstrap.js.map +0 -1
  321. package/dist/session-input-operations.d.ts +0 -19
  322. package/dist/session-input-operations.js +0 -46
  323. package/dist/session-input-operations.js.map +0 -1
  324. package/dist/session-message-history.d.ts +0 -27
  325. package/dist/session-message-history.js +0 -105
  326. package/dist/session-message-history.js.map +0 -1
  327. package/dist/session-runtime.js.map +0 -1
  328. package/dist/session-semantics.js.map +0 -1
  329. package/dist/shell-args.js.map +0 -1
  330. package/dist/shell-hooks.js.map +0 -1
  331. package/dist/shell-state.js.map +0 -1
  332. package/dist/status-detector.js.map +0 -1
  333. package/dist/statusline-model.js.map +0 -1
  334. package/dist/task-dispatcher.d.ts +0 -64
  335. package/dist/task-dispatcher.js +0 -213
  336. package/dist/task-dispatcher.js.map +0 -1
  337. package/dist/task-workflow.js.map +0 -1
  338. package/dist/tasks.js.map +0 -1
  339. package/dist/team.js.map +0 -1
  340. package/dist/terminal-host.js.map +0 -1
  341. package/dist/threads.js.map +0 -1
  342. package/dist/tmux/doctor.js.map +0 -1
  343. package/dist/tmux/inbox-popup.js.map +0 -1
  344. package/dist/tmux/runtime-manager.js.map +0 -1
  345. package/dist/tmux/session-transport.js.map +0 -1
  346. package/dist/tmux/statusline-cache.js.map +0 -1
  347. package/dist/tmux/statusline.js.map +0 -1
  348. package/dist/tmux/switcher.js.map +0 -1
  349. package/dist/tmux/window-open.js.map +0 -1
  350. package/dist/tool-output-watchers.js.map +0 -1
  351. package/dist/tui/render/box.js.map +0 -1
  352. package/dist/tui/render/text.js.map +0 -1
  353. package/dist/tui/screens/dashboard-renderers.js.map +0 -1
  354. package/dist/tui/screens/overlay-renderers.js.map +0 -1
  355. package/dist/tui/screens/subscreen-renderers.js.map +0 -1
  356. package/dist/workflow.js.map +0 -1
  357. package/dist/worktree.js.map +0 -1
@@ -0,0 +1,69 @@
1
+ import { type RuntimeExchange } from "./runtime-core/exchange-store.js";
2
+ export type RuntimeMigrationDiagnosticSeverity = "info" | "warning" | "error";
3
+ export type RuntimeMigrationSourceKind = "legacy-context" | "legacy-history" | "legacy-status" | "legacy-thread" | "legacy-message-log" | "legacy-task" | "legacy-plan" | "legacy-recording" | "legacy-attachment" | "runtime-topology" | "runtime-exchange" | "saved-state" | "metadata";
4
+ export interface RuntimeMigrationDiagnostic {
5
+ severity: RuntimeMigrationDiagnosticSeverity;
6
+ kind: RuntimeMigrationSourceKind;
7
+ path: string;
8
+ message: string;
9
+ }
10
+ export interface RuntimeMigrationReport {
11
+ version: 1;
12
+ generatedAt: string;
13
+ status: "clean" | "needs_import" | "blocked";
14
+ project: {
15
+ repoRoot: string;
16
+ projectId: string;
17
+ projectStateDir: string;
18
+ localAimuxDir: string;
19
+ };
20
+ authority: {
21
+ runtimeTopologyPath: string;
22
+ runtimeExchangePath: string;
23
+ note: string;
24
+ };
25
+ legacy: Record<RuntimeMigrationSourceKind, number>;
26
+ diagnostics: RuntimeMigrationDiagnostic[];
27
+ }
28
+ export interface RuntimeMigrationManifest {
29
+ version: 1;
30
+ generatedAt: string;
31
+ report: RuntimeMigrationReport;
32
+ backups: Array<{
33
+ kind: RuntimeMigrationSourceKind;
34
+ source: string;
35
+ backup: string;
36
+ }>;
37
+ copiedDirs: Array<{
38
+ kind: RuntimeMigrationSourceKind;
39
+ source: string;
40
+ target: string;
41
+ }>;
42
+ copiedFiles: Array<{
43
+ kind: RuntimeMigrationSourceKind;
44
+ source: string;
45
+ target: string;
46
+ }>;
47
+ wrote: Array<{
48
+ kind: RuntimeMigrationSourceKind;
49
+ path: string;
50
+ }>;
51
+ }
52
+ export declare function buildRuntimeMigrationReport(input?: {
53
+ cwd?: string;
54
+ now?: string;
55
+ }): RuntimeMigrationReport;
56
+ export declare function importRuntimeMigration(input?: {
57
+ cwd?: string;
58
+ now?: string;
59
+ }): {
60
+ exchange: RuntimeExchange;
61
+ manifest: RuntimeMigrationManifest;
62
+ };
63
+ export declare function rollbackRuntimeMigration(manifestPath: string): RuntimeMigrationManifest;
64
+ export declare function renderRuntimeMigrationReport(report: RuntimeMigrationReport): string;
65
+ export declare function renderRuntimeMigrationImportResult(result: {
66
+ exchange: RuntimeExchange;
67
+ manifest: RuntimeMigrationManifest;
68
+ }): string;
69
+ export declare function renderRuntimeMigrationRollbackResult(manifest: RuntimeMigrationManifest): string;
@@ -0,0 +1,398 @@
1
+ import { copyFileSync, cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync, } from "node:fs";
2
+ import { tmpdir } from "node:os";
3
+ import { basename, dirname, join } from "node:path";
4
+ import { getReadOnlyProjectPathsFor } from "./paths.js";
5
+ import { RuntimeExchangeStore } from "./runtime-core/exchange-store.js";
6
+ import { importRuntimeExchangeFromLegacyFiles } from "./runtime-core/exchange-import.js";
7
+ import { RuntimeTopologyStore } from "./runtime-core/topology-store.js";
8
+ function emptyLegacyCounts() {
9
+ return {
10
+ "legacy-context": 0,
11
+ "legacy-history": 0,
12
+ "legacy-status": 0,
13
+ "legacy-thread": 0,
14
+ "legacy-message-log": 0,
15
+ "legacy-task": 0,
16
+ "legacy-plan": 0,
17
+ "legacy-recording": 0,
18
+ "legacy-attachment": 0,
19
+ "runtime-topology": 0,
20
+ "runtime-exchange": 0,
21
+ "saved-state": 0,
22
+ metadata: 0,
23
+ };
24
+ }
25
+ function listFiles(dir, predicate) {
26
+ if (!existsSync(dir))
27
+ return [];
28
+ try {
29
+ return readdirSync(dir)
30
+ .filter(predicate)
31
+ .map((name) => join(dir, name));
32
+ }
33
+ catch {
34
+ return [];
35
+ }
36
+ }
37
+ function listNestedFiles(dir, predicate) {
38
+ if (!existsSync(dir))
39
+ return [];
40
+ const paths = [];
41
+ try {
42
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
43
+ const path = join(dir, entry.name);
44
+ if (entry.isDirectory()) {
45
+ paths.push(...listNestedFiles(path, predicate));
46
+ }
47
+ else if (predicate(entry.name)) {
48
+ paths.push(path);
49
+ }
50
+ }
51
+ }
52
+ catch {
53
+ return [];
54
+ }
55
+ return paths;
56
+ }
57
+ function hasEntries(path) {
58
+ try {
59
+ return existsSync(path) && readdirSync(path).length > 0;
60
+ }
61
+ catch {
62
+ return false;
63
+ }
64
+ }
65
+ function pushJsonDiagnostic(diagnostics, kind, path) {
66
+ try {
67
+ JSON.parse(readFileSync(path, "utf8"));
68
+ }
69
+ catch (err) {
70
+ diagnostics.push({
71
+ severity: "error",
72
+ kind,
73
+ path,
74
+ message: `invalid JSON: ${err instanceof Error ? err.message : String(err)}`,
75
+ });
76
+ }
77
+ }
78
+ function pushJsonlDiagnostics(diagnostics, kind, path) {
79
+ let lines;
80
+ try {
81
+ lines = readFileSync(path, "utf8").split("\n");
82
+ }
83
+ catch (err) {
84
+ diagnostics.push({
85
+ severity: "error",
86
+ kind,
87
+ path,
88
+ message: `unreadable JSONL: ${err instanceof Error ? err.message : String(err)}`,
89
+ });
90
+ return;
91
+ }
92
+ lines.forEach((line, index) => {
93
+ if (!line.trim())
94
+ return;
95
+ try {
96
+ JSON.parse(line);
97
+ }
98
+ catch (err) {
99
+ diagnostics.push({
100
+ severity: "error",
101
+ kind,
102
+ path,
103
+ message: `invalid JSONL on line ${index + 1}: ${err instanceof Error ? err.message : String(err)}`,
104
+ });
105
+ }
106
+ });
107
+ }
108
+ function validateRuntimeYaml(diagnostics, paths) {
109
+ if (existsSync(paths.runtimeTopologyPath)) {
110
+ try {
111
+ new RuntimeTopologyStore(paths.runtimeTopologyPath).read();
112
+ }
113
+ catch (err) {
114
+ diagnostics.push({
115
+ severity: "error",
116
+ kind: "runtime-topology",
117
+ path: paths.runtimeTopologyPath,
118
+ message: `invalid runtime topology: ${err instanceof Error ? err.message : String(err)}`,
119
+ });
120
+ }
121
+ }
122
+ if (existsSync(paths.runtimeExchangePath)) {
123
+ try {
124
+ new RuntimeExchangeStore(paths.runtimeExchangePath).read();
125
+ }
126
+ catch (err) {
127
+ diagnostics.push({
128
+ severity: "error",
129
+ kind: "runtime-exchange",
130
+ path: paths.runtimeExchangePath,
131
+ message: `invalid runtime exchange: ${err instanceof Error ? err.message : String(err)}`,
132
+ });
133
+ }
134
+ }
135
+ }
136
+ function runtimeExchangeHasRecords(path) {
137
+ const exchange = new RuntimeExchangeStore(path).read();
138
+ return [
139
+ exchange.threads,
140
+ exchange.messages,
141
+ exchange.tasks,
142
+ exchange.handoffs,
143
+ exchange.reviews,
144
+ exchange.waits,
145
+ exchange.inbox,
146
+ exchange.planRefs,
147
+ exchange.continuityRefs,
148
+ exchange.attachmentRefs,
149
+ ].some((entries) => entries.length > 0);
150
+ }
151
+ function timestampForPath(date) {
152
+ return date.toISOString().replace(/[:.]/g, "-");
153
+ }
154
+ function backupFile(manifest, kind, source, backupDir) {
155
+ if (!existsSync(source))
156
+ return;
157
+ const backup = join(backupDir, basename(source));
158
+ copyFileSync(source, backup);
159
+ manifest.backups.push({ kind, source, backup });
160
+ }
161
+ function copiedFileEntries(kind, source, target) {
162
+ return listNestedFiles(source, () => true).map((path) => ({
163
+ kind,
164
+ source: path,
165
+ target: join(target, path.slice(source.length + 1)),
166
+ }));
167
+ }
168
+ function copyLegacyDir(manifest, kind, source, target) {
169
+ if (!existsSync(source))
170
+ return;
171
+ if (hasEntries(target))
172
+ return;
173
+ mkdirSync(dirname(target), { recursive: true });
174
+ cpSync(source, target, { recursive: true, force: false });
175
+ manifest.copiedDirs.push({ kind, source, target });
176
+ manifest.copiedFiles.push(...copiedFileEntries(kind, source, target));
177
+ }
178
+ function legacyGlobalFiles(paths) {
179
+ const globalHistoryDir = join(paths.projectStateDir, "history");
180
+ const globalContextDir = join(paths.projectStateDir, "context");
181
+ const globalStatusDir = join(paths.projectStateDir, "status");
182
+ return {
183
+ historyPaths: listFiles(globalHistoryDir, (name) => name.endsWith(".jsonl")),
184
+ contextPaths: listNestedFiles(globalContextDir, (name) => name.endsWith(".md") || name.endsWith(".jsonl")),
185
+ statusPaths: listFiles(globalStatusDir, (name) => name.endsWith(".md")),
186
+ };
187
+ }
188
+ function validateImportedExchange(exchange) {
189
+ const dir = mkdtempSync(join(tmpdir(), "aimux-runtime-migration-validate-"));
190
+ try {
191
+ new RuntimeExchangeStore(join(dir, "runtime-exchange.yaml")).write(exchange);
192
+ }
193
+ finally {
194
+ rmSync(dir, { recursive: true, force: true });
195
+ }
196
+ }
197
+ function rollbackManifest(manifest) {
198
+ const backedSources = new Set(manifest.backups.map((backup) => backup.source));
199
+ for (const copied of manifest.copiedFiles) {
200
+ if (existsSync(copied.target)) {
201
+ rmSync(copied.target, { force: true });
202
+ }
203
+ }
204
+ for (const copied of manifest.copiedDirs) {
205
+ if (!existsSync(copied.target))
206
+ continue;
207
+ try {
208
+ if (readdirSync(copied.target).length === 0) {
209
+ rmSync(copied.target, { recursive: true, force: true });
210
+ }
211
+ }
212
+ catch { }
213
+ }
214
+ for (const wrote of manifest.wrote) {
215
+ if (!backedSources.has(wrote.path) && existsSync(wrote.path)) {
216
+ rmSync(wrote.path, { force: true });
217
+ }
218
+ }
219
+ for (const backup of manifest.backups) {
220
+ mkdirSync(dirname(backup.source), { recursive: true });
221
+ copyFileSync(backup.backup, backup.source);
222
+ }
223
+ }
224
+ export function buildRuntimeMigrationReport(input = {}) {
225
+ const generatedAt = input.now ?? new Date().toISOString();
226
+ const paths = getReadOnlyProjectPathsFor(input.cwd ?? process.cwd());
227
+ const legacy = emptyLegacyCounts();
228
+ const diagnostics = [];
229
+ const localThreadsDir = join(paths.localAimuxDir, "threads");
230
+ const localTasksDir = join(paths.localAimuxDir, "tasks");
231
+ const localPlansDir = join(paths.localAimuxDir, "plans");
232
+ const localHistoryDir = join(paths.localAimuxDir, "history");
233
+ const localContextDir = join(paths.localAimuxDir, "context");
234
+ const localStatusDir = join(paths.localAimuxDir, "status");
235
+ const localAttachmentsDir = join(paths.localAimuxDir, "attachments");
236
+ const globalRecordingsDir = join(paths.projectStateDir, "recordings");
237
+ const globalHistoryDir = join(paths.projectStateDir, "history");
238
+ const globalContextDir = join(paths.projectStateDir, "context");
239
+ const globalStatusDir = join(paths.projectStateDir, "status");
240
+ const threadFiles = listFiles(localThreadsDir, (name) => name.endsWith(".json"));
241
+ const messageLogs = listFiles(localThreadsDir, (name) => name.endsWith(".jsonl"));
242
+ const taskFiles = listFiles(localTasksDir, (name) => name.endsWith(".json"));
243
+ const attachmentFiles = listFiles(localAttachmentsDir, (name) => name.endsWith(".json"));
244
+ legacy["legacy-thread"] = threadFiles.length;
245
+ legacy["legacy-message-log"] = messageLogs.length;
246
+ legacy["legacy-task"] = taskFiles.length;
247
+ legacy["legacy-plan"] = listFiles(localPlansDir, (name) => name.endsWith(".md")).length;
248
+ legacy["legacy-history"] =
249
+ listFiles(localHistoryDir, (name) => name.endsWith(".jsonl")).length +
250
+ listFiles(globalHistoryDir, (name) => name.endsWith(".jsonl")).length;
251
+ legacy["legacy-context"] =
252
+ listNestedFiles(localContextDir, (name) => name.endsWith(".md") || name.endsWith(".jsonl")).length +
253
+ listNestedFiles(globalContextDir, (name) => name.endsWith(".md") || name.endsWith(".jsonl")).length;
254
+ legacy["legacy-status"] =
255
+ listFiles(localStatusDir, (name) => name.endsWith(".md")).length +
256
+ listFiles(globalStatusDir, (name) => name.endsWith(".md")).length;
257
+ legacy["legacy-recording"] = listFiles(globalRecordingsDir, (name) => name.endsWith(".txt") || name.endsWith(".log")).length;
258
+ legacy["legacy-attachment"] = attachmentFiles.length;
259
+ legacy["runtime-topology"] = existsSync(paths.runtimeTopologyPath) ? 1 : 0;
260
+ legacy["runtime-exchange"] = existsSync(paths.runtimeExchangePath) ? 1 : 0;
261
+ legacy["saved-state"] = existsSync(paths.statePath) ? 1 : 0;
262
+ legacy.metadata = existsSync(paths.metadataPath) ? 1 : 0;
263
+ for (const path of threadFiles)
264
+ pushJsonDiagnostic(diagnostics, "legacy-thread", path);
265
+ for (const path of messageLogs)
266
+ pushJsonlDiagnostics(diagnostics, "legacy-message-log", path);
267
+ for (const path of taskFiles)
268
+ pushJsonDiagnostic(diagnostics, "legacy-task", path);
269
+ for (const path of attachmentFiles)
270
+ pushJsonDiagnostic(diagnostics, "legacy-attachment", path);
271
+ if (existsSync(paths.statePath))
272
+ pushJsonDiagnostic(diagnostics, "saved-state", paths.statePath);
273
+ if (existsSync(paths.metadataPath))
274
+ pushJsonDiagnostic(diagnostics, "metadata", paths.metadataPath);
275
+ validateRuntimeYaml(diagnostics, paths);
276
+ for (const subdir of ["context", "history", "status"]) {
277
+ const source = join(paths.projectStateDir, subdir);
278
+ const target = join(paths.localAimuxDir, subdir);
279
+ if (existsSync(source) && hasEntries(source) && hasEntries(target)) {
280
+ diagnostics.push({
281
+ severity: "warning",
282
+ kind: `legacy-${subdir}`,
283
+ path: source,
284
+ message: `legacy global ${subdir} exists but local .aimux/${subdir} is not empty; explicit import will leave it untouched`,
285
+ });
286
+ }
287
+ }
288
+ const hasErrors = diagnostics.some((diagnostic) => diagnostic.severity === "error");
289
+ const hasLegacy = Object.entries(legacy).some(([kind, count]) => kind.startsWith("legacy-") && count > 0);
290
+ if (!hasErrors &&
291
+ hasLegacy &&
292
+ existsSync(paths.runtimeExchangePath) &&
293
+ runtimeExchangeHasRecords(paths.runtimeExchangePath)) {
294
+ diagnostics.push({
295
+ severity: "error",
296
+ kind: "runtime-exchange",
297
+ path: paths.runtimeExchangePath,
298
+ message: "runtime-exchange.yaml already contains authoritative records; migration import would overwrite them",
299
+ });
300
+ }
301
+ return {
302
+ version: 1,
303
+ generatedAt,
304
+ status: diagnostics.some((diagnostic) => diagnostic.severity === "error")
305
+ ? "blocked"
306
+ : hasLegacy
307
+ ? "needs_import"
308
+ : "clean",
309
+ project: {
310
+ repoRoot: paths.repoRoot,
311
+ projectId: paths.projectId,
312
+ projectStateDir: paths.projectStateDir,
313
+ localAimuxDir: paths.localAimuxDir,
314
+ },
315
+ authority: {
316
+ runtimeTopologyPath: paths.runtimeTopologyPath,
317
+ runtimeExchangePath: paths.runtimeExchangePath,
318
+ note: "runtime-topology.yaml and runtime-exchange.yaml are authoritative; legacy files are imported only by this explicit command.",
319
+ },
320
+ legacy,
321
+ diagnostics,
322
+ };
323
+ }
324
+ export function importRuntimeMigration(input = {}) {
325
+ const generatedAt = input.now ?? new Date().toISOString();
326
+ const report = buildRuntimeMigrationReport({ cwd: input.cwd, now: generatedAt });
327
+ const errors = report.diagnostics.filter((diagnostic) => diagnostic.severity === "error");
328
+ if (errors.length > 0) {
329
+ throw new Error(`runtime migration blocked by ${errors.length} diagnostic error(s)`);
330
+ }
331
+ const paths = getReadOnlyProjectPathsFor(input.cwd ?? process.cwd());
332
+ const globals = legacyGlobalFiles(paths);
333
+ const exchange = importRuntimeExchangeFromLegacyFiles({
334
+ now: generatedAt,
335
+ additionalHistoryPaths: globals.historyPaths,
336
+ additionalContextPaths: globals.contextPaths,
337
+ additionalStatusPaths: globals.statusPaths,
338
+ });
339
+ validateImportedExchange(exchange);
340
+ const backupDir = join(report.project.projectStateDir, "migration-backups", timestampForPath(new Date(generatedAt)));
341
+ const manifestPath = join(backupDir, "manifest.json");
342
+ mkdirSync(backupDir, { recursive: true });
343
+ const manifest = {
344
+ version: 1,
345
+ generatedAt,
346
+ report,
347
+ backups: [],
348
+ copiedDirs: [],
349
+ copiedFiles: [],
350
+ wrote: [],
351
+ };
352
+ try {
353
+ backupFile(manifest, "runtime-exchange", report.authority.runtimeExchangePath, backupDir);
354
+ for (const subdir of ["context", "history", "status"]) {
355
+ copyLegacyDir(manifest, `legacy-${subdir}`, join(report.project.projectStateDir, subdir), join(report.project.localAimuxDir, subdir));
356
+ }
357
+ manifest.wrote.push({ kind: "runtime-exchange", path: report.authority.runtimeExchangePath });
358
+ writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + "\n");
359
+ const writtenExchange = new RuntimeExchangeStore(report.authority.runtimeExchangePath).write(exchange);
360
+ writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + "\n");
361
+ return { exchange: writtenExchange, manifest };
362
+ }
363
+ catch (err) {
364
+ rollbackManifest(manifest);
365
+ throw err;
366
+ }
367
+ }
368
+ export function rollbackRuntimeMigration(manifestPath) {
369
+ const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
370
+ rollbackManifest(manifest);
371
+ return manifest;
372
+ }
373
+ export function renderRuntimeMigrationReport(report) {
374
+ return JSON.stringify(report, null, 2);
375
+ }
376
+ export function renderRuntimeMigrationImportResult(result) {
377
+ return JSON.stringify({
378
+ ok: true,
379
+ manifestPath: join(result.manifest.report.project.projectStateDir, "migration-backups", timestampForPath(new Date(result.manifest.generatedAt)), "manifest.json"),
380
+ copiedDirs: result.manifest.copiedDirs,
381
+ backups: result.manifest.backups,
382
+ counts: {
383
+ threads: result.exchange.threads.length,
384
+ messages: result.exchange.messages.length,
385
+ tasks: result.exchange.tasks.length,
386
+ planRefs: result.exchange.planRefs.length,
387
+ continuityRefs: result.exchange.continuityRefs.length,
388
+ attachmentRefs: result.exchange.attachmentRefs.length,
389
+ },
390
+ }, null, 2);
391
+ }
392
+ export function renderRuntimeMigrationRollbackResult(manifest) {
393
+ return JSON.stringify({
394
+ ok: true,
395
+ restored: manifest.backups,
396
+ removedCopiedDirs: manifest.copiedDirs,
397
+ }, null, 2);
398
+ }
@@ -1,11 +1,16 @@
1
1
  import { type ToolConfig } from "./config.js";
2
2
  import { type TmuxRuntimeManager, type TmuxTarget } from "./tmux/runtime-manager.js";
3
+ import { type SessionTeamMetadata } from "./team.js";
3
4
  export interface ForkSourceSnapshot {
4
5
  historyText?: string;
5
6
  liveText?: string;
6
7
  planText?: string;
7
8
  statusText?: string;
8
9
  }
10
+ export declare function buildAimuxAgentInstructions(opts?: {
11
+ sessionId?: string;
12
+ includeTeammateCreationInstructions?: boolean;
13
+ }): string;
9
14
  interface SessionBootstrapDependencies {
10
15
  tmuxRuntimeManager: TmuxRuntimeManager;
11
16
  getSessionLabel(sessionId: string): string | undefined;
@@ -22,8 +27,8 @@ export declare class SessionBootstrapService {
22
27
  worktreePath?: string;
23
28
  extraPreamble?: string;
24
29
  includeAimuxPreamble?: boolean;
30
+ team?: SessionTeamMetadata;
25
31
  }): string;
26
- buildInitialKickoffPrompt(sessionId: string, preamble: string): string;
27
32
  ensurePlanFile(sessionId: string, command: string, worktreePath?: string): void;
28
33
  composeToolArgs(toolCfg: {
29
34
  args: string[];
@@ -35,14 +40,11 @@ export declare class SessionBootstrapService {
35
40
  readForkSourceSnapshot(sourceSessionId: string): ForkSourceSnapshot;
36
41
  summarizeForkSourceActivity(snapshot: ForkSourceSnapshot): string | undefined;
37
42
  buildForkPreamble(sourceSessionId: string, targetSessionId: string): string;
38
- buildCodexForkKickoffPrompt(sourceSessionId: string, targetSessionId: string, snapshot: ForkSourceSnapshot, instruction?: string): string;
39
- buildCodexMigrationKickoffPrompt(sessionId: string, sourceWorktreePath: string, targetWorktreePath: string, snapshot: ForkSourceSnapshot, instruction?: string): string;
40
- deliverDetachedCodexKickoffPrompt(targetSessionId: string, kickoff: string, delayMs?: number): Promise<void>;
41
- waitForDetachedCodexInputReady(targetSessionId: string, target: TmuxTarget): Promise<boolean>;
43
+ buildCodexForkContinuityPreamble(sourceSessionId: string, targetSessionId: string, snapshot: ForkSourceSnapshot, instruction?: string): string;
44
+ buildCodexMigrationContinuityPreamble(sessionId: string, sourceWorktreePath: string, targetWorktreePath: string, snapshot: ForkSourceSnapshot, instruction?: string): string;
42
45
  seedForkArtifacts(sourceSessionId: string, targetSessionId: string, targetToolConfigKey: string): void;
43
46
  finalizePreamble(command: string, preamble: string): void;
44
47
  private isDefaultPlanContent;
45
- private paneLooksLikeCodexInputReady;
46
48
  }
47
49
  export declare function getToolResumeArgs(toolCfg: ToolConfig | undefined, backendSessionId: string | undefined): string[] | undefined;
48
50
  export {};