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
1 change: 1 addition & 0 deletions .github/scripts/id-pr-checks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ prod-lines-check
test-unit
test-crate-integration
test-native-shell
test-tui-shell
test-rust-examples
test-shard-0
test-shard-1
Expand Down
13 changes: 13 additions & 0 deletions .github/test-suite-registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,19 @@
"status": "mapped",
"notes": "The native-shell check runs every integration target in this non-default workspace member; suite paths trued up 2026-11-17 while repairing the registry ratchet (#10329)."
},
{
"id": "id.tui-shell.capability-statement",
"paths": ["pkgs/id/crates/id-tui-shell/tests/*.rs"],
"invocation": "nix flake check ./pkgs/id (check test-tui-shell runs cargo nextest -p id-tui-shell)",
"venue": {
"workflow": ".github/workflows/id-check.yml",
"job_step": "check_each / test-tui-shell",
"state": "active",
"dispatchable": true
},
"status": "mapped",
"notes": "The tui-shell check runs every integration target in this non-default workspace member; the first target is the capability-statement check recorded for #12818 (shells v2 slice 2, decision D3)."
},
{
"id": "id.bench.compare-script",
"paths": [".github/scripts/id-bench-compare.test.sh"],
Expand Down
7 changes: 7 additions & 0 deletions pkgs/id/Cargo.lock

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

1 change: 1 addition & 0 deletions pkgs/id/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ members = [
"crates/id-render",
"crates/id-native-shell",
"crates/id-hw-shell",
"crates/id-tui-shell",
"crates/id-cli",
"crates/id-import-notion",
]
Expand Down
45 changes: 45 additions & 0 deletions pkgs/id/crates/id-tui-shell/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[package]
name = "id-tui-shell"
version = "0.1.0"
edition = "2024"
rust-version = "1.96"
description = "Terminal (TUI) shell for id (more-shells v2 slice 2, #12818): the text-native world-session client on the F13.1 shell contract, capability statement recorded per decision D3"
license = "MIT OR Apache-2.0"

# TUI shell (#12818, design more-shells v2 §2): a workspace member but
# deliberately NOT a default member, like id-native-shell and
# id-hw-shell, so the ordinary `id` build never acquires this shell's
# dependencies. Per decision D3 of the v2 outline, the crate's first
# recorded content is its capability statement (capability-statement.json),
# recorded before implementation starts; the frame-layer implementation
# (feature completion on #12818) builds on it in this crate.

[dependencies]
serde_json = "1"

[lints.rust]
unsafe_code = "warn"
rust_2018_idioms = { level = "warn", priority = -1 }
rust_2024_compatibility = { level = "warn", priority = -1 }
missing_debug_implementations = "warn"
missing_docs = "warn"
trivial_casts = "warn"
trivial_numeric_casts = "warn"
unused_lifetimes = "warn"
unused_qualifications = "warn"

[lints.clippy]
all = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }
nursery = { level = "warn", priority = -1 }
cargo = { level = "warn", priority = -1 }

# Deny critical issues - these indicate bugs or serious problems
# (mirrors pkgs/id/Cargo.toml and the other shell crates).
# Test modules should add: #[allow(clippy::unwrap_used, clippy::expect_used)]
unwrap_used = "deny"
expect_used = "deny"
panic = "deny"
unimplemented = "deny"
todo = "deny"
dbg_macro = "deny"
63 changes: 63 additions & 0 deletions pkgs/id/crates/id-tui-shell/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# id-tui-shell

Terminal (TUI) shell for `id` — more-shells v2 slice 2 (issue
#12818; design `doc/2026-11-23T03-17-14Z_design_more_shells_v2/`,
§2, from the native TUI client idea, issue #1071). A ratatui
client speaking the F13.1 shell contract
(`pkgs/id/contract/shell-contract.v1.json`): it covers the full
text-native workflow of a world session — join, read, act,
reconnect under the v1 history-identity rule — at parity with
the browser shell's text surface. It adds no frame kinds and
needs no host change.

This crate is a workspace member but deliberately **not** a
default member, like the other shells, so the ordinary `id`
build never acquires this shell's dependencies:

```sh
cargo build -p id # no TUI shell — default members only
cargo build -p id-tui-shell # the TUI shell
cargo test -p id-tui-shell # capability-statement tests
```

## Status

- **Capability statement — recorded** (this slice, per decision
D3 of the v2 outline: the claimed subset is recorded before
implementation starts). See the section below.
- **Feature completion — open** on issue #12818: the frame
builders, session fold, and three-panel presentation (room /
object selector, room/document, chatroom — #1071) land in
this crate on top of the statement, followed by conformance
on the recorded session plus behavioral completion checks
for the workflow, per the v1 gate.

## Capability statement

Per the v2 outline (§2 and decision D3), this shell's
capability statement is recorded in
[`capability-statement.json`](capability-statement.json) before
implementation starts, stated plainly in the hardware shell's
style: the client frames it sends (`join`, `input`, `paste`,
`resize`, `chat`, `form_result`, `records`), the server frames
it presents (`snapshot`, `event`, `view`, `form_result_status`,
`records`, and `error` surfaced as a session refusal), the
capability providers it declares (none — no F13.7 provider is
named for the TUI in #1071, the outline, or #12818), its
reconnect rule (history identity; divergence resolves by
re-snapshot, never by merge), and what it excludes by name
(rich rendering, media, provider offers, world hosting and
program authoring, offline reading, agent-profile surfaces).

The claimed subset is the browser shell's text surface
(`pkgs/id/web/src/world.ts`, `world-form.ts`) — the parity
anchor #12818 names — not the native GUI shell's wider one:
no screen-region subscription, no semantic diffs, no provider
frames. `tests/capability_statement.rs` pins the statement to
the contract file and to the workflow the issue names, so the
record cannot drift from the contract it is a statement
against; when the builders and the session fold land, the
check grows the same builder/fold oracles the native shell's
statement check carries (#10928). The conformance run is
wired into the check — the `test-tui-shell` flake check runs
this crate's test suite.
1 change: 1 addition & 0 deletions pkgs/id/crates/id-tui-shell/capability-statement.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"contract":{"file":"pkgs/id/contract/shell-contract.v1.json","name":"id-shell","version":1},"excludes":["rich rendering — scene (3D) surfaces are not rendered; a view is presented as its text (`data`) fallback and, for screen surfaces, as a terminal cell grid","media — audio surfaces and image rendering are not presented, including the intent/byte image protocol sketched in issue #1071: it needs frame kinds the contract does not name, which the F11.12 gate reserves to a contract revision (v2 outline, non-goals)","provider offers — no F13.7 capability providers are declared or answered; no provider is named for the TUI in issue #1071, the v2 outline, or issue #12818, and provider_request frames are not presented","world hosting and program authoring — the browser shell's install_begin/install_chunk/install_end and compile frames are not sent; the TUI is a world-session client, not a hosting or authoring surface","offline reading — not claimed; that is the browser shell's slice-1 surface (issue #10927). The TUI presents a live session, locally hosted or remote","agent-profile surfaces — semantic_diff and screen_subscription frames are not presented; the TUI's screen read is the view frame, as in the browser shell"],"platform":"terminal","posture":"local-first: the shell is a presentation client of a world host — a local host when one is running, otherwise a remote host reached directly over iroh; it hosts no world and implements no hosted or quota surface","presentation":{"error":"not presented as content: an error frame refuses the session and surfaces as a session failure","events":"presented in the chat panel and folded into the room/object selector (chat_posted, region_changed, object_changed, input_applied, program_changed, system_event)","screen":"terminal cell grid (ratatui): the view frame's screen surface rendered as styled terminal cells, with patch negotiation on join as in the browser shell","surface_less_view":"the legacy `data` text fallback, the same rule the terminal shell presents","text_and_form":"deterministic text projection across three panels (room/object selector, room/document, chatroom — issue #1071); form surfaces render as text panels with their actions, answered with form_result"},"presents":["error","event","form_result_status","records","snapshot","view"],"providers":[],"reconnect":"reconnect presents the last applied sequence and the session's history identity (join `after` / `resume_token`); where continuity cannot be established the shell takes a fresh snapshot — divergence resolves by re-snapshot, never by merge (the v1 history-identity rule)","recorded_for":"shells v2 slice 2 (issue #12818); terms per doc/2026-11-23T03-17-14Z_design_more_shells_v2 (issue #6297), section 2 and decision D3 — the claimed subset, recorded before implementation starts","sends":["chat","form_result","input","join","paste","records","resize"],"shell":"id-tui-shell","statement":"shell-capability-statement","transport":"iroh (contract transport 'iroh', alpn /id-world/1)","version":1,"workflow":["join","read","act","reconnect"]}
52 changes: 52 additions & 0 deletions pkgs/id/crates/id-tui-shell/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//! Terminal (TUI) shell for `id` — more-shells v2 slice 2
//! (#12818; design `doc/2026-11-23T03-17-14Z_design_more_shells_v2`,
//! §2 "TUI — feature completion", from #1071).
//!
//! The TUI is a shell in the F13.1 shell contract's terms, not a
//! debug view: a ratatui client covering the full text-native
//! workflow of a world session — join, read, act, reconnect under
//! the v1 history-identity rule — at parity with the browser
//! shell's text surface.
//!
//! Per decision D3 of the v2 outline, the claimed subset is
//! recorded as this shell's capability statement *before*
//! implementation starts. That statement is this crate's first
//! recorded content: [`CAPABILITY_STATEMENT_JSON`] is the verbatim
//! record (`capability-statement.json` at the crate root), and
//! `tests/capability_statement.rs` pins it to the contract file
//! and to the workflow #12818 names, so the claim cannot drift
//! silently from the contract it is a statement against. The
//! frame builders, session fold, and presentation glue of feature
//! completion land in this crate on top of the statement, and the
//! pinning tests grow with them — the same progression the
//! hardware shell (#10929) and the native shell (#10928) followed.

/// Shell-contract name this client speaks (F13.1).
pub const CONTRACT_NAME: &str = "id-shell";

/// Shell-contract major version this shell's statement is
/// recorded against.
pub const CONTRACT_VERSION: u64 = 1;

/// The TUI shell's recorded capability statement, verbatim:
/// the client frames it sends, the server frames it presents,
/// the F13.7 providers it declares (none), its posture and
/// reconnect rule, and its exclusions by name. The canonical
/// record is `capability-statement.json` at the crate root;
/// this constant embeds that file so the statement ships with
/// the shell it describes.
pub const CAPABILITY_STATEMENT_JSON: &str = include_str!("../capability-statement.json");

/// The recorded capability statement, parsed. The canonical
/// record is the JSON text in [`CAPABILITY_STATEMENT_JSON`];
/// this is a convenience parse of exactly that text.
///
/// # Errors
///
/// Returns the `serde_json` error if the recorded statement
/// shipped in this crate is not valid JSON — a build-time
/// defect the crate's capability-statement tests exist to
/// catch.
pub fn capability_statement() -> Result<serde_json::Value, serde_json::Error> {
serde_json::from_str(CAPABILITY_STATEMENT_JSON)
}
Loading