@rubytech/create-sitedesk-code 0.1.386 → 0.1.388

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 (306) hide show
  1. package/dist/__tests__/cron-heartbeat-registration.test.js +5 -0
  2. package/dist/cron-registration.js +1 -0
  3. package/dist/index.js +4 -0
  4. package/package.json +1 -1
  5. package/payload/platform/config/brand.json +3 -3
  6. package/payload/platform/neo4j/schema.cypher +36 -1
  7. package/payload/platform/plugins/.claude-plugin/marketplace.json +5 -5
  8. package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +61 -1
  9. package/payload/platform/plugins/docs/references/graph.md +11 -0
  10. package/payload/platform/plugins/docs/references/plugins-guide.md +1 -0
  11. package/payload/platform/plugins/docs/references/sweep-guide.md +43 -0
  12. package/payload/platform/plugins/memory/references/schema-estate-agent.md +34 -0
  13. package/payload/platform/plugins/scheduling/PLUGIN.md +17 -1
  14. package/payload/platform/plugins/scheduling/mcp/dist/index.js +12 -0
  15. package/payload/platform/plugins/scheduling/mcp/dist/index.js.map +1 -1
  16. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/agent-dispatch.test.d.ts +2 -0
  17. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/agent-dispatch.test.d.ts.map +1 -0
  18. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/agent-dispatch.test.js +101 -0
  19. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/agent-dispatch.test.js.map +1 -0
  20. package/payload/platform/plugins/scheduling/mcp/dist/lib/agent-dispatch.d.ts +54 -0
  21. package/payload/platform/plugins/scheduling/mcp/dist/lib/agent-dispatch.d.ts.map +1 -0
  22. package/payload/platform/plugins/scheduling/mcp/dist/lib/agent-dispatch.js +117 -0
  23. package/payload/platform/plugins/scheduling/mcp/dist/lib/agent-dispatch.js.map +1 -0
  24. package/payload/platform/plugins/scheduling/mcp/dist/lib/schedule-classify.d.ts +7 -0
  25. package/payload/platform/plugins/scheduling/mcp/dist/lib/schedule-classify.d.ts.map +1 -1
  26. package/payload/platform/plugins/scheduling/mcp/dist/lib/schedule-classify.js +6 -3
  27. package/payload/platform/plugins/scheduling/mcp/dist/lib/schedule-classify.js.map +1 -1
  28. package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/agent-turn-dispatch.test.d.ts +2 -0
  29. package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/agent-turn-dispatch.test.d.ts.map +1 -0
  30. package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/agent-turn-dispatch.test.js +88 -0
  31. package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/agent-turn-dispatch.test.js.map +1 -0
  32. package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/standing-audit.test.d.ts +2 -0
  33. package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/standing-audit.test.d.ts.map +1 -0
  34. package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/standing-audit.test.js +77 -0
  35. package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/standing-audit.test.js.map +1 -0
  36. package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.d.ts +59 -0
  37. package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.d.ts.map +1 -0
  38. package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.js +131 -0
  39. package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.js.map +1 -0
  40. package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.js +62 -15
  41. package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.js.map +1 -1
  42. package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-event-agent.test.d.ts +2 -0
  43. package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-event-agent.test.d.ts.map +1 -0
  44. package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-event-agent.test.js +110 -0
  45. package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-event-agent.test.js.map +1 -0
  46. package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-get-agent.test.d.ts +2 -0
  47. package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-get-agent.test.d.ts.map +1 -0
  48. package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-get-agent.test.js +35 -0
  49. package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-get-agent.test.js.map +1 -0
  50. package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-update-agent.test.d.ts +2 -0
  51. package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-update-agent.test.d.ts.map +1 -0
  52. package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-update-agent.test.js +81 -0
  53. package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-update-agent.test.js.map +1 -0
  54. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-event.d.ts +7 -0
  55. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-event.d.ts.map +1 -1
  56. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-event.js +21 -4
  57. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-event.js.map +1 -1
  58. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-get.d.ts +4 -0
  59. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-get.d.ts.map +1 -1
  60. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-get.js +6 -0
  61. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-get.js.map +1 -1
  62. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-update.d.ts +2 -1
  63. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-update.d.ts.map +1 -1
  64. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-update.js +32 -1
  65. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-update.js.map +1 -1
  66. package/payload/platform/plugins/sweep/.claude-plugin/plugin.json +8 -0
  67. package/payload/platform/plugins/sweep/PLUGIN.md +15 -0
  68. package/payload/platform/plugins/sweep/skills/sweep-workflow/SKILL.md +113 -0
  69. package/payload/platform/plugins/whatsapp/PLUGIN.md +1 -1
  70. package/payload/platform/plugins/whatsapp/mcp/dist/index.js +19 -4
  71. package/payload/platform/plugins/whatsapp/mcp/dist/index.js.map +1 -1
  72. package/payload/platform/plugins/whatsapp/references/channels-whatsapp.md +9 -4
  73. package/payload/platform/plugins/whatsapp/skills/manage-whatsapp-config/SKILL.md +12 -0
  74. package/payload/platform/scripts/seed-neo4j.sh +38 -0
  75. package/payload/platform/services/whatsapp-channel/dist/notification.d.ts +5 -0
  76. package/payload/platform/services/whatsapp-channel/dist/notification.d.ts.map +1 -1
  77. package/payload/platform/services/whatsapp-channel/dist/notification.js.map +1 -1
  78. package/payload/platform/services/whatsapp-channel/dist/server.js +1 -1
  79. package/payload/platform/services/whatsapp-channel/dist/server.js.map +1 -1
  80. package/payload/premium-plugins/.claude-plugin/marketplace.json +0 -15
  81. package/payload/server/public/assets/{AdminLoginScreens-oxqHKL3C.js → AdminLoginScreens-BejIjbmU.js} +1 -1
  82. package/payload/server/public/assets/{AdminShell-DBD6ruS1.js → AdminShell-D2-uBSB5.js} +1 -1
  83. package/payload/server/public/assets/{Checkbox-yr8-ftrE.js → Checkbox-1F1tzqca.js} +1 -1
  84. package/payload/server/public/assets/Transcript-DkGa4CQH.js +2 -0
  85. package/payload/server/public/assets/{admin-CQfZnuFy.js → admin-DqQARkjy.js} +1 -1
  86. package/payload/server/public/assets/{browser-DbdPeDK1.js → browser-nDtEK6RC.js} +1 -1
  87. package/payload/server/public/assets/{calendar-CFdOhe7Q.js → calendar-CO4Bwmho.js} +1 -1
  88. package/payload/server/public/assets/chat-DeIge_bC.js +1 -0
  89. package/payload/server/public/assets/chevron-left-DhVdq0aN.js +1 -0
  90. package/payload/server/public/assets/data-B1GIdzHk.js +1 -0
  91. package/payload/server/public/assets/{graph-Bluocsf_.js → graph-DFyicKd7.js} +1 -1
  92. package/payload/server/public/assets/{graph-labels-BcLJmY-v.js → graph-labels-D3BQdcpD.js} +1 -1
  93. package/payload/server/public/assets/{operator-DjK3MBSS.js → operator-BxrjWdT9.js} +1 -1
  94. package/payload/server/public/assets/{page-DQNYTb2d.js → page-ByDLq_o1.js} +1 -1
  95. package/payload/server/public/assets/{page-zJQTRXB2.js → page-D-Ep4bXd.js} +1 -1
  96. package/payload/server/public/assets/{public-CHCniosp.js → public-DbdqfdYq.js} +1 -1
  97. package/payload/server/public/assets/{rotate-ccw-JDfwjfIL.js → rotate-ccw-BkX8HODe.js} +1 -1
  98. package/payload/server/public/assets/{useSubAccountSwitcher-CfI3J2IX.css → useSubAccountSwitcher-DS0iqSkP.css} +1 -1
  99. package/payload/server/public/browser.html +4 -4
  100. package/payload/server/public/calendar.html +5 -5
  101. package/payload/server/public/chat.html +8 -8
  102. package/payload/server/public/data.html +7 -7
  103. package/payload/server/public/graph.html +8 -8
  104. package/payload/server/public/index.html +10 -10
  105. package/payload/server/public/operator.html +10 -10
  106. package/payload/server/public/public.html +8 -8
  107. package/payload/server/server.js +713 -331
  108. package/payload/platform/plugins/sales/.claude-plugin/plugin.json +0 -8
  109. package/payload/platform/plugins/sales/PLUGIN.md +0 -106
  110. package/payload/platform/plugins/sales/references/close-tracking.md +0 -69
  111. package/payload/platform/plugins/sales/references/comparisons.md +0 -99
  112. package/payload/platform/plugins/sales/references/competitive-positioning.md +0 -51
  113. package/payload/platform/plugins/sales/references/faq.md +0 -73
  114. package/payload/platform/plugins/sales/references/objection-handling.md +0 -157
  115. package/payload/platform/plugins/sales/references/pricing.md +0 -101
  116. package/payload/premium-plugins/teaching/.claude-plugin/plugin.json +0 -8
  117. package/payload/premium-plugins/teaching/PLUGIN.md +0 -58
  118. package/payload/premium-plugins/teaching/skills/interactive-tutor/SKILL.md +0 -59
  119. package/payload/premium-plugins/teaching/skills/interactive-tutor/references/assessment.md +0 -70
  120. package/payload/premium-plugins/teaching/skills/interactive-tutor/references/classroom-conduct.md +0 -43
  121. package/payload/premium-plugins/teaching/skills/interactive-tutor/references/teaching-modes.md +0 -83
  122. package/payload/premium-plugins/teaching/skills/lesson-planner/SKILL.md +0 -48
  123. package/payload/premium-plugins/teaching/skills/lesson-planner/references/context-gathering.md +0 -41
  124. package/payload/premium-plugins/teaching/skills/lesson-planner/references/plan-structure.md +0 -94
  125. package/payload/premium-plugins/teaching/skills/study-pack-builder/SKILL.md +0 -52
  126. package/payload/premium-plugins/teaching/skills/study-pack-builder/references/disaggregation.md +0 -49
  127. package/payload/premium-plugins/teaching/skills/study-pack-builder/references/materials.md +0 -116
  128. package/payload/premium-plugins/venture-studio/.claude-plugin/plugin.json +0 -8
  129. package/payload/premium-plugins/venture-studio/PLUGIN.md +0 -128
  130. package/payload/premium-plugins/venture-studio/bin/scaffold.sh +0 -116
  131. package/payload/premium-plugins/venture-studio/skills/brand-pack/SKILL.md +0 -256
  132. package/payload/premium-plugins/venture-studio/skills/brand-pack/references/color-psychology.md +0 -118
  133. package/payload/premium-plugins/venture-studio/skills/investor-data-room/SKILL.md +0 -436
  134. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/business-plan-template.md +0 -64
  135. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/competitive-battlecard.md +0 -37
  136. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/competitor-analysis.md +0 -32
  137. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/compliance-research-checklist.md +0 -53
  138. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/data-room-structure.md +0 -88
  139. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/deck-blueprint-template.md +0 -39
  140. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/design-tokens-application.md +0 -79
  141. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/html-pdf-pipeline.md +0 -236
  142. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/internal-workings-scrub.md +0 -33
  143. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/monetization-strategy.md +0 -35
  144. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/pricing-strategy.md +0 -37
  145. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/strategy-frameworks.md +0 -46
  146. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/termsheet-template.md +0 -88
  147. package/payload/premium-plugins/venture-studio/skills/investor-data-room/templates/prospectus/index.html +0 -1565
  148. package/payload/premium-plugins/venture-studio/skills/investor-data-room/templates/prospectus/render-pdf.mjs +0 -91
  149. package/payload/premium-plugins/venture-studio/skills/investor-data-room/templates/prospectus/term_sheet.html +0 -715
  150. package/payload/premium-plugins/venture-studio/skills/legal-essentials/SKILL.md +0 -65
  151. package/payload/premium-plugins/venture-studio/skills/office-hours/SKILL.md +0 -587
  152. package/payload/premium-plugins/venture-studio/skills/prototype-host/SKILL.md +0 -179
  153. package/payload/premium-plugins/venture-studio/skills/prototype-host/references/cloudflared-ingress-edit.md +0 -81
  154. package/payload/premium-plugins/venture-studio/skills/prototype-host/references/scaffold-frameworks.md +0 -60
  155. package/payload/premium-plugins/venture-studio/skills/prototype-host/references/systemd-user-service.md +0 -104
  156. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/SKILL.md +0 -342
  157. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/aarrr-metrics.md +0 -275
  158. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/assumption-testing.md +0 -93
  159. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/boolean-search.md +0 -308
  160. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/build-measure-learn.md +0 -262
  161. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/business-model-canvas.md +0 -171
  162. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/commitment-signals.md +0 -246
  163. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/design-thinking.md +0 -183
  164. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/earlyvangelist.md +0 -190
  165. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/first-principles.md +0 -58
  166. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/fishbone.md +0 -114
  167. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/five-whys.md +0 -43
  168. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/ice-scoring.md +0 -237
  169. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/innovation-accounting.md +0 -290
  170. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/jtbd.md +0 -105
  171. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/landing-page.md +0 -361
  172. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/market-sizing.md +0 -58
  173. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/market-type.md +0 -167
  174. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/mom-test.md +0 -193
  175. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/mvp-types.md +0 -200
  176. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/og-images.md +0 -239
  177. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/pareto.md +0 -103
  178. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/persona-development.md +0 -291
  179. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/pivot-types.md +0 -225
  180. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/positioning-statement.md +0 -179
  181. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/prd.md +0 -363
  182. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/pre-mortem.md +0 -74
  183. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/problem-validation.md +0 -253
  184. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/product-market-fit.md +0 -256
  185. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/research-synthesis.md +0 -276
  186. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/strategy-red-team.md +0 -41
  187. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/three-engines-of-growth.md +0 -248
  188. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/validation-tests.md +0 -89
  189. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/value-proposition-canvas.md +0 -121
  190. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/win-loss-analysis.md +0 -242
  191. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/workflow-mapping.md +0 -271
  192. package/payload/premium-plugins/writer-craft/.claude-plugin/plugin.json +0 -21
  193. package/payload/premium-plugins/writer-craft/PLUGIN.md +0 -134
  194. package/payload/premium-plugins/writer-craft/agents/writer-craft--manuscript-reviewer.md +0 -108
  195. package/payload/premium-plugins/writer-craft/lib/mcp-lifeline/dist/index.d.ts +0 -8
  196. package/payload/premium-plugins/writer-craft/lib/mcp-lifeline/dist/index.d.ts.map +0 -1
  197. package/payload/premium-plugins/writer-craft/lib/mcp-lifeline/dist/index.js +0 -71
  198. package/payload/premium-plugins/writer-craft/lib/mcp-lifeline/dist/index.js.map +0 -1
  199. package/payload/premium-plugins/writer-craft/lib/mcp-lifeline/package.json +0 -7
  200. package/payload/premium-plugins/writer-craft/lib/mcp-spawn-tee/index.js +0 -193
  201. package/payload/premium-plugins/writer-craft/lib/mcp-spawn-tee/package.json +0 -3
  202. package/payload/premium-plugins/writer-craft/lib/mcp-stderr-tee/dist/index.d.ts +0 -51
  203. package/payload/premium-plugins/writer-craft/lib/mcp-stderr-tee/dist/index.d.ts.map +0 -1
  204. package/payload/premium-plugins/writer-craft/lib/mcp-stderr-tee/dist/index.js +0 -196
  205. package/payload/premium-plugins/writer-craft/lib/mcp-stderr-tee/dist/index.js.map +0 -1
  206. package/payload/premium-plugins/writer-craft/lib/mcp-stderr-tee/package.json +0 -7
  207. package/payload/premium-plugins/writer-craft/mcp/dist/cli/ingest-session-text.d.ts +0 -3
  208. package/payload/premium-plugins/writer-craft/mcp/dist/cli/ingest-session-text.d.ts.map +0 -1
  209. package/payload/premium-plugins/writer-craft/mcp/dist/cli/ingest-session-text.js +0 -58
  210. package/payload/premium-plugins/writer-craft/mcp/dist/cli/ingest-session-text.js.map +0 -1
  211. package/payload/premium-plugins/writer-craft/mcp/dist/index.d.ts +0 -3
  212. package/payload/premium-plugins/writer-craft/mcp/dist/index.d.ts.map +0 -1
  213. package/payload/premium-plugins/writer-craft/mcp/dist/index.js +0 -403
  214. package/payload/premium-plugins/writer-craft/mcp/dist/index.js.map +0 -1
  215. package/payload/premium-plugins/writer-craft/mcp/dist/lib/neo4j.d.ts +0 -14
  216. package/payload/premium-plugins/writer-craft/mcp/dist/lib/neo4j.d.ts.map +0 -1
  217. package/payload/premium-plugins/writer-craft/mcp/dist/lib/neo4j.js +0 -47
  218. package/payload/premium-plugins/writer-craft/mcp/dist/lib/neo4j.js.map +0 -1
  219. package/payload/premium-plugins/writer-craft/mcp/dist/lib/voice-corpus.d.ts +0 -117
  220. package/payload/premium-plugins/writer-craft/mcp/dist/lib/voice-corpus.d.ts.map +0 -1
  221. package/payload/premium-plugins/writer-craft/mcp/dist/lib/voice-corpus.js +0 -138
  222. package/payload/premium-plugins/writer-craft/mcp/dist/lib/voice-corpus.js.map +0 -1
  223. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-distil-profile.d.ts +0 -90
  224. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-distil-profile.d.ts.map +0 -1
  225. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-distil-profile.js +0 -609
  226. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-distil-profile.js.map +0 -1
  227. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-ingest-session-text.d.ts +0 -19
  228. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-ingest-session-text.d.ts.map +0 -1
  229. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-ingest-session-text.js +0 -124
  230. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-ingest-session-text.js.map +0 -1
  231. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-record-feedback.d.ts +0 -38
  232. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-record-feedback.d.ts.map +0 -1
  233. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-record-feedback.js +0 -93
  234. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-record-feedback.js.map +0 -1
  235. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.d.ts +0 -61
  236. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.d.ts.map +0 -1
  237. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.js +0 -171
  238. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-retrieve-conditioning.js.map +0 -1
  239. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-tag-content.d.ts +0 -35
  240. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-tag-content.d.ts.map +0 -1
  241. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-tag-content.js +0 -127
  242. package/payload/premium-plugins/writer-craft/mcp/dist/tools/voice-tag-content.js.map +0 -1
  243. package/payload/premium-plugins/writer-craft/mcp/package-lock.json +0 -1327
  244. package/payload/premium-plugins/writer-craft/mcp/package.json +0 -19
  245. package/payload/premium-plugins/writer-craft/mcp/scripts/smoke.mjs +0 -420
  246. package/payload/premium-plugins/writer-craft/mcp/src/index.ts +0 -457
  247. package/payload/premium-plugins/writer-craft/mcp/src/lib/neo4j.ts +0 -56
  248. package/payload/premium-plugins/writer-craft/mcp/src/lib/voice-corpus.ts +0 -154
  249. package/payload/premium-plugins/writer-craft/mcp/src/tools/voice-distil-profile.ts +0 -833
  250. package/payload/premium-plugins/writer-craft/mcp/src/tools/voice-ingest-session-text.ts +0 -153
  251. package/payload/premium-plugins/writer-craft/mcp/src/tools/voice-record-feedback.ts +0 -148
  252. package/payload/premium-plugins/writer-craft/mcp/src/tools/voice-retrieve-conditioning.ts +0 -270
  253. package/payload/premium-plugins/writer-craft/mcp/src/tools/voice-tag-content.ts +0 -181
  254. package/payload/premium-plugins/writer-craft/mcp/tsconfig.json +0 -8
  255. package/payload/premium-plugins/writer-craft/skills/citation-style/SKILL.md +0 -94
  256. package/payload/premium-plugins/writer-craft/skills/citation-style/references/book-and-chapter-models.md +0 -77
  257. package/payload/premium-plugins/writer-craft/skills/citation-style/references/citation-rules.md +0 -103
  258. package/payload/premium-plugins/writer-craft/skills/citation-style/references/journal-article-models.md +0 -74
  259. package/payload/premium-plugins/writer-craft/skills/citation-style/references/other-source-models.md +0 -146
  260. package/payload/premium-plugins/writer-craft/skills/citation-style/references/reference-list-rules.md +0 -70
  261. package/payload/premium-plugins/writer-craft/skills/editorial-practice/SKILL.md +0 -108
  262. package/payload/premium-plugins/writer-craft/skills/editorial-practice/references/copyediting.md +0 -73
  263. package/payload/premium-plugins/writer-craft/skills/editorial-practice/references/developmental-editing.md +0 -85
  264. package/payload/premium-plugins/writer-craft/skills/editorial-practice/references/genre-specific-editing.md +0 -78
  265. package/payload/premium-plugins/writer-craft/skills/editorial-practice/references/line-editing.md +0 -55
  266. package/payload/premium-plugins/writer-craft/skills/editorial-practice/references/self-editing.md +0 -89
  267. package/payload/premium-plugins/writer-craft/skills/persuasive-storytelling/SKILL.md +0 -114
  268. package/payload/premium-plugins/writer-craft/skills/persuasive-storytelling/references/audience-analysis.md +0 -73
  269. package/payload/premium-plugins/writer-craft/skills/persuasive-storytelling/references/crafting-persuasive-story.md +0 -76
  270. package/payload/premium-plugins/writer-craft/skills/persuasive-storytelling/references/persuasion-case-studies.md +0 -67
  271. package/payload/premium-plugins/writer-craft/skills/persuasive-storytelling/references/transformation-framework.md +0 -86
  272. package/payload/premium-plugins/writer-craft/skills/point-of-view/SKILL.md +0 -97
  273. package/payload/premium-plugins/writer-craft/skills/point-of-view/references/indirect-narration.md +0 -72
  274. package/payload/premium-plugins/writer-craft/skills/point-of-view/references/pov-types-and-voice.md +0 -91
  275. package/payload/premium-plugins/writer-craft/skills/point-of-view/references/protagonist-filter.md +0 -71
  276. package/payload/premium-plugins/writer-craft/skills/point-of-view/references/tense-and-person.md +0 -85
  277. package/payload/premium-plugins/writer-craft/skills/prose-craft/SKILL.md +0 -100
  278. package/payload/premium-plugins/writer-craft/skills/prose-craft/references/punctuation-and-grammar.md +0 -72
  279. package/payload/premium-plugins/writer-craft/skills/prose-craft/references/repetition.md +0 -71
  280. package/payload/premium-plugins/writer-craft/skills/prose-craft/references/sound-and-rhythm.md +0 -64
  281. package/payload/premium-plugins/writer-craft/skills/prose-craft/references/word-economy.md +0 -93
  282. package/payload/premium-plugins/writer-craft/skills/reader-engagement/SKILL.md +0 -100
  283. package/payload/premium-plugins/writer-craft/skills/reader-engagement/references/cause-effect-setup-payoff.md +0 -79
  284. package/payload/premium-plugins/writer-craft/skills/reader-engagement/references/conflict-escalation.md +0 -81
  285. package/payload/premium-plugins/writer-craft/skills/reader-engagement/references/hooking-readers.md +0 -67
  286. package/payload/premium-plugins/writer-craft/skills/reader-engagement/references/neurochemistry-of-engagement.md +0 -94
  287. package/payload/premium-plugins/writer-craft/skills/review-manuscript/SKILL.md +0 -111
  288. package/payload/premium-plugins/writer-craft/skills/review-manuscript/references/review-manuscript-checklist.md +0 -119
  289. package/payload/premium-plugins/writer-craft/skills/review-prose/SKILL.md +0 -99
  290. package/payload/premium-plugins/writer-craft/skills/review-prose/references/prose-review-checklist.md +0 -112
  291. package/payload/premium-plugins/writer-craft/skills/review-scene/SKILL.md +0 -99
  292. package/payload/premium-plugins/writer-craft/skills/review-scene/references/scene-analysis-framework.md +0 -95
  293. package/payload/premium-plugins/writer-craft/skills/story-architecture/SKILL.md +0 -106
  294. package/payload/premium-plugins/writer-craft/skills/story-architecture/references/blueprinting-and-scene-cards.md +0 -118
  295. package/payload/premium-plugins/writer-craft/skills/story-architecture/references/inner-issue-and-protagonist-goal.md +0 -66
  296. package/payload/premium-plugins/writer-craft/skills/story-architecture/references/misbelief-desire-worldview.md +0 -87
  297. package/payload/premium-plugins/writer-craft/skills/story-architecture/references/origin-scenes-and-escalation.md +0 -82
  298. package/payload/premium-plugins/writer-craft/skills/story-blueprint/SKILL.md +0 -133
  299. package/payload/premium-plugins/writer-craft/skills/story-blueprint/references/blueprinting-exercises.md +0 -118
  300. package/payload/premium-plugins/writer-craft/skills/story-blueprint/references/blueprinting-process.md +0 -128
  301. package/payload/premium-plugins/writer-craft/skills/voice-mirror/SKILL.md +0 -241
  302. package/payload/server/public/assets/Transcript-FX_w6no6.js +0 -2
  303. package/payload/server/public/assets/chat-BunxcNDk.js +0 -1
  304. package/payload/server/public/assets/chevron-left-Cngmu0Py.js +0 -1
  305. package/payload/server/public/assets/data-IqZlMSwG.js +0 -1
  306. /package/payload/server/public/assets/{useSubAccountSwitcher-BpQ3oKiJ.js → useSubAccountSwitcher-DMbRhLPv.js} +0 -0
