@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,387 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ObserverUiState,
|
|
3
|
+
ProgressResultFlash,
|
|
4
|
+
Task,
|
|
5
|
+
TaskNode,
|
|
6
|
+
TaskNodeKind,
|
|
7
|
+
TaskNodeStatus,
|
|
8
|
+
TaskStatus,
|
|
9
|
+
TaskStoreSnapshot,
|
|
10
|
+
} from './types';
|
|
11
|
+
import { UsageBus } from '../commercial/UsageBus';
|
|
12
|
+
import { HostAppearanceStore } from '../provider/HostAppearanceStore';
|
|
13
|
+
import { message, resolveText, runtimeText, type LocalizedText, type LocalizedMessage } from '../i18n';
|
|
14
|
+
|
|
15
|
+
type Listener = (snap: TaskStoreSnapshot) => void;
|
|
16
|
+
|
|
17
|
+
function uid(prefix: string): string {
|
|
18
|
+
return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const MAX_TASKS = 40;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* In-memory task + node history for the observer UI.
|
|
25
|
+
*/
|
|
26
|
+
export class TaskStoreImpl {
|
|
27
|
+
private tasks: Task[] = [];
|
|
28
|
+
private activeTaskId: string | null = null;
|
|
29
|
+
private resultFlash: ProgressResultFlash | null = null;
|
|
30
|
+
private userGateWaiting: LocalizedText | null = null;
|
|
31
|
+
private localizedTitles = new Map<string, LocalizedMessage>();
|
|
32
|
+
private localizedTaskTitles = new Map<string, LocalizedMessage>();
|
|
33
|
+
private localizedResult: LocalizedMessage | null = null;
|
|
34
|
+
private unsubscribeAppearance: (() => void) | null = null;
|
|
35
|
+
private appearanceChanged = false;
|
|
36
|
+
private lastChromeLiftAt = 0;
|
|
37
|
+
private ui: ObserverUiState = {
|
|
38
|
+
sheetOpen: false,
|
|
39
|
+
selectedTaskId: null,
|
|
40
|
+
chromeSuppressed: false,
|
|
41
|
+
chromeEpoch: 0,
|
|
42
|
+
};
|
|
43
|
+
private listeners = new Set<Listener>();
|
|
44
|
+
|
|
45
|
+
subscribe(listener: Listener): () => void {
|
|
46
|
+
this.listeners.add(listener);
|
|
47
|
+
if (!this.unsubscribeAppearance) {
|
|
48
|
+
let locale = HostAppearanceStore.get().locale;
|
|
49
|
+
this.unsubscribeAppearance = HostAppearanceStore.subscribe(() => {
|
|
50
|
+
const next = HostAppearanceStore.get().locale;
|
|
51
|
+
if (next !== locale && this.activeTaskId) this.appearanceChanged = true;
|
|
52
|
+
locale = next;
|
|
53
|
+
this.emit();
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
listener(this.snapshot());
|
|
57
|
+
return () => {
|
|
58
|
+
this.listeners.delete(listener);
|
|
59
|
+
if (!this.listeners.size) {
|
|
60
|
+
this.unsubscribeAppearance?.();
|
|
61
|
+
this.unsubscribeAppearance = null;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
snapshot(): TaskStoreSnapshot {
|
|
67
|
+
const tasks = this.tasks.map(task => ({
|
|
68
|
+
...task,
|
|
69
|
+
title: this.localizedTaskTitles.has(task.id) ? resolveText(this.localizedTaskTitles.get(task.id)!) : task.title,
|
|
70
|
+
nodes: task.nodes.map(node => {
|
|
71
|
+
const copy = this.localizedTitles.get(node.id);
|
|
72
|
+
return copy ? { ...node, title: resolveText(copy) } : node;
|
|
73
|
+
}),
|
|
74
|
+
}));
|
|
75
|
+
return {
|
|
76
|
+
tasks,
|
|
77
|
+
activeTaskId: this.activeTaskId,
|
|
78
|
+
subtitle: this.computeSubtitle(tasks),
|
|
79
|
+
resultFlash: this.resultFlash && this.localizedResult
|
|
80
|
+
? { ...this.resultFlash, message: resolveText(this.localizedResult).slice(0, 80) }
|
|
81
|
+
: this.resultFlash,
|
|
82
|
+
userGateWaiting: this.userGateWaiting ? resolveText(this.userGateWaiting) : null,
|
|
83
|
+
ui: { ...this.ui },
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private emit() {
|
|
88
|
+
const snap = this.snapshot();
|
|
89
|
+
for (const l of this.listeners) l(snap);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private computeSubtitle(tasks: Task[]): string | null {
|
|
93
|
+
if (this.userGateWaiting) return resolveText(this.userGateWaiting);
|
|
94
|
+
const active = tasks.find((t) => t.id === this.activeTaskId);
|
|
95
|
+
if (!active || active.status !== 'running') return null;
|
|
96
|
+
const running = [...active.nodes]
|
|
97
|
+
.reverse()
|
|
98
|
+
.find((n) => n.status === 'running' && n.kind !== 'dump');
|
|
99
|
+
if (running) return this.appearanceChanged && !this.localizedTitles.has(running.id)
|
|
100
|
+
? runtimeText('progress.running') : running.title;
|
|
101
|
+
const last = [...active.nodes]
|
|
102
|
+
.reverse()
|
|
103
|
+
.find((n) => n.kind !== 'dump');
|
|
104
|
+
if (last) return this.appearanceChanged && !this.localizedTitles.has(last.id)
|
|
105
|
+
? runtimeText('progress.running') : last.title;
|
|
106
|
+
return active.title;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Pause chrome copy while waiting for App password/PIN/OTP. */
|
|
110
|
+
setUserGateWaiting(message: LocalizedText | null) {
|
|
111
|
+
this.userGateWaiting = message;
|
|
112
|
+
this.appearanceChanged = false;
|
|
113
|
+
this.emit();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
setUi(patch: Partial<ObserverUiState>) {
|
|
117
|
+
this.ui = { ...this.ui, ...patch };
|
|
118
|
+
this.emit();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Open chat sheet (history + input). */
|
|
122
|
+
openSheet(taskId?: string | null) {
|
|
123
|
+
const selected =
|
|
124
|
+
taskId !== undefined
|
|
125
|
+
? taskId
|
|
126
|
+
: this.activeTaskId ?? this.tasks[0]?.id ?? null;
|
|
127
|
+
const wasOpen = this.ui.sheetOpen;
|
|
128
|
+
this.setUi({ sheetOpen: true, selectedTaskId: selected });
|
|
129
|
+
if (!wasOpen) {
|
|
130
|
+
UsageBus.emit({ type: 'sheet_opened', at: Date.now() });
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
closeSheet() {
|
|
135
|
+
const wasOpen = this.ui.sheetOpen;
|
|
136
|
+
this.setUi({ sheetOpen: false });
|
|
137
|
+
if (wasOpen) {
|
|
138
|
+
UsageBus.emit({ type: 'sheet_closed', at: Date.now() });
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
toggleSheet() {
|
|
143
|
+
if (this.ui.sheetOpen) this.closeSheet();
|
|
144
|
+
else this.openSheet();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** Hide progress chrome for one agent gesture that would hit it. */
|
|
148
|
+
suppressChrome() {
|
|
149
|
+
if (this.ui.chromeSuppressed) return;
|
|
150
|
+
this.setUi({ chromeSuppressed: true });
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
restoreChrome() {
|
|
154
|
+
if (!this.ui.chromeSuppressed) return;
|
|
155
|
+
this.setUi({ chromeSuppressed: false });
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Remount progress Modal so it stacks above a host Settings/sheet Modal.
|
|
160
|
+
* Throttled to avoid flicker during rapid taps.
|
|
161
|
+
*/
|
|
162
|
+
liftChrome() {
|
|
163
|
+
const now = Date.now();
|
|
164
|
+
if (now - this.lastChromeLiftAt < 450) return;
|
|
165
|
+
this.lastChromeLiftAt = now;
|
|
166
|
+
this.setUi({ chromeEpoch: (this.ui.chromeEpoch ?? 0) + 1 });
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** @deprecated use closeSheet */
|
|
170
|
+
hide() {
|
|
171
|
+
this.closeSheet();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** @deprecated use openSheet */
|
|
175
|
+
show() {
|
|
176
|
+
this.openSheet();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
selectTask(taskId: string | null) {
|
|
180
|
+
this.setUi({
|
|
181
|
+
selectedTaskId: taskId,
|
|
182
|
+
sheetOpen: true,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Remove a task from recent history (and clear selection if needed). */
|
|
187
|
+
removeTask(taskId: string) {
|
|
188
|
+
const existed = this.tasks.some((t) => t.id === taskId);
|
|
189
|
+
if (!existed) return;
|
|
190
|
+
this.tasks = this.tasks.filter((t) => t.id !== taskId);
|
|
191
|
+
if (this.activeTaskId === taskId) {
|
|
192
|
+
this.activeTaskId = this.tasks[0]?.id ?? null;
|
|
193
|
+
}
|
|
194
|
+
if (this.ui.selectedTaskId === taskId) {
|
|
195
|
+
this.ui = {
|
|
196
|
+
...this.ui,
|
|
197
|
+
selectedTaskId: this.activeTaskId ?? this.tasks[0]?.id ?? null,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
if (this.resultFlash?.taskId === taskId) {
|
|
201
|
+
this.resultFlash = null;
|
|
202
|
+
}
|
|
203
|
+
this.emit();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
startTask(title: string): Task {
|
|
207
|
+
this.appearanceChanged = false;
|
|
208
|
+
const task: Task = {
|
|
209
|
+
id: uid('task'),
|
|
210
|
+
title,
|
|
211
|
+
status: 'running',
|
|
212
|
+
createdAt: Date.now(),
|
|
213
|
+
updatedAt: Date.now(),
|
|
214
|
+
nodes: [
|
|
215
|
+
{
|
|
216
|
+
id: uid('node'),
|
|
217
|
+
kind: 'user',
|
|
218
|
+
title,
|
|
219
|
+
status: 'done',
|
|
220
|
+
createdAt: Date.now(),
|
|
221
|
+
finishedAt: Date.now(),
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
};
|
|
225
|
+
this.tasks = [task, ...this.tasks].slice(0, MAX_TASKS);
|
|
226
|
+
this.activeTaskId = task.id;
|
|
227
|
+
this.resultFlash = null;
|
|
228
|
+
this.localizedResult = null;
|
|
229
|
+
// Progress pill only — do not auto-open sheet
|
|
230
|
+
this.ui = {
|
|
231
|
+
...this.ui,
|
|
232
|
+
selectedTaskId: task.id,
|
|
233
|
+
};
|
|
234
|
+
this.emit();
|
|
235
|
+
return task;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
ensureActiveTask(fallbackTitle?: string): string {
|
|
239
|
+
if (
|
|
240
|
+
this.activeTaskId &&
|
|
241
|
+
this.tasks.some((t) => t.id === this.activeTaskId && t.status === 'running')
|
|
242
|
+
) {
|
|
243
|
+
return this.activeTaskId;
|
|
244
|
+
}
|
|
245
|
+
const task = this.startTask(fallbackTitle ?? runtimeText('runtime.defaultTask'));
|
|
246
|
+
if (fallbackTitle === undefined) {
|
|
247
|
+
const copy = message('runtime.defaultTask');
|
|
248
|
+
this.localizedTaskTitles.set(task.id, copy);
|
|
249
|
+
this.localizedTitles.set(task.nodes[0].id, copy);
|
|
250
|
+
}
|
|
251
|
+
return task.id;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
appendNode(input: {
|
|
255
|
+
kind: TaskNodeKind;
|
|
256
|
+
title: LocalizedText;
|
|
257
|
+
detail?: string;
|
|
258
|
+
status?: TaskNodeStatus;
|
|
259
|
+
taskId?: string;
|
|
260
|
+
}): TaskNode {
|
|
261
|
+
this.appearanceChanged = false;
|
|
262
|
+
const taskId = input.taskId ?? this.ensureActiveTask(resolveText(input.title));
|
|
263
|
+
const node: TaskNode = {
|
|
264
|
+
id: uid('node'),
|
|
265
|
+
kind: input.kind,
|
|
266
|
+
title: resolveText(input.title),
|
|
267
|
+
detail: input.detail,
|
|
268
|
+
status: input.status ?? 'running',
|
|
269
|
+
createdAt: Date.now(),
|
|
270
|
+
finishedAt:
|
|
271
|
+
input.status === 'done' || input.status === 'failed' ? Date.now() : undefined,
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
if (typeof input.title !== 'string') this.localizedTitles.set(node.id, input.title);
|
|
275
|
+
this.tasks = this.tasks.map((t) => {
|
|
276
|
+
if (t.id !== taskId) return t;
|
|
277
|
+
return {
|
|
278
|
+
...t,
|
|
279
|
+
updatedAt: Date.now(),
|
|
280
|
+
nodes: [...t.nodes, node],
|
|
281
|
+
};
|
|
282
|
+
});
|
|
283
|
+
this.activeTaskId = taskId;
|
|
284
|
+
this.emit();
|
|
285
|
+
return node;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
updateNode(nodeId: string, patch: Partial<Pick<TaskNode, 'detail' | 'status'>> & { title?: LocalizedText }) {
|
|
289
|
+
if (patch.title !== undefined) {
|
|
290
|
+
this.appearanceChanged = false;
|
|
291
|
+
if (typeof patch.title === 'string') this.localizedTitles.delete(nodeId);
|
|
292
|
+
else this.localizedTitles.set(nodeId, patch.title);
|
|
293
|
+
}
|
|
294
|
+
const resolvedPatch = { ...patch, ...(patch.title !== undefined ? { title: resolveText(patch.title) } : {}) } as Partial<TaskNode>;
|
|
295
|
+
this.tasks = this.tasks.map((t) => ({
|
|
296
|
+
...t,
|
|
297
|
+
nodes: t.nodes.map((n) => {
|
|
298
|
+
if (n.id !== nodeId) return n;
|
|
299
|
+
const status = patch.status ?? n.status;
|
|
300
|
+
return {
|
|
301
|
+
...n,
|
|
302
|
+
...resolvedPatch,
|
|
303
|
+
status,
|
|
304
|
+
finishedAt:
|
|
305
|
+
status === 'done' || status === 'failed' || status === 'skipped'
|
|
306
|
+
? Date.now()
|
|
307
|
+
: n.finishedAt,
|
|
308
|
+
};
|
|
309
|
+
}),
|
|
310
|
+
updatedAt: Date.now(),
|
|
311
|
+
}));
|
|
312
|
+
this.emit();
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
finishTask(
|
|
316
|
+
status: Exclude<TaskStatus, 'running'>,
|
|
317
|
+
taskId?: string,
|
|
318
|
+
summary?: LocalizedText,
|
|
319
|
+
) {
|
|
320
|
+
const id = taskId ?? this.activeTaskId;
|
|
321
|
+
if (!id) return;
|
|
322
|
+
const task = this.tasks.find((t) => t.id === id);
|
|
323
|
+
this.tasks = this.tasks.map((t) => {
|
|
324
|
+
if (t.id !== id) return t;
|
|
325
|
+
return {
|
|
326
|
+
...t,
|
|
327
|
+
status,
|
|
328
|
+
updatedAt: Date.now(),
|
|
329
|
+
finishedAt: Date.now(),
|
|
330
|
+
nodes: t.nodes.map((n) =>
|
|
331
|
+
n.status === 'running'
|
|
332
|
+
? {
|
|
333
|
+
...n,
|
|
334
|
+
status: status === 'success' ? 'done' : 'failed',
|
|
335
|
+
finishedAt: Date.now(),
|
|
336
|
+
}
|
|
337
|
+
: n,
|
|
338
|
+
),
|
|
339
|
+
};
|
|
340
|
+
});
|
|
341
|
+
const message =
|
|
342
|
+
(summary && resolveText(summary).trim()) ||
|
|
343
|
+
task?.title ||
|
|
344
|
+
runtimeText(`status.${status}`);
|
|
345
|
+
this.localizedResult = summary && typeof summary !== 'string' ? summary : null;
|
|
346
|
+
this.resultFlash = {
|
|
347
|
+
status,
|
|
348
|
+
message: message.slice(0, 80),
|
|
349
|
+
taskId: id,
|
|
350
|
+
at: Date.now(),
|
|
351
|
+
};
|
|
352
|
+
this.userGateWaiting = null;
|
|
353
|
+
// Show result pill even if chrome was suppressed for a gesture.
|
|
354
|
+
if (this.ui.chromeSuppressed) {
|
|
355
|
+
this.ui = { ...this.ui, chromeSuppressed: false };
|
|
356
|
+
}
|
|
357
|
+
if (this.activeTaskId === id) this.activeTaskId = null;
|
|
358
|
+
this.emit();
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/** Clear the post-run result pill (after auto-dismiss). */
|
|
362
|
+
clearResultFlash() {
|
|
363
|
+
if (!this.resultFlash) return;
|
|
364
|
+
this.resultFlash = null;
|
|
365
|
+
this.emit();
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
clear() {
|
|
369
|
+
this.tasks = [];
|
|
370
|
+
this.activeTaskId = null;
|
|
371
|
+
this.resultFlash = null;
|
|
372
|
+
this.userGateWaiting = null;
|
|
373
|
+
this.localizedTitles.clear();
|
|
374
|
+
this.localizedTaskTitles.clear();
|
|
375
|
+
this.localizedResult = null;
|
|
376
|
+
this.appearanceChanged = false;
|
|
377
|
+
this.ui = {
|
|
378
|
+
sheetOpen: false,
|
|
379
|
+
selectedTaskId: null,
|
|
380
|
+
chromeSuppressed: false,
|
|
381
|
+
chromeEpoch: 0,
|
|
382
|
+
};
|
|
383
|
+
this.emit();
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export const TaskStore = new TaskStoreImpl();
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export type TaskStatus = 'running' | 'success' | 'failed' | 'cancelled';
|
|
2
|
+
|
|
3
|
+
export type TaskNodeKind =
|
|
4
|
+
| 'user'
|
|
5
|
+
| 'plan'
|
|
6
|
+
| 'dump'
|
|
7
|
+
| 'find'
|
|
8
|
+
| 'tap'
|
|
9
|
+
| 'swipe'
|
|
10
|
+
| 'type'
|
|
11
|
+
| 'confirm'
|
|
12
|
+
| 'info'
|
|
13
|
+
| 'error';
|
|
14
|
+
|
|
15
|
+
export type TaskNodeStatus = 'pending' | 'running' | 'done' | 'failed' | 'skipped';
|
|
16
|
+
|
|
17
|
+
/** One step / log line inside a task session. */
|
|
18
|
+
export type TaskNode = {
|
|
19
|
+
id: string;
|
|
20
|
+
kind: TaskNodeKind;
|
|
21
|
+
/** Subtitle / human-readable line. */
|
|
22
|
+
title: string;
|
|
23
|
+
detail?: string;
|
|
24
|
+
status: TaskNodeStatus;
|
|
25
|
+
createdAt: number;
|
|
26
|
+
finishedAt?: number;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** One user intent / agent run. */
|
|
30
|
+
export type Task = {
|
|
31
|
+
id: string;
|
|
32
|
+
/** User utterance or short goal. */
|
|
33
|
+
title: string;
|
|
34
|
+
status: TaskStatus;
|
|
35
|
+
createdAt: number;
|
|
36
|
+
updatedAt: number;
|
|
37
|
+
finishedAt?: number;
|
|
38
|
+
nodes: TaskNode[];
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type ObserverUiState = {
|
|
42
|
+
/**
|
|
43
|
+
* Chat sheet open: session history + NL input.
|
|
44
|
+
* Closed by default; opened via progress pill or host entry button.
|
|
45
|
+
*/
|
|
46
|
+
sheetOpen: boolean;
|
|
47
|
+
/** Selected task for session detail; null → latest / active. */
|
|
48
|
+
selectedTaskId: string | null;
|
|
49
|
+
/**
|
|
50
|
+
* Temporarily hide progress pill + stop while an agent tap/swipe
|
|
51
|
+
* would hit the same screen region (e.g. bottom tab / cart).
|
|
52
|
+
*/
|
|
53
|
+
chromeSuppressed: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Bumped to remount progress Modal above a newly presented host modal
|
|
56
|
+
* (e.g. Settings). Latest RN Modal wins the window stack.
|
|
57
|
+
*/
|
|
58
|
+
chromeEpoch: number;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/** Brief success/failure line shown on the progress pill after a run ends. */
|
|
62
|
+
export type ProgressResultFlash = {
|
|
63
|
+
status: Exclude<TaskStatus, 'running'>;
|
|
64
|
+
message: string;
|
|
65
|
+
taskId: string;
|
|
66
|
+
at: number;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export type TaskStoreSnapshot = {
|
|
70
|
+
tasks: Task[];
|
|
71
|
+
activeTaskId: string | null;
|
|
72
|
+
/** Current progress line while a task is running. */
|
|
73
|
+
subtitle: string | null;
|
|
74
|
+
/** Post-run result pill; cleared by UI after auto-dismiss. */
|
|
75
|
+
resultFlash: ProgressResultFlash | null;
|
|
76
|
+
/**
|
|
77
|
+
* Secure-input wait: non-null while agent paused for password/PIN/OTP.
|
|
78
|
+
* UI shows banner +「我已完成」.
|
|
79
|
+
*/
|
|
80
|
+
userGateWaiting: string | null;
|
|
81
|
+
ui: ObserverUiState;
|
|
82
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { TaskStore } from './TaskStore';
|
|
3
|
+
import type { TaskStoreSnapshot } from './types';
|
|
4
|
+
|
|
5
|
+
export function useTaskStore(): TaskStoreSnapshot {
|
|
6
|
+
const [snap, setSnap] = useState<TaskStoreSnapshot>(() => TaskStore.snapshot());
|
|
7
|
+
useEffect(() => TaskStore.subscribe(setSnap), []);
|
|
8
|
+
return snap;
|
|
9
|
+
}
|