@replohq/sandbox-runtime 1.24.6 → 1.25.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.
|
@@ -75,10 +75,15 @@ declare const previewDiagnosticReportSchema: z.ZodObject<{
|
|
|
75
75
|
at: z.ZodNumber;
|
|
76
76
|
}, z.core.$strip>;
|
|
77
77
|
}, z.core.$strip>;
|
|
78
|
+
declare const devServerConnectionStateSchema: z.ZodEnum<{
|
|
79
|
+
connecting: "connecting";
|
|
80
|
+
connected: "connected";
|
|
81
|
+
}>;
|
|
78
82
|
export type PreviewErrorDetail = z.infer<typeof previewErrorDetailSchema>;
|
|
79
83
|
export type PreviewHealth = z.infer<typeof previewHealthSchema>;
|
|
80
84
|
export type PreviewStatusReport = z.infer<typeof previewStatusReportSchema>;
|
|
81
85
|
export type PreviewDiagnosticReport = z.infer<typeof previewDiagnosticReportSchema>;
|
|
86
|
+
export type DevServerConnectionState = z.infer<typeof devServerConnectionStateSchema>;
|
|
82
87
|
export declare const previewHealthToEditorMethodConfig: {
|
|
83
88
|
documentArrived: {
|
|
84
89
|
inputSchema: z.ZodObject<{
|
|
@@ -141,6 +146,17 @@ export declare const previewHealthToEditorMethodConfig: {
|
|
|
141
146
|
}, z.core.$strip>;
|
|
142
147
|
outputSchema: z.ZodVoid;
|
|
143
148
|
};
|
|
149
|
+
devServerConnectionChanged: {
|
|
150
|
+
inputSchema: z.ZodObject<{
|
|
151
|
+
state: z.ZodEnum<{
|
|
152
|
+
connecting: "connecting";
|
|
153
|
+
connected: "connected";
|
|
154
|
+
}>;
|
|
155
|
+
route: z.ZodString;
|
|
156
|
+
documentId: z.ZodString;
|
|
157
|
+
}, z.core.$strip>;
|
|
158
|
+
outputSchema: z.ZodVoid;
|
|
159
|
+
};
|
|
144
160
|
};
|
|
145
161
|
export declare const editorToPreviewHealthMethodConfig: {};
|
|
146
162
|
/**
|
|
@@ -148,7 +164,7 @@ export declare const editorToPreviewHealthMethodConfig: {};
|
|
|
148
164
|
* status from current runtimes and null from older runtimes, which only say
|
|
149
165
|
* ok or error.
|
|
150
166
|
*/
|
|
151
|
-
export declare function subscribeToPreviewHealth({ getFrameWindow, onDocumentArrived, onStatus, onDiagnostic, onPeerVersionMismatch, }: {
|
|
167
|
+
export declare function subscribeToPreviewHealth({ getFrameWindow, onDocumentArrived, onStatus, onDiagnostic, onDevServerConnectionChanged, onPeerVersionMismatch, }: {
|
|
152
168
|
getFrameWindow: () => Window | null;
|
|
153
169
|
onDocumentArrived?: () => void;
|
|
154
170
|
onStatus: (update: {
|
|
@@ -156,6 +172,7 @@ export declare function subscribeToPreviewHealth({ getFrameWindow, onDocumentArr
|
|
|
156
172
|
report: PreviewStatusReport | null;
|
|
157
173
|
}) => void;
|
|
158
174
|
onDiagnostic?: (report: PreviewDiagnosticReport) => void;
|
|
175
|
+
onDevServerConnectionChanged?: (state: DevServerConnectionState) => void;
|
|
159
176
|
onPeerVersionMismatch?: (mismatch: IframeRpcVersionMismatch) => void;
|
|
160
177
|
}): () => void;
|
|
161
178
|
export {};
|
|
@@ -47,6 +47,7 @@ var previewDiagnosticReportSchema = z.object({
|
|
|
47
47
|
at: z.number()
|
|
48
48
|
})
|
|
49
49
|
});
|
|
50
|
+
var devServerConnectionStateSchema = z.enum(["connecting", "connected"]);
|
|
50
51
|
var previewHealthToEditorMethodConfig = {
|
|
51
52
|
documentArrived: {
|
|
52
53
|
inputSchema: z.object({ route: z.string() }),
|
|
@@ -59,6 +60,14 @@ var previewHealthToEditorMethodConfig = {
|
|
|
59
60
|
diagnosticRecorded: {
|
|
60
61
|
inputSchema: previewDiagnosticReportSchema,
|
|
61
62
|
outputSchema: z.void()
|
|
63
|
+
},
|
|
64
|
+
devServerConnectionChanged: {
|
|
65
|
+
inputSchema: z.object({
|
|
66
|
+
state: devServerConnectionStateSchema,
|
|
67
|
+
route: z.string(),
|
|
68
|
+
documentId: z.string()
|
|
69
|
+
}),
|
|
70
|
+
outputSchema: z.void()
|
|
62
71
|
}
|
|
63
72
|
};
|
|
64
73
|
var editorToPreviewHealthMethodConfig = {};
|
|
@@ -72,6 +81,7 @@ function subscribeToPreviewHealth({
|
|
|
72
81
|
onDocumentArrived,
|
|
73
82
|
onStatus,
|
|
74
83
|
onDiagnostic,
|
|
84
|
+
onDevServerConnectionChanged,
|
|
75
85
|
onPeerVersionMismatch
|
|
76
86
|
}) {
|
|
77
87
|
const isFromFrame = (event) => {
|
|
@@ -97,6 +107,9 @@ function subscribeToPreviewHealth({
|
|
|
97
107
|
},
|
|
98
108
|
diagnosticRecorded: (report) => {
|
|
99
109
|
onDiagnostic?.(report);
|
|
110
|
+
},
|
|
111
|
+
devServerConnectionChanged: ({ state }) => {
|
|
112
|
+
onDevServerConnectionChanged?.(state);
|
|
100
113
|
}
|
|
101
114
|
}
|
|
102
115
|
});
|
package/buildMetadata.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const BUILD_METADATA = {
|
|
2
2
|
"packageName": "@replohq/sandbox-runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25.0",
|
|
4
4
|
"branch": "HEAD",
|
|
5
|
-
"commit": "
|
|
6
|
-
"builtAt": "2026-11-
|
|
5
|
+
"commit": "c5e3259b4bbe7b22046b0b2a57fe9b826917748e",
|
|
6
|
+
"builtAt": "2026-11-09T23:38:05.958Z"
|
|
7
7
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@replohq/sandbox-runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25.0",
|
|
4
4
|
"reploBuild": {
|
|
5
5
|
"packageName": "@replohq/sandbox-runtime",
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.25.0",
|
|
7
7
|
"branch": "HEAD",
|
|
8
|
-
"commit": "
|
|
9
|
-
"builtAt": "2026-11-
|
|
8
|
+
"commit": "c5e3259b4bbe7b22046b0b2a57fe9b826917748e",
|
|
9
|
+
"builtAt": "2026-11-09T23:38:05.958Z"
|
|
10
10
|
},
|
|
11
11
|
"description": "Replo sandbox runtime — editor integration for agent-built Next.js sites.",
|
|
12
12
|
"license": "SEE LICENSE IN LICENSE",
|
package/previewHealth.js
CHANGED
|
@@ -295,14 +295,21 @@ function createPreviewHealthMonitor() {
|
|
|
295
295
|
overlayStyle.textContent = "nextjs-portal{display:none!important}";
|
|
296
296
|
document.head.append(overlayStyle);
|
|
297
297
|
const stopScrollLockRelease = releaseNextOverlayScrollLock();
|
|
298
|
-
const
|
|
299
|
-
onBuildErrors: actions.buildErrorsChanged
|
|
298
|
+
const unsubscribeFromDevServer = subscribeToDevServer({
|
|
299
|
+
onBuildErrors: actions.buildErrorsChanged,
|
|
300
|
+
onConnectionChanged: (state) => {
|
|
301
|
+
editor.devServerConnectionChanged({
|
|
302
|
+
state,
|
|
303
|
+
route: window.location.pathname,
|
|
304
|
+
documentId
|
|
305
|
+
});
|
|
306
|
+
}
|
|
300
307
|
});
|
|
301
308
|
return {
|
|
302
309
|
actions,
|
|
303
310
|
dispose() {
|
|
304
311
|
unsubscribe();
|
|
305
|
-
|
|
312
|
+
unsubscribeFromDevServer();
|
|
306
313
|
overlayStyle.remove();
|
|
307
314
|
stopScrollLockRelease();
|
|
308
315
|
cancelPendingRecovery();
|
|
@@ -351,8 +358,9 @@ function openSocket(url) {
|
|
|
351
358
|
});
|
|
352
359
|
});
|
|
353
360
|
}
|
|
354
|
-
function
|
|
355
|
-
onBuildErrors
|
|
361
|
+
function subscribeToDevServer({
|
|
362
|
+
onBuildErrors,
|
|
363
|
+
onConnectionChanged
|
|
356
364
|
}) {
|
|
357
365
|
const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
|
|
358
366
|
const getUrl = (path) => {
|
|
@@ -388,14 +396,20 @@ function subscribeToBuildStatus({
|
|
|
388
396
|
};
|
|
389
397
|
const reconnect = async (path) => {
|
|
390
398
|
const socket = await retry(
|
|
391
|
-
async () => {
|
|
399
|
+
async (_bail, attempt) => {
|
|
392
400
|
if (isStopped) {
|
|
393
401
|
return null;
|
|
394
402
|
}
|
|
395
403
|
const opened = await openSocket(getUrl(path));
|
|
396
404
|
if (opened === null) {
|
|
405
|
+
if (attempt === 1) {
|
|
406
|
+
onConnectionChanged("connecting");
|
|
407
|
+
}
|
|
397
408
|
throw new HmrSocketClosedError(path);
|
|
398
409
|
}
|
|
410
|
+
if (attempt > 1) {
|
|
411
|
+
onConnectionChanged("connected");
|
|
412
|
+
}
|
|
399
413
|
return opened;
|
|
400
414
|
},
|
|
401
415
|
{
|
|
@@ -30,19 +30,8 @@ function getOrCreateFramesLayerContainer({
|
|
|
30
30
|
document.body.append(container);
|
|
31
31
|
return container;
|
|
32
32
|
}
|
|
33
|
-
const ANNOTATION_FONT_STYLE_ID = "replo-annotation-font";
|
|
34
33
|
const BADGE_SIZE_PX = 30;
|
|
35
|
-
const
|
|
36
|
-
const BADGE_FONT = 'italic 400 16px/1 "PP Editorial New", Georgia, "Times New Roman", serif';
|
|
37
|
-
function ensureBadgeFont() {
|
|
38
|
-
if (document.getElementById(ANNOTATION_FONT_STYLE_ID)) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const style = document.createElement("style");
|
|
42
|
-
style.id = ANNOTATION_FONT_STYLE_ID;
|
|
43
|
-
style.textContent = `@font-face{font-family:"PP Editorial New";src:url("${EDITORIAL_ITALIC_FONT_URL}") format("woff2");font-weight:normal;font-style:italic;font-display:swap;}`;
|
|
44
|
-
document.head.append(style);
|
|
45
|
-
}
|
|
34
|
+
const BADGE_FONT = "600 14px/1 Inter, system-ui, sans-serif";
|
|
46
35
|
const badgeNodesById = /* @__PURE__ */ new Map();
|
|
47
36
|
let activeBadgeId = null;
|
|
48
37
|
function badgeRestingTransform(id) {
|
|
@@ -98,7 +87,7 @@ function createFrameNode(spec) {
|
|
|
98
87
|
"cursor: pointer",
|
|
99
88
|
"pointer-events: auto",
|
|
100
89
|
"margin: 0",
|
|
101
|
-
"padding: 0
|
|
90
|
+
"padding: 0"
|
|
102
91
|
].join(";");
|
|
103
92
|
badge.addEventListener("pointerdown", () => {
|
|
104
93
|
badge.style.transform = "scale(0.9)";
|
|
@@ -127,7 +116,6 @@ function showAnnotationFrames({
|
|
|
127
116
|
if (!container) {
|
|
128
117
|
return;
|
|
129
118
|
}
|
|
130
|
-
ensureBadgeFont();
|
|
131
119
|
activeBadgeId = frames.find((spec) => spec.isActive)?.id ?? null;
|
|
132
120
|
badgeNodesById.clear();
|
|
133
121
|
container.replaceChildren(...frames.map((spec) => createFrameNode(spec)));
|