Liking cljdoc? Tell your friends :D

com.blockether.vis.internal.foundation.shim-attach

Built-in sandbox SHIM: attach — the ONE way a block hands an artifact it produced to the engine. A tool running in py3 writes any artifact (a PNG it rendered, a CSV/JSON/PDF/wav it built, whatever) and hands it to attach(path) (or attach(data, filename) for bytes it never wrote out), getting back the stored artifact's DESCRIPTOR; the engine then OWNS the bytes as a durable session_iteration_attachment row — surviving a web/TUI restart and (for image media-types) replayable to a vision model cross-turn.

No parsing, no round-trip through the model-facing stdout: we control the whole boundary. One Python front serves attach in a block and vis.attachments.create in an extension: _attachment_verbs of the SDK (blockether.vis._attachments). It reads the file through the confined open of its process, so a path outside the roots raises the normal sandbox error. Then it calls the host bridge with one options map and the type that the filename suggests as a hint. Each operation has one body here behind two door names: a __vis_record_attachment__ name for the sandbox and a __vis_host_attach__ name for an extension ([[extension-host-doors]]). The engine decides the media type ([[decide-attachment]]). The bridge appends the attachment map to the per-block *attachment-sink* (mpl-capture/record-attachment!). run-python-block drains that sink into the block outcome's :attachments; the loop stamps each with the producing block's tool-call-id and hands them to db-store-iteration!'s :attachments. The artifact's :id and :version are minted at the sink, so the block that produced it can address it immediately.

Registered unconditionally as a foundation shim, alongside ls: its :ext/sandbox-shims entry autoloads attach into every sandbox.

Built-in sandbox SHIM: `attach` — the ONE way a block hands an artifact it
produced to the engine. A tool running in `py3`
writes any artifact (a PNG it rendered, a CSV/JSON/PDF/wav it built, whatever)
and hands it to `attach(path)` (or `attach(data, filename)` for bytes it
never wrote out), getting back the stored artifact's DESCRIPTOR; the
engine then OWNS the bytes as a durable `session_iteration_attachment` row —
surviving a web/TUI restart and (for image media-types) replayable to a
vision model cross-turn.

No parsing, no round-trip through the model-facing stdout: we control the whole
boundary. One Python front serves `attach` in a block and `vis.attachments.create` in an
extension: `_attachment_verbs` of the SDK (`blockether.vis._attachments`). It reads
the file through the confined `open` of its process, so a path outside the roots
raises the normal sandbox error. Then it calls the host bridge with one options
map and the type that the filename suggests as a hint. Each operation has one
body here behind two door names: a `__vis_record_attachment__` name for the
sandbox and a `__vis_host_attach__` name for an extension
([[extension-host-doors]]). The engine decides the media type
([[decide-attachment]]). The bridge appends the attachment map to the
per-block `*attachment-sink*` (`mpl-capture/record-attachment!`). `run-python-block`
drains that sink into the block outcome's `:attachments`; the loop stamps each with
the producing block's tool-call-id and hands them to `db-store-iteration!`'s
`:attachments`. The artifact's `:id` and `:version` are minted at the sink, so
the block that produced it can address it immediately.

Registered unconditionally as a foundation shim, alongside `ls`: its
`:ext/sandbox-shims` entry autoloads `attach` into every sandbox.
raw docstring

attach-bridge-bindingsclj

(attach-bridge-bindings)

Shared sandbox operations for attachments and apps. Failures use the standard tool error hook.

Shared sandbox operations for attachments and apps. Failures use the standard tool error hook.
sourceraw docstring

attachment-descriptorclj

(attachment-descriptor a)

One session_attachment row as the compact DESCRIPTOR list_attachments() and get_attachment(id) hand the model: identity, provenance and shape, and never any bytes.

PROVENANCE STARTS AT THE TURN. Every row carries session_turn_soul_id, so every descriptor carries :turn-id — a user image and a tool artifact are placed the same way and a rail can be grouped by turn without a second lookup. :iteration-id / :tool-call-id are the FINER grain only a tool artifact has, so a user image omits both instead of carrying nils that say nothing.

:is-pending is false here by construction: a stored row is stored. The sandbox reader answers the same key true for an artifact the RUNNING block just attached, which is not in the database yet.

One `session_attachment` row as the compact DESCRIPTOR `list_attachments()` and
`get_attachment(id)` hand the model: identity, provenance and shape, and never
any bytes.

PROVENANCE STARTS AT THE TURN. Every row carries `session_turn_soul_id`, so
every descriptor carries `:turn-id` — a user image and a tool artifact are
placed the same way and a rail can be grouped by turn without a second
lookup. `:iteration-id` / `:tool-call-id` are the FINER grain only a tool
artifact has, so a user image omits both instead of carrying nils that say
nothing.

`:is-pending` is false here by construction: a stored row is stored. The
sandbox reader answers the same key `true` for an artifact the RUNNING block
just attached, which is not in the database yet.
sourceraw docstring

register!clj

(register!)
source

register-outside-source!clj

(register-outside-source! source-name source)

Register source under source-name, the :source of its descriptors: the attachments that another system owns and that a session can read, such as the resources of its MCP servers. Nothing stores them in the session. source has:

:list, a function of no arguments that gives the descriptors that the running session can read. Each has :id, :source, :filename and :version 1, and :uri when the attachment has an address. The doors add the other keys of a session descriptor; see [[outside-row]].

:locate, a function of one target that gives the descriptor of an attachment that :list does not give, or nil.

:read, a function of one descriptor that gives the attachment with its :base64, :media-type and :size.

Registering a name again replaces its source.

Register `source` under `source-name`, the `:source` of its descriptors: the
attachments that another system owns and that a session can read, such as the
resources of its MCP servers. Nothing stores them in the session. `source` has:

`:list`, a function of no arguments that gives the descriptors that the running
session can read. Each has `:id`, `:source`, `:filename` and `:version` 1, and
`:uri` when the attachment has an address. The doors add the other keys of a
session descriptor; see [[outside-row]].

`:locate`, a function of one target that gives the descriptor of an attachment
that `:list` does not give, or nil.

`:read`, a function of one descriptor that gives the attachment with its
`:base64`, `:media-type` and `:size`.

Registering a name again replaces its source.
sourceraw docstring

session-readerclj

(session-reader {:keys [db-info session-id]})

Build the attachment callbacks for one session. Check that the session owns each id before reading its bytes.

Build the attachment callbacks for one session. Check that the session owns each id before reading its bytes.
sourceraw docstring

vis-extensionclj

source

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close