OCaml Claude SDK using Eio and Jsont

fix(claudeio): stop Client.run after Complete to prevent deadlock

Client.run was using Seq.iter which waits for EOF, but the Claude CLI
only sends EOF when it exits, and it waits for stdin to close first.
This caused a deadlock where both sides waited for the other.

Now run explicitly stops after receiving Complete, matching the behavior
of receive_all.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

+12 -1
+12 -1
lib/client.ml
··· 411 411 let receive t = fun () -> handle_messages t 412 412 413 413 let run t ~handler = 414 - Seq.iter (Handler.dispatch handler) (receive t) 414 + (* Stop after Complete response - don't wait for EOF since Claude CLI 415 + waits for stdin to close before exiting, causing a deadlock *) 416 + let rec loop seq = 417 + match seq () with 418 + | Seq.Nil -> () 419 + | Seq.Cons (Response.Complete _ as resp, _) -> 420 + Handler.dispatch handler resp 421 + | Seq.Cons (resp, rest) -> 422 + Handler.dispatch handler resp; 423 + loop rest 424 + in 425 + loop (receive t) 415 426 416 427 let receive_all t = 417 428 let rec collect acc seq =