Liking cljdoc? Tell your friends :D

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

Re-frame-like state management for the TUI. Single app-db atom, pure event handlers, side effects via reg-fx.

Re-frame-like state management for the TUI.
Single app-db atom, pure event handlers, side effects via reg-fx.
raw docstring

any-background-loading?clj

(any-background-loading? db)

True when a non-active tab has a turn in flight.

True when a non-active tab has a turn in flight.
sourceraw docstring

app-dbclj

source

background-loading-tokensclj

(background-loading-tokens db)

Cancel tokens of every BACKGROUND tab (in :tab-locals, excluding the active tab held at the db root) whose turn is in flight. Ctrl+C quit consults these so a quit while other tabs are still working can warn + cancel them instead of orphaning their worker futures (orphans keep the JVM alive ~60s → looks frozen).

Cancel tokens of every BACKGROUND tab (in `:tab-locals`, excluding the active
tab held at the db root) whose turn is in flight. Ctrl+C quit consults these so
a quit while other tabs are still working can warn + cancel them instead of
orphaning their worker futures (orphans keep the JVM alive ~60s → looks frozen).
sourceraw docstring

default-settingsclj

Per-user TUI settings. Persisted to ~/.vis/config.edn under :tui-settings.

theme-name - reusable channel theme id. Default :vis-light; extension themes are declared through :ext/theme and surfaced in Settings.

show-thinking / show-iterations / show-silent - high-signal content controls. Thinking is forced OFF so provider chain-of-thought is not shown as assistant prose. Forensics still keep reasoning in the DB / reproduction surfaces; chat UI normally hides successful :vis/silent system calls unless show-silent is enabled.

reasoning-level - base model thinking depth for reasoning-capable models. Default :balanced; users can cycle it via Ctrl+K -> Settings -> Providers & Models.

openai-codex-verbosity - Codex-only output detail knob. Default :low; users can cycle it via Ctrl+K -> Settings -> Providers & Models.

show-timestamps - chrome control. Default OFF because timestamps duplicate info already on screen.

mouse-selection-copy - app-side terminal selection. Default ON so drag-selecting visible text copies it on mouse release even while the fullscreen TUI has mouse reporting enabled.

The previous :show-iteration-headers and :show-final-answer-header toggles were removed: the ITERATION N / CODE N / STDOUT / ERROR / FINAL ANSWER superscripts they controlled have been deleted from the rendering pipeline outright (the visual zones already convey the same boundaries without the labels).

Per-user TUI settings. Persisted to `~/.vis/config.edn` under
`:tui-settings`.

  theme-name - reusable channel theme id. Default `:vis-light`; extension
      themes are declared through `:ext/theme` and surfaced in Settings.

  show-thinking / show-iterations / show-silent - high-signal content
      controls. Thinking is forced OFF so provider chain-of-thought is
      not shown as assistant prose. Forensics still keep reasoning in the
      DB / reproduction surfaces; chat UI normally hides successful
      :vis/silent system calls unless show-silent is enabled.

  reasoning-level - base model thinking depth for reasoning-capable
      models. Default `:balanced`; users can cycle it via
      Ctrl+K -> Settings -> Providers & Models.

  openai-codex-verbosity - Codex-only output detail knob.
      Default `:low`; users can cycle it via Ctrl+K -> Settings -> Providers & Models.

  show-timestamps - chrome control. Default OFF because timestamps
      duplicate info already on screen.

  mouse-selection-copy - app-side terminal selection. Default ON so
      drag-selecting visible text copies it on mouse release even while
      the fullscreen TUI has mouse reporting enabled.

The previous `:show-iteration-headers` and `:show-final-answer-header`
toggles were removed: the ITERATION N / CODE N / STDOUT / ERROR /
FINAL ANSWER superscripts they controlled have been deleted from
the rendering pipeline outright (the visual zones already convey
the same boundaries without the labels).
sourceraw docstring

dispatchclj

(dispatch [id :as event-vec])

Dispatch an event vector, e.g. (dispatch [:send-message "hello"]). Wakes the render thread when the event changes the ACTIVE view. An event bumps :render-version and notifies the painter unless it is in no-render-bump-events, AND either it is in always-bump-events or it actually mutated the active-view slice (see active-view-slice). A turn streaming into a background tab only rewrites :tab-locals, so it no longer wakes the painter — the header tab spinner still animates on the render loop's own wall-clock tick.

