@castlekit/castle 0.0.1 → 0.1.1

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 (63) hide show
  1. package/README.md +38 -1
  2. package/bin/castle.js +94 -0
  3. package/install.sh +729 -0
  4. package/next.config.ts +7 -0
  5. package/package.json +52 -5
  6. package/postcss.config.mjs +7 -0
  7. package/src/app/api/avatars/[id]/route.ts +75 -0
  8. package/src/app/api/openclaw/agents/route.ts +107 -0
  9. package/src/app/api/openclaw/config/route.ts +94 -0
  10. package/src/app/api/openclaw/events/route.ts +96 -0
  11. package/src/app/api/openclaw/logs/route.ts +59 -0
  12. package/src/app/api/openclaw/ping/route.ts +68 -0
  13. package/src/app/api/openclaw/restart/route.ts +65 -0
  14. package/src/app/api/openclaw/sessions/route.ts +62 -0
  15. package/src/app/globals.css +286 -0
  16. package/src/app/icon.png +0 -0
  17. package/src/app/layout.tsx +42 -0
  18. package/src/app/page.tsx +269 -0
  19. package/src/app/ui-kit/page.tsx +684 -0
  20. package/src/cli/onboarding.ts +576 -0
  21. package/src/components/dashboard/agent-status.tsx +107 -0
  22. package/src/components/dashboard/glass-card.tsx +28 -0
  23. package/src/components/dashboard/goal-widget.tsx +174 -0
  24. package/src/components/dashboard/greeting-widget.tsx +78 -0
  25. package/src/components/dashboard/index.ts +7 -0
  26. package/src/components/dashboard/stat-widget.tsx +61 -0
  27. package/src/components/dashboard/stock-widget.tsx +164 -0
  28. package/src/components/dashboard/weather-widget.tsx +68 -0
  29. package/src/components/icons/castle-icon.tsx +21 -0
  30. package/src/components/kanban/index.ts +3 -0
  31. package/src/components/kanban/kanban-board.tsx +391 -0
  32. package/src/components/kanban/kanban-card.tsx +137 -0
  33. package/src/components/kanban/kanban-column.tsx +98 -0
  34. package/src/components/layout/index.ts +4 -0
  35. package/src/components/layout/page-header.tsx +20 -0
  36. package/src/components/layout/sidebar.tsx +128 -0
  37. package/src/components/layout/theme-toggle.tsx +59 -0
  38. package/src/components/layout/user-menu.tsx +72 -0
  39. package/src/components/ui/alert.tsx +72 -0
  40. package/src/components/ui/avatar.tsx +87 -0
  41. package/src/components/ui/badge.tsx +39 -0
  42. package/src/components/ui/button.tsx +43 -0
  43. package/src/components/ui/card.tsx +107 -0
  44. package/src/components/ui/checkbox.tsx +56 -0
  45. package/src/components/ui/clock.tsx +171 -0
  46. package/src/components/ui/dialog.tsx +105 -0
  47. package/src/components/ui/index.ts +34 -0
  48. package/src/components/ui/input.tsx +112 -0
  49. package/src/components/ui/option-card.tsx +151 -0
  50. package/src/components/ui/progress.tsx +103 -0
  51. package/src/components/ui/radio.tsx +109 -0
  52. package/src/components/ui/select.tsx +46 -0
  53. package/src/components/ui/slider.tsx +62 -0
  54. package/src/components/ui/tabs.tsx +132 -0
  55. package/src/components/ui/toggle-group.tsx +85 -0
  56. package/src/components/ui/toggle.tsx +78 -0
  57. package/src/components/ui/tooltip.tsx +145 -0
  58. package/src/components/ui/uptime.tsx +106 -0
  59. package/src/lib/config.ts +195 -0
  60. package/src/lib/gateway-connection.ts +391 -0
  61. package/src/lib/hooks/use-openclaw.ts +163 -0
  62. package/src/lib/utils.ts +6 -0
  63. package/tsconfig.json +34 -0
