Liking cljdoc? Tell your friends :D

com.blockether.vis.ext.channel-tui.chat

TUI-side projections over the canonical in-process gateway.

On startup the TUI creates a fresh :tui gateway session by default. Pass --session-id ID or --resume to pick up an existing one. Session data is persisted in ~/.vis/vis.mdb so you can come back to it.

TUI-side projections over the canonical in-process gateway.

On startup the TUI creates a fresh `:tui` gateway session by default.
Pass `--session-id ID` or `--resume` to pick up an existing one.
Session data is persisted in `~/.vis/vis.mdb` so you can come back to it.
raw docstring

assistant-messageclj

(assistant-message blocks)
(assistant-message blocks timestamp)

Create a canonical assistant message from typed content blocks.

Create a canonical assistant message from typed content blocks.
sourceraw docstring

attach!clj

(attach! session tid)
(attach! {:keys [id]} tid {:keys [on-chunk]})

Attach to an already submitted gateway turn and return canonical content.

Attach to an already submitted gateway turn and return canonical content.
sourceraw docstring

content->markdownclj

(content->markdown blocks)

Disposable Markdown projection of canonical content blocks.

Disposable Markdown projection of canonical content blocks.
sourceraw docstring

dispose!clj

(dispose! {:keys [id]})

Release the TUI's env handle. Session data stays in ~/.vis/vis.mdb so other consumers of the :tui channel (e.g. vis sessions tui, future inspectors) still see it.

Release the TUI's env handle. Session data stays in
`~/.vis/vis.mdb` so other consumers of the `:tui` channel
(e.g. `vis sessions tui`, future inspectors) still see it.
sourceraw docstring

error-contentclj

(error-content result)

Canonical blocks for a failed gateway result.

Canonical blocks for a failed gateway result.
sourceraw docstring

history-pageclj

(history-page session-id opts)

ONE window of session-id's history, projected like rebuild-history.

opts: :limit turns (nil = all), :offset 0-based start in the OLDEST-FIRST turn list (nil = the NEWEST :limit turns). The gateway also caps a window in BYTES, so :offset comes back as the window it ACTUALLY served — always page from THAT, never from your own arithmetic.

Returns {:messages [...] :offset n :total n :has-more bool}, or a zero-length page on failure (never nil, so callers need no nil-dance).

ONE window of `session-id`'s history, projected like `rebuild-history`.

`opts`: `:limit` turns (nil = all), `:offset` 0-based start in the
OLDEST-FIRST turn list (nil = the NEWEST `:limit` turns). The gateway also
caps a window in BYTES, so `:offset` comes back as the window it ACTUALLY
served — always page from THAT, never from your own arithmetic.

Returns `{:messages [...] :offset n :total n :has-more bool}`, or a
zero-length page on failure (never nil, so callers need no nil-dance).
sourceraw docstring

make-sessionclj

(make-session _provider-config)
(make-session provider-config opts)

Create a fresh :tui session at this client's invocation root. The gateway reuses a warm session when that root matches its own.

Create a fresh `:tui` session at this client's invocation root. The gateway
reuses a warm session when that root matches its own.
sourceraw docstring

make-session-asyncclj

(make-session-async provider-config)
(make-session-async provider-config opts)

Create a session off the input thread. The gateway normally answers from its compatible warm pool; a pool miss still never blocks TUI input.

Create a session off the input thread. The gateway normally answers from its
compatible warm pool; a pool miss still never blocks TUI input.
sourceraw docstring

older-historyclj

(older-history session-id offset)

The page of turns immediately ABOVE offset (the current oldest loaded window start). nil when there is nothing older left to fetch.

The page of turns immediately ABOVE `offset` (the current oldest loaded
window start). `nil` when there is nothing older left to fetch.
sourceraw docstring

older-page-turnsclj

Window size for one scroll-up page of OLDER turns.

Window size for one scroll-up page of OLDER turns.
sourceraw docstring

rebuild-historyclj

(rebuild-history session-id)

The WHOLE session's history. UNBOUNDED: the gateway hydrates every turn and every iteration before this returns, which on a long session is seconds of work and megabytes of JSON. Kept for surfaces that genuinely need all of it (cinema's exporter); interactive open goes through history-page.

