@playerthree/bench/opencode
The OpenCode authoring harness (SPEC §20.11): opencode run headless in a fresh isolated home and an empty working
directory, reaching the game only through the playerthree-mcp stdio bridge with the lobby commander's credential.
Bash, web fetch, web search, files outside the working directory and the game's live-play tools are denied.
OpenCode never sees the provider key: its only provider is a loopback metering proxy, which adds the key and the
model's private request extras (router pinning), caps each reply's output, buffers each reply whole, charges its
actual cost (turnCostUsd) against the run's ceilings and withholds a reply that crosses one, so its tool calls never run.
It records the upstream, generation id and cost the router reports. When a run ends before the deadline, the harness
continues the same OpenCode session with the seat's status: authoring has no early exit.
Interfaces
OpenCodeOptions
Defined in: packages/bench/src/opencode.ts:47
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
bin | string | The opencode platform binary, e.g. <prefix>/node_modules/opencode-linux-x64/bin/opencode. | packages/bench/src/opencode.ts:49 |
bridge? | readonly string[] | The stdio bridge command (default: the linked runner's playerthree-mcp under this Node). | packages/bench/src/opencode.ts:53 |
contextTokens? | number | Context window OpenCode compacts against, tokens (default OPENCODE_CONTEXT_TOKENS). | packages/bench/src/opencode.ts:51 |
generationRetryMs? | number | Pause between lookups of a generation's billed cost not yet published, ms (default GENERATION_LOOKUP_RETRY_MS). | packages/bench/src/opencode.ts:57 |
retryPauseMs? | number | Pause after a run that completed no model turn, ms (default OPENCODE_RETRY_PAUSE_MS). | packages/bench/src/opencode.ts:55 |
Variables
OPENCODE_CONTEXT_TOKENS
const OPENCODE_CONTEXT_TOKENS: 128000 = 128_000;Defined in: packages/bench/src/opencode.ts:27
Context window OpenCode compacts against when the operator names none, tokens.
OPENCODE_HARNESS_ID
const OPENCODE_HARNESS_ID: "opencode" = 'opencode';Defined in: packages/bench/src/opencode.ts:25
OPENCODE_MAX_IDLE_RUNS
const OPENCODE_MAX_IDLE_RUNS: 3 = 3;Defined in: packages/bench/src/opencode.ts:31
Consecutive runs without a completed model turn that end authoring as a provider (or harness) failure.
OPENCODE_RETRY_PAUSE_MS
const OPENCODE_RETRY_PAUSE_MS: 10000 = 10_000;Defined in: packages/bench/src/opencode.ts:29
Pause before the next run after a run that completed no model turn.
Functions
openCodeHarness()
function openCodeHarness(options): Promise<AuthoringHarness>;Defined in: packages/bench/src/opencode.ts:67
Reads the binary's version (the harness identity) before any authoring; a binary that reports none is refused.
Parameters
| Parameter | Type |
|---|---|
options | OpenCodeOptions |
Returns
Promise<AuthoringHarness>
