Move pending state/artifact deltas from ctx onto the event. TODO: Handle non-persisted states (e.g. `temp:` prefixed keys) that should flow through ctx but not be written to session events.
(self, event: Event, ctx: Context)
| 379 | ctx._route_emitted = True |
| 380 | |
| 381 | def _flush_deltas(self, event: Event, ctx: Context) -> None: |
| 382 | """Move pending state/artifact deltas from ctx onto the event. |
| 383 | |
| 384 | TODO: Handle non-persisted states (e.g. `temp:` prefixed keys) |
| 385 | that should flow through ctx but not be written to session events. |
| 386 | """ |
| 387 | from ..events.event_actions import EventActions |
| 388 | |
| 389 | state_delta = ctx.actions.state_delta |
| 390 | artifact_delta = ctx.actions.artifact_delta |
| 391 | if not state_delta and not artifact_delta: |
| 392 | return |
| 393 | |
| 394 | if not event.actions: |
| 395 | event.actions = EventActions() |
| 396 | if state_delta: |
| 397 | event.actions.state_delta.update(state_delta) |
| 398 | state_delta.clear() |
| 399 | if artifact_delta: |
| 400 | event.actions.artifact_delta.update(artifact_delta) |
| 401 | artifact_delta.clear() |
| 402 | |
| 403 | def _enrich_event(self, event: Event, ctx: Context) -> None: |
| 404 | """Set author, node_info, invocation_id on the event.""" |
no test coverage detected