@mobileai/react-native 0.1.0 → 0.3.0

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 (35) hide show
  1. package/README.md +78 -7
  2. package/lib/module/components/AIAgent.js +40 -4
  3. package/lib/module/components/AIAgent.js.map +1 -1
  4. package/lib/module/components/AgentChatBar.js +177 -29
  5. package/lib/module/components/AgentChatBar.js.map +1 -1
  6. package/lib/module/core/AgentRuntime.js +268 -126
  7. package/lib/module/core/AgentRuntime.js.map +1 -1
  8. package/lib/module/core/FiberTreeWalker.js +74 -20
  9. package/lib/module/core/FiberTreeWalker.js.map +1 -1
  10. package/lib/module/core/systemPrompt.js +164 -0
  11. package/lib/module/core/systemPrompt.js.map +1 -0
  12. package/lib/module/providers/GeminiProvider.js +189 -73
  13. package/lib/module/providers/GeminiProvider.js.map +1 -1
  14. package/lib/typescript/src/components/AIAgent.d.ts +9 -1
  15. package/lib/typescript/src/components/AIAgent.d.ts.map +1 -1
  16. package/lib/typescript/src/components/AgentChatBar.d.ts +4 -3
  17. package/lib/typescript/src/components/AgentChatBar.d.ts.map +1 -1
  18. package/lib/typescript/src/core/AgentRuntime.d.ts +16 -0
  19. package/lib/typescript/src/core/AgentRuntime.d.ts.map +1 -1
  20. package/lib/typescript/src/core/FiberTreeWalker.d.ts +5 -0
  21. package/lib/typescript/src/core/FiberTreeWalker.d.ts.map +1 -1
  22. package/lib/typescript/src/core/systemPrompt.d.ts +9 -0
  23. package/lib/typescript/src/core/systemPrompt.d.ts.map +1 -0
  24. package/lib/typescript/src/core/types.d.ts +51 -13
  25. package/lib/typescript/src/core/types.d.ts.map +1 -1
  26. package/lib/typescript/src/providers/GeminiProvider.d.ts +33 -13
  27. package/lib/typescript/src/providers/GeminiProvider.d.ts.map +1 -1
  28. package/package.json +16 -14
  29. package/src/components/AIAgent.tsx +41 -1
  30. package/src/components/AgentChatBar.tsx +150 -28
  31. package/src/core/AgentRuntime.ts +287 -131
  32. package/src/core/FiberTreeWalker.ts +74 -19
  33. package/src/core/systemPrompt.ts +162 -0
  34. package/src/core/types.ts +58 -10
  35. package/src/providers/GeminiProvider.ts +174 -101
package/README.md CHANGED
@@ -1,9 +1,15 @@
1
- # @mobileai/react-native
1
+ # MobileAI — React Native AI Agent
2
2
 
3
3
  > **Autonomous AI agent for React Native** — Your app gets an AI copilot that can see, understand, and interact with your UI. Zero wrappers, zero view rewriting.
4
4
 
