@rubytech/create-maxy 1.0.894 → 1.0.895
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/payload/server/server.js
CHANGED
|
@@ -7962,17 +7962,75 @@ app12.post("/", requireAdminSession, async (c) => {
|
|
|
7962
7962
|
});
|
|
7963
7963
|
var chat_failure_default = app12;
|
|
7964
7964
|
|
|
7965
|
+
// server/routes/admin/new-session-failure.ts
|
|
7966
|
+
var REASON_VALUES = /* @__PURE__ */ new Set(["server-status", "network-error"]);
|
|
7967
|
+
var ISO_RE2 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
7968
|
+
var app13 = new Hono();
|
|
7969
|
+
app13.post("/", requireAdminSession, async (c) => {
|
|
7970
|
+
let body;
|
|
7971
|
+
try {
|
|
7972
|
+
body = await c.req.json();
|
|
7973
|
+
} catch {
|
|
7974
|
+
console.error(`[admin-chat] new-conversation outcome=fail reason=schema:body-not-json`);
|
|
7975
|
+
return c.json({ ok: false, reason: "body-not-json" }, 400);
|
|
7976
|
+
}
|
|
7977
|
+
if (typeof body.reason !== "string" || !REASON_VALUES.has(body.reason)) {
|
|
7978
|
+
console.error(`[admin-chat] new-conversation outcome=fail reason=schema:reason`);
|
|
7979
|
+
return c.json({ ok: false, reason: "schema:reason" }, 400);
|
|
7980
|
+
}
|
|
7981
|
+
if (typeof body.at !== "string" || !ISO_RE2.test(body.at)) {
|
|
7982
|
+
console.error(`[admin-chat] new-conversation outcome=fail reason=schema:at`);
|
|
7983
|
+
return c.json({ ok: false, reason: "schema:at" }, 400);
|
|
7984
|
+
}
|
|
7985
|
+
let statusToken;
|
|
7986
|
+
if (body.reason === "server-status") {
|
|
7987
|
+
if (typeof body.status !== "number" || !Number.isInteger(body.status) || body.status < 100 || body.status > 599) {
|
|
7988
|
+
console.error(`[admin-chat] new-conversation outcome=fail reason=schema:status`);
|
|
7989
|
+
return c.json({ ok: false, reason: "schema:status" }, 400);
|
|
7990
|
+
}
|
|
7991
|
+
statusToken = String(body.status);
|
|
7992
|
+
} else {
|
|
7993
|
+
statusToken = "net";
|
|
7994
|
+
}
|
|
7995
|
+
const cacheKey = c.var.cacheKey;
|
|
7996
|
+
const cacheKeyTag = cacheKey.slice(0, 8);
|
|
7997
|
+
console.log(`[admin-chat] new-conversation outcome=fail cacheKey=${cacheKeyTag} status=${statusToken} reason=${body.reason} at=${body.at}`);
|
|
7998
|
+
return c.body(null, 204);
|
|
7999
|
+
});
|
|
8000
|
+
var new_session_failure_default = app13;
|
|
8001
|
+
|
|
8002
|
+
// server/routes/admin/new-session-submit.ts
|
|
8003
|
+
var ISO_RE3 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
8004
|
+
var app14 = new Hono();
|
|
8005
|
+
app14.post("/", requireAdminSession, async (c) => {
|
|
8006
|
+
let body;
|
|
8007
|
+
try {
|
|
8008
|
+
body = await c.req.json();
|
|
8009
|
+
} catch {
|
|
8010
|
+
console.error(`[admin-chat] new-conversation outcome=submit reason=schema:body-not-json`);
|
|
8011
|
+
return c.json({ ok: false, reason: "body-not-json" }, 400);
|
|
8012
|
+
}
|
|
8013
|
+
if (typeof body.at !== "string" || !ISO_RE3.test(body.at)) {
|
|
8014
|
+
console.error(`[admin-chat] new-conversation outcome=submit reason=schema:at`);
|
|
8015
|
+
return c.json({ ok: false, reason: "schema:at" }, 400);
|
|
8016
|
+
}
|
|
8017
|
+
const cacheKey = c.var.cacheKey;
|
|
8018
|
+
console.log(`[admin-chat] new-conversation outcome=submit cacheKey=${cacheKey.slice(0, 8)} at=${body.at}`);
|
|
8019
|
+
return c.body(null, 204);
|
|
8020
|
+
});
|
|
8021
|
+
var new_session_submit_default = app14;
|
|
8022
|
+
|
|
7965
8023
|
// server/routes/admin/failure-report.ts
|
|
7966
8024
|
var SESSION_KEY_RE = /^sk_[0-9a-f]{16}$/i;
|
|
7967
8025
|
var UUID_RE4 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
7968
|
-
var
|
|
8026
|
+
var ISO_RE4 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
7969
8027
|
var SAFE_TOKEN_RE = /^[\w.:-]{1,64}$/;
|
|
7970
8028
|
function validate2(body) {
|
|
7971
8029
|
const missing = [];
|
|
7972
8030
|
if (typeof body.sessionKey !== "string" || !SESSION_KEY_RE.test(body.sessionKey)) missing.push("sessionKey");
|
|
7973
8031
|
if (typeof body.conversationId !== "string" || !UUID_RE4.test(body.conversationId)) missing.push("conversationId");
|
|
7974
8032
|
if (typeof body.lastUserMessageId !== "string" || !SAFE_TOKEN_RE.test(body.lastUserMessageId)) missing.push("lastUserMessageId");
|
|
7975
|
-
if (typeof body.clickTs !== "string" || !
|
|
8033
|
+
if (typeof body.clickTs !== "string" || !ISO_RE4.test(body.clickTs)) missing.push("clickTs");
|
|
7976
8034
|
const snap = body.clientSnapshot;
|
|
7977
8035
|
if (!snap || typeof snap !== "object") missing.push("clientSnapshot");
|
|
7978
8036
|
if (missing.length > 0) return { ok: false, missing };
|
|
@@ -7995,8 +8053,8 @@ function validate2(body) {
|
|
|
7995
8053
|
}
|
|
7996
8054
|
};
|
|
7997
8055
|
}
|
|
7998
|
-
var
|
|
7999
|
-
|
|
8056
|
+
var app15 = new Hono();
|
|
8057
|
+
app15.post("/", requireAdminSession, async (c) => {
|
|
8000
8058
|
let body;
|
|
8001
8059
|
try {
|
|
8002
8060
|
body = await c.req.json();
|
|
@@ -8025,12 +8083,12 @@ app13.post("/", requireAdminSession, async (c) => {
|
|
|
8025
8083
|
appendStreamLogLine(accountId, v.value.sessionKey, line);
|
|
8026
8084
|
return c.json({ ok: true });
|
|
8027
8085
|
});
|
|
8028
|
-
var failure_report_default =
|
|
8086
|
+
var failure_report_default = app15;
|
|
8029
8087
|
|
|
8030
8088
|
// server/routes/admin/sse-telemetry.ts
|
|
8031
8089
|
var SESSION_KEY_RE2 = /^sk_[0-9a-f]{16}$/i;
|
|
8032
8090
|
var UUID_RE5 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
8033
|
-
var
|
|
8091
|
+
var ISO_RE5 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
8034
8092
|
var PHASE_VALUES = /* @__PURE__ */ new Set(["connected", "event_received", "render_complete", "error", "close"]);
|
|
8035
8093
|
var SAFE_TOKEN_RE2 = /^[\w.:-]{1,64}$/;
|
|
8036
8094
|
function validate3(body) {
|
|
@@ -8038,7 +8096,7 @@ function validate3(body) {
|
|
|
8038
8096
|
if (typeof body.sessionKey !== "string" || !SESSION_KEY_RE2.test(body.sessionKey)) missing.push("sessionKey");
|
|
8039
8097
|
if (typeof body.conversationId !== "string" || !UUID_RE5.test(body.conversationId)) missing.push("conversationId");
|
|
8040
8098
|
if (typeof body.phase !== "string" || !PHASE_VALUES.has(body.phase)) missing.push("phase");
|
|
8041
|
-
if (typeof body.ts !== "string" || !
|
|
8099
|
+
if (typeof body.ts !== "string" || !ISO_RE5.test(body.ts)) missing.push("ts");
|
|
8042
8100
|
if (missing.length > 0) return { ok: false, missing };
|
|
8043
8101
|
const eventType = typeof body.eventType === "string" && SAFE_TOKEN_RE2.test(body.eventType) ? body.eventType : "-";
|
|
8044
8102
|
const messageId = typeof body.messageId === "string" && SAFE_TOKEN_RE2.test(body.messageId) ? body.messageId : "-";
|
|
@@ -8054,8 +8112,8 @@ function validate3(body) {
|
|
|
8054
8112
|
}
|
|
8055
8113
|
};
|
|
8056
8114
|
}
|
|
8057
|
-
var
|
|
8058
|
-
|
|
8115
|
+
var app16 = new Hono();
|
|
8116
|
+
app16.post("/", requireAdminSession, async (c) => {
|
|
8059
8117
|
let body;
|
|
8060
8118
|
try {
|
|
8061
8119
|
body = await c.req.json();
|
|
@@ -8078,11 +8136,11 @@ app14.post("/", requireAdminSession, async (c) => {
|
|
|
8078
8136
|
);
|
|
8079
8137
|
return c.json({ ok: true });
|
|
8080
8138
|
});
|
|
8081
|
-
var sse_telemetry_default =
|
|
8139
|
+
var sse_telemetry_default = app16;
|
|
8082
8140
|
|
|
8083
8141
|
// server/routes/admin/compact.ts
|
|
8084
|
-
var
|
|
8085
|
-
|
|
8142
|
+
var app17 = new Hono();
|
|
8143
|
+
app17.post("/", requireAdminSession, async (c) => {
|
|
8086
8144
|
const cacheKey = c.var.cacheKey;
|
|
8087
8145
|
const encoder = new TextEncoder();
|
|
8088
8146
|
const stream = new ReadableStream({
|
|
@@ -8109,7 +8167,7 @@ app15.post("/", requireAdminSession, async (c) => {
|
|
|
8109
8167
|
}
|
|
8110
8168
|
});
|
|
8111
8169
|
});
|
|
8112
|
-
var compact_default =
|
|
8170
|
+
var compact_default = app17;
|
|
8113
8171
|
|
|
8114
8172
|
// server/routes/admin/logs.ts
|
|
8115
8173
|
import { existsSync as existsSync13, readdirSync as readdirSync5, readFileSync as readFileSync11, statSync as statSync6 } from "fs";
|
|
@@ -8132,8 +8190,8 @@ function resolveSessionLogPaths(filename, logDirs) {
|
|
|
8132
8190
|
|
|
8133
8191
|
// server/routes/admin/logs.ts
|
|
8134
8192
|
var TAIL_BYTES = 8192;
|
|
8135
|
-
var
|
|
8136
|
-
|
|
8193
|
+
var app18 = new Hono();
|
|
8194
|
+
app18.get("/", async (c) => {
|
|
8137
8195
|
const fileParam = c.req.query("file");
|
|
8138
8196
|
const typeParam = c.req.query("type");
|
|
8139
8197
|
const conversationIdParam = c.req.query("conversationId");
|
|
@@ -8275,12 +8333,12 @@ app16.get("/", async (c) => {
|
|
|
8275
8333
|
}
|
|
8276
8334
|
return c.json({ logs });
|
|
8277
8335
|
});
|
|
8278
|
-
var logs_default =
|
|
8336
|
+
var logs_default = app18;
|
|
8279
8337
|
|
|
8280
8338
|
// server/routes/admin/claude-info.ts
|
|
8281
8339
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
8282
|
-
var
|
|
8283
|
-
|
|
8340
|
+
var app19 = new Hono();
|
|
8341
|
+
app19.get("/", (c) => {
|
|
8284
8342
|
let version = "unknown";
|
|
8285
8343
|
try {
|
|
8286
8344
|
const raw = execFileSync2("claude", ["--version"], { encoding: "utf-8", timeout: 5e3 });
|
|
@@ -8298,14 +8356,14 @@ app17.get("/", (c) => {
|
|
|
8298
8356
|
const thinkingView = resolvedAccount?.config.thinkingView ?? "default";
|
|
8299
8357
|
return c.json({ version, account, model, thinkingView });
|
|
8300
8358
|
});
|
|
8301
|
-
var claude_info_default =
|
|
8359
|
+
var claude_info_default = app19;
|
|
8302
8360
|
|
|
8303
8361
|
// server/routes/admin/attachment.ts
|
|
8304
8362
|
import { readFile as readFile2, readdir } from "fs/promises";
|
|
8305
8363
|
import { existsSync as existsSync14 } from "fs";
|
|
8306
8364
|
import { resolve as resolve9 } from "path";
|
|
8307
|
-
var
|
|
8308
|
-
|
|
8365
|
+
var app20 = new Hono();
|
|
8366
|
+
app20.get("/:attachmentId", requireAdminSession, async (c) => {
|
|
8309
8367
|
const attachmentId = c.req.param("attachmentId");
|
|
8310
8368
|
const cacheKey = c.var.cacheKey;
|
|
8311
8369
|
const accountId = getAccountIdForSession(cacheKey);
|
|
@@ -8344,13 +8402,13 @@ app18.get("/:attachmentId", requireAdminSession, async (c) => {
|
|
|
8344
8402
|
}
|
|
8345
8403
|
});
|
|
8346
8404
|
});
|
|
8347
|
-
var attachment_default =
|
|
8405
|
+
var attachment_default = app20;
|
|
8348
8406
|
|
|
8349
8407
|
// server/routes/admin/agents.ts
|
|
8350
8408
|
import { resolve as resolve10 } from "path";
|
|
8351
8409
|
import { readdirSync as readdirSync6, readFileSync as readFileSync12, existsSync as existsSync15, rmSync } from "fs";
|
|
8352
|
-
var
|
|
8353
|
-
|
|
8410
|
+
var app21 = new Hono();
|
|
8411
|
+
app21.get("/", (c) => {
|
|
8354
8412
|
const account = resolveAccount();
|
|
8355
8413
|
if (!account) return c.json({ agents: [] });
|
|
8356
8414
|
const agentsDir = resolve10(account.accountDir, "agents");
|
|
@@ -8380,7 +8438,7 @@ app19.get("/", (c) => {
|
|
|
8380
8438
|
}
|
|
8381
8439
|
return c.json({ agents });
|
|
8382
8440
|
});
|
|
8383
|
-
|
|
8441
|
+
app21.delete("/:slug", async (c) => {
|
|
8384
8442
|
const slug = c.req.param("slug");
|
|
8385
8443
|
const account = resolveAccount();
|
|
8386
8444
|
if (!account) return c.json({ error: "No account resolved" }, 400);
|
|
@@ -8410,7 +8468,7 @@ app19.delete("/:slug", async (c) => {
|
|
|
8410
8468
|
return c.json({ error: "Failed to delete agent" }, 500);
|
|
8411
8469
|
}
|
|
8412
8470
|
});
|
|
8413
|
-
|
|
8471
|
+
app21.post("/:slug/project", async (c) => {
|
|
8414
8472
|
const slug = c.req.param("slug");
|
|
8415
8473
|
const account = resolveAccount();
|
|
8416
8474
|
if (!account) return c.json({ error: "No account resolved" }, 400);
|
|
@@ -8432,7 +8490,7 @@ app19.post("/:slug/project", async (c) => {
|
|
|
8432
8490
|
return c.json({ error: `Projection failed: ${msg}` }, 500);
|
|
8433
8491
|
}
|
|
8434
8492
|
});
|
|
8435
|
-
var agents_default =
|
|
8493
|
+
var agents_default = app21;
|
|
8436
8494
|
|
|
8437
8495
|
// server/routes/admin/sessions.ts
|
|
8438
8496
|
import crypto2 from "crypto";
|
|
@@ -8723,8 +8781,8 @@ function formatAge(updatedAtStr) {
|
|
|
8723
8781
|
return "unknown";
|
|
8724
8782
|
}
|
|
8725
8783
|
}
|
|
8726
|
-
var
|
|
8727
|
-
|
|
8784
|
+
var app22 = new Hono();
|
|
8785
|
+
app22.get("/", requireAdminSession, async (c) => {
|
|
8728
8786
|
const cacheKey = c.var.cacheKey;
|
|
8729
8787
|
const accountId = getAccountIdForSession(cacheKey);
|
|
8730
8788
|
if (!accountId) return c.json({ error: "Account not found for session" }, 401);
|
|
@@ -8764,11 +8822,13 @@ app20.get("/", requireAdminSession, async (c) => {
|
|
|
8764
8822
|
return c.json({ error: "Failed to fetch sessions" }, 500);
|
|
8765
8823
|
}
|
|
8766
8824
|
});
|
|
8767
|
-
|
|
8825
|
+
app22.post("/new", requireAdminSession, async (c) => {
|
|
8768
8826
|
const oldCacheKey = c.var.cacheKey;
|
|
8827
|
+
console.log(`[admin-chat] new-conversation outcome=ingress cacheKey=${oldCacheKey.slice(0, 8)}`);
|
|
8769
8828
|
const accountId = getAccountIdForSession(oldCacheKey);
|
|
8770
8829
|
const userId = getUserIdForSession(oldCacheKey);
|
|
8771
8830
|
if (!accountId || !userId) {
|
|
8831
|
+
console.error(`[admin-chat] new-conversation outcome=fail reason=missing-account-or-user cacheKey=${oldCacheKey.slice(0, 8)}`);
|
|
8772
8832
|
return c.json({ error: "Session missing account or user context" }, 400);
|
|
8773
8833
|
}
|
|
8774
8834
|
const newSignedSessionToken = crypto2.randomUUID();
|
|
@@ -8777,10 +8837,10 @@ app20.post("/new", requireAdminSession, async (c) => {
|
|
|
8777
8837
|
registerSession(newCacheKey, "admin", accountId, void 0, userId, userName);
|
|
8778
8838
|
const previousConversationId = clearSessionHistory(oldCacheKey);
|
|
8779
8839
|
unregisterSession(oldCacheKey);
|
|
8780
|
-
console.log(`[
|
|
8840
|
+
console.log(`[admin-chat] new-conversation outcome=ok oldKey=${oldCacheKey.slice(0, 8)} newKey=${newCacheKey.slice(0, 8)} previousConversationId=${previousConversationId?.slice(0, 8) ?? "none"}`);
|
|
8781
8841
|
return c.json({ session_key: newSignedSessionToken, conversationId: null });
|
|
8782
8842
|
});
|
|
8783
|
-
|
|
8843
|
+
app22.post("/switch", requireAdminSession, async (c) => {
|
|
8784
8844
|
const cacheKey = c.var.cacheKey;
|
|
8785
8845
|
const accountId = getAccountIdForSession(cacheKey);
|
|
8786
8846
|
const userId = getUserIdForSession(cacheKey);
|
|
@@ -8808,7 +8868,7 @@ app20.post("/switch", requireAdminSession, async (c) => {
|
|
|
8808
8868
|
console.log(`[session-switch] from=${cacheKey.slice(0, 8)} to=${targetCacheKey.slice(0, 8)} targetConvId=${targetConversationId?.slice(0, 8) ?? "none"} accountId=${accountId.slice(0, 8)}`);
|
|
8809
8869
|
return c.json({ session_key: targetSignedSessionToken, conversationId: targetConversationId });
|
|
8810
8870
|
});
|
|
8811
|
-
|
|
8871
|
+
app22.delete("/:id", requireAdminSession, async (c) => {
|
|
8812
8872
|
const conversationId = c.req.param("id");
|
|
8813
8873
|
const cacheKey = c.var.cacheKey;
|
|
8814
8874
|
const accountId = getAccountIdForSession(cacheKey);
|
|
@@ -8823,7 +8883,7 @@ app20.delete("/:id", requireAdminSession, async (c) => {
|
|
|
8823
8883
|
return c.json({ error: "Failed to delete session" }, 500);
|
|
8824
8884
|
}
|
|
8825
8885
|
});
|
|
8826
|
-
|
|
8886
|
+
app22.post("/:id/resume", async (c) => {
|
|
8827
8887
|
const conversationId = c.req.param("id");
|
|
8828
8888
|
const t0 = Date.now();
|
|
8829
8889
|
const signedSessionToken = c.req.query("session_key") ?? "";
|
|
@@ -9101,7 +9161,7 @@ app20.post("/:id/resume", async (c) => {
|
|
|
9101
9161
|
}
|
|
9102
9162
|
});
|
|
9103
9163
|
});
|
|
9104
|
-
|
|
9164
|
+
app22.post("/:id/label", requireAdminSession, async (c) => {
|
|
9105
9165
|
const conversationId = c.req.param("id");
|
|
9106
9166
|
const cacheKey = c.var.cacheKey;
|
|
9107
9167
|
const accountId = getAccountIdForSession(cacheKey);
|
|
@@ -9128,7 +9188,7 @@ app20.post("/:id/label", requireAdminSession, async (c) => {
|
|
|
9128
9188
|
return c.json({ label: null });
|
|
9129
9189
|
}
|
|
9130
9190
|
});
|
|
9131
|
-
|
|
9191
|
+
app22.put("/:id/label", requireAdminSession, async (c) => {
|
|
9132
9192
|
const conversationId = c.req.param("id");
|
|
9133
9193
|
const cacheKey = c.var.cacheKey;
|
|
9134
9194
|
let body;
|
|
@@ -9154,11 +9214,11 @@ app20.put("/:id/label", requireAdminSession, async (c) => {
|
|
|
9154
9214
|
return c.json({ error: "Failed to rename session" }, 500);
|
|
9155
9215
|
}
|
|
9156
9216
|
});
|
|
9157
|
-
var sessions_default =
|
|
9217
|
+
var sessions_default = app22;
|
|
9158
9218
|
|
|
9159
9219
|
// server/routes/admin/browser.ts
|
|
9160
|
-
var
|
|
9161
|
-
|
|
9220
|
+
var app23 = new Hono();
|
|
9221
|
+
app23.post("/launch", async (c) => {
|
|
9162
9222
|
try {
|
|
9163
9223
|
const transport = resolveBrowserTransport(c.req.raw, c.env?.incoming?.socket?.remoteAddress);
|
|
9164
9224
|
if (transport === "vnc") {
|
|
@@ -9180,7 +9240,7 @@ app21.post("/launch", async (c) => {
|
|
|
9180
9240
|
);
|
|
9181
9241
|
}
|
|
9182
9242
|
});
|
|
9183
|
-
var browser_default =
|
|
9243
|
+
var browser_default = app23;
|
|
9184
9244
|
|
|
9185
9245
|
// server/routes/admin/browser-iframe.ts
|
|
9186
9246
|
var ALLOWED_EVENTS = /* @__PURE__ */ new Set([
|
|
@@ -9197,8 +9257,8 @@ function asString(v, max = 500) {
|
|
|
9197
9257
|
function asNumber(v) {
|
|
9198
9258
|
return typeof v === "number" && Number.isFinite(v) ? v : void 0;
|
|
9199
9259
|
}
|
|
9200
|
-
var
|
|
9201
|
-
|
|
9260
|
+
var app24 = new Hono();
|
|
9261
|
+
app24.post("/event", async (c) => {
|
|
9202
9262
|
let body = {};
|
|
9203
9263
|
try {
|
|
9204
9264
|
body = await c.req.json();
|
|
@@ -9219,7 +9279,7 @@ app22.post("/event", async (c) => {
|
|
|
9219
9279
|
});
|
|
9220
9280
|
return c.body(null, 204);
|
|
9221
9281
|
});
|
|
9222
|
-
var browser_iframe_default =
|
|
9282
|
+
var browser_iframe_default = app24;
|
|
9223
9283
|
|
|
9224
9284
|
// app/lib/cdp-client.ts
|
|
9225
9285
|
var CDP_HOST = "127.0.0.1";
|
|
@@ -9262,8 +9322,8 @@ async function cdpNavigateNewTab(url, opts = {}) {
|
|
|
9262
9322
|
}
|
|
9263
9323
|
|
|
9264
9324
|
// server/routes/admin/device-browser.ts
|
|
9265
|
-
var
|
|
9266
|
-
|
|
9325
|
+
var app25 = new Hono();
|
|
9326
|
+
app25.post("/navigate", async (c) => {
|
|
9267
9327
|
const TAG19 = "[device-url:click]";
|
|
9268
9328
|
let body;
|
|
9269
9329
|
try {
|
|
@@ -9350,7 +9410,7 @@ app23.post("/navigate", async (c) => {
|
|
|
9350
9410
|
targetId: outcome.targetId
|
|
9351
9411
|
});
|
|
9352
9412
|
});
|
|
9353
|
-
var device_browser_default =
|
|
9413
|
+
var device_browser_default = app25;
|
|
9354
9414
|
|
|
9355
9415
|
// server/routes/admin/events.ts
|
|
9356
9416
|
var ALLOWED_EVENTS2 = /* @__PURE__ */ new Set([
|
|
@@ -9359,8 +9419,8 @@ var ALLOWED_EVENTS2 = /* @__PURE__ */ new Set([
|
|
|
9359
9419
|
"device-url:vnc-surface-shown",
|
|
9360
9420
|
"device-url:malformed"
|
|
9361
9421
|
]);
|
|
9362
|
-
var
|
|
9363
|
-
|
|
9422
|
+
var app26 = new Hono();
|
|
9423
|
+
app26.post("/", async (c) => {
|
|
9364
9424
|
const TAG19 = "[admin:events]";
|
|
9365
9425
|
let body;
|
|
9366
9426
|
try {
|
|
@@ -9391,7 +9451,7 @@ app24.post("/", async (c) => {
|
|
|
9391
9451
|
console.error(`[${event}] ${formatted}`);
|
|
9392
9452
|
return c.json({ ok: true });
|
|
9393
9453
|
});
|
|
9394
|
-
var events_default =
|
|
9454
|
+
var events_default = app26;
|
|
9395
9455
|
|
|
9396
9456
|
// server/routes/admin/cloudflare.ts
|
|
9397
9457
|
import { homedir as homedir2 } from "os";
|
|
@@ -9534,7 +9594,7 @@ function validateBody(body) {
|
|
|
9534
9594
|
}
|
|
9535
9595
|
return null;
|
|
9536
9596
|
}
|
|
9537
|
-
var
|
|
9597
|
+
var app27 = new Hono();
|
|
9538
9598
|
function fieldFromReason(reason) {
|
|
9539
9599
|
switch (reason) {
|
|
9540
9600
|
case "not-signed-in":
|
|
@@ -9555,7 +9615,7 @@ function fieldFromReason(reason) {
|
|
|
9555
9615
|
return "script";
|
|
9556
9616
|
}
|
|
9557
9617
|
}
|
|
9558
|
-
|
|
9618
|
+
app27.get("/domains", requireAdminSession, async (c) => {
|
|
9559
9619
|
const started = Date.now();
|
|
9560
9620
|
const cacheKey = c.var.cacheKey;
|
|
9561
9621
|
let correlationId;
|
|
@@ -9651,7 +9711,7 @@ ${result.stderr}` : ""}`;
|
|
|
9651
9711
|
return c.json(success, 200);
|
|
9652
9712
|
});
|
|
9653
9713
|
var TUNNELS_TIMEOUT_MS = 30 * 1e3;
|
|
9654
|
-
|
|
9714
|
+
app27.get("/tunnels", requireAdminSession, async (c) => {
|
|
9655
9715
|
const started = Date.now();
|
|
9656
9716
|
const cacheKey = c.var.cacheKey;
|
|
9657
9717
|
let correlationId;
|
|
@@ -9748,7 +9808,7 @@ ${result.stderr}` : ""}`;
|
|
|
9748
9808
|
const success = { ok: true, tunnels, defaultName, correlationId, streamLogPath };
|
|
9749
9809
|
return c.json(success, 200);
|
|
9750
9810
|
});
|
|
9751
|
-
|
|
9811
|
+
app27.post("/setup", requireAdminSession, async (c) => {
|
|
9752
9812
|
const started = Date.now();
|
|
9753
9813
|
const cacheKey = c.var.cacheKey;
|
|
9754
9814
|
let correlationId;
|
|
@@ -10010,7 +10070,7 @@ actionId: ${actionId}`,
|
|
|
10010
10070
|
};
|
|
10011
10071
|
return ok(success);
|
|
10012
10072
|
});
|
|
10013
|
-
var cloudflare_default =
|
|
10073
|
+
var cloudflare_default = app27;
|
|
10014
10074
|
|
|
10015
10075
|
// server/routes/admin/files.ts
|
|
10016
10076
|
import { createReadStream as createReadStream3 } from "fs";
|
|
@@ -10443,8 +10503,8 @@ function buildDisplayPath(relPath2, accountNames) {
|
|
|
10443
10503
|
return dn ? { name: seg, displayName: dn } : { name: seg };
|
|
10444
10504
|
});
|
|
10445
10505
|
}
|
|
10446
|
-
var
|
|
10447
|
-
|
|
10506
|
+
var app28 = new Hono();
|
|
10507
|
+
app28.get("/", requireAdminSession, async (c) => {
|
|
10448
10508
|
const cacheKey = c.var.cacheKey;
|
|
10449
10509
|
if (!getAccountIdForSession(cacheKey)) {
|
|
10450
10510
|
console.error(`[data] auth-rejected endpoint="/api/admin/files" reason="no account for session"`);
|
|
@@ -10505,7 +10565,7 @@ app26.get("/", requireAdminSession, async (c) => {
|
|
|
10505
10565
|
return c.json({ error: message }, 500);
|
|
10506
10566
|
}
|
|
10507
10567
|
});
|
|
10508
|
-
|
|
10568
|
+
app28.get("/download", requireAdminSession, async (c) => {
|
|
10509
10569
|
const cacheKey = c.var.cacheKey;
|
|
10510
10570
|
if (!getAccountIdForSession(cacheKey)) {
|
|
10511
10571
|
console.error(`[data] auth-rejected endpoint="/api/admin/files/download" reason="no account for session"`);
|
|
@@ -10553,7 +10613,7 @@ app26.get("/download", requireAdminSession, async (c) => {
|
|
|
10553
10613
|
return c.json({ error: message }, 500);
|
|
10554
10614
|
}
|
|
10555
10615
|
});
|
|
10556
|
-
|
|
10616
|
+
app28.post("/upload", requireAdminSession, async (c) => {
|
|
10557
10617
|
const cacheKey = c.var.cacheKey;
|
|
10558
10618
|
const accountId = getAccountIdForSession(cacheKey);
|
|
10559
10619
|
if (!accountId) {
|
|
@@ -10611,7 +10671,7 @@ app26.post("/upload", requireAdminSession, async (c) => {
|
|
|
10611
10671
|
mimeType: file.type
|
|
10612
10672
|
});
|
|
10613
10673
|
});
|
|
10614
|
-
|
|
10674
|
+
app28.delete("/", requireAdminSession, async (c) => {
|
|
10615
10675
|
const cacheKey = c.var.cacheKey;
|
|
10616
10676
|
const accountId = getAccountIdForSession(cacheKey);
|
|
10617
10677
|
if (!accountId) {
|
|
@@ -10678,7 +10738,7 @@ app26.delete("/", requireAdminSession, async (c) => {
|
|
|
10678
10738
|
return c.json({ error: message }, 500);
|
|
10679
10739
|
}
|
|
10680
10740
|
});
|
|
10681
|
-
var files_default =
|
|
10741
|
+
var files_default = app28;
|
|
10682
10742
|
|
|
10683
10743
|
// ../lib/graph-search/src/index.ts
|
|
10684
10744
|
var import_dist = __toESM(require_dist());
|
|
@@ -11058,8 +11118,8 @@ var MAX_LIMIT = 2e3;
|
|
|
11058
11118
|
var DEFAULT_VECTOR_THRESHOLD = 0.82;
|
|
11059
11119
|
var MESSAGE_FAMILY_LABELS = ["Message", "UserMessage", "AssistantMessage", "WhatsAppMessage"];
|
|
11060
11120
|
var CONVERSATION_PARENT_LABELS = /* @__PURE__ */ new Set(["AdminConversation", "PublicConversation"]);
|
|
11061
|
-
var
|
|
11062
|
-
|
|
11121
|
+
var app29 = new Hono();
|
|
11122
|
+
app29.get("/", requireAdminSession, async (c) => {
|
|
11063
11123
|
const cacheKey = c.var.cacheKey;
|
|
11064
11124
|
const q = (c.req.query("q") ?? "").trim();
|
|
11065
11125
|
const rawLimit = c.req.query("limit");
|
|
@@ -11190,7 +11250,7 @@ app27.get("/", requireAdminSession, async (c) => {
|
|
|
11190
11250
|
await session.close();
|
|
11191
11251
|
}
|
|
11192
11252
|
});
|
|
11193
|
-
var graph_search_default =
|
|
11253
|
+
var graph_search_default = app29;
|
|
11194
11254
|
|
|
11195
11255
|
// server/routes/admin/graph-subgraph.ts
|
|
11196
11256
|
import neo4j2 from "neo4j-driver";
|
|
@@ -11348,8 +11408,8 @@ var STRIPPED_PROPERTIES = /* @__PURE__ */ new Set([
|
|
|
11348
11408
|
"otpCode",
|
|
11349
11409
|
"cacheKey"
|
|
11350
11410
|
]);
|
|
11351
|
-
var
|
|
11352
|
-
|
|
11411
|
+
var app30 = new Hono();
|
|
11412
|
+
app30.get("/", requireAdminSession, async (c) => {
|
|
11353
11413
|
const cacheKey = c.var.cacheKey;
|
|
11354
11414
|
const accountId = getAccountIdForSession(cacheKey);
|
|
11355
11415
|
if (!accountId) {
|
|
@@ -11932,12 +11992,12 @@ function pruneNode(node, warnedClasses, conversationWarnings) {
|
|
|
11932
11992
|
}
|
|
11933
11993
|
return trashed ? { id: node.id, labels, properties, trashed: true } : { id: node.id, labels, properties };
|
|
11934
11994
|
}
|
|
11935
|
-
var graph_subgraph_default =
|
|
11995
|
+
var graph_subgraph_default = app30;
|
|
11936
11996
|
|
|
11937
11997
|
// server/routes/admin/graph-delete.ts
|
|
11938
11998
|
var ALLOWED_BY = ["graph-page", "graph-drag-trash"];
|
|
11939
|
-
var
|
|
11940
|
-
|
|
11999
|
+
var app31 = new Hono();
|
|
12000
|
+
app31.post("/", requireAdminSession, async (c) => {
|
|
11941
12001
|
const cacheKey = c.var.cacheKey;
|
|
11942
12002
|
const accountId = getAccountIdForSession(cacheKey);
|
|
11943
12003
|
if (!accountId) {
|
|
@@ -12008,11 +12068,11 @@ app29.post("/", requireAdminSession, async (c) => {
|
|
|
12008
12068
|
}
|
|
12009
12069
|
}
|
|
12010
12070
|
});
|
|
12011
|
-
var graph_delete_default =
|
|
12071
|
+
var graph_delete_default = app31;
|
|
12012
12072
|
|
|
12013
12073
|
// server/routes/admin/graph-restore.ts
|
|
12014
|
-
var
|
|
12015
|
-
|
|
12074
|
+
var app32 = new Hono();
|
|
12075
|
+
app32.post("/", requireAdminSession, async (c) => {
|
|
12016
12076
|
const cacheKey = c.var.cacheKey;
|
|
12017
12077
|
const accountId = getAccountIdForSession(cacheKey);
|
|
12018
12078
|
if (!accountId) {
|
|
@@ -12076,11 +12136,11 @@ app30.post("/", requireAdminSession, async (c) => {
|
|
|
12076
12136
|
}
|
|
12077
12137
|
}
|
|
12078
12138
|
});
|
|
12079
|
-
var graph_restore_default =
|
|
12139
|
+
var graph_restore_default = app32;
|
|
12080
12140
|
|
|
12081
12141
|
// server/routes/admin/graph-labels-in-graph.ts
|
|
12082
|
-
var
|
|
12083
|
-
|
|
12142
|
+
var app33 = new Hono();
|
|
12143
|
+
app33.get("/", requireAdminSession, async (c) => {
|
|
12084
12144
|
const cacheKey = c.var.cacheKey;
|
|
12085
12145
|
const accountId = getAccountIdForSession(cacheKey);
|
|
12086
12146
|
if (!accountId) {
|
|
@@ -12146,11 +12206,11 @@ var LABELS_IN_GRAPH_CYPHER = `
|
|
|
12146
12206
|
sum(halfEdges) AS relDegree
|
|
12147
12207
|
RETURN label, nodeCount, relDegree
|
|
12148
12208
|
`;
|
|
12149
|
-
var graph_labels_in_graph_default =
|
|
12209
|
+
var graph_labels_in_graph_default = app33;
|
|
12150
12210
|
|
|
12151
12211
|
// server/routes/admin/graph-default-view.ts
|
|
12152
|
-
var
|
|
12153
|
-
|
|
12212
|
+
var app34 = new Hono();
|
|
12213
|
+
app34.get("/", requireAdminSession, async (c) => {
|
|
12154
12214
|
const cacheKey = c.var.cacheKey;
|
|
12155
12215
|
const accountId = getAccountIdForSession(cacheKey);
|
|
12156
12216
|
const userId = getUserIdForSession(cacheKey);
|
|
@@ -12188,7 +12248,7 @@ app32.get("/", requireAdminSession, async (c) => {
|
|
|
12188
12248
|
}
|
|
12189
12249
|
}
|
|
12190
12250
|
});
|
|
12191
|
-
|
|
12251
|
+
app34.put("/", requireAdminSession, async (c) => {
|
|
12192
12252
|
const cacheKey = c.var.cacheKey;
|
|
12193
12253
|
const accountId = getAccountIdForSession(cacheKey);
|
|
12194
12254
|
const userId = getUserIdForSession(cacheKey);
|
|
@@ -12277,11 +12337,11 @@ var WRITE_CYPHER = `
|
|
|
12277
12337
|
p.updatedAt = $updatedAt
|
|
12278
12338
|
RETURN p.labels AS labels
|
|
12279
12339
|
`;
|
|
12280
|
-
var graph_default_view_default =
|
|
12340
|
+
var graph_default_view_default = app34;
|
|
12281
12341
|
|
|
12282
12342
|
// server/routes/admin/file-attach.ts
|
|
12283
|
-
var
|
|
12284
|
-
|
|
12343
|
+
var app35 = new Hono();
|
|
12344
|
+
app35.post("/", async (c) => {
|
|
12285
12345
|
try {
|
|
12286
12346
|
const body = await c.req.json();
|
|
12287
12347
|
const { filePath, accountId } = body;
|
|
@@ -12304,7 +12364,7 @@ app33.post("/", async (c) => {
|
|
|
12304
12364
|
return c.json({ error: message }, 500);
|
|
12305
12365
|
}
|
|
12306
12366
|
});
|
|
12307
|
-
var file_attach_default =
|
|
12367
|
+
var file_attach_default = app35;
|
|
12308
12368
|
|
|
12309
12369
|
// server/routes/admin/sidebar-artefacts.ts
|
|
12310
12370
|
import neo4j3 from "neo4j-driver";
|
|
@@ -12314,8 +12374,8 @@ import { existsSync as existsSync19 } from "fs";
|
|
|
12314
12374
|
var LIMIT = 50;
|
|
12315
12375
|
var TEXT_MIME_PREFIXES = ["text/", "application/json", "application/markdown"];
|
|
12316
12376
|
var ADMIN_AGENT_FILES = ["IDENTITY.md", "SOUL.md", "KNOWLEDGE.md"];
|
|
12317
|
-
var
|
|
12318
|
-
|
|
12377
|
+
var app36 = new Hono();
|
|
12378
|
+
app36.get("/", requireAdminSession, async (c) => {
|
|
12319
12379
|
const cacheKey = c.var.cacheKey;
|
|
12320
12380
|
const accountId = getAccountIdForSession(cacheKey);
|
|
12321
12381
|
if (!accountId) {
|
|
@@ -12521,7 +12581,7 @@ function isWithin(target, root) {
|
|
|
12521
12581
|
const rel = relative2(root, target);
|
|
12522
12582
|
return !rel.startsWith("..") && !isAbsolute(rel);
|
|
12523
12583
|
}
|
|
12524
|
-
var sidebar_artefacts_default =
|
|
12584
|
+
var sidebar_artefacts_default = app36;
|
|
12525
12585
|
|
|
12526
12586
|
// server/routes/admin/sidebar-artefact-save.ts
|
|
12527
12587
|
import { mkdir as mkdir3, readdir as readdir4, stat as stat5, writeFile as writeFile4 } from "fs/promises";
|
|
@@ -12529,8 +12589,8 @@ import { resolve as resolve16 } from "path";
|
|
|
12529
12589
|
import { existsSync as existsSync20 } from "fs";
|
|
12530
12590
|
var ADMIN_AGENT_FILES2 = /* @__PURE__ */ new Set(["IDENTITY.md", "SOUL.md", "KNOWLEDGE.md"]);
|
|
12531
12591
|
var UUID_RE8 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
12532
|
-
var
|
|
12533
|
-
|
|
12592
|
+
var app37 = new Hono();
|
|
12593
|
+
app37.post("/", requireAdminSession, async (c) => {
|
|
12534
12594
|
const cacheKey = c.var.cacheKey;
|
|
12535
12595
|
const accountId = getAccountIdForSession(cacheKey);
|
|
12536
12596
|
if (!accountId) return c.json({ error: "Account not found for session" }, 401);
|
|
@@ -12642,15 +12702,15 @@ async function resolveSavePath(id, accountId, accountDir) {
|
|
|
12642
12702
|
function relPath(absPath, root) {
|
|
12643
12703
|
return absPath.startsWith(root) ? absPath.slice(root.length + 1) : absPath;
|
|
12644
12704
|
}
|
|
12645
|
-
var sidebar_artefact_save_default =
|
|
12705
|
+
var sidebar_artefact_save_default = app37;
|
|
12646
12706
|
|
|
12647
12707
|
// server/routes/admin/sidebar-artefact-content.ts
|
|
12648
12708
|
import { readFile as readFile5, readdir as readdir5 } from "fs/promises";
|
|
12649
12709
|
import { existsSync as existsSync21 } from "fs";
|
|
12650
12710
|
import { resolve as resolve17 } from "path";
|
|
12651
12711
|
var UUID_RE9 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
12652
|
-
var
|
|
12653
|
-
|
|
12712
|
+
var app38 = new Hono();
|
|
12713
|
+
app38.get("/", requireAdminSession, async (c) => {
|
|
12654
12714
|
const cacheKey = c.var.cacheKey;
|
|
12655
12715
|
const accountId = getAccountIdForSession(cacheKey);
|
|
12656
12716
|
if (!accountId) return new Response("Unauthorized", { status: 401 });
|
|
@@ -12691,7 +12751,7 @@ app36.get("/", requireAdminSession, async (c) => {
|
|
|
12691
12751
|
}
|
|
12692
12752
|
});
|
|
12693
12753
|
});
|
|
12694
|
-
var sidebar_artefact_content_default =
|
|
12754
|
+
var sidebar_artefact_content_default = app38;
|
|
12695
12755
|
|
|
12696
12756
|
// server/routes/admin/health.ts
|
|
12697
12757
|
import { existsSync as existsSync22, readFileSync as readFileSync16 } from "fs";
|
|
@@ -12736,8 +12796,8 @@ async function probeConversationDb() {
|
|
|
12736
12796
|
});
|
|
12737
12797
|
}
|
|
12738
12798
|
}
|
|
12739
|
-
var
|
|
12740
|
-
|
|
12799
|
+
var app39 = new Hono();
|
|
12800
|
+
app39.get("/", async (c) => {
|
|
12741
12801
|
const version = readVersion();
|
|
12742
12802
|
const probe = await probeConversationDb();
|
|
12743
12803
|
const uptimeMs = Date.now() - new Date(PROCESS_STARTED_AT).getTime();
|
|
@@ -12759,39 +12819,41 @@ app37.get("/", async (c) => {
|
|
|
12759
12819
|
uptimeMs
|
|
12760
12820
|
});
|
|
12761
12821
|
});
|
|
12762
|
-
var health_default2 =
|
|
12822
|
+
var health_default2 = app39;
|
|
12763
12823
|
|
|
12764
12824
|
// server/routes/admin/index.ts
|
|
12765
|
-
var
|
|
12766
|
-
|
|
12767
|
-
|
|
12768
|
-
|
|
12769
|
-
|
|
12770
|
-
|
|
12771
|
-
|
|
12772
|
-
|
|
12773
|
-
|
|
12774
|
-
|
|
12775
|
-
|
|
12776
|
-
|
|
12777
|
-
|
|
12778
|
-
|
|
12779
|
-
|
|
12780
|
-
|
|
12781
|
-
|
|
12782
|
-
|
|
12783
|
-
|
|
12784
|
-
|
|
12785
|
-
|
|
12786
|
-
|
|
12787
|
-
|
|
12788
|
-
|
|
12789
|
-
|
|
12790
|
-
|
|
12791
|
-
|
|
12792
|
-
|
|
12793
|
-
|
|
12794
|
-
|
|
12825
|
+
var app40 = new Hono();
|
|
12826
|
+
app40.route("/session", session_default2);
|
|
12827
|
+
app40.route("/chat", chat_default2);
|
|
12828
|
+
app40.route("/chat-failure", chat_failure_default);
|
|
12829
|
+
app40.route("/new-session-failure", new_session_failure_default);
|
|
12830
|
+
app40.route("/new-session-submit", new_session_submit_default);
|
|
12831
|
+
app40.route("/failure-report", failure_report_default);
|
|
12832
|
+
app40.route("/sse-telemetry", sse_telemetry_default);
|
|
12833
|
+
app40.route("/compact", compact_default);
|
|
12834
|
+
app40.route("/logs", logs_default);
|
|
12835
|
+
app40.route("/claude-info", claude_info_default);
|
|
12836
|
+
app40.route("/attachment", attachment_default);
|
|
12837
|
+
app40.route("/agents", agents_default);
|
|
12838
|
+
app40.route("/sessions", sessions_default);
|
|
12839
|
+
app40.route("/browser", browser_default);
|
|
12840
|
+
app40.route("/browser-iframe", browser_iframe_default);
|
|
12841
|
+
app40.route("/device-browser", device_browser_default);
|
|
12842
|
+
app40.route("/events", events_default);
|
|
12843
|
+
app40.route("/cloudflare", cloudflare_default);
|
|
12844
|
+
app40.route("/files", files_default);
|
|
12845
|
+
app40.route("/graph-search", graph_search_default);
|
|
12846
|
+
app40.route("/graph-subgraph", graph_subgraph_default);
|
|
12847
|
+
app40.route("/graph-delete", graph_delete_default);
|
|
12848
|
+
app40.route("/graph-restore", graph_restore_default);
|
|
12849
|
+
app40.route("/graph-labels-in-graph", graph_labels_in_graph_default);
|
|
12850
|
+
app40.route("/graph-default-view", graph_default_view_default);
|
|
12851
|
+
app40.route("/file-attach", file_attach_default);
|
|
12852
|
+
app40.route("/sidebar-artefacts", sidebar_artefacts_default);
|
|
12853
|
+
app40.route("/sidebar-artefact-save", sidebar_artefact_save_default);
|
|
12854
|
+
app40.route("/sidebar-artefact-content", sidebar_artefact_content_default);
|
|
12855
|
+
app40.route("/health-brand", health_default2);
|
|
12856
|
+
var admin_default = app40;
|
|
12795
12857
|
|
|
12796
12858
|
// server/routes/sites.ts
|
|
12797
12859
|
import { existsSync as existsSync23, readFileSync as readFileSync17, realpathSync as realpathSync4, statSync as statSync7 } from "fs";
|
|
@@ -12826,8 +12888,8 @@ function getExt(p) {
|
|
|
12826
12888
|
if (idx < p.lastIndexOf("/")) return "";
|
|
12827
12889
|
return p.slice(idx).toLowerCase();
|
|
12828
12890
|
}
|
|
12829
|
-
var
|
|
12830
|
-
|
|
12891
|
+
var app41 = new Hono();
|
|
12892
|
+
app41.get("/:rel{.*}", (c) => {
|
|
12831
12893
|
const reqPath = c.req.path;
|
|
12832
12894
|
const rawRel = c.req.param("rel") ?? "";
|
|
12833
12895
|
const trimmed = rawRel.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
@@ -12930,7 +12992,7 @@ app39.get("/:rel{.*}", (c) => {
|
|
|
12930
12992
|
"X-Content-Type-Options": "nosniff"
|
|
12931
12993
|
});
|
|
12932
12994
|
});
|
|
12933
|
-
var sites_default =
|
|
12995
|
+
var sites_default = app41;
|
|
12934
12996
|
|
|
12935
12997
|
// app/lib/graph-health.ts
|
|
12936
12998
|
var HOUR_MS = 60 * 60 * 1e3;
|
|
@@ -13340,9 +13402,9 @@ watchFile(ALIAS_DOMAINS_PATH2, { interval: 2e3 }, () => {
|
|
|
13340
13402
|
function isPublicHost(host) {
|
|
13341
13403
|
return host.startsWith("public.") || aliasDomains.has(host);
|
|
13342
13404
|
}
|
|
13343
|
-
var
|
|
13344
|
-
|
|
13345
|
-
|
|
13405
|
+
var app42 = new Hono();
|
|
13406
|
+
app42.use("*", clientIpMiddleware);
|
|
13407
|
+
app42.use("*", async (c, next) => {
|
|
13346
13408
|
await next();
|
|
13347
13409
|
c.header("X-Content-Type-Options", "nosniff");
|
|
13348
13410
|
c.header("Referrer-Policy", "strict-origin-when-cross-origin");
|
|
@@ -13352,7 +13414,7 @@ app40.use("*", async (c, next) => {
|
|
|
13352
13414
|
);
|
|
13353
13415
|
});
|
|
13354
13416
|
var HTTP_LOG_PATHS = /* @__PURE__ */ new Set(["/vnc-viewer.html", "/vnc-popout.html"]);
|
|
13355
|
-
|
|
13417
|
+
app42.use("*", async (c, next) => {
|
|
13356
13418
|
if (!HTTP_LOG_PATHS.has(c.req.path)) {
|
|
13357
13419
|
await next();
|
|
13358
13420
|
return;
|
|
@@ -13385,7 +13447,7 @@ var PUBLIC_ALLOWED_PREFIXES = [
|
|
|
13385
13447
|
"/sites/"
|
|
13386
13448
|
];
|
|
13387
13449
|
var PUBLIC_ALLOWED_EXACT = ["/favicon.ico"];
|
|
13388
|
-
|
|
13450
|
+
app42.use("*", async (c, next) => {
|
|
13389
13451
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
13390
13452
|
if (!isPublicHost(host)) {
|
|
13391
13453
|
await next();
|
|
@@ -13425,7 +13487,7 @@ function resolveRemoteAuthOpts() {
|
|
|
13425
13487
|
return brandLoginOpts;
|
|
13426
13488
|
}
|
|
13427
13489
|
var MAX_LOGIN_BODY = 8 * 1024;
|
|
13428
|
-
|
|
13490
|
+
app42.post("/__remote-auth/login", async (c) => {
|
|
13429
13491
|
const client = clientFrom(c);
|
|
13430
13492
|
const clientIp = client.ip || "unknown";
|
|
13431
13493
|
if (!requestIsTlsTerminated(c)) {
|
|
@@ -13470,7 +13532,7 @@ app40.post("/__remote-auth/login", async (c) => {
|
|
|
13470
13532
|
}
|
|
13471
13533
|
});
|
|
13472
13534
|
});
|
|
13473
|
-
|
|
13535
|
+
app42.get("/__remote-auth/logout", (c) => {
|
|
13474
13536
|
const client = clientFrom(c);
|
|
13475
13537
|
const clientIp = client.ip || "unknown";
|
|
13476
13538
|
console.error(`[remote-auth] logout ip=${clientIp}`);
|
|
@@ -13483,7 +13545,7 @@ app40.get("/__remote-auth/logout", (c) => {
|
|
|
13483
13545
|
}
|
|
13484
13546
|
});
|
|
13485
13547
|
});
|
|
13486
|
-
|
|
13548
|
+
app42.post("/__remote-auth/change-password", async (c) => {
|
|
13487
13549
|
const client = clientFrom(c);
|
|
13488
13550
|
const clientIp = client.ip || "unknown";
|
|
13489
13551
|
const rateLimited = checkRateLimit(client);
|
|
@@ -13534,13 +13596,13 @@ app40.post("/__remote-auth/change-password", async (c) => {
|
|
|
13534
13596
|
return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(), mode: "change", changeError: "Failed to save password", redirect }), 200);
|
|
13535
13597
|
}
|
|
13536
13598
|
});
|
|
13537
|
-
|
|
13599
|
+
app42.get("/__remote-auth/setup", (c) => {
|
|
13538
13600
|
if (isRemoteAuthConfigured()) {
|
|
13539
13601
|
return c.redirect("/");
|
|
13540
13602
|
}
|
|
13541
13603
|
return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(), mode: "setup" }), 200);
|
|
13542
13604
|
});
|
|
13543
|
-
|
|
13605
|
+
app42.post("/__remote-auth/set-initial-password", async (c) => {
|
|
13544
13606
|
if (isRemoteAuthConfigured()) {
|
|
13545
13607
|
return c.redirect("/");
|
|
13546
13608
|
}
|
|
@@ -13578,10 +13640,10 @@ app40.post("/__remote-auth/set-initial-password", async (c) => {
|
|
|
13578
13640
|
return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(), mode: "setup", setupError: "Failed to save password. Please try again." }), 200);
|
|
13579
13641
|
}
|
|
13580
13642
|
});
|
|
13581
|
-
|
|
13643
|
+
app42.get("/api/remote-auth/status", (c) => {
|
|
13582
13644
|
return c.json({ configured: isRemoteAuthConfigured() });
|
|
13583
13645
|
});
|
|
13584
|
-
|
|
13646
|
+
app42.post("/api/remote-auth/set-password", async (c) => {
|
|
13585
13647
|
let body;
|
|
13586
13648
|
try {
|
|
13587
13649
|
body = await c.req.json();
|
|
@@ -13612,9 +13674,9 @@ app40.post("/api/remote-auth/set-password", async (c) => {
|
|
|
13612
13674
|
return c.json({ error: "Failed to save password" }, 500);
|
|
13613
13675
|
}
|
|
13614
13676
|
});
|
|
13615
|
-
|
|
13677
|
+
app42.route("/api/_client-error", client_error_default);
|
|
13616
13678
|
console.log("[client-error-route] mounted");
|
|
13617
|
-
|
|
13679
|
+
app42.use("*", async (c, next) => {
|
|
13618
13680
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
13619
13681
|
const path2 = c.req.path;
|
|
13620
13682
|
if (path2 === "/favicon.ico" || path2.startsWith("/assets/") || path2.startsWith("/brand/")) {
|
|
@@ -13654,15 +13716,15 @@ app40.use("*", async (c, next) => {
|
|
|
13654
13716
|
console.error(`[remote-auth] login required ip=${clientIp} path=${path2} ${disambig}`);
|
|
13655
13717
|
return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(), redirect: path2 }), 200);
|
|
13656
13718
|
});
|
|
13657
|
-
|
|
13658
|
-
|
|
13659
|
-
|
|
13660
|
-
|
|
13661
|
-
|
|
13662
|
-
|
|
13663
|
-
|
|
13664
|
-
|
|
13665
|
-
|
|
13719
|
+
app42.route("/api/health", health_default);
|
|
13720
|
+
app42.route("/api/session", session_default);
|
|
13721
|
+
app42.route("/api/chat", chat_default);
|
|
13722
|
+
app42.route("/api/group", group_default);
|
|
13723
|
+
app42.route("/api/access", access_default);
|
|
13724
|
+
app42.route("/api/telegram", telegram_default);
|
|
13725
|
+
app42.route("/api/whatsapp", whatsapp_default);
|
|
13726
|
+
app42.route("/api/onboarding", onboarding_default);
|
|
13727
|
+
app42.route("/api/admin", admin_default);
|
|
13666
13728
|
var SAFE_SLUG_RE = /^[a-z][a-z0-9-]{2,49}$/;
|
|
13667
13729
|
var SAFE_FILENAME_RE = /^[a-z0-9_][a-z0-9_.-]{0,99}$/i;
|
|
13668
13730
|
var IMAGE_MIME = {
|
|
@@ -13674,7 +13736,7 @@ var IMAGE_MIME = {
|
|
|
13674
13736
|
".svg": "image/svg+xml",
|
|
13675
13737
|
".ico": "image/x-icon"
|
|
13676
13738
|
};
|
|
13677
|
-
|
|
13739
|
+
app42.get("/agent-assets/:slug/:filename", (c) => {
|
|
13678
13740
|
const slug = c.req.param("slug");
|
|
13679
13741
|
const filename = c.req.param("filename");
|
|
13680
13742
|
if (!SAFE_SLUG_RE.test(slug)) {
|
|
@@ -13709,7 +13771,7 @@ app40.get("/agent-assets/:slug/:filename", (c) => {
|
|
|
13709
13771
|
"Cache-Control": "public, max-age=3600"
|
|
13710
13772
|
});
|
|
13711
13773
|
});
|
|
13712
|
-
|
|
13774
|
+
app42.get("/generated/:filename", (c) => {
|
|
13713
13775
|
const filename = c.req.param("filename");
|
|
13714
13776
|
if (!SAFE_FILENAME_RE.test(filename) || filename.includes("..")) {
|
|
13715
13777
|
console.error(`[generated] serve file=${filename} status=403`);
|
|
@@ -13739,7 +13801,7 @@ app40.get("/generated/:filename", (c) => {
|
|
|
13739
13801
|
"Cache-Control": "public, max-age=86400"
|
|
13740
13802
|
});
|
|
13741
13803
|
});
|
|
13742
|
-
|
|
13804
|
+
app42.route("/sites", sites_default);
|
|
13743
13805
|
var htmlCache = /* @__PURE__ */ new Map();
|
|
13744
13806
|
var brandLogoPath = "/brand/maxy-monochrome.png";
|
|
13745
13807
|
var brandIconPath = "/brand/maxy-monochrome.png";
|
|
@@ -13876,7 +13938,7 @@ function brandedPublicHtml(agentSlug) {
|
|
|
13876
13938
|
function escapeHtml(s) {
|
|
13877
13939
|
return s.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
13878
13940
|
}
|
|
13879
|
-
|
|
13941
|
+
app42.get("/", (c) => {
|
|
13880
13942
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
13881
13943
|
if (isPublicHost(host)) {
|
|
13882
13944
|
const defaultSlug = resolveDefaultSlug();
|
|
@@ -13884,12 +13946,12 @@ app40.get("/", (c) => {
|
|
|
13884
13946
|
}
|
|
13885
13947
|
return c.html(cachedHtml("index.html"));
|
|
13886
13948
|
});
|
|
13887
|
-
|
|
13949
|
+
app42.get("/public", (c) => {
|
|
13888
13950
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
13889
13951
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
13890
13952
|
return c.html(cachedHtml("public.html"));
|
|
13891
13953
|
});
|
|
13892
|
-
|
|
13954
|
+
app42.get("/chat", (c) => {
|
|
13893
13955
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
13894
13956
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
13895
13957
|
return c.html(cachedHtml("public.html"));
|
|
@@ -13908,9 +13970,9 @@ async function logViewerFetch(c, next) {
|
|
|
13908
13970
|
duration_ms: Date.now() - start
|
|
13909
13971
|
});
|
|
13910
13972
|
}
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
|
|
13973
|
+
app42.use("/vnc-viewer.html", logViewerFetch);
|
|
13974
|
+
app42.use("/vnc-popout.html", logViewerFetch);
|
|
13975
|
+
app42.get("/vnc-popout.html", (c) => {
|
|
13914
13976
|
let html = htmlCache.get("vnc-popout.html");
|
|
13915
13977
|
if (!html) {
|
|
13916
13978
|
html = readFileSync19(resolve21(process.cwd(), "public", "vnc-popout.html"), "utf-8");
|
|
@@ -13923,7 +13985,7 @@ app40.get("/vnc-popout.html", (c) => {
|
|
|
13923
13985
|
}
|
|
13924
13986
|
return c.html(html);
|
|
13925
13987
|
});
|
|
13926
|
-
|
|
13988
|
+
app42.post("/api/vnc/client-event", async (c) => {
|
|
13927
13989
|
let body;
|
|
13928
13990
|
try {
|
|
13929
13991
|
body = await c.req.json();
|
|
@@ -13944,20 +14006,20 @@ app40.post("/api/vnc/client-event", async (c) => {
|
|
|
13944
14006
|
});
|
|
13945
14007
|
return c.json({ ok: true });
|
|
13946
14008
|
});
|
|
13947
|
-
|
|
14009
|
+
app42.get("/g/:slug", (c) => {
|
|
13948
14010
|
return c.html(brandedPublicHtml());
|
|
13949
14011
|
});
|
|
13950
|
-
|
|
14012
|
+
app42.get("/graph", (c) => {
|
|
13951
14013
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
13952
14014
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
13953
14015
|
return c.html(cachedHtml("graph.html"));
|
|
13954
14016
|
});
|
|
13955
|
-
|
|
14017
|
+
app42.get("/data", (c) => {
|
|
13956
14018
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
13957
14019
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
13958
14020
|
return c.html(cachedHtml("data.html"));
|
|
13959
14021
|
});
|
|
13960
|
-
|
|
14022
|
+
app42.get("/:slug", async (c, next) => {
|
|
13961
14023
|
const slug = c.req.param("slug");
|
|
13962
14024
|
if (AGENT_SLUG_PATTERN.test(`/${slug}`)) {
|
|
13963
14025
|
const branding = loadBrandingCache(slug);
|
|
@@ -13967,15 +14029,15 @@ app40.get("/:slug", async (c, next) => {
|
|
|
13967
14029
|
await next();
|
|
13968
14030
|
});
|
|
13969
14031
|
if (brandFaviconPath !== "/favicon.ico") {
|
|
13970
|
-
|
|
14032
|
+
app42.get("/favicon.ico", (c) => {
|
|
13971
14033
|
c.header("Cache-Control", "public, max-age=300");
|
|
13972
14034
|
return c.redirect(brandFaviconPath, 302);
|
|
13973
14035
|
});
|
|
13974
14036
|
}
|
|
13975
|
-
|
|
14037
|
+
app42.use("/*", serveStatic({ root: "./public" }));
|
|
13976
14038
|
var port = parseInt(process.env.MAXY_UI_INTERNAL_PORT ?? process.env.PORT ?? "19199", 10);
|
|
13977
14039
|
var hostname = process.env.HOSTNAME ?? "127.0.0.1";
|
|
13978
|
-
var httpServer = serve({ fetch:
|
|
14040
|
+
var httpServer = serve({ fetch: app42.fetch, port, hostname });
|
|
13979
14041
|
console.log(`${BRAND.productName} listening on http://${hostname}:${port}`);
|
|
13980
14042
|
console.log("[boot] auth-mode summary: oauth=8 api-key=1 (api-key consumer: invokePublicAgent only)");
|
|
13981
14043
|
var SUBAPP_MANIFEST = [
|
|
@@ -13996,7 +14058,7 @@ for (const m of SUBAPP_MANIFEST) {
|
|
|
13996
14058
|
}
|
|
13997
14059
|
try {
|
|
13998
14060
|
const registered = [];
|
|
13999
|
-
for (const r of
|
|
14061
|
+
for (const r of app42.routes ?? []) {
|
|
14000
14062
|
if (typeof r.path !== "string" || r.path.includes(":") || r.path.includes("*")) continue;
|
|
14001
14063
|
if (AGENT_SLUG_PATTERN.test(r.path)) {
|
|
14002
14064
|
registered.push({ method: (r.method ?? "ALL").toUpperCase(), path: r.path });
|