PtcRunner.Kernel.Dispatcher (PtcRunner v0.14.0)

Copy Markdown View Source

Internal bounded capability invocation boundary.

Dispatch validates normalized arguments, atomically reserves environment and provider-task budgets in PtcRunner.Kernel.RunState, emits canonical attempt events, runs the trusted callback in a monitored heap-limited process, and constructs the uniform Lisp result envelope. An error capability-stopped event carries the closed envelope kind and reason; an unrecognized atom is retained only as a one-way fingerprint, and details stay off that event. Completion is checked against run closure so late results cannot re-enter Lisp.

Mission failures after callback entry are classified with the capability's declared effect. Read failures keep an explicit typed provider retry policy. Unclassified callback raises, exits, throws, and monitored process deaths default to non-retryable in both environments; Dispatcher-owned provider timeouts remain retryable. Write and unknown failures are non-retryable and carry mutation_state: :indeterminate when invocation may have reached external state and the outcome is unknown. A trusted ProviderError with dispatch_provenance: :not_dispatched or :dispatched preserves its specific policy without exposing that internal provenance. Workflow capabilities also retain explicit provider-owned retry policy. Before a mission provider publishes a terminal policy failure, its monitored callback records that classification in RunState so a subsequent evaluator kill cannot make the agent repeat the call.

A pre-callback input-schema rejection may add up to three schema-authored argument violations to the Lisp error envelope. The rejected arguments, undeclared property names, and opaque semantic-validator reasons remain withheld. Enum and const literals are never included. If bounded schema validation itself becomes unavailable, Dispatcher returns the distinct capability_unavailable/input_validation_unavailable category without charging protocol or capability-call budgets or emitting capability events.

Summary

Functions

Dispatches one capability through the bounded, context-aware boundary.

Functions

dispatch(state, environment, arg3, name, arguments, dispatch_context, event_sink, inspection_sink)

@spec dispatch(
  PtcRunner.Kernel.RunState.t(),
  :workflow | :mission,
  map(),
  binary(),
  map(),
  map(),
  term(),
  term()
) :: map()

Dispatches one capability through the bounded, context-aware boundary.