CliSubprocessCore.Runtime (CliSubprocessCore v0.1.0)

Copy Markdown View Source

Runtime state helpers for normalized session event emission.

Summary

Functions

Returns runtime metadata for observability and session inspection.

Creates a new runtime state.

Emits the next normalized event and increments the runtime sequence.

Stores a single metadata key on the runtime state.

Replaces the provider session identifier tracked by the runtime.

Types

t()

@type t() :: %CliSubprocessCore.Runtime{
  metadata: map(),
  profile: module(),
  provider: atom(),
  provider_session_id: String.t() | nil,
  sequence: non_neg_integer()
}

Functions

info(runtime)

@spec info(t()) :: map()

Returns runtime metadata for observability and session inspection.

new(opts)

@spec new(keyword()) :: t()

Creates a new runtime state.

next_event(runtime, kind, payload, opts \\ [])

Emits the next normalized event and increments the runtime sequence.

put_metadata(runtime, key, value)

@spec put_metadata(t(), atom() | String.t(), term()) :: t()

Stores a single metadata key on the runtime state.

put_provider_session_id(runtime, provider_session_id)

@spec put_provider_session_id(t(), String.t() | nil) :: t()

Replaces the provider session identifier tracked by the runtime.