Liking cljdoc? Tell your friends :D

com.blockether.vis.internal.loop.turn

One turn from user input to its persisted outcome.

Prepares the turn context and routing, dispatches slash, bang and normal turns, and finalizes the turn result. turn! is the entry point.

One turn from user input to its persisted outcome.

Prepares the turn context and routing, dispatches slash, bang and normal
turns, and finalizes the turn result. `turn!` is the entry point.
raw docstring

custom-bindingsclj

(custom-bindings env)

Current custom sandbox bindings {sym -> value}.

Current custom sandbox bindings {sym -> value}.
sourceraw docstring

run-turn!clj

(run-turn! env user-request loop-opts)

Store turn -> iteration-loop -> update turn -> return result.

Derives :prior-outcome (one of :complete, :cancelled, :error) from the loop result and persists it on the session_turn_state row. The next turn's <system_state> digest reads it.

BEFORE the LLM round-trip, every turn is passed through slash/dispatch. When the user-message resolves to a registered slash, the turn is fully handled by a synthetic iteration (tag :user-slash) and the LLM is never called. The transcript still shows the user message + the slash envelope.

A slash NO extension claims (:reason :unknown) gets one more chance as a PROMPT TEMPLATE (.vis/prompts/*.md, ~/.vis/prompts, provider-contributed templates like /<name>): when a template matches, the expanded text runs as a NORMAL LLM turn. Registered slashes always win over templates.

Store turn -> iteration-loop -> update turn -> return result.

Derives `:prior-outcome` (one of `:complete`, `:cancelled`, `:error`)
from the loop result and
persists it on the `session_turn_state` row. The next turn's
`<system_state>` digest reads it.

BEFORE the LLM round-trip, every turn is passed through
`slash/dispatch`. When the user-message resolves
to a registered slash, the turn is fully handled by a synthetic
iteration (`tag :user-slash`) and the LLM is never called. The
transcript still shows the user message + the slash envelope.

A slash NO extension claims (`:reason :unknown`) gets one more
chance as a PROMPT TEMPLATE (`.vis/prompts/*.md`, `~/.vis/prompts`,
provider-contributed templates like `/<name>`): when a
template matches, the expanded text runs as a NORMAL LLM turn.
Registered slashes always win over templates.
sourceraw docstring

turn!clj

(turn! environment messages)
(turn! environment messages opts)

Runs one session turn on an RLM environment using iterative LLM code evaluation.

Params: environment - RLM environment from create-environment. messages - Vector of message maps. Always a vector, e.g.: [(svar/user <prompt-text>)] [(svar/user <prompt-text> (svar/image <b64> <mime-type>))] opts - Map, optional:

  • :spec - Output spec for structured answers.
  • :model - Override config's default model.
  • :max-context-tokens - Token budget for context.
  • :debug? - Enable verbose debug logging (default: false). Logs iteration details, code evaluation, LLM responses at :debug level with :rlm-phase context.
  • :reasoning-default - Optional base reasoning effort for reasoning-capable models. Accepts :low/:medium/:high or low/medium/high strings. Adaptive escalation still applies.
  • :reasoning-effort - Exact provider-native effort string, high or max. Catalog-gated and threaded unchanged through every iteration.
  • :extra-body - Optional provider-specific request-body params merged into the upstream LLM call after auto max_tokens + reasoning translation.
  • :request-kind - Request origin, :user (default) or :council.
  • :council-entry-id - Required immutable Council entry id for :council requests.

Returns: Map with:

  • :trace - Vector of iteration trace entries, each containing: {:iteration N :response <llm-response-text> :blocks [{:id 0 :code <code-str> :stdout <printed-text> :error nil :envelope {:started-at-ms 10 :finished-at-ms 15 ...}} ...]}
  • :iteration-count - Number of iterations used.
  • :duration-ms - Turn duration in milliseconds.
  • :tokens - Token usage map {"input" N "output" N "total" N} (canonical string keys).
  • :cost - Cost map {"input_cost" N "output_cost" N "total_cost" N} (canonical string keys).
  • :confidence - Confidence level (:high/:medium/:low) from final iteration.
  • :reasoning - String summary of how the answer was derived (from LLM's FINAL call).
  • :status - Only present on failure (:error or :cancelled).
Runs one session turn on an RLM environment using iterative LLM code evaluation.

 Params:
 `environment` - RLM environment from create-environment.
 `messages` - Vector of message maps. Always a vector, e.g.:
              [(svar/user <prompt-text>)]
              [(svar/user <prompt-text> (svar/image <b64> <mime-type>))]
`opts` - Map, optional:
  - :spec - Output spec for structured answers.
  - :model - Override config's default model.
   - :max-context-tokens - Token budget for context.
   - :debug? - Enable verbose debug logging (default: false). Logs iteration details,
     code evaluation, LLM responses at :debug level with :rlm-phase context.
   - :reasoning-default - Optional base reasoning effort for reasoning-capable models.
     Accepts :low/:medium/:high or low/medium/high strings. Adaptive escalation still applies.
   - :reasoning-effort - Exact provider-native effort string, `high` or `max`.
     Catalog-gated and threaded unchanged through every iteration.
   - :extra-body - Optional provider-specific request-body params merged into the
     upstream LLM call after auto max_tokens + reasoning translation.
   - :request-kind - Request origin, :user (default) or :council.
   - :council-entry-id - Required immutable Council entry id for :council requests.

 Returns:
Map with:
   - :trace - Vector of iteration trace entries, each containing:
       {:iteration N
        :response <llm-response-text>
        :blocks [{:id 0 :code <code-str> :stdout <printed-text> :error nil
                  :envelope {:started-at-ms 10 :finished-at-ms 15 ...}}
                    ...]}
  - :iteration-count - Number of iterations used.
  - :duration-ms - Turn duration in milliseconds.
  - :tokens - Token usage map {"input" N "output" N "total" N} (canonical string keys).
  - :cost - Cost map {"input_cost" N "output_cost" N "total_cost" N} (canonical string keys).
  - :confidence - Confidence level (:high/:medium/:low) from final iteration.
   - :reasoning - String summary of how the answer was derived (from LLM's FINAL call).
   - :status - Only present on failure (`:error` or `:cancelled`).
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