Add ZIO module #49
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/claude-code-query!49
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/zio-module"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds a third runtime adapter —
zio— to the SDK, alongsidedirect(Ox) andeffectful(cats-effect/fs2), all thin wrappers over the sharedcoremodule. The ZIO module exposes the same surface adapted to ZIO idioms: a typed error channel (IO[CLIError, A]/ZStream[Any, CLIError, Message]/ZIO[Scope, CLIError, Session]),ZStream-based query streaming, and a scoped multi-turnSessionbacked by a long-lived CLI process.The build now has four modules:
core,direct,effectful,zio. Theziomodule depends only oncore— no domain logic is duplicated; it implementscore's tagless-finalConversationLogIndex[F]/ConversationLogReader[F]withzio.Task.What's included
ClaudeCode):ask,query,querySync,queryResult,session; traitSession(send/stream/sessionId); a package object re-exporting core model + the fullCLIErrorADT + log types for single-import use.ProcessManager(streams the CLI viazio-process, scoped resources, finalizer ordering, timeouts),SessionProcess(long-lived process, stdin queue, multi-turn routing, deterministic teardown),CLIDiscovery,JsonParser,FileSystemOps.ZioConversationLogIndex/ZioConversationLogReader.ANTHROPIC_API_KEY).README.md,ARCHITECTURE.md,CLAUDE.md).Library versions
Verified against Maven Central before opening this PR — all on the latest published releases:
zio/zio-streams/zio-test/zio-test-sbtzio-processReview & fixes
The branch was put through the multi-skill code review (style, testing, security, scala3, composition, architecture, zio, api, repository). Contested "critical" findings were verified empirically; three were false positives:
ZStream.takeUntilis inclusive (equivalent to fs2takeThrough) — the ResultMessage is not dropped./rejects path separators in non-literal segments (throwsInvalidSegment) — nosessionIdpath traversal.send"silent prompt loss" was wrong:offeron a shut-down unbounded ZIO queue interrupts, it does not returnfalse.Confirmed findings were then fixed under TDD:
sendto a released session now surfaces a typedSessionProcessDied(guards onstdinQueue.isShutdown) instead of an interruption — matchingeffectful's parity (onlydirect, with explicitclose(), usesSessionClosedError).validateConfigurationsurfaces a real error on an I/O fault instead of mapping every failure to "directory does not exist"; the existence/directory classification is extracted into a pure, directly-testedcwdError.os.isFile(matchingdirect), so a directory named*.jsonlno longer produces a phantom entry.CLIDiscoveryPURPOSE comment now describes behavior, not implementation.parseJsonLine, log-index decoy/meta-sidecar edge cases, and integration tests for malformed-JSON-mid-turn, session-id refresh from aResultMessage, and send-to-dead →SessionProcessDied.An adversarial verification pass over the diff surfaced one real gap (an untested
listSubAgentsguard branch), now closed with a decoy-directory regression test (confirmed red without the guard).Test status
All gates green:
__.compile584/584 (no warnings),__.fix --check279/279,__.checkFormat, unit__.test526/526,zio.itest244/244.🤖 Generated with Claude Code