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.
Prompt Admission Precedes Execution
Session.prompt(...) publishes one durable session.inbox.enqueued fact whose projection inserts one session_inbox row before advisory execution begins. An inbox item remains outside model-visible Session History until delivery. The session.inbox.delivered projection consumes the row and inserts a visible user or synthetic message atomically; compaction and move control items are consumed without becoming transcript messages.
Reusing a Session ID adopts the existing Session. Reusing a user or synthetic inbox item ID is idempotent when Session and type match: the first admission wins, and retried payload, metadata, and delivery are ignored. After delivery, retry reconciliation uses the projected message and does not require enqueue history. Cross-Session and cross-type reuse fail. Compaction and move controls retain operation-specific conflict behavior.
resume controls scheduling, not durability:
- Omitted or
truerecords the input, then schedulesSessionExecution.wake(sessionID). falserecords the input without scheduling execution.
Delivery is explicit:
steeris the default. Steers deliver in enqueue order at the next Safe Step Boundary. Delivery stops before a compaction or move control item.queueremains pending while the Session can continue. At an idle boundary, steers still take priority; otherwise one queued item delivers, followed by any steers that arrived during delivery. The runner then reevaluates continuation before another queued item.
Promoting new user input resets the selected agent's step allowance. A batch of steers resets it once.
Manual compaction and Session movement use the same inbox as control items. Each request has its own inbox identity and delivery mode. A control item forms a delivery boundary so later steers do not cross it.