robot-resources 1.14.0 → 1.14.2

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 CHANGED
@@ -1,78 +1,91 @@
1
- # robot-resources
1
+ # Robot Resources
2
2
 
3
- > One command to install Robot Resources tools for any agent stack.
3
+ > Tools for AI agents and agentic software. Humans have HR. Agents have RR.
4
+
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** (smart model selection — picks the right model for each task, 60-90% cost savings as a side effect) and **Scraper** (token compression for web content, median 91% token reduction). Both run locally. Both free.
6
+
7
+ ## Quick Start
4
8
 
5
9
  ```bash
6
- npx robot-resources
10
+ npx -y robot-resources
7
11
  ```
8
12
 
9
- The wizard detects what you're building and walks you through the right setup OpenClaw plugin install, JS library path, Python SDK path, MCP config for Cursor / Claude Code, or just the docs URL.
13
+ Detects your project shape (Node / Python / OpenClaw) and installs the right shim. No login, no API keys to enter, no signup. Router uses your existing provider keys they never leave your machine.
14
+
15
+ ## Router
16
+
17
+ Smart model selection. Classifies each prompt by task type (coding / reasoning / analysis / simple_qa / creative / general), filters by model capability, then within the qualifying set picks the cheapest. Routes the right model for the task — cost savings (60-90% across mixed workloads) follow from that, not the other way around. Hybrid classification: keyword fast-path (~5ms, ~70% of prompts) + LLM slow-path for ambiguous prompts (~200ms). Routes across Anthropic, OpenAI, and Google when the corresponding keys are present.
10
18
 
11
- ## What the wizard does
19
+ Three ways to install on a dev machine:
12
20
 
13
- 1. **Provisions an anonymous API key** via `POST /v1/auth/signup` (saved to `~/.robot-resources/config.json`). Optional routing works without it; the key just lights up the dashboard at robotresources.ai/dashboard.
14
- 2. **Detects your stack**:
15
- - OpenClaw installed (`~/.openclaw/`) installs the router plugin (in-process HTTP server) + scraper OC plugin, patches `openclaw.json`, restarts the gateway. **No Python, no daemon, no system service.**
16
- - Non-OC + cwd has `package.json` with LangChain/LangGraph/Mastra → preselects "JS/TS agent."
17
- - Non-OC + cwd has `requirements.txt` / `pyproject.toml` → preselects "Python agent."
18
- - Non-OC + Cursor or Claude Code installed → preselects "MCP tool."
19
- 3. **Runs the chosen path**:
20
- - **JS/TS agent** → prints `npm install @robot-resources/router` + `import { routePrompt }` example
21
- - **Python agent** → prints `pip install robot-resources` + `from robot_resources.router import route` example, plus an httpx fallback if you'd rather skip the SDK
22
- - **Cursor / Claude Code** → writes the scraper MCP config into `~/.cursor/mcp.json` / `~/.claude/settings.json`
23
- - **Docs** → prints the URL + exits
24
- - **Install OpenClaw first** → redirect message + exits
21
+ - **OpenClaw users** get an in-process plugin inside the OC gateway. Anthropic, OpenAI, and Google calls each route to their native upstream no cross-shape body translation.
22
+ - **Node projects** get an auto-attach shim (`NODE_OPTIONS=--require .../auto.cjs`). Every Anthropic, OpenAI, and Google SDK call from any Node process routes automatically. No code changes.
23
+ - **Python projects** get a `.pth` auto-attach shim in your venv. Every `anthropic` / `openai` / `google.generativeai` SDK call routes automatically. No code changes.
25
24
 
26
- ## Flags
25
+ For runtimes that ignore `NODE_OPTIONS` / `.pth` (Bun, Deno, Vercel Edge, Go, Rust, etc.), call the HTTP API directly: `POST https://api.robotresources.ai/v1/route`. Authed by API key, 100 req/min, CORS open.
27
26
 
