@replohq/sandbox-runtime 1.16.1 → 1.16.2

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.
@@ -1,48 +1,8 @@
1
1
  import type { ErrorUserFacingDetails, ErrorUserFacingDetailsWithMessage } from "./generated/errors";
2
+ import type { ReploErrorConfig } from "./reploError";
2
3
  import * as z from "zod";
3
- /**
4
- * Config to use for any standard error we throw in Replo
5
- */
6
- export type ReploErrorConfig = {
7
- /**
8
- * Message of the error, used only internally. If not provided, defaults to
9
- * the error's class name
10
- */
11
- message?: string;
12
- /**
13
- * Any additional data about the error, e.g. ids of content that was trying
14
- * to be accessed, contextual variables, etc. This is included when the error
15
- * is logged to Sentry, etc
16
- */
17
- additionalData?: Record<string, unknown>;
18
- /** Meta details for error reporting */
19
- errorReportingDetails?: {
20
- /**
21
- * If true, tells Sentry that it should group this error differently when
22
- * it happens on different endpoints ("transactions" in Sentry are endpoints)
23
- */
24
- includeTransactionInFingerprint?: boolean;
25
- /**
26
- * If provided, these get added to the Sentry fingerprint for this error. Useful
27
- * for when you want to modify the grouping of an error, especially for reusing
28
- * errors in different places.
29
- */
30
- customFingerprint?: string[];
31
- };
32
- /**
33
- * Original cause of the error (useful for if you need to catch and re-throw errors
34
- * with more context). Will be reported in stacktraces, sentry, etc.
35
- */
36
- cause?: unknown;
37
- };
38
- /**
39
- * Base error that all errors in Replo inherit from
40
- */
41
- export declare abstract class ReploError extends Error {
42
- config: ReploErrorConfig;
43
- id: string;
44
- constructor(config: ReploErrorConfig);
45
- }
4
+ import { ReploError } from "./reploError";
5
+ export { ReploError, type ReploErrorConfig } from "./reploError";
46
6
  /**
47
7
  * Wraps an error so `async-retry` stops immediately instead of scheduling
48
8
  * another attempt: the library rejects with any thrown error carrying a truthy
@@ -10,6 +10,7 @@ var defaultLogger = {
10
10
  debug: console.debug,
11
11
  error: console.error
12
12
  };
13
+
13
14
  var ReploError = class _ReploError extends Error {
14
15
  config;
15
16
  id;
@@ -30,6 +31,7 @@ var ReploError = class _ReploError extends Error {
30
31
  }
31
32
  }
32
33
  };
34
+
33
35
  var errorUserFacingDetailsMessageSchema = z.object({
34
36
  type: z.enum([
35
37
  "toast",
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Config to use for any standard error we throw in Replo
3
+ */
4
+ export type ReploErrorConfig = {
5
+ /**
6
+ * Message of the error, used only internally. If not provided, defaults to
7
+ * the error's class name
8
+ */
9
+ message?: string;
10
+ /**
11
+ * Any additional data about the error, e.g. ids of content that was trying
12
+ * to be accessed, contextual variables, etc. This is included when the error
13
+ * is logged to Sentry, etc
14
+ */
15
+ additionalData?: Record<string, unknown>;
16
+ /** Meta details for error reporting */
17
+ errorReportingDetails?: {
18
+ /**
19
+ * If true, tells Sentry that it should group this error differently when
20
+ * it happens on different endpoints ("transactions" in Sentry are endpoints)
21
+ */
22
+ includeTransactionInFingerprint?: boolean;
23
+ /**
24
+ * If provided, these get added to the Sentry fingerprint for this error. Useful
25
+ * for when you want to modify the grouping of an error, especially for reusing
26
+ * errors in different places.
27
+ */
28
+ customFingerprint?: string[];
29
+ };
30
+ /**
31
+ * Original cause of the error (useful for if you need to catch and re-throw errors
32
+ * with more context). Will be reported in stacktraces, sentry, etc.
33
+ */
34
+ cause?: unknown;
35
+ };
36
+ /**
37
+ * Base error that all errors in Replo inherit from
38
+ */
39
+ export declare abstract class ReploError extends Error {
40
+ config: ReploErrorConfig;
41
+ id: string;
42
+ constructor(config: ReploErrorConfig);
43
+ }
@@ -367,7 +367,6 @@ export declare const websiteBuilderToPreviewIframeMethodConfig: {
367
367
  navigateToRoute: {
368
368
  inputSchema: z.ZodObject<{
369
369
  pathname: z.ZodString;
370
- navigationId: z.ZodOptional<z.ZodNumber>;
371
370
  }, z.core.$strip>;
372
371
  outputSchema: z.ZodVoid;
373
372
  };
@@ -918,12 +917,6 @@ export declare const previewIframeToWebsiteBuilderMethodConfig: {
918
917
  inputSchema: z.ZodUndefined;
919
918
  outputSchema: z.ZodVoid;
920
919
  };
921
- navigationAccepted: {
922
- inputSchema: z.ZodObject<{
923
- navigationId: z.ZodNumber;
924
- }, z.core.$strip>;
925
- outputSchema: z.ZodVoid;
926
- };
927
920
  };
