@jungjaehoon/mama-os 0.77.0 → 0.79.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 (338) hide show
  1. package/CHANGELOG.md +446 -0
  2. package/README.md +59 -30
  3. package/db/migrations/002-model-runs-parent-index.sql +11 -0
  4. package/db/migrations/003-upkeep-settled.sql +15 -0
  5. package/dist/api/google-read-actions.d.ts +30 -0
  6. package/dist/api/google-read-actions.d.ts.map +1 -0
  7. package/dist/api/google-read-actions.js +256 -0
  8. package/dist/api/google-read-actions.js.map +1 -0
  9. package/dist/api/record-actions.d.ts.map +1 -1
  10. package/dist/api/record-actions.js +23 -5
  11. package/dist/api/record-actions.js.map +1 -1
  12. package/dist/api/report-handler.d.ts +0 -6
  13. package/dist/api/report-handler.d.ts.map +1 -1
  14. package/dist/api/report-handler.js +0 -54
  15. package/dist/api/report-handler.js.map +1 -1
  16. package/dist/api/security-events.d.ts +1 -1
  17. package/dist/api/security-events.d.ts.map +1 -1
  18. package/dist/api/security-events.js +10 -1
  19. package/dist/api/security-events.js.map +1 -1
  20. package/dist/api/source-actions.d.ts +9 -0
  21. package/dist/api/source-actions.d.ts.map +1 -1
  22. package/dist/api/source-actions.js +49 -0
  23. package/dist/api/source-actions.js.map +1 -1
  24. package/dist/api/viewer-request-security.d.ts +14 -1
  25. package/dist/api/viewer-request-security.d.ts.map +1 -1
  26. package/dist/api/viewer-request-security.js +26 -3
  27. package/dist/api/viewer-request-security.js.map +1 -1
  28. package/dist/api/viewer-server.d.ts +8 -0
  29. package/dist/api/viewer-server.d.ts.map +1 -1
  30. package/dist/api/viewer-server.js +66 -0
  31. package/dist/api/viewer-server.js.map +1 -1
  32. package/dist/api/work-actions.d.ts +19 -2
  33. package/dist/api/work-actions.d.ts.map +1 -1
  34. package/dist/api/work-actions.js +42 -2
  35. package/dist/api/work-actions.js.map +1 -1
  36. package/dist/cli/commands/backfill.d.ts.map +1 -1
  37. package/dist/cli/commands/backfill.js +1 -0
  38. package/dist/cli/commands/backfill.js.map +1 -1
  39. package/dist/cli/commands/backup.d.ts +14 -0
  40. package/dist/cli/commands/backup.d.ts.map +1 -0
  41. package/dist/cli/commands/backup.js +174 -0
  42. package/dist/cli/commands/backup.js.map +1 -0
  43. package/dist/cli/commands/control.d.ts +44 -0
  44. package/dist/cli/commands/control.d.ts.map +1 -0
  45. package/dist/cli/commands/control.js +354 -0
  46. package/dist/cli/commands/control.js.map +1 -0
  47. package/dist/cli/commands/daemon.d.ts +60 -3
  48. package/dist/cli/commands/daemon.d.ts.map +1 -1
  49. package/dist/cli/commands/daemon.js +454 -78
  50. package/dist/cli/commands/daemon.js.map +1 -1
  51. package/dist/cli/commands/doctor.d.ts +13 -0
  52. package/dist/cli/commands/doctor.d.ts.map +1 -0
  53. package/dist/cli/commands/doctor.js +216 -0
  54. package/dist/cli/commands/doctor.js.map +1 -0
  55. package/dist/cli/commands/init-questions.d.ts +98 -0
  56. package/dist/cli/commands/init-questions.d.ts.map +1 -0
  57. package/dist/cli/commands/init-questions.js +420 -0
  58. package/dist/cli/commands/init-questions.js.map +1 -0
  59. package/dist/cli/commands/init-section.d.ts +13 -0
  60. package/dist/cli/commands/init-section.d.ts.map +1 -0
  61. package/dist/cli/commands/init-section.js +375 -0
  62. package/dist/cli/commands/init-section.js.map +1 -0
  63. package/dist/cli/commands/init.d.ts +56 -2
  64. package/dist/cli/commands/init.d.ts.map +1 -1
  65. package/dist/cli/commands/init.js +562 -350
  66. package/dist/cli/commands/init.js.map +1 -1
  67. package/dist/cli/commands/logs.d.ts +9 -0
  68. package/dist/cli/commands/logs.d.ts.map +1 -0
  69. package/dist/cli/commands/logs.js +109 -0
  70. package/dist/cli/commands/logs.js.map +1 -0
  71. package/dist/cli/commands/node-move.d.ts +20 -0
  72. package/dist/cli/commands/node-move.d.ts.map +1 -0
  73. package/dist/cli/commands/node-move.js +289 -0
  74. package/dist/cli/commands/node-move.js.map +1 -0
  75. package/dist/cli/commands/register-owner.d.ts +3 -0
  76. package/dist/cli/commands/register-owner.d.ts.map +1 -1
  77. package/dist/cli/commands/register-owner.js +14 -0
  78. package/dist/cli/commands/register-owner.js.map +1 -1
  79. package/dist/cli/commands/restore.d.ts +16 -0
  80. package/dist/cli/commands/restore.d.ts.map +1 -0
  81. package/dist/cli/commands/restore.js +137 -0
  82. package/dist/cli/commands/restore.js.map +1 -0
  83. package/dist/cli/commands/service.d.ts +44 -0
  84. package/dist/cli/commands/service.d.ts.map +1 -0
  85. package/dist/cli/commands/service.js +306 -0
  86. package/dist/cli/commands/service.js.map +1 -0
  87. package/dist/cli/commands/tools.d.ts +1 -1
  88. package/dist/cli/commands/tools.d.ts.map +1 -1
  89. package/dist/cli/commands/tools.js +8 -3
  90. package/dist/cli/commands/tools.js.map +1 -1
  91. package/dist/cli/commands/uninstall.d.ts +7 -0
  92. package/dist/cli/commands/uninstall.d.ts.map +1 -0
  93. package/dist/cli/commands/uninstall.js +335 -0
  94. package/dist/cli/commands/uninstall.js.map +1 -0
  95. package/dist/cli/commands/update.d.ts +59 -0
  96. package/dist/cli/commands/update.d.ts.map +1 -0
  97. package/dist/cli/commands/update.js +948 -0
  98. package/dist/cli/commands/update.js.map +1 -0
  99. package/dist/cli/index.js +74 -23
  100. package/dist/cli/index.js.map +1 -1
  101. package/dist/cli/launch-files.d.ts +119 -0
  102. package/dist/cli/launch-files.d.ts.map +1 -1
  103. package/dist/cli/launch-files.js +324 -15
  104. package/dist/cli/launch-files.js.map +1 -1
  105. package/dist/cli/prompt.d.ts +2 -1
  106. package/dist/cli/prompt.d.ts.map +1 -1
  107. package/dist/cli/prompt.js +5 -2
  108. package/dist/cli/prompt.js.map +1 -1
  109. package/dist/cli/runtime/backend-probe.d.ts +34 -0
  110. package/dist/cli/runtime/backend-probe.d.ts.map +1 -0
  111. package/dist/cli/runtime/backend-probe.js +83 -0
  112. package/dist/cli/runtime/backend-probe.js.map +1 -0
  113. package/dist/cli/runtime/backup.d.ts +130 -0
  114. package/dist/cli/runtime/backup.d.ts.map +1 -0
  115. package/dist/cli/runtime/backup.js +592 -0
  116. package/dist/cli/runtime/backup.js.map +1 -0
  117. package/dist/cli/runtime/daemon-control.d.ts +169 -0
  118. package/dist/cli/runtime/daemon-control.d.ts.map +1 -0
  119. package/dist/cli/runtime/daemon-control.js +441 -0
  120. package/dist/cli/runtime/daemon-control.js.map +1 -0
  121. package/dist/cli/runtime/default-roots.d.ts +27 -0
  122. package/dist/cli/runtime/default-roots.d.ts.map +1 -0
  123. package/dist/cli/runtime/default-roots.js +61 -0
  124. package/dist/cli/runtime/default-roots.js.map +1 -0
  125. package/dist/cli/runtime/diagnostics.d.ts +68 -0
  126. package/dist/cli/runtime/diagnostics.d.ts.map +1 -0
  127. package/dist/cli/runtime/diagnostics.js +1139 -0
  128. package/dist/cli/runtime/diagnostics.js.map +1 -0
  129. package/dist/cli/runtime/init-state.d.ts +20 -0
  130. package/dist/cli/runtime/init-state.d.ts.map +1 -0
  131. package/dist/cli/runtime/init-state.js +51 -0
  132. package/dist/cli/runtime/init-state.js.map +1 -0
  133. package/dist/cli/runtime/install-kind.d.ts +54 -0
  134. package/dist/cli/runtime/install-kind.d.ts.map +1 -0
  135. package/dist/cli/runtime/install-kind.js +164 -0
  136. package/dist/cli/runtime/install-kind.js.map +1 -0
  137. package/dist/cli/runtime/node-move-journal.d.ts +44 -0
  138. package/dist/cli/runtime/node-move-journal.d.ts.map +1 -0
  139. package/dist/cli/runtime/node-move-journal.js +48 -0
  140. package/dist/cli/runtime/node-move-journal.js.map +1 -0
  141. package/dist/cli/runtime/release-check.d.ts +94 -0
  142. package/dist/cli/runtime/release-check.d.ts.map +1 -0
  143. package/dist/cli/runtime/release-check.js +316 -0
  144. package/dist/cli/runtime/release-check.js.map +1 -0
  145. package/dist/cli/runtime/restore.d.ts +98 -0
  146. package/dist/cli/runtime/restore.d.ts.map +1 -0
  147. package/dist/cli/runtime/restore.js +756 -0
  148. package/dist/cli/runtime/restore.js.map +1 -0
  149. package/dist/cli/runtime/setup-page.d.ts +57 -0
  150. package/dist/cli/runtime/setup-page.d.ts.map +1 -0
  151. package/dist/cli/runtime/setup-page.js +266 -0
  152. package/dist/cli/runtime/setup-page.js.map +1 -0
  153. package/dist/cli/runtime/source-tools.d.ts +60 -0
  154. package/dist/cli/runtime/source-tools.d.ts.map +1 -0
  155. package/dist/cli/runtime/source-tools.js +170 -0
  156. package/dist/cli/runtime/source-tools.js.map +1 -0
  157. package/dist/cli/runtime/systemd-service.d.ts +13 -0
  158. package/dist/cli/runtime/systemd-service.d.ts.map +1 -0
  159. package/dist/cli/runtime/systemd-service.js +32 -0
  160. package/dist/cli/runtime/systemd-service.js.map +1 -0
  161. package/dist/cli/runtime/telegram-pairing.d.ts +73 -0
  162. package/dist/cli/runtime/telegram-pairing.d.ts.map +1 -0
  163. package/dist/cli/runtime/telegram-pairing.js +184 -0
  164. package/dist/cli/runtime/telegram-pairing.js.map +1 -0
  165. package/dist/cli/runtime/update-journal.d.ts +135 -0
  166. package/dist/cli/runtime/update-journal.d.ts.map +1 -0
  167. package/dist/cli/runtime/update-journal.js +144 -0
  168. package/dist/cli/runtime/update-journal.js.map +1 -0
  169. package/dist/cli/runtime/update-progress.d.ts +95 -0
  170. package/dist/cli/runtime/update-progress.d.ts.map +1 -0
  171. package/dist/cli/runtime/update-progress.js +154 -0
  172. package/dist/cli/runtime/update-progress.js.map +1 -0
  173. package/dist/cli/runtime/update-request.d.ts +58 -0
  174. package/dist/cli/runtime/update-request.d.ts.map +1 -0
  175. package/dist/cli/runtime/update-request.js +172 -0
  176. package/dist/cli/runtime/update-request.js.map +1 -0
  177. package/dist/connectors/calendar/index.d.ts +5 -1
  178. package/dist/connectors/calendar/index.d.ts.map +1 -1
  179. package/dist/connectors/calendar/index.js +19 -28
  180. package/dist/connectors/calendar/index.js.map +1 -1
  181. package/dist/connectors/chatwork/index.d.ts.map +1 -1
  182. package/dist/connectors/chatwork/index.js +7 -3
  183. package/dist/connectors/chatwork/index.js.map +1 -1
  184. package/dist/connectors/config-loader.d.ts +7 -1
  185. package/dist/connectors/config-loader.d.ts.map +1 -1
  186. package/dist/connectors/config-loader.js +11 -2
  187. package/dist/connectors/config-loader.js.map +1 -1
  188. package/dist/connectors/discord/index.d.ts.map +1 -1
  189. package/dist/connectors/discord/index.js +4 -3
  190. package/dist/connectors/discord/index.js.map +1 -1
  191. package/dist/connectors/drive/index.d.ts.map +1 -1
  192. package/dist/connectors/drive/index.js +15 -13
  193. package/dist/connectors/drive/index.js.map +1 -1
  194. package/dist/connectors/framework/gws-utils.d.ts +62 -0
  195. package/dist/connectors/framework/gws-utils.d.ts.map +1 -1
  196. package/dist/connectors/framework/gws-utils.js +133 -3
  197. package/dist/connectors/framework/gws-utils.js.map +1 -1
  198. package/dist/connectors/framework/polling-scheduler.d.ts.map +1 -1
  199. package/dist/connectors/framework/polling-scheduler.js +12 -11
  200. package/dist/connectors/framework/polling-scheduler.js.map +1 -1
  201. package/dist/connectors/framework/types.d.ts +24 -0
  202. package/dist/connectors/framework/types.d.ts.map +1 -1
  203. package/dist/connectors/framework/types.js +9 -0
  204. package/dist/connectors/framework/types.js.map +1 -1
  205. package/dist/connectors/gmail/index.d.ts.map +1 -1
  206. package/dist/connectors/gmail/index.js +14 -13
  207. package/dist/connectors/gmail/index.js.map +1 -1
  208. package/dist/connectors/imessage/index.d.ts.map +1 -1
  209. package/dist/connectors/imessage/index.js +2 -1
  210. package/dist/connectors/imessage/index.js.map +1 -1
  211. package/dist/connectors/index.d.ts +4 -4
  212. package/dist/connectors/index.d.ts.map +1 -1
  213. package/dist/connectors/index.js +4 -10
  214. package/dist/connectors/index.js.map +1 -1
  215. package/dist/connectors/notion/index.d.ts.map +1 -1
  216. package/dist/connectors/notion/index.js +5 -3
  217. package/dist/connectors/notion/index.js.map +1 -1
  218. package/dist/connectors/sheets/index.d.ts.map +1 -1
  219. package/dist/connectors/sheets/index.js +17 -12
  220. package/dist/connectors/sheets/index.js.map +1 -1
  221. package/dist/connectors/slack/index.d.ts.map +1 -1
  222. package/dist/connectors/slack/index.js +9 -3
  223. package/dist/connectors/slack/index.js.map +1 -1
  224. package/dist/connectors/telegram/index.d.ts.map +1 -1
  225. package/dist/connectors/telegram/index.js +4 -3
  226. package/dist/connectors/telegram/index.js.map +1 -1
  227. package/dist/connectors/trello/index.d.ts +1 -1
  228. package/dist/connectors/trello/index.d.ts.map +1 -1
  229. package/dist/connectors/trello/index.js +10 -5
  230. package/dist/connectors/trello/index.js.map +1 -1
  231. package/dist/gateways/discord.d.ts +6 -0
  232. package/dist/gateways/discord.d.ts.map +1 -1
  233. package/dist/gateways/discord.js +38 -27
  234. package/dist/gateways/discord.js.map +1 -1
  235. package/dist/gateways/slack.d.ts +6 -0
  236. package/dist/gateways/slack.d.ts.map +1 -1
  237. package/dist/gateways/slack.js +38 -27
  238. package/dist/gateways/slack.js.map +1 -1
  239. package/dist/gateways/telegram-commands.d.ts +124 -0
  240. package/dist/gateways/telegram-commands.d.ts.map +1 -0
  241. package/dist/gateways/telegram-commands.js +131 -0
  242. package/dist/gateways/telegram-commands.js.map +1 -0
  243. package/dist/gateways/telegram.d.ts +20 -0
  244. package/dist/gateways/telegram.d.ts.map +1 -1
  245. package/dist/gateways/telegram.js +138 -34
  246. package/dist/gateways/telegram.js.map +1 -1
  247. package/dist/gateways/turn-contract.d.ts +11 -0
  248. package/dist/gateways/turn-contract.d.ts.map +1 -1
  249. package/dist/runtime/action-surface.d.ts +1 -1
  250. package/dist/runtime/action-surface.d.ts.map +1 -1
  251. package/dist/runtime/action-surface.js +10 -0
  252. package/dist/runtime/action-surface.js.map +1 -1
  253. package/dist/runtime/backend-security.d.ts +26 -2
  254. package/dist/runtime/backend-security.d.ts.map +1 -1
  255. package/dist/runtime/backend-security.js +63 -10
  256. package/dist/runtime/backend-security.js.map +1 -1
  257. package/dist/runtime/config.d.ts +3 -0
  258. package/dist/runtime/config.d.ts.map +1 -1
  259. package/dist/runtime/config.js +4 -4
  260. package/dist/runtime/config.js.map +1 -1
  261. package/dist/runtime/connectors.d.ts +21 -1
  262. package/dist/runtime/connectors.d.ts.map +1 -1
  263. package/dist/runtime/connectors.js +28 -17
  264. package/dist/runtime/connectors.js.map +1 -1
  265. package/dist/runtime/core-db.d.ts.map +1 -1
  266. package/dist/runtime/core-db.js +2 -0
  267. package/dist/runtime/core-db.js.map +1 -1
  268. package/dist/runtime/member-paths.d.ts +15 -7
  269. package/dist/runtime/member-paths.d.ts.map +1 -1
  270. package/dist/runtime/member-paths.js +64 -12
  271. package/dist/runtime/member-paths.js.map +1 -1
  272. package/dist/runtime/member-session.d.ts +4 -0
  273. package/dist/runtime/member-session.d.ts.map +1 -1
  274. package/dist/runtime/member-session.js +23 -2
  275. package/dist/runtime/member-session.js.map +1 -1
  276. package/dist/runtime/native-session.d.ts +2 -0
  277. package/dist/runtime/native-session.d.ts.map +1 -1
  278. package/dist/runtime/native-session.js +1 -0
  279. package/dist/runtime/native-session.js.map +1 -1
  280. package/dist/runtime/owner-runtime.d.ts +63 -1
  281. package/dist/runtime/owner-runtime.d.ts.map +1 -1
  282. package/dist/runtime/owner-runtime.js +180 -3
  283. package/dist/runtime/owner-runtime.js.map +1 -1
  284. package/dist/runtime/owner-system-prompt.d.ts.map +1 -1
  285. package/dist/runtime/owner-system-prompt.js +6 -5
  286. package/dist/runtime/owner-system-prompt.js.map +1 -1
  287. package/dist/runtime/principal-access.d.ts +2 -0
  288. package/dist/runtime/principal-access.d.ts.map +1 -1
  289. package/dist/runtime/principal-access.js +7 -0
  290. package/dist/runtime/principal-access.js.map +1 -1
  291. package/dist/runtime/principal-sessions.d.ts.map +1 -1
  292. package/dist/runtime/principal-sessions.js +8 -1
  293. package/dist/runtime/principal-sessions.js.map +1 -1
  294. package/dist/runtime/record-orders.d.ts.map +1 -1
  295. package/dist/runtime/record-orders.js +3 -29
  296. package/dist/runtime/record-orders.js.map +1 -1
  297. package/dist/runtime/report-scheduler.d.ts +9 -2
  298. package/dist/runtime/report-scheduler.d.ts.map +1 -1
  299. package/dist/runtime/report-scheduler.js +37 -10
  300. package/dist/runtime/report-scheduler.js.map +1 -1
  301. package/dist/runtime/rotating-log.d.ts +44 -0
  302. package/dist/runtime/rotating-log.d.ts.map +1 -0
  303. package/dist/runtime/rotating-log.js +124 -0
  304. package/dist/runtime/rotating-log.js.map +1 -0
  305. package/dist/runtime/stimulus-delivery.d.ts +3 -0
  306. package/dist/runtime/stimulus-delivery.d.ts.map +1 -1
  307. package/dist/runtime/stimulus-delivery.js +19 -3
  308. package/dist/runtime/stimulus-delivery.js.map +1 -1
  309. package/dist/runtime/tools-paths.d.ts +7 -0
  310. package/dist/runtime/tools-paths.d.ts.map +1 -1
  311. package/dist/runtime/tools-paths.js +11 -5
  312. package/dist/runtime/tools-paths.js.map +1 -1
  313. package/dist/runtime/upkeep-close.d.ts +17 -0
  314. package/dist/runtime/upkeep-close.d.ts.map +1 -0
  315. package/dist/runtime/upkeep-close.js +127 -0
  316. package/dist/runtime/upkeep-close.js.map +1 -0
  317. package/dist/runtime/upkeep-orders.d.ts +124 -0
  318. package/dist/runtime/upkeep-orders.d.ts.map +1 -0
  319. package/dist/runtime/upkeep-orders.js +310 -0
  320. package/dist/runtime/upkeep-orders.js.map +1 -0
  321. package/dist/runtime/upkeep-reconcile.d.ts +25 -0
  322. package/dist/runtime/upkeep-reconcile.d.ts.map +1 -0
  323. package/dist/runtime/upkeep-reconcile.js +231 -0
  324. package/dist/runtime/upkeep-reconcile.js.map +1 -0
  325. package/dist/runtime/upkeep-writeback.d.ts +22 -0
  326. package/dist/runtime/upkeep-writeback.d.ts.map +1 -0
  327. package/dist/runtime/upkeep-writeback.js +203 -0
  328. package/dist/runtime/upkeep-writeback.js.map +1 -0
  329. package/dist/tools/document-toolkit.d.ts +2 -0
  330. package/dist/tools/document-toolkit.d.ts.map +1 -1
  331. package/dist/tools/document-toolkit.js +2 -0
  332. package/dist/tools/document-toolkit.js.map +1 -1
  333. package/dist/utils/untrusted-content.d.ts.map +1 -1
  334. package/dist/utils/untrusted-content.js +8 -1
  335. package/dist/utils/untrusted-content.js.map +1 -1
  336. package/install/install.sh +457 -0
  337. package/install/node.json +9 -0
  338. package/package.json +5 -5
