@mobileai/react-native 0.9.17 → 0.9.19

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 (292) hide show
  1. package/LICENSE +28 -20
  2. package/MobileAIFloatingOverlay.podspec +25 -0
  3. package/android/build.gradle +61 -0
  4. package/android/src/main/AndroidManifest.xml +3 -0
  5. package/android/src/main/java/com/mobileai/overlay/FloatingOverlayView.kt +151 -0
  6. package/android/src/main/java/com/mobileai/overlay/MobileAIOverlayPackage.kt +23 -0
  7. package/android/src/newarch/com/mobileai/overlay/FloatingOverlayViewManager.kt +45 -0
  8. package/android/src/oldarch/com/mobileai/overlay/FloatingOverlayViewManager.kt +29 -0
  9. package/ios/MobileAIFloatingOverlayComponentView.mm +73 -0
  10. package/lib/module/components/AIAgent.js +902 -136
  11. package/lib/module/components/AIConsentDialog.js +439 -0
  12. package/lib/module/components/AgentChatBar.js +828 -134
  13. package/lib/module/components/AgentOverlay.js +2 -1
  14. package/lib/module/components/DiscoveryTooltip.js +21 -9
  15. package/lib/module/components/FloatingOverlayWrapper.js +108 -0
  16. package/lib/module/components/Icons.js +123 -0
  17. package/lib/module/config/endpoints.js +12 -2
  18. package/lib/module/core/AgentRuntime.js +373 -27
  19. package/lib/module/core/FiberAdapter.js +56 -0
  20. package/lib/module/core/FiberTreeWalker.js +186 -80
  21. package/lib/module/core/IdleDetector.js +19 -0
  22. package/lib/module/core/NativeAlertInterceptor.js +191 -0
  23. package/lib/module/core/systemPrompt.js +203 -45
  24. package/lib/module/index.js +3 -0
  25. package/lib/module/providers/GeminiProvider.js +72 -56
  26. package/lib/module/providers/ProviderFactory.js +6 -2
  27. package/lib/module/services/AudioInputService.js +3 -12
  28. package/lib/module/services/AudioOutputService.js +1 -13
  29. package/lib/module/services/ConversationService.js +166 -0
  30. package/lib/module/services/MobileAIKnowledgeRetriever.js +41 -0
  31. package/lib/module/services/VoiceService.js +29 -8
  32. package/lib/module/services/telemetry/MobileAI.js +44 -0
  33. package/lib/module/services/telemetry/TelemetryService.js +13 -1
  34. package/lib/module/services/telemetry/TouchAutoCapture.js +44 -18
  35. package/lib/module/specs/FloatingOverlayNativeComponent.ts +19 -0
  36. package/lib/module/support/CSATSurvey.js +95 -12
  37. package/lib/module/support/EscalationSocket.js +70 -1
  38. package/lib/module/support/ReportedIssueEventSource.js +148 -0
  39. package/lib/module/support/escalateTool.js +4 -2
  40. package/lib/module/support/index.js +1 -0
  41. package/lib/module/support/reportIssueTool.js +127 -0
  42. package/lib/module/support/supportPrompt.js +77 -9
  43. package/lib/module/tools/guideTool.js +2 -1
  44. package/lib/module/tools/longPressTool.js +4 -3
  45. package/lib/module/tools/pickerTool.js +6 -4
  46. package/lib/module/tools/tapTool.js +12 -3
  47. package/lib/module/tools/typeTool.js +19 -10
  48. package/lib/module/utils/logger.js +175 -6
  49. package/lib/typescript/react-native.config.d.ts +11 -0
  50. package/lib/typescript/src/components/AIAgent.d.ts +28 -2
  51. package/lib/typescript/src/components/AIConsentDialog.d.ts +153 -0
  52. package/lib/typescript/src/components/AgentChatBar.d.ts +15 -2
  53. package/lib/typescript/src/components/DiscoveryTooltip.d.ts +3 -1
  54. package/lib/typescript/src/components/FloatingOverlayWrapper.d.ts +51 -0
  55. package/lib/typescript/src/components/Icons.d.ts +8 -0
  56. package/lib/typescript/src/config/endpoints.d.ts +5 -3
  57. package/lib/typescript/src/core/AgentRuntime.d.ts +4 -0
  58. package/lib/typescript/src/core/FiberAdapter.d.ts +25 -0
  59. package/lib/typescript/src/core/FiberTreeWalker.d.ts +2 -0
  60. package/lib/typescript/src/core/IdleDetector.d.ts +11 -0
  61. package/lib/typescript/src/core/NativeAlertInterceptor.d.ts +55 -0
  62. package/lib/typescript/src/core/types.d.ts +106 -1
  63. package/lib/typescript/src/index.d.ts +9 -4
  64. package/lib/typescript/src/providers/GeminiProvider.d.ts +6 -5
  65. package/lib/typescript/src/services/ConversationService.d.ts +55 -0
  66. package/lib/typescript/src/services/MobileAIKnowledgeRetriever.d.ts +9 -0
  67. package/lib/typescript/src/services/telemetry/MobileAI.d.ts +7 -0
  68. package/lib/typescript/src/services/telemetry/TelemetryService.d.ts +1 -1
  69. package/lib/typescript/src/services/telemetry/TouchAutoCapture.d.ts +9 -6
  70. package/lib/typescript/src/services/telemetry/types.d.ts +3 -1
  71. package/lib/typescript/src/specs/FloatingOverlayNativeComponent.d.ts +17 -0
  72. package/lib/typescript/src/support/EscalationSocket.d.ts +17 -0
  73. package/lib/typescript/src/support/ReportedIssueEventSource.d.ts +24 -0
  74. package/lib/typescript/src/support/escalateTool.d.ts +5 -0
  75. package/lib/typescript/src/support/index.d.ts +2 -1
  76. package/lib/typescript/src/support/reportIssueTool.d.ts +20 -0
  77. package/lib/typescript/src/support/types.d.ts +56 -1
  78. package/lib/typescript/src/utils/logger.d.ts +15 -0
  79. package/package.json +20 -9
  80. package/react-native.config.js +12 -0
  81. package/lib/module/__cli_tmp__.js.map +0 -1
  82. package/lib/module/components/AIAgent.js.map +0 -1
  83. package/lib/module/components/AIZone.js.map +0 -1
  84. package/lib/module/components/AgentChatBar.js.map +0 -1
  85. package/lib/module/components/AgentErrorBoundary.js.map +0 -1
  86. package/lib/module/components/AgentOverlay.js.map +0 -1
  87. package/lib/module/components/DiscoveryTooltip.js.map +0 -1
  88. package/lib/module/components/HighlightOverlay.js.map +0 -1
  89. package/lib/module/components/Icons.js.map +0 -1
  90. package/lib/module/components/ProactiveHint.js.map +0 -1
  91. package/lib/module/components/cards/InfoCard.js.map +0 -1
  92. package/lib/module/components/cards/ReviewSummary.js.map +0 -1
  93. package/lib/module/config/endpoints.js.map +0 -1
  94. package/lib/module/core/ActionRegistry.js.map +0 -1
  95. package/lib/module/core/AgentRuntime.js.map +0 -1
  96. package/lib/module/core/FiberTreeWalker.js.map +0 -1
  97. package/lib/module/core/IdleDetector.js.map +0 -1
  98. package/lib/module/core/MCPBridge.js.map +0 -1
  99. package/lib/module/core/ScreenDehydrator.js.map +0 -1
  100. package/lib/module/core/ZoneRegistry.js.map +0 -1
  101. package/lib/module/core/systemPrompt.js.map +0 -1
  102. package/lib/module/core/types.js.map +0 -1
  103. package/lib/module/hooks/useAction.js.map +0 -1
  104. package/lib/module/index.js.map +0 -1
  105. package/lib/module/plugin/withAppIntents.js.map +0 -1
  106. package/lib/module/providers/GeminiProvider.js.map +0 -1
  107. package/lib/module/providers/OpenAIProvider.js.map +0 -1
  108. package/lib/module/providers/ProviderFactory.js.map +0 -1
  109. package/lib/module/services/AudioInputService.js.map +0 -1
  110. package/lib/module/services/AudioOutputService.js.map +0 -1
  111. package/lib/module/services/KnowledgeBaseService.js.map +0 -1
  112. package/lib/module/services/VoiceService.js.map +0 -1
  113. package/lib/module/services/flags/FlagService.js.map +0 -1
  114. package/lib/module/services/telemetry/MobileAI.js.map +0 -1
  115. package/lib/module/services/telemetry/PiiScrubber.js.map +0 -1
  116. package/lib/module/services/telemetry/TelemetryService.js.map +0 -1
  117. package/lib/module/services/telemetry/TouchAutoCapture.js.map +0 -1
  118. package/lib/module/services/telemetry/device.js.map +0 -1
  119. package/lib/module/services/telemetry/deviceMetadata.js.map +0 -1
  120. package/lib/module/services/telemetry/index.js.map +0 -1
  121. package/lib/module/services/telemetry/types.js.map +0 -1
  122. package/lib/module/support/CSATSurvey.js.map +0 -1
  123. package/lib/module/support/EscalationEventSource.js.map +0 -1
  124. package/lib/module/support/EscalationSocket.js.map +0 -1
  125. package/lib/module/support/SupportChatModal.js.map +0 -1
  126. package/lib/module/support/SupportGreeting.js.map +0 -1
  127. package/lib/module/support/TicketStore.js.map +0 -1
  128. package/lib/module/support/escalateTool.js.map +0 -1
  129. package/lib/module/support/index.js.map +0 -1
  130. package/lib/module/support/supportPrompt.js.map +0 -1
  131. package/lib/module/support/types.js.map +0 -1
  132. package/lib/module/tools/datePickerTool.js.map +0 -1
  133. package/lib/module/tools/guideTool.js.map +0 -1
  134. package/lib/module/tools/index.js.map +0 -1
  135. package/lib/module/tools/keyboardTool.js.map +0 -1
  136. package/lib/module/tools/longPressTool.js.map +0 -1
  137. package/lib/module/tools/pickerTool.js.map +0 -1
  138. package/lib/module/tools/restoreTool.js.map +0 -1
  139. package/lib/module/tools/scrollTool.js.map +0 -1
  140. package/lib/module/tools/simplifyTool.js.map +0 -1
  141. package/lib/module/tools/sliderTool.js.map +0 -1
  142. package/lib/module/tools/tapTool.js.map +0 -1
  143. package/lib/module/tools/typeTool.js.map +0 -1
  144. package/lib/module/tools/types.js.map +0 -1
  145. package/lib/module/types/jsx.d.js.map +0 -1
  146. package/lib/module/utils/audioUtils.js.map +0 -1
  147. package/lib/module/utils/logger.js.map +0 -1
  148. package/lib/typescript/babel.config.d.ts.map +0 -1
  149. package/lib/typescript/bin/generate-map.d.cts.map +0 -1
  150. package/lib/typescript/eslint.config.d.mts.map +0 -1
  151. package/lib/typescript/generate-map.d.ts.map +0 -1
  152. package/lib/typescript/src/__cli_tmp__.d.ts.map +0 -1
  153. package/lib/typescript/src/components/AIAgent.d.ts.map +0 -1
  154. package/lib/typescript/src/components/AIZone.d.ts.map +0 -1
  155. package/lib/typescript/src/components/AgentChatBar.d.ts.map +0 -1
  156. package/lib/typescript/src/components/AgentErrorBoundary.d.ts.map +0 -1
  157. package/lib/typescript/src/components/AgentOverlay.d.ts.map +0 -1
  158. package/lib/typescript/src/components/DiscoveryTooltip.d.ts.map +0 -1
  159. package/lib/typescript/src/components/HighlightOverlay.d.ts.map +0 -1
  160. package/lib/typescript/src/components/Icons.d.ts.map +0 -1
  161. package/lib/typescript/src/components/ProactiveHint.d.ts.map +0 -1
  162. package/lib/typescript/src/components/cards/InfoCard.d.ts.map +0 -1
  163. package/lib/typescript/src/components/cards/ReviewSummary.d.ts.map +0 -1
  164. package/lib/typescript/src/config/endpoints.d.ts.map +0 -1
  165. package/lib/typescript/src/core/ActionRegistry.d.ts.map +0 -1
  166. package/lib/typescript/src/core/AgentRuntime.d.ts.map +0 -1
  167. package/lib/typescript/src/core/FiberTreeWalker.d.ts.map +0 -1
  168. package/lib/typescript/src/core/IdleDetector.d.ts.map +0 -1
  169. package/lib/typescript/src/core/MCPBridge.d.ts.map +0 -1
  170. package/lib/typescript/src/core/ScreenDehydrator.d.ts.map +0 -1
  171. package/lib/typescript/src/core/ZoneRegistry.d.ts.map +0 -1
  172. package/lib/typescript/src/core/systemPrompt.d.ts.map +0 -1
  173. package/lib/typescript/src/core/types.d.ts.map +0 -1
  174. package/lib/typescript/src/hooks/useAction.d.ts.map +0 -1
  175. package/lib/typescript/src/index.d.ts.map +0 -1
  176. package/lib/typescript/src/plugin/withAppIntents.d.ts.map +0 -1
  177. package/lib/typescript/src/providers/GeminiProvider.d.ts.map +0 -1
  178. package/lib/typescript/src/providers/OpenAIProvider.d.ts.map +0 -1
  179. package/lib/typescript/src/providers/ProviderFactory.d.ts.map +0 -1
  180. package/lib/typescript/src/services/AudioInputService.d.ts.map +0 -1
  181. package/lib/typescript/src/services/AudioOutputService.d.ts.map +0 -1
  182. package/lib/typescript/src/services/KnowledgeBaseService.d.ts.map +0 -1
  183. package/lib/typescript/src/services/VoiceService.d.ts.map +0 -1
  184. package/lib/typescript/src/services/flags/FlagService.d.ts.map +0 -1
  185. package/lib/typescript/src/services/telemetry/MobileAI.d.ts.map +0 -1
  186. package/lib/typescript/src/services/telemetry/PiiScrubber.d.ts.map +0 -1
  187. package/lib/typescript/src/services/telemetry/TelemetryService.d.ts.map +0 -1
  188. package/lib/typescript/src/services/telemetry/TouchAutoCapture.d.ts.map +0 -1
  189. package/lib/typescript/src/services/telemetry/device.d.ts.map +0 -1
  190. package/lib/typescript/src/services/telemetry/deviceMetadata.d.ts.map +0 -1
  191. package/lib/typescript/src/services/telemetry/index.d.ts.map +0 -1
  192. package/lib/typescript/src/services/telemetry/types.d.ts.map +0 -1
  193. package/lib/typescript/src/support/CSATSurvey.d.ts.map +0 -1
  194. package/lib/typescript/src/support/EscalationEventSource.d.ts.map +0 -1
  195. package/lib/typescript/src/support/EscalationSocket.d.ts.map +0 -1
  196. package/lib/typescript/src/support/SupportChatModal.d.ts.map +0 -1
  197. package/lib/typescript/src/support/SupportGreeting.d.ts.map +0 -1
  198. package/lib/typescript/src/support/TicketStore.d.ts.map +0 -1
  199. package/lib/typescript/src/support/escalateTool.d.ts.map +0 -1
  200. package/lib/typescript/src/support/index.d.ts.map +0 -1
  201. package/lib/typescript/src/support/supportPrompt.d.ts.map +0 -1
  202. package/lib/typescript/src/support/types.d.ts.map +0 -1
  203. package/lib/typescript/src/tools/datePickerTool.d.ts.map +0 -1
  204. package/lib/typescript/src/tools/guideTool.d.ts.map +0 -1
  205. package/lib/typescript/src/tools/index.d.ts.map +0 -1
  206. package/lib/typescript/src/tools/keyboardTool.d.ts.map +0 -1
  207. package/lib/typescript/src/tools/longPressTool.d.ts.map +0 -1
  208. package/lib/typescript/src/tools/pickerTool.d.ts.map +0 -1
  209. package/lib/typescript/src/tools/restoreTool.d.ts.map +0 -1
  210. package/lib/typescript/src/tools/scrollTool.d.ts.map +0 -1
  211. package/lib/typescript/src/tools/simplifyTool.d.ts.map +0 -1
  212. package/lib/typescript/src/tools/sliderTool.d.ts.map +0 -1
  213. package/lib/typescript/src/tools/tapTool.d.ts.map +0 -1
  214. package/lib/typescript/src/tools/typeTool.d.ts.map +0 -1
  215. package/lib/typescript/src/tools/types.d.ts.map +0 -1
  216. package/lib/typescript/src/utils/audioUtils.d.ts.map +0 -1
  217. package/lib/typescript/src/utils/logger.d.ts.map +0 -1
  218. package/src/__cli_tmp__.tsx +0 -9
  219. package/src/cli/analyzers/chain-analyzer.ts +0 -183
  220. package/src/cli/extractors/ai-extractor.ts +0 -6
  221. package/src/cli/extractors/ast-extractor.ts +0 -551
  222. package/src/cli/generate-intents.ts +0 -140
  223. package/src/cli/generate-map.ts +0 -121
  224. package/src/cli/generate-swift.ts +0 -116
  225. package/src/cli/scanners/expo-scanner.ts +0 -203
  226. package/src/cli/scanners/rn-scanner.ts +0 -445
  227. package/src/components/AIAgent.tsx +0 -1716
  228. package/src/components/AIZone.tsx +0 -147
  229. package/src/components/AgentChatBar.tsx +0 -1143
  230. package/src/components/AgentErrorBoundary.tsx +0 -78
  231. package/src/components/AgentOverlay.tsx +0 -73
  232. package/src/components/DiscoveryTooltip.tsx +0 -148
  233. package/src/components/HighlightOverlay.tsx +0 -136
  234. package/src/components/Icons.tsx +0 -253
  235. package/src/components/ProactiveHint.tsx +0 -145
  236. package/src/components/cards/InfoCard.tsx +0 -58
  237. package/src/components/cards/ReviewSummary.tsx +0 -76
  238. package/src/config/endpoints.ts +0 -22
  239. package/src/core/ActionRegistry.ts +0 -105
  240. package/src/core/AgentRuntime.ts +0 -1471
  241. package/src/core/FiberTreeWalker.ts +0 -930
  242. package/src/core/IdleDetector.ts +0 -72
  243. package/src/core/MCPBridge.ts +0 -163
  244. package/src/core/ScreenDehydrator.ts +0 -53
  245. package/src/core/ZoneRegistry.ts +0 -44
  246. package/src/core/systemPrompt.ts +0 -431
  247. package/src/core/types.ts +0 -521
  248. package/src/hooks/useAction.ts +0 -182
  249. package/src/index.ts +0 -83
  250. package/src/plugin/withAppIntents.ts +0 -98
  251. package/src/providers/GeminiProvider.ts +0 -357
  252. package/src/providers/OpenAIProvider.ts +0 -379
  253. package/src/providers/ProviderFactory.ts +0 -36
  254. package/src/services/AudioInputService.ts +0 -226
  255. package/src/services/AudioOutputService.ts +0 -236
  256. package/src/services/KnowledgeBaseService.ts +0 -156
  257. package/src/services/VoiceService.ts +0 -451
  258. package/src/services/flags/FlagService.ts +0 -137
  259. package/src/services/telemetry/MobileAI.ts +0 -66
  260. package/src/services/telemetry/PiiScrubber.ts +0 -17
  261. package/src/services/telemetry/TelemetryService.ts +0 -323
  262. package/src/services/telemetry/TouchAutoCapture.ts +0 -165
  263. package/src/services/telemetry/device.ts +0 -93
  264. package/src/services/telemetry/deviceMetadata.ts +0 -13
  265. package/src/services/telemetry/index.ts +0 -13
  266. package/src/services/telemetry/types.ts +0 -75
  267. package/src/support/CSATSurvey.tsx +0 -304
  268. package/src/support/EscalationEventSource.ts +0 -190
  269. package/src/support/EscalationSocket.ts +0 -152
  270. package/src/support/SupportChatModal.tsx +0 -563
  271. package/src/support/SupportGreeting.tsx +0 -161
  272. package/src/support/TicketStore.ts +0 -100
  273. package/src/support/escalateTool.ts +0 -174
  274. package/src/support/index.ts +0 -29
  275. package/src/support/supportPrompt.ts +0 -55
  276. package/src/support/types.ts +0 -155
  277. package/src/tools/datePickerTool.ts +0 -60
  278. package/src/tools/guideTool.ts +0 -76
  279. package/src/tools/index.ts +0 -20
  280. package/src/tools/keyboardTool.ts +0 -30
  281. package/src/tools/longPressTool.ts +0 -61
  282. package/src/tools/pickerTool.ts +0 -115
  283. package/src/tools/restoreTool.ts +0 -33
  284. package/src/tools/scrollTool.ts +0 -156
  285. package/src/tools/simplifyTool.ts +0 -33
  286. package/src/tools/sliderTool.ts +0 -65
  287. package/src/tools/tapTool.ts +0 -93
  288. package/src/tools/typeTool.ts +0 -113
  289. package/src/tools/types.ts +0 -58
  290. package/src/types/jsx.d.ts +0 -20
  291. package/src/utils/audioUtils.ts +0 -54
  292. package/src/utils/logger.ts +0 -38
