@playerthree/connect
Headless connection setup: the catalog of agent harnesses a player can attach to a game's MCP endpoint, the exact copy-paste command or config for each one, and the wire types games use for connections and consent requests. DOM-free and UI-free: games render their own buttons, icons and pages from this.
With MCP authorization (OAuth 2.1, see docs/MCP.md) nothing here carries a secret: one static URL for everyone, and
the harness signs the player in through the browser. token (a per-match seat token or a persistent commander
token) is the bearer fallback for harnesses or hosts without OAuth; it is embedded only when it has the opaque
PlayerThree token format. Output is only built from a well-formed http(s) URL and a [a-z0-9-] server name, so no
command line is ever assembled from unexpected input.
Interfaces
ConnectionClient
Defined in: packages/connect/src/index.ts:254
The OAuth client behind a connection, as the host describes it. Name and URI come from the client: show as text.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
domain? | readonly | string | Host of a CIMD client_id URL: the name is vouched for by that domain. Absent (DCR): self-asserted, unverified. | packages/connect/src/index.ts:261 |
kind | readonly | | "claude-code" | "claude-api" | "codex" | "opencode" | "pi" | "oh-my-pi" | "hermes" | "generic" | "playerthree-runner" | "playerthree-bridge" | - | packages/connect/src/index.ts:256 |
logoUri? | readonly | string | - | packages/connect/src/index.ts:259 |
name | readonly | string | - | packages/connect/src/index.ts:255 |
uri? | readonly | string | Client ID Metadata Document URL (CIMD clients) or the client's declared homepage. | packages/connect/src/index.ts:258 |
ConnectionInfo
Defined in: packages/connect/src/index.ts:265
One independently authorised harness connection to one named commander.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
active | readonly | boolean | A recent call, a call in flight, or an active sequence; signed in alone does not mean active now. | packages/connect/src/index.ts:271 |
authorizedAt | readonly | number | ms epoch of the latest explicit consent for this exact connection. | packages/connect/src/index.ts:277 |
client | readonly | ConnectionClient | - | packages/connect/src/index.ts:268 |
commander | readonly | string | - | packages/connect/src/index.ts:267 |
createdAt | readonly | number | ms epoch of the consent that created it. | packages/connect/src/index.ts:275 |
id | readonly | string | - | packages/connect/src/index.ts:266 |
lastSeen | readonly | number | null | ms epoch of the last authenticated request, null if never used. | packages/connect/src/index.ts:273 |
roles | readonly | readonly string[] | - | packages/connect/src/index.ts:269 |
ConsentAnswer
Defined in: packages/connect/src/index.ts:292
The owner's answer to a ConsentRequestInfo: approve or deny, binding the connection to one commander and its roles.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
approve | readonly | boolean | - | packages/connect/src/index.ts:295 |
commander | readonly | string | - | packages/connect/src/index.ts:293 |
pairingCode? | readonly | string | Alternative to profile authentication: a code consumed by this approval, or a request-bound exchange token. | packages/connect/src/index.ts:297 |
pairingToken? | readonly | string | - | packages/connect/src/index.ts:298 |
roles | readonly | readonly string[] | - | packages/connect/src/index.ts:294 |
ConsentCommander
Defined in: packages/connect/src/index.ts:313
Safe named commander details returned after pairing; never includes profile or commander secrets.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
holder | readonly | | Pick<ConnectionClient, "kind" | "name"> | null | - | packages/connect/src/index.ts:320 |
id | readonly | string | - | packages/connect/src/index.ts:314 |
isolation | readonly | object | - | packages/connect/src/index.ts:318 |
isolation.independentSessions | readonly | boolean | - | packages/connect/src/index.ts:318 |
kind | readonly | "policy" | "agent" | - | packages/connect/src/index.ts:317 |
mandate | readonly | Mandate | - | packages/connect/src/index.ts:323 |
metadata? | readonly | object | - | packages/connect/src/index.ts:319 |
metadata.model? | readonly | string | - | packages/connect/src/index.ts:319 |
metadata.provider? | readonly | string | - | packages/connect/src/index.ts:319 |
metadata.scaffoldVersion? | readonly | string | - | packages/connect/src/index.ts:319 |
name | readonly | string | - | packages/connect/src/index.ts:315 |
roles | readonly | readonly string[] | - | packages/connect/src/index.ts:316 |
scopes | readonly | readonly ("act" | "policy" | "practice" | "publish" | "say")[] | What this named commander may do and is asked to do (shown so consent is informed). | packages/connect/src/index.ts:322 |
ConsentRequestInfo
Defined in: packages/connect/src/index.ts:281
A pending authorization request the owner is asked to approve.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
client | readonly | ConnectionClient | - | packages/connect/src/index.ts:282 |
expiresAt | readonly | number | ms epoch after which the request is gone (start the sign-in again from the harness). | packages/connect/src/index.ts:288 |
redirect | readonly | object | Where the browser returns after consent; consent pages must show the host and flag loopback-only redirects. | packages/connect/src/index.ts:286 |
redirect.host | readonly | string | - | packages/connect/src/index.ts:286 |
redirect.loopback | readonly | boolean | - | packages/connect/src/index.ts:286 |
roles | readonly | readonly string[] | Roles the owner can grant. | packages/connect/src/index.ts:284 |
ConsentResult
Defined in: packages/connect/src/index.ts:302
Where to send the browser next (the client's redirect URI with the code, or with error=access_denied).
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
redirect | readonly | string | packages/connect/src/index.ts:303 |
Harness
Defined in: packages/connect/src/index.ts:25
Catalog entry of one harness family.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
blurb | readonly | string | One line on what it is. | packages/connect/src/index.ts:30 |
docsUrl? | readonly | string | The harness's own MCP documentation, when it has a public page. | packages/connect/src/index.ts:32 |
kind | readonly | | "claude-code" | "claude-api" | "codex" | "opencode" | "pi" | "oh-my-pi" | "hermes" | "generic" | "playerthree-runner" | "playerthree-bridge" | - | packages/connect/src/index.ts:26 |
name | readonly | string | Display name. | packages/connect/src/index.ts:28 |
HarnessSetup
Defined in: packages/connect/src/index.ts:63
The copy-paste setup for one harness.
Extends
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
alternative? | readonly | SetupText | The same server as a config-file entry, for players who prefer editing the file. | - | packages/connect/src/index.ts:68 |
file? | readonly | string | - | SetupText.file | packages/connect/src/index.ts:58 |
kind | readonly | | "claude-code" | "claude-api" | "codex" | "opencode" | "pi" | "oh-my-pi" | "hermes" | "generic" | "playerthree-runner" | "playerthree-bridge" | - | - | packages/connect/src/index.ts:64 |
language | readonly | "json" | "sh" | "slash" | "toml" | "yaml" | - | SetupText.language | packages/connect/src/index.ts:57 |
text | readonly | string | - | SetupText.text | packages/connect/src/index.ts:59 |
then | readonly | string | Plain-language next step after pasting (how the harness signs in). | - | packages/connect/src/index.ts:66 |
KickoffOptions
Defined in: packages/connect/src/index.ts:228
Inputs of kickoffPrompt: the game title, the seat roles and their mandate.
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
gameTitle | readonly | string | packages/connect/src/index.ts:229 |
mandate | readonly | Mandate | packages/connect/src/index.ts:231 |
roles | readonly | readonly string[] | packages/connect/src/index.ts:230 |
PairingCode
Defined in: packages/connect/src/index.ts:307
A single-use code minted in the owner's browser; expires after ten minutes.
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
code | readonly | string | packages/connect/src/index.ts:308 |
expiresAt | readonly | number | packages/connect/src/index.ts:309 |
PairingResult
Defined in: packages/connect/src/index.ts:327
A capability for one consent request, not a profile login. Keep it only in the consent page's memory.
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
commanders | readonly | readonly ConsentCommander[] | packages/connect/src/index.ts:328 |
expiresAt | readonly | number | packages/connect/src/index.ts:330 |
pairingToken | readonly | string | packages/connect/src/index.ts:329 |
SetupOptions
Defined in: packages/connect/src/index.ts:72
Inputs of harnessSetup.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
channel? | readonly | boolean | Claude Code only: opt in to the stdio bridge's research-preview wake channel. | packages/connect/src/index.ts:80 |
mcpUrl | readonly | string | The game's MCP endpoint, e.g. https://game.example/mcp. | packages/connect/src/index.ts:74 |
serverName | readonly | string | MCP server name inside the harness ([a-z0-9-], ≤ 64), e.g. from serverName. | packages/connect/src/index.ts:76 |
token? | readonly | string | Bearer fallback: a seat or commander token instead of OAuth sign-in. | packages/connect/src/index.ts:78 |
SetupText
Defined in: packages/connect/src/index.ts:56
Where a setup goes: sh runs in a terminal, slash is typed into the harness's own session; otherwise it is
pasted into file (or the client's MCP settings when no file).
Extended by
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
file? | readonly | string | packages/connect/src/index.ts:58 |
language | readonly | "json" | "sh" | "slash" | "toml" | "yaml" | packages/connect/src/index.ts:57 |
text | readonly | string | packages/connect/src/index.ts:59 |
Type Aliases
ClientKind
type ClientKind = typeof CLIENT_KINDS[number];Defined in: packages/connect/src/index.ts:17
Variables
CLIENT_KINDS
const CLIENT_KINDS: readonly ["claude-code", "claude-api", "codex", "opencode", "pi", "oh-my-pi", "hermes", "generic", "playerthree-runner", "playerthree-bridge"];Defined in: packages/connect/src/index.ts:16
Harness families a connection can come from (detected by the host from the OAuth client's metadata).
HARNESSES
const HARNESSES: readonly Harness[];Defined in: packages/connect/src/index.ts:36
Every harness with a setup recipe, in the order games should offer them.
MANDATE_PRESETS
const MANDATE_PRESETS: object;Defined in: packages/connect/src/index.ts:221
UI shortcuts; intersect their scopes with the modes supported by the game's manifest.
Type Declaration
| Name | Type | Default value | Defined in |
|---|---|---|---|
advisor | object | - | packages/connect/src/index.ts:224 |
advisor.autonomy | "supervised" | 'supervised' | packages/connect/src/index.ts:224 |
advisor.scopes | ("policy" | "practice" | "say")[] | - | packages/connect/src/index.ts:224 |
author | object | - | packages/connect/src/index.ts:223 |
author.autonomy | "autonomous" | 'autonomous' | packages/connect/src/index.ts:223 |
author.scopes | ("policy" | "practice" | "publish" | "say")[] | - | packages/connect/src/index.ts:223 |
autonomous | object | - | packages/connect/src/index.ts:222 |
autonomous.autonomy | "autonomous" | 'autonomous' | packages/connect/src/index.ts:222 |
autonomous.scopes | ("act" | "policy" | "practice" | "publish" | "say")[] | - | packages/connect/src/index.ts:222 |
Functions
harness()
function harness(kind): Harness;Defined in: packages/connect/src/index.ts:50
The catalog entry of kind.
Parameters
| Parameter | Type |
|---|---|
kind | | "claude-code" | "claude-api" | "codex" | "opencode" | "pi" | "oh-my-pi" | "hermes" | "generic" | "playerthree-runner" | "playerthree-bridge" |
Returns
harnessSetup()
function harnessSetup(kind, opts): HarnessSetup | undefined;Defined in: packages/connect/src/index.ts:105
Setup for kind, or undefined when the URL is not http(s), the server name is not [a-z0-9-] or the token is
malformed (callers render nothing rather than a broken command).
Parameters
| Parameter | Type |
|---|---|
kind | | "claude-code" | "claude-api" | "codex" | "opencode" | "pi" | "oh-my-pi" | "hermes" | "generic" | "playerthree-runner" | "playerthree-bridge" |
opts | SetupOptions |
Returns
HarnessSetup | undefined
isClientKind()
function isClientKind(v): v is "claude-code" | "claude-api" | "codex" | "opencode" | "pi" | "oh-my-pi" | "hermes" | "generic" | "playerthree-runner" | "playerthree-bridge";Defined in: packages/connect/src/index.ts:20
Narrows an untrusted value to a known ClientKind.
Parameters
| Parameter | Type |
|---|---|
v | unknown |
Returns
v is "claude-code" | "claude-api" | "codex" | "opencode" | "pi" | "oh-my-pi" | "hermes" | "generic" | "playerthree-runner" | "playerthree-bridge"
kickoffPrompt()
function kickoffPrompt(__namedParameters): string;Defined in: packages/connect/src/index.ts:235
The player-pasted first message for a turn-based harness; live briefing remains authoritative.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | KickoffOptions |
Returns
string
serverName()
function serverName(...parts): string;Defined in: packages/connect/src/index.ts:84
MCP server name from identifiers: lower-case, [a-z0-9-], joined with -, ≤ 64 chars.
Parameters
| Parameter | Type |
|---|---|
...parts | string[] |
Returns
string
