robot-resources 1.6.1 → 1.7.1

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.
Files changed (3) hide show
  1. package/README.md +80 -48
  2. package/lib/wizard.js +38 -8
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -1,73 +1,105 @@
1
- # robot-resources — Unified Installer
1
+ # Robot Resources
2
2
 
3
- One command to install all Robot Resources tools:
3
+ > Tools for AI agents. Humans have HR. Agents have RR.
4
4
 
5
- ```
5
+ Robot Resources builds tools for AI agents and any software that makes LLM API calls — chatbots, RAG pipelines, AI-powered apps, internal tools. Two products today: **Router** (intelligent model routing, 60-90% cost savings) and **Scraper** (token compression for web content, median 91% token reduction). Both run locally, both free.
6
+
7
+ ## Quick Start
8
+
9
+ ```bash
6
10
  npx robot-resources
7
11
  ```
8
12
 
9
- ## What the wizard does
10
-
11
- 1. **GitHub OAuth** — authenticates via PKCE, saves API key to `~/.robot-resources/config.json`
12
- 2. **Router install** — detects Python 3.10+, creates venv, pip installs `robot-resources-router`
13
- 3. **Service registration** — registers router as launchd (macOS) or systemd (Linux) service
14
- 4. **Scraper** — installs @robot-resources/scraper for token-efficient web compression
13
+ One command: authenticates via GitHub OAuth, installs Router as an always-on service, registers Scraper as the default web compression tool, and configures your agent automatically.
15
14
 
16
- ## Adding a new tool
15
+ ## Products
17
16
 
18
- When you build a new product for RR, follow this checklist:
17
+ ### Router
19
18
 
20
- ### 1. Create the npx entry point
19
+ Intelligent LLM routing proxy. Classifies each prompt by task type, filters by model capability, routes to the cheapest model that qualifies.
21
20
 
22
- Your tool needs an npm package with a `bin` entry that runs a setup wizard. Two patterns:
21
+ - Hybrid classification: keyword detection (~5ms) + LLM fallback for ambiguous prompts (~200ms)
22
+ - Dynamic thresholds: simple tasks open cheap models (0.60), complex tasks require top models (0.85)
23
+ - 11 models across OpenAI, Anthropic, and Google — routes within your available providers
24
+ - 60-90% cost savings with zero quality loss
25
+ - OpenAI-compatible API on localhost:3838 — change your base_url and you're done
26
+ - OpenClaw compatible — plugin auto-installs, works with API keys and subscriptions
23
27
 
24
- - **Node.js tool:** Add `bin` to your package.json pointing to a setup script
25
- - **Python tool:** Create a thin npm wrapper (like `router/packages/router/`) that handles pip install
28
+ ```bash
29
+ npx @robot-resources/router
30
+ ```
26
31
 
27
- The wizard should:
28
- - Check `~/.robot-resources/config.json` — offer login if missing
29
- - Install the tool
30
- - Configure MCP if applicable
31
- - Print usage instructions
32
+ ### Scraper
32
33
 
33
- ### 2. Update the unified wizard
34
+ Token compression for web content. Fetches any URL, strips noise, returns clean markdown with token count.
34
35
 
35
- Edit `packages/cli/lib/wizard.js` to add your tool as a new step between service registration and MCP config.
36
+ - Mozilla Readability extraction (0.97 F1 accuracy)
37
+ - Content-aware token estimation (±15% of actual BPE)
38
+ - 3-tier fetch: fast, stealth (TLS fingerprint), render (headless browser)
39
+ - Multi-page BFS crawl with robots.txt compliance
40
+ - Median 91% token reduction per page
36
41
 
37
- ### 3. Update the landing page
42
+ Installed automatically via `npx robot-resources`. Available as MCP tool `scraper_compress_url(url)` in your agent.
38
43
 
39
- | File | What to change |
40
- |------|---------------|
41
- | `web/src/pages/Landing/types.ts` | Add install subsection if new section |
42
- | `web/src/pages/Landing/components/ContentPanel/animatedContentScreens.ts` | Add install screen (desktop + mobile) |
43
- | `web/src/pages/Landing/components/TerminalPanel/terminalCommands.ts` | Add install subcommand output |
44
+ ### Dashboard
44
45
 
45
- ### 4. Update agent-facing content
46
+ Usage dashboard with real-time telemetry. Auth via GitHub OAuth, KPI panels, routing stats, cost savings tracking. Mobile-responsive.
46
47
 
47
- | File | What to change |
48
- |------|---------------|
49
- | `web/public/llms.txt` | Add tool with `npx @robot-resources/<tool>` |
50
- | `web/public/llms-full.txt` | Add detailed section with npx install |
51
- | `web/public/.well-known/ai-resources.json` | Add SoftwareApplication entry with InstallAction |
48
+ ### MCP Servers
52
49
 
53
- ### 5. Update the publish workflow
50
+ Both products include MCP servers for AI agent integration:
54
51
 
55
- Add your package.json path to `.github/workflows/publish.yml` triggers and add a publish step.
52
+ ```bash
53
+ npx -y @robot-resources/router-mcp # Router stats + config
54
+ npx -y @robot-resources/scraper-mcp # Scraper compression
55
+ ```
56
56
 
57
- ### 6. Add to root workspaces
57
+ ## Pricing
58
58
 
59
- Add your package directory to the `workspaces` array in the root `package.json`.
59
+ Free. Unlimited. No tiers. Both tools run locally — you pay your AI providers directly. No markup, no rate limits, no quotas. Your API keys never leave your machine.
60
60
 
61
- ## Architecture
61
+ ## Monorepo Structure
62
62
 
63
63
  ```
