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
2 changes: 2 additions & 0 deletions pkgs/id/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pkgs/id/contract/shell-contract.v1.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"contract": "id-shell",
"version": 1,
"revision": 15,
"revision": 16,
"description": "The client-server frame protocol every id shell (terminal, web, native) speaks to a world host. Version 1 is the protocol behind the /id-world/1 ALPN. A shell sends only frames and fields named here; it ignores server frame types and fields it does not know. Additive changes bump `revision`; removing or changing a frame or field needs version 2 and a new ALPN. Event-producing frames must name their stable world-event contract here.",
"max_frame_bytes": 1048576,
"routing_fields": ["world"],
Expand Down Expand Up @@ -46,6 +46,7 @@
"after": "u64?",
"screen_patches": { "type": "bool", "optional": true, "nullable": false },
"screen_msgpack": { "type": "bool", "optional": true, "nullable": false },
"screen_compress": { "type": "bool", "optional": true, "nullable": false },
"device_input": { "type": "object", "optional": true, "nullable": true },
"agent_profile": { "type": "bool", "optional": true, "nullable": false },
"resume_token": { "type": "string", "optional": true, "nullable": true, "max_bytes": 64 }
Expand Down Expand Up @@ -592,6 +593,7 @@
},
"features": {
"screen_msgpack": "Revision 12 (negotiated binary screen patches, F12.11 phase 3, issue #12242; design doc/2026-11-01_design_id805.md sections 3, 5, 6): the join frame's `screen_msgpack` field is the capability flag — a shell that sets it, together with `screen_patches`, on a byte-capable transport receives screen patch frames as binary frames instead of JSON `view` frames. A binary patch frame is one versioned MessagePack value (id-core `screen_codec`, codec version 1) carrying exactly the fields of the `view` frame it replaces — `sequence`, `view_revision`, `base_view_revision`, `resume_token`, and the `patch` — with the same world-event cursor and view-revision semantics; full views, resume-token issuance, and every other frame stay on the text path. On the length-prefixed transports (iroh, ssh-exec) a binary frame body is marked with a single leading NUL byte, which no JSON text frame can start with; on WebSocket it is a binary message. Negotiation is offer-and-observe: a host or transport without the revision simply keeps sending JSON patch frames, and a shell must accept both for a session that offered the flag. Client frames remain text JSON in both directions of the negotiation; a binary frame from a client is malformed input and fails the session safely, like a non-UTF-8 frame. A host never sends a binary frame to a session that did not offer the flag, and never guesses an encoding: an unsupported codec version or a malformed binary payload is a decode failure for the shell, which falls back to a full view by rejoining or presenting its retained full-view path.",
"screen_compress": "Revision 16 (compressed binary screen patches, F12.11 phase 4, issue #805; design doc/2026-11-01_design_id805.md sections 2.3, 3, 5, 6): the join frame's `screen_compress` field is the capability flag \u2014 a shell that sets it, together with `screen_patches` and `screen_msgpack`, on a byte-capable transport receives screen patch frames as version-2 compressed MessagePack frames whenever compression makes the complete frame smaller, and as version-1 frames otherwise. A version-2 frame is one MessagePack value `{version: 2, compression, payload}` (id-core `screen_codec`); `compression` 1 means the payload is the raw-DEFLATE (RFC 1951) of the version-1 frame, `compression` 0 means the payload is the version-1 frame as-is. The inner frame carries exactly the fields of the `view` frame it replaces, with the same world-event cursor, view-revision, and resume-token semantics. Decompression is bounded by the shared 1 MiB frame limit: a payload that inflates past it, an unknown compression id, or a truncated stream is a decode failure for the shell, which falls back to a full view by rejoining or presenting its retained full-view path. A host never sends a compressed frame to a session that did not offer the flag, and never guesses an encoding.",
"agent_profile": "Revision 11 (agent profile for #6300, design doc/2026-11-09_design_id6300_agents_in_worlds_v1.md sections 4.2, 4.3, 8, 9.1): the capability flag is the join frame's `agent_profile` field — a shell that sets it advertises it can consume semantic diffs. A joined agent-profile shell may send `screen_subscribe` naming a screen region (an object with u16 `x`, `y`, `width`, `height` in screen cells) and/or semantic event classes (`chat_posted`, `input_applied`, `object_changed`, `system_event`, `program_changed`; an empty list means all classes, an absent field means no event diffs). The host answers with a `screen_subscription` frame echoing the active subscription and the current screen revision, then sends `semantic_diff` frames scoped to the subscription: event diffs for subscribed classes as world events commit, and region diffs (changes of kind `region_changed`, one per changed row inside the region, carrying that row's new text) as views change. Each semantic_diff names the world `sequence` it follows, the `view_revision` it was computed at, and its `base_view_revision` when it diffs against a known earlier screen. Agent input frames (`input`, `chat`, `paste`, `form_result`, `pointer`) may carry `screen_revision`, the stale-decision token: the screen revision the input was decided against. The host applies such an input only while that revision is still the session's current screen revision; otherwise it rejects the input with an `error` frame whose code is `stale_decision`, commits nothing, and returns the current view. A host without this revision does not know the flag and serves the agent full view frames at reduced fidelity with identical authority; a shell that never sets the flag is unaffected.",
"surface": "A view frame may carry a typed `surface`: a versioned document of kind `screen`, `text`, `form`, `scene`, `audio` or `widget`. Every kind carries its own `version`, bounds and host-side validation (id-core `world_presentation::parse_surface`); a document that names a known kind but fails validation is refused, never rendered. Revision 13 (rich presentation surfaces, issue #12657 slice 1a) adds the `scene` kind: a `scene/1` document is a bounded flat list of named nodes from a closed shape set (`box`, `sphere`, `plane`, `point`), each with a position and a size in world units. Revision 14 (issue #12657 slice 1b) adds the `audio` kind: an `audio/1` document is a bounded list of descriptive audio cues — each a named sound reference with a format from a closed set (`wav`, `ogg`, `mp3`), a duration in milliseconds and a repeat flag. Cues carry no embedded bytes, URLs or scripts; a presenter resolves each cue id against the world's own assets. Revision 15 (issue #12657 slice 1c) adds the `widget` kind: a `widget/1` document is a bounded list of descriptive controls — each a named control from a closed kind set (`button`, `toggle`, `link`) with a safe label, a toggle's current state, and, where it acts, the id of a world action. Controls carry no URLs, scripts or embedded payloads; a presenter resolves each action id against the world's own actions. A shell that does not understand a surface renders `data`; a shell without a renderer for a kind it does understand uses that kind's deterministic text projection, and a host that does not know a kind at all drops the document to the legacy plain-text path.",
"input_events": "Pointer input per the input event model design (doc/2026-11-08T05-48-47Z_design_input_event_model, issue #1831 slice S2; landed in revision 10). Coordinates are cells in the target surface's grid: producers map device pixels to cells at the edge, so frames never carry pixels. `pointer` frames are class event — journaled and replayed like `input`; a drag is a press, a sequence of drag_move frames, and a release, and each drag_move is its own frame, so the frame limit bounds one move, never the whole path. `hover` frames are class ephemeral: connection-local presentation context, never journaled and never seen by other sessions. A pointer_id is unique only within its producing connection; the host namespaces it with the connection's identity when journaling, and press/release pairing is scoped to that (connection, pointer_id) pair. An event an environment cannot produce, or that the target app did not declare in its manifest `interfaces.input`, is refused explicitly: the host answers `input_refused` naming the event and a reason from that frame's enum — an input event is never silently dropped."
Expand Down
6 changes: 5 additions & 1 deletion pkgs/id/crates/id-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"

[features]
default = ["world", "sandbox"]
world = ["dep:rmp-serde"]
world = ["dep:rmp-serde", "dep:flate2", "dep:serde_bytes"]
sandbox = []
web = ["dep:qrcode"]
test-utils = []
Expand Down Expand Up @@ -46,6 +46,10 @@ qrcode = { version = "0.14.1", default-features = false, optional = true }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
rmp-serde = { version = "1", optional = true }
# Optional DEFLATE (RFC 1951) for compressed screen frames (F12.11 phase 4,
# #805): pure-Rust backend, no system zlib.
flate2 = { version = "1", default-features = false, features = ["rust_backend"], optional = true }
serde_bytes = { version = "0.11", optional = true }
tempfile = "3"
thiserror = "2"
tokio = { version = "1", features = ["full"] }
Expand Down
Loading