@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.
- package/CHANGELOG.md +10 -0
- package/CODE_OF_CONDUCT.md +3 -0
- package/CONTRIBUTING.md +9 -0
- package/LICENSE +21 -0
- package/README.md +65 -0
- package/README.zh-CN.md +50 -0
- package/SECURITY.md +5 -0
- package/android/build.gradle +40 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/cn/intentcomputing/kokoagentsdk/KokoAgentSdkModule.java +1356 -0
- package/android/src/main/java/cn/intentcomputing/kokoagentsdk/KokoAgentSdkPackage.java +23 -0
- package/docs/INTEGRATION.md +168 -0
- package/docs/INTEGRATION.zh-CN.md +140 -0
- package/docs/PRIVACY.md +11 -0
- package/docs/PRIVACY.zh-CN.md +11 -0
- package/docs/PUBLISH.md +11 -0
- package/docs/PUBLISH.zh-CN.md +11 -0
- package/ios/KokoAgentSdk/KokoAgentSdk.h +5 -0
- package/ios/KokoAgentSdk/KokoAgentSdk.m +2464 -0
- package/ios/KokoAgentSdk/KokoOcrBounds.h +20 -0
- package/ios/KokoAgentSdk/KokoScrollBounds.h +21 -0
- package/koko-agent-sdk.podspec +23 -0
- package/lib/commonjs/KokoAgent.js +1427 -0
- package/lib/commonjs/KokoAgent.js.map +1 -0
- package/lib/commonjs/assist/OnDeviceAssist.js +94 -0
- package/lib/commonjs/assist/OnDeviceAssist.js.map +1 -0
- package/lib/commonjs/assist/intentClassify.js +100 -0
- package/lib/commonjs/assist/intentClassify.js.map +1 -0
- package/lib/commonjs/assist/nodeRank.js +120 -0
- package/lib/commonjs/assist/nodeRank.js.map +1 -0
- package/lib/commonjs/assist/ocrTarget.js +135 -0
- package/lib/commonjs/assist/ocrTarget.js.map +1 -0
- package/lib/commonjs/assist/webVisualChange.js +29 -0
- package/lib/commonjs/assist/webVisualChange.js.map +1 -0
- package/lib/commonjs/client/ActionOutcomeUnknownError.js +28 -0
- package/lib/commonjs/client/ActionOutcomeUnknownError.js.map +1 -0
- package/lib/commonjs/client/AgentSession.js +858 -0
- package/lib/commonjs/client/AgentSession.js.map +1 -0
- package/lib/commonjs/client/GatewayClient.js +302 -0
- package/lib/commonjs/client/GatewayClient.js.map +1 -0
- package/lib/commonjs/client/OperationReplayGuard.js +62 -0
- package/lib/commonjs/client/OperationReplayGuard.js.map +1 -0
- package/lib/commonjs/client/RunCheckpoint.js +139 -0
- package/lib/commonjs/client/RunCheckpoint.js.map +1 -0
- package/lib/commonjs/client/loopDetect.js +184 -0
- package/lib/commonjs/client/loopDetect.js.map +1 -0
- package/lib/commonjs/client/recentSearch.js +50 -0
- package/lib/commonjs/client/recentSearch.js.map +1 -0
- package/lib/commonjs/client/walletChoiceGuard.js +18 -0
- package/lib/commonjs/client/walletChoiceGuard.js.map +1 -0
- package/lib/commonjs/client/webResultCategory.js +38 -0
- package/lib/commonjs/client/webResultCategory.js.map +1 -0
- package/lib/commonjs/commercial/AccountStore.js +78 -0
- package/lib/commonjs/commercial/AccountStore.js.map +1 -0
- package/lib/commonjs/commercial/AgentDebug.js +104 -0
- package/lib/commonjs/commercial/AgentDebug.js.map +1 -0
- package/lib/commonjs/commercial/ExecutionGuard.js +53 -0
- package/lib/commonjs/commercial/ExecutionGuard.js.map +1 -0
- package/lib/commonjs/commercial/UsageBus.js +42 -0
- package/lib/commonjs/commercial/UsageBus.js.map +1 -0
- package/lib/commonjs/commercial/branding.js +69 -0
- package/lib/commonjs/commercial/branding.js.map +1 -0
- package/lib/commonjs/commercial/devMode.js +52 -0
- package/lib/commonjs/commercial/devMode.js.map +1 -0
- package/lib/commonjs/commercial/trust.js +69 -0
- package/lib/commonjs/commercial/trust.js.map +1 -0
- package/lib/commonjs/confirmation/gate.js +62 -0
- package/lib/commonjs/confirmation/gate.js.map +1 -0
- package/lib/commonjs/cursor/CursorOverlay.js +141 -0
- package/lib/commonjs/cursor/CursorOverlay.js.map +1 -0
- package/lib/commonjs/cursor/PointerHand.js +51 -0
- package/lib/commonjs/cursor/PointerHand.js.map +1 -0
- package/lib/commonjs/cursor/controller.js +91 -0
- package/lib/commonjs/cursor/controller.js.map +1 -0
- package/lib/commonjs/cursor/pointer.js +49 -0
- package/lib/commonjs/cursor/pointer.js.map +1 -0
- package/lib/commonjs/debug/KokoRemoteSmoke.js +611 -0
- package/lib/commonjs/debug/KokoRemoteSmoke.js.map +1 -0
- package/lib/commonjs/explore/ExplorationGraph.js +418 -0
- package/lib/commonjs/explore/ExplorationGraph.js.map +1 -0
- package/lib/commonjs/explore/bootstrapExplore.js +59 -0
- package/lib/commonjs/explore/bootstrapExplore.js.map +1 -0
- package/lib/commonjs/host/HostActions.js +266 -0
- package/lib/commonjs/host/HostActions.js.map +1 -0
- package/lib/commonjs/i18n/index.js +169 -0
- package/lib/commonjs/i18n/index.js.map +1 -0
- package/lib/commonjs/i18n/runtimeMessages.js +184 -0
- package/lib/commonjs/i18n/runtimeMessages.js.map +1 -0
- package/lib/commonjs/index.js +640 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/native/NativeBridge.js +132 -0
- package/lib/commonjs/native/NativeBridge.js.map +1 -0
- package/lib/commonjs/native/navigationLabel.js +16 -0
- package/lib/commonjs/native/navigationLabel.js.map +1 -0
- package/lib/commonjs/native/normalizeViewTree.js +28 -0
- package/lib/commonjs/native/normalizeViewTree.js.map +1 -0
- package/lib/commonjs/native/pruneOffscreen.js +76 -0
- package/lib/commonjs/native/pruneOffscreen.js.map +1 -0
- package/lib/commonjs/native/scrollViewport.js +69 -0
- package/lib/commonjs/native/scrollViewport.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/privacy/redact.js +108 -0
- package/lib/commonjs/privacy/redact.js.map +1 -0
- package/lib/commonjs/privacy/screenEvidence.js +59 -0
- package/lib/commonjs/privacy/screenEvidence.js.map +1 -0
- package/lib/commonjs/privacy/screenModel.js +404 -0
- package/lib/commonjs/privacy/screenModel.js.map +1 -0
- package/lib/commonjs/privacy/sensitiveScreen.js +58 -0
- package/lib/commonjs/privacy/sensitiveScreen.js.map +1 -0
- package/lib/commonjs/privacy/userGate.js +213 -0
- package/lib/commonjs/privacy/userGate.js.map +1 -0
- package/lib/commonjs/protocol/actions.js +112 -0
- package/lib/commonjs/protocol/actions.js.map +1 -0
- package/lib/commonjs/provider/HostAppearanceStore.js +111 -0
- package/lib/commonjs/provider/HostAppearanceStore.js.map +1 -0
- package/lib/commonjs/provider/KokoProvider.js +81 -0
- package/lib/commonjs/provider/KokoProvider.js.map +1 -0
- package/lib/commonjs/provider/KokoUiContext.js +102 -0
- package/lib/commonjs/provider/KokoUiContext.js.map +1 -0
- package/lib/commonjs/selector/match.js +378 -0
- package/lib/commonjs/selector/match.js.map +1 -0
- package/lib/commonjs/task/TaskStore.js +361 -0
- package/lib/commonjs/task/TaskStore.js.map +1 -0
- package/lib/commonjs/task/types.js +2 -0
- package/lib/commonjs/task/types.js.map +1 -0
- package/lib/commonjs/task/useTaskStore.js +14 -0
- package/lib/commonjs/task/useTaskStore.js.map +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/ui/KokoChatSheet.js +885 -0
- package/lib/commonjs/ui/KokoChatSheet.js.map +1 -0
- package/lib/commonjs/ui/KokoComposer.js +161 -0
- package/lib/commonjs/ui/KokoComposer.js.map +1 -0
- package/lib/commonjs/ui/KokoDialogHost.js +254 -0
- package/lib/commonjs/ui/KokoDialogHost.js.map +1 -0
- package/lib/commonjs/ui/KokoEntryButton.js +81 -0
- package/lib/commonjs/ui/KokoEntryButton.js.map +1 -0
- package/lib/commonjs/ui/KokoObserver.js +522 -0
- package/lib/commonjs/ui/KokoObserver.js.map +1 -0
- package/lib/commonjs/ui/KokoOverlayLayer.js +45 -0
- package/lib/commonjs/ui/KokoOverlayLayer.js.map +1 -0
- package/lib/commonjs/ui/KokoSubtitle.js +95 -0
- package/lib/commonjs/ui/KokoSubtitle.js.map +1 -0
- package/lib/commonjs/ui/KokoTaskPanel.js +322 -0
- package/lib/commonjs/ui/KokoTaskPanel.js.map +1 -0
- package/lib/commonjs/ui/hostOverlay.js +126 -0
- package/lib/commonjs/ui/hostOverlay.js.map +1 -0
- package/lib/commonjs/ui/icons.js +132 -0
- package/lib/commonjs/ui/icons.js.map +1 -0
- package/lib/commonjs/ui/progressChrome.js +66 -0
- package/lib/commonjs/ui/progressChrome.js.map +1 -0
- package/lib/commonjs/ui/safeArea.js +96 -0
- package/lib/commonjs/ui/safeArea.js.map +1 -0
- package/lib/commonjs/ui/useOverlayOrigin.js +40 -0
- package/lib/commonjs/ui/useOverlayOrigin.js.map +1 -0
- package/lib/module/KokoAgent.js +1418 -0
- package/lib/module/KokoAgent.js.map +1 -0
- package/lib/module/assist/OnDeviceAssist.js +89 -0
- package/lib/module/assist/OnDeviceAssist.js.map +1 -0
- package/lib/module/assist/intentClassify.js +95 -0
- package/lib/module/assist/intentClassify.js.map +1 -0
- package/lib/module/assist/nodeRank.js +115 -0
- package/lib/module/assist/nodeRank.js.map +1 -0
- package/lib/module/assist/ocrTarget.js +123 -0
- package/lib/module/assist/ocrTarget.js.map +1 -0
- package/lib/module/assist/webVisualChange.js +24 -0
- package/lib/module/assist/webVisualChange.js.map +1 -0
- package/lib/module/client/ActionOutcomeUnknownError.js +23 -0
- package/lib/module/client/ActionOutcomeUnknownError.js.map +1 -0
- package/lib/module/client/AgentSession.js +854 -0
- package/lib/module/client/AgentSession.js.map +1 -0
- package/lib/module/client/GatewayClient.js +293 -0
- package/lib/module/client/GatewayClient.js.map +1 -0
- package/lib/module/client/OperationReplayGuard.js +58 -0
- package/lib/module/client/OperationReplayGuard.js.map +1 -0
- package/lib/module/client/RunCheckpoint.js +135 -0
- package/lib/module/client/RunCheckpoint.js.map +1 -0
- package/lib/module/client/loopDetect.js +177 -0
- package/lib/module/client/loopDetect.js.map +1 -0
- package/lib/module/client/recentSearch.js +46 -0
- package/lib/module/client/recentSearch.js.map +1 -0
- package/lib/module/client/walletChoiceGuard.js +14 -0
- package/lib/module/client/walletChoiceGuard.js.map +1 -0
- package/lib/module/client/webResultCategory.js +34 -0
- package/lib/module/client/webResultCategory.js.map +1 -0
- package/lib/module/commercial/AccountStore.js +75 -0
- package/lib/module/commercial/AccountStore.js.map +1 -0
- package/lib/module/commercial/AgentDebug.js +99 -0
- package/lib/module/commercial/AgentDebug.js.map +1 -0
- package/lib/module/commercial/ExecutionGuard.js +49 -0
- package/lib/module/commercial/ExecutionGuard.js.map +1 -0
- package/lib/module/commercial/UsageBus.js +38 -0
- package/lib/module/commercial/UsageBus.js.map +1 -0
- package/lib/module/commercial/branding.js +63 -0
- package/lib/module/commercial/branding.js.map +1 -0
- package/lib/module/commercial/devMode.js +45 -0
- package/lib/module/commercial/devMode.js.map +1 -0
- package/lib/module/commercial/trust.js +62 -0
- package/lib/module/commercial/trust.js.map +1 -0
- package/lib/module/confirmation/gate.js +54 -0
- package/lib/module/confirmation/gate.js.map +1 -0
- package/lib/module/cursor/CursorOverlay.js +136 -0
- package/lib/module/cursor/CursorOverlay.js.map +1 -0
- package/lib/module/cursor/PointerHand.js +47 -0
- package/lib/module/cursor/PointerHand.js.map +1 -0
- package/lib/module/cursor/controller.js +87 -0
- package/lib/module/cursor/controller.js.map +1 -0
- package/lib/module/cursor/pointer.js +45 -0
- package/lib/module/cursor/pointer.js.map +1 -0
- package/lib/module/debug/KokoRemoteSmoke.js +608 -0
- package/lib/module/debug/KokoRemoteSmoke.js.map +1 -0
- package/lib/module/explore/ExplorationGraph.js +406 -0
- package/lib/module/explore/ExplorationGraph.js.map +1 -0
- package/lib/module/explore/bootstrapExplore.js +55 -0
- package/lib/module/explore/bootstrapExplore.js.map +1 -0
- package/lib/module/host/HostActions.js +255 -0
- package/lib/module/host/HostActions.js.map +1 -0
- package/lib/module/i18n/index.js +159 -0
- package/lib/module/i18n/index.js.map +1 -0
- package/lib/module/i18n/runtimeMessages.js +180 -0
- package/lib/module/i18n/runtimeMessages.js.map +1 -0
- package/lib/module/index.js +44 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/native/NativeBridge.js +128 -0
- package/lib/module/native/NativeBridge.js.map +1 -0
- package/lib/module/native/navigationLabel.js +12 -0
- package/lib/module/native/navigationLabel.js.map +1 -0
- package/lib/module/native/normalizeViewTree.js +25 -0
- package/lib/module/native/normalizeViewTree.js.map +1 -0
- package/lib/module/native/pruneOffscreen.js +72 -0
- package/lib/module/native/pruneOffscreen.js.map +1 -0
- package/lib/module/native/scrollViewport.js +63 -0
- package/lib/module/native/scrollViewport.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/privacy/redact.js +103 -0
- package/lib/module/privacy/redact.js.map +1 -0
- package/lib/module/privacy/screenEvidence.js +50 -0
- package/lib/module/privacy/screenEvidence.js.map +1 -0
- package/lib/module/privacy/screenModel.js +397 -0
- package/lib/module/privacy/screenModel.js.map +1 -0
- package/lib/module/privacy/sensitiveScreen.js +52 -0
- package/lib/module/privacy/sensitiveScreen.js.map +1 -0
- package/lib/module/privacy/userGate.js +202 -0
- package/lib/module/privacy/userGate.js.map +1 -0
- package/lib/module/protocol/actions.js +108 -0
- package/lib/module/protocol/actions.js.map +1 -0
- package/lib/module/provider/HostAppearanceStore.js +101 -0
- package/lib/module/provider/HostAppearanceStore.js.map +1 -0
- package/lib/module/provider/KokoProvider.js +74 -0
- package/lib/module/provider/KokoProvider.js.map +1 -0
- package/lib/module/provider/KokoUiContext.js +96 -0
- package/lib/module/provider/KokoUiContext.js.map +1 -0
- package/lib/module/selector/match.js +366 -0
- package/lib/module/selector/match.js.map +1 -0
- package/lib/module/task/TaskStore.js +356 -0
- package/lib/module/task/TaskStore.js.map +1 -0
- package/lib/module/task/types.js +2 -0
- package/lib/module/task/types.js.map +1 -0
- package/lib/module/task/useTaskStore.js +10 -0
- package/lib/module/task/useTaskStore.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/ui/KokoChatSheet.js +879 -0
- package/lib/module/ui/KokoChatSheet.js.map +1 -0
- package/lib/module/ui/KokoComposer.js +155 -0
- package/lib/module/ui/KokoComposer.js.map +1 -0
- package/lib/module/ui/KokoDialogHost.js +247 -0
- package/lib/module/ui/KokoDialogHost.js.map +1 -0
- package/lib/module/ui/KokoEntryButton.js +74 -0
- package/lib/module/ui/KokoEntryButton.js.map +1 -0
- package/lib/module/ui/KokoObserver.js +516 -0
- package/lib/module/ui/KokoObserver.js.map +1 -0
- package/lib/module/ui/KokoOverlayLayer.js +39 -0
- package/lib/module/ui/KokoOverlayLayer.js.map +1 -0
- package/lib/module/ui/KokoSubtitle.js +90 -0
- package/lib/module/ui/KokoSubtitle.js.map +1 -0
- package/lib/module/ui/KokoTaskPanel.js +316 -0
- package/lib/module/ui/KokoTaskPanel.js.map +1 -0
- package/lib/module/ui/hostOverlay.js +120 -0
- package/lib/module/ui/hostOverlay.js.map +1 -0
- package/lib/module/ui/icons.js +124 -0
- package/lib/module/ui/icons.js.map +1 -0
- package/lib/module/ui/progressChrome.js +58 -0
- package/lib/module/ui/progressChrome.js.map +1 -0
- package/lib/module/ui/safeArea.js +92 -0
- package/lib/module/ui/safeArea.js.map +1 -0
- package/lib/module/ui/useOverlayOrigin.js +36 -0
- package/lib/module/ui/useOverlayOrigin.js.map +1 -0
- package/lib/typescript/commonjs/KokoAgent.d.ts +167 -0
- package/lib/typescript/commonjs/KokoAgent.d.ts.map +1 -0
- package/lib/typescript/commonjs/assist/OnDeviceAssist.d.ts +31 -0
- package/lib/typescript/commonjs/assist/OnDeviceAssist.d.ts.map +1 -0
- package/lib/typescript/commonjs/assist/intentClassify.d.ts +18 -0
- package/lib/typescript/commonjs/assist/intentClassify.d.ts.map +1 -0
- package/lib/typescript/commonjs/assist/nodeRank.d.ts +32 -0
- package/lib/typescript/commonjs/assist/nodeRank.d.ts.map +1 -0
- package/lib/typescript/commonjs/assist/ocrTarget.d.ts +25 -0
- package/lib/typescript/commonjs/assist/ocrTarget.d.ts.map +1 -0
- package/lib/typescript/commonjs/assist/webVisualChange.d.ts +6 -0
- package/lib/typescript/commonjs/assist/webVisualChange.d.ts.map +1 -0
- package/lib/typescript/commonjs/client/ActionOutcomeUnknownError.d.ts +13 -0
- package/lib/typescript/commonjs/client/ActionOutcomeUnknownError.d.ts.map +1 -0
- package/lib/typescript/commonjs/client/AgentSession.d.ts +56 -0
- package/lib/typescript/commonjs/client/AgentSession.d.ts.map +1 -0
- package/lib/typescript/commonjs/client/GatewayClient.d.ts +149 -0
- package/lib/typescript/commonjs/client/GatewayClient.d.ts.map +1 -0
- package/lib/typescript/commonjs/client/OperationReplayGuard.d.ts +13 -0
- package/lib/typescript/commonjs/client/OperationReplayGuard.d.ts.map +1 -0
- package/lib/typescript/commonjs/client/RunCheckpoint.d.ts +57 -0
- package/lib/typescript/commonjs/client/RunCheckpoint.d.ts.map +1 -0
- package/lib/typescript/commonjs/client/loopDetect.d.ts +15 -0
- package/lib/typescript/commonjs/client/loopDetect.d.ts.map +1 -0
- package/lib/typescript/commonjs/client/recentSearch.d.ts +5 -0
- package/lib/typescript/commonjs/client/recentSearch.d.ts.map +1 -0
- package/lib/typescript/commonjs/client/walletChoiceGuard.d.ts +4 -0
- package/lib/typescript/commonjs/client/walletChoiceGuard.d.ts.map +1 -0
- package/lib/typescript/commonjs/client/webResultCategory.d.ts +5 -0
- package/lib/typescript/commonjs/client/webResultCategory.d.ts.map +1 -0
- package/lib/typescript/commonjs/commercial/AccountStore.d.ts +17 -0
- package/lib/typescript/commonjs/commercial/AccountStore.d.ts.map +1 -0
- package/lib/typescript/commonjs/commercial/AgentDebug.d.ts +25 -0
- package/lib/typescript/commonjs/commercial/AgentDebug.d.ts.map +1 -0
- package/lib/typescript/commonjs/commercial/ExecutionGuard.d.ts +18 -0
- package/lib/typescript/commonjs/commercial/ExecutionGuard.d.ts.map +1 -0
- package/lib/typescript/commonjs/commercial/UsageBus.d.ts +18 -0
- package/lib/typescript/commonjs/commercial/UsageBus.d.ts.map +1 -0
- package/lib/typescript/commonjs/commercial/branding.d.ts +25 -0
- package/lib/typescript/commonjs/commercial/branding.d.ts.map +1 -0
- package/lib/typescript/commonjs/commercial/devMode.d.ts +26 -0
- package/lib/typescript/commonjs/commercial/devMode.d.ts.map +1 -0
- package/lib/typescript/commonjs/commercial/trust.d.ts +21 -0
- package/lib/typescript/commonjs/commercial/trust.d.ts.map +1 -0
- package/lib/typescript/commonjs/confirmation/gate.d.ts +18 -0
- package/lib/typescript/commonjs/confirmation/gate.d.ts.map +1 -0
- package/lib/typescript/commonjs/cursor/CursorOverlay.d.ts +13 -0
- package/lib/typescript/commonjs/cursor/CursorOverlay.d.ts.map +1 -0
- package/lib/typescript/commonjs/cursor/PointerHand.d.ts +16 -0
- package/lib/typescript/commonjs/cursor/PointerHand.d.ts.map +1 -0
- package/lib/typescript/commonjs/cursor/controller.d.ts +30 -0
- package/lib/typescript/commonjs/cursor/controller.d.ts.map +1 -0
- package/lib/typescript/commonjs/cursor/pointer.d.ts +23 -0
- package/lib/typescript/commonjs/cursor/pointer.d.ts.map +1 -0
- package/lib/typescript/commonjs/debug/KokoRemoteSmoke.d.ts +96 -0
- package/lib/typescript/commonjs/debug/KokoRemoteSmoke.d.ts.map +1 -0
- package/lib/typescript/commonjs/explore/ExplorationGraph.d.ts +96 -0
- package/lib/typescript/commonjs/explore/ExplorationGraph.d.ts.map +1 -0
- package/lib/typescript/commonjs/explore/bootstrapExplore.d.ts +40 -0
- package/lib/typescript/commonjs/explore/bootstrapExplore.d.ts.map +1 -0
- package/lib/typescript/commonjs/host/HostActions.d.ts +101 -0
- package/lib/typescript/commonjs/host/HostActions.d.ts.map +1 -0
- package/lib/typescript/commonjs/i18n/index.d.ts +20 -0
- package/lib/typescript/commonjs/i18n/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/i18n/runtimeMessages.d.ts +178 -0
- package/lib/typescript/commonjs/i18n/runtimeMessages.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +66 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/native/NativeBridge.d.ts +70 -0
- package/lib/typescript/commonjs/native/NativeBridge.d.ts.map +1 -0
- package/lib/typescript/commonjs/native/navigationLabel.d.ts +4 -0
- package/lib/typescript/commonjs/native/navigationLabel.d.ts.map +1 -0
- package/lib/typescript/commonjs/native/normalizeViewTree.d.ts +4 -0
- package/lib/typescript/commonjs/native/normalizeViewTree.d.ts.map +1 -0
- package/lib/typescript/commonjs/native/pruneOffscreen.d.ts +3 -0
- package/lib/typescript/commonjs/native/pruneOffscreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/native/scrollViewport.d.ts +13 -0
- package/lib/typescript/commonjs/native/scrollViewport.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/privacy/redact.d.ts +9 -0
- package/lib/typescript/commonjs/privacy/redact.d.ts.map +1 -0
- package/lib/typescript/commonjs/privacy/screenEvidence.d.ts +14 -0
- package/lib/typescript/commonjs/privacy/screenEvidence.d.ts.map +1 -0
- package/lib/typescript/commonjs/privacy/screenModel.d.ts +26 -0
- package/lib/typescript/commonjs/privacy/screenModel.d.ts.map +1 -0
- package/lib/typescript/commonjs/privacy/sensitiveScreen.d.ts +8 -0
- package/lib/typescript/commonjs/privacy/sensitiveScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/privacy/userGate.d.ts +58 -0
- package/lib/typescript/commonjs/privacy/userGate.d.ts.map +1 -0
- package/lib/typescript/commonjs/protocol/actions.d.ts +7 -0
- package/lib/typescript/commonjs/protocol/actions.d.ts.map +1 -0
- package/lib/typescript/commonjs/provider/HostAppearanceStore.d.ts +64 -0
- package/lib/typescript/commonjs/provider/HostAppearanceStore.d.ts.map +1 -0
- package/lib/typescript/commonjs/provider/KokoProvider.d.ts +39 -0
- package/lib/typescript/commonjs/provider/KokoProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/provider/KokoUiContext.d.ts +22 -0
- package/lib/typescript/commonjs/provider/KokoUiContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/selector/match.d.ts +27 -0
- package/lib/typescript/commonjs/selector/match.d.ts.map +1 -0
- package/lib/typescript/commonjs/task/TaskStore.d.ts +65 -0
- package/lib/typescript/commonjs/task/TaskStore.d.ts.map +1 -0
- package/lib/typescript/commonjs/task/types.d.ts +66 -0
- package/lib/typescript/commonjs/task/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/task/useTaskStore.d.ts +3 -0
- package/lib/typescript/commonjs/task/useTaskStore.d.ts.map +1 -0
- package/lib/typescript/commonjs/types.d.ts +372 -0
- package/lib/typescript/commonjs/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/KokoChatSheet.d.ts +8 -0
- package/lib/typescript/commonjs/ui/KokoChatSheet.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/KokoComposer.d.ts +13 -0
- package/lib/typescript/commonjs/ui/KokoComposer.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/KokoDialogHost.d.ts +32 -0
- package/lib/typescript/commonjs/ui/KokoDialogHost.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/KokoEntryButton.d.ts +18 -0
- package/lib/typescript/commonjs/ui/KokoEntryButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/KokoObserver.d.ts +13 -0
- package/lib/typescript/commonjs/ui/KokoObserver.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/KokoOverlayLayer.d.ts +35 -0
- package/lib/typescript/commonjs/ui/KokoOverlayLayer.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/KokoSubtitle.d.ts +7 -0
- package/lib/typescript/commonjs/ui/KokoSubtitle.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/KokoTaskPanel.d.ts +7 -0
- package/lib/typescript/commonjs/ui/KokoTaskPanel.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hostOverlay.d.ts +28 -0
- package/lib/typescript/commonjs/ui/hostOverlay.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/icons.d.ts +26 -0
- package/lib/typescript/commonjs/ui/icons.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/progressChrome.d.ts +21 -0
- package/lib/typescript/commonjs/ui/progressChrome.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/safeArea.d.ts +12 -0
- package/lib/typescript/commonjs/ui/safeArea.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/useOverlayOrigin.d.ts +22 -0
- package/lib/typescript/commonjs/ui/useOverlayOrigin.d.ts.map +1 -0
- package/lib/typescript/module/KokoAgent.d.ts +167 -0
- package/lib/typescript/module/KokoAgent.d.ts.map +1 -0
- package/lib/typescript/module/assist/OnDeviceAssist.d.ts +31 -0
- package/lib/typescript/module/assist/OnDeviceAssist.d.ts.map +1 -0
- package/lib/typescript/module/assist/intentClassify.d.ts +18 -0
- package/lib/typescript/module/assist/intentClassify.d.ts.map +1 -0
- package/lib/typescript/module/assist/nodeRank.d.ts +32 -0
- package/lib/typescript/module/assist/nodeRank.d.ts.map +1 -0
- package/lib/typescript/module/assist/ocrTarget.d.ts +25 -0
- package/lib/typescript/module/assist/ocrTarget.d.ts.map +1 -0
- package/lib/typescript/module/assist/webVisualChange.d.ts +6 -0
- package/lib/typescript/module/assist/webVisualChange.d.ts.map +1 -0
- package/lib/typescript/module/client/ActionOutcomeUnknownError.d.ts +13 -0
- package/lib/typescript/module/client/ActionOutcomeUnknownError.d.ts.map +1 -0
- package/lib/typescript/module/client/AgentSession.d.ts +56 -0
- package/lib/typescript/module/client/AgentSession.d.ts.map +1 -0
- package/lib/typescript/module/client/GatewayClient.d.ts +149 -0
- package/lib/typescript/module/client/GatewayClient.d.ts.map +1 -0
- package/lib/typescript/module/client/OperationReplayGuard.d.ts +13 -0
- package/lib/typescript/module/client/OperationReplayGuard.d.ts.map +1 -0
- package/lib/typescript/module/client/RunCheckpoint.d.ts +57 -0
- package/lib/typescript/module/client/RunCheckpoint.d.ts.map +1 -0
- package/lib/typescript/module/client/loopDetect.d.ts +15 -0
- package/lib/typescript/module/client/loopDetect.d.ts.map +1 -0
- package/lib/typescript/module/client/recentSearch.d.ts +5 -0
- package/lib/typescript/module/client/recentSearch.d.ts.map +1 -0
- package/lib/typescript/module/client/walletChoiceGuard.d.ts +4 -0
- package/lib/typescript/module/client/walletChoiceGuard.d.ts.map +1 -0
- package/lib/typescript/module/client/webResultCategory.d.ts +5 -0
- package/lib/typescript/module/client/webResultCategory.d.ts.map +1 -0
- package/lib/typescript/module/commercial/AccountStore.d.ts +17 -0
- package/lib/typescript/module/commercial/AccountStore.d.ts.map +1 -0
- package/lib/typescript/module/commercial/AgentDebug.d.ts +25 -0
- package/lib/typescript/module/commercial/AgentDebug.d.ts.map +1 -0
- package/lib/typescript/module/commercial/ExecutionGuard.d.ts +18 -0
- package/lib/typescript/module/commercial/ExecutionGuard.d.ts.map +1 -0
- package/lib/typescript/module/commercial/UsageBus.d.ts +18 -0
- package/lib/typescript/module/commercial/UsageBus.d.ts.map +1 -0
- package/lib/typescript/module/commercial/branding.d.ts +25 -0
- package/lib/typescript/module/commercial/branding.d.ts.map +1 -0
- package/lib/typescript/module/commercial/devMode.d.ts +26 -0
- package/lib/typescript/module/commercial/devMode.d.ts.map +1 -0
- package/lib/typescript/module/commercial/trust.d.ts +21 -0
- package/lib/typescript/module/commercial/trust.d.ts.map +1 -0
- package/lib/typescript/module/confirmation/gate.d.ts +18 -0
- package/lib/typescript/module/confirmation/gate.d.ts.map +1 -0
- package/lib/typescript/module/cursor/CursorOverlay.d.ts +13 -0
- package/lib/typescript/module/cursor/CursorOverlay.d.ts.map +1 -0
- package/lib/typescript/module/cursor/PointerHand.d.ts +16 -0
- package/lib/typescript/module/cursor/PointerHand.d.ts.map +1 -0
- package/lib/typescript/module/cursor/controller.d.ts +30 -0
- package/lib/typescript/module/cursor/controller.d.ts.map +1 -0
- package/lib/typescript/module/cursor/pointer.d.ts +23 -0
- package/lib/typescript/module/cursor/pointer.d.ts.map +1 -0
- package/lib/typescript/module/debug/KokoRemoteSmoke.d.ts +96 -0
- package/lib/typescript/module/debug/KokoRemoteSmoke.d.ts.map +1 -0
- package/lib/typescript/module/explore/ExplorationGraph.d.ts +96 -0
- package/lib/typescript/module/explore/ExplorationGraph.d.ts.map +1 -0
- package/lib/typescript/module/explore/bootstrapExplore.d.ts +40 -0
- package/lib/typescript/module/explore/bootstrapExplore.d.ts.map +1 -0
- package/lib/typescript/module/host/HostActions.d.ts +101 -0
- package/lib/typescript/module/host/HostActions.d.ts.map +1 -0
- package/lib/typescript/module/i18n/index.d.ts +20 -0
- package/lib/typescript/module/i18n/index.d.ts.map +1 -0
- package/lib/typescript/module/i18n/runtimeMessages.d.ts +178 -0
- package/lib/typescript/module/i18n/runtimeMessages.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +66 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/native/NativeBridge.d.ts +70 -0
- package/lib/typescript/module/native/NativeBridge.d.ts.map +1 -0
- package/lib/typescript/module/native/navigationLabel.d.ts +4 -0
- package/lib/typescript/module/native/navigationLabel.d.ts.map +1 -0
- package/lib/typescript/module/native/normalizeViewTree.d.ts +4 -0
- package/lib/typescript/module/native/normalizeViewTree.d.ts.map +1 -0
- package/lib/typescript/module/native/pruneOffscreen.d.ts +3 -0
- package/lib/typescript/module/native/pruneOffscreen.d.ts.map +1 -0
- package/lib/typescript/module/native/scrollViewport.d.ts +13 -0
- package/lib/typescript/module/native/scrollViewport.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/privacy/redact.d.ts +9 -0
- package/lib/typescript/module/privacy/redact.d.ts.map +1 -0
- package/lib/typescript/module/privacy/screenEvidence.d.ts +14 -0
- package/lib/typescript/module/privacy/screenEvidence.d.ts.map +1 -0
- package/lib/typescript/module/privacy/screenModel.d.ts +26 -0
- package/lib/typescript/module/privacy/screenModel.d.ts.map +1 -0
- package/lib/typescript/module/privacy/sensitiveScreen.d.ts +8 -0
- package/lib/typescript/module/privacy/sensitiveScreen.d.ts.map +1 -0
- package/lib/typescript/module/privacy/userGate.d.ts +58 -0
- package/lib/typescript/module/privacy/userGate.d.ts.map +1 -0
- package/lib/typescript/module/protocol/actions.d.ts +7 -0
- package/lib/typescript/module/protocol/actions.d.ts.map +1 -0
- package/lib/typescript/module/provider/HostAppearanceStore.d.ts +64 -0
- package/lib/typescript/module/provider/HostAppearanceStore.d.ts.map +1 -0
- package/lib/typescript/module/provider/KokoProvider.d.ts +39 -0
- package/lib/typescript/module/provider/KokoProvider.d.ts.map +1 -0
- package/lib/typescript/module/provider/KokoUiContext.d.ts +22 -0
- package/lib/typescript/module/provider/KokoUiContext.d.ts.map +1 -0
- package/lib/typescript/module/selector/match.d.ts +27 -0
- package/lib/typescript/module/selector/match.d.ts.map +1 -0
- package/lib/typescript/module/task/TaskStore.d.ts +65 -0
- package/lib/typescript/module/task/TaskStore.d.ts.map +1 -0
- package/lib/typescript/module/task/types.d.ts +66 -0
- package/lib/typescript/module/task/types.d.ts.map +1 -0
- package/lib/typescript/module/task/useTaskStore.d.ts +3 -0
- package/lib/typescript/module/task/useTaskStore.d.ts.map +1 -0
- package/lib/typescript/module/types.d.ts +372 -0
- package/lib/typescript/module/types.d.ts.map +1 -0
- package/lib/typescript/module/ui/KokoChatSheet.d.ts +8 -0
- package/lib/typescript/module/ui/KokoChatSheet.d.ts.map +1 -0
- package/lib/typescript/module/ui/KokoComposer.d.ts +13 -0
- package/lib/typescript/module/ui/KokoComposer.d.ts.map +1 -0
- package/lib/typescript/module/ui/KokoDialogHost.d.ts +32 -0
- package/lib/typescript/module/ui/KokoDialogHost.d.ts.map +1 -0
- package/lib/typescript/module/ui/KokoEntryButton.d.ts +18 -0
- package/lib/typescript/module/ui/KokoEntryButton.d.ts.map +1 -0
- package/lib/typescript/module/ui/KokoObserver.d.ts +13 -0
- package/lib/typescript/module/ui/KokoObserver.d.ts.map +1 -0
- package/lib/typescript/module/ui/KokoOverlayLayer.d.ts +35 -0
- package/lib/typescript/module/ui/KokoOverlayLayer.d.ts.map +1 -0
- package/lib/typescript/module/ui/KokoSubtitle.d.ts +7 -0
- package/lib/typescript/module/ui/KokoSubtitle.d.ts.map +1 -0
- package/lib/typescript/module/ui/KokoTaskPanel.d.ts +7 -0
- package/lib/typescript/module/ui/KokoTaskPanel.d.ts.map +1 -0
- package/lib/typescript/module/ui/hostOverlay.d.ts +28 -0
- package/lib/typescript/module/ui/hostOverlay.d.ts.map +1 -0
- package/lib/typescript/module/ui/icons.d.ts +26 -0
- package/lib/typescript/module/ui/icons.d.ts.map +1 -0
- package/lib/typescript/module/ui/progressChrome.d.ts +21 -0
- package/lib/typescript/module/ui/progressChrome.d.ts.map +1 -0
- package/lib/typescript/module/ui/safeArea.d.ts +12 -0
- package/lib/typescript/module/ui/safeArea.d.ts.map +1 -0
- package/lib/typescript/module/ui/useOverlayOrigin.d.ts +22 -0
- package/lib/typescript/module/ui/useOverlayOrigin.d.ts.map +1 -0
- package/package.json +153 -0
- package/react-native.config.js +12 -0
- package/src/KokoAgent.ts +1415 -0
- package/src/assist/OnDeviceAssist.ts +133 -0
- package/src/assist/intentClassify.ts +122 -0
- package/src/assist/nodeRank.ts +167 -0
- package/src/assist/ocrTarget.ts +146 -0
- package/src/assist/webVisualChange.ts +24 -0
- package/src/client/ActionOutcomeUnknownError.ts +18 -0
- package/src/client/AgentSession.ts +952 -0
- package/src/client/GatewayClient.ts +439 -0
- package/src/client/OperationReplayGuard.ts +61 -0
- package/src/client/RunCheckpoint.ts +154 -0
- package/src/client/loopDetect.ts +213 -0
- package/src/client/recentSearch.ts +47 -0
- package/src/client/walletChoiceGuard.ts +15 -0
- package/src/client/webResultCategory.ts +28 -0
- package/src/commercial/AccountStore.ts +85 -0
- package/src/commercial/AgentDebug.ts +142 -0
- package/src/commercial/ExecutionGuard.ts +67 -0
- package/src/commercial/UsageBus.ts +44 -0
- package/src/commercial/branding.ts +97 -0
- package/src/commercial/devMode.ts +48 -0
- package/src/commercial/trust.ts +67 -0
- package/src/confirmation/gate.ts +82 -0
- package/src/cursor/CursorOverlay.tsx +138 -0
- package/src/cursor/PointerHand.tsx +49 -0
- package/src/cursor/controller.ts +98 -0
- package/src/cursor/pointer.ts +40 -0
- package/src/debug/KokoRemoteSmoke.tsx +561 -0
- package/src/explore/ExplorationGraph.ts +518 -0
- package/src/explore/bootstrapExplore.ts +89 -0
- package/src/host/HostActions.ts +349 -0
- package/src/i18n/index.ts +229 -0
- package/src/i18n/runtimeMessages.ts +180 -0
- package/src/index.ts +203 -0
- package/src/native/NativeBridge.ts +207 -0
- package/src/native/navigationLabel.ts +11 -0
- package/src/native/normalizeViewTree.ts +16 -0
- package/src/native/pruneOffscreen.ts +72 -0
- package/src/native/scrollViewport.ts +51 -0
- package/src/privacy/redact.ts +115 -0
- package/src/privacy/screenEvidence.ts +55 -0
- package/src/privacy/screenModel.ts +504 -0
- package/src/privacy/sensitiveScreen.ts +55 -0
- package/src/privacy/userGate.ts +233 -0
- package/src/protocol/actions.ts +66 -0
- package/src/provider/HostAppearanceStore.ts +148 -0
- package/src/provider/KokoProvider.tsx +118 -0
- package/src/provider/KokoUiContext.tsx +162 -0
- package/src/selector/match.ts +417 -0
- package/src/task/TaskStore.ts +387 -0
- package/src/task/types.ts +82 -0
- package/src/task/useTaskStore.ts +9 -0
- package/src/types.ts +318 -0
- package/src/ui/KokoChatSheet.tsx +930 -0
- package/src/ui/KokoComposer.tsx +174 -0
- package/src/ui/KokoDialogHost.tsx +249 -0
- package/src/ui/KokoEntryButton.tsx +74 -0
- package/src/ui/KokoObserver.tsx +587 -0
- package/src/ui/KokoOverlayLayer.tsx +53 -0
- package/src/ui/KokoSubtitle.tsx +80 -0
- package/src/ui/KokoTaskPanel.tsx +299 -0
- package/src/ui/hostOverlay.tsx +148 -0
- package/src/ui/icons.tsx +145 -0
- package/src/ui/progressChrome.ts +73 -0
- package/src/ui/safeArea.ts +95 -0
- package/src/ui/useOverlayOrigin.ts +29 -0
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { sensitiveScreenKind } from "./sensitiveScreen.js";
|
|
4
|
+
import { scrollViewports } from "../native/scrollViewport.js";
|
|
5
|
+
import { redactOutbound } from "./redact.js";
|
|
6
|
+
import { isSdkChrome } from "./screenEvidence.js";
|
|
7
|
+
/**
|
|
8
|
+
* Scroll descriptions UIKit synthesizes for accessibility.
|
|
9
|
+
*
|
|
10
|
+
* They ride along on scroll containers and get concatenated into the label of
|
|
11
|
+
* whatever sits inside, so a real list row reads "BTC Bitcoin … Vertical scr"
|
|
12
|
+
* with its own content truncated away. Nothing can be aimed at them.
|
|
13
|
+
*/
|
|
14
|
+
const A11Y_SCROLL_NOISE = /\b(vertical|horizontal)\s+scroll\s+bar,\s*\d+\s*pages?\b|\bsection\s+index\b/gi;
|
|
15
|
+
function labelOf(n) {
|
|
16
|
+
const raw = (n.text || n.accessibilityLabel || '').replace(A11Y_SCROLL_NOISE, ' ');
|
|
17
|
+
const t = redactOutbound(raw).replace(/\s+/g, ' ').trim();
|
|
18
|
+
return t.slice(0, 80);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Labels often sit on Fabric Paragraph children while Pressable is the parent. */
|
|
22
|
+
function descendantLabel(n, depth = 0) {
|
|
23
|
+
const own = labelOf(n);
|
|
24
|
+
if (own) return own;
|
|
25
|
+
if (depth >= 4) return '';
|
|
26
|
+
const parts = [];
|
|
27
|
+
for (const c of n.children) {
|
|
28
|
+
const l = descendantLabel(c, depth + 1);
|
|
29
|
+
if (l) parts.push(l);
|
|
30
|
+
if (parts.join(' ').length >= 80) break;
|
|
31
|
+
}
|
|
32
|
+
return parts.join(' ').replace(/\s+/g, ' ').trim().slice(0, 80);
|
|
33
|
+
}
|
|
34
|
+
function isExcludedSubtree(node) {
|
|
35
|
+
return isSdkChrome(node) || /logbox/i.test(`${node.type} ${node.testID || ''}`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Dev LogBox / framework warnings that leak into accessibility trees. */
|
|
39
|
+
function isNoiseLabel(label) {
|
|
40
|
+
const s = label.trim();
|
|
41
|
+
if (!s) return false;
|
|
42
|
+
return /Dialog Animation duration/i.test(s) || /estimatedContentHeight/i.test(s) || /please use estimatedContentHeight/i.test(s) || /Require cycle:/i.test(s) || /Open debugger to view warnings/i.test(s) || /^!,?\s*Open debugger/i.test(s) || /^LogBox/i.test(s) || /PurchasesReactNative/i.test(s) || /See \d+ more components/i.test(s) || /^(addLog|addConsoleLog|reactConsoleErrorHandler|anonymous|renderWithHooks),/i.test(s) || /platform=ios&dev=true/i.test(s);
|
|
43
|
+
}
|
|
44
|
+
function isIgnoredLabel(label) {
|
|
45
|
+
return isNoiseLabel(label);
|
|
46
|
+
}
|
|
47
|
+
function isField(n) {
|
|
48
|
+
const t = n.type.toLowerCase();
|
|
49
|
+
return /textfield|textinput|edittext|uitextfield|uitextview|textarea/.test(t) || !!n.accessibilityLabel && /input|输入|placeholder|what do you/i.test(n.accessibilityLabel) && !n.clickable;
|
|
50
|
+
}
|
|
51
|
+
function collectNear(root, id) {
|
|
52
|
+
let parent = null;
|
|
53
|
+
let found = false;
|
|
54
|
+
const walk = (n, p) => {
|
|
55
|
+
if (n.id === id) {
|
|
56
|
+
parent = p;
|
|
57
|
+
found = true;
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
for (const c of n.children) {
|
|
61
|
+
walk(c, n);
|
|
62
|
+
if (found) return;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
walk(root, null);
|
|
66
|
+
if (!parent) return undefined;
|
|
67
|
+
const bits = [];
|
|
68
|
+
const gather = n => {
|
|
69
|
+
if (n.visible === false || isExcludedSubtree(n)) return;
|
|
70
|
+
const l = labelOf(n);
|
|
71
|
+
if (l && n.id !== id) bits.push(l);
|
|
72
|
+
for (const c of n.children) gather(c);
|
|
73
|
+
};
|
|
74
|
+
gather(parent);
|
|
75
|
+
const joined = [...new Set(bits)].filter(b => !isIgnoredLabel(b)).slice(0, 4).join(' · ');
|
|
76
|
+
return joined || undefined;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Text inside an affordance, in reading order.
|
|
81
|
+
*
|
|
82
|
+
* A list row or card whose own label is just a title loses the association
|
|
83
|
+
* between its cells: three tokens laid out as name/price/change siblings
|
|
84
|
+
* reach the planner as nine unrelated fragments, so "which one gained most"
|
|
85
|
+
* is unanswerable. Reading order is the only thing that ties a price to a
|
|
86
|
+
* name, so keep it — do not sort or globally de-duplicate.
|
|
87
|
+
*/
|
|
88
|
+
function descendantContext(n, ownLabel) {
|
|
89
|
+
const bits = [];
|
|
90
|
+
const gather = cur => {
|
|
91
|
+
if (cur.visible === false || isExcludedSubtree(cur)) return;
|
|
92
|
+
if (cur !== n) {
|
|
93
|
+
const l = labelOf(cur);
|
|
94
|
+
if (l && l !== ownLabel && l !== bits[bits.length - 1] && !isIgnoredLabel(l)) {
|
|
95
|
+
bits.push(l);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
for (const c of cur.children) gather(c);
|
|
99
|
+
};
|
|
100
|
+
gather(n);
|
|
101
|
+
if (bits.length < 2) return undefined;
|
|
102
|
+
return bits.join(' · ');
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* A label carrying only a number — a price, a percentage, a count.
|
|
107
|
+
*
|
|
108
|
+
* This is data the screen is showing, not something to aim at. Left ranked
|
|
109
|
+
* as a plain short button it outscores the controls around it and fills the
|
|
110
|
+
* model with fragments like 「$0.00352」 that say nothing about what tapping
|
|
111
|
+
* them would do.
|
|
112
|
+
*/
|
|
113
|
+
function isDataOnlyLabel(label) {
|
|
114
|
+
const s = label.trim();
|
|
115
|
+
if (!s) return false;
|
|
116
|
+
return /^[+\-$€£¥₿~≈]*[\d][\d.,\s]*(%|[KkMmBb])?$/.test(s);
|
|
117
|
+
}
|
|
118
|
+
function kindOf(n, label, near) {
|
|
119
|
+
if (/uitab(?:bar)?button|bottomnavigationitem|tabview$/i.test(n.type)) return 'tab';
|
|
120
|
+
if (n.sheet && n.clickable) return 'sheet';
|
|
121
|
+
if (n.toggle) return 'toggle';
|
|
122
|
+
if (n.adjustable || /picker|datepicker|uiswitch|slider|stepper|seekbar|segment|numberpicker/i.test(n.type)) {
|
|
123
|
+
return 'adjustable';
|
|
124
|
+
}
|
|
125
|
+
if (/delete|删除|trash|remove|关闭|close|cancel|取消|好|ok|确定|允许|不允许/i.test(label)) {
|
|
126
|
+
return 'button';
|
|
127
|
+
}
|
|
128
|
+
if (/add|添加|创建|导入|确认|submit|send|下一步|登录|保存|分享|share/i.test(label)) {
|
|
129
|
+
return 'button';
|
|
130
|
+
}
|
|
131
|
+
if (near && near !== label) return 'row';
|
|
132
|
+
return 'button';
|
|
133
|
+
}
|
|
134
|
+
function isLikelyCtaLabel(label) {
|
|
135
|
+
const s = label.trim();
|
|
136
|
+
if (!s || s.length > 24) return false;
|
|
137
|
+
return /^(创建|添加|新建|导入|登录|注册|开始|继续|下一步|完成|确认|提交|发送|连接|恢复)/.test(s);
|
|
138
|
+
}
|
|
139
|
+
function scoreAffordance(a, screenH) {
|
|
140
|
+
let s = 0;
|
|
141
|
+
const bottomBand = screenH * 0.72;
|
|
142
|
+
// Recovery navigation must survive a dense page's candidate limit.
|
|
143
|
+
if (a.y < screenH * 0.25 && /^(back|go back|close|返回|返回上一级|关闭)$/i.test(a.label)) s += 500;
|
|
144
|
+
if (a.kind === 'tab') s += 400;
|
|
145
|
+
// Primary empty-state CTAs (center) must outrank bottom tabs in the snapshot.
|
|
146
|
+
if (isLikelyCtaLabel(a.label) && a.y < bottomBand) s += 260;
|
|
147
|
+
// Bottom tab / dock chrome must survive list truncation.
|
|
148
|
+
if (a.y >= bottomBand) s += 200;
|
|
149
|
+
if (a.kind === 'sheet') s += 180;
|
|
150
|
+
if (a.kind === 'field') s += 120;
|
|
151
|
+
if (a.kind === 'toggle' || a.kind === 'adjustable') s += 110;
|
|
152
|
+
if (a.kind === 'button' && !a.near) s += 90;
|
|
153
|
+
if (a.kind === 'button' && a.near) s += 40;
|
|
154
|
+
if (a.kind === 'row') s += 20;
|
|
155
|
+
// Prefer short nav labels over long product row titles.
|
|
156
|
+
if (a.label.length <= 12 && !a.near) s += 30;
|
|
157
|
+
if (a.testID) s += 25;
|
|
158
|
+
// A bare number is short and context-free, so the bonuses above would rank
|
|
159
|
+
// a price above the search box on the same screen. Fields keep their score:
|
|
160
|
+
// an amount input is labelled by its current value and still needs typing.
|
|
161
|
+
if (a.kind !== 'field' && isDataOnlyLabel(a.label)) s -= 140;
|
|
162
|
+
return s;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Semantic screen model for the planner — "what can this screen do?"
|
|
167
|
+
* Collects all candidates then keeps the highest-priority ones so bottom
|
|
168
|
+
* navigation is not crowded out by long product lists.
|
|
169
|
+
*/
|
|
170
|
+
export function extractAffordances(root, max = 40) {
|
|
171
|
+
if (sensitiveScreenKind(root)) return [];
|
|
172
|
+
const ranked = [];
|
|
173
|
+
const seen = new Set();
|
|
174
|
+
const screenH = Math.max(root.frame?.height ?? 0, 1);
|
|
175
|
+
const byId = new Map(flattenForModel(root).map(n => [n.id, n]));
|
|
176
|
+
const parents = new Map();
|
|
177
|
+
const indexParents = node => {
|
|
178
|
+
for (const child of node.children) {
|
|
179
|
+
parents.set(child.id, node);
|
|
180
|
+
indexParents(child);
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
indexParents(root);
|
|
184
|
+
const parentOf = n => parents.get(n.id);
|
|
185
|
+
const isAncestor = (ancestor, child) => {
|
|
186
|
+
for (let parent = parentOf(child); parent; parent = parentOf(parent)) {
|
|
187
|
+
if (parent.id === ancestor.id) return true;
|
|
188
|
+
}
|
|
189
|
+
return false;
|
|
190
|
+
};
|
|
191
|
+
const climbInteractive = n => {
|
|
192
|
+
// A testID is a test hook, not an affordance: hosts put them on the text
|
|
193
|
+
// inside a row as readily as on the row. Stopping there emits the cell and
|
|
194
|
+
// hides the control, so only fall back to it when nothing above is
|
|
195
|
+
// interactive.
|
|
196
|
+
let testIdFallback;
|
|
197
|
+
let cur = n;
|
|
198
|
+
while (cur) {
|
|
199
|
+
const x = cur;
|
|
200
|
+
if (cur.clickable || x.toggle || x.adjustable || x.sheet) return cur;
|
|
201
|
+
if (cur.testID && !testIdFallback) testIdFallback = cur;
|
|
202
|
+
cur = parentOf(cur);
|
|
203
|
+
}
|
|
204
|
+
return testIdFallback ?? n;
|
|
205
|
+
};
|
|
206
|
+
const hasInteractiveAncestor = n => {
|
|
207
|
+
for (let cur = parentOf(n); cur; cur = parentOf(cur)) {
|
|
208
|
+
const x = cur;
|
|
209
|
+
if (cur.clickable || x.toggle || x.adjustable || x.sheet) return true;
|
|
210
|
+
}
|
|
211
|
+
return false;
|
|
212
|
+
};
|
|
213
|
+
const pushButton = (n, label, near) => {
|
|
214
|
+
if (!label || isIgnoredLabel(label)) return;
|
|
215
|
+
const node = n;
|
|
216
|
+
const kind = kindOf(node, label, near);
|
|
217
|
+
const key = `b:${label}:${near ?? ''}:${kind}:${n.id}`;
|
|
218
|
+
if (seen.has(key)) return;
|
|
219
|
+
// Only nested wrappers describe the same action. Identical sibling labels
|
|
220
|
+
// belong to distinct rows (e.g. Delete beside two different products).
|
|
221
|
+
const index = ranked.findIndex(a => {
|
|
222
|
+
const previous = byId.get(a.nodeId);
|
|
223
|
+
return a.label === label && previous && (previous.id === n.id || isAncestor(previous, n) || isAncestor(n, previous));
|
|
224
|
+
});
|
|
225
|
+
if (index >= 0) {
|
|
226
|
+
const previous = index >= 0 ? byId.get(ranked[index].nodeId) : undefined;
|
|
227
|
+
if (!previous || !n.clickable || previous.clickable && previous.frame.width * previous.frame.height <= n.frame.width * n.frame.height) return;
|
|
228
|
+
ranked.splice(index, 1);
|
|
229
|
+
}
|
|
230
|
+
seen.add(key);
|
|
231
|
+
ranked.push({
|
|
232
|
+
kind,
|
|
233
|
+
label,
|
|
234
|
+
nodeId: n.id,
|
|
235
|
+
// Wide enough for a row of cells; a 3-item card runs about 85 chars.
|
|
236
|
+
near: near && near !== label ? near.slice(0, 120) : undefined,
|
|
237
|
+
clickable: true,
|
|
238
|
+
selected: n.selected || undefined,
|
|
239
|
+
testID: n.testID,
|
|
240
|
+
y: n.frame?.y ?? 0,
|
|
241
|
+
score: 0
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
const walk = n => {
|
|
245
|
+
if (n.visible === false || isExcludedSubtree(n)) return;
|
|
246
|
+
const node = n;
|
|
247
|
+
const label = descendantLabel(n);
|
|
248
|
+
const field = isField(n);
|
|
249
|
+
const y = n.frame?.y ?? 0;
|
|
250
|
+
if (field && label) {
|
|
251
|
+
const key = `f:${n.id}`;
|
|
252
|
+
if (!seen.has(key)) {
|
|
253
|
+
seen.add(key);
|
|
254
|
+
ranked.push({
|
|
255
|
+
kind: 'field',
|
|
256
|
+
label,
|
|
257
|
+
nodeId: n.id,
|
|
258
|
+
near: collectNear(root, n.id),
|
|
259
|
+
clickable: n.clickable,
|
|
260
|
+
y,
|
|
261
|
+
score: 0
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
} else if ((n.clickable || node.toggle || node.adjustable) && (label || node.toggle || node.adjustable) && !(label && isIgnoredLabel(label))) {
|
|
265
|
+
// Context from inside the control first, from around it second. A row's
|
|
266
|
+
// own cells are what make it identifiable; its siblings are other rows.
|
|
267
|
+
const near = descendantContext(n, label) ?? collectNear(root, n.id);
|
|
268
|
+
let display = label || (node.toggle ? `开关${node.on != null ? node.on ? '(开)' : '(关)' : ''}` : '') || (node.adjustable ? '可调节控件' : '') || n.type.split('.').pop() || '控件';
|
|
269
|
+
if (node.toggle && label && node.on != null) {
|
|
270
|
+
display = `${label}(${node.on ? '开' : '关'})`;
|
|
271
|
+
}
|
|
272
|
+
if (node.adjustable && typeof node.value === 'number' && Number.isFinite(node.value)) {
|
|
273
|
+
const v = Math.round(node.value * 100) / 100;
|
|
274
|
+
const lo = typeof node.min === 'number' ? Math.round(node.min * 100) / 100 : null;
|
|
275
|
+
const hi = typeof node.max === 'number' ? Math.round(node.max * 100) / 100 : null;
|
|
276
|
+
const range = lo != null && hi != null ? `,${lo}–${hi}` : '';
|
|
277
|
+
display = `${display}(${v}${range})`;
|
|
278
|
+
}
|
|
279
|
+
pushButton(n, display, near && near !== display ? near : undefined);
|
|
280
|
+
} else if (label && isLikelyCtaLabel(label)) {
|
|
281
|
+
// Tamagui Button: text often on a non-clickable Paragraph — promote CTA.
|
|
282
|
+
const target = climbInteractive(n);
|
|
283
|
+
const near = collectNear(root, target.id);
|
|
284
|
+
pushButton(target, label, near && near !== label ? near : undefined);
|
|
285
|
+
} else if (n.testID && label && !isIgnoredLabel(label)) {
|
|
286
|
+
// Already covered: the clickable ancestor was pushed on the way down,
|
|
287
|
+
// with this text as part of its context. Emitting the cell too would
|
|
288
|
+
// duplicate it stripped of everything that made it meaningful.
|
|
289
|
+
if (!hasInteractiveAncestor(n)) {
|
|
290
|
+
const target = climbInteractive(n);
|
|
291
|
+
pushButton(target, label, collectNear(root, target.id));
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
for (const c of n.children) walk(c);
|
|
295
|
+
};
|
|
296
|
+
walk(root);
|
|
297
|
+
for (const a of ranked) {
|
|
298
|
+
a.score = scoreAffordance(a, screenH);
|
|
299
|
+
}
|
|
300
|
+
ranked.sort((a, b) => b.score - a.score || a.y - b.y);
|
|
301
|
+
|
|
302
|
+
// Bottom tab chrome often outranks page body — reserve slots for upper content
|
|
303
|
+
// so tab switches change the fingerprint and Discovery lists reach the planner.
|
|
304
|
+
const bottomBand = screenH * 0.72;
|
|
305
|
+
const upper = ranked.filter(a => a.y < bottomBand);
|
|
306
|
+
const bottom = ranked.filter(a => a.y >= bottomBand);
|
|
307
|
+
const upperSlots = Math.max(Math.ceil(max * 0.65), max - 5);
|
|
308
|
+
const picked = [];
|
|
309
|
+
const seenIds = new Set();
|
|
310
|
+
const take = (list, n) => {
|
|
311
|
+
for (const a of list) {
|
|
312
|
+
if (picked.length >= n) break;
|
|
313
|
+
if (seenIds.has(a.nodeId)) continue;
|
|
314
|
+
seenIds.add(a.nodeId);
|
|
315
|
+
picked.push(a);
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
take(upper, upperSlots);
|
|
319
|
+
take(bottom, max);
|
|
320
|
+
take(ranked, max);
|
|
321
|
+
return picked.slice(0, max).map(({
|
|
322
|
+
kind,
|
|
323
|
+
label,
|
|
324
|
+
nodeId,
|
|
325
|
+
near,
|
|
326
|
+
clickable,
|
|
327
|
+
selected
|
|
328
|
+
}) => ({
|
|
329
|
+
kind,
|
|
330
|
+
label,
|
|
331
|
+
nodeId,
|
|
332
|
+
near,
|
|
333
|
+
clickable,
|
|
334
|
+
selected
|
|
335
|
+
}));
|
|
336
|
+
}
|
|
337
|
+
function flattenForModel(root) {
|
|
338
|
+
const out = [];
|
|
339
|
+
const walk = n => {
|
|
340
|
+
if (n.visible === false || isExcludedSubtree(n)) return;
|
|
341
|
+
out.push(n);
|
|
342
|
+
for (const c of n.children) walk(c);
|
|
343
|
+
};
|
|
344
|
+
walk(root);
|
|
345
|
+
return out;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/** Read-only page copy is state too: wizard steps may reuse every button. */
|
|
349
|
+
export function readablePageContent(root, max = 24) {
|
|
350
|
+
if (sensitiveScreenKind(root)) return [];
|
|
351
|
+
const controls = new Set(extractAffordances(root, 100).map(a => a.label));
|
|
352
|
+
const text = new Set();
|
|
353
|
+
const hasCopy = n => n.visible !== false && !isExcludedSubtree(n) && (!!labelOf(n) || n.children.some(hasCopy));
|
|
354
|
+
const walk = n => {
|
|
355
|
+
if (n.visible === false || n.secure || isExcludedSubtree(n)) return;
|
|
356
|
+
// Prefer leaf copy to native ancestors' aggregated (and truncated) labels.
|
|
357
|
+
const hasChildCopy = n.children.some(hasCopy);
|
|
358
|
+
const label = (n.text || n.accessibilityLabel || '').replace(/\s+/g, ' ').trim();
|
|
359
|
+
if (!hasChildCopy && label && !controls.has(label) && !isIgnoredLabel(label) && !isDataOnlyLabel(label) && !/^\d{1,2}:\d{2}$/.test(label)) text.add(redactOutbound(label, root).slice(0, 500));
|
|
360
|
+
for (const c of n.children) walk(c);
|
|
361
|
+
};
|
|
362
|
+
walk(root);
|
|
363
|
+
return redactOutbound([...text].slice(0, max), root);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/** Compact text for LLM context (token-friendly). */
|
|
367
|
+
export function screenModelText(root, max = 40, hostExtra) {
|
|
368
|
+
if (sensitiveScreenKind(root)) return '[private screen — user completes locally]';
|
|
369
|
+
const items = extractAffordances(root, max);
|
|
370
|
+
const controls = items.length ? items.map(a => {
|
|
371
|
+
const near = a.near ? ` · near「${a.near}」` : '';
|
|
372
|
+
const hint = a.kind === 'tab' ? ' · 一级栏目入口,目标属于该栏目时先进入' : a.kind === 'toggle' ? ' · tap 切换' : a.kind === 'adjustable' ? ' · tap/swipe 调到目标值(看括号内当前值)' : '';
|
|
373
|
+
const state = a.selected ? ' · 当前已选中(无需再点)' : '';
|
|
374
|
+
return `- [${a.kind}] 「${a.label}」 id=${a.nodeId}${near}${state}${hint}`;
|
|
375
|
+
}).join('\n') : '';
|
|
376
|
+
const regions = scrollViewports(root).slice(0, 6).map(({
|
|
377
|
+
node,
|
|
378
|
+
frame: f
|
|
379
|
+
}) => `- [scroll-region] id=${node.id} bounds=(${Math.round(f.x)},${Math.round(f.y)},${Math.round(f.width)},${Math.round(f.height)}) · 仅用于当前列表,优先相关可见导航;滑动起终点须在区域内`).join('\n');
|
|
380
|
+
const content = readablePageContent(root).map(text => `- [content] ${text}`).join('\n');
|
|
381
|
+
const dumpPart = [controls, content, regions].filter(Boolean).join('\n');
|
|
382
|
+
const host = (hostExtra || '').trim();
|
|
383
|
+
if (dumpPart && host) return `${dumpPart}\n${host}`;
|
|
384
|
+
if (dumpPart) return dumpPart;
|
|
385
|
+
if (host) return host;
|
|
386
|
+
return '(未识别到可操作控件或滚动区域;等待加载后重新观察,勿盲目滑动)';
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/** One-line snapshot for history feedback after an action. */
|
|
390
|
+
export function screenSnapshotLine(root, max = 12) {
|
|
391
|
+
if (sensitiveScreenKind(root)) return '[private screen — user completes locally]';
|
|
392
|
+
const items = extractAffordances(root, max);
|
|
393
|
+
const content = readablePageContent(root);
|
|
394
|
+
const copy = content.length ? ` | content: ${content.join(' | ')}` : '';
|
|
395
|
+
return `screen: ${items.length ? items.map(a => `${a.label}${a.selected ? ' [selected]' : ''}`).join(' | ') : '(no controls)'}${copy}`;
|
|
396
|
+
}
|
|
397
|
+
//# sourceMappingURL=screenModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["sensitiveScreenKind","scrollViewports","redactOutbound","isSdkChrome","A11Y_SCROLL_NOISE","labelOf","n","raw","text","accessibilityLabel","replace","t","trim","slice","descendantLabel","depth","own","parts","c","children","l","push","join","length","isExcludedSubtree","node","test","type","testID","isNoiseLabel","label","s","isIgnoredLabel","isField","toLowerCase","clickable","collectNear","root","id","parent","found","walk","p","undefined","bits","gather","visible","joined","Set","filter","b","descendantContext","ownLabel","cur","isDataOnlyLabel","kindOf","near","sheet","toggle","adjustable","isLikelyCtaLabel","scoreAffordance","a","screenH","bottomBand","y","kind","extractAffordances","max","ranked","seen","Math","frame","height","byId","Map","flattenForModel","map","parents","indexParents","child","set","parentOf","get","isAncestor","ancestor","climbInteractive","testIdFallback","x","hasInteractiveAncestor","pushButton","key","has","index","findIndex","previous","nodeId","width","splice","add","selected","score","field","display","on","split","pop","value","Number","isFinite","v","round","lo","min","hi","range","target","sort","upper","bottom","upperSlots","ceil","picked","seenIds","take","list","out","readablePageContent","controls","hasCopy","some","secure","hasChildCopy","screenModelText","hostExtra","items","hint","state","regions","f","content","dumpPart","Boolean","host","screenSnapshotLine","copy"],"sourceRoot":"../../../src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CAAC,CAACxH,IAAI,CAAC,IAAI,CAAC;EACxE,MAAMyH,IAAI,GAAG,CAACT,SAAS,IAAI,EAAE,EAAE1H,IAAI,CAAC,CAAC;EACrC,IAAIiI,QAAQ,IAAIE,IAAI,EAAE,OAAO,GAAGF,QAAQ,KAAKE,IAAI,EAAE;EACnD,IAAIF,QAAQ,EAAE,OAAOA,QAAQ;EAC7B,IAAIE,IAAI,EAAE,OAAOA,IAAI;EACrB,OAAO,kCAAkC;AAC3C;;AAEA;AACA,OAAO,SAASC,kBAAkBA,CAAC3G,IAAc,EAAE+B,GAAG,GAAG,EAAE,EAAU;EACnE,IAAIpE,mBAAmB,CAACqC,IAAI,CAAC,EAAE,OAAO,2CAA2C;EACjF,MAAMkG,KAAK,GAAGpE,kBAAkB,CAAC9B,IAAI,EAAE+B,GAAG,CAAC;EAC3C,MAAMwE,OAAO,GAAGb,mBAAmB,CAAC1F,IAAI,CAAC;EACzC,MAAM4G,IAAI,GAAGL,OAAO,CAACrH,MAAM,GAAG,eAAeqH,OAAO,CAACtH,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE;EACvE,OAAO,WAAWiH,KAAK,CAAChH,MAAM,GAAGgH,KAAK,CAAC1D,GAAG,CAACf,CAAC,IAAI,GAAGA,CAAC,CAAChC,KAAK,GAAGgC,CAAC,CAACsC,QAAQ,GAAG,aAAa,GAAG,EAAE,EAAE,CAAC,CAAC9E,IAAI,CAAC,KAAK,CAAC,GAAG,eAAe,GAAG2H,IAAI,EAAE;AACxI","ignoreList":[]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { runtimeText } from "../i18n/index.js";
|
|
4
|
+
import { isPrivateInput, isSdkChrome, PRIVATE_INPUT_PROMPT_RE, staticScreenLabels } from "./screenEvidence.js";
|
|
5
|
+
/** Local-only classification. Never return a field value or mnemonic word. */
|
|
6
|
+
export function sensitiveScreenKind(root) {
|
|
7
|
+
if (!root) return null;
|
|
8
|
+
let result = null;
|
|
9
|
+
let legacyPhraseCells = 0;
|
|
10
|
+
let legacySuggestions = false;
|
|
11
|
+
const visit = n => {
|
|
12
|
+
if (isSdkChrome(n)) return;
|
|
13
|
+
if (n.visible === false) {
|
|
14
|
+
for (const child of n.children || []) visit(child);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (isPrivateInput(n)) result = 'password';
|
|
18
|
+
const id = n.testID || '';
|
|
19
|
+
if (/textfield|textinput|edittext|textview|textarea/i.test(n.type) && /助记词|mnemonic|(?:recovery|seed)[\s_-]*phrase/i.test(`${id} ${n.accessibilityLabel || ''}`)) result = 'recovery_phrase';
|
|
20
|
+
if (/textfield|textinput|edittext|textview|textarea/i.test(n.type) && /私钥|private[\s_-]*key/i.test(`${id} ${n.accessibilityLabel || ''}`)) result = 'private_key';
|
|
21
|
+
if (/privacy-sensitive.*(?:phrase|mnemonic|seed)/i.test(id)) {
|
|
22
|
+
result = 'recovery_phrase';
|
|
23
|
+
}
|
|
24
|
+
if (/phrase-index\d+/i.test(id)) legacyPhraseCells++;
|
|
25
|
+
if (/^suggest-|^wordIndex$/i.test(id)) legacySuggestions = true;
|
|
26
|
+
if (/privacy-sensitive.*private|private[-_]?key[-_]?(?:value|field|input)/i.test(id)) {
|
|
27
|
+
result = 'private_key';
|
|
28
|
+
}
|
|
29
|
+
for (const child of n.children || []) visit(child);
|
|
30
|
+
};
|
|
31
|
+
visit(root);
|
|
32
|
+
if (result) return result;
|
|
33
|
+
const headings = staticScreenLabels(root).map(({
|
|
34
|
+
label
|
|
35
|
+
}) => label);
|
|
36
|
+
// Legacy wallet IDs are not reserved SDK markers: suggest-* is also common
|
|
37
|
+
// in public search. Require phrase context or an actual indexed word grid.
|
|
38
|
+
if (legacyPhraseCells >= 3 || (legacyPhraseCells || legacySuggestions) && headings.some(text => /助记词|mnemonic|(?:recovery|seed)\s+phrase/i.test(text))) return 'recovery_phrase';
|
|
39
|
+
for (const text of headings) {
|
|
40
|
+
if (PRIVATE_INPUT_PROMPT_RE.test(text)) return 'password';
|
|
41
|
+
if (/^(?:(?:验证|确认|备份|显示|查看|输入|导入|恢复)(?:您的|你的)?助记词|(?:verify|confirm|back\s*up|backup|show|reveal|import|enter)\s+(?:(?:your|the)\s+)?(?:recovery\s+|seed\s+)?(?:phrase|mnemonic))\s*[::??]?$/i.test(text)) return 'recovery_phrase';
|
|
42
|
+
if (/^(?:(?:导出|显示|查看|输入|导入)(?:您的|你的)?私钥|(?:export|show|reveal|import|enter)\s+(?:(?:your|the)\s+)?private\s*key)\s*[::]?$/i.test(text)) return 'private_key';
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
export class SensitiveScreenError extends Error {
|
|
47
|
+
constructor() {
|
|
48
|
+
super(runtimeText('runtime.privateStep'));
|
|
49
|
+
this.name = 'SensitiveScreenError';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=sensitiveScreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["runtimeText","isPrivateInput","isSdkChrome","PRIVATE_INPUT_PROMPT_RE","staticScreenLabels","sensitiveScreenKind","root","result","legacyPhraseCells","legacySuggestions","visit","n","visible","child","children","id","testID","test","type","accessibilityLabel","headings","map","label","some","text","SensitiveScreenError","Error","constructor","name"],"sourceRoot":"../../../src","sources":["privacy/sensitiveScreen.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,kBAAS;AAErC,SAASC,cAAc,EAAEC,WAAW,EAAEC,uBAAuB,EAAEC,kBAAkB,QAAQ,qBAAkB;AAI3G;AACA,OAAO,SAASC,mBAAmBA,CAACC,IAAiC,EAA8B;EACjG,IAAI,CAACA,IAAI,EAAE,OAAO,IAAI;EACtB,IAAIC,MAAkC,GAAG,IAAI;EAC7C,IAAIC,iBAAiB,GAAG,CAAC;EACzB,IAAIC,iBAAiB,GAAG,KAAK;EAC7B,MAAMC,KAAK,GAAIC,CAAW,I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