Skip to main content

Module attach

Module attach 

Source
Expand description

Files a message names as @path, read to go with it: an image as an image, any other file as its text, capped the way read shows it, so the model needs no read call for it.

Structs§

Attached
What a message’s @path references came to.

Functions§

attached_file
The label and the contents of an attached text file, when text is one, so a view can show it without the markup around it.
attachments
The files text names with @path, each once, resolved from base in workspace and read from it. Every @ token that names a file there is attached, whatever its shape (@notes.md, @src/lib.rs, @Makefile, @.env); one with no file there is missing when it looks like a path, and otherwise stays text, such as @alice or @alice.smith. A token’s trailing punctuation is not part of its path. A leading ~/ is the user’s home on this machine; in another workspace it is not attached, with a note.
first_typed
What the user typed first in conversation (typed).
is_image_path
Whether path names an image by its extension.
is_path_reference
Whether reference, an @ token without its @, looks like a path by its shape alone: it holds a /, or ends in a dot and one to four letters or digits. attachments reports such a token as missing when no file is there; any other token (a mention, an address, or a file with no extension) is attached only when its file is there, and is otherwise left as text.
read_image
The image at path in workspace as message content, its type told by its first bytes; why not, for a file that cannot be read, is larger than a provider takes, or is not a PNG, JPEG, GIF or WebP image.
typed
What the user typed in message at of conversation: the text items of a message of the user’s own (EntryRef::is_users_own), never of one an agent or a plugin delivered, such as a note, nor a file attached, each trimmed, joined by a blank line; None when it has none.