[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-108675":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":18,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":10,"pushedAt":25,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":29,"discoverSource":30},108675,"osewa","rjyo\u002Fosewa","rjyo","Persistent remote terminals over QUIC and TLS WebSocket, built on libghostty-vt (Rust)","https:\u002F\u002Fosewa.dev",null,"Rust",142,1,60,3,0,2,8,68,55.7,"Apache License 2.0",false,"main",[],"2026-11-16 09:43:55","2026-11-23 00:05:40","# osewa\n\n**The terminal protocol that never drops.**\n\n[Watch the 2-minute intro](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=3oR_9WRLMgM)\n\nosewa runs your remote shell over a TCP\u002FUDP hybrid: QUIC when UDP gets\nthrough, TLS WebSocket when it doesn't. The session lives on the host, not\nin the connection, so a dead link is just a reconnect, and your shell,\nscrollback and running jobs never notice.\n\nLike ssh, but the session survives the network. Like mosh, but it forwards\nports, runs commands and works where UDP is blocked.\n\nThe protocol is in [docs\u002FPROTOCOL.md](docs\u002FPROTOCOL.md) (QUIC in\n[docs\u002FQUIC.md](docs\u002FQUIC.md)), benchmark results in\n[bench\u002FRESULTS.md](bench\u002FRESULTS.md).\n\n## Why now\n\nssh and mosh were built for networks we no longer have. Bandwidth is now\ncheap almost everywhere: a Starlink dish, about the worst link most people\nwill meet if money is not a limit, still carries tens of Mbit\u002Fs. What hurts now is latency, deep\nbuffers, switching networks and blocked UDP. And on the other end there is\noften a coding agent, redrawing a full-screen TUI for hours while you check\nin from a laptop or a phone.\n\n| | ssh (1995) | mosh (2012) | osewa |\n| --- | --- | --- | --- |\n| Built for | One steady wired link | Scarce, lossy mobile bandwidth | Plenty of bandwidth, bad latency and queues |\n| Session | Dies with the TCP connection | Survives roaming | Lives on the host: survives roaming, sleep and server restarts |\n| Transport | TCP | UDP only | QUIC, falling back to TLS over TCP |\n| Screen on the host | None, bytes are replayed | Its own emulator, no scrollback | libghostty-vt, Ghostty's terminal engine |\n| Beyond the shell | Port forwards, exec | Terminal only | Port forwards and exec on the same connection |\n| Kitty protocols (keyboard, graphics, clipboard) | Passed through | No | Keyboard; graphics with animation, kept on the host and redrawn on reconnect (images sent inline); OSC 52 copy; OSC 52 and Kitty clipboard reads with `--clipboard-read`; Kitty paste events |\n| OSC, including modern ones (hyperlinks, cwd, prompt marks, agent status OSC 7501) | Passed through | Few | Yes, plus colors (your terminal's answer programs' queries), light\u002Fdark reports, pointer shapes and notifications (OSC 9, 777) |\n\n**mosh bet on saving bandwidth.** It sends small screen diffs from its own\nterminal emulator, and when that emulator reads the output differently from\nyour terminal, you get the garbled text we have all seen. Whatever it\ndoesn't model, like hyperlinks, never reaches you. The bandwidth it saves no\nlonger matters; the cost remains: UDP only, no port forwarding, no\nscrollback.\n\n**There was no engine to keep the real screen.** In 2012 no terminal\nemulator came as a library, so mosh wrote its own. libghostty-vt is\nGhostty's engine as a library, so the host can keep the same exact, modern\nscreen your terminal app draws, and send it whole when you reconnect.\n\n**ssh is still the way in.** It is on every host, and osewa uses it once,\nto install itself and enroll your device. But an ssh session is its TCP\nconnection: it dies when the network changes, and under load its queue\ngrows until each key waits behind a download (705 ms round trips in our\ntests).\n\n## Benchmarks: osewa vs ssh vs mosh\n\nOn a bad network, osewa echoes keys 8–100× faster than ssh under load, and\ncomes back from a network change faster than mosh.\n\n| | osewa | mosh | ssh |\n| --- | --- | --- | --- |\n| Transport | QUIC (UDP) + TLS WebSocket (TCP), raced | UDP only (SSP) | TCP |\n| Survives sleep \u002F IP change | Yes, resumes in **0.4 s** | Yes, 1.1 s | No |\n| Echo p50 during a download, cellular (60 ms, deep buffer) | **138 ms** | — | 1,714 ms |\n| Echo p50 during a download, Wi-Fi (20 ms, 1% loss) | **44 ms** | — | 374 ms |\n| Echo during a download, 1 Mbit\u002Fs (100 ms, 1% loss) | **154 ms** | — | none within 15 s |\n| Connect + run a command, 120 ms RTT | **388 ms** | — | 1,630 ms |\n| Local echo prediction | Yes | Yes | No |\n| Port forwarding, exec | Yes | No | Yes |\n| Works with UDP blocked | Yes, falls back to TCP | No | Yes |\n| Bulk throughput | Equal to ssh; ahead on lossy Wi-Fi (0.99 vs 0.92 MB\u002Fs) | — | — |\n\nosewa numbers are over QUIC, its default, from the full benchmark run of\n2026-10-31. Over the TLS WebSocket, echo during a download was faster still\non cellular (73 ms) and the 1 Mbit\u002Fs link (125 ms). One caveat: in this test\nrig QUIC reaches the container through Docker's UDP port forwarding, which\ncaps a 50 Mbit\u002Fs download near 1.4 MB\u002Fs.\n\n### Real world: Thailand to Tokyo, over Tailscale\n\nFrom one Mac mini Pro in Thailand to another in Tokyo, over Tailscale (about\n125 ms round trip), osewa connects four times faster than ssh and six times\nfaster than mosh. During a download it echoes keys in 129 ms, 3 ms over\nidle, against ssh's 178 and mosh's 198.\n\n| Median of 5 runs | osewa QUIC | osewa WebSocket | ssh | mosh |\n| --- | ---: | ---: | ---: | ---: |\n| Connect + run a command | **387 ms** | 640 ms | 1,627 ms | 2,366 ms |\n| Echo p50, idle | **126 ms** | 127 ms | 136 ms | 142 ms |\n| Echo p50 \u002F p95 during a download | **129 \u002F 156 ms** | 164 \u002F 276 ms | 178 \u002F 208 ms | 198 \u002F 228 ms |\n| Download alone | 9.86 MB\u002Fs | **9.97 MB\u002Fs** | 9.82 MB\u002Fs | — |\n| Download while typing | 9.82 MB\u002Fs | 9.57 MB\u002Fs | 10.87 MB\u002Fs | **11.07 MB\u002Fs** |\n\nEcho is timed with prediction off, so it is the real round trip of a key.\nmosh carries only the terminal, so its download ran over a separate ssh\nconnection on the same path, as a mosh user's would. Alone, every download\nran near 10 MB\u002Fs, close to what the line allows (below). While typing,\nssh's downloads filled the line to 96–98% and kept about 1 MB\u002Fs more than\nosewa's, and their keys waited 50–70 ms longer, behind the queue that\ntakes. osewa's download left about a tenth of the line free, and its keys\ndid not queue. Runs of 2026-11-01 with `osewa-bench vs` on the current\nbuild (raw output in [bench\u002Freal-world-2026-11-01.txt](bench\u002Freal-world-2026-11-01.txt)).\n\n**The network.** The Tokyo Mac mini sits on 5 GHz Wi-Fi (802.11ac, 80 MHz)\nbehind an apartment cable line (coax, not fiber) whose upload is capped at\n100 Mbit\u002Fs. That cap is the bottleneck for every download here: after\nTailscale's and Ethernet's headers it leaves about 11.3 MB\u002Fs of payload.\nTailscale ran direct between the two NATs (WireGuard over UDP, no relay),\nand the benchmark checked that before and after the runs. The path is\njittery, as a cable upload's request-and-grant scheduling makes it: ping\nbefore the runs measured 120 ms at best, 167 ms on average, with a 36 ms\nstandard deviation, and 116 \u002F 156 \u002F 33 ms after. Run to run it swings too\n(ssh's echo during a download ranged 175–359 ms across the five runs, osewa\nQUIC's 127–160), so read differences under about 20 ms as noise. It also\nchanges from day to day, since the building's neighbours share the cable\nupload: on 2026-10-31 the same path gave ssh 5.36 MB\u002Fs alone, against 9.82\nhere, so compare columns within one table, not across days. That evening\nthe Thai ISP's path would not go direct at all, and Tailscale fell back to\nits Tokyo relay, which caps everything near 2.8 MB\u002Fs and pushes ssh's echo\nunder load to about 700 ms. Those runs are not used here.\n\n### Real world: Thailand to a Tokyo VPS\n\nFrom the same Mac in Thailand to a 1-vCPU, 1 GB Linode in Tokyo, over the\npublic internet (about 100 ms round trip). With a faster path, osewa over\nQUIC downloads at three times ssh's speed, and during the download keys\necho in 102 ms, as fast as idle; ssh's take 145.\n\n| Median of 5 runs | osewa QUIC | osewa WebSocket | ssh | mosh |\n| --- | ---: | ---: | ---: | ---: |\n| Connect + run a command | **311 ms** | 511 ms | 1,337 ms | 1,993 ms |\n| Echo p50, idle | **99 ms** | 101 ms | 110 ms | 114 ms |\n| Echo p50 \u002F p95 during a download | **102 \u002F 105 ms** | 104 \u002F 143 ms | 145 \u002F 150 ms | 113 \u002F 119 ms |\n| Download alone | **39.67 MB\u002Fs** | 27.26 MB\u002Fs | 11.96 MB\u002Fs | n\u002Fa |\n| Download while typing | **30.55 MB\u002Fs** | 27.28 MB\u002Fs | 11.55 MB\u002Fs | 15.45 MB\u002Fs |\n\nmosh carries only the terminal, so it has no download of its own: its\n\"while typing\" figure is a separate ssh connection beside the mosh\nsession, which is why it can beat ssh's download over the session's own\nconnection. ssh's download swings a lot from run to run on this path, so\ntreat the ssh and mosh download numbers as rough until we rerun them.\n\nQUIC's download while typing ranged 15.8–39.9 MB\u002Fs across the five runs;\nthe WebSocket's held at 27 in every one. Runs of 2026-10-31 with\n`osewa-bench vs` (raw output in\n[bench\u002Freal-world-vps-2026-10-31.txt](bench\u002Freal-world-vps-2026-10-31.txt)).\n\n### Resource use\n\nAn idle osewa session takes 14.3 MB on the host, half of ssh's and two\nthirds of mosh's, and 6.9 MB on the client. The cost is host CPU on heavy\noutput: osewa keeps the real screen, so it parses everything the program\nwrites, where ssh just forwards bytes.\n\n| | osewa | mosh | ssh |\n| --- | ---: | ---: | ---: |\n| Host memory, idle session | **14.3 MB** | 20.6 MB | 27.4 MB |\n| Client memory, idle session | **6.9 MB** | 14.3 MB | 8.2 MB |\n| Host \u002F client CPU, typing 10 keys\u002Fs | 0.5% \u002F 0.6% | 0.4% \u002F 0.5% | \u003C0.1% \u002F 0.1% |\n| Host CPU per MB, log tail at 50 kB\u002Fs | 302 ms | 434 ms | **66 ms** |\n| Host CPU per MB, output flood | **6 ms** | 45 ms | 12 ms |\n| Host memory, output flood | 35.6 MB | **20.2 MB** | 27.6 MB |\n\nSame container and run as above, osewa over the TLS WebSocket; an idle\nsession uses under 0.1% CPU on both ends for all three. In a flood the\nprogram wrote 173 MB\u002Fs under osewa, 22 MB\u002Fs under mosh and 1.2 MB\u002Fs under\nssh, which holds the program back to the link's speed.\n\n*osewa won't fill the network's buffers to squeeze out bulk throughput,\nwhich is what makes ssh's keys take seconds to echo under load. On lossy\nlinks bulk speed swings run to run for both.*\n\n## Quick start\n\nInstall osewa (Linux and macOS, amd64 and arm64) into `~\u002F.local\u002Fbin`:\n\n    curl -fsSL https:\u002F\u002Fosewa.dev\u002Finstall.sh | sh\n\nThen:\n\n    osewa login --service me@devbox   # install on the host, enroll this device, run as a user service\n    osewa attach devbox               # attach to (or create) a session\n    osewa forward devbox 3000         # forward localhost:3000\n    osewa exec devbox -- make test    # run a command, no terminal\n    osewa update devbox               # upgrade the host over osewa, no ssh\n\nBuild from source (needs Rust and Zig for libghostty-vt):\n\n    make libghostty   # pinned libghostty-vt into .cache\u002F\n    make check        # clippy + tests\n    make build        # bin\u002Fosewa\n    make ios-framework  # target\u002FOsewa.xcframework: the C API (crates\u002Fffi\u002Finclude\u002Fosewa.h) for iOS apps\n    make release      # dist\u002FvX.Y.Z\u002F: linux (static musl) and darwin binaries, amd64 and arm64\n\nReleasing: `scripts\u002Frelease.sh notes` drafts `docs\u002Freleases\u002FvX.Y.Z.md`\n(the patch after the latest tag) to edit and commit; `scripts\u002Frelease.sh\npublish` then builds with that version built in, signs and notarizes the\ndarwin binaries, tags HEAD and creates the GitHub release, which\ninstall.sh downloads. A published version never changes. Binaries it can\nrun here (Docker for linux, Rosetta for darwin-amd64) must print the same\n`version --json`; the others are checked by arch and the build id\n(`p\u003Cprotocol>-s\u003Csnapshot>`) baked into them. Signing\n(`scripts\u002Fsign-darwin.sh`) reads its identity and notary profile from the\nenvironment (see the script headers).\n\n## Roadmap\n\nosewa is growing into two layers: a transport that any terminal app can\nride, and a multiplexer on top of it.\n\n1. **Transport.** What ships today: QUIC with TLS WebSocket fallback,\n   sessions held on the host, exactly-once input, keystrokes ahead of bulk,\n   and the latest screen instead of a backlog on a slow link. It is also\n   an experimental transport in [Moshi](https:\u002F\u002Fgetmoshi.app), the iOS and\n   Android terminal app, beside mosh.\n2. **Mux.** Tabs, splits and workspaces held on the host, like tmux, but\n   built from osewa sessions instead of running inside one. Every pane is\n   its own session with its own flow control, the layout lives on the host,\n   and a terminal, a desktop app or a phone attaches to the same layout.\n   With no tmux in between, there is one terminal engine between you and\n   the program, and an agent's full-screen TUI redraws at the transport's\n   speed.\n\nThe transport stays usable on its own: the mux is one client of the same\nopen protocol.\n\n## Built for agents\n\nA coding agent runs for hours in a full-screen TUI, and you check in from\nwherever you are. osewa keeps that screen on the host in libghostty-vt, so\nwhat the agent's terminal does reaches you whole, on every reconnect, and\nthe host answers the agent's queries itself, so it never waits on a client\nthat is asleep.\n\n| Sequence | What it is | What osewa does |\n| --- | --- | --- |\n| OSC 7501 | Agent status: working, blocked, done, idle, with progress and a message | Kept per session: `osewa ls` shows it, and attach shows a notice when the agent is blocked or done |\n| OSC 133 | Prompt marks | Passed to your terminal; a new prompt ends a working or blocked status |\n| OSC 9, OSC 777 | Desktop notifications | Sent to your terminal as one, live only, never replayed on reconnect |\n| OSC 52 | Clipboard | Copies reach your clipboard; reads only with `--clipboard-read`, owner only |\n| OSC 8 | Hyperlinks | Kept in the screen and passed through |\n| OSC 7 | Current directory | Passed through |\n| OSC 0, 1, 2 | Window and tab titles | Passed through, control characters stripped |\n| OSC 4, 10, 11, 12, 21 and resets 104, 110–112 | Palette, foreground, background and cursor colors | Your terminal's colors answer the agent's queries; colors it sets are drawn on your terminal and reset on detach |\n| DSR 996, mode 2031 | Light or dark appearance | Answered from your terminal's, and reported when it changes |\n| OSC 22 | Pointer shape | Your terminal's pointer follows |\n| Kitty keyboard (`CSI u`) | Unambiguous keys and modifiers | Supported |\n| Kitty graphics (`APC G`) | Images, including animation | Drawn on terminals that draw them (kitty, Ghostty, WezTerm; `--graphics` to choose): kept on the host and redrawn on reconnect; images sent inline only |\n| OSC 5522 | Kitty's clipboard protocol | Reads wait for the owner like OSC 52's, text only, with `--clipboard-read`; pastes arrive as Kitty paste events when the program asks for them |\n\nEverything else (other OSCs, DCS including tmux passthrough, APC, PM, SOS)\nis dropped before it reaches your terminal: the remote program doesn't get\nto command it.\n\n## Features\n\n- **Hybrid carrier:** QUIC with automatic TLS WebSocket fallback, one frame\n  format on both.\n- **Persistent sessions:** survive sleep, IP changes, NAT rebinding and\n  server restarts.\n- **Exactly-once input:** sequenced and acked keystrokes, resent across\n  reconnects.\n- **Priority and flow control:** terminals before bulk, credit-based\n  backpressure, a typing-aware in-flight cap.\n- **No head-of-line blocking:** each port forward and exec gets its own\n  QUIC stream.\n- **Predictive local echo** with mosh-style epochs; never shows passwords.\n- **Port forwarding and remote exec** (`-L` style forwards,\n  stdin\u002Fstdout\u002Fstderr) on the same connection.\n- **Device keys:** Ed25519 per device, TLS 1.3, pinned server key. No\n  passwords, no trust on first use.\n- **Self-hosting:** `osewa login` installs over ssh once; `osewa update`\n  upgrades over osewa, and released builds say when a release is out, or\n  install it themselves if you opt in\n  (`osewa set auto-update auto|ask|off`).\n- **Open protocol and a client library,** built on Ghostty's\n  terminal engine. Linux and macOS hosts.\n\n## How it works\n\nosewa separates the session from the transport, then makes the transport\nhard to kill.\n\n1. **TCP\u002FUDP hybrid transport.** The same framed protocol runs on two\n   carriers. QUIC over UDP: a 1-RTT handshake, connection IDs that survive\n   address changes, and a separate stream per port forward, so a lost\n   packet in a download never blocks your echo. TLS 1.3 WebSocket over TCP:\n   it gets through proxies and UDP-hostile networks. The server advertises\n   QUIC, the client caches it and races both carriers with a 300 ms head\n   start for QUIC. Nothing to configure.\n2. **The host keeps the real screen.** Each terminal runs in its own\n   process on the host, which keeps the actual screen with libghostty-vt,\n   Ghostty's terminal engine. Reconnecting sends that screen as one\n   snapshot, not a replay of everything you missed. And when output\n   outruns a slow link, you get the latest screen instead of a\n   minutes-long backlog. Connections come and go; restarting the server\n   doesn't touch a session.\n3. **The link never gives up.** Pings detect a dead path in about a\n   second. The client redials, racing attempts every 500 ms, and resumes\n   every session on the new connection. Input carries sequence numbers and\n   is resent until acked, so no keystroke is lost or doubled.\n4. **Keystrokes first.** Frames go out by priority (control, then\n   terminals, then exec, then forwards) under end-to-end credit flow\n   control. Bulk streams are held to the path's bandwidth-delay product\n   plus 40 ms of queue while you type, and 200 ms when you don't, so a\n   download can't bury your echo. Over TCP the server also asks the kernel\n   how much is already in flight, and while you type holds the queue to\n   10 ms.\n5. **Predictive local echo.** On slow links the client draws each key\n   before the host echoes it, mosh-style, and checks it against the real\n   screen. Nothing on a line is shown until the host confirms one key, so\n   passwords never appear.\n\nAuth is per-device Ed25519 keys over TLS 1.3, with the server key pinned.\nYou enroll once over ssh, and osewa installs itself on the host. After\nthat, even updates go over osewa.\n\n## How we measured\n\nosewa and OpenSSH ran against the same container, through the same\npublished ports, over netem-shaped links with realistic buffers: far fiber\n(120 ms, 50 Mbit\u002Fs), cellular with a deep buffer (60 ms, 10 Mbit\u002Fs), Wi-Fi\nwith 1% loss (20 ms, 20 Mbit\u002Fs) and a slow link (100 ms, 1 Mbit\u002Fs, 1%\nloss). Echo is the time from sending a key to seeing it, during a download\non the same connection. Recovery is measured by moving the client to a new\nIP address after 5 s offline. Real-path checks ran from Thailand against a\nMac mini in Tokyo over Tailscale and a Linode VPS in Tokyo over the public\ninternet. The rig is an e2e suite in Docker, run against an image of\nthis build (`docker build --target binary`); the results are in\n[bench\u002FRESULTS.md](bench\u002FRESULTS.md).\n\n## FAQ\n\n**Does it replace ssh?** For interactive work, yes. You need ssh once, to\nenroll; after that osewa runs on its own port (TCP and UDP 7322).\n\n**What if UDP is blocked?** The client races QUIC against a TLS WebSocket\nand takes whichever connects first. With UDP blocked, that costs 300 ms per\nconnect.\n\n**How is it different from mosh?** mosh keeps sessions alive and predicts\necho too, but it is UDP-only and carries only the terminal. osewa adds TCP\nfallback, port forwarding and exec, and keeps keystrokes ahead of bulk data\non the same connection.\n\n**Does it work behind a VPN or tailnet?** Yes. QUIC starts with 1200-byte\npackets to fit a WireGuard MTU, and the Mac mini numbers above were taken\nover Tailscale.\n\n**Is it as safe as ssh?** The cryptography is: TLS 1.3 only, and both ends\nprove who they are with Ed25519 keys on every connection, no passwords. The\nserver's key comes to you during enrollment over ssh, so there is no \"trust\nthis host?\" prompt, and a revoked device is out on its next connect. Where\nssh is ahead is age: OpenSSH has decades of audits and osewa has none yet,\nit adds a second open port, and its device key is a plain file (mode 0600),\nnot one behind a passphrase or an agent.\n\n## License\n\nApache 2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).\n","osewa 是一个具备会话持久性的远程终端协议，支持在 QUIC 和 TLS WebSocket 之间智能切换传输层，确保网络中断、设备休眠或服务器重启后终端会话（含 shell 状态、滚动缓冲区和运行中任务）不丢失。核心基于 Rust 编写的 libghostty-vt 终端引擎，在服务端完整保真渲染现代终端特性（如超链接、OSC 52\u002F777\u002F7501、图形动画、剪贴板交互），并支持端口转发与命令执行。适用于高延迟、频繁切换网络（如移动办公、卫星链路）、需长期保持 TUI 应用运行的开发与运维场景。","2026-11-24 04:34:56","CREATED_QUERY"]