Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions doc/2026-11-02T_reference_kitty_disambiguate_v1.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
# kitty-disambiguate-v1 profile reference

- Status: **implemented (Slice A)** in `pkgs/id/examples/roc-world/Key.roc`
(`Key.parse_events`, `Key.to_legacy`); no activation.
- Status: **implemented, slices A–F**. The decoder is
`pkgs/id/examples/roc-world/Key.roc` (`Key.parse_events`, `Key.to_legacy`);
the bounded stream assembler is `pkgs/id/crates/id-worlds/src/input_framing.rs`;
the browser encoder is `richTerminalBytesForKey` in
`pkgs/id/web/src/world-keyboard.ts`, selected per connection by
`?keyboard=kitty` in `world.ts`; SSH negotiation (push/verify/pop plus
assembler framing on the raw path) is `world_ssh::kitty`, behind the
server opt-in `SshServeOptions::kitty_keyboard` (serve command:
`ID_WORLD_SSH_KITTY_KEYBOARD=1`). Defaults are legacy everywhere.
- Upstream specification:
[Comprehensive keyboard handling in terminals](https://sw.kovidgoyal.net/kitty/keyboard-protocol/),
verified by direct fetch on **2026-11-02** (sections Quickstart, Key codes,
Modifiers, Event types, Progressive enhancement, Disambiguate escape codes,
Legacy key event encoding, Functional key definitions).
- Design record: `doc/2026-11-01_design_id787.md` §§4.1–4.2, 5–6 (Slice A).
Activation (negotiation, assembler, browser encoder) is slices B–F and is
**gated on F13.4 detection (#786, still open)**. This profile must only be
selected after an explicit opt-in; the push/pop owner is slice E.
- Design record: `doc/2026-11-01_design_id787.md` §§4.1–4.2, 5–6.
Activation waited for F13.4 detection: the SSH adapter's startup probe
(`world_terminal.rs`) records kitty keyboard support in the connection
profile, and negotiation starts only from that evidence, only after an
explicit opt-in; the push/pop owner is the SSH session (slice E).

## Wire summary (verified against the upstream spec)

Expand Down
16 changes: 15 additions & 1 deletion pkgs/id/crates/id-cli/src/commands/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2352,8 +2352,22 @@ pub async fn cmd_serve(opts: ServeOptions) -> Result<()> {
status!(
"world ssh over iroh: `id world ssh-tunnel <node-id>` then `ssh -p 2222 <world>@127.0.0.1`"
);
// #787 Slice E: kitty keyboard negotiation is opt-in per server,
// for worlds compiled with the extended Key module; every other
// world keeps the legacy input semantics by default.
let kitty_keyboard = std::env::var("ID_WORLD_SSH_KITTY_KEYBOARD")
.is_ok_and(|value| value == "1" || value.eq_ignore_ascii_case("true"));
if kitty_keyboard {
status!(
"world ssh kitty keyboard: enabled (kitty-disambiguate-v1, negotiated per session)"
);
}
let options = id_worlds::world_ssh::SshServeOptions { kitty_keyboard };
tokio::spawn(async move {
if let Err(e) = id_worlds::world_ssh::serve(listener, hub, host_key, blobs).await {
if let Err(e) =
id_worlds::world_ssh::serve_with_options(listener, hub, host_key, blobs, options)
.await
{
tracing::error!("world ssh server error: {}", e);
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
//! token per complete key, independent of how the transport split the stream.
//! Plain text emits one token per Unicode scalar.
//!
//! The module is deliberately **inert**: `world_ssh` does not call it, the
//! durable `Input(Vec<u8>)` event is unchanged and no transport behaviour moves
//! yet. Slice E owns activation after F13.4 supplies detection and the reply
//! demultiplexer; [`ReplyFilter`] is the interface that demultiplexer plugs into.
//! Activation is Slice E: `world_ssh` runs one assembler per opted-in raw
//! connection whose terminal reported kitty keyboard support to the F13.4
//! probe, after the push is verified (see `world_ssh::kitty`). Sessions that
//! are not opted in, or whose terminal did not report support, never touch
//! this module and keep the legacy chunk forwarding exactly. The durable
//! `Input(Vec<u8>)` event is unchanged either way; [`ReplyFilter`] is the
//! interface the connection-local reply classifier plugs into.
//!
//! Token bytes are never rewritten: what the assembler emits is exactly the
//! bytes the transport received. Framing failures are fatal by design, because
Expand Down
1 change: 1 addition & 0 deletions pkgs/id/crates/id-worlds/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pub mod blob_gate;
pub mod chat_anchor_render;
pub mod groups;
pub mod guest_burn;
pub mod input_framing;
pub mod program_bundle;
pub mod program_gallery;
pub mod program_gallery_admission;
Expand Down
Loading