Packages

A Gleam library for building and orchestrating agents on the BEAM.

Current section

Files

Jump to
pig src pig@obs@emit.erl
Raw

src/pig@obs@emit.erl

-module(pig@obs@emit).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/pig/obs/emit.gleam").
-export([to_dispatcher/2]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(
" Event emission utilities.\n"
"\n"
" Provides functions to emit SessionEvents to the dispatcher.\n"
" This module bridges events.gleam and dispatcher.gleam to avoid circular imports.\n"
).
-file("src/pig/obs/emit.gleam", 14).
?DOC(
" Send a SessionEvent to the dispatcher actor.\n"
" Takes the dispatcher Subject directly — only what it needs.\n"
" This is the primary way for the core agent code to emit observability events\n"
" through the dispatcher to all registered consumers (session writer, terminal, etc.).\n"
).
-spec to_dispatcher(
gleam@erlang@process:subject(pig@obs@dispatcher:dispatcher_message()),
pig@obs@events:session_event()
) -> nil.
to_dispatcher(Dispatcher_subject, Event) ->
gleam@erlang@process:send(Dispatcher_subject, {event, Event}).