@rubytech/create-maxy-code 0.1.36 → 0.1.38

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 (344) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/package-lock.json +752 -512
  3. package/payload/platform/plugins/admin/PLUGIN.md +12 -0
  4. package/payload/platform/plugins/admin/hooks/__tests__/turn-completed-graph-write.test.sh +109 -0
  5. package/payload/platform/plugins/admin/hooks/turn-completed-graph-write.sh +114 -0
  6. package/payload/platform/plugins/admin/skills/unzip-attachment/SKILL.md +1 -1
  7. package/payload/platform/plugins/contacts/PLUGIN.md +11 -0
  8. package/payload/platform/plugins/docs/references/internals.md +10 -0
  9. package/payload/platform/plugins/docs/references/platform.md +9 -4
  10. package/payload/platform/plugins/email/PLUGIN.md +11 -0
  11. package/payload/platform/plugins/linkedin-import/.claude-plugin/plugin.json +1 -1
  12. package/payload/platform/plugins/linkedin-import/PLUGIN.md +5 -5
  13. package/payload/platform/plugins/linkedin-import/skills/linkedin-import/SKILL.md +3 -1
  14. package/payload/platform/plugins/linkedin-import/skills/linkedin-import/references/connections.md +2 -2
  15. package/payload/platform/plugins/loop/PLUGIN.md +11 -0
  16. package/payload/platform/plugins/memory/PLUGIN.md +11 -0
  17. package/payload/platform/plugins/memory/skills/conversation-archive/SKILL.md +2 -0
  18. package/payload/platform/plugins/memory/skills/conversation-archive-enrich/SKILL.md +2 -0
  19. package/payload/platform/plugins/memory/skills/document-ingest/SKILL.md +6 -4
  20. package/payload/platform/plugins/outlook/PLUGIN.md +11 -0
  21. package/payload/platform/plugins/replicate/PLUGIN.md +11 -0
  22. package/payload/platform/plugins/scheduling/PLUGIN.md +11 -0
  23. package/payload/platform/plugins/tasks/PLUGIN.md +11 -0
  24. package/payload/platform/plugins/telegram/PLUGIN.md +11 -0
  25. package/payload/platform/plugins/waitlist/PLUGIN.md +11 -0
  26. package/payload/platform/plugins/whatsapp/PLUGIN.md +11 -0
  27. package/payload/platform/plugins/workflows/PLUGIN.md +11 -0
  28. package/payload/platform/scripts/seed-neo4j.sh +14 -0
  29. package/payload/platform/scripts/verify-skill-tool-surface.sh +5 -3
  30. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
  31. package/payload/platform/services/claude-session-manager/dist/http-server.js +16 -1
  32. package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
  33. package/payload/platform/services/claude-session-manager/dist/index.js +63 -3
  34. package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
  35. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts +34 -1
  36. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
  37. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +132 -1
  38. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
  39. package/payload/platform/services/claude-session-manager/dist/session-store.d.ts +13 -1
  40. package/payload/platform/services/claude-session-manager/dist/session-store.d.ts.map +1 -1
  41. package/payload/platform/services/claude-session-manager/dist/session-store.js +7 -3
  42. package/payload/platform/services/claude-session-manager/dist/session-store.js.map +1 -1
  43. package/payload/platform/services/claude-session-manager/dist/tool-surface.d.ts +37 -4
  44. package/payload/platform/services/claude-session-manager/dist/tool-surface.d.ts.map +1 -1
  45. package/payload/platform/services/claude-session-manager/dist/tool-surface.js +128 -27
  46. package/payload/platform/services/claude-session-manager/dist/tool-surface.js.map +1 -1
  47. package/payload/platform/templates/agents/admin/IDENTITY.md +5 -14
  48. package/payload/platform/templates/specialists/agents/database-operator.md +27 -70
  49. package/payload/platform/templates/specialists/agents/librarian.md +55 -0
  50. package/payload/premium-plugins/real-agent/plugins/loop/PLUGIN.md +11 -0
  51. package/payload/server/public/assets/{Checkbox-C_5g1tvd.js → Checkbox-DAki3vDW.js} +1 -1
  52. package/payload/server/public/assets/{admin-CMhAQf3x.js → admin-CyAZtsYZ.js} +1 -1
  53. package/payload/server/public/assets/{architectureDiagram-Q4EWVU46-PATAR9cB.js → architectureDiagram-Q4EWVU46-C-hla3Ip.js} +1 -1
  54. package/payload/server/public/assets/{blockDiagram-DXYQGD6D-BTtUDSn8.js → blockDiagram-DXYQGD6D-CbzjtNs3.js} +1 -1
  55. package/payload/server/public/assets/{brand--hRSJcTa.css → brand-Cun0PBrA.css} +1 -1
  56. package/payload/server/public/assets/{c4Diagram-AHTNJAMY-DagJLqud.js → c4Diagram-AHTNJAMY-B87UblA0.js} +1 -1
  57. package/payload/server/public/assets/channel-CTNo72W7.js +1 -0
  58. package/payload/server/public/assets/{chunk-336JU56O-r_17ZSte.js → chunk-336JU56O-2a2pVlSg.js} +2 -2
  59. package/payload/server/public/assets/{chunk-426QAEUC-BeZHE5Od.js → chunk-426QAEUC-j9NOD8_a.js} +1 -1
  60. package/payload/server/public/assets/{chunk-4TB4RGXK-BOKuzFDs.js → chunk-4TB4RGXK-Cs872xAq.js} +1 -1
  61. package/payload/server/public/assets/{chunk-5FUZZQ4R-CFPql_Mb.js → chunk-5FUZZQ4R-BnDFbZ_I.js} +1 -1
  62. package/payload/server/public/assets/{chunk-5PVQY5BW-B-ooj0Oj.js → chunk-5PVQY5BW-Bu5B3Hyf.js} +1 -1
  63. package/payload/server/public/assets/{chunk-EDXVE4YY-pfgSmAaU.js → chunk-EDXVE4YY-B96Fw4FF.js} +1 -1
  64. package/payload/server/public/assets/{chunk-ENJZ2VHE-Czo3wSBG.js → chunk-ENJZ2VHE-CcGrGQim.js} +1 -1
  65. package/payload/server/public/assets/{chunk-ICPOFSXX-B0Kq8LNp.js → chunk-ICPOFSXX-ZRvcI4Ai.js} +1 -1
  66. package/payload/server/public/assets/{chunk-OYMX7WX6-BM97IkL3.js → chunk-OYMX7WX6-B6RI9Fbf.js} +1 -1
  67. package/payload/server/public/assets/{chunk-U2HBQHQK-Qu1CuohC.js → chunk-U2HBQHQK-BYGHVYyo.js} +1 -1
  68. package/payload/server/public/assets/{chunk-X2U36JSP-uDlh8MVE.js → chunk-X2U36JSP-rwNs-gTO.js} +1 -1
  69. package/payload/server/public/assets/{chunk-YZCP3GAM-DUlG-OZ5.js → chunk-YZCP3GAM-jPttJRap.js} +1 -1
  70. package/payload/server/public/assets/{chunk-ZZ45TVLE-BABivBFM.js → chunk-ZZ45TVLE-DLykWOT5.js} +1 -1
  71. package/payload/server/public/assets/classDiagram-6PBFFD2Q-BaV5nDmT.js +1 -0
  72. package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-DOKlCKjY.js +1 -0
  73. package/payload/server/public/assets/clone-sQSwlSln.js +1 -0
  74. package/payload/server/public/assets/{dagre-KV5264BT-CVL1mRVD.js → dagre-KV5264BT-C6wSzHX2.js} +1 -1
  75. package/payload/server/public/assets/{dagre-BLaP4HDY.js → dagre-jnQDnF-5.js} +1 -1
  76. package/payload/server/public/assets/data-DbkuXcPb.js +1 -0
  77. package/payload/server/public/assets/{device-url-actions-Dmhh-Azv.js → device-url-actions-y1tXNDZx.js} +1 -1
  78. package/payload/server/public/assets/{diagram-5BDNPKRD-Db75sppc.js → diagram-5BDNPKRD-N3X-n90h.js} +1 -1
  79. package/payload/server/public/assets/{diagram-G4DWMVQ6-Cj8Nvgev.js → diagram-G4DWMVQ6-vfmbzdPd.js} +1 -1
  80. package/payload/server/public/assets/{diagram-MMDJMWI5-BGXJmtU0.js → diagram-MMDJMWI5-BETmPx_w.js} +1 -1
  81. package/payload/server/public/assets/{diagram-TYMM5635-FALU804i.js → diagram-TYMM5635-BSUGM4wG.js} +1 -1
  82. package/payload/server/public/assets/{erDiagram-SMLLAGMA-Dny5IMgt.js → erDiagram-SMLLAGMA-CWZ9OwMb.js} +1 -1
  83. package/payload/server/public/assets/{flowDiagram-DWJPFMVM-CvKuRNSd.js → flowDiagram-DWJPFMVM-BpQOQS1a.js} +1 -1
  84. package/payload/server/public/assets/{ganttDiagram-T4ZO3ILL-CMMNRVGJ.js → ganttDiagram-T4ZO3ILL-Dc59igCS.js} +1 -1
  85. package/payload/server/public/assets/{gitGraphDiagram-UUTBAWPF-GNp7o9CH.js → gitGraphDiagram-UUTBAWPF-D6lXg3zl.js} +1 -1
  86. package/payload/server/public/assets/graph-CC5_6-dg.js +1 -0
  87. package/payload/server/public/assets/{graph-labels-DnFPoPy9.js → graph-labels-DFyNH0jb.js} +1 -1
  88. package/payload/server/public/assets/{graphlib-Bbf4iSQ9.js → graphlib-yG7kH8Fr.js} +1 -1
  89. package/payload/server/public/assets/{infoDiagram-42DDH7IO-CKnsQ4zf.js → infoDiagram-42DDH7IO-TS9Pv8Os.js} +1 -1
  90. package/payload/server/public/assets/{ishikawaDiagram-UXIWVN3A-7iiLy5h7.js → ishikawaDiagram-UXIWVN3A-BJiJJTq6.js} +1 -1
  91. package/payload/server/public/assets/{journeyDiagram-VCZTEJTY-BqbrYu64.js → journeyDiagram-VCZTEJTY-C7PW4fmw.js} +1 -1
  92. package/payload/server/public/assets/{kanban-definition-6JOO6SKY-B4xrW1HU.js → kanban-definition-6JOO6SKY-BEk21ciD.js} +1 -1
  93. package/payload/server/public/assets/{line-VuY4jgLe.js → line-DusyVWDE.js} +1 -1
  94. package/payload/server/public/assets/{mermaid-parser.core-BaqOkGpC.js → mermaid-parser.core-DeeojQSb.js} +1 -1
  95. package/payload/server/public/assets/{mermaid.core-CCQHCJiH.js → mermaid.core-p65Lo7Sj.js} +3 -3
  96. package/payload/server/public/assets/{mindmap-definition-QFDTVHPH-CD7_gX12.js → mindmap-definition-QFDTVHPH-B0jxFxdS.js} +1 -1
  97. package/payload/server/public/assets/{page-BbunxlG3.js → page-BeYGnDzI.js} +1 -1
  98. package/payload/server/public/assets/{page-CDFsJW62.js → page-x5khmfRx.js} +1 -1
  99. package/payload/server/public/assets/{pieDiagram-DEJITSTG-DYv6IDvS.js → pieDiagram-DEJITSTG-DJ5GKYt6.js} +1 -1
  100. package/payload/server/public/assets/{public-vZ5OE_BJ.js → public-cnoUs7vq.js} +3 -3
  101. package/payload/server/public/assets/{quadrantDiagram-34T5L4WZ-Djjgb1kX.js → quadrantDiagram-34T5L4WZ-BV7R-kwV.js} +1 -1
  102. package/payload/server/public/assets/{requirementDiagram-MS252O5E-D1jpw_fu.js → requirementDiagram-MS252O5E-DRiLzlGN.js} +1 -1
  103. package/payload/server/public/assets/{sankeyDiagram-XADWPNL6-CiWmspyf.js → sankeyDiagram-XADWPNL6-C5-6_cCI.js} +1 -1
  104. package/payload/server/public/assets/{sequenceDiagram-FGHM5R23-B1GXIeQe.js → sequenceDiagram-FGHM5R23-5FXm_VYM.js} +1 -1
  105. package/payload/server/public/assets/{stateDiagram-FHFEXIEX-DX7QZrhc.js → stateDiagram-FHFEXIEX-FCQTaGqV.js} +1 -1
  106. package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-BdpPhdqg.js +1 -0
  107. package/payload/server/public/assets/{timeline-definition-GMOUNBTQ-BxiwnKFu.js → timeline-definition-GMOUNBTQ-tvtq62ef.js} +1 -1
  108. package/payload/server/public/assets/{vennDiagram-DHZGUBPP-RxZA_K0W.js → vennDiagram-DHZGUBPP-Dk-k7CE4.js} +1 -1
  109. package/payload/server/public/assets/{wardleyDiagram-NUSXRM2D-b2tVWjtB.js → wardleyDiagram-NUSXRM2D-CZSrqniY.js} +1 -1
  110. package/payload/server/public/assets/{xychartDiagram-5P7HB3ND-D55tkJH1.js → xychartDiagram-5P7HB3ND-CpGLpk7Q.js} +1 -1
  111. package/payload/server/public/data.html +5 -5
  112. package/payload/server/public/graph.html +6 -6
  113. package/payload/server/public/index.html +8 -8
  114. package/payload/server/public/public.html +5 -5
  115. package/dist/__tests__/onboarding-state-readback.test.js +0 -61
  116. package/dist/onboarding-readback.js +0 -27
  117. package/payload/platform/lib/anthropic-key/dist/index.d.ts +0 -22
  118. package/payload/platform/lib/anthropic-key/dist/index.d.ts.map +0 -1
  119. package/payload/platform/lib/anthropic-key/dist/index.js +0 -232
  120. package/payload/platform/lib/anthropic-key/dist/index.js.map +0 -1
  121. package/payload/platform/plugins/admin/mcp/dist/lib/onboarding.d.ts +0 -39
  122. package/payload/platform/plugins/admin/mcp/dist/lib/onboarding.d.ts.map +0 -1
  123. package/payload/platform/plugins/admin/mcp/dist/lib/onboarding.js +0 -249
  124. package/payload/platform/plugins/admin/mcp/dist/lib/onboarding.js.map +0 -1
  125. package/payload/platform/plugins/real-agency/plugins/.claude-plugin/marketplace.json +0 -13
  126. package/payload/platform/plugins/real-agency/plugins/loop/.claude-plugin/plugin.json +0 -17
  127. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/index.d.ts +0 -2
  128. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/index.d.ts.map +0 -1
  129. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/index.js +0 -293
  130. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/index.js.map +0 -1
  131. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/lib/crypto.d.ts +0 -10
  132. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/lib/crypto.d.ts.map +0 -1
  133. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/lib/crypto.js +0 -88
  134. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/lib/crypto.js.map +0 -1
  135. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/lib/loop-api.d.ts +0 -82
  136. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/lib/loop-api.d.ts.map +0 -1
  137. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/lib/loop-api.js +0 -427
  138. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/lib/loop-api.js.map +0 -1
  139. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/lib/neo4j.d.ts +0 -5
  140. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/lib/neo4j.d.ts.map +0 -1
  141. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/lib/neo4j.js +0 -40
  142. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/lib/neo4j.js.map +0 -1
  143. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/customer-preferences.d.ts +0 -10
  144. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/customer-preferences.d.ts.map +0 -1
  145. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/customer-preferences.js +0 -24
  146. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/customer-preferences.js.map +0 -1
  147. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/feedback.d.ts +0 -16
  148. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/feedback.d.ts.map +0 -1
  149. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/feedback.js +0 -35
  150. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/feedback.js.map +0 -1
  151. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/key-deregister.d.ts +0 -5
  152. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/key-deregister.d.ts.map +0 -1
  153. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/key-deregister.js +0 -19
  154. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/key-deregister.js.map +0 -1
  155. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/key-list.d.ts +0 -4
  156. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/key-list.d.ts.map +0 -1
  157. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/key-list.js +0 -14
  158. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/key-list.js.map +0 -1
  159. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/key-register.d.ts +0 -9
  160. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/key-register.d.ts.map +0 -1
  161. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/key-register.js +0 -60
  162. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/key-register.js.map +0 -1
  163. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-enquiry.d.ts +0 -13
  164. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-enquiry.d.ts.map +0 -1
  165. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-enquiry.js +0 -41
  166. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-enquiry.js.map +0 -1
  167. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match-batch.d.ts +0 -9
  168. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match-batch.d.ts.map +0 -1
  169. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match-batch.js +0 -16
  170. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match-batch.js.map +0 -1
  171. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match-request.d.ts +0 -15
  172. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match-request.d.ts.map +0 -1
  173. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match-request.js +0 -11
  174. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match-request.js.map +0 -1
  175. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match.d.ts +0 -10
  176. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match.d.ts.map +0 -1
  177. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match.js +0 -39
  178. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match.js.map +0 -1
  179. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/people-detail.d.ts +0 -9
  180. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/people-detail.d.ts.map +0 -1
  181. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/people-detail.js +0 -125
  182. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/people-detail.js.map +0 -1
  183. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/people-search.d.ts +0 -18
  184. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/people-search.d.ts.map +0 -1
  185. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/people-search.js +0 -87
  186. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/people-search.js.map +0 -1
  187. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/property-detail.d.ts +0 -10
  188. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/property-detail.d.ts.map +0 -1
  189. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/property-detail.js +0 -82
  190. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/property-detail.js.map +0 -1
  191. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/property-listed.d.ts +0 -12
  192. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/property-listed.d.ts.map +0 -1
  193. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/property-listed.js +0 -32
  194. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/property-listed.js.map +0 -1
  195. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/property-request.d.ts +0 -15
  196. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/property-request.d.ts.map +0 -1
  197. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/property-request.js +0 -11
  198. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/property-request.js.map +0 -1
  199. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/property-search.d.ts +0 -16
  200. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/property-search.d.ts.map +0 -1
  201. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/property-search.js +0 -41
  202. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/property-search.js.map +0 -1
  203. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/supplier.d.ts +0 -13
  204. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/supplier.d.ts.map +0 -1
  205. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/supplier.js +0 -49
  206. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/supplier.js.map +0 -1
  207. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/team-availability.d.ts +0 -7
  208. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/team-availability.d.ts.map +0 -1
  209. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/team-availability.js +0 -19
  210. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/team-availability.js.map +0 -1
  211. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/team-info.d.ts +0 -5
  212. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/team-info.d.ts.map +0 -1
  213. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/team-info.js +0 -32
  214. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/team-info.js.map +0 -1
  215. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-create.d.ts +0 -14
  216. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-create.d.ts.map +0 -1
  217. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-create.js +0 -11
  218. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-create.js.map +0 -1
  219. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-detail.d.ts +0 -9
  220. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-detail.d.ts.map +0 -1
  221. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-detail.js +0 -85
  222. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-detail.js.map +0 -1
  223. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-search.d.ts +0 -13
  224. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-search.d.ts.map +0 -1
  225. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-search.js +0 -44
  226. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-search.js.map +0 -1
  227. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-update.d.ts +0 -14
  228. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-update.d.ts.map +0 -1
  229. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-update.js +0 -18
  230. package/payload/platform/plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-update.js.map +0 -1
  231. package/payload/premium-plugins/real-agency/plugins/.claude-plugin/marketplace.json +0 -13
  232. package/payload/premium-plugins/real-agency/plugins/loop/.claude-plugin/plugin.json +0 -17
  233. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/index.d.ts +0 -2
  234. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/index.d.ts.map +0 -1
  235. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/index.js +0 -293
  236. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/index.js.map +0 -1
  237. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/lib/crypto.d.ts +0 -10
  238. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/lib/crypto.d.ts.map +0 -1
  239. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/lib/crypto.js +0 -88
  240. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/lib/crypto.js.map +0 -1
  241. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/lib/loop-api.d.ts +0 -82
  242. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/lib/loop-api.d.ts.map +0 -1
  243. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/lib/loop-api.js +0 -427
  244. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/lib/loop-api.js.map +0 -1
  245. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/lib/neo4j.d.ts +0 -5
  246. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/lib/neo4j.d.ts.map +0 -1
  247. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/lib/neo4j.js +0 -40
  248. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/lib/neo4j.js.map +0 -1
  249. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/customer-preferences.d.ts +0 -10
  250. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/customer-preferences.d.ts.map +0 -1
  251. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/customer-preferences.js +0 -24
  252. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/customer-preferences.js.map +0 -1
  253. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/feedback.d.ts +0 -16
  254. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/feedback.d.ts.map +0 -1
  255. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/feedback.js +0 -35
  256. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/feedback.js.map +0 -1
  257. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/key-deregister.d.ts +0 -5
  258. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/key-deregister.d.ts.map +0 -1
  259. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/key-deregister.js +0 -19
  260. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/key-deregister.js.map +0 -1
  261. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/key-list.d.ts +0 -4
  262. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/key-list.d.ts.map +0 -1
  263. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/key-list.js +0 -14
  264. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/key-list.js.map +0 -1
  265. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/key-register.d.ts +0 -9
  266. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/key-register.d.ts.map +0 -1
  267. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/key-register.js +0 -60
  268. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/key-register.js.map +0 -1
  269. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-enquiry.d.ts +0 -13
  270. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-enquiry.d.ts.map +0 -1
  271. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-enquiry.js +0 -41
  272. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-enquiry.js.map +0 -1
  273. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match-batch.d.ts +0 -9
  274. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match-batch.d.ts.map +0 -1
  275. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match-batch.js +0 -16
  276. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match-batch.js.map +0 -1
  277. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match-request.d.ts +0 -15
  278. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match-request.d.ts.map +0 -1
  279. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match-request.js +0 -11
  280. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match-request.js.map +0 -1
  281. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match.d.ts +0 -10
  282. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match.d.ts.map +0 -1
  283. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match.js +0 -39
  284. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/marketing-match.js.map +0 -1
  285. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/people-detail.d.ts +0 -9
  286. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/people-detail.d.ts.map +0 -1
  287. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/people-detail.js +0 -125
  288. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/people-detail.js.map +0 -1
  289. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/people-search.d.ts +0 -18
  290. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/people-search.d.ts.map +0 -1
  291. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/people-search.js +0 -87
  292. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/people-search.js.map +0 -1
  293. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/property-detail.d.ts +0 -10
  294. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/property-detail.d.ts.map +0 -1
  295. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/property-detail.js +0 -82
  296. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/property-detail.js.map +0 -1
  297. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/property-listed.d.ts +0 -12
  298. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/property-listed.d.ts.map +0 -1
  299. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/property-listed.js +0 -32
  300. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/property-listed.js.map +0 -1
  301. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/property-request.d.ts +0 -15
  302. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/property-request.d.ts.map +0 -1
  303. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/property-request.js +0 -11
  304. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/property-request.js.map +0 -1
  305. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/property-search.d.ts +0 -16
  306. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/property-search.d.ts.map +0 -1
  307. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/property-search.js +0 -41
  308. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/property-search.js.map +0 -1
  309. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/supplier.d.ts +0 -13
  310. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/supplier.d.ts.map +0 -1
  311. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/supplier.js +0 -49
  312. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/supplier.js.map +0 -1
  313. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/team-availability.d.ts +0 -7
  314. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/team-availability.d.ts.map +0 -1
  315. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/team-availability.js +0 -19
  316. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/team-availability.js.map +0 -1
  317. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/team-info.d.ts +0 -5
  318. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/team-info.d.ts.map +0 -1
  319. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/team-info.js +0 -32
  320. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/team-info.js.map +0 -1
  321. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-create.d.ts +0 -14
  322. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-create.d.ts.map +0 -1
  323. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-create.js +0 -11
  324. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-create.js.map +0 -1
  325. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-detail.d.ts +0 -9
  326. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-detail.d.ts.map +0 -1
  327. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-detail.js +0 -85
  328. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-detail.js.map +0 -1
  329. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-search.d.ts +0 -13
  330. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-search.d.ts.map +0 -1
  331. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-search.js +0 -44
  332. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-search.js.map +0 -1
  333. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-update.d.ts +0 -14
  334. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-update.d.ts.map +0 -1
  335. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-update.js +0 -18
  336. package/payload/premium-plugins/real-agency/plugins/loop/mcp/dist/tools/viewing-update.js.map +0 -1
  337. package/payload/server/public/assets/channel-ad6bhEyF.js +0 -1
  338. package/payload/server/public/assets/classDiagram-6PBFFD2Q-D9Gycby2.js +0 -1
  339. package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-sUgm3wmz.js +0 -1
  340. package/payload/server/public/assets/clone-CZxh5VW0.js +0 -1
  341. package/payload/server/public/assets/data-DarDs6k1.js +0 -1
  342. package/payload/server/public/assets/graph-CG9KcTMy.js +0 -1
  343. package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-CekuC-ks.js +0 -1
  344. /package/payload/server/public/assets/{brand-B62OQoRC.js → brand-lj7EhWRg.js} +0 -0
