@rubytech/create-realagent-code 0.1.114 → 0.1.115

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 (403) hide show
  1. package/dist/__tests__/installer-specialist-registration.test.js +40 -1
  2. package/dist/__tests__/premium-bundle-gate.test.js +59 -0
  3. package/dist/index.js +24 -1
  4. package/dist/specialist-registration.js +15 -0
  5. package/package.json +1 -1
  6. package/payload/platform/config/brand.json +2 -2
  7. package/payload/platform/neo4j/schema.cypher +1 -1
  8. package/payload/platform/plugins/.claude-plugin/marketplace.json +0 -20
  9. package/payload/platform/plugins/contacts/mcp/dist/index.js +3 -3
  10. package/payload/platform/plugins/contacts/mcp/dist/index.js.map +1 -1
  11. package/payload/platform/plugins/contacts/mcp/dist/tools/contact-create.js +1 -1
  12. package/payload/platform/plugins/docs/references/contacts-guide.md +1 -9
  13. package/payload/platform/plugins/docs/references/getting-started.md +1 -1
  14. package/payload/platform/plugins/docs/references/internals.md +1 -1
  15. package/payload/platform/plugins/docs/references/platform.md +1 -1
  16. package/payload/platform/plugins/docs/references/plugins-guide.md +1 -2
  17. package/payload/platform/plugins/linkedin-import/PLUGIN.md +1 -1
  18. package/payload/platform/plugins/memory/PLUGIN.md +1 -1
  19. package/payload/platform/plugins/sales/.claude-plugin/plugin.json +1 -1
  20. package/payload/platform/plugins/sales/PLUGIN.md +9 -9
  21. package/payload/platform/plugins/sales/references/close-tracking.md +6 -6
  22. package/payload/platform/plugins/sales/references/faq.md +1 -5
  23. package/payload/platform/plugins/sales/references/objection-handling.md +2 -2
  24. package/payload/platform/plugins/scheduling/PLUGIN.md +1 -1
  25. package/payload/platform/plugins/scheduling/mcp/dist/index.js +2 -2
  26. package/payload/platform/plugins/scheduling/mcp/dist/index.js.map +1 -1
  27. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/getUserTimezone.test.js +1 -1
  28. package/payload/platform/plugins/workflows/PLUGIN.md +1 -1
  29. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-execute.d.ts +1 -1
  30. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-execute.js +2 -2
  31. package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-execute.js.map +1 -1
  32. package/payload/platform/scripts/conversation-id-allowlist.txt +0 -7
  33. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
  34. package/payload/platform/services/claude-session-manager/dist/http-server.js +42 -1
  35. package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
  36. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts +34 -0
  37. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
  38. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +83 -2
  39. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
  40. package/payload/platform/templates/specialists/agents/project-manager.md +1 -3
  41. package/payload/server/{chunk-FSPPVVWM.js → chunk-FJCI6X3H.js} +192 -0
  42. package/payload/server/maxy-edge.js +1 -1
  43. package/payload/server/public/assets/{ChatInput-CsnIedhS.js → ChatInput-CJo_77bp.js} +5 -1
  44. package/payload/server/public/assets/{Checkbox-CWugFyFT.js → Checkbox-YrQovXpN.js} +1 -1
  45. package/payload/server/public/assets/{admin-D3gZuyUn.js → admin-DOxHsV7g.js} +25 -25
  46. package/payload/server/public/assets/{architectureDiagram-Q4EWVU46-CeTRKWDb.js → architectureDiagram-Q4EWVU46-Breg9-99.js} +1 -1
  47. package/payload/server/public/assets/{blockDiagram-DXYQGD6D-DeeIX5U3.js → blockDiagram-DXYQGD6D-DXf1_673.js} +1 -1
  48. package/payload/server/public/assets/{c4Diagram-AHTNJAMY-CFsqZuil.js → c4Diagram-AHTNJAMY-CSZ36W4-.js} +1 -1
  49. package/payload/server/public/assets/channel-BmZnt3PP.js +1 -0
  50. package/payload/server/public/assets/{chunk-336JU56O-DpIXuFM0.js → chunk-336JU56O-DsrLk2eK.js} +2 -2
  51. package/payload/server/public/assets/{chunk-426QAEUC-Qk8qqrvA.js → chunk-426QAEUC-JpNfNf81.js} +1 -1
  52. package/payload/server/public/assets/{chunk-4TB4RGXK-DtM8-CUn.js → chunk-4TB4RGXK-DmClEAD0.js} +1 -1
  53. package/payload/server/public/assets/{chunk-5FUZZQ4R-CrSQ4ySU.js → chunk-5FUZZQ4R-BI9blW3N.js} +1 -1
  54. package/payload/server/public/assets/{chunk-5PVQY5BW-Bn2nQwdj.js → chunk-5PVQY5BW-BbgttEFO.js} +1 -1
  55. package/payload/server/public/assets/{chunk-EDXVE4YY-CzCPnR0P.js → chunk-EDXVE4YY-BX_LCFOx.js} +1 -1
  56. package/payload/server/public/assets/{chunk-ENJZ2VHE-CgZj9RoG.js → chunk-ENJZ2VHE-Bb7EoD0w.js} +1 -1
  57. package/payload/server/public/assets/{chunk-ICPOFSXX-wy-eNjwW.js → chunk-ICPOFSXX-DH8uQk-s.js} +1 -1
  58. package/payload/server/public/assets/{chunk-OYMX7WX6-CMmJtL8S.js → chunk-OYMX7WX6-FH5kgXsw.js} +1 -1
  59. package/payload/server/public/assets/{chunk-U2HBQHQK-CFCW7OaT.js → chunk-U2HBQHQK-D_ljlkHr.js} +1 -1
  60. package/payload/server/public/assets/{chunk-X2U36JSP-Bgh-CJSN.js → chunk-X2U36JSP-BX3EmZvm.js} +1 -1
  61. package/payload/server/public/assets/{chunk-YZCP3GAM-BXKwZ4vN.js → chunk-YZCP3GAM-Vu7-E93h.js} +1 -1
  62. package/payload/server/public/assets/{chunk-ZZ45TVLE-BiOuK5NP.js → chunk-ZZ45TVLE-CwjhNPX5.js} +1 -1
  63. package/payload/server/public/assets/classDiagram-6PBFFD2Q-kmMLFUpV.js +1 -0
  64. package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-BV7Ae8ct.js +1 -0
  65. package/payload/server/public/assets/clone-B5eqoN9I.js +1 -0
  66. package/payload/server/public/assets/{dagre-DyCxa9Q2.js → dagre-Ce6gsj0C.js} +1 -1
  67. package/payload/server/public/assets/{dagre-KV5264BT-Cffo_hmf.js → dagre-KV5264BT-BaMGpsoy.js} +1 -1
  68. package/payload/server/public/assets/data-NMvGx6jm.js +1 -0
  69. package/payload/server/public/assets/{diagram-5BDNPKRD-Bt93Du3V.js → diagram-5BDNPKRD-CHEE9rjq.js} +1 -1
  70. package/payload/server/public/assets/{diagram-G4DWMVQ6-v4r-tBsC.js → diagram-G4DWMVQ6-C98sZLW1.js} +1 -1
  71. package/payload/server/public/assets/{diagram-MMDJMWI5-DKrVPOP-.js → diagram-MMDJMWI5-DNvMGsTZ.js} +1 -1
  72. package/payload/server/public/assets/{diagram-TYMM5635-B1PzWQb9.js → diagram-TYMM5635-Cdte4IBa.js} +1 -1
  73. package/payload/server/public/assets/{erDiagram-SMLLAGMA-ClQzsQAs.js → erDiagram-SMLLAGMA-C9VZsWXK.js} +1 -1
  74. package/payload/server/public/assets/{flowDiagram-DWJPFMVM-h3IbpN_7.js → flowDiagram-DWJPFMVM-tuP5fzzR.js} +1 -1
  75. package/payload/server/public/assets/{ganttDiagram-T4ZO3ILL-ClaxOJi8.js → ganttDiagram-T4ZO3ILL-SJgRPUwx.js} +1 -1
  76. package/payload/server/public/assets/{gitGraphDiagram-UUTBAWPF-pM-U4ClD.js → gitGraphDiagram-UUTBAWPF-DU_cI_50.js} +1 -1
  77. package/payload/server/public/assets/graph-BkwTCV2Y.js +1 -0
  78. package/payload/server/public/assets/graph-labels-h39S93Xo.js +1 -0
  79. package/payload/server/public/assets/{graphlib-CwimOv_M.js → graphlib-D_nAsvmx.js} +1 -1
  80. package/payload/server/public/assets/{infoDiagram-42DDH7IO-DcO3Giwe.js → infoDiagram-42DDH7IO-Cj2Y19m6.js} +1 -1
  81. package/payload/server/public/assets/{ishikawaDiagram-UXIWVN3A-BcdSL5VS.js → ishikawaDiagram-UXIWVN3A-DMc1xq1y.js} +1 -1
  82. package/payload/server/public/assets/{journeyDiagram-VCZTEJTY-CYahHYzf.js → journeyDiagram-VCZTEJTY-C4CRAQma.js} +1 -1
  83. package/payload/server/public/assets/{kanban-definition-6JOO6SKY-Cl5KhoS4.js → kanban-definition-6JOO6SKY-CTr4AldU.js} +1 -1
  84. package/payload/server/public/assets/lib-Bnh57com.js +29 -0
  85. package/payload/server/public/assets/{line-d_2oTxLp.js → line-Btlm_IAl.js} +1 -1
  86. package/payload/server/public/assets/{mermaid-parser.core-CMMDGv3x.js → mermaid-parser.core-DXFdj_y1.js} +1 -1
  87. package/payload/server/public/assets/{mermaid.core-DK9ENGbr.js → mermaid.core-DFBhoCr5.js} +3 -3
  88. package/payload/server/public/assets/{mindmap-definition-QFDTVHPH-mA3x3MFG.js → mindmap-definition-QFDTVHPH-r9gVQybo.js} +1 -1
  89. package/payload/server/public/assets/{page-CgDmg_fX.js → page-B0iMmY6t.js} +1 -1
  90. package/payload/server/public/assets/{page-D9lluVl7.js → page-zQ79YCEt.js} +2 -2
  91. package/payload/server/public/assets/{pieDiagram-DEJITSTG-CW1nGFlY.js → pieDiagram-DEJITSTG-CHKZjSaH.js} +1 -1
  92. package/payload/server/public/assets/{public-DdLMkNdS.js → public-DyGWgfaZ.js} +4 -4
  93. package/payload/server/public/assets/{quadrantDiagram-34T5L4WZ-DI5igJhR.js → quadrantDiagram-34T5L4WZ-CSGR1HJr.js} +1 -1
  94. package/payload/server/public/assets/{requirementDiagram-MS252O5E-DyVeI4e_.js → requirementDiagram-MS252O5E-DZ6hX9D6.js} +1 -1
  95. package/payload/server/public/assets/{sankeyDiagram-XADWPNL6-CCTTBYKY.js → sankeyDiagram-XADWPNL6-DbZBKh0m.js} +1 -1
  96. package/payload/server/public/assets/{sequenceDiagram-FGHM5R23-hVVf35ly.js → sequenceDiagram-FGHM5R23-BHHpb8dt.js} +1 -1
  97. package/payload/server/public/assets/{stateDiagram-FHFEXIEX-CSLuQDUX.js → stateDiagram-FHFEXIEX-DQ1jiLB4.js} +1 -1
  98. package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-CByT2RzF.js +1 -0
  99. package/payload/server/public/assets/{timeline-definition-GMOUNBTQ-sxC3W8Q4.js → timeline-definition-GMOUNBTQ-BlGiEU7p.js} +1 -1
  100. package/payload/server/public/assets/{vennDiagram-DHZGUBPP-Ro-ton6Z.js → vennDiagram-DHZGUBPP-DmEH-hsB.js} +1 -1
  101. package/payload/server/public/assets/{wardleyDiagram-NUSXRM2D-T-dKD0Zx.js → wardleyDiagram-NUSXRM2D-C7KJJ40d.js} +1 -1
  102. package/payload/server/public/assets/{xychartDiagram-5P7HB3ND-CfProPts.js → xychartDiagram-5P7HB3ND-JDnusCaa.js} +1 -1
  103. package/payload/server/public/data.html +4 -4
  104. package/payload/server/public/graph.html +5 -5
  105. package/payload/server/public/index.html +7 -7
  106. package/payload/server/public/public.html +4 -4
  107. package/payload/server/server.js +52 -8
  108. package/payload/platform/plugins/teaching/.claude-plugin/plugin.json +0 -8
  109. package/payload/platform/plugins/teaching/PLUGIN.md +0 -58
  110. package/payload/platform/plugins/teaching/skills/interactive-tutor/SKILL.md +0 -59
  111. package/payload/platform/plugins/teaching/skills/interactive-tutor/references/assessment.md +0 -70
  112. package/payload/platform/plugins/teaching/skills/interactive-tutor/references/classroom-conduct.md +0 -43
  113. package/payload/platform/plugins/teaching/skills/interactive-tutor/references/teaching-modes.md +0 -83
  114. package/payload/platform/plugins/teaching/skills/lesson-planner/SKILL.md +0 -48
  115. package/payload/platform/plugins/teaching/skills/lesson-planner/references/context-gathering.md +0 -41
  116. package/payload/platform/plugins/teaching/skills/lesson-planner/references/plan-structure.md +0 -94
  117. package/payload/platform/plugins/teaching/skills/study-pack-builder/SKILL.md +0 -52
  118. package/payload/platform/plugins/teaching/skills/study-pack-builder/references/disaggregation.md +0 -49
  119. package/payload/platform/plugins/teaching/skills/study-pack-builder/references/materials.md +0 -116
  120. package/payload/platform/plugins/venture-studio/.claude-plugin/plugin.json +0 -8
  121. package/payload/platform/plugins/venture-studio/PLUGIN.md +0 -119
  122. package/payload/platform/plugins/venture-studio/bin/scaffold.sh +0 -116
  123. package/payload/platform/plugins/venture-studio/skills/brand-pack/SKILL.md +0 -256
  124. package/payload/platform/plugins/venture-studio/skills/brand-pack/references/color-psychology.md +0 -118
  125. package/payload/platform/plugins/venture-studio/skills/investor-data-room/SKILL.md +0 -374
  126. package/payload/platform/plugins/venture-studio/skills/investor-data-room/references/business-plan-template.md +0 -64
  127. package/payload/platform/plugins/venture-studio/skills/investor-data-room/references/compliance-research-checklist.md +0 -53
  128. package/payload/platform/plugins/venture-studio/skills/investor-data-room/references/data-room-structure.md +0 -88
  129. package/payload/platform/plugins/venture-studio/skills/investor-data-room/references/deck-blueprint-template.md +0 -39
  130. package/payload/platform/plugins/venture-studio/skills/investor-data-room/references/design-tokens-application.md +0 -79
  131. package/payload/platform/plugins/venture-studio/skills/investor-data-room/references/html-pdf-pipeline.md +0 -236
  132. package/payload/platform/plugins/venture-studio/skills/investor-data-room/references/internal-workings-scrub.md +0 -33
  133. package/payload/platform/plugins/venture-studio/skills/investor-data-room/references/termsheet-template.md +0 -88
  134. package/payload/platform/plugins/venture-studio/skills/investor-data-room/templates/prospectus/index.html +0 -1565
  135. package/payload/platform/plugins/venture-studio/skills/investor-data-room/templates/prospectus/render-pdf.mjs +0 -91
  136. package/payload/platform/plugins/venture-studio/skills/investor-data-room/templates/prospectus/term_sheet.html +0 -715
  137. package/payload/platform/plugins/venture-studio/skills/office-hours/SKILL.md +0 -587
  138. package/payload/platform/plugins/venture-studio/skills/prototype-host/SKILL.md +0 -179
  139. package/payload/platform/plugins/venture-studio/skills/prototype-host/references/cloudflared-ingress-edit.md +0 -81
  140. package/payload/platform/plugins/venture-studio/skills/prototype-host/references/scaffold-frameworks.md +0 -60
  141. package/payload/platform/plugins/venture-studio/skills/prototype-host/references/systemd-user-service.md +0 -104
  142. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/SKILL.md +0 -336
  143. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/aarrr-metrics.md +0 -275
  144. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/assumption-testing.md +0 -93
  145. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/boolean-search.md +0 -308
  146. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/build-measure-learn.md +0 -262
  147. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/business-model-canvas.md +0 -171
  148. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/commitment-signals.md +0 -246
  149. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/design-thinking.md +0 -183
  150. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/earlyvangelist.md +0 -190
  151. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/first-principles.md +0 -58
  152. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/fishbone.md +0 -114
  153. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/five-whys.md +0 -43
  154. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/ice-scoring.md +0 -237
  155. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/innovation-accounting.md +0 -290
  156. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/jtbd.md +0 -105
  157. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/landing-page.md +0 -361
  158. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/market-type.md +0 -167
  159. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/mom-test.md +0 -193
  160. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/mvp-types.md +0 -200
  161. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/og-images.md +0 -239
  162. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/pareto.md +0 -103
  163. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/persona-development.md +0 -291
  164. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/pivot-types.md +0 -225
  165. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/positioning-statement.md +0 -179
  166. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/prd.md +0 -363
  167. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/pre-mortem.md +0 -74
  168. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/problem-validation.md +0 -253
  169. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/product-market-fit.md +0 -256
  170. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/research-synthesis.md +0 -276
  171. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/three-engines-of-growth.md +0 -248
  172. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/validation-tests.md +0 -89
  173. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/value-proposition-canvas.md +0 -121
  174. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/win-loss-analysis.md +0 -242
  175. package/payload/platform/plugins/venture-studio/skills/zero-to-prototype/references/workflow-mapping.md +0 -271
  176. package/payload/platform/plugins/waitlist/.claude-plugin/plugin.json +0 -17
  177. package/payload/platform/plugins/waitlist/PLUGIN.md +0 -86
  178. package/payload/platform/plugins/waitlist/mcp/dist/index.d.ts +0 -2
  179. package/payload/platform/plugins/waitlist/mcp/dist/index.d.ts.map +0 -1
  180. package/payload/platform/plugins/waitlist/mcp/dist/index.js +0 -388
  181. package/payload/platform/plugins/waitlist/mcp/dist/index.js.map +0 -1
  182. package/payload/platform/plugins/waitlist/mcp/dist/lib/admin-model.d.ts +0 -16
  183. package/payload/platform/plugins/waitlist/mcp/dist/lib/admin-model.d.ts.map +0 -1
  184. package/payload/platform/plugins/waitlist/mcp/dist/lib/admin-model.js +0 -58
  185. package/payload/platform/plugins/waitlist/mcp/dist/lib/admin-model.js.map +0 -1
  186. package/payload/platform/plugins/waitlist/mcp/dist/lib/embedding.d.ts +0 -3
  187. package/payload/platform/plugins/waitlist/mcp/dist/lib/embedding.d.ts.map +0 -1
  188. package/payload/platform/plugins/waitlist/mcp/dist/lib/embedding.js +0 -48
  189. package/payload/platform/plugins/waitlist/mcp/dist/lib/embedding.js.map +0 -1
  190. package/payload/platform/plugins/waitlist/mcp/dist/lib/neo4j.d.ts +0 -5
  191. package/payload/platform/plugins/waitlist/mcp/dist/lib/neo4j.d.ts.map +0 -1
  192. package/payload/platform/plugins/waitlist/mcp/dist/lib/neo4j.js +0 -40
  193. package/payload/platform/plugins/waitlist/mcp/dist/lib/neo4j.js.map +0 -1
  194. package/payload/platform/plugins/waitlist/mcp/dist/tools/__tests__/waitlist-persist.test.d.ts +0 -2
  195. package/payload/platform/plugins/waitlist/mcp/dist/tools/__tests__/waitlist-persist.test.d.ts.map +0 -1
  196. package/payload/platform/plugins/waitlist/mcp/dist/tools/__tests__/waitlist-persist.test.js +0 -70
  197. package/payload/platform/plugins/waitlist/mcp/dist/tools/__tests__/waitlist-persist.test.js.map +0 -1
  198. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-extract.d.ts +0 -34
  199. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-extract.d.ts.map +0 -1
  200. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-extract.js +0 -129
  201. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-extract.js.map +0 -1
  202. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-heal.d.ts +0 -27
  203. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-heal.d.ts.map +0 -1
  204. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-heal.js +0 -127
  205. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-heal.js.map +0 -1
  206. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-list.d.ts +0 -23
  207. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-list.d.ts.map +0 -1
  208. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-list.js +0 -58
  209. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-list.js.map +0 -1
  210. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-persist.d.ts +0 -83
  211. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-persist.d.ts.map +0 -1
  212. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-persist.js +0 -433
  213. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-persist.js.map +0 -1
  214. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-review.d.ts +0 -19
  215. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-review.d.ts.map +0 -1
  216. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-review.js +0 -81
  217. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-review.js.map +0 -1
  218. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-scan.d.ts +0 -28
  219. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-scan.d.ts.map +0 -1
  220. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-scan.js +0 -50
  221. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-scan.js.map +0 -1
  222. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-setup.d.ts +0 -33
  223. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-setup.d.ts.map +0 -1
  224. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-setup.js +0 -297
  225. package/payload/platform/plugins/waitlist/mcp/dist/tools/waitlist-setup.js.map +0 -1
  226. package/payload/platform/plugins/waitlist/mcp/package.json +0 -23
  227. package/payload/platform/plugins/waitlist/mcp/vitest.config.ts +0 -9
  228. package/payload/platform/plugins/writer-craft/.claude-plugin/plugin.json +0 -8
  229. package/payload/platform/plugins/writer-craft/PLUGIN.md +0 -88
  230. package/payload/platform/plugins/writer-craft/agents/writer-craft--manuscript-reviewer.md +0 -92
  231. package/payload/platform/plugins/writer-craft/skills/citation-style/SKILL.md +0 -94
  232. package/payload/platform/plugins/writer-craft/skills/citation-style/references/book-and-chapter-models.md +0 -77
  233. package/payload/platform/plugins/writer-craft/skills/citation-style/references/citation-rules.md +0 -103
  234. package/payload/platform/plugins/writer-craft/skills/citation-style/references/journal-article-models.md +0 -74
  235. package/payload/platform/plugins/writer-craft/skills/citation-style/references/other-source-models.md +0 -146
  236. package/payload/platform/plugins/writer-craft/skills/citation-style/references/reference-list-rules.md +0 -70
  237. package/payload/platform/plugins/writer-craft/skills/editorial-practice/SKILL.md +0 -108
  238. package/payload/platform/plugins/writer-craft/skills/editorial-practice/references/copyediting.md +0 -73
  239. package/payload/platform/plugins/writer-craft/skills/editorial-practice/references/developmental-editing.md +0 -85
  240. package/payload/platform/plugins/writer-craft/skills/editorial-practice/references/genre-specific-editing.md +0 -78
  241. package/payload/platform/plugins/writer-craft/skills/editorial-practice/references/line-editing.md +0 -55
  242. package/payload/platform/plugins/writer-craft/skills/editorial-practice/references/self-editing.md +0 -89
  243. package/payload/platform/plugins/writer-craft/skills/persuasive-storytelling/SKILL.md +0 -114
  244. package/payload/platform/plugins/writer-craft/skills/persuasive-storytelling/references/audience-analysis.md +0 -73
  245. package/payload/platform/plugins/writer-craft/skills/persuasive-storytelling/references/crafting-persuasive-story.md +0 -76
  246. package/payload/platform/plugins/writer-craft/skills/persuasive-storytelling/references/persuasion-case-studies.md +0 -67
  247. package/payload/platform/plugins/writer-craft/skills/persuasive-storytelling/references/transformation-framework.md +0 -86
  248. package/payload/platform/plugins/writer-craft/skills/point-of-view/SKILL.md +0 -97
  249. package/payload/platform/plugins/writer-craft/skills/point-of-view/references/indirect-narration.md +0 -72
  250. package/payload/platform/plugins/writer-craft/skills/point-of-view/references/pov-types-and-voice.md +0 -91
  251. package/payload/platform/plugins/writer-craft/skills/point-of-view/references/protagonist-filter.md +0 -71
  252. package/payload/platform/plugins/writer-craft/skills/point-of-view/references/tense-and-person.md +0 -85
  253. package/payload/platform/plugins/writer-craft/skills/prose-craft/SKILL.md +0 -100
  254. package/payload/platform/plugins/writer-craft/skills/prose-craft/references/punctuation-and-grammar.md +0 -72
  255. package/payload/platform/plugins/writer-craft/skills/prose-craft/references/repetition.md +0 -71
  256. package/payload/platform/plugins/writer-craft/skills/prose-craft/references/sound-and-rhythm.md +0 -64
  257. package/payload/platform/plugins/writer-craft/skills/prose-craft/references/word-economy.md +0 -93
  258. package/payload/platform/plugins/writer-craft/skills/reader-engagement/SKILL.md +0 -100
  259. package/payload/platform/plugins/writer-craft/skills/reader-engagement/references/cause-effect-setup-payoff.md +0 -79
  260. package/payload/platform/plugins/writer-craft/skills/reader-engagement/references/conflict-escalation.md +0 -81
  261. package/payload/platform/plugins/writer-craft/skills/reader-engagement/references/hooking-readers.md +0 -67
  262. package/payload/platform/plugins/writer-craft/skills/reader-engagement/references/neurochemistry-of-engagement.md +0 -94
  263. package/payload/platform/plugins/writer-craft/skills/review-manuscript/SKILL.md +0 -111
  264. package/payload/platform/plugins/writer-craft/skills/review-manuscript/references/review-manuscript-checklist.md +0 -119
  265. package/payload/platform/plugins/writer-craft/skills/review-prose/SKILL.md +0 -99
  266. package/payload/platform/plugins/writer-craft/skills/review-prose/references/prose-review-checklist.md +0 -112
  267. package/payload/platform/plugins/writer-craft/skills/review-scene/SKILL.md +0 -99
  268. package/payload/platform/plugins/writer-craft/skills/review-scene/references/scene-analysis-framework.md +0 -95
  269. package/payload/platform/plugins/writer-craft/skills/story-architecture/SKILL.md +0 -106
  270. package/payload/platform/plugins/writer-craft/skills/story-architecture/references/blueprinting-and-scene-cards.md +0 -118
  271. package/payload/platform/plugins/writer-craft/skills/story-architecture/references/inner-issue-and-protagonist-goal.md +0 -66
  272. package/payload/platform/plugins/writer-craft/skills/story-architecture/references/misbelief-desire-worldview.md +0 -87
  273. package/payload/platform/plugins/writer-craft/skills/story-architecture/references/origin-scenes-and-escalation.md +0 -82
  274. package/payload/platform/plugins/writer-craft/skills/story-blueprint/SKILL.md +0 -133
  275. package/payload/platform/plugins/writer-craft/skills/story-blueprint/references/blueprinting-exercises.md +0 -118
  276. package/payload/platform/plugins/writer-craft/skills/story-blueprint/references/blueprinting-process.md +0 -128
  277. package/payload/premium-plugins/.claude-plugin/marketplace.json +0 -23
  278. package/payload/premium-plugins/teaching/.claude-plugin/plugin.json +0 -8
  279. package/payload/premium-plugins/teaching/PLUGIN.md +0 -58
  280. package/payload/premium-plugins/teaching/skills/interactive-tutor/SKILL.md +0 -59
  281. package/payload/premium-plugins/teaching/skills/interactive-tutor/references/assessment.md +0 -70
  282. package/payload/premium-plugins/teaching/skills/interactive-tutor/references/classroom-conduct.md +0 -43
  283. package/payload/premium-plugins/teaching/skills/interactive-tutor/references/teaching-modes.md +0 -83
  284. package/payload/premium-plugins/teaching/skills/lesson-planner/SKILL.md +0 -48
  285. package/payload/premium-plugins/teaching/skills/lesson-planner/references/context-gathering.md +0 -41
  286. package/payload/premium-plugins/teaching/skills/lesson-planner/references/plan-structure.md +0 -94
  287. package/payload/premium-plugins/teaching/skills/study-pack-builder/SKILL.md +0 -52
  288. package/payload/premium-plugins/teaching/skills/study-pack-builder/references/disaggregation.md +0 -49
  289. package/payload/premium-plugins/teaching/skills/study-pack-builder/references/materials.md +0 -116
  290. package/payload/premium-plugins/venture-studio/.claude-plugin/plugin.json +0 -8
  291. package/payload/premium-plugins/venture-studio/PLUGIN.md +0 -119
  292. package/payload/premium-plugins/venture-studio/bin/scaffold.sh +0 -116
  293. package/payload/premium-plugins/venture-studio/skills/brand-pack/SKILL.md +0 -256
  294. package/payload/premium-plugins/venture-studio/skills/brand-pack/references/color-psychology.md +0 -118
  295. package/payload/premium-plugins/venture-studio/skills/investor-data-room/SKILL.md +0 -374
  296. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/business-plan-template.md +0 -64
  297. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/compliance-research-checklist.md +0 -53
  298. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/data-room-structure.md +0 -88
  299. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/deck-blueprint-template.md +0 -39
  300. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/design-tokens-application.md +0 -79
  301. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/html-pdf-pipeline.md +0 -236
  302. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/internal-workings-scrub.md +0 -33
  303. package/payload/premium-plugins/venture-studio/skills/investor-data-room/references/termsheet-template.md +0 -88
  304. package/payload/premium-plugins/venture-studio/skills/investor-data-room/templates/prospectus/index.html +0 -1565
  305. package/payload/premium-plugins/venture-studio/skills/investor-data-room/templates/prospectus/render-pdf.mjs +0 -91
  306. package/payload/premium-plugins/venture-studio/skills/investor-data-room/templates/prospectus/term_sheet.html +0 -715
  307. package/payload/premium-plugins/venture-studio/skills/office-hours/SKILL.md +0 -587
  308. package/payload/premium-plugins/venture-studio/skills/prototype-host/SKILL.md +0 -179
  309. package/payload/premium-plugins/venture-studio/skills/prototype-host/references/cloudflared-ingress-edit.md +0 -81
  310. package/payload/premium-plugins/venture-studio/skills/prototype-host/references/scaffold-frameworks.md +0 -60
  311. package/payload/premium-plugins/venture-studio/skills/prototype-host/references/systemd-user-service.md +0 -104
  312. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/SKILL.md +0 -336
  313. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/aarrr-metrics.md +0 -275
  314. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/assumption-testing.md +0 -93
  315. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/boolean-search.md +0 -308
  316. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/build-measure-learn.md +0 -262
  317. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/business-model-canvas.md +0 -171
  318. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/commitment-signals.md +0 -246
  319. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/design-thinking.md +0 -183
  320. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/earlyvangelist.md +0 -190
  321. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/first-principles.md +0 -58
  322. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/fishbone.md +0 -114
  323. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/five-whys.md +0 -43
  324. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/ice-scoring.md +0 -237
  325. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/innovation-accounting.md +0 -290
  326. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/jtbd.md +0 -105
  327. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/landing-page.md +0 -361
  328. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/market-type.md +0 -167
  329. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/mom-test.md +0 -193
  330. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/mvp-types.md +0 -200
  331. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/og-images.md +0 -239
  332. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/pareto.md +0 -103
  333. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/persona-development.md +0 -291
  334. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/pivot-types.md +0 -225
  335. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/positioning-statement.md +0 -179
  336. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/prd.md +0 -363
  337. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/pre-mortem.md +0 -74
  338. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/problem-validation.md +0 -253
  339. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/product-market-fit.md +0 -256
  340. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/research-synthesis.md +0 -276
  341. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/three-engines-of-growth.md +0 -248
  342. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/validation-tests.md +0 -89
  343. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/value-proposition-canvas.md +0 -121
  344. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/win-loss-analysis.md +0 -242
  345. package/payload/premium-plugins/venture-studio/skills/zero-to-prototype/references/workflow-mapping.md +0 -271
  346. package/payload/premium-plugins/writer-craft/.claude-plugin/plugin.json +0 -8
  347. package/payload/premium-plugins/writer-craft/PLUGIN.md +0 -88
  348. package/payload/premium-plugins/writer-craft/agents/writer-craft--manuscript-reviewer.md +0 -92
  349. package/payload/premium-plugins/writer-craft/skills/citation-style/SKILL.md +0 -94
  350. package/payload/premium-plugins/writer-craft/skills/citation-style/references/book-and-chapter-models.md +0 -77
  351. package/payload/premium-plugins/writer-craft/skills/citation-style/references/citation-rules.md +0 -103
  352. package/payload/premium-plugins/writer-craft/skills/citation-style/references/journal-article-models.md +0 -74
  353. package/payload/premium-plugins/writer-craft/skills/citation-style/references/other-source-models.md +0 -146
  354. package/payload/premium-plugins/writer-craft/skills/citation-style/references/reference-list-rules.md +0 -70
  355. package/payload/premium-plugins/writer-craft/skills/editorial-practice/SKILL.md +0 -108
  356. package/payload/premium-plugins/writer-craft/skills/editorial-practice/references/copyediting.md +0 -73
  357. package/payload/premium-plugins/writer-craft/skills/editorial-practice/references/developmental-editing.md +0 -85
  358. package/payload/premium-plugins/writer-craft/skills/editorial-practice/references/genre-specific-editing.md +0 -78
  359. package/payload/premium-plugins/writer-craft/skills/editorial-practice/references/line-editing.md +0 -55
  360. package/payload/premium-plugins/writer-craft/skills/editorial-practice/references/self-editing.md +0 -89
  361. package/payload/premium-plugins/writer-craft/skills/persuasive-storytelling/SKILL.md +0 -114
  362. package/payload/premium-plugins/writer-craft/skills/persuasive-storytelling/references/audience-analysis.md +0 -73
  363. package/payload/premium-plugins/writer-craft/skills/persuasive-storytelling/references/crafting-persuasive-story.md +0 -76
  364. package/payload/premium-plugins/writer-craft/skills/persuasive-storytelling/references/persuasion-case-studies.md +0 -67
  365. package/payload/premium-plugins/writer-craft/skills/persuasive-storytelling/references/transformation-framework.md +0 -86
  366. package/payload/premium-plugins/writer-craft/skills/point-of-view/SKILL.md +0 -97
  367. package/payload/premium-plugins/writer-craft/skills/point-of-view/references/indirect-narration.md +0 -72
  368. package/payload/premium-plugins/writer-craft/skills/point-of-view/references/pov-types-and-voice.md +0 -91
  369. package/payload/premium-plugins/writer-craft/skills/point-of-view/references/protagonist-filter.md +0 -71
  370. package/payload/premium-plugins/writer-craft/skills/point-of-view/references/tense-and-person.md +0 -85
  371. package/payload/premium-plugins/writer-craft/skills/prose-craft/SKILL.md +0 -100
  372. package/payload/premium-plugins/writer-craft/skills/prose-craft/references/punctuation-and-grammar.md +0 -72
  373. package/payload/premium-plugins/writer-craft/skills/prose-craft/references/repetition.md +0 -71
  374. package/payload/premium-plugins/writer-craft/skills/prose-craft/references/sound-and-rhythm.md +0 -64
  375. package/payload/premium-plugins/writer-craft/skills/prose-craft/references/word-economy.md +0 -93
  376. package/payload/premium-plugins/writer-craft/skills/reader-engagement/SKILL.md +0 -100
  377. package/payload/premium-plugins/writer-craft/skills/reader-engagement/references/cause-effect-setup-payoff.md +0 -79
  378. package/payload/premium-plugins/writer-craft/skills/reader-engagement/references/conflict-escalation.md +0 -81
  379. package/payload/premium-plugins/writer-craft/skills/reader-engagement/references/hooking-readers.md +0 -67
  380. package/payload/premium-plugins/writer-craft/skills/reader-engagement/references/neurochemistry-of-engagement.md +0 -94
  381. package/payload/premium-plugins/writer-craft/skills/review-manuscript/SKILL.md +0 -111
  382. package/payload/premium-plugins/writer-craft/skills/review-manuscript/references/review-manuscript-checklist.md +0 -119
  383. package/payload/premium-plugins/writer-craft/skills/review-prose/SKILL.md +0 -99
  384. package/payload/premium-plugins/writer-craft/skills/review-prose/references/prose-review-checklist.md +0 -112
  385. package/payload/premium-plugins/writer-craft/skills/review-scene/SKILL.md +0 -99
  386. package/payload/premium-plugins/writer-craft/skills/review-scene/references/scene-analysis-framework.md +0 -95
  387. package/payload/premium-plugins/writer-craft/skills/story-architecture/SKILL.md +0 -106
  388. package/payload/premium-plugins/writer-craft/skills/story-architecture/references/blueprinting-and-scene-cards.md +0 -118
  389. package/payload/premium-plugins/writer-craft/skills/story-architecture/references/inner-issue-and-protagonist-goal.md +0 -66
  390. package/payload/premium-plugins/writer-craft/skills/story-architecture/references/misbelief-desire-worldview.md +0 -87
  391. package/payload/premium-plugins/writer-craft/skills/story-architecture/references/origin-scenes-and-escalation.md +0 -82
  392. package/payload/premium-plugins/writer-craft/skills/story-blueprint/SKILL.md +0 -133
  393. package/payload/premium-plugins/writer-craft/skills/story-blueprint/references/blueprinting-exercises.md +0 -118
  394. package/payload/premium-plugins/writer-craft/skills/story-blueprint/references/blueprinting-process.md +0 -128
  395. package/payload/server/public/assets/channel-CrSx5mnG.js +0 -1
  396. package/payload/server/public/assets/classDiagram-6PBFFD2Q-C3IDJsqN.js +0 -1
  397. package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-BOIrJ5Zb.js +0 -1
  398. package/payload/server/public/assets/clone-P8Fkz7JD.js +0 -1
  399. package/payload/server/public/assets/data-DRfwJPja.js +0 -1
  400. package/payload/server/public/assets/graph-B4FFYwus.js +0 -1
  401. package/payload/server/public/assets/graph-labels-Cpk9Ktt0.js +0 -1
  402. package/payload/server/public/assets/lib--yuBd0Xi.js +0 -33
  403. package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-C5JejhQU.js +0 -1