928
921
  export declare const selectModeParentMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
929
922
  method: z.ZodLiteral<"expandToSection">;
@@ -51,10 +51,7 @@ var websiteBuilderToPreviewIframeMethodConfig = {
51
51
  timeoutMs: 1500
52
52
  },
53
53
  navigateToRoute: {
54
- inputSchema: z.object({
55
- pathname: z.string(),
56
- navigationId: z.number().int().optional()
57
- }),
54
+ inputSchema: z.object({ pathname: z.string() }),
58
55
  outputSchema: z.void()
59
56
  },
60
57
  setDisplayMode: {
@@ -176,10 +173,6 @@ var previewIframeToWebsiteBuilderMethodConfig = {
176
173
  fastRefreshComplete: {
177
174
  inputSchema: z.undefined(),
178
175
  outputSchema: z.void()
179
- },
180
- navigationAccepted: {
181
- inputSchema: z.object({ navigationId: z.number().int() }),
182
- outputSchema: z.void()
183
176
  }
184
177
  };
185
178
  var selectModeParentMessageSchema = z.discriminatedUnion("method", [
package/buildMetadata.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export const BUILD_METADATA = {
2
2
  "packageName": "@replohq/sandbox-runtime",
3
- "version": "1.16.1",
3
+ "version": "1.16.2",
4
4
  "branch": "HEAD",
5
- "commit": "829bdb2d651053b102e8afdb7bc0ed13022a1833",
6
- "builtAt": "2026-10-19T22:00:45.884Z"
5
+ "commit": "9158b1e6452ebc5e1945da883b1c8406c7b17f08",
6
+ "builtAt": "2026-10-19T23:23:08.010Z"
7
7
  };
@@ -109,6 +109,29 @@ function startViewportSnapshotResponder({
109
109
  };
110
110
  requester.postMessage(response, requesterOrigin);
111
111
  };
112
+ const requestType = event.data.type;
113
+ const respondWithChildFrames = (snapshot2, context2) => {
114
+ if (captureDom ? snapshot2 === null : !context2) {
115
+ respond(null);
116
+ return;
117
+ }
118
+ void requestChildViewportSnapshots({
119
+ targetWindow,
120
+ requestId: `${requestId}:${frameIndex}`,
121
+ timeoutMs: cascadeTimeoutMs,
122
+ remainingDepth: remainingDepth - 1,
123
+ requestType
124
+ }).then((childCaptures) => {
125
+ respond({
126
+ snapshot: snapshot2,
127
+ ...context2 ? { context: context2 } : {},
128
+ childFrames: childCaptures.flatMap((child) => {
129
+ const rect = measureFrameRect(child.frameIndex);
130
+ return rect ? [{ frameIndex: child.frameIndex, rect, capture: child.capture }] : [];
131
+ })
132
+ });
133
+ });
134
+ };
112
135
  let snapshot = null;
113
136
  let context;
114
137
  try {
@@ -119,26 +142,14 @@ function startViewportSnapshotResponder({
119
142
  }
120
143
  } catch {
121
144
  }
122
- if (captureDom ? snapshot === null : !context) {
123
- respond(null);
145
+ if (snapshot instanceof Promise) {
146
+ snapshot.then(
147
+ (resolved) => respondWithChildFrames(resolved, context),
148
+ () => respond(null)
149
+ );
124
150
  return;
125
151
  }
126
- void requestChildViewportSnapshots({
127
- targetWindow,
128
- requestId: `${requestId}:${frameIndex}`,
129
- timeoutMs: cascadeTimeoutMs,
130
- remainingDepth: remainingDepth - 1,
131
- requestType: event.data.type
132
- }).then((childCaptures) => {
133
- respond({
134
- snapshot,
135
- ...context ? { context } : {},
136
- childFrames: childCaptures.flatMap((child) => {
137
- const rect = measureFrameRect(child.frameIndex);
138
- return rect ? [{ frameIndex: child.frameIndex, rect, capture: child.capture }] : [];
139
- })
140
- });
141
- });
152
+ respondWithChildFrames(snapshot, context);
142
153
  };
143
154
  targetWindow.addEventListener("message", onMessage);
144
155
  return () => {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@replohq/sandbox-runtime",
3
- "version": "1.16.1",
3
+ "version": "1.16.2",
4
4
  "reploBuild": {
5
5
  "packageName": "@replohq/sandbox-runtime",
6
- "version": "1.16.1",
6
+ "version": "1.16.2",
7
7
  "branch": "HEAD",
8
- "commit": "829bdb2d651053b102e8afdb7bc0ed13022a1833",
9
- "builtAt": "2026-10-19T22:00:45.884Z"
8
+ "commit": "9158b1e6452ebc5e1945da883b1c8406c7b17f08",
9
+ "builtAt": "2026-10-19T23:23:08.010Z"
10
10
  },
11
11
  "description": "Replo sandbox runtime — editor integration for agent-built Next.js sites.",
12
12
  "license": "SEE LICENSE IN LICENSE",