Skip to content

feat(api,studio): playground mode (RFC-0036 phase 2) - #23

Merged
Madraka merged 1 commit into
mainfrom
feat/playground-mode
Oct 20, 2026
Merged

Madraka merged 1 commit into
mainfrom
feat/playground-mode

Conversation

@Madraka

@Madraka Madraka commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

RFC-0036 phase 2 (ADR-0038, #10). Independent of phase 1 (#22).

API (packages/api/src/playground.ts)

  • isBlockedInPlayground(method, path): pure deny list (auth, people, keys, mcp, uploads, outbound, transfer, sites, domains, agent, schedules) plus an allow list; a route on neither is refused as unclassified. The test walks every ROUTE_SCOPES entry: each is on exactly one list, and every allowed route is passable by the playground principal.
  • PLAYGROUND_PRINCIPAL (user_playground, role editor): Editor scopes + site:settings, without asset:manage (it implies asset:upload), members:invite, commenters:data, automations:manage. Never *, site:create, members:manage, agents:manage.
  • createApi({ playground: { info, maxBodyBytes } }): guard middleware first (403 {error:"playground", block}, 413 over 200 KB), principal fixed, scopes checked as for a member (routeGuard membership on), features.playground in /api/instance. resolvePrincipal moved into a helper to keep createApi within its size baseline; scopes.ts exports matchesRoute/routeFor.

Studio

  • PlaygroundBar block (compact secondary Kumo Banner: minutes left as ICU plural + privacy note, Reset, Deploy to Cloudflare), under the top bar on every screen; DESIGN.md §2af.
  • requireSession accepts a 403 from /api/auth when /api/instance reports a playground (there is no Better Auth there).
  • Account surface leaves out Agents, Team, Account (nav, palette, user menu, sign-out); a direct visit shows PlaygroundUnavailable ("Available in your own install").
  • 6 new strings, translated into all 18 languages via pnpm i18n:import (AI drafts awaiting review).

RFC deviations (written into the RFC once #10 is on main, in this PR or phase 3): the block union gains schedules and unclassified; the actor id is user_playground (the existing user_ prefix); media-library changes are blocked too (a session's media are the read-only demo pack).

pnpm check green locally (run alone).

🤖 Generated with Claude Code

RFC-0036 phase 2. createApi({ playground }) answers every request as the
fixed PLAYGROUND_PRINCIPAL (Editor scopes plus site:settings, without
asset:manage, which implies asset:upload, inviting, commenter data or
automations), mounts the pure isBlockedInPlayground guard (403
playground) with a body limit, checks scopes as for a member, and
reports features.playground in /api/instance. Every route in
ROUTE_SCOPES is either denied or allowed; one on neither list is refused
as unclassified, and a test walks them all.

Studio: a PlaygroundBar block (session bar with minutes left, Reset and
Deploy to Cloudflare), requireSession accepts a playground without
Better Auth, and the team, agent and account screens are left out with
an "Available in your own install" note. New strings in every language
(AI drafts).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Madraka <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 20, 2026 15:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@Madraka
Madraka merged commit e056dd8 into main Oct 20, 2026
4 checks passed
@Madraka Madraka mentioned this pull request Oct 20, 2026
Madraka added a commit that referenced this pull request Oct 20, 2026
feat(api,studio): playground mode (RFC-0036 phase 2)
Madraka added a commit that referenced this pull request Oct 20, 2026
The public playground (RFC-0036): Durable Object SQLite storage (#22),
playground mode in the API and Studio (#23), and the playground Worker
and PlaygroundSite Durable Object (#24).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Madraka <[email protected]>
@Madraka
Madraka deleted the feat/playground-mode branch October 20, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants