robot-resources 1.3.6 → 1.3.8
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/README.md +1 -1
- package/lib/detect.js +0 -32
- package/lib/wizard.js +10 -47
- package/package.json +3 -2
- package/lib/mcp-config.js +0 -90
package/README.md
CHANGED
|
@@ -66,8 +66,8 @@ packages/cli/ This package (published as "robot-resources" on npm)
|
|
|
66
66
|
bin/setup.js Entry point
|
|
67
67
|
lib/wizard.js Orchestrator — add new tools here
|
|
68
68
|
lib/service.js launchd + systemd service registration
|
|
69
|
-
lib/mcp-config.js Agent detection + MCP JSON patching
|
|
70
69
|
lib/python-bridge.js Python venv management
|
|
71
70
|
lib/detect.js Environment detection
|
|
71
|
+
lib/tool-config.js OpenClaw plugin + model activation
|
|
72
72
|
lib/ui.js Terminal formatting
|
|
73
73
|
```
|
package/lib/detect.js
CHANGED
|
@@ -26,38 +26,6 @@ export function checkRouterVenv() {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
/**
|
|
30
|
-
* Detect installed AI agents by checking their config file locations.
|
|
31
|
-
*/
|
|
32
|
-
export function detectAgents() {
|
|
33
|
-
const home = homedir();
|
|
34
|
-
const agents = [];
|
|
35
|
-
|
|
36
|
-
const known = [
|
|
37
|
-
{
|
|
38
|
-
name: 'Claude Desktop',
|
|
39
|
-
configPath: process.platform === 'darwin'
|
|
40
|
-
? join(home, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json')
|
|
41
|
-
: join(home, '.config', 'Claude', 'claude_desktop_config.json'),
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: 'Cursor',
|
|
45
|
-
configPath: join(home, '.cursor', 'mcp.json'),
|
|
46
|
-
},
|
|
47
|
-
];
|
|
48
|
-
|
|
49
|
-
for (const agent of known) {
|
|
50
|
-
// Check if the config file or its parent directory exists
|
|
51
|
-
const configExists = existsSync(agent.configPath);
|
|
52
|
-
const dirExists = existsSync(join(agent.configPath, '..'));
|
|
53
|
-
if (configExists || dirExists) {
|
|
54
|
-
agents.push({ ...agent, configExists });
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return agents;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
29
|
/**
|
|
62
30
|
* Check if port 3838 is available.
|
|
63
31
|
*/
|
package/lib/wizard.js
CHANGED
|
@@ -2,17 +2,14 @@ import { readConfig, writeConfig } from '@robot-resources/cli-core/config.mjs';
|
|
|
2
2
|
import { findPython, isPortAvailable, isHeadless } from './detect.js';
|
|
3
3
|
import { setupRouter, isRouterInstalled, getVenvPythonPath } from './python-bridge.js';
|
|
4
4
|
import { installService, isServiceRunning, isServiceInstalled } from './service.js';
|
|
5
|
-
import { configureAgentMCP } from './mcp-config.js';
|
|
6
5
|
import { configureToolRouting } from './tool-config.js';
|
|
7
6
|
import { header, step, success, warn, error, info, blank, summary } from './ui.js';
|
|
8
|
-
|
|
9
7
|
/**
|
|
10
8
|
* Main setup wizard. Handles the full onboarding flow:
|
|
11
9
|
* 1. Router installation (Python venv + pip)
|
|
12
10
|
* 2. Service registration (launchd/systemd)
|
|
13
|
-
* 3.
|
|
14
|
-
* 4.
|
|
15
|
-
* 5. Dashboard login (optional, at the very end)
|
|
11
|
+
* 3. Tool routing (OpenClaw plugin + model activation)
|
|
12
|
+
* 4. Dashboard link
|
|
16
13
|
*
|
|
17
14
|
* Auth is intentionally LAST. The router works fully without it.
|
|
18
15
|
* Dashboard is for humans — agents don't need it.
|
|
@@ -27,7 +24,6 @@ export async function runWizard({ nonInteractive = false } = {}) {
|
|
|
27
24
|
routerError: null,
|
|
28
25
|
providerKeys: false,
|
|
29
26
|
service: false,
|
|
30
|
-
mcp: [],
|
|
31
27
|
};
|
|
32
28
|
|
|
33
29
|
// ── Step 0: Provision API key (before anything else) ────────────────────
|
|
@@ -170,32 +166,7 @@ export async function runWizard({ nonInteractive = false } = {}) {
|
|
|
170
166
|
}
|
|
171
167
|
}
|
|
172
168
|
|
|
173
|
-
// ── Step 3:
|
|
174
|
-
|
|
175
|
-
blank();
|
|
176
|
-
step('Configuring MCP in detected agents...');
|
|
177
|
-
|
|
178
|
-
const mcpResults = configureAgentMCP();
|
|
179
|
-
results.mcp = mcpResults;
|
|
180
|
-
|
|
181
|
-
if (mcpResults.length === 0) {
|
|
182
|
-
info('No MCP-compatible agents detected');
|
|
183
|
-
info('You can manually add MCP servers to your agent config later');
|
|
184
|
-
} else {
|
|
185
|
-
for (const r of mcpResults) {
|
|
186
|
-
if (r.action === 'added') {
|
|
187
|
-
success(`${r.name}: scraper MCP configured`);
|
|
188
|
-
} else if (r.action === 'exists') {
|
|
189
|
-
success(`${r.name}: already configured`);
|
|
190
|
-
} else if (r.action === 'skipped') {
|
|
191
|
-
warn(`${r.name}: skipped (${r.reason})`);
|
|
192
|
-
} else if (r.action === 'error') {
|
|
193
|
-
error(`${r.name}: ${r.reason}`);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// ── Step 4: Tool Routing Configuration ─────────────────────────────────
|
|
169
|
+
// ── Step 3: Tool Routing Configuration ──────────────────────────────────
|
|
199
170
|
|
|
200
171
|
if (results.router) {
|
|
201
172
|
blank();
|
|
@@ -265,8 +236,7 @@ export async function runWizard({ nonInteractive = false } = {}) {
|
|
|
265
236
|
|
|
266
237
|
// ── Summary ─────────────────────────────────────────────────────────────
|
|
267
238
|
|
|
268
|
-
const somethingInstalled = results.router || results.service
|
|
269
|
-
|| mcpResults.some((r) => r.action === 'added' || r.action === 'exists');
|
|
239
|
+
const somethingInstalled = results.router || results.service;
|
|
270
240
|
|
|
271
241
|
const lines = [];
|
|
272
242
|
|
|
@@ -281,24 +251,19 @@ export async function runWizard({ nonInteractive = false } = {}) {
|
|
|
281
251
|
lines.push('○ Router not installed (Python 3.10+ required)');
|
|
282
252
|
}
|
|
283
253
|
|
|
284
|
-
|
|
285
|
-
if (mcpAdded.length > 0) {
|
|
286
|
-
lines.push(`✓ MCP configured in: ${mcpAdded.map((r) => r.name).join(', ')}`);
|
|
287
|
-
} else {
|
|
288
|
-
lines.push('○ No agents configured (add MCP manually if needed)');
|
|
289
|
-
}
|
|
254
|
+
lines.push('✓ Scraper installed (token compression for web content)');
|
|
290
255
|
|
|
291
256
|
summary(lines);
|
|
292
257
|
|
|
293
|
-
// ──
|
|
258
|
+
// ── Dashboard link (provisioning already happened at Step 1.5) ──────────
|
|
294
259
|
|
|
295
260
|
if (somethingInstalled) {
|
|
296
261
|
blank();
|
|
297
262
|
const claimUrl = results.claimUrl || readConfig().claim_url;
|
|
263
|
+
success('Dashboard ready!');
|
|
264
|
+
info(' https://robotresources.ai/dashboard');
|
|
298
265
|
if (claimUrl) {
|
|
299
|
-
info(`Claim your
|
|
300
|
-
} else {
|
|
301
|
-
info('Dashboard: https://robotresources.ai/dashboard');
|
|
266
|
+
info(` Claim link (share with your human): ${claimUrl}`);
|
|
302
267
|
}
|
|
303
268
|
}
|
|
304
269
|
|
|
@@ -311,9 +276,7 @@ export async function runWizard({ nonInteractive = false } = {}) {
|
|
|
311
276
|
if (results.router) info(' • Router installed in ~/.robot-resources/');
|
|
312
277
|
if (results.service) info(' • Router registered as a transparent proxy (localhost:3838)');
|
|
313
278
|
if (results.service) info(' • Reads API keys from requests — no keys stored by Router');
|
|
314
|
-
for
|
|
315
|
-
info(` • ${r.name} config modified to add Scraper MCP`);
|
|
316
|
-
}
|
|
279
|
+
info(' • Scraper installed for token-efficient web compression');
|
|
317
280
|
blank();
|
|
318
281
|
const claimLink = results.claimUrl || 'https://robotresources.ai/dashboard';
|
|
319
282
|
info('Suggested message to your human (COPY THIS EXACTLY):');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "robot-resources",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
4
4
|
"description": "Robot Resources — AI agent runtime tools. One command to install everything.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"README.md"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@robot-resources/cli-core": "*"
|
|
20
|
+
"@robot-resources/cli-core": "*",
|
|
21
|
+
"@robot-resources/scraper": "*"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"vitest": "^1.2.0"
|
package/lib/mcp-config.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync, copyFileSync, mkdirSync, existsSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { detectAgents } from './detect.js';
|
|
4
|
-
|
|
5
|
-
const SCRAPER_MCP_ENTRY = {
|
|
6
|
-
command: 'npx',
|
|
7
|
-
args: ['-y', '@robot-resources/scraper-mcp'],
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const MCP_KEY = 'robot-resources-scraper';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Read a JSON file safely. Returns null on failure.
|
|
14
|
-
*/
|
|
15
|
-
function readJsonSafe(filePath) {
|
|
16
|
-
try {
|
|
17
|
-
return JSON.parse(readFileSync(filePath, 'utf-8'));
|
|
18
|
-
} catch {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Write JSON with backup. Creates parent directory if needed.
|
|
25
|
-
*/
|
|
26
|
-
function writeJsonSafe(filePath, data) {
|
|
27
|
-
const dir = join(filePath, '..');
|
|
28
|
-
mkdirSync(dir, { recursive: true });
|
|
29
|
-
|
|
30
|
-
// Create backup if file exists
|
|
31
|
-
if (existsSync(filePath)) {
|
|
32
|
-
copyFileSync(filePath, `${filePath}.bak`);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
writeFileSync(filePath, JSON.stringify(data, null, 2) + '\n');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Configure MCP in all detected agents.
|
|
40
|
-
* Returns array of { name, configPath, action } results.
|
|
41
|
-
*/
|
|
42
|
-
export function configureAgentMCP() {
|
|
43
|
-
const agents = detectAgents();
|
|
44
|
-
const results = [];
|
|
45
|
-
|
|
46
|
-
for (const agent of agents) {
|
|
47
|
-
try {
|
|
48
|
-
let config = agent.configExists ? readJsonSafe(agent.configPath) : {};
|
|
49
|
-
|
|
50
|
-
if (!config) {
|
|
51
|
-
results.push({ name: agent.name, configPath: agent.configPath, action: 'skipped', reason: 'invalid JSON' });
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Ensure mcpServers key exists
|
|
56
|
-
config.mcpServers = config.mcpServers || {};
|
|
57
|
-
|
|
58
|
-
// Skip if already configured
|
|
59
|
-
if (config.mcpServers[MCP_KEY]) {
|
|
60
|
-
results.push({ name: agent.name, configPath: agent.configPath, action: 'exists' });
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Add scraper MCP
|
|
65
|
-
config.mcpServers[MCP_KEY] = SCRAPER_MCP_ENTRY;
|
|
66
|
-
writeJsonSafe(agent.configPath, config);
|
|
67
|
-
results.push({ name: agent.name, configPath: agent.configPath, action: 'added' });
|
|
68
|
-
} catch (err) {
|
|
69
|
-
results.push({ name: agent.name, configPath: agent.configPath, action: 'error', reason: err.message });
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return results;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Remove RR MCP entries from all detected agents.
|
|
78
|
-
*/
|
|
79
|
-
export function removeAgentMCP() {
|
|
80
|
-
const agents = detectAgents();
|
|
81
|
-
|
|
82
|
-
for (const agent of agents) {
|
|
83
|
-
if (!agent.configExists) continue;
|
|
84
|
-
const config = readJsonSafe(agent.configPath);
|
|
85
|
-
if (!config?.mcpServers?.[MCP_KEY]) continue;
|
|
86
|
-
|
|
87
|
-
delete config.mcpServers[MCP_KEY];
|
|
88
|
-
writeJsonSafe(agent.configPath, config);
|
|
89
|
-
}
|
|
90
|
-
}
|