Wraith. Kiro. ACP
(Wraith v0.1.0)
View Source
Ported from shadow_corp. A client for the Agent Client Protocol — JSON-RPC 2.0 over WebSocket — as spoken by the Kiro Agent Server (KAS).
One process per connection. The owner (the process that called
connect/2) receives everything the agent sends that is not a reply:
{:acp, pid, {:notification, method, params}}
{:acp, pid, {:request, id, method, params}} # answer with respond/3
{:acp, pid, {:closed, reason}}Replies to our own requests come back to the caller of request/4.
Two KAS facts baked in: over the WS transport every client is an
observer, so (1) _kiro/auth/getAccessToken can never be satisfied by
us — the credential lives in the VM — and (2) permission answers must go
through _kiro/permission/respond (permit/3), a plain reply is dropped.
Summary
Functions
Answer (or dismiss with nil) a _kiro/userInput question.
Returns a specification to start this module under a supervisor.
Close a live session (it stays on disk; ensure_session re-hydrates it).
Open a WebSocket to url (ws:// or wss://). opts[:protocols] are
Sec-WebSocket-Protocol values (MicroVM auth rides here), opts[:owner]
defaults to the caller. Returns once the upgrade succeeded.
Create-or-load a session under a caller-chosen id (idempotent +
overrideSessionId), with steering documents. extra carries e.g.
%{customAgents: [agent], modeId: agent.id}.
Fire a notification (no reply expected).
Grant/deny a session/request_permission the observer way.
Send a request and wait for the reply (result or error).
Switch a session's agent (mode): a reopened session keeps the one it was saved with otherwise.
A steering note into a session: _session/steer (a persisted user-style message).
Types
@type conn() :: pid()
Functions
Answer (or dismiss with nil) a _kiro/userInput question.
Returns a specification to start this module under a supervisor.
See Supervisor.
Close a live session (it stays on disk; ensure_session re-hydrates it).
Open a WebSocket to url (ws:// or wss://). opts[:protocols] are
Sec-WebSocket-Protocol values (MicroVM auth rides here), opts[:owner]
defaults to the caller. Returns once the upgrade succeeded.
Create-or-load a session under a caller-chosen id (idempotent +
overrideSessionId), with steering documents. extra carries e.g.
%{customAgents: [agent], modeId: agent.id}.
Fire a notification (no reply expected).
Grant/deny a session/request_permission the observer way.
Send a request and wait for the reply (result or error).
Switch a session's agent (mode): a reopened session keeps the one it was saved with otherwise.
A steering note into a session: _session/steer (a persisted user-style message).