@robbiesrobotics/alice-agents 1.3.1 → 1.3.2

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.
package/lib/doctor.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { readFileSync, existsSync } from 'node:fs';
1
+ import { readFileSync, existsSync, accessSync, constants } from 'node:fs';
2
2
  import { join, dirname } from 'node:path';
3
- import { homedir } from 'node:os';
3
+ import { homedir, platform } from 'node:os';
4
4
  import { execSync } from 'node:child_process';
5
5
  import { fileURLToPath } from 'node:url';
6
6
 
@@ -42,6 +42,72 @@ function loadConfig() {
42
42
  }
43
43
  }
44
44
 
45
+ /**
46
+ * Check Docker socket accessibility.
47
+ * On Linux, Docker often requires sudo unless the user is in the docker group.
48
+ * Returns { present, accessible, needsSudo, hint }
49
+ */
50
+ function checkDockerEnvironment() {
51
+ const isLinux = platform() === 'linux';
52
+
53
+ // Check if docker binary exists at all
54
+ let dockerInstalled = false;
55
+ try {
56
+ execSync('which docker', { stdio: 'pipe' });
57
+ dockerInstalled = true;
58
+ } catch {
59
+ // Docker not installed — not a blocker unless openclaw needs it
60
+ return { present: false, accessible: false, needsSudo: false, hint: null };
61
+ }
62
+
63
+ // Try docker ps without sudo
64
+ try {
65
+ execSync('docker ps', { stdio: 'pipe' });
66
+ return { present: true, accessible: true, needsSudo: false, hint: null };
67
+ } catch (err) {
68
+ const msg = err.stderr?.toString() || '';
69
+
70
+ // Permission denied / cannot connect to daemon — classic sudo-required scenario
71
+ const isPermissionIssue =
72
+ msg.includes('permission denied') ||
73
+ msg.includes('Got permission denied') ||
74
+ msg.includes('Cannot connect to the Docker daemon') ||
75
+ msg.includes('dial unix') ||
76
+ msg.includes('connect: permission denied');
77
+
78
+ if (isLinux && isPermissionIssue) {
79
+ // Try sudo docker ps to confirm it works with elevated perms
80
+ let sudoWorks = false;
81
+ try {
82
+ execSync('sudo docker ps', { stdio: 'pipe', timeout: 5000 });
83
+ sudoWorks = true;
84
+ } catch {}
85
+
86
+ return {
87
+ present: true,
88
+ accessible: false,
89
+ needsSudo: true,
90
+ sudoWorks,
91
+ hint: sudoWorks
92
+ ? `Docker requires sudo on this machine. Fix with:\n sudo usermod -aG docker $USER && newgrp docker\n Then log out and back in. Or run OpenClaw with sudo (not recommended for production).`
93
+ : `Docker found but not accessible. Check that the Docker daemon is running:\n sudo systemctl start docker\n Then add your user to the docker group:\n sudo usermod -aG docker $USER && newgrp docker`,
94
+ };
95
+ }
96
+
97
+ // Docker is installed but daemon isn't running
98
+ if (msg.includes('Is the docker daemon running') || msg.includes('Cannot connect')) {
99
+ return {
100
+ present: true,
101
+ accessible: false,
102
+ needsSudo: false,
103
+ hint: 'Docker daemon is not running. Start it:\n sudo systemctl start docker (Linux)\n open -a Docker (macOS)',
104
+ };
105
+ }
106
+
107
+ return { present: true, accessible: false, needsSudo: false, hint: `docker ps failed: ${msg.slice(0, 100)}` };
108
+ }
109
+ }
110
+
45
111
  export async function runDoctor() {
46
112
  console.log('\n 🩺 A.L.I.C.E. Doctor — Diagnostic Report\n');
47
113
  let allOk = true;
@@ -157,7 +223,27 @@ export async function runDoctor() {
157
223
  );
158
224
  allOk = allOk && modelOk;
159
225
 
160
- // 6. License check
226
+ // 6. Docker environment check (Linux-aware)
227
+ const docker = checkDockerEnvironment();
228
+ if (docker.present) {
229
+ if (docker.accessible) {
230
+ check('Docker accessible', true);
231
+ } else if (docker.needsSudo) {
232
+ check(
233
+ 'Docker requires sudo — user not in docker group',
234
+ false,
235
+ docker.hint
236
+ );
237
+ // Docker permission issue is a warning, not a hard failure for A.L.I.C.E. itself
238
+ // but it will break OpenClaw's own Docker features
239
+ console.log(' ℹ️ Note: This will affect OpenClaw features that use Docker.\n');
240
+ } else {
241
+ check('Docker daemon not running or not accessible', false, docker.hint);
242
+ }
243
+ }
244
+ // If docker not present at all, skip silently — not required for all setups
245
+
246
+ // 7. License check
161
247
  const { checkProLicense } = await import('./license.mjs');
162
248
  const manifest = (() => {
163
249
  try {
package/lib/installer.mjs CHANGED
@@ -29,6 +29,44 @@ function isOpenClawInstalled() {
29
29
  }
30
30
  }
31
31
 
32
+ /**
33
+ * On Linux, Docker requires the user to be in the docker group.
34
+ * Detect this early and warn before OpenClaw's own preflight fails cryptically.
35
+ */
36
+ function checkLinuxDockerPermissions() {
37
+ if (process.platform !== 'linux') return;
38
+
39
+ try {
40
+ execSync('which docker', { stdio: 'pipe' });
41
+ } catch {
42
+ return; // Docker not installed — not our problem
43
+ }
44
+
45
+ try {
46
+ execSync('docker ps', { stdio: 'pipe' });
47
+ return; // Works fine — user is in docker group
48
+ } catch (err) {
49
+ const msg = err.stderr?.toString() || '';
50
+ const isPermissionIssue =
51
+ msg.includes('permission denied') ||
52
+ msg.includes('Got permission denied') ||
53
+ msg.includes('Cannot connect to the Docker daemon') ||
54
+ msg.includes('connect: permission denied');
55
+
56
+ if (isPermissionIssue) {
57
+ console.log(' ⚠️ Docker permission issue detected.\n');
58
+ console.log(' Your user is not in the docker group. This will cause');
59
+ console.log(' OpenClaw to fail when it tries to access Docker.\n');
60
+ console.log(' Fix this now (recommended):');
61
+ console.log(' sudo usermod -aG docker $USER');
62
+ console.log(' newgrp docker\n');
63
+ console.log(' Or log out and back in after running the usermod command.');
64
+ console.log(' You can also run: npx @robbiesrobotics/alice-agents --doctor');
65
+ console.log(' after fixing to verify the issue is resolved.\n');
66
+ }
67
+ }
68
+ }
69
+
32
70
  async function detectRuntime() {
33
71
  // Check for NemoClaw binary
34
72
  try {
@@ -215,6 +253,9 @@ export async function runInstall(options = {}) {
215
253
 
216
254
  printBanner();
217
255
 
256
+ // 0. Linux Docker permission check — warn early before OpenClaw preflight fails
257
+ checkLinuxDockerPermissions();
258
+
218
259
  // 1. Detect OpenClaw — offer to install if missing
219
260
  if (!isOpenClawInstalled() || !configExists()) {
220
261
  await installRuntime(auto);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robbiesrobotics/alice-agents",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "A.L.I.C.E. — 28 AI agents for OpenClaw. One conversation, one team.",
5
5
  "bin": {
6
6
  "alice-agents": "bin/alice-install.mjs"