# Interface and packaging
URL: /documentation/extensions/interface-and-packaging



## Goal [#goal]

Ship a source change — a new tool, skill, routine, or detector — so that an already-installed Codex or Claude Code session actually sees it, with the widget, the manifests, and the trust attestation all agreeing on the same build.

## Before you start [#before-you-start]

* Know where the source actually lives. Three source trees feed the one shipped artifact at `plugins/strata19/`:

| Source                                                                                              | Ships as                                    | Built by                                                       |
| --------------------------------------------------------------------------------------------------- | ------------------------------------------- | -------------------------------------------------------------- |
| `src/mcp/facade/*.ts` — every tool handler, the stdio server, the specbook pipeline, model-assist   | `plugins/strata19/server/facade-stdio.js`   | `pnpm build:plugin` (esbuild)                                  |
| `apps/web/src/components/strata19/*.tsx` — the workspace widget tabs plus `data/strata19-client.ts` | `plugins/strata19/widget/workspace.html`    | `pnpm build:plugin` (vite)                                     |
| `plugins/strata19/assets/icon.png` — the brand mark                                                 | `plugins/strata19/assets/composer-icon.png` | `node scripts/strata19/build-brand-assets.mjs`, run separately |

Everything else under `plugins/strata19/` (`.codex-plugin/plugin.json`, `.mcp.json`, `hooks/`, `skills/`, its README) is hand-edited directly — no generator writes those. &#x2A;*Never hand-edit `server/facade-stdio.js` or `widget/workspace.html`** — both are generated and committed for a zero-build install, and the next `pnpm build:plugin` silently overwrites hand edits.

## Steps [#steps]

<Steps>
  <Step>
    ### Wire the projection before touching the widget [#wire-the-projection-before-touching-the-widget]

    A new interactive tool result is a projection over four independent, forced decisions in `src/mcp/facade/tool-projection-registry.ts`: `exposure` (is it advertised, and to whom), `presentation` (does a human see a card, a route, or text), `widgetCall` (may the sandboxed frame invoke it, and which of its actions), and `skillOwners` (does any packaged skill teach it). Nothing here is inherited from an omission — a text-only tool carries a named reason (`host_orientation`, `transport_utility`, or `fully_actionable_text`), and a withheld widget permission carries one too.
  </Step>

  <Step>
    ### Add the view model, if the tool renders a card [#add-the-view-model-if-the-tool-renders-a-card]

    `presentation.kind: 'compact_domain_card'` needs a matching branch in `buildViewModel`/`buildWidgetProps` (`src/mcp/facade/view-models.ts`). A registry entry with no matching branch is exactly how `strata19.manage_recommendation` once mounted a workspace template with neither a card nor a route, and its compact rendering fell through to a terminal `No data`.
  </Step>

  <Step>
    ### Grant widget-call access deliberately, if at all [#grant-widget-call-access-deliberately-if-at-all]

    If the widget frame should be able to invoke the tool directly, add its name to `WIDGET_ACCESSIBLE_TOOLS` in `src/mcp/facade/app-resources.ts`, and set `widgetCall.actions` in the projection registry to the **exact** action-enum values the widget dispatches — least privilege: granting the tool without naming actions hands the sandboxed frame every action it supports, including writes it never calls. `assertWidgetAccessibleToolsMatchRegistry()` in the same file runs eagerly at module load and throws if the two disagree.
  </Step>

  <Step>
    ### Bump the version in exactly one place [#bump-the-version-in-exactly-one-place]

    ```
    plugins/strata19/.codex-plugin/plugin.json  →  "version"
    ```

    Do not hand-edit any other manifest. `plugin.json` is the single source of truth; the next step byte-surgically propagates it. As of this writing that is **seven** downstream manifests plus one baked literal — eight surfaces from one edit, registered in `scripts/strata19/version-surfaces.mjs`'s `VERSION_DOWNSTREAM_MANIFESTS`:

    * `marketplace.json` (repo root)
    * `.claude-plugin/marketplace.json` (repo root)
    * `plugins/strata19/.claude-plugin/plugin.json` (Claude Code)
    * `plugins/strata19/server/package.json`
    * `plugins/strata19/server/package-lock.json` (twice — top level and `packages[""]`)
    * `plugins/strata19/plugin.json` (Antigravity)
    * `plugins/strata19/manifest.json` (Claude Desktop / MCPB bundle)
    * `serverInfo.version`, baked into `server/facade-stdio.js` at build time

    Adding a new version-bearing manifest without adding it to that registry is the whole failure mode this list exists to prevent — do both in the same commit. Bumping is not optional even when nothing else changed: the host cache is version-keyed, so pushing new code under an already-installed version reuses the cached directory and ships nothing.
  </Step>

  <Step>
    ### Rebuild [#rebuild]

    ```bash
    pnpm build:plugin
    ```

    One command, three steps in order: `node scripts/build-plugin.mjs` (regenerates `server/facade-stdio.js` and `widget/workspace.html`, propagates the version into the seven downstream manifests) → `pnpm gate:plugin` (credential/path/dev-artifact scan, re-run on the just-rebuilt tree, plus a check that all version surfaces now agree) → `tsx scripts/strata19/host-smoke-matrix.ts` (spawns the freshly built bundle and probes it as a real host would). Build runs before the gate deliberately — checking agreement before propagation always fails on the version bump itself.

    `build:plugin` also writes the `strata19TrustedArtifacts` block into the two root marketplace manifests: the SHA-256 of every shipped payload artifact, generated last so it covers the final bytes. This is GC-01's trust root for marketplace installs — see the detector's own `dispositionReason` in [Add a detector](/documentation/extensions/detectors) for what happens without it.
  </Step>

  <Step>
    ### Commit and push [#commit-and-push]

    Do not push `plugin-dist` by hand. `pnpm release:plugin` is the one release command: it refuses a dirty tree, a checkout that is not on `origin/master`, and any version that is not strictly higher than the one on `origin/plugin-dist`, the highest `strata19--v*` tag and `latest.json`; then it bumps, builds, gates, commits, publishes `plugin-dist` **with history** (fast-forward only, never forced), tags the result `strata19--v<x.y.z>`, pins the marketplace `ref` and `sha`, attaches the release assets and publishes `latest.json`. Use `--dry-run` to see what it would do. The payload reaches users via `plugin install`; the root marketplace manifests reach them via `plugin marketplace update` — two different refs, fetched by two different host commands, on independent refresh cadences.

    To go back, `node scripts/release/release-plugin.mjs --rollback <x.y.z>` rewrites the marketplace `ref`, `sha`, version, trust block and `latest.json` together from the tagged release.

    `pnpm gate:plugin-version-guard` runs in CI: a change to the shipped bundle that does not also raise the version fails, because hosts cache by version and the change would otherwise ship nothing.
  </Step>

  <Step>
    ### Reinstall and verify it landed [#reinstall-and-verify-it-landed]

    ```bash
    codex plugin add strata19@strata19
    ```

    Reinstalls from the marketplace into a fresh version-keyed cache directory. Trust the reinstall log for nothing — diff the actual bytes:

    ```bash
    diff -q plugins/strata19/server/facade-stdio.js \
      ~/.codex/plugins/cache/strata19/strata19/<version>/server/facade-stdio.js
    diff -q plugins/strata19/widget/workspace.html \
      ~/.codex/plugins/cache/strata19/strata19/<version>/widget/workspace.html
    ```

    Both should report no difference. If a widget or a tool doesn't reflect a change you just made, this is almost always why — the version wasn't bumped, the build didn't rerun, or the reinstall didn't happen.
  </Step>
