@replohq/sandbox-runtime 1.10.0 → 1.10.2

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.
@@ -94,6 +94,7 @@ export type SelectedElement = {
94
94
  tagName: string;
95
95
  elementType: string;
96
96
  textContent: string | null;
97
+ sectionLabel?: string;
97
98
  rect: SelectModeBoundingRect;
98
99
  textMetrics: SelectModeTextMetrics | null;
99
100
  outerHTML: string;
@@ -145,6 +145,7 @@ export declare const selectedElementSchema: z.ZodObject<{
145
145
  tagName: z.ZodString;
146
146
  elementType: z.ZodString;
147
147
  textContent: z.ZodNullable<z.ZodString>;
148
+ sectionLabel: z.ZodOptional<z.ZodString>;
148
149
  rect: z.ZodObject<{
149
150
  x: z.ZodNumber;
150
151
  y: z.ZodNumber;
@@ -246,6 +247,7 @@ export declare const selectableDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
246
247
  tagName: z.ZodString;
247
248
  elementType: z.ZodString;
248
249
  textContent: z.ZodNullable<z.ZodString>;
250
+ sectionLabel: z.ZodOptional<z.ZodString>;
249
251
  rect: z.ZodObject<{
250
252
  x: z.ZodNumber;
251
253
  y: z.ZodNumber;
@@ -442,6 +444,7 @@ export declare const selectModeSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodOb
442
444
  tagName: z.ZodString;
443
445
  elementType: z.ZodString;
444
446
  textContent: z.ZodNullable<z.ZodString>;
447
+ sectionLabel: z.ZodOptional<z.ZodString>;
445
448
  rect: z.ZodObject<{
446
449
  x: z.ZodNumber;
447
450
  y: z.ZodNumber;
@@ -544,6 +547,7 @@ export declare const selectModeSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodOb
544
547
  tagName: z.ZodString;
545
548
  elementType: z.ZodString;
546
549
  textContent: z.ZodNullable<z.ZodString>;
550
+ sectionLabel: z.ZodOptional<z.ZodString>;
547
551
  rect: z.ZodObject<{
548
552
  x: z.ZodNumber;
549
553
  y: z.ZodNumber;
@@ -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, selectableDataPayloadSchema, selectableDataSchema, selectablePlanDataSchema, selectablePlanPayloadSchema, selectedElementSchema, transformPoint, transformRect, transformSelectableData, transformSelectedElement } from '../../chunk-PJBGUXBG.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, selectableDataPayloadSchema, selectableDataSchema, selectablePlanDataSchema, selectablePlanPayloadSchema, selectedElementSchema, transformPoint, transformRect, transformSelectableData, transformSelectedElement } from '../../chunk-NBVMONRN.mjs';
2
2
  import '../../chunk-JUKCUPQ6.mjs';
3
3
  import '../../chunk-FLYEIRFK.mjs';
4
4
  import '../../chunk-TESFJQID.mjs';
@@ -60,6 +60,7 @@ export declare const selectModeEventInputSchemas: {
60
60
  tagName: z.ZodString;
61
61
  elementType: z.ZodString;
62
62
  textContent: z.ZodNullable<z.ZodString>;
63
+ sectionLabel: z.ZodOptional<z.ZodString>;
63
64
  rect: z.ZodObject<{
64
65
  x: z.ZodNumber;
65
66
  y: z.ZodNumber;
@@ -201,6 +202,7 @@ export declare const websiteBuilderToPreviewIframeMethodConfig: {
201
202
  tagName: z.ZodString;
202
203
  elementType: z.ZodString;
203
204
  textContent: z.ZodNullable<z.ZodString>;
205
+ sectionLabel: z.ZodOptional<z.ZodString>;
204
206
  rect: z.ZodObject<{
205
207
  x: z.ZodNumber;
206
208
  y: z.ZodNumber;
@@ -277,6 +279,7 @@ export declare const websiteBuilderToPreviewIframeMethodConfig: {
277
279
  tagName: z.ZodString;
278
280
  elementType: z.ZodString;
279
281
  textContent: z.ZodNullable<z.ZodString>;
282
+ sectionLabel: z.ZodOptional<z.ZodString>;
280
283
  rect: z.ZodObject<{
281
284
  x: z.ZodNumber;
282
285
  y: z.ZodNumber;
@@ -472,6 +475,7 @@ export declare const previewIframeToWebsiteBuilderMethodConfig: {
472
475
  tagName: z.ZodString;
473
476
  elementType: z.ZodString;
474
477
  textContent: z.ZodNullable<z.ZodString>;
478
+ sectionLabel: z.ZodOptional<z.ZodString>;
475
479
  rect: z.ZodObject<{
476
480
  x: z.ZodNumber;
477
481
  y: z.ZodNumber;
@@ -566,6 +570,7 @@ export declare const previewIframeToWebsiteBuilderMethodConfig: {
566
570
  tagName: z.ZodString;
567
571
  elementType: z.ZodString;
568
572
  textContent: z.ZodNullable<z.ZodString>;
573
+ sectionLabel: z.ZodOptional<z.ZodString>;
569
574
  rect: z.ZodObject<{
570
575
  x: z.ZodNumber;
571
576
  y: z.ZodNumber;
@@ -749,6 +754,7 @@ export declare const previewIframeToWebsiteBuilderMethodConfig: {
749
754
  tagName: z.ZodString;
750
755
  elementType: z.ZodString;
751
756
  textContent: z.ZodNullable<z.ZodString>;
757
+ sectionLabel: z.ZodOptional<z.ZodString>;
752
758
  rect: z.ZodObject<{
753
759
  x: z.ZodNumber;
754
760
  y: z.ZodNumber;
@@ -1009,6 +1015,7 @@ export declare const selectModeIframeMessageSchema: z.ZodDiscriminatedUnion<[z.Z
1009
1015
  tagName: z.ZodString;
1010
1016
  elementType: z.ZodString;
1011
1017
  textContent: z.ZodNullable<z.ZodString>;
1018
+ sectionLabel: z.ZodOptional<z.ZodString>;
1012
1019
  rect: z.ZodObject<{
1013
1020
  x: z.ZodNumber;
1014
1021
  y: z.ZodNumber;
@@ -1187,6 +1194,7 @@ export declare const selectModeIframeMessageSchema: z.ZodDiscriminatedUnion<[z.Z
1187
1194
  tagName: z.ZodString;
1188
1195
  elementType: z.ZodString;
1189
1196
  textContent: z.ZodNullable<z.ZodString>;
1197
+ sectionLabel: z.ZodOptional<z.ZodString>;
1190
1198
  rect: z.ZodObject<{
1191
1199
  x: z.ZodNumber;
1192
1200
  y: z.ZodNumber;
@@ -1,4 +1,4 @@
1
- import { selectModeBoundingRectSchema, selectModeTiptapActiveMarksSchema, selectModeSelectionRectSchema, selectableDataSchema, selectModeHoverRectSchema, selectModeFormatCommandSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionTypeSchema, displayModeSchema, selectModeClickPositionSchema, selectedElementSchema } from '../../chunk-PJBGUXBG.mjs';
1
+ import { selectModeBoundingRectSchema, selectModeTiptapActiveMarksSchema, selectModeSelectionRectSchema, selectableDataSchema, selectModeHoverRectSchema, selectModeFormatCommandSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionTypeSchema, displayModeSchema, selectModeClickPositionSchema, selectedElementSchema } from '../../chunk-NBVMONRN.mjs';
2
2
  import '../../chunk-JUKCUPQ6.mjs';
3
3
  import '../../chunk-FLYEIRFK.mjs';
4
4
  import '../../chunk-TESFJQID.mjs';
package/buildMetadata.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export const BUILD_METADATA = {
2
2
  "packageName": "@replohq/sandbox-runtime",
3
- "version": "1.10.0",
3
+ "version": "1.10.2",
4
4
  "branch": "HEAD",
5
- "commit": "604d707e41cac581b43e134371e5e9a0f78fa2b7",
6
- "builtAt": "2026-09-25T19:36:00.140Z"
5
+ "commit": "0253f4740d039112c72fe121bf18ea8b609af18b",
6
+ "builtAt": "2026-09-27T03:43:50.436Z"
7
7
  };
@@ -127,6 +127,7 @@ var selectedElementSchema = z.object({
127
127
  tagName: z.string(),
128
128
  elementType: z.string(),
129
129
  textContent: z.string().nullable(),
130
+ sectionLabel: z.string().optional(),
130
131
  rect: selectModeBoundingRectSchema,
131
132
  textMetrics: selectModeTextMetricsSchema.nullable(),
132
133
  outerHTML: z.string(),
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@replohq/sandbox-runtime",
3
- "version": "1.10.0",
3
+ "version": "1.10.2",
4
4
  "reploBuild": {
5
5
  "packageName": "@replohq/sandbox-runtime",
6
- "version": "1.10.0",
6
+ "version": "1.10.2",
7
7
  "branch": "HEAD",
8
- "commit": "604d707e41cac581b43e134371e5e9a0f78fa2b7",
9
- "builtAt": "2026-09-25T19:36:00.140Z"
8
+ "commit": "0253f4740d039112c72fe121bf18ea8b609af18b",
9
+ "builtAt": "2026-09-27T03:43:50.436Z"
10
10
  },
11
11
  "description": "Replo sandbox runtime — editor integration for agent-built Next.js sites.",
12
12
  "license": "SEE LICENSE IN LICENSE",
@@ -8,6 +8,43 @@ import { getImageDescriptor } from "../imageSources";
8
8
  import { skipInlineTextMarkElements } from "../inlineTextMarks";
9
9
  import { getElementBoundingRect } from "../interactions/selectionGeometry";
10
10
  import { getDefinedStyles, getInheritedStyles } from "./styleExtraction";
11
+ const SECTION_SELECTOR = 'section, article, aside, [role="region"]';
12
+ const SECTION_LABEL_LENGTH = 60;
13
+ function normalizeSectionLabel(value) {
14
+ return value?.replace(/\s+/g, " ").trim().slice(0, SECTION_LABEL_LENGTH) || void 0;
15
+ }
16
+ function findSectionLabel(section) {
17
+ if (!section) {
18
+ return void 0;
19
+ }
20
+ const ariaLabel = normalizeSectionLabel(section.getAttribute("aria-label"));
21
+ if (ariaLabel) {
22
+ return ariaLabel;
23
+ }
24
+ const labelledBy = section.getAttribute("aria-labelledby");
25
+ const labelledByText = normalizeSectionLabel(
26
+ labelledBy?.split(/\s+/).map((id) => section.ownerDocument.getElementById(id)?.textContent).filter(Boolean).join(" ")
27
+ );
28
+ if (labelledByText) {
29
+ return labelledByText;
30
+ }
31
+ const headings = Array.from(
32
+ section.querySelectorAll("h1, h2, h3, h4, h5, h6")
33
+ ).filter((candidate) => {
34
+ if (candidate.checkVisibility?.({ visibilityProperty: true }) === false) {
35
+ return false;
36
+ }
37
+ const semanticSection = candidate.closest(SECTION_SELECTOR);
38
+ return !semanticSection || semanticSection === section || !section.contains(semanticSection);
39
+ });
40
+ const highestHeadingLevel = Math.min(
41
+ ...headings.map((heading2) => Number(heading2.tagName[1]))
42
+ );
43
+ const [heading, competingHeading] = headings.filter(
44
+ (candidate) => Number(candidate.tagName[1]) === highestHeadingLevel
45
+ );
46
+ return competingHeading ? void 0 : normalizeSectionLabel(heading ? getRenderedText(heading) : void 0);
47
+ }
11
48
  function getNearestSelectableElement(element) {
12
49
  const host = skipInlineTextMarkElements(element);
13
50
  return host.closest(`[${SELECT_MODE_SELECTABLE_ATTRIBUTE}]`) ?? host;
@@ -184,12 +221,14 @@ function buildElementDescriptor({
184
221
  const fiberChain = element instanceof HTMLElement ? getFiberChain(element) : [];
185
222
  const sourceLocation = fiberChain[0]?.sourceLocation;
186
223
  const trimmedText = getRenderedText(element);
224
+ const sectionLabel = findSectionLabel(section);
187
225
  return {
188
226
  kind: "react-element",
189
227
  selector: buildSelector(element),
190
228
  tagName: element.tagName.toLowerCase(),
191
229
  elementType: identifyElement({ element, trimmedText }),
192
230
  textContent: trimmedText?.slice(0, 200) ?? null,
231
+ ...sectionLabel ? { sectionLabel } : {},
193
232
  rect: getElementBoundingRect(element),
194
233
  textMetrics,
195
234
  outerHTML: element.outerHTML.slice(0, 4e3),
@@ -4,6 +4,7 @@ import {
4
4
  getNearestSelectableElement
5
5
  } from "../descriptor/elementDescriptor";
6
6
  import { getWebsiteBuilderRpc } from "../iframeRpcChannel";
7
+ import { findContainingSection } from "../interactions/sectionGeometry";
7
8
  import {
8
9
  collectDragCandidates,
9
10
  getCandidatesInSelection,
@@ -242,6 +243,7 @@ function useSelectionInteractions() {
242
243
  element,
243
244
  data: buildElementDescriptor({
244
245
  element,
246
+ section: findContainingSection(element),
245
247
  clickPosition: getElementAnchor({
246
248
  element,
247
249
  selectionRect: anchorRect
@@ -19,6 +19,7 @@ export declare function getSelectModeIframeRpcChannel(): import("../_vendor/sche
19
19
  tagName: import("zod").ZodString;
20
20
  elementType: import("zod").ZodString;
21
21
  textContent: import("zod").ZodNullable<import("zod").ZodString>;
22
+ sectionLabel: import("zod").ZodOptional<import("zod").ZodString>;
22
23
  rect: import("zod").ZodObject<{
23
24
  x: import("zod").ZodNumber;
24
25
  y: import("zod").ZodNumber;
@@ -113,6 +114,7 @@ export declare function getSelectModeIframeRpcChannel(): import("../_vendor/sche
113
114
  tagName: import("zod").ZodString;
114
115
  elementType: import("zod").ZodString;
115
116
  textContent: import("zod").ZodNullable<import("zod").ZodString>;
117
+ sectionLabel: import("zod").ZodOptional<import("zod").ZodString>;
116
118
  rect: import("zod").ZodObject<{
117
119
  x: import("zod").ZodNumber;
118
120
  y: import("zod").ZodNumber;
@@ -296,6 +298,7 @@ export declare function getSelectModeIframeRpcChannel(): import("../_vendor/sche
296
298
  tagName: import("zod").ZodString;
297
299
  elementType: import("zod").ZodString;
298
300
  textContent: import("zod").ZodNullable<import("zod").ZodString>;
301
+ sectionLabel: import("zod").ZodOptional<import("zod").ZodString>;
299
302
  rect: import("zod").ZodObject<{
300
303
  x: import("zod").ZodNumber;
301
304
  y: import("zod").ZodNumber;
@@ -5,6 +5,7 @@ import type { SelectionFrameSpec } from "./selectionFrame";
5
5
  import type { SelectModeInteractionSession } from "./selectModeSession";
6
6
  import type { InlineTiptapEditor } from "./tiptapInlineEditor";
7
7
  export declare const EMPTY_ACTIVE_MARKS: SelectModeTiptapActiveMarks;
8
+ export declare const INLINE_EDIT_PREPARE_TIMEOUT_MS = 10000;
8
9
  type InlineEditDraft = {
9
10
  status: "pending";
10
11
  editId: string;
@@ -29,6 +29,7 @@ const EMPTY_ACTIVE_MARKS = {
29
29
  strike: false
30
30
  };
31
31
  const FOCUS_STEAL_GUARD_MS = 1500;
32
+ const INLINE_EDIT_PREPARE_TIMEOUT_MS = 1e4;
32
33
  function isPendingEdit({
33
34
  editId,
34
35
  request
@@ -579,7 +580,7 @@ const selectModeStore = createShallowStore(
579
580
  const editId = crypto.randomUUID();
580
581
  const timeout = window.setTimeout(
581
582
  () => finishPendingEdit({ editId, status: "failed" }),
582
- 5e3
583
+ INLINE_EDIT_PREPARE_TIMEOUT_MS
583
584
  );
584
585
  setInlineEditRequest({
585
586
  activeMarks: EMPTY_ACTIVE_MARKS,
@@ -693,6 +694,7 @@ const useInteractionSession = () => {
693
694
  };
694
695
  export {
695
696
  EMPTY_ACTIVE_MARKS,
697
+ INLINE_EDIT_PREPARE_TIMEOUT_MS,
696
698
  selectModeStore,
697
699
  useDisplayMode,
698
700
  useEditingElement,