showrunner-agent
v0.5.139
Published
Provider-neutral connector SDK for Showrunner agents
Readme
Showrunner Agent Connector
showrunner-agent connects a user-owned provider process to one Showrunner agent installation. It accepts durable, ordered events, runs one provider adapter, and sends idempotent commands through the connector v1 API.
Run
Owner runs use the provider's native settings and permission requests. Codex and Claude teammate runs use provider sandboxes; ACP accepts owner runs.
npm ci
npm run build
npm test
npx showrunner-agent connect \
--api <api-base-url> \
--installation-id <installation-uuid> \
--pairing-code ABCD-EFGH \
--adapter codexDon't type the connect command from here — the agent editor in the app prints one with the pairing
code and API URL already filled in for the build you are running (ConnectCommandBuilder). Its API
URL comes from scripts/dev-stack.sh (API_PORT) for a numbered dev stack, from applicationUrl
in api/src/Bylines.Messenger.Api/Properties/launchSettings.json for stack 0, and from the hosted
domain otherwise.
Released builds install the connector from npm, and it ships with the API rather than on a pipeline
of its own — the same way agent-gateway does. Staging and production are separate npm packages,
each published by its own API deploy after the deploy succeeds: showrunner-agent-staging
(<version>-staging.<run> on every merge) and showrunner-agent (the package.json version, once
per release). Separate packages because a staging build is pinned to the staging servers, and
because npm allows one trusted publisher per package. Both publish by trusted publishing (OIDC, no
stored token). Feature PRs do not bump the connector version. When cutting a production release with connector
changes, make one release PR that bumps version in package.json and package-lock.json.
validate-connector-release in .github/workflows/deploy-production-api.yml builds the release
package before the API deploy and rejects changes that reuse an already-published version, using
external-agent-gateway/scripts/check-connector-release.sh. An identical published package permits an API-only release.
Staging keeps publishing a unique prerelease automatically, without a version bump. A
local build runs this working tree instead, via the npm link that dev-stack.sh up performs.
Deliveries within each session run in order.
Supported CLI adapters are custom, codex, claude, and acp. A custom module must default-export an AgentAdapter (or export it as adapter). Every adapter accepts --cwd /absolute/project/path to choose its working directory; ACP additionally requires --agent <id>. The supported ACP IDs and invocation shapes live in src/adapters/acp/acp-config.ts. An agent whose authentication entry is set there (Grok) is signed in through ACP authenticate before each session, from the credential that entry names: for Grok, XAI_API_KEY in the connector's environment or the login grok login stores. Without one, the chat says which command to run.
Codex, Claude, and ACP runs work directly in the agent's connected folder, including resumed chats and Try with attempts. Runs never create per-run copies, claim or lock the folder, or wait for another run to finish. A Mac-wide active-run registry checks the Git project root (or the connected folder outside Git), across agents and connector installations. When another run is active there, the new run posts a step naming the agent and requester, proceeds immediately, and tells the agent to preserve the other run's work.
When runs overlap in the same project, each run's Edited files card lists only files reported by its own agent's edit tools, file-change events, or changed-files reports. Without overlap, the card also includes changes observed in the folder's Git diff. The connector doesn't create branches or move work between folders.
Connector state and the single-process lock are scoped by the normalized API URL and installation ID.
Each installation belongs to a workspace; all of its chats share one connector, with separate provider
sessions. Different installations (including the same provider in different workspaces) can run together
under one OS account. --cwd selects the project directory, not the connection identity.
Commands must include --installation-id, which the app fills in for both pairing and reconnecting.
Existing provider-scoped credentials are left untouched and are not adopted into a new scope. After
upgrading, stop the old connector and open the agent’s Settings → Connection page to generate a fresh
pairing command once. Subsequent reconnects reuse that installation’s scoped credentials.
The connector credential is issued by Showrunner pairing and stored by FileConnectorCredentialStorage in the platform data directory selected by env-paths. The directory and file are enforced as modes 0700 and 0600. Pairing, access, and refresh values are never accepted as provider configuration and are redacted from logs.
Provider credentials and isolation
- Codex launches
codex app-serverover stdio. Authentication comes from the locally installed Codex process and its normal OpenAI credential configuration. App-server endpoints are limited to stdio, Unix sockets, or loopback unless an embedding application explicitly opts out. See the current Codex app-server documentation. Consent-only MCP forms appear as Showrunner approvals. When Codex supplies structured Computer Use connector and target-app identity, an unchecked Just this once saves permission for that app, covering every Computer Use action in it, for this agent installation while Codex receives a one-use response. A checked Just this once grants only the current action. On the Mac running the bundled connector, its owner can view and forget remembered apps under Computer Use approvals in agent settings. Other devices direct the owner to that Mac for bundled agents, or to the local list/reset CLI commands for terminal-run agents. Arbitrary structured forms, URL authorization and other action-specific confirmations are not app-access grants. - Claude is transparently re-hosted with
@anthropic-ai/claude-agent-sdkthrough the user's installed Claude Code binary and its existing sign-in. Executable discovery is defined byfindClaudeCodeExecutableinsrc/adapters/claude/claude-adapter.ts. - ACP agents use their CLI's configured credentials. ACP receives the same Showrunner tools as Codex and Claude through an invocation-scoped stdio MCP bridge. New and resumed sessions get a fresh authenticated loopback endpoint; calls use the connector's existing grants and owner approval flow. Providers that identify a Showrunner call with a fully qualified structured tool name defer authorization to the bridge. Providers that omit that identity still require their host approval and may show an additional approval before the bridge checks the call. The endpoint closes when the invocation ends. Native image ingestion remains unavailable; download_file provides file access.
- Custom adapters own their provider credential loading. Keep secrets outside the repository and do not put them in Showrunner messages, adapter state, command errors, or structured log fields.
Run each connector under a dedicated OS account/container with access only to its intended working directory, network destinations, and provider credentials. Do not share a home directory or cloud credential chain with unrelated workloads. Disable unused MCP servers and prefer read-only scopes.
Run permissions and approval cards
The server fixes trust.runType to owner, trusted, or untrusted when a run starts. Reading messages, files, web pages, or tool output never changes it. trust.ownerProfileId identifies whose Showrunner content the run works with: the agent's owner. Only the owner's runs get owner authority.
Owner and trusted runs pass through the provider's native configuration and permission prompts, including Full access. A trusted teammate cannot use the owner's connected accounts (Claude's claude.ai connectors, Codex's apps). Untrusted runs use a verified provider sandbox: project work and Showrunner's own tools in the chat need no card, while files outside the project folder, each new site, the owner's accounts, and email sends ask the owner. On any run, Showrunner's own tools ask only before sending to people and moving money. The server limits teammate reads to content the teammate can see, and the connector starts a fresh provider session when retained context may contain private content. ACP accepts owner and trusted runs. See docs/native-sandbox-approvals.md.
Cards carry an origin describing why they appeared: provider_ask relays a provider permission request; sandbox_escape, network, outside_project, and owner_account identify untrusted requests beyond the sandbox or into the installer's accounts; owner_setup is an untrusted request asking for the installer's own setup, answered by trusting the teammate. A run reads the chats everyone in the room it was asked in can see; in an owner's private chat with the agent that is all the owner's chats, and a teammate's run stays within what its starter can see. Provider permission memory stays with the provider. Allow on an untrusted run's non-folder card covers that exact effect for the rest of the request; a decline is final for that request. Allow on an outside-folder card grants the folder for the rest of the invocation. Outside-folder cards also offer Always allow this folder, which saves the exact directory from the provider's native permission request. Later untrusted runs can read saved folders; owner and trusted runs use the native filesystem instead. The filesystem root, /Users, a home folder, its Library and .config, and top-level system folders such as /etc, /opt, /usr and /Volumes can be granted for one invocation but can't be saved. Other untrusted cards offer Always trust name, which ends that teammate's untrusted runs on the agent (helpers included) without doing the card's action, and starts each request again from its message as a new trusted run, with a line in the chat saying so.
Claude and Codex keep a run open while the provider reports background jobs. Claude's background_tasks_changed snapshot (excluding tasks the SDK marks ambient, plus terminal task_updated patches) and Codex's background-terminal inventory decide which jobs are running. When the provider's turn ends, the connector marks the foreground ended: the card shows its finished steps and one quiet background-jobs line, each job with its own Stop (Claude stopTask, Codex thread/backgroundTerminals/terminate). The run's Stop stays while any job runs and ends the run and every job. A person's message during this time steers into the run, as it does while the foreground works. Codex isn't woken when a job ends, so the connector posts one line saying how it went. Once the CLI is idle with only ambient tasks, the invocation ends while the CLI stays available for that chat. The next message uses the same input queue. Ending the CLI ends its background tasks.
The connector resolves its login-shell environment once before loading its adapter, using SHELL and a bounded interactive login. Connector overrides and the selected executable keep precedence. Shell startup failures retain the launch environment and log no environment values.
Returning files and screen recordings
Codex and Claude expose upload_file through the same connector tool registry. For files already
on disk, pass localPath, fileName, and mimeType; for small text output, pass content instead.
Paths resolve against the connector's --cwd. Directories, empty files, and oversized files are refused.
The connector size limit is maxConnectorFileBytes in src/file-limits.ts, matching the API ceiling
AgentFileTransferService.MaxFileBytes in the .NET adapter. File types follow the human upload policy: any type is accepted, and the API derives the stored
MIME type from the real filename using EnhancedMimeTypes.GetMimeType.
For “build this feature and send a screen recording,” the coding agent implements and tests the
feature, runs the app, and records the actual interaction using its available host tools. It must
finish the recording and save it inside --cwd before calling:
{
"localPath": "recordings/feature-demo.mp4",
"fileName": "feature-demo.mp4",
"mimeType": "video/mp4"
}The connector reads the source, requests a scoped upload URL, transfers binary bytes, and finalizes the asset. Only after finalization does
it return an assetId. The agent includes that ID in an asset_reference piece in its reply,
which makes the file available through the native attachment UI. Local paths and encoded video
bytes aren't reply attachments. Local files stream in bounded chunks from a verified open file handle.
Uploads cancelled before finalization return no success receipt; once finalization succeeds, its
asset receipt is preserved even if cancellation arrives while finalization is in flight.
The exemption uses filesystem timestamps rather than content provenance. Copies, atomic saves,
renames, checkouts, and other writes during the run can create a qualifying new inode at a
pre-existing path, even when another process wrote it. Where birthtime is unavailable, the
ctime/mtime fallback cannot distinguish creation from modification.
The transfer timeout in ExternalAgentClient.uploadFile reserves finalization headroom within
AgentFileTransferService.UploadLifetime. Compress or shorten recordings that exceed the connector limit.
Recording requires an app environment and a working host recording tool; the connector doesn't
supply a desktop or fabricate a recording. If capture is unavailable, the agent reports the blocker.
ACP mounts these tools through its MCP bridge; custom SDK adapters can use the same
AdapterClient.uploadFile transport directly.
This follows Slack's file upload sequence: reserve, transfer bytes, finalize, then share a durable file reference. For the intended user experience, see Devin's testing and recordings.
Shared piece interpretation
Protocol 3.0 uses the same resolved, numeric-discriminator pieces as Runner for message events,
chat context and notes. The API's Transport/AgentReadMapper.cs is the projection source of truth;
shared/agent-contracts supplies both runtimes' TypeScript schemas and input descriptions.
References carry resolved metadata, annotation summaries, and explicit unavailable or opaque states.
Tool grants and write capabilities remain installation-specific. The outgoing showrunner v1.0
fence is independent of the transport version and retains its string-discriminator vocabulary.
The connector must be upgraded for protocol 3.0. Older connectors are rejected by the protocol
handshake. Queued requests from the older protocol end with a visible upgrade explanation and
a request to send them again; they are never forwarded as unreadable payloads. Note writes use the same numeric write contract and API mapper as Runner. The .NET source is
Bylines.Messenger.Contracts/DTOs/Agents/AgentWritePieceDtos.cs. The provider tools adapt
string piece names to that contract. To keep a piece with sourcePieceId unchanged, pass that ID
as { "type": "retained_piece_reference", "pieceId": "..." } in update_note. This preserves the
stored piece exactly, including annotations, drawings, cards and unavailable references, without
revealing hidden content. Only pieces already on that note may be retained; creating new notes
cannot use retained references. Updates replace the full body: omitted pieces are deleted.
When installing from this repository, run npm ci --prefix ../shared/agent-contracts before
npm ci in this directory. Reinstall the local dependency after changing its source. The npm
release bundles the compiled shared package; users installing showrunner-agent do not need
this repository or a separately published contracts package.
