V2 specs tour
The upstream OpenCode contracts underneath doc.haus: who owns what, how sessions admit and execute prompts, how tools are built and bounded, and the two accepted decisions on events and provider policy.
Laws
- Single execution:
Tool.make(config)can execute onlyconfig.execute. - Codec boundary: a tool observes decoded input; Code Mode observes the validated encoded output; model content and metadata come from the tool response.
- Canonical representation: a completed call has exactly one stored model representation; a failed call has exactly one stored error plus at most one final partial snapshot. Every other view is derived at a named boundary.
- Metadata opt-in: absent response metadata produces absent metadata, never a copied output.
- Durable identity: invocation-owned records use the exact Session, agent, assistant message, and call IDs supplied by the runner.
- Scoped registration: closing a Scope removes exactly its registration and reveals any prior active overlay.
- Captured execution: a call executes the registered tool advertised in its model request.
- Per-call rejection: rejecting one unavailable call cannot fail another call.
- Storage encapsulation: domain output does not change according to model-output bounding or retention policy.