@jungjaehoon/mama-os 0.28.6 → 0.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (452) hide show
  1. package/dist/agent/agent-loop.d.ts +0 -4
  2. package/dist/agent/agent-loop.d.ts.map +1 -1
  3. package/dist/agent/agent-loop.js +33 -10
  4. package/dist/agent/agent-loop.js.map +1 -1
  5. package/dist/agent/code-act/host-bridge.d.ts.map +1 -1
  6. package/dist/agent/code-act/host-bridge.js +53 -3
  7. package/dist/agent/code-act/host-bridge.js.map +1 -1
  8. package/dist/agent/code-act/tool-policy.d.ts.map +1 -1
  9. package/dist/agent/code-act/tool-policy.js +5 -0
  10. package/dist/agent/code-act/tool-policy.js.map +1 -1
  11. package/dist/agent/codex-auth.d.ts +0 -1
  12. package/dist/agent/codex-auth.d.ts.map +1 -1
  13. package/dist/agent/codex-auth.js +0 -4
  14. package/dist/agent/codex-auth.js.map +1 -1
  15. package/dist/agent/codex-home.d.ts +0 -2
  16. package/dist/agent/codex-home.d.ts.map +1 -1
  17. package/dist/agent/codex-home.js +0 -66
  18. package/dist/agent/codex-home.js.map +1 -1
  19. package/dist/agent/context-compile-service.d.ts +9 -0
  20. package/dist/agent/context-compile-service.d.ts.map +1 -1
  21. package/dist/agent/context-compile-service.js +6 -0
  22. package/dist/agent/context-compile-service.js.map +1 -1
  23. package/dist/agent/context-prompt-builder.d.ts +0 -6
  24. package/dist/agent/context-prompt-builder.d.ts.map +1 -1
  25. package/dist/agent/context-prompt-builder.js +0 -131
  26. package/dist/agent/context-prompt-builder.js.map +1 -1
  27. package/dist/agent/contract-extractor.d.ts +0 -4
  28. package/dist/agent/contract-extractor.d.ts.map +1 -1
  29. package/dist/agent/contract-extractor.js +0 -68
  30. package/dist/agent/contract-extractor.js.map +1 -1
  31. package/dist/agent/gateway-tool-executor.d.ts +20 -15
  32. package/dist/agent/gateway-tool-executor.d.ts.map +1 -1
  33. package/dist/agent/gateway-tool-executor.js +236 -90
  34. package/dist/agent/gateway-tool-executor.js.map +1 -1
  35. package/dist/agent/gateway-tools.md +7 -4
  36. package/dist/agent/skill-loader.d.ts +0 -7
  37. package/dist/agent/skill-loader.d.ts.map +1 -1
  38. package/dist/agent/skill-loader.js +0 -86
  39. package/dist/agent/skill-loader.js.map +1 -1
  40. package/dist/agent/token-estimator.d.ts +0 -8
  41. package/dist/agent/token-estimator.d.ts.map +1 -1
  42. package/dist/agent/token-estimator.js +0 -14
  43. package/dist/agent/token-estimator.js.map +1 -1
  44. package/dist/agent/tool-registry.d.ts.map +1 -1
  45. package/dist/agent/tool-registry.js +23 -5
  46. package/dist/agent/tool-registry.js.map +1 -1
  47. package/dist/agent/types.d.ts +27 -1
  48. package/dist/agent/types.d.ts.map +1 -1
  49. package/dist/agent/types.js.map +1 -1
  50. package/dist/api/agent-graph-handler.d.ts +9 -0
  51. package/dist/api/agent-graph-handler.d.ts.map +1 -1
  52. package/dist/api/agent-graph-handler.js +27 -1
  53. package/dist/api/agent-graph-handler.js.map +1 -1
  54. package/dist/api/entity-audit-handler.d.ts +1 -2
  55. package/dist/api/entity-audit-handler.d.ts.map +1 -1
  56. package/dist/api/entity-audit-handler.js +0 -5
  57. package/dist/api/entity-audit-handler.js.map +1 -1
  58. package/dist/api/index.d.ts +1 -9
  59. package/dist/api/index.d.ts.map +1 -1
  60. package/dist/api/index.js +4 -17
  61. package/dist/api/index.js.map +1 -1
  62. package/dist/api/intelligence-handler.d.ts +0 -5
  63. package/dist/api/intelligence-handler.d.ts.map +1 -1
  64. package/dist/api/intelligence-handler.js +0 -15
  65. package/dist/api/intelligence-handler.js.map +1 -1
  66. package/dist/api/types.d.ts +1 -5
  67. package/dist/api/types.d.ts.map +1 -1
  68. package/dist/api/types.js +0 -14
  69. package/dist/api/types.js.map +1 -1
  70. package/dist/cli/commands/start.d.ts +117 -3
  71. package/dist/cli/commands/start.d.ts.map +1 -1
  72. package/dist/cli/commands/start.js +223 -62
  73. package/dist/cli/commands/start.js.map +1 -1
  74. package/dist/cli/config/config-manager.d.ts +0 -5
  75. package/dist/cli/config/config-manager.d.ts.map +1 -1
  76. package/dist/cli/config/config-manager.js +0 -29
  77. package/dist/cli/config/config-manager.js.map +1 -1
  78. package/dist/cli/config/types.d.ts.map +1 -1
  79. package/dist/cli/config/types.js +3 -0
  80. package/dist/cli/config/types.js.map +1 -1
  81. package/dist/cli/runtime/api-routes-init.d.ts.map +1 -1
  82. package/dist/cli/runtime/api-routes-init.js +32 -5
  83. package/dist/cli/runtime/api-routes-init.js.map +1 -1
  84. package/dist/cli/runtime/api-server-init.d.ts.map +1 -1
  85. package/dist/cli/runtime/api-server-init.js +2 -0
  86. package/dist/cli/runtime/api-server-init.js.map +1 -1
  87. package/dist/cli/runtime/gateway-init.d.ts +1 -1
  88. package/dist/cli/runtime/gateway-init.d.ts.map +1 -1
  89. package/dist/cli/runtime/gateway-init.js +11 -38
  90. package/dist/cli/runtime/gateway-init.js.map +1 -1
  91. package/dist/cli/runtime/gateway-wiring.d.ts.map +1 -1
  92. package/dist/cli/runtime/gateway-wiring.js +6 -120
  93. package/dist/cli/runtime/gateway-wiring.js.map +1 -1
  94. package/dist/cli/utils/pid-manager.d.ts +0 -10
  95. package/dist/cli/utils/pid-manager.d.ts.map +1 -1
  96. package/dist/cli/utils/pid-manager.js +0 -26
  97. package/dist/cli/utils/pid-manager.js.map +1 -1
  98. package/dist/connectors/framework/polling-scheduler.d.ts +33 -1
  99. package/dist/connectors/framework/polling-scheduler.d.ts.map +1 -1
  100. package/dist/connectors/framework/polling-scheduler.js +46 -40
  101. package/dist/connectors/framework/polling-scheduler.js.map +1 -1
  102. package/dist/connectors/trello/query-tools.d.ts +32 -5
  103. package/dist/connectors/trello/query-tools.d.ts.map +1 -1
  104. package/dist/connectors/trello/query-tools.js +56 -17
  105. package/dist/connectors/trello/query-tools.js.map +1 -1
  106. package/dist/db/agent-store.d.ts +0 -4
  107. package/dist/db/agent-store.d.ts.map +1 -1
  108. package/dist/db/agent-store.js +0 -65
  109. package/dist/db/agent-store.js.map +1 -1
  110. package/dist/envelope/enforcer.d.ts.map +1 -1
  111. package/dist/envelope/enforcer.js +10 -1
  112. package/dist/envelope/enforcer.js.map +1 -1
  113. package/dist/envelope/index.d.ts +0 -1
  114. package/dist/envelope/index.d.ts.map +1 -1
  115. package/dist/envelope/index.js +0 -1
  116. package/dist/envelope/index.js.map +1 -1
  117. package/dist/envelope/signature.d.ts +0 -1
  118. package/dist/envelope/signature.d.ts.map +1 -1
  119. package/dist/envelope/signature.js +0 -7
  120. package/dist/envelope/signature.js.map +1 -1
  121. package/dist/envelope/tool-connector-scope.d.ts +35 -0
  122. package/dist/envelope/tool-connector-scope.d.ts.map +1 -0
  123. package/dist/envelope/tool-connector-scope.js +57 -0
  124. package/dist/envelope/tool-connector-scope.js.map +1 -0
  125. package/dist/evidence/effects.d.ts +107 -0
  126. package/dist/evidence/effects.d.ts.map +1 -0
  127. package/dist/evidence/effects.js +281 -0
  128. package/dist/evidence/effects.js.map +1 -0
  129. package/dist/evidence/read.d.ts +75 -0
  130. package/dist/evidence/read.d.ts.map +1 -0
  131. package/dist/evidence/read.js +105 -0
  132. package/dist/evidence/read.js.map +1 -0
  133. package/dist/gateways/base-gateway.d.ts +23 -3
  134. package/dist/gateways/base-gateway.d.ts.map +1 -1
  135. package/dist/gateways/base-gateway.js +15 -2
  136. package/dist/gateways/base-gateway.js.map +1 -1
  137. package/dist/gateways/discord.d.ts +4 -16
  138. package/dist/gateways/discord.d.ts.map +1 -1
  139. package/dist/gateways/discord.js +22 -189
  140. package/dist/gateways/discord.js.map +1 -1
  141. package/dist/gateways/index.d.ts +2 -1
  142. package/dist/gateways/index.d.ts.map +1 -1
  143. package/dist/gateways/message-router.d.ts +13 -20
  144. package/dist/gateways/message-router.d.ts.map +1 -1
  145. package/dist/gateways/message-router.js +32 -3
  146. package/dist/gateways/message-router.js.map +1 -1
  147. package/dist/gateways/slack.d.ts +2 -12
  148. package/dist/gateways/slack.d.ts.map +1 -1
  149. package/dist/gateways/slack.js +6 -220
  150. package/dist/gateways/slack.js.map +1 -1
  151. package/dist/gateways/telegram.d.ts +2 -2
  152. package/dist/gateways/telegram.d.ts.map +1 -1
  153. package/dist/gateways/telegram.js +3 -2
  154. package/dist/gateways/telegram.js.map +1 -1
  155. package/dist/gateways/turn-contract.d.ts +104 -0
  156. package/dist/gateways/turn-contract.d.ts.map +1 -0
  157. package/dist/{memory/consult-contract.js → gateways/turn-contract.js} +1 -1
  158. package/dist/gateways/turn-contract.js.map +1 -0
  159. package/dist/memory/provenance-live.d.ts +111 -0
  160. package/dist/memory/provenance-live.d.ts.map +1 -0
  161. package/dist/memory/provenance-live.js +381 -0
  162. package/dist/memory/provenance-live.js.map +1 -0
  163. package/dist/memory/provenance-resolver.d.ts +184 -0
  164. package/dist/memory/provenance-resolver.d.ts.map +1 -0
  165. package/dist/memory/provenance-resolver.js +152 -0
  166. package/dist/memory/provenance-resolver.js.map +1 -0
  167. package/dist/multi-agent/agent-event-bus.d.ts +1 -0
  168. package/dist/multi-agent/agent-event-bus.d.ts.map +1 -1
  169. package/dist/multi-agent/bmad-templates.d.ts +0 -18
  170. package/dist/multi-agent/bmad-templates.d.ts.map +1 -1
  171. package/dist/multi-agent/bmad-templates.js +0 -127
  172. package/dist/multi-agent/bmad-templates.js.map +1 -1
  173. package/dist/multi-agent/dashboard-agent-persona.js +3 -3
  174. package/dist/operator/board-reconcile.d.ts +2 -3
  175. package/dist/operator/board-reconcile.d.ts.map +1 -1
  176. package/dist/operator/board-reconcile.js +18 -32
  177. package/dist/operator/board-reconcile.js.map +1 -1
  178. package/dist/operator/changes-projection.d.ts +70 -0
  179. package/dist/operator/changes-projection.d.ts.map +1 -0
  180. package/dist/operator/changes-projection.js +109 -0
  181. package/dist/operator/changes-projection.js.map +1 -0
  182. package/dist/operator/external-correlation.d.ts +94 -0
  183. package/dist/operator/external-correlation.d.ts.map +1 -0
  184. package/dist/operator/external-correlation.js +177 -0
  185. package/dist/operator/external-correlation.js.map +1 -0
  186. package/dist/operator/operator-trigger-loop.d.ts +9 -1
  187. package/dist/operator/operator-trigger-loop.d.ts.map +1 -1
  188. package/dist/operator/operator-trigger-loop.js +8 -4
  189. package/dist/operator/operator-trigger-loop.js.map +1 -1
  190. package/dist/operator/provenance-lookup.d.ts +18 -0
  191. package/dist/operator/provenance-lookup.d.ts.map +1 -0
  192. package/dist/operator/provenance-lookup.js +54 -0
  193. package/dist/operator/provenance-lookup.js.map +1 -0
  194. package/dist/operator/report-carry.d.ts +18 -1
  195. package/dist/operator/report-carry.d.ts.map +1 -1
  196. package/dist/operator/report-carry.js +22 -3
  197. package/dist/operator/report-carry.js.map +1 -1
  198. package/dist/operator/report-run.d.ts +31 -0
  199. package/dist/operator/report-run.d.ts.map +1 -1
  200. package/dist/operator/report-run.js +140 -22
  201. package/dist/operator/report-run.js.map +1 -1
  202. package/dist/operator/task-ledger.d.ts +84 -2
  203. package/dist/operator/task-ledger.d.ts.map +1 -1
  204. package/dist/operator/task-ledger.js +274 -31
  205. package/dist/operator/task-ledger.js.map +1 -1
  206. package/dist/operator/trigger-author.d.ts +7 -0
  207. package/dist/operator/trigger-author.d.ts.map +1 -1
  208. package/dist/operator/trigger-author.js +78 -7
  209. package/dist/operator/trigger-author.js.map +1 -1
  210. package/dist/operator/worker-run.js +1 -1
  211. package/dist/operator/worker-run.js.map +1 -1
  212. package/dist/operator/workorder-hooks.d.ts +79 -4
  213. package/dist/operator/workorder-hooks.d.ts.map +1 -1
  214. package/dist/operator/workorder-hooks.js +152 -20
  215. package/dist/operator/workorder-hooks.js.map +1 -1
  216. package/dist/operator/workorder-publishers.d.ts +2 -0
  217. package/dist/operator/workorder-publishers.d.ts.map +1 -1
  218. package/dist/operator/workorder-publishers.js +8 -1
  219. package/dist/operator/workorder-publishers.js.map +1 -1
  220. package/dist/utils/untrusted-content.d.ts +11 -0
  221. package/dist/utils/untrusted-content.d.ts.map +1 -1
  222. package/dist/utils/untrusted-content.js +20 -0
  223. package/dist/utils/untrusted-content.js.map +1 -1
  224. package/package.json +4 -3
  225. package/scripts/backfill-channel-keys.ts +451 -0
  226. package/dist/agent/auto-recall.d.ts +0 -48
  227. package/dist/agent/auto-recall.d.ts.map +0 -1
  228. package/dist/agent/auto-recall.js +0 -192
  229. package/dist/agent/auto-recall.js.map +0 -1
  230. package/dist/agent/claude-client.d.ts +0 -50
  231. package/dist/agent/claude-client.d.ts.map +0 -1
  232. package/dist/agent/claude-client.js +0 -219
  233. package/dist/agent/claude-client.js.map +0 -1
  234. package/dist/agent/delegation-executor.d.ts +0 -49
  235. package/dist/agent/delegation-executor.d.ts.map +0 -1
  236. package/dist/agent/delegation-executor.js +0 -692
  237. package/dist/agent/delegation-executor.js.map +0 -1
  238. package/dist/agent/mcp-executor.d.ts +0 -60
  239. package/dist/agent/mcp-executor.d.ts.map +0 -1
  240. package/dist/agent/mcp-executor.js +0 -190
  241. package/dist/agent/mcp-executor.js.map +0 -1
  242. package/dist/agent/process-tree.d.ts +0 -6
  243. package/dist/agent/process-tree.d.ts.map +0 -1
  244. package/dist/agent/process-tree.js +0 -21
  245. package/dist/agent/process-tree.js.map +0 -1
  246. package/dist/agent/streaming-callback-manager.d.ts +0 -85
  247. package/dist/agent/streaming-callback-manager.d.ts.map +0 -1
  248. package/dist/agent/streaming-callback-manager.js +0 -103
  249. package/dist/agent/streaming-callback-manager.js.map +0 -1
  250. package/dist/agent/token-budget.d.ts +0 -49
  251. package/dist/agent/token-budget.d.ts.map +0 -1
  252. package/dist/agent/token-budget.js +0 -92
  253. package/dist/agent/token-budget.js.map +0 -1
  254. package/dist/connectors/kagemusha/history-compiler.d.ts +0 -18
  255. package/dist/connectors/kagemusha/history-compiler.d.ts.map +0 -1
  256. package/dist/connectors/kagemusha/history-compiler.js +0 -35
  257. package/dist/connectors/kagemusha/history-compiler.js.map +0 -1
  258. package/dist/db/migrations/wiki-artifacts.d.ts +0 -3
  259. package/dist/db/migrations/wiki-artifacts.d.ts.map +0 -1
  260. package/dist/db/migrations/wiki-artifacts.js +0 -24
  261. package/dist/db/migrations/wiki-artifacts.js.map +0 -1
  262. package/dist/envelope/subset.d.ts +0 -9
  263. package/dist/envelope/subset.d.ts.map +0 -1
  264. package/dist/envelope/subset.js +0 -67
  265. package/dist/envelope/subset.js.map +0 -1
  266. package/dist/memory/consult-contract.d.ts +0 -8
  267. package/dist/memory/consult-contract.d.ts.map +0 -1
  268. package/dist/memory/consult-contract.js.map +0 -1
  269. package/dist/multi-agent/agent-message-queue.d.ts +0 -104
  270. package/dist/multi-agent/agent-message-queue.d.ts.map +0 -1
  271. package/dist/multi-agent/agent-message-queue.js +0 -227
  272. package/dist/multi-agent/agent-message-queue.js.map +0 -1
  273. package/dist/multi-agent/background-task-manager.d.ts +0 -248
  274. package/dist/multi-agent/background-task-manager.d.ts.map +0 -1
  275. package/dist/multi-agent/background-task-manager.js +0 -415
  276. package/dist/multi-agent/background-task-manager.js.map +0 -1
  277. package/dist/multi-agent/category-router.d.ts +0 -56
  278. package/dist/multi-agent/category-router.d.ts.map +0 -1
  279. package/dist/multi-agent/category-router.js +0 -99
  280. package/dist/multi-agent/category-router.js.map +0 -1
  281. package/dist/multi-agent/council-engine.d.ts +0 -60
  282. package/dist/multi-agent/council-engine.d.ts.map +0 -1
  283. package/dist/multi-agent/council-engine.js +0 -284
  284. package/dist/multi-agent/council-engine.js.map +0 -1
  285. package/dist/multi-agent/delegation-format-validator.d.ts +0 -22
  286. package/dist/multi-agent/delegation-format-validator.d.ts.map +0 -1
  287. package/dist/multi-agent/delegation-format-validator.js +0 -31
  288. package/dist/multi-agent/delegation-format-validator.js.map +0 -1
  289. package/dist/multi-agent/delegation-manager.d.ts +0 -128
  290. package/dist/multi-agent/delegation-manager.d.ts.map +0 -1
  291. package/dist/multi-agent/delegation-manager.js +0 -276
  292. package/dist/multi-agent/delegation-manager.js.map +0 -1
  293. package/dist/multi-agent/i18n-messages.d.ts +0 -35
  294. package/dist/multi-agent/i18n-messages.d.ts.map +0 -1
  295. package/dist/multi-agent/i18n-messages.js +0 -54
  296. package/dist/multi-agent/i18n-messages.js.map +0 -1
  297. package/dist/multi-agent/index.d.ts +0 -31
  298. package/dist/multi-agent/index.d.ts.map +0 -1
  299. package/dist/multi-agent/index.js +0 -46
  300. package/dist/multi-agent/index.js.map +0 -1
  301. package/dist/multi-agent/multi-agent-base.d.ts +0 -223
  302. package/dist/multi-agent/multi-agent-base.d.ts.map +0 -1
  303. package/dist/multi-agent/multi-agent-base.js +0 -592
  304. package/dist/multi-agent/multi-agent-base.js.map +0 -1
  305. package/dist/multi-agent/multi-agent-discord.d.ts +0 -142
  306. package/dist/multi-agent/multi-agent-discord.d.ts.map +0 -1
  307. package/dist/multi-agent/multi-agent-discord.js +0 -1235
  308. package/dist/multi-agent/multi-agent-discord.js.map +0 -1
  309. package/dist/multi-agent/multi-agent-slack.d.ts +0 -146
  310. package/dist/multi-agent/multi-agent-slack.d.ts.map +0 -1
  311. package/dist/multi-agent/multi-agent-slack.js +0 -953
  312. package/dist/multi-agent/multi-agent-slack.js.map +0 -1
  313. package/dist/multi-agent/multi-bot-manager.d.ts +0 -119
  314. package/dist/multi-agent/multi-bot-manager.d.ts.map +0 -1
  315. package/dist/multi-agent/multi-bot-manager.js +0 -449
  316. package/dist/multi-agent/multi-bot-manager.js.map +0 -1
  317. package/dist/multi-agent/orchestrator.d.ts +0 -110
  318. package/dist/multi-agent/orchestrator.d.ts.map +0 -1
  319. package/dist/multi-agent/orchestrator.js +0 -436
  320. package/dist/multi-agent/orchestrator.js.map +0 -1
  321. package/dist/multi-agent/rate-limiter.d.ts +0 -76
  322. package/dist/multi-agent/rate-limiter.d.ts.map +0 -1
  323. package/dist/multi-agent/rate-limiter.js +0 -128
  324. package/dist/multi-agent/rate-limiter.js.map +0 -1
  325. package/dist/multi-agent/shared-context.d.ts +0 -127
  326. package/dist/multi-agent/shared-context.d.ts.map +0 -1
  327. package/dist/multi-agent/shared-context.js +0 -239
  328. package/dist/multi-agent/shared-context.js.map +0 -1
  329. package/dist/multi-agent/slack-config-validator.d.ts +0 -42
  330. package/dist/multi-agent/slack-config-validator.d.ts.map +0 -1
  331. package/dist/multi-agent/slack-config-validator.js +0 -194
  332. package/dist/multi-agent/slack-config-validator.js.map +0 -1
  333. package/dist/multi-agent/slack-multi-bot-manager.d.ts +0 -143
  334. package/dist/multi-agent/slack-multi-bot-manager.d.ts.map +0 -1
  335. package/dist/multi-agent/slack-multi-bot-manager.js +0 -413
  336. package/dist/multi-agent/slack-multi-bot-manager.js.map +0 -1
  337. package/dist/multi-agent/swarm/swarm-anti-pattern-detector.d.ts +0 -98
  338. package/dist/multi-agent/swarm/swarm-anti-pattern-detector.d.ts.map +0 -1
  339. package/dist/multi-agent/swarm/swarm-anti-pattern-detector.js +0 -225
  340. package/dist/multi-agent/swarm/swarm-anti-pattern-detector.js.map +0 -1
  341. package/dist/multi-agent/swarm/swarm-db.d.ts +0 -175
  342. package/dist/multi-agent/swarm/swarm-db.d.ts.map +0 -1
  343. package/dist/multi-agent/swarm/swarm-db.js +0 -313
  344. package/dist/multi-agent/swarm/swarm-db.js.map +0 -1
  345. package/dist/multi-agent/swarm/swarm-event-reporter.d.ts +0 -116
  346. package/dist/multi-agent/swarm/swarm-event-reporter.d.ts.map +0 -1
  347. package/dist/multi-agent/swarm/swarm-event-reporter.js +0 -243
  348. package/dist/multi-agent/swarm/swarm-event-reporter.js.map +0 -1
  349. package/dist/multi-agent/swarm/swarm-mama-adapter.d.ts +0 -57
  350. package/dist/multi-agent/swarm/swarm-mama-adapter.d.ts.map +0 -1
  351. package/dist/multi-agent/swarm/swarm-mama-adapter.js +0 -87
  352. package/dist/multi-agent/swarm/swarm-mama-adapter.js.map +0 -1
  353. package/dist/multi-agent/swarm/swarm-manager.d.ts +0 -122
  354. package/dist/multi-agent/swarm/swarm-manager.d.ts.map +0 -1
  355. package/dist/multi-agent/swarm/swarm-manager.js +0 -199
  356. package/dist/multi-agent/swarm/swarm-manager.js.map +0 -1
  357. package/dist/multi-agent/swarm/swarm-task-learner.d.ts +0 -104
  358. package/dist/multi-agent/swarm/swarm-task-learner.d.ts.map +0 -1
  359. package/dist/multi-agent/swarm/swarm-task-learner.js +0 -211
  360. package/dist/multi-agent/swarm/swarm-task-learner.js.map +0 -1
  361. package/dist/multi-agent/swarm/swarm-task-runner.d.ts +0 -155
  362. package/dist/multi-agent/swarm/swarm-task-runner.d.ts.map +0 -1
  363. package/dist/multi-agent/swarm/swarm-task-runner.js +0 -615
  364. package/dist/multi-agent/swarm/swarm-task-runner.js.map +0 -1
  365. package/dist/multi-agent/swarm/wave-engine.d.ts +0 -96
  366. package/dist/multi-agent/swarm/wave-engine.d.ts.map +0 -1
  367. package/dist/multi-agent/swarm/wave-engine.js +0 -123
  368. package/dist/multi-agent/swarm/wave-engine.js.map +0 -1
  369. package/dist/multi-agent/system-reminder.d.ts +0 -206
  370. package/dist/multi-agent/system-reminder.d.ts.map +0 -1
  371. package/dist/multi-agent/system-reminder.js +0 -455
  372. package/dist/multi-agent/system-reminder.js.map +0 -1
  373. package/dist/multi-agent/task-continuation.d.ts +0 -74
  374. package/dist/multi-agent/task-continuation.d.ts.map +0 -1
  375. package/dist/multi-agent/task-continuation.js +0 -172
  376. package/dist/multi-agent/task-continuation.js.map +0 -1
  377. package/dist/multi-agent/ultrawork-state.d.ts +0 -57
  378. package/dist/multi-agent/ultrawork-state.d.ts.map +0 -1
  379. package/dist/multi-agent/ultrawork-state.js +0 -191
  380. package/dist/multi-agent/ultrawork-state.js.map +0 -1
  381. package/dist/multi-agent/ultrawork.d.ts +0 -152
  382. package/dist/multi-agent/ultrawork.d.ts.map +0 -1
  383. package/dist/multi-agent/ultrawork.js +0 -879
  384. package/dist/multi-agent/ultrawork.js.map +0 -1
  385. package/dist/multi-agent/work-tracker.d.ts +0 -22
  386. package/dist/multi-agent/work-tracker.d.ts.map +0 -1
  387. package/dist/multi-agent/work-tracker.js +0 -45
  388. package/dist/multi-agent/work-tracker.js.map +0 -1
  389. package/dist/multi-agent/workflow-engine.d.ts +0 -87
  390. package/dist/multi-agent/workflow-engine.d.ts.map +0 -1
  391. package/dist/multi-agent/workflow-engine.js +0 -604
  392. package/dist/multi-agent/workflow-engine.js.map +0 -1
  393. package/dist/onboarding/all-tools.d.ts +0 -18
  394. package/dist/onboarding/all-tools.d.ts.map +0 -1
  395. package/dist/onboarding/all-tools.js +0 -149
  396. package/dist/onboarding/all-tools.js.map +0 -1
  397. package/dist/onboarding/autonomous-discovery-tools.d.ts +0 -23
  398. package/dist/onboarding/autonomous-discovery-tools.d.ts.map +0 -1
  399. package/dist/onboarding/autonomous-discovery-tools.js +0 -268
  400. package/dist/onboarding/autonomous-discovery-tools.js.map +0 -1
  401. package/dist/onboarding/onboarding-state.d.ts +0 -70
  402. package/dist/onboarding/onboarding-state.d.ts.map +0 -1
  403. package/dist/onboarding/onboarding-state.js +0 -183
  404. package/dist/onboarding/onboarding-state.js.map +0 -1
  405. package/dist/onboarding/personality-quiz.d.ts +0 -35
  406. package/dist/onboarding/personality-quiz.d.ts.map +0 -1
  407. package/dist/onboarding/personality-quiz.js +0 -219
  408. package/dist/onboarding/personality-quiz.js.map +0 -1
  409. package/dist/onboarding/phase-5-summary.d.ts +0 -26
  410. package/dist/onboarding/phase-5-summary.d.ts.map +0 -1
  411. package/dist/onboarding/phase-5-summary.js +0 -153
  412. package/dist/onboarding/phase-5-summary.js.map +0 -1
  413. package/dist/onboarding/phase-6-security.d.ts +0 -33
  414. package/dist/onboarding/phase-6-security.d.ts.map +0 -1
  415. package/dist/onboarding/phase-6-security.js +0 -473
  416. package/dist/onboarding/phase-6-security.js.map +0 -1
  417. package/dist/onboarding/phase-7-integrations.d.ts +0 -91
  418. package/dist/onboarding/phase-7-integrations.d.ts.map +0 -1
  419. package/dist/onboarding/phase-7-integrations.js +0 -725
  420. package/dist/onboarding/phase-7-integrations.js.map +0 -1
  421. package/dist/onboarding/phase-8-demo.d.ts +0 -43
  422. package/dist/onboarding/phase-8-demo.d.ts.map +0 -1
  423. package/dist/onboarding/phase-8-demo.js +0 -346
  424. package/dist/onboarding/phase-8-demo.js.map +0 -1
  425. package/dist/onboarding/phase-9-finalization.d.ts +0 -27
  426. package/dist/onboarding/phase-9-finalization.d.ts.map +0 -1
  427. package/dist/onboarding/phase-9-finalization.js +0 -417
  428. package/dist/onboarding/phase-9-finalization.js.map +0 -1
  429. package/dist/onboarding/ritual-prompt.d.ts +0 -2
  430. package/dist/onboarding/ritual-prompt.d.ts.map +0 -1
  431. package/dist/onboarding/ritual-prompt.js +0 -285
  432. package/dist/onboarding/ritual-prompt.js.map +0 -1
  433. package/dist/onboarding/ritual-tools.d.ts +0 -17
  434. package/dist/onboarding/ritual-tools.d.ts.map +0 -1
  435. package/dist/onboarding/ritual-tools.js +0 -93
  436. package/dist/onboarding/ritual-tools.js.map +0 -1
  437. package/dist/setup/setup-tools.d.ts +0 -13
  438. package/dist/setup/setup-tools.d.ts.map +0 -1
  439. package/dist/setup/setup-tools.js +0 -106
  440. package/dist/setup/setup-tools.js.map +0 -1
  441. package/dist/utils/slack-input-validator.d.ts +0 -74
  442. package/dist/utils/slack-input-validator.d.ts.map +0 -1
  443. package/dist/utils/slack-input-validator.js +0 -275
  444. package/dist/utils/slack-input-validator.js.map +0 -1
  445. package/dist/utils/slack-rate-limiter.d.ts +0 -139
  446. package/dist/utils/slack-rate-limiter.d.ts.map +0 -1
  447. package/dist/utils/slack-rate-limiter.js +0 -324
  448. package/dist/utils/slack-rate-limiter.js.map +0 -1
  449. package/dist/wiki/wiki-compiler.d.ts +0 -13
  450. package/dist/wiki/wiki-compiler.d.ts.map +0 -1
  451. package/dist/wiki/wiki-compiler.js +0 -82
  452. package/dist/wiki/wiki-compiler.js.map +0 -1