The WHOLE session's history. UNBOUNDED: the gateway hydrates every turn and
every iteration before this returns, which on a long session is seconds of
work and megabytes of JSON. Kept for surfaces that genuinely need all of it
(cinema's exporter); interactive open goes through `history-page`.
sourceraw docstring

render-answerclj

(render-answer blocks)

Project canonical content blocks to Markdown for clipboard/export callers.

Project canonical content blocks to Markdown for clipboard/export callers.
sourceraw docstring

resume-sessionclj

(resume-session session-id)

Resume an existing gateway-managed session by id — ANY channel, so a conversation started in the CLI or elsewhere resumes here too. Accepts full UUID or unambiguous short UUID prefix. Returns {:id UUID :history [...]} with persisted messages. When a turn is IN FLIGHT (started here, in the web, or a sibling process) the map ALSO carries :status, :current-turn-id, the running turn's :running-request text and its canonical gateway :running-started-at (epoch ms — the ONE clock every attaching channel shares, so two TUIs show the SAME elapsed time), so the caller can ATTACH and stream it live (see state/:attach-running-turn) instead of showing frozen history. Any queued backlog rides along as :queued-turns [{:turn-id .. :client-id .. :text .. :queued-at-ms ..}] (oldest first) so the tab mirrors the gateway's server-side queue on open; :client-id is the submitter's own correlation id, so a channel recognises which rows it submitted by id instead of by request text. :running-client-id is the same correlation id for the RUNNING turn.

Resume an existing gateway-managed session by id — ANY channel, so a
conversation started in the CLI or elsewhere resumes here too.
Accepts full UUID or unambiguous short UUID prefix.
Returns `{:id UUID :history [...]}` with persisted messages. When a turn is
IN FLIGHT (started here, in the web, or a sibling process) the map ALSO
carries `:status`, `:current-turn-id`, the running turn's
`:running-request` text and its canonical gateway `:running-started-at`
(epoch ms — the ONE clock every attaching channel shares, so two TUIs
show the SAME elapsed time), so the caller can ATTACH and stream it live (see
state/:attach-running-turn) instead of showing frozen history. Any queued
backlog rides along as `:queued-turns`
`[{:turn-id .. :client-id .. :text .. :queued-at-ms ..}]` (oldest first) so the
tab mirrors the gateway's server-side queue on open; `:client-id` is the
submitter's own correlation id, so a channel recognises which rows it submitted
by id instead of by request text. `:running-client-id` is the
same correlation id for the RUNNING turn.
sourceraw docstring

resume-tail-turnsclj

How many of the NEWEST turns a session opens with. The TUI lands at the bottom, so anything above the first viewport is invisible work — it is fetched lazily when the user actually scrolls UP.

How many of the NEWEST turns a session opens with. The TUI lands at the
bottom, so anything above the first viewport is invisible work — it is
fetched lazily when the user actually scrolls UP.
sourceraw docstring

subscribe-session-events!clj

(subscribe-session-events! session-id on-chunk)

PERSISTENT live event subscription for one open session tab.

The blocking submit/attach SSE loops exist only WHILE a turn runs in this process, so an idle tab is deaf: a sibling TUI/web queueing, editing or deleting a message — or starting a whole turn — never reached it (the queue-desync + frozen-idle-tab bugs). This subscribes to the session's live event stream (from the CURRENT cursor — no replay churn) for the tab's whole lifetime and forwards every projectable event as a chunk to on-chunk (:queue-sync, :turn-start, …). The caller filters phases and dispatches; the TUI handlers are idempotent, so overlap with an active attach subscription is harmless. Returns a zero-arg cleanup fn.

PERSISTENT live event subscription for one open session tab.

The blocking submit/attach SSE loops exist only WHILE a turn runs in this
process, so an idle tab is deaf: a sibling TUI/web queueing, editing or
deleting a message — or starting a whole turn — never reached it (the
queue-desync + frozen-idle-tab bugs). This subscribes to the session's
live event stream (from the CURRENT cursor — no replay churn) for the
tab's whole lifetime and forwards every projectable event as a chunk to
`on-chunk` (`:queue-sync`, `:turn-start`, …). The caller filters phases
and dispatches; the TUI handlers are idempotent, so overlap with an
active attach subscription is harmless. Returns a zero-arg cleanup fn.
sourceraw docstring

turn!clj

(turn! session text)
(turn! {:keys [id]}
       text
       {:keys [on-chunk cancel-token reasoning-default extra-body turn-features
               workspace idempotency-key display-text]})

Submit a user request through the canonical in-process gateway. Blocking.

Submit a user request through the canonical in-process gateway. Blocking.
sourceraw docstring

user-messageclj

(user-message text)
(user-message text timestamp)

Create a canonical user message.

Create a canonical user message.
sourceraw docstring

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