KetraTerm
API · DevelopmentAll versions

submitInput

Atomically validates expected and admits the complete semantic events. Checks session identity, cancellation, producer revision/snapshot and all intervening input/output/resize under mutation, producer and admission serialization. Rejection sends no prefix and does not consume capacity. Success uses the same bounds, mode/policy capture and writer as submitInput.

The caller owns editor semantics: translate valid caret/deletion spans to events before calling. This method does not infer shell editing units from UTF-16 offsets. Cancel obsolete requests through TerminalCommandEditContext.cancel. Cancellation/shutdown overlapping admission may win or lose; acceptance is not transport completion or a remote execution acknowledgement.


Admits one immutable semantic event with explicit lifecycle/capacity feedback. Keys, focus and mouse encode synchronously into the byte queue. Paste and replacement retain source text and admission-time modes/policy for the background encoder within the shared bulk budget (16 operations and 16,777,216 UTF-16/deletion units, including active work).

Mode/policy suppression and empty input still return ACCEPTED while running; that result promises admission, not emitted bytes or transport completion. Encoder argument failures propagate with staged bytes rolled back. Background encoding/transport failures close the session through state and failure. Existing TerminalInputEncoder methods use this path and discard the result. Mouse coordinates and replacement counts retain their event conventions.


Admits events as one indivisible outbound operation, copying the list before return. Keep the list stable during the call; event values are immutable. All events use one admission-time mode/policy snapshot on the background encoder. Later keys, bytes and replies cannot interleave even when this operation spans native writes. Closure/failure may still interrupt its prefix.

At most 256 events fit in one compound operation. It shares the bulk budget with paste/replacement, counting each event's retained text and deletion work with a minimum of one unit. Over-budget batches fail closed before any event is admitted. An empty batch is an accepted no-op only while running.

This overload guarantees byte ordering only. Use a captured command-edit context with the conditional overload to validate a shell revision. Observe state to cancel response-dependent work on termination.