Runtime Bundle
How provider state becomes the applied sandbox runtime.
Overview
Org in a Box now treats runtime config as a staged artifact instead of a live config file. Provider rows in Postgres are the desired state, bun orginabox runtime apply promotes the staged bundle, and the sandbox only consumes the applied bundle.
flowchart LR
A[Provider rows in Postgres] --> B[Stage runtime bundle]
B --> C[/runtime/staged]
C --> D[bun orginabox runtime apply]
D --> E[/runtime/applied]
E --> F[Sandbox reads applied bundle]
F --> G[Prompt resolves applied model]
G --> H[Explicit providerID and modelID]
State Layers
Desired state
Desired state lives in Postgres and includes:
- provider identity
- encrypted credentials
- base URL
- preferred flag
- default model
Staged state
The staged bundle is the latest generated runtime snapshot. It is safe to inspect before activation and can exist even when the applied bundle is older.
Applied state
The applied bundle is what the sandbox actually uses. Chat, session prompts, and runtime status checks should treat applied state as the source of truth.
Bundle Contents
The runtime bundle includes:
manifest.jsonfor revision and timestamp metadataruntime.jsonfor the Orginabox-native runtime documentauth.jsonfor the sandbox adapteropencode.jsoncfor the generated sandbox config
The base sandbox config stays provider-agnostic. Provider-specific behavior comes from the applied bundle, not from a checked-in opencode.jsonc default.
Apply Flow
- A provider or model change is saved.
- Orginabox stages a new runtime bundle from the DB state.
bun orginabox runtime statusshows whether the staged and applied revisions differ.bun orginabox runtime applypromotes the staged bundle to applied state.- The sandbox restarts and reads only the applied artifacts.
Prompt Routing
Orginabox-originated turns resolve against the applied runtime before they call into the sandbox. That means:
- staged changes do not affect live chat
- model selection does not depend on a boot-time default
- agent profile overrides still win when they point at a provider that exists in the applied bundle
Operational Checks
- Use
bun orginabox runtime statuswhen a provider change does not seem to affect chat. - Use
bun orginabox runtime applyafter provider imports, credential updates, or default-model changes. - If runtime apply fails, fix the provider row first and re-run the apply step.
