Skip to content

Commit aac44fc

Browse files
committed
feat: invoke callback group — spawn external work from states
Add invoke as a first-class callback group (CallbackGroup.INVOKE), following SCXML <invoke> semantics. States can spawn background work (API calls, file I/O, child state machines) on entry and cancel it on exit. - New CallbackGroup.INVOKE with convention naming (on_invoke_<state>), decorator (@state.invoke), and inline callables - IInvoke protocol for advanced handlers with InvokeContext (cancellation, send events to parent, machine reference) - StateChartInvoker adapter for child state machine invocation - invoke_group() for running multiple callables concurrently and waiting for all results as a single done.invoke event - InvokeManager lifecycle management integrated into both sync and async engines (sync: daemon threads, async: thread executor wrapped in asyncio.Task) - done_invoke_<state> factory prefix maps to done.invoke.<state> event family - visitor pattern (visit/async_visit) on CallbacksExecutor and CallbacksRegistry - __contains__ on CallbacksRegistry to avoid direct _registry access - Full test suite and documentation with practical file I/O examples
1 parent 3b5ef35 commit aac44fc

12 files changed

Lines changed: 1480 additions & 6 deletions

File tree

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ integrations
1919
diagram
2020
weighted_transitions
2121
processing_model
22+
invoke
2223
statecharts
2324
api
2425
auto_examples/index

0 commit comments

Comments
 (0)