# Script Writer workspace

Use the existing Narrative Compiler as a typed, versioned production Block.

Script Writer (`sm.script@1.1.0`) reuses the full Narrative Compiler: reference
transcripts, writing and optional research, review, inline edits, revision chat,
saved scripts, learned voices, and version history. Open its listing in Marketplace
or the Block library, then choose **Use in studio → Open workspace**. It is no
longer an account-menu utility. Starting Chat remains separate and protected.

The manifest and adapter are in `packages/block-platform/script-writer.js`.
They use the same SDK `validateValues` and `resolveContextInputs` contract as other
Blocks. `client/src/components/ScriptWriterBlock.jsx` mounts the existing UI.

- Primary `input`: optional `brief` document (schemaVersion 1) with production
  planning context. The app supplies the project title and conversation. A Step
  can prefill the topic with `config.input: {schemaVersion: 1, topic: "Your topic"}`.
- Secondary `script`: optional `script` document from `context.script.read`,
  containing `{schemaVersion: 1, text: "Current narration"}`.
- Primary `output`: `script`, semantic role `narration_script`, containing
  `{schemaVersion: 1, text: "Accepted narration"}`. Empty scripts, non-text values,
  and text over 200,000 characters are rejected.

**Use this script** validates the output and updates the shared project narration.
The recommended workflow is **Script Writer → Voiceover**; its compatible typed
connection is implemented through the shared narration document, without graph
nodes or wires. Opening the Block does not generate a script or charge credits.
Existing writing and research actions retain their displayed prices and server
billing checks. A viewer cannot write; accepting a stale draft cannot overwrite a
teammate's changed narration.

The version-addressed source download includes the current wrapper, Narrative
Compiler, local source dependencies, and this SDK. This is a trusted built-in host workspace, not
an arbitrary React package admitted by the external sandbox. External imports
still support recipe and isolated JavaScript runtimes; changing an imported
manifest to `runtime: host` cannot load privileged workspace code.
