The canonical per-form DISPLAY contract — ONE source of truth for the fields a channel reads to render an executed form, live (via the gateway) and restored (via the DB).
Why this exists: the SAME field set used to be hand-listed in independent
allowlists across the loop, persistence, gateway, progress, and restored display
paths. Now every layer projects the WHOLE set through ->display (outbound) /
<-wire (inbound), so a new display field is a ONE-line change to
display-keys and form-roundtrip-test fails if a boundary stops carrying it.
Transformed fields (:stdout/:error bounded, :silent/:duration_ms
renamed) stay as explicit gateway overrides — they are not carried verbatim, so
they are NOT in this set.
The canonical per-form DISPLAY contract — ONE source of truth for the fields a channel reads to render an executed form, live (via the gateway) and restored (via the DB). Why this exists: the SAME field set used to be hand-listed in independent allowlists across the loop, persistence, gateway, progress, and restored display paths. Now every layer projects the WHOLE set through `->display` (outbound) / `<-wire` (inbound), so a new display field is a ONE-line change to `display-keys` and `form-roundtrip-test` fails if a boundary stops carrying it. Transformed fields (`:stdout`/`:error` bounded, `:silent`/`:duration_ms` renamed) stay as explicit gateway overrides — they are not carried verbatim, so they are NOT in this set.
(->display m)Project the canonical display fields off a source map (loop chunk/block, a restored row) — the ONE projection every form builder + the gateway uses instead of hand-listing keys. Drops nils so a merge never stamps empty keys.
Project the canonical display fields off a source map (loop chunk/block, a restored row) — the ONE projection every form builder + the gateway uses instead of hand-listing keys. Drops nils so a merge never stamps empty keys.
(<-wire event)Read the canonical display fields back off a gateway WIRE event into a form,
using the literal wire spelling declared beside each engine key in
display-fields. The single inbound projection channels use — the mirror of
->display.
Read the canonical display fields back off a gateway WIRE event into a form, using the literal wire spelling declared beside each engine key in `display-fields`. The single inbound projection channels use — the mirror of `->display`.
(coalesce-forms forms)Merge each maximal run of ADJACENT, successful coalescable native op-cards into
a single card: format_code folds adjacent per-file acks into one roll-up
across files. Every other form passes through untouched — batching tools such
as cat, patch and grep already carry every path of one call in ONE card, so
two adjacent cards are two genuinely distinct calls. The ONE projection both
channels apply before rendering an iteration's forms, so repeated tool acks
never render as a stack of look-alike sibling bubbles. Always returns a vector.
Merge each maximal run of ADJACENT, successful coalescable native op-cards into a single card: `format_code` folds adjacent per-file acks into one roll-up across files. Every other form passes through untouched — batching tools such as cat, patch and grep already carry every path of one call in ONE card, so two adjacent cards are two genuinely distinct calls. The ONE projection both channels apply before rendering an iteration's forms, so repeated tool acks never render as a stack of look-alike sibling bubbles. Always returns a vector.
The canonical engine keys projected by ->display and recovered by <-wire.
The canonical engine keys projected by `->display` and recovered by `<-wire`.
(hide-tool-code? {:keys [error success?] :as form})Should a channel DROP a form's invocation source instead of showing it as a
separate code block? Successful native tools already have a result card, so
their synthesized invocation is redundant. Failed native tools keep source
context. python_execution is different: its program is user-relevant
evidence and remains visible on both success and failure. This is the shared
TUI/channel policy; web mirrors it at the wire boundary.
Should a channel DROP a form's invocation source instead of showing it as a separate code block? Successful native tools already have a result card, so their synthesized invocation is redundant. Failed native tools keep source context. `python_execution` is different: its program is user-relevant evidence and remains visible on both success and failure. This is the shared TUI/channel policy; web mirrors it at the wire boundary.
(result-card {:keys [result-summary pending-summary result-render
pending-render]
tool-name :vis/tool-name})Canonical tool-result CARD descriptor — the ONE place the op-card / collapse
decision is made, so the TUI and web AGREE on tool?/label/summary/collapsible
instead of each re-deriving it from the raw form. Given an executed
form map, returns the op-card shape for a NATIVE TOOL result:
{:tool? true
:label RG — op-card badge label (tool-label)
:summary 5 hits in 1 file — the HEADLINE (:result-summary), nil
when the tool authored none
:body …markdown… — the detail body (:result-render), nil
for a summary-only tool (move/delete)
:collapsible? true} — true ⇔ there's a body to fold under
the summary (a chevron/<details>)
A call still RUNNING has no result yet, so the headline falls back to the
tool-authored :pending-summary ($ npm test (running)): the SAME
card, in its awaiting state, rather than a bare unlabeled code band.
nil for a NON-tool form (no :vis/tool-name) — its result rendering stays
channel-specific (raw value / stdout). The badge is whatever the tool's
:summary already produced; no first-line-of-body heuristic.
Canonical tool-result CARD descriptor — the ONE place the op-card / collapse
decision is made, so the TUI and web AGREE on `tool?`/label/summary/collapsible
instead of each re-deriving it from the raw form. Given an executed
form map, returns the op-card shape for a NATIVE TOOL result:
{:tool? true
:label RG — op-card badge label (`tool-label`)
:summary 5 hits in 1 file — the HEADLINE (`:result-summary`), nil
when the tool authored none
:body …markdown… — the detail body (`:result-render`), nil
for a summary-only tool (move/delete)
:collapsible? true} — true ⇔ there's a body to fold under
the summary (a chevron/`<details>`)
A call still RUNNING has no result yet, so the headline falls back to the
tool-authored `:pending-summary` (`$ npm test (running)`): the SAME
card, in its awaiting state, rather than a bare unlabeled code band.
`nil` for a NON-tool form (no `:vis/tool-name`) — its result rendering stays
channel-specific (raw value / stdout). The badge is whatever the tool's
`:summary` already produced; no first-line-of-body heuristic.(result-cards form)The op-card descriptor(s) a form renders — the ONE place a channel asks "what cards does this form show?" so the TUI and web never re-derive it differently.
A python block that print()ed several tool results carries a :cards vector of
canonical mini-forms; each becomes its OWN op-card via result-card. Any other
form yields its single result-card (or none). Always a vector — channels just
iterate. Empty when the form has no tool card at all (plain value / stdout).
The op-card descriptor(s) a form renders — the ONE place a channel asks "what cards does this form show?" so the TUI and web never re-derive it differently. A python block that print()ed several tool results carries a `:cards` vector of canonical mini-forms; each becomes its OWN op-card via `result-card`. Any other form yields its single `result-card` (or none). Always a vector — channels just iterate. Empty when the form has no tool card at all (plain value / stdout).
(with-display-code form)Attach the canonical cached ruff rendering of a form's Python source.
Channels render :display-code verbatim; local callers without it may use
the same formatter. Nested result cards are normalized recursively.
An AUTHORED :display-code is never overwritten: a native tool may render
its own PENDING call (:render-start-call-fn — shell ships the bash it is about to
run instead of the raw invocation JSON), and that surface, paired with its
:display-language, is the one the channels must paint.
Attach the canonical cached ruff rendering of a form's Python source. Channels render `:display-code` verbatim; local callers without it may use the same formatter. Nested result cards are normalized recursively. An AUTHORED `:display-code` is never overwritten: a native tool may render its own PENDING call (`:render-start-call-fn` — `shell` ships the bash it is about to run instead of the raw invocation JSON), and that surface, paired with its `:display-language`, is the one the channels must paint.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |