@rubytech/create-realagent 1.0.812 → 1.0.813

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.
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Real Agent</title>
7
7
  <link rel="icon" href="/favicon.ico">
8
- <script type="module" crossorigin src="/assets/admin-w4mS-Tne.js"></script>
8
+ <script type="module" crossorigin src="/assets/admin-D_1VXUmN.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-DD-I1_y5.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-DOYWvSKw.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-qlgyTAkD.js">
@@ -45,6 +45,7 @@ import {
45
45
  sleep,
46
46
  streamLogPathFor,
47
47
  stripAttachmentMetaSuffix,
48
+ tryCookieBridgeForConversation,
48
49
  validateKey,
49
50
  validatePasswordStrength,
50
51
  verifyPassword,
@@ -52,7 +53,7 @@ import {
52
53
  vncLog,
53
54
  waitForExit,
54
55
  writeChromiumWrapper
55
- } from "./chunk-6UFBDVWR.js";
56
+ } from "./chunk-KKC4IV6I.js";
56
57
  import {
57
58
  agentLogStream,
58
59
  clearSessionHistory,
@@ -80,7 +81,7 @@ import {
80
81
  sigtermFlushStreamLogs,
81
82
  unregisterSession,
82
83
  validateSession
83
- } from "./chunk-D2JKNYRK.js";
84
+ } from "./chunk-WK6KSHPD.js";
84
85
  import {
85
86
  ACCOUNTS_DIR,
86
87
  GREETING_DIRECTIVE,
@@ -120,7 +121,7 @@ import {
120
121
  verifyAndGetConversationUpdatedAt,
121
122
  verifyConversationOwnership,
122
123
  writeAdminUserAndPerson
123
- } from "./chunk-FMNXMQIL.js";
124
+ } from "./chunk-TQTMKIW6.js";
124
125
 
125
126
  // ../lib/graph-trash/dist/index.js
126
127
  var require_dist = __commonJS({
@@ -8707,7 +8708,7 @@ var app11 = new Hono();
8707
8708
  app11.post("/cancel", requireAdminSession, async (c) => {
8708
8709
  const session_key = c.var.sessionKey;
8709
8710
  try {
8710
- const { interruptClient: interruptClient2 } = await import("./client-pool-VW3EE2YD.js");
8711
+ const { interruptClient: interruptClient2 } = await import("./client-pool-KUFFECZC.js");
8711
8712
  await interruptClient2(session_key);
8712
8713
  return c.json({ ok: true });
8713
8714
  } catch (err) {
@@ -9643,9 +9644,38 @@ app17.delete("/:id", requireAdminSession, async (c) => {
9643
9644
  return c.json({ error: "Failed to delete session" }, 500);
9644
9645
  }
9645
9646
  });
9646
- app17.get("/:id/messages", requireAdminSession, async (c) => {
9647
+ app17.get("/:id/messages", async (c) => {
9647
9648
  const conversationId = c.req.param("id");
9648
- const sessionKey = c.var.sessionKey;
9649
+ const sessionKey = c.req.query("session_key") ?? "";
9650
+ if (!sessionKey) {
9651
+ console.error(`[session] middleware-reject status=400 code=session-missing reason="session_key required" path=${c.req.path}`);
9652
+ return c.json({ error: "session_key required", code: "session-missing" }, 400);
9653
+ }
9654
+ let result = validateSession(sessionKey, "admin");
9655
+ if (!result.ok) {
9656
+ if (result.reason === "session-not-registered") {
9657
+ const bridge = await tryCookieBridgeForConversation(c, sessionKey, conversationId);
9658
+ if (!bridge.ok) {
9659
+ if (bridge.reason === "conversation-not-found") {
9660
+ return c.json({ error: "Conversation not found" }, 404);
9661
+ }
9662
+ const tail = sessionKey.slice(0, 8);
9663
+ console.error(`[session] middleware-reject status=401 code=session-not-registered reason="cookie-bridge-rejected:${bridge.reason}" path=${c.req.path} sessionKey=${tail}\u2026`);
9664
+ return c.json({ error: "Invalid or expired admin session", code: "session-not-registered" }, 401);
9665
+ }
9666
+ result = validateSession(sessionKey, "admin");
9667
+ if (!result.ok) {
9668
+ const tail = sessionKey.slice(0, 8);
9669
+ console.error(`[session] middleware-reject status=401 code=session-not-registered reason="post-bridge re-validate failed" path=${c.req.path} sessionKey=${tail}\u2026`);
9670
+ return c.json({ error: "Invalid or expired admin session", code: "session-not-registered" }, 401);
9671
+ }
9672
+ } else {
9673
+ const tail = sessionKey.slice(0, 8);
9674
+ const wireCode = result.reason === "agent-type-mismatch" ? "session-not-registered" : result.reason;
9675
+ console.error(`[session] middleware-reject status=401 code=${wireCode} reason="invalid or expired admin session" path=${c.req.path} sessionKey=${tail}\u2026`);
9676
+ return c.json({ error: "Invalid or expired admin session", code: wireCode }, 401);
9677
+ }
9678
+ }
9649
9679
  const accountId = getAccountIdForSession(sessionKey);
9650
9680
  if (!accountId) return c.json({ error: "Account not found for session" }, 401);
9651
9681
  const owned = await verifyConversationOwnership(conversationId, accountId);