ExternalRuntimeTransport.ExecutionSurface (ExternalRuntimeTransport v0.1.0)

Copy Markdown View Source

Public execution-surface contract for process placement and transport routing.

This contract is intentionally narrow:

  • surface_kind selects the runtime surface
  • transport_options carries transport-only data
  • target_id, lease_ref, surface_ref, and boundary_class stay typed
  • observability remains an opaque metadata bag

Provider family, command selection, and process launch arguments do not belong in ExecutionSurface.

Summary

Types

adapter_surface_kind()

@type adapter_surface_kind() :: atom()

boundary_class()

@type boundary_class() :: atom() | String.t() | nil

contract_version()

@type contract_version() :: String.t()

dispatch()

@type dispatch() :: %{start: function(), start_link: function(), run: function()}

projected_t()

@type projected_t() :: %{
  contract_version: contract_version(),
  surface_kind: surface_kind(),
  transport_options: map(),
  target_id: String.t() | nil,
  lease_ref: String.t() | nil,
  surface_ref: String.t() | nil,
  boundary_class: boundary_class(),
  observability: map()
}

reserved_key()

@type reserved_key() ::
  :contract_version
  | :surface_kind
  | :transport_options
  | :target_id
  | :lease_ref
  | :surface_ref
  | :boundary_class
  | :observability

resolution_error()

@type resolution_error() :: {:unsupported_surface_kind, surface_kind()}

resolved()

@type resolved() :: %{
  adapter_capabilities:
    ExternalRuntimeTransport.ExecutionSurface.Capabilities.t(),
  dispatch: dispatch(),
  adapter_options: keyword(),
  surface: t()
}

surface_kind()

@type surface_kind() :: :local_subprocess | :ssh_exec | :guest_bridge

t()

@type t() :: %ExternalRuntimeTransport.ExecutionSurface{
  boundary_class: boundary_class(),
  contract_version: contract_version(),
  lease_ref: String.t() | nil,
  observability: map(),
  surface_kind: surface_kind(),
  surface_ref: String.t() | nil,
  target_id: String.t() | nil,
  transport_options: keyword()
}

validation_error()

@type validation_error() ::
  {:invalid_contract_version, term()}
  | {:invalid_surface_kind, term()}
  | {:invalid_transport_options, term()}
  | {:invalid_execution_surface, term()}
  | {:invalid_target_id, term()}
  | {:invalid_lease_ref, term()}
  | {:invalid_surface_ref, term()}
  | {:invalid_boundary_class, term()}
  | {:invalid_observability, term()}
  | {:adapter_not_loaded, module()}

Functions

capabilities(surface_kind)

@spec capabilities(t() | surface_kind() | keyword() | map() | nil) ::
  {:ok, ExternalRuntimeTransport.ExecutionSurface.Capabilities.t()}
  | {:error, term()}

contract_version()

@spec contract_version() :: String.t()

default_surface_kind()

@spec default_surface_kind() :: :local_subprocess

new(opts)

@spec new(keyword()) :: {:ok, t()} | {:error, validation_error()}

nonlocal_path_surface?(surface)

@spec nonlocal_path_surface?(t() | surface_kind() | keyword() | map() | nil) ::
  boolean()

normalize_surface_kind(surface_kind)

@spec normalize_surface_kind(term()) ::
  {:ok, surface_kind()} | {:error, {:invalid_surface_kind, term()}}

normalize_transport_options(options)

@spec normalize_transport_options(term()) ::
  {:ok, keyword()} | {:error, {:invalid_transport_options, term()}}

path_semantics(surface)

remote_surface?(surface)

@spec remote_surface?(t() | surface_kind() | keyword() | map() | nil) :: boolean()

remote_surface_kind?(surface_kind)

@spec remote_surface_kind?(surface_kind()) :: boolean()

reserved_keys()

@spec reserved_keys() :: [reserved_key(), ...]

resolve(opts)

@spec resolve(keyword()) ::
  {:ok, resolved()} | {:error, validation_error() | resolution_error()}

supported_surface_kinds()

@spec supported_surface_kinds() :: [adapter_surface_kind(), ...]

surface_metadata(surface)

@spec surface_metadata(t()) :: keyword()

to_map(surface)

@spec to_map(t()) :: projected_t()