Liking cljdoc? Tell your friends :D

hive-tmux.claude.poll

Waiting on a Claude Code pane: poll its row until a predicate holds, until it is at rest twice in a row, until its prompt is free of anyone's text.

Two ways to wait for rest, and the difference matters:

settled idle idle twice, SETTLE-MS apart. A pane between two tool calls looks idle for a moment, so one idle read proves nothing. turn boundary idle once. Under a /goal Stop hook the pane starts its next turn within one poll, so the rest between turns lasts a single read and never two in a row: waiting for two can only ever time out (friction 20261116185504-0376516a).

:between-turns? in the opts selects the second; every waiter here honours it, so a job stays consistent across all of its steps.

Stratum: Pipeline, under hive-tmux.claude.compact. Every read, clock and sleep goes through the host port, so a test drives time.

Waiting on a Claude Code pane: poll its row until a predicate holds, until it
is at rest twice in a row, until its prompt is free of anyone's text.

Two ways to wait for rest, and the difference matters:

  settled idle   idle twice, SETTLE-MS apart. A pane between two tool calls
                 looks idle for a moment, so one idle read proves nothing.
  turn boundary  idle once. Under a /goal Stop hook the pane starts its next
                 turn within one poll, so the rest between turns lasts a
                 single read and never two in a row: waiting for two can
                 only ever time out (friction 20261116185504-0376516a).

`:between-turns?` in the opts selects the second; every waiter here honours
it, so a job stays consistent across all of its steps.

Stratum: Pipeline, under `hive-tmux.claude.compact`. Every read, clock and
sleep goes through the host port, so a test drives time.
raw docstring

idle?clj

(idle? row)

Is ROW a Claude pane at rest? The screen shows no spinner and Claude Code's own session status, when known, is not busy. A row that could not be read is not idle.

Is ROW a Claude pane at rest? The screen shows no spinner and Claude Code's
own session status, when known, is not busy. A row that could not be read
is not idle.
sourceraw docstring

observeclj

(observe h ref)

The row of the pane REF names, read through host H; nil when it cannot be read.

The row of the pane REF names, read through host H; nil when it cannot be
read.
sourceraw docstring

turn-boundary?clj

(turn-boundary? row)

Is ROW a turn boundary: the pane is at rest, so whatever turn it was running has ended -- whether or not a hook starts the next one straight away. Read once, with no second reading to confirm: see the namespace docstring.

Is ROW a turn boundary: the pane is at rest, so whatever turn it was running
has ended -- whether or not a hook starts the next one straight away. Read
once, with no second reading to confirm: see the namespace docstring.
sourceraw docstring

turns?clj

(turns? opts row)

Is rest for this job proven at a single turn boundary? OPTS :between-turns? true or false forces it; :auto (the default) asks ROW: a pane whose /goal is active is restarted by a Stop hook the moment its turn ends, so its rest lasts one read. A row that cannot be read is not evidence of a hook.

Is rest for this job proven at a single turn boundary? OPTS :between-turns?
true or false forces it; :auto (the default) asks ROW: a pane whose /goal is
active is restarted by a Stop hook the moment its turn ends, so its rest
lasts one read. A row that cannot be read is not evidence of a hook.
sourceraw docstring

wait-input-clearclj

(wait-input-clear h ref opts timeout-ms)

Poll until the prompt holds no one's text and the pane is at rest, at most TIMEOUT-MS: text that was sent starts a turn, and that turn must end before anything else is typed. The row, or nil on timeout.

Poll until the prompt holds no one's text and the pane is at rest, at most
TIMEOUT-MS: text that was sent starts a turn, and that turn must end before
anything else is typed. The row, or nil on timeout.
sourceraw docstring

wait-restclj

(wait-rest h ref pred opts timeout-ms)

The row where PRED holds and the pane is confirmed at rest, in the way OPTS ask for: a single read when :between-turns? is literally true (a turn boundary), two reads SETTLE-MS apart otherwise (a settled idle). Anything else -- absent, nil, or an unresolved :auto -- means a settled idle, since that is the contract every caller had before turn boundaries existed. Nil on timeout.

The row where PRED holds and the pane is confirmed at rest, in the way OPTS
ask for: a single read when :between-turns? is literally true (a turn
boundary), two reads SETTLE-MS apart otherwise (a settled idle). Anything
else -- absent, nil, or an unresolved :auto -- means a settled idle, since
that is the contract every caller had before turn boundaries existed.
Nil on timeout.
sourceraw docstring

wait-settledclj

(wait-settled h ref pred {:keys [settle-ms] :as opts} timeout-ms)

PRED holds twice, SETTLE-MS apart: a pane between two tool calls looks idle for a moment. The second row, or nil on timeout.

PRED holds twice, SETTLE-MS apart: a pane between two tool calls looks idle
for a moment. The second row, or nil on timeout.
sourceraw docstring

wait-settled-idleclj

(wait-settled-idle h ref opts timeout-ms)

Idle twice, SETTLE-MS apart. The second row, or nil on timeout.

Idle twice, SETTLE-MS apart. The second row, or nil on timeout.
sourceraw docstring

wait-turn-boundaryclj

(wait-turn-boundary h ref opts timeout-ms)

The first row that is at rest: the boundary between two turns. One read is the whole proof, because a /goal Stop hook leaves no more than one.

The first row that is at rest: the boundary between two turns. One read is
the whole proof, because a /goal Stop hook leaves no more than one.
sourceraw docstring

wait-untilclj

(wait-until h ref pred {:keys [poll-ms]} timeout-ms)

Poll (observe) until (pred row) holds, at most TIMEOUT-MS. The row, or nil on timeout.

Poll (observe) until (pred row) holds, at most TIMEOUT-MS. The row, or nil
on timeout.
sourceraw docstring

waited-forclj

(waited-for opts)

What a wait on rest waits for, named for the timeout error: :turn-boundary when the job reads a single rest (a /goal pane between turns), :settled-idle when it needs two.

What a wait on rest waits for, named for the timeout error: :turn-boundary
when the job reads a single rest (a /goal pane between turns), :settled-idle
when it needs two.
sourceraw docstring

with-turnsclj

(with-turns opts row)

OPTS with :between-turns? resolved to a boolean against the job's FIRST row. Resolved once per job, because the evidence that picks it (an active /goal) is gone after /compact clears it, and a job must not change how it proves rest halfway through.

OPTS with :between-turns? resolved to a boolean against the job's FIRST row.
Resolved once per job, because the evidence that picks it (an active /goal)
is gone after /compact clears it, and a job must not change how it proves
rest halfway through.
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