@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,132 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.NativeBridge = void 0;
7
+ var _reactNative = require("react-native");
8
+ var _pruneOffscreen = require("./pruneOffscreen.js");
9
+ var _normalizeViewTree = require("./normalizeViewTree.js");
10
+ const LINKING_ERROR = `KokoAgentSdk native module is not linked. ` + `Rebuild the host app after adding @intentcomputing/koko-agent-sdk ` + `(iOS: pod install; Android: gradle sync). Platform=${_reactNative.Platform.OS}`;
11
+ const Native = _reactNative.NativeModules.KokoAgentSdk;
12
+ function getNative() {
13
+ if (!Native) {
14
+ throw new Error(LINKING_ERROR);
15
+ }
16
+ return Native;
17
+ }
18
+ const NativeBridge = exports.NativeBridge = {
19
+ isAvailable() {
20
+ return !!Native;
21
+ },
22
+ /** iOS bundle identifier / Android applicationId. Empty when native module is missing. */
23
+ hostAppId() {
24
+ const raw = Native?.hostAppId;
25
+ return typeof raw === "string" ? raw.trim() : "";
26
+ },
27
+ async dump(options = {}) {
28
+ const raw = await getNative().dumpViewTree({
29
+ maxDepth: options.maxDepth ?? 60,
30
+ skipInvisible: options.skipInvisible ?? true
31
+ });
32
+ const root = (0, _normalizeViewTree.normalizeViewTree)(raw);
33
+ // Every consumer — ranking, selectors, the user gate — reads the tree from
34
+ // here, so offscreen nodes have to go before any of them see it.
35
+ return options.skipInvisible === false ? root : (0, _pruneOffscreen.pruneOffscreen)(root);
36
+ },
37
+ tap(point) {
38
+ return getNative().dispatchTap(point.x, point.y);
39
+ },
40
+ /** Public capability flags only; never requests account data. */
41
+ async inspectWebWalletProvider(point) {
42
+ const native = getNative();
43
+ if (typeof native.inspectWebWalletProvider !== 'function') return null;
44
+ return native.inspectWebWalletProvider(point.x, point.y);
45
+ },
46
+ swipe(from, to, durationMs) {
47
+ return getNative().dispatchSwipe(from.x, from.y, to.x, to.y, durationMs);
48
+ },
49
+ /**
50
+ * Two-finger pinch at center. scale>1 zoom in, scale<1 zoom out.
51
+ * Falls back to error if native build lacks dispatchPinch.
52
+ */
53
+ pinch(center, scale, durationMs) {
54
+ const n = getNative();
55
+ if (typeof n.dispatchPinch !== 'function') {
56
+ throw new Error('KokoAgentSdk: dispatchPinch unavailable — rebuild the host app with the latest native module');
57
+ }
58
+ return n.dispatchPinch(center.x, center.y, scale, durationMs);
59
+ },
60
+ /** Invoke a presented system alert action by button title. */
61
+ async invokeAlertAction(title) {
62
+ const n = getNative();
63
+ if (typeof n.invokeAlertAction !== 'function') return false;
64
+ await n.invokeAlertAction(title);
65
+ return true;
66
+ },
67
+ typeText(text, clear) {
68
+ return getNative().typeText(text, clear);
69
+ },
70
+ focusNode(nodeId) {
71
+ return getNative().focusNode(nodeId);
72
+ },
73
+ /** Ensure software keyboard / first responder at a screen point (TextInput). */
74
+ focusAt(point) {
75
+ return getNative().focusAt(point.x, point.y);
76
+ },
77
+ async dismissKeyboard() {
78
+ const n = getNative();
79
+ if (typeof n.dismissKeyboard === 'function') {
80
+ await n.dismissKeyboard();
81
+ }
82
+ },
83
+ async scrollIntoView(_point) {
84
+ // No-op: auto scroll-into-view before tap scrolled page-level ScrollViews
85
+ // (home / onboarding) and looked like a secret swipe. Callers that need
86
+ // scrolling must use an explicit swipe gesture instead.
87
+ return;
88
+ },
89
+ screenshot(options = {}) {
90
+ return getNative().captureScreenshot({
91
+ hideOverlays: options.hideOverlays ?? true
92
+ });
93
+ },
94
+ /**
95
+ * On-device screen OCR via Vision (iOS) or an opted-in ML Kit host (Android).
96
+ * Soft-fails to empty tokens when the native method is missing.
97
+ */
98
+ async recognizeScreenText(options = {}) {
99
+ const n = getNative();
100
+ if (typeof n.recognizeScreenText !== 'function') {
101
+ return {
102
+ tokens: [],
103
+ texts: [],
104
+ backend: 'unavailable'
105
+ };
106
+ }
107
+ const raw = await n.recognizeScreenText({
108
+ hideOverlays: options.hideOverlays ?? true,
109
+ maxTokens: options.maxTokens ?? 24,
110
+ languages: options.languages
111
+ });
112
+ return {
113
+ tokens: Array.isArray(raw?.tokens) ? raw.tokens.map(String) : [],
114
+ texts: Array.isArray(raw?.texts) ? raw.texts.map(t => {
115
+ const f = t?.frame;
116
+ const frame = f && [f.x, f.y, f.width, f.height].every(v => Number.isFinite(Number(v))) ? {
117
+ x: Number(f.x),
118
+ y: Number(f.y),
119
+ width: Number(f.width),
120
+ height: Number(f.height)
121
+ } : undefined;
122
+ return {
123
+ text: String(t?.text ?? ''),
124
+ confidence: Number(t?.confidence ?? 0),
125
+ frame
126
+ };
127
+ }) : [],
128
+ backend: String(raw?.backend || 'vision')
129
+ };
130
+ }
131
+ };
132
+ //# sourceMappingURL=NativeBridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_pruneOffscreen","_normalizeViewTree","LINKING_ERROR","Platform","OS","Native","NativeModules","KokoAgentSdk","getNative","Error","NativeBridge","exports","isAvailable","hostAppId","raw","trim","dump","options","dumpViewTree","maxDepth","skipInvisible","root","normalizeViewTree","pruneOffscreen","tap","point","dispatchTap","x","y","inspectWebWalletProvider","native","swipe","from","to","durationMs","dispatchSwipe","pinch","center","scale","n","dispatchPinch","invokeAlertAction","title","typeText","text","clear","focusNode","nodeId","focusAt","dismissKeyboard","scrollIntoView","_point","screenshot","captureScreenshot","hideOverlays","recognizeScreenText","tokens","texts","backend","maxTokens","languages","Array","isArray","map","String","t","f","frame","width","height","every","v","Number","isFinite","undefined","confidence"],"sourceRoot":"../../../src","sources":["native/NativeBridge.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAA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AAO;MACLJ,MAAM,EAAEK,KAAK,CAACC,OAAO,CAAChD,GAAG,EAAE0C,MAAM,CAAC,GAAG1C,GAAG,CAAC0C,MAAM,CAACO,GAAG,CAACC,MAAM,CAAC,GAAG,EAAE;MAChEP,KAAK,EAAEI,KAAK,CAACC,OAAO,CAAChD,GAAG,EAAE2C,KAAK,CAAC,GAC5B3C,GAAG,CAAC2C,KAAK,CAACM,GAAG,CAAEE,CAAC,IAAK;QACnB,MAAMC,CAAC,GAAGD,CAAC,EAAEE,KAAK;QAClB,MAAMA,KAAK,GACTD,CAAC,IACD,CAACA,CAAC,CAACvC,CAAC,EAAEuC,CAAC,CAACtC,CAAC,EAAEsC,CAAC,CAACE,KAAK,EAAEF,CAAC,CAACG,MAAM,CAAC,CAACC,KAAK,CAAEC,CAAC,IAAKC,MAAM,CAACC,QAAQ,CAACD,MAAM,CAACD,CAAC,CAAC,CAAC,CAAC,GAClE;UACE5C,CAAC,EAAE6C,MAAM,CAACN,CAAC,CAACvC,CAAC,CAAC;UACdC,CAAC,EAAE4C,MAAM,CAACN,CAAC,CAACtC,CAAC,CAAC;UACdwC,KAAK,EAAEI,MAAM,CAACN,CAAC,CAACE,KAAK,CAAC;UACtBC,MAAM,EAAEG,MAAM,CAACN,CAAC,CAACG,MAAM;QACzB,CAAC,GACDK,SAAS;QACf,OAAO;UACL9B,IAAI,EAAEoB,MAAM,CAACC,CAAC,EAAErB,IAAI,IAAI,EAAE,CAAC;UAC3B+B,UAAU,EAAEH,MAAM,CAACP,CAAC,EAAEU,UAAU,IAAI,CAAC,CAAC;UACtCR;QACF,CAAC;MACH,CAAC,CAAC,GACF,EAAE;MACNT,OAAO,EAAEM,MAAM,CAAClD,GAAG,EAAE4C,OAAO,IAAI,QAAQ;IAC1C,CAAC;EACH;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.navigationLabel = navigationLabel;
7
+ /** Explicit semantic navigation IDs, never inferred from icon position alone. */
8
+ function navigationLabel(node) {
9
+ if ((node.text || '').trim() || (node.accessibilityLabel || '').trim()) return undefined;
10
+ if (!node.clickable || node.visible === false || node.enabled === false) return undefined;
11
+ const id = (node.testID || '').replace(/[^a-z]/gi, '').toLowerCase();
12
+ if (/^(?:nav(?:igation)?(?:header)?|header|toolbar)?(?:go)?back(?:button)?$|^buttonback$/.test(id)) return 'Back';
13
+ if (/^(?:nav(?:igation)?(?:header)?|header|toolbar)?close(?:button)?$|^buttonclose$/.test(id)) return 'Close';
14
+ return undefined;
15
+ }
16
+ //# sourceMappingURL=navigationLabel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["navigationLabel","node","text","trim","accessibilityLabel","undefined","clickable","visible","enabled","id","testID","replace","toLowerCase","test"],"sourceRoot":"../../../src","sources":["native/navigationLabel.ts"],"mappings":";;;;;;AAEA;AACO,SAASA,eAAeA,CAACC,IAAc,EAAsB;EAClE,IAAI,CAACA,IAAI,CAACC,IAAI,IAAI,EAAE,EAAEC,IAAI,CAAC,CAAC,IAAI,CAACF,IAAI,CAACG,kBAAkB,IAAI,EAAE,EAAED,IAAI,CAAC,CAAC,EAAE,OAAOE,SAAS;EACxF,IAAI,CAACJ,IAAI,CAACK,SAAS,IAAIL,IAAI,CAACM,OAAO,KAAK,KAAK,IAAIN,IAAI,CAACO,OAAO,KAAK,KAAK,EAAE,OAAOH,SAAS;EACzF,MAAMI,EAAE,GAAG,CAACR,IAAI,CAACS,MAAM,IAAI,EAAE,EAAEC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAACC,WAAW,CAAC,CAAC;EACpE,IAAI,qFAAqF,CAACC,IAAI,CAACJ,EAAE,CAAC,EAAE,OAAO,MAAM;EACjH,IAAI,gFAAgF,CAACI,IAAI,CAACJ,EAAE,CAAC,EAAE,OAAO,OAAO;EAC7G,OAAOJ,SAAS;AAClB","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.normalizeViewTree = normalizeViewTree;
7
+ var _navigationLabel = require("./navigationLabel.js");
8
+ /** NSNumber boolean expressions can arrive as 0/1 through the RN bridge. */
9
+ function normalizeViewTree(node) {
10
+ const children = node.children.map(normalizeViewTree);
11
+ const flags = {};
12
+ for (const key of ['scrollable', 'clipsChildren', 'visible', 'enabled', 'clickable', 'secure']) {
13
+ const value = node[key];
14
+ if (value === 0 || value === 1) flags[key] = value === 1;
15
+ }
16
+ const label = (0, _navigationLabel.navigationLabel)({
17
+ ...node,
18
+ ...flags
19
+ });
20
+ if (label) flags.accessibilityLabel = label;
21
+ if (!Object.keys(flags).length && children.every((child, i) => child === node.children[i])) return node;
22
+ return {
23
+ ...node,
24
+ ...flags,
25
+ children
26
+ };
27
+ }
28
+ //# sourceMappingURL=normalizeViewTree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_navigationLabel","require","normalizeViewTree","node","children","map","flags","key","value","label","navigationLabel","accessibilityLabel","Object","keys","length","every","child","i"],"sourceRoot":"../../../src","sources":["native/normalizeViewTree.ts"],"mappings":";;;;;;AACA,IAAAA,gBAAA,GAAAC,OAAA;AAEA;AACO,SAASC,iBAAiBA,CAACC,IAAc,EAAY;EAC1D,MAAMC,QAAQ,GAAGD,IAAI,CAACC,QAAQ,CAACC,GAAG,CAACH,iBAAiB,CAAC;EACrD,MAAMI,KAAwB,GAAG,CAAC,CAAC;EACnC,KAAK,MAAMC,GAAG,IAAI,CAAC,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAW;IACvG,MAAMC,KAAc,GAAGL,IAAI,CAACI,GAAG,CAAC;IAChC,IAAIC,KAAK,KAAK,CAAC,IAAIA,KAAK,KAAK,CAAC,EAAEF,KAAK,CAACC,GAAG,CAAC,GAAGC,KAAK,KAAK,CAAC;EAC1D;EACA,MAAMC,KAAK,GAAG,IAAAC,gCAAe,EAAC;IAAE,GAAGP,IAAI;IAAE,GAAGG;EAAM,CAAC,CAAC;EACpD,IAAIG,KAAK,EAAEH,KAAK,CAACK,kBAAkB,GAAGF,KAAK;EAC3C,IAAI,CAACG,MAAM,CAACC,IAAI,CAACP,KAAK,CAAC,CAACQ,MAAM,IAAIV,QAAQ,CAACW,KAAK,CAAC,CAACC,KAAK,EAAEC,CAAC,KAAKD,KAAK,KAAKb,IAAI,CAACC,QAAQ,CAACa,CAAC,CAAC,CAAC,EAAE,OAAOd,IAAI;EACvG,OAAO;IAAE,GAAGA,IAAI;IAAE,GAAGG,KAAK;IAAEF;EAAS,CAAC;AACxC","ignoreList":[]}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.pruneOffscreen = pruneOffscreen;
7
+ /**
8
+ * Drop nodes that are mounted but nowhere on screen.
9
+ *
10
+ * Both platforms report a node as visible from its own flags alone — Android
11
+ * `VISIBLE && isShown()`, iOS `!hidden && alpha > 0`. Neither asks whether the
12
+ * node is inside the window, so a navigator screen that is still mounted but
13
+ * pushed aside keeps showing up in every dump. The agent then plans against a
14
+ * screen the user cannot see, and the user gate can stall a run on a prompt
15
+ * that is not there.
16
+ *
17
+ * Intersect against the window and every clipping/scroll ancestor. A mounted
18
+ * list row outside its scroll viewport must not become a clickable target.
19
+ */
20
+
21
+ /** Rounding slack, in points: a node flush with the edge must survive. */
22
+ const EPSILON = 0.5;
23
+ function intersects(a, b) {
24
+ return a.x < b.x + b.width - EPSILON && a.x + a.width > b.x + EPSILON && a.y < b.y + b.height - EPSILON && a.y + a.height > b.y + EPSILON;
25
+ }
26
+ function clippedFrame(a, b) {
27
+ if (!intersects(a, b)) return null;
28
+ const x = Math.max(a.x, b.x);
29
+ const y = Math.max(a.y, b.y);
30
+ return {
31
+ x,
32
+ y,
33
+ width: Math.min(a.x + a.width, b.x + b.width) - x,
34
+ height: Math.min(a.y + a.height, b.y + b.height) - y
35
+ };
36
+ }
37
+ function prune(node, window) {
38
+ if (node.visible === false) return null;
39
+ const clip = node.clipsChildren === true || /scrollview|recyclerview|listview/i.test(node.type);
40
+ const childWindow = clip ? clippedFrame(node.frame, window) : window;
41
+ const children = [];
42
+ for (const child of childWindow ? node.children : []) {
43
+ const kept = prune(child, childWindow);
44
+ if (kept) children.push(kept);
45
+ }
46
+ // A container can sit outside the window while laying children back inside
47
+ // it (carousels, drawers), so keep any ancestor that still leads somewhere
48
+ // on screen.
49
+ if (children.length === 0 && !intersects(node.frame, window)) return null;
50
+ const onScreen = intersects(node.frame, window);
51
+ const centerVisible = onScreen && node.frame.x + node.frame.width / 2 >= window.x && node.frame.x + node.frame.width / 2 <= window.x + window.width && node.frame.y + node.frame.height / 2 >= window.y && node.frame.y + node.frame.height / 2 <= window.y + window.height;
52
+ if (!children.length && !centerVisible) return null;
53
+ const changed = children.length !== node.children.length || children.some((c, i) => c !== node.children[i]);
54
+ if (!changed && centerVisible) return node;
55
+ // Native containers aggregate all descendant labels before clipping. Never
56
+ // retain a hidden row's text on an otherwise visible ancestor.
57
+ // A structural ancestor can be larger than the viewport while containing
58
+ // visible children. Keep it traversable but not actionable or labelled.
59
+ return {
60
+ ...node,
61
+ children,
62
+ visible: centerVisible || children.length > 0,
63
+ clickable: node.clickable && centerVisible,
64
+ ...(!centerVisible || changed && node.children.length ? {
65
+ text: centerVisible && node.text ? children.map(c => c.text || c.accessibilityLabel || '').filter(Boolean).join(' ').slice(0, 240) || undefined : undefined,
66
+ accessibilityLabel: undefined
67
+ } : {})
68
+ };
69
+ }
70
+ function pruneOffscreen(root) {
71
+ return prune(root, root.frame) ?? {
72
+ ...root,
73
+ children: []
74
+ };
75
+ }
76
+ //# sourceMappingURL=pruneOffscreen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EPSILON","intersects","a","b","x","width","y","height","clippedFrame","Math","max","min","prune","node","window","visible","clip","clipsChildren","test","type","childWindow","frame","children","child","kept","push","length","onScreen","centerVisible","changed","some","c","i","clickable","text","map","accessibilityLabel","filter","Boolean","join","slice","undefined","pruneOffscreen","root"],"sourceRoot":"../../../src","sources":["native/pruneOffscreen.ts"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAMA,OAAO,GAAG,GAAG;AAEnB,SAASC,UAAUA,CAACC,CAAQ,EAAEC,CAAQ,EAAW;EAC/C,OACED,CAAC,CAACE,CAAC,GAAGD,CAAC,CAACC,CAAC,GAAGD,CAAC,CAACE,KAAK,GAAGL,OAAO,IAC7BE,CAAC,CAACE,CAAC,GAAGF,CAAC,CAACG,KAAK,GAAGF,CAAC,CAACC,CAAC,GAAGJ,OAAO,IAC7BE,CAAC,CAACI,CAAC,GAAGH,CAAC,CAACG,CAAC,GAAGH,CAAC,CAACI,MAAM,GAAGP,OAAO,IAC9BE,CAAC,CAACI,CAAC,GAAGJ,CAAC,CAACK,MAAM,GAAGJ,CAAC,CAACG,CAAC,GAAGN,OAAO;AAElC;AAEA,SAASQ,YAAYA,CAACN,CAAQ,EAAEC,CAAQ,EAAgB;EACtD,IAAI,CAACF,UAAU,CAACC,CAAC,EAAEC,CAAC,CAAC,EAAE,OAAO,IAAI;EAClC,MAAMC,CAAC,GAAGK,IAAI,CAACC,GAAG,CAACR,CAAC,CAACE,CAAC,EAAED,CAAC,CAACC,CAAC,CAAC;EAC5B,MAAME,CAAC,GAAGG,IAAI,CAACC,GAAG,CAACR,CAAC,CAACI,CAAC,EAAEH,CAAC,CAACG,CAAC,CAAC;EAC5B,OAAO;IAAEF,CAAC;IAAEE,CAAC;IAAED,KAAK,EAAEI,IAAI,CAACE,GAAG,CAACT,CAAC,CAACE,CAAC,GAAGF,CAAC,CAACG,KAAK,EAAEF,CAAC,CAACC,CAAC,GAAGD,CAAC,CAACE,KAAK,CAAC,GAAGD,CAAC;IAC9DG,MAAM,EAAEE,IAAI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E,CAAC;AACb;AAEO,SAASC,cAAcA,CAACC,IAAc,EAAY;EACvD,OAAO/B,KAAK,CAAC+B,IAAI,EAAEA,IAAI,CAACtB,KAAK,CAAC,IAAI;IAAE,GAAGsB,IAAI;IAAErB,QAAQ,EAAE;EAAG,CAAC;AAC7D","ignoreList":[]}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.boundedScrollGesture = boundedScrollGesture;
7
+ exports.scrollPosition = scrollPosition;
8
+ exports.scrollViewports = scrollViewports;
9
+ function intersect(a, b) {
10
+ const x = Math.max(a.x, b.x),
11
+ y = Math.max(a.y, b.y);
12
+ const width = Math.min(a.x + a.width, b.x + b.width) - x;
13
+ const height = Math.min(a.y + a.height, b.y + b.height) - y;
14
+ return width > 0 && height > 0 ? {
15
+ x,
16
+ y,
17
+ width,
18
+ height
19
+ } : null;
20
+ }
21
+
22
+ /** Visible scroll regions, clipped by the window and every clipping ancestor. */
23
+ function scrollViewports(root) {
24
+ const out = [];
25
+ const walk = (node, clip) => {
26
+ const frame = intersect(node.frame, clip);
27
+ if (node.scrollable === true && node.visible !== false && frame) out.push({
28
+ node,
29
+ frame
30
+ });
31
+ const clips = node.clipsChildren || /scrollview|recyclerview|listview/i.test(node.type);
32
+ const childClip = clips ? frame : clip;
33
+ if (childClip) for (const child of node.children) walk(child, childClip);
34
+ };
35
+ walk(root, root.frame);
36
+ return out;
37
+ }
38
+ function boundedScrollGesture(frame, from, to) {
39
+ const insetX = Math.min(12, frame.width / 4),
40
+ insetY = Math.min(12, frame.height / 4);
41
+ const clamp = p => ({
42
+ x: Math.max(frame.x + insetX, Math.min(frame.x + frame.width - insetX, p.x)),
43
+ y: Math.max(frame.y + insetY, Math.min(frame.y + frame.height - insetY, p.y))
44
+ });
45
+ return {
46
+ from: clamp(from),
47
+ to: clamp(to)
48
+ };
49
+ }
50
+
51
+ /** Position-only evidence: changing prices must not masquerade as scrolling. */
52
+ function scrollPosition(root, from) {
53
+ const viewport = scrollViewports(root).filter(({
54
+ frame: f
55
+ }) => from.x >= f.x && from.x <= f.x + f.width && from.y >= f.y && from.y <= f.y + f.height).sort((a, b) => a.frame.width * a.frame.height - b.frame.width * b.frame.height)[0];
56
+ if (!viewport) return null;
57
+ const positions = [];
58
+ const walk = n => {
59
+ if (n.visible === false) return;
60
+ if (!n.children.length || n.clickable) positions.push(`${n.id}:${Math.round(n.frame.x)},${Math.round(n.frame.y)}`);
61
+ for (const child of n.children) walk(child);
62
+ };
63
+ walk(viewport.node);
64
+ // Only the hash leaves this local comparison; labels/values are never used.
65
+ let hash = 2166136261;
66
+ for (const c of positions.join('|')) hash = Math.imul(hash ^ c.charCodeAt(0), 16777619);
67
+ return (hash >>> 0).toString(16);
68
+ }
69
+ //# sourceMappingURL=scrollViewport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["intersect","a","b","x","Math","max","y","width","min","height","scrollViewports","root","out","walk","node","clip","frame","scrollable","visible","push","clips","clipsChildren","test","type","childClip","child","children","boundedScrollGesture","from","to","insetX","insetY","clamp","p","scrollPosition","viewport","filter","f","sort","positions","n","length","clickable","id","round","hash","c","join","imul","charCodeAt","toString"],"sourceRoot":"../../../src","sources":["native/scrollViewport.ts"],"mappings":";;;;;;;;AAEA,SAASA,SAASA,CAACC,CAAQ,EAAEC,CAAQ,EAAgB;EACnD,MAAMC,CAAC,GAAGC,IAAI,CAACC,GAAG,CAACJ,CAAC,CAACE,CAAC,EAAED,CAAC,CAACC,CAAC,CAAC;IAAEG,CAAC,GAAGF,IAAI,CAACC,GAAG,CAACJ,CAAC,CAACK,CAAC,EAAEJ,CAAC,CAACI,CAAC,CAAC;EACpD,MAAMC,KAAK,GAAGH,IAAI,CAACI,GAAG,CAACP,CAAC,CAACE,CAAC,GAAGF,CAAC,CAACM,KAAK,EAAEL,CAAC,CAACC,CAAC,GAAGD,CAAC,CAACK,KAAK,CAAC,GAAGJ,CAAC;EACxD,MAA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e,KAAK,CAACP,MAAM,GAAGP,CAAC,CAACc,KAAK,CAACT,KAAK,GAAGL,CAAC,CAACc,KAAK,CAACP,MAAM,CAAC,CAAC,CAAC,CAAC;EACrF,IAAI,CAAC0B,QAAQ,EAAE,OAAO,IAAI;EAC1B,MAAMI,SAAmB,GAAG,EAAE;EAC9B,MAAM1B,IAAI,GAAI2B,CAAW,IAAK;IAC5B,IAAIA,CAAC,CAACtB,OAAO,KAAK,KAAK,EAAE;IACzB,IAAI,CAACsB,CAAC,CAACd,QAAQ,CAACe,MAAM,IAAID,CAAC,CAACE,SAAS,EAAEH,SAAS,CAACpB,IAAI,CAAC,GAAGqB,CAAC,CAACG,EAAE,IAAIvC,IAAI,CAACwC,KAAK,CAACJ,CAAC,CAACxB,KAAK,CAACb,CAAC,CAAC,IAAIC,IAAI,CAACwC,KAAK,CAACJ,CAAC,CAACxB,KAAK,CAACV,CAAC,CAAC,EAAE,CAAC;IAClH,KAAK,MAAMmB,KAAK,IAAIe,CAAC,CAACd,QAAQ,EAAEb,IAAI,CAACY,KAAK,CAAC;EAC7C,CAAC;EACDZ,IAAI,CAACsB,QAAQ,CAACrB,IAAI,CAAC;EACnB;EACA,IAAI+B,IAAI,GAAG,UAAU;EACrB,KAAK,MAAMC,CAAC,IAAIP,SAAS,CAACQ,IAAI,CAAC,GAAG,CAAC,EAAEF,IAAI,GAAGzC,IAAI,CAAC4C,IAAI,CAACH,IAAI,GAAGC,CAAC,CAACG,UAAU,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC;EACvF,OAAO,CAACJ,IAAI,KAAK,CAAC,EAAEK,QAAQ,CAAC,EAAE,CAAC;AAClC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.redactOutbound = redactOutbound;
7
+ exports.redactViewTreeClient = redactViewTreeClient;
8
+ exports.viewTreeOutline = viewTreeOutline;
9
+ var _sensitiveScreen = require("./sensitiveScreen.js");
10
+ /**
11
+ * Client-side redaction before upload (defense in depth; server also redacts).
12
+ */
13
+
14
+ function redactViewTreeClient(node, maxDepth = 80) {
15
+ if ((0, _sensitiveScreen.sensitiveScreenKind)(node)) {
16
+ return {
17
+ ...nodeFields(node),
18
+ text: '[private screen]',
19
+ children: []
20
+ };
21
+ }
22
+ return walk(node, 0, maxDepth);
23
+ }
24
+
25
+ /** Applies to every outbound field, including OCR/model/history and test IDs. */
26
+ function redactOutbound(value, tree) {
27
+ const secrets = new Set();
28
+ const collect = n => {
29
+ if (n.secure) {
30
+ for (const v of [n.text, n.accessibilityLabel]) {
31
+ if (v && !/^[•●*\s]+$/.test(v)) secrets.add(v);
32
+ }
33
+ }
34
+ for (const child of n.children || []) collect(child);
35
+ };
36
+ for (const source of Array.isArray(tree) ? tree : [tree]) {
37
+ if (source) collect(source);
38
+ }
39
+ const visit = v => {
40
+ if (typeof v === 'string') {
41
+ let out = v;
42
+ for (const secret of secrets) out = out.split(secret).join('[redacted]');
43
+ return out.replace(/\b(?:0x)?[a-fA-F0-9]{64}\b/g, '[redacted]').replace(/\b[5KL][1-9A-HJ-NP-Za-km-z]{50,51}\b/g, '[redacted]').replace(/((?:password|passcode|密码|私钥|private\s*key)\s*[:=:]\s*)[^\s,;"}]+/gi, '$1[redacted]');
44
+ }
45
+ if (Array.isArray(v)) return v.map(visit);
46
+ if (v && typeof v === 'object') return Object.fromEntries(Object.entries(v).map(([k, x]) => [k, visit(x)]));
47
+ return v;
48
+ };
49
+ return visit(value);
50
+ }
51
+ function scrub(text) {
52
+ if (!text) return undefined;
53
+ const t = text.replace(/\s+/g, ' ').trim();
54
+ if (!t) return undefined;
55
+ // A feature label is not its private value. Keep public navigation copy and
56
+ // addresses usable; value formats and assignments are scrubbed separately.
57
+ const safe = redactOutbound(t);
58
+ return safe.length > 80 ? `${safe.slice(0, 80)}…` : safe;
59
+ }
60
+ function walk(node, depth, maxDepth) {
61
+ return {
62
+ ...nodeFields(node),
63
+ text: node.secure ? '[redacted]' : scrub(node.text),
64
+ accessibilityLabel: node.secure ? '[redacted]' : scrub(node.accessibilityLabel),
65
+ testID: node.secure ? undefined : scrub(node.testID),
66
+ children: depth >= maxDepth ? [] : node.children.slice(0, 40).map(c => walk(c, depth + 1, maxDepth))
67
+ };
68
+ }
69
+
70
+ /** Runtime trees cross a JS boundary: TypeScript types do not filter fields. */
71
+ function nodeFields(node) {
72
+ const finite = value => typeof value === 'number' && Number.isFinite(value) ? value : undefined;
73
+ const out = {
74
+ id: typeof node.id === 'string' ? node.id : '',
75
+ type: typeof node.type === 'string' ? node.type : 'View',
76
+ frame: {
77
+ x: finite(node.frame?.x) ?? 0,
78
+ y: finite(node.frame?.y) ?? 0,
79
+ width: finite(node.frame?.width) ?? 0,
80
+ height: finite(node.frame?.height) ?? 0
81
+ },
82
+ clickable: node.clickable === true,
83
+ enabled: node.enabled !== false,
84
+ visible: node.visible !== false
85
+ };
86
+ for (const key of ['secure', 'selected', 'sheet', 'toggle', 'on', 'adjustable', 'scrollable', 'clipsChildren']) {
87
+ if (typeof node[key] === 'boolean') out[key] = node[key];
88
+ }
89
+ for (const key of ['value', 'min', 'max']) {
90
+ const value = finite(node[key]);
91
+ if (value !== undefined) out[key] = value;
92
+ }
93
+ return out;
94
+ }
95
+ function viewTreeOutline(node, maxLines = 120) {
96
+ if ((0, _sensitiveScreen.sensitiveScreenKind)(node)) return '[private screen — user completes locally]';
97
+ const lines = [];
98
+ const go = (n, indent) => {
99
+ if (lines.length >= maxLines) return;
100
+ const bits = [n.clickable ? 'tap' : null, n.text ? `"${n.text}"` : null, n.accessibilityLabel && n.accessibilityLabel !== n.text ? `a11y="${n.accessibilityLabel}"` : null, n.testID ? `id=${n.testID}` : null].filter(Boolean).join(' ');
101
+ lines.push(`${' '.repeat(indent)}${n.id} ${n.type} ${bits}`.trimEnd());
102
+ for (const c of n.children) go(c, indent + 1);
103
+ };
104
+ go(node, 0);
105
+ if (lines.length >= maxLines) lines.push('…(truncated)');
106
+ return lines.join('\n');
107
+ }
108
+ //# sourceMappingURL=redact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_sensitiveScreen","require","redactViewTreeClient","node","maxDepth","sensitiveScreenKind","nodeFields","text","children","walk","redactOutbound","value","tree","secrets","Set","collect","n","secure","v","accessibilityLabel","test","add","child","source","Array","isArray","visit","out","secret","split","join","replace","map","Object","fromEntries","entries","k","x","scrub","undefined","t","trim","safe","length","slice","depth","testID","c","finite","Number","isFinite","id","type","frame","y","width","height","clickable","enabled","visible","key","viewTreeOutline","maxLines","lines","go","indent","bits","filter","Boolean","push","repeat","trimEnd"],"sourceRoot":"../../../src","sources":["privacy/redact.ts"],"mappings":";;;;;;;;AACA,IAAAA,gBAAA,GAAAC,OAAA;AAEA;AACA;AACA;;AAEO,SAASC,oBAAoBA,CAACC,IAAc,EAAEC,QAAQ,GAAG,EAAE,EAAY;EAC5E,IAAI,IAAAC,oCAAmB,EAACF,IAAI,CAAC,EAAE;IAC7B,OAAO;MAAE,GAAGG,UAAU,CAACH,IAAI,CAAC;MAAEI,IAAI,EAAE,kBAAkB;MAAEC,QAAQ,EAAE;IAAG,CAAC;EACxE;EACA,OAAOC,IAAI,CAACN,IAAI,EAAE,CAAC,EAAEC,QAAQ,CAAC;AAChC;;AAEA;AACO,SAASM,cAAcA,CAAIC,KAAQ,EAAEC,IAA2D,EAAK;EAC1G,MAAMC,OAAO,GAAG,IAAIC,GAAG,CAAS,CAAC;EACjC,MAAMC,OAAO,GAAIC,CAAW,IAAK;IAC/B,IAAIA,CAAC,CAACC,MAAM,EAAE;MACZ,KAAK,MAAMC,CAAC,IAAI,CAACF,CAAC,CAACT,IAAI,EAAES,CAAC,CAACG,kBAAkB,CAAC,EAAE;QAC9C,IAAID,CAAC,IAAI,CAAC,YAAY,CAACE,IAAI,CAACF,CAAC,CAAC,EAAEL,OAAO,CAACQ,GAAG,CAACH,CAAC,CAAC;MACh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 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PRIVATE_INPUT_PROMPT_RE = void 0;
7
+ exports.isPrivateInput = isPrivateInput;
8
+ exports.isSdkChrome = isSdkChrome;
9
+ exports.isSystemSheet = isSystemSheet;
10
+ exports.nodeLabels = nodeLabels;
11
+ exports.staticScreenLabels = staticScreenLabels;
12
+ /** Shared by local gates and the final upload boundary; never inspect values. */
13
+ const PRIVATE_INPUT_PROMPT_RE = exports.PRIVATE_INPUT_PROMPT_RE = /^(?:(?:请)?(?:输入|设置|确认|创建|验证|解锁|重置|更改|修改)(?:您?的|新|旧|登录|支付|交易|钱包|安全|数字|\d+位|\s)*(?:密码|安全码|验证码)|(?:登录|支付|交易|钱包)?密码|安全码|验证码|短信验证|(?:please\s+)?(?:enter|set|confirm|create|verify|unlock|reset|change)\s+(?:(?:your|new|old|wallet|payment|login|\d+[- ]digit)\s+)*(?:password|passcode|pin|otp|security\s+code|verification\s+code)|password|passcode|pin|otp|cvv)\s*[::??!!]?$/i;
14
+ function isPrivateInput(node) {
15
+ if (node.secure) return true;
16
+ if (!/securetext|password|textfield|textinput|edittext|textview|textarea/i.test(node.type)) return false;
17
+ const metadata = `${node.testID || ''} ${node.accessibilityLabel || ''} ${node.type}`;
18
+ return /password|passwd|pass[-_\s]?code|\bpin\b|\botp\b|\bcvv\b|verification[-_\s]*code|security[-_\s]*code|密码|验证码|安全码/i.test(metadata) || typeof node.text === 'string' && PRIVATE_INPUT_PROMPT_RE.test(node.text.trim());
19
+ }
20
+
21
+ /** Text spoken by a node; test IDs are metadata, never user-facing copy. */
22
+ function nodeLabels(node) {
23
+ return [...new Set([node.text, node.accessibilityLabel].filter(text => typeof text === 'string' && !!text.trim()).map(text => text.replace(/\s+/g, ' ').trim()))];
24
+ }
25
+ function isSdkChrome(node) {
26
+ return /^koko-agent-(?:overlay|cursor|entry)(?:$|[/:-])/i.test(node.testID || '');
27
+ }
28
+ function isSystemSheet(node) {
29
+ return node.sheet === true || /uialertcontroller|alertdialog|biometricprompt/i.test(node.type);
30
+ }
31
+
32
+ /** A full-screen Pressable used to dismiss the keyboard is not an action row. */
33
+ function isActionRow(node, root) {
34
+ if (!node.clickable && !node.toggle && !node.adjustable) return false;
35
+ if (/button|menuitem|tabbaritem|navigationitem/i.test(node.type)) return true;
36
+ if (node === root || node.frame.height >= root.frame.height / 2) return false;
37
+ const hasIndependentAction = n => n.children.some(child => child.clickable || child.toggle || child.adjustable || hasIndependentAction(child));
38
+ return !hasIndependentAction(node);
39
+ }
40
+
41
+ /** Static own copy, excluding aggregated ancestors and offered menu actions. */
42
+ function staticScreenLabels(root) {
43
+ const out = [];
44
+ const hasCopy = n => n.visible !== false && !isSdkChrome(n) && (!!nodeLabels(n).length || n.children.some(hasCopy));
45
+ const visit = (node, inAction) => {
46
+ if (isSdkChrome(node)) return;
47
+ const action = inAction || isActionRow(node, root);
48
+ if (node.visible !== false && !action && !node.children.some(hasCopy)) {
49
+ for (const label of nodeLabels(node)) out.push({
50
+ node,
51
+ label
52
+ });
53
+ }
54
+ for (const child of node.children) visit(child, action);
55
+ };
56
+ visit(root, false);
57
+ return out;
58
+ }
59
+ //# sourceMappingURL=screenEvidence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["PRIVATE_INPUT_PROMPT_RE","exports","isPrivateInput","node","secure","test","type","metadata","testID","accessibilityLabel","text","trim","nodeLabels","Set","filter","map","replace","isSdkChrome","isSystemSheet","sheet","isActionRow","root","clickable","toggle","adjustable","frame","height","hasIndependentAction","n","children","some","child","staticScreenLabels","out","hasCopy","visible","length","visit","inAction","action","label","push"],"sourceRoot":"../../../src","sources":["privacy/screenEvidence.ts"],"mappings":";;;;;;;;;;;AAEA;AACO,MAAMA,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAClC,+WAA+W;AAE1W,SAASE,cAAcA,CAACC,IAAc,EAAW;EACtD,IAAIA,IAAI,CAACC,MAAM,EAAE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