@chrysb/alphaclaw 0.5.5 → 0.5.7-beta.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 (86) hide show
  1. package/bin/alphaclaw.js +6 -1
  2. package/lib/public/css/agents.css +92 -0
  3. package/lib/public/css/explorer.css +101 -0
  4. package/lib/public/css/shell.css +15 -4
  5. package/lib/public/js/app.js +69 -3
  6. package/lib/public/js/components/action-button.js +5 -0
  7. package/lib/public/js/components/agents-tab/agent-bindings-section/helpers.js +76 -0
  8. package/lib/public/js/components/agents-tab/agent-bindings-section/index.js +490 -0
  9. package/lib/public/js/components/agents-tab/agent-bindings-section/use-agent-bindings.js +256 -0
  10. package/lib/public/js/components/agents-tab/agent-detail-panel.js +74 -0
  11. package/lib/public/js/components/agents-tab/agent-identity-section.js +175 -0
  12. package/lib/public/js/components/agents-tab/agent-overview/index.js +53 -0
  13. package/lib/public/js/components/agents-tab/agent-overview/manage-card.js +44 -0
  14. package/lib/public/js/components/agents-tab/agent-overview/model-card.js +158 -0
  15. package/lib/public/js/components/agents-tab/agent-overview/use-model-card.js +169 -0
  16. package/lib/public/js/components/agents-tab/agent-overview/use-workspace-card.js +45 -0
  17. package/lib/public/js/components/agents-tab/agent-overview/workspace-card.js +47 -0
  18. package/lib/public/js/components/agents-tab/agent-pairing-section.js +265 -0
  19. package/lib/public/js/components/agents-tab/create-agent-modal.js +189 -0
  20. package/lib/public/js/components/agents-tab/create-channel-modal.js +323 -0
  21. package/lib/public/js/components/agents-tab/delete-agent-dialog.js +50 -0
  22. package/lib/public/js/components/agents-tab/edit-agent-modal.js +109 -0
  23. package/lib/public/js/components/agents-tab/index.js +148 -0
  24. package/lib/public/js/components/agents-tab/use-agents.js +89 -0
  25. package/lib/public/js/components/channel-account-status-badge.js +35 -0
  26. package/lib/public/js/components/channel-operations-panel.js +33 -0
  27. package/lib/public/js/components/channels.js +545 -60
  28. package/lib/public/js/components/envars.js +25 -4
  29. package/lib/public/js/components/general/index.js +21 -11
  30. package/lib/public/js/components/general/use-general-tab.js +78 -16
  31. package/lib/public/js/components/google/gmail-setup-wizard.js +1 -3
  32. package/lib/public/js/components/google/index.js +28 -30
  33. package/lib/public/js/components/icons.js +37 -0
  34. package/lib/public/js/components/models-tab/index.js +58 -224
  35. package/lib/public/js/components/models-tab/model-picker.js +212 -0
  36. package/lib/public/js/components/models-tab/use-models.js +17 -14
  37. package/lib/public/js/components/onboarding/use-welcome-pairing.js +4 -4
  38. package/lib/public/js/components/onboarding/welcome-pairing-step.js +2 -2
  39. package/lib/public/js/components/overflow-menu.js +122 -0
  40. package/lib/public/js/components/pairings.js +36 -8
  41. package/lib/public/js/components/routes/agents-route.js +27 -0
  42. package/lib/public/js/components/routes/general-route.js +2 -0
  43. package/lib/public/js/components/routes/index.js +1 -0
  44. package/lib/public/js/components/routes/telegram-route.js +2 -2
  45. package/lib/public/js/components/secret-input.js +8 -1
  46. package/lib/public/js/components/sidebar.js +65 -39
  47. package/lib/public/js/components/telegram-workspace/index.js +175 -74
  48. package/lib/public/js/components/telegram-workspace/manage.js +83 -10
  49. package/lib/public/js/components/telegram-workspace/onboarding.js +9 -8
  50. package/lib/public/js/components/webhooks.js +43 -18
  51. package/lib/public/js/hooks/use-app-shell-controller.js +7 -0
  52. package/lib/public/js/hooks/use-browse-navigation.js +8 -5
  53. package/lib/public/js/hooks/use-destination-session-selection.js +8 -1
  54. package/lib/public/js/lib/api.js +163 -9
  55. package/lib/public/js/lib/app-navigation.js +2 -1
  56. package/lib/public/js/lib/channel-create-operation.js +102 -0
  57. package/lib/public/js/lib/format.js +14 -0
  58. package/lib/public/js/lib/sse.js +51 -0
  59. package/lib/public/js/lib/telegram-api.js +38 -18
  60. package/lib/public/setup.html +1 -0
  61. package/lib/public/shared/browse-file-policies.json +0 -1
  62. package/lib/server/agents/service.js +1478 -0
  63. package/lib/server/constants.js +2 -2
  64. package/lib/server/env.js +3 -1
  65. package/lib/server/gateway.js +104 -20
  66. package/lib/server/gmail-serve.js +2 -12
  67. package/lib/server/gmail-watch.js +29 -2
  68. package/lib/server/onboarding/import/import-applier.js +0 -1
  69. package/lib/server/onboarding/index.js +0 -6
  70. package/lib/server/onboarding/workspace.js +74 -38
  71. package/lib/server/openclaw-config.js +23 -0
  72. package/lib/server/operation-events.js +141 -0
  73. package/lib/server/routes/agents.js +266 -0
  74. package/lib/server/routes/pairings.js +135 -25
  75. package/lib/server/routes/system.js +90 -10
  76. package/lib/server/routes/telegram.js +247 -51
  77. package/lib/server/startup.js +23 -0
  78. package/lib/server/telegram-workspace.js +61 -10
  79. package/lib/server/topic-registry.js +66 -7
  80. package/lib/server/watchdog.js +151 -27
  81. package/lib/server/webhooks.js +60 -12
  82. package/lib/server.js +40 -27
  83. package/lib/setup/core-prompts/AGENTS.md +6 -5
  84. package/lib/setup/core-prompts/TOOLS.md +1 -8
  85. package/package.json +1 -1
  86. package/lib/setup/skills/control-ui/SKILL.md +0 -62
package/lib/server.js CHANGED
@@ -72,6 +72,7 @@ const {
72
72
  isGatewayRunning,
73
73
  startGateway,
74
74
  restartGateway: restartGatewayWithReload,
75
+ restartGatewayLight: restartGatewayLightWithReload,
75
76
  attachGatewaySignalHandlers,
76
77
  ensureGatewayProxyConfig,
77
78
  syncChannelConfig,
@@ -90,7 +91,7 @@ const {
90
91
  } = require("./server/restart-required-state");
91
92
  const {
92
93
  ensureOpenclawRuntimeArtifacts,
93
- installControlUiSkill,
94
+ resolveSetupUiUrl,
94
95
  syncBootstrapPromptFiles,
95
96
  } = require("./server/onboarding/workspace");
96
97
  const {
@@ -105,6 +106,9 @@ const { createDiscordApi } = require("./server/discord-api");
105
106
  const { createWatchdogNotifier } = require("./server/watchdog-notify");
106
107
  const { createWatchdog } = require("./server/watchdog");
107
108
  const { createDoctorService } = require("./server/doctor/service");
109
+ const { createAgentsService } = require("./server/agents/service");
110
+ const { createOperationEventsService } = require("./server/operation-events");
111
+ const { runOnboardedBootSequence } = require("./server/startup");
108
112
 
109
113
  const { registerAuthRoutes } = require("./server/routes/auth");
110
114
  const { registerPageRoutes } = require("./server/routes/pages");
@@ -122,6 +126,7 @@ const { registerWatchdogRoutes } = require("./server/routes/watchdog");
122
126
  const { registerUsageRoutes } = require("./server/routes/usage");
123
127
  const { registerGmailRoutes } = require("./server/routes/gmail");
124
128
  const { registerDoctorRoutes } = require("./server/routes/doctor");
129
+ const { registerAgentRoutes } = require("./server/routes/agents");
125
130
 
126
131
  const { PORT, kTrustProxyHops, SETUP_API_PREFIXES } = constants;
127
132
 
@@ -152,22 +157,24 @@ proxy.on("error", (err, req, res) => {
152
157
  });
153
158
 
154
159
  const authProfiles = createAuthProfiles();
155
- const loginThrottle = { ...createLoginThrottle(), getClientKey };
156
160
  const { shellCmd, clawCmd, gogCmd } = createCommands({ gatewayEnv });
157
- const resolveSetupUrl = () => {
158
- const explicit =
161
+ const agentsService = createAgentsService({
162
+ fs,
163
+ OPENCLAW_DIR: constants.OPENCLAW_DIR,
164
+ readEnvFile,
165
+ writeEnvFile,
166
+ reloadEnv,
167
+ restartGateway: () => restartGatewayWithReload(reloadEnv),
168
+ clawCmd,
169
+ });
170
+ const loginThrottle = { ...createLoginThrottle(), getClientKey };
171
+ const resolveSetupUrl = () =>
172
+ resolveSetupUiUrl(
159
173
  process.env.ALPHACLAW_SETUP_URL ||
160
- process.env.ALPHACLAW_BASE_URL ||
161
- process.env.RENDER_EXTERNAL_URL ||
162
- process.env.URL;
163
- if (explicit) return String(explicit).trim();
164
- if (process.env.RAILWAY_STATIC_URL) {
165
- const domain = String(process.env.RAILWAY_STATIC_URL).trim();
166
- if (!domain) return "";
167
- return domain.startsWith("http") ? domain : `https://${domain}`;
168
- }
169
- return "";
170
- };
174
+ process.env.ALPHACLAW_BASE_URL ||
175
+ process.env.RENDER_EXTERNAL_URL ||
176
+ process.env.URL,
177
+ );
171
178
  const restartGateway = () => restartGatewayWithReload(reloadEnv);
172
179
  const openclawVersionService = createOpenclawVersionService({
173
180
  gatewayEnv,
@@ -176,6 +183,7 @@ const openclawVersionService = createOpenclawVersionService({
176
183
  });
177
184
  const alphaclawVersionService = createAlphaclawVersionService();
178
185
  const restartRequiredState = createRestartRequiredState({ isGatewayRunning });
186
+ const operationEvents = createOperationEventsService();
179
187
 
180
188
  const { requireAuth, isAuthorizedRequest } = registerAuthRoutes({
181
189
  app,
@@ -333,11 +341,6 @@ const doSyncPromptFiles = () => {
333
341
  workspaceDir: constants.WORKSPACE_DIR,
334
342
  baseUrl: setupUiUrl,
335
343
  });
336
- installControlUiSkill({
337
- fs,
338
- openclawDir: constants.OPENCLAW_DIR,
339
- baseUrl: setupUiUrl,
340
- });
341
344
  installGogCliSkill({ fs, openclawDir: constants.OPENCLAW_DIR });
342
345
  };
343
346
  registerTelegramRoutes({
@@ -380,6 +383,12 @@ registerDoctorRoutes({
380
383
  requireAuth,
381
384
  doctorService,
382
385
  });
386
+ registerAgentRoutes({
387
+ app,
388
+ agentsService,
389
+ restartRequiredState,
390
+ operationEvents,
391
+ });
383
392
  registerProxyRoutes({
384
393
  app,
385
394
  proxy,
@@ -415,13 +424,17 @@ server.on("upgrade", (req, socket, head) => {
415
424
  server.listen(PORT, "0.0.0.0", () => {
416
425
  console.log(`[alphaclaw] Express listening on :${PORT}`);
417
426
  if (isOnboarded()) {
418
- doSyncPromptFiles();
419
- reloadEnv();
420
- syncChannelConfig(readEnvFile());
421
- ensureGatewayProxyConfig(null);
422
- startGateway();
423
- watchdog.start();
424
- gmailWatchService.start();
427
+ runOnboardedBootSequence({
428
+ doSyncPromptFiles,
429
+ reloadEnv,
430
+ syncChannelConfig,
431
+ readEnvFile,
432
+ ensureGatewayProxyConfig,
433
+ resolveSetupUrl,
434
+ startGateway,
435
+ watchdog,
436
+ gmailWatchService,
437
+ });
425
438
  } else {
426
439
  console.log("[alphaclaw] Awaiting onboarding via Setup UI");
427
440
  }
@@ -21,14 +21,15 @@ Before diving into implementation, share your plan when the work is **significan
21
21
 
22
22
  If any of these apply, outline your approach first — what you intend to do, in what order, and any trade-offs you see — then **wait for the user's sign-off** before proceeding. For straightforward, low-risk tasks, just get it done.
23
23
 
24
- ### Show Your Work (IMPORTANT)
24
+ ### Save and Show Your Work (IMPORTANT)
25
25
 
26
- Mandatory: Anytime you add, edit, or remove files/resources, end your message with a **Changes committed** summary.
26
+ Your `.openclaw` directory is version-controlled and this is how work survives container restarts.
27
27
 
28
- Use workspace-relative paths only for local files (no absolute paths). Include all internal resources (files, config, cron jobs, skills) and external resources (third-party pages, databases, integrations) that were created, modified, or removed.
28
+ Anytime you add, edit, or remove workspace files, openclaw.json, cron.json, skills, or external resources (third-party pages, databases, integrations), **commit and push your changes to git**. Never force push; always pull first if there might be remote changes.
29
+
30
+ Whenever you do this, end your message with a **Changes committed** summary. Use workspace-relative paths for local files.
29
31
 
30
32
  ```
31
- Changes committed ([abc1234](commit url)): <-- linked commit hash
33
+ Changes committed ([abc1234](commit url)): <-- linked abbreviated hash, no backticks
32
34
  • path/or/resource (new|edit|delete) — brief description
33
35
  ```
34
-
@@ -23,14 +23,7 @@ Changes to env vars are made through the **Envars** tab (`{{SETUP_UI_URL}}#envar
23
23
 
24
24
  ### Google Workspace
25
25
 
26
- Google Workspace is connected via the **General** tab (`{{SETUP_UI_URL}}#general`). The user provides OAuth client credentials from Google Cloud Console, then authorizes access to the services they need (Gmail, Calendar, Drive, Sheets, Docs, Tasks, Contacts, Meet).
27
-
28
- ## Git Discipline
29
-
30
- **Commit and push after every set of changes.** Your entire .openclaw directory (config, cron, workspace) is version controlled. This is how your work survives container restarts.
31
-
32
- Never force push. Always pull before pushing if there might be remote changes.
33
- After pushing, include a link to the commit using the abbreviated hash: [abc1234](https://github.com/owner/repo/commit/abc1234) format. No backticks.
26
+ Google Workspace is connected via the **General** tab (`{{SETUP_UI_URL}}#general`). The user provides OAuth client credentials from Google Cloud Console, then authorizes access to the services they need (Gmail, Calendar, Drive, Sheets, Docs, Tasks, Contacts, Meet). Connected accounts and `gog` CLI usage are covered by the gog-cli skill.
34
27
 
35
28
  ## Telegram Formatting
36
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrysb/alphaclaw",
3
- "version": "0.5.5",
3
+ "version": "0.5.7-beta.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,62 +0,0 @@
1
- ---
2
- name: alphaclaw
3
- description: Know when and how to direct the user to the AlphaClaw UI for configuration tasks.
4
- ---
5
-
6
- # AlphaClaw UI
7
-
8
- There is a web-based Setup UI at `{{BASE_URL}}`. The **user** manages runtime configuration through it. You should NOT call these API endpoints yourself or write config files directly — instead, tell the user what they need to do and where to do it.
9
-
10
- ## When to direct the user to the UI
11
-
12
- ### Adding or changing environment variables
13
-
14
- When the user needs to add a new API key, token, or any env var:
15
-
16
- > You can add that in your Setup UI → **Envars** tab: {{BASE_URL}}#envars
17
-
18
- ### Connecting a new channel (Telegram, Discord)
19
-
20
- > Add your bot token in the Setup UI → **Envars** tab ({{BASE_URL}}#envars), then approve the pairing request in the **General** tab ({{BASE_URL}}#general).
21
-
22
- ### Approving or rejecting pairings
23
-
24
- When a user asks about pairing their Telegram or Discord account:
25
-
26
- > Open the Setup UI → **General** tab ({{BASE_URL}}#general). Pending pairing requests appear automatically — click **Approve** or **Reject**.
27
-
28
- ### Connecting OpenAI Codex OAuth
29
-
30
- > Connect or reconnect Codex OAuth from the Setup UI → **Providers** tab ({{BASE_URL}}#providers). Click **Connect Codex OAuth** and follow the popup flow.
31
-
32
- ### Connecting Google Workspace
33
-
34
- > Set up Google Workspace from the Setup UI → **General** tab ({{BASE_URL}}#general, Google section). You'll need your OAuth client credentials from Google Cloud Console.
35
-
36
- Supported Google services (user selects which to enable during OAuth):
37
-
38
- | Service | Read | Write | Google API |
39
- | -------- | --------------- | ---------------- | ------------------------------ |
40
- | Gmail | `gmail:read` | `gmail:write` | `gmail.googleapis.com` |
41
- | Calendar | `calendar:read` | `calendar:write` | `calendar-json.googleapis.com` |
42
- | Drive | `drive:read` | `drive:write` | `drive.googleapis.com` |
43
- | Sheets | `sheets:read` | `sheets:write` | `sheets.googleapis.com` |
44
- | Docs | `docs:read` | `docs:write` | `docs.googleapis.com` |
45
- | Tasks | `tasks:read` | `tasks:write` | `tasks.googleapis.com` |
46
- | Contacts | `contacts:read` | `contacts:write` | `people.googleapis.com` |
47
- | Meet | `meet:read` | `meet:write` | `meet.googleapis.com` |
48
-
49
- Default enabled: Gmail (read), Calendar (read+write), Drive (read), Sheets (read), Docs (read).
50
-
51
- The `gog` CLI is available to verify Google API access:
52
-
53
- ```bash
54
- gog auth list --plain
55
- gog gmail labels list --account user@gmail.com
56
- gog calendar calendars --account user@gmail.com
57
- gog drive ls --account user@gmail.com
58
- gog sheets metadata SPREADSHEET_ID --account user@gmail.com
59
- gog contacts list --account user@gmail.com
60
- ```
61
-
62
- Config lives at `/data/.openclaw/gogcli/`.