Artifact cfcdc968be4769df7413b10082f0ad526af92542e34e957b8156e445158471b1:
- File docs/dev/share.md — part of check-in [18d06ffa63] at 2026-11-29 08:14:02 on branch share-artifacts — /share: publish to the HTML artifact publisher (user: dmestas, size: 1483) [annotate] [blame] [check-ins using]
/share to the artifact publisher
Status: built 2026-11-29 (ticket 16). Tier: bundled (src/share.c). Clock: vendor (the
publisher's HTTP API). Record: none; a share is a request the person confirmed, not a journal row.
Default: the publisher when a token is stored (or HTML_PUBLISHER_TOKEN is set) and artifactsUrl is set, else the gist.
src/share.c is called by the terminal interface's /share after the yes (share_run in
src/tui/app.c). pic_share_artifacts picks the destination from sessionShareDestination;
pic_share_publish does one POST {artifactsUrl}/api/artifacts over http.c and net.c, the
token in the Authorization: Bearer header and nowhere else, wiped after the call and scrubbed
from errors. The body is {title, message, user, files: {"index.html": base64}}; the reply's
viewerUrl is what the terminal shows.
A text file over 256 KB is a blob in the publisher: the page is first sent with
PUT /api/blobs/SHA256 (Content-Type: text/html) and the artifact's index.html is the pointer
file (artifact-blob 1, sha256, size, type), as the publisher's public/client.js does.
The token is a credential named artifacts, a key that serves no model: pic_model_keyname
(src/model.c) accepts it, as it does brave-search, so pic login artifacts and /login take
it and routing rules and imports refuse it. test/tui/share.sh runs the whole path against
fake_server; it never uses the real publisher or a real token.