Set Doc Role
Flip one reference doc between ‘process’ and ‘context’ (D1 doc roles — the chip toggle). Text docs are role-LOCKED to context (400). A same-role PATCH is an idempotent no-op (200, no event). A real flip appends a USER-actor activity event (consumable — the brain learns and reacts) and ticks the session. Flipping to context does NOT cancel in-flight runs — runs pin their inputs at launch (chronology honesty).
Authorizations
Body
PATCH /sessions/{id}/docs/{doc_id} — flip one reference doc's role (D1 doc roles). Text docs are role-LOCKED to context (400).
process, context Response
Successful Response
Surface count of doc_kind surfaces: pages for page docs, SHEETS for sheet docs (spreadsheets have no pages — sheet path, plan A7). Always None for text docs.
What page_count counts (the locator surface vocabulary); 'text' = context-only .md/.txt doc. None = legacy row, page semantics.
page, sheet, text What the doc is FOR (D1): 'process' docs are exercised by commits/launches; 'context' docs feed the agent's context and never launch runs.
process, context True for text docs — they can only be context (no converter on the agent path covers text).