clawport-ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/.env.example +35 -0
  2. package/BRANDING.md +131 -0
  3. package/CLAUDE.md +252 -0
  4. package/README.md +262 -0
  5. package/SETUP.md +337 -0
  6. package/app/agents/[id]/page.tsx +727 -0
  7. package/app/api/agents/route.ts +12 -0
  8. package/app/api/chat/[id]/route.ts +139 -0
  9. package/app/api/cron-runs/route.ts +13 -0
  10. package/app/api/crons/route.ts +12 -0
  11. package/app/api/kanban/chat/[id]/route.ts +119 -0
  12. package/app/api/kanban/chat-history/[ticketId]/route.ts +36 -0
  13. package/app/api/memory/route.ts +12 -0
  14. package/app/api/transcribe/route.ts +37 -0
  15. package/app/api/tts/route.ts +42 -0
  16. package/app/chat/[id]/page.tsx +10 -0
  17. package/app/chat/page.tsx +200 -0
  18. package/app/crons/page.tsx +870 -0
  19. package/app/docs/page.tsx +399 -0
  20. package/app/favicon.ico +0 -0
  21. package/app/globals.css +692 -0
  22. package/app/kanban/page.tsx +327 -0
  23. package/app/layout.tsx +45 -0
  24. package/app/memory/page.tsx +685 -0
  25. package/app/page.tsx +817 -0
  26. package/app/providers.tsx +37 -0
  27. package/app/settings/page.tsx +901 -0
  28. package/app/settings-provider.tsx +209 -0
  29. package/components/AgentAvatar.tsx +54 -0
  30. package/components/AgentNode.tsx +122 -0
  31. package/components/Breadcrumbs.tsx +126 -0
  32. package/components/DynamicFavicon.tsx +62 -0
  33. package/components/ErrorState.tsx +97 -0
  34. package/components/FeedView.tsx +494 -0
  35. package/components/GlobalSearch.tsx +571 -0
  36. package/components/GridView.tsx +532 -0
  37. package/components/ManorMap.tsx +157 -0
  38. package/components/MobileSidebar.tsx +251 -0
  39. package/components/NavLinks.tsx +271 -0
  40. package/components/OnboardingWizard.tsx +1067 -0
  41. package/components/Sidebar.tsx +115 -0
  42. package/components/ThemeToggle.tsx +108 -0
  43. package/components/chat/AgentList.tsx +537 -0
  44. package/components/chat/ConversationView.tsx +1047 -0
  45. package/components/chat/FileAttachment.tsx +140 -0
  46. package/components/chat/MediaPreview.tsx +111 -0
  47. package/components/chat/VoiceMessage.tsx +139 -0
  48. package/components/crons/PipelineGraph.tsx +327 -0
  49. package/components/crons/WeeklySchedule.tsx +630 -0
  50. package/components/docs/AgentsSection.tsx +209 -0
  51. package/components/docs/ApiReferenceSection.tsx +256 -0
  52. package/components/docs/ArchitectureSection.tsx +221 -0
  53. package/components/docs/ComponentsSection.tsx +253 -0
  54. package/components/docs/CronSystemSection.tsx +235 -0
  55. package/components/docs/DocSection.tsx +346 -0
  56. package/components/docs/GettingStartedSection.tsx +169 -0
  57. package/components/docs/ThemingSection.tsx +257 -0
  58. package/components/docs/TroubleshootingSection.tsx +200 -0
  59. package/components/kanban/AgentPicker.tsx +321 -0
  60. package/components/kanban/CreateTicketModal.tsx +333 -0
  61. package/components/kanban/KanbanBoard.tsx +70 -0
  62. package/components/kanban/KanbanColumn.tsx +166 -0
  63. package/components/kanban/TicketCard.tsx +245 -0
  64. package/components/kanban/TicketDetailPanel.tsx +850 -0
  65. package/components/ui/badge.tsx +48 -0
  66. package/components/ui/button.tsx +64 -0
  67. package/components/ui/card.tsx +92 -0
  68. package/components/ui/dialog.tsx +158 -0
  69. package/components/ui/scroll-area.tsx +58 -0
  70. package/components/ui/separator.tsx +28 -0
  71. package/components/ui/skeleton.tsx +27 -0
  72. package/components/ui/tabs.tsx +91 -0
  73. package/components/ui/tooltip.tsx +57 -0
  74. package/components.json +23 -0
  75. package/docs/API.md +648 -0
  76. package/docs/COMPONENTS.md +1059 -0
  77. package/docs/THEMING.md +795 -0
  78. package/lib/agents-registry.ts +35 -0
  79. package/lib/agents.json +282 -0
  80. package/lib/agents.test.ts +367 -0
  81. package/lib/agents.ts +32 -0
  82. package/lib/anthropic.test.ts +422 -0
  83. package/lib/anthropic.ts +220 -0
  84. package/lib/api-error.ts +16 -0
  85. package/lib/audio-recorder.test.ts +72 -0
  86. package/lib/audio-recorder.ts +169 -0
  87. package/lib/conversations.test.ts +331 -0
  88. package/lib/conversations.ts +117 -0
  89. package/lib/cron-pipelines.test.ts +69 -0
  90. package/lib/cron-pipelines.ts +58 -0
  91. package/lib/cron-runs.test.ts +118 -0
  92. package/lib/cron-runs.ts +67 -0
  93. package/lib/cron-utils.test.ts +222 -0
  94. package/lib/cron-utils.ts +160 -0
  95. package/lib/crons.test.ts +502 -0
  96. package/lib/crons.ts +114 -0
  97. package/lib/env.test.ts +44 -0
  98. package/lib/env.ts +14 -0
  99. package/lib/kanban/automation.test.ts +245 -0
  100. package/lib/kanban/automation.ts +143 -0
  101. package/lib/kanban/chat-store.test.ts +149 -0
  102. package/lib/kanban/chat-store.ts +81 -0
  103. package/lib/kanban/store.test.ts +238 -0
  104. package/lib/kanban/store.ts +98 -0
  105. package/lib/kanban/types.ts +50 -0
  106. package/lib/kanban/useAgentWork.ts +78 -0
  107. package/lib/memory.ts +45 -0
  108. package/lib/multimodal.test.ts +219 -0
  109. package/lib/multimodal.ts +68 -0
  110. package/lib/pipeline.integration.test.ts +343 -0
  111. package/lib/sanitize.ts +194 -0
  112. package/lib/settings.test.ts +137 -0
  113. package/lib/settings.ts +94 -0
  114. package/lib/styles.ts +24 -0
  115. package/lib/themes.ts +9 -0
  116. package/lib/transcribe.test.ts +141 -0
  117. package/lib/transcribe.ts +111 -0
  118. package/lib/types.ts +66 -0
  119. package/lib/utils.ts +6 -0
  120. package/lib/validation.test.ts +132 -0
  121. package/lib/validation.ts +80 -0
  122. package/next.config.ts +7 -0
  123. package/package.json +56 -0
  124. package/postcss.config.mjs +7 -0
  125. package/public/file.svg +1 -0
  126. package/public/globe.svg +1 -0
  127. package/public/next.svg +1 -0
  128. package/public/vercel.svg +1 -0
  129. package/public/window.svg +1 -0
  130. package/scripts/setup.mjs +215 -0
  131. package/tsconfig.json +34 -0
  132. package/vitest.config.ts +17 -0
package/SETUP.md ADDED
@@ -0,0 +1,337 @@
1
+ # ClawPort -- Setup Guide
2
+
3
+ This guide walks you through getting ClawPort running against your own OpenClaw instance. If you just want the quick version, see the [README](README.md).
4
+
5
+ ---
6
+
7
+ ## Prerequisites
8
+
9
+ 1. **Node.js 22+** -- [Download](https://nodejs.org). Verify with `node -v`.
10
+ 2. **OpenClaw** -- [Install OpenClaw](https://openclaw.ai) and make sure the CLI works: `openclaw --version`.
11
+ 3. **OpenClaw gateway running** -- ClawPort talks to the gateway at `localhost:18789`. Start it before launching the UI.
12
+
13
+ ---
14
+
15
+ ## 1. Install ClawPort
16
+
17
+ ```bash
18
+ git clone https://github.com/openclaw/clawport.git
19
+ cd clawport
20
+ npm install
21
+ ```
22
+
23
+ ---
24
+
25
+ ## 2. Configure Environment
26
+
27
+ The fastest way is the auto-setup script:
28
+
29
+ ```bash
30
+ npm run setup
31
+ ```
32
+
33
+ This auto-detects your `WORKSPACE_PATH`, `OPENCLAW_BIN`, and gateway token from your local OpenClaw installation, shows you what it found, and writes `.env.local` after you confirm.
34
+
35
+ If you prefer to configure manually, copy the template and edit:
36
+
37
+ ```bash
38
+ cp .env.example .env.local
39
+ ```
40
+
41
+ Open `.env.local` in your editor and set the three required variables.
42
+
43
+ ### WORKSPACE_PATH
44
+
45
+ The path to your OpenClaw workspace directory. This is where OpenClaw stores agent SOUL files, memory, and other data.
46
+
47
+ **Default location:** `~/.openclaw/workspace`
48
+
49
+ To verify:
50
+
51
+ ```bash
52
+ ls ~/.openclaw/workspace
53
+ ```
54
+
55
+ You should see files like `SOUL.md`, an `agents/` directory, and a `memory/` directory. Use the full absolute path in your `.env.local`:
56
+
57
+ ```env
58
+ WORKSPACE_PATH=/Users/yourname/.openclaw/workspace
59
+ ```
60
+
61
+ ### OPENCLAW_BIN
62
+
63
+ The absolute path to the `openclaw` CLI binary. ClawPort calls this binary for vision messages, cron listing, and other CLI operations.
64
+
65
+ To find it:
66
+
67
+ ```bash
68
+ which openclaw
69
+ ```
70
+
71
+ Use whatever that returns:
72
+
73
+ ```env
74
+ OPENCLAW_BIN=/usr/local/bin/openclaw
75
+ ```
76
+
77
+ If you installed via nvm or a version manager, the path might be something like `/Users/yourname/.nvm/versions/node/v22.14.0/bin/openclaw`. That's fine -- just use the full path.
78
+
79
+ ### OPENCLAW_GATEWAY_TOKEN
80
+
81
+ The token that authenticates all API calls to the OpenClaw gateway. Every request ClawPort makes (chat, vision, TTS, transcription) includes this token.
82
+
83
+ To find it:
84
+
85
+ ```bash
86
+ openclaw gateway status
87
+ ```
88
+
89
+ This should display your gateway configuration including the token. Copy it into your `.env.local`:
90
+
91
+ ```env
92
+ OPENCLAW_GATEWAY_TOKEN=your-token-here
93
+ ```
94
+
95
+ ### ELEVENLABS_API_KEY (optional)
96
+
97
+ If you want voice indicators on agent profiles, add your ElevenLabs API key. Get one at [elevenlabs.io](https://elevenlabs.io).
98
+
99
+ ```env
100
+ ELEVENLABS_API_KEY=sk_your-key-here
101
+ ```
102
+
103
+ If you skip this, everything works normally. Voice indicators just won't appear.
104
+
105
+ ---
106
+
107
+ ## 3. Start the Gateway
108
+
109
+ ClawPort expects the OpenClaw gateway to be running at `localhost:18789`. Start it in a separate terminal:
110
+
111
+ ```bash
112
+ openclaw gateway run
113
+ ```
114
+
115
+ Leave this running while you use ClawPort. If the gateway isn't running, chat and all AI features will fail with connection errors.
116
+
117
+ ---
118
+
119
+ ## 4. Run ClawPort
120
+
121
+ ```bash
122
+ npm run dev
123
+ ```
124
+
125
+ Open [http://localhost:3000](http://localhost:3000).
126
+
127
+ ### First-Run Onboarding
128
+
129
+ On your first visit, ClawPort launches the **onboarding wizard**. This walks you through:
130
+
131
+ - **Naming your portal** -- give your command centre a custom name and subtitle
132
+ - **Choosing a theme** -- pick from Dark, Glass, Color, Light, or System
133
+ - **Setting an accent color** -- personalize the UI highlight color
134
+ - **Customizing your logo** -- upload an icon or choose an emoji
135
+ - **Entering your name** -- so the UI knows who the operator is
136
+
137
+ All of these can be changed later in the Settings page. The wizard just gets you started quickly.
138
+
139
+ ---
140
+
141
+ ## 5. Agent Customization
142
+
143
+ ### Using the Bundled Registry
144
+
145
+ ClawPort ships with a default agent registry at `lib/agents.json`. This is a working example showing a full team hierarchy. It works out of the box if your OpenClaw workspace has matching agent SOUL files.
146
+
147
+ ### Using Your Own Agents
148
+
149
+ To define your own agent team, create a file at:
150
+
151
+ ```
152
+ $WORKSPACE_PATH/clawport/agents.json
153
+ ```
154
+
155
+ For example, if your `WORKSPACE_PATH` is `/Users/yourname/.openclaw/workspace`:
156
+
157
+ ```bash
158
+ mkdir -p /Users/yourname/.openclaw/workspace/clawport
159
+ ```
160
+
161
+ Then create `agents.json` in that directory. ClawPort checks for this file on every request. If it exists, it replaces the bundled registry entirely. If it's missing or contains invalid JSON, the bundled default is used as a fallback.
162
+
163
+ ### Agent Entry Format
164
+
165
+ Your `agents.json` should be an array of agent objects. Here's the minimal required shape:
166
+
167
+ ```json
168
+ [
169
+ {
170
+ "id": "my-agent",
171
+ "name": "My Agent",
172
+ "title": "What this agent does",
173
+ "reportsTo": null,
174
+ "directReports": [],
175
+ "soulPath": "agents/my-agent/SOUL.md",
176
+ "voiceId": null,
177
+ "color": "#06b6d4",
178
+ "emoji": "🤖",
179
+ "tools": ["read", "write"],
180
+ "memoryPath": null,
181
+ "description": "One-liner about this agent."
182
+ }
183
+ ]
184
+ ```
185
+
186
+ ### Field Reference
187
+
188
+ | Field | Type | Description |
189
+ |-------|------|-------------|
190
+ | `id` | string | Unique slug for the agent (e.g., `"vera"`) |
191
+ | `name` | string | Display name (e.g., `"VERA"`) |
192
+ | `title` | string | Role title (e.g., `"Chief Strategy Officer"`) |
193
+ | `reportsTo` | string or null | Parent agent `id` for the org chart. `null` for the root. |
194
+ | `directReports` | string[] | Array of child agent `id`s |
195
+ | `soulPath` | string or null | Path to the agent's SOUL.md, relative to `WORKSPACE_PATH` |
196
+ | `voiceId` | string or null | ElevenLabs voice ID (requires `ELEVENLABS_API_KEY`) |
197
+ | `color` | string | Hex color for the agent's node in the Org Map |
198
+ | `emoji` | string | Emoji shown as the agent's avatar |
199
+ | `tools` | string[] | List of tools this agent has access to |
200
+ | `memoryPath` | string or null | Path to agent-specific memory (relative to `WORKSPACE_PATH`) |
201
+ | `description` | string | One-line description shown in the UI |
202
+
203
+ ### Hierarchy Rules
204
+
205
+ - Exactly one agent should have `"reportsTo": null` -- this is your root/orchestrator node.
206
+ - `directReports` should be consistent with `reportsTo`. If agent B reports to agent A, then A's `directReports` should include B's `id`.
207
+ - The Org Map uses these relationships to build the org chart automatically.
208
+
209
+ ### Example: Minimal Two-Agent Setup
210
+
211
+ ```json
212
+ [
213
+ {
214
+ "id": "boss",
215
+ "name": "Boss",
216
+ "title": "Orchestrator",
217
+ "reportsTo": null,
218
+ "directReports": ["worker"],
219
+ "soulPath": "SOUL.md",
220
+ "voiceId": null,
221
+ "color": "#f5c518",
222
+ "emoji": "👑",
223
+ "tools": ["read", "write", "exec", "message"],
224
+ "memoryPath": null,
225
+ "description": "Top-level orchestrator."
226
+ },
227
+ {
228
+ "id": "worker",
229
+ "name": "Worker",
230
+ "title": "Task Runner",
231
+ "reportsTo": "boss",
232
+ "directReports": [],
233
+ "soulPath": "agents/worker/SOUL.md",
234
+ "voiceId": null,
235
+ "color": "#22c55e",
236
+ "emoji": "⚙️",
237
+ "tools": ["read", "write"],
238
+ "memoryPath": null,
239
+ "description": "Handles assigned tasks."
240
+ }
241
+ ]
242
+ ```
243
+
244
+ ---
245
+
246
+ ## 6. Production Build
247
+
248
+ ```bash
249
+ npx next build
250
+ npm start
251
+ ```
252
+
253
+ The production server runs on port 3000 by default. The gateway still needs to be running at `localhost:18789`.
254
+
255
+ ---
256
+
257
+ ## Troubleshooting
258
+
259
+ ### "Missing required environment variable: WORKSPACE_PATH"
260
+
261
+ Your `.env.local` is missing or the variable isn't set. Make sure you copied `.env.example`:
262
+
263
+ ```bash
264
+ cp .env.example .env.local
265
+ ```
266
+
267
+ Then fill in the values. Restart the dev server after changing `.env.local`.
268
+
269
+ ### Gateway connection refused / chat not working
270
+
271
+ The OpenClaw gateway isn't running. Start it:
272
+
273
+ ```bash
274
+ openclaw gateway run
275
+ ```
276
+
277
+ Verify it's reachable:
278
+
279
+ ```bash
280
+ curl http://localhost:18789/v1/models
281
+ ```
282
+
283
+ You should get a JSON response. If not, check that nothing else is using port 18789.
284
+
285
+ ### No agents showing up
286
+
287
+ 1. **Check `WORKSPACE_PATH`** -- make sure it points to a valid OpenClaw workspace directory.
288
+ 2. **Check your agents.json** -- if you placed a custom `agents.json` at `$WORKSPACE_PATH/clawport/agents.json`, make sure it's valid JSON. A syntax error will cause a silent fallback to the bundled registry. Test with:
289
+ ```bash
290
+ cat $WORKSPACE_PATH/clawport/agents.json | python3 -m json.tool
291
+ ```
292
+ 3. **Check the server console** -- ClawPort logs errors to the terminal where `npm run dev` is running.
293
+
294
+ ### Agent SOUL.md not loading
295
+
296
+ The `soulPath` in your agents.json is relative to `WORKSPACE_PATH`. If your workspace is at `/Users/you/.openclaw/workspace` and `soulPath` is `"agents/vera/SOUL.md"`, ClawPort will look for `/Users/you/.openclaw/workspace/agents/vera/SOUL.md`.
297
+
298
+ Make sure the file exists at that path.
299
+
300
+ ### Images not working in chat
301
+
302
+ Image messages use the CLI pipeline (`openclaw gateway call chat.send`). Common issues:
303
+
304
+ 1. **`OPENCLAW_BIN` path is wrong** -- run `which openclaw` and update `.env.local`.
305
+ 2. **Gateway token is wrong** -- verify with `openclaw gateway status`.
306
+ 3. **Image too large** -- ClawPort resizes to 1200px max, but extremely large images may still hit limits. Try a smaller image.
307
+
308
+ Check the server console for errors like `sendViaOpenClaw execFile error:` or `E2BIG`.
309
+
310
+ ### Voice/TTS features not working
311
+
312
+ Voice features require `ELEVENLABS_API_KEY` in your `.env.local`. Without it, voice indicators won't appear on agent profiles.
313
+
314
+ Audio transcription (speech-to-text) uses Whisper through the OpenClaw gateway and does not require a separate key.
315
+
316
+ ### Port 3000 already in use
317
+
318
+ Another process is using port 3000. Either stop it or run ClawPort on a different port:
319
+
320
+ ```bash
321
+ npm run dev -- -p 3001
322
+ ```
323
+
324
+ ---
325
+
326
+ ## Running Tests
327
+
328
+ ```bash
329
+ npm test # Run all tests via Vitest
330
+ npx tsc --noEmit # Type-check (expect 0 errors)
331
+ ```
332
+
333
+ ---
334
+
335
+ ## Developer Guide
336
+
337
+ For architecture deep-dives, test patterns, and contribution conventions, see [CLAUDE.md](CLAUDE.md).