works.iterative.claude.zio

Members list

Type members

Classlikes

object ClaudeCode

Entry point for querying the Claude Code CLI with ZIO.

Entry point for querying the Claude Code CLI with ZIO.

query streams messages as the CLI produces them; querySync and queryResult are convenience collectors. session opens a scoped multi-turn conversation. All operations fail with a typed CLIError.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
ClaudeCode.type
trait Session

An active Claude Code session backed by a long-lived CLI process.

An active Claude Code session backed by a long-lived CLI process.

A session is a stream of messages plus a way to inject user input. Turns are not modelled: the CLI owns turn boundaries, and a message read from events is not "the reply to your last send" (a background task finishing emits its own result with no send in flight, and a send issued mid-turn is merged into the running turn). See docs/adr/0001-session-is-a-stream-not-turns.md.

Completion is observed as state, not as a delivered event: send is fire-and-forget and the reliable "the turn finished" signal is the monotone resultsSeen counter behind state. Because the counter never decreases and is readable at any time, waiting on resultsSeen > n has no window to lose a race in — sendAndAwait closes the completion race outright rather than narrowing it.

The session is acquired within a Scope, whose finalizers shut down the process on both normal exit and error. Closing the scope closes the CLI's input and waits for the CLI to exit — it finishes its turn and writes the rest of its transcript first — killing it only if it has not exited within works.iterative.claude.zio.internal.cli.SessionProcess.CloseTimeout. Unless custody is off, closing then keeps the transcript one last time, bounded by its own close timeout (see ClaudeCode.session). The two bounds are paid one after the other, so releasing the scope of a session whose CLI never exits and whose keep never finishes takes both of them; a caller that needs release to be prompt can fork it.

Attributes

Supertypes
class Object
trait Matchable
class Any
trait Sessions

The sessions a host has started and still holds.

The sessions a host has started and still holds.

A session is a running process, and a process outlives the request that started it: whoever asked for it has to be able to come back to it — after a reload, from a second tab — and reach the same agent rather than a new one. That is the whole of what this is for. Nothing about the conversation is kept here; the transcript is the CLI's own file, and this holds only what a file cannot be: the live process, by name.

Every session held is let go of when the holder's scope closes, so a host that stops leaves no agent running behind it.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Sessions

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Sessions.type

Types

type ArchiveConfig = ArchiveConfig
type AssistantLogEntry = AssistantLogEntry
type AssistantMessage = AssistantMessage
type CLIError = CLIError
type CLINotFoundError = CLINotFoundError
type Channel = Channel
type ConfigurationError = ConfigurationError
type ContentBlock = ContentBlock
type ContextItem = ContextItem
type ControlRequest = ControlRequest
type ControlRequestBody = ControlRequestBody
type ControlResponse = ControlResponse
type ConversationLogEntry = ConversationLogEntry
type ConversationLogIndex[F[_]] = ConversationLogIndex[F]
type ConversationLogReader[F[_]] = ConversationLogReader[F]
type Custody = Custody
type EnvironmentValidationError = EnvironmentValidationError
type FileHistorySnapshotLogEntry = FileHistorySnapshotLogEntry
type Installation = Installation
type InterruptOutcome = InterruptOutcome
type JsonParsingError = JsonParsingError
type LastPromptLogEntry = LastPromptLogEntry
type LogEntryPayload = LogEntryPayload
type LogFileMetadata = LogFileMetadata
type Message = Message
type MessageId = MessageId
type NodeJSNotFoundError = NodeJSNotFoundError
type PermissionDenial = PermissionDenial
type PermissionMode = PermissionMode
type ProcessExecutionError = ProcessExecutionError
type ProcessTimeoutError = ProcessTimeoutError
type ProgressLogEntry = ProgressLogEntry
type ProjectPathDecoder = ProjectPathDecoder.type
type QueryOptions = QueryOptions
type QueueOperationLogEntry = QueueOperationLogEntry
type RawLogEntry = RawLogEntry
type RedactedThinkingBlock = RedactedThinkingBlock
type RequestId = RequestId
type ResultMessage = ResultMessage
type ResultOrigin = ResultOrigin
type ResultTimings = ResultTimings
type SessionClosedError = SessionClosedError
type SessionEnd = SessionEnd
type SessionEndedBeforeRequest = SessionEndedBeforeRequest
type SessionId = SessionId
type SessionInfo = SessionInfo
type SessionOptions = SessionOptions
type SessionProcessDied = SessionProcessDied
type SessionState = SessionState
type SubAgentMetadata = SubAgentMetadata
type SystemLogEntry = SystemLogEntry
type SystemMessage = SystemMessage
type TextBlock = TextBlock
type ThinkingBlock = ThinkingBlock
type TokenUsage = TokenUsage
type ToolResultBlock = ToolResultBlock
type ToolUseBlock = ToolUseBlock
type TurnTrouble = TurnTrouble
type TurnTroubleLogEntry = TurnTroubleLogEntry
type UnknownMessage = UnknownMessage
type UserInput = UserInput
type UserLogEntry = UserLogEntry
type UserMessage = UserMessage