@@ -45,12 +45,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
45
45
  return (mod && mod.__esModule) ? mod : { "default": mod };
46
46
  };
47
47
  Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.OPERATOR_REPORT_TOOL_POLICY = exports.WORKORDER_TOOL_POLICIES = void 0;
48
49
  exports.requireRuntimeBackend = requireRuntimeBackend;
49
50
  exports.serializeCodeActExecutionResult = serializeCodeActExecutionResult;
50
51
  exports.deriveCodeActToolPolicy = deriveCodeActToolPolicy;
51
52
  exports.resolveCodeActAgentPolicy = resolveCodeActAgentPolicy;
52
53
  exports.resolveCodeActRawConnectors = resolveCodeActRawConnectors;
53
54
  exports.scopeDaemonRawConnectors = scopeDaemonRawConnectors;
55
+ exports.buildFullReportGatherLines = buildFullReportGatherLines;
56
+ exports.causeEventIdsFromPayload = causeEventIdsFromPayload;
57
+ exports.workOrderEnvelopeScope = workOrderEnvelopeScope;
58
+ exports.temporalTaskBinding = temporalTaskBinding;
54
59
  exports.resolveCodeActMemoryScopes = resolveCodeActMemoryScopes;
55
60
  exports.buildOperatorReportAgentPolicy = buildOperatorReportAgentPolicy;
