Wraith.Studio (Wraith v0.1.0)

View Source

The agent studio: a Kiro agent, running on a MicroVM (or the offline fake), that builds this site with you — writes posts, scripts widgets, changes settings — through Wraith.Studio.Tools over the bridge.

One site has one studio (Wraith.Studio.Server, a singleton), which owns one KAS conversation at a time (sessions/0 lists past ones; new_session/1 starts a fresh one). The Kiro API key is set once (set_key/1, Vault-encrypted into the site item) or comes from KIRO_API_KEY.

Events for LiveViews are on the "studio" PubSub topic:

{:studio, :entries, [entry]}            # the whole transcript (replace)
{:studio, :entry, entry}                # one new/changed entry (upsert by id)
{:studio, :state, %{phase, turn, pending}}  # phase: :off | :booting | :ready | :error

Summary

Functions

agent(site)

The custom agent the studio conversation runs as: built-ins plus the wraith server.

agent_rev()

answer(tool_call_id, answer)

See Wraith.Studio.Server.answer/2.

broadcast(msg)

cancel()

See Wraith.Studio.Server.cancel/0.

clear_key()

close_session_row(row)

create_session(user_id)

current_session(user_id)

The current session row, created if none.

entries(session_id)

Persisted transcript entries of a session, oldest first.

key()

The key in the clear — for the VM payload only.

key?()

key_hint()

new_session(user)

See Wraith.Studio.Server.new_session/1.

permit(tool_call_id, option_id)

See Wraith.Studio.Server.permit/2.

prompt(text, user)

See Wraith.Studio.Server.prompt/2.

save_entry(session_id, entry, seq)

sessions()

set_key(raw)

Verify and store a Kiro API key. Shows only its hint afterwards.

shutdown()

See Wraith.Studio.Server.shutdown/0.

state()

See Wraith.Studio.Server.state/0.

steering(site)

subscribe()

update_session(row, fun)

wake(user)

See Wraith.Studio.Server.wake/1.