@rubytech/create-maxy 1.0.653 → 1.0.655

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 (135) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/plugins/cloudflare/references/manual-setup.md +1 -1
  3. package/payload/platform/plugins/cloudflare/scripts/_stream-log.sh +33 -18
  4. package/payload/platform/plugins/cloudflare/scripts/list-cf-domains.ts +6 -3
  5. package/payload/platform/plugins/cloudflare/scripts/setup-tunnel.sh +5 -4
  6. package/payload/server/public/assets/{admin-DLp3geZN.js → admin-CVZaji3A.js} +10 -10
  7. package/payload/server/public/assets/{arc-CRqJUbyK.js → arc-BMhgytDB.js} +1 -1
  8. package/payload/server/public/assets/architecture-YZFGNWBL-S9-oeq_x.js +1 -0
  9. package/payload/server/public/assets/{architectureDiagram-Q4EWVU46-DtICG195.js → architectureDiagram-Q4EWVU46-BePoi8XC.js} +1 -1
  10. package/payload/server/public/assets/{blockDiagram-DXYQGD6D-nw1V7I38.js → blockDiagram-DXYQGD6D-BkiwLTtq.js} +1 -1
  11. package/payload/server/public/assets/{c4Diagram-AHTNJAMY-C1eEC43O.js → c4Diagram-AHTNJAMY-bpjPj2Ln.js} +1 -1
  12. package/payload/server/public/assets/channel-D3U0_a1j.js +1 -0
  13. package/payload/server/public/assets/{chunk-2KRD3SAO-Bybqj-wj.js → chunk-2KRD3SAO-ZcHg_orY.js} +1 -1
  14. package/payload/server/public/assets/{chunk-336JU56O-Dszn2qEY.js → chunk-336JU56O-BpATJiGl.js} +2 -2
  15. package/payload/server/public/assets/chunk-426QAEUC-Wz6Bpsil.js +1 -0
  16. package/payload/server/public/assets/{chunk-4BX2VUAB-DrKtrnWH.js → chunk-4BX2VUAB-zJekz2NU.js} +1 -1
  17. package/payload/server/public/assets/{chunk-4TB4RGXK-CBFzVYqS.js → chunk-4TB4RGXK-CLXL19Wd.js} +1 -1
  18. package/payload/server/public/assets/{chunk-55IACEB6-BNsOFSNf.js → chunk-55IACEB6-CzqB8aoU.js} +1 -1
  19. package/payload/server/public/assets/{chunk-5FUZZQ4R-CXZykYh_.js → chunk-5FUZZQ4R-BoTfWHuW.js} +1 -1
  20. package/payload/server/public/assets/{chunk-5PVQY5BW-CLNppenz.js → chunk-5PVQY5BW-RhIfPCRB.js} +1 -1
  21. package/payload/server/public/assets/{chunk-67CJDMHE-DFyE0-n0.js → chunk-67CJDMHE-mM1sFmlz.js} +1 -1
  22. package/payload/server/public/assets/{chunk-7N4EOEYR-BIKZD1_4.js → chunk-7N4EOEYR-GUck0jv1.js} +1 -1
  23. package/payload/server/public/assets/{chunk-AA7GKIK3-D4_g24le.js → chunk-AA7GKIK3-BYhfUc1V.js} +1 -1
  24. package/payload/server/public/assets/{chunk-BSJP7CBP-Cd9H-V61.js → chunk-BSJP7CBP-CTsYuARh.js} +1 -1
  25. package/payload/server/public/assets/{chunk-CIAEETIT-CAU9PIQi.js → chunk-CIAEETIT-CGsGmUze.js} +1 -1
  26. package/payload/server/public/assets/{chunk-EDXVE4YY-CR1JfOwe.js → chunk-EDXVE4YY-utELKGQK.js} +1 -1
  27. package/payload/server/public/assets/{chunk-ENJZ2VHE-CuXW3Isg.js → chunk-ENJZ2VHE-CNHjq5xK.js} +1 -1
  28. package/payload/server/public/assets/{chunk-FMBD7UC4-BwGAtkIr.js → chunk-FMBD7UC4-DaRrfk3s.js} +1 -1
  29. package/payload/server/public/assets/{chunk-FOC6F5B3-Cn0552qP.js → chunk-FOC6F5B3-BaeLcJVt.js} +1 -1
  30. package/payload/server/public/assets/{chunk-ICPOFSXX-DEZT2XyQ.js → chunk-ICPOFSXX-Di63NBur.js} +2 -2
  31. package/payload/server/public/assets/{chunk-K5T4RW27-KwBFTzJ9.js → chunk-K5T4RW27-CTTOezMH.js} +1 -1
  32. package/payload/server/public/assets/{chunk-KGLVRYIC-1-3y582Z.js → chunk-KGLVRYIC-DCkohKP2.js} +1 -1
  33. package/payload/server/public/assets/{chunk-LIHQZDEY-DXIBsDHL.js → chunk-LIHQZDEY-osQO30uB.js} +1 -1
  34. package/payload/server/public/assets/{chunk-ORNJ4GCN-CRbOike7.js → chunk-ORNJ4GCN-DoLajOOe.js} +1 -1
  35. package/payload/server/public/assets/{chunk-OYMX7WX6-CVT9itnY.js → chunk-OYMX7WX6-BSPzqyxs.js} +1 -1
  36. package/payload/server/public/assets/chunk-QZHKN3VN-BAQp1OEl.js +1 -0
  37. package/payload/server/public/assets/{chunk-U2HBQHQK-BLgNHWFf.js → chunk-U2HBQHQK-BZnA7c4T.js} +1 -1
  38. package/payload/server/public/assets/{chunk-X2U36JSP-DHYLiYqc.js → chunk-X2U36JSP-DpQ2OA_c.js} +1 -1
  39. package/payload/server/public/assets/{chunk-XPW4576I-DBdiQ3Zy.js → chunk-XPW4576I-BccP1mlQ.js} +1 -1
  40. package/payload/server/public/assets/{chunk-YZCP3GAM-DXaosB5Z.js → chunk-YZCP3GAM-BAkNXu0G.js} +1 -1
  41. package/payload/server/public/assets/{chunk-ZZ45TVLE-B5dCmOpH.js → chunk-ZZ45TVLE-DBSm41oP.js} +1 -1
  42. package/payload/server/public/assets/classDiagram-6PBFFD2Q-6EGGLDD_.js +1 -0
  43. package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-DfAV4tgE.js +1 -0
  44. package/payload/server/public/assets/clone-BoV8noAi.js +1 -0
  45. package/payload/server/public/assets/{cose-bilkent-S5V4N54A-DaHtPQvk.js → cose-bilkent-S5V4N54A-Boeb8aWs.js} +1 -1
  46. package/payload/server/public/assets/{dagre-KV5264BT-CAL9V_HR.js → dagre-KV5264BT-BkvWofSp.js} +1 -1
  47. package/payload/server/public/assets/{dagre-N8C5Xujx.js → dagre-nvPNAunb.js} +1 -1
  48. package/payload/server/public/assets/data-DgI19qYm.js +1 -0
  49. package/payload/server/public/assets/{diagram-5BDNPKRD-pzBSPqlM.js → diagram-5BDNPKRD-CMEgyt4E.js} +1 -1
  50. package/payload/server/public/assets/{diagram-G4DWMVQ6-DStdLqos.js → diagram-G4DWMVQ6-ChorrAF0.js} +1 -1
  51. package/payload/server/public/assets/{diagram-MMDJMWI5-D-SfeX-6.js → diagram-MMDJMWI5-D_iD27po.js} +1 -1
  52. package/payload/server/public/assets/{diagram-TYMM5635-Cdr1DQ84.js → diagram-TYMM5635-8qXI1ioG.js} +1 -1
  53. package/payload/server/public/assets/{erDiagram-SMLLAGMA-CIg1dDZT.js → erDiagram-SMLLAGMA-BFjtKDSB.js} +1 -1
  54. package/payload/server/public/assets/{file-Buaz89w8.js → file-J1JpJF4E.js} +1 -1
  55. package/payload/server/public/assets/{flatten-CpKIi5d2.js → flatten-ya0TqRLc.js} +1 -1
  56. package/payload/server/public/assets/{flowDiagram-DWJPFMVM-CJtU1T6d.js → flowDiagram-DWJPFMVM-Bpd7IL9l.js} +1 -1
  57. package/payload/server/public/assets/{ganttDiagram-T4ZO3ILL-R4fuRAT1.js → ganttDiagram-T4ZO3ILL-CwOozU85.js} +1 -1
  58. package/payload/server/public/assets/gitGraph-7Q5UKJZL-BOC4CldZ.js +1 -0
  59. package/payload/server/public/assets/{gitGraphDiagram-UUTBAWPF-sifugSGn.js → gitGraphDiagram-UUTBAWPF-CcPILiC9.js} +1 -1
  60. package/payload/server/public/assets/{graph-B_TxtKJP.js → graph-CFwxUVS0.js} +19 -19
  61. package/payload/server/public/assets/{graphlib-DrlxPM8j.js → graphlib-B_mcXEVr.js} +1 -1
  62. package/payload/server/public/assets/{house-B5wS-2kc.js → house-Dche6_m0.js} +1 -1
  63. package/payload/server/public/assets/info-OMHHGYJF-BSCPTUIx.js +1 -0
  64. package/payload/server/public/assets/infoDiagram-42DDH7IO-T2sn--WJ.js +2 -0
  65. package/payload/server/public/assets/{isEmpty-C3Vxk1It.js → isEmpty-h-wRi_o9.js} +1 -1
  66. package/payload/server/public/assets/{ishikawaDiagram-UXIWVN3A-CYUJOA2c.js → ishikawaDiagram-UXIWVN3A-DOP9-Q8H.js} +1 -1
  67. package/payload/server/public/assets/{journeyDiagram-VCZTEJTY-UltrLajs.js → journeyDiagram-VCZTEJTY-DGATg0WC.js} +1 -1
  68. package/payload/server/public/assets/{jsx-runtime-WYScGBOd.js → jsx-runtime-BE1CBORz.js} +1 -1
  69. package/payload/server/public/assets/{jsx-runtime-ChVPhhAG.css → jsx-runtime-C7zbe_Pq.css} +1 -1
  70. package/payload/server/public/assets/{kanban-definition-6JOO6SKY-BBaThtP3.js → kanban-definition-6JOO6SKY-C5PigmKg.js} +1 -1
  71. package/payload/server/public/assets/{line-BhOwLD_o.js → line-DlKKhwkO.js} +1 -1
  72. package/payload/server/public/assets/{linear-D76hoLvZ.js → linear-DD4JiB1l.js} +1 -1
  73. package/payload/server/public/assets/{mermaid-parser.core-D8n5xV7A.js → mermaid-parser.core-C8xGCa9p.js} +2 -2
  74. package/payload/server/public/assets/{mermaid.core-C3TZA9fX.js → mermaid.core-CCUSwZB_.js} +3 -3
  75. package/payload/server/public/assets/{mindmap-definition-QFDTVHPH-Bv1kghvk.js → mindmap-definition-QFDTVHPH-75k-IVhC.js} +1 -1
  76. package/payload/server/public/assets/{ordinal-BLrOss5K.js → ordinal-Dwxksj1B.js} +1 -1
  77. package/payload/server/public/assets/packet-4T2RLAQJ-pBa_ZhNI.js +1 -0
  78. package/payload/server/public/assets/pie-ZZUOXDRM-BzYOyiMb.js +1 -0
  79. package/payload/server/public/assets/{pieDiagram-DEJITSTG-BSYldcKa.js → pieDiagram-DEJITSTG-DN5RsDwZ.js} +1 -1
  80. package/payload/server/public/assets/public-LhnMTdDE.js +5 -0
  81. package/payload/server/public/assets/{quadrantDiagram-34T5L4WZ-lCDshgz1.js → quadrantDiagram-34T5L4WZ-Sd9x6pNe.js} +1 -1
  82. package/payload/server/public/assets/radar-PYXPWWZC-CTVOaAq6.js +1 -0
  83. package/payload/server/public/assets/{reduce-C5tBOlxC.js → reduce-BUuWaDl2.js} +1 -1
  84. package/payload/server/public/assets/{requirementDiagram-MS252O5E-C7j42RrO.js → requirementDiagram-MS252O5E-BDgifYzj.js} +1 -1
  85. package/payload/server/public/assets/{sankeyDiagram-XADWPNL6-plPbHhuF.js → sankeyDiagram-XADWPNL6-BX9VULNJ.js} +1 -1
  86. package/payload/server/public/assets/{sequenceDiagram-FGHM5R23-D3Y8MXiX.js → sequenceDiagram-FGHM5R23-z3vMxhgE.js} +1 -1
  87. package/payload/server/public/assets/{share-2-Z5v9aWZ2.js → share-2-6hJtFYgM.js} +1 -1
  88. package/payload/server/public/assets/{stateDiagram-FHFEXIEX-D4BdhMPy.js → stateDiagram-FHFEXIEX-DlP0hBxF.js} +1 -1
  89. package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-DSddQStC.js +1 -0
  90. package/payload/server/public/assets/{timeline-definition-GMOUNBTQ-Lh9jrYCl.js → timeline-definition-GMOUNBTQ-DwQbhKCo.js} +1 -1
  91. package/payload/server/public/assets/treeView-SZITEDCU-OTnF4Qzw.js +1 -0
  92. package/payload/server/public/assets/treemap-W4RFUUIX-DlIRmHFb.js +1 -0
  93. package/payload/server/public/assets/{useVoiceRecorder-CgMo3FDt.js → useVoiceRecorder-PUde6itK.js} +4 -4
  94. package/payload/server/public/assets/{vennDiagram-DHZGUBPP-Cx0v19iv.js → vennDiagram-DHZGUBPP-WTqmZWWa.js} +1 -1
  95. package/payload/server/public/assets/wardley-RL74JXVD-DwMXAC4U.js +1 -0
  96. package/payload/server/public/assets/{wardleyDiagram-NUSXRM2D-BYewCTre.js → wardleyDiagram-NUSXRM2D-BUY50x5T.js} +1 -1
  97. package/payload/server/public/assets/x-DmqRGGHj.js +1 -0
  98. package/payload/server/public/assets/{xychartDiagram-5P7HB3ND-CkfIdbJu.js → xychartDiagram-5P7HB3ND-Btdq-fDj.js} +1 -1
  99. package/payload/server/public/data.html +6 -7
  100. package/payload/server/public/graph.html +6 -6
  101. package/payload/server/public/index.html +8 -9
  102. package/payload/server/public/public.html +5 -6
  103. package/payload/server/server.js +402 -104
  104. package/payload/server/public/assets/architecture-YZFGNWBL-CXIHKKCa.js +0 -1
  105. package/payload/server/public/assets/channel-CA7njeKl.js +0 -1
  106. package/payload/server/public/assets/chunk-426QAEUC-tWQOa3-I.js +0 -1
  107. package/payload/server/public/assets/chunk-QZHKN3VN-BwkFBCAY.js +0 -1
  108. package/payload/server/public/assets/classDiagram-6PBFFD2Q-CUZ9BU_6.js +0 -1
  109. package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-BGYsCDux.js +0 -1
  110. package/payload/server/public/assets/clone-BjouONkW.js +0 -1
  111. package/payload/server/public/assets/data-DPqrIvgB.js +0 -1
  112. package/payload/server/public/assets/gitGraph-7Q5UKJZL-tvzbaNdg.js +0 -1
  113. package/payload/server/public/assets/info-OMHHGYJF-ByeBaFw5.js +0 -1
  114. package/payload/server/public/assets/infoDiagram-42DDH7IO-CjgCxerY.js +0 -2
  115. package/payload/server/public/assets/packet-4T2RLAQJ-Csybj5RO.js +0 -1
  116. package/payload/server/public/assets/pie-ZZUOXDRM-Iw1du1Bn.js +0 -1
  117. package/payload/server/public/assets/public-BNEciseE.js +0 -5
  118. package/payload/server/public/assets/radar-PYXPWWZC-rEet4TBV.js +0 -1
  119. package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-DhKxVkX3.js +0 -1
  120. package/payload/server/public/assets/trash-2-BaLFnigq.js +0 -1
  121. package/payload/server/public/assets/treeView-SZITEDCU-PaLYyjtc.js +0 -1
  122. package/payload/server/public/assets/treemap-W4RFUUIX-CEhGYFbO.js +0 -1
  123. package/payload/server/public/assets/wardley-RL74JXVD-xtJ4_o4d.js +0 -1
  124. package/payload/server/public/assets/x-DYxtrMFK.js +0 -1
  125. /package/payload/server/public/assets/{_baseFor-WfS9pKAn.js → _baseFor-Dn4GSmI6.js} +0 -0
  126. /package/payload/server/public/assets/{array-HeX70jSN.js → array-DJN9YAVf.js} +0 -0
  127. /package/payload/server/public/assets/{cytoscape.esm-CDZo0kst.js → cytoscape.esm-BcJTl1re.js} +0 -0
  128. /package/payload/server/public/assets/{defaultLocale-GJwWH1Jr.js → defaultLocale-B4F_XsBB.js} +0 -0
  129. /package/payload/server/public/assets/{dist-BKbAaes5.js → dist-CrzV1W3-.js} +0 -0
  130. /package/payload/server/public/assets/{init-BPLPMQ3Y.js → init-DX0Y1qU4.js} +0 -0
  131. /package/payload/server/public/assets/{katex-CKZ-HWMQ.js → katex-CjHJ1D7d.js} +0 -0
  132. /package/payload/server/public/assets/{path-YdFzr2W6.js → path-7vUsG-o2.js} +0 -0
  133. /package/payload/server/public/assets/{preload-helper-BEFjQwLd.js → preload-helper-qlgyTAkD.js} +0 -0
  134. /package/payload/server/public/assets/{rough.esm-HAx67Hnb.js → rough.esm-NLRoWnq-.js} +0 -0
  135. /package/payload/server/public/assets/{src-BvrHnOMG.js → src-Bo15iQ7w.js} +0 -0
@@ -1201,14 +1201,14 @@ var Hono = class _Hono {
1201
1201
  * app.route("/api", app2) // GET /api/user
1202
1202
  * ```
1203
1203
  */
1204
- route(path2, app30) {
1204
+ route(path2, app31) {
1205
1205
  const subApp = this.basePath(path2);
1206
- app30.routes.map((r) => {
1206
+ app31.routes.map((r) => {
1207
1207
  let handler;
1208
- if (app30.errorHandler === errorHandler) {
1208
+ if (app31.errorHandler === errorHandler) {
1209
1209
  handler = r.handler;
1210
1210
  } else {
1211
- handler = async (c, next) => (await compose([], app30.errorHandler)(c, () => r.handler(c, next))).res;
1211
+ handler = async (c, next) => (await compose([], app31.errorHandler)(c, () => r.handler(c, next))).res;
1212
1212
  handler[COMPOSED_HANDLER] = r.handler;
1213
1213
  }
1214
1214
  subApp.#addRoute(r.method, r.path, handler);
@@ -10867,6 +10867,13 @@ ${block}`;
10867
10867
  }
10868
10868
 
10869
10869
  // server/routes/_helpers.ts
10870
+ async function safeJson(c) {
10871
+ try {
10872
+ return await c.req.json();
10873
+ } catch {
10874
+ return null;
10875
+ }
10876
+ }
10870
10877
  async function resolveSessionKey(c) {
10871
10878
  const fromQuery = c.req.query("session_key");
10872
10879
  if (fromQuery) return fromQuery;
@@ -11323,7 +11330,7 @@ function defaultRules() {
11323
11330
  name: "setup-tunnel.sh failed to persist step-7 completion",
11324
11331
  type: "silent-catch",
11325
11332
  logSource: "any",
11326
- pattern: "\\[setup-tunnel\\] step=onboarding-persist result=error",
11333
+ pattern: "\\[script:setup-tunnel\\] step=onboarding-persist result=error",
11327
11334
  thresholdCount: 0,
11328
11335
  thresholdWindowMinutes: 0,
11329
11336
  suggestedAction: "[Task 562] setup-tunnel.sh could not persist step-7 completion before arming the service restart. Read the `reason` field on the failing phase line: `fs-flag-dir-failed` means `${ACCOUNT_DIR}/onboarding/` is not writable (chmod issue or disk full); `fs-flag-write-failed` means the flag file itself could not be written. Without the flag, the next admin session will re-ask the Cloudflare question the user just answered. Recovery: fix the permission/disk issue, then either re-run `~/setup-tunnel.sh` (the flag-write is idempotent) or call `onboarding-complete-step` with step 7 from the admin chat to mark step 7 complete explicitly."
@@ -18083,7 +18090,7 @@ import * as childProcess from "child_process";
18083
18090
  import { appendFileSync as appendFileSync6, createReadStream as createReadStream2, mkdirSync as mkdirSync12, statSync as statSync8 } from "fs";
18084
18091
  import { dirname as dirname7 } from "path";
18085
18092
  import { StringDecoder as StringDecoder2 } from "string_decoder";
18086
- var SCRIPT_STREAM_RE = /^\[([^\]]+)\] \[([a-z][a-z0-9-]*)((?::[a-z0-9:_-]+)?)\] (.*)$/;
18093
+ var SCRIPT_STREAM_RE = /^\[([^\]]+)\] \[script:([a-z][a-z0-9-]*)((?::[a-z0-9:_-]+)?)\] (.*)$/;
18087
18094
  function parseLine(line) {
18088
18095
  const m = line.match(SCRIPT_STREAM_RE);
18089
18096
  if (!m) return void 0;
@@ -18178,6 +18185,11 @@ function startScriptStreamTailer(opts) {
18178
18185
  }
18179
18186
  var SCOPE_TOKEN_RE = /^[a-z][a-z0-9-]*$/;
18180
18187
  function writeRouteMilestone(streamLogPath, scope, line) {
18188
+ if (scope.startsWith("script:")) {
18189
+ throw new Error(
18190
+ `writeRouteMilestone: scope "${scope}" must not start with "script:" \u2014 the helper prepends it (Task 605)`
18191
+ );
18192
+ }
18181
18193
  if (!SCOPE_TOKEN_RE.test(scope)) {
18182
18194
  throw new Error(
18183
18195
  `writeRouteMilestone: scope "${scope}" must match [a-z][a-z0-9-]* \u2014 the tailer regex won't match otherwise`
@@ -18186,7 +18198,7 @@ function writeRouteMilestone(streamLogPath, scope, line) {
18186
18198
  const ts = (/* @__PURE__ */ new Date()).toISOString();
18187
18199
  try {
18188
18200
  mkdirSync12(dirname7(streamLogPath), { recursive: true });
18189
- appendFileSync6(streamLogPath, `[${ts}] [${scope}] ${line}
18201
+ appendFileSync6(streamLogPath, `[${ts}] [script:${scope}] ${line}
18190
18202
  `);
18191
18203
  } catch (err) {
18192
18204
  console.error(
@@ -20121,13 +20133,18 @@ var GRAPH_LABEL_COLOURS = {
20121
20133
  var ALL_GRAPH_LABELS = Object.freeze(
20122
20134
  Object.keys(GRAPH_LABEL_COLOURS)
20123
20135
  );
20136
+ var HIDDEN_BY_DEFAULT_LABELS = Object.freeze(
20137
+ /* @__PURE__ */ new Set(["Chunk"])
20138
+ );
20124
20139
  function isKnownLabel(label) {
20125
20140
  return Object.prototype.hasOwnProperty.call(GRAPH_LABEL_COLOURS, label);
20126
20141
  }
20142
+ function isHiddenByDefault(label) {
20143
+ return HIDDEN_BY_DEFAULT_LABELS.has(label);
20144
+ }
20127
20145
 
20128
20146
  // server/routes/admin/graph-subgraph.ts
20129
- var DEFAULT_LIMIT2 = 200;
20130
- var MAX_LIMIT2 = 500;
20147
+ var CEILING = 2e3;
20131
20148
  var STRIPPED_PROPERTIES = /* @__PURE__ */ new Set([
20132
20149
  "embedding",
20133
20150
  "passwordHash",
@@ -20143,12 +20160,41 @@ app26.get("/", requireAdminSession, async (c) => {
20143
20160
  console.error('[graph-page] auth-rejected reason="no account for session"');
20144
20161
  return c.json({ error: "Account not found for session" }, 401);
20145
20162
  }
20146
- const rawLimit = c.req.query("limit");
20147
- const parsedLimit = rawLimit ? parseInt(rawLimit, 10) : DEFAULT_LIMIT2;
20148
- const limit = Number.isFinite(parsedLimit) && parsedLimit > 0 ? Math.min(parsedLimit, MAX_LIMIT2) : DEFAULT_LIMIT2;
20149
- const rawLabels = c.req.query("labels");
20150
- const labels = rawLabels ? rawLabels.split(",").map((s) => s.trim()).filter(Boolean) : [];
20163
+ const mode = c.req.query("mode");
20164
+ if (mode !== "default" && mode !== "neighbourhood") {
20165
+ console.error(
20166
+ `[graph-page] load rejected reason=missing-mode account=${accountId} got=${mode ?? "null"}`
20167
+ );
20168
+ return c.json(
20169
+ { error: "mode required: default | neighbourhood" },
20170
+ 400
20171
+ );
20172
+ }
20173
+ if (mode === "default") return handleDefault(c, accountId);
20174
+ return handleNeighbourhood(c, accountId);
20175
+ });
20176
+ async function handleDefault(c, accountId) {
20177
+ const rawLabels = c.req.query("labels") ?? "";
20178
+ const labels = rawLabels.split(",").map((s) => s.trim()).filter(Boolean);
20179
+ if (labels.length === 0) {
20180
+ console.error(
20181
+ `[graph-page] load rejected reason=missing-filter account=${accountId} labels=`
20182
+ );
20183
+ return c.json(
20184
+ { error: "labels required in default mode \u2014 pick at least one node type" },
20185
+ 400
20186
+ );
20187
+ }
20151
20188
  for (const label of labels) {
20189
+ if (isHiddenByDefault(label)) {
20190
+ console.error(
20191
+ `[graph-page] load rejected reason=chunk-label-requested account=${accountId} labels=${labels.join(",")}`
20192
+ );
20193
+ return c.json(
20194
+ { error: `label "${label}" is hidden by default \u2014 it cannot be requested via mode=default` },
20195
+ 400
20196
+ );
20197
+ }
20152
20198
  if (!isKnownLabel(label)) {
20153
20199
  return c.json(
20154
20200
  { error: `unknown label "${label}" \u2014 not registered in graph-labels.ts` },
@@ -20159,18 +20205,78 @@ app26.get("/", requireAdminSession, async (c) => {
20159
20205
  const started = Date.now();
20160
20206
  const session = getSession();
20161
20207
  try {
20162
- const cypher = labels.length > 0 ? buildCypher(true) : buildCypher(false);
20163
- const params = { accountId, limit };
20164
- if (labels.length > 0) params.labels = labels;
20165
- const result = await session.run(cypher, params);
20208
+ const result = await session.executeRead(async (tx) => {
20209
+ const countResult = await tx.run(DEFAULT_COUNT_CYPHER, { accountId, labels });
20210
+ const matchedRaw = countResult.records[0]?.get("matched");
20211
+ const matched = typeof matchedRaw === "bigint" ? Number(matchedRaw) : Number(matchedRaw ?? 0);
20212
+ if (matched > CEILING) {
20213
+ return { overLimit: true, matched };
20214
+ }
20215
+ const fetchResult = await tx.run(DEFAULT_FETCH_CYPHER, { accountId, labels });
20216
+ const record = fetchResult.records[0];
20217
+ const rawNodes = record?.get("nodes") ?? [];
20218
+ const rawEdges = record?.get("edges") ?? [];
20219
+ return { overLimit: false, matched, rawNodes, rawEdges };
20220
+ });
20221
+ const elapsed = Date.now() - started;
20222
+ if (result.overLimit) {
20223
+ console.error(
20224
+ `[graph-page] load rejected reason=ceiling-exceeded account=${accountId} labels=${labels.join(",")} matched=${result.matched} ceiling=${CEILING} ms=${elapsed}`
20225
+ );
20226
+ return c.json(
20227
+ {
20228
+ error: `Refine your filter \u2014 ${result.matched} matches exceed the ${CEILING} cap.`,
20229
+ matched: result.matched
20230
+ },
20231
+ 413
20232
+ );
20233
+ }
20234
+ const nodes = result.rawNodes.map(pruneNode);
20235
+ const edges = result.rawEdges.filter((e) => e && e.id != null);
20236
+ console.error(
20237
+ `[graph-page] load mode=default account=${accountId} labels=${labels.join(",")} nodes=${nodes.length} edges=${edges.length} ms=${elapsed}`
20238
+ );
20239
+ return c.json({ nodes, edges });
20240
+ } catch (err) {
20241
+ const elapsed = Date.now() - started;
20242
+ const message = err instanceof Error ? err.message : String(err);
20243
+ console.error(`[graph-page] error stage=fetch reason="${message}" ms=${elapsed}`);
20244
+ return c.json({ error: `Graph data unavailable: ${message}` }, 503);
20245
+ } finally {
20246
+ try {
20247
+ await session.close();
20248
+ } catch {
20249
+ }
20250
+ }
20251
+ }
20252
+ async function handleNeighbourhood(c, accountId) {
20253
+ const elementId = c.req.query("elementId");
20254
+ if (!elementId) {
20255
+ return c.json(
20256
+ { error: "elementId required in neighbourhood mode" },
20257
+ 400
20258
+ );
20259
+ }
20260
+ const started = Date.now();
20261
+ const session = getSession();
20262
+ try {
20263
+ const result = await session.executeRead(async (tx) => {
20264
+ return await tx.run(NEIGHBOURHOOD_CYPHER, { accountId, elementId });
20265
+ });
20166
20266
  const record = result.records[0];
20167
20267
  const rawNodes = record?.get("nodes") ?? [];
20168
20268
  const rawEdges = record?.get("edges") ?? [];
20269
+ const elapsed = Date.now() - started;
20270
+ if (rawNodes.length === 0) {
20271
+ console.error(
20272
+ `[graph-page] load rejected reason=not-found account=${accountId} elementId=${elementId} ms=${elapsed}`
20273
+ );
20274
+ return c.json({ error: "Node not found" }, 404);
20275
+ }
20169
20276
  const nodes = rawNodes.map(pruneNode);
20170
20277
  const edges = rawEdges.filter((e) => e && e.id != null);
20171
- const elapsed = Date.now() - started;
20172
20278
  console.error(
20173
- `[graph-page] load account=${accountId} nodes=${nodes.length} edges=${edges.length} ms=${elapsed}`
20279
+ `[graph-page] load mode=neighbourhood account=${accountId} elementId=${elementId} nodes=${nodes.length} edges=${edges.length} ms=${elapsed}`
20174
20280
  );
20175
20281
  return c.json({ nodes, edges });
20176
20282
  } catch (err) {
@@ -20184,30 +20290,63 @@ app26.get("/", requireAdminSession, async (c) => {
20184
20290
  } catch {
20185
20291
  }
20186
20292
  }
20187
- });
20188
- function buildCypher(filtered) {
20189
- const labelGuard = filtered ? "AND any(lbl IN labels(n) WHERE lbl IN $labels)" : "";
20190
- return `
20191
- MATCH (n)
20192
- WHERE n.accountId = $accountId ${labelGuard}
20193
- WITH n ORDER BY coalesce(n.updatedAt, n.createdAt, '') DESC
20194
- LIMIT toInteger($limit)
20195
- WITH collect(n) AS nodes, collect(elementId(n)) AS nodeIds
20196
- UNWIND nodes AS n
20197
- OPTIONAL MATCH (n)-[r]-(m)
20198
- WHERE elementId(m) IN nodeIds
20199
- WITH nodes,
20200
- collect(DISTINCT CASE WHEN r IS NULL THEN null ELSE {
20201
- id: elementId(r),
20202
- from: elementId(startNode(r)),
20203
- to: elementId(endNode(r)),
20204
- type: type(r)
20205
- } END) AS rawEdges
20206
- RETURN
20207
- [x IN nodes | {id: elementId(x), labels: labels(x), properties: properties(x)}] AS nodes,
20208
- [e IN rawEdges WHERE e IS NOT NULL] AS edges
20209
- `;
20210
20293
  }
20294
+ var DEFAULT_COUNT_CYPHER = `
20295
+ MATCH (n)
20296
+ WHERE n.accountId = $accountId
20297
+ AND any(lbl IN labels(n) WHERE lbl IN $labels)
20298
+ AND NOT n:Trashed
20299
+ AND n.deletedAt IS NULL
20300
+ RETURN count(n) AS matched
20301
+ `;
20302
+ var DEFAULT_FETCH_CYPHER = `
20303
+ MATCH (n)
20304
+ WHERE n.accountId = $accountId
20305
+ AND any(lbl IN labels(n) WHERE lbl IN $labels)
20306
+ AND NOT n:Trashed
20307
+ AND n.deletedAt IS NULL
20308
+ WITH collect(n) AS nodes, collect(elementId(n)) AS nodeIds
20309
+ UNWIND nodes AS n
20310
+ OPTIONAL MATCH (n)-[r]-(m)
20311
+ WHERE elementId(m) IN nodeIds
20312
+ WITH nodes,
20313
+ collect(DISTINCT CASE WHEN r IS NULL THEN null ELSE {
20314
+ id: elementId(r),
20315
+ from: elementId(startNode(r)),
20316
+ to: elementId(endNode(r)),
20317
+ type: type(r)
20318
+ } END) AS rawEdges
20319
+ RETURN
20320
+ [x IN nodes | {id: elementId(x), labels: labels(x), properties: properties(x)}] AS nodes,
20321
+ [e IN rawEdges WHERE e IS NOT NULL] AS edges
20322
+ `;
20323
+ var NEIGHBOURHOOD_CYPHER = `
20324
+ MATCH (n)
20325
+ WHERE elementId(n) = $elementId
20326
+ AND n.accountId = $accountId
20327
+ AND NOT n:Trashed
20328
+ AND n.deletedAt IS NULL
20329
+ OPTIONAL MATCH (n)-[]-(m)
20330
+ WHERE m.accountId = $accountId
20331
+ AND NOT m:Trashed
20332
+ AND m.deletedAt IS NULL
20333
+ WITH n, collect(DISTINCT m) AS neighbours
20334
+ WITH [n] + [x IN neighbours WHERE x IS NOT NULL] AS windowNodes
20335
+ WITH windowNodes, [x IN windowNodes | elementId(x)] AS windowIds
20336
+ UNWIND windowNodes AS w
20337
+ OPTIONAL MATCH (w)-[r]-(o)
20338
+ WHERE elementId(o) IN windowIds
20339
+ WITH windowNodes,
20340
+ collect(DISTINCT CASE WHEN r IS NULL THEN null ELSE {
20341
+ id: elementId(r),
20342
+ from: elementId(startNode(r)),
20343
+ to: elementId(endNode(r)),
20344
+ type: type(r)
20345
+ } END) AS rawEdges
20346
+ RETURN
20347
+ [x IN windowNodes | {id: elementId(x), labels: labels(x), properties: properties(x)}] AS nodes,
20348
+ [e IN rawEdges WHERE e IS NOT NULL] AS edges
20349
+ `;
20211
20350
  function pruneNode(node) {
20212
20351
  const properties = {};
20213
20352
  for (const [key, value] of Object.entries(node.properties ?? {})) {
@@ -20218,9 +20357,167 @@ function pruneNode(node) {
20218
20357
  }
20219
20358
  var graph_subgraph_default = app26;
20220
20359
 
20221
- // server/routes/admin/file-attach.ts
20360
+ // ../lib/graph-trash/src/index.ts
20361
+ var UNIQUE_KEYS_BY_LABEL = {
20362
+ Person: ["email", "telephone"],
20363
+ Service: ["serviceId"],
20364
+ LocalBusiness: ["accountId"],
20365
+ Task: ["taskId"],
20366
+ Event: ["eventId"],
20367
+ KnowledgeDocument: ["attachmentId"],
20368
+ DigitalDocument: ["attachmentId"],
20369
+ Conversation: ["conversationId", "sessionKey"],
20370
+ Message: ["messageId"],
20371
+ OnboardingState: ["accountId"],
20372
+ Workflow: ["workflowId"],
20373
+ WorkflowStep: ["stepId"],
20374
+ WorkflowRun: ["runId"],
20375
+ Preference: ["preferenceId"],
20376
+ Email: ["emailId", "messageId"],
20377
+ AdminUser: ["userId"],
20378
+ ToolCall: ["callId"],
20379
+ // Composite component nulls — frees the composite constraint:
20380
+ AccessGrant: ["contactValue"],
20381
+ // composite (contactValue, agentSlug, accountId)
20382
+ UserProfile: ["userId"]
20383
+ // composite (accountId, userId)
20384
+ };
20385
+ async function trashNode(params) {
20386
+ const { session, accountId, elementId, by, reason } = params;
20387
+ const lookup = await session.run(
20388
+ `MATCH (n) WHERE elementId(n) = $eid AND n.accountId = $accountId
20389
+ RETURN labels(n) AS labels, properties(n) AS props`,
20390
+ { eid: elementId, accountId }
20391
+ );
20392
+ if (lookup.records.length === 0) {
20393
+ throw new Error(
20394
+ `trashNode: node not found (elementId=${elementId} accountId=${accountId.slice(0, 8)}\u2026)`
20395
+ );
20396
+ }
20397
+ const allLabels = lookup.records[0].get("labels");
20398
+ const props = lookup.records[0].get("props");
20399
+ const baseLabels = allLabels.filter((l) => l !== "Trashed");
20400
+ if (allLabels.includes("Trashed")) {
20401
+ return {
20402
+ trashed: false,
20403
+ alreadyTrashed: true,
20404
+ nodeId: elementId,
20405
+ labels: baseLabels,
20406
+ trashedAt: String(props.trashedAt ?? ""),
20407
+ originalKeys: {}
20408
+ };
20409
+ }
20410
+ const uniqueKeys = /* @__PURE__ */ new Set();
20411
+ for (const label of baseLabels) {
20412
+ for (const key of UNIQUE_KEYS_BY_LABEL[label] ?? []) uniqueKeys.add(key);
20413
+ }
20414
+ const originalKeys = {};
20415
+ for (const k of uniqueKeys) {
20416
+ if (props[k] !== void 0 && props[k] !== null) originalKeys[k] = props[k];
20417
+ }
20418
+ const setNullClauses = Object.keys(originalKeys).map((k) => `n.\`${k}\` = null`).join(", ");
20419
+ const setNullSuffix = setNullClauses ? `, ${setNullClauses}` : "";
20420
+ const trashedAt = (/* @__PURE__ */ new Date()).toISOString();
20421
+ await session.run(
20422
+ `MATCH (n) WHERE elementId(n) = $eid
20423
+ SET n:Trashed,
20424
+ n.trashedAt = datetime($trashedAt),
20425
+ n.trashedBy = $by,
20426
+ n.trashReason = $reason,
20427
+ n._trashedKeys = $trashedKeysJson${setNullSuffix}`,
20428
+ {
20429
+ eid: elementId,
20430
+ trashedAt,
20431
+ by,
20432
+ reason: reason ?? null,
20433
+ trashedKeysJson: JSON.stringify(originalKeys)
20434
+ }
20435
+ );
20436
+ process.stderr.write(
20437
+ `[trash:marked] accountId=${accountId} elementId=${elementId} labels=${baseLabels.join(",")} by=${by} reason=${reason ?? "null"}
20438
+ `
20439
+ );
20440
+ return {
20441
+ trashed: true,
20442
+ alreadyTrashed: false,
20443
+ nodeId: elementId,
20444
+ labels: baseLabels,
20445
+ trashedAt,
20446
+ originalKeys
20447
+ };
20448
+ }
20449
+
20450
+ // server/routes/admin/graph-delete.ts
20222
20451
  var app27 = new Hono2();
20223
- app27.post("/", async (c) => {
20452
+ app27.post("/", requireAdminSession, async (c) => {
20453
+ const sessionKey = c.var.sessionKey;
20454
+ const accountId = getAccountIdForSession(sessionKey);
20455
+ if (!accountId) {
20456
+ console.error('[graph-page] delete auth-rejected reason="no account for session"');
20457
+ return c.json({ error: "Account not found for session" }, 401);
20458
+ }
20459
+ const body = await safeJson(c);
20460
+ if (!body) {
20461
+ return c.json({ error: "JSON body required" }, 400);
20462
+ }
20463
+ const elementId = typeof body.elementId === "string" ? body.elementId.trim() : "";
20464
+ if (!elementId) {
20465
+ return c.json({ error: "elementId required" }, 400);
20466
+ }
20467
+ const started = Date.now();
20468
+ const session = getSession();
20469
+ try {
20470
+ const lookup = await session.run(
20471
+ `MATCH (n)
20472
+ WHERE elementId(n) = $elementId AND n.accountId = $accountId
20473
+ RETURN labels(n) AS labels LIMIT 1`,
20474
+ { elementId, accountId }
20475
+ );
20476
+ if (lookup.records.length === 0) {
20477
+ const elapsed2 = Date.now() - started;
20478
+ console.error(
20479
+ `[graph-page] delete account=${accountId} elementId=${elementId} labels= result=not-found ms=${elapsed2}`
20480
+ );
20481
+ return c.json({ error: "Node not found" }, 404);
20482
+ }
20483
+ const preflightLabels = lookup.records[0].get("labels") ?? [];
20484
+ const result = await trashNode({
20485
+ session,
20486
+ accountId,
20487
+ elementId,
20488
+ by: "graph-page"
20489
+ });
20490
+ const elapsed = Date.now() - started;
20491
+ const labelSummary = (result.labels.length > 0 ? result.labels : preflightLabels).join(",");
20492
+ console.error(
20493
+ `[graph-page] delete account=${accountId} elementId=${elementId} labels=${labelSummary} result=ok ms=${elapsed}`
20494
+ );
20495
+ const response = {
20496
+ elementId: result.nodeId,
20497
+ labels: result.labels.length > 0 ? result.labels : preflightLabels,
20498
+ trashedAt: result.trashedAt,
20499
+ alreadyTrashed: result.alreadyTrashed
20500
+ };
20501
+ return c.json(response);
20502
+ } catch (err) {
20503
+ const elapsed = Date.now() - started;
20504
+ const message = err instanceof Error ? err.message : String(err);
20505
+ console.error(
20506
+ `[graph-page] delete account=${accountId} elementId=${elementId} labels= result=error ms=${elapsed} err="${message}"`
20507
+ );
20508
+ return c.json({ error: `Delete failed: ${message}` }, 503);
20509
+ } finally {
20510
+ try {
20511
+ await session.close();
20512
+ } catch {
20513
+ }
20514
+ }
20515
+ });
20516
+ var graph_delete_default = app27;
20517
+
20518
+ // server/routes/admin/file-attach.ts
20519
+ var app28 = new Hono2();
20520
+ app28.post("/", async (c) => {
20224
20521
  try {
20225
20522
  const body = await c.req.json();
20226
20523
  const { filePath, accountId } = body;
@@ -20243,29 +20540,30 @@ app27.post("/", async (c) => {
20243
20540
  return c.json({ error: message }, 500);
20244
20541
  }
20245
20542
  });
20246
- var file_attach_default = app27;
20543
+ var file_attach_default = app28;
20247
20544
 
20248
20545
  // server/routes/admin/index.ts
20249
- var app28 = new Hono2();
20250
- app28.route("/session", session_default2);
20251
- app28.route("/chat", chat_default2);
20252
- app28.route("/compact", compact_default);
20253
- app28.route("/logs", logs_default);
20254
- app28.route("/claude-info", claude_info_default);
20255
- app28.route("/attachment", attachment_default);
20256
- app28.route("/account", account_default);
20257
- app28.route("/agents", agents_default);
20258
- app28.route("/version", version_default);
20259
- app28.route("/sessions", sessions_default);
20260
- app28.route("/browser", browser_default);
20261
- app28.route("/device-browser", device_browser_default);
20262
- app28.route("/events", events_default);
20263
- app28.route("/cloudflare", cloudflare_default);
20264
- app28.route("/files", files_default);
20265
- app28.route("/graph-search", graph_search_default);
20266
- app28.route("/graph-subgraph", graph_subgraph_default);
20267
- app28.route("/file-attach", file_attach_default);
20268
- var admin_default = app28;
20546
+ var app29 = new Hono2();
20547
+ app29.route("/session", session_default2);
20548
+ app29.route("/chat", chat_default2);
20549
+ app29.route("/compact", compact_default);
20550
+ app29.route("/logs", logs_default);
20551
+ app29.route("/claude-info", claude_info_default);
20552
+ app29.route("/attachment", attachment_default);
20553
+ app29.route("/account", account_default);
20554
+ app29.route("/agents", agents_default);
20555
+ app29.route("/version", version_default);
20556
+ app29.route("/sessions", sessions_default);
20557
+ app29.route("/browser", browser_default);
20558
+ app29.route("/device-browser", device_browser_default);
20559
+ app29.route("/events", events_default);
20560
+ app29.route("/cloudflare", cloudflare_default);
20561
+ app29.route("/files", files_default);
20562
+ app29.route("/graph-search", graph_search_default);
20563
+ app29.route("/graph-subgraph", graph_subgraph_default);
20564
+ app29.route("/graph-delete", graph_delete_default);
20565
+ app29.route("/file-attach", file_attach_default);
20566
+ var admin_default = app29;
20269
20567
 
20270
20568
  // server/index.ts
20271
20569
  var PLATFORM_ROOT11 = process.env.MAXY_PLATFORM_ROOT || "";
@@ -20323,9 +20621,9 @@ watchFile(ALIAS_DOMAINS_PATH2, { interval: 2e3 }, () => {
20323
20621
  function isPublicHost(host) {
20324
20622
  return host.startsWith("public.") || aliasDomains.has(host);
20325
20623
  }
20326
- var app29 = new Hono2();
20327
- app29.use("*", clientIpMiddleware);
20328
- app29.use("*", async (c, next) => {
20624
+ var app30 = new Hono2();
20625
+ app30.use("*", clientIpMiddleware);
20626
+ app30.use("*", async (c, next) => {
20329
20627
  await next();
20330
20628
  c.header("X-Content-Type-Options", "nosniff");
20331
20629
  c.header("Referrer-Policy", "strict-origin-when-cross-origin");
@@ -20348,7 +20646,7 @@ var PUBLIC_ALLOWED_PREFIXES = [
20348
20646
  "/g/"
20349
20647
  ];
20350
20648
  var PUBLIC_ALLOWED_EXACT = ["/favicon.ico"];
20351
- app29.use("*", async (c, next) => {
20649
+ app30.use("*", async (c, next) => {
20352
20650
  const host = (c.req.header("host") ?? "").split(":")[0];
20353
20651
  if (!isPublicHost(host)) {
20354
20652
  await next();
@@ -20388,7 +20686,7 @@ function resolveRemoteAuthOpts() {
20388
20686
  return brandLoginOpts;
20389
20687
  }
20390
20688
  var MAX_LOGIN_BODY = 8 * 1024;
20391
- app29.post("/__remote-auth/login", async (c) => {
20689
+ app30.post("/__remote-auth/login", async (c) => {
20392
20690
  const clientIp = c.var.clientIp || "unknown";
20393
20691
  const rateLimited = checkRateLimit(clientIp);
20394
20692
  if (rateLimited) {
@@ -20424,7 +20722,7 @@ app29.post("/__remote-auth/login", async (c) => {
20424
20722
  }
20425
20723
  });
20426
20724
  });
20427
- app29.get("/__remote-auth/logout", (c) => {
20725
+ app30.get("/__remote-auth/logout", (c) => {
20428
20726
  const cookieHeader = c.req.header("cookie");
20429
20727
  const token = parseCookie(cookieHeader, "__remote_session");
20430
20728
  if (token) invalidateRemoteSession(token);
@@ -20437,7 +20735,7 @@ app29.get("/__remote-auth/logout", (c) => {
20437
20735
  }
20438
20736
  });
20439
20737
  });
20440
- app29.post("/__remote-auth/change-password", async (c) => {
20738
+ app30.post("/__remote-auth/change-password", async (c) => {
20441
20739
  const clientIp = c.var.clientIp || "unknown";
20442
20740
  const rateLimited = checkRateLimit(clientIp);
20443
20741
  if (rateLimited) {
@@ -20486,13 +20784,13 @@ app29.post("/__remote-auth/change-password", async (c) => {
20486
20784
  return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(), mode: "change", changeError: "Failed to save password", redirect }), 200);
20487
20785
  }
20488
20786
  });
20489
- app29.get("/__remote-auth/setup", (c) => {
20787
+ app30.get("/__remote-auth/setup", (c) => {
20490
20788
  if (isRemoteAuthConfigured()) {
20491
20789
  return c.redirect("/");
20492
20790
  }
20493
20791
  return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(), mode: "setup" }), 200);
20494
20792
  });
20495
- app29.post("/__remote-auth/set-initial-password", async (c) => {
20793
+ app30.post("/__remote-auth/set-initial-password", async (c) => {
20496
20794
  if (isRemoteAuthConfigured()) {
20497
20795
  return c.redirect("/");
20498
20796
  }
@@ -20528,10 +20826,10 @@ app29.post("/__remote-auth/set-initial-password", async (c) => {
20528
20826
  return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(), mode: "setup", setupError: "Failed to save password. Please try again." }), 200);
20529
20827
  }
20530
20828
  });
20531
- app29.get("/api/remote-auth/status", (c) => {
20829
+ app30.get("/api/remote-auth/status", (c) => {
20532
20830
  return c.json({ configured: isRemoteAuthConfigured() });
20533
20831
  });
20534
- app29.post("/api/remote-auth/set-password", async (c) => {
20832
+ app30.post("/api/remote-auth/set-password", async (c) => {
20535
20833
  let body;
20536
20834
  try {
20537
20835
  body = await c.req.json();
@@ -20561,9 +20859,9 @@ app29.post("/api/remote-auth/set-password", async (c) => {
20561
20859
  return c.json({ error: "Failed to save password" }, 500);
20562
20860
  }
20563
20861
  });
20564
- app29.route("/api/_client-error", client_error_default);
20862
+ app30.route("/api/_client-error", client_error_default);
20565
20863
  console.log("[client-error-route] mounted");
20566
- app29.use("*", async (c, next) => {
20864
+ app30.use("*", async (c, next) => {
20567
20865
  const host = (c.req.header("host") ?? "").split(":")[0];
20568
20866
  const path2 = c.req.path;
20569
20867
  if (path2 === "/favicon.ico" || path2.startsWith("/assets/") || path2.startsWith("/brand/")) {
@@ -20603,15 +20901,15 @@ function parseCookie(cookieHeader, name) {
20603
20901
  return null;
20604
20902
  }
20605
20903
  }
20606
- app29.route("/api/health", health_default);
20607
- app29.route("/api/session", session_default);
20608
- app29.route("/api/chat", chat_default);
20609
- app29.route("/api/group", group_default);
20610
- app29.route("/api/access", access_default);
20611
- app29.route("/api/telegram", telegram_default);
20612
- app29.route("/api/whatsapp", whatsapp_default);
20613
- app29.route("/api/onboarding", onboarding_default);
20614
- app29.route("/api/admin", admin_default);
20904
+ app30.route("/api/health", health_default);
20905
+ app30.route("/api/session", session_default);
20906
+ app30.route("/api/chat", chat_default);
20907
+ app30.route("/api/group", group_default);
20908
+ app30.route("/api/access", access_default);
20909
+ app30.route("/api/telegram", telegram_default);
20910
+ app30.route("/api/whatsapp", whatsapp_default);
20911
+ app30.route("/api/onboarding", onboarding_default);
20912
+ app30.route("/api/admin", admin_default);
20615
20913
  var SAFE_SLUG_RE = /^[a-z][a-z0-9-]{2,49}$/;
20616
20914
  var SAFE_FILENAME_RE = /^[a-z0-9_][a-z0-9_.-]{0,99}$/i;
20617
20915
  var IMAGE_MIME = {
@@ -20623,7 +20921,7 @@ var IMAGE_MIME = {
20623
20921
  ".svg": "image/svg+xml",
20624
20922
  ".ico": "image/x-icon"
20625
20923
  };
20626
- app29.get("/agent-assets/:slug/:filename", (c) => {
20924
+ app30.get("/agent-assets/:slug/:filename", (c) => {
20627
20925
  const slug = c.req.param("slug");
20628
20926
  const filename = c.req.param("filename");
20629
20927
  if (!SAFE_SLUG_RE.test(slug)) {
@@ -20658,7 +20956,7 @@ app29.get("/agent-assets/:slug/:filename", (c) => {
20658
20956
  "Cache-Control": "public, max-age=3600"
20659
20957
  });
20660
20958
  });
20661
- app29.get("/generated/:filename", (c) => {
20959
+ app30.get("/generated/:filename", (c) => {
20662
20960
  const filename = c.req.param("filename");
20663
20961
  if (!SAFE_FILENAME_RE.test(filename) || filename.includes("..")) {
20664
20962
  console.error(`[generated] serve file=${filename} status=403`);
@@ -20823,7 +21121,7 @@ function brandedPublicHtml(agentSlug) {
20823
21121
  function escapeHtml2(s) {
20824
21122
  return s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
20825
21123
  }
20826
- app29.get("/", (c) => {
21124
+ app30.get("/", (c) => {
20827
21125
  const host = (c.req.header("host") ?? "").split(":")[0];
20828
21126
  if (isPublicHost(host)) {
20829
21127
  const defaultSlug = resolveDefaultSlug();
@@ -20831,12 +21129,12 @@ app29.get("/", (c) => {
20831
21129
  }
20832
21130
  return c.html(cachedHtml("index.html"));
20833
21131
  });
20834
- app29.get("/public", (c) => {
21132
+ app30.get("/public", (c) => {
20835
21133
  const host = (c.req.header("host") ?? "").split(":")[0];
20836
21134
  if (isPublicHost(host)) return c.text("Not found", 404);
20837
21135
  return c.html(cachedHtml("public.html"));
20838
21136
  });
20839
- app29.get("/chat", (c) => {
21137
+ app30.get("/chat", (c) => {
20840
21138
  const host = (c.req.header("host") ?? "").split(":")[0];
20841
21139
  if (isPublicHost(host)) return c.text("Not found", 404);
20842
21140
  return c.html(cachedHtml("public.html"));
@@ -20855,9 +21153,9 @@ async function logViewerFetch(c, next) {
20855
21153
  duration_ms: Date.now() - start
20856
21154
  });
20857
21155
  }
20858
- app29.use("/vnc-viewer.html", logViewerFetch);
20859
- app29.use("/vnc-popout.html", logViewerFetch);
20860
- app29.get("/vnc-popout.html", (c) => {
21156
+ app30.use("/vnc-viewer.html", logViewerFetch);
21157
+ app30.use("/vnc-popout.html", logViewerFetch);
21158
+ app30.get("/vnc-popout.html", (c) => {
20861
21159
  let html = htmlCache.get("vnc-popout.html");
20862
21160
  if (!html) {
20863
21161
  html = readFileSync25(resolve29(process.cwd(), "public", "vnc-popout.html"), "utf-8");
@@ -20870,7 +21168,7 @@ app29.get("/vnc-popout.html", (c) => {
20870
21168
  }
20871
21169
  return c.html(html);
20872
21170
  });
20873
- app29.post("/api/vnc/client-event", async (c) => {
21171
+ app30.post("/api/vnc/client-event", async (c) => {
20874
21172
  let body;
20875
21173
  try {
20876
21174
  body = await c.req.json();
@@ -20891,20 +21189,20 @@ app29.post("/api/vnc/client-event", async (c) => {
20891
21189
  });
20892
21190
  return c.json({ ok: true });
20893
21191
  });
20894
- app29.get("/g/:slug", (c) => {
21192
+ app30.get("/g/:slug", (c) => {
20895
21193
  return c.html(brandedPublicHtml());
20896
21194
  });
20897
- app29.get("/graph", (c) => {
21195
+ app30.get("/graph", (c) => {
20898
21196
  const host = (c.req.header("host") ?? "").split(":")[0];
20899
21197
  if (isPublicHost(host)) return c.text("Not found", 404);
20900
21198
  return c.html(cachedHtml("graph.html"));
20901
21199
  });
20902
- app29.get("/data", (c) => {
21200
+ app30.get("/data", (c) => {
20903
21201
  const host = (c.req.header("host") ?? "").split(":")[0];
20904
21202
  if (isPublicHost(host)) return c.text("Not found", 404);
20905
21203
  return c.html(cachedHtml("data.html"));
20906
21204
  });
20907
- app29.get("/:slug", async (c, next) => {
21205
+ app30.get("/:slug", async (c, next) => {
20908
21206
  const slug = c.req.param("slug");
20909
21207
  if (AGENT_SLUG_PATTERN.test(`/${slug}`)) {
20910
21208
  const branding = loadBrandingCache(slug);
@@ -20913,10 +21211,10 @@ app29.get("/:slug", async (c, next) => {
20913
21211
  }
20914
21212
  await next();
20915
21213
  });
20916
- app29.use("/*", serveStatic({ root: "./public" }));
21214
+ app30.use("/*", serveStatic({ root: "./public" }));
20917
21215
  var port = parseInt(process.env.PORT ?? "19200", 10);
20918
21216
  var hostname = process.env.HOSTNAME ?? "0.0.0.0";
20919
- var httpServer = serve({ fetch: app29.fetch, port, hostname });
21217
+ var httpServer = serve({ fetch: app30.fetch, port, hostname });
20920
21218
  attachVncWsProxy(httpServer, {
20921
21219
  isPublicHost,
20922
21220
  upstreamHost: "127.0.0.1",
@@ -20962,7 +21260,7 @@ for (const m of SUBAPP_MANIFEST) {
20962
21260
  }
20963
21261
  try {
20964
21262
  const registered = [];
20965
- for (const r of app29.routes ?? []) {
21263
+ for (const r of app30.routes ?? []) {
20966
21264
  if (typeof r.path !== "string" || r.path.includes(":") || r.path.includes("*")) continue;
20967
21265
  if (AGENT_SLUG_PATTERN.test(r.path)) {
20968
21266
  registered.push({ method: (r.method ?? "ALL").toUpperCase(), path: r.path });