aicodeman 1.40.0 → 1.41.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (351) hide show
  1. package/README.md +81 -13
  2. package/dist/attachment-registry.d.ts +2 -0
  3. package/dist/attachment-registry.d.ts.map +1 -1
  4. package/dist/attachment-registry.js +14 -3
  5. package/dist/attachment-registry.js.map +1 -1
  6. package/dist/cli-agent.d.ts +227 -0
  7. package/dist/cli-agent.d.ts.map +1 -0
  8. package/dist/cli-agent.js +771 -0
  9. package/dist/cli-agent.js.map +1 -0
  10. package/dist/cli.d.ts +25 -1
  11. package/dist/cli.d.ts.map +1 -1
  12. package/dist/cli.js +103 -41
  13. package/dist/cli.js.map +1 -1
  14. package/dist/codeman-credentials.d.ts +27 -0
  15. package/dist/codeman-credentials.d.ts.map +1 -0
  16. package/dist/codeman-credentials.js +66 -0
  17. package/dist/codeman-credentials.js.map +1 -0
  18. package/dist/config/buffer-limits.d.ts +9 -0
  19. package/dist/config/buffer-limits.d.ts.map +1 -1
  20. package/dist/config/buffer-limits.js +9 -0
  21. package/dist/config/buffer-limits.js.map +1 -1
  22. package/dist/config/cli-registry/schema.d.ts +10 -0
  23. package/dist/config/cli-registry/schema.d.ts.map +1 -1
  24. package/dist/config/cli-registry/schema.js +15 -0
  25. package/dist/config/cli-registry/schema.js.map +1 -1
  26. package/dist/config/cli-registry/stock.d.ts.map +1 -1
  27. package/dist/config/cli-registry/stock.js +47 -0
  28. package/dist/config/cli-registry/stock.js.map +1 -1
  29. package/dist/config/cli-registry/types.d.ts +47 -1
  30. package/dist/config/cli-registry/types.d.ts.map +1 -1
  31. package/dist/folder-listing.d.ts +94 -0
  32. package/dist/folder-listing.d.ts.map +1 -0
  33. package/dist/folder-listing.js +241 -0
  34. package/dist/folder-listing.js.map +1 -0
  35. package/dist/git-clone.d.ts.map +1 -1
  36. package/dist/git-clone.js +4 -0
  37. package/dist/git-clone.js.map +1 -1
  38. package/dist/hooks-config.d.ts +36 -16
  39. package/dist/hooks-config.d.ts.map +1 -1
  40. package/dist/hooks-config.js +45 -20
  41. package/dist/hooks-config.js.map +1 -1
  42. package/dist/html-view-capabilities.d.ts +54 -0
  43. package/dist/html-view-capabilities.d.ts.map +1 -0
  44. package/dist/html-view-capabilities.js +103 -0
  45. package/dist/html-view-capabilities.js.map +1 -0
  46. package/dist/image-watcher.d.ts.map +1 -1
  47. package/dist/image-watcher.js +6 -2
  48. package/dist/image-watcher.js.map +1 -1
  49. package/dist/mcp-server.d.ts +114 -0
  50. package/dist/mcp-server.d.ts.map +1 -0
  51. package/dist/mcp-server.js +917 -0
  52. package/dist/mcp-server.js.map +1 -0
  53. package/dist/mcp-sync-targets.d.ts +34 -0
  54. package/dist/mcp-sync-targets.d.ts.map +1 -0
  55. package/dist/mcp-sync-targets.js +55 -0
  56. package/dist/mcp-sync-targets.js.map +1 -0
  57. package/dist/mcp-sync.d.ts +7 -1
  58. package/dist/mcp-sync.d.ts.map +1 -1
  59. package/dist/mcp-sync.js +113 -6
  60. package/dist/mcp-sync.js.map +1 -1
  61. package/dist/mux-interface.d.ts +36 -1
  62. package/dist/mux-interface.d.ts.map +1 -1
  63. package/dist/remote-files.d.ts +37 -0
  64. package/dist/remote-files.d.ts.map +1 -1
  65. package/dist/remote-files.js +103 -0
  66. package/dist/remote-files.js.map +1 -1
  67. package/dist/remote-pane-history.d.ts +103 -0
  68. package/dist/remote-pane-history.d.ts.map +1 -0
  69. package/dist/remote-pane-history.js +258 -0
  70. package/dist/remote-pane-history.js.map +1 -0
  71. package/dist/remote-ssh-limiter.d.ts +16 -3
  72. package/dist/remote-ssh-limiter.d.ts.map +1 -1
  73. package/dist/remote-ssh-limiter.js +37 -6
  74. package/dist/remote-ssh-limiter.js.map +1 -1
  75. package/dist/session.d.ts +29 -1
  76. package/dist/session.d.ts.map +1 -1
  77. package/dist/session.js +63 -4
  78. package/dist/session.js.map +1 -1
  79. package/dist/subagent-watcher.d.ts.map +1 -1
  80. package/dist/subagent-watcher.js +29 -6
  81. package/dist/subagent-watcher.js.map +1 -1
  82. package/dist/tab-layout-legacy-order.d.ts.map +1 -1
  83. package/dist/tab-layout-legacy-order.js +72 -13
  84. package/dist/tab-layout-legacy-order.js.map +1 -1
  85. package/dist/tab-layout-service.d.ts +33 -2
  86. package/dist/tab-layout-service.d.ts.map +1 -1
  87. package/dist/tab-layout-service.js +102 -7
  88. package/dist/tab-layout-service.js.map +1 -1
  89. package/dist/tab-layout.d.ts +9 -0
  90. package/dist/tab-layout.d.ts.map +1 -1
  91. package/dist/tab-layout.js +15 -2
  92. package/dist/tab-layout.js.map +1 -1
  93. package/dist/templates/case-template.md +2 -0
  94. package/dist/tmux-manager.d.ts +76 -2
  95. package/dist/tmux-manager.d.ts.map +1 -1
  96. package/dist/tmux-manager.js +216 -40
  97. package/dist/tmux-manager.js.map +1 -1
  98. package/dist/tui/tui-client.d.ts +3 -17
  99. package/dist/tui/tui-client.d.ts.map +1 -1
  100. package/dist/tui/tui-client.js +3 -44
  101. package/dist/tui/tui-client.js.map +1 -1
  102. package/dist/types/session.d.ts +53 -0
  103. package/dist/types/session.d.ts.map +1 -1
  104. package/dist/types/session.js.map +1 -1
  105. package/dist/usage-telemetry.d.ts +44 -7
  106. package/dist/usage-telemetry.d.ts.map +1 -1
  107. package/dist/usage-telemetry.js +72 -7
  108. package/dist/usage-telemetry.js.map +1 -1
  109. package/dist/utils/index.d.ts +1 -0
  110. package/dist/utils/index.d.ts.map +1 -1
  111. package/dist/utils/index.js +1 -0
  112. package/dist/utils/index.js.map +1 -1
  113. package/dist/utils/process-exit-wait.d.ts +40 -0
  114. package/dist/utils/process-exit-wait.d.ts.map +1 -0
  115. package/dist/utils/process-exit-wait.js +68 -0
  116. package/dist/utils/process-exit-wait.js.map +1 -0
  117. package/dist/web/approval-inbox.d.ts +12 -0
  118. package/dist/web/approval-inbox.d.ts.map +1 -1
  119. package/dist/web/approval-inbox.js +1 -0
  120. package/dist/web/approval-inbox.js.map +1 -1
  121. package/dist/web/middleware/auth.d.ts.map +1 -1
  122. package/dist/web/middleware/auth.js +33 -0
  123. package/dist/web/middleware/auth.js.map +1 -1
  124. package/dist/web/paste-image-gc.d.ts +46 -6
  125. package/dist/web/paste-image-gc.d.ts.map +1 -1
  126. package/dist/web/paste-image-gc.js +106 -32
  127. package/dist/web/paste-image-gc.js.map +1 -1
  128. package/dist/web/ports/session-port.d.ts +8 -1
  129. package/dist/web/ports/session-port.d.ts.map +1 -1
  130. package/dist/web/public/admin-ui.js.gz +0 -0
  131. package/dist/web/public/api-client.c9b1cddc.js.gz +0 -0
  132. package/dist/web/public/app.24689381.js +43 -0
  133. package/dist/web/public/app.24689381.js.br +0 -0
  134. package/dist/web/public/app.24689381.js.gz +0 -0
  135. package/dist/web/public/approvals-ui.js +4 -0
  136. package/dist/web/public/approvals-ui.js.br +0 -0
  137. package/dist/web/public/approvals-ui.js.gz +0 -0
  138. package/dist/web/public/{constants.c0f8f9de.js → constants.17d77b65.js} +690 -35
  139. package/dist/web/public/constants.17d77b65.js.br +0 -0
  140. package/dist/web/public/constants.17d77b65.js.gz +0 -0
  141. package/dist/web/public/cron-ui.js.gz +0 -0
  142. package/dist/web/public/entrance-animations.js +490 -43
  143. package/dist/web/public/entrance-animations.js.br +0 -0
  144. package/dist/web/public/entrance-animations.js.gz +0 -0
  145. package/dist/web/public/gesture/gesture-codeman.js +112 -6
  146. package/dist/web/public/git-status-ui.js.gz +0 -0
  147. package/dist/web/public/home-sessions.js +2 -1
  148. package/dist/web/public/home-sessions.js.br +0 -0
  149. package/dist/web/public/home-sessions.js.gz +0 -0
  150. package/dist/web/public/host-wake-ui.js.gz +0 -0
  151. package/dist/web/public/i18n.9afd8e4d.js +2 -0
  152. package/dist/web/public/i18n.9afd8e4d.js.br +0 -0
  153. package/dist/web/public/i18n.9afd8e4d.js.gz +0 -0
  154. package/dist/web/public/image-input.9ed1d0d2.js +453 -0
  155. package/dist/web/public/image-input.9ed1d0d2.js.br +0 -0
  156. package/dist/web/public/image-input.9ed1d0d2.js.gz +0 -0
  157. package/dist/web/public/index.html +223 -46
  158. package/dist/web/public/index.html.br +0 -0
  159. package/dist/web/public/index.html.gz +0 -0
  160. package/dist/web/public/input-cjk.8bc46081.js.gz +0 -0
  161. package/dist/web/public/{keyboard-accessory.c1e7c7b7.js → keyboard-accessory.c458eea8.js} +115 -35
  162. package/dist/web/public/keyboard-accessory.c458eea8.js.br +0 -0
  163. package/dist/web/public/keyboard-accessory.c458eea8.js.gz +0 -0
  164. package/dist/web/public/mobile-handlers.0ef9c311.js.gz +0 -0
  165. package/dist/web/public/mobile-ime-preview.2dbaf262.js.gz +0 -0
  166. package/dist/web/public/mobile-overview.js +11 -2
  167. package/dist/web/public/mobile-overview.js.br +0 -0
  168. package/dist/web/public/mobile-overview.js.gz +0 -0
  169. package/dist/web/public/mobile.2dff1580.css +1 -0
  170. package/dist/web/public/mobile.2dff1580.css.br +0 -0
  171. package/dist/web/public/mobile.2dff1580.css.gz +0 -0
  172. package/dist/web/public/{notification-manager.50bb87d8.js → notification-manager.feb82c04.js} +19 -2
  173. package/dist/web/public/notification-manager.feb82c04.js.br +0 -0
  174. package/dist/web/public/notification-manager.feb82c04.js.gz +0 -0
  175. package/dist/web/public/orchestrator-panel.js.gz +0 -0
  176. package/dist/web/public/{panels-ui.4735dfc2.js → panels-ui.73ec0137.js} +87 -87
  177. package/dist/web/public/panels-ui.73ec0137.js.br +0 -0
  178. package/dist/web/public/panels-ui.73ec0137.js.gz +0 -0
  179. package/dist/web/public/ralph-panel.b350e2ef.js.gz +0 -0
  180. package/dist/web/public/ralph-wizard.b6c0dd19.js.gz +0 -0
  181. package/dist/web/public/readmymind-ui.js.gz +0 -0
  182. package/dist/web/public/reboot-restore-ui.js.gz +0 -0
  183. package/dist/web/public/respawn-ui.ff0dae4c.js.gz +0 -0
  184. package/dist/web/public/sanitize-html.e7147e76.js.gz +0 -0
  185. package/dist/web/public/session-lineage.js.gz +0 -0
  186. package/dist/web/public/{session-ui.f731602c.js → session-ui.dbc6819b.js} +33 -33
  187. package/dist/web/public/session-ui.dbc6819b.js.br +0 -0
  188. package/dist/web/public/session-ui.dbc6819b.js.gz +0 -0
  189. package/dist/web/public/settings-ui.81ac264e.js +97 -0
  190. package/dist/web/public/settings-ui.81ac264e.js.br +0 -0
  191. package/dist/web/public/settings-ui.81ac264e.js.gz +0 -0
  192. package/dist/web/public/spreadsheet-preview-worker.js +11 -0
  193. package/dist/web/public/spreadsheet-preview-worker.js.br +0 -0
  194. package/dist/web/public/spreadsheet-preview-worker.js.gz +0 -0
  195. package/dist/web/public/{spreadsheet-preview.af82fa2f.js → spreadsheet-preview.75c751de.js} +1 -1
  196. package/dist/web/public/spreadsheet-preview.75c751de.js.br +0 -0
  197. package/dist/web/public/spreadsheet-preview.75c751de.js.gz +0 -0
  198. package/dist/web/public/spreadsheet-xlsx-core.js +110 -0
  199. package/dist/web/public/spreadsheet-xlsx-core.js.br +0 -0
  200. package/dist/web/public/spreadsheet-xlsx-core.js.gz +0 -0
  201. package/dist/web/public/styles.900a28e4.css +1 -0
  202. package/dist/web/public/styles.900a28e4.css.br +0 -0
  203. package/dist/web/public/styles.900a28e4.css.gz +0 -0
  204. package/dist/web/public/{subagent-windows.e6ca799f.js → subagent-windows.07277a58.js} +7 -5
  205. package/dist/web/public/subagent-windows.07277a58.js.br +0 -0
  206. package/dist/web/public/subagent-windows.07277a58.js.gz +0 -0
  207. package/dist/web/public/sw.js +6 -2
  208. package/dist/web/public/sw.js.br +0 -0
  209. package/dist/web/public/sw.js.gz +0 -0
  210. package/dist/web/public/tab-layout-browser.2d6189f7.js +1 -0
  211. package/dist/web/public/tab-layout-browser.2d6189f7.js.br +0 -0
  212. package/dist/web/public/tab-layout-browser.2d6189f7.js.gz +0 -0
  213. package/dist/web/public/{tab-rail-resize.a5867793.js → tab-rail-resize.7157e0bd.js} +1 -1
  214. package/dist/web/public/tab-rail-resize.7157e0bd.js.br +0 -0
  215. package/dist/web/public/tab-rail-resize.7157e0bd.js.gz +0 -0
  216. package/dist/web/public/terminal-keycode229-recovery.af09f99a.js.gz +0 -0
  217. package/dist/web/public/terminal-split.js.gz +0 -0
  218. package/dist/web/public/terminal-tile.js +135 -38
  219. package/dist/web/public/terminal-tile.js.br +0 -0
  220. package/dist/web/public/terminal-tile.js.gz +0 -0
  221. package/dist/web/public/terminal-ui.858f5da5.js +2 -0
  222. package/dist/web/public/terminal-ui.858f5da5.js.br +0 -0
  223. package/dist/web/public/terminal-ui.858f5da5.js.gz +0 -0
  224. package/dist/web/public/tile-grid.js +769 -137
  225. package/dist/web/public/tile-grid.js.br +0 -0
  226. package/dist/web/public/tile-grid.js.gz +0 -0
  227. package/dist/web/public/ultracode-panel.js.gz +0 -0
  228. package/dist/web/public/ultracode-windows.js +9 -6
  229. package/dist/web/public/ultracode-windows.js.br +0 -0
  230. package/dist/web/public/ultracode-windows.js.gz +0 -0
  231. package/dist/web/public/vendor/dompurify.min.js.gz +0 -0
  232. package/dist/web/public/vendor/exceljs.min.js.gz +0 -0
  233. package/dist/web/public/vendor/fflate.min.js.gz +0 -0
  234. package/dist/web/public/vendor/marked.min.js.gz +0 -0
  235. package/dist/web/public/vendor/xterm-addon-fit.min.js.gz +0 -0
  236. package/dist/web/public/vendor/xterm-addon-serialize.min.js.gz +0 -0
  237. package/dist/web/public/vendor/xterm-addon-unicode11.min.js.gz +0 -0
  238. package/dist/web/public/vendor/xterm-addon-webgl.min.js.gz +0 -0
  239. package/dist/web/public/vendor/xterm-predictive-echo.ae5e3d5d.js.gz +0 -0
  240. package/dist/web/public/vendor/xterm-zerolag-input.0b69623c.js +4 -0
  241. package/dist/web/public/vendor/xterm-zerolag-input.0b69623c.js.br +0 -0
  242. package/dist/web/public/vendor/xterm-zerolag-input.0b69623c.js.gz +0 -0
  243. package/dist/web/public/vendor/xterm.css.gz +0 -0
  244. package/dist/web/public/vendor/xterm.min.js.gz +0 -0
  245. package/dist/web/public/voice-input.2342c37b.js.gz +0 -0
  246. package/dist/web/public/voice-pcm-worklet.js.gz +0 -0
  247. package/dist/web/public/webview-tabs.js +12 -0
  248. package/dist/web/public/webview-tabs.js.br +0 -0
  249. package/dist/web/public/webview-tabs.js.gz +0 -0
  250. package/dist/web/route-helpers.d.ts +8 -0
  251. package/dist/web/route-helpers.d.ts.map +1 -1
  252. package/dist/web/route-helpers.js +8 -0
  253. package/dist/web/route-helpers.js.map +1 -1
  254. package/dist/web/routes/admin-routes.d.ts.map +1 -1
  255. package/dist/web/routes/admin-routes.js +4 -1
  256. package/dist/web/routes/admin-routes.js.map +1 -1
  257. package/dist/web/routes/approval-routes.d.ts.map +1 -1
  258. package/dist/web/routes/approval-routes.js +6 -8
  259. package/dist/web/routes/approval-routes.js.map +1 -1
  260. package/dist/web/routes/case-routes.js +1 -1
  261. package/dist/web/routes/case-routes.js.map +1 -1
  262. package/dist/web/routes/cli-registry-routes.d.ts +23 -4
  263. package/dist/web/routes/cli-registry-routes.d.ts.map +1 -1
  264. package/dist/web/routes/cli-registry-routes.js +92 -7
  265. package/dist/web/routes/cli-registry-routes.js.map +1 -1
  266. package/dist/web/routes/file-routes.d.ts +46 -1
  267. package/dist/web/routes/file-routes.d.ts.map +1 -1
  268. package/dist/web/routes/file-routes.js +214 -27
  269. package/dist/web/routes/file-routes.js.map +1 -1
  270. package/dist/web/routes/hook-event-routes.d.ts.map +1 -1
  271. package/dist/web/routes/hook-event-routes.js +8 -1
  272. package/dist/web/routes/hook-event-routes.js.map +1 -1
  273. package/dist/web/routes/html-view-routes.d.ts +60 -0
  274. package/dist/web/routes/html-view-routes.d.ts.map +1 -0
  275. package/dist/web/routes/html-view-routes.js +288 -0
  276. package/dist/web/routes/html-view-routes.js.map +1 -0
  277. package/dist/web/routes/index.d.ts +1 -0
  278. package/dist/web/routes/index.d.ts.map +1 -1
  279. package/dist/web/routes/index.js +1 -0
  280. package/dist/web/routes/index.js.map +1 -1
  281. package/dist/web/routes/mcp-sync-routes.d.ts +7 -2
  282. package/dist/web/routes/mcp-sync-routes.d.ts.map +1 -1
  283. package/dist/web/routes/mcp-sync-routes.js +10 -3
  284. package/dist/web/routes/mcp-sync-routes.js.map +1 -1
  285. package/dist/web/routes/reboot-restore-routes.js +3 -3
  286. package/dist/web/routes/reboot-restore-routes.js.map +1 -1
  287. package/dist/web/routes/session-routes.d.ts +1 -0
  288. package/dist/web/routes/session-routes.d.ts.map +1 -1
  289. package/dist/web/routes/session-routes.js +345 -90
  290. package/dist/web/routes/session-routes.js.map +1 -1
  291. package/dist/web/routes/status-telemetry-routes.d.ts.map +1 -1
  292. package/dist/web/routes/status-telemetry-routes.js +16 -2
  293. package/dist/web/routes/status-telemetry-routes.js.map +1 -1
  294. package/dist/web/schemas.d.ts +32 -0
  295. package/dist/web/schemas.d.ts.map +1 -1
  296. package/dist/web/schemas.js +74 -0
  297. package/dist/web/schemas.js.map +1 -1
  298. package/dist/web/server.d.ts +7 -2
  299. package/dist/web/server.d.ts.map +1 -1
  300. package/dist/web/server.js +77 -24
  301. package/dist/web/server.js.map +1 -1
  302. package/dist/web/sse-events.d.ts +5 -2
  303. package/dist/web/sse-events.d.ts.map +1 -1
  304. package/dist/web/sse-events.js +5 -2
  305. package/dist/web/sse-events.js.map +1 -1
  306. package/package.json +5 -4
  307. package/skills/codeman/SKILL.md +30 -7
  308. package/README.zh-CN.md +0 -1147
  309. package/dist/web/public/app.abadc970.js +0 -43
  310. package/dist/web/public/app.abadc970.js.br +0 -0
  311. package/dist/web/public/app.abadc970.js.gz +0 -0
  312. package/dist/web/public/constants.c0f8f9de.js.br +0 -0
  313. package/dist/web/public/constants.c0f8f9de.js.gz +0 -0
  314. package/dist/web/public/i18n.a31747a9.js +0 -2
  315. package/dist/web/public/i18n.a31747a9.js.br +0 -0
  316. package/dist/web/public/i18n.a31747a9.js.gz +0 -0
  317. package/dist/web/public/image-input.898a538b.js +0 -281
  318. package/dist/web/public/image-input.898a538b.js.br +0 -0
  319. package/dist/web/public/image-input.898a538b.js.gz +0 -0
  320. package/dist/web/public/keyboard-accessory.c1e7c7b7.js.br +0 -0
  321. package/dist/web/public/keyboard-accessory.c1e7c7b7.js.gz +0 -0
  322. package/dist/web/public/mobile.111b187d.css +0 -1
  323. package/dist/web/public/mobile.111b187d.css.br +0 -0
  324. package/dist/web/public/mobile.111b187d.css.gz +0 -0
  325. package/dist/web/public/notification-manager.50bb87d8.js.br +0 -0
  326. package/dist/web/public/notification-manager.50bb87d8.js.gz +0 -0
  327. package/dist/web/public/panels-ui.4735dfc2.js.br +0 -0
  328. package/dist/web/public/panels-ui.4735dfc2.js.gz +0 -0
  329. package/dist/web/public/session-ui.f731602c.js.br +0 -0
  330. package/dist/web/public/session-ui.f731602c.js.gz +0 -0
  331. package/dist/web/public/settings-ui.a97ab16f.js +0 -97
  332. package/dist/web/public/settings-ui.a97ab16f.js.br +0 -0
  333. package/dist/web/public/settings-ui.a97ab16f.js.gz +0 -0
  334. package/dist/web/public/spreadsheet-preview.af82fa2f.js.br +0 -0
  335. package/dist/web/public/spreadsheet-preview.af82fa2f.js.gz +0 -0
  336. package/dist/web/public/styles.8ee12666.css +0 -1
  337. package/dist/web/public/styles.8ee12666.css.br +0 -0
  338. package/dist/web/public/styles.8ee12666.css.gz +0 -0
  339. package/dist/web/public/subagent-windows.e6ca799f.js.br +0 -0
  340. package/dist/web/public/subagent-windows.e6ca799f.js.gz +0 -0
  341. package/dist/web/public/tab-layout-browser.065fcba4.js +0 -1
  342. package/dist/web/public/tab-layout-browser.065fcba4.js.br +0 -0
  343. package/dist/web/public/tab-layout-browser.065fcba4.js.gz +0 -0
  344. package/dist/web/public/tab-rail-resize.a5867793.js.br +0 -0
  345. package/dist/web/public/tab-rail-resize.a5867793.js.gz +0 -0
  346. package/dist/web/public/terminal-ui.5059b30e.js +0 -2
  347. package/dist/web/public/terminal-ui.5059b30e.js.br +0 -0
  348. package/dist/web/public/terminal-ui.5059b30e.js.gz +0 -0
  349. package/dist/web/public/vendor/xterm-zerolag-input.bbb5f84c.js +0 -4
  350. package/dist/web/public/vendor/xterm-zerolag-input.bbb5f84c.js.br +0 -0
  351. package/dist/web/public/vendor/xterm-zerolag-input.bbb5f84c.js.gz +0 -0
