@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.
@@ -0,0 +1,34 @@
1
+ import {
2
+ _evictAllForTest,
3
+ _poolSnapshotForTest,
4
+ acquireClient,
5
+ acquireOneShotClient,
6
+ evictClient,
7
+ getActiveClient,
8
+ interruptClient,
9
+ pushUserMessage,
10
+ pushUserToolResult,
11
+ recordCachedTokens,
12
+ recordCrash,
13
+ setInflight,
14
+ startIdleEvictTick,
15
+ stopIdleEvictTick
16
+ } from "./chunk-22LK7D5R.js";
17
+ import "./chunk-7ADUQXTU.js";
18
+ import "./chunk-JSBRDJBE.js";
19
+ export {
20
+ _evictAllForTest,
21
+ _poolSnapshotForTest,
22
+ acquireClient,
23
+ acquireOneShotClient,
24
+ evictClient,
25
+ getActiveClient,
26
+ interruptClient,
27
+ pushUserMessage,
28
+ pushUserToolResult,
29
+ recordCachedTokens,
30
+ recordCrash,
31
+ setInflight,
32
+ startIdleEvictTick,
33
+ stopIdleEvictTick
34
+ };
@@ -14,12 +14,13 @@ import {
14
14
  requireAdminCookie,
15
15
  sanitizeClientCorrId,
16
16
  streamActionEvents,
17
- vncLog
18
- } from "./chunk-CNNPNADU.js";
17
+ vncLog,
18
+ websockifyLog
19
+ } from "./chunk-2Q2S52GB.js";
19
20
  import {
20
21
  LOG_DIR,
21
22
  WEBSOCKIFY_PORT
22
- } from "./chunk-FL3H3AQD.js";
23
+ } from "./chunk-22LK7D5R.js";
23
24
  import "./chunk-7ADUQXTU.js";
24
25
  import "./chunk-JSBRDJBE.js";
25
26
 
@@ -47,12 +48,14 @@ var HOP_BY_HOP = /* @__PURE__ */ new Set([
47
48
  function attachVncWsProxy(server2, opts) {
48
49
  const upstreamHost = opts.upstreamHost ?? "127.0.0.1";
49
50
  const upstreamPort = opts.upstreamPort ?? WEBSOCKIFY_PORT;
51
+ const brand = opts.brand ?? "unknown";
50
52
  server2.on("upgrade", (req, clientSocket, head) => {
51
53
  try {
52
54
  handleUpgrade(req, clientSocket, head, {
53
55
  isPublicHost: opts.isPublicHost,
54
56
  upstreamHost,
55
- upstreamPort
57
+ upstreamPort,
58
+ brand
56
59
  });
57
60
  } catch (err) {
58
61
  vncLog("ws-upgrade", {
@@ -158,6 +161,8 @@ function handleUpgrade(req, clientSocket, head, opts) {
158
161
  sec_ws_version: headerString(req.headers["sec-websocket-version"]) ?? null,
159
162
  sec_ws_protocol: headerString(req.headers["sec-websocket-protocol"]) ?? null
160
163
  });
164
+ websockifyLog("upgrade", { brand: opts.brand, remote: remote ?? "unknown", sid: corrId });
165
+ const upgradeStart = Date.now();
161
166
  const upstream = createConnection({ host: opts.upstreamHost, port: opts.upstreamPort });
162
167
  upstream.setTimeout(UPSTREAM_TIMEOUT_MS);
163
168
  let bytesClientToUpstream = 0;
@@ -175,6 +180,13 @@ function handleUpgrade(req, clientSocket, head, opts) {
175
180
  clientBytes: bytesClientToUpstream,
176
181
  upstreamBytes: bytesUpstreamToClient
177
182
  });
183
+ websockifyLog("close", {
184
+ brand: opts.brand,
185
+ code: reason === "error" ? 1006 : 1e3,
186
+ reason,
187
+ durationMs: Date.now() - upgradeStart,
188
+ sid: corrId
189
+ });
178
190
  }
179
191
  clientSocket.destroy();
180
192
  upstream.destroy();
@@ -236,6 +248,13 @@ function handleUpgrade(req, clientSocket, head, opts) {
236
248
  err: "timeout",
237
249
  timeout_ms: UPSTREAM_TIMEOUT_MS
238
250
  });
251
+ websockifyLog("close", {
252
+ brand: opts.brand,
253
+ code: 1006,
254
+ reason: "upstream-connect-timeout",
255
+ durationMs: Date.now() - upgradeStart,
256
+ sid: corrId
257
+ });
239
258
  writeStatusAndDestroy(clientSocket, 504, "Gateway Timeout");
240
259
  upstream.destroy();
241
260
  });
@@ -246,6 +265,14 @@ function handleUpgrade(req, clientSocket, head, opts) {
246
265
  side: "upstream-connect",
247
266
  err: err.message
248
267
  });
268
+ websockifyLog("close", {
269
+ brand: opts.brand,
270
+ code: 1006,
271
+ reason: "upstream-connect-error",
272
+ durationMs: Date.now() - upgradeStart,
273
+ sid: corrId,
274
+ err: err.message
275
+ });
249
276
  writeStatusAndDestroy(clientSocket, 502, "Bad Gateway");
250
277
  upstream.destroy();
251
278
  });
@@ -954,7 +981,8 @@ server.headersTimeout = server.keepAliveTimeout + 1e3;
954
981
  attachVncWsProxy(server, {
955
982
  isPublicHost,
956
983
  upstreamHost: WEBSOCKIFY_HOST,
957
- upstreamPort: WEBSOCKIFY_PORT2
984
+ upstreamPort: WEBSOCKIFY_PORT2,
985
+ brand: BRAND.productName
958
986
  });
959
987
  server.on("upgrade", (req, socket, head) => {
960
988
  const url = req.url ?? "";