@btraut/browser-bridge 0.6.1 → 0.7.1

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/dist/index.js CHANGED
@@ -75,7 +75,6 @@ var successEnvelopeSchema = (result) => import_zod.z.object({
75
75
  ok: import_zod.z.literal(true),
76
76
  result
77
77
  });
78
- var apiEnvelopeSchema = (result) => import_zod.z.union([successEnvelopeSchema(result), ErrorEnvelopeSchema]);
79
78
 
80
79
  // packages/shared/src/schemas.ts
81
80
  var import_zod2 = require("zod");
@@ -1483,9 +1482,11 @@ var createCoreClient2 = (options = {}) => {
1483
1482
  var toToolResult = (payload) => {
1484
1483
  const content = [{ type: "text", text: JSON.stringify(payload) }];
1485
1484
  if (payload && typeof payload === "object") {
1485
+ const isErrorEnvelope = ErrorEnvelopeSchema.safeParse(payload).success;
1486
1486
  return {
1487
1487
  content,
1488
- structuredContent: payload
1488
+ structuredContent: payload,
1489
+ isError: isErrorEnvelope
1489
1490
  };
1490
1491
  }
1491
1492
  return { content };
@@ -1498,7 +1499,7 @@ var toInternalErrorEnvelope = (error) => ({
1498
1499
  retryable: false
1499
1500
  }
1500
1501
  });
1501
- var envelope = (schema) => apiEnvelopeSchema(schema);
1502
+ var envelope = (schema) => successEnvelopeSchema(schema);
1502
1503
  var TOOL_DEFINITIONS = [
1503
1504
  {
1504
1505
  name: "session.create",
@@ -2473,6 +2474,9 @@ var PAGE_STATE_SCRIPT = [
2473
2474
  "})()"
2474
2475
  ].join("\n");
2475
2476
 
2477
+ // packages/core/src/diagnostics.ts
2478
+ var STALE_ERROR_THRESHOLD_MS = 2 * 60 * 1e3;
2479
+
2476
2480
  // packages/core/src/routes/diagnostics.ts
2477
2481
  var PROCESS_STARTED_AT = new Date(
2478
2482
  Date.now() - Math.floor(process.uptime() * 1e3)