Skip to content
API reference

API reference

Import Purpose
@fungi.computer/darkroom Model catalog, settings, references, provider wire shapes and cost estimates.
@fungi.computer/darkroom/app-media-contracts Runtime-neutral App catalog, destination and completed-generation schemas.
@fungi.computer/darkroom/server Hono service, typed generation, metering and the portable SQL operation owner.
@fungi.computer/darkroom/cloudflare Native operation DO, Workers AI provider and Images fitters.
@fungi.computer/darkroom/provenance Lossless public image downloads with private metadata removed.

The App-facing JSON protocol and page handles live in @fungi.computer/agar/media-json. Darkroom owns host execution and its @fungi.computer/darkroom/browser HTTP failure decoder.

The App contract entry exports mediaModelsSchema, destinationSchema and appMediaGenerationResultSchema. The catalog bound is the maintained model count; the host still filters models after decoding. Pending App replies use Agar’s public pendingSchema. appMediaModelsOutcomeSchema and appMediaGenerationOutcomeSchema include the broker’s emitted refusal payloads: closed admission codes, the Media attachment-budget refusal, the existing agentAppMediaLibraryFailureSchema, and appMediaBrokerFailureSchema. The latter preserves the broker projection: HTTP code becomes error, HTTP error becomes message, and stage, retryable and optional provider facts stay unchanged. HTTP failures and transport envelopes are separate representations and do not decode as these outcomes.

Provider facts use Agar’s canonical Media grammar: an allowlisted error category and bounded numeric code, or result_download and a native HTTP status. The durable owner retains those facts through interruption and replay, including safety refusals, without retaining the original error message or cause in the failure record. A terminal provider failure never redispatches the paid attempt. The fresh pre-release schema replaces the safety-only refusal table; old preview stores require an explicit host reset, not an automatic migration or dual reader.

See the generated API for signatures and host ports. The Cloudflare entry needs the native Workers type declarations in a TypeScript host. The other entries use ordinary platform web types.

Generate media through a host-supplied provider, retain its exact output, and retry saving without repeating inference. Your host owns identity, permission, billing and destination access.

Use the root entry for the model catalog and settings. server composes the service and portable SQL owner. cloudflare binds that owner to a SQLite Durable Object and supplies Workers AI and Images adapters. provenance strips private image metadata for downloads.