@@ -19,7 +19,14 @@ function isUntrustedExternalEvidenceTool(toolName) {
19
19
  toolName === 'source.attachment.list' ||
20
20
  toolName === 'source.attachment.download' ||
21
21
  toolName === 'manage.wiki.read' ||
22
- toolName === 'report.read');
22
+ toolName === 'report.read' ||
23
+ // Live connector reads (readsConnector): card and file text is written by other people, and
24
+ // the board reconcile order reads cards in a turn with no person in it.
25
+ toolName === 'trello.read' ||
26
+ toolName === 'drive.read' ||
27
+ toolName === 'drive.download' ||
28
+ // Mail, events, sheets and documents are written by other people too.
29
+ toolName === 'google.read');
23
30
  }
24
31
  const OPEN_MARKER = '<<<UNTRUSTED-CONTENT';
25
32
  const END_MARKER = '<<<END-UNTRUSTED-CONTENT>>>';
@@ -1 +1 @@
1
- {"version":3,"file":"untrusted-content.js","sourceRoot":"","sources":["../../src/utils/untrusted-content.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,0EAYC;AAKD,oDAWC;AAKD,8CAIC;AArCD,SAAgB,+BAA+B,CAAC,QAAgB;IAC9D,OAAO;IACL,mEAAmE;IACnE,QAAQ,KAAK,UAAU;QACvB,QAAQ,KAAK,wBAAwB;QACrC,QAAQ,KAAK,eAAe;QAC5B,QAAQ,KAAK,aAAa;QAC1B,QAAQ,KAAK,wBAAwB;QACrC,QAAQ,KAAK,4BAA4B;QACzC,QAAQ,KAAK,kBAAkB;QAC/B,QAAQ,KAAK,aAAa,CAC3B,CAAC;AACJ,CAAC;AAED,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAC3C,MAAM,UAAU,GAAG,6BAA6B,CAAC;AAEjD,SAAgB,oBAAoB,CAAC,MAAc,EAAE,OAAe;IAClE,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC;IAC5D,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IACrE,OAAO;QACL,GAAG,WAAW,WAAW,UAAU,KAAK;QACxC,8EAA8E;QAC9E,kFAAkF;QAClF,yDAAyD;QACzD,IAAI;QACJ,UAAU;KACX,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAAC,IAAY,EAAE,IAAa;IAC3D,OAAO,+BAA+B,CAAC,IAAI,CAAC;QAC1C,CAAC,CAAC,oBAAoB,CAAC,IAAI,EAAE,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;QAC5F,CAAC,CAAC,IAAI,CAAC;AACX,CAAC"}
1
+ {"version":3,"file":"untrusted-content.js","sourceRoot":"","sources":["../../src/utils/untrusted-content.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,0EAmBC;AAKD,oDAWC;AAKD,8CAIC;AA5CD,SAAgB,+BAA+B,CAAC,QAAgB;IAC9D,OAAO;IACL,mEAAmE;IACnE,QAAQ,KAAK,UAAU;QACvB,QAAQ,KAAK,wBAAwB;QACrC,QAAQ,KAAK,eAAe;QAC5B,QAAQ,KAAK,aAAa;QAC1B,QAAQ,KAAK,wBAAwB;QACrC,QAAQ,KAAK,4BAA4B;QACzC,QAAQ,KAAK,kBAAkB;QAC/B,QAAQ,KAAK,aAAa;QAC1B,4FAA4F;QAC5F,wEAAwE;QACxE,QAAQ,KAAK,aAAa;QAC1B,QAAQ,KAAK,YAAY;QACzB,QAAQ,KAAK,gBAAgB;QAC7B,sEAAsE;QACtE,QAAQ,KAAK,aAAa,CAC3B,CAAC;AACJ,CAAC;AAED,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAC3C,MAAM,UAAU,GAAG,6BAA6B,CAAC;AAEjD,SAAgB,oBAAoB,CAAC,MAAc,EAAE,OAAe;IAClE,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC;IAC5D,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IACrE,OAAO;QACL,GAAG,WAAW,WAAW,UAAU,KAAK;QACxC,8EAA8E;QAC9E,kFAAkF;QAClF,yDAAyD;QACzD,IAAI;QACJ,UAAU;KACX,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAAC,IAAY,EAAE,IAAa;IAC3D,OAAO,+BAA+B,CAAC,IAAI,CAAC;QAC1C,CAAC,CAAC,oBAAoB,CAAC,IAAI,EAAE,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;QAC5F,CAAC,CAAC,IAAI,CAAC;AACX,CAAC"}
@@ -0,0 +1,457 @@
1
+ #!/bin/sh
2
+ # MAMA OS installer (docs/development/work/install.md).
3
+ #
4
+ # curl -fsSL https://github.com/jungjaehoon-lifegamez/MAMA/releases/latest/download/install.sh | sh -s -- --backend claude --non-interactive
5
+ #
6
+ # It asks nothing: the person's agent runs it from a shell without a terminal. It installs a pinned
7
+ # Node.js into ~/.mama/node, MAMA OS into ~/.mama/npm, the `mama` command into ~/.mama/bin, the
8
+ # backend CLI with its vendor's installer when none that runs is found, and a marked PATH block in
9
+ # the login shell's startup file; then it runs `mama init --non-interactive`, which opens the setup
10
+ # page for the bot token and the pairing code.
11
+ #
12
+ # The whole body is one function, called on the last line, so a download cut off midway runs
13
+ # nothing. scripts/sync-versions.js writes the version lines from package.json and
14
+ # install/node.json.
15
+
16
+ mama_install() {
17
+ set -eu
18
+ # mama init makes ~/.mama 0700 only when it creates it; this script may create it first.
19
+ umask 077
20
+
21
+ MAMA_OS_VERSION=0.79.0
22
+ NODE_VERSION=22.23.4
23
+ NODE_SHA256_DARWIN_ARM64=c9e1dbc748b33ed2d14f42445191ecaf14c56259c7a9a26d0042c49ec2b66428
24
+ NODE_SHA256_DARWIN_X64=efcc2b0db6f94bf53eddb038fe2b370277a042bd29e4f19b8f8e23598795b819
25
+ NODE_SHA256_LINUX_X64=b8492284c76a54baf58d61668dd0e41ee0fc98adabf9503d30f05d08f55b4406
26
+ NODE_SHA256_LINUX_ARM64=f7a1e486dbc8b286847815b477d4fb5e9fb963ed4489c3e1588853d685f589f9
27
+
28
+ say() { printf '%s\n' "$*"; }
29
+ fail() {
30
+ printf 'mama install: %s\n' "$*" >&2
31
+ exit 1
32
+ }
33
+ # One shell word, single-quoted.
34
+ quote() { printf "'%s'" "$(printf '%s' "$1" | sed "s/'/'\\\\''/g")"; }
35
+
36
+ usage() {
37
+ say 'Usage: install.sh [--backend claude|codex] [--non-interactive | --no-init]'
38
+ say ' --backend the backend CLI MAMA runs; a new install needs it'
39
+ say ' --non-interactive run mama init --non-interactive: it reads MAMA_INIT_* variables and'
40
+ say ' opens the setup page; a new install needs it or --no-init'
41
+ say ' --no-init install only, and print the init command'
42
+ say 'An install already set up needs no option: it runs mama init --non-interactive.'
43
+ say 'Piped from curl: curl -fsSL <url> | sh -s -- --backend claude --non-interactive'
44
+ }
45
+
46
+ backend=''
47
+ init_mode=''
48
+ while [ $# -gt 0 ]; do
49
+ case $1 in
50
+ --backend)
51
+ [ $# -ge 2 ] || fail '--backend needs claude or codex'
52
+ backend=$2
53
+ shift 2
54
+ ;;
55
+ --backend=*)
56
+ backend=${1#--backend=}
57
+ shift
58
+ ;;
59
+ --non-interactive | --no-init)
60
+ [ -z "$init_mode" ] || fail 'choose one of --non-interactive and --no-init'
61
+ init_mode=${1#--}
62
+ shift
63
+ ;;
64
+ -h | --help)
65
+ usage
66
+ return 0
67
+ ;;
68
+ *)
69
+ usage >&2
70
+ fail "unknown option: $1"
71
+ ;;
72
+ esac
73
+ done
74
+ case $backend in
75
+ '' | claude | codex) ;;
76
+ *) fail "--backend must be claude or codex, not $backend" ;;
77
+ esac
78
+
79
+ [ -n "${HOME:-}" ] && [ -d "$HOME" ] || fail 'HOME is not set to a folder'
80
+ root=$HOME/.mama
81
+ node_dir=$root/node
82
+ prefix=$root/npm
83
+ package=$prefix/lib/node_modules/@jungjaehoon/mama-os
84
+ cli=$package/dist/cli/index.js
85
+ wrapper=$root/bin/mama
86
+
87
+ # A move of the managed Node that did not finish (`mama update --node`, install.md, "Moving the
88
+ # managed Node"), before anything else and in plain sh: ~/.mama/npm may be missing now. At
89
+ # `committed` the new Node runs, and its old folders go; otherwise each folder set aside goes back
90
+ # over whatever is in its place, and the service starts on it. The journal has one field per line
91
+ # (src/cli/runtime/node-move-journal.ts); each step below can be run again after a cut.
92
+ move_journal=$root/runtime/node-move.json
93
+ if [ -e "$move_journal" ]; then
94
+ holder=$root/runtime/update.holder.json
95
+ holder_pid=''
96
+ [ -f "$holder" ] && holder_pid=$(sed -n 's/^{"pid":\([0-9][0-9]*\),.*/\1/p' "$holder")
97
+ if [ -n "$holder_pid" ] && kill -0 "$holder_pid" 2>/dev/null; then
98
+ fail "a move of the managed Node or an update runs now (pid $holder_pid, $holder); run this again once it ends. If that pid is not MAMA's, remove $holder first."
99
+ fi
100
+ move_from=$(sed -n 's/^ "from": "\(.*\)",$/\1/p' "$move_journal")
101
+ move_to=$(sed -n 's/^ "to": "\(.*\)",$/\1/p' "$move_journal")
102
+ if grep -q '^ "phase": "committed",$' "$move_journal"; then
103
+ rm -rf "$root/node.old" "$root/npm.old"
104
+ rm -f "$move_journal"
105
+ say "The managed Node's move to $move_to had taken effect; its old folders are removed."
106
+ else
107
+ # The hold is the recovery's invariant: with it, start.sh runs nothing and the folders may be
108
+ # half renamed; without it every rename was done (the move and this recovery write and sync it
109
+ # before their first rename, and sync the renames before they remove it).
110
+ hold=$root/runtime/update.hold
111
+ if [ ! -e "$hold" ] && { [ -d "$root/node.old" ] || [ -d "$root/npm.old" ]; }; then
112
+ # Every rename done: the new Node runs on its own prefix, and may run MAMA (a move killed
113
+ # while it waited for the boot), which stops before its folders move back.
114
+ [ -x "$node_dir/bin/node" ] && [ -f "$cli" ] ||
115
+ fail "the move of the managed Node to $move_to is unfinished, with no hold file and no runnable $node_dir/bin/node or $cli; nothing was changed. Stop MAMA, create $hold, then run this installer again."
116
+ "$node_dir/bin/node" "$cli" stop </dev/null ||
117
+ fail "the move of the managed Node to $move_to is unfinished, and MAMA on it did not stop (above); nothing was changed. Run $wrapper stop --now, then this installer again."
118
+ fi
119
+ # Held before the first rename, so a cut midway leaves the hold: the next run stops nothing,
120
+ # and a start meanwhile (a reboot) runs nothing on a half-renamed pair.
121
+ : >"$hold"
122
+ sync
123
+ for folder in node npm; do
124
+ if [ -d "$root/$folder.old" ]; then
125
+ rm -rf "${root:?}/$folder"
126
+ mv "$root/$folder.old" "$root/$folder"
127
+ fi
128
+ done
129
+ rm -rf "$root/node.new" "$root/npm.new"
130
+ sync
131
+ rm -f "$hold"
132
+ "$node_dir/bin/node" "$cli" service start </dev/null ||
133
+ fail "Node.js $move_from is back in $node_dir, but MAMA did not start on it (above); run this installer again"
134
+ # Last: a run cut before here does all of this again.
135
+ rm -f "$move_journal"
136
+ fail "the move of the managed Node from $move_from to $move_to was cut off, and is undone: MAMA runs on Node.js $move_from again. Run this installer again to move it."
137
+ fi
138
+ fi
139
+
140
+ # Another install owns this account: a setup with no MAMA in the managed prefix.
141
+ holds_mama=no
142
+ [ -f "$package/package.json" ] && holds_mama=yes
143
+ set_up=no
144
+ [ -f "$root/config.yaml" ] && set_up=yes
145
+ if [ "$holds_mama" = no ] && { [ "$set_up" = yes ] || [ -f "$root/start.sh" ]; }; then
146
+ fail "$root is set up by another MAMA install (not in $prefix); this installer will not take it over. Nothing was changed. mama update --dry-run shows how that install updates."
147
+ fi
148
+ # Nothing reads a terminal. A new install is told its backend and how to set up; one already set
149
+ # up runs as it was installed, so the bare command mama update and doctor print runs as is.
150
+ if [ "$set_up" = no ]; then
151
+ [ -n "$backend" ] || fail 'a new install needs --backend claude or --backend codex'
152
+ [ -n "$init_mode" ] ||
153
+ fail 'a new install needs --non-interactive (mama init reads MAMA_INIT_* variables and opens the setup page) or --no-init'
154
+ fi
155
+ [ -n "$init_mode" ] || init_mode=non-interactive
156
+
157
+ case $(uname -s) in
158
+ Darwin) os=darwin ;;
159
+ Linux) os=linux ;;
160
+ *) fail "MAMA OS installs on macOS and Linux; this is $(uname -s)" ;;
161
+ esac
162
+ case $(uname -m) in
163
+ x86_64 | amd64) arch=x64 ;;
164
+ arm64 | aarch64) arch=arm64 ;;
165
+ *) fail "MAMA OS installs on x64 and arm64; this is $(uname -m)" ;;
166
+ esac
167
+ case $os-$arch in
168
+ darwin-arm64) node_sha256=$NODE_SHA256_DARWIN_ARM64 ;;
169
+ darwin-x64) node_sha256=$NODE_SHA256_DARWIN_X64 ;;
170
+ linux-x64) node_sha256=$NODE_SHA256_LINUX_X64 ;;
171
+ linux-arm64) node_sha256=$NODE_SHA256_LINUX_ARM64 ;;
172
+ esac
173
+
174
+ # ~/.local/bin is where the vendor installers put the backend.
175
+ PATH=$HOME/.local/bin:$PATH
176
+ export PATH
177
+
178
+ # Linux: the parent of member_root and tools_root, and linger, in one sudo call. sudo keeps the
179
+ # umask 077 above; 022 inside, or the parent would be 0700 and init's folder check would fail.
180
+ if [ "$os" = linux ]; then
181
+ user=$(id -un)
182
+ # default-roots.ts's pattern, ^[A-Za-z0-9][A-Za-z0-9._-]*$, spelled out: a range in a
183
+ # bracket expression follows the locale.
184
+ alnum=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
185
+ case $user in
186
+ '' | [!$alnum]* | *[!$alnum._-]*) user_ok=no ;;
187
+ *) user_ok=yes ;;
188
+ esac
189
+ if [ "$user_ok" = no ]; then
190
+ say "The user name $user has characters MAMA's default folders do not take, so nothing is run with sudo; set MAMA_INIT_MEMBER_ROOT and MAMA_INIT_TOOLS_ROOT to two folders outside your home instead."
191
+ elif [ -n "$(find /var/lib/mama -prune -type d -user 0 -perm 0755 2>/dev/null)" ] &&
192
+ [ -n "$(find "/var/lib/mama/$user" -prune -type d -user "$(id -u)" -perm 0700 2>/dev/null)" ] &&
193
+ [ -e "/var/lib/systemd/linger/$user" ]; then
194
+ say "/var/lib/mama/$user is in place and linger is on."
195
+ else
196
+ privileged="umask 022; install -d -m 0755 /var/lib/mama; install -d -o $user -m 0700 /var/lib/mama/$user; loginctl enable-linger $user"
197
+ say "MAMA keeps member workspaces and document tools under /var/lib/mama/$user, and linger keeps it running after you log out. This needs sudo once:"
198
+ say " sudo sh -c '$privileged'"
199
+ if command -v sudo >/dev/null 2>&1 && sudo sh -c "$privileged" </dev/null; then
200
+ say "Done."
201
+ else
202
+ say "That did not run. Run it later, or set MAMA_INIT_MEMBER_ROOT and MAMA_INIT_TOOLS_ROOT to two folders outside your home."
203
+ fi
204
+ fi
205
+ fi
206
+
207
+ mkdir -p "$root"
208
+ download=$root/node.$$.tar.gz
209
+ unpack=$root/node.$$.tmp
210
+ vendor_script=$root/backend-install.$$.sh
211
+ write_tmp=''
212
+ trap 'rm -rf "$download" "$unpack" "$vendor_script" ${write_tmp:+"$write_tmp"}' EXIT
213
+ trap 'exit 129' HUP
214
+ trap 'exit 130' INT
215
+ trap 'exit 143' TERM
216
+ # What a run killed outright (SIGKILL, a power cut) left behind.
217
+ rm -rf "$root"/node.*.tmp "$root"/node.*.tar.gz "$root"/backend-install.*.sh
218
+
219
+ # Node.js: the pinned release, checked against the pinned SHA-256, unpacked beside its place and
220
+ # renamed into $1.
221
+ fetch_node() {
222
+ command -v curl >/dev/null 2>&1 || fail 'curl is needed to download Node.js'
223
+ if command -v shasum >/dev/null 2>&1; then
224
+ sha256() { shasum -a 256 "$1" | cut -d ' ' -f 1; }
225
+ elif command -v sha256sum >/dev/null 2>&1; then
226
+ sha256() { sha256sum "$1" | cut -d ' ' -f 1; }
227
+ else
228
+ fail 'shasum or sha256sum is needed to check the Node.js download'
229
+ fi
230
+ node_file=node-v$NODE_VERSION-$os-$arch.tar.gz
231
+ node_url=https://nodejs.org/dist/v$NODE_VERSION/$node_file
232
+ say "Downloading Node.js $NODE_VERSION: $node_url"
233
+ curl -fsSL -o "$download" "$node_url" </dev/null || fail "could not download $node_url"
234
+ actual=$(sha256 "$download")
235
+ if [ "$actual" != "$node_sha256" ]; then
236
+ rm -f "$download"
237
+ fail "$node_file has SHA-256 $actual, not $node_sha256, which this installer pins; the download was deleted and nothing was unpacked."
238
+ fi
239
+ rm -rf "$unpack"
240
+ mkdir "$unpack"
241
+ tar -xzf "$download" -C "$unpack" --strip-components 1 </dev/null
242
+ rm -f "$download"
243
+ [ "$("$unpack/bin/node" --version </dev/null)" = "v$NODE_VERSION" ] ||
244
+ fail "the unpacked $node_file does not run as Node.js $NODE_VERSION"
245
+ rm -rf "$1"
246
+ mv "$unpack" "$1"
247
+ }
248
+ node_now=''
249
+ if [ -x "$node_dir/bin/node" ]; then
250
+ node_now=$("$node_dir/bin/node" --version </dev/null 2>/dev/null || true)
251
+ fi
252
+ if [ "$node_now" = "v$NODE_VERSION" ]; then
253
+ say "Node.js $NODE_VERSION is in place: $node_dir"
254
+ elif [ -f "$root/start.sh" ] && [ -n "$node_now" ]; then
255
+ # The service runs this Node: mama update --node moves it with the service stopped, boots
256
+ # MAMA on the new one and checks it, and puts the old one back on a failure. It runs on the
257
+ # Node it moves away from.
258
+ say "MAMA runs Node.js ${node_now#v} from $node_dir; this installer pins $NODE_VERSION, so it moves MAMA to it."
259
+ fetch_node "$root/node.new"
260
+ PATH="$node_dir/bin:$PATH" "$node_dir/bin/node" "$cli" update --node "$root/node.new" </dev/null ||
261
+ fail "moving MAMA to Node.js $NODE_VERSION did not finish (mama update --node's report is above)"
262
+ else
263
+ fetch_node "$node_dir"
264
+ say "Node.js $NODE_VERSION installed: $node_dir"
265
+ fi
266
+
267
+ # MAMA OS, with the managed Node's own npm and that Node first on PATH, as mama update runs it.
268
+ installed=''
269
+ if [ -d "$prefix" ]; then
270
+ installed=$(PATH="$node_dir/bin:$PATH" "$node_dir/bin/npm" ls -g --prefix "$prefix" \
271
+ --depth=0 --parseable --long @jungjaehoon/mama-os </dev/null 2>/dev/null |
272
+ sed -n 's|.*:@jungjaehoon/mama-os@\([^:]*\).*|\1|p' || true)
273
+ fi
274
+ if [ "$set_up" = yes ]; then
275
+ say "MAMA OS ${installed:-(unreadable)} is installed in $prefix; mama update updates it."
276
+ elif [ "$installed" = "$MAMA_OS_VERSION" ]; then
277
+ say "MAMA OS $MAMA_OS_VERSION is in place: $prefix"
278
+ else
279
+ say "Installing @jungjaehoon/mama-os@$MAMA_OS_VERSION into $prefix"
280
+ PATH="$node_dir/bin:$PATH" "$node_dir/bin/npm" install -g --prefix "$prefix" \
281
+ --no-audit --no-fund "@jungjaehoon/mama-os@$MAMA_OS_VERSION" </dev/null ||
282
+ fail "npm could not install @jungjaehoon/mama-os@$MAMA_OS_VERSION (its error is above). $prefix is left for the next run of this installer, which installs it again."
283
+ fi
284
+ [ -f "$cli" ] || fail "$cli is missing; run this installer again to reinstall MAMA OS"
285
+
286
+ # `mama`: the managed Node on the package's CLI by full paths. The bin's own `#!/usr/bin/env node`
287
+ # would run whichever Node comes first, or none on a clean account.
288
+ # write_file writes $2 to $1 when it differs, and returns 1 when it does not. It writes a
289
+ # temporary file beside the real one (a link is followed to its target, so the link stays) and
290
+ # renames it into place, so a failed write, a full disk included, leaves the old file whole. The
291
+ # temporary file starts as a copy of the old one, mode included, so a read-only file is refused.
292
+ write_file() {
293
+ write_target=$1
294
+ while [ -L "$write_target" ]; do
295
+ write_link=$(readlink "$write_target") || fail "could not read the link $write_target"
296
+ case $write_link in
297
+ /*) write_target=$write_link ;;
298
+ *) write_target=$(dirname "$write_target")/$write_link ;;
299
+ esac
300
+ done
301
+ if [ -f "$write_target" ] && printf '%s\n' "$2" | cmp -s - "$write_target"; then return 1; fi
302
+ mkdir -p "$(dirname "$write_target")" || fail "could not create $(dirname "$write_target")"
303
+ write_tmp=$write_target.mama.$$
304
+ if [ -e "$write_target" ]; then
305
+ cp -p "$write_target" "$write_tmp" || fail "could not write $1"
306
+ fi
307
+ printf '%s\n' "$2" >"$write_tmp" || fail "could not write $1"
308
+ mv -f "$write_tmp" "$write_target" || fail "could not write $1"
309
+ write_tmp=''
310
+ }
311
+ if write_file "$wrapper" "#!/bin/sh
312
+ exec $(quote "$node_dir/bin/node") $(quote "$cli") \"\$@\""; then
313
+ chmod 700 "$wrapper" || fail "could not make $wrapper executable"
314
+ say "mama command written: $wrapper"
315
+ fi
316
+ other=$(command -v mama 2>/dev/null || true)
317
+ if [ -n "$other" ] && [ "$other" != "$wrapper" ]; then
318
+ say "Another mama comes first on this PATH: $other. The startup block below puts $wrapper ahead of it in new terminals."
319
+ fi
320
+
321
+ # The backend CLI: kept when the one on PATH runs (mama init checks its version and sign-in),
322
+ # else the vendor's documented installer, into ~/.local/bin. A found command counts only when
323
+ # `--version` exits 0 and prints a version, as backend-probe.ts reads it: a shim with no real CLI
324
+ # behind it (cmux's exits 127) is no backend. A set-up install run without --backend keeps its own.
325
+ backend_runs() {
326
+ backend_version=$("$1" --version </dev/null 2>/dev/null) &&
327
+ printf '%s\n' "$backend_version" | grep -Eq '[[:digit:]]+[.][[:digit:]]+[.][[:digit:]]+'
328
+ }
329
+ backend_path=''
330
+ [ -z "$backend" ] || backend_path=$(command -v "$backend" 2>/dev/null || true)
331
+ if [ -z "$backend" ]; then
332
+ :
333
+ elif [ -n "$backend_path" ] && backend_runs "$backend_path"; then
334
+ say "$backend is installed: $backend_path"
335
+ else
336
+ [ -z "$backend_path" ] ||
337
+ say "$backend_path does not run (its --version exited non-zero or printed no version), so it does not count."
338
+ case $backend in
339
+ claude)
340
+ vendor_url=https://claude.ai/install.sh
341
+ vendor_page=https://code.claude.com/docs/en/setup
342
+ vendor_shell='bash'
343
+ ;;
344
+ codex)
345
+ vendor_url=https://chatgpt.com/codex/install.sh
346
+ vendor_page=https://learn.chatgpt.com/docs/codex/cli
347
+ vendor_shell='sh'
348
+ ;;
349
+ esac
350
+ say "Installing $backend with its vendor's installer: curl -fsSL $vendor_url | $vendor_shell"
351
+ command -v curl >/dev/null 2>&1 || fail "curl is needed to install $backend; see $vendor_page"
352
+ # Fetched first, so a failed download is not an installer that ran on nothing.
353
+ curl -fsSL -o "$vendor_script" "$vendor_url" </dev/null ||
354
+ fail "could not download $vendor_url; see $vendor_page"
355
+ if [ "$backend" = codex ]; then
356
+ # On a terminal Codex's installer offers to start Codex on ~/.codex, not the home MAMA gives
357
+ # it; its install folder stays ~/.local/bin, which the startup block names.
358
+ (
359
+ unset CODEX_HOME CODEX_INSTALL_DIR
360
+ CODEX_NON_INTERACTIVE=1 sh "$vendor_script"
361
+ ) </dev/null || fail "the codex installer failed (its output is above); see $vendor_page"
362
+ else
363
+ bash "$vendor_script" </dev/null ||
364
+ fail "the claude installer failed (its output is above); see $vendor_page"
365
+ fi
366
+ rm -f "$vendor_script"
367
+ backend_path=$(command -v "$backend" 2>/dev/null || true)
368
+ [ -n "$backend_path" ] ||
369
+ fail "$backend's installer finished, but $backend is not on PATH or in $HOME/.local/bin; see $vendor_page"
370
+ backend_runs "$backend_path" ||
371
+ fail "$backend's installer finished, but $backend_path does not run (its --version exited non-zero or printed no version); see $vendor_page"
372
+ say "$backend installed: $backend_path"
373
+ fi
374
+
375
+ # The login shell's startup file: the text between the markers is rewritten on each run.
376
+ path_line="export PATH=\"\$HOME/.mama/bin:\$PATH\""
377
+ fish_dirs="$root/bin"
378
+ # The backend named, or without --backend either one the vendor installers put there.
379
+ local_backend=no
380
+ for name in ${backend:-claude codex}; do
381
+ if [ -x "$HOME/.local/bin/$name" ]; then local_backend=yes; fi
382
+ done
383
+ if [ "$local_backend" = yes ]; then
384
+ path_line="export PATH=\"\$HOME/.mama/bin:\$HOME/.local/bin:\$PATH\""
385
+ fish_dirs="$fish_dirs $HOME/.local/bin"
386
+ fi
387
+ startup=''
388
+ reopen='Open a new terminal'
389
+ case $(basename "${SHELL:-sh}") in
390
+ zsh) startup=${ZDOTDIR:-$HOME}/.zshrc ;;
391
+ bash)
392
+ if [ "$os" = linux ]; then
393
+ startup=$HOME/.bashrc
394
+ elif [ ! -f "$HOME/.bash_profile" ] && [ -f "$HOME/.profile" ]; then
395
+ startup=$HOME/.profile
396
+ else
397
+ startup=$HOME/.bash_profile
398
+ fi
399
+ ;;
400
+ fish)
401
+ reopen="In fish, run once: fish_add_path $fish_dirs"
402
+ say "fish: no startup file is written. $reopen"
403
+ ;;
404
+ *) startup=$HOME/.profile ;;
405
+ esac
406
+ if [ -n "$startup" ]; then
407
+ block="# >>> mama >>>
408
+ # Written by the MAMA OS installer; each run rewrites the lines between these markers.
409
+ $path_line
410
+ # <<< mama <<<"
411
+ current=''
412
+ if [ -e "$startup" ]; then
413
+ current=$(cat "$startup") || fail "could not read $startup"
414
+ fi
415
+ # Markers match with a trailing carriage return too (a file saved with CRLF line ends). Unequal
416
+ # counts exit 3: a block without its end line would otherwise swallow the rest of the file.
417
+ updated=$(printf '%s\n' "$current" | MAMA_BLOCK=$block awk '
418
+ { line = $0; sub(/\r$/, "", line) }
419
+ line == "# >>> mama >>>" { opened++; if (!done) print ENVIRON["MAMA_BLOCK"]; done = 1; skip = 1; next }
420
+ line == "# <<< mama <<<" { closed++; if (skip) { skip = 0; next } }
421
+ skip { next }
422
+ { print; last = line }
423
+ END {
424
+ if (opened != closed) exit 3
425
+ if (!done) {
426
+ if (NR > 0 && last != "") print ""
427
+ print ENVIRON["MAMA_BLOCK"]
428
+ }
429
+ }
430
+ ') || fail "$startup has a '# >>> mama >>>' line without its '# <<< mama <<<' line, or the other way round; fix it, then run this installer again"
431
+ # An absent or empty file gets the block alone.
432
+ [ -n "$current" ] || updated=$block
433
+ if write_file "$startup" "$updated"; then
434
+ say "PATH block written in $startup"
435
+ fi
436
+ fi
437
+
438
+ # mama init: npm and init run by full path with the managed Node first on PATH. Init reads the
439
+ # backend this script installed; a set-up install run without --backend has its own.
440
+ if [ -n "$backend" ]; then
441
+ MAMA_INIT_BACKEND=$backend
442
+ export MAMA_INIT_BACKEND
443
+ fi
444
+ case $init_mode in
445
+ no-init)
446
+ say "Installed. $reopen to have mama on PATH."
447
+ # ~/.local/bin first, as here: init looks for the backend on PATH, and a new shell may not
448
+ # read the startup block yet.
449
+ say "Set up with: PATH=\"\$HOME/.local/bin:\$PATH\" ${backend:+MAMA_INIT_BACKEND=$backend }MAMA_INIT_MODEL=<model> $(quote "$wrapper") init --non-interactive"
450
+ ;;
451
+ non-interactive)
452
+ PATH="$node_dir/bin:$PATH" "$wrapper" init --non-interactive </dev/null
453
+ ;;
454
+ esac
455
+ }
456
+
457
+ mama_install "$@"
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": "22.23.4",
3
+ "sha256": {
4
+ "darwin-arm64": "c9e1dbc748b33ed2d14f42445191ecaf14c56259c7a9a26d0042c49ec2b66428",
5
+ "darwin-x64": "efcc2b0db6f94bf53eddb038fe2b370277a042bd29e4f19b8f8e23598795b819",
6
+ "linux-x64": "b8492284c76a54baf58d61668dd0e41ee0fc98adabf9503d30f05d08f55b4406",
7
+ "linux-arm64": "f7a1e486dbc8b286847815b477d4fb5e9fb963ed4489c3e1588853d685f589f9"
8
+ }
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jungjaehoon/mama-os",
3
- "version": "0.77.0",
3
+ "version": "0.79.0",
4
4
  "description": "MAMA OS - The local work agent behind your messenger.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -43,6 +43,7 @@
43
43
  "public",
44
44
  "db",
45
45
  "toolkit",
46
+ "install",
46
47
  "README.md",
47
48
  "CHANGELOG.md"
48
49
  ],
@@ -50,20 +51,19 @@
50
51
  "access": "public"
51
52
  },
52
53
  "dependencies": {
53
- "@jungjaehoon/mama-core": "^8.7.0",
54
+ "@jungjaehoon/mama-core": "^8.9.0",
54
55
  "@slack/socket-mode": "^2.0.5",
55
56
  "@slack/web-api": "^7.13.0",
56
57
  "better-sqlite3": "^12.8.0",
57
58
  "discord.js": "^14.25.1",
58
- "express": "^5.2.1",
59
59
  "fflate": "0.8.3",
60
60
  "grammy": "^1.42.0",
61
61
  "htmlparser2": "12.0.0",
62
- "js-yaml": "^4.1.1"
62
+ "js-yaml": "^4.1.1",
63
+ "tar": "7.5.9"
63
64
  },
64
65
  "devDependencies": {
65
66
  "@types/better-sqlite3": "^7.6.13",
66
- "@types/express": "^5.0.6",
67
67
  "@types/js-yaml": "^4.0.9",
68
68
  "@types/node": "^22.0.0",
69
69
  "typescript": "^5.4.0",