feat(clawdbot): add Clawdbot gateway integration - #481
Conversation
Add Clawdbot gateway integration allowing users to connect to their local or remote Clawdbot gateway and chat with AI sessions. Features: - Device identity with Ed25519 signing using @noble/ed25519 - WebSocket connection with protocol v3 (req/res/event frames) - Device pairing flow with approval via gateway dashboard - Gateway config persistence with auto-reconnect on app load - Sessions list with proper field mapping (GatewaySessionRow types) - New chat creates isolated sessions (not using main session) - Chat screen with streaming message support - Input styling matches main app AgentInput component New files: - sources/clawdbot/ - Core gateway integration module - sources/app/(app)/clawdbot/ - Clawdbot screens (index, connect, new, chat) - sources/components/ClawdbotViewWrapper.tsx - Tab wrapper component Also adds Clawdbot tab to main tab bar and all translations. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
|
If you rebase on main, I've fixed the libsodium-wrappers ESM imports by upgrading them to 0.8.2. No more patches I think. |
|
Awesome @bra1nDump ! Can't wait to try that :) Some small ideas/discussions from a first look: I noticed sources/clawdbot/deviceIdentity.ts uses @noble/ed25519 plus crypto.subtle.digest(...) for the device fingerprint. Given the app is already libsodium-first, would it make sense to implement the device identity + signing via libsodium as well? That would keep primitives consistent and avoid any WebCrypto/RN portability surprises. One possible direction (if it matches the gateway expectations):
Sketch: (If you’d rather store the 64-byte secretKey directly instead of the seed, that works too.) Token/password persistence (threat model?)clawdbotStorage.ts stores token/password in MMKV JSON. Is that acceptable for this feature’s threat model, or should we treat those like other secrets and put them in SecureStore (native) / a safer web mechanism? We have encrypt-at-rest patterns elsewhere that we could reuse if we want consistency (you can have a look at the SecretStore implementation in leeroy-wip where I added support for storing encrypted secrets). Streaming robustnessIn clawdbot/chat/[sessionKey].tsx, the UI processes only the latest event; if multiple deltas land between renders, intermediate chunks could get skipped. Might be worth processing all unhandled events since last index. Connect screen completenessconnect.tsx keeps password state and persists it, but I didn’t see a password input rendered — is that intentionally deferred, or should it be added/removed? Small hygiene / DX
|
Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
|
thank you for the feedback! this pr is entirely vibe coded and i doubt will get merged at all. this is more of a prototype to get something running. likely clawdbot (molt bot) will be simply a different agent type from the UX perspective even if the underlying sync is completely different |
Every Happy session (all tabs, all devices on one daemon) was pinned to the gateway's shared `agent:<id>:main` session because OpenClawBackend hardcoded `socket.getMainSessionKey()`. Result: a slow turn in tab 1 queued every other Happy session, transcripts merged across tabs, and each turn re-sent the combined history (prompt-cost inflation). Mirror the per-chat scoping that Telegram/Discord channels already do: construct `agent:<agentId>:happy:<sessionTag>` from the gateway main key and the unique sessionTag already generated per `runOpenClaw` spawn. The OpenClaw gateway accepts arbitrary suffixes via `toAgentStoreSessionKey` (see `dist/session-key-Cn2QoOyX.js:106-117`), so this is happy-cli only — no server, RPC, or encryption changes. Adds `HAPPY_OPENCLAW_SESSION_KEY` env override for users who want the legacy shared-session behavior or a custom key. Restores the per-chat isolation that the original Clawdbot prototype (slopus#481) had explicitly, and that was dropped during the OpenClaw rebrand (slopus#816). Fixes slopus#1185 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
Every Happy session (all tabs, all devices on one daemon) was pinned to the gateway's shared `agent:<id>:main` session because OpenClawBackend hardcoded `socket.getMainSessionKey()`. Result: a slow turn in tab 1 queued every other Happy session, transcripts merged across tabs, and each turn re-sent the combined history (prompt-cost inflation). Mirror the per-chat scoping that Telegram/Discord channels already do: construct `agent:<agentId>:happy:<sessionTag>` from the gateway main key and the unique sessionTag already generated per `runOpenClaw` spawn. The OpenClaw gateway accepts arbitrary suffixes via `toAgentStoreSessionKey` (see `dist/session-key-Cn2QoOyX.js:106-117`), so this is happy-cli only — no server, RPC, or encryption changes. Adds `HAPPY_OPENCLAW_SESSION_KEY` env override for users who want the legacy shared-session behavior or a custom key. Restores the per-chat isolation that the original Clawdbot prototype (slopus#481) had explicitly, and that was dropped during the OpenClaw rebrand (slopus#816). Fixes slopus#1185 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
Every Happy session (all tabs, all devices on one daemon) was pinned to the gateway's shared `agent:<id>:main` session because OpenClawBackend hardcoded `socket.getMainSessionKey()`. Result: a slow turn in tab 1 queued every other Happy session, transcripts merged across tabs, and each turn re-sent the combined history (prompt-cost inflation). Mirror the per-chat scoping that Telegram/Discord channels already do: construct `agent:<agentId>:happy:<sessionTag>` from the gateway main key and the unique sessionTag already generated per `runOpenClaw` spawn. The OpenClaw gateway accepts arbitrary suffixes via `toAgentStoreSessionKey` (see `dist/session-key-Cn2QoOyX.js:106-117`), so this is happy-cli only — no server, RPC, or encryption changes. Adds `HAPPY_OPENCLAW_SESSION_KEY` env override for users who want the legacy shared-session behavior or a custom key. Restores the per-chat isolation that the original Clawdbot prototype (slopus#481) had explicitly, and that was dropped during the OpenClaw rebrand (slopus#816). Fixes slopus#1185 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
Every Happy session (all tabs, all devices on one daemon) was pinned to the gateway's shared `agent:<id>:main` session because OpenClawBackend hardcoded `socket.getMainSessionKey()`. Result: a slow turn in tab 1 queued every other Happy session, transcripts merged across tabs, and each turn re-sent the combined history (prompt-cost inflation). Mirror the per-chat scoping that Telegram/Discord channels already do: construct `agent:<agentId>:happy:<sessionTag>` from the gateway main key and the unique sessionTag already generated per `runOpenClaw` spawn. The OpenClaw gateway accepts arbitrary suffixes via `toAgentStoreSessionKey` (see `dist/session-key-Cn2QoOyX.js:106-117`), so this is happy-cli only — no server, RPC, or encryption changes. Adds `HAPPY_OPENCLAW_SESSION_KEY` env override for users who want the legacy shared-session behavior or a custom key. Restores the per-chat isolation that the original Clawdbot prototype (slopus#481) had explicitly, and that was dropped during the OpenClaw rebrand (slopus#816). Fixes slopus#1185 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
Every Happy session (all tabs, all devices on one daemon) was pinned to the gateway's shared `agent:<id>:main` session because OpenClawBackend hardcoded `socket.getMainSessionKey()`. Result: a slow turn in tab 1 queued every other Happy session, transcripts merged across tabs, and each turn re-sent the combined history (prompt-cost inflation). Mirror the per-chat scoping that Telegram/Discord channels already do: construct `agent:<agentId>:happy:<sessionTag>` from the gateway main key and the unique sessionTag already generated per `runOpenClaw` spawn. The OpenClaw gateway accepts arbitrary suffixes via `toAgentStoreSessionKey` (see `dist/session-key-Cn2QoOyX.js:106-117`), so this is happy-cli only — no server, RPC, or encryption changes. Adds `HAPPY_OPENCLAW_SESSION_KEY` env override for users who want the legacy shared-session behavior or a custom key. Restores the per-chat isolation that the original Clawdbot prototype (slopus#481) had explicitly, and that was dropped during the OpenClaw rebrand (slopus#816). Fixes slopus#1185 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
Every Happy session (all tabs, all devices on one daemon) was pinned to the gateway's shared `agent:<id>:main` session because OpenClawBackend hardcoded `socket.getMainSessionKey()`. Result: a slow turn in tab 1 queued every other Happy session, transcripts merged across tabs, and each turn re-sent the combined history (prompt-cost inflation). Mirror the per-chat scoping that Telegram/Discord channels already do: construct `agent:<agentId>:happy:<sessionTag>` from the gateway main key and the unique sessionTag already generated per `runOpenClaw` spawn. The OpenClaw gateway accepts arbitrary suffixes via `toAgentStoreSessionKey` (see `dist/session-key-Cn2QoOyX.js:106-117`), so this is happy-cli only — no server, RPC, or encryption changes. Adds `HAPPY_OPENCLAW_SESSION_KEY` env override for users who want the legacy shared-session behavior or a custom key. Restores the per-chat isolation that the original Clawdbot prototype (slopus#481) had explicitly, and that was dropped during the OpenClaw rebrand (slopus#816). Fixes slopus#1185 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
Every Happy session (all tabs, all devices on one daemon) was pinned to the gateway's shared `agent:<id>:main` session because OpenClawBackend hardcoded `socket.getMainSessionKey()`. Result: a slow turn in tab 1 queued every other Happy session, transcripts merged across tabs, and each turn re-sent the combined history (prompt-cost inflation). Mirror the per-chat scoping that Telegram/Discord channels already do: construct `agent:<agentId>:happy:<sessionTag>` from the gateway main key and the unique sessionTag already generated per `runOpenClaw` spawn. The OpenClaw gateway accepts arbitrary suffixes via `toAgentStoreSessionKey` (see `dist/session-key-Cn2QoOyX.js:106-117`), so this is happy-cli only — no server, RPC, or encryption changes. Adds `HAPPY_OPENCLAW_SESSION_KEY` env override for users who want the legacy shared-session behavior or a custom key. Restores the per-chat isolation that the original Clawdbot prototype (slopus#481) had explicitly, and that was dropped during the OpenClaw rebrand (slopus#816). Fixes slopus#1185 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
Add Clawdbot gateway integration allowing users to connect to their local or remote Clawdbot gateway and chat with AI sessions.
Features:
New files:
Also adds Clawdbot tab to main tab bar and all translations.
Generated with Claude Code via Happy