Expand description
Prompt attachments: upload a file to the Grok Bot attachment store and get an alias
to send with SendPrompt::attachment_paths.
The flow is BeginGrokBotAttachmentUpload → HTTPS PUT of the bytes to the presigned
URL(s) the backend returned → CompleteGrokBotAttachmentUpload, which returns the
alias. All four backend calls need a Cursor access token (a client built with
Client::connect_cursor or
Client::with_cursor_token).
The presigned PUT never carries a bearer token: only the headers the backend
returned are sent, only to the exact URL it returned, and only over https
(loopback http is allowed with Policy::allow_local_backend).
Errors name the upload host, never the URL’s query string or signature.
Structs§
- Attachment
Read - One resolved read (
GrokBotAttachmentRead). - Begin
Upload BeginGrokBotAttachmentUploadresponse.- Completed
Upload CompleteGrokBotAttachmentUploadresponse.- Presigned
Parts PresignGrokBotAttachmentUploadPartsresponse.- Upload
Part - One presigned part (
GrokBotAttachmentUploadPart). - Upload
Progress - Progress of
Client::upload_attachment. - Upload
Target - A presigned request target (
GrokBotAttachmentUploadRequestTarget). - Uploaded
Attachment - A successfully uploaded attachment, ready for
SendPrompt.
Enums§
- Attachment
Kind - The broad kind of a file, from its extension (drives the client-side size limit).
- Read
Outcome - Where an attachment can be read from (
GrokBotAttachmentReadOutcome). - Upload
Failure - Why
Client::upload_attachmentcould not produce an alias. - Upload
Mode - How the backend wants the file uploaded (
GrokBotAttachmentUploadMode). - Upload
Refusal - Why an upload was refused (
GrokBotAttachmentUploadRefusal).
Constants§
- MAX_
ATTACHMENTS_ PER_ PROMPT - Most attachments the desktop app stages on one prompt.
- MAX_
FILE_ BYTES - Size limit for non-image, non-video files.
- MAX_
IMAGE_ BYTES - Image size limit the desktop app enforces before uploading (the server is final).
- MAX_
VIDEO_ BYTES - Size limit for video.
Functions§
- sha256_
hex - SHA-256 as lowercase hex.
- url_
host - The host of a URL, without credentials, path or query.
- validate_
attachment - Check a file name and size the way the desktop app does before uploading.