@adminide-stack/yantra-mobile 12.0.195 → 12.0.196-alpha.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/lib/components/CustomDrawer.js +17 -1
- package/lib/components/CustomDrawer.js.map +1 -1
- package/lib/compute.js +57 -1
- package/lib/compute.js.map +1 -1
- package/lib/config/env-config.js +11 -1
- package/lib/config/env-config.js.map +1 -1
- package/lib/features/agent-chat/NativeAgentChat.js +7 -0
- package/lib/features/agent-chat/NativeAgentChat.js.map +1 -1
- package/lib/features/canvas/extendVideo.js +5 -1
- package/lib/features/canvas/extendVideo.js.map +1 -1
- package/lib/features/canvas/workflow/StepSheet.js +18 -1
- package/lib/features/canvas/workflow/StepSheet.js.map +1 -1
- package/lib/features/canvas/workflow/workflowSteps.js +102 -31
- package/lib/features/canvas/workflow/workflowSteps.js.map +1 -1
- package/lib/features/chat/ComposerMicSend.js +35 -0
- package/lib/features/chat/ComposerMicSend.js.map +1 -0
- package/lib/features/chat/ComposerModeSwitch.js +64 -1
- package/lib/features/chat/ComposerModeSwitch.js.map +1 -1
- package/lib/features/chat/askUser.js +6 -1
- package/lib/features/chat/askUser.js.map +1 -1
- package/lib/features/connectors/ConnectorSheet.js +443 -0
- package/lib/features/connectors/ConnectorSheet.js.map +1 -0
- package/lib/features/connectors/ConnectorsPage.js +320 -0
- package/lib/features/connectors/ConnectorsPage.js.map +1 -0
- package/lib/features/connectors/connectConnector.js +278 -0
- package/lib/features/connectors/connectConnector.js.map +1 -0
- package/lib/features/connectors/connectorCatalog.js +222 -0
- package/lib/features/connectors/connectorCatalog.js.map +1 -0
- package/lib/features/connectors/useConnectorCatalog.js +153 -0
- package/lib/features/connectors/useConnectorCatalog.js.map +1 -0
- package/lib/features/home/needsYou/HomeNeedsYou.js +618 -0
- package/lib/features/home/needsYou/HomeNeedsYou.js.map +1 -0
- package/lib/features/home/needsYou/chatFollowUps.js +333 -0
- package/lib/features/home/needsYou/chatFollowUps.js.map +1 -0
- package/lib/features/home/needsYou/format.js +47 -0
- package/lib/features/home/needsYou/format.js.map +1 -0
- package/lib/features/home/needsYou/historyText.js +40 -0
- package/lib/features/home/needsYou/historyText.js.map +1 -0
- package/lib/features/home/needsYou/inboxHighlights.js +152 -0
- package/lib/features/home/needsYou/inboxHighlights.js.map +1 -0
- package/lib/features/home/needsYou/panelsSettings.js +71 -0
- package/lib/features/home/needsYou/panelsSettings.js.map +1 -0
- package/lib/features/home/needsYou/ported/commandConfirmProtocol.js +13 -0
- package/lib/features/home/needsYou/ported/commandConfirmProtocol.js.map +1 -0
- package/lib/features/home/needsYou/ported/paymentApprovalProtocol.js +91 -0
- package/lib/features/home/needsYou/ported/paymentApprovalProtocol.js.map +1 -0
- package/lib/features/home/needsYou/ported/resultCardModels.js +659 -0
- package/lib/features/home/needsYou/ported/resultCardModels.js.map +1 -0
- package/lib/features/home/needsYou/types.js +1 -0
- package/lib/features/home/needsYou/types.js.map +1 -0
- package/lib/features/home/needsYou/useChatFollowUps.js +149 -0
- package/lib/features/home/needsYou/useChatFollowUps.js.map +1 -0
- package/lib/features/home/needsYou/useHomeBriefing.js +68 -0
- package/lib/features/home/needsYou/useHomeBriefing.js.map +1 -0
- package/lib/features/home/needsYou/useInboxHighlights.js +173 -0
- package/lib/features/home/needsYou/useInboxHighlights.js.map +1 -0
- package/lib/features/home/needsYou/usePanelsSettings.js +105 -0
- package/lib/features/home/needsYou/usePanelsSettings.js.map +1 -0
- package/lib/features/shopping/DealCard.js +8 -1
- package/lib/features/shopping/DealCard.js.map +1 -1
- package/lib/features/shopping/DealRails.js +24 -7
- package/lib/features/shopping/DealRails.js.map +1 -1
- package/lib/features/shopping/DealsPanel.js +1 -1
- package/lib/features/shopping/DealsPanel.js.map +1 -1
- package/lib/features/shopping/HolidayDealsPanel.js +529 -0
- package/lib/features/shopping/HolidayDealsPanel.js.map +1 -0
- package/lib/features/shopping/HolidayDealsParts.js +954 -0
- package/lib/features/shopping/HolidayDealsParts.js.map +1 -0
- package/lib/features/shopping/HolidayOffers.js +351 -0
- package/lib/features/shopping/HolidayOffers.js.map +1 -0
- package/lib/features/shopping/ProductCard.js +80 -14
- package/lib/features/shopping/ProductCard.js.map +1 -1
- package/lib/features/shopping/ProductDetailSheet.js +22 -3
- package/lib/features/shopping/ProductDetailSheet.js.map +1 -1
- package/lib/features/shopping/SavedPanel.js +341 -5
- package/lib/features/shopping/SavedPanel.js.map +1 -1
- package/lib/features/shopping/SearchResults.js +8 -2
- package/lib/features/shopping/SearchResults.js.map +1 -1
- package/lib/features/shopping/ShoppingAgentChatPane.js +12 -0
- package/lib/features/shopping/ShoppingAgentChatPane.js.map +1 -1
- package/lib/features/shopping/ShoppingExperience.js +56 -19
- package/lib/features/shopping/ShoppingExperience.js.map +1 -1
- package/lib/features/shopping/TrendingSections.js +13 -4
- package/lib/features/shopping/TrendingSections.js.map +1 -1
- package/lib/features/shopping/WatchlistPanel.js +61 -5
- package/lib/features/shopping/WatchlistPanel.js.map +1 -1
- package/lib/features/shopping/catalog.js +41 -2
- package/lib/features/shopping/catalog.js.map +1 -1
- package/lib/features/shopping/chat/brainRouter.js +14 -0
- package/lib/features/shopping/chat/brainRouter.js.map +1 -1
- package/lib/features/shopping/chat/shoppingTurn.js +88 -16
- package/lib/features/shopping/chat/shoppingTurn.js.map +1 -1
- package/lib/features/shopping/hooks/useHolidayDeals.js +388 -0
- package/lib/features/shopping/hooks/useHolidayDeals.js.map +1 -0
- package/lib/features/shopping/hooks/useProductMedia.js +33 -6
- package/lib/features/shopping/hooks/useProductMedia.js.map +1 -1
- package/lib/features/shopping/hooks/useShoppingHistorySync.js +8 -4
- package/lib/features/shopping/hooks/useShoppingHistorySync.js.map +1 -1
- package/lib/features/shopping/hooks/useTrendingProducts.js +11 -3
- package/lib/features/shopping/hooks/useTrendingProducts.js.map +1 -1
- package/lib/features/shopping/savedProducts.js +76 -6
- package/lib/features/shopping/savedProducts.js.map +1 -1
- package/lib/features/shopping/services/aiRelevance.js +212 -0
- package/lib/features/shopping/services/aiRelevance.js.map +1 -0
- package/lib/features/shopping/services/blackFriday.js +301 -0
- package/lib/features/shopping/services/blackFriday.js.map +1 -0
- package/lib/features/shopping/services/blackFridayBrowserSites.js +137 -0
- package/lib/features/shopping/services/blackFridayBrowserSites.js.map +1 -0
- package/lib/features/shopping/services/catalogProductSearch.js +21 -3
- package/lib/features/shopping/services/catalogProductSearch.js.map +1 -1
- package/lib/features/shopping/services/holidayDeals.js +143 -0
- package/lib/features/shopping/services/holidayDeals.js.map +1 -0
- package/lib/features/shopping/services/mediaShape.js +7 -0
- package/lib/features/shopping/services/mediaShape.js.map +1 -0
- package/lib/features/shopping/services/modelStep.js +95 -0
- package/lib/features/shopping/services/modelStep.js.map +1 -0
- package/lib/features/shopping/services/modelWords.js +14 -0
- package/lib/features/shopping/services/modelWords.js.map +1 -0
- package/lib/features/shopping/services/productAvailability.js +5 -1
- package/lib/features/shopping/services/productAvailability.js.map +1 -1
- package/lib/features/shopping/services/productFilters.js +2 -2
- package/lib/features/shopping/services/productFilters.js.map +1 -1
- package/lib/features/shopping/services/productMedia.js +103 -18
- package/lib/features/shopping/services/productMedia.js.map +1 -1
- package/lib/features/shopping/services/retailerUrl.js +11 -8
- package/lib/features/shopping/services/retailerUrl.js.map +1 -1
- package/lib/features/shopping/services/salesDealsStore.js +3 -2
- package/lib/features/shopping/services/salesDealsStore.js.map +1 -1
- package/lib/features/shopping/services/savedReads.js +82 -0
- package/lib/features/shopping/services/savedReads.js.map +1 -0
- package/lib/features/shopping/services/searchCardFields.js +2 -0
- package/lib/features/shopping/services/searchCardFields.js.map +1 -1
- package/lib/features/shopping/services/searchRelevance.js +154 -24
- package/lib/features/shopping/services/searchRelevance.js.map +1 -1
- package/lib/features/shopping/services/secondHand.js +12 -0
- package/lib/features/shopping/services/secondHand.js.map +1 -0
- package/lib/features/shopping/services/shoppingProductSearch.js +82 -10
- package/lib/features/shopping/services/shoppingProductSearch.js.map +1 -1
- package/lib/features/shopping/services/shoppingSearchConnectorClient.js +14 -1
- package/lib/features/shopping/services/shoppingSearchConnectorClient.js.map +1 -1
- package/lib/features/shopping/services/shoppingSubgraph.js +2 -1
- package/lib/features/shopping/services/shoppingSubgraph.js.map +1 -1
- package/lib/features/shopping/services/storedGalleries.js +130 -0
- package/lib/features/shopping/services/storedGalleries.js.map +1 -0
- package/lib/features/shopping/services/usedSites.js +263 -0
- package/lib/features/shopping/services/usedSites.js.map +1 -0
- package/lib/features/shopping/services/verifyProducts.js +3 -3
- package/lib/features/shopping/services/verifyProducts.js.map +1 -1
- package/lib/features/shopping/services/watchDeal.js +61 -0
- package/lib/features/shopping/services/watchDeal.js.map +1 -0
- package/lib/features/shopping/shoppingRuntime.js +7 -2
- package/lib/features/shopping/shoppingRuntime.js.map +1 -1
- package/lib/features/shopping/state/accountCaches.js +20 -0
- package/lib/features/shopping/state/accountCaches.js.map +1 -0
- package/lib/features/shopping/state/holidayDealsRequest.js +22 -0
- package/lib/features/shopping/state/holidayDealsRequest.js.map +1 -0
- package/lib/features/shopping/tutorials/ShoppingTutorialDock.js +1 -1
- package/lib/features/shopping/tutorials/ShoppingTutorialDock.js.map +1 -1
- package/lib/features/shopping/tutorials/shoppingTutorials.js +2 -0
- package/lib/features/shopping/tutorials/shoppingTutorials.js.map +1 -1
- package/lib/features/shopping/useShoppingSearch.js +74 -18
- package/lib/features/shopping/useShoppingSearch.js.map +1 -1
- package/lib/features/team-chat/TeamChatExperience.js +474 -0
- package/lib/features/team-chat/TeamChatExperience.js.map +1 -0
- package/lib/features/team-chat/api/client.js +198 -0
- package/lib/features/team-chat/api/client.js.map +1 -0
- package/lib/features/team-chat/api/live.js +160 -0
- package/lib/features/team-chat/api/live.js.map +1 -0
- package/lib/features/team-chat/api/ops.js +241 -0
- package/lib/features/team-chat/api/ops.js.map +1 -0
- package/lib/features/team-chat/app.js +12 -0
- package/lib/features/team-chat/app.js.map +1 -0
- package/lib/features/team-chat/components/Avatar.js +107 -0
- package/lib/features/team-chat/components/Avatar.js.map +1 -0
- package/lib/features/team-chat/components/Composer.js +641 -0
- package/lib/features/team-chat/components/Composer.js.map +1 -0
- package/lib/features/team-chat/components/Dialogs.js +598 -0
- package/lib/features/team-chat/components/Dialogs.js.map +1 -0
- package/lib/features/team-chat/components/EmojiPicker.js +165 -0
- package/lib/features/team-chat/components/EmojiPicker.js.map +1 -0
- package/lib/features/team-chat/components/MessageItem.js +658 -0
- package/lib/features/team-chat/components/MessageItem.js.map +1 -0
- package/lib/features/team-chat/components/MessageList.js +248 -0
- package/lib/features/team-chat/components/MessageList.js.map +1 -0
- package/lib/features/team-chat/components/Mrkdwn.js +228 -0
- package/lib/features/team-chat/components/Mrkdwn.js.map +1 -0
- package/lib/features/team-chat/components/QuickSwitcher.js +215 -0
- package/lib/features/team-chat/components/QuickSwitcher.js.map +1 -0
- package/lib/features/team-chat/components/ui.js +662 -0
- package/lib/features/team-chat/components/ui.js.map +1 -0
- package/lib/features/team-chat/nativeTeamChatRegistry.js +15 -0
- package/lib/features/team-chat/nativeTeamChatRegistry.js.map +1 -0
- package/lib/features/team-chat/state/fetched.js +39 -0
- package/lib/features/team-chat/state/fetched.js.map +1 -0
- package/lib/features/team-chat/state/lists.js +230 -0
- package/lib/features/team-chat/state/lists.js.map +1 -0
- package/lib/features/team-chat/state/store.js +1108 -0
- package/lib/features/team-chat/state/store.js.map +1 -0
- package/lib/features/team-chat/state/useChannelDirectory.js +21 -0
- package/lib/features/team-chat/state/useChannelDirectory.js.map +1 -0
- package/lib/features/team-chat/theme.js +77 -0
- package/lib/features/team-chat/theme.js.map +1 -0
- package/lib/features/team-chat/utils/composeText.js +72 -0
- package/lib/features/team-chat/utils/composeText.js.map +1 -0
- package/lib/features/team-chat/utils/emoji.js +369 -0
- package/lib/features/team-chat/utils/emoji.js.map +1 -0
- package/lib/features/team-chat/utils/format.js +109 -0
- package/lib/features/team-chat/utils/format.js.map +1 -0
- package/lib/features/team-chat/utils/messageRows.js +24 -0
- package/lib/features/team-chat/utils/messageRows.js.map +1 -0
- package/lib/features/team-chat/utils/mrkdwn.js +222 -0
- package/lib/features/team-chat/utils/mrkdwn.js.map +1 -0
- package/lib/features/team-chat/utils/notify.js +47 -0
- package/lib/features/team-chat/utils/notify.js.map +1 -0
- package/lib/features/team-chat/utils/pickFiles.js +81 -0
- package/lib/features/team-chat/utils/pickFiles.js.map +1 -0
- package/lib/features/team-chat/views/ActivityView.js +235 -0
- package/lib/features/team-chat/views/ActivityView.js.map +1 -0
- package/lib/features/team-chat/views/BrowseView.js +179 -0
- package/lib/features/team-chat/views/BrowseView.js.map +1 -0
- package/lib/features/team-chat/views/ChannelView.js +475 -0
- package/lib/features/team-chat/views/ChannelView.js.map +1 -0
- package/lib/features/team-chat/views/DetailsPane.js +816 -0
- package/lib/features/team-chat/views/DetailsPane.js.map +1 -0
- package/lib/features/team-chat/views/DraftsView.js +212 -0
- package/lib/features/team-chat/views/DraftsView.js.map +1 -0
- package/lib/features/team-chat/views/FilesView.js +152 -0
- package/lib/features/team-chat/views/FilesView.js.map +1 -0
- package/lib/features/team-chat/views/NewMessageView.js +286 -0
- package/lib/features/team-chat/views/NewMessageView.js.map +1 -0
- package/lib/features/team-chat/views/PeopleView.js +118 -0
- package/lib/features/team-chat/views/PeopleView.js.map +1 -0
- package/lib/features/team-chat/views/ProfilePane.js +220 -0
- package/lib/features/team-chat/views/ProfilePane.js.map +1 -0
- package/lib/features/team-chat/views/SavedView.js +113 -0
- package/lib/features/team-chat/views/SavedView.js.map +1 -0
- package/lib/features/team-chat/views/SearchView.js +307 -0
- package/lib/features/team-chat/views/SearchView.js.map +1 -0
- package/lib/features/team-chat/views/Sidebar.js +368 -0
- package/lib/features/team-chat/views/Sidebar.js.map +1 -0
- package/lib/features/team-chat/views/ThreadPane.js +139 -0
- package/lib/features/team-chat/views/ThreadPane.js.map +1 -0
- package/lib/features/team-chat/views/ThreadsView.js +157 -0
- package/lib/features/team-chat/views/ThreadsView.js.map +1 -0
- package/lib/features/webbuilder/WebBuilderExperience.js +276 -42
- package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -1
- package/lib/features/webbuilder/buildFragments.js +10 -4
- package/lib/features/webbuilder/buildFragments.js.map +1 -1
- package/lib/features/webbuilder/components/AssetChips.js +61 -0
- package/lib/features/webbuilder/components/AssetChips.js.map +1 -0
- package/lib/features/webbuilder/components/AssetSiteChooser.js +100 -0
- package/lib/features/webbuilder/components/AssetSiteChooser.js.map +1 -0
- package/lib/features/webbuilder/components/CommentsLayer.js +485 -0
- package/lib/features/webbuilder/components/CommentsLayer.js.map +1 -0
- package/lib/features/webbuilder/components/Composer.js +16 -2
- package/lib/features/webbuilder/components/Composer.js.map +1 -1
- package/lib/features/webbuilder/components/ComposerModeSwitch.js +71 -0
- package/lib/features/webbuilder/components/ComposerModeSwitch.js.map +1 -0
- package/lib/features/webbuilder/components/MyAssetsPicker.js +500 -0
- package/lib/features/webbuilder/components/MyAssetsPicker.js.map +1 -0
- package/lib/features/webbuilder/components/PlanDocument.js +165 -0
- package/lib/features/webbuilder/components/PlanDocument.js.map +1 -0
- package/lib/features/webbuilder/components/PlanDraftCard.js +205 -0
- package/lib/features/webbuilder/components/PlanDraftCard.js.map +1 -0
- package/lib/features/webbuilder/components/PlanView.js +788 -0
- package/lib/features/webbuilder/components/PlanView.js.map +1 -0
- package/lib/features/webbuilder/components/PreviewConsoleSheet.js +334 -0
- package/lib/features/webbuilder/components/PreviewConsoleSheet.js.map +1 -0
- package/lib/features/webbuilder/components/PreviewFrame.js +45 -3
- package/lib/features/webbuilder/components/PreviewFrame.js.map +1 -1
- package/lib/features/webbuilder/components/PreviewScreen.js +94 -10
- package/lib/features/webbuilder/components/PreviewScreen.js.map +1 -1
- package/lib/features/webbuilder/components/ProjectChat.js +84 -14
- package/lib/features/webbuilder/components/ProjectChat.js.map +1 -1
- package/lib/features/webbuilder/components/StudioHome.js +69 -6
- package/lib/features/webbuilder/components/StudioHome.js.map +1 -1
- package/lib/features/webbuilder/components/StyleDirectionsSheet.js +291 -0
- package/lib/features/webbuilder/components/StyleDirectionsSheet.js.map +1 -0
- package/lib/features/webbuilder/components/VersionChangesView.js +574 -0
- package/lib/features/webbuilder/components/VersionChangesView.js.map +1 -0
- package/lib/features/webbuilder/components/VersionPreviewView.js +186 -0
- package/lib/features/webbuilder/components/VersionPreviewView.js.map +1 -0
- package/lib/features/webbuilder/components/VersionsSheet.js +673 -16
- package/lib/features/webbuilder/components/VersionsSheet.js.map +1 -1
- package/lib/features/webbuilder/connectorTemplates.js +6 -1
- package/lib/features/webbuilder/connectorTemplates.js.map +1 -1
- package/lib/features/webbuilder/myAssets.js +101 -0
- package/lib/features/webbuilder/myAssets.js.map +1 -0
- package/lib/features/webbuilder/planChat.js +146 -0
- package/lib/features/webbuilder/planChat.js.map +1 -0
- package/lib/features/webbuilder/planDocument.js +89 -0
- package/lib/features/webbuilder/planDocument.js.map +1 -0
- package/lib/features/webbuilder/planStore.js +55 -0
- package/lib/features/webbuilder/planStore.js.map +1 -0
- package/lib/features/webbuilder/previewCommentsScript.js +218 -0
- package/lib/features/webbuilder/previewCommentsScript.js.map +1 -0
- package/lib/features/webbuilder/previewConsoleScript.js +39 -0
- package/lib/features/webbuilder/previewConsoleScript.js.map +1 -0
- package/lib/features/webbuilder/styleDirections.js +85 -0
- package/lib/features/webbuilder/styleDirections.js.map +1 -0
- package/lib/features/webbuilder/useCanvasComments.js +335 -0
- package/lib/features/webbuilder/useCanvasComments.js.map +1 -0
- package/lib/features/webbuilder/useCatalogTemplates.js +37 -0
- package/lib/features/webbuilder/useCatalogTemplates.js.map +1 -0
- package/lib/features/webbuilder/usePlanMode.js +145 -0
- package/lib/features/webbuilder/usePlanMode.js.map +1 -0
- package/lib/features/webbuilder/useStyleDirections.js +112 -0
- package/lib/features/webbuilder/useStyleDirections.js.map +1 -0
- package/lib/features/webbuilder/web/assets/assetsApi.js +174 -0
- package/lib/features/webbuilder/web/assets/assetsApi.js.map +1 -0
- package/lib/features/webbuilder/web/assets/assetsApi.ts +173 -0
- package/lib/features/webbuilder/web/assets/myAssets.js +341 -0
- package/lib/features/webbuilder/web/assets/myAssets.js.map +1 -0
- package/lib/features/webbuilder/web/assets/myAssets.ts +396 -0
- package/lib/features/webbuilder/web/canvas/elementName.js +46 -0
- package/lib/features/webbuilder/web/canvas/elementName.js.map +1 -0
- package/lib/features/webbuilder/web/canvas/visualEditorBridge.js +95 -0
- package/lib/features/webbuilder/web/canvas/visualEditorBridge.js.map +1 -0
- package/lib/features/webbuilder/web/chat/agentTurn.js +24 -0
- package/lib/features/webbuilder/web/chat/agentTurn.js.map +1 -0
- package/lib/features/webbuilder/web/chat/planMode.js +164 -0
- package/lib/features/webbuilder/web/chat/planMode.js.map +1 -0
- package/lib/features/webbuilder/web/chat/realPlans.js +66 -0
- package/lib/features/webbuilder/web/chat/realPlans.js.map +1 -0
- package/lib/features/webbuilder/web/comments/comments.js +336 -0
- package/lib/features/webbuilder/web/comments/comments.js.map +1 -0
- package/lib/features/webbuilder/web/comments/commentsApi.js +59 -0
- package/lib/features/webbuilder/web/comments/commentsApi.js.map +1 -0
- package/lib/features/webbuilder/web/components/planView.js +21 -0
- package/lib/features/webbuilder/web/components/planView.js.map +1 -0
- package/lib/features/webbuilder/web/console/consolePanel.js +43 -0
- package/lib/features/webbuilder/web/console/consolePanel.js.map +1 -0
- package/lib/features/webbuilder/web/console/previewConsole.js +256 -0
- package/lib/features/webbuilder/web/console/previewConsole.js.map +1 -0
- package/lib/features/webbuilder/web/console/usePreviewConsole.js +147 -0
- package/lib/features/webbuilder/web/console/usePreviewConsole.js.map +1 -0
- package/lib/features/webbuilder/web/design/directions.js +419 -1
- package/lib/features/webbuilder/web/design/directions.js.map +1 -1
- package/lib/features/webbuilder/web/history/diffActions.js +222 -0
- package/lib/features/webbuilder/web/history/diffActions.js.map +1 -0
- package/lib/features/webbuilder/web/history/diffHighlight.js +18 -0
- package/lib/features/webbuilder/web/history/diffHighlight.js.map +1 -0
- package/lib/features/webbuilder/web/history/versionActions.js +272 -0
- package/lib/features/webbuilder/web/history/versionActions.js.map +1 -0
- package/lib/features/webbuilder/web/history/versionDiff.js +338 -0
- package/lib/features/webbuilder/web/history/versionDiff.js.map +1 -0
- package/lib/features/webbuilder/web/history/versionPreview.js +83 -0
- package/lib/features/webbuilder/web/history/versionPreview.js.map +1 -0
- package/lib/features/webbuilder/web/history/versionPreviewMachine.js +150 -0
- package/lib/features/webbuilder/web/history/versionPreviewMachine.js.map +1 -0
- package/lib/features/webbuilder/web/history/versions.js +326 -1
- package/lib/features/webbuilder/web/history/versions.js.map +1 -1
- package/lib/features/webbuilder/web/hosted/hostedTurn.js +36 -0
- package/lib/features/webbuilder/web/hosted/hostedTurn.js.map +1 -0
- package/lib/features/webbuilder/web/studio/brandKit.js +25 -0
- package/lib/features/webbuilder/web/studio/brandKit.js.map +1 -0
- package/lib/features/webbuilder/web/utils/promptSafe.js +15 -0
- package/lib/features/webbuilder/web/utils/promptSafe.js.map +1 -0
- package/lib/features/webbuilder/web/webServices.js +3 -1
- package/lib/features/webbuilder/web/webServices.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/routes.json +55 -0
- package/lib/screens/Account/index.js +13 -5
- package/lib/screens/Account/index.js.map +1 -1
- package/lib/screens/Chat/index.js +16 -0
- package/lib/screens/Chat/index.js.map +1 -1
- package/lib/screens/Home/HomeScreen.js +202 -39
- package/lib/screens/Home/HomeScreen.js.map +1 -1
- package/lib/screens/Home/components/HomeHero.js +52 -38
- package/lib/screens/Home/components/HomeHero.js.map +1 -1
- package/lib/screens/Home/components/homeCatalog.js +8 -1
- package/lib/screens/Home/components/homeCatalog.js.map +1 -1
- package/lib/screens/TeamChat/index.js +41 -0
- package/lib/screens/TeamChat/index.js.map +1 -0
- package/lib/screens/WebBuilder/nativeWebBuilderRedirect.js +9 -2
- package/lib/screens/WebBuilder/nativeWebBuilderRedirect.js.map +1 -1
- package/lib/screens/WebBuilderNative/index.js +13 -3
- package/lib/screens/WebBuilderNative/index.js.map +1 -1
- package/lib/screens/WebBuilderNative/useConnectorTemplates.js +2 -2
- package/lib/screens/WebBuilderNative/useConnectorTemplates.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brainRouter.js","sources":["../../../../src/features/shopping/chat/brainRouter.ts"],"sourcesContent":["/**\n * Native: the web surface's `chat/brainRouter.ts` (0.37.0) verbatim; the kit\n * helpers and the brain transport are `./brainRouterKit`.\n *\n * What the user meant - decided by yantra-brain from the state of the shop\n * page, never by a word list.\n *\n * \"price check the first one\" used to reach the retailers as a search for the\n * words \"the first one\", and armed a watch on whatever came back; \"open the\n * second one\" and \"add the cheapest one to cart\" did nothing. A hand-written\n * router for those was written and thrown away the same day: it cannot know\n * what people will type, and a wrong guess silently replaces the grid.\n *\n * So the brain gets the grid as the shopper sees it - the numbered products\n * with their prices, ratings and stores, the search behind them, the cart,\n * the watches, the last exchange - and returns ONE verdict in a shape the\n * surface can run. This module builds that ask and validates the answer\n * (bounds and shapes, which is not routing). When the brain does not answer,\n * the surface says so; it does not guess.\n */\nimport {\n actionName,\n boundedIndex,\n boundedIndexes,\n completeViaBrain,\n parseJsonObject,\n positiveNumber,\n renderRecent,\n trimmedString,\n trunc,\n type BrainMessage,\n type CompleteViaBrainOptions,\n} from './brainRouterKit';\nimport type { Product } from '../catalog';\n\nexport interface ChatTurn {\n role: 'user' | 'assistant';\n content: string;\n}\n\nexport interface ShoppingRouterState {\n /** The grid, in the order shown. Index 1 is the first card. */\n products: readonly Product[];\n /** The search behind the grid, if one produced it. */\n query?: string;\n cartCount: number;\n /** Products a price watch was armed on in this session, by name. */\n watching: readonly string[];\n /** The last few turns, oldest first, so \"yes\" and \"the other one\" have a referent. */\n recent?: readonly ChatTurn[];\n}\n\nexport type ShoppingVerdict =\n | { action: 'search'; query: string; budget?: number }\n | { action: 'open'; index: number }\n | { action: 'cart'; index: number; quantity: number }\n | { action: 'save'; index: number }\n | { action: 'watch'; index?: number; query?: string; targetPrice?: number }\n | { action: 'stop_watch' }\n | { action: 'clarify'; candidates: number[]; question: string }\n | { action: 'reply'; text: string }\n /**\n * Not this pane's job: it happens on a real web page. The assistant has a\n * cloud Computer for that, so the turn goes to the agent. `index` points at\n * the product on screen they meant, when they meant one.\n */\n | { action: 'computer'; index?: number };\n\n/** More rows than this and the list is a wall the model stops reading; the grid has paging anyway. */\nconst MAX_PRODUCTS_IN_PROMPT = 40;\n\nfunction money(price: number): string {\n return Number.isInteger(price) ? `$${price}` : `$${price.toFixed(2)}`;\n}\n\n/** One product as the shopper sees it on the card. */\nexport function productLine(p: Product): string {\n const meta = [\n p.price > 0 ? money(p.price) : undefined,\n p.rating > 0 ? `★ ${p.rating.toFixed(1)}` : undefined,\n p.brand,\n p.source ? `via ${p.source}` : undefined,\n ].filter(Boolean);\n return `${trunc(p.name, 120)}${meta.length ? ` - ${meta.join(' · ')}` : ''}`;\n}\n\n/**\n * The ask. Prose rules, not prompt trickery: what each action means, when it\n * applies, and that the answer is one JSON object. The state is rendered as\n * the person would see it - the numbered grid, then the situation.\n */\nexport function buildRouterMessages(text: string, state: ShoppingRouterState): BrainMessage[] {\n const rows = state.products.slice(0, MAX_PRODUCTS_IN_PROMPT);\n const lines = rows.length\n ? rows.map((p, i) => `${i + 1}. ${productLine(p)}`).join('\\n')\n : '(none - nothing has been searched yet)';\n const more = state.products.length > rows.length ? `\\n…and ${state.products.length - rows.length} more below.` : '';\n\n const situation: string[] = [];\n if (state.query) situation.push(`These products came from the search \"${state.query}\".`);\n // The orders a superlative indexes into, worked out here so the brain\n // reads them instead of doing arithmetic over forty prices - \"the second\n // cheapest\" was the third cheapest when it sorted for itself.\n const tag = (p: Product) => [p.brand, p.source].filter(Boolean).join(', ');\n const entry = (p: Product, i: number, v: string) => `#${i + 1} (${v}${tag(p) ? `, ${tag(p)}` : ''})`;\n const byPrice = rows\n .map((p, i) => ({ p, i, v: p.price }))\n .filter((x) => x.v > 0)\n .sort((a, b) => a.v - b.v);\n if (byPrice.length > 1)\n situation.push(`By price, lowest first: ${byPrice.map((x) => entry(x.p, x.i, money(x.v))).join(', ')}.`);\n const byRating = rows\n .map((p, i) => ({ p, i, v: p.rating }))\n .filter((x) => x.v > 0)\n .sort((a, b) => b.v - a.v);\n if (byRating.length > 1)\n situation.push(`By rating, highest first: ${byRating.map((x) => entry(x.p, x.i, x.v.toFixed(1))).join(', ')}.`);\n situation.push(\n state.cartCount > 0\n ? `The cart has ${state.cartCount} item${state.cartCount === 1 ? '' : 's'}.`\n : 'The cart is empty.',\n );\n situation.push(\n state.watching.length\n ? `Price watches armed this session: ${state.watching.map((n) => `\"${trunc(n, 60)}\"`).join(', ')}.`\n : 'No price watch has been armed this session.',\n );\n\n const system =\n 'You are the router for a shopping assistant that searches real products across many stores, keeps a cart and a saved list, ' +\n \"and can watch a product's price on the user's own cloud Computer. The user types one message; you decide the ONE action \" +\n 'the assistant takes, from the state you are given. You answer with a single JSON object and nothing else.\\n\\n' +\n 'Actions:\\n' +\n '- \"search\": the user describes something to buy or browse - a product, a category, a brand, a need (\"something to keep coffee hot\"), ' +\n 'with or without a budget. {\"action\":\"search\",\"query\":\"<the product words, without the asking verb>\",\"budget\":<max price in dollars, only when stated>}. ' +\n 'Any category counts; you do not need to recognise the product. A search replaces the grid, so only choose it when they want different products.\\n' +\n '- \"open\": show the details of ONE product on screen. They may name it by position (\"the first one\", \"#3\", \"the last one\", ' +\n '\"the second sony one\"), by name, brand or store or a part of it (typos happen), or by a superlative over the list ' +\n '(\"the cheapest\", \"best rated\", \"the most expensive\") - compare the listed prices and ratings yourself. {\"action\":\"open\",\"index\":<1-based number>}. ' +\n 'A bare pick with no verb (\"the second one\") is an open.\\n' +\n '- \"cart\": put ONE product on screen in the cart. {\"action\":\"cart\",\"index\":<n>,\"quantity\":<n, 1 unless they said otherwise>}.\\n' +\n '- \"save\": save / bookmark / wishlist ONE product on screen. {\"action\":\"save\",\"index\":<n>}.\\n' +\n '- \"watch\": track a price - price check, watch, alert me when it drops. For a product on screen: ' +\n '{\"action\":\"watch\",\"index\":<n>,\"targetPrice\":<dollars, only when stated>}. For a product they name that is NOT on screen: ' +\n '{\"action\":\"watch\",\"query\":\"<the product words>\",\"targetPrice\":...}. \"price check\" with nothing named means the whole watchlist: {\"action\":\"watch\"}.\\n' +\n '- \"stop_watch\": stop or pause the price checks, in whatever language it is said (\"stop watching\", \"band kar do\", \"para de vigiar\"). {\"action\":\"stop_watch\"}.\\n' +\n '- \"clarify\": they want to act on ONE product but their words fit SEVERAL on screen, or none clearly (\"add it to the cart\" with many on screen). ' +\n '{\"action\":\"clarify\",\"candidates\":[<the indexes that fit, may be empty>],\"question\":\"<one short question naming them>\"}.\\n' +\n '- \"computer\": the message is about a real web page, not about this grid - searching ON a named store\\'s own site ' +\n '(\"search amazon for nike shoes\", \"in the amazon page search for X\", \"use the computer\"), their signed-in account there ' +\n '(\"my amazon cart\", \"add it to my amazon cart\", \"buy it on amazon\"), a checkout, a payment, opening a product\\'s own page, ' +\n 'or signing in. The assistant has a cloud browser - the user\\'s Computer - and hands the turn to it. {\"action\":\"computer\"}, ' +\n 'or {\"action\":\"computer\",\"index\":<n>} when they mean one of the products on screen (\"open it in the computer\", ' +\n '\"add the first one to my amazon cart\"). Prefer it over \"open\", \"cart\" and \"save\" whenever the message points at a page or a ' +\n 'store account rather than at this list.\\n' +\n '- \"reply\": nothing to run - a greeting, thanks, a question about the products on screen or about shopping in general, where things stand, a comment. ' +\n '{\"action\":\"reply\",\"text\":\"<a short helpful answer in the assistant\\'s own voice, two or three sentences, plain text, no lists: ' +\n 'answer questions about the products on screen from the numbered list only (their exact prices, ratings and stores), say what is in the cart or being watched when asked, ' +\n 'and when it fits invite them to name what they are looking for. Never invent products, prices, stores or stock>\"}.\\n\\n' +\n 'Rules: never turn small talk or a question into a search. Never point at a product that is not on screen. ' +\n 'NEVER write a \"reply\" that says the assistant cannot browse, cannot open a link, cannot search a store\\'s site, cannot use ' +\n 'the computer, or that it only updates the cart \"in this shopping session\" - every one of those is a \"computer\". ' +\n 'Never answer \"I do not see a product\" to a message that points at the list or at the page; that is a \"computer\" or a \"clarify\". ' +\n 'A \"computer\" message that does not say WHICH product, with several on screen, may be a \"clarify\" naming them - and then the ' +\n 'answer that picks one is a \"computer\" with that index, never an \"open\": the lane the question came from is still the lane. ' +\n 'A store named to pick a row OUT of the list (\"the one from target\", \"the walmart one\", \"the cheapest amazon one\") is ' +\n 'identifying a product, not pointing at that store\\'s site - those are \"open\", \"cart\", \"save\" or \"clarify\" as usual. ' +\n '\"first\" or \"last\" inside a sentence is a position only when it points at the list. For a superlative (\"the cheapest\", \"the second cheapest\", ' +\n '\"best rated\") read the sorted orders in the situation; a brand or store named with it (\"the cheapest sony\") restricts it to those rows. ' +\n 'A comparative between named rows (\"the cheaper sony\", \"the better rated of the two\") is read off the same orders. ' +\n 'One verdict acts on ONE product: when they name several (\"the two cheapest\", \"#2 and #4\"), answer with \"reply\" or \"clarify\" saying you do them one at a time and naming them - never silently act on just one. ' +\n 'When a message stops one thing and starts another (\"stop watching X and watch Y instead\"), the action is the thing to START. ' +\n 'A question ABOUT a product (\"how much is #3\", \"is the xm5 good on planes\") is a \"reply\" with the answer, not an \"open\". ' +\n 'A pick with no verb is an \"open\", never a \"cart\" or \"save\". Prefer \"clarify\" over guessing between two products. ' +\n 'Write \"reply\" and \"clarify\" text in the language the user wrote in. ' +\n 'The message may be in any language, with slang or typos - route it the same way. Output ONLY the JSON object.';\n\n const user =\n `Products on screen (numbered as displayed):\\n${lines}${more}\\n\\n` +\n `Situation:\\n${situation.map((s) => `- ${s}`).join('\\n')}\\n\\n` +\n `Recent conversation:\\n${renderRecent(state.recent ?? [])}\\n\\n` +\n `User message:\\n${text.trim()}`;\n return [\n { role: 'system', content: system },\n { role: 'user', content: user },\n ];\n}\n\n/**\n * The brain's answer, checked - not second-guessed. An index must point at a\n * row that exists, numbers must be positive, an action must be one we can\n * run. Anything else is \"no verdict\", which the caller reports as such.\n */\nexport function parseVerdict(content: string, state: ShoppingRouterState): ShoppingVerdict | null {\n const obj = parseJsonObject(content);\n if (!obj) return null;\n const n = state.products.length;\n const index = boundedIndex(obj.index, n);\n switch (actionName(obj.action)) {\n case 'search': {\n const query = trimmedString(obj.query);\n if (!query) return null;\n const budget = positiveNumber(obj.budget);\n return { action: 'search', query, ...(budget !== undefined ? { budget } : {}) };\n }\n case 'open':\n case 'save':\n return index !== undefined ? { action: actionName(obj.action) as 'open' | 'save', index } : null;\n case 'cart': {\n if (index === undefined) return null;\n const quantity = Math.min(20, Math.floor(positiveNumber(obj.quantity) ?? 1));\n return { action: 'cart', index, quantity };\n }\n case 'watch': {\n const query = trimmedString(obj.query);\n const targetPrice = positiveNumber(obj.targetPrice);\n return {\n action: 'watch',\n ...(index !== undefined ? { index } : query ? { query } : {}),\n ...(targetPrice !== undefined ? { targetPrice } : {}),\n };\n }\n case 'stop_watch':\n case 'stopwatch':\n return { action: 'stop_watch' };\n case 'clarify': {\n const question = trimmedString(obj.question);\n return question ? { action: 'clarify', candidates: boundedIndexes(obj.candidates, n), question } : null;\n }\n case 'reply': {\n const reply = trimmedString(obj.text);\n return reply ? { action: 'reply', text: reply } : null;\n }\n case 'computer':\n // An index is a courtesy here, not a requirement: \"search amazon\n // for nike shoes\" points at no row and is still the Computer's.\n return { action: 'computer', ...(index !== undefined ? { index } : {}) };\n default:\n return null;\n }\n}\n\n/**\n * Ask the brain. `null` means NO VERDICT (unreachable, timed out, or an answer\n * we could not validate) - which the caller must report, not paper over.\n */\nexport async function routeShoppingViaBrain(\n text: string,\n state: ShoppingRouterState,\n options: CompleteViaBrainOptions = {},\n): Promise<ShoppingVerdict | null> {\n const trimmed = text.trim();\n if (!trimmed) return null;\n const content = await completeViaBrain(buildRouterMessages(trimmed, state), { maxTokens: 300, ...options });\n return content ? parseVerdict(content, state) : null;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA4EA,MAAM,sBAAyB,GAAA,EAAA;A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AA;AAAA,QAC5C;AAAA,OACE,GAAA,IAAA;AAAA;AACN,IACF,KAAK,OACH,EAAA;AACE,MAAM,MAAA,KAAA,GAAQ,aAAc,CAAA,GAAA,CAAI,IAAI,CAAA;AACpC,MAAA,OAAO,KAAQ,GAAA;AAAA,QACb,MAAQ,EAAA,OAAA;AAAA,QACR,IAAM,EAAA;AAAA,OACJ,GAAA,IAAA;AAAA;AACN,IACF,KAAK,UAAA;AAGH,MAAO,OAAA,cAAA,CAAA;AAAA,QACL,MAAQ,EAAA;AAAA,OAAA,EACJ,UAAU,MAAY,GAAA;AAAA,QACxB;AAAA,UACE,EAAC,CAAA;AAAA,IAET;AACE,MAAO,OAAA,IAAA;AAAA;AAEb;AAMA,eAAsB,qBAAsB,CAAA,IAAA,EAAc,KAA4B,EAAA,OAAA,GAAmC,EAAqC,EAAA;AAC5J,EAAM,MAAA,OAAA,GAAU,KAAK,IAAK,EAAA;AAC1B,EAAI,IAAA,CAAC,SAAgB,OAAA,IAAA;AACrB,EAAA,MAAM,UAAU,MAAM,gBAAA,CAAiB,mBAAoB,CAAA,OAAA,EAAS,KAAK,CAAG,EAAA,cAAA,CAAA;AAAA,IAC1E,SAAW,EAAA;AAAA,GAAA,EACR,OACJ,CAAA,CAAA;AACD,EAAA,OAAO,OAAU,GAAA,YAAA,CAAa,OAAS,EAAA,KAAK,CAAI,GAAA,IAAA;AAClD"}
|
|
1
|
+
{"version":3,"file":"brainRouter.js","sources":["../../../../src/features/shopping/chat/brainRouter.ts"],"sourcesContent":["/**\n * Native: the web surface's `chat/brainRouter.ts` (0.37.0) verbatim; the kit\n * helpers and the brain transport are `./brainRouterKit`.\n *\n * What the user meant - decided by yantra-brain from the state of the shop\n * page, never by a word list.\n *\n * \"price check the first one\" used to reach the retailers as a search for the\n * words \"the first one\", and armed a watch on whatever came back; \"open the\n * second one\" and \"add the cheapest one to cart\" did nothing. A hand-written\n * router for those was written and thrown away the same day: it cannot know\n * what people will type, and a wrong guess silently replaces the grid.\n *\n * So the brain gets the grid as the shopper sees it - the numbered products\n * with their prices, ratings and stores, the search behind them, the cart,\n * the watches, the last exchange - and returns ONE verdict in a shape the\n * surface can run. This module builds that ask and validates the answer\n * (bounds and shapes, which is not routing). When the brain does not answer,\n * the surface says so; it does not guess.\n */\nimport {\n actionName,\n boundedIndex,\n boundedIndexes,\n completeViaBrain,\n parseJsonObject,\n positiveNumber,\n renderRecent,\n trimmedString,\n trunc,\n type BrainMessage,\n type CompleteViaBrainOptions,\n} from './brainRouterKit';\nimport type { Product } from '../catalog';\n\nexport interface ChatTurn {\n role: 'user' | 'assistant';\n content: string;\n}\n\nexport interface ShoppingRouterState {\n /** The grid, in the order shown. Index 1 is the first card. */\n products: readonly Product[];\n /** The search behind the grid, if one produced it. */\n query?: string;\n cartCount: number;\n /** Products a price watch was armed on in this session, by name. */\n watching: readonly string[];\n /** The last few turns, oldest first, so \"yes\" and \"the other one\" have a referent. */\n recent?: readonly ChatTurn[];\n}\n\nexport type ShoppingVerdict =\n | { action: 'search'; query: string; budget?: number }\n | { action: 'open'; index: number }\n | { action: 'cart'; index: number; quantity: number }\n | { action: 'save'; index: number }\n | { action: 'watch'; index?: number; query?: string; targetPrice?: number }\n | { action: 'stop_watch' }\n | { action: 'clarify'; candidates: number[]; question: string }\n | { action: 'reply'; text: string }\n /**\n * Not this pane's job: it happens on a real web page. The assistant has a\n * cloud Computer for that, so the turn goes to the agent. `index` points at\n * the product on screen they meant, when they meant one.\n */\n | { action: 'computer'; index?: number }\n /**\n * Holiday deals: Black Friday, Cyber Monday or the season's deals on\n * something (or the season's best), \"is this a real deal\", \"should I\n * wait\", when a store's sale starts. Opens the holiday deals section on\n * `query` (empty: the season's best).\n */\n | { action: 'deals'; query: string }\n /**\n * A social post (TikTok, Instagram, YouTube, Pinterest, Facebook) about a\n * product: read what it is selling, then find it at stores.\n */\n | { action: 'link'; url: string };\n\n/** More rows than this and the list is a wall the model stops reading; the grid has paging anyway. */\nconst MAX_PRODUCTS_IN_PROMPT = 40;\n\nfunction money(price: number): string {\n return Number.isInteger(price) ? `$${price}` : `$${price.toFixed(2)}`;\n}\n\n/** One product as the shopper sees it on the card. */\nexport function productLine(p: Product): string {\n const meta = [\n p.price > 0 ? money(p.price) : undefined,\n p.rating > 0 ? `★ ${p.rating.toFixed(1)}` : undefined,\n p.brand,\n p.source ? `via ${p.source}` : undefined,\n ].filter(Boolean);\n return `${trunc(p.name, 120)}${meta.length ? ` - ${meta.join(' · ')}` : ''}`;\n}\n\n/**\n * The ask. Prose rules, not prompt trickery: what each action means, when it\n * applies, and that the answer is one JSON object. The state is rendered as\n * the person would see it - the numbered grid, then the situation.\n */\nexport function buildRouterMessages(text: string, state: ShoppingRouterState): BrainMessage[] {\n const rows = state.products.slice(0, MAX_PRODUCTS_IN_PROMPT);\n const lines = rows.length\n ? rows.map((p, i) => `${i + 1}. ${productLine(p)}`).join('\\n')\n : '(none - nothing has been searched yet)';\n const more = state.products.length > rows.length ? `\\n…and ${state.products.length - rows.length} more below.` : '';\n\n const situation: string[] = [];\n if (state.query) situation.push(`These products came from the search \"${state.query}\".`);\n // The orders a superlative indexes into, worked out here so the brain\n // reads them instead of doing arithmetic over forty prices - \"the second\n // cheapest\" was the third cheapest when it sorted for itself.\n const tag = (p: Product) => [p.brand, p.source].filter(Boolean).join(', ');\n const entry = (p: Product, i: number, v: string) => `#${i + 1} (${v}${tag(p) ? `, ${tag(p)}` : ''})`;\n const byPrice = rows\n .map((p, i) => ({ p, i, v: p.price }))\n .filter((x) => x.v > 0)\n .sort((a, b) => a.v - b.v);\n if (byPrice.length > 1)\n situation.push(`By price, lowest first: ${byPrice.map((x) => entry(x.p, x.i, money(x.v))).join(', ')}.`);\n const byRating = rows\n .map((p, i) => ({ p, i, v: p.rating }))\n .filter((x) => x.v > 0)\n .sort((a, b) => b.v - a.v);\n if (byRating.length > 1)\n situation.push(`By rating, highest first: ${byRating.map((x) => entry(x.p, x.i, x.v.toFixed(1))).join(', ')}.`);\n situation.push(\n state.cartCount > 0\n ? `The cart has ${state.cartCount} item${state.cartCount === 1 ? '' : 's'}.`\n : 'The cart is empty.',\n );\n situation.push(\n state.watching.length\n ? `Price watches armed this session: ${state.watching.map((n) => `\"${trunc(n, 60)}\"`).join(', ')}.`\n : 'No price watch has been armed this session.',\n );\n\n const system =\n 'You are the router for a shopping assistant that searches real products across many stores, keeps a cart and a saved list, ' +\n \"and can watch a product's price on the user's own cloud Computer. The user types one message; you decide the ONE action \" +\n 'the assistant takes, from the state you are given. You answer with a single JSON object and nothing else.\\n\\n' +\n 'Actions:\\n' +\n '- \"search\": the user describes something to buy or browse - a product, a category, a brand, a need (\"something to keep coffee hot\"), ' +\n 'with or without a budget. {\"action\":\"search\",\"query\":\"<the product words, without the asking verb>\",\"budget\":<max price in dollars, only when stated>}. ' +\n 'Any category counts; you do not need to recognise the product. A search replaces the grid, so only choose it when they want different products.\\n' +\n '- \"open\": show the details of ONE product on screen. They may name it by position (\"the first one\", \"#3\", \"the last one\", ' +\n '\"the second sony one\"), by name, brand or store or a part of it (typos happen), or by a superlative over the list ' +\n '(\"the cheapest\", \"best rated\", \"the most expensive\") - compare the listed prices and ratings yourself. {\"action\":\"open\",\"index\":<1-based number>}. ' +\n 'A bare pick with no verb (\"the second one\") is an open.\\n' +\n '- \"cart\": put ONE product on screen in the cart. {\"action\":\"cart\",\"index\":<n>,\"quantity\":<n, 1 unless they said otherwise>}.\\n' +\n '- \"save\": save / bookmark / wishlist ONE product on screen. {\"action\":\"save\",\"index\":<n>}.\\n' +\n '- \"watch\": track a price - price check, watch, alert me when it drops. For a product on screen: ' +\n '{\"action\":\"watch\",\"index\":<n>,\"targetPrice\":<dollars, only when stated>}. For a product they name that is NOT on screen: ' +\n '{\"action\":\"watch\",\"query\":\"<the product words>\",\"targetPrice\":...}. \"price check\" with nothing named means the whole watchlist: {\"action\":\"watch\"}.\\n' +\n '- \"stop_watch\": stop or pause the price checks, in whatever language it is said (\"stop watching\", \"band kar do\", \"para de vigiar\"). {\"action\":\"stop_watch\"}.\\n' +\n '- \"clarify\": they want to act on ONE product but their words fit SEVERAL on screen, or none clearly (\"add it to the cart\" with many on screen). ' +\n '{\"action\":\"clarify\",\"candidates\":[<the indexes that fit, may be empty>],\"question\":\"<one short question naming them>\"}.\\n' +\n '- \"computer\": the message is about a real web page, not about this grid - searching ON a named store\\'s own site ' +\n '(\"search amazon for nike shoes\", \"in the amazon page search for X\", \"use the computer\"), their signed-in account there ' +\n '(\"my amazon cart\", \"add it to my amazon cart\", \"buy it on amazon\"), a checkout, a payment, opening a product\\'s own page, ' +\n 'or signing in. The assistant has a cloud browser - the user\\'s Computer - and hands the turn to it. {\"action\":\"computer\"}, ' +\n 'or {\"action\":\"computer\",\"index\":<n>} when they mean one of the products on screen (\"open it in the computer\", ' +\n '\"add the first one to my amazon cart\"). Prefer it over \"open\", \"cart\" and \"save\" whenever the message points at a page or a ' +\n 'store account rather than at this list.\\n' +\n '- \"deals\": Black Friday, Cyber Monday or holiday deals - on something (\"black friday deals on a 65 inch tv\", \"cyber monday airpods\") ' +\n 'or the season\\'s best (\"what are the best black friday deals\"), whether a deal is real or they should wait, or when a store\\'s Black Friday ' +\n 'sale starts and reminders for it. {\"action\":\"deals\",\"query\":\"<the product words, empty for the season\\'s best or a store\\'s sale dates>\"}. ' +\n 'Choose it over \"search\" whenever they ask for deals, sales or discounts for the holiday season.\\n' +\n '- \"link\": the message carries a link to a social post - TikTok, Instagram, YouTube, Pinterest, Facebook, X, Threads - about a product ' +\n '(\"saw this on tiktok, is it a good price? https://...\"). {\"action\":\"link\",\"url\":\"<the link exactly as written>\"}. A link to a store\\'s own ' +\n 'product page is not a \"link\": it is a \"computer\" (open it) or a \"search\" (find it elsewhere).\\n' +\n '- \"reply\": nothing to run - a greeting, thanks, a question about the products on screen or about shopping in general, where things stand, a comment. ' +\n '{\"action\":\"reply\",\"text\":\"<a short helpful answer in the assistant\\'s own voice, two or three sentences, plain text, no lists: ' +\n 'answer questions about the products on screen from the numbered list only (their exact prices, ratings and stores), say what is in the cart or being watched when asked, ' +\n 'and when it fits invite them to name what they are looking for. Never invent products, prices, stores or stock>\"}.\\n\\n' +\n 'Rules: never turn small talk or a question into a search. Never point at a product that is not on screen. ' +\n 'NEVER write a \"reply\" that says the assistant cannot browse, cannot open a link, cannot search a store\\'s site, cannot use ' +\n 'the computer, or that it only updates the cart \"in this shopping session\" - every one of those is a \"computer\". ' +\n 'Never answer \"I do not see a product\" to a message that points at the list or at the page; that is a \"computer\" or a \"clarify\". ' +\n 'A \"computer\" message that does not say WHICH product, with several on screen, may be a \"clarify\" naming them - and then the ' +\n 'answer that picks one is a \"computer\" with that index, never an \"open\": the lane the question came from is still the lane. ' +\n 'A store named to pick a row OUT of the list (\"the one from target\", \"the walmart one\", \"the cheapest amazon one\") is ' +\n 'identifying a product, not pointing at that store\\'s site - those are \"open\", \"cart\", \"save\" or \"clarify\" as usual. ' +\n '\"first\" or \"last\" inside a sentence is a position only when it points at the list. For a superlative (\"the cheapest\", \"the second cheapest\", ' +\n '\"best rated\") read the sorted orders in the situation; a brand or store named with it (\"the cheapest sony\") restricts it to those rows. ' +\n 'A comparative between named rows (\"the cheaper sony\", \"the better rated of the two\") is read off the same orders. ' +\n 'One verdict acts on ONE product: when they name several (\"the two cheapest\", \"#2 and #4\"), answer with \"reply\" or \"clarify\" saying you do them one at a time and naming them - never silently act on just one. ' +\n 'When a message stops one thing and starts another (\"stop watching X and watch Y instead\"), the action is the thing to START. ' +\n 'A question ABOUT a product (\"how much is #3\", \"is the xm5 good on planes\") is a \"reply\" with the answer, not an \"open\". ' +\n 'A pick with no verb is an \"open\", never a \"cart\" or \"save\". Prefer \"clarify\" over guessing between two products. ' +\n 'Write \"reply\" and \"clarify\" text in the language the user wrote in. ' +\n 'The message may be in any language, with slang or typos - route it the same way. Output ONLY the JSON object.';\n\n const user =\n `Products on screen (numbered as displayed):\\n${lines}${more}\\n\\n` +\n `Situation:\\n${situation.map((s) => `- ${s}`).join('\\n')}\\n\\n` +\n `Recent conversation:\\n${renderRecent(state.recent ?? [])}\\n\\n` +\n `User message:\\n${text.trim()}`;\n return [\n { role: 'system', content: system },\n { role: 'user', content: user },\n ];\n}\n\n/**\n * The brain's answer, checked - not second-guessed. An index must point at a\n * row that exists, numbers must be positive, an action must be one we can\n * run. Anything else is \"no verdict\", which the caller reports as such.\n */\nexport function parseVerdict(content: string, state: ShoppingRouterState): ShoppingVerdict | null {\n const obj = parseJsonObject(content);\n if (!obj) return null;\n const n = state.products.length;\n const index = boundedIndex(obj.index, n);\n switch (actionName(obj.action)) {\n case 'search': {\n const query = trimmedString(obj.query);\n if (!query) return null;\n const budget = positiveNumber(obj.budget);\n return { action: 'search', query, ...(budget !== undefined ? { budget } : {}) };\n }\n case 'open':\n case 'save':\n return index !== undefined ? { action: actionName(obj.action) as 'open' | 'save', index } : null;\n case 'cart': {\n if (index === undefined) return null;\n const quantity = Math.min(20, Math.floor(positiveNumber(obj.quantity) ?? 1));\n return { action: 'cart', index, quantity };\n }\n case 'watch': {\n const query = trimmedString(obj.query);\n const targetPrice = positiveNumber(obj.targetPrice);\n return {\n action: 'watch',\n ...(index !== undefined ? { index } : query ? { query } : {}),\n ...(targetPrice !== undefined ? { targetPrice } : {}),\n };\n }\n case 'stop_watch':\n case 'stopwatch':\n return { action: 'stop_watch' };\n case 'clarify': {\n const question = trimmedString(obj.question);\n return question ? { action: 'clarify', candidates: boundedIndexes(obj.candidates, n), question } : null;\n }\n case 'reply': {\n const reply = trimmedString(obj.text);\n return reply ? { action: 'reply', text: reply } : null;\n }\n case 'computer':\n // An index is a courtesy here, not a requirement: \"search amazon\n // for nike shoes\" points at no row and is still the Computer's.\n return { action: 'computer', ...(index !== undefined ? { index } : {}) };\n case 'deals':\n // An empty query is the season's best: a valid verdict\n return { action: 'deals', query: typeof obj.query === 'string' ? obj.query.trim().slice(0, 120) : '' };\n case 'link': {\n const url = trimmedString(obj.url);\n return url && /^https?:\\/\\/\\S+$/i.test(url) ? { action: 'link', url } : null;\n }\n default:\n return null;\n }\n}\n\n/**\n * Ask the brain. `null` means NO VERDICT (unreachable, timed out, or an answer\n * we could not validate) - which the caller must report, not paper over.\n */\nexport async function routeShoppingViaBrain(\n text: string,\n state: ShoppingRouterState,\n options: CompleteViaBrainOptions = {},\n): Promise<ShoppingVerdict | null> {\n const trimmed = text.trim();\n if (!trimmed) return null;\n const content = await completeViaBrain(buildRouterMessages(trimmed, state), { maxTokens: 300, ...options });\n return content ? parseVerdict(content, state) : null;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA4FA,MAAM,sBAAyB,GAAA,EAAA;AAC/B,SAAS,MAAM,KAAuB,EAAA;AACpC,EAAO,OAAA,MAAA,CAAO,SAAU,CAAA,KAAK,CAAI,GAAA,CAAA,CAAA,EAAI,KAAK,CAAA,CAAA,GAAK,CAAI,CAAA,EAAA,KAAA,CAAM,OAAQ,CAAA,CAAC,CAAC,CAAA,CAAA;AACrE;AAGO,SAAS,YAAY,CAAoB,EAAA;AAC9C,EAAA,MAAM,IAAO,GAAA,CAAC,CAAE,CAAA,KAAA,GAAQ,IAAI,KAAM,CAAA,CAAA,CAAE,KAAK,CAAA,GAAI,MAAW,EAAA,CAAA,CAAE,MAAS,GAAA,CAAA,GAAI,UAAK,CAAE,CAAA,MAAA,CAAO,OAAQ,CAAA,CAAC,CAAC,CAAA,CAAA,GAAK,MAAW,EAAA,CAAA,CAAE,OAAO,CAAE,CAAA,MAAA,GAAS,CAAO,IAAA,EAAA,CAAA,CAAE,MAAM,CAAA,CAAA,GAAK,MAAS,CAAA,CAAE,OAAO,OAAO,CAAA;AAChL,EAAA,OAAO,CAAG,EAAA,KAAA,CAAM,CAAE,CAAA,IAAA,EAAM,GAAG,CAAC,CAAA,EAAG,IAAK,CAAA,MAAA,GAAS,MAAM,IAAK,CAAA,IAAA,CAAK,QAAK,CAAC,KAAK,EAAE,CAAA,CAAA;AAC5E;AAOgB,SAAA,mBAAA,CAAoB,MAAc,KAA4C,EAAA;AA5G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;AAAA,OACE,GAAA,IAAA;AAAA;AACN,IACF;AACE,MAAO,OAAA,IAAA;AAAA;AAEb;AAMA,eAAsB,qBAAsB,CAAA,IAAA,EAAc,KAA4B,EAAA,OAAA,GAAmC,EAAqC,EAAA;AAC5J,EAAM,MAAA,OAAA,GAAU,KAAK,IAAK,EAAA;AAC1B,EAAI,IAAA,CAAC,SAAgB,OAAA,IAAA;AACrB,EAAA,MAAM,UAAU,MAAM,gBAAA,CAAiB,mBAAoB,CAAA,OAAA,EAAS,KAAK,CAAG,EAAA,cAAA,CAAA;AAAA,IAC1E,SAAW,EAAA;AAAA,GAAA,EACR,OACJ,CAAA,CAAA;AACD,EAAA,OAAO,OAAU,GAAA,YAAA,CAAa,OAAS,EAAA,KAAK,CAAI,GAAA,IAAA;AAClD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {classifyShoppingIntentViaBrain}from'../services/parseShoppingIntentViaBrain.js';import {buildShoppingAttachment}from'../services/buildShoppingAttachment.js';import {routeShoppingViaBrain}from'./brainRouter.js';import {ROUTING_BRAIN_DID_NOT_ANSWER}from'./brainRouterKit.js';import {composeComputerHandoff}from'./computerHandoff.js';var __defProp = Object.defineProperty;
|
|
1
|
+
import {classifyShoppingIntentViaBrain}from'../services/parseShoppingIntentViaBrain.js';import {buildShoppingAttachment}from'../services/buildShoppingAttachment.js';import {blackFridayOpen,checkSocialLink}from'../services/blackFriday.js';import {requestHolidayDeals}from'../state/holidayDealsRequest.js';import {routeShoppingViaBrain}from'./brainRouter.js';import {ROUTING_BRAIN_DID_NOT_ANSWER}from'./brainRouterKit.js';import {composeComputerHandoff}from'./computerHandoff.js';var __defProp = Object.defineProperty;
|
|
2
2
|
var __defProps = Object.defineProperties;
|
|
3
3
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -30,8 +30,26 @@ var __objRest = (source, exclude) => {
|
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
32
|
const COMPUTER_WITHOUT_AN_AGENT = "That one happens on the live page rather than in these results. Ask it in the main chat and I will do it on your Computer.";
|
|
33
|
+
const HOLIDAY_SEASON_OVER = "The holiday deals season is over; it is back next November. I can still search every store for it.";
|
|
34
|
+
const PLATFORM_NAMES = {
|
|
35
|
+
tiktok: "TikTok",
|
|
36
|
+
instagram: "Instagram",
|
|
37
|
+
youtube: "YouTube",
|
|
38
|
+
pinterest: "Pinterest",
|
|
39
|
+
facebook: "Facebook",
|
|
40
|
+
reddit: "Reddit",
|
|
41
|
+
x: "X",
|
|
42
|
+
threads: "Threads"
|
|
43
|
+
};
|
|
44
|
+
function socialPostLine(post, words) {
|
|
45
|
+
const place = PLATFORM_NAMES[post.platform] ? `the ${PLATFORM_NAMES[post.platform]} post` : "that page";
|
|
46
|
+
const said = post.prices.length ? ` It says $${post.prices[0]}.` : "";
|
|
47
|
+
const unknown = post.shopLinks.filter((link) => !link.known).map((link) => link.host);
|
|
48
|
+
const warn = unknown.length ? ` Its link goes to ${unknown.join(", ")}, a store we do not know - check it before you pay.` : "";
|
|
49
|
+
return `From ${place}: ${words}.${said}${warn} Here it is at stores you know.`;
|
|
50
|
+
}
|
|
33
51
|
async function decideShoppingTurn(text, state, deps) {
|
|
34
|
-
var _a, _b, _d;
|
|
52
|
+
var _a, _b, _c, _d, _e, _f, _h;
|
|
35
53
|
const route = (_a = deps.route) != null ? _a : routeShoppingViaBrain;
|
|
36
54
|
const classify = (_b = deps.classify) != null ? _b : classifyShoppingIntentViaBrain;
|
|
37
55
|
const verdict = await route(text, __spreadValues(__spreadProps(__spreadValues({
|
|
@@ -76,31 +94,85 @@ async function decideShoppingTurn(text, state, deps) {
|
|
|
76
94
|
}
|
|
77
95
|
};
|
|
78
96
|
}
|
|
79
|
-
if (verdict.action
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
97
|
+
if (verdict.action === "deals") {
|
|
98
|
+
const nothing = buildShoppingAttachment([], {
|
|
99
|
+
query: text,
|
|
100
|
+
totalCount: 0
|
|
101
|
+
});
|
|
102
|
+
if (!((_c = deps.seasonOpen) != null ? _c : blackFridayOpen)()) {
|
|
103
|
+
return {
|
|
104
|
+
kind: "reply",
|
|
105
|
+
result: {
|
|
106
|
+
attachment: nothing,
|
|
107
|
+
pick: true,
|
|
108
|
+
messageContent: HOLIDAY_SEASON_OVER
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
((_d = deps.openHolidayDeals) != null ? _d : requestHolidayDeals)(verdict.query);
|
|
113
|
+
return {
|
|
114
|
+
kind: "deals",
|
|
115
|
+
query: verdict.query,
|
|
116
|
+
result: {
|
|
117
|
+
attachment: nothing,
|
|
118
|
+
pick: true,
|
|
119
|
+
messageContent: verdict.query ? `Here are the holiday deals on \u201C${verdict.query}\u201D: real markdowns only, each saying whether its price is really low.` : "Here are the season's best deals, real lows first, with each store's sale dates."
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
let fromPost;
|
|
124
|
+
let searchWords;
|
|
125
|
+
if (verdict.action === "link") {
|
|
126
|
+
const post = await ((_e = deps.checkLink) != null ? _e : checkSocialLink)({
|
|
127
|
+
url: verdict.url,
|
|
128
|
+
text
|
|
129
|
+
}).catch(() => null);
|
|
130
|
+
searchWords = (_f = post == null ? void 0 : post.productName) != null ? _f : post == null ? void 0 : post.query;
|
|
131
|
+
if (!post || !searchWords) {
|
|
132
|
+
return {
|
|
133
|
+
kind: "reply",
|
|
134
|
+
result: {
|
|
135
|
+
attachment: buildShoppingAttachment([], {
|
|
136
|
+
query: text,
|
|
137
|
+
totalCount: 0
|
|
138
|
+
}),
|
|
139
|
+
pick: true,
|
|
140
|
+
messageContent: `I could not tell what that post is selling${(post == null ? void 0 : post.note) ? ` (${post.note})` : ""}. What is the product called?`
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
fromPost = socialPostLine(post, searchWords);
|
|
145
|
+
} else if (verdict.action !== "search") {
|
|
146
|
+
return {
|
|
147
|
+
kind: "reply",
|
|
148
|
+
result: await deps.runPickVerdict(verdict)
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
const words = searchWords != null ? searchWords : verdict.action === "search" ? verdict.query : "";
|
|
152
|
+
const budget = verdict.action === "search" ? verdict.budget : void 0;
|
|
83
153
|
const {
|
|
84
154
|
intent
|
|
85
|
-
} = await classify(
|
|
155
|
+
} = await classify(words, {
|
|
86
156
|
assumeShopping: true
|
|
87
157
|
});
|
|
88
|
-
const
|
|
89
|
-
query:
|
|
158
|
+
const _g = intent != null ? intent : {
|
|
159
|
+
query: words
|
|
90
160
|
}, {
|
|
91
161
|
monitor: _monitor,
|
|
92
162
|
targetPrice: _target
|
|
93
|
-
} =
|
|
163
|
+
} = _g, shape = __objRest(_g, [
|
|
94
164
|
"monitor",
|
|
95
165
|
"targetPrice"
|
|
96
166
|
]);
|
|
97
167
|
const shaped = __spreadValues(__spreadProps(__spreadValues({}, shape), {
|
|
98
|
-
query: ((
|
|
99
|
-
}),
|
|
100
|
-
budget
|
|
168
|
+
query: ((_h = shape.query) == null ? void 0 : _h.trim()) || words
|
|
169
|
+
}), budget !== void 0 && shape.budget === void 0 ? {
|
|
170
|
+
budget
|
|
101
171
|
} : {});
|
|
102
|
-
return {
|
|
172
|
+
return __spreadValues({
|
|
103
173
|
kind: "search",
|
|
104
174
|
intent: shaped
|
|
105
|
-
}
|
|
106
|
-
|
|
175
|
+
}, fromPost ? {
|
|
176
|
+
lead: fromPost
|
|
177
|
+
} : {});
|
|
178
|
+
}export{COMPUTER_WITHOUT_AN_AGENT,HOLIDAY_SEASON_OVER,decideShoppingTurn,socialPostLine};//# sourceMappingURL=shoppingTurn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shoppingTurn.js","sources":["../../../../src/features/shopping/chat/shoppingTurn.ts"],"sourcesContent":["/**\n * One typed Shopping Agent turn, decided - native twin of the web surface's\n * `ShoppingSearchContext.applyFromAnalysis` (0.37.0), kept apart from the pane\n * so the routing is testable without rendering a chat.\n *\n * What the message means is the brain's call, made from the grid the shopper\n * is looking at, the cart, the watches and the last exchange - one verdict\n * (chat/brainRouter.ts); this only sorts it into what the pane runs:\n *\n * - `search`: the classify lane SHAPES the brain's query (relevance\n * vocabulary, department; its monitor verdict is not read - watching was\n * the router's call) and the pane runs `applyFromChatIntent` with it;\n * - `handoff`: a turn about a live page goes to the agent, with the product on\n * screen it pointed at (chat/computerHandoff.ts);\n * - `reply`: everything else was run on the grid (`runPickVerdict`) and comes\n * back as prose - including no verdict at all, which is said, never guessed.\n */\nimport type { Product } from '../catalog';\nimport type { ParsedShoppingIntent } from '../services/parseShoppingIntent';\nimport { classifyShoppingIntentViaBrain } from '../services/parseShoppingIntentViaBrain';\nimport { buildShoppingAttachment } from '../services/buildShoppingAttachment';\nimport type { ShoppingChatSearchResult } from '../useShoppingSearch';\nimport { routeShoppingViaBrain, type ChatTurn, type ShoppingVerdict } from './brainRouter';\nimport { ROUTING_BRAIN_DID_NOT_ANSWER } from './brainRouterKit';\nimport { composeComputerHandoff } from './computerHandoff';\n\n/**\n * Shown only where there is no agent to hand to. It says what is true there\n * rather than pretending the pane can drive a page.\n */\nexport const COMPUTER_WITHOUT_AN_AGENT =\n 'That one happens on the live page rather than in these results. Ask it in the main chat and I will do it on your Computer.';\n\nexport type PickVerdict = Exclude<ShoppingVerdict, { action: 'search' } | { action: 'computer' }>;\n\nexport interface ShoppingTurnState {\n /** The cards as the shopper sees them: only those meeting the request. */\n products: readonly Product[];\n /** The search behind the grid. */\n query?: string;\n cartCount: number;\n watching: readonly string[];\n recent?: ChatTurn[];\n}\n\nexport interface ShoppingTurnDeps {\n runPickVerdict: (verdict: PickVerdict) => Promise<ShoppingChatSearchResult>;\n /** The router; the brain's by default (tests hand in their own). */\n route?: typeof routeShoppingViaBrain;\n /** The classify lane that shapes a search; the brain's by default. */\n classify?: typeof classifyShoppingIntentViaBrain;\n}\n\nexport type ShoppingTurnOutcome =\n | { kind: 'search'; intent: ParsedShoppingIntent }\n | { kind: 'handoff'; text: string; result: ShoppingChatSearchResult }\n | { kind: 'reply'; result: ShoppingChatSearchResult };\n\nexport async function decideShoppingTurn(\n text: string,\n state: ShoppingTurnState,\n deps: ShoppingTurnDeps,\n): Promise<ShoppingTurnOutcome> {\n const route = deps.route ?? routeShoppingViaBrain;\n const classify = deps.classify ?? classifyShoppingIntentViaBrain;\n const verdict = await route(text, {\n products: state.products,\n ...(state.query ? { query: state.query } : {}),\n cartCount: state.cartCount,\n watching: state.watching,\n ...(state.recent ? { recent: state.recent } : {}),\n });\n if (!verdict) {\n return {\n kind: 'reply',\n result: {\n attachment: buildShoppingAttachment([], { query: text, totalCount: 0 }),\n messageContent: ROUTING_BRAIN_DID_NOT_ANSWER,\n pick: true,\n },\n };\n }\n if (verdict.action === 'computer') {\n // Not this pane's turn. It is about a live page - a store's own site,\n // their account there, a cart or a checkout - and the agent has the\n // Computer for it.\n const product = verdict.index !== undefined ? state.products[verdict.index - 1] : undefined;\n const handoff = composeComputerHandoff(text, product);\n return {\n kind: 'handoff',\n text: handoff,\n result: {\n attachment: buildShoppingAttachment([], { query: text, totalCount: 0 }),\n messageContent: COMPUTER_WITHOUT_AN_AGENT,\n pick: true,\n handoff: { text: handoff },\n },\n };\n }\n if (verdict.action !== 'search') return { kind: 'reply', result: await deps.runPickVerdict(verdict) };\n\n // A search. The classify lane SHAPES it - relevance vocabulary (product\n // type, synonyms, exclusions) and the department - and when that lane is\n // out, the brain's own words go to the retailers as they are. Its monitor\n // verdict is not read: watching was the router's call to make.\n const { intent } = await classify(verdict.query, { assumeShopping: true });\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { monitor: _monitor, targetPrice: _target, ...shape } = intent ?? { query: verdict.query };\n const shaped: ParsedShoppingIntent = {\n ...shape,\n query: shape.query?.trim() || verdict.query,\n ...(verdict.budget !== undefined && shape.budget === undefined ? { budget: verdict.bud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A,IAAA,GAAA,MAAA,GAAA,EAAA,CAAa,WAAU,OAAQ,CAAA;AAAA,GAAA,CAAA,EAClC,OAAQ,CAAA,MAAA,KAAW,MAAa,IAAA,KAAA,CAAM,WAAW,MAAY,GAAA;AAAA,IAC/D,QAAQ,OAAQ,CAAA;AAAA,MACd,EAAC,CAAA;AAEP,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,QAAA;AAAA,IACN,MAAQ,EAAA;AAAA,GACV;AACF"}
|
|
1
|
+
{"version":3,"file":"shoppingTurn.js","sources":["../../../../src/features/shopping/chat/shoppingTurn.ts"],"sourcesContent":["/**\n * One typed Shopping Agent turn, decided - native twin of the web surface's\n * `ShoppingSearchContext.applyFromAnalysis` (0.49.0), kept apart from the pane\n * so the routing is testable without rendering a chat.\n *\n * What the message means is the brain's call, made from the grid the shopper\n * is looking at, the cart, the watches and the last exchange - one verdict\n * (chat/brainRouter.ts); this only sorts it into what the pane runs:\n *\n * - `search`: the classify lane SHAPES the brain's query (relevance\n * vocabulary, department; its monitor verdict is not read - watching was\n * the router's call) and the pane runs `applyFromChatIntent` with it;\n * - `handoff`: a turn about a live page goes to the agent, with the product on\n * screen it pointed at (chat/computerHandoff.ts);\n * - `deals` (0.49.0): holiday deals asked for (\"black friday deals on a 65\n * inch tv\") put a request for the holiday deals section\n * (state/holidayDealsRequest.ts) and say so; out of season, a `reply` says\n * the season is over;\n * - a social post's link (0.49.0, verdict `link`): LINK_CHECK reads what it\n * sells, then it is a `search` for that product, with `lead` - what the post\n * sells, its price and a store to check - said before the results;\n * - `reply`: everything else was run on the grid (`runPickVerdict`) and comes\n * back as prose - including no verdict at all, which is said, never guessed.\n */\nimport type { Product } from '../catalog';\nimport type { ParsedShoppingIntent } from '../services/parseShoppingIntent';\nimport { classifyShoppingIntentViaBrain } from '../services/parseShoppingIntentViaBrain';\nimport { buildShoppingAttachment } from '../services/buildShoppingAttachment';\nimport { blackFridayOpen, checkSocialLink } from '../services/blackFriday';\nimport { requestHolidayDeals } from '../state/holidayDealsRequest';\nimport type { ShoppingChatSearchResult } from '../useShoppingSearch';\nimport { routeShoppingViaBrain, type ChatTurn, type ShoppingVerdict } from './brainRouter';\nimport { ROUTING_BRAIN_DID_NOT_ANSWER } from './brainRouterKit';\nimport { composeComputerHandoff } from './computerHandoff';\n\n/**\n * Shown only where there is no agent to hand to. It says what is true there\n * rather than pretending the pane can drive a page.\n */\nexport const COMPUTER_WITHOUT_AN_AGENT =\n 'That one happens on the live page rather than in these results. Ask it in the main chat and I will do it on your Computer.';\n\n/** A holiday deals ask once the season (Nov 1 - Dec 24) is over. */\nexport const HOLIDAY_SEASON_OVER =\n 'The holiday deals season is over; it is back next November. I can still search every store for it.';\n\nexport type PickVerdict = Exclude<\n ShoppingVerdict,\n { action: 'search' } | { action: 'computer' } | { action: 'deals' } | { action: 'link' }\n>;\n\nconst PLATFORM_NAMES: Record<string, string> = {\n tiktok: 'TikTok',\n instagram: 'Instagram',\n youtube: 'YouTube',\n pinterest: 'Pinterest',\n facebook: 'Facebook',\n reddit: 'Reddit',\n x: 'X',\n threads: 'Threads',\n};\n\n/** What the chat says about a social post before the store results: what it sells, its price, a store to check. */\nexport function socialPostLine(\n post: { platform: string; prices: number[]; shopLinks: Array<{ host: string; known: boolean }> },\n words: string,\n): string {\n const place = PLATFORM_NAMES[post.platform] ? `the ${PLATFORM_NAMES[post.platform]} post` : 'that page';\n const said = post.prices.length ? ` It says $${post.prices[0]}.` : '';\n const unknown = post.shopLinks.filter((link) => !link.known).map((link) => link.host);\n const warn = unknown.length\n ? ` Its link goes to ${unknown.join(', ')}, a store we do not know - check it before you pay.`\n : '';\n return `From ${place}: ${words}.${said}${warn} Here it is at stores you know.`;\n}\n\nexport interface ShoppingTurnState {\n /** The cards as the shopper sees them: only those meeting the request. */\n products: readonly Product[];\n /** The search behind the grid. */\n query?: string;\n cartCount: number;\n watching: readonly string[];\n recent?: ChatTurn[];\n}\n\nexport interface ShoppingTurnDeps {\n runPickVerdict: (verdict: PickVerdict) => Promise<ShoppingChatSearchResult>;\n /** The router; the brain's by default (tests hand in their own). */\n route?: typeof routeShoppingViaBrain;\n /** The classify lane that shapes a search; the brain's by default. */\n classify?: typeof classifyShoppingIntentViaBrain;\n /** Reads what a social post sells (LINK_CHECK); the connector's by default. */\n checkLink?: typeof checkSocialLink;\n /** Opens the holiday deals section on a query; the shared request store by default. */\n openHolidayDeals?: (query: string) => void;\n /** Whether the holiday deals season is on; the section's own clock by default. */\n seasonOpen?: () => boolean;\n}\n\nexport type ShoppingTurnOutcome =\n /** `lead`: said before the results (what a social post sells, for a `link`). */\n | { kind: 'search'; intent: ParsedShoppingIntent; lead?: string }\n /** The holiday deals section was asked to open on `query`; `result` is what the chat says. */\n | { kind: 'deals'; query: string; result: ShoppingChatSearchResult }\n | { kind: 'handoff'; text: string; result: ShoppingChatSearchResult }\n | { kind: 'reply'; result: ShoppingChatSearchResult };\n\nexport async function decideShoppingTurn(\n text: string,\n state: ShoppingTurnState,\n deps: ShoppingTurnDeps,\n): Promise<ShoppingTurnOutcome> {\n const route = deps.route ?? routeShoppingViaBrain;\n const classify = deps.classify ?? classifyShoppingIntentViaBrain;\n const verdict = await route(text, {\n products: state.products,\n ...(state.query ? { query: state.query } : {}),\n cartCount: state.cartCount,\n watching: state.watching,\n ...(state.recent ? { recent: state.recent } : {}),\n });\n if (!verdict) {\n return {\n kind: 'reply',\n result: {\n attachment: buildShoppingAttachment([], { query: text, totalCount: 0 }),\n messageContent: ROUTING_BRAIN_DID_NOT_ANSWER,\n pick: true,\n },\n };\n }\n if (verdict.action === 'computer') {\n // Not this pane's turn. It is about a live page - a store's own site,\n // their account there, a cart or a checkout - and the agent has the\n // Computer for it.\n const product = verdict.index !== undefined ? state.products[verdict.index - 1] : undefined;\n const handoff = composeComputerHandoff(text, product);\n return {\n kind: 'handoff',\n text: handoff,\n result: {\n attachment: buildShoppingAttachment([], { query: text, totalCount: 0 }),\n messageContent: COMPUTER_WITHOUT_AN_AGENT,\n pick: true,\n handoff: { text: handoff },\n },\n };\n }\n if (verdict.action === 'deals') {\n // Holiday deals: the section that reads every deal site and says whether each price is real\n const nothing = buildShoppingAttachment([], { query: text, totalCount: 0 });\n if (!(deps.seasonOpen ?? blackFridayOpen)()) {\n return { kind: 'reply', result: { attachment: nothing, pick: true, messageContent: HOLIDAY_SEASON_OVER } };\n }\n (deps.openHolidayDeals ?? requestHolidayDeals)(verdict.query);\n return {\n kind: 'deals',\n query: verdict.query,\n result: {\n attachment: nothing,\n pick: true,\n messageContent: verdict.query\n ? `Here are the holiday deals on “${verdict.query}”: real markdowns only, each saying whether its price is really low.`\n : \"Here are the season's best deals, real lows first, with each store's sale dates.\",\n },\n };\n }\n let fromPost: string | undefined;\n let searchWords: string | undefined;\n if (verdict.action === 'link') {\n // A social post: what it is selling, then that product at the stores\n const post = await (deps.checkLink ?? checkSocialLink)({ url: verdict.url, text }).catch(() => null);\n searchWords = post?.productName ?? post?.query;\n if (!post || !searchWords) {\n return {\n kind: 'reply',\n result: {\n attachment: buildShoppingAttachment([], { query: text, totalCount: 0 }),\n pick: true,\n messageContent: `I could not tell what that post is selling${post?.note ? ` (${post.note})` : ''}. What is the product called?`,\n },\n };\n }\n fromPost = socialPostLine(post, searchWords);\n } else if (verdict.action !== 'search') {\n return { kind: 'reply', result: await deps.runPickVerdict(verdict) };\n }\n const words = searchWords ?? (verdict.action === 'search' ? verdict.query : '');\n const budget = verdict.action === 'search' ? verdict.budget : undefined;\n\n // A search. The classify lane SHAPES it - relevance vocabulary (product\n // type, synonyms, exclusions) and the department - and when that lane is\n // out, the brain's own words go to the retailers as they are. Its monitor\n // verdict is not read: watching was the router's call to make.\n const { intent } = await classify(words, { assumeShopping: true });\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { monitor: _monitor, targetPrice: _target, ...shape } = intent ?? { query: words };\n const shaped: ParsedShoppingIntent = {\n ...shape,\n query: shape.query?.trim() || words,\n ...(budget !== undefined && shape.budget === undefined ? { budget } : {}),\n };\n return {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