@intentcomputing/koko-agent-sdk 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (622) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/CODE_OF_CONDUCT.md +3 -0
  3. package/CONTRIBUTING.md +9 -0
  4. package/LICENSE +21 -0
  5. package/README.md +65 -0
  6. package/README.zh-CN.md +50 -0
  7. package/SECURITY.md +5 -0
  8. package/android/build.gradle +40 -0
  9. package/android/src/main/AndroidManifest.xml +2 -0
  10. package/android/src/main/java/cn/intentcomputing/kokoagentsdk/KokoAgentSdkModule.java +1356 -0
  11. package/android/src/main/java/cn/intentcomputing/kokoagentsdk/KokoAgentSdkPackage.java +23 -0
  12. package/docs/INTEGRATION.md +168 -0
  13. package/docs/INTEGRATION.zh-CN.md +140 -0
  14. package/docs/PRIVACY.md +11 -0
  15. package/docs/PRIVACY.zh-CN.md +11 -0
  16. package/docs/PUBLISH.md +11 -0
  17. package/docs/PUBLISH.zh-CN.md +11 -0
  18. package/ios/KokoAgentSdk/KokoAgentSdk.h +5 -0
  19. package/ios/KokoAgentSdk/KokoAgentSdk.m +2464 -0
  20. package/ios/KokoAgentSdk/KokoOcrBounds.h +20 -0
  21. package/ios/KokoAgentSdk/KokoScrollBounds.h +21 -0
  22. package/koko-agent-sdk.podspec +23 -0
  23. package/lib/commonjs/KokoAgent.js +1427 -0
  24. package/lib/commonjs/KokoAgent.js.map +1 -0
  25. package/lib/commonjs/assist/OnDeviceAssist.js +94 -0
  26. package/lib/commonjs/assist/OnDeviceAssist.js.map +1 -0
  27. package/lib/commonjs/assist/intentClassify.js +100 -0
  28. package/lib/commonjs/assist/intentClassify.js.map +1 -0
  29. package/lib/commonjs/assist/nodeRank.js +120 -0
  30. package/lib/commonjs/assist/nodeRank.js.map +1 -0
  31. package/lib/commonjs/assist/ocrTarget.js +135 -0
  32. package/lib/commonjs/assist/ocrTarget.js.map +1 -0
  33. package/lib/commonjs/assist/webVisualChange.js +29 -0
  34. package/lib/commonjs/assist/webVisualChange.js.map +1 -0
  35. package/lib/commonjs/client/ActionOutcomeUnknownError.js +28 -0
  36. package/lib/commonjs/client/ActionOutcomeUnknownError.js.map +1 -0
  37. package/lib/commonjs/client/AgentSession.js +858 -0
  38. package/lib/commonjs/client/AgentSession.js.map +1 -0
  39. package/lib/commonjs/client/GatewayClient.js +302 -0
  40. package/lib/commonjs/client/GatewayClient.js.map +1 -0
  41. package/lib/commonjs/client/OperationReplayGuard.js +62 -0
  42. package/lib/commonjs/client/OperationReplayGuard.js.map +1 -0
  43. package/lib/commonjs/client/RunCheckpoint.js +139 -0
  44. package/lib/commonjs/client/RunCheckpoint.js.map +1 -0
  45. package/lib/commonjs/client/loopDetect.js +184 -0
  46. package/lib/commonjs/client/loopDetect.js.map +1 -0
  47. package/lib/commonjs/client/recentSearch.js +50 -0
  48. package/lib/commonjs/client/recentSearch.js.map +1 -0
  49. package/lib/commonjs/client/walletChoiceGuard.js +18 -0
  50. package/lib/commonjs/client/walletChoiceGuard.js.map +1 -0
  51. package/lib/commonjs/client/webResultCategory.js +38 -0
  52. package/lib/commonjs/client/webResultCategory.js.map +1 -0
  53. package/lib/commonjs/commercial/AccountStore.js +78 -0
  54. package/lib/commonjs/commercial/AccountStore.js.map +1 -0
  55. package/lib/commonjs/commercial/AgentDebug.js +104 -0
  56. package/lib/commonjs/commercial/AgentDebug.js.map +1 -0
  57. package/lib/commonjs/commercial/ExecutionGuard.js +53 -0
  58. package/lib/commonjs/commercial/ExecutionGuard.js.map +1 -0
  59. package/lib/commonjs/commercial/UsageBus.js +42 -0
  60. package/lib/commonjs/commercial/UsageBus.js.map +1 -0
  61. package/lib/commonjs/commercial/branding.js +69 -0
  62. package/lib/commonjs/commercial/branding.js.map +1 -0
  63. package/lib/commonjs/commercial/devMode.js +52 -0
  64. package/lib/commonjs/commercial/devMode.js.map +1 -0
  65. package/lib/commonjs/commercial/trust.js +69 -0
  66. package/lib/commonjs/commercial/trust.js.map +1 -0
  67. package/lib/commonjs/confirmation/gate.js +62 -0
  68. package/lib/commonjs/confirmation/gate.js.map +1 -0
  69. package/lib/commonjs/cursor/CursorOverlay.js +141 -0
  70. package/lib/commonjs/cursor/CursorOverlay.js.map +1 -0
  71. package/lib/commonjs/cursor/PointerHand.js +51 -0
  72. package/lib/commonjs/cursor/PointerHand.js.map +1 -0
  73. package/lib/commonjs/cursor/controller.js +91 -0
  74. package/lib/commonjs/cursor/controller.js.map +1 -0
  75. package/lib/commonjs/cursor/pointer.js +49 -0
  76. package/lib/commonjs/cursor/pointer.js.map +1 -0
  77. package/lib/commonjs/debug/KokoRemoteSmoke.js +611 -0
  78. package/lib/commonjs/debug/KokoRemoteSmoke.js.map +1 -0
  79. package/lib/commonjs/explore/ExplorationGraph.js +418 -0
  80. package/lib/commonjs/explore/ExplorationGraph.js.map +1 -0
  81. package/lib/commonjs/explore/bootstrapExplore.js +59 -0
  82. package/lib/commonjs/explore/bootstrapExplore.js.map +1 -0
  83. package/lib/commonjs/host/HostActions.js +266 -0
  84. package/lib/commonjs/host/HostActions.js.map +1 -0
  85. package/lib/commonjs/i18n/index.js +169 -0
  86. package/lib/commonjs/i18n/index.js.map +1 -0
  87. package/lib/commonjs/i18n/runtimeMessages.js +184 -0
  88. package/lib/commonjs/i18n/runtimeMessages.js.map +1 -0
  89. package/lib/commonjs/index.js +640 -0
  90. package/lib/commonjs/index.js.map +1 -0
  91. package/lib/commonjs/native/NativeBridge.js +132 -0
  92. package/lib/commonjs/native/NativeBridge.js.map +1 -0
  93. package/lib/commonjs/native/navigationLabel.js +16 -0
  94. package/lib/commonjs/native/navigationLabel.js.map +1 -0
  95. package/lib/commonjs/native/normalizeViewTree.js +28 -0
  96. package/lib/commonjs/native/normalizeViewTree.js.map +1 -0
  97. package/lib/commonjs/native/pruneOffscreen.js +76 -0
  98. package/lib/commonjs/native/pruneOffscreen.js.map +1 -0
  99. package/lib/commonjs/native/scrollViewport.js +69 -0
  100. package/lib/commonjs/native/scrollViewport.js.map +1 -0
  101. package/lib/commonjs/package.json +1 -0
  102. package/lib/commonjs/privacy/redact.js +108 -0
  103. package/lib/commonjs/privacy/redact.js.map +1 -0
  104. package/lib/commonjs/privacy/screenEvidence.js +59 -0
  105. package/lib/commonjs/privacy/screenEvidence.js.map +1 -0
  106. package/lib/commonjs/privacy/screenModel.js +404 -0
  107. package/lib/commonjs/privacy/screenModel.js.map +1 -0
  108. package/lib/commonjs/privacy/sensitiveScreen.js +58 -0
  109. package/lib/commonjs/privacy/sensitiveScreen.js.map +1 -0
  110. package/lib/commonjs/privacy/userGate.js +213 -0
  111. package/lib/commonjs/privacy/userGate.js.map +1 -0
  112. package/lib/commonjs/protocol/actions.js +112 -0
  113. package/lib/commonjs/protocol/actions.js.map +1 -0
  114. package/lib/commonjs/provider/HostAppearanceStore.js +111 -0
  115. package/lib/commonjs/provider/HostAppearanceStore.js.map +1 -0
  116. package/lib/commonjs/provider/KokoProvider.js +81 -0
  117. package/lib/commonjs/provider/KokoProvider.js.map +1 -0
  118. package/lib/commonjs/provider/KokoUiContext.js +102 -0
  119. package/lib/commonjs/provider/KokoUiContext.js.map +1 -0
  120. package/lib/commonjs/selector/match.js +378 -0
  121. package/lib/commonjs/selector/match.js.map +1 -0
  122. package/lib/commonjs/task/TaskStore.js +361 -0
  123. package/lib/commonjs/task/TaskStore.js.map +1 -0
  124. package/lib/commonjs/task/types.js +2 -0
  125. package/lib/commonjs/task/types.js.map +1 -0
  126. package/lib/commonjs/task/useTaskStore.js +14 -0
  127. package/lib/commonjs/task/useTaskStore.js.map +1 -0
  128. package/lib/commonjs/types.js +2 -0
  129. package/lib/commonjs/types.js.map +1 -0
  130. package/lib/commonjs/ui/KokoChatSheet.js +885 -0
  131. package/lib/commonjs/ui/KokoChatSheet.js.map +1 -0
  132. package/lib/commonjs/ui/KokoComposer.js +161 -0
  133. package/lib/commonjs/ui/KokoComposer.js.map +1 -0
  134. package/lib/commonjs/ui/KokoDialogHost.js +254 -0
  135. package/lib/commonjs/ui/KokoDialogHost.js.map +1 -0
  136. package/lib/commonjs/ui/KokoEntryButton.js +81 -0
  137. package/lib/commonjs/ui/KokoEntryButton.js.map +1 -0
  138. package/lib/commonjs/ui/KokoObserver.js +522 -0
  139. package/lib/commonjs/ui/KokoObserver.js.map +1 -0
  140. package/lib/commonjs/ui/KokoOverlayLayer.js +45 -0
  141. package/lib/commonjs/ui/KokoOverlayLayer.js.map +1 -0
  142. package/lib/commonjs/ui/KokoSubtitle.js +95 -0
  143. package/lib/commonjs/ui/KokoSubtitle.js.map +1 -0
  144. package/lib/commonjs/ui/KokoTaskPanel.js +322 -0
  145. package/lib/commonjs/ui/KokoTaskPanel.js.map +1 -0
  146. package/lib/commonjs/ui/hostOverlay.js +126 -0
  147. package/lib/commonjs/ui/hostOverlay.js.map +1 -0
  148. package/lib/commonjs/ui/icons.js +132 -0
  149. package/lib/commonjs/ui/icons.js.map +1 -0
  150. package/lib/commonjs/ui/progressChrome.js +66 -0
  151. package/lib/commonjs/ui/progressChrome.js.map +1 -0
  152. package/lib/commonjs/ui/safeArea.js +96 -0
  153. package/lib/commonjs/ui/safeArea.js.map +1 -0
  154. package/lib/commonjs/ui/useOverlayOrigin.js +40 -0
  155. package/lib/commonjs/ui/useOverlayOrigin.js.map +1 -0
  156. package/lib/module/KokoAgent.js +1418 -0
  157. package/lib/module/KokoAgent.js.map +1 -0
  158. package/lib/module/assist/OnDeviceAssist.js +89 -0
  159. package/lib/module/assist/OnDeviceAssist.js.map +1 -0
  160. package/lib/module/assist/intentClassify.js +95 -0
  161. package/lib/module/assist/intentClassify.js.map +1 -0
  162. package/lib/module/assist/nodeRank.js +115 -0
  163. package/lib/module/assist/nodeRank.js.map +1 -0
  164. package/lib/module/assist/ocrTarget.js +123 -0
  165. package/lib/module/assist/ocrTarget.js.map +1 -0
  166. package/lib/module/assist/webVisualChange.js +24 -0
  167. package/lib/module/assist/webVisualChange.js.map +1 -0
  168. package/lib/module/client/ActionOutcomeUnknownError.js +23 -0
  169. package/lib/module/client/ActionOutcomeUnknownError.js.map +1 -0
  170. package/lib/module/client/AgentSession.js +854 -0
  171. package/lib/module/client/AgentSession.js.map +1 -0
  172. package/lib/module/client/GatewayClient.js +293 -0
  173. package/lib/module/client/GatewayClient.js.map +1 -0
  174. package/lib/module/client/OperationReplayGuard.js +58 -0
  175. package/lib/module/client/OperationReplayGuard.js.map +1 -0
  176. package/lib/module/client/RunCheckpoint.js +135 -0
  177. package/lib/module/client/RunCheckpoint.js.map +1 -0
  178. package/lib/module/client/loopDetect.js +177 -0
  179. package/lib/module/client/loopDetect.js.map +1 -0
  180. package/lib/module/client/recentSearch.js +46 -0
  181. package/lib/module/client/recentSearch.js.map +1 -0
  182. package/lib/module/client/walletChoiceGuard.js +14 -0
  183. package/lib/module/client/walletChoiceGuard.js.map +1 -0
  184. package/lib/module/client/webResultCategory.js +34 -0
  185. package/lib/module/client/webResultCategory.js.map +1 -0
  186. package/lib/module/commercial/AccountStore.js +75 -0
  187. package/lib/module/commercial/AccountStore.js.map +1 -0
  188. package/lib/module/commercial/AgentDebug.js +99 -0
  189. package/lib/module/commercial/AgentDebug.js.map +1 -0
  190. package/lib/module/commercial/ExecutionGuard.js +49 -0
  191. package/lib/module/commercial/ExecutionGuard.js.map +1 -0
  192. package/lib/module/commercial/UsageBus.js +38 -0
  193. package/lib/module/commercial/UsageBus.js.map +1 -0
  194. package/lib/module/commercial/branding.js +63 -0
  195. package/lib/module/commercial/branding.js.map +1 -0
  196. package/lib/module/commercial/devMode.js +45 -0
  197. package/lib/module/commercial/devMode.js.map +1 -0
  198. package/lib/module/commercial/trust.js +62 -0
  199. package/lib/module/commercial/trust.js.map +1 -0
  200. package/lib/module/confirmation/gate.js +54 -0
  201. package/lib/module/confirmation/gate.js.map +1 -0
  202. package/lib/module/cursor/CursorOverlay.js +136 -0
  203. package/lib/module/cursor/CursorOverlay.js.map +1 -0
  204. package/lib/module/cursor/PointerHand.js +47 -0
  205. package/lib/module/cursor/PointerHand.js.map +1 -0
  206. package/lib/module/cursor/controller.js +87 -0
  207. package/lib/module/cursor/controller.js.map +1 -0
  208. package/lib/module/cursor/pointer.js +45 -0
  209. package/lib/module/cursor/pointer.js.map +1 -0
  210. package/lib/module/debug/KokoRemoteSmoke.js +608 -0
  211. package/lib/module/debug/KokoRemoteSmoke.js.map +1 -0
  212. package/lib/module/explore/ExplorationGraph.js +406 -0
  213. package/lib/module/explore/ExplorationGraph.js.map +1 -0
  214. package/lib/module/explore/bootstrapExplore.js +55 -0
  215. package/lib/module/explore/bootstrapExplore.js.map +1 -0
  216. package/lib/module/host/HostActions.js +255 -0
  217. package/lib/module/host/HostActions.js.map +1 -0
  218. package/lib/module/i18n/index.js +159 -0
  219. package/lib/module/i18n/index.js.map +1 -0
  220. package/lib/module/i18n/runtimeMessages.js +180 -0
  221. package/lib/module/i18n/runtimeMessages.js.map +1 -0
  222. package/lib/module/index.js +44 -0
  223. package/lib/module/index.js.map +1 -0
  224. package/lib/module/native/NativeBridge.js +128 -0
  225. package/lib/module/native/NativeBridge.js.map +1 -0
  226. package/lib/module/native/navigationLabel.js +12 -0
  227. package/lib/module/native/navigationLabel.js.map +1 -0
  228. package/lib/module/native/normalizeViewTree.js +25 -0
  229. package/lib/module/native/normalizeViewTree.js.map +1 -0
  230. package/lib/module/native/pruneOffscreen.js +72 -0
  231. package/lib/module/native/pruneOffscreen.js.map +1 -0
  232. package/lib/module/native/scrollViewport.js +63 -0
  233. package/lib/module/native/scrollViewport.js.map +1 -0
  234. package/lib/module/package.json +1 -0
  235. package/lib/module/privacy/redact.js +103 -0
  236. package/lib/module/privacy/redact.js.map +1 -0
  237. package/lib/module/privacy/screenEvidence.js +50 -0
  238. package/lib/module/privacy/screenEvidence.js.map +1 -0
  239. package/lib/module/privacy/screenModel.js +397 -0
  240. package/lib/module/privacy/screenModel.js.map +1 -0
  241. package/lib/module/privacy/sensitiveScreen.js +52 -0
  242. package/lib/module/privacy/sensitiveScreen.js.map +1 -0
  243. package/lib/module/privacy/userGate.js +202 -0
  244. package/lib/module/privacy/userGate.js.map +1 -0
  245. package/lib/module/protocol/actions.js +108 -0
  246. package/lib/module/protocol/actions.js.map +1 -0
  247. package/lib/module/provider/HostAppearanceStore.js +101 -0
  248. package/lib/module/provider/HostAppearanceStore.js.map +1 -0
  249. package/lib/module/provider/KokoProvider.js +74 -0
  250. package/lib/module/provider/KokoProvider.js.map +1 -0
  251. package/lib/module/provider/KokoUiContext.js +96 -0
  252. package/lib/module/provider/KokoUiContext.js.map +1 -0
  253. package/lib/module/selector/match.js +366 -0
  254. package/lib/module/selector/match.js.map +1 -0
  255. package/lib/module/task/TaskStore.js +356 -0
  256. package/lib/module/task/TaskStore.js.map +1 -0
  257. package/lib/module/task/types.js +2 -0
  258. package/lib/module/task/types.js.map +1 -0
  259. package/lib/module/task/useTaskStore.js +10 -0
  260. package/lib/module/task/useTaskStore.js.map +1 -0
  261. package/lib/module/types.js +2 -0
  262. package/lib/module/types.js.map +1 -0
  263. package/lib/module/ui/KokoChatSheet.js +879 -0
  264. package/lib/module/ui/KokoChatSheet.js.map +1 -0
  265. package/lib/module/ui/KokoComposer.js +155 -0
  266. package/lib/module/ui/KokoComposer.js.map +1 -0
  267. package/lib/module/ui/KokoDialogHost.js +247 -0
  268. package/lib/module/ui/KokoDialogHost.js.map +1 -0
  269. package/lib/module/ui/KokoEntryButton.js +74 -0
  270. package/lib/module/ui/KokoEntryButton.js.map +1 -0
  271. package/lib/module/ui/KokoObserver.js +516 -0
  272. package/lib/module/ui/KokoObserver.js.map +1 -0
  273. package/lib/module/ui/KokoOverlayLayer.js +39 -0
  274. package/lib/module/ui/KokoOverlayLayer.js.map +1 -0
  275. package/lib/module/ui/KokoSubtitle.js +90 -0
  276. package/lib/module/ui/KokoSubtitle.js.map +1 -0
  277. package/lib/module/ui/KokoTaskPanel.js +316 -0
  278. package/lib/module/ui/KokoTaskPanel.js.map +1 -0
  279. package/lib/module/ui/hostOverlay.js +120 -0
  280. package/lib/module/ui/hostOverlay.js.map +1 -0
  281. package/lib/module/ui/icons.js +124 -0
  282. package/lib/module/ui/icons.js.map +1 -0
  283. package/lib/module/ui/progressChrome.js +58 -0
  284. package/lib/module/ui/progressChrome.js.map +1 -0
  285. package/lib/module/ui/safeArea.js +92 -0
  286. package/lib/module/ui/safeArea.js.map +1 -0
  287. package/lib/module/ui/useOverlayOrigin.js +36 -0
  288. package/lib/module/ui/useOverlayOrigin.js.map +1 -0
  289. package/lib/typescript/commonjs/KokoAgent.d.ts +167 -0
  290. package/lib/typescript/commonjs/KokoAgent.d.ts.map +1 -0
  291. package/lib/typescript/commonjs/assist/OnDeviceAssist.d.ts +31 -0
  292. package/lib/typescript/commonjs/assist/OnDeviceAssist.d.ts.map +1 -0
  293. package/lib/typescript/commonjs/assist/intentClassify.d.ts +18 -0
  294. package/lib/typescript/commonjs/assist/intentClassify.d.ts.map +1 -0
  295. package/lib/typescript/commonjs/assist/nodeRank.d.ts +32 -0
  296. package/lib/typescript/commonjs/assist/nodeRank.d.ts.map +1 -0
  297. package/lib/typescript/commonjs/assist/ocrTarget.d.ts +25 -0
  298. package/lib/typescript/commonjs/assist/ocrTarget.d.ts.map +1 -0
  299. package/lib/typescript/commonjs/assist/webVisualChange.d.ts +6 -0
  300. package/lib/typescript/commonjs/assist/webVisualChange.d.ts.map +1 -0
  301. package/lib/typescript/commonjs/client/ActionOutcomeUnknownError.d.ts +13 -0
  302. package/lib/typescript/commonjs/client/ActionOutcomeUnknownError.d.ts.map +1 -0
  303. package/lib/typescript/commonjs/client/AgentSession.d.ts +56 -0
  304. package/lib/typescript/commonjs/client/AgentSession.d.ts.map +1 -0
  305. package/lib/typescript/commonjs/client/GatewayClient.d.ts +149 -0
  306. package/lib/typescript/commonjs/client/GatewayClient.d.ts.map +1 -0
  307. package/lib/typescript/commonjs/client/OperationReplayGuard.d.ts +13 -0
  308. package/lib/typescript/commonjs/client/OperationReplayGuard.d.ts.map +1 -0
  309. package/lib/typescript/commonjs/client/RunCheckpoint.d.ts +57 -0
  310. package/lib/typescript/commonjs/client/RunCheckpoint.d.ts.map +1 -0
  311. package/lib/typescript/commonjs/client/loopDetect.d.ts +15 -0
  312. package/lib/typescript/commonjs/client/loopDetect.d.ts.map +1 -0
  313. package/lib/typescript/commonjs/client/recentSearch.d.ts +5 -0
  314. package/lib/typescript/commonjs/client/recentSearch.d.ts.map +1 -0
  315. package/lib/typescript/commonjs/client/walletChoiceGuard.d.ts +4 -0
  316. package/lib/typescript/commonjs/client/walletChoiceGuard.d.ts.map +1 -0
  317. package/lib/typescript/commonjs/client/webResultCategory.d.ts +5 -0
  318. package/lib/typescript/commonjs/client/webResultCategory.d.ts.map +1 -0
  319. package/lib/typescript/commonjs/commercial/AccountStore.d.ts +17 -0
  320. package/lib/typescript/commonjs/commercial/AccountStore.d.ts.map +1 -0
  321. package/lib/typescript/commonjs/commercial/AgentDebug.d.ts +25 -0
  322. package/lib/typescript/commonjs/commercial/AgentDebug.d.ts.map +1 -0
  323. package/lib/typescript/commonjs/commercial/ExecutionGuard.d.ts +18 -0
  324. package/lib/typescript/commonjs/commercial/ExecutionGuard.d.ts.map +1 -0
  325. package/lib/typescript/commonjs/commercial/UsageBus.d.ts +18 -0
  326. package/lib/typescript/commonjs/commercial/UsageBus.d.ts.map +1 -0
  327. package/lib/typescript/commonjs/commercial/branding.d.ts +25 -0
  328. package/lib/typescript/commonjs/commercial/branding.d.ts.map +1 -0
  329. package/lib/typescript/commonjs/commercial/devMode.d.ts +26 -0
  330. package/lib/typescript/commonjs/commercial/devMode.d.ts.map +1 -0
  331. package/lib/typescript/commonjs/commercial/trust.d.ts +21 -0
  332. package/lib/typescript/commonjs/commercial/trust.d.ts.map +1 -0
  333. package/lib/typescript/commonjs/confirmation/gate.d.ts +18 -0
  334. package/lib/typescript/commonjs/confirmation/gate.d.ts.map +1 -0
  335. package/lib/typescript/commonjs/cursor/CursorOverlay.d.ts +13 -0
  336. package/lib/typescript/commonjs/cursor/CursorOverlay.d.ts.map +1 -0
  337. package/lib/typescript/commonjs/cursor/PointerHand.d.ts +16 -0
  338. package/lib/typescript/commonjs/cursor/PointerHand.d.ts.map +1 -0
  339. package/lib/typescript/commonjs/cursor/controller.d.ts +30 -0
  340. package/lib/typescript/commonjs/cursor/controller.d.ts.map +1 -0
  341. package/lib/typescript/commonjs/cursor/pointer.d.ts +23 -0
  342. package/lib/typescript/commonjs/cursor/pointer.d.ts.map +1 -0
  343. package/lib/typescript/commonjs/debug/KokoRemoteSmoke.d.ts +96 -0
  344. package/lib/typescript/commonjs/debug/KokoRemoteSmoke.d.ts.map +1 -0
  345. package/lib/typescript/commonjs/explore/ExplorationGraph.d.ts +96 -0
  346. package/lib/typescript/commonjs/explore/ExplorationGraph.d.ts.map +1 -0
  347. package/lib/typescript/commonjs/explore/bootstrapExplore.d.ts +40 -0
  348. package/lib/typescript/commonjs/explore/bootstrapExplore.d.ts.map +1 -0
  349. package/lib/typescript/commonjs/host/HostActions.d.ts +101 -0
  350. package/lib/typescript/commonjs/host/HostActions.d.ts.map +1 -0
  351. package/lib/typescript/commonjs/i18n/index.d.ts +20 -0
  352. package/lib/typescript/commonjs/i18n/index.d.ts.map +1 -0
  353. package/lib/typescript/commonjs/i18n/runtimeMessages.d.ts +178 -0
  354. package/lib/typescript/commonjs/i18n/runtimeMessages.d.ts.map +1 -0
  355. package/lib/typescript/commonjs/index.d.ts +66 -0
  356. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  357. package/lib/typescript/commonjs/native/NativeBridge.d.ts +70 -0
  358. package/lib/typescript/commonjs/native/NativeBridge.d.ts.map +1 -0
  359. package/lib/typescript/commonjs/native/navigationLabel.d.ts +4 -0
  360. package/lib/typescript/commonjs/native/navigationLabel.d.ts.map +1 -0
  361. package/lib/typescript/commonjs/native/normalizeViewTree.d.ts +4 -0
  362. package/lib/typescript/commonjs/native/normalizeViewTree.d.ts.map +1 -0
  363. package/lib/typescript/commonjs/native/pruneOffscreen.d.ts +3 -0
  364. package/lib/typescript/commonjs/native/pruneOffscreen.d.ts.map +1 -0
  365. package/lib/typescript/commonjs/native/scrollViewport.d.ts +13 -0
  366. package/lib/typescript/commonjs/native/scrollViewport.d.ts.map +1 -0
  367. package/lib/typescript/commonjs/package.json +1 -0
  368. package/lib/typescript/commonjs/privacy/redact.d.ts +9 -0
  369. package/lib/typescript/commonjs/privacy/redact.d.ts.map +1 -0
  370. package/lib/typescript/commonjs/privacy/screenEvidence.d.ts +14 -0
  371. package/lib/typescript/commonjs/privacy/screenEvidence.d.ts.map +1 -0
  372. package/lib/typescript/commonjs/privacy/screenModel.d.ts +26 -0
  373. package/lib/typescript/commonjs/privacy/screenModel.d.ts.map +1 -0
  374. package/lib/typescript/commonjs/privacy/sensitiveScreen.d.ts +8 -0
  375. package/lib/typescript/commonjs/privacy/sensitiveScreen.d.ts.map +1 -0
  376. package/lib/typescript/commonjs/privacy/userGate.d.ts +58 -0
  377. package/lib/typescript/commonjs/privacy/userGate.d.ts.map +1 -0
  378. package/lib/typescript/commonjs/protocol/actions.d.ts +7 -0
  379. package/lib/typescript/commonjs/protocol/actions.d.ts.map +1 -0
  380. package/lib/typescript/commonjs/provider/HostAppearanceStore.d.ts +64 -0
  381. package/lib/typescript/commonjs/provider/HostAppearanceStore.d.ts.map +1 -0
  382. package/lib/typescript/commonjs/provider/KokoProvider.d.ts +39 -0
  383. package/lib/typescript/commonjs/provider/KokoProvider.d.ts.map +1 -0
  384. package/lib/typescript/commonjs/provider/KokoUiContext.d.ts +22 -0
  385. package/lib/typescript/commonjs/provider/KokoUiContext.d.ts.map +1 -0
  386. package/lib/typescript/commonjs/selector/match.d.ts +27 -0
  387. package/lib/typescript/commonjs/selector/match.d.ts.map +1 -0
  388. package/lib/typescript/commonjs/task/TaskStore.d.ts +65 -0
  389. package/lib/typescript/commonjs/task/TaskStore.d.ts.map +1 -0
  390. package/lib/typescript/commonjs/task/types.d.ts +66 -0
  391. package/lib/typescript/commonjs/task/types.d.ts.map +1 -0
  392. package/lib/typescript/commonjs/task/useTaskStore.d.ts +3 -0
  393. package/lib/typescript/commonjs/task/useTaskStore.d.ts.map +1 -0
  394. package/lib/typescript/commonjs/types.d.ts +372 -0
  395. package/lib/typescript/commonjs/types.d.ts.map +1 -0
  396. package/lib/typescript/commonjs/ui/KokoChatSheet.d.ts +8 -0
  397. package/lib/typescript/commonjs/ui/KokoChatSheet.d.ts.map +1 -0
  398. package/lib/typescript/commonjs/ui/KokoComposer.d.ts +13 -0
  399. package/lib/typescript/commonjs/ui/KokoComposer.d.ts.map +1 -0
  400. package/lib/typescript/commonjs/ui/KokoDialogHost.d.ts +32 -0
  401. package/lib/typescript/commonjs/ui/KokoDialogHost.d.ts.map +1 -0
  402. package/lib/typescript/commonjs/ui/KokoEntryButton.d.ts +18 -0
  403. package/lib/typescript/commonjs/ui/KokoEntryButton.d.ts.map +1 -0
  404. package/lib/typescript/commonjs/ui/KokoObserver.d.ts +13 -0
  405. package/lib/typescript/commonjs/ui/KokoObserver.d.ts.map +1 -0
  406. package/lib/typescript/commonjs/ui/KokoOverlayLayer.d.ts +35 -0
  407. package/lib/typescript/commonjs/ui/KokoOverlayLayer.d.ts.map +1 -0
  408. package/lib/typescript/commonjs/ui/KokoSubtitle.d.ts +7 -0
  409. package/lib/typescript/commonjs/ui/KokoSubtitle.d.ts.map +1 -0
  410. package/lib/typescript/commonjs/ui/KokoTaskPanel.d.ts +7 -0
  411. package/lib/typescript/commonjs/ui/KokoTaskPanel.d.ts.map +1 -0
  412. package/lib/typescript/commonjs/ui/hostOverlay.d.ts +28 -0
  413. package/lib/typescript/commonjs/ui/hostOverlay.d.ts.map +1 -0
  414. package/lib/typescript/commonjs/ui/icons.d.ts +26 -0
  415. package/lib/typescript/commonjs/ui/icons.d.ts.map +1 -0
  416. package/lib/typescript/commonjs/ui/progressChrome.d.ts +21 -0
  417. package/lib/typescript/commonjs/ui/progressChrome.d.ts.map +1 -0
  418. package/lib/typescript/commonjs/ui/safeArea.d.ts +12 -0
  419. package/lib/typescript/commonjs/ui/safeArea.d.ts.map +1 -0
  420. package/lib/typescript/commonjs/ui/useOverlayOrigin.d.ts +22 -0
  421. package/lib/typescript/commonjs/ui/useOverlayOrigin.d.ts.map +1 -0
  422. package/lib/typescript/module/KokoAgent.d.ts +167 -0
  423. package/lib/typescript/module/KokoAgent.d.ts.map +1 -0
  424. package/lib/typescript/module/assist/OnDeviceAssist.d.ts +31 -0
  425. package/lib/typescript/module/assist/OnDeviceAssist.d.ts.map +1 -0
  426. package/lib/typescript/module/assist/intentClassify.d.ts +18 -0
  427. package/lib/typescript/module/assist/intentClassify.d.ts.map +1 -0
  428. package/lib/typescript/module/assist/nodeRank.d.ts +32 -0
  429. package/lib/typescript/module/assist/nodeRank.d.ts.map +1 -0
  430. package/lib/typescript/module/assist/ocrTarget.d.ts +25 -0
  431. package/lib/typescript/module/assist/ocrTarget.d.ts.map +1 -0
  432. package/lib/typescript/module/assist/webVisualChange.d.ts +6 -0
  433. package/lib/typescript/module/assist/webVisualChange.d.ts.map +1 -0
  434. package/lib/typescript/module/client/ActionOutcomeUnknownError.d.ts +13 -0
  435. package/lib/typescript/module/client/ActionOutcomeUnknownError.d.ts.map +1 -0
  436. package/lib/typescript/module/client/AgentSession.d.ts +56 -0
  437. package/lib/typescript/module/client/AgentSession.d.ts.map +1 -0
  438. package/lib/typescript/module/client/GatewayClient.d.ts +149 -0
  439. package/lib/typescript/module/client/GatewayClient.d.ts.map +1 -0
  440. package/lib/typescript/module/client/OperationReplayGuard.d.ts +13 -0
  441. package/lib/typescript/module/client/OperationReplayGuard.d.ts.map +1 -0
  442. package/lib/typescript/module/client/RunCheckpoint.d.ts +57 -0
  443. package/lib/typescript/module/client/RunCheckpoint.d.ts.map +1 -0
  444. package/lib/typescript/module/client/loopDetect.d.ts +15 -0
  445. package/lib/typescript/module/client/loopDetect.d.ts.map +1 -0
  446. package/lib/typescript/module/client/recentSearch.d.ts +5 -0
  447. package/lib/typescript/module/client/recentSearch.d.ts.map +1 -0
  448. package/lib/typescript/module/client/walletChoiceGuard.d.ts +4 -0
  449. package/lib/typescript/module/client/walletChoiceGuard.d.ts.map +1 -0
  450. package/lib/typescript/module/client/webResultCategory.d.ts +5 -0
  451. package/lib/typescript/module/client/webResultCategory.d.ts.map +1 -0
  452. package/lib/typescript/module/commercial/AccountStore.d.ts +17 -0
  453. package/lib/typescript/module/commercial/AccountStore.d.ts.map +1 -0
  454. package/lib/typescript/module/commercial/AgentDebug.d.ts +25 -0
  455. package/lib/typescript/module/commercial/AgentDebug.d.ts.map +1 -0
  456. package/lib/typescript/module/commercial/ExecutionGuard.d.ts +18 -0
  457. package/lib/typescript/module/commercial/ExecutionGuard.d.ts.map +1 -0
  458. package/lib/typescript/module/commercial/UsageBus.d.ts +18 -0
  459. package/lib/typescript/module/commercial/UsageBus.d.ts.map +1 -0
  460. package/lib/typescript/module/commercial/branding.d.ts +25 -0
  461. package/lib/typescript/module/commercial/branding.d.ts.map +1 -0
  462. package/lib/typescript/module/commercial/devMode.d.ts +26 -0
  463. package/lib/typescript/module/commercial/devMode.d.ts.map +1 -0
  464. package/lib/typescript/module/commercial/trust.d.ts +21 -0
  465. package/lib/typescript/module/commercial/trust.d.ts.map +1 -0
  466. package/lib/typescript/module/confirmation/gate.d.ts +18 -0
  467. package/lib/typescript/module/confirmation/gate.d.ts.map +1 -0
  468. package/lib/typescript/module/cursor/CursorOverlay.d.ts +13 -0
  469. package/lib/typescript/module/cursor/CursorOverlay.d.ts.map +1 -0
  470. package/lib/typescript/module/cursor/PointerHand.d.ts +16 -0
  471. package/lib/typescript/module/cursor/PointerHand.d.ts.map +1 -0
  472. package/lib/typescript/module/cursor/controller.d.ts +30 -0
  473. package/lib/typescript/module/cursor/controller.d.ts.map +1 -0
  474. package/lib/typescript/module/cursor/pointer.d.ts +23 -0
  475. package/lib/typescript/module/cursor/pointer.d.ts.map +1 -0
  476. package/lib/typescript/module/debug/KokoRemoteSmoke.d.ts +96 -0
  477. package/lib/typescript/module/debug/KokoRemoteSmoke.d.ts.map +1 -0
  478. package/lib/typescript/module/explore/ExplorationGraph.d.ts +96 -0
  479. package/lib/typescript/module/explore/ExplorationGraph.d.ts.map +1 -0
  480. package/lib/typescript/module/explore/bootstrapExplore.d.ts +40 -0
  481. package/lib/typescript/module/explore/bootstrapExplore.d.ts.map +1 -0
  482. package/lib/typescript/module/host/HostActions.d.ts +101 -0
  483. package/lib/typescript/module/host/HostActions.d.ts.map +1 -0
  484. package/lib/typescript/module/i18n/index.d.ts +20 -0
  485. package/lib/typescript/module/i18n/index.d.ts.map +1 -0
  486. package/lib/typescript/module/i18n/runtimeMessages.d.ts +178 -0
  487. package/lib/typescript/module/i18n/runtimeMessages.d.ts.map +1 -0
  488. package/lib/typescript/module/index.d.ts +66 -0
  489. package/lib/typescript/module/index.d.ts.map +1 -0
  490. package/lib/typescript/module/native/NativeBridge.d.ts +70 -0
  491. package/lib/typescript/module/native/NativeBridge.d.ts.map +1 -0
  492. package/lib/typescript/module/native/navigationLabel.d.ts +4 -0
  493. package/lib/typescript/module/native/navigationLabel.d.ts.map +1 -0
  494. package/lib/typescript/module/native/normalizeViewTree.d.ts +4 -0
  495. package/lib/typescript/module/native/normalizeViewTree.d.ts.map +1 -0
  496. package/lib/typescript/module/native/pruneOffscreen.d.ts +3 -0
  497. package/lib/typescript/module/native/pruneOffscreen.d.ts.map +1 -0
  498. package/lib/typescript/module/native/scrollViewport.d.ts +13 -0
  499. package/lib/typescript/module/native/scrollViewport.d.ts.map +1 -0
  500. package/lib/typescript/module/package.json +1 -0
  501. package/lib/typescript/module/privacy/redact.d.ts +9 -0
  502. package/lib/typescript/module/privacy/redact.d.ts.map +1 -0
  503. package/lib/typescript/module/privacy/screenEvidence.d.ts +14 -0
  504. package/lib/typescript/module/privacy/screenEvidence.d.ts.map +1 -0
  505. package/lib/typescript/module/privacy/screenModel.d.ts +26 -0
  506. package/lib/typescript/module/privacy/screenModel.d.ts.map +1 -0
  507. package/lib/typescript/module/privacy/sensitiveScreen.d.ts +8 -0
  508. package/lib/typescript/module/privacy/sensitiveScreen.d.ts.map +1 -0
  509. package/lib/typescript/module/privacy/userGate.d.ts +58 -0
  510. package/lib/typescript/module/privacy/userGate.d.ts.map +1 -0
  511. package/lib/typescript/module/protocol/actions.d.ts +7 -0
  512. package/lib/typescript/module/protocol/actions.d.ts.map +1 -0
  513. package/lib/typescript/module/provider/HostAppearanceStore.d.ts +64 -0
  514. package/lib/typescript/module/provider/HostAppearanceStore.d.ts.map +1 -0
  515. package/lib/typescript/module/provider/KokoProvider.d.ts +39 -0
  516. package/lib/typescript/module/provider/KokoProvider.d.ts.map +1 -0
  517. package/lib/typescript/module/provider/KokoUiContext.d.ts +22 -0
  518. package/lib/typescript/module/provider/KokoUiContext.d.ts.map +1 -0
  519. package/lib/typescript/module/selector/match.d.ts +27 -0
  520. package/lib/typescript/module/selector/match.d.ts.map +1 -0
  521. package/lib/typescript/module/task/TaskStore.d.ts +65 -0
  522. package/lib/typescript/module/task/TaskStore.d.ts.map +1 -0
  523. package/lib/typescript/module/task/types.d.ts +66 -0
  524. package/lib/typescript/module/task/types.d.ts.map +1 -0
  525. package/lib/typescript/module/task/useTaskStore.d.ts +3 -0
  526. package/lib/typescript/module/task/useTaskStore.d.ts.map +1 -0
  527. package/lib/typescript/module/types.d.ts +372 -0
  528. package/lib/typescript/module/types.d.ts.map +1 -0
  529. package/lib/typescript/module/ui/KokoChatSheet.d.ts +8 -0
  530. package/lib/typescript/module/ui/KokoChatSheet.d.ts.map +1 -0
  531. package/lib/typescript/module/ui/KokoComposer.d.ts +13 -0
  532. package/lib/typescript/module/ui/KokoComposer.d.ts.map +1 -0
  533. package/lib/typescript/module/ui/KokoDialogHost.d.ts +32 -0
  534. package/lib/typescript/module/ui/KokoDialogHost.d.ts.map +1 -0
  535. package/lib/typescript/module/ui/KokoEntryButton.d.ts +18 -0
  536. package/lib/typescript/module/ui/KokoEntryButton.d.ts.map +1 -0
  537. package/lib/typescript/module/ui/KokoObserver.d.ts +13 -0
  538. package/lib/typescript/module/ui/KokoObserver.d.ts.map +1 -0
  539. package/lib/typescript/module/ui/KokoOverlayLayer.d.ts +35 -0
  540. package/lib/typescript/module/ui/KokoOverlayLayer.d.ts.map +1 -0
  541. package/lib/typescript/module/ui/KokoSubtitle.d.ts +7 -0
  542. package/lib/typescript/module/ui/KokoSubtitle.d.ts.map +1 -0
  543. package/lib/typescript/module/ui/KokoTaskPanel.d.ts +7 -0
  544. package/lib/typescript/module/ui/KokoTaskPanel.d.ts.map +1 -0
  545. package/lib/typescript/module/ui/hostOverlay.d.ts +28 -0
  546. package/lib/typescript/module/ui/hostOverlay.d.ts.map +1 -0
  547. package/lib/typescript/module/ui/icons.d.ts +26 -0
  548. package/lib/typescript/module/ui/icons.d.ts.map +1 -0
  549. package/lib/typescript/module/ui/progressChrome.d.ts +21 -0
  550. package/lib/typescript/module/ui/progressChrome.d.ts.map +1 -0
  551. package/lib/typescript/module/ui/safeArea.d.ts +12 -0
  552. package/lib/typescript/module/ui/safeArea.d.ts.map +1 -0
  553. package/lib/typescript/module/ui/useOverlayOrigin.d.ts +22 -0
  554. package/lib/typescript/module/ui/useOverlayOrigin.d.ts.map +1 -0
  555. package/package.json +153 -0
  556. package/react-native.config.js +12 -0
  557. package/src/KokoAgent.ts +1415 -0
  558. package/src/assist/OnDeviceAssist.ts +133 -0
  559. package/src/assist/intentClassify.ts +122 -0
  560. package/src/assist/nodeRank.ts +167 -0
  561. package/src/assist/ocrTarget.ts +146 -0
  562. package/src/assist/webVisualChange.ts +24 -0
  563. package/src/client/ActionOutcomeUnknownError.ts +18 -0
  564. package/src/client/AgentSession.ts +952 -0
  565. package/src/client/GatewayClient.ts +439 -0
  566. package/src/client/OperationReplayGuard.ts +61 -0
  567. package/src/client/RunCheckpoint.ts +154 -0
  568. package/src/client/loopDetect.ts +213 -0
  569. package/src/client/recentSearch.ts +47 -0
  570. package/src/client/walletChoiceGuard.ts +15 -0
  571. package/src/client/webResultCategory.ts +28 -0
  572. package/src/commercial/AccountStore.ts +85 -0
  573. package/src/commercial/AgentDebug.ts +142 -0
  574. package/src/commercial/ExecutionGuard.ts +67 -0
  575. package/src/commercial/UsageBus.ts +44 -0
  576. package/src/commercial/branding.ts +97 -0
  577. package/src/commercial/devMode.ts +48 -0
  578. package/src/commercial/trust.ts +67 -0
  579. package/src/confirmation/gate.ts +82 -0
  580. package/src/cursor/CursorOverlay.tsx +138 -0
  581. package/src/cursor/PointerHand.tsx +49 -0
  582. package/src/cursor/controller.ts +98 -0
  583. package/src/cursor/pointer.ts +40 -0
  584. package/src/debug/KokoRemoteSmoke.tsx +561 -0
  585. package/src/explore/ExplorationGraph.ts +518 -0
  586. package/src/explore/bootstrapExplore.ts +89 -0
  587. package/src/host/HostActions.ts +349 -0
  588. package/src/i18n/index.ts +229 -0
  589. package/src/i18n/runtimeMessages.ts +180 -0
  590. package/src/index.ts +203 -0
  591. package/src/native/NativeBridge.ts +207 -0
  592. package/src/native/navigationLabel.ts +11 -0
  593. package/src/native/normalizeViewTree.ts +16 -0
  594. package/src/native/pruneOffscreen.ts +72 -0
  595. package/src/native/scrollViewport.ts +51 -0
  596. package/src/privacy/redact.ts +115 -0
  597. package/src/privacy/screenEvidence.ts +55 -0
  598. package/src/privacy/screenModel.ts +504 -0
  599. package/src/privacy/sensitiveScreen.ts +55 -0
  600. package/src/privacy/userGate.ts +233 -0
  601. package/src/protocol/actions.ts +66 -0
  602. package/src/provider/HostAppearanceStore.ts +148 -0
  603. package/src/provider/KokoProvider.tsx +118 -0
  604. package/src/provider/KokoUiContext.tsx +162 -0
  605. package/src/selector/match.ts +417 -0
  606. package/src/task/TaskStore.ts +387 -0
  607. package/src/task/types.ts +82 -0
  608. package/src/task/useTaskStore.ts +9 -0
  609. package/src/types.ts +318 -0
  610. package/src/ui/KokoChatSheet.tsx +930 -0
  611. package/src/ui/KokoComposer.tsx +174 -0
  612. package/src/ui/KokoDialogHost.tsx +249 -0
  613. package/src/ui/KokoEntryButton.tsx +74 -0
  614. package/src/ui/KokoObserver.tsx +587 -0
  615. package/src/ui/KokoOverlayLayer.tsx +53 -0
  616. package/src/ui/KokoSubtitle.tsx +80 -0
  617. package/src/ui/KokoTaskPanel.tsx +299 -0
  618. package/src/ui/hostOverlay.tsx +148 -0
  619. package/src/ui/icons.tsx +145 -0
  620. package/src/ui/progressChrome.ts +73 -0
  621. package/src/ui/safeArea.ts +95 -0
  622. package/src/ui/useOverlayOrigin.ts +29 -0
