Hugs
A hug’s page has no network. Files go in as attachments, come back through upload slots, and everything is
read, uploaded and downloaded through the host, with the viewer’s permissions.
Attachments: files the page shows
The agent uploads workspace files and passes them with the ask:ctx.attach(paths)takes paths or globs inside the workspace, with an optionallabel— at most 25 files of 25 MB each. A file that can’t be attached (no match, too large, outside the workspace) is logged and left out.- Each attachment is
{ artifact_id, name, size, content_type, sha256 }. Pass theartifact_ids in the params, so the page knows which file is which. - On a resume (
wait: 'yield'), don’t attach again:ctx.hug.resumed().length > 0.
hug.attachments lists them:
compare-versions reads two text files this way and shows images with file_url;
image-markup draws on an image loaded with file_url.
read_file works for an attachment, the viewer’s own uploads, and — in view mode — the files in the answer being
shown. At most 10 reads at once and 50 MB per page.
Upload slots: files people send
Afile() field in the definition is an upload slot:
In the page,
<cliq-file key="evidence"> does the whole thing. By hand:
upload rejects with a HugError — upload_cancelled, file_too_large, file_type, upload_failed. The file is
checked against the slot by the host and again by CliqHub (by declared type, extension and first bytes).
In the agent, the answer holds the reference, not the bytes:
cliq hug files (Asking people).
Downloads
<cliq-attachment> has a Download
button.
Links
http and https.