Wraith.Kiro.Runtime behaviour (Wraith v0.1.0)

View Source

Where the studio's Kiro Agent Server runs. Ported from shadow_corp's Kiro.Runtime: one implementation per environment, config :wraith, :kiro_runtime.

A runtime launches the VM with a payload the in-VM shim receives on its /run hook (the Kiro API key, the bridge key, the journal location), reports lifecycle state and tells us how to open the ACP and bridge WebSockets.

Summary

Types

attach()

@type attach() :: %{
  url: String.t(),
  protocols: [String.t()],
  expires_at: DateTime.t() | nil
}

id()

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

state()

@type state() :: :pending | :running | :suspended | :terminated | :failed

Callbacks

attach(id, t)

@callback attach(id(), String.t()) :: {:ok, attach()} | {:error, term()}

attach_bridge(id, t, keyword)

@callback attach_bridge(id(), String.t(), keyword()) :: {:ok, attach()} | {:error, term()}

checkpoint(id, t)

(optional)
@callback checkpoint(id(), String.t()) :: :ok | {:error, term()}

list()

(optional)
@callback list() :: {:ok, [%{id: id(), state: state()}]} | {:error, term()}

resume(id)

@callback resume(id()) :: :ok | {:error, term()}

start(map)

@callback start(map()) :: {:ok, %{id: id(), endpoint: String.t()}} | {:error, term()}

status(id)

@callback status(id()) :: {:ok, state()} | {:error, term()}

suspend(id)

@callback suspend(id()) :: :ok | {:error, term()}

terminate(id)

@callback terminate(id()) :: :ok | {:error, term()}

Functions

attach(id, endpoint)

attach_bridge(id, endpoint, opts \\ [])

checkpoint(id, endpoint)

impl()

list()

resume(id)

start(payload)

status(id)

suspend(id)

terminate(id)