@agentshouse/kit-wire
The Kit wire: every shape agents.house and the Kit exchange, declared once with
zod, and the wire computed from them.
- The Kit connection at
KIT_CONNECTION_PATH: each Kit call House sends (KIT_CALLS, one per
Kit method), the Result the Kit returns (KIT_CALL_RESULT), and the One-way calls each side
sends (HOUSE_ONE_WAY_CALLS, KIT_ONE_WAY_CALLS).
- Every
/kit/<act> request and answer (KIT_ACTS), the names of the door acts the Kit calls
at /kit/door/<act> (KIT_DOOR_ACTS), and the sign-in at /kit and /kit/token
(KIT_LOGIN_START, KIT_LOGIN_POLL and their answers).
- The request-metadata keys a call under an Environment's Kit credential names its Agent
conversation (
CONVERSATION_META_KEY) or its Environment function run
(FUNCTION_RUN_META_KEY) under, never both, and the request header App Git reads a
conversation from (CONVERSATION_GIT_HEADER).
KIT_WIRE is computed from those shapes, so a change to any of them is a new wire. A Kit
names it in the x-house-kit-wire header (KIT_WIRE_HEADER) of every request and in its
connection's subprotocol, KIT_CONNECTION_PROTOCOL_PREFIX followed by the wire. House serves
its own wire alone and answers any other with kit_update_required, whose release and
commands (BUILDING_KIT) name the Kit release its Building serves.
- At
@agentshouse/kit-wire/arguments, the arguments House takes for each door act
(KIT_DOOR_ARGUMENTS) and for each Tool the Kit calls itself over a conversation's House
connection (KIT_TOOLS, KIT_TOOL_ARGUMENTS), each a zod schema of the JSON Schema of the
shape House refuses a call with, so a rule House checks in its own code stays out. They are
no part of the wire: a changed argument is a new version of this package, not a new wire.
import { KIT_WIRE, KIT_WIRE_HEADER, KIT_CALL, type KitActRequest } from '@agentshouse/kit-wire';
const call = KIT_CALL.parse(JSON.parse(frame));
const ended: KitActRequest<'turns/end'> = { conversation, turn, content, failed };
await fetch(new URL('/kit/turns/end', house), {
method: 'POST',
headers: { 'content-type': 'application/json', [KIT_WIRE_HEADER]: KIT_WIRE },
body: JSON.stringify(ended),
});