Commit Graph
21 Commits
Author SHA1 Message Date
BFlat e288274edc Merge pull request #2609 from dotCooCoo/fix/jsonrpc-skip-long-line
craft-jsonrpc: skip_line discards the rest of an over-long line
2026-11-26 10:05:20 +07:00
BFlat 8b6e8c4608 Merge pull request #2604 from dotCooCoo/fix/jsonrpc-read-line-interrupted
craft-jsonrpc: read_line retries reads interrupted by a signal
2026-11-26 10:04:40 +07:00
BFlat e2a0739dd4 Merge pull request #2603 from dotCooCoo/feat/jsonrpc-single-handler
craft-jsonrpc: one handler can take both requests and notifications
2026-11-26 10:04:27 +07:00
dotCooCoo 1af016f7f2 craft-jsonrpc: add skip_line to resume after an over-long line
After read_line returns LineError::TooLong, skip_line discards the rest
of that line without buffering it and leaves the reader at the next
message, so a server can answer the oversized message and keep the
session open. It returns false at EOF and retries interrupted reads.
2026-11-20 10:42:50 -08:00
dotCooCoo 4c3fd4ad59 craft-jsonrpc: read_line retries reads interrupted by a signal
read_line returned LineError::Io when fill_buf failed with
ErrorKind::Interrupted, so a signal that arrived during a blocking read
of stdin ended the caller's session. It now retries the read, as
BufRead::read_until does. Other I/O errors are still returned.
2026-11-20 10:39:36 -08:00
dotCooCoo aecc9aa7d9 craft-jsonrpc: one handler can take both requests and notifications
process and process_legacy take two independent FnMut closures, so a
server whose requests and notifications update the same session must
wrap it in a RefCell, or record notifications and replay them after the
call without their params.

The new Handler trait has request and notification methods that both
take &mut self. process_with and process_legacy_with dispatch to one
Handler, with the same envelope, batch and limit behavior as process and
process_legacy, which now call them. Existing callers are unchanged.
2026-11-20 10:38:48 -08:00
dotCooCoo 696a9e9c0d craft-jsonrpc: ParseError builds its JSON-RPC error response
ParseError::rpc_error and ParseError::error_response turn a failure
from parse_json or process into a response with a null ID: -32700
"Parse error" for invalid JSON, and -32600 with the limit message for a
message or batch over its limit. RpcError also implements
From<ParseError>.
2026-11-20 10:37:22 -08:00
FredApps 3cde950739 Merge remote-tracking branch 'origin/main' into w-codex/shared-jsonrpc-io
# Conflicts:
#	crates/jsonrpc/src/lib.rs
2026-11-16 00:22:34 +01:00
FredApps 6909f21a85 Merge pull request #1650 from storytold/codex/shared-control-envelope
Share bounded legacy control envelopes
2026-11-15 23:58:51 +01:00
Dylan M. Taylor 2aca045a78 Exercise cancellation after partial line consumption 2026-11-15 19:09:15 +00:00
Dylan M. Taylor baa9bfed78 Preserve partial lines across cancellation 2026-11-15 19:08:24 +00:00
Dylan M. Taylor c5ce8a2366 Bound async JSON-RPC line buffering 2026-11-15 19:06:40 +00:00
Dylan M. Taylor 65f3e1a624 Add async JSON-RPC line adapter 2026-11-15 18:55:49 +00:00
Dylan M. Taylor 8f9a719fb1 Cover idless successful control requests 2026-11-15 17:06:03 +00:00
Dylan M. Taylor d6d4f2bd4c Cover oversized control lines 2026-11-15 17:01:38 +00:00
Dylan M. Taylor 72da2d5d05 Enforce control line limit before trimming 2026-11-15 17:01:28 +00:00
Dylan M. Taylor cbc8279a80 Share bounded legacy control envelopes 2026-11-15 17:00:55 +00:00
Dylan M. Taylor 2c9903ca1d Support configurable legacy MCP sessions and envelopes 2026-11-15 15:29:27 +00:00
Dylan M. Taylor 576fdd5e1a Support explicit JSON-RPC ID policies 2026-11-15 12:06:30 +00:00
Dylan M. Taylor 6d1c6188f3 Expose validated single JSON-RPC request inspection 2026-11-15 11:56:16 +00:00
Dylan M. Taylor e67d770c09 Add bounded JSON-RPC server envelopes 2026-11-15 11:51:16 +00:00