@mobileai/react-native 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 +34 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,10 @@ Wrap your navigation with `<AIAgent>`. The AI automatically understands your ent
|
|
|
16
16
|
|
|
17
17
|
## ✨ Features
|
|
18
18
|
|
|
19
|
-
- 🤖 **Zero-config UI understanding** — No
|
|
19
|
+
- 🤖 **Zero-config UI understanding** — No annotations, no accessibility labels. The AI reads your entire React Fiber tree automatically.
|
|
20
|
+
- 🎯 **Universal component support** — Works with every React Native component (Pressable, Switch, TextInput, custom components) without modification.
|
|
21
|
+
- 🖼️ **Media inference** — Detects images and videos on screen, captures their URIs, and infers context from parent component names — enabling Gemini's vision capabilities.
|
|
22
|
+
- 📐 **Compact DOM output** — Collapses structural view nesting into flat, token-efficient output. Your 50-level deep navigation bar becomes a single line.
|
|
20
23
|
- 🧭 **Auto-navigation** — Navigates between screens to complete multi-step tasks.
|
|
21
24
|
- 🔒 **Production-grade security** — Element gating, content masking, lifecycle hooks, human-in-the-loop confirmation.
|
|
22
25
|
- 🧩 **Custom actions** — Expose any business logic (checkout, API calls) as AI-callable tools with `useAction`.
|
|
@@ -55,6 +58,33 @@ export default function App() {
|
|
|
55
58
|
|
|
56
59
|
A floating chat bar appears automatically. Ask the AI to navigate, tap buttons, fill forms — it reads your live UI and acts.
|
|
57
60
|
|
|
61
|
+
## 🧠 How It Works
|
|
62
|
+
|
|
63
|
+
The SDK traverses your **React Fiber tree** at runtime and generates a compact, LLM-friendly representation of everything on screen:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
Account Settings
|
|
67
|
+
[image in="SettingsScreen" src="https://randomuser.me/api/portraits/men/32.jpg"]
|
|
68
|
+
Demo User
|
|
69
|
+
demo@test.com
|
|
70
|
+
Profile Information
|
|
71
|
+
Full Name
|
|
72
|
+
[0]<text-input>Enter your name />
|
|
73
|
+
Email Address
|
|
74
|
+
[1]<text-input>Enter your email />
|
|
75
|
+
Notifications
|
|
76
|
+
Email Alerts
|
|
77
|
+
[2]<switch value="true"> />
|
|
78
|
+
Push Notifications
|
|
79
|
+
[3]<switch value="false"> />
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Key design decisions:**
|
|
83
|
+
- **Structural views are transparent** — React Navigation's 50+ nested `<View>` layers are collapsed. Only interactive elements and text content appear.
|
|
84
|
+
- **Media is context-aware** — Images emit `[image in="ComponentName" src="url"]`, giving the LLM both *where* the image is and the full URL for Gemini's vision model.
|
|
85
|
+
- **State is explicit** — Switch values, check states, and input values are emitted as attributes so the LLM knows the current state.
|
|
86
|
+
- **Polymorphic tap** — `tap(index)` works on any component: calls `onPress` for buttons, `onValueChange` for switches, and bubbles up the Fiber tree for custom wrapper components.
|
|
87
|
+
|
|
58
88
|
## 🔌 API Reference
|
|
59
89
|
|
|
60
90
|
### `<AIAgent>` Component
|
|
@@ -244,10 +274,10 @@ This starts two servers:
|
|
|
244
274
|
|
|
245
275
|
| Tool | Description |
|
|
246
276
|
|------|-------------|
|
|
247
|
-
| `tap(index)` | Tap
|
|
248
|
-
| `type(index, text)` | Type text into
|
|
277
|
+
| `tap(index)` | Tap any interactive element. Polymorphic: triggers `onPress` for buttons, `onValueChange` for switches, bubbles up Fiber tree for wrapper components. |
|
|
278
|
+
| `type(index, text)` | Type text into a text-input. |
|
|
249
279
|
| `navigate(screen)` | Navigate to a screen. |
|
|
250
|
-
| `done(text)` | Complete the task. |
|
|
280
|
+
| `done(text)` | Complete the task with a response. |
|
|
251
281
|
| `ask_user(question)` | Ask the user for clarification. |
|
|
252
282
|
|
|
253
283
|
## 📋 Requirements
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mobileai/react-native",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Build autonomous AI agents for React Native and Expo apps. Provides AI-native UI traversal, tool calling, and structured reasoning.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"source": "./src/index.ts",
|