works.iterative.claude.zio.internal.cli

Members list

Type members

Classlikes

object CLIDiscovery

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes

Builds and runs the Claude Code CLI process, exposing its stdout as a stream of parsed Message values.

Builds and runs the Claude Code CLI process, exposing its stdout as a stream of parsed Message values.

The process is spawned with zio-process. stdout lines are parsed into messages; stderr is collected concurrently for error diagnostics. When the stream completes naturally the process exit code is checked and a non-zero code is surfaced as a ProcessExecutionError. An optional timeout kills the process and surfaces a ProcessTimeoutError.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object QueryCustody

Custody for a query — a run that produces one result and then ends.

Custody for a query — a run that produces one result and then ends.

A query's CLI process exits when the run ends, so there is nothing to mirror until then and exactly one mirror to run: the archive hook's onClose. This wraps a run's message stream so that mirror fires when the stream is finished with, whether it ended in a result, an error, or an interruption.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
final case class SessionArchiveHook(afterResult: SessionId => UIO[Unit], onClose: SessionId => UIO[Unit])

Hooks the session reader invokes to mirror the vendor transcript tree.

Hooks the session reader invokes to mirror the vendor transcript tree.

Both hooks are best-effort: they never fail, so mirroring can never break the session. A mirror failure is observable only as a logged warning.

afterResult returns as soon as a mirror is scheduled, running the copy on a background fiber so a slow tree copy never back-pressures the session reader. onClose waits for any in-flight mirror and then settles the archive to the full tree.

Value parameters

afterResult

fired with the session id after each real (origin-absent) result

onClose

fired with the session id when the session ends

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type

Starts and manages a long-lived Claude Code CLI session process.

Starts and manages a long-lived Claude Code CLI session process.

The process is spawned once and kept alive for the whole session. stdin is fed from a queue (keeping the pipe open across sends). ONE internal reader fiber owns the stdout stream: it parses each line, captures the session id, routes control responses to their waiting request, folds results into the readable SessionState, and fans every message out over a Hub — so any number of events/stateChanges consumers each see the full stream.

Scope finalizers run in reverse registration order, which closes a session in this order: shut down stdin, wait for the CLI to exit on its own (up to CloseTimeout; skipped when the close is an interruption), signal the readers, kill the process tree, and keep the transcript one last time.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type