package/README.md CHANGED
@@ -1 +1,38 @@
1
- # CastleKit
1
+ # Castle
2
+
3
+ The extensible interface for [OpenClaw](https://openclaw.ai) AI agents.
4
+
5
+ Castle is a local-first, open-source UI that gives you chat, agent management, and a dashboard for your OpenClaw agents. Everything runs on your machine — no cloud services, no data leakage.
6
+
7
+ ## Quick Install
8
+
9
+ ```bash
10
+ curl -fsSL https://castlekit.com/install.sh | bash
11
+ ```
12
+
13
+ ## Manual Install
14
+
15
+ ```bash
16
+ npm install -g @castlekit/castle
17
+ castle setup
18
+ ```
19
+
20
+ ## Development
21
+
22
+ ```bash
23
+ git clone https://github.com/castlekit/castle.git
24
+ cd castle
25
+ npm install
26
+ npm run dev
27
+ ```
28
+
29
+ Then open [http://localhost:3333](http://localhost:3333).
30
+
31
+ ## Requirements
32
+
33
+ - Node.js >= 22
34
+ - [OpenClaw](https://openclaw.ai) (installed automatically if missing)
35
+
36
+ ## License
37
+
38
+ MIT
package/bin/castle.js ADDED
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env -S node --import tsx
2
+
3
+ // Castle CLI - The multi-agent workspace
4
+ // https://castlekit.com
5
+
6
+ import { program } from "commander";
7
+ import pc from "picocolors";
8
+ import { readFileSync } from "fs";
9
+ import { resolve, dirname } from "path";
10
+ import { fileURLToPath } from "url";
11
+
12
+ const __dirname = dirname(fileURLToPath(import.meta.url));
13
+ let version = "0.0.0";
14
+ try {
15
+ version = JSON.parse(readFileSync(resolve(__dirname, "..", "package.json"), "utf-8")).version;
16
+ } catch { /* fallback */ }
17
+
18
+ program
19
+ .name("castle")
20
+ .description("The multi-agent workspace")
21
+ .version(version);
22
+
23
+ program
24
+ .command("setup")
25
+ .description("Run the Castle setup wizard")
26
+ .action(async () => {
27
+ const { runOnboarding } = await import("../src/cli/onboarding.ts");
28
+ await runOnboarding();
29
+ });
30
+
31
+ program
32
+ .command("open")
33
+ .description("Open Castle in the browser")
34
+ .action(async () => {
35
+ const { readConfig, configExists } = await import("../src/lib/config.ts");
36
+ const open = (await import("open")).default;
37
+ const port = configExists() ? readConfig().server?.port || 3333 : 3333;
38
+ const url = `http://localhost:${port}`;
39
+ console.log(pc.bold("\n 🏰 Castle\n"));
40
+ console.log(` Opening ${pc.cyan(url)}...\n`);
41
+ await open(url);
42
+ });
43
+
44
+ program
45
+ .command("status")
46
+ .description("Show Castle and agent status")
47
+ .action(async () => {
48
+ const { readConfig, configExists, isOpenClawInstalled } = await import(
49
+ "../src/lib/config.ts"
50
+ );
51
+
52
+ console.log(pc.bold("\n 🏰 Castle Status\n"));
53
+
54
+ if (!configExists()) {
55
+ console.log(pc.yellow(" Castle is not configured yet."));
56
+ console.log(` Run ${pc.cyan("castle setup")} to get started.\n`);
57
+ return;
58
+ }
59
+
60
+ const config = readConfig();
61
+ console.log(
62
+ ` OpenClaw: ${
63
+ isOpenClawInstalled() ? pc.green("Installed") : pc.red("Not found")
64
+ }`
65
+ );
66
+ console.log(` Gateway: ${pc.dim(`ws://127.0.0.1:${config.openclaw.gateway_port}`)}`);
67
+ console.log(
68
+ ` Primary: ${pc.cyan(config.openclaw.primary_agent || "not set")}`
69
+ );
70
+ console.log(` Web UI: ${pc.cyan(`http://localhost:${config.server.port}`)}`);
71
+ console.log();
72
+ });
73
+
74
+ // Default action (no subcommand) — trigger setup if first run, otherwise show help
75
+ if (process.argv.length <= 2) {
76
+ (async () => {
77
+ const { configExists } = await import("../src/lib/config.ts");
78
+
79
+ if (!configExists()) {
80
+ // First run — trigger onboarding
81
+ const { runOnboarding } = await import("../src/cli/onboarding.ts");
82
+ await runOnboarding();
83
+ } else {
84
+ console.log(pc.bold("\n 🏰 Castle\n"));
85
+ console.log(pc.dim(" The multi-agent workspace.\n"));
86
+ console.log(` ${pc.cyan("castle open")} Open the web UI`);
87
+ console.log(` ${pc.cyan("castle setup")} Re-run setup wizard`);
88
+ console.log(` ${pc.cyan("castle status")} Show status`);
89
+ console.log(` ${pc.cyan("castle --help")} All commands\n`);
90
+ }
91
+ })();
92
+ } else {
93
+ program.parse();
94
+ }