@rubytech/create-realagent-code 0.1.16 → 0.1.18

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 (127) hide show
  1. package/dist/__tests__/onboarding-state-readback.test.js +61 -0
  2. package/dist/__tests__/plugin-install.test.js +105 -0
  3. package/dist/index.js +175 -0
  4. package/dist/lib/plugin-install.js +108 -0
  5. package/dist/onboarding-readback.js +27 -0
  6. package/package.json +1 -1
  7. package/payload/platform/config/brand.json +6 -1
  8. package/payload/platform/plugins/.claude-plugin/marketplace.json +103 -0
  9. package/payload/platform/plugins/admin/.claude-plugin/plugin.json +17 -0
  10. package/payload/platform/plugins/anthropic/.claude-plugin/plugin.json +8 -0
  11. package/payload/platform/plugins/business-assistant/.claude-plugin/plugin.json +8 -0
  12. package/payload/platform/plugins/cloudflare/.claude-plugin/plugin.json +17 -0
  13. package/payload/platform/plugins/contacts/.claude-plugin/plugin.json +17 -0
  14. package/payload/platform/plugins/deep-research/.claude-plugin/plugin.json +8 -0
  15. package/payload/platform/plugins/docs/.claude-plugin/plugin.json +8 -0
  16. package/payload/platform/plugins/docs/references/deployment.md +73 -0
  17. package/payload/platform/plugins/docs/references/platform.md +1 -1
  18. package/payload/platform/plugins/email/.claude-plugin/plugin.json +17 -0
  19. package/payload/platform/plugins/linkedin-import/.claude-plugin/plugin.json +8 -0
  20. package/payload/platform/plugins/memory/.claude-plugin/plugin.json +17 -0
  21. package/payload/platform/plugins/outlook/.claude-plugin/plugin.json +17 -0
  22. package/payload/platform/plugins/projects/.claude-plugin/plugin.json +8 -0
  23. package/payload/platform/plugins/replicate/.claude-plugin/plugin.json +17 -0
  24. package/payload/platform/plugins/sales/.claude-plugin/plugin.json +8 -0
  25. package/payload/platform/plugins/scheduling/.claude-plugin/plugin.json +17 -0
  26. package/payload/platform/plugins/tasks/.claude-plugin/plugin.json +13 -13
  27. package/payload/platform/plugins/waitlist/.claude-plugin/plugin.json +17 -0
  28. package/payload/platform/plugins/whatsapp/.claude-plugin/plugin.json +17 -0
  29. package/payload/platform/plugins/workflows/.claude-plugin/plugin.json +13 -12
  30. package/payload/platform/scripts/seed-neo4j.sh +35 -0
  31. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
  32. package/payload/platform/services/claude-session-manager/dist/http-server.js +13 -2
  33. package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
  34. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts +6 -0
  35. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
  36. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +9 -3
  37. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
  38. package/payload/premium-plugins/.claude-plugin/marketplace.json +18 -0
  39. package/payload/premium-plugins/real-agency/plugins/.claude-plugin/marketplace.json +63 -0
  40. package/payload/premium-plugins/real-agency/plugins/brochures/.claude-plugin/plugin.json +8 -0
  41. package/payload/premium-plugins/real-agency/plugins/buyers/.claude-plugin/plugin.json +8 -0
  42. package/payload/premium-plugins/real-agency/plugins/estate-business/.claude-plugin/plugin.json +8 -0
  43. package/payload/premium-plugins/real-agency/plugins/estate-coaching/.claude-plugin/plugin.json +8 -0
  44. package/payload/premium-plugins/real-agency/plugins/estate-onboarding/.claude-plugin/plugin.json +8 -0
  45. package/payload/premium-plugins/real-agency/plugins/estate-sales/.claude-plugin/plugin.json +8 -0
  46. package/payload/premium-plugins/real-agency/plugins/estate-teaching/.claude-plugin/plugin.json +8 -0
  47. package/payload/premium-plugins/real-agency/plugins/leads/.claude-plugin/plugin.json +8 -0
  48. package/payload/premium-plugins/real-agency/plugins/listings/.claude-plugin/plugin.json +8 -0
  49. package/payload/premium-plugins/real-agency/plugins/loop/.claude-plugin/plugin.json +17 -0
  50. package/payload/premium-plugins/real-agency/plugins/vendors/.claude-plugin/plugin.json +8 -0
  51. package/payload/premium-plugins/teaching/.claude-plugin/plugin.json +8 -0
  52. package/payload/premium-plugins/writer-craft/.claude-plugin/plugin.json +8 -0
  53. package/payload/server/public/assets/{Checkbox-YcNN7jq1.js → Checkbox-BmlrSRF8.js} +1 -1
  54. package/payload/server/public/assets/admin-Drvl0Okz.js +216 -0
  55. package/payload/server/public/assets/{architectureDiagram-Q4EWVU46-96vgHxqG.js → architectureDiagram-Q4EWVU46-DU8MnqOj.js} +1 -1
  56. package/payload/server/public/assets/{blockDiagram-DXYQGD6D-BdH2Cb_g.js → blockDiagram-DXYQGD6D-DwBZc1na.js} +1 -1
  57. package/payload/server/public/assets/{c4Diagram-AHTNJAMY-N93PeJeZ.js → c4Diagram-AHTNJAMY-C9ZHreVX.js} +1 -1
  58. package/payload/server/public/assets/channel-Boz4UHN2.js +1 -0
  59. package/payload/server/public/assets/{chunk-336JU56O--ZhC91-8.js → chunk-336JU56O-DNXqHk42.js} +2 -2
  60. package/payload/server/public/assets/{chunk-426QAEUC-NreYOhuj.js → chunk-426QAEUC-DOLKkQGn.js} +1 -1
  61. package/payload/server/public/assets/{chunk-4TB4RGXK-D8tdHM-B.js → chunk-4TB4RGXK-l8iZx-gQ.js} +1 -1
  62. package/payload/server/public/assets/{chunk-5FUZZQ4R-0x7lCysy.js → chunk-5FUZZQ4R-DQwRtUdO.js} +1 -1
  63. package/payload/server/public/assets/{chunk-5PVQY5BW-B8aFD0v2.js → chunk-5PVQY5BW-CvvoBJnn.js} +1 -1
  64. package/payload/server/public/assets/{chunk-EDXVE4YY-DcGxS2xv.js → chunk-EDXVE4YY-DV1J4-LR.js} +1 -1
  65. package/payload/server/public/assets/{chunk-ENJZ2VHE-CGa-VGZR.js → chunk-ENJZ2VHE-Co6qpIQl.js} +1 -1
  66. package/payload/server/public/assets/{chunk-ICPOFSXX-jOlAtTf8.js → chunk-ICPOFSXX-9v9O_mwr.js} +1 -1
  67. package/payload/server/public/assets/{chunk-OYMX7WX6-DYDZSTbO.js → chunk-OYMX7WX6-D2X1NuKZ.js} +1 -1
  68. package/payload/server/public/assets/{chunk-U2HBQHQK-CZ-7SbAa.js → chunk-U2HBQHQK-DmqWEsN2.js} +1 -1
  69. package/payload/server/public/assets/{chunk-X2U36JSP-DE9wpb9Q.js → chunk-X2U36JSP-C0b2a6Bq.js} +1 -1
  70. package/payload/server/public/assets/{chunk-YZCP3GAM-B6klGA8S.js → chunk-YZCP3GAM-BdBAquWg.js} +1 -1
  71. package/payload/server/public/assets/{chunk-ZZ45TVLE-BtC_su1V.js → chunk-ZZ45TVLE-C1AFspLM.js} +1 -1
  72. package/payload/server/public/assets/classDiagram-6PBFFD2Q-CRA6E97A.js +1 -0
  73. package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-VnieTvEm.js +1 -0
  74. package/payload/server/public/assets/clone-6YhZHo8b.js +1 -0
  75. package/payload/server/public/assets/{dagre-DJ6RkHVs.js → dagre-7eiQzAHj.js} +1 -1
  76. package/payload/server/public/assets/{dagre-KV5264BT-BL-5O-QR.js → dagre-KV5264BT-a88ylEXY.js} +1 -1
  77. package/payload/server/public/assets/data-Dq_if_B4.js +1 -0
  78. package/payload/server/public/assets/{device-url-actions-BN_tQerV.js → device-url-actions-_s-UgHa3.js} +1 -1
  79. package/payload/server/public/assets/{diagram-5BDNPKRD-tmZhEAU-.js → diagram-5BDNPKRD-XuINnSy-.js} +1 -1
  80. package/payload/server/public/assets/{diagram-G4DWMVQ6-Cm8Qa00o.js → diagram-G4DWMVQ6-B93iSQ8a.js} +1 -1
  81. package/payload/server/public/assets/{diagram-MMDJMWI5-gpFqrqSd.js → diagram-MMDJMWI5-Gcoj967k.js} +1 -1
  82. package/payload/server/public/assets/{diagram-TYMM5635-Dhui1_oR.js → diagram-TYMM5635-C2BKnsAF.js} +1 -1
  83. package/payload/server/public/assets/{erDiagram-SMLLAGMA-DVwK_CfW.js → erDiagram-SMLLAGMA-DwbOuflI.js} +1 -1
  84. package/payload/server/public/assets/{flowDiagram-DWJPFMVM-BElR60Ob.js → flowDiagram-DWJPFMVM-CEExhdxC.js} +1 -1
  85. package/payload/server/public/assets/{ganttDiagram-T4ZO3ILL-8NGZhLA3.js → ganttDiagram-T4ZO3ILL-kYNYeUK-.js} +1 -1
  86. package/payload/server/public/assets/{gitGraphDiagram-UUTBAWPF-DGVw9ymM.js → gitGraphDiagram-UUTBAWPF-D3X2eJPE.js} +1 -1
  87. package/payload/server/public/assets/graph-CNFkzAKU.js +1 -0
  88. package/payload/server/public/assets/{graph-labels-piCPPdFq.js → graph-labels-C6ZZPglH.js} +1 -1
  89. package/payload/server/public/assets/{graphlib-uE-sp1ee.js → graphlib-_S6i_Jn2.js} +1 -1
  90. package/payload/server/public/assets/{infoDiagram-42DDH7IO-B-Vuz8L0.js → infoDiagram-42DDH7IO-CQx0vDcC.js} +1 -1
  91. package/payload/server/public/assets/{ishikawaDiagram-UXIWVN3A-DlcYgX27.js → ishikawaDiagram-UXIWVN3A-0eZUgqUP.js} +1 -1
  92. package/payload/server/public/assets/{journeyDiagram-VCZTEJTY-C-19XR7D.js → journeyDiagram-VCZTEJTY-D-B2Kd_J.js} +1 -1
  93. package/payload/server/public/assets/jsx-runtime-CtqEPPN5.css +1 -0
  94. package/payload/server/public/assets/{kanban-definition-6JOO6SKY-CEsBB-l2.js → kanban-definition-6JOO6SKY-BmLn-OEz.js} +1 -1
  95. package/payload/server/public/assets/{line-B_WJJGNO.js → line-h25nWPBw.js} +1 -1
  96. package/payload/server/public/assets/{mermaid-parser.core-DHnCk5T5.js → mermaid-parser.core-CXXeaSZi.js} +1 -1
  97. package/payload/server/public/assets/{mermaid.core-DhZqC4uG.js → mermaid.core-BjFfgEHL.js} +3 -3
  98. package/payload/server/public/assets/{mindmap-definition-QFDTVHPH-B2tHowcI.js → mindmap-definition-QFDTVHPH-Dql4ILoK.js} +1 -1
  99. package/payload/server/public/assets/{page-CjxybpTy.js → page-CdWWweCx.js} +1 -1
  100. package/payload/server/public/assets/{page-CBA4FUGo.js → page-D20UnO_r.js} +1 -1
  101. package/payload/server/public/assets/{pieDiagram-DEJITSTG-xopsRxKN.js → pieDiagram-DEJITSTG-nYaoTCKZ.js} +1 -1
  102. package/payload/server/public/assets/{public-BBqroGXK.js → public-CXgyLdJU.js} +3 -3
  103. package/payload/server/public/assets/{quadrantDiagram-34T5L4WZ-B19ZbtY0.js → quadrantDiagram-34T5L4WZ-XG8xivm9.js} +1 -1
  104. package/payload/server/public/assets/{requirementDiagram-MS252O5E-BMcM9iam.js → requirementDiagram-MS252O5E-C2GzfT-6.js} +1 -1
  105. package/payload/server/public/assets/{sankeyDiagram-XADWPNL6-DW5Hs7Av.js → sankeyDiagram-XADWPNL6-3aI78p2X.js} +1 -1
  106. package/payload/server/public/assets/{sequenceDiagram-FGHM5R23-Cn7z1Q3s.js → sequenceDiagram-FGHM5R23-CvaNRYuS.js} +1 -1
  107. package/payload/server/public/assets/{stateDiagram-FHFEXIEX-DR7At7js.js → stateDiagram-FHFEXIEX-DHT2Zyvj.js} +1 -1
  108. package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-YmtuS9BN.js +1 -0
  109. package/payload/server/public/assets/{timeline-definition-GMOUNBTQ-Bm8JLRpB.js → timeline-definition-GMOUNBTQ-DqPjDUku.js} +1 -1
  110. package/payload/server/public/assets/{vennDiagram-DHZGUBPP-6XqALjnd.js → vennDiagram-DHZGUBPP-lQB1LgjH.js} +1 -1
  111. package/payload/server/public/assets/{wardleyDiagram-NUSXRM2D-DhdYZjeI.js → wardleyDiagram-NUSXRM2D-sxSMxkwm.js} +1 -1
  112. package/payload/server/public/assets/{xychartDiagram-5P7HB3ND-CBmEo9Oi.js → xychartDiagram-5P7HB3ND-4-dvvfSD.js} +1 -1
  113. package/payload/server/public/data.html +5 -5
  114. package/payload/server/public/graph.html +6 -6
  115. package/payload/server/public/index.html +8 -8
  116. package/payload/server/public/public.html +5 -5
  117. package/payload/server/server.js +91 -6
  118. package/payload/server/public/assets/admin-B1JZ0uth.js +0 -216
  119. package/payload/server/public/assets/channel-TAr3X5oz.js +0 -1
  120. package/payload/server/public/assets/classDiagram-6PBFFD2Q-DjmusLvy.js +0 -1
  121. package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-TIJEjUyl.js +0 -1
  122. package/payload/server/public/assets/clone-O8K8fxhJ.js +0 -1
  123. package/payload/server/public/assets/data-DcMPzQFt.js +0 -1
  124. package/payload/server/public/assets/graph-oLjrPnCQ.js +0 -1
  125. package/payload/server/public/assets/jsx-runtime-jZDyLD_2.css +0 -1
  126. package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-CvqZ4uTP.js +0 -1
  127. /package/payload/server/public/assets/{jsx-runtime-HrrfyPcI.js → jsx-runtime-BSJRynxp.js} +0 -0
