@rubytech/create-maxy-code 0.1.299 → 0.1.301
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.
- package/package.json +1 -1
- package/payload/platform/plugins/admin/PLUGIN.md +10 -10
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +84 -84
- package/payload/platform/plugins/admin/skills/public-agent-manager/SKILL.md +4 -4
- package/payload/platform/plugins/aeo/PLUGIN.md +1 -1
- package/payload/platform/plugins/business-assistant/skills/e-sign/SKILL.md +4 -4
- package/payload/platform/plugins/cloudflare/references/manual-setup.md +43 -22
- package/payload/platform/plugins/cloudflare/references/reset-guide.md +19 -1
- package/payload/platform/plugins/cloudflare/skills/cloudflare/SKILL.md +19 -3
- package/payload/platform/plugins/contacts/PLUGIN.md +1 -1
- package/payload/platform/plugins/docs/references/admin-identity-gate.md +6 -6
- package/payload/platform/plugins/docs/references/admin-session.md +15 -15
- package/payload/platform/plugins/docs/references/admin-ui.md +18 -18
- package/payload/platform/plugins/docs/references/aeo.md +1 -1
- package/payload/platform/plugins/docs/references/deployment.md +3 -3
- package/payload/platform/plugins/docs/references/internals.md +28 -28
- package/payload/platform/plugins/docs/references/platform.md +21 -21
- package/payload/platform/plugins/docs/references/plugins-guide.md +3 -3
- package/payload/platform/plugins/docs/references/troubleshooting.md +6 -6
- package/payload/platform/plugins/docs/references/visitor-graph.md +3 -3
- package/payload/platform/plugins/email/PLUGIN.md +2 -2
- package/payload/platform/plugins/email/references/email-reference.md +2 -2
- package/payload/platform/plugins/linkedin-import/skills/linkedin-import/SKILL.md +2 -2
- package/payload/platform/plugins/memory/.claude-plugin/plugin.json +1 -1
- package/payload/platform/plugins/memory/PLUGIN.md +9 -9
- package/payload/platform/plugins/memory/references/graph-primitives.md +2 -2
- package/payload/platform/plugins/memory/references/schema-base.md +14 -14
- package/payload/platform/plugins/memory/references/transcript-formats/circleback.md +1 -1
- package/payload/platform/plugins/memory/references/transcript-formats/otter.md +1 -1
- package/payload/platform/plugins/memory/skills/conversation-archive/SKILL.md +6 -6
- package/payload/platform/plugins/memory/skills/conversation-archive-enrich/SKILL.md +1 -1
- package/payload/platform/plugins/memory/skills/conversation-archive-mcp/SKILL.md +8 -8
- package/payload/platform/plugins/memory/skills/document-ingest/SKILL.md +5 -5
- package/payload/platform/plugins/obsidian-import/skills/obsidian-import/references/daily-notes.md +1 -1
- package/payload/platform/plugins/prompt-optimiser/skills/prompt-optimiser/SKILL.md +1 -1
- package/payload/platform/plugins/slides/PROVENANCE.md +1 -1
- package/payload/platform/plugins/substack-import/skills/substack-import/SKILL.md +1 -1
- package/payload/platform/plugins/telegram/PLUGIN.md +1 -1
- package/payload/platform/plugins/url-get/PLUGIN.md +2 -2
- package/payload/platform/plugins/whatsapp/.claude-plugin/plugin.json +1 -1
- package/payload/platform/plugins/whatsapp/PLUGIN.md +5 -5
- package/payload/platform/plugins/whatsapp/references/channels-whatsapp.md +5 -5
- package/payload/platform/plugins/whatsapp/skills/manage-whatsapp-config/SKILL.md +1 -1
- package/payload/platform/plugins/workflows/PLUGIN.md +1 -1
- package/payload/platform/plugins/x-import/PLUGIN.md +2 -2
- package/payload/platform/plugins/x-import/skills/x-import/SKILL.md +1 -1
- package/payload/platform/scripts/__tests__/check-no-task-id-leaks.test.sh +125 -0
- package/payload/platform/scripts/__tests__/resume-tunnel.test.sh +253 -0
- package/payload/platform/scripts/check-no-esm-require.mjs +4 -0
- package/payload/platform/scripts/check-no-task-id-leaks.mjs +54 -6
- package/payload/platform/scripts/resume-tunnel.sh +89 -5
- package/payload/platform/services/whatsapp-channel/dist/notification.d.ts +14 -0
- package/payload/platform/services/whatsapp-channel/dist/notification.d.ts.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/notification.js +11 -0
- package/payload/platform/services/whatsapp-channel/dist/notification.js.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/server.d.ts +4 -0
- package/payload/platform/services/whatsapp-channel/dist/server.d.ts.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/server.js +54 -3
- package/payload/platform/services/whatsapp-channel/dist/server.js.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/turn-follow.d.ts +18 -0
- package/payload/platform/services/whatsapp-channel/dist/turn-follow.d.ts.map +1 -0
- package/payload/platform/services/whatsapp-channel/dist/turn-follow.js +137 -0
- package/payload/platform/services/whatsapp-channel/dist/turn-follow.js.map +1 -0
- package/payload/platform/templates/specialists/agents/database-operator.md +1 -1
- package/payload/platform/templates/specialists/agents/librarian.md +2 -2
- package/payload/server/{chunk-7H4KMTMC.js → chunk-JHSF5VPE.js} +171 -95
- package/payload/server/maxy-edge.js +19 -1
- package/payload/server/public/assets/AdminShell-BJrxifYa.js +1 -0
- package/payload/server/public/assets/{Checkbox-DHnspkuk.js → Checkbox-C7bBRzLP.js} +1 -1
- package/payload/server/public/assets/{Transcript-9FlneAzM.js → Transcript-bGy_Gx99.js} +1 -1
- package/payload/server/public/assets/admin-jYKA7jR5.js +1 -0
- package/payload/server/public/assets/{arc-CPOhuw1V.js → arc-DxSm8tli.js} +1 -1
- package/payload/server/public/assets/architecture-YZFGNWBL-6g9jRVgc.js +1 -0
- package/payload/server/public/assets/{architectureDiagram-Q4EWVU46-BaR37f-j.js → architectureDiagram-Q4EWVU46-7JSAh0vL.js} +1 -1
- package/payload/server/public/assets/audio-attachment-mime-DL5R1M2A.js +30 -0
- package/payload/server/public/assets/{blockDiagram-DXYQGD6D-Du7NMQfQ.js → blockDiagram-DXYQGD6D-DLoVmHKD.js} +1 -1
- package/payload/server/public/assets/{browser--bCCzvRh.js → browser-7fyPCFWB.js} +1 -1
- package/payload/server/public/assets/{c4Diagram-AHTNJAMY-F3GnFLbs.js → c4Diagram-AHTNJAMY-Nv1G0o9P.js} +1 -1
- package/payload/server/public/assets/channel-BgQLJanG.js +1 -0
- package/payload/server/public/assets/chat-UF9ATDwe.js +1 -0
- package/payload/server/public/assets/{chunk-2KRD3SAO-SUv9UlAA.js → chunk-2KRD3SAO-BpqPMhoA.js} +1 -1
- package/payload/server/public/assets/chunk-336JU56O-DgXHlVU_.js +2 -0
- package/payload/server/public/assets/chunk-426QAEUC-Dr_XVuUq.js +1 -0
- package/payload/server/public/assets/{chunk-4BX2VUAB-D5iKMyHO.js → chunk-4BX2VUAB-nwyZSZH8.js} +1 -1
- package/payload/server/public/assets/{chunk-4TB4RGXK-BahbQ7-Z.js → chunk-4TB4RGXK-Tfxz9LHX.js} +1 -1
- package/payload/server/public/assets/{chunk-55IACEB6-DfF9myIx.js → chunk-55IACEB6-6FMJQGXG.js} +1 -1
- package/payload/server/public/assets/{chunk-5FUZZQ4R-jF6a9UVe.js → chunk-5FUZZQ4R-g2FgZF3D.js} +1 -1
- package/payload/server/public/assets/{chunk-5PVQY5BW-BOCI-roy.js → chunk-5PVQY5BW-DtLwXsPH.js} +1 -1
- package/payload/server/public/assets/{chunk-67CJDMHE-E5wGK0dP.js → chunk-67CJDMHE-K91CP5ZU.js} +1 -1
- package/payload/server/public/assets/{chunk-7N4EOEYR-CtT0GsUT.js → chunk-7N4EOEYR-BGpCQhqK.js} +1 -1
- package/payload/server/public/assets/{chunk-AA7GKIK3-CGUj8eo-.js → chunk-AA7GKIK3-jkDbInck.js} +1 -1
- package/payload/server/public/assets/{chunk-BSJP7CBP-OPAIjvSk.js → chunk-BSJP7CBP-mDosdzGs.js} +1 -1
- package/payload/server/public/assets/{chunk-CIAEETIT-S_D8FhIT.js → chunk-CIAEETIT-DhBxewpQ.js} +1 -1
- package/payload/server/public/assets/{chunk-EDXVE4YY-CkD4AyZi.js → chunk-EDXVE4YY-B7c-9Emg.js} +1 -1
- package/payload/server/public/assets/{chunk-ENJZ2VHE-CmoK-c5f.js → chunk-ENJZ2VHE-Cqhhncox.js} +1 -1
- package/payload/server/public/assets/{chunk-FMBD7UC4-DcyogdNf.js → chunk-FMBD7UC4-BpDq6wj1.js} +1 -1
- package/payload/server/public/assets/{chunk-FOC6F5B3-8iNobZdv.js → chunk-FOC6F5B3-Ds02-ktu.js} +1 -1
- package/payload/server/public/assets/{chunk-ICPOFSXX-DeGZE9pw.js → chunk-ICPOFSXX-BTX5POFr.js} +2 -2
- package/payload/server/public/assets/{chunk-K5T4RW27-CkoKFdgU.js → chunk-K5T4RW27-Du1PXXBU.js} +1 -1
- package/payload/server/public/assets/{chunk-KGLVRYIC-DyNP1efP.js → chunk-KGLVRYIC-siasOAf8.js} +1 -1
- package/payload/server/public/assets/{chunk-LIHQZDEY-WZPpo5Dd.js → chunk-LIHQZDEY-xf1rbZtf.js} +1 -1
- package/payload/server/public/assets/{chunk-ORNJ4GCN-Cr7E0-Df.js → chunk-ORNJ4GCN-DeTLQ_LD.js} +1 -1
- package/payload/server/public/assets/{chunk-OYMX7WX6-BPjxo1Oc.js → chunk-OYMX7WX6-DQ7_oVJn.js} +1 -1
- package/payload/server/public/assets/chunk-QZHKN3VN-DF4o9HRJ.js +1 -0
- package/payload/server/public/assets/{chunk-U2HBQHQK-CuDS7yVX.js → chunk-U2HBQHQK-CXmFUKgn.js} +1 -1
- package/payload/server/public/assets/{chunk-X2U36JSP-DEkde3xe.js → chunk-X2U36JSP-Bj8-8Wkz.js} +1 -1
- package/payload/server/public/assets/{chunk-XPW4576I-BwRCuKyu.js → chunk-XPW4576I-Con3TXqt.js} +1 -1
- package/payload/server/public/assets/{chunk-YZCP3GAM-DD9nUp-w.js → chunk-YZCP3GAM-Dx8BHGWf.js} +1 -1
- package/payload/server/public/assets/{chunk-ZZ45TVLE-BDH9b11G.js → chunk-ZZ45TVLE-Dp4Q5Y-f.js} +1 -1
- package/payload/server/public/assets/classDiagram-6PBFFD2Q-DAbPKU6u.js +1 -0
- package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-BKuFQLcv.js +1 -0
- package/payload/server/public/assets/clone-DnNHGhNe.js +1 -0
- package/payload/server/public/assets/{cose-bilkent-S5V4N54A-CfeophtW.js → cose-bilkent-S5V4N54A-pZiCv69E.js} +1 -1
- package/payload/server/public/assets/{dagre-CVxEmku2.js → dagre-CLqhEgbL.js} +1 -1
- package/payload/server/public/assets/{dagre-KV5264BT-TOuVLdjq.js → dagre-KV5264BT-BCxE8iyk.js} +1 -1
- package/payload/server/public/assets/{data-B8Waqy4Q.js → data-CIJnkfgX.js} +1 -1
- package/payload/server/public/assets/{diagram-5BDNPKRD-BJQnfJjx.js → diagram-5BDNPKRD-slUEdZzz.js} +1 -1
- package/payload/server/public/assets/{diagram-G4DWMVQ6-CqK94J29.js → diagram-G4DWMVQ6-DPcraMfu.js} +1 -1
- package/payload/server/public/assets/{diagram-MMDJMWI5-BCnATv2X.js → diagram-MMDJMWI5-DR6luhGK.js} +1 -1
- package/payload/server/public/assets/{diagram-TYMM5635-Cl3BUrVs.js → diagram-TYMM5635-Jap1B4wA.js} +1 -1
- package/payload/server/public/assets/{erDiagram-SMLLAGMA--Uw0kvib.js → erDiagram-SMLLAGMA-DJKUs2hO.js} +1 -1
- package/payload/server/public/assets/{file-download-Pk6cNtuB.js → file-download-gth6Gpmn.js} +1 -1
- package/payload/server/public/assets/{flatten-DtM0XAMt.js → flatten-Cl1Bc3dR.js} +1 -1
- package/payload/server/public/assets/{flowDiagram-DWJPFMVM-B_VGZIbJ.js → flowDiagram-DWJPFMVM-C8W-ZZ9W.js} +1 -1
- package/payload/server/public/assets/{ganttDiagram-T4ZO3ILL-D-vdf1dC.js → ganttDiagram-T4ZO3ILL-DYCX4Xu2.js} +1 -1
- package/payload/server/public/assets/gitGraph-7Q5UKJZL-g7mvu6IY.js +1 -0
- package/payload/server/public/assets/{gitGraphDiagram-UUTBAWPF-CpyAlvu3.js → gitGraphDiagram-UUTBAWPF-CZu_fpgS.js} +1 -1
- package/payload/server/public/assets/{graph-D-VQpkaS.js → graph-DHnB3BHK.js} +1 -1
- package/payload/server/public/assets/{graph-labels-cJvlyVxD.js → graph-labels-huk-fKcY.js} +1 -1
- package/payload/server/public/assets/{graphlib-DaV4XyBp.js → graphlib-Bdp7TA4y.js} +1 -1
- package/payload/server/public/assets/info-OMHHGYJF-DZqJuIkB.js +1 -0
- package/payload/server/public/assets/infoDiagram-42DDH7IO-cGfGccHz.js +2 -0
- package/payload/server/public/assets/{isEmpty-D__iH1WQ.js → isEmpty-D1pGOD1J.js} +1 -1
- package/payload/server/public/assets/{ishikawaDiagram-UXIWVN3A-_4NvfwwU.js → ishikawaDiagram-UXIWVN3A-B7KfIX6z.js} +1 -1
- package/payload/server/public/assets/{journeyDiagram-VCZTEJTY-PJQ-tPWv.js → journeyDiagram-VCZTEJTY-CSDwBfhF.js} +1 -1
- package/payload/server/public/assets/jsx-runtime-DZddXDvJ.css +1 -0
- package/payload/server/public/assets/{kanban-definition-6JOO6SKY-asCNlyH4.js → kanban-definition-6JOO6SKY-CWzcEKTr.js} +1 -1
- package/payload/server/public/assets/{line-BSXr2IPU.js → line-BNQSlbYn.js} +1 -1
- package/payload/server/public/assets/{linear-CSAKvvko.js → linear-BN6kGN93.js} +1 -1
- package/payload/server/public/assets/mermaid-parser.core-CcFhkElq.js +4 -0
- package/payload/server/public/assets/mermaid.core-BsIeJ7Cc.js +11 -0
- package/payload/server/public/assets/{mindmap-definition-QFDTVHPH-IxwnMT2Q.js → mindmap-definition-QFDTVHPH-CQVzj6D_.js} +1 -1
- package/payload/server/public/assets/operator-D3QAzlPs.js +1 -0
- package/payload/server/public/assets/{ordinal-BRQ5CzZY.js → ordinal-CBZeH4Yp.js} +1 -1
- package/payload/server/public/assets/packet-4T2RLAQJ-Hn8rlHpy.js +1 -0
- package/payload/server/public/assets/page-86edaOS1.js +1 -0
- package/payload/server/public/assets/pie-ZZUOXDRM-BPGWVqBm.js +1 -0
- package/payload/server/public/assets/{pieDiagram-DEJITSTG-DFqSnPPB.js → pieDiagram-DEJITSTG-DnrQ9fyn.js} +1 -1
- package/payload/server/public/assets/preload-helper-CQ36nxok.js +1 -0
- package/payload/server/public/assets/public-B4LqL6lA.js +6 -0
- package/payload/server/public/assets/{quadrantDiagram-34T5L4WZ-1AB3hlEb.js → quadrantDiagram-34T5L4WZ-BQWlCyWi.js} +1 -1
- package/payload/server/public/assets/radar-PYXPWWZC-DMdLrj3E.js +1 -0
- package/payload/server/public/assets/{reduce-CkcXOmmJ.js → reduce-PuPlFPRX.js} +1 -1
- package/payload/server/public/assets/{requirementDiagram-MS252O5E-C2Zpzq3l.js → requirementDiagram-MS252O5E-Du_vZhU1.js} +1 -1
- package/payload/server/public/assets/{sankeyDiagram-XADWPNL6-DkmhPhwS.js → sankeyDiagram-XADWPNL6-Cf6Z8GPQ.js} +1 -1
- package/payload/server/public/assets/{sequenceDiagram-FGHM5R23-1hQLpeZ1.js → sequenceDiagram-FGHM5R23-CS8GVol8.js} +1 -1
- package/payload/server/public/assets/{stateDiagram-FHFEXIEX-CBHIwm3f.js → stateDiagram-FHFEXIEX-Bv1NW2F1.js} +1 -1
- package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-BGUCxPmp.js +1 -0
- package/payload/server/public/assets/{timeline-definition-GMOUNBTQ-CLRWWipW.js → timeline-definition-GMOUNBTQ-ClGYAsr0.js} +1 -1
- package/payload/server/public/assets/treeView-SZITEDCU-CWxofUbI.js +1 -0
- package/payload/server/public/assets/treemap-W4RFUUIX-Cfgb_ZG0.js +1 -0
- package/payload/server/public/assets/{useSelectionMode-6fff2UIV.js → useSelectionMode-lrH0qwAR.js} +1 -1
- package/payload/server/public/assets/{vennDiagram-DHZGUBPP-ByFoQMek.js → vennDiagram-DHZGUBPP-C2wTcxQT.js} +1 -1
- package/payload/server/public/assets/wardley-RL74JXVD-B45olYjj.js +1 -0
- package/payload/server/public/assets/{wardleyDiagram-NUSXRM2D-DIkXRSha.js → wardleyDiagram-NUSXRM2D-D86-ivEx.js} +1 -1
- package/payload/server/public/assets/{xychartDiagram-5P7HB3ND-BNdEcN73.js → xychartDiagram-5P7HB3ND-Ba5WAN8P.js} +1 -1
- package/payload/server/public/browser.html +6 -6
- package/payload/server/public/chat.html +9 -8
- package/payload/server/public/data.html +5 -5
- package/payload/server/public/graph.html +8 -8
- package/payload/server/public/index.html +9 -9
- package/payload/server/public/operator.html +9 -9
- package/payload/server/public/public.html +7 -6
- package/payload/server/server.js +164 -124
- package/payload/server/public/assets/AdminShell-Eo1RXZxq.js +0 -1
- package/payload/server/public/assets/admin-ORJGvOqo.js +0 -1
- package/payload/server/public/assets/architecture-YZFGNWBL-CQHotPO2.js +0 -1
- package/payload/server/public/assets/audio-attachment-mime-CFRERhV0.js +0 -1
- package/payload/server/public/assets/channel-DfO_IgSU.js +0 -1
- package/payload/server/public/assets/chat-DIrzZjdO.js +0 -1
- package/payload/server/public/assets/chunk-336JU56O-DHUrM3QG.js +0 -2
- package/payload/server/public/assets/chunk-426QAEUC-CBo-Lx7X.js +0 -1
- package/payload/server/public/assets/chunk-QZHKN3VN-CNlL2tiW.js +0 -1
- package/payload/server/public/assets/classDiagram-6PBFFD2Q-Bo-iLGpk.js +0 -1
- package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-Bz7DNpvQ.js +0 -1
- package/payload/server/public/assets/clone-Bh_bM_44.js +0 -1
- package/payload/server/public/assets/gitGraph-7Q5UKJZL-Ds2hoRX4.js +0 -1
- package/payload/server/public/assets/info-OMHHGYJF-BuX4gDTt.js +0 -1
- package/payload/server/public/assets/infoDiagram-42DDH7IO-pcFw8-8F.js +0 -2
- package/payload/server/public/assets/jsx-runtime-BjFkEGXb.css +0 -1
- package/payload/server/public/assets/mermaid-parser.core-DFxv-h16.js +0 -4
- package/payload/server/public/assets/mermaid.core-Be34BFtA.js +0 -11
- package/payload/server/public/assets/operator-DyLRFmNE.js +0 -1
- package/payload/server/public/assets/packet-4T2RLAQJ-9qQ2zAJ3.js +0 -1
- package/payload/server/public/assets/page-CFgywgGE.js +0 -1
- package/payload/server/public/assets/pie-ZZUOXDRM-aDbmozld.js +0 -1
- package/payload/server/public/assets/public-_pD6yEQ6.js +0 -35
- package/payload/server/public/assets/radar-PYXPWWZC-CEm-iLey.js +0 -1
- package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-DHGLsXgi.js +0 -1
- package/payload/server/public/assets/treeView-SZITEDCU-DYa2gPJa.js +0 -1
- package/payload/server/public/assets/treemap-W4RFUUIX-D816ED1y.js +0 -1
- package/payload/server/public/assets/wardley-RL74JXVD-BniDWDlr.js +0 -1
- /package/payload/server/public/assets/{_baseFor-SRtUHe7G.js → _baseFor-brRjpUOX.js} +0 -0
- /package/payload/server/public/assets/{array-BpsnM-Py.js → array-BGFCBI0e.js} +0 -0
- /package/payload/server/public/assets/{cytoscape.esm-D4Rl1H5h.js → cytoscape.esm-TvRJ2tGX.js} +0 -0
- /package/payload/server/public/assets/{defaultLocale-C7sQPl-O.js → defaultLocale-CRZydyG6.js} +0 -0
- /package/payload/server/public/assets/{dist-BXJR8AkG.js → dist-Dbh7HrZX.js} +0 -0
- /package/payload/server/public/assets/{init-BydxaDEV.js → init-B8gtcn7T.js} +0 -0
- /package/payload/server/public/assets/{jsx-runtime-B54kfC3e.js → jsx-runtime-CMu8uN0-.js} +0 -0
- /package/payload/server/public/assets/{katex-B0fVeDx4.js → katex-RxgSu_dy.js} +0 -0
- /package/payload/server/public/assets/{path-jlWYQ2i9.js → path-DZF-JdEe.js} +0 -0
- /package/payload/server/public/assets/{rough.esm-c4PR5shF.js → rough.esm-6CnTHTkH.js} +0 -0
- /package/payload/server/public/assets/{src-CPkr6SrY.js → src-BoaldmnP.js} +0 -0
package/payload/server/server.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
ACCOUNTS_DIR,
|
|
4
|
+
AGENT_SLUG_PATTERN,
|
|
4
5
|
BIN_DIR,
|
|
5
6
|
BRAND_NAME,
|
|
6
7
|
CDP_PORT,
|
|
@@ -15,6 +16,8 @@ import {
|
|
|
15
16
|
LOG_DIR,
|
|
16
17
|
MAXY_DIR,
|
|
17
18
|
PLATFORM_ROOT,
|
|
19
|
+
PUBLIC_ALLOWED_EXACT,
|
|
20
|
+
PUBLIC_ALLOWED_PREFIXES,
|
|
18
21
|
RFB_PORT,
|
|
19
22
|
SYSTEM_PATH_SLUGS,
|
|
20
23
|
USERS_FILE,
|
|
@@ -26,6 +29,7 @@ import {
|
|
|
26
29
|
canAccessAdmin,
|
|
27
30
|
checkGroupMembership,
|
|
28
31
|
checkRateLimit,
|
|
32
|
+
classifyHost,
|
|
29
33
|
cleanupLeakedPremiumSubs,
|
|
30
34
|
clearRateLimit,
|
|
31
35
|
clientIpMiddleware,
|
|
@@ -45,6 +49,7 @@ import {
|
|
|
45
49
|
getConversationClaudeSessionIds,
|
|
46
50
|
getDefaultAccountId,
|
|
47
51
|
getGroupParticipants,
|
|
52
|
+
getOperatorDomains,
|
|
48
53
|
getRecentMessages,
|
|
49
54
|
getRoleForSession,
|
|
50
55
|
getSession,
|
|
@@ -55,7 +60,9 @@ import {
|
|
|
55
60
|
getUserTimezone,
|
|
56
61
|
httpLog,
|
|
57
62
|
isActiveAgentSlug,
|
|
63
|
+
isOperatorHost,
|
|
58
64
|
isPasswordValid,
|
|
65
|
+
isPublicPathAllowed,
|
|
59
66
|
isRemoteAuthConfigured,
|
|
60
67
|
linkConversationTranscript,
|
|
61
68
|
listAdminSessions,
|
|
@@ -97,7 +104,7 @@ import {
|
|
|
97
104
|
vncLog,
|
|
98
105
|
walkPremiumBundles,
|
|
99
106
|
writeAdminUserAndPerson
|
|
100
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-JHSF5VPE.js";
|
|
101
108
|
import {
|
|
102
109
|
__commonJS,
|
|
103
110
|
__toESM
|
|
@@ -1214,40 +1221,11 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
1214
1221
|
};
|
|
1215
1222
|
|
|
1216
1223
|
// server/index.ts
|
|
1217
|
-
import { readFileSync as readFileSync26, existsSync as
|
|
1224
|
+
import { readFileSync as readFileSync26, existsSync as existsSync27, watchFile } from "fs";
|
|
1218
1225
|
import { resolve as resolve29, join as join22, basename as basename8 } from "path";
|
|
1219
1226
|
import { homedir as homedir3 } from "os";
|
|
1220
1227
|
import { monitorEventLoopDelay } from "perf_hooks";
|
|
1221
1228
|
|
|
1222
|
-
// app/lib/agent-slug-pattern.ts
|
|
1223
|
-
var AGENT_SLUG_PATTERN = /^\/([a-z][a-z0-9-]{2,49})$/;
|
|
1224
|
-
|
|
1225
|
-
// server/public-host-gate.ts
|
|
1226
|
-
var PUBLIC_ALLOWED_PREFIXES = [
|
|
1227
|
-
"/api/session",
|
|
1228
|
-
"/api/chat",
|
|
1229
|
-
"/api/access/",
|
|
1230
|
-
"/api/health",
|
|
1231
|
-
"/api/group/",
|
|
1232
|
-
"/api/telegram/",
|
|
1233
|
-
"/assets/",
|
|
1234
|
-
"/brand/",
|
|
1235
|
-
"/agent-assets/",
|
|
1236
|
-
"/generated/",
|
|
1237
|
-
"/g/",
|
|
1238
|
-
"/sites/"
|
|
1239
|
-
];
|
|
1240
|
-
var PUBLIC_ALLOWED_EXACT = ["/favicon.ico", "/brand-defaults.css"];
|
|
1241
|
-
function isPublicPathAllowed(path2) {
|
|
1242
|
-
if (path2 === "/") return true;
|
|
1243
|
-
if (PUBLIC_ALLOWED_EXACT.includes(path2)) return true;
|
|
1244
|
-
if (PUBLIC_ALLOWED_PREFIXES.some((prefix) => path2.startsWith(prefix))) return true;
|
|
1245
|
-
return AGENT_SLUG_PATTERN.test(path2);
|
|
1246
|
-
}
|
|
1247
|
-
function isOperatorHost(host) {
|
|
1248
|
-
return host.startsWith("operator.");
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
1229
|
// server/webchat-descriptor.ts
|
|
1252
1230
|
import { resolve, join as join2 } from "path";
|
|
1253
1231
|
function webchatGatewayUrl() {
|
|
@@ -7732,7 +7710,7 @@ var whatsapp_reader_default = app5;
|
|
|
7732
7710
|
// server/routes/webchat.ts
|
|
7733
7711
|
import { basename as basename3, dirname as dirname2 } from "path";
|
|
7734
7712
|
import { join as join11 } from "path";
|
|
7735
|
-
import { readFileSync as readFileSync11, renameSync, writeFileSync as writeFileSync5 } from "fs";
|
|
7713
|
+
import { existsSync as existsSync8, readdirSync as readdirSync7, readFileSync as readFileSync11, renameSync, writeFileSync as writeFileSync5 } from "fs";
|
|
7736
7714
|
var WEBCHAT_ADMIN_KEY = "webchat-admin";
|
|
7737
7715
|
var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
7738
7716
|
function locateSession(sessionId) {
|
|
@@ -7747,6 +7725,27 @@ function locateSession(sessionId) {
|
|
|
7747
7725
|
}
|
|
7748
7726
|
return { projectDir: null, channel: null };
|
|
7749
7727
|
}
|
|
7728
|
+
function locateSidecar(sessionId) {
|
|
7729
|
+
const cfg = claudeConfigDir();
|
|
7730
|
+
if (!cfg) return null;
|
|
7731
|
+
const projectsRoot = join11(cfg, "projects");
|
|
7732
|
+
let slugs;
|
|
7733
|
+
try {
|
|
7734
|
+
slugs = readdirSync7(projectsRoot, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
|
|
7735
|
+
} catch {
|
|
7736
|
+
return null;
|
|
7737
|
+
}
|
|
7738
|
+
for (const slug of slugs) {
|
|
7739
|
+
const metaPath = join11(projectsRoot, slug, `${sessionId}.meta.json`);
|
|
7740
|
+
if (existsSync8(metaPath)) {
|
|
7741
|
+
return { channel: readSidecarMeta(metaPath).channel };
|
|
7742
|
+
}
|
|
7743
|
+
}
|
|
7744
|
+
return null;
|
|
7745
|
+
}
|
|
7746
|
+
function sessionSidecarExists(sessionId) {
|
|
7747
|
+
return locateSidecar(sessionId) !== null;
|
|
7748
|
+
}
|
|
7750
7749
|
function conflictingBinding(channel) {
|
|
7751
7750
|
return channel !== null && channel !== "webchat" ? channel : null;
|
|
7752
7751
|
}
|
|
@@ -7875,9 +7874,14 @@ function createWebchatRoutes(deps) {
|
|
|
7875
7874
|
let deliveryKey = WEBCHAT_ADMIN_KEY;
|
|
7876
7875
|
let deliverySessionId;
|
|
7877
7876
|
if (target !== void 0) {
|
|
7878
|
-
|
|
7877
|
+
let { projectDir, channel } = locateSession(target);
|
|
7879
7878
|
if (projectDir === null) {
|
|
7880
|
-
|
|
7879
|
+
const sidecar = locateSidecar(target);
|
|
7880
|
+
if (sidecar === null) {
|
|
7881
|
+
console.error(`[webchat:inbound] op=send-refused key=session:${target.slice(0, 8)} reason=session-not-found`);
|
|
7882
|
+
return c.json({ error: "session not found" }, 404);
|
|
7883
|
+
}
|
|
7884
|
+
channel = sidecar.channel;
|
|
7881
7885
|
}
|
|
7882
7886
|
const binding = conflictingBinding(channel);
|
|
7883
7887
|
if (binding !== null) {
|
|
@@ -8006,8 +8010,9 @@ ${note}` : note;
|
|
|
8006
8010
|
return c.json({ error: "invalid session id" }, 400);
|
|
8007
8011
|
}
|
|
8008
8012
|
const { projectDir: projectDir2, channel } = locateSession(target);
|
|
8013
|
+
const known = projectDir2 !== null || sessionSidecarExists(target);
|
|
8009
8014
|
const indicators2 = await fetchComposerIndicators(target);
|
|
8010
|
-
return c.json({ sessionId: target, projectDir: projectDir2, channelBinding: conflictingBinding(channel), ...indicators2 });
|
|
8015
|
+
return c.json({ sessionId: target, projectDir: projectDir2, channelBinding: conflictingBinding(channel), known, ...indicators2 });
|
|
8011
8016
|
}
|
|
8012
8017
|
const sessionId = adminSessionIdFor(accountId, WEBCHAT_ADMIN_KEY);
|
|
8013
8018
|
const cfg = claudeConfigDir();
|
|
@@ -8030,7 +8035,7 @@ ${note}` : note;
|
|
|
8030
8035
|
import { resolve as resolve11 } from "path";
|
|
8031
8036
|
|
|
8032
8037
|
// app/lib/claude-agent/specialist-roster.ts
|
|
8033
|
-
import { existsSync as
|
|
8038
|
+
import { existsSync as existsSync9, readFileSync as readFileSync12, readdirSync as readdirSync8 } from "fs";
|
|
8034
8039
|
import { join as join12 } from "path";
|
|
8035
8040
|
function field(fm, name) {
|
|
8036
8041
|
const m = fm.match(new RegExp(`^${name}:\\s*(.*?)\\r?$`, "m"));
|
|
@@ -8042,8 +8047,8 @@ function field(fm, name) {
|
|
|
8042
8047
|
return value || null;
|
|
8043
8048
|
}
|
|
8044
8049
|
function readSpecialistRoster(specialistsDir) {
|
|
8045
|
-
if (!
|
|
8046
|
-
const entries =
|
|
8050
|
+
if (!existsSync9(specialistsDir)) return { specialists: [], skipped: [] };
|
|
8051
|
+
const entries = readdirSync8(specialistsDir);
|
|
8047
8052
|
const specialists = [];
|
|
8048
8053
|
const skipped = [];
|
|
8049
8054
|
for (const file of entries.sort()) {
|
|
@@ -8168,7 +8173,7 @@ var webchat_greeting_default = app6;
|
|
|
8168
8173
|
// server/routes/telegram.ts
|
|
8169
8174
|
import { homedir } from "os";
|
|
8170
8175
|
import { resolve as resolve12, join as join13 } from "path";
|
|
8171
|
-
import { existsSync as
|
|
8176
|
+
import { existsSync as existsSync10, readFileSync as readFileSync13 } from "fs";
|
|
8172
8177
|
|
|
8173
8178
|
// app/lib/telegram/access-control.ts
|
|
8174
8179
|
function checkTelegramAccess(params) {
|
|
@@ -8220,7 +8225,7 @@ var DISPATCH_TIMEOUT_MS = 12e4;
|
|
|
8220
8225
|
function configDirName() {
|
|
8221
8226
|
const platformRoot2 = process.env.MAXY_PLATFORM_ROOT ?? resolve12(process.cwd(), "..");
|
|
8222
8227
|
const brandPath = join13(platformRoot2, "config", "brand.json");
|
|
8223
|
-
if (
|
|
8228
|
+
if (existsSync10(brandPath)) {
|
|
8224
8229
|
try {
|
|
8225
8230
|
return JSON.parse(readFileSync13(brandPath, "utf-8")).configDir ?? ".maxy";
|
|
8226
8231
|
} catch {
|
|
@@ -8254,7 +8259,7 @@ app7.post("/", async (c) => {
|
|
|
8254
8259
|
return c.json({ ok: false }, 400);
|
|
8255
8260
|
}
|
|
8256
8261
|
const sp = secretPath(botType);
|
|
8257
|
-
if (!
|
|
8262
|
+
if (!existsSync10(sp)) {
|
|
8258
8263
|
console.error(`${TAG22} op=reject reason=no-secret-file botType=${botType}`);
|
|
8259
8264
|
return c.json({ ok: false }, 401);
|
|
8260
8265
|
}
|
|
@@ -8321,11 +8326,11 @@ var telegram_default = app7;
|
|
|
8321
8326
|
|
|
8322
8327
|
// server/routes/onboarding.ts
|
|
8323
8328
|
import { spawn, spawnSync as spawnSync2, execFileSync as execFileSync2 } from "child_process";
|
|
8324
|
-
import { openSync as openSync2, closeSync as closeSync2, writeFileSync as writeFileSync7, writeSync, existsSync as
|
|
8329
|
+
import { openSync as openSync2, closeSync as closeSync2, writeFileSync as writeFileSync7, writeSync, existsSync as existsSync12, readFileSync as readFileSync15, unlinkSync } from "fs";
|
|
8325
8330
|
import { createHash as createHash3, randomUUID as randomUUID7 } from "crypto";
|
|
8326
8331
|
|
|
8327
8332
|
// ../lib/admins-write/src/index.ts
|
|
8328
|
-
import { existsSync as
|
|
8333
|
+
import { existsSync as existsSync11, readFileSync as readFileSync14, writeFileSync as writeFileSync6, renameSync as renameSync2, mkdirSync as mkdirSync2, readdirSync as readdirSync9, statSync as statSync5 } from "fs";
|
|
8329
8334
|
import { dirname as dirname3, join as join14 } from "path";
|
|
8330
8335
|
function logLine(input, result) {
|
|
8331
8336
|
const userIdShort = input.userId.slice(0, 8);
|
|
@@ -8343,7 +8348,7 @@ function writeAdminEntry(input) {
|
|
|
8343
8348
|
const result = { usersJsonResult: "noop", accountJsonResult: "noop" };
|
|
8344
8349
|
try {
|
|
8345
8350
|
let users = [];
|
|
8346
|
-
if (
|
|
8351
|
+
if (existsSync11(input.usersFile)) {
|
|
8347
8352
|
const raw = readFileSync14(input.usersFile, "utf-8").trim();
|
|
8348
8353
|
if (raw) {
|
|
8349
8354
|
const parsed = JSON.parse(raw);
|
|
@@ -8369,7 +8374,7 @@ function writeAdminEntry(input) {
|
|
|
8369
8374
|
}
|
|
8370
8375
|
try {
|
|
8371
8376
|
const accountJsonPath = join14(input.accountDir, "account.json");
|
|
8372
|
-
if (!
|
|
8377
|
+
if (!existsSync11(accountJsonPath)) {
|
|
8373
8378
|
throw new Error(`account.json not found at ${accountJsonPath}`);
|
|
8374
8379
|
}
|
|
8375
8380
|
const config = JSON.parse(readFileSync14(accountJsonPath, "utf-8"));
|
|
@@ -8396,7 +8401,7 @@ function checkAdminAuthInvariant(input) {
|
|
|
8396
8401
|
usersWithoutAccount: []
|
|
8397
8402
|
};
|
|
8398
8403
|
const usersUserIds = /* @__PURE__ */ new Set();
|
|
8399
|
-
if (
|
|
8404
|
+
if (existsSync11(input.usersFile)) {
|
|
8400
8405
|
try {
|
|
8401
8406
|
const raw = readFileSync14(input.usersFile, "utf-8").trim();
|
|
8402
8407
|
if (raw) {
|
|
@@ -8411,10 +8416,10 @@ function checkAdminAuthInvariant(input) {
|
|
|
8411
8416
|
}
|
|
8412
8417
|
}
|
|
8413
8418
|
const accountUserIds = /* @__PURE__ */ new Set();
|
|
8414
|
-
if (
|
|
8419
|
+
if (existsSync11(input.accountsDir)) {
|
|
8415
8420
|
let entries;
|
|
8416
8421
|
try {
|
|
8417
|
-
entries =
|
|
8422
|
+
entries = readdirSync9(input.accountsDir);
|
|
8418
8423
|
} catch (err) {
|
|
8419
8424
|
const msg = err instanceof Error ? err.message : String(err);
|
|
8420
8425
|
console.error(`[${input.tag}] accounts-dir unreadable accountsDir=${input.accountsDir} error=${msg}`);
|
|
@@ -8430,7 +8435,7 @@ function checkAdminAuthInvariant(input) {
|
|
|
8430
8435
|
continue;
|
|
8431
8436
|
}
|
|
8432
8437
|
const accountJsonPath = join14(accountDir, "account.json");
|
|
8433
|
-
if (!
|
|
8438
|
+
if (!existsSync11(accountJsonPath)) continue;
|
|
8434
8439
|
let admins = [];
|
|
8435
8440
|
try {
|
|
8436
8441
|
const config = JSON.parse(readFileSync14(accountJsonPath, "utf-8"));
|
|
@@ -8473,7 +8478,7 @@ function hashPin2(pin) {
|
|
|
8473
8478
|
return createHash3("sha256").update(pin).digest("hex");
|
|
8474
8479
|
}
|
|
8475
8480
|
function readUsersFile2() {
|
|
8476
|
-
if (!
|
|
8481
|
+
if (!existsSync12(USERS_FILE)) return null;
|
|
8477
8482
|
const raw = readFileSync15(USERS_FILE, "utf-8").trim();
|
|
8478
8483
|
if (!raw) return [];
|
|
8479
8484
|
return JSON.parse(raw);
|
|
@@ -8527,7 +8532,7 @@ app8.post("/claude-auth", async (c) => {
|
|
|
8527
8532
|
} catch (err) {
|
|
8528
8533
|
logoutError = err instanceof Error ? err.message : String(err);
|
|
8529
8534
|
}
|
|
8530
|
-
const credentialsPresent =
|
|
8535
|
+
const credentialsPresent = existsSync12(CLAUDE_CREDENTIALS_FILE);
|
|
8531
8536
|
const ranMs = Date.now() - start;
|
|
8532
8537
|
console.log(`[onboarding] op=claude-logout credentialsPresent=${credentialsPresent} ranMs=${ranMs} logoutError=${logoutError ? JSON.stringify(logoutError.slice(0, 120)) : "none"}`);
|
|
8533
8538
|
return c.json({ logged_out: !credentialsPresent });
|
|
@@ -8634,7 +8639,7 @@ app8.post("/set-pin", async (c) => {
|
|
|
8634
8639
|
console.log(`[set-pin] wrote users.json + account.json admins: userId=${userId.slice(0, 8)}\u2026 role=owner`);
|
|
8635
8640
|
if (process.platform === "linux") {
|
|
8636
8641
|
let installOwner = null;
|
|
8637
|
-
if (
|
|
8642
|
+
if (existsSync12(INSTALL_OWNER_FILE)) {
|
|
8638
8643
|
try {
|
|
8639
8644
|
const raw = readFileSync15(INSTALL_OWNER_FILE, "utf-8").trim();
|
|
8640
8645
|
if (raw.length > 0) installOwner = raw;
|
|
@@ -8717,7 +8722,7 @@ app8.delete("/set-pin", async (c) => {
|
|
|
8717
8722
|
var onboarding_default = app8;
|
|
8718
8723
|
|
|
8719
8724
|
// server/routes/client-error.ts
|
|
8720
|
-
import { appendFileSync, existsSync as
|
|
8725
|
+
import { appendFileSync, existsSync as existsSync13, renameSync as renameSync3, statSync as statSync6 } from "fs";
|
|
8721
8726
|
import { join as join15 } from "path";
|
|
8722
8727
|
var CLIENT_ERRORS_LOG = join15(LOG_DIR, "client-errors.log");
|
|
8723
8728
|
var MAX_LOG_SIZE = 10 * 1024 * 1024;
|
|
@@ -8762,7 +8767,7 @@ function stackHead(stack) {
|
|
|
8762
8767
|
}
|
|
8763
8768
|
function rotateIfNeeded() {
|
|
8764
8769
|
try {
|
|
8765
|
-
if (!
|
|
8770
|
+
if (!existsSync13(CLIENT_ERRORS_LOG)) return;
|
|
8766
8771
|
const stats = statSync6(CLIENT_ERRORS_LOG);
|
|
8767
8772
|
if (stats.size < MAX_LOG_SIZE) return;
|
|
8768
8773
|
renameSync3(CLIENT_ERRORS_LOG, CLIENT_ERRORS_LOG + ".1");
|
|
@@ -9044,18 +9049,18 @@ app10.post("/", async (c) => {
|
|
|
9044
9049
|
var session_default = app10;
|
|
9045
9050
|
|
|
9046
9051
|
// server/routes/admin/logs.ts
|
|
9047
|
-
import { existsSync as
|
|
9052
|
+
import { existsSync as existsSync15, readdirSync as readdirSync10, readFileSync as readFileSync16, statSync as statSync7 } from "fs";
|
|
9048
9053
|
import { resolve as resolve13, basename as basename4 } from "path";
|
|
9049
9054
|
|
|
9050
9055
|
// app/lib/logs-read-resolve.ts
|
|
9051
|
-
import { existsSync as
|
|
9056
|
+
import { existsSync as existsSync14 } from "fs";
|
|
9052
9057
|
import { join as join16 } from "path";
|
|
9053
9058
|
function resolveSessionLogPaths(filename, logDirs) {
|
|
9054
9059
|
const tried = [filename];
|
|
9055
9060
|
const hits = [];
|
|
9056
9061
|
for (const dir of logDirs) {
|
|
9057
9062
|
const fullPath = join16(dir, filename);
|
|
9058
|
-
if (
|
|
9063
|
+
if (existsSync14(fullPath)) {
|
|
9059
9064
|
hits.push({ path: fullPath, dir });
|
|
9060
9065
|
}
|
|
9061
9066
|
}
|
|
@@ -9183,10 +9188,10 @@ app11.get("/", async (c) => {
|
|
|
9183
9188
|
const seen = /* @__PURE__ */ new Set();
|
|
9184
9189
|
const logs = {};
|
|
9185
9190
|
for (const dir of logDirs) {
|
|
9186
|
-
if (!
|
|
9191
|
+
if (!existsSync15(dir)) continue;
|
|
9187
9192
|
let files;
|
|
9188
9193
|
try {
|
|
9189
|
-
files =
|
|
9194
|
+
files = readdirSync10(dir).filter((f) => f.endsWith(".log"));
|
|
9190
9195
|
} catch (err) {
|
|
9191
9196
|
const reason = err instanceof Error ? err.message : String(err);
|
|
9192
9197
|
console.warn(`[admin/logs] readdir-fail dir=${dir} reason=${reason}`);
|
|
@@ -9234,7 +9239,7 @@ var claude_info_default = app12;
|
|
|
9234
9239
|
|
|
9235
9240
|
// server/routes/admin/attachment.ts
|
|
9236
9241
|
import { readFile as readFile2, readdir } from "fs/promises";
|
|
9237
|
-
import { existsSync as
|
|
9242
|
+
import { existsSync as existsSync16 } from "fs";
|
|
9238
9243
|
import { resolve as resolve14 } from "path";
|
|
9239
9244
|
var app13 = new Hono();
|
|
9240
9245
|
app13.get("/:attachmentId", requireAdminSession, async (c) => {
|
|
@@ -9248,11 +9253,11 @@ app13.get("/:attachmentId", requireAdminSession, async (c) => {
|
|
|
9248
9253
|
return new Response("Not found", { status: 404 });
|
|
9249
9254
|
}
|
|
9250
9255
|
const dir = resolve14(ATTACHMENTS_ROOT, accountId, attachmentId);
|
|
9251
|
-
if (!
|
|
9256
|
+
if (!existsSync16(dir)) {
|
|
9252
9257
|
return new Response("Not found", { status: 404 });
|
|
9253
9258
|
}
|
|
9254
9259
|
const metaPath = resolve14(dir, `${attachmentId}.meta.json`);
|
|
9255
|
-
if (!
|
|
9260
|
+
if (!existsSync16(metaPath)) {
|
|
9256
9261
|
return new Response("Not found", { status: 404 });
|
|
9257
9262
|
}
|
|
9258
9263
|
let meta;
|
|
@@ -9280,21 +9285,21 @@ var attachment_default = app13;
|
|
|
9280
9285
|
|
|
9281
9286
|
// server/routes/admin/agents.ts
|
|
9282
9287
|
import { resolve as resolve15 } from "path";
|
|
9283
|
-
import { readdirSync as
|
|
9288
|
+
import { readdirSync as readdirSync11, readFileSync as readFileSync17, existsSync as existsSync17, rmSync } from "fs";
|
|
9284
9289
|
var app14 = new Hono();
|
|
9285
9290
|
app14.get("/", (c) => {
|
|
9286
9291
|
const account = resolveAccount();
|
|
9287
9292
|
if (!account) return c.json({ agents: [] });
|
|
9288
9293
|
const agentsDir = resolve15(account.accountDir, "agents");
|
|
9289
|
-
if (!
|
|
9294
|
+
if (!existsSync17(agentsDir)) return c.json({ agents: [] });
|
|
9290
9295
|
const agents = [];
|
|
9291
9296
|
try {
|
|
9292
|
-
const entries =
|
|
9297
|
+
const entries = readdirSync11(agentsDir, { withFileTypes: true });
|
|
9293
9298
|
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
9294
9299
|
if (!entry.isDirectory()) continue;
|
|
9295
9300
|
if (entry.name === "admin") continue;
|
|
9296
9301
|
const configPath2 = resolve15(agentsDir, entry.name, "config.json");
|
|
9297
|
-
if (!
|
|
9302
|
+
if (!existsSync17(configPath2)) continue;
|
|
9298
9303
|
try {
|
|
9299
9304
|
const config = JSON.parse(readFileSync17(configPath2, "utf-8"));
|
|
9300
9305
|
agents.push({
|
|
@@ -9323,7 +9328,7 @@ app14.delete("/:slug", async (c) => {
|
|
|
9323
9328
|
return c.json({ error: "Invalid agent slug" }, 400);
|
|
9324
9329
|
}
|
|
9325
9330
|
const agentDir = resolve15(account.accountDir, "agents", slug);
|
|
9326
|
-
if (!
|
|
9331
|
+
if (!existsSync17(agentDir)) {
|
|
9327
9332
|
return c.json({ error: "Agent not found" }, 404);
|
|
9328
9333
|
}
|
|
9329
9334
|
try {
|
|
@@ -9353,7 +9358,7 @@ app14.post("/:slug/project", async (c) => {
|
|
|
9353
9358
|
return c.json({ error: "Invalid agent slug" }, 400);
|
|
9354
9359
|
}
|
|
9355
9360
|
const agentDir = resolve15(account.accountDir, "agents", slug);
|
|
9356
|
-
if (!
|
|
9361
|
+
if (!existsSync17(agentDir)) {
|
|
9357
9362
|
return c.json({ error: "Agent not found on disk" }, 404);
|
|
9358
9363
|
}
|
|
9359
9364
|
try {
|
|
@@ -9369,7 +9374,7 @@ var agents_default = app14;
|
|
|
9369
9374
|
// server/routes/admin/sessions.ts
|
|
9370
9375
|
import crypto2 from "crypto";
|
|
9371
9376
|
import { resolve as resolvePath } from "path";
|
|
9372
|
-
import { existsSync as
|
|
9377
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync3, createWriteStream } from "fs";
|
|
9373
9378
|
|
|
9374
9379
|
// ../lib/admin-conversation-purge/src/index.ts
|
|
9375
9380
|
async function purgeAdminConversationJsonls(args) {
|
|
@@ -9529,7 +9534,7 @@ function validateAndShapeAttachments(raws, conversationAccountId, sessionId, mes
|
|
|
9529
9534
|
let reason = null;
|
|
9530
9535
|
if (!a.attachmentId || !a.filename || !a.mimeType || !a.storagePath) reason = "schema-fail";
|
|
9531
9536
|
else if (a.accountId !== conversationAccountId) reason = "account-mismatch";
|
|
9532
|
-
else if (!
|
|
9537
|
+
else if (!existsSync18(a.storagePath)) reason = "missing-file";
|
|
9533
9538
|
if (reason) {
|
|
9534
9539
|
invalid++;
|
|
9535
9540
|
try {
|
|
@@ -10055,7 +10060,7 @@ app15.put("/:id/label", requireAdminSession, async (c) => {
|
|
|
10055
10060
|
var sessions_default = app15;
|
|
10056
10061
|
|
|
10057
10062
|
// app/lib/claude-agent/spawn-context.ts
|
|
10058
|
-
import { existsSync as
|
|
10063
|
+
import { existsSync as existsSync19, readFileSync as readFileSync18, readdirSync as readdirSync12, statSync as statSync8 } from "fs";
|
|
10059
10064
|
import { dirname as dirname4, resolve as resolve16, join as join17 } from "path";
|
|
10060
10065
|
async function resolveOwnerProfileBlock(accountId, userId) {
|
|
10061
10066
|
if (!userId) return { ok: false, reason: "missing-user-id" };
|
|
@@ -10090,7 +10095,7 @@ function extractPluginToolDescriptions(pluginDir) {
|
|
|
10090
10095
|
];
|
|
10091
10096
|
let raw = null;
|
|
10092
10097
|
for (const path2 of candidates) {
|
|
10093
|
-
if (!
|
|
10098
|
+
if (!existsSync19(path2)) continue;
|
|
10094
10099
|
try {
|
|
10095
10100
|
raw = readFileSync18(path2, "utf-8");
|
|
10096
10101
|
break;
|
|
@@ -10142,8 +10147,8 @@ function parseSkillPathsFromFrontmatter(fm) {
|
|
|
10142
10147
|
function listPluginDirs() {
|
|
10143
10148
|
const out = /* @__PURE__ */ new Map();
|
|
10144
10149
|
const platformPlugins = resolve16(PLATFORM_ROOT, "plugins");
|
|
10145
|
-
if (
|
|
10146
|
-
for (const name of
|
|
10150
|
+
if (existsSync19(platformPlugins)) {
|
|
10151
|
+
for (const name of readdirSync12(platformPlugins)) {
|
|
10147
10152
|
const dir = join17(platformPlugins, name);
|
|
10148
10153
|
try {
|
|
10149
10154
|
if (statSync8(dir).isDirectory()) out.set(name, dir);
|
|
@@ -10152,12 +10157,12 @@ function listPluginDirs() {
|
|
|
10152
10157
|
}
|
|
10153
10158
|
}
|
|
10154
10159
|
const premiumRoot = resolve16(dirname4(PLATFORM_ROOT), "premium-plugins");
|
|
10155
|
-
if (
|
|
10156
|
-
for (const bundle of
|
|
10160
|
+
if (existsSync19(premiumRoot)) {
|
|
10161
|
+
for (const bundle of readdirSync12(premiumRoot)) {
|
|
10157
10162
|
const bundlePlugins = join17(premiumRoot, bundle, "plugins");
|
|
10158
|
-
if (!
|
|
10163
|
+
if (!existsSync19(bundlePlugins)) continue;
|
|
10159
10164
|
try {
|
|
10160
|
-
for (const name of
|
|
10165
|
+
for (const name of readdirSync12(bundlePlugins)) {
|
|
10161
10166
|
const dir = join17(bundlePlugins, name);
|
|
10162
10167
|
try {
|
|
10163
10168
|
if (statSync8(dir).isDirectory()) out.set(name, dir);
|
|
@@ -10172,7 +10177,7 @@ function listPluginDirs() {
|
|
|
10172
10177
|
}
|
|
10173
10178
|
function readEnabledPlugins(accountId) {
|
|
10174
10179
|
const accountFile = resolve16(PLATFORM_ROOT, "..", "data/accounts", accountId, "account.json");
|
|
10175
|
-
if (!
|
|
10180
|
+
if (!existsSync19(accountFile)) return /* @__PURE__ */ new Set();
|
|
10176
10181
|
try {
|
|
10177
10182
|
const parsed = JSON.parse(readFileSync18(accountFile, "utf-8"));
|
|
10178
10183
|
return new Set(
|
|
@@ -10183,7 +10188,7 @@ function readEnabledPlugins(accountId) {
|
|
|
10183
10188
|
}
|
|
10184
10189
|
}
|
|
10185
10190
|
function readFrontmatter(path2) {
|
|
10186
|
-
if (!
|
|
10191
|
+
if (!existsSync19(path2)) return null;
|
|
10187
10192
|
let raw;
|
|
10188
10193
|
try {
|
|
10189
10194
|
raw = readFileSync18(path2, "utf-8");
|
|
@@ -10218,7 +10223,7 @@ ${fm}
|
|
|
10218
10223
|
`plugin-manifest-tool-coverage plugin=${name} tools=${tools.length} with-desc=${withDesc}`
|
|
10219
10224
|
);
|
|
10220
10225
|
if (toolNames.length > 0 && descMap.size === 0) {
|
|
10221
|
-
const hasSource =
|
|
10226
|
+
const hasSource = existsSync19(join17(dir, "mcp/dist/index.js")) || existsSync19(join17(dir, "mcp/src/index.ts"));
|
|
10222
10227
|
if (hasSource) {
|
|
10223
10228
|
console.warn(
|
|
10224
10229
|
`[spawn-context] WARN plugin=${name} mcp source present but tool-description regex matched zero entries \u2014 SDK upgrade may have changed the registration shape`
|
|
@@ -10245,10 +10250,10 @@ ${skillFm}
|
|
|
10245
10250
|
}
|
|
10246
10251
|
function computeSpecialistDomains(accountId) {
|
|
10247
10252
|
const specialistsDir = resolve16(PLATFORM_ROOT, "..", "data/accounts", accountId, "specialists", "agents");
|
|
10248
|
-
if (!
|
|
10253
|
+
if (!existsSync19(specialistsDir)) return [];
|
|
10249
10254
|
let entries;
|
|
10250
10255
|
try {
|
|
10251
|
-
entries =
|
|
10256
|
+
entries = readdirSync12(specialistsDir);
|
|
10252
10257
|
} catch {
|
|
10253
10258
|
return [];
|
|
10254
10259
|
}
|
|
@@ -10291,7 +10296,7 @@ ${fm}
|
|
|
10291
10296
|
}
|
|
10292
10297
|
function computeDormantPlugins(accountId) {
|
|
10293
10298
|
const accountFile = resolve16(PLATFORM_ROOT, "..", "data/accounts", accountId, "account.json");
|
|
10294
|
-
if (!
|
|
10299
|
+
if (!existsSync19(accountFile)) return [];
|
|
10295
10300
|
let enabled;
|
|
10296
10301
|
try {
|
|
10297
10302
|
const raw = readFileSync18(accountFile, "utf-8");
|
|
@@ -10306,10 +10311,10 @@ function computeDormantPlugins(accountId) {
|
|
|
10306
10311
|
return [];
|
|
10307
10312
|
}
|
|
10308
10313
|
const pluginsDir = resolve16(PLATFORM_ROOT, "plugins");
|
|
10309
|
-
if (!
|
|
10314
|
+
if (!existsSync19(pluginsDir)) return [];
|
|
10310
10315
|
let entries;
|
|
10311
10316
|
try {
|
|
10312
|
-
entries =
|
|
10317
|
+
entries = readdirSync12(pluginsDir);
|
|
10313
10318
|
} catch {
|
|
10314
10319
|
return [];
|
|
10315
10320
|
}
|
|
@@ -10317,7 +10322,7 @@ function computeDormantPlugins(accountId) {
|
|
|
10317
10322
|
for (const name of entries) {
|
|
10318
10323
|
if (enabled.has(name)) continue;
|
|
10319
10324
|
const manifestPath = resolve16(pluginsDir, name, "PLUGIN.md");
|
|
10320
|
-
if (!
|
|
10325
|
+
if (!existsSync19(manifestPath)) continue;
|
|
10321
10326
|
let manifest;
|
|
10322
10327
|
try {
|
|
10323
10328
|
manifest = readFileSync18(manifestPath, "utf-8");
|
|
@@ -10334,11 +10339,11 @@ function computeDormantPlugins(accountId) {
|
|
|
10334
10339
|
}
|
|
10335
10340
|
|
|
10336
10341
|
// server/routes/admin/claude-sessions.ts
|
|
10337
|
-
import { existsSync as
|
|
10342
|
+
import { existsSync as existsSync20, readFileSync as readFileSync19 } from "fs";
|
|
10338
10343
|
import { resolve as resolve17 } from "path";
|
|
10339
10344
|
function readTunnelState(brandConfigDir) {
|
|
10340
10345
|
const statePath = `${process.env.HOME ?? ""}/${brandConfigDir}/cloudflared/tunnel.state`;
|
|
10341
|
-
if (!
|
|
10346
|
+
if (!existsSync20(statePath)) return null;
|
|
10342
10347
|
try {
|
|
10343
10348
|
const parsed = JSON.parse(readFileSync19(statePath, "utf-8"));
|
|
10344
10349
|
const tunnelId = typeof parsed.tunnelId === "string" ? parsed.tunnelId : null;
|
|
@@ -13780,7 +13785,7 @@ var graph_default_view_default = app25;
|
|
|
13780
13785
|
// server/routes/admin/sidebar-artefacts.ts
|
|
13781
13786
|
import { readdir as readdir4, stat as stat5 } from "fs/promises";
|
|
13782
13787
|
import { resolve as resolve21, relative as relative3, isAbsolute, sep as sep6, basename as basename7 } from "path";
|
|
13783
|
-
import { existsSync as
|
|
13788
|
+
import { existsSync as existsSync21 } from "fs";
|
|
13784
13789
|
var LIMIT = 50;
|
|
13785
13790
|
var ADMIN_AGENT_FILES = ["IDENTITY.md", "SOUL.md", "KNOWLEDGE.md"];
|
|
13786
13791
|
function toDataRootRelPath(absPath) {
|
|
@@ -13886,7 +13891,7 @@ async function fetchAgentTemplateRows(accountDir) {
|
|
|
13886
13891
|
async function unionSpecialistFilenames(overrideDir, bundledDir) {
|
|
13887
13892
|
const names = /* @__PURE__ */ new Set();
|
|
13888
13893
|
for (const dir of [overrideDir, bundledDir]) {
|
|
13889
|
-
if (!
|
|
13894
|
+
if (!existsSync21(dir)) continue;
|
|
13890
13895
|
try {
|
|
13891
13896
|
const entries = await readdir4(dir);
|
|
13892
13897
|
for (const entry of entries) {
|
|
@@ -13901,7 +13906,7 @@ async function unionSpecialistFilenames(overrideDir, bundledDir) {
|
|
|
13901
13906
|
}
|
|
13902
13907
|
async function readAgentTemplateRow(inp) {
|
|
13903
13908
|
let chosenPath = null;
|
|
13904
|
-
if (
|
|
13909
|
+
if (existsSync21(inp.overridePath)) {
|
|
13905
13910
|
try {
|
|
13906
13911
|
validateFilePathInAccount(inp.overridePath, inp.overrideRoot);
|
|
13907
13912
|
chosenPath = inp.overridePath;
|
|
@@ -13912,7 +13917,7 @@ async function readAgentTemplateRow(inp) {
|
|
|
13912
13917
|
);
|
|
13913
13918
|
return null;
|
|
13914
13919
|
}
|
|
13915
|
-
} else if (
|
|
13920
|
+
} else if (existsSync21(inp.bundledPath)) {
|
|
13916
13921
|
if (!isWithin(inp.bundledPath, inp.bundledRoot)) {
|
|
13917
13922
|
console.error(
|
|
13918
13923
|
`[admin/sidebar-artefacts] agent-template-read-failed agent=${inp.displayName} kind=${inp.logName} error="bundled path outside PLATFORM_ROOT"`
|
|
@@ -14078,8 +14083,8 @@ var session_archive_default = app29;
|
|
|
14078
14083
|
|
|
14079
14084
|
// server/routes/admin/session-rc-spawn.ts
|
|
14080
14085
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
14081
|
-
function resolveSpawnPlan(host, body, mintId = randomUUID9) {
|
|
14082
|
-
const operator = isOperatorHost(host);
|
|
14086
|
+
function resolveSpawnPlan(host, operatorDomains, body, mintId = randomUUID9) {
|
|
14087
|
+
const operator = isOperatorHost(host, operatorDomains);
|
|
14083
14088
|
const resumeId = typeof body.sessionId === "string" && body.sessionId.length > 0 ? body.sessionId : void 0;
|
|
14084
14089
|
const name = typeof body.name === "string" && body.name.length > 0 ? body.name : void 0;
|
|
14085
14090
|
const webchatBind = resumeId === void 0 || operator;
|
|
@@ -14115,8 +14120,8 @@ app30.post("/", requireAdminSession, async (c) => {
|
|
|
14115
14120
|
} catch {
|
|
14116
14121
|
body = {};
|
|
14117
14122
|
}
|
|
14118
|
-
const host = c.req.header("host") ?? "";
|
|
14119
|
-
const plan = resolveSpawnPlan(host, body);
|
|
14123
|
+
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
14124
|
+
const plan = resolveSpawnPlan(host, getOperatorDomains(), body);
|
|
14120
14125
|
const spawnReqId = randomUUID9();
|
|
14121
14126
|
console.log(
|
|
14122
14127
|
`[chat-spawn] op=request spawnReqId=${spawnReqId} origin=${plan.origin} kind=${plan.kind} sessionId=${plan.kind === "new" ? "new" : plan.sessionId}`
|
|
@@ -14283,12 +14288,12 @@ app31.get("/", async (c) => {
|
|
|
14283
14288
|
var system_stats_default = app31;
|
|
14284
14289
|
|
|
14285
14290
|
// server/routes/admin/health.ts
|
|
14286
|
-
import { existsSync as
|
|
14291
|
+
import { existsSync as existsSync22, readFileSync as readFileSync20 } from "fs";
|
|
14287
14292
|
import { resolve as resolve22, join as join20 } from "path";
|
|
14288
14293
|
var PLATFORM_ROOT6 = process.env.MAXY_PLATFORM_ROOT ?? resolve22(process.cwd(), "..");
|
|
14289
14294
|
var brandHostname = "maxy";
|
|
14290
14295
|
var brandJsonPath = join20(PLATFORM_ROOT6, "config", "brand.json");
|
|
14291
|
-
if (
|
|
14296
|
+
if (existsSync22(brandJsonPath)) {
|
|
14292
14297
|
try {
|
|
14293
14298
|
const brand = JSON.parse(readFileSync20(brandJsonPath, "utf-8"));
|
|
14294
14299
|
if (brand.hostname) brandHostname = brand.hostname;
|
|
@@ -14299,7 +14304,7 @@ var VERSION_FILE = resolve22(PLATFORM_ROOT6, `config/.${brandHostname}-version`)
|
|
|
14299
14304
|
var PROCESS_STARTED_AT = (/* @__PURE__ */ new Date()).toISOString();
|
|
14300
14305
|
var PROBE_TIMEOUT_MS = 1e3;
|
|
14301
14306
|
function readVersion() {
|
|
14302
|
-
if (!
|
|
14307
|
+
if (!existsSync22(VERSION_FILE)) return "unknown";
|
|
14303
14308
|
return readFileSync20(VERSION_FILE, "utf-8").trim() || "unknown";
|
|
14304
14309
|
}
|
|
14305
14310
|
async function probeConversationDb() {
|
|
@@ -15283,7 +15288,7 @@ app42.route("/request-magic-link", request_magic_link_default);
|
|
|
15283
15288
|
var access_default = app42;
|
|
15284
15289
|
|
|
15285
15290
|
// server/routes/sites.ts
|
|
15286
|
-
import { existsSync as
|
|
15291
|
+
import { existsSync as existsSync23, readFileSync as readFileSync22, realpathSync as realpathSync5, statSync as statSync9 } from "fs";
|
|
15287
15292
|
import { resolve as resolve25 } from "path";
|
|
15288
15293
|
var SAFE_SEG_RE = /^[a-z0-9_][a-z0-9_.-]{0,99}$/i;
|
|
15289
15294
|
var MIME = {
|
|
@@ -15349,7 +15354,7 @@ app43.get("/:rel{.*}", (c) => {
|
|
|
15349
15354
|
}
|
|
15350
15355
|
let stat7;
|
|
15351
15356
|
try {
|
|
15352
|
-
stat7 =
|
|
15357
|
+
stat7 = existsSync23(filePath) ? statSync9(filePath) : null;
|
|
15353
15358
|
} catch {
|
|
15354
15359
|
stat7 = null;
|
|
15355
15360
|
}
|
|
@@ -15368,7 +15373,7 @@ app43.get("/:rel{.*}", (c) => {
|
|
|
15368
15373
|
console.error(`[sites] path-traversal-rejected path=${reqPath} reason=escape status=403`);
|
|
15369
15374
|
return c.text("Forbidden", 403);
|
|
15370
15375
|
}
|
|
15371
|
-
if (!
|
|
15376
|
+
if (!existsSync23(filePath)) {
|
|
15372
15377
|
console.error(`[sites] not-found path=${reqPath} status=404`);
|
|
15373
15378
|
return c.text("Not found", 404);
|
|
15374
15379
|
}
|
|
@@ -15499,7 +15504,7 @@ var VISITOR_COOKIE_NAME = "mxy_v";
|
|
|
15499
15504
|
var VISITOR_COOKIE_MAX_AGE_SECONDS = Math.floor(DEFAULT_TTL_MS / 1e3);
|
|
15500
15505
|
|
|
15501
15506
|
// app/lib/brand-config.ts
|
|
15502
|
-
import { existsSync as
|
|
15507
|
+
import { existsSync as existsSync24, readFileSync as readFileSync24 } from "fs";
|
|
15503
15508
|
import { join as join21 } from "path";
|
|
15504
15509
|
var cached2 = null;
|
|
15505
15510
|
var cachedAttempted = false;
|
|
@@ -15509,7 +15514,7 @@ function readBrandConfig() {
|
|
|
15509
15514
|
const platformRoot2 = process.env.MAXY_PLATFORM_ROOT;
|
|
15510
15515
|
if (!platformRoot2) return null;
|
|
15511
15516
|
const brandPath = join21(platformRoot2, "config", "brand.json");
|
|
15512
|
-
if (!
|
|
15517
|
+
if (!existsSync24(brandPath)) return null;
|
|
15513
15518
|
try {
|
|
15514
15519
|
cached2 = JSON.parse(readFileSync24(brandPath, "utf-8"));
|
|
15515
15520
|
return cached2;
|
|
@@ -16000,7 +16005,7 @@ var visitor_event_default = app46;
|
|
|
16000
16005
|
|
|
16001
16006
|
// server/routes/session.ts
|
|
16002
16007
|
import { resolve as resolve26 } from "path";
|
|
16003
|
-
import { existsSync as
|
|
16008
|
+
import { existsSync as existsSync25, writeFileSync as writeFileSync9, mkdirSync as mkdirSync5 } from "fs";
|
|
16004
16009
|
var UUID_RE4 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
16005
16010
|
function writeBrandingCache(accountId, agentSlug, branding) {
|
|
16006
16011
|
try {
|
|
@@ -16095,7 +16100,7 @@ app47.post("/", async (c) => {
|
|
|
16095
16100
|
let agentConfig = null;
|
|
16096
16101
|
if (account) {
|
|
16097
16102
|
const agentDir = resolve26(account.accountDir, "agents", agentSlug);
|
|
16098
|
-
if (!
|
|
16103
|
+
if (!existsSync25(agentDir) || !existsSync25(resolve26(agentDir, "config.json"))) {
|
|
16099
16104
|
return c.json({ error: "Agent not found" }, 404);
|
|
16100
16105
|
}
|
|
16101
16106
|
agentConfig = resolveAgentConfig(account.accountDir, agentSlug);
|
|
@@ -16842,6 +16847,37 @@ function createWaChannelRoutes(deps) {
|
|
|
16842
16847
|
deps.onReceived?.(senderId, waMessageId);
|
|
16843
16848
|
return c.json({ ok: true });
|
|
16844
16849
|
});
|
|
16850
|
+
app49.post("/wa-channel/turn-end", async (c) => {
|
|
16851
|
+
const body = await c.req.json().catch(() => null);
|
|
16852
|
+
const senderId = body?.senderId;
|
|
16853
|
+
const sessionId = body?.sessionId;
|
|
16854
|
+
const replied = body?.replied;
|
|
16855
|
+
if (typeof senderId !== "string" || typeof sessionId !== "string" || typeof replied !== "boolean") {
|
|
16856
|
+
return c.json({ error: "senderId, sessionId and replied required" }, 400);
|
|
16857
|
+
}
|
|
16858
|
+
const sid = sessionId.slice(0, 8);
|
|
16859
|
+
if (replied) {
|
|
16860
|
+
console.error(`[whatsapp-native] op=turn-end sessionId=${sid} replied=yes delivered=reply`);
|
|
16861
|
+
return c.json({ ok: true, delivered: "reply" });
|
|
16862
|
+
}
|
|
16863
|
+
const finalText = typeof body?.finalText === "string" ? body.finalText : "";
|
|
16864
|
+
if (!finalText.trim()) {
|
|
16865
|
+
console.error(`[whatsapp-native] op=turn-end sessionId=${sid} replied=no delivered=none`);
|
|
16866
|
+
return c.json({ ok: true, delivered: "none" });
|
|
16867
|
+
}
|
|
16868
|
+
const bytes = Buffer.byteLength(finalText, "utf8");
|
|
16869
|
+
try {
|
|
16870
|
+
await deps.sendOutbound(senderId, finalText);
|
|
16871
|
+
} catch (err) {
|
|
16872
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
16873
|
+
console.error(
|
|
16874
|
+
`[whatsapp-native] op=turn-end sessionId=${sid} replied=no delivered=error bytes=${bytes} error=${message}`
|
|
16875
|
+
);
|
|
16876
|
+
return c.json({ error: message }, 500);
|
|
16877
|
+
}
|
|
16878
|
+
console.error(`[whatsapp-native] op=turn-end sessionId=${sid} replied=no delivered=fallback bytes=${bytes}`);
|
|
16879
|
+
return c.json({ ok: true, delivered: "fallback" });
|
|
16880
|
+
});
|
|
16845
16881
|
return app49;
|
|
16846
16882
|
}
|
|
16847
16883
|
|
|
@@ -17333,7 +17369,7 @@ function broadcastAdminShutdown(reason) {
|
|
|
17333
17369
|
|
|
17334
17370
|
// ../lib/entitlement/src/index.ts
|
|
17335
17371
|
import { createPublicKey, createHash as createHash5, verify as cryptoVerify } from "crypto";
|
|
17336
|
-
import { existsSync as
|
|
17372
|
+
import { existsSync as existsSync26, readFileSync as readFileSync25, statSync as statSync10 } from "fs";
|
|
17337
17373
|
import { resolve as resolve28 } from "path";
|
|
17338
17374
|
|
|
17339
17375
|
// ../lib/entitlement/src/canonicalize.ts
|
|
@@ -17382,7 +17418,7 @@ function resolveEntitlement(brand, account) {
|
|
|
17382
17418
|
return logResolved(implicitTrust(account), null);
|
|
17383
17419
|
}
|
|
17384
17420
|
const entitlementPath = resolve28(brand.configDir, "entitlement.json");
|
|
17385
|
-
if (!
|
|
17421
|
+
if (!existsSync26(entitlementPath)) {
|
|
17386
17422
|
return logResolved(anonymousFallback("missing"), { reason: "missing" });
|
|
17387
17423
|
}
|
|
17388
17424
|
const stat7 = statSync10(entitlementPath);
|
|
@@ -17574,10 +17610,10 @@ function clientFrom(c) {
|
|
|
17574
17610
|
var PLATFORM_ROOT9 = process.env.MAXY_PLATFORM_ROOT || "";
|
|
17575
17611
|
var BRAND_JSON_PATH = PLATFORM_ROOT9 ? join22(PLATFORM_ROOT9, "config", "brand.json") : "";
|
|
17576
17612
|
var BRAND = { productName: "Maxy", hostname: "maxy", configDir: ".maxy", marketingUrl: "https://getmaxy.com" };
|
|
17577
|
-
if (BRAND_JSON_PATH && !
|
|
17613
|
+
if (BRAND_JSON_PATH && !existsSync27(BRAND_JSON_PATH)) {
|
|
17578
17614
|
console.error(`[brand] WARNING: brand.json not found at ${BRAND_JSON_PATH} \u2014 using Maxy defaults`);
|
|
17579
17615
|
}
|
|
17580
|
-
if (BRAND_JSON_PATH &&
|
|
17616
|
+
if (BRAND_JSON_PATH && existsSync27(BRAND_JSON_PATH)) {
|
|
17581
17617
|
try {
|
|
17582
17618
|
const parsed = JSON.parse(readFileSync26(BRAND_JSON_PATH, "utf-8"));
|
|
17583
17619
|
BRAND = { ...BRAND, ...parsed };
|
|
@@ -17601,7 +17637,7 @@ var brandLoginOpts = {
|
|
|
17601
17637
|
var ALIAS_DOMAINS_PATH = join22(homedir3(), BRAND.configDir, "alias-domains.json");
|
|
17602
17638
|
function loadAliasDomains() {
|
|
17603
17639
|
try {
|
|
17604
|
-
if (!
|
|
17640
|
+
if (!existsSync27(ALIAS_DOMAINS_PATH)) return null;
|
|
17605
17641
|
const parsed = JSON.parse(readFileSync26(ALIAS_DOMAINS_PATH, "utf-8"));
|
|
17606
17642
|
if (!Array.isArray(parsed)) {
|
|
17607
17643
|
console.error("[alias-domains] malformed alias-domains.json \u2014 expected array");
|
|
@@ -17738,7 +17774,7 @@ app48.use("*", async (c, next) => {
|
|
|
17738
17774
|
});
|
|
17739
17775
|
app48.use("*", async (c, next) => {
|
|
17740
17776
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
17741
|
-
if (!isPublicHost(host)) {
|
|
17777
|
+
if (isOperatorHost(host, getOperatorDomains()) || !isPublicHost(host)) {
|
|
17742
17778
|
await next();
|
|
17743
17779
|
return;
|
|
17744
17780
|
}
|
|
@@ -17970,7 +18006,10 @@ app48.use("*", async (c, next) => {
|
|
|
17970
18006
|
remoteAddress: rawRemote,
|
|
17971
18007
|
xForwardedFor: rawXff,
|
|
17972
18008
|
cookieHeader: c.req.header("cookie"),
|
|
17973
|
-
|
|
18009
|
+
// Task 829 — operator-wins: an operator host is admin-gated, so it must not
|
|
18010
|
+
// be classified public here (which would bypass the admin gate). A host in
|
|
18011
|
+
// both operator-domains.json and alias-domains.json stays admin-gated.
|
|
18012
|
+
isPublicHost: (h) => !isOperatorHost(h, getOperatorDomains()) && isPublicHost(h)
|
|
17974
18013
|
});
|
|
17975
18014
|
if (decision.allow) {
|
|
17976
18015
|
await next();
|
|
@@ -18033,7 +18072,7 @@ app48.get("/agent-assets/:slug/:filename", (c) => {
|
|
|
18033
18072
|
console.error(`[agent-assets] path-traversal-rejected slug=${slug} file=${filename}`);
|
|
18034
18073
|
return c.text("Forbidden", 403);
|
|
18035
18074
|
}
|
|
18036
|
-
if (!
|
|
18075
|
+
if (!existsSync27(filePath)) {
|
|
18037
18076
|
console.error(`[agent-assets] serve slug=${slug} file=${filename} status=404`);
|
|
18038
18077
|
return c.text("Not found", 404);
|
|
18039
18078
|
}
|
|
@@ -18063,7 +18102,7 @@ app48.get("/generated/:filename", (c) => {
|
|
|
18063
18102
|
console.error(`[generated] serve file=${filename} status=403`);
|
|
18064
18103
|
return c.text("Forbidden", 403);
|
|
18065
18104
|
}
|
|
18066
|
-
if (!
|
|
18105
|
+
if (!existsSync27(filePath)) {
|
|
18067
18106
|
console.error(`[generated] serve file=${filename} status=404`);
|
|
18068
18107
|
return c.text("Not found", 404);
|
|
18069
18108
|
}
|
|
@@ -18083,7 +18122,7 @@ app48.route("/v", visitor_consent_default);
|
|
|
18083
18122
|
var htmlCache = /* @__PURE__ */ new Map();
|
|
18084
18123
|
var brandLogoPath = "/brand/maxy-monochrome.png";
|
|
18085
18124
|
var brandIconPath = "/brand/maxy-monochrome.png";
|
|
18086
|
-
if (BRAND_JSON_PATH &&
|
|
18125
|
+
if (BRAND_JSON_PATH && existsSync27(BRAND_JSON_PATH)) {
|
|
18087
18126
|
try {
|
|
18088
18127
|
const fullBrand = JSON.parse(readFileSync26(BRAND_JSON_PATH, "utf-8"));
|
|
18089
18128
|
if (fullBrand.assets?.logo) brandLogoPath = `/brand/${fullBrand.assets.logo}`;
|
|
@@ -18103,7 +18142,7 @@ function readInstalledVersion() {
|
|
|
18103
18142
|
try {
|
|
18104
18143
|
if (!PLATFORM_ROOT9) return "unknown";
|
|
18105
18144
|
const versionFile = join22(PLATFORM_ROOT9, "config", `.${BRAND.hostname}-version`);
|
|
18106
|
-
if (!
|
|
18145
|
+
if (!existsSync27(versionFile)) return "unknown";
|
|
18107
18146
|
const content = readFileSync26(versionFile, "utf-8").trim();
|
|
18108
18147
|
return content || "unknown";
|
|
18109
18148
|
} catch {
|
|
@@ -18166,7 +18205,7 @@ function loadBrandingCache(agentSlug) {
|
|
|
18166
18205
|
const accountId = getDefaultAccountId();
|
|
18167
18206
|
if (!accountId) return null;
|
|
18168
18207
|
const cachePath = join22(configDir2, "branding-cache", accountId, `${agentSlug}.json`);
|
|
18169
|
-
if (!
|
|
18208
|
+
if (!existsSync27(cachePath)) return null;
|
|
18170
18209
|
return JSON.parse(readFileSync26(cachePath, "utf-8"));
|
|
18171
18210
|
} catch {
|
|
18172
18211
|
return null;
|
|
@@ -18212,11 +18251,12 @@ function agentUnavailableHtml() {
|
|
|
18212
18251
|
}
|
|
18213
18252
|
app48.get("/", (c) => {
|
|
18214
18253
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
18215
|
-
|
|
18254
|
+
const klass = classifyHost(host, getOperatorDomains(), isPublicHost);
|
|
18255
|
+
if (klass === "operator") {
|
|
18216
18256
|
console.log(`[host-class] host=${host} class=operator served=operator.html`);
|
|
18217
18257
|
return c.html(cachedHtml("operator.html"));
|
|
18218
18258
|
}
|
|
18219
|
-
if (
|
|
18259
|
+
if (klass === "public") {
|
|
18220
18260
|
const defaultSlug = resolveDefaultSlug();
|
|
18221
18261
|
if (!defaultSlug) {
|
|
18222
18262
|
console.error("[public-root] op=no-default");
|
|
@@ -18296,7 +18336,7 @@ app48.get("/g/:slug", (c) => {
|
|
|
18296
18336
|
});
|
|
18297
18337
|
app48.get("/graph", (c) => {
|
|
18298
18338
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
18299
|
-
if (isPublicHost(host) || isOperatorHost(host)) return c.text("Not found", 404);
|
|
18339
|
+
if (isPublicHost(host) || isOperatorHost(host, getOperatorDomains())) return c.text("Not found", 404);
|
|
18300
18340
|
return c.html(cachedHtml("graph.html"));
|
|
18301
18341
|
});
|
|
18302
18342
|
app48.get("/chat", (c) => {
|
|
@@ -18311,7 +18351,7 @@ app48.get("/data", (c) => {
|
|
|
18311
18351
|
});
|
|
18312
18352
|
app48.get("/browser", (c) => {
|
|
18313
18353
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
18314
|
-
if (isPublicHost(host) || isOperatorHost(host)) return c.text("Not found", 404);
|
|
18354
|
+
if (isPublicHost(host) || isOperatorHost(host, getOperatorDomains())) return c.text("Not found", 404);
|
|
18315
18355
|
return c.html(cachedHtml("browser.html"));
|
|
18316
18356
|
});
|
|
18317
18357
|
app48.get("/:slug", async (c, next) => {
|
|
@@ -18416,7 +18456,7 @@ try {
|
|
|
18416
18456
|
var ADMINUSER_RECONCILE_INTERVAL_MS = 60 * 60 * 1e3;
|
|
18417
18457
|
async function runAdminUserReconcileTick() {
|
|
18418
18458
|
try {
|
|
18419
|
-
if (!
|
|
18459
|
+
if (!existsSync27(USERS_FILE)) {
|
|
18420
18460
|
console.error("[adminuser-self-heal] skip reason=no-users-file");
|
|
18421
18461
|
return;
|
|
18422
18462
|
}
|