Pixir.Delegate.DaemonClient (pixir v0.1.5)

Copy Markdown View Source

Short-lived CLI client for the workspace-local Delegate daemon.

This module owns the IPC attempt from ordinary pixir delegate commands into a manually started foreground daemon. It treats stale endpoint files and closed sockets as fallback-capable daemon unavailability, while authentication or workspace mismatch remain explicit structured errors.

Summary

Functions

Call the workspace-local daemon.

Follow a daemon stream, emitting progress frames until a final payload arrives.

Return daemon status through IPC.

Ask the daemon to stop.

Functions

call(action, body, opts \\ [])

@spec call(String.t(), map(), keyword()) :: {:ok, map()} | {:error, map()}

Call the workspace-local daemon.

follow(action, body, emit_frame, opts \\ [])

@spec follow(String.t(), map(), (map() -> term()), keyword()) ::
  {:ok, map()} | {:error, map()}

Follow a daemon stream, emitting progress frames until a final payload arrives.

The daemon sends zero or more %{"ipc_frame" => true} packets followed by the normal %{"ipc_ok" => true, "payload" => ...} response. The callback receives decoded frame maps in-order and should keep side effects bounded to presentation.

status(opts \\ [])

@spec status(keyword()) :: {:ok, map()} | {:error, map()}

Return daemon status through IPC.

stop(opts \\ [])

@spec stop(keyword()) :: {:ok, map()} | {:error, map()}

Ask the daemon to stop.