@replohq/canopy-sdk 0.11.1 → 0.13.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 (63) hide show
  1. package/_vendor/replo-utils/lib/misc.d.ts +18 -1
  2. package/_vendor/replo-utils/lib/misc.mjs +1 -1
  3. package/_vendor/schemas/designLibrary.d.ts +4 -4
  4. package/_vendor/schemas/errors.mjs +1 -1
  5. package/_vendor/schemas/generated/selectMode.d.ts +102 -0
  6. package/_vendor/schemas/savedStyles.d.ts +2 -2
  7. package/_vendor/schemas/selectMode.d.ts +471 -0
  8. package/_vendor/schemas/selectMode.mjs +119 -3
  9. package/{chunk-RUJDCFMG.mjs → chunk-OCB5XQYL.mjs} +1 -1
  10. package/editor/LinkInterceptor.js +4 -0
  11. package/editor/LinkInterceptor.js.map +2 -2
  12. package/editor/select-mode/EditorSelection.js +74 -1
  13. package/editor/select-mode/EditorSelection.js.map +2 -2
  14. package/editor/select-mode/descriptor/elementDescriptor.d.ts +13 -2
  15. package/editor/select-mode/descriptor/elementDescriptor.js +19 -31
  16. package/editor/select-mode/descriptor/elementDescriptor.js.map +2 -2
  17. package/editor/select-mode/descriptor/styleExtraction.d.ts +3 -0
  18. package/editor/select-mode/descriptor/styleExtraction.js +271 -0
  19. package/editor/select-mode/descriptor/styleExtraction.js.map +7 -0
  20. package/editor/select-mode/displayModeStore.d.ts +10 -0
  21. package/editor/select-mode/displayModeStore.js +47 -0
  22. package/editor/select-mode/displayModeStore.js.map +7 -0
  23. package/editor/select-mode/fast-refresh-relay.d.ts +3 -0
  24. package/editor/select-mode/fast-refresh-relay.js +35 -0
  25. package/editor/select-mode/fast-refresh-relay.js.map +7 -0
  26. package/editor/select-mode/fiber.d.ts +17 -0
  27. package/editor/select-mode/fiber.js +103 -34
  28. package/editor/select-mode/fiber.js.map +2 -2
  29. package/editor/select-mode/hooks/useEditModeStateMachine.d.ts +20 -0
  30. package/editor/select-mode/hooks/useEditModeStateMachine.js +226 -0
  31. package/editor/select-mode/hooks/useEditModeStateMachine.js.map +7 -0
  32. package/editor/select-mode/hooks/useOptimisticOverrides.d.ts +20 -0
  33. package/editor/select-mode/hooks/useOptimisticOverrides.js +284 -0
  34. package/editor/select-mode/hooks/useOptimisticOverrides.js.map +7 -0
  35. package/editor/select-mode/hooks/useParentMessaging.d.ts +17 -2
  36. package/editor/select-mode/hooks/useParentMessaging.js +66 -1
  37. package/editor/select-mode/hooks/useParentMessaging.js.map +2 -2
  38. package/editor/select-mode/hooks/useSelectModeController.js +5 -6
  39. package/editor/select-mode/hooks/useSelectModeController.js.map +2 -2
  40. package/editor/select-mode/hooks/useSelectionHover.js +16 -1
  41. package/editor/select-mode/hooks/useSelectionHover.js.map +2 -2
  42. package/editor/select-mode/hooks/useSelectionInteractions.d.ts +7 -2
  43. package/editor/select-mode/hooks/useSelectionInteractions.js +57 -18
  44. package/editor/select-mode/hooks/useSelectionInteractions.js.map +2 -2
  45. package/editor/select-mode/hooks/useSiblingResolution.d.ts +6 -0
  46. package/editor/select-mode/hooks/useSiblingResolution.js +59 -0
  47. package/editor/select-mode/hooks/useSiblingResolution.js.map +7 -0
  48. package/editor/select-mode/inlineTextMarks.d.ts +6 -0
  49. package/editor/select-mode/inlineTextMarks.js +25 -0
  50. package/editor/select-mode/inlineTextMarks.js.map +7 -0
  51. package/editor/select-mode/interactions/selectionGeometry.js +4 -0
  52. package/editor/select-mode/interactions/selectionGeometry.js.map +2 -2
  53. package/editor/select-mode/selectionFrame.d.ts +5 -0
  54. package/editor/select-mode/selectionFrame.js +25 -1
  55. package/editor/select-mode/selectionFrame.js.map +2 -2
  56. package/editor/select-mode/symbolicate.js +32 -10
  57. package/editor/select-mode/symbolicate.js.map +2 -2
  58. package/editor/select-mode/tiptapInlineEditor.d.ts +23 -0
  59. package/editor/select-mode/tiptapInlineEditor.js +120 -0
  60. package/editor/select-mode/tiptapInlineEditor.js.map +7 -0
  61. package/next/config.js +11 -9
  62. package/next/config.js.map +2 -2
  63. package/package.json +9 -1
@@ -144,20 +144,42 @@ function applyResolved({
144
144
  };
145
145
  }
146
146
  async function symbolicateSelectedElement(selectedElement) {
147
- const sourceLocation = selectedElement.sourceLocation;
148
- if (!sourceLocation || !isLikelyCompiledLocation(sourceLocation)) {
147
+ const targets = [];
148
+ const fiberChain = selectedElement.fiberChain.map((entry) => ({ ...entry }));
149
+ for (const entry of fiberChain) {
150
+ if (isLikelyCompiledLocation(entry.sourceLocation)) {
151
+ targets.push({
152
+ location: entry.sourceLocation,
153
+ apply: (next) => {
154
+ entry.sourceLocation = next;
155
+ }
156
+ });
157
+ }
158
+ }
159
+ let sourceLocation = selectedElement.sourceLocation;
160
+ if (sourceLocation && isLikelyCompiledLocation(sourceLocation)) {
161
+ const captured = sourceLocation;
162
+ targets.push({
163
+ location: captured,
164
+ apply: (next) => {
165
+ sourceLocation = next;
166
+ }
167
+ });
168
+ }
169
+ if (targets.length === 0) {
149
170
  return selectedElement;
150
171
  }
151
- const resolved = await symbolicateFrames([toNextStackFrame(sourceLocation)]);
152
- const frame = extractResolvedFrame(resolved[0] ?? null);
153
- const nextLocation = applyResolved({ original: sourceLocation, frame });
154
- console.log("[selectMode] symbolicate: resolved", {
155
- before: sourceLocation.filePath,
156
- after: nextLocation.filePath
157
- });
172
+ const resolved = await symbolicateFrames(
173
+ targets.map((target) => toNextStackFrame(target.location))
174
+ );
175
+ for (const [index, target] of targets.entries()) {
176
+ const frame = extractResolvedFrame(resolved[index] ?? null);
177
+ target.apply(applyResolved({ original: target.location, frame }));
178
+ }
158
179
  return {
159
180
  ...selectedElement,
160
- sourceLocation: nextLocation
181
+ sourceLocation,
182
+ fiberChain
161
183
  };
162
184
  }
163
185
  async function symbolicateSelectedElements(elements) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../editor/select-mode/symbolicate.ts"],
4
- "sourcesContent": ["import type {\n SelectedElement,\n SelectModeSourceLocation,\n} from \"schemas/generated/selectMode\";\n\n/**\n * Runtime source-attribution for React 19 + Next.js Turbopack.\n *\n * React 19 removed `fiber._debugSource`; the only per-element source pointer\n * left is `fiber._debugStack`, whose `.stack` references compiled SSR/client\n * chunks. We POST those compiled frames to Next.js's dev-only\n * `/__nextjs_original-stack-frames` endpoint, which symbolicates them through\n * Turbopack's in-memory source maps \u2014 the same mechanism the Next error\n * overlay uses (see `next/dist/server/dev/middleware-turbopack.js`).\n */\n\ntype NextStackFrame = {\n file: string | null;\n methodName: string | null;\n arguments: string[];\n // Next.js's `/__nextjs_original-stack-frames` reads these as `line1`/`column1`\n // (1-based) in the request body \u2014 same field names it uses in the response.\n // Sending `lineNumber`/`column` is silently dropped on the server side.\n line1: number | null;\n column1: number | null;\n};\n\ntype ResolvedFrame = {\n file: string | null;\n line1?: number | null;\n column1?: number | null;\n methodName?: string | null;\n ignored?: boolean;\n arguments?: string[];\n};\n\ntype OriginalStackFrameResponse = {\n originalStackFrame: ResolvedFrame | null;\n originalCodeFrame: string | null;\n};\n\ntype SettledResponseEntry =\n | { status: \"fulfilled\"; value: OriginalStackFrameResponse }\n | { status: \"rejected\"; reason: string };\n\nconst SYMBOLICATE_ENDPOINT = \"/__nextjs_original-stack-frames\";\n\nfunction isLikelyCompiledLocation(\n location: SelectModeSourceLocation | undefined,\n): boolean {\n if (!location) {\n return false;\n }\n const filePath = location.filePath;\n return (\n filePath.includes(\".next\") ||\n filePath.includes(\"/chunks/\") ||\n filePath.includes(\"webpack-internal:\") ||\n filePath.includes(\"turbopack:\") ||\n filePath.endsWith(\".js\") ||\n filePath.startsWith(\"about:\")\n );\n}\n\n// React 19 fibers for server-rendered (RSC) elements carry a `_debugStack`\n// whose top frame points at an SSR chunk. The endpoint resolves those\n// against the server bundler context; client chunks go through the client\n// bundler context. Mis-routing returns the compiled chunk unchanged.\nfunction isServerChunk(filePath: string): boolean {\n return (\n filePath.startsWith(\"about://React/Server\") ||\n filePath.includes(\"/server/chunks/\") ||\n filePath.includes(\".next-dev/dev/server/\") ||\n filePath.includes(\".next/server/\")\n );\n}\n\n// Matches the `/_next/static/...` tail of a browser chunk URL's pathname.\n// Capture group 1 is the `/static/...` segment that lives under the dist dir\n// on disk. Mirrors `regexNextStatic` in\n// `next/dist/server/lib/parse-stack.js`.\nconst NEXT_STATIC_PATH_PATTERN = /\\/_next(\\/static\\/.+)/;\n\n// Absolute path to the dev dist dir (e.g.\n// `/workspace/dev/website/.next-dev/dev`). Next.js define-injects this into\n// dev client bundles (see the `__NEXT_DIST_DIR` define in\n// `next/dist/build/define-env.ts`); because canopy-sdk is transpiled into the\n// host Next app, the replacement reaches this reference too. Outside a Next\n// dev client build the value is absent, so we bail and leave the URL as-is.\nfunction getNextDistDir(): string | null {\n try {\n const distDir = process.env.__NEXT_DIST_DIR;\n return typeof distDir === \"string\" && distDir.length > 0 ? distDir : null;\n } catch {\n return null;\n }\n}\n\n// Turbopack's `/__nextjs_original-stack-frames` backend only resolves source\n// maps for `file://` (or bare filesystem) paths \u2014 it rejects browser chunk\n// URLs (`https://host/_next/static/chunks/X.js`) with \"Unknown url scheme\",\n// which is why client-component frames never symbolicated in the sandbox\n// (everything is served over https) even though it worked for RSC frames that\n// already carry filesystem paths. Rewrite the URL to the on-disk dist path the\n// same way Next's own server-side stack parser does, so the endpoint can map\n// it back to the user's `.tsx`.\nfunction rewriteBrowserChunkUrlToDistPath(filePath: string): string {\n if (!/^https?:\\/\\//.test(filePath)) {\n return filePath;\n }\n const distDir = getNextDistDir();\n if (!distDir) {\n return filePath;\n }\n let url: URL;\n try {\n url = new URL(filePath);\n } catch {\n return filePath;\n }\n const staticPathMatch = NEXT_STATIC_PATH_PATTERN.exec(url.pathname);\n if (!staticPathMatch?.[1]) {\n return filePath;\n }\n const normalizedDistDir = distDir.replace(/\\\\/g, \"/\").replace(/\\/$/, \"\");\n return `file://${normalizedDistDir}${staticPathMatch[1]}${url.search}`;\n}\n\n// React 19's `_debugStack.stack` for RSC components wraps the SSR chunk URL\n// in an `about://React/Server/` prefix and appends a `?<digits>` cache-buster.\n// Turbopack's source-map lookup matches against the bare chunk URL; with\n// either decoration in place it returns the compiled chunk unchanged. Client\n// components instead carry a plain browser chunk URL, which Turbopack rejects\n// outright unless rewritten to its on-disk `file://` path.\nfunction normalizeFilePathForSymbolicator(filePath: string): string {\n let normalized = filePath;\n if (normalized.startsWith(\"about://React/Server/\")) {\n normalized = normalized.slice(\"about://React/Server/\".length);\n }\n normalized = normalized.replace(/\\?\\d+$/, \"\");\n return rewriteBrowserChunkUrlToDistPath(normalized);\n}\n\nfunction toNextStackFrame(location: SelectModeSourceLocation): NextStackFrame {\n return {\n file: normalizeFilePathForSymbolicator(location.filePath),\n methodName: location.componentName ?? null,\n arguments: [],\n line1: location.lineNumber,\n column1: location.columnNumber ?? null,\n };\n}\n\nfunction extractResolvedFrame(\n entry: SettledResponseEntry | null,\n): ResolvedFrame | null {\n if (!entry || entry.status !== \"fulfilled\") {\n return null;\n }\n return entry.value?.originalStackFrame ?? null;\n}\n\nasync function postFrames({\n frames,\n isServer,\n}: {\n frames: NextStackFrame[];\n isServer: boolean;\n}): Promise<(SettledResponseEntry | null)[]> {\n if (frames.length === 0) {\n return [];\n }\n try {\n const response = await fetch(SYMBOLICATE_ENDPOINT, {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({\n frames,\n isServer,\n isEdgeServer: false,\n isAppDirectory: true,\n }),\n });\n if (!response.ok) {\n console.log(\"[selectMode] symbolicate: endpoint returned non-OK status\", {\n status: response.status,\n isServer,\n });\n return frames.map(() => null);\n }\n const parsed: unknown = await response.json();\n if (Array.isArray(parsed)) {\n // Promise.allSettled-shaped entries; see\n // node_modules/next/dist/server/dev/middleware-turbopack.js.\n // Legacy cast - the runtime shape isn't exported as a type.\n // eslint-disable-next-line replo/no-as-cast\n return parsed as (SettledResponseEntry | null)[];\n }\n return frames.map(() => null);\n } catch (error) {\n console.log(\"[selectMode] symbolicate: fetch failed\", {\n isServer,\n error,\n });\n return frames.map(() => null);\n }\n}\n\nasync function symbolicateFrames(\n frames: NextStackFrame[],\n): Promise<(SettledResponseEntry | null)[]> {\n const serverIndices: number[] = [];\n const clientIndices: number[] = [];\n for (const [index, frame] of frames.entries()) {\n if (frame.file && isServerChunk(frame.file)) {\n serverIndices.push(index);\n } else {\n clientIndices.push(index);\n }\n }\n\n const [serverResults, clientResults] = await Promise.all([\n postFrames({\n frames: serverIndices.map((index) => frames[index]!),\n isServer: true,\n }),\n postFrames({\n frames: clientIndices.map((index) => frames[index]!),\n isServer: false,\n }),\n ]);\n\n const merged: (SettledResponseEntry | null)[] = frames.map(() => null);\n for (const [position, index] of serverIndices.entries()) {\n merged[index] = serverResults[position] ?? null;\n }\n for (const [position, index] of clientIndices.entries()) {\n merged[index] = clientResults[position] ?? null;\n }\n return merged;\n}\n\nfunction applyResolved({\n original,\n frame,\n}: {\n original: SelectModeSourceLocation;\n frame: ResolvedFrame | null;\n}): SelectModeSourceLocation {\n if (!frame || !frame.file || frame.line1 == null) {\n return original;\n }\n return {\n filePath: frame.file,\n lineNumber: frame.line1,\n columnNumber: frame.column1 ?? undefined,\n componentName: original.componentName,\n };\n}\n\nexport async function symbolicateSelectedElement(\n selectedElement: SelectedElement,\n): Promise<SelectedElement> {\n const sourceLocation = selectedElement.sourceLocation;\n if (!sourceLocation || !isLikelyCompiledLocation(sourceLocation)) {\n return selectedElement;\n }\n\n const resolved = await symbolicateFrames([toNextStackFrame(sourceLocation)]);\n const frame = extractResolvedFrame(resolved[0] ?? null);\n const nextLocation = applyResolved({ original: sourceLocation, frame });\n\n console.log(\"[selectMode] symbolicate: resolved\", {\n before: sourceLocation.filePath,\n after: nextLocation.filePath,\n });\n\n return {\n ...selectedElement,\n sourceLocation: nextLocation,\n };\n}\n\nexport async function symbolicateSelectedElements(\n elements: SelectedElement[],\n): Promise<SelectedElement[]> {\n return Promise.all(elements.map(symbolicateSelectedElement));\n}\n"],
5
- "mappings": "AA6CA,MAAM,uBAAuB;AAE7B,SAAS,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M,kBAAkB,CAAC,iBAAiB,cAAc,CAAC,CAAC;AAC3E,QAAM,QAAQ,qBAAqB,SAAS,CAAC,KAAK,IAAI;AACtD,QAAM,eAAe,cAAc,EAAE,UAAU,gBAAgB,MAAM,CAAC;AAEtE,UAAQ,IAAI,sCAAsC;AAAA,IAChD,QAAQ,eAAe;AAAA,IACvB,OAAO,aAAa;AAAA,EACtB,CAAC;AAED,SAAO;AAAA,IACL,GAAG;AAAA,IACH,gBAAgB;AAAA,EAClB;AACF;AAEA,eAAsB,4BACpB,UAC4B;AAC5B,SAAO,QAAQ,IAAI,SAAS,IAAI,0BAA0B,CAAC;AAC7D;",
4
+ "sourcesContent": ["import type {\n SelectedElement,\n SelectModeFiberChainEntry,\n SelectModeSourceLocation,\n} from \"schemas/generated/selectMode\";\n\n/**\n * Runtime source-attribution for React 19 + Next.js Turbopack.\n *\n * React 19 removed `fiber._debugSource`; the only per-element source pointer\n * left is `fiber._debugStack`, whose `.stack` references compiled SSR/client\n * chunks. We POST those compiled frames to Next.js's dev-only\n * `/__nextjs_original-stack-frames` endpoint, which symbolicates them through\n * Turbopack's in-memory source maps \u2014 the same mechanism the Next error\n * overlay uses (see `next/dist/server/dev/middleware-turbopack.js`).\n */\n\ntype NextStackFrame = {\n file: string | null;\n methodName: string | null;\n arguments: string[];\n // Next.js's `/__nextjs_original-stack-frames` reads these as `line1`/`column1`\n // (1-based) in the request body \u2014 same field names it uses in the response.\n // Sending `lineNumber`/`column` is silently dropped on the server side.\n line1: number | null;\n column1: number | null;\n};\n\ntype ResolvedFrame = {\n file: string | null;\n line1?: number | null;\n column1?: number | null;\n methodName?: string | null;\n ignored?: boolean;\n arguments?: string[];\n};\n\ntype OriginalStackFrameResponse = {\n originalStackFrame: ResolvedFrame | null;\n originalCodeFrame: string | null;\n};\n\ntype SettledResponseEntry =\n | { status: \"fulfilled\"; value: OriginalStackFrameResponse }\n | { status: \"rejected\"; reason: string };\n\nconst SYMBOLICATE_ENDPOINT = \"/__nextjs_original-stack-frames\";\n\nfunction isLikelyCompiledLocation(\n location: SelectModeSourceLocation | undefined,\n): boolean {\n if (!location) {\n return false;\n }\n const filePath = location.filePath;\n return (\n filePath.includes(\".next\") ||\n filePath.includes(\"/chunks/\") ||\n filePath.includes(\"webpack-internal:\") ||\n filePath.includes(\"turbopack:\") ||\n filePath.endsWith(\".js\") ||\n filePath.startsWith(\"about:\")\n );\n}\n\n// React 19 fibers for server-rendered (RSC) elements carry a `_debugStack`\n// whose top frame points at an SSR chunk (e.g. `about://React/Server/file://\n// .../.next-dev/.../server/chunks/ssr/*.js`). The endpoint resolves those\n// against the server bundler context; client chunks go through the client\n// bundler context. Mis-routing returns the compiled chunk unchanged.\nfunction isServerChunk(filePath: string): boolean {\n return (\n filePath.startsWith(\"about://React/Server\") ||\n filePath.includes(\"/server/chunks/\") ||\n filePath.includes(\".next-dev/dev/server/\") ||\n filePath.includes(\".next/server/\")\n );\n}\n\n// Matches the `/_next/static/...` tail of a browser chunk URL's pathname.\n// Capture group 1 is the `/static/...` segment that lives under the dist dir\n// on disk. Mirrors `regexNextStatic` in\n// `next/dist/server/lib/parse-stack.js`.\nconst NEXT_STATIC_PATH_PATTERN = /\\/_next(\\/static\\/.+)/;\n\n// Absolute path to the dev dist dir (e.g.\n// `/workspace/dev/website/.next-dev/dev`). Next.js define-injects this into\n// dev client bundles (see the `__NEXT_DIST_DIR` define in\n// `next/dist/build/define-env.ts`); because canopy-sdk is transpiled into the\n// host Next app, the replacement reaches this reference too. Outside a Next\n// dev client build the value is absent, so we bail and leave the URL as-is.\nfunction getNextDistDir(): string | null {\n try {\n const distDir = process.env.__NEXT_DIST_DIR;\n return typeof distDir === \"string\" && distDir.length > 0 ? distDir : null;\n } catch {\n return null;\n }\n}\n\n// Turbopack's `/__nextjs_original-stack-frames` backend only resolves source\n// maps for `file://` (or bare filesystem) paths \u2014 it rejects browser chunk\n// URLs (`https://host/_next/static/chunks/X.js`) with \"Unknown url scheme\",\n// which is why client-component frames never symbolicated in the sandbox\n// (everything is served over https) even though it worked for RSC frames that\n// already carry filesystem paths. Rewrite the URL to the on-disk dist path the\n// same way Next's own server-side stack parser does, so the endpoint can map\n// it back to the user's `.tsx`.\nfunction rewriteBrowserChunkUrlToDistPath(filePath: string): string {\n if (!/^https?:\\/\\//.test(filePath)) {\n return filePath;\n }\n const distDir = getNextDistDir();\n if (!distDir) {\n return filePath;\n }\n let url: URL;\n try {\n url = new URL(filePath);\n } catch {\n return filePath;\n }\n const staticPathMatch = NEXT_STATIC_PATH_PATTERN.exec(url.pathname);\n if (!staticPathMatch?.[1]) {\n return filePath;\n }\n const normalizedDistDir = distDir.replace(/\\\\/g, \"/\").replace(/\\/$/, \"\");\n return `file://${normalizedDistDir}${staticPathMatch[1]}${url.search}`;\n}\n\n// React 19's `_debugStack.stack` for RSC components wraps the SSR chunk URL\n// in an `about://React/Server/` prefix and appends a `?<digits>` cache-buster\n// (e.g. `about://React/Server/file:///.../[root-of-the-server]__abc._.js?21`).\n// Turbopack's source-map lookup matches against the bare chunk URL; with\n// either decoration in place it returns the compiled chunk unchanged. Client\n// components instead carry a plain browser chunk URL, which Turbopack rejects\n// outright unless rewritten to its on-disk `file://` path.\nfunction normalizeFilePathForSymbolicator(filePath: string): string {\n let normalized = filePath;\n if (normalized.startsWith(\"about://React/Server/\")) {\n normalized = normalized.slice(\"about://React/Server/\".length);\n }\n normalized = normalized.replace(/\\?\\d+$/, \"\");\n return rewriteBrowserChunkUrlToDistPath(normalized);\n}\n\nfunction toNextStackFrame(location: SelectModeSourceLocation): NextStackFrame {\n return {\n file: normalizeFilePathForSymbolicator(location.filePath),\n methodName: location.componentName ?? null,\n arguments: [],\n line1: location.lineNumber,\n column1: location.columnNumber ?? null,\n };\n}\n\nfunction extractResolvedFrame(\n entry: SettledResponseEntry | null,\n): ResolvedFrame | null {\n if (!entry || entry.status !== \"fulfilled\") {\n return null;\n }\n return entry.value?.originalStackFrame ?? null;\n}\n\nasync function postFrames({\n frames,\n isServer,\n}: {\n frames: NextStackFrame[];\n isServer: boolean;\n}): Promise<(SettledResponseEntry | null)[]> {\n if (frames.length === 0) {\n return [];\n }\n try {\n const response = await fetch(SYMBOLICATE_ENDPOINT, {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({\n frames,\n isServer,\n isEdgeServer: false,\n isAppDirectory: true,\n }),\n });\n if (!response.ok) {\n console.log(\"[selectMode] symbolicate: endpoint returned non-OK status\", {\n status: response.status,\n isServer,\n });\n return frames.map(() => null);\n }\n const parsed: unknown = await response.json();\n if (Array.isArray(parsed)) {\n // Promise.allSettled-shaped entries; see\n // node_modules/next/dist/server/dev/middleware-turbopack.js.\n // Legacy cast - the runtime shape isn't exported as a type.\n // eslint-disable-next-line replo/no-as-cast\n return parsed as (SettledResponseEntry | null)[];\n }\n return frames.map(() => null);\n } catch (error) {\n console.log(\"[selectMode] symbolicate: fetch failed\", {\n isServer,\n error,\n });\n return frames.map(() => null);\n }\n}\n\nasync function symbolicateFrames(\n frames: NextStackFrame[],\n): Promise<(SettledResponseEntry | null)[]> {\n const serverIndices: number[] = [];\n const clientIndices: number[] = [];\n for (const [index, frame] of frames.entries()) {\n if (frame.file && isServerChunk(frame.file)) {\n serverIndices.push(index);\n } else {\n clientIndices.push(index);\n }\n }\n\n const [serverResults, clientResults] = await Promise.all([\n postFrames({\n frames: serverIndices.map((index) => frames[index]!),\n isServer: true,\n }),\n postFrames({\n frames: clientIndices.map((index) => frames[index]!),\n isServer: false,\n }),\n ]);\n\n const merged: (SettledResponseEntry | null)[] = frames.map(() => null);\n for (const [position, index] of serverIndices.entries()) {\n merged[index] = serverResults[position] ?? null;\n }\n for (const [position, index] of clientIndices.entries()) {\n merged[index] = clientResults[position] ?? null;\n }\n return merged;\n}\n\nfunction applyResolved({\n original,\n frame,\n}: {\n original: SelectModeSourceLocation;\n frame: ResolvedFrame | null;\n}): SelectModeSourceLocation {\n if (!frame || !frame.file || frame.line1 == null) {\n return original;\n }\n return {\n filePath: frame.file,\n lineNumber: frame.line1,\n columnNumber: frame.column1 ?? undefined,\n componentName: original.componentName,\n };\n}\n\nexport async function symbolicateSelectedElement(\n selectedElement: SelectedElement,\n): Promise<SelectedElement> {\n const targets: {\n location: SelectModeSourceLocation;\n apply: (next: SelectModeSourceLocation) => void;\n }[] = [];\n\n const fiberChain: SelectModeFiberChainEntry[] =\n selectedElement.fiberChain.map((entry) => ({ ...entry }));\n for (const entry of fiberChain) {\n if (isLikelyCompiledLocation(entry.sourceLocation)) {\n targets.push({\n location: entry.sourceLocation,\n apply: (next) => {\n entry.sourceLocation = next;\n },\n });\n }\n }\n\n let sourceLocation = selectedElement.sourceLocation;\n if (sourceLocation && isLikelyCompiledLocation(sourceLocation)) {\n const captured = sourceLocation;\n targets.push({\n location: captured,\n apply: (next) => {\n sourceLocation = next;\n },\n });\n }\n\n if (targets.length === 0) {\n return selectedElement;\n }\n\n const resolved = await symbolicateFrames(\n targets.map((target) => toNextStackFrame(target.location)),\n );\n\n for (const [index, target] of targets.entries()) {\n const frame = extractResolvedFrame(resolved[index] ?? null);\n target.apply(applyResolved({ original: target.location, frame }));\n }\n\n return {\n ...selectedElement,\n sourceLocation,\n fiberChain,\n };\n}\n\nexport async function symbolicateSelectedElements(\n elements: SelectedElement[],\n): Promise<SelectedElement[]> {\n return Promise.all(elements.map(symbolicateSelectedElement));\n}\n"],
5
+ "mappings": "AA8CA,MAAM,uBAAuB;AAE7B,SAAS,yBACP,UACS;AACT,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AACA,QAAM,WAAW,SAAS;AAC1B,SACE,SAAS,SAAS,OAAO,KACzB,SAAS,SAAS,UAAU,KAC5B,SAAS,SAAS,mBAAmB,KACrC,SAAS,SAAS,YAAY,KAC9B,SAAS,SAAS,KAAK,KACvB,SAAS,WAAW,QAAQ;AAEhC;AAOA,SAAS,cAAc,UAA2B;AAChD,SACE,SAAS,WAAW,sBAAsB,KAC1C,SAAS,SAAS,iBAAiB,KACnC,SAAS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,yBAAiB;AAAA,MACnB;AAAA,IACF,CAAC;AAAA,EACH;AAEA,MAAI,QAAQ,WAAW,GAAG;AACxB,WAAO;AAAA,EACT;AAEA,QAAM,WAAW,MAAM;AAAA,IACrB,QAAQ,IAAI,CAAC,WAAW,iBAAiB,OAAO,QAAQ,CAAC;AAAA,EAC3D;AAEA,aAAW,CAAC,OAAO,MAAM,KAAK,QAAQ,QAAQ,GAAG;AAC/C,UAAM,QAAQ,qBAAqB,SAAS,KAAK,KAAK,IAAI;AAC1D,WAAO,MAAM,cAAc,EAAE,UAAU,OAAO,UAAU,MAAM,CAAC,CAAC;AAAA,EAClE;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EACF;AACF;AAEA,eAAsB,4BACpB,UAC4B;AAC5B,SAAO,QAAQ,IAAI,SAAS,IAAI,0BAA0B,CAAC;AAC7D;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,23 @@
1
+ import type { JSONContent } from "@tiptap/core";
2
+ import type { SelectModeFormatCommand } from "../../_vendor/schemas/generated/selectMode";
3
+ export type InlineTiptapEditor = {
4
+ focus: () => void;
5
+ focusAndSelectAll: () => void;
6
+ destroy: () => void;
7
+ getHTML: () => string;
8
+ getJSON: () => JSONContent;
9
+ runFormatCommand: (command: SelectModeFormatCommand) => void;
10
+ };
11
+ export declare function createInlineTiptapEditor({ element, content, onCommit, onEscape, onBlur, onSelectionUpdate, }: {
12
+ element: HTMLElement;
13
+ content: string;
14
+ onCommit: () => void;
15
+ onEscape: () => void;
16
+ onBlur: () => void;
17
+ onSelectionUpdate: (activeMarks: {
18
+ bold: boolean;
19
+ italic: boolean;
20
+ underline: boolean;
21
+ strike: boolean;
22
+ }) => void;
23
+ }): InlineTiptapEditor;
@@ -0,0 +1,120 @@
1
+ import { Editor, Mark } from "@tiptap/core";
2
+ import Bold from "@tiptap/extension-bold";
3
+ import Document from "@tiptap/extension-document";
4
+ import Italic from "@tiptap/extension-italic";
5
+ import Strike from "@tiptap/extension-strike";
6
+ import Text from "@tiptap/extension-text";
7
+ import Underline from "@tiptap/extension-underline";
8
+ const InlineDocument = Document.extend({
9
+ content: "inline*"
10
+ });
11
+ const InlineLink = Mark.create({
12
+ name: "link",
13
+ inclusive: false,
14
+ addAttributes() {
15
+ return {
16
+ class: { default: null },
17
+ href: { default: null },
18
+ rel: { default: null },
19
+ target: { default: null }
20
+ };
21
+ },
22
+ parseHTML() {
23
+ return [{ tag: "a[href]" }];
24
+ },
25
+ renderHTML({ HTMLAttributes }) {
26
+ return ["a", HTMLAttributes, 0];
27
+ }
28
+ });
29
+ function createInlineTiptapEditor({
30
+ element,
31
+ content,
32
+ onCommit,
33
+ onEscape,
34
+ onBlur,
35
+ onSelectionUpdate
36
+ }) {
37
+ const originalAttributes = Array.from(
38
+ element.attributes,
39
+ ({ name, value }) => ({
40
+ name,
41
+ value
42
+ })
43
+ );
44
+ element.replaceChildren();
45
+ const mount = {
46
+ mount: element
47
+ };
48
+ const editor = new Editor({
49
+ element: mount,
50
+ content,
51
+ extensions: [
52
+ InlineDocument,
53
+ Text,
54
+ Bold,
55
+ Italic,
56
+ Underline,
57
+ Strike,
58
+ InlineLink
59
+ ],
60
+ editorProps: {
61
+ // Drop the browser's default focus ring on the contenteditable — the
62
+ // select-mode selection frame already indicates the edit target.
63
+ attributes: { style: "outline: none;" },
64
+ handleKeyDown: (_view, event) => {
65
+ if (event.key === "Enter" && (event.shiftKey || event.metaKey || event.ctrlKey)) {
66
+ event.preventDefault();
67
+ onCommit();
68
+ return true;
69
+ }
70
+ if (event.key === "Escape") {
71
+ event.preventDefault();
72
+ onEscape();
73
+ return true;
74
+ }
75
+ return false;
76
+ }
77
+ },
78
+ onSelectionUpdate: ({ editor: activeEditor }) => {
79
+ onSelectionUpdate({
80
+ bold: activeEditor.isActive("bold"),
81
+ italic: activeEditor.isActive("italic"),
82
+ underline: activeEditor.isActive("underline"),
83
+ strike: activeEditor.isActive("strike")
84
+ });
85
+ },
86
+ onBlur: () => {
87
+ onBlur();
88
+ }
89
+ });
90
+ return {
91
+ focus: () => editor.commands.focus(),
92
+ // Focus the editor with the full text block selected so the user can type
93
+ // to replace it immediately (or arrow/click to drop the selection).
94
+ focusAndSelectAll: () => editor.chain().focus().selectAll().run(),
95
+ destroy: () => {
96
+ editor.destroy();
97
+ for (const attribute of Array.from(element.attributes)) {
98
+ element.removeAttribute(attribute.name);
99
+ }
100
+ for (const { name, value } of originalAttributes) {
101
+ element.setAttribute(name, value);
102
+ }
103
+ },
104
+ getHTML: () => editor.getHTML(),
105
+ getJSON: () => editor.getJSON(),
106
+ runFormatCommand: (command) => {
107
+ const commandRunners = {
108
+ toggleBold: () => editor.chain().focus().toggleBold().run(),
109
+ toggleItalic: () => editor.chain().focus().toggleItalic().run(),
110
+ toggleUnderline: () => editor.chain().focus().toggleUnderline().run(),
111
+ toggleStrike: () => editor.chain().focus().toggleStrike().run()
112
+ };
113
+ commandRunners[command]();
114
+ }
115
+ };
116
+ }
117
+ export {
118
+ createInlineTiptapEditor
119
+ };
120
+ //# sourceMappingURL=tiptapInlineEditor.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../editor/select-mode/tiptapInlineEditor.ts"],
4
+ "sourcesContent": ["import type { JSONContent } from \"@tiptap/core\";\nimport type { SelectModeFormatCommand } from \"schemas/generated/selectMode\";\n\nimport { Editor, Mark } from \"@tiptap/core\";\nimport Bold from \"@tiptap/extension-bold\";\nimport Document from \"@tiptap/extension-document\";\nimport Italic from \"@tiptap/extension-italic\";\nimport Strike from \"@tiptap/extension-strike\";\nimport Text from \"@tiptap/extension-text\";\nimport Underline from \"@tiptap/extension-underline\";\n\nconst InlineDocument = Document.extend({\n content: \"inline*\",\n});\n\nconst InlineLink = Mark.create({\n name: \"link\",\n inclusive: false,\n addAttributes() {\n return {\n class: { default: null },\n href: { default: null },\n rel: { default: null },\n target: { default: null },\n };\n },\n parseHTML() {\n return [{ tag: \"a[href]\" }];\n },\n renderHTML({ HTMLAttributes }) {\n return [\"a\", HTMLAttributes, 0];\n },\n});\n\nexport type InlineTiptapEditor = {\n focus: () => void;\n focusAndSelectAll: () => void;\n destroy: () => void;\n getHTML: () => string;\n getJSON: () => JSONContent;\n runFormatCommand: (command: SelectModeFormatCommand) => void;\n};\n\nexport function createInlineTiptapEditor({\n element,\n content,\n onCommit,\n onEscape,\n onBlur,\n onSelectionUpdate,\n}: {\n element: HTMLElement;\n content: string;\n onCommit: () => void;\n onEscape: () => void;\n onBlur: () => void;\n onSelectionUpdate: (activeMarks: {\n bold: boolean;\n italic: boolean;\n underline: boolean;\n strike: boolean;\n }) => void;\n}): InlineTiptapEditor {\n const originalAttributes = Array.from(\n element.attributes,\n ({ name, value }) => ({\n name,\n value,\n }),\n );\n // ProseMirror *appends* its contenteditable to the mount node rather than\n // replacing it, so the element's original text node would survive as a\n // sibling and render a duplicate copy. The editor's initial content comes\n // from the `content` option below (not the element's DOM), and the caller\n // keeps the original HTML for revert, so emptying the node here is safe.\n element.replaceChildren();\n const mount = {\n mount: element,\n } as unknown as Element; /* eslint-disable-line replo/no-as-cast -- NOTE (Noah Gilmore, 2026-07-16): ProseMirror accepts this documented direct-mount shape at runtime, but Tiptap v2's Editor option incorrectly narrows it to Element. */\n const editor = new Editor({\n element: mount,\n content,\n extensions: [\n InlineDocument,\n Text,\n Bold,\n Italic,\n Underline,\n Strike,\n InlineLink,\n ],\n editorProps: {\n // Drop the browser's default focus ring on the contenteditable \u2014 the\n // select-mode selection frame already indicates the edit target.\n attributes: { style: \"outline: none;\" },\n handleKeyDown: (_view, event) => {\n // Commit on Shift-Enter or Cmd/Ctrl-Enter; a bare Enter inserts a line\n // break as usual.\n if (\n event.key === \"Enter\" &&\n (event.shiftKey || event.metaKey || event.ctrlKey)\n ) {\n event.preventDefault();\n onCommit();\n return true;\n }\n if (event.key === \"Escape\") {\n event.preventDefault();\n onEscape();\n return true;\n }\n return false;\n },\n },\n onSelectionUpdate: ({ editor: activeEditor }) => {\n onSelectionUpdate({\n bold: activeEditor.isActive(\"bold\"),\n italic: activeEditor.isActive(\"italic\"),\n underline: activeEditor.isActive(\"underline\"),\n strike: activeEditor.isActive(\"strike\"),\n });\n },\n onBlur: () => {\n onBlur();\n },\n });\n\n return {\n focus: () => editor.commands.focus(),\n // Focus the editor with the full text block selected so the user can type\n // to replace it immediately (or arrow/click to drop the selection).\n focusAndSelectAll: () => editor.chain().focus().selectAll().run(),\n destroy: () => {\n editor.destroy();\n for (const attribute of Array.from(element.attributes)) {\n element.removeAttribute(attribute.name);\n }\n for (const { name, value } of originalAttributes) {\n element.setAttribute(name, value);\n }\n },\n getHTML: () => editor.getHTML(),\n getJSON: () => editor.getJSON(),\n runFormatCommand: (command) => {\n const commandRunners: Record<SelectModeFormatCommand, () => void> = {\n toggleBold: () => editor.chain().focus().toggleBold().run(),\n toggleItalic: () => editor.chain().focus().toggleItalic().run(),\n toggleUnderline: () => editor.chain().focus().toggleUnderline().run(),\n toggleStrike: () => editor.chain().focus().toggleStrike().run(),\n };\n commandRunners[command]();\n },\n };\n}\n"],
5
+ "mappings": "AAGA,SAAS,QAAQ,YAAY;AAC7B,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,YAAY;AACnB,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,OAAO,eAAe;AAEtB,MAAM,iBAAiB,SAAS,OAAO;AAAA,EACrC,SAAS;AACX,CAAC;AAED,MAAM,aAAa,KAAK,OAAO;AAAA,EAC7B,MAAM;AAAA,EACN,WAAW;AAAA,EACX,gBAAgB;AACd,WAAO;AAAA,MACL,OAAO,EAAE,SAAS,KAAK;AAAA,MACvB,MAAM,EAAE,SAAS,KAAK;AAAA,MACtB,KAAK,EAAE,SAAS,KAAK;AAAA,MACrB,QAAQ,EAAE,SAAS,KAAK;AAAA,IAC1B;AAAA,EACF;AAAA,EACA,YAAY;AACV,WAAO,CAAC,EAAE,KAAK,UAAU,CAAC;AAAA,EAC5B;AAAA,EACA,WAA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OAAO,SAAS,MAAM;AAAA;AAAA;AAAA,IAGnC,mBAAmB,MAAM,OAAO,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI;AAAA,IAChE,SAAS,MAAM;AACb,aAAO,QAAQ;AACf,iBAAW,aAAa,MAAM,KAAK,QAAQ,UAAU,GAAG;AACtD,gBAAQ,gBAAgB,UAAU,IAAI;AAAA,MACxC;AACA,iBAAW,EAAE,MAAM,MAAM,KAAK,oBAAoB;AAChD,gBAAQ,aAAa,MAAM,KAAK;AAAA,MAClC;AAAA,IACF;AAAA,IACA,SAAS,MAAM,OAAO,QAAQ;AAAA,IAC9B,SAAS,MAAM,OAAO,QAAQ;AAAA,IAC9B,kBAAkB,CAAC,YAAY;AAC7B,YAAM,iBAA8D;AAAA,QAClE,YAAY,MAAM,OAAO,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI;AAAA,QAC1D,cAAc,MAAM,OAAO,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI;AAAA,QAC9D,iBAAiB,MAAM,OAAO,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,IAAI;AAAA,QACpE,cAAc,MAAM,OAAO,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI;AAAA,MAChE;AACA,qBAAe,OAAO,EAAE;AAAA,IAC1B;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
package/next/config.js CHANGED
@@ -15,7 +15,6 @@ const PLATFORM_SERVER_ACTION_ORIGINS = [
15
15
  "*.preview.reploapi.com",
16
16
  "*.preview-staging.reploapi.com"
17
17
  ];
18
- const dedupe = (origins) => Array.from(new Set(origins));
19
18
  function siteConfig(overrides = {}) {
20
19
  const isBuild = process.env.BUILD_ENV === "build";
21
20
  const {
@@ -48,10 +47,11 @@ function siteConfig(overrides = {}) {
48
47
  ...overrideTurbopack,
49
48
  root: isBuild ? "/" : "/workspace/dev"
50
49
  },
51
- allowedDevOrigins: dedupe([
52
- ...overrideDevOrigins ?? [],
53
- ...PLATFORM_DEV_ORIGINS
54
- ]),
50
+ // canopy-sdk ships as raw source with zero workspace deps, so we can't pull
51
+ // in lodash-es `uniq` here — dedupe inline via a Set instead.
52
+ allowedDevOrigins: Array.from(
53
+ /* @__PURE__ */ new Set([...overrideDevOrigins ?? [], ...PLATFORM_DEV_ORIGINS])
54
+ ),
55
55
  images: {
56
56
  ...overrideImages,
57
57
  loader: "custom",
@@ -72,10 +72,12 @@ function siteConfig(overrides = {}) {
72
72
  cpus: isBuild ? os.availableParallelism() : void 0,
73
73
  serverActions: {
74
74
  ...overrideServerActions,
75
- allowedOrigins: dedupe([
76
- ...overrideServerActions?.allowedOrigins ?? [],
77
- ...PLATFORM_SERVER_ACTION_ORIGINS
78
- ])
75
+ allowedOrigins: Array.from(
76
+ /* @__PURE__ */ new Set([
77
+ ...overrideServerActions?.allowedOrigins ?? [],
78
+ ...PLATFORM_SERVER_ACTION_ORIGINS
79
+ ])
80
+ )
79
81
  }
80
82
  }
81
83
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../next/config.ts"],
4
- "sourcesContent": ["import os from \"os\";\nimport type { NextConfig } from \"next\";\n\n// Origins browsers load sandbox previews from \u2014 PREVIEW_HOSTNAME in the\n// coordinator's wrangler.jsonc plus Daytona's native preview domain. Next 16\n// hard-blocks cross-origin dev requests (HMR WebSocket, Server Actions) from\n// origins missing here.\nconst PLATFORM_DEV_ORIGINS = [\n \"localhost:*\",\n \"*.localhost:*\",\n \"*.lvh.me:*\",\n \"*.daytonaproxy01.net\",\n \"*.preview.reploapi.com\",\n \"*.preview-staging.reploapi.com\",\n];\n\nconst PLATFORM_SERVER_ACTION_ORIGINS = [\n \"localhost:*\",\n \"*.localhost:*\",\n \"*.lvh.me:*\",\n \"*.cloudflare-agent-coordinator.replo.workers.dev\",\n \"*.preview.reploapi.com\",\n \"*.preview-staging.reploapi.com\",\n];\n\nconst dedupe = (origins: string[]): string[] => Array.from(new Set(origins));\n\n// The canonical Next.js runtime contract shared by every agent-built site.\n// Sites re-export `default` from here through a one-line `next.config.ts` shim,\n// so the platform wiring (sandbox dist dirs, Turbopack root, preview origins,\n// Cloudflare image loader) lives in exactly one place instead of being copied\n// into each template.\n//\n// `overrides` is a per-site customization surface, but it must not be able to\n// silently amputate platform wiring. A plain `...overrides` spread is a shallow\n// merge: a site that sets any nested key (e.g. `experimental.typedRoutes`)\n// would replace the whole `experimental`/`images` block and drop platform\n// defaults like the build-worker OOM guard or the Cloudflare image loader. So\n// load-bearing keys are re-asserted after the spread and the nested blocks are\n// deep-merged: a site can add keys, but platform invariants always win and\n// platform origin lists are preserved (site entries are appended, not swapped).\nexport function siteConfig(overrides: NextConfig = {}): NextConfig {\n const isBuild = process.env.BUILD_ENV === \"build\";\n const {\n turbopack: overrideTurbopack,\n images: overrideImages,\n experimental: overrideExperimental,\n allowedDevOrigins: overrideDevOrigins,\n ...restOverrides\n } = overrides;\n\n const { serverActions: overrideServerActions, ...restOverrideExperimental } =\n overrideExperimental ?? {};\n\n return {\n // Site-overridable defaults.\n reactStrictMode: true,\n devIndicators: false,\n ...restOverrides,\n\n // Platform invariants \u2014 re-asserted after the spread so a site override\n // can never break sandbox builds, publish, or the dev server.\n output: \"standalone\",\n distDir: isBuild ? \".next\" : \".next-dev\",\n // NOTE (Cole, 2026-04-30, REPL-26637): The publish tool patches\n // required-server-files.json to clear this value before OpenNext bundles,\n // since \"/\" makes esbuild emit absolute-path requires that break in Workers.\n // NOTE (Patrick Lu, 2026-07-06, REPL-28775): Leave outputFileTracingRoot\n // unset outside builds because Next 15.5+ otherwise forces turbopack.root to\n // \"/\" and makes the dev watcher retain whole-filesystem state.\n outputFileTracingRoot: isBuild ? \"/\" : undefined,\n // NOTE (Patrick Lu, 2026-07-06, REPL-28775): Match build tracing at publish\n // time; keep dev's watcher on the user app tree.\n turbopack: {\n ...overrideTurbopack,\n root: isBuild ? \"/\" : \"/workspace/dev\",\n },\n allowedDevOrigins: dedupe([\n ...(overrideDevOrigins ?? []),\n ...PLATFORM_DEV_ORIGINS,\n ]),\n images: {\n ...overrideImages,\n loader: \"custom\",\n loaderFile: \"./image-loader.ts\",\n remotePatterns: overrideImages?.remotePatterns ?? [\n {\n protocol: \"https\",\n hostname: \"**\",\n },\n ],\n },\n experimental: {\n ...restOverrideExperimental,\n // NOTE (Cole, 2026-06-18, REPL-28180): Next sizes its build worker pool\n // off os.cpus().length = host cores (~64) inside a cgroup-limited sandbox,\n // not the 2 the container actually has \u2014 a worker swarm that OOMs the\n // 4 GiB box. availableParallelism() is cgroup-aware. Gated to prod build.\n cpus: isBuild ? os.availableParallelism() : undefined,\n serverActions: {\n ...overrideServerActions,\n allowedOrigins: dedupe([\n ...(overrideServerActions?.allowedOrigins ?? []),\n ...PLATFORM_SERVER_ACTION_ORIGINS,\n ]),\n },\n },\n };\n}\n\nconst nextConfig: NextConfig = siteConfig();\n\nexport default nextConfig;\n"],
5
- "mappings": "AAAA,OAAO,QAAQ;AAOf,MAAM,uBAAuB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,iCAAiC;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,SAAS,CAAC,YAAgC,MAAM,KAAK,IAAI,IAAI,OAAO,CAAC;AAgBpE,SAAS,WAAW,YAAwB,CAAC,GAAe;AACjE,QAAM,UAAU,QAAQ,IAAI,cAAc;AAC1C,QAAM;AAAA,IACJ,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB,GAAG;AAAA,EACL,IAAI;AAEJ,QAAM,EAAE,eAAe,uBAAuB,GAAG,yBAAyB,IACxE,wBAAwB,CAAC;AAE3B,SAAO;AAAA;AAAA,IAEL,iBAAiB;AAAA,IACjB,eAAe;AAAA,IACf,GAAG;AAAA;AAAA;AAAA,IAIH,QAAQ;AAAA,IACR,SAAS,UAAU,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAO7B,uBAAuB,UAAU,MAAM;AAAA;AAAA;AAAA,IAGvC,WAAW;AAAA,MACT,GAAG;AAAA,MACH,MAAM,UAAU,MAAM;AAAA,IACxB;AAAA,IACA,mBAAmB,OAAO;AAAA,MACxB,GAAI,sBAAsB,CAAC;AAAA,MAC3B,GAAG;AAAA,IACL,CAAC;AAAA,IACD,QAAQ;AAAA,MACN,GAAG;AAAA,MACH,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,gBAAgB,gBAAgB,kBAAkB;AAAA,QAChD;AAAA,UACE,UAAU;AAAA,UACV,UAAU;AAAA,QACZ;AAAA,MACF;AAAA,IACF;AAAA,IACA,cAAc;AAAA,MACZ,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA,MAKH,MAAM,UAAU,GAAG,qBAAqB,IAAI;AAAA,MAC5C,eAAe;AAAA,QACb,GAAG;AAAA,QACH,gBAAgB,OAAO;AAAA,UACrB,GAAI,uBAAuB,kBAAkB,CAAC;AAAA,UAC9C,GAAG;AAAA,QACL,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;AAEA,MAAM,aAAyB,WAAW;AAE1C,IAAO,iBAAQ;",
4
+ "sourcesContent": ["import os from \"os\";\nimport type { NextConfig } from \"next\";\n\n// Origins browsers load sandbox previews from \u2014 PREVIEW_HOSTNAME in the\n// coordinator's wrangler.jsonc plus Daytona's native preview domain. Next 16\n// hard-blocks cross-origin dev requests (HMR WebSocket, Server Actions) from\n// origins missing here.\nconst PLATFORM_DEV_ORIGINS = [\n \"localhost:*\",\n \"*.localhost:*\",\n \"*.lvh.me:*\",\n \"*.daytonaproxy01.net\",\n \"*.preview.reploapi.com\",\n \"*.preview-staging.reploapi.com\",\n];\n\nconst PLATFORM_SERVER_ACTION_ORIGINS = [\n \"localhost:*\",\n \"*.localhost:*\",\n \"*.lvh.me:*\",\n \"*.cloudflare-agent-coordinator.replo.workers.dev\",\n \"*.preview.reploapi.com\",\n \"*.preview-staging.reploapi.com\",\n];\n\n// The canonical Next.js runtime contract shared by every agent-built site.\n// Sites re-export `default` from here through a one-line `next.config.ts` shim,\n// so the platform wiring (sandbox dist dirs, Turbopack root, preview origins,\n// Cloudflare image loader) lives in exactly one place instead of being copied\n// into each template.\n//\n// `overrides` is a per-site customization surface, but it must not be able to\n// silently amputate platform wiring. A plain `...overrides` spread is a shallow\n// merge: a site that sets any nested key (e.g. `experimental.typedRoutes`)\n// would replace the whole `experimental`/`images` block and drop platform\n// defaults like the build-worker OOM guard or the Cloudflare image loader. So\n// load-bearing keys are re-asserted after the spread and the nested blocks are\n// deep-merged: a site can add keys, but platform invariants always win and\n// platform origin lists are preserved (site entries are appended, not swapped).\nexport function siteConfig(overrides: NextConfig = {}): NextConfig {\n const isBuild = process.env.BUILD_ENV === \"build\";\n const {\n turbopack: overrideTurbopack,\n images: overrideImages,\n experimental: overrideExperimental,\n allowedDevOrigins: overrideDevOrigins,\n ...restOverrides\n } = overrides;\n\n const { serverActions: overrideServerActions, ...restOverrideExperimental } =\n overrideExperimental ?? {};\n\n return {\n // Site-overridable defaults.\n reactStrictMode: true,\n devIndicators: false,\n ...restOverrides,\n\n // Platform invariants \u2014 re-asserted after the spread so a site override\n // can never break sandbox builds, publish, or the dev server.\n output: \"standalone\",\n distDir: isBuild ? \".next\" : \".next-dev\",\n // NOTE (Cole, 2026-04-30, REPL-26637): The publish tool patches\n // required-server-files.json to clear this value before OpenNext bundles,\n // since \"/\" makes esbuild emit absolute-path requires that break in Workers.\n // NOTE (Patrick Lu, 2026-07-06, REPL-28775): Leave outputFileTracingRoot\n // unset outside builds because Next 15.5+ otherwise forces turbopack.root to\n // \"/\" and makes the dev watcher retain whole-filesystem state.\n outputFileTracingRoot: isBuild ? \"/\" : undefined,\n // NOTE (Patrick Lu, 2026-07-06, REPL-28775): Match build tracing at publish\n // time; keep dev's watcher on the user app tree.\n turbopack: {\n ...overrideTurbopack,\n root: isBuild ? \"/\" : \"/workspace/dev\",\n },\n // canopy-sdk ships as raw source with zero workspace deps, so we can't pull\n // in lodash-es `uniq` here \u2014 dedupe inline via a Set instead.\n allowedDevOrigins: Array.from(\n new Set([...(overrideDevOrigins ?? []), ...PLATFORM_DEV_ORIGINS]),\n ),\n images: {\n ...overrideImages,\n loader: \"custom\",\n loaderFile: \"./image-loader.ts\",\n remotePatterns: overrideImages?.remotePatterns ?? [\n {\n protocol: \"https\",\n hostname: \"**\",\n },\n ],\n },\n experimental: {\n ...restOverrideExperimental,\n // NOTE (Cole, 2026-06-18, REPL-28180): Next sizes its build worker pool\n // off os.cpus().length = host cores (~64) inside a cgroup-limited sandbox,\n // not the 2 the container actually has \u2014 a worker swarm that OOMs the\n // 4 GiB box. availableParallelism() is cgroup-aware. Gated to prod build.\n cpus: isBuild ? os.availableParallelism() : undefined,\n serverActions: {\n ...overrideServerActions,\n allowedOrigins: Array.from(\n new Set([\n ...(overrideServerActions?.allowedOrigins ?? []),\n ...PLATFORM_SERVER_ACTION_ORIGINS,\n ]),\n ),\n },\n },\n };\n}\n\nconst nextConfig: NextConfig = siteConfig();\n\nexport default nextConfig;\n"],
5
+ "mappings": "AAAA,OAAO,QAAQ;AAOf,MAAM,uBAAuB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,iCAAiC;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAgBO,SAAS,WAAW,YAAwB,CAAC,GAAe;AACjE,QAAM,UAAU,QAAQ,IAAI,cAAc;AAC1C,QAAM;AAAA,IACJ,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB,GAAG;AAAA,EACL,IAAI;AAEJ,QAAM,EAAE,eAAe,uBAAuB,GAAG,yBAAyB,IACxE,wBAAwB,CAAC;AAE3B,SAAO;AAAA;AAAA,IAEL,iBAAiB;AAAA,IACjB,eAAe;AAAA,IACf,GAAG;AAAA;AAAA;AAAA,IAIH,QAAQ;AAAA,IACR,SAAS,UAAU,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAO7B,uBAAuB,UAAU,MAAM;AAAA;AAAA;AAAA,IAGvC,WAAW;AAAA,MACT,GAAG;AAAA,MACH,MAAM,UAAU,MAAM;AAAA,IACxB;AAAA;AAAA;AAAA,IAGA,mBAAmB,MAAM;AAAA,MACvB,oBAAI,IAAI,CAAC,GAAI,sBAAsB,CAAC,GAAI,GAAG,oBAAoB,CAAC;AAAA,IAClE;AAAA,IACA,QAAQ;AAAA,MACN,GAAG;AAAA,MACH,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,gBAAgB,gBAAgB,kBAAkB;AAAA,QAChD;AAAA,UACE,UAAU;AAAA,UACV,UAAU;AAAA,QACZ;AAAA,MACF;AAAA,IACF;AAAA,IACA,cAAc;AAAA,MACZ,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA,MAKH,MAAM,UAAU,GAAG,qBAAqB,IAAI;AAAA,MAC5C,eAAe;AAAA,QACb,GAAG;AAAA,QACH,gBAAgB,MAAM;AAAA,UACpB,oBAAI,IAAI;AAAA,YACN,GAAI,uBAAuB,kBAAkB,CAAC;AAAA,YAC9C,GAAG;AAAA,UACL,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEA,MAAM,aAAyB,WAAW;AAE1C,IAAO,iBAAQ;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,10 +1,18 @@
1
1
  {
2
2
  "name": "@replohq/canopy-sdk",
3
- "version": "0.11.1",
3
+ "version": "0.13.0",
4
4
  "description": "Replo Canopy SDK — cart, analytics, data loaders, and editor runtime for agent-built Next.js sites.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "dependencies": {
8
+ "@tiptap/core": "^2.25.0",
9
+ "@tiptap/extension-bold": "^2.25.0",
10
+ "@tiptap/extension-document": "^2.25.0",
11
+ "@tiptap/extension-italic": "^2.25.0",
12
+ "@tiptap/extension-strike": "^2.25.0",
13
+ "@tiptap/extension-text": "^2.25.0",
14
+ "@tiptap/extension-underline": "^2.25.0",
15
+ "@tiptap/pm": "^2.25.0",
8
16
  "tiny-jsonc": "^1.0.2",
9
17
  "uuid": "^11.1.0",
10
18
  "zod": "^4.3.6"