Miosa.OpenComputers.Hosts (Miosa v1.0.0)

Copy Markdown View Source

Host registration and lifecycle.

A host is a physical or virtual machine you own that has been registered with MIOSA by installing the miosa-host agent. Once registered, MIOSA can dispatch jobs, manage files, issue tunnels, and run AI agents on it.

The host_key is returned only on creation — save it immediately.

Summary

Functions

Register a new host.

Stream live host events (SSE).

Get a host by ID.

List all registered hosts.

Revoke a host registration. The host loses access immediately.

Update host metadata (name, labels).

Types

result()

@type result() :: {:ok, map()} | {:error, Miosa.Error.t()}

Functions

create(client, attrs)

@spec create(Miosa.Client.t(), map()) :: result()

Register a new host.

attrs must include :name. Optional: :region, :labels.

The returned map includes host_key — shown once, store it securely.

events(client, host_id, callback)

@spec events(Miosa.Client.t(), String.t(), function()) ::
  :ok | {:error, Miosa.Error.t()}

Stream live host events (SSE).

The callback is called for each %{type: type, data: data} event map. Blocks until the stream ends. Returns :ok or {:error, reason}.

get(client, host_id)

@spec get(Miosa.Client.t(), String.t()) :: result()

Get a host by ID.

list(client, opts \\ [])

@spec list(
  Miosa.Client.t(),
  keyword()
) :: result()

List all registered hosts.

Options: :page, :per_page.

revoke(client, host_id)

@spec revoke(Miosa.Client.t(), String.t()) :: result()

Revoke a host registration. The host loses access immediately.

update(client, host_id, attrs)

@spec update(Miosa.Client.t(), String.t(), map()) :: result()

Update host metadata (name, labels).