robot-resources 1.10.3 → 1.10.5
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/detect.js +9 -0
- package/lib/health-report.js +11 -5
- package/lib/tool-config.js +100 -7
- package/lib/wizard.js +10 -4
- package/package.json +2 -2
package/lib/detect.js
CHANGED
|
@@ -21,6 +21,15 @@ export function isOpenClawPluginInstalled() {
|
|
|
21
21
|
|| existsSync(join(extDir, 'robot-resources-router'));
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Check if the Robot Resources scraper OC plugin is already installed.
|
|
26
|
+
*/
|
|
27
|
+
export function isScraperOcPluginInstalled() {
|
|
28
|
+
const home = homedir();
|
|
29
|
+
const extDir = join(home, '.openclaw', 'extensions');
|
|
30
|
+
return existsSync(join(extDir, 'robot-resources-scraper-oc-plugin'));
|
|
31
|
+
}
|
|
32
|
+
|
|
24
33
|
/**
|
|
25
34
|
* Detect OpenClaw auth mode: 'subscription' (OAuth token) or 'apikey'.
|
|
26
35
|
*
|
package/lib/health-report.js
CHANGED
|
@@ -113,11 +113,17 @@ function probeMcp() {
|
|
|
113
113
|
try {
|
|
114
114
|
const ocPath = join(homedir(), '.openclaw', 'openclaw.json');
|
|
115
115
|
const ocConfig = JSON.parse(readFileSync(ocPath, 'utf-8'));
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
116
|
+
const hasRouter = !!ocConfig?.plugins?.entries?.['robot-resources-router']?.enabled;
|
|
117
|
+
const hasScraper = !!ocConfig?.plugins?.entries?.['robot-resources-scraper-oc-plugin']?.enabled;
|
|
118
|
+
|
|
119
|
+
if (hasRouter && hasScraper) {
|
|
120
|
+
return { healthy: true, detail: 'plugins registered' };
|
|
121
|
+
}
|
|
122
|
+
if (!hasRouter && !hasScraper) {
|
|
123
|
+
return { healthy: false, detail: 'router + scraper plugins not registered' };
|
|
124
|
+
}
|
|
125
|
+
const missing = !hasRouter ? 'robot-resources-router' : 'robot-resources-scraper-oc-plugin';
|
|
126
|
+
return { healthy: false, detail: `${missing} not registered` };
|
|
121
127
|
} catch {
|
|
122
128
|
return { healthy: false, detail: 'openclaw.json not found' };
|
|
123
129
|
}
|
package/lib/tool-config.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createRequire } from 'node:module';
|
|
|
3
3
|
import { readFileSync, writeFileSync, copyFileSync, cpSync, mkdirSync, existsSync, rmSync } from 'node:fs';
|
|
4
4
|
import { homedir } from 'node:os';
|
|
5
5
|
import { join, dirname } from 'node:path';
|
|
6
|
-
import { isOpenClawInstalled, isOpenClawPluginInstalled, getOpenClawAuthMode, isClaudeCodeInstalled, isCursorInstalled } from './detect.js';
|
|
6
|
+
import { isOpenClawInstalled, isOpenClawPluginInstalled, isScraperOcPluginInstalled, getOpenClawAuthMode, isClaudeCodeInstalled, isCursorInstalled } from './detect.js';
|
|
7
7
|
import { stripJson5 } from './json5.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -151,6 +151,89 @@ function registerPluginEntry() {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Trust the scraper OC plugin in OpenClaw config.
|
|
156
|
+
*
|
|
157
|
+
* Adds "robot-resources-scraper-oc-plugin" to plugins.allow so OpenClaw
|
|
158
|
+
* loads it without provenance warnings. The plugin's before_tool_call
|
|
159
|
+
* hook redirects web_fetch to scraper_compress_url.
|
|
160
|
+
*
|
|
161
|
+
* Returns true if the config was updated, false otherwise.
|
|
162
|
+
*/
|
|
163
|
+
function trustScraperOcPlugin() {
|
|
164
|
+
const configPath = join(homedir(), '.openclaw', 'openclaw.json');
|
|
165
|
+
|
|
166
|
+
try {
|
|
167
|
+
const config = readOrCreateOpenClawConfig();
|
|
168
|
+
|
|
169
|
+
if (!config.plugins) config.plugins = {};
|
|
170
|
+
if (!Array.isArray(config.plugins.allow)) config.plugins.allow = [];
|
|
171
|
+
|
|
172
|
+
if (config.plugins.allow.includes('robot-resources-scraper-oc-plugin')) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
config.plugins.allow.push('robot-resources-scraper-oc-plugin');
|
|
177
|
+
|
|
178
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n', 'utf-8');
|
|
179
|
+
return true;
|
|
180
|
+
} catch {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Copy the bundled scraper OC plugin files to
|
|
187
|
+
* ~/.openclaw/extensions/robot-resources-scraper-oc-plugin/.
|
|
188
|
+
*
|
|
189
|
+
* Mirrors installPluginFiles() but for the scraper OC plugin package.
|
|
190
|
+
*/
|
|
191
|
+
function installScraperOcPluginFiles() {
|
|
192
|
+
const require = createRequire(import.meta.url);
|
|
193
|
+
// OC plugin lives as a subfolder inside the scraper package post-consolidation.
|
|
194
|
+
const scraperPkgPath = require.resolve('@robot-resources/scraper/package.json');
|
|
195
|
+
const pluginDir = join(dirname(scraperPkgPath), 'oc-plugin');
|
|
196
|
+
|
|
197
|
+
const targetDir = join(homedir(), '.openclaw', 'extensions', 'robot-resources-scraper-oc-plugin');
|
|
198
|
+
mkdirSync(targetDir, { recursive: true });
|
|
199
|
+
|
|
200
|
+
for (const file of ['index.js', 'openclaw.plugin.json', 'package.json']) {
|
|
201
|
+
copyFileSync(join(pluginDir, file), join(targetDir, file));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Copy lib/ recursively. Clear destination first so files removed in
|
|
205
|
+
// a new version don't linger from a previous install.
|
|
206
|
+
const srcLib = join(pluginDir, 'lib');
|
|
207
|
+
const dstLib = join(targetDir, 'lib');
|
|
208
|
+
if (existsSync(srcLib)) {
|
|
209
|
+
rmSync(dstLib, { recursive: true, force: true });
|
|
210
|
+
cpSync(srcLib, dstLib, { recursive: true });
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Register the scraper OC plugin in openclaw.json so OC loads it on
|
|
216
|
+
* gateway start. Adds plugins.entries['robot-resources-scraper-oc-plugin'] = { enabled: true }.
|
|
217
|
+
*/
|
|
218
|
+
function registerScraperOcPluginEntry() {
|
|
219
|
+
const configPath = join(homedir(), '.openclaw', 'openclaw.json');
|
|
220
|
+
|
|
221
|
+
try {
|
|
222
|
+
const config = readOrCreateOpenClawConfig();
|
|
223
|
+
|
|
224
|
+
if (!config.plugins) config.plugins = {};
|
|
225
|
+
if (!config.plugins.entries) config.plugins.entries = {};
|
|
226
|
+
|
|
227
|
+
if (config.plugins.entries['robot-resources-scraper-oc-plugin']) return;
|
|
228
|
+
|
|
229
|
+
config.plugins.entries['robot-resources-scraper-oc-plugin'] = { enabled: true };
|
|
230
|
+
|
|
231
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n', 'utf-8');
|
|
232
|
+
} catch {
|
|
233
|
+
// Non-fatal — plugin may still auto-load from extensions dir
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
154
237
|
/**
|
|
155
238
|
* Configure OpenClaw to route through Robot Resources Router.
|
|
156
239
|
*
|
|
@@ -167,7 +250,10 @@ function registerPluginEntry() {
|
|
|
167
250
|
function configureOpenClaw() {
|
|
168
251
|
const authMode = getOpenClawAuthMode();
|
|
169
252
|
|
|
170
|
-
|
|
253
|
+
const routerWasInstalled = isOpenClawPluginInstalled();
|
|
254
|
+
const scraperWasInstalled = isScraperOcPluginInstalled();
|
|
255
|
+
|
|
256
|
+
if (routerWasInstalled && scraperWasInstalled) {
|
|
171
257
|
return {
|
|
172
258
|
name: 'OpenClaw',
|
|
173
259
|
action: 'already_configured',
|
|
@@ -176,13 +262,20 @@ function configureOpenClaw() {
|
|
|
176
262
|
}
|
|
177
263
|
|
|
178
264
|
try {
|
|
179
|
-
|
|
265
|
+
let configActivated = false;
|
|
180
266
|
|
|
181
|
-
|
|
182
|
-
|
|
267
|
+
if (!routerWasInstalled) {
|
|
268
|
+
installPluginFiles();
|
|
269
|
+
registerPluginEntry();
|
|
270
|
+
configActivated = trustPlugin();
|
|
271
|
+
}
|
|
183
272
|
|
|
184
|
-
|
|
185
|
-
|
|
273
|
+
if (!scraperWasInstalled) {
|
|
274
|
+
installScraperOcPluginFiles();
|
|
275
|
+
registerScraperOcPluginEntry();
|
|
276
|
+
// OR-combine so configActivated reflects "any plugin entry was added to allow".
|
|
277
|
+
configActivated = trustScraperOcPlugin() || configActivated;
|
|
278
|
+
}
|
|
186
279
|
|
|
187
280
|
return {
|
|
188
281
|
name: 'OpenClaw',
|
package/lib/wizard.js
CHANGED
|
@@ -31,10 +31,13 @@ const CLI_VERSION = (() => {
|
|
|
31
31
|
* The wizard's job is reduced to:
|
|
32
32
|
*
|
|
33
33
|
* 1. Provision an anonymous api_key (telemetry/dashboard identity).
|
|
34
|
-
* 2. Install
|
|
35
|
-
* routing logic) into
|
|
34
|
+
* 2. Install both OC plugins:
|
|
35
|
+
* a. router plugin (in-process HTTP server + routing logic) into
|
|
36
|
+
* ~/.openclaw/extensions/robot-resources-router/
|
|
37
|
+
* b. scraper OC plugin (web_fetch → scraper_compress_url hook) into
|
|
38
|
+
* ~/.openclaw/extensions/robot-resources-scraper-oc-plugin/
|
|
36
39
|
* 3. Register the scraper MCP in openclaw.json.
|
|
37
|
-
* 4. Restart the OC gateway so the
|
|
40
|
+
* 4. Restart the OC gateway so the plugins load.
|
|
38
41
|
*
|
|
39
42
|
* No Python, no venv, no systemd, no port probe.
|
|
40
43
|
*/
|
|
@@ -323,7 +326,10 @@ export async function runWizard({ nonInteractive = false } = {}) {
|
|
|
323
326
|
blank();
|
|
324
327
|
warn('IMPORTANT: Notify your human about this installation.');
|
|
325
328
|
info('Robot Resources has made the following changes to this machine:');
|
|
326
|
-
if (results.pluginInstalled)
|
|
329
|
+
if (results.pluginInstalled) {
|
|
330
|
+
info(' • Router plugin installed in ~/.openclaw/extensions/robot-resources-router/');
|
|
331
|
+
info(' • Scraper plugin installed in ~/.openclaw/extensions/robot-resources-scraper-oc-plugin/');
|
|
332
|
+
}
|
|
327
333
|
if (results.pluginInstalled) info(' • Plugin runs in-process inside OpenClaw — no separate service');
|
|
328
334
|
if (results.scraper) info(' • Scraper MCP configured — scraper_compress_url(url) available');
|
|
329
335
|
blank();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "robot-resources",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.5",
|
|
4
4
|
"description": "Robot Resources — AI agent tools. One command to install everything.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@robot-resources/cli-core": "*",
|
|
21
21
|
"@robot-resources/router": "*",
|
|
22
|
-
"@robot-resources/scraper": "
|
|
22
|
+
"@robot-resources/scraper": "*"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"vitest": "^1.2.0"
|