Documentation Index
Fetch the complete documentation index at: https://avocadostudioai.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Streaming/Optimistic Patch Transport Checklist
Status: Preview adapter and shared types are complete — see
packages/preview-adapter/src/preview-bridge-core.tsx (the applyPatch and
resetToServer message handlers and emitPatchAck). Editor-side integration
(wiring postPatchToSite into the chat, inline-edit, reorder, delete, and
variation handlers) is still pending.Editor Tasks
File:apps/editor/src/App.tsx
- Add transport flag near env constants (
siteOrigin,orchestrator) and deriveenablePatchTransportfromVITE_ENABLE_PATCH_TRANSPORT. - Add tx state near existing
useStatedeclarations:lastConfirmedVersionBySlug,pendingTxBySlug,transportDegradedBySlug. - Add helpers near
postToSite(...):postPatchToSite(...),enqueueTx(...),ackTx(...),rejectTxAndResync(...),scheduleTxTimeout(...). - Extend the existing
window.addEventListener("message", onMessage)handler to process new iframepatchAckmessages. - In
submitChatStream(...), insidepayload.type === "op_applied"handling, sendapplyPatchper op (instead of onlydraftUpdated), with fallback to current refresh behavior. - In
inlineEditCommit(...), after successful/ops, sendapplyPatchwith the same op payload and versions. - In
reorderBlock(...), after successful/ops, sendapplyPatchfor the move op. - In
deleteBlock(...), after successful/ops, sendapplyPatchfor the remove op. - In
applyVariation(...), after successful/ops, sendapplyPatchfor theupdate_propsop. - Keep
postToSite("draftUpdated", ...)as fallback path when transport disabled, timed out, or rejected.
Preview Adapter Tasks
File:packages/preview-adapter/src/preview-bridge.tsx
- Extend
SiteMessageunion to includeapplyPatchandresetToServer. - Add local refs/state in
useEffectscope:serverVersionRef,optimisticQueueRef,currentSlugRef. - Add helper functions near existing helpers:
validatePatchVersion(...),applyOpsOptimistically(...),emitPatchAck(...),clearOptimisticState(...). - In
onMessage(...), addmsg.type === "applyPatch"branch: validate version, apply/reject patch, sendpatchAck. - In
onMessage(...), addmsg.type === "resetToServer"branch: clear optimistic queue, run existingsmoothRefresh(), restore focus. - Keep current
draftUpdatedbranch unchanged as compatibility fallback.
Shared Contract Tasks
File:packages/shared/src/index.ts
- Add TS types for
site-editor/v2messages:ApplyPatchMessage,PatchAckMessage,ResetToServerMessage. - Add zod schemas for these payloads and a typed reject-reason enum.
- Export these types/schemas for editor and preview adapter consumption.
Orchestrator Compatibility Tasks
File:apps/orchestrator/src/index.ts
- Keep
/chat/streamop_appliedpayload stable and documented as source of patch transport ops. - Ensure all op-producing paths continue returning
previewVersionandfocusBlockIdconsistently. - Add a short comment near
op_appliedSSE write clarifying it is patch-transport input for editor iframe.
Validation Tasks
- Streamed chat with multiple ops updates preview incrementally without full refresh.
- Force version mismatch and confirm automatic
resetToServerrecovery. - Confirm inline edit/reorder/delete/variation all still work with fallback off/on.
- Confirm undo/redo still yields same final server JSON as before.