Skip to main content

Module dispatch

Module dispatch 

Source
Expand description

Command dispatch — the single execution path for all commands.

The CommandDispatcher trait defines how a single command is resolved and executed. The Kernel implements this trait with the full dispatch chain: user tools → builtins → .kai scripts → external commands → backend tools.

PipelineRunner calls dispatcher.dispatch() for each command in a pipeline, handling I/O routing (stdin piping, redirects) around each call.

Stmt::Command ──┐
                 ├──▶ execute_pipeline() ──▶ PipelineRunner::run(dispatcher, commands, ctx)
Stmt::Pipeline ──┘                                  │
                                              for each command:
                                                dispatcher.dispatch(cmd, ctx)
                                                    │
                                              ┌─────┼──────────────┐
                                              │     │              │
                                         user_tools builtins  .kai scripts
                                                               external cmds
                                                               backend tools

Structs§

BackendDispatcher
Fallback dispatcher that routes through backend.call_tool().

Enums§

PipelinePosition
Position of a command within a pipeline.

Traits§

CommandDispatcher
Trait for dispatching a single command through the full resolution chain.