Documentation
¶
Overview ¶
Package block defines the reserved content-block envelope (xyz-spec §12.7): a result value whose JSON is an object with the single key "content", holding items of exactly the shapes
{"type": "text", "text": "..."}
{"type": "image", "mimeType": "...", "data": "<base64>"}
Handlers may return block.Envelope directly, or any equivalent shape — the frontends detect the envelope duck-typed, so the reserve is not tied to this package. Binary payloads are base64 on the wire, never bare bytes; use block.Image to construct them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Envelope ¶
type Envelope struct {
Content []Item `json:"content"`
}
Envelope is the reserved block envelope shape.
func DetectJSON ¶
DetectJSON reports whether raw is exactly the reserved envelope and, if so, returns the decoded envelope. Anything else — extra top-level keys, item shapes beyond text/image, unknown types — is not the envelope.
type Item ¶
type Item struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
MIMEType string `json:"mimeType,omitempty"`
Data string `json:"data,omitempty"`
}
Item is one block in the envelope. Use the Text/Image constructors; the struct is exported for direct literal use by handlers.