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
@@ -5,27 +5,57 @@ import { getContextDir, getHistoryDir, getPlansDir, getStatusDir } from "./paths
5
5
  import { readHistory } from "./context/history.js";
6
6
  import { debug, debugPreamble } from "./debug.js";
7
7
  import { listWorktrees as listAllWorktrees } from "./worktree.js";
8
- import { deliverTmuxPrompt } from "./agent-prompt-delivery.js";
8
+ export function buildAimuxAgentInstructions(opts = {}) {
9
+ const sessionLine = opts.sessionId ? `Your aimux session ID is ${opts.sessionId}.\n` : "";
10
+ const sessionPath = opts.sessionId ?? "{session-id}";
11
+ const includeTeammates = opts.includeTeammateCreationInstructions !== false;
12
+ const teamCoordinationLine = includeTeammates
13
+ ? "- Do not directly spawn or control other agents unless the user gives an explicit aimux CLI command.\n" +
14
+ "- Do not call aimux metadata APIs from inside an agent unless the user gives an explicit CLI/API command.\n"
15
+ : "- This session is already a teammate; do not create nested teammate teams.\n";
16
+ const delegationProtocol = includeTeammates
17
+ ? "When the user specifically asks for delegation, handoff, or teammate coordination, use explicit aimux CLI/API commands so the runtime exchange records the work. " +
18
+ 'For generic delegation or handoff records, create them with `aimux task assign` or the project service task endpoint with `status: "pending"`, `assignedBy`, `description`, `prompt`, and timestamps. '
19
+ : 'For generic delegation or handoff records, create them with `aimux task assign` or the project service task endpoint with `status: "pending"`, `assignedBy`, `description`, `prompt`, and timestamps. ';
20
+ return ("You are running inside aimux, an agent multiplexer for this repository. " +
21
+ "Aimux keeps long-lived Claude, Codex, and shell sessions in the main checkout and git worktrees so the user can switch between them, stop/restart them, and coordinate work.\n" +
22
+ sessionLine +
23
+ "\n" +
24
+ "## Aimux Model\n" +
25
+ "- The user controls aimux from the dashboard and tmux status/footer UI.\n" +
26
+ "- Agents are normal tool processes running inside aimux-managed tmux windows.\n" +
27
+ "- Broad cross-agent coordination uses aimux task, handoff, and thread commands backed by the runtime exchange.\n" +
28
+ teamCoordinationLine +
29
+ "\n" +
30
+ "## Shared Context Files\n" +
31
+ `- .aimux/context/${sessionPath}/live.md — recent conversation for this session\n` +
32
+ `- .aimux/context/${sessionPath}/summary.md — compacted history for this session\n` +
33
+ `- .aimux/plans/${sessionPath}.md — optional shared plan for long-running or delegated work\n` +
34
+ `- .aimux/status/${sessionPath}.md — optional brief status note for long-running or delegated work\n` +
35
+ "- .aimux/context/{other-session-id}/ — other agents' context when needed\n" +
36
+ "- .aimux/history/ — full raw conversation history (JSONL)\n" +
37
+ "\n" +
38
+ "Do not proactively create or edit `.aimux/plans/*` or `.aimux/status/*` for simple questions, read-only inspections, or one-shot tasks. " +
39
+ "Only update those files when the user asks for coordination/delegation, when the task is explicitly long-running, or when state would materially help another agent continue the work.\n" +
40
+ "\n" +
41
+ "## Delegation Protocol\n" +
42
+ delegationProtocol +
43
+ "Optional fields are `assignedTo` for a specific session ID and `tool` for coordination metadata. Treat tasks as shared handoff records for explicit manual coordination flows.\n" +
44
+ "When you accept a task, complete it and mark the task `done` with `result`, or `failed` with `error`.");
45
+ }
9
46
  export class SessionBootstrapService {
10
47
  deps;
11
48
  constructor(deps) {
12
49
  this.deps = deps;
13
50
  }
14
51
  buildSessionPreamble(opts) {
15
- const { sessionId, worktreePath, extraPreamble, includeAimuxPreamble = true } = opts;
52
+ const { sessionId, worktreePath, extraPreamble, includeAimuxPreamble = true, team } = opts;
16
53
  let preamble = "";
17
54
  if (includeAimuxPreamble) {
18
- preamble =
19
- "You are running inside aimux, an agent multiplexer. " +
20
- "Other agents may be working on this codebase simultaneously.\n" +
21
- `Your session ID is ${sessionId}.\n` +
22
- `- .aimux/context/${sessionId}/live.md — your recent conversation history\n` +
23
- `- .aimux/context/${sessionId}/summary.md — your compacted history\n` +
24
- `- .aimux/plans/${sessionId}.md — your shared working plan\n` +
25
- "- .aimux/sessions.json — all running agents\n" +
26
- "- Other agent contexts are in .aimux/context/{their-session-id}/. Check sessions.json for the list.\n" +
27
- "- Other agent plans are in .aimux/plans/{their-session-id}.md.\n" +
28
- "- .aimux/history/ — full raw conversation history (JSONL)";
55
+ preamble = buildAimuxAgentInstructions({
56
+ sessionId,
57
+ includeTeammateCreationInstructions: !team?.parentSessionId,
58
+ });
29
59
  }
30
60
  if (includeAimuxPreamble) {
31
61
  const globalAimuxMd = join(homedir(), "AIMUX.md");
@@ -64,78 +94,11 @@ export class SessionBootstrapService {
64
94
  preamble += `\n\nYou are working in a git worktree at ${worktreePath}. Stay in this directory.`;
65
95
  }
66
96
  }
67
- if (includeAimuxPreamble) {
68
- preamble +=
69
- "\n\n## Planning\n" +
70
- "Maintain a plan file at .aimux/plans/" +
71
- sessionId +
72
- ".md.\n" +
73
- "Keep it current enough that other agents can audit, annotate, or continue your work.\n" +
74
- "Use this structure:\n" +
75
- "- Goal\n" +
76
- "- Current Status\n" +
77
- "- Steps\n" +
78
- "- Notes\n" +
79
- "Update it when your plan materially changes or when you complete a step.";
80
- preamble +=
81
- "\n\n## Status\n" +
82
- "Maintain a status file at .aimux/status/" +
83
- sessionId +
84
- ".md (3-5 lines max).\n" +
85
- "Update it whenever your focus changes. Include:\n" +
86
- "- What you're currently working on\n" +
87
- "- Key files involved\n" +
88
- "- Current state (investigating, implementing, testing, blocked, etc.)";
89
- preamble +=
90
- "\n\n## Aimux Cross-Agent Delegation\n" +
91
- "IMPORTANT: This is the aimux delegation system for coordinating work across agents in this multiplexer. " +
92
- "It is separate from any built-in task/todo features in your own tool.\n\n" +
93
- "### Delegating work to another agent\n" +
94
- "When asked to delegate, hand off, or assign work to another agent, create a JSON file:\n" +
95
- "```\n" +
96
- ".aimux/tasks/{short-descriptive-name}.json\n" +
97
- "```\n" +
98
- "Contents:\n" +
99
- "```json\n" +
100
- '{\n "id": "{same as filename without .json}",\n "status": "pending",\n' +
101
- ' "assignedBy": "' +
102
- sessionId +
103
- '",\n' +
104
- ' "description": "Brief summary of the task",\n' +
105
- ' "prompt": "Detailed instructions for the other agent",\n' +
106
- ' "createdAt": "{ISO timestamp}",\n "updatedAt": "{ISO timestamp}"\n}\n' +
107
- "```\n" +
108
- "Optional fields: `assignedTo` (target session ID), `tool` (preferred tool type).\n" +
109
- "Aimux will automatically dispatch pending tasks to idle agents and inject the prompt.\n" +
110
- "Check .aimux/sessions.json for available agents and their session IDs.\n\n" +
111
- "### Receiving a delegated task\n" +
112
- "When you see `[AIMUX TASK ...]` in your input, another agent delegated work to you.\n" +
113
- "Complete the work, then update the task file:\n" +
114
- '- Success: set `status` to `"done"` and add a `result` field with a summary\n' +
115
- '- Failure: set `status` to `"failed"` and add an `error` field\n' +
116
- "The delegating agent will be notified automatically.";
117
- }
118
97
  if (extraPreamble) {
119
98
  preamble += (preamble ? "\n" : "") + extraPreamble;
120
99
  }
121
100
  return preamble;
122
101
  }
123
- buildInitialKickoffPrompt(sessionId, preamble) {
124
- const summaryPath = join(getContextDir(), sessionId, "summary.md");
125
- const livePath = join(getContextDir(), sessionId, "live.md");
126
- const planPath = join(getPlansDir(), `${sessionId}.md`);
127
- const statusPath = join(getStatusDir(), `${sessionId}.md`);
128
- return [
129
- `This is an aimux-managed session with session ID ${sessionId}.`,
130
- `Your shared session files live at ${summaryPath}, ${livePath}, ${planPath}, and ${statusPath}.`,
131
- "Read and follow these operating instructions for this session before continuing.",
132
- "Treat them as standing session rules and coordination context, not as a user request.",
133
- "",
134
- preamble.trim(),
135
- ]
136
- .filter(Boolean)
137
- .join("\n");
138
- }
139
102
  ensurePlanFile(sessionId, command, worktreePath) {
140
103
  try {
141
104
  const plansDir = getPlansDir();
@@ -172,7 +135,9 @@ export class SessionBootstrapService {
172
135
  return [...baseArgs, ...actionArgs, ...trailingArgs];
173
136
  }
174
137
  canResumeWithBackendSessionId(toolCfg, backendSessionId) {
175
- return Boolean(backendSessionId && toolCfg?.resumeArgs && toolCfg.resumeByBackendSessionId !== false);
138
+ return Boolean(backendSessionId &&
139
+ toolCfg?.resumeArgs?.some((arg) => arg.includes("{sessionId}")) &&
140
+ toolCfg.resumeByBackendSessionId !== false);
176
141
  }
177
142
  readForkSourceSnapshot(sourceSessionId) {
178
143
  const historyTurns = readHistory(sourceSessionId, { lastN: 20 });
@@ -293,7 +258,7 @@ export class SessionBootstrapService {
293
258
  .filter(Boolean)
294
259
  .join("\n");
295
260
  }
296
- buildCodexForkKickoffPrompt(sourceSessionId, targetSessionId, snapshot, instruction) {
261
+ buildCodexForkContinuityPreamble(sourceSessionId, targetSessionId, snapshot, instruction) {
297
262
  const activitySummary = this.summarizeForkSourceActivity(snapshot);
298
263
  const summaryPath = join(getContextDir(), targetSessionId, "summary.md");
299
264
  const livePath = join(getContextDir(), targetSessionId, "live.md");
@@ -310,7 +275,7 @@ export class SessionBootstrapService {
310
275
  .filter(Boolean)
311
276
  .join(" ");
312
277
  }
313
- buildCodexMigrationKickoffPrompt(sessionId, sourceWorktreePath, targetWorktreePath, snapshot, instruction) {
278
+ buildCodexMigrationContinuityPreamble(sessionId, sourceWorktreePath, targetWorktreePath, snapshot, instruction) {
314
279
  const activitySummary = this.summarizeForkSourceActivity(snapshot);
315
280
  const summaryPath = join(getContextDir(), sessionId, "summary.md");
316
281
  const livePath = join(getContextDir(), sessionId, "live.md");
@@ -329,65 +294,6 @@ export class SessionBootstrapService {
329
294
  .filter(Boolean)
330
295
  .join(" ");
331
296
  }
332
- deliverDetachedCodexKickoffPrompt(targetSessionId, kickoff, delayMs = 1800) {
333
- return new Promise((resolve) => {
334
- setTimeout(async () => {
335
- try {
336
- const target = this.deps.getSessionTmuxTarget(targetSessionId);
337
- if (target) {
338
- const ready = await this.waitForDetachedCodexInputReady(targetSessionId, target);
339
- if (!ready) {
340
- debug(`codex kickoff input prompt not ready for ${targetSessionId}; attempting best-effort delivery`, "fork");
341
- }
342
- await deliverTmuxPrompt({
343
- tmuxRuntimeManager: this.deps.tmuxRuntimeManager,
344
- target,
345
- prompt: kickoff,
346
- submit: true,
347
- isTargetCurrent: () => {
348
- const currentTarget = this.deps.getSessionTmuxTarget(targetSessionId);
349
- return Boolean(currentTarget && currentTarget.windowId === target.windowId);
350
- },
351
- });
352
- }
353
- }
354
- catch {
355
- // Continue even if kickoff automation fails; user can still recover manually.
356
- }
357
- finally {
358
- resolve();
359
- }
360
- }, delayMs);
361
- });
362
- }
363
- waitForDetachedCodexInputReady(targetSessionId, target) {
364
- return new Promise((resolve) => {
365
- const poll = (attempt = 1) => {
366
- if (attempt > 80) {
367
- resolve(false);
368
- return;
369
- }
370
- setTimeout(() => {
371
- try {
372
- const currentTarget = this.deps.getSessionTmuxTarget(targetSessionId);
373
- if (!currentTarget || currentTarget.windowId !== target.windowId) {
374
- resolve(false);
375
- return;
376
- }
377
- if (this.paneLooksLikeCodexInputReady(target)) {
378
- resolve(true);
379
- return;
380
- }
381
- }
382
- catch {
383
- // Keep polling; tmux capture can fail briefly while the window is starting.
384
- }
385
- poll(attempt + 1);
386
- }, attempt === 1 ? 150 : 250);
387
- };
388
- poll();
389
- });
390
- }
391
297
  seedForkArtifacts(sourceSessionId, targetSessionId, targetToolConfigKey) {
392
298
  const snapshot = this.readForkSourceSnapshot(sourceSessionId);
393
299
  const activitySummary = this.summarizeForkSourceActivity(snapshot);
@@ -458,26 +364,12 @@ export class SessionBootstrapService {
458
364
  normalized.includes("# Current Status\n\nTBD") &&
459
365
  normalized.includes("# Steps\n\n- [ ] TBD"));
460
366
  }
461
- paneLooksLikeCodexInputReady(target) {
462
- const pane = this.deps.tmuxRuntimeManager.captureTarget(target, { startLine: -40 });
463
- const lines = pane
464
- .split("\n")
465
- .map((line) => line.trim())
466
- .filter(Boolean);
467
- if (lines.length === 0)
468
- return false;
469
- const text = lines.join("\n");
470
- const hasCodexHeader = text.includes("OpenAI Codex") || /\bgpt-[\w.-]+\b/.test(text);
471
- if (!hasCodexHeader)
472
- return false;
473
- const recentLines = lines.slice(-12);
474
- return recentLines.some((line) => /^([›>]\s*$|[›>]\s+\S)/.test(line));
475
- }
476
367
  }
477
368
  export function getToolResumeArgs(toolCfg, backendSessionId) {
478
- if (!backendSessionId || !toolCfg?.resumeArgs || toolCfg.resumeByBackendSessionId === false) {
369
+ if (!backendSessionId ||
370
+ !toolCfg?.resumeArgs?.some((arg) => arg.includes("{sessionId}")) ||
371
+ toolCfg.resumeByBackendSessionId === false) {
479
372
  return undefined;
480
373
  }
481
374
  return toolCfg.resumeArgs.map((arg) => arg.replace("{sessionId}", backendSessionId));
482
375
  }
483
- //# sourceMappingURL=session-bootstrap.js.map
@@ -1,4 +1,5 @@
1
1
  import type { SessionStatus } from "./status-detector.js";
2
+ import type { SessionTeamMetadata } from "./team.js";
2
3
  export interface SessionTransport {
3
4
  id: string;
4
5
  command: string;
@@ -27,6 +28,7 @@ export declare class SessionRuntime {
27
28
  readonly transport: SessionTransport;
28
29
  private hooks;
29
30
  private readonly startedAt?;
31
+ team?: SessionTeamMetadata;
30
32
  constructor(transport: SessionTransport, startTime: number | undefined, hooks?: SessionRuntimeHooks);
31
33
  get id(): string;
32
34
  get command(): string;
@@ -2,6 +2,7 @@ export class SessionRuntime {
2
2
  transport;
3
3
  hooks;
4
4
  startedAt;
5
+ team;
5
6
  constructor(transport, startTime, hooks = {}) {
6
7
  this.transport = transport;
7
8
  this.hooks = hooks;
@@ -53,4 +54,3 @@ export class SessionRuntime {
53
54
  this.transport.destroy();
54
55
  }
55
56
  }
56
- //# sourceMappingURL=session-runtime.js.map
@@ -1,6 +1,9 @@
1
1
  import type { AgentActivityState, AgentAttentionState } from "./agent-events.js";
2
- import type { DashboardSessionStatus } from "./dashboard/index.js";
3
2
  import type { NotificationRecord } from "./notifications.js";
3
+ import type { PendingSessionActionKind } from "./pending-actions.js";
4
+ import type { SessionStatus } from "./status-detector.js";
5
+ export type SessionRawStatus = SessionStatus;
6
+ export type SessionPendingAction = PendingSessionActionKind;
4
7
  export type SessionLifecycleState = "creating" | "starting" | "running" | "idle" | "offline" | "stopping" | "graveyarding" | "error";
5
8
  export type SessionUserLabel = "working" | "needs_input" | "blocked" | "error" | "idle" | "offline" | "starting" | "stopping" | "graveyarding" | "done" | "interrupted";
6
9
  export type SessionUserAttention = "none" | "needs_input" | "blocked" | "error";
@@ -50,8 +53,8 @@ export interface SessionSemanticState {
50
53
  familyCount: number;
51
54
  }
52
55
  export interface DeriveSessionSemanticsInput {
53
- status: DashboardSessionStatus;
54
- pendingAction?: "creating" | "forking" | "migrating" | "starting" | "stopping" | "graveyarding" | "renaming";
56
+ status: SessionRawStatus;
57
+ pendingAction?: SessionPendingAction;
55
58
  activity?: AgentActivityState;
56
59
  attention?: AgentAttentionState;
57
60
  unseenCount?: number;
@@ -67,6 +70,11 @@ export interface DeriveSessionSemanticsInput {
67
70
  hasActiveTask?: boolean;
68
71
  }
69
72
  export declare function deriveSessionSemantics(input: DeriveSessionSemanticsInput): SessionSemanticState;
70
- export declare function sessionSemanticStatusLabel(semantic: SessionSemanticState, _fallbackStatus: DashboardSessionStatus): string;
73
+ export declare function sessionSemanticStatusLabel(semantic: SessionSemanticState, _fallbackStatus: SessionRawStatus): string;
74
+ export declare function sessionDisplayStatusLabel(input: {
75
+ status: SessionRawStatus;
76
+ pendingAction?: SessionPendingAction;
77
+ semantic?: SessionSemanticState;
78
+ }): string;
71
79
  export declare function sessionSemanticAttentionScore(semantic: SessionSemanticState): number;
72
80
  export declare function sessionSemanticCompactHint(semantic: SessionSemanticState): string | null;
@@ -199,10 +199,23 @@ function sessionSemanticCompactHintFromParts(input) {
199
199
  export function sessionSemanticStatusLabel(semantic, _fallbackStatus) {
200
200
  return semantic.presentation.statusLabel;
201
201
  }
202
+ const RAW_STATUS_LABELS = {
203
+ running: "running",
204
+ idle: "idle",
205
+ waiting: "thinking",
206
+ exited: "exited",
207
+ offline: "offline",
208
+ };
209
+ export function sessionDisplayStatusLabel(input) {
210
+ if (input.pendingAction)
211
+ return input.pendingAction;
212
+ if (input.semantic)
213
+ return sessionSemanticStatusLabel(input.semantic, input.status);
214
+ return RAW_STATUS_LABELS[input.status];
215
+ }
202
216
  export function sessionSemanticAttentionScore(semantic) {
203
217
  return semantic.presentation.attentionScore;
204
218
  }
205
219
  export function sessionSemanticCompactHint(semantic) {
206
220
  return semantic.presentation.compactHint;
207
221
  }
208
- //# sourceMappingURL=session-semantics.js.map
@@ -54,4 +54,3 @@ export function parseShellArgs(input) {
54
54
  }
55
55
  return args;
56
56
  }
57
- //# sourceMappingURL=shell-args.js.map
@@ -33,20 +33,29 @@ function buildZshIntegration() {
33
33
  ' printf "%s" "$endpoint"',
34
34
  "}",
35
35
  "",
36
+ "_aimux_json_escape() {",
37
+ ' printf "%s" "$1" | sed -e \'s/\\\\/\\\\\\\\/g\' -e \'s/"/\\\\"/g\'',
38
+ "}",
39
+ "",
36
40
  "_aimux_report_shell_state() {",
37
41
  ' [ -n "$AIMUX_SESSION_ID" ] || return 0',
38
42
  ' [ -n "$AIMUX_TOOL" ] || AIMUX_TOOL="shell"',
39
- ' [ "${AIMUX_LAST_SHELL_STATE:-}" = "$1" ] && return 0',
40
- ' local endpoint="" payload=""',
43
+ ' local state_key="$1:${2:-}"',
44
+ ' [ "${AIMUX_LAST_SHELL_STATE:-}" = "$state_key" ] && return 0',
45
+ ' local endpoint="" payload="" command_json="" escaped_command=""',
41
46
  ' endpoint="$(_aimux_read_endpoint)" || return 0',
42
- ' payload=$(printf \'{"state":"%s","sessionId":"%s","tool":"%s"}\' "$1" "$AIMUX_SESSION_ID" "$AIMUX_TOOL")',
43
- ' AIMUX_LAST_SHELL_STATE="$1"',
47
+ ' if [ -n "${2:-}" ]; then',
48
+ ' escaped_command="$(_aimux_json_escape "$2")"',
49
+ ' command_json=$(printf \',"command":"%s"\' "$escaped_command")',
50
+ " fi",
51
+ ' payload=$(printf \'{"state":"%s","sessionId":"%s","tool":"%s"%s}\' "$1" "$AIMUX_SESSION_ID" "$AIMUX_TOOL" "$command_json")',
52
+ ' AIMUX_LAST_SHELL_STATE="$state_key"',
44
53
  " command -v curl >/dev/null 2>&1 || return 0",
45
54
  ' { command nohup curl --silent --show-error --fail --max-time 1 --output /dev/null -H "content-type: application/json" --data "$payload" "$endpoint/shell-state" >/dev/null 2>&1 </dev/null || true; } &! ',
46
55
  "}",
47
56
  "",
48
57
  "_aimux_preexec() {",
49
- " _aimux_report_shell_state running",
58
+ ' _aimux_report_shell_state running "$1"',
50
59
  "}",
51
60
  "",
52
61
  "_aimux_precmd() {",
@@ -86,14 +95,23 @@ function buildBashIntegration() {
86
95
  ' printf "%s" "$endpoint"',
87
96
  "}",
88
97
  "",
98
+ "_aimux_json_escape() {",
99
+ ' printf "%s" "$1" | sed -e \'s/\\\\/\\\\\\\\/g\' -e \'s/"/\\\\"/g\'',
100
+ "}",
101
+ "",
89
102
  "_aimux_report_shell_state() {",
90
103
  ' [ -n "$AIMUX_SESSION_ID" ] || return 0',
91
104
  ' [ -n "$AIMUX_TOOL" ] || AIMUX_TOOL="shell"',
92
- ' [ "${AIMUX_LAST_SHELL_STATE:-}" = "$1" ] && return 0',
93
- ' local endpoint="" payload=""',
105
+ ' local state_key="$1:${2:-}"',
106
+ ' [ "${AIMUX_LAST_SHELL_STATE:-}" = "$state_key" ] && return 0',
107
+ ' local endpoint="" payload="" command_json="" escaped_command=""',
94
108
  ' endpoint="$(_aimux_read_endpoint)" || return 0',
95
- ' payload=$(printf \'{"state":"%s","sessionId":"%s","tool":"%s"}\' "$1" "$AIMUX_SESSION_ID" "$AIMUX_TOOL")',
96
- ' AIMUX_LAST_SHELL_STATE="$1"',
109
+ ' if [ -n "${2:-}" ]; then',
110
+ ' escaped_command="$(_aimux_json_escape "$2")"',
111
+ ' command_json=$(printf \',"command":"%s"\' "$escaped_command")',
112
+ " fi",
113
+ ' payload=$(printf \'{"state":"%s","sessionId":"%s","tool":"%s"%s}\' "$1" "$AIMUX_SESSION_ID" "$AIMUX_TOOL" "$command_json")',
114
+ ' AIMUX_LAST_SHELL_STATE="$state_key"',
97
115
  " command -v curl >/dev/null 2>&1 || return 0",
98
116
  ' command nohup curl --silent --show-error --fail --max-time 1 --output /dev/null -H "content-type: application/json" --data "$payload" "$endpoint/shell-state" >/dev/null 2>&1 </dev/null &',
99
117
  " disown $! 2>/dev/null || true",
@@ -101,7 +119,11 @@ function buildBashIntegration() {
101
119
  "",
102
120
  "_aimux_preexec_command() {",
103
121
  ' [ -n "$COMP_LINE" ] && return',
104
- " _aimux_report_shell_state running",
122
+ ' [ -n "${AIMUX_SHELL_HOOK_ACTIVE:-}" ] && return',
123
+ ' case "$BASH_COMMAND" in _aimux_*|trap\\ *) return ;; esac',
124
+ " AIMUX_SHELL_HOOK_ACTIVE=1",
125
+ ' _aimux_report_shell_state running "$BASH_COMMAND"',
126
+ " AIMUX_SHELL_HOOK_ACTIVE=",
105
127
  "}",
106
128
  "",
107
129
  "_aimux_prompt_command() {",
@@ -173,4 +195,3 @@ export function wrapInteractiveShellWithIntegration(opts) {
173
195
  env: opts.env,
174
196
  });
175
197
  }
176
- //# sourceMappingURL=shell-hooks.js.map
@@ -5,6 +5,7 @@ export interface ApplyShellStateInput {
5
5
  state: string;
6
6
  sessionId: string;
7
7
  tool?: string;
8
+ command?: string;
8
9
  tracker: AgentTracker;
9
10
  projectRoot?: string;
10
11
  emitAlert: (input: {
@@ -24,5 +25,6 @@ export interface ApplyShellStateResult {
24
25
  previousActivity?: AgentActivityState;
25
26
  nextActivity: AgentActivityState;
26
27
  notified: boolean;
28
+ command?: string;
27
29
  }
28
30
  export declare function applyShellStateTransition(input: ApplyShellStateInput): ApplyShellStateResult;
@@ -1,15 +1,32 @@
1
1
  import { loadConfig } from "./config.js";
2
- import { loadMetadataState } from "./metadata-store.js";
2
+ import { loadMetadataState, updateSessionMetadata } from "./metadata-store.js";
3
3
  import { clearNotifications } from "./notifications.js";
4
+ function normalizeShellCommand(command) {
5
+ const trimmed = command?.replace(/\s+/g, " ").trim();
6
+ if (!trimmed)
7
+ return undefined;
8
+ return trimmed.length > 500 ? `${trimmed.slice(0, 497)}...` : trimmed;
9
+ }
4
10
  export function applyShellStateTransition(input) {
5
11
  const state = input.state.trim();
6
12
  const sessionId = input.sessionId.trim();
7
13
  const tool = input.tool?.trim() || "shell";
14
+ const command = normalizeShellCommand(input.command);
8
15
  const previousActivity = loadMetadataState(input.projectRoot).sessions[sessionId]?.derived?.activity;
9
16
  let nextActivity;
10
17
  let notified = false;
11
18
  if (state === "running" || state === "command" || state === "busy") {
12
19
  nextActivity = "running";
20
+ if (command) {
21
+ updateSessionMetadata(sessionId, (current) => ({
22
+ ...current,
23
+ derived: {
24
+ ...(current.derived ?? {}),
25
+ shellCommand: command,
26
+ shellCommandState: "running",
27
+ },
28
+ }), input.projectRoot);
29
+ }
13
30
  if (previousActivity !== "running") {
14
31
  clearNotifications({ sessionId });
15
32
  input.tracker.setActivity(sessionId, "running", input.projectRoot);
@@ -19,6 +36,13 @@ export function applyShellStateTransition(input) {
19
36
  }
20
37
  else if (state === "prompt" || state === "idle") {
21
38
  nextActivity = "idle";
39
+ updateSessionMetadata(sessionId, (current) => ({
40
+ ...current,
41
+ derived: {
42
+ ...(current.derived ?? {}),
43
+ shellCommandState: "prompt",
44
+ },
45
+ }), input.projectRoot);
22
46
  if (previousActivity !== "idle") {
23
47
  input.tracker.setActivity(sessionId, "idle", input.projectRoot);
24
48
  input.tracker.setAttention(sessionId, "normal", input.projectRoot);
@@ -46,6 +70,6 @@ export function applyShellStateTransition(input) {
46
70
  previousActivity,
47
71
  nextActivity,
48
72
  notified,
73
+ command,
49
74
  };
50
75
  }
51
- //# sourceMappingURL=shell-state.js.map
@@ -64,4 +64,3 @@ export class StatusDetector {
64
64
  }
65
65
  }
66
66
  }
67
- //# sourceMappingURL=status-detector.js.map
@@ -1,10 +1,12 @@
1
1
  import type { AgentActivityState, AgentAttentionState } from "./agent-events.js";
2
2
  import type { SessionSemanticState } from "./session-semantics.js";
3
+ import type { SessionTeamMetadata } from "./team.js";
3
4
  export interface StatuslineSession {
4
5
  id: string;
5
6
  kind?: "agent" | "service";
6
7
  tool: string;
7
8
  label?: string;
9
+ launchCommandLine?: string;
8
10
  tmuxWindowId?: string;
9
11
  tmuxWindowIndex?: number;
10
12
  windowName?: string;
@@ -14,8 +16,9 @@ export interface StatuslineSession {
14
16
  active?: boolean;
15
17
  worktreePath?: string;
16
18
  semantic?: SessionSemanticState;
19
+ team?: SessionTeamMetadata;
17
20
  }
18
- export declare function compactSessionTitle(session: Pick<StatuslineSession, "kind" | "tool" | "label" | "role" | "id">): string;
21
+ export declare function compactSessionTitle(session: Pick<StatuslineSession, "kind" | "tool" | "label" | "launchCommandLine" | "role" | "id">): string;
19
22
  export interface StatuslineMetadataEntry {
20
23
  status?: {
21
24
  text: string;
@@ -78,6 +81,7 @@ export interface StatuslineData {
78
81
  project?: string;
79
82
  dashboardScreen?: "dashboard" | "plans" | "graveyard" | "activity" | "threads" | "notifications" | "workflow" | "help";
80
83
  sessions?: StatuslineSession[];
84
+ teammates?: StatuslineSession[];
81
85
  metadata?: Record<string, StatuslineMetadataEntry>;
82
86
  controlPlane?: {
83
87
  daemonAlive?: boolean;
@@ -101,7 +105,8 @@ export declare const DASHBOARD_SCREEN_TABS: Array<{
101
105
  }>;
102
106
  export declare function trim(text: string, max: number): string;
103
107
  export declare function normalizePath(path: string | undefined, projectRoot: string): string;
104
- export declare function sessionIdentity(session: Pick<StatuslineSession, "id" | "tool" | "label" | "role">): string;
108
+ export declare function findStatuslineSession(data: StatuslineData, sessionId: string | undefined): StatuslineSession | undefined;
109
+ export declare function sessionIdentity(session: Pick<StatuslineSession, "id" | "tool" | "label" | "launchCommandLine" | "role">): string;
105
110
  export declare function renderSemanticBadge(semantic: SessionSemanticState | undefined): string | null;
106
111
  export declare function renderSessionCompactHint(session: {
107
112
  semantic?: SessionSemanticState;
@@ -115,5 +120,8 @@ export declare function currentPathContext(currentPath: string | undefined): {
115
120
  export declare function resolveCurrentSessionId(data: StatuslineData, currentSession?: string, currentWindow?: string, currentWindowId?: string, currentPath?: string, projectRoot?: string): string | undefined;
116
121
  export declare function resolveExactCurrentSessionId(data: StatuslineData, currentSession?: string, currentWindow?: string, currentWindowId?: string, currentPath?: string, projectRoot?: string): string | undefined;
117
122
  export declare function resolveScopedSessions(data: StatuslineData, projectRoot: string, currentSession?: string, currentWindow?: string, currentWindowId?: string, currentPath?: string): ResolvedStatuslineSession[];
123
+ export declare function resolveFocusedTeammate(data: StatuslineData, projectRoot: string, currentSession?: string, currentWindow?: string, currentWindowId?: string, currentPath?: string): ResolvedStatuslineSession | null;
124
+ export declare function resolveFocusedTeammateGroup(data: StatuslineData, projectRoot: string, currentSession?: string, currentWindow?: string, currentWindowId?: string, currentPath?: string): ResolvedStatuslineSession[];
125
+ export declare function resolveCurrentTeammates(data: StatuslineData, projectRoot: string, currentSession?: string, currentWindow?: string, currentWindowId?: string, currentPath?: string): ResolvedStatuslineSession[];
118
126
  export declare function resolveSessionMetadata(data: StatuslineData, projectRoot: string, currentSession?: string, currentWindow?: string, currentWindowId?: string, currentPath?: string): StatuslineMetadataEntry | undefined;
119
127
  export declare function resolveExactSessionMetadata(data: StatuslineData, projectRoot: string, currentSession?: string, currentWindow?: string, currentWindowId?: string, currentPath?: string): StatuslineMetadataEntry | undefined;