@jungjaehoon/mama-os 0.53.1 → 0.58.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 (1729) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/README.md +62 -259
  3. package/db/migrations/001-connector-event-index.sql +251 -0
  4. package/dist/agent/claude-native-tool-policy.d.ts +17 -0
  5. package/dist/agent/claude-native-tool-policy.d.ts.map +1 -0
  6. package/dist/agent/claude-native-tool-policy.js +88 -0
  7. package/dist/agent/claude-native-tool-policy.js.map +1 -0
  8. package/dist/api/attachment-actions.d.ts +16 -0
  9. package/dist/api/attachment-actions.d.ts.map +1 -0
  10. package/dist/api/attachment-actions.js +280 -0
  11. package/dist/api/attachment-actions.js.map +1 -0
  12. package/dist/api/auth-middleware.d.ts +15 -55
  13. package/dist/api/auth-middleware.d.ts.map +1 -1
  14. package/dist/api/auth-middleware.js +56 -233
  15. package/dist/api/auth-middleware.js.map +1 -1
  16. package/dist/api/cf-access.d.ts +6 -0
  17. package/dist/api/cf-access.d.ts.map +1 -0
  18. package/dist/api/cf-access.js +121 -0
  19. package/dist/api/cf-access.js.map +1 -0
  20. package/dist/api/file-delivery.d.ts +29 -0
  21. package/dist/api/file-delivery.d.ts.map +1 -0
  22. package/dist/api/file-delivery.js +90 -0
  23. package/dist/api/file-delivery.js.map +1 -0
  24. package/dist/api/help-actions.d.ts +12 -0
  25. package/dist/api/help-actions.d.ts.map +1 -0
  26. package/dist/api/help-actions.js +70 -0
  27. package/dist/api/help-actions.js.map +1 -0
  28. package/dist/api/owner-timezone-actions.d.ts +10 -0
  29. package/dist/api/owner-timezone-actions.d.ts.map +1 -0
  30. package/dist/api/owner-timezone-actions.js +73 -0
  31. package/dist/api/owner-timezone-actions.js.map +1 -0
  32. package/dist/api/record-actions.d.ts +8 -0
  33. package/dist/api/record-actions.d.ts.map +1 -0
  34. package/dist/api/record-actions.js +53 -0
  35. package/dist/api/record-actions.js.map +1 -0
  36. package/dist/api/report-actions.d.ts +20 -0
  37. package/dist/api/report-actions.d.ts.map +1 -0
  38. package/dist/api/report-actions.js +137 -0
  39. package/dist/api/report-actions.js.map +1 -0
  40. package/dist/api/report-handler.d.ts +15 -11
  41. package/dist/api/report-handler.d.ts.map +1 -1
  42. package/dist/api/report-handler.js +48 -120
  43. package/dist/api/report-handler.js.map +1 -1
  44. package/dist/api/report-persistence.d.ts +3 -3
  45. package/dist/api/report-persistence.d.ts.map +1 -1
  46. package/dist/api/report-persistence.js +35 -10
  47. package/dist/api/report-persistence.js.map +1 -1
  48. package/dist/api/report-source-actions.d.ts +11 -0
  49. package/dist/api/report-source-actions.d.ts.map +1 -0
  50. package/dist/api/report-source-actions.js +309 -0
  51. package/dist/api/report-source-actions.js.map +1 -0
  52. package/dist/api/security-events.d.ts +23 -0
  53. package/dist/api/security-events.d.ts.map +1 -0
  54. package/dist/api/security-events.js +71 -0
  55. package/dist/api/security-events.js.map +1 -0
  56. package/dist/api/source-actions.d.ts +9 -0
  57. package/dist/api/source-actions.d.ts.map +1 -0
  58. package/dist/api/source-actions.js +274 -0
  59. package/dist/api/source-actions.js.map +1 -0
  60. package/dist/api/stored-source-reader.d.ts +21 -0
  61. package/dist/api/stored-source-reader.d.ts.map +1 -0
  62. package/dist/api/stored-source-reader.js +269 -0
  63. package/dist/api/stored-source-reader.js.map +1 -0
  64. package/dist/api/viewer-data.d.ts +143 -0
  65. package/dist/api/viewer-data.d.ts.map +1 -0
  66. package/dist/api/viewer-data.js +518 -0
  67. package/dist/api/viewer-data.js.map +1 -0
  68. package/dist/api/viewer-request-security.d.ts +12 -0
  69. package/dist/api/viewer-request-security.d.ts.map +1 -0
  70. package/dist/api/viewer-request-security.js +217 -0
  71. package/dist/api/viewer-request-security.js.map +1 -0
  72. package/dist/api/viewer-server.d.ts +56 -0
  73. package/dist/api/viewer-server.d.ts.map +1 -0
  74. package/dist/api/viewer-server.js +937 -0
  75. package/dist/api/viewer-server.js.map +1 -0
  76. package/dist/api/wiki-actions.d.ts +20 -0
  77. package/dist/api/wiki-actions.d.ts.map +1 -0
  78. package/dist/api/wiki-actions.js +296 -0
  79. package/dist/api/wiki-actions.js.map +1 -0
  80. package/dist/api/work-actions.d.ts +96 -0
  81. package/dist/api/work-actions.d.ts.map +1 -0
  82. package/dist/api/work-actions.js +956 -0
  83. package/dist/api/work-actions.js.map +1 -0
  84. package/dist/cli/commands/daemon.d.ts +90 -0
  85. package/dist/cli/commands/daemon.d.ts.map +1 -0
  86. package/dist/cli/commands/daemon.js +632 -0
  87. package/dist/cli/commands/daemon.js.map +1 -0
  88. package/dist/cli/commands/init.d.ts +7 -18
  89. package/dist/cli/commands/init.d.ts.map +1 -1
  90. package/dist/cli/commands/init.js +357 -273
  91. package/dist/cli/commands/init.js.map +1 -1
  92. package/dist/cli/commands/replay.d.ts +12 -0
  93. package/dist/cli/commands/replay.d.ts.map +1 -0
  94. package/dist/cli/commands/replay.js +145 -0
  95. package/dist/cli/commands/replay.js.map +1 -0
  96. package/dist/cli/commands/secret.d.ts +6 -0
  97. package/dist/cli/commands/secret.d.ts.map +1 -0
  98. package/dist/cli/commands/secret.js +24 -0
  99. package/dist/cli/commands/secret.js.map +1 -0
  100. package/dist/cli/index.d.ts +0 -5
  101. package/dist/cli/index.d.ts.map +1 -1
  102. package/dist/cli/index.js +52 -95
  103. package/dist/cli/index.js.map +1 -1
  104. package/dist/cli/launch-files.d.ts +10 -0
  105. package/dist/cli/launch-files.d.ts.map +1 -0
  106. package/dist/cli/launch-files.js +74 -0
  107. package/dist/cli/launch-files.js.map +1 -0
  108. package/dist/cli/prompt.d.ts +15 -0
  109. package/dist/cli/prompt.d.ts.map +1 -0
  110. package/dist/cli/prompt.js +64 -0
  111. package/dist/cli/prompt.js.map +1 -0
  112. package/dist/cli/runtime/action-mcp-config.d.ts +15 -0
  113. package/dist/cli/runtime/action-mcp-config.d.ts.map +1 -0
  114. package/dist/cli/runtime/action-mcp-config.js +56 -0
  115. package/dist/cli/runtime/action-mcp-config.js.map +1 -0
  116. package/dist/cli/runtime/claude-caller-config.d.ts +4 -0
  117. package/dist/cli/runtime/claude-caller-config.d.ts.map +1 -0
  118. package/dist/cli/runtime/claude-caller-config.js +46 -0
  119. package/dist/cli/runtime/claude-caller-config.js.map +1 -0
  120. package/dist/cli/secrets.d.ts +9 -0
  121. package/dist/cli/secrets.d.ts.map +1 -0
  122. package/dist/cli/secrets.js +94 -0
  123. package/dist/cli/secrets.js.map +1 -0
  124. package/dist/connectors/calendar/index.d.ts +11 -10
  125. package/dist/connectors/calendar/index.d.ts.map +1 -1
  126. package/dist/connectors/calendar/index.js +171 -97
  127. package/dist/connectors/calendar/index.js.map +1 -1
  128. package/dist/connectors/chatwork/index.d.ts +31 -5
  129. package/dist/connectors/chatwork/index.d.ts.map +1 -1
  130. package/dist/connectors/chatwork/index.js +184 -20
  131. package/dist/connectors/chatwork/index.js.map +1 -1
  132. package/dist/connectors/claude-code/index.d.ts +0 -2
  133. package/dist/connectors/claude-code/index.d.ts.map +1 -1
  134. package/dist/connectors/claude-code/index.js +94 -70
  135. package/dist/connectors/claude-code/index.js.map +1 -1
  136. package/dist/connectors/config-loader.d.ts +1 -6
  137. package/dist/connectors/config-loader.d.ts.map +1 -1
  138. package/dist/connectors/config-loader.js +154 -134
  139. package/dist/connectors/config-loader.js.map +1 -1
  140. package/dist/connectors/discord/index.d.ts +8 -1
  141. package/dist/connectors/discord/index.d.ts.map +1 -1
  142. package/dist/connectors/discord/index.js +110 -32
  143. package/dist/connectors/discord/index.js.map +1 -1
  144. package/dist/connectors/drive/index.d.ts +10 -5
  145. package/dist/connectors/drive/index.d.ts.map +1 -1
  146. package/dist/connectors/drive/index.js +145 -88
  147. package/dist/connectors/drive/index.js.map +1 -1
  148. package/dist/connectors/framework/attachment-io.d.ts +5 -0
  149. package/dist/connectors/framework/attachment-io.d.ts.map +1 -0
  150. package/dist/connectors/framework/attachment-io.js +72 -0
  151. package/dist/connectors/framework/attachment-io.js.map +1 -0
  152. package/dist/connectors/framework/attachments.d.ts +32 -0
  153. package/dist/connectors/framework/attachments.d.ts.map +1 -0
  154. package/dist/connectors/framework/attachments.js +14 -0
  155. package/dist/connectors/framework/attachments.js.map +1 -0
  156. package/dist/connectors/framework/connector-event-types.d.ts +136 -0
  157. package/dist/connectors/framework/connector-event-types.d.ts.map +1 -0
  158. package/dist/connectors/framework/connector-event-types.js +3 -0
  159. package/dist/connectors/framework/connector-event-types.js.map +1 -0
  160. package/dist/connectors/framework/connector-state.d.ts +3 -0
  161. package/dist/connectors/framework/connector-state.d.ts.map +1 -0
  162. package/dist/connectors/framework/connector-state.js +47 -0
  163. package/dist/connectors/framework/connector-state.js.map +1 -0
  164. package/dist/connectors/framework/event-index.d.ts +28 -0
  165. package/dist/connectors/framework/event-index.d.ts.map +1 -0
  166. package/dist/connectors/framework/event-index.js +354 -0
  167. package/dist/connectors/framework/event-index.js.map +1 -0
  168. package/dist/connectors/framework/gws-utils.d.ts +3 -8
  169. package/dist/connectors/framework/gws-utils.d.ts.map +1 -1
  170. package/dist/connectors/framework/gws-utils.js +23 -30
  171. package/dist/connectors/framework/gws-utils.js.map +1 -1
  172. package/dist/connectors/framework/index.d.ts +4 -2
  173. package/dist/connectors/framework/index.d.ts.map +1 -1
  174. package/dist/connectors/framework/index.js +8 -6
  175. package/dist/connectors/framework/index.js.map +1 -1
  176. package/dist/connectors/framework/polling-scheduler.d.ts +71 -52
  177. package/dist/connectors/framework/polling-scheduler.d.ts.map +1 -1
  178. package/dist/connectors/framework/polling-scheduler.js +236 -168
  179. package/dist/connectors/framework/polling-scheduler.js.map +1 -1
  180. package/dist/connectors/framework/raw-query.d.ts +44 -0
  181. package/dist/connectors/framework/raw-query.d.ts.map +1 -0
  182. package/dist/connectors/framework/raw-query.js +584 -0
  183. package/dist/connectors/framework/raw-query.js.map +1 -0
  184. package/dist/connectors/framework/stored-index-read.d.ts +16 -0
  185. package/dist/connectors/framework/stored-index-read.d.ts.map +1 -0
  186. package/dist/connectors/framework/stored-index-read.js +66 -0
  187. package/dist/connectors/framework/stored-index-read.js.map +1 -0
  188. package/dist/connectors/framework/types.d.ts +17 -61
  189. package/dist/connectors/framework/types.d.ts.map +1 -1
  190. package/dist/connectors/framework/types.js +0 -4
  191. package/dist/connectors/framework/types.js.map +1 -1
  192. package/dist/connectors/gmail/index.d.ts +3 -2
  193. package/dist/connectors/gmail/index.d.ts.map +1 -1
  194. package/dist/connectors/gmail/index.js +74 -27
  195. package/dist/connectors/gmail/index.js.map +1 -1
  196. package/dist/connectors/ical/index.d.ts +29 -0
  197. package/dist/connectors/ical/index.d.ts.map +1 -0
  198. package/dist/connectors/ical/index.js +220 -0
  199. package/dist/connectors/ical/index.js.map +1 -0
  200. package/dist/connectors/ical/parser.d.ts +13 -0
  201. package/dist/connectors/ical/parser.d.ts.map +1 -0
  202. package/dist/connectors/ical/parser.js +117 -0
  203. package/dist/connectors/ical/parser.js.map +1 -0
  204. package/dist/connectors/imessage/index.d.ts +3 -1
  205. package/dist/connectors/imessage/index.d.ts.map +1 -1
  206. package/dist/connectors/imessage/index.js +31 -16
  207. package/dist/connectors/imessage/index.js.map +1 -1
  208. package/dist/connectors/index.d.ts +12 -5
  209. package/dist/connectors/index.d.ts.map +1 -1
  210. package/dist/connectors/index.js +67 -18
  211. package/dist/connectors/index.js.map +1 -1
  212. package/dist/connectors/kagemusha/index.d.ts +7 -19
  213. package/dist/connectors/kagemusha/index.d.ts.map +1 -1
  214. package/dist/connectors/kagemusha/index.js +123 -173
  215. package/dist/connectors/kagemusha/index.js.map +1 -1
  216. package/dist/connectors/notion/index.d.ts.map +1 -1
  217. package/dist/connectors/notion/index.js +79 -36
  218. package/dist/connectors/notion/index.js.map +1 -1
  219. package/dist/connectors/obsidian/index.d.ts +1 -1
  220. package/dist/connectors/obsidian/index.d.ts.map +1 -1
  221. package/dist/connectors/obsidian/index.js +59 -57
  222. package/dist/connectors/obsidian/index.js.map +1 -1
  223. package/dist/connectors/sheets/index.d.ts +8 -4
  224. package/dist/connectors/sheets/index.d.ts.map +1 -1
  225. package/dist/connectors/sheets/index.js +155 -143
  226. package/dist/connectors/sheets/index.js.map +1 -1
  227. package/dist/connectors/slack/index.d.ts +24 -5
  228. package/dist/connectors/slack/index.d.ts.map +1 -1
  229. package/dist/connectors/slack/index.js +177 -39
  230. package/dist/connectors/slack/index.js.map +1 -1
  231. package/dist/connectors/telegram/index.d.ts +9 -2
  232. package/dist/connectors/telegram/index.d.ts.map +1 -1
  233. package/dist/connectors/telegram/index.js +119 -70
  234. package/dist/connectors/telegram/index.js.map +1 -1
  235. package/dist/connectors/trello/index.d.ts +10 -3
  236. package/dist/connectors/trello/index.d.ts.map +1 -1
  237. package/dist/connectors/trello/index.js +88 -39
  238. package/dist/connectors/trello/index.js.map +1 -1
  239. package/dist/gateways/base-gateway.d.ts +9 -33
  240. package/dist/gateways/base-gateway.d.ts.map +1 -1
  241. package/dist/gateways/base-gateway.js +7 -28
  242. package/dist/gateways/base-gateway.js.map +1 -1
  243. package/dist/gateways/conversation-record.d.ts +52 -0
  244. package/dist/gateways/conversation-record.d.ts.map +1 -0
  245. package/dist/gateways/conversation-record.js +220 -0
  246. package/dist/gateways/conversation-record.js.map +1 -0
  247. package/dist/gateways/discord.d.ts +33 -135
  248. package/dist/gateways/discord.d.ts.map +1 -1
  249. package/dist/gateways/discord.js +258 -778
  250. package/dist/gateways/discord.js.map +1 -1
  251. package/dist/gateways/session-store.d.ts +28 -9
  252. package/dist/gateways/session-store.d.ts.map +1 -1
  253. package/dist/gateways/session-store.js +192 -60
  254. package/dist/gateways/session-store.js.map +1 -1
  255. package/dist/gateways/slack.d.ts +35 -105
  256. package/dist/gateways/slack.d.ts.map +1 -1
  257. package/dist/gateways/slack.js +282 -440
  258. package/dist/gateways/slack.js.map +1 -1
  259. package/dist/gateways/telegram-attachments.d.ts +32 -0
  260. package/dist/gateways/telegram-attachments.d.ts.map +1 -0
  261. package/dist/gateways/telegram-attachments.js +113 -0
  262. package/dist/gateways/telegram-attachments.js.map +1 -0
  263. package/dist/gateways/telegram-errors.d.ts +3 -0
  264. package/dist/gateways/telegram-errors.d.ts.map +1 -0
  265. package/dist/gateways/telegram-errors.js +10 -0
  266. package/dist/gateways/telegram-errors.js.map +1 -0
  267. package/dist/gateways/telegram-format.d.ts.map +1 -1
  268. package/dist/gateways/telegram-format.js +11 -3
  269. package/dist/gateways/telegram-format.js.map +1 -1
  270. package/dist/gateways/telegram-message-ledger.d.ts +31 -25
  271. package/dist/gateways/telegram-message-ledger.d.ts.map +1 -1
  272. package/dist/gateways/telegram-message-ledger.js +122 -146
  273. package/dist/gateways/telegram-message-ledger.js.map +1 -1
  274. package/dist/gateways/telegram-response-presenter.d.ts +3 -1
  275. package/dist/gateways/telegram-response-presenter.d.ts.map +1 -1
  276. package/dist/gateways/telegram-response-presenter.js +14 -0
  277. package/dist/gateways/telegram-response-presenter.js.map +1 -1
  278. package/dist/gateways/telegram-text-entities.d.ts +2 -3
  279. package/dist/gateways/telegram-text-entities.d.ts.map +1 -1
  280. package/dist/gateways/telegram-text-entities.js +4 -5
  281. package/dist/gateways/telegram-text-entities.js.map +1 -1
  282. package/dist/gateways/telegram.d.ts +39 -101
  283. package/dist/gateways/telegram.d.ts.map +1 -1
  284. package/dist/gateways/telegram.js +406 -919
  285. package/dist/gateways/telegram.js.map +1 -1
  286. package/dist/gateways/turn-contract.d.ts +27 -87
  287. package/dist/gateways/turn-contract.d.ts.map +1 -1
  288. package/dist/gateways/types.d.ts +14 -299
  289. package/dist/gateways/types.d.ts.map +1 -1
  290. package/dist/gateways/types.js +0 -3
  291. package/dist/gateways/types.js.map +1 -1
  292. package/dist/index.d.ts +1 -6
  293. package/dist/index.d.ts.map +1 -1
  294. package/dist/index.js +0 -23
  295. package/dist/index.js.map +1 -1
  296. package/dist/operator/board-read-views.d.ts +8 -10
  297. package/dist/operator/board-read-views.d.ts.map +1 -1
  298. package/dist/operator/board-read-views.js +7 -16
  299. package/dist/operator/board-read-views.js.map +1 -1
  300. package/dist/operator/board-slot-instructions.d.ts +5 -8
  301. package/dist/operator/board-slot-instructions.d.ts.map +1 -1
  302. package/dist/operator/board-slot-instructions.js +12 -24
  303. package/dist/operator/board-slot-instructions.js.map +1 -1
  304. package/dist/replay/import-manifest.d.ts +21 -0
  305. package/dist/replay/import-manifest.d.ts.map +1 -0
  306. package/dist/replay/import-manifest.js +157 -0
  307. package/dist/replay/import-manifest.js.map +1 -0
  308. package/dist/replay/jev-client.d.ts +35 -0
  309. package/dist/replay/jev-client.d.ts.map +1 -0
  310. package/dist/replay/jev-client.js +141 -0
  311. package/dist/replay/jev-client.js.map +1 -0
  312. package/dist/replay/kagemusha-import.d.ts +35 -0
  313. package/dist/replay/kagemusha-import.d.ts.map +1 -0
  314. package/dist/replay/kagemusha-import.js +543 -0
  315. package/dist/replay/kagemusha-import.js.map +1 -0
  316. package/dist/replay/replay-cursor.d.ts +31 -0
  317. package/dist/replay/replay-cursor.d.ts.map +1 -0
  318. package/dist/replay/replay-cursor.js +189 -0
  319. package/dist/replay/replay-cursor.js.map +1 -0
  320. package/dist/replay/replay-feeder.d.ts +55 -0
  321. package/dist/replay/replay-feeder.d.ts.map +1 -0
  322. package/dist/replay/replay-feeder.js +214 -0
  323. package/dist/replay/replay-feeder.js.map +1 -0
  324. package/dist/replay/replay-ledger.d.ts +32 -0
  325. package/dist/replay/replay-ledger.d.ts.map +1 -0
  326. package/dist/replay/replay-ledger.js +91 -0
  327. package/dist/replay/replay-ledger.js.map +1 -0
  328. package/dist/replay/replay-source-catalog.d.ts +66 -0
  329. package/dist/replay/replay-source-catalog.d.ts.map +1 -0
  330. package/dist/replay/replay-source-catalog.js +332 -0
  331. package/dist/replay/replay-source-catalog.js.map +1 -0
  332. package/dist/replay/trello-import.d.ts +33 -0
  333. package/dist/replay/trello-import.d.ts.map +1 -0
  334. package/dist/replay/trello-import.js +204 -0
  335. package/dist/replay/trello-import.js.map +1 -0
  336. package/dist/replay/window-queue.d.ts +116 -0
  337. package/dist/replay/window-queue.d.ts.map +1 -0
  338. package/dist/replay/window-queue.js +497 -0
  339. package/dist/replay/window-queue.js.map +1 -0
  340. package/dist/runtime/action-mcp-server.d.ts +30 -0
  341. package/dist/runtime/action-mcp-server.d.ts.map +1 -0
  342. package/dist/runtime/action-mcp-server.js +178 -0
  343. package/dist/runtime/action-mcp-server.js.map +1 -0
  344. package/dist/runtime/action-surface.d.ts +47 -0
  345. package/dist/runtime/action-surface.d.ts.map +1 -0
  346. package/dist/runtime/action-surface.js +192 -0
  347. package/dist/runtime/action-surface.js.map +1 -0
  348. package/dist/runtime/backend-security.d.ts +7 -0
  349. package/dist/runtime/backend-security.d.ts.map +1 -0
  350. package/dist/runtime/backend-security.js +28 -0
  351. package/dist/runtime/backend-security.js.map +1 -0
  352. package/dist/runtime/claude-caller-hook.d.ts +20 -0
  353. package/dist/runtime/claude-caller-hook.d.ts.map +1 -0
  354. package/dist/runtime/claude-caller-hook.js +41 -0
  355. package/dist/runtime/claude-caller-hook.js.map +1 -0
  356. package/dist/runtime/config.d.ts +84 -0
  357. package/dist/runtime/config.d.ts.map +1 -0
  358. package/dist/runtime/config.js +361 -0
  359. package/dist/runtime/config.js.map +1 -0
  360. package/dist/runtime/connectors.d.ts +41 -0
  361. package/dist/runtime/connectors.d.ts.map +1 -0
  362. package/dist/runtime/connectors.js +187 -0
  363. package/dist/runtime/connectors.js.map +1 -0
  364. package/dist/runtime/core-db.d.ts +8 -0
  365. package/dist/runtime/core-db.d.ts.map +1 -0
  366. package/dist/runtime/core-db.js +19 -0
  367. package/dist/runtime/core-db.js.map +1 -0
  368. package/dist/runtime/model-cache.d.ts +9 -0
  369. package/dist/runtime/model-cache.d.ts.map +1 -0
  370. package/dist/runtime/model-cache.js +22 -0
  371. package/dist/runtime/model-cache.js.map +1 -0
  372. package/dist/runtime/native-session.d.ts +86 -0
  373. package/dist/runtime/native-session.d.ts.map +1 -0
  374. package/dist/runtime/native-session.js +282 -0
  375. package/dist/runtime/native-session.js.map +1 -0
  376. package/dist/runtime/owner-policy.d.ts +10 -0
  377. package/dist/runtime/owner-policy.d.ts.map +1 -0
  378. package/dist/runtime/owner-policy.js +35 -0
  379. package/dist/runtime/owner-policy.js.map +1 -0
  380. package/dist/runtime/owner-runtime.d.ts +89 -0
  381. package/dist/runtime/owner-runtime.d.ts.map +1 -0
  382. package/dist/runtime/owner-runtime.js +319 -0
  383. package/dist/runtime/owner-runtime.js.map +1 -0
  384. package/dist/runtime/owner-system-prompt.d.ts +16 -0
  385. package/dist/runtime/owner-system-prompt.d.ts.map +1 -0
  386. package/dist/runtime/owner-system-prompt.js +118 -0
  387. package/dist/runtime/owner-system-prompt.js.map +1 -0
  388. package/dist/runtime/recent-owner-exchanges.d.ts +8 -0
  389. package/dist/runtime/recent-owner-exchanges.d.ts.map +1 -0
  390. package/dist/runtime/recent-owner-exchanges.js +27 -0
  391. package/dist/runtime/recent-owner-exchanges.js.map +1 -0
  392. package/dist/runtime/record-orders.d.ts +49 -0
  393. package/dist/runtime/record-orders.d.ts.map +1 -0
  394. package/dist/runtime/record-orders.js +152 -0
  395. package/dist/runtime/record-orders.js.map +1 -0
  396. package/dist/runtime/report-scheduler.d.ts +24 -0
  397. package/dist/runtime/report-scheduler.d.ts.map +1 -0
  398. package/dist/runtime/report-scheduler.js +100 -0
  399. package/dist/runtime/report-scheduler.js.map +1 -0
  400. package/dist/runtime/session-credential.d.ts +5 -0
  401. package/dist/runtime/session-credential.d.ts.map +1 -0
  402. package/dist/runtime/session-credential.js +19 -0
  403. package/dist/runtime/session-credential.js.map +1 -0
  404. package/dist/runtime/stimulus-delivery.d.ts +83 -0
  405. package/dist/runtime/stimulus-delivery.d.ts.map +1 -0
  406. package/dist/runtime/stimulus-delivery.js +507 -0
  407. package/dist/runtime/stimulus-delivery.js.map +1 -0
  408. package/dist/runtime/timezone.d.ts +15 -0
  409. package/dist/runtime/timezone.d.ts.map +1 -0
  410. package/dist/runtime/timezone.js +128 -0
  411. package/dist/runtime/timezone.js.map +1 -0
  412. package/dist/runtime/turn-orders.d.ts +86 -0
  413. package/dist/runtime/turn-orders.d.ts.map +1 -0
  414. package/dist/runtime/turn-orders.js +272 -0
  415. package/dist/runtime/turn-orders.js.map +1 -0
  416. package/dist/sqlite.d.ts +7 -32
  417. package/dist/sqlite.d.ts.map +1 -1
  418. package/dist/sqlite.js +10 -48
  419. package/dist/sqlite.js.map +1 -1
  420. package/dist/storage/migrations/raw-item-revisions.d.ts +6 -0
  421. package/dist/storage/migrations/raw-item-revisions.d.ts.map +1 -0
  422. package/dist/storage/migrations/raw-item-revisions.js +109 -0
  423. package/dist/storage/migrations/raw-item-revisions.js.map +1 -0
  424. package/dist/storage/migrations-source.d.ts +5 -0
  425. package/dist/storage/migrations-source.d.ts.map +1 -0
  426. package/dist/storage/migrations-source.js +24 -0
  427. package/dist/storage/migrations-source.js.map +1 -0
  428. package/dist/storage/source-archive.d.ts +123 -0
  429. package/dist/storage/source-archive.d.ts.map +1 -0
  430. package/dist/storage/source-archive.js +595 -0
  431. package/dist/storage/source-archive.js.map +1 -0
  432. package/dist/storage-sqlite.d.ts +59 -0
  433. package/dist/storage-sqlite.d.ts.map +1 -0
  434. package/dist/storage-sqlite.js +75 -0
  435. package/dist/storage-sqlite.js.map +1 -0
  436. package/dist/utils/untrusted-content.d.ts +5 -35
  437. package/dist/utils/untrusted-content.d.ts.map +1 -1
  438. package/dist/utils/untrusted-content.js +16 -75
  439. package/dist/utils/untrusted-content.js.map +1 -1
  440. package/dist/wiki/obsidian-writer.d.ts +4 -2
  441. package/dist/wiki/obsidian-writer.d.ts.map +1 -1
  442. package/dist/wiki/obsidian-writer.js +85 -4
  443. package/dist/wiki/obsidian-writer.js.map +1 -1
  444. package/dist/wiki/path-safety.d.ts +2 -0
  445. package/dist/wiki/path-safety.d.ts.map +1 -1
  446. package/dist/wiki/path-safety.js +11 -3
  447. package/dist/wiki/path-safety.js.map +1 -1
  448. package/dist/wiki/wiki-edits.d.ts +17 -0
  449. package/dist/wiki/wiki-edits.d.ts.map +1 -0
  450. package/dist/wiki/wiki-edits.js +75 -0
  451. package/dist/wiki/wiki-edits.js.map +1 -0
  452. package/dist/wiki/wiki-read.d.ts +20 -11
  453. package/dist/wiki/wiki-read.d.ts.map +1 -1
  454. package/dist/wiki/wiki-read.js +87 -89
  455. package/dist/wiki/wiki-read.js.map +1 -1
  456. package/dist/wiki-artifacts/types.d.ts +1 -1
  457. package/dist/wiki-artifacts/types.d.ts.map +1 -1
  458. package/dist/wiki-artifacts/wiki-publish-adapter.d.ts.map +1 -1
  459. package/dist/wiki-artifacts/wiki-publish-adapter.js +13 -9
  460. package/dist/wiki-artifacts/wiki-publish-adapter.js.map +1 -1
  461. package/package.json +11 -41
  462. package/public/viewer/js/modules/graph.js +111 -41
  463. package/public/viewer/js/modules/memory.js +4 -31
  464. package/public/viewer/js/modules/wiki.js +0 -37
  465. package/public/viewer/js/utils/api.js +4 -50
  466. package/public/viewer/log-viewer.html +46 -0
  467. package/public/viewer/operator/operator.css +1 -1
  468. package/public/viewer/operator/operator.js +10835 -8211
  469. package/public/viewer/src/modules/graph.ts +133 -41
  470. package/public/viewer/src/modules/memory.ts +4 -31
  471. package/public/viewer/src/modules/wiki.ts +0 -42
  472. package/public/viewer/src/types/global.d.ts +1 -1
  473. package/public/viewer/src/utils/api.ts +7 -83
  474. package/public/viewer/viewer.html +7 -96
  475. package/dist/agent/agent-loop.d.ts +0 -289
  476. package/dist/agent/agent-loop.d.ts.map +0 -1
  477. package/dist/agent/agent-loop.js +0 -2842
  478. package/dist/agent/agent-loop.js.map +0 -1
  479. package/dist/agent/attachment-text-extractor.d.ts +0 -2
  480. package/dist/agent/attachment-text-extractor.d.ts.map +0 -1
  481. package/dist/agent/attachment-text-extractor.js +0 -128
  482. package/dist/agent/attachment-text-extractor.js.map +0 -1
  483. package/dist/agent/backend-model-policy.d.ts +0 -58
  484. package/dist/agent/backend-model-policy.d.ts.map +0 -1
  485. package/dist/agent/backend-model-policy.js +0 -167
  486. package/dist/agent/backend-model-policy.js.map +0 -1
  487. package/dist/agent/backend-model-runner-factory.d.ts +0 -27
  488. package/dist/agent/backend-model-runner-factory.d.ts.map +0 -1
  489. package/dist/agent/backend-model-runner-factory.js +0 -88
  490. package/dist/agent/backend-model-runner-factory.js.map +0 -1
  491. package/dist/agent/claude-cli-wrapper.d.ts +0 -144
  492. package/dist/agent/claude-cli-wrapper.d.ts.map +0 -1
  493. package/dist/agent/claude-cli-wrapper.js +0 -382
  494. package/dist/agent/claude-cli-wrapper.js.map +0 -1
  495. package/dist/agent/cli-arg-redaction.d.ts +0 -2
  496. package/dist/agent/cli-arg-redaction.d.ts.map +0 -1
  497. package/dist/agent/cli-arg-redaction.js +0 -18
  498. package/dist/agent/cli-arg-redaction.js.map +0 -1
  499. package/dist/agent/cline-cli-adapter.d.ts +0 -126
  500. package/dist/agent/cline-cli-adapter.d.ts.map +0 -1
  501. package/dist/agent/cline-cli-adapter.js +0 -1042
  502. package/dist/agent/cline-cli-adapter.js.map +0 -1
  503. package/dist/agent/cline-native-tool-policy.d.ts +0 -9
  504. package/dist/agent/cline-native-tool-policy.d.ts.map +0 -1
  505. package/dist/agent/cline-native-tool-policy.js +0 -61
  506. package/dist/agent/cline-native-tool-policy.js.map +0 -1
  507. package/dist/agent/code-act/completed-terminal-result.d.ts +0 -5
  508. package/dist/agent/code-act/completed-terminal-result.d.ts.map +0 -1
  509. package/dist/agent/code-act/completed-terminal-result.js +0 -83
  510. package/dist/agent/code-act/completed-terminal-result.js.map +0 -1
  511. package/dist/agent/code-act/constants.d.ts +0 -11
  512. package/dist/agent/code-act/constants.d.ts.map +0 -1
  513. package/dist/agent/code-act/constants.js +0 -64
  514. package/dist/agent/code-act/constants.js.map +0 -1
  515. package/dist/agent/code-act/host-bridge.d.ts +0 -50
  516. package/dist/agent/code-act/host-bridge.d.ts.map +0 -1
  517. package/dist/agent/code-act/host-bridge.js +0 -1405
  518. package/dist/agent/code-act/host-bridge.js.map +0 -1
  519. package/dist/agent/code-act/index.d.ts +0 -10
  520. package/dist/agent/code-act/index.d.ts.map +0 -1
  521. package/dist/agent/code-act/index.js +0 -22
  522. package/dist/agent/code-act/index.js.map +0 -1
  523. package/dist/agent/code-act/run-context-registry.d.ts +0 -36
  524. package/dist/agent/code-act/run-context-registry.d.ts.map +0 -1
  525. package/dist/agent/code-act/run-context-registry.js +0 -143
  526. package/dist/agent/code-act/run-context-registry.js.map +0 -1
  527. package/dist/agent/code-act/sandbox.d.ts +0 -25
  528. package/dist/agent/code-act/sandbox.d.ts.map +0 -1
  529. package/dist/agent/code-act/sandbox.js +0 -494
  530. package/dist/agent/code-act/sandbox.js.map +0 -1
  531. package/dist/agent/code-act/tool-catalog.d.ts +0 -30
  532. package/dist/agent/code-act/tool-catalog.d.ts.map +0 -1
  533. package/dist/agent/code-act/tool-catalog.js +0 -185
  534. package/dist/agent/code-act/tool-catalog.js.map +0 -1
  535. package/dist/agent/code-act/tool-policy.d.ts +0 -51
  536. package/dist/agent/code-act/tool-policy.d.ts.map +0 -1
  537. package/dist/agent/code-act/tool-policy.js +0 -160
  538. package/dist/agent/code-act/tool-policy.js.map +0 -1
  539. package/dist/agent/code-act/type-definition-generator.d.ts +0 -19
  540. package/dist/agent/code-act/type-definition-generator.d.ts.map +0 -1
  541. package/dist/agent/code-act/type-definition-generator.js +0 -73
  542. package/dist/agent/code-act/type-definition-generator.js.map +0 -1
  543. package/dist/agent/code-act/types.d.ts +0 -57
  544. package/dist/agent/code-act/types.d.ts.map +0 -1
  545. package/dist/agent/code-act/types.js +0 -14
  546. package/dist/agent/code-act/types.js.map +0 -1
  547. package/dist/agent/codex-app-server-process.d.ts +0 -257
  548. package/dist/agent/codex-app-server-process.d.ts.map +0 -1
  549. package/dist/agent/codex-app-server-process.js +0 -2084
  550. package/dist/agent/codex-app-server-process.js.map +0 -1
  551. package/dist/agent/codex-auth.d.ts +0 -2
  552. package/dist/agent/codex-auth.d.ts.map +0 -1
  553. package/dist/agent/codex-auth.js +0 -17
  554. package/dist/agent/codex-auth.js.map +0 -1
  555. package/dist/agent/codex-auxiliary-tools.d.ts +0 -17
  556. package/dist/agent/codex-auxiliary-tools.d.ts.map +0 -1
  557. package/dist/agent/codex-auxiliary-tools.js +0 -267
  558. package/dist/agent/codex-auxiliary-tools.js.map +0 -1
  559. package/dist/agent/codex-home.d.ts +0 -13
  560. package/dist/agent/codex-home.d.ts.map +0 -1
  561. package/dist/agent/codex-home.js +0 -644
  562. package/dist/agent/codex-home.js.map +0 -1
  563. package/dist/agent/codex-thread-registry.d.ts +0 -63
  564. package/dist/agent/codex-thread-registry.d.ts.map +0 -1
  565. package/dist/agent/codex-thread-registry.js +0 -433
  566. package/dist/agent/codex-thread-registry.js.map +0 -1
  567. package/dist/agent/content-dedup.d.ts +0 -86
  568. package/dist/agent/content-dedup.d.ts.map +0 -1
  569. package/dist/agent/content-dedup.js +0 -114
  570. package/dist/agent/content-dedup.js.map +0 -1
  571. package/dist/agent/context-compile-contract.d.ts +0 -5
  572. package/dist/agent/context-compile-contract.d.ts.map +0 -1
  573. package/dist/agent/context-compile-contract.js +0 -8
  574. package/dist/agent/context-compile-contract.js.map +0 -1
  575. package/dist/agent/context-compile-service.d.ts +0 -60
  576. package/dist/agent/context-compile-service.d.ts.map +0 -1
  577. package/dist/agent/context-compile-service.js +0 -481
  578. package/dist/agent/context-compile-service.js.map +0 -1
  579. package/dist/agent/context-prompt-builder.d.ts +0 -24
  580. package/dist/agent/context-prompt-builder.d.ts.map +0 -1
  581. package/dist/agent/context-prompt-builder.js +0 -61
  582. package/dist/agent/context-prompt-builder.js.map +0 -1
  583. package/dist/agent/contract-extractor.d.ts +0 -124
  584. package/dist/agent/contract-extractor.d.ts.map +0 -1
  585. package/dist/agent/contract-extractor.js +0 -465
  586. package/dist/agent/contract-extractor.js.map +0 -1
  587. package/dist/agent/drive-tools.d.ts +0 -83
  588. package/dist/agent/drive-tools.d.ts.map +0 -1
  589. package/dist/agent/drive-tools.js +0 -338
  590. package/dist/agent/drive-tools.js.map +0 -1
  591. package/dist/agent/gateway-tool-catalog.d.ts +0 -14
  592. package/dist/agent/gateway-tool-catalog.d.ts.map +0 -1
  593. package/dist/agent/gateway-tool-catalog.js +0 -41
  594. package/dist/agent/gateway-tool-catalog.js.map +0 -1
  595. package/dist/agent/gateway-tool-executor.d.ts +0 -353
  596. package/dist/agent/gateway-tool-executor.d.ts.map +0 -1
  597. package/dist/agent/gateway-tool-executor.js +0 -5448
  598. package/dist/agent/gateway-tool-executor.js.map +0 -1
  599. package/dist/agent/gateway-tools.md +0 -166
  600. package/dist/agent/image-translation-tools.d.ts +0 -48
  601. package/dist/agent/image-translation-tools.d.ts.map +0 -1
  602. package/dist/agent/image-translation-tools.js +0 -274
  603. package/dist/agent/image-translation-tools.js.map +0 -1
  604. package/dist/agent/index.d.ts +0 -13
  605. package/dist/agent/index.d.ts.map +0 -1
  606. package/dist/agent/index.js +0 -18
  607. package/dist/agent/index.js.map +0 -1
  608. package/dist/agent/mama-tool-handlers.d.ts +0 -11
  609. package/dist/agent/mama-tool-handlers.d.ts.map +0 -1
  610. package/dist/agent/mama-tool-handlers.js +0 -220
  611. package/dist/agent/mama-tool-handlers.js.map +0 -1
  612. package/dist/agent/managed-agent-runtime-sync.d.ts +0 -36
  613. package/dist/agent/managed-agent-runtime-sync.d.ts.map +0 -1
  614. package/dist/agent/managed-agent-runtime-sync.js +0 -245
  615. package/dist/agent/managed-agent-runtime-sync.js.map +0 -1
  616. package/dist/agent/managed-agent-validation.d.ts +0 -4
  617. package/dist/agent/managed-agent-validation.d.ts.map +0 -1
  618. package/dist/agent/managed-agent-validation.js +0 -85
  619. package/dist/agent/managed-agent-validation.js.map +0 -1
  620. package/dist/agent/model-runner.d.ts +0 -180
  621. package/dist/agent/model-runner.d.ts.map +0 -1
  622. package/dist/agent/model-runner.js +0 -54
  623. package/dist/agent/model-runner.js.map +0 -1
  624. package/dist/agent/native-effect-observer.d.ts +0 -20
  625. package/dist/agent/native-effect-observer.d.ts.map +0 -1
  626. package/dist/agent/native-effect-observer.js +0 -86
  627. package/dist/agent/native-effect-observer.js.map +0 -1
  628. package/dist/agent/obsidian-cli-args.d.ts +0 -14
  629. package/dist/agent/obsidian-cli-args.d.ts.map +0 -1
  630. package/dist/agent/obsidian-cli-args.js +0 -57
  631. package/dist/agent/obsidian-cli-args.js.map +0 -1
  632. package/dist/agent/os-agent-capabilities.md +0 -367
  633. package/dist/agent/persistent-cli-adapter.d.ts +0 -173
  634. package/dist/agent/persistent-cli-adapter.d.ts.map +0 -1
  635. package/dist/agent/persistent-cli-adapter.js +0 -506
  636. package/dist/agent/persistent-cli-adapter.js.map +0 -1
  637. package/dist/agent/persistent-cli-process.d.ts +0 -392
  638. package/dist/agent/persistent-cli-process.d.ts.map +0 -1
  639. package/dist/agent/persistent-cli-process.js +0 -1568
  640. package/dist/agent/persistent-cli-process.js.map +0 -1
  641. package/dist/agent/post-tool-handler.d.ts +0 -27
  642. package/dist/agent/post-tool-handler.d.ts.map +0 -1
  643. package/dist/agent/post-tool-handler.js +0 -194
  644. package/dist/agent/post-tool-handler.js.map +0 -1
  645. package/dist/agent/pre-compact-handler.d.ts +0 -36
  646. package/dist/agent/pre-compact-handler.d.ts.map +0 -1
  647. package/dist/agent/pre-compact-handler.js +0 -162
  648. package/dist/agent/pre-compact-handler.js.map +0 -1
  649. package/dist/agent/prompt-enhancer.d.ts +0 -33
  650. package/dist/agent/prompt-enhancer.d.ts.map +0 -1
  651. package/dist/agent/prompt-enhancer.js +0 -811
  652. package/dist/agent/prompt-enhancer.js.map +0 -1
  653. package/dist/agent/prompt-size-monitor.d.ts +0 -104
  654. package/dist/agent/prompt-size-monitor.d.ts.map +0 -1
  655. package/dist/agent/prompt-size-monitor.js +0 -192
  656. package/dist/agent/prompt-size-monitor.js.map +0 -1
  657. package/dist/agent/role-manager.d.ts +0 -122
  658. package/dist/agent/role-manager.d.ts.map +0 -1
  659. package/dist/agent/role-manager.js +0 -300
  660. package/dist/agent/role-manager.js.map +0 -1
  661. package/dist/agent/session-pool.d.ts +0 -176
  662. package/dist/agent/session-pool.d.ts.map +0 -1
  663. package/dist/agent/session-pool.js +0 -368
  664. package/dist/agent/session-pool.js.map +0 -1
  665. package/dist/agent/skill-loader.d.ts +0 -87
  666. package/dist/agent/skill-loader.d.ts.map +0 -1
  667. package/dist/agent/skill-loader.js +0 -461
  668. package/dist/agent/skill-loader.js.map +0 -1
  669. package/dist/agent/stop-continuation-handler.d.ts +0 -106
  670. package/dist/agent/stop-continuation-handler.d.ts.map +0 -1
  671. package/dist/agent/stop-continuation-handler.js +0 -230
  672. package/dist/agent/stop-continuation-handler.js.map +0 -1
  673. package/dist/agent/subagent-run-reconcile.d.ts +0 -23
  674. package/dist/agent/subagent-run-reconcile.d.ts.map +0 -1
  675. package/dist/agent/subagent-run-reconcile.js +0 -56
  676. package/dist/agent/subagent-run-reconcile.js.map +0 -1
  677. package/dist/agent/temporal-code-act-breaker.d.ts +0 -26
  678. package/dist/agent/temporal-code-act-breaker.d.ts.map +0 -1
  679. package/dist/agent/temporal-code-act-breaker.js +0 -94
  680. package/dist/agent/temporal-code-act-breaker.js.map +0 -1
  681. package/dist/agent/token-estimator.d.ts +0 -25
  682. package/dist/agent/token-estimator.d.ts.map +0 -1
  683. package/dist/agent/token-estimator.js +0 -75
  684. package/dist/agent/token-estimator.js.map +0 -1
  685. package/dist/agent/tool-registry.d.ts +0 -81
  686. package/dist/agent/tool-registry.d.ts.map +0 -1
  687. package/dist/agent/tool-registry.js +0 -876
  688. package/dist/agent/tool-registry.js.map +0 -1
  689. package/dist/agent/types.d.ts +0 -1261
  690. package/dist/agent/types.d.ts.map +0 -1
  691. package/dist/agent/types.js +0 -60
  692. package/dist/agent/types.js.map +0 -1
  693. package/dist/agent/yaml-frontmatter.d.ts +0 -75
  694. package/dist/agent/yaml-frontmatter.d.ts.map +0 -1
  695. package/dist/agent/yaml-frontmatter.js +0 -166
  696. package/dist/agent/yaml-frontmatter.js.map +0 -1
  697. package/dist/api/agent-context-handler.d.ts +0 -10
  698. package/dist/api/agent-context-handler.d.ts.map +0 -1
  699. package/dist/api/agent-context-handler.js +0 -216
  700. package/dist/api/agent-context-handler.js.map +0 -1
  701. package/dist/api/agent-graph-handler.d.ts +0 -18
  702. package/dist/api/agent-graph-handler.d.ts.map +0 -1
  703. package/dist/api/agent-graph-handler.js +0 -569
  704. package/dist/api/agent-graph-handler.js.map +0 -1
  705. package/dist/api/agent-handler.d.ts +0 -36
  706. package/dist/api/agent-handler.d.ts.map +0 -1
  707. package/dist/api/agent-handler.js +0 -223
  708. package/dist/api/agent-handler.js.map +0 -1
  709. package/dist/api/agent-raw-handler.d.ts +0 -70
  710. package/dist/api/agent-raw-handler.d.ts.map +0 -1
  711. package/dist/api/agent-raw-handler.js +0 -262
  712. package/dist/api/agent-raw-handler.js.map +0 -1
  713. package/dist/api/agent-situation-handler.d.ts +0 -14
  714. package/dist/api/agent-situation-handler.d.ts.map +0 -1
  715. package/dist/api/agent-situation-handler.js +0 -383
  716. package/dist/api/agent-situation-handler.js.map +0 -1
  717. package/dist/api/connector-feed-handler.d.ts +0 -42
  718. package/dist/api/connector-feed-handler.d.ts.map +0 -1
  719. package/dist/api/connector-feed-handler.js +0 -180
  720. package/dist/api/connector-feed-handler.js.map +0 -1
  721. package/dist/api/cron-handler.d.ts +0 -44
  722. package/dist/api/cron-handler.d.ts.map +0 -1
  723. package/dist/api/cron-handler.js +0 -261
  724. package/dist/api/cron-handler.js.map +0 -1
  725. package/dist/api/entity-audit-handler.d.ts +0 -12
  726. package/dist/api/entity-audit-handler.d.ts.map +0 -1
  727. package/dist/api/entity-audit-handler.js +0 -119
  728. package/dist/api/entity-audit-handler.js.map +0 -1
  729. package/dist/api/entity-audit-queue.d.ts +0 -74
  730. package/dist/api/entity-audit-queue.d.ts.map +0 -1
  731. package/dist/api/entity-audit-queue.js +0 -123
  732. package/dist/api/entity-audit-queue.js.map +0 -1
  733. package/dist/api/entity-audit-runner.d.ts +0 -9
  734. package/dist/api/entity-audit-runner.d.ts.map +0 -1
  735. package/dist/api/entity-audit-runner.js +0 -240
  736. package/dist/api/entity-audit-runner.js.map +0 -1
  737. package/dist/api/entity-review-handler.d.ts +0 -18
  738. package/dist/api/entity-review-handler.d.ts.map +0 -1
  739. package/dist/api/entity-review-handler.js +0 -521
  740. package/dist/api/entity-review-handler.js.map +0 -1
  741. package/dist/api/error-handler.d.ts +0 -22
  742. package/dist/api/error-handler.d.ts.map +0 -1
  743. package/dist/api/error-handler.js +0 -104
  744. package/dist/api/error-handler.js.map +0 -1
  745. package/dist/api/graph-api-types.d.ts +0 -105
  746. package/dist/api/graph-api-types.d.ts.map +0 -1
  747. package/dist/api/graph-api-types.js +0 -6
  748. package/dist/api/graph-api-types.js.map +0 -1
  749. package/dist/api/graph-api.d.ts +0 -42
  750. package/dist/api/graph-api.d.ts.map +0 -1
  751. package/dist/api/graph-api.js +0 -3460
  752. package/dist/api/graph-api.js.map +0 -1
  753. package/dist/api/heartbeat-handler.d.ts +0 -49
  754. package/dist/api/heartbeat-handler.d.ts.map +0 -1
  755. package/dist/api/heartbeat-handler.js +0 -106
  756. package/dist/api/heartbeat-handler.js.map +0 -1
  757. package/dist/api/index.d.ts +0 -145
  758. package/dist/api/index.d.ts.map +0 -1
  759. package/dist/api/index.js +0 -448
  760. package/dist/api/index.js.map +0 -1
  761. package/dist/api/intelligence-handler.d.ts +0 -116
  762. package/dist/api/intelligence-handler.d.ts.map +0 -1
  763. package/dist/api/intelligence-handler.js +0 -280
  764. package/dist/api/intelligence-handler.js.map +0 -1
  765. package/dist/api/memory-provenance-handler.d.ts +0 -3
  766. package/dist/api/memory-provenance-handler.d.ts.map +0 -1
  767. package/dist/api/memory-provenance-handler.js +0 -120
  768. package/dist/api/memory-provenance-handler.js.map +0 -1
  769. package/dist/api/operator-handler.d.ts +0 -19
  770. package/dist/api/operator-handler.d.ts.map +0 -1
  771. package/dist/api/operator-handler.js +0 -106
  772. package/dist/api/operator-handler.js.map +0 -1
  773. package/dist/api/operator-summary.d.ts +0 -3
  774. package/dist/api/operator-summary.d.ts.map +0 -1
  775. package/dist/api/operator-summary.js +0 -72
  776. package/dist/api/operator-summary.js.map +0 -1
  777. package/dist/api/operator-tasks-handler.d.ts +0 -7
  778. package/dist/api/operator-tasks-handler.d.ts.map +0 -1
  779. package/dist/api/operator-tasks-handler.js +0 -192
  780. package/dist/api/operator-tasks-handler.js.map +0 -1
  781. package/dist/api/runtime-status-handler.d.ts +0 -42
  782. package/dist/api/runtime-status-handler.d.ts.map +0 -1
  783. package/dist/api/runtime-status-handler.js +0 -56
  784. package/dist/api/runtime-status-handler.js.map +0 -1
  785. package/dist/api/skills-handler.d.ts +0 -12
  786. package/dist/api/skills-handler.d.ts.map +0 -1
  787. package/dist/api/skills-handler.js +0 -156
  788. package/dist/api/skills-handler.js.map +0 -1
  789. package/dist/api/token-handler.d.ts +0 -33
  790. package/dist/api/token-handler.d.ts.map +0 -1
  791. package/dist/api/token-handler.js +0 -118
  792. package/dist/api/token-handler.js.map +0 -1
  793. package/dist/api/types.d.ts +0 -155
  794. package/dist/api/types.d.ts.map +0 -1
  795. package/dist/api/types.js +0 -49
  796. package/dist/api/types.js.map +0 -1
  797. package/dist/api/ui-command-handler.d.ts +0 -48
  798. package/dist/api/ui-command-handler.d.ts.map +0 -1
  799. package/dist/api/ui-command-handler.js +0 -160
  800. package/dist/api/ui-command-handler.js.map +0 -1
  801. package/dist/api/upload-handler.d.ts +0 -12
  802. package/dist/api/upload-handler.d.ts.map +0 -1
  803. package/dist/api/upload-handler.js +0 -321
  804. package/dist/api/upload-handler.js.map +0 -1
  805. package/dist/api/wiki-handler.d.ts +0 -19
  806. package/dist/api/wiki-handler.d.ts.map +0 -1
  807. package/dist/api/wiki-handler.js +0 -136
  808. package/dist/api/wiki-handler.js.map +0 -1
  809. package/dist/api/worker-envelope.d.ts +0 -26
  810. package/dist/api/worker-envelope.d.ts.map +0 -1
  811. package/dist/api/worker-envelope.js +0 -176
  812. package/dist/api/worker-envelope.js.map +0 -1
  813. package/dist/auth/claude-client.d.ts +0 -12
  814. package/dist/auth/claude-client.d.ts.map +0 -1
  815. package/dist/auth/claude-client.js +0 -36
  816. package/dist/auth/claude-client.js.map +0 -1
  817. package/dist/auth/claude-code-auth.d.ts +0 -12
  818. package/dist/auth/claude-code-auth.d.ts.map +0 -1
  819. package/dist/auth/claude-code-auth.js +0 -85
  820. package/dist/auth/claude-code-auth.js.map +0 -1
  821. package/dist/auth/index.d.ts +0 -9
  822. package/dist/auth/index.d.ts.map +0 -1
  823. package/dist/auth/index.js +0 -13
  824. package/dist/auth/index.js.map +0 -1
  825. package/dist/auth/oauth-manager.d.ts +0 -59
  826. package/dist/auth/oauth-manager.d.ts.map +0 -1
  827. package/dist/auth/oauth-manager.js +0 -252
  828. package/dist/auth/oauth-manager.js.map +0 -1
  829. package/dist/auth/types.d.ts +0 -92
  830. package/dist/auth/types.d.ts.map +0 -1
  831. package/dist/auth/types.js +0 -23
  832. package/dist/auth/types.js.map +0 -1
  833. package/dist/cli/commands/connector.d.ts +0 -14
  834. package/dist/cli/commands/connector.d.ts.map +0 -1
  835. package/dist/cli/commands/connector.js +0 -174
  836. package/dist/cli/commands/connector.js.map +0 -1
  837. package/dist/cli/commands/gateway.d.ts +0 -18
  838. package/dist/cli/commands/gateway.d.ts.map +0 -1
  839. package/dist/cli/commands/gateway.js +0 -144
  840. package/dist/cli/commands/gateway.js.map +0 -1
  841. package/dist/cli/commands/report.d.ts +0 -14
  842. package/dist/cli/commands/report.d.ts.map +0 -1
  843. package/dist/cli/commands/report.js +0 -102
  844. package/dist/cli/commands/report.js.map +0 -1
  845. package/dist/cli/commands/run.d.ts +0 -19
  846. package/dist/cli/commands/run.d.ts.map +0 -1
  847. package/dist/cli/commands/run.js +0 -123
  848. package/dist/cli/commands/run.js.map +0 -1
  849. package/dist/cli/commands/setup.d.ts +0 -3
  850. package/dist/cli/commands/setup.d.ts.map +0 -1
  851. package/dist/cli/commands/setup.js +0 -9
  852. package/dist/cli/commands/setup.js.map +0 -1
  853. package/dist/cli/commands/start.d.ts +0 -263
  854. package/dist/cli/commands/start.d.ts.map +0 -1
  855. package/dist/cli/commands/start.js +0 -2230
  856. package/dist/cli/commands/start.js.map +0 -1
  857. package/dist/cli/commands/status.d.ts +0 -18
  858. package/dist/cli/commands/status.d.ts.map +0 -1
  859. package/dist/cli/commands/status.js +0 -326
  860. package/dist/cli/commands/status.js.map +0 -1
  861. package/dist/cli/commands/stop.d.ts +0 -28
  862. package/dist/cli/commands/stop.d.ts.map +0 -1
  863. package/dist/cli/commands/stop.js +0 -597
  864. package/dist/cli/commands/stop.js.map +0 -1
  865. package/dist/cli/config/config-manager.d.ts +0 -84
  866. package/dist/cli/config/config-manager.d.ts.map +0 -1
  867. package/dist/cli/config/config-manager.js +0 -886
  868. package/dist/cli/config/config-manager.js.map +0 -1
  869. package/dist/cli/config/types.d.ts +0 -633
  870. package/dist/cli/config/types.d.ts.map +0 -1
  871. package/dist/cli/config/types.js +0 -247
  872. package/dist/cli/config/types.js.map +0 -1
  873. package/dist/cli/runtime/agent-loop-init.d.ts +0 -53
  874. package/dist/cli/runtime/agent-loop-init.d.ts.map +0 -1
  875. package/dist/cli/runtime/agent-loop-init.js +0 -368
  876. package/dist/cli/runtime/agent-loop-init.js.map +0 -1
  877. package/dist/cli/runtime/api-routes-init.d.ts +0 -84
  878. package/dist/cli/runtime/api-routes-init.d.ts.map +0 -1
  879. package/dist/cli/runtime/api-routes-init.js +0 -1542
  880. package/dist/cli/runtime/api-routes-init.js.map +0 -1
  881. package/dist/cli/runtime/api-server-init.d.ts +0 -59
  882. package/dist/cli/runtime/api-server-init.d.ts.map +0 -1
  883. package/dist/cli/runtime/api-server-init.js +0 -159
  884. package/dist/cli/runtime/api-server-init.js.map +0 -1
  885. package/dist/cli/runtime/code-act-executor.d.ts +0 -14
  886. package/dist/cli/runtime/code-act-executor.d.ts.map +0 -1
  887. package/dist/cli/runtime/code-act-executor.js +0 -108
  888. package/dist/cli/runtime/code-act-executor.js.map +0 -1
  889. package/dist/cli/runtime/connector-bootstrap.d.ts +0 -8
  890. package/dist/cli/runtime/connector-bootstrap.d.ts.map +0 -1
  891. package/dist/cli/runtime/connector-bootstrap.js +0 -14
  892. package/dist/cli/runtime/connector-bootstrap.js.map +0 -1
  893. package/dist/cli/runtime/connector-init.d.ts +0 -64
  894. package/dist/cli/runtime/connector-init.d.ts.map +0 -1
  895. package/dist/cli/runtime/connector-init.js +0 -237
  896. package/dist/cli/runtime/connector-init.js.map +0 -1
  897. package/dist/cli/runtime/daemon.d.ts +0 -38
  898. package/dist/cli/runtime/daemon.d.ts.map +0 -1
  899. package/dist/cli/runtime/daemon.js +0 -263
  900. package/dist/cli/runtime/daemon.js.map +0 -1
  901. package/dist/cli/runtime/envelope-bootstrap.d.ts +0 -17
  902. package/dist/cli/runtime/envelope-bootstrap.d.ts.map +0 -1
  903. package/dist/cli/runtime/envelope-bootstrap.js +0 -56
  904. package/dist/cli/runtime/envelope-bootstrap.js.map +0 -1
  905. package/dist/cli/runtime/gateway-init.d.ts +0 -55
  906. package/dist/cli/runtime/gateway-init.d.ts.map +0 -1
  907. package/dist/cli/runtime/gateway-init.js +0 -196
  908. package/dist/cli/runtime/gateway-init.js.map +0 -1
  909. package/dist/cli/runtime/gateway-wiring.d.ts +0 -51
  910. package/dist/cli/runtime/gateway-wiring.d.ts.map +0 -1
  911. package/dist/cli/runtime/gateway-wiring.js +0 -215
  912. package/dist/cli/runtime/gateway-wiring.js.map +0 -1
  913. package/dist/cli/runtime/mama-core-init.d.ts +0 -42
  914. package/dist/cli/runtime/mama-core-init.d.ts.map +0 -1
  915. package/dist/cli/runtime/mama-core-init.js +0 -211
  916. package/dist/cli/runtime/mama-core-init.js.map +0 -1
  917. package/dist/cli/runtime/message-router-config.d.ts +0 -4
  918. package/dist/cli/runtime/message-router-config.d.ts.map +0 -1
  919. package/dist/cli/runtime/message-router-config.js +0 -11
  920. package/dist/cli/runtime/message-router-config.js.map +0 -1
  921. package/dist/cli/runtime/metrics-init.d.ts +0 -28
  922. package/dist/cli/runtime/metrics-init.d.ts.map +0 -1
  923. package/dist/cli/runtime/metrics-init.js +0 -131
  924. package/dist/cli/runtime/metrics-init.js.map +0 -1
  925. package/dist/cli/runtime/owner-backfill.d.ts +0 -24
  926. package/dist/cli/runtime/owner-backfill.d.ts.map +0 -1
  927. package/dist/cli/runtime/owner-backfill.js +0 -24
  928. package/dist/cli/runtime/owner-backfill.js.map +0 -1
  929. package/dist/cli/runtime/scheduler-init.d.ts +0 -60
  930. package/dist/cli/runtime/scheduler-init.d.ts.map +0 -1
  931. package/dist/cli/runtime/scheduler-init.js +0 -173
  932. package/dist/cli/runtime/scheduler-init.js.map +0 -1
  933. package/dist/cli/runtime/server-start.d.ts +0 -23
  934. package/dist/cli/runtime/server-start.d.ts.map +0 -1
  935. package/dist/cli/runtime/server-start.js +0 -174
  936. package/dist/cli/runtime/server-start.js.map +0 -1
  937. package/dist/cli/runtime/shutdown.d.ts +0 -46
  938. package/dist/cli/runtime/shutdown.d.ts.map +0 -1
  939. package/dist/cli/runtime/shutdown.js +0 -240
  940. package/dist/cli/runtime/shutdown.js.map +0 -1
  941. package/dist/cli/runtime/temporal-init.d.ts +0 -26
  942. package/dist/cli/runtime/temporal-init.d.ts.map +0 -1
  943. package/dist/cli/runtime/temporal-init.js +0 -57
  944. package/dist/cli/runtime/temporal-init.js.map +0 -1
  945. package/dist/cli/runtime/types.d.ts +0 -127
  946. package/dist/cli/runtime/types.d.ts.map +0 -1
  947. package/dist/cli/runtime/types.js +0 -12
  948. package/dist/cli/runtime/types.js.map +0 -1
  949. package/dist/cli/runtime/utilities.d.ts +0 -72
  950. package/dist/cli/runtime/utilities.d.ts.map +0 -1
  951. package/dist/cli/runtime/utilities.js +0 -472
  952. package/dist/cli/runtime/utilities.js.map +0 -1
  953. package/dist/cli/shutdown-utils.d.ts +0 -6
  954. package/dist/cli/shutdown-utils.d.ts.map +0 -1
  955. package/dist/cli/shutdown-utils.js +0 -11
  956. package/dist/cli/shutdown-utils.js.map +0 -1
  957. package/dist/cli/utils/pid-manager.d.ts +0 -56
  958. package/dist/cli/utils/pid-manager.d.ts.map +0 -1
  959. package/dist/cli/utils/pid-manager.js +0 -141
  960. package/dist/cli/utils/pid-manager.js.map +0 -1
  961. package/dist/concurrency/index.d.ts +0 -13
  962. package/dist/concurrency/index.d.ts.map +0 -1
  963. package/dist/concurrency/index.js +0 -22
  964. package/dist/concurrency/index.js.map +0 -1
  965. package/dist/concurrency/lane-manager.d.ts +0 -113
  966. package/dist/concurrency/lane-manager.d.ts.map +0 -1
  967. package/dist/concurrency/lane-manager.js +0 -248
  968. package/dist/concurrency/lane-manager.js.map +0 -1
  969. package/dist/concurrency/session-key.d.ts +0 -41
  970. package/dist/concurrency/session-key.d.ts.map +0 -1
  971. package/dist/concurrency/session-key.js +0 -61
  972. package/dist/concurrency/session-key.js.map +0 -1
  973. package/dist/concurrency/types.d.ts +0 -73
  974. package/dist/concurrency/types.d.ts.map +0 -1
  975. package/dist/concurrency/types.js +0 -16
  976. package/dist/concurrency/types.js.map +0 -1
  977. package/dist/connectors/framework/raw-store.d.ts +0 -63
  978. package/dist/connectors/framework/raw-store.d.ts.map +0 -1
  979. package/dist/connectors/framework/raw-store.js +0 -356
  980. package/dist/connectors/framework/raw-store.js.map +0 -1
  981. package/dist/connectors/kagemusha/query-tools.d.ts +0 -146
  982. package/dist/connectors/kagemusha/query-tools.d.ts.map +0 -1
  983. package/dist/connectors/kagemusha/query-tools.js +0 -467
  984. package/dist/connectors/kagemusha/query-tools.js.map +0 -1
  985. package/dist/connectors/private-connector-policy.d.ts +0 -174
  986. package/dist/connectors/private-connector-policy.d.ts.map +0 -1
  987. package/dist/connectors/private-connector-policy.js +0 -299
  988. package/dist/connectors/private-connector-policy.js.map +0 -1
  989. package/dist/connectors/private-prompt-overlay.d.ts +0 -17
  990. package/dist/connectors/private-prompt-overlay.d.ts.map +0 -1
  991. package/dist/connectors/private-prompt-overlay.js +0 -156
  992. package/dist/connectors/private-prompt-overlay.js.map +0 -1
  993. package/dist/connectors/trello/query-tools.d.ts +0 -243
  994. package/dist/connectors/trello/query-tools.d.ts.map +0 -1
  995. package/dist/connectors/trello/query-tools.js +0 -661
  996. package/dist/connectors/trello/query-tools.js.map +0 -1
  997. package/dist/db/agent-store.d.ts +0 -145
  998. package/dist/db/agent-store.d.ts.map +0 -1
  999. package/dist/db/agent-store.js +0 -279
  1000. package/dist/db/agent-store.js.map +0 -1
  1001. package/dist/db/migrations/agent-activity-envelope-hash.d.ts +0 -3
  1002. package/dist/db/migrations/agent-activity-envelope-hash.d.ts.map +0 -1
  1003. package/dist/db/migrations/agent-activity-envelope-hash.js +0 -29
  1004. package/dist/db/migrations/agent-activity-envelope-hash.js.map +0 -1
  1005. package/dist/db/migrations/agent-activity-gateway-call-id.d.ts +0 -3
  1006. package/dist/db/migrations/agent-activity-gateway-call-id.d.ts.map +0 -1
  1007. package/dist/db/migrations/agent-activity-gateway-call-id.js +0 -17
  1008. package/dist/db/migrations/agent-activity-gateway-call-id.js.map +0 -1
  1009. package/dist/db/migrations/agent-activity-tool-name.d.ts +0 -8
  1010. package/dist/db/migrations/agent-activity-tool-name.d.ts.map +0 -1
  1011. package/dist/db/migrations/agent-activity-tool-name.js +0 -24
  1012. package/dist/db/migrations/agent-activity-tool-name.js.map +0 -1
  1013. package/dist/db/migrations/agent-activity-validation-columns.d.ts +0 -3
  1014. package/dist/db/migrations/agent-activity-validation-columns.d.ts.map +0 -1
  1015. package/dist/db/migrations/agent-activity-validation-columns.js +0 -22
  1016. package/dist/db/migrations/agent-activity-validation-columns.js.map +0 -1
  1017. package/dist/db/migrations/agent-metrics-response-avg.d.ts +0 -3
  1018. package/dist/db/migrations/agent-metrics-response-avg.d.ts.map +0 -1
  1019. package/dist/db/migrations/agent-metrics-response-avg.js +0 -19
  1020. package/dist/db/migrations/agent-metrics-response-avg.js.map +0 -1
  1021. package/dist/db/migrations/agent-store-tables.d.ts +0 -3
  1022. package/dist/db/migrations/agent-store-tables.d.ts.map +0 -1
  1023. package/dist/db/migrations/agent-store-tables.js +0 -64
  1024. package/dist/db/migrations/agent-store-tables.js.map +0 -1
  1025. package/dist/db/migrations/envelope-tables.d.ts +0 -3
  1026. package/dist/db/migrations/envelope-tables.d.ts.map +0 -1
  1027. package/dist/db/migrations/envelope-tables.js +0 -38
  1028. package/dist/db/migrations/envelope-tables.js.map +0 -1
  1029. package/dist/db/migrations/operator-owner-action-candidates.d.ts +0 -19
  1030. package/dist/db/migrations/operator-owner-action-candidates.d.ts.map +0 -1
  1031. package/dist/db/migrations/operator-owner-action-candidates.js +0 -254
  1032. package/dist/db/migrations/operator-owner-action-candidates.js.map +0 -1
  1033. package/dist/db/migrations/operator-procedures.d.ts +0 -4
  1034. package/dist/db/migrations/operator-procedures.d.ts.map +0 -1
  1035. package/dist/db/migrations/operator-procedures.js +0 -63
  1036. package/dist/db/migrations/operator-procedures.js.map +0 -1
  1037. package/dist/db/migrations/operator-task-classification.d.ts +0 -15
  1038. package/dist/db/migrations/operator-task-classification.d.ts.map +0 -1
  1039. package/dist/db/migrations/operator-task-classification.js +0 -25
  1040. package/dist/db/migrations/operator-task-classification.js.map +0 -1
  1041. package/dist/db/migrations/operator-task-external-lifecycle.d.ts +0 -17
  1042. package/dist/db/migrations/operator-task-external-lifecycle.d.ts.map +0 -1
  1043. package/dist/db/migrations/operator-task-external-lifecycle.js +0 -199
  1044. package/dist/db/migrations/operator-task-external-lifecycle.js.map +0 -1
  1045. package/dist/db/migrations/operator-task-review-lifecycle.d.ts +0 -4
  1046. package/dist/db/migrations/operator-task-review-lifecycle.d.ts.map +0 -1
  1047. package/dist/db/migrations/operator-task-review-lifecycle.js +0 -17
  1048. package/dist/db/migrations/operator-task-review-lifecycle.js.map +0 -1
  1049. package/dist/db/migrations/operator-task-temporal.d.ts +0 -8
  1050. package/dist/db/migrations/operator-task-temporal.d.ts.map +0 -1
  1051. package/dist/db/migrations/operator-task-temporal.js +0 -214
  1052. package/dist/db/migrations/operator-task-temporal.js.map +0 -1
  1053. package/dist/db/migrations/owner-action-effects.d.ts +0 -18
  1054. package/dist/db/migrations/owner-action-effects.d.ts.map +0 -1
  1055. package/dist/db/migrations/owner-action-effects.js +0 -111
  1056. package/dist/db/migrations/owner-action-effects.js.map +0 -1
  1057. package/dist/db/migrations/raw-item-revisions.d.ts +0 -4
  1058. package/dist/db/migrations/raw-item-revisions.d.ts.map +0 -1
  1059. package/dist/db/migrations/raw-item-revisions.js +0 -29
  1060. package/dist/db/migrations/raw-item-revisions.js.map +0 -1
  1061. package/dist/db/migrations/token-usage-agent-version.d.ts +0 -3
  1062. package/dist/db/migrations/token-usage-agent-version.d.ts.map +0 -1
  1063. package/dist/db/migrations/token-usage-agent-version.js +0 -16
  1064. package/dist/db/migrations/token-usage-agent-version.js.map +0 -1
  1065. package/dist/db/migrations/validation-session-tables.d.ts +0 -3
  1066. package/dist/db/migrations/validation-session-tables.d.ts.map +0 -1
  1067. package/dist/db/migrations/validation-session-tables.js +0 -59
  1068. package/dist/db/migrations/validation-session-tables.js.map +0 -1
  1069. package/dist/envelope/authority.d.ts +0 -15
  1070. package/dist/envelope/authority.d.ts.map +0 -1
  1071. package/dist/envelope/authority.js +0 -95
  1072. package/dist/envelope/authority.js.map +0 -1
  1073. package/dist/envelope/canonical.d.ts +0 -14
  1074. package/dist/envelope/canonical.d.ts.map +0 -1
  1075. package/dist/envelope/canonical.js +0 -68
  1076. package/dist/envelope/canonical.js.map +0 -1
  1077. package/dist/envelope/enforcer.d.ts +0 -30
  1078. package/dist/envelope/enforcer.d.ts.map +0 -1
  1079. package/dist/envelope/enforcer.js +0 -286
  1080. package/dist/envelope/enforcer.js.map +0 -1
  1081. package/dist/envelope/expiry.d.ts +0 -2
  1082. package/dist/envelope/expiry.d.ts.map +0 -1
  1083. package/dist/envelope/expiry.js +0 -15
  1084. package/dist/envelope/expiry.js.map +0 -1
  1085. package/dist/envelope/index.d.ts +0 -9
  1086. package/dist/envelope/index.d.ts.map +0 -1
  1087. package/dist/envelope/index.js +0 -25
  1088. package/dist/envelope/index.js.map +0 -1
  1089. package/dist/envelope/key-provider.d.ts +0 -7
  1090. package/dist/envelope/key-provider.d.ts.map +0 -1
  1091. package/dist/envelope/key-provider.js +0 -137
  1092. package/dist/envelope/key-provider.js.map +0 -1
  1093. package/dist/envelope/reactive-config.d.ts +0 -24
  1094. package/dist/envelope/reactive-config.d.ts.map +0 -1
  1095. package/dist/envelope/reactive-config.js +0 -198
  1096. package/dist/envelope/reactive-config.js.map +0 -1
  1097. package/dist/envelope/run-guard.d.ts +0 -10
  1098. package/dist/envelope/run-guard.d.ts.map +0 -1
  1099. package/dist/envelope/run-guard.js +0 -19
  1100. package/dist/envelope/run-guard.js.map +0 -1
  1101. package/dist/envelope/signature.d.ts +0 -15
  1102. package/dist/envelope/signature.d.ts.map +0 -1
  1103. package/dist/envelope/signature.js +0 -75
  1104. package/dist/envelope/signature.js.map +0 -1
  1105. package/dist/envelope/store.d.ts +0 -16
  1106. package/dist/envelope/store.d.ts.map +0 -1
  1107. package/dist/envelope/store.js +0 -118
  1108. package/dist/envelope/store.js.map +0 -1
  1109. package/dist/envelope/tool-connector-scope.d.ts +0 -35
  1110. package/dist/envelope/tool-connector-scope.d.ts.map +0 -1
  1111. package/dist/envelope/tool-connector-scope.js +0 -61
  1112. package/dist/envelope/tool-connector-scope.js.map +0 -1
  1113. package/dist/envelope/types.d.ts +0 -60
  1114. package/dist/envelope/types.d.ts.map +0 -1
  1115. package/dist/envelope/types.js +0 -9
  1116. package/dist/envelope/types.js.map +0 -1
  1117. package/dist/evidence/effects.d.ts +0 -125
  1118. package/dist/evidence/effects.d.ts.map +0 -1
  1119. package/dist/evidence/effects.js +0 -409
  1120. package/dist/evidence/effects.js.map +0 -1
  1121. package/dist/evidence/read.d.ts +0 -130
  1122. package/dist/evidence/read.d.ts.map +0 -1
  1123. package/dist/evidence/read.js +0 -167
  1124. package/dist/evidence/read.js.map +0 -1
  1125. package/dist/gateways/attachment-utils.d.ts +0 -28
  1126. package/dist/gateways/attachment-utils.d.ts.map +0 -1
  1127. package/dist/gateways/attachment-utils.js +0 -489
  1128. package/dist/gateways/attachment-utils.js.map +0 -1
  1129. package/dist/gateways/channel-history.d.ts +0 -148
  1130. package/dist/gateways/channel-history.d.ts.map +0 -1
  1131. package/dist/gateways/channel-history.js +0 -385
  1132. package/dist/gateways/channel-history.js.map +0 -1
  1133. package/dist/gateways/context-injector.d.ts +0 -255
  1134. package/dist/gateways/context-injector.d.ts.map +0 -1
  1135. package/dist/gateways/context-injector.js +0 -285
  1136. package/dist/gateways/context-injector.js.map +0 -1
  1137. package/dist/gateways/image-analyzer.d.ts +0 -28
  1138. package/dist/gateways/image-analyzer.d.ts.map +0 -1
  1139. package/dist/gateways/image-analyzer.js +0 -154
  1140. package/dist/gateways/image-analyzer.js.map +0 -1
  1141. package/dist/gateways/index.d.ts +0 -35
  1142. package/dist/gateways/index.d.ts.map +0 -1
  1143. package/dist/gateways/index.js +0 -55
  1144. package/dist/gateways/index.js.map +0 -1
  1145. package/dist/gateways/member-candidate-store.d.ts +0 -26
  1146. package/dist/gateways/member-candidate-store.d.ts.map +0 -1
  1147. package/dist/gateways/member-candidate-store.js +0 -90
  1148. package/dist/gateways/member-candidate-store.js.map +0 -1
  1149. package/dist/gateways/member-effective-scope.d.ts +0 -25
  1150. package/dist/gateways/member-effective-scope.d.ts.map +0 -1
  1151. package/dist/gateways/member-effective-scope.js +0 -323
  1152. package/dist/gateways/member-effective-scope.js.map +0 -1
  1153. package/dist/gateways/message-router.d.ts +0 -239
  1154. package/dist/gateways/message-router.d.ts.map +0 -1
  1155. package/dist/gateways/message-router.js +0 -1714
  1156. package/dist/gateways/message-router.js.map +0 -1
  1157. package/dist/gateways/plugin-loader.d.ts +0 -80
  1158. package/dist/gateways/plugin-loader.d.ts.map +0 -1
  1159. package/dist/gateways/plugin-loader.js +0 -299
  1160. package/dist/gateways/plugin-loader.js.map +0 -1
  1161. package/dist/gateways/principal.d.ts +0 -37
  1162. package/dist/gateways/principal.d.ts.map +0 -1
  1163. package/dist/gateways/principal.js +0 -95
  1164. package/dist/gateways/principal.js.map +0 -1
  1165. package/dist/gateways/report-projection-v1.d.ts +0 -41
  1166. package/dist/gateways/report-projection-v1.d.ts.map +0 -1
  1167. package/dist/gateways/report-projection-v1.js +0 -160
  1168. package/dist/gateways/report-projection-v1.js.map +0 -1
  1169. package/dist/gateways/telegram-media.d.ts +0 -41
  1170. package/dist/gateways/telegram-media.d.ts.map +0 -1
  1171. package/dist/gateways/telegram-media.js +0 -242
  1172. package/dist/gateways/telegram-media.js.map +0 -1
  1173. package/dist/gateways/telegram-report-context-store.d.ts +0 -131
  1174. package/dist/gateways/telegram-report-context-store.d.ts.map +0 -1
  1175. package/dist/gateways/telegram-report-context-store.js +0 -388
  1176. package/dist/gateways/telegram-report-context-store.js.map +0 -1
  1177. package/dist/gateways/tool-status-tracker.d.ts +0 -87
  1178. package/dist/gateways/tool-status-tracker.d.ts.map +0 -1
  1179. package/dist/gateways/tool-status-tracker.js +0 -284
  1180. package/dist/gateways/tool-status-tracker.js.map +0 -1
  1181. package/dist/mcp/code-act-api-client.d.ts +0 -32
  1182. package/dist/mcp/code-act-api-client.d.ts.map +0 -1
  1183. package/dist/mcp/code-act-api-client.js +0 -80
  1184. package/dist/mcp/code-act-api-client.js.map +0 -1
  1185. package/dist/mcp/code-act-mcp-config.d.ts +0 -49
  1186. package/dist/mcp/code-act-mcp-config.d.ts.map +0 -1
  1187. package/dist/mcp/code-act-mcp-config.js +0 -124
  1188. package/dist/mcp/code-act-mcp-config.js.map +0 -1
  1189. package/dist/mcp/code-act-server.d.ts +0 -14
  1190. package/dist/mcp/code-act-server.d.ts.map +0 -1
  1191. package/dist/mcp/code-act-server.js +0 -204
  1192. package/dist/mcp/code-act-server.js.map +0 -1
  1193. package/dist/mcp/code-act-terminal-transport.d.ts +0 -64
  1194. package/dist/mcp/code-act-terminal-transport.d.ts.map +0 -1
  1195. package/dist/mcp/code-act-terminal-transport.js +0 -176
  1196. package/dist/mcp/code-act-terminal-transport.js.map +0 -1
  1197. package/dist/memory/agent-notice-queue.d.ts +0 -24
  1198. package/dist/memory/agent-notice-queue.d.ts.map +0 -1
  1199. package/dist/memory/agent-notice-queue.js +0 -40
  1200. package/dist/memory/agent-notice-queue.js.map +0 -1
  1201. package/dist/memory/audit-task-queue.d.ts +0 -28
  1202. package/dist/memory/audit-task-queue.d.ts.map +0 -1
  1203. package/dist/memory/audit-task-queue.js +0 -29
  1204. package/dist/memory/audit-task-queue.js.map +0 -1
  1205. package/dist/memory/bootstrap-context.d.ts +0 -12
  1206. package/dist/memory/bootstrap-context.d.ts.map +0 -1
  1207. package/dist/memory/bootstrap-context.js +0 -68
  1208. package/dist/memory/bootstrap-context.js.map +0 -1
  1209. package/dist/memory/history-extractor.d.ts +0 -69
  1210. package/dist/memory/history-extractor.d.ts.map +0 -1
  1211. package/dist/memory/history-extractor.js +0 -210
  1212. package/dist/memory/history-extractor.js.map +0 -1
  1213. package/dist/memory/memory-agent-ack.d.ts +0 -4
  1214. package/dist/memory/memory-agent-ack.d.ts.map +0 -1
  1215. package/dist/memory/memory-agent-ack.js +0 -54
  1216. package/dist/memory/memory-agent-ack.js.map +0 -1
  1217. package/dist/memory/memory-agent-dashboard.d.ts +0 -35
  1218. package/dist/memory/memory-agent-dashboard.d.ts.map +0 -1
  1219. package/dist/memory/memory-agent-dashboard.js +0 -116
  1220. package/dist/memory/memory-agent-dashboard.js.map +0 -1
  1221. package/dist/memory/memory-logger.d.ts +0 -47
  1222. package/dist/memory/memory-logger.d.ts.map +0 -1
  1223. package/dist/memory/memory-logger.js +0 -126
  1224. package/dist/memory/memory-logger.js.map +0 -1
  1225. package/dist/memory/provenance-live.d.ts +0 -111
  1226. package/dist/memory/provenance-live.d.ts.map +0 -1
  1227. package/dist/memory/provenance-live.js +0 -381
  1228. package/dist/memory/provenance-live.js.map +0 -1
  1229. package/dist/memory/provenance-resolver.d.ts +0 -184
  1230. package/dist/memory/provenance-resolver.d.ts.map +0 -1
  1231. package/dist/memory/provenance-resolver.js +0 -152
  1232. package/dist/memory/provenance-resolver.js.map +0 -1
  1233. package/dist/memory/raw-backed-memory-ingest.d.ts +0 -26
  1234. package/dist/memory/raw-backed-memory-ingest.d.ts.map +0 -1
  1235. package/dist/memory/raw-backed-memory-ingest.js +0 -214
  1236. package/dist/memory/raw-backed-memory-ingest.js.map +0 -1
  1237. package/dist/memory/recall-bundle-formatter.d.ts +0 -26
  1238. package/dist/memory/recall-bundle-formatter.d.ts.map +0 -1
  1239. package/dist/memory/recall-bundle-formatter.js +0 -53
  1240. package/dist/memory/recall-bundle-formatter.js.map +0 -1
  1241. package/dist/memory/save-candidate-extractor.d.ts +0 -16
  1242. package/dist/memory/save-candidate-extractor.d.ts.map +0 -1
  1243. package/dist/memory/save-candidate-extractor.js +0 -127
  1244. package/dist/memory/save-candidate-extractor.js.map +0 -1
  1245. package/dist/memory/save-candidate-types.d.ts +0 -16
  1246. package/dist/memory/save-candidate-types.d.ts.map +0 -1
  1247. package/dist/memory/save-candidate-types.js +0 -3
  1248. package/dist/memory/save-candidate-types.js.map +0 -1
  1249. package/dist/memory/scope-context.d.ts +0 -12
  1250. package/dist/memory/scope-context.d.ts.map +0 -1
  1251. package/dist/memory/scope-context.js +0 -18
  1252. package/dist/memory/scope-context.js.map +0 -1
  1253. package/dist/memory/secret-filter.d.ts +0 -23
  1254. package/dist/memory/secret-filter.d.ts.map +0 -1
  1255. package/dist/memory/secret-filter.js +0 -90
  1256. package/dist/memory/secret-filter.js.map +0 -1
  1257. package/dist/multi-agent/agent-event-bus.d.ts +0 -50
  1258. package/dist/multi-agent/agent-event-bus.d.ts.map +0 -1
  1259. package/dist/multi-agent/agent-event-bus.js +0 -101
  1260. package/dist/multi-agent/agent-event-bus.js.map +0 -1
  1261. package/dist/multi-agent/agent-process-manager.d.ts +0 -205
  1262. package/dist/multi-agent/agent-process-manager.d.ts.map +0 -1
  1263. package/dist/multi-agent/agent-process-manager.js +0 -1191
  1264. package/dist/multi-agent/agent-process-manager.js.map +0 -1
  1265. package/dist/multi-agent/bmad-templates.d.ts +0 -49
  1266. package/dist/multi-agent/bmad-templates.d.ts.map +0 -1
  1267. package/dist/multi-agent/bmad-templates.js +0 -121
  1268. package/dist/multi-agent/bmad-templates.js.map +0 -1
  1269. package/dist/multi-agent/runtime-process.d.ts +0 -74
  1270. package/dist/multi-agent/runtime-process.d.ts.map +0 -1
  1271. package/dist/multi-agent/runtime-process.js +0 -160
  1272. package/dist/multi-agent/runtime-process.js.map +0 -1
  1273. package/dist/multi-agent/tool-permission-manager.d.ts +0 -70
  1274. package/dist/multi-agent/tool-permission-manager.d.ts.map +0 -1
  1275. package/dist/multi-agent/tool-permission-manager.js +0 -195
  1276. package/dist/multi-agent/tool-permission-manager.js.map +0 -1
  1277. package/dist/multi-agent/types.d.ts +0 -438
  1278. package/dist/multi-agent/types.d.ts.map +0 -1
  1279. package/dist/multi-agent/types.js +0 -27
  1280. package/dist/multi-agent/types.js.map +0 -1
  1281. package/dist/multi-agent/wiki-agent-persona.d.ts +0 -16
  1282. package/dist/multi-agent/wiki-agent-persona.d.ts.map +0 -1
  1283. package/dist/multi-agent/wiki-agent-persona.js +0 -23
  1284. package/dist/multi-agent/wiki-agent-persona.js.map +0 -1
  1285. package/dist/multi-agent/workflow-types.d.ts +0 -186
  1286. package/dist/multi-agent/workflow-types.d.ts.map +0 -1
  1287. package/dist/multi-agent/workflow-types.js +0 -9
  1288. package/dist/multi-agent/workflow-types.js.map +0 -1
  1289. package/dist/observability/code-audit.d.ts +0 -87
  1290. package/dist/observability/code-audit.d.ts.map +0 -1
  1291. package/dist/observability/code-audit.js +0 -414
  1292. package/dist/observability/code-audit.js.map +0 -1
  1293. package/dist/observability/health-check.d.ts +0 -102
  1294. package/dist/observability/health-check.d.ts.map +0 -1
  1295. package/dist/observability/health-check.js +0 -422
  1296. package/dist/observability/health-check.js.map +0 -1
  1297. package/dist/observability/health-score.d.ts +0 -29
  1298. package/dist/observability/health-score.d.ts.map +0 -1
  1299. package/dist/observability/health-score.js +0 -83
  1300. package/dist/observability/health-score.js.map +0 -1
  1301. package/dist/observability/metrics-cleanup.d.ts +0 -24
  1302. package/dist/observability/metrics-cleanup.d.ts.map +0 -1
  1303. package/dist/observability/metrics-cleanup.js +0 -51
  1304. package/dist/observability/metrics-cleanup.js.map +0 -1
  1305. package/dist/observability/metrics-store.d.ts +0 -52
  1306. package/dist/observability/metrics-store.d.ts.map +0 -1
  1307. package/dist/observability/metrics-store.js +0 -186
  1308. package/dist/observability/metrics-store.js.map +0 -1
  1309. package/dist/observability/operational-issues.d.ts +0 -55
  1310. package/dist/observability/operational-issues.d.ts.map +0 -1
  1311. package/dist/observability/operational-issues.js +0 -170
  1312. package/dist/observability/operational-issues.js.map +0 -1
  1313. package/dist/onboarding/agent-contract.d.ts +0 -42
  1314. package/dist/onboarding/agent-contract.d.ts.map +0 -1
  1315. package/dist/onboarding/agent-contract.js +0 -129
  1316. package/dist/onboarding/agent-contract.js.map +0 -1
  1317. package/dist/onboarding/assess-live.d.ts +0 -22
  1318. package/dist/onboarding/assess-live.d.ts.map +0 -1
  1319. package/dist/onboarding/assess-live.js +0 -200
  1320. package/dist/onboarding/assess-live.js.map +0 -1
  1321. package/dist/onboarding/bootstrap-template.d.ts +0 -5
  1322. package/dist/onboarding/bootstrap-template.d.ts.map +0 -1
  1323. package/dist/onboarding/bootstrap-template.js +0 -34
  1324. package/dist/onboarding/bootstrap-template.js.map +0 -1
  1325. package/dist/operator/action-verifier.d.ts +0 -75
  1326. package/dist/operator/action-verifier.d.ts.map +0 -1
  1327. package/dist/operator/action-verifier.js +0 -149
  1328. package/dist/operator/action-verifier.js.map +0 -1
  1329. package/dist/operator/board-delta-gate.d.ts +0 -131
  1330. package/dist/operator/board-delta-gate.d.ts.map +0 -1
  1331. package/dist/operator/board-delta-gate.js +0 -181
  1332. package/dist/operator/board-delta-gate.js.map +0 -1
  1333. package/dist/operator/board-pipeline-render.d.ts +0 -16
  1334. package/dist/operator/board-pipeline-render.d.ts.map +0 -1
  1335. package/dist/operator/board-pipeline-render.js +0 -69
  1336. package/dist/operator/board-pipeline-render.js.map +0 -1
  1337. package/dist/operator/board-reconcile.d.ts +0 -61
  1338. package/dist/operator/board-reconcile.d.ts.map +0 -1
  1339. package/dist/operator/board-reconcile.js +0 -157
  1340. package/dist/operator/board-reconcile.js.map +0 -1
  1341. package/dist/operator/board-refresh-gate.d.ts +0 -39
  1342. package/dist/operator/board-refresh-gate.d.ts.map +0 -1
  1343. package/dist/operator/board-refresh-gate.js +0 -83
  1344. package/dist/operator/board-refresh-gate.js.map +0 -1
  1345. package/dist/operator/changes-projection.d.ts +0 -72
  1346. package/dist/operator/changes-projection.d.ts.map +0 -1
  1347. package/dist/operator/changes-projection.js +0 -110
  1348. package/dist/operator/changes-projection.js.map +0 -1
  1349. package/dist/operator/connector-delta-repo.d.ts +0 -33
  1350. package/dist/operator/connector-delta-repo.d.ts.map +0 -1
  1351. package/dist/operator/connector-delta-repo.js +0 -0
  1352. package/dist/operator/connector-delta-repo.js.map +0 -1
  1353. package/dist/operator/console-brief.d.ts +0 -40
  1354. package/dist/operator/console-brief.d.ts.map +0 -1
  1355. package/dist/operator/console-brief.js +0 -246
  1356. package/dist/operator/console-brief.js.map +0 -1
  1357. package/dist/operator/experience-evidence.d.ts +0 -18
  1358. package/dist/operator/experience-evidence.d.ts.map +0 -1
  1359. package/dist/operator/experience-evidence.js +0 -82
  1360. package/dist/operator/experience-evidence.js.map +0 -1
  1361. package/dist/operator/experience-hints.d.ts +0 -44
  1362. package/dist/operator/experience-hints.d.ts.map +0 -1
  1363. package/dist/operator/experience-hints.js +0 -98
  1364. package/dist/operator/experience-hints.js.map +0 -1
  1365. package/dist/operator/external-correlation.d.ts +0 -94
  1366. package/dist/operator/external-correlation.d.ts.map +0 -1
  1367. package/dist/operator/external-correlation.js +0 -177
  1368. package/dist/operator/external-correlation.js.map +0 -1
  1369. package/dist/operator/external-lifecycle-candidates.d.ts +0 -70
  1370. package/dist/operator/external-lifecycle-candidates.d.ts.map +0 -1
  1371. package/dist/operator/external-lifecycle-candidates.js +0 -579
  1372. package/dist/operator/external-lifecycle-candidates.js.map +0 -1
  1373. package/dist/operator/external-lifecycle-discovery.d.ts +0 -61
  1374. package/dist/operator/external-lifecycle-discovery.d.ts.map +0 -1
  1375. package/dist/operator/external-lifecycle-discovery.js +0 -103
  1376. package/dist/operator/external-lifecycle-discovery.js.map +0 -1
  1377. package/dist/operator/external-lifecycle.d.ts +0 -105
  1378. package/dist/operator/external-lifecycle.d.ts.map +0 -1
  1379. package/dist/operator/external-lifecycle.js +0 -27
  1380. package/dist/operator/external-lifecycle.js.map +0 -1
  1381. package/dist/operator/file-coordination.d.ts +0 -7
  1382. package/dist/operator/file-coordination.d.ts.map +0 -1
  1383. package/dist/operator/file-coordination.js +0 -84
  1384. package/dist/operator/file-coordination.js.map +0 -1
  1385. package/dist/operator/file-export.d.ts +0 -22
  1386. package/dist/operator/file-export.d.ts.map +0 -1
  1387. package/dist/operator/file-export.js +0 -115
  1388. package/dist/operator/file-export.js.map +0 -1
  1389. package/dist/operator/leg-cadence.d.ts +0 -72
  1390. package/dist/operator/leg-cadence.d.ts.map +0 -1
  1391. package/dist/operator/leg-cadence.js +0 -122
  1392. package/dist/operator/leg-cadence.js.map +0 -1
  1393. package/dist/operator/mama-memory-port.d.ts +0 -13
  1394. package/dist/operator/mama-memory-port.d.ts.map +0 -1
  1395. package/dist/operator/mama-memory-port.js +0 -33
  1396. package/dist/operator/mama-memory-port.js.map +0 -1
  1397. package/dist/operator/operator-interfaces.d.ts +0 -136
  1398. package/dist/operator/operator-interfaces.d.ts.map +0 -1
  1399. package/dist/operator/operator-interfaces.js +0 -15
  1400. package/dist/operator/operator-interfaces.js.map +0 -1
  1401. package/dist/operator/operator-trigger-loop.d.ts +0 -203
  1402. package/dist/operator/operator-trigger-loop.d.ts.map +0 -1
  1403. package/dist/operator/operator-trigger-loop.js +0 -827
  1404. package/dist/operator/operator-trigger-loop.js.map +0 -1
  1405. package/dist/operator/owner-action-effects.d.ts +0 -112
  1406. package/dist/operator/owner-action-effects.d.ts.map +0 -1
  1407. package/dist/operator/owner-action-effects.js +0 -375
  1408. package/dist/operator/owner-action-effects.js.map +0 -1
  1409. package/dist/operator/owner-event-effects.d.ts +0 -65
  1410. package/dist/operator/owner-event-effects.d.ts.map +0 -1
  1411. package/dist/operator/owner-event-effects.js +0 -249
  1412. package/dist/operator/owner-event-effects.js.map +0 -1
  1413. package/dist/operator/owner-event-inbox.d.ts +0 -124
  1414. package/dist/operator/owner-event-inbox.d.ts.map +0 -1
  1415. package/dist/operator/owner-event-inbox.js +0 -440
  1416. package/dist/operator/owner-event-inbox.js.map +0 -1
  1417. package/dist/operator/owner-event-loop.d.ts +0 -99
  1418. package/dist/operator/owner-event-loop.d.ts.map +0 -1
  1419. package/dist/operator/owner-event-loop.js +0 -253
  1420. package/dist/operator/owner-event-loop.js.map +0 -1
  1421. package/dist/operator/owner-event-outcome.d.ts +0 -36
  1422. package/dist/operator/owner-event-outcome.d.ts.map +0 -1
  1423. package/dist/operator/owner-event-outcome.js +0 -174
  1424. package/dist/operator/owner-event-outcome.js.map +0 -1
  1425. package/dist/operator/owner-event-policy.d.ts +0 -40
  1426. package/dist/operator/owner-event-policy.d.ts.map +0 -1
  1427. package/dist/operator/owner-event-policy.js +0 -75
  1428. package/dist/operator/owner-event-policy.js.map +0 -1
  1429. package/dist/operator/owner-event-prompt.d.ts +0 -21
  1430. package/dist/operator/owner-event-prompt.d.ts.map +0 -1
  1431. package/dist/operator/owner-event-prompt.js +0 -69
  1432. package/dist/operator/owner-event-prompt.js.map +0 -1
  1433. package/dist/operator/owner-runtime-journal.d.ts +0 -21
  1434. package/dist/operator/owner-runtime-journal.d.ts.map +0 -1
  1435. package/dist/operator/owner-runtime-journal.js +0 -135
  1436. package/dist/operator/owner-runtime-journal.js.map +0 -1
  1437. package/dist/operator/owner-runtime.d.ts +0 -48
  1438. package/dist/operator/owner-runtime.d.ts.map +0 -1
  1439. package/dist/operator/owner-runtime.js +0 -99
  1440. package/dist/operator/owner-runtime.js.map +0 -1
  1441. package/dist/operator/pending-report-store.d.ts +0 -99
  1442. package/dist/operator/pending-report-store.d.ts.map +0 -1
  1443. package/dist/operator/pending-report-store.js +0 -554
  1444. package/dist/operator/pending-report-store.js.map +0 -1
  1445. package/dist/operator/procedure-activation.d.ts +0 -7
  1446. package/dist/operator/procedure-activation.d.ts.map +0 -1
  1447. package/dist/operator/procedure-activation.js +0 -132
  1448. package/dist/operator/procedure-activation.js.map +0 -1
  1449. package/dist/operator/procedure-projection.d.ts +0 -25
  1450. package/dist/operator/procedure-projection.d.ts.map +0 -1
  1451. package/dist/operator/procedure-projection.js +0 -80
  1452. package/dist/operator/procedure-projection.js.map +0 -1
  1453. package/dist/operator/procedure-runtime.d.ts +0 -45
  1454. package/dist/operator/procedure-runtime.d.ts.map +0 -1
  1455. package/dist/operator/procedure-runtime.js +0 -496
  1456. package/dist/operator/procedure-runtime.js.map +0 -1
  1457. package/dist/operator/procedure-store.d.ts +0 -97
  1458. package/dist/operator/procedure-store.d.ts.map +0 -1
  1459. package/dist/operator/procedure-store.js +0 -368
  1460. package/dist/operator/procedure-store.js.map +0 -1
  1461. package/dist/operator/provenance-lookup.d.ts +0 -18
  1462. package/dist/operator/provenance-lookup.d.ts.map +0 -1
  1463. package/dist/operator/provenance-lookup.js +0 -54
  1464. package/dist/operator/provenance-lookup.js.map +0 -1
  1465. package/dist/operator/repair-request.d.ts +0 -29
  1466. package/dist/operator/repair-request.d.ts.map +0 -1
  1467. package/dist/operator/repair-request.js +0 -115
  1468. package/dist/operator/repair-request.js.map +0 -1
  1469. package/dist/operator/report-carry-delivery.d.ts +0 -35
  1470. package/dist/operator/report-carry-delivery.d.ts.map +0 -1
  1471. package/dist/operator/report-carry-delivery.js +0 -55
  1472. package/dist/operator/report-carry-delivery.js.map +0 -1
  1473. package/dist/operator/report-carry.d.ts +0 -66
  1474. package/dist/operator/report-carry.d.ts.map +0 -1
  1475. package/dist/operator/report-carry.js +0 -352
  1476. package/dist/operator/report-carry.js.map +0 -1
  1477. package/dist/operator/report-delivery-coordinator.d.ts +0 -84
  1478. package/dist/operator/report-delivery-coordinator.d.ts.map +0 -1
  1479. package/dist/operator/report-delivery-coordinator.js +0 -146
  1480. package/dist/operator/report-delivery-coordinator.js.map +0 -1
  1481. package/dist/operator/report-run.d.ts +0 -52
  1482. package/dist/operator/report-run.d.ts.map +0 -1
  1483. package/dist/operator/report-run.js +0 -32
  1484. package/dist/operator/report-run.js.map +0 -1
  1485. package/dist/operator/report-scheduler.d.ts +0 -66
  1486. package/dist/operator/report-scheduler.d.ts.map +0 -1
  1487. package/dist/operator/report-scheduler.js +0 -135
  1488. package/dist/operator/report-scheduler.js.map +0 -1
  1489. package/dist/operator/runtime-config.d.ts +0 -10
  1490. package/dist/operator/runtime-config.d.ts.map +0 -1
  1491. package/dist/operator/runtime-config.js +0 -21
  1492. package/dist/operator/runtime-config.js.map +0 -1
  1493. package/dist/operator/situation-report.d.ts +0 -197
  1494. package/dist/operator/situation-report.d.ts.map +0 -1
  1495. package/dist/operator/situation-report.js +0 -462
  1496. package/dist/operator/situation-report.js.map +0 -1
  1497. package/dist/operator/subagent-stimulus.d.ts +0 -34
  1498. package/dist/operator/subagent-stimulus.d.ts.map +0 -1
  1499. package/dist/operator/subagent-stimulus.js +0 -145
  1500. package/dist/operator/subagent-stimulus.js.map +0 -1
  1501. package/dist/operator/task-ledger.d.ts +0 -879
  1502. package/dist/operator/task-ledger.d.ts.map +0 -1
  1503. package/dist/operator/task-ledger.js +0 -3601
  1504. package/dist/operator/task-ledger.js.map +0 -1
  1505. package/dist/operator/task-list-views.d.ts +0 -91
  1506. package/dist/operator/task-list-views.d.ts.map +0 -1
  1507. package/dist/operator/task-list-views.js +0 -532
  1508. package/dist/operator/task-list-views.js.map +0 -1
  1509. package/dist/operator/task-temporal.d.ts +0 -24
  1510. package/dist/operator/task-temporal.d.ts.map +0 -1
  1511. package/dist/operator/task-temporal.js +0 -123
  1512. package/dist/operator/task-temporal.js.map +0 -1
  1513. package/dist/operator/temporal-effect.d.ts +0 -65
  1514. package/dist/operator/temporal-effect.d.ts.map +0 -1
  1515. package/dist/operator/temporal-effect.js +0 -71
  1516. package/dist/operator/temporal-effect.js.map +0 -1
  1517. package/dist/operator/temporal-reconcile.d.ts +0 -49
  1518. package/dist/operator/temporal-reconcile.d.ts.map +0 -1
  1519. package/dist/operator/temporal-reconcile.js +0 -231
  1520. package/dist/operator/temporal-reconcile.js.map +0 -1
  1521. package/dist/operator/temporal-runtime.d.ts +0 -51
  1522. package/dist/operator/temporal-runtime.d.ts.map +0 -1
  1523. package/dist/operator/temporal-runtime.js +0 -104
  1524. package/dist/operator/temporal-runtime.js.map +0 -1
  1525. package/dist/operator/temporal-worker.d.ts +0 -18
  1526. package/dist/operator/temporal-worker.d.ts.map +0 -1
  1527. package/dist/operator/temporal-worker.js +0 -82
  1528. package/dist/operator/temporal-worker.js.map +0 -1
  1529. package/dist/operator/thread-brief-memory.d.ts +0 -29
  1530. package/dist/operator/thread-brief-memory.d.ts.map +0 -1
  1531. package/dist/operator/thread-brief-memory.js +0 -61
  1532. package/dist/operator/thread-brief-memory.js.map +0 -1
  1533. package/dist/operator/trigger-author.d.ts +0 -63
  1534. package/dist/operator/trigger-author.d.ts.map +0 -1
  1535. package/dist/operator/trigger-author.js +0 -384
  1536. package/dist/operator/trigger-author.js.map +0 -1
  1537. package/dist/operator/trigger-evolve.d.ts +0 -31
  1538. package/dist/operator/trigger-evolve.d.ts.map +0 -1
  1539. package/dist/operator/trigger-evolve.js +0 -51
  1540. package/dist/operator/trigger-evolve.js.map +0 -1
  1541. package/dist/operator/trigger-fire.d.ts +0 -29
  1542. package/dist/operator/trigger-fire.d.ts.map +0 -1
  1543. package/dist/operator/trigger-fire.js +0 -41
  1544. package/dist/operator/trigger-fire.js.map +0 -1
  1545. package/dist/operator/trigger-matcher.d.ts +0 -19
  1546. package/dist/operator/trigger-matcher.d.ts.map +0 -1
  1547. package/dist/operator/trigger-matcher.js +0 -65
  1548. package/dist/operator/trigger-matcher.js.map +0 -1
  1549. package/dist/operator/trigger-registry.d.ts +0 -58
  1550. package/dist/operator/trigger-registry.d.ts.map +0 -1
  1551. package/dist/operator/trigger-registry.js +0 -349
  1552. package/dist/operator/trigger-registry.js.map +0 -1
  1553. package/dist/operator/trigger-review.d.ts +0 -23
  1554. package/dist/operator/trigger-review.d.ts.map +0 -1
  1555. package/dist/operator/trigger-review.js +0 -193
  1556. package/dist/operator/trigger-review.js.map +0 -1
  1557. package/dist/operator/trigger-types.d.ts +0 -95
  1558. package/dist/operator/trigger-types.d.ts.map +0 -1
  1559. package/dist/operator/trigger-types.js +0 -14
  1560. package/dist/operator/trigger-types.js.map +0 -1
  1561. package/dist/operator/wiki-continuity.d.ts +0 -153
  1562. package/dist/operator/wiki-continuity.d.ts.map +0 -1
  1563. package/dist/operator/wiki-continuity.js +0 -221
  1564. package/dist/operator/wiki-continuity.js.map +0 -1
  1565. package/dist/operator/worker-run.d.ts +0 -109
  1566. package/dist/operator/worker-run.d.ts.map +0 -1
  1567. package/dist/operator/worker-run.js +0 -131
  1568. package/dist/operator/worker-run.js.map +0 -1
  1569. package/dist/operator/workorder-consumer.d.ts +0 -294
  1570. package/dist/operator/workorder-consumer.d.ts.map +0 -1
  1571. package/dist/operator/workorder-consumer.js +0 -1108
  1572. package/dist/operator/workorder-consumer.js.map +0 -1
  1573. package/dist/operator/workorder-hooks.d.ts +0 -162
  1574. package/dist/operator/workorder-hooks.d.ts.map +0 -1
  1575. package/dist/operator/workorder-hooks.js +0 -342
  1576. package/dist/operator/workorder-hooks.js.map +0 -1
  1577. package/dist/operator/workorder-publishers.d.ts +0 -117
  1578. package/dist/operator/workorder-publishers.d.ts.map +0 -1
  1579. package/dist/operator/workorder-publishers.js +0 -544
  1580. package/dist/operator/workorder-publishers.js.map +0 -1
  1581. package/dist/runners/cli-runner.d.ts +0 -59
  1582. package/dist/runners/cli-runner.d.ts.map +0 -1
  1583. package/dist/runners/cli-runner.js +0 -191
  1584. package/dist/runners/cli-runner.js.map +0 -1
  1585. package/dist/runners/index.d.ts +0 -11
  1586. package/dist/runners/index.d.ts.map +0 -1
  1587. package/dist/runners/index.js +0 -15
  1588. package/dist/runners/index.js.map +0 -1
  1589. package/dist/runners/types.d.ts +0 -81
  1590. package/dist/runners/types.d.ts.map +0 -1
  1591. package/dist/runners/types.js +0 -31
  1592. package/dist/runners/types.js.map +0 -1
  1593. package/dist/scheduler/cron-result-router.d.ts +0 -24
  1594. package/dist/scheduler/cron-result-router.d.ts.map +0 -1
  1595. package/dist/scheduler/cron-result-router.js +0 -63
  1596. package/dist/scheduler/cron-result-router.js.map +0 -1
  1597. package/dist/scheduler/cron-scheduler.d.ts +0 -115
  1598. package/dist/scheduler/cron-scheduler.d.ts.map +0 -1
  1599. package/dist/scheduler/cron-scheduler.js +0 -336
  1600. package/dist/scheduler/cron-scheduler.js.map +0 -1
  1601. package/dist/scheduler/cron-worker.d.ts +0 -39
  1602. package/dist/scheduler/cron-worker.d.ts.map +0 -1
  1603. package/dist/scheduler/cron-worker.js +0 -94
  1604. package/dist/scheduler/cron-worker.js.map +0 -1
  1605. package/dist/scheduler/heartbeat.d.ts +0 -64
  1606. package/dist/scheduler/heartbeat.d.ts.map +0 -1
  1607. package/dist/scheduler/heartbeat.js +0 -197
  1608. package/dist/scheduler/heartbeat.js.map +0 -1
  1609. package/dist/scheduler/index.d.ts +0 -26
  1610. package/dist/scheduler/index.d.ts.map +0 -1
  1611. package/dist/scheduler/index.js +0 -37
  1612. package/dist/scheduler/index.js.map +0 -1
  1613. package/dist/scheduler/job-lock.d.ts +0 -85
  1614. package/dist/scheduler/job-lock.d.ts.map +0 -1
  1615. package/dist/scheduler/job-lock.js +0 -137
  1616. package/dist/scheduler/job-lock.js.map +0 -1
  1617. package/dist/scheduler/recovery.d.ts +0 -78
  1618. package/dist/scheduler/recovery.d.ts.map +0 -1
  1619. package/dist/scheduler/recovery.js +0 -124
  1620. package/dist/scheduler/recovery.js.map +0 -1
  1621. package/dist/scheduler/schedule-store.d.ts +0 -112
  1622. package/dist/scheduler/schedule-store.d.ts.map +0 -1
  1623. package/dist/scheduler/schedule-store.js +0 -259
  1624. package/dist/scheduler/schedule-store.js.map +0 -1
  1625. package/dist/scheduler/token-keep-alive.d.ts +0 -49
  1626. package/dist/scheduler/token-keep-alive.d.ts.map +0 -1
  1627. package/dist/scheduler/token-keep-alive.js +0 -102
  1628. package/dist/scheduler/token-keep-alive.js.map +0 -1
  1629. package/dist/scheduler/types.d.ts +0 -98
  1630. package/dist/scheduler/types.d.ts.map +0 -1
  1631. package/dist/scheduler/types.js +0 -21
  1632. package/dist/scheduler/types.js.map +0 -1
  1633. package/dist/security/security-monitor.d.ts +0 -56
  1634. package/dist/security/security-monitor.d.ts.map +0 -1
  1635. package/dist/security/security-monitor.js +0 -779
  1636. package/dist/security/security-monitor.js.map +0 -1
  1637. package/dist/security/trusted-proxy.d.ts +0 -9
  1638. package/dist/security/trusted-proxy.d.ts.map +0 -1
  1639. package/dist/security/trusted-proxy.js +0 -36
  1640. package/dist/security/trusted-proxy.js.map +0 -1
  1641. package/dist/skills/index.d.ts +0 -10
  1642. package/dist/skills/index.d.ts.map +0 -1
  1643. package/dist/skills/index.js +0 -26
  1644. package/dist/skills/index.js.map +0 -1
  1645. package/dist/skills/skill-executor.d.ts +0 -48
  1646. package/dist/skills/skill-executor.d.ts.map +0 -1
  1647. package/dist/skills/skill-executor.js +0 -483
  1648. package/dist/skills/skill-executor.js.map +0 -1
  1649. package/dist/skills/skill-loader.d.ts +0 -40
  1650. package/dist/skills/skill-loader.d.ts.map +0 -1
  1651. package/dist/skills/skill-loader.js +0 -233
  1652. package/dist/skills/skill-loader.js.map +0 -1
  1653. package/dist/skills/skill-matcher.d.ts +0 -33
  1654. package/dist/skills/skill-matcher.d.ts.map +0 -1
  1655. package/dist/skills/skill-matcher.js +0 -190
  1656. package/dist/skills/skill-matcher.js.map +0 -1
  1657. package/dist/skills/skill-registry.d.ts +0 -117
  1658. package/dist/skills/skill-registry.d.ts.map +0 -1
  1659. package/dist/skills/skill-registry.js +0 -627
  1660. package/dist/skills/skill-registry.js.map +0 -1
  1661. package/dist/skills/types.d.ts +0 -131
  1662. package/dist/skills/types.d.ts.map +0 -1
  1663. package/dist/skills/types.js +0 -12
  1664. package/dist/skills/types.js.map +0 -1
  1665. package/dist/utils/log-sanitizer.d.ts +0 -79
  1666. package/dist/utils/log-sanitizer.d.ts.map +0 -1
  1667. package/dist/utils/log-sanitizer.js +0 -215
  1668. package/dist/utils/log-sanitizer.js.map +0 -1
  1669. package/dist/validation/session-service.d.ts +0 -72
  1670. package/dist/validation/session-service.d.ts.map +0 -1
  1671. package/dist/validation/session-service.js +0 -298
  1672. package/dist/validation/session-service.js.map +0 -1
  1673. package/dist/validation/store.d.ts +0 -25
  1674. package/dist/validation/store.d.ts.map +0 -1
  1675. package/dist/validation/store.js +0 -200
  1676. package/dist/validation/store.js.map +0 -1
  1677. package/dist/validation/types.d.ts +0 -119
  1678. package/dist/validation/types.d.ts.map +0 -1
  1679. package/dist/validation/types.js +0 -57
  1680. package/dist/validation/types.js.map +0 -1
  1681. package/dist/wiki/wiki-turn-contract.d.ts +0 -19
  1682. package/dist/wiki/wiki-turn-contract.d.ts.map +0 -1
  1683. package/dist/wiki/wiki-turn-contract.js +0 -60
  1684. package/dist/wiki/wiki-turn-contract.js.map +0 -1
  1685. package/public/viewer/js/utils/ui-commands.js +0 -88
  1686. package/public/viewer/src/utils/ui-commands.ts +0 -114
  1687. package/scripts/attachment/extract-office-text.js +0 -179
  1688. package/scripts/attachment/extract-pdf-text.swift +0 -36
  1689. package/scripts/backfill-channel-keys.ts +0 -509
  1690. package/scripts/crack-failure-digests.ts +0 -55
  1691. package/scripts/generate-gateway-tools.ts +0 -131
  1692. package/scripts/image/fb-overlay.py +0 -128
  1693. package/scripts/image/ocr-image.py +0 -38
  1694. package/scripts/postinstall.js +0 -161
  1695. package/scripts/setup-ocr.js +0 -120
  1696. package/templates/AGENTS.claude.md +0 -23
  1697. package/templates/AGENTS.codex.md +0 -11
  1698. package/templates/bmad/LICENSE +0 -28
  1699. package/templates/bmad/architecture.md +0 -343
  1700. package/templates/bmad/bmm-workflow-status.template.yaml +0 -66
  1701. package/templates/bmad/prd.md +0 -198
  1702. package/templates/bmad/product-brief.md +0 -149
  1703. package/templates/bmad/sprint-status.template.yaml +0 -35
  1704. package/templates/bmad/tech-spec.md +0 -151
  1705. package/templates/entity-audit-fixtures/cross-language-aliases.json +0 -28
  1706. package/templates/entity-audit-fixtures/gold-canonical-identities.json +0 -46
  1707. package/templates/skills/danggeun-monitor.md +0 -88
  1708. package/templates/skills/document-analyze.md +0 -63
  1709. package/templates/skills/frontend-design.md +0 -71
  1710. package/templates/skills/image-translate.md +0 -62
  1711. package/templates/skills/multi-agent-collab.md +0 -145
  1712. package/templates/skills/scheduling.md +0 -107
  1713. package/templates/workspace/skill-forge/DESIGN.md +0 -115
  1714. package/templates/workspace/skill-forge/agents/architect.ts +0 -295
  1715. package/templates/workspace/skill-forge/agents/developer.ts +0 -364
  1716. package/templates/workspace/skill-forge/agents/qa.ts +0 -313
  1717. package/templates/workspace/skill-forge/claude-api.ts +0 -353
  1718. package/templates/workspace/skill-forge/discord-ui.ts +0 -580
  1719. package/templates/workspace/skill-forge/error-handler.ts +0 -354
  1720. package/templates/workspace/skill-forge/mama-integration.ts +0 -357
  1721. package/templates/workspace/skill-forge/orchestrator.ts +0 -495
  1722. package/templates/workspace/skill-forge/output/generated-skills/skills/hello-world/README.md +0 -24
  1723. package/templates/workspace/skill-forge/output/generated-skills/skills/hello-world/index.ts +0 -79
  1724. package/templates/workspace/skill-forge/output/generated-skills/skills/hello-world/types.ts +0 -17
  1725. package/templates/workspace/skill-forge/package.json +0 -21
  1726. package/templates/workspace/skill-forge/state/session.json +0 -132
  1727. package/templates/workspace/skill-forge/test-e2e.ts +0 -139
  1728. package/templates/workspace/skill-forge/tsconfig.json +0 -20
  1729. package/templates/workspace/skill-forge/types.ts +0 -159
