Expand description
Op-in API in crates/protocol (issue #5261, Phase A1 of the
core/protocol extraction spec).
The TUI engine already had an internal channel (Op in
crates/tui/src/core/ops.rs with tx_op / rx_op and tx_steer).
This protocol file formalizes that channel so TUI, CLI, app-server, and
tests share one serializable API. The wire is OpEnvelope + Op;
transports that already speak JSON (app-server, tests) can send the
envelope directly, while in-process callers continue to use the typed
enum.
Parity is compile-enforced from the engine side:
crates/tui/src/core/protocol_parity.rs matches every engine Op
variant exhaustively into a protocol Op (protocol_covers_engine_ops).
What is deliberately stripped at this boundary:
mpsc/oneshotreply channels (GetSubAgentSettlement,GetSessionSnapshot,GetProviderRuntimeStatus,BootstrapMcp,RetryMcpServer,ReloadMcp). Over the wire the reply is anEventMsgor a response frame, not a channel.Arc<HookExecutor>onSendMessage: hooks are host configuration, not turn input.- Resolved provider routes and clients. Only the non-secret receipt
(
model,model_provider) crosses; the engine re-resolves. Ruleset, transcriptMessages, andSystemPromptcross asserde_json::Valuefrom their ownSerializeuntil typed in a later phase.
Steer and Cancel have no engine Op twin on purpose: the engine
carries them on tx_steer and the cancellation token. They are protocol
operations regardless, because every out-of-process client needs them.
Structs§
- Compaction
Policy - Compaction policy derived from a provider route. Twin of the engine’s
CompactionConfig. - OpEnvelope
- Every
Opis paired with the ids that route it. This is theOp-in half of theOp-in /EventMsg-out contract. - Route
Limits - Token-limit facts for a route.
Noneis unknown, never zero.
Enums§
- Op
- Operations that can be submitted to the core engine. This is the
protocol view of
crates/tui/src/core/ops::Op— same lifecycle, same provenance gate — but serializable and free ofmpsc/oneshotfields. In-process callers convert at the boundary; out-of-process callers send the JSON directly.
Constants§
- OP_
KINDS - Every wire tag
Opcan carry, in declaration order.
Functions§
- headless_
send_ message_ op - Build a headless
SendMessageenvelope with fresh ids. This is the one-line helper every headless caller (CLIexec, app-server, tests) uses so TUI and headless start a session identically.