bare-agent 0.4.0 → 0.4.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.
package/README.md CHANGED
@@ -73,14 +73,15 @@ Every piece works alone — take what you need, ignore the rest.
73
73
  | **Stream** | Structured event emitter. Pipe as JSONL, subscribe in-process, or custom transport |
74
74
  | **Errors** | Typed hierarchy — `ProviderError`, `ToolError`, `TimeoutError`, `MaxRoundsError`, `CircuitOpenError` |
75
75
  | **Browsing** | Web navigation, clicking, typing, reading via `barebrowse`. Two modes: library tools (inline snapshots, pass to Loop) or CLI session (disk-based snapshots, token-efficient for multi-step flows) |
76
+ | **Mobile** | Android + iOS device control via `baremobile`. Same two modes: library tools (`createMobileTools` — action tools auto-return snapshots) or CLI session (`baremobile` CLI — disk-based snapshots) |
76
77
 
77
78
  **Providers:** OpenAI-compatible (OpenAI, OpenRouter, Groq, vLLM, LM Studio), Anthropic, Ollama, CLIPipe (any CLI tool via stdin/stdout with real-time streaming), Fallback, or bring your own (one method: `generate`). All return the same shape — swap freely.
78
79
 
79
- **Tools:** Any function is a tool. REST APIs, MCP servers, CLI commands, shell scripts — if it's a function, it works. Built-in: `barebrowse` for web browsing (optional) — library tools for inline results or CLI session mode for token-efficient disk-based snapshots.
80
+ **Tools:** Any function is a tool. REST APIs, MCP servers, CLI commands, shell scripts — if it's a function, it works. Built-in: `barebrowse` for web browsing, `baremobile` for Android + iOS device control (both optional) — library tools for inline results or CLI session mode for token-efficient disk-based snapshots.
80
81
 
81
82
  **Cross-language:** Runs as a subprocess. Communicate via JSONL on stdin/stdout from Python, Go, Rust, Ruby, Java, or anything that can spawn a process. Ready-made wrappers in [`contrib/`](contrib/README.md).
82
83
 
83
- **Deps:** 0 required. Optional: `cron-parser` (cron expressions), `better-sqlite3` (SQLite store), `barebrowse` (web browsing).
84
+ **Deps:** 0 required. Optional: `cron-parser` (cron expressions), `better-sqlite3` (SQLite store), `barebrowse` (web browsing), `baremobile` (Android + iOS device control).
84
85
 
85
86
  ---
86
87
 
@@ -141,9 +142,9 @@ Three vanilla JS modules. Zero dependencies. Same API patterns.
141
142
 
142
143
  | | [**bareagent**](https://npmjs.com/package/bare-agent) | [**barebrowse**](https://npmjs.com/package/barebrowse) | [**baremobile**](https://npmjs.com/package/baremobile) |
143
144
  |---|---|---|---|
144
- | **Does** | Gives agents a think→act loop | Gives agents a real browser | Gives agents an Android device |
145
+ | **Does** | Gives agents a think→act loop | Gives agents a real browser | Gives agents Android + iOS devices |
145
146
  | **How** | Goal in → coordinated actions out | URL in → pruned snapshot out | Screen in → pruned snapshot out |
146
- | **Replaces** | LangChain, CrewAI, AutoGen | Playwright, Selenium, Puppeteer | Appium, Espresso, UIAutomator2 |
147
+ | **Replaces** | LangChain, CrewAI, AutoGen | Playwright, Selenium, Puppeteer | Appium, Espresso, XCUITest |
147
148
  | **Interfaces** | Library · CLI · subprocess | Library · CLI · MCP | Library · CLI · MCP |
148
149
  | **Solo or together** | Orchestrates both as tools | Works standalone | Works standalone |
149
150
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-agent",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "files": [
5
5
  "index.js",
6
6
  "src/",
package/tools/mobile.js CHANGED
@@ -173,6 +173,19 @@ async function createMobileTools(opts = {}) {
173
173
  return buf.toString('base64');
174
174
  },
175
175
  },
176
+ {
177
+ name: 'mobile_tap_xy',
178
+ description: 'Tap by pixel coordinates on the mobile screen. Use when elements lack refs. Returns updated snapshot.',
179
+ parameters: {
180
+ type: 'object',
181
+ properties: {
182
+ x: { type: 'number', description: 'X coordinate' },
183
+ y: { type: 'number', description: 'Y coordinate' },
184
+ },
185
+ required: ['x', 'y'],
186
+ },
187
+ execute: async ({ x, y }) => actionAndSnapshot((page) => page.tapXY(x, y)),
188
+ },
176
189
  ];
177
190
 
178
191
  // Android-only tools
@@ -191,19 +204,6 @@ async function createMobileTools(opts = {}) {
191
204
  },
192
205
  execute: async ({ action, extras }) => actionAndSnapshot((page) => page.intent(action, extras || {})),
193
206
  },
194
- {
195
- name: 'mobile_tap_xy',
196
- description: 'Tap by pixel coordinates on the mobile screen. Use when elements lack refs. Returns updated snapshot.',
197
- parameters: {
198
- type: 'object',
199
- properties: {
200
- x: { type: 'number', description: 'X coordinate' },
201
- y: { type: 'number', description: 'Y coordinate' },
202
- },
203
- required: ['x', 'y'],
204
- },
205
- execute: async ({ x, y }) => actionAndSnapshot((page) => page.tapXY(x, y)),
206
- },
207
207
  {
208
208
  name: 'mobile_tap_grid',
209
209
  description: 'Tap by grid cell (e.g. "C5") for vision-based fallback. Use with mobile_grid to get cell layout. Returns updated snapshot.',
@@ -245,6 +245,24 @@ async function createMobileTools(opts = {}) {
245
245
  });
246
246
  }
247
247
 
248
+ // Find tools (both platforms, no device call — reads refMap from last snapshot)
249
+ tools.push({
250
+ name: 'mobile_find_text',
251
+ description: 'Find an interactive element by visible text or accessibility label. Searches the refMap from the last snapshot — no device call. Returns the ref number or null if not found.',
252
+ parameters: {
253
+ type: 'object',
254
+ properties: {
255
+ text: { type: 'string', description: 'Text or label substring to search for' },
256
+ },
257
+ required: ['text'],
258
+ },
259
+ execute: async ({ text }) => {
260
+ const page = await getPage();
261
+ const ref = page.findByText(text);
262
+ return ref !== null && ref !== undefined ? ref : null;
263
+ },
264
+ });
265
+
248
266
  // Wait tools (both platforms)
249
267
  tools.push(
250
268
  {