@@ -5,12 +5,12 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Data — Maxy</title>
7
7
  <link rel="icon" href="/favicon.ico">
8
- <script type="module" crossorigin src="/assets/data-DcMPzQFt.js"></script>
8
+ <script type="module" crossorigin src="/assets/data-Dq_if_B4.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-DD-I1_y5.js">
10
- <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-HrrfyPcI.js">
11
- <link rel="modulepreload" crossorigin href="/assets/graph-labels-piCPPdFq.js">
12
- <link rel="modulepreload" crossorigin href="/assets/page-CjxybpTy.js">
13
- <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-jZDyLD_2.css">
10
+ <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BSJRynxp.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/graph-labels-C6ZZPglH.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/page-CdWWweCx.js">
13
+ <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-CtqEPPN5.css">
14
14
  </head>
15
15
  <body>
16
16
  <div id="root"></div>
@@ -5,13 +5,13 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Graph — Maxy</title>
7
7
  <link rel="icon" href="/favicon.ico">
8
- <script type="module" crossorigin src="/assets/graph-oLjrPnCQ.js"></script>
8
+ <script type="module" crossorigin src="/assets/graph-CNFkzAKU.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-DD-I1_y5.js">
10
- <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-HrrfyPcI.js">
11
- <link rel="modulepreload" crossorigin href="/assets/Checkbox-YcNN7jq1.js">
12
- <link rel="modulepreload" crossorigin href="/assets/graph-labels-piCPPdFq.js">
13
- <link rel="modulepreload" crossorigin href="/assets/page-CBA4FUGo.js">
14
- <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-jZDyLD_2.css">
10
+ <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BSJRynxp.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/Checkbox-BmlrSRF8.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/graph-labels-C6ZZPglH.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/page-D20UnO_r.js">
14
+ <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-CtqEPPN5.css">
15
15
  </head>
