1.9 KiB
1.9 KiB
Web Chat (macOS menu bar)
The macOS Clawdis app embeds the pi-web-ui chat surface inside WKWebView, wired directly to your primary session (main unless inbound.reply.session.mainKey overrides it). No HTTP server is started; assets are bundled into the app and loaded from file://, so nothing is exposed on the network.
How it works
- UI bundle:
apps/macos/Sources/Clawdis/Resources/WebChat/containspi-web-uidist plus vendor deps and a tinypi-aistub. - Bridge: a
WKScriptMessageHandlernamedclawdispasses chat turns topnpm clawdis agent --to <sessionKey> --message ... --jsonand returns the first payload text. Everything stays in-process—no sockets, no local web server. - Session: always uses the primary key; history is hydrated from
~/.clawdis/sessions/<SessionId>.jsonlso turns from WhatsApp/Telegram show up here too.
Building/updating the bundle
- Ensure
../pi-monois present andpnpm installhas been run there. - Sync vendor files: copied from
../pi-mono/node_modulesintoapps/macos/Sources/Clawdis/Resources/WebChat/vendor(run via repo scripts when updating). - The mac app loads assets relative to the bundled folder with an import map; no external CDN or HTTP endpoints are used.
- Rebuild/restart the app with
./scripts/restart-mac.sh(required so the new resources land in the app bundle).
Limitations
- Text-only, single-turn response (no streaming yet; tools/attachments not plumbed).
- The embedded
pi-aiis a stub sufficient for UI wiring; provider selection is fixed to the primary Clawd session.
Troubleshooting
- Right-click → “Inspect Element” opens Web Inspector. Check the console for
boot:messages. - Blank view usually means import map or vendor assets are missing; confirm files exist under
Resources/WebChat/vendorand the import map points to relative paths. - Errors are rendered in-page in red if the boot script fails after parsing.