@playerthree/cli
Programmatic API of the playerthree CLI (use it from CI scripts or tests).
Interfaces
AuditOptions
Defined in: packages/cli/src/audit.ts:738
Programmatic API of the playerthree CLI (use it from CI scripts or tests).
Extended by
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
expectHash? | string | Remote only: fail if the endpoint's surface hash differs. | packages/cli/src/audit.ts:745 |
hugeBytes? | number | Size of "huge" fuzz strings. Default 256 KiB in-process, 64 KiB remote. | packages/cli/src/audit.ts:741 |
seed? | number | - | packages/cli/src/audit.ts:739 |
timeoutMs? | number | Per-call timeout in ms (default 5000). | packages/cli/src/audit.ts:743 |
AuditReport
Defined in: packages/cli/src/audit.ts:49
Programmatic API of the playerthree CLI (use it from CI scripts or tests).
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
cases | number | - | packages/cli/src/audit.ts:57 |
checks | CheckResult[] | - | packages/cli/src/audit.ts:58 |
durationMs | number | - | packages/cli/src/audit.ts:61 |
game | object | - | packages/cli/src/audit.ts:52 |
game.id | string | - | packages/cli/src/audit.ts:52 |
game.title | string | - | packages/cli/src/audit.ts:52 |
game.version | string | - | packages/cli/src/audit.ts:52 |
generatedAt | string | - | packages/cli/src/audit.ts:62 |
mode | "in-process" | "remote" | "custom" | - | packages/cli/src/audit.ts:51 |
notes | string[] | - | packages/cli/src/audit.ts:59 |
ok | boolean | - | packages/cli/src/audit.ts:60 |
seats | object[] | - | packages/cli/src/audit.ts:54 |
surface | SeatSurface | What the first audited seat's agent learns (core briefing, topics, schemas), for the Safety Card. | packages/cli/src/audit.ts:56 |
surfaceHash | string | - | packages/cli/src/audit.ts:53 |
target | string | - | packages/cli/src/audit.ts:50 |
AuditSeat
Defined in: packages/cli/src/audit.ts:164
Programmatic API of the playerthree CLI (use it from CI scripts or tests).
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
invoke | Invoke | - | packages/cli/src/audit.ts:167 |
objectArgsOnly? | boolean | The transport only carries object arguments (MCP): skip whole-argument non-object cases. | packages/cli/src/audit.ts:169 |
role | string | - | packages/cli/src/audit.ts:166 |
team | string | - | packages/cli/src/audit.ts:165 |
AuditSeatsOptions
Defined in: packages/cli/src/audit.ts:849
Programmatic API of the playerthree CLI (use it from CI scripts or tests).
Extends
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
backoffMs? | number | - | - | packages/cli/src/audit.ts:854 |
batch? | number | Intent batch size per call (default 16) and back-off when rate-limited (default 250 ms). | - | packages/cli/src/audit.ts:853 |
expectHash? | string | Remote only: fail if the endpoint's surface hash differs. | AuditOptions.expectHash | packages/cli/src/audit.ts:745 |
hugeBytes? | number | Size of "huge" fuzz strings. Default 256 KiB in-process, 64 KiB remote. | AuditOptions.hugeBytes | packages/cli/src/audit.ts:741 |
label | string | Shown as the audit target. | - | packages/cli/src/audit.ts:851 |
seed? | number | - | AuditOptions.seed | packages/cli/src/audit.ts:739 |
timeoutMs? | number | Per-call timeout in ms (default 5000). | AuditOptions.timeoutMs | packages/cli/src/audit.ts:743 |
CheckResult
Defined in: packages/cli/src/audit.ts:38
One audit check: counts of passing and failing cases.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
failed | number | - | packages/cli/src/audit.ts:42 |
failures | object[] | First few failures (developer-facing). | packages/cli/src/audit.ts:44 |
id | string | - | packages/cli/src/audit.ts:39 |
passed | number | - | packages/cli/src/audit.ts:41 |
skipped? | string | Why the check could not run on this target. | packages/cli/src/audit.ts:46 |
title | string | - | packages/cli/src/audit.ts:40 |
CostRow
Defined in: packages/cli/src/lint.ts:56
Properties
| Property | Type | Defined in |
|---|---|---|
model | string | packages/cli/src/lint.ts:57 |
typicalPerHour? | number | packages/cli/src/lint.ts:59 |
usdPerMtok | number | packages/cli/src/lint.ts:58 |
worstPerHour | number | packages/cli/src/lint.ts:60 |
DevServer
Defined in: packages/cli/src/dev.ts:25
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
devtoolsUrl | readonly | string | Operator console (DevTools) deep link to this session; local mode, no credential (loopback only). | packages/cli/src/dev.ts:32 |
host | readonly | PlayerThreeHost | - | packages/cli/src/dev.ts:27 |
match | readonly | PlayerThreeMatch | - | packages/cli/src/dev.ts:28 |
mcpUrl | readonly | string | - | packages/cli/src/dev.ts:30 |
seat | readonly | object | - | packages/cli/src/dev.ts:33 |
seat.role | public | string | - | packages/cli/src/dev.ts:33 |
seat.team | public | string | - | packages/cli/src/dev.ts:33 |
seat.token | public | string | - | packages/cli/src/dev.ts:33 |
server | readonly | Server | - | packages/cli/src/dev.ts:26 |
url | readonly | string | - | packages/cli/src/dev.ts:29 |
waitsForAgent | readonly | boolean | True until the agent's first observe/act starts the match clock. | packages/cli/src/dev.ts:35 |
Methods
close()
close(): Promise<void>;Defined in: packages/cli/src/dev.ts:36
Returns
Promise<void>
DevServerOptions
Defined in: packages/cli/src/dev.ts:15
Listen address (default 127.0.0.1:8787), the agent's seat and the match seed (default 1).
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
host? | string | - | packages/cli/src/dev.ts:17 |
port? | number | - | packages/cli/src/dev.ts:16 |
seat? | string | Seat handed to an agent: team/role. Default: first team, first role. | packages/cli/src/dev.ts:19 |
seed? | number | - | packages/cli/src/dev.ts:20 |
startNow? | boolean | Start the clock immediately instead of when the agent first observes or acts. | packages/cli/src/dev.ts:22 |
Finding
Defined in: packages/cli/src/lint.ts:12
One lint result; any error fails the report.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
code | string | Stable machine code, e.g. obs.too_large. | packages/cli/src/lint.ts:15 |
level | Level | - | packages/cli/src/lint.ts:13 |
message | string | - | packages/cli/src/lint.ts:18 |
path | string | Manifest path the finding is about. | packages/cli/src/lint.ts:17 |
Io
Defined in: packages/cli/src/main.ts:43
Output and terminal capabilities of one CLI run, injectable for tests.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
color | boolean | - | packages/cli/src/main.ts:46 |
env? | Record<string, string | undefined> | Environment for db (default process.env). | packages/cli/src/main.ts:48 |
interactive? | boolean | stdin and stdout are both terminals (default false). | packages/cli/src/main.ts:50 |
Methods
err()
err(text): void;Defined in: packages/cli/src/main.ts:45
Parameters
| Parameter | Type |
|---|---|
text | string |
Returns
void
out()
out(text): void;Defined in: packages/cli/src/main.ts:44
Parameters
| Parameter | Type |
|---|---|
text | string |
Returns
void
prompt()?
prompt?(question): Promise<string>;Defined in: packages/cli/src/main.ts:52
Reads one answer line (required when interactive).
Parameters
| Parameter | Type |
|---|---|
question | string |
Returns
Promise<string>
LintOptions
Defined in: packages/cli/src/lint.ts:33
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
everySeconds? | number | Agent polling cadence for the cost estimate, seconds of real time. Default 10. | packages/cli/src/lint.ts:35 |
maxTokens? | number | … and above this fail (default 64 000). | packages/cli/src/lint.ts:44 |
prices? | Record<string, number> | Override / extend the price table ($/Mtok input). | packages/cli/src/lint.ts:37 |
sampleTicks? | number | Ticks of bot-vs-bot play to sample typical observations from. Default 600. | packages/cli/src/lint.ts:39 |
seed? | number | - | packages/cli/src/lint.ts:40 |
warnTokens? | number | Worst-case observation tokens above this warn (default 8 000) … | packages/cli/src/lint.ts:42 |
LintReport
Defined in: packages/cli/src/lint.ts:63
Properties
| Property | Type | Defined in |
|---|---|---|
cost | object | packages/cli/src/lint.ts:68 |
cost.everySeconds | number | packages/cli/src/lint.ts:68 |
cost.observationsPerHour | number | packages/cli/src/lint.ts:68 |
cost.pricesChecked | string | packages/cli/src/lint.ts:68 |
cost.rows | CostRow[] | packages/cli/src/lint.ts:68 |
findings | Finding[] | packages/cli/src/lint.ts:66 |
game | object | packages/cli/src/lint.ts:64 |
game.id | string | packages/cli/src/lint.ts:64 |
game.title | string | packages/cli/src/lint.ts:64 |
game.version | string | packages/cli/src/lint.ts:64 |
observation | ObservationStats | packages/cli/src/lint.ts:67 |
ok | boolean | packages/cli/src/lint.ts:65 |
ObservationStats
Defined in: packages/cli/src/lint.ts:47
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
sampledMax? | Size | Largest sampled observation. | packages/cli/src/lint.ts:52 |
samples | number | - | packages/cli/src/lint.ts:53 |
typical? | Size | Mean over sampled observations. Undefined if sampling failed. | packages/cli/src/lint.ts:50 |
worst | Size | - | packages/cli/src/lint.ts:48 |
Size
Defined in: packages/cli/src/size.ts:21
Properties
| Property | Type | Defined in |
|---|---|---|
bytes | number | packages/cli/src/size.ts:22 |
tokens | number | packages/cli/src/size.ts:23 |
Type Aliases
Invoke
type Invoke = (method, args) => Promise<unknown>;Defined in: packages/cli/src/audit.ts:162
Calls one control method with raw arguments (exactly the MCP tool argument object, e.g. { intents } for act),
so malformed shapes reach the endpoint unaltered. Throws an Error with a code on a failed call.
Parameters
| Parameter | Type |
|---|---|
method | ControlMethod |
args | unknown |
Returns
Promise<unknown>
Variables
DEFAULT_PRICES
const DEFAULT_PRICES: Readonly<Record<string, number>>;Defined in: packages/cli/src/lint.ts:22
Input price per million tokens, USD. List prices checked 2026-11-02 on each provider's pricing page.
PRICES_CHECKED
const PRICES_CHECKED: "2026-11-02" = '2026-11-02';Defined in: packages/cli/src/lint.ts:31
Functions
auditDefinition()
function auditDefinition(def, opts?): Promise<AuditReport>;Defined in: packages/cli/src/audit.ts:749
Audit a game definition on an in-process PlayerThreeHost (every role of the first team, plus local-only checks).
Parameters
| Parameter | Type |
|---|---|
def | GameDefinition |
opts? | AuditOptions |
Returns
Promise<AuditReport>
auditRemote()
function auditRemote(
url,
token,
opts?
): Promise<AuditReport>;Defined in: packages/cli/src/audit.ts:810
Audit a live MCP endpoint through a seat token (the seat should be under agent control).
Parameters
| Parameter | Type |
|---|---|
url | string |
token | string |
opts? | AuditOptions |
Returns
Promise<AuditReport>
auditSeats()
function auditSeats(seats, opts): Promise<AuditReport>;Defined in: packages/cli/src/audit.ts:861
Audit seats reached through any binding (e.g. your own WebSocket transport): give one Invoke per seat that
forwards raw tool-shaped arguments. Runs the fuzz, echo, vocabulary, schema and rate-limit checks.
Parameters
| Parameter | Type |
|---|---|
seats | AuditSeat[] |
opts | AuditSeatsOptions |
Returns
Promise<AuditReport>
devBanner()
function devBanner(
d,
def,
color?
): string;Defined in: packages/cli/src/dev.ts:95
The terminal banner playerthree dev prints: the match, its links and harness setup for the seat.
Parameters
| Parameter | Type | Default value |
|---|---|---|
d | DevServer | undefined |
def | GameDefinition | undefined |
color? | boolean | false |
Returns
string
estimateTokens()
function estimateTokens(text): number;Defined in: packages/cli/src/size.ts:14
Estimated LLM tokens of text (see TOKEN_RE).
Parameters
| Parameter | Type |
|---|---|
text | string |
Returns
number
formatAuditReport()
function formatAuditReport(r, color?): string;Defined in: packages/cli/src/audit.ts:888
Human-readable audit report (ANSI colours when color).
Parameters
| Parameter | Type | Default value |
|---|---|---|
r | AuditReport | undefined |
color? | boolean | false |
Returns
string
formatLintReport()
function formatLintReport(r, color?): string;Defined in: packages/cli/src/lint.ts:303
Human-readable lint report (ANSI colours when color).
Parameters
| Parameter | Type | Default value |
|---|---|---|
r | LintReport | undefined |
color? | boolean | false |
Returns
string
lintDefinition()
function lintDefinition(def, opts?): LintReport;Defined in: packages/cli/src/lint.ts:235
Runs every design-time check on a game definition; ok is false when any finding is an error.
Parameters
| Parameter | Type |
|---|---|
def | GameDefinition |
opts? | LintOptions |
Returns
loadDefinition()
function loadDefinition(modulePath, exportName?): Promise<GameDefinition<AnyManifest>>;Defined in: packages/cli/src/load.ts:7
Import a game module and return its definition export (or the named export).
Parameters
| Parameter | Type | Default value |
|---|---|---|
modulePath | string | undefined |
exportName? | string | 'definition' |
Returns
Promise<GameDefinition<AnyManifest>>
localInvoke()
function localInvoke(c): Invoke;Defined in: packages/cli/src/audit.ts:173
Raw-argument invocation of an in-process SeatControl (for auditSeats).
Parameters
| Parameter | Type |
|---|---|
c | SeatControl |
Returns
main()
function main(argv, io?): Promise<number>;Defined in: packages/cli/src/main.ts:232
Runs one CLI invocation (argv without the node and script paths); resolves to the process exit code.
Parameters
| Parameter | Type | Default value |
|---|---|---|
argv | string[] | undefined |
io? | Io | defaultIo |
Returns
Promise<number>
prosiness()
function prosiness(literal): string | undefined;Defined in: packages/cli/src/lint.ts:79
Heuristic: an enum literal "looks like prose" when it has many words or contains sentence/instruction words.
Parameters
| Parameter | Type |
|---|---|
literal | string |
Returns
string | undefined
safetyCard()
function safetyCard(r): string;Defined in: packages/cli/src/safety.ts:45
Renders the Safety Card markdown from an audit report.
Parameters
| Parameter | Type |
|---|---|
r | AuditReport |
Returns
string
startDevServer()
function startDevServer(def, opts?): Promise<DevServer>;Defined in: packages/cli/src/dev.ts:40
Serves def on one HTTP server — MCP at /mcp, DevTools at /playerthree/devtools — with one match whose seat opts.seat is agent-controlled and has a minted seat token.
Parameters
| Parameter | Type |
|---|---|
def | GameDefinition |
opts? | DevServerOptions |
Returns
Promise<DevServer>
worstCase()
function worstCase(s): Size;Defined in: packages/cli/src/size.ts:57
Conservative JSON encoding bound (every optional field present, every array full). Bounded text includes worst-case escaping; integer arrays use exact integer endpoint widths.
Parameters
| Parameter | Type |
|---|---|
s | Schema |
