This library is in flux. APIs may change without notice. Generated from source with koruc 0.1.7 on 8/19/2026.

Bridge

~import std/bridge

Resource Bridge Standard Library

bridge.kz · 7 tors · ~[comptime]· ~[runtime]

Resource Bridge Standard Library · 15 more lines
Resource Bridge Standard Library Persistent handle storage for long-running interactive sessions (Hollywood OS mode) A Bridge owns a HandlePool that outlives any single interpreter run, so a resource opened on one turn is still held on the next — the human or the agent can act on it three turns later and the obligation is still outstanding. The session is itself an obligation: `create` mints `<session!>` and only `close` discharges it, so a bridge cannot be brought into being and forgotten. You cannot forget to hang up. A bridge is bound to a SCOPE at birth. The scope is the vocabulary: the set of events that may act on what the bridge holds, and — through each obligation's recorded discharge event — the knowledge of how to release it. That is what makes hanging up able to actually release rather than merely forget.

Phantom lifecycles

Derived from the phantom labels in the declarations below — state! issues an obligation the compiler will chase, !state discharges it, a bare state holds it without moving it. Nothing here is hand-drawn.

Bridge 1 state session!

create

<session!> koru_std/bridge.kz:125

close

<!session> koru_std/bridge.kz:387