AmpSdk.Runtime.CLI (AmpSdk v0.6.0)

Copy Markdown View Source

Session-oriented runtime kit for the shared Amp CLI lane.

The tagged mailbox event atom is adapter detail. Higher-level callers should consume AmpSdk.Stream or projected AmpSdk.Types.* messages instead of treating the underlying session tag as core identity.

Summary

Types

execute_input()

@type execute_input() :: String.t() | [AmpSdk.Types.UserInputMessage.t() | map()]

start_option()

@type start_option() ::
  {:input, execute_input()}
  | {:options, AmpSdk.Types.Options.t()}
  | {:subscriber, pid() | {pid(), reference() | :legacy}}
  | {:metadata, map()}
  | {:session_event_tag, atom()}

Functions

build_args(options)

@spec build_args(AmpSdk.Types.Options.t()) :: [String.t()]

build_args(options, input_mode)

@spec build_args(AmpSdk.Types.Options.t(), :prompt | :json_input) :: [String.t()]

build_invocation(opts)

@spec build_invocation(keyword()) ::
  {:ok, CliSubprocessCore.Command.t()} | {:error, term()}

capabilities()

@spec capabilities() :: [atom()]

close(session)

@spec close(pid()) :: :ok

end_input(session)

@spec end_input(pid()) :: :ok | {:error, term()}

info(session)

@spec info(pid()) :: map()

interrupt(session)

@spec interrupt(pid()) :: :ok | {:error, term()}

list_provider_sessions(opts \\ [])

@spec list_provider_sessions(keyword()) :: {:ok, [map()]} | {:error, term()}

new_projection_state(info \\ %{})

@spec new_projection_state(map()) :: map()

project_event(event, state)

@spec project_event(CliSubprocessCore.Event.t(), map()) ::
  {[AmpSdk.Types.stream_message()], map()}

send_input(session, input, opts \\ [])

@spec send_input(pid(), execute_input(), keyword()) :: :ok | {:error, term()}

start_session(opts)

@spec start_session([start_option()]) ::
  {:ok, pid(),
   %{info: map(), projection_state: map(), temp_dir: String.t() | nil}}
  | {:error, term()}

stderr_chunk(event)

@spec stderr_chunk(CliSubprocessCore.Event.t()) :: String.t() | nil

subscribe(session, pid, ref)

@spec subscribe(pid(), pid(), reference()) :: :ok | {:error, term()}