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

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 close stdin and kill the process on exit.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type