# /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.
`pic share` (the child `/share` runs) takes the page on stdin and sends nothing without a yes: a
prompt on `/dev/tty`, or `--yes`. The overlay shows the address from `pic share --where` and hands
that same address to the child as `--to URL --yes`, so a setting changed while it is open cannot
redirect the page. The child is given 30 seconds (`run_piped` in `src/tui/app.c` ends it after
that); the overlay's notice says it is sharing. `pic_share_url_ok` is the one check for an address
and for the viewer link: https://, or http:// to 127.0.0.1, localhost or [::1], printable ASCII
only. `artifactsUrl` falls back to `HTML_PUBLISHER_URL`.
`--yes --to URL` is the one way past the yes, and it sends the stored publisher token to any
https:// address it names. A model's `bash` call could run it, as it could run `curl` with the same
token: the permission mode, not `pic share`, is what stands between a model and that call. The
token is one the user stored for this publisher; a user who lets a model run commands unasked
should keep it out of the store and use `HTML_PUBLISHER_TOKEN` only when sharing.