5
- [![npm](https://img.shields.io/npm/v/@mobileai/react-native)](https://www.npmjs.com/package/@mobileai/react-native)
6
- [![license](https://img.shields.io/npm/l/@mobileai/react-native)](https://github.com/mohamed2m2018/react-native-ai-agent/blob/main/LICENSE)
5
+ **Two names, one package — install either:**
6
+
7
+ | | Package | npm |
8
+ |---|---|---|
9
+ | 📦 | `@mobileai/react-native` | [![npm](https://img.shields.io/npm/v/@mobileai/react-native?label=latest)](https://www.npmjs.com/package/@mobileai/react-native) |
10
+ | 📦 | `react-native-agentic-ai` | [![npm](https://img.shields.io/npm/v/react-native-agentic-ai?label=latest)](https://www.npmjs.com/package/react-native-agentic-ai) |
11
+
12
+ [![license](https://img.shields.io/npm/l/@mobileai/react-native)](https://github.com/mohamed2m2018/mobileai-react-native/blob/main/LICENSE)
7
13
  [![platform](https://img.shields.io/badge/platform-iOS%20%7C%20Android-brightgreen)]()
8
14
 
9
15
  Wrap your navigation with `<AIAgent>`. The AI automatically understands your entire screen — every button, every input, every label — and acts on it.
@@ -21,6 +27,8 @@ Wrap your navigation with `<AIAgent>`. The AI automatically understands your ent
21
27
 
22
28
  ```bash
23
29
  npm install @mobileai/react-native
30
+ # — or —
31
+ npm install react-native-agentic-ai
24
32
  ```
25
33
 
26
34
  No native modules required. Works with Expo managed workflow out of the box — **no eject needed**.
@@ -29,6 +37,7 @@ No native modules required. Works with Expo managed workflow out of the box —
29
37
 
30
38
  ```tsx
31
39
  import { AIAgent } from '@mobileai/react-native';
40
+ // or: import { AIAgent } from 'react-native-agentic-ai';
32
41
  import { NavigationContainer, useNavigationContainerRef } from '@react-navigation/native';
33
42
 
34
43
  export default function App() {
@@ -68,6 +77,7 @@ Register a **non-UI action** the AI can call — for business logic that isn't a
68
77
 
69
78
  ```tsx
70
79
  import { useAction } from '@mobileai/react-native';
80
+ // or: import { useAction } from 'react-native-agentic-ai';
71
81
 
72
82
  function CartScreen() {
73
83
  const { clearCart, getTotal } = useCart();
@@ -159,15 +169,76 @@ useAction('checkout', 'Place the order', {}, () => {
159
169
  | `onBeforeTask` | Called before task execution starts. |
160
170
  | `onAfterTask` | Called after task completes. |
161
171
 
162
- ## 🌐 MCP Bridge
172
+ ## 🌐 MCP Bridge (Control Your App from Desktop AI)
173
+
174
+ The MCP (Model Context Protocol) bridge lets **external AI agents** — like Claude Desktop, OpenClaw, or any MCP-compatible client — remotely control your React Native app through natural language.
175
+
176
+ ### Architecture
177
+
178
+ ```
179
+ ┌──────────────────┐ SSE/HTTP ┌──────────────────┐ WebSocket ┌──────────────────┐
180
+ │ Claude Desktop │ ◄──────────────► │ MCP Server │ ◄─────────────► │ Your React │
181
+ │ or any MCP │ (port 3100) │ (Node.js) │ (port 3101) │ Native App │
182
+ │ compatible AI │ │ │ │ │
183
+ └──────────────────┘ └──────────────────┘ └──────────────────┘
184
+ ```
185
+
186
+ ### How It Works
187
+
188
+ 1. The **MCP server** (included in `mcp-server/`) runs on your machine as a Node.js process
189
+ 2. Your **React Native app** connects to the server via WebSocket (`ws://localhost:3101`)
190
+ 3. An **external AI** (e.g., Claude Desktop) connects to the MCP server via SSE (`http://localhost:3100/mcp/sse`)
191
+ 4. When Claude sends a command like *"Order 2 lemonades"*, the MCP server forwards it to your app
192
+ 5. Your app's `AgentRuntime` executes the task autonomously and sends back the result
193
+
194
+ ### Setup
195
+
196
+ **1. Start the MCP server:**
197
+
198
+ ```bash
199
+ cd mcp-server
200
+ npm install
201
+ npm start
202
+ ```
163
203
 
164
- Connect external AI agents to your app via the Model Context Protocol:
204
+ This starts two servers:
205
+ - **HTTP/SSE** on `http://localhost:3100` — for AI clients (Claude, OpenClaw)
206
+ - **WebSocket** on `ws://localhost:3101` — for your React Native app
207
+
208
+ **2. Connect your app:**
165
209
 
166
210
  ```tsx
167
- <AIAgent apiKey="..." mcpServerUrl="ws://localhost:3101" />
211
+ <AIAgent
212
+ apiKey="YOUR_GEMINI_KEY"
213
+ mcpServerUrl="ws://localhost:3101"
214
+ />
168
215
  ```
169
216
 
170
- See the `mcp-server/` directory for the companion Node.js server setup.
217
+ **3. Connect Claude Desktop** add this to your Claude config (`~/Library/Application Support/Claude/claude_desktop_config.json`):
218
+
219
+ ```json
220
+ {
221
+ "mcpServers": {
222
+ "mobile-app": {
223
+ "url": "http://localhost:3100/mcp/sse"
224
+ }
225
+ }
226
+ }
227
+ ```
228
+
229
+ ### Available MCP Tools
230
+
231
+ | Tool | Description |
232
+ |------|-------------|
233
+ | `execute_task(command)` | Send a natural language task to the app (e.g., *"Add a burger to cart"*) |
234
+ | `get_app_status()` | Check if the React Native app is currently connected |
235
+
236
+ ### Environment Variables
237
+
238
+ | Variable | Default | Description |
239
+ |----------|---------|-------------|
240
+ | `MCP_PORT` | `3100` | HTTP/SSE port for AI clients |
241
+ | `WS_PORT` | `3101` | WebSocket port for the React Native app |
171
242
 
172
243
  ## 🛠️ Built-in Tools
173
244
 
@@ -46,13 +46,18 @@ export function AIAgent({
46
46
  customTools,
47
47
  instructions,
48
48
  stepDelay,
49
- mcpServerUrl
49
+ mcpServerUrl,
50
+ router,
51
+ pathname
50
52
  }) {
51
53
  const rootViewRef = useRef(null);
52
54
  const [isThinking, setIsThinking] = useState(false);
53
55
  const [statusText, setStatusText] = useState('');
54
56
  const [lastResult, setLastResult] = useState(null);
55
57
 
58
+ // Ref-based resolver for ask_user — stays alive across renders
59
+ const askUserResolverRef = useRef(null);
60
+
56
61
  // ─── Create Runtime ──────────────────────────────────────────
57
62
 
58
63
  const config = useMemo(() => ({
@@ -70,8 +75,25 @@ export function AIAgent({
70
75
  customTools,
71
76
  instructions,
72
77
  stepDelay,
73
- mcpServerUrl
74
- }), [apiKey, model, language, maxSteps, interactiveBlacklist, interactiveWhitelist, onBeforeStep, onAfterStep, onBeforeTask, onAfterTask, transformScreenContent, customTools, instructions, stepDelay, mcpServerUrl]);
78
+ mcpServerUrl,
79
+ router,
80
+ pathname,
81
+ onStatusUpdate: setStatusText,
82
+ // Page-agent pattern: block the agent loop until user responds
83
+ onAskUser: question => {
84
+ return new Promise(resolve => {
85
+ askUserResolverRef.current = resolve;
86
+ // Show question in chat bar, allow user input
87
+ setLastResult({
88
+ success: true,
89
+ message: `❓ ${question}`,
90
+ steps: []
91
+ });
92
+ setIsThinking(false);
93
+ setStatusText('');
94
+ });
95
+ }
96
+ }), [apiKey, model, language, maxSteps, interactiveBlacklist, interactiveWhitelist, onBeforeStep, onAfterStep, onBeforeTask, onAfterTask, transformScreenContent, customTools, instructions, stepDelay, mcpServerUrl, router, pathname]);
75
97
  const provider = useMemo(() => new GeminiProvider(apiKey, model), [apiKey, model]);
76
98
  const runtime = useMemo(() => new AgentRuntime(provider, config, rootViewRef.current, navRef),
77
99
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -98,6 +120,19 @@ export function AIAgent({
98
120
  const handleSend = useCallback(async message => {
99
121
  if (!message.trim()) return;
100
122
  logger.info('AIAgent', `User message: "${message}"`);
123
+
124
+ // If there's a pending ask_user, resolve it instead of starting a new execution
125
+ if (askUserResolverRef.current) {
126
+ const resolver = askUserResolverRef.current;
127
+ askUserResolverRef.current = null;
128
+ setIsThinking(true);
129
+ setStatusText('Processing your answer...');
130
+ setLastResult(null);
131
+ resolver(message);
132
+ return;
133
+ }
134
+
135
+ // Normal execution — new task
101
136
  setIsThinking(true);
102
137
  setStatusText('Thinking...');
103
138
  setLastResult(null);
@@ -137,7 +172,8 @@ export function AIAgent({
137
172
  onSend: handleSend,
138
173
  isThinking: isThinking,
139
174
  lastResult: lastResult,
140
- language: language
175
+ language: language,
176
+ onDismiss: () => setLastResult(null)
141
177
  })]
142
178
  });
143
179
  }
@@ -1 +1 @@
1
- {"version":3,"names":["React","useCallback","useEffect","useMemo","useRef","useState","View","StyleSheet","AgentRuntime","GeminiProvider","AgentContext","AgentChatBar","AgentOverlay","logger","MCPBridge","jsx","_jsx","jsxs","_jsxs","AIAgent","apiKey","model","navRef","language","maxSteps","showChatBar","children","onResult","interactiveBlacklist","interactiveWhitelist","onBeforeStep","onAfterStep","onBeforeTask","onAfterTask","transformScreenContent","customTools","instructions","stepDelay","mcpServerUrl","rootViewRef","isThinking","setIsThinking","statusText","setStatusText","lastResult","setLastResult","config","provider","runtime","current","updateRefs","info","bridge","destroy","handleSend","message","trim","result","execute","success","error","steps","Provider","value","ref","style","styles","root","collapsable","visible","onSend","create","flex"],"sourceRoot":"../../../src","sources":["components/AIAgent.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IACVC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SAASC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAC/C,SAASC,YAAY,QAAQ,yBAAsB;AACnD,SAASC,cAAc,QAAQ,gCAA6B;AAC5D,SAASC,YAAY,QAAQ,uBAAoB;AACjD,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,MAAM,QAAQ,oBAAiB;AACxC,SAASC,SAAS,QAAQ,sBAAmB;;AAG7C;;AAGA;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAiDA;;AAEA,OAAO,SAASC,OAAOA,CAAC;EACtBC,MAAM;EACNC,KAAK,GAAG,kBAAkB;EAC1BC,MAAM;EACNC,QAAQ,GAAG,IAAI;EACfC,QAAQ,GAAG,EAAE;EACbC,WAAW,GAAG,IAAI;EAClBC,QAAQ;EACRC,QAAQ;EACR;EACAC,oBAAoB;EACpBC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EAAEA,KAAK,CAAC;MACnDf,aAAa,CAAC;QACZc,OAAO,EAAE,KAAK;QACdJ,OAAO,EAAE,UAAUK,KAAK,CAACL,OAAO,EAAE;QAClCM,KAAK,EAAE;MACT,CAAC,CAAC;IACJ,CAAC,SAAS;MACRpB,aAAa,CAAC,KAAK,CAAC;MACpBE,aAAa,CAAC,EAAE,CAAC;IACnB;EACF,CAAC,EAAE,CAACK,OAAO,EAAE1B,MAAM,EAAEK,QAAQ,CAAC,CAAC;;EAE/B;;EAEA,oBACET,KAAA,CAACR,YAAY,CAACoD,QAAQ;IAACC,KAAK,EAAEf,OAAQ;IAAAtB,QAAA,gBACpCV,IAAA,CAACV,IAAI;MAAC0D,GAAG,EAAEzB,WAAY;MAAC0B,KAAK,EAAEC,MAAM,CAACC,IAAK;MAACC,WAAW,EAAE,KAAM;MAAA1C,QAAA,EAC5DA;IAAQ,CACL,CAAC,eAGPV,IAAA,CAACJ,YAAY;MAACyD,OAAO,EAAE7B,UAAW;MAACE,UAAU,EAAEA;IAAW,CAAE,CAAC,EAG5DjB,WAAW,iBACVT,IAAA,CAACL,YAAY;MACX2D,MAAM,EAAEhB,UAAW;MACnBd,UAAU,EAAEA,UAAW;MACvBI,UAAU,EAAEA,UAAW;MACvBrB,QAAQ,EAAEA;IAAS,CACpB,CACF;EAAA,CACoB,CAAC;AAE5B;AAEA,MAAM2C,MAAM,GAAG3D,UAAU,CAACgE,MAAM,CAAC;EAC/BJ,IAAI,EAAE;IACJK,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useCallback","useEffect","useMemo","useRef","useState","View","StyleSheet","AgentRuntime","GeminiProvider","AgentContext","AgentChatBar","AgentOverlay","logger","MCPBridge","jsx","_jsx","jsxs","_jsxs","AIAgent","apiKey","model","navRef","language","maxSteps","showChatBar","children","onResult","interactiveBlacklist","interactiveWhitelist","onBeforeStep","onAfterStep","onBeforeTask","onAfterTask","transformScreenContent","customTools","instructions","stepDelay","mcpServerUrl","router","pathname","rootViewRef","isThinking","setIsThinking","statusText","setStatusText","lastResult","setLastResult","askUserResolverRef","config","onStatusUpdate","onAskUser","question","Promise","resolve","current","success","message","steps","provider","runtime","updateRefs","info","bridge","destroy","handleSend","trim","resolver","result","execute","error","Provider","value","ref","style","styles","root","collapsable","visible","onSend","onDismiss","create","flex"],"sourceRoot":"../../../src","sources":["components/AIAgent.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IACVC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SAASC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAC/C,SAASC,YAAY,QAAQ,yBAAsB;AACnD,SAASC,cAAc,QAAQ,gCAA6B;AAC5D,SAASC,YAAY,QAAQ,uBAAoB;AACjD,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,MAAM,QAAQ,oBAAiB;AACxC,SAASC,SAAS,QAAQ,sBAAmB;;AAG7C;;AAGA;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAyDA;;AAEA,OAAO,SAASC,OAAOA,CAAC;EACtBC,MAAM;EACNC,KAAK,GAAG,kBAAkB;EAC1BC,MAAM;EACNC,QAAQ,GAAG,IAAI;EACfC,QAAQ,GAAG,EAAE;EACbC,WAAW,GAAG,IAAI;EAClBC,QAAQ;EACRC,QAAQ;EACR;EACAC,oBAAoB;EACpBC,oBAAoB;EACpBC,YAAY;EACZC,WAAW;EACXC,YAAY;EACZC,WAAW;EACXC,sBAAsB;EACtBC,WAAW;EACXC,YAAY;EACZC,SAAS;EACTC,YAAY;EACZC,MAAM;EACNC;AACY,CAAC,EAAE;EACf,MAAMC,WAAW,GAAGrC,MAAM,CAAM,IAAI,CAAC;EACrC,MAAM,CAACsC,UAAU,EAAEC,aAAa,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,iBACVT,IAAA,CAACL,YAAY;MACXoE,MAAM,EAAEd,UAAW;MACnBvB,UAAU,EAAEA,UAAW;MACvBI,UAAU,EAAEA,UAAW;MACvBvB,QAAQ,EAAEA,QAAS;MACnByD,SAAS,EAAEA,CAAA,KAAMjC,aAAa,CAAC,IAAI;IAAE,CACtC,CACF;EAAA,CACoB,CAAC;AAE5B;AAEA,MAAM4B,MAAM,GAAGpE,UAAU,CAAC0E,MAAM,CAAC;EAC/BL,IAAI,EAAE;IACJM,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,41 +1,121 @@
1
1
  "use strict";
2
2
 
3
3
  /**
4
- * AgentChatBar — Floating chat input at the bottom of the screen.
5
- * User sends messages here, and results are shown inline.
4
+ * AgentChatBar — Floating, draggable, compressible chat widget.
5
+ * Does not block underlying UI natively.
6
6
  */
7
7
 
8
- import { useState } from 'react';
9
- import { View, TextInput, Pressable, Text, StyleSheet, KeyboardAvoidingView, Platform } from 'react-native';
8
+ import { useState, useRef } from 'react';
9
+ import { View, TextInput, Pressable, Text, StyleSheet, Animated, PanResponder, useWindowDimensions } from 'react-native';
10
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  export function AgentChatBar({
12
12
  onSend,
13
13
  isThinking,
14
14
  lastResult,
15
- language
15
+ language,
16
+ onDismiss
16
17
  }) {
17
18
  const [text, setText] = useState('');
19
+ const [isExpanded, setIsExpanded] = useState(false);
20
+ const {
21
+ height
22
+ } = useWindowDimensions();
18
23
  const isArabic = language === 'ar';
24
+
25
+ // Initial position: Bottom right for FAB, Bottom center for Expanded
26
+ // For simplicity, we just initialize to a safe generic spot on screen.
27
+ const pan = useRef(new Animated.ValueXY({
28
+ x: 10,
29
+ y: height - 200
30
+ })).current;
31
+
32
+ // PanResponder for dragging the widget
33
+ const panResponder = useRef(PanResponder.create({
34
+ onMoveShouldSetPanResponder: (_, gestureState) => {
35
+ // Only trigger drag if moving more than 5px (allows taps to register inside)
36
+ return Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5;
37
+ },
38
+ onPanResponderGrant: () => {
39
+ pan.setOffset({
40
+ x: pan.x._value,
41
+ y: pan.y._value
42
+ });
43
+ pan.setValue({
44
+ x: 0,
45
+ y: 0
46
+ });
47
+ },
48
+ onPanResponderMove: Animated.event([null, {
49
+ dx: pan.x,
50
+ dy: pan.y
51
+ }], {
52
+ useNativeDriver: false
53
+ }),
54
+ onPanResponderRelease: () => {
55
+ pan.flattenOffset();
56
+ }
57
+ })).current;
19
58
  const handleSend = () => {
20
59
  if (text.trim() && !isThinking) {
21
60
  onSend(text.trim());
22
61
  setText('');
23
62
  }
24
63
  };
25
- return /*#__PURE__*/_jsxs(KeyboardAvoidingView, {
26
- behavior: Platform.OS === 'ios' ? 'padding' : undefined,
27
- style: styles.container,
28
- children: [lastResult && /*#__PURE__*/_jsx(View, {
64
+
65
+ // ─── Compressed State (FAB) ───
66
+ if (!isExpanded) {
67
+ return /*#__PURE__*/_jsx(Animated.View, {
68
+ style: [styles.fabContainer, pan.getLayout()],
69
+ ...panResponder.panHandlers,
70
+ children: /*#__PURE__*/_jsx(Pressable, {
71
+ style: styles.fab,
72
+ onPress: () => setIsExpanded(true),
73
+ accessibilityLabel: "Open AI Agent Chat",
74
+ children: /*#__PURE__*/_jsx(Text, {
75
+ style: styles.fabIcon,
76
+ children: isThinking ? '⏳' : '🤖'
77
+ })
78
+ })
79
+ });
80
+ }
81
+
82
+ // ─── Expanded State (Widget) ───
83
+ return /*#__PURE__*/_jsxs(Animated.View, {
84
+ style: [styles.expandedContainer, pan.getLayout()],
85
+ children: [/*#__PURE__*/_jsxs(View, {
86
+ ...panResponder.panHandlers,
87
+ style: styles.dragHandleArea,
88
+ accessibilityLabel: "Drag AI Agent",
89
+ children: [/*#__PURE__*/_jsx(View, {
90
+ style: styles.dragGrip
91
+ }), /*#__PURE__*/_jsx(Pressable, {
92
+ onPress: () => setIsExpanded(false),
93
+ style: styles.minimizeBtn,
94
+ accessibilityLabel: "Minimize AI Agent",
95
+ children: /*#__PURE__*/_jsx(Text, {
96
+ style: styles.minimizeText,
97
+ children: "\u2014"
98
+ })
99
+ })]
100
+ }), lastResult && /*#__PURE__*/_jsxs(View, {
29
101
  style: [styles.resultBubble, lastResult.success ? styles.resultSuccess : styles.resultError],
30
- children: /*#__PURE__*/_jsx(Text, {
102
+ children: [/*#__PURE__*/_jsx(Text, {
31
103
  style: styles.resultText,
32
104
  children: lastResult.message
33
- })
105
+ }), onDismiss && /*#__PURE__*/_jsx(Pressable, {
106
+ style: styles.dismissButton,
107
+ onPress: onDismiss,
108
+ hitSlop: 12,
109
+ children: /*#__PURE__*/_jsx(Text, {
110
+ style: styles.dismissText,
111
+ children: "\u2715"
112
+ })
113
+ })]
34
114
  }), /*#__PURE__*/_jsxs(View, {
35
115
  style: styles.inputRow,
36
116
  children: [/*#__PURE__*/_jsx(TextInput, {
37
117
  style: [styles.input, isArabic && styles.inputRTL],
38
- placeholder: isArabic ? 'اكتب طلبك...' : 'Ask the AI agent...',
118
+ placeholder: isArabic ? 'اكتب طلبك...' : 'Ask AI...',
39
119
  placeholderTextColor: "#999",
40
120
  value: text,
41
121
  onChangeText: setText,
@@ -47,6 +127,7 @@ export function AgentChatBar({
47
127
  style: [styles.sendButton, isThinking && styles.sendButtonDisabled],
48
128
  onPress: handleSend,
49
129
  disabled: isThinking || !text.trim(),
130
+ accessibilityLabel: "Send request to AI Agent",
50
131
  children: /*#__PURE__*/_jsx(Text, {
51
132
  style: styles.sendButtonText,
52
133
  children: isThinking ? '⏳' : '🚀'
@@ -56,22 +137,79 @@ export function AgentChatBar({
56
137
  });
57
138
  }
58
139
  const styles = StyleSheet.create({
59
- container: {
140
+ // FAB Styles
141
+ fabContainer: {
60
142
  position: 'absolute',
61
- bottom: 0,
62
- left: 0,
63
- right: 0,
64
- paddingHorizontal: 12,
65
- paddingBottom: Platform.OS === 'ios' ? 34 : 12,
66
- paddingTop: 8,
143
+ zIndex: 9999
144
+ },
145
+ fab: {
146
+ width: 60,
147
+ height: 60,
148
+ borderRadius: 30,
149
+ backgroundColor: '#1a1a2e',
150
+ justifyContent: 'center',
151
+ alignItems: 'center',
152
+ elevation: 5,
153
+ shadowColor: '#000',
154
+ shadowOffset: {
155
+ width: 0,
156
+ height: 4
157
+ },
158
+ shadowOpacity: 0.3,
159
+ shadowRadius: 6
160
+ },
161
+ fabIcon: {
162
+ fontSize: 28
163
+ },
164
+ // Expanded Styles
165
+ expandedContainer: {
166
+ position: 'absolute',
167
+ zIndex: 9999,
168
+ width: 340,
67
169
  backgroundColor: 'rgba(26, 26, 46, 0.95)',
68
- borderTopLeftRadius: 20,
69
- borderTopRightRadius: 20
170
+ borderRadius: 24,
171
+ padding: 16,
172
+ paddingTop: 8,
173
+ elevation: 8,
174
+ shadowColor: '#000',
175
+ shadowOffset: {
176
+ width: 0,
177
+ height: 8
178
+ },
179
+ shadowOpacity: 0.4,
180
+ shadowRadius: 10
70
181
  },
182
+ dragHandleArea: {
183
+ width: '100%',
184
+ height: 30,
185
+ justifyContent: 'center',
186
+ alignItems: 'center',
187
+ marginBottom: 8
188
+ },
189
+ dragGrip: {
190
+ width: 40,
191
+ height: 5,
192
+ backgroundColor: 'rgba(255, 255, 255, 0.3)',
193
+ borderRadius: 4
194
+ },
195
+ minimizeBtn: {
196
+ position: 'absolute',
197
+ right: 0,
198
+ top: 0,
199
+ padding: 8
200
+ },
201
+ minimizeText: {
202
+ color: '#fff',
203
+ fontSize: 18,
204
+ fontWeight: 'bold'
205
+ },
206
+ // Results & Input
71
207
  resultBubble: {
72
208
  borderRadius: 12,
73
209
  padding: 12,
74
- marginBottom: 8
210
+ marginBottom: 12,
211
+ flexDirection: 'row',
212
+ alignItems: 'flex-start'
75
213
  },
76
214
  resultSuccess: {
77
215
  backgroundColor: 'rgba(40, 167, 69, 0.2)'
@@ -82,7 +220,17 @@ const styles = StyleSheet.create({
82
220
  resultText: {
83
221
  color: '#fff',
84
222
  fontSize: 14,
85
- lineHeight: 20
223
+ lineHeight: 20,
224
+ flex: 1
225
+ },
226
+ dismissButton: {
227
+ marginLeft: 8,
228
+ padding: 2
229
+ },
230
+ dismissText: {
231
+ color: 'rgba(255, 255, 255, 0.6)',
232
+ fontSize: 14,
233
+ fontWeight: 'bold'
86
234
  },
87
235
  inputRow: {
88
236
  flexDirection: 'row',
@@ -92,9 +240,9 @@ const styles = StyleSheet.create({
92
240
  input: {
93
241
  flex: 1,
94
242
  backgroundColor: 'rgba(255, 255, 255, 0.1)',
95
- borderRadius: 24,
243
+ borderRadius: 20,
96
244
  paddingHorizontal: 16,
97
- paddingVertical: 12,
245
+ paddingVertical: 10,
98
246
  color: '#fff',
99
247
  fontSize: 16
100
248
  },
@@ -103,9 +251,9 @@ const styles = StyleSheet.create({
103
251
  writingDirection: 'rtl'
104
252
  },
105
253
  sendButton: {
106
- width: 44,
107
- height: 44,
108
- borderRadius: 22,
254
+ width: 40,
255
+ height: 40,
256
+ borderRadius: 20,
109
257
  backgroundColor: 'rgba(255, 255, 255, 0.15)',
110
258
  justifyContent: 'center',
111
259
  alignItems: 'center'
@@ -114,7 +262,7 @@ const styles = StyleSheet.create({
114
262
  opacity: 0.5
115
263
  },
116
264
  sendButtonText: {
117
- fontSize: 20
265
+ fontSize: 18
118
266
  }
119
267
  });
120
268
  //# sourceMappingURL=AgentChatBar.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useState","View","TextInput","Pressable","Text","StyleSheet","KeyboardAvoidingView","Platform","jsx","_jsx","jsxs","_jsxs","AgentChatBar","onSend","isThinking","lastResult","language","text","setText","isArabic","handleSend","trim","behavior","OS","undefined","style","styles","container","children","resultBubble","success","resultSuccess","resultError","resultText","message","inputRow","input","inputRTL","placeholder","placeholderTextColor","value","onChangeText","onSubmitEditing","returnKeyType","editable","multiline","sendButton","sendButtonDisabled","onPress","disabled","sendButtonText","create","position","bottom","left","right","paddingHorizontal","paddingBottom","paddingTop","backgroundColor","borderTopLeftRadius","borderTopRightRadius","borderRadius","padding","marginBottom","color","fontSize","lineHeight","flexDirection","alignItems","gap","flex","paddingVertical","textAlign","writingDirection","width","height","justifyContent","opacity"],"sourceRoot":"../../../src","sources":["components/AgentChatBar.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,OAAO;AAChC,SACEC,IAAI,EACJC,SAAS,EACTC,SAAS,EACTC,IAAI,EACJC,UAAU,EACVC,oBAAoB,EACpBC,QAAQ,QACH,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAUtB,OAAO,SAASC,YAAYA,CAAC;EAAEC,MAAM;EAAEC,UAAU;EAAEC,UAAU;EAAEC;AAA4B,CAAC,EAAE;EAC5F,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGlB,QAAQ,CAAC,EAAE,CAAC;EACpC,MAAMmB,QAAQ,GAAGH,QAAQ,KAAK,IAAI;EAElC,MAAMI,UAAU,GAAGA,CAAA,KAAM;IACvB,IAAIH,IAAI,CAACI,IAAI,CAAC,CAAC,IAAI,CAACP,UAAU,EAAE;MAC9BD,MAAM,CAACI,IAAI,CAACI,IAAI,CAAC,CAAC,CAAC;MACnBH,OAAO,CAAC,EAAE,CAAC;IACb;EACF,CAAC;EAED,oBACEP,KAAA,CAACL,oBAAoB;IACnBgB,QAAQ,EAAEf,QAAQ,CAACgB,EAAE,KAAK,KAAK,GAAG,SAAS,GAAGC,SAAU;IACxDC,KAAK,EAAEC,MAAM,CAACC,SAAU;IAAAC,QAAA,GAGvBb,UAAU,iBACTN,IAAA,CAACR,IAAI;MAACwB,KAAK,EAAE,CAACC,MAAM,CAACG,YAAY,EAAEd,UAAU,CAACe,OAAO,GAAGJ,MAAM,CAACK,aAAa,GAAGL,MAAM,CAACM,WAAW,CAAE;MAAAJ,QAAA,eACjGnB,IAAA,CAACL,IAAI;QAACqB,KAAK,EAAEC,MAAM,CAACO,UAAW;QAAAL,QAAA,EAAE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AAC;IACbC,eAAe,EAAE,wBAAwB;IACzCC,mBAAmB,EAAE,EAAE;IACvBC,oBAAoB,EAAE;EACxB,CAAC;EACDhC,YAAY,EAAE;IACZiC,YAAY,EAAE,EAAE;IAChBC,OAAO,EAAE,EAAE;IACXC,YAAY,EAAE;EAChB,CAAC;EACDjC,aAAa,EAAE;IACb4B,eAAe,EAAE;EACnB,CAAC;EACD3B,WAAW,EAAE;IACX2B,eAAe,EAAE;EACnB,CAAC;EACD1B,UAAU,EAAE;IACVgC,KAAK,EAAE,MAAM;IACbC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd,CAAC;EACDhC,QAAQ,EAAE;IACRiC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,GAAG,EAAE;EACP,CAAC;EACDlC,KAAK,EAAE;IACLmC,IAAI,EAAE,CAAC;IACPZ,eAAe,EAAE,0BAA0B;IAC3CG,YAAY,EAAE,EAAE;IAChBN,iBAAiB,EAAE,EAAE;IACrBgB,eAAe,EAAE,EAAE;IACnBP,KAAK,EAAE,MAAM;IACbC,QAAQ,EAAE;EACZ,CAAC;EACD7B,QAAQ,EAAE;IACRoC,SAAS,EAAE,OAAO;IAClBC,gBAAgB,EAAE;EACpB,CAAC;EACD5B,UAAU,EAAE;IACV6B,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,EAAE;IACVd,YAAY,EAAE,EAAE;IAChBH,eAAe,EAAE,2BAA2B;IAC5CkB,cAAc,EAAE,QAAQ;IACxBR,UAAU,EAAE;EACd,CAAC;EACDtB,kBAAkB,EAAE;IAClB+B,OAAO,EAAE;EACX,CAAC;EACD5B,cAAc,EAAE;IACdgB,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useState","useRef","View","TextInput","Pressable","Text","StyleSheet","Animated","PanResponder","useWindowDimensions","jsx","_jsx","jsxs","_jsxs","AgentChatBar","onSend","isThinking","lastResult","language","onDismiss","text","setText","isExpanded","setIsExpanded","height","isArabic","pan","ValueXY","x","y","current","panResponder","create","onMoveShouldSetPanResponder","_","gestureState","Math","abs","dx","dy","onPanResponderGrant","setOffset","_value","setValue","onPanResponderMove","event","useNativeDriver","onPanResponderRelease","flattenOffset","handleSend","trim","style","styles","fabContainer","getLayout","panHandlers","children","fab","onPress","accessibilityLabel","fabIcon","expandedContainer","dragHandleArea","dragGrip","minimizeBtn","minimizeText","resultBubble","success","resultSuccess","resultError","resultText","message","dismissButton","hitSlop","dismissText","inputRow","input","inputRTL","placeholder","placeholderTextColor","value","onChangeText","onSubmitEditing","returnKeyType","editable","multiline","sendButton","sendButtonDisabled","disabled","sendButtonText","position","zIndex","width","borderRadius","backgroundColor","justifyContent","alignItems","elevation","shadowColor","shadowOffset","shadowOpacity","shadowRadius","fontSize","padding","paddingTop","marginBottom","right","top","color","fontWeight","flexDirection","lineHeight","flex","marginLeft","gap","paddingHorizontal","paddingVertical","textAlign","writingDirection","opacity"],"sourceRoot":"../../../src","sources":["components/AgentChatBar.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,MAAM,QAAQ,OAAO;AACxC,SACEC,IAAI,EACJC,SAAS,EACTC,SAAS,EACTC,IAAI,EACJC,UAAU,EACVC,QAAQ,EACRC,YAAY,EACZC,mBAAmB,QACd,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAWtB,OAAO,SAASC,YAAYA,CAAC;EAAEC,MAAM;EAAEC,UAAU;EAAEC,UAAU;EAAEC,QAAQ;EAAEC;AAA6B,CAAC,EAAE;EACvG,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGrB,QAAQ,CAAC,EAAE,CAAC;EACpC,MAAM,CAACsB,UAAU,EAAEC,aAAa,CAAC,GAAGvB,QAAQ,CAAC,KAAK,CAAC;EACnD,MAAM;IAAEwB;EAAO,CAAC,GAAGf,mBAAmB,CAAC,CAAC;EACxC,MA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