@@ -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 +0,0 @@
1
- import{it as e,rt as t}from"./chunk-ICPOFSXX-wy-eNjwW.js";var n=(n,r)=>e.lang.round(t.parse(n)[r]);export{n as t};
@@ -1 +0,0 @@
1
- import{h as e}from"./src-B6XdH6xq.js";import"./chunk-ICPOFSXX-wy-eNjwW.js";import"./dist-Bd4S37oi.js";import"./chunk-5PVQY5BW-Bn2nQwdj.js";import"./chunk-U2HBQHQK-CFCW7OaT.js";import"./chunk-FMBD7UC4-w-yBZsN2.js";import"./chunk-BSJP7CBP-DP7LTBll.js";import"./chunk-ZZ45TVLE-BiOuK5NP.js";import"./chunk-YZCP3GAM-BXKwZ4vN.js";import"./chunk-55IACEB6-BRJOZLpU.js";import"./chunk-EDXVE4YY-CzCPnR0P.js";import"./chunk-X2U36JSP-Bgh-CJSN.js";import"./chunk-5FUZZQ4R-CrSQ4ySU.js";import"./chunk-ENJZ2VHE-CgZj9RoG.js";import"./chunk-336JU56O-DpIXuFM0.js";import{i as t,n,r,t as i}from"./chunk-4TB4RGXK-DtM8-CUn.js";var a={parser:n,get db(){return new i},renderer:r,styles:t,init:e(e=>{e.class||={},e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{a as diagram};
@@ -1 +0,0 @@
1
- import{h as e}from"./src-B6XdH6xq.js";import"./chunk-ICPOFSXX-wy-eNjwW.js";import"./dist-Bd4S37oi.js";import"./chunk-5PVQY5BW-Bn2nQwdj.js";import"./chunk-U2HBQHQK-CFCW7OaT.js";import"./chunk-FMBD7UC4-w-yBZsN2.js";import"./chunk-BSJP7CBP-DP7LTBll.js";import"./chunk-ZZ45TVLE-BiOuK5NP.js";import"./chunk-YZCP3GAM-BXKwZ4vN.js";import"./chunk-55IACEB6-BRJOZLpU.js";import"./chunk-EDXVE4YY-CzCPnR0P.js";import"./chunk-X2U36JSP-Bgh-CJSN.js";import"./chunk-5FUZZQ4R-CrSQ4ySU.js";import"./chunk-ENJZ2VHE-CgZj9RoG.js";import"./chunk-336JU56O-DpIXuFM0.js";import{i as t,n,r,t as i}from"./chunk-4TB4RGXK-DtM8-CUn.js";var a={parser:n,get db(){return new i},renderer:r,styles:t,init:e(e=>{e.class||={},e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{a as diagram};
@@ -1 +0,0 @@
1
- import{i as e}from"./graphlib-CwimOv_M.js";var t=4;function n(n){return e(n,t)}export{n as t};
@@ -1 +0,0 @@
1
- import{c as e,m as t}from"./ChatInput-CsnIedhS.js";import"./graph-labels-Cpk9Ktt0.js";import{t as n}from"./page-CgDmg_fX.js";var r=t(),i=e();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
@@ -1 +0,0 @@
1
- import{c as e,m as t}from"./ChatInput-CsnIedhS.js";import"./graph-labels-Cpk9Ktt0.js";import{n}from"./page-D9lluVl7.js";import"./Checkbox-CWugFyFT.js";var r=t(),i=e();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
@@ -1 +0,0 @@
1
- import{o as e}from"./chunk-DD-I1_y5.js";import{c as t,d as n,f as r,g as i,l as a,o,p as s,r as c,t as l,u}from"./ChatInput-CsnIedhS.js";var d=s(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),f=s(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),p=s(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),m=s(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),h=s(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),g=s(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),_=s(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),v=s(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),y=s(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),b=s(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),x=s(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),S=s(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),C=s(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),w=s(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),T=s(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),E=s(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),D=s(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),O=s(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),k=s(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ee=s(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),A=s(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),te=s(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),ne=s(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),re=s(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),j=e(i(),1),M=t(),N=`maxy-shell-side-px`;function P(){if(typeof window>`u`)return 0;let e=document.querySelector(`.platform > .artefact`)?.getBoundingClientRect();return e&&e.width>0?Math.round(e.width):0}function F(e){if(typeof window>`u`)return e;let t=window.innerWidth,n=Math.max(248,t-480-P());return Math.min(Math.max(e,248),n)}function ie(){if(typeof window>`u`)return 264;try{let e=window.localStorage.getItem(N);if(!e)return 264;let t=parseInt(e,10);if(Number.isFinite(t)&&t>=248)return F(t)}catch{}return 264}function ae({targetSelector:e=`.platform`}){let t=(0,j.useRef)(null),[n,r]=(0,j.useState)(()=>ie()),i=(0,j.useRef)(n);(0,j.useEffect)(()=>{let t=document.querySelector(e);!t||!(t instanceof HTMLElement)||(t.style.setProperty(`--side-px`,`${n}px`),i.current=n)},[n,e]);let a=(0,j.useCallback)(()=>{r(e=>{let t=F(e);return t===e?e:t})},[]);(0,j.useEffect)(()=>{a(),window.addEventListener(`resize`,a);let t=document.querySelector(e),n=null;return t instanceof HTMLElement&&(n=new MutationObserver(a),n.observe(t,{attributes:!0,attributeFilter:[`data-artefact`,`class`]})),()=>{window.removeEventListener(`resize`,a),n?.disconnect()}},[a,e]);let o=e=>{e.preventDefault();let n=t.current;if(!n)return;n.setPointerCapture(e.pointerId),n.classList.add(`dragging`);let a=!1,o=e=>{a=!0,r(F(Math.round(e.clientX)))},s=()=>{if(n.releasePointerCapture(e.pointerId),n.classList.remove(`dragging`),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),!a)return;let t=i.current;try{window.localStorage.setItem(N,String(t))}catch{}console.info(`[admin-ui] sidebar-resize px=${t}`)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s)},s=()=>{let e=F(264);r(e);try{window.localStorage.removeItem(N)}catch{}console.info(`[admin-ui] sidebar-resize px=${e}`)};return(0,M.jsx)(`div`,{ref:t,className:`side-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,onPointerDown:o,onDoubleClick:s})}var oe=!1;function se(){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function ce(){let e=typeof crypto<`u`&&typeof crypto.randomUUID==`function`;if(!oe){oe=!0;let t=typeof window<`u`&&`isSecureContext`in window?window.isSecureContext:!1;console.info(`[idempotency] uuid-source=${e?`native`:`getRandomValues`} secureContext=${t}`)}return e?crypto.randomUUID():se()}function le(e){let t=e.trim();return t.length>=1&&t.length<=200}function I(e,t,n,r){let i=e===`pane`?`pane-action`:`sidebar-${t}`;console.info(`[admin-ui] ${i} sessionId=${n.slice(0,8)} action=${t} outcome=${r}`)}var ue=/session_([A-Za-z0-9_-]+)/;function de(e){if(!e)return null;let t=e.match(ue);return t?t[1]:null}async function fe(e,t,n,r,i){let a=de(r)??`unknown`,o=e=>e.slice(0,8),s=t===`pane`?`pane-action action=resume-archive`:`sidebar-resume-archive`,c;try{let t=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(n)}/archive?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({mode:`archive`})});c=t.ok?`ok`:t.status===409?`409`:`error`;let r=`[admin-ui] ${s} sourceSessionId=${o(n)} newSessionId=${o(a)} result=${c}`;c===`error`?console.error(r):console.info(r)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[admin-ui] ${s} sourceSessionId=${o(n)} newSessionId=${o(a)} result=error detail=${t}`)}finally{i.refetch()}}function pe(e,t,n=`pane`){let[r,i]=(0,j.useState)(null),a=(0,j.useRef)(!1),o=(0,j.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};if(a.current)return I(n,`resume`,r,`skipped-in-flight`),{ok:!1,error:`in-flight`};a.current=!0,i(`resume`);let o=ce();try{let i=await fetch(`/api/admin/claude-sessions/resume?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({sessionId:r,channel:`browser`,idempotencyKey:o})}),a=await i.json();if(!i.ok||!(`sessionId`in a)){let e=a.error??`POST returned ${i.status}`;return I(n,`resume`,r,String(i.status)),{ok:!1,error:e}}return t.setSessions(e=>[a,...e.filter(e=>e.sessionId!==r)]),I(n,`resume`,r,`200`),fe(e,n,r,a.url,t),{ok:!0}}catch(e){let i=e instanceof Error?e.message:String(e);return I(n,`resume`,r,`threw`),t.refetch(),{ok:!1,error:i}}finally{a.current=!1,i(null)}},[e,t,n]),s=(0,j.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`end`);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(r)}/stop?session_key=${encodeURIComponent(e)}`,{method:`POST`});if(!i.ok){let e=await i.text().catch(()=>``);return I(n,`end`,r,String(i.status)),t.refetch(),{ok:!1,error:`POST /stop ${i.status} ${e.slice(0,200)}`}}return I(n,`end`,r,`204`),t.refetch(),{ok:!0}}catch(e){let i=e instanceof Error?e.message:String(e);return I(n,`end`,r,`threw`),t.refetch(),{ok:!1,error:i}}finally{i(null)}},[e,t,n]),c=(0,j.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`purge`);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(r)}?purge=1&session_key=${encodeURIComponent(e)}`,{method:`DELETE`});if(!i.ok){let e=await i.json().catch(()=>({})),t=e.detail||e.error||`DELETE ?purge=1 ${i.status}`;return I(n,`purge`,r,String(i.status)),{ok:!1,error:t}}return t.setSessions(e=>e.filter(e=>e.sessionId!==r)),I(n,`purge`,r,`200`),t.refetch(),{ok:!0}}catch(e){let t=e instanceof Error?e.message:String(e);return I(n,`purge`,r,`threw`),{ok:!1,error:t}}finally{i(null)}},[e,t,n]),l=(0,j.useCallback)(async(r,a)=>{if(!e)return{ok:!1,error:`no-cache-key`};i(a);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(r)}/archive?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({mode:a})});if(!i.ok){let e=await i.json().catch(()=>({})),t=e.detail||e.error||`POST /archive ${i.status}`;return I(n,a,r,String(i.status)),{ok:!1,error:t}}return a===`archive`&&t.setSessions(e=>e.filter(e=>e.sessionId!==r)),t.refetch(),I(n,a,r,`200`),{ok:!0}}catch(e){let t=e instanceof Error?e.message:String(e);return I(n,a,r,`threw`),{ok:!1,error:t}}finally{i(null)}},[e,t,n]);return{inFlight:r,resume:o,end:s,purge:c,archive:(0,j.useCallback)(e=>l(e,`archive`),[l]),unarchive:(0,j.useCallback)(e=>l(e,`unarchive`),[l]),rename:(0,j.useCallback)(async(t,r)=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`rename`);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(t)}/rename?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({title:r})});if(!i.ok){let e=await i.json().catch(()=>({})),r=e.detail||e.error||`POST /rename ${i.status}`;return I(n,`rename`,t,String(i.status)),{ok:!1,error:r,reason:e.reason}}return I(n,`rename`,t,`200`),{ok:!0}}catch(e){let r=e instanceof Error?e.message:String(e);return I(n,`rename`,t,`threw`),{ok:!1,error:r}}finally{i(null)}},[e,n])}}function me(e){return`code.session.pinned.${e}`}function he(e){if(typeof window>`u`)return new Set;try{let t=window.localStorage.getItem(me(e));if(!t)return new Set;let n=JSON.parse(t);return Array.isArray(n)?new Set(n.filter(e=>typeof e==`string`)):new Set}catch{return new Set}}function L(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(me(e),JSON.stringify([...t]))}catch{}}function ge(e){let[t,n]=(0,j.useState)(()=>he(e));(0,j.useEffect)(()=>{n(he(e))},[e]);let r=(0,j.useCallback)(t=>{n(n=>{let r=new Set(n);return r.has(t)?r.delete(t):r.add(t),L(e,r),r})},[e]);return{pinned:t,isPinned:(0,j.useCallback)(e=>t.has(e),[t]),togglePin:r}}function _e(e){let{businessName:t,onNavigate:n,onToggleSidebar:r,sidebarOpen:i,onLogout:s}=e,[l,u]=(0,j.useState)(!1),d=(0,j.useRef)(null),f=(0,j.useRef)(null),[p,m]=(0,j.useState)(null),[g,b]=(0,j.useState)(!1),[E,D]=(0,j.useState)(null),[O,k]=(0,j.useState)(null),[A,te]=(0,j.useState)(null),[ne,N]=(0,j.useState)(``);(0,j.useEffect)(()=>{N(window.location.hostname.startsWith(`admin.`)?window.location.origin.replace(`admin.`,`public.`):window.location.origin)},[]),(0,j.useEffect)(()=>{if(!l)return;let e=e=>{d.current&&!d.current.contains(e.target)&&u(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[l]),(0,j.useEffect)(()=>{if(!l)return;let e=e=>{e.key===`Escape`&&u(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[l]),(0,j.useEffect)(()=>{l&&f.current?.focus()},[l]),(0,j.useEffect)(()=>{if(!l)return;let e=!1;return fetch(`/api/admin/version`).then(e=>e.json()).then(t=>{e||te(t)}).catch(e=>{console.error(`[admin/version] menu-open client fetch failed:`,e)}),()=>{e=!0}},[l]);let P=(0,j.useCallback)(()=>{u(e=>{let t=!e;return t&&console.info(`[admin-ui] header-menu-open`),t})},[]),F=(0,j.useCallback)(e=>{u(!1),n(e)},[n]),ie=(0,j.useCallback)(async()=>{if(p!==null){m(null),k(null);return}b(!0),D(null);try{let e=await fetch(`/api/admin/agents`);if(!e.ok)throw Error(`Failed to load agents`);m((await e.json()).agents??[])}catch(e){console.error(`[admin/agents] list failed:`,e),D(e instanceof Error?e.message:String(e)),m([])}finally{b(!1)}},[p]),ae=(0,j.useCallback)(e=>{k(null),m(t=>t?.filter(t=>t.slug!==e)??null),fetch(`/api/admin/agents/${encodeURIComponent(e)}`,{method:`DELETE`}).catch(e=>console.error(`[admin/agents] delete failed:`,e))},[]),oe=(0,j.useCallback)(()=>{u(!1),s()},[s]),se=t||c.productName;return(0,M.jsxs)(`header`,{className:`admin-header`,children:[(0,M.jsx)(`button`,{type:`button`,className:`admin-sidebar-toggle`,"aria-label":i?`Hide sidebar`:`Show sidebar`,title:i?`Hide sidebar`:`Show sidebar`,"aria-expanded":i,onClick:r,children:i?(0,M.jsx)(w,{size:20,strokeWidth:1.5}):(0,M.jsx)(T,{size:20,strokeWidth:1.5})}),(0,M.jsxs)(`div`,{className:`chat-header-label`,children:[(0,M.jsx)(`span`,{className:`chat-logo-btn`,"aria-hidden":`true`,children:(0,M.jsx)(`img`,{src:o,alt:``,className:`chat-logo`})}),(0,M.jsx)(`h1`,{className:`chat-tagline`,children:se})]}),(0,M.jsxs)(`div`,{className:`chat-burger-wrap`,ref:d,children:[(0,M.jsx)(`button`,{type:`button`,className:`admin-burger`,onClick:P,"aria-label":`Menu`,"aria-haspopup":`true`,"aria-expanded":l,children:(0,M.jsx)(C,{size:20})}),l&&(0,M.jsxs)(`div`,{className:`admin-menu`,role:`menu`,children:[(0,M.jsxs)(`button`,{ref:f,type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>F(`data`),children:[(0,M.jsx)(_,{size:14}),` Data`]}),(0,M.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>F(`graph`),children:[(0,M.jsx)(ee,{size:14}),` Graph`]}),(0,M.jsx)(`div`,{className:`chat-menu-divider`}),(0,M.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:ie,children:[(0,M.jsx)(v,{size:14}),` Public`,g&&(0,M.jsx)(x,{size:12,className:`spin`})]}),p!==null&&(0,M.jsxs)(`div`,{className:`chat-menu-agents`,children:[E&&(0,M.jsx)(`span`,{className:`chat-menu-agent-error`,children:E}),p.length===0&&!E&&(0,M.jsx)(`span`,{className:`chat-menu-agent-empty`,children:`No public agents configured`}),p.map(e=>(0,M.jsxs)(`div`,{className:`chat-menu-item chat-menu-agent-item`,children:[(0,M.jsx)(`span`,{className:`agent-status-dot ${e.status}`}),(0,M.jsxs)(`span`,{className:`agent-text`,children:[(0,M.jsx)(`span`,{className:`agent-display-name`,children:e.displayName}),(0,M.jsxs)(`span`,{className:`agent-slug`,children:[`/`,e.slug]})]}),O===e.slug?(0,M.jsxs)(`span`,{className:`agent-actions agent-confirm`,children:[(0,M.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-yes`,title:`Confirm delete`,onClick:()=>ae(e.slug),children:(0,M.jsx)(h,{size:12})}),(0,M.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-no`,title:`Cancel`,onClick:()=>k(null),children:(0,M.jsx)(re,{size:12})})]}):(0,M.jsxs)(`span`,{className:`agent-actions`,children:[(0,M.jsx)(`a`,{href:`${ne}/${e.slug}`,target:`_blank`,rel:`noopener noreferrer`,className:`agent-action-btn`,title:`Open agent`,onClick:()=>u(!1),children:(0,M.jsx)(v,{size:12})}),(0,M.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-delete-btn`,title:`Delete agent`,onClick:()=>k(e.slug),children:(0,M.jsx)(a,{size:12})})]})]},e.slug))]}),(0,M.jsx)(`div`,{className:`chat-menu-divider`}),(0,M.jsxs)(`div`,{className:`chat-menu-version chat-menu-version-passive`,children:[(0,M.jsx)(y,{size:14}),(0,M.jsxs)(`span`,{className:`version-installed`,children:[A?`v${A.installed}`:`…`,A&&!A.updateAvailable&&(0,M.jsx)(`span`,{className:`version-uptodate-dot`}),A?.updateAvailable&&(0,M.jsx)(`span`,{className:`version-update-dot`})]})]}),(0,M.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:oe,children:[(0,M.jsx)(S,{size:14}),` Log out`]})]})]})]})}var R=`maxy-admin-session`,ve=typeof BroadcastChannel<`u`;function ye(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.type===`rotation`&&typeof t.newKey==`string`&&t.newKey.length>0&&(t.surface===`chat`||t.surface===`graph`||t.surface===`data`||t.surface===`sessions`)&&typeof t.ts==`number`}function be(e){if(!ve)return()=>{};let t=new BroadcastChannel(R),n=t=>{if(!ye(t.data)){console.warn(`[admin-session-broadcast] outcome=received-malformed payload=${JSON.stringify(t.data)}`);return}e(t.data)};return t.addEventListener(`message`,n),()=>{t.removeEventListener(`message`,n),t.close()}}var z=`maxy-admin-session-key`;function xe(e,t){return`${e}${e.includes(`?`)?`&`:`?`}session_key=${encodeURIComponent(t)}`}async function B(e){let t;try{t=await e.clone().json()}catch{return`parse-failed`}if(typeof t!=`object`||!t)return`unknown-401`;let n=t.code;return n===`session-missing`||n===`session-not-registered`||n===`session-expired-age`||n===`grant-expired`?n:`unknown-401`}function Se(){try{return sessionStorage.getItem(z)}catch{return null}}function Ce(e){let{initialCacheKey:t,surface:n}=e,[r,i]=(0,j.useState)(t),a=(0,j.useRef)(t);(0,j.useEffect)(()=>{a.current=r},[r]),(0,j.useEffect)(()=>{t!==a.current&&(i(t),a.current=t,s(e=>e+1))},[t]);let[o,s]=(0,j.useState)(0),[c,l]=(0,j.useState)(null);(0,j.useEffect)(()=>be(e=>{let t=a.current.slice(0,8),r=e.newKey.slice(0,8);e.newKey!==a.current&&(console.log(`[admin-session-broadcast] outcome=received oldKey=${t} newKey=${r} surface=${n} senderSurface=${e.surface}`),i(e.newKey),s(e=>e+1),l(null))}),[n]);let u=(0,j.useCallback)(()=>{try{sessionStorage.removeItem(z)}catch{}window.location.href=`/`},[]);return{adminFetch:(0,j.useCallback)(async(e,t)=>{let r=a.current,o=xe(e,r),c=await fetch(o,t);if(c.status!==401)return c;let d=await B(c);if(d===`session-missing`)return console.warn(`[useAdminFetch] outcome=redirect-to-login reason=${d} surface=${n} path=${e}`),u(),c;if(d!==`session-not-registered`)return console.warn(`[useAdminFetch] outcome=redirect-to-login reason=${d} surface=${n} path=${e}`),l({message:`Your admin session has expired. Click to reload and sign in.`,reason:d}),c;let f=Se();if(!f||f===r)return console.warn(`[useAdminFetch] outcome=redirect-to-login reason=session-not-registered-no-fresh-key surface=${n} path=${e}`),l({message:`Your admin session was renewed in another tab. Click to reload.`,reason:`session-not-registered`}),c;i(f),a.current=f,s(e=>e+1),console.log(`[useAdminFetch] outcome=retry-after-rotation oldKey=${r.slice(0,8)} newKey=${f.slice(0,8)} surface=${n} path=${e}`);let p=xe(e,f),m=await fetch(p,t);return m.status===401&&(console.warn(`[useAdminFetch] outcome=redirect-to-login reason=second-401-after-retry surface=${n} path=${e}`),l({message:`Your admin session has expired. Click to reload and sign in.`,reason:`session-not-registered`})),m},[u,n]),cacheKey:r,sessionRefetchNonce:o,banner:c,reloadToLogin:u}}var V=`/api/admin/claude-sessions/events`,H=`admin-session-list-view`,U=`admin-session-list-include-subagents`,W=`admin-session-list-include-background`;function we(e){return e===`active`||e===`archived`||e===`all`}function Te(){let e={rows:[],view:`active`,includeBackground:!1,connected:!1},t=new Map,n=new Set,r=null,i=null,a=0,o=0,s=null,c=!1,l=!1;function u(){let n=[...t.values()].sort((e,t)=>t.updatedAt===e.updatedAt?e.sessionId<t.sessionId?-1:1:t.updatedAt-e.updatedAt);e={...e,rows:n}}function d(){for(let e of n)e()}function f(e,n){if(e===`row-removed`){let e=n?.sessionId;if(typeof e!=`string`||!t.delete(e))return;u(),d();return}let r=n;if(typeof r.sessionId!=`string`)return;let i={sessionId:r.sessionId,live:r.live===!0,status:r.status===`busy`?`busy`:r.status===`idle`?`idle`:r.status===`detached`?`detached`:`gone`,agentLabel:typeof r.agentLabel==`string`&&r.agentLabel.length>0?r.agentLabel:null,cwd:typeof r.cwd==`string`?r.cwd:null,firstPrompt:typeof r.firstPrompt==`string`&&r.firstPrompt.length>0?r.firstPrompt:null,titleSource:r.titleSource===`user`||r.titleSource===`ai`?r.titleSource:null,updatedAt:typeof r.updatedAt==`number`?r.updatedAt:0,url:typeof r.url==`string`&&r.url.length>0?r.url:null,archived:r.archived===!0};t.set(i.sessionId,i),u(),d()}function p(t){if(r&&s===t||(r&&=(r.close(),null),!t))return;s=t,c=!1,l=!1;let n=xe(V,t);try{r=new EventSource(n)}catch(e){console.error(`[admin-ui] session-row-store EventSource construct failed:`,e),h(`auto`);return}r.addEventListener(`open`,()=>{c=!0,a=0,e={...e,connected:!0},d(),console.info(`[admin-ui] session-row-store connected events-received=${o}`)});for(let e of[`row-created`,`row-updated`,`row-archived`,`row-removed`])r.addEventListener(e,t=>{o+=1;try{f(e,JSON.parse(t.data))}catch(t){console.error(`[admin-ui] session-row-store parse failed kind=${e}:`,t)}});r.addEventListener(`error`,()=>{r&&=(r.close(),null),e={...e,connected:!1},d(),!c&&!l&&(l=!0,m(n)),h(`auto`)})}async function m(e){let t=a+1,n=0,r=`unknown`;try{let t=await fetch(e,{method:`GET`});n=t.status,r=t.status>=400&&t.status<500?await B(t):`unknown`}catch(e){console.error(`[admin-ui] session-row-store sse-error-probe-failed:`,e);return}console.error(`[admin-ui] session-row-store sse-error status=${n} code=${r} attempt=${t}`)}function h(e){if(i)return;a+=1;let t=Math.min(1e3*2**Math.min(a,5),3e4);console.info(`[admin-ui] session-row-store reconnect trigger=${e} attempt=${a} delay-ms=${t}`),i=setTimeout(()=>{i=null,s&&p(s)},t)}function g(){i&&=(clearTimeout(i),null),a=0,r&&=(r.close(),null),console.info(`[admin-ui] session-row-store reconnect trigger=manual attempt=0 delay-ms=0`),s&&p(s)}function _(){if(!(typeof window>`u`))try{let t=window.localStorage.getItem(H);we(t)&&(e={...e,view:t});let n=window.localStorage.getItem(U);if(n===null){let e=window.localStorage.getItem(W);e!==null&&(window.localStorage.setItem(U,e),window.localStorage.removeItem(W),n=e,console.info(`[admin-ui] session-list-storage-migrated from=${W} to=${U} value=${e}`))}n===`1`&&(e={...e,includeBackground:!0})}catch{}}function v(t){e={...e,view:t};try{window.localStorage.setItem(H,t)}catch{}d()}function y(t){e={...e,includeBackground:t};try{window.localStorage.setItem(U,t?`1`:`0`)}catch{}d()}function b(e){return n.add(e),()=>{n.delete(e)}}function x(){return e}function S(){r&&=(r.close(),null),i&&=(clearTimeout(i),null),s=null,e={...e,connected:!1}}function C(e,t){f(e,t)}function w(t){e={...e,connected:t},d()}function T(){t.clear(),u(),d()}function E(e){let n=new Set(e),r=0;for(let e of[...t.keys()])n.has(e)||(t.delete(e),r+=1);r!==0&&(console.info(`[admin-ui] session-row-store reconcile evicted=${r} kept=${t.size}`),u(),d())}return _(),{subscribe:b,getSnapshot:x,connect:p,disconnect:S,setView:v,setIncludeBackground:y,reconnectNow:g,reconcileFromList:E,_injectEventForTesting:C,_setConnectedForTesting:w,_clearRowsForTesting:T}}var G=Te();G._injectEventForTesting,G.connect,G._setConnectedForTesting,G.getSnapshot,G.reconcileFromList;function Ee(e){let t=(0,j.useSyncExternalStore)(G.subscribe,G.getSnapshot,G.getSnapshot);(0,j.useEffect)(()=>{e&&G.connect(e)},[e]);let n=(0,j.useCallback)(e=>G.setView(e),[]),r=(0,j.useCallback)(e=>G.setIncludeBackground(e),[]),i=(0,j.useCallback)(()=>G.reconnectNow(),[]),a=(0,j.useCallback)(e=>G.reconcileFromList(e),[]);return{rows:t.rows,view:t.view,includeBackground:t.includeBackground,connected:t.connected,setView:n,setIncludeBackground:r,reconnectNow:i,reconcileFromList:a}}function De(e,t,n){return e.filter(e=>!(t===`active`&&e.archived||t===`archived`&&!e.archived||!n&&e.agentLabel!==null&&e.agentLabel!==`admin`))}var K=6e4,Oe=60*K,ke=24*Oe,q=K,Ae=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],je=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function Me(e){return e<10?`0${e}`:String(e)}function Ne(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function Pe(e,t){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t))return`—`;let n=t-e;if(n<-q)return`—`;let r=n<0?0:n;if(r<K)return`just now`;if(r<Oe)return`${Math.floor(r/K)}m`;if(r<ke)return`${Math.floor(r/Oe)}h`;let i=new Date(t),a=new Date(e),o=Math.round((Ne(i)-Ne(a))/ke);if(o===1)return`yesterday`;if(o>=2&&o<=6)return je[a.getDay()];let s=Me(a.getDate()),c=Ae[a.getMonth()];return a.getFullYear()===i.getFullYear()?`${s} ${c}`:`${s} ${c} ${a.getFullYear()}`}function Fe(e=3e4){let[t,n]=(0,j.useState)(()=>Date.now());return(0,j.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var Ie={default:`Ask`,acceptEdits:`Accept edits`,plan:`Plan`,auto:`Auto`,bypassPermissions:`Bypass permissions`},Le=[`default`,`acceptEdits`,`plan`,`auto`,`bypassPermissions`],Re=`Plan does not include auto mode`,ze=[{value:void 0,label:`Default`},{value:`claude-opus-4-7`,label:`Opus 4.7`},{value:`claude-sonnet-4-6`,label:`Sonnet 4.6`},{value:`claude-haiku-4-5`,label:`Haiku 4.5`}];function Be({seedMode:e,seedModel:t,submitting:n,error:i,onSubmit:a,onCancel:o,onErrorClear:s}){let[c,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(e),[p,m]=(0,j.useState)(t),[_,v]=(0,j.useState)(!1),[y,b]=(0,j.useState)(!1),[S,C]=(0,j.useState)(null),w=(0,j.useRef)(null),T=(0,j.useRef)(null),E=(0,j.useRef)(null);(0,j.useEffect)(()=>{w.current?.focus()},[]),(0,j.useEffect)(()=>{let e=!1,t=Date.now();return(async()=>{try{let n=await fetch(`/api/admin/claude-capabilities`);if(!n.ok)throw Error(`status ${n.status}`);let r=await n.json();if(e)return;C(r.autoModeAvailable),console.info(`[admin-ui] capability-fetch ok=true autoModeAvailable=${r.autoModeAvailable} seatTier=${r.seatTier??`null`} ms=${Date.now()-t}`)}catch(n){if(e)return;let r=n instanceof Error?n.message:String(n);console.error(`[admin-ui] capability-fetch ok=false reason="${r}" ms=${Date.now()-t}`)}})(),()=>{e=!0}},[]);let D=(0,j.useMemo)(()=>e=>e===`auto`&&S===!1,[S]);(0,j.useEffect)(()=>{function e(e){if(e.key===`Escape`){if(_){v(!1),e.stopPropagation();return}if(y){b(!1),e.stopPropagation();return}o(`esc`)}}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[_,y,o]),(0,j.useEffect)(()=>{if(!_&&!y)return;function e(e){_&&T.current&&!T.current.contains(e.target)&&v(!1),y&&E.current&&!E.current.contains(e.target)&&b(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[_,y]);let O=c.trim(),k=O.length>0&&!n,ee=(0,j.useCallback)(()=>{if(O.length===0||n)return;let e=window.open(`about:blank`,`_blank`);console.info(`[admin-ui] new-session-modal-placeholder-open outcome=${e===null?`blocked`:`ok`}`),a({message:c,permissionMode:d,model:p,placeholder:e})},[c,d,p,O,n,a]);function A(e){e.preventDefault(),ee()}let te=ze.find(e=>e.value===p)?.label??`Default`;return(0,M.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`new-session-modal-title`,className:`new-session-modal-overlay`,onClick:e=>{e.target===e.currentTarget&&o(`backdrop`)},children:(0,M.jsxs)(`div`,{className:`new-session-modal`,children:[(0,M.jsx)(`h2`,{id:`new-session-modal-title`,className:`new-session-modal-title`,children:`New session`}),(0,M.jsxs)(`form`,{className:`new-session-modal-form`,onSubmit:A,children:[(0,M.jsx)(`div`,{className:`chat-form`,children:(0,M.jsx)(l,{ref:w,value:c,onChange:e=>{u(e),i&&s()},placeholder:`What should this session do?`,disabled:n})}),i&&(0,M.jsx)(`div`,{className:`tunnel-route__error`,role:`alert`,children:i}),(0,M.jsxs)(`div`,{className:`new-session-modal-actions`,children:[(0,M.jsxs)(`div`,{className:`new-session-modal-pickers`,children:[(0,M.jsxs)(`div`,{className:`new-session-modal-picker-wrap`,ref:T,children:[(0,M.jsxs)(`button`,{type:`button`,className:`side-mode-trigger`,onClick:()=>{let e=!_;console.info(`[admin-ui] new-session-modal-mode-picker action=${e?`open`:`close`} current=${d}`),v(e)},disabled:n,"aria-haspopup":`menu`,"aria-expanded":_,"aria-label":`Permission mode for this session`,children:[Ie[d],(0,M.jsx)(r,{size:12,"aria-hidden":`true`})]}),_&&(0,M.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Mode`,children:[(0,M.jsx)(`div`,{className:`side-mode-popover-head`,children:(0,M.jsx)(`span`,{children:`Mode`})}),Le.map((e,t)=>{let n=D(e);return(0,M.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`side-mode-popover-item`,disabled:n,title:n?Re:void 0,"aria-disabled":n||void 0,onClick:()=>{n||(console.info(`[admin-ui] new-session-modal-mode-change from=${d} to=${e} trigger=click`),f(e),v(!1))},children:[(0,M.jsx)(`span`,{children:Ie[e]}),(0,M.jsxs)(`span`,{className:`side-mode-popover-shortcut`,children:[e===d&&(0,M.jsx)(h,{size:12}),(0,M.jsx)(`span`,{children:t+1})]})]},e)})]})]}),(0,M.jsxs)(`div`,{className:`new-session-modal-picker-wrap`,ref:E,children:[(0,M.jsxs)(`button`,{type:`button`,className:`side-mode-trigger`,onClick:()=>{let e=!y;console.info(`[admin-ui] new-session-modal-model-picker action=${e?`open`:`close`} current=${p??`default`}`),b(e)},disabled:n,"aria-haspopup":`menu`,"aria-expanded":y,"aria-label":`Model for this session`,children:[te,(0,M.jsx)(r,{size:12,"aria-hidden":`true`})]}),y&&(0,M.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Model`,children:[(0,M.jsx)(`div`,{className:`side-mode-popover-head`,children:(0,M.jsx)(`span`,{children:`Model`})}),ze.map(e=>(0,M.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`side-mode-popover-item`,onClick:()=>{console.info(`[admin-ui] new-session-modal-model-change from=${p??`default`} to=${e.value??`default`} trigger=click`),m(e.value),b(!1)},children:[(0,M.jsx)(`span`,{children:e.label}),(0,M.jsx)(`span`,{className:`side-mode-popover-shortcut`,children:e.value===p&&(0,M.jsx)(h,{size:12})})]},e.label))]})]})]}),(0,M.jsxs)(`div`,{className:`new-session-modal-buttons`,children:[(0,M.jsx)(`button`,{type:`button`,className:`modal-action-btn`,onClick:()=>o(`button`),disabled:n,children:`Cancel`}),(0,M.jsx)(`button`,{type:`submit`,className:`new-session-modal-submit`,disabled:!k,"aria-label":`Send`,children:n?(0,M.jsx)(x,{size:14,className:`spinning`}):(0,M.jsx)(g,{size:14})})]})]})]})]})})}var Ve=1e4,He=(0,j.forwardRef)(function(e,t){let{businessName:i,cacheKey:o,role:s,userName:l,userAvatar:g,sessions:_,sessionsLoading:y,sessionsError:S,ensureSessionsLoaded:C,refetchSessions:w,onSelectArtefact:T,onSelectProjects:k,onSelectPeople:ee,onSelectTasks:re,onSelectAgents:N,onCloseMobileDrawer:P,onSelectSession:F,selectedSessionId:ie,collapsed:ae,mobileDrawerOpen:oe,recentsActions:se}=e,[ce,I]=(0,j.useState)(null),[ue,de]=(0,j.useState)(null),[fe,me]=(0,j.useState)(!1);(0,j.useEffect)(()=>{C()},[C]);let he=(0,j.useRef)(null),[L,_e]=(0,j.useState)(!1),[R,ve]=(0,j.useState)(`default`),[ye,be]=(0,j.useState)(void 0),z=(0,j.useRef)(null),[xe,B]=(0,j.useState)(null),[Se,Ce]=(0,j.useState)(!1),V=(0,j.useRef)(0),H=(0,j.useRef)(new Map),U=c.productName,W=typeof l==`string`?l:l===null?`name unavailable`:i||U,we=(W.trim().charAt(0)||`?`).toUpperCase(),Te=ge(c.hostname),G=Ee(o),K=(0,j.useMemo)(()=>{let e=De(G.rows,G.view,G.includeBackground);if(Te.pinned.size===0)return e;let t=[],n=[];for(let r of e)(Te.pinned.has(r.sessionId)?t:n).push(r);return[...t,...n]},[G.rows,G.view,G.includeBackground,Te.pinned]),Oe=K.length,ke=Fe(3e4);(0,j.useEffect)(()=>{if(H.current.size!==0)for(let e of G.rows){let t=H.current.get(e.sessionId);if(!t||e.url===null)continue;H.current.delete(e.sessionId),clearTimeout(t.timeoutId);let n=e.sessionId.slice(0,8);if(t.placeholder.closed){console.info(`[admin-ui] new-session-auto-open outcome=timeout sessionId=${n}`);continue}t.placeholder.location.href=e.url,console.info(`[admin-ui] new-session-auto-open outcome=ok sessionId=${n}`)}},[G.rows]),(0,j.useEffect)(()=>{let e=H.current;return()=>{for(let{timeoutId:t}of e.values())clearTimeout(t);e.clear()}},[]);let[q,Ae]=(0,j.useState)(`chat`),[je,Me]=(0,j.useState)([]),[Ne,Ie]=(0,j.useState)(!1),[Le,Re]=(0,j.useState)(null),[ze,He]=(0,j.useState)(!1);(0,j.useImperativeHandle)(t,()=>({patchArtefact(e,t){Me(n=>n.map(n=>n.id===e?{...n,...t}:n))}}),[]);let[J,Y]=(0,j.useState)(!1),qe=(0,j.useRef)(null),Je={default:`Ask`,acceptEdits:`Accept edits`,plan:`Plan`,auto:`Auto`,bypassPermissions:`Bypass permissions`},Ye=[`default`,`acceptEdits`,`plan`,`auto`,`bypassPermissions`];(0,j.useEffect)(()=>{if(!o)return;let e=!1,t=Date.now();return(async()=>{try{let n=await fetch(`/api/admin/session-defaults?session_key=${encodeURIComponent(o)}`);if(!n.ok)throw Error(`status ${n.status}`);let r=await n.json();if(e)return;let i=r.permissionMode,a=r.model??void 0;ve(i),be(a),z.current={permissionMode:i,model:a},console.info(`[admin-ui] session-defaults-hydrate permissionMode=${i} model=${a??`default`} ms=${Date.now()-t}`)}catch(n){if(e)return;let r=n instanceof Error?n.message:String(n);console.error(`[admin-ui] session-defaults-hydrate-failed reason="${r}" ms=${Date.now()-t}`)}})(),()=>{e=!0}},[o]);let X=(0,j.useCallback)(async(e,t)=>{if(!o||!z.current)return;let n=z.current,r=Date.now();console.info(`[admin-ui] session-defaults-put from={mode:${n.permissionMode},model:${n.model??`default`}} to={mode:${e.permissionMode},model:${e.model??`default`}} trigger=${t}`);try{let t=await fetch(`/api/admin/session-defaults?session_key=${encodeURIComponent(o)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({permissionMode:e.permissionMode,model:e.model??null})});if(!t.ok)throw Error(`status ${t.status}`);z.current=e,console.info(`[admin-ui] session-defaults-put-ok ms=${Date.now()-r}`)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[admin-ui] session-defaults-put-failed reason="${t}" ms=${Date.now()-r}`),ve(n.permissionMode),be(n.model)}},[o]);(0,j.useEffect)(()=>{if(!J)return;function e(e){qe.current&&!qe.current.contains(e.target)&&(console.info(`[admin-ui] sidebar-mode-picker action=close mode=${R}`),Y(!1))}function t(e){if(e.key===`Escape`){console.info(`[admin-ui] sidebar-mode-picker action=close mode=${R}`),Y(!1);return}let t=[`1`,`2`,`3`,`4`,`5`].indexOf(e.key);if(t>=0&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let n=Ye[t];n&&(e.preventDefault(),console.info(`[admin-ui] sidebar-mode-picker action=select mode=${n} via=shortcut`),ve(n),Y(!1),X({permissionMode:n,model:ye},`sidebar`))}}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[J,R,ye,X]),(0,j.useEffect)(()=>{function e(e){e.shiftKey&&(e.metaKey||e.ctrlKey)&&(e.key===`m`||e.key===`M`)&&(e.preventDefault(),Y(e=>{let t=!e;return console.info(`[admin-ui] sidebar-mode-picker action=${t?`open`:`close`} mode=${R} via=shortcut`),t}))}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[R]);let Xe=(0,j.useCallback)(async()=>{if(o){He(!0),Re(null);try{let e=await fetch(`/api/admin/sidebar-artefacts?session_key=${encodeURIComponent(o)}`);if(!e.ok)throw Error(`status ${e.status}`);Me((await e.json()).artefacts??[]),Ie(!0)}catch(e){let t=e instanceof Error?e.message:String(e);Re(`Failed to load artefacts: ${t}`),console.error(`[admin-ui] sidebar-artefacts fetch failed: ${t}`)}finally{He(!1)}}},[o]),Ze=()=>{Ae(`chat`),console.info(`[admin-ui] sidebar-nav surface=sessions count=${Oe}`)},Qe=()=>{Ae(`artefacts`),console.info(`[admin-ui] sidebar-nav surface=artefacts count=${Ne?je.length:0} collapsed=${ae}`),Ne||Xe()},Z=1.5,$e=q===`chat`?`Sessions`:`Artefacts`,et=q===`chat`?y?`…`:String(Oe):ze?`…`:String(je.length),tt=q===`chat`?y:ze,nt=()=>{console.info(`[admin-ui] sidebar-refresh surface=${q}`),q===`chat`?w().then(e=>{e!==null&&G.reconcileFromList(e.map(e=>e.sessionId))}):Xe()},rt=(0,j.useCallback)(()=>{if(L||!o){console.info(`[admin-ui] sidebar-new-session-click-ignored startingSession=${L} cacheKey=${o?`set`:`missing`}`);return}B(null),V.current=Date.now(),console.info(`[admin-ui] sidebar-new-session-modal-open seedMode=${R} cacheKey-prefix=${o.slice(0,8)}`),Ce(!0)},[o,L,R]),it=(0,j.useCallback)(e=>{let t=V.current?Date.now()-V.current:0;console.info(`[admin-ui] sidebar-new-session-modal-cancel reason=${e} dwell-ms=${t}`),B(null),Ce(!1)},[]),at=(0,j.useCallback)(async e=>{if(L||!o)return;let t=V.current?Date.now()-V.current:0,n=Date.now();console.info(`[admin-ui] sidebar-new-session-modal-submit permissionMode=${e.permissionMode} model=${e.model??`default`} messageChars=${e.message.length} dwell-ms=${t}`),_e(!0),B(null);try{console.info(`[admin-ui] sidebar-new-session-fetch-start permissionMode=${e.permissionMode} model=${e.model??`default`} messageChars=${e.message.length}`);let t={channel:`browser`,permissionMode:e.permissionMode,initialMessage:e.message};e.model!==void 0&&(t.model=e.model);let r=await fetch(`/api/admin/claude-sessions?session_key=${encodeURIComponent(o)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)}),i=Date.now()-n;console.info(`[admin-ui] sidebar-new-session-fetch-done status=${r.status} ok=${r.ok} ms=${i}`);let a=await r.json();if(!r.ok||!(`sessionId`in a)){let e=a,t=e.error??`POST returned ${r.status}`,i=e.reason?`${t}: ${e.reason}`:t;console.error(`[admin-ui] sidebar-new-session-failed status=${r.status} ms=${Date.now()-n} error=${t} reason=${e.reason??`none`} tail=${JSON.stringify(e.stderrTail??``)}`),B(i);return}console.info(`[admin-ui] sidebar-new-session-ok pid=${a.pid} sessionId=${a.sessionId.slice(0,8)} permissionMode=${e.permissionMode} model=${e.model??`default`} ms=${Date.now()-n}`),se.setSessions(e=>[a,...e]),Ce(!1);let s=a.sessionId,c=s.slice(0,8);if(e.placeholder===null)console.info(`[admin-ui] new-session-auto-open outcome=fallback sessionId=${c}`),F(s);else{let t=setTimeout(()=>{let e=H.current.get(s);e&&(H.current.delete(s),e.placeholder.closed||e.placeholder.close(),console.info(`[admin-ui] new-session-auto-open outcome=timeout sessionId=${c}`))},Ve);H.current.set(s,{placeholder:e.placeholder,timeoutId:t})}}catch(e){let t=e instanceof Error?e.message:String(e);B(t),console.error(`[admin-ui] sidebar-new-session-threw ms=${Date.now()-n} message=${t}`)}finally{_e(!1)}},[o,L,se,F]),Q=pe(o,se,`sidebar`),ot=(0,j.useCallback)(async e=>{let t=await Q.resume(e);t.ok||console.error(`[admin-ui] sidebar-resume failed: ${t.error}`)},[Q]),st=(0,j.useCallback)(async e=>{me(!0),de(null);let t=await Q.purge(e);t.ok?I(null):de(t.error??`purge failed`),me(!1)},[Q]),ct=(0,j.useCallback)(async e=>{let t=await Q.end(e);t.ok||console.error(`[admin-ui] sidebar-end-session failed: ${t.error}`)},[Q]),lt=(0,j.useCallback)(async e=>{let t=await Q.archive(e);t.ok||console.error(`[admin-ui] sidebar-archive failed: ${t.error}`)},[Q]),ut=(0,j.useCallback)(async e=>{let t=await Q.unarchive(e);t.ok||console.error(`[admin-ui] sidebar-unarchive failed: ${t.error}`)},[Q]),[dt,$]=(0,j.useState)(null),[ft,pt]=(0,j.useState)(``),mt=(0,j.useCallback)(async(e,t)=>{let n=ft.trim();if(n.length===0||!le(n)){$(null);return}if(n===(t??``)){$(null);return}let r=await Q.rename(e,n);r.ok||console.error(`[admin-ui] sidebar-rename failed: ${r.error}`),$(null)},[ft,Q]),ht=(0,j.useCallback)(()=>{$(null)},[]);return(0,M.jsxs)(`aside`,{className:`side`,children:[q===`chat`&&(0,M.jsxs)(`div`,{className:`side-new-session-row`,ref:qe,children:[(0,M.jsxs)(`button`,{type:`button`,className:`side-new-session`,onClick:rt,disabled:L||!o,children:[L?(0,M.jsx)(x,{size:14,className:`spinning`}):(0,M.jsx)(D,{size:14}),(0,M.jsx)(`span`,{children:`New session`})]}),(0,M.jsxs)(`button`,{type:`button`,className:`side-mode-trigger`,onClick:()=>{let e=!J;console.info(`[admin-ui] sidebar-mode-picker action=${e?`open`:`close`} mode=${R}`),Y(e)},disabled:L,"aria-haspopup":`menu`,"aria-expanded":J,"aria-label":`Permission mode for the next session`,title:`Shift+Cmd+M`,children:[Je[R],(0,M.jsx)(r,{size:12,"aria-hidden":`true`})]}),J&&(0,M.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Mode`,children:[(0,M.jsxs)(`div`,{className:`side-mode-popover-head`,children:[(0,M.jsx)(`span`,{children:`Mode`}),(0,M.jsx)(`span`,{className:`side-mode-popover-shortcut`,"aria-hidden":`true`,children:`⇧⌘M`})]}),Ye.map((e,t)=>(0,M.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`side-mode-popover-item`,onClick:()=>{console.info(`[admin-ui] sidebar-mode-picker action=select mode=${e}`),ve(e),Y(!1),X({permissionMode:e,model:ye},`sidebar`)},children:[(0,M.jsx)(`span`,{children:Je[e]}),(0,M.jsxs)(`span`,{className:`side-mode-popover-shortcut`,children:[e===R&&(0,M.jsx)(h,{size:12}),(0,M.jsx)(`span`,{children:t+1})]})]},e))]})]}),(0,M.jsxs)(`nav`,{className:`side-nav`,children:[(0,M.jsxs)(`button`,{type:`button`,className:`nav-row${q===`chat`?` active`:``}`,onClick:Ze,children:[(0,M.jsx)(te,{size:20,strokeWidth:Z}),(0,M.jsx)(`span`,{className:`label`,children:`Sessions`}),(0,M.jsx)(`span`,{className:`kbd`})]}),(0,M.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=people`),ee(),P()},children:[(0,M.jsx)(ne,{size:20,strokeWidth:Z}),(0,M.jsx)(`span`,{className:`label`,children:`People`}),(0,M.jsx)(`span`,{className:`kbd`})]}),(0,M.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=agents`),N(),P()},children:[(0,M.jsx)(p,{size:20,strokeWidth:Z}),(0,M.jsx)(`span`,{className:`label`,children:`Agents`}),(0,M.jsx)(`span`,{className:`kbd`})]}),(0,M.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=projects`),k(),P()},children:[(0,M.jsx)(m,{size:20,strokeWidth:Z}),(0,M.jsx)(`span`,{className:`label`,children:`Projects`}),(0,M.jsx)(`span`,{className:`kbd`})]}),(0,M.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=tasks`),re(),P()},children:[(0,M.jsx)(b,{size:20,strokeWidth:Z}),(0,M.jsx)(`span`,{className:`label`,children:`Tasks`}),(0,M.jsx)(`span`,{className:`kbd`})]}),(0,M.jsxs)(`button`,{type:`button`,className:`nav-row${q===`artefacts`?` active`:``}`,onClick:Qe,children:[(0,M.jsx)(n,{size:20,strokeWidth:Z}),(0,M.jsx)(`span`,{className:`label`,children:`Artefacts`}),(0,M.jsx)(`span`,{className:`kbd`})]})]}),(0,M.jsxs)(`div`,{className:`side-list`,ref:he,children:[(0,M.jsxs)(`div`,{className:`group-head`,children:[(0,M.jsx)(`span`,{children:$e}),(0,M.jsxs)(`span`,{className:`group-head-meta`,children:[(0,M.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh ${$e.toLowerCase()}`,"aria-label":`Refresh ${$e.toLowerCase()}`,onClick:nt,disabled:tt,children:(0,M.jsx)(O,{size:12,className:tt?`spinning`:void 0})}),(0,M.jsx)(`span`,{children:et})]})]}),q===`chat`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(We,{view:G.view,setView:e=>{console.info(`[admin-ui] sidebar-view-change view=${e}`),G.setView(e)},connected:G.connected,reconnectNow:G.reconnectNow}),S&&(0,M.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:S}),K.map(e=>{let t=ie===e.sessionId,n=dt===e.sessionId;return(0,M.jsxs)(`div`,{className:`conv${t?` active`:``}`,children:[n?(0,M.jsxs)(`span`,{className:`conv-name-line`,style:{flex:1,minWidth:0},children:[(0,M.jsx)(te,{size:12,className:`conv-channel-icon`,"aria-label":`claude session`}),(0,M.jsx)(Ge,{live:e.live,status:e.status}),(0,M.jsx)(`input`,{type:`text`,value:ft,autoFocus:!0,maxLength:200,onChange:e=>pt(e.target.value),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),mt(e.sessionId,e.firstPrompt)):t.key===`Escape`&&(t.preventDefault(),ht())},onBlur:()=>{mt(e.sessionId,e.firstPrompt)},className:`conv-name`,"aria-label":`Rename session`,style:{flex:1,minWidth:0,background:`transparent`,border:`none`,outline:`none`,color:`inherit`,font:`inherit`}})]}):(0,M.jsxs)(`button`,{type:`button`,className:`conv-name-button`,onClick:()=>{F(e.sessionId),P()},title:`Show metadata`,children:[(0,M.jsxs)(`span`,{className:`conv-name-line`,children:[(0,M.jsx)(te,{size:12,className:`conv-channel-icon`,"aria-label":`claude session`}),(0,M.jsx)(Ge,{live:e.live,status:e.status}),e.firstPrompt?(0,M.jsx)(`span`,{className:`conv-name`,children:e.firstPrompt}):(0,M.jsxs)(`span`,{className:`conv-name`,style:{fontStyle:`italic`,opacity:.6},children:[`(unnamed · `,e.sessionId.slice(0,8),`)`]})]}),(0,M.jsx)(`span`,{className:`conv-timestamp`,children:Pe(e.updatedAt,ke)})]}),!n&&(0,M.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Rename`,"aria-label":`Rename session`,onClick:()=>{pt(e.firstPrompt??``),$(e.sessionId)},children:(0,M.jsx)(E,{size:13})}),e.url!==null&&(0,M.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Open in new tab`,"aria-label":`Open in new tab`,onClick:()=>Ke(e.url,e.sessionId),children:(0,M.jsx)(v,{size:13})}),e.live?(0,M.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`End session`,"aria-label":`End session`,onClick:()=>void ct(e.sessionId),disabled:Q.inFlight===`end`,children:Q.inFlight===`end`?(0,M.jsx)(x,{size:13,className:`spinning`}):(0,M.jsx)(A,{size:13})}):e.archived?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Unarchive session`,"aria-label":`Unarchive session`,onClick:()=>void ut(e.sessionId),disabled:Q.inFlight===`unarchive`,children:Q.inFlight===`unarchive`?(0,M.jsx)(x,{size:13,className:`spinning`}):(0,M.jsx)(d,{size:13})}),(0,M.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Purge JSONL`,"aria-label":`Purge JSONL`,onClick:()=>{de(null),I({sessionId:e.sessionId,displayName:e.firstPrompt})},children:(0,M.jsx)(a,{size:13})})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Resume session`,"aria-label":`Resume session`,onClick:()=>void ot(e.sessionId),disabled:Q.inFlight===`resume`,children:Q.inFlight===`resume`?(0,M.jsx)(x,{size:13,className:`spinning`}):(0,M.jsx)(u,{size:13})}),(0,M.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Archive session`,"aria-label":`Archive session`,onClick:()=>void lt(e.sessionId),disabled:Q.inFlight===`archive`,children:Q.inFlight===`archive`?(0,M.jsx)(x,{size:13,className:`spinning`}):(0,M.jsx)(f,{size:13})}),(0,M.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Purge JSONL`,"aria-label":`Purge JSONL`,onClick:()=>{de(null),I({sessionId:e.sessionId,displayName:e.firstPrompt})},children:(0,M.jsx)(a,{size:13})})]})]},e.sessionId)})]}),q===`artefacts`&&(0,M.jsxs)(M.Fragment,{children:[Le&&(0,M.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:Le}),Ne&&!Le&&je.length===0&&(0,M.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:`No artefacts yet`}),je.map(e=>(0,M.jsxs)(`button`,{type:`button`,className:`conv`,onClick:()=>{T({docId:e.id,name:e.name,content:e.content,editable:e.editable,mimeType:e.mimeType,skipReason:e.skipReason},`sidebar-artefacts`),P()},children:[(0,M.jsx)(`span`,{className:`conv-name`,children:e.name}),(0,M.jsx)(`span`,{className:`conv-kind`,"data-kind":e.kind===`agent-template`?`agent`:`doc`,children:e.kind===`agent-template`?`agent`:`doc`})]},e.id))]})]}),(0,M.jsx)(Ue,{}),(0,M.jsxs)(`div`,{className:`side-foot`,children:[(0,M.jsx)(`div`,{className:`avatar`,children:g?(0,M.jsx)(`img`,{src:g,alt:W}):we}),(0,M.jsxs)(`div`,{className:`who`,children:[(0,M.jsx)(`span`,{className:`name`,children:W}),(0,M.jsx)(`span`,{className:`role`,children:s??`operator`})]})]}),Se&&(0,M.jsx)(Be,{seedMode:R,seedModel:ye,submitting:L,error:xe,onSubmit:e=>void at(e),onCancel:it,onErrorClear:()=>B(null)}),ce&&(0,M.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`purge-confirm-title`,className:`modal-overlay`,onClick:e=>{e.target===e.currentTarget&&!fe&&I(null)},children:(0,M.jsxs)(`div`,{className:`modal-card`,children:[(0,M.jsx)(`h3`,{id:`purge-confirm-title`,style:{margin:0,marginBottom:8,fontSize:16,fontWeight:600},children:`Purge session JSONL?`}),(0,M.jsxs)(`p`,{style:{margin:0,marginBottom:8,fontSize:13},children:[`This hard-deletes the transcript for `,(0,M.jsx)(`strong`,{children:ce.displayName??ce.sessionId.slice(0,8)}),`. The action cannot be undone.`]}),ue&&(0,M.jsx)(`p`,{style:{margin:0,marginBottom:8,fontSize:12,color:`var(--text-tertiary)`},children:ue}),(0,M.jsxs)(`div`,{className:`modal-action-row`,children:[(0,M.jsx)(`button`,{type:`button`,className:`modal-action-btn`,disabled:fe,onClick:()=>I(null),children:`Cancel`}),(0,M.jsx)(`button`,{type:`button`,className:`modal-action-btn`,"data-variant":`danger`,disabled:fe,onClick:()=>void st(ce.sessionId),children:fe?(0,M.jsx)(x,{size:13,className:`spinning`}):`Purge`})]})]})})]})}),J=5e3;function Ue(){let[e,t]=(0,j.useState)(null);if((0,j.useEffect)(()=>{let e=!1,n=null;async function r(){try{let n=await fetch(`/api/admin/system-stats`);if(!n.ok){console.error(`[admin-ui] system-stats-fetch-failed status=${n.status}`);return}let r=await n.json();e||t(r)}catch(e){console.error(`[admin-ui] system-stats-fetch-failed reason=${e instanceof Error?e.message:String(e)}`)}}function i(){n===null&&(r(),n=setInterval(()=>{r()},J))}function a(){n!==null&&(clearInterval(n),n=null)}function o(){document.hidden?a():i()}return document.hidden||i(),document.addEventListener(`visibilitychange`,o),()=>{e=!0,a(),document.removeEventListener(`visibilitychange`,o)}},[]),!e)return null;let n=e.cpuPct,r=e.memUsedPct,i=n!==null&&n>=.9,a=n!==null&&n>=.98,o=r!==null&&r>=.9,s=r!==null&&r>=.98,c=i||o,l=a||s,u=e=>e===null?`—`:`${Math.round(e*100)}%`,d=e=>{if(e===null)return{width:`0%`,background:`var(--text-tertiary)`};let t=Math.min(1,Math.max(0,e)),n=Math.round(140*(1-t));return{width:`${Math.round(t*100)}%`,background:`hsl(${n}, 65%, 45%)`}},f=[`system-stats`];return c&&f.push(`system-stats--warn`),l&&f.push(`system-stats--crit`),(0,M.jsxs)(`div`,{className:f.join(` `),role:`status`,"aria-label":`host CPU and RAM`,children:[(0,M.jsxs)(`div`,{className:`system-stats__metric`,children:[(0,M.jsxs)(`span`,{className:i?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`CPU `,u(n)]}),(0,M.jsx)(`div`,{className:`system-stats__bar`,children:(0,M.jsx)(`div`,{className:`system-stats__bar-fill`,style:d(n)})})]}),(0,M.jsxs)(`div`,{className:`system-stats__metric`,children:[(0,M.jsxs)(`span`,{className:o?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`RAM `,u(r)]}),(0,M.jsx)(`div`,{className:`system-stats__bar`,children:(0,M.jsx)(`div`,{className:`system-stats__bar-fill`,style:d(r)})})]})]})}var Y=[{value:`active`,label:`Active`},{value:`archived`,label:`Archived`},{value:`all`,label:`All`}];function We(e){let{view:t,setView:n,connected:r,reconnectNow:i}=e;return(0,M.jsx)(`div`,{className:`session-view-controls`,children:(0,M.jsxs)(`div`,{className:`session-view-segmented`,role:`tablist`,"aria-label":`Session view`,children:[Y.map(e=>(0,M.jsx)(`button`,{type:`button`,role:`tab`,className:`session-view-tab${t===e.value?` active`:``}`,"aria-selected":t===e.value,onClick:()=>n(e.value),children:e.label},e.value)),r?(0,M.jsx)(`span`,{className:`session-view-connection connected`,"aria-label":`Live updates connected.`,title:`Live updates connected.`}):(0,M.jsx)(`button`,{type:`button`,className:`session-view-connection disconnected`,"aria-label":`Live updates paused. Click to retry.`,title:`Live updates paused. Click to retry.`,onClick:i})]})})}function Ge({live:e,status:t}){return e?t===`busy`?(0,M.jsxs)(`span`,{className:`session-status session-status-busy`,"aria-label":`session busy`,children:[(0,M.jsx)(`span`,{className:`session-status-dot`}),(0,M.jsx)(`span`,{className:`session-status-dot`}),(0,M.jsx)(`span`,{className:`session-status-dot`})]}):t===`detached`?(0,M.jsx)(`span`,{className:`session-status session-status-detached`,"aria-label":`session detached — manager restart survivor`}):(0,M.jsx)(`span`,{className:`session-status session-status-idle`,"aria-label":`session idle`}):(0,M.jsx)(`span`,{className:`session-status session-status-archived`,"aria-label":`session archived`})}function Ke(e,t){let n=t.slice(0,8),r=window.open(e,`_blank`,`noopener,noreferrer`)===null?`blocked`:`ok`;console.info(`[admin-ui] sidebar-open-in-new-tab outcome=${r} sessionId=${n}`)}function qe(e){return e.map(e=>[e.sessionId,e.displayName,e.lastMessageAt,e.status])}function Je(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r[0]!==i[0]||r[1]!==i[1]||r[2]!==i[2]||r[3]!==i[3])return!1}return!0}function Ye(e){let[t,n]=(0,j.useState)([]),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)(null),l=(0,j.useRef)([]),u=(0,j.useCallback)(async t=>{if(!e||!t&&s===e)return null;i(!0),o(null);try{let t=await fetch(`/api/admin/claude-sessions?session_key=${encodeURIComponent(e)}`);if(!t.ok)throw Error(`claude-sessions fetch returned ${t.status}`);let r=await t.json(),i=Array.isArray(r)?r:r.sessions??[],a=qe(i),o=Je(l.current,a);return o||(n(i),l.current=a),c(e),console.info(`[admin-ui] sessions-poll outcome=${o?`unchanged`:`changed`} count=${i.length} cacheKey=${e.slice(0,8)}`),i}catch(t){return console.info(`[admin-ui] sessions-poll outcome=error count=0 cacheKey=${e.slice(0,8)}`),console.error(`[admin/claude-sessions] fetch failed:`,t),o(t instanceof Error?t.message:String(t)),null}finally{i(!1)}},[e,s]);(0,j.useEffect)(()=>{e||(c(null),n([]),o(null),l.current=[])},[e]);let d=(0,j.useCallback)(()=>u(!1),[u]),f=(0,j.useCallback)(()=>u(!0),[u]);return{sessions:t,setSessions:n,loading:r,loaded:s!==null&&s===e,error:a,ensureLoaded:d,refetch:f}}var X=`admin-sidebar-collapsed`,Xe=`admin-sidebar-drawer-open`;function Ze(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(X)===`1`}catch{return!1}}function Qe(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(X,`1`):window.sessionStorage.removeItem(X)}catch{}}function Z(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(Xe)===`1`}catch{return!1}}function $e(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(Xe,`1`):window.sessionStorage.removeItem(Xe)}catch{}}var et=720;function tt(e){let{cacheKey:t,businessName:n,onLogout:r,userName:i,userAvatar:a,role:o,selectedSessionId:s,onSelectSession:c,onSelectArtefact:l,dataArtefact:u=`closed`,children:d,footer:f}=e,[p,m]=(0,j.useState)(()=>Ze()),[h,g]=(0,j.useState)(()=>Z()),[_,v]=(0,j.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: ${et}px)`).matches);(0,j.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(max-width: ${et}px)`),t=e=>v(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let y=(0,j.useCallback)(e=>{Qe(e),m(e)},[]),b=(0,j.useCallback)(e=>{$e(e),g(e)},[]);(0,j.useEffect)(()=>{if(typeof window>`u`)return;let e=window.location?.pathname??``;console.info(`[admin-ui] shell-mount route=${e} collapsed=${p} drawer=${h}`)},[]);let x=_?h:!p,S=(0,j.useCallback)(()=>{if(!(typeof window>`u`))if(window.matchMedia(`(max-width: ${et}px)`).matches){let e=h;console.info(`[admin-ui] header-sidebar-toggle from=${e?`open`:`closed`} mode=drawer`),b(!e)}else{let e=p;console.info(`[admin-ui] header-sidebar-toggle from=${e?`closed`:`open`} mode=collapse`),y(!e)}},[p,h,y,b]),C=(0,j.useCallback)(e=>{console.info(`[admin-ui] header-menu-nav target=${e}`),window.location.href=e===`data`?`/data`:`/graph`},[]),w=Ye(t),T=Ee(t),E=(0,j.useMemo)(()=>T.rows.map(e=>e.sessionId),[T.rows]),D=(0,j.useCallback)(e=>{if(c){c(e);return}window.location.assign(`/?sessionId=${encodeURIComponent(e)}`)},[c]),O=(0,j.useCallback)(e=>{l&&l(e)},[l]),k={collapsed:p,mobileDrawerOpen:h,sidebarOpen:x,onToggleSidebar:S,setMobileDrawerOpen:b,sessionsState:w,sessionRowIds:E,sessionRowsConnected:T.connected};return(0,M.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[(0,M.jsx)(_e,{businessName:n,onNavigate:C,onToggleSidebar:S,sidebarOpen:x,onLogout:r}),(0,M.jsxs)(`div`,{className:`platform${h?` menu-open`:``}${p?` sidebar-collapsed`:``}`,"data-artefact":u,children:[(0,M.jsx)(He,{businessName:n,cacheKey:t,role:o??null,userName:i,userAvatar:a??null,sessions:w.sessions,sessionsLoading:w.loading,sessionsError:w.error,ensureSessionsLoaded:w.ensureLoaded,refetchSessions:w.refetch,onSelectArtefact:O,onSelectProjects:()=>{window.location.href=`/graph?label=Project`},onSelectPeople:()=>{window.location.href=`/graph?label=Person`},onSelectTasks:()=>{window.location.href=`/graph?label=Task`},onSelectAgents:()=>{window.location.href=`/graph?label=Agent`},onCloseMobileDrawer:()=>b(!1),onSelectSession:D,selectedSessionId:s??null,collapsed:p,mobileDrawerOpen:h,recentsActions:{setSessions:w.setSessions,refetch:w.refetch}}),typeof d==`function`?d(k):d]}),h&&(0,M.jsx)(`div`,{className:`sidebar-backdrop menu-open`,"aria-hidden":`true`,onClick:()=>b(!1)}),f]})}var nt={LocalBusiness:`#4F6B8A`,Service:`#6B85A0`,PriceSpecification:`#8AA0B8`,OpeningHoursSpecification:`#A8BACE`,Organization:`#8A6B47`,Person:`#B86E4A`,UserProfile:`#D08960`,Preference:`#DFA67A`,AdminUser:`#8C5230`,AccessGrant:`#66381F`,KnowledgeDocument:`#6E8A5A`,ConversationArchive:`#82A06A`,Section:`#8AA876`,Chunk:`#A6C194`,DigitalDocument:`#5A7548`,CreativeWork:`#B5C9A2`,Question:`#C7D6B5`,FAQPage:`#95B385`,DefinedTerm:`#76906A`,Review:`#3F5A2E`,ImageObject:`#A0BB8C`,Conversation:`#6B5A85`,AdminConversation:`#4F4070`,PublicConversation:`#8A75A8`,Message:`#6B7280`,UserMessage:`#DFA67A`,AssistantMessage:`#C9A876`,ToolCall:`#B5ABCB`,Task:`#B0617A`,Project:`#8E4A60`,Event:`#C68095`,Workflow:`#3A6F77`,WorkflowStep:`#5A8E96`,WorkflowRun:`#7AAAB2`,StepResult:`#9CC4CB`,Email:`#6F7F4A`,EmailAccount:`#91A063`,Agent:`#B8893D`},rt=`#94A3B8`;Object.freeze(Object.keys(nt)),Object.freeze(new Set([`Chunk`,`GraphPreference`]));var it=Object.freeze(new Set(`LocalBusiness.Service.PriceSpecification.OpeningHoursSpecification.Organization.Person.UserProfile.Preference.AdminUser.AccessGrant.KnowledgeDocument.DigitalDocument.CreativeWork.Question.FAQPage.DefinedTerm.Review.ImageObject.AdminConversation.PublicConversation.Task.Project.Event.Workflow.Email.EmailAccount.Agent`.split(`.`)));Object.freeze(new Set([`ToolCall`,`StepResult`,`WorkflowStep`,`WorkflowRun`])),Object.freeze(new Set([`HAS_TOOL_CALL`,`RUN_OF`,`HAS_STEP`,`HAS_RESULT`]));function at(e){for(let t=1;t<e.length;t++)if(Object.prototype.hasOwnProperty.call(nt,e[t]))return e[t];return e[0]??null}function Q(e){return nt[e]??`#94A3B8`}function ot(e){let t=at(e),n=t?Q(t):rt,r=0;for(let t=1;t<e.length;t++)Object.prototype.hasOwnProperty.call(nt,e[t])&&r++;return{displayLabel:t,colour:n,driftCandidates:r}}export{d as C,f as S,E as _,tt as a,_ as b,le as c,re as d,A as f,D as g,O as h,ot as i,pe as l,k as m,Q as n,Ce as o,ee as p,at as r,ge as s,it as t,ae as u,x as v,h as x,v as y};