64
- packages/cli-core/ Shared auth, config, login (private — never published)
65
- packages/cli/ This package (published as "robot-resources" on npm)
66
- bin/setup.js Entry point
67
- lib/wizard.js Orchestrator add new tools here
68
- lib/service.js launchd + systemd service registration
69
- lib/python-bridge.js Python venv management
70
- lib/detect.js Environment detection
71
- lib/tool-config.js OpenClaw plugin + model activation
72
- lib/ui.js Terminal formatting
64
+ robot-resources/
65
+ ├── router/ # LLM routing proxy (Python + TypeScript MCP)
66
+ ├── scraper/ # Token compression (TypeScript)
67
+ ├── web/ # Landing page + dashboard (React/Vite)
68
+ ├── platform/ # Backend API auth, telemetry (Hono/Cloudflare Workers)
69
+ ├── packages/ # Unified CLI installer (npx robot-resources)
70
+ ├── skills/ # Agent skills (ClawHub)
71
+ ├── _orchestrator/ # Business coordination
72
+ └── _brand/ # Brand assets and design system
73
73
  ```
74
+
75
+ ## Development
76
+
77
+ Each product has its own setup:
78
+
79
+ - [Router](./router/README.md)
80
+ - [Scraper](./scraper/packages/scraper/README.md)
81
+ - [Platform](./platform/README.md)
82
+ - [CLI](./packages/cli/README.md)
83
+
84
+ ## CI/CD
85
+
86
+ Unified pipeline on push/PR to main:
87
+
88
+ - **Router**: ruff, mypy, pytest
89
+ - **Scraper**: tsc, vitest
90
+ - **Web**: tsc, eslint
91
+ - **Publish**: 7 npm packages via OIDC (`router`, `router-mcp`, `scraper`, `scraper-mcp`, `scraper-tracking`, `cli-core`, `cli`)
92
+
93
+ ## Links
94
+
95
+ - Website: https://robotresources.ai
96
+ - GitHub: https://github.com/robot-resources
97
+ - npm: `npx robot-resources`
98
+ - Twitter/X: https://x.com/robotresources
99
+ - Discord: https://robotresources.ai/discord
100
+ - Contact: agent@robotresources.ai
101
+ - Agent docs: https://robotresources.ai/llms.txt
102
+
103
+ ## License
104
+
105
+ MIT
package/lib/wizard.js CHANGED
@@ -69,14 +69,12 @@ export async function runWizard({ nonInteractive = false } = {}) {
69
69
 
70
70
  if (res.ok) {
71
71
  const { data } = await res.json();
72
- if (data.api_key !== 'existing') {
73
- writeConfig({
74
- api_key: data.api_key,
75
- key_id: data.key_id,
76
- claim_url: data.claim_url,
77
- signup_source: 'auto',
78
- });
79
- }
72
+ writeConfig({
73
+ api_key: data.api_key,
74
+ key_id: data.key_id,
75
+ claim_url: data.claim_url,
76
+ signup_source: 'auto',
77
+ });
80
78
  results.auth = true;
81
79
  results.authMethod = 'auto';
82
80
  results.claimUrl = data.claim_url;
@@ -267,6 +265,38 @@ export async function runWizard({ nonInteractive = false } = {}) {
267
265
  }
268
266
  }
269
267
 
268
+ // ── Install Complete Telemetry ───────────────────────────────────────────
269
+ //
270
+ // Fire once after install, using the API key directly (not from config read-back).
271
+ // This immediately populates last_used_at and proves the key works end-to-end.
272
+
273
+ if (results.auth) {
274
+ try {
275
+ const config = readConfig();
276
+ const platformUrl = process.env.RR_PLATFORM_URL || 'https://api.robotresources.ai';
277
+ await fetch(`${platformUrl}/v1/telemetry`, {
278
+ method: 'POST',
279
+ headers: {
280
+ 'Authorization': `Bearer ${config.api_key}`,
281
+ 'Content-Type': 'application/json',
282
+ },
283
+ body: JSON.stringify({
284
+ product: 'cli',
285
+ event_type: 'install_complete',
286
+ payload: {
287
+ router: results.router || false,
288
+ service: results.service || false,
289
+ scraper: results.scraper || false,
290
+ source: 'wizard',
291
+ },
292
+ }),
293
+ signal: AbortSignal.timeout(5_000),
294
+ });
295
+ } catch {
296
+ // Non-fatal — install_complete is best-effort
297
+ }
298
+ }
299
+
270
300
  // ── Summary ─────────────────────────────────────────────────────────────
271
301
 
272
302
  const somethingInstalled = results.router || results.service || results.scraper;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "robot-resources",
3
- "version": "1.6.1",
3
+ "version": "1.7.1",
4
4
  "description": "Robot Resources — AI agent runtime 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/openclaw-plugin": "*",
22
- "@robot-resources/scraper": "^0.2.0"
22
+ "@robot-resources/scraper": "^0.3.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "vitest": "^1.2.0"