16
16
  <body>
17
17
  <div id="root"></div>
@@ -5,15 +5,15 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Real Agent</title>
7
7
  <link rel="icon" href="/favicon.ico">
8
- <script type="module" crossorigin src="/assets/admin-B1JZ0uth.js"></script>
8
+ <script type="module" crossorigin src="/assets/admin-Drvl0Okz.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-DD-I1_y5.js">
10
- <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-HrrfyPcI.js">
11
- <link rel="modulepreload" crossorigin href="/assets/device-url-actions-BN_tQerV.js">
12
- <link rel="modulepreload" crossorigin href="/assets/Checkbox-YcNN7jq1.js">
13
- <link rel="modulepreload" crossorigin href="/assets/graph-labels-piCPPdFq.js">
14
- <link rel="modulepreload" crossorigin href="/assets/page-CjxybpTy.js">
15
- <link rel="modulepreload" crossorigin href="/assets/page-CBA4FUGo.js">
16
- <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-jZDyLD_2.css">
10
+ <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BSJRynxp.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/device-url-actions-_s-UgHa3.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/Checkbox-BmlrSRF8.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/graph-labels-C6ZZPglH.js">
14
+ <link rel="modulepreload" crossorigin href="/assets/page-CdWWweCx.js">
15
+ <link rel="modulepreload" crossorigin href="/assets/page-D20UnO_r.js">
16
+ <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-CtqEPPN5.css">
17
17
  <link rel="stylesheet" crossorigin href="/assets/admin-CWMpccrR.css">
