react-native-agentic-ai 0.0.2 → 0.2.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.
- package/LICENSE +20 -0
- package/README.md +253 -14
- package/lib/module/components/AIAgent.js +185 -0
- package/lib/module/components/AIAgent.js.map +1 -0
- package/lib/module/components/AgentChatBar.js +268 -0
- package/lib/module/components/AgentChatBar.js.map +1 -0
- package/lib/module/components/AgentOverlay.js +53 -0
- package/lib/module/components/AgentOverlay.js.map +1 -0
- package/lib/module/core/AgentRuntime.js +640 -0
- package/lib/module/core/AgentRuntime.js.map +1 -0
- package/lib/module/core/FiberTreeWalker.js +362 -0
- package/lib/module/core/FiberTreeWalker.js.map +1 -0
- package/lib/module/core/MCPBridge.js +98 -0
- package/lib/module/core/MCPBridge.js.map +1 -0
- package/lib/module/core/ScreenDehydrator.js +46 -0
- package/lib/module/core/ScreenDehydrator.js.map +1 -0
- package/lib/module/core/systemPrompt.js +164 -0
- package/lib/module/core/systemPrompt.js.map +1 -0
- package/lib/module/core/types.js +2 -0
- package/lib/module/core/types.js.map +1 -0
- package/lib/module/hooks/useAction.js +32 -0
- package/lib/module/hooks/useAction.js.map +1 -0
- package/lib/module/index.js +17 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/providers/GeminiProvider.js +294 -0
- package/lib/module/providers/GeminiProvider.js.map +1 -0
- package/lib/module/utils/logger.js +17 -0
- package/lib/module/utils/logger.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/components/AIAgent.d.ts +65 -0
- package/lib/typescript/src/components/AIAgent.d.ts.map +1 -0
- package/lib/typescript/src/components/AgentChatBar.d.ts +15 -0
- package/lib/typescript/src/components/AgentChatBar.d.ts.map +1 -0
- package/lib/typescript/src/components/AgentOverlay.d.ts +10 -0
- package/lib/typescript/src/components/AgentOverlay.d.ts.map +1 -0
- package/lib/typescript/src/core/AgentRuntime.d.ts +53 -0
- package/lib/typescript/src/core/AgentRuntime.d.ts.map +1 -0
- package/lib/typescript/src/core/FiberTreeWalker.d.ts +31 -0
- package/lib/typescript/src/core/FiberTreeWalker.d.ts.map +1 -0
- package/lib/typescript/src/core/MCPBridge.d.ts +23 -0
- package/lib/typescript/src/core/MCPBridge.d.ts.map +1 -0
- package/lib/typescript/src/core/ScreenDehydrator.d.ts +20 -0
- package/lib/typescript/src/core/ScreenDehydrator.d.ts.map +1 -0
- package/lib/typescript/src/core/systemPrompt.d.ts +9 -0
- package/lib/typescript/src/core/systemPrompt.d.ts.map +1 -0
- package/lib/typescript/src/core/types.d.ts +176 -0
- package/lib/typescript/src/core/types.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useAction.d.ts +13 -0
- package/lib/typescript/src/hooks/useAction.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +10 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/providers/GeminiProvider.d.ts +43 -0
- package/lib/typescript/src/providers/GeminiProvider.d.ts.map +1 -0
- package/lib/typescript/src/utils/logger.d.ts +7 -0
- package/lib/typescript/src/utils/logger.d.ts.map +1 -0
- package/package.json +135 -12
- package/src/components/AIAgent.tsx +262 -0
- package/src/components/AgentChatBar.tsx +258 -0
- package/src/components/AgentOverlay.tsx +48 -0
- package/src/core/AgentRuntime.ts +661 -0
- package/src/core/FiberTreeWalker.ts +404 -0
- package/src/core/MCPBridge.ts +110 -0
- package/src/core/ScreenDehydrator.ts +53 -0
- package/src/core/systemPrompt.ts +162 -0
- package/src/core/types.ts +233 -0
- package/src/hooks/useAction.ts +40 -0
- package/src/index.ts +22 -0
- package/src/providers/GeminiProvider.ts +283 -0
- package/src/utils/logger.ts +21 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentChatBar — Floating, draggable, compressible chat widget.
|
|
3
|
+
* Does not block underlying UI natively.
|
|
4
|
+
*/
|
|
5
|
+
import type { ExecutionResult } from '../core/types';
|
|
6
|
+
interface AgentChatBarProps {
|
|
7
|
+
onSend: (message: string) => void;
|
|
8
|
+
isThinking: boolean;
|
|
9
|
+
lastResult: ExecutionResult | null;
|
|
10
|
+
language: 'en' | 'ar';
|
|
11
|
+
onDismiss?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function AgentChatBar({ onSend, isThinking, lastResult, language, onDismiss }: AgentChatBarProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=AgentChatBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentChatBar.d.ts","sourceRoot":"","sources":["../../../../src/components/AgentChatBar.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,UAAU,iBAAiB;IACzB,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,eAAe,GAAG,IAAI,CAAC;IACnC,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,iBAAiB,2CAyGtG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentOverlay — Subtle thinking indicator shown while the AI agent is processing.
|
|
3
|
+
*/
|
|
4
|
+
interface AgentOverlayProps {
|
|
5
|
+
visible: boolean;
|
|
6
|
+
statusText: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function AgentOverlay({ visible, statusText }: AgentOverlayProps): import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=AgentOverlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentOverlay.d.ts","sourceRoot":"","sources":["../../../../src/components/AgentOverlay.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAIH,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,iBAAiB,kDAWtE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentRuntime — The main agent loop, inspired by page-agent.js.
|
|
3
|
+
*
|
|
4
|
+
* Flow:
|
|
5
|
+
* 1. Walk Fiber tree → detect interactive elements
|
|
6
|
+
* 2. Dehydrate screen → text for LLM
|
|
7
|
+
* 3. Send to AI provider with tools
|
|
8
|
+
* 4. Parse tool call → execute (tap, type, navigate, done)
|
|
9
|
+
* 5. If not done, repeat from step 1 (re-dehydrate after UI change)
|
|
10
|
+
*/
|
|
11
|
+
import type { AIProvider, AgentConfig, ExecutionResult, ActionDefinition } from './types';
|
|
12
|
+
export declare class AgentRuntime {
|
|
13
|
+
private provider;
|
|
14
|
+
private config;
|
|
15
|
+
private rootRef;
|
|
16
|
+
private navRef;
|
|
17
|
+
private tools;
|
|
18
|
+
private actions;
|
|
19
|
+
private history;
|
|
20
|
+
private isRunning;
|
|
21
|
+
private lastAskUserQuestion;
|
|
22
|
+
constructor(provider: AIProvider, config: AgentConfig, rootRef: any, navRef: any);
|
|
23
|
+
private registerBuiltInTools;
|
|
24
|
+
registerAction(action: ActionDefinition): void;
|
|
25
|
+
unregisterAction(name: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Recursively collect ALL screen names from the navigation state tree.
|
|
28
|
+
* This handles tabs, drawers, and nested stacks.
|
|
29
|
+
*/
|
|
30
|
+
private getRouteNames;
|
|
31
|
+
private collectRouteNames;
|
|
32
|
+
/**
|
|
33
|
+
* Recursively find the deepest active screen name.
|
|
34
|
+
* For tabs: follows active tab → active screen inside that tab.
|
|
35
|
+
*/
|
|
36
|
+
private getCurrentScreenName;
|
|
37
|
+
private getDeepestScreenName;
|
|
38
|
+
/** Maps a tool call to a user-friendly status label for the loading overlay. */
|
|
39
|
+
private getToolStatusLabel;
|
|
40
|
+
private buildToolsForProvider;
|
|
41
|
+
private getWalkConfig;
|
|
42
|
+
private getInstructions;
|
|
43
|
+
private observations;
|
|
44
|
+
private lastScreenName;
|
|
45
|
+
private handleObservations;
|
|
46
|
+
private assembleUserPrompt;
|
|
47
|
+
execute(userMessage: string): Promise<ExecutionResult>;
|
|
48
|
+
/** Update refs (called when component re-renders) */
|
|
49
|
+
updateRefs(rootRef: any, navRef: any): void;
|
|
50
|
+
/** Check if agent is currently executing */
|
|
51
|
+
getIsRunning(): boolean;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=AgentRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/AgentRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EAEX,eAAe,EAEf,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAMjB,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,OAAO,CAAM;IACrB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,KAAK,CAA0C;IACvD,OAAO,CAAC,OAAO,CAA4C;IAC3D,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,mBAAmB,CAAuB;gBAGhD,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,GAAG,EACZ,MAAM,EAAE,GAAG;IAyBb,OAAO,CAAC,oBAAoB;IAkK5B,cAAc,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAK9C,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAMpC;;;OAGG;IACH,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,iBAAiB;IAczB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAiB5B,OAAO,CAAC,oBAAoB;IAW5B,gFAAgF;IAChF,OAAO,CAAC,kBAAkB;IAmB1B,OAAO,CAAC,qBAAqB;IA8B7B,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,eAAe;IAyBvB,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,cAAc,CAAc;IAEpC,OAAO,CAAC,kBAAkB;IAsB1B,OAAO,CAAC,kBAAkB;IAuDpB,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAuL5D,qDAAqD;IACrD,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,IAAI;IAK3C,4CAA4C;IAC5C,YAAY,IAAI,OAAO;CAGxB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FiberTreeWalker — Traverses React's Fiber tree to discover interactive elements.
|
|
3
|
+
*
|
|
4
|
+
* This is the React Native equivalent of page-agent.js reading the DOM.
|
|
5
|
+
* Instead of traversing HTML nodes, we traverse React Fiber nodes and detect
|
|
6
|
+
* interactive elements by their type and props (onPress, onChangeText, etc.).
|
|
7
|
+
*
|
|
8
|
+
* Architecture inspired by: https://github.com/alibaba/page-agent
|
|
9
|
+
*/
|
|
10
|
+
import type { InteractiveElement } from './types';
|
|
11
|
+
export interface WalkConfig {
|
|
12
|
+
/** React refs of elements to exclude — mirrors page-agent interactiveBlacklist */
|
|
13
|
+
interactiveBlacklist?: React.RefObject<any>[];
|
|
14
|
+
/** If set, only these elements are interactive — mirrors page-agent interactiveWhitelist */
|
|
15
|
+
interactiveWhitelist?: React.RefObject<any>[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Check if a node has ANY event handler prop (on* function).
|
|
19
|
+
* Mirrors RNTL's getEventHandlerFromProps pattern.
|
|
20
|
+
*/
|
|
21
|
+
export declare function hasAnyEventHandler(props: any): boolean;
|
|
22
|
+
export interface WalkResult {
|
|
23
|
+
elementsText: string;
|
|
24
|
+
interactives: InteractiveElement[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Walk the React Fiber tree from a root and collect all interactive elements
|
|
28
|
+
* as well as a hierarchical layout representation for the LLM.
|
|
29
|
+
*/
|
|
30
|
+
export declare function walkFiberTree(rootRef: any, config?: WalkConfig): WalkResult;
|
|
31
|
+
//# sourceMappingURL=FiberTreeWalker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FiberTreeWalker.d.ts","sourceRoot":"","sources":["../../../../src/core/FiberTreeWalker.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAe,MAAM,SAAS,CAAC;AAI/D,MAAM,WAAW,UAAU;IACzB,kFAAkF;IAClF,oBAAoB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;IAC9C,4FAA4F;IAC5F,oBAAoB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;CAC/C;AAsDD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAQtD;AAsND,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,kBAAkB,EAAE,CAAC;CACpC;AAID;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,UAAU,CA4F3E"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCPBridge — Connects the React Native app to the local MCP Server bridge.
|
|
3
|
+
*
|
|
4
|
+
* Flow:
|
|
5
|
+
* - Connects via WebSocket to the Node.js MCP server
|
|
6
|
+
* - Listens for 'request' messages containing an MCP command
|
|
7
|
+
* - Forwards the command to AgentRuntime.execute()
|
|
8
|
+
* - Sends the ExecutionResult back via WebSocket as a 'response'
|
|
9
|
+
*/
|
|
10
|
+
import type { AgentRuntime } from './AgentRuntime';
|
|
11
|
+
export declare class MCPBridge {
|
|
12
|
+
private url;
|
|
13
|
+
private ws;
|
|
14
|
+
private runtime;
|
|
15
|
+
private reconnectTimer;
|
|
16
|
+
private isDestroyed;
|
|
17
|
+
constructor(url: string, runtime: AgentRuntime);
|
|
18
|
+
private connect;
|
|
19
|
+
private sendResponse;
|
|
20
|
+
private scheduleReconnect;
|
|
21
|
+
destroy(): void;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=MCPBridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MCPBridge.d.ts","sourceRoot":"","sources":["../../../../src/core/MCPBridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,qBAAa,SAAS;IACpB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,cAAc,CAA8C;IACpE,OAAO,CAAC,WAAW,CAAS;gBAEhB,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY;IAM9C,OAAO,CAAC,OAAO;IAsDf,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,iBAAiB;IAQlB,OAAO;CAWf"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ScreenDehydrator — Converts discovered interactive elements into
|
|
3
|
+
* a text representation for the LLM, matching page-agent.js format.
|
|
4
|
+
*
|
|
5
|
+
* Output example:
|
|
6
|
+
* ```
|
|
7
|
+
* Screen: Home | Available screens: Home, Menu, Cart
|
|
8
|
+
* Interactive elements:
|
|
9
|
+
* [0]<pressable>🍕 Pizzas</>
|
|
10
|
+
* [1]<pressable>🍔 Burgers</>
|
|
11
|
+
* [2]<pressable>🥤 Drinks</>
|
|
12
|
+
* [3]<pressable>🛒 View Cart</>
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
import type { InteractiveElement, DehydratedScreen } from './types';
|
|
16
|
+
/**
|
|
17
|
+
* Dehydrate the current screen state into a text format for the LLM.
|
|
18
|
+
*/
|
|
19
|
+
export declare function dehydrateScreen(screenName: string, availableScreens: string[], elementsText: string, elements: InteractiveElement[]): DehydratedScreen;
|
|
20
|
+
//# sourceMappingURL=ScreenDehydrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScreenDehydrator.d.ts","sourceRoot":"","sources":["../../../../src/core/ScreenDehydrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEpE;;GAEG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,gBAAgB,EAAE,MAAM,EAAE,EAC1B,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,kBAAkB,EAAE,GAC7B,gBAAgB,CA2BlB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System prompt for the AI agent — adapted from page-agent reference.
|
|
3
|
+
*
|
|
4
|
+
* Separated into its own file for maintainability.
|
|
5
|
+
* The prompt uses XML-style tags (matching page-agent's structure)
|
|
6
|
+
* to give the LLM clear, structured instructions.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildSystemPrompt(language: string): string;
|
|
9
|
+
//# sourceMappingURL=systemPrompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"systemPrompt.d.ts","sourceRoot":"","sources":["../../../../src/core/systemPrompt.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAyJ1D"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core types for the page-agent-style React Native AI SDK.
|
|
3
|
+
*/
|
|
4
|
+
export type ElementType = 'pressable' | 'text-input' | 'switch' | 'scrollable';
|
|
5
|
+
export interface InteractiveElement {
|
|
6
|
+
/** Unique index assigned during tree walk */
|
|
7
|
+
index: number;
|
|
8
|
+
/** Element type */
|
|
9
|
+
type: ElementType;
|
|
10
|
+
/** Human-readable label (extracted from Text children or accessibilityLabel) */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Reference to the Fiber node for execution */
|
|
13
|
+
fiberNode: any;
|
|
14
|
+
/** Key props snapshot */
|
|
15
|
+
props: {
|
|
16
|
+
onPress?: (...args: any[]) => void;
|
|
17
|
+
onChangeText?: (text: string) => void;
|
|
18
|
+
onValueChange?: (value: boolean) => void;
|
|
19
|
+
value?: string | boolean;
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
checked?: boolean;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
accessibilityLabel?: string;
|
|
24
|
+
accessibilityRole?: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface DehydratedScreen {
|
|
28
|
+
/** Current screen name (from navigation state) */
|
|
29
|
+
screenName: string;
|
|
30
|
+
/** All available screen names (from routeNames) */
|
|
31
|
+
availableScreens: string[];
|
|
32
|
+
/** Indexed interactive elements as text */
|
|
33
|
+
elementsText: string;
|
|
34
|
+
/** Raw elements array */
|
|
35
|
+
elements: InteractiveElement[];
|
|
36
|
+
}
|
|
37
|
+
export interface AgentStep {
|
|
38
|
+
stepIndex: number;
|
|
39
|
+
reflection: AgentReasoning;
|
|
40
|
+
action: {
|
|
41
|
+
name: string;
|
|
42
|
+
input: Record<string, any>;
|
|
43
|
+
output: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export interface AgentConfig {
|
|
47
|
+
apiKey: string;
|
|
48
|
+
model?: string;
|
|
49
|
+
language?: 'en' | 'ar';
|
|
50
|
+
/** Maximum steps per task (page-agent default: 40) */
|
|
51
|
+
maxSteps?: number;
|
|
52
|
+
/**
|
|
53
|
+
* React refs of elements the AI must NOT interact with.
|
|
54
|
+
* Mirrors page-agent.js `interactiveBlacklist: Element[]`.
|
|
55
|
+
* The Fiber walker skips any node whose ref matches one in this list.
|
|
56
|
+
*/
|
|
57
|
+
interactiveBlacklist?: React.RefObject<any>[];
|
|
58
|
+
/**
|
|
59
|
+
* If set, the AI can ONLY interact with these elements.
|
|
60
|
+
* Mirrors page-agent.js `interactiveWhitelist: Element[]`.
|
|
61
|
+
*/
|
|
62
|
+
interactiveWhitelist?: React.RefObject<any>[];
|
|
63
|
+
/** Called before each agent step. */
|
|
64
|
+
onBeforeStep?: (stepCount: number) => Promise<void> | void;
|
|
65
|
+
/** Called after each agent step with full history. */
|
|
66
|
+
onAfterStep?: (history: AgentStep[]) => Promise<void> | void;
|
|
67
|
+
/** Called before task execution starts. */
|
|
68
|
+
onBeforeTask?: () => Promise<void> | void;
|
|
69
|
+
/** Called after task completes (success or failure). */
|
|
70
|
+
onAfterTask?: (result: ExecutionResult) => Promise<void> | void;
|
|
71
|
+
/**
|
|
72
|
+
* Transform dehydrated screen text before sending to LLM.
|
|
73
|
+
* Use to mask sensitive data (credit cards, PII, etc).
|
|
74
|
+
* Mirrors page-agent.js `transformPageContent`.
|
|
75
|
+
*/
|
|
76
|
+
transformScreenContent?: (content: string) => Promise<string> | string;
|
|
77
|
+
/**
|
|
78
|
+
* Override or remove built-in tools.
|
|
79
|
+
* Set tool to `null` to remove it (e.g., `{ navigate: null }`).
|
|
80
|
+
* Mirrors page-agent.js `customTools: Record<string, Tool | null>`.
|
|
81
|
+
*/
|
|
82
|
+
customTools?: Record<string, ToolDefinition | null>;
|
|
83
|
+
/** Instructions to guide the agent's behavior. */
|
|
84
|
+
instructions?: {
|
|
85
|
+
/** Global system-level instructions, applied to all tasks. */
|
|
86
|
+
system?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Dynamic per-screen instructions callback.
|
|
89
|
+
* Called before each step to get instructions for the current screen.
|
|
90
|
+
* Mirrors page-agent.js `getPageInstructions(url)`.
|
|
91
|
+
*/
|
|
92
|
+
getScreenInstructions?: (screenName: string) => string | undefined | null;
|
|
93
|
+
};
|
|
94
|
+
/** Delay between steps in ms (page-agent default: 400ms). */
|
|
95
|
+
stepDelay?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Called with a human-readable status string at each step.
|
|
98
|
+
* Use this to show dynamic loading text (e.g., "Tapping 'Add'...").
|
|
99
|
+
*/
|
|
100
|
+
onStatusUpdate?: (status: string) => void;
|
|
101
|
+
/**
|
|
102
|
+
* Callback for when agent needs user input (ask_user tool).
|
|
103
|
+
* Mirrors page-agent: the agent loop blocks until the user responds.
|
|
104
|
+
* If not set, ask_user tool will break the loop (legacy behavior).
|
|
105
|
+
* @example onAskUser: (q) => new Promise(resolve => showPrompt(q, resolve))
|
|
106
|
+
*/
|
|
107
|
+
onAskUser?: (question: string) => Promise<string>;
|
|
108
|
+
/**
|
|
109
|
+
* Expo Router instance (from useRouter()).
|
|
110
|
+
* When provided, the navigate tool uses router.push('/path') instead of navRef.navigate().
|
|
111
|
+
*/
|
|
112
|
+
router?: {
|
|
113
|
+
push: (href: string) => void;
|
|
114
|
+
replace: (href: string) => void;
|
|
115
|
+
back: () => void;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Current pathname from Expo Router (from usePathname()).
|
|
119
|
+
* Used to determine the current screen when using Expo Router.
|
|
120
|
+
*/
|
|
121
|
+
pathname?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Optional URL of the companion Node.js MCP server bridge (e.g. ws://localhost:3101).
|
|
124
|
+
* If set, the SDK will connect to this server and listen for execution requests
|
|
125
|
+
* from external AI agents (like OpenClaw, Claude Desktop, etc).
|
|
126
|
+
*/
|
|
127
|
+
mcpServerUrl?: string;
|
|
128
|
+
}
|
|
129
|
+
export interface ExecutionResult {
|
|
130
|
+
success: boolean;
|
|
131
|
+
message: string;
|
|
132
|
+
steps: AgentStep[];
|
|
133
|
+
}
|
|
134
|
+
export interface ToolDefinition {
|
|
135
|
+
name: string;
|
|
136
|
+
description: string;
|
|
137
|
+
parameters: Record<string, ToolParam>;
|
|
138
|
+
execute: (args: Record<string, any>) => Promise<string>;
|
|
139
|
+
}
|
|
140
|
+
export interface ToolParam {
|
|
141
|
+
type: 'string' | 'number' | 'boolean';
|
|
142
|
+
description: string;
|
|
143
|
+
required?: boolean;
|
|
144
|
+
enum?: string[];
|
|
145
|
+
}
|
|
146
|
+
export interface ActionDefinition {
|
|
147
|
+
name: string;
|
|
148
|
+
description: string;
|
|
149
|
+
parameters: Record<string, string>;
|
|
150
|
+
handler: (args: Record<string, any>) => any;
|
|
151
|
+
}
|
|
152
|
+
/** Structured reasoning returned per step via the agent_step tool. */
|
|
153
|
+
export interface AgentReasoning {
|
|
154
|
+
/** Assessment of whether the previous action succeeded or failed. */
|
|
155
|
+
previousGoalEval: string;
|
|
156
|
+
/** What to remember for future steps (progress, items found, etc). */
|
|
157
|
+
memory: string;
|
|
158
|
+
/** The immediate next goal and why. */
|
|
159
|
+
plan: string;
|
|
160
|
+
}
|
|
161
|
+
/** Result from the AI provider's generateContent call. */
|
|
162
|
+
export interface ProviderResult {
|
|
163
|
+
/** Extracted action tool call (action_name + params). */
|
|
164
|
+
toolCalls: Array<{
|
|
165
|
+
name: string;
|
|
166
|
+
args: Record<string, any>;
|
|
167
|
+
}>;
|
|
168
|
+
/** Structured reasoning from MacroTool (evaluation, memory, next_goal). */
|
|
169
|
+
reasoning: AgentReasoning;
|
|
170
|
+
/** Raw text response (if any). */
|
|
171
|
+
text?: string;
|
|
172
|
+
}
|
|
173
|
+
export interface AIProvider {
|
|
174
|
+
generateContent(systemPrompt: string, userMessage: string, tools: ToolDefinition[], history: AgentStep[]): Promise<ProviderResult>;
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useAction — Optional hook to register non-UI actions for the AI agent.
|
|
3
|
+
*
|
|
4
|
+
* Use this for business logic that doesn't correspond to a visible UI element,
|
|
5
|
+
* e.g., API calls, cart operations, calculations.
|
|
6
|
+
*
|
|
7
|
+
* The Fiber tree walker handles visible UI elements automatically.
|
|
8
|
+
* useAction is for invisible operations the AI should be able to trigger.
|
|
9
|
+
*/
|
|
10
|
+
import type { AgentRuntime } from '../core/AgentRuntime';
|
|
11
|
+
export declare const AgentContext: import("react").Context<AgentRuntime | null>;
|
|
12
|
+
export declare function useAction(name: string, description: string, parameters: Record<string, string>, handler: (args: Record<string, any>) => any): void;
|
|
13
|
+
//# sourceMappingURL=useAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAction.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAction.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,eAAO,MAAM,YAAY,8CAA2C,CAAC;AAErE,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,GAAG,GAC1C,IAAI,CAkBN"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @mobileai/react-native — Page-Agent Architecture
|
|
3
|
+
*
|
|
4
|
+
* Zero-wrapper AI agent for React Native.
|
|
5
|
+
* Auto-detects interactive elements via React Fiber tree traversal.
|
|
6
|
+
*/
|
|
7
|
+
export { AIAgent } from './components/AIAgent';
|
|
8
|
+
export { useAction } from './hooks/useAction';
|
|
9
|
+
export type { AgentConfig, ExecutionResult, InteractiveElement, DehydratedScreen, ToolDefinition, ActionDefinition, } from './core/types';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG9C,YAAY,EACV,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,GACjB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GeminiProvider — Gemini API integration with structured action pattern.
|
|
3
|
+
*
|
|
4
|
+
* Uses a single forced function call (`agent_step`) that bundles
|
|
5
|
+
* structured reasoning (evaluation, memory, plan) alongside the action.
|
|
6
|
+
* This replaces free-form text + separate tool calls for stability.
|
|
7
|
+
*/
|
|
8
|
+
import type { AIProvider, ToolDefinition, AgentStep, ProviderResult } from '../core/types';
|
|
9
|
+
export declare class GeminiProvider implements AIProvider {
|
|
10
|
+
private apiKey;
|
|
11
|
+
private model;
|
|
12
|
+
constructor(apiKey: string, model?: string);
|
|
13
|
+
generateContent(systemPrompt: string, userMessage: string, tools: ToolDefinition[], history: AgentStep[]): Promise<ProviderResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Builds a single `agent_step` function declaration that combines:
|
|
16
|
+
* - Structured reasoning fields (previous_goal_eval, memory, plan)
|
|
17
|
+
* - action_name (enum of all available tool names)
|
|
18
|
+
* - All tool parameter fields as flat top-level properties
|
|
19
|
+
*
|
|
20
|
+
* Flat schema avoids Gemini's "deeply nested schema" rejection in ANY mode.
|
|
21
|
+
*/
|
|
22
|
+
private buildAgentStepDeclaration;
|
|
23
|
+
private mapParamType;
|
|
24
|
+
/**
|
|
25
|
+
* Builds Gemini conversation contents.
|
|
26
|
+
*
|
|
27
|
+
* Each step is a STATELESS single-turn request (matching page-agent's approach):
|
|
28
|
+
* - System prompt has general instructions
|
|
29
|
+
* - User message contains full context: task, history, screen state
|
|
30
|
+
* - Model responds with agent_step function call
|
|
31
|
+
*
|
|
32
|
+
* History is embedded as text in assembleUserPrompt (via <agent_history>),
|
|
33
|
+
* NOT as functionCall/functionResponse pairs. This avoids Gemini's
|
|
34
|
+
* conversation format requirements and thought_signature complexity.
|
|
35
|
+
*/
|
|
36
|
+
private buildContents;
|
|
37
|
+
/**
|
|
38
|
+
* Parses the Gemini response expecting a single agent_step function call.
|
|
39
|
+
* Extracts structured reasoning + action, and determines which tool to execute.
|
|
40
|
+
*/
|
|
41
|
+
private parseAgentStepResponse;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=GeminiProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeminiProvider.d.ts","sourceRoot":"","sources":["../../../../src/providers/GeminiProvider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAkB,MAAM,eAAe,CAAC;AAsB3G,qBAAa,cAAe,YAAW,UAAU;IAC/C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAS;gBAEV,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,MAA2B;IAKxD,eAAe,CACnB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,EAAE,SAAS,EAAE,GACnB,OAAO,CAAC,cAAc,CAAC;IA2D1B;;;;;;;OAOG;IACH,OAAO,CAAC,yBAAyB;IA0DjC,OAAO,CAAC,YAAY;IAYpB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,aAAa;IASrB;;;OAGG;IACH,OAAO,CAAC,sBAAsB;CA2E/B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const logger: {
|
|
2
|
+
info: (context: string, ...args: any[]) => void;
|
|
3
|
+
warn: (context: string, ...args: any[]) => void;
|
|
4
|
+
error: (context: string, ...args: any[]) => void;
|
|
5
|
+
debug: (context: string, ...args: any[]) => void;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/utils/logger.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,MAAM;oBACD,MAAM,WAAW,GAAG,EAAE;oBAGtB,MAAM,WAAW,GAAG,EAAE;qBAGrB,MAAM,WAAW,GAAG,EAAE;qBAGtB,MAAM,WAAW,GAAG,EAAE;CAKxC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,22 +1,145 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-agentic-ai",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Build autonomous AI agents for React Native and Expo apps. Provides AI-native UI traversal, tool calling, and structured reasoning.",
|
|
5
|
+
"main": "./lib/module/index.js",
|
|
6
|
+
"source": "./src/index.ts",
|
|
7
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"source": "./src/index.ts",
|
|
11
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
12
|
+
"default": "./lib/module/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"src",
|
|
18
|
+
"lib",
|
|
19
|
+
"android",
|
|
20
|
+
"ios",
|
|
21
|
+
"cpp",
|
|
22
|
+
"*.podspec",
|
|
23
|
+
"react-native.config.js",
|
|
24
|
+
"!ios/build",
|
|
25
|
+
"!android/build",
|
|
26
|
+
"!android/gradle",
|
|
27
|
+
"!android/gradlew",
|
|
28
|
+
"!android/gradlew.bat",
|
|
29
|
+
"!android/local.properties",
|
|
30
|
+
"!**/__tests__",
|
|
31
|
+
"!**/__fixtures__",
|
|
32
|
+
"!**/__mocks__",
|
|
33
|
+
"!**/__mocks__",
|
|
34
|
+
"!**/.*",
|
|
35
|
+
"!mcp-server"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"example": "yarn workspace @mobileai/react-native-example",
|
|
39
|
+
"clean": "del-cli lib",
|
|
40
|
+
"prepare": "bob build",
|
|
41
|
+
"typecheck": "tsc",
|
|
42
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
43
|
+
"test": "jest",
|
|
44
|
+
"publish:dual": "bash scripts/publish-dual.sh",
|
|
45
|
+
"publish:dual:dry": "bash scripts/publish-dual.sh --dry-run"
|
|
46
|
+
},
|
|
6
47
|
"keywords": [
|
|
7
48
|
"react-native",
|
|
49
|
+
"expo",
|
|
8
50
|
"ai",
|
|
51
|
+
"llm",
|
|
9
52
|
"agent",
|
|
53
|
+
"autonomous-agent",
|
|
10
54
|
"gemini",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
55
|
+
"openai",
|
|
56
|
+
"artificial-intelligence",
|
|
57
|
+
"mobile-ai",
|
|
58
|
+
"ui-automation",
|
|
59
|
+
"react native ai agent"
|
|
15
60
|
],
|
|
16
|
-
"author": "Mohamed Salah",
|
|
17
|
-
"license": "MIT",
|
|
18
61
|
"repository": {
|
|
19
62
|
"type": "git",
|
|
20
|
-
"url": "https://github.com/
|
|
21
|
-
}
|
|
22
|
-
|
|
63
|
+
"url": "git+https://github.com/mohamed2m2018/mobileai-react-native.git"
|
|
64
|
+
},
|
|
65
|
+
"author": "Mohamed Salah <mohamedsalah@example.com> (https://example.com)",
|
|
66
|
+
"license": "MIT",
|
|
67
|
+
"bugs": {
|
|
68
|
+
"url": "https://github.com/mohamed2m2018/mobileai-react-native/issues"
|
|
69
|
+
},
|
|
70
|
+
"homepage": "https://github.com/mohamed2m2018/mobileai-react-native#readme",
|
|
71
|
+
"publishConfig": {
|
|
72
|
+
"registry": "https://registry.npmjs.org/"
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@eslint/compat": "^1.3.2",
|
|
76
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
77
|
+
"@eslint/js": "^9.35.0",
|
|
78
|
+
"@react-native/babel-preset": "0.83.0",
|
|
79
|
+
"@react-native/eslint-config": "0.83.0",
|
|
80
|
+
"@types/jest": "^29.5.14",
|
|
81
|
+
"@types/react": "^19.1.12",
|
|
82
|
+
"@types/react-native": "^0.72.8",
|
|
83
|
+
"del-cli": "^6.0.0",
|
|
84
|
+
"eslint": "^9.35.0",
|
|
85
|
+
"eslint-config-prettier": "^10.1.8",
|
|
86
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
87
|
+
"jest": "^29.7.0",
|
|
88
|
+
"prettier": "^2.8.8",
|
|
89
|
+
"react": "19.2.0",
|
|
90
|
+
"react-native": "0.83.2",
|
|
91
|
+
"react-native-builder-bob": "^0.40.18",
|
|
92
|
+
"turbo": "^2.5.6",
|
|
93
|
+
"typescript": "^5.9.2"
|
|
94
|
+
},
|
|
95
|
+
"peerDependencies": {
|
|
96
|
+
"react": "*",
|
|
97
|
+
"react-native": "*"
|
|
98
|
+
},
|
|
99
|
+
"workspaces": [
|
|
100
|
+
"example"
|
|
101
|
+
],
|
|
102
|
+
"packageManager": "yarn@4.11.0",
|
|
103
|
+
"react-native-builder-bob": {
|
|
104
|
+
"source": "src",
|
|
105
|
+
"output": "lib",
|
|
106
|
+
"targets": [
|
|
107
|
+
[
|
|
108
|
+
"module",
|
|
109
|
+
{
|
|
110
|
+
"esm": true
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
[
|
|
114
|
+
"typescript",
|
|
115
|
+
{
|
|
116
|
+
"project": "tsconfig.build.json"
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
"prettier": {
|
|
122
|
+
"quoteProps": "consistent",
|
|
123
|
+
"singleQuote": true,
|
|
124
|
+
"tabWidth": 2,
|
|
125
|
+
"trailingComma": "es5",
|
|
126
|
+
"useTabs": false
|
|
127
|
+
},
|
|
128
|
+
"jest": {
|
|
129
|
+
"preset": "react-native",
|
|
130
|
+
"modulePathIgnorePatterns": [
|
|
131
|
+
"<rootDir>/example/node_modules",
|
|
132
|
+
"<rootDir>/lib/"
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
"create-react-native-library": {
|
|
136
|
+
"type": "library",
|
|
137
|
+
"languages": "js",
|
|
138
|
+
"tools": [
|
|
139
|
+
"eslint",
|
|
140
|
+
"jest"
|
|
141
|
+
],
|
|
142
|
+
"version": "0.57.2"
|
|
143
|
+
},
|
|
144
|
+
"dependencies": {}
|
|
145
|
+
}
|