packages/interactive-environment/README.md

@clankie/interactive-environment

Provider-neutral contracts shared by the GBA body, Discord presence, rendered surfaces, computer bodies, and activity observation. The package defines session phases, leases, action results, concrete GBA commands and observations, semantic events, bounded telemetry references, and Discord presence tool exposure.

Some schema names retain gba_emulator for compatibility. They do not imply an emulator ships here: Clankie's current game body is his own PokeAgents world seat. Play owns that product path; this package owns the wire contracts and legacy record readers.

ActivityShare*Schema defines a separate v2 general-media plane with scoped share/generation envelopes, optional game capture counters, PNG header/digest validation and stereo PCM capped at 200 ms. Source descriptors confer no capture authority. Media and bounded display text stay outside semantic events. The legacy rendered-surface v1 shapes remain unchanged; operational contracts and pending hosted admission live in the Activity reference.

Semantic event data is a closed, bounded union of state-transition payloads. Raw ticks, chunks, packets, audio, and video are rejected from the semantic plane and travel only as bounded EnvironmentTelemetryReferenceSchema artifact references. Discord presence tool exposure single-writes schema v2 lanes while dual-reading legacy tui supervision as the v2 operator lane.

Session and lease v2 contracts use strict profile-specific resource bounds. The gba_emulator profile pins the core, savestate identity, frame/input budgets, and capabilities. The legacy_v1 profile exists only to read persisted v1 sessions and normalize them to v2; new sessions write v2. Action/result/event contracts remain v1.

The clankie service remains authoritative. Models receive no credentials, cannot mint leases, and cannot widen the concrete action schemas. Runtime and emulator details stay behind the contracts in this package.

ActivityObservationSnapshotSchema defines present-tense self-observation for active activities. The first gba_emulator variant separates bounded selfAuthored objective/intent/commentary from the runnerObserved settled outcome/effect/progress the service records, and admits only a framebuffer digest, never frame bytes. ActivityObservationReadSchema distinguishes a matching snapshot, a live session whose first turn is still pending, and no live activity. This is a read contract, not an environment command or capability projection. RenderedSurfaceStatusSchema is the display-only present-tense counterpart: its closed thinking/acting phase accompanies rendered media without moving model text, authority, or raw media into the semantic plane. RenderedSurfaceFrameSchema and RenderedSurfaceAudioSchema carry bounded PNG and stereo PCM packets only on that rendered-media plane. Audio is live-only; consumers drop stale packets instead of retaining or replaying them.

ComputerLeaseSchema follows the environment clock conventions and binds a driver to a body and conversation. ComputerScreenshotSchema carries a fresh image identity, exact target, dimensions and coordinate mapping; ComputerFrameSchema keeps bounded PNG media separate from semantic metadata and input receipts. ComputerCommandSchema admits ordered concrete inputs; ComputerReceiptSchema distinguishes confirmed, failed and uncertain outcomes. The service owns authority, native references and the persistent single-driver registry. The contract selects no model or hosting implementation.