Pre-launch fixes: error handling, cleanup, consistency

- Remove unused claude-agent-sdk from host deps (only used in container)
- Remove dead scheduler MCP config (built into IPC)
- Remove unused eslint script
- Add clear error message when Apple Container fails to start
- Auto-generate launchd plist with real paths in setup skill
- Standardize Node.js version to 20+ everywhere

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gavrielc
2026-02-01 23:00:49 +02:00
parent 48822ff67d
commit df52232763
5 changed files with 29 additions and 25 deletions

View File

@@ -315,16 +315,14 @@ This will open a browser for OAuth consent. After authorization, credentials are
## 10. Configure launchd Service
Get the actual paths:
Generate the plist file with correct paths automatically:
```bash
which node
pwd
```
NODE_PATH=$(which node)
PROJECT_PATH=$(pwd)
HOME_PATH=$HOME
Create the plist file at `~/Library/LaunchAgents/com.nanoclaw.plist`:
```xml
cat > ~/Library/LaunchAgents/com.nanoclaw.plist << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@@ -333,11 +331,11 @@ Create the plist file at `~/Library/LaunchAgents/com.nanoclaw.plist`:
<string>com.nanoclaw</string>
<key>ProgramArguments</key>
<array>
<string>NODE_PATH_HERE</string>
<string>PROJECT_PATH_HERE/dist/index.js</string>
<string>${NODE_PATH}</string>
<string>${PROJECT_PATH}/dist/index.js</string>
</array>
<key>WorkingDirectory</key>
<string>PROJECT_PATH_HERE</string>
<string>${PROJECT_PATH}</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
@@ -345,19 +343,22 @@ Create the plist file at `~/Library/LaunchAgents/com.nanoclaw.plist`:
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/bin:HOME_PATH_HERE/.local/bin</string>
<string>/usr/local/bin:/usr/bin:/bin:${HOME_PATH}/.local/bin</string>
<key>HOME</key>
<string>HOME_PATH_HERE</string>
<string>${HOME_PATH}</string>
</dict>
<key>StandardOutPath</key>
<string>PROJECT_PATH_HERE/logs/nanoclaw.log</string>
<string>${PROJECT_PATH}/logs/nanoclaw.log</string>
<key>StandardErrorPath</key>
<string>PROJECT_PATH_HERE/logs/nanoclaw.error.log</string>
<string>${PROJECT_PATH}/logs/nanoclaw.error.log</string>
</dict>
</plist>
```
EOF
Replace the placeholders with actual paths from the commands above.
echo "Created launchd plist with:"
echo " Node: ${NODE_PATH}"
echo " Project: ${PROJECT_PATH}"
```
Build and start the service:

View File

@@ -3,10 +3,6 @@
"gmail": {
"command": "npx",
"args": ["-y", "@gongrzhe/server-gmail-autoauth-mcp"]
},
"scheduler": {
"command": "npx",
"args": ["-y", "schedule-task-mcp"]
}
}
}

View File

@@ -78,7 +78,7 @@ A personal Claude assistant accessible via WhatsApp, with persistent memory per
| Container Runtime | Apple Container | Isolated Linux VMs for agent execution |
| Agent | @anthropic-ai/claude-agent-sdk (0.2.29) | Run Claude with tools and MCP servers |
| Browser Automation | agent-browser + Chromium | Web interaction and screenshots |
| Runtime | Node.js 22+ | Host process for routing and scheduling |
| Runtime | Node.js 20+ | Host process for routing and scheduling |
---

View File

@@ -9,11 +9,9 @@
"start": "node dist/index.js",
"dev": "tsx src/index.ts",
"auth": "tsx src/whatsapp-auth.ts",
"lint": "eslint src/",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@anthropic-ai/claude-agent-sdk": "^0.1.0",
"@whiskeysockets/baileys": "^7.0.0-rc.9",
"better-sqlite3": "^11.8.1",
"cron-parser": "^5.5.0",
@@ -30,6 +28,6 @@
"typescript": "^5.7.0"
},
"engines": {
"node": ">=18"
"node": ">=20"
}
}

View File

@@ -546,7 +546,16 @@ function ensureContainerSystemRunning(): void {
execSync('container system start', { stdio: 'pipe', timeout: 30000 });
logger.info('Apple Container system started');
} catch (err) {
logger.error({ err }, 'Failed to start Apple Container system - agents will not work');
logger.error({ err }, 'Failed to start Apple Container system');
console.error('\n╔════════════════════════════════════════════════════════════════╗');
console.error('║ FATAL: Apple Container system failed to start ║');
console.error('║ ║');
console.error('║ Agents cannot run without Apple Container. To fix: ║');
console.error('║ 1. Install from: https://github.com/apple/container/releases ║');
console.error('║ 2. Run: container system start ║');
console.error('║ 3. Restart NanoClaw ║');
console.error('╚════════════════════════════════════════════════════════════════╝\n');
throw new Error('Apple Container system is required but failed to start');
}
}
}