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