Skip to content

Pendant app shell: agents on nsh (read path) - #10

Merged
VirtualMachinist merged 16 commits into
mainfrom
feat/pendant-shell
Nov 14, 2026
Merged

VirtualMachinist merged 16 commits into
mainfrom
feat/pendant-shell

Conversation

@VirtualMachinist

Copy link
Copy Markdown
Member

Summary

The Pendant app shell, read path (pack 2a, G1): an nsh v0.5.0 Rust app in app/ that shows the agents from a bridge behind the tailnet proxy, on the iOS simulator and the Android emulator.

  • Shell and navigation: app/nsh.json and app/src/lib.rs hold the navigation between the list, detail and inbox screens, plus a PENDANT_START launch hook for tap-free checks. The bridge URL comes from PENDANT_BRIDGE_URL at build time and is never committed.
  • Client: app/src/net/. HTTP goes through nsh fetch. The WebSocket runs on a tungstenite 0.28 worker thread, because nsh 0.5.0's WebSocket client is JS-only. That is the same tungstenite that nsh-core already pulls in. The client tracks seq and resends watches after a reconnect.
  • Screens: app/src/agents/ holds the agent list (link state, count), the detail screen (marker, latest seq, unwatch on dismiss) and the inbox with the blocked state. The theme is in app/src/theme.rs.
  • Bridge: crates/pendant-herdr/src/snapshot.rs reads the snapshot inside herdr's {type, snapshot} reply envelope. Before this, every live snapshot read as empty. It has a test for the live shape.
  • Scratch session: scripts/scratch/ seeds a named four-pane session that shows only made-up content: four markers, one ticking pane, one blocked agent. The scripts refuse any session name outside the scratch prefixes.
  • deny.toml: allows ISC and CDLA-Permissive-2.0, and ignores two "unmaintained" notices that come in through nsh 0.5.0 (RUSTSEC-2025-0141, RUSTSEC-2026-0192). No vulnerability advisory is ignored.

Not in the app

  • No direct tokio or reqwest dependency, and no tokio in app/src. tokio arrives only through nsh-core, which depends on it unconditionally. reqwest is absent from the tree.

Test plan

  • CI: check (workspace and app cargo deny), banned-names, cargo-deny
  • App fmt, clippy and tests on the build host
  • iOS simulator and Android emulator: the agent count matches /v1/snapshot, the blocked agent reads blocked, detail shows the seeded marker, the inbox shows the blocked event, and seq rises over the WebSocket
  • The detail screen sends an unwatch on dismiss

🤖 Generated with Claude Code

VirtualMachinist and others added 16 commits November 14, 2026 10:15
seed.sh starts a named session with one workspace, four panes in a 2x2 split,
a made-up marker line per pane, and four reported agents with one blocked.
Each pane re-reports its lifecycle state so the reported agents stay
registered while the pane is open. teardown.sh stops and deletes the session.
Only fixture content; no live session and no notes.
herdr 0.9.5 answers `session.snapshot` with `{type, snapshot}`, so the agents
and workspaces sat one level below where the parser looked and every snapshot
came back empty. Descend when the reply carries a snapshot object; keep the
flat fixture shape working. Adds a test for the live envelope.
The app becomes an nsh v0.5.0 Rust app. lib.rs is the library root and
holds the navigation stack (agents, agent detail, inbox); nsh.json names
App as the root and limits the network to *.ts.net hosts.

net/ reads the bridge with nsh's fetch: typed snapshot, agent, workspace,
agent detail, inbox and error bodies, and the /v1/ws version 1 envelope
(watch, unwatch, resync up; frame, scrollback, refused down) with a seq
tracker. The bridge origin is not in the source: it is read from
PENDANT_BRIDGE_URL at build time and must be an https origin.

agents/mod.rs and theme.rs are placeholders for the screens and colours.

The notes store and its Lapis link are built on the host only, so its
tests and pendant_app::{Config, Store} are unchanged, and the iOS and
Android builds carry no Lapis. On those targets lib.rs mounts the device
keystore directly. rust-version rises to 1.97, nsh's minimum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both scripts now resolve the name through lib.sh, which refuses an empty name
and anything not starting with pendant-scratch or pendant-shell, prints the
refusal and exits 1 before any herdr call. teardown stops and deletes
sessions, so a typo must not be able to reach a live one.
net/live.rs keeps one shared live state for the screens, started by the
root and read with net::live::live():

- link: Connecting, Open, Closed(why) or Unconfigured(why)
- snapshot and inbox, fetched with nsh's fetch every 3 s; error holds
  the last HTTP failure
- panes: per watched pane, the frames seen, the highest seq and any
  that did not rise, full frames, the last frame, the scrollback and the
  last refused operation; watch(pane) and unwatch(pane) drive it

nsh 0.5.0 exposes its WebSocket to TSX only, so one worker thread holds
wss://<bridge>/v1/ws with blocking tungstenite 0.28 (the line nsh-core
already uses) over rustls with ring and the webpki roots. It sends the
Serve origin the bridge requires, re-sends watches after a reconnect,
backs off up to 30 s, and hands messages to the engine thread through a
channel drained every 100 ms. Frames are logged with their seq.

deny.toml allows ISC and CDLA-Permissive-2.0 (ring, untrusted,
rustls-webpki, webpki-roots) and ignores two unmaintained notices that
come only through nsh 0.5.0: RUSTSEC-2025-0141 (bincode 1.3.3) and
RUSTSEC-2026-0192 (ttf-parser), to be reviewed at the next nsh upgrade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
herdr only emits frames when pane output changes, so the seeded session was
static after the first full frame. Pane 1 now prints PENDANT-SCRATCH-TICK-<n>
every 2 s inside its reporter loop, after the marker line, so the marker stays
in scrollback and frames keep rising. Made-up content only; pane 2 stays the
blocked one.
live_socket_sees_rising_frames drives the worker against a running
bridge named by PENDANT_BRIDGE_URL at run time, watches one pane
(PENDANT_WATCH_PANE) and passes when the link opens and the pane's
frames arrive with a rising seq. It is ignored by default, so CI and
plain test runs never dial out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PENDANT_START=inbox or agent:<id>, read at run time, opens that page
over the agent list. A simulator launch passes it as
SIMCTL_CHILD_PENDANT_START, so the shell checks can open detail and the
inbox without taps; without it the app opens on the list as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The panes started the operator's interactive shell, so their scrollback held
the login prompt, the typed reporter loop and job-control noise. Each pane now
starts pane.sh through env -i and bash --noprofile --norc; it erases the
prompt, the command echo and startup noise before printing, and never returns
to a shell. Pane text is only PENDANT-SCRATCH-MARKER-<n> plus the pane-1
ticker. Fixture content unchanged; the name guard still applies.
The live link now logs each watch and unwatch it sends, and the root
logs a page leaving the stack natively, next to the frame lines, so a
device log shows whether a pane is released when its page goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@VirtualMachinist
VirtualMachinist merged commit 26cccb9 into main Nov 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant