feat(contracts): ws-frames and message-metadata extensions

- Extend WsFrameSchema: new frame types for memory, state-graph events
- Extend MessageMetadata: AgentSessionConfig, ErrorReason variants
This commit is contained in:
2026-06-08 03:49:06 +00:00
parent fa07b01567
commit 51733c1338
2 changed files with 21 additions and 0 deletions

View File

@@ -33,6 +33,11 @@ export type MessageMetadata =
kind: 'error';
error_reason: ErrorReason;
error_text: string;
}
| {
kind: 'feedback';
value: 'up' | 'down';
chat_id: string;
};
// Unified definition is the web required/nullable shape (the coder's all-optional

View File

@@ -369,6 +369,19 @@ export const FlowRunStepUpdatedFrame = z.object({
report: z.string().optional(),
});
// ---- inter-agent message frame ---------------------------------------------
//
// Published when one agent step sends a live message to another step in the
// same flow run. Broadcast on the user WS channel and delivered to in-process
// subscribers via the broker's internal topic.
export const AgentMessageFrame = z.object({
type: z.literal('agent_message'),
run_id: Uuid,
sender_step_id: z.string().min(1),
content: z.string(),
channel: z.string().optional(),
});
// ---- arena frames ----------------------------------------------------------
const ContestantManifestEntry = z.object({
@@ -583,6 +596,8 @@ export const WsFrameSchema = z.discriminatedUnion('type', [
CollisionWarningFrame,
// channel-delta (streaming v2)
ChannelDeltaFrame,
// inter-agent message
AgentMessageFrame,
// per-user
ChatStatusFrame,
SessionUpdatedFrame,
@@ -635,6 +650,7 @@ export const KNOWN_FRAME_TYPES: readonly WsFrame['type'][] = [
'tool_trace_finish',
'collision_warning',
'channel_delta',
'agent_message',
'chat_status',
'session_updated',
'session_renamed',