@replohq/sandbox-runtime 1.16.2 → 1.18.0

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.
Files changed (56) hide show
  1. package/ClientErrorBoundary.js +26 -0
  2. package/DocumentReadyBeacon.js +5 -1
  3. package/_vendor/replo-utils/lib/historyKeys.d.ts +2 -0
  4. package/_vendor/replo-utils/lib/historyKeys.mjs +18 -0
  5. package/_vendor/schemas/generated/selectModeIframeRpc.d.ts +43 -0
  6. package/_vendor/schemas/iframeRpcChannel.mjs +3 -541
  7. package/_vendor/schemas/previewHealthIframeRpc.d.ts +159 -0
  8. package/_vendor/schemas/previewHealthIframeRpc.mjs +123 -0
  9. package/_vendor/schemas/selectModeIframeRpc.d.ts +149 -3
  10. package/_vendor/schemas/selectModeIframeRpc.mjs +72 -2
  11. package/buildMetadata.js +3 -3
  12. package/chunk-KRA4LUIR.mjs +541 -0
  13. package/nextErrorFeed.d.ts +30 -0
  14. package/nextErrorFeed.js +64 -0
  15. package/package.json +5 -12
  16. package/previewHealth.d.ts +25 -0
  17. package/previewHealth.js +431 -0
  18. package/sandbox-runtime.js +0 -2
  19. package/select-mode/EditorSelection.js +5 -1
  20. package/select-mode/fast-refresh-relay.js +82 -3
  21. package/select-mode/fiber.d.ts +6 -0
  22. package/select-mode/fiber.js +33 -0
  23. package/select-mode/hooks/useParentMessaging.js +10 -3
  24. package/select-mode/hooks/useSelectionHover.js +2 -1
  25. package/select-mode/hooks/useSelectionInteractions.js +10 -0
  26. package/select-mode/iframeRpcChannel.d.ts +46 -2
  27. package/select-mode/iframeRpcChannel.js +7 -0
  28. package/select-mode/section-canvas/SectionCanvas.d.ts +7 -0
  29. package/select-mode/section-canvas/SectionCanvas.js +599 -0
  30. package/select-mode/section-canvas/optimisticSectionMove.d.ts +39 -0
  31. package/select-mode/section-canvas/optimisticSectionMove.js +172 -0
  32. package/select-mode/section-canvas/sectionCanvasControls.d.ts +3 -0
  33. package/select-mode/section-canvas/sectionCanvasControls.js +8 -0
  34. package/select-mode/section-canvas/sectionCanvasStore.d.ts +71 -0
  35. package/select-mode/section-canvas/sectionCanvasStore.js +275 -0
  36. package/select-mode/section-canvas/sectionElements.d.ts +16 -0
  37. package/select-mode/section-canvas/sectionElements.js +94 -0
  38. package/select-mode/section-canvas/sectionGhost.d.ts +5 -0
  39. package/select-mode/section-canvas/sectionGhost.js +23 -0
  40. package/select-mode/symbolicate.d.ts +2 -0
  41. package/select-mode/symbolicate.js +18 -1
  42. package/NextErrorReporter.d.ts +0 -1
  43. package/NextErrorReporter.js +0 -131
  44. package/_vendor/schemas/componentPreview.d.ts +0 -43
  45. package/_vendor/schemas/componentPreview.mjs +0 -79
  46. package/_vendor/schemas/generated/componentPreview.d.ts +0 -5
  47. package/_vendor/schemas/generated/componentPreview.mjs +0 -1
  48. package/_vendor/schemas/loaderKeys.d.ts +0 -69
  49. package/next/component-preview-client.d.ts +0 -8
  50. package/next/component-preview-client.js +0 -227
  51. package/next/component-preview-href.d.ts +0 -5
  52. package/next/component-preview-href.js +0 -13
  53. package/next/component-preview-props.d.ts +0 -8
  54. package/next/component-preview-props.js +0 -35
  55. package/next/component-preview.d.ts +0 -11
  56. package/next/component-preview.js +0 -83
@@ -0,0 +1,159 @@
1
+ import * as z from "zod";
2
+ export declare const PREVIEW_HEALTH_IFRAME_RPC_CHANNEL_ID: "replo:preview-health-iframe-rpc";
3
+ export declare const PREVIEW_HEALTH_IFRAME_RPC_CHANNEL_VERSION: 1;
4
+ export declare const previewErrorDetailSchema: z.ZodObject<{
5
+ message: z.ZodString;
6
+ name: z.ZodNullable<z.ZodString>;
7
+ stack: z.ZodNullable<z.ZodString>;
8
+ componentStack: z.ZodNullable<z.ZodString>;
9
+ digest: z.ZodNullable<z.ZodString>;
10
+ }, z.core.$strip>;
11
+ export declare const previewHealthSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
12
+ status: z.ZodLiteral<"ok">;
13
+ }, z.core.$strip>, z.ZodObject<{
14
+ status: z.ZodLiteral<"error">;
15
+ source: z.ZodEnum<{
16
+ boundary: "boundary";
17
+ root: "root";
18
+ build: "build";
19
+ }>;
20
+ error: z.ZodObject<{
21
+ message: z.ZodString;
22
+ name: z.ZodNullable<z.ZodString>;
23
+ stack: z.ZodNullable<z.ZodString>;
24
+ componentStack: z.ZodNullable<z.ZodString>;
25
+ digest: z.ZodNullable<z.ZodString>;
26
+ }, z.core.$strip>;
27
+ }, z.core.$strip>], "status">;
28
+ declare const previewStatusReportSchema: z.ZodObject<{
29
+ route: z.ZodString;
30
+ documentId: z.ZodString;
31
+ seq: z.ZodNumber;
32
+ health: z.ZodDiscriminatedUnion<[z.ZodObject<{
33
+ status: z.ZodLiteral<"ok">;
34
+ }, z.core.$strip>, z.ZodObject<{
35
+ status: z.ZodLiteral<"error">;
36
+ source: z.ZodEnum<{
37
+ boundary: "boundary";
38
+ root: "root";
39
+ build: "build";
40
+ }>;
41
+ error: z.ZodObject<{
42
+ message: z.ZodString;
43
+ name: z.ZodNullable<z.ZodString>;
44
+ stack: z.ZodNullable<z.ZodString>;
45
+ componentStack: z.ZodNullable<z.ZodString>;
46
+ digest: z.ZodNullable<z.ZodString>;
47
+ }, z.core.$strip>;
48
+ }, z.core.$strip>], "status">;
49
+ }, z.core.$strip>;
50
+ declare const previewDiagnosticReportSchema: z.ZodObject<{
51
+ route: z.ZodString;
52
+ documentId: z.ZodString;
53
+ diagnostic: z.ZodObject<{
54
+ origin: z.ZodEnum<{
55
+ boundary: "boundary";
56
+ root: "root";
57
+ build: "build";
58
+ runtime: "runtime";
59
+ recoverable: "recoverable";
60
+ console: "console";
61
+ rejection: "rejection";
62
+ }>;
63
+ impact: z.ZodEnum<{
64
+ unknown: "unknown";
65
+ page: "page";
66
+ }>;
67
+ error: z.ZodObject<{
68
+ message: z.ZodString;
69
+ name: z.ZodNullable<z.ZodString>;
70
+ stack: z.ZodNullable<z.ZodString>;
71
+ componentStack: z.ZodNullable<z.ZodString>;
72
+ digest: z.ZodNullable<z.ZodString>;
73
+ }, z.core.$strip>;
74
+ at: z.ZodNumber;
75
+ }, z.core.$strip>;
76
+ }, z.core.$strip>;
77
+ export type PreviewErrorDetail = z.infer<typeof previewErrorDetailSchema>;
78
+ export type PreviewHealth = z.infer<typeof previewHealthSchema>;
79
+ export type PreviewStatusReport = z.infer<typeof previewStatusReportSchema>;
80
+ export type PreviewDiagnosticReport = z.infer<typeof previewDiagnosticReportSchema>;
81
+ export declare const previewHealthToEditorMethodConfig: {
82
+ documentArrived: {
83
+ inputSchema: z.ZodObject<{
84
+ route: z.ZodString;
85
+ }, z.core.$strip>;
86
+ outputSchema: z.ZodVoid;
87
+ };
88
+ statusChanged: {
89
+ inputSchema: z.ZodObject<{
90
+ route: z.ZodString;
91
+ documentId: z.ZodString;
92
+ seq: z.ZodNumber;
93
+ health: z.ZodDiscriminatedUnion<[z.ZodObject<{
94
+ status: z.ZodLiteral<"ok">;
95
+ }, z.core.$strip>, z.ZodObject<{
96
+ status: z.ZodLiteral<"error">;
97
+ source: z.ZodEnum<{
98
+ boundary: "boundary";
99
+ root: "root";
100
+ build: "build";
101
+ }>;
102
+ error: z.ZodObject<{
103
+ message: z.ZodString;
104
+ name: z.ZodNullable<z.ZodString>;
105
+ stack: z.ZodNullable<z.ZodString>;
106
+ componentStack: z.ZodNullable<z.ZodString>;
107
+ digest: z.ZodNullable<z.ZodString>;
108
+ }, z.core.$strip>;
109
+ }, z.core.$strip>], "status">;
110
+ }, z.core.$strip>;
111
+ outputSchema: z.ZodVoid;
112
+ };
113
+ diagnosticRecorded: {
114
+ inputSchema: z.ZodObject<{
115
+ route: z.ZodString;
116
+ documentId: z.ZodString;
117
+ diagnostic: z.ZodObject<{
118
+ origin: z.ZodEnum<{
119
+ boundary: "boundary";
120
+ root: "root";
121
+ build: "build";
122
+ runtime: "runtime";
123
+ recoverable: "recoverable";
124
+ console: "console";
125
+ rejection: "rejection";
126
+ }>;
127
+ impact: z.ZodEnum<{
128
+ unknown: "unknown";
129
+ page: "page";
130
+ }>;
131
+ error: z.ZodObject<{
132
+ message: z.ZodString;
133
+ name: z.ZodNullable<z.ZodString>;
134
+ stack: z.ZodNullable<z.ZodString>;
135
+ componentStack: z.ZodNullable<z.ZodString>;
136
+ digest: z.ZodNullable<z.ZodString>;
137
+ }, z.core.$strip>;
138
+ at: z.ZodNumber;
139
+ }, z.core.$strip>;
140
+ }, z.core.$strip>;
141
+ outputSchema: z.ZodVoid;
142
+ };
143
+ };
144
+ export declare const editorToPreviewHealthMethodConfig: {};
145
+ /**
146
+ * Editor side of a preview iframe's health channel. `report` is the full
147
+ * status from current runtimes and null from older runtimes, which only say
148
+ * ok or error.
149
+ */
150
+ export declare function subscribeToPreviewHealth({ getFrameWindow, onDocumentArrived, onStatus, onDiagnostic, }: {
151
+ getFrameWindow: () => Window | null;
152
+ onDocumentArrived?: () => void;
153
+ onStatus: (update: {
154
+ status: PreviewHealth["status"];
155
+ report: PreviewStatusReport | null;
156
+ }) => void;
157
+ onDiagnostic?: (report: PreviewDiagnosticReport) => void;
158
+ }): () => void;
159
+ export {};
@@ -0,0 +1,123 @@
1
+ import { createIframeRpcChannel } from '../../chunk-KRA4LUIR.mjs';
2
+ import '../../chunk-LIPH4O4F.mjs';
3
+ import '../../chunk-PH3S6LJI.mjs';
4
+ import '../../chunk-FLYEIRFK.mjs';
5
+ import '../../chunk-TESFJQID.mjs';
6
+ import '../../chunk-G3S6ZNPF.mjs';
7
+ import * as z from 'zod';
8
+
9
+ var PREVIEW_HEALTH_IFRAME_RPC_CHANNEL_ID = "replo:preview-health-iframe-rpc";
10
+ var PREVIEW_HEALTH_IFRAME_RPC_CHANNEL_VERSION = 1;
11
+ var previewErrorDetailSchema = z.object({
12
+ message: z.string(),
13
+ name: z.string().nullable(),
14
+ stack: z.string().nullable(),
15
+ componentStack: z.string().nullable(),
16
+ digest: z.string().nullable()
17
+ });
18
+ var previewHealthSchema = z.discriminatedUnion("status", [
19
+ z.object({ status: z.literal("ok") }),
20
+ z.object({
21
+ status: z.literal("error"),
22
+ source: z.enum(["boundary", "root", "build"]),
23
+ error: previewErrorDetailSchema
24
+ })
25
+ ]);
26
+ var previewStatusReportSchema = z.object({
27
+ route: z.string(),
28
+ documentId: z.string(),
29
+ seq: z.number().int().positive(),
30
+ health: previewHealthSchema
31
+ });
32
+ var previewDiagnosticReportSchema = z.object({
33
+ route: z.string(),
34
+ documentId: z.string(),
35
+ diagnostic: z.object({
36
+ origin: z.enum([
37
+ "boundary",
38
+ "root",
39
+ "runtime",
40
+ "recoverable",
41
+ "console",
42
+ "rejection",
43
+ "build"
44
+ ]),
45
+ impact: z.enum(["page", "unknown"]),
46
+ error: previewErrorDetailSchema,
47
+ at: z.number()
48
+ })
49
+ });
50
+ var previewHealthToEditorMethodConfig = {
51
+ documentArrived: {
52
+ inputSchema: z.object({ route: z.string() }),
53
+ outputSchema: z.void()
54
+ },
55
+ statusChanged: {
56
+ inputSchema: previewStatusReportSchema,
57
+ outputSchema: z.void()
58
+ },
59
+ diagnosticRecorded: {
60
+ inputSchema: previewDiagnosticReportSchema,
61
+ outputSchema: z.void()
62
+ }
63
+ };
64
+ var editorToPreviewHealthMethodConfig = {};
65
+ var legacyPreviewStatusMessageSchema = z.object({
66
+ type: z.literal("replo:preview:status"),
67
+ status: z.enum(["ok", "error"]),
68
+ phase: z.literal("document").optional()
69
+ });
70
+ function subscribeToPreviewHealth({
71
+ getFrameWindow,
72
+ onDocumentArrived,
73
+ onStatus,
74
+ onDiagnostic
75
+ }) {
76
+ const isFromFrame = (event) => {
77
+ const frameWindow = getFrameWindow();
78
+ return frameWindow !== null && event.source === frameWindow;
79
+ };
80
+ const channel = createIframeRpcChannel({
81
+ subscriberWindow: window,
82
+ channelIdentifier: PREVIEW_HEALTH_IFRAME_RPC_CHANNEL_ID,
83
+ version: PREVIEW_HEALTH_IFRAME_RPC_CHANNEL_VERSION,
84
+ getTargetWindow: getFrameWindow,
85
+ targetOrigin: "*",
86
+ isExpectedMessage: isFromFrame,
87
+ outgoingMethods: editorToPreviewHealthMethodConfig,
88
+ incomingMethods: previewHealthToEditorMethodConfig,
89
+ handlers: {
90
+ documentArrived: () => {
91
+ onDocumentArrived?.();
92
+ },
93
+ statusChanged: (report) => {
94
+ onStatus({ status: report.health.status, report });
95
+ },
96
+ diagnosticRecorded: (report) => {
97
+ onDiagnostic?.(report);
98
+ }
99
+ }
100
+ });
101
+ const handleLegacyMessage = (event) => {
102
+ if (!isFromFrame(event)) {
103
+ return;
104
+ }
105
+ const message = legacyPreviewStatusMessageSchema.safeParse(event.data);
106
+ if (!message.success) {
107
+ return;
108
+ }
109
+ if (message.data.phase === "document") {
110
+ onDocumentArrived?.();
111
+ return;
112
+ }
113
+ onStatus({ status: message.data.status, report: null });
114
+ };
115
+ const unsubscribe = channel.subscribe();
116
+ window.addEventListener("message", handleLegacyMessage);
117
+ return () => {
118
+ unsubscribe();
119
+ window.removeEventListener("message", handleLegacyMessage);
120
+ };
121
+ }
122
+
123
+ export { PREVIEW_HEALTH_IFRAME_RPC_CHANNEL_ID, PREVIEW_HEALTH_IFRAME_RPC_CHANNEL_VERSION, editorToPreviewHealthMethodConfig, previewErrorDetailSchema, previewHealthSchema, previewHealthToEditorMethodConfig, subscribeToPreviewHealth };
@@ -4,9 +4,9 @@ export declare const SELECT_MODE_IFRAME_RPC_CHANNEL_ID: "replo:select-mode-ifram
4
4
  export declare const SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION: 1;