@@ -1,145 +0,0 @@
1
- import React, { useEffect, useRef } from 'react';
2
- import { View, Animated, StyleSheet, Text, Pressable } from 'react-native';
3
-
4
- interface ProactiveHintProps {
5
- stage: 'hidden' | 'pulse' | 'badge';
6
- badgeText?: string;
7
- onDismiss: () => void;
8
- children: React.ReactNode;
9
- }
10
-
11
- export function ProactiveHint({ stage, badgeText = "Need help?", onDismiss, children }: ProactiveHintProps) {
12
- const pulseAnim = useRef(new Animated.Value(1)).current;
13
- const opacityAnim = useRef(new Animated.Value(0)).current;
14
- const badgeScale = useRef(new Animated.Value(0)).current;
15
-
16
- useEffect(() => {
17
- // Pulse animation logic
18
- if (stage === 'pulse') {
19
- Animated.loop(
20
- Animated.sequence([
21
- Animated.parallel([
22
- Animated.timing(pulseAnim, {
23
- toValue: 1.3,
24
- duration: 1500,
25
- useNativeDriver: true,
26
- }),
27
- Animated.timing(opacityAnim, {
28
- toValue: 0,
29
- duration: 1500,
30
- useNativeDriver: true,
31
- }),
32
- ]),
33
- Animated.timing(pulseAnim, {
34
- toValue: 1,
35
- duration: 0,
36
- useNativeDriver: true,
37
- }),
38
- Animated.timing(opacityAnim, {
39
- toValue: 0.8,
40
- duration: 0,
41
- useNativeDriver: true,
42
- }),
43
- ])
44
- ).start();
45
- } else {
46
- pulseAnim.stopAnimation();
47
- opacityAnim.stopAnimation();
48
- pulseAnim.setValue(1);
49
- opacityAnim.setValue(0);
50
- }
51
-
52
- // Badge animation logic
53
- if (stage === 'badge') {
54
- Animated.spring(badgeScale, {
55
- toValue: 1,
56
- friction: 5,
57
- tension: 100,
58
- useNativeDriver: true,
59
- }).start();
60
- } else {
61
- badgeScale.setValue(0);
62
- }
63
- }, [stage, pulseAnim, opacityAnim, badgeScale]);
64
-
65
- return (
66
- <View style={styles.container}>
67
- {/* Badge State */}
68
- {stage === 'badge' && (
69
- <Animated.View style={[styles.badgeContainer, { transform: [{ scale: badgeScale }] }]}>
70
- <Text style={styles.badgeText}>{badgeText}</Text>
71
- <Pressable hitSlop={10} style={styles.closeButton} onPress={onDismiss}>
72
- <Text style={styles.closeText}>×</Text>
73
- </Pressable>
74
- </Animated.View>
75
- )}
76
-
77
- {/* Pulse effect under children */}
78
- {stage === 'pulse' && (
79
- <Animated.View
80
- style={[
81
- styles.pulseRing,
82
- {
83
- transform: [{ scale: pulseAnim }],
84
- opacity: opacityAnim,
85
- },
86
- ]}
87
- />
88
- )}
89
-
90
- {/* The main FAB or children */}
91
- {children}
92
- </View>
93
- );
94
- }
95
-
96
- const styles = StyleSheet.create({
97
- container: {
98
- alignItems: 'center',
99
- justifyContent: 'center',
100
- },
101
- pulseRing: {
102
- position: 'absolute',
103
- width: 60,
104
- height: 60,
105
- borderRadius: 30,
106
- backgroundColor: '#7B68EE',
107
- },
108
- badgeContainer: {
109
- position: 'absolute',
110
- bottom: 70, // Float above the FAB
111
- right: 0,
112
- flexDirection: 'row',
113
- alignItems: 'center',
114
- backgroundColor: '#ffffff',
115
- paddingHorizontal: 12,
116
- paddingVertical: 8,
117
- borderRadius: 20,
118
- shadowColor: '#000',
119
- shadowOffset: { width: 0, height: 2 },
120
- shadowOpacity: 0.15,
121
- shadowRadius: 4,
122
- elevation: 4,
123
- minWidth: 120,
124
- },
125
- badgeText: {
126
- color: '#333333',
127
- fontSize: 14,
128
- fontWeight: '500',
129
- marginRight: 8,
130
- },
131
- closeButton: {
132
- justifyContent: 'center',
133
- alignItems: 'center',
134
- width: 20,
135
- height: 20,
136
- borderRadius: 10,
137
- backgroundColor: '#f0f0f0',
138
- },
139
- closeText: {
140
- fontSize: 14,
141
- color: '#666',
142
- fontWeight: 'bold',
143
- marginTop: -2,
144
- },
145
- });
@@ -1,58 +0,0 @@
1
- import { View, Text, StyleSheet } from 'react-native';
2
-
3
- interface InfoCardProps {
4
- title?: string;
5
- body?: string;
6
- icon?: string;
7
- }
8
-
9
- /**
10
- * Built-in card template for AI injection.
11
- *
12
- * IMPORTANT: displayName must be set explicitly here.
13
- * In production/minified builds, the function name is mangled (e.g. `a`, `b`),
14
- * so `injectCardTool` cannot identify templates by inferred name alone.
15
- * Always look up templates by `T.displayName`, never by `T.name`.
16
- */
17
- export function InfoCard({ title = 'Info', body = '', icon = 'ℹ️' }: InfoCardProps) {
18
- return (
19
- <View style={styles.container}>
20
- <Text style={styles.icon}>{icon}</Text>
21
- <View style={styles.content}>
22
- <Text style={styles.title}>{title}</Text>
23
- {body ? <Text style={styles.body}>{body}</Text> : null}
24
- </View>
25
- </View>
26
- );
27
- }
28
-
29
- // Must be explicit — minification mangles function.name in production builds.
30
- InfoCard.displayName = 'InfoCard';
31
-
32
- const styles = StyleSheet.create({
33
- container: {
34
- flexDirection: 'row',
35
- alignItems: 'flex-start',
36
- backgroundColor: '#f0f7ff',
37
- borderRadius: 10,
38
- padding: 12,
39
- gap: 10,
40
- },
41
- icon: {
42
- fontSize: 22,
43
- },
44
- content: {
45
- flex: 1,
46
- },
47
- title: {
48
- fontWeight: '600',
49
- fontSize: 14,
50
- color: '#1a1a2e',
51
- marginBottom: 2,
52
- },
53
- body: {
54
- fontSize: 13,
55
- color: '#444',
56
- lineHeight: 18,
57
- },
58
- });
@@ -1,76 +0,0 @@
1
- import { View, Text, StyleSheet } from 'react-native';
2
-
3
- interface ReviewSummaryProps {
4
- rating?: number; // 0-5
5
- reviewCount?: number;
6
- headline?: string;
7
- sentiment?: 'positive' | 'neutral' | 'negative';
8
- }
9
-
10
- /**
11
- * Built-in card template that shows a product/service review summary.
12
- * Injected by the AI agent to surface social proof at decision points.
13
- *
14
- * IMPORTANT: displayName is set explicitly to survive minification.
15
- * The injectCardTool resolves templates by `T.displayName`, not `T.name`.
16
- */
17
- export function ReviewSummary({
18
- rating = 0,
19
- reviewCount = 0,
20
- headline = 'Customer Reviews',
21
- sentiment = 'neutral',
22
- }: ReviewSummaryProps) {
23
- const stars = Math.round(Math.min(5, Math.max(0, rating)));
24
- const filled = '★'.repeat(stars);
25
- const empty = '☆'.repeat(5 - stars);
26
-
27
- const sentimentColor: Record<ReviewSummaryProps['sentiment'] & string, string> = {
28
- positive: '#16a34a',
29
- neutral: '#6b7280',
30
- negative: '#dc2626',
31
- };
32
-
33
- return (
34
- <View style={styles.container}>
35
- <Text style={styles.headline}>{headline}</Text>
36
- <View style={styles.row}>
37
- <Text style={[styles.stars, { color: sentimentColor[sentiment] }]}>
38
- {filled}{empty}
39
- </Text>
40
- <Text style={styles.meta}>
41
- {rating.toFixed(1)} · {reviewCount.toLocaleString()} reviews
42
- </Text>
43
- </View>
44
- </View>
45
- );
46
- }
47
-
48
- // Explicit — function.name is mangled in minified production builds.
49
- ReviewSummary.displayName = 'ReviewSummary';
50
-
51
- const styles = StyleSheet.create({
52
- container: {
53
- backgroundColor: '#fffbeb',
54
- borderRadius: 10,
55
- padding: 12,
56
- },
57
- headline: {
58
- fontWeight: '600',
59
- fontSize: 13,
60
- color: '#1a1a2e',
61
- marginBottom: 6,
62
- },
63
- row: {
64
- flexDirection: 'row',
65
- alignItems: 'center',
66
- gap: 8,
67
- },
68
- stars: {
69
- fontSize: 18,
70
- letterSpacing: 1,
71
- },
72
- meta: {
73
- fontSize: 12,
74
- color: '#6b7280',
75
- },
76
- });
@@ -1,22 +0,0 @@
1
- /**
2
- * SDK Endpoint Configuration
3
- *
4
- * All MobileAI backend URLs live here.
5
- * Change these to point to a self-hosted or staging server.
6
- *
7
- * Enterprise customers: use the `analyticsProxyUrl` prop on <AIAgent>
8
- * to route telemetry through your own backend without touching this file.
9
- */
10
-
11
- const MOBILEAI_BASE = 'http://localhost:3001';
12
-
13
- export const ENDPOINTS = {
14
- /** Telemetry event ingest — receives batched SDK events */
15
- telemetryIngest: `${MOBILEAI_BASE}/api/v1/events`,
16
-
17
- /** Feature flag sync — fetches remote flags for this analyticsKey */
18
- featureFlags: `${MOBILEAI_BASE}/api/v1/flags`,
19
-
20
- /** Live agent escalation (support handoff) */
21
- escalation: `${MOBILEAI_BASE}`,
22
- } as const;
@@ -1,105 +0,0 @@
1
- import type { ActionDefinition, ActionParameterDef } from './types';
2
-
3
- export interface MCPToolDeclaration {
4
- name: string;
5
- description: string;
6
- inputSchema: {
7
- type: string;
8
- properties: Record<string, any>;
9
- required: string[];
10
- };
11
- }
12
-
13
- /**
14
- * A central registry for all actions registered via `useAction`.
15
- * This acts as the single source of truth for:
16
- * 1. The in-app AI Agent (AgentRuntime)
17
- * 2. The MCP Server (external agents)
18
- * 3. iOS App Intents (Siri)
19
- * 4. Android AppFunctions (Gemini)
20
- */
21
- export class ActionRegistry {
22
- private actions = new Map<string, ActionDefinition>();
23
- private listeners = new Set<() => void>();
24
-
25
- /** Register a new action definition */
26
- register(action: ActionDefinition): void {
27
- this.actions.set(action.name, action);
28
- this.notify();
29
- }
30
-
31
- /** Unregister an action by name */
32
- unregister(name: string): void {
33
- this.actions.delete(name);
34
- this.notify();
35
- }
36
-
37
- /** Get a specific action by name */
38
- get(name: string): ActionDefinition | undefined {
39
- return this.actions.get(name);
40
- }
41
-
42
- /** Get all registered actions */
43
- getAll(): ActionDefinition[] {
44
- return Array.from(this.actions.values());
45
- }
46
-
47
- /** Clear all registered actions (useful for testing) */
48
- clear(): void {
49
- this.actions.clear();
50
- this.notify();
51
- }
52
-
53
- /**
54
- * Subscribe to changes (e.g. when a new screen mounts and registers actions).
55
- * Useful for the MCP server to re-announce tools.
56
- */
57
- onChange(listener: () => void): () => void {
58
- this.listeners.add(listener);
59
- return () => {
60
- this.listeners.delete(listener);
61
- };
62
- }
63
-
64
- /** Serialize all actions as strictly-typed MCP tool declarations */
65
- toMCPTools(): MCPToolDeclaration[] {
66
- return this.getAll().map((a) => ({
67
- name: a.name,
68
- description: a.description,
69
- inputSchema: this.buildInputSchema(a.parameters),
70
- }));
71
- }
72
-
73
- private buildInputSchema(params: Record<string, string | ActionParameterDef>) {
74
- const properties: Record<string, any> = {};
75
- const required: string[] = [];
76
-
77
- for (const [key, val] of Object.entries(params)) {
78
- if (typeof val === 'string') {
79
- // Backward compatibility: passing a string means it's a required string param.
80
- properties[key] = { type: 'string', description: val };
81
- required.push(key);
82
- } else {
83
- // New strict parameter definition
84
- properties[key] = { type: val.type, description: val.description };
85
- if (val.enum) {
86
- properties[key].enum = val.enum;
87
- }
88
- if (val.required !== false) {
89
- required.push(key);
90
- }
91
- }
92
- }
93
-
94
- return { type: 'object', properties, required };
95
- }
96
-
97
- private notify() {
98
- this.listeners.forEach((l) => l());
99
- }
100
- }
101
-
102
- // Export a singleton instance.
103
- // This allows background channels (like App Intents bridging) to access actions
104
- // even if the React tree hasn't accessed the AIAgent context yet.
105
- export const actionRegistry = new ActionRegistry();