Match the desktop/web theme (public/style.css): accent #E3A64A gold (dark) / #C9892F (light) replacing the indigo, +onAccent #1A1305 dark ink for gold-fill buttons, +accentSoft. Status colors realigned to the web warm palette (#46D07F/#F5B14C/#FF6B6B). Terminal canvas fixed to the desktop warm-dark (#100F0D bg / #ECE9E3 fg) with gold caret/selection. DSButtonStyle primary now uses onAccent (dark) instead of white for contrast on gold. All via the single accent token + DS palette — no scattered edits. Verified: iPhone 16 290 + iPad Pro 11 290 tests green (DesignSystemTests assert the exact gold + web-status RGB in both schemes).
WebTerm iOS Client
Native iOS client for the web-terminal server in the repository root. It is a pure remote client: it speaks the same WebSocket wire protocol and HTTP endpoints as the web frontend and requires zero server changes in P0.
Build & Run
Requirements: macOS 15, Xcode 16.3 (Swift 6.1), XcodeGen, iOS 18.4 simulator (iPhone 16). SwiftTerm 1.13 is resolved for the App target only.
cd ios
xcodegen generate # project.yml → WebTerm.xcodeproj
open WebTerm.xcodeproj # or run the full test suite headless:
xcodebuild -project WebTerm.xcodeproj -scheme WebTerm \
-destination 'platform=iOS Simulator,name=iPhone 16,arch=arm64' test
Layout:
| Path | What |
|---|---|
App/ |
SwiftUI app glue + WebTermTests unit-test bundle |
Packages/WireProtocol |
Frozen wire contract (frames, validation, tunables) |
Packages/SessionCore |
SessionEngine actor: connect/replay/reconnect/gate |
Packages/HostRegistry |
Paired hosts + last-session persistence |
Packages/APIClient |
HTTP endpoints (guarded routes carry Origin) |
Packages/TestSupport |
FakeTransport / FakeClock / FakeHTTPTransport |
IntegrationTests/ |
Tests against a real Node server (npm start) |
Per-package tests: swift test --package-path Packages/<Name>.
The server runs from the repo root: npm install && npm start (see the root
README).
ntfy notification bridge (P0 "host finds the phone")
Until APNs push lands (P1, T-iOS-20/21), the phone is notified via the
existing ntfy bridge that already ships with
npm run setup-hooks. No new code — this chapter documents and verifies
the shipped behavior.
What it does
When Claude Code (running inside a web-terminal session on the host) fires a
hook event, an extra curl posts to your ntfy topic:
| Claude Code hook event | ntfy Priority header |
Meaning |
|---|---|---|
PermissionRequest (held gate) |
high |
NEEDS-INPUT — Claude is waiting for approval |
Stop / SessionEnd |
low |
DONE — the task finished / session ended |
Install logic: scripts/setup-hooks.mjs:229-238 (high on PermissionRequest
at :231-233, low on Stop/SessionEnd at :235-237). The command itself is
built by buildNtfyCommand (scripts/setup-hooks.mjs:91-101).
Default-off: env unset ⇒ zero side effects
The bridge is opt-in at install time: npm run setup-hooks only adds the
ntfy hooks when both WEBTERM_NTFY_URL and WEBTERM_NTFY_TOPIC are set in
the environment (gate at scripts/setup-hooks.mjs:262-264, guarded install at
:229). With the vars unset, the written settings.json contains no ntfy
entry at all (verified: fresh install without env → grep -c WEBTERM_NTFY settings.json = 0, and the install log has no ntfy line).
Two further layers keep it inert outside web-terminal:
- Every installed ntfy command starts with
[ -n "$WEBTERM_HOOK_URL" ] && …(scripts/setup-hooks.mjs:93) — in a normal terminal that var is unset, so the hook is a no-op. - The session env is the only carrier: the server forwards
WEBTERM_NTFY_*into each spawned session via the...process.envspread (src/session/session.ts:95-102, comment at:99-100). Nothing is hardcoded server-side.
Setup
-
Install the ntfy app on the iPhone (App Store) and allow notifications.
-
Generate a random topic and subscribe to it. On the public
ntfy.shserver, the topic name is the password: anyone who knows it can read your notifications and publish to the channel. Use a random string, e.g.openssl rand -hex 12. -
Export the env vars, then install the hooks and start the server from that same shell (the install gate reads env at
setup-hooks.mjs:262-264; at runtime the curl expands$WEBTERM_NTFY_*from the session env, which inherits the server's env —src/session/session.ts:95-102):export WEBTERM_NTFY_URL=https://ntfy.sh # or your self-hosted ntfy export WEBTERM_NTFY_TOPIC=<your-random-topic> # optional, self-hosted/paid access control only: export WEBTERM_NTFY_TOKEN=tk_... # env only — never a literal npm run setup-hooks # expect: Installed ntfy bridge (NEEDS-INPUT=high, DONE=low) → https://ntfy.sh/<topic> npm startConfirmation log line:
scripts/setup-hooks.mjs:296-298. -
Restart any running
claudesessions (the installer prints this reminder).
What the notification contains (payload minimization)
Verified against the shipped command (scripts/setup-hooks.mjs:91-101): the
curl sends an empty POST body — there is no -d/--data flag at all. The
only information that leaves the host is:
- which topic was posted to (your private random channel), and
- the
Priorityheader (high= needs input,low= done).
No session id, no cwd, no command content, no tool names — strictly less
than even a "sessionId prefix + status word" payload. In the ntfy app both
signals show ntfy's default message text; you tell them apart by the priority
rendering (high-priority notifications are visually marked and can bypass
quiet delivery).
The token is referenced as Bearer $WEBTERM_NTFY_TOKEN
(scripts/setup-hooks.mjs:95) — a shell variable expanded at hook-fire time.
It is never written into settings.json or any command literal (SEC-C6;
regression-tested by test/setup-hooks.test.ts:410-421, re-run for this
verification: 49/49 passed).
What it does NOT cover: STUCK
stuck is a server-derived state: manager.sweepStuck
(src/session/manager.ts:268) infers it from output silence while a session
looks busy. No Claude Code hook event fires for it, so a hook-side bridge
physically cannot send a STUCK notification. This gap is closed in P1 by APNs
(T-iOS-20), which pushes from the server's own event bus.
Turning it off / P1 supersession
Once P1 APNs lands (T-iOS-20/21), this bridge is superseded and can be disabled. Any of:
- Re-run
npm run setup-hookswithout theWEBTERM_NTFY_*env vars — the reinstall pass strips previously installed ntfy groups (marker cleanup,scripts/setup-hooks.mjs:185-205; the ntfy command contains theWEBTERM_HOOK_URLmarker via its guard at:93, verified: reinstall without env → 0 ntfy entries remain). npm run setup-hooks -- --remove— removes all web-terminal hooks.
End-to-end phone check — DEFERRED(需真机/用户操作)
Not runnable in this environment (requires the user's phone and mutating the user's live Claude Code hook config). Exact manual steps:
- iPhone: install ntfy, subscribe to
<your-random-topic>onhttps://ntfy.sh, allow notifications. - Mac:
export WEBTERM_NTFY_URL=https://ntfy.sh WEBTERM_NTFY_TOPIC=<topic>, runnpm run setup-hooks, confirm the log lineInstalled ntfy bridge (NEEDS-INPUT=high, DONE=low), thennpm startfrom the same shell. - Open the web terminal, start a session, run
claude, and give it a task that triggers a permission gate (e.g. a Bash command that is not pre-allowed). - When the gate is held (tab badge shows waiting-for-approval), the iPhone should receive a high-priority ntfy notification within seconds.
- Approve and let the task finish — a low-priority notification arrives
on
Stop/SessionEnd.