Dispatch an event vector, e.g. (dispatch [:send-message "hello"]).
Wakes the render thread when the event changes the ACTIVE view. An event
bumps `:render-version` and notifies the painter unless it is in
`no-render-bump-events`, AND either it is in `always-bump-events` or it
actually mutated the active-view slice (see `active-view-slice`). A turn
streaming into a background tab only rewrites `:tab-locals`, so it no longer
wakes the painter — the header tab spinner still animates on the render
loop's own wall-clock tick.
sourceraw docstring

init!clj

(init!)

Initialize app-db with default state. The persisted layer now has two halves: ~/.vis/config.edn :tui-settings holds the handful of locals this channel still owns (theme + contributors-disabled). All migrated booleans / enums live in the toggles registry (:toggles slot, loaded by vis/toggles-hydrate-from-config! in screen/run-chat!). We merge a one-shot projection of the registry into :settings here so the first paint is coherent; ongoing changes flow through the listener registered there.

Initialize app-db with default state. The persisted layer now
has two halves: `~/.vis/config.edn :tui-settings` holds the
handful of locals this channel still owns (theme +
contributors-disabled). All migrated booleans / enums live in the
toggles registry (`:toggles` slot, loaded by
`vis/toggles-hydrate-from-config!` in `screen/run-chat!`). We
merge a one-shot projection of the registry into `:settings` here
so the first paint is coherent; ongoing changes flow through the
listener registered there.
sourceraw docstring

model-cycle-positionclj

(model-cycle-position provider model)

Live [position total] (1-based) of provider/model within the model cycle, or nil when the current model isn't one of the cycle entries. The footer button renders this as the n/N inside its (cycle …) hint; it reads the SAME model-cycle-entries the C-x m handler steps through, so the count the button shows is exactly the count the cycle walks.

Live `[position total]` (1-based) of `provider`/`model` within the model
cycle, or nil when the current model isn't one of the cycle entries. The
footer button renders this as the `n/N` inside its `(cycle …)` hint; it
reads the SAME `model-cycle-entries` the C-x m handler steps through, so the
count the button shows is exactly the count the cycle walks.
sourceraw docstring

reg-event-dbclj

(reg-event-db id handler-fn)

Register a pure event handler: (fn [db event-vec] new-db)

Register a pure event handler: (fn [db event-vec] new-db)
sourceraw docstring

reg-event-fxclj

(reg-event-fx id handler-fn)

Register an effect-producing event handler: (fn [db event-vec] {:db new-db :fx [[:effect-id args...]]})

Register an effect-producing event handler:
(fn [db event-vec] {:db new-db :fx [[:effect-id args...]]})
sourceraw docstring

reg-fxclj

(reg-fx id handler-fn)

Register a side-effect handler: (fn [args] ...)

Register a side-effect handler: (fn [args] ...)
sourceraw docstring

render-monitorclj

source

tab-id-for-sessionclj

(tab-id-for-session db session-id)

Resolve a session-id string to its tab id. The active tab's session lives at the db root; background tabs' sessions live in :tab-locals.

Resolve a session-id string to its tab id. The active tab's session lives
at the db root; background tabs' sessions live in `:tab-locals`.
sourceraw docstring

tab-session-snapshotclj

(tab-session-snapshot db)

Ordered open-tab session ids + the active one, for per-place persistence. Returns {:active <session-id-str|nil> :sessions [<session-id-str> …]} in left-to-right tab order. The active tab's session lives at the db root; every other tab's lives in :tab-locals.

Ordered open-tab session ids + the active one, for per-place persistence.
Returns {:active <session-id-str|nil> :sessions [<session-id-str> …]} in
left-to-right tab order. The active tab's session lives at the db root;
every other tab's lives in `:tab-locals`.
sourceraw docstring

transcript-dump-input?clj

(transcript-dump-input? text)

True when text looks like a copied Vis assistant trace/transcript, not a fresh user prompt. These strings can enter user_request after accidental bubble copy/paste, then poison ArrowUp history on resumed sessions.

True when text looks like a copied Vis assistant trace/transcript, not a
fresh user prompt. These strings can enter `user_request` after accidental
bubble copy/paste, then poison ArrowUp history on resumed sessions.
sourceraw docstring

untitled-session-labelclj

Default workspace label for a session without a title yet.

Aliases the channel-agnostic value in internal/header so the TUI, web, Telegram, etc. all show the same placeholder. Kept exported here for callers (and tests) that already reach in via the state namespace.

Default workspace label for a session without a title yet.

Aliases the channel-agnostic value in `internal/header` so the TUI,
web, Telegram, etc. all show the same placeholder. Kept exported
here for callers (and tests) that already reach in via the state
namespace.
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