@replohq/sandbox-runtime 1.21.0 → 1.22.1

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,4 +1,12 @@
1
1
  import * as z from "zod";
2
+ export declare function isUuid(value: string): boolean;
3
+ /**
4
+ * The thread id in a bare id or either D-23 permalink form
5
+ * (`…/comments/<id>`, `…/<folderId>?thread=<id>`); null when there is none.
6
+ */
7
+ export declare function parseCommentThreadReference(reference: string): string | null;
8
+ /** A comment body an agent or API caller writes: something besides whitespace. */
9
+ export declare const commentBodyTextSchema: z.ZodString;
2
10
  export declare const commentSourceSchema: z.ZodEnum<{
3
11
  ui: "ui";
4
12
  agent: "agent";
@@ -126,7 +134,7 @@ export declare const commentTargetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
126
134
  routePatternHint: z.ZodOptional<z.ZodString>;
127
135
  via: z.ZodOptional<z.ZodObject<{
128
136
  fileId: z.ZodUUID;
129
- shareId: z.ZodString;
137
+ shareId: z.ZodUUID;
130
138
  }, z.core.$strip>>;
131
139
  }, z.core.$strip>, z.ZodObject<{
132
140
  kind: z.ZodLiteral<"order">;
@@ -386,7 +394,7 @@ export declare const createCommentThreadBodySchema: z.ZodObject<{
386
394
  routePatternHint: z.ZodOptional<z.ZodString>;
387
395
  via: z.ZodOptional<z.ZodObject<{
388
396
  fileId: z.ZodUUID;
389
- shareId: z.ZodString;
397
+ shareId: z.ZodUUID;
390
398
  }, z.core.$strip>>;
391
399
  }, z.core.$strip>, z.ZodObject<{
392
400
  kind: z.ZodLiteral<"order">;
@@ -556,7 +564,7 @@ export declare const presignCommentAttachmentBodySchema: z.ZodObject<{
556
564
  routePatternHint: z.ZodOptional<z.ZodString>;
557
565
  via: z.ZodOptional<z.ZodObject<{
558
566
  fileId: z.ZodUUID;
559
- shareId: z.ZodString;
567
+ shareId: z.ZodUUID;
560
568
  }, z.core.$strip>>;
561
569
  }, z.core.$strip>, z.ZodObject<{
562
570
  kind: z.ZodLiteral<"order">;
@@ -586,7 +594,7 @@ export declare const commitCommentAttachmentBodySchema: z.ZodObject<{
586
594
  routePatternHint: z.ZodOptional<z.ZodString>;
587
595
  via: z.ZodOptional<z.ZodObject<{
588
596
  fileId: z.ZodUUID;
589
- shareId: z.ZodString;
597
+ shareId: z.ZodUUID;
590
598
  }, z.core.$strip>>;
591
599
  }, z.core.$strip>, z.ZodObject<{
592
600
  kind: z.ZodLiteral<"order">;
@@ -1,4 +1,4 @@
1
- import { commentAnchorSchema, displayModeSchema, commentAnchorElementSchema } from '../../chunk-NVOBD46N.mjs';
1
+ import { commentAnchorSchema, displayModeSchema, commentAnchorElementSchema } from '../../chunk-CGRTGQO5.mjs';
2
2
  import '../../chunk-THOBCJJA.mjs';
3
3
  import '../../chunk-4ITJNSXZ.mjs';
4
4
  import '../../chunk-SKVPFN7M.mjs';
@@ -1,4 +1,4 @@
1
- export { SELECT_MODE_SELECTABLE_ATTRIBUTE, SELECT_MODE_SELECTABLE_PAYLOAD_ATTRIBUTE, displayModeSchema, getIframeOffset, isSelectedSection, readSelectablePayload, selectModeBoundingRectSchema, selectModeClickPositionSchema, selectModeDefinedStyleSchema, selectModeFiberChainEntrySchema, selectModeFormatCommandSchema, selectModeHoverRectSchema, selectModeImageSchema, selectModeImageScopeSchema, selectModeImageSourceSchema, selectModeInlineTextStatusSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionRectSchema, selectModeSelectionSchema, selectModeSelectionTypeSchema, selectModeSourceLocationSchema, selectModeStyleAtRuleSchema, selectModeStyleVariantSchema, selectModeTextMetricsSchema, selectModeTiptapActiveMarksSchema, selectModeVideoSchema, selectableDataPayloadSchema, selectableDataSchema, selectablePlanDataSchema, selectablePlanPayloadSchema, selectedElementSchema, transformPoint, transformRect, transformSelectableData, transformSelectedElement } from '../../chunk-NVOBD46N.mjs';
1
+ export { SELECT_MODE_SELECTABLE_ATTRIBUTE, SELECT_MODE_SELECTABLE_PAYLOAD_ATTRIBUTE, displayModeSchema, getIframeOffset, isSelectedSection, readSelectablePayload, selectModeBoundingRectSchema, selectModeClickPositionSchema, selectModeDefinedStyleSchema, selectModeFiberChainEntrySchema, selectModeFormatCommandSchema, selectModeHoverRectSchema, selectModeImageSchema, selectModeImageScopeSchema, selectModeImageSourceSchema, selectModeInlineTextStatusSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionRectSchema, selectModeSelectionSchema, selectModeSelectionTypeSchema, selectModeSourceLocationSchema, selectModeStyleAtRuleSchema, selectModeStyleVariantSchema, selectModeTextMetricsSchema, selectModeTiptapActiveMarksSchema, selectModeVideoSchema, selectableDataPayloadSchema, selectableDataSchema, selectablePlanDataSchema, selectablePlanPayloadSchema, selectedElementSchema, transformPoint, transformRect, transformSelectableData, transformSelectedElement } from '../../chunk-CGRTGQO5.mjs';
2
2
  import '../../chunk-THOBCJJA.mjs';
3
3
  import '../../chunk-4ITJNSXZ.mjs';
4
4
  import '../../chunk-SKVPFN7M.mjs';
@@ -1,4 +1,4 @@
1
- import { selectModeBoundingRectSchema, selectModeTiptapActiveMarksSchema, selectModeSelectionRectSchema, selectableDataSchema, selectModeHoverRectSchema, selectModeFormatCommandSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionTypeSchema, displayModeSchema, selectModeClickPositionSchema, selectedElementSchema } from '../../chunk-NVOBD46N.mjs';
1
+ import { selectModeBoundingRectSchema, selectModeTiptapActiveMarksSchema, selectModeSelectionRectSchema, selectableDataSchema, selectModeHoverRectSchema, selectModeFormatCommandSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionTypeSchema, displayModeSchema, selectModeClickPositionSchema, selectedElementSchema } from '../../chunk-CGRTGQO5.mjs';
2
2
  import '../../chunk-THOBCJJA.mjs';
3
3
  import '../../chunk-4ITJNSXZ.mjs';
4
4
  import '../../chunk-SKVPFN7M.mjs';
package/buildMetadata.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export const BUILD_METADATA = {
2
2
  "packageName": "@replohq/sandbox-runtime",
3
- "version": "1.21.0",
3
+ "version": "1.22.1",
4
4
  "branch": "HEAD",
5
- "commit": "d5ce2185ff844319f59248b9da6641bf96f4c0a2",
6
- "builtAt": "2026-10-29T04:07:57.675Z"
5
+ "commit": "073dd1a46fae9bca92aae68286e667ef84854658",
6
+ "builtAt": "2026-10-30T20:41:52.402Z"
7
7
  };
@@ -13,6 +13,9 @@ function parseSchemaOrNull(value, schema) {
13
13
  const parseResult = schema.safeParse(value);
14
14
  return parseResult.success ? parseResult.data : null;
15
15
  }
16
+ z.string().min(1).refine((body) => body.trim().length > 0, {
17
+ message: "Write something before posting."
18
+ });
16
19
  var commentSourceSchema = z.enum(["ui", "agent", "mcp", "api"]).describe("CommentSource");
17
20
  var unitIntervalSchema = z.number().min(0).max(1);
18
21
  var anchorUrlSchema = z.string().max(2048);
@@ -82,7 +85,7 @@ var commentTargetSchema = z.discriminatedUnion("kind", [
82
85
  url: anchorUrlSchema,
83
86
  locale: anchorLocaleSchema.nullish(),
84
87
  routePatternHint: anchorUrlSchema.optional(),
85
- via: z.object({ fileId: z.uuid(), shareId: z.string() }).optional().describe(
88
+ via: z.object({ fileId: z.uuid(), shareId: z.uuid() }).optional().describe(
86
89
  "Set when the site preview is embedded in an artifact or canvas."
87
90
  )
88
91
  }),
@@ -4,7 +4,7 @@ import type { DisplayMode } from "../_vendor/schemas/generated/selectMode";
4
4
  import type { ElementSource } from "./capture";
5
5
  export declare const OVERLAY_Z_INDEX = 2147483645;
6
6
  export declare const HIGHLIGHT_BACKGROUND = "rgba(250, 204, 21, 0.28)";
7
- export declare const BADGE_SIZE_PX = 20;
7
+ export declare const BADGE_SIZE_PX = 32;
8
8
  export declare const RERESOLVE_DEBOUNCE_MS = 250;
9
9
  export type CommentsOverlayCallbacks = {
10
10
  onAnchorPicked: (input: {
@@ -4,8 +4,9 @@ import { OVERLAY_ROOT_ATTRIBUTE } from "./textQuote";
4
4
  const OVERLAY_Z_INDEX = 2147483645;
5
5
  const HIGHLIGHT_BACKGROUND = "rgba(250, 204, 21, 0.28)";
6
6
  const QUOTE_UNDERLINE = "2px solid rgba(250, 204, 21, 0.9)";
7
- const BADGE_SIZE_PX = 20;
7
+ const BADGE_SIZE_PX = 32;
8
8
  const BADGE_HIT_TARGET_PX = 44;
9
+ const BADGE_HIT_TARGET_WIDTH_PX = 64;
9
10
  const COMPACT_GUTTER_MAX_WIDTH_PX = 600;
10
11
  const RERESOLVE_DEBOUNCE_MS = 250;
11
12
  const SELECTION_PROMPT_DEBOUNCE_MS = 150;
@@ -286,16 +287,17 @@ function createCommentsOverlay(options) {
286
287
  const paintBadges = () => {
287
288
  const isCompact = window.innerWidth <= COMPACT_GUTTER_MAX_WIDTH_PX;
288
289
  const size = BADGE_HIT_TARGET_PX;
289
- const maxLeft = Math.max(0, window.innerWidth - size);
290
+ const width = BADGE_HIT_TARGET_WIDTH_PX;
291
+ const maxLeft = Math.max(0, window.innerWidth - width);
290
292
  const maxTop = Math.max(0, window.innerHeight - size);
291
293
  const placed = [];
292
294
  const place = (rect) => {
293
- const baseLeft = isCompact ? maxLeft : Math.max(0, Math.min(maxLeft, rect.right - size / 2));
295
+ const baseLeft = isCompact ? maxLeft : Math.max(0, Math.min(maxLeft, rect.right - width / 2));
294
296
  const baseTop = Math.max(0, Math.min(maxTop, rect.top - size / 2));
295
- const columns = Math.ceil(maxLeft / size);
297
+ const columns = Math.ceil(maxLeft / width);
296
298
  const rows = Math.ceil(maxTop / size);
297
299
  for (let column = 0; column <= columns * 2; column++) {
298
- const left = baseLeft + (column % 2 ? 1 : -1) * Math.ceil(column / 2) * size;
300
+ const left = baseLeft + (column % 2 ? 1 : -1) * Math.ceil(column / 2) * width;
299
301
  if (left < 0 || left > maxLeft) {
300
302
  continue;
301
303
  }
@@ -305,7 +307,7 @@ function createCommentsOverlay(options) {
305
307
  continue;
306
308
  }
307
309
  const collides = placed.some((slot) => {
308
- return Math.abs(slot.left - left) < size && Math.abs(slot.top - top) < size;
310
+ return Math.abs(slot.left - left) < width && Math.abs(slot.top - top) < size;
309
311
  });
310
312
  if (!collides) {
311
313
  placed.push({ left, top });
@@ -340,7 +342,7 @@ function createCommentsOverlay(options) {
340
342
  "aria-label",
341
343
  pin.count === 1 ? "Open comment" : `Open ${pin.count} comments`
342
344
  );
343
- badge.style.cssText = `position:absolute;pointer-events:auto;display:flex;align-items:center;justify-content:center;width:${size}px;height:${size}px;padding:0;margin:0;border:0;background:transparent;cursor:pointer`;
345
+ badge.style.cssText = `position:absolute;pointer-events:auto;display:flex;align-items:center;justify-content:center;width:${width}px;height:${size}px;padding:0;margin:0;border:0;background:transparent;cursor:pointer;outline-offset:-2px`;
344
346
  if (isCompact) {
345
347
  badge.style.justifyContent = "flex-end";
346
348
  }
@@ -348,25 +350,21 @@ function createCommentsOverlay(options) {
348
350
  badge.style.top = `${position.top}px`;
349
351
  const isActive = isFocused || pin.threadId === hoveredBadgeThreadId;
350
352
  const dot = document.createElement("span");
351
- dot.style.cssText = `display:flex;align-items:center;justify-content:center;gap:3px;box-sizing:border-box;min-width:${BADGE_SIZE_PX}px;height:${BADGE_SIZE_PX}px;padding:0 ${pin.count === 1 ? 0 : 6}px;border-radius:${BADGE_SIZE_PX / 2}px;border:1px solid rgba(17,24,39,.14);background:#fff;color:#6b7280;box-shadow:0 1px 3px rgba(0,0,0,.18);font:600 11px/1 system-ui,-apple-system,sans-serif;font-variant-numeric:tabular-nums;white-space:nowrap`;
353
+ dot.style.cssText = `display:flex;align-items:center;justify-content:center;gap:6px;box-sizing:border-box;min-width:48px;height:${BADGE_SIZE_PX}px;padding:0 6px;border-radius:8px;border:1px solid rgba(0,0,0,.12);background:#ffeb80;color:#171717;box-shadow:0 1px 3px rgba(0,0,0,.12);font:600 14px/1 system-ui,-apple-system,sans-serif;font-variant-numeric:tabular-nums;white-space:nowrap`;
352
354
  if (isCompact) {
353
355
  dot.style.marginRight = "3px";
354
356
  }
355
357
  if (isActive) {
356
- dot.style.borderColor = "#f59e0b";
357
- dot.style.background = "#fef3c7";
358
- dot.style.color = "#b45309";
358
+ dot.style.borderColor = "rgba(0,0,0,.4)";
359
359
  }
360
360
  if (resolution.status === "ambiguous") {
361
361
  dot.style.borderStyle = "dashed";
362
362
  }
363
- const icon = createIcon("12", "M7.9 20A9 9 0 1 0 4 16.1L2 22Z");
363
+ const icon = createIcon("16", "M7.9 20A9 9 0 1 0 4 16.1L2 22Z");
364
364
  icon.setAttribute("stroke-linecap", "round");
365
365
  icon.setAttribute("stroke-linejoin", "round");
366
366
  dot.append(icon);
367
- if (pin.count > 1) {
368
- dot.append(pin.count > 99 ? "99+" : String(pin.count));
369
- }
367
+ dot.append(pin.count > 99 ? "99+" : String(pin.count));
370
368
  badge.append(dot);
371
369
  badge.addEventListener("click", (event) => {
372
370
  event.preventDefault();
package/next/config.js CHANGED
@@ -1,4 +1,6 @@
1
- import { existsSync } from "fs";
1
+ import { createHash } from "crypto";
2
+ import { existsSync, readFileSync } from "fs";
3
+ import { createRequire } from "module";
2
4
  import path from "path";
3
5
  const DEFAULT_PAGE_EXTENSIONS = ["tsx", "ts", "jsx", "js"];
4
6
  const DEVELOPMENT_ONLY_PAGE_EXTENSIONS = ["dev.jsx", "dev.tsx"];
@@ -6,6 +8,33 @@ const BUILD_ONLY_PAGE_EXTENSIONS = ["published.tsx"];
6
8
  const PUBLISH_TSCONFIG_FILENAME = "tsconfig.publish.json";
7
9
  const PLATFORM_DEVICE_SIZES = [640, 828, 1080, 1200, 1920, 2048, 3840];
8
10
  const PLATFORM_IMAGE_SIZES = [32, 48, 96, 128, 256, 384];
11
+ const VETTED_NEXT_POLYFILL_MODULE_SHA256 = "94c8008b70e41ac5b0360fd6f35ea7a59c20c6927aca7731ef8c6a3c26b9cddf";
12
+ function getPolyfillAlias() {
13
+ try {
14
+ const requireFromSite = createRequire(
15
+ path.join(process.cwd(), "package.json")
16
+ );
17
+ const source = readFileSync(
18
+ path.join(
19
+ path.dirname(requireFromSite.resolve("next/package.json")),
20
+ "dist/build/polyfills/polyfill-module.js"
21
+ )
22
+ );
23
+ requireFromSite.resolve("@replohq/sdk/next/polyfill-module");
24
+ if (createHash("sha256").update(source).digest("hex") === VETTED_NEXT_POLYFILL_MODULE_SHA256) {
25
+ return {
26
+ "../build/polyfills/polyfill-module": {
27
+ browser: "@replohq/sdk/next/polyfill-module"
28
+ }
29
+ };
30
+ }
31
+ } catch {
32
+ }
33
+ console.warn(
34
+ "[@replohq/sandbox-runtime] Skipped the Next.js polyfill alias, so Next's own polyfills ship. Either the installed @replohq/sdk has no next/polyfill-module (upgrade it), or next/dist/build/polyfills/polyfill-module.js is missing or differs from the vetted version (re-vet the polyfill list and update VETTED_NEXT_POLYFILL_MODULE_SHA256 in @replohq/sandbox-runtime/next/config)."
35
+ );
36
+ return {};
37
+ }
9
38
  function getPageExtensions(configuredExtensions) {
10
39
  const baseExtensions = (configuredExtensions ?? DEFAULT_PAGE_EXTENSIONS).filter((extension) => {
11
40
  return !DEVELOPMENT_ONLY_PAGE_EXTENSIONS.includes(extension) && !BUILD_ONLY_PAGE_EXTENSIONS.includes(extension);
@@ -24,6 +53,13 @@ function withComponentPreviewPageExtension(config) {
24
53
  ...config,
25
54
  pageExtensions: getPageExtensions(config.pageExtensions),
26
55
  typescript: getTypescriptConfig(config.typescript),
56
+ turbopack: {
57
+ ...config.turbopack,
58
+ resolveAlias: {
59
+ ...getPolyfillAlias(),
60
+ ...config.turbopack?.resolveAlias
61
+ }
62
+ },
27
63
  images: {
28
64
  ...config.images,
29
65
  deviceSizes: config.images?.deviceSizes ?? PLATFORM_DEVICE_SIZES,
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@replohq/sandbox-runtime",
3
- "version": "1.21.0",
3
+ "version": "1.22.1",
4
4
  "reploBuild": {
5
5
  "packageName": "@replohq/sandbox-runtime",
6
- "version": "1.21.0",
6
+ "version": "1.22.1",
7
7
  "branch": "HEAD",
8
- "commit": "d5ce2185ff844319f59248b9da6641bf96f4c0a2",
9
- "builtAt": "2026-10-29T04:07:57.675Z"
8
+ "commit": "073dd1a46fae9bca92aae68286e667ef84854658",
9
+ "builtAt": "2026-10-30T20:41:52.402Z"
10
10
  },
11
11
  "description": "Replo sandbox runtime — editor integration for agent-built Next.js sites.",
12
12
  "license": "SEE LICENSE IN LICENSE",