Files
PaperClipAI/packages/paperclip-runner/docs/live-console.md
T
Dotta 560e7e48b5 feat(runner): add SDK and developer tooling (#12608)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - The runner package already provides the production protocol and
execution spine.
> - Contributors still need stable SDK surfaces, deterministic test
tools, and local inspection tools.
> - Those surfaces share generated contracts and must change as one
package boundary.
> - This pull request adds the package-local SDK, labs, examples, and
drift checks.
> - The benefit is a reviewable developer platform that does not change
application execution selection.

## Linked Issues or Issue Description

**Subsystem affected**

`packages/paperclip-runner` — runner SDK, conformance tools, and
developer tooling.

**Problem or motivation**

The production runner spine is present, but package consumers cannot
build deterministic integrations, inspect sessions, or verify
provider-neutral behavior through supported surfaces.

**Proposed solution**

Add browser, React, standalone, live-session, scenario, conformance, and
evaluation surfaces. Add generated contract inventories and
package-local verification scripts. Keep production application routing
unchanged.

**Alternatives considered**

We considered splitting each generated catalog, SDK surface, and demo
into separate pull requests. Those changes share exports, fixtures, and
drift gates. Splitting them would create intermediate package states
that do not build.

**Roadmap alignment**

No overlapping item appears in `ROADMAP.md`. This work extends the
runner package that is already on `master`.

## What Changed

- Add browser, React, standalone, live-session, and issue-thread SDK
surfaces.
- Add deterministic mock control-plane, scenario, conformance, replay,
and evaluation tools.
- Add bounded Codex, OpenCode, and ACPX development transports and
fixtures.
- Keep deferred managed-provider execution fail-closed. Persisted
compatibility data remains readable.
- Add generated capability inventories with their source files and drift
checks.
- Add examples, package documentation, browser checks, and
clean-consumer checks.
- Preserve the reviewed protocol bounds, replay compatibility aliases,
process environment isolation, and semantic redaction limits.
- Update the ACPX package patch that the existing workspace patch
registry already tracks.
- Do not change `pnpm-lock.yaml`, repository workflows, server runtime
selection, or the application UI.

## Verification

GitHub Actions is the verification authority for this pull request. The
repository CI, package TypeScript and Rust checks, package tests,
generated-output drift checks, browser checks, security scans, and
Greptile review must pass on the exact head.

Local test suites were not run because this series uses parallel GitHub
Actions for verification.

## Risks

This is a large greenfield package change. The main risks are public
export drift, generated-output drift, and optional React consumer
compatibility. Package boundary checks, clean-consumer checks, and
browser tests cover those risks. Production adapter selection and server
execution are outside this pull request.

## Stack

1. **This PR:** runner SDK and developer tooling.
2. [Codex production server
integration](https://github.com/paperclipai/paperclip/pull/12616).
3. [Provider-neutral task-thread
UI](https://github.com/paperclipai/paperclip/pull/12617).

## Model Used

OpenAI Codex, GPT-5, high-reasoning mode, with tool use and code
execution.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have described the issue in-PR following the feature request
template
- [x] I have not referenced internal/instance-local Paperclip issues or
links
- [x] My branch name describes the change and contains no internal
Paperclip ticket id
- [ ] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge
2026-08-31 21:33:11 -05:00

6.7 KiB

Live console Live Console

Scope

This is the browser layer of Live console. It adds a Live console mode to the existing standalone devtool in devtools/browser/. It builds on the protocol and demo server and follows the approved interaction map and component decision record.

Every file lives under packages/paperclip-runner/. The console does not import or change Paperclip server, UI, database, or control-plane code.

Start it

pnpm --filter @paperclipai/paperclip-runner console:live-console

Then open http://127.0.0.1:4180/ and choose Live console.

Live console is deliberately loopback-only. A wildcard or LAN --host fails startup because this developer console can start provider-backed turns and resolve approvals. There is no unauthenticated remote mode.

Two environment variables change the driver behind the console:

Variable Default Effect
PAPERCLIP_LIVE_CONSOLE_DRIVER demo codex starts the real codex app-server driver behind the same routes
PAPERCLIP_LIVE_CONSOLE_CHUNK_DELAY_MS 45 Milliseconds between streamed chunks in the demo driver

Where state comes from

The console has one data contract: the canonical PRP event stream and the SessionSnapshot the shared reducer produces from it. There is no second event model, no message store, and no client-side session cache.

  • The browser reduces the events it receives with the same applyPrpEvent the server and the CLI use, so a live session and a replayed session project identically. The inspector's Session tab reports that comparison as match or mismatch.
  • Transcript order is the reducer timeline order. Nothing is re-sorted.
  • Lineage, goal state, pending requests, and the durable cursor come from the demo server's public state, which is refreshed whenever new events arrive.
  • The steering chip is the only local UI intent. It resolves to acknowledged, rejected, or failed from canonical facts and never merges text into the transcript before an acknowledgement.

Surfaces

Surface Source of truth Notes
Transcript reducer timeline and items user messages come from turn.submitted payload text
Composer composer state machine one visible primary action: Send, Steer, or Stop
Steering chip steering_acknowledgement item or a rejection code rejected text stays recoverable with Send as new message
Request card runtime_request.* events renders only the actions the upstream request offers
Goal banner and menu capability snapshot and goal events unsupported verbs are disabled with the exact diagnostic
Lineage tree driver thread lineage child steering is shown as unsupported, never emulated
Connection block transport status and durable cursor includes a deliberate connection-loss control
Inspector raw canonical events four tabs: Events, Requests, Capabilities, Session
Replay stepper recorded canonical events marked with a REPLAY eyebrow badge

Interruption races

The console distinguishes all three races the spec requires:

Race What the console shows
interrupt before start the pending turn resolves to Cancelled before start; no assistant item is ever created
interrupt during generation the stream stops in place, the partial text stays, and an interrupted divider is added
interrupt during a tool call the tool item keeps its last known status with no fabricated result

Escape in the composer moves focus to Stop. It never interrupts directly, because a destructive action needs an explicit activation.

Demo chats

The demo server owns the manifest catalogue and serves it at GET /api/liveConsole/manifests. Each manifest names the scenario it proves and the observations a human should confirm; the console renders that list as a checklist rather than restating it in the UI.

Manifest Proves
completion streaming, reasoning, tool, answer, structured result
steering same-turn steering acknowledgement and stale-turn rejection
interrupt-before-start cancellation before the provider accepts the turn
interrupt-during-generation preserved partial text
interrupt-during-tool preserved tool status with no fabricated result
approvals command and file-change approvals, single-response guarantee
user-input typed answers and request expiry
subagents parent/child lineage and unsupported child steering
goals set, view, pause, resume, clear
goals-unsupported exact capability diagnostic instead of a hidden control
failure failed item and failed turn inside the record

Manifests run in any order. Reset demo state names exactly what it discards and leaves recorded evidence files untouched.

Credentials

No provider or Paperclip credential reaches the browser. The Node process owns the driver, the working directory, and any provider login. Every JSON and event frame passes the demo server's redaction layer, and the inspector renders redaction markers verbatim without attempting to reconstruct them.

The live console and standalone server share one transport admission guard: exact loopback Host/port, loopback sockets, same-origin Origin and Fetch Metadata, plus JSON-only mutations. Browser reset closes the server session; active sessions and SSE subscribers are hard-capped. Local untrusted processes remain a residual risk, and the Codex sandbox/approval policy is the final execution boundary.

Components

Adapted from shadcn/ui and Vercel AI Elements source, rewritten in the package's local idiom, with zero new runtime dependencies:

  • AI Elements: conversation, message, composer, reasoning-item, tool-item.
  • shadcn/ui: tabs, menu, dialog, tooltip, banner.

scripts/check-forbidden-imports.mjs fails the build if anything under devtools/browser/ imports ai, @ai-sdk/*, zod, radix-ui, cmdk, streamdown, shiki, use-stick-to-bottom, class-variance-authority, tailwindcss, or nanoid. scripts/check-browser-tokens.mjs fails if a component file carries a raw colour, pixel, or font value.

Verification

pnpm --filter @paperclipai/paperclip-runner exec vitest run \
  src/mock-core/live-console-scripted-driver.test.ts \
  src/mock-core/live-console-demo-server.test.ts \
  devtools/browser/src/live/transcript-model.test.ts
pnpm --filter @paperclipai/paperclip-runner test:browser
pnpm --filter @paperclipai/paperclip-runner check:browser-tokens
pnpm --filter @paperclipai/paperclip-runner check:forbidden-imports

See the tutorial.