@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,406 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * On-device exploration graph — screen fingerprints + labeled transitions.
5
+ * No host feature catalog required. Persist best-effort (AsyncStorage if present).
6
+ */
7
+
8
+ const STORAGE_KEY_PREFIX = '@koko/exploration-graph/v1/';
9
+ function stableHash(parts) {
10
+ // FNV-1a 32-bit — good enough for local fingerprints.
11
+ let h = 0x811c9dc5;
12
+ const s = parts.join('\u0001');
13
+ for (let i = 0; i < s.length; i++) {
14
+ h ^= s.charCodeAt(i);
15
+ h = Math.imul(h, 0x01000193);
16
+ }
17
+ return (h >>> 0).toString(16).padStart(8, '0');
18
+ }
19
+
20
+ /** Normalize labels for graph identity (locale-ish noise trimmed). */
21
+ export function normalizeExploreLabel(label) {
22
+ return String(label || '').replace(/\s+/g, ' ').trim().slice(0, 64);
23
+ }
24
+
25
+ /**
26
+ * Cross-locale synonyms for explore edge labels.
27
+ * Stale graphs often store JP「環境設定」while the live UI shows「偏好设置」.
28
+ */
29
+ const EXPLORE_LABEL_GROUPS = [['偏好设置', '偏好設定', '環境設定', 'Preferences', '偏好'], ['设置', '設定', 'Settings'], ['语言', '語言', 'Language', '言語'], ['主题', 'Theme', 'テーマ', '外观'], ['更多', '选项', '選項', 'More', 'Options', 'オプション']];
30
+
31
+ /** All synonym spellings for an explore / affordance label. */
32
+ export function exploreLabelSynonyms(label) {
33
+ const n = normalizeExploreLabel(label);
34
+ if (!n) return [];
35
+ const lower = n.toLowerCase();
36
+ for (const group of EXPLORE_LABEL_GROUPS) {
37
+ if (group.some(g => {
38
+ const ng = normalizeExploreLabel(g);
39
+ return ng === n || ng.toLowerCase() === lower;
40
+ })) {
41
+ return [...new Set(group.map(normalizeExploreLabel))];
42
+ }
43
+ }
44
+ return [n];
45
+ }
46
+
47
+ /**
48
+ * Map a historical explore tap label onto a label currently on screen
49
+ * (exact / synonym). Returns null when nothing matches.
50
+ */
51
+ export function resolveExploreLabelOnScreen(desired, available) {
52
+ if (!desired || !available.length) return null;
53
+ const syns = exploreLabelSynonyms(desired);
54
+ const pairs = available.map(raw => ({
55
+ raw,
56
+ norm: normalizeExploreLabel(raw)
57
+ }));
58
+ for (const s of syns) {
59
+ const hit = pairs.find(p => p.norm === s || p.norm.toLowerCase() === s.toLowerCase());
60
+ if (hit) return hit.raw;
61
+ }
62
+ for (const s of syns) {
63
+ if (s.length < 2) continue;
64
+ const hit = pairs.find(p => p.norm.includes(s) || s.includes(p.norm));
65
+ if (hit) return hit.raw;
66
+ }
67
+ return null;
68
+ }
69
+
70
+ /**
71
+ * Fingerprint a screen from affordance labels (order-insensitive top-N).
72
+ */
73
+ export function fingerprintFromLabels(labels, max = 16) {
74
+ const norm = [...new Set(labels.map(normalizeExploreLabel).filter(l => l.length >= 1 && l.length <= 40))].sort((a, b) => a.localeCompare(b)).slice(0, max);
75
+ return stableHash(norm.length ? norm : ['(empty)']);
76
+ }
77
+ function edgeId(fromId, label, toId) {
78
+ return `${fromId}|${normalizeExploreLabel(label)}|${toId}`;
79
+ }
80
+ function tryAsyncStorage() {
81
+ try {
82
+ // Optional peer — many RN hosts already ship it.
83
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
84
+ const mod = require('@react-native-async-storage/async-storage');
85
+ const store = mod?.default ?? mod;
86
+ if (store && typeof store.getItem === 'function') return store;
87
+ } catch {
88
+ // optional
89
+ }
90
+ return null;
91
+ }
92
+ export class ExplorationGraphStore {
93
+ appKey = 'default';
94
+ nodes = new Map();
95
+ edges = new Map();
96
+ loaded = false;
97
+ saveTimer = null;
98
+ setAppKey(appKey) {
99
+ const next = String(appKey || 'default').trim() || 'default';
100
+ if (next === this.appKey && this.loaded) return;
101
+ if (next !== this.appKey) {
102
+ this.nodes.clear();
103
+ this.edges.clear();
104
+ this.loaded = false;
105
+ }
106
+ this.appKey = next;
107
+ }
108
+ getAppKey() {
109
+ return this.appKey;
110
+ }
111
+ async ensureLoaded() {
112
+ if (this.loaded) return;
113
+ this.loaded = true;
114
+ const storage = tryAsyncStorage();
115
+ if (!storage) return;
116
+ try {
117
+ const raw = await storage.getItem(STORAGE_KEY_PREFIX + this.appKey);
118
+ if (!raw) return;
119
+ const snap = JSON.parse(raw);
120
+ if (snap?.version !== 1 || !Array.isArray(snap.nodes)) return;
121
+ for (const n of snap.nodes) this.nodes.set(n.id, n);
122
+ for (const e of snap.edges || []) this.edges.set(e.id, e);
123
+ } catch {
124
+ // corrupt — start fresh
125
+ }
126
+ }
127
+ scheduleSave() {
128
+ if (this.saveTimer) clearTimeout(this.saveTimer);
129
+ this.saveTimer = setTimeout(() => {
130
+ this.saveTimer = null;
131
+ void this.persist();
132
+ }, 400);
133
+ }
134
+ async persist() {
135
+ const storage = tryAsyncStorage();
136
+ if (!storage) return;
137
+ try {
138
+ const snap = this.snapshot();
139
+ await storage.setItem(STORAGE_KEY_PREFIX + this.appKey, JSON.stringify(snap));
140
+ } catch {
141
+ // ignore quota / unavailable
142
+ }
143
+ }
144
+ snapshot() {
145
+ return {
146
+ version: 1,
147
+ appKey: this.appKey,
148
+ updatedAt: Date.now(),
149
+ nodes: [...this.nodes.values()],
150
+ edges: [...this.edges.values()]
151
+ };
152
+ }
153
+ clear() {
154
+ this.nodes.clear();
155
+ this.edges.clear();
156
+ // Persist immediately so a stale debounce cannot resurrect old edges.
157
+ if (this.saveTimer) {
158
+ clearTimeout(this.saveTimer);
159
+ this.saveTimer = null;
160
+ }
161
+ void this.persist();
162
+ }
163
+
164
+ /** Upsert a screen node; returns node id (= fingerprint). */
165
+ observeScreen(labels) {
166
+ const clean = labels.map(normalizeExploreLabel).filter(l => l && !/Open debugger|view warnings|^!,/i.test(l) && !/^LogBox/i.test(l));
167
+ // Empty dumps are transient overlays — still fingerprint, but don't
168
+ // inflate visit noise by merging junk labels into an existing rich node.
169
+ const id = fingerprintFromLabels(clean);
170
+ const prev = this.nodes.get(id);
171
+ const node = {
172
+ id,
173
+ labels: clean.length > 0 ? clean.slice(0, 24) : prev?.labels?.length ? prev.labels : [],
174
+ fingerprint: id,
175
+ seenAt: Date.now(),
176
+ visitCount: (prev?.visitCount ?? 0) + 1
177
+ };
178
+ this.nodes.set(id, node);
179
+ this.scheduleSave();
180
+ return node;
181
+ }
182
+
183
+ /**
184
+ * Record a transition after a tap. No-op if screen did not change.
185
+ */
186
+ recordTransition(fromLabels, label, toLabels) {
187
+ const from = this.observeScreen(fromLabels);
188
+ const to = this.observeScreen(toLabels);
189
+ const action = normalizeExploreLabel(label);
190
+ if (!action || from.id === to.id) return null;
191
+ const id = edgeId(from.id, action, to.id);
192
+ const prev = this.edges.get(id);
193
+ const edge = {
194
+ id,
195
+ fromId: from.id,
196
+ toId: to.id,
197
+ label: action,
198
+ count: (prev?.count ?? 0) + 1,
199
+ lastAt: Date.now()
200
+ };
201
+ this.edges.set(id, edge);
202
+ this.scheduleSave();
203
+ return edge;
204
+ }
205
+
206
+ /** Nodes whose labels match any of the query tokens. */
207
+ findNodesMatching(tokens) {
208
+ const toks = tokens.map(t => normalizeExploreLabel(t).toLowerCase()).filter(t => t.length >= 2);
209
+ if (!toks.length) return [];
210
+ const hits = [];
211
+ for (const n of this.nodes.values()) {
212
+ const blob = n.labels.join('\n').toLowerCase();
213
+ if (toks.some(t => blob.includes(t))) hits.push(n);
214
+ }
215
+ return hits.sort((a, b) => b.visitCount - a.visitCount);
216
+ }
217
+
218
+ /**
219
+ * BFS shortest path of tap labels from current fingerprint toward any
220
+ * node matching goal tokens.
221
+ */
222
+ findPathToGoal(fromLabels, goalTokens, maxDepth = 6) {
223
+ const fromId = fingerprintFromLabels(fromLabels);
224
+ // Prefer nodes matching the most *specific* tokens (语言 > 偏好 > 设置).
225
+ const tokenWeight = t => {
226
+ if (/语言|語言|language|locale/i.test(t)) return 4;
227
+ if (/偏好|preferences/i.test(t)) return 2;
228
+ if (/设置|設定|settings/i.test(t)) return 1;
229
+ return 1;
230
+ };
231
+ const scored = [...this.nodes.values()].map(n => {
232
+ const blob = n.labels.join('\n').toLowerCase();
233
+ let score = 0;
234
+ for (const t of goalTokens) {
235
+ if (blob.includes(t.toLowerCase())) score += tokenWeight(t);
236
+ }
237
+ return {
238
+ n,
239
+ score
240
+ };
241
+ }).filter(x => x.score > 0).sort((a, b) => b.score - a.score || b.n.visitCount - a.n.visitCount);
242
+ if (!scored.length) return null;
243
+ // If the goal cares about language, prefer screens that literally show it
244
+ // over parent menus that only mention 偏好/设置.
245
+ const wantsLanguage = goalTokens.some(t => /语言|語言|language|locale/i.test(t));
246
+ const languageHits = wantsLanguage ? scored.filter(x => x.n.labels.some(l => /语言|語言|language|locale/i.test(l))) : [];
247
+ // A specific goal that no explored screen actually satisfies must not fall
248
+ // back to screens that merely scored on an incidental token: the caller
249
+ // walks this path blindly, so a confident wrong answer costs real taps and
250
+ // can strand the App somewhere worse than where it started. Say "no path"
251
+ // and let the planner read the current screen instead.
252
+ if (wantsLanguage && !languageHits.length) return null;
253
+ const pool = languageHits.length ? languageHits : scored;
254
+ const best = pool[0].score;
255
+ const targets = new Set(pool.filter(x => x.score === best).map(x => x.n.id));
256
+ if (targets.has(fromId)) return [];
257
+ const adj = new Map();
258
+ for (const e of this.edges.values()) {
259
+ const list = adj.get(e.fromId) ?? [];
260
+ list.push(e);
261
+ adj.set(e.fromId, list);
262
+ }
263
+ for (const list of adj.values()) {
264
+ list.sort((a, b) => b.count - a.count);
265
+ }
266
+ const queue = [{
267
+ id: fromId,
268
+ path: []
269
+ }];
270
+ const seen = new Set([fromId]);
271
+ while (queue.length) {
272
+ const cur = queue.shift();
273
+ if (cur.path.length >= maxDepth) continue;
274
+ const outs = adj.get(cur.id) ?? [];
275
+ // First hop must be tappable on the live screen (or a synonym of one).
276
+ for (const e of outs) {
277
+ if (seen.has(e.toId)) continue;
278
+ if (cur.path.length === 0 && !resolveExploreLabelOnScreen(e.label, fromLabels)) {
279
+ continue;
280
+ }
281
+ const nextPath = [...cur.path, {
282
+ fromId: e.fromId,
283
+ toId: e.toId,
284
+ label: e.label
285
+ }];
286
+ if (targets.has(e.toId)) return nextPath;
287
+ seen.add(e.toId);
288
+ queue.push({
289
+ id: e.toId,
290
+ path: nextPath
291
+ });
292
+ }
293
+ }
294
+ return null;
295
+ }
296
+
297
+ /**
298
+ * Soft hints for the planner: known outgoing labels from current screen
299
+ * that historically led toward goal-matching screens.
300
+ */
301
+ hintLabelsTowardGoal(fromLabels, goalTokens, limit = 6) {
302
+ const path = this.findPathToGoal(fromLabels, goalTokens, 6);
303
+ if (path?.length) {
304
+ return [...new Set(path.map(p => p.label))].slice(0, limit);
305
+ }
306
+ // Fallback: any edge label that appears on a goal-matching node as well.
307
+ const goalNodes = this.findNodesMatching(goalTokens);
308
+ if (!goalNodes.length) return [];
309
+ const goalIds = new Set(goalNodes.map(n => n.id));
310
+ const fromId = fingerprintFromLabels(fromLabels);
311
+ const labels = [];
312
+ for (const e of this.edges.values()) {
313
+ if (e.fromId === fromId && goalIds.has(e.toId)) labels.push(e.label);
314
+ }
315
+ // Also surface labels that appear ON goal screens (what to look for).
316
+ for (const n of goalNodes.slice(0, 3)) {
317
+ for (const l of n.labels.slice(0, 8)) {
318
+ if (goalTokens.some(t => l.toLowerCase().includes(t.toLowerCase()))) {
319
+ labels.push(l);
320
+ }
321
+ }
322
+ }
323
+ return [...new Set(labels)].slice(0, limit);
324
+ }
325
+ stats() {
326
+ return {
327
+ nodes: this.nodes.size,
328
+ edges: this.edges.size,
329
+ appKey: this.appKey
330
+ };
331
+ }
332
+ }
333
+ export const ExplorationGraph = new ExplorationGraphStore();
334
+
335
+ /** Extract goal tokens for graph search (structural NL bits). */
336
+ export function goalTokensForExplore(goal) {
337
+ return goalExploreQuery(goal).allTokens;
338
+ }
339
+
340
+ /**
341
+ * Split explore query into destination tokens vs broader keywords.
342
+ * E.g. 「设置语言」targets 语言 screens, not every screen that merely says 设置.
343
+ */
344
+ export function goalExploreQuery(goal) {
345
+ const g = String(goal || '').trim();
346
+ const all = [];
347
+ const add = (list, s) => {
348
+ const t = normalizeExploreLabel(s);
349
+ if (t.length >= 2) list.push(t);
350
+ };
351
+ const targetTokens = [];
352
+ if (/语言|語言|language|locale|言語/i.test(g)) {
353
+ add(targetTokens, '语言');
354
+ add(targetTokens, 'Language');
355
+ add(targetTokens, '言語');
356
+ add(targetTokens, 'locale');
357
+ // Preferences screens usually host the language control.
358
+ add(targetTokens, '偏好');
359
+ add(targetTokens, 'Preferences');
360
+ add(targetTokens, '偏好设置');
361
+ add(targetTokens, '環境設定');
362
+ } else if (/主题|theme|テーマ/i.test(g)) {
363
+ add(targetTokens, '主题');
364
+ add(targetTokens, 'Theme');
365
+ add(targetTokens, 'テーマ');
366
+ } else if (/偏好|preferences|環境設定/i.test(g)) {
367
+ add(targetTokens, '偏好');
368
+ add(targetTokens, 'Preferences');
369
+ add(targetTokens, '環境設定');
370
+ } else if (/设置|設定|settings/i.test(g)) {
371
+ add(targetTokens, '设置');
372
+ add(targetTokens, 'Settings');
373
+ add(targetTokens, '設定');
374
+ }
375
+ for (const t of targetTokens) add(all, t);
376
+ if (/设置|設定|settings/i.test(g)) {
377
+ add(all, '设置');
378
+ add(all, 'Settings');
379
+ add(all, '設定');
380
+ }
381
+ if (/偏好|preferences|環境設定/i.test(g)) {
382
+ add(all, '偏好');
383
+ add(all, 'Preferences');
384
+ add(all, '環境設定');
385
+ }
386
+ if (/更多|选项|More|Options|オプション|選項/i.test(g)) {
387
+ add(all, '更多');
388
+ add(all, '选项');
389
+ add(all, 'オプション');
390
+ }
391
+ const stripped = g.replace(/^(请|帮我|帮忙|麻烦|我想|我要|打开|进入|点击|点|切换|设置|把)/g, '').replace(/一下|这个|那个/g, '');
392
+ for (const m of stripped.match(/[\u4e00-\u9fff]{2,8}|[A-Za-z]{3,16}/g) ?? []) {
393
+ add(all, m);
394
+ }
395
+ const uniq = xs => [...new Set(xs)].slice(0, 12);
396
+ const targets = uniq(targetTokens);
397
+ return {
398
+ targetTokens: targets.length ? targets : uniq(all),
399
+ allTokens: uniq(all)
400
+ };
401
+ }
402
+ export function exploreHintsModelText(hints) {
403
+ if (!hints.length) return '';
404
+ return `- [explore] 本机探索图建议优先尝试:${hints.map(h => `「${h}」`).join(' → ')}(非强制;以当前 dump 为准)`;
405
+ }
406
+ //# sourceMappingURL=ExplorationGraph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["STORAGE_KEY_PREFIX","stableHash","parts","h","s","join","i","length","charCodeAt","Math","imul","toString","padStart","normalizeExploreLabel","label","String","replace","trim","slice","EXPLORE_LABEL_GROUPS","exploreLabelSynonyms","n","lower","toLowerCase","group","some","g","ng","Set","map","resolveExploreLabelOnScreen","desired","available","syns","pairs","raw","norm","hit","find","p","includes","fingerprintFromLabels","labels","max","filter","l","sort","a","b","localeCompare","edgeId","fromId","toId","tryAsyncStorage","mod","require","store","default","getItem","ExplorationGraphStore","appKey","nodes","Map","edges","loaded","saveTimer","setAppKey","next","clear","getAppKey","ensureLoaded","storage","snap","JSON","parse","version","Array","isArray","set","id","e","scheduleSave","clearTimeout","setTimeout","persist","snapshot","setItem","stringify","updatedAt","Date","now","values","observeScreen","clean","test","prev","get","node","fingerprint","seenAt","visitCount","recordTransition","fromLabels","toLabels","from","to","action","edge","count","lastAt","findNodesMatching","tokens","toks","t","hits","blob","push","findPathToGoal","goalTokens","maxDepth","tokenWeight","scored","score","x","wantsLanguage","languageHits","pool","best","targets","has","adj","list","queue","path","seen","cur","shift","outs","nextPath","add","hintLabelsTowardGoal","limit","goalNodes","goalIds","stats","size","ExplorationGraph","goalTokensForExplore","goal","goalExploreQuery","allTokens","all","targetTokens","stripped","m","match","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ACfV,OAAO,CACN,yCAAyC,EACzC,EACF,CAAC,CACAA,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;EAC3B,KAAK,MAAM0I,CAAC,IAAID,QAAQ,CAACE,KAAK,CAAC,sCAAsC,CAAC,IAAI,EAAE,EAAE;IAC5EhB,GAAG,CAACY,GAAG,EAAEG,CAAC,CAAC;EACb;EACA,MAAME,IAAI,GAAIC,EAAY,IAAK,CAAC,GAAG,IAAIjI,GAAG,CAACiI,EAAE,CAAC,CAAC,CAAC3I,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;EAC5D,MAAM8G,OAAO,GAAG4B,IAAI,CAACJ,YAAY,CAAC;EAClC,OAAO;IACLA,YAAY,EAAExB,OAAO,CAACzH,MAAM,GAAGyH,OAAO,GAAG4B,IAAI,CAACL,GAAG,CAAC;IAClDD,SAAS,EAAEM,IAAI,CAACL,GAAG;EACrB,CAAC;AACH;AAEA,OAAO,SAASO,qBAAqBA,CAACC,KAAe,EAAU;EAC7D,IAAI,CAACA,KAAK,CAACxJ,MAAM,EAAE,OAAO,EAAE;EAC5B,OAAO,2BAA2BwJ,KAAK,CAAClI,GAAG,CAAE1B,CAAC,IAAK,IAAIA,CAAC,GAAG,CAAC,CAACE,IAAI,CAAC,KAAK,CAAC,mBAAmB;AAC7F","ignoreList":[]}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ /** Capture the current public screen as local exploration metadata. */
4
+
5
+ import { extractAffordances } from "../privacy/screenModel.js";
6
+ import { redactOutbound } from "../privacy/redact.js";
7
+ import { detectAppUserGate } from "../privacy/userGate.js";
8
+ import { findNodeById } from "../selector/match.js";
9
+ import { ExplorationGraph, normalizeExploreLabel } from "./ExplorationGraph.js";
10
+ /**
11
+ * Compatibility entry point for read-only observation. Uses the caller's
12
+ * existing dump permission; never mints a permit, starts a task, navigates,
13
+ * changes LogBox settings or invokes host callbacks. Graphs are soft hints,
14
+ * and never constitute permission to execute a historical transition.
15
+ */
16
+ export async function bootstrapExplore(agent, opts = {}) {
17
+ const failure = summary => ({
18
+ success: false,
19
+ steps: 0,
20
+ summary,
21
+ graph: ExplorationGraph.snapshot()
22
+ });
23
+ try {
24
+ // dump() enforces the current execution permission. A failed read must not
25
+ // be turned into a blind dismiss, a synthetic tap or a local permit.
26
+ const tree = await agent.dump({
27
+ silent: true
28
+ });
29
+ if (detectAppUserGate(tree)) return failure('Current screen requires user input; no exploration data was recorded.');
30
+ // Field values and read-only body copy do not belong in persistent maps.
31
+ const hasIndependentInputOrAction = node => node.children.some(child => child.clickable || /textfield|textinput|edittext|textview|textarea/i.test(child.type) || hasIndependentInputOrAction(child));
32
+ const labels = [...new Set(extractAffordances(tree, 80).filter(action => action.kind !== 'field').filter(action => {
33
+ const target = findNodeById(tree, action.nodeId);
34
+ // Aggregate keyboard-dismiss/root wrappers can contain a field's
35
+ // current value; they are not standalone public control labels.
36
+ return target && !(target === tree && target.children.length) && !hasIndependentInputOrAction(target);
37
+ }).map(action => normalizeExploreLabel(redactOutbound(action.label, tree))).filter(Boolean))];
38
+ if (!labels.length) return failure('No public controls were identified on the current screen.');
39
+ if (opts.appKey) ExplorationGraph.setAppKey(opts.appKey);
40
+ await ExplorationGraph.ensureLoaded();
41
+ ExplorationGraph.observeScreen(labels);
42
+ await ExplorationGraph.persist();
43
+ return {
44
+ success: true,
45
+ steps: 0,
46
+ summary: 'Observed the current public screen without performing any actions.',
47
+ graph: ExplorationGraph.snapshot()
48
+ };
49
+ } catch {
50
+ // Native / host errors may contain field values. Do not copy them into a
51
+ // returned graph, task history or progress message.
52
+ return failure('Unable to read the current screen with the existing execution permission.');
53
+ }
54
+ }
55
+ //# sourceMappingURL=bootstrapExplore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["extractAffordances","redactOutbound","detectAppUserGate","findNodeById","ExplorationGraph","normalizeExploreLabel","bootstrapExplore","agent","opts","failure","summary","success","steps","graph","snapshot","tree","dump","silent","hasIndependentInputOrAction","node","children","some","child","clickable","test","type","labels","Set","filter","action","kind","target","nodeId","length","map","label","Boolean","appKey","setAppKey","ensureLoaded","observeScreen","persist"],"sourceRoot":"../../../src","sources":["explore/bootstrapExplore.ts"],"mappings":";;AAAA;;AAEA,SAASA,kBAAkB,QAAQ,2BAAwB;AAC3D,SAASC,cAAc,QAAQ,sBAAmB;AAClD,SAASC,iBAAiB,QAAQ,wBAAqB;AACvD,SAASC,YAAY,QAAQ,sBAAmB;AAEhD,SAASC,gBAAgB,EAAEC,qBAAqB,QAAuC,uBAAoB;AAiC3G;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,gBAAgBA,CACpCC,KAAgB,EAChBC,IAA6B,GAAG,CAAC,CAAC,EACD;EACjC,MAAMC,OAAO,GAAIC,OAAe,KAA8B;IAC5DC,OAAO,EAAE,KAAK;IAAEC,KAAK,EAAE,CAAC;IAAEF,OAAO;IAAEG,KAAK,EAAET,gBAAgB,CAACU,QAAQ,CAAC;EACtE,CAAC,CAAC;EACF,IAAI;IACF;IACA;IACA,MAAMC,IAAI,GAAG,MAAMR,KAAK,CAACS,IAAI,CAAC;MAAEC,MAAM,EAAE;IAAK,CAAC,CAAC;IAC/C,IAAIf,iBAAiB,CAACa,IAAI,CAAC,EAAE,OAAON,OAAO,CAAC,uEAAuE,CAAC;IACpH;IACA,MAAMS,2BAA2B,GAAIC,IAAc,IAAcA,IAAI,CAACC,QAAQ,CAACC,IAAI,CAACC,KAAK,IACvFA,KAAK,CAACC,SAAS,IAAI,iDAAiD,CAACC,IAAI,CAACF,KAAK,CAACG,IAAI,CAAC,IACrFP,2BAA2B,CAACI,KAAK,CAAC,CAAC;IACrC,MAAMI,MAAM,GAAG,CAAC,GAAG,IAAIC,GAAG,CAAC3B,kBAAkB,CAACe,IAAI,EAAE,EAAE,CAAC,CACpDa,MAAM,CAACC,MAAM,IAAIA,MAAM,CAACC,IAAI,KAAK,OAAO,CAAC,CACzCF,MAAM,CAACC,MAAM,IAAI;MAChB,MAAME,MAAM,GAAG5B,YAAY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