</Steps>

## Verify [#verify]

```bash
pnpm audit:projections            # projection registry vs. live facadeTools registry
pnpm gate:mcp-tools-list:plugin-artifact   # tools/list against the just-built bundle, not dist/
pnpm verify:strata19-checksums    # CHECKSUMS.json vs. the committed artifact bytes
pnpm verify:strata19-plugin-parity
```

`gate:mcp-tools-list:plugin-artifact` matters specifically because the default `pnpm gate:mcp-tools-list` only ever validated `dist/mcp/facade/facade-stdio.js` — never the file a real host loads — so a source fix could be gated green while the last released artifact still shipped the pre-fix payload. `verify:strata19-plugin-parity` runs that check itself as part of its own pass, against whatever currently sits in `plugins/strata19/server/facade-stdio.js`.

## If it doesn't work [#if-it-doesnt-work]

* **`pnpm build:plugin` fails saying a downstream manifest has no `"version"` field.** A version-bearing manifest exists that isn't registered in `VERSION_DOWNSTREAM_MANIFESTS` — register it and add the version field in the same commit.
* **`pnpm gate:plugin` finds a `node_modules` directory under the plugin tree and fails the build.** This plugin ships as a filesystem copy — `.gitignore` has no effect on what the marketplace copies. Remove `plugins/strata19/server/node_modules` (from a native `npm install` you ran locally) before rebuilding.
* **`GC-01` refuses with "covers version X but this install is Y."** A release skipped `build:plugin` and hand-edited versions, so the trust attestation covers a different build than what's installed — fix the release by rebuilding properly, not by routing around the check.
* **Your host's marketplace snapshot names an older version than the plugin build you have installed.** Refreshing the marketplace and updating the plugin are different commands — run `codex plugin marketplace update strata19` (or the Claude Code equivalent), separately from `codex plugin add strata19@strata19`.
* **The widget shows a blank frame or a permanent "refreshing…".** First establish which deployment you are debugging, because the requirements are different. With `STRATA19_WEB_BASE` unset — the default, and the whole Free Local tier — the widget is the self-contained bundle inlined at build time (`src/mcp/facade/app-resources.ts`), so there is no web app to reach and nothing to configure; a blank frame there means the bundle is missing from the build, not that a URL is unset. The hosted path is reached *only* when `STRATA19_WEB_BASE` is explicitly set, and only then do its requirements apply: the web app must be reachable, the base must be `https://` (an https-sandboxed widget iframe cannot frame `http://localhost`, independent of CSP), and for `next dev` specifically the tunnel host must be in `allowedDevOrigins`.
* **You rebuilt and the change still isn't visible in a running session.** The plugin cache is version-keyed; editing source and even running `pnpm build:plugin` changes nothing a running session sees until you bump the version and reinstall. This is the single most common way to lose an hour on this loop.

## Related [#related]

* [Add an MCP tool](/documentation/extensions/mcp-tools) — the projection fields this page's step 1 assumes you already understand.
* [Add a detector](/documentation/extensions/detectors) — GC-01's trust root, referenced above, gates one specific detector on the artifact this page's rebuild step produces.
* [Test an extension](/documentation/extensions/testing) — the package- and release-boundary tests that exercise the artifact this loop produces.
* [`reference/limits`](/documentation/reference/limits) — what the trust attestation does and does not prove.
