@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,587 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Animated,
|
|
4
|
+
Easing,
|
|
5
|
+
Image,
|
|
6
|
+
PanResponder,
|
|
7
|
+
Pressable,
|
|
8
|
+
StyleSheet,
|
|
9
|
+
Text,
|
|
10
|
+
useWindowDimensions,
|
|
11
|
+
View,
|
|
12
|
+
} from 'react-native';
|
|
13
|
+
import { useKokoAgent } from '../provider/KokoProvider';
|
|
14
|
+
import { useKokoUi } from '../provider/KokoUiContext';
|
|
15
|
+
import { TaskStore } from '../task/TaskStore';
|
|
16
|
+
import { useTaskStore } from '../task/useTaskStore';
|
|
17
|
+
import type { ProgressResultFlash } from '../task/types';
|
|
18
|
+
import { useSafeAreaInsetsOptional } from './safeArea';
|
|
19
|
+
import { useOverlayOrigin } from './useOverlayOrigin';
|
|
20
|
+
import { KokoChatSheet } from './KokoChatSheet';
|
|
21
|
+
import { KokoHostOverlay } from './hostOverlay';
|
|
22
|
+
import { setProgressChromeFrame } from './progressChrome';
|
|
23
|
+
import { IconCheck, IconClose, IconDash, IconStop } from './icons';
|
|
24
|
+
import { signalAppUserGateCheck } from '../privacy/userGate';
|
|
25
|
+
import {
|
|
26
|
+
CursorController,
|
|
27
|
+
type CursorState,
|
|
28
|
+
} from '../cursor/controller';
|
|
29
|
+
import { KOKO_CURSOR_TEST_ID } from './KokoOverlayLayer';
|
|
30
|
+
import { PointerHand } from '../cursor/PointerHand';
|
|
31
|
+
import {
|
|
32
|
+
CURSOR_H,
|
|
33
|
+
CURSOR_TIP_X,
|
|
34
|
+
CURSOR_TIP_Y,
|
|
35
|
+
CURSOR_W,
|
|
36
|
+
} from '../cursor/pointer';
|
|
37
|
+
|
|
38
|
+
const RESULT_DISMISS_MS = 2600;
|
|
39
|
+
|
|
40
|
+
export type KokoObserverProps = {
|
|
41
|
+
/** @deprecated Prefer config.branding.placeholder */
|
|
42
|
+
composerPlaceholder?: string;
|
|
43
|
+
/** Draw agent cursor in the same overlay Modal (default true). */
|
|
44
|
+
cursor?: boolean;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Progress pill + stop (+ optional cursor) in one host overlay Modal.
|
|
49
|
+
* After a run ends, shows an animated success/fail icon then auto-dismisses.
|
|
50
|
+
*/
|
|
51
|
+
export function KokoObserver({
|
|
52
|
+
composerPlaceholder,
|
|
53
|
+
cursor = true,
|
|
54
|
+
}: KokoObserverProps) {
|
|
55
|
+
const koko = useKokoAgent();
|
|
56
|
+
const { branding, t, colors } = useKokoUi();
|
|
57
|
+
const { subtitle, tasks, activeTaskId, ui, resultFlash, userGateWaiting } =
|
|
58
|
+
useTaskStore();
|
|
59
|
+
const insets = useSafeAreaInsetsOptional();
|
|
60
|
+
const running = tasks.some(
|
|
61
|
+
(t) => t.id === activeTaskId && t.status === 'running',
|
|
62
|
+
);
|
|
63
|
+
const [cursorState, setCursorState] = useState<CursorState>(() =>
|
|
64
|
+
CursorController.getState(),
|
|
65
|
+
);
|
|
66
|
+
// Clear of the host's own bottom chrome (tab bars, CTAs) by default; the
|
|
67
|
+
// user can drag it anywhere from there.
|
|
68
|
+
const bottom = Math.max(insets.bottom, 8) + (userGateWaiting ? 144 : 40);
|
|
69
|
+
const right = Math.max(insets.right, 8) + 14;
|
|
70
|
+
const rowRef = useRef<View>(null);
|
|
71
|
+
const {
|
|
72
|
+
ref: cursorLayerRef,
|
|
73
|
+
origin: cursorOrigin,
|
|
74
|
+
measure: measureCursorLayer,
|
|
75
|
+
} = useOverlayOrigin();
|
|
76
|
+
const resultOpacity = useRef(new Animated.Value(1)).current;
|
|
77
|
+
const cursorAnim = useRef(
|
|
78
|
+
new Animated.ValueXY({ x: cursorState.x, y: cursorState.y }),
|
|
79
|
+
).current;
|
|
80
|
+
const cursorPress = useRef(new Animated.Value(0)).current;
|
|
81
|
+
const chromeEpoch = ui.chromeEpoch ?? 0;
|
|
82
|
+
|
|
83
|
+
// Whatever corner we pick, some run will need the user to touch exactly what
|
|
84
|
+
// the pill is sitting on. Let them shove it aside instead of making them
|
|
85
|
+
// guess our layout.
|
|
86
|
+
const { width: screenW, height: screenH } = useWindowDimensions();
|
|
87
|
+
const dragOffset = useRef(new Animated.ValueXY({ x: 0, y: 0 })).current;
|
|
88
|
+
const dragStart = useRef({ x: 0, y: 0 });
|
|
89
|
+
const dragBounds = useRef({ x: 0, y: 0, width: 0, height: 0 });
|
|
90
|
+
|
|
91
|
+
// Manual takeover must leave the host's bottom submit/next button usable,
|
|
92
|
+
// including when the user previously dragged normal progress into that area.
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (userGateWaiting) dragOffset.setValue({ x: 0, y: 0 });
|
|
95
|
+
}, [!!userGateWaiting, dragOffset]);
|
|
96
|
+
|
|
97
|
+
useEffect(() => CursorController.subscribe(setCursorState), []);
|
|
98
|
+
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if ((!running || userGateWaiting) && cursorState.visible) CursorController.hide();
|
|
101
|
+
}, [running, userGateWaiting, cursorState.visible]);
|
|
102
|
+
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
const duration = Math.max(0, cursorState.moveDurationMs ?? 0);
|
|
105
|
+
const to = {
|
|
106
|
+
x: cursorState.x - cursorOrigin.x - CURSOR_TIP_X,
|
|
107
|
+
y: cursorState.y - cursorOrigin.y - CURSOR_TIP_Y,
|
|
108
|
+
};
|
|
109
|
+
if (duration <= 0) {
|
|
110
|
+
cursorAnim.stopAnimation();
|
|
111
|
+
cursorAnim.setValue(to);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
Animated.timing(cursorAnim, {
|
|
115
|
+
toValue: to,
|
|
116
|
+
duration,
|
|
117
|
+
// Cursor animation can overlap Fabric's lazy native view registration.
|
|
118
|
+
useNativeDriver: false,
|
|
119
|
+
}).start();
|
|
120
|
+
}, [
|
|
121
|
+
cursorState.x,
|
|
122
|
+
cursorState.y,
|
|
123
|
+
cursorState.moveDurationMs,
|
|
124
|
+
cursorOrigin.x,
|
|
125
|
+
cursorOrigin.y,
|
|
126
|
+
cursorAnim,
|
|
127
|
+
]);
|
|
128
|
+
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
Animated.spring(cursorPress, {
|
|
131
|
+
toValue: cursorState.pressing ? 1 : 0,
|
|
132
|
+
useNativeDriver: false,
|
|
133
|
+
friction: 6,
|
|
134
|
+
}).start();
|
|
135
|
+
}, [cursorState.pressing, cursorPress]);
|
|
136
|
+
|
|
137
|
+
const onStop = useCallback(() => {
|
|
138
|
+
koko.stop();
|
|
139
|
+
koko.finishTask('cancelled', t('runtime.cancelled'));
|
|
140
|
+
}, [koko, t]);
|
|
141
|
+
|
|
142
|
+
const measureChrome = useCallback(() => {
|
|
143
|
+
rowRef.current?.measureInWindow((x, y, width, height) => {
|
|
144
|
+
if (width > 0 && height > 0) {
|
|
145
|
+
dragBounds.current = { x, y, width, height };
|
|
146
|
+
setProgressChromeFrame({ x, y, width, height });
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}, []);
|
|
150
|
+
|
|
151
|
+
useEffect(() => {
|
|
152
|
+
const frame = requestAnimationFrame(measureChrome);
|
|
153
|
+
return () => cancelAnimationFrame(frame);
|
|
154
|
+
}, [bottom, right, measureChrome]);
|
|
155
|
+
|
|
156
|
+
const dragResponder = useMemo(
|
|
157
|
+
() =>
|
|
158
|
+
PanResponder.create({
|
|
159
|
+
// Capture, so a drag that starts on the stop button still moves the
|
|
160
|
+
// pill. A plain press never crosses the threshold and stays with the
|
|
161
|
+
// button.
|
|
162
|
+
onMoveShouldSetPanResponderCapture: (_e, g) =>
|
|
163
|
+
Math.abs(g.dx) > 6 || Math.abs(g.dy) > 6,
|
|
164
|
+
onPanResponderGrant: () => {
|
|
165
|
+
dragOffset.stopAnimation((v) => {
|
|
166
|
+
dragStart.current = v as { x: number; y: number };
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
onPanResponderMove: (_e, g) => {
|
|
170
|
+
const b = dragBounds.current;
|
|
171
|
+
// `b` is where the pill is right now, offset included, so take the
|
|
172
|
+
// offset back out to get the room left on each side.
|
|
173
|
+
const restX = b.x - dragStart.current.x;
|
|
174
|
+
const restY = b.y - dragStart.current.y;
|
|
175
|
+
const min = 8;
|
|
176
|
+
const clamp = (v: number, lo: number, hi: number) =>
|
|
177
|
+
Math.min(hi, Math.max(lo, v));
|
|
178
|
+
dragOffset.setValue({
|
|
179
|
+
x: clamp(
|
|
180
|
+
dragStart.current.x + g.dx,
|
|
181
|
+
min - restX,
|
|
182
|
+
screenW - b.width - min - restX,
|
|
183
|
+
),
|
|
184
|
+
y: clamp(
|
|
185
|
+
dragStart.current.y + g.dy,
|
|
186
|
+
min - restY,
|
|
187
|
+
screenH - b.height - min - restY,
|
|
188
|
+
),
|
|
189
|
+
});
|
|
190
|
+
},
|
|
191
|
+
// The agent hides chrome before touching anything under it, so the
|
|
192
|
+
// clearance rect has to follow the pill to its new home.
|
|
193
|
+
onPanResponderRelease: measureChrome,
|
|
194
|
+
onPanResponderTerminate: measureChrome,
|
|
195
|
+
}),
|
|
196
|
+
[dragOffset, measureChrome, screenW, screenH],
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
if (!resultFlash) return;
|
|
201
|
+
resultOpacity.setValue(0);
|
|
202
|
+
Animated.timing(resultOpacity, {
|
|
203
|
+
toValue: 1,
|
|
204
|
+
duration: 160,
|
|
205
|
+
useNativeDriver: true,
|
|
206
|
+
}).start();
|
|
207
|
+
const hide = setTimeout(() => {
|
|
208
|
+
Animated.timing(resultOpacity, {
|
|
209
|
+
toValue: 0,
|
|
210
|
+
duration: 200,
|
|
211
|
+
useNativeDriver: true,
|
|
212
|
+
}).start(({ finished }) => {
|
|
213
|
+
if (finished) TaskStore.clearResultFlash();
|
|
214
|
+
});
|
|
215
|
+
}, RESULT_DISMISS_MS);
|
|
216
|
+
return () => clearTimeout(hide);
|
|
217
|
+
}, [resultFlash?.at, resultOpacity]);
|
|
218
|
+
|
|
219
|
+
useEffect(() => {
|
|
220
|
+
if (!running && !resultFlash && !userGateWaiting) {
|
|
221
|
+
setProgressChromeFrame(null);
|
|
222
|
+
}
|
|
223
|
+
}, [running, resultFlash, userGateWaiting]);
|
|
224
|
+
|
|
225
|
+
useEffect(() => {
|
|
226
|
+
if (!running) return;
|
|
227
|
+
TaskStore.liftChrome();
|
|
228
|
+
}, [running, subtitle]);
|
|
229
|
+
|
|
230
|
+
const showingResult = Boolean(resultFlash) && !running;
|
|
231
|
+
const showProgress =
|
|
232
|
+
(running || showingResult || !!userGateWaiting) &&
|
|
233
|
+
!ui.sheetOpen &&
|
|
234
|
+
!ui.chromeSuppressed;
|
|
235
|
+
const showCursor = Boolean(cursor && running && cursorState.visible);
|
|
236
|
+
const showOverlay = showProgress || showCursor;
|
|
237
|
+
|
|
238
|
+
const cursorScale = cursorPress.interpolate({
|
|
239
|
+
inputRange: [0, 1],
|
|
240
|
+
outputRange: [1, 0.88],
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
return (
|
|
244
|
+
<>
|
|
245
|
+
{showOverlay ? (
|
|
246
|
+
<KokoHostOverlay liftToken={chromeEpoch}>
|
|
247
|
+
{showCursor ? (
|
|
248
|
+
<View
|
|
249
|
+
ref={cursorLayerRef}
|
|
250
|
+
onLayout={measureCursorLayer}
|
|
251
|
+
testID={KOKO_CURSOR_TEST_ID}
|
|
252
|
+
nativeID={KOKO_CURSOR_TEST_ID}
|
|
253
|
+
collapsable={false}
|
|
254
|
+
pointerEvents="none"
|
|
255
|
+
style={StyleSheet.absoluteFillObject}
|
|
256
|
+
accessibilityElementsHidden
|
|
257
|
+
importantForAccessibility="no-hide-descendants"
|
|
258
|
+
>
|
|
259
|
+
<Animated.View
|
|
260
|
+
style={[
|
|
261
|
+
styles.cursor,
|
|
262
|
+
{
|
|
263
|
+
transform: [
|
|
264
|
+
...cursorAnim.getTranslateTransform(),
|
|
265
|
+
{ scale: cursorScale },
|
|
266
|
+
],
|
|
267
|
+
},
|
|
268
|
+
]}
|
|
269
|
+
>
|
|
270
|
+
<PointerHand />
|
|
271
|
+
</Animated.View>
|
|
272
|
+
</View>
|
|
273
|
+
) : null}
|
|
274
|
+
|
|
275
|
+
{showProgress ? (
|
|
276
|
+
<View
|
|
277
|
+
pointerEvents="box-none"
|
|
278
|
+
style={[styles.progressWrap, { bottom, right }]}
|
|
279
|
+
>
|
|
280
|
+
<Animated.View
|
|
281
|
+
ref={rowRef}
|
|
282
|
+
{...dragResponder.panHandlers}
|
|
283
|
+
style={[
|
|
284
|
+
styles.progressRow,
|
|
285
|
+
{ transform: dragOffset.getTranslateTransform() },
|
|
286
|
+
showingResult ? { opacity: resultOpacity } : null,
|
|
287
|
+
]}
|
|
288
|
+
onLayout={measureChrome}
|
|
289
|
+
>
|
|
290
|
+
{showingResult && resultFlash ? (
|
|
291
|
+
<ResultIconBadge
|
|
292
|
+
flash={resultFlash}
|
|
293
|
+
onPress={() => TaskStore.openSheet(resultFlash.taskId)}
|
|
294
|
+
a11y={t('progress.openA11y')}
|
|
295
|
+
/>
|
|
296
|
+
) : userGateWaiting ? (
|
|
297
|
+
<>
|
|
298
|
+
<View
|
|
299
|
+
style={[
|
|
300
|
+
styles.progress,
|
|
301
|
+
styles.gateBanner,
|
|
302
|
+
{ backgroundColor: colors.progressBg },
|
|
303
|
+
]}
|
|
304
|
+
>
|
|
305
|
+
<View
|
|
306
|
+
style={[
|
|
307
|
+
styles.logo,
|
|
308
|
+
{ backgroundColor: branding.primaryColor },
|
|
309
|
+
]}
|
|
310
|
+
>
|
|
311
|
+
{branding.iconSource ? (
|
|
312
|
+
<Image
|
|
313
|
+
source={branding.iconSource}
|
|
314
|
+
style={styles.logoImage}
|
|
315
|
+
resizeMode="cover"
|
|
316
|
+
/>
|
|
317
|
+
) : (
|
|
318
|
+
<Text style={styles.logoMark}>{branding.mark}</Text>
|
|
319
|
+
)}
|
|
320
|
+
</View>
|
|
321
|
+
<Text
|
|
322
|
+
style={[
|
|
323
|
+
styles.progressText,
|
|
324
|
+
{ color: colors.progressText },
|
|
325
|
+
]}
|
|
326
|
+
numberOfLines={4}
|
|
327
|
+
accessibilityLiveRegion="polite"
|
|
328
|
+
>
|
|
329
|
+
{userGateWaiting}
|
|
330
|
+
</Text>
|
|
331
|
+
</View>
|
|
332
|
+
<Pressable
|
|
333
|
+
style={[
|
|
334
|
+
styles.doneBtn,
|
|
335
|
+
{ backgroundColor: branding.primaryColor },
|
|
336
|
+
]}
|
|
337
|
+
onPress={() => {
|
|
338
|
+
TaskStore.setUserGateWaiting(t('gate.checking'));
|
|
339
|
+
signalAppUserGateCheck();
|
|
340
|
+
}}
|
|
341
|
+
accessibilityRole="button"
|
|
342
|
+
accessibilityLabel={t('gate.check')}
|
|
343
|
+
hitSlop={6}
|
|
344
|
+
>
|
|
345
|
+
<Text style={styles.doneBtnText}>{t('gate.check')}</Text>
|
|
346
|
+
</Pressable>
|
|
347
|
+
<Pressable
|
|
348
|
+
style={styles.stopBtn}
|
|
349
|
+
onPress={onStop}
|
|
350
|
+
accessibilityRole="button"
|
|
351
|
+
accessibilityLabel={t('progress.stopA11y')}
|
|
352
|
+
hitSlop={6}
|
|
353
|
+
>
|
|
354
|
+
<IconStop size={11} color="#fff" />
|
|
355
|
+
</Pressable>
|
|
356
|
+
</>
|
|
357
|
+
) : (
|
|
358
|
+
<>
|
|
359
|
+
<View
|
|
360
|
+
style={[
|
|
361
|
+
styles.progress,
|
|
362
|
+
{ backgroundColor: colors.progressBg },
|
|
363
|
+
]}
|
|
364
|
+
accessibilityElementsHidden
|
|
365
|
+
importantForAccessibility="no-hide-descendants"
|
|
366
|
+
>
|
|
367
|
+
<View
|
|
368
|
+
style={[
|
|
369
|
+
styles.logo,
|
|
370
|
+
{ backgroundColor: branding.primaryColor },
|
|
371
|
+
]}
|
|
372
|
+
>
|
|
373
|
+
{branding.iconSource ? (
|
|
374
|
+
<Image
|
|
375
|
+
source={branding.iconSource}
|
|
376
|
+
style={styles.logoImage}
|
|
377
|
+
resizeMode="cover"
|
|
378
|
+
/>
|
|
379
|
+
) : (
|
|
380
|
+
<Text style={styles.logoMark}>{branding.mark}</Text>
|
|
381
|
+
)}
|
|
382
|
+
<View style={styles.liveDot} />
|
|
383
|
+
</View>
|
|
384
|
+
<Text
|
|
385
|
+
style={[
|
|
386
|
+
styles.progressText,
|
|
387
|
+
{ color: colors.progressText },
|
|
388
|
+
]}
|
|
389
|
+
numberOfLines={1}
|
|
390
|
+
>
|
|
391
|
+
{subtitle ?? `${branding.name} ${t('progress.running')}`}
|
|
392
|
+
</Text>
|
|
393
|
+
</View>
|
|
394
|
+
<Pressable
|
|
395
|
+
style={styles.stopBtn}
|
|
396
|
+
onPress={onStop}
|
|
397
|
+
accessibilityRole="button"
|
|
398
|
+
accessibilityLabel={t('progress.stopA11y')}
|
|
399
|
+
hitSlop={6}
|
|
400
|
+
>
|
|
401
|
+
<IconStop size={11} color="#fff" />
|
|
402
|
+
</Pressable>
|
|
403
|
+
</>
|
|
404
|
+
)}
|
|
405
|
+
</Animated.View>
|
|
406
|
+
</View>
|
|
407
|
+
) : null}
|
|
408
|
+
</KokoHostOverlay>
|
|
409
|
+
) : null}
|
|
410
|
+
|
|
411
|
+
<KokoChatSheet placeholder={composerPlaceholder} />
|
|
412
|
+
</>
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
function ResultIconBadge({
|
|
417
|
+
flash,
|
|
418
|
+
onPress,
|
|
419
|
+
a11y,
|
|
420
|
+
}: {
|
|
421
|
+
flash: ProgressResultFlash;
|
|
422
|
+
onPress: () => void;
|
|
423
|
+
a11y: string;
|
|
424
|
+
}) {
|
|
425
|
+
const { t } = useKokoUi();
|
|
426
|
+
const scale = useRef(new Animated.Value(0.4)).current;
|
|
427
|
+
const spin = useRef(new Animated.Value(0)).current;
|
|
428
|
+
|
|
429
|
+
useEffect(() => {
|
|
430
|
+
scale.setValue(0.4);
|
|
431
|
+
spin.setValue(0);
|
|
432
|
+
Animated.parallel([
|
|
433
|
+
Animated.spring(scale, {
|
|
434
|
+
toValue: 1,
|
|
435
|
+
friction: 5,
|
|
436
|
+
tension: 140,
|
|
437
|
+
useNativeDriver: true,
|
|
438
|
+
}),
|
|
439
|
+
Animated.timing(spin, {
|
|
440
|
+
toValue: 1,
|
|
441
|
+
duration: flash.status === 'success' ? 320 : 260,
|
|
442
|
+
easing: Easing.out(Easing.cubic),
|
|
443
|
+
useNativeDriver: true,
|
|
444
|
+
}),
|
|
445
|
+
]).start();
|
|
446
|
+
}, [flash.at, flash.status, scale, spin]);
|
|
447
|
+
|
|
448
|
+
const bg =
|
|
449
|
+
flash.status === 'success'
|
|
450
|
+
? '#10B981'
|
|
451
|
+
: flash.status === 'cancelled'
|
|
452
|
+
? '#64748B'
|
|
453
|
+
: '#FF453A';
|
|
454
|
+
const label = t(`progress.${flash.status}`);
|
|
455
|
+
|
|
456
|
+
const rotate = spin.interpolate({
|
|
457
|
+
inputRange: [0, 1],
|
|
458
|
+
outputRange:
|
|
459
|
+
flash.status === 'failed' ? ['-28deg', '0deg'] : ['12deg', '0deg'],
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
return (
|
|
463
|
+
<Pressable
|
|
464
|
+
onPress={onPress}
|
|
465
|
+
accessibilityRole="button"
|
|
466
|
+
accessibilityLabel={`${label}, ${a11y}`}
|
|
467
|
+
hitSlop={8}
|
|
468
|
+
>
|
|
469
|
+
<Animated.View
|
|
470
|
+
style={[
|
|
471
|
+
styles.resultBadge,
|
|
472
|
+
{ backgroundColor: bg, transform: [{ scale }, { rotate }] },
|
|
473
|
+
]}
|
|
474
|
+
>
|
|
475
|
+
{flash.status === 'success' ? (
|
|
476
|
+
<IconCheck size={27} color="#fff" />
|
|
477
|
+
) : flash.status === 'cancelled' ? (
|
|
478
|
+
<IconDash size={24} color="#fff" />
|
|
479
|
+
) : (
|
|
480
|
+
<IconClose size={24} color="#fff" />
|
|
481
|
+
)}
|
|
482
|
+
</Animated.View>
|
|
483
|
+
</Pressable>
|
|
484
|
+
);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
const styles = StyleSheet.create({
|
|
488
|
+
progressWrap: {
|
|
489
|
+
position: 'absolute',
|
|
490
|
+
zIndex: 9999,
|
|
491
|
+
elevation: 9999,
|
|
492
|
+
alignItems: 'flex-end',
|
|
493
|
+
},
|
|
494
|
+
progressRow: {
|
|
495
|
+
flexDirection: 'row',
|
|
496
|
+
alignItems: 'center',
|
|
497
|
+
gap: 8,
|
|
498
|
+
},
|
|
499
|
+
progress: {
|
|
500
|
+
flexDirection: 'row',
|
|
501
|
+
alignItems: 'center',
|
|
502
|
+
maxWidth: 172,
|
|
503
|
+
paddingHorizontal: 9,
|
|
504
|
+
paddingVertical: 7,
|
|
505
|
+
borderRadius: 13,
|
|
506
|
+
backgroundColor: 'rgba(20,20,22,0.94)',
|
|
507
|
+
},
|
|
508
|
+
gateBanner: {
|
|
509
|
+
maxWidth: 220,
|
|
510
|
+
alignItems: 'flex-start',
|
|
511
|
+
},
|
|
512
|
+
doneBtn: {
|
|
513
|
+
paddingHorizontal: 10,
|
|
514
|
+
paddingVertical: 7,
|
|
515
|
+
borderRadius: 11,
|
|
516
|
+
alignItems: 'center',
|
|
517
|
+
justifyContent: 'center',
|
|
518
|
+
},
|
|
519
|
+
doneBtnText: {
|
|
520
|
+
color: '#fff',
|
|
521
|
+
fontSize: 11.5,
|
|
522
|
+
fontWeight: '600',
|
|
523
|
+
},
|
|
524
|
+
resultBadge: {
|
|
525
|
+
width: 66,
|
|
526
|
+
height: 66,
|
|
527
|
+
borderRadius: 33,
|
|
528
|
+
alignItems: 'center',
|
|
529
|
+
justifyContent: 'center',
|
|
530
|
+
shadowColor: '#000',
|
|
531
|
+
shadowOpacity: 0.28,
|
|
532
|
+
shadowRadius: 12,
|
|
533
|
+
shadowOffset: { width: 0, height: 4 },
|
|
534
|
+
elevation: 8,
|
|
535
|
+
},
|
|
536
|
+
logo: {
|
|
537
|
+
width: 20,
|
|
538
|
+
height: 20,
|
|
539
|
+
borderRadius: 6,
|
|
540
|
+
alignItems: 'center',
|
|
541
|
+
justifyContent: 'center',
|
|
542
|
+
marginRight: 7,
|
|
543
|
+
overflow: 'hidden',
|
|
544
|
+
},
|
|
545
|
+
logoImage: {
|
|
546
|
+
width: 20,
|
|
547
|
+
height: 20,
|
|
548
|
+
},
|
|
549
|
+
logoMark: {
|
|
550
|
+
color: '#fff',
|
|
551
|
+
fontSize: 10,
|
|
552
|
+
fontWeight: '800',
|
|
553
|
+
},
|
|
554
|
+
liveDot: {
|
|
555
|
+
position: 'absolute',
|
|
556
|
+
right: -1,
|
|
557
|
+
bottom: -1,
|
|
558
|
+
width: 6,
|
|
559
|
+
height: 6,
|
|
560
|
+
borderRadius: 3,
|
|
561
|
+
backgroundColor: '#34D399',
|
|
562
|
+
borderWidth: 1.2,
|
|
563
|
+
borderColor: 'rgba(20,20,22,0.94)',
|
|
564
|
+
},
|
|
565
|
+
progressText: {
|
|
566
|
+
flexShrink: 1,
|
|
567
|
+
color: '#F5F5F7',
|
|
568
|
+
fontSize: 11.5,
|
|
569
|
+
lineHeight: 15,
|
|
570
|
+
fontWeight: '600',
|
|
571
|
+
},
|
|
572
|
+
stopBtn: {
|
|
573
|
+
width: 30,
|
|
574
|
+
height: 30,
|
|
575
|
+
borderRadius: 12,
|
|
576
|
+
backgroundColor: '#FF453A',
|
|
577
|
+
alignItems: 'center',
|
|
578
|
+
justifyContent: 'center',
|
|
579
|
+
},
|
|
580
|
+
cursor: {
|
|
581
|
+
position: 'absolute',
|
|
582
|
+
width: CURSOR_W,
|
|
583
|
+
height: CURSOR_H,
|
|
584
|
+
left: 0,
|
|
585
|
+
top: 0,
|
|
586
|
+
},
|
|
587
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import { StyleSheet, View, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/** Native dump / tap / screenshot skip views whose testID starts with this. */
|
|
5
|
+
export const KOKO_OVERLAY_TEST_ID = 'koko-agent-overlay';
|
|
6
|
+
/** Cursor layer — skipped in dump, but NOT hidden during tap (must stay visible). */
|
|
7
|
+
export const KOKO_CURSOR_TEST_ID = 'koko-agent-cursor';
|
|
8
|
+
|
|
9
|
+
export type KokoOverlayLayerProps = {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
style?: StyleProp<ViewStyle>;
|
|
12
|
+
/**
|
|
13
|
+
* `box-none` (default): children receive touches; empty area passes through.
|
|
14
|
+
* `none`: entire layer ignores touches (cursor).
|
|
15
|
+
* `auto`: layer blocks (modal sheet content).
|
|
16
|
+
*/
|
|
17
|
+
pointerEvents?: 'box-none' | 'none' | 'auto' | 'box-only';
|
|
18
|
+
/** Override testID / nativeID (default: koko-agent-overlay). */
|
|
19
|
+
testID?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Host for SDK chrome (progress / cursor / sheet / dialogs).
|
|
24
|
+
* Marked so native dump & agent taps can ignore / pierce this layer.
|
|
25
|
+
*/
|
|
26
|
+
export function KokoOverlayLayer({
|
|
27
|
+
children,
|
|
28
|
+
style,
|
|
29
|
+
pointerEvents = 'box-none',
|
|
30
|
+
testID = KOKO_OVERLAY_TEST_ID,
|
|
31
|
+
}: KokoOverlayLayerProps) {
|
|
32
|
+
return (
|
|
33
|
+
<View
|
|
34
|
+
testID={testID}
|
|
35
|
+
nativeID={testID}
|
|
36
|
+
collapsable={false}
|
|
37
|
+
pointerEvents={pointerEvents}
|
|
38
|
+
style={style}
|
|
39
|
+
accessibilityElementsHidden
|
|
40
|
+
importantForAccessibility="no-hide-descendants"
|
|
41
|
+
>
|
|
42
|
+
{children}
|
|
43
|
+
</View>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const overlayFill = StyleSheet.create({
|
|
48
|
+
fill: {
|
|
49
|
+
...StyleSheet.absoluteFillObject,
|
|
50
|
+
zIndex: 9999,
|
|
51
|
+
elevation: 9999,
|
|
52
|
+
},
|
|
53
|
+
});
|