@replohq/sandbox-runtime 1.7.12 → 1.7.13

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.
@@ -80,4 +80,5 @@ export declare function isNetworkErrorMessage(message: string): boolean;
80
80
  * fallback string or `String(error)`.
81
81
  */
82
82
  export declare function getErrorMessage(error: unknown, fallback?: string): string;
83
+ export declare function appendErrorId(detail: string, errorId: string | null | undefined): string;
83
84
  export {};
@@ -50,6 +50,13 @@ export declare const componentPreviewComponentSchema: z.ZodObject<{
50
50
  path: z.ZodString;
51
51
  name: z.ZodString;
52
52
  }, z.core.$strip>;
53
+ export declare const componentPreviewUsageSchema: z.ZodObject<{
54
+ kind: z.ZodEnum<{
55
+ page: "page";
56
+ layout: "layout";
57
+ }>;
58
+ route: z.ZodString;
59
+ }, z.core.$strip>;
53
60
  export declare const componentPreviewIndexSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
54
61
  status: z.ZodLiteral<"unavailable">;
55
62
  }, z.core.$strip>, z.ZodObject<{
@@ -58,6 +65,13 @@ export declare const componentPreviewIndexSchema: z.ZodDiscriminatedUnion<[z.Zod
58
65
  path: z.ZodString;
59
66
  name: z.ZodString;
60
67
  }, z.core.$strip>>;
68
+ usagesByComponentPath: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
69
+ kind: z.ZodEnum<{
70
+ page: "page";
71
+ layout: "layout";
72
+ }>;
73
+ route: z.ZodString;
74
+ }, z.core.$strip>>>;
61
75
  }, z.core.$strip>], "status">;
62
76
  export declare const componentPreviewSourceFileSchema: z.ZodObject<{
63
77
  path: z.ZodString;
@@ -79,4 +93,6 @@ export declare const componentPreviewPreparationSchema: z.ZodDiscriminatedUnion<
79
93
  pathname: z.ZodString;
80
94
  }, z.core.$strip>, z.ZodObject<{
81
95
  status: z.ZodLiteral<"siteUpdateRequired">;
96
+ }, z.core.$strip>, z.ZodObject<{
97
+ status: z.ZodLiteral<"invalidComponent">;
82
98
  }, z.core.$strip>], "status">;
@@ -86,11 +86,19 @@ var componentPreviewComponentSchema = z.object({
86
86
  path: componentPreviewPathSchema,
87
87
  name: z.string().min(1).max(120)
88
88
  }).describe("ComponentPreviewComponent");
89
+ var componentPreviewUsageSchema = z.object({
90
+ kind: z.enum(["page", "layout"]),
91
+ route: z.string().min(1)
92
+ }).describe("ComponentPreviewUsage");
89
93
  var componentPreviewIndexSchema = z.discriminatedUnion("status", [
90
94
  z.object({ status: z.literal("unavailable") }),
91
95
  z.object({
92
96
  status: z.literal("ready"),
93
- components: z.array(componentPreviewComponentSchema)
97
+ components: z.array(componentPreviewComponentSchema),
98
+ usagesByComponentPath: z.record(
99
+ componentPreviewPathSchema,
100
+ z.array(componentPreviewUsageSchema)
101
+ )
94
102
  })
95
103
  ]).describe("ComponentPreviewIndex");
96
104
  var componentPreviewSourceFileSchema = z.object({
@@ -107,7 +115,8 @@ var componentPreviewPreparationSchema = z.discriminatedUnion("status", [
107
115
  status: z.literal("ready"),
108
116
  pathname: z.string().regex(/^\/[A-Za-z0-9/_-]+$/u)
109
117
  }),
110
- z.object({ status: z.literal("siteUpdateRequired") })
118
+ z.object({ status: z.literal("siteUpdateRequired") }),
119
+ z.object({ status: z.literal("invalidComponent") })
111
120
  ]).describe("ComponentPreviewPreparation");
112
121
 
113
- export { COMPONENT_PREVIEW_IFRAME_RPC_CHANNEL_ID, COMPONENT_PREVIEW_IFRAME_RPC_CHANNEL_VERSION, COMPONENT_PREVIEW_PARENT_ORIGIN_PARAM, MAX_COMPONENT_PREVIEW_PROPS_BYTES, componentPreviewComponentSchema, componentPreviewIndexSchema, componentPreviewPathSchema, componentPreviewPreparationSchema, componentPreviewProductReferenceSchema, componentPreviewPropNameSchema, componentPreviewPropsSchema, componentPreviewSelectionSchema, componentPreviewSourceFileSchema, componentPreviewSourceSchema, componentPreviewToWebsiteBuilderMethodConfig, websiteBuilderToComponentPreviewMethodConfig };
122
+ export { COMPONENT_PREVIEW_IFRAME_RPC_CHANNEL_ID, COMPONENT_PREVIEW_IFRAME_RPC_CHANNEL_VERSION, COMPONENT_PREVIEW_PARENT_ORIGIN_PARAM, MAX_COMPONENT_PREVIEW_PROPS_BYTES, componentPreviewComponentSchema, componentPreviewIndexSchema, componentPreviewPathSchema, componentPreviewPreparationSchema, componentPreviewProductReferenceSchema, componentPreviewPropNameSchema, componentPreviewPropsSchema, componentPreviewSelectionSchema, componentPreviewSourceFileSchema, componentPreviewSourceSchema, componentPreviewToWebsiteBuilderMethodConfig, componentPreviewUsageSchema, websiteBuilderToComponentPreviewMethodConfig };
@@ -436,6 +436,12 @@ export declare class IframeRpcChannelTimeoutError extends IframeRpcChannelError
436
436
  timeoutMs: number;
