SagentsLiveDebugger.Router (Sagents LiveDebugger v0.4.0-rc.2)

Copy Markdown

Router macro for mounting the debugger in a Phoenix application.

Options

  • :coordinator (required) - The coordinator module for managing agent sessions.

  • :pubsub (required) - The Phoenix.PubSub instance the host application uses to broadcast agent and presence events. The debugger subscribes to Sagents.Subscriber.presence_topic/0 and to per-conversation viewer presence topics on this PubSub.

  • :presence_module - Optional presence module for real-time viewer updates.

  • :live_socket_path - Configures the socket path. Must match the socket "/live", Phoenix.LiveView.Socket in your endpoint. Defaults to "/live".

  • :csp_nonce_assign_key - An assign key to find the CSP nonce value used for assets. Supports either atom() (used for both script and style nonces) or a map of type %{optional(:script) => atom(), optional(:style) => atom()}.

Examples

import SagentsLiveDebugger.Router

scope "/dev" do
  pipe_through :browser

  sagents_live_debugger "/debug/agents",
    coordinator: MyApp.Coordinator,
    pubsub: MyApp.PubSub,
    presence_module: MyAppWeb.Presence
end

With CSP nonces:

sagents_live_debugger "/debug/agents",
  coordinator: MyApp.Coordinator,
  pubsub: MyApp.PubSub,
  csp_nonce_assign_key: :csp_nonce

Summary

Functions

sagents_live_debugger(path, opts \\ [])

(macro)