Repository navigation
Conversation
This was referenced Oct 3, 2026
Closed
Copies @decocms/blocks/protocol (unpublished v8) into packages/shared/src/vendor/blocks-protocol with a sync script and a SYNC.md note, and exposes it as @decocms/shared/blocks-protocol*. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Default off. Gates the content-protocol editing path for next-major Blocks sites. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Adds a ContentStorage over RepoContentClient (one repo, app root and branch; blob shas as versions, the branch head as the revision) behind the vendored createContentHandler, at POST /api/:org/decofile/:virtualMcpId/:branch/rpc GET /api/:org/decofile/:virtualMcpId/:branch/draft-grant Both sit under the existing scope middleware (session, cms plan, repository binding) and answer 404 unless the org has the site_editor_content_protocol flag. They don't need a preview server. A missing branch reads as the default branch until the first write creates it. The tracked blocks.gen.json regeneration moves to gen-artifact.ts, shared with the commit coalescer. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Runs the protocol's black-box conformance suite against the new endpoint over the GitHub stub, plus the flag gate, session auth, the bound branch, branch creation on first write and the tracked blocks.gen.json. The stub now hashes blobs the way git does, so versions computed from content agree with its tree. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
useContentBackend decides, per project and branch, whether the editor reads and writes the legacy way or through the Blocks content protocol: a connected deco serve, or Studio's GitHub backend when a Fast Preview session's branch has a committed schema. Behind the org flag; pending while the flag or the probe loads, so a project never switches backends mid-read. On the protocol, useDecofile and useLiveMeta poll blocks.list and schema.get with ifNoneMatch at describe.pollIntervalMs and on focus, the write hooks send one blocks.apply each and adopt its revision, and a poll keeps entries still being saved. On GitHub the draft pointer comes from the new draft-grant route plus the list revision. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
/connect#endpoint=…&token=… (the link deco serve prints) takes the connection out of the fragment, keeps it for the tab across the login redirect and hands over to /$org/connect, which calls describe (Chrome's Local Network Access prompt), lets the editor pick the project and opens its site editor. The connection is stored per project in this browser. The site editor shows a Local server chip with Disconnect, says when the server restarted with a new token or isn't running, and hides the publish and terminal surfaces: the developer commits. Image and file uploads go to PUT <server>/assets/<name> when describe.assets allows. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
- A key in the manifest is a block type, so short names like `hero` aren't read as saved blocks, are offered in block pickers, and can't be taken by a new saved block. Without the manifest, the module-path heuristic is unchanged. - Lazy<T> fields render the form of T and store the lazy block around the value; `lazy` is never offered as a pick. The built-in `multivariate` keeps each variant's value in a lazy block; the legacy names keep plain values. - Redirects list and edit the flat `redirect` shape next to the nested one, keep the shape they were read in, and edit its optional status (301/302/307/308). New redirects stay nested. - On the protocol, Secret fields are write-only: what an editor types is encrypted in the browser with describe.secrets.publicKey and only the secret block with its ciphertext is saved. v7 secrets say they can't be edited there. The content protocol never runs site code, so on it: - the preview is the real app (the draft on GitHub, the dev app for a connected deco serve) with no in-place /live/previews renders; - the add-section gallery shows each block's name, description and schema @image instead of rendered thumbnails; - loader-backed pickers fall back to the schema's options or free text; - Run, runnable loaders and actions, and app install are hidden. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
A stand-in deco serve (the protocol's handler over an in-memory working tree, on 127.0.0.1 with a token) is connected through /connect; the spec edits a field, a Lazy<T> field (stored wrapped) and a Secret field, and checks the stored ciphertext decrypts with the test's private key while the plaintext appears in no stored file and no request. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Documents the site_editor_content_protocol flag, when a project uses the content protocol (a Fast Preview branch with a committed schema, or a connected deco serve), connecting deco serve, and what works differently because the site's code never runs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
The SEO autosave read the latest page block from a hard-coded cache key, which a connected deco serve doesn't use. Also drops exports nothing imports any more. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
…ew server The content-protocol storage and the commit coalescer share the commit message builder. Only the rpc route skips the preview-server check: a draft grant has nothing to point at without one. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
/connect is now a root route (the deco serve connect link), so an org with that slug would be shadowed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Fixes: - Pages come from the manifest's pages group (the built-in page and route blocks like post), and new pages use the built-in page type. - Connect links accept only a server on this machine, and the connect screen shows the server and folder before a project is picked. - The legacy secret field (which posts plaintext to the site) renders only on the legacy backend; undecided or unreachable shows a message. - A failed GitHub probe makes the backend unavailable and retries, instead of routing a protocol site to the legacy path for good. - A deco serve that restarted or stopped is detected on the next read or write, so the chip says why. - Uploads respect describe.assets.maxBytes; /assets thumbnails load from the dev app on a deco serve connection. Cuts: - One batched blocks.list + schema.get per poll, shared by the decofile and schema hooks (as the protocol docs describe), replacing two pollers and the probe's schema reuse. - The draft grant is a cached query; saves no longer fetch it. - ContentCapabilities becomes isProtocolProject; the git-status invalidation, cache-key choice, unavailable error and localStorage mirroring each live in one place; the connect routes share the default org resolution and layout with the home route. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
/site-editor is now a root route (the account-less site editor over deco serve), so an org with that slug would be shadowed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
The link deco serve prints becomes /site-editor#endpoint=…&token=…: just the site editor, talking the content protocol to the server on this machine, with no sign-in, org, project or GitHub. The connection leaves the URL at once and is kept for the tab (sessionStorage); only loopback servers are accepted. /connect redirects there for older CLIs, and the signed-in /$org/connect project picker is gone. The editor gets a placeholder project whose org has no id: useVirtualMCP and the org-settings read skip themselves without one, and TabDecoServeConnectionContext hands every surface the tab's connection. The header shows a v8/v7 badge (ContentVersionBadge). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Pasting a deco serve link into Advanced → Local checks the server answers describe, then edits the project over the content protocol (v8); any other URL keeps today's tunnel behaviour (v7). The local path no longer needs the site_editor_content_protocol flag: a connection exists only once its link was pasted, so v7 sites are untouched. The GitHub backend stays behind the flag. The logged-in editor header shows the v8/v7 badge. The e2e spec covers the account-less /site-editor (through a /connect link) and the signed-in Local option. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
PostHog captures the first pageview before the router strips the fragment, so /connect#…&token=… reached $current_url. Drop token from the hash in sanitizeAnalyticsUrl. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Signed in, the user pastes the link rather than opening it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
This was referenced Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack
One Studio stack, each PR based on the one before it:
#7796 (org_sites project link, base:
main) → #7728 (blocks v8 support) → #7770 (sandbox content protocol) → #7766 (hosted)This PR: #7728, based on #7796.
Merged #7796 (
c9a0da883, no conflicts; it also brought in currentmain). Then merged #7796's review fixes (1a4391782, no conflicts). Then merged #7796's PO decisions (cb3f73d45, no conflicts) and its comment tidy-up (7d3613fcd, no conflicts). This PR shows only the v8 support diff once its base isfeat/org-sites-project-link.What is this contribution about?
The Studio site editor can now edit sites built on next-major Blocks (
@decocms/blocks@8) through the Blocks content protocol. Editing a localdeco serve(the account-less/site-editorroute, and the Local draft environment when signed in) needs no org flag; the GitHub-backed protocol is behind the org flag below. The editor reads the committed schema and.deco/blocksand never runs the site's code. All of it sits behind the default-off org flagsite_editor_content_protocol. With the flag off, Studio behaves as it does today.What's in
Protocol from
@decocms/blocks. Studio depends on the published@decocms/blocks, pinned exactly at8.1.0-next.7, and imports its public@decocms/blocks/protocol,/protocol/server,/protocol/conformance,/protocol/storage/fsand/secretssubpaths. See "How Studio gets the protocol" below.GitHub backend (API). It serves the protocol over a project's repository:
POST /api/:org/decofile/:virtualMcpId/:branch/rpcrunscreateContentHandlerfrom@decocms/blocks/protocol/serverover a storage built onRepoContentClient(apps/api/src/decofile/repo-content-storage.ts).schema.gen.json, thenmeta.gen.json, then the default branch. It is served only when it says"blocksMajor": 8; a v7 site reads as schemaless and any write to it is refused (Unsupported), so even a direct API call can't write a v7 site.blocks.gen.jsonis regenerated in the same commit (gen-artifact.ts, shared with the existing commit coalescer).GET .../changesanswers what the draft branch changed against production, for the site's?__draft=pointer. Like v7's read and save, every/rpcanswer carries the pointer's token (X-Deco-Draft-Token,X-Deco-Api-Hostheaders, since the body is the protocol's). See "Draft previews" below.Which backend a project uses (web). One selector decides:
deco serveconnection, which is always v8);deco serve→ protocol on the local server;cms) session whose branch has a committed schema → protocol on GitHub;Sandbox sessions stay legacy. A failed GitHub check is never read as "no schema": the project shows as unavailable and the check retries.
Reading and writing (web).
blocks.list+schema.getper poll, usingifNoneMatch, atdescribe.pollIntervalMsand on window focus.blocks.apply, and the client adopts the returned revision.?__draft=link is the v7 Fast Preview pointer, naming the branch'schanges(see "Draft previews" below). "Exit preview" still uses?__draft=off.Connecting to
deco serve. No token anywhere: Studio never sends one, ignorestoken=in old links, remembers the endpoint per browser, reconnects on its own, accepts only127.0.0.1/localhost/[::1]/rpcendpoints.7d1a2c79c:deco servenow answers every origin (blocks#619), so the empty state shows plainnpx @decocms/blocks serveon any Studio origin; the--allow-originguidance, its en/pt-br strings and the official-origin check are gone, and the e2e stub reflects anyOrigin.c97b68ba3:deco serveis onlocalhost(blocks#619): the default endpoint ishttp://localhost:4545/rpcand every label showslocalhost:<port>; links and remembered endpoints on127.0.0.1or[::1]still open and are read aslocalhost, so a returning user's stored server matches a new link.<studio>/site-editor#endpoint=…&token=…./site-editortakes the token out of the URL and keeps it for this tab only, so a reload keeps the connection. Signed in, the same link pasted into the draft selector's Local option connects a project.127.0.0.1,localhost,[::1],*.localhost).deco serve --read-only). There is no Disconnect: on/site-editorthe connection follows one rule (see "Guided site editor empty state"); in a project, choosing a draft in the selector leaves Local.PUT <server>/assets/<name>and respectdescribe.assets.maxBytes. On adeco serveconnection,/assets/…thumbnails load from the dev app.v8 content shapes.
pagesgroup, so the built-inpageand route blocks such aspostappear.Lazy<T>fields editTand save the{"__resolveType":"lazy","value":…}wrapper;lazyis never offered as a pick.multivariatewraps each variant's value inlazy; the legacy multivariate names keep plain values.status(301/302/307/308) anddiscardQueryParameters, and keep fields the editor doesn't know.Secret widget. Write-only:
describe.secrets.publicKey(RSA-OAEP/SHA-256 + AES-256-GCM, the protocol's ciphertext format). Only{"__resolveType":"secret","ciphertext":…}is sent..deco/secrets.pub.What isn't available on the protocol. Nothing renders in place, and the add-section gallery shows each block's name, description and schema
@image. Loader-backed pickers fall back to the schema's options or free text. Run, runnable loaders and actions, and app install are hidden.Settings (CMS settings block, v8). A "Settings" row in the Content sidebar opens the form of the site's well-known
CMSblock (typecms-settings: preview hosts, telemetry, analytics), from the schema. It knows only that name and type. It's offered only when the schema describes the type, so not on v7 sites or on8.1.0-next.3, and aCMSblock of another type gets an explanation instead of a form.CMS.jsonwith oneblocks.applyguarded byifMatch: { CMS: null }(b4bfc9124), so aCMScreated meanwhile, of any type, is never replaced.useSaveBlock/useDebouncedSaveBlock(SaveGuard, decided when the save runs) toapplyProtocolPatch. Only the content-protocol backend sends it.Other.
site-editoris now a reserved organization slug.agentic-cms.mdxwas dropped in the merge; see "Merged main" below for what still needs a home.Flag:
site_editor_content_protocol, off by default. It gates the GitHub-backed protocol only;/site-editorand the Local draft environment work without it. It is not inDEFAULT_ON_FLAGSand has no settings UI. Turn it on for an org withORGANIZATION_SETTINGS_UPDATE, passing{ "flags": { "site_editor_content_protocol": true } }.How Studio gets the protocol
From npm:
@decocms/[email protected](exact pin, dist-tagnext) is a dependency ofapps/api,apps/webandpackages/e2e. Nothing is vendored: the oldpackages/shared/src/vendor/blocks-protocol, itsSYNC.mdandscripts/sync-blocks-protocol.tsare gone. Every import maps to a public export:@decocms/blocks/protocolcreateContentHandler(GitHub endpoint, deco-serve e2e stub)@decocms/blocks/protocol/serverrunConformance(GitHub e2e)@decocms/blocks/protocol/conformancecreateFsStorage(deco-serve e2e stub)@decocms/blocks/protocol/storage/fsencryptSecret(secret field)@decocms/blocks/secretsThree pieces the vendored copy exposed have no public export, and the framework wasn't widened for them:
ciphertext,secrets):@decocms/shared/secret-ciphertextis a small reading of the documentedv1.<wrappedKey>.<iv>.<ciphertext>format. It checks that aSecretfield holds a well-formed ciphertext, and gives tests what they need to decrypt one. Encryption itself usesencryptSecret.storage/memory): the deco-serve e2e stub now runs the public filesystem storage in a temp working tree, likedeco serve, and reads the saved files from disk.server/assets): dropped from the stub, since no spec uploads.@decocms/blocksships TypeScript sources. Bun (API) and Vite (web) load them as they are. Playwright runs on Node, which won't strip types undernode_modules, so e2e imports the runtime pieces throughpackages/e2e/fixtures/blocks-protocol.ts. That file registers tsx first, the same way the package's owndecobin does.@decocms/blocksandtsxare on the e2e import allowlist.Async rendering is off on v8. v8 has no async rendering out of the box, so on v8 sites the site editor offers no async-render control on section rows or page SEO, and never writes a Lazy wrapper. The v7→v8 migration strips Lazy wrappers, so v8 shows no async-render UI at all. The controls appear only once Studio knows the site is v7, not while the backend is still being detected. v7 is unchanged.
Out of scope
ifSchemaMatch,ref/refsand read limits: removed from the protocol (v8 N-16: drafts are the fast-preview pointer, with only the branch's changes over the local release blocks#619). The GitHub storage is bound to the branch in the URL; since 8.1.0-next.6 itsdescribe()no longer returnsrefs/idempotency, and arefparam is rejected as an unknown parameter (Invalid params).ifMatchon ordinary saves (autosave is last writer wins). The one exception is Settings' first save, which is create-only.deco serveinside sandbox pods.Production safety
Verdict: safe to merge with
site_editor_content_protocoloff everywhere. An independent re-audit at7bd82f5b0found nothing that changes v7 sites; its two remaining code items are fixed ina01bb071f(see below). v7 behaviour equalsmain.Which sites are v8 (the
blocksMajorrule). The schema's file name (schema.gen.json/meta.gen.json) does not tell the version.deco schemawrites an explicit top-level"blocksMajor": 8, anddeco checkrejects a v8 schema without it. Studio treats a site as v8 only when its committed schema hasblocksMajor === 8(strict equality). Everything else is v7: a missing field,7,"8",9,null, a schema that doesn't parse, no schema file, or a failed GitHub read (retried every 5 s; a site already known to be v8 stays v8). The web (isV8Schema) and the API's/rpcstorage apply the same rule: on a v7 site/rpcreads as schemaless and refuses every write.Gating matrix
/rpc,/changessite_editor_content_protocol(a failed settings read answers 404)/rpcwith the flag on, v7 siteUnsupported)blocksMajor === 8at the branch headnew_blocks_editorflag as today, no badgeblocksMajor === 8mainresolve-schema)mainon every block of two real v7 metas (76 and 226 blocks)deco servediscovery, no-schema editor/site-editorroute and the protocol path onlymain; localhost probed asdeco serve(3 s) then saved as the tunnel/site-editorsite-editoris a reserved org slugdeco@decocms/blocksis a devDependency only;.bin/decois Studio's CLI8.1.0-next.7in api, web and e2eFixed after the re-audit (
a01bb071f)/rpcnow enforcesblocksMajorserver-side (repo-content-storage.ts):readSchemareturns no schema unless it is v8, andcommitthrowsUnsupported: not a Blocks v8 site. New e2e: a v7 schema over/rpcwith the flag on is not served and not written.resolve-schema.ts: array items whose$refis a union (a matcher inside Multi) stay resolved as onmain, so nested matchers keep their branch schema and defaults. Re-run over the two real v7 metas: 0 of 76 and 0 of 226 blocks differ frommain(previouslymulti.ts/negate.tsdiffered).Release order
docker buildthe API image and confirm/healthanswers (CI'sdocker-smokebuilds the sandbox image, not the API image).@decocms/blockswithBLOCKS_MAJOR(deco schemawriting"blocksMajor": 8), bump Studio's exact pin, and re-rundeco schemaand commit in each v8 site (storefront-tanstack, blog-tanstack, faststore). Until then no site is recognized as v8 (the safe failure: they stay v7)./rpc,/changes) and GitHub API usage / rate limiting for that org.How did you verify your code works?
Run on the final tree (
5d1756b52):bun run fmt:checkbun run lint(oxlint)bun run knippackages/runtime, a package this PR doesn't touch)bun run check(typecheck of every workspace)bun run testtsc --noEmitfor web, api, shared and e2e on every commit of the branchNew or updated unit tests:
pagetype for new pages;Lazy<T>and multivariate values;Upstream (Blocks protocol) tests:
vitest packages/blocks/src/protocol, 492 pass, plus a new test that a legacy secret loader block passes the secret guard.E2E.
content-protocol-deco-serve.spec.tspasses locally against the published package (4/4, and 8/8 with--repeat-each=2). With the Settings tests (b4bfc9124): 7/7 against the local framework link. Under a heavily loaded machine,refuses a link to a server off this machineonce missed its 5 s wait; it passed on every rerun.content-protocol-github.spec.tsloads and runs, but it needs the e2e API environment (the GitHub stub and its env). Against a plain dev server it fails on sign-up rate limits and on the missing stub, so CI is the signal for it.content-protocol-github.spec.ts:blocks.gen.jsonis regenerated;content-protocol-deco-serve.spec.ts:CMS.jsonwithifMatch: { CMS: null }; the second save carries no guard;CMSof another type written behind the editor's back survives the first save, and the editor explains it;/site-editorlink flow, including that the server address is shown;Lazy<T>field (stored wrapped) and a secret: the stored ciphertext decrypts with the test's key, and the plaintext never appears in storage or in a request.Run them with
bun run --cwd=packages/e2e test:e2e content-protocol. The existingdecofile-api.spec.tsandfast-preview-git-sync.spec.tsare unchanged.Screenshots/Demonstration
To add: the
/site-editorscreen (server address and folder), the "Local server" chip, the secret widget, and the page list on a v8 site.How to Test
site_editor_content_protocolfor a test org..deco/schema.gen.json.?__draft=….npx @decocms/blocks serve --preview localhost:<app port>(with the app's dev server running) and open the/site-editor#endpoint=…link it prints (no token:deco servehas none)./site-editor#endpoint=https://example.com/rpc&token=x: you should see "This site editor link is incomplete", in the New Layout whatever the preference says./rpcand/changesreturn 404.Migration Notes
site-editoris now a reserved org slug. Before deploying, confirm no existing organization uses it (SELECT id, slug FROM organization WHERE slug = 'site-editor';must return no rows); I couldn't check production data. The check is also documented next to the route inapps/web/src/router.tsx.Follow-ups
8.1.0-next.7to the stable@decocms/blocks@8once it's released.ifMatchon every save, with managed drafts.deco servein sandbox pods, so sandbox sessions on v8 sites can use the protocol.Review Checklist
/site-editoris reachable only by URL; the Local option keeps today's tunnel behaviour for any non-deco serveURL)🤖 Generated with Claude Code
https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig
Draft previews: the Fast Preview pointer, changes only
v8 keeps v7's Fast Preview protocol: the site gets a
?__draft=pointer and fetches it. The only change is what the pointer answers: what the draft branch changed against production, not the whole decofile. The site'scms.forDraft(pointer)layers it over the production content it already has (blocks docs:/next/content-delivery#draft-previews; SDK side: decocms/blocks#619).Pointer (same shape as v7, with a
/changessuffix)<apiHost>/api/<org>/decofile/<vmcp>/<branch>/changes?token=<draft token>@<revision>.signDraftToken): HMAC-signed, scoped to org, project and branch, 6 hours./rpcanswer (session only, so a draft token can never mint another) carries it in theX-Deco-Draft-TokenandX-Deco-Api-Hostheaders. The editor's protocol client stashes it, and replaces it only an hour before its 6-hour expiry, so polling doesn't reload the preview iframe. There is no separate token route.Answer (
GET .../changes,apps/api/src/decofile/draft-changes.ts){format: 1, set: {name: block JSON}, delete: [names]}, computed from Git on every request. Nothing is prepared or stored.RepoContentClient.mergeBase(GitHub:compare?per_page=1, reading onlymerge_base_commit; GitLab/Bitbucket: their merge-base endpoints), never the full compare payload, so a branch far from production doesn't time out:getBranchcall. A new save is a new head.{format: 1, set: {}, delete: []}), so a pointer minted before the first save works.Cache-Control: no-store,Access-Control-Allow-Origin: *.{error, file}names it), 502 for the Git provider./changesthe way the v7 anonymous read projects them (projectPlanningPostsForPreview), so they don't show in v8 previews yet. Documented; blog-tanstack doesn't use drafts today.v7 unchanged
GET .../:branchandPATCHbehave exactly as on main: whole decofile for the anonymous?token=read, and a fresh token on every editor read and write.Editor
useProtocolDraftbuilds the pointer from the stashed token and the current revision. There is no readiness state: until the first/rpcanswer there is no pointer, as with v7 before its first read.Tests
draft-changes.test.ts: merge base, aliases,__proto__, app roots, missing branch, size limit, delete-only branch, rename (delete + set), deleting the winning spelling of an aliased name, malformed block JSON, per-head reuse.content-protocol-github.spec.ts): flag off and anonymous access,/rpcanswers carry the token and a token can't call/rpc, a save shows only its changes in/changes, the token is scoped to its branch, and the v7 read of the same branch still returns the whole decofile.decofile-api.spec.ts(v7) is unchanged.Replaced the overlay delivery with the changes pointer
POST .../preview,revisionOnBranch,GET .../site-connection, the/rpcpost-commit overlay hook, overlay uploads to object storage,/api/_delivery(draft-delivery.ts), overlay grants and site tokens, the "Preparing preview" state anddraft-preview-loop.test.ts(it ran the overlay SDK; the changes SDK isn't published yet).draft-token.ts,paths.ts,key-utils.tsandorg-fs.tsare back to main.Testing v8 locally
/site-editor(no account): a top-level route that is not gated: no org flag and no preference. It always renders in the New Layout (the project-first app takeover), even when the user's New Layout preference is off; a route-scoped override (ForceProjectFirstNav, set only byroutes/site-editor.tsx) does that without a second copy of the layout. It opens the same Site Editor app a project launches (its Preview and Content tabs; Preview has the page picker; Content edits blocks and saves throughdeco serve), full screen with no sidebar. Hosted features are hidden: no chat, GitHub, drafts, publishing/releases or Code tab. It talks to a localdeco serveover the content protocol. The connection arrives in the URL (/site-editor#endpoint=…&token=…); Studio removes the token from the address bar, keeps it for that tab only, and strips it from analytics. Only servers on this machine are accepted./:org/:project/site-editor(and its Content and Code tabs) and at/site-editor. Signed in on/site-editor, the rail lists the user's orgs, then the Site Editor entry, highlighted (aria-current="page", linking to/site-editor); signed out there is no rail. There is no org there, so no recent app is recorded.storefront-tanstack(feat/next-major,@decocms/[email protected]) withdeco serve --preview localhost:5190, driven with Playwright, signed out at/site-editorand signed in through a project's Local environment: the schema loads (recursive commerceProducttypes no longer freeze the tab), the preview frames the real storefront, a text edit lands in.deco/blocks/pages-home.jsonand shows in the preview about 2s later, and Replace image uploads throughdeco serve(/assets/<name>). Site-side fixes that made this work: frame loads getframe-ancestorsfor Studio instead ofX-Frame-Options: SAMEORIGIN,vite devskips the edge cache, and the dev server reloads open pages when the content module changes.deco servereports the app URL in the content protocol's describe (describe.preview.url). Set it withdeco serve --preview localhost:8001(host:port or a full URL); by default it readsserver.portfrom the Vite config, elsehttp://localhost:5173. Studio loads it in the Preview tab only if it is a loopback URL. The signed-in Local draft environment uses the same value.deco servelink and Studio checks the server answers, then switches the project to v8 (inline errors when the server stopped or restarted with a new token). Any other URL is a tunnel, handled exactly as today (v7). Works for every org without a flag; the GitHub-backed protocol stays behindsite_editor_content_protocol.x-deco-matchers-override, so a variant tab forces its variant in the preview's?__draft=pointer instead. It adds one reserved__variant=<block>@<path>=<index>parameter per forced variant, andcms.forDraftapplies them (v8 N-15: preview a forced variant through the draft pointer; dev reload recipes blocks#618). For localdeco serveit is a pointer to the serve endpoint carrying only the forced variants, never the token. On the GitHub backend they go into the Fast Preview pointer. v7 projects keep the header. Verified live against storefront-tanstack: variant 2 shows on its tab, variant 1 comes back on its tab, and a forced variant survives the reload after a save.v8badge with a tooltip in the header of/site-editorand the signed-in site editor, on v8 sites only. v7 sites show nothing new./site-editor(no org) and signed in, whatever the org'snew_blocks_editorflag; v7 sites keep following the flag. While the site's version is detected the editor stays in its loading state instead of flashing the old one (bbf06e2).Guided site editor empty state
/site-editorfollows one rule, with no way to disconnect:#endpoint=…, which wins), or else the last one used in this browser, then the default127.0.0.1:4545.The empty state explains the site editor, shows the
deco servecommand to copy (with--allow-origin <origin>when Studio isn't on an official address), the "Looking for deco serve on …" line, and docs links.deco serveon another port prints a link with#endpoint=…; opening it is how you reach that port (there is no address field). On a deployed Studio that doesn't have Chrome's local-network permission yet, a single "Look for deco serve on this computer" button starts the search, so Chrome's prompt comes after a click; a denied permission is explained.Guided messages remain only where the server answered but can't be used: out of date (asks for a token), version mismatch, another program on the port, an error, and read-only (chip). Verified headless with Playwright: a fresh context with nothing on 4545 shows the empty state;
/site-editor#endpoint=http%3A%2F%2F127.0.0.1%3A4547%2Frpcopens the storefront editor; stopping the server returns to the empty state and restarting it reopens the editor; no disconnect control anywhere.No schema yet (
72ce0c33c): without.deco/schema.gen.json, the editor (/site-editorand the Local draft) still opens. Content lists every saved block grouped by__resolveType; a block opens as plain fields inferred from its JSON plus the raw JSON editor, and a save keeps every untouched value exactly; Preview's Blocks panel shows the current page the same way. One banner (npx @decocms/blocks schemawith copy, docs link) goes away on its own when the schema appears. Readsschema.get's newschema: null(decocms/blocks#619766b0ff7) and an older server's NotFound alike. Verified headless with Playwright on a storefront-tanstack copy with the schema removed: list, open, edit and save round-trip, thendeco schemaand the banner left.Framework side: decocms/blocks v8 stack #602–#614 (spec: decocms/blocks#585). Studio consumes it as
@decocms/[email protected]from npm.🤖 Generated with Claude Code
https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig