Liking cljdoc? Tell your friends :D

com.blockether.vis.internal.util

The engine's one shared leaf: the primitives every namespace kept re-rolling — a millisecond clock, the two blank-string idioms, a trimmed environment read, UTF-8 bytes, SHA-256 and the hex fold.

It requires NOTHING from the rest of vis and never will. That is the whole contract: a leaf can be required from anywhere — specs that load during namespace initialization, the gateway, the sandbox — without a cycle to reason about. Everything here is a pure function of its arguments (or of one process-wide reading), so nothing here may become a top-level value: a def that CALLS one of these freezes the BUILDER's answer into the native image (native-image-env-capture-test is the gate).

A name earns a place here when a THIRD namespace needs it. A helper with one caller belongs beside its caller, not in this file.

The engine's one shared leaf: the primitives every namespace kept re-rolling —
a millisecond clock, the two blank-string idioms, a trimmed environment read,
UTF-8 bytes, SHA-256 and the hex fold.

It requires NOTHING from the rest of vis and never will. That is the whole
contract: a leaf can be required from anywhere — specs that load during
namespace initialization, the gateway, the sandbox — without a cycle to
reason about. Everything here is a pure function of its arguments (or of one
process-wide reading), so nothing here may become a top-level value: a `def`
that CALLS one of these freezes the BUILDER's answer into the native image
(`native-image-env-capture-test` is the gate).

A name earns a place here when a THIRD namespace needs it. A helper with one
caller belongs beside its caller, not in this file.
raw docstring

bytes->hexclj

(bytes->hex b)

Lowercase hex of b, two characters per byte and no separators.

Lowercase hex of `b`, two characters per byte and no separators.
sourceraw docstring

env-valclj

(env-val k)

Environment variable k, trimmed, or nil when it is unset or blank.

Environment variable `k`, trimmed, or nil when it is unset or blank.
sourceraw docstring

fence-delimiterclj

(fence-delimiter body)

Markdown fence delimiter (a backtick run) longer than any backtick run in body. Arbitrary content — a file being read, a diff of a Markdown file, a tool's stdout — carries Markdown fences of its own; a fixed triple-backtick wrapper is then ambiguous and the INNER fence closes the outer block early, so everything after it renders as prose instead of code. CommonMark permits longer fences: pick the shortest safe one.

Markdown fence delimiter (a backtick run) longer than any backtick run in
`body`. Arbitrary content — a file being read, a diff of a Markdown file, a
tool's stdout — carries Markdown fences of its own; a fixed triple-backtick
wrapper is then ambiguous and the INNER fence closes the outer block early,
so everything after it renders as prose instead of code. CommonMark permits
longer fences: pick the shortest safe one.
sourceraw docstring

fencedclj

(fenced body)
(fenced body lang)

Wrap body in a fenced code block body itself cannot close early, with an optional lang info string. Callers keep their own blank/nil guards.

Wrap `body` in a fenced code block `body` itself cannot close early, with an
optional `lang` info string. Callers keep their own blank/nil guards.
sourceraw docstring

native-image?clj

(native-image?)

True when this is the compiled binary rather than a JVM run.

The two runtimes differ in what they may ASSUME - a spawn argv, a memory floor, a timeout - so the question is asked in several unrelated places and answered here once. imagecode is set at build time as well, so a caller that must tell BUILD from RUNTIME reads the property itself.

True when this is the compiled binary rather than a JVM run.

The two runtimes differ in what they may ASSUME - a spawn argv, a memory
floor, a timeout - so the question is asked in several unrelated places and
answered here once. `imagecode` is set at build time as well, so a caller
that must tell BUILD from RUNTIME reads the property itself.
sourceraw docstring

non-blankclj

(non-blank x)

x trimmed to a string, or nil when it is nil, empty or all whitespace.

`x` trimmed to a string, or nil when it is nil, empty or all whitespace.
sourceraw docstring

non-blank-string?clj

(non-blank-string? x)

True when x is a string carrying something other than whitespace.

True when `x` is a string carrying something other than whitespace.
sourceraw docstring

normalize-thinking-textclj

(normalize-thinking-text text)

Canonical thinking text for every surface — gateway SSE, poll/replay, session transcript and the TUI timeline all normalize HERE so no consumer is the first place a difference appears.

Reasoning streams arrive with paragraph-style blank-line runs and whitespace-padded blank rows; collapse those, then drop the provider's elision marker. nil when nothing is left, so a blank tick falls back to the text already on screen instead of wiping it.

Canonical thinking text for every surface — gateway SSE, poll/replay, session
transcript and the TUI timeline all normalize HERE so no consumer is the
first place a difference appears.

Reasoning streams arrive with paragraph-style blank-line runs and
whitespace-padded blank rows; collapse those, then drop the provider's
elision marker. nil when nothing is left, so a blank tick falls back to the
text already on screen instead of wiping it.
sourceraw docstring

now-msclj

(now-ms)

Milliseconds since the epoch — the engine's one wall clock.

Milliseconds since the epoch — the engine's one wall clock.
sourceraw docstring

redact-secret-textclj

(redact-secret-text text)
(redact-secret-text text known-secrets)

Redact labelled credentials, credential headers/URLs, private PEM keys and embedded vault handles in PRESENTATION text. This is not a detector for arbitrary unlabelled or encoded secrets. Raw tool values must not pass here.

Optional known-secrets are literal values local to one form validation, not a registry. Replace them in one pass, longest first, preserving redaction markers so repeated presentation/sink passes are idempotent.

Redact labelled credentials, credential headers/URLs, private PEM keys and
embedded vault handles in PRESENTATION text. This is not a detector for
arbitrary unlabelled or encoded secrets. Raw tool values must not pass here.

Optional `known-secrets` are literal values local to one form validation, not
a registry. Replace them in one pass, longest first, preserving redaction
markers so repeated presentation/sink passes are idempotent.
sourceraw docstring

secret-key?clj

(secret-key? key)

Whether a named data key denotes credentials. Non-name keys are not secrets.

Whether a named data key denotes credentials. Non-name keys are not secrets.
sourceraw docstring

sentence-boundary-patternclj

One CLOSED sentence or clause end in model text — ., !, ? or with any trailing quotes/brackets, at whitespace or end of string, or a newline.

Owned here because the gateway uses it to flush the live stream one sentence at a time (gateway.state/sentence-closed-in-suffix?). Settled reasoning also treats a syntactically closed Markdown heading as a complete thought.

One CLOSED sentence or clause end in model text — `.`, `!`, `?` or `…` with
any trailing quotes/brackets, at whitespace or end of string, or a newline.

Owned here because the gateway uses it to flush the live stream one sentence
at a time (`gateway.state/sentence-closed-in-suffix?`). Settled reasoning also
treats a syntactically closed Markdown heading as a complete thought.
sourceraw docstring

settled-thinking-textclj

(settled-thinking-text text)

Canonical thinking text for a SETTLED iteration — what a transcript, a timeline entry or a replayed row keeps — or nil when the provider showed nothing usable.

normalize-thinking-text, CLIPPED to the last complete thought: a closed sentence/line or a syntactically closed Markdown heading; nil when it closed none. Anthropic writes the thinking summary with a SECOND model that streams alongside the thinking block; when the block closes first the summary stops wherever it stood — mid-word — and the wire terminates it with the marker. So prose AFTER the last complete boundary is exactly what the summarizer was writing when it was cut. A closed heading, however, is a complete structural unit and remains useful without terminal punctuation.

LIVE ticks keep normalize-thinking-text: mid-stream every summary is still a fragment, and the stream must paint as it arrives. This decision belongs at the shared progress boundary; presentation clients render its settled value exactly rather than maintaining their own filtering vocabulary.

Canonical thinking text for a SETTLED iteration — what a transcript, a
timeline entry or a replayed row keeps — or nil when the provider showed
nothing usable.

`normalize-thinking-text`, CLIPPED to the last complete thought: a closed
sentence/line or a syntactically closed Markdown heading; nil when it closed
none. Anthropic writes the thinking summary with a SECOND model that streams
alongside the thinking block; when the block closes first the summary stops
wherever it stood — mid-word — and the wire terminates it with the `…` marker.
So prose AFTER the last complete boundary is exactly what the summarizer was
writing when it was cut. A closed heading, however, is a complete structural
unit and remains useful without terminal punctuation.

LIVE ticks keep `normalize-thinking-text`: mid-stream every summary is still
a fragment, and the stream must paint as it arrives. This decision belongs at
the shared progress boundary; presentation clients render its settled value
exactly rather than maintaining their own filtering vocabulary.
sourceraw docstring

sha256clj

(sha256 b)

SHA-256 digest bytes of b.

SHA-256 digest bytes of `b`.
sourceraw docstring

sha256-digestclj

(sha256-digest)

A fresh SHA-256 MessageDigest — for the streaming case, where the content arrives in chunks and sha256 would need it all in memory at once.

A fresh SHA-256 `MessageDigest` — for the streaming case, where the content
arrives in chunks and `sha256` would need it all in memory at once.
sourceraw docstring

sha256-hexclj

(sha256-hex x)

Lowercase-hex SHA-256 of bytes, or of a string's UTF-8 bytes — the ONE content-identity fold in the engine: cache keys, replay dedup, source markers and pairing all read the same digits for the same input.

Lowercase-hex SHA-256 of bytes, or of a string's UTF-8 bytes — the ONE
content-identity fold in the engine: cache keys, replay dedup, source
markers and pairing all read the same digits for the same input.
sourceraw docstring

strip-elision-markerclj

(strip-elision-marker text)

Reasoning text without its trailing provider elision marker.

Suffix-only, therefore MONOTONE: a live stream may strip on every tick and the cumulative-minus-emitted-length delta math still never loses a character.

Reasoning `text` without its trailing provider elision marker.

Suffix-only, therefore MONOTONE: a live stream may strip on every tick and
the cumulative-minus-emitted-length delta math still never loses a
character.
sourceraw docstring

truncateclj

(truncate s n)

Head-clip s to at most n chars (no ellipsis) — the engine's ONE head-clip, so it is also the one place that must never hand a lone surrogate to a UTF-8 consumer downstream (JSON escape, SQLite, the mobile client): a cut that would land inside an astral char takes one char less instead of splitting the pair.

Head-clip `s` to at most `n` chars (no ellipsis) — the engine's ONE head-clip,
so it is also the one place that must never hand a lone surrogate to a UTF-8
consumer downstream (JSON escape, SQLite, the mobile client): a cut that would
land inside an astral char takes one char less instead of splitting the pair.
sourceraw docstring

utf8clj

(utf8 s)

s as UTF-8 bytes — the one charset every vis wire format names.

`s` as UTF-8 bytes — the one charset every vis wire format names.
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