package/README.md CHANGED
@@ -19,16 +19,12 @@
19
19
  <a href="https://github.com/Ark0N/Codeman/commits/master"><img src="https://img.shields.io/github/commit-activity/t/Ark0N/Codeman?style=flat-square&color=1e3a5f" alt="Total commits"></a>
20
20
  </p>
21
21
 
22
- <p align="center">
23
- ⭐ <strong>Like Codeman? <a href="https://github.com/Ark0N/Codeman">Give it a star on GitHub!</a></strong> It takes one click and helps more people find the project. ⭐
24
- </p>
25
-
26
22
  <p align="center">
27
23
  <strong>English</strong> &bull; <a href="README.zh-CN.md">简体中文</a>
28
24
  </p>
29
25
 
30
26
  <p align="center">
31
- <img src="docs/images/subagent-demo-20260724.gif" alt="Codeman — parallel subagent visualization" width="900">
27
+ <img src="docs/images/tiles-crt-stats-20261010.gif" alt="Codeman tile grid: six live agents (DeepSeek Harness, Claude Code, Pi, Codex, OpenCode and a shell) powering on and off with the CRT animation, with the live header strip showing CPU, memory and Claude plan usage" width="800">
32
28
  </p>
33
29
 
34
30
  **Codeman** is a self-hosted mission control for AI coding agents. It spawns Claude Code, OpenCode, Codex, Antigravity, Gemini, Pi, Grok, DeepSeek Harness, or OMP inside persistent tmux sessions, streams the real terminal to any browser, and keeps agents productive after you walk away: it re-prompts on idle, resumes when a usage limit resets, runs scheduled jobs, and shows every background agent working in real time.
@@ -54,7 +50,7 @@ The installer asks before every system change, and re-running the same line upda
54
50
  - **Self-hosted and private** - loopback-only by default, MIT licensed, no telemetry, runs entirely on your machine
55
51
 
56
52
  <p align="center">
57
- <img src="docs/images/codeman-tour-20260724.png" alt="Codeman dashboard tour: session tabs per case, one-click Run for new agents, live plan usage in the header" width="900">
53
+ <img src="docs/images/codeman-tour-20261010.png" alt="Codeman dashboard tour: session tabs per case, one-click Run for new agents, live plan usage in the header" width="900">
58
54
  </p>
59
55
 
60
56
  ---
@@ -426,7 +422,7 @@ The title is templated into the served HTML on first byte, so it's correct from
426
422
  ### Tab Alerts
427
423
 
428
424
  <p align="center">
429
- <img src="docs/images/tab-alerts-glow-20260815.gif" alt="Session tabs: a regular active tab beside a yellow waiting-for-input tab and a red needs-decision tab, both with a breathing glow" width="900">
425
+ <a href="docs/images/codeman-tab-states-20261010.png"><img src="docs/images/codeman-tab-states-20261010.gif" alt="Tab states, annotated: a working tab with a spinning green ring, a red tab blocked on the agent's question shown below it, and a yellow tab whose turn is done, both alert tabs breathing" width="900"></a>
430
426
  </p>
431
427
 
432
428
  Every tab tells you its state at a glance. A running session keeps its green status dot. When a session stops and waits for input, its tab turns **yellow**: steady ring, tinted background, yellow dot, with a slow breathing glow on top. When a permission prompt or question is **blocking** the agent, the tab turns **red** with a faster pulse. The base tint never blinks off, so even a split-second glance (or a screenshot) reads the true state; the ring stays visible while the tab is selected, and a page reload re-arms pending alerts from the server, so a blocked session can never hide behind a fresh-looking tab.
@@ -737,19 +733,23 @@ For AI agents and automation that control Codeman without a browser: an agent th
737
733
 
738
734
  ### The agent skill (start here)
739
735
 
740
- Everything in this section also ships as a **Claude Code skill** in [`skills/codeman`](skills/codeman/SKILL.md). Install it once and you never paste API docs into a prompt again. You ask for what you want in plain English, and the agent already sitting inside a Codeman session loads the recipes and drives the API itself.
736
+ Everything in this section also ships as an **agent skill**, [`skills/codeman`](skills/codeman/SKILL.md), in the `SKILL.md` format Claude Code, Codex, Gemini CLI, OpenCode, Grok, OMP and most other agent CLIs read. Install it once and you never paste API docs into a prompt again. You ask for what you want in plain English, and the agent already sitting inside a Codeman session loads the recipes and drives the API itself.
737
+
738
+ <p align="center">
739
+ <a href="docs/images/codeman-skill-crt-20261010.png"><img src="docs/images/codeman-skill-crt-20261010.gif" alt="A real codeman skill run: one short prompt typed into Claude Code, the tile grid powering on, then a DeepSeek Harness worker on a local qwen model and a Claude Code worker powering on as new tiles, with lineage lines from the lead to both" width="900"></a>
740
+ </p>
741
741
 
742
742
  #### Step 1: install it
743
743
 
744
744
  | How | Command | Scope |
745
745
  | -------------- | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
746
- | Skills CLI | `npx skills add Ark0N/Codeman --skill codeman -g` | Global, works for any skills-aware agent |
746
+ | Skills CLI | `npx skills add Ark0N/Codeman --skill codeman -g` | Global, for any skills-aware agent ([skills.sh](https://skills.sh)); the way to give it to pi |
747
747
  | Claude Code plugin | `/plugin marketplace add Ark0N/Codeman` then `/plugin install codeman@codeman` | Global, through Claude Code's plugin manager; `/plugin update codeman` follows releases. Pick this OR a `codeman skill install`, not both: a Claude Code with both lists the skill twice (`codeman` and `codeman:codeman`) |
748
748
  | Bundled CLI | `codeman skill install` | Global (`~/.claude/skills/codeman`), for npm installs that never cloned the repo |
749
- | Bundled CLI | `codeman skill install --case <name>` | One case only |
750
- | Web UI | App Settings → Agents & CLIs → Claude → **Agent Skill** | Auto-injects into each case on Claude session create (`agentSkillEnabled`, SYNCED, default off) |
749
+ | Bundled CLI | `codeman skill install --case <name> [--mode <mode>]` | One case only; `--mode codex` (or any other run mode) writes it where that CLI looks for skills |
750
+ | Web UI | App Settings → Agents & CLIs → All agent CLIs → **Codeman Agent Skill** | Auto-injects into each case on session create, where that session's CLI looks: `.claude/skills/` for Claude Code, `.agents/skills/` for Codex, Gemini CLI, OpenCode, Antigravity, Grok, DeepSeek and OMP; not pi, whose project skills trigger a trust prompt (`agentSkillEnabled`, SYNCED, default off) |
751
751
 
752
- `codeman skill uninstall [--case <name>]` reverses the CLI installs, and never touches a `skills/codeman` you wrote yourself.
752
+ `codeman skill uninstall [--case <name>]` reverses the CLI installs (with `--case`, every Codeman-managed copy in that case, whichever CLI's directory it sits in), and never touches a `skills/codeman` you wrote yourself.
753
753
 
754
754
  #### Step 2: ask for things
755
755
 
@@ -802,7 +802,7 @@ Every recipe in there was verified against a live server, and the comments recor
802
802
  - **It self-gates.** Outside a Codeman session (`CODEMAN_MUX` unset) the skill refuses to act and does not guess an API URL, so a global install costs an unrelated Claude Code session nothing.
803
803
  - **It is deliberately conservative.** Unprompted, it may only spawn sessions, prompt them, and delete ones **it created in that same conversation, by exact id**, through a fail-closed guard that refuses to delete the agent's own session. Deleting a case (which erases a real directory of your code), bulk kills, respawn/ralph/cron/orchestrator changes and settings writes all require you to ask, naming the target.
804
804
 
805
- ⚠️ Turning `agentSkillEnabled` back off **does not remove already-injected copies** (a create-time sweep would yank the skill out from under other live sessions sharing that `.claude/` dir). Remove them per case with `codeman skill uninstall --case <name>`.
805
+ ⚠️ Turning `agentSkillEnabled` back off **does not remove already-injected copies** (a create-time sweep would yank the skill out from under other live sessions sharing that workspace). Remove them per case with `codeman skill uninstall --case <name>`.
806
806
 
807
807
  ---
808
808
 
@@ -944,6 +944,74 @@ codeman tui --list # numbered session list (plain tex
944
944
  codeman tui 3 # attach to session 3 of that list
945
945
  ```
946
946
 
947
+ ### `codeman agent` — session-to-session verbs in every CLI mode
948
+
949
+ The skill above drives the API with `curl` and `jq` from a preamble Codeman seeds per session. Where it does not reach (a `pi` or `shell` session, a machine without `jq`), the same environment is still there (`CODEMAN_MUX=1`, `CODEMAN_SESSION_ID`, `CODEMAN_API_URL` are exported into every pane), so `codeman agent` packages the same verbs as commands. It is a thin client over the endpoints listed under [API](#api): no new route, no new transport, auth and ownership unchanged. One line in a case's `AGENTS.md` is enough: *"other sessions: `codeman agent --help`"*.
950
+
951
+ ```bash
952
+ codeman agent ls # sessions; * marks this one
953
+ SID=$(codeman agent spawn scratch-1 --mode claude) # quick-start + wait for the composer where the mode has a ready mark
954
+ codeman agent send "$SID" 'review src/, then say DONE' --until stop,exit --timeout 300000 # --wait = default signal set
955
+ codeman agent read "$SID" # last answer (as the server reads it for that mode)
956
+ codeman agent read "$SID" --tail 3000 # terminal tail, ANSI stripped (every mode)
957
+ codeman agent send "$SID" 'run the tests, then print WORKDONE followed by _4711' # hook-less modes (opencode, pi, …): ask for the marker in halves …
958
+ codeman agent wait "$SID" --match WORKDONE_4711 # … and wait on the joined form, which the prompt's echo never contains
959
+ codeman agent interrupt "$SID" # a bare ESC, conversation intact
960
+ codeman agent rm "$SID" # any session except this one
961
+ ```
962
+
963
+ Rules the commands enforce rather than document: they refuse outside a Codeman session and never guess a URL; `send` transmits printable text plus Enter only (a control byte such as `Ctrl+C` is `app_exit` in opencode — ESC exists solely as `interrupt`, which never appends Enter); `rm` refuses an empty id, an unprovable self id and a prefix match in either direction. Ids may be the 8-character prefixes `ls` prints (resolved through the list; an ambiguous prefix refuses, anything shorter than 8 characters refuses on every verb). A prompt that starts with `-` goes after `--` (`send "$SID" -- "- fix the bug"`). The echo of the prompt you sent is output too: a `--match` marker that appears verbatim in the prompt matches at once, before the worker has done anything, so the prompt asks for it in halves. A remote session whose host is asleep answers a fire-and-forget `send` with `buffered` (Codeman wakes the host and types the prompt once the pane is back) or `dropped` (over the wake buffer's cap, nothing will be typed: exit `1`). Exit codes: `0` delivered/matched/signal, `1` error, `2` timeout, `3` the worker exited or the wait ended without an answer (`delivered:false`, `ended:true`), `4` refused. `spawn` prints the id alone on stdout (prose goes to stderr), so `SID=$(…)` captures exactly the id. `--json` prints the envelope's `data` for every verb. `--until stop` on a mode without hook signals is the server's 400, passed through — the marker path (`--match`) is the answer there, exactly as for the skill.
964
+
965
+ ### MCP server (`codeman mcp`): drive Codeman from any MCP client
966
+
967
+ `codeman mcp` is a [Model Context Protocol](https://modelcontextprotocol.io) server on stdio, so any MCP client (Claude Code, Claude Desktop, Codex, Gemini CLI, Cursor, ...) can start Codeman sessions in any installed agent CLI, prompt them, wait for them, read their answers and clean up, from inside Codeman or from outside it. Like `codeman agent`, it is a client of the HTTP API: no new route, auth and ownership unchanged.
968
+
969
+ ```bash
970
+ # Claude Code
971
+ claude mcp add codeman -e CODEMAN_API_URL=https://127.0.0.1:3000 -- codeman mcp
972
+ ```
973
+
974
+ ```json
975
+ {
976
+ "mcpServers": {
977
+ "codeman": {
978
+ "command": "codeman",
979
+ "args": ["mcp"],
980
+ "env": { "CODEMAN_API_URL": "https://127.0.0.1:3000" }
981
+ }
982
+ }
983
+ }
984
+ ```
985
+
986
+ ```toml
987
+ # Codex (~/.codex/config.toml): raise the 60 s default tool timeout for long waits
988
+ [mcp_servers.codeman]
989
+ command = "codeman"
990
+ args = ["mcp"]
991
+ env = { CODEMAN_API_URL = "https://127.0.0.1:3000" }
992
+ env_vars = ["CODEMAN_MUX", "CODEMAN_SESSION_ID"] # Codex passes MCP servers a minimal env; these let it know the Codeman session it runs in
993
+ tool_timeout_sec = 120
994
+ ```
995
+
996
+ The JSON form is what Claude Desktop, Cursor and Gemini CLI take. Add `"CODEMAN_PASSWORD"` to `env` when the server has a password (or let it read the data dir's `.env`). Without the `codeman` command on PATH (a git checkout run without the installer), use `node /path/to/Codeman/dist/index.js mcp`.
997
+
998
+ | Tool | Does |
999
+ | ---- | ---- |
1000
+ | `list_sessions` | Every session you can see, with its run mode, status, folder, and whether these tools may prompt it |
1001
+ | `start_session` | A new worker in a case (a fresh scratch folder, or an existing case) in any installed CLI; waits until it can take a prompt |
1002
+ | `send_prompt` | Types a one-line prompt and presses Enter; optionally waits for the end of the turn |
1003
+ | `wait_for_session` | Waits for a signal (`stop`, `blocked`, `idle`, `working`, `exit`) or a literal marker in the output |
1004
+ | `read_output` | The last answer, the whole conversation, or the last bytes of the terminal |
1005
+ | `interrupt_session` | One Escape: stops the current turn, keeps the conversation |
1006
+ | `delete_session` | Closes a worker (its case folder stays) |
1007
+
1008
+ Rules the server enforces rather than documents:
1009
+
1010
+ - **It never guesses a server.** The URL comes from `CODEMAN_API_URL` or `--url`; without one it still starts and lists its tools, and every call says how to configure it.
1011
+ - **Only its own sessions.** Prompting, interrupting and deleting are limited to sessions this server started (and, run inside a Codeman session, that session's own workers). Listing, reading and waiting work on everything. `codeman mcp --allow-any-session` lifts the limit, for a user who wants an assistant to drive their existing tabs. It never acts on the session it runs in.
1012
+ - **Waits fit the client.** A wait defaults to 45 s (Codex cuts MCP tools off at 60 s by default) and is capped at 600 s; `timed_out` / `still_working` means call again.
1013
+ - **Both protocol eras.** It answers the 2026-07-28 revision (per-request `_meta`, `server/discover`) and the `initialize` handshake of 2024-11-05 to 2025-11-25.
1014
+
947
1015
  ### Hooks (events flowing _back_ to Codeman)
948
1016
 
949
1017
  Codeman registers Claude Code hooks that `POST /api/hook-event` (`permission_prompt`, `idle_prompt`, `stop`, `task_completed`, …) so the dashboard reacts in real time. This endpoint is auth-exempt on loopback but, under a managed tunnel, requires the `X-Codeman-Hook-Secret` header (read it from `$CODEMAN_HOOK_SECRET_FILE`). You normally don't call this by hand — Codeman wires it up — but it's how the autonomy layers "see" what the agent is doing.
@@ -71,6 +71,8 @@ declare class AttachmentRegistry {
71
71
  clearSession(sessionId: string): void;
72
72
  }
73
73
  export declare const attachmentRegistry: AttachmentRegistry;
74
+ /** Every extension {@link isSupportedAttachmentExtension} accepts (lowercase, no dot). */
75
+ export declare function supportedAttachmentExtensions(): string[];
74
76
  export declare function isSupportedAttachmentExtension(extension: string): boolean;
75
77
  export declare function getAttachmentType(extension: string): AttachmentDetectedType;
76
78
  export declare function buildAttachmentRoutes(sessionId: string, attachmentId: string): {
@@ -1 +1 @@
1
- {"version":3,"file":"attachment-registry.d.ts","sourceRoot":"","sources":["../src/attachment-registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,EAA2C,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC9F,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,MAAM,CAAiD,CAAC;AAC9G,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,MAAM,CAS1D,CAAC;AAEH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,0BAA0B,EAAE,WAAW,CAAC,MAAM,CAAuB,CAAC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AG,gBAAgB,GAAG,SAAS;IASjF,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;CAGtC;AAED,eAAO,MAAM,kBAAkB,oBAA2B,CAAC;AAE3D,0FAA0F;AAC1F,wBAAgB,6BAA6B,IAAI,MAAM,EAAE,CAExD;AAED,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEzE;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,sBAAsB,CAa3E;AAED,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,GACnB;IACD,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB,CAOA;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAEvF;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,gBAAgB,GAAG,4BAA4B,CAe9F;AAED,sDAAsD;AACtD,MAAM,WAAW,iCAAiC;IAChD;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;;;;OAQG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC,CAAC;CAClE;AAoFD,wBAAsB,0BAA0B,CAC9C,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,iCAAsC,GAC9C,OAAO,CAAC,4BAA4B,CAAC,CAoFvC"}
@@ -8,7 +8,8 @@
8
8
  import { randomUUID } from 'node:crypto';
9
9
  import { realpathSync } from 'node:fs';
10
10
  import fs from 'node:fs/promises';
11
- import { basename, extname, isAbsolute } from 'node:path';
11
+ import { homedir } from 'node:os';
12
+ import { basename, extname, isAbsolute, join } from 'node:path';
12
13
  import { isBlockedAttachmentPath, isUnderTree, loadAttachmentGuardConfig } from './config/attachment-guard.js';
13
14
  import { EDITABLE_EXTENSIONS } from './config/file-editing.js';
14
15
  import { validateSessionFilePath } from './web/route-helpers.js';
@@ -111,6 +112,10 @@ class AttachmentRegistry {
111
112
  }
112
113
  }
113
114
  export const attachmentRegistry = new AttachmentRegistry();
115
+ /** Every extension {@link isSupportedAttachmentExtension} accepts (lowercase, no dot). */
116
+ export function supportedAttachmentExtensions() {
117
+ return [...SUPPORTED_ATTACHMENT_EXTENSIONS];
118
+ }
114
119
  export function isSupportedAttachmentExtension(extension) {
115
120
  return SUPPORTED_ATTACHMENT_EXTENSIONS.has(extension.toLowerCase().replace(/^\./, ''));
116
121
  }
@@ -220,12 +225,18 @@ async function resolveRemoteAttachment(requestedPath, remote, sessionWorkingDir,
220
225
  };
221
226
  }
222
227
  export async function registerExternalAttachment(sessionId, requestedPath, options = {}) {
223
- if (!requestedPath || !isAbsolute(requestedPath)) {
228
+ // `~/…` is the home of the session's HOST: expanded here for a local session,
229
+ // and by the probe on the remote host for a remote one (`buildRemoteProbeCommand`),
230
+ // whose home this server does not know. A clicked terminal link sends it as is
231
+ // (Claude Code echoes attachments as `~/…`). Every guard below runs on the
232
+ // resolved absolute path either way.
233
+ const homeRelative = typeof requestedPath === 'string' && requestedPath.startsWith('~/');
234
+ if (!requestedPath || (!isAbsolute(requestedPath) && !homeRelative)) {
224
235
  throw new AttachmentRegistrationError('Attachment path must be an absolute local path');
225
236
  }
226
237
  const resolved = await (options.remote
227
238
  ? resolveRemoteAttachment(requestedPath, options.remote, options.sessionWorkingDir, options.remoteProbes)
228
- : resolveLocalAttachment(requestedPath));
239
+ : resolveLocalAttachment(homeRelative ? join(homedir(), requestedPath.slice(2)) : requestedPath));
229
240
  // COD-53: enforce the active attachment-guard policy on the symlink-resolved
230
241
  // path before doing anything else.
231
242
  const guard = await loadAttachmentGuardConfig();
@@ -1 +1 @@
1
- {"version":3,"file":"attachment-registry.js","sourceRoot":"","sources":["../src/attachment-registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAC/G,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAoB,MAAM,mBAAmB,CAAC;AAI9F;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAwB,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAC9G,MAAM,CAAC,MAAM,2BAA2B,GAAwB,IAAI,GAAG,CAAC;IACtE,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;CACP,CAAC,CAAC;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAwB,mBAAmB,CAAC;AAEnF;;;;GAIG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAsB,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEhH,MAAM,+BAA+B,GAAG,IAAI,GAAG,CAAC;IAC9C,KAAK;IACL,KAAK;IACL,MAAM;IACN,KA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,CAAC,6BAA6B,CAAC,CAAC;IACvE,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACrB,MAAM,IAAI,2BAA2B,CAAC,+BAA+B,CAAC,CAAC;IACzE,CAAC;IAED,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;IAEhE,MAAM,QAAQ,GAAG,kBAAkB,CAAC,cAAc,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IAC5E,IAAI,QAAQ,EAAE,CAAC;QACb,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAC1B,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;QACrC,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAChC,OAAO,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,MAAM,GAAqB;QAC/B,YAAY,EAAE,OAAO,UAAU,EAAE,EAAE;QACnC,SAAS;QACT,QAAQ,EAAE,YAAY;QACtB,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC;QAChC,SAAS;QACT,cAAc,EAAE,iBAAiB,CAAC,SAAS,CAAC;QAC5C,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,CAAC;QAC1B,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,MAAM,EAAE,UAAU;KACnB,CAAC;IACF,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO,uBAAuB,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,227 @@
1
+ import type { Command } from 'commander';
2
+ import { type CodemanCredentials } from './codeman-credentials.js';
3
+ export interface AgentContext {
4
+ /** Base URL of the Codeman server, from `CODEMAN_API_URL`. */
5
+ apiUrl: string;
6
+ /** This session's id, from `CODEMAN_SESSION_ID`. */
7
+ selfId: string;
8
+ /** Basic-auth credentials, when the server has a password. */
9
+ auth?: CodemanCredentials;
10
+ }
11
+ /** Thrown when the process is not inside a Codeman-managed session. */
12
+ export declare class AgentGuardError extends Error {
13
+ }
14
+ /** Exit codes shared by every verb; a shell agent can branch on them. */
15
+ export declare const EXIT: {
16
+ readonly ok: 0;
17
+ readonly error: 1;
18
+ readonly timeout: 2;
19
+ readonly dead: 3;
20
+ readonly refused: 4;
21
+ };
22
+ /**
23
+ * Resolve the context from the environment, or throw `AgentGuardError`.
24
+ *
25
+ * Credentials in the order every client of the API uses (`credentialsFrom`, shared
26
+ * with `codeman attach` and the TUI): each field from the environment (a session
27
+ * inherits the server's), then the data dir's `.env`. No password means the server
28
+ * is open (single-user) — or it is not, and the 401 says so.
29
+ */
30
+ export declare function resolveAgentContext(env?: NodeJS.ProcessEnv, envFile?: () => Record<string, string>): AgentContext;
31
+ /**
32
+ * Is `id` this session? Prefix in BOTH directions, because ids appear in full and
33
+ * in 8-char form (mux names, UI surfaces, Docker's truncated `$SELF`). A self id
34
+ * shorter than 8 characters cannot prove anything and is treated as "maybe me".
35
+ */
36
+ export declare function isSelfSession(selfId: string, id: string): boolean;
37
+ /** Why `rm` refuses, or `undefined` when the delete may go ahead. */
38
+ export declare function deleteRefusal(selfId: string, id: string): string | undefined;
39
+ /**
40
+ * The prompt `send` was given, which must be ONE argument. Joining several with spaces
41
+ * would turn an unquoted `$(cat notes.txt)`, which the shell splits on every newline,
42
+ * back into a single line, so the multi-line refusal below would never see it.
43
+ */
44
+ export declare function sendPromptFromArgs(words: readonly string[]): {
45
+ text: string;
46
+ } | {
47
+ error: string;
48
+ };
49
+ /**
50
+ * Why `send` refuses this text, or `undefined` when it is printable. The composer
51
+ * takes one line; the server strips `\r`/`\n` but everything else below 0x20 (and
52
+ * DEL) reaches the pane as a keypress. None of that is a prompt.
53
+ */
54
+ export declare function inputRefusal(text: string): string | undefined;
55
+ /**
56
+ * Body for `POST /sessions/:id/input` on the send path: text plus `\r` unless the
57
+ * caller asked to type without submitting. Never anything else.
58
+ */
59
+ export declare function buildSendBody(text: string, options: {
60
+ enter: boolean;
61
+ clientId: string;
62
+ seq: number;
63
+ wait?: string | true;
64
+ waitTimeout?: number;
65
+ }): Record<string, unknown>;
66
+ /** Body for the interrupt path: a bare ESC, and nothing appended — ever. */
67
+ export declare function buildInterruptBody(clientId: string, seq: number): Record<string, unknown>;
68
+ /** `clientId` for this caller: fixed per sending session, so `seq` stays monotonic. */
69
+ export declare function defaultClientId(selfId: string, suffix?: string): string;
70
+ /**
71
+ * Strip a terminal buffer for humans: the shared ANSI strip (CSI, OSC such as window
72
+ * titles, keypad modes) plus the charset designators (`ESC ( B`) it leaves in.
73
+ */
74
+ export declare function stripAnsi(text: string): string;
75
+ /** Parse a positive-integer option (`--timeout` ms, `--tail` bytes); the server rejects anything else. */
76
+ export declare function parsePositiveInt(raw: string | undefined, fallback: number, flag?: string): number;
77
+ /**
78
+ * Exit code for a wait result: matched or a signal → ok, `exit` or `ended` → dead,
79
+ * timeout → timeout. `ended` is checked BEFORE the happy paths: a worker that dies
80
+ * during `--until stop` comes back as `ended:true, signal:null` (the registry only
81
+ * satisfies waiters that listed `exit`, then cancels the rest), and a `--match` on
82
+ * a dead worker as `ended:true, matched:false` — both are "dead", never "done".
83
+ */
84
+ export declare function waitExitCode(wait: WaitResult | undefined): number;
85
+ export interface ApiEnvelope<T = unknown> {
86
+ success: boolean;
87
+ data?: T;
88
+ error?: string;
89
+ errorCode?: string;
90
+ }
91
+ export interface ApiResponse<T = unknown> {
92
+ status: number;
93
+ /** Parsed envelope, or `undefined` when the body was not JSON (auth guards answer in plain text). */
94
+ json?: ApiEnvelope<T>;
95
+ text: string;
96
+ }
97
+ export interface WaitResult {
98
+ /** The signal that fired, or null when the wait ended without one. */
99
+ signal?: string | null;
100
+ timedOut?: boolean;
101
+ /** The session went away (deleted / torn down / the write failed) before the wait resolved. */
102
+ ended?: boolean;
103
+ timeoutMs?: number;
104
+ until?: string[];
105
+ matched?: boolean;
106
+ match?: string;
107
+ snippet?: string;
108
+ immediate?: boolean;
109
+ }
110
+ export interface RequestOptions {
111
+ method: 'GET' | 'POST' | 'DELETE';
112
+ path: string;
113
+ query?: Record<string, string | number | boolean | undefined>;
114
+ body?: Record<string, unknown>;
115
+ headers?: Record<string, string>;
116
+ /** Socket timeout; long-polls pass their own timeout plus headroom. */
117
+ timeoutMs?: number;
118
+ /** Aborts the request (an MCP client cancelling a long wait); the promise rejects. */
119
+ signal?: AbortSignal;
120
+ }
121
+ export type ApiRequest = (ctx: AgentContext, options: RequestOptions) => Promise<ApiResponse>;
122
+ /** Every request carries these; they are ignored on endpoints that do not read them. */
123
+ export declare function baseHeaders(ctx: AgentContext): Record<string, string>;
124
+ /** The real transport. `rejectUnauthorized:false` because the HTTPS install uses a self-signed cert. */
125
+ export declare const httpRequest: ApiRequest;
126
+ /** One line describing a failed response, for humans. Plain-text guards (401/403/429) have no envelope. */
127
+ export declare function describeFailure(res: ApiResponse): string;
128
+ export interface AgentIo {
129
+ out: (line: string) => void;
130
+ err: (line: string) => void;
131
+ }
132
+ export interface AgentDeps {
133
+ ctx: AgentContext;
134
+ request: ApiRequest;
135
+ io: AgentIo;
136
+ json: boolean;
137
+ /** Clock for `seq`; injectable so tests are deterministic. */
138
+ now?: () => number;
139
+ }
140
+ /**
141
+ * Shortest prefix that may name a session: the 8-char form `ls` prints, and the floor
142
+ * the server's own resolver uses (`PARENT_SESSION_ID_MIN_PREFIX`, route-helpers.ts).
143
+ */
144
+ export declare const MIN_ID_PREFIX_LENGTH = 8;
145
+ /**
146
+ * Turn the id a human typed into the one the routes accept. `ls` prints 8-char
147
+ * prefixes and the routes answer 404 to those (measured live), so anything shorter
148
+ * than a full id resolves through the session list; an ambiguous prefix refuses
149
+ * rather than picking one. Below 8 characters it refuses before the list: "unique"
150
+ * means nothing for `9` — it names whatever session happens to be alone with that
151
+ * first character, and `rm`/`send` would act on it.
152
+ */
153
+ export declare function resolveSessionId(deps: AgentDeps, id: string): Promise<{
154
+ id: string;
155
+ } | {
156
+ error: string;
157
+ code: number;
158
+ }>;
159
+ /** `agent ls` — every session the caller can see, self marked. */
160
+ export declare function agentLs(deps: AgentDeps): Promise<number>;
161
+ export interface SpawnOptions {
162
+ caseName: string;
163
+ mode: string;
164
+ name?: string;
165
+ /** Wait for the composer before returning, where the registry gives the mode a ready mark. */
166
+ ready: boolean;
167
+ timeoutMs: number;
168
+ }
169
+ /**
170
+ * Agent-scratch label for a case directory a spawn CREATES (the server applies it only
171
+ * when quick-start makes the directory). The Add Case UI offers a recursive delete for
172
+ * such directories, so this header must never ride any other request: mislabelling a
173
+ * real repo there is the one failure in this area that costs actual work.
174
+ */
175
+ export declare const AGENT_ORIGIN_HEADER: {
176
+ readonly 'X-Codeman-Agent-Origin': "codeman-agent-cli";
177
+ };
178
+ /**
179
+ * What the mode's TUI draws once its composer can take a prompt, from the CLI registry
180
+ * (`capabilities.composerReadyMark`); undefined means the mode has no readiness wait.
181
+ */
182
+ export declare function composerReadyMark(mode: string): string | undefined;
183
+ /** `agent spawn` — quick-start with lineage, then the readiness ladder where the mode has one. */
184
+ export declare function agentSpawn(deps: AgentDeps, options: SpawnOptions): Promise<number>;
185
+ export interface SendOptions {
186
+ id: string;
187
+ text: string;
188
+ enter: boolean;
189
+ /** `undefined` = fire-and-forget; `true` = default signal set; string = comma list. */
190
+ wait?: string | true;
191
+ timeoutMs?: number;
192
+ clientId?: string;
193
+ seq?: number;
194
+ }
195
+ /** `agent send` — printable text plus `\r`, exactly-once, optionally blocking on end of turn. */
196
+ export declare function agentSend(deps: AgentDeps, options: SendOptions): Promise<number>;
197
+ export interface WaitOptions {
198
+ id: string;
199
+ until?: string;
200
+ match?: string;
201
+ from?: 'buffer' | 'now';
202
+ fresh?: boolean;
203
+ nocase?: boolean;
204
+ timeoutMs: number;
205
+ }
206
+ /** `agent wait` — a signal (`--until`) or a literal output marker (`--match`). */
207
+ export declare function agentWait(deps: AgentDeps, options: WaitOptions): Promise<number>;
208
+ export interface ReadOptions {
209
+ id: string;
210
+ /** Bytes of raw terminal to fetch; ANSI is stripped for humans. */
211
+ tail?: number;
212
+ /** Whole conversation (`context=full`) instead of the last assistant message. */
213
+ full?: boolean;
214
+ }
215
+ /** `agent read` — the last answer (the route picks the transcript reader or the pane segmenter) or a terminal tail. */
216
+ export declare function agentRead(deps: AgentDeps, options: ReadOptions): Promise<number>;
217
+ /** `agent interrupt` — a bare ESC keypress, no Enter, conversation intact. */
218
+ export declare function agentInterrupt(deps: AgentDeps, options: {
219
+ id: string;
220
+ }): Promise<number>;
221
+ /** `agent rm` — delete a session that is provably not this one. */
222
+ export declare function agentRm(deps: AgentDeps, options: {
223
+ id: string;
224
+ }): Promise<number>;
225
+ /** Register `codeman agent …` on the program. */
226
+ export declare function registerAgentCommands(program: Command): Command;
227
+ //# sourceMappingURL=cli-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-agent.d.ts","sourceRoot":"","sources":["../src/cli-agent.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAC;AAUlC,MAAM,WAAW,YAAY;IAC3B,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,IAAI,CAAC,EAAE,kBAAkB,CAAC;CAC3B;AAED,uEAAuE;AACvE,qBAAa,eAAgB,SAAQ,KAAK;CAAG;AAE7C,yEAAyE;AACzE,eAAO,MAAM,IAAI;;;;;;CAMP,CAAC;AAEX;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,OAAO,GAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAA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