@@ -0,0 +1,404 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.extractAffordances = extractAffordances;
7
+ exports.readablePageContent = readablePageContent;
8
+ exports.screenModelText = screenModelText;
9
+ exports.screenSnapshotLine = screenSnapshotLine;
10
+ var _sensitiveScreen = require("./sensitiveScreen.js");
11
+ var _scrollViewport = require("../native/scrollViewport.js");
12
+ var _redact = require("./redact.js");
13
+ var _screenEvidence = require("./screenEvidence.js");
14
+ /**
15
+ * Scroll descriptions UIKit synthesizes for accessibility.
16
+ *
17
+ * They ride along on scroll containers and get concatenated into the label of
18
+ * whatever sits inside, so a real list row reads "BTC Bitcoin … Vertical scr"
19
+ * with its own content truncated away. Nothing can be aimed at them.
20
+ */
21
+ const A11Y_SCROLL_NOISE = /\b(vertical|horizontal)\s+scroll\s+bar,\s*\d+\s*pages?\b|\bsection\s+index\b/gi;
22
+ function labelOf(n) {
23
+ const raw = (n.text || n.accessibilityLabel || '').replace(A11Y_SCROLL_NOISE, ' ');
24
+ const t = (0, _redact.redactOutbound)(raw).replace(/\s+/g, ' ').trim();
25
+ return t.slice(0, 80);
26
+ }
27
+
28
+ /** Labels often sit on Fabric Paragraph children while Pressable is the parent. */
29
+ function descendantLabel(n, depth = 0) {
30
+ const own = labelOf(n);
31
+ if (own) return own;
32
+ if (depth >= 4) return '';
33
+ const parts = [];
34
+ for (const c of n.children) {
35
+ const l = descendantLabel(c, depth + 1);
36
+ if (l) parts.push(l);
37
+ if (parts.join(' ').length >= 80) break;
38
+ }
39
+ return parts.join(' ').replace(/\s+/g, ' ').trim().slice(0, 80);
40
+ }
41
+ function isExcludedSubtree(node) {
42
+ return (0, _screenEvidence.isSdkChrome)(node) || /logbox/i.test(`${node.type} ${node.testID || ''}`);
43
+ }
44
+
45
+ /** Dev LogBox / framework warnings that leak into accessibility trees. */
46
+ function isNoiseLabel(label) {
47
+ const s = label.trim();
48
+ if (!s) return false;
49
+ return /Dialog Animation duration/i.test(s) || /estimatedContentHeight/i.test(s) || /please use estimatedContentHeight/i.test(s) || /Require cycle:/i.test(s) || /Open debugger to view warnings/i.test(s) || /^!,?\s*Open debugger/i.test(s) || /^LogBox/i.test(s) || /PurchasesReactNative/i.test(s) || /See \d+ more components/i.test(s) || /^(addLog|addConsoleLog|reactConsoleErrorHandler|anonymous|renderWithHooks),/i.test(s) || /platform=ios&dev=true/i.test(s);
50
+ }
51
+ function isIgnoredLabel(label) {
52
+ return isNoiseLabel(label);
53
+ }
54
+ function isField(n) {
55
+ const t = n.type.toLowerCase();
56
+ return /textfield|textinput|edittext|uitextfield|uitextview|textarea/.test(t) || !!n.accessibilityLabel && /input|输入|placeholder|what do you/i.test(n.accessibilityLabel) && !n.clickable;
57
+ }
58
+ function collectNear(root, id) {
59
+ let parent = null;
60
+ let found = false;
61
+ const walk = (n, p) => {
62
+ if (n.id === id) {
63
+ parent = p;
64
+ found = true;
65
+ return;
66
+ }
67
+ for (const c of n.children) {
68
+ walk(c, n);
69
+ if (found) return;
70
+ }
71
+ };
72
+ walk(root, null);
73
+ if (!parent) return undefined;
74
+ const bits = [];
75
+ const gather = n => {
76
+ if (n.visible === false || isExcludedSubtree(n)) return;
77
+ const l = labelOf(n);
78
+ if (l && n.id !== id) bits.push(l);
79
+ for (const c of n.children) gather(c);
80
+ };
81
+ gather(parent);
82
+ const joined = [...new Set(bits)].filter(b => !isIgnoredLabel(b)).slice(0, 4).join(' · ');
83
+ return joined || undefined;
84
+ }
85
+
86
+ /**
87
+ * Text inside an affordance, in reading order.
88
+ *
89
+ * A list row or card whose own label is just a title loses the association
90
+ * between its cells: three tokens laid out as name/price/change siblings
91
+ * reach the planner as nine unrelated fragments, so "which one gained most"
92
+ * is unanswerable. Reading order is the only thing that ties a price to a
93
+ * name, so keep it — do not sort or globally de-duplicate.
94
+ */
95
+ function descendantContext(n, ownLabel) {
96
+ const bits = [];
97
+ const gather = cur => {
98
+ if (cur.visible === false || isExcludedSubtree(cur)) return;
99
+ if (cur !== n) {
100
+ const l = labelOf(cur);
101
+ if (l && l !== ownLabel && l !== bits[bits.length - 1] && !isIgnoredLabel(l)) {
102
+ bits.push(l);
103
+ }
104
+ }
105
+ for (const c of cur.children) gather(c);
106
+ };
107
+ gather(n);
108
+ if (bits.length < 2) return undefined;
109
+ return bits.join(' · ');
110
+ }
111
+
112
+ /**
113
+ * A label carrying only a number — a price, a percentage, a count.
114
+ *
115
+ * This is data the screen is showing, not something to aim at. Left ranked
116
+ * as a plain short button it outscores the controls around it and fills the
117
+ * model with fragments like 「$0.00352」 that say nothing about what tapping
118
+ * them would do.
119
+ */
120
+ function isDataOnlyLabel(label) {
121
+ const s = label.trim();
122
+ if (!s) return false;
123
+ return /^[+\-$€£¥₿~≈]*[\d][\d.,\s]*(%|[KkMmBb])?$/.test(s);
124
+ }
125
+ function kindOf(n, label, near) {
126
+ if (/uitab(?:bar)?button|bottomnavigationitem|tabview$/i.test(n.type)) return 'tab';
127
+ if (n.sheet && n.clickable) return 'sheet';
128
+ if (n.toggle) return 'toggle';
129
+ if (n.adjustable || /picker|datepicker|uiswitch|slider|stepper|seekbar|segment|numberpicker/i.test(n.type)) {
130
+ return 'adjustable';
131
+ }
132
+ if (/delete|删除|trash|remove|关闭|close|cancel|取消|好|ok|确定|允许|不允许/i.test(label)) {
133
+ return 'button';
134
+ }
135
+ if (/add|添加|创建|导入|确认|submit|send|下一步|登录|保存|分享|share/i.test(label)) {
136
+ return 'button';
137
+ }
138
+ if (near && near !== label) return 'row';
139
+ return 'button';
140
+ }
141
+ function isLikelyCtaLabel(label) {
142
+ const s = label.trim();
143
+ if (!s || s.length > 24) return false;
144
+ return /^(创建|添加|新建|导入|登录|注册|开始|继续|下一步|完成|确认|提交|发送|连接|恢复)/.test(s);
145
+ }
146
+ function scoreAffordance(a, screenH) {
147
+ let s = 0;
148
+ const bottomBand = screenH * 0.72;
149
+ // Recovery navigation must survive a dense page's candidate limit.
150
+ if (a.y < screenH * 0.25 && /^(back|go back|close|返回|返回上一级|关闭)$/i.test(a.label)) s += 500;
151
+ if (a.kind === 'tab') s += 400;
152
+ // Primary empty-state CTAs (center) must outrank bottom tabs in the snapshot.
153
+ if (isLikelyCtaLabel(a.label) && a.y < bottomBand) s += 260;
154
+ // Bottom tab / dock chrome must survive list truncation.
155
+ if (a.y >= bottomBand) s += 200;
156
+ if (a.kind === 'sheet') s += 180;
157
+ if (a.kind === 'field') s += 120;
158
+ if (a.kind === 'toggle' || a.kind === 'adjustable') s += 110;
159
+ if (a.kind === 'button' && !a.near) s += 90;
160
+ if (a.kind === 'button' && a.near) s += 40;
161
+ if (a.kind === 'row') s += 20;
162
+ // Prefer short nav labels over long product row titles.
163
+ if (a.label.length <= 12 && !a.near) s += 30;
164
+ if (a.testID) s += 25;
165
+ // A bare number is short and context-free, so the bonuses above would rank
166
+ // a price above the search box on the same screen. Fields keep their score:
167
+ // an amount input is labelled by its current value and still needs typing.
168
+ if (a.kind !== 'field' && isDataOnlyLabel(a.label)) s -= 140;
169
+ return s;
170
+ }
171
+
172
+ /**
173
+ * Semantic screen model for the planner — "what can this screen do?"
174
+ * Collects all candidates then keeps the highest-priority ones so bottom
175
+ * navigation is not crowded out by long product lists.
176
+ */
177
+ function extractAffordances(root, max = 40) {
178
+ if ((0, _sensitiveScreen.sensitiveScreenKind)(root)) return [];
179
+ const ranked = [];
180
+ const seen = new Set();
181
+ const screenH = Math.max(root.frame?.height ?? 0, 1);
182
+ const byId = new Map(flattenForModel(root).map(n => [n.id, n]));
183
+ const parents = new Map();
184
+ const indexParents = node => {
185
+ for (const child of node.children) {
186
+ parents.set(child.id, node);
187
+ indexParents(child);
188
+ }
189
+ };
190
+ indexParents(root);
191
+ const parentOf = n => parents.get(n.id);
192
+ const isAncestor = (ancestor, child) => {
193
+ for (let parent = parentOf(child); parent; parent = parentOf(parent)) {
194
+ if (parent.id === ancestor.id) return true;
195
+ }
196
+ return false;
197
+ };
198
+ const climbInteractive = n => {
199
+ // A testID is a test hook, not an affordance: hosts put them on the text
200
+ // inside a row as readily as on the row. Stopping there emits the cell and
201
+ // hides the control, so only fall back to it when nothing above is
202
+ // interactive.
203
+ let testIdFallback;
204
+ let cur = n;
205
+ while (cur) {
206
+ const x = cur;
207
+ if (cur.clickable || x.toggle || x.adjustable || x.sheet) return cur;
208
+ if (cur.testID && !testIdFallback) testIdFallback = cur;
209
+ cur = parentOf(cur);
210
+ }
211
+ return testIdFallback ?? n;
212
+ };
213
+ const hasInteractiveAncestor = n => {
214
+ for (let cur = parentOf(n); cur; cur = parentOf(cur)) {
215
+ const x = cur;
216
+ if (cur.clickable || x.toggle || x.adjustable || x.sheet) return true;
217
+ }
218
+ return false;
219
+ };
220
+ const pushButton = (n, label, near) => {
221
+ if (!label || isIgnoredLabel(label)) return;
222
+ const node = n;
223
+ const kind = kindOf(node, label, near);
224
+ const key = `b:${label}:${near ?? ''}:${kind}:${n.id}`;
225
+ if (seen.has(key)) return;
226
+ // Only nested wrappers describe the same action. Identical sibling labels
227
+ // belong to distinct rows (e.g. Delete beside two different products).
228
+ const index = ranked.findIndex(a => {
229
+ const previous = byId.get(a.nodeId);
230
+ return a.label === label && previous && (previous.id === n.id || isAncestor(previous, n) || isAncestor(n, previous));
231
+ });
232
+ if (index >= 0) {
233
+ const previous = index >= 0 ? byId.get(ranked[index].nodeId) : undefined;
234
+ if (!previous || !n.clickable || previous.clickable && previous.frame.width * previous.frame.height <= n.frame.width * n.frame.height) return;
235
+ ranked.splice(index, 1);
236
+ }
237
+ seen.add(key);
238
+ ranked.push({
239
+ kind,
240
+ label,
241
+ nodeId: n.id,
242
+ // Wide enough for a row of cells; a 3-item card runs about 85 chars.
243
+ near: near && near !== label ? near.slice(0, 120) : undefined,
244
+ clickable: true,
245
+ selected: n.selected || undefined,
246
+ testID: n.testID,
247
+ y: n.frame?.y ?? 0,
248
+ score: 0
249
+ });
250
+ };
251
+ const walk = n => {
252
+ if (n.visible === false || isExcludedSubtree(n)) return;
253
+ const node = n;
254
+ const label = descendantLabel(n);
255
+ const field = isField(n);
256
+ const y = n.frame?.y ?? 0;
257
+ if (field && label) {
258
+ const key = `f:${n.id}`;
259
+ if (!seen.has(key)) {
260
+ seen.add(key);
261
+ ranked.push({
262
+ kind: 'field',
263
+ label,
264
+ nodeId: n.id,
265
+ near: collectNear(root, n.id),
266
+ clickable: n.clickable,
267
+ y,
268
+ score: 0
269
+ });
270
+ }
271
+ } else if ((n.clickable || node.toggle || node.adjustable) && (label || node.toggle || node.adjustable) && !(label && isIgnoredLabel(label))) {
272
+ // Context from inside the control first, from around it second. A row's
273
+ // own cells are what make it identifiable; its siblings are other rows.
274
+ const near = descendantContext(n, label) ?? collectNear(root, n.id);
275
+ let display = label || (node.toggle ? `开关${node.on != null ? node.on ? '(开)' : '(关)' : ''}` : '') || (node.adjustable ? '可调节控件' : '') || n.type.split('.').pop() || '控件';
276
+ if (node.toggle && label && node.on != null) {
277
+ display = `${label}(${node.on ? '开' : '关'})`;
278
+ }
279
+ if (node.adjustable && typeof node.value === 'number' && Number.isFinite(node.value)) {
280
+ const v = Math.round(node.value * 100) / 100;
281
+ const lo = typeof node.min === 'number' ? Math.round(node.min * 100) / 100 : null;
282
+ const hi = typeof node.max === 'number' ? Math.round(node.max * 100) / 100 : null;
283
+ const range = lo != null && hi != null ? `,${lo}–${hi}` : '';
284
+ display = `${display}(${v}${range})`;
285
+ }
286
+ pushButton(n, display, near && near !== display ? near : undefined);
287
+ } else if (label && isLikelyCtaLabel(label)) {
288
+ // Tamagui Button: text often on a non-clickable Paragraph — promote CTA.
289
+ const target = climbInteractive(n);
290
+ const near = collectNear(root, target.id);
291
+ pushButton(target, label, near && near !== label ? near : undefined);
292
+ } else if (n.testID && label && !isIgnoredLabel(label)) {
293
+ // Already covered: the clickable ancestor was pushed on the way down,
294
+ // with this text as part of its context. Emitting the cell too would
295
+ // duplicate it stripped of everything that made it meaningful.
296
+ if (!hasInteractiveAncestor(n)) {
297
+ const target = climbInteractive(n);
298
+ pushButton(target, label, collectNear(root, target.id));
299
+ }
300
+ }
301
+ for (const c of n.children) walk(c);
302
+ };
303
+ walk(root);
304
+ for (const a of ranked) {
305
+ a.score = scoreAffordance(a, screenH);
306
+ }
307
+ ranked.sort((a, b) => b.score - a.score || a.y - b.y);
308
+
309
+ // Bottom tab chrome often outranks page body — reserve slots for upper content
310
+ // so tab switches change the fingerprint and Discovery lists reach the planner.
311
+ const bottomBand = screenH * 0.72;
312
+ const upper = ranked.filter(a => a.y < bottomBand);
313
+ const bottom = ranked.filter(a => a.y >= bottomBand);
314
+ const upperSlots = Math.max(Math.ceil(max * 0.65), max - 5);
315
+ const picked = [];
316
+ const seenIds = new Set();
317
+ const take = (list, n) => {
318
+ for (const a of list) {
319
+ if (picked.length >= n) break;
320
+ if (seenIds.has(a.nodeId)) continue;
321
+ seenIds.add(a.nodeId);
322
+ picked.push(a);
323
+ }
324
+ };
325
+ take(upper, upperSlots);
326
+ take(bottom, max);
327
+ take(ranked, max);
328
+ return picked.slice(0, max).map(({
329
+ kind,
330
+ label,
331
+ nodeId,
332
+ near,
333
+ clickable,
334
+ selected
335
+ }) => ({
336
+ kind,
337
+ label,
338
+ nodeId,
339
+ near,
340
+ clickable,
341
+ selected
342
+ }));
343
+ }
344
+ function flattenForModel(root) {
345
+ const out = [];
346
+ const walk = n => {
347
+ if (n.visible === false || isExcludedSubtree(n)) return;
348
+ out.push(n);
349
+ for (const c of n.children) walk(c);
350
+ };
351
+ walk(root);
352
+ return out;
353
+ }
354
+
355
+ /** Read-only page copy is state too: wizard steps may reuse every button. */
356
+ function readablePageContent(root, max = 24) {
357
+ if ((0, _sensitiveScreen.sensitiveScreenKind)(root)) return [];
358
+ const controls = new Set(extractAffordances(root, 100).map(a => a.label));
359
+ const text = new Set();
360
+ const hasCopy = n => n.visible !== false && !isExcludedSubtree(n) && (!!labelOf(n) || n.children.some(hasCopy));
361
+ const walk = n => {
362
+ if (n.visible === false || n.secure || isExcludedSubtree(n)) return;
363
+ // Prefer leaf copy to native ancestors' aggregated (and truncated) labels.
364
+ const hasChildCopy = n.children.some(hasCopy);
365
+ const label = (n.text || n.accessibilityLabel || '').replace(/\s+/g, ' ').trim();
366
+ if (!hasChildCopy && label && !controls.has(label) && !isIgnoredLabel(label) && !isDataOnlyLabel(label) && !/^\d{1,2}:\d{2}$/.test(label)) text.add((0, _redact.redactOutbound)(label, root).slice(0, 500));
367
+ for (const c of n.children) walk(c);
368
+ };
369
+ walk(root);
370
+ return (0, _redact.redactOutbound)([...text].slice(0, max), root);
371
+ }
372
+
373
+ /** Compact text for LLM context (token-friendly). */
374
+ function screenModelText(root, max = 40, hostExtra) {
375
+ if ((0, _sensitiveScreen.sensitiveScreenKind)(root)) return '[private screen — user completes locally]';
376
+ const items = extractAffordances(root, max);
377
+ const controls = items.length ? items.map(a => {
378
+ const near = a.near ? ` · near「${a.near}」` : '';
379
+ const hint = a.kind === 'tab' ? ' · 一级栏目入口,目标属于该栏目时先进入' : a.kind === 'toggle' ? ' · tap 切换' : a.kind === 'adjustable' ? ' · tap/swipe 调到目标值(看括号内当前值)' : '';
380
+ const state = a.selected ? ' · 当前已选中(无需再点)' : '';
381
+ return `- [${a.kind}] 「${a.label}」 id=${a.nodeId}${near}${state}${hint}`;
382
+ }).join('\n') : '';
383
+ const regions = (0, _scrollViewport.scrollViewports)(root).slice(0, 6).map(({
384
+ node,
385
+ frame: f
386
+ }) => `- [scroll-region] id=${node.id} bounds=(${Math.round(f.x)},${Math.round(f.y)},${Math.round(f.width)},${Math.round(f.height)}) · 仅用于当前列表,优先相关可见导航;滑动起终点须在区域内`).join('\n');
387
+ const content = readablePageContent(root).map(text => `- [content] ${text}`).join('\n');
388
+ const dumpPart = [controls, content, regions].filter(Boolean).join('\n');
389
+ const host = (hostExtra || '').trim();
390
+ if (dumpPart && host) return `${dumpPart}\n${host}`;
391
+ if (dumpPart) return dumpPart;
392
+ if (host) return host;
393
+ return '(未识别到可操作控件或滚动区域;等待加载后重新观察,勿盲目滑动)';
394
+ }
395
+
396
+ /** One-line snapshot for history feedback after an action. */
397
+ function screenSnapshotLine(root, max = 12) {
398
+ if ((0, _sensitiveScreen.sensitiveScreenKind)(root)) return '[private screen — user completes locally]';
399
+ const items = extractAffordances(root, max);
400
+ const content = readablePageContent(root);
401
+ const copy = content.length ? ` | content: ${content.join(' | ')}` : '';
402
+ return `screen: ${items.length ? items.map(a => `${a.label}${a.selected ? ' [selected]' : ''}`).join(' | ') : '(no controls)'}${copy}`;
403
+ }
404
+ //# sourceMappingURL=screenModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_sensitiveScreen","require","_scrollViewport","_redact","_screenEvidence","A11Y_SCROLL_NOISE","labelOf","n","raw","text","accessibilityLabel","replace","t","redactOutbound","trim","slice","descendantLabel","depth","own","parts","c","children","l","push","join","length","isExcludedSubtree","node","isSdkChrome","test","type","testID","isNoiseLabel","label","s","isIgnoredLabel","isField","toLowerCase","clickable","collectNear","root","id","parent","found","walk","p","undefined","bits","gather","visible","joined","Set","filter","b","descendantContext","ownLabel","cur","isDataOnlyLabel","kindOf","near","sheet","toggle","adjustable","isLikelyCtaLabel","scoreAffordance","a","screenH","bottomBand","y","kind","extractAffordances","max","sensitiveScreenKind","ranked","seen","Math","frame","height","byId","Map","flattenForModel","map","parents","indexParents","child","set","parentOf","get","isAncestor","ancestor","climbInteractive","testIdFallback","x","hasInteractiveAncestor","pushButton","key","has","index","findIndex","previous","nodeId","width","splice","add","selected","score","field","display","on","split","pop","value","Number","isFinite","v","round","lo","min","hi","range","target","sort","upper","bottom","upperSlots","ceil","picked","seenIds","take","list","out","readablePageContent","controls","hasCopy","some","secure","hasChildCopy","screenModelText","hostExtra","items","hint","state","regions","scrollViewports","f","content","dumpPart","Boolean","host","screenSnapshotLine","copy"],"sourceRoot":"../../../src","sources":["privacy/screenModel.ts"],"mappings":";;;;;;;;;AACA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAmCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,iBAAiB,GACrB,gFAAgF;AAElF,SAASC,OAAOA,CAACC,CAAW,EAAU;EACpC,MAAMC,GAAG,GAAG,CAACD,CAAC,CAACE,IAAI,IAAIF,CAAC,CAACG,kBAAkB,IAAI,EAAE,EAAEC,OAAO,CACxDN,iBAAiB,EACjB,GACF,CAAC;EACD,MAAMO,CAAC,GAAG,IAAAC,sBAAc,EAACL,GAAG,CAAC,CAACG,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAACG,IAAI,CAAC,CAAC;EACzD,OAAOF,CAAC,CAACG,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;AACvB;;AAEA;AACA,SAASC,eAAeA,CAACT,CAAW,EAAEU,KAAK,GAAG,CAAC,EAAU;EACvD,MAAMC,GAAG,GAAGZ,OAAO,CAACC,CAAC,CAAC;EACtB,IAAIW,GAAG,EAAE,OAAOA,GAAG;EACnB,IAAID,KAAK,IAAI,CAAC,EAAE,OAAO,EAAE;EACzB,MAAME,KAAe,GAAG,EAAE;EAC1B,KAAK,MAAMC,CAAC,IAAIb,CAAC,CAACc,QAAQ,EAAE;IAC1B,MAAMC,CAAC,GAAGN,eAAe,CAACI,CAAC,EAAEH,KAAK,GAAG,CAAC,CAAC;IACvC,IAAIK,CAAC,EAAEH,KAAK,CAACI,IAAI,CAACD,CAAC,CAAC;IACpB,IAAIH,KAAK,CAACK,IAAI,CAAC,GAA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6
+ exports.SensitiveScreenError = void 0;
7
+ exports.sensitiveScreenKind = sensitiveScreenKind;
8
+ var _index = require("../i18n/index.js");
9
+ var _screenEvidence = require("./screenEvidence.js");
10
+ /** Local-only classification. Never return a field value or mnemonic word. */
11
+ function sensitiveScreenKind(root) {
12
+ if (!root) return null;
13
+ let result = null;
14
+ let legacyPhraseCells = 0;
15
+ let legacySuggestions = false;
16
+ const visit = n => {
17
+ if ((0, _screenEvidence.isSdkChrome)(n)) return;
18
+ if (n.visible === false) {
19
+ for (const child of n.children || []) visit(child);
20
+ return;
21
+ }
22
+ if ((0, _screenEvidence.isPrivateInput)(n)) result = 'password';
23
+ const id = n.testID || '';
24
+ if (/textfield|textinput|edittext|textview|textarea/i.test(n.type) && /助记词|mnemonic|(?:recovery|seed)[\s_-]*phrase/i.test(`${id} ${n.accessibilityLabel || ''}`)) result = 'recovery_phrase';
25
+ if (/textfield|textinput|edittext|textview|textarea/i.test(n.type) && /私钥|private[\s_-]*key/i.test(`${id} ${n.accessibilityLabel || ''}`)) result = 'private_key';
26
+ if (/privacy-sensitive.*(?:phrase|mnemonic|seed)/i.test(id)) {
27
+ result = 'recovery_phrase';
28
+ }
29
+ if (/phrase-index\d+/i.test(id)) legacyPhraseCells++;
30
+ if (/^suggest-|^wordIndex$/i.test(id)) legacySuggestions = true;
31
+ if (/privacy-sensitive.*private|private[-_]?key[-_]?(?:value|field|input)/i.test(id)) {
32
+ result = 'private_key';
33
+ }
34
+ for (const child of n.children || []) visit(child);
35
+ };
36
+ visit(root);
37
+ if (result) return result;
38
+ const headings = (0, _screenEvidence.staticScreenLabels)(root).map(({
39
+ label
40
+ }) => label);
41
+ // Legacy wallet IDs are not reserved SDK markers: suggest-* is also common
42
+ // in public search. Require phrase context or an actual indexed word grid.
43
+ if (legacyPhraseCells >= 3 || (legacyPhraseCells || legacySuggestions) && headings.some(text => /助记词|mnemonic|(?:recovery|seed)\s+phrase/i.test(text))) return 'recovery_phrase';
44
+ for (const text of headings) {
45
+ if (_screenEvidence.PRIVATE_INPUT_PROMPT_RE.test(text)) return 'password';
46
+ if (/^(?:(?:验证|确认|备份|显示|查看|输入|导入|恢复)(?:您的|你的)?助记词|(?:verify|confirm|back\s*up|backup|show|reveal|import|enter)\s+(?:(?:your|the)\s+)?(?:recovery\s+|seed\s+)?(?:phrase|mnemonic))\s*[::??]?$/i.test(text)) return 'recovery_phrase';
47
+ if (/^(?:(?:导出|显示|查看|输入|导入)(?:您的|你的)?私钥|(?:export|show|reveal|import|enter)\s+(?:(?:your|the)\s+)?private\s*key)\s*[::]?$/i.test(text)) return 'private_key';
48
+ }
49
+ return null;
50
+ }
51
+ class SensitiveScreenError extends Error {
52
+ constructor() {
53
+ super((0, _index.runtimeText)('runtime.privateStep'));
54
+ this.name = 'SensitiveScreenError';
55
+ }
56
+ }
57
+ exports.SensitiveScreenError = SensitiveScreenError;
58
+ //# sourceMappingURL=sensitiveScreen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_index","require","_screenEvidence","sensitiveScreenKind","root","result","legacyPhraseCells","legacySuggestions","visit","n","isSdkChrome","visible","child","children","isPrivateInput","id","testID","test","type","accessibilityLabel","headings","staticScreenLabels","map","label","some","text","PRIVATE_INPUT_PROMPT_RE","SensitiveScreenError","Error","constructor","runtimeText","name","exports"],"sourceRoot":"../../../src","sources":["privacy/sensitiveScreen.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AAIA;AACO,SAASE,mBAAmBA,CAACC,IAAiC,EAA8B;EACjG,IAAI,CAACA,IAAI,EAAE,OAAO,IAAI;EACtB,IAAIC,MAAkC,GAAG,IAAI;EAC7C,IAAIC,iBAAiB,GAAG,CAAC;EACzB,IAAIC,iBAAiB,GAAG,KAAK;EAC7B,MAAMC,KAAK,GAAIC,CAAW,IAAK;IAC7B,IAAI,IAAAC,2BAAW,EAACD,CAAC,CAAC,EAAE;IACpB,IAAIA,CAAC,CAACE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