Liking cljdoc? Tell your friends :D

com.blockether.vis.internal.titling

Session-title subsystem, lifted out of the loop namespace: the three listener registries (per-session value, global, and the pending/spinner channel), the single set-title-with-broadcast! mutation point, and the async auto-title side-channel (an off-surface ask! that names a session on its first real turn). A LEAF — depends only on persistance + svar + runtime-settings, never back on the loop.

Session-title subsystem, lifted out of the loop namespace: the three listener
registries (per-session value, global, and the pending/spinner channel), the
single `set-title-with-broadcast!` mutation point, and the async auto-title
side-channel (an off-surface `ask!` that names a session on its first
real turn). A LEAF — depends only on persistance + svar + runtime-settings,
never back on the loop.
raw docstring

add-global-title-listener!clj

(add-global-title-listener! listener-fn)

Register listener-fn to observe title changes across ALL sessions. The fn is invoked with the session id (a UUID) and the new title every time ANY session's title changes - host rename and auto-title generation alike, since they all funnel through set-title-with-broadcast!.

Returns the listener fn so callers can pass it to remove-global-title-listener! later.

Register `listener-fn` to observe title changes across ALL sessions.
The fn is invoked with the session id (a UUID) and the new title
every time ANY session's title changes - host rename and auto-title
generation alike, since they all funnel through `set-title-with-broadcast!`.

Returns the listener fn so callers can pass it to
`remove-global-title-listener!` later.
sourceraw docstring

add-title-listener!clj

(add-title-listener! session-id listener-fn)

Register listener-fn for session-id. The fn is invoked with the new title (a string) every time the title changes. Multiple listeners are supported; they fire in unspecified order.

Returns the listener fn so callers can pass it to remove-title-listener! later.

Register `listener-fn` for `session-id`. The fn is invoked with
the new title (a string) every time the title changes. Multiple
listeners are supported; they fire in unspecified order.

Returns the listener fn so callers can pass it to
`remove-title-listener!` later.
sourceraw docstring

add-title-pending-listener!clj

(add-title-pending-listener! session-id listener-fn)

Register listener-fn for session-id; invoked with a boolean (true when title generation starts, false when it ends). Returns the listener fn for later remove-title-pending-listener!.

Register `listener-fn` for `session-id`; invoked with a boolean
(true when title generation starts, false when it ends). Returns the
listener fn for later `remove-title-pending-listener!`.
sourceraw docstring

after-turn-auto-title!clj

(after-turn-auto-title! env user-request)

The LLM title upgrade, run once the foreground turn has finished. Auto-title quality is cosmetic while foreground responsiveness is core, so the title call ALWAYS goes after the user's request instead of racing it for the same gateway slot (Blockether/vis#71), and it never waits out a rate limit (title-router): a refused title simply leaves the local title in place and a later turn retries the upgrade. It OVERWRITES the provisional local title and freezes it, so a real LLM title is generated once and never regenerated. Skipped entirely when titling.mode is not llm or the session already has a frozen title. Returns a future or nil; callers intentionally do not wait.

The LLM title upgrade, run once the foreground turn has finished. Auto-title
quality is cosmetic while foreground responsiveness is core, so the title
call ALWAYS goes after the user's request instead of racing it for the same
gateway slot (Blockether/vis#71), and it never waits out a rate limit
(`title-router`): a refused title simply leaves the local title in place and
a later turn retries the upgrade. It OVERWRITES the provisional local title
and freezes it, so a real LLM title is generated once and never regenerated.
Skipped entirely when `titling.mode` is not `llm` or the session already has
a frozen title. Returns a future or nil; callers intentionally do not wait.
sourceraw docstring

maybe-auto-title!clj

(maybe-auto-title! env user-request)

Title the session at the START of a normal LLM turn — LOCALLY, always.

local-auto-title (the request's first sentence) is written up front and marked PROVISIONAL: it cannot hang, spends no quota and contacts no provider, so the user's own request is the FIRST thing that reaches the gateway. The optional LLM upgrade is handed to after-turn-auto-title! once that request is done (Blockether/vis#71).

Returns nil — there is nothing to wait for. Titles are host-owned; there is no model-facing override.

Title the session at the START of a normal LLM turn — LOCALLY, always.

`local-auto-title` (the request's first sentence) is written up front and
marked PROVISIONAL: it cannot hang, spends no quota and contacts no
provider, so the user's own request is the FIRST thing that reaches the
gateway. The optional LLM upgrade is handed to `after-turn-auto-title!` once
that request is done (Blockether/vis#71).

Returns nil — there is nothing to wait for. Titles are host-owned; there is
no model-facing override.
sourceraw docstring

remove-global-title-listener!clj

(remove-global-title-listener! listener-fn)

Deregister a previously added global title listener. Idempotent.

Deregister a previously added global title listener. Idempotent.
sourceraw docstring

remove-title-listener!clj

(remove-title-listener! session-id listener-fn)

Deregister a previously added listener. Idempotent.

Deregister a previously added listener. Idempotent.
sourceraw docstring

remove-title-pending-listener!clj

(remove-title-pending-listener! session-id listener-fn)

Deregister a previously added pending listener. Idempotent.

Deregister a previously added pending listener. Idempotent.
sourceraw docstring

set-title-with-broadcast!clj

(set-title-with-broadcast! db-info session-id session-title-atom title)

Single mutation point for session titles.

  1. Writes the title to the persisted session_state row.
  2. Updates the env's in-memory :session-title-atom so the next iteration's :session-title-atom mirror sees the new value AND so a read from the Python sandbox returns the fresh string immediately, without a DB round-trip.
  3. Broadcasts to every registered listener.

session-title-atom may be nil (host-driven path with no live env).

Single mutation point for session titles.

1. Writes the title to the persisted `session_state` row.
2. Updates the env's in-memory `:session-title-atom` so the next iteration's
   `:session-title-atom` mirror sees the new value AND so a
   read from the Python sandbox returns the fresh string immediately,
   without a DB round-trip.
3. Broadcasts to every registered listener.

`session-title-atom` may be nil (host-driven path with no live env).
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