@rubytech/create-maxy-code 0.1.497 → 0.1.499

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 (223) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/lib/active-rules/dist/index.d.ts +3 -7
  3. package/payload/platform/lib/active-rules/dist/index.d.ts.map +1 -1
  4. package/payload/platform/lib/active-rules/dist/index.js +20 -52
  5. package/payload/platform/lib/active-rules/dist/index.js.map +1 -1
  6. package/payload/platform/lib/active-rules/src/index.test.ts +35 -69
  7. package/payload/platform/lib/active-rules/src/index.ts +17 -58
  8. package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +55 -9
  9. package/payload/platform/plugins/docs/references/admin-ui.md +36 -6
  10. package/payload/platform/plugins/docs/references/internals.md +2 -2
  11. package/payload/platform/plugins/docs/references/sweep-guide.md +16 -0
  12. package/payload/platform/plugins/email/mcp/dist/__tests__/compose-signature.test.d.ts +2 -0
  13. package/payload/platform/plugins/email/mcp/dist/__tests__/compose-signature.test.d.ts.map +1 -0
  14. package/payload/platform/plugins/email/mcp/dist/__tests__/compose-signature.test.js +53 -0
  15. package/payload/platform/plugins/email/mcp/dist/__tests__/compose-signature.test.js.map +1 -0
  16. package/payload/platform/plugins/email/mcp/dist/__tests__/signature.test.d.ts +2 -0
  17. package/payload/platform/plugins/email/mcp/dist/__tests__/signature.test.d.ts.map +1 -0
  18. package/payload/platform/plugins/email/mcp/dist/__tests__/signature.test.js +50 -0
  19. package/payload/platform/plugins/email/mcp/dist/__tests__/signature.test.js.map +1 -0
  20. package/payload/platform/plugins/email/mcp/dist/lib/compose.d.ts.map +1 -1
  21. package/payload/platform/plugins/email/mcp/dist/lib/compose.js +15 -2
  22. package/payload/platform/plugins/email/mcp/dist/lib/compose.js.map +1 -1
  23. package/payload/platform/plugins/email/mcp/dist/lib/signature.d.ts +29 -0
  24. package/payload/platform/plugins/email/mcp/dist/lib/signature.d.ts.map +1 -0
  25. package/payload/platform/plugins/email/mcp/dist/lib/signature.js +55 -0
  26. package/payload/platform/plugins/email/mcp/dist/lib/signature.js.map +1 -0
  27. package/payload/platform/plugins/email/references/email-reference.md +10 -0
  28. package/payload/platform/plugins/memory/PLUGIN.md +2 -0
  29. package/payload/platform/plugins/memory/mcp/dist/index.js +2 -2
  30. package/payload/platform/plugins/memory/mcp/dist/index.js.map +1 -1
  31. package/payload/platform/plugins/memory/mcp/dist/scripts/__tests__/dream-cycle-sweep-decision.test.d.ts +2 -0
  32. package/payload/platform/plugins/memory/mcp/dist/scripts/__tests__/dream-cycle-sweep-decision.test.d.ts.map +1 -0
  33. package/payload/platform/plugins/memory/mcp/dist/scripts/__tests__/dream-cycle-sweep-decision.test.js +84 -0
  34. package/payload/platform/plugins/memory/mcp/dist/scripts/__tests__/dream-cycle-sweep-decision.test.js.map +1 -0
  35. package/payload/platform/plugins/memory/mcp/dist/scripts/dream-cycle-sweep-decision.d.ts +54 -0
  36. package/payload/platform/plugins/memory/mcp/dist/scripts/dream-cycle-sweep-decision.d.ts.map +1 -0
  37. package/payload/platform/plugins/memory/mcp/dist/scripts/dream-cycle-sweep-decision.js +58 -0
  38. package/payload/platform/plugins/memory/mcp/dist/scripts/dream-cycle-sweep-decision.js.map +1 -0
  39. package/payload/platform/plugins/memory/mcp/dist/scripts/dream-cycle-sweep.d.ts +30 -0
  40. package/payload/platform/plugins/memory/mcp/dist/scripts/dream-cycle-sweep.d.ts.map +1 -0
  41. package/payload/platform/plugins/memory/mcp/dist/scripts/dream-cycle-sweep.js +204 -0
  42. package/payload/platform/plugins/memory/mcp/dist/scripts/dream-cycle-sweep.js.map +1 -0
  43. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-derive-insights.test.js +30 -0
  44. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-derive-insights.test.js.map +1 -1
  45. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-read-active-rules.test.js +10 -9
  46. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-read-active-rules.test.js.map +1 -1
  47. package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.d.ts +4 -2
  48. package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.d.ts.map +1 -1
  49. package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.js +38 -0
  50. package/payload/platform/plugins/memory/mcp/dist/tools/conversation-archive-derive-insights.js.map +1 -1
  51. package/payload/platform/plugins/memory/mcp/vitest.config.ts +2 -0
  52. package/payload/platform/plugins/memory/skills/conversation-archive-enrich/SKILL.md +10 -4
  53. package/payload/platform/plugins/memory/skills/conversational-memory/SKILL.md +2 -0
  54. package/payload/platform/plugins/memory/skills/preference-audit/SKILL.md +16 -0
  55. package/payload/platform/plugins/sweep/PLUGIN.md +5 -1
  56. package/payload/platform/plugins/sweep/skills/email-graph-sweep/SKILL.md +165 -0
  57. package/payload/platform/services/claude-session-manager/dist/preference-reconciliation-audit.d.ts +19 -19
  58. package/payload/platform/services/claude-session-manager/dist/preference-reconciliation-audit.d.ts.map +1 -1
  59. package/payload/platform/services/claude-session-manager/dist/preference-reconciliation-audit.js +28 -34
  60. package/payload/platform/services/claude-session-manager/dist/preference-reconciliation-audit.js.map +1 -1
  61. package/payload/server/package.json +2 -1
  62. package/payload/server/public/activity.html +6 -6
  63. package/payload/server/public/assets/{AdminLoginScreens-BXDYzNbq.js → AdminLoginScreens-Ce5aBBWF.js} +1 -1
  64. package/payload/server/public/assets/AdminShell-BFVVkWFC.js +2 -0
  65. package/payload/server/public/assets/{activity-cVe5ZnG7.js → activity-CKUYOLd2.js} +1 -1
  66. package/payload/server/public/assets/admin-BWb8me-E.js +1 -0
  67. package/payload/server/public/assets/{arc-BrHWN2Kr.js → arc-CpWWSum8.js} +1 -1
  68. package/payload/server/public/assets/architecture-YZFGNWBL-D-AX2VuA.js +1 -0
  69. package/payload/server/public/assets/{architectureDiagram-Q4EWVU46-1OxSL3rT.js → architectureDiagram-Q4EWVU46-D2EzaII0.js} +1 -1
  70. package/payload/server/public/assets/{blockDiagram-DXYQGD6D-C6yKiblF.js → blockDiagram-DXYQGD6D-8kDpaNSZ.js} +1 -1
  71. package/payload/server/public/assets/{bot-Bb8yj02k.js → bot-DESMpxSQ.js} +1 -1
  72. package/payload/server/public/assets/{browser-BdWeCfYJ.js → browser-CpLq_DIo.js} +1 -1
  73. package/payload/server/public/assets/{c4Diagram-AHTNJAMY-BzTyHS1I.js → c4Diagram-AHTNJAMY-CbwmZpK3.js} +1 -1
  74. package/payload/server/public/assets/{calendar-B4KbpiXR.js → calendar-ClOwyuz-.js} +1 -1
  75. package/payload/server/public/assets/channel-DZ5sh6YQ.js +1 -0
  76. package/payload/server/public/assets/chat-MvnxPJZ5.js +1 -0
  77. package/payload/server/public/assets/chevron-left-BzIg4in6.js +1 -0
  78. package/payload/server/public/assets/chevron-right-BcFSa9C3.js +1 -0
  79. package/payload/server/public/assets/{chunk-2KRD3SAO-BGAUfWvM.js → chunk-2KRD3SAO-PFheZ9mw.js} +1 -1
  80. package/payload/server/public/assets/{chunk-336JU56O-M1H_u2Qv.js → chunk-336JU56O-CCFOp5VK.js} +2 -2
  81. package/payload/server/public/assets/chunk-426QAEUC-CcjBLp4a.js +1 -0
  82. package/payload/server/public/assets/{chunk-4BX2VUAB-CkxXXCiF.js → chunk-4BX2VUAB-Hz4JWOf2.js} +1 -1
  83. package/payload/server/public/assets/{chunk-4TB4RGXK-DPWZYGHH.js → chunk-4TB4RGXK-4xeV0s85.js} +1 -1
  84. package/payload/server/public/assets/{chunk-55IACEB6-CBkNmqrt.js → chunk-55IACEB6-4QKgBpoh.js} +1 -1
  85. package/payload/server/public/assets/{chunk-5FUZZQ4R-uIqIu9ha.js → chunk-5FUZZQ4R-ms3K6Z5z.js} +1 -1
  86. package/payload/server/public/assets/{chunk-5PVQY5BW-B_S7XzpE.js → chunk-5PVQY5BW-CIC4GIGi.js} +1 -1
  87. package/payload/server/public/assets/{chunk-67CJDMHE-BbMV1lgW.js → chunk-67CJDMHE-B-XrWVmV.js} +1 -1
  88. package/payload/server/public/assets/{chunk-7N4EOEYR-C49Mv-nQ.js → chunk-7N4EOEYR-C7ECOUYQ.js} +1 -1
  89. package/payload/server/public/assets/{chunk-AA7GKIK3-Dy_pJOp_.js → chunk-AA7GKIK3-DOZ6Fxwk.js} +1 -1
  90. package/payload/server/public/assets/{chunk-BSJP7CBP-Ce-OmPqn.js → chunk-BSJP7CBP-4cJ_b0c6.js} +1 -1
  91. package/payload/server/public/assets/{chunk-CIAEETIT-tnjq-APC.js → chunk-CIAEETIT--mhZipWM.js} +1 -1
  92. package/payload/server/public/assets/{chunk-EDXVE4YY-uzO7kO4e.js → chunk-EDXVE4YY-jZpVwob_.js} +1 -1
  93. package/payload/server/public/assets/{chunk-ENJZ2VHE-DQMOsG1f.js → chunk-ENJZ2VHE-Nn-p-xIA.js} +1 -1
  94. package/payload/server/public/assets/{chunk-FMBD7UC4-Top6y08S.js → chunk-FMBD7UC4-DyNpcKOS.js} +1 -1
  95. package/payload/server/public/assets/{chunk-FOC6F5B3-B9LPNCUS.js → chunk-FOC6F5B3-C0P8q1uz.js} +1 -1
  96. package/payload/server/public/assets/{chunk-ICPOFSXX-DeIt3WoY.js → chunk-ICPOFSXX-CdXQ5SfI.js} +2 -2
  97. package/payload/server/public/assets/{chunk-K5T4RW27-DAnRM04h.js → chunk-K5T4RW27-BVZJKKsT.js} +1 -1
  98. package/payload/server/public/assets/{chunk-KGLVRYIC-C0QYcbLe.js → chunk-KGLVRYIC-QlVWTe0V.js} +1 -1
  99. package/payload/server/public/assets/{chunk-LIHQZDEY-BjvA5ykt.js → chunk-LIHQZDEY-CpGVZutP.js} +1 -1
  100. package/payload/server/public/assets/{chunk-ORNJ4GCN-Cs46Gj7z.js → chunk-ORNJ4GCN-WVcS6fUC.js} +1 -1
  101. package/payload/server/public/assets/{chunk-OYMX7WX6-CBHIFMBx.js → chunk-OYMX7WX6-B7hiSTed.js} +1 -1
  102. package/payload/server/public/assets/chunk-QZHKN3VN-B2WjDYBE.js +1 -0
  103. package/payload/server/public/assets/{chunk-U2HBQHQK-5_DL8yx6.js → chunk-U2HBQHQK-DJPnZxGy.js} +1 -1
  104. package/payload/server/public/assets/{chunk-X2U36JSP-BDCaWRe9.js → chunk-X2U36JSP-DilBs1Yc.js} +1 -1
  105. package/payload/server/public/assets/{chunk-XPW4576I-B10QuxYb.js → chunk-XPW4576I-B5-uyrJ0.js} +1 -1
  106. package/payload/server/public/assets/{chunk-YZCP3GAM-81jJqyDd.js → chunk-YZCP3GAM-BNO4z0Mv.js} +1 -1
  107. package/payload/server/public/assets/{chunk-ZZ45TVLE-DGx3J6Dx.js → chunk-ZZ45TVLE-BzHMQpip.js} +1 -1
  108. package/payload/server/public/assets/classDiagram-6PBFFD2Q-CT3jNrze.js +1 -0
  109. package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-DJRsjAkC.js +1 -0
  110. package/payload/server/public/assets/clock-Dr3NGtjR.js +1 -0
  111. package/payload/server/public/assets/clone-FcEDnoMT.js +1 -0
  112. package/payload/server/public/assets/{cose-bilkent-S5V4N54A-CRDvLRXs.js → cose-bilkent-S5V4N54A-3DWYmn1o.js} +1 -1
  113. package/payload/server/public/assets/{dagre--rdjN6xZ.js → dagre-Cpy31xJW.js} +1 -1
  114. package/payload/server/public/assets/{dagre-KV5264BT-DHbVQPnV.js → dagre-KV5264BT-C8fyxHFd.js} +1 -1
  115. package/payload/server/public/assets/data-BjqC4hyM.js +1 -0
  116. package/payload/server/public/assets/{diagram-5BDNPKRD-D8HC1Idg.js → diagram-5BDNPKRD-ycyhnLvr.js} +1 -1
  117. package/payload/server/public/assets/{diagram-G4DWMVQ6-evvg8aey.js → diagram-G4DWMVQ6-BkeYicIt.js} +1 -1
  118. package/payload/server/public/assets/{diagram-MMDJMWI5-4hZuk-Dd.js → diagram-MMDJMWI5-BcGZU-Q3.js} +1 -1
  119. package/payload/server/public/assets/{diagram-TYMM5635-Cwei1ql9.js → diagram-TYMM5635-DuBDCFb_.js} +1 -1
  120. package/payload/server/public/assets/{dist-B2N0v8hZ.js → dist-BYc_arNy.js} +1 -1
  121. package/payload/server/public/assets/{erDiagram-SMLLAGMA-BG5OK4Fx.js → erDiagram-SMLLAGMA-DmkeOzvp.js} +1 -1
  122. package/payload/server/public/assets/{flatten-naJ5PJ4f.js → flatten-QjnJ1Gcl.js} +1 -1
  123. package/payload/server/public/assets/{flowDiagram-DWJPFMVM-CPB_poda.js → flowDiagram-DWJPFMVM-CkE-pjuB.js} +1 -1
  124. package/payload/server/public/assets/{ganttDiagram-T4ZO3ILL-CD6BL1UP.js → ganttDiagram-T4ZO3ILL-Cjiy3kvE.js} +1 -1
  125. package/payload/server/public/assets/gitGraph-7Q5UKJZL-D1uhnP9U.js +1 -0
  126. package/payload/server/public/assets/{gitGraphDiagram-UUTBAWPF-C-e8FDGn.js → gitGraphDiagram-UUTBAWPF-CsI4lKZm.js} +1 -1
  127. package/payload/server/public/assets/{graph-COyGp2x1.js → graph-B7niLM97.js} +3 -3
  128. package/payload/server/public/assets/{graph-labels-CR-HqNdV.js → graph-labels-DykmXYHA.js} +1 -1
  129. package/payload/server/public/assets/{graphlib-CdCZY1Mj.js → graphlib-BkXxC6D5.js} +1 -1
  130. package/payload/server/public/assets/info-OMHHGYJF-oNm27GAV.js +1 -0
  131. package/payload/server/public/assets/infoDiagram-42DDH7IO-LxTftqyS.js +2 -0
  132. package/payload/server/public/assets/{isEmpty-Bnpg7b8f.js → isEmpty-BavJI9Cn.js} +1 -1
  133. package/payload/server/public/assets/{ishikawaDiagram-UXIWVN3A-CFLhfPpo.js → ishikawaDiagram-UXIWVN3A-D8lZtjRc.js} +1 -1
  134. package/payload/server/public/assets/{journeyDiagram-VCZTEJTY-BN0PaMgT.js → journeyDiagram-VCZTEJTY-kLE7SiR_.js} +1 -1
  135. package/payload/server/public/assets/{kanban-definition-6JOO6SKY-CmRilACp.js → kanban-definition-6JOO6SKY-ove6JuD3.js} +1 -1
  136. package/payload/server/public/assets/{line-DR6Zk7d6.js → line-CZMSoxM6.js} +1 -1
  137. package/payload/server/public/assets/{linear-CAOWPodQ.js → linear-Be8IK9hK.js} +1 -1
  138. package/payload/server/public/assets/{maximize-2-ne1kaQlS.js → maximize-2-BbzPm7o8.js} +1 -1
  139. package/payload/server/public/assets/{mermaid-parser.core-0vmQl6Gn.js → mermaid-parser.core-BBADqbnp.js} +2 -2
  140. package/payload/server/public/assets/{mermaid.core-DWgpHiLh.js → mermaid.core-mH3N7K0I.js} +3 -3
  141. package/payload/server/public/assets/{mindmap-definition-QFDTVHPH-CViR7VGV.js → mindmap-definition-QFDTVHPH-BjwwwWil.js} +1 -1
  142. package/payload/server/public/assets/operator-DCNWUKP_.js +1 -0
  143. package/payload/server/public/assets/{ordinal-Wx4m9zHk.js → ordinal-BHeIKG-K.js} +1 -1
  144. package/payload/server/public/assets/packet-4T2RLAQJ-eQNVGiK3.js +1 -0
  145. package/payload/server/public/assets/{page-DwfYACyC.js → page-C4TrTU6r.js} +4 -4
  146. package/payload/server/public/assets/page-DUgrGrJp.js +1 -0
  147. package/payload/server/public/assets/{pdf-render-0hyh3Jlf.js → pdf-render-fJz4vym9.js} +1 -1
  148. package/payload/server/public/assets/pie-ZZUOXDRM-E1u-48rt.js +1 -0
  149. package/payload/server/public/assets/{pieDiagram-DEJITSTG-B7YQ1_Kr.js → pieDiagram-DEJITSTG-D-lXWWta.js} +1 -1
  150. package/payload/server/public/assets/{public-BACeh5xm.js → public-DXJXQPwe.js} +1 -1
  151. package/payload/server/public/assets/{quadrantDiagram-34T5L4WZ-Dxs0nGu5.js → quadrantDiagram-34T5L4WZ-13QyG_AO.js} +1 -1
  152. package/payload/server/public/assets/radar-PYXPWWZC-Cn2cGN90.js +1 -0
  153. package/payload/server/public/assets/{reduce-BUmc8RDR.js → reduce-Fm685to3.js} +1 -1
  154. package/payload/server/public/assets/{requirementDiagram-MS252O5E-DDNYDqZc.js → requirementDiagram-MS252O5E-Bx45Bgn4.js} +1 -1
  155. package/payload/server/public/assets/{rotate-ccw-tY4mfSrJ.js → rotate-ccw-L42fL8ey.js} +1 -1
  156. package/payload/server/public/assets/routines-JOV6xdYh.js +1 -0
  157. package/payload/server/public/assets/{sankeyDiagram-XADWPNL6-DLWoegU5.js → sankeyDiagram-XADWPNL6-Cj-Gq25v.js} +1 -1
  158. package/payload/server/public/assets/{sequenceDiagram-FGHM5R23-DINNPlTY.js → sequenceDiagram-FGHM5R23-B8RDRq93.js} +1 -1
  159. package/payload/server/public/assets/{src-DHSQDYx-.js → src-D3VYuW_Z.js} +1 -1
  160. package/payload/server/public/assets/{stateDiagram-FHFEXIEX-Dsan8EIl.js → stateDiagram-FHFEXIEX-DoyFF1Kl.js} +1 -1
  161. package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-Bml-X4-H.js +1 -0
  162. package/payload/server/public/assets/{tasks-C4nPXsbX.js → tasks-GNtvZL8F.js} +1 -1
  163. package/payload/server/public/assets/{time-entry-format-CmqjpGG2.js → time-entry-format-BreNpFLJ.js} +1 -1
  164. package/payload/server/public/assets/{timeline-definition-GMOUNBTQ-CISzecz5.js → timeline-definition-GMOUNBTQ-Df4RQXm6.js} +1 -1
  165. package/payload/server/public/assets/treeView-SZITEDCU-CimabhXy.js +1 -0
  166. package/payload/server/public/assets/treemap-W4RFUUIX-Cg264rpM.js +1 -0
  167. package/payload/server/public/assets/{triangle-alert-DKZ69dOa.js → triangle-alert-DumCWC08.js} +1 -1
  168. package/payload/server/public/assets/{useCopyFeedback-Cf5jFDR5.js → useCopyFeedback-DHCtz8qX.js} +1 -1
  169. package/payload/server/public/assets/useSubAccountSwitcher-Bc7XHr0L.js +9 -0
  170. package/payload/server/public/assets/{useSubAccountSwitcher-DFnDNIDO.css → useSubAccountSwitcher-DPHQJO7E.css} +1 -1
  171. package/payload/server/public/assets/{useVoiceRecorder-BVdKbTku.js → useVoiceRecorder-Cu6zvuFx.js} +2 -2
  172. package/payload/server/public/assets/{vennDiagram-DHZGUBPP-Bh2s76nJ.js → vennDiagram-DHZGUBPP-D2o5og9l.js} +1 -1
  173. package/payload/server/public/assets/wardley-RL74JXVD-tbgfCg0E.js +1 -0
  174. package/payload/server/public/assets/{wardleyDiagram-NUSXRM2D-Grzw0FHg.js → wardleyDiagram-NUSXRM2D-BDueObbS.js} +1 -1
  175. package/payload/server/public/assets/wrench-iWkROE1V.js +1 -0
  176. package/payload/server/public/assets/{xychartDiagram-5P7HB3ND-7pY90HjH.js → xychartDiagram-5P7HB3ND-BTYs4Fgh.js} +1 -1
  177. package/payload/server/public/browser.html +5 -5
  178. package/payload/server/public/calendar.html +8 -7
  179. package/payload/server/public/chat.html +15 -14
  180. package/payload/server/public/data.html +12 -12
  181. package/payload/server/public/graph.html +10 -10
  182. package/payload/server/public/index.html +16 -16
  183. package/payload/server/public/operator.html +16 -15
  184. package/payload/server/public/public.html +15 -14
  185. package/payload/server/public/routines.html +20 -0
  186. package/payload/server/public/tasks.html +7 -7
  187. package/payload/server/server.js +464 -260
  188. package/payload/server/public/assets/AdminShell-CiTHCp5t.js +0 -2
  189. package/payload/server/public/assets/admin-BbcLizN0.js +0 -1
  190. package/payload/server/public/assets/architecture-YZFGNWBL-CZQzGRSM.js +0 -1
  191. package/payload/server/public/assets/channel-uhtvXKHn.js +0 -1
  192. package/payload/server/public/assets/chat-BEcbZB3e.js +0 -1
  193. package/payload/server/public/assets/chevron-left-Cy_RXwhn.js +0 -1
  194. package/payload/server/public/assets/chevron-right-CEjdB4AT.js +0 -1
  195. package/payload/server/public/assets/chunk-426QAEUC-D4XtWgLR.js +0 -1
  196. package/payload/server/public/assets/chunk-QZHKN3VN-Qlc2PFAj.js +0 -1
  197. package/payload/server/public/assets/classDiagram-6PBFFD2Q-CBH5ngSm.js +0 -1
  198. package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-Ck3eNZce.js +0 -1
  199. package/payload/server/public/assets/clone-Cv8evfNb.js +0 -1
  200. package/payload/server/public/assets/data-L-hMHLBN.js +0 -1
  201. package/payload/server/public/assets/gitGraph-7Q5UKJZL-CBZPQJLj.js +0 -1
  202. package/payload/server/public/assets/info-OMHHGYJF-1vIoX-kP.js +0 -1
  203. package/payload/server/public/assets/infoDiagram-42DDH7IO-BDInZV9G.js +0 -2
  204. package/payload/server/public/assets/operator-Q0F_EEyq.js +0 -1
  205. package/payload/server/public/assets/packet-4T2RLAQJ-CTU0gCGb.js +0 -1
  206. package/payload/server/public/assets/page-bRjlk8Dt.js +0 -1
  207. package/payload/server/public/assets/pie-ZZUOXDRM-D-EEHxhC.js +0 -1
  208. package/payload/server/public/assets/radar-PYXPWWZC-DHXATZGB.js +0 -1
  209. package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-B4yeYYgL.js +0 -1
  210. package/payload/server/public/assets/treeView-SZITEDCU-CC7ouMFd.js +0 -1
  211. package/payload/server/public/assets/treemap-W4RFUUIX-CaCg27im.js +0 -1
  212. package/payload/server/public/assets/useSubAccountSwitcher-DdctgpPL.js +0 -9
  213. package/payload/server/public/assets/wardley-RL74JXVD-bMPsqQZ7.js +0 -1
  214. /package/payload/server/public/assets/{_baseFor-k8hYPe-U.js → _baseFor-Bvwvhrz4.js} +0 -0
  215. /package/payload/server/public/assets/{array-BFDiaBgf.js → array-D3d-WgFW.js} +0 -0
  216. /package/payload/server/public/assets/{chunk-TPjIAO9U.js → chunk-fQC6bEKA.js} +0 -0
  217. /package/payload/server/public/assets/{cytoscape.esm-Ch0xptA4.js → cytoscape.esm-Cun-OM6a.js} +0 -0
  218. /package/payload/server/public/assets/{defaultLocale-ZeknFqNe.js → defaultLocale-CisKV5Ew.js} +0 -0
  219. /package/payload/server/public/assets/{init-0VJVrkRJ.js → init-D9ZOVaZ3.js} +0 -0
  220. /package/payload/server/public/assets/{katex-Br7bH10N.js → katex-C-3ZDK8o.js} +0 -0
  221. /package/payload/server/public/assets/{path-INs8XTPH.js → path-BMOgQSLM.js} +0 -0
  222. /package/payload/server/public/assets/{preload-helper-CH6UZRzu.js → preload-helper-DL2DwvxV.js} +0 -0
  223. /package/payload/server/public/assets/{rough.esm-DU9bZLvZ.js → rough.esm-BrTFrov0.js} +0 -0
@@ -144,47 +144,18 @@ var require_dist = __commonJS({
144
144
  "../lib/active-rules/dist/index.js"(exports) {
145
145
  "use strict";
146
146
  Object.defineProperty(exports, "__esModule", { value: true });
147
- exports.ACTIVE_CANDIDATE_LIMIT = exports.ACTIVE_CANDIDATE_FLOOR = exports.INJECTION_RULE_CAP = exports.SAME_SUBJECT_COSINE = void 0;
148
- exports.cosine = cosine;
149
- exports.deconflictBySubject = deconflictBySubject;
147
+ exports.ACTIVE_CANDIDATE_FLOOR = exports.SAME_SUBJECT_COSINE = void 0;
150
148
  exports.formatStandingRulesBlock = formatStandingRulesBlock2;
151
149
  exports.resolveOwnerUserId = resolveOwnerUserId2;
152
150
  exports.queryActiveRuleCandidates = queryActiveRuleCandidates;
153
151
  exports.resolveActiveRules = resolveActiveRules2;
154
152
  exports.activeRuleSet = activeRuleSet;
155
153
  exports.SAME_SUBJECT_COSINE = 0.85;
156
- exports.INJECTION_RULE_CAP = 12;
157
154
  exports.ACTIVE_CANDIDATE_FLOOR = 0.4;
158
- exports.ACTIVE_CANDIDATE_LIMIT = 30;
159
- function cosine(a, b) {
160
- if (!a.length || !b.length || a.length !== b.length)
161
- return 0;
162
- let dot = 0;
163
- let na = 0;
164
- let nb = 0;
165
- for (let i = 0; i < a.length; i++) {
166
- dot += a[i] * b[i];
167
- na += a[i] * a[i];
168
- nb += b[i] * b[i];
169
- }
170
- if (na === 0 || nb === 0)
171
- return 0;
172
- return dot / (Math.sqrt(na) * Math.sqrt(nb));
173
- }
174
- function deconflictBySubject(records, cosineThreshold = exports.SAME_SUBJECT_COSINE) {
175
- const winners = [];
176
- for (const r of records) {
177
- const emb = r.embedding;
178
- const isDup = Array.isArray(emb) && emb.length > 0 && winners.some((w) => Array.isArray(w.embedding) && w.embedding.length > 0 && cosine(emb, w.embedding) >= cosineThreshold);
179
- if (!isDup)
180
- winners.push(r);
181
- }
182
- return winners.map(({ embedding: _embedding, ...rest }) => rest);
183
- }
184
- function formatStandingRulesBlock2(rules, cap = exports.INJECTION_RULE_CAP) {
155
+ function formatStandingRulesBlock2(rules) {
185
156
  if (rules.length === 0)
186
157
  return "";
187
- const lines = rules.slice(0, cap).map((r) => `- ${r.value}`);
158
+ const lines = rules.map((r) => `- ${r.value}`);
188
159
  return `## Standing rules
189
160
  ${lines.join("\n")}`;
190
161
  }
@@ -209,7 +180,6 @@ ${lines.join("\n")}`;
209
180
  pref.key AS key, pref.value AS value, pref.confidence AS confidence,
210
181
  pref.observedAt AS observedAt, pref.embedding AS embedding
211
182
  ORDER BY pref.confidence DESC, pref.observedAt DESC
212
- LIMIT ${exports.ACTIVE_CANDIDATE_LIMIT}
213
183
  `, { accountId, ownerUserId, floor: exports.ACTIVE_CANDIDATE_FLOOR });
214
184
  return result.records.map((r) => ({
215
185
  preferenceId: r.get("preferenceId"),
@@ -236,12 +206,13 @@ ${lines.join("\n")}`;
236
206
  async function queryActiveRuleCandidates(session, accountId) {
237
207
  return (await resolveCandidates(session, accountId)).candidates;
238
208
  }
239
- async function resolveActiveRules2(session, accountId, cap = exports.INJECTION_RULE_CAP) {
209
+ async function resolveActiveRules2(session, accountId) {
240
210
  const { candidates, ownerUserId, source } = await resolveCandidates(session, accountId);
241
- return { rules: deconflictBySubject(candidates).slice(0, cap), ownerUserId, source };
211
+ const rules = candidates.map(({ embedding: _embedding, ...rest }) => rest);
212
+ return { rules, ownerUserId, source };
242
213
  }
243
- async function activeRuleSet(session, accountId, cap = exports.INJECTION_RULE_CAP) {
244
- return (await resolveActiveRules2(session, accountId, cap)).rules;
214
+ async function activeRuleSet(session, accountId) {
215
+ return (await resolveActiveRules2(session, accountId)).rules;
245
216
  }
246
217
  }
247
218
  });
@@ -7176,8 +7147,8 @@ function webchatTurnTimeoutMs() {
7176
7147
  return Number(process.env.WEBCHAT_TURN_TIMEOUT_MS ?? String(2 * 6e4));
7177
7148
  }
7178
7149
  function createChatRoutes(deps) {
7179
- const app65 = new Hono();
7180
- app65.post("/", async (c) => {
7150
+ const app66 = new Hono();
7151
+ app66.post("/", async (c) => {
7181
7152
  console.log(`[chat-route] entered route=public method=POST`);
7182
7153
  const contentType = c.req.header("content-type") ?? "";
7183
7154
  const account = resolveAccount();
@@ -7441,7 +7412,7 @@ ${result.result.text}` : result.result.text;
7441
7412
  }
7442
7413
  });
7443
7414
  });
7444
- return app65;
7415
+ return app66;
7445
7416
  }
