symfonic.capabilities.human.pausing¶
pausing ¶
The handler that turns a reserved interaction call into a stopped run.
Split out of :mod:~symfonic.capabilities.human.contribution when HK2 gave the
pause a second thing to record. contribution is the declaration -- what
this capability offers a compiler, and why each half of it exists -- and this
module is the one behaviour that declaration routes to. They were one module
while the behaviour was "mint a token and raise"; the reasoning for the split is
the same line-budget rule that put typed_interrupts next door to
typed_projection rather than inside it.
The ordering below is the whole of HK2's "earned, not announced" property, and
it is an ordering rather than a flag: the handler asks the capability to pause,
the capability writes the turn state and reports whether the write landed, and
only that report becomes PendingInterrupt.resumable. Nothing in this module
can set it to True on its own, which is what makes the property structural
instead of a rule somebody has to remember.
PauseBinding
dataclass
¶
PauseBinding(pin: Any = None, scope: Any = None, run_id: str = '', root_run_id: str = '', session_id: str = '', thread_id: str = '', checkpoint_id: str | None = None)
What a pause has to be bound to, resolved per run by the composition root.
Every field is a fact about this run and none of them is known when the
plan is compiled, which is why this arrives through a callable rather than
on the capability: a bundle folded once at construction would bind every
turn to the first turn's tenant, run and thread. That is the same defect
TurnRequest.scope exists to correct, one capability over.
checkpoint_id may be None, in which case the capability resolves it
through its checkpoint port. A deployment with neither cannot pause, and
:meth:HumanInteractionCapability.pause refuses rather than minting a
token bound to no checkpoint.
pause_handler ¶
pause_handler(capability: Any, binding: Callable[[], PauseBinding | None], encode_token: Callable[[Any], str]) -> Callable[[Any], Any]
Build the handler that turns a reserved interaction call into a pause.
Source code in src/symfonic/capabilities/human/pausing.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |