@replohq/sandbox-runtime 1.24.7 → 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.24.7",
3
+ "version": "1.25.0",
4
4
  "branch": "HEAD",
5
- "commit": "ae3b30aedf49e4c1351290757cbab9f9f50e8369",
6
- "builtAt": "2026-11-09T22:40:21.866Z"
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.24.7",
3
+ "version": "1.25.0",
4
4
  "reploBuild": {
5
5
  "packageName": "@replohq/sandbox-runtime",
6
- "version": "1.24.7",
6
+ "version": "1.25.0",
7
7
  "branch": "HEAD",
8
- "commit": "ae3b30aedf49e4c1351290757cbab9f9f50e8369",
9
- "builtAt": "2026-11-09T22:40:21.866Z"
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 stopBuildStatus = subscribeToBuildStatus({
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
- stopBuildStatus();
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 subscribeToBuildStatus({
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
  {