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:
@@ -315,16 +315,14 @@ This will open a browser for OAuth consent. After authorization, credentials are
|
|||||||
|
|
||||||
## 10. Configure launchd Service
|
## 10. Configure launchd Service
|
||||||
|
|
||||||
Get the actual paths:
|
Generate the plist file with correct paths automatically:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
which node
|
NODE_PATH=$(which node)
|
||||||
pwd
|
PROJECT_PATH=$(pwd)
|
||||||
```
|
HOME_PATH=$HOME
|
||||||
|
|
||||||
Create the plist file at `~/Library/LaunchAgents/com.nanoclaw.plist`:
|
cat > ~/Library/LaunchAgents/com.nanoclaw.plist << EOF
|
||||||
|
|
||||||
```xml
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
@@ -333,11 +331,11 @@ Create the plist file at `~/Library/LaunchAgents/com.nanoclaw.plist`:
|
|||||||
<string>com.nanoclaw</string>
|
<string>com.nanoclaw</string>
|
||||||
<key>ProgramArguments</key>
|
<key>ProgramArguments</key>
|
||||||
<array>
|
<array>
|
||||||
<string>NODE_PATH_HERE</string>
|
<string>${NODE_PATH}</string>
|
||||||
<string>PROJECT_PATH_HERE/dist/index.js</string>
|
<string>${PROJECT_PATH}/dist/index.js</string>
|
||||||
</array>
|
</array>
|
||||||
<key>WorkingDirectory</key>
|
<key>WorkingDirectory</key>
|
||||||
<string>PROJECT_PATH_HERE</string>
|
<string>${PROJECT_PATH}</string>
|
||||||
<key>RunAtLoad</key>
|
<key>RunAtLoad</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>KeepAlive</key>
|
<key>KeepAlive</key>
|
||||||
@@ -345,19 +343,22 @@ Create the plist file at `~/Library/LaunchAgents/com.nanoclaw.plist`:
|
|||||||
<key>EnvironmentVariables</key>
|
<key>EnvironmentVariables</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>PATH</key>
|
<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>
|
<key>HOME</key>
|
||||||
<string>HOME_PATH_HERE</string>
|
<string>${HOME_PATH}</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>StandardOutPath</key>
|
<key>StandardOutPath</key>
|
||||||
<string>PROJECT_PATH_HERE/logs/nanoclaw.log</string>
|
<string>${PROJECT_PATH}/logs/nanoclaw.log</string>
|
||||||
<key>StandardErrorPath</key>
|
<key>StandardErrorPath</key>
|
||||||
<string>PROJECT_PATH_HERE/logs/nanoclaw.error.log</string>
|
<string>${PROJECT_PATH}/logs/nanoclaw.error.log</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</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:
|
Build and start the service:
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,6 @@
|
|||||||
"gmail": {
|
"gmail": {
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "@gongrzhe/server-gmail-autoauth-mcp"]
|
"args": ["-y", "@gongrzhe/server-gmail-autoauth-mcp"]
|
||||||
},
|
|
||||||
"scheduler": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "schedule-task-mcp"]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
SPEC.md
2
SPEC.md
@@ -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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,9 @@
|
|||||||
"start": "node dist/index.js",
|
"start": "node dist/index.js",
|
||||||
"dev": "tsx src/index.ts",
|
"dev": "tsx src/index.ts",
|
||||||
"auth": "tsx src/whatsapp-auth.ts",
|
"auth": "tsx src/whatsapp-auth.ts",
|
||||||
"lint": "eslint src/",
|
|
||||||
"typecheck": "tsc --noEmit"
|
"typecheck": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@anthropic-ai/claude-agent-sdk": "^0.1.0",
|
|
||||||
"@whiskeysockets/baileys": "^7.0.0-rc.9",
|
"@whiskeysockets/baileys": "^7.0.0-rc.9",
|
||||||
"better-sqlite3": "^11.8.1",
|
"better-sqlite3": "^11.8.1",
|
||||||
"cron-parser": "^5.5.0",
|
"cron-parser": "^5.5.0",
|
||||||
@@ -30,6 +28,6 @@
|
|||||||
"typescript": "^5.7.0"
|
"typescript": "^5.7.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=20"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
11
src/index.ts
11
src/index.ts
@@ -546,7 +546,16 @@ function ensureContainerSystemRunning(): void {
|
|||||||
execSync('container system start', { stdio: 'pipe', timeout: 30000 });
|
execSync('container system start', { stdio: 'pipe', timeout: 30000 });
|
||||||
logger.info('Apple Container system started');
|
logger.info('Apple Container system started');
|
||||||
} catch (err) {
|
} 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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user