This library is in flux. APIs may change without notice. Generated from source with koruc 0.1.7 on 10/5/2026.
Bridge
~import std/bridgeResource Bridge Standard Library — persistent handle storage for long-running interactive sessions (Hollywood OS mode)
bridge.kz · 2 tors · ~[comptime]· ~[runtime]
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
tors that may act on what the bridge holds, and — through each obligation's
recorded discharge tor — 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 get-handles
koru_std/bridge.kz:162// GET_HANDLES - Query handles currently on the bridge
~pub tor get-handles { br: *Bridge } -> u32// CLOSE - Hang up: release everything the session still holds
//
// VOID, and that is load-bearing rather than minimal. Auto-discharge can only
// insert a disposer with nothing to bind — `auto_discharge_inserter.zig:2742`
// refuses any tor carrying a branch or a bare return, because the inserter
// appends a bare call and cannot invent a binding for its output. A `close`
// that returned the still-held count disqualified itself, which meant every
// failure arm of every conversation had to spell the hang-up by hand.
// Failing to release is not a value a caller may drop; it panics. `get-handles`
// is there for anyone who wants the count on either side of the call.
~pub tor close { br: *Bridge<!session> }