@@ -1,61 +0,0 @@
1
- // Task 033 — install-invariant for OnboardingState seed.
2
- //
3
- // The installer re-reads Neo4j after seed-neo4j.sh to verify the
4
- // OnboardingState node landed. The parser turns cypher-shell's plain-
5
- // format output into a tri-state outcome consumed by the loud-fail
6
- // branch in src/index.ts. These tests fence the three outcomes the
7
- // installer logs name: present / missing / unreachable.
8
- import test from "node:test";
9
- import assert from "node:assert/strict";
10
- import { classifyOnboardingReadBack } from "../onboarding-readback.js";
11
- test("non-zero exit → unreachable, with stderr tail captured", () => {
12
- const outcome = classifyOnboardingReadBack({
13
- status: 1,
14
- stdout: "",
15
- stderr: "Connection refused: bolt://localhost:7687",
16
- });
17
- assert.equal(outcome.kind, "unreachable");
18
- if (outcome.kind === "unreachable") {
19
- assert.match(outcome.stderrTail, /Connection refused/);
20
- }
21
- });
22
- test("header row only (no match) → missing", () => {
23
- // cypher-shell --format plain emits the column header even when zero rows
24
- // matched. The seed-or-fail contract treats header-only as the loud-fail.
25
- const outcome = classifyOnboardingReadBack({
26
- status: 0,
27
- stdout: "currentStep\n",
28
- stderr: "",
29
- });
30
- assert.equal(outcome.kind, "missing");
31
- });
32
- test("data row present → present, currentStep relayed verbatim", () => {
33
- const outcome = classifyOnboardingReadBack({
34
- status: 0,
35
- stdout: "currentStep\n0\n",
36
- stderr: "",
37
- });
38
- assert.equal(outcome.kind, "present");
39
- if (outcome.kind === "present") {
40
- assert.equal(outcome.currentStep, "0");
41
- }
42
- });
43
- test("empty stdout + zero exit → missing (defensive: cypher-shell flushed nothing)", () => {
44
- const outcome = classifyOnboardingReadBack({
45
- status: 0,
46
- stdout: "",
47
- stderr: "",
48
- });
49
- assert.equal(outcome.kind, "missing");
50
- });
51
- test("trailing whitespace tolerated on present row", () => {
52
- const outcome = classifyOnboardingReadBack({
53
- status: 0,
54
- stdout: "currentStep\n0 \n\n",
55
- stderr: "",
56
- });
57
- assert.equal(outcome.kind, "present");
58
- if (outcome.kind === "present") {
59
- assert.equal(outcome.currentStep, "0");
60
- }
61
- });
@@ -1,27 +0,0 @@
1
- // Task 033 — pure parser for the OnboardingState read-back assertion.
2
- //
3
- // Extracted into a dedicated module (not src/index.ts) so the test
4
- // suite can import it without triggering index's brand.json-at-load
5
- // side effect. The installer's loud-fail branches at
6
- // `assertOnboardingStateSeeded` consume the tri-state outcome.
7
- /**
8
- * Classify cypher-shell --format plain output into one of three states:
9
- *
10
- * - `unreachable` — non-zero exit (auth, network, syntax). Stderr tail
11
- * (last 200 chars) is preserved so the install log carries the
12
- * symptom verbatim.
13
- * - `missing` — exit 0 but no data row beyond the header. cypher-shell
14
- * prints the column name even on a zero-match query.
15
- * - `present` — exit 0 with at least one data row. `currentStep` is the
16
- * first field on row 2.
17
- */
18
- export function classifyOnboardingReadBack(input) {
19
- if (input.status !== 0) {
20
- return { kind: "unreachable", stderrTail: input.stderr.trim().slice(-200) };
21
- }
22
- const lines = input.stdout.trim().split("\n").filter((l) => l.length > 0);
23
- if (lines.length < 2) {
24
- return { kind: "missing" };
25
- }
26
- return { kind: "present", currentStep: lines[1].trim() };
27
- }
@@ -1,22 +0,0 @@
1
- /**
2
- * Centralised Anthropic API key management.
3
- *
4
- * Provides read/write/validate operations for the Anthropic API key
5
- * used by the public agent. All consumers import from this module
6
- * instead of inlining the env-var-then-file lookup pattern.
7
- *
8
- * Follows the same shape as cloudflare/mcp/src/lib/cloudflared.ts
9
- * (readToken, writeToken, hasToken, validateToken).
10
- */
11
- export declare function readKey(): string | null;
12
- export declare function writeKey(key: string): void;
13
- export declare function hasKey(): boolean;
14
- export declare function deleteKey(): void;
15
- export type KeyStatus = "valid" | "billing" | "auth_error" | "missing" | "error";
16
- export interface KeyValidation {
17
- status: KeyStatus;
18
- message: string;
19
- }
20
- export declare function validateKey(key?: string): Promise<KeyValidation>;
21
- export declare function keyFilePath(): string;
22
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAoEH,wBAAgB,OAAO,IAAI,MAAM,GAAG,IAAI,CAiDvC;AAMD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAiB1C;AAMD,wBAAgB,MAAM,IAAI,OAAO,CAEhC;AAaD,wBAAgB,SAAS,IAAI,IAAI,CAsBhC;AAUD,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,GAAG,OAAO,CAAC;AAEjF,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,WAAW,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAsFtE;AAOD,wBAAgB,WAAW,IAAI,MAAM,CAEpC"}
@@ -1,232 +0,0 @@
1
- "use strict";
2
- /**
3
- * Centralised Anthropic API key management.
4
- *
5
- * Provides read/write/validate operations for the Anthropic API key
6
- * used by the public agent. All consumers import from this module
7
- * instead of inlining the env-var-then-file lookup pattern.
8
- *
9
- * Follows the same shape as cloudflare/mcp/src/lib/cloudflared.ts
10
- * (readToken, writeToken, hasToken, validateToken).
11
- */
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.readKey = readKey;
14
- exports.writeKey = writeKey;
15
- exports.hasKey = hasKey;
16
- exports.deleteKey = deleteKey;
17
- exports.validateKey = validateKey;
18
- exports.keyFilePath = keyFilePath;
19
- const index_js_1 = require("../../models/dist/index.js");
20
- const node_fs_1 = require("node:fs");
21
- const node_path_1 = require("node:path");
22
- const node_os_1 = require("node:os");
23
- // ---------------------------------------------------------------------------
24
- // Path resolution — lazy, cached
25
- //
26
- // The key file lives at ~/{configDir}/.anthropic-api-key where configDir
27
- // is read from brand.json. Resolution strategy:
28
- // 1. PLATFORM_ROOT env var → brand.json → configDir (MCP servers)
29
- // 2. MAXY_PLATFORM_ROOT env var → brand.json → configDir (UI/Next.js)
30
- // 3. Fall back to .maxy (dev environment, neither env var set)
31
- // ---------------------------------------------------------------------------
32
- let cachedKeyFilePath = null;
33
- function resolveKeyFilePath() {
34
- if (cachedKeyFilePath)
35
- return cachedKeyFilePath;
36
- let configDirName = ".maxy"; // default for dev
37
- const platformRoot = process.env.PLATFORM_ROOT ?? process.env.MAXY_PLATFORM_ROOT;
38
- if (platformRoot) {
39
- const brandPath = (0, node_path_1.join)(platformRoot, "config", "brand.json");
40
- if (!(0, node_fs_1.existsSync)(brandPath)) {
41
- throw new Error(`brand.json not found at ${brandPath} — platform not properly installed`);
42
- }
43
- try {
44
- const brand = JSON.parse((0, node_fs_1.readFileSync)(brandPath, "utf-8"));
45
- if (!brand.configDir) {
46
- throw new Error(`brand.json at ${brandPath} is missing the configDir field`);
47
- }
48
- configDirName = brand.configDir;
49
- }
50
- catch (err) {
51
- if (err instanceof SyntaxError) {
52
- throw new Error(`brand.json at ${brandPath} is not valid JSON: ${err.message}`);
53
- }
54
- throw err;
55
- }
56
- }
57
- cachedKeyFilePath = (0, node_path_1.resolve)((0, node_os_1.homedir)(), configDirName, ".anthropic-api-key");
58
- return cachedKeyFilePath;
59
- }
60
- // ---------------------------------------------------------------------------
61
- // readKey — two-tier lookup: env var → file
62
- //
63
- // Returns the key string or null if unavailable. Never throws on
64
- // missing/unreadable key — callers handle null per their context.
65
- // ---------------------------------------------------------------------------
66
- function readKey() {
67
- const envKey = process.env.ANTHROPIC_API_KEY;
68
- if (envKey && envKey.trim()) {
69
- return envKey.trim();
70
- }
71
- let keyFilePath;
72
- try {
73
- keyFilePath = resolveKeyFilePath();
74
- }
75
- catch (err) {
76
- const msg = err instanceof Error ? err.message : String(err);
77
- console.error(`[anthropic-key] path resolution failed: ${msg}`);
78
- return null;
79
- }
80
- if (envKey !== undefined) {
81
- // env var was set but empty — log and fall through to file
82
- console.error(`[anthropic-key] ANTHROPIC_API_KEY env var is set but empty, falling back to file`);
83
- }
84
- try {
85
- const raw = (0, node_fs_1.readFileSync)(keyFilePath, "utf-8").trim();
86
- if (!raw) {
87
- console.error(`[anthropic-key] key file exists but is empty: ${keyFilePath}`);
88
- return null;
89
- }
90
- return raw;
91
- }
92
- catch (err) {
93
- const code = err instanceof Error && "code" in err
94
- ? err.code
95
- : undefined;
96
- if (code === "ENOENT") {
97
- // File does not exist — expected on fresh installs
98
- console.error(`[anthropic-key] no key available (env var unset, file not found: ${keyFilePath})`);
99
- }
100
- else {
101
- const msg = err instanceof Error ? err.message : String(err);
102
- console.error(`[anthropic-key] failed to read key file ${keyFilePath}: ${msg}`);
103
- }
104
- return null;
105
- }
106
- }
107
- // ---------------------------------------------------------------------------
108
- // writeKey — validate format and write with restricted permissions
109
- // ---------------------------------------------------------------------------
110
- function writeKey(key) {
111
- const trimmed = key.trim();
112
- if (!trimmed.startsWith("sk-ant-")) {
113
- throw new Error("Invalid key format. Must start with sk-ant-.");
114
- }
115
- if (trimmed.length < 90) {
116
- throw new Error("Invalid key format. Must be at least 90 characters.");
117
- }
118
- const keyFilePath = resolveKeyFilePath();
119
- (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(keyFilePath), { recursive: true });
120
- (0, node_fs_1.writeFileSync)(keyFilePath, trimmed, { mode: 0o600 });
121
- console.error(`[anthropic-key] key written to ${keyFilePath}`);
122
- }
123
- // ---------------------------------------------------------------------------
124
- // hasKey — thin check, no validation
125
- // ---------------------------------------------------------------------------
126
- function hasKey() {
127
- return readKey() !== null;
128
- }
129
- // ---------------------------------------------------------------------------
130
- // deleteKey — remove the stored key file; idempotent on ENOENT
131
- //
132
- // Throws on unexpected fs errors (EACCES, EBUSY, EPERM) so callers can
133
- // surface a structured failure. ENOENT is treated as a no-op because the
134
- // intended post-condition ("no key file on disk") is already satisfied.
135
- // Per Task 531 learning, never use `{ force: true }` — it swallows the
136
- // error classes that matter (permission, busy) and leaves the caller
137
- // believing removal succeeded.
138
- // ---------------------------------------------------------------------------
139
- function deleteKey() {
140
- const keyFilePath = resolveKeyFilePath();
141
- try {
142
- (0, node_fs_1.unlinkSync)(keyFilePath);
143
- console.error(`[anthropic-key] deleteKey: removed ${keyFilePath}`);
144
- }
145
- catch (err) {
146
- const code = err instanceof Error && "code" in err
147
- ? err.code
148
- : undefined;
149
- if (code === "ENOENT") {
150
- console.error(`[anthropic-key] deleteKey: nothing to remove (ENOENT): ${keyFilePath}`);
151
- return;
152
- }
153
- const msg = err instanceof Error ? err.message : String(err);
154
- console.error(`[anthropic-key] deleteKey: failed to remove ${keyFilePath}: ${msg}`);
155
- throw err;
156
- }
157
- }
158
- async function validateKey(key) {
159
- const effectiveKey = key ?? readKey();
160
- if (!effectiveKey) {
161
- return {
162
- status: "missing",
163
- message: "No API key available (env var unset, file missing or empty).",
164
- };
165
- }
166
- const start = Date.now();
167
- try {
168
- const res = await fetch("https://api.anthropic.com/v1/messages", {
169
- method: "POST",
170
- headers: {
171
- "Content-Type": "application/json",
172
- "x-api-key": effectiveKey,
173
- "anthropic-version": "2023-06-01",
174
- },
175
- body: JSON.stringify({
176
- model: index_js_1.HAIKU_MODEL,
177
- max_tokens: 1,
178
- messages: [{ role: "user", content: "hi" }],
179
- }),
180
- signal: AbortSignal.timeout(10000),
181
- });
182
- const latency = Date.now() - start;
183
- if (res.ok || res.status === 429) {
184
- // Consume the response body to release the connection back to the pool.
185
- await res.text();
186
- console.error(`[anthropic-key] validate: valid (${res.status}, ${latency}ms)`);
187
- return {
188
- status: "valid",
189
- message: "API key is working. Credits available.",
190
- };
191
- }
192
- const body = await res.text();
193
- if (/credit balance|billing|purchase credits/i.test(body)) {
194
- console.error(`[anthropic-key] validate: billing (${res.status}, ${latency}ms)`);
195
- return {
196
- status: "billing",
197
- message: "API key is valid but credit balance is too low. The user must add credits at console.anthropic.com under Plans & Billing, or enable auto-top-up.",
198
- };
199
- }
200
- if (res.status === 401 ||
201
- res.status === 403 ||
202
- /authentication_error|permission_error/i.test(body)) {
203
- console.error(`[anthropic-key] validate: auth_error (${res.status}, ${latency}ms)`);
204
- return {
205
- status: "auth_error",
206
- message: "API key was rejected. It may be invalid, revoked, or expired. The user should create a new key at console.anthropic.com/settings/keys.",
207
- };
208
- }
209
- console.error(`[anthropic-key] validate: error (${res.status}, ${latency}ms)`);
210
- return {
211
- status: "error",
212
- message: `Could not verify API key. Anthropic returned ${res.status}. This may be a temporary outage — try again later.`,
213
- };
214
- }
215
- catch (err) {
216
- const latency = Date.now() - start;
217
- const msg = err instanceof Error ? err.message : String(err);
218
- console.error(`[anthropic-key] validate: error (network failure, ${latency}ms): ${msg}`);
219
- return {
220
- status: "error",
221
- message: `Could not reach the Anthropic API: ${msg}. Check network connectivity.`,
222
- };
223
- }
224
- }
225
- // ---------------------------------------------------------------------------
226
- // keyFilePath — expose the resolved path for callers that need it
227
- // (e.g., existsSync checks, user-facing messages about the key location)
228
- // ---------------------------------------------------------------------------
229
- function keyFilePath() {
230
- return resolveKeyFilePath();
231
- }
232
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAoEH,0BAiDC;AAMD,4BAiBC;AAMD,wBAEC;AAaD,8BAsBC;AAiBD,kCAsFC;AAOD,kCAEC;AArSD,yDAAyD;AACzD,qCAMiB;AACjB,yCAAmD;AACnD,qCAAkC;AAElC,8EAA8E;AAC9E,iCAAiC;AACjC,EAAE;AACF,yEAAyE;AACzE,gDAAgD;AAChD,qEAAqE;AACrE,yEAAyE;AACzE,kEAAkE;AAClE,8EAA8E;AAE9E,IAAI,iBAAiB,GAAkB,IAAI,CAAC;AAE5C,SAAS,kBAAkB;IACzB,IAAI,iBAAiB;QAAE,OAAO,iBAAiB,CAAC;IAEhD,IAAI,a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AgD,GAAG,CAAC,MAAM,qDAAqD;SACzH,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;QACnC,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7D,OAAO,CAAC,KAAK,CACX,qDAAqD,OAAO,QAAQ,GAAG,EAAE,CAC1E,CAAC;QACF,OAAO;YACL,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,sCAAsC,GAAG,+BAA+B;SAClF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,8EAA8E;AAC9E,kEAAkE;AAClE,yEAAyE;AACzE,8EAA8E;AAE9E,SAAgB,WAAW;IACzB,OAAO,kBAAkB,EAAE,CAAC;AAC9B,CAAC"}
@@ -1,39 +0,0 @@
1
- export interface OnboardingState {
2
- currentStep: number;
3
- step1CompletedAt: string | null;
4
- step2CompletedAt: string | null;
5
- step3CompletedAt: string | null;
6
- step4CompletedAt: string | null;
7
- step5CompletedAt: string | null;
8
- step6CompletedAt: string | null;
9
- step7CompletedAt: string | null;
10
- step8CompletedAt: string | null;
11
- step9CompletedAt: string | null;
12
- createdAt: string;
13
- updatedAt: string;
14
- }
15
- export interface SessionLike {
16
- run(query: string, params?: Record<string, unknown>): Promise<{
17
- records: Array<{
18
- get(key: string): unknown;
19
- }>;
20
- }>;
21
- close(): Promise<void>;
22
- }
23
- /**
24
- * Task 562: consume the step-7 completion flag written by setup-tunnel.sh
25
- * before the service restart. The script runs inside ${BRAND}.service's
26
- * cgroup and cannot complete the MCP call after dispatching the restart —
27
- * so it drops a filesystem marker instead. The first read of onboarding
28
- * state after the restart picks it up, advances the graph via the same
29
- * CASE-WHEN-NULL cypher as completeOnboardingStep, and deletes the marker.
30
- *
31
- * Idempotent at every layer: a missing flag is a no-op; a flag present
32
- * against an already-completed step is a no-op on the graph (CASE-WHEN-NULL
33
- * preserves the existing timestamp); a crash between graph write and flag
34
- * delete re-consumes on the next call with the same no-op outcome.
35
- */
36
- export declare function consumeStep7Flag(session: SessionLike, accountId: string, accountDir: string): Promise<boolean>;
37
- export declare function getOnboardingState(sessionFactory: () => SessionLike, accountId: string, accountDir: string): Promise<OnboardingState>;
38
- export declare function completeOnboardingStep(sessionFactory: () => SessionLike, accountId: string, step: number): Promise<OnboardingState>;
39
- //# sourceMappingURL=onboarding.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"onboarding.d.ts","sourceRoot":"","sources":["../../src/lib/onboarding.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;QAC5D,OAAO,EAAE,KAAK,CAAC;YAAE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;SAAE,CAAC,CAAC;KAC/C,CAAC,CAAC;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAoED;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,OAAO,CAAC,CA4DlB;AAgBD,wBAAsB,kBAAkB,CACtC,cAAc,EAAE,MAAM,WAAW,EACjC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,CAAC,CA4E1B;AAED,wBAAsB,sBAAsB,CAC1C,cAAc,EAAE,MAAM,WAAW,EACjC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,eAAe,CAAC,CA6C1B"}
@@ -1,249 +0,0 @@
1
- // Onboarding state management — graph-persisted workflow state.
2
- // Purpose-built for Phase 0; migrates to a Workflow node with Task 13.
3
- import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
4
- import { join } from "node:path";
5
- const STEP_FIELDS = [
6
- "step1CompletedAt",
7
- "step2CompletedAt",
8
- "step3CompletedAt",
9
- "step4CompletedAt",
10
- "step5CompletedAt",
11
- "step6CompletedAt",
12
- "step7CompletedAt",
13
- "step8CompletedAt",
14
- "step9CompletedAt",
15
- ];
16
- // neo4j-driver v5 returns Integer objects for integer properties, not native
17
- // JS numbers. This converts them safely (values 0–9 are well within range).
18
- function toJsNumber(val) {
19
- if (typeof val === "number")
20
- return val;
21
- if (val && typeof val === "object" && "toNumber" in val) {
22
- return val.toNumber();
23
- }
24
- return 0;
25
- }
26
- function recordToState(record) {
27
- return {
28
- currentStep: toJsNumber(record.get("currentStep")),
29
- step1CompletedAt: record.get("step1CompletedAt") ?? null,
30
- step2CompletedAt: record.get("step2CompletedAt") ?? null,
31
- step3CompletedAt: record.get("step3CompletedAt") ?? null,
32
- step4CompletedAt: record.get("step4CompletedAt") ?? null,
33
- step5CompletedAt: record.get("step5CompletedAt") ?? null,
34
- step6CompletedAt: record.get("step6CompletedAt") ?? null,
35
- step7CompletedAt: record.get("step7CompletedAt") ?? null,
36
- step8CompletedAt: record.get("step8CompletedAt") ?? null,
37
- step9CompletedAt: record.get("step9CompletedAt") ?? null,
38
- createdAt: record.get("createdAt") ?? new Date().toISOString(),
39
- updatedAt: record.get("updatedAt") ?? new Date().toISOString(),
40
- };
41
- }
42
- function readMigrationStep(accountDir) {
43
- try {
44
- const raw = readFileSync(join(accountDir, "account.json"), "utf-8");
45
- const config = JSON.parse(raw);
46
- if (typeof config.onboardingStep === "number" && config.onboardingStep > 0) {
47
- return config.onboardingStep;
48
- }
49
- }
50
- catch {
51
- // File missing, unreadable, or malformed — no migration data
52
- }
53
- return 0;
54
- }
55
- function removeOnboardingStepFromFile(accountDir) {
56
- try {
57
- const configPath = join(accountDir, "account.json");
58
- const raw = readFileSync(configPath, "utf-8");
59
- const config = JSON.parse(raw);
60
- if ("onboardingStep" in config) {
61
- delete config.onboardingStep;
62
- writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
63
- }
64
- }
65
- catch {
66
- // Tolerate cleanup failure — graph is the authority now
67
- }
68
- }
69
- /**
70
- * Task 562: consume the step-7 completion flag written by setup-tunnel.sh
71
- * before the service restart. The script runs inside ${BRAND}.service's
72
- * cgroup and cannot complete the MCP call after dispatching the restart —
73
- * so it drops a filesystem marker instead. The first read of onboarding
74
- * state after the restart picks it up, advances the graph via the same
75
- * CASE-WHEN-NULL cypher as completeOnboardingStep, and deletes the marker.
76
- *
77
- * Idempotent at every layer: a missing flag is a no-op; a flag present
78
- * against an already-completed step is a no-op on the graph (CASE-WHEN-NULL
79
- * preserves the existing timestamp); a crash between graph write and flag
80
- * delete re-consumes on the next call with the same no-op outcome.
81
- */
82
- export async function consumeStep7Flag(session, accountId, accountDir) {
83
- const flagPath = join(accountDir, "onboarding", "step7-complete");
84
- if (!existsSync(flagPath))
85
- return false;
86
- let completedAt = new Date().toISOString();
87
- try {
88
- const raw = readFileSync(flagPath, "utf-8").trim();
89
- if (raw) {
90
- const parsed = JSON.parse(raw);
91
- if (typeof parsed.completedAt === "string") {
92
- completedAt = parsed.completedAt;
93
- }
94
- }
95
- }
96
- catch {
97
- // Malformed flag content still advances state — the flag's presence
98
- // alone is the authoritative signal; the embedded timestamp is forensic.
99
- }
100
- // RETURN count(o) so we can detect the "no OnboardingState node" case
101
- // where SET is a silent no-op. Without this check, rmSync below would
102
- // delete the flag against a graph that never applied the write, silently
103
- // losing the step-7 completion signal forever.
104
- const result = await session.run(`MATCH (o:OnboardingState {accountId: $accountId})
105
- SET o.step7CompletedAt = CASE WHEN o.step7CompletedAt IS NULL THEN $completedAt ELSE o.step7CompletedAt END,
106
- o.currentStep = CASE WHEN 7 > o.currentStep THEN 7 ELSE o.currentStep END,
107
- o.updatedAt = $completedAt
108
- RETURN count(o) AS updated`, { accountId, completedAt });
109
- const updatedRaw = result.records[0]?.get("updated");
110
- const updated = toJsNumber(updatedRaw);
111
- if (updated === 0) {
112
- // No OnboardingState node yet — leave the flag in place so the next
113
- // reader (after node creation via MERGE in this function's migration
114
- // branch below) can still consume it.
115
- console.log(`[onboarding-flag-consumed] accountId=${accountId.slice(0, 8)}… step=7 ` +
116
- `source=filesystem flagPath=${flagPath} skipped=no-node`);
117
- return false;
118
- }
119
- console.log(`[onboarding-flag-consumed] accountId=${accountId.slice(0, 8)}… step=7 ` +
120
- `source=filesystem flagPath=${flagPath} completedAt=${completedAt}`);
121
- try {
122
- rmSync(flagPath);
123
- }
124
- catch (err) {
125
- console.error(`[onboarding-flag-consumed] warn: failed to delete ${flagPath}: ` +
126
- `${err instanceof Error ? err.message : String(err)}`);
127
- }
128
- return true;
129
- }
130
- const READ_STATE_QUERY = `MATCH (o:OnboardingState {accountId: $accountId})
131
- RETURN o.currentStep AS currentStep,
132
- o.step1CompletedAt AS step1CompletedAt,
133
- o.step2CompletedAt AS step2CompletedAt,
134
- o.step3CompletedAt AS step3CompletedAt,
135
- o.step4CompletedAt AS step4CompletedAt,
136
- o.step5CompletedAt AS step5CompletedAt,
137
- o.step6CompletedAt AS step6CompletedAt,
138
- o.step7CompletedAt AS step7CompletedAt,
139
- o.step8CompletedAt AS step8CompletedAt,
140
- o.step9CompletedAt AS step9CompletedAt,
141
- o.createdAt AS createdAt,
142
- o.updatedAt AS updatedAt`;
143
- export async function getOnboardingState(sessionFactory, accountId, accountDir) {
144
- const session = sessionFactory();
145
- try {
146
- // Check for existing graph node
147
- const existing = await session.run(READ_STATE_QUERY, { accountId });
148
- const nodeExisted = existing.records.length > 0;
149
- if (nodeExisted) {
150
- // Task 562: consume setup-tunnel.sh step-7 flag against the existing
151
- // node. loadOnboardingStep (UI side) usually does this first at session
152
- // start; this call is defensive in case this read precedes it.
153
- //
154
- // Always re-read after the consume attempt. If a concurrent caller
155
- // consumed the flag between our initial read and our consumeStep7Flag
156
- // call, consumeStep7Flag returns false (flag gone) but the graph still
157
- // advanced — returning `existing.records[0]` would hand back the stale
158
- // pre-consumption record. One extra indexed MATCH is negligible and
159
- // guarantees the caller sees the authoritative state.
160
- await consumeStep7Flag(session, accountId, accountDir);
161
- const refreshed = await session.run(READ_STATE_QUERY, { accountId });
162
- return recordToState(refreshed.records[0]);
163
- }
164
- // No graph node — check for migration from account.json
165
- const migratedStep = readMigrationStep(accountDir);
166
- const now = new Date().toISOString();
167
- // Build step completion timestamps for migrated steps.
168
- // account.json only stored a step counter, not per-step timestamps,
169
- // so migrated steps all get the current time — the original times
170
- // were never recorded.
171
- const stepProps = {};
172
- for (let i = 0; i < STEP_FIELDS.length; i++) {
173
- stepProps[STEP_FIELDS[i]] = i < migratedStep ? now : null;
174
- }
175
- // Create the node via MERGE (idempotent under concurrent access)
176
- const result = await session.run(`MERGE (o:OnboardingState {accountId: $accountId})
177
- ON CREATE SET
178
- o.currentStep = $currentStep,
179
- o.step1CompletedAt = $step1CompletedAt,
180
- o.step2CompletedAt = $step2CompletedAt,
181
- o.step3CompletedAt = $step3CompletedAt,
182
- o.step4CompletedAt = $step4CompletedAt,
183
- o.step5CompletedAt = $step5CompletedAt,
184
- o.step6CompletedAt = $step6CompletedAt,
185
- o.step7CompletedAt = $step7CompletedAt,
186
- o.step8CompletedAt = $step8CompletedAt,
187
- o.step9CompletedAt = $step9CompletedAt,
188
- o.createdAt = $now,
189
- o.updatedAt = $now
190
- RETURN o.currentStep AS currentStep,
191
- o.step1CompletedAt AS step1CompletedAt,
192
- o.step2CompletedAt AS step2CompletedAt,
193
- o.step3CompletedAt AS step3CompletedAt,
194
- o.step4CompletedAt AS step4CompletedAt,
195
- o.step5CompletedAt AS step5CompletedAt,
196
- o.step6CompletedAt AS step6CompletedAt,
197
- o.step7CompletedAt AS step7CompletedAt,
198
- o.step8CompletedAt AS step8CompletedAt,
199
- o.step9CompletedAt AS step9CompletedAt,
200
- o.createdAt AS createdAt,
201
- o.updatedAt AS updatedAt`, { accountId, currentStep: migratedStep, now, ...stepProps });
202
- // Clean up account.json if migration happened
203
- if (migratedStep > 0) {
204
- removeOnboardingStepFromFile(accountDir);
205
- }
206
- return recordToState(result.records[0]);
207
- }
208
- finally {
209
- await session.close();
210
- }
211
- }
212
- export async function completeOnboardingStep(sessionFactory, accountId, step) {
213
- if (!Number.isInteger(step) || step < 1 || step > 9) {
214
- throw new Error("Step must be between 1 and 9");
215
- }
216
- const session = sessionFactory();
217
- try {
218
- const stepField = STEP_FIELDS[step - 1];
219
- const now = new Date().toISOString();
220
- // Single query: MATCH + SET. If no node exists, MATCH returns zero
221
- // records and we detect that from the result — no separate check needed.
222
- const result = await session.run(`MATCH (o:OnboardingState {accountId: $accountId})
223
- SET o.${stepField} = CASE WHEN o.${stepField} IS NULL THEN $now ELSE o.${stepField} END,
224
- o.currentStep = CASE WHEN $step > o.currentStep THEN $step ELSE o.currentStep END,
225
- o.updatedAt = $now
226
- RETURN o.currentStep AS currentStep,
227
- o.step1CompletedAt AS step1CompletedAt,
228
- o.step2CompletedAt AS step2CompletedAt,
229
- o.step3CompletedAt AS step3CompletedAt,
230
- o.step4CompletedAt AS step4CompletedAt,
231
- o.step5CompletedAt AS step5CompletedAt,
232
- o.step6CompletedAt AS step6CompletedAt,
233
- o.step7CompletedAt AS step7CompletedAt,
234
- o.step8CompletedAt AS step8CompletedAt,
235
- o.step9CompletedAt AS step9CompletedAt,
236
- o.createdAt AS createdAt,
237
- o.updatedAt AS updatedAt`, { accountId, step, now });
238
- if (result.records.length === 0) {
239
- throw new Error("No onboarding state found for this account. Call onboarding-get first.");
240
- }
241
- console.log(`[onboarding-step-complete] accountId=${accountId.slice(0, 8)}… ` +
242
- `step=${step} completedAt=${now}`);
243
- return recordToState(result.records[0]);
244
- }
245
- finally {
246
- await session.close();
247
- }
248
- }
249
- //# sourceMappingURL=onboarding.js.map