botmux 3.14.0 → 3.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (812) hide show
  1. package/README.en.md +2 -2
  2. package/README.md +2 -2
  3. package/dist/.runtime-build-id +1 -1
  4. package/dist/adapters/backend/destroy-result.d.ts +159 -0
  5. package/dist/adapters/backend/destroy-result.d.ts.map +1 -0
  6. package/dist/adapters/backend/destroy-result.js +223 -0
  7. package/dist/adapters/backend/destroy-result.js.map +1 -0
  8. package/dist/adapters/backend/herdr-backend.d.ts +4 -0
  9. package/dist/adapters/backend/herdr-backend.d.ts.map +1 -1
  10. package/dist/adapters/backend/herdr-backend.js +23 -1
  11. package/dist/adapters/backend/herdr-backend.js.map +1 -1
  12. package/dist/adapters/backend/mojo-backend.d.ts +577 -0
  13. package/dist/adapters/backend/mojo-backend.d.ts.map +1 -0
  14. package/dist/adapters/backend/mojo-backend.js +2471 -0
  15. package/dist/adapters/backend/mojo-backend.js.map +1 -0
  16. package/dist/adapters/backend/mojo-budgets.d.ts +21 -0
  17. package/dist/adapters/backend/mojo-budgets.d.ts.map +1 -0
  18. package/dist/adapters/backend/mojo-budgets.js +22 -0
  19. package/dist/adapters/backend/mojo-budgets.js.map +1 -0
  20. package/dist/adapters/backend/mojo-isolated-workspace.d.ts +69 -0
  21. package/dist/adapters/backend/mojo-isolated-workspace.d.ts.map +1 -0
  22. package/dist/adapters/backend/mojo-isolated-workspace.js +213 -0
  23. package/dist/adapters/backend/mojo-isolated-workspace.js.map +1 -0
  24. package/dist/adapters/backend/mojo-process-tree.d.ts +292 -0
  25. package/dist/adapters/backend/mojo-process-tree.d.ts.map +1 -0
  26. package/dist/adapters/backend/mojo-process-tree.js +486 -0
  27. package/dist/adapters/backend/mojo-process-tree.js.map +1 -0
  28. package/dist/adapters/backend/mojo-types.d.ts +542 -0
  29. package/dist/adapters/backend/mojo-types.d.ts.map +1 -0
  30. package/dist/adapters/backend/mojo-types.js +682 -0
  31. package/dist/adapters/backend/mojo-types.js.map +1 -0
  32. package/dist/adapters/backend/reproduce-command.js +3 -3
  33. package/dist/adapters/backend/reproduce-command.js.map +1 -1
  34. package/dist/adapters/backend/riff-backend.js +1 -1
  35. package/dist/adapters/backend/riff-backend.js.map +1 -1
  36. package/dist/adapters/backend/sandbox.d.ts +44 -7
  37. package/dist/adapters/backend/sandbox.d.ts.map +1 -1
  38. package/dist/adapters/backend/sandbox.js +30 -7
  39. package/dist/adapters/backend/sandbox.js.map +1 -1
  40. package/dist/adapters/backend/session-backend-selector.d.ts +14 -1
  41. package/dist/adapters/backend/session-backend-selector.d.ts.map +1 -1
  42. package/dist/adapters/backend/session-backend-selector.js +82 -10
  43. package/dist/adapters/backend/session-backend-selector.js.map +1 -1
  44. package/dist/adapters/backend/tmux-pipe-backend.d.ts +30 -0
  45. package/dist/adapters/backend/tmux-pipe-backend.d.ts.map +1 -1
  46. package/dist/adapters/backend/tmux-pipe-backend.js +60 -0
  47. package/dist/adapters/backend/tmux-pipe-backend.js.map +1 -1
  48. package/dist/adapters/backend/types.d.ts +108 -6
  49. package/dist/adapters/backend/types.d.ts.map +1 -1
  50. package/dist/adapters/backend/types.js.map +1 -1
  51. package/dist/adapters/backend/zmx-backend.d.ts +11 -0
  52. package/dist/adapters/backend/zmx-backend.d.ts.map +1 -1
  53. package/dist/adapters/backend/zmx-backend.js +16 -1
  54. package/dist/adapters/backend/zmx-backend.js.map +1 -1
  55. package/dist/adapters/cli/codex-app.d.ts.map +1 -1
  56. package/dist/adapters/cli/codex-app.js +2 -2
  57. package/dist/adapters/cli/codex-app.js.map +1 -1
  58. package/dist/adapters/cli/codex.d.ts.map +1 -1
  59. package/dist/adapters/cli/codex.js +7 -0
  60. package/dist/adapters/cli/codex.js.map +1 -1
  61. package/dist/adapters/cli/copilot.d.ts +3 -1
  62. package/dist/adapters/cli/copilot.d.ts.map +1 -1
  63. package/dist/adapters/cli/copilot.js +23 -5
  64. package/dist/adapters/cli/copilot.js.map +1 -1
  65. package/dist/adapters/cli/cursor.d.ts.map +1 -1
  66. package/dist/adapters/cli/cursor.js +26 -4
  67. package/dist/adapters/cli/cursor.js.map +1 -1
  68. package/dist/adapters/cli/dsh.d.ts.map +1 -1
  69. package/dist/adapters/cli/dsh.js +5 -1
  70. package/dist/adapters/cli/dsh.js.map +1 -1
  71. package/dist/adapters/cli/grok.d.ts.map +1 -1
  72. package/dist/adapters/cli/grok.js +24 -5
  73. package/dist/adapters/cli/grok.js.map +1 -1
  74. package/dist/adapters/cli/kimi.d.ts.map +1 -1
  75. package/dist/adapters/cli/kimi.js +19 -1
  76. package/dist/adapters/cli/kimi.js.map +1 -1
  77. package/dist/adapters/cli/mojo.d.ts +28 -0
  78. package/dist/adapters/cli/mojo.d.ts.map +1 -0
  79. package/dist/adapters/cli/mojo.js +58 -0
  80. package/dist/adapters/cli/mojo.js.map +1 -0
  81. package/dist/adapters/cli/pi.d.ts +20 -5
  82. package/dist/adapters/cli/pi.d.ts.map +1 -1
  83. package/dist/adapters/cli/pi.js +27 -5
  84. package/dist/adapters/cli/pi.js.map +1 -1
  85. package/dist/adapters/cli/read-isolation.d.ts +251 -1
  86. package/dist/adapters/cli/read-isolation.d.ts.map +1 -1
  87. package/dist/adapters/cli/read-isolation.js +254 -1
  88. package/dist/adapters/cli/read-isolation.js.map +1 -1
  89. package/dist/adapters/cli/registry.d.ts +13 -1
  90. package/dist/adapters/cli/registry.d.ts.map +1 -1
  91. package/dist/adapters/cli/registry.js +19 -1
  92. package/dist/adapters/cli/registry.js.map +1 -1
  93. package/dist/adapters/cli/runner-input.d.ts +3 -3
  94. package/dist/adapters/cli/runner-input.d.ts.map +1 -1
  95. package/dist/adapters/cli/runner-input.js +4 -3
  96. package/dist/adapters/cli/runner-input.js.map +1 -1
  97. package/dist/adapters/cli/shared-hints.d.ts +3 -1
  98. package/dist/adapters/cli/shared-hints.d.ts.map +1 -1
  99. package/dist/adapters/cli/shared-hints.js +51 -30
  100. package/dist/adapters/cli/shared-hints.js.map +1 -1
  101. package/dist/adapters/cli/types.d.ts +33 -4
  102. package/dist/adapters/cli/types.d.ts.map +1 -1
  103. package/dist/bot-registry.d.ts +42 -0
  104. package/dist/bot-registry.d.ts.map +1 -1
  105. package/dist/bot-registry.js +54 -4
  106. package/dist/bot-registry.js.map +1 -1
  107. package/dist/cli/arg-utils.d.ts +5 -0
  108. package/dist/cli/arg-utils.d.ts.map +1 -1
  109. package/dist/cli/arg-utils.js +7 -0
  110. package/dist/cli/arg-utils.js.map +1 -1
  111. package/dist/cli/bots-list-output.d.ts +130 -2
  112. package/dist/cli/bots-list-output.d.ts.map +1 -1
  113. package/dist/cli/bots-list-output.js +173 -27
  114. package/dist/cli/bots-list-output.js.map +1 -1
  115. package/dist/cli/daemon-lifecycle-env.d.ts +10 -3
  116. package/dist/cli/daemon-lifecycle-env.d.ts.map +1 -1
  117. package/dist/cli/daemon-lifecycle-env.js +38 -11
  118. package/dist/cli/daemon-lifecycle-env.js.map +1 -1
  119. package/dist/cli/dashboard-command.d.ts +15 -0
  120. package/dist/cli/dashboard-command.d.ts.map +1 -1
  121. package/dist/cli/dashboard-command.js +22 -0
  122. package/dist/cli/dashboard-command.js.map +1 -1
  123. package/dist/cli/log-tail.d.ts +54 -0
  124. package/dist/cli/log-tail.d.ts.map +1 -0
  125. package/dist/cli/log-tail.js +167 -0
  126. package/dist/cli/log-tail.js.map +1 -0
  127. package/dist/cli/pm2-env.d.ts +16 -0
  128. package/dist/cli/pm2-env.d.ts.map +1 -0
  129. package/dist/cli/pm2-env.js +63 -0
  130. package/dist/cli/pm2-env.js.map +1 -0
  131. package/dist/cli/pm2-fleet-lock.d.ts +26 -0
  132. package/dist/cli/pm2-fleet-lock.d.ts.map +1 -0
  133. package/dist/cli/pm2-fleet-lock.js +50 -0
  134. package/dist/cli/pm2-fleet-lock.js.map +1 -0
  135. package/dist/cli/pm2-god-retirement.d.ts +59 -0
  136. package/dist/cli/pm2-god-retirement.d.ts.map +1 -0
  137. package/dist/cli/pm2-god-retirement.js +95 -0
  138. package/dist/cli/pm2-god-retirement.js.map +1 -0
  139. package/dist/cli/session-list-wake.d.ts +41 -0
  140. package/dist/cli/session-list-wake.d.ts.map +1 -0
  141. package/dist/cli/session-list-wake.js +102 -0
  142. package/dist/cli/session-list-wake.js.map +1 -0
  143. package/dist/cli/workflow.d.ts.map +1 -1
  144. package/dist/cli/workflow.js +26 -0
  145. package/dist/cli/workflow.js.map +1 -1
  146. package/dist/cli.d.ts.map +1 -1
  147. package/dist/cli.js +941 -118
  148. package/dist/cli.js.map +1 -1
  149. package/dist/codex-app-runner.js +261 -49
  150. package/dist/codex-app-runner.js.map +1 -1
  151. package/dist/core/cli-runtime-update.d.ts +8 -0
  152. package/dist/core/cli-runtime-update.d.ts.map +1 -1
  153. package/dist/core/cli-runtime-update.js +127 -8
  154. package/dist/core/cli-runtime-update.js.map +1 -1
  155. package/dist/core/close-residual.d.ts +64 -0
  156. package/dist/core/close-residual.d.ts.map +1 -0
  157. package/dist/core/close-residual.js +93 -0
  158. package/dist/core/close-residual.js.map +1 -0
  159. package/dist/core/closed-session-card.d.ts.map +1 -1
  160. package/dist/core/closed-session-card.js +11 -3
  161. package/dist/core/closed-session-card.js.map +1 -1
  162. package/dist/core/command-discovery.d.ts.map +1 -1
  163. package/dist/core/command-discovery.js +4 -1
  164. package/dist/core/command-discovery.js.map +1 -1
  165. package/dist/core/command-handler.d.ts.map +1 -1
  166. package/dist/core/command-handler.js +129 -27
  167. package/dist/core/command-handler.js.map +1 -1
  168. package/dist/core/cost-calculator.d.ts +3 -1
  169. package/dist/core/cost-calculator.d.ts.map +1 -1
  170. package/dist/core/cost-calculator.js +230 -1
  171. package/dist/core/cost-calculator.js.map +1 -1
  172. package/dist/core/daemon-background-close.d.ts +19 -0
  173. package/dist/core/daemon-background-close.d.ts.map +1 -0
  174. package/dist/core/daemon-background-close.js +39 -0
  175. package/dist/core/daemon-background-close.js.map +1 -0
  176. package/dist/core/dashboard-command/overview.d.ts +4 -0
  177. package/dist/core/dashboard-command/overview.d.ts.map +1 -1
  178. package/dist/core/dashboard-command/overview.js +8 -1
  179. package/dist/core/dashboard-command/overview.js.map +1 -1
  180. package/dist/core/dashboard-ipc-server.d.ts.map +1 -1
  181. package/dist/core/dashboard-ipc-server.js +415 -42
  182. package/dist/core/dashboard-ipc-server.js.map +1 -1
  183. package/dist/core/dashboard-rows.d.ts +4 -0
  184. package/dist/core/dashboard-rows.d.ts.map +1 -1
  185. package/dist/core/dashboard-rows.js +3 -0
  186. package/dist/core/dashboard-rows.js.map +1 -1
  187. package/dist/core/dashboard-url.d.ts +37 -0
  188. package/dist/core/dashboard-url.d.ts.map +1 -1
  189. package/dist/core/dashboard-url.js +71 -0
  190. package/dist/core/dashboard-url.js.map +1 -1
  191. package/dist/core/deferred-schedule-settlement.d.ts +15 -1
  192. package/dist/core/deferred-schedule-settlement.d.ts.map +1 -1
  193. package/dist/core/deferred-schedule-settlement.js +4 -1
  194. package/dist/core/deferred-schedule-settlement.js.map +1 -1
  195. package/dist/core/device-isolation-daemon.d.ts +91 -1
  196. package/dist/core/device-isolation-daemon.d.ts.map +1 -1
  197. package/dist/core/device-isolation-daemon.js +346 -2
  198. package/dist/core/device-isolation-daemon.js.map +1 -1
  199. package/dist/core/local-terminal-opener.d.ts.map +1 -1
  200. package/dist/core/local-terminal-opener.js +5 -1
  201. package/dist/core/local-terminal-opener.js.map +1 -1
  202. package/dist/core/loopback-target.d.ts +14 -0
  203. package/dist/core/loopback-target.d.ts.map +1 -0
  204. package/dist/core/loopback-target.js +20 -0
  205. package/dist/core/loopback-target.js.map +1 -0
  206. package/dist/core/maintenance.d.ts.map +1 -1
  207. package/dist/core/maintenance.js +16 -2
  208. package/dist/core/maintenance.js.map +1 -1
  209. package/dist/core/mojo-containment-command.d.ts +20 -0
  210. package/dist/core/mojo-containment-command.d.ts.map +1 -0
  211. package/dist/core/mojo-containment-command.js +266 -0
  212. package/dist/core/mojo-containment-command.js.map +1 -0
  213. package/dist/core/mojo-containment.d.ts +575 -0
  214. package/dist/core/mojo-containment.d.ts.map +1 -0
  215. package/dist/core/mojo-containment.js +1158 -0
  216. package/dist/core/mojo-containment.js.map +1 -0
  217. package/dist/core/mojo-launcher-env-quarantine.d.ts +30 -0
  218. package/dist/core/mojo-launcher-env-quarantine.d.ts.map +1 -0
  219. package/dist/core/mojo-launcher-env-quarantine.js +175 -0
  220. package/dist/core/mojo-launcher-env-quarantine.js.map +1 -0
  221. package/dist/core/mojo-session-identity.d.ts +3 -0
  222. package/dist/core/mojo-session-identity.d.ts.map +1 -0
  223. package/dist/core/mojo-session-identity.js +126 -0
  224. package/dist/core/mojo-session-identity.js.map +1 -0
  225. package/dist/core/persistent-backend.d.ts +32 -8
  226. package/dist/core/persistent-backend.d.ts.map +1 -1
  227. package/dist/core/persistent-backend.js +55 -17
  228. package/dist/core/persistent-backend.js.map +1 -1
  229. package/dist/core/plugins/mcp/gateway.d.ts +14 -1
  230. package/dist/core/plugins/mcp/gateway.d.ts.map +1 -1
  231. package/dist/core/plugins/mcp/gateway.js +70 -3
  232. package/dist/core/plugins/mcp/gateway.js.map +1 -1
  233. package/dist/core/plugins/mcp/host.d.ts +2 -0
  234. package/dist/core/plugins/mcp/host.d.ts.map +1 -1
  235. package/dist/core/plugins/mcp/host.js +2 -0
  236. package/dist/core/plugins/mcp/host.js.map +1 -1
  237. package/dist/core/plugins/pm2.d.ts.map +1 -1
  238. package/dist/core/plugins/pm2.js +16 -3
  239. package/dist/core/plugins/pm2.js.map +1 -1
  240. package/dist/core/plugins/service-manager.d.ts +9 -0
  241. package/dist/core/plugins/service-manager.d.ts.map +1 -1
  242. package/dist/core/plugins/service-manager.js +33 -16
  243. package/dist/core/plugins/service-manager.js.map +1 -1
  244. package/dist/core/preview-port-owner.d.ts +109 -0
  245. package/dist/core/preview-port-owner.d.ts.map +1 -0
  246. package/dist/core/preview-port-owner.js +320 -0
  247. package/dist/core/preview-port-owner.js.map +1 -0
  248. package/dist/core/remote-cli-ids.d.ts +5 -0
  249. package/dist/core/remote-cli-ids.d.ts.map +1 -0
  250. package/dist/core/remote-cli-ids.js +24 -0
  251. package/dist/core/remote-cli-ids.js.map +1 -0
  252. package/dist/core/{riff-shutdown-detach.d.ts → remote-shutdown-detach.d.ts} +40 -39
  253. package/dist/core/remote-shutdown-detach.d.ts.map +1 -0
  254. package/dist/core/{riff-shutdown-detach.js → remote-shutdown-detach.js} +85 -83
  255. package/dist/core/remote-shutdown-detach.js.map +1 -0
  256. package/dist/core/{riff-worker-shutdown-readiness.d.ts → remote-worker-shutdown-readiness.d.ts} +5 -4
  257. package/dist/core/remote-worker-shutdown-readiness.d.ts.map +1 -0
  258. package/dist/core/{riff-worker-shutdown-readiness.js → remote-worker-shutdown-readiness.js} +4 -3
  259. package/dist/core/remote-worker-shutdown-readiness.js.map +1 -0
  260. package/dist/core/reply-target.d.ts +16 -1
  261. package/dist/core/reply-target.d.ts.map +1 -1
  262. package/dist/core/reply-target.js +61 -0
  263. package/dist/core/reply-target.js.map +1 -1
  264. package/dist/core/session-group-birth.d.ts +26 -0
  265. package/dist/core/session-group-birth.d.ts.map +1 -1
  266. package/dist/core/session-group-birth.js +81 -4
  267. package/dist/core/session-group-birth.js.map +1 -1
  268. package/dist/core/session-manager.d.ts +15 -2
  269. package/dist/core/session-manager.d.ts.map +1 -1
  270. package/dist/core/session-manager.js +259 -5
  271. package/dist/core/session-manager.js.map +1 -1
  272. package/dist/core/session-model.d.ts +46 -0
  273. package/dist/core/session-model.d.ts.map +1 -0
  274. package/dist/core/session-model.js +42 -0
  275. package/dist/core/session-model.js.map +1 -0
  276. package/dist/core/session-owner-reminder.d.ts +63 -0
  277. package/dist/core/session-owner-reminder.d.ts.map +1 -0
  278. package/dist/core/session-owner-reminder.js +196 -0
  279. package/dist/core/session-owner-reminder.js.map +1 -0
  280. package/dist/core/session-preview-registry.d.ts +53 -0
  281. package/dist/core/session-preview-registry.d.ts.map +1 -0
  282. package/dist/core/session-preview-registry.js +82 -0
  283. package/dist/core/session-preview-registry.js.map +1 -0
  284. package/dist/core/session-preview.d.ts +114 -0
  285. package/dist/core/session-preview.d.ts.map +1 -0
  286. package/dist/core/session-preview.js +184 -0
  287. package/dist/core/session-preview.js.map +1 -0
  288. package/dist/core/session-rename.d.ts.map +1 -1
  289. package/dist/core/session-rename.js +5 -3
  290. package/dist/core/session-rename.js.map +1 -1
  291. package/dist/core/session-wake-deadline.d.ts +5 -0
  292. package/dist/core/session-wake-deadline.d.ts.map +1 -0
  293. package/dist/core/session-wake-deadline.js +13 -0
  294. package/dist/core/session-wake-deadline.js.map +1 -0
  295. package/dist/core/shutdown-budgets.d.ts +7 -6
  296. package/dist/core/shutdown-budgets.d.ts.map +1 -1
  297. package/dist/core/shutdown-budgets.js +11 -10
  298. package/dist/core/shutdown-budgets.js.map +1 -1
  299. package/dist/core/skills/frontmatter.d.ts.map +1 -1
  300. package/dist/core/skills/frontmatter.js +6 -1
  301. package/dist/core/skills/frontmatter.js.map +1 -1
  302. package/dist/core/terminal-control-grant.d.ts +74 -0
  303. package/dist/core/terminal-control-grant.d.ts.map +1 -0
  304. package/dist/core/terminal-control-grant.js +183 -0
  305. package/dist/core/terminal-control-grant.js.map +1 -0
  306. package/dist/core/terminal-proxy.d.ts.map +1 -1
  307. package/dist/core/terminal-proxy.js +4 -5
  308. package/dist/core/terminal-proxy.js.map +1 -1
  309. package/dist/core/terminal-write-auth.d.ts +4 -11
  310. package/dist/core/terminal-write-auth.d.ts.map +1 -1
  311. package/dist/core/terminal-write-auth.js +19 -16
  312. package/dist/core/terminal-write-auth.js.map +1 -1
  313. package/dist/core/trigger-session.d.ts.map +1 -1
  314. package/dist/core/trigger-session.js +36 -29
  315. package/dist/core/trigger-session.js.map +1 -1
  316. package/dist/core/types.d.ts +88 -10
  317. package/dist/core/types.d.ts.map +1 -1
  318. package/dist/core/types.js +9 -7
  319. package/dist/core/types.js.map +1 -1
  320. package/dist/core/workbench-link.d.ts +81 -0
  321. package/dist/core/workbench-link.d.ts.map +1 -0
  322. package/dist/core/workbench-link.js +109 -0
  323. package/dist/core/workbench-link.js.map +1 -0
  324. package/dist/core/worker-pool.d.ts +312 -11
  325. package/dist/core/worker-pool.d.ts.map +1 -1
  326. package/dist/core/worker-pool.js +2515 -217
  327. package/dist/core/worker-pool.js.map +1 -1
  328. package/dist/daemon.d.ts +6 -0
  329. package/dist/daemon.d.ts.map +1 -1
  330. package/dist/daemon.js +447 -116
  331. package/dist/daemon.js.map +1 -1
  332. package/dist/dashboard/aggregator.d.ts +33 -3
  333. package/dist/dashboard/aggregator.d.ts.map +1 -1
  334. package/dist/dashboard/aggregator.js +93 -17
  335. package/dist/dashboard/aggregator.js.map +1 -1
  336. package/dist/dashboard/auth-session-connections.d.ts +59 -0
  337. package/dist/dashboard/auth-session-connections.d.ts.map +1 -0
  338. package/dist/dashboard/auth-session-connections.js +109 -0
  339. package/dist/dashboard/auth-session-connections.js.map +1 -0
  340. package/dist/dashboard/auth.d.ts +99 -1
  341. package/dist/dashboard/auth.d.ts.map +1 -1
  342. package/dist/dashboard/auth.js +176 -64
  343. package/dist/dashboard/auth.js.map +1 -1
  344. package/dist/dashboard/bot-payload.d.ts +5 -0
  345. package/dist/dashboard/bot-payload.d.ts.map +1 -1
  346. package/dist/dashboard/bot-payload.js +4 -0
  347. package/dist/dashboard/bot-payload.js.map +1 -1
  348. package/dist/dashboard/control-audit.d.ts +112 -0
  349. package/dist/dashboard/control-audit.d.ts.map +1 -0
  350. package/dist/dashboard/control-audit.js +195 -0
  351. package/dist/dashboard/control-audit.js.map +1 -0
  352. package/dist/dashboard/control-csrf.d.ts +123 -0
  353. package/dist/dashboard/control-csrf.d.ts.map +1 -0
  354. package/dist/dashboard/control-csrf.js +392 -0
  355. package/dist/dashboard/control-csrf.js.map +1 -0
  356. package/dist/dashboard/daemon-reconcile.d.ts +26 -0
  357. package/dist/dashboard/daemon-reconcile.d.ts.map +1 -0
  358. package/dist/dashboard/daemon-reconcile.js +46 -0
  359. package/dist/dashboard/daemon-reconcile.js.map +1 -0
  360. package/dist/dashboard/debug-terminal.d.ts.map +1 -1
  361. package/dist/dashboard/debug-terminal.js +18 -4
  362. package/dist/dashboard/debug-terminal.js.map +1 -1
  363. package/dist/dashboard/events-sse.d.ts +60 -0
  364. package/dist/dashboard/events-sse.d.ts.map +1 -0
  365. package/dist/dashboard/events-sse.js +63 -0
  366. package/dist/dashboard/events-sse.js.map +1 -0
  367. package/dist/dashboard/h5-auth.d.ts +256 -0
  368. package/dist/dashboard/h5-auth.d.ts.map +1 -0
  369. package/dist/dashboard/h5-auth.js +825 -0
  370. package/dist/dashboard/h5-auth.js.map +1 -0
  371. package/dist/dashboard/managed-spawn.d.ts +36 -0
  372. package/dist/dashboard/managed-spawn.d.ts.map +1 -0
  373. package/dist/dashboard/managed-spawn.js +169 -0
  374. package/dist/dashboard/managed-spawn.js.map +1 -0
  375. package/dist/dashboard/preview-content-capability.d.ts +41 -0
  376. package/dist/dashboard/preview-content-capability.d.ts.map +1 -0
  377. package/dist/dashboard/preview-content-capability.js +127 -0
  378. package/dist/dashboard/preview-content-capability.js.map +1 -0
  379. package/dist/dashboard/preview-contract.d.ts +85 -0
  380. package/dist/dashboard/preview-contract.d.ts.map +1 -0
  381. package/dist/dashboard/preview-contract.js +198 -0
  382. package/dist/dashboard/preview-contract.js.map +1 -0
  383. package/dist/dashboard/preview-guard-page.d.ts +52 -0
  384. package/dist/dashboard/preview-guard-page.d.ts.map +1 -0
  385. package/dist/dashboard/preview-guard-page.js +162 -0
  386. package/dist/dashboard/preview-guard-page.js.map +1 -0
  387. package/dist/dashboard/preview-interaction.d.ts +57 -0
  388. package/dist/dashboard/preview-interaction.d.ts.map +1 -0
  389. package/dist/dashboard/preview-interaction.js +198 -0
  390. package/dist/dashboard/preview-interaction.js.map +1 -0
  391. package/dist/dashboard/preview-proxy.d.ts +113 -0
  392. package/dist/dashboard/preview-proxy.d.ts.map +1 -0
  393. package/dist/dashboard/preview-proxy.js +543 -0
  394. package/dist/dashboard/preview-proxy.js.map +1 -0
  395. package/dist/dashboard/public-redact.d.ts +23 -0
  396. package/dist/dashboard/public-redact.d.ts.map +1 -1
  397. package/dist/dashboard/public-redact.js +90 -21
  398. package/dist/dashboard/public-redact.js.map +1 -1
  399. package/dist/dashboard/request-identity.d.ts +77 -0
  400. package/dist/dashboard/request-identity.d.ts.map +1 -0
  401. package/dist/dashboard/request-identity.js +72 -0
  402. package/dist/dashboard/request-identity.js.map +1 -0
  403. package/dist/dashboard/session-cleanup.d.ts +5 -0
  404. package/dist/dashboard/session-cleanup.d.ts.map +1 -1
  405. package/dist/dashboard/session-cleanup.js +4 -0
  406. package/dist/dashboard/session-cleanup.js.map +1 -1
  407. package/dist/dashboard/settings-write-applier.d.ts +5 -1
  408. package/dist/dashboard/settings-write-applier.d.ts.map +1 -1
  409. package/dist/dashboard/settings-write-applier.js +14 -0
  410. package/dist/dashboard/settings-write-applier.js.map +1 -1
  411. package/dist/dashboard/standing-link.d.ts +76 -0
  412. package/dist/dashboard/standing-link.d.ts.map +1 -0
  413. package/dist/dashboard/standing-link.js +111 -0
  414. package/dist/dashboard/standing-link.js.map +1 -0
  415. package/dist/dashboard/terminal-control.d.ts +105 -0
  416. package/dist/dashboard/terminal-control.d.ts.map +1 -0
  417. package/dist/dashboard/terminal-control.js +296 -0
  418. package/dist/dashboard/terminal-control.js.map +1 -0
  419. package/dist/dashboard/terminal-front-proxy.d.ts +55 -0
  420. package/dist/dashboard/terminal-front-proxy.d.ts.map +1 -0
  421. package/dist/dashboard/terminal-front-proxy.js +397 -0
  422. package/dist/dashboard/terminal-front-proxy.js.map +1 -0
  423. package/dist/dashboard/terminal-view-capability.d.ts +97 -0
  424. package/dist/dashboard/terminal-view-capability.d.ts.map +1 -0
  425. package/dist/dashboard/terminal-view-capability.js +145 -0
  426. package/dist/dashboard/terminal-view-capability.js.map +1 -0
  427. package/dist/dashboard/web/agent-workbench-api.d.ts +59 -0
  428. package/dist/dashboard/web/agent-workbench-api.d.ts.map +1 -0
  429. package/dist/dashboard/web/agent-workbench-api.js +227 -0
  430. package/dist/dashboard/web/agent-workbench-api.js.map +1 -0
  431. package/dist/dashboard/web/agent-workbench-appearance-menu.d.ts +59 -0
  432. package/dist/dashboard/web/agent-workbench-appearance-menu.d.ts.map +1 -0
  433. package/dist/dashboard/web/agent-workbench-appearance-menu.js +195 -0
  434. package/dist/dashboard/web/agent-workbench-appearance-menu.js.map +1 -0
  435. package/dist/dashboard/web/agent-workbench-appearance.d.ts +222 -0
  436. package/dist/dashboard/web/agent-workbench-appearance.d.ts.map +1 -0
  437. package/dist/dashboard/web/agent-workbench-appearance.js +499 -0
  438. package/dist/dashboard/web/agent-workbench-appearance.js.map +1 -0
  439. package/dist/dashboard/web/agent-workbench-capabilities.d.ts +13 -0
  440. package/dist/dashboard/web/agent-workbench-capabilities.d.ts.map +1 -0
  441. package/dist/dashboard/web/agent-workbench-capabilities.js +24 -0
  442. package/dist/dashboard/web/agent-workbench-capabilities.js.map +1 -0
  443. package/dist/dashboard/web/agent-workbench-chat.d.ts +90 -0
  444. package/dist/dashboard/web/agent-workbench-chat.d.ts.map +1 -0
  445. package/dist/dashboard/web/agent-workbench-chat.js +168 -0
  446. package/dist/dashboard/web/agent-workbench-chat.js.map +1 -0
  447. package/dist/dashboard/web/agent-workbench-dock-page.d.ts +3 -0
  448. package/dist/dashboard/web/agent-workbench-dock-page.d.ts.map +1 -0
  449. package/dist/dashboard/web/agent-workbench-dock-page.js +23 -0
  450. package/dist/dashboard/web/agent-workbench-dock-page.js.map +1 -0
  451. package/dist/dashboard/web/agent-workbench-dock-view.d.ts +22 -0
  452. package/dist/dashboard/web/agent-workbench-dock-view.d.ts.map +1 -0
  453. package/dist/dashboard/web/agent-workbench-dock-view.js +76 -0
  454. package/dist/dashboard/web/agent-workbench-dock-view.js.map +1 -0
  455. package/dist/dashboard/web/agent-workbench-model.d.ts +196 -0
  456. package/dist/dashboard/web/agent-workbench-model.d.ts.map +1 -0
  457. package/dist/dashboard/web/agent-workbench-model.js +529 -0
  458. package/dist/dashboard/web/agent-workbench-model.js.map +1 -0
  459. package/dist/dashboard/web/agent-workbench-page.d.ts +3 -0
  460. package/dist/dashboard/web/agent-workbench-page.d.ts.map +1 -0
  461. package/dist/dashboard/web/agent-workbench-page.js +27 -0
  462. package/dist/dashboard/web/agent-workbench-page.js.map +1 -0
  463. package/dist/dashboard/web/agent-workbench-panes.d.ts +49 -0
  464. package/dist/dashboard/web/agent-workbench-panes.d.ts.map +1 -0
  465. package/dist/dashboard/web/agent-workbench-panes.js +468 -0
  466. package/dist/dashboard/web/agent-workbench-panes.js.map +1 -0
  467. package/dist/dashboard/web/agent-workbench-session-list.d.ts +42 -0
  468. package/dist/dashboard/web/agent-workbench-session-list.d.ts.map +1 -0
  469. package/dist/dashboard/web/agent-workbench-session-list.js +353 -0
  470. package/dist/dashboard/web/agent-workbench-session-list.js.map +1 -0
  471. package/dist/dashboard/web/agent-workbench-storage.d.ts +49 -0
  472. package/dist/dashboard/web/agent-workbench-storage.d.ts.map +1 -0
  473. package/dist/dashboard/web/agent-workbench-storage.js +197 -0
  474. package/dist/dashboard/web/agent-workbench-storage.js.map +1 -0
  475. package/dist/dashboard/web/agent-workbench-touch.d.ts +46 -0
  476. package/dist/dashboard/web/agent-workbench-touch.d.ts.map +1 -0
  477. package/dist/dashboard/web/agent-workbench-touch.js +96 -0
  478. package/dist/dashboard/web/agent-workbench-touch.js.map +1 -0
  479. package/dist/dashboard/web/agent-workbench-view.d.ts +34 -0
  480. package/dist/dashboard/web/agent-workbench-view.d.ts.map +1 -0
  481. package/dist/dashboard/web/agent-workbench-view.js +439 -0
  482. package/dist/dashboard/web/agent-workbench-view.js.map +1 -0
  483. package/dist/dashboard/web/app.d.ts.map +1 -1
  484. package/dist/dashboard/web/app.js +63 -2
  485. package/dist/dashboard/web/app.js.map +1 -1
  486. package/dist/dashboard/web/bot-defaults-page.d.ts +18 -0
  487. package/dist/dashboard/web/bot-defaults-page.d.ts.map +1 -1
  488. package/dist/dashboard/web/bot-defaults-page.js +362 -36
  489. package/dist/dashboard/web/bot-defaults-page.js.map +1 -1
  490. package/dist/dashboard/web/bot-defaults.d.ts +8 -0
  491. package/dist/dashboard/web/bot-defaults.d.ts.map +1 -1
  492. package/dist/dashboard/web/bot-defaults.js.map +1 -1
  493. package/dist/dashboard/web/control-csrf.d.ts +4 -0
  494. package/dist/dashboard/web/control-csrf.d.ts.map +1 -0
  495. package/dist/dashboard/web/control-csrf.js +26 -0
  496. package/dist/dashboard/web/control-csrf.js.map +1 -0
  497. package/dist/dashboard/web/dashboard-routes.d.ts.map +1 -1
  498. package/dist/dashboard/web/dashboard-routes.js +2 -0
  499. package/dist/dashboard/web/dashboard-routes.js.map +1 -1
  500. package/dist/dashboard/web/groups-page.d.ts.map +1 -1
  501. package/dist/dashboard/web/groups-page.js +11 -2
  502. package/dist/dashboard/web/groups-page.js.map +1 -1
  503. package/dist/dashboard/web/i18n.d.ts.map +1 -1
  504. package/dist/dashboard/web/i18n.js +140 -6
  505. package/dist/dashboard/web/i18n.js.map +1 -1
  506. package/dist/dashboard/web/overview-page.d.ts.map +1 -1
  507. package/dist/dashboard/web/overview-page.js +3 -2
  508. package/dist/dashboard/web/overview-page.js.map +1 -1
  509. package/dist/dashboard/web/sessions-page.d.ts.map +1 -1
  510. package/dist/dashboard/web/sessions-page.js +41 -1
  511. package/dist/dashboard/web/sessions-page.js.map +1 -1
  512. package/dist/dashboard/web/sessions.d.ts.map +1 -1
  513. package/dist/dashboard/web/sessions.js +5 -1
  514. package/dist/dashboard/web/sessions.js.map +1 -1
  515. package/dist/dashboard/web/settings-page.d.ts +3 -0
  516. package/dist/dashboard/web/settings-page.d.ts.map +1 -1
  517. package/dist/dashboard/web/settings-page.js +56 -10
  518. package/dist/dashboard/web/settings-page.js.map +1 -1
  519. package/dist/dashboard/web/skills-page.d.ts.map +1 -1
  520. package/dist/dashboard/web/skills-page.js +4 -2
  521. package/dist/dashboard/web/skills-page.js.map +1 -1
  522. package/dist/dashboard/web/store.d.ts +27 -2
  523. package/dist/dashboard/web/store.d.ts.map +1 -1
  524. package/dist/dashboard/web/store.js +43 -4
  525. package/dist/dashboard/web/store.js.map +1 -1
  526. package/dist/dashboard/web/ui.d.ts +3 -0
  527. package/dist/dashboard/web/ui.d.ts.map +1 -1
  528. package/dist/dashboard/web/ui.js +11 -0
  529. package/dist/dashboard/web/ui.js.map +1 -1
  530. package/dist/dashboard/web/update-action.d.ts +12 -0
  531. package/dist/dashboard/web/update-action.d.ts.map +1 -1
  532. package/dist/dashboard/web/update-action.js +11 -0
  533. package/dist/dashboard/web/update-action.js.map +1 -1
  534. package/dist/dashboard/workbench-doctor.d.ts +114 -0
  535. package/dist/dashboard/workbench-doctor.d.ts.map +1 -0
  536. package/dist/dashboard/workbench-doctor.js +620 -0
  537. package/dist/dashboard/workbench-doctor.js.map +1 -0
  538. package/dist/dashboard/workbench-ticket.d.ts +165 -0
  539. package/dist/dashboard/workbench-ticket.d.ts.map +1 -0
  540. package/dist/dashboard/workbench-ticket.js +495 -0
  541. package/dist/dashboard/workbench-ticket.js.map +1 -0
  542. package/dist/dashboard-web/app.js +1 -1
  543. package/dist/dashboard-web/chunks/agent-workbench-dock-page-IKAC5CFL.js +1 -0
  544. package/dist/dashboard-web/chunks/agent-workbench-page-M53UN5EB.js +1 -0
  545. package/dist/dashboard-web/chunks/bot-defaults-page-YKE5SDZF.js +10 -0
  546. package/dist/dashboard-web/chunks/chunk-22WIADUT.js +2 -0
  547. package/dist/dashboard-web/chunks/chunk-24ONYQMR.js +1 -0
  548. package/dist/dashboard-web/chunks/{chunk-6O7KXFD2.js → chunk-2W6SCN3M.js} +1 -1
  549. package/dist/dashboard-web/chunks/chunk-4XNJX6B3.js +1 -0
  550. package/dist/dashboard-web/chunks/{chunk-Q2MT4VWH.js → chunk-F6KNPF4R.js} +11 -9
  551. package/dist/dashboard-web/chunks/chunk-FXW3V4JR.js +1 -0
  552. package/dist/dashboard-web/chunks/chunk-G5ZS2YUS.js +1 -0
  553. package/dist/dashboard-web/chunks/chunk-KTQ7B6ZR.js +1 -0
  554. package/dist/dashboard-web/chunks/{chunk-U3ZFSO7E.js → chunk-NACP7BMR.js} +1 -1
  555. package/dist/dashboard-web/chunks/{connectors-page-2KZO5KSJ.js → connectors-page-VOISXXII.js} +1 -1
  556. package/dist/dashboard-web/chunks/{feedback-page-CLVTOLLO.js → feedback-page-RN6HRZMS.js} +1 -1
  557. package/dist/dashboard-web/chunks/groups-page-UQT6DCB7.js +8 -0
  558. package/dist/dashboard-web/chunks/{insights-page-4RPU2CRU.js → insights-page-HJFDYR5N.js} +3 -3
  559. package/dist/dashboard-web/chunks/{monitor-room-OTKQ2CXK.js → monitor-room-V7PCP47V.js} +1 -1
  560. package/dist/dashboard-web/chunks/{monitoring-page-IJPUB6JT.js → monitoring-page-NKEKVQAP.js} +1 -1
  561. package/dist/dashboard-web/chunks/{office-page-QSR3J44Y.js → office-page-GVJF73XW.js} +1 -1
  562. package/dist/dashboard-web/chunks/overview-page-KHLV6VTI.js +1 -0
  563. package/dist/dashboard-web/chunks/{plugin-page-VEGTCEAS.js → plugin-page-J3OF5IY4.js} +1 -1
  564. package/dist/dashboard-web/chunks/{roles-page-6NWJMOB5.js → roles-page-WQIRSOLZ.js} +1 -1
  565. package/dist/dashboard-web/chunks/{schedules-page-6I3LNXD4.js → schedules-page-J2DEY2X6.js} +1 -1
  566. package/dist/dashboard-web/chunks/sessions-page-7BQFEA5P.js +8 -0
  567. package/dist/dashboard-web/chunks/settings-page-BJEIOFJH.js +2 -0
  568. package/dist/dashboard-web/chunks/{skills-page-M2Q6L5CB.js → skills-page-HGIFR3IU.js} +2 -2
  569. package/dist/dashboard-web/chunks/{team-federation-page-7I7FDE3B.js → team-federation-page-MR5ZPL4B.js} +1 -1
  570. package/dist/dashboard-web/chunks/{v3-page-HQXRL65L.js → v3-page-GBR5JWPE.js} +2 -2
  571. package/dist/dashboard-web/chunks/{whiteboards-page-LQKC4TAZ.js → whiteboards-page-QAZM4BN3.js} +1 -1
  572. package/dist/dashboard-web/index.html +8 -1
  573. package/dist/dashboard-web/style.css +2006 -10
  574. package/dist/dashboard.js +1017 -264
  575. package/dist/dashboard.js.map +1 -1
  576. package/dist/dsh-runner.js +8 -1
  577. package/dist/dsh-runner.js.map +1 -1
  578. package/dist/global-config.d.ts +30 -0
  579. package/dist/global-config.d.ts.map +1 -1
  580. package/dist/global-config.js +33 -0
  581. package/dist/global-config.js.map +1 -1
  582. package/dist/i18n/en.d.ts.map +1 -1
  583. package/dist/i18n/en.js +46 -27
  584. package/dist/i18n/en.js.map +1 -1
  585. package/dist/i18n/zh.d.ts.map +1 -1
  586. package/dist/i18n/zh.js +43 -27
  587. package/dist/i18n/zh.js.map +1 -1
  588. package/dist/im/lark/card-builder.d.ts +1 -1
  589. package/dist/im/lark/card-builder.d.ts.map +1 -1
  590. package/dist/im/lark/card-builder.js +22 -6
  591. package/dist/im/lark/card-builder.js.map +1 -1
  592. package/dist/im/lark/card-handler.d.ts.map +1 -1
  593. package/dist/im/lark/card-handler.js +118 -24
  594. package/dist/im/lark/card-handler.js.map +1 -1
  595. package/dist/im/lark/client.d.ts +15 -0
  596. package/dist/im/lark/client.d.ts.map +1 -1
  597. package/dist/im/lark/client.js +30 -0
  598. package/dist/im/lark/client.js.map +1 -1
  599. package/dist/im/lark/event-dispatcher.d.ts +48 -0
  600. package/dist/im/lark/event-dispatcher.d.ts.map +1 -1
  601. package/dist/im/lark/event-dispatcher.js +138 -41
  602. package/dist/im/lark/event-dispatcher.js.map +1 -1
  603. package/dist/im/lark/identity-cache.d.ts +14 -6
  604. package/dist/im/lark/identity-cache.d.ts.map +1 -1
  605. package/dist/im/lark/identity-cache.js +69 -26
  606. package/dist/im/lark/identity-cache.js.map +1 -1
  607. package/dist/im/lark/lark-hosts.d.ts +13 -0
  608. package/dist/im/lark/lark-hosts.d.ts.map +1 -1
  609. package/dist/im/lark/lark-hosts.js +16 -0
  610. package/dist/im/lark/lark-hosts.js.map +1 -1
  611. package/dist/im/lark/overview-card.d.ts +22 -0
  612. package/dist/im/lark/overview-card.d.ts.map +1 -1
  613. package/dist/im/lark/overview-card.js +53 -3
  614. package/dist/im/lark/overview-card.js.map +1 -1
  615. package/dist/im/lark/sessions-card.d.ts.map +1 -1
  616. package/dist/im/lark/sessions-card.js +26 -3
  617. package/dist/im/lark/sessions-card.js.map +1 -1
  618. package/dist/im/lark/workflow-slash-command.d.ts +6 -0
  619. package/dist/im/lark/workflow-slash-command.d.ts.map +1 -1
  620. package/dist/im/lark/workflow-slash-command.js +7 -0
  621. package/dist/im/lark/workflow-slash-command.js.map +1 -1
  622. package/dist/index-daemon.js +27 -4
  623. package/dist/index-daemon.js.map +1 -1
  624. package/dist/index-dashboard.d.ts +3 -0
  625. package/dist/index-dashboard.d.ts.map +1 -0
  626. package/dist/index-dashboard.js +94 -0
  627. package/dist/index-dashboard.js.map +1 -0
  628. package/dist/platform/team-agents-client.d.ts +199 -0
  629. package/dist/platform/team-agents-client.d.ts.map +1 -0
  630. package/dist/platform/team-agents-client.js +263 -0
  631. package/dist/platform/team-agents-client.js.map +1 -0
  632. package/dist/platform/tunnel-client.d.ts +6 -0
  633. package/dist/platform/tunnel-client.d.ts.map +1 -1
  634. package/dist/platform/tunnel-client.js.map +1 -1
  635. package/dist/services/async-trigger-state.d.ts +7 -3
  636. package/dist/services/async-trigger-state.d.ts.map +1 -1
  637. package/dist/services/async-trigger-state.js +28 -0
  638. package/dist/services/async-trigger-state.js.map +1 -1
  639. package/dist/services/async-trigger-store.d.ts +13 -4
  640. package/dist/services/async-trigger-store.d.ts.map +1 -1
  641. package/dist/services/async-trigger-store.js +55 -8
  642. package/dist/services/async-trigger-store.js.map +1 -1
  643. package/dist/services/bot-config-store.d.ts +1 -11
  644. package/dist/services/bot-config-store.d.ts.map +1 -1
  645. package/dist/services/bot-config-store.js +27 -3
  646. package/dist/services/bot-config-store.js.map +1 -1
  647. package/dist/services/bot-profile-store.d.ts +17 -2
  648. package/dist/services/bot-profile-store.d.ts.map +1 -1
  649. package/dist/services/bot-profile-store.js +93 -12
  650. package/dist/services/bot-profile-store.js.map +1 -1
  651. package/dist/services/bridge-fallback-gate.d.ts +15 -7
  652. package/dist/services/bridge-fallback-gate.d.ts.map +1 -1
  653. package/dist/services/bridge-fallback-gate.js +43 -16
  654. package/dist/services/bridge-fallback-gate.js.map +1 -1
  655. package/dist/services/bridge-turn-queue.d.ts +10 -1
  656. package/dist/services/bridge-turn-queue.d.ts.map +1 -1
  657. package/dist/services/bridge-turn-queue.js +29 -9
  658. package/dist/services/bridge-turn-queue.js.map +1 -1
  659. package/dist/services/claude-transcript.d.ts +19 -0
  660. package/dist/services/claude-transcript.d.ts.map +1 -1
  661. package/dist/services/claude-transcript.js +57 -5
  662. package/dist/services/claude-transcript.js.map +1 -1
  663. package/dist/services/codex-app-threads.d.ts +2 -0
  664. package/dist/services/codex-app-threads.d.ts.map +1 -1
  665. package/dist/services/codex-app-threads.js +1 -1
  666. package/dist/services/codex-app-threads.js.map +1 -1
  667. package/dist/services/codex-reasoning-effort.d.ts +8 -0
  668. package/dist/services/codex-reasoning-effort.d.ts.map +1 -1
  669. package/dist/services/codex-reasoning-effort.js +24 -0
  670. package/dist/services/codex-reasoning-effort.js.map +1 -1
  671. package/dist/services/cursor-resume-policy.d.ts.map +1 -1
  672. package/dist/services/cursor-resume-policy.js +15 -3
  673. package/dist/services/cursor-resume-policy.js.map +1 -1
  674. package/dist/services/open-platform-rename.d.ts.map +1 -1
  675. package/dist/services/open-platform-rename.js +3 -2
  676. package/dist/services/open-platform-rename.js.map +1 -1
  677. package/dist/services/ordinary-turn-recovery.d.ts +76 -0
  678. package/dist/services/ordinary-turn-recovery.d.ts.map +1 -0
  679. package/dist/services/ordinary-turn-recovery.js +349 -0
  680. package/dist/services/ordinary-turn-recovery.js.map +1 -0
  681. package/dist/services/peer-cross-ref-store.d.ts +8 -0
  682. package/dist/services/peer-cross-ref-store.d.ts.map +1 -0
  683. package/dist/services/peer-cross-ref-store.js +95 -0
  684. package/dist/services/peer-cross-ref-store.js.map +1 -0
  685. package/dist/services/pi-transcript.d.ts.map +1 -1
  686. package/dist/services/pi-transcript.js +10 -6
  687. package/dist/services/pi-transcript.js.map +1 -1
  688. package/dist/services/resume-fresh-policy.d.ts +17 -0
  689. package/dist/services/resume-fresh-policy.d.ts.map +1 -0
  690. package/dist/services/resume-fresh-policy.js +24 -0
  691. package/dist/services/resume-fresh-policy.js.map +1 -0
  692. package/dist/services/session-group-title.d.ts +1 -0
  693. package/dist/services/session-group-title.d.ts.map +1 -1
  694. package/dist/services/session-group-title.js +16 -1
  695. package/dist/services/session-group-title.js.map +1 -1
  696. package/dist/services/session-groups-store.d.ts +30 -0
  697. package/dist/services/session-groups-store.d.ts.map +1 -1
  698. package/dist/services/session-groups-store.js +26 -4
  699. package/dist/services/session-groups-store.js.map +1 -1
  700. package/dist/services/session-owner-notification.d.ts +9 -0
  701. package/dist/services/session-owner-notification.d.ts.map +1 -0
  702. package/dist/services/session-owner-notification.js +10 -0
  703. package/dist/services/session-owner-notification.js.map +1 -0
  704. package/dist/services/session-owner-reminder-config-store.d.ts +9 -0
  705. package/dist/services/session-owner-reminder-config-store.d.ts.map +1 -0
  706. package/dist/services/session-owner-reminder-config-store.js +24 -0
  707. package/dist/services/session-owner-reminder-config-store.js.map +1 -0
  708. package/dist/services/session-owner-reminder-store.d.ts +5 -0
  709. package/dist/services/session-owner-reminder-store.d.ts.map +1 -0
  710. package/dist/services/session-owner-reminder-store.js +54 -0
  711. package/dist/services/session-owner-reminder-store.js.map +1 -0
  712. package/dist/services/session-store.d.ts +98 -21
  713. package/dist/services/session-store.d.ts.map +1 -1
  714. package/dist/services/session-store.js +406 -48
  715. package/dist/services/session-store.js.map +1 -1
  716. package/dist/services/structured-bridge-clis.d.ts +15 -2
  717. package/dist/services/structured-bridge-clis.d.ts.map +1 -1
  718. package/dist/services/structured-bridge-clis.js +16 -1
  719. package/dist/services/structured-bridge-clis.js.map +1 -1
  720. package/dist/services/transcript-resolver.d.ts +1 -1
  721. package/dist/services/transcript-resolver.d.ts.map +1 -1
  722. package/dist/services/transcript-resolver.js +6 -1
  723. package/dist/services/transcript-resolver.js.map +1 -1
  724. package/dist/setup/bot-config-editor.d.ts.map +1 -1
  725. package/dist/setup/bot-config-editor.js +7 -2
  726. package/dist/setup/bot-config-editor.js.map +1 -1
  727. package/dist/setup/ensure-herdr-integrations.d.ts +13 -0
  728. package/dist/setup/ensure-herdr-integrations.d.ts.map +1 -1
  729. package/dist/setup/ensure-herdr-integrations.js +21 -3
  730. package/dist/setup/ensure-herdr-integrations.js.map +1 -1
  731. package/dist/setup/open-platform-automation.d.ts +1 -0
  732. package/dist/setup/open-platform-automation.d.ts.map +1 -1
  733. package/dist/setup/open-platform-automation.js +107 -7
  734. package/dist/setup/open-platform-automation.js.map +1 -1
  735. package/dist/skills/definitions.d.ts +17 -0
  736. package/dist/skills/definitions.d.ts.map +1 -1
  737. package/dist/skills/definitions.js +78 -8
  738. package/dist/skills/definitions.js.map +1 -1
  739. package/dist/skills/injection-mode.d.ts +24 -3
  740. package/dist/skills/injection-mode.d.ts.map +1 -1
  741. package/dist/skills/injection-mode.js +64 -15
  742. package/dist/skills/injection-mode.js.map +1 -1
  743. package/dist/skills/installer.d.ts +18 -0
  744. package/dist/skills/installer.d.ts.map +1 -1
  745. package/dist/skills/installer.js +45 -1
  746. package/dist/skills/installer.js.map +1 -1
  747. package/dist/types.d.ts +222 -10
  748. package/dist/types.d.ts.map +1 -1
  749. package/dist/utils/bot-routing.d.ts +1 -1
  750. package/dist/utils/bot-routing.d.ts.map +1 -1
  751. package/dist/utils/bot-routing.js.map +1 -1
  752. package/dist/utils/child-env.d.ts +92 -2
  753. package/dist/utils/child-env.d.ts.map +1 -1
  754. package/dist/utils/child-env.js +195 -1
  755. package/dist/utils/child-env.js.map +1 -1
  756. package/dist/utils/cli-usage-limit.d.ts +25 -14
  757. package/dist/utils/cli-usage-limit.d.ts.map +1 -1
  758. package/dist/utils/cli-usage-limit.js +25 -15
  759. package/dist/utils/cli-usage-limit.js.map +1 -1
  760. package/dist/utils/daemon-rejection-guard.d.ts +35 -0
  761. package/dist/utils/daemon-rejection-guard.d.ts.map +1 -0
  762. package/dist/utils/daemon-rejection-guard.js +101 -0
  763. package/dist/utils/daemon-rejection-guard.js.map +1 -0
  764. package/dist/utils/dashboard-env.d.ts +53 -0
  765. package/dist/utils/dashboard-env.d.ts.map +1 -0
  766. package/dist/utils/dashboard-env.js +116 -0
  767. package/dist/utils/dashboard-env.js.map +1 -0
  768. package/dist/utils/global-install.d.ts.map +1 -1
  769. package/dist/utils/global-install.js +61 -5
  770. package/dist/utils/global-install.js.map +1 -1
  771. package/dist/utils/install-diagnostics.d.ts +14 -7
  772. package/dist/utils/install-diagnostics.d.ts.map +1 -1
  773. package/dist/utils/install-diagnostics.js +20 -11
  774. package/dist/utils/install-diagnostics.js.map +1 -1
  775. package/dist/utils/local-dev-update.d.ts +132 -0
  776. package/dist/utils/local-dev-update.d.ts.map +1 -0
  777. package/dist/utils/local-dev-update.js +176 -0
  778. package/dist/utils/local-dev-update.js.map +1 -0
  779. package/dist/utils/pending-input-queue.d.ts +12 -1
  780. package/dist/utils/pending-input-queue.d.ts.map +1 -1
  781. package/dist/utils/pending-input-queue.js.map +1 -1
  782. package/dist/worker.js +1517 -236
  783. package/dist/worker.js.map +1 -1
  784. package/dist/workflows/definition.d.ts +68 -68
  785. package/dist/workflows/events/payloads.d.ts +14 -14
  786. package/dist/workflows/events/schema.d.ts +312 -312
  787. package/dist/workflows/migration/v2-run-archive-schema.d.ts +40 -40
  788. package/dist/workflows/v3/cli-run.d.ts.map +1 -1
  789. package/dist/workflows/v3/cli-run.js +7 -0
  790. package/dist/workflows/v3/cli-run.js.map +1 -1
  791. package/dist/workflows/v3/goal-cli.d.ts +3 -0
  792. package/dist/workflows/v3/goal-cli.d.ts.map +1 -1
  793. package/dist/workflows/v3/goal-cli.js +11 -0
  794. package/dist/workflows/v3/goal-cli.js.map +1 -1
  795. package/dist/workflows/v3/run-envelope.d.ts +144 -144
  796. package/package.json +7 -2
  797. package/dist/cli/pm2-god-admission.d.ts +0 -8
  798. package/dist/cli/pm2-god-admission.d.ts.map +0 -1
  799. package/dist/cli/pm2-god-admission.js +0 -25
  800. package/dist/cli/pm2-god-admission.js.map +0 -1
  801. package/dist/core/riff-shutdown-detach.d.ts.map +0 -1
  802. package/dist/core/riff-shutdown-detach.js.map +0 -1
  803. package/dist/core/riff-worker-shutdown-readiness.d.ts.map +0 -1
  804. package/dist/core/riff-worker-shutdown-readiness.js.map +0 -1
  805. package/dist/dashboard-web/chunks/bot-defaults-page-4RENHE7J.js +0 -10
  806. package/dist/dashboard-web/chunks/chunk-2WQDS65D.js +0 -1
  807. package/dist/dashboard-web/chunks/chunk-G5XGBCM6.js +0 -1
  808. package/dist/dashboard-web/chunks/chunk-WLIVBPJC.js +0 -1
  809. package/dist/dashboard-web/chunks/groups-page-HLASRTSY.js +0 -8
  810. package/dist/dashboard-web/chunks/overview-page-6OK63V4V.js +0 -1
  811. package/dist/dashboard-web/chunks/sessions-page-B2TXGJDO.js +0 -8
  812. package/dist/dashboard-web/chunks/settings-page-6KJADSC6.js +0 -2
