@rubytech/create-realagent 1.0.858 → 1.0.859

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.
@@ -6,6 +6,7 @@ import {
6
6
  SUPPORTED_MIME_TYPES,
7
7
  assertSupportedMime,
8
8
  autoDeliverPremiumPlugins,
9
+ browserViewerLog,
9
10
  buildX11Env,
10
11
  callOauthLlm,
11
12
  canAccessAdmin,
@@ -25,6 +26,7 @@ import {
25
26
  ensureVnc,
26
27
  findMissingPlugins,
27
28
  hashPassword,
29
+ httpLog,
28
30
  invokeAgent,
29
31
  isActionActive,
30
32
  isPasswordValid,
@@ -62,7 +64,7 @@ import {
62
64
  vncLog,
63
65
  waitForExit,
64
66
  writeChromiumWrapper
65
- } from "./chunk-CNNPNADU.js";
67
+ } from "./chunk-2Q2S52GB.js";
66
68
  import {
67
69
  ACCOUNTS_DIR,
68
70
  CDP_PORT,
@@ -107,7 +109,7 @@ import {
107
109
  unregisterSession,
108
110
  validateAgentSlug,
109
111
  validateSession
110
- } from "./chunk-FL3H3AQD.js";
112
+ } from "./chunk-22LK7D5R.js";
111
113
  import {
112
114
  CLOUDFLARE_TASK_DIAGNOSTICS,
113
115
  appendCloudflareSteps,
@@ -7434,7 +7436,7 @@ var app11 = new Hono();
7434
7436
  app11.post("/cancel", requireAdminSession, async (c) => {
7435
7437
  const session_key = c.var.sessionKey;
7436
7438
  try {
7437
- const { interruptClient: interruptClient2 } = await import("./client-pool-WA5WGN7W.js");
7439
+ const { interruptClient: interruptClient2 } = await import("./client-pool-3BCJTPPA.js");
7438
7440
  await interruptClient2(session_key);
7439
7441
  return c.json({ ok: true });
7440
7442
  } catch (err) {
@@ -8893,6 +8895,45 @@ app18.post("/launch", async (c) => {
8893
8895
  });
8894
8896
  var browser_default = app18;
8895
8897
 
8898
+ // server/routes/admin/browser-iframe.ts
8899
+ var ALLOWED_EVENTS = /* @__PURE__ */ new Set([
8900
+ "mount",
8901
+ "unmount",
8902
+ "rfb-connected",
8903
+ "rfb-error",
8904
+ "iframe-load"
8905
+ ]);
8906
+ function asString(v, max = 500) {
8907
+ if (typeof v !== "string") return void 0;
8908
+ return v.length > max ? v.slice(0, max) : v;
8909
+ }
8910
+ function asNumber(v) {
8911
+ return typeof v === "number" && Number.isFinite(v) ? v : void 0;
8912
+ }
8913
+ var app19 = new Hono();
8914
+ app19.post("/event", async (c) => {
8915
+ let body = {};
8916
+ try {
8917
+ body = await c.req.json();
8918
+ } catch {
8919
+ browserViewerLog("invalid", { reason: "body-not-json" });
8920
+ return c.body(null, 204);
8921
+ }
8922
+ const eventRaw = asString(body.event, 64);
8923
+ const event = eventRaw && ALLOWED_EVENTS.has(eventRaw) ? eventRaw : "invalid";
8924
+ browserViewerLog(event, {
8925
+ brand: asString(body.brand, 64),
8926
+ conversationId: asString(body.conversationId, 64),
8927
+ session_key: asString(body.session_key, 128),
8928
+ durationMs: asNumber(body.durationMs),
8929
+ errorCode: asString(body.errorCode, 64),
8930
+ message: asString(body.message, 200),
8931
+ surface: asString(body.surface, 32)
8932
+ });
8933
+ return c.body(null, 204);
8934
+ });
8935
+ var browser_iframe_default = app19;
8936
+
8896
8937
  // app/lib/cdp-client.ts
8897
8938
  var CDP_HOST = "127.0.0.1";
8898
8939
  var CDP_PORT2 = CDP_PORT;
@@ -8934,8 +8975,8 @@ async function cdpNavigateNewTab(url, opts = {}) {
8934
8975
  }
8935
8976
 
8936
8977
  // server/routes/admin/device-browser.ts
8937
- var app19 = new Hono();
8938
- app19.post("/navigate", async (c) => {
8978
+ var app20 = new Hono();
8979
+ app20.post("/navigate", async (c) => {
8939
8980
  const TAG19 = "[device-url:click]";
8940
8981
  let body;
8941
8982
  try {
@@ -9022,17 +9063,17 @@ app19.post("/navigate", async (c) => {
9022
9063
  targetId: outcome.targetId
9023
9064
  });
9024
9065
  });
9025
- var device_browser_default = app19;
9066
+ var device_browser_default = app20;
9026
9067
 
9027
9068
  // server/routes/admin/events.ts
9028
- var ALLOWED_EVENTS = /* @__PURE__ */ new Set([
9069
+ var ALLOWED_EVENTS2 = /* @__PURE__ */ new Set([
9029
9070
  "device-url:render",
9030
9071
  "device-url:fallback-shown",
9031
9072
  "device-url:vnc-surface-shown",
9032
9073
  "device-url:malformed"
9033
9074
  ]);
9034
- var app20 = new Hono();
9035
- app20.post("/", async (c) => {
9075
+ var app21 = new Hono();
9076
+ app21.post("/", async (c) => {
9036
9077
  const TAG19 = "[admin:events]";
9037
9078
  let body;
9038
9079
  try {
@@ -9043,7 +9084,7 @@ app20.post("/", async (c) => {
9043
9084
  return c.json({ ok: false, detail: "Request body was not valid JSON" }, 400);
9044
9085
  }
9045
9086
  const event = typeof body.event === "string" ? body.event : "";
9046
- if (!ALLOWED_EVENTS.has(event)) {
9087
+ if (!ALLOWED_EVENTS2.has(event)) {
9047
9088
  console.error(`${TAG19} reject reason=event-not-allowed event=${JSON.stringify(event)}`);
9048
9089
  return c.json({ ok: false, detail: `Event "${event}" is not allowed` }, 400);
9049
9090
  }
@@ -9063,7 +9104,7 @@ app20.post("/", async (c) => {
9063
9104
  console.error(`[${event}] ${formatted}`);
9064
9105
  return c.json({ ok: true });
9065
9106
  });
9066
- var events_default = app20;
9107
+ var events_default = app21;
9067
9108
 
9068
9109
  // server/routes/admin/cloudflare.ts
9069
9110
  import { homedir as homedir2 } from "os";
@@ -9181,7 +9222,7 @@ function validateBody(body) {
9181
9222
  }
9182
9223
  return null;
9183
9224
  }
9184
- var app21 = new Hono();
9225
+ var app22 = new Hono();
9185
9226
  function fieldFromReason(reason) {
9186
9227
  switch (reason) {
9187
9228
  case "not-signed-in":
@@ -9202,7 +9243,7 @@ function fieldFromReason(reason) {
9202
9243
  return "script";
9203
9244
  }
9204
9245
  }
9205
- app21.get("/domains", requireAdminSession, async (c) => {
9246
+ app22.get("/domains", requireAdminSession, async (c) => {
9206
9247
  const started = Date.now();
9207
9248
  const sessionKey = c.var.sessionKey;
9208
9249
  let correlationId;
@@ -9297,7 +9338,7 @@ ${result.stderr}` : ""}`;
9297
9338
  return c.json(success, 200);
9298
9339
  });
9299
9340
  var TUNNELS_TIMEOUT_MS = 30 * 1e3;
9300
- app21.get("/tunnels", requireAdminSession, async (c) => {
9341
+ app22.get("/tunnels", requireAdminSession, async (c) => {
9301
9342
  const started = Date.now();
9302
9343
  const sessionKey = c.var.sessionKey;
9303
9344
  let correlationId;
@@ -9385,7 +9426,7 @@ ${result.stderr}` : ""}`;
9385
9426
  const success = { ok: true, tunnels, defaultName, correlationId, streamLogPath };
9386
9427
  return c.json(success, 200);
9387
9428
  });
9388
- app21.post("/setup", requireAdminSession, async (c) => {
9429
+ app22.post("/setup", requireAdminSession, async (c) => {
9389
9430
  const started = Date.now();
9390
9431
  const sessionKey = c.var.sessionKey;
9391
9432
  let correlationId;
@@ -9622,7 +9663,7 @@ actionId: ${actionId}`,
9622
9663
  };
9623
9664
  return ok(success);
9624
9665
  });
9625
- var cloudflare_default = app21;
9666
+ var cloudflare_default = app22;
9626
9667
 
9627
9668
  // server/routes/admin/files.ts
9628
9669
  import { createReadStream as createReadStream3 } from "fs";
@@ -10055,8 +10096,8 @@ function buildDisplayPath(relPath2, accountNames) {
10055
10096
  return dn ? { name: seg, displayName: dn } : { name: seg };
10056
10097
  });
10057
10098
  }
10058
- var app22 = new Hono();
10059
- app22.get("/", requireAdminSession, async (c) => {
10099
+ var app23 = new Hono();
10100
+ app23.get("/", requireAdminSession, async (c) => {
10060
10101
  const sessionKey = c.var.sessionKey;
10061
10102
  if (!getAccountIdForSession(sessionKey)) {
10062
10103
  console.error(`[data] auth-rejected endpoint="/api/admin/files" reason="no account for session"`);
@@ -10117,7 +10158,7 @@ app22.get("/", requireAdminSession, async (c) => {
10117
10158
  return c.json({ error: message }, 500);
10118
10159
  }
10119
10160
  });
10120
- app22.get("/download", requireAdminSession, async (c) => {
10161
+ app23.get("/download", requireAdminSession, async (c) => {
10121
10162
  const sessionKey = c.var.sessionKey;
10122
10163
  if (!getAccountIdForSession(sessionKey)) {
10123
10164
  console.error(`[data] auth-rejected endpoint="/api/admin/files/download" reason="no account for session"`);
@@ -10165,7 +10206,7 @@ app22.get("/download", requireAdminSession, async (c) => {
10165
10206
  return c.json({ error: message }, 500);
10166
10207
  }
10167
10208
  });
10168
- app22.post("/upload", requireAdminSession, async (c) => {
10209
+ app23.post("/upload", requireAdminSession, async (c) => {
10169
10210
  const sessionKey = c.var.sessionKey;
10170
10211
  const accountId = getAccountIdForSession(sessionKey);
10171
10212
  if (!accountId) {
@@ -10223,7 +10264,7 @@ app22.post("/upload", requireAdminSession, async (c) => {
10223
10264
  mimeType: file.type
10224
10265
  });
10225
10266
  });
10226
- app22.delete("/", requireAdminSession, async (c) => {
10267
+ app23.delete("/", requireAdminSession, async (c) => {
10227
10268
  const sessionKey = c.var.sessionKey;
10228
10269
  const accountId = getAccountIdForSession(sessionKey);
10229
10270
  if (!accountId) {
@@ -10290,7 +10331,7 @@ app22.delete("/", requireAdminSession, async (c) => {
10290
10331
  return c.json({ error: message }, 500);
10291
10332
  }
10292
10333
  });
10293
- var files_default = app22;
10334
+ var files_default = app23;
10294
10335
 
10295
10336
  // ../lib/graph-search/src/index.ts
10296
10337
  var import_dist = __toESM(require_dist());
@@ -10622,8 +10663,8 @@ var DEFAULT_LIMIT = 20;
10622
10663
  var MAX_LIMIT = 2e3;
10623
10664
  var MESSAGE_FAMILY_LABELS = ["Message", "UserMessage", "AssistantMessage", "WhatsAppMessage"];
10624
10665
  var CONVERSATION_PARENT_LABELS = /* @__PURE__ */ new Set(["AdminConversation", "PublicConversation"]);
10625
- var app23 = new Hono();
10626
- app23.get("/", requireAdminSession, async (c) => {
10666
+ var app24 = new Hono();
10667
+ app24.get("/", requireAdminSession, async (c) => {
10627
10668
  const sessionKey = c.var.sessionKey;
10628
10669
  const q = (c.req.query("q") ?? "").trim();
10629
10670
  const rawLimit = c.req.query("limit");
@@ -10733,7 +10774,7 @@ app23.get("/", requireAdminSession, async (c) => {
10733
10774
  await session.close();
10734
10775
  }
10735
10776
  });
10736
- var graph_search_default = app23;
10777
+ var graph_search_default = app24;
10737
10778
 
10738
10779
  // server/routes/admin/graph-subgraph.ts
10739
10780
  import neo4j2 from "neo4j-driver";
@@ -10891,8 +10932,8 @@ var STRIPPED_PROPERTIES = /* @__PURE__ */ new Set([
10891
10932
  "otpCode",
10892
10933
  "sessionKey"
10893
10934
  ]);
10894
- var app24 = new Hono();
10895
- app24.get("/", requireAdminSession, async (c) => {
10935
+ var app25 = new Hono();
10936
+ app25.get("/", requireAdminSession, async (c) => {
10896
10937
  const sessionKey = c.var.sessionKey;
10897
10938
  const accountId = getAccountIdForSession(sessionKey);
10898
10939
  if (!accountId) {
@@ -11475,12 +11516,12 @@ function pruneNode(node, warnedClasses, conversationWarnings) {
11475
11516
  }
11476
11517
  return trashed ? { id: node.id, labels, properties, trashed: true } : { id: node.id, labels, properties };
11477
11518
  }
11478
- var graph_subgraph_default = app24;
11519
+ var graph_subgraph_default = app25;
11479
11520
 
11480
11521
  // server/routes/admin/graph-delete.ts
11481
11522
  var ALLOWED_BY = ["graph-page", "graph-drag-trash"];
11482
- var app25 = new Hono();
11483
- app25.post("/", requireAdminSession, async (c) => {
11523
+ var app26 = new Hono();
11524
+ app26.post("/", requireAdminSession, async (c) => {
11484
11525
  const sessionKey = c.var.sessionKey;
11485
11526
  const accountId = getAccountIdForSession(sessionKey);
11486
11527
  if (!accountId) {
@@ -11551,11 +11592,11 @@ app25.post("/", requireAdminSession, async (c) => {
11551
11592
  }
11552
11593
  }
11553
11594
  });
11554
- var graph_delete_default = app25;
11595
+ var graph_delete_default = app26;
11555
11596
 
11556
11597
  // server/routes/admin/graph-restore.ts
11557
- var app26 = new Hono();
11558
- app26.post("/", requireAdminSession, async (c) => {
11598
+ var app27 = new Hono();
11599
+ app27.post("/", requireAdminSession, async (c) => {
11559
11600
  const sessionKey = c.var.sessionKey;
11560
11601
  const accountId = getAccountIdForSession(sessionKey);
11561
11602
  if (!accountId) {
@@ -11619,11 +11660,11 @@ app26.post("/", requireAdminSession, async (c) => {
11619
11660
  }
11620
11661
  }
11621
11662
  });
11622
- var graph_restore_default = app26;
11663
+ var graph_restore_default = app27;
11623
11664
 
11624
11665
  // server/routes/admin/graph-labels-in-graph.ts
11625
- var app27 = new Hono();
11626
- app27.get("/", requireAdminSession, async (c) => {
11666
+ var app28 = new Hono();
11667
+ app28.get("/", requireAdminSession, async (c) => {
11627
11668
  const sessionKey = c.var.sessionKey;
11628
11669
  const accountId = getAccountIdForSession(sessionKey);
11629
11670
  if (!accountId) {
@@ -11689,11 +11730,11 @@ var LABELS_IN_GRAPH_CYPHER = `
11689
11730
  sum(halfEdges) AS relDegree
11690
11731
  RETURN label, nodeCount, relDegree
11691
11732
  `;
11692
- var graph_labels_in_graph_default = app27;
11733
+ var graph_labels_in_graph_default = app28;
11693
11734
 
11694
11735
  // server/routes/admin/graph-default-view.ts
11695
- var app28 = new Hono();
11696
- app28.get("/", requireAdminSession, async (c) => {
11736
+ var app29 = new Hono();
11737
+ app29.get("/", requireAdminSession, async (c) => {
11697
11738
  const sessionKey = c.var.sessionKey;
11698
11739
  const accountId = getAccountIdForSession(sessionKey);
11699
11740
  const userId = getUserIdForSession(sessionKey);
@@ -11731,7 +11772,7 @@ app28.get("/", requireAdminSession, async (c) => {
11731
11772
  }
11732
11773
  }
11733
11774
  });
11734
- app28.put("/", requireAdminSession, async (c) => {
11775
+ app29.put("/", requireAdminSession, async (c) => {
11735
11776
  const sessionKey = c.var.sessionKey;
11736
11777
  const accountId = getAccountIdForSession(sessionKey);
11737
11778
  const userId = getUserIdForSession(sessionKey);
@@ -11820,11 +11861,11 @@ var WRITE_CYPHER = `
11820
11861
  p.updatedAt = $updatedAt
11821
11862
  RETURN p.labels AS labels
11822
11863
  `;
11823
- var graph_default_view_default = app28;
11864
+ var graph_default_view_default = app29;
11824
11865
 
11825
11866
  // server/routes/admin/file-attach.ts
11826
- var app29 = new Hono();
11827
- app29.post("/", async (c) => {
11867
+ var app30 = new Hono();
11868
+ app30.post("/", async (c) => {
11828
11869
  try {
11829
11870
  const body = await c.req.json();
11830
11871
  const { filePath, accountId } = body;
@@ -11847,11 +11888,11 @@ app29.post("/", async (c) => {
11847
11888
  return c.json({ error: message }, 500);
11848
11889
  }
11849
11890
  });
11850
- var file_attach_default = app29;
11891
+ var file_attach_default = app30;
11851
11892
 
11852
11893
  // server/routes/admin/adherence.ts
11853
- var app30 = new Hono();
11854
- app30.get("/", requireAdminSession, async (c) => {
11894
+ var app31 = new Hono();
11895
+ app31.get("/", requireAdminSession, async (c) => {
11855
11896
  const agent = c.req.query("agent") ?? "admin";
11856
11897
  const includeBlock = c.req.query("block") === "1";
11857
11898
  const account = resolveAccount();
@@ -11872,7 +11913,7 @@ app30.get("/", requireAdminSession, async (c) => {
11872
11913
  return c.json({ error: "Failed to read adherence ledger", agent }, 500);
11873
11914
  }
11874
11915
  });
11875
- var adherence_default = app30;
11916
+ var adherence_default = app31;
11876
11917
 
11877
11918
  // server/routes/admin/sidebar-artefacts.ts
11878
11919
  import neo4j3 from "neo4j-driver";
@@ -11882,8 +11923,8 @@ import { existsSync as existsSync19 } from "fs";
11882
11923
  var LIMIT = 50;
11883
11924
  var TEXT_MIME_PREFIXES = ["text/", "application/json", "application/markdown"];
11884
11925
  var ADMIN_AGENT_FILES = ["IDENTITY.md", "SOUL.md", "KNOWLEDGE.md"];
11885
- var app31 = new Hono();
11886
- app31.get("/", requireAdminSession, async (c) => {
11926
+ var app32 = new Hono();
11927
+ app32.get("/", requireAdminSession, async (c) => {
11887
11928
  const sessionKey = c.var.sessionKey;
11888
11929
  const accountId = getAccountIdForSession(sessionKey);
11889
11930
  if (!accountId) {
@@ -12089,7 +12130,7 @@ function isWithin(target, root) {
12089
12130
  const rel = relative2(root, target);
12090
12131
  return !rel.startsWith("..") && !isAbsolute(rel);
12091
12132
  }
12092
- var sidebar_artefacts_default = app31;
12133
+ var sidebar_artefacts_default = app32;
12093
12134
 
12094
12135
  // server/routes/admin/sidebar-artefact-save.ts
12095
12136
  import { mkdir as mkdir3, readdir as readdir4, stat as stat5, writeFile as writeFile4 } from "fs/promises";
@@ -12097,8 +12138,8 @@ import { resolve as resolve17 } from "path";
12097
12138
  import { existsSync as existsSync20 } from "fs";
12098
12139
  var ADMIN_AGENT_FILES2 = /* @__PURE__ */ new Set(["IDENTITY.md", "SOUL.md", "KNOWLEDGE.md"]);
12099
12140
  var UUID_RE5 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
12100
- var app32 = new Hono();
12101
- app32.post("/", requireAdminSession, async (c) => {
12141
+ var app33 = new Hono();
12142
+ app33.post("/", requireAdminSession, async (c) => {
12102
12143
  const sessionKey = c.var.sessionKey;
12103
12144
  const accountId = getAccountIdForSession(sessionKey);
12104
12145
  if (!accountId) return c.json({ error: "Account not found for session" }, 401);
@@ -12178,15 +12219,15 @@ async function resolveSavePath(id, accountId, accountDir) {
12178
12219
  function relPath(absPath, root) {
12179
12220
  return absPath.startsWith(root) ? absPath.slice(root.length + 1) : absPath;
12180
12221
  }
12181
- var sidebar_artefact_save_default = app32;
12222
+ var sidebar_artefact_save_default = app33;
12182
12223
 
12183
12224
  // server/routes/admin/sidebar-artefact-content.ts
12184
12225
  import { readFile as readFile5, readdir as readdir5 } from "fs/promises";
12185
12226
  import { existsSync as existsSync21 } from "fs";
12186
12227
  import { resolve as resolve18 } from "path";
12187
12228
  var UUID_RE6 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
12188
- var app33 = new Hono();
12189
- app33.get("/", requireAdminSession, async (c) => {
12229
+ var app34 = new Hono();
12230
+ app34.get("/", requireAdminSession, async (c) => {
12190
12231
  const sessionKey = c.var.sessionKey;
12191
12232
  const accountId = getAccountIdForSession(sessionKey);
12192
12233
  if (!accountId) return new Response("Unauthorized", { status: 401 });
@@ -12227,7 +12268,7 @@ app33.get("/", requireAdminSession, async (c) => {
12227
12268
  }
12228
12269
  });
12229
12270
  });
12230
- var sidebar_artefact_content_default = app33;
12271
+ var sidebar_artefact_content_default = app34;
12231
12272
 
12232
12273
  // server/routes/admin/health.ts
12233
12274
  import { existsSync as existsSync22, readFileSync as readFileSync16 } from "fs";
@@ -12272,8 +12313,8 @@ async function probeConversationDb() {
12272
12313
  });
12273
12314
  }
12274
12315
  }
12275
- var app34 = new Hono();
12276
- app34.get("/", async (c) => {
12316
+ var app35 = new Hono();
12317
+ app35.get("/", async (c) => {
12277
12318
  const version = readVersion();
12278
12319
  const probe = await probeConversationDb();
12279
12320
  const uptimeMs = Date.now() - new Date(PROCESS_STARTED_AT).getTime();
@@ -12295,36 +12336,37 @@ app34.get("/", async (c) => {
12295
12336
  uptimeMs
12296
12337
  });
12297
12338
  });
12298
- var health_default2 = app34;
12339
+ var health_default2 = app35;
12299
12340
 
12300
12341
  // server/routes/admin/index.ts
12301
- var app35 = new Hono();
12302
- app35.route("/session", session_default2);
12303
- app35.route("/chat", chat_default2);
12304
- app35.route("/compact", compact_default);
12305
- app35.route("/logs", logs_default);
12306
- app35.route("/claude-info", claude_info_default);
12307
- app35.route("/attachment", attachment_default);
12308
- app35.route("/agents", agents_default);
12309
- app35.route("/sessions", sessions_default);
12310
- app35.route("/browser", browser_default);
12311
- app35.route("/device-browser", device_browser_default);
12312
- app35.route("/events", events_default);
12313
- app35.route("/cloudflare", cloudflare_default);
12314
- app35.route("/files", files_default);
12315
- app35.route("/graph-search", graph_search_default);
12316
- app35.route("/graph-subgraph", graph_subgraph_default);
12317
- app35.route("/graph-delete", graph_delete_default);
12318
- app35.route("/graph-restore", graph_restore_default);
12319
- app35.route("/graph-labels-in-graph", graph_labels_in_graph_default);
12320
- app35.route("/graph-default-view", graph_default_view_default);
12321
- app35.route("/file-attach", file_attach_default);
12322
- app35.route("/adherence", adherence_default);
12323
- app35.route("/sidebar-artefacts", sidebar_artefacts_default);
12324
- app35.route("/sidebar-artefact-save", sidebar_artefact_save_default);
12325
- app35.route("/sidebar-artefact-content", sidebar_artefact_content_default);
12326
- app35.route("/health-brand", health_default2);
12327
- var admin_default = app35;
12342
+ var app36 = new Hono();
12343
+ app36.route("/session", session_default2);
12344
+ app36.route("/chat", chat_default2);
12345
+ app36.route("/compact", compact_default);
12346
+ app36.route("/logs", logs_default);
12347
+ app36.route("/claude-info", claude_info_default);
12348
+ app36.route("/attachment", attachment_default);
12349
+ app36.route("/agents", agents_default);
12350
+ app36.route("/sessions", sessions_default);
12351
+ app36.route("/browser", browser_default);
12352
+ app36.route("/browser-iframe", browser_iframe_default);
12353
+ app36.route("/device-browser", device_browser_default);
12354
+ app36.route("/events", events_default);
12355
+ app36.route("/cloudflare", cloudflare_default);
12356
+ app36.route("/files", files_default);
12357
+ app36.route("/graph-search", graph_search_default);
12358
+ app36.route("/graph-subgraph", graph_subgraph_default);
12359
+ app36.route("/graph-delete", graph_delete_default);
12360
+ app36.route("/graph-restore", graph_restore_default);
12361
+ app36.route("/graph-labels-in-graph", graph_labels_in_graph_default);
12362
+ app36.route("/graph-default-view", graph_default_view_default);
12363
+ app36.route("/file-attach", file_attach_default);
12364
+ app36.route("/adherence", adherence_default);
12365
+ app36.route("/sidebar-artefacts", sidebar_artefacts_default);
12366
+ app36.route("/sidebar-artefact-save", sidebar_artefact_save_default);
12367
+ app36.route("/sidebar-artefact-content", sidebar_artefact_content_default);
12368
+ app36.route("/health-brand", health_default2);
12369
+ var admin_default = app36;
12328
12370
 
12329
12371
  // server/routes/sites.ts
12330
12372
  import { existsSync as existsSync23, readFileSync as readFileSync17, realpathSync as realpathSync4, statSync as statSync7 } from "fs";
@@ -12359,8 +12401,8 @@ function getExt(p) {
12359
12401
  if (idx < p.lastIndexOf("/")) return "";
12360
12402
  return p.slice(idx).toLowerCase();
12361
12403
  }
12362
- var app36 = new Hono();
12363
- app36.get("/:rel{.*}", (c) => {
12404
+ var app37 = new Hono();
12405
+ app37.get("/:rel{.*}", (c) => {
12364
12406
  const reqPath = c.req.path;
12365
12407
  const rawRel = c.req.param("rel") ?? "";
12366
12408
  const trimmed = rawRel.replace(/^\/+/, "").replace(/\/+$/, "");
@@ -12463,7 +12505,7 @@ app36.get("/:rel{.*}", (c) => {
12463
12505
  "X-Content-Type-Options": "nosniff"
12464
12506
  });
12465
12507
  });
12466
- var sites_default = app36;
12508
+ var sites_default = app37;
12467
12509
 
12468
12510
  // app/lib/graph-health.ts
12469
12511
  var HOUR_MS = 60 * 60 * 1e3;
@@ -12617,9 +12659,9 @@ watchFile(ALIAS_DOMAINS_PATH2, { interval: 2e3 }, () => {
12617
12659
  function isPublicHost(host) {
12618
12660
  return host.startsWith("public.") || aliasDomains.has(host);
12619
12661
  }
12620
- var app37 = new Hono();
12621
- app37.use("*", clientIpMiddleware);
12622
- app37.use("*", async (c, next) => {
12662
+ var app38 = new Hono();
12663
+ app38.use("*", clientIpMiddleware);
12664
+ app38.use("*", async (c, next) => {
12623
12665
  await next();
12624
12666
  c.header("X-Content-Type-Options", "nosniff");
12625
12667
  c.header("Referrer-Policy", "strict-origin-when-cross-origin");
@@ -12628,6 +12670,25 @@ app37.use("*", async (c, next) => {
12628
12670
  c.req.path === "/vnc-viewer.html" ? "SAMEORIGIN" : "DENY"
12629
12671
  );
12630
12672
  });
12673
+ var HTTP_LOG_PATHS = /* @__PURE__ */ new Set(["/vnc-viewer.html", "/vnc-popout.html"]);
12674
+ app38.use("*", async (c, next) => {
12675
+ if (!HTTP_LOG_PATHS.has(c.req.path)) {
12676
+ await next();
12677
+ return;
12678
+ }
12679
+ const start = Date.now();
12680
+ try {
12681
+ await next();
12682
+ } finally {
12683
+ httpLog({
12684
+ method: c.req.method,
12685
+ path: c.req.path,
12686
+ status: c.res?.status ?? 0,
12687
+ ms: Date.now() - start,
12688
+ brand: BRAND.productName
12689
+ });
12690
+ }
12691
+ });
12631
12692
  var PUBLIC_ALLOWED_PREFIXES = [
12632
12693
  "/api/session",
12633
12694
  "/api/chat",
@@ -12643,7 +12704,7 @@ var PUBLIC_ALLOWED_PREFIXES = [
12643
12704
  "/sites/"
12644
12705
  ];
12645
12706
  var PUBLIC_ALLOWED_EXACT = ["/favicon.ico"];
12646
- app37.use("*", async (c, next) => {
12707
+ app38.use("*", async (c, next) => {
12647
12708
  const host = (c.req.header("host") ?? "").split(":")[0];
12648
12709
  if (!isPublicHost(host)) {
12649
12710
  await next();
@@ -12683,7 +12744,7 @@ function resolveRemoteAuthOpts() {
12683
12744
  return brandLoginOpts;
12684
12745
  }
12685
12746
  var MAX_LOGIN_BODY = 8 * 1024;
12686
- app37.post("/__remote-auth/login", async (c) => {
12747
+ app38.post("/__remote-auth/login", async (c) => {
12687
12748
  const client = clientFrom(c);
12688
12749
  const clientIp = client.ip || "unknown";
12689
12750
  if (!requestIsTlsTerminated(c)) {
@@ -12727,7 +12788,7 @@ app37.post("/__remote-auth/login", async (c) => {
12727
12788
  }
12728
12789
  });
12729
12790
  });
12730
- app37.get("/__remote-auth/logout", (c) => {
12791
+ app38.get("/__remote-auth/logout", (c) => {
12731
12792
  return new Response(null, {
12732
12793
  status: 302,
12733
12794
  headers: {
@@ -12737,7 +12798,7 @@ app37.get("/__remote-auth/logout", (c) => {
12737
12798
  }
12738
12799
  });
12739
12800
  });
12740
- app37.post("/__remote-auth/change-password", async (c) => {
12801
+ app38.post("/__remote-auth/change-password", async (c) => {
12741
12802
  const client = clientFrom(c);
12742
12803
  const clientIp = client.ip || "unknown";
12743
12804
  const rateLimited = checkRateLimit(client);
@@ -12787,13 +12848,13 @@ app37.post("/__remote-auth/change-password", async (c) => {
12787
12848
  return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(), mode: "change", changeError: "Failed to save password", redirect }), 200);
12788
12849
  }
12789
12850
  });
12790
- app37.get("/__remote-auth/setup", (c) => {
12851
+ app38.get("/__remote-auth/setup", (c) => {
12791
12852
  if (isRemoteAuthConfigured()) {
12792
12853
  return c.redirect("/");
12793
12854
  }
12794
12855
  return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(), mode: "setup" }), 200);
12795
12856
  });
12796
- app37.post("/__remote-auth/set-initial-password", async (c) => {
12857
+ app38.post("/__remote-auth/set-initial-password", async (c) => {
12797
12858
  if (isRemoteAuthConfigured()) {
12798
12859
  return c.redirect("/");
12799
12860
  }
@@ -12829,10 +12890,10 @@ app37.post("/__remote-auth/set-initial-password", async (c) => {
12829
12890
  return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(), mode: "setup", setupError: "Failed to save password. Please try again." }), 200);
12830
12891
  }
12831
12892
  });
12832
- app37.get("/api/remote-auth/status", (c) => {
12893
+ app38.get("/api/remote-auth/status", (c) => {
12833
12894
  return c.json({ configured: isRemoteAuthConfigured() });
12834
12895
  });
12835
- app37.post("/api/remote-auth/set-password", async (c) => {
12896
+ app38.post("/api/remote-auth/set-password", async (c) => {
12836
12897
  let body;
12837
12898
  try {
12838
12899
  body = await c.req.json();
@@ -12862,9 +12923,9 @@ app37.post("/api/remote-auth/set-password", async (c) => {
12862
12923
  return c.json({ error: "Failed to save password" }, 500);
12863
12924
  }
12864
12925
  });
12865
- app37.route("/api/_client-error", client_error_default);
12926
+ app38.route("/api/_client-error", client_error_default);
12866
12927
  console.log("[client-error-route] mounted");
12867
- app37.use("*", async (c, next) => {
12928
+ app38.use("*", async (c, next) => {
12868
12929
  const host = (c.req.header("host") ?? "").split(":")[0];
12869
12930
  const path2 = c.req.path;
12870
12931
  if (path2 === "/favicon.ico" || path2.startsWith("/assets/") || path2.startsWith("/brand/")) {
@@ -12890,6 +12951,13 @@ app37.use("*", async (c, next) => {
12890
12951
  return;
12891
12952
  }
12892
12953
  const disambig = `remoteAddress="${rawRemote ?? ""}" xff="${rawXff ?? ""}" resolvedKind=${decision.client.kind}`;
12954
+ if (path2 === "/api/admin/browser-iframe/event") {
12955
+ browserViewerLog("auth-rejected", {
12956
+ ip: clientIp,
12957
+ reason: decision.reason,
12958
+ brand: BRAND.productName
12959
+ });
12960
+ }
12893
12961
  if (decision.reason === "remote-unconfigured") {
12894
12962
  console.error(`[remote-auth] not configured, redirecting to setup ip=${clientIp} path=${path2} ${disambig}`);
12895
12963
  return c.redirect("/__remote-auth/setup");
@@ -12897,15 +12965,15 @@ app37.use("*", async (c, next) => {
12897
12965
  console.error(`[remote-auth] login required ip=${clientIp} path=${path2} ${disambig}`);
12898
12966
  return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(), redirect: path2 }), 200);
12899
12967
  });
12900
- app37.route("/api/health", health_default);
12901
- app37.route("/api/session", session_default);
12902
- app37.route("/api/chat", chat_default);
12903
- app37.route("/api/group", group_default);
12904
- app37.route("/api/access", access_default);
12905
- app37.route("/api/telegram", telegram_default);
12906
- app37.route("/api/whatsapp", whatsapp_default);
12907
- app37.route("/api/onboarding", onboarding_default);
12908
- app37.route("/api/admin", admin_default);
12968
+ app38.route("/api/health", health_default);
12969
+ app38.route("/api/session", session_default);
12970
+ app38.route("/api/chat", chat_default);
12971
+ app38.route("/api/group", group_default);
12972
+ app38.route("/api/access", access_default);
12973
+ app38.route("/api/telegram", telegram_default);
12974
+ app38.route("/api/whatsapp", whatsapp_default);
12975
+ app38.route("/api/onboarding", onboarding_default);
12976
+ app38.route("/api/admin", admin_default);
12909
12977
  var SAFE_SLUG_RE = /^[a-z][a-z0-9-]{2,49}$/;
12910
12978
  var SAFE_FILENAME_RE = /^[a-z0-9_][a-z0-9_.-]{0,99}$/i;
12911
12979
  var IMAGE_MIME = {
@@ -12917,7 +12985,7 @@ var IMAGE_MIME = {
12917
12985
  ".svg": "image/svg+xml",
12918
12986
  ".ico": "image/x-icon"
12919
12987
  };
12920
- app37.get("/agent-assets/:slug/:filename", (c) => {
12988
+ app38.get("/agent-assets/:slug/:filename", (c) => {
12921
12989
  const slug = c.req.param("slug");
12922
12990
  const filename = c.req.param("filename");
12923
12991
  if (!SAFE_SLUG_RE.test(slug)) {
@@ -12952,7 +13020,7 @@ app37.get("/agent-assets/:slug/:filename", (c) => {
12952
13020
  "Cache-Control": "public, max-age=3600"
12953
13021
  });
12954
13022
  });
12955
- app37.get("/generated/:filename", (c) => {
13023
+ app38.get("/generated/:filename", (c) => {
12956
13024
  const filename = c.req.param("filename");
12957
13025
  if (!SAFE_FILENAME_RE.test(filename) || filename.includes("..")) {
12958
13026
  console.error(`[generated] serve file=${filename} status=403`);
@@ -12982,7 +13050,7 @@ app37.get("/generated/:filename", (c) => {
12982
13050
  "Cache-Control": "public, max-age=86400"
12983
13051
  });
12984
13052
  });
12985
- app37.route("/sites", sites_default);
13053
+ app38.route("/sites", sites_default);
12986
13054
  var htmlCache = /* @__PURE__ */ new Map();
12987
13055
  var brandLogoPath = "/brand/maxy-monochrome.png";
12988
13056
  var brandIconPath = "/brand/maxy-monochrome.png";
@@ -13119,7 +13187,7 @@ function brandedPublicHtml(agentSlug) {
13119
13187
  function escapeHtml(s) {
13120
13188
  return s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
13121
13189
  }
13122
- app37.get("/", (c) => {
13190
+ app38.get("/", (c) => {
13123
13191
  const host = (c.req.header("host") ?? "").split(":")[0];
13124
13192
  if (isPublicHost(host)) {
13125
13193
  const defaultSlug = resolveDefaultSlug();
@@ -13127,12 +13195,12 @@ app37.get("/", (c) => {
13127
13195
  }
13128
13196
  return c.html(cachedHtml("index.html"));
13129
13197
  });
13130
- app37.get("/public", (c) => {
13198
+ app38.get("/public", (c) => {
13131
13199
  const host = (c.req.header("host") ?? "").split(":")[0];
13132
13200
  if (isPublicHost(host)) return c.text("Not found", 404);
13133
13201
  return c.html(cachedHtml("public.html"));
13134
13202
  });
13135
- app37.get("/chat", (c) => {
13203
+ app38.get("/chat", (c) => {
13136
13204
  const host = (c.req.header("host") ?? "").split(":")[0];
13137
13205
  if (isPublicHost(host)) return c.text("Not found", 404);
13138
13206
  return c.html(cachedHtml("public.html"));
@@ -13151,9 +13219,9 @@ async function logViewerFetch(c, next) {
13151
13219
  duration_ms: Date.now() - start
13152
13220
  });
13153
13221
  }
13154
- app37.use("/vnc-viewer.html", logViewerFetch);
13155
- app37.use("/vnc-popout.html", logViewerFetch);
13156
- app37.get("/vnc-popout.html", (c) => {
13222
+ app38.use("/vnc-viewer.html", logViewerFetch);
13223
+ app38.use("/vnc-popout.html", logViewerFetch);
13224
+ app38.get("/vnc-popout.html", (c) => {
13157
13225
  let html = htmlCache.get("vnc-popout.html");
13158
13226
  if (!html) {
13159
13227
  html = readFileSync18(resolve21(process.cwd(), "public", "vnc-popout.html"), "utf-8");
@@ -13166,7 +13234,7 @@ app37.get("/vnc-popout.html", (c) => {
13166
13234
  }
13167
13235
  return c.html(html);
13168
13236
  });
13169
- app37.post("/api/vnc/client-event", async (c) => {
13237
+ app38.post("/api/vnc/client-event", async (c) => {
13170
13238
  let body;
13171
13239
  try {
13172
13240
  body = await c.req.json();
@@ -13187,20 +13255,20 @@ app37.post("/api/vnc/client-event", async (c) => {
13187
13255
  });
13188
13256
  return c.json({ ok: true });
13189
13257
  });
13190
- app37.get("/g/:slug", (c) => {
13258
+ app38.get("/g/:slug", (c) => {
13191
13259
  return c.html(brandedPublicHtml());
13192
13260
  });
13193
- app37.get("/graph", (c) => {
13261
+ app38.get("/graph", (c) => {
13194
13262
  const host = (c.req.header("host") ?? "").split(":")[0];
13195
13263
  if (isPublicHost(host)) return c.text("Not found", 404);
13196
13264
  return c.html(cachedHtml("graph.html"));
13197
13265
  });
13198
- app37.get("/data", (c) => {
13266
+ app38.get("/data", (c) => {
13199
13267
  const host = (c.req.header("host") ?? "").split(":")[0];
13200
13268
  if (isPublicHost(host)) return c.text("Not found", 404);
13201
13269
  return c.html(cachedHtml("data.html"));
13202
13270
  });
13203
- app37.get("/:slug", async (c, next) => {
13271
+ app38.get("/:slug", async (c, next) => {
13204
13272
  const slug = c.req.param("slug");
13205
13273
  if (AGENT_SLUG_PATTERN.test(`/${slug}`)) {
13206
13274
  const branding = loadBrandingCache(slug);
@@ -13210,15 +13278,15 @@ app37.get("/:slug", async (c, next) => {
13210
13278
  await next();
13211
13279
  });
13212
13280
  if (brandFaviconPath !== "/favicon.ico") {
13213
- app37.get("/favicon.ico", (c) => {
13281
+ app38.get("/favicon.ico", (c) => {
13214
13282
  c.header("Cache-Control", "public, max-age=300");
13215
13283
  return c.redirect(brandFaviconPath, 302);
13216
13284
  });
13217
13285
  }
13218
- app37.use("/*", serveStatic({ root: "./public" }));
13286
+ app38.use("/*", serveStatic({ root: "./public" }));
13219
13287
  var port = parseInt(process.env.MAXY_UI_INTERNAL_PORT ?? process.env.PORT ?? "19199", 10);
13220
13288
  var hostname = process.env.HOSTNAME ?? "127.0.0.1";
13221
- var httpServer = serve({ fetch: app37.fetch, port, hostname });
13289
+ var httpServer = serve({ fetch: app38.fetch, port, hostname });
13222
13290
  console.log(`${BRAND.productName} listening on http://${hostname}:${port}`);
13223
13291
  console.log("[boot] auth-mode summary: oauth=8 api-key=1 (api-key consumer: invokePublicAgent only)");
13224
13292
  var SUBAPP_MANIFEST = [
@@ -13239,7 +13307,7 @@ for (const m of SUBAPP_MANIFEST) {
13239
13307
  }
13240
13308
  try {
13241
13309
  const registered = [];
13242
- for (const r of app37.routes ?? []) {
13310
+ for (const r of app38.routes ?? []) {
13243
13311
  if (typeof r.path !== "string" || r.path.includes(":") || r.path.includes("*")) continue;
13244
13312
  if (AGENT_SLUG_PATTERN.test(r.path)) {
13245
13313
  registered.push({ method: (r.method ?? "ALL").toUpperCase(), path: r.path });