feat: support general chat file attachments

This commit is contained in:
Federico Jaramillo Martinez
2026-06-25 21:32:07 +02:00
parent 790b36f0ea
commit 7e812aa7f5
11 changed files with 397 additions and 96 deletions
+18 -6
View File
@@ -176,14 +176,13 @@ export interface QueuedSessionMessage {
}
/**
* A binary attachment carried with a prompt. The wire format mirrors pi's own
* `ImageContent` shape (`{ type: "image", data, mimeType }`) so attachments are
* fully compatible with the underlying pi coding agent.
* A pi-native image attachment carried with a prompt. The wire format mirrors
* pi's own `ImageContent` shape (`{ type: "image", data, mimeType }`) so these
* attachments are compatible with native multimodal delivery after validation.
*/
export interface PromptAttachment {
/** Kind of attachment. Only images are supported by pi today. */
export interface PromptImageAttachment {
kind: "image";
/** IANA mime type (for example "image/png"). */
/** Supported image MIME type (image/png, image/jpeg, image/gif, or image/webp). */
mimeType: string;
/** Base64-encoded binary payload (no data: URL prefix). */
data: string;
@@ -191,6 +190,19 @@ export interface PromptAttachment {
name?: string;
}
/** A general file attachment that must be saved into the workspace before use. */
export interface PromptFileAttachment {
kind: "file";
/** Non-empty IANA MIME type (for example "application/pdf"). */
mimeType: string;
/** Base64-encoded binary payload (no data: URL prefix). Empty for zero-byte files. */
data: string;
/** Optional original filename, used for previews and folder-mode filenames. */
name?: string;
}
export type PromptAttachment = PromptImageAttachment | PromptFileAttachment;
/**
* How prompt attachments should be delivered to the session.
* - "inline": send the binary to pi as native image content (multimodal input).