Skip to main content

Module cli

Module cli 

Source
Expand description

The Claude CLI subprocess behind every ambient call: spawn it as bare text generation, race it against cancellation and a timeout, and parse its stream-json reply.

Constants§

AMBIENT_MODEL
The model every ambient call runs on.

Functions§

ambient_call_cwd 🔒
Where ambient side calls run: <data dir>/ambient-calls, created on demand; None (inherit srv’s cwd, as before) only if it cannot be made. No agent works there, so no agent’s history ever matches its transcripts (#3629).
invoke_haiku
Invoke the Claude CLI on AMBIENT_MODEL for one ambient call, within timeout (the purpose’s own, purpose::Purpose::timeout).
parse_cli_stream 🔒
The last assistant text block (sanitized) and the usage from a claude -p --output-format stream-json transcript. Text is empty when the model said nothing, or only wrapped nothing in a fence.