@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,879 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { ActivityIndicator, Alert, Animated, Dimensions, Easing, FlatList, Image, Keyboard, Modal, Platform, Pressable, StatusBar, StyleSheet, Text, TextInput, View } from 'react-native';
|
|
5
|
+
import { useKokoAgent } from "../provider/KokoProvider.js";
|
|
6
|
+
import { useKokoUi } from "../provider/KokoUiContext.js";
|
|
7
|
+
import { TaskStore } from "../task/TaskStore.js";
|
|
8
|
+
import { useTaskStore } from "../task/useTaskStore.js";
|
|
9
|
+
import { useSafeAreaInsetsOptional } from "./safeArea.js";
|
|
10
|
+
import { IconClose, IconStop } from "./icons.js";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
const SHEET_BG_FALLBACK = '#121316';
|
|
13
|
+
const DEFAULT_SHEET_HEIGHT_RATIO = 0.6;
|
|
14
|
+
/** Auto-growing composer: default 1 line, cap at 3. */
|
|
15
|
+
const INPUT_FONT_SIZE = 15;
|
|
16
|
+
const INPUT_LINE_HEIGHT = 22;
|
|
17
|
+
const INPUT_MAX_LINES = 3;
|
|
18
|
+
const INPUT_TEXT_MIN = INPUT_LINE_HEIGHT;
|
|
19
|
+
const INPUT_TEXT_MAX = INPUT_LINE_HEIGHT * INPUT_MAX_LINES;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Estimate height from text + box width.
|
|
23
|
+
* iOS often reports a stuck contentSize when `height` is controlled, so we
|
|
24
|
+
* must not rely on contentSize alone (paste / wrap would never grow).
|
|
25
|
+
*/
|
|
26
|
+
function estimateComposerHeight(value, widthPt) {
|
|
27
|
+
if (!value) return INPUT_TEXT_MIN;
|
|
28
|
+
const paragraphs = value.split('\n');
|
|
29
|
+
if (widthPt <= 0) {
|
|
30
|
+
return Math.min(INPUT_TEXT_MAX, Math.max(INPUT_TEXT_MIN, paragraphs.length * INPUT_LINE_HEIGHT));
|
|
31
|
+
}
|
|
32
|
+
// Slightly narrow so we grow a bit early rather than clip.
|
|
33
|
+
const charsPerLine = Math.max(4, Math.floor(widthPt / (INPUT_FONT_SIZE * 0.95)));
|
|
34
|
+
let lines = 0;
|
|
35
|
+
for (const para of paragraphs) {
|
|
36
|
+
const len = Math.max(1, Array.from(para).length);
|
|
37
|
+
lines += Math.ceil(len / charsPerLine);
|
|
38
|
+
}
|
|
39
|
+
lines = Math.min(INPUT_MAX_LINES, Math.max(1, lines));
|
|
40
|
+
return lines * INPUT_LINE_HEIGHT;
|
|
41
|
+
}
|
|
42
|
+
/** Read the host app's current StatusBar appearance before we override it. */
|
|
43
|
+
function snapshotHostStatusBar() {
|
|
44
|
+
const sb = StatusBar;
|
|
45
|
+
const cur = sb._currentValues ?? sb._defaultProps;
|
|
46
|
+
return {
|
|
47
|
+
barStyle: cur?.barStyle?.value ?? 'default',
|
|
48
|
+
backgroundColor: cur?.backgroundColor?.value != null ? String(cur.backgroundColor.value) : undefined
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const KIND_KEYS = {
|
|
52
|
+
user: 'kind.user',
|
|
53
|
+
plan: 'kind.plan',
|
|
54
|
+
dump: 'kind.dump',
|
|
55
|
+
find: 'kind.find',
|
|
56
|
+
tap: 'kind.tap',
|
|
57
|
+
swipe: 'kind.swipe',
|
|
58
|
+
type: 'kind.type',
|
|
59
|
+
confirm: 'kind.confirm',
|
|
60
|
+
info: 'kind.info',
|
|
61
|
+
error: 'kind.error'
|
|
62
|
+
};
|
|
63
|
+
function formatTime(ts) {
|
|
64
|
+
const d = new Date(ts);
|
|
65
|
+
return `${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}:${String(d.getSeconds()).padStart(2, '0')}`;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Chat sheet: backdrop fades in first, then sheet slides down from the top.
|
|
70
|
+
*/
|
|
71
|
+
export function KokoChatSheet({
|
|
72
|
+
placeholder
|
|
73
|
+
}) {
|
|
74
|
+
const koko = useKokoAgent();
|
|
75
|
+
const {
|
|
76
|
+
branding,
|
|
77
|
+
t,
|
|
78
|
+
colors
|
|
79
|
+
} = useKokoUi();
|
|
80
|
+
const {
|
|
81
|
+
tasks,
|
|
82
|
+
ui,
|
|
83
|
+
activeTaskId
|
|
84
|
+
} = useTaskStore();
|
|
85
|
+
const insets = useSafeAreaInsetsOptional();
|
|
86
|
+
const [text, setText] = useState('');
|
|
87
|
+
const [inputHeight, setInputHeight] = useState(INPUT_TEXT_MIN);
|
|
88
|
+
const [inputWidth, setInputWidth] = useState(0);
|
|
89
|
+
const textRef = useRef('');
|
|
90
|
+
const [busy, setBusy] = useState(false);
|
|
91
|
+
const [mounted, setMounted] = useState(false);
|
|
92
|
+
const backdropOpacity = useRef(new Animated.Value(0)).current;
|
|
93
|
+
// Negative Y = off-screen above; sheet slides down from the top.
|
|
94
|
+
const sheetY = useRef(new Animated.Value(-Dimensions.get('window').height)).current;
|
|
95
|
+
const statusBarEntryRef = useRef(null);
|
|
96
|
+
const hostStatusBarRef = useRef(null);
|
|
97
|
+
const primaryColor = branding.primaryColor;
|
|
98
|
+
const inputPlaceholder = placeholder ?? branding.placeholder;
|
|
99
|
+
const statusMeta = useCallback(status => {
|
|
100
|
+
switch (status) {
|
|
101
|
+
case 'running':
|
|
102
|
+
return {
|
|
103
|
+
color: '#34D399',
|
|
104
|
+
label: t('status.running')
|
|
105
|
+
};
|
|
106
|
+
case 'success':
|
|
107
|
+
return {
|
|
108
|
+
color: '#60A5FA',
|
|
109
|
+
label: t('status.success')
|
|
110
|
+
};
|
|
111
|
+
case 'failed':
|
|
112
|
+
return {
|
|
113
|
+
color: '#F87171',
|
|
114
|
+
label: t('status.failed')
|
|
115
|
+
};
|
|
116
|
+
case 'cancelled':
|
|
117
|
+
return {
|
|
118
|
+
color: '#A1A1AA',
|
|
119
|
+
label: t('status.cancelled')
|
|
120
|
+
};
|
|
121
|
+
default:
|
|
122
|
+
return {
|
|
123
|
+
color: '#A1A1AA',
|
|
124
|
+
label: status
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}, [t]);
|
|
128
|
+
const applySheetStatusBar = useCallback(() => {
|
|
129
|
+
if (statusBarEntryRef.current) return;
|
|
130
|
+
// Record host app status bar before overriding (for restore / debugging).
|
|
131
|
+
hostStatusBarRef.current = snapshotHostStatusBar();
|
|
132
|
+
statusBarEntryRef.current = StatusBar.pushStackEntry({
|
|
133
|
+
animated: true,
|
|
134
|
+
barStyle: colors.statusBar,
|
|
135
|
+
// Colour only. On Android `translucent` is a window flag on the host
|
|
136
|
+
// activity, not something we paint: flipping it relayouts the whole app
|
|
137
|
+
// out from under the status bar and back again, which reads as the host
|
|
138
|
+
// flinching every time the sheet opens. The Modal already draws under
|
|
139
|
+
// the status bar on its own.
|
|
140
|
+
...(Platform.OS === 'android' ? {
|
|
141
|
+
backgroundColor: colors.sheetBg
|
|
142
|
+
} : null)
|
|
143
|
+
});
|
|
144
|
+
}, [colors.sheetBg, colors.statusBar]);
|
|
145
|
+
const restoreHostStatusBar = useCallback(() => {
|
|
146
|
+
if (statusBarEntryRef.current) {
|
|
147
|
+
StatusBar.popStackEntry(statusBarEntryRef.current);
|
|
148
|
+
statusBarEntryRef.current = null;
|
|
149
|
+
} else if (hostStatusBarRef.current) {
|
|
150
|
+
// Fallback if stack entry was lost — re-apply recorded host values.
|
|
151
|
+
const prev = hostStatusBarRef.current;
|
|
152
|
+
StatusBar.setBarStyle(prev.barStyle, true);
|
|
153
|
+
if (Platform.OS === 'android' && prev.backgroundColor != null) {
|
|
154
|
+
StatusBar.setBackgroundColor(prev.backgroundColor, true);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
hostStatusBarRef.current = null;
|
|
158
|
+
}, []);
|
|
159
|
+
|
|
160
|
+
// This sheet hangs from the top, so a keyboard never pushes it anywhere —
|
|
161
|
+
// it just eats the bottom of the screen where the composer lives. The only
|
|
162
|
+
// thing that keeps the input reachable is capping how tall the sheet may
|
|
163
|
+
// grow. KeyboardAvoidingView cannot express that: it assumes bottom-anchored
|
|
164
|
+
// content, and on Android the Modal gets its own window that the system
|
|
165
|
+
// never resizes for the IME, so it is a no-op there anyway.
|
|
166
|
+
const [keyboardHeight, setKeyboardHeight] = useState(0);
|
|
167
|
+
const [rootHeight, setRootHeight] = useState(0);
|
|
168
|
+
const [composerFocused, setComposerFocused] = useState(false);
|
|
169
|
+
useEffect(() => {
|
|
170
|
+
const ios = Platform.OS === 'ios';
|
|
171
|
+
const show = Keyboard.addListener(ios ? 'keyboardWillShow' : 'keyboardDidShow', e => setKeyboardHeight(e.endCoordinates.height));
|
|
172
|
+
const hide = Keyboard.addListener(ios ? 'keyboardWillHide' : 'keyboardDidHide', () => setKeyboardHeight(0));
|
|
173
|
+
return () => {
|
|
174
|
+
show.remove();
|
|
175
|
+
hide.remove();
|
|
176
|
+
};
|
|
177
|
+
}, []);
|
|
178
|
+
const selected = useMemo(() => {
|
|
179
|
+
const id = ui.selectedTaskId ?? activeTaskId ?? tasks[0]?.id;
|
|
180
|
+
return tasks.find(t => t.id === id) ?? null;
|
|
181
|
+
}, [tasks, ui.selectedTaskId, activeTaskId]);
|
|
182
|
+
const running = busy || tasks.some(t => t.id === activeTaskId && t.status === 'running');
|
|
183
|
+
useEffect(() => {
|
|
184
|
+
if (ui.sheetOpen && !ui.selectedTaskId && tasks[0]) {
|
|
185
|
+
TaskStore.setUi({
|
|
186
|
+
selectedTaskId: activeTaskId ?? tasks[0].id
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}, [ui.sheetOpen, ui.selectedTaskId, tasks, activeTaskId]);
|
|
190
|
+
const closeAnimated = useCallback(() => {
|
|
191
|
+
const off = -Dimensions.get('window').height;
|
|
192
|
+
Animated.parallel([Animated.timing(sheetY, {
|
|
193
|
+
toValue: off,
|
|
194
|
+
duration: 260,
|
|
195
|
+
easing: Easing.in(Easing.cubic),
|
|
196
|
+
useNativeDriver: true
|
|
197
|
+
}), Animated.timing(backdropOpacity, {
|
|
198
|
+
toValue: 0,
|
|
199
|
+
duration: 220,
|
|
200
|
+
delay: 80,
|
|
201
|
+
useNativeDriver: true
|
|
202
|
+
})]).start(() => {
|
|
203
|
+
// Always clear sheetOpen — if we only close on finished=true,
|
|
204
|
+
// an interrupted animation leaves sheetOpen stuck true and the
|
|
205
|
+
// sheet can slide back open on remount / Fast Refresh.
|
|
206
|
+
restoreHostStatusBar();
|
|
207
|
+
setMounted(false);
|
|
208
|
+
TaskStore.closeSheet();
|
|
209
|
+
});
|
|
210
|
+
}, [backdropOpacity, sheetY, restoreHostStatusBar]);
|
|
211
|
+
useEffect(() => {
|
|
212
|
+
if (ui.sheetOpen) {
|
|
213
|
+
setMounted(true);
|
|
214
|
+
applySheetStatusBar();
|
|
215
|
+
sheetY.setValue(-Dimensions.get('window').height);
|
|
216
|
+
backdropOpacity.setValue(0);
|
|
217
|
+
// 1) backdrop fade 2) sheet slides down from top
|
|
218
|
+
Animated.sequence([Animated.timing(backdropOpacity, {
|
|
219
|
+
toValue: 1,
|
|
220
|
+
duration: 180,
|
|
221
|
+
easing: Easing.out(Easing.quad),
|
|
222
|
+
useNativeDriver: true
|
|
223
|
+
}), Animated.timing(sheetY, {
|
|
224
|
+
toValue: 0,
|
|
225
|
+
duration: 320,
|
|
226
|
+
easing: Easing.out(Easing.cubic),
|
|
227
|
+
useNativeDriver: true
|
|
228
|
+
})]).start();
|
|
229
|
+
} else if (mounted) {
|
|
230
|
+
restoreHostStatusBar();
|
|
231
|
+
setMounted(false);
|
|
232
|
+
backdropOpacity.setValue(0);
|
|
233
|
+
sheetY.setValue(-Dimensions.get('window').height);
|
|
234
|
+
}
|
|
235
|
+
}, [ui.sheetOpen]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
236
|
+
|
|
237
|
+
useEffect(() => () => restoreHostStatusBar(), [restoreHostStatusBar]);
|
|
238
|
+
const onSend = useCallback(async () => {
|
|
239
|
+
const goal = text.trim();
|
|
240
|
+
if (!goal || running) return;
|
|
241
|
+
setBusy(true);
|
|
242
|
+
setText('');
|
|
243
|
+
textRef.current = '';
|
|
244
|
+
setInputHeight(INPUT_TEXT_MIN);
|
|
245
|
+
// Drop sheet state immediately so a mid-run remount cannot reopen it.
|
|
246
|
+
restoreHostStatusBar();
|
|
247
|
+
setMounted(false);
|
|
248
|
+
TaskStore.closeSheet();
|
|
249
|
+
sheetY.setValue(-Dimensions.get('window').height);
|
|
250
|
+
backdropOpacity.setValue(0);
|
|
251
|
+
// Let host unfreeze + EmptyWallet remount before the first dump.
|
|
252
|
+
await new Promise(r => setTimeout(r, 500));
|
|
253
|
+
try {
|
|
254
|
+
await koko.runGoal(goal);
|
|
255
|
+
} catch {
|
|
256
|
+
// surfaced in task log
|
|
257
|
+
} finally {
|
|
258
|
+
setBusy(false);
|
|
259
|
+
}
|
|
260
|
+
}, [text, running, koko, restoreHostStatusBar, sheetY, backdropOpacity]);
|
|
261
|
+
const onStop = useCallback(() => {
|
|
262
|
+
koko.stop();
|
|
263
|
+
koko.finishTask('cancelled', t('runtime.cancelled'));
|
|
264
|
+
setBusy(false);
|
|
265
|
+
}, [koko, t]);
|
|
266
|
+
const confirmDeleteTask = useCallback(task => {
|
|
267
|
+
const title = task.title.length > 36 ? `${task.title.slice(0, 36)}…` : task.title;
|
|
268
|
+
Alert.alert(t('sheet.deleteTaskTitle'), t('sheet.deleteTaskBody', {
|
|
269
|
+
title
|
|
270
|
+
}), [{
|
|
271
|
+
text: t('dialog.cancel'),
|
|
272
|
+
style: 'cancel'
|
|
273
|
+
}, {
|
|
274
|
+
text: t('sheet.deleteTask'),
|
|
275
|
+
style: 'destructive',
|
|
276
|
+
onPress: () => {
|
|
277
|
+
if (task.status === 'running' && task.id === activeTaskId) {
|
|
278
|
+
koko.stop();
|
|
279
|
+
}
|
|
280
|
+
TaskStore.removeTask(task.id);
|
|
281
|
+
}
|
|
282
|
+
}]);
|
|
283
|
+
}, [t, koko, activeTaskId]);
|
|
284
|
+
if (!mounted && !ui.sheetOpen) return null;
|
|
285
|
+
const topPad = Math.max(insets.top, Platform.OS === 'ios' ? 44 : 24) + 8;
|
|
286
|
+
|
|
287
|
+
// A host whose activity runs in adjustPan never gets a keyboard frame out of
|
|
288
|
+
// Android, and neither does anything drawn inside a Modal's own window. Both
|
|
289
|
+
// are the host's call, not ours, so when the composer has focus and no frame
|
|
290
|
+
// arrived, assume a keyboard of typical size rather than let it swallow the
|
|
291
|
+
// input.
|
|
292
|
+
const screenH = rootHeight || Dimensions.get('window').height;
|
|
293
|
+
const occluded = keyboardHeight > 0 ? keyboardHeight : composerFocused ? screenH * 0.45 : 0;
|
|
294
|
+
// Keep entry, empty and selected-task states at the same default height.
|
|
295
|
+
// Content scrolls inside the sheet; the keyboard may shrink, never grow it.
|
|
296
|
+
const defaultHeight = Math.round(screenH * DEFAULT_SHEET_HEIGHT_RATIO);
|
|
297
|
+
const sheetSize = {
|
|
298
|
+
height: occluded > 0 ? Math.min(defaultHeight, Math.max(screenH * 0.3, screenH - occluded - 8)) : defaultHeight
|
|
299
|
+
};
|
|
300
|
+
return /*#__PURE__*/_jsx(Modal, {
|
|
301
|
+
visible: mounted || ui.sheetOpen,
|
|
302
|
+
animationType: "none",
|
|
303
|
+
transparent: true,
|
|
304
|
+
presentationStyle: "overFullScreen",
|
|
305
|
+
onRequestClose: closeAnimated,
|
|
306
|
+
statusBarTranslucent: true,
|
|
307
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
308
|
+
testID: "koko-agent-overlay",
|
|
309
|
+
nativeID: "koko-agent-overlay",
|
|
310
|
+
collapsable: false,
|
|
311
|
+
style: styles.root,
|
|
312
|
+
onLayout: e => setRootHeight(e.nativeEvent.layout.height),
|
|
313
|
+
children: [/*#__PURE__*/_jsx(Animated.View, {
|
|
314
|
+
pointerEvents: "auto",
|
|
315
|
+
style: [styles.backdrop, {
|
|
316
|
+
opacity: backdropOpacity,
|
|
317
|
+
backgroundColor: colors.overlay
|
|
318
|
+
}],
|
|
319
|
+
children: /*#__PURE__*/_jsx(Pressable, {
|
|
320
|
+
style: StyleSheet.absoluteFill,
|
|
321
|
+
onPress: closeAnimated,
|
|
322
|
+
accessibilityRole: "button",
|
|
323
|
+
accessibilityLabel: t('sheet.closeA11y')
|
|
324
|
+
})
|
|
325
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
326
|
+
style: styles.sheetWrap,
|
|
327
|
+
pointerEvents: "box-none",
|
|
328
|
+
children: /*#__PURE__*/_jsxs(Animated.View, {
|
|
329
|
+
style: [styles.sheet, sheetSize, {
|
|
330
|
+
paddingTop: topPad,
|
|
331
|
+
transform: [{
|
|
332
|
+
translateY: sheetY
|
|
333
|
+
}],
|
|
334
|
+
backgroundColor: colors.sheetBg,
|
|
335
|
+
borderColor: colors.border
|
|
336
|
+
}],
|
|
337
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
338
|
+
style: styles.header,
|
|
339
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
340
|
+
style: styles.brandBlock,
|
|
341
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
342
|
+
style: [styles.brandMark, {
|
|
343
|
+
backgroundColor: primaryColor
|
|
344
|
+
}],
|
|
345
|
+
children: branding.iconSource ? /*#__PURE__*/_jsx(Image, {
|
|
346
|
+
source: branding.iconSource,
|
|
347
|
+
style: styles.brandMarkImage,
|
|
348
|
+
resizeMode: "cover"
|
|
349
|
+
}) : /*#__PURE__*/_jsx(Text, {
|
|
350
|
+
style: styles.brandMarkText,
|
|
351
|
+
children: branding.mark
|
|
352
|
+
})
|
|
353
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
354
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
355
|
+
style: [styles.title, {
|
|
356
|
+
color: colors.text
|
|
357
|
+
}],
|
|
358
|
+
children: branding.name
|
|
359
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
360
|
+
style: [styles.subtitle, {
|
|
361
|
+
color: colors.textSecondary
|
|
362
|
+
}],
|
|
363
|
+
children: branding.tagline
|
|
364
|
+
})]
|
|
365
|
+
})]
|
|
366
|
+
}), /*#__PURE__*/_jsx(Pressable, {
|
|
367
|
+
onPress: closeAnimated,
|
|
368
|
+
hitSlop: 12,
|
|
369
|
+
style: styles.closeBtn,
|
|
370
|
+
accessibilityRole: "button",
|
|
371
|
+
accessibilityLabel: t('sheet.closeA11y'),
|
|
372
|
+
children: /*#__PURE__*/_jsx(IconClose, {
|
|
373
|
+
size: 13,
|
|
374
|
+
color: colors.textSecondary
|
|
375
|
+
})
|
|
376
|
+
})]
|
|
377
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
378
|
+
style: [styles.section, {
|
|
379
|
+
color: colors.textMuted
|
|
380
|
+
}],
|
|
381
|
+
children: t('sheet.recentTasks')
|
|
382
|
+
}), /*#__PURE__*/_jsx(FlatList, {
|
|
383
|
+
horizontal: true,
|
|
384
|
+
data: tasks,
|
|
385
|
+
keyExtractor: t => t.id,
|
|
386
|
+
style: styles.taskStrip,
|
|
387
|
+
contentContainerStyle: styles.taskStripContent,
|
|
388
|
+
showsHorizontalScrollIndicator: false,
|
|
389
|
+
ListEmptyComponent: /*#__PURE__*/_jsx(Text, {
|
|
390
|
+
style: [styles.emptyInline, {
|
|
391
|
+
color: colors.textMuted
|
|
392
|
+
}],
|
|
393
|
+
children: t('sheet.emptyTasks')
|
|
394
|
+
}),
|
|
395
|
+
renderItem: ({
|
|
396
|
+
item
|
|
397
|
+
}) => {
|
|
398
|
+
const selectedRow = item.id === selected?.id;
|
|
399
|
+
const meta = statusMeta(item.status);
|
|
400
|
+
return /*#__PURE__*/_jsxs(Pressable, {
|
|
401
|
+
style: [styles.taskChip, {
|
|
402
|
+
backgroundColor: colors.chipBg,
|
|
403
|
+
borderColor: colors.border
|
|
404
|
+
}, selectedRow && styles.taskChipOn],
|
|
405
|
+
onPress: () => TaskStore.selectTask(item.id),
|
|
406
|
+
onLongPress: () => confirmDeleteTask(item),
|
|
407
|
+
delayLongPress: 380,
|
|
408
|
+
accessibilityRole: "button",
|
|
409
|
+
accessibilityHint: t('sheet.deleteTask'),
|
|
410
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
411
|
+
style: [styles.dot, {
|
|
412
|
+
backgroundColor: meta.color
|
|
413
|
+
}]
|
|
414
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
415
|
+
style: styles.taskChipBody,
|
|
416
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
417
|
+
style: [styles.taskChipText, {
|
|
418
|
+
color: colors.text
|
|
419
|
+
}],
|
|
420
|
+
numberOfLines: 1,
|
|
421
|
+
children: item.title
|
|
422
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
423
|
+
style: [styles.taskChipMeta, {
|
|
424
|
+
color: meta.color
|
|
425
|
+
}],
|
|
426
|
+
children: meta.label
|
|
427
|
+
})]
|
|
428
|
+
})]
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
432
|
+
style: styles.sessionHead,
|
|
433
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
434
|
+
style: [styles.sectionTight, {
|
|
435
|
+
color: colors.textMuted
|
|
436
|
+
}],
|
|
437
|
+
children: t('sheet.timeline')
|
|
438
|
+
}), selected ? /*#__PURE__*/_jsx(Text, {
|
|
439
|
+
style: [styles.sessionHint, {
|
|
440
|
+
color: colors.textSecondary
|
|
441
|
+
}],
|
|
442
|
+
numberOfLines: 1,
|
|
443
|
+
children: selected.title
|
|
444
|
+
}) : null]
|
|
445
|
+
}), /*#__PURE__*/_jsx(FlatList, {
|
|
446
|
+
style: styles.nodeList,
|
|
447
|
+
data: selected?.nodes ?? [],
|
|
448
|
+
keyExtractor: n => n.id,
|
|
449
|
+
contentContainerStyle: (selected?.nodes.length ?? 0) === 0 ? styles.nodeListEmpty : undefined,
|
|
450
|
+
ListEmptyComponent: /*#__PURE__*/_jsxs(View, {
|
|
451
|
+
style: styles.emptyBlock,
|
|
452
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
453
|
+
style: [styles.emptyTitle, {
|
|
454
|
+
color: colors.text
|
|
455
|
+
}],
|
|
456
|
+
children: t('sheet.emptyNodesTitle')
|
|
457
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
458
|
+
style: [styles.emptyHint, {
|
|
459
|
+
color: colors.textMuted
|
|
460
|
+
}],
|
|
461
|
+
children: t('sheet.emptyNodesHint')
|
|
462
|
+
})]
|
|
463
|
+
}),
|
|
464
|
+
renderItem: ({
|
|
465
|
+
item,
|
|
466
|
+
index
|
|
467
|
+
}) => /*#__PURE__*/_jsxs(View, {
|
|
468
|
+
style: styles.nodeRow,
|
|
469
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
470
|
+
style: styles.timeline,
|
|
471
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
472
|
+
style: [styles.timelineDot, {
|
|
473
|
+
backgroundColor: colors.textMuted
|
|
474
|
+
}]
|
|
475
|
+
}), index < (selected?.nodes.length ?? 1) - 1 ? /*#__PURE__*/_jsx(View, {
|
|
476
|
+
style: [styles.timelineLine, {
|
|
477
|
+
backgroundColor: colors.border
|
|
478
|
+
}]
|
|
479
|
+
}) : null]
|
|
480
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
481
|
+
style: styles.nodeBody,
|
|
482
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
483
|
+
style: styles.nodeTop,
|
|
484
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
485
|
+
style: [styles.nodeKind, {
|
|
486
|
+
color: colors.textMuted
|
|
487
|
+
}],
|
|
488
|
+
children: t(KIND_KEYS[item.kind])
|
|
489
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
490
|
+
style: [styles.nodeTime, {
|
|
491
|
+
color: colors.textMuted
|
|
492
|
+
}],
|
|
493
|
+
children: formatTime(item.createdAt)
|
|
494
|
+
})]
|
|
495
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
496
|
+
style: [styles.nodeTitle, {
|
|
497
|
+
color: colors.text
|
|
498
|
+
}],
|
|
499
|
+
children: item.title
|
|
500
|
+
})]
|
|
501
|
+
})]
|
|
502
|
+
})
|
|
503
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
504
|
+
style: styles.composer,
|
|
505
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
506
|
+
style: [styles.inputWrap, {
|
|
507
|
+
backgroundColor: colors.inputBg,
|
|
508
|
+
borderColor: colors.border
|
|
509
|
+
}],
|
|
510
|
+
onLayout: e => {
|
|
511
|
+
const w = Math.round(e.nativeEvent.layout.width);
|
|
512
|
+
if (w > 0 && w !== inputWidth) {
|
|
513
|
+
setInputWidth(w);
|
|
514
|
+
setInputHeight(estimateComposerHeight(textRef.current, w));
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
children: /*#__PURE__*/_jsx(TextInput, {
|
|
518
|
+
style: [styles.input, {
|
|
519
|
+
minHeight: INPUT_TEXT_MIN,
|
|
520
|
+
height: inputHeight,
|
|
521
|
+
maxHeight: INPUT_TEXT_MAX,
|
|
522
|
+
color: colors.text
|
|
523
|
+
}],
|
|
524
|
+
value: text,
|
|
525
|
+
onChangeText: v => {
|
|
526
|
+
textRef.current = v;
|
|
527
|
+
setText(v);
|
|
528
|
+
setInputHeight(estimateComposerHeight(v, inputWidth));
|
|
529
|
+
},
|
|
530
|
+
onContentSizeChange: e => {
|
|
531
|
+
const v = textRef.current;
|
|
532
|
+
if (!v) {
|
|
533
|
+
setInputHeight(INPUT_TEXT_MIN);
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
const estimated = estimateComposerHeight(v, inputWidth);
|
|
537
|
+
const raw = e.nativeEvent.contentSize.height;
|
|
538
|
+
const fromSize = raw > INPUT_LINE_HEIGHT + 8 ? Math.min(INPUT_TEXT_MAX, Math.max(INPUT_TEXT_MIN, Math.ceil(raw))) : INPUT_TEXT_MIN;
|
|
539
|
+
const next = Math.max(estimated, fromSize);
|
|
540
|
+
setInputHeight(prev => prev === next ? prev : next);
|
|
541
|
+
},
|
|
542
|
+
placeholder: inputPlaceholder,
|
|
543
|
+
placeholderTextColor: colors.textMuted,
|
|
544
|
+
editable: !running,
|
|
545
|
+
multiline: true,
|
|
546
|
+
scrollEnabled: inputHeight >= INPUT_TEXT_MAX - 1,
|
|
547
|
+
textAlignVertical: "top",
|
|
548
|
+
blurOnSubmit: false,
|
|
549
|
+
onFocus: () => setComposerFocused(true),
|
|
550
|
+
onBlur: () => setComposerFocused(false),
|
|
551
|
+
accessibilityLabel: t('sheet.inputA11y')
|
|
552
|
+
})
|
|
553
|
+
}), running ? /*#__PURE__*/_jsx(Pressable, {
|
|
554
|
+
style: [styles.btn, styles.btnStop, styles.btnIcon],
|
|
555
|
+
onPress: onStop,
|
|
556
|
+
accessibilityRole: "button",
|
|
557
|
+
accessibilityLabel: t('sheet.stopA11y'),
|
|
558
|
+
children: /*#__PURE__*/_jsx(IconStop, {
|
|
559
|
+
size: 12,
|
|
560
|
+
color: "#fff"
|
|
561
|
+
})
|
|
562
|
+
}) : /*#__PURE__*/_jsx(Pressable, {
|
|
563
|
+
style: [styles.btn, styles.btnSend, {
|
|
564
|
+
backgroundColor: primaryColor
|
|
565
|
+
}, !text.trim() && styles.btnDisabled],
|
|
566
|
+
onPress: onSend,
|
|
567
|
+
disabled: !text.trim(),
|
|
568
|
+
children: busy ? /*#__PURE__*/_jsx(ActivityIndicator, {
|
|
569
|
+
color: "#fff"
|
|
570
|
+
}) : /*#__PURE__*/_jsx(Text, {
|
|
571
|
+
style: styles.btnText,
|
|
572
|
+
children: t('sheet.send')
|
|
573
|
+
})
|
|
574
|
+
})]
|
|
575
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
576
|
+
style: [styles.handle, {
|
|
577
|
+
backgroundColor: colors.handle
|
|
578
|
+
}]
|
|
579
|
+
})]
|
|
580
|
+
})
|
|
581
|
+
})]
|
|
582
|
+
})
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
const styles = StyleSheet.create({
|
|
586
|
+
root: {
|
|
587
|
+
flex: 1,
|
|
588
|
+
justifyContent: 'flex-start'
|
|
589
|
+
},
|
|
590
|
+
backdrop: {
|
|
591
|
+
...StyleSheet.absoluteFillObject,
|
|
592
|
+
zIndex: 0
|
|
593
|
+
},
|
|
594
|
+
sheetWrap: {
|
|
595
|
+
flex: 1,
|
|
596
|
+
justifyContent: 'flex-start',
|
|
597
|
+
zIndex: 1
|
|
598
|
+
},
|
|
599
|
+
sheet: {
|
|
600
|
+
// Definite height above bounds the flexible, scrolling step list.
|
|
601
|
+
backgroundColor: SHEET_BG_FALLBACK,
|
|
602
|
+
borderBottomLeftRadius: 22,
|
|
603
|
+
borderBottomRightRadius: 22,
|
|
604
|
+
paddingHorizontal: 16,
|
|
605
|
+
paddingBottom: 10,
|
|
606
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
607
|
+
borderColor: 'rgba(255,255,255,0.08)',
|
|
608
|
+
borderTopWidth: 0
|
|
609
|
+
},
|
|
610
|
+
handle: {
|
|
611
|
+
alignSelf: 'center',
|
|
612
|
+
width: 40,
|
|
613
|
+
height: 4,
|
|
614
|
+
borderRadius: 2,
|
|
615
|
+
backgroundColor: 'rgba(255,255,255,0.22)',
|
|
616
|
+
marginTop: 12
|
|
617
|
+
},
|
|
618
|
+
header: {
|
|
619
|
+
flexDirection: 'row',
|
|
620
|
+
alignItems: 'center',
|
|
621
|
+
justifyContent: 'space-between',
|
|
622
|
+
marginBottom: 18
|
|
623
|
+
},
|
|
624
|
+
brandBlock: {
|
|
625
|
+
flexDirection: 'row',
|
|
626
|
+
alignItems: 'center',
|
|
627
|
+
gap: 12,
|
|
628
|
+
flexShrink: 1
|
|
629
|
+
},
|
|
630
|
+
brandMark: {
|
|
631
|
+
width: 36,
|
|
632
|
+
height: 36,
|
|
633
|
+
borderRadius: 10,
|
|
634
|
+
backgroundColor: '#0A84FF',
|
|
635
|
+
alignItems: 'center',
|
|
636
|
+
justifyContent: 'center',
|
|
637
|
+
overflow: 'hidden'
|
|
638
|
+
},
|
|
639
|
+
brandMarkImage: {
|
|
640
|
+
width: 36,
|
|
641
|
+
height: 36
|
|
642
|
+
},
|
|
643
|
+
brandMarkText: {
|
|
644
|
+
color: '#fff',
|
|
645
|
+
fontSize: 17,
|
|
646
|
+
fontWeight: '800'
|
|
647
|
+
},
|
|
648
|
+
title: {
|
|
649
|
+
color: '#F4F4F5',
|
|
650
|
+
fontSize: 18,
|
|
651
|
+
fontWeight: '800',
|
|
652
|
+
letterSpacing: -0.3
|
|
653
|
+
},
|
|
654
|
+
subtitle: {
|
|
655
|
+
color: 'rgba(255,255,255,0.42)',
|
|
656
|
+
fontSize: 12,
|
|
657
|
+
marginTop: 2
|
|
658
|
+
},
|
|
659
|
+
closeBtn: {
|
|
660
|
+
width: 32,
|
|
661
|
+
height: 32,
|
|
662
|
+
borderRadius: 10,
|
|
663
|
+
backgroundColor: 'rgba(255,255,255,0.06)',
|
|
664
|
+
alignItems: 'center',
|
|
665
|
+
justifyContent: 'center'
|
|
666
|
+
},
|
|
667
|
+
section: {
|
|
668
|
+
color: 'rgba(255,255,255,0.38)',
|
|
669
|
+
fontSize: 11,
|
|
670
|
+
fontWeight: '700',
|
|
671
|
+
letterSpacing: 0.6,
|
|
672
|
+
textTransform: 'uppercase',
|
|
673
|
+
marginBottom: 10
|
|
674
|
+
},
|
|
675
|
+
sectionTight: {
|
|
676
|
+
color: 'rgba(255,255,255,0.38)',
|
|
677
|
+
fontSize: 11,
|
|
678
|
+
fontWeight: '700',
|
|
679
|
+
letterSpacing: 0.6,
|
|
680
|
+
textTransform: 'uppercase'
|
|
681
|
+
},
|
|
682
|
+
taskStrip: {
|
|
683
|
+
maxHeight: 64,
|
|
684
|
+
// The sheet shrinks to fit above the keyboard; without this the strip
|
|
685
|
+
// gives way first and clips its chips instead of the step list scrolling.
|
|
686
|
+
flexGrow: 0,
|
|
687
|
+
flexShrink: 0,
|
|
688
|
+
marginBottom: 16
|
|
689
|
+
},
|
|
690
|
+
taskStripContent: {
|
|
691
|
+
alignItems: 'center',
|
|
692
|
+
paddingRight: 8
|
|
693
|
+
},
|
|
694
|
+
taskChip: {
|
|
695
|
+
flexDirection: 'row',
|
|
696
|
+
alignItems: 'center',
|
|
697
|
+
paddingHorizontal: 12,
|
|
698
|
+
paddingVertical: 10,
|
|
699
|
+
borderRadius: 14,
|
|
700
|
+
backgroundColor: 'rgba(255,255,255,0.05)',
|
|
701
|
+
marginRight: 8,
|
|
702
|
+
maxWidth: 200,
|
|
703
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
704
|
+
borderColor: 'rgba(255,255,255,0.06)'
|
|
705
|
+
},
|
|
706
|
+
taskChipOn: {
|
|
707
|
+
backgroundColor: 'rgba(10,132,255,0.18)',
|
|
708
|
+
borderColor: 'rgba(10,132,255,0.35)'
|
|
709
|
+
},
|
|
710
|
+
taskChipBody: {
|
|
711
|
+
flexShrink: 1
|
|
712
|
+
},
|
|
713
|
+
taskChipText: {
|
|
714
|
+
color: '#F4F4F5',
|
|
715
|
+
fontSize: 13,
|
|
716
|
+
fontWeight: '600'
|
|
717
|
+
},
|
|
718
|
+
taskChipMeta: {
|
|
719
|
+
fontSize: 10,
|
|
720
|
+
fontWeight: '600',
|
|
721
|
+
marginTop: 2
|
|
722
|
+
},
|
|
723
|
+
emptyInline: {
|
|
724
|
+
color: 'rgba(255,255,255,0.35)',
|
|
725
|
+
fontSize: 13,
|
|
726
|
+
paddingVertical: 12
|
|
727
|
+
},
|
|
728
|
+
sessionHead: {
|
|
729
|
+
flexDirection: 'row',
|
|
730
|
+
alignItems: 'baseline',
|
|
731
|
+
justifyContent: 'space-between',
|
|
732
|
+
gap: 12,
|
|
733
|
+
marginBottom: 10
|
|
734
|
+
},
|
|
735
|
+
sessionHint: {
|
|
736
|
+
flexShrink: 1,
|
|
737
|
+
color: 'rgba(255,255,255,0.35)',
|
|
738
|
+
fontSize: 12
|
|
739
|
+
},
|
|
740
|
+
nodeList: {
|
|
741
|
+
flexGrow: 1,
|
|
742
|
+
flexShrink: 1,
|
|
743
|
+
minHeight: 0,
|
|
744
|
+
maxHeight: Math.round(Dimensions.get('window').height * 0.42),
|
|
745
|
+
marginBottom: 14
|
|
746
|
+
},
|
|
747
|
+
nodeListEmpty: {
|
|
748
|
+
minHeight: 120,
|
|
749
|
+
justifyContent: 'center'
|
|
750
|
+
},
|
|
751
|
+
emptyBlock: {
|
|
752
|
+
alignItems: 'center',
|
|
753
|
+
paddingVertical: 28,
|
|
754
|
+
paddingHorizontal: 20
|
|
755
|
+
},
|
|
756
|
+
emptyTitle: {
|
|
757
|
+
color: 'rgba(255,255,255,0.55)',
|
|
758
|
+
fontSize: 15,
|
|
759
|
+
fontWeight: '600',
|
|
760
|
+
marginBottom: 6
|
|
761
|
+
},
|
|
762
|
+
emptyHint: {
|
|
763
|
+
color: 'rgba(255,255,255,0.32)',
|
|
764
|
+
fontSize: 13,
|
|
765
|
+
textAlign: 'center',
|
|
766
|
+
lineHeight: 18
|
|
767
|
+
},
|
|
768
|
+
nodeRow: {
|
|
769
|
+
flexDirection: 'row',
|
|
770
|
+
paddingBottom: 4
|
|
771
|
+
},
|
|
772
|
+
timeline: {
|
|
773
|
+
width: 16,
|
|
774
|
+
alignItems: 'center',
|
|
775
|
+
marginRight: 10
|
|
776
|
+
},
|
|
777
|
+
timelineDot: {
|
|
778
|
+
width: 7,
|
|
779
|
+
height: 7,
|
|
780
|
+
borderRadius: 4,
|
|
781
|
+
backgroundColor: '#0A84FF',
|
|
782
|
+
marginTop: 5
|
|
783
|
+
},
|
|
784
|
+
timelineLine: {
|
|
785
|
+
width: 1,
|
|
786
|
+
flex: 1,
|
|
787
|
+
backgroundColor: 'rgba(255,255,255,0.1)',
|
|
788
|
+
marginTop: 4,
|
|
789
|
+
marginBottom: 2
|
|
790
|
+
},
|
|
791
|
+
nodeBody: {
|
|
792
|
+
flex: 1,
|
|
793
|
+
paddingBottom: 14
|
|
794
|
+
},
|
|
795
|
+
nodeTop: {
|
|
796
|
+
flexDirection: 'row',
|
|
797
|
+
alignItems: 'center',
|
|
798
|
+
justifyContent: 'space-between',
|
|
799
|
+
marginBottom: 3
|
|
800
|
+
},
|
|
801
|
+
nodeKind: {
|
|
802
|
+
color: '#7DD3FC',
|
|
803
|
+
fontSize: 10,
|
|
804
|
+
fontWeight: '700',
|
|
805
|
+
letterSpacing: 0.3
|
|
806
|
+
},
|
|
807
|
+
nodeTime: {
|
|
808
|
+
color: 'rgba(255,255,255,0.28)',
|
|
809
|
+
fontSize: 11,
|
|
810
|
+
fontVariant: ['tabular-nums']
|
|
811
|
+
},
|
|
812
|
+
nodeTitle: {
|
|
813
|
+
color: '#ECECF0',
|
|
814
|
+
fontSize: 14,
|
|
815
|
+
lineHeight: 20
|
|
816
|
+
},
|
|
817
|
+
dot: {
|
|
818
|
+
width: 7,
|
|
819
|
+
height: 7,
|
|
820
|
+
borderRadius: 4,
|
|
821
|
+
marginRight: 8
|
|
822
|
+
},
|
|
823
|
+
composer: {
|
|
824
|
+
flexShrink: 0,
|
|
825
|
+
flexDirection: 'row',
|
|
826
|
+
alignItems: 'flex-end',
|
|
827
|
+
gap: 8,
|
|
828
|
+
backgroundColor: 'rgba(255,255,255,0.06)',
|
|
829
|
+
borderRadius: 16,
|
|
830
|
+
paddingLeft: 14,
|
|
831
|
+
paddingRight: 10,
|
|
832
|
+
paddingVertical: 6,
|
|
833
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
834
|
+
borderColor: 'rgba(255,255,255,0.08)'
|
|
835
|
+
},
|
|
836
|
+
inputWrap: {
|
|
837
|
+
flex: 1,
|
|
838
|
+
paddingVertical: 8,
|
|
839
|
+
paddingHorizontal: 6,
|
|
840
|
+
justifyContent: 'center'
|
|
841
|
+
},
|
|
842
|
+
input: {
|
|
843
|
+
width: '100%',
|
|
844
|
+
color: '#F4F4F5',
|
|
845
|
+
fontSize: INPUT_FONT_SIZE,
|
|
846
|
+
lineHeight: INPUT_LINE_HEIGHT,
|
|
847
|
+
paddingHorizontal: 2,
|
|
848
|
+
paddingVertical: 0,
|
|
849
|
+
margin: 0
|
|
850
|
+
},
|
|
851
|
+
btn: {
|
|
852
|
+
minWidth: 68,
|
|
853
|
+
paddingHorizontal: 14,
|
|
854
|
+
paddingVertical: 11,
|
|
855
|
+
borderRadius: 12,
|
|
856
|
+
alignItems: 'center',
|
|
857
|
+
justifyContent: 'center',
|
|
858
|
+
marginBottom: 2
|
|
859
|
+
},
|
|
860
|
+
btnIcon: {
|
|
861
|
+
minWidth: 44,
|
|
862
|
+
paddingHorizontal: 12
|
|
863
|
+
},
|
|
864
|
+
btnSend: {
|
|
865
|
+
backgroundColor: '#0A84FF'
|
|
866
|
+
},
|
|
867
|
+
btnStop: {
|
|
868
|
+
backgroundColor: '#FF453A'
|
|
869
|
+
},
|
|
870
|
+
btnDisabled: {
|
|
871
|
+
opacity: 0.4
|
|
872
|
+
},
|
|
873
|
+
btnText: {
|
|
874
|
+
color: '#fff',
|
|
875
|
+
fontWeight: '700',
|
|
876
|
+
fontSize: 14
|
|
877
|
+
}
|
|
878
|
+
});
|
|
879
|
+
//# sourceMappingURL=KokoChatSheet.js.map
|