5
5
  export declare const inlineEditFeedbackSchema: z.ZodObject<{
6
6
  status: z.ZodEnum<{
7
+ failed: "failed";
7
8
  pending: "pending";
8
9
  unavailable: "unavailable";
9
- failed: "failed";
10
10
  }>;
11
11
  rect: z.ZodObject<{
12
12
  x: z.ZodNumber;
@@ -25,6 +25,75 @@ export declare const iframeRuntimeBuildMetadataSchema: z.ZodObject<{
25
25
  branch: z.ZodNullable<z.ZodString>;
26
26
  commit: z.ZodNullable<z.ZodString>;
27
27
  builtAt: z.ZodNullable<z.ZodString>;
28
+ capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
29
+ }, z.core.$strip>;
30
+ /** Runtimes listing this draw section insert and drag controls on the canvas and accept `setSectionCanvas`. */
31
+ export declare const SECTION_CANVAS_CAPABILITY = "sectionCanvas";
32
+ export declare const sectionCanvasSectionSchema: z.ZodObject<{
33
+ index: z.ZodNumber;
34
+ startLine: z.ZodNumber;
35
+ endLine: z.ZodNumber;
36
+ label: z.ZodString;
37
+ isLocked: z.ZodBoolean;
38
+ }, z.core.$strip>;
39
+ /**
40
+ * Whether a source location's file is the canvas's page file. Locations arrive as `file://` URLs,
41
+ * `./`-relative or absolute paths, and the page file is workspace-relative, so either may be a path
42
+ * suffix of the other. The builder's selection sync and the runtime's section finding both use this.
43
+ */
44
+ export declare function isSectionCanvasPageFile({ filePath, pageFilePath, }: {
45
+ filePath: string;
46
+ pageFilePath: string;
47
+ }): boolean;
48
+ export declare const sectionCanvasStateSchema: z.ZodObject<{
49
+ pageFilePath: z.ZodString;
50
+ sections: z.ZodArray<z.ZodObject<{
51
+ index: z.ZodNumber;
52
+ startLine: z.ZodNumber;
53
+ endLine: z.ZodNumber;
54
+ label: z.ZodString;
55
+ isLocked: z.ZodBoolean;
56
+ }, z.core.$strip>>;
57
+ previewScale: z.ZodNumber;
58
+ isDisabled: z.ZodBoolean;
59
+ insertingAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
60
+ occludedInsets: z.ZodOptional<z.ZodNullable<z.ZodObject<{
61
+ left: z.ZodNumber;
62
+ right: z.ZodNumber;
63
+ }, z.core.$strip>>>;
64
+ }, z.core.$strip>;
65
+ export declare const sectionCanvasRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
66
+ type: z.ZodLiteral<"insert">;
67
+ at: z.ZodNumber;
68
+ }, z.core.$strip>, z.ZodObject<{
69
+ type: z.ZodLiteral<"move">;
70
+ moveId: z.ZodString;
71
+ index: z.ZodNumber;
72
+ to: z.ZodNumber;
73
+ }, z.core.$strip>, z.ZodObject<{
74
+ type: z.ZodLiteral<"remove">;
75
+ index: z.ZodNumber;
76
+ }, z.core.$strip>, z.ZodObject<{
77
+ type: z.ZodLiteral<"undo">;
78
+ }, z.core.$strip>, z.ZodObject<{
79
+ type: z.ZodLiteral<"redo">;
80
+ }, z.core.$strip>, z.ZodObject<{
81
+ type: z.ZodLiteral<"cancelInsert">;
82
+ }, z.core.$strip>], "type">;
83
+ export declare const sectionCanvasLayoutEntrySchema: z.ZodObject<{
84
+ index: z.ZodNumber;
85
+ startLine: z.ZodNumber;
86
+ endLine: z.ZodNumber;
87
+ rect: z.ZodObject<{
88
+ x: z.ZodNumber;
89
+ y: z.ZodNumber;
90
+ left: z.ZodNumber;
91
+ top: z.ZodNumber;
92
+ right: z.ZodNumber;
93
+ bottom: z.ZodNumber;
94
+ width: z.ZodNumber;
95
+ height: z.ZodNumber;
96
+ }, z.core.$strip>;
28
97
  }, z.core.$strip>;
29
98
  export declare const selectModeEventInputSchemas: {
30
99
  hover: z.ZodObject<{
@@ -185,6 +254,38 @@ export declare const selectModeEventInputSchemas: {
185
254
  }, z.core.$strip>;
186
255
  };
187
256
  export declare const websiteBuilderToPreviewIframeMethodConfig: {
257
+ setSectionCanvas: {
258
+ inputSchema: z.ZodObject<{
259
+ canvas: z.ZodNullable<z.ZodObject<{
260
+ pageFilePath: z.ZodString;
261
+ sections: z.ZodArray<z.ZodObject<{
262
+ index: z.ZodNumber;
263
+ startLine: z.ZodNumber;
264
+ endLine: z.ZodNumber;
265
+ label: z.ZodString;
266
+ isLocked: z.ZodBoolean;
267
+ }, z.core.$strip>>;
268
+ previewScale: z.ZodNumber;
269
+ isDisabled: z.ZodBoolean;
270
+ insertingAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
271
+ occludedInsets: z.ZodOptional<z.ZodNullable<z.ZodObject<{
272
+ left: z.ZodNumber;
273
+ right: z.ZodNumber;
274
+ }, z.core.$strip>>>;
275
+ }, z.core.$strip>>;
276
+ }, z.core.$strip>;
277
+ outputSchema: z.ZodVoid;
278
+ };
279
+ settleSectionMove: {
280
+ inputSchema: z.ZodObject<{
281
+ moveId: z.ZodString;
282
+ outcome: z.ZodEnum<{
283
+ failed: "failed";
284
+ persisted: "persisted";
285
+ }>;
286
+ }, z.core.$strip>;
287
+ outputSchema: z.ZodVoid;
288
+ };
188
289
  expandToSection: {
189
290
  inputSchema: z.ZodObject<{
190
291
  targetSelector: z.ZodString;
@@ -478,6 +579,49 @@ export declare const websiteBuilderToPreviewIframeMethodConfig: {
478
579
  };
479
580
  };
480
581
  export declare const previewIframeToWebsiteBuilderMethodConfig: {
582
+ sectionCanvasRequest: {
583
+ inputSchema: z.ZodObject<{
584
+ request: z.ZodDiscriminatedUnion<[z.ZodObject<{
585
+ type: z.ZodLiteral<"insert">;
586
+ at: z.ZodNumber;
587
+ }, z.core.$strip>, z.ZodObject<{
588
+ type: z.ZodLiteral<"move">;
589
+ moveId: z.ZodString;
590
+ index: z.ZodNumber;
591
+ to: z.ZodNumber;
592
+ }, z.core.$strip>, z.ZodObject<{
593
+ type: z.ZodLiteral<"remove">;
594
+ index: z.ZodNumber;
595
+ }, z.core.$strip>, z.ZodObject<{
596
+ type: z.ZodLiteral<"undo">;
597
+ }, z.core.$strip>, z.ZodObject<{
598
+ type: z.ZodLiteral<"redo">;
599
+ }, z.core.$strip>, z.ZodObject<{
600
+ type: z.ZodLiteral<"cancelInsert">;
601
+ }, z.core.$strip>], "type">;
602
+ }, z.core.$strip>;
603
+ outputSchema: z.ZodVoid;
604
+ };
605
+ sectionCanvasLayoutChanged: {
606
+ inputSchema: z.ZodObject<{
607
+ sections: z.ZodArray<z.ZodObject<{
608
+ index: z.ZodNumber;
609
+ startLine: z.ZodNumber;
610
+ endLine: z.ZodNumber;
611
+ rect: z.ZodObject<{
612
+ x: z.ZodNumber;
613
+ y: z.ZodNumber;
614
+ left: z.ZodNumber;
615
+ top: z.ZodNumber;
616
+ right: z.ZodNumber;
617
+ bottom: z.ZodNumber;
618
+ width: z.ZodNumber;
619
+ height: z.ZodNumber;
620
+ }, z.core.$strip>;
621
+ }, z.core.$strip>>;
622
+ }, z.core.$strip>;
623
+ outputSchema: z.ZodVoid;
624
+ };
481
625
  requestInlineTextEdit: {
482
626
  inputSchema: z.ZodObject<{
483
627
  editId: z.ZodString;
@@ -576,6 +720,7 @@ export declare const previewIframeToWebsiteBuilderMethodConfig: {
576
720
  branch: z.ZodNullable<z.ZodString>;
577
721
  commit: z.ZodNullable<z.ZodString>;
578
722
  builtAt: z.ZodNullable<z.ZodString>;
723
+ capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
579
724
  }, z.core.$strip>;
580
725
  outputSchema: z.ZodVoid;
581
726
  };
@@ -882,9 +1027,9 @@ export declare const previewIframeToWebsiteBuilderMethodConfig: {
882
1027
  inputSchema: z.ZodObject<{
883
1028
  feedback: z.ZodNullable<z.ZodObject<{
884
1029
  status: z.ZodEnum<{
1030
+ failed: "failed";
885
1031
  pending: "pending";
886
1032
  unavailable: "unavailable";
887
- failed: "failed";
888
1033
  }>;
889
1034
  rect: z.ZodObject<{
890
1035
  x: z.ZodNumber;
@@ -1032,6 +1177,7 @@ export declare const selectModeIframeMessageSchema: z.ZodDiscriminatedUnion<[z.Z
1032
1177
  branch: z.ZodNullable<z.ZodString>;
1033
1178
  commit: z.ZodNullable<z.ZodString>;
1034
1179
  builtAt: z.ZodNullable<z.ZodString>;
1180
+ capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
1035
1181
  }, z.core.$strip>;
1036
1182
  }, z.core.$strip>, z.ZodObject<{
1037
1183
  method: z.ZodLiteral<"elementSelected">;
@@ -1330,9 +1476,9 @@ export declare const selectModeIframeMessageSchema: z.ZodDiscriminatedUnion<[z.Z
1330
1476
  data: z.ZodObject<{
1331
1477
  feedback: z.ZodNullable<z.ZodObject<{
1332
1478
  status: z.ZodEnum<{
1479
+ failed: "failed";
1333
1480
  pending: "pending";
1334
1481
  unavailable: "unavailable";
1335
- failed: "failed";
1336
1482
  }>;
1337
1483
  rect: z.ZodObject<{
1338
1484
  x: z.ZodNumber;
@@ -16,8 +16,57 @@ var iframeRuntimeBuildMetadataSchema = z.object({
16
16
  version: z.string(),
17
17
  branch: z.string().nullable(),
18
18
  commit: z.string().nullable(),
19
- builtAt: z.string().nullable()
19
+ builtAt: z.string().nullable(),
20
+ capabilities: z.array(z.string()).optional()
20
21
  }).describe("IframeRuntimeBuildMetadata");
22
+ var SECTION_CANVAS_CAPABILITY = "sectionCanvas";
23
+ var sectionCanvasSectionSchema = z.object({
24
+ index: z.number().int().nonnegative(),
25
+ startLine: z.number().int().positive(),
26
+ endLine: z.number().int().positive(),
27
+ label: z.string(),
28
+ isLocked: z.boolean()
29
+ }).describe("SectionCanvasSection");
30
+ function isSectionCanvasPageFile({
31
+ filePath,
32
+ pageFilePath
33
+ }) {
34
+ const normalized = filePath.replace(/^file:\/\//u, "").replace(/^\.\//u, "");
35
+ return normalized === pageFilePath || normalized.endsWith(`/${pageFilePath}`) || pageFilePath.endsWith(`/${normalized}`);
36
+ }
37
+ var sectionCanvasStateSchema = z.object({
38
+ pageFilePath: z.string(),
39
+ sections: z.array(sectionCanvasSectionSchema),
40
+ previewScale: z.number().positive(),
41
+ isDisabled: z.boolean(),
42
+ insertingAt: z.number().int().nonnegative().nullish(),
43
+ occludedInsets: z.object({
44
+ left: z.number().nonnegative(),
45
+ right: z.number().nonnegative()
46
+ }).nullish()
47
+ }).describe("SectionCanvasState");
48
+ var sectionCanvasRequestSchema = z.discriminatedUnion("type", [
49
+ z.object({ type: z.literal("insert"), at: z.number().int().nonnegative() }),
50
+ z.object({
51
+ type: z.literal("move"),
52
+ moveId: z.string(),
53
+ index: z.number().int().nonnegative(),
54
+ to: z.number().int().nonnegative()
55
+ }),
56
+ z.object({
57
+ type: z.literal("remove"),
58
+ index: z.number().int().nonnegative()
59
+ }),
60
+ z.object({ type: z.literal("undo") }),
61
+ z.object({ type: z.literal("redo") }),
62
+ z.object({ type: z.literal("cancelInsert") })
63
+ ]).describe("SectionCanvasRequest");
64
+ var sectionCanvasLayoutEntrySchema = z.object({
65
+ index: z.number().int().nonnegative(),
66
+ startLine: z.number().int().positive(),
67
+ endLine: z.number().int().positive(),
68
+ rect: selectModeBoundingRectSchema
69
+ }).describe("SectionCanvasLayoutEntry");
21
70
  var selectModeEventInputSchemas = {
22
71
  hover: z.object({
23
72
  rect: selectModeHoverRectSchema.nullable()
@@ -37,6 +86,17 @@ var selectModeEventInputSchemas = {
37
86
  })
38
87
  };
39
88
  var websiteBuilderToPreviewIframeMethodConfig = {
89
+ setSectionCanvas: {
90
+ inputSchema: z.object({ canvas: sectionCanvasStateSchema.nullable() }),
91
+ outputSchema: z.void()
92
+ },
93
+ settleSectionMove: {
94
+ inputSchema: z.object({
95
+ moveId: z.string(),
96
+ outcome: z.enum(["persisted", "failed"])
97
+ }),
98
+ outputSchema: z.void()
99
+ },
40
100
  expandToSection: {
41
101
  inputSchema: z.object({ targetSelector: z.string() }),
42
102
  outputSchema: z.void()
@@ -110,6 +170,16 @@ var websiteBuilderToPreviewIframeMethodConfig = {
110
170
  }
111
171
  };
112
172
  var previewIframeToWebsiteBuilderMethodConfig = {
173
+ sectionCanvasRequest: {
174
+ inputSchema: z.object({ request: sectionCanvasRequestSchema }),
175
+ outputSchema: z.void()
176
+ },
177
+ sectionCanvasLayoutChanged: {
178
+ inputSchema: z.object({
179
+ sections: z.array(sectionCanvasLayoutEntrySchema)
180
+ }),
181
+ outputSchema: z.void()
182
+ },
113
183
  requestInlineTextEdit: {
114
184
  inputSchema: z.object({
115
185
  editId: z.string(),
@@ -265,4 +335,4 @@ var selectModeIframeMessageSchema = z.discriminatedUnion("method", [
265
335
  })
266
336
  ]).describe("SelectModeIframeMessage");
267
337
 
268
- export { SELECT_MODE_IFRAME_RPC_CHANNEL_ID, SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION, iframeRuntimeBuildMetadataSchema, inlineEditFeedbackSchema, previewIframeToWebsiteBuilderMethodConfig, selectModeEventInputSchemas, selectModeIframeMessageSchema, selectModeParentMessageSchema, websiteBuilderToPreviewIframeMethodConfig };
338
+ export { SECTION_CANVAS_CAPABILITY, SELECT_MODE_IFRAME_RPC_CHANNEL_ID, SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION, iframeRuntimeBuildMetadataSchema, inlineEditFeedbackSchema, isSectionCanvasPageFile, previewIframeToWebsiteBuilderMethodConfig, sectionCanvasLayoutEntrySchema, sectionCanvasRequestSchema, sectionCanvasSectionSchema, sectionCanvasStateSchema, 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.16.2",
3
+ "version": "1.18.0",
4
4
  "branch": "HEAD",
5
- "commit": "9158b1e6452ebc5e1945da883b1c8406c7b17f08",
6
- "builtAt": "2026-10-19T23:23:08.010Z"
5
+ "commit": "371ae98105e9f99b04918b3dffe40867380cd9ef",
6
+ "builtAt": "2026-10-21T22:33:13.604Z"
7
7
  };