@@ -1,1542 +0,0 @@
1
- "use strict";
2
- /**
3
- * API route registration.
4
- *
5
- * Extracted from start.ts (Task 11 Part B).
6
- * Registers ALL REST endpoints, middleware, static file serving,
7
- * and wires Dashboard + Wiki agents via AgentProcessManager.
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
- Object.defineProperty(o, "default", { enumerable: true, value: v });
22
- }) : function(o, v) {
23
- o["default"] = v;
24
- });
25
- var __importStar = (this && this.__importStar) || (function () {
26
- var ownKeys = function(o) {
27
- ownKeys = Object.getOwnPropertyNames || function (o) {
28
- var ar = [];
29
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30
- return ar;
31
- };
32
- return ownKeys(o);
33
- };
34
- return function (mod) {
35
- if (mod && mod.__esModule) return mod;
36
- var result = {};
37
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38
- __setModuleDefault(result, mod);
39
- return result;
40
- };
41
- })();
42
- var __importDefault = (this && this.__importDefault) || function (mod) {
43
- return (mod && mod.__esModule) ? mod : { "default": mod };
44
- };
45
- Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.buildReconcileExternalLifecycleCandidates = void 0;
47
- exports.registerKagemushaTaskRoute = registerKagemushaTaskRoute;
48
- exports.registerApiRoutes = registerApiRoutes;
49
- const node_fs_1 = require("node:fs");
50
- const node_os_1 = require("node:os");
51
- const express_1 = __importDefault(require("express"));
52
- const node_path_1 = __importDefault(require("node:path"));
53
- const node_http_1 = __importDefault(require("node:http"));
54
- const agent_store_js_1 = require("../../db/agent-store.js");
55
- const memory_agent_dashboard_js_1 = require("../../memory/memory-agent-dashboard.js");
56
- const upload_handler_js_1 = require("../../api/upload-handler.js");
57
- const operator_tasks_handler_js_1 = require("../../api/operator-tasks-handler.js");
58
- const auth_middleware_js_1 = require("../../api/auth-middleware.js");
59
- const utilities_js_1 = require("./utilities.js");
60
- const code_act_mcp_config_js_1 = require("../../mcp/code-act-mcp-config.js");
61
- const code_audit_js_1 = require("../../observability/code-audit.js");
62
- const workorder_publishers_js_1 = require("../../operator/workorder-publishers.js");
63
- const workorder_hooks_js_1 = require("../../operator/workorder-hooks.js");
64
- const board_delta_gate_js_1 = require("../../operator/board-delta-gate.js");
65
- const wiki_continuity_js_1 = require("../../operator/wiki-continuity.js");
66
- const external_lifecycle_discovery_js_1 = require("../../operator/external-lifecycle-discovery.js");
67
- Object.defineProperty(exports, "buildReconcileExternalLifecycleCandidates", { enumerable: true, get: function () { return external_lifecycle_discovery_js_1.buildReconcileExternalLifecycleCandidates; } });
68
- const security_monitor_js_1 = require("../../security/security-monitor.js");
69
- const debugLogger = __importStar(require("@jungjaehoon/mama-core/debug-logger"));
70
- const leg_cadence_js_1 = require("../../operator/leg-cadence.js");
71
- const { DebugLogger } = debugLogger;
72
- const routesLogger = new DebugLogger('api-routes');
73
- const HOST_MANUAL_FULL_REPAIR_CHANNEL = 'host:api-report-agent-refresh';
74
- function queryString(value) {
75
- return typeof value === 'string' ? value : undefined;
76
- }
77
- function queryLimit(value) {
78
- if (typeof value !== 'string') {
79
- return 30;
80
- }
81
- const limit = Number(value);
82
- return Number.isFinite(limit) ? limit : 30;
83
- }
84
- function registerKagemushaTaskRoute(app, policy, loadQuery = async () => (await import('../../connectors/kagemusha/query-tools.js')).queryTasks) {
85
- if (!policy.isEnabled('kagemusha')) {
86
- return;
87
- }
88
- app.get('/api/kagemusha/tasks', auth_middleware_js_1.requireAuth, async (req, res) => {
89
- try {
90
- const queryTasks = await loadQuery();
91
- const tasks = queryTasks({
92
- status: queryString(req.query.status),
93
- priority: queryString(req.query.priority),
94
- search: queryString(req.query.search),
95
- sourceRoom: queryString(req.query.sourceRoom),
96
- limit: queryLimit(req.query.limit),
97
- });
98
- if (req.query.filter === 'overdue') {
99
- const now = Date.now();
100
- const overdue = tasks.filter((task) => {
101
- return task.deadline !== null && new Date(task.deadline).getTime() < now;
102
- });
103
- res.json({ success: true, tasks: overdue, total: overdue.length });
104
- return;
105
- }
106
- res.json({ success: true, tasks, total: tasks.length });
107
- }
108
- catch (error) {
109
- res.status(500).json({
110
- success: false,
111
- error: error instanceof Error ? error.message : String(error),
112
- });
113
- }
114
- });
115
- }
116
- async function registerApiRoutes(params) {
117
- const { config, apiServer, eventBus, oauthManager: _oauthManager, mamaApi: _mamaApi, messageRouter, toolExecutor, discordGateway, slackGateway, graphHandler, getAdapter, privateConnectorPolicy, rawConnectorScope, sessionsDb, workOrderConsumer, boardRefreshGate, } = params;
118
- let boardBootTimeout = null;
119
- let boardInterval = null;
120
- let wikiContinuityInterval = null;
121
- let boardReconcileScheduler = null;
122
- let boardReconcileEnabled = false;
123
- let requestBoardRepair = () => {
124
- routesLogger.error('[stage2] Board repair nudge ignored: dashboard-agent is not configured');
125
- };
126
- // ── Stage-2 workorder publishers ──────────────────────────────────────
127
- // The ONLY system run path since v0.28.0: every scheduled/boot/manual run
128
- // below enqueues an occurrence-keyed workorder for the consumer lane (the
129
- // legacy executeValidatedRun persona runs were removed after the 2026-07-22
130
- // production cutover).
131
- const enqueueWorkOrderOrThrow = (workKind, idempotencyKey, payload, priority) => {
132
- const ledger = toolExecutor.getTaskLedger();
133
- if (!ledger) {
134
- throw new Error(`[stage2] TaskLedger unavailable - cannot enqueue ${workKind} workorder`);
135
- }
136
- (0, workorder_publishers_js_1.validateWorkOrderPayload)(workKind, payload);
137
- const wo = ledger.enqueueWorkOrder({ workKind, idempotencyKey, input: payload, priority });
138
- console.log(`[stage2] enqueued workorder ${workKind}#${wo.id} key=${idempotencyKey}`);
139
- return wo;
140
- };
141
- // Wire EventBus to tool executor for agent_notices tool
142
- toolExecutor.setAgentEventBus(eventBus);
143
- (0, operator_tasks_handler_js_1.registerOperatorTaskRoutes)(apiServer.app, {
144
- getTaskLedger: () => toolExecutor.getTaskLedger(),
145
- });
146
- const hasEnabledAgentConfig = (agentId) => {
147
- const agentConfig = config.multi_agent?.agents?.[agentId];
148
- return Boolean(agentConfig && agentConfig.enabled !== false);
149
- };
150
- // ── Report Slots + legacy dashboard/wiki fanout ───────────────────────
151
- const wikiAgentConfigured = hasEnabledAgentConfig('wiki-agent');
152
- // Manual refresh endpoint (kept for compatibility)
153
- apiServer.app.post('/api/report/refresh', auth_middleware_js_1.requireAuth, (_req, res) => {
154
- res.json({ ok: true, message: 'Viewer now renders data directly from Intelligence API' });
155
- });
156
- apiServer.app.post('/api/operator/report', auth_middleware_js_1.requireAuth, (_req, res) => {
157
- const outcome = params.requestFullReport?.() ?? {
158
- accepted: false,
159
- reason: 'unavailable',
160
- };
161
- if (outcome.accepted) {
162
- res.status(202).json({ ok: true, status: 'accepted' });
163
- return;
164
- }
165
- const status = outcome.reason === 'busy' ? 409 : 503;
166
- res.status(status).json({ ok: false, reason: outcome.reason ?? 'unavailable' });
167
- });
168
- // -- TG-05/TG-06 owner-report delivery recovery (design Decision 3) --
169
- // A definite rejection is never retried automatically; these explicit
170
- // operator actions are the ONLY way to reactivate the same delivery ID or
171
- // to cancel a proven-unaccepted occurrence. The trigger loop observes the
172
- // resulting terminal/retryable state on its next tick.
173
- const reportContextStore = params.reportContextStore;
174
- if (reportContextStore) {
175
- apiServer.app.get('/api/operator/report-delivery/:deliveryId', auth_middleware_js_1.requireAuth, (req, res) => {
176
- const event = reportContextStore.getEvent(String(req.params.deliveryId));
177
- if (!event) {
178
- res.status(404).json({ ok: false, error: 'unknown delivery ID' });
179
- return;
180
- }
181
- res.json({ ok: true, event });
182
- });
183
- const isProtocolRefusal = (error) => error instanceof Error && /cannot be (cancelled|reactivated)/i.test(error.message);
184
- apiServer.app.post('/api/operator/report-delivery/reactivate', auth_middleware_js_1.requireAuth, (req, res) => {
185
- const deliveryId = (req.body ?? {}).deliveryId;
186
- if (typeof deliveryId !== 'string' || deliveryId.length === 0) {
187
- res.status(400).json({ ok: false, error: 'deliveryId must be a non-empty string' });
188
- return;
189
- }
190
- try {
191
- reportContextStore.reactivate(deliveryId);
192
- res.json({
193
- ok: true,
194
- message: `delivery ${deliveryId} reactivated; next due tick retries`,
195
- });
196
- }
197
- catch (error) {
198
- res.status(isProtocolRefusal(error) ? 409 : 500).json({
199
- ok: false,
200
- error: error instanceof Error ? error.message : String(error),
201
- });
202
- }
203
- });
204
- apiServer.app.post('/api/operator/report-delivery/cancel', auth_middleware_js_1.requireAuth, (req, res) => {
205
- const body = (req.body ?? {});
206
- const deliveryId = body.deliveryId;
207
- const reason = body.reason;
208
- if (typeof deliveryId !== 'string' ||
209
- deliveryId.length === 0 ||
210
- typeof reason !== 'string' ||
211
- reason.length === 0) {
212
- res
213
- .status(400)
214
- .json({ ok: false, error: 'deliveryId and reason must be non-empty strings' });
215
- return;
216
- }
217
- try {
218
- reportContextStore.cancel(deliveryId, reason, new Date().toISOString());
219
- res.json({ ok: true, message: `delivery ${deliveryId} cancelled` });
220
- }
221
- catch (error) {
222
- res.status(isProtocolRefusal(error) ? 409 : 500).json({
223
- ok: false,
224
- error: error instanceof Error ? error.message : String(error),
225
- });
226
- }
227
- });
228
- }
229
- if (config.agent.backend === 'claude') {
230
- // Merge code-act MCP server into mama-mcp-config.json. The owner runtime's
231
- // own claude persona needs this entry, so it is NOT gated on any legacy
232
- // self-paced agent (dashboard-agent / wiki-agent) being configured.
233
- try {
234
- (0, code_act_mcp_config_js_1.ensureCodeActMcpConfig)({
235
- mcpConfigPath: node_path_1.default.join((0, node_os_1.homedir)(), '.mama', 'mama-mcp-config.json'),
236
- apiPort: utilities_js_1.API_PORT,
237
- logger: routesLogger,
238
- });
239
- }
240
- catch (err) {
241
- routesLogger.warn('[api-routes-init] Failed to merge code-act into MCP config:', err);
242
- }
243
- }
244
- // report_publish is a core surface (feeds the /viewer operator board), not a
245
- // multi-agent feature: wire it unconditionally. All slot ids are accepted;
246
- // size/count caps and loud logging live in createReportPublisher.
247
- {
248
- const { createReportPublisher } = await import('../../api/report-handler.js');
249
- toolExecutor.setReportPublisher(createReportPublisher(apiServer.reportStore, apiServer.reportSseClients));
250
- // S1-T4 artifact hub: the console READS the board it directs. Same store
251
- // the publisher writes - MAMA's status answers cite these slots
252
- // instead of re-deriving state from memory copies.
253
- toolExecutor.setReportReader(() => {
254
- const slots = apiServer.reportStore.getAll();
255
- const projected = {};
256
- for (const [name, slot] of Object.entries(slots)) {
257
- projected[name] = {
258
- html: slot.html,
259
- basisRevision: slot.basisRevision,
260
- currentBasisRevision: slot.currentBasisRevision,
261
- freshness: slot.freshness,
262
- updatedAt: Number.isFinite(slot.updatedAt)
263
- ? new Date(slot.updatedAt).toISOString()
264
- : null,
265
- };
266
- }
267
- return projected;
268
- });
269
- }
270
- {
271
- // ── Stage-2 Board publisher and verifier ───────────────────────────
272
- // Schedule/boot/manual all funnel here: one occurrence-keyed board
273
- // workorder per entry. An enqueue failure is logged loudly and the next
274
- // occurrence retries - there is no fallback run path.
275
- const reconcileEnabled = process.env.MAMA_BOARD_RECONCILE === '1';
276
- boardReconcileEnabled = reconcileEnabled;
277
- // Evidence that a board was actually WRITTEN, not just that a run reached
278
- // 'done'. An unverified full run reaches 'done' too, so the delta gate
279
- // requires a publish at or after the baseline run's enqueue time.
280
- const boardPublishedAt = () => {
281
- const slots = apiServer.reportStore.getAll();
282
- let oldest = Number.POSITIVE_INFINITY;
283
- for (const slotId of workorder_hooks_js_1.REQUIRED_FULL_BOARD_SLOTS) {
284
- const updatedAt = slots[slotId]?.updatedAt;
285
- if (!Number.isFinite(updatedAt))
286
- return 0;
287
- oldest = Math.min(oldest, updatedAt);
288
- }
289
- return Number.isFinite(oldest) ? oldest : 0;
290
- };
291
- const runDashboardAgent = (opts) => {
292
- try {
293
- // Cheap host-side delta gate (Fix E). It runs in BOTH configs, because
294
- // under MAMA_BOARD_RECONCILE=1 every scheduled enqueue reaches this
295
- // line WITH dirt: `needsFullRepair()` is true whenever a channel delta
296
- // or an owner board request arrived since the last verified full run
297
- // (board-refresh-gate.ts), which is an "inputs moved" claim - exactly
298
- // the claim this gate re-checks against what the board actually reads.
299
- // The "board was not rebuilt" case is NOT suppressed: it surfaces as
300
- // the gate's own `unpublished` reason, measured from the report slots
301
- // rather than assumed. A broken signal enqueues as before -
302
- // availability of the board beats the token saving - but says so.
303
- const delta = (0, board_delta_gate_js_1.evaluateBoardFullDelta)({
304
- readWatermark: () => {
305
- const ledger = toolExecutor.getTaskLedger();
306
- if (!ledger) {
307
- throw new Error('TaskLedger unavailable - cannot read the board input watermark');
308
- }
309
- const adapter = getAdapter();
310
- return (0, board_delta_gate_js_1.composeBoardInputWatermark)([
311
- (0, board_delta_gate_js_1.connectorObservationTerm)(adapter),
312
- ledger.ownerTaskTerm(),
313
- (0, board_delta_gate_js_1.memoryRecencyTerm)(adapter),
314
- ]);
315
- },
316
- readBaseline: () => {
317
- const ledger = toolExecutor.getTaskLedger();
318
- if (!ledger) {
319
- throw new Error('TaskLedger unavailable - cannot read the full-board baseline');
320
- }
321
- return ledger.lastCompletedBoardFullRun();
322
- },
323
- readBoardPublishedAt: boardPublishedAt,
324
- });
325
- if (delta.warning) {
326
- // error, not warn: DebugLogger defaults to MAMA_LOG_LEVEL=ERROR, so a
327
- // warn here would be invisible on a normal daemon - and a gate whose
328
- // signal is broken is permanently inert, which is exactly the kind of
329
- // silent degradation this file logs loudly everywhere else.
330
- routesLogger.error(`[stage2] board delta gate unavailable (${delta.warning}); enqueueing the full board anyway`);
331
- }
332
- // Two independent authorities, and neither of them is "the daemon just
333
- // started" (owner decision 2026-09-09). `delta` means the watermark
334
- // moved, and the in-memory gate must agree that something actually
335
- // arrived - the notices term of that watermark is an in-memory ring, so
336
- // a restart alone changes it and used to buy one full run per boot. The
337
- // other reasons are EVIDENCE about the board itself (no baseline, never
338
- // published, stale past DEFAULT_BOARD_FULL_MAX_STALENESS_MS, or a signal
339
- // we could not read), and those still enqueue on their own: availability
340
- // of the board beats the token saving.
341
- const gateDirty = boardRefreshGate ? boardRefreshGate.needsFullRepair() : true;
342
- // 'unpublished' is the ONE reason that must still agree with the in-memory dirt: a
343
- // board whose last completed run honestly had nothing to publish stays unpublished
344
- // forever, so on its own this reason would re-enqueue every 30 minutes for the rest
345
- // of the daemon's life. Every other reason is bounded on its own - 'no-baseline'
346
- // fires once, 'stale' at most once per DEFAULT_BOARD_FULL_MAX_STALENESS_MS, 'delta'
347
- // only when a durable term actually moved, and 'signal-unavailable' is the case
348
- // where availability of the board beats the token saving.
349
- const needsDirtAgreement = delta.reason === 'unpublished';
350
- if (!opts?.force && !delta.enqueue) {
351
- routesLogger.info(`[stage2] board full skipped: ${delta.reason} - nothing the board reads has moved since the last published full run`);
352
- return;
353
- }
354
- if (!opts?.force && needsDirtAgreement && !gateDirty) {
355
- routesLogger.info(`[stage2] board full skipped: ${delta.reason} with a clean repair gate - the last completed run had nothing to publish and nothing has arrived since`);
356
- return;
357
- }
358
- // The skips say why nothing ran; this says why something did. Without it a boot
359
- // enqueue was the one board decision with no reason on the record.
360
- // A forced refresh is always a rebuild; otherwise the gate decides (board-delta-gate.ts).
361
- const runMode = opts?.force ? 'full' : delta.mode;
362
- const anchorPublishedAt = runMode === 'delta' ? delta.anchorPublishedAt : null;
363
- const anchor = anchorPublishedAt === null ? null : new Date(anchorPublishedAt).toISOString();
364
- // The basis the published board rests on, read from the SAME report slots the anchor
365
- // came from - not a fresh read, so the turn is told the basis of what it is editing.
366
- const anchorBasis = anchor === null
367
- ? null
368
- : (apiServer.reportStore.get('pipeline')?.currentBasisRevision ?? null);
369
- // An anchored decision the store cannot name a basis for is not a delta: the turn would
370
- // have to invent the basis it publishes under. Rebuild instead of guessing.
371
- const mode = runMode === 'delta' && anchor !== null && anchorBasis !== null ? 'delta' : 'full';
372
- if (mode === 'delta') {
373
- routesLogger.info(`[stage2] board delta enqueued: ${delta.reason} (anchor ${String(anchor)}, basis ${String(anchorBasis)})`);
374
- }
375
- else {
376
- routesLogger.info(`[stage2] board full enqueued: ${opts?.force ? 'force' : delta.reason} (watermark ${delta.watermark ?? 'unavailable'})`);
377
- }
378
- if (opts?.force && boardRefreshGate) {
379
- // Host-owned manual dirt is captured before validation/enqueue can
380
- // fail. It clears only through the full run-bound effect verifier.
381
- boardRefreshGate.markChannelDirty(HOST_MANUAL_FULL_REPAIR_CHANNEL);
382
- }
383
- const now = Date.now();
384
- const repair = boardRefreshGate?.captureFullRepair();
385
- const ledger = toolExecutor.getTaskLedger();
386
- if (!ledger) {
387
- throw new Error('TaskLedger unavailable - cannot issue reclassification candidates');
388
- }
389
- const reclassificationCandidates = ledger
390
- .list({
391
- includeTerminal: false,
392
- qualification: 'legacy_unqualified',
393
- order: 'deadline_priority',
394
- limit: 10,
395
- })
396
- .map((task) => ({ taskId: task.id, taskRevision: task.revision }));
397
- enqueueWorkOrderOrThrow('board', opts?.force
398
- ? (0, workorder_publishers_js_1.boardManualKey)(now)
399
- : boardRefreshGate
400
- ? (0, workorder_publishers_js_1.boardRepairKey)()
401
- : (0, workorder_publishers_js_1.boardFullKey)(now), {
402
- mode,
403
- ...(mode === 'delta'
404
- ? { deltaAnchor: anchor, deltaBasisRevision: anchorBasis }
405
- : {}),
406
- ...(repair ?? {}),
407
- // Carried so this run's completion becomes the next tick's baseline.
408
- ...(delta.watermark === null ? {} : { deltaWatermark: delta.watermark }),
409
- reclassificationCandidates,
410
- ...(opts?.force ? { force: true } : {}),
411
- }, opts?.force ? 'high' : undefined);
412
- }
413
- catch (err) {
414
- routesLogger.error('[stage2] board enqueue failed:', err instanceof Error ? err.message : err);
415
- }
416
- };
417
- // Host-gated repair: runs only when the gate is dirty or the delta moved.
418
- requestBoardRepair = () => runDashboardAgent();
419
- // First run after 10s (let connectors poll first), then every 30 min
420
- // ONE constant feeds both the timer and the declared cadence - if they
421
- // drift apart the watchdog pages on a schedule nobody is running.
422
- const DASHBOARD_AGENT_INTERVAL_MS = 30 * 60 * 1000;
423
- boardBootTimeout = setTimeout(() => {
424
- runDashboardAgent();
425
- }, 10_000);
426
- (0, leg_cadence_js_1.getLegCadence)()?.declare('dashboard-agent', DASHBOARD_AGENT_INTERVAL_MS);
427
- boardInterval = setInterval(() => {
428
- (0, leg_cadence_js_1.getLegCadence)()?.beat('dashboard-agent');
429
- runDashboardAgent();
430
- }, DASHBOARD_AGENT_INTERVAL_MS);
431
- // Manual trigger (owner-forced: the workorder carries force=true so the
432
- // worker brief skips its NO_UPDATE delta gate)
433
- apiServer.app.post('/api/report/agent-refresh', auth_middleware_js_1.requireAuth, async (_req, res) => {
434
- runDashboardAgent({ force: true });
435
- res.json({ ok: true, message: 'Board refresh workorder enqueued (forced)' });
436
- });
437
- // Manual Board reconcile remains available for an explicit operator
438
- // request. Connector deltas belong to the MAMA owner-event agent and are
439
- // no longer consumed by a parallel Board worker.
440
- if (reconcileEnabled && boardRefreshGate) {
441
- const { ReconcileScheduler } = await import('../../operator/board-reconcile.js');
442
- const { captureSnapshot, verifyAfterRun } = await import('../../operator/action-verifier.js');
443
- // Verifier deps (M8 Phase 2): run-bound signals only -- notes from the
444
- // operator ledger, board slots. Observe, never block. Trace queries are
445
- // worker-keyed (buildWorkerTraceQueries below): reconcile runs execute
446
- // on the workorder consumer lane only.
447
- const reconcileLedger = toolExecutor.getTaskLedger();
448
- const verifierDeps = {
449
- getSlots: () => apiServer.reportStore.getAllSorted(),
450
- getLedgerHash: () => reconcileLedger?.payloadHash() ?? '',
451
- getScopedNoteMaxId: (scope) => reconcileLedger?.maxNoUpdateId(scope) ?? 0,
452
- };
453
- // Stage-2 board completion hook (plan D1/E3/G1): the consumer wraps
454
- // reconcile workorders with the SAME bracket the legacy closure owns,
455
- // but trace rows from worker runs carry the worker's identity, not
456
- // agent_id='dashboard-agent' - the re-key goes through details JSON
457
- // (agent_activity has NO channel_id column; json_extract is the only
458
- // schema-supported key; agent_id re-keying is a green-test trap).
459
- if (workOrderConsumer) {
460
- const { applyBoardRefreshVerdict, buildFullBoardTraceQueries, buildWorkerTraceQueries, boardCandidateReceiptVerdict, } = await import('../../operator/workorder-hooks.js');
461
- // Per ATTEMPT, not per lane: a sibling board order running inside a delegated
462
- // attempt's window must not discharge it (review P1-1).
463
- const reconcileVerifierDepsFor = (attemptId) => ({
464
- ...verifierDeps,
465
- ...buildWorkerTraceQueries(sessionsDb, 'worker:board', undefined, attemptId),
466
- });
467
- const fullVerifierDepsFor = (attemptId) => ({
468
- ...verifierDeps,
469
- ...buildFullBoardTraceQueries(sessionsDb, 'worker:board', attemptId),
470
- });
471
- workOrderConsumer.registerHook('board', {
472
- verdictRequired: true,
473
- before: (wo) => {
474
- if (wo.payload.mode === 'reconcile') {
475
- return captureSnapshot(reconcileVerifierDepsFor(wo.id), `reconcile:${String(wo.payload.channelKey)}`);
476
- }
477
- if (wo.payload.mode !== 'reconcile' && typeof wo.payload.noUpdateScope === 'string') {
478
- return captureSnapshot(fullVerifierDepsFor(wo.id), wo.payload.noUpdateScope);
479
- }
480
- return null;
481
- },
482
- after: (wo, response, beforeState) => {
483
- const receiptVerdict = boardCandidateReceiptVerdict(wo, reconcileLedger);
484
- if (!beforeState) {
485
- if (response.includes('NO_UPDATE')) {
486
- console.log('[stage2] board worker: no changes detected, publish skipped');
487
- }
488
- return receiptVerdict;
489
- }
490
- const isReconcile = wo.payload.mode === 'reconcile';
491
- const scope = isReconcile
492
- ? `reconcile:${String(wo.payload.channelKey)}`
493
- : String(wo.payload.noUpdateScope);
494
- const verdict = verifyAfterRun(isReconcile ? reconcileVerifierDepsFor(wo.id) : fullVerifierDepsFor(wo.id), beforeState, scope);
495
- // force:true is a request to rebuild/publish, so an exact no-op
496
- // note cannot discharge it. Non-force scheduled repair may use
497
- // the exact scope note when there is genuinely nothing to write.
498
- const effectVerified = verdict.verified &&
499
- !(wo.payload.mode !== 'reconcile' &&
500
- wo.payload.force === true &&
501
- verdict.obligatedTraceCount === 0);
502
- // The mode is named in the outcome: a verified delta and a verified full are
503
- // different claims about how the board was produced, and `full_verified` on a delta
504
- // run would hide which one actually happened.
505
- const boardMode = wo.payload.mode === 'delta' ? 'delta' : 'full';
506
- const outcome = effectVerified
507
- ? isReconcile
508
- ? 'reconcile_verified'
509
- : `${boardMode}_verified`
510
- : isReconcile
511
- ? 'reconcile_unverified'
512
- : `${boardMode}_unverified`;
513
- console.log(`[stage2] ${outcome} scope=${scope}${verdict.effects.length > 0 ? ` (${verdict.effects.join('; ')})` : ''}`);
514
- try {
515
- if (sessionsDb) {
516
- (0, agent_store_js_1.logActivity)(sessionsDb, {
517
- agent_id: 'workorder-board',
518
- agent_version: 0,
519
- type: outcome,
520
- input_summary: scope,
521
- output_summary: verdict.effects.join('; '),
522
- execution_status: 'completed',
523
- trigger_reason: 'workorder',
524
- });
525
- }
526
- }
527
- catch {
528
- /* telemetry only */
529
- }
530
- if (!effectVerified) {
531
- eventBus.emit({
532
- type: 'agent:action',
533
- agent: 'Dashboard Agent',
534
- action: isReconcile ? 'reconcile_unverified' : 'full_unverified',
535
- target: isReconcile ? String(wo.payload.channelKey) : scope,
536
- });
537
- }
538
- return applyBoardRefreshVerdict(wo, effectVerified, receiptVerdict, boardRefreshGate);
539
- },
540
- });
541
- }
542
- const reconcileScheduler = new ReconcileScheduler({
543
- debounceMs: Number(process.env.MAMA_RECONCILE_DEBOUNCE_MS) || undefined,
544
- maxWaitMs: Number(process.env.MAMA_RECONCILE_MAX_WAIT_MS) || undefined,
545
- globalMaxPerHour: Number(process.env.MAMA_RECONCILE_MAX_PER_HOUR) || undefined,
546
- log: (line) => console.log(line),
547
- run: (channelKey, deltaLines, eventIds, repairGeneration) => {
548
- // The reconcile leg is a board workorder; its bracket verification
549
- // runs in the consumer's completion hook (registered above).
550
- try {
551
- const privateKagemushaPartition = channelKey.startsWith('kagemusha:');
552
- const mayProjectKagemushaLifecycle = privateConnectorPolicy.isEnabled('kagemusha') &&
553
- rawConnectorScope.includes('kagemusha');
554
- if (privateKagemushaPartition && !mayProjectKagemushaLifecycle) {
555
- // A private partition that boot did not authorize is consumed
556
- // without a generic board workorder. Rejecting would retain and
557
- // retry the private delta; enqueuing would leak its prose.
558
- boardRefreshGate.consumeUnauthorizedPartition(channelKey, repairGeneration);
559
- return Promise.resolve();
560
- }
561
- const ledger = toolExecutor.getTaskLedger();
562
- if (!ledger) {
563
- throw new Error('[stage2] TaskLedger unavailable - cannot construct lifecycle evidence');
564
- }
565
- const candidates = (0, external_lifecycle_discovery_js_1.buildReconcileExternalLifecycleCandidates)({
566
- eventIds,
567
- getAdapter,
568
- ledger,
569
- privateConnectorPolicy,
570
- rawConnectorScope,
571
- });
572
- const reclassificationCandidates = ledger
573
- .list({ channel: channelKey, order: 'updated', limit: 10 })
574
- .map((task) => ({ taskId: task.id, taskRevision: task.revision }));
575
- enqueueWorkOrderOrThrow('board', (0, workorder_publishers_js_1.boardReconcileKey)(channelKey, Date.now()), {
576
- mode: 'reconcile',
577
- channelKey,
578
- deltaLines,
579
- // The batch, carried structurally. It was already inside deltaLines as
580
- // `[id:evt_...]` text and could only be recovered by parsing prose.
581
- eventIds,
582
- repairGeneration,
583
- reclassificationCandidates,
584
- // Host-authored structural authority. deltaLines remain untrusted,
585
- // human-readable context and never grant lifecycle mutations.
586
- candidates,
587
- });
588
- }
589
- catch (err) {
590
- routesLogger.error('[stage2] reconcile enqueue failed:', err instanceof Error ? err.message : err);
591
- // REJECT so ReconcileScheduler restores pendingLines - a
592
- // resolved failure silently drops this delta (PR bot round).
593
- return Promise.reject(err instanceof Error ? err : new Error(String(err)));
594
- }
595
- return Promise.resolve();
596
- },
597
- });
598
- boardReconcileScheduler = reconcileScheduler;
599
- // Manual reconcile: lines from the body, or the caller must supply them
600
- // (no silent alternate data path -- M8 review #17).
601
- apiServer.app.post('/api/operator/reconcile', auth_middleware_js_1.requireAuth, (req, res) => {
602
- const { channelKey, lines } = (req.body ?? {});
603
- if (typeof channelKey !== 'string' ||
604
- channelKey.length === 0 ||
605
- channelKey.length > 1000 ||
606
- !Array.isArray(lines) ||
607
- lines.length === 0) {
608
- res.status(400).json({
609
- ok: false,
610
- error: 'channelKey (1-1000 chars) and non-empty lines[] are required',
611
- });
612
- return;
613
- }
614
- const repairGeneration = boardRefreshGate.markChannelDirty(channelKey);
615
- reconcileScheduler.enqueue(channelKey, lines, [], repairGeneration);
616
- res.json({ ok: true, message: 'Reconcile queued (async; runs after debounce)' });
617
- });
618
- console.log('[reconcile] Board reconcile leg enabled (MAMA_BOARD_RECONCILE=1)');
619
- }
620
- }
621
- // ── Wiki Agent ──────────────────────────────────────────────────────
622
- const wikiConfig = config.wiki;
623
- if (wikiAgentConfigured && wikiConfig?.enabled && wikiConfig.vaultPath) {
624
- const { ObsidianWriter } = await import('../../wiki/obsidian-writer.js');
625
- const obsWriter = new ObsidianWriter(wikiConfig.vaultPath, wikiConfig.wikiDir || 'wiki');
626
- obsWriter.ensureDirectories();
627
- routesLogger.debug(`[Wiki Agent] vault: ${obsWriter.getWikiPath()}`);
628
- // Wire Obsidian vault path for CLI tool. The wiki directory itself is what
629
- // gets registered as an Obsidian vault (agent-facing paths like daily/... are
630
- // relative to it), so the CLI vault name is the wiki path's basename.
631
- const fullWikiPath = obsWriter.getWikiPath();
632
- const obsidianVaultName = node_path_1.default.basename(fullWikiPath);
633
- toolExecutor.setObsidianVaultPath(fullWikiPath, obsidianVaultName);
634
- routesLogger.debug(`[Wiki Agent] Obsidian CLI vault: ${fullWikiPath} (vault=${obsidianVaultName})`);
635
- // Ensure Obsidian is running with the wiki vault open (macOS only).
636
- // NOTE: obsidian://open?vault= only opens vaults ALREADY registered in
637
- // Obsidian; registering the wiki directory as a vault is a one-time manual
638
- // setup step. If it is not registered, the CLI reports unavailable and the
639
- // agent falls back to wiki_publish (direct file writes still work).
640
- if (process.platform === 'darwin' && !process.env.VITEST) {
641
- try {
642
- const { execFile: execFileChild } = await import('child_process');
643
- execFileChild('open', [`obsidian://open?vault=${encodeURIComponent(obsidianVaultName)}`], { timeout: 5000 }, () => {
644
- /* non-fatal: CLI will return error, agent falls back to wiki_publish */
645
- });
646
- }
647
- catch {
648
- /* non-fatal */
649
- }
650
- }
651
- // Wire wiki_publish tool to shared gateway executor (used by code-act path)
652
- toolExecutor.setWikiPublisher((pages) => {
653
- const scheduledPages = pages.every((page) => page.expectedContentVersion !== undefined);
654
- if (scheduledPages) {
655
- // Home.md is the v5 index and is part of the staged page set. Legacy index.md/log.md
656
- // writes stay on the generic path so a scheduled publish has one rollback boundary.
657
- obsWriter.writePagesAtomically(pages);
658
- }
659
- else {
660
- for (const page of pages) {
661
- obsWriter.writePage(page);
662
- }
663
- obsWriter.updateIndex(pages);
664
- obsWriter.appendLog('compile', `Published ${pages.length} pages`);
665
- }
666
- routesLogger.debug(`[Wiki Agent] Published ${pages.length} pages to vault`);
667
- eventBus.emit({
668
- type: 'wiki:compiled',
669
- pages: pages.map((p) => p.path || ''),
670
- });
671
- });
672
- // Owner/host IANA time zone - the same source the temporal runtime and the
673
- // TaskLedger derive the owner day from.
674
- const wikiTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
675
- // The wiki source watermark covers connector observation, native owner tasks
676
- // and memory recency. Agent notices are DELIBERATELY EXCLUDED: a wiki
677
- // completion/no-update notice must not move the watermark and so wake the
678
- // wiki turn forever.
679
- const readWikiSourceWatermark = () => {
680
- const ledger = toolExecutor.getTaskLedger();
681
- if (!ledger) {
682
- throw new Error('TaskLedger unavailable - cannot read the wiki source watermark');
683
- }
684
- const adapter = getAdapter();
685
- return (0, wiki_continuity_js_1.composeWikiSourceWatermark)([
686
- (0, board_delta_gate_js_1.connectorObservationTerm)(adapter),
687
- ledger.ownerTaskTerm(),
688
- (0, board_delta_gate_js_1.memoryRecencyTerm)(adapter),
689
- ]);
690
- };
691
- const runWikiAgent = (trigger, opts) => {
692
- try {
693
- const now = Date.now();
694
- const ledger = toolExecutor.getTaskLedger();
695
- if (!ledger) {
696
- throw new Error('TaskLedger unavailable - cannot plan a wiki run');
697
- }
698
- const decision = (0, wiki_continuity_js_1.evaluateWikiContinuity)({
699
- nowMs: now,
700
- timeZone: wikiTimeZone,
701
- connectors: (0, wiki_continuity_js_1.publicWikiConnectorScope)(rawConnectorScope, privateConnectorPolicy.enabledPrivateConnectors),
702
- trigger,
703
- forced: opts?.forced === true,
704
- requestedOwnerDate: opts?.ownerDate,
705
- readSourceWatermark: readWikiSourceWatermark,
706
- readBaseline: () => ledger.lastCompletedWikiRun(),
707
- });
708
- if (decision.warning) {
709
- routesLogger.error(`[stage2] wiki source watermark unavailable (${decision.warning}); enqueueing the wiki run anyway`);
710
- }
711
- if (!decision.enqueue || decision.payload === null) {
712
- routesLogger.info(`[stage2] wiki skipped: ${decision.reason} - same owner date and source watermark already completed`);
713
- return { status: 'skipped', reason: decision.reason };
714
- }
715
- // Non-forced continuity runs dedupe on the typed source snapshot (owner
716
- // date + watermark) so boot/hourly/event against an unchanged snapshot
717
- // resolve to ONE open workorder; a null watermark falls back to a coarse
718
- // per-day hour bucket; a forced manual run stays occurrence-unique.
719
- const idempotencyKey = opts?.forced
720
- ? (0, workorder_publishers_js_1.wikiBatchKey)(trigger, now)
721
- : decision.payload.sourceWatermark === null
722
- ? (0, workorder_publishers_js_1.wikiUnavailableKey)(decision.payload.ownerDate, now)
723
- : (0, workorder_publishers_js_1.wikiContinuityKey)(decision.payload.ownerDate, decision.payload.sourceWatermark);
724
- const wo = enqueueWorkOrderOrThrow('wiki', idempotencyKey, { ...decision.payload }, opts?.forced ? 'high' : undefined);
725
- return { status: 'enqueued', workOrderId: wo.id };
726
- }
727
- catch (err) {
728
- const error = err instanceof Error ? err.message : String(err);
729
- routesLogger.error('[stage2] wiki enqueue failed:', error);
730
- return { status: 'error', error };
731
- }
732
- };
733
- // Stage-2 wiki completion hook (plan E4): outcome reading only - the
734
- // wiki:compiled events flow through the wikiPublisher independently.
735
- if (workOrderConsumer) {
736
- const { buildWikiAfterHook, buildWorkerTraceQueries, LANE_OBLIGATED_TOOLS } = await import('../../operator/workorder-hooks.js');
737
- // Bound to the ATTEMPT: a delegated wiki attempt stays open for up to 30 minutes, and
738
- // a sibling wiki order's wiki_publish must not discharge it (review P1-1).
739
- const wikiTracesFor = (attemptId) => buildWorkerTraceQueries(sessionsDb, 'worker:wiki', LANE_OBLIGATED_TOOLS.wiki, attemptId);
740
- workOrderConsumer.registerHook('wiki', {
741
- verdictRequired: true,
742
- // The trace rowid before the run is what makes the count run-bound; without it the
743
- // hook would count any wiki_publish this process ever made.
744
- before: (wo) => wikiTracesFor(wo.id).getTraceMaxId(),
745
- after: buildWikiAfterHook((line) => routesLogger.info(line), {
746
- tracesFor: wikiTracesFor,
747
- onUnverified: (note) => eventBus.emit({
748
- type: 'agent:action',
749
- agent: 'Wiki Agent',
750
- action: 'unverified',
751
- target: note,
752
- }),
753
- }),
754
- });
755
- }
756
- // Event-driven: compile when extraction completes. Trailing-edge debounce so
757
- // bursts of extraction:completed events coalesce into one wiki compile run.
758
- // Scheduled/event callers discard the run outcome - their failures are
759
- // log-only inside runWikiAgent; only the manual route surfaces an error.
760
- eventBus.onDebounced('extraction:completed', () => {
761
- runWikiAgent('extraction:completed');
762
- }, 30_000);
763
- // Promotion feeds the wiki: freshly promoted decisions are exactly the
764
- // material daily notes and lessons compile from.
765
- eventBus.onDebounced('memory:promoted', () => {
766
- runWikiAgent('memory:promoted');
767
- }, 30_000);
768
- // Emit agent:action notices when wiki pages are compiled
769
- eventBus.on('wiki:compiled', (event) => {
770
- if (event.type === 'wiki:compiled') {
771
- for (const page of event.pages) {
772
- eventBus.emit({
773
- type: 'agent:action',
774
- agent: 'Wiki Agent',
775
- action: 'compiled',
776
- target: page,
777
- });
778
- }
779
- }
780
- });
781
- // Manual trigger API. A manual request bypasses the skip gate (forced) and
782
- // may backfill a missed recent day via a STRICT optional ownerDate; a
783
- // malformed date is rejected rather than silently defaulted.
784
- apiServer.app.post('/api/wiki/compile', auth_middleware_js_1.requireAuth, async (req, res) => {
785
- const body = (req.body ?? {});
786
- let ownerDate;
787
- if (body.ownerDate !== undefined) {
788
- if (typeof body.ownerDate !== 'string') {
789
- res.status(400).json({ ok: false, error: 'ownerDate must be a YYYY-MM-DD string' });
790
- return;
791
- }
792
- try {
793
- ownerDate = (0, wiki_continuity_js_1.parseStrictOwnerDate)(body.ownerDate);
794
- }
795
- catch (err) {
796
- res
797
- .status(400)
798
- .json({ ok: false, error: err instanceof Error ? err.message : String(err) });
799
- return;
800
- }
801
- // A future day cannot be backfilled: reject at the HTTP boundary with a
802
- // clear 400 rather than letting the planner throw into a swallowed 200.
803
- const currentOwnerDate = (0, wiki_continuity_js_1.ownerDateForInstant)(Date.now(), wikiTimeZone);
804
- if (ownerDate > currentOwnerDate) {
805
- res.status(400).json({
806
- ok: false,
807
- error: `ownerDate ${ownerDate} is in the future (current owner date ${currentOwnerDate})`,
808
- });
809
- return;
810
- }
811
- }
812
- const outcome = runWikiAgent('manual', { forced: true, ownerDate });
813
- if (outcome.status === 'error') {
814
- // A real planning/ledger/validation/enqueue failure must not be reported
815
- // as success (M1): return a non-2xx and never say enqueued.
816
- res.status(500).json({ ok: false, error: outcome.error });
817
- return;
818
- }
819
- res.json({ ok: true, message: 'Wiki compile workorder enqueued', status: outcome.status });
820
- });
821
- // No boot enqueue (owner decision 2026-09-09): a restart is not evidence
822
- // that the wiki has anything to compile, and the boot continuity order was
823
- // what put a multi-minute maintenance turn in front of the owner's first
824
- // message after every restart. The hourly continuity tick below still gives
825
- // a new owner date its one run, on evidence rather than on boot.
826
- // Host-owned hourly continuity tick. The cheap watermark/date gate inside
827
- // runWikiAgent skips the model when the same owner date and source watermark
828
- // already completed; a new owner date still gets one run even when quiet.
829
- const WIKI_CONTINUITY_INTERVAL_MS = 60 * 60 * 1000;
830
- wikiContinuityInterval = setInterval(() => {
831
- runWikiAgent('hourly');
832
- }, WIKI_CONTINUITY_INTERVAL_MS);
833
- wikiContinuityInterval.unref?.();
834
- routesLogger.info('[Wiki Agent] Ready — triggers: hourly continuity tick, extraction:completed / memory:promoted events, POST /api/wiki/compile');
835
- }
836
- // -- Memory Promotion: scheduled observation->decision curation --
837
- // Owner directive 2026-07-11: the decision layer starved after the 07-03/04
838
- // backfill because nothing periodically judges connector-ingested business
839
- // data (the M0 kill switch removed direct LLM extraction, and the memory
840
- // agent only audits owner conversation turns). This pass has the memory
841
- // agent promote DURABLE judgments only -- task states stay on the board.
842
- const memoryAgentConfigured = hasEnabledAgentConfig('memory');
843
- if (memoryAgentConfigured) {
844
- const PROMOTION_INTERVAL_MS = (0, workorder_publishers_js_1.normalizePromotionIntervalMs)(Math.max(1, Number(process.env.MAMA_MEMORY_PROMOTION_HOURS) || 6) * 60 * 60 * 1000);
845
- const PROMOTION_INITIAL_DELAY_MS = 10 * 60 * 1000; // let connectors poll first
846
- // Promotion runs are workorders: enqueue-only, the consumer lane runs
847
- // them under the memory-curation brief. The PROMOTED <n> parse and its
848
- // event emissions live in the completion hook below.
849
- const runMemoryPromotion = (opts) => {
850
- try {
851
- const now = Date.now();
852
- enqueueWorkOrderOrThrow('memory-curation', opts?.manual ? (0, workorder_publishers_js_1.promotionManualKey)(now) : (0, workorder_publishers_js_1.promotionKey)(now, PROMOTION_INTERVAL_MS), { scheduledAt: new Date(now).toISOString() }, opts?.manual ? 'high' : undefined);
853
- }
854
- catch (err) {
855
- routesLogger.error('[stage2] promotion enqueue failed:', err instanceof Error ? err.message : err);
856
- }
857
- };
858
- // Stage-2 promotion completion hook (plan E4): the PROMOTED <n> parse and
859
- // its event emissions are the wiki ingress chain's second link - losing
860
- // them in the workorder conversion would silently sever memory:promoted.
861
- if (workOrderConsumer) {
862
- const { buildPromotionAfterHook, buildWorkerTraceQueries, LANE_OBLIGATED_TOOLS, LANE_WRITE_TOOLS, } = await import('../../operator/workorder-hooks.js');
863
- const promotionTracesFor = (attemptId) => buildWorkerTraceQueries(sessionsDb, 'worker:memory-curation', LANE_OBLIGATED_TOOLS['memory-curation'], attemptId);
864
- workOrderConsumer.registerHook('memory-curation', {
865
- before: (wo) => promotionTracesFor(wo.id).getTraceMaxId(),
866
- after: buildPromotionAfterHook({
867
- emitAgentAction: (action, target) => eventBus.emit({ type: 'agent:action', agent: 'Memory Agent', action, target }),
868
- emitMemoryPromoted: (saved) => eventBus.emit({ type: 'memory:promoted', saved }),
869
- log: (line) => console.log(line),
870
- }, {
871
- tracesFor: promotionTracesFor,
872
- writeTracesFor: (attemptId) => buildWorkerTraceQueries(sessionsDb, 'worker:memory-curation', LANE_WRITE_TOOLS['memory-curation'], attemptId),
873
- log: (line) => console.log(line),
874
- onUnverified: (note) => eventBus.emit({
875
- type: 'agent:action',
876
- agent: 'Memory Agent',
877
- action: 'unverified',
878
- target: note,
879
- }),
880
- }),
881
- });
882
- }
883
- setTimeout(() => runMemoryPromotion(), PROMOTION_INITIAL_DELAY_MS);
884
- (0, leg_cadence_js_1.getLegCadence)()?.declare('memory-promotion', PROMOTION_INTERVAL_MS);
885
- setInterval(() => {
886
- (0, leg_cadence_js_1.getLegCadence)()?.beat('memory-promotion');
887
- runMemoryPromotion();
888
- }, PROMOTION_INTERVAL_MS);
889
- apiServer.app.post('/api/memory/promote', auth_middleware_js_1.requireAuth, (_req, res) => {
890
- runMemoryPromotion({ manual: true });
891
- res.json({ ok: true, message: 'Memory promotion workorder enqueued' });
892
- });
893
- console.log(`[Memory Promotion] Ready: every ${PROMOTION_INTERVAL_MS / 3_600_000}h, POST /api/memory/promote`);
894
- }
895
- // -- System Audit: hourly deterministic code checks ---------------------
896
- // Owner decision 2026-04-22 (legacy id: mama_conductor_audit_code_based_read_only),
897
- // landed 2026-07-17: the audit is fact collection and recording executed by
898
- // CODE - no LLM invocation, no auto-fix, no broad filesystem access. The
899
- // prior hourly LLM audit violated that decision and the 2026-05-14
900
- // no-shell-autofix rule, and lost its tools entirely to the persona
901
- // lockdown (--tools ""). The 24h alert-dedup contract (owner verdict
902
- // 2026-07-11) is preserved inside runCodeAudit; MAJOR findings flow through
903
- // dispatchSecurityAlertDirect to the configured security alert sender.
904
- const AUDIT_INTERVAL_MS = 60 * 60 * 1000; // 1 hour
905
- const AUDIT_INITIAL_DELAY_MS = 5 * 60 * 1000; // 5 min after startup
906
- const doSystemAudit = async () => {
907
- try {
908
- const report = await (0, code_audit_js_1.runCodeAudit)({
909
- config: {
910
- telegram: config.telegram,
911
- multi_agent: config.multi_agent,
912
- roles: config.roles,
913
- },
914
- // Evaluated at audit time: gateway-wiring registers the sender only
915
- // for ACTIVE gateways, so a configured target on a dead gateway must
916
- // not report a false PASS.
917
- securityAlertConfigured: (0, security_monitor_js_1.hasSecurityAlertSender)(),
918
- // Direct dispatch, NOT recordSecurityEvent: audit findings are
919
- // self-generated and must not fabricate incident/denylist/RDAP
920
- // artifacts for a pseudo client. dispatchSecurityAlertDirect awaits
921
- // delivery and throws on failure, so runCodeAudit keeps
922
- // last_alerted_at null and retries on the next run (fail loud).
923
- alert: async (finding, reason) => {
924
- await (0, security_monitor_js_1.dispatchSecurityAlertDirect)({
925
- type: 'system_audit_finding',
926
- severity: 'critical',
927
- message: `[Audit/${reason}] ${finding.summary}`,
928
- // path carries the finding id so the alert-cooldown fingerprint
929
- // distinguishes findings instead of collapsing them all into one.
930
- path: finding.id,
931
- details: { findingId: finding.id, detail: finding.detail ?? null },
932
- });
933
- },
934
- });
935
- const majors = report.findings.filter((f) => f.severity === 'MAJOR').length;
936
- const minors = report.findings.filter((f) => f.severity === 'MINOR').length;
937
- routesLogger.info(`[System Audit] ${report.pass_items.length} pass, ${majors} MAJOR, ${minors} MINOR, ` +
938
- `alerted=[${report.alerted.join(',')}] in ${report.duration_ms}ms`);
939
- if (report.alert_delivery_failures.length > 0) {
940
- routesLogger.error('[System Audit] Alert delivery failures:', report.alert_delivery_failures.join('; '));
941
- }
942
- return report;
943
- }
944
- catch (err) {
945
- routesLogger.error('[System Audit] Failed:', err instanceof Error ? err.message : String(err));
946
- return null;
947
- }
948
- };
949
- // Serialize scheduled and manual runs (same pattern as the memory-promotion
950
- // chain above): overlapping audits would read the same prior state, alert
951
- // twice, and race the audit-findings.json write. doSystemAudit never
952
- // rejects, so chaining on the previous run is sufficient.
953
- let auditRunChain = Promise.resolve(null);
954
- const runSystemAudit = () => {
955
- const next = auditRunChain.then(doSystemAudit);
956
- auditRunChain = next;
957
- return next;
958
- };
959
- setTimeout(() => {
960
- void runSystemAudit();
961
- (0, leg_cadence_js_1.getLegCadence)()?.declare('system-audit', AUDIT_INTERVAL_MS);
962
- setInterval(() => {
963
- (0, leg_cadence_js_1.getLegCadence)()?.beat('system-audit');
964
- void runSystemAudit();
965
- }, AUDIT_INTERVAL_MS);
966
- }, AUDIT_INITIAL_DELAY_MS);
967
- // Manual trigger returns the full report (read-only, no LLM, fast)
968
- apiServer.app.post('/api/system/audit', auth_middleware_js_1.requireAuth, async (_req, res) => {
969
- const report = await runSystemAudit();
970
- if (report) {
971
- res.json({ ok: true, mode: 'code', report });
972
- }
973
- else {
974
- res.status(500).json({ ok: false, error: 'audit failed - see daemon.log' });
975
- }
976
- });
977
- routesLogger.info('[System Audit] Ready - deterministic code checks every 60 min, POST /api/system/audit for manual run');
978
- // ── Memory Agent stats API ────────────────────────────────────────────
979
- apiServer.app.get('/api/memory-agent/stats', auth_middleware_js_1.requireAuth, (_req, res) => {
980
- const stats = messageRouter.getMemoryAgentStats();
981
- res.json(stats);
982
- });
983
- // ── Memory Agent dashboard API ────────────────────────────────────────
984
- apiServer.app.get('/api/memory-agent/dashboard', auth_middleware_js_1.requireAuth, async (_req, res) => {
985
- try {
986
- // 1. Memory agent runtime stats
987
- const agentStats = messageRouter.getMemoryAgentStats();
988
- // 2. Memory DB stats (decisions, checkpoints, outcomes, topics)
989
- const adapter = getAdapter();
990
- const now = Date.now();
991
- const weekAgo = now - 7 * 24 * 60 * 60 * 1000;
992
- const monthAgo = now - 30 * 24 * 60 * 60 * 1000;
993
- const totalRow = adapter.prepare('SELECT COUNT(*) as count FROM decisions').get();
994
- const weekRow = adapter
995
- .prepare('SELECT COUNT(*) as count FROM decisions WHERE created_at > ?')
996
- .get(weekAgo);
997
- const monthRow = adapter
998
- .prepare('SELECT COUNT(*) as count FROM decisions WHERE created_at > ?')
999
- .get(monthAgo);
1000
- const checkpointRow = adapter.prepare('SELECT COUNT(*) as count FROM checkpoints').get();
1001
- const outcomeRows = adapter
1002
- .prepare(`SELECT outcome, COUNT(*) as count FROM decisions
1003
- WHERE outcome IS NOT NULL GROUP BY outcome`)
1004
- .all();
1005
- const outcomes = {};
1006
- for (const row of outcomeRows) {
1007
- outcomes[row.outcome?.toLowerCase() ?? 'unknown'] = row.count;
1008
- }
1009
- const topTopics = adapter
1010
- .prepare(`SELECT topic, COUNT(*) as count FROM decisions
1011
- WHERE topic IS NOT NULL GROUP BY topic ORDER BY count DESC LIMIT 10`)
1012
- .all();
1013
- // 3. Recent decisions (last 20)
1014
- const recentDecisions = adapter
1015
- .prepare(`SELECT id, topic, decision, outcome, confidence, created_at
1016
- FROM decisions ORDER BY created_at DESC LIMIT 20`)
1017
- .all();
1018
- // 4. Channel summaries (from channel_summary_state table, if it exists)
1019
- let channelSummaries = [];
1020
- try {
1021
- const rawSummaries = adapter
1022
- .prepare('SELECT channel_key, updated_at FROM channel_summary_state ORDER BY updated_at DESC LIMIT 20')
1023
- .all();
1024
- channelSummaries = rawSummaries.map((r) => ({
1025
- channelKey: r.channel_key,
1026
- updatedAt: r.updated_at,
1027
- }));
1028
- }
1029
- catch {
1030
- // Table may not exist yet — not an error
1031
- }
1032
- const payload = (0, memory_agent_dashboard_js_1.buildMemoryAgentDashboardPayload)({
1033
- agentStats,
1034
- channelSummaries,
1035
- recentDecisions,
1036
- generatedAt: new Date().toISOString(),
1037
- });
1038
- res.json({
1039
- ...payload,
1040
- agent: agentStats,
1041
- memory: {
1042
- total: totalRow?.count ?? 0,
1043
- thisWeek: weekRow?.count ?? 0,
1044
- thisMonth: monthRow?.count ?? 0,
1045
- checkpoints: checkpointRow?.count ?? 0,
1046
- outcomes,
1047
- topTopics,
1048
- },
1049
- channelSummaries,
1050
- });
1051
- }
1052
- catch (error) {
1053
- routesLogger.error('[memory-agent/dashboard] Error', error instanceof Error ? error : String(error));
1054
- res.status(500).json({
1055
- error: error instanceof Error ? error.message : String(error),
1056
- });
1057
- }
1058
- });
1059
- // ── Session API endpoints ─────────────────────────────────────────────
1060
- apiServer.app.get('/api/sessions/last-active', auth_middleware_js_1.requireAuth, async (_req, res) => {
1061
- try {
1062
- const sessions = messageRouter.listSessions('viewer');
1063
- if (sessions.length === 0) {
1064
- res.json({ session: null });
1065
- return;
1066
- }
1067
- const sorted = sessions.sort((a, b) => b.lastActive - a.lastActive);
1068
- res.json({ session: sorted[0] });
1069
- }
1070
- catch (error) {
1071
- console.error('[Sessions API] Error:', error);
1072
- res.status(500).json({ error: error instanceof Error ? error.message : String(error) });
1073
- }
1074
- });
1075
- apiServer.app.get('/api/sessions', auth_middleware_js_1.requireAuth, async (_req, res) => {
1076
- try {
1077
- const viewerSessions = messageRouter.listSessions('viewer');
1078
- const discordSessions = messageRouter.listSessions('discord');
1079
- const telegramSessions = messageRouter.listSessions('telegram');
1080
- const slackSessions = messageRouter.listSessions('slack');
1081
- res.json({
1082
- viewer: viewerSessions,
1083
- discord: discordSessions,
1084
- telegram: telegramSessions,
1085
- slack: slackSessions,
1086
- });
1087
- }
1088
- catch (error) {
1089
- console.error('[Sessions API] Error:', error);
1090
- res.status(500).json({ error: error instanceof Error ? error.message : String(error) });
1091
- }
1092
- });
1093
- registerKagemushaTaskRoute(apiServer.app, apiServer.privateConnectorPolicy);
1094
- // ── Agent Notices endpoint ────────────────────────────────────────────
1095
- apiServer.app.get('/api/agent-notices', auth_middleware_js_1.requireAuth, async (_req, res) => {
1096
- try {
1097
- const limit = Number(_req.query.limit) || 20;
1098
- const notices = eventBus.getRecentNotices(limit);
1099
- res.json({
1100
- success: true,
1101
- notices: notices.map((n) => ({
1102
- agent: n.agent,
1103
- action: n.action,
1104
- target: n.target,
1105
- timestamp: new Date(n.timestamp).toISOString(),
1106
- })),
1107
- total: notices.length,
1108
- });
1109
- }
1110
- catch (error) {
1111
- res.status(500).json({
1112
- success: false,
1113
- error: error instanceof Error ? error.message : String(error),
1114
- });
1115
- }
1116
- });
1117
- // ── Discord send endpoint ─────────────────────────────────────────────
1118
- apiServer.app.post('/api/discord/send', auth_middleware_js_1.requireAuth, async (req, res) => {
1119
- try {
1120
- const { channelId, message } = req.body;
1121
- if (!channelId || !message) {
1122
- res.status(400).json({ error: 'channelId and message are required' });
1123
- return;
1124
- }
1125
- if (!discordGateway) {
1126
- res.status(503).json({ error: 'Discord gateway not connected' });
1127
- return;
1128
- }
1129
- console.log(`[Discord Send] Sending to ${channelId}: ${message.substring(0, 50)}...`);
1130
- await discordGateway.sendMessage(channelId, message);
1131
- console.log(`[Discord Send] Success`);
1132
- res.json({ success: true });
1133
- }
1134
- catch (error) {
1135
- console.error('[Discord Send] Error:', error);
1136
- res.status(500).json({ error: error instanceof Error ? error.message : String(error) });
1137
- }
1138
- });
1139
- // ── Slack send endpoint ───────────────────────────────────────────────
1140
- apiServer.app.post('/api/slack/send', auth_middleware_js_1.requireAuth, async (req, res) => {
1141
- try {
1142
- const { channelId, message, filePath, caption } = req.body;
1143
- if (!channelId || (!message && !filePath)) {
1144
- res.status(400).json({ error: 'channelId and (message or filePath) are required' });
1145
- return;
1146
- }
1147
- if (!slackGateway) {
1148
- res.status(503).json({ error: 'Slack gateway not connected' });
1149
- return;
1150
- }
1151
- if (filePath) {
1152
- // SECURITY: Path traversal prevention (same pattern as /api/discord/image)
1153
- const fsMod = await import('fs/promises');
1154
- const workspacePath = config.workspace?.path?.replace('~', process.env.HOME || '') ||
1155
- `${process.env.HOME}/.mama/workspace`;
1156
- const tempPath = node_path_1.default.join(workspacePath, 'temp');
1157
- const tmpPath = '/tmp';
1158
- const resolvedFilePath = node_path_1.default.isAbsolute(filePath)
1159
- ? node_path_1.default.resolve(filePath)
1160
- : node_path_1.default.resolve(workspacePath, filePath);
1161
- const normalizedWorkspace = node_path_1.default.resolve(workspacePath);
1162
- const normalizedTemp = node_path_1.default.resolve(tempPath);
1163
- const isInWorkspace = resolvedFilePath.startsWith(normalizedWorkspace + node_path_1.default.sep);
1164
- const isInTemp = resolvedFilePath.startsWith(normalizedTemp + node_path_1.default.sep);
1165
- const isInTmp = resolvedFilePath.startsWith(tmpPath + '/');
1166
- if (!isInWorkspace && !isInTemp && !isInTmp) {
1167
- console.warn(`[Slack Send] SECURITY: Path traversal blocked: ${filePath} -> ${resolvedFilePath}`);
1168
- res
1169
- .status(400)
1170
- .json({ error: 'File path must be within workspace, workspace/temp, or /tmp' });
1171
- return;
1172
- }
1173
- // Block sensitive file types
1174
- const deniedExtensions = ['.db', '.key', '.pem', '.env', '.sqlite', '.sqlite3'];
1175
- const ext = node_path_1.default.extname(resolvedFilePath).toLowerCase();
1176
- if (deniedExtensions.includes(ext)) {
1177
- console.warn(`[Slack Send] SECURITY: Denied file type blocked: ${ext}`);
1178
- res.status(400).json({ error: 'File type not allowed' });
1179
- return;
1180
- }
1181
- try {
1182
- await fsMod.access(resolvedFilePath);
1183
- }
1184
- catch {
1185
- res.status(404).json({ error: 'File not found' });
1186
- return;
1187
- }
1188
- console.log(`[Slack Send] Sending file to ${channelId}: ${resolvedFilePath}`);
1189
- await slackGateway.sendFile(channelId, resolvedFilePath, caption);
1190
- }
1191
- if (message) {
1192
- console.log(`[Slack Send] Sending to ${channelId}: ${message.substring(0, 50)}...`);
1193
- await slackGateway.sendMessage(channelId, message);
1194
- }
1195
- console.log(`[Slack Send] Success`);
1196
- res.json({ success: true });
1197
- }
1198
- catch (error) {
1199
- console.error('[Slack Send] Error:', error);
1200
- res.status(500).json({ error: error instanceof Error ? error.message : String(error) });
1201
- }
1202
- });
1203
- // Legacy model-and-send endpoints are retired. They accepted an arbitrary
1204
- // destination without the delivery ledger, so retries could duplicate output.
1205
- for (const retiredPath of ['/api/discord/cron', '/api/report']) {
1206
- apiServer.app.post(retiredPath, auth_middleware_js_1.requireAuth, (_req, res) => {
1207
- res.status(410).json({
1208
- error: 'Legacy model-and-send endpoint retired; use the owner runtime and receipted delivery',
1209
- });
1210
- });
1211
- }
1212
- // ── Screenshot endpoint ───────────────────────────────────────────────
1213
- apiServer.app.post('/api/screenshot', auth_middleware_js_1.requireAuth, async (req, res) => {
1214
- const { spawn } = await import('child_process');
1215
- try {
1216
- const { channelId, htmlFile, caption } = req.body;
1217
- if (!channelId || !htmlFile) {
1218
- res.status(400).json({ error: 'channelId and htmlFile are required' });
1219
- return;
1220
- }
1221
- if (!discordGateway) {
1222
- res.status(503).json({ error: 'Discord gateway not connected' });
1223
- return;
1224
- }
1225
- const workspacePath = config.workspace?.path?.replace('~', process.env.HOME || '') ||
1226
- `${process.env.HOME}/.mama/workspace`;
1227
- // SECURITY P0: Path traversal prevention
1228
- if (node_path_1.default.isAbsolute(htmlFile)) {
1229
- res.status(400).json({ error: 'Absolute paths not allowed' });
1230
- return;
1231
- }
1232
- const resolvedPath = node_path_1.default.resolve(workspacePath, htmlFile);
1233
- const normalizedWorkspace = node_path_1.default.resolve(workspacePath);
1234
- if (!resolvedPath.startsWith(normalizedWorkspace + node_path_1.default.sep)) {
1235
- res.status(400).json({ error: 'Path traversal detected' });
1236
- return;
1237
- }
1238
- const fs = await import('fs/promises');
1239
- try {
1240
- await fs.access(resolvedPath);
1241
- }
1242
- catch {
1243
- res.status(404).json({ error: 'File not found' });
1244
- return;
1245
- }
1246
- const allowedExtensions = ['.html', '.htm'];
1247
- if (!allowedExtensions.some((ext) => resolvedPath.toLowerCase().endsWith(ext))) {
1248
- res.status(400).json({ error: 'Only HTML files allowed' });
1249
- return;
1250
- }
1251
- const htmlPath = resolvedPath;
1252
- const outputPath = `${workspacePath}/temp/screenshot-${Date.now()}.png`;
1253
- console.log(`[Screenshot] Taking screenshot of: ${htmlPath}`);
1254
- // SECURITY P0: never shell out. Use spawn with args to avoid injection.
1255
- await new Promise((resolve, reject) => {
1256
- const child = spawn('node', [`${workspacePath}/scripts/html-screenshot.mjs`, htmlPath, outputPath], {
1257
- cwd: workspacePath,
1258
- stdio: 'ignore',
1259
- });
1260
- let settled = false;
1261
- const timeoutId = setTimeout(() => {
1262
- if (settled)
1263
- return;
1264
- settled = true;
1265
- child.kill('SIGKILL');
1266
- reject(new Error('Screenshot script timed out after 30000ms'));
1267
- }, 30000);
1268
- child.on('error', (err) => {
1269
- clearTimeout(timeoutId);
1270
- if (settled)
1271
- return;
1272
- settled = true;
1273
- reject(err);
1274
- });
1275
- child.on('exit', (code, signal) => {
1276
- clearTimeout(timeoutId);
1277
- if (settled)
1278
- return;
1279
- settled = true;
1280
- if (code === 0) {
1281
- resolve();
1282
- return;
1283
- }
1284
- reject(new Error(`Screenshot script failed: code=${code ?? 'null'} signal=${signal ?? 'null'}`));
1285
- });
1286
- });
1287
- // Send to Discord
1288
- console.log(`[Screenshot] Sending to Discord: ${outputPath}`);
1289
- await discordGateway.sendFile(channelId, outputPath, caption);
1290
- console.log('[Screenshot] Complete');
1291
- res.json({ success: true, screenshot: outputPath });
1292
- }
1293
- catch (error) {
1294
- console.error('[Screenshot] Error:', error);
1295
- res.status(500).json({ error: error instanceof Error ? error.message : String(error) });
1296
- }
1297
- });
1298
- // ── Discord image endpoint (4-layer path validation) ──────────────────
1299
- apiServer.app.post('/api/discord/image', auth_middleware_js_1.requireAuth, async (req, res) => {
1300
- const fs = await import('fs/promises');
1301
- try {
1302
- const { channelId, imagePath, caption } = req.body;
1303
- if (!channelId || !imagePath) {
1304
- res.status(400).json({ error: 'channelId and imagePath are required' });
1305
- return;
1306
- }
1307
- if (!discordGateway) {
1308
- res.status(503).json({ error: 'Discord gateway not connected' });
1309
- return;
1310
- }
1311
- // SECURITY P0: 4-layer path validation
1312
- const workspacePath = config.workspace?.path?.replace('~', process.env.HOME || '') ||
1313
- `${process.env.HOME}/.mama/workspace`;
1314
- const tempPath = node_path_1.default.join(workspacePath, 'temp');
1315
- const tmpPath = '/tmp';
1316
- // Layer 1: Reject absolute paths (unless in allowed directories)
1317
- if (node_path_1.default.isAbsolute(imagePath)) {
1318
- const normalizedInput = node_path_1.default.normalize(imagePath);
1319
- const isInWorkspace = normalizedInput.startsWith(node_path_1.default.resolve(workspacePath) + node_path_1.default.sep);
1320
- const isInTemp = normalizedInput.startsWith(node_path_1.default.resolve(tempPath) + node_path_1.default.sep);
1321
- const isInTmp = normalizedInput.startsWith(tmpPath + node_path_1.default.sep);
1322
- if (!isInWorkspace && !isInTemp && !isInTmp) {
1323
- console.warn(`[Discord Image] SECURITY: Absolute path blocked: ${imagePath}`);
1324
- res
1325
- .status(400)
1326
- .json({ error: 'Absolute paths only allowed in workspace, workspace/temp, or /tmp' });
1327
- return;
1328
- }
1329
- }
1330
- // Layer 2: Resolve and verify within allowed directories
1331
- const resolvedImagePath = node_path_1.default.isAbsolute(imagePath)
1332
- ? node_path_1.default.resolve(imagePath)
1333
- : node_path_1.default.resolve(workspacePath, imagePath);
1334
- const normalizedWorkspace = node_path_1.default.resolve(workspacePath);
1335
- const normalizedTemp = node_path_1.default.resolve(tempPath);
1336
- const isInWorkspace = resolvedImagePath.startsWith(normalizedWorkspace + node_path_1.default.sep);
1337
- const isInTemp = resolvedImagePath.startsWith(normalizedTemp + node_path_1.default.sep);
1338
- const isInTmp = resolvedImagePath.startsWith(tmpPath + node_path_1.default.sep);
1339
- if (!isInWorkspace && !isInTemp && !isInTmp) {
1340
- console.warn(`[Discord Image] SECURITY: Path traversal blocked: ${imagePath} -> ${resolvedImagePath}`);
1341
- res.status(400).json({ error: 'Path traversal detected' });
1342
- return;
1343
- }
1344
- // Layer 3: Verify file exists
1345
- try {
1346
- await fs.access(resolvedImagePath);
1347
- }
1348
- catch {
1349
- res.status(404).json({ error: 'Image file not found' });
1350
- return;
1351
- }
1352
- // Layer 4: Whitelist extensions
1353
- const allowedExtensions = ['.png', '.jpg', '.jpeg', '.gif', '.webp'];
1354
- if (!allowedExtensions.some((ext) => resolvedImagePath.toLowerCase().endsWith(ext))) {
1355
- console.warn(`[Discord Image] SECURITY: Invalid extension blocked: ${resolvedImagePath}`);
1356
- res
1357
- .status(400)
1358
- .json({ error: 'Only image files allowed (.png, .jpg, .jpeg, .gif, .webp)' });
1359
- return;
1360
- }
1361
- console.log(`[Discord Image] Sending: ${resolvedImagePath}`);
1362
- await discordGateway.sendFile(channelId, resolvedImagePath, caption);
1363
- console.log('[Discord Image] Complete');
1364
- res.json({ success: true });
1365
- }
1366
- catch (error) {
1367
- console.error('[Discord Image] Error:', error);
1368
- res.status(500).json({ error: error instanceof Error ? error.message : String(error) });
1369
- }
1370
- });
1371
- // ── Upload / download media endpoints ─────────────────────────────────
1372
- apiServer.app.use('/api', (0, upload_handler_js_1.createUploadRouter)());
1373
- // ── Auth gate for /graph/* write endpoints ────────────────────────────
1374
- apiServer.app.use('/graph', (req, res, next) => {
1375
- const isRead = req.method === 'GET' || req.method === 'HEAD';
1376
- if (!isRead && !(0, auth_middleware_js_1.isAuthenticated)(req)) {
1377
- (0, auth_middleware_js_1.logUnauthorizedAttempt)(req);
1378
- res.status(401).json({
1379
- error: true,
1380
- code: 'UNAUTHORIZED',
1381
- message: 'Authentication required.',
1382
- });
1383
- return;
1384
- }
1385
- next();
1386
- });
1387
- // ── Graph handler middleware ───────────────────────────────────────────
1388
- apiServer.app.use(async (req, res, next) => {
1389
- const handled = await graphHandler(req, res);
1390
- if (!handled)
1391
- next();
1392
- });
1393
- // ── Session proxy middleware ───────────────────────────────────────────
1394
- apiServer.app.use((req, res, next) => {
1395
- if (req.path.startsWith('/api/session')) {
1396
- const bodyData = req.body ? JSON.stringify(req.body) : '';
1397
- const options = {
1398
- hostname: 'localhost',
1399
- port: utilities_js_1.EMBEDDING_PORT,
1400
- path: req.url,
1401
- method: req.method,
1402
- headers: {
1403
- ...req.headers,
1404
- host: `localhost:${utilities_js_1.EMBEDDING_PORT}`,
1405
- 'content-length': Buffer.byteLength(bodyData),
1406
- },
1407
- };
1408
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1409
- const proxy = node_http_1.default.request(options, (proxyRes) => {
1410
- res.writeHead(proxyRes.statusCode, proxyRes.headers);
1411
- proxyRes.pipe(res, { end: true });
1412
- });
1413
- if (bodyData) {
1414
- proxy.write(bodyData);
1415
- }
1416
- proxy.end();
1417
- proxy.on('error', (error) => {
1418
- if (!res.headersSent) {
1419
- res.status(500).json({ error: 'Failed to proxy session API', details: error.message });
1420
- }
1421
- });
1422
- }
1423
- else {
1424
- next();
1425
- }
1426
- });
1427
- console.log(`✓ Session API proxied to port ${utilities_js_1.EMBEDDING_PORT}`);
1428
- // ── Daemon Log API ────────────────────────────────────────────────────
1429
- apiServer.app.get('/api/logs/daemon', auth_middleware_js_1.requireAuth, (req, res) => {
1430
- const logPath = node_path_1.default.join((0, node_os_1.homedir)(), '.mama', 'logs', 'daemon.log');
1431
- if (!(0, node_fs_1.existsSync)(logPath)) {
1432
- res.status(404).json({ error: 'daemon.log not found' });
1433
- return;
1434
- }
1435
- try {
1436
- const stat = (0, node_fs_1.statSync)(logPath);
1437
- const since = parseInt(req.query.since, 10) || 0;
1438
- if (since > 0 && stat.mtimeMs <= since) {
1439
- res.status(304).end();
1440
- return;
1441
- }
1442
- const requestedTail = parseInt(req.query.tail, 10);
1443
- const tail = Math.min(Math.max(isNaN(requestedTail) ? 200 : requestedTail, 1), 5000);
1444
- const chunkSize = Math.min(stat.size, tail * 300);
1445
- const buffer = Buffer.alloc(chunkSize);
1446
- const fd = (0, node_fs_1.openSync)(logPath, 'r');
1447
- try {
1448
- (0, node_fs_1.readSync)(fd, buffer, 0, chunkSize, Math.max(0, stat.size - chunkSize));
1449
- }
1450
- finally {
1451
- (0, node_fs_1.closeSync)(fd);
1452
- }
1453
- const raw = buffer.toString('utf-8');
1454
- const allLines = raw.split('\n').filter((l) => l.trim());
1455
- const lines = allLines.slice(-tail);
1456
- const isFullFile = chunkSize >= stat.size;
1457
- res.json({
1458
- lines,
1459
- total: isFullFile ? allLines.length : undefined,
1460
- totalBytes: stat.size,
1461
- mtime: stat.mtimeMs,
1462
- truncated: !isFullFile,
1463
- });
1464
- }
1465
- catch (err) {
1466
- res.status(500).json({ error: err instanceof Error ? err.message : String(err) });
1467
- }
1468
- });
1469
- // ── Workspace skills API ──────────────────────────────────────────────
1470
- const skillsWorkDir = node_path_1.default.join((0, node_os_1.homedir)(), '.mama', 'workspace', 'skills');
1471
- apiServer.app.get('/api/workspace/skills', auth_middleware_js_1.requireAuth, (_req, res) => {
1472
- try {
1473
- if (!(0, node_fs_1.existsSync)(skillsWorkDir)) {
1474
- res.json({ skills: [] });
1475
- return;
1476
- }
1477
- const dirs = (0, node_fs_1.readdirSync)(skillsWorkDir, { withFileTypes: true })
1478
- .filter((d) => d.isDirectory())
1479
- .map((d) => {
1480
- const mdPath = node_path_1.default.join(skillsWorkDir, d.name, 'SKILL.md');
1481
- const exists = (0, node_fs_1.existsSync)(mdPath);
1482
- return { id: d.name, exists };
1483
- })
1484
- .filter((s) => s.exists)
1485
- .map(({ id }) => ({ id }));
1486
- res.json({ skills: dirs });
1487
- }
1488
- catch (err) {
1489
- console.warn('[GET /api/workspace/skills] Failed to read skills directory (non-fatal):', err);
1490
- res.json({ skills: [] });
1491
- }
1492
- });
1493
- apiServer.app.get('/api/workspace/skills/:name/content', auth_middleware_js_1.requireAuth, (req, res) => {
1494
- const name = req.params.name;
1495
- if (!name || /[^a-zA-Z0-9_-]/.test(name)) {
1496
- res.status(400).json({ error: 'Invalid skill name' });
1497
- return;
1498
- }
1499
- const mdPath = node_path_1.default.join(skillsWorkDir, name, 'SKILL.md');
1500
- try {
1501
- if (!(0, node_fs_1.existsSync)(mdPath)) {
1502
- res.status(404).json({ error: 'Skill not found' });
1503
- return;
1504
- }
1505
- const content = (0, node_fs_1.readFileSync)(mdPath, 'utf-8');
1506
- res.json({ content });
1507
- }
1508
- catch (err) {
1509
- routesLogger.warn('[GET /api/workspace/skills/:name/content] Failed to read skill:', err);
1510
- res.status(500).json({ error: 'Failed to read skill content' });
1511
- }
1512
- });
1513
- console.log('✓ Workspace Skills API available at /api/workspace/skills');
1514
- // ── Viewer static assets ──────────────────────────────────────────────
1515
- const publicDir = node_path_1.default.join(__dirname, '..', '..', '..', 'public');
1516
- apiServer.app.use(express_1.default.static(publicDir, {
1517
- setHeaders: (res, _filePath) => {
1518
- res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
1519
- res.setHeader('Pragma', 'no-cache');
1520
- res.setHeader('Expires', '0');
1521
- },
1522
- }));
1523
- console.log('✓ Viewer UI available at /viewer');
1524
- return {
1525
- boardReconcileEnabled,
1526
- requestBoardRepair,
1527
- stop: () => {
1528
- if (boardBootTimeout)
1529
- clearTimeout(boardBootTimeout);
1530
- boardBootTimeout = null;
1531
- if (boardInterval)
1532
- clearInterval(boardInterval);
1533
- boardInterval = null;
1534
- if (wikiContinuityInterval)
1535
- clearInterval(wikiContinuityInterval);
1536
- wikiContinuityInterval = null;
1537
- boardReconcileScheduler?.stop();
1538
- boardReconcileScheduler = null;
1539
- },
1540
- };
1541
- }
1542
- //# sourceMappingURL=api-routes-init.js.map