56
61
  exports.buildWorkOrderAgentPolicy = buildWorkOrderAgentPolicy;
@@ -66,6 +71,7 @@ const stop_js_1 = require("./stop.js");
66
71
  const index_js_1 = require("../../auth/index.js");
67
72
  const gateway_tool_executor_js_1 = require("../../agent/gateway-tool-executor.js");
68
73
  const context_compile_service_js_1 = require("../../agent/context-compile-service.js");
74
+ const read_js_1 = require("../../evidence/read.js");
69
75
  const tool_registry_js_1 = require("../../agent/tool-registry.js");
70
76
  const tool_policy_js_1 = require("../../agent/code-act/tool-policy.js");
71
77
  const index_js_2 = require("../../gateways/index.js");
@@ -235,13 +241,21 @@ function resolveCodeActRawConnectors(enabledConnectorNames) {
235
241
  return [...new Set((enabledConnectorNames ?? []).map((name) => name.trim()).filter(Boolean))];
236
242
  }
237
243
  /**
238
- * Trello contains owner-scoped project evidence. Among daemon-internal runs,
239
- * only host-issued board and temporal workorders may read it. Verified owner-console
240
- * chat receives its separate route-scoped envelope in envelope-bootstrap.
244
+ * Trello contains owner-scoped project evidence. Among daemon-internal runs, only host-issued
245
+ * board and temporal workorders and the scheduled operator report may read it. Verified
246
+ * owner-console chat receives its separate route-scoped envelope in envelope-bootstrap.
247
+ *
248
+ * The report is admitted because it must cross-check the native ledger against the live board
249
+ * before asserting item state; its envelope still grants NO destinations, so this widens what
250
+ * the report may READ, never what it may send. Read authority is enforced per tool through
251
+ * envelope/tool-connector-scope.ts - the api-code-act principal below stays filtered and its
252
+ * direct board reads are now denied rather than silently permitted by role membership.
241
253
  */
242
254
  function scopeDaemonRawConnectors(enabledConnectorNames, principal) {
243
255
  const connectors = resolveCodeActRawConnectors(enabledConnectorNames);
244
- if (principal === 'workorder-board' || principal === 'workorder-temporal') {
256
+ if (principal === 'workorder-board' ||
257
+ principal === 'workorder-temporal' ||
258
+ principal === 'operator-report') {
245
259
  return connectors;
246
260
  }
247
261
  return connectors.filter((connector) => connector !== 'trello');
@@ -268,6 +282,108 @@ function uniqueMemoryScopes(scopes) {
268
282
  }
269
283
  return unique;
270
284
  }
285
+ /**
286
+ * The connector and channel a temporal task is bound to, as plain values.
287
+ *
288
+ * The workorder payload carries only HASHED source identifiers (they are compared, never
289
+ * read), so the binding has to come from the owner task row. Split on the FIRST colon:
290
+ * `source_channel` is `<connector>:<channelId>` and channel ids contain colons of their own.
291
+ *
292
+ * Returns null when the task names no channel - which is not a failure, it is a task whose
293
+ * reconcile may rest on no raw evidence at all.
294
+ */
295
+ /**
296
+ * The scope a workorder envelope carries.
297
+ *
298
+ * Extracted so the binding can be asserted directly. Composed inline, the only way to test
299
+ * it was to re-compose it in the test - which tests the copy, and a copy of a scope
300
+ * construction is how this subsystem's authority drifts from what it claims.
301
+ */
302
+ /**
303
+ * What the scheduled full report is INSTRUCTED to gather with.
304
+ *
305
+ * Exported so a test can hold it against the lane's tool grant. Every defect this session
306
+ * found was a wiring defect - a tool granted and never instructed, a lane wired zero times,
307
+ * a binder that never bound - and all of them live in this file and its neighbour, the two
308
+ * directories the suite covers at a third. An instruction list that cannot be read by a
309
+ * test is one nobody can check against the grant it depends on.
310
+ */
311
+ function buildFullReportGatherLines({ lastSuccessIso, }) {
312
+ return [
313
+ 'kagemusha_overview() for room/task/message counts',
314
+ 'kagemusha_tasks({}) for the open task board, plus kagemusha_tasks({ status: "review" }) for items awaiting review (status values must be real board statuses like pending/in_progress/review - invented labels match nothing)',
315
+ lastSuccessIso
316
+ ? `kagemusha_entities({ activeOnly: true }) for active channels, then kagemusha_messages({ channelId, since: "${lastSuccessIso}" }) on the busiest 2-3 - since is the last successful report; do NOT widen it`
317
+ : 'kagemusha_entities({ activeOnly: true }) for active channels, then kagemusha_messages({ channelId }) on the busiest 2-3 (since defaults to the last 7 days; pass an ISO-8601 timestamp like since: "2026-07-09T00:00:00Z" to narrow it - never a phrase like "24h ago")',
318
+ 'mama_recall(query) for memory relevant to what you find',
319
+ 'schedule_upcoming({ days: 14 }) for upcoming calendar events -- cross-check task deadlines against them',
320
+ lastSuccessIso
321
+ ? `changes_read({ since: "${lastSuccessIso}" }) for what THIS system durably changed since the last report -- lead with it, and say what each change rested on`
322
+ : 'changes_read({ since: "7d" }) for what THIS system durably changed in the window -- lead with it, and say what each change rested on',
323
+ 'On changes_read: cause_state "unattributed" means the system cannot explain that change, NOT that nothing happened -- report the coverage counts as they are rather than rounding them up. It is ONE PAGE: if returned is less than total, say so instead of describing the page as the whole. It covers work items only today, so the absence of report or memory changes there is not evidence they did not happen.',
324
+ ];
325
+ }
326
+ /**
327
+ * The batch a work order carries, as the run's cause.
328
+ *
329
+ * Exported because it was an inline closure and therefore untestable, while being the ONE
330
+ * hop that carries this branch's whole claim: the system knew the batch before the run
331
+ * began, so the agent never has to restate it. Review pointed out that `causeEventIds`
332
+ * appeared in exactly two test files and both called the ledger directly - a rename or a
333
+ * payload-shape drift here would have returned attribution to 32% with the suite green.
334
+ *
335
+ * Only per-channel reconcile work orders carry `eventIds`; `board:full`, wiki and
336
+ * memory-curation do not, and get an empty batch rather than an invented one.
337
+ */
338
+ function causeEventIdsFromPayload(payload) {
339
+ if (payload === null || typeof payload !== 'object')
340
+ return [];
341
+ const batch = payload.eventIds;
342
+ if (!Array.isArray(batch))
343
+ return [];
344
+ return batch.filter((id) => typeof id === 'string' && id.trim().length > 0);
345
+ }
346
+ function workOrderEnvelopeScope(input) {
347
+ const isTemporal = input.workKind === 'temporal';
348
+ return {
349
+ project_refs: [{ kind: 'project', id: input.projectId }],
350
+ // A temporal run reads its task's connector or nothing. Every other lane keeps the
351
+ // connectors it was configured with.
352
+ raw_connectors: isTemporal
353
+ ? input.temporalBinding
354
+ ? [input.temporalBinding.connector]
355
+ : []
356
+ : input.laneConnectors,
357
+ memory_scopes: [
358
+ ...(0, scope_context_js_1.deriveMemoryScopes)({
359
+ source: 'operator',
360
+ channelId: `worker:${input.workKind}`,
361
+ projectId: input.projectId,
362
+ }),
363
+ ...(input.temporalBinding
364
+ ? [
365
+ {
366
+ kind: 'channel',
367
+ id: `${input.temporalBinding.connector}:${input.temporalBinding.channel}`,
368
+ },
369
+ ]
370
+ : []),
371
+ ],
372
+ allowed_destinations: [],
373
+ };
374
+ }
375
+ function temporalTaskBinding(ledger, taskId) {
376
+ const sourceChannel = ledger.getById(taskId)?.sourceChannel;
377
+ if (typeof sourceChannel !== 'string')
378
+ return null;
379
+ const separator = sourceChannel.indexOf(':');
380
+ if (separator <= 0 || separator === sourceChannel.length - 1)
381
+ return null;
382
+ return {
383
+ connector: sourceChannel.slice(0, separator),
384
+ channel: sourceChannel.slice(separator + 1),
385
+ };
386
+ }
271
387
  function resolveCodeActMemoryScopes(baseScopes, adapter) {
272
388
  const scopes = [...baseScopes];
273
389
  if (!adapter) {
@@ -313,11 +429,12 @@ function buildCodeActRole(policy) {
313
429
  // Stage-2 workers are short-lived operator jobs, not standing multi-agent
314
430
  // personas. Their permissions must therefore be complete on a default install
315
431
  // and must not vary with optional legacy agent configuration.
316
- const WORKORDER_TOOL_POLICIES = {
432
+ exports.WORKORDER_TOOL_POLICIES = {
317
433
  board: {
318
434
  roleName: 'workorder-board',
319
435
  allowedTools: [
320
436
  'agent_notices',
437
+ 'changes_read',
321
438
  'context_compile',
322
439
  'contract_no_update',
323
440
  'kagemusha_entities',
@@ -372,23 +489,41 @@ const WORKORDER_TOOL_POLICIES = {
372
489
  * decides whether a full report has task-board substance), the fullReportSelfGather lines,
373
490
  * the board_publish lines, and the single mama_save the report may make.
374
491
  *
375
- * Its envelope grants no destinations and filters trello out of the raw connectors
376
- * (scopeDaemonRawConnectors 'operator-report'), so no send or task-mutation tool belongs here.
492
+ * Its envelope grants no destinations, so no send tool belongs here, and no task-mutation
493
+ * tool either: the report observes, the board workorder maintains.
494
+ *
495
+ * trello_kanban is the ONE whole-board live read. Without it the report could only restate the
496
+ * native ledger, which is a derived store the board workorder is forbidden to sync from Trello -
497
+ * so a card that moved days ago still reported as "no completion signal" (live 2026-07-28).
498
+ * Reading it is scoped by the envelope now that direct connector readers are mapped in
499
+ * envelope/tool-connector-scope.ts; without that mapping this entry alone would have granted
500
+ * unscoped access.
377
501
  */
378
- const OPERATOR_REPORT_TOOL_POLICY = {
502
+ exports.OPERATOR_REPORT_TOOL_POLICY = {
379
503
  roleName: 'operator-report',
380
504
  allowedTools: [
381
- 'context_compile',
505
+ // context_compile is deliberately ABSENT. Envelope scope is connector-level, so
506
+ // granting the board connector for trello_kanban would otherwise also permit
507
+ // context_compile({connectors:['trello']}) - raw card bodies pulled into a tier-2
508
+ // lane that can write durable memory. The report needs the whole-board read, not
509
+ // raw compilation, and its gather instructions never ask for it.
510
+ // What the report is FOR: what moved since last time. Until now the only way to
511
+ // answer that was to re-read current state and infer the delta, which is how a
512
+ // report ends up restating the board instead of naming the change.
513
+ 'changes_read',
382
514
  'kagemusha_entities',
383
515
  'kagemusha_messages',
384
516
  'kagemusha_overview',
385
517
  'kagemusha_tasks',
518
+ 'mama_provenance',
386
519
  'mama_recall',
387
520
  'mama_save',
388
521
  'mama_search',
389
522
  'report_publish',
390
523
  'schedule_upcoming',
524
+ 'task_external_correlation',
391
525
  'task_list',
526
+ 'trello_kanban',
392
527
  ],
393
528
  };
394
529
  /**
@@ -402,12 +537,12 @@ const OPERATOR_REPORT_TOOL_POLICY = {
402
537
  */
403
538
  function buildOperatorReportAgentPolicy(model, backend) {
404
539
  const blockedTools = [];
405
- const innerTools = uniqueToolList(OPERATOR_REPORT_TOOL_POLICY.allowedTools);
540
+ const innerTools = uniqueToolList(exports.OPERATOR_REPORT_TOOL_POLICY.allowedTools);
406
541
  const allowedTools = uniqueToolList(['code_act', ...innerTools]);
407
542
  const agentContext = {
408
543
  source: 'operator',
409
544
  platform: 'cli',
410
- roleName: OPERATOR_REPORT_TOOL_POLICY.roleName,
545
+ roleName: exports.OPERATOR_REPORT_TOOL_POLICY.roleName,
411
546
  role: {
412
547
  allowedTools,
413
548
  blockedTools,
@@ -431,7 +566,7 @@ function buildOperatorReportAgentPolicy(model, backend) {
431
566
  return { agentContext, gatewayToolsPrompt: tool_registry_js_1.ToolRegistry.generatePrompt(innerTools) };
432
567
  }
433
568
  function buildWorkOrderAgentPolicy(kind, model, backend) {
434
- const policy = WORKORDER_TOOL_POLICIES[kind];
569
+ const policy = exports.WORKORDER_TOOL_POLICIES[kind];
435
570
  if (!policy) {
436
571
  throw new Error(`Missing built-in workorder tool policy for '${kind}'`);
437
572
  }
@@ -733,6 +868,10 @@ async function runAgentLoop(config, options = {}) {
733
868
  const { getAdapter } = require('@jungjaehoon/mama-core/db-manager');
734
869
  const contextCompileService = (0, context_compile_service_js_1.createContextCompileService)({
735
870
  memoryAdapter: getAdapter(),
871
+ // Raw visibility comes from the owner's connector config, not from the derived scope
872
+ // columns. Without this the compile reads nothing: measured on the live index, the
873
+ // scope-based predicate returns 0 of 30,671 events for the input shape sent here.
874
+ channelGrant: read_js_1.liveBoundaryChannels,
736
875
  });
737
876
  toolExecutor.setContextCompileService(contextCompileService);
738
877
  agentLoop.setContextCompileService(contextCompileService);
@@ -1018,28 +1157,11 @@ async function runAgentLoop(config, options = {}) {
1018
1157
  toolExecutor.setRestartMultiAgentAgent(graphHandlerOptions.restartMultiAgentAgent);
1019
1158
  agentLoop.setApplyMultiAgentConfig(graphHandlerOptions.applyMultiAgentConfig);
1020
1159
  agentLoop.setRestartMultiAgentAgent(graphHandlerOptions.restartMultiAgentAgent);
1021
- if (fallbackMultiAgentConfig.enabled && !toolExecutor.hasDelegateSupport()) {
1022
- const { DelegationManager } = await import('../../multi-agent/delegation-manager.js');
1023
- const agentConfigs = Object.entries(fallbackMultiAgentConfig.agents || {}).map(([id, cfg]) => ({
1024
- id,
1025
- ...cfg,
1026
- }));
1027
- const dm = new DelegationManager(agentConfigs);
1028
- dm.setSessionsDb(db);
1029
- toolExecutor.setDelegationManager(dm);
1030
- agentLoop.setDelegationManager(dm);
1031
- graphHandlerOptions.applyMultiAgentConfig = async (rawConfig) => {
1032
- const nextConfig = rawConfig;
1033
- pm.updateConfig(nextConfig);
1034
- dm.updateAgents(Object.entries(nextConfig.agents || {}).map(([id, cfg]) => ({ id, ...cfg })));
1035
- };
1036
- toolExecutor.setApplyMultiAgentConfig(graphHandlerOptions.applyMultiAgentConfig);
1037
- agentLoop.setApplyMultiAgentConfig(graphHandlerOptions.applyMultiAgentConfig);
1038
- console.log('[start] ✓ Delegate tool wired (standalone — no Discord/Slack handler)');
1039
- }
1040
- else {
1041
- console.log('[start] ✓ System agent process manager wired');
1042
- }
1160
+ // The delegate wiring was here. Over the full log history it was wired ZERO times and
1161
+ // its only runtime trace was one call refused by role permission. The process manager
1162
+ // above stays: that one IS wired on every boot (113 so far) and runs the dashboard and
1163
+ // wiki agents.
1164
+ console.log('[start] ✓ System agent process manager wired');
1043
1165
  }
1044
1166
  // ── Phase 9: Heartbeat + Connectors ──────────────────────────────────────
1045
1167
  const { heartbeatScheduler, tokenKeepAlive, healthWarningInterval } = (0, scheduler_init_js_1.initHeartbeat)(config, agentLoop, discordGateway, scheduler, healthCheckService);
@@ -1148,8 +1270,32 @@ async function runAgentLoop(config, options = {}) {
1148
1270
  systemPrompt: buildWorkerSystemPrompt(workOrderPolicy.gatewayToolsPrompt, runtimeBackend, wo.workKind),
1149
1271
  agentContext: workOrderPolicy.agentContext,
1150
1272
  }, wo.id);
1273
+ // A temporal run is bound to ONE task on ONE channel, and the packet check
1274
+ // (temporalPacketRawSourcesWithinBoundSource) enforces exactly that: every raw ref
1275
+ // must match the task's connector:channel or the reconcile is refused.
1276
+ //
1277
+ // While raw reads returned nothing that check was vacuous. Once the channel grant
1278
+ // makes them return rows it stops being vacuous, and a lane-wide envelope hands
1279
+ // the compile every configured channel of every granted connector - so every
1280
+ // raw-backed temporal run would fail a check it cannot satisfy. The envelope has
1281
+ // to say what the run is actually bound to.
1282
+ //
1283
+ // A task with no source channel gets no connector at all, which is the same answer
1284
+ // from the other direction: the check requires zero raw refs for those, so the
1285
+ // grant must be empty rather than merely narrow.
1286
+ // A reconcile carries the channel's delta batch. Handing it to the run makes every
1287
+ // durable change the run produces rest on it WITHOUT the agent restating anything -
1288
+ // the system knew the batch before the run began. This is the whole difference
1289
+ // between a bounded run and an unbounded one.
1290
+ const workOrderBatch = causeEventIdsFromPayload(wo.payload);
1291
+ if (workOrderBatch.length > 0) {
1292
+ runOptions.causeEventIds = workOrderBatch;
1293
+ }
1294
+ let temporalBinding = null;
1151
1295
  if (wo.workKind === 'temporal') {
1152
- runOptions.temporalWorkContext = (0, temporal_worker_js_1.buildTemporalWorkerContext)(taskLedger, wo);
1296
+ const temporalContext = (0, temporal_worker_js_1.buildTemporalWorkerContext)(taskLedger, wo);
1297
+ runOptions.temporalWorkContext = temporalContext;
1298
+ temporalBinding = temporalTaskBinding(taskLedger, temporalContext.taskId);
1153
1299
  }
1154
1300
  // Per-run scoped envelope (live-gate finding, 2026-07-18): gateway
1155
1301
  // 'model_tool' executions are envelope-gated, and workerRun is a new
@@ -1168,16 +1314,18 @@ async function runAgentLoop(config, options = {}) {
1168
1314
  source: 'watch',
1169
1315
  channel_id: `worker:${wo.workKind}`,
1170
1316
  trigger_context: { user_text: `<stage2 workorder ${wo.workKind}#${wo.id}>` },
1171
- scope: {
1172
- project_refs: [{ kind: 'project', id: projectId }],
1173
- raw_connectors: scopeDaemonRawConnectors(codeActRawConnectors, `workorder-${wo.workKind}`),
1174
- memory_scopes: resolveCodeActMemoryScopes((0, scope_context_js_1.deriveMemoryScopes)({
1175
- source: 'operator',
1176
- channelId: `worker:${wo.workKind}`,
1317
+ scope: (() => {
1318
+ const scope = workOrderEnvelopeScope({
1319
+ workKind: wo.workKind,
1177
1320
  projectId,
1178
- }), getAdapter()),
1179
- allowed_destinations: [],
1180
- },
1321
+ laneConnectors: scopeDaemonRawConnectors(codeActRawConnectors, `workorder-${wo.workKind}`),
1322
+ temporalBinding,
1323
+ });
1324
+ return {
1325
+ ...scope,
1326
+ memory_scopes: resolveCodeActMemoryScopes(scope.memory_scopes, getAdapter()),
1327
+ };
1328
+ })(),
1181
1329
  tier: 2,
1182
1330
  budget: { wall_seconds: wallSeconds },
1183
1331
  expires_at: new Date(Date.now() + wallSeconds * 1000 + 30_000).toISOString(),
@@ -1289,6 +1437,14 @@ async function runAgentLoop(config, options = {}) {
1289
1437
  const { reviewTriggerCLI } = await import('../../operator/trigger-review.js');
1290
1438
  const { ReportScheduler, FileReportScheduleStore, parseReportHours } = await import('../../operator/report-scheduler.js');
1291
1439
  const { persistLastFullReport } = await import('../../operator/report-carry.js');
1440
+ // Set when a report is composed, read when that same report is delivered. Safe
1441
+ // because ALL operator work serializes on the operator lane (SOURCE_GLOBAL_LANES),
1442
+ // so compose and deliver cannot interleave with another report - stated here
1443
+ // because the safety comes from the lane, not from this file.
1444
+ let lastReportProvenance = {
1445
+ status: 'unavailable',
1446
+ reason: 'no_run_handle',
1447
+ };
1292
1448
  const { createPersonaReportAsk } = await import('../../operator/report-run.js');
1293
1449
  const { OPERATOR_FULL_REPORT_TAG } = await import('../../operator/situation-report.js');
1294
1450
  const { buildBoardPublishLines } = await import('../../operator/board-slot-instructions.js');
@@ -1323,7 +1479,7 @@ async function runAgentLoop(config, options = {}) {
1323
1479
  delta: new ConnectorDeltaRepo(getAdapter(), (0, config_manager_js_1.expandPath)('~/.mama/operator/trigger-loop-cursors.json')),
1324
1480
  memory: createMamaMemoryPort(),
1325
1481
  registry: triggerRegistry,
1326
- onChannelDelta: (channelKey, lines) => channelDeltaSink.current?.(channelKey, lines),
1482
+ onChannelDelta: (channelKey, lines, eventIds) => channelDeltaSink.current?.(channelKey, lines, eventIds),
1327
1483
  askAgent: triggerAgentRuntime.askAuthor,
1328
1484
  // M2.2: reports go through the daemon's persona agent (system prompt, pinned model,
1329
1485
  // session lanes) instead of the bare CLI - report tone comes from generation inputs.
@@ -1358,11 +1514,11 @@ async function runAgentLoop(config, options = {}) {
1358
1514
  channel_id: 'report',
1359
1515
  trigger_context: { user_text: '<operator scheduled report>' },
1360
1516
  scope: {
1361
- // Reads: enabled non-Trello raw connectors (kagemusha_* gathers) + memory scopes.
1362
- // Trello is reserved for verified owner-console plus host-issued board and
1363
- // temporal workorder envelopes.
1364
- // covering mama_recall/mama_save. allowed_destinations stays [] - NO new
1365
- // send surface (constraint 2).
1517
+ // Reads: enabled raw connectors (kagemusha_* gathers plus the live board
1518
+ // cross-check) + memory scopes covering mama_recall/mama_save.
1519
+ // allowed_destinations stays [] - NO send surface. That bounds SENDS only;
1520
+ // read authority is bounded per tool by envelope/tool-connector-scope.ts
1521
+ // against the connectors granted here.
1366
1522
  project_refs: [{ kind: 'project', id: projectId }],
1367
1523
  raw_connectors: scopeDaemonRawConnectors(codeActRawConnectors, 'operator-report'),
1368
1524
  memory_scopes: resolveCodeActMemoryScopes((0, scope_context_js_1.deriveMemoryScopes)({ source: 'operator', channelId: 'report', projectId }), getAdapter()),
@@ -1393,10 +1549,23 @@ async function runAgentLoop(config, options = {}) {
1393
1549
  freshSession: true,
1394
1550
  ...(envelope ? { envelope } : {}),
1395
1551
  });
1396
- return { response: result.response, history: result.history };
1552
+ return {
1553
+ response: result.response,
1554
+ history: result.history,
1555
+ // Dropped here until now: the loop already resolves a run handle, and
1556
+ // discarding it meant a delivered report could not be traced to the run
1557
+ // that wrote it.
1558
+ modelRunId: result.modelRunId,
1559
+ ...(result.modelRunProvenance === undefined
1560
+ ? {}
1561
+ : { modelRunProvenance: result.modelRunProvenance }),
1562
+ };
1397
1563
  },
1398
1564
  log: (line) => console.log(line),
1399
1565
  fullReportTag: OPERATOR_FULL_REPORT_TAG,
1566
+ onRunProvenance: (provenance) => {
1567
+ lastReportProvenance = provenance;
1568
+ },
1400
1569
  }),
1401
1570
  review: (trigger, context) => reviewTriggerCLI(trigger, context, triggerAgentRuntime.askReview),
1402
1571
  output: reportOutput,
@@ -1404,21 +1573,13 @@ async function runAgentLoop(config, options = {}) {
1404
1573
  // M2.3: the scheduled full report self-gathers via the persona agent's gateway tools
1405
1574
  // (the Kagemusha lesson: a reporter with tools has substance; a window summary alone
1406
1575
  // reports "quiet" whenever polling is between batches).
1407
- fullReportSelfGather: ({ lastSuccessIso }) => [
1408
- 'kagemusha_overview() for room/task/message counts',
1409
- 'kagemusha_tasks({}) for the open task board, plus kagemusha_tasks({ status: "review" }) for items awaiting review (status values must be real board statuses like pending/in_progress/review - invented labels match nothing)',
1410
- lastSuccessIso
1411
- ? `kagemusha_entities({ activeOnly: true }) for active channels, then kagemusha_messages({ channelId, since: "${lastSuccessIso}" }) on the busiest 2-3 - since is the last successful report; do NOT widen it`
1412
- : 'kagemusha_entities({ activeOnly: true }) for active channels, then kagemusha_messages({ channelId }) on the busiest 2-3 (since defaults to the last 7 days; pass an ISO-8601 timestamp like since: "2026-07-09T00:00:00Z" to narrow it - never a phrase like "24h ago")',
1413
- 'mama_recall(query) for memory relevant to what you find',
1414
- 'schedule_upcoming({ days: 14 }) for upcoming calendar events -- cross-check task deadlines against them',
1415
- ],
1576
+ fullReportSelfGather: buildFullReportGatherLines,
1416
1577
  // Kagemusha dual output: the same scheduled run updates the /ui operator board
1417
1578
  // slots via report_publish, then writes the plain-text owner report.
1418
1579
  fullReportBoardLines: buildBoardPublishLines(),
1419
1580
  // S1-T4 context carry: the delivered FULL report persists so the owner
1420
1581
  // console references it per turn instead of fabricating status.
1421
- persistLastFullReport: (iso, text) => persistLastFullReport(iso, text),
1582
+ persistLastFullReport: (iso, text) => persistLastFullReport(iso, text, lastReportProvenance),
1422
1583
  pendingReportStore: new FilePendingReportStore((0, config_manager_js_1.expandPath)('~/.mama/operator/pending-owner-reports.json'), (line) => console.error(line)),
1423
1584
  config: {
1424
1585
  tickMs: Number(process.env.MAMA_TRIGGER_LOOP_TICK_MS || 60_000),
@@ -1474,7 +1635,7 @@ async function runAgentLoop(config, options = {}) {
1474
1635
  envelopeAuthority: envelopeBootstrap.envelopeAuthority,
1475
1636
  contextCompileService,
1476
1637
  });
1477
- channelDeltaSink.current = (channelKey, lines) => eventBus.emit({ type: 'operator:channel-delta', channelKey, lines });
1638
+ channelDeltaSink.current = (channelKey, lines, eventIds) => eventBus.emit({ type: 'operator:channel-delta', channelKey, lines, eventIds });
1478
1639
  await (0, api_routes_init_js_1.registerApiRoutes)({
1479
1640
  config,
1480
1641
  apiServer,