@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

PropertyModifierTypeDescriptionDefined in
domain?readonlystringHost 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
kindreadonly| "claude-code" | "claude-api" | "codex" | "opencode" | "pi" | "oh-my-pi" | "hermes" | "generic" | "playerthree-runner" | "playerthree-bridge"-packages/connect/src/index.ts:256
logoUri?readonlystring-packages/connect/src/index.ts:259
namereadonlystring-packages/connect/src/index.ts:255
uri?readonlystringClient 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

PropertyModifierTypeDescriptionDefined in
activereadonlybooleanA recent call, a call in flight, or an active sequence; signed in alone does not mean active now.packages/connect/src/index.ts:271
authorizedAtreadonlynumberms epoch of the latest explicit consent for this exact connection.packages/connect/src/index.ts:277
clientreadonlyConnectionClient-packages/connect/src/index.ts:268
commanderreadonlystring-packages/connect/src/index.ts:267
createdAtreadonlynumberms epoch of the consent that created it.packages/connect/src/index.ts:275
idreadonlystring-packages/connect/src/index.ts:266
lastSeenreadonlynumber | nullms epoch of the last authenticated request, null if never used.packages/connect/src/index.ts:273
rolesreadonlyreadonly 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

PropertyModifierTypeDescriptionDefined in
approvereadonlyboolean-packages/connect/src/index.ts:295
commanderreadonlystring-packages/connect/src/index.ts:293
pairingCode?readonlystringAlternative to profile authentication: a code consumed by this approval, or a request-bound exchange token.packages/connect/src/index.ts:297
pairingToken?readonlystring-packages/connect/src/index.ts:298
rolesreadonlyreadonly 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

PropertyModifierTypeDescriptionDefined in
holderreadonly| Pick<ConnectionClient, "kind" | "name"> | null-packages/connect/src/index.ts:320
idreadonlystring-packages/connect/src/index.ts:314
isolationreadonlyobject-packages/connect/src/index.ts:318
isolation.independentSessionsreadonlyboolean-packages/connect/src/index.ts:318
kindreadonly"policy" | "agent"-packages/connect/src/index.ts:317
mandatereadonlyMandate-packages/connect/src/index.ts:323
metadata?readonlyobject-packages/connect/src/index.ts:319
metadata.model?readonlystring-packages/connect/src/index.ts:319
metadata.provider?readonlystring-packages/connect/src/index.ts:319
metadata.scaffoldVersion?readonlystring-packages/connect/src/index.ts:319
namereadonlystring-packages/connect/src/index.ts:315
rolesreadonlyreadonly string[]-packages/connect/src/index.ts:316
scopesreadonlyreadonly ("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

PropertyModifierTypeDescriptionDefined in
clientreadonlyConnectionClient-packages/connect/src/index.ts:282
expiresAtreadonlynumberms epoch after which the request is gone (start the sign-in again from the harness).packages/connect/src/index.ts:288
redirectreadonlyobjectWhere the browser returns after consent; consent pages must show the host and flag loopback-only redirects.packages/connect/src/index.ts:286
redirect.hostreadonlystring-packages/connect/src/index.ts:286
redirect.loopbackreadonlyboolean-packages/connect/src/index.ts:286
rolesreadonlyreadonly 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

PropertyModifierTypeDefined in
redirectreadonlystringpackages/connect/src/index.ts:303

Harness

Defined in: packages/connect/src/index.ts:25

Catalog entry of one harness family.

Properties

PropertyModifierTypeDescriptionDefined in
blurbreadonlystringOne line on what it is.packages/connect/src/index.ts:30
docsUrl?readonlystringThe harness's own MCP documentation, when it has a public page.packages/connect/src/index.ts:32
kindreadonly| "claude-code" | "claude-api" | "codex" | "opencode" | "pi" | "oh-my-pi" | "hermes" | "generic" | "playerthree-runner" | "playerthree-bridge"-packages/connect/src/index.ts:26
namereadonlystringDisplay 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

PropertyModifierTypeDescriptionInherited fromDefined in
alternative?readonlySetupTextThe same server as a config-file entry, for players who prefer editing the file.-packages/connect/src/index.ts:68
file?readonlystring-SetupText.filepackages/connect/src/index.ts:58
kindreadonly| "claude-code" | "claude-api" | "codex" | "opencode" | "pi" | "oh-my-pi" | "hermes" | "generic" | "playerthree-runner" | "playerthree-bridge"--packages/connect/src/index.ts:64
languagereadonly"json" | "sh" | "slash" | "toml" | "yaml"-SetupText.languagepackages/connect/src/index.ts:57
textreadonlystring-SetupText.textpackages/connect/src/index.ts:59
thenreadonlystringPlain-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

PropertyModifierTypeDefined in
gameTitlereadonlystringpackages/connect/src/index.ts:229
mandatereadonlyMandatepackages/connect/src/index.ts:231
rolesreadonlyreadonly 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

PropertyModifierTypeDefined in
codereadonlystringpackages/connect/src/index.ts:308
expiresAtreadonlynumberpackages/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

PropertyModifierTypeDefined in
commandersreadonlyreadonly ConsentCommander[]packages/connect/src/index.ts:328
expiresAtreadonlynumberpackages/connect/src/index.ts:330
pairingTokenreadonlystringpackages/connect/src/index.ts:329

SetupOptions

Defined in: packages/connect/src/index.ts:72

Inputs of harnessSetup.

Properties

PropertyModifierTypeDescriptionDefined in
channel?readonlybooleanClaude Code only: opt in to the stdio bridge's research-preview wake channel.packages/connect/src/index.ts:80
mcpUrlreadonlystringThe game's MCP endpoint, e.g. https://game.example/mcp.packages/connect/src/index.ts:74
serverNamereadonlystringMCP server name inside the harness ([a-z0-9-], ≤ 64), e.g. from serverName.packages/connect/src/index.ts:76
token?readonlystringBearer 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

PropertyModifierTypeDefined in
file?readonlystringpackages/connect/src/index.ts:58
languagereadonly"json" | "sh" | "slash" | "toml" | "yaml"packages/connect/src/index.ts:57
textreadonlystringpackages/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

NameTypeDefault valueDefined in
advisorobject-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
authorobject-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
autonomousobject-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

ParameterType
kind| "claude-code" | "claude-api" | "codex" | "opencode" | "pi" | "oh-my-pi" | "hermes" | "generic" | "playerthree-runner" | "playerthree-bridge"

Returns

Harness


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

ParameterType
kind| "claude-code" | "claude-api" | "codex" | "opencode" | "pi" | "oh-my-pi" | "hermes" | "generic" | "playerthree-runner" | "playerthree-bridge"
optsSetupOptions

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

ParameterType
vunknown

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

ParameterType
__namedParametersKickoffOptions

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

ParameterType
...partsstring[]

Returns

string