feat: add gateway protocol attachment support

Extends the gateway wire protocol with GatewayAttachment type and
attachment event. agent.send handler now accepts optional attachments
parameter and converts them for the agent pipeline. Includes 5 new
tests for protocol and handler layers.
This commit is contained in:
William Valentin
2026-02-07 09:09:06 -08:00
parent b9bfee9c5b
commit e052778b0a
5 changed files with 93 additions and 4 deletions
+22
View File
@@ -29,12 +29,27 @@ export interface GatewayEvent {
data: unknown;
}
// ── Attachment data for gateway protocol messages ───────────────
/** Attachment data sent in agent.send params or emitted as events. */
export interface GatewayAttachment {
/** MIME type (e.g. "image/jpeg", "audio/ogg") */
mimeType: string;
/** Base64-encoded data */
data?: string;
/** URL to the resource */
url?: string;
/** Filename hint */
filename?: string;
}
// ── Event types emitted during agent.send ──────────────────────
export type EventType =
| 'content'
| 'tool_start'
| 'tool_end'
| 'attachment'
| 'done'
| 'error';
@@ -56,6 +71,13 @@ export interface ToolEndEventData {
};
}
export interface AttachmentEventData {
mimeType: string;
data?: string;
url?: string;
filename?: string;
}
export interface DoneEventData {
content: string;
}