27
+ For explicit control inside JS / Python code, use the routing-decision library:
28
+
29
+ ```bash
30
+ npm install @robot-resources/router # JS / TS
31
+ pip install robot-resources # Python (singular package name)
28
32
  ```
29
- --for=<target> langchain | python | cursor | claude-code | docs
30
- Skip the prompt and run that path directly.
31
- Required for non-TTY contexts (CI, piped, etc.)
32
- --non-interactive Treat as CI run regardless of TTY state
33
- --yes / -y Same as --non-interactive
33
+
34
+ ```js
35
+ import { routePrompt } from '@robot-resources/router/routing';
36
+ const decision = routePrompt('write a python function that reverses a string');
37
+ // decision.selected_model → 'claude-haiku-4-5' (or similar — cheapest qualifying)
34
38
  ```
35
39
 
36
- Without flags in a non-TTY context, the wizard prints the `--for=` hint and exits cleanly — never blocks waiting for stdin.
40
+ ```python
41
+ from robot_resources.router import route
42
+ decision = route('write a python function that reverses a string')
43
+ ```
37
44
 
38
- ## Pre-set the API key
45
+ Returns a routing decision; your code makes the actual LLM call with the selected model. Each request goes from your machine straight to the lab's API (`api.anthropic.com` / `api.openai.com` / `generativelanguage.googleapis.com`) using your existing key for that lab. Nothing is relayed through our infrastructure.
39
46
 
40
- For fleets or CI:
47
+ ## Scraper
41
48
 
42
- ```bash
43
- export RR_API_KEY=rr_live_... # skip signup, use this key
44
- npx robot-resources --for=cursor # or whatever path applies
45
- ```
49
+ Token compression for web content. Fetches any URL, strips noise, returns clean markdown with token count. Median 91% token reduction per page (verified across 41 page types). Mozilla Readability extraction (0.97 F1). Content-aware token estimation calibrated per content type, ±15% of actual BPE. 3-tier fetch (fast / stealth via TLS fingerprint / render via headless browser), BFS multi-page crawl, robots.txt compliance.
46
50
 
47
- ## Five paths, one wizard
51
+ Three ways to consume:
48
52
 
49
- | Path | What you get | Where |
50
- |---|---|---|
51
- | OpenClaw plugin | In-process router inside the OC gateway. Auto-routes Anthropic calls to the cheapest capable model. | `~/.openclaw/extensions/robot-resources-router/` |
52
- | JS/TS agent | `@robot-resources/router/routing` — pure ESM, zero deps, offline keyword classifier. | npm |
53
- | Python agent | `robot-resources` (singular) — thin httpx client over `/v1/route`. | PyPI |
54
- | HTTP API | Any language with curl/fetch. Authed by API key. | `POST https://api.robotresources.ai/v1/route` |
55
- | Cursor / Claude Code MCP | Scraper MCP wired into your tool's config (web fetches → 91% smaller markdown). | `~/.cursor/mcp.json` or `~/.claude/settings.json` |
53
+ - **JS library** `npm install @robot-resources/scraper` `import { scrape } from '@robot-resources/scraper'`
54
+ - **MCP server** — `npx -y @robot-resources/scraper scraper-mcp` exposes `scraper_compress_url(url)` and crawl tools to any MCP-compatible client. Auto-wired into OpenClaw by the wizard; for other clients (Cursor, Claude Code, Windsurf), add manually to your client's MCP config.
55
+ - **OpenClaw plugin** installed automatically via `npx robot-resources`. Hooks `before_tool_call` to redirect `web_fetch` through scraper compression.
56
56
 
57
- Full integration docs: https://robotresources.ai/docs
57
+ No API keys, no config.
58
58
 
59
- ## Architecture (post-PR-2.5)
59
+ ## Deploying to production
60
60
 
61
- The router used to be a Python daemon on `localhost:3838`. **Not anymore.** It now runs in-process inside whichever surface consumes it:
61
+ The wizard's shell-config install reaches dev machines only production processes don't read `.bashrc`, and env vars come from your deploy config. Copy-paste recipes for setting `NODE_OPTIONS` (Node) or installing the `.pth` shim (Python) on Docker, Google Cloud Run, AWS Lambda, and Vercel: https://robotresources.ai/docs/deploy/.
62
62
 
63
- - **OpenClaw** — the plugin's `register()` starts an HTTP server on `127.0.0.1:18790` inside OC's node process. Lifetime tied to OC. Zero daemon to keep alive.
64
- - **JS agents** — call `routePrompt()` directly. No HTTP at all. Pure function.
65
- - **Python / curl** — call `POST /v1/route` on `api.robotresources.ai`. Server-side classifier on Cloudflare Workers.
63
+ ## Advanced
66
64
 
67
- User provider keys never leave the user's machine. The platform never receives, stores, or transmits them.
65
+ ```
66
+ npx robot-resources [flags]
68
67
 
69
- ## Telemetry
68
+ --for=<target> langchain | python | cursor | claude-code | docs
69
+ Skip the prompt and run that path directly.
70
+ Required for non-TTY contexts (CI, piped, etc.)
71
+ --non-interactive Treat as CI run regardless of TTY state
72
+ --yes / -y Same as --non-interactive
73
+ ```
70
74
 
71
- Anonymous, fire-and-forget, opt-in via the wizard's API-key provisioning. Events: `wizard_started`, `wizard_path_chosen`, `install_complete`, `route_completed`, `route_via_api`, `route_via_lib`. No personal data, no request content, no provider keys.
75
+ Pre-set the API key for fleets or CI (skips signup, uses the key you provide):
76
+
77
+ ```bash
78
+ export RR_API_KEY=rr_live_...
79
+ npx robot-resources --for=langchain
80
+ ```
72
81
 
73
82
  ## Pricing
74
83
 
75
- Free. Unlimited. Your API keys never leave your machine.
84
+ Free. Unlimited. No tiers. You pay your AI providers directly — no markup, no rate limits, no quotas.
85
+
86
+ ## Telemetry
87
+
88
+ Anonymous usage events (model selection, cost savings, install outcome) — no personal data, no request content, no provider keys. Opt out with `RR_TELEMETRY=off`.
76
89
 
77
90
  ## Links
78
91
 
@@ -80,11 +93,11 @@ Free. Unlimited. Your API keys never leave your machine.
80
93
  - Docs: https://robotresources.ai/docs
81
94
  - Dashboard: https://robotresources.ai/dashboard
82
95
  - HTTP API: `POST https://api.robotresources.ai/v1/route`
83
- - npm: https://www.npmjs.com/package/robot-resources
84
96
  - GitHub: https://github.com/robot-resources/packages
85
97
  - Discord: https://robotresources.ai/discord
86
98
  - Contact: agent@robotresources.ai
87
- - Agent docs: https://robotresources.ai/llms.txt
99
+
100
+ > AI agents installing this on a human's behalf: see https://robotresources.ai/llms.txt for the agent install protocol.
88
101
 
89
102
  ## License
90
103
 
@@ -106,7 +106,8 @@ async function showJsPath() {
106
106
  }
107
107
  blank();
108
108
  info('Once your shell picks up the new NODE_OPTIONS, every Node agent on');
109
- info('this machine routes Anthropic SDK calls through Robot Resources.');
109
+ info('this machine routes Anthropic, OpenAI, and Google SDK calls through');
110
+ info('Robot Resources.');
110
111
  if (process.platform === 'win32') {
111
112
  info('Open a new cmd / PowerShell window — current terminals will not see the change.');
112
113
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "robot-resources",
3
- "version": "1.14.0",
3
+ "version": "1.14.2",
4
4
  "description": "Robot Resources — AI agent tools. One command to install everything.",
5
5
  "type": "module",
6
6
  "bin": {