Value members

Concrete fields

val ArchiveConfig: ArchiveConfig.type
val AssistantLogEntry: AssistantLogEntry.type
val AssistantMessage: AssistantMessage.type
val CLINotFoundError: CLINotFoundError.type
val Channel: Channel.type
val ConfigurationError: ConfigurationError.type
val ContextItem: ContextItem.type
val ControlRequest: ControlRequest.type
val ControlRequestBody: ControlRequestBody.type
val ControlResponse: ControlResponse.type
val ConversationLogEntry: ConversationLogEntry.type
val Custody: Custody.type
val EnvironmentValidationError: EnvironmentValidationError.type
val FileHistorySnapshotLogEntry: FileHistorySnapshotLogEntry.type
val Installation: Installation.type
val InterruptOutcome: InterruptOutcome.type
val JsonParsingError: JsonParsingError.type
val LastPromptLogEntry: LastPromptLogEntry.type
val LogFileMetadata: LogFileMetadata.type
val MessageId: MessageId.type
val NodeJSNotFoundError: NodeJSNotFoundError.type
val PermissionDenial: PermissionDenial.type
val PermissionMode: PermissionMode.type
val ProcessExecutionError: ProcessExecutionError.type
val ProcessTimeoutError: ProcessTimeoutError.type
val ProgressLogEntry: ProgressLogEntry.type
val ProjectPathDecoder: ProjectPathDecoder.type
val QueryOptions: QueryOptions.type
val QueueOperationLogEntry: QueueOperationLogEntry.type
val RawLogEntry: RawLogEntry.type
val RedactedThinkingBlock: RedactedThinkingBlock.type
val RequestId: RequestId.type
val ResultMessage: ResultMessage.type
val ResultOrigin: ResultOrigin.type
val ResultTimings: ResultTimings.type
val SessionClosedError: SessionClosedError.type
val SessionEnd: SessionEnd.type
val SessionEndedBeforeRequest: SessionEndedBeforeRequest.type
val SessionId: SessionId.type
val SessionInfo: SessionInfo.type
val SessionOptions: SessionOptions.type
val SessionProcessDied: SessionProcessDied.type
val SessionState: SessionState.type
val SubAgentMetadata: SubAgentMetadata.type
val SystemLogEntry: SystemLogEntry.type
val SystemMessage: SystemMessage.type
val TextBlock: TextBlock.type
val ThinkingBlock: ThinkingBlock.type
val TokenUsage: TokenUsage.type
val ToolResultBlock: ToolResultBlock.type
val ToolUseBlock: ToolUseBlock.type
val TurnTrouble: TurnTrouble.type
val TurnTroubleLogEntry: TurnTroubleLogEntry.type
val UnknownMessage: UnknownMessage.type
val UserInput: UserInput.type
val UserLogEntry: UserLogEntry.type
val UserMessage: UserMessage.type