18
18
  <link rel="stylesheet" href="/brand-defaults.css">
19
19
  </head>
@@ -5,12 +5,12 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Real Agent</title>
7
7
  <link rel="icon" href="/favicon.ico">
8
- <script type="module" crossorigin src="/assets/public-BBqroGXK.js"></script>
8
+ <script type="module" crossorigin src="/assets/public-CXgyLdJU.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-DD-I1_y5.js">
10
- <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-HrrfyPcI.js">
11
- <link rel="modulepreload" crossorigin href="/assets/device-url-actions-BN_tQerV.js">
12
- <link rel="modulepreload" crossorigin href="/assets/Checkbox-YcNN7jq1.js">
13
- <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-jZDyLD_2.css">
10
+ <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BSJRynxp.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/device-url-actions-_s-UgHa3.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/Checkbox-BmlrSRF8.js">
13
+ <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-CtqEPPN5.css">
14
14
  <link rel="stylesheet" href="/brand-defaults.css">
15
15
  </head>
16
16
  <body>
@@ -7993,6 +7993,9 @@ var deprecationLogged = /* @__PURE__ */ new Set();
7993
7993
  function hashPin2(pin) {
7994
7994
  return createHash2("sha256").update(pin).digest("hex");
7995
7995
  }
7996
+ function isOnboardingComplete(step) {
7997
+ return step !== null && step >= 9;
7998
+ }
7996
7999
  function readUsersFile2() {
7997
8000
  if (!existsSync12(USERS_FILE)) return null;
7998
8001
  const raw = readFileSync14(USERS_FILE, "utf-8").trim();
@@ -8068,13 +8071,17 @@ async function createAdminSession(accountId, thinkingView, userId, userName, rol
8068
8071
  const cacheKey = fingerprintSessionKey(signedSessionToken);
8069
8072
  registerSession(cacheKey, "admin", accountId, void 0, userId, userName, role);
8070
8073
  if (userId) setWantsPriorConversation(cacheKey);
8071
- let onboardingComplete = true;
8074
+ let onboardingComplete = false;
8075
+ let onboardingStepLog = "unread";
8072
8076
  try {
8073
8077
  const step = await loadOnboardingStep(accountId);
8074
- onboardingComplete = step === null || step >= 9;
8078
+ onboardingComplete = isOnboardingComplete(step);
8079
+ onboardingStepLog = step === null ? "null" : step;
8075
8080
  } catch (err) {
8076
8081
  console.error(`[session] onboarding query failed: ${err instanceof Error ? err.message : String(err)}`);
8082
+ onboardingStepLog = "error";
8077
8083
  }
8084
+ console.log(`[onboarding-gate] session=${cacheKey.slice(0, 8)} accountId=${accountId.slice(0, 8)} step=${onboardingStepLog} complete=${onboardingComplete} phase=create`);
8078
8085
  let businessName;
8079
8086
  try {
8080
8087
  const branding = await fetchBranding(accountId);
@@ -8129,13 +8136,17 @@ app10.get("/", async (c) => {
8129
8136
  }
8130
8137
  const account = resolveAccount();
8131
8138
  const thinkingView = account?.config.thinkingView ?? "default";
8132
- let onboardingComplete = true;
8139
+ let onboardingComplete = false;
8140
+ let onboardingStepLog = "unread";
8133
8141
  try {
8134
8142
  const step = await loadOnboardingStep(accountId);
8135
- onboardingComplete = step === null || step >= 9;
8143
+ onboardingComplete = isOnboardingComplete(step);
8144
+ onboardingStepLog = step === null ? "null" : step;
8136
8145
  } catch (err) {
8137
8146
  console.error(`[session] restore onboarding query failed: ${err instanceof Error ? err.message : String(err)}`);
8147
+ onboardingStepLog = "error";
8138
8148
  }
8149
+ console.log(`[onboarding-gate] session=${cacheKey.slice(0, 8)} accountId=${accountId.slice(0, 8)} step=${onboardingStepLog} complete=${onboardingComplete} phase=restore`);
8139
8150
  let businessName;
8140
8151
  try {
8141
8152
  const branding = await fetchBranding(accountId);
@@ -9432,6 +9443,53 @@ app21.put("/:id/label", requireAdminSession, async (c) => {
9432
9443
  });
9433
9444
  var sessions_default = app21;
9434
9445
 
9446
+ // app/lib/claude-agent/onboarding-prompt.ts
9447
+ var eligibleForInjection = /* @__PURE__ */ new Set();
9448
+ function markEligibleForInjection(managerSessionId) {
9449
+ eligibleForInjection.add(managerSessionId);
9450
+ }
9451
+ function consumeInjectionSlot(managerSessionId) {
9452
+ return eligibleForInjection.delete(managerSessionId);
9453
+ }
9454
+ async function buildOnboardingPromptBlock(accountId) {
9455
+ const step = await loadOnboardingStep(accountId);
9456
+ const accountIdShort = accountId.slice(0, 8);
9457
+ if (step === null) {
9458
+ const block2 = renderUnreachableBlock();
9459
+ console.log(`[onboarding-inject] graph-unreachable accountId=${accountIdShort}`);
9460
+ return { injected: true, block: block2, step: "graph-unreachable" };
9461
+ }
9462
+ if (step === 9) {
9463
+ console.log(`[onboarding-inject] agent=admin accountId=${accountIdShort} step=9 injected=false`);
9464
+ return { injected: false, reason: "complete" };
9465
+ }
9466
+ if (step === -1) {
9467
+ const block2 = renderIncompleteBlock(-1);
9468
+ console.log(`[onboarding-inject] agent=admin accountId=${accountIdShort} step=missing injected=true`);
9469
+ return { injected: true, block: block2, step: "missing" };
9470
+ }
9471
+ const block = renderIncompleteBlock(step);
9472
+ console.log(`[onboarding-inject] agent=admin accountId=${accountIdShort} step=${step} injected=true`);
9473
+ return { injected: true, block, step };
9474
+ }
9475
+ function renderIncompleteBlock(currentStep) {
9476
+ const stepAttr = currentStep < 0 ? "missing" : String(currentStep);
9477
+ return [
9478
+ `<onboarding-state currentStep="${stepAttr}">`,
9479
+ `This is a fresh ${currentStep < 0 ? "install" : "session"} with onboarding incomplete. Before responding to the operator, call the \`skill-load\` tool with \`skillName=onboarding\` and follow that skill's instructions to drive the 9-step admin onboarding flow from step ${currentStep < 0 ? 0 : currentStep + 1}. Do not greet, do not summarise; render the next step's component as the skill directs.`,
9480
+ `</onboarding-state>`,
9481
+ ""
9482
+ ].join("\n");
9483
+ }
9484
+ function renderUnreachableBlock() {
9485
+ return [
9486
+ `<onboarding-state currentStep="unknown" graphUnreachable="true">`,
9487
+ `Neo4j is unreachable, so onboarding state cannot be read. Do not assume onboarding is complete. Tell the operator the graph is unreachable, name the symptom in one line, and stop \u2014 do not improvise an onboarding flow without state, and do not silently skip the step the operator was on.`,
9488
+ `</onboarding-state>`,
9489
+ ""
9490
+ ].join("\n");
9491
+ }
9492
+
9435
9493
  // server/routes/admin/claude-sessions.ts
9436
9494
  var TAG19 = "[claude-session-manager:wrapper]";
9437
9495
  function managerBase() {
@@ -9462,6 +9520,12 @@ app22.post("/", async (c) => {
9462
9520
  return null;
9463
9521
  });
9464
9522
  if (!upstream) return c.json({ error: "manager-unreachable" }, 503);
9523
+ if (upstream.ok) {
9524
+ const buffered = await upstream.clone().json().catch(() => null);
9525
+ if (buffered && typeof buffered.sessionId === "string" && buffered.sessionId) {
9526
+ markEligibleForInjection(buffered.sessionId);
9527
+ }
9528
+ }
9465
9529
  return new Response(upstream.body, { status: upstream.status, headers: upstream.headers });
9466
9530
  });
9467
9531
  app22.get("/", async (c) => {
@@ -9567,13 +9631,34 @@ app22.patch("/:sessionId", async (c) => {
9567
9631
  });
9568
9632
  app22.post("/:sessionId/input", async (c) => {
9569
9633
  const sessionId = c.req.param("sessionId");
9570
- const body = await c.req.text();
9634
+ const rawBody = await c.req.text();
9635
+ let outboundBody = rawBody;
9636
+ const cacheKey = c.get("cacheKey") ?? "";
9637
+ const accountId = getAccountIdForSession(cacheKey);
9638
+ if (accountId && consumeInjectionSlot(sessionId)) {
9639
+ let parsed = null;
9640
+ try {
9641
+ parsed = JSON.parse(rawBody);
9642
+ } catch {
9643
+ parsed = null;
9644
+ }
9645
+ if (parsed && typeof parsed.text === "string") {
9646
+ try {
9647
+ const outcome = await buildOnboardingPromptBlock(accountId);
9648
+ if (outcome.injected) {
9649
+ outboundBody = JSON.stringify({ ...parsed, text: outcome.block + parsed.text });
9650
+ }
9651
+ } catch (err) {
9652
+ console.error(`${TAG19} onboarding-inject failed: ${err instanceof Error ? err.message : String(err)}`);
9653
+ }
9654
+ }
9655
+ }
9571
9656
  const upstream = await fetch(
9572
9657
  `${managerBase()}/${encodeURIComponent(sessionId)}/input`,
9573
9658
  {
9574
9659
  method: "POST",
9575
9660
  headers: { "content-type": "application/json" },
9576
- body
9661
+ body: outboundBody
9577
9662
  }
9578
9663
  ).catch((err) => {
9579
9664
  console.error(`${TAG19} fetch-failed op=input message=${err instanceof Error ? err.message : String(err)}`);