> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tuturuuu.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Co-programming permissions

> Who may edit, run and show cursors in a meeting's Co-programming room, how hosts grant access live, and where each rule is enforced.

## Product decision

Decision (4 December 2026). Status: implemented.

Scope: the Co-programming activity in Meet calls (`apps/meet`, and Parley where
it embeds the Meet call). One rule also reaches standalone shared playgrounds,
because their code rooms run on the same server: a view-only participant's
cursor, selection and pointer are hidden from everyone else. Edit and run rights
outside meetings are unchanged.

Default: only the host and room admins may edit the shared code, run it, and
broadcast their cursor, selection and pointer. Everyone else is view-only. They
follow the code live, can scroll and copy it, and see run results.

## Host controls

Room admins open **Permissions** above the shared code:

| Control | Effect |
| - | - |
| Per-person Edit / Run switches | Grants or revokes that person's edit or run right. |
| Everyone can edit | Every participant may edit. |
| Everyone can run | Every participant may run. Run stays bounded by the existing runner limits. |
| Show everyone's cursors | View-only participants' cursors and selections reach the room. |
| Raised hands | Approve grants edit and clears the request; decline clears it. |
| Take back control | Clears every grant, request and room-wide switch. |

A participant who may not edit sees **Ask to edit**. A raised hand reaches every
room admin as a toast with Allow and Decline. A participant who tries to type
while view-only sees a hint pointing at **Ask to edit**.

Changes apply live and last for the session: the policy is part of the room's
settings (`settings.programmingAccess`), not the database.

## Permission matrix

| Person | Edit | Run | Cursor broadcast |
| - | - | - | - |
| Host | Always | Always | Always |
| Room admin (assigned co-host or event co-host) | Always | Always | Always |
| Participant with an edit grant | Yes | Only with a run grant | Yes |
| Participant with a run grant only | No | Yes | Only when cursors are shown |
| Any participant, "Everyone can edit" on | Yes | Per run rule | Yes |
| View-only participant | No | No | Only when cursors are shown |
| Problem rooms where the learner subject is read-only | No | No | Per rule above |

## Enforcement

* **Room service** (`packages/realtime/src/meet/room-programming-access.ts`):
  the room applies `programming.access.set` only for room admins, on its own
  token. `programming.read` returns the caller's capabilities. The shared run
  receipt (`programming.run`) needs run permission.
* **Meet API** (`packages/meet-core/src/features/call/server/programming*.ts`):
  join tickets carry `owner` for the host, `editor` for people allowed to edit,
  and `viewer` for everyone else. Run, stop and problem tests return `403`
  `PROGRAMMING_RUN_FORBIDDEN` without run permission, and compile checks return
  `403` `PROGRAMMING_EDIT_FORBIDDEN` without edit permission. If a room answers
  without capabilities, only the host keeps edit and run.
* **Code room** (`apps/meet-realtime/src/collaboration-access.ts`): a viewer's
  document update is never applied or relayed. The room answers `rejected` and
  the browser rebuilds its document from the room. On a revocation the Meet API
  pushes a signed `/collaboration/access` request. That request drops the revoked
  editors' sockets to viewer at once and sets whether viewer cursors are relayed.
  The push carries the policy revision, and the room ignores one older than the
  last revision it applied. It also records when each editor was revoked. An
  editor ticket issued before that time acts as viewer, so a cached ticket
  cannot regain edit during its 60-second lifetime. Seed and join tickets carry
  the cursor switch and its revision, so a new or reseeded code room starts with
  the current policy. When a co-host loses room admin, a room admin's browser
  asks the room to re-check that person. The room reports them revoked only
  when they no longer hold edit. If a push fails, the 60-second ticket expiry
  bounds the revocation. A push is one bounded request per change and starts no
  runner work. Permission changes are limited to 60 per actor per minute and
  raised hands to 10.

## Deployment

Deploy `apps/meet-realtime` together with the Meet app, or before it. Meet
tickets carry new optional fields (`iat`, `viewerCursors`, `accessRevision`),
and an older code-room Worker rejects them. An older Meet app with a newer
Worker keeps working: its tickets omit the fields, and its rooms fall back to
the host-only default. A policy push without a revision is read as revision 0;
it still demotes the editors it lists but cannot override a newer cursor
switch.

## Participant tools

The strip above the code shows the person's role badge (Admin, Editor or
Viewer) and who is editing. It also holds **Follow host** (keeps the host's file
and cursor line in view), run history for the session, text size, and **Ask to
edit**. **Start fresh** asks for confirmation before it replaces the room's code
with the language's starter code.

## Regression coverage

* `packages/realtime/src/meet/room-programming-access.test.ts`: defaults, live
  grant and revoke, take back control, non-admin refusal, and the raise-hand flow.
* `packages/meet-core/src/features/call/server/programming-access.test.ts`:
  rejected runs, stops, tests and checks; viewer and editor tickets; fail-closed
  older rooms; and the live push.
* `apps/meet-realtime/src/collaboration-access.test.ts`: socket downgrade,
  forged pushes, and viewer cursor stripping.
* `packages/meet-core/src/features/call/components/programming-access-ui.test.tsx`:
  badges, raise hand, the Permissions popover, the live grant, the request toast
  and the view-only hint.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.