7446
7417
 
7447
7418
  // app/lib/channel-pty-bridge/admin-session-id.ts
@@ -7475,8 +7446,8 @@ function isLoopbackAddr(addr) {
7475
7446
  return addr === "127.0.0.1" || addr === "::1" || addr === "::ffff:127.0.0.1";
7476
7447
  }
7477
7448
  function createScheduleInjectRoutes(deps) {
7478
- const app65 = new Hono();
7479
- app65.post("/", async (c) => {
7449
+ const app66 = new Hono();
7450
+ app66.post("/", async (c) => {
7480
7451
  const env = c.env;
7481
7452
  const remoteAddr = env?.incoming?.socket?.remoteAddress ?? "";
7482
7453
  if (!isLoopbackAddr(remoteAddr)) {
@@ -7577,11 +7548,11 @@ function createScheduleInjectRoutes(deps) {
7577
7548
  console.error(`${TAG20} op=inject-spawn eventId=${eventId} sessionId=${sessionId} result=ok status=-`);
7578
7549
  return c.json({ ok: true }, 200);
7579
7550
  });
7580
- return app65;
7551
+ return app66;
7581
7552
  }
7582
7553
 
7583
7554
  // server/index.ts
7584
- var import_dist11 = __toESM(require_dist(), 1);
7555
+ var import_dist8 = __toESM(require_dist(), 1);
7585
7556
 
7586
7557
  // app/lib/whatsapp/socket-resolution-error.ts
7587
7558
  function formatPresentKeys(presentKeys) {
@@ -8774,6 +8745,23 @@ function filterConversationsForSubAccount(conversations, managerPhones) {
8774
8745
  }
8775
8746
  return out;
8776
8747
  }
8748
+ function unionThread(a, b) {
8749
+ const seen = /* @__PURE__ */ new Set();
8750
+ const merged = [];
8751
+ for (const rec of [...a, ...b]) {
8752
+ if (seen.has(rec.messageId)) continue;
8753
+ seen.add(rec.messageId);
8754
+ merged.push(rec);
8755
+ }
8756
+ return merged.sort((x, y) => Date.parse(x.dateSent) - Date.parse(y.dateSent));
8757
+ }
8758
+ function unionConversationMaps(a, b) {
8759
+ const out = /* @__PURE__ */ new Map();
8760
+ for (const jid of /* @__PURE__ */ new Set([...a.keys(), ...b.keys()])) {
8761
+ out.set(jid, unionThread(a.get(jid) ?? [], b.get(jid) ?? []));
8762
+ }
8763
+ return out;
8764
+ }
8777
8765
 
8778
8766
  // app/lib/whatsapp/authorize-recall-read.ts
8779
8767
  function authorizeRecallRead(input) {
@@ -9263,7 +9251,10 @@ app2.get("/conversations", (c) => {
9263
9251
  const projecting = projection.managerPhones != null;
9264
9252
  const managerPhonesBound = projection.managerPhones?.length ?? 0;
9265
9253
  const allConversations = readAllConversations(storeAccountId);
9266
- const scoped = projection.managerPhones ? filterConversationsForSubAccount(allConversations, projection.managerPhones) : allConversations;
9254
+ const scoped = projection.managerPhones ? unionConversationMaps(
9255
+ filterConversationsForSubAccount(allConversations, projection.managerPhones),
9256
+ readAllConversations(resolveReadStoreKey(requestedAccountId))
9257
+ ) : allConversations;
9267
9258
  const conversations = [...scoped.entries()].map(([jid, messages]) => {
9268
9259
  const last = messages.length > 0 ? messages[messages.length - 1] : null;
9269
9260
  return {
@@ -9302,12 +9293,20 @@ app2.get("/messages", (c) => {
9302
9293
  projection.managerPhones,
9303
9294
  conversationCounterpartyPhone(jid, storeMessages[0]?.senderTelephone ?? "")
9304
9295
  );
9305
- const bounded = counterpartyBound ? storeMessages : [];
9296
+ const ownStoreAccountId = projecting ? resolveReadStoreKey(requestedAccountId) : storeAccountId;
9297
+ const houseThread = counterpartyBound ? storeMessages : [];
9298
+ const ownThread = projecting ? readConversation(ownStoreAccountId, jid) : [];
9299
+ const sourceById = /* @__PURE__ */ new Map();
9300
+ for (const m of houseThread) if (!sourceById.has(m.messageId)) sourceById.set(m.messageId, storeAccountId);
9301
+ for (const m of ownThread) if (!sourceById.has(m.messageId)) sourceById.set(m.messageId, ownStoreAccountId);
9302
+ const bounded = projecting ? unionThread(houseThread, ownThread) : houseThread;
9306
9303
  const limited = effectiveLimit ? bounded.slice(-effectiveLimit) : bounded;
9307
- const threadReactions = foldReactions(readReactions(storeAccountId, jid));
9304
+ const threadReactions = foldReactions(
9305
+ projecting ? [...readReactions(storeAccountId, jid), ...readReactions(ownStoreAccountId, jid)] : readReactions(storeAccountId, jid)
9306
+ );
9308
9307
  let withAttachments = 0;
9309
9308
  const messages = limited.map((m) => {
9310
- const attachment = recallAttachment(storeAccountId, m.attachmentId);
9309
+ const attachment = recallAttachment(sourceById.get(m.messageId) ?? storeAccountId, m.attachmentId);
9311
9310
  if (attachment) withAttachments += 1;
9312
9311
  const reactions = threadReactions.get(m.msgKeyId);
9313
9312
  return {
@@ -11623,7 +11622,7 @@ function unwrapChannel(text) {
11623
11622
  }
11624
11623
  return source ? { text: inner, source } : { text: inner };
11625
11624
  }
11626
- var COMPOSED_ADMIN_FRAME = /^(?:## Standing rules\n[\s\S]*?\n\n)?## Context\n([\s\S]*)\n\n## Instruction\n[\s\S]*$/;
11625
+ var COMPOSED_ADMIN_FRAME = /^(?:## Scheduled automation \(platform-verified\)\n[\s\S]*?\n\n)?(?:## Standing rules\n[\s\S]*?\n\n)?## Context\n([\s\S]*)\n\n## Instruction\n[\s\S]*$/;
11627
11626
  var UPLOAD_ANNOTATION = /(?:\n\n)?\[The operator uploaded \d+ file\(s\): [\s\S]*\]$/;
11628
11627
  function rawFromComposedAdminFrame(text) {
11629
11628
  const context = text.match(COMPOSED_ADMIN_FRAME)?.[1];
@@ -12172,6 +12171,23 @@ function tagAndMergeInstallConversations(perAccount) {
12172
12171
  }
12173
12172
  return all.sort((x, y) => (y.lastMessageAt ?? "").localeCompare(x.lastMessageAt ?? ""));
12174
12173
  }
12174
+ function dropHouseRowsOwnedBySubAccount(rows, subManagerPhones) {
12175
+ return rows.filter((r) => {
12176
+ if (r.isHouse !== true || r.source !== "store" || r.senderId == null) return true;
12177
+ let owner = null;
12178
+ for (const [subId, phones] of subManagerPhones) {
12179
+ if (counterpartyBoundToSubAccount(phones, r.senderId)) {
12180
+ owner = subId;
12181
+ break;
12182
+ }
12183
+ }
12184
+ if (owner === null) return true;
12185
+ const subHasOwnRow = rows.some(
12186
+ (o) => o.isHouse !== true && o.accountId === owner && o.source === "store" && o.senderId != null && counterpartyBoundToSubAccount([o.senderId], r.senderId)
12187
+ );
12188
+ return !subHasOwnRow;
12189
+ });
12190
+ }
12175
12191
  app5.get("/conversations-all", requireAdminSession, async (c) => {
12176
12192
  const cacheKey = c.var.cacheKey;
12177
12193
  const caller2 = getAccountIdForSession(cacheKey) ?? null;
@@ -12245,10 +12261,21 @@ app5.get("/conversations-all", requireAdminSession, async (c) => {
12245
12261
  const storeRows = buildStoreConversationRows(account.accountId, readConversationSummaries(account.accountId));
12246
12262
  perAccount.push({ isHouse, rows: [...named, ...storeRows] });
12247
12263
  }
12248
- const conversations = tagAndMergeInstallConversations(perAccount);
12264
+ const houseAccount = validAccounts.find((a) => a.accountId === houseId) ?? null;
12265
+ const subManagerPhones = /* @__PURE__ */ new Map();
12266
+ if (houseAccount) {
12267
+ const managers = readAccountManagers(houseAccount.accountDir);
12268
+ for (const a of validAccounts) {
12269
+ if (houseIds.has(a.accountId)) continue;
12270
+ const phones = managerPhonesForAccount(managers, a.accountId);
12271
+ if (phones.length > 0) subManagerPhones.set(a.accountId, phones);
12272
+ }
12273
+ }
12274
+ const merged = tagAndMergeInstallConversations(perAccount);
12275
+ const conversations = dropHouseRowsOwnedBySubAccount(merged, subManagerPhones);
12249
12276
  const houseRows = conversations.filter((r) => r.isHouse).length;
12250
12277
  console.log(
12251
- `[wa-reader] op=conversations-all accounts=${validAccounts.length} rows=${conversations.length} house=${houseRows} sub=${conversations.length - houseRows}`
12278
+ `[wa-reader] op=conversations-all accounts=${validAccounts.length} rows=${conversations.length} house=${houseRows} sub=${conversations.length - houseRows} deduped=${merged.length - conversations.length}`
12252
12279
  );
12253
12280
  return c.json({ conversations });
12254
12281
  });
@@ -13791,8 +13818,8 @@ async function reapplyLeversViaManager() {
13791
13818
  var WEBCHAT_SEND_TURN_WINDOW_MS = Number(process.env.WEBCHAT_SEND_TURN_WINDOW_MS ?? String(15e3));
13792
13819
  var sendSeq = 0;
13793
13820
  function createWebchatRoutes(deps) {
13794
- const app65 = new Hono();
13795
- app65.post("/send", requireAdminSession, async (c) => {
13821
+ const app66 = new Hono();
13822
+ app66.post("/send", requireAdminSession, async (c) => {
13796
13823
  let accountId;
13797
13824
  try {
13798
13825
  accountId = resolvePlatformAccountId();
@@ -13995,7 +14022,7 @@ ${note}` : note;
13995
14022
  if (turnTimer.unref) turnTimer.unref();
13996
14023
  return c.json({ ok: true });
13997
14024
  });
13998
- app65.post("/interrupt", requireAdminSession, async (c) => {
14025
+ app66.post("/interrupt", requireAdminSession, async (c) => {
13999
14026
  const cacheKey = c.get("cacheKey");
14000
14027
  const requesterUserId = (cacheKey ? getUserIdForSession(cacheKey) : void 0) ?? null;
14001
14028
  const primaryUserId = resolvePrimaryAdminUserId();
@@ -14023,7 +14050,7 @@ ${note}` : note;
14023
14050
  }
14024
14051
  return c.json({ ok: true, stopped: outcome.stopped, intId: outcome.intId, deadChild: outcome.deadChild }, 200);
14025
14052
  });
14026
- app65.post("/settings", requireAdminSession, async (c) => {
14053
+ app66.post("/settings", requireAdminSession, async (c) => {
14027
14054
  const body = await c.req.json().catch(() => null);
14028
14055
  const op = body?.op;
14029
14056
  const value = body?.value;
@@ -14063,7 +14090,7 @@ ${note}` : note;
14063
14090
  console.log(`[webchat:settings] op=${op} outcome=accepted value=${value} settingsApplied=${settingsApplied}`);
14064
14091
  return c.json({ ok: true, settingsApplied });
14065
14092
  });
14066
- app65.get("/session", requireAdminSession, async (c) => {
14093
+ app66.get("/session", requireAdminSession, async (c) => {
14067
14094
  let accountId;
14068
14095
  try {
14069
14096
  accountId = resolvePlatformAccountId();
@@ -14141,7 +14168,7 @@ ${note}` : note;
14141
14168
  const indicators = await fetchComposerIndicators(sessionId);
14142
14169
  return c.json({ sessionId, projectDir, source, sizeBytes: jsonlSizeBytes(projectDir, sessionId), pendingPermissionPrompt: deps.pendingPromptFor?.(`session:${sessionId}`) ?? null, deliveryFailure: deps.deliveryFailureFor?.(`session:${sessionId}`) ?? null, ...indicators, ...readLevers(account) });
14143
14170
  });
14144
- app65.post("/permission-verdict", requireAdminSession, async (c) => {
14171
+ app66.post("/permission-verdict", requireAdminSession, async (c) => {
14145
14172
  const body = await c.req.json().catch(() => null);
14146
14173
  const sessionId = body?.sessionId;
14147
14174
  const requestId = body?.request_id;
@@ -14158,7 +14185,7 @@ ${note}` : note;
14158
14185
  const ok = deps.resolvePermissionVerdict?.(`session:${sessionId}`, requestId, behavior) ?? false;
14159
14186
  return c.json({ ok });
14160
14187
  });
14161
- return app65;
14188
+ return app66;
14162
14189
  }
14163
14190
 
14164
14191
  // server/routes/webchat-greeting.ts
@@ -23530,6 +23557,161 @@ app46.get("/booking-link", requireAdminSession, (c) => {
23530
23557
  });
23531
23558
  var calendar_default = app46;
23532
23559
 
23560
+ // server/routes/admin/routines.ts
23561
+ import cronParser from "cron-parser";
23562
+ var { parseExpression } = cronParser;
23563
+ var app47 = new Hono();
23564
+ var AUTOMATION_WHERE = "(e.recurrence IS NOT NULL OR e.agentChannel IS NOT NULL OR e.actionPlugin IS NOT NULL)";
23565
+ var ROUTINE_COLS = `e.eventId AS eventId, e.name AS name, e.eventStatus AS eventStatus,
23566
+ e.recurrence AS recurrence, e.nextRun AS nextRun, e.lastTriggered AS lastTriggered,
23567
+ e.timezone AS timezone, e.startDate AS startDate,
23568
+ e.agentChannel AS agentChannel, e.agentDestination AS agentDestination, e.agentPrompt AS agentPrompt,
23569
+ e.actionPlugin AS actionPlugin, e.actionTool AS actionTool, e.actionArgs AS actionArgs,
23570
+ e.notes AS notes, e.lastDispatchResult AS lastDispatchResult, e.lastDispatchAt AS lastDispatchAt`;
23571
+ function mapRoutine(r) {
23572
+ const g = (k) => r.get(k) ?? null;
23573
+ return {
23574
+ eventId: g("eventId"),
23575
+ name: g("name"),
23576
+ eventStatus: g("eventStatus"),
23577
+ recurrence: g("recurrence"),
23578
+ nextRun: g("nextRun"),
23579
+ lastTriggered: g("lastTriggered"),
23580
+ timezone: g("timezone"),
23581
+ startDate: g("startDate"),
23582
+ agentChannel: g("agentChannel"),
23583
+ agentDestination: g("agentDestination"),
23584
+ agentPrompt: g("agentPrompt"),
23585
+ actionPlugin: g("actionPlugin"),
23586
+ actionTool: g("actionTool"),
23587
+ actionArgs: g("actionArgs"),
23588
+ notes: g("notes"),
23589
+ lastDispatchResult: g("lastDispatchResult"),
23590
+ lastDispatchAt: g("lastDispatchAt")
23591
+ };
23592
+ }
23593
+ app47.get("/", requireAdminSession, async (c) => {
23594
+ const accountId = getAccountIdForSession(c.var.cacheKey);
23595
+ if (!accountId) {
23596
+ console.error('[admin:routines] op=list auth-rejected reason="no account for session"');
23597
+ return c.json({ error: "Account not found for session" }, 401);
23598
+ }
23599
+ const session = getSession();
23600
+ try {
23601
+ const res = await session.run(
23602
+ `MATCH (e:Event {accountId: $accountId})
23603
+ WHERE ${AUTOMATION_WHERE}
23604
+ RETURN ${ROUTINE_COLS}
23605
+ ORDER BY e.nextRun`,
23606
+ { accountId }
23607
+ );
23608
+ const routines = res.records.map(mapRoutine);
23609
+ console.log(`[admin:routines] op=list accountId=${accountId.slice(0, 8)} count=${routines.length}`);
23610
+ return c.json({ routines });
23611
+ } catch (err) {
23612
+ const message = err instanceof Error ? err.message : String(err);
23613
+ console.error(`[admin:routines] op=list-fail err="${message}"`);
23614
+ return c.json({ error: `Routines unavailable: ${message}` }, 503);
23615
+ } finally {
23616
+ await session.close();
23617
+ }
23618
+ });
23619
+ app47.get("/:eventId", requireAdminSession, async (c) => {
23620
+ const accountId = getAccountIdForSession(c.var.cacheKey);
23621
+ if (!accountId) return c.json({ error: "Account not found for session" }, 401);
23622
+ const eventId = c.req.param("eventId");
23623
+ const session = getSession();
23624
+ try {
23625
+ const res = await session.run(
23626
+ `MATCH (e:Event {eventId: $eventId, accountId: $accountId})
23627
+ WHERE ${AUTOMATION_WHERE}
23628
+ RETURN ${ROUTINE_COLS}`,
23629
+ { eventId, accountId }
23630
+ );
23631
+ const found = res.records.length > 0;
23632
+ console.log(`[admin:routines] op=get id=${eventId.slice(0, 8)} found=${found}`);
23633
+ if (!found) return c.json({ error: "Routine not found" }, 404);
23634
+ return c.json({ routine: mapRoutine(res.records[0]) });
23635
+ } catch (err) {
23636
+ const message = err instanceof Error ? err.message : String(err);
23637
+ console.error(`[admin:routines] op=get-fail id=${eventId.slice(0, 8)} err="${message}"`);
23638
+ return c.json({ error: `Routine unavailable: ${message}` }, 503);
23639
+ } finally {
23640
+ await session.close();
23641
+ }
23642
+ });
23643
+ app47.patch("/:eventId", requireAdminSession, async (c) => {
23644
+ const accountId = getAccountIdForSession(c.var.cacheKey);
23645
+ if (!accountId) return c.json({ error: "Account not found for session" }, 401);
23646
+ const eventId = c.req.param("eventId");
23647
+ const body = await c.req.json().catch(() => ({}));
23648
+ const setClauses = [];
23649
+ const params = { eventId, accountId };
23650
+ const fields = [];
23651
+ let nextRunLog = "unchanged";
23652
+ if (typeof body.agentPrompt === "string") {
23653
+ setClauses.push("e.agentPrompt = $agentPrompt");
23654
+ params.agentPrompt = body.agentPrompt;
23655
+ fields.push("agentPrompt");
23656
+ }
23657
+ if (typeof body.recurrence === "string") {
23658
+ const tzSession = getSession();
23659
+ let timezone = null;
23660
+ try {
23661
+ const tzRes = await tzSession.run(
23662
+ `MATCH (e:Event {eventId: $eventId, accountId: $accountId}) RETURN e.timezone AS timezone`,
23663
+ { eventId, accountId }
23664
+ );
23665
+ timezone = tzRes.records[0]?.get("timezone") ?? null;
23666
+ } catch (err) {
23667
+ const message = err instanceof Error ? err.message : String(err);
23668
+ console.error(`[admin:routines] op=patch id=${eventId.slice(0, 8)} outcome=rejected reason=tz-read-fail err="${message}"`);
23669
+ return c.json({ error: `Routine unavailable: ${message}` }, 503);
23670
+ } finally {
23671
+ await tzSession.close();
23672
+ }
23673
+ try {
23674
+ const interval = parseExpression(body.recurrence, { currentDate: /* @__PURE__ */ new Date(), tz: timezone ?? void 0 });
23675
+ const nextRun = interval.next().toISOString();
23676
+ setClauses.push("e.recurrence = $recurrence", "e.nextRun = $nextRun");
23677
+ params.recurrence = body.recurrence;
23678
+ params.nextRun = nextRun;
23679
+ fields.push("recurrence");
23680
+ nextRunLog = nextRun;
23681
+ } catch (err) {
23682
+ const reason = err instanceof Error ? err.message : String(err);
23683
+ console.error(`[admin:routines] op=patch id=${eventId.slice(0, 8)} outcome=rejected reason=invalid-cron cron=${body.recurrence}`);
23684
+ return c.json({ error: `Invalid recurrence: ${reason}` }, 400);
23685
+ }
23686
+ }
23687
+ if (setClauses.length === 0) return c.json({ error: "No editable fields supplied" }, 400);
23688
+ setClauses.push("e.updatedAt = $updatedAt");
23689
+ params.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
23690
+ const session = getSession();
23691
+ try {
23692
+ const res = await session.run(
23693
+ `MATCH (e:Event {eventId: $eventId, accountId: $accountId})
23694
+ WHERE ${AUTOMATION_WHERE}
23695
+ SET ${setClauses.join(", ")}
23696
+ RETURN ${ROUTINE_COLS}`,
23697
+ params
23698
+ );
23699
+ if (res.records.length === 0) {
23700
+ console.error(`[admin:routines] op=patch id=${eventId.slice(0, 8)} outcome=rejected reason=not-found`);
23701
+ return c.json({ error: "Routine not found" }, 404);
23702
+ }
23703
+ console.log(`[admin:routines] op=patch id=${eventId.slice(0, 8)} fields=${fields.join("+")} outcome=ok nextRun=${nextRunLog} cron=${params.recurrence ?? "unchanged"}`);
23704
+ return c.json({ routine: mapRoutine(res.records[0]) });
23705
+ } catch (err) {
23706
+ const message = err instanceof Error ? err.message : String(err);
23707
+ console.error(`[admin:routines] op=patch id=${eventId.slice(0, 8)} outcome=rejected reason=${message}`);
23708
+ return c.json({ error: `Update failed: ${message}` }, 503);
23709
+ } finally {
23710
+ await session.close();
23711
+ }
23712
+ });
23713
+ var routines_default = app47;
23714
+
23533
23715
  // app/lib/time-entry-format.ts
23534
23716
  function secondsBetween(startIso, endIso) {
23535
23717
  const s = Date.parse(startIso);
@@ -23551,8 +23733,8 @@ function toNum(v) {
23551
23733
  var TAG39 = "[task-timer]";
23552
23734
  var COMPLETED = /* @__PURE__ */ new Set(["completed"]);
23553
23735
  var HIDDEN_FROM_OPEN = /* @__PURE__ */ new Set(["completed", "cancelled"]);
23554
- var app47 = new Hono();
23555
- app47.get("/", requireAdminSession, async (c) => {
23736
+ var app48 = new Hono();
23737
+ app48.get("/", requireAdminSession, async (c) => {
23556
23738
  const cacheKey = c.var.cacheKey;
23557
23739
  const accountId = getAccountIdForSession(cacheKey);
23558
23740
  if (!accountId) {
@@ -23639,13 +23821,13 @@ app47.get("/", requireAdminSession, async (c) => {
23639
23821
  await session.close();
23640
23822
  }
23641
23823
  });
23642
- var tasks_list_default = app47;
23824
+ var tasks_list_default = app48;
23643
23825
 
23644
23826
  // server/routes/admin/task-timer-start.ts
23645
23827
  import { randomUUID as randomUUID14 } from "crypto";
23646
23828
  var TAG40 = "[task-timer]";
23647
- var app48 = new Hono();
23648
- app48.post("/", requireAdminSession, async (c) => {
23829
+ var app49 = new Hono();
23830
+ app49.post("/", requireAdminSession, async (c) => {
23649
23831
  const cacheKey = c.var.cacheKey;
23650
23832
  const accountId = getAccountIdForSession(cacheKey);
23651
23833
  if (!accountId) return c.json({ error: "Account not found for session" }, 401);
@@ -23700,13 +23882,13 @@ app48.post("/", requireAdminSession, async (c) => {
23700
23882
  await session.close();
23701
23883
  }
23702
23884
  });
23703
- var task_timer_start_default = app48;
23885
+ var task_timer_start_default = app49;
23704
23886
 
23705
23887
  // server/routes/admin/task-timer-stop.ts
23706
23888
  import neo4j5 from "neo4j-driver";
23707
23889
  var TAG41 = "[task-timer]";
23708
- var app49 = new Hono();
23709
- app49.post("/", requireAdminSession, async (c) => {
23890
+ var app50 = new Hono();
23891
+ app50.post("/", requireAdminSession, async (c) => {
23710
23892
  const cacheKey = c.var.cacheKey;
23711
23893
  const accountId = getAccountIdForSession(cacheKey);
23712
23894
  if (!accountId) return c.json({ error: "Account not found for session" }, 401);
@@ -23773,12 +23955,12 @@ app49.post("/", requireAdminSession, async (c) => {
23773
23955
  await session.close();
23774
23956
  }
23775
23957
  });
23776
- var task_timer_stop_default = app49;
23958
+ var task_timer_stop_default = app50;
23777
23959
 
23778
23960
  // server/routes/admin/task-complete.ts
23779
23961
  var TAG42 = "[task-timer]";
23780
- var app50 = new Hono();
23781
- app50.post("/", requireAdminSession, async (c) => {
23962
+ var app51 = new Hono();
23963
+ app51.post("/", requireAdminSession, async (c) => {
23782
23964
  const cacheKey = c.var.cacheKey;
23783
23965
  const accountId = getAccountIdForSession(cacheKey);
23784
23966
  if (!accountId) return c.json({ error: "Account not found for session" }, 401);
@@ -23816,14 +23998,14 @@ app50.post("/", requireAdminSession, async (c) => {
23816
23998
  await session.close();
23817
23999
  }
23818
24000
  });
23819
- var task_complete_default = app50;
24001
+ var task_complete_default = app51;
23820
24002
 
23821
24003
  // server/routes/admin/task-time-adjust.ts
23822
24004
  import { randomUUID as randomUUID15 } from "crypto";
23823
24005
  import neo4j6 from "neo4j-driver";
23824
24006
  var TAG43 = "[task-time-adjust]";
23825
- var app51 = new Hono();
23826
- app51.post("/", requireAdminSession, async (c) => {
24007
+ var app52 = new Hono();
24008
+ app52.post("/", requireAdminSession, async (c) => {
23827
24009
  const cacheKey = c.var.cacheKey;
23828
24010
  const accountId = getAccountIdForSession(cacheKey);
23829
24011
  if (!accountId) return c.json({ error: "Account not found for session" }, 401);
@@ -23897,11 +24079,11 @@ app51.post("/", requireAdminSession, async (c) => {
23897
24079
  await session.close();
23898
24080
  }
23899
24081
  });
23900
- var task_time_adjust_default = app51;
24082
+ var task_time_adjust_default = app52;
23901
24083
 
23902
24084
  // server/routes/admin/activity.ts
23903
24085
  import { readdirSync as readdirSync24 } from "fs";
23904
- var app52 = new Hono();
24086
+ var app53 = new Hono();
23905
24087
  var TAG44 = "[activity]";
23906
24088
  function resolveHouseAccountId(accounts) {
23907
24089
  const houses = accounts.filter((a) => a.config.role === "house");
@@ -23923,7 +24105,7 @@ function countAccountDirsOnDisk() {
23923
24105
  return null;
23924
24106
  }
23925
24107
  }
23926
- app52.get("/", requireAdminSession, async (c) => {
24108
+ app53.get("/", requireAdminSession, async (c) => {
23927
24109
  const req = requestToken();
23928
24110
  const cacheKey = c.var.cacheKey;
23929
24111
  const caller2 = getAccountIdForSession(cacheKey) ?? null;
@@ -24032,60 +24214,61 @@ app52.get("/", requireAdminSession, async (c) => {
24032
24214
  }
24033
24215
  });
24034
24216
  });
24035
- var activity_default = app52;
24217
+ var activity_default = app53;
24036
24218
 
24037
24219
  // server/routes/admin/index.ts
24038
- var app53 = new Hono();
24039
- app53.route("/session", session_default);
24040
- app53.route("/accounts", accounts_default);
24041
- app53.route("/logs", logs_default);
24042
- app53.route("/claude-info", claude_info_default);
24043
- app53.route("/attachment", attachment_default);
24044
- app53.route("/agents", agents_default);
24045
- app53.route("/sessions", sessions_default);
24046
- app53.route("/claude-sessions", claude_sessions_default);
24047
- app53.route("/log-ingest", log_ingest_default);
24048
- app53.route("/events", events_default);
24049
- app53.route("/files", files_default);
24050
- app53.route("/graph-search", graph_search_default);
24051
- app53.route("/graph-subgraph", graph_subgraph_default);
24052
- app53.route("/graph-delete", graph_delete_default);
24053
- app53.route("/graph-restore", graph_restore_default);
24054
- app53.route("/graph-labels-in-graph", graph_labels_in_graph_default);
24055
- app53.route("/graph-default-view", graph_default_view_default);
24056
- app53.route("/sidebar-artefacts", sidebar_artefacts_default);
24057
- app53.route("/sidebar-sessions", sidebar_sessions_default);
24058
- app53.route("/session-delete", session_delete_default);
24059
- app53.route("/session-stop", session_stop_default);
24060
- app53.route("/session-archive", session_archive_default);
24061
- app53.route("/session-rename", session_rename_default);
24062
- app53.route("/session-usage", session_usage_default);
24063
- app53.route("/browser", browser_default);
24064
- app53.route("/session-rc-spawn", session_rc_spawn_default);
24065
- app53.route("/session-reseat", session_reseat_default);
24066
- app53.route("/system-stats", system_stats_default);
24067
- app53.route("/health-brand", health_default2);
24068
- app53.route("/linkedin-ingest", linkedin_ingest_default);
24069
- app53.route("/post-turn-context", post_turn_context_default);
24070
- app53.route("/public-session-context", public_session_context_default);
24071
- app53.route("/public-session-exit", public_session_exit_default);
24072
- app53.route("/access-session-evict", access_session_evict_default);
24073
- app53.route("/enrol-person", enrol_person_default);
24074
- app53.route("/calendar", calendar_default);
24075
- app53.route("/tasks-list", tasks_list_default);
24076
- app53.route("/task-timer-start", task_timer_start_default);
24077
- app53.route("/task-timer-stop", task_timer_stop_default);
24078
- app53.route("/task-complete", task_complete_default);
24079
- app53.route("/task-time-adjust", task_time_adjust_default);
24080
- app53.route("/activity", activity_default);
24081
- var admin_default = app53;
24220
+ var app54 = new Hono();
24221
+ app54.route("/session", session_default);
24222
+ app54.route("/accounts", accounts_default);
24223
+ app54.route("/logs", logs_default);
24224
+ app54.route("/claude-info", claude_info_default);
24225
+ app54.route("/attachment", attachment_default);
24226
+ app54.route("/agents", agents_default);
24227
+ app54.route("/sessions", sessions_default);
24228
+ app54.route("/claude-sessions", claude_sessions_default);
24229
+ app54.route("/log-ingest", log_ingest_default);
24230
+ app54.route("/events", events_default);
24231
+ app54.route("/files", files_default);
24232
+ app54.route("/graph-search", graph_search_default);
24233
+ app54.route("/graph-subgraph", graph_subgraph_default);
24234
+ app54.route("/graph-delete", graph_delete_default);
24235
+ app54.route("/graph-restore", graph_restore_default);
24236
+ app54.route("/graph-labels-in-graph", graph_labels_in_graph_default);
24237
+ app54.route("/graph-default-view", graph_default_view_default);
24238
+ app54.route("/sidebar-artefacts", sidebar_artefacts_default);
24239
+ app54.route("/sidebar-sessions", sidebar_sessions_default);
24240
+ app54.route("/session-delete", session_delete_default);
24241
+ app54.route("/session-stop", session_stop_default);
24242
+ app54.route("/session-archive", session_archive_default);
24243
+ app54.route("/session-rename", session_rename_default);
24244
+ app54.route("/session-usage", session_usage_default);
24245
+ app54.route("/browser", browser_default);
24246
+ app54.route("/session-rc-spawn", session_rc_spawn_default);
24247
+ app54.route("/session-reseat", session_reseat_default);
24248
+ app54.route("/system-stats", system_stats_default);
24249
+ app54.route("/health-brand", health_default2);
24250
+ app54.route("/linkedin-ingest", linkedin_ingest_default);
24251
+ app54.route("/post-turn-context", post_turn_context_default);
24252
+ app54.route("/public-session-context", public_session_context_default);
24253
+ app54.route("/public-session-exit", public_session_exit_default);
24254
+ app54.route("/access-session-evict", access_session_evict_default);
24255
+ app54.route("/enrol-person", enrol_person_default);
24256
+ app54.route("/calendar", calendar_default);
24257
+ app54.route("/routines", routines_default);
24258
+ app54.route("/tasks-list", tasks_list_default);
24259
+ app54.route("/task-timer-start", task_timer_start_default);
24260
+ app54.route("/task-timer-stop", task_timer_stop_default);
24261
+ app54.route("/task-complete", task_complete_default);
24262
+ app54.route("/task-time-adjust", task_time_adjust_default);
24263
+ app54.route("/activity", activity_default);
24264
+ var admin_default = app54;
24082
24265
 
24083
24266
  // server/routes/access/verify-token.ts
24084
24267
  var TAG45 = "[access-verify]";
24085
24268
  var MINT_TAG = "[access-session-mint]";
24086
24269
  var COOKIE_NAME = "__access_session";
24087
- var app54 = new Hono();
24088
- app54.post("/", async (c) => {
24270
+ var app55 = new Hono();
24271
+ app55.post("/", async (c) => {
24089
24272
  const ip = c.var.clientIp || "unknown";
24090
24273
  let body;
24091
24274
  try {
@@ -24167,7 +24350,7 @@ app54.post("/", async (c) => {
24167
24350
  displayName: grant.displayName
24168
24351
  });
24169
24352
  });
24170
- var verify_token_default = app54;
24353
+ var verify_token_default = app55;
24171
24354
 
24172
24355
  // app/lib/access-email.ts
24173
24356
  import { spawn as spawn2 } from "child_process";
@@ -24230,9 +24413,9 @@ async function sendMagicLinkEmail(payload) {
24230
24413
 
24231
24414
  // server/routes/access/request-magic-link.ts
24232
24415
  var TAG46 = "[access-request-link]";
24233
- var app55 = new Hono();
24416
+ var app56 = new Hono();
24234
24417
  var VISITOR_MESSAGE = "If that email is on the invite list, a fresh link is on the way.";
24235
- app55.post("/", async (c) => {
24418
+ app56.post("/", async (c) => {
24236
24419
  let body;
24237
24420
  try {
24238
24421
  body = await c.req.json();
@@ -24306,13 +24489,13 @@ app55.post("/", async (c) => {
24306
24489
  );
24307
24490
  return c.json({ message: VISITOR_MESSAGE }, 200);
24308
24491
  });
24309
- var request_magic_link_default = app55;
24492
+ var request_magic_link_default = app56;
24310
24493
 
24311
24494
  // server/routes/access/index.ts
24312
- var app56 = new Hono();
24313
- app56.route("/verify-token", verify_token_default);
24314
- app56.route("/request-magic-link", request_magic_link_default);
24315
- var access_default = app56;
24495
+ var app57 = new Hono();
24496
+ app57.route("/verify-token", verify_token_default);
24497
+ app57.route("/request-magic-link", request_magic_link_default);
24498
+ var access_default = app57;
24316
24499
 
24317
24500
  // server/routes/sites.ts
24318
24501
  import { existsSync as existsSync36, readFileSync as readFileSync39, realpathSync as realpathSync7, statSync as statSync14 } from "fs";
@@ -24347,8 +24530,8 @@ function getExt(p) {
24347
24530
  if (idx < p.lastIndexOf("/")) return "";
24348
24531
  return p.slice(idx).toLowerCase();
24349
24532
  }
24350
- var app57 = new Hono();
24351
- app57.get("/:rel{.*}", (c) => {
24533
+ var app58 = new Hono();
24534
+ app58.get("/:rel{.*}", (c) => {
24352
24535
  const reqPath = c.req.path;
24353
24536
  const rawRel = c.req.param("rel") ?? "";
24354
24537
  const trimmed = rawRel.replace(/^\/+/, "").replace(/\/+$/, "");
@@ -24451,7 +24634,7 @@ app57.get("/:rel{.*}", (c) => {
24451
24634
  "X-Content-Type-Options": "nosniff"
24452
24635
  });
24453
24636
  });
24454
- var sites_default = app57;
24637
+ var sites_default = app58;
24455
24638
 
24456
24639
  // app/lib/visitor-token.ts
24457
24640
  import { createHmac, randomBytes, timingSafeEqual } from "crypto";
@@ -24551,7 +24734,7 @@ function readBrandConfig() {
24551
24734
  }
24552
24735
 
24553
24736
  // server/routes/visitor-consent.ts
24554
- var app58 = new Hono();
24737
+ var app59 = new Hono();
24555
24738
  var CONSENT_COOKIE_NAME = "mxy_consent";
24556
24739
  var CONSENT_COOKIE_MAX_AGE_SECONDS = 60 * 60 * 24 * 365;
24557
24740
  var DEFAULT_CONSENT_COPY = {
@@ -24596,17 +24779,17 @@ function siteSlugFromReferer(referer) {
24596
24779
  return "";
24597
24780
  }
24598
24781
  }
24599
- app58.options("/consent", (c) => {
24782
+ app59.options("/consent", (c) => {
24600
24783
  const origin = getOrigin(c);
24601
24784
  setCorsHeaders(c, origin);
24602
24785
  return c.body(null, 204);
24603
24786
  });
24604
- app58.options("/brand-config", (c) => {
24787
+ app59.options("/brand-config", (c) => {
24605
24788
  const origin = getOrigin(c);
24606
24789
  setCorsHeaders(c, origin);
24607
24790
  return c.body(null, 204);
24608
24791
  });
24609
- app58.post("/consent", async (c) => {
24792
+ app59.post("/consent", async (c) => {
24610
24793
  const origin = getOrigin(c);
24611
24794
  setCorsHeaders(c, origin);
24612
24795
  let raw;
@@ -24646,7 +24829,7 @@ app58.post("/consent", async (c) => {
24646
24829
  console.log(`[consent] ${parsed.decision} site=${site} brand=${brandName} tokenBound=${tokenBound}`);
24647
24830
  return c.body(null, 204);
24648
24831
  });
24649
- app58.get("/brand-config", (c) => {
24832
+ app59.get("/brand-config", (c) => {
24650
24833
  const origin = getOrigin(c);
24651
24834
  setCorsHeaders(c, origin);
24652
24835
  const brand = readBrandConfig();
@@ -24656,7 +24839,7 @@ app58.get("/brand-config", (c) => {
24656
24839
  c.header("Cache-Control", "public, max-age=300");
24657
24840
  return c.json({ consent: { copy, palette } });
24658
24841
  });
24659
- var visitor_consent_default = app58;
24842
+ var visitor_consent_default = app59;
24660
24843
 
24661
24844
  // server/routes/listings.ts
24662
24845
  function getCookie(headerValue, name) {
@@ -24683,8 +24866,8 @@ function appendConsentParams(pageUrl, token) {
24683
24866
  }
24684
24867
  var SAFE_SLUG_RE = /^[a-z0-9](?:[a-z0-9-]{0,118}[a-z0-9])?$/;
24685
24868
  var CHAT_SESSION_KEY_RE = /^[A-Za-z0-9][A-Za-z0-9_-]{7,127}$/;
24686
- var app59 = new Hono();
24687
- app59.get("/:slug/click", async (c) => {
24869
+ var app60 = new Hono();
24870
+ app60.get("/:slug/click", async (c) => {
24688
24871
  const slug = c.req.param("slug") ?? "";
24689
24872
  const rawSession = c.req.query("session") ?? "";
24690
24873
  const sessionKey = CHAT_SESSION_KEY_RE.test(rawSession) ? rawSession : "invalid";
@@ -24748,10 +24931,10 @@ app59.get("/:slug/click", async (c) => {
24748
24931
  console.log(`[property-card-click] sessionKey=${sessionKey} listingSlug=${slug} consent=${consentCookie ?? "absent"} ts=${(/* @__PURE__ */ new Date()).toISOString()}`);
24749
24932
  return c.redirect(redirectUrl, 302);
24750
24933
  });
24751
- var listings_default = app59;
24934
+ var listings_default = app60;
24752
24935
 
24753
24936
  // server/routes/visitor-event.ts
24754
- var app60 = new Hono();
24937
+ var app61 = new Hono();
24755
24938
  var BOT_UA_RE = /\b(bot|crawl|spider|slurp|headlesschrome|phantomjs|googlebot|bingbot|yandex|baiduspider|ahrefsbot|semrushbot|mj12bot|dotbot|petalbot)\b/i;
24756
24939
  var buckets = /* @__PURE__ */ new Map();
24757
24940
  var RATE_LIMIT = 60;
@@ -24827,12 +25010,12 @@ function originAllowed(origin, allowlist) {
24827
25010
  return false;
24828
25011
  }
24829
25012
  }
24830
- app60.options("/event", (c) => {
25013
+ app61.options("/event", (c) => {
24831
25014
  const origin = getOrigin2(c);
24832
25015
  setCorsHeaders2(c, origin);
24833
25016
  return c.body(null, 204);
24834
25017
  });
24835
- app60.post("/event", async (c) => {
25018
+ app61.post("/event", async (c) => {
24836
25019
  const origin = getOrigin2(c);
24837
25020
  setCorsHeaders2(c, origin);
24838
25021
  const ua = c.req.header("user-agent") ?? "";
@@ -25037,7 +25220,7 @@ async function writeEvent(opts) {
25037
25220
  );
25038
25221
  }
25039
25222
  }
25040
- var visitor_event_default = app60;
25223
+ var visitor_event_default = app61;
25041
25224
 
25042
25225
  // server/routes/session.ts
25043
25226
  import { resolve as resolve33 } from "path";
@@ -25083,8 +25266,8 @@ function withVisitorCookie(response, visitorId) {
25083
25266
  headers
25084
25267
  });
25085
25268
  }
25086
- var app61 = new Hono();
25087
- app61.post("/", async (c) => {
25269
+ var app62 = new Hono();
25270
+ app62.post("/", async (c) => {
25088
25271
  let body;
25089
25272
  try {
25090
25273
  body = await c.req.json();
@@ -25231,7 +25414,7 @@ app61.post("/", async (c) => {
25231
25414
  newVisitorId
25232
25415
  );
25233
25416
  });
25234
- var session_default2 = app61;
25417
+ var session_default2 = app62;
25235
25418
 
25236
25419
  // server/lib/calendar-slots.ts
25237
25420
  var WEEKDAYS = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
@@ -25314,17 +25497,17 @@ function computeOpenSlots(config, busy, fromISO, toISO) {
25314
25497
  }
25315
25498
 
25316
25499
  // server/routes/calendar-public.ts
25317
- var app62 = new Hono();
25500
+ var app63 = new Hono();
25318
25501
  function setCors(c) {
25319
25502
  c.header("Access-Control-Allow-Origin", "*");
25320
25503
  c.header("Access-Control-Allow-Methods", "GET, OPTIONS");
25321
25504
  c.header("Access-Control-Allow-Headers", "content-type");
25322
25505
  }
25323
- app62.options("/free-busy", (c) => {
25506
+ app63.options("/free-busy", (c) => {
25324
25507
  setCors(c);
25325
25508
  return c.body(null, 204);
25326
25509
  });
25327
- app62.get("/free-busy", async (c) => {
25510
+ app63.get("/free-busy", async (c) => {
25328
25511
  setCors(c);
25329
25512
  const from = c.req.query("from");
25330
25513
  const to = c.req.query("to");
@@ -25380,14 +25563,14 @@ app62.get("/free-busy", async (c) => {
25380
25563
  await session.close();
25381
25564
  }
25382
25565
  });
25383
- var calendar_public_default = app62;
25566
+ var calendar_public_default = app63;
25384
25567
 
25385
25568
  // server/routes/portal-fetch.ts
25386
25569
  import { createReadStream as createReadStream3 } from "fs";
25387
25570
  import { stat as stat8, readFile as readFile8, realpath } from "fs/promises";
25388
25571
  import { join as join44, resolve as resolve34, sep as sep9 } from "path";
25389
25572
  import { Readable as Readable3 } from "stream";
25390
- var app63 = new Hono();
25573
+ var app64 = new Hono();
25391
25574
  var TAG47 = "[portal-fetch]";
25392
25575
  async function verifySignature(secret, accountId, relPath, expiresAtMs, signature, nowMs) {
25393
25576
  if (!secret || !signature) return false;
@@ -25550,9 +25733,9 @@ async function handle(c, headOnly) {
25550
25733
  }
25551
25734
  });
25552
25735
  }
25553
- app63.get("/fetch", (c) => handle(c, false));
25554
- app63.on("HEAD", "/fetch", (c) => handle(c, true));
25555
- var portal_fetch_default = app63;
25736
+ app64.get("/fetch", (c) => handle(c, false));
25737
+ app64.on("HEAD", "/fetch", (c) => handle(c, true));
25738
+ var portal_fetch_default = app64;
25556
25739
 
25557
25740
  // app/lib/timeentry-census.ts
25558
25741
  var TAG48 = "[timeentry-census]";
@@ -26458,9 +26641,6 @@ var InboundHub = class {
26458
26641
  }
26459
26642
  };
26460
26643
 
26461
- // app/lib/whatsapp/gateway/wa-gateway.ts
26462
- var import_dist7 = __toESM(require_dist(), 1);
26463
-
26464
26644
  // node_modules/hono/dist/utils/stream.js
26465
26645
  var StreamingApi = class {
26466
26646
  writer;
@@ -26612,8 +26792,8 @@ var streamSSE = (c, cb, onError) => {
26612
26792
 
26613
26793
  // app/lib/whatsapp/gateway/routes.ts
26614
26794
  function createWaChannelRoutes(deps) {
26615
- const app65 = new Hono();
26616
- app65.get("/wa-channel/inbound", (c) => {
26795
+ const app66 = new Hono();
26796
+ app66.get("/wa-channel/inbound", (c) => {
26617
26797
  const senderId = c.req.query("senderId");
26618
26798
  if (!senderId) return c.json({ error: "senderId required" }, 400);
26619
26799
  return streamSSE(c, async (stream2) => {
@@ -26631,7 +26811,7 @@ function createWaChannelRoutes(deps) {
26631
26811
  }
26632
26812
  });
26633
26813
  });
26634
- app65.post("/wa-channel/reply", async (c) => {
26814
+ app66.post("/wa-channel/reply", async (c) => {
26635
26815
  const body = await c.req.json().catch(() => null);
26636
26816
  const senderId = body?.senderId;
26637
26817
  const text = body?.text;
@@ -26652,7 +26832,7 @@ function createWaChannelRoutes(deps) {
26652
26832
  console.error(`[whatsapp-native] op=reply-dispatch senderId=${senderId} bytes=${bytes}`);
26653
26833
  return c.json({ ok: true });
26654
26834
  });
26655
- app65.post("/wa-channel/reply-document", async (c) => {
26835
+ app66.post("/wa-channel/reply-document", async (c) => {
26656
26836
  const body = await c.req.json().catch(() => null);
26657
26837
  const senderId = body?.senderId;
26658
26838
  const files = body?.files;
@@ -26691,7 +26871,7 @@ function createWaChannelRoutes(deps) {
26691
26871
  }
26692
26872
  return c.json({ ok: true, results });
26693
26873
  });
26694
- app65.post("/wa-channel/ready", async (c) => {
26874
+ app66.post("/wa-channel/ready", async (c) => {
26695
26875
  const body = await c.req.json().catch(() => null);
26696
26876
  const senderId = body?.senderId;
26697
26877
  if (typeof senderId !== "string") {
@@ -26700,7 +26880,7 @@ function createWaChannelRoutes(deps) {
26700
26880
  deps.onReady?.(senderId);
26701
26881
  return c.json({ ok: true });
26702
26882
  });
26703
- app65.post("/wa-channel/received", async (c) => {
26883
+ app66.post("/wa-channel/received", async (c) => {
26704
26884
  const body = await c.req.json().catch(() => null);
26705
26885
  const senderId = body?.senderId;
26706
26886
  const waMessageId = body?.waMessageId;
@@ -26710,7 +26890,7 @@ function createWaChannelRoutes(deps) {
26710
26890
  deps.onReceived?.(senderId, waMessageId);
26711
26891
  return c.json({ ok: true });
26712
26892
  });
26713
- app65.post("/wa-channel/turn-end", async (c) => {
26893
+ app66.post("/wa-channel/turn-end", async (c) => {
26714
26894
  const body = await c.req.json().catch(() => null);
26715
26895
  const senderId = body?.senderId;
26716
26896
  const sessionId = body?.sessionId;
@@ -26743,7 +26923,7 @@ function createWaChannelRoutes(deps) {
26743
26923
  console.error(`[whatsapp-native] op=turn-end sessionId=${sid} replied=no delivered=none`);
26744
26924
  return c.json({ ok: true, delivered: "none" });
26745
26925
  });
26746
- return app65;
26926
+ return app66;
26747
26927
  }
26748
26928
 
26749
26929
  // app/lib/whatsapp/gateway/wa-gateway.ts
@@ -26876,7 +27056,7 @@ var WaGateway = class {
26876
27056
  const injected = res.block ? (res.block.match(/^- /gm) ?? []).length : 0;
26877
27057
  const owner8 = res.ownerUserId ? res.ownerUserId.slice(0, 8) : "-";
26878
27058
  console.error(
26879
- `[preference-inject] op=inject channel=wa accountId=${input.effectiveAccountId} injected=${injected} owner=${owner8} source=${res.source} capped=${injected >= import_dist7.INJECTION_RULE_CAP}`
27059
+ `[preference-inject] op=inject channel=wa accountId=${input.effectiveAccountId} injected=${injected} owner=${owner8} source=${res.source}`
26880
27060
  );
26881
27061
  }
26882
27062
  this.hub.deliver(
@@ -27156,13 +27336,10 @@ var InboundHub2 = class {
27156
27336
  }
27157
27337
  };
27158
27338
 
27159
- // app/lib/webchat/gateway/webchat-gateway.ts
27160
- var import_dist8 = __toESM(require_dist(), 1);
27161
-
27162
27339
  // app/lib/webchat/gateway/routes.ts
27163
27340
  function createWebchatChannelRoutes(deps) {
27164
- const app65 = new Hono();
27165
- app65.get("/webchat-channel/inbound", (c) => {
27341
+ const app66 = new Hono();
27342
+ app66.get("/webchat-channel/inbound", (c) => {
27166
27343
  const key = c.req.query("key");
27167
27344
  if (!key) return c.json({ error: "key required" }, 400);
27168
27345
  return streamSSE(c, async (stream2) => {
@@ -27180,7 +27357,7 @@ function createWebchatChannelRoutes(deps) {
27180
27357
  }
27181
27358
  });
27182
27359
  });
27183
- app65.post("/webchat-channel/reply", async (c) => {
27360
+ app66.post("/webchat-channel/reply", async (c) => {
27184
27361
  const body = await c.req.json().catch(() => null);
27185
27362
  const key = body?.key;
27186
27363
  const text = body?.text;
@@ -27190,7 +27367,7 @@ function createWebchatChannelRoutes(deps) {
27190
27367
  deps.onReply?.(key, text);
27191
27368
  return c.json({ ok: true });
27192
27369
  });
27193
- app65.post("/webchat-channel/connector-auth", async (c) => {
27370
+ app66.post("/webchat-channel/connector-auth", async (c) => {
27194
27371
  const body = await c.req.json().catch(() => null);
27195
27372
  const key = body?.key;
27196
27373
  const sessionId = body?.sessionId;
@@ -27203,7 +27380,7 @@ function createWebchatChannelRoutes(deps) {
27203
27380
  const result = await deps.onConnectorAuth({ key, sessionId, name, completed });
27204
27381
  return c.json(result);
27205
27382
  });
27206
- app65.post("/webchat-channel/ready", async (c) => {
27383
+ app66.post("/webchat-channel/ready", async (c) => {
27207
27384
  const body = await c.req.json().catch(() => null);
27208
27385
  const key = body?.key;
27209
27386
  if (typeof key !== "string") {
@@ -27212,7 +27389,7 @@ function createWebchatChannelRoutes(deps) {
27212
27389
  deps.onReady?.(key);
27213
27390
  return c.json({ ok: true });
27214
27391
  });
27215
- app65.post("/webchat-channel/permission-request", async (c) => {
27392
+ app66.post("/webchat-channel/permission-request", async (c) => {
27216
27393
  const body = await c.req.json().catch(() => null);
27217
27394
  const key = body?.key;
27218
27395
  const requestId = body?.request_id;
@@ -27226,7 +27403,7 @@ function createWebchatChannelRoutes(deps) {
27226
27403
  const verdict = await deps.awaitPermissionVerdict({ key, requestId, toolName, description, inputPreview });
27227
27404
  return c.json(verdict);
27228
27405
  });
27229
- app65.post("/webchat-channel/received", async (c) => {
27406
+ app66.post("/webchat-channel/received", async (c) => {
27230
27407
  const body = await c.req.json().catch(() => null);
27231
27408
  const key = body?.key;
27232
27409
  const messageId = body?.messageId;
@@ -27236,7 +27413,7 @@ function createWebchatChannelRoutes(deps) {
27236
27413
  deps.onReceived?.(key, messageId);
27237
27414
  return c.json({ ok: true });
27238
27415
  });
27239
- app65.post("/webchat-channel/turn-end", async (c) => {
27416
+ app66.post("/webchat-channel/turn-end", async (c) => {
27240
27417
  const body = await c.req.json().catch(() => null);
27241
27418
  const key = body?.key;
27242
27419
  const sessionId = body?.sessionId;
@@ -27259,7 +27436,7 @@ function createWebchatChannelRoutes(deps) {
27259
27436
  console.error(`[webchat-native] op=turn-end channel=webchat key=${k} sessionId=${sid} replied=no delivered=none`);
27260
27437
  return c.json({ ok: true, delivered: "none" });
27261
27438
  });
27262
- return app65;
27439
+ return app66;
27263
27440
  }
27264
27441
 
27265
27442
  // app/lib/webchat/gateway/webchat-gateway.ts
@@ -27637,7 +27814,7 @@ var WebchatGateway = class _WebchatGateway {
27637
27814
  const injected = res.block ? (res.block.match(/^- /gm) ?? []).length : 0;
27638
27815
  const owner8 = res.ownerUserId ? res.ownerUserId.slice(0, 8) : "-";
27639
27816
  console.error(
27640
- `[preference-inject] op=inject channel=web accountId=${input.accountId} injected=${injected} owner=${owner8} source=${res.source} capped=${injected >= import_dist8.INJECTION_RULE_CAP}`
27817
+ `[preference-inject] op=inject channel=web accountId=${input.accountId} injected=${injected} owner=${owner8} source=${res.source}`
27641
27818
  );
27642
27819
  }
27643
27820
  this.hub.deliver(
@@ -28341,13 +28518,10 @@ var InboundHub3 = class {
28341
28518
  }
28342
28519
  };
28343
28520
 
28344
- // app/lib/telegram/gateway/telegram-gateway.ts
28345
- var import_dist9 = __toESM(require_dist(), 1);
28346
-
28347
28521
  // app/lib/telegram/gateway/routes.ts
28348
28522
  function createTelegramChannelRoutes(deps) {
28349
- const app65 = new Hono();
28350
- app65.get("/tg-channel/inbound", (c) => {
28523
+ const app66 = new Hono();
28524
+ app66.get("/tg-channel/inbound", (c) => {
28351
28525
  const key = c.req.query("key");
28352
28526
  if (!key) return c.json({ error: "key required" }, 400);
28353
28527
  return streamSSE(c, async (stream2) => {
@@ -28365,7 +28539,7 @@ function createTelegramChannelRoutes(deps) {
28365
28539
  }
28366
28540
  });
28367
28541
  });
28368
- app65.post("/tg-channel/reply", async (c) => {
28542
+ app66.post("/tg-channel/reply", async (c) => {
28369
28543
  const body = await c.req.json().catch(() => null);
28370
28544
  const key = body?.key;
28371
28545
  const text = body?.text;
@@ -28381,7 +28555,7 @@ function createTelegramChannelRoutes(deps) {
28381
28555
  console.error(`[telegram-native] op=reply key=${key} bytes=${Buffer.byteLength(text, "utf8")}`);
28382
28556
  return c.json({ ok: true });
28383
28557
  });
28384
- app65.post("/tg-channel/ready", async (c) => {
28558
+ app66.post("/tg-channel/ready", async (c) => {
28385
28559
  const body = await c.req.json().catch(() => null);
28386
28560
  const key = body?.key;
28387
28561
  if (typeof key !== "string") {
@@ -28390,7 +28564,7 @@ function createTelegramChannelRoutes(deps) {
28390
28564
  deps.onReady?.(key);
28391
28565
  return c.json({ ok: true });
28392
28566
  });
28393
- app65.post("/tg-channel/received", async (c) => {
28567
+ app66.post("/tg-channel/received", async (c) => {
28394
28568
  const body = await c.req.json().catch(() => null);
28395
28569
  const key = body?.key;
28396
28570
  const messageId = body?.messageId;
@@ -28400,7 +28574,7 @@ function createTelegramChannelRoutes(deps) {
28400
28574
  deps.onReceived?.(key, messageId);
28401
28575
  return c.json({ ok: true });
28402
28576
  });
28403
- app65.post("/tg-channel/turn-end", async (c) => {
28577
+ app66.post("/tg-channel/turn-end", async (c) => {
28404
28578
  const body = await c.req.json().catch(() => null);
28405
28579
  const key = body?.key;
28406
28580
  const sessionId = body?.sessionId;
@@ -28433,7 +28607,7 @@ function createTelegramChannelRoutes(deps) {
28433
28607
  console.error(`[telegram-native] op=turn-end key=${key} sessionId=${sid} replied=no delivered=none`);
28434
28608
  return c.json({ ok: true, delivered: "none" });
28435
28609
  });
28436
- return app65;
28610
+ return app66;
28437
28611
  }
28438
28612
 
28439
28613
  // app/lib/telegram/gateway/telegram-gateway.ts
@@ -28517,7 +28691,7 @@ var TelegramGateway = class {
28517
28691
  const injected = res.block ? (res.block.match(/^- /gm) ?? []).length : 0;
28518
28692
  const owner8 = res.ownerUserId ? res.ownerUserId.slice(0, 8) : "-";
28519
28693
  console.error(
28520
- `[preference-inject] op=inject channel=tg accountId=${input.accountId} injected=${injected} owner=${owner8} source=${res.source} capped=${injected >= import_dist9.INJECTION_RULE_CAP}`
28694
+ `[preference-inject] op=inject channel=tg accountId=${input.accountId} injected=${injected} owner=${owner8} source=${res.source}`
28521
28695
  );
28522
28696
  }
28523
28697
  this.hub.deliver(
@@ -28886,11 +29060,11 @@ async function firePublicSessionEndReview(input) {
28886
29060
  }
28887
29061
 
28888
29062
  // app/lib/whatsapp/inbound/resolve-client-graph-owner.ts
28889
- var import_dist10 = __toESM(require_dist(), 1);
29063
+ var import_dist7 = __toESM(require_dist(), 1);
28890
29064
  async function resolveClientOwnerUserId(accountId, deps = {}) {
28891
29065
  const listAccounts = deps.listAccounts ?? listValidAccounts;
28892
29066
  const getSession4 = deps.getSession ?? getSession;
28893
- const resolveOwner2 = deps.resolveOwner ?? import_dist10.resolveOwnerUserId;
29067
+ const resolveOwner2 = deps.resolveOwner ?? import_dist7.resolveOwnerUserId;
28894
29068
  const role = listAccounts().find((a) => a.accountId === accountId)?.config.role;
28895
29069
  if (role !== "client") return null;
28896
29070
  const session = getSession4();
@@ -29338,7 +29512,7 @@ watchFile(ALIAS_DOMAINS_PATH, { interval: 2e3 }, () => {
29338
29512
  function isPublicHost(host) {
29339
29513
  return host.startsWith("public.") || aliasDomains.has(host);
29340
29514
  }
29341
- var app64 = new Hono();
29515
+ var app65 = new Hono();
29342
29516
  function resolveChannelOverride(accountId, channel, senderId) {
29343
29517
  try {
29344
29518
  const dir = listValidAccounts().find((a) => a.accountId === accountId)?.accountDir;
@@ -29352,8 +29526,8 @@ var webchatFileFollowers = /* @__PURE__ */ new Map();
29352
29526
  async function fetchAccountStandingRules(accountId) {
29353
29527
  const session = getSession();
29354
29528
  try {
29355
- const res = await (0, import_dist11.resolveActiveRules)(session, accountId);
29356
- return { block: (0, import_dist11.formatStandingRulesBlock)(res.rules), ownerUserId: res.ownerUserId, source: res.source };
29529
+ const res = await (0, import_dist8.resolveActiveRules)(session, accountId);
29530
+ return { block: (0, import_dist8.formatStandingRulesBlock)(res.rules), ownerUserId: res.ownerUserId, source: res.source };
29357
29531
  } catch (err) {
29358
29532
  console.error(
29359
29533
  `[preference-inject] op=fetch-failed accountId=${accountId} error=${err instanceof Error ? err.message : String(err)}`
@@ -29514,7 +29688,7 @@ var waGateway = new WaGateway({
29514
29688
  nativeFileFollowers.set(senderId, ac);
29515
29689
  }
29516
29690
  });
29517
- app64.route("/", waGateway.routes());
29691
+ app65.route("/", waGateway.routes());
29518
29692
  waGateway.startSweeper();
29519
29693
  function runDuplicateSenderAudit() {
29520
29694
  try {
@@ -29637,7 +29811,7 @@ var webchatGateway = new WebchatGateway({
29637
29811
  firePublicSessionEndReview: (input) => firePublicSessionEndReview(input)
29638
29812
  });
29639
29813
  setWebchatGateway(webchatGateway);
29640
- app64.route("/", webchatGateway.routes());
29814
+ app65.route("/", webchatGateway.routes());
29641
29815
  webchatGateway.startSweeper();
29642
29816
  webchatGateway.startPublicReaper();
29643
29817
  var telegramFileFollowers = /* @__PURE__ */ new Map();
@@ -29681,7 +29855,7 @@ var telegramGateway = new TelegramGateway({
29681
29855
  }
29682
29856
  });
29683
29857
  setTelegramGateway(telegramGateway);
29684
- app64.route("/", telegramGateway.routes());
29858
+ app65.route("/", telegramGateway.routes());
29685
29859
  telegramGateway.startSweeper();
29686
29860
  var chatRoutes = createChatRoutes({
29687
29861
  handleInbound: (input) => webchatGateway.handleInbound(input),
@@ -29715,19 +29889,19 @@ var scheduleInjectRoutes = createScheduleInjectRoutes({
29715
29889
  return managed.account;
29716
29890
  }
29717
29891
  });
29718
- app64.route("/api/channel/schedule-inject", scheduleInjectRoutes);
29719
- app64.use("*", clientIpMiddleware);
29892
+ app65.route("/api/channel/schedule-inject", scheduleInjectRoutes);
29893
+ app65.use("*", clientIpMiddleware);
29720
29894
  function allowsSameOriginFraming(path3) {
29721
29895
  return path3 === "/vnc-viewer.html" || path3.startsWith("/api/admin/attachment/") || path3.startsWith("/api/public-reader/attachment/") || path3 === "/api/admin/files/download";
29722
29896
  }
29723
- app64.use("*", async (c, next) => {
29897
+ app65.use("*", async (c, next) => {
29724
29898
  await next();
29725
29899
  c.header("X-Content-Type-Options", "nosniff");
29726
29900
  c.header("Referrer-Policy", "strict-origin-when-cross-origin");
29727
29901
  c.header("X-Frame-Options", allowsSameOriginFraming(c.req.path) ? "SAMEORIGIN" : "DENY");
29728
29902
  });
29729
29903
  var HTTP_LOG_PATHS = /* @__PURE__ */ new Set(["/vnc-viewer.html", "/vnc-popout.html"]);
29730
- app64.use("*", async (c, next) => {
29904
+ app65.use("*", async (c, next) => {
29731
29905
  if (!HTTP_LOG_PATHS.has(c.req.path)) {
29732
29906
  await next();
29733
29907
  return;
@@ -29745,7 +29919,7 @@ app64.use("*", async (c, next) => {
29745
29919
  });
29746
29920
  }
29747
29921
  });
29748
- app64.use("*", async (c, next) => {
29922
+ app65.use("*", async (c, next) => {
29749
29923
  const host = (c.req.header("host") ?? "").split(":")[0];
29750
29924
  if (isOperatorHost(host, getOperatorDomains()) || !isPublicHost(host)) {
29751
29925
  await next();
@@ -29783,7 +29957,7 @@ function resolveRemoteAuthOpts(c) {
29783
29957
  return { ...brandLoginOpts, origin };
29784
29958
  }
29785
29959
  var MAX_LOGIN_BODY = 8 * 1024;
29786
- app64.post("/__remote-auth/login", async (c) => {
29960
+ app65.post("/__remote-auth/login", async (c) => {
29787
29961
  const client = clientFrom(c);
29788
29962
  const clientIp = client.ip || "unknown";
29789
29963
  if (!requestIsTlsTerminated(c)) {
@@ -29828,7 +30002,7 @@ app64.post("/__remote-auth/login", async (c) => {
29828
30002
  }
29829
30003
  });
29830
30004
  });
29831
- app64.get("/__remote-auth/logout", (c) => {
30005
+ app65.get("/__remote-auth/logout", (c) => {
29832
30006
  const client = clientFrom(c);
29833
30007
  const clientIp = client.ip || "unknown";
29834
30008
  console.error(`[remote-auth] logout ip=${clientIp}`);
@@ -29841,7 +30015,7 @@ app64.get("/__remote-auth/logout", (c) => {
29841
30015
  }
29842
30016
  });
29843
30017
  });
29844
- app64.post("/__remote-auth/change-password", async (c) => {
30018
+ app65.post("/__remote-auth/change-password", async (c) => {
29845
30019
  const client = clientFrom(c);
29846
30020
  const clientIp = client.ip || "unknown";
29847
30021
  const rateLimited = checkRateLimit(client);
@@ -29900,13 +30074,13 @@ app64.post("/__remote-auth/change-password", async (c) => {
29900
30074
  return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(c), mode: "change", changeError: "Failed to save password", redirect }), 200);
29901
30075
  }
29902
30076
  });
29903
- app64.get("/__remote-auth/setup", (c) => {
30077
+ app65.get("/__remote-auth/setup", (c) => {
29904
30078
  if (isRemoteAuthConfigured()) {
29905
30079
  return c.redirect("/");
29906
30080
  }
29907
30081
  return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(c), mode: "setup" }), 200);
29908
30082
  });
29909
- app64.post("/__remote-auth/set-initial-password", async (c) => {
30083
+ app65.post("/__remote-auth/set-initial-password", async (c) => {
29910
30084
  if (isRemoteAuthConfigured()) {
29911
30085
  return c.redirect("/");
29912
30086
  }
@@ -29944,10 +30118,10 @@ app64.post("/__remote-auth/set-initial-password", async (c) => {
29944
30118
  return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(c), mode: "setup", setupError: "Failed to save password. Please try again." }), 200);
29945
30119
  }
29946
30120
  });
29947
- app64.get("/api/remote-auth/status", (c) => {
30121
+ app65.get("/api/remote-auth/status", (c) => {
29948
30122
  return c.json({ configured: isRemoteAuthConfigured() });
29949
30123
  });
29950
- app64.post("/api/remote-auth/set-password", async (c) => {
30124
+ app65.post("/api/remote-auth/set-password", async (c) => {
29951
30125
  let body;
29952
30126
  try {
29953
30127
  body = await c.req.json();
@@ -29986,10 +30160,10 @@ app64.post("/api/remote-auth/set-password", async (c) => {
29986
30160
  return c.json({ error: "Failed to save password" }, 500);
29987
30161
  }
29988
30162
  });
29989
- app64.route("/api/_client-error", client_error_default);
30163
+ app65.route("/api/_client-error", client_error_default);
29990
30164
  console.log("[client-error-route] mounted");
29991
30165
  var PWA_PUBLIC_PATHS = /* @__PURE__ */ new Set(["/sw.js", ...PWA_SURFACES.map((s) => s.manifestPath)]);
29992
- app64.use("*", async (c, next) => {
30166
+ app65.use("*", async (c, next) => {
29993
30167
  const host = (c.req.header("host") ?? "").split(":")[0];
29994
30168
  const path3 = c.req.path;
29995
30169
  if (path3 === "/favicon.ico" || path3.startsWith("/assets/") || path3.startsWith("/brand/") || // Public free/busy is read by the booking page (a separate Cloudflare Pages
@@ -30033,28 +30207,28 @@ app64.use("*", async (c, next) => {
30033
30207
  }
30034
30208
  return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(c), redirect: path3 }), 200);
30035
30209
  });
30036
- app64.route("/api/health", health_default);
30037
- app64.route("/api/chat", chatRoutes);
30038
- app64.route("/api/whatsapp", whatsapp_default);
30039
- app64.route("/api/storage", storage_broker_default);
30040
- app64.route("/api/whatsapp-reader", whatsapp_reader_default);
30041
- app64.route("/api/public-reader", public_reader_default);
30042
- app64.route("/api/webchat", createWebchatRoutes({
30210
+ app65.route("/api/health", health_default);
30211
+ app65.route("/api/chat", chatRoutes);
30212
+ app65.route("/api/whatsapp", whatsapp_default);
30213
+ app65.route("/api/storage", storage_broker_default);
30214
+ app65.route("/api/whatsapp-reader", whatsapp_reader_default);
30215
+ app65.route("/api/public-reader", public_reader_default);
30216
+ app65.route("/api/webchat", createWebchatRoutes({
30043
30217
  handleInbound: (input) => webchatGateway.handleInbound(input),
30044
30218
  // Task 940 — the permission relay's pointer read + verdict write.
30045
30219
  pendingPromptFor: (key) => webchatGateway.pendingPromptFor(key),
30046
30220
  deliveryFailureFor: (key) => webchatGateway.deliveryFailureFor(key),
30047
30221
  resolvePermissionVerdict: (key, requestId, behavior) => webchatGateway.resolvePermissionVerdict(key, requestId, behavior)
30048
30222
  }));
30049
- app64.route("/api/webchat/greeting", webchat_greeting_default);
30050
- app64.route("/api/telegram", telegram_default);
30051
- app64.route("/api/quickbooks", quickbooks_default);
30052
- app64.route("/api/onboarding", onboarding_default);
30053
- app64.route("/api/admin", admin_default);
30054
- app64.route("/api/access", access_default);
30055
- app64.route("/api/session", session_default2);
30056
- app64.route("/api/calendar", calendar_public_default);
30057
- app64.route("/api/portal", portal_fetch_default);
30223
+ app65.route("/api/webchat/greeting", webchat_greeting_default);
30224
+ app65.route("/api/telegram", telegram_default);
30225
+ app65.route("/api/quickbooks", quickbooks_default);
30226
+ app65.route("/api/onboarding", onboarding_default);
30227
+ app65.route("/api/admin", admin_default);
30228
+ app65.route("/api/access", access_default);
30229
+ app65.route("/api/session", session_default2);
30230
+ app65.route("/api/calendar", calendar_public_default);
30231
+ app65.route("/api/portal", portal_fetch_default);
30058
30232
  var SAFE_SLUG_RE2 = /^[a-z][a-z0-9-]{2,49}$/;
30059
30233
  var SAFE_FILENAME_RE = /^[a-z0-9_][a-z0-9_.-]{0,99}$/i;
30060
30234
  var IMAGE_MIME = {
@@ -30066,7 +30240,7 @@ var IMAGE_MIME = {
30066
30240
  ".svg": "image/svg+xml",
30067
30241
  ".ico": "image/x-icon"
30068
30242
  };
30069
- app64.get("/agent-assets/:slug/:filename", (c) => {
30243
+ app65.get("/agent-assets/:slug/:filename", (c) => {
30070
30244
  const slug = c.req.param("slug");
30071
30245
  const filename = c.req.param("filename");
30072
30246
  if (!SAFE_SLUG_RE2.test(slug)) {
@@ -30101,7 +30275,7 @@ app64.get("/agent-assets/:slug/:filename", (c) => {
30101
30275
  "Cache-Control": "public, max-age=3600"
30102
30276
  });
30103
30277
  });
30104
- app64.get("/generated/:filename", (c) => {
30278
+ app65.get("/generated/:filename", (c) => {
30105
30279
  const filename = c.req.param("filename");
30106
30280
  if (!SAFE_FILENAME_RE.test(filename) || filename.includes("..")) {
30107
30281
  console.error(`[generated] serve file=${filename} status=403`);
@@ -30131,10 +30305,10 @@ app64.get("/generated/:filename", (c) => {
30131
30305
  "Cache-Control": "public, max-age=86400"
30132
30306
  });
30133
30307
  });
30134
- app64.route("/sites", sites_default);
30135
- app64.route("/listings", listings_default);
30136
- app64.route("/v", visitor_event_default);
30137
- app64.route("/v", visitor_consent_default);
30308
+ app65.route("/sites", sites_default);
30309
+ app65.route("/listings", listings_default);
30310
+ app65.route("/v", visitor_event_default);
30311
+ app65.route("/v", visitor_consent_default);
30138
30312
  var htmlCache = /* @__PURE__ */ new Map();
30139
30313
  var brandLogoPath = "/brand/maxy-monochrome.png";
30140
30314
  var brandIconPath = "/brand/maxy-monochrome.png";
@@ -30289,7 +30463,7 @@ function brandedPublicHtml(agentSlug) {
30289
30463
  function agentUnavailableHtml() {
30290
30464
  return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>${escapeHtml(BRAND.productName)}</title></head><body style="font-family:system-ui,sans-serif;max-width:32rem;margin:4rem auto;padding:0 1.5rem;color:#222"><h1 style="font-size:1.25rem">Agent unavailable</h1><p>This agent isn't available right now. If you reached this page from a saved link, the agent may have been turned off.</p></body></html>`;
30291
30465
  }
30292
- app64.get("/", (c) => {
30466
+ app65.get("/", (c) => {
30293
30467
  const host = (c.req.header("host") ?? "").split(":")[0];
30294
30468
  const klass = classifyHost(host, getOperatorDomains(), isPublicHost);
30295
30469
  if (klass === "operator") {
@@ -30311,12 +30485,12 @@ app64.get("/", (c) => {
30311
30485
  console.log(`[host-class] host=${host} class=admin served=index.html`);
30312
30486
  return c.html(cachedHtml("index.html"));
30313
30487
  });
30314
- app64.get("/public", (c) => {
30488
+ app65.get("/public", (c) => {
30315
30489
  const host = (c.req.header("host") ?? "").split(":")[0];
30316
30490
  if (isPublicHost(host)) return c.text("Not found", 404);
30317
30491
  return c.html(cachedHtml("public.html"));
30318
30492
  });
30319
- app64.get("/public-chat", (c) => {
30493
+ app65.get("/public-chat", (c) => {
30320
30494
  const host = (c.req.header("host") ?? "").split(":")[0];
30321
30495
  if (isPublicHost(host)) return c.text("Not found", 404);
30322
30496
  return c.html(cachedHtml("public.html"));
@@ -30335,9 +30509,9 @@ async function logViewerFetch(c, next) {
30335
30509
  duration_ms: Date.now() - start
30336
30510
  });
30337
30511
  }
30338
- app64.use("/vnc-viewer.html", logViewerFetch);
30339
- app64.use("/vnc-popout.html", logViewerFetch);
30340
- app64.get("/vnc-popout.html", (c) => {
30512
+ app65.use("/vnc-viewer.html", logViewerFetch);
30513
+ app65.use("/vnc-popout.html", logViewerFetch);
30514
+ app65.get("/vnc-popout.html", (c) => {
30341
30515
  let html = htmlCache.get("vnc-popout.html");
30342
30516
  if (!html) {
30343
30517
  html = readFileSync45(resolve41(process.cwd(), "public", "vnc-popout.html"), "utf-8");
@@ -30350,7 +30524,7 @@ app64.get("/vnc-popout.html", (c) => {
30350
30524
  }
30351
30525
  return c.html(html);
30352
30526
  });
30353
- app64.post("/api/vnc/client-event", async (c) => {
30527
+ app65.post("/api/vnc/client-event", async (c) => {
30354
30528
  let body;
30355
30529
  try {
30356
30530
  body = await c.req.json();
@@ -30371,11 +30545,11 @@ app64.post("/api/vnc/client-event", async (c) => {
30371
30545
  });
30372
30546
  return c.json({ ok: true });
30373
30547
  });
30374
- app64.get("/g/:slug", (c) => {
30548
+ app65.get("/g/:slug", (c) => {
30375
30549
  return c.html(brandedPublicHtml(resolveDefaultSlug() ?? void 0));
30376
30550
  });
30377
30551
  for (const pwa of PWA_SURFACES) {
30378
- app64.get(pwa.manifestPath, (c) => {
30552
+ app65.get(pwa.manifestPath, (c) => {
30379
30553
  const manifest = buildManifest(pwa, {
30380
30554
  productName: BRAND.productName,
30381
30555
  appIcon192: brandAppIcon192Path,
@@ -30391,7 +30565,7 @@ for (const pwa of PWA_SURFACES) {
30391
30565
  return c.body(JSON.stringify(manifest));
30392
30566
  });
30393
30567
  }
30394
- app64.get("/sw.js", (c) => {
30568
+ app65.get("/sw.js", (c) => {
30395
30569
  if (SW_SOURCE == null) {
30396
30570
  console.error("[pwa] op=sw status=500 reason=sw-source-missing");
30397
30571
  return c.text("Service worker unavailable", 500);
@@ -30400,12 +30574,12 @@ app64.get("/sw.js", (c) => {
30400
30574
  console.log(`[pwa] op=sw status=200 ct=${SW_CONTENT_TYPE}`);
30401
30575
  return c.body(SW_SOURCE);
30402
30576
  });
30403
- app64.get("/graph", (c) => {
30577
+ app65.get("/graph", (c) => {
30404
30578
  const host = (c.req.header("host") ?? "").split(":")[0];
30405
30579
  if (isPublicHost(host) || isOperatorHost(host, getOperatorDomains())) return c.text("Not found", 404);
30406
30580
  return c.html(cachedHtml("graph.html"));
30407
30581
  });
30408
- app64.get("/chat", (c) => {
30582
+ app65.get("/chat", (c) => {
30409
30583
  const host = (c.req.header("host") ?? "").split(":")[0];
30410
30584
  if (isOperatorHost(host, getOperatorDomains())) {
30411
30585
  console.log(`[host-class] host=${host} class=operator served=operator.html`);
@@ -30414,32 +30588,37 @@ app64.get("/chat", (c) => {
30414
30588
  if (isPublicHost(host)) return c.text("Not found", 404);
30415
30589
  return c.html(cachedHtml("chat.html"));
30416
30590
  });
30417
- app64.get("/data", (c) => {
30591
+ app65.get("/data", (c) => {
30418
30592
  const host = (c.req.header("host") ?? "").split(":")[0];
30419
30593
  if (isPublicHost(host)) return c.text("Not found", 404);
30420
30594
  return c.html(cachedHtml("data.html"));
30421
30595
  });
30422
- app64.get("/tasks", (c) => {
30596
+ app65.get("/tasks", (c) => {
30423
30597
  const host = (c.req.header("host") ?? "").split(":")[0];
30424
30598
  if (isPublicHost(host)) return c.text("Not found", 404);
30425
30599
  return c.html(cachedHtml("tasks.html"));
30426
30600
  });
30427
- app64.get("/activity", (c) => {
30601
+ app65.get("/activity", (c) => {
30428
30602
  const host = (c.req.header("host") ?? "").split(":")[0];
30429
30603
  if (isPublicHost(host)) return c.text("Not found", 404);
30430
30604
  return c.html(cachedHtml("activity.html"));
30431
30605
  });
30432
- app64.get("/calendar", (c) => {
30606
+ app65.get("/calendar", (c) => {
30433
30607
  const host = (c.req.header("host") ?? "").split(":")[0];
30434
30608
  if (isPublicHost(host)) return c.text("Not found", 404);
30435
30609
  return c.html(cachedHtml("calendar.html"));
30436
30610
  });
30437
- app64.get("/browser", (c) => {
30611
+ app65.get("/routines", (c) => {
30612
+ const host = (c.req.header("host") ?? "").split(":")[0];
30613
+ if (isPublicHost(host)) return c.text("Not found", 404);
30614
+ return c.html(cachedHtml("routines.html"));
30615
+ });
30616
+ app65.get("/browser", (c) => {
30438
30617
  const host = (c.req.header("host") ?? "").split(":")[0];
30439
30618
  if (isPublicHost(host) || isOperatorHost(host, getOperatorDomains())) return c.text("Not found", 404);
30440
30619
  return c.html(cachedHtml("browser.html"));
30441
30620
  });
30442
- app64.get("/:slug", async (c, next) => {
30621
+ app65.get("/:slug", async (c, next) => {
30443
30622
  const slug = c.req.param("slug");
30444
30623
  if (AGENT_SLUG_PATTERN.test(`/${slug}`)) {
30445
30624
  const account = resolveAccount();
@@ -30454,13 +30633,13 @@ app64.get("/:slug", async (c, next) => {
30454
30633
  await next();
30455
30634
  });
30456
30635
  if (brandFaviconPath !== "/favicon.ico") {
30457
- app64.get("/favicon.ico", (c) => {
30636
+ app65.get("/favicon.ico", (c) => {
30458
30637
  c.header("Cache-Control", "public, max-age=300");
30459
30638
  return c.redirect(brandFaviconPath, 302);
30460
30639
  });
30461
30640
  }
30462
- app64.use("/*", serveStatic({ root: "./public" }));
30463
- app64.all("*", (c) => {
30641
+ app65.use("/*", serveStatic({ root: "./public" }));
30642
+ app65.all("*", (c) => {
30464
30643
  const host = (c.req.header("host") ?? "").split(":")[0];
30465
30644
  const path3 = c.req.path;
30466
30645
  if (isPublicHost(host)) {
@@ -30474,7 +30653,7 @@ app64.all("*", (c) => {
30474
30653
  });
30475
30654
  var port = requirePortEnv("MAXY_UI_INTERNAL_PORT", { tag: "ui-server" });
30476
30655
  var hostname = process.env.HOSTNAME ?? "127.0.0.1";
30477
- var httpServer = serve({ fetch: app64.fetch, port, hostname });
30656
+ var httpServer = serve({ fetch: app65.fetch, port, hostname });
30478
30657
  console.log(`${BRAND.productName} listening on http://${hostname}:${port}`);
30479
30658
  {
30480
30659
  const reconcilePlatformRoot = process.env.MAXY_PLATFORM_ROOT ?? join47(__dirname, "..");
@@ -30516,6 +30695,31 @@ console.log(`${BRAND.productName} listening on http://${hostname}:${port}`);
30516
30695
  }
30517
30696
  });
30518
30697
  }
30698
+ {
30699
+ const DREAM_CYCLE_SWEEP_INTERVAL_MS = 36e5;
30700
+ const dreamPlatformRoot = process.env.MAXY_PLATFORM_ROOT ?? join47(__dirname, "..");
30701
+ const dreamSweepScript = resolve41(dreamPlatformRoot, "plugins/memory/mcp/dist/scripts/dream-cycle-sweep.js");
30702
+ registerLoop({
30703
+ name: "dream-cycle-sweep",
30704
+ intervalMs: DREAM_CYCLE_SWEEP_INTERVAL_MS,
30705
+ firstRunDelayMs: 3e4,
30706
+ detached: true,
30707
+ run: (ctx) => {
30708
+ if (!existsSync42(dreamSweepScript)) return;
30709
+ try {
30710
+ const child = spawn3(process.execPath, [dreamSweepScript], {
30711
+ env: { ...process.env, PLATFORM_ROOT: dreamPlatformRoot },
30712
+ stdio: "inherit"
30713
+ });
30714
+ child.unref();
30715
+ ctx.child(child.pid);
30716
+ child.on("error", (err) => console.error(`[dream-cycle-sweep] spawn-failed err="${err.message}"`));
30717
+ } catch (err) {
30718
+ console.error(`[dream-cycle-sweep] spawn-failed err="${err.message}"`);
30719
+ }
30720
+ }
30721
+ });
30722
+ }
30519
30723
  {
30520
30724
  const outlookPlatformRoot = process.env.MAXY_PLATFORM_ROOT ?? join47(__dirname, "..");
30521
30725
  const outlookScript = resolve41(outlookPlatformRoot, "plugins/outlook/mcp/dist/scripts/complete-registration.js");
@@ -30825,7 +31029,7 @@ for (const m of SUBAPP_MANIFEST) {
30825
31029
  }
30826
31030
  try {
30827
31031
  const registered = [];
30828
- for (const r of app64.routes ?? []) {
31032
+ for (const r of app65.routes ?? []) {
30829
31033
  if (typeof r.path !== "string" || r.path.includes(":") || r.path.includes("*")) continue;
30830
31034
  if (AGENT_SLUG_PATTERN.test(r.path)) {
30831
31035
  registered.push({ method: (r.method ?? "ALL").toUpperCase(), path: r.path });