@@ -1,128 +0,0 @@
1
- # The Blueprinting Process — Step by Step
2
-
3
- ## Overview
4
-
5
- The blueprint is not a traditional outline. It is built scene by scene, grounded in the protagonist's internal story, and developed iteratively alongside drafting. Plot is the servant of story — external events exist to force the internal transformation.
6
-
7
- The process starts with the internal architecture and builds outward.
8
-
9
- ## Step 1: The What If
10
-
11
- Every story begins with a premise. A story-worthy What If must contain three elements:
12
-
13
- 1. **Context** — the specific world, circumstances, and relationships that make the situation meaningful
14
- 2. **Conflict** — not just external obstacle, but the seed of internal struggle
15
- 3. **A point** — the thematic question the story will interrogate
16
-
17
- ### Testing Your What If
18
- A neutral What If is not story-worthy:
19
- - "What if a woman got a new job?" → neutral, no internal conflict implied
20
- - "What if a woman who built her identity around being indispensable at work was promoted into a role where she has to delegate everything?" → story-worthy, implies collision between identity and situation
21
-
22
- The What If is not a plot summary. It is closer to a thesis statement for the story's meaning.
23
-
24
- ## Step 2: The Protagonist
25
-
26
- The protagonist is not whoever the story happens to — it's the person whose internal change the story is about.
27
-
28
- ### Key Questions
29
- - Who has the most to lose internally?
30
- - Whose worldview will be most challenged by the What If?
31
- - Who will be forced to change or be destroyed by the attempt to avoid it?
32
-
33
- ### Common Errors
34
- - Introducing too many characters without a clear focal point
35
- - Choosing a protagonist who is too passive or already enlightened
36
- - Confusing the most active character with the most internally conflicted one
37
-
38
- ## Step 3: Misbelief and Desire
39
-
40
- ### The Misbelief
41
- A false conclusion about how the world works, rooted in a specific past experience. Not a character flaw — a coping strategy. It protected the protagonist once; now it imprisons them.
42
-
43
- Excavate until the misbelief is:
44
- - Specific enough to state in one sentence
45
- - Traceable to a concrete origin experience
46
- - Active — currently shaping decisions
47
- - In direct conflict with the desire
48
-
49
- ### The Desire
50
- Something the protagonist has wanted, perhaps for years. The misbelief prevents them from achieving it. Every time they move toward the desire, the misbelief sabotages them.
51
-
52
- ## Step 4: The Origin Scene
53
-
54
- Write the specific moment the misbelief formed. Not a summary — a full scene in the protagonist's subjective POV. The reader must see the emotional logic: how this conclusion made sense at the time.
55
-
56
- ## Step 5: Escalating Backstory
57
-
58
- Write 3-5 scenes from the protagonist's past showing the misbelief deepening:
59
- - Each scene tests or activates the misbelief
60
- - The protagonist acts on it, and the result appears to confirm it
61
- - Each scene escalates in significance — the costs increase
62
- - The pattern explains who the protagonist is on page one
63
-
64
- ## Step 6: The Opening
65
-
66
- The novel begins at the last possible moment — when the protagonist can no longer avoid confronting the thing the misbelief has protected them from.
67
-
68
- The opening scene must accomplish:
69
- 1. Establish the protagonist's internal state (desire, misbelief, the world they believe they're living in)
70
- 2. Introduce the unavoidable external problem
71
- 3. Plant seeds of major internal conflicts
72
- 4. Establish a ticking clock
73
-
74
- ### The Unavoidable External Problem Must:
75
- - Directly threaten or challenge the misbelief
76
- - Activate the long-standing desire
77
- - Have a clear ticking clock
78
- - Have a clear consequence the reader can anticipate from page one
79
-
80
- Write a first-layer version. It will be rewritten many times. Use TK for elements not yet known.
81
-
82
- ## Step 7: The Ending (The Aha Moment)
83
-
84
- Determine the internal climax before constructing the middle.
85
-
86
- The Aha moment is not the plot climax — it is the moment of internal change: when the protagonist confronts and dismantles (or fails to dismantle) their misbelief.
87
-
88
- Requirements:
89
- - **Earned** — pushed to the absolute edge
90
- - **Specific** — a precise scene-level moment
91
- - **Tied to the third rail** — causally connected to everything the plot has put them through
92
-
93
- The ending will change as the story deepens. That is fine.
94
-
95
- ## Step 8: Building Scene Cards
96
-
97
- With opening and ending bookended, build Scene Cards connecting them.
98
-
99
- For each scene:
100
- - **External event**: What happens
101
- - **Internal meaning**: How it forces the internal struggle forward
102
- - **Urgency hook**: What question it raises for the reader
103
- - **Cause**: What scene triggered this one
104
- - **Effect**: What this scene triggers next
105
-
106
- ### Using TK
107
- "To come" — a placeholder for something that must be there but isn't yet known. TKs are not failures; they are honest markers of what needs excavation.
108
-
109
- ### Mining the Past for Plot
110
- Use backstory scenes to generate plot events. The protagonist's misbelief will predictably cause them to react in certain ways — those reactions generate consequences — those consequences become plot.
111
-
112
- ### The Sixth Tick
113
- The last thing that happens before the novel begins. The final moment of the "before" life. Usually the event that makes the unavoidable external problem unavoidable.
114
-
115
- ## Step 9: Writing Forward
116
-
117
- Stories grow in spirals:
118
- - Write a scene → it reveals something about the past
119
- - Revise earlier scenes → reveals something about the future
120
- - Each pass deepens rather than merely extends
121
-
122
- Draft and blueprint simultaneously. The two activities inform each other. Don't complete the blueprint before writing; don't write without blueprinting.
123
-
124
- ### The Plot Trap
125
- Once a plot is in motion, it is tempting to follow external events wherever they lead while the internal story quietly suffocates. For every external event, ask: does it force the internal struggle forward? If not, cut or replace.
126
-
127
- ### Trust the Cards
128
- When lost in a scene, return to the Scene Card. What is the internal meaning of this moment? What must the protagonist realise, resist, or choose?
@@ -1,241 +0,0 @@
1
- ---
2
- name: voice-mirror
3
- description: "Capture the operator's authorial voice from their own writing and apply it to agent-drafted content. Activate when the operator asks to tag historical content as human-authored, to distil a style profile, to retrieve voice exemplars for a drafting task, or to record their edit on an agent draft as feedback. Other drafting skills (email composition, Postiz publisher, property-brochure, prospectus) call `voice-retrieve-conditioning` transparently — `voiceMirror: false` in the calling skill's frontmatter opts out."
4
- ---
5
-
6
- # Voice Mirror
7
-
8
- Distil the operator's own voice from the content they have actually written, and condition agent drafts on it so generated copy reads as theirs. Anthropic models cannot be fine-tuned; voice mimicry comes from in-context conditioning — a style card plus a handful of real exemplars. The 1M context window makes this affordable.
9
-
10
- The skill is built on five deterministic MCP tools served by the `writer-craft` plugin's MCP server (`premium-plugins/writer-craft/mcp/`):
11
-
12
- | Tool | Purpose |
13
- |------|---------|
14
- | `voice-tag-content` | Stamp historical or new content nodes with `authorshipMode` and operator-supplied `format`. Bulk-tags arrays of node ids. |
15
- | `voice-distil-profile` | Walk the `human-only` corpus for a given `format` and `scope` and produce a `:VoiceProfile {styleCard, generatedAt, corpusSize, feedbackEntries, format, scope}` node. `scope='personal'` (default) walks one author; `scope='org'` walks the whole account. Without a `format`, enumerates all formats present in that scope's corpus and distils each. |
16
- | `voice-retrieve-conditioning` | Return `{styleCard, exemplars[], status}` for a drafting brief. Requires `brief.format`; `brief.scope` (default `personal`) picks personal vs org voice, with a personal→org fallback. K=5 for short-form, K=15 for long-form. Token-budget bounded. |
17
- | `voice-record-feedback` | When the operator edits an agent draft, write a `:VoiceEdit {originalText, editedText, intent, occurredAt, format}-[:FEEDBACK_FOR]->(:VoiceProfile {format})` node. The `intent` field is a Haiku-summarised diff. |
18
- | `voice-ingest-session-text` | Write operator turns from the current session as `:Message {format:'text', authorshipMode:'human-only'}` corpus nodes. The agent reads its own operator turns from context and passes them as `turns`. Deduplicates via `contentHash`. Invoked on demand when the operator asks to capture this session's voice. |
19
-
20
- ## Surface — establishment is admin-only; conditioning is shared with the drafting seat
21
-
22
- The four **establishment** tools (`voice-tag-content`, `voice-distil-profile`, `voice-ingest-session-text`, `voice-record-feedback`) are admin-allowlisted and exist only on the admin agent's tool surface. No specialist carries them, by design: `format` and `authorshipMode` are editorial choices the operator makes, so building and curating a voice profile is an operator-interactive admin flow, not a step a specialist runs unattended.
23
-
24
- `voice-retrieve-conditioning` is different. It is the **drafting-time** conditioning tool: a drafting skill calls it to pull the style card and exemplars and condition its prose. It is carried by `specialists:content-producer` (the authoring seat, which holds `plainly` and `prose-craft`) and is **not** on the admin surface — conditioning is drafting-seat-only. The consulting prose deliverables (`decision-memo`, `narrative-builder`, `pitch-deck`), the property brochure (`property-brochure`), and the investor data-room business plan (Stage 3 prose) all compose on content-producer and condition there. The split that holds: the operator curates voice with the four establishment tools on the admin seat; any drafting seat only retrieves it. Admin never calls `voice-retrieve-conditioning` directly — the conditioning instruction goes into the brief admin hands to content-producer.
25
-
26
- This matters most right after an ingest. When a specialist (the librarian) files a document and the operator then asks to tag it — "mark that as me / human-only / marketing-copy" — the tagging is yours to run, not the specialist's. The specialist cannot call `voice-tag-content` and will hand back the created node's identifier instead. Take that id and run `voice-tag-content` here. If the id is not in context (a later turn, the librarian's return scrolled off), fall back to the unknown-authorship query in the backfill flow below to find the just-filed node. Never route the tag back into a specialist; a specialist reporting "voice-tag-content is not in my tools" is the boundary working as intended, not a failure to escalate.
27
-
28
- ## When to activate
29
-
30
- Activate when the operator says any of:
31
-
32
- - **"Tag this as me" / "I wrote that" / "mark these as human-only".** Drives `voice-tag-content`.
33
- - **"Build my voice profile" / "distil my style" / "rebuild the voice mirror".** Drives `voice-distil-profile`.
34
- - **"Read my writing first" / "draft this in my voice" — when the operator is asking for a hand-written-quality draft, not a generic AI reply.** Drives `voice-retrieve-conditioning`; the calling drafting skill is the actual surface, this skill is the conditioning input.
35
- - **"Use my edit as a teaching example" / "remember how I changed that".** Drives `voice-record-feedback`.
36
- - **"Review my historical writing and tag it" / "start the backfill".** Drives the interactive backfill flow described below.
37
- - **"Capture my voice from this chat" / "ingest this session" / "learn how I write from this conversation".** Drives the on-demand session-text capture flow described below.
38
-
39
- Do **not** activate for:
40
-
41
- - Writing-craft review tasks (`prose-craft`, `review-prose`, etc.). Those are critique skills, not voice-capture.
42
- - Public-figure voice mimicry. Out of scope — see the `## Out of scope` section.
43
- - Audio voice cloning. Different domain entirely.
44
-
45
- ## Corpus formats
46
-
47
- Voice profiles are segmented by content format. The closed enum is:
48
-
49
- | Format | Operator picks for |
50
- |--------|--------------------|
51
- | `text` | `:Message` nodes; the operator's session turns, captured on demand via `voice-ingest-session-text` when the operator asks to capture this session's voice |
52
- | `email` | Email threads stored as `:KnowledgeDocument {source:'email'}` or `:ConversationArchive {source:'email'}` |
53
- | `social-post` | `:SocialPost` nodes |
54
- | `article` | Long-form `:KnowledgeDocument` the operator considers an article |
55
- | `note` | Short-form `:KnowledgeDocument` the operator considers a note |
56
- | `marketing-copy` | Any node the operator considers marketing copy |
57
-
58
- Format is editorial — the operator picks it per node when calling `voice-tag-content`. The tool does not infer it.
59
-
60
- ## Flow — backfill review (one-shot session)
61
-
62
- Run when the operator first installs voice-mirror, then whenever they want to refresh the corpus.
63
-
64
- ### 1. Pick a corpus stream
65
-
66
- The operator's authored content lives in two stream shapes that the backfill UX handles differently:
67
-
68
- - **Discrete documents and posts** — `:KnowledgeDocument` (covers email threads via `source:'email'`), `:SocialPost`, and one-off `:Message` nodes. Per-item tagging with previews.
69
- - **Chat archives** — conversation-document `:KnowledgeDocument` nodes (those carrying `conversationIdentity`) with their child `:Section` chunks. Per-conversation tagging because chunking happens server-side and the operator owns whole conversations, not individual chunks. Chat is the highest-leverage corpus — the unguarded voice that email rarely captures.
70
-
71
- Ask the operator which stream to backfill first. Default to chat archives when the account has any conversation-document `:KnowledgeDocument` nodes, because that's where voice signal is strongest.
72
-
73
- ### 2a. Discrete documents — paginate in batches of 10
74
-
75
- Query for `:KnowledgeDocument | :SocialPost | :Message` nodes belonging to this operator's account whose `authorshipMode` is `unknown`. Order by `dateSent | datePublished | dateCreated` descending — most recent first. For each batch, surface a numbered list with: source label, date, recipient or topic, and a one-line preview (first ~120 chars of body). Operator commands name both mode and format:
76
-
77
- - `1-10 human-only article` — tag every item in the batch as `human-only` with format `article`.
78
- - `1,3,7 human-only email` — tag a subset with mode + format.
79
- - `2 human-led-agent-assisted note` — single-item.
80
- - `5 agent-led-human-reviewed marketing-copy` — single-item.
81
- - `1-10 human-only article author:joel` — attribute the batch to a named author (a `userId`) rather than the tagging operator.
82
- - `skip` — leave the batch as `unknown` and advance.
83
- - `stop` — exit the backfill; the next session resumes from where the operator left off.
84
-
85
- `format` is required on every command; the tool will not infer it. If the operator omits the format, ask before tagging. `author:<userId>` is optional — **omit it and the content is attributed to the tagging operator**, so single-operator accounts get personal attribution for free and behave exactly as before. Name an author only on a multi-operator account when tagging someone else's writing. Bulk-tag via `voice-tag-content` once per operator response. Emit `[voice-tag] mode=<mode> format=<format> scope=personal author=<userId> count=<n>` per write.
86
-
87
- ### 2b. Chat archives — paginate per conversation-document parent
88
-
89
- For each conversation-document `:KnowledgeDocument` (with `conversationIdentity` set) that has at least one `:Section` chunk whose `authorshipMode` is `unknown`, surface: source file, participant names, message count, date range, and a one-line summary. Offer:
90
-
91
- - `human-only` — tag every child `:Section` chunk in this conversation as `human-only`.
92
- - `mixed` — open the conversation for per-chunk tagging (rare; only when the archive contains multiple authors on the operator's side).
93
- - `not me` — tag every chunk as `agent-only` (e.g. a Slack channel where the operator only forwarded other people's messages).
94
- - `skip` / `stop` — same semantics as 2a.
95
-
96
- Bulk-tag via `voice-tag-content` with the list of `:Section` element IDs the conversation-document contains, passing `format='text'` (chat archives are unambiguously text-format). Attribution defaults to the tagging operator; on a multi-operator account, pass `author:<userId>` to attribute the conversation to the operator who actually owns it. The skill emits `[voice-tag] mode=<mode> format=<format> scope=personal author=<userId> count=<chunk-count>` once per conversation.
97
-
98
- Authorship at conversation granularity is a deliberate UX trade-off: chunks within a conversation almost always share the same operator's voice, and per-chunk tagging at archive scale would burn the operator's attention. The `mixed` opt-in covers the rare case where it matters.
99
-
100
- ### 3. Distil when the corpus crosses threshold
101
-
102
- After each backfill batch, check whether the qualifying corpus (`authorshipMode IN ['human-only', 'human-led-agent-assisted']`) for any format has grown ≥20% since the last `:VoiceProfile.corpusSize` for that format (or ≥1 entry if no profile exists for that format). If yes, offer to run `voice-distil-profile` immediately. The operator can defer; the next scheduled distillation will pick it up.
103
-
104
- ## On-demand text-format capture (session turns)
105
-
106
- Operator turns are captured into the `text` corpus on demand — when the operator asks to capture this session's voice, never automatically. There is no SessionEnd hook; the operator is in the loop.
107
-
108
- When the operator says "capture my voice from this chat" (or similar):
109
-
110
- 1. Read the operator's own turns from the live conversation context — the user messages already in this session.
111
- 2. Call `voice-ingest-session-text` with those turns as the `turns` array. The tool filters out slash commands, harness injections (`<system-reminder>`), and large paste blocks, deduplicates via SHA256 content hash, and writes each new turn as a `:Message {format:'text', authorshipMode:'human-only'}` node.
112
- 3. The tool triggers an incremental `text`-format distillation if the corpus grew ≥20% since the last profile.
113
-
114
- This runs only on the admin seat (the tool is admin-allowlisted). Accounts without a voice profile degrade gracefully — capture simply populates the corpus for the first distillation.
115
-
116
- ## Flow — drafting-time conditioning
117
-
118
- Drafting skills (email composition, Postiz, property-brochure, investor-data-room Stage 3 prose, prospectus) call `voice-retrieve-conditioning` transparently before assembling their prompt. The skill takes a brief — `{topic, format, length, register, scope}` — where `format` is the target corpus format and `scope` picks whose voice to draft in. Default `scope` is `personal` (the calling operator's own voice); a drafting skill whose output goes out under the business name passes `scope: "org"` for the house voice. Email composition stays personal; property-brochure, the investor-data-room Stage 3 business plan, and the prospectus skills request `org`. It returns:
119
-
120
- ```yaml
121
- styleCard: |
122
- sentenceLengthDistribution: short-heavy (median 12 words)
123
- register: warm-professional, British, contraction-friendly
124
- favoured: ["properly", "the right thing", "happy to"]
125
- avoided: ["circle back", "synergy", "leverage"]
126
- taboos: ["per my last email", "kind regards"]
127
- opening: drop the salutation if the thread is mid-flow; otherwise "Hi <name>,"
128
- closing: "Best, Neo" — no signature block
129
- exemplars:
130
- - source: Email to Sarah Knight, 2026-04-12, re: lease draft
131
- body: "…actual operator-written paragraph…"
132
- - source: SocialPost on LinkedIn, 2026-03-30
133
- body: "…"
134
- ```
135
-
136
- Drafting skills inject both blocks into their prompt. Opt-out is per-skill: declare `voiceMirror: false` in the skill's frontmatter and the calling site skips the fetch. Default is on.
137
-
138
- The tool returns `{styleCard, exemplars, status}` with a discriminated `status`:
139
-
140
- - **`ok`** — a profile and/or exemplars were returned for the requested scope; inject both blocks.
141
- - **`fallback-org`** — a `personal` request found no personal profile/corpus, so the **org (house) voice** was returned instead. Inject the (org) blocks and draft normally. This is the standing signal that the calling operator has no personal attribution yet — the account is running on the house voice. Don't tell the operator they have "no profile"; they have the house one.
142
- - **`no-data`** — the lookup ran but no `:VoiceProfile` exists for this scope and the corpus is empty (and, for a personal request, no org profile either). Fall back to default register; this is the only state where you say "you have no voice profile yet".
143
- - **`error`** — the lookup failed (the payload carries an `error` message). Fall back to default register *exactly as for no-data* so drafting never crashes — but **never** tell the operator they have no profile; the profile state is unknown because the lookup errored.
144
-
145
- In all four states drafting proceeds. `ok` and `fallback-org` inject a style card; `no-data` and `error` degrade to the default register. The distinction matters only for what you tell the operator about *why* a given voice was (or was not) applied.
146
-
147
- Emit `[voice-retrieve] scope=<scope> format=<format> status=<status> styleCardBytes=<n> exemplarCount=<k> tokenBudget=<n>` per call.
148
-
149
- ## Flow — feedback capture
150
-
151
- When the operator edits an agent draft (in the email composer's edit loop, or in any drafting skill that supports inline edits), capture the diff:
152
-
153
- 1. The calling skill passes `{originalText, editedText, format, scope}` to `voice-record-feedback`. `scope` matches the scope the draft was retrieved at — an edit on an org draft passes `scope: "org"`.
154
- 2. The tool runs a Haiku diff summarisation to produce an `intent` field — a one-sentence description of what the operator changed and why. Example intents: "shorter and dropped the apology", "switched to first person", "removed sign-off", "added a specific date".
155
- 3. The tool writes `(:VoiceEdit {originalText, editedText, intent, occurredAt, userId, scope, accountId, format})-[:FEEDBACK_FOR]->(:VoiceProfile {format})` for the scoped profile. An org edit routes to the org profile (`userId='__org__'`); a personal edit to the operator's own. The real editor is always preserved via `(:AdminUser)-[:AUTHORED]->(:VoiceEdit)`, even on org edits.
156
-
157
- Feedback accumulates between distillations. The next `voice-distil-profile` run at the matching scope reads every `:VoiceEdit` linked to that profile and feeds the intents into the style-card refinement.
158
-
159
- Emit `[voice-record-feedback] scope=<scope> userId=<id|__org__> format=<format> intent="<haiku-summary>" diffBytes=<n>`.
160
-
161
- ## Distillation cadence
162
-
163
- `voice-distil-profile` re-runs per format when **either**:
164
-
165
- - the `human-only` corpus for that format has grown ≥20% since the last `:VoiceProfile.corpusSize` for that format, OR
166
- - 30 days have passed since `:VoiceProfile.generatedAt` for that format.
167
-
168
- A re-run within the 30-day window with <20% growth is a no-op — the tool returns the existing profile unchanged and emits `[voice-distil] skip reason=below-threshold format=<format>`.
169
-
170
- The triggering surface is the skill, not a scheduled job. Distillation runs on demand: at the end of a backfill batch, when the email composer notices stale-profile narration, or when the operator says "rebuild my voice profile".
171
-
172
- ### Amend mode (single-document update)
173
-
174
- Activate when the operator names one or more specific documents and wants them folded into their voice profile right now — e.g. **"I just published this new article, take that into account"**, **"that thread to Sarah is a good example of how I write — fold it in"**, or **"add this essay to my voice profile"**. The full-corpus distil cadence is wrong for "this specific document, now" — the operator's signal is the document choice, not the cadence guard.
175
-
176
- Call `voice-distil-profile` with:
177
-
178
- - `mode: 'amend'`
179
- - `format: <VoiceFormat>` — required; the operator's per-format profile
180
- - `nodeIds: [<elementId>, ...]` — the documents the operator picked (one or more)
181
-
182
- The tool returns `{existingStyleCard, exemplars[], feedbackIntents[], eligible, ineligible}`. Compare the named exemplars against the prior card and the recent edit intents, then choose:
183
-
184
- - **Material delta** — compose an updated YAML and call `mode: 'write'` with `styleCardYaml` and `amendedFromNodeIds: [<elementId>, ...]` listing the documents that actually moved the card. The write bypasses the cadence guard and adds `LEARNED_FROM` edges to those documents (pre-existing edges remain).
185
- - **No material delta** — reply to the operator in-turn ("nothing in that article shifts your voice card; the prior profile still applies"). Do not call `mode: 'write'`. `generatedAt` only advances on a write.
186
-
187
- When `eligible=0` (every named document failed the predicate) surface the `ineligible[]` payload to the operator naming the per-id reason (`node-not-found`, `wrong-account`, `ineligible-authorship-mode`, `trashed`, `ineligible-label`) rather than silently no-op. Most commonly this means the documents are tagged as `agent-only` and need re-tagging via `voice-tag-content` before they can amend a profile.
188
-
189
- Amend mode does not apply to the on-demand session-text capture path. Session-text ingest stays on the full-corpus path; amend is operator-initiated only.
190
-
191
- ## Org and personal scope
192
-
193
- Every account holds, per format, **one org (house) profile and any number of personal profiles** at once:
194
-
195
- - **Personal** — one operator's own voice. Key `(accountId, userId, format)`, `scope='personal'`, anchored on the operator's `:AdminUser`. Distilled from that operator's author-tagged content only (`n.voiceAuthor = userId`).
196
- - **Org** — the account/house voice. Key `(accountId, '__org__', format)`, `scope='org'`, anchored on the account's `:LocalBusiness`. Distilled from the **whole account** (every author's content), not one person's.
197
-
198
- `__org__` is a reserved sentinel userId. It keeps the existing `(accountId, userId, format)` unique constraint valid with no migration — exactly one org profile per `(account, format)` — and a real operator must never hold it.
199
-
200
- Which voice a draft uses is the `scope` on the retrieval brief: `"my voice"` → personal, `"the house/org voice"` → org. A personal request with no personal profile yet falls back to the org profile (`status: "fallback-org"`); an org request with no org profile degrades to the default register (`status: "no-data"`).
201
-
202
- **Single-operator accounts are unchanged.** With author omitted at tag time, the sole operator is the implicit author, so their personal corpus equals the account-wide corpus and personal distillation reproduces the prior single profile. Legacy content carries no `voiceAuthor`; it appears only in the account-wide org walk until re-tagged, and personal drafts fall back to the org voice in the meantime.
203
-
204
- ## Observability
205
-
206
- | Tag | When |
207
- |-----|------|
208
- | `[voice-tag] mode=<mode> format=<format> scope=personal author=<userId> count=<n>` | Every tag write. `author=` is the resolved value (operator's id when omitted). |
209
- | `[voice-distil] scope=<scope> userId=<id\|__org__> anchor=<AdminUser\|LocalBusiness> format=<format> corpusSize=<n> generatedAt=<iso> feedbackEntries=<n>` | Each distillation write. Org also carries `sentinel=__org__`. |
210
- | `[voice-distil] scope=<scope> userId=<id\|__org__> format=<format> skip reason=<below-threshold\|recent\|empty-corpus>` | When the cadence/empty guard fires. |
211
- | `[voice-distil] scope=<scope> mode=amend userId=<id\|__org__> format=<format> nodeIds=<count> existingProfile=<elementId\|none> eligible=<n> ineligible=<n> exemplars=<n>` | Each amend-mode call. `eligible=0` means surface `ineligible[]` to the operator, never silently no-op. |
212
- | `[voice-distil] scope=<scope> mode=write userId=<id\|__org__> anchor=<…> format=<format> amended=true amendedFromNodeIds=<count> ...` | Amend-write fired (operator-initiated update persisted). |
213
- | `[voice-retrieve] scope=<scope> format=<format> status=<ok\|fallback-org\|no-data\|error> styleCardBytes=<n> exemplarCount=<k> tokenBudget=<n>` | Each retrieval. `status=fallback-org` proves the personal→org fallback fired. |
214
- | `[voice-record-feedback] scope=<scope> userId=<id\|__org__> format=<format> intent="<haiku-summary>" diffBytes=<n>` | Each feedback write. |
215
- | `[voice-ingest-session-text] sessionId=<id> adminUser=<id> turns=<n> bytes=<n> skipped=<m>` | On-demand session-text capture. |
216
-
217
- **Confirms working:** `[voice-retrieve] exemplarCount≥1` precedes every drafting-skill prompt assembly when the calling skill has not opted out. `[voice-distil]` appears at least once per 30-day window per active format per operator. `[voice-ingest-session-text] turns≥1` appears when the operator asks to capture a session's voice.
218
-
219
- **Indicates failure:** `[voice-retrieve] exemplarCount=0` with non-empty corpus → similarity index broken; `[voice-distil] error …` → corpus walk or LLM call failed; absence of `[voice-record-feedback]` after an operator-edit-then-send flow → feedback loop is dead.
220
-
221
- **Diagnostic path:**
222
-
223
- ```
224
- journalctl -u maxy-code | grep -E '\[voice-(tag|distil|retrieve|record-feedback|ingest-session-text)\]'
225
- ```
226
-
227
- Filter by `userId=<id>` for per-operator drill-down.
228
-
229
- ## Out of scope
230
-
231
- - Voice blending across multiple authors (no "Joel + Neo combined voice").
232
- - Style transfer from public-figure corpora — voice-mirror only learns from the operator's own writing.
233
- - Audio voice cloning / speech synthesis — different domain.
234
- - Auto-tagging legacy content via heuristics — backfill is operator-driven only; the agent never guesses authorship.
235
- - Admin-UI editing of the `styleCard` — operator edits via `database-operator` for now. Surfacing this in a dedicated UI is a follow-up task.
236
-
237
- ## Dependencies
238
-
239
- - **Memory plugin's graph-write gate** is the single write boundary; new tools route through it, never bypass.
240
- - **Haiku LLM call path** (already used by `memory-classify`) is reused for diff-intent summarisation.
241
- - **`:AdminUser` must exist** for the operator before distillation runs. Personal-mode operators with `Person {role: "admin-personal"}` need to be promoted to an `:AdminUser` first — out of scope here.
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-render-NQmflZ7K.js","assets/preload-helper-C5gCWwwF.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./chunk-CAM3fms7.js";import{D as t,L as n,M as r,m as i}from"./useSubAccountSwitcher-BpQ3oKiJ.js";import{t as a}from"./preload-helper-C5gCWwwF.js";var o=t(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),s=t(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),c=e(n(),1),l=r();function u({children:e,tail:t=null,repinSignals:n}){let r=(0,c.useRef)(null),i=(0,c.useRef)(null),a=(0,c.useRef)(!0),[o,s]=(0,c.useState)(!0),u=(0,c.useRef)(0),d=(0,c.useRef)(0),f=()=>{let e=r.current;if(!e)return;let t=e.clientHeight,n=e.scrollHeight,i=t!==u.current||n!==d.current;if(u.current=t,d.current=n,i){a.current&&(e.scrollTop=e.scrollHeight);return}let o=n-e.scrollTop-t<=32;a.current=o,s(e=>e===o?e:o)},p=()=>{let e=r.current;e&&(e.scrollTop=e.scrollHeight,d.current=e.scrollHeight,u.current=e.clientHeight,a.current=!0,s(!0))},m=t!=null;return(0,c.useLayoutEffect)(()=>{let e=r.current;e&&a.current&&(e.scrollTop=e.scrollHeight),e&&(d.current=e.scrollHeight,u.current=e.clientHeight)},[...n,m]),(0,c.useLayoutEffect)(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>f());return r.current&&e.observe(r.current),i.current&&e.observe(i.current),()=>e.disconnect()},[]),(0,l.jsxs)(`div`,{className:`wa-reader`,children:[(0,l.jsx)(`div`,{className:`wa-reader-thread`,ref:r,onScroll:f,children:(0,l.jsxs)(`div`,{className:`wa-thread-scroll`,ref:i,children:[e,t]})}),!o&&(0,l.jsx)(`button`,{type:`button`,className:`wa-jump`,onClick:p,"aria-label":`Jump to latest message`,title:`Jump to latest message`,children:`↓`})]})}var d={auth_expired:`Your session has expired. Please sign in again.`,claude_down:`Claude is currently experiencing an outage. Please try again in a few minutes.`,claude_overloaded:`Claude is overloaded right now. Please try again shortly.`,model_unavailable:`The selected model is currently unavailable. Switch to a different model from the model picker to continue.`,agent_error:`Something went wrong. Please try again.`},f={auth_expired:`I'm not available right now. Please try again later.`,claude_down:`I'm not available right now. Please try again later.`,claude_overloaded:`I'm not available right now. Please try again shortly.`,model_unavailable:`I'm not available right now. Please try again later.`,agent_error:`I'm not available right now. Please try again later.`};function p(e,t=`admin`){return t===`public`?f[e]:d[e]}function m(e){return e===`whatsapp`?` · via WhatsApp`:e===`webchat`?` · via web`:``}var h=/\.(png|jpe?g|gif|webp|svg|bmp)$/i,g=/\.pdf$/i;function _(e,t){return(t?t.startsWith(`image/`):h.test(e))?`image`:t&&t.startsWith(`audio/`)?`audio`:(t?t===`application/pdf`:g.test(e))?`pdf`:`file`}function v(e,t,n,r){let i=encodeURIComponent(e.path),a=encodeURIComponent(n),o=r?`&disposition=${r}`:``;return e.root===`scratchpad`?`/api/admin/files/download?path=${i}&root=scratchpad&sessionId=${encodeURIComponent(t)}&session_key=${a}${o}`:`/api/admin/files/download?path=${i}&root=data&session_key=${a}${o}`}function y(e,t,n,r){return t===`public`?`/api/public-reader/attachment/${e}?sessionId=${encodeURIComponent(n)}`:`/api/admin/attachment/${e}?session_key=${encodeURIComponent(r)}`}function b(e){if(e<1024)return`${e} B`;let t=e/1024;if(t<1024)return`${t<10?t.toFixed(1):Math.round(t)} KB`;let n=t/1024;return`${n<10?n.toFixed(1):Math.round(n)} MB`}function x({href:e,filename:t,label:n}){return(0,l.jsxs)(`a`,{className:`chat-attachment-chip`,href:e,download:t,children:[(0,l.jsx)(s,{size:14,"aria-hidden":!0}),n]})}function S({src:e,filename:t,sizeBytes:n,expandable:r,onFail:i}){let[a,o]=(0,c.useState)(!1),[s,u]=(0,c.useState)(!1),d=n==null?t:`${t} · ${b(n)}`;return s?(0,l.jsx)(x,{href:e,filename:t,label:d}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`img`,{className:`chat-attachment-image`,src:e,alt:t,onClick:r?()=>o(!0):void 0,onError:()=>{u(!0),i?.(`fetch`)}}),r&&a&&(0,l.jsx)(`div`,{className:`chat-attachment-overlay`,role:`dialog`,"aria-label":t,onClick:()=>o(!1),children:(0,l.jsx)(`img`,{className:`chat-attachment-overlay-image`,src:e,alt:t})})]})}var C=280,w=360,T=16;function E({src:e,filename:t,sizeBytes:n,onFail:r}){let[i,s]=(0,c.useState)(!1),[u,d]=(0,c.useState)(!1),f=(0,c.useRef)(null),p=n==null?t:`${t} · ${b(n)}`;return(0,c.useEffect)(()=>{let t=!1,n=null;return(async()=>{try{let{loadPdf:r,renderPageToFit:i}=await a(async()=>{let{loadPdf:e,renderPageToFit:t}=await import(`./pdf-render-NQmflZ7K.js`);return{loadPdf:e,renderPageToFit:t}},__vite__mapDeps([0,1])),o=await r(e);n=o;let s=f.current;if(t||!s)return;await i(o,1,s,C,w)}catch{t||(d(!0),r?.(`render`))}})(),()=>{t=!0;try{n?.destroy()}catch{}}},[e]),u?(0,l.jsx)(x,{href:e,filename:t,label:p}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`chat-attachment-pdf`,children:[(0,l.jsx)(`canvas`,{ref:f,className:`chat-attachment-pdf-canvas`,"aria-label":t}),(0,l.jsx)(`button`,{type:`button`,className:`chat-attachment-pdf-expand`,"aria-label":`Expand ${t}`,onClick:()=>s(!0),children:(0,l.jsx)(o,{size:14,"aria-hidden":!0})})]}),i&&(0,l.jsx)(D,{src:e,filename:t,label:p,onClose:()=>s(!1),onFail:r})]})}function D({src:e,filename:t,label:n,onClose:r,onFail:o}){let s=(0,c.useRef)(null),u=(0,c.useRef)(null),[d,f]=(0,c.useState)(null),[p,m]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{let t=!1;return(async()=>{try{let{loadPdf:n}=await a(async()=>{let{loadPdf:e}=await import(`./pdf-render-NQmflZ7K.js`);return{loadPdf:e}},__vite__mapDeps([0,1])),r=await n(e);if(t){try{r.destroy()}catch{}return}u.current=r,f(r.numPages)}catch{t||(m(!0),o?.(`render`))}})(),()=>{t=!0;try{u.current?.destroy()}catch{}}},[e]),(0,c.useEffect)(()=>{if(d==null)return;let e=s.current,t=u.current;if(!e||!t)return;let n=!1;return(async()=>{try{let{renderPageToWidth:r}=await a(async()=>{let{renderPageToWidth:e}=await import(`./pdf-render-NQmflZ7K.js`);return{renderPageToWidth:e}},__vite__mapDeps([0,1])),i=Array.from(e.querySelectorAll(`canvas.chat-attachment-overlay-page`)),o=Math.max(e.clientWidth-T*2,1);for(let e=0;e<i.length;e++){if(n)return;await r(t,e+1,i[e],o)}}catch{n||(m(!0),o?.(`render`))}})(),()=>{n=!0}},[d]),(0,l.jsxs)(`div`,{className:`chat-attachment-overlay`,role:`dialog`,"aria-label":t,onClick:r,children:[(0,l.jsx)(`div`,{ref:s,className:`chat-attachment-overlay-pdf`,onClick:e=>e.stopPropagation(),children:p?(0,l.jsx)(x,{href:e,filename:t,label:n}):Array.from({length:d??0},(e,n)=>(0,l.jsx)(`canvas`,{className:`chat-attachment-overlay-page`,"aria-label":`${t} page ${n+1}`},n))}),(0,l.jsx)(`button`,{type:`button`,className:`chat-attachment-overlay-close`,"aria-label":`Close`,onClick:r,children:(0,l.jsx)(i,{size:20,"aria-hidden":!0})})]})}function O({filename:e,href:t,mimeType:n,sizeBytes:r,expandable:i,telemetry:a}){let o=_(e,n);(0,c.useEffect)(()=>{a?.onRender?.({kind:o,mime:n,served:!!t})},[]);let u=a?.onFail?e=>a.onFail({kind:o===`pdf`?`pdf`:`image`,mime:n,reason:e}):void 0;if(o===`image`&&t)return(0,l.jsx)(S,{src:t,filename:e,sizeBytes:r,expandable:i,onFail:u});if(o===`audio`&&t)return(0,l.jsx)(`audio`,{className:`chat-attachment-audio`,controls:!0,preload:`metadata`,src:t});if(o===`pdf`&&t)return(0,l.jsx)(E,{src:t,filename:e,sizeBytes:r,onFail:u});let d=r==null?e:`${e} · ${b(r)}`;return t?(0,l.jsx)(x,{href:t,filename:e,label:d}):(0,l.jsxs)(`p`,{className:`chat-doc`,children:[(0,l.jsx)(s,{size:14,"aria-hidden":!0,style:{verticalAlign:`text-bottom`}}),` `,d]})}function k(e,t,n,r=`/api/whatsapp-reader/stream`,i=e,a=!0){let[o,s]=(0,c.useState)([]),[l,u]=(0,c.useState)(`open`),[d,f]=(0,c.useState)(null),p=(0,c.useRef)([]);return(0,c.useEffect)(()=>{p.current=o},[o]),(0,c.useEffect)(()=>{s([]),p.current=[],f(null)},[i,t,n,r]),(0,c.useEffect)(()=>{if(u(`open`),!a)return;let i=p.current.slice(),o=i.map(A),c=0,l=i.length>0,d=`${r}?sessionId=${encodeURIComponent(e)}&projectDir=${encodeURIComponent(t)}&session_key=${encodeURIComponent(n)}`,m=new EventSource(d);return m.onopen=()=>{console.info(`[admin-ui] wa-stream onopen sessionId=${e}`),u(`open`)},m.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(l){if(c<o.length&&A(t)===o[c]){c+=1;return}l=!1}s(e=>[...e,t])},m.addEventListener(`activity`,e=>{try{f(JSON.parse(e.data))}catch{}}),m.addEventListener(`activity-clear`,()=>f(null)),m.onerror=()=>{m.readyState===2&&(console.error(`[admin-ui] wa-stream onerror readyState=${m.readyState}`),u(`error`))},()=>m.close()},[e,t,n,r,i,a]),{turns:o,status:l,subagentActivity:d}}function A(e){return JSON.stringify(e)}function j(e,t,n,r=!0){let[i,a]=(0,c.useState)([]),[o,s]=(0,c.useState)(`open`);return(0,c.useEffect)(()=>{if(a([]),s(`open`),!r||!e||!t)return;let i=`/api/whatsapp-reader/store-stream?accountId=${encodeURIComponent(e)}&remoteJid=${encodeURIComponent(t)}&session_key=${encodeURIComponent(n)}`,o=new EventSource(i);return o.onopen=()=>s(`open`),o.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}a(e=>[...e,t])},o.onerror=()=>{o.readyState===2&&s(`error`)},()=>o.close()},[e,t,n,r]),{turns:i,status:o}}var M=e=>{if(!e)return 1/0;let t=new Date(e).getTime();return Number.isNaN(t)?1/0:t};function N(e,t){let n=[],r=0;return e.forEach((e,t)=>n.push({sort:M(e.ts),sub:1,ins:r++,item:{kind:`turn`,turn:e,idx:t}})),t.forEach(e=>n.push({sort:M(e.ts),sub:0,ins:r++,item:{kind:`directive`,entry:e}})),n.sort((e,t)=>e.sort===t.sort?e.sort===1/0?e.ins-t.ins:e.sub-t.sub||e.ins-t.ins:e.sort<t.sort?-1:1).map(e=>e.item)}function P(e,t,n=!0){let[r,i]=(0,c.useState)([]);return(0,c.useEffect)(()=>{if(!n||typeof fetch!=`function`)return;let r=!0,a=`/api/whatsapp-reader/directives?sessionId=${encodeURIComponent(e)}&session_key=${encodeURIComponent(t)}`;return fetch(a).then(e=>e.ok?e.json():{entries:[]}).then(e=>{r&&i(Array.isArray(e.entries)?e.entries:[])}).catch(()=>{r&&i([])}),()=>{r=!1}},[e,t,n]),r}var F=new Set([`operator-inbound`,`operator-typed`,`agent-reply`,`agent-reply-document`,`agent-file`,`agent-error`,`whatsapp-persisted`]);function I(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function L(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}var R=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],z=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function B(e){let t=String(e.getMonth()+1).padStart(2,`0`),n=String(e.getDate()).padStart(2,`0`);return`${e.getFullYear()}-${t}-${n}`}function V(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:B(t)}function H(e,t=new Date){if(!e)return``;let n=new Date(e);if(Number.isNaN(n.getTime()))return``;let r=B(n);if(r===B(t))return`Today`;let i=new Date(t);return i.setDate(i.getDate()-1),r===B(i)?`Yesterday`:`${R[n.getDay()]} ${n.getDate()} ${z[n.getMonth()]} ${n.getFullYear()}`}function U(e){return e.kind===`turn`?e.turn.ts:e.entry.ts}function W({ts:e}){return(0,l.jsx)(`div`,{className:`day-divider`,role:`separator`,children:(0,l.jsx)(`span`,{className:`day-divider-label`,children:H(e)})})}function G(){return(0,l.jsx)(`div`,{className:`session-divider`,role:`separator`,children:(0,l.jsx)(`span`,{className:`session-divider-label`,children:`Conversation continued`})})}function K({label:e,ts:t}){return(0,l.jsxs)(`div`,{className:`wa-turn-head`,children:[(0,l.jsx)(`span`,{className:`wa-who`,children:e}),(0,l.jsx)(`time`,{className:`wa-time`,children:I(t)})]})}function q({turn:e}){let[t,n]=(0,c.useState)(!1),r=e.kind===`tool-result`,i=r?`wa-turn wa-turn-result${e.isError?` is-error`:``}`:`wa-turn wa-turn-tool`,a=r?e.isError?`result (error)`:`result`:`↳ ${e.name}`,o=r?e.text:JSON.stringify(e.input,null,2);return(0,l.jsxs)(`div`,{className:i,children:[(0,l.jsxs)(`button`,{type:`button`,className:`wa-tool-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,l.jsx)(`span`,{className:`wa-chevron`,children:t?`▾`:`▸`}),(0,l.jsx)(`span`,{className:`wa-who`,children:a}),(0,l.jsx)(`time`,{className:`wa-time`,children:I(e.ts)})]}),t&&(0,l.jsx)(`pre`,{className:`wa-code`,children:o})]})}function J({entry:e,sessionId:t,sessionKey:n}){let[r,i]=(0,c.useState)(!1),[a,o]=(0,c.useState)(null),s=()=>{let s=!r;if(i(s),s&&a===null&&typeof fetch==`function`){let r=`/api/whatsapp-reader/directive?sessionId=${encodeURIComponent(t)}&name=${encodeURIComponent(e.name)}&session_key=${encodeURIComponent(n)}`;fetch(r).then(e=>e.ok?e.text():`(directive unavailable)`).then(o).catch(()=>o(`(directive unavailable)`))}};return(0,l.jsxs)(`div`,{className:`wa-turn wa-turn-directive`,children:[(0,l.jsxs)(`button`,{type:`button`,className:`wa-tool-toggle`,"aria-expanded":r,onClick:s,children:[(0,l.jsx)(`span`,{className:`wa-chevron`,children:r?`▾`:`▸`}),(0,l.jsxs)(`span`,{className:`wa-who`,children:[`⚙ directive injected (`,e.len,` B)`]}),(0,l.jsx)(`time`,{className:`wa-time`,children:I(e.ts)})]}),r&&(0,l.jsx)(`pre`,{className:`wa-code`,children:a??`Loading…`})]})}var Y={onRender:({kind:e,mime:t,served:n})=>console.info(`[operator-ui] op=reader-attachment kind=${e} mime=${t??``} served=${n}`),onFail:({kind:e,mime:t,reason:n})=>console.info(`[operator-ui] op=reader-attachment-fail kind=${e} mime=${t??``} reason=${n}`)};function X(e,t,n){switch(e.kind){case`operator-inbound`:return(0,l.jsxs)(`div`,{className:`wa-turn wa-turn-in`,children:[(0,l.jsx)(K,{label:`Operator${m(e.source)}`,ts:e.ts}),e.text&&(0,l.jsx)(`p`,{className:`wa-body`,children:e.text}),e.attachments&&e.attachments.length>0&&(0,l.jsx)(`div`,{className:`chat-attachment-list`,children:e.attachments.map((e,t)=>(0,l.jsx)(O,{expandable:!0,filename:e.filename,mimeType:e.mimeType,sizeBytes:e.sizeBytes,href:y(e.attachmentId,n.audience,n.sessionId,n.sessionKey),telemetry:Y},t))})]},t);case`operator-typed`:return(0,l.jsxs)(`div`,{className:`wa-turn wa-turn-in wa-turn-typed`,children:[(0,l.jsx)(K,{label:`Operator (web)`,ts:e.ts}),(0,l.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`agent-text`:return(0,l.jsxs)(`div`,{className:`wa-turn wa-turn-think`,children:[(0,l.jsx)(K,{label:`Agent`,ts:e.ts}),(0,l.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`agent-reply`:return(0,l.jsxs)(`div`,{className:`wa-turn wa-turn-out`,children:[(0,l.jsx)(K,{label:`Agent`,ts:e.ts}),(0,l.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`agent-reply-document`:return(0,l.jsxs)(`div`,{className:`wa-turn wa-turn-out`,children:[(0,l.jsx)(K,{label:`Agent`,ts:e.ts}),(0,l.jsxs)(`p`,{className:`wa-doc`,children:[(0,l.jsx)(s,{size:14,"aria-hidden":!0,style:{verticalAlign:`text-bottom`}}),` `,`sent document(s): `,e.files.map(L).join(`, `)]}),e.caption&&(0,l.jsx)(`p`,{className:`wa-body`,children:e.caption})]},t);case`agent-file`:return(0,l.jsxs)(`div`,{className:`wa-turn wa-turn-out`,children:[(0,l.jsx)(K,{label:`Agent`,ts:e.ts}),e.files.map((t,r)=>{let i=L(t),a=e.downloads?.[r];return(0,l.jsx)(O,{expandable:!0,filename:i,href:a?v(a,n.sessionId,n.sessionKey,g.test(i)?`inline`:void 0):void 0,telemetry:Y},r)}),e.caption&&(0,l.jsx)(`p`,{className:`wa-body`,children:e.caption})]},t);case`whatsapp-persisted`:return(0,l.jsxs)(`div`,{className:`wa-turn ${e.fromMe?`wa-turn-out`:`wa-turn-in`}`,children:[(0,l.jsx)(K,{label:e.fromMe?`Sent`:e.senderName??`Contact`,ts:e.ts}),(0,l.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`session-continued`:return(0,l.jsx)(G,{},t);case`tool-call`:case`tool-result`:return(0,l.jsx)(q,{turn:e},t);case`agent-error`:return(0,l.jsxs)(`div`,{className:`wa-turn wa-turn-error`,role:`alert`,children:[(0,l.jsx)(K,{label:`Agent`,ts:e.ts}),(0,l.jsx)(`p`,{className:`wa-body wa-error-body`,children:p(e.code,`admin`)}),e.code===`agent_error`&&e.raw&&(0,l.jsx)(`pre`,{className:`wa-code`,children:e.raw})]},t)}}function Z(e,t,n,r=`admin`){let i={sessionId:t,sessionKey:n,audience:r},a=[],o=null;return e.forEach((e,r)=>{let s=U(e),c=V(s);c!==null&&c!==o&&(a.push((0,l.jsx)(W,{ts:s},`day-${r}`)),o=c),a.push(e.kind===`turn`?X(e.turn,r,i):(0,l.jsx)(J,{entry:e.entry,sessionId:t,sessionKey:n},r))}),a}function Q(e){return e.filter(e=>e.kind===`turn`&&F.has(e.turn.kind))}function $({sessionId:e,projectDir:t,sessionKey:n,renderItems:r=Z,clean:i,onToggleClean:a,forceDeliveredOnly:o=!1,streamEndpoint:s=`/api/whatsapp-reader/stream`,suppressDirectives:d=!1,tail:f=null,resetKey:p,onTurnsChange:m,onActivityChange:h,store:g}){let _=!!g,v=k(e,t,n,s,p,!_),y=j(g?.accountId??``,g?.remoteJid??``,n,_),{turns:b,status:x}=_?{turns:y.turns,status:y.status}:{turns:v.turns,status:v.status},S=_?null:v.subagentActivity;(0,c.useEffect)(()=>{h?.(S)},[S,h]),(0,c.useEffect)(()=>{m?.(b.length)},[b.length,m]);let C=N(b,P(e,n,!d)),w=a==null?!1:!!i,T=o||w?Q(C):C;return(0,l.jsxs)(u,{repinSignals:[b,w],tail:f,children:[x===`error`&&(0,l.jsx)(`div`,{className:`wa-reader-error`,children:`Stream disconnected.`}),b.length===0&&x===`open`&&(0,l.jsx)(`div`,{className:`wa-reader-placeholder`,children:`No messages in this conversation yet.`}),r(T,e,n)]})}export{s as _,L as a,U as c,h as d,g as f,p as g,m as h,$ as i,O as l,v as m,J as n,V as o,y as p,G as r,I as s,W as t,E as u};
@@ -1 +0,0 @@
1
- import{F as e,M as t}from"./useSubAccountSwitcher-BpQ3oKiJ.js";import"./admin-types-hioowVct.js";import"./AdminShell-DBD6ruS1.js";import{n}from"./page-zJQTRXB2.js";import"./Transcript-FX_w6no6.js";var r=e(),i=t();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
@@ -1 +0,0 @@
1
- import{D as e}from"./useSubAccountSwitcher-BpQ3oKiJ.js";var t=e(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]);export{t};
@@ -1 +0,0 @@
1
- import{F as e,M as t}from"./useSubAccountSwitcher-BpQ3oKiJ.js";import{t as n}from"./page-DQNYTb2d.js";import"./Transcript-FX_w6no6.js";import"./graph-labels-BcLJmY-v.js";var r=e(),i=t();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));