437
437
  });
438
438
  }
439
+ export declare class IframeRpcChannelTargetUnavailableError extends IframeRpcChannelError {
440
+ constructor({ callType, method, }: {
441
+ callType: "notify" | "request" | "response";
442
+ method?: string;
443
+ });
444
+ }
439
445
  export declare class IframeRpcChannelRemoteError extends IframeRpcChannelError {
440
446
  constructor({ method, message }: {
441
447
  method: string;
@@ -12,6 +12,13 @@ export type ComponentPreviewIndex = {
12
12
  } | {
13
13
  status: "ready";
14
14
  components: ComponentPreviewComponent[];
15
+ usagesByComponentPath: {
16
+ [x: string]: ComponentPreviewUsage[];
17
+ };
18
+ };
19
+ export type ComponentPreviewUsage = {
20
+ kind: "page" | "layout";
21
+ route: string;
15
22
  };
16
23
  export type ComponentPreviewSourceFile = {
17
24
  path: string;
@@ -27,4 +34,6 @@ export type ComponentPreviewPreparation = {
27
34
  pathname: string;
28
35
  } | {
29
36
  status: "siteUpdateRequired";
37
+ } | {
38
+ status: "invalidComponent";
30
39
  };
@@ -116,6 +116,17 @@ var IframeRpcChannelTimeoutError = class extends IframeRpcChannelError {
116
116
  });
117
117
  }
118
118
  };
119
+ var IframeRpcChannelTargetUnavailableError = class extends IframeRpcChannelError {
120
+ constructor({
121
+ callType,
122
+ method
123
+ }) {
124
+ super({
125
+ message: method ? `RPC target window was unavailable for '${method}'` : "RPC target window was unavailable for a response",
126
+ additionalData: { callType, method }
127
+ });
128
+ }
129
+ };
119
130
  var IframeRpcChannelRemoteError = class extends IframeRpcChannelError {
120
131
  constructor({ method, message }) {
121
132
  super({
@@ -247,8 +258,8 @@ function createIframeRpcChannel(options) {
247
258
  const pendingRequests = /* @__PURE__ */ new Map();
248
259
  let subscriberCount = 0;
249
260
  let handlerMeta;
250
- const postMessage = (call2) => {
251
- getTargetWindow()?.postMessage(
261
+ const postMessage = (call2, targetWindow = getTargetWindow()) => {
262
+ targetWindow?.postMessage(
252
263
  {
253
264
  channelIdentifier,
254
265
  version,
@@ -368,9 +379,6 @@ function createIframeRpcChannel(options) {
368
379
  pendingRequest.resolve(parsedOutput.data);
369
380
  };
370
381
  const handleMessage = (event) => {
371
- if (!isExpectedMessage(event)) {
372
- return;
373
- }
374
382
  const parsedMetadata = z.object({
375
383
  channelIdentifier: z.literal(channelIdentifier),
376
384
  version: z.literal(version)
@@ -378,6 +386,15 @@ function createIframeRpcChannel(options) {
378
386
  if (!parsedMetadata.success) {
379
387
  return;
380
388
  }
389
+ if (!isExpectedMessage(event)) {
390
+ defaultLogger.error("[iframeRpcChannel] Dropping unexpected message", {
391
+ channelIdentifier,
392
+ version,
393
+ origin: event.origin,
394
+ hasSource: Boolean(event.source)
395
+ });
396
+ return;
397
+ }
381
398
  const parsedCall = iframeRpcCallSchema.safeParse(event.data);
382
399
  if (!parsedCall.success) {
383
400
  return;
@@ -464,6 +481,15 @@ function createIframeRpcChannel(options) {
464
481
  new IframeRpcChannelUnsubscribedError({ method })
465
482
  );
466
483
  }
484
+ const targetWindow = getTargetWindow();
485
+ if (!targetWindow) {
486
+ return Promise.reject(
487
+ new IframeRpcChannelTargetUnavailableError({
488
+ callType: "request",
489
+ method
490
+ })
491
+ );
492
+ }
467
493
  const id = randomUUID();
468
494
  const timeoutMs = definition.timeoutMs ?? 3e4;
469
495
  return new Promise(
@@ -480,12 +506,21 @@ function createIframeRpcChannel(options) {
480
506
  reject,
481
507
  timeoutId
482
508
  });
483
- postMessage({
484
- type: "request",
485
- id,
486
- method,
487
- data: parsedInput.data
488
- });
509
+ try {
510
+ postMessage(
511
+ {
512
+ type: "request",
513
+ id,
514
+ method,
515
+ data: parsedInput.data
516
+ },
517
+ targetWindow
518
+ );
519
+ } catch (error) {
520
+ clearTimeout(timeoutId);
521
+ pendingRequests.delete(id);
522
+ reject(error);
523
+ }
489
524
  }
490
525
  );
491
526
  };
@@ -26,7 +26,141 @@ export declare const iframeRuntimeBuildMetadataSchema: z.ZodObject<{
26
26
  commit: z.ZodNullable<z.ZodString>;
27
27
  builtAt: z.ZodNullable<z.ZodString>;
28
28
  }, z.core.$strip>;
29
- export declare const websiteBuilderToCanopyMethodConfig: {
29
+ export declare const selectModeEventInputSchemas: {
30
+ hover: z.ZodObject<{
31
+ rect: z.ZodNullable<z.ZodObject<{
32
+ x: z.ZodNumber;
33
+ y: z.ZodNumber;
34
+ left: z.ZodNumber;
35
+ top: z.ZodNumber;
36
+ right: z.ZodNumber;
37
+ bottom: z.ZodNumber;
38
+ width: z.ZodNumber;
39
+ height: z.ZodNumber;
40
+ }, z.core.$strip>>;
41
+ }, z.core.$strip>;
42
+ areaSelection: z.ZodObject<{
43
+ rect: z.ZodObject<{
44
+ x: z.ZodNumber;
45
+ y: z.ZodNumber;
46
+ left: z.ZodNumber;
47
+ top: z.ZodNumber;
48
+ right: z.ZodNumber;
49
+ bottom: z.ZodNumber;
50
+ width: z.ZodNumber;
51
+ height: z.ZodNumber;
52
+ }, z.core.$strip>;
53
+ items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
54
+ kind: z.ZodLiteral<"react-element">;
55
+ selector: z.ZodString;
56
+ tagName: z.ZodString;
57
+ elementType: z.ZodString;
58
+ textContent: z.ZodNullable<z.ZodString>;
59
+ rect: z.ZodObject<{
60
+ x: z.ZodNumber;
61
+ y: z.ZodNumber;
62
+ left: z.ZodNumber;
63
+ top: z.ZodNumber;
64
+ right: z.ZodNumber;
65
+ bottom: z.ZodNumber;
66
+ width: z.ZodNumber;
67
+ height: z.ZodNumber;
68
+ }, z.core.$strip>;
69
+ textMetrics: z.ZodNullable<z.ZodObject<{
70
+ tightWidth: z.ZodNumber;
71
+ lineCount: z.ZodNumber;
72
+ lineHeight: z.ZodNumber;
73
+ }, z.core.$strip>>;
74
+ outerHTML: z.ZodString;
75
+ definedStyles: z.ZodDefault<z.ZodArray<z.ZodObject<{
76
+ property: z.ZodString;
77
+ variant: z.ZodNullable<z.ZodObject<{
78
+ atRules: z.ZodArray<z.ZodObject<{
79
+ type: z.ZodString;
80
+ text: z.ZodString;
81
+ }, z.core.$strip>>;
82
+ pseudo: z.ZodNullable<z.ZodString>;
83
+ }, z.core.$strip>>;
84
+ className: z.ZodNullable<z.ZodString>;
85
+ raw: z.ZodString;
86
+ resolved: z.ZodString;
87
+ }, z.core.$strip>>>;
88
+ inheritedStyles: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
89
+ clickPosition: z.ZodObject<{
90
+ x: z.ZodNumber;
91
+ y: z.ZodNumber;
92
+ }, z.core.$strip>;
93
+ sourceLocation: z.ZodOptional<z.ZodObject<{
94
+ filePath: z.ZodString;
95
+ lineNumber: z.ZodNumber;
96
+ columnNumber: z.ZodOptional<z.ZodNumber>;
97
+ componentName: z.ZodOptional<z.ZodString>;
98
+ }, z.core.$strip>>;
99
+ fiberChain: z.ZodDefault<z.ZodArray<z.ZodObject<{
100
+ sourceLocation: z.ZodObject<{
101
+ filePath: z.ZodString;
102
+ lineNumber: z.ZodNumber;
103
+ columnNumber: z.ZodOptional<z.ZodNumber>;
104
+ componentName: z.ZodOptional<z.ZodString>;
105
+ }, z.core.$strip>;
106
+ tagName: z.ZodOptional<z.ZodString>;
107
+ componentName: z.ZodOptional<z.ZodString>;
108
+ props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
109
+ }, z.core.$strip>>>;
110
+ siblingSelectors: z.ZodDefault<z.ZodArray<z.ZodString>>;
111
+ }, z.core.$strip>, z.ZodObject<{
112
+ kind: z.ZodLiteral<"plan">;
113
+ planId: z.ZodString;
114
+ label: z.ZodString;
115
+ rect: z.ZodObject<{
116
+ x: z.ZodNumber;
117
+ y: z.ZodNumber;
118
+ left: z.ZodNumber;
119
+ top: z.ZodNumber;
120
+ right: z.ZodNumber;
121
+ bottom: z.ZodNumber;
122
+ width: z.ZodNumber;
123
+ height: z.ZodNumber;
124
+ }, z.core.$strip>;
125
+ }, z.core.$strip>], "kind">>;
126
+ }, z.core.$strip>;
127
+ dragRect: z.ZodObject<{
128
+ dragRect: z.ZodNullable<z.ZodObject<{
129
+ x: z.ZodNumber;
130
+ y: z.ZodNumber;
131
+ left: z.ZodNumber;
132
+ top: z.ZodNumber;
133
+ right: z.ZodNumber;
134
+ bottom: z.ZodNumber;
135
+ width: z.ZodNumber;
136
+ height: z.ZodNumber;
137
+ }, z.core.$strip>>;
138
+ selectionRects: z.ZodArray<z.ZodObject<{
139
+ id: z.ZodString;
140
+ rect: z.ZodObject<{
141
+ x: z.ZodNumber;
142
+ y: z.ZodNumber;
143
+ left: z.ZodNumber;
144
+ top: z.ZodNumber;
145
+ right: z.ZodNumber;
146
+ bottom: z.ZodNumber;
147
+ width: z.ZodNumber;
148
+ height: z.ZodNumber;
149
+ }, z.core.$strip>;
150
+ }, z.core.$strip>>;
151
+ }, z.core.$strip>;
152
+ inlineEditState: z.ZodObject<{
153
+ activeMarks: z.ZodObject<{
154
+ bold: z.ZodBoolean;
155
+ italic: z.ZodBoolean;
156
+ underline: z.ZodBoolean;
157
+ strike: z.ZodBoolean;
158
+ }, z.core.$strip>;
159
+ isInlineEditing: z.ZodBoolean;
160
+ isInlineEditPending: z.ZodBoolean;
161
+ }, z.core.$strip>;
162
+ };
163
+ export declare const websiteBuilderToPreviewIframeMethodConfig: {
30
164
  symbolicateSelectedElement: {
31
165
  inputSchema: z.ZodObject<{
32
166
  kind: z.ZodLiteral<"react-element">;
@@ -245,7 +379,7 @@ export declare const websiteBuilderToCanopyMethodConfig: {
245
379
  outputSchema: z.ZodVoid;
246
380
  };
247
381
  };
248
- export declare const canopyToWebsiteBuilderMethodConfig: {
382
+ export declare const previewIframeToWebsiteBuilderMethodConfig: {
249
383
  requestInlineTextEdit: {
250
384
  inputSchema: z.ZodObject<{
251
385
  editId: z.ZodString;
@@ -1,4 +1,4 @@
1
- import { selectModeBoundingRectSchema, selectModeFormatCommandSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionTypeSchema, displayModeSchema, selectModeTiptapActiveMarksSchema, selectableDataSchema, selectModeSelectionRectSchema, selectModeClickPositionSchema, selectedElementSchema } from '../../chunk-4T7WSMC3.mjs';
1
+ import { selectModeBoundingRectSchema, selectModeTiptapActiveMarksSchema, selectModeSelectionRectSchema, selectableDataSchema, selectModeFormatCommandSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionTypeSchema, displayModeSchema, selectModeClickPositionSchema, selectedElementSchema } from '../../chunk-4T7WSMC3.mjs';
2
2
  import '../../chunk-JUKCUPQ6.mjs';
3
3
  import '../../chunk-FLYEIRFK.mjs';
4
4
  import '../../chunk-TESFJQID.mjs';
@@ -18,7 +18,25 @@ var iframeRuntimeBuildMetadataSchema = z.object({
18
18
  commit: z.string().nullable(),
19
19
  builtAt: z.string().nullable()
20
20
  }).describe("IframeRuntimeBuildMetadata");
21
- var websiteBuilderToCanopyMethodConfig = {
21
+ var selectModeEventInputSchemas = {
22
+ hover: z.object({
23
+ rect: selectModeBoundingRectSchema.nullable()
24
+ }),
25
+ areaSelection: z.object({
26
+ rect: selectModeBoundingRectSchema,
27
+ items: z.array(selectableDataSchema)
28
+ }),
29
+ dragRect: z.object({
30
+ dragRect: selectModeBoundingRectSchema.nullable(),
31
+ selectionRects: z.array(selectModeSelectionRectSchema)
32
+ }),
33
+ inlineEditState: z.object({
34
+ activeMarks: selectModeTiptapActiveMarksSchema,
35
+ isInlineEditing: z.boolean(),
36
+ isInlineEditPending: z.boolean()
37
+ })
38
+ };
39
+ var websiteBuilderToPreviewIframeMethodConfig = {
22
40
  symbolicateSelectedElement: {
23
41
  inputSchema: selectedElementSchema,
24
42
  outputSchema: selectedElementSchema,
@@ -83,7 +101,7 @@ var websiteBuilderToCanopyMethodConfig = {
83
101
  outputSchema: z.void()
84
102
  }
85
103
  };
86
- var canopyToWebsiteBuilderMethodConfig = {
104
+ var previewIframeToWebsiteBuilderMethodConfig = {
87
105
  requestInlineTextEdit: {
88
106
  inputSchema: z.object({
89
107
  editId: z.string(),
@@ -103,9 +121,7 @@ var canopyToWebsiteBuilderMethodConfig = {
103
121
  outputSchema: z.void()
104
122
  },
105
123
  hoverElement: {
106
- inputSchema: z.object({
107
- rect: selectModeBoundingRectSchema.nullable()
108
- }),
124
+ inputSchema: selectModeEventInputSchemas.hover,
109
125
  outputSchema: z.void()
110
126
  },
111
127
  selectedElementRectUpdate: {
@@ -122,17 +138,11 @@ var canopyToWebsiteBuilderMethodConfig = {
122
138
  outputSchema: z.void()
123
139
  },
124
140
  dragRectUpdated: {
125
- inputSchema: z.object({
126
- dragRect: selectModeBoundingRectSchema.nullable(),
127
- selectionRects: z.array(selectModeSelectionRectSchema)
128
- }),
141
+ inputSchema: selectModeEventInputSchemas.dragRect,
129
142
  outputSchema: z.void()
130
143
  },
131
144
  areaSelected: {
132
- inputSchema: z.object({
133
- rect: selectModeBoundingRectSchema,
134
- items: z.array(selectableDataSchema)
135
- }),
145
+ inputSchema: selectModeEventInputSchemas.areaSelection,
136
146
  outputSchema: z.void()
137
147
  },
138
148
  textCommitted: {
@@ -149,11 +159,7 @@ var canopyToWebsiteBuilderMethodConfig = {
149
159
  outputSchema: z.void()
150
160
  },
151
161
  editorStateUpdate: {
152
- inputSchema: z.object({
153
- activeMarks: selectModeTiptapActiveMarksSchema,
154
- isInlineEditing: z.boolean(),
155
- isInlineEditPending: z.boolean()
156
- }),
162
+ inputSchema: selectModeEventInputSchemas.inlineEditState,
157
163
  outputSchema: z.void()
158
164
  },
159
165
  fastRefreshComplete: {
@@ -164,27 +170,27 @@ var canopyToWebsiteBuilderMethodConfig = {
164
170
  var selectModeParentMessageSchema = z.discriminatedUnion("method", [
165
171
  z.object({
166
172
  method: z.literal("setDisplayMode"),
167
- data: websiteBuilderToCanopyMethodConfig.setDisplayMode.inputSchema
173
+ data: websiteBuilderToPreviewIframeMethodConfig.setDisplayMode.inputSchema
168
174
  }),
169
175
  z.object({
170
176
  method: z.literal("setSelectionType"),
171
- data: websiteBuilderToCanopyMethodConfig.setSelectionType.inputSchema
177
+ data: websiteBuilderToPreviewIframeMethodConfig.setSelectionType.inputSchema
172
178
  }),
173
179
  z.object({
174
180
  method: z.literal("applyOptimisticUpdate"),
175
- data: websiteBuilderToCanopyMethodConfig.applyOptimisticUpdate.inputSchema
181
+ data: websiteBuilderToPreviewIframeMethodConfig.applyOptimisticUpdate.inputSchema
176
182
  }),
177
183
  z.object({
178
184
  method: z.literal("markCommitted"),
179
- data: websiteBuilderToCanopyMethodConfig.markCommitted.inputSchema
185
+ data: websiteBuilderToPreviewIframeMethodConfig.markCommitted.inputSchema
180
186
  }),
181
187
  z.object({
182
188
  method: z.literal("resolveSessionOverrides"),
183
- data: websiteBuilderToCanopyMethodConfig.resolveSessionOverrides.inputSchema
189
+ data: websiteBuilderToPreviewIframeMethodConfig.resolveSessionOverrides.inputSchema
184
190
  }),
185
191
  z.object({
186
192
  method: z.literal("revertOverride"),
187
- data: websiteBuilderToCanopyMethodConfig.revertOverride.inputSchema
193
+ data: websiteBuilderToPreviewIframeMethodConfig.revertOverride.inputSchema
188
194
  }),
189
195
  z.object({
190
196
  method: z.literal("enterEditMode")
@@ -194,7 +200,7 @@ var selectModeParentMessageSchema = z.discriminatedUnion("method", [
194
200
  }),
195
201
  z.object({
196
202
  method: z.literal("formatCommand"),
197
- data: websiteBuilderToCanopyMethodConfig.formatCommand.inputSchema
203
+ data: websiteBuilderToPreviewIframeMethodConfig.formatCommand.inputSchema
198
204
  })
199
205
  ]).describe("SelectModeParentMessage");
200
206
  var selectModeIframeMessageSchema = z.discriminatedUnion("method", [
@@ -204,43 +210,43 @@ var selectModeIframeMessageSchema = z.discriminatedUnion("method", [
204
210
  }),
205
211
  z.object({
206
212
  method: z.literal("elementSelected"),
207
- data: canopyToWebsiteBuilderMethodConfig.elementSelected.inputSchema
213
+ data: previewIframeToWebsiteBuilderMethodConfig.elementSelected.inputSchema
208
214
  }),
209
215
  z.object({
210
216
  method: z.literal("hoverElement"),
211
- data: canopyToWebsiteBuilderMethodConfig.hoverElement.inputSchema
217
+ data: previewIframeToWebsiteBuilderMethodConfig.hoverElement.inputSchema
212
218
  }),
213
219
  z.object({
214
220
  method: z.literal("selectedElementRectUpdate"),
215
- data: canopyToWebsiteBuilderMethodConfig.selectedElementRectUpdate.inputSchema
221
+ data: previewIframeToWebsiteBuilderMethodConfig.selectedElementRectUpdate.inputSchema
216
222
  }),
217
223
  z.object({
218
224
  method: z.literal("selectedAreaRectUpdate"),
219
- data: canopyToWebsiteBuilderMethodConfig.selectedAreaRectUpdate.inputSchema
225
+ data: previewIframeToWebsiteBuilderMethodConfig.selectedAreaRectUpdate.inputSchema
220
226
  }),
221
227
  z.object({
222
228
  method: z.literal("dragRectUpdated"),
223
- data: canopyToWebsiteBuilderMethodConfig.dragRectUpdated.inputSchema
229
+ data: previewIframeToWebsiteBuilderMethodConfig.dragRectUpdated.inputSchema
224
230
  }),
225
231
  z.object({
226
232
  method: z.literal("areaSelected"),
227
- data: canopyToWebsiteBuilderMethodConfig.areaSelected.inputSchema
233
+ data: previewIframeToWebsiteBuilderMethodConfig.areaSelected.inputSchema
228
234
  }),
229
235
  z.object({
230
236
  method: z.literal("textCommitted"),
231
- data: canopyToWebsiteBuilderMethodConfig.textCommitted.inputSchema
237
+ data: previewIframeToWebsiteBuilderMethodConfig.textCommitted.inputSchema
232
238
  }),
233
239
  z.object({
234
240
  method: z.literal("inlineEditFeedbackChanged"),
235
- data: canopyToWebsiteBuilderMethodConfig.inlineEditFeedbackChanged.inputSchema
241
+ data: previewIframeToWebsiteBuilderMethodConfig.inlineEditFeedbackChanged.inputSchema
236
242
  }),
237
243
  z.object({
238
244
  method: z.literal("editorStateUpdate"),
239
- data: canopyToWebsiteBuilderMethodConfig.editorStateUpdate.inputSchema
245
+ data: previewIframeToWebsiteBuilderMethodConfig.editorStateUpdate.inputSchema
240
246
  }),
241
247
  z.object({
242
248
  method: z.literal("fastRefreshComplete")
243
249
  })
244
250
  ]).describe("SelectModeIframeMessage");
245
251
 
246
- export { SELECT_MODE_IFRAME_RPC_CHANNEL_ID, SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION, canopyToWebsiteBuilderMethodConfig, iframeRuntimeBuildMetadataSchema, inlineEditFeedbackSchema, selectModeIframeMessageSchema, selectModeParentMessageSchema, websiteBuilderToCanopyMethodConfig };
252
+ export { SELECT_MODE_IFRAME_RPC_CHANNEL_ID, SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION, iframeRuntimeBuildMetadataSchema, inlineEditFeedbackSchema, previewIframeToWebsiteBuilderMethodConfig, selectModeEventInputSchemas, selectModeIframeMessageSchema, selectModeParentMessageSchema, websiteBuilderToPreviewIframeMethodConfig };
package/buildMetadata.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export const BUILD_METADATA = {
2
2
  "packageName": "@replohq/sandbox-runtime",
3
- "version": "1.7.12",
3
+ "version": "1.7.13",
4
4
  "branch": "HEAD",
5
- "commit": "25c44bae8033d312c213c7d6d6cd3bba14a38cfd",
6
- "builtAt": "2026-09-22T04:29:15.711Z"
5
+ "commit": "48e7e55752c4448369b7a49ce608c6539acb3a24",
6
+ "builtAt": "2026-09-23T03:50:04.538Z"
7
7
  };
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@replohq/sandbox-runtime",
3
- "version": "1.7.12",
3
+ "version": "1.7.13",
4
4
  "reploBuild": {
5
5
  "packageName": "@replohq/sandbox-runtime",
6
- "version": "1.7.12",
6
+ "version": "1.7.13",
7
7
  "branch": "HEAD",
8
- "commit": "25c44bae8033d312c213c7d6d6cd3bba14a38cfd",
9
- "builtAt": "2026-09-22T04:29:15.711Z"
8
+ "commit": "48e7e55752c4448369b7a49ce608c6539acb3a24",
9
+ "builtAt": "2026-09-23T03:50:04.538Z"
10
10
  },
11
11
  "description": "Replo sandbox runtime — editor integration for agent-built Next.js sites.",
12
12
  "license": "SEE LICENSE IN LICENSE",
@@ -286,7 +286,6 @@ function useOptimisticOverrides() {
286
286
  removeOverride({ editId, outcome: "failed" });
287
287
  }, OVERRIDE_REGISTRATION_TIMEOUT_MS),
288
288
  sessionId: null,
289
- state: "live",
290
289
  targets: elements.map((element) => ({
291
290
  element,
292
291
  originalState: getOriginalState({ element, payload }),
@@ -317,7 +316,6 @@ function useOptimisticOverrides() {
317
316
  }
318
317
  clearTimeout(override.registrationTimeout);
319
318
  override.sessionId = sessionId;
320
- override.state = "fired";
321
319
  const outcome = getSessionOutcomes().get(sessionId);
322
320
  if (outcome) {
323
321
  removeOverride({ editId, outcome });
@@ -1,8 +1,8 @@
1
1
  import type { SelectedElement } from "../_vendor/schemas/generated/selectMode";
2
2
  import type { IframeRpcChannelInputHandlers, IframeRpcChannelRemote } from "../_vendor/schemas/iframeRpcChannel";
3
- import { canopyToWebsiteBuilderMethodConfig, websiteBuilderToCanopyMethodConfig } from "../_vendor/schemas/selectModeIframeRpc";
4
- export type WebsiteBuilderRpcRemote = IframeRpcChannelRemote<typeof canopyToWebsiteBuilderMethodConfig>;
5
- type SelectModeParentMessagingHandlers = Omit<IframeRpcChannelInputHandlers<typeof websiteBuilderToCanopyMethodConfig>, "symbolicateSelectedElement" | "navigateToRoute">;
3
+ import { previewIframeToWebsiteBuilderMethodConfig, websiteBuilderToPreviewIframeMethodConfig } from "../_vendor/schemas/selectModeIframeRpc";
4
+ export type WebsiteBuilderRpcRemote = IframeRpcChannelRemote<typeof previewIframeToWebsiteBuilderMethodConfig>;
5
+ type SelectModeParentMessagingHandlers = Omit<IframeRpcChannelInputHandlers<typeof websiteBuilderToPreviewIframeMethodConfig>, "symbolicateSelectedElement" | "navigateToRoute">;
6
6
  export declare function setNavigateToRouteHandler(handler: ((input: {
7
7
  pathname: string;
8
8
  }) => void) | null): void;
@@ -3,10 +3,10 @@ import {
3
3
  createIframeRpcRemote
4
4
  } from "../_vendor/schemas/iframeRpcChannel.mjs";
5
5
  import {
6
- canopyToWebsiteBuilderMethodConfig,
6
+ previewIframeToWebsiteBuilderMethodConfig,
7
7
  SELECT_MODE_IFRAME_RPC_CHANNEL_ID,
8
8
  SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION,
9
- websiteBuilderToCanopyMethodConfig
9
+ websiteBuilderToPreviewIframeMethodConfig
10
10
  } from "../_vendor/schemas/selectModeIframeRpc.mjs";
11
11
  import { symbolicateSelectedElement } from "./symbolicate";
12
12
  let messagingHandlers = null;
@@ -22,8 +22,8 @@ function createSelectModeIframeRpcChannel() {
22
22
  getTargetWindow: () => window.parent === window ? null : window.parent,
23
23
  targetOrigin: "*",
24
24
  isExpectedMessage: (event) => event.source === window.parent,
25
- outgoingMethods: canopyToWebsiteBuilderMethodConfig,
26
- incomingMethods: websiteBuilderToCanopyMethodConfig,
25
+ outgoingMethods: previewIframeToWebsiteBuilderMethodConfig,
26
+ incomingMethods: websiteBuilderToPreviewIframeMethodConfig,
27
27
  handlers: {
28
28
  setDisplayMode: (input) => {
29
29
  messagingHandlers?.setDisplayMode(input);
@@ -1,25 +1,20 @@
1
- import type { DisplayMode, SelectableData, SelectModeBoundingRect, SelectModeFormatCommand, SelectModeSelectionType } from "../_vendor/schemas/generated/selectMode";
1
+ import type { DisplayMode, SelectableData, SelectModeBoundingRect, SelectModeFormatCommand, SelectModeSelectionType, SelectModeTiptapActiveMarks } from "../_vendor/schemas/generated/selectMode";
2
2
  import type { InlineEditFeedback } from "../_vendor/schemas/generated/selectModeIframeRpc";
3
3
  import type { DragCandidate } from "./interactions/selectionGeometry";
4
4
  import type { SelectionFrameSpec } from "./selectionFrame";
5
5
  import type { SelectModeInteractionSession } from "./selectModeSession";
6
6
  import type { InlineTiptapEditor } from "./tiptapInlineEditor";
7
- export type ActiveMarks = {
8
- bold: boolean;
9
- italic: boolean;
10
- underline: boolean;
11
- strike: boolean;
12
- };
13
- export declare const EMPTY_ACTIVE_MARKS: ActiveMarks;
14
- type InlineEditRequest = {
7
+ export declare const EMPTY_ACTIVE_MARKS: SelectModeTiptapActiveMarks;
8
+ type InlineEditDraft = {
15
9
  status: "pending";
16
10
  editId: string;
17
11
  element: HTMLElement;
18
12
  timeout: number;
19
- stopFeedback: () => void;
20
13
  } | {
21
14
  status: Exclude<InlineEditFeedback["status"], "pending">;
22
15
  element: HTMLElement;
16
+ };
17
+ type InlineEditRequest = InlineEditDraft & {
23
18
  stopFeedback: () => void;
24
19
  };
25
20
  type LastClick = {
@@ -52,7 +47,7 @@ interface SelectModeStoreState {
52
47
  initialHTML: string | null;
53
48
  isCommitting: boolean;
54
49
  beginEditingAt: number;
55
- activeMarks: ActiveMarks;
50
+ activeMarks: SelectModeTiptapActiveMarks;
56
51
  actions: {
57
52
  reset: () => void;
58
53
  setDisplayMode: (displayMode: DisplayMode) => void;
@@ -12,10 +12,7 @@ import {
12
12
  import { reportInlineEditFeedback } from "./inlineEditFeedback";
13
13
  import { getDocumentScrollOffset } from "./interactions/selectionGeometry";
14
14
  import { isTextEditableElement } from "./isTextEditableElement";
15
- import {
16
- getAreaSelectionFrameSpecs,
17
- getElementSelectionFrameSpecs
18
- } from "./selectionFrame";
15
+ import { getSelectionFrameSpecs } from "./selectionFrame";
19
16
  import { getConnectedSelectedElement, IDLE_SESSION } from "./selectModeSession";
20
17
  import {
21
18
  isUserSourceLocation,
@@ -405,17 +402,19 @@ const selectModeStore = createShallowStore(
405
402
  },
406
403
  showElementSelectionFrames: ({ elements, scrollOffset }) => {
407
404
  set({
408
- selectionFrames: getElementSelectionFrameSpecs({
405
+ selectionFrames: getSelectionFrameSpecs({
409
406
  elements,
410
- scrollOffset
407
+ scrollOffset,
408
+ variant: "element"
411
409
  })
412
410
  });
413
411
  },
414
412
  showAreaSelectionFrames: ({ elements, scrollOffset }) => {
415
413
  set({
416
- selectionFrames: getAreaSelectionFrameSpecs({
414
+ selectionFrames: getSelectionFrameSpecs({
417
415
  elements,
418
- scrollOffset
416
+ scrollOffset,
417
+ variant: "area"
419
418
  })
420
419
  });
421
420
  },
@@ -12,17 +12,11 @@ export type SelectionFrameSpec = {
12
12
  pageRect: SelectionFramePageRect;
13
13
  variant: SelectionFrameVariant;
14
14
  };
15
- export declare function getElementSelectionFrameSpecs({ elements, scrollOffset, }: {
16
- elements: Element[];
17
- scrollOffset: {
18
- left: number;
19
- top: number;
20
- };
21
- }): SelectionFrameSpec[];
22
- export declare function getAreaSelectionFrameSpecs({ elements, scrollOffset, }: {
15
+ export declare function getSelectionFrameSpecs({ elements, scrollOffset, variant, }: {
23
16
  elements: Element[];
24
17
  scrollOffset: {
25
18
  left: number;
26
19
  top: number;
27
20
  };
21
+ variant: SelectionFrameVariant;
28
22
  }): SelectionFrameSpec[];
@@ -1,7 +1,7 @@
1
1
  const SELECTION_FRAMES_CONTAINER_ID = "replo-select-mode-selection-frames";
2
2
  const SELECTION_FRAME_BORDER_HEX = "#c026d3";
3
3
  const SELECTION_FRAME_EDITING_BORDER_HEX = "#e879f9";
4
- function getFrameSpecs({
4
+ function getSelectionFrameSpecs({
5
5
  elements,
6
6
  scrollOffset,
7
7
  variant
@@ -19,22 +19,9 @@ function getFrameSpecs({
19
19
  };
20
20
  });
21
21
  }
22
- function getElementSelectionFrameSpecs({
23
- elements,
24
- scrollOffset
25
- }) {
26
- return getFrameSpecs({ elements, scrollOffset, variant: "element" });
27
- }
28
- function getAreaSelectionFrameSpecs({
29
- elements,
30
- scrollOffset
31
- }) {
32
- return getFrameSpecs({ elements, scrollOffset, variant: "area" });
33
- }
34
22
  export {
35
23
  SELECTION_FRAMES_CONTAINER_ID,
36
24
  SELECTION_FRAME_BORDER_HEX,
37
25
  SELECTION_FRAME_EDITING_BORDER_HEX,
38
- getAreaSelectionFrameSpecs,
39
- getElementSelectionFrameSpecs
26
+ getSelectionFrameSpecs
40
27
  };