@rubytech/create-maxy-code 0.1.292 → 0.1.293
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/package-lock.json +18 -1
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +4 -2
- package/payload/platform/plugins/docs/references/admin-ui.md +2 -0
- package/payload/platform/plugins/docs/references/platform.md +1 -1
- package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.d.ts +1 -1
- package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.js +1 -1
- package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.js.map +1 -1
- package/payload/platform/services/webchat-channel/dist/server.d.ts +37 -1
- package/payload/platform/services/webchat-channel/dist/server.d.ts.map +1 -1
- package/payload/platform/services/webchat-channel/dist/server.js +43 -13
- package/payload/platform/services/webchat-channel/dist/server.js.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/server.d.ts +37 -1
- package/payload/platform/services/whatsapp-channel/dist/server.d.ts.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/server.js +43 -13
- package/payload/platform/services/whatsapp-channel/dist/server.js.map +1 -1
- package/payload/server/{chunk-QDCBAHPI.js → chunk-7H4KMTMC.js} +1 -1
- package/payload/server/maxy-edge.js +1 -1
- package/payload/server/public/assets/AdminShell-7xqVmEF0.js +1 -0
- package/payload/server/public/assets/{Checkbox-hYA5LjZ5.js → Checkbox-xIFPRr-Y.js} +1 -1
- package/payload/server/public/assets/{Transcript-BaC574J0.js → Transcript-siyY9S7_.js} +1 -1
- package/payload/server/public/assets/admin-DVyRE7og.js +1 -0
- package/payload/server/public/assets/{arc-yRinR5h4.js → arc-iu3VNUKX.js} +1 -1
- package/payload/server/public/assets/architecture-YZFGNWBL-HsK_v-AH.js +1 -0
- package/payload/server/public/assets/{architectureDiagram-Q4EWVU46-d4iT6VnY.js → architectureDiagram-Q4EWVU46-un5y1Pav.js} +1 -1
- package/payload/server/public/assets/{blockDiagram-DXYQGD6D-o5Tjd8VR.js → blockDiagram-DXYQGD6D-CrT4y-Ve.js} +1 -1
- package/payload/server/public/assets/browser-CWFHESdi.js +1 -0
- package/payload/server/public/assets/{c4Diagram-AHTNJAMY-B8IQ2a83.js → c4Diagram-AHTNJAMY-BTNlRxRe.js} +1 -1
- package/payload/server/public/assets/channel-B3X2ELTx.js +1 -0
- package/payload/server/public/assets/chat-CoZ5hSiK.js +1 -0
- package/payload/server/public/assets/{chunk-2KRD3SAO-DAJbbBPY.js → chunk-2KRD3SAO-DjQJDvnb.js} +1 -1
- package/payload/server/public/assets/{chunk-336JU56O-1-fVU2_7.js → chunk-336JU56O-CWAQPaQW.js} +2 -2
- package/payload/server/public/assets/chunk-426QAEUC-CYsbwfwG.js +1 -0
- package/payload/server/public/assets/{chunk-4BX2VUAB-BTCTbhtf.js → chunk-4BX2VUAB-B2BREWGj.js} +1 -1
- package/payload/server/public/assets/{chunk-4TB4RGXK-k-V-xUC9.js → chunk-4TB4RGXK-CWOel6yZ.js} +1 -1
- package/payload/server/public/assets/{chunk-55IACEB6-BY026nUv.js → chunk-55IACEB6-8_6mlBoL.js} +1 -1
- package/payload/server/public/assets/{chunk-5FUZZQ4R-DMLY3acx.js → chunk-5FUZZQ4R-CcBL3hEb.js} +1 -1
- package/payload/server/public/assets/{chunk-5PVQY5BW-Dw-Sd9tl.js → chunk-5PVQY5BW-DpqQNCTE.js} +1 -1
- package/payload/server/public/assets/{chunk-67CJDMHE-Dl7bLJGe.js → chunk-67CJDMHE-D-EZpLie.js} +1 -1
- package/payload/server/public/assets/{chunk-7N4EOEYR-CFBOyqnD.js → chunk-7N4EOEYR-C9Ely26O.js} +1 -1
- package/payload/server/public/assets/{chunk-AA7GKIK3-BnnqjSlh.js → chunk-AA7GKIK3-DZZsYrza.js} +1 -1
- package/payload/server/public/assets/{chunk-BSJP7CBP-DKCTDAZE.js → chunk-BSJP7CBP-B_1DfG3d.js} +1 -1
- package/payload/server/public/assets/{chunk-CIAEETIT-jjeAEkQy.js → chunk-CIAEETIT-Osq5Xgsl.js} +1 -1
- package/payload/server/public/assets/{chunk-EDXVE4YY-DtpX8vYJ.js → chunk-EDXVE4YY-ecraT_D1.js} +1 -1
- package/payload/server/public/assets/{chunk-ENJZ2VHE-TxT7_-ER.js → chunk-ENJZ2VHE-D2_uycym.js} +1 -1
- package/payload/server/public/assets/{chunk-FMBD7UC4-B0zglVlf.js → chunk-FMBD7UC4-CpPyTbk9.js} +1 -1
- package/payload/server/public/assets/{chunk-FOC6F5B3-COVX_UuK.js → chunk-FOC6F5B3-BBUjlBL-.js} +1 -1
- package/payload/server/public/assets/{chunk-ICPOFSXX-CPrjaFl6.js → chunk-ICPOFSXX-BG-5Z4Qz.js} +2 -2
- package/payload/server/public/assets/{chunk-K5T4RW27-Bav1KRIS.js → chunk-K5T4RW27-BQfKdYtk.js} +1 -1
- package/payload/server/public/assets/{chunk-KGLVRYIC-nj7A12cJ.js → chunk-KGLVRYIC-D1pxYesN.js} +1 -1
- package/payload/server/public/assets/{chunk-LIHQZDEY-BmMkL9jD.js → chunk-LIHQZDEY-CwDi08BU.js} +1 -1
- package/payload/server/public/assets/{chunk-ORNJ4GCN-BvGwrI3j.js → chunk-ORNJ4GCN-Dy-V9ZFU.js} +1 -1
- package/payload/server/public/assets/{chunk-OYMX7WX6-CmoWgYtj.js → chunk-OYMX7WX6-Be3df9Kc.js} +1 -1
- package/payload/server/public/assets/chunk-QZHKN3VN-CitInsDb.js +1 -0
- package/payload/server/public/assets/{chunk-U2HBQHQK-stvjyyuR.js → chunk-U2HBQHQK-B1lsc9BA.js} +1 -1
- package/payload/server/public/assets/{chunk-X2U36JSP-qAuy5Y44.js → chunk-X2U36JSP-lSzO6qYV.js} +1 -1
- package/payload/server/public/assets/{chunk-XPW4576I-DpLw5_cw.js → chunk-XPW4576I-BvIgWKZQ.js} +1 -1
- package/payload/server/public/assets/{chunk-YZCP3GAM-Vk12yILs.js → chunk-YZCP3GAM-Bb60_vDO.js} +1 -1
- package/payload/server/public/assets/{chunk-ZZ45TVLE-WJVrlWz_.js → chunk-ZZ45TVLE-Bny6wiCL.js} +1 -1
- package/payload/server/public/assets/classDiagram-6PBFFD2Q-B8ZHYEIL.js +1 -0
- package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-D7TgEwXH.js +1 -0
- package/payload/server/public/assets/clone-C-K4Yq8V.js +1 -0
- package/payload/server/public/assets/{cose-bilkent-S5V4N54A-bCIQHniJ.js → cose-bilkent-S5V4N54A-DsO6VRrT.js} +1 -1
- package/payload/server/public/assets/{dagre--B-g8MLT.js → dagre-DTQyvF-b.js} +1 -1
- package/payload/server/public/assets/{dagre-KV5264BT-BHFfoLq0.js → dagre-KV5264BT-Bd45zu30.js} +1 -1
- package/payload/server/public/assets/data-Dex0L_hs.js +1 -0
- package/payload/server/public/assets/{diagram-5BDNPKRD-TvCFSaXd.js → diagram-5BDNPKRD-B3GfgObm.js} +1 -1
- package/payload/server/public/assets/{diagram-G4DWMVQ6-8flGaFB_.js → diagram-G4DWMVQ6-Ccy_YcB0.js} +1 -1
- package/payload/server/public/assets/{diagram-MMDJMWI5-Dag0WBhV.js → diagram-MMDJMWI5-uOEKrHYy.js} +1 -1
- package/payload/server/public/assets/{diagram-TYMM5635-u7wh2Nwj.js → diagram-TYMM5635-BAWSU1wH.js} +1 -1
- package/payload/server/public/assets/{erDiagram-SMLLAGMA-DBTHDFh_.js → erDiagram-SMLLAGMA-C5SNsoHU.js} +1 -1
- package/payload/server/public/assets/{flatten-CpKIi5d2.js → flatten-ya0TqRLc.js} +1 -1
- package/payload/server/public/assets/{flowDiagram-DWJPFMVM-C4bd2cb-.js → flowDiagram-DWJPFMVM-eGUNT0jC.js} +1 -1
- package/payload/server/public/assets/{ganttDiagram-T4ZO3ILL-DrfpI4Gl.js → ganttDiagram-T4ZO3ILL-ChQD_MQS.js} +1 -1
- package/payload/server/public/assets/gitGraph-7Q5UKJZL-CP3pxYZ8.js +1 -0
- package/payload/server/public/assets/{gitGraphDiagram-UUTBAWPF-a_WyzWRQ.js → gitGraphDiagram-UUTBAWPF-CK5hWyS_.js} +1 -1
- package/payload/server/public/assets/{graph-labels-DznU92XA.js → graph-labels-J48HJ3as.js} +1 -1
- package/payload/server/public/assets/graph-nPeTW1V_.js +51 -0
- package/payload/server/public/assets/{graphlib-B85zmy3s.js → graphlib-DbSkkysa.js} +1 -1
- package/payload/server/public/assets/info-OMHHGYJF-DUz8FRjp.js +1 -0
- package/payload/server/public/assets/infoDiagram-42DDH7IO-CoLeR6OP.js +2 -0
- package/payload/server/public/assets/{isEmpty-C3Vxk1It.js → isEmpty-h-wRi_o9.js} +1 -1
- package/payload/server/public/assets/{ishikawaDiagram-UXIWVN3A-3jXIqGtb.js → ishikawaDiagram-UXIWVN3A-DR685OiM.js} +1 -1
- package/payload/server/public/assets/{journeyDiagram-VCZTEJTY-BXrBb8KE.js → journeyDiagram-VCZTEJTY-DYgyVIQE.js} +1 -1
- package/payload/server/public/assets/{kanban-definition-6JOO6SKY-Dc5vZnuT.js → kanban-definition-6JOO6SKY-BbOYz3ft.js} +1 -1
- package/payload/server/public/assets/{line-x0RuVReA.js → line-BmJuH1ci.js} +1 -1
- package/payload/server/public/assets/{linear-Cdt0EBMa.js → linear-HbmXARXu.js} +1 -1
- package/payload/server/public/assets/{mermaid-parser.core-CBRGDK2w.js → mermaid-parser.core-B9dlRmr6.js} +2 -2
- package/payload/server/public/assets/{mermaid.core-DeYYeYyM.js → mermaid.core-CA_tMkuh.js} +3 -3
- package/payload/server/public/assets/{mindmap-definition-QFDTVHPH-Bw-hRp-Y.js → mindmap-definition-QFDTVHPH-DNfGKB3j.js} +1 -1
- package/payload/server/public/assets/{ordinal-BLrOss5K.js → ordinal-Dwxksj1B.js} +1 -1
- package/payload/server/public/assets/packet-4T2RLAQJ-C-0PIYwM.js +1 -0
- package/payload/server/public/assets/pie-ZZUOXDRM-DUWx5LLr.js +1 -0
- package/payload/server/public/assets/{pieDiagram-DEJITSTG-C2DTjmdf.js → pieDiagram-DEJITSTG-4nplxyR3.js} +1 -1
- package/payload/server/public/assets/{public-tk3PfPWF.js → public-C7o23SFC.js} +3 -3
- package/payload/server/public/assets/{quadrantDiagram-34T5L4WZ-Ffhnv5Ih.js → quadrantDiagram-34T5L4WZ-BuRxivWl.js} +1 -1
- package/payload/server/public/assets/radar-PYXPWWZC-BPW6Hewb.js +1 -0
- package/payload/server/public/assets/{reduce-C5tBOlxC.js → reduce-BUuWaDl2.js} +1 -1
- package/payload/server/public/assets/{requirementDiagram-MS252O5E-y7-gOSmI.js → requirementDiagram-MS252O5E-CX0JWzZW.js} +1 -1
- package/payload/server/public/assets/{sankeyDiagram-XADWPNL6-CMwArh7T.js → sankeyDiagram-XADWPNL6-BPbfY-tX.js} +1 -1
- package/payload/server/public/assets/{sequenceDiagram-FGHM5R23-C8obTGl1.js → sequenceDiagram-FGHM5R23-BgDVnY5n.js} +1 -1
- package/payload/server/public/assets/{stateDiagram-FHFEXIEX-BZHsj7kJ.js → stateDiagram-FHFEXIEX-DZzcTY8N.js} +1 -1
- package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-Bk-yVe98.js +1 -0
- package/payload/server/public/assets/{timeline-definition-GMOUNBTQ-D-fo_L7-.js → timeline-definition-GMOUNBTQ-LRc4oAIn.js} +1 -1
- package/payload/server/public/assets/treeView-SZITEDCU-CfxoEICI.js +1 -0
- package/payload/server/public/assets/treemap-W4RFUUIX-BFC84eoy.js +1 -0
- package/payload/server/public/assets/{useSelectionMode-CQBRZjvc.css → useSelectionMode-s7AH5v9J.css} +1 -1
- package/payload/server/public/assets/{vennDiagram-DHZGUBPP--aEWsS70.js → vennDiagram-DHZGUBPP-D285XuiE.js} +1 -1
- package/payload/server/public/assets/wardley-RL74JXVD-C-mQV2If.js +1 -0
- package/payload/server/public/assets/{wardleyDiagram-NUSXRM2D-DFWrB0Kk.js → wardleyDiagram-NUSXRM2D-55WTCJwx.js} +1 -1
- package/payload/server/public/assets/{xychartDiagram-5P7HB3ND-DZsTZHC6.js → xychartDiagram-5P7HB3ND-mBKutlt4.js} +1 -1
- package/payload/server/public/browser.html +4 -5
- package/payload/server/public/chat.html +5 -5
- package/payload/server/public/data.html +5 -6
- package/payload/server/public/graph.html +6 -7
- package/payload/server/public/index.html +6 -7
- package/payload/server/public/public.html +4 -4
- package/payload/server/server.js +321 -246
- package/payload/server/public/assets/AdminShell-CpRQprdb.js +0 -1
- package/payload/server/public/assets/SidebarSplitter-D0mErwLL.js +0 -1
- package/payload/server/public/assets/admin-BVasculM.js +0 -1
- package/payload/server/public/assets/architecture-YZFGNWBL-B2UAw-4R.js +0 -1
- package/payload/server/public/assets/browser-CwU2ReNI.js +0 -1
- package/payload/server/public/assets/channel-CizJU0ud.js +0 -1
- package/payload/server/public/assets/chat-NxS8JsVQ.js +0 -1
- package/payload/server/public/assets/chunk-426QAEUC-CAPR5ZG1.js +0 -1
- package/payload/server/public/assets/chunk-QZHKN3VN-COXR_N4N.js +0 -1
- package/payload/server/public/assets/classDiagram-6PBFFD2Q-kzz9ab1y.js +0 -1
- package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-NFfOmc0C.js +0 -1
- package/payload/server/public/assets/clone-C15qvnbX.js +0 -1
- package/payload/server/public/assets/data-CebDWao6.js +0 -1
- package/payload/server/public/assets/gitGraph-7Q5UKJZL-CwwaM7ed.js +0 -1
- package/payload/server/public/assets/graph-qR6IbCv1.js +0 -51
- package/payload/server/public/assets/info-OMHHGYJF-CiiU112m.js +0 -1
- package/payload/server/public/assets/infoDiagram-42DDH7IO-g9Re1Ubl.js +0 -2
- package/payload/server/public/assets/packet-4T2RLAQJ-Bq_zPNb3.js +0 -1
- package/payload/server/public/assets/pie-ZZUOXDRM-R-cewHYM.js +0 -1
- package/payload/server/public/assets/radar-PYXPWWZC-CZpBUjmo.js +0 -1
- package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-fK1TrvKX.js +0 -1
- package/payload/server/public/assets/treeView-SZITEDCU-CjsdVrjr.js +0 -1
- package/payload/server/public/assets/treemap-W4RFUUIX-BZ8peN4O.js +0 -1
- package/payload/server/public/assets/wardley-RL74JXVD-BYLmRSDV.js +0 -1
- /package/payload/server/public/assets/{_baseFor-WfS9pKAn.js → _baseFor-Dn4GSmI6.js} +0 -0
- /package/payload/server/public/assets/{array-HeX70jSN.js → array-DJN9YAVf.js} +0 -0
- /package/payload/server/public/assets/{cytoscape.esm-CDZo0kst.js → cytoscape.esm-BcJTl1re.js} +0 -0
- /package/payload/server/public/assets/{defaultLocale-GJwWH1Jr.js → defaultLocale-B4F_XsBB.js} +0 -0
- /package/payload/server/public/assets/{dist-ePW3hz19.js → dist-B7zzC2xF.js} +0 -0
- /package/payload/server/public/assets/{init-BPLPMQ3Y.js → init-DX0Y1qU4.js} +0 -0
- /package/payload/server/public/assets/{katex-CKZ-HWMQ.js → katex-CjHJ1D7d.js} +0 -0
- /package/payload/server/public/assets/{path-YdFzr2W6.js → path-7vUsG-o2.js} +0 -0
- /package/payload/server/public/assets/{rough.esm-HAx67Hnb.js → rough.esm-NLRoWnq-.js} +0 -0
- /package/payload/server/public/assets/{src-DssjGmtU.js → src-CpjuOYjb.js} +0 -0
- /package/payload/server/public/assets/{useSelectionMode-CJ2UADOe.js → useSelectionMode-CFisDuuw.js} +0 -0
package/payload/server/server.js
CHANGED
|
@@ -97,7 +97,7 @@ import {
|
|
|
97
97
|
vncLog,
|
|
98
98
|
walkPremiumBundles,
|
|
99
99
|
writeAdminUserAndPerson
|
|
100
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-7H4KMTMC.js";
|
|
101
101
|
import {
|
|
102
102
|
__commonJS,
|
|
103
103
|
__toESM
|
|
@@ -7707,8 +7707,8 @@ import { basename as basename3, dirname as dirname2 } from "path";
|
|
|
7707
7707
|
import { join as join10 } from "path";
|
|
7708
7708
|
var WEBCHAT_ADMIN_KEY = "webchat-admin";
|
|
7709
7709
|
function createWebchatRoutes(deps) {
|
|
7710
|
-
const
|
|
7711
|
-
|
|
7710
|
+
const app49 = new Hono();
|
|
7711
|
+
app49.post("/send", requireAdminSession, async (c) => {
|
|
7712
7712
|
const body = await c.req.json().catch(() => null);
|
|
7713
7713
|
const text = body?.text;
|
|
7714
7714
|
if (typeof text !== "string" || text.length === 0) {
|
|
@@ -7725,7 +7725,7 @@ function createWebchatRoutes(deps) {
|
|
|
7725
7725
|
await deps.handleInbound({ role: "admin", accountId, key: WEBCHAT_ADMIN_KEY, text });
|
|
7726
7726
|
return c.json({ ok: true });
|
|
7727
7727
|
});
|
|
7728
|
-
|
|
7728
|
+
app49.get("/session", requireAdminSession, (c) => {
|
|
7729
7729
|
let accountId;
|
|
7730
7730
|
try {
|
|
7731
7731
|
accountId = resolvePlatformAccountId();
|
|
@@ -7747,9 +7747,88 @@ function createWebchatRoutes(deps) {
|
|
|
7747
7747
|
}
|
|
7748
7748
|
return c.json({ sessionId, projectDir });
|
|
7749
7749
|
});
|
|
7750
|
-
return
|
|
7750
|
+
return app49;
|
|
7751
7751
|
}
|
|
7752
7752
|
|
|
7753
|
+
// server/routes/webchat-greeting.ts
|
|
7754
|
+
var OUTSTANDING_TASK_STATUSES = ["pending", "active", "running"];
|
|
7755
|
+
var UPCOMING_EVENT_STATUSES = ["scheduled", "due"];
|
|
7756
|
+
var TASK_ITEMS_CAP = 5;
|
|
7757
|
+
var EVENTS_CYPHER = `
|
|
7758
|
+
MATCH (e:Event)
|
|
7759
|
+
WHERE e.accountId = $accountId
|
|
7760
|
+
AND e.eventStatus IN $statuses
|
|
7761
|
+
AND coalesce(e.nextRun, e.startDate) >= $now
|
|
7762
|
+
RETURN e.eventId AS eventId, e.name AS name,
|
|
7763
|
+
coalesce(e.nextRun, e.startDate) AS at
|
|
7764
|
+
ORDER BY at ASC
|
|
7765
|
+
LIMIT 5`;
|
|
7766
|
+
var TASKS_CYPHER = `
|
|
7767
|
+
MATCH (t:Task)
|
|
7768
|
+
WHERE t.accountId = $accountId
|
|
7769
|
+
AND t.status IN $statuses
|
|
7770
|
+
WITH t ORDER BY coalesce(t.createdAt, '') ASC
|
|
7771
|
+
WITH collect({ taskId: t.taskId, name: t.name, status: t.status }) AS all
|
|
7772
|
+
RETURN all[0..${TASK_ITEMS_CAP}] AS items, size(all) AS total`;
|
|
7773
|
+
var app6 = new Hono();
|
|
7774
|
+
app6.get("/", requireAdminSession, async (c) => {
|
|
7775
|
+
const cacheKey = c.var.cacheKey;
|
|
7776
|
+
const accountId = getAccountIdForSession(cacheKey);
|
|
7777
|
+
if (!accountId) {
|
|
7778
|
+
console.error("[webchat:greeting] op=read-failed reason=no-account-for-session");
|
|
7779
|
+
return c.json({ ok: false });
|
|
7780
|
+
}
|
|
7781
|
+
const started = Date.now();
|
|
7782
|
+
let session;
|
|
7783
|
+
try {
|
|
7784
|
+
session = getSession();
|
|
7785
|
+
const { events, tasks } = await session.executeRead(
|
|
7786
|
+
async (tx) => {
|
|
7787
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7788
|
+
const eventsResult = await tx.run(EVENTS_CYPHER, {
|
|
7789
|
+
accountId,
|
|
7790
|
+
statuses: UPCOMING_EVENT_STATUSES,
|
|
7791
|
+
now
|
|
7792
|
+
});
|
|
7793
|
+
const tasksResult = await tx.run(TASKS_CYPHER, {
|
|
7794
|
+
accountId,
|
|
7795
|
+
statuses: OUTSTANDING_TASK_STATUSES
|
|
7796
|
+
});
|
|
7797
|
+
const events2 = eventsResult.records.map((r) => ({
|
|
7798
|
+
eventId: String(r.get("eventId")),
|
|
7799
|
+
name: String(r.get("name")),
|
|
7800
|
+
at: String(r.get("at"))
|
|
7801
|
+
}));
|
|
7802
|
+
const tasksRecord = tasksResult.records[0];
|
|
7803
|
+
const rawTotal = tasksRecord ? r2n(tasksRecord.get("total")) : 0;
|
|
7804
|
+
const tasks2 = {
|
|
7805
|
+
items: tasksRecord ? tasksRecord.get("items") : [],
|
|
7806
|
+
total: rawTotal
|
|
7807
|
+
};
|
|
7808
|
+
return { events: events2, tasks: tasks2 };
|
|
7809
|
+
}
|
|
7810
|
+
);
|
|
7811
|
+
console.log(
|
|
7812
|
+
`[webchat:greeting] op=read account=${accountId.slice(0, 8)} events=${events.length} tasks=${tasks.total} ms=${Date.now() - started}`
|
|
7813
|
+
);
|
|
7814
|
+
return c.json({ ok: true, events, tasks });
|
|
7815
|
+
} catch (err) {
|
|
7816
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
7817
|
+
console.error(`[webchat:greeting] op=read-failed reason=${detail}`);
|
|
7818
|
+
return c.json({ ok: false });
|
|
7819
|
+
} finally {
|
|
7820
|
+
await session?.close();
|
|
7821
|
+
}
|
|
7822
|
+
});
|
|
7823
|
+
function r2n(value) {
|
|
7824
|
+
if (typeof value === "number") return value;
|
|
7825
|
+
if (value && typeof value === "object" && "low" in value) {
|
|
7826
|
+
return Number(value.low);
|
|
7827
|
+
}
|
|
7828
|
+
return Number(value ?? 0);
|
|
7829
|
+
}
|
|
7830
|
+
var webchat_greeting_default = app6;
|
|
7831
|
+
|
|
7753
7832
|
// server/routes/telegram.ts
|
|
7754
7833
|
import { homedir } from "os";
|
|
7755
7834
|
import { resolve as resolve10, join as join11 } from "path";
|
|
@@ -7830,8 +7909,8 @@ async function sendTelegram(botToken, chatId, text) {
|
|
|
7830
7909
|
return { ok: false, error: e instanceof Error ? e.message : String(e) };
|
|
7831
7910
|
}
|
|
7832
7911
|
}
|
|
7833
|
-
var
|
|
7834
|
-
|
|
7912
|
+
var app7 = new Hono();
|
|
7913
|
+
app7.post("/", async (c) => {
|
|
7835
7914
|
const botParam = c.req.query("bot");
|
|
7836
7915
|
const botType = botParam === "admin" ? "admin" : botParam === "public" ? "public" : null;
|
|
7837
7916
|
if (!botType) {
|
|
@@ -7902,7 +7981,7 @@ app6.post("/", async (c) => {
|
|
|
7902
7981
|
})();
|
|
7903
7982
|
return c.json({ ok: true }, 200);
|
|
7904
7983
|
});
|
|
7905
|
-
var telegram_default =
|
|
7984
|
+
var telegram_default = app7;
|
|
7906
7985
|
|
|
7907
7986
|
// server/routes/onboarding.ts
|
|
7908
7987
|
import { spawn, spawnSync as spawnSync2, execFileSync as execFileSync2 } from "child_process";
|
|
@@ -8089,11 +8168,11 @@ async function waitForAuthPage(timeoutMs = 2e4) {
|
|
|
8089
8168
|
}
|
|
8090
8169
|
return false;
|
|
8091
8170
|
}
|
|
8092
|
-
var
|
|
8093
|
-
|
|
8171
|
+
var app8 = new Hono();
|
|
8172
|
+
app8.get("/claude-auth", async (c) => {
|
|
8094
8173
|
return c.json({ authenticated: await checkAuthStatus() });
|
|
8095
8174
|
});
|
|
8096
|
-
|
|
8175
|
+
app8.post("/claude-auth", async (c) => {
|
|
8097
8176
|
let body = {};
|
|
8098
8177
|
try {
|
|
8099
8178
|
body = await c.req.json();
|
|
@@ -8163,7 +8242,7 @@ app7.post("/claude-auth", async (c) => {
|
|
|
8163
8242
|
await waitForAuthPage(2e4);
|
|
8164
8243
|
return c.json({ started: true, transport });
|
|
8165
8244
|
});
|
|
8166
|
-
|
|
8245
|
+
app8.post("/set-pin", async (c) => {
|
|
8167
8246
|
let existingUsers = null;
|
|
8168
8247
|
try {
|
|
8169
8248
|
existingUsers = readUsersFile2();
|
|
@@ -8265,7 +8344,7 @@ ${body.pin}
|
|
|
8265
8344
|
}
|
|
8266
8345
|
return c.json({ ok: true });
|
|
8267
8346
|
});
|
|
8268
|
-
|
|
8347
|
+
app8.delete("/set-pin", async (c) => {
|
|
8269
8348
|
let users = null;
|
|
8270
8349
|
try {
|
|
8271
8350
|
users = readUsersFile2();
|
|
@@ -8299,7 +8378,7 @@ app7.delete("/set-pin", async (c) => {
|
|
|
8299
8378
|
}
|
|
8300
8379
|
return c.json({ ok: true });
|
|
8301
8380
|
});
|
|
8302
|
-
var onboarding_default =
|
|
8381
|
+
var onboarding_default = app8;
|
|
8303
8382
|
|
|
8304
8383
|
// server/routes/client-error.ts
|
|
8305
8384
|
import { appendFileSync, existsSync as existsSync11, renameSync as renameSync2, statSync as statSync6 } from "fs";
|
|
@@ -8355,8 +8434,8 @@ function rotateIfNeeded() {
|
|
|
8355
8434
|
console.error(`[client-error] log rotation failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
8356
8435
|
}
|
|
8357
8436
|
}
|
|
8358
|
-
var
|
|
8359
|
-
|
|
8437
|
+
var app9 = new Hono();
|
|
8438
|
+
app9.post("/", async (c) => {
|
|
8360
8439
|
const client = resolveClientIp(
|
|
8361
8440
|
c.env?.incoming?.socket?.remoteAddress,
|
|
8362
8441
|
c.req.header("x-forwarded-for")
|
|
@@ -8458,7 +8537,7 @@ app8.post("/", async (c) => {
|
|
|
8458
8537
|
}
|
|
8459
8538
|
return c.json({ ok: true });
|
|
8460
8539
|
});
|
|
8461
|
-
var client_error_default =
|
|
8540
|
+
var client_error_default = app9;
|
|
8462
8541
|
|
|
8463
8542
|
// server/routes/admin/session.ts
|
|
8464
8543
|
import { randomUUID as randomUUID8 } from "crypto";
|
|
@@ -8516,8 +8595,8 @@ async function createAdminSession(accountId, thinkingView, userId, userName, rol
|
|
|
8516
8595
|
sessionId: initialSessionId
|
|
8517
8596
|
};
|
|
8518
8597
|
}
|
|
8519
|
-
var
|
|
8520
|
-
|
|
8598
|
+
var app10 = new Hono();
|
|
8599
|
+
app10.get("/", async (c) => {
|
|
8521
8600
|
const signedSessionToken = c.req.query("session_key");
|
|
8522
8601
|
if (!signedSessionToken) {
|
|
8523
8602
|
return c.json({ error: "Invalid or expired admin session" }, 401);
|
|
@@ -8563,7 +8642,7 @@ app9.get("/", async (c) => {
|
|
|
8563
8642
|
sessionId: getSessionIdForSession(cacheKey) ?? null
|
|
8564
8643
|
});
|
|
8565
8644
|
});
|
|
8566
|
-
|
|
8645
|
+
app10.post("/", async (c) => {
|
|
8567
8646
|
let body;
|
|
8568
8647
|
try {
|
|
8569
8648
|
body = await c.req.json();
|
|
@@ -8626,7 +8705,7 @@ app9.post("/", async (c) => {
|
|
|
8626
8705
|
const payload = await createAdminSession(selected.accountId, selected.config.thinkingView, userId, userName, selected.role, avatar);
|
|
8627
8706
|
return c.json(payload);
|
|
8628
8707
|
});
|
|
8629
|
-
var session_default =
|
|
8708
|
+
var session_default = app10;
|
|
8630
8709
|
|
|
8631
8710
|
// server/routes/admin/logs.ts
|
|
8632
8711
|
import { existsSync as existsSync13, readdirSync as readdirSync8, readFileSync as readFileSync14, statSync as statSync7 } from "fs";
|
|
@@ -8649,8 +8728,8 @@ function resolveSessionLogPaths(filename, logDirs) {
|
|
|
8649
8728
|
|
|
8650
8729
|
// server/routes/admin/logs.ts
|
|
8651
8730
|
var TAIL_BYTES = 8192;
|
|
8652
|
-
var
|
|
8653
|
-
|
|
8731
|
+
var app11 = new Hono();
|
|
8732
|
+
app11.get("/", async (c) => {
|
|
8654
8733
|
const fileParam = c.req.query("file");
|
|
8655
8734
|
const typeParam = c.req.query("type");
|
|
8656
8735
|
const sessionIdParam = c.req.query("sessionId");
|
|
@@ -8792,12 +8871,12 @@ app10.get("/", async (c) => {
|
|
|
8792
8871
|
}
|
|
8793
8872
|
return c.json({ logs });
|
|
8794
8873
|
});
|
|
8795
|
-
var logs_default =
|
|
8874
|
+
var logs_default = app11;
|
|
8796
8875
|
|
|
8797
8876
|
// server/routes/admin/claude-info.ts
|
|
8798
8877
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
8799
|
-
var
|
|
8800
|
-
|
|
8878
|
+
var app12 = new Hono();
|
|
8879
|
+
app12.get("/", (c) => {
|
|
8801
8880
|
let version = "unknown";
|
|
8802
8881
|
try {
|
|
8803
8882
|
const raw = execFileSync3("claude", ["--version"], { encoding: "utf-8", timeout: 5e3 });
|
|
@@ -8815,14 +8894,14 @@ app11.get("/", (c) => {
|
|
|
8815
8894
|
const thinkingView = resolvedAccount?.config.thinkingView ?? "default";
|
|
8816
8895
|
return c.json({ version, account, model, thinkingView });
|
|
8817
8896
|
});
|
|
8818
|
-
var claude_info_default =
|
|
8897
|
+
var claude_info_default = app12;
|
|
8819
8898
|
|
|
8820
8899
|
// server/routes/admin/attachment.ts
|
|
8821
8900
|
import { readFile as readFile2, readdir } from "fs/promises";
|
|
8822
8901
|
import { existsSync as existsSync14 } from "fs";
|
|
8823
8902
|
import { resolve as resolve12 } from "path";
|
|
8824
|
-
var
|
|
8825
|
-
|
|
8903
|
+
var app13 = new Hono();
|
|
8904
|
+
app13.get("/:attachmentId", requireAdminSession, async (c) => {
|
|
8826
8905
|
const attachmentId = c.req.param("attachmentId");
|
|
8827
8906
|
const cacheKey = c.var.cacheKey;
|
|
8828
8907
|
const accountId = getAccountIdForSession(cacheKey);
|
|
@@ -8861,13 +8940,13 @@ app12.get("/:attachmentId", requireAdminSession, async (c) => {
|
|
|
8861
8940
|
}
|
|
8862
8941
|
});
|
|
8863
8942
|
});
|
|
8864
|
-
var attachment_default =
|
|
8943
|
+
var attachment_default = app13;
|
|
8865
8944
|
|
|
8866
8945
|
// server/routes/admin/agents.ts
|
|
8867
8946
|
import { resolve as resolve13 } from "path";
|
|
8868
8947
|
import { readdirSync as readdirSync9, readFileSync as readFileSync15, existsSync as existsSync15, rmSync } from "fs";
|
|
8869
|
-
var
|
|
8870
|
-
|
|
8948
|
+
var app14 = new Hono();
|
|
8949
|
+
app14.get("/", (c) => {
|
|
8871
8950
|
const account = resolveAccount();
|
|
8872
8951
|
if (!account) return c.json({ agents: [] });
|
|
8873
8952
|
const agentsDir = resolve13(account.accountDir, "agents");
|
|
@@ -8897,7 +8976,7 @@ app13.get("/", (c) => {
|
|
|
8897
8976
|
}
|
|
8898
8977
|
return c.json({ agents });
|
|
8899
8978
|
});
|
|
8900
|
-
|
|
8979
|
+
app14.delete("/:slug", async (c) => {
|
|
8901
8980
|
const slug = c.req.param("slug");
|
|
8902
8981
|
const account = resolveAccount();
|
|
8903
8982
|
if (!account) return c.json({ error: "No account resolved" }, 400);
|
|
@@ -8927,7 +9006,7 @@ app13.delete("/:slug", async (c) => {
|
|
|
8927
9006
|
return c.json({ error: "Failed to delete agent" }, 500);
|
|
8928
9007
|
}
|
|
8929
9008
|
});
|
|
8930
|
-
|
|
9009
|
+
app14.post("/:slug/project", async (c) => {
|
|
8931
9010
|
const slug = c.req.param("slug");
|
|
8932
9011
|
const account = resolveAccount();
|
|
8933
9012
|
if (!account) return c.json({ error: "No account resolved" }, 400);
|
|
@@ -8949,7 +9028,7 @@ app13.post("/:slug/project", async (c) => {
|
|
|
8949
9028
|
return c.json({ error: `Projection failed: ${msg}` }, 500);
|
|
8950
9029
|
}
|
|
8951
9030
|
});
|
|
8952
|
-
var agents_default =
|
|
9031
|
+
var agents_default = app14;
|
|
8953
9032
|
|
|
8954
9033
|
// server/routes/admin/sessions.ts
|
|
8955
9034
|
import crypto2 from "crypto";
|
|
@@ -9221,8 +9300,8 @@ function formatAge(updatedAtStr) {
|
|
|
9221
9300
|
return "unknown";
|
|
9222
9301
|
}
|
|
9223
9302
|
}
|
|
9224
|
-
var
|
|
9225
|
-
|
|
9303
|
+
var app15 = new Hono();
|
|
9304
|
+
app15.get("/", requireAdminSession, async (c) => {
|
|
9226
9305
|
const cacheKey = c.var.cacheKey;
|
|
9227
9306
|
const accountId = getAccountIdForSession(cacheKey);
|
|
9228
9307
|
if (!accountId) return c.json({ error: "Account not found for session" }, 401);
|
|
@@ -9252,7 +9331,7 @@ app14.get("/", requireAdminSession, async (c) => {
|
|
|
9252
9331
|
return c.json({ error: "Failed to fetch sessions" }, 500);
|
|
9253
9332
|
}
|
|
9254
9333
|
});
|
|
9255
|
-
|
|
9334
|
+
app15.post("/new", requireAdminSession, async (c) => {
|
|
9256
9335
|
const oldCacheKey = c.var.cacheKey;
|
|
9257
9336
|
console.log(`[admin-chat] new-conversation outcome=ingress cacheKey=${oldCacheKey.slice(0, 8)}`);
|
|
9258
9337
|
const accountId = getAccountIdForSession(oldCacheKey);
|
|
@@ -9269,7 +9348,7 @@ app14.post("/new", requireAdminSession, async (c) => {
|
|
|
9269
9348
|
console.log(`[admin-chat] new-conversation outcome=ok oldKey=${oldCacheKey.slice(0, 8)} newKey=${newCacheKey.slice(0, 8)}`);
|
|
9270
9349
|
return c.json({ session_key: newSignedSessionToken, sessionId: null });
|
|
9271
9350
|
});
|
|
9272
|
-
|
|
9351
|
+
app15.post("/switch", requireAdminSession, async (c) => {
|
|
9273
9352
|
const cacheKey = c.var.cacheKey;
|
|
9274
9353
|
const accountId = getAccountIdForSession(cacheKey);
|
|
9275
9354
|
const userId = getUserIdForSession(cacheKey);
|
|
@@ -9297,7 +9376,7 @@ app14.post("/switch", requireAdminSession, async (c) => {
|
|
|
9297
9376
|
console.log(`[session-switch] from=${cacheKey.slice(0, 8)} to=${targetCacheKey.slice(0, 8)} targetConvId=${targetSessionId?.slice(0, 8) ?? "none"} accountId=${accountId.slice(0, 8)}`);
|
|
9298
9377
|
return c.json({ session_key: targetSignedSessionToken, sessionId: targetSessionId });
|
|
9299
9378
|
});
|
|
9300
|
-
|
|
9379
|
+
app15.delete("/:id", requireAdminSession, async (c) => {
|
|
9301
9380
|
const sessionId = c.req.param("id");
|
|
9302
9381
|
const cacheKey = c.var.cacheKey;
|
|
9303
9382
|
const accountId = getAccountIdForSession(cacheKey);
|
|
@@ -9342,7 +9421,7 @@ app14.delete("/:id", requireAdminSession, async (c) => {
|
|
|
9342
9421
|
500
|
|
9343
9422
|
);
|
|
9344
9423
|
});
|
|
9345
|
-
|
|
9424
|
+
app15.post("/:id/resume", async (c) => {
|
|
9346
9425
|
const sessionId = c.req.param("id");
|
|
9347
9426
|
const t0 = Date.now();
|
|
9348
9427
|
const signedSessionToken = c.req.query("session_key") ?? "";
|
|
@@ -9611,7 +9690,7 @@ app14.post("/:id/resume", async (c) => {
|
|
|
9611
9690
|
}
|
|
9612
9691
|
});
|
|
9613
9692
|
});
|
|
9614
|
-
|
|
9693
|
+
app15.put("/:id/label", requireAdminSession, async (c) => {
|
|
9615
9694
|
const sessionId = c.req.param("id");
|
|
9616
9695
|
const cacheKey = c.var.cacheKey;
|
|
9617
9696
|
let body;
|
|
@@ -9637,7 +9716,7 @@ app14.put("/:id/label", requireAdminSession, async (c) => {
|
|
|
9637
9716
|
return c.json({ error: "Failed to rename session" }, 500);
|
|
9638
9717
|
}
|
|
9639
9718
|
});
|
|
9640
|
-
var sessions_default =
|
|
9719
|
+
var sessions_default = app15;
|
|
9641
9720
|
|
|
9642
9721
|
// app/lib/claude-agent/spawn-context.ts
|
|
9643
9722
|
import { existsSync as existsSync17, readFileSync as readFileSync16, readdirSync as readdirSync10, statSync as statSync8 } from "fs";
|
|
@@ -9962,7 +10041,7 @@ async function refuseIfClaudeAuthDead(c, route, sessionId) {
|
|
|
9962
10041
|
503
|
|
9963
10042
|
);
|
|
9964
10043
|
}
|
|
9965
|
-
var
|
|
10044
|
+
var app16 = new Hono();
|
|
9966
10045
|
async function performSpawnWithInitialMessage(args) {
|
|
9967
10046
|
const ownerStart = Date.now();
|
|
9968
10047
|
const aboutOwner = await resolveOwnerProfileBlock(args.senderId, args.userId);
|
|
@@ -10039,8 +10118,8 @@ function mintTranscriptEdge(sessionId, claudeSessionId, accountId) {
|
|
|
10039
10118
|
if (!sessionId || !claudeSessionId) return;
|
|
10040
10119
|
void linkConversationTranscript(sessionId, claudeSessionId, accountId);
|
|
10041
10120
|
}
|
|
10042
|
-
|
|
10043
|
-
|
|
10121
|
+
app16.use("*", requireAdminSession);
|
|
10122
|
+
app16.post("/", async (c) => {
|
|
10044
10123
|
const routeStart = Date.now();
|
|
10045
10124
|
const cacheKey = c.get("cacheKey") ?? "";
|
|
10046
10125
|
let body = {};
|
|
@@ -10083,18 +10162,18 @@ app15.post("/", async (c) => {
|
|
|
10083
10162
|
console.log(`${TAG23} route-done surface=cookie status=${response.status} route-ms=${Date.now() - routeStart}`);
|
|
10084
10163
|
return response;
|
|
10085
10164
|
});
|
|
10086
|
-
var claude_sessions_default =
|
|
10165
|
+
var claude_sessions_default = app16;
|
|
10087
10166
|
|
|
10088
10167
|
// server/routes/admin/log-ingest.ts
|
|
10089
10168
|
var TAG24 = "[log-ingest]";
|
|
10090
10169
|
var TAG_PATTERN = /^[A-Za-z0-9_:-]{1,32}$/;
|
|
10091
10170
|
var LEVELS = /* @__PURE__ */ new Set(["debug", "info", "warn", "error"]);
|
|
10092
10171
|
var MAX_LINE_BYTES = 4096;
|
|
10093
|
-
var
|
|
10172
|
+
var app17 = new Hono();
|
|
10094
10173
|
function isLoopbackAddr(addr) {
|
|
10095
10174
|
return addr === "127.0.0.1" || addr === "::1" || addr === "::ffff:127.0.0.1";
|
|
10096
10175
|
}
|
|
10097
|
-
|
|
10176
|
+
app17.post("/", async (c) => {
|
|
10098
10177
|
const remoteAddr = c.env?.incoming?.socket?.remoteAddress ?? "";
|
|
10099
10178
|
if (!isLoopbackAddr(remoteAddr)) {
|
|
10100
10179
|
console.error(`${TAG24} reject reason=non-loopback remoteAddr=${remoteAddr}`);
|
|
@@ -10137,7 +10216,7 @@ app16.post("/", async (c) => {
|
|
|
10137
10216
|
else console.log(formatted);
|
|
10138
10217
|
return c.json({ ok: true }, 200);
|
|
10139
10218
|
});
|
|
10140
|
-
var log_ingest_default =
|
|
10219
|
+
var log_ingest_default = app17;
|
|
10141
10220
|
|
|
10142
10221
|
// server/routes/admin/events.ts
|
|
10143
10222
|
var ALLOWED_EVENTS = /* @__PURE__ */ new Set([
|
|
@@ -10146,8 +10225,8 @@ var ALLOWED_EVENTS = /* @__PURE__ */ new Set([
|
|
|
10146
10225
|
"device-url:vnc-surface-shown",
|
|
10147
10226
|
"device-url:malformed"
|
|
10148
10227
|
]);
|
|
10149
|
-
var
|
|
10150
|
-
|
|
10228
|
+
var app18 = new Hono();
|
|
10229
|
+
app18.post("/", async (c) => {
|
|
10151
10230
|
const TAG32 = "[admin:events]";
|
|
10152
10231
|
let body;
|
|
10153
10232
|
try {
|
|
@@ -10178,7 +10257,7 @@ app17.post("/", async (c) => {
|
|
|
10178
10257
|
console.error(`[${event}] ${formatted}`);
|
|
10179
10258
|
return c.json({ ok: true });
|
|
10180
10259
|
});
|
|
10181
|
-
var events_default =
|
|
10260
|
+
var events_default = app18;
|
|
10182
10261
|
|
|
10183
10262
|
// server/routes/admin/files.ts
|
|
10184
10263
|
import { createReadStream as createReadStream2 } from "fs";
|
|
@@ -11086,8 +11165,8 @@ async function knowledgeDocOwnedByAccount(accountId, attachmentId) {
|
|
|
11086
11165
|
await session.close();
|
|
11087
11166
|
}
|
|
11088
11167
|
}
|
|
11089
|
-
var
|
|
11090
|
-
|
|
11168
|
+
var app19 = new Hono();
|
|
11169
|
+
app19.get("/", requireAdminSession, async (c) => {
|
|
11091
11170
|
const cacheKey = c.var.cacheKey;
|
|
11092
11171
|
const accountId = getAccountIdForSession(cacheKey);
|
|
11093
11172
|
if (!accountId) {
|
|
@@ -11153,7 +11232,7 @@ app18.get("/", requireAdminSession, async (c) => {
|
|
|
11153
11232
|
return c.json({ error: message }, 500);
|
|
11154
11233
|
}
|
|
11155
11234
|
});
|
|
11156
|
-
|
|
11235
|
+
app19.get("/download", requireAdminSession, async (c) => {
|
|
11157
11236
|
const cacheKey = c.var.cacheKey;
|
|
11158
11237
|
const accountId = getAccountIdForSession(cacheKey);
|
|
11159
11238
|
if (!accountId) {
|
|
@@ -11217,7 +11296,7 @@ app18.get("/download", requireAdminSession, async (c) => {
|
|
|
11217
11296
|
return c.json({ error: message }, 500);
|
|
11218
11297
|
}
|
|
11219
11298
|
});
|
|
11220
|
-
|
|
11299
|
+
app19.post("/upload", requireAdminSession, async (c) => {
|
|
11221
11300
|
const cacheKey = c.var.cacheKey;
|
|
11222
11301
|
const accountId = getAccountIdForSession(cacheKey);
|
|
11223
11302
|
if (!accountId) {
|
|
@@ -11278,7 +11357,7 @@ app18.post("/upload", requireAdminSession, async (c) => {
|
|
|
11278
11357
|
mimeType: file.type
|
|
11279
11358
|
});
|
|
11280
11359
|
});
|
|
11281
|
-
|
|
11360
|
+
app19.delete("/", requireAdminSession, async (c) => {
|
|
11282
11361
|
const cacheKey = c.var.cacheKey;
|
|
11283
11362
|
const accountId = getAccountIdForSession(cacheKey);
|
|
11284
11363
|
if (!accountId) {
|
|
@@ -11354,7 +11433,7 @@ app18.delete("/", requireAdminSession, async (c) => {
|
|
|
11354
11433
|
return c.json({ error: message }, 500);
|
|
11355
11434
|
}
|
|
11356
11435
|
});
|
|
11357
|
-
var files_default =
|
|
11436
|
+
var files_default = app19;
|
|
11358
11437
|
|
|
11359
11438
|
// ../lib/graph-search/src/index.ts
|
|
11360
11439
|
var import_dist = __toESM(require_dist());
|
|
@@ -12119,8 +12198,8 @@ var DEFAULT_LIMIT = 20;
|
|
|
12119
12198
|
var MAX_LIMIT = 2e3;
|
|
12120
12199
|
var MESSAGE_FAMILY_LABELS = ["Message", "UserMessage", "AssistantMessage", "WhatsAppMessage"];
|
|
12121
12200
|
var CONVERSATION_PARENT_LABELS = /* @__PURE__ */ new Set(["AdminConversation", "PublicConversation"]);
|
|
12122
|
-
var
|
|
12123
|
-
|
|
12201
|
+
var app20 = new Hono();
|
|
12202
|
+
app20.get("/", requireAdminSession, async (c) => {
|
|
12124
12203
|
const cacheKey = c.var.cacheKey;
|
|
12125
12204
|
const q = (c.req.query("q") ?? "").trim();
|
|
12126
12205
|
const rawLimit = c.req.query("limit");
|
|
@@ -12256,7 +12335,7 @@ app19.get("/", requireAdminSession, async (c) => {
|
|
|
12256
12335
|
await session.close();
|
|
12257
12336
|
}
|
|
12258
12337
|
});
|
|
12259
|
-
var graph_search_default =
|
|
12338
|
+
var graph_search_default = app20;
|
|
12260
12339
|
|
|
12261
12340
|
// server/routes/admin/graph-subgraph.ts
|
|
12262
12341
|
import neo4j from "neo4j-driver";
|
|
@@ -12340,8 +12419,8 @@ var STRIPPED_PROPERTIES = /* @__PURE__ */ new Set([
|
|
|
12340
12419
|
"otpCode",
|
|
12341
12420
|
"cacheKey"
|
|
12342
12421
|
]);
|
|
12343
|
-
var
|
|
12344
|
-
|
|
12422
|
+
var app21 = new Hono();
|
|
12423
|
+
app21.get("/", requireAdminSession, async (c) => {
|
|
12345
12424
|
const cacheKey = c.var.cacheKey;
|
|
12346
12425
|
const accountId = getAccountIdForSession(cacheKey);
|
|
12347
12426
|
if (!accountId) {
|
|
@@ -12924,12 +13003,12 @@ function pruneNode(node, warnedClasses, conversationWarnings) {
|
|
|
12924
13003
|
}
|
|
12925
13004
|
return trashed ? { id: node.id, labels, properties, trashed: true } : { id: node.id, labels, properties };
|
|
12926
13005
|
}
|
|
12927
|
-
var graph_subgraph_default =
|
|
13006
|
+
var graph_subgraph_default = app21;
|
|
12928
13007
|
|
|
12929
13008
|
// server/routes/admin/graph-delete.ts
|
|
12930
13009
|
var ALLOWED_BY = ["graph-page", "graph-drag-trash", "graph-side-panel-trash"];
|
|
12931
|
-
var
|
|
12932
|
-
|
|
13010
|
+
var app22 = new Hono();
|
|
13011
|
+
app22.post("/", requireAdminSession, async (c) => {
|
|
12933
13012
|
const cacheKey = c.var.cacheKey;
|
|
12934
13013
|
const accountId = getAccountIdForSession(cacheKey);
|
|
12935
13014
|
if (!accountId) {
|
|
@@ -13091,11 +13170,11 @@ app21.post("/", requireAdminSession, async (c) => {
|
|
|
13091
13170
|
}
|
|
13092
13171
|
}
|
|
13093
13172
|
});
|
|
13094
|
-
var graph_delete_default =
|
|
13173
|
+
var graph_delete_default = app22;
|
|
13095
13174
|
|
|
13096
13175
|
// server/routes/admin/graph-restore.ts
|
|
13097
|
-
var
|
|
13098
|
-
|
|
13176
|
+
var app23 = new Hono();
|
|
13177
|
+
app23.post("/", requireAdminSession, async (c) => {
|
|
13099
13178
|
const cacheKey = c.var.cacheKey;
|
|
13100
13179
|
const accountId = getAccountIdForSession(cacheKey);
|
|
13101
13180
|
if (!accountId) {
|
|
@@ -13159,11 +13238,11 @@ app22.post("/", requireAdminSession, async (c) => {
|
|
|
13159
13238
|
}
|
|
13160
13239
|
}
|
|
13161
13240
|
});
|
|
13162
|
-
var graph_restore_default =
|
|
13241
|
+
var graph_restore_default = app23;
|
|
13163
13242
|
|
|
13164
13243
|
// server/routes/admin/graph-labels-in-graph.ts
|
|
13165
|
-
var
|
|
13166
|
-
|
|
13244
|
+
var app24 = new Hono();
|
|
13245
|
+
app24.get("/", requireAdminSession, async (c) => {
|
|
13167
13246
|
const cacheKey = c.var.cacheKey;
|
|
13168
13247
|
const accountId = getAccountIdForSession(cacheKey);
|
|
13169
13248
|
if (!accountId) {
|
|
@@ -13229,11 +13308,11 @@ var LABELS_IN_GRAPH_CYPHER = `
|
|
|
13229
13308
|
sum(halfEdges) AS relDegree
|
|
13230
13309
|
RETURN label, nodeCount, relDegree
|
|
13231
13310
|
`;
|
|
13232
|
-
var graph_labels_in_graph_default =
|
|
13311
|
+
var graph_labels_in_graph_default = app24;
|
|
13233
13312
|
|
|
13234
13313
|
// server/routes/admin/graph-default-view.ts
|
|
13235
|
-
var
|
|
13236
|
-
|
|
13314
|
+
var app25 = new Hono();
|
|
13315
|
+
app25.get("/", requireAdminSession, async (c) => {
|
|
13237
13316
|
const cacheKey = c.var.cacheKey;
|
|
13238
13317
|
const accountId = getAccountIdForSession(cacheKey);
|
|
13239
13318
|
const userId = getUserIdForSession(cacheKey);
|
|
@@ -13271,7 +13350,7 @@ app24.get("/", requireAdminSession, async (c) => {
|
|
|
13271
13350
|
}
|
|
13272
13351
|
}
|
|
13273
13352
|
});
|
|
13274
|
-
|
|
13353
|
+
app25.put("/", requireAdminSession, async (c) => {
|
|
13275
13354
|
const cacheKey = c.var.cacheKey;
|
|
13276
13355
|
const accountId = getAccountIdForSession(cacheKey);
|
|
13277
13356
|
const userId = getUserIdForSession(cacheKey);
|
|
@@ -13360,7 +13439,7 @@ var WRITE_CYPHER = `
|
|
|
13360
13439
|
p.updatedAt = $updatedAt
|
|
13361
13440
|
RETURN p.labels AS labels
|
|
13362
13441
|
`;
|
|
13363
|
-
var graph_default_view_default =
|
|
13442
|
+
var graph_default_view_default = app25;
|
|
13364
13443
|
|
|
13365
13444
|
// server/routes/admin/sidebar-artefacts.ts
|
|
13366
13445
|
import { readdir as readdir4, stat as stat5 } from "fs/promises";
|
|
@@ -13372,8 +13451,8 @@ function toDataRootRelPath(absPath) {
|
|
|
13372
13451
|
if (absPath !== DATA_ROOT && !absPath.startsWith(DATA_ROOT + sep6)) return null;
|
|
13373
13452
|
return relative3(DATA_ROOT, absPath);
|
|
13374
13453
|
}
|
|
13375
|
-
var
|
|
13376
|
-
|
|
13454
|
+
var app26 = new Hono();
|
|
13455
|
+
app26.get("/", requireAdminSession, async (c) => {
|
|
13377
13456
|
const cacheKey = c.var.cacheKey;
|
|
13378
13457
|
const accountId = getAccountIdForSession(cacheKey);
|
|
13379
13458
|
if (!accountId) {
|
|
@@ -13536,11 +13615,11 @@ function isWithin(target, root) {
|
|
|
13536
13615
|
const rel = relative3(root, target);
|
|
13537
13616
|
return !rel.startsWith("..") && !isAbsolute(rel);
|
|
13538
13617
|
}
|
|
13539
|
-
var sidebar_artefacts_default =
|
|
13618
|
+
var sidebar_artefacts_default = app26;
|
|
13540
13619
|
|
|
13541
13620
|
// server/routes/admin/session-delete.ts
|
|
13542
|
-
var
|
|
13543
|
-
|
|
13621
|
+
var app27 = new Hono();
|
|
13622
|
+
app27.post("/", requireAdminSession, async (c) => {
|
|
13544
13623
|
let body;
|
|
13545
13624
|
try {
|
|
13546
13625
|
body = await c.req.json();
|
|
@@ -13578,11 +13657,11 @@ app26.post("/", requireAdminSession, async (c) => {
|
|
|
13578
13657
|
console.error(`[session-delete] sessionId=${sessionId} delete-status=${del.status}`);
|
|
13579
13658
|
return c.json({ error: `manager-status-${del.status}` }, 502);
|
|
13580
13659
|
});
|
|
13581
|
-
var session_delete_default =
|
|
13660
|
+
var session_delete_default = app27;
|
|
13582
13661
|
|
|
13583
13662
|
// server/routes/admin/session-stop.ts
|
|
13584
|
-
var
|
|
13585
|
-
|
|
13663
|
+
var app28 = new Hono();
|
|
13664
|
+
app28.post("/", requireAdminSession, async (c) => {
|
|
13586
13665
|
let body;
|
|
13587
13666
|
try {
|
|
13588
13667
|
body = await c.req.json();
|
|
@@ -13607,11 +13686,11 @@ app27.post("/", requireAdminSession, async (c) => {
|
|
|
13607
13686
|
console.error(`[session-stop] sessionId=${sessionId} manager-status=${res.status}`);
|
|
13608
13687
|
return c.json({ error: `manager-status-${res.status}` }, 502);
|
|
13609
13688
|
});
|
|
13610
|
-
var session_stop_default =
|
|
13689
|
+
var session_stop_default = app28;
|
|
13611
13690
|
|
|
13612
13691
|
// server/routes/admin/session-archive.ts
|
|
13613
|
-
var
|
|
13614
|
-
|
|
13692
|
+
var app29 = new Hono();
|
|
13693
|
+
app29.post("/", requireAdminSession, async (c) => {
|
|
13615
13694
|
let body;
|
|
13616
13695
|
try {
|
|
13617
13696
|
body = await c.req.json();
|
|
@@ -13659,11 +13738,11 @@ app28.post("/", requireAdminSession, async (c) => {
|
|
|
13659
13738
|
console.error(`[session-archive] sessionId=${sessionId.slice(0, 8)} manager-status=${res.status}`);
|
|
13660
13739
|
return c.json({ error: `manager-status-${res.status}` }, 502);
|
|
13661
13740
|
});
|
|
13662
|
-
var session_archive_default =
|
|
13741
|
+
var session_archive_default = app29;
|
|
13663
13742
|
|
|
13664
13743
|
// server/routes/admin/session-rc-spawn.ts
|
|
13665
|
-
var
|
|
13666
|
-
|
|
13744
|
+
var app30 = new Hono();
|
|
13745
|
+
app30.post("/", requireAdminSession, async (c) => {
|
|
13667
13746
|
let body;
|
|
13668
13747
|
try {
|
|
13669
13748
|
body = await c.req.json();
|
|
@@ -13697,7 +13776,7 @@ app29.post("/", requireAdminSession, async (c) => {
|
|
|
13697
13776
|
}
|
|
13698
13777
|
return c.json(parsed ?? {});
|
|
13699
13778
|
});
|
|
13700
|
-
var session_rc_spawn_default =
|
|
13779
|
+
var session_rc_spawn_default = app30;
|
|
13701
13780
|
|
|
13702
13781
|
// server/routes/admin/system-stats.ts
|
|
13703
13782
|
import { readFile as readFile5 } from "fs/promises";
|
|
@@ -13794,8 +13873,8 @@ async function sample() {
|
|
|
13794
13873
|
if (process.platform === "linux") return sampleLinux();
|
|
13795
13874
|
return sampleOsFallback();
|
|
13796
13875
|
}
|
|
13797
|
-
var
|
|
13798
|
-
|
|
13876
|
+
var app31 = new Hono();
|
|
13877
|
+
app31.get("/", async (c) => {
|
|
13799
13878
|
const started = Date.now();
|
|
13800
13879
|
if (!inflight) {
|
|
13801
13880
|
inflight = sample().finally(() => {
|
|
@@ -13818,7 +13897,7 @@ app30.get("/", async (c) => {
|
|
|
13818
13897
|
return c.json({ degraded: true, reason, sampledAtMs: Date.now() });
|
|
13819
13898
|
}
|
|
13820
13899
|
});
|
|
13821
|
-
var system_stats_default =
|
|
13900
|
+
var system_stats_default = app31;
|
|
13822
13901
|
|
|
13823
13902
|
// server/routes/admin/health.ts
|
|
13824
13903
|
import { existsSync as existsSync20, readFileSync as readFileSync18 } from "fs";
|
|
@@ -13863,8 +13942,8 @@ async function probeConversationDb() {
|
|
|
13863
13942
|
});
|
|
13864
13943
|
}
|
|
13865
13944
|
}
|
|
13866
|
-
var
|
|
13867
|
-
|
|
13945
|
+
var app32 = new Hono();
|
|
13946
|
+
app32.get("/", async (c) => {
|
|
13868
13947
|
const version = readVersion();
|
|
13869
13948
|
const probe = await probeConversationDb();
|
|
13870
13949
|
const uptimeMs = Date.now() - new Date(PROCESS_STARTED_AT).getTime();
|
|
@@ -13886,7 +13965,7 @@ app31.get("/", async (c) => {
|
|
|
13886
13965
|
uptimeMs
|
|
13887
13966
|
});
|
|
13888
13967
|
});
|
|
13889
|
-
var health_default2 =
|
|
13968
|
+
var health_default2 = app32;
|
|
13890
13969
|
|
|
13891
13970
|
// server/routes/admin/linkedin-ingest.ts
|
|
13892
13971
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
@@ -13988,8 +14067,8 @@ function buildInitialMessage(env) {
|
|
|
13988
14067
|
}
|
|
13989
14068
|
return header;
|
|
13990
14069
|
}
|
|
13991
|
-
var
|
|
13992
|
-
|
|
14070
|
+
var app33 = new Hono();
|
|
14071
|
+
app33.post("/", requireAdminSession, async (c) => {
|
|
13993
14072
|
let body;
|
|
13994
14073
|
try {
|
|
13995
14074
|
body = await c.req.json();
|
|
@@ -14034,7 +14113,7 @@ app32.post("/", requireAdminSession, async (c) => {
|
|
|
14034
14113
|
);
|
|
14035
14114
|
return c.json({ ok: true, dispatchId: envelope.dispatchId, taskId: spawned.sessionId }, 202);
|
|
14036
14115
|
});
|
|
14037
|
-
var linkedin_ingest_default =
|
|
14116
|
+
var linkedin_ingest_default = app33;
|
|
14038
14117
|
|
|
14039
14118
|
// server/routes/admin/post-turn-context.ts
|
|
14040
14119
|
import neo4j2 from "neo4j-driver";
|
|
@@ -14076,8 +14155,8 @@ function pruneProperties(raw) {
|
|
|
14076
14155
|
}
|
|
14077
14156
|
return out;
|
|
14078
14157
|
}
|
|
14079
|
-
var
|
|
14080
|
-
|
|
14158
|
+
var app34 = new Hono();
|
|
14159
|
+
app34.get("/", async (c) => {
|
|
14081
14160
|
const remoteAddr = c.env?.incoming?.socket?.remoteAddress ?? "";
|
|
14082
14161
|
if (!isLoopbackAddr2(remoteAddr)) {
|
|
14083
14162
|
console.error(`${TAG26} reject reason=non-loopback remoteAddr=${remoteAddr}`);
|
|
@@ -14137,7 +14216,7 @@ app33.get("/", async (c) => {
|
|
|
14137
14216
|
await session.close();
|
|
14138
14217
|
}
|
|
14139
14218
|
});
|
|
14140
|
-
var post_turn_context_default =
|
|
14219
|
+
var post_turn_context_default = app34;
|
|
14141
14220
|
|
|
14142
14221
|
// server/routes/admin/public-session-context.ts
|
|
14143
14222
|
import neo4j3 from "neo4j-driver";
|
|
@@ -14179,8 +14258,8 @@ function pruneProperties2(raw) {
|
|
|
14179
14258
|
}
|
|
14180
14259
|
return out;
|
|
14181
14260
|
}
|
|
14182
|
-
var
|
|
14183
|
-
|
|
14261
|
+
var app35 = new Hono();
|
|
14262
|
+
app35.get("/", async (c) => {
|
|
14184
14263
|
const remoteAddr = c.env?.incoming?.socket?.remoteAddress ?? "";
|
|
14185
14264
|
if (!isLoopbackAddr3(remoteAddr)) {
|
|
14186
14265
|
console.error(`${TAG27} reject reason=non-loopback remoteAddr=${remoteAddr}`);
|
|
@@ -14239,15 +14318,15 @@ app34.get("/", async (c) => {
|
|
|
14239
14318
|
await session.close();
|
|
14240
14319
|
}
|
|
14241
14320
|
});
|
|
14242
|
-
var public_session_context_default =
|
|
14321
|
+
var public_session_context_default = app35;
|
|
14243
14322
|
|
|
14244
14323
|
// server/routes/admin/public-session-exit.ts
|
|
14245
14324
|
var TAG28 = "[public-session-exit-route]";
|
|
14246
14325
|
function isLoopbackAddr4(addr) {
|
|
14247
14326
|
return addr === "127.0.0.1" || addr === "::1" || addr === "::ffff:127.0.0.1";
|
|
14248
14327
|
}
|
|
14249
|
-
var
|
|
14250
|
-
|
|
14328
|
+
var app36 = new Hono();
|
|
14329
|
+
app36.post("/", async (c) => {
|
|
14251
14330
|
const remoteAddr = c.env?.incoming?.socket?.remoteAddress ?? "";
|
|
14252
14331
|
if (!isLoopbackAddr4(remoteAddr)) {
|
|
14253
14332
|
console.error(`${TAG28} reject reason=non-loopback remoteAddr=${remoteAddr}`);
|
|
@@ -14274,15 +14353,15 @@ app35.post("/", async (c) => {
|
|
|
14274
14353
|
handlePublicSessionExit(sessionId);
|
|
14275
14354
|
return c.json({ ok: true });
|
|
14276
14355
|
});
|
|
14277
|
-
var public_session_exit_default =
|
|
14356
|
+
var public_session_exit_default = app36;
|
|
14278
14357
|
|
|
14279
14358
|
// server/routes/admin/access-session-evict.ts
|
|
14280
14359
|
var TAG29 = "[access-session-evict]";
|
|
14281
14360
|
function isLoopbackAddr5(addr) {
|
|
14282
14361
|
return addr === "127.0.0.1" || addr === "::1" || addr === "::ffff:127.0.0.1";
|
|
14283
14362
|
}
|
|
14284
|
-
var
|
|
14285
|
-
|
|
14363
|
+
var app37 = new Hono();
|
|
14364
|
+
app37.post("/", async (c) => {
|
|
14286
14365
|
const remoteAddr = c.env?.incoming?.socket?.remoteAddress ?? "";
|
|
14287
14366
|
if (!isLoopbackAddr5(remoteAddr)) {
|
|
14288
14367
|
console.error(`${TAG29} reject reason=non-loopback remoteAddr=${remoteAddr}`);
|
|
@@ -14310,11 +14389,11 @@ app36.post("/", async (c) => {
|
|
|
14310
14389
|
console.log(`${TAG29} grantId=${grantId} dropped=${dropped}`);
|
|
14311
14390
|
return c.json({ ok: true, dropped });
|
|
14312
14391
|
});
|
|
14313
|
-
var access_session_evict_default =
|
|
14392
|
+
var access_session_evict_default = app37;
|
|
14314
14393
|
|
|
14315
14394
|
// server/routes/admin/browser.ts
|
|
14316
|
-
var
|
|
14317
|
-
|
|
14395
|
+
var app38 = new Hono();
|
|
14396
|
+
app38.post("/launch", requireAdminSession, async (c) => {
|
|
14318
14397
|
try {
|
|
14319
14398
|
const transport = resolveBrowserTransport(c.req.raw, c.env?.incoming?.socket?.remoteAddress);
|
|
14320
14399
|
console.error(`[admin/browser/launch] op=request transport=${transport}`);
|
|
@@ -14342,41 +14421,41 @@ app37.post("/launch", requireAdminSession, async (c) => {
|
|
|
14342
14421
|
);
|
|
14343
14422
|
}
|
|
14344
14423
|
});
|
|
14345
|
-
var browser_default =
|
|
14424
|
+
var browser_default = app38;
|
|
14346
14425
|
|
|
14347
14426
|
// server/routes/admin/index.ts
|
|
14348
|
-
var
|
|
14349
|
-
|
|
14350
|
-
|
|
14351
|
-
|
|
14352
|
-
|
|
14353
|
-
|
|
14354
|
-
|
|
14355
|
-
|
|
14356
|
-
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
|
|
14363
|
-
|
|
14364
|
-
|
|
14365
|
-
|
|
14366
|
-
|
|
14367
|
-
|
|
14368
|
-
|
|
14369
|
-
|
|
14370
|
-
|
|
14371
|
-
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
|
|
14375
|
-
|
|
14376
|
-
|
|
14377
|
-
|
|
14378
|
-
|
|
14379
|
-
var admin_default =
|
|
14427
|
+
var app39 = new Hono();
|
|
14428
|
+
app39.route("/session", session_default);
|
|
14429
|
+
app39.route("/logs", logs_default);
|
|
14430
|
+
app39.route("/claude-info", claude_info_default);
|
|
14431
|
+
app39.route("/attachment", attachment_default);
|
|
14432
|
+
app39.route("/agents", agents_default);
|
|
14433
|
+
app39.route("/sessions", sessions_default);
|
|
14434
|
+
app39.route("/claude-sessions", claude_sessions_default);
|
|
14435
|
+
app39.route("/log-ingest", log_ingest_default);
|
|
14436
|
+
app39.route("/events", events_default);
|
|
14437
|
+
app39.route("/files", files_default);
|
|
14438
|
+
app39.route("/graph-search", graph_search_default);
|
|
14439
|
+
app39.route("/graph-subgraph", graph_subgraph_default);
|
|
14440
|
+
app39.route("/graph-delete", graph_delete_default);
|
|
14441
|
+
app39.route("/graph-restore", graph_restore_default);
|
|
14442
|
+
app39.route("/graph-labels-in-graph", graph_labels_in_graph_default);
|
|
14443
|
+
app39.route("/graph-default-view", graph_default_view_default);
|
|
14444
|
+
app39.route("/sidebar-artefacts", sidebar_artefacts_default);
|
|
14445
|
+
app39.route("/sidebar-sessions", sidebar_sessions_default);
|
|
14446
|
+
app39.route("/session-delete", session_delete_default);
|
|
14447
|
+
app39.route("/session-stop", session_stop_default);
|
|
14448
|
+
app39.route("/session-archive", session_archive_default);
|
|
14449
|
+
app39.route("/browser", browser_default);
|
|
14450
|
+
app39.route("/session-rc-spawn", session_rc_spawn_default);
|
|
14451
|
+
app39.route("/system-stats", system_stats_default);
|
|
14452
|
+
app39.route("/health-brand", health_default2);
|
|
14453
|
+
app39.route("/linkedin-ingest", linkedin_ingest_default);
|
|
14454
|
+
app39.route("/post-turn-context", post_turn_context_default);
|
|
14455
|
+
app39.route("/public-session-context", public_session_context_default);
|
|
14456
|
+
app39.route("/public-session-exit", public_session_exit_default);
|
|
14457
|
+
app39.route("/access-session-evict", access_session_evict_default);
|
|
14458
|
+
var admin_default = app39;
|
|
14380
14459
|
|
|
14381
14460
|
// app/lib/access-gate.ts
|
|
14382
14461
|
import neo4j4 from "neo4j-driver";
|
|
@@ -14590,8 +14669,8 @@ async function generateNewMagicToken(grantId) {
|
|
|
14590
14669
|
var TAG30 = "[access-verify]";
|
|
14591
14670
|
var MINT_TAG = "[access-session-mint]";
|
|
14592
14671
|
var COOKIE_NAME = "__access_session";
|
|
14593
|
-
var
|
|
14594
|
-
|
|
14672
|
+
var app40 = new Hono();
|
|
14673
|
+
app40.post("/", async (c) => {
|
|
14595
14674
|
const ip = c.var.clientIp || "unknown";
|
|
14596
14675
|
let body;
|
|
14597
14676
|
try {
|
|
@@ -14673,7 +14752,7 @@ app39.post("/", async (c) => {
|
|
|
14673
14752
|
displayName: grant.displayName
|
|
14674
14753
|
});
|
|
14675
14754
|
});
|
|
14676
|
-
var verify_token_default =
|
|
14755
|
+
var verify_token_default = app40;
|
|
14677
14756
|
|
|
14678
14757
|
// app/lib/access-email.ts
|
|
14679
14758
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -14736,9 +14815,9 @@ async function sendMagicLinkEmail(payload) {
|
|
|
14736
14815
|
|
|
14737
14816
|
// server/routes/access/request-magic-link.ts
|
|
14738
14817
|
var TAG31 = "[access-request-link]";
|
|
14739
|
-
var
|
|
14818
|
+
var app41 = new Hono();
|
|
14740
14819
|
var VISITOR_MESSAGE = "If that email is on the invite list, a fresh link is on the way.";
|
|
14741
|
-
|
|
14820
|
+
app41.post("/", async (c) => {
|
|
14742
14821
|
let body;
|
|
14743
14822
|
try {
|
|
14744
14823
|
body = await c.req.json();
|
|
@@ -14812,13 +14891,13 @@ app40.post("/", async (c) => {
|
|
|
14812
14891
|
);
|
|
14813
14892
|
return c.json({ message: VISITOR_MESSAGE }, 200);
|
|
14814
14893
|
});
|
|
14815
|
-
var request_magic_link_default =
|
|
14894
|
+
var request_magic_link_default = app41;
|
|
14816
14895
|
|
|
14817
14896
|
// server/routes/access/index.ts
|
|
14818
|
-
var
|
|
14819
|
-
|
|
14820
|
-
|
|
14821
|
-
var access_default =
|
|
14897
|
+
var app42 = new Hono();
|
|
14898
|
+
app42.route("/verify-token", verify_token_default);
|
|
14899
|
+
app42.route("/request-magic-link", request_magic_link_default);
|
|
14900
|
+
var access_default = app42;
|
|
14822
14901
|
|
|
14823
14902
|
// server/routes/sites.ts
|
|
14824
14903
|
import { existsSync as existsSync21, readFileSync as readFileSync20, realpathSync as realpathSync5, statSync as statSync9 } from "fs";
|
|
@@ -14853,8 +14932,8 @@ function getExt(p) {
|
|
|
14853
14932
|
if (idx < p.lastIndexOf("/")) return "";
|
|
14854
14933
|
return p.slice(idx).toLowerCase();
|
|
14855
14934
|
}
|
|
14856
|
-
var
|
|
14857
|
-
|
|
14935
|
+
var app43 = new Hono();
|
|
14936
|
+
app43.get("/:rel{.*}", (c) => {
|
|
14858
14937
|
const reqPath = c.req.path;
|
|
14859
14938
|
const rawRel = c.req.param("rel") ?? "";
|
|
14860
14939
|
const trimmed = rawRel.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
@@ -14957,7 +15036,7 @@ app42.get("/:rel{.*}", (c) => {
|
|
|
14957
15036
|
"X-Content-Type-Options": "nosniff"
|
|
14958
15037
|
});
|
|
14959
15038
|
});
|
|
14960
|
-
var sites_default =
|
|
15039
|
+
var sites_default = app43;
|
|
14961
15040
|
|
|
14962
15041
|
// app/lib/visitor-token.ts
|
|
14963
15042
|
import { createHmac, randomBytes, timingSafeEqual } from "crypto";
|
|
@@ -15057,7 +15136,7 @@ function readBrandConfig() {
|
|
|
15057
15136
|
}
|
|
15058
15137
|
|
|
15059
15138
|
// server/routes/visitor-consent.ts
|
|
15060
|
-
var
|
|
15139
|
+
var app44 = new Hono();
|
|
15061
15140
|
var CONSENT_COOKIE_NAME = "mxy_consent";
|
|
15062
15141
|
var CONSENT_COOKIE_MAX_AGE_SECONDS = 60 * 60 * 24 * 365;
|
|
15063
15142
|
var DEFAULT_CONSENT_COPY = {
|
|
@@ -15102,17 +15181,17 @@ function siteSlugFromReferer(referer) {
|
|
|
15102
15181
|
return "";
|
|
15103
15182
|
}
|
|
15104
15183
|
}
|
|
15105
|
-
|
|
15184
|
+
app44.options("/consent", (c) => {
|
|
15106
15185
|
const origin = getOrigin(c);
|
|
15107
15186
|
setCorsHeaders(c, origin);
|
|
15108
15187
|
return c.body(null, 204);
|
|
15109
15188
|
});
|
|
15110
|
-
|
|
15189
|
+
app44.options("/brand-config", (c) => {
|
|
15111
15190
|
const origin = getOrigin(c);
|
|
15112
15191
|
setCorsHeaders(c, origin);
|
|
15113
15192
|
return c.body(null, 204);
|
|
15114
15193
|
});
|
|
15115
|
-
|
|
15194
|
+
app44.post("/consent", async (c) => {
|
|
15116
15195
|
const origin = getOrigin(c);
|
|
15117
15196
|
setCorsHeaders(c, origin);
|
|
15118
15197
|
let raw;
|
|
@@ -15152,7 +15231,7 @@ app43.post("/consent", async (c) => {
|
|
|
15152
15231
|
console.log(`[consent] ${parsed.decision} site=${site} brand=${brandName} tokenBound=${tokenBound}`);
|
|
15153
15232
|
return c.body(null, 204);
|
|
15154
15233
|
});
|
|
15155
|
-
|
|
15234
|
+
app44.get("/brand-config", (c) => {
|
|
15156
15235
|
const origin = getOrigin(c);
|
|
15157
15236
|
setCorsHeaders(c, origin);
|
|
15158
15237
|
const brand = readBrandConfig();
|
|
@@ -15162,7 +15241,7 @@ app43.get("/brand-config", (c) => {
|
|
|
15162
15241
|
c.header("Cache-Control", "public, max-age=300");
|
|
15163
15242
|
return c.json({ consent: { copy, palette } });
|
|
15164
15243
|
});
|
|
15165
|
-
var visitor_consent_default =
|
|
15244
|
+
var visitor_consent_default = app44;
|
|
15166
15245
|
|
|
15167
15246
|
// server/routes/listings.ts
|
|
15168
15247
|
function getCookie(headerValue, name) {
|
|
@@ -15189,8 +15268,8 @@ function appendConsentParams(pageUrl, token) {
|
|
|
15189
15268
|
}
|
|
15190
15269
|
var SAFE_SLUG_RE = /^[a-z0-9](?:[a-z0-9-]{0,118}[a-z0-9])?$/;
|
|
15191
15270
|
var CHAT_SESSION_KEY_RE = /^[A-Za-z0-9][A-Za-z0-9_-]{7,127}$/;
|
|
15192
|
-
var
|
|
15193
|
-
|
|
15271
|
+
var app45 = new Hono();
|
|
15272
|
+
app45.get("/:slug/click", async (c) => {
|
|
15194
15273
|
const slug = c.req.param("slug") ?? "";
|
|
15195
15274
|
const rawSession = c.req.query("session") ?? "";
|
|
15196
15275
|
const sessionKey = CHAT_SESSION_KEY_RE.test(rawSession) ? rawSession : "invalid";
|
|
@@ -15254,10 +15333,10 @@ app44.get("/:slug/click", async (c) => {
|
|
|
15254
15333
|
console.log(`[property-card-click] sessionKey=${sessionKey} listingSlug=${slug} consent=${consentCookie ?? "absent"} ts=${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
15255
15334
|
return c.redirect(redirectUrl, 302);
|
|
15256
15335
|
});
|
|
15257
|
-
var listings_default =
|
|
15336
|
+
var listings_default = app45;
|
|
15258
15337
|
|
|
15259
15338
|
// server/routes/visitor-event.ts
|
|
15260
|
-
var
|
|
15339
|
+
var app46 = new Hono();
|
|
15261
15340
|
var BOT_UA_RE = /\b(bot|crawl|spider|slurp|headlesschrome|phantomjs|googlebot|bingbot|yandex|baiduspider|ahrefsbot|semrushbot|mj12bot|dotbot|petalbot)\b/i;
|
|
15262
15341
|
var buckets = /* @__PURE__ */ new Map();
|
|
15263
15342
|
var RATE_LIMIT = 60;
|
|
@@ -15324,12 +15403,12 @@ function originAllowed(origin, allowlist) {
|
|
|
15324
15403
|
return false;
|
|
15325
15404
|
}
|
|
15326
15405
|
}
|
|
15327
|
-
|
|
15406
|
+
app46.options("/event", (c) => {
|
|
15328
15407
|
const origin = getOrigin2(c);
|
|
15329
15408
|
setCorsHeaders2(c, origin);
|
|
15330
15409
|
return c.body(null, 204);
|
|
15331
15410
|
});
|
|
15332
|
-
|
|
15411
|
+
app46.post("/event", async (c) => {
|
|
15333
15412
|
const origin = getOrigin2(c);
|
|
15334
15413
|
setCorsHeaders2(c, origin);
|
|
15335
15414
|
const ua = c.req.header("user-agent") ?? "";
|
|
@@ -15534,7 +15613,7 @@ async function writeEvent(opts) {
|
|
|
15534
15613
|
);
|
|
15535
15614
|
}
|
|
15536
15615
|
}
|
|
15537
|
-
var visitor_event_default =
|
|
15616
|
+
var visitor_event_default = app46;
|
|
15538
15617
|
|
|
15539
15618
|
// server/routes/session.ts
|
|
15540
15619
|
import { resolve as resolve24 } from "path";
|
|
@@ -15580,8 +15659,8 @@ function withVisitorCookie(response, visitorId) {
|
|
|
15580
15659
|
headers
|
|
15581
15660
|
});
|
|
15582
15661
|
}
|
|
15583
|
-
var
|
|
15584
|
-
|
|
15662
|
+
var app47 = new Hono();
|
|
15663
|
+
app47.post("/", async (c) => {
|
|
15585
15664
|
let body;
|
|
15586
15665
|
try {
|
|
15587
15666
|
body = await c.req.json();
|
|
@@ -15792,7 +15871,7 @@ app46.post("/", async (c) => {
|
|
|
15792
15871
|
newVisitorId
|
|
15793
15872
|
);
|
|
15794
15873
|
});
|
|
15795
|
-
var session_default2 =
|
|
15874
|
+
var session_default2 = app47;
|
|
15796
15875
|
|
|
15797
15876
|
// app/lib/graph-health.ts
|
|
15798
15877
|
var import_dist4 = __toESM(require_dist3(), 1);
|
|
@@ -16282,8 +16361,8 @@ var streamSSE = (c, cb, onError) => {
|
|
|
16282
16361
|
|
|
16283
16362
|
// app/lib/whatsapp/gateway/routes.ts
|
|
16284
16363
|
function createWaChannelRoutes(deps) {
|
|
16285
|
-
const
|
|
16286
|
-
|
|
16364
|
+
const app49 = new Hono();
|
|
16365
|
+
app49.get("/wa-channel/inbound", (c) => {
|
|
16287
16366
|
const senderId = c.req.query("senderId");
|
|
16288
16367
|
if (!senderId) return c.json({ error: "senderId required" }, 400);
|
|
16289
16368
|
return streamSSE(c, async (stream2) => {
|
|
@@ -16301,7 +16380,7 @@ function createWaChannelRoutes(deps) {
|
|
|
16301
16380
|
}
|
|
16302
16381
|
});
|
|
16303
16382
|
});
|
|
16304
|
-
|
|
16383
|
+
app49.post("/wa-channel/reply", async (c) => {
|
|
16305
16384
|
const body = await c.req.json().catch(() => null);
|
|
16306
16385
|
const senderId = body?.senderId;
|
|
16307
16386
|
const text = body?.text;
|
|
@@ -16322,7 +16401,7 @@ function createWaChannelRoutes(deps) {
|
|
|
16322
16401
|
console.error(`[whatsapp-native] op=reply-dispatch senderId=${senderId} bytes=${bytes}`);
|
|
16323
16402
|
return c.json({ ok: true });
|
|
16324
16403
|
});
|
|
16325
|
-
|
|
16404
|
+
app49.post("/wa-channel/reply-document", async (c) => {
|
|
16326
16405
|
const body = await c.req.json().catch(() => null);
|
|
16327
16406
|
const senderId = body?.senderId;
|
|
16328
16407
|
const files = body?.files;
|
|
@@ -16361,7 +16440,7 @@ function createWaChannelRoutes(deps) {
|
|
|
16361
16440
|
}
|
|
16362
16441
|
return c.json({ ok: true, results });
|
|
16363
16442
|
});
|
|
16364
|
-
|
|
16443
|
+
app49.post("/wa-channel/ready", async (c) => {
|
|
16365
16444
|
const body = await c.req.json().catch(() => null);
|
|
16366
16445
|
const senderId = body?.senderId;
|
|
16367
16446
|
if (typeof senderId !== "string") {
|
|
@@ -16370,7 +16449,7 @@ function createWaChannelRoutes(deps) {
|
|
|
16370
16449
|
deps.onReady?.(senderId);
|
|
16371
16450
|
return c.json({ ok: true });
|
|
16372
16451
|
});
|
|
16373
|
-
|
|
16452
|
+
app49.post("/wa-channel/received", async (c) => {
|
|
16374
16453
|
const body = await c.req.json().catch(() => null);
|
|
16375
16454
|
const senderId = body?.senderId;
|
|
16376
16455
|
const waMessageId = body?.waMessageId;
|
|
@@ -16380,7 +16459,7 @@ function createWaChannelRoutes(deps) {
|
|
|
16380
16459
|
deps.onReceived?.(senderId, waMessageId);
|
|
16381
16460
|
return c.json({ ok: true });
|
|
16382
16461
|
});
|
|
16383
|
-
return
|
|
16462
|
+
return app49;
|
|
16384
16463
|
}
|
|
16385
16464
|
|
|
16386
16465
|
// app/lib/whatsapp/gateway/wa-gateway.ts
|
|
@@ -16611,8 +16690,8 @@ var InboundHub2 = class {
|
|
|
16611
16690
|
|
|
16612
16691
|
// app/lib/webchat/gateway/routes.ts
|
|
16613
16692
|
function createWebchatChannelRoutes(deps) {
|
|
16614
|
-
const
|
|
16615
|
-
|
|
16693
|
+
const app49 = new Hono();
|
|
16694
|
+
app49.get("/webchat-channel/inbound", (c) => {
|
|
16616
16695
|
const key = c.req.query("key");
|
|
16617
16696
|
if (!key) return c.json({ error: "key required" }, 400);
|
|
16618
16697
|
return streamSSE(c, async (stream2) => {
|
|
@@ -16630,7 +16709,7 @@ function createWebchatChannelRoutes(deps) {
|
|
|
16630
16709
|
}
|
|
16631
16710
|
});
|
|
16632
16711
|
});
|
|
16633
|
-
|
|
16712
|
+
app49.post("/webchat-channel/reply", async (c) => {
|
|
16634
16713
|
const body = await c.req.json().catch(() => null);
|
|
16635
16714
|
const key = body?.key;
|
|
16636
16715
|
const text = body?.text;
|
|
@@ -16640,7 +16719,7 @@ function createWebchatChannelRoutes(deps) {
|
|
|
16640
16719
|
deps.onReply?.(key, Buffer.byteLength(text, "utf8"));
|
|
16641
16720
|
return c.json({ ok: true });
|
|
16642
16721
|
});
|
|
16643
|
-
|
|
16722
|
+
app49.post("/webchat-channel/ready", async (c) => {
|
|
16644
16723
|
const body = await c.req.json().catch(() => null);
|
|
16645
16724
|
const key = body?.key;
|
|
16646
16725
|
if (typeof key !== "string") {
|
|
@@ -16649,7 +16728,7 @@ function createWebchatChannelRoutes(deps) {
|
|
|
16649
16728
|
deps.onReady?.(key);
|
|
16650
16729
|
return c.json({ ok: true });
|
|
16651
16730
|
});
|
|
16652
|
-
|
|
16731
|
+
app49.post("/webchat-channel/received", async (c) => {
|
|
16653
16732
|
const body = await c.req.json().catch(() => null);
|
|
16654
16733
|
const key = body?.key;
|
|
16655
16734
|
const messageId = body?.messageId;
|
|
@@ -16659,7 +16738,7 @@ function createWebchatChannelRoutes(deps) {
|
|
|
16659
16738
|
deps.onReceived?.(key, messageId);
|
|
16660
16739
|
return c.json({ ok: true });
|
|
16661
16740
|
});
|
|
16662
|
-
return
|
|
16741
|
+
return app49;
|
|
16663
16742
|
}
|
|
16664
16743
|
|
|
16665
16744
|
// app/lib/webchat/gateway/webchat-gateway.ts
|
|
@@ -17158,7 +17237,7 @@ watchFile(ALIAS_DOMAINS_PATH, { interval: 2e3 }, () => {
|
|
|
17158
17237
|
function isPublicHost(host) {
|
|
17159
17238
|
return host.startsWith("public.") || aliasDomains.has(host);
|
|
17160
17239
|
}
|
|
17161
|
-
var
|
|
17240
|
+
var app48 = new Hono();
|
|
17162
17241
|
var nativeFileFollowers = /* @__PURE__ */ new Map();
|
|
17163
17242
|
var waGateway = new WaGateway({
|
|
17164
17243
|
gatewayUrl: `http://127.0.0.1:${process.env.MAXY_UI_INTERNAL_PORT ?? ""}`,
|
|
@@ -17214,7 +17293,7 @@ var waGateway = new WaGateway({
|
|
|
17214
17293
|
nativeFileFollowers.set(senderId, ac);
|
|
17215
17294
|
}
|
|
17216
17295
|
});
|
|
17217
|
-
|
|
17296
|
+
app48.route("/", waGateway.routes());
|
|
17218
17297
|
waGateway.startSweeper();
|
|
17219
17298
|
var webchatGateway = new WebchatGateway({
|
|
17220
17299
|
gatewayUrl: `http://127.0.0.1:${process.env.MAXY_UI_INTERNAL_PORT ?? ""}`,
|
|
@@ -17237,10 +17316,10 @@ var webchatGateway = new WebchatGateway({
|
|
|
17237
17316
|
}
|
|
17238
17317
|
}
|
|
17239
17318
|
});
|
|
17240
|
-
|
|
17319
|
+
app48.route("/", webchatGateway.routes());
|
|
17241
17320
|
webchatGateway.startSweeper();
|
|
17242
|
-
|
|
17243
|
-
|
|
17321
|
+
app48.use("*", clientIpMiddleware);
|
|
17322
|
+
app48.use("*", async (c, next) => {
|
|
17244
17323
|
await next();
|
|
17245
17324
|
c.header("X-Content-Type-Options", "nosniff");
|
|
17246
17325
|
c.header("Referrer-Policy", "strict-origin-when-cross-origin");
|
|
@@ -17250,7 +17329,7 @@ app47.use("*", async (c, next) => {
|
|
|
17250
17329
|
);
|
|
17251
17330
|
});
|
|
17252
17331
|
var HTTP_LOG_PATHS = /* @__PURE__ */ new Set(["/vnc-viewer.html", "/vnc-popout.html"]);
|
|
17253
|
-
|
|
17332
|
+
app48.use("*", async (c, next) => {
|
|
17254
17333
|
if (!HTTP_LOG_PATHS.has(c.req.path)) {
|
|
17255
17334
|
await next();
|
|
17256
17335
|
return;
|
|
@@ -17268,7 +17347,7 @@ app47.use("*", async (c, next) => {
|
|
|
17268
17347
|
});
|
|
17269
17348
|
}
|
|
17270
17349
|
});
|
|
17271
|
-
|
|
17350
|
+
app48.use("*", async (c, next) => {
|
|
17272
17351
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
17273
17352
|
if (!isPublicHost(host)) {
|
|
17274
17353
|
await next();
|
|
@@ -17299,7 +17378,7 @@ function resolveRemoteAuthOpts() {
|
|
|
17299
17378
|
return brandLoginOpts;
|
|
17300
17379
|
}
|
|
17301
17380
|
var MAX_LOGIN_BODY = 8 * 1024;
|
|
17302
|
-
|
|
17381
|
+
app48.post("/__remote-auth/login", async (c) => {
|
|
17303
17382
|
const client = clientFrom(c);
|
|
17304
17383
|
const clientIp = client.ip || "unknown";
|
|
17305
17384
|
if (!requestIsTlsTerminated(c)) {
|
|
@@ -17344,7 +17423,7 @@ app47.post("/__remote-auth/login", async (c) => {
|
|
|
17344
17423
|
}
|
|
17345
17424
|
});
|
|
17346
17425
|
});
|
|
17347
|
-
|
|
17426
|
+
app48.get("/__remote-auth/logout", (c) => {
|
|
17348
17427
|
const client = clientFrom(c);
|
|
17349
17428
|
const clientIp = client.ip || "unknown";
|
|
17350
17429
|
console.error(`[remote-auth] logout ip=${clientIp}`);
|
|
@@ -17357,7 +17436,7 @@ app47.get("/__remote-auth/logout", (c) => {
|
|
|
17357
17436
|
}
|
|
17358
17437
|
});
|
|
17359
17438
|
});
|
|
17360
|
-
|
|
17439
|
+
app48.post("/__remote-auth/change-password", async (c) => {
|
|
17361
17440
|
const client = clientFrom(c);
|
|
17362
17441
|
const clientIp = client.ip || "unknown";
|
|
17363
17442
|
const rateLimited = checkRateLimit(client);
|
|
@@ -17408,13 +17487,13 @@ app47.post("/__remote-auth/change-password", async (c) => {
|
|
|
17408
17487
|
return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(), mode: "change", changeError: "Failed to save password", redirect }), 200);
|
|
17409
17488
|
}
|
|
17410
17489
|
});
|
|
17411
|
-
|
|
17490
|
+
app48.get("/__remote-auth/setup", (c) => {
|
|
17412
17491
|
if (isRemoteAuthConfigured()) {
|
|
17413
17492
|
return c.redirect("/");
|
|
17414
17493
|
}
|
|
17415
17494
|
return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(), mode: "setup" }), 200);
|
|
17416
17495
|
});
|
|
17417
|
-
|
|
17496
|
+
app48.post("/__remote-auth/set-initial-password", async (c) => {
|
|
17418
17497
|
if (isRemoteAuthConfigured()) {
|
|
17419
17498
|
return c.redirect("/");
|
|
17420
17499
|
}
|
|
@@ -17452,10 +17531,10 @@ app47.post("/__remote-auth/set-initial-password", async (c) => {
|
|
|
17452
17531
|
return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(), mode: "setup", setupError: "Failed to save password. Please try again." }), 200);
|
|
17453
17532
|
}
|
|
17454
17533
|
});
|
|
17455
|
-
|
|
17534
|
+
app48.get("/api/remote-auth/status", (c) => {
|
|
17456
17535
|
return c.json({ configured: isRemoteAuthConfigured() });
|
|
17457
17536
|
});
|
|
17458
|
-
|
|
17537
|
+
app48.post("/api/remote-auth/set-password", async (c) => {
|
|
17459
17538
|
let body;
|
|
17460
17539
|
try {
|
|
17461
17540
|
body = await c.req.json();
|
|
@@ -17486,9 +17565,9 @@ app47.post("/api/remote-auth/set-password", async (c) => {
|
|
|
17486
17565
|
return c.json({ error: "Failed to save password" }, 500);
|
|
17487
17566
|
}
|
|
17488
17567
|
});
|
|
17489
|
-
|
|
17568
|
+
app48.route("/api/_client-error", client_error_default);
|
|
17490
17569
|
console.log("[client-error-route] mounted");
|
|
17491
|
-
|
|
17570
|
+
app48.use("*", async (c, next) => {
|
|
17492
17571
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
17493
17572
|
const path2 = c.req.path;
|
|
17494
17573
|
if (path2 === "/favicon.ico" || path2.startsWith("/assets/") || path2.startsWith("/brand/")) {
|
|
@@ -17521,16 +17600,17 @@ app47.use("*", async (c, next) => {
|
|
|
17521
17600
|
console.error(`[remote-auth] login required ip=${clientIp} path=${path2} ${disambig}`);
|
|
17522
17601
|
return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(), redirect: path2 }), 200);
|
|
17523
17602
|
});
|
|
17524
|
-
|
|
17525
|
-
|
|
17526
|
-
|
|
17527
|
-
|
|
17528
|
-
|
|
17529
|
-
|
|
17530
|
-
|
|
17531
|
-
|
|
17532
|
-
|
|
17533
|
-
|
|
17603
|
+
app48.route("/api/health", health_default);
|
|
17604
|
+
app48.route("/api/chat", chat_default);
|
|
17605
|
+
app48.route("/api/whatsapp", whatsapp_default);
|
|
17606
|
+
app48.route("/api/whatsapp-reader", whatsapp_reader_default);
|
|
17607
|
+
app48.route("/api/webchat", createWebchatRoutes({ handleInbound: (input) => webchatGateway.handleInbound(input) }));
|
|
17608
|
+
app48.route("/api/webchat/greeting", webchat_greeting_default);
|
|
17609
|
+
app48.route("/api/telegram", telegram_default);
|
|
17610
|
+
app48.route("/api/onboarding", onboarding_default);
|
|
17611
|
+
app48.route("/api/admin", admin_default);
|
|
17612
|
+
app48.route("/api/access", access_default);
|
|
17613
|
+
app48.route("/api/session", session_default2);
|
|
17534
17614
|
var SAFE_SLUG_RE2 = /^[a-z][a-z0-9-]{2,49}$/;
|
|
17535
17615
|
var SAFE_FILENAME_RE = /^[a-z0-9_][a-z0-9_.-]{0,99}$/i;
|
|
17536
17616
|
var IMAGE_MIME = {
|
|
@@ -17542,7 +17622,7 @@ var IMAGE_MIME = {
|
|
|
17542
17622
|
".svg": "image/svg+xml",
|
|
17543
17623
|
".ico": "image/x-icon"
|
|
17544
17624
|
};
|
|
17545
|
-
|
|
17625
|
+
app48.get("/agent-assets/:slug/:filename", (c) => {
|
|
17546
17626
|
const slug = c.req.param("slug");
|
|
17547
17627
|
const filename = c.req.param("filename");
|
|
17548
17628
|
if (!SAFE_SLUG_RE2.test(slug)) {
|
|
@@ -17577,7 +17657,7 @@ app47.get("/agent-assets/:slug/:filename", (c) => {
|
|
|
17577
17657
|
"Cache-Control": "public, max-age=3600"
|
|
17578
17658
|
});
|
|
17579
17659
|
});
|
|
17580
|
-
|
|
17660
|
+
app48.get("/generated/:filename", (c) => {
|
|
17581
17661
|
const filename = c.req.param("filename");
|
|
17582
17662
|
if (!SAFE_FILENAME_RE.test(filename) || filename.includes("..")) {
|
|
17583
17663
|
console.error(`[generated] serve file=${filename} status=403`);
|
|
@@ -17607,10 +17687,10 @@ app47.get("/generated/:filename", (c) => {
|
|
|
17607
17687
|
"Cache-Control": "public, max-age=86400"
|
|
17608
17688
|
});
|
|
17609
17689
|
});
|
|
17610
|
-
|
|
17611
|
-
|
|
17612
|
-
|
|
17613
|
-
|
|
17690
|
+
app48.route("/sites", sites_default);
|
|
17691
|
+
app48.route("/listings", listings_default);
|
|
17692
|
+
app48.route("/v", visitor_event_default);
|
|
17693
|
+
app48.route("/v", visitor_consent_default);
|
|
17614
17694
|
var htmlCache = /* @__PURE__ */ new Map();
|
|
17615
17695
|
var brandLogoPath = "/brand/maxy-monochrome.png";
|
|
17616
17696
|
var brandIconPath = "/brand/maxy-monochrome.png";
|
|
@@ -17741,7 +17821,7 @@ function escapeHtml(s) {
|
|
|
17741
17821
|
function agentUnavailableHtml() {
|
|
17742
17822
|
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>${escapeHtml(BRAND.productName)}</title></head><body style="font-family:system-ui,sans-serif;max-width:32rem;margin:4rem auto;padding:0 1.5rem;color:#222"><h1 style="font-size:1.25rem">Agent unavailable</h1><p>This agent isn't available right now. If you reached this page from a saved link, the agent may have been turned off.</p></body></html>`;
|
|
17743
17823
|
}
|
|
17744
|
-
|
|
17824
|
+
app48.get("/", (c) => {
|
|
17745
17825
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
17746
17826
|
if (isPublicHost(host)) {
|
|
17747
17827
|
const defaultSlug = resolveDefaultSlug();
|
|
@@ -17757,12 +17837,12 @@ app47.get("/", (c) => {
|
|
|
17757
17837
|
}
|
|
17758
17838
|
return c.html(cachedHtml("index.html"));
|
|
17759
17839
|
});
|
|
17760
|
-
|
|
17840
|
+
app48.get("/public", (c) => {
|
|
17761
17841
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
17762
17842
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
17763
17843
|
return c.html(cachedHtml("public.html"));
|
|
17764
17844
|
});
|
|
17765
|
-
|
|
17845
|
+
app48.get("/public-chat", (c) => {
|
|
17766
17846
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
17767
17847
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
17768
17848
|
return c.html(cachedHtml("public.html"));
|
|
@@ -17781,9 +17861,9 @@ async function logViewerFetch(c, next) {
|
|
|
17781
17861
|
duration_ms: Date.now() - start
|
|
17782
17862
|
});
|
|
17783
17863
|
}
|
|
17784
|
-
|
|
17785
|
-
|
|
17786
|
-
|
|
17864
|
+
app48.use("/vnc-viewer.html", logViewerFetch);
|
|
17865
|
+
app48.use("/vnc-popout.html", logViewerFetch);
|
|
17866
|
+
app48.get("/vnc-popout.html", (c) => {
|
|
17787
17867
|
let html = htmlCache.get("vnc-popout.html");
|
|
17788
17868
|
if (!html) {
|
|
17789
17869
|
html = readFileSync24(resolve27(process.cwd(), "public", "vnc-popout.html"), "utf-8");
|
|
@@ -17796,7 +17876,7 @@ app47.get("/vnc-popout.html", (c) => {
|
|
|
17796
17876
|
}
|
|
17797
17877
|
return c.html(html);
|
|
17798
17878
|
});
|
|
17799
|
-
|
|
17879
|
+
app48.post("/api/vnc/client-event", async (c) => {
|
|
17800
17880
|
let body;
|
|
17801
17881
|
try {
|
|
17802
17882
|
body = await c.req.json();
|
|
@@ -17817,35 +17897,30 @@ app47.post("/api/vnc/client-event", async (c) => {
|
|
|
17817
17897
|
});
|
|
17818
17898
|
return c.json({ ok: true });
|
|
17819
17899
|
});
|
|
17820
|
-
|
|
17900
|
+
app48.get("/g/:slug", (c) => {
|
|
17821
17901
|
return c.html(brandedPublicHtml());
|
|
17822
17902
|
});
|
|
17823
|
-
|
|
17903
|
+
app48.get("/graph", (c) => {
|
|
17824
17904
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
17825
17905
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
17826
17906
|
return c.html(cachedHtml("graph.html"));
|
|
17827
17907
|
});
|
|
17828
|
-
|
|
17908
|
+
app48.get("/chat", (c) => {
|
|
17829
17909
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
17830
17910
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
17831
17911
|
return c.html(cachedHtml("chat.html"));
|
|
17832
17912
|
});
|
|
17833
|
-
|
|
17834
|
-
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
17835
|
-
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
17836
|
-
return c.html(cachedHtml("sessions.html"));
|
|
17837
|
-
});
|
|
17838
|
-
app47.get("/data", (c) => {
|
|
17913
|
+
app48.get("/data", (c) => {
|
|
17839
17914
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
17840
17915
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
17841
17916
|
return c.html(cachedHtml("data.html"));
|
|
17842
17917
|
});
|
|
17843
|
-
|
|
17918
|
+
app48.get("/browser", (c) => {
|
|
17844
17919
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
17845
17920
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
17846
17921
|
return c.html(cachedHtml("browser.html"));
|
|
17847
17922
|
});
|
|
17848
|
-
|
|
17923
|
+
app48.get("/:slug", async (c, next) => {
|
|
17849
17924
|
const slug = c.req.param("slug");
|
|
17850
17925
|
if (AGENT_SLUG_PATTERN.test(`/${slug}`)) {
|
|
17851
17926
|
const account = resolveAccount();
|
|
@@ -17860,13 +17935,13 @@ app47.get("/:slug", async (c, next) => {
|
|
|
17860
17935
|
await next();
|
|
17861
17936
|
});
|
|
17862
17937
|
if (brandFaviconPath !== "/favicon.ico") {
|
|
17863
|
-
|
|
17938
|
+
app48.get("/favicon.ico", (c) => {
|
|
17864
17939
|
c.header("Cache-Control", "public, max-age=300");
|
|
17865
17940
|
return c.redirect(brandFaviconPath, 302);
|
|
17866
17941
|
});
|
|
17867
17942
|
}
|
|
17868
|
-
|
|
17869
|
-
|
|
17943
|
+
app48.use("/*", serveStatic({ root: "./public" }));
|
|
17944
|
+
app48.all("*", (c) => {
|
|
17870
17945
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
17871
17946
|
const path2 = c.req.path;
|
|
17872
17947
|
if (isPublicHost(host)) {
|
|
@@ -17880,7 +17955,7 @@ app47.all("*", (c) => {
|
|
|
17880
17955
|
});
|
|
17881
17956
|
var port = requirePortEnv("MAXY_UI_INTERNAL_PORT", { tag: "ui-server" });
|
|
17882
17957
|
var hostname = process.env.HOSTNAME ?? "127.0.0.1";
|
|
17883
|
-
var httpServer = serve({ fetch:
|
|
17958
|
+
var httpServer = serve({ fetch: app48.fetch, port, hostname });
|
|
17884
17959
|
console.log(`${BRAND.productName} listening on http://${hostname}:${port}`);
|
|
17885
17960
|
startAuthHealthHeartbeat();
|
|
17886
17961
|
{
|
|
@@ -17919,7 +17994,7 @@ for (const m of SUBAPP_MANIFEST) {
|
|
|
17919
17994
|
}
|
|
17920
17995
|
try {
|
|
17921
17996
|
const registered = [];
|
|
17922
|
-
for (const r of
|
|
17997
|
+
for (const r of app48.routes ?? []) {
|
|
17923
17998
|
if (typeof r.path !== "string" || r.path.includes(":") || r.path.includes("*")) continue;
|
|
17924
17999
|
if (AGENT_SLUG_PATTERN.test(r.path)) {
|
|
17925
18000
|
registered.push({ method: (r.method ?? "ALL").toUpperCase(), path: r.path });
|