@@ -0,0 +1,682 @@
1
+ /**
2
+ * Types for the mojo (@byted/mojo) backend.
3
+ *
4
+ * Kept in a separate module so `mojo.ts` (the CLI adapter) and
5
+ * `mojo-backend.ts` can share them without a cycle, and so the event shapes —
6
+ * which were established empirically against @byted/mojo 1.0.10 — are
7
+ * documented in one place.
8
+ */
9
+ /**
10
+ * Keys that are INTERNAL plumbing and must never be accepted from user config.
11
+ *
12
+ * Each has a platform-wide source of truth that is frozen onto the session at
13
+ * creation (`Session.agentFrozen`), so a second entry point inside the `mojo`
14
+ * block would let live edits override a frozen identity — e.g. cancelling an
15
+ * orphaned remote session through a binary or wrapper the bot only gained
16
+ * afterwards, reaching the wrong gateway or tenant.
17
+ *
18
+ * bots.json parsing and `/config set mojo` both reject these outright rather
19
+ * than dropping them silently, because a silent drop reads as "applied".
20
+ */
21
+ export const MOJO_INTERNAL_CONFIG_KEYS = [
22
+ 'bin',
23
+ 'cwd',
24
+ 'model',
25
+ 'disableCliBypass',
26
+ 'wrapperCli',
27
+ 'resumeCliSessionId',
28
+ 'extraCliArgs',
29
+ 'builtinSkillBlock',
30
+ ];
31
+ /** The top-level bot field that owns each internal key, for error messages. */
32
+ export const MOJO_INTERNAL_KEY_OWNER = {
33
+ bin: 'cliPathOverride',
34
+ cwd: 'workingDir',
35
+ model: 'model',
36
+ disableCliBypass: 'disableCliBypass',
37
+ wrapperCli: 'wrapperCli',
38
+ resumeCliSessionId: '(managed by botmux)',
39
+ extraCliArgs: 'CLI_EXTRA_ARGS',
40
+ builtinSkillBlock: 'skillInjection',
41
+ };
42
+ /**
43
+ * Control-plane fields that decide WHERE and AS WHOM a session executes:
44
+ * cloud-vs-host execution, the API endpoint, the PPE profile, and the
45
+ * workspace/agent it is routed to.
46
+ *
47
+ * These are frozen onto the session at creation (see MojoSessionIdentity). A live
48
+ * bot edit must never retroactively move an existing session between execution
49
+ * modes or tenants — a cold resume would otherwise resume, or a `/close` cancel,
50
+ * against a different endpoint than the one that created the remote session.
51
+ *
52
+ * Credentials (`jwt` / `jwtEnv` / `env`) are deliberately NOT here: they must
53
+ * stay live so a rotated token takes effect, and a plaintext JWT must not be
54
+ * persisted into session state.
55
+ */
56
+ export const MOJO_IDENTITY_KEYS = [
57
+ 'cloud',
58
+ 'localDaemon',
59
+ 'baseUrl',
60
+ 'ppeEnv',
61
+ 'workspaceId',
62
+ 'agentId',
63
+ ];
64
+ /**
65
+ * The child's effective environment, layered lowest → highest precedence:
66
+ *
67
+ * base (worker-supplied session env / process env)
68
+ * → bot `env` (bots.json top-level, already sanitized)
69
+ * → `mojo.env` (bots.json mojo block — highest)
70
+ *
71
+ * This exists so the launcher and the backend cannot disagree. They previously
72
+ * layered independently and the launcher omitted `mojo.env` entirely, so a
73
+ * wrapper binary was resolved against a PATH the child never actually ran with:
74
+ * a same-named program earlier on the bot-level PATH shadowed the one the
75
+ * operator pinned in `mojo.env.PATH`. For a wrapper that carries auth or acts
76
+ * as a gateway, that means executing under the wrong identity.
77
+ *
78
+ * Callers that need control-plane hygiene must still strip
79
+ * MOJO_CONTROL_ENV_KEYS afterwards; this helper only fixes the layering.
80
+ */
81
+ export function buildEffectiveChildEnv(layers) {
82
+ return {
83
+ ...(layers.base ?? {}),
84
+ ...(layers.botEnv ?? {}),
85
+ ...(layers.mojoEnv ?? {}),
86
+ };
87
+ }
88
+ /**
89
+ * Environment variables that carry the SAME control-plane decisions as the frozen
90
+ * identity keys. They exist because the mojo CLI reads its endpoint/profile from
91
+ * env, which makes `env` a back door around the freeze: a live
92
+ * `env: { AGENT_BASE_URL: ... }` would move an existing session to another tenant
93
+ * even though `baseUrl` itself is frozen.
94
+ *
95
+ * buildEnv() therefore DELETES all of these after merging and re-derives them
96
+ * from the (frozen) config alone. `X_JWT_TOKEN` is deliberately absent: a rotated
97
+ * credential must keep taking effect.
98
+ */
99
+ export const MOJO_CONTROL_ENV_KEYS = [
100
+ 'AGENT_BASE_URL',
101
+ 'MOJO_PPE_ENV',
102
+ 'AGENT_LOCAL_DAEMON',
103
+ ];
104
+ /**
105
+ * The one env var name the mojo CLI actually reads its credential from.
106
+ *
107
+ * `jwtEnv` only tells the DAEMON where to look up the value; buildEnv() always
108
+ * hands the resolved token to the child as this name. That asymmetry is why the
109
+ * remote-execution proof exempts this fixed name and never `jwtEnv` — see
110
+ * mojoUnprovableEnvKeys.
111
+ */
112
+ export const MOJO_CANONICAL_JWT_ENV_KEY = 'X_JWT_TOKEN';
113
+ /** True only when the remote session is provably gone (cancelled or finished). */
114
+ export function isMojoRemoteGone(outcome) {
115
+ return outcome.kind === 'cancelled' || outcome.kind === 'already_terminal';
116
+ }
117
+ /**
118
+ * Pick just the control-plane identity out of a (already normalized) config.
119
+ * Absent keys are omitted rather than stored as undefined, so the frozen record
120
+ * stays a faithful snapshot of what was actually configured.
121
+ */
122
+ export function pickMojoSessionIdentity(cfg) {
123
+ const out = {};
124
+ if (!cfg)
125
+ return out;
126
+ for (const key of MOJO_IDENTITY_KEYS) {
127
+ const value = cfg[key];
128
+ if (value !== undefined)
129
+ out[key] = value;
130
+ }
131
+ return out;
132
+ }
133
+ /**
134
+ * Which control-plane keys differ between the frozen snapshot and live config,
135
+ * for the log line explaining why a session kept its original control plane.
136
+ * Empty array = identical.
137
+ *
138
+ * Returns KEY NAMES ONLY, never values. `baseUrl` is a URL that may legitimately
139
+ * carry userinfo (`https://user:pass@host`) or a signed query
140
+ * (`?sig=<token>`) — the URL validator allows both, because they are valid
141
+ * endpoints — so logging old/new values verbatim would write credentials into the
142
+ * daemon log. The key name is all an operator needs to know what changed; the
143
+ * value is already in their own config.
144
+ */
145
+ export function diffMojoSessionIdentity(frozen, live) {
146
+ const changes = [];
147
+ for (const key of MOJO_IDENTITY_KEYS) {
148
+ const a = frozen[key];
149
+ const b = live[key];
150
+ if (a === b)
151
+ continue;
152
+ // Booleans are not secrets and the transition is the whole point
153
+ // (cloud→host execution is the dangerous one), so those are shown.
154
+ changes.push(typeof a === 'boolean' || typeof b === 'boolean'
155
+ ? `${key}: ${String(a)} → ${String(b)}`
156
+ : key);
157
+ }
158
+ return changes;
159
+ }
160
+ /**
161
+ * Combine the user's `mojo` block with the platform-owned launch identity into
162
+ * the ONE config both the worker (live session) and the daemon (workerless
163
+ * `/close`) run on.
164
+ *
165
+ * Sharing this matters: the daemon cancels an orphaned session WITHOUT a worker,
166
+ * so it never calls spawn() and cannot pick these up from SpawnOpts. Building
167
+ * the config only in the worker meant a bot running fine on a custom binary /
168
+ * per-bot JWT could not be cancelled once its worker died — leaving the remote
169
+ * session burning cloud sandbox time while still holding injected credentials.
170
+ *
171
+ * There is no precedence question to answer here: the launch identity has EXACTLY
172
+ * one source (`generic`, which callers populate from the session's frozen
173
+ * values). Anything the user put under those keys in the `mojo` block is stripped
174
+ * — both config entry points reject them, so reaching this function with one set
175
+ * means a hand-edited file, and honouring it would let a live edit override a
176
+ * frozen session identity.
177
+ */
178
+ export function buildEffectiveMojoConfig(mojoBlock, generic) {
179
+ const block = { ...(mojoBlock ?? {}) };
180
+ for (const key of MOJO_INTERNAL_CONFIG_KEYS)
181
+ delete block[key];
182
+ const merged = block;
183
+ const bin = emptyToUndefined(generic.cliPathOverride);
184
+ if (bin !== undefined)
185
+ merged.bin = bin;
186
+ if (generic.workingDir !== undefined)
187
+ merged.cwd = generic.workingDir;
188
+ const model = emptyToUndefined(generic.model);
189
+ if (model !== undefined)
190
+ merged.model = model;
191
+ if (generic.disableCliBypass !== undefined) {
192
+ merged.disableCliBypass = generic.disableCliBypass;
193
+ }
194
+ // Per-bot env is the LOWER layer: an explicit `mojo.env` entry wins. This one
195
+ // IS a genuine two-source merge — `mojo.env` has no top-level equivalent.
196
+ if (generic.env || merged.env) {
197
+ merged.env = { ...(generic.env ?? {}), ...(merged.env ?? {}) };
198
+ }
199
+ if (generic.resumeCliSessionId !== undefined) {
200
+ merged.resumeCliSessionId = generic.resumeCliSessionId;
201
+ }
202
+ const wrapperCli = emptyToUndefined(generic.wrapperCli);
203
+ if (wrapperCli !== undefined)
204
+ merged.wrapperCli = wrapperCli;
205
+ if (generic.extraCliArgs && generic.extraCliArgs.length > 0) {
206
+ merged.extraCliArgs = [...generic.extraCliArgs];
207
+ }
208
+ const builtinSkillBlock = emptyToUndefined(generic.builtinSkillBlock);
209
+ if (builtinSkillBlock !== undefined)
210
+ merged.builtinSkillBlock = builtinSkillBlock;
211
+ return merged;
212
+ }
213
+ /** Treat a blank/whitespace-only override as unset. */
214
+ function emptyToUndefined(value) {
215
+ const trimmed = value?.trim();
216
+ return trimmed ? trimmed : undefined;
217
+ }
218
+ /**
219
+ * CLI flags that carry platform-owned decisions: the control plane, the execution
220
+ * mode, the approval bypass, the model, and the resume lineage.
221
+ *
222
+ * `CLI_EXTRA_ARGS` is appended AFTER the backend's own flags so an operator can
223
+ * override behaviour knobs (that is the documented contract), but with
224
+ * last-value-wins parsing that also let it override these — making env a second
225
+ * entry point for the very identity that is frozen per session. They are rejected
226
+ * instead.
227
+ *
228
+ * Long forms only: the mojo CLI has no short aliases for any of these, and
229
+ * `-r` is covered separately because it is the resume lineage.
230
+ */
231
+ const MOJO_RESERVED_CLI_FLAGS = new Set([
232
+ '--workspace-id',
233
+ '--agent-id',
234
+ '--cloud',
235
+ '--no-cloud',
236
+ '--model',
237
+ '--yolo',
238
+ '--no-yolo',
239
+ '--resume',
240
+ '-r',
241
+ '--continue',
242
+ '-c',
243
+ '--background',
244
+ '--output-format',
245
+ '--include-partial',
246
+ ]);
247
+ /**
248
+ * Reject platform-owned flags in operator-supplied extra args.
249
+ *
250
+ * Handles `--flag value`, `--flag=value` and the bare boolean form, since all
251
+ * three reach the CLI identically. Returns the offending flags, empty when clean.
252
+ */
253
+ export function findReservedMojoCliFlags(args) {
254
+ const offending = [];
255
+ for (const arg of args) {
256
+ if (!arg.startsWith('-'))
257
+ continue;
258
+ // `--flag=value` and `--flag value` are the same flag to the CLI.
259
+ const flag = arg.includes('=') ? arg.slice(0, arg.indexOf('=')) : arg;
260
+ if (MOJO_RESERVED_CLI_FLAGS.has(flag) && !offending.includes(flag)) {
261
+ offending.push(flag);
262
+ }
263
+ }
264
+ return offending;
265
+ }
266
+ /**
267
+ * Can this mojo session prove it executes nothing locally?
268
+ *
269
+ * A launch prefix (wrapperCli) breaks the proof: it runs BEFORE the binary and
270
+ * can rewrite the very environment the decision depends on — `env
271
+ * AGENT_LOCAL_DAEMON=1 mojo` re-enables host execution after buildEnv() set it to
272
+ * 0, and buildEnv cannot defend against it because the prefix is applied later.
273
+ * Inspecting the wrapper string is not enough either: a wrapper may be a script
274
+ * that sets the variable internally.
275
+ *
276
+ * So a wrapper makes the session unprovable, and the local sandbox stays engaged.
277
+ * The launcher's ENV is treated exactly the same way, and for the same reason —
278
+ * see mojoUnprovableEnvKeys.
279
+ */
280
+ export function mojoUnprovableEnvKeys(
281
+ // `jwtEnv` is accepted (callers spread a whole config in) but deliberately
282
+ // IGNORED — see the exemption note below. Keep it in the signature so those
283
+ // spreads keep type-checking; do NOT read it.
284
+ cfg) {
285
+ const keys = Object.keys(cfg?.env ?? {});
286
+ if (keys.length === 0)
287
+ return [];
288
+ // ALLOWLIST, deliberately: the set of variables that can redirect execution
289
+ // (PATH, NODE_OPTIONS, LD_PRELOAD, LD_LIBRARY_PATH, DYLD_*, …) cannot be
290
+ // enumerated completely — the same reason `env` is not live-patchable, see
291
+ // MOJO_LIVE_PATCH_KEYS below. So anything NOT known-harmless voids the proof.
292
+ //
293
+ // The exemption is the FIXED canonical name and nothing else. It must never be
294
+ // derived from `jwtEnv`, because that made the allowlist operator-extensible:
295
+ // `jwtEnv: 'PATH'` + `env: { PATH: <dir with a fake mojo> }` passed validation
296
+ // (PATH is not a reserved key) and then reported ZERO unprovable keys, so
297
+ // isMojoFullyRemote() returned true — the local sandbox was skipped and device
298
+ // isolation classified the session safe_remote, while resolveBin() picked the
299
+ // binary off that very PATH. Same trick with NODE_OPTIONS / LD_PRELOAD / DYLD_*.
300
+ //
301
+ // Ignoring `jwtEnv` here is not a compatibility break in the child: buildEnv()
302
+ // resolves whatever `jwtEnv` names and hands the VALUE to the CLI as
303
+ // X_JWT_TOKEN regardless (see MojoBackend.buildEnv). `jwtEnv` is a "where to
304
+ // read it from" pointer, never a name the child reads — so it has no business
305
+ // widening a proof about which binary executes.
306
+ return keys.filter(k => k !== MOJO_CANONICAL_JWT_ENV_KEY).sort();
307
+ }
308
+ /**
309
+ * Single source of truth for the execution mode a mojo config asks for.
310
+ *
311
+ * buildArgs (`--cloud`), buildEnv (`AGENT_LOCAL_DAEMON`) and the spawn audit
312
+ * log MUST all derive from this one function — they were previously three
313
+ * hand-kept copies and drifted twice (review F2: the audit label disagreed
314
+ * with the env for cloud+localDaemon both set, and for non-boolean values
315
+ * smuggled past strictBoolean by an old frozen snapshot).
316
+ *
317
+ * Precedence (review F3): an explicit `localDaemon: true` WINS over
318
+ * `cloud: true` and suppresses the `--cloud` flag entirely — previously both
319
+ * were emitted and the CLI received contradictory instructions. This stays
320
+ * consistent with isMojoFullyRemote(), which already returns false whenever
321
+ * `localDaemon === true`.
322
+ *
323
+ * Strict comparisons on purpose: a non-boolean survivor (e.g. the string
324
+ * "false" in a frozen snapshot written before strictBoolean existed) fails
325
+ * closed into the sandbox fallback rather than enabling host execution.
326
+ */
327
+ export function deriveMojoExecutionMode(cfg) {
328
+ const cloud = cfg?.cloud;
329
+ const local = cfg?.localDaemon;
330
+ if (local === true) {
331
+ return {
332
+ agentLocalDaemon: '1',
333
+ passCloudFlag: false,
334
+ label: cloud === true
335
+ ? 'host (explicit localDaemon; cloud flag suppressed)'
336
+ : 'host (explicit localDaemon)',
337
+ };
338
+ }
339
+ if (cloud === true) {
340
+ return { agentLocalDaemon: '0', passCloudFlag: true, label: 'cloud-sandbox (--cloud)' };
341
+ }
342
+ if (local === undefined) {
343
+ return { agentLocalDaemon: '1', passCloudFlag: false, label: 'host (default)' };
344
+ }
345
+ return {
346
+ agentLocalDaemon: '0',
347
+ passCloudFlag: false,
348
+ label: local === false
349
+ ? 'sandbox-fallback (localDaemon=false, cloud off)'
350
+ : 'sandbox-fallback (invalid localDaemon value)',
351
+ };
352
+ }
353
+ export function isMojoFullyRemote(cfg) {
354
+ if (cfg?.cloud !== true)
355
+ return false;
356
+ if (cfg.localDaemon === true)
357
+ return false;
358
+ if (cfg.wrapperCli?.trim())
359
+ return false;
360
+ // The launcher ENV is part of the proof, not just the wrapper. resolveBin()
361
+ // picks the binary off the effective child PATH, so `env: { PATH: <dir with a
362
+ // fake mojo> }` runs different code while cloud/localDaemon/wrapperCli all
363
+ // still look clean — and loader hooks (LD_PRELOAD / NODE_OPTIONS / DYLD_*) do
364
+ // the same to the real binary.
365
+ //
366
+ // This is not hypothetical drift: `env` is NOT part of the frozen identity, so
367
+ // sessionMojoConfig() re-merges it from LIVE bot config on every cold refork.
368
+ // A session created as cloud-only could therefore be switched to a local fake
369
+ // after a daemon restart while this function kept returning true — bypassing
370
+ // the local sandbox AND getting classified safe_remote by device isolation.
371
+ if (mojoUnprovableEnvKeys(cfg).length > 0)
372
+ return false;
373
+ return true;
374
+ }
375
+ /**
376
+ * WHY this config cannot prove it runs nothing locally — one actionable
377
+ * explanation, or `undefined` when the proof holds.
378
+ *
379
+ * Shared deliberately. There are two independent places that refuse a
380
+ * not-provably-remote mojo session — the OPTIONAL sandbox gate
381
+ * (backendSandboxCompatibilityError) and the MANDATORY device-credential
382
+ * isolation path (which rewrites spawnBin, so MojoBackend.spawn refuses the
383
+ * wrapper it never asked for) — and they used to explain it differently. The
384
+ * device path told operators to "run fully remote (cloud on, localDaemon off)"
385
+ * even when cloud was already on and the real blocker was an env key, which is
386
+ * advice that cannot be acted on. Both now read from this one function.
387
+ *
388
+ * Returns key NAMES only, never values: these strings reach logs and chat, and
389
+ * one of the keys is by definition the operator's credential variable.
390
+ *
391
+ * Ordering mirrors isMojoFullyRemote so the two can never disagree about whether
392
+ * there is a problem — only about how much detail to print.
393
+ */
394
+ export function mojoRemoteProofFailureReason(cfg) {
395
+ if (cfg?.cloud !== true) {
396
+ return 'mojo.cloud is not enabled, so tools run on this host — '
397
+ + 'set mojo.cloud=true (and leave mojo.localDaemon off).';
398
+ }
399
+ if (cfg.localDaemon === true) {
400
+ return 'mojo.localDaemon is on, which deliberately runs tools on this host — '
401
+ + 'turn it off to keep execution remote.';
402
+ }
403
+ const wrapper = cfg.wrapperCli?.trim();
404
+ if (wrapper) {
405
+ return 'a launch prefix (wrapperCli) runs before the binary and can rewrite the '
406
+ + 'environment the decision depends on, so it voids the proof.';
407
+ }
408
+ const unprovable = mojoUnprovableEnvKeys(cfg);
409
+ if (unprovable.length === 0)
410
+ return undefined;
411
+ const listed = unprovable.join(', ');
412
+ const dangerous = 'they can change which binary is executed (PATH) or inject into it '
413
+ + '(LD_PRELOAD / NODE_OPTIONS / DYLD_*)';
414
+ // A custom `jwtEnv` key is not dangerous in itself, so the generic wording reads
415
+ // as a false accusation against a JWT variable. Explain the real rule and give
416
+ // the two migrations that keep the credential working AND the session provable.
417
+ const credentialKey = cfg.jwtEnv?.trim();
418
+ const hitsCredential = !!credentialKey
419
+ && credentialKey !== MOJO_CANONICAL_JWT_ENV_KEY
420
+ && unprovable.includes(credentialKey);
421
+ if (!hitsCredential) {
422
+ return `the bot's \`env\` / \`mojo.env\` sets ${listed} — ${dangerous}.`;
423
+ }
424
+ const rest = unprovable.filter(k => k !== credentialKey);
425
+ const credentialAdvice = `\`${credentialKey}\` holds this bot's credential, but the proof exempts only `
426
+ + `\`${MOJO_CANONICAL_JWT_ENV_KEY}\` — a config-supplied name cannot be told apart `
427
+ + 'from one that redirects execution. Set `mojo.jwt` instead, or move that '
428
+ + "variable to the daemon's own environment (neither is a proof input).";
429
+ if (rest.length === 0) {
430
+ return `the bot's \`env\` / \`mojo.env\` sets ${listed}. ${credentialAdvice}`;
431
+ }
432
+ // Mixed case: migrating the credential alone would NOT make this provable, and a
433
+ // message that implies otherwise sends the operator round the loop a second time.
434
+ return `the bot's \`env\` / \`mojo.env\` sets ${listed}. ${credentialAdvice} `
435
+ + `Migrating the credential is not sufficient on its own: ${rest.join(', ')} `
436
+ + `must be removed as well — ${dangerous}.`;
437
+ }
438
+ /**
439
+ * The ONLY setting that may change on a live session: the JWT.
440
+ *
441
+ * Deliberately this narrow. The previous version allowed an arbitrary `env` patch,
442
+ * which review showed is equivalent to replacing the launcher: with no
443
+ * `cliPathOverride` the backend spawns the bare name `mojo`, so a live
444
+ * `env: { PATH: <dir with a fake mojo> }` executes a different binary on the next
445
+ * turn — and `NODE_OPTIONS` / `LD_PRELOAD` / `DYLD_*` are comparable. Enumerating
446
+ * dangerous variables cannot be made complete, so `env` is not patchable at all.
447
+ *
448
+ * Note this is not about a compromised daemon (which already has more authority
449
+ * than this); the problem was that a completely legitimate, validated patch could
450
+ * change what gets executed.
451
+ *
452
+ * Everything else in `mojo` (env / stream / systemPrompt / idleTimeoutSec) now
453
+ * requires a new session, matching how the control plane already behaves.
454
+ */
455
+ export const MOJO_LIVE_PATCH_KEYS = ['jwt'];
456
+ /**
457
+ * Build the complete live snapshot for a session.
458
+ *
459
+ * Resolves `jwtEnv` here rather than shipping the env map, so credential rotation
460
+ * works without giving a patch the power to change PATH / loader variables.
461
+ * Always returns an explicit value (`null` when there is no credential), because
462
+ * an omitted field cannot express "cleared".
463
+ */
464
+ export function pickMojoLivePatch(cfg, sources = {}) {
465
+ const literal = cfg?.jwt?.trim();
466
+ if (literal)
467
+ return { jwt: literal };
468
+ // Resolve the configured key across the same layers buildEnv() would, reading
469
+ // only the VALUE — the map itself is never shipped, which is what stops a
470
+ // patch from rewriting PATH / loader variables.
471
+ const key = cfg?.jwtEnv?.trim() || MOJO_CANONICAL_JWT_ENV_KEY;
472
+ const fromMojoEnv = cfg?.env?.[key]?.trim();
473
+ if (fromMojoEnv)
474
+ return { jwt: fromMojoEnv };
475
+ const fromGeneric = sources.genericEnv?.[key]?.trim();
476
+ if (fromGeneric)
477
+ return { jwt: fromGeneric };
478
+ const fromAmbient = (sources.ambientEnv ?? process.env)[key]?.trim();
479
+ // Always explicit: `null` is the tombstone that lets a deleted credential
480
+ // actually be cleared on the backend.
481
+ return { jwt: fromAmbient ? fromAmbient : null };
482
+ }
483
+ /**
484
+ * Validate a live patch arriving over IPC.
485
+ *
486
+ * Separate from normalizeMojoConfig on purpose: that one validates the USER's
487
+ * config block, where `jwt` must be a non-empty string. A live patch is a
488
+ * different shape — `null` is a meaningful tombstone — so reusing the config
489
+ * validator rejected every clear request and the backend never saw it.
490
+ */
491
+ export function normalizeMojoLivePatch(raw) {
492
+ if (raw === undefined || raw === null)
493
+ return { ok: true, value: {} };
494
+ if (typeof raw !== 'object' || Array.isArray(raw)) {
495
+ return { ok: false, errors: ['mojo live patch must be a JSON object'] };
496
+ }
497
+ const errors = [];
498
+ const value = {};
499
+ for (const [key, val] of Object.entries(raw)) {
500
+ if (key !== 'jwt') {
501
+ // Deliberately strict: an `env` patch would be equivalent to replacing
502
+ // the launcher (see MOJO_LIVE_PATCH_KEYS), so anything beyond `jwt` is
503
+ // a bug or a stale payload, not something to accept quietly.
504
+ errors.push(`mojo live patch does not accept "${key}"`);
505
+ continue;
506
+ }
507
+ if (val === undefined)
508
+ continue;
509
+ if (val === null) {
510
+ value.jwt = null;
511
+ continue;
512
+ }
513
+ if (typeof val !== 'string' || !val.trim()) {
514
+ errors.push('mojo live patch jwt must be a non-empty string or null');
515
+ continue;
516
+ }
517
+ value.jwt = val;
518
+ }
519
+ return errors.length > 0 ? { ok: false, errors } : { ok: true, value };
520
+ }
521
+ /** Field-name → validator, so unknown keys are rejected rather than passed through. */
522
+ const MOJO_FIELD_VALIDATORS = {
523
+ workspaceId: nonEmptyString,
524
+ agentId: nonEmptyString,
525
+ cloud: strictBoolean,
526
+ idleTimeoutSec: positiveInteger,
527
+ stream: strictBoolean,
528
+ systemPrompt: plainString,
529
+ jwt: nonEmptyString,
530
+ jwtEnv: jwtEnvVarName,
531
+ baseUrl: httpUrl,
532
+ localDaemon: strictBoolean,
533
+ ppeEnv: nonEmptyString,
534
+ env: stringMap,
535
+ };
536
+ function strictBoolean(v) {
537
+ // The reason this is strict rather than coerced: `localDaemon: "false"` used
538
+ // to satisfy `!== true` in the sandbox check (bypassing the local sandbox)
539
+ // while being truthy in buildEnv (setting AGENT_LOCAL_DAEMON=1). That
540
+ // combination skips isolation AND enables host execution.
541
+ return typeof v === 'boolean' ? undefined : 'must be a boolean (true/false, not a string)';
542
+ }
543
+ function positiveInteger(v) {
544
+ return typeof v === 'number' && Number.isInteger(v) && v > 0
545
+ ? undefined
546
+ : 'must be a positive integer';
547
+ }
548
+ function plainString(v) {
549
+ return typeof v === 'string' ? undefined : 'must be a string';
550
+ }
551
+ function nonEmptyString(v) {
552
+ if (typeof v !== 'string')
553
+ return 'must be a string';
554
+ return v.trim() ? undefined : 'must not be empty';
555
+ }
556
+ function envVarName(v) {
557
+ if (typeof v !== 'string')
558
+ return 'must be a string';
559
+ return /^[A-Za-z_][A-Za-z0-9_]*$/.test(v)
560
+ ? undefined
561
+ : 'must be a valid environment variable name';
562
+ }
563
+ /**
564
+ * `jwtEnv` is not just a name lookup: buildEnv() DELETES `env[jwtEnv]` before
565
+ * re-deriving the credential, so the name doubles as a deletion primitive. A
566
+ * shape-only check let `jwtEnv: "BOTMUX_MOJO_TREE_NONCE"` erase the containment
567
+ * tree nonce — the only signal that survives setsid + reparent — turning the
568
+ * termination proof blind while every gate still reported success. Reserved
569
+ * botmux keys and control-plane keys are therefore rejected by NAME, with the
570
+ * same delegation (not a copied list) the env-map validator uses.
571
+ */
572
+ function jwtEnvVarName(v) {
573
+ const shape = envVarName(v);
574
+ if (shape)
575
+ return shape;
576
+ const key = v;
577
+ if (isReservedPerBotEnvKey(key)) {
578
+ return `must not name ${key} — botmux owns this variable (session identity, `
579
+ + 'CLI data root, or bot credential), and buildEnv() would delete it';
580
+ }
581
+ if (MOJO_CONTROL_ENV_KEYS.includes(key)) {
582
+ return `must not name ${key} — it is control-plane state frozen per session`;
583
+ }
584
+ return undefined;
585
+ }
586
+ function httpUrl(v) {
587
+ if (typeof v !== 'string' || !v.trim())
588
+ return 'must be a non-empty string';
589
+ let parsed;
590
+ try {
591
+ parsed = new URL(v);
592
+ }
593
+ catch {
594
+ return 'must be a valid URL';
595
+ }
596
+ return parsed.protocol === 'http:' || parsed.protocol === 'https:'
597
+ ? undefined
598
+ : 'must be an http(s) URL';
599
+ }
600
+ /**
601
+ * Same reserved-key rule the top-level `env` uses. Imported rather than
602
+ * duplicated: per-bot-env.ts is itself a dependency-free leaf, so this keeps
603
+ * mojo-types cheap for the many tests that pull it in.
604
+ */
605
+ import { isReservedPerBotEnvKey } from '../../core/per-bot-env.js';
606
+ /** Same rule the top-level `env` uses — see per-bot-env.ts. */
607
+ const ENV_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
608
+ function stringMap(v) {
609
+ if (!v || typeof v !== 'object' || Array.isArray(v))
610
+ return 'must be a JSON object';
611
+ const control = new Set(MOJO_CONTROL_ENV_KEYS);
612
+ for (const [k, val] of Object.entries(v)) {
613
+ if (typeof val !== 'string')
614
+ return `value for "${k}" must be a string`;
615
+ if (!ENV_KEY_RE.test(k))
616
+ return `"${k}" is not a valid environment variable name`;
617
+ // `mojo.env` is the HIGHEST-precedence layer of the child env, so it must
618
+ // honour the SAME reserved list as the top-level `env`. Otherwise the block
619
+ // botmux already enforces there (session routing, CLI data roots, bot
620
+ // credentials) is bypassed just by moving the key in here — and it then
621
+ // WINS the merge. Delegated to isReservedPerBotEnvKey rather than
622
+ // re-listed, because a second copy of that set would drift.
623
+ if (isReservedPerBotEnvKey(k)) {
624
+ return `must not set ${k} — botmux owns this variable (session identity, `
625
+ + 'CLI data root, or bot credential); per-bot `env` rejects it too';
626
+ }
627
+ // Reject rather than silently strip: buildEnv() removes these anyway, and
628
+ // an operator who sets AGENT_BASE_URL here would otherwise believe their
629
+ // endpoint took effect while the session kept its frozen one.
630
+ if (control.has(k)) {
631
+ const owner = k === 'AGENT_BASE_URL' ? 'baseUrl'
632
+ : k === 'MOJO_PPE_ENV' ? 'ppeEnv'
633
+ : 'localDaemon';
634
+ return `must not set ${k} — it is control-plane state frozen per session; `
635
+ + `use the \`${owner}\` setting instead`;
636
+ }
637
+ }
638
+ return undefined;
639
+ }
640
+ /**
641
+ * Validate a raw `mojo` block from ANY entry point (bots.json, `/config set
642
+ * mojo`, dashboard, or a defensive check before it reaches the worker).
643
+ *
644
+ * Fails closed on: unknown keys (typos like `cluod` would silently disable the
645
+ * cloud sandbox), internal launch-identity keys (they have top-level owners and
646
+ * are frozen on the session), and wrong types.
647
+ *
648
+ * Type strictness is a SECURITY requirement here, not tidiness — see
649
+ * strictBoolean for the concrete fail-open it prevents.
650
+ */
651
+ export function normalizeMojoConfig(raw) {
652
+ if (raw === undefined || raw === null)
653
+ return { ok: true, value: {} };
654
+ if (typeof raw !== 'object' || Array.isArray(raw)) {
655
+ return { ok: false, errors: ['mojo must be a JSON object'] };
656
+ }
657
+ const errors = [];
658
+ const value = {};
659
+ const internal = new Set(MOJO_INTERNAL_CONFIG_KEYS);
660
+ for (const [key, val] of Object.entries(raw)) {
661
+ if (internal.has(key)) {
662
+ errors.push(`mojo.${key} is not configurable inside the mojo block — `
663
+ + `use the top-level \`${MOJO_INTERNAL_KEY_OWNER[key] ?? key}\` instead`);
664
+ continue;
665
+ }
666
+ const validate = MOJO_FIELD_VALIDATORS[key];
667
+ if (!validate) {
668
+ errors.push(`mojo.${key} is not a recognized setting`);
669
+ continue;
670
+ }
671
+ // An explicit `undefined` (from JSON round-trips) means "unset", not invalid.
672
+ if (val === undefined)
673
+ continue;
674
+ const problem = validate(val);
675
+ if (problem)
676
+ errors.push(`mojo.${key} ${problem}`);
677
+ else
678
+ value[key] = val;
679
+ }
680
+ return errors.length > 0 ? { ok: false, errors } : { ok: true, value: value };
681
+ }
682
+ //# sourceMappingURL=mojo-types.js.map