volclaw 0.3.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 (80) hide show
  1. package/CONTRIBUTING.md +105 -0
  2. package/LICENSE +21 -0
  3. package/README.aiclaw.md +22 -0
  4. package/README.aliclaw.md +22 -0
  5. package/README.autoopenclaw.md +22 -0
  6. package/README.claw-open.md +22 -0
  7. package/README.clawjs.md +22 -0
  8. package/README.fastclaw.md +22 -0
  9. package/README.md +22 -0
  10. package/README.md.bak +242 -0
  11. package/README.megaclaw.md +22 -0
  12. package/README.open-claw.md +22 -0
  13. package/README.openclaw-cli.md +239 -0
  14. package/README.openclaw-daemon.md +239 -0
  15. package/README.openclaw-gateway.md +239 -0
  16. package/README.openclaw-health.md +239 -0
  17. package/README.openclaw-helper.md +239 -0
  18. package/README.openclaw-install.md +239 -0
  19. package/README.openclaw-manage.md +239 -0
  20. package/README.openclaw-monitor.md +239 -0
  21. package/README.openclaw-run.md +239 -0
  22. package/README.openclaw-service.md +239 -0
  23. package/README.openclaw-setup.md +239 -0
  24. package/README.openclaw-start.md +239 -0
  25. package/README.openclaw-tools.md +239 -0
  26. package/README.openclaw-upgrade.md +13 -0
  27. package/README.openclaw-utils.md +239 -0
  28. package/README.openclaw-watch.md +239 -0
  29. package/README.qclaw-cli.md +22 -0
  30. package/README.qclaw.md +22 -0
  31. package/README.smartclaw.md +22 -0
  32. package/README.volclaw.md +22 -0
  33. package/README.zh-CN.md +213 -0
  34. package/app-dist/main.js +300 -0
  35. package/app-dist/package.json +3 -0
  36. package/app-dist/server-process.js +95 -0
  37. package/assets/demo.gif +0 -0
  38. package/assets/welcome.png +0 -0
  39. package/demo.tape +28 -0
  40. package/dist/chunk-LIZ6XXW3.js +1149 -0
  41. package/dist/index.d.ts +2 -0
  42. package/dist/index.js +582 -0
  43. package/dist/server-ZYSNFLSO.js +7 -0
  44. package/homebrew/README.md +37 -0
  45. package/homebrew/openclaw-cli.rb +22 -0
  46. package/homebrew/openclaw-doctor.rb +26 -0
  47. package/package.aiclaw.json +25 -0
  48. package/package.aliclaw.json +25 -0
  49. package/package.autoopenclaw.json +25 -0
  50. package/package.claw-open.json +25 -0
  51. package/package.clawjs.json +25 -0
  52. package/package.fastclaw.json +25 -0
  53. package/package.json +25 -0
  54. package/package.json.bak +51 -0
  55. package/package.megaclaw.json +25 -0
  56. package/package.open-claw.json +25 -0
  57. package/package.openclaw-cli.json +51 -0
  58. package/package.openclaw-daemon.json +51 -0
  59. package/package.openclaw-gateway.json +51 -0
  60. package/package.openclaw-health.json +51 -0
  61. package/package.openclaw-helper.json +51 -0
  62. package/package.openclaw-install.json +51 -0
  63. package/package.openclaw-manage.json +51 -0
  64. package/package.openclaw-monitor.json +51 -0
  65. package/package.openclaw-run.json +51 -0
  66. package/package.openclaw-service.json +51 -0
  67. package/package.openclaw-setup.json +51 -0
  68. package/package.openclaw-start.json +51 -0
  69. package/package.openclaw-tools.json +51 -0
  70. package/package.openclaw-upgrade.json +50 -0
  71. package/package.openclaw-utils.json +51 -0
  72. package/package.openclaw-watch.json +51 -0
  73. package/package.qclaw-cli.json +25 -0
  74. package/package.qclaw.json +25 -0
  75. package/package.smartclaw.json +25 -0
  76. package/package.volclaw.json +25 -0
  77. package/scripts/post-app-compile.cjs +3 -0
  78. package/scripts/post-app-compile.js +7 -0
  79. package/scripts/publish.sh +120 -0
  80. package/scripts/publish.sh.bak +63 -0
@@ -0,0 +1,300 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const electron_1 = require("electron");
37
+ const path = __importStar(require("node:path"));
38
+ const http = __importStar(require("node:http"));
39
+ // ── Constants ──────────────────────────────────────────────────────────────
40
+ const DASHBOARD_PORT = 9090;
41
+ const DASHBOARD_URL = `http://localhost:${DASHBOARD_PORT}`;
42
+ const HEALTH_INTERVAL_MS = 30000;
43
+ // In dev: __dirname = app-dist/, script is app-dist/server-process.js
44
+ // In packaged: __dirname = .../app.asar/app-dist/, script is same
45
+ const SERVER_SCRIPT = path.join(__dirname, "server-process.js");
46
+ // Icon paths (relative to app bundle Resources or dev project root)
47
+ const ICON_PATH = path.join(electron_1.app.isPackaged
48
+ ? path.join(process.resourcesPath, "assets/icon.iconset/icon_16x16@2x.png")
49
+ : path.join(__dirname, "../assets/icon.iconset/icon_16x16@2x.png"));
50
+ // ── State ──────────────────────────────────────────────────────────────────
51
+ let tray = null;
52
+ let mainWindow = null;
53
+ let serverProc = null;
54
+ let isHealthy = true;
55
+ // ── Server lifecycle ───────────────────────────────────────────────────────
56
+ /** Check if dashboard server is already running on the port */
57
+ function isServerRunning() {
58
+ return new Promise((resolve) => {
59
+ http.get(`${DASHBOARD_URL}/api/status`, { timeout: 1000 }, (res) => {
60
+ resolve(res.statusCode === 200);
61
+ }).on("error", () => resolve(false))
62
+ .on("timeout", () => resolve(false));
63
+ });
64
+ }
65
+ function isPortInUse(port) {
66
+ return new Promise((resolve) => {
67
+ http.get(`http://127.0.0.1:${port}/api/status`, { timeout: 1000 }, (res) => {
68
+ resolve(res.statusCode === 200);
69
+ }).on("error", () => resolve(false));
70
+ });
71
+ }
72
+ function findCLI() {
73
+ // Try env PATH first, then common nvm paths
74
+ const { execSync } = require("node:child_process");
75
+ try {
76
+ return execSync("which openclaw-doctor", { encoding: "utf-8" }).trim();
77
+ }
78
+ catch { }
79
+ const home = process.env.HOME ?? "";
80
+ const candidates = [
81
+ `${home}/.nvm/versions/node/v24.14.0/bin/openclaw-doctor`,
82
+ `${home}/.nvm/versions/node/v22.13.0/bin/openclaw-doctor`,
83
+ `/usr/local/bin/openclaw-doctor`,
84
+ `/opt/homebrew/bin/openclaw-doctor`,
85
+ ];
86
+ const { existsSync } = require("node:fs");
87
+ return candidates.find(existsSync) ?? null;
88
+ }
89
+ async function startServer() {
90
+ if (await isPortInUse(DASHBOARD_PORT)) {
91
+ console.log("[app] dashboard already running, reusing");
92
+ return;
93
+ }
94
+ const cli = findCLI();
95
+ if (!cli) {
96
+ console.error("[app] openclaw-doctor CLI not found — install with: npm install -g openclaw-doctor");
97
+ return;
98
+ }
99
+ // Use system node (not Electron's node) to run the CLI
100
+ const { spawnSync: _ss, spawn } = require("node:child_process");
101
+ // Find system node
102
+ let nodeExec = "/usr/local/bin/node";
103
+ try {
104
+ const nvmNode = _ss("bash", ["-lc", "which node"], { encoding: "utf-8" });
105
+ if (nvmNode.stdout?.trim())
106
+ nodeExec = nvmNode.stdout.trim();
107
+ }
108
+ catch { }
109
+ console.log(`[app] Starting: ${nodeExec} ${cli} monitor`);
110
+ serverProc = spawn(nodeExec, [cli, "monitor"], {
111
+ env: { ...process.env, PATH: `/usr/local/bin:/opt/homebrew/bin:${process.env.PATH}` },
112
+ stdio: "pipe",
113
+ });
114
+ serverProc.stderr?.on("data", (d) => console.error("[monitor]", d.toString().trim()));
115
+ serverProc.stdout?.on("data", (d) => console.log("[monitor]", d.toString().trim()));
116
+ serverProc.on("exit", (code) => {
117
+ console.log(`[app] monitor exited (code ${code}), retry in 3s`);
118
+ serverProc = null;
119
+ setTimeout(startServer, 3000);
120
+ });
121
+ }
122
+ async function ensureServer() {
123
+ // If already running (e.g. openclaw-doctor watch --dashboard), reuse it
124
+ const already = await isServerRunning();
125
+ if (already) {
126
+ console.log("[app] Dashboard server already running, reusing existing instance");
127
+ return;
128
+ }
129
+ startServer();
130
+ await waitForServer();
131
+ }
132
+ function waitForServer(retries = 20) {
133
+ return new Promise((resolve, reject) => {
134
+ let attempts = 0;
135
+ const check = () => {
136
+ http
137
+ .get(`${DASHBOARD_URL}/api/status`, { timeout: 2000 }, (res) => {
138
+ if (res.statusCode === 200)
139
+ return resolve();
140
+ retry();
141
+ })
142
+ .on("error", retry);
143
+ };
144
+ const retry = () => {
145
+ if (++attempts >= retries)
146
+ return reject(new Error("Dashboard server did not start"));
147
+ setTimeout(check, 500);
148
+ };
149
+ check();
150
+ });
151
+ }
152
+ // ── Window ─────────────────────────────────────────────────────────────────
153
+ function createWindow() {
154
+ mainWindow = new electron_1.BrowserWindow({
155
+ width: 1024,
156
+ height: 720,
157
+ minWidth: 800,
158
+ minHeight: 600,
159
+ title: "OpenClaw Doctor",
160
+ backgroundColor: "#050810",
161
+ webPreferences: { contextIsolation: true },
162
+ show: false,
163
+ });
164
+ mainWindow.loadURL(DASHBOARD_URL);
165
+ mainWindow.once("ready-to-show", () => mainWindow?.show());
166
+ mainWindow.on("close", (e) => {
167
+ e.preventDefault();
168
+ mainWindow?.hide();
169
+ });
170
+ }
171
+ function showWindow() {
172
+ if (!mainWindow)
173
+ createWindow();
174
+ else {
175
+ mainWindow.show();
176
+ mainWindow.focus();
177
+ }
178
+ }
179
+ // ── Tray ───────────────────────────────────────────────────────────────────
180
+ function buildTrayMenu() {
181
+ return electron_1.Menu.buildFromTemplate([
182
+ {
183
+ label: "OpenClaw Doctor",
184
+ enabled: false,
185
+ },
186
+ {
187
+ label: `Status: ${isHealthy ? "🟢 HEALTHY" : "🔴 UNREACHABLE"}`,
188
+ enabled: false,
189
+ },
190
+ { type: "separator" },
191
+ { label: "Open Dashboard", click: () => showWindow() },
192
+ { label: "Open in Browser", click: () => electron_1.shell.openExternal(DASHBOARD_URL) },
193
+ { type: "separator" },
194
+ {
195
+ label: "Restart Gateway",
196
+ click: async () => {
197
+ try {
198
+ await fetch(`${DASHBOARD_URL}/api/restart`, { method: "POST" });
199
+ }
200
+ catch { }
201
+ },
202
+ },
203
+ {
204
+ label: "Run Doctor Fix",
205
+ click: async () => {
206
+ try {
207
+ await fetch(`${DASHBOARD_URL}/api/doctor`, { method: "POST" });
208
+ }
209
+ catch { }
210
+ },
211
+ },
212
+ { type: "separator" },
213
+ {
214
+ label: "Start at Login",
215
+ type: "checkbox",
216
+ checked: electron_1.app.getLoginItemSettings().openAtLogin,
217
+ click: (item) => {
218
+ electron_1.app.setLoginItemSettings({ openAtLogin: item.checked });
219
+ },
220
+ },
221
+ { type: "separator" },
222
+ { label: "Quit", click: () => electron_1.app.exit(0) },
223
+ ]);
224
+ }
225
+ function createTray() {
226
+ let icon;
227
+ try {
228
+ icon = electron_1.nativeImage.createFromPath(ICON_PATH);
229
+ // Mark as template for macOS menubar (auto dark/light adaptation)
230
+ icon.setTemplateImage(true);
231
+ }
232
+ catch {
233
+ icon = electron_1.nativeImage.createEmpty();
234
+ }
235
+ tray = new electron_1.Tray(icon);
236
+ tray.setToolTip("OpenClaw Doctor — starting...");
237
+ tray.setContextMenu(buildTrayMenu());
238
+ tray.on("double-click", () => showWindow());
239
+ }
240
+ function updateTray(healthy) {
241
+ if (!tray)
242
+ return;
243
+ isHealthy = healthy;
244
+ tray.setToolTip(`OpenClaw Doctor — ${healthy ? "HEALTHY" : "UNREACHABLE"}`);
245
+ tray.setContextMenu(buildTrayMenu());
246
+ }
247
+ // ── Health polling ─────────────────────────────────────────────────────────
248
+ async function pollHealth() {
249
+ try {
250
+ const res = await fetch(`${DASHBOARD_URL}/api/status`);
251
+ const data = (await res.json());
252
+ const wasHealthy = isHealthy;
253
+ updateTray(data.healthy);
254
+ if (!data.healthy && wasHealthy) {
255
+ new electron_1.Notification({
256
+ title: "OpenClaw Doctor",
257
+ body: "Gateway is down — attempting auto-restart...",
258
+ }).show();
259
+ }
260
+ else if (data.healthy && !wasHealthy) {
261
+ new electron_1.Notification({
262
+ title: "OpenClaw Doctor",
263
+ body: "Gateway is back online ✓",
264
+ }).show();
265
+ }
266
+ }
267
+ catch {
268
+ updateTray(false);
269
+ }
270
+ }
271
+ // ── App lifecycle ──────────────────────────────────────────────────────────
272
+ electron_1.app.on("ready", async () => {
273
+ // macOS: don't show in Dock
274
+ if (process.platform === "darwin")
275
+ electron_1.app.dock?.hide();
276
+ createTray();
277
+ try {
278
+ await ensureServer();
279
+ }
280
+ catch {
281
+ console.warn("[app] server warmup timed out, opening anyway");
282
+ }
283
+ createWindow();
284
+ await pollHealth();
285
+ setInterval(pollHealth, HEALTH_INTERVAL_MS);
286
+ });
287
+ electron_1.app.on("window-all-closed", () => {
288
+ // Keep app alive in tray (do nothing — don't quit)
289
+ });
290
+ electron_1.app.on("activate", () => {
291
+ showWindow();
292
+ });
293
+ // Prevent second instance
294
+ const gotLock = electron_1.app.requestSingleInstanceLock();
295
+ if (!gotLock) {
296
+ electron_1.app.quit();
297
+ }
298
+ else {
299
+ electron_1.app.on("second-instance", () => showWindow());
300
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ /**
37
+ * Forked by Electron main process.
38
+ * Starts the dashboard HTTP server directly using Node's http module.
39
+ * This file is compiled to CommonJS and runs as a standalone child process.
40
+ */
41
+ const http = __importStar(require("node:http"));
42
+ const fs = __importStar(require("node:fs"));
43
+ const path = __importStar(require("node:path"));
44
+ const cp = __importStar(require("node:child_process"));
45
+ const PORT = Number(process.env.DASHBOARD_PORT ?? 9090);
46
+ // Find openclaw-doctor CLI (the installed npm package)
47
+ function findOpenclawDoctor() {
48
+ // 1. Check if there's a global install
49
+ try {
50
+ const which = cp.execSync("which openclaw-doctor", { encoding: "utf-8" }).trim();
51
+ if (which)
52
+ return which;
53
+ }
54
+ catch { }
55
+ // 2. Check common paths
56
+ const candidates = [
57
+ "/usr/local/bin/openclaw-doctor",
58
+ "/opt/homebrew/bin/openclaw-doctor",
59
+ path.join(process.env.HOME ?? "", ".nvm/versions/node/v24.14.0/bin/openclaw-doctor"),
60
+ path.join(process.env.HOME ?? "", ".nvm/versions/node/v22.13.0/bin/openclaw-doctor"),
61
+ ];
62
+ for (const c of candidates) {
63
+ if (fs.existsSync(c))
64
+ return c;
65
+ }
66
+ return null;
67
+ }
68
+ // Strategy: spawn openclaw-doctor monitor as a subprocess
69
+ const cli = findOpenclawDoctor();
70
+ if (cli) {
71
+ console.log(`[server-process] Starting via CLI: ${cli} monitor`);
72
+ const child = cp.spawn(process.execPath, [cli, "monitor"], {
73
+ env: { ...process.env },
74
+ stdio: "inherit",
75
+ });
76
+ child.on("exit", (code) => {
77
+ console.log(`[server-process] CLI exited (${code})`);
78
+ process.exit(code ?? 1);
79
+ });
80
+ }
81
+ else {
82
+ // Fallback: minimal inline HTTP server returning status
83
+ console.warn("[server-process] openclaw-doctor CLI not found, starting fallback server");
84
+ const server = http.createServer((req, res) => {
85
+ if (req.url === "/api/status") {
86
+ res.writeHead(200, { "Content-Type": "application/json" });
87
+ res.end(JSON.stringify({ healthy: false, gateway: false, channels: [], agents: [], durationMs: 0, error: "CLI not found" }));
88
+ }
89
+ else {
90
+ res.writeHead(200, { "Content-Type": "text/html" });
91
+ res.end("<h1>OpenClaw Doctor</h1><p>CLI not found. Please install openclaw-doctor.</p>");
92
+ }
93
+ });
94
+ server.listen(PORT, () => console.log(`[server-process] Fallback server on :${PORT}`));
95
+ }
Binary file
Binary file
package/demo.tape ADDED
@@ -0,0 +1,28 @@
1
+ Output assets/demo.gif
2
+
3
+ Set Shell "bash"
4
+ Set FontSize 14
5
+ Set Width 900
6
+ Set Height 500
7
+ Set Theme "Catppuccin Mocha"
8
+ Set Padding 20
9
+
10
+ # Show the tool
11
+ Type "openclaw-doctor status" Sleep 500ms Enter
12
+ Sleep 3s
13
+
14
+ # Start background monitoring
15
+ Type "openclaw-doctor watch -d" Sleep 500ms Enter
16
+ Sleep 3s
17
+
18
+ # Check again to show it's running
19
+ Type "openclaw-doctor status" Sleep 500ms Enter
20
+ Sleep 3s
21
+
22
+ # Show logs
23
+ Type "openclaw-doctor logs --doctor" Sleep 500ms Enter
24
+ Sleep 3s
25
+
26
+ # Stop
27
+ Type "openclaw-doctor unwatch" Sleep 500ms Enter
28
+ Sleep 2s