LemonRouter.RunProcess (lemon_router v0.1.0)

View Source

Process that owns a single run lifecycle.

RunProcess expects a router-built %LemonCore.ExecutionCommand{} at init time. Router-owned conversation identity must already be resolved before this process submits work into the configured runtime.

Each RunProcess:

  • Owns a run_id
  • Manages abort state
  • Subscribes to Bus for run events
  • Maintains metadata snapshot
  • Emits router-level events

Heavy logic is delegated to focused submodules:

  • RunProcess.Watchdog -- idle-run watchdog timer
  • RunProcess.CompactionTrigger -- context-overflow & compaction markers
  • RunProcess.RetryHandler -- zero-answer auto-retry
  • LemonRouter.SurfaceManager -- semantic answer/status coordination and fanout
  • RunProcess.ArtifactTracker -- generated file tracking and answer metadata enrichment
  • LemonRouter.MediaJobRecorder -- generated media delivery metadata recording

Summary

Functions

Returns a specification to start this module under a supervisor.

Keep an active run alive (or cancel it) when watchdog keepalive UI is used.

Functions

abort(pid_or_run_id, reason \\ :user_requested)

@spec abort(pid() | binary(), reason :: term()) :: :ok

Abort this run process.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

keep_alive(pid_or_run_id, decision \\ :continue)

@spec keep_alive(pid() | binary(), decision :: :continue | :cancel) :: :ok

Keep an active run alive (or cancel it) when watchdog keepalive UI is used.

start_link(opts)