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

make-sessionclj

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

Create a fresh :tui session through the gateway-owned warm pool.

Create a fresh `:tui` session through the gateway-owned warm pool.
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 warm pool; a pool miss still never blocks TUI input.

Create a session off the input thread. The gateway normally answers from its
warm pool; a pool miss still never blocks TUI input.
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

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