@athenaintel/react 0.43.0 → 0.50.0
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/README.md +258 -8
- package/dist/agent-runtime/src/answer-label.cjs +137 -0
- package/dist/agent-runtime/src/answer-label.cjs.map +1 -0
- package/dist/agent-runtime/src/answer-label.d.ts +104 -0
- package/dist/agent-runtime/src/answer-label.js +137 -0
- package/dist/agent-runtime/src/answer-label.js.map +1 -0
- package/dist/agent-runtime/src/answer-rows.cjs +180 -0
- package/dist/agent-runtime/src/answer-rows.cjs.map +1 -0
- package/dist/agent-runtime/src/answer-rows.d.ts +86 -0
- package/dist/agent-runtime/src/answer-rows.js +180 -0
- package/dist/agent-runtime/src/answer-rows.js.map +1 -0
- package/dist/agent-runtime/src/call-recap.cjs +319 -0
- package/dist/agent-runtime/src/call-recap.cjs.map +1 -0
- package/dist/agent-runtime/src/call-recap.d.ts +142 -0
- package/dist/agent-runtime/src/call-recap.js +319 -0
- package/dist/agent-runtime/src/call-recap.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-store.cjs +1 -0
- package/dist/agent-runtime/src/chat-outbox-store.cjs.map +1 -1
- package/dist/agent-runtime/src/chat-outbox-store.d.ts +7 -0
- package/dist/agent-runtime/src/chat-outbox-store.js +1 -0
- package/dist/agent-runtime/src/chat-outbox-store.js.map +1 -1
- package/dist/agent-runtime/src/chat-outbox.cjs +46 -5
- package/dist/agent-runtime/src/chat-outbox.cjs.map +1 -1
- package/dist/agent-runtime/src/chat-outbox.d.ts +29 -0
- package/dist/agent-runtime/src/chat-outbox.js +46 -5
- package/dist/agent-runtime/src/chat-outbox.js.map +1 -1
- package/dist/agent-runtime/src/client-tool-bridge.cjs +15 -15
- package/dist/agent-runtime/src/client-tool-bridge.cjs.map +1 -1
- package/dist/agent-runtime/src/conversation-index.cjs +8 -8
- package/dist/agent-runtime/src/conversation-index.cjs.map +1 -1
- package/dist/agent-runtime/src/conversation-index.d.ts +7 -0
- package/dist/agent-runtime/src/conversation-index.js.map +1 -1
- package/dist/agent-runtime/src/conversation-list.cjs +2 -1
- package/dist/agent-runtime/src/conversation-list.cjs.map +1 -1
- package/dist/agent-runtime/src/conversation-list.d.ts +19 -3
- package/dist/agent-runtime/src/conversation-list.js +2 -1
- package/dist/agent-runtime/src/conversation-list.js.map +1 -1
- package/dist/agent-runtime/src/decision-checks.cjs +207 -0
- package/dist/agent-runtime/src/decision-checks.cjs.map +1 -0
- package/dist/agent-runtime/src/decision-checks.d.ts +142 -0
- package/dist/agent-runtime/src/decision-checks.js +207 -0
- package/dist/agent-runtime/src/decision-checks.js.map +1 -0
- package/dist/agent-runtime/src/desktop-handoff.d.ts +12 -0
- package/dist/agent-runtime/src/errors.cjs +18 -0
- package/dist/agent-runtime/src/errors.cjs.map +1 -1
- package/dist/agent-runtime/src/errors.d.ts +7 -0
- package/dist/agent-runtime/src/errors.js +18 -0
- package/dist/agent-runtime/src/errors.js.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs +12 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +6 -6
- package/dist/agent-runtime/src/generated/runconfig-contract.js +12 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
- package/dist/agent-runtime/src/handoff-arrival.cjs +60 -0
- package/dist/agent-runtime/src/handoff-arrival.cjs.map +1 -0
- package/dist/agent-runtime/src/handoff-arrival.d.ts +46 -0
- package/dist/agent-runtime/src/handoff-arrival.js +60 -0
- package/dist/agent-runtime/src/handoff-arrival.js.map +1 -0
- package/dist/agent-runtime/src/index.d.ts +16 -9
- package/dist/agent-runtime/src/interrupts.cjs +71 -19
- package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
- package/dist/agent-runtime/src/interrupts.d.ts +40 -3
- package/dist/agent-runtime/src/interrupts.js +56 -4
- package/dist/agent-runtime/src/interrupts.js.map +1 -1
- package/dist/agent-runtime/src/lane-history.cjs +8 -8
- package/dist/agent-runtime/src/lane-history.cjs.map +1 -1
- package/dist/agent-runtime/src/messages.cjs +43 -8
- package/dist/agent-runtime/src/messages.cjs.map +1 -1
- package/dist/agent-runtime/src/messages.d.ts +25 -3
- package/dist/agent-runtime/src/messages.js +43 -8
- package/dist/agent-runtime/src/messages.js.map +1 -1
- package/dist/agent-runtime/src/model-context.cjs +3 -2
- package/dist/agent-runtime/src/model-context.cjs.map +1 -1
- package/dist/agent-runtime/src/model-context.d.ts +6 -1
- package/dist/agent-runtime/src/model-context.js +3 -2
- package/dist/agent-runtime/src/model-context.js.map +1 -1
- package/dist/agent-runtime/src/offline-status.cjs +36 -0
- package/dist/agent-runtime/src/offline-status.cjs.map +1 -0
- package/dist/agent-runtime/src/offline-status.d.ts +118 -3
- package/dist/agent-runtime/src/offline-status.js +36 -0
- package/dist/agent-runtime/src/offline-status.js.map +1 -0
- package/dist/agent-runtime/src/queue.cjs +0 -9
- package/dist/agent-runtime/src/queue.cjs.map +1 -1
- package/dist/agent-runtime/src/queue.js +0 -9
- package/dist/agent-runtime/src/queue.js.map +1 -1
- package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs +9 -9
- package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
- package/dist/agent-runtime/src/runtime-catalog.cjs +42 -0
- package/dist/agent-runtime/src/runtime-catalog.cjs.map +1 -0
- package/dist/agent-runtime/src/runtime-catalog.d.ts +35 -0
- package/dist/agent-runtime/src/runtime-catalog.js +42 -0
- package/dist/agent-runtime/src/runtime-catalog.js.map +1 -0
- package/dist/agent-runtime/src/runtime-messages.cjs.map +1 -1
- package/dist/agent-runtime/src/runtime-messages.d.ts +1 -1
- package/dist/agent-runtime/src/runtime-messages.js.map +1 -1
- package/dist/agent-runtime/src/runtime.d.ts +41 -0
- package/dist/agent-runtime/src/send-recovery.cjs +37 -3
- package/dist/agent-runtime/src/send-recovery.cjs.map +1 -1
- package/dist/agent-runtime/src/send-recovery.d.ts +19 -0
- package/dist/agent-runtime/src/send-recovery.js +37 -3
- package/dist/agent-runtime/src/send-recovery.js.map +1 -1
- package/dist/agent-runtime/src/statewire-suspended.cjs +3 -3
- package/dist/agent-runtime/src/statewire-suspended.cjs.map +1 -1
- package/dist/agent-runtime/src/subagents.cjs +32 -2
- package/dist/agent-runtime/src/subagents.cjs.map +1 -1
- package/dist/agent-runtime/src/subagents.d.ts +9 -0
- package/dist/agent-runtime/src/subagents.js +30 -0
- package/dist/agent-runtime/src/subagents.js.map +1 -1
- package/dist/agent-runtime/src/thread-driver.cjs +67 -0
- package/dist/agent-runtime/src/thread-driver.cjs.map +1 -0
- package/dist/agent-runtime/src/thread-driver.d.ts +49 -0
- package/dist/agent-runtime/src/thread-driver.js +67 -0
- package/dist/agent-runtime/src/thread-driver.js.map +1 -0
- package/dist/agent-runtime/src/thread-handoff-flow-machine.d.ts +172 -0
- package/dist/agent-runtime/src/thread-handoff-protocol.d.ts +868 -0
- package/dist/agent-runtime/src/thread-handoff-qr.d.ts +11 -0
- package/dist/agent-runtime/src/thread-handoff.d.ts +3 -364
- package/dist/agent-runtime/src/thread-status.cjs +3 -3
- package/dist/agent-runtime/src/thread-status.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-metadata.cjs +210 -25
- package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-metadata.d.ts +12 -0
- package/dist/agent-runtime/src/tool-metadata.js +210 -25
- package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
- package/dist/agent-runtime/src/tool-names.cjs +2 -0
- package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-names.d.ts +2 -0
- package/dist/agent-runtime/src/tool-names.js +2 -0
- package/dist/agent-runtime/src/tool-names.js.map +1 -1
- package/dist/agent-runtime/src/types.d.ts +10 -2
- package/dist/agent-runtime/src/use-conversation-list.cjs +14 -13
- package/dist/agent-runtime/src/use-conversation-list.cjs.map +1 -1
- package/dist/agent-runtime/src/use-conversation-list.d.ts +6 -0
- package/dist/agent-runtime/src/use-conversation-list.js +3 -2
- package/dist/agent-runtime/src/use-conversation-list.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +45 -20
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +10 -3
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +27 -2
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-config.cjs +14 -14
- package/dist/agent-runtime/src/use-deep-agent-config.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs +6 -6
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +40 -22
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +17 -0
- package/dist/agent-runtime/src/use-deep-agent-runtime.js +24 -6
- package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs +45 -45
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs +588 -130
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +162 -10
- package/dist/agent-runtime/src/use-deep-agent-voice.js +529 -71
- package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs +26 -26
- package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs.map +1 -1
- package/dist/agent-runtime/src/use-historical-edit-attachments.cjs +4 -4
- package/dist/agent-runtime/src/use-historical-edit-attachments.cjs.map +1 -1
- package/dist/agent-runtime/src/use-thread-handoff-flow.d.ts +34 -26
- package/dist/agent-runtime/src/voice-earcon.cjs +139 -0
- package/dist/agent-runtime/src/voice-earcon.cjs.map +1 -0
- package/dist/agent-runtime/src/voice-earcon.d.ts +38 -0
- package/dist/agent-runtime/src/voice-earcon.js +139 -0
- package/dist/agent-runtime/src/voice-earcon.js.map +1 -0
- package/dist/agent-runtime/src/voice-media.cjs +117 -0
- package/dist/agent-runtime/src/voice-media.cjs.map +1 -0
- package/dist/agent-runtime/src/voice-media.d.ts +63 -0
- package/dist/agent-runtime/src/voice-media.js +117 -0
- package/dist/agent-runtime/src/voice-media.js.map +1 -0
- package/dist/agent-runtime/src/voice-presentation.cjs +2 -0
- package/dist/agent-runtime/src/voice-presentation.cjs.map +1 -1
- package/dist/agent-runtime/src/voice-presentation.js +2 -0
- package/dist/agent-runtime/src/voice-presentation.js.map +1 -1
- package/dist/agent-runtime/src/voice-wire-types.d.ts +32 -0
- package/dist/assets/AssetPanel.cjs +11 -11
- package/dist/assets/AssetPanel.cjs.map +1 -1
- package/dist/assets/AthenaAssetEmbed.cjs +11 -9
- package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
- package/dist/assets/AthenaAssetEmbed.d.ts +18 -5
- package/dist/assets/AthenaAssetEmbed.js +4 -2
- package/dist/assets/AthenaAssetEmbed.js.map +1 -1
- package/dist/assets/AthenaLayout.cjs +16 -16
- package/dist/assets/AthenaLayout.cjs.map +1 -1
- package/dist/assets/use-asset-content.cjs +4 -4
- package/dist/assets/use-asset-content.cjs.map +1 -1
- package/dist/assets/use-asset-embed.cjs +14 -7
- package/dist/assets/use-asset-embed.cjs.map +1 -1
- package/dist/assets/use-asset-embed.d.ts +23 -6
- package/dist/assets/use-asset-embed.js +10 -3
- package/dist/assets/use-asset-embed.js.map +1 -1
- package/dist/auth/AthenaAuthContext.cjs +3 -3
- package/dist/auth/AthenaAuthContext.cjs.map +1 -1
- package/dist/auth/AthenaAuthProvider.cjs +8 -8
- package/dist/auth/AthenaAuthProvider.cjs.map +1 -1
- package/dist/auth/AthenaCredentialSourceContext.cjs +5 -5
- package/dist/auth/AthenaCredentialSourceContext.cjs.map +1 -1
- package/dist/auth/AthenaSSOProvider.cjs +14 -14
- package/dist/auth/AthenaSSOProvider.cjs.map +1 -1
- package/dist/auth/credential-source.cjs +26 -13
- package/dist/auth/credential-source.cjs.map +1 -1
- package/dist/auth/credential-source.d.ts +8 -0
- package/dist/auth/credential-source.js +26 -13
- package/dist/auth/credential-source.js.map +1 -1
- package/dist/catalog/agent-model-options.cjs +25 -17
- package/dist/catalog/agent-model-options.cjs.map +1 -1
- package/dist/catalog/agent-model-options.d.ts +38 -5
- package/dist/catalog/agent-model-options.js +25 -17
- package/dist/catalog/agent-model-options.js.map +1 -1
- package/dist/catalog/channel-refusal.cjs +36 -0
- package/dist/catalog/channel-refusal.cjs.map +1 -0
- package/dist/catalog/channel-refusal.d.ts +29 -0
- package/dist/catalog/channel-refusal.js +36 -0
- package/dist/catalog/channel-refusal.js.map +1 -0
- package/dist/catalog/chat-pickers.cjs +60 -24
- package/dist/catalog/chat-pickers.cjs.map +1 -1
- package/dist/catalog/chat-pickers.d.ts +12 -2
- package/dist/catalog/chat-pickers.js +56 -20
- package/dist/catalog/chat-pickers.js.map +1 -1
- package/dist/catalog/runtime-catalog.cjs +89 -23
- package/dist/catalog/runtime-catalog.cjs.map +1 -1
- package/dist/catalog/runtime-catalog.d.ts +8 -2
- package/dist/catalog/runtime-catalog.js +83 -17
- package/dist/catalog/runtime-catalog.js.map +1 -1
- package/dist/catalog/use-athena-chat-mode.cjs +12 -12
- package/dist/catalog/use-athena-chat-mode.cjs.map +1 -1
- package/dist/chat/AthenaChat.cjs +155 -67
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +42 -2
- package/dist/chat/AthenaChat.js +106 -18
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/chat/AthenaChatErrorBoundary.cjs +3 -3
- package/dist/chat/AthenaChatErrorBoundary.cjs.map +1 -1
- package/dist/chat/DrivingOnChip.cjs +23 -0
- package/dist/chat/DrivingOnChip.cjs.map +1 -0
- package/dist/chat/DrivingOnChip.d.ts +17 -0
- package/dist/chat/DrivingOnChip.js +23 -0
- package/dist/chat/DrivingOnChip.js.map +1 -0
- package/dist/chat/StatewireApprovalCard.cjs +166 -37
- package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
- package/dist/chat/StatewireApprovalCard.d.ts +91 -2
- package/dist/chat/StatewireApprovalCard.js +156 -27
- package/dist/chat/StatewireApprovalCard.js.map +1 -1
- package/dist/chat/StatewireClientToolBridge.cjs +2 -2
- package/dist/chat/StatewireClientToolBridge.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.cjs +81 -69
- package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.d.ts +25 -13
- package/dist/chat/StatewireQueuedMessages.js +73 -61
- package/dist/chat/StatewireQueuedMessages.js.map +1 -1
- package/dist/chat/WaitingOnYouBanner.cjs +9 -5
- package/dist/chat/WaitingOnYouBanner.cjs.map +1 -1
- package/dist/chat/WaitingOnYouBanner.js +7 -3
- package/dist/chat/WaitingOnYouBanner.js.map +1 -1
- package/dist/chat/athena-chat-welcome.cjs +2 -2
- package/dist/chat/athena-chat-welcome.cjs.map +1 -1
- package/dist/chat/athena-citation-links.cjs +5 -5
- package/dist/chat/athena-citation-links.cjs.map +1 -1
- package/dist/chat/athena-composer-controls.cjs +26 -16
- package/dist/chat/athena-composer-controls.cjs.map +1 -1
- package/dist/chat/athena-composer-controls.d.ts +6 -0
- package/dist/chat/athena-composer-controls.js +26 -16
- package/dist/chat/athena-composer-controls.js.map +1 -1
- package/dist/chat/athena-turn-end-status.cjs +42 -0
- package/dist/chat/athena-turn-end-status.cjs.map +1 -0
- package/dist/chat/athena-turn-end-status.d.ts +24 -0
- package/dist/chat/athena-turn-end-status.js +42 -0
- package/dist/chat/athena-turn-end-status.js.map +1 -0
- package/dist/chat/browser-decision-check.cjs +131 -0
- package/dist/chat/browser-decision-check.cjs.map +1 -0
- package/dist/chat/browser-decision-check.d.ts +61 -0
- package/dist/chat/browser-decision-check.js +131 -0
- package/dist/chat/browser-decision-check.js.map +1 -0
- package/dist/chat/chat-outbox-rows.cjs +3 -3
- package/dist/chat/chat-outbox-rows.cjs.map +1 -1
- package/dist/chat/chat-voice-controls.cjs +96 -29
- package/dist/chat/chat-voice-controls.cjs.map +1 -1
- package/dist/chat/chat-voice-controls.d.ts +42 -3
- package/dist/chat/chat-voice-controls.js +92 -25
- package/dist/chat/chat-voice-controls.js.map +1 -1
- package/dist/chat/composer-keyboard-hint.cjs +5 -5
- package/dist/chat/composer-keyboard-hint.cjs.map +1 -1
- package/dist/chat/device-operation.cjs +29 -0
- package/dist/chat/device-operation.cjs.map +1 -0
- package/dist/chat/device-operation.d.ts +34 -0
- package/dist/chat/device-operation.js +29 -0
- package/dist/chat/device-operation.js.map +1 -0
- package/dist/chat/super-grouping/CollapsibleGroup.cjs +14 -14
- package/dist/chat/super-grouping/CollapsibleGroup.cjs.map +1 -1
- package/dist/chat/super-grouping/GroupedMessageParts.cjs +4 -4
- package/dist/chat/super-grouping/GroupedMessageParts.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.cjs +52 -36
- package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.d.ts +19 -4
- package/dist/chat/super-grouping/SuperGroupingCard.js +29 -13
- package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +32 -32
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.js +3 -3
- package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
- package/dist/chat/super-grouping/ToolTimeline.cjs +73 -40
- package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -1
- package/dist/chat/super-grouping/ToolTimeline.d.ts +10 -2
- package/dist/chat/super-grouping/ToolTimeline.js +69 -36
- package/dist/chat/super-grouping/ToolTimeline.js.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.cjs +47 -12
- package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.d.ts +21 -0
- package/dist/chat/super-grouping/activity-timeline.js +47 -12
- package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
- package/dist/chat/super-grouping/grouping-function.cjs +4 -0
- package/dist/chat/super-grouping/grouping-function.cjs.map +1 -1
- package/dist/chat/super-grouping/grouping-function.d.ts +7 -0
- package/dist/chat/super-grouping/grouping-function.js +5 -1
- package/dist/chat/super-grouping/grouping-function.js.map +1 -1
- package/dist/chat/super-grouping/index.cjs +6 -0
- package/dist/chat/super-grouping/index.cjs.map +1 -1
- package/dist/chat/super-grouping/index.d.ts +5 -2
- package/dist/chat/super-grouping/index.js +7 -1
- package/dist/chat/super-grouping/index.js.map +1 -1
- package/dist/chat/super-grouping/tool-part-placement.cjs +17 -0
- package/dist/chat/super-grouping/tool-part-placement.cjs.map +1 -0
- package/dist/chat/super-grouping/tool-part-placement.d.ts +22 -0
- package/dist/chat/super-grouping/tool-part-placement.js +17 -0
- package/dist/chat/super-grouping/tool-part-placement.js.map +1 -0
- package/dist/chat/thread-scroll-to-bottom.cjs +2 -2
- package/dist/chat/thread-scroll-to-bottom.cjs.map +1 -1
- package/dist/chat/thread-scroll-to-bottom.d.ts +10 -7
- package/dist/chat/thread-scroll-to-bottom.js +2 -2
- package/dist/chat/thread-scroll-to-bottom.js.map +1 -1
- package/dist/chat/tooltip-icon-button.cjs +2 -2
- package/dist/chat/tooltip-icon-button.cjs.map +1 -1
- package/dist/chat/use-athena-voice-live.cjs +11 -0
- package/dist/chat/use-athena-voice-live.cjs.map +1 -0
- package/dist/chat/use-athena-voice-live.d.ts +11 -0
- package/dist/chat/use-athena-voice-live.js +11 -0
- package/dist/chat/use-athena-voice-live.js.map +1 -0
- package/dist/chat/use-statewire-approval-request.cjs +56 -24
- package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
- package/dist/chat/use-statewire-approval-request.d.ts +33 -4
- package/dist/chat/use-statewire-approval-request.js +41 -9
- package/dist/chat/use-statewire-approval-request.js.map +1 -1
- package/dist/chat-ui/auth/sign-in-card.cjs +2 -2
- package/dist/chat-ui/auth/sign-in-card.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.cjs +138 -107
- package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.d.ts +20 -4
- package/dist/chat-ui/composer/tiptap-composer.js +85 -54
- package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
- package/dist/chat-ui/header/conversation-history-panel.cjs +49 -23
- package/dist/chat-ui/header/conversation-history-panel.cjs.map +1 -1
- package/dist/chat-ui/header/conversation-history-panel.d.ts +12 -1
- package/dist/chat-ui/header/conversation-history-panel.js +38 -12
- package/dist/chat-ui/header/conversation-history-panel.js.map +1 -1
- package/dist/chat-ui/index.cjs +21 -0
- package/dist/chat-ui/index.cjs.map +1 -1
- package/dist/chat-ui/index.d.ts +8 -1
- package/dist/chat-ui/index.js +21 -0
- package/dist/chat-ui/index.js.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.cjs +4 -4
- package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs +10 -9
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js +3 -2
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs +2 -2
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs +29 -6
- package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-list.d.ts +7 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-list.js +25 -2
- package/dist/chat-ui/mentions/suggestions/components/menu-list.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.cjs +2 -2
- package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.cjs +2 -2
- package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +3 -3
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.cjs +56 -2
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.d.ts +12 -0
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.js +56 -2
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +24 -3
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +7 -0
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js +24 -3
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs +35 -13
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +15 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js +28 -6
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.cjs +9 -6
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.d.ts +3 -0
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.js +5 -2
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.js.map +1 -1
- package/dist/chat-ui/mentions/use-account-workspace-id.cjs +45 -10
- package/dist/chat-ui/mentions/use-account-workspace-id.cjs.map +1 -1
- package/dist/chat-ui/mentions/use-account-workspace-id.d.ts +24 -1
- package/dist/chat-ui/mentions/use-account-workspace-id.js +46 -11
- package/dist/chat-ui/mentions/use-account-workspace-id.js.map +1 -1
- package/dist/chat-ui/mentions/use-member-avatar.cjs +4 -4
- package/dist/chat-ui/mentions/use-member-avatar.cjs.map +1 -1
- package/dist/chat-ui/mentions/use-mention-asset.cjs +3 -3
- package/dist/chat-ui/mentions/use-mention-asset.cjs.map +1 -1
- package/dist/chat-ui/messages/answer-label.cjs +42 -0
- package/dist/chat-ui/messages/answer-label.cjs.map +1 -0
- package/dist/chat-ui/messages/answer-label.d.ts +33 -0
- package/dist/chat-ui/messages/answer-label.js +42 -0
- package/dist/chat-ui/messages/answer-label.js.map +1 -0
- package/dist/chat-ui/messages/arrival-animation.cjs +13 -0
- package/dist/chat-ui/messages/arrival-animation.cjs.map +1 -0
- package/dist/chat-ui/messages/arrival-animation.d.ts +14 -0
- package/dist/chat-ui/messages/arrival-animation.js +13 -0
- package/dist/chat-ui/messages/arrival-animation.js.map +1 -0
- package/dist/chat-ui/messages/continue-pill.cjs +5 -5
- package/dist/chat-ui/messages/continue-pill.cjs.map +1 -1
- package/dist/chat-ui/messages/from-the-call-card.cjs +124 -0
- package/dist/chat-ui/messages/from-the-call-card.cjs.map +1 -0
- package/dist/chat-ui/messages/from-the-call-card.d.ts +17 -0
- package/dist/chat-ui/messages/from-the-call-card.js +124 -0
- package/dist/chat-ui/messages/from-the-call-card.js.map +1 -0
- package/dist/chat-ui/messages/handoff-arrival-divider.cjs +44 -0
- package/dist/chat-ui/messages/handoff-arrival-divider.cjs.map +1 -0
- package/dist/chat-ui/messages/handoff-arrival-divider.d.ts +17 -0
- package/dist/chat-ui/messages/handoff-arrival-divider.js +44 -0
- package/dist/chat-ui/messages/handoff-arrival-divider.js.map +1 -0
- package/dist/chat-ui/messages/message-actions-config.cjs +3 -3
- package/dist/chat-ui/messages/message-actions-config.cjs.map +1 -1
- package/dist/chat-ui/messages/message-components.cjs +8 -4
- package/dist/chat-ui/messages/message-components.cjs.map +1 -1
- package/dist/chat-ui/messages/message-components.js +5 -1
- package/dist/chat-ui/messages/message-components.js.map +1 -1
- package/dist/chat-ui/messages/message-images.cjs +66 -0
- package/dist/chat-ui/messages/message-images.cjs.map +1 -0
- package/dist/chat-ui/messages/message-images.d.ts +16 -0
- package/dist/chat-ui/messages/message-images.js +66 -0
- package/dist/chat-ui/messages/message-images.js.map +1 -0
- package/dist/chat-ui/messages/user-edit-composer.cjs +2 -2
- package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
- package/dist/chat-ui/messages/wake-marker.cjs +3 -3
- package/dist/chat-ui/messages/wake-marker.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-link.cjs +3 -2
- package/dist/chat-ui/rich-text/chat-link.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-link.d.ts +4 -0
- package/dist/chat-ui/rich-text/chat-link.js +4 -3
- package/dist/chat-ui/rich-text/chat-link.js.map +1 -1
- package/dist/chat-ui/rich-text/chat-message-body.cjs +9 -8
- package/dist/chat-ui/rich-text/chat-message-body.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-message-body.d.ts +12 -0
- package/dist/chat-ui/rich-text/chat-message-body.js +2 -1
- package/dist/chat-ui/rich-text/chat-message-body.js.map +1 -1
- package/dist/chat-ui/rich-text/chat-node-views.cjs +6 -6
- package/dist/chat-ui/rich-text/chat-node-views.cjs.map +1 -1
- package/dist/chat-ui/rich-text/dom-output-spec.cjs +2 -2
- package/dist/chat-ui/rich-text/dom-output-spec.cjs.map +1 -1
- package/dist/chat-ui/statewire.cjs +3 -0
- package/dist/chat-ui/statewire.cjs.map +1 -1
- package/dist/chat-ui/statewire.d.ts +2 -1
- package/dist/chat-ui/statewire.js +3 -0
- package/dist/chat-ui/statewire.js.map +1 -1
- package/dist/chat-ui/thread/chat-thread-shell.cjs +45 -14
- package/dist/chat-ui/thread/chat-thread-shell.cjs.map +1 -1
- package/dist/chat-ui/thread/chat-thread-shell.d.ts +16 -2
- package/dist/chat-ui/thread/chat-thread-shell.js +37 -6
- package/dist/chat-ui/thread/chat-thread-shell.js.map +1 -1
- package/dist/chat-ui/thread/composer-send-or-stop.cjs +30 -20
- package/dist/chat-ui/thread/composer-send-or-stop.cjs.map +1 -1
- package/dist/chat-ui/thread/composer-send-or-stop.d.ts +8 -0
- package/dist/chat-ui/thread/composer-send-or-stop.js +29 -19
- package/dist/chat-ui/thread/composer-send-or-stop.js.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.cjs +20 -21
- package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.js +3 -4
- package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
- package/dist/chat-ui/thread/thread-loading-overlay.cjs +5 -5
- package/dist/chat-ui/thread/thread-loading-overlay.cjs.map +1 -1
- package/dist/collab/client.cjs +52 -3
- package/dist/collab/client.cjs.map +1 -1
- package/dist/collab/client.d.ts +27 -0
- package/dist/collab/client.js +52 -3
- package/dist/collab/client.js.map +1 -1
- package/dist/collab/document-status.cjs +150 -0
- package/dist/collab/document-status.cjs.map +1 -0
- package/dist/collab/document-status.d.ts +68 -0
- package/dist/collab/document-status.js +150 -0
- package/dist/collab/document-status.js.map +1 -0
- package/dist/collab/index.cjs +7 -0
- package/dist/collab/index.cjs.map +1 -1
- package/dist/collab/index.d.ts +6 -1
- package/dist/collab/index.js +7 -0
- package/dist/collab/index.js.map +1 -1
- package/dist/collab/presence-react.cjs +11 -11
- package/dist/collab/presence-react.cjs.map +1 -1
- package/dist/collab/react.cjs +6 -6
- package/dist/collab/react.cjs.map +1 -1
- package/dist/composer/AttachmentContext.cjs +24 -11
- package/dist/composer/AttachmentContext.cjs.map +1 -1
- package/dist/composer/AttachmentContext.js +18 -5
- package/dist/composer/AttachmentContext.js.map +1 -1
- package/dist/composer/ComposerAttachmentPreview.cjs +78 -23
- package/dist/composer/ComposerAttachmentPreview.cjs.map +1 -1
- package/dist/composer/ComposerAttachmentPreview.d.ts +5 -3
- package/dist/composer/ComposerAttachmentPreview.js +79 -24
- package/dist/composer/ComposerAttachmentPreview.js.map +1 -1
- package/dist/composer/ComposerDropZone.cjs +7 -7
- package/dist/composer/ComposerDropZone.cjs.map +1 -1
- package/dist/composer/FileUploadButton.cjs +37 -22
- package/dist/composer/FileUploadButton.cjs.map +1 -1
- package/dist/composer/FileUploadButton.d.ts +6 -0
- package/dist/composer/FileUploadButton.js +34 -19
- package/dist/composer/FileUploadButton.js.map +1 -1
- package/dist/composer/QuoteContext.cjs +8 -8
- package/dist/composer/QuoteContext.cjs.map +1 -1
- package/dist/composer/composer-handoff.cjs +4 -4
- package/dist/composer/composer-handoff.cjs.map +1 -1
- package/dist/composer/index.d.ts +1 -1
- package/dist/composer/useAppendToComposer.cjs +4 -4
- package/dist/composer/useAppendToComposer.cjs.map +1 -1
- package/dist/composer/useAttachFiles.cjs +23 -6
- package/dist/composer/useAttachFiles.cjs.map +1 -1
- package/dist/composer/useAttachFiles.d.ts +15 -7
- package/dist/composer/useAttachFiles.js +22 -5
- package/dist/composer/useAttachFiles.js.map +1 -1
- package/dist/composer/useComposerAttachment.cjs +4 -4
- package/dist/composer/useComposerAttachment.cjs.map +1 -1
- package/dist/composer/useFileUpload.cjs +21 -16
- package/dist/composer/useFileUpload.cjs.map +1 -1
- package/dist/composer/useFileUpload.d.ts +12 -0
- package/dist/composer/useFileUpload.js +12 -7
- package/dist/composer/useFileUpload.js.map +1 -1
- package/dist/composer/useReadComposerDraft.cjs +27 -8
- package/dist/composer/useReadComposerDraft.cjs.map +1 -1
- package/dist/composer/useReadComposerDraft.d.ts +23 -1
- package/dist/composer/useReadComposerDraft.js +27 -8
- package/dist/composer/useReadComposerDraft.js.map +1 -1
- package/dist/composer/useSendMessage.cjs +4 -4
- package/dist/composer/useSendMessage.cjs.map +1 -1
- package/dist/diagnostics/useAthenaDiagnostics.cjs +4 -4
- package/dist/diagnostics/useAthenaDiagnostics.cjs.map +1 -1
- package/dist/dictation/audio-level-history.cjs +3 -3
- package/dist/dictation/audio-level-history.cjs.map +1 -1
- package/dist/dictation/dictation-controls.cjs +24 -20
- package/dist/dictation/dictation-controls.cjs.map +1 -1
- package/dist/dictation/dictation-controls.d.ts +6 -1
- package/dist/dictation/dictation-controls.js +24 -20
- package/dist/dictation/dictation-controls.js.map +1 -1
- package/dist/dictation/use-athena-dictation-engine.cjs +3 -3
- package/dist/dictation/use-athena-dictation-engine.cjs.map +1 -1
- package/dist/dictation/use-dictation.cjs +22 -22
- package/dist/dictation/use-dictation.cjs.map +1 -1
- package/dist/index.cjs +29 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +18 -4
- package/dist/index.js +30 -3
- package/dist/index.js.map +1 -1
- package/dist/keryx-http/src/receive-only-socket.cjs +40 -0
- package/dist/keryx-http/src/receive-only-socket.cjs.map +1 -0
- package/dist/keryx-http/src/receive-only-socket.d.ts +27 -0
- package/dist/keryx-http/src/receive-only-socket.js +40 -0
- package/dist/keryx-http/src/receive-only-socket.js.map +1 -0
- package/dist/keryx-http/src/unconfirmed-update-attributions.cjs +190 -0
- package/dist/keryx-http/src/unconfirmed-update-attributions.cjs.map +1 -0
- package/dist/keryx-http/src/unconfirmed-update-attributions.d.ts +132 -0
- package/dist/keryx-http/src/unconfirmed-update-attributions.js +190 -0
- package/dist/keryx-http/src/unconfirmed-update-attributions.js.map +1 -0
- package/dist/keryx-http/src/update-attributions.cjs +141 -0
- package/dist/keryx-http/src/update-attributions.cjs.map +1 -0
- package/dist/keryx-http/src/update-attributions.d.ts +107 -0
- package/dist/keryx-http/src/update-attributions.js +141 -0
- package/dist/keryx-http/src/update-attributions.js.map +1 -0
- package/dist/lib/owner-document.cjs +6 -6
- package/dist/lib/owner-document.cjs.map +1 -1
- package/dist/lib/use-athena-rest-query.cjs +4 -4
- package/dist/lib/use-athena-rest-query.cjs.map +1 -1
- package/dist/lib/use-document-active.cjs +4 -4
- package/dist/lib/use-document-active.cjs.map +1 -1
- package/dist/lib/use-prefers-reduced-motion.cjs +2 -2
- package/dist/lib/use-prefers-reduced-motion.cjs.map +1 -1
- package/dist/offline/offline-history.cjs +7 -7
- package/dist/offline/offline-history.cjs.map +1 -1
- package/dist/provider/AthenaContext.cjs +3 -3
- package/dist/provider/AthenaContext.cjs.map +1 -1
- package/dist/provider/AthenaProvider.cjs +120 -79
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +11 -1
- package/dist/provider/AthenaProvider.js +44 -3
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/provider/PostHogProvider.cjs +2 -2
- package/dist/provider/PostHogProvider.cjs.map +1 -1
- package/dist/provider/agent-selection-context.cjs +2 -2
- package/dist/provider/agent-selection-context.cjs.map +1 -1
- package/dist/provider/chat-mode-context.cjs +2 -2
- package/dist/provider/chat-mode-context.cjs.map +1 -1
- package/dist/provider/session-persistence-context.cjs +10 -0
- package/dist/provider/session-persistence-context.cjs.map +1 -0
- package/dist/provider/session-persistence-context.d.ts +15 -0
- package/dist/provider/session-persistence-context.js +10 -0
- package/dist/provider/session-persistence-context.js.map +1 -0
- package/dist/provider/statewire-history-context.cjs +4 -4
- package/dist/provider/statewire-history-context.cjs.map +1 -1
- package/dist/provider/statewire-lifecycle-context.cjs +3 -3
- package/dist/provider/statewire-lifecycle-context.cjs.map +1 -1
- package/dist/provider/statewire-window-context.cjs +3 -3
- package/dist/provider/statewire-window-context.cjs.map +1 -1
- package/dist/provider/theme-style-context.cjs +3 -3
- package/dist/provider/theme-style-context.cjs.map +1 -1
- package/dist/react/package.json.cjs +1 -1
- package/dist/react/package.json.js +1 -1
- package/dist/runtime/StatewireThreadConfigLaneSync.cjs +10 -10
- package/dist/runtime/StatewireThreadConfigLaneSync.cjs.map +1 -1
- package/dist/runtime/auth-refusal-restart.cjs +7 -7
- package/dist/runtime/auth-refusal-restart.cjs.map +1 -1
- package/dist/runtime/auth.cjs +13 -13
- package/dist/runtime/auth.cjs.map +1 -1
- package/dist/runtime/statewire-lifecycle.cjs +1 -0
- package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
- package/dist/runtime/statewire-lifecycle.d.ts +3 -1
- package/dist/runtime/statewire-lifecycle.js +2 -1
- package/dist/runtime/statewire-lifecycle.js.map +1 -1
- package/dist/runtime/statewire-server-lane-context.cjs +2 -2
- package/dist/runtime/statewire-server-lane-context.cjs.map +1 -1
- package/dist/runtime/statewire-session-lane.cjs +4 -4
- package/dist/runtime/statewire-session-lane.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.cjs +10 -8
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +2 -0
- package/dist/runtime/useAthenaStatewireRuntime.js +2 -0
- package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/threads/Inbox.cjs +8 -8
- package/dist/threads/Inbox.cjs.map +1 -1
- package/dist/threads/SessionList.cjs +9 -9
- package/dist/threads/SessionList.cjs.map +1 -1
- package/dist/threads/SessionsPage.cjs +11 -11
- package/dist/threads/SessionsPage.cjs.map +1 -1
- package/dist/threads/api.cjs.map +1 -1
- package/dist/threads/api.d.ts +15 -0
- package/dist/threads/api.js.map +1 -1
- package/dist/threads/conversation-list-fetcher.cjs +13 -5
- package/dist/threads/conversation-list-fetcher.cjs.map +1 -1
- package/dist/threads/conversation-list-fetcher.d.ts +4 -1
- package/dist/threads/conversation-list-fetcher.js +13 -5
- package/dist/threads/conversation-list-fetcher.js.map +1 -1
- package/dist/threads/index-triggered-refresh.cjs +10 -10
- package/dist/threads/index-triggered-refresh.cjs.map +1 -1
- package/dist/threads/mark-viewed-thread-read.cjs +12 -12
- package/dist/threads/mark-viewed-thread-read.cjs.map +1 -1
- package/dist/threads/offline-session-list.cjs +3 -3
- package/dist/threads/offline-session-list.cjs.map +1 -1
- package/dist/threads/session-list-tab-share.cjs +5 -5
- package/dist/threads/session-list-tab-share.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.cjs +79 -57
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.d.ts +20 -8
- package/dist/threads/statewire-thread-list.js +28 -6
- package/dist/threads/statewire-thread-list.js.map +1 -1
- package/dist/threads/thread-id-context.cjs +5 -5
- package/dist/threads/thread-id-context.cjs.map +1 -1
- package/dist/threads/use-athena-session-attention.cjs +2 -2
- package/dist/threads/use-athena-session-attention.cjs.map +1 -1
- package/dist/threads/use-athena-sessions.cjs +37 -15
- package/dist/threads/use-athena-sessions.cjs.map +1 -1
- package/dist/threads/use-athena-sessions.d.ts +10 -5
- package/dist/threads/use-athena-sessions.js +28 -6
- package/dist/threads/use-athena-sessions.js.map +1 -1
- package/dist/threads/use-athena-thread-model.cjs +3 -3
- package/dist/threads/use-athena-thread-model.cjs.map +1 -1
- package/dist/threads/use-rest-conversation-history.cjs +3 -3
- package/dist/threads/use-rest-conversation-history.cjs.map +1 -1
- package/dist/threads/use-rest-conversation-history.d.ts +1 -0
- package/dist/threads/use-statewire-conversation-history.cjs +8 -8
- package/dist/threads/use-statewire-conversation-history.cjs.map +1 -1
- package/dist/threads/use-thread-archive.cjs +9 -9
- package/dist/threads/use-thread-archive.cjs.map +1 -1
- package/dist/threads/use-thread-favorite.cjs +2 -2
- package/dist/threads/use-thread-favorite.cjs.map +1 -1
- package/dist/threads/use-thread-field-override.cjs +20 -20
- package/dist/threads/use-thread-field-override.cjs.map +1 -1
- package/dist/threads/use-thread-read-state.cjs +4 -4
- package/dist/threads/use-thread-read-state.cjs.map +1 -1
- package/dist/threads/use-thread-rename.cjs +2 -2
- package/dist/threads/use-thread-rename.cjs.map +1 -1
- package/dist/threads/useAthenaThreadManager.cjs +2 -2
- package/dist/threads/useAthenaThreadManager.cjs.map +1 -1
- package/dist/tools/NestedPtcMessages.cjs +6 -6
- package/dist/tools/NestedPtcMessages.cjs.map +1 -1
- package/dist/tools/append-document-tool-ui.cjs +7 -7
- package/dist/tools/append-document-tool-ui.cjs.map +1 -1
- package/dist/tools/file-tool-uis.cjs +2 -2
- package/dist/tools/file-tool-uis.cjs.map +1 -1
- package/dist/tools/misc-tool-uis.cjs +2 -2
- package/dist/tools/misc-tool-uis.cjs.map +1 -1
- package/dist/tools/primitives.cjs +6 -6
- package/dist/tools/primitives.cjs.map +1 -1
- package/dist/tools/read-asset-tool-ui.cjs +6 -6
- package/dist/tools/read-asset-tool-ui.cjs.map +1 -1
- package/dist/tools/subagent-task-tool-ui.cjs +21 -21
- package/dist/tools/subagent-task-tool-ui.cjs.map +1 -1
- package/dist/tools/test-recording-tool-uis.cjs +16 -16
- package/dist/tools/test-recording-tool-uis.cjs.map +1 -1
- package/dist/tools/todo-plan-store.cjs +4 -4
- package/dist/tools/todo-plan-store.cjs.map +1 -1
- package/dist/tools/tool-appearance.cjs +3 -3
- package/dist/tools/tool-appearance.cjs.map +1 -1
- package/dist/tools/tool-fallback.cjs +14 -14
- package/dist/tools/tool-fallback.cjs.map +1 -1
- package/dist/tools/tool-uis.cjs +74 -74
- package/dist/tools/tool-uis.cjs.map +1 -1
- package/dist/tools/use-elapsed-seconds.cjs +3 -3
- package/dist/tools/use-elapsed-seconds.cjs.map +1 -1
- package/dist/tools/write-todos-tool-ui.cjs +9 -9
- package/dist/tools/write-todos-tool-ui.cjs.map +1 -1
- package/dist/ui/image-viewer.cjs +382 -0
- package/dist/ui/image-viewer.cjs.map +1 -0
- package/dist/ui/image-viewer.d.ts +50 -0
- package/dist/ui/image-viewer.js +382 -0
- package/dist/ui/image-viewer.js.map +1 -0
- package/dist/voice/chat.cjs +6 -0
- package/dist/voice/chat.cjs.map +1 -1
- package/dist/voice/chat.d.ts +1 -1
- package/dist/voice/chat.js +8 -2
- package/dist/voice/livekit-join.cjs +52 -101
- package/dist/voice/livekit-join.cjs.map +1 -1
- package/dist/voice/livekit-join.d.ts +1 -6
- package/dist/voice/livekit-join.js +52 -101
- package/dist/voice/livekit-join.js.map +1 -1
- package/dist/voice/livekit.cjs.map +1 -1
- package/dist/voice/livekit.d.ts +11 -1
- package/dist/voice/livekit.js.map +1 -1
- package/dist/voice/use-athena-voice-session.cjs +34 -34
- package/dist/voice/use-athena-voice-session.cjs.map +1 -1
- package/dist/workbench/ComputerLiveDesktop.cjs +13 -13
- package/dist/workbench/ComputerLiveDesktop.cjs.map +1 -1
- package/dist/workbench/SessionWorkbench.cjs +22 -22
- package/dist/workbench/SessionWorkbench.cjs.map +1 -1
- package/dist/workbench/session-workbench-context.cjs +3 -3
- package/dist/workbench/session-workbench-context.cjs.map +1 -1
- package/dist/workbench/session-workbench-panes.cjs +8 -8
- package/dist/workbench/session-workbench-panes.cjs.map +1 -1
- package/dist/workbench/workbench-layout-context.cjs +3 -3
- package/dist/workbench/workbench-layout-context.cjs.map +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-mention-suggestions.cjs","sources":["../../../../../src/chat-ui/mentions/suggestions/data/use-mention-suggestions.ts"],"sourcesContent":["/**\n * Mention Suggestions Store — shared by every Athena chat host (the Chrome\n * side panel, the Office task pane, the SDK's AthenaChat).\n *\n * Full Olympus-style mention store with all categories:\n * Favorites, Assets, Projects, Browse Profiles, Folders,\n * current/group webpages, Team, Workspace, Drives + Global Search (assets,\n * plus workspace members when Team is offered).\n *\n * Uses registry + cache architecture from Olympus with\n * async data fetching via GraphQL. A host may hand the Tools / Toolkits\n * categories its own list instead of the server catalog (`tools`).\n */\n\nimport { Store } from \"@tanstack/store\";\nimport { useEffect, useMemo, useRef } from \"react\";\nimport type { MentionAuthContext } from \"./api-client\";\nimport { useMentionAuth } from \"./api-client\";\nimport { createItemCache, type ItemCache } from \"./item-cache\";\nimport {\n createScopeRegistry,\n registerSource,\n bindScopes,\n type ScopeRegistry,\n} from \"./scope-registry\";\nimport {\n transformRootCategories,\n fetchAssets,\n fetchFavorites,\n fetchFolders,\n fetchFolderContents,\n fetchTypedAssets,\n fetchTeam,\n fetchTools,\n fetchToolkits,\n fetchDrives,\n fetchGlobalSearch,\n transformProvidedTools,\n withProvidedTools,\n createTeamLoader,\n withTeam,\n} from \"./sources\";\nimport type { MentionTool, WebpageMention } from \"./types\";\n\nexport function webpageMentionFingerprint(\n webpages: readonly WebpageMention[],\n): string {\n return JSON.stringify(\n webpages.map(({ tabId, title, url, isCurrent }) => [\n tabId,\n title,\n url,\n isCurrent,\n ]),\n );\n}\n\n// ── Store types ──\n\nexport interface MentionSuggestionsStoreState {\n registry: ScopeRegistry;\n cache: ItemCache;\n}\n\nexport type MentionSuggestionsStore = Store<MentionSuggestionsStoreState>;\n\n// ── Categories ──\n\n/**\n * All mention menu categories, in display order.\n */\nexport const ROOT_MENTION_CATEGORIES = [\n \"favorites\",\n \"assets\",\n \"projects\",\n \"browse_profiles\",\n \"folders\",\n \"tools\",\n \"toolkits\",\n \"team\",\n \"drives\",\n] as const;\n\nexport type MentionRootCategory = (typeof ROOT_MENTION_CATEGORIES)[number];\n\n// ── Store builder ──\n\n/** Stable fingerprint of a host's tool list, for cache invalidation. */\nexport function providedToolsFingerprint(tools: readonly MentionTool[]): string {\n return JSON.stringify(\n tools.map(({ id, name, type, description, icon }) => [\n id,\n name,\n type,\n description ?? null,\n icon ?? null,\n ]),\n );\n}\n\nfunction buildStore({\n auth,\n getWebpages,\n getTools,\n rootCategories,\n}: {\n auth: MentionAuthContext;\n getWebpages: () => readonly WebpageMention[];\n /** Present when the host supplies the Tools / Toolkits list itself. */\n getTools?: () => readonly MentionTool[];\n rootCategories: readonly MentionRootCategory[];\n}): MentionSuggestionsStore {\n const registry = createScopeRegistry();\n const cache = createItemCache();\n\n // ── Root categories ──\n registerSource(registry, \"root\", transformRootCategories, {\n categories: [...rootCategories],\n getWebpages,\n });\n\n const loadTeam = createTeamLoader(auth);\n\n // ── Global search (aggregated) ──\n // A host's own tools ride along so a root query finds them beside assets,\n // and so do workspace members when the host offers Team.\n const withHostTools = getTools\n ? withProvidedTools(fetchGlobalSearch, getTools)\n : fetchGlobalSearch;\n registerSource(\n registry,\n \"global_search\",\n rootCategories.includes(\"team\") ? withTeam(withHostTools, loadTeam) : withHostTools,\n { auth },\n );\n bindScopes(registry, \"root\", \"global_search\");\n\n // ── Assets ──\n registerSource(registry, \"athena_assets\", fetchAssets, { auth, limit: 50 });\n\n // ── Favorites ──\n registerSource(registry, \"favorites\", fetchFavorites, { auth, limit: 50 });\n\n // ── Folders (flat list) ──\n registerSource(\n registry,\n \"athena_folders\",\n fetchFolders,\n { auth, limit: 50 },\n true /* isFlat */,\n );\n\n // ── Internal drive (folder navigation root) ──\n registerSource(registry, \"internal_drive\", fetchFolderContents, {\n auth,\n limit: 50,\n });\n\n // ── Projects ──\n registerSource(registry, \"athena_projects\", fetchTypedAssets, {\n auth,\n includeOnlyTypes: [\"project\"],\n limit: 50,\n });\n\n // ── Browse Profiles ──\n registerSource(registry, \"athena_browse_profiles\", fetchTypedAssets, {\n auth,\n includeOnlyTypes: [\"browse_profile\"],\n limit: 50,\n });\n\n // ── Tools & Toolkits ── the server catalog, or the host's own list\n if (getTools) {\n registerSource(registry, \"tools\", transformProvidedTools, {\n getTools,\n type: \"tool\",\n });\n registerSource(registry, \"toolkits\", transformProvidedTools, {\n getTools,\n type: \"toolkit\",\n });\n } else {\n registerSource(registry, \"tools\", fetchTools, { auth });\n registerSource(registry, \"toolkits\", fetchToolkits, { auth });\n }\n\n // ── Team ──\n registerSource(registry, \"team\", fetchTeam, { auth, loadTeam });\n\n // ── Drives (catalogs) ──\n registerSource(registry, \"drive_catalogs\", fetchDrives, { auth });\n\n return new Store<MentionSuggestionsStoreState>({ registry, cache });\n}\n\n// ── Hook ──\n\n/**\n * Creates a stable MentionSuggestionsStore.\n * Uses MentionAuthCtx for API credentials.\n */\nexport function useMentionSuggestions({\n webpages,\n tools,\n rootCategories = ROOT_MENTION_CATEGORIES,\n}: {\n webpages: readonly WebpageMention[];\n /**\n * Host-provided Tools / Toolkits candidates. When set (even empty) they\n * replace the server tool catalog for those categories and join root\n * search results; omitted, the categories fetch the catalog.\n */\n tools?: readonly MentionTool[];\n /** Categories shown at the top level; hosts can narrow the default set. */\n rootCategories?: readonly MentionRootCategory[];\n}): {\n store: MentionSuggestionsStore;\n invalidate: (scope: string) => void;\n} {\n const auth = useMentionAuth();\n const webpagesRef = useRef(webpages);\n webpagesRef.current = webpages;\n const toolsRef = useRef(tools);\n toolsRef.current = tools;\n const hasProvidedTools = tools !== undefined;\n\n // Depend on primitive values to avoid rebuilding store on object identity changes\n const store = useMemo(\n () =>\n buildStore({\n auth,\n getWebpages: () => webpagesRef.current,\n getTools: hasProvidedTools ? () => toolsRef.current ?? [] : undefined,\n rootCategories,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n auth.backendUrl,\n auth.accessToken,\n auth.apiKey,\n auth.workspaceId,\n auth.userId,\n hasProvidedTools,\n rootCategories.join(\",\"),\n ],\n );\n\n const invalidate = useMemo(\n () => (scope: string) => {\n const state = store.state;\n const { registry, cache } = state;\n\n // Clear scope from cache\n if (cache.items) {\n for (const item of Object.values(cache.items)) {\n item.visibleInScopes.delete(scope);\n }\n // Remove orphaned items\n for (const [id, item] of Object.entries(cache.items)) {\n if (item.visibleInScopes.size === 0) {\n delete cache.items[id];\n }\n }\n }\n\n // Reset fetch states\n if (registry.entries[scope]) {\n registry.entries[scope].fetchStates = {};\n }\n\n store.setState((prev) => ({ ...prev }));\n },\n [store],\n );\n\n const webpageFingerprint = webpageMentionFingerprint(webpages);\n const previousWebpageFingerprintRef = useRef<string | null>(null);\n\n useEffect(() => {\n if (previousWebpageFingerprintRef.current === webpageFingerprint) return;\n previousWebpageFingerprintRef.current = webpageFingerprint;\n invalidate(\"root\");\n }, [invalidate, webpageFingerprint]);\n\n // A changed tool list drops the cached Tools / Toolkits entries (and the\n // root search results they were folded into) so the next open re-reads it.\n const toolsFingerprint = tools ? providedToolsFingerprint(tools) : null;\n const previousToolsFingerprintRef = useRef<string | null>(null);\n\n useEffect(() => {\n if (previousToolsFingerprintRef.current === toolsFingerprint) return;\n previousToolsFingerprintRef.current = toolsFingerprint;\n if (toolsFingerprint === null) return;\n invalidate(\"tools\");\n invalidate(\"toolkits\");\n invalidate(\"global_search\");\n }, [invalidate, toolsFingerprint]);\n\n return { store, invalidate };\n}\n"],"names":["createScopeRegistry","createItemCache","registerSource","transformRootCategories","createTeamLoader","withProvidedTools","fetchGlobalSearch","withTeam","bindScopes","fetchAssets","fetchFavorites","fetchFolders","fetchFolderContents","fetchTypedAssets","transformProvidedTools","fetchTools","fetchToolkits","fetchTeam","fetchDrives","Store","useMentionAuth","useRef","store","useMemo","useEffect"],"mappings":";;;;;;;;AA4CO,SAAS,0BACd,UACQ;AACR,SAAO,KAAK;AAAA,IACV,SAAS,IAAI,CAAC,EAAE,OAAO,OAAO,KAAK,gBAAgB;AAAA,MACjD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,CACD;AAAA,EAAA;AAEL;AAgBO,MAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAOO,SAAS,yBAAyB,OAAuC;AAC9E,SAAO,KAAK;AAAA,IACV,MAAM,IAAI,CAAC,EAAE,IAAI,MAAM,MAAM,aAAa,WAAW;AAAA,MACnD;AAAA,MACA;AAAA,MACA;AAAA,MACA,eAAe;AAAA,MACf,QAAQ;AAAA,IAAA,CACT;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AAC7C,eAAK,gBAAgB,OAAO,KAAK;AAAA,QACnC;AAEA,mBAAW,CAAC,IAAI,IAAI,KAAK,OAAO,QAAQ,MAAM,KAAK,GAAG;AACpD,cAAI,KAAK,gBAAgB,SAAS,GAAG;AACnC,mBAAO,MAAM,MAAM,EAAE;AAAA,UACvB;AAAA,QACF;AAAA,MACF;AAGA,UAAI,SAAS,QAAQ,KAAK,GAAG;AAC3B,iBAAS,QAAQ,KAAK,EAAE,cAAc,CAAA;AAAA,MACxC;AAEA,MAAAA,OAAM,SAAS,CAAC,UAAU,EAAE,GAAG,OAAO;AAAA,IACxC;AAAA,IACA,CAACA,MAAK;AAAA,EAAA;AAGR,QAAM,qBAAqB,0BAA0B,QAAQ;AAC7D,QAAM,gCAAgCD,MAAAA,OAAsB,IAAI;AAEhEG,QAAAA,UAAU,MAAM;AACd,QAAI,8BAA8B,YAAY,mBAAoB;AAClE,kCAA8B,UAAU;AACxC,eAAW,MAAM;AAAA,EACnB,GAAG,CAAC,YAAY,kBAAkB,CAAC;AAInC,QAAM,mBAAmB,QAAQ,yBAAyB,KAAK,IAAI;AACnE,QAAM,8BAA8BH,MAAAA,OAAsB,IAAI;AAE9DG,QAAAA,UAAU,MAAM;AACd,QAAI,4BAA4B,YAAY,iBAAkB;AAC9D,gCAA4B,UAAU;AACtC,QAAI,qBAAqB,KAAM;AAC/B,eAAW,OAAO;AAClB,eAAW,UAAU;AACrB,eAAW,eAAe;AAAA,EAC5B,GAAG,CAAC,YAAY,gBAAgB,CAAC;AAEjC,SAAO,EAAE,OAAAF,QAAO,WAAA;AAClB;;;;;"}
|
|
1
|
+
{"version":3,"file":"use-mention-suggestions.cjs","sources":["../../../../../src/chat-ui/mentions/suggestions/data/use-mention-suggestions.ts"],"sourcesContent":["/**\n * Mention Suggestions Store — shared by every Athena chat host (the Chrome\n * side panel, the Office task pane, the SDK's AthenaChat).\n *\n * Full Olympus-style mention store with all categories:\n * Favorites, Assets, Projects, Browse Profiles, Folders,\n * current/group webpages, Team, Workspace, Drives + Global Search (assets,\n * plus workspace members when Team is offered).\n *\n * Uses registry + cache architecture from Olympus with\n * async data fetching via GraphQL. A host may hand the Tools / Toolkits\n * categories its own list instead of the server catalog (`tools`).\n */\n\nimport type { LabelCopy } from \"@athenaintel/agent-runtime/offline-status\";\nimport { Store } from \"@tanstack/store\";\nimport { useEffect, useLayoutEffect, useMemo, useRef } from \"react\";\nimport type { MentionAuthContext } from \"./api-client\";\nimport { useMentionAuth } from \"./api-client\";\nimport { createItemCache, type ItemCache } from \"./item-cache\";\nimport { retryFailedFetches } from \"./orchestrator\";\nimport {\n createScopeRegistry,\n registerSource,\n bindScopes,\n type ScopeRegistry,\n} from \"./scope-registry\";\nimport {\n transformRootCategories,\n fetchAssets,\n fetchFavorites,\n fetchFolders,\n fetchFolderContents,\n fetchTypedAssets,\n fetchTeam,\n fetchTools,\n fetchToolkits,\n fetchDrives,\n fetchGlobalSearch,\n transformProvidedTools,\n withProvidedTools,\n createTeamLoader,\n withTeam,\n} from \"./sources\";\nimport type { MentionTool, WebpageMention } from \"./types\";\n\nexport function webpageMentionFingerprint(\n webpages: readonly WebpageMention[],\n): string {\n return JSON.stringify(\n webpages.map(({ tabId, title, url, isCurrent }) => [\n tabId,\n title,\n url,\n isCurrent,\n ]),\n );\n}\n\n// ── Store types ──\n\nexport interface MentionSuggestionsStoreState {\n registry: ScopeRegistry;\n cache: ItemCache;\n /**\n * Why nothing is asked of Athena right now, or `null` while it answers: the\n * scopes whose source asks Athena fetch nothing and say this instead, while\n * the host's own items (its tabs, its tool list) and what was already loaded\n * still show.\n */\n athenaUnavailable: LabelCopy | null;\n}\n\nexport type MentionSuggestionsStore = Store<MentionSuggestionsStoreState>;\n\n// ── Categories ──\n\n/**\n * All mention menu categories, in display order.\n */\nexport const ROOT_MENTION_CATEGORIES = [\n \"favorites\",\n \"assets\",\n \"projects\",\n \"browse_profiles\",\n \"folders\",\n \"tools\",\n \"toolkits\",\n \"team\",\n \"drives\",\n] as const;\n\nexport type MentionRootCategory = (typeof ROOT_MENTION_CATEGORIES)[number];\n\n// ── Store builder ──\n\n/** Stable fingerprint of a host's tool list, for cache invalidation. */\nexport function providedToolsFingerprint(tools: readonly MentionTool[]): string {\n return JSON.stringify(\n tools.map(({ id, name, type, description, icon }) => [\n id,\n name,\n type,\n description ?? null,\n icon ?? null,\n ]),\n );\n}\n\nfunction buildStore({\n auth,\n getWebpages,\n getTools,\n rootCategories,\n athenaUnavailable,\n}: {\n auth: MentionAuthContext;\n getWebpages: () => readonly WebpageMention[];\n /** Present when the host supplies the Tools / Toolkits list itself. */\n getTools?: () => readonly MentionTool[];\n rootCategories: readonly MentionRootCategory[];\n athenaUnavailable: LabelCopy | null;\n}): MentionSuggestionsStore {\n const registry = createScopeRegistry();\n const cache = createItemCache();\n\n // ── Root categories ──\n registerSource(registry, \"root\", transformRootCategories, {\n categories: [...rootCategories],\n getWebpages,\n });\n\n const loadTeam = createTeamLoader(auth);\n\n // ── Global search (aggregated) ──\n // A host's own tools ride along so a root query finds them beside assets,\n // and so do workspace members when the host offers Team.\n const withHostTools = getTools\n ? withProvidedTools(fetchGlobalSearch, getTools)\n : fetchGlobalSearch;\n registerSource(\n registry,\n \"global_search\",\n rootCategories.includes(\"team\") ? withTeam(withHostTools, loadTeam) : withHostTools,\n { auth },\n );\n bindScopes(registry, \"root\", \"global_search\");\n\n // ── Assets ──\n registerSource(registry, \"athena_assets\", fetchAssets, { auth, limit: 50 });\n\n // ── Favorites ──\n registerSource(registry, \"favorites\", fetchFavorites, { auth, limit: 50 });\n\n // ── Folders (flat list) ──\n registerSource(\n registry,\n \"athena_folders\",\n fetchFolders,\n { auth, limit: 50 },\n true /* isFlat */,\n );\n\n // ── Internal drive (folder navigation root) ──\n registerSource(registry, \"internal_drive\", fetchFolderContents, {\n auth,\n limit: 50,\n });\n\n // ── Projects ──\n registerSource(registry, \"athena_projects\", fetchTypedAssets, {\n auth,\n includeOnlyTypes: [\"project\"],\n limit: 50,\n });\n\n // ── Browse Profiles ──\n registerSource(registry, \"athena_browse_profiles\", fetchTypedAssets, {\n auth,\n includeOnlyTypes: [\"browse_profile\"],\n limit: 50,\n });\n\n // ── Tools & Toolkits ── the server catalog, or the host's own list\n if (getTools) {\n registerSource(registry, \"tools\", transformProvidedTools, {\n getTools,\n type: \"tool\",\n });\n registerSource(registry, \"toolkits\", transformProvidedTools, {\n getTools,\n type: \"toolkit\",\n });\n } else {\n registerSource(registry, \"tools\", fetchTools, { auth });\n registerSource(registry, \"toolkits\", fetchToolkits, { auth });\n }\n\n // ── Team ──\n registerSource(registry, \"team\", fetchTeam, { auth, loadTeam });\n\n // ── Drives (catalogs) ──\n registerSource(registry, \"drive_catalogs\", fetchDrives, { auth });\n\n return new Store<MentionSuggestionsStoreState>({\n registry,\n cache,\n athenaUnavailable,\n });\n}\n\n/** Two reasons say the same thing (a host may hand a new object with the same words). */\nfunction sameReason(a: LabelCopy | null, b: LabelCopy | null): boolean {\n if (a === null || b === null) return a === b;\n return a.label === b.label && a.detail === b.detail;\n}\n\n// ── Hook ──\n\n/**\n * Creates a stable MentionSuggestionsStore.\n * Uses MentionAuthCtx for API credentials.\n */\nexport function useMentionSuggestions({\n webpages,\n tools,\n rootCategories = ROOT_MENTION_CATEGORIES,\n athenaUnavailable = null,\n}: {\n webpages: readonly WebpageMention[];\n /**\n * Host-provided Tools / Toolkits candidates. When set (even empty) they\n * replace the server tool catalog for those categories and join root\n * search results; omitted, the categories fetch the catalog.\n */\n tools?: readonly MentionTool[];\n /** Categories shown at the top level; hosts can narrow the default set. */\n rootCategories?: readonly MentionRootCategory[];\n /**\n * Why nothing may be asked of Athena right now (`NEEDS_CONNECTION` while\n * Athena can't be reached), or `null`. Once it clears, the lookups that\n * failed meanwhile run again.\n */\n athenaUnavailable?: LabelCopy | null;\n}): {\n store: MentionSuggestionsStore;\n invalidate: (scope: string) => void;\n} {\n const auth = useMentionAuth();\n const webpagesRef = useRef(webpages);\n webpagesRef.current = webpages;\n const toolsRef = useRef(tools);\n toolsRef.current = tools;\n const hasProvidedTools = tools !== undefined;\n // Read once per store build: a store rebuilt meanwhile starts where the host stands.\n const athenaUnavailableRef = useRef(athenaUnavailable);\n athenaUnavailableRef.current = athenaUnavailable;\n\n // Depend on primitive values to avoid rebuilding store on object identity changes\n const store = useMemo(\n () =>\n buildStore({\n auth,\n getWebpages: () => webpagesRef.current,\n getTools: hasProvidedTools ? () => toolsRef.current ?? [] : undefined,\n rootCategories,\n athenaUnavailable: athenaUnavailableRef.current,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n auth.backendUrl,\n auth.accessToken,\n auth.apiKey,\n auth.workspaceId,\n auth.userId,\n hasProvidedTools,\n rootCategories.join(\",\"),\n ],\n );\n\n const invalidate = useMemo(\n () => (scope: string) => {\n const state = store.state;\n const { registry, cache } = state;\n\n // Clear scope from cache\n if (cache.items) {\n for (const item of Object.values(cache.items)) {\n item.visibleInScopes.delete(scope);\n }\n // Remove orphaned items\n for (const [id, item] of Object.entries(cache.items)) {\n if (item.visibleInScopes.size === 0) {\n delete cache.items[id];\n }\n }\n }\n\n // Reset fetch states\n if (registry.entries[scope]) {\n registry.entries[scope].fetchStates = {};\n }\n\n store.setState((prev) => ({ ...prev }));\n },\n [store],\n );\n\n // Before the menu's own effects run, so no lookup leaves under a stale answer;\n // a value that changed nothing keeps the store's state (and its readers) as is.\n useLayoutEffect(() => {\n const unavailableBefore = store.state.athenaUnavailable;\n if (sameReason(unavailableBefore, athenaUnavailable)) return;\n store.setState((prev) => ({ ...prev, athenaUnavailable }));\n if (unavailableBefore !== null && athenaUnavailable === null) {\n retryFailedFetches(store);\n }\n }, [athenaUnavailable, store]);\n\n const webpageFingerprint = webpageMentionFingerprint(webpages);\n const previousWebpageFingerprintRef = useRef<string | null>(null);\n\n useEffect(() => {\n if (previousWebpageFingerprintRef.current === webpageFingerprint) return;\n previousWebpageFingerprintRef.current = webpageFingerprint;\n invalidate(\"root\");\n }, [invalidate, webpageFingerprint]);\n\n // A changed tool list drops the cached Tools / Toolkits entries (and the\n // root search results they were folded into) so the next open re-reads it.\n const toolsFingerprint = tools ? providedToolsFingerprint(tools) : null;\n const previousToolsFingerprintRef = useRef<string | null>(null);\n\n useEffect(() => {\n if (previousToolsFingerprintRef.current === toolsFingerprint) return;\n previousToolsFingerprintRef.current = toolsFingerprint;\n if (toolsFingerprint === null) return;\n invalidate(\"tools\");\n invalidate(\"toolkits\");\n invalidate(\"global_search\");\n }, [invalidate, toolsFingerprint]);\n\n return { store, invalidate };\n}\n"],"names":["createScopeRegistry","createItemCache","registerSource","transformRootCategories","createTeamLoader","withProvidedTools","fetchGlobalSearch","withTeam","bindScopes","fetchAssets","fetchFavorites","fetchFolders","fetchFolderContents","fetchTypedAssets","transformProvidedTools","fetchTools","fetchToolkits","fetchTeam","fetchDrives","Store","useMentionAuth","useRef","store","useMemo","useLayoutEffect","retryFailedFetches","useEffect"],"mappings":";;;;;;;;;AA8CO,SAAS,0BACd,UACQ;AACR,SAAO,KAAK;AAAA,IACV,SAAS,IAAI,CAAC,EAAE,OAAO,OAAO,KAAK,gBAAgB;AAAA,MACjD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,CACD;AAAA,EAAA;AAEL;AAuBO,MAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAOO,SAAS,yBAAyB,OAAuC;AAC9E,SAAO,KAAK;AAAA,IACV,MAAM,IAAI,CAAC,EAAE,IAAI,MAAM,MAAM,aAAa,WAAW;AAAA,MACnD;AAAA,MACA;AAAA,MACA;AAAA,MACA,eAAe;AAAA,MACf,QAAQ;AAAA,IAAA,CACT;AAAA,EAAA;AAEL;AAEA,SAAS,WAAW;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAO4B;AAC1B,QAAM,WAAWA,cAAAA,oBAAA;AAC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,YAAY,iBAAkB;AAC9D,gCAA4B,UAAU;AACtC,QAAI,qBAAqB,KAAM;AAC/B,eAAW,OAAO;AAClB,eAAW,UAAU;AACrB,eAAW,eAAe;AAAA,EAC5B,GAAG,CAAC,YAAY,gBAAgB,CAAC;AAEjC,SAAO,EAAE,OAAAJ,QAAO,WAAA;AAClB;;;;;"}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* async data fetching via GraphQL. A host may hand the Tools / Toolkits
|
|
12
12
|
* categories its own list instead of the server catalog (`tools`).
|
|
13
13
|
*/
|
|
14
|
+
import type { LabelCopy } from "../../../../agent-runtime/src/offline-status";
|
|
14
15
|
import { Store } from "@tanstack/store";
|
|
15
16
|
import { type ItemCache } from "./item-cache";
|
|
16
17
|
import { type ScopeRegistry } from "./scope-registry";
|
|
@@ -19,6 +20,13 @@ export declare function webpageMentionFingerprint(webpages: readonly WebpageMent
|
|
|
19
20
|
export interface MentionSuggestionsStoreState {
|
|
20
21
|
registry: ScopeRegistry;
|
|
21
22
|
cache: ItemCache;
|
|
23
|
+
/**
|
|
24
|
+
* Why nothing is asked of Athena right now, or `null` while it answers: the
|
|
25
|
+
* scopes whose source asks Athena fetch nothing and say this instead, while
|
|
26
|
+
* the host's own items (its tabs, its tool list) and what was already loaded
|
|
27
|
+
* still show.
|
|
28
|
+
*/
|
|
29
|
+
athenaUnavailable: LabelCopy | null;
|
|
22
30
|
}
|
|
23
31
|
export type MentionSuggestionsStore = Store<MentionSuggestionsStoreState>;
|
|
24
32
|
/**
|
|
@@ -32,7 +40,7 @@ export declare function providedToolsFingerprint(tools: readonly MentionTool[]):
|
|
|
32
40
|
* Creates a stable MentionSuggestionsStore.
|
|
33
41
|
* Uses MentionAuthCtx for API credentials.
|
|
34
42
|
*/
|
|
35
|
-
export declare function useMentionSuggestions({ webpages, tools, rootCategories, }: {
|
|
43
|
+
export declare function useMentionSuggestions({ webpages, tools, rootCategories, athenaUnavailable, }: {
|
|
36
44
|
webpages: readonly WebpageMention[];
|
|
37
45
|
/**
|
|
38
46
|
* Host-provided Tools / Toolkits candidates. When set (even empty) they
|
|
@@ -42,6 +50,12 @@ export declare function useMentionSuggestions({ webpages, tools, rootCategories,
|
|
|
42
50
|
tools?: readonly MentionTool[];
|
|
43
51
|
/** Categories shown at the top level; hosts can narrow the default set. */
|
|
44
52
|
rootCategories?: readonly MentionRootCategory[];
|
|
53
|
+
/**
|
|
54
|
+
* Why nothing may be asked of Athena right now (`NEEDS_CONNECTION` while
|
|
55
|
+
* Athena can't be reached), or `null`. Once it clears, the lookups that
|
|
56
|
+
* failed meanwhile run again.
|
|
57
|
+
*/
|
|
58
|
+
athenaUnavailable?: LabelCopy | null;
|
|
45
59
|
}): {
|
|
46
60
|
store: MentionSuggestionsStore;
|
|
47
61
|
invalidate: (scope: string) => void;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Store } from "@tanstack/store";
|
|
2
|
-
import { useRef, useMemo, useEffect } from "react";
|
|
2
|
+
import { useRef, useMemo, useLayoutEffect, useEffect } from "react";
|
|
3
3
|
import { useMentionAuth } from "./api-client.js";
|
|
4
4
|
import { createItemCache } from "./item-cache.js";
|
|
5
|
+
import { retryFailedFetches } from "./orchestrator.js";
|
|
5
6
|
import { registerSource, bindScopes, createScopeRegistry } from "./scope-registry.js";
|
|
6
|
-
import { transformRootCategories,
|
|
7
|
+
import { transformRootCategories, withProvidedTools, fetchGlobalSearch, withTeam, fetchAssets, fetchFavorites, fetchFolders, fetchFolderContents, fetchTypedAssets, transformProvidedTools, fetchTools, fetchToolkits, fetchTeam, fetchDrives, createTeamLoader } from "./sources/index.js";
|
|
7
8
|
function webpageMentionFingerprint(webpages) {
|
|
8
9
|
return JSON.stringify(
|
|
9
10
|
webpages.map(({ tabId, title, url, isCurrent }) => [
|
|
@@ -40,7 +41,8 @@ function buildStore({
|
|
|
40
41
|
auth,
|
|
41
42
|
getWebpages,
|
|
42
43
|
getTools,
|
|
43
|
-
rootCategories
|
|
44
|
+
rootCategories,
|
|
45
|
+
athenaUnavailable
|
|
44
46
|
}) {
|
|
45
47
|
const registry = createScopeRegistry();
|
|
46
48
|
const cache = createItemCache();
|
|
@@ -95,12 +97,21 @@ function buildStore({
|
|
|
95
97
|
}
|
|
96
98
|
registerSource(registry, "team", fetchTeam, { auth, loadTeam });
|
|
97
99
|
registerSource(registry, "drive_catalogs", fetchDrives, { auth });
|
|
98
|
-
return new Store({
|
|
100
|
+
return new Store({
|
|
101
|
+
registry,
|
|
102
|
+
cache,
|
|
103
|
+
athenaUnavailable
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function sameReason(a, b) {
|
|
107
|
+
if (a === null || b === null) return a === b;
|
|
108
|
+
return a.label === b.label && a.detail === b.detail;
|
|
99
109
|
}
|
|
100
110
|
function useMentionSuggestions({
|
|
101
111
|
webpages,
|
|
102
112
|
tools,
|
|
103
|
-
rootCategories = ROOT_MENTION_CATEGORIES
|
|
113
|
+
rootCategories = ROOT_MENTION_CATEGORIES,
|
|
114
|
+
athenaUnavailable = null
|
|
104
115
|
}) {
|
|
105
116
|
const auth = useMentionAuth();
|
|
106
117
|
const webpagesRef = useRef(webpages);
|
|
@@ -108,12 +119,15 @@ function useMentionSuggestions({
|
|
|
108
119
|
const toolsRef = useRef(tools);
|
|
109
120
|
toolsRef.current = tools;
|
|
110
121
|
const hasProvidedTools = tools !== void 0;
|
|
122
|
+
const athenaUnavailableRef = useRef(athenaUnavailable);
|
|
123
|
+
athenaUnavailableRef.current = athenaUnavailable;
|
|
111
124
|
const store = useMemo(
|
|
112
125
|
() => buildStore({
|
|
113
126
|
auth,
|
|
114
127
|
getWebpages: () => webpagesRef.current,
|
|
115
128
|
getTools: hasProvidedTools ? () => toolsRef.current ?? [] : void 0,
|
|
116
|
-
rootCategories
|
|
129
|
+
rootCategories,
|
|
130
|
+
athenaUnavailable: athenaUnavailableRef.current
|
|
117
131
|
}),
|
|
118
132
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
119
133
|
[
|
|
@@ -147,6 +161,14 @@ function useMentionSuggestions({
|
|
|
147
161
|
},
|
|
148
162
|
[store]
|
|
149
163
|
);
|
|
164
|
+
useLayoutEffect(() => {
|
|
165
|
+
const unavailableBefore = store.state.athenaUnavailable;
|
|
166
|
+
if (sameReason(unavailableBefore, athenaUnavailable)) return;
|
|
167
|
+
store.setState((prev) => ({ ...prev, athenaUnavailable }));
|
|
168
|
+
if (unavailableBefore !== null && athenaUnavailable === null) {
|
|
169
|
+
retryFailedFetches(store);
|
|
170
|
+
}
|
|
171
|
+
}, [athenaUnavailable, store]);
|
|
150
172
|
const webpageFingerprint = webpageMentionFingerprint(webpages);
|
|
151
173
|
const previousWebpageFingerprintRef = useRef(null);
|
|
152
174
|
useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-mention-suggestions.js","sources":["../../../../../src/chat-ui/mentions/suggestions/data/use-mention-suggestions.ts"],"sourcesContent":["/**\n * Mention Suggestions Store — shared by every Athena chat host (the Chrome\n * side panel, the Office task pane, the SDK's AthenaChat).\n *\n * Full Olympus-style mention store with all categories:\n * Favorites, Assets, Projects, Browse Profiles, Folders,\n * current/group webpages, Team, Workspace, Drives + Global Search (assets,\n * plus workspace members when Team is offered).\n *\n * Uses registry + cache architecture from Olympus with\n * async data fetching via GraphQL. A host may hand the Tools / Toolkits\n * categories its own list instead of the server catalog (`tools`).\n */\n\nimport { Store } from \"@tanstack/store\";\nimport { useEffect, useMemo, useRef } from \"react\";\nimport type { MentionAuthContext } from \"./api-client\";\nimport { useMentionAuth } from \"./api-client\";\nimport { createItemCache, type ItemCache } from \"./item-cache\";\nimport {\n createScopeRegistry,\n registerSource,\n bindScopes,\n type ScopeRegistry,\n} from \"./scope-registry\";\nimport {\n transformRootCategories,\n fetchAssets,\n fetchFavorites,\n fetchFolders,\n fetchFolderContents,\n fetchTypedAssets,\n fetchTeam,\n fetchTools,\n fetchToolkits,\n fetchDrives,\n fetchGlobalSearch,\n transformProvidedTools,\n withProvidedTools,\n createTeamLoader,\n withTeam,\n} from \"./sources\";\nimport type { MentionTool, WebpageMention } from \"./types\";\n\nexport function webpageMentionFingerprint(\n webpages: readonly WebpageMention[],\n): string {\n return JSON.stringify(\n webpages.map(({ tabId, title, url, isCurrent }) => [\n tabId,\n title,\n url,\n isCurrent,\n ]),\n );\n}\n\n// ── Store types ──\n\nexport interface MentionSuggestionsStoreState {\n registry: ScopeRegistry;\n cache: ItemCache;\n}\n\nexport type MentionSuggestionsStore = Store<MentionSuggestionsStoreState>;\n\n// ── Categories ──\n\n/**\n * All mention menu categories, in display order.\n */\nexport const ROOT_MENTION_CATEGORIES = [\n \"favorites\",\n \"assets\",\n \"projects\",\n \"browse_profiles\",\n \"folders\",\n \"tools\",\n \"toolkits\",\n \"team\",\n \"drives\",\n] as const;\n\nexport type MentionRootCategory = (typeof ROOT_MENTION_CATEGORIES)[number];\n\n// ── Store builder ──\n\n/** Stable fingerprint of a host's tool list, for cache invalidation. */\nexport function providedToolsFingerprint(tools: readonly MentionTool[]): string {\n return JSON.stringify(\n tools.map(({ id, name, type, description, icon }) => [\n id,\n name,\n type,\n description ?? null,\n icon ?? null,\n ]),\n );\n}\n\nfunction buildStore({\n auth,\n getWebpages,\n getTools,\n rootCategories,\n}: {\n auth: MentionAuthContext;\n getWebpages: () => readonly WebpageMention[];\n /** Present when the host supplies the Tools / Toolkits list itself. */\n getTools?: () => readonly MentionTool[];\n rootCategories: readonly MentionRootCategory[];\n}): MentionSuggestionsStore {\n const registry = createScopeRegistry();\n const cache = createItemCache();\n\n // ── Root categories ──\n registerSource(registry, \"root\", transformRootCategories, {\n categories: [...rootCategories],\n getWebpages,\n });\n\n const loadTeam = createTeamLoader(auth);\n\n // ── Global search (aggregated) ──\n // A host's own tools ride along so a root query finds them beside assets,\n // and so do workspace members when the host offers Team.\n const withHostTools = getTools\n ? withProvidedTools(fetchGlobalSearch, getTools)\n : fetchGlobalSearch;\n registerSource(\n registry,\n \"global_search\",\n rootCategories.includes(\"team\") ? withTeam(withHostTools, loadTeam) : withHostTools,\n { auth },\n );\n bindScopes(registry, \"root\", \"global_search\");\n\n // ── Assets ──\n registerSource(registry, \"athena_assets\", fetchAssets, { auth, limit: 50 });\n\n // ── Favorites ──\n registerSource(registry, \"favorites\", fetchFavorites, { auth, limit: 50 });\n\n // ── Folders (flat list) ──\n registerSource(\n registry,\n \"athena_folders\",\n fetchFolders,\n { auth, limit: 50 },\n true /* isFlat */,\n );\n\n // ── Internal drive (folder navigation root) ──\n registerSource(registry, \"internal_drive\", fetchFolderContents, {\n auth,\n limit: 50,\n });\n\n // ── Projects ──\n registerSource(registry, \"athena_projects\", fetchTypedAssets, {\n auth,\n includeOnlyTypes: [\"project\"],\n limit: 50,\n });\n\n // ── Browse Profiles ──\n registerSource(registry, \"athena_browse_profiles\", fetchTypedAssets, {\n auth,\n includeOnlyTypes: [\"browse_profile\"],\n limit: 50,\n });\n\n // ── Tools & Toolkits ── the server catalog, or the host's own list\n if (getTools) {\n registerSource(registry, \"tools\", transformProvidedTools, {\n getTools,\n type: \"tool\",\n });\n registerSource(registry, \"toolkits\", transformProvidedTools, {\n getTools,\n type: \"toolkit\",\n });\n } else {\n registerSource(registry, \"tools\", fetchTools, { auth });\n registerSource(registry, \"toolkits\", fetchToolkits, { auth });\n }\n\n // ── Team ──\n registerSource(registry, \"team\", fetchTeam, { auth, loadTeam });\n\n // ── Drives (catalogs) ──\n registerSource(registry, \"drive_catalogs\", fetchDrives, { auth });\n\n return new Store<MentionSuggestionsStoreState>({ registry, cache });\n}\n\n// ── Hook ──\n\n/**\n * Creates a stable MentionSuggestionsStore.\n * Uses MentionAuthCtx for API credentials.\n */\nexport function useMentionSuggestions({\n webpages,\n tools,\n rootCategories = ROOT_MENTION_CATEGORIES,\n}: {\n webpages: readonly WebpageMention[];\n /**\n * Host-provided Tools / Toolkits candidates. When set (even empty) they\n * replace the server tool catalog for those categories and join root\n * search results; omitted, the categories fetch the catalog.\n */\n tools?: readonly MentionTool[];\n /** Categories shown at the top level; hosts can narrow the default set. */\n rootCategories?: readonly MentionRootCategory[];\n}): {\n store: MentionSuggestionsStore;\n invalidate: (scope: string) => void;\n} {\n const auth = useMentionAuth();\n const webpagesRef = useRef(webpages);\n webpagesRef.current = webpages;\n const toolsRef = useRef(tools);\n toolsRef.current = tools;\n const hasProvidedTools = tools !== undefined;\n\n // Depend on primitive values to avoid rebuilding store on object identity changes\n const store = useMemo(\n () =>\n buildStore({\n auth,\n getWebpages: () => webpagesRef.current,\n getTools: hasProvidedTools ? () => toolsRef.current ?? [] : undefined,\n rootCategories,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n auth.backendUrl,\n auth.accessToken,\n auth.apiKey,\n auth.workspaceId,\n auth.userId,\n hasProvidedTools,\n rootCategories.join(\",\"),\n ],\n );\n\n const invalidate = useMemo(\n () => (scope: string) => {\n const state = store.state;\n const { registry, cache } = state;\n\n // Clear scope from cache\n if (cache.items) {\n for (const item of Object.values(cache.items)) {\n item.visibleInScopes.delete(scope);\n }\n // Remove orphaned items\n for (const [id, item] of Object.entries(cache.items)) {\n if (item.visibleInScopes.size === 0) {\n delete cache.items[id];\n }\n }\n }\n\n // Reset fetch states\n if (registry.entries[scope]) {\n registry.entries[scope].fetchStates = {};\n }\n\n store.setState((prev) => ({ ...prev }));\n },\n [store],\n );\n\n const webpageFingerprint = webpageMentionFingerprint(webpages);\n const previousWebpageFingerprintRef = useRef<string | null>(null);\n\n useEffect(() => {\n if (previousWebpageFingerprintRef.current === webpageFingerprint) return;\n previousWebpageFingerprintRef.current = webpageFingerprint;\n invalidate(\"root\");\n }, [invalidate, webpageFingerprint]);\n\n // A changed tool list drops the cached Tools / Toolkits entries (and the\n // root search results they were folded into) so the next open re-reads it.\n const toolsFingerprint = tools ? providedToolsFingerprint(tools) : null;\n const previousToolsFingerprintRef = useRef<string | null>(null);\n\n useEffect(() => {\n if (previousToolsFingerprintRef.current === toolsFingerprint) return;\n previousToolsFingerprintRef.current = toolsFingerprint;\n if (toolsFingerprint === null) return;\n invalidate(\"tools\");\n invalidate(\"toolkits\");\n invalidate(\"global_search\");\n }, [invalidate, toolsFingerprint]);\n\n return { store, invalidate };\n}\n"],"names":[],"mappings":";;;;;;AA4CO,SAAS,0BACd,UACQ;AACR,SAAO,KAAK;AAAA,IACV,SAAS,IAAI,CAAC,EAAE,OAAO,OAAO,KAAK,gBAAgB;AAAA,MACjD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,CACD;AAAA,EAAA;AAEL;AAgBO,MAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAOO,SAAS,yBAAyB,OAAuC;AAC9E,SAAO,KAAK;AAAA,IACV,MAAM,IAAI,CAAC,EAAE,IAAI,MAAM,MAAM,aAAa,WAAW;AAAA,MACnD;AAAA,MACA;AAAA,MACA;AAAA,MACA,eAAe;AAAA,MACf,QAAQ;AAAA,IAAA,CACT;AAAA,EAAA;AAEL;AAEA,SAAS,WAAW;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAM4B;AAC1B,QAAM,WAAW,oBAAA;AACjB,QAAM,QAAQ,gBAAA;AAGd,iBAAe,UAAU,QAAQ,yBAAyB;AAAA,IACxD,YAAY,CAAC,GAAG,cAAc;AAAA,IAC9B;AAAA,EAAA,CACD;AAED,QAAM,WAAW,iBAAiB,IAAI;AAKtC,QAAM,gBAAgB,WAClB,kBAAkB,mBAAmB,QAAQ,IAC7C;AACJ;AAAA,IACE;AAAA,IACA;AAAA,IACA,eAAe,SAAS,MAAM,IAAI,SAAS,eAAe,QAAQ,IAAI;AAAA,IACtE,EAAE,KAAA;AAAA,EAAK;AAET,aAAW,UAAU,QAAQ,eAAe;AAG5C,iBAAe,UAAU,iBAAiB,aAAa,EAAE,MAAM,OAAO,IAAI;AAG1E,iBAAe,UAAU,aAAa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U;AACrB,eAAW,eAAe;AAAA,EAC5B,GAAG,CAAC,YAAY,gBAAgB,CAAC;AAEjC,SAAO,EAAE,OAAO,WAAA;AAClB;"}
|
|
1
|
+
{"version":3,"file":"use-mention-suggestions.js","sources":["../../../../../src/chat-ui/mentions/suggestions/data/use-mention-suggestions.ts"],"sourcesContent":["/**\n * Mention Suggestions Store — shared by every Athena chat host (the Chrome\n * side panel, the Office task pane, the SDK's AthenaChat).\n *\n * Full Olympus-style mention store with all categories:\n * Favorites, Assets, Projects, Browse Profiles, Folders,\n * current/group webpages, Team, Workspace, Drives + Global Search (assets,\n * plus workspace members when Team is offered).\n *\n * Uses registry + cache architecture from Olympus with\n * async data fetching via GraphQL. A host may hand the Tools / Toolkits\n * categories its own list instead of the server catalog (`tools`).\n */\n\nimport type { LabelCopy } from \"@athenaintel/agent-runtime/offline-status\";\nimport { Store } from \"@tanstack/store\";\nimport { useEffect, useLayoutEffect, useMemo, useRef } from \"react\";\nimport type { MentionAuthContext } from \"./api-client\";\nimport { useMentionAuth } from \"./api-client\";\nimport { createItemCache, type ItemCache } from \"./item-cache\";\nimport { retryFailedFetches } from \"./orchestrator\";\nimport {\n createScopeRegistry,\n registerSource,\n bindScopes,\n type ScopeRegistry,\n} from \"./scope-registry\";\nimport {\n transformRootCategories,\n fetchAssets,\n fetchFavorites,\n fetchFolders,\n fetchFolderContents,\n fetchTypedAssets,\n fetchTeam,\n fetchTools,\n fetchToolkits,\n fetchDrives,\n fetchGlobalSearch,\n transformProvidedTools,\n withProvidedTools,\n createTeamLoader,\n withTeam,\n} from \"./sources\";\nimport type { MentionTool, WebpageMention } from \"./types\";\n\nexport function webpageMentionFingerprint(\n webpages: readonly WebpageMention[],\n): string {\n return JSON.stringify(\n webpages.map(({ tabId, title, url, isCurrent }) => [\n tabId,\n title,\n url,\n isCurrent,\n ]),\n );\n}\n\n// ── Store types ──\n\nexport interface MentionSuggestionsStoreState {\n registry: ScopeRegistry;\n cache: ItemCache;\n /**\n * Why nothing is asked of Athena right now, or `null` while it answers: the\n * scopes whose source asks Athena fetch nothing and say this instead, while\n * the host's own items (its tabs, its tool list) and what was already loaded\n * still show.\n */\n athenaUnavailable: LabelCopy | null;\n}\n\nexport type MentionSuggestionsStore = Store<MentionSuggestionsStoreState>;\n\n// ── Categories ──\n\n/**\n * All mention menu categories, in display order.\n */\nexport const ROOT_MENTION_CATEGORIES = [\n \"favorites\",\n \"assets\",\n \"projects\",\n \"browse_profiles\",\n \"folders\",\n \"tools\",\n \"toolkits\",\n \"team\",\n \"drives\",\n] as const;\n\nexport type MentionRootCategory = (typeof ROOT_MENTION_CATEGORIES)[number];\n\n// ── Store builder ──\n\n/** Stable fingerprint of a host's tool list, for cache invalidation. */\nexport function providedToolsFingerprint(tools: readonly MentionTool[]): string {\n return JSON.stringify(\n tools.map(({ id, name, type, description, icon }) => [\n id,\n name,\n type,\n description ?? null,\n icon ?? null,\n ]),\n );\n}\n\nfunction buildStore({\n auth,\n getWebpages,\n getTools,\n rootCategories,\n athenaUnavailable,\n}: {\n auth: MentionAuthContext;\n getWebpages: () => readonly WebpageMention[];\n /** Present when the host supplies the Tools / Toolkits list itself. */\n getTools?: () => readonly MentionTool[];\n rootCategories: readonly MentionRootCategory[];\n athenaUnavailable: LabelCopy | null;\n}): MentionSuggestionsStore {\n const registry = createScopeRegistry();\n const cache = createItemCache();\n\n // ── Root categories ──\n registerSource(registry, \"root\", transformRootCategories, {\n categories: [...rootCategories],\n getWebpages,\n });\n\n const loadTeam = createTeamLoader(auth);\n\n // ── Global search (aggregated) ──\n // A host's own tools ride along so a root query finds them beside assets,\n // and so do workspace members when the host offers Team.\n const withHostTools = getTools\n ? withProvidedTools(fetchGlobalSearch, getTools)\n : fetchGlobalSearch;\n registerSource(\n registry,\n \"global_search\",\n rootCategories.includes(\"team\") ? withTeam(withHostTools, loadTeam) : withHostTools,\n { auth },\n );\n bindScopes(registry, \"root\", \"global_search\");\n\n // ── Assets ──\n registerSource(registry, \"athena_assets\", fetchAssets, { auth, limit: 50 });\n\n // ── Favorites ──\n registerSource(registry, \"favorites\", fetchFavorites, { auth, limit: 50 });\n\n // ── Folders (flat list) ──\n registerSource(\n registry,\n \"athena_folders\",\n fetchFolders,\n { auth, limit: 50 },\n true /* isFlat */,\n );\n\n // ── Internal drive (folder navigation root) ──\n registerSource(registry, \"internal_drive\", fetchFolderContents, {\n auth,\n limit: 50,\n });\n\n // ── Projects ──\n registerSource(registry, \"athena_projects\", fetchTypedAssets, {\n auth,\n includeOnlyTypes: [\"project\"],\n limit: 50,\n });\n\n // ── Browse Profiles ──\n registerSource(registry, \"athena_browse_profiles\", fetchTypedAssets, {\n auth,\n includeOnlyTypes: [\"browse_profile\"],\n limit: 50,\n });\n\n // ── Tools & Toolkits ── the server catalog, or the host's own list\n if (getTools) {\n registerSource(registry, \"tools\", transformProvidedTools, {\n getTools,\n type: \"tool\",\n });\n registerSource(registry, \"toolkits\", transformProvidedTools, {\n getTools,\n type: \"toolkit\",\n });\n } else {\n registerSource(registry, \"tools\", fetchTools, { auth });\n registerSource(registry, \"toolkits\", fetchToolkits, { auth });\n }\n\n // ── Team ──\n registerSource(registry, \"team\", fetchTeam, { auth, loadTeam });\n\n // ── Drives (catalogs) ──\n registerSource(registry, \"drive_catalogs\", fetchDrives, { auth });\n\n return new Store<MentionSuggestionsStoreState>({\n registry,\n cache,\n athenaUnavailable,\n });\n}\n\n/** Two reasons say the same thing (a host may hand a new object with the same words). */\nfunction sameReason(a: LabelCopy | null, b: LabelCopy | null): boolean {\n if (a === null || b === null) return a === b;\n return a.label === b.label && a.detail === b.detail;\n}\n\n// ── Hook ──\n\n/**\n * Creates a stable MentionSuggestionsStore.\n * Uses MentionAuthCtx for API credentials.\n */\nexport function useMentionSuggestions({\n webpages,\n tools,\n rootCategories = ROOT_MENTION_CATEGORIES,\n athenaUnavailable = null,\n}: {\n webpages: readonly WebpageMention[];\n /**\n * Host-provided Tools / Toolkits candidates. When set (even empty) they\n * replace the server tool catalog for those categories and join root\n * search results; omitted, the categories fetch the catalog.\n */\n tools?: readonly MentionTool[];\n /** Categories shown at the top level; hosts can narrow the default set. */\n rootCategories?: readonly MentionRootCategory[];\n /**\n * Why nothing may be asked of Athena right now (`NEEDS_CONNECTION` while\n * Athena can't be reached), or `null`. Once it clears, the lookups that\n * failed meanwhile run again.\n */\n athenaUnavailable?: LabelCopy | null;\n}): {\n store: MentionSuggestionsStore;\n invalidate: (scope: string) => void;\n} {\n const auth = useMentionAuth();\n const webpagesRef = useRef(webpages);\n webpagesRef.current = webpages;\n const toolsRef = useRef(tools);\n toolsRef.current = tools;\n const hasProvidedTools = tools !== undefined;\n // Read once per store build: a store rebuilt meanwhile starts where the host stands.\n const athenaUnavailableRef = useRef(athenaUnavailable);\n athenaUnavailableRef.current = athenaUnavailable;\n\n // Depend on primitive values to avoid rebuilding store on object identity changes\n const store = useMemo(\n () =>\n buildStore({\n auth,\n getWebpages: () => webpagesRef.current,\n getTools: hasProvidedTools ? () => toolsRef.current ?? [] : undefined,\n rootCategories,\n athenaUnavailable: athenaUnavailableRef.current,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n auth.backendUrl,\n auth.accessToken,\n auth.apiKey,\n auth.workspaceId,\n auth.userId,\n hasProvidedTools,\n rootCategories.join(\",\"),\n ],\n );\n\n const invalidate = useMemo(\n () => (scope: string) => {\n const state = store.state;\n const { registry, cache } = state;\n\n // Clear scope from cache\n if (cache.items) {\n for (const item of Object.values(cache.items)) {\n item.visibleInScopes.delete(scope);\n }\n // Remove orphaned items\n for (const [id, item] of Object.entries(cache.items)) {\n if (item.visibleInScopes.size === 0) {\n delete cache.items[id];\n }\n }\n }\n\n // Reset fetch states\n if (registry.entries[scope]) {\n registry.entries[scope].fetchStates = {};\n }\n\n store.setState((prev) => ({ ...prev }));\n },\n [store],\n );\n\n // Before the menu's own effects run, so no lookup leaves under a stale answer;\n // a value that changed nothing keeps the store's state (and its readers) as is.\n useLayoutEffect(() => {\n const unavailableBefore = store.state.athenaUnavailable;\n if (sameReason(unavailableBefore, athenaUnavailable)) return;\n store.setState((prev) => ({ ...prev, athenaUnavailable }));\n if (unavailableBefore !== null && athenaUnavailable === null) {\n retryFailedFetches(store);\n }\n }, [athenaUnavailable, store]);\n\n const webpageFingerprint = webpageMentionFingerprint(webpages);\n const previousWebpageFingerprintRef = useRef<string | null>(null);\n\n useEffect(() => {\n if (previousWebpageFingerprintRef.current === webpageFingerprint) return;\n previousWebpageFingerprintRef.current = webpageFingerprint;\n invalidate(\"root\");\n }, [invalidate, webpageFingerprint]);\n\n // A changed tool list drops the cached Tools / Toolkits entries (and the\n // root search results they were folded into) so the next open re-reads it.\n const toolsFingerprint = tools ? providedToolsFingerprint(tools) : null;\n const previousToolsFingerprintRef = useRef<string | null>(null);\n\n useEffect(() => {\n if (previousToolsFingerprintRef.current === toolsFingerprint) return;\n previousToolsFingerprintRef.current = toolsFingerprint;\n if (toolsFingerprint === null) return;\n invalidate(\"tools\");\n invalidate(\"toolkits\");\n invalidate(\"global_search\");\n }, [invalidate, toolsFingerprint]);\n\n return { store, invalidate };\n}\n"],"names":[],"mappings":";;;;;;;AA8CO,SAAS,0BACd,UACQ;AACR,SAAO,KAAK;AAAA,IACV,SAAS,IAAI,CAAC,EAAE,OAAO,OAAO,KAAK,gBAAgB;AAAA,MACjD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,CACD;AAAA,EAAA;AAEL;AAuBO,MAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAOO,SAAS,yBAAyB,OAAuC;AAC9E,SAAO,KAAK;AAAA,IACV,MAAM,IAAI,CAAC,EAAE,IAAI,MAAM,MAAM,aAAa,WAAW;AAAA,MACnD;AAAA,MACA;AAAA,MACA;AAAA,MACA,eAAe;AAAA,MACf,QAAQ;AAAA,IAAA,CACT;AAAA,EAAA;AAEL;AAEA,SA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1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const reactStore = require("@tanstack/react-store");
|
|
4
|
-
const
|
|
4
|
+
const require$$0 = require("react");
|
|
5
5
|
const orchestrator = require("./orchestrator.cjs");
|
|
6
6
|
function useMenuItems(store, options) {
|
|
7
7
|
const { scope, query = "", minItems = 50, parentScope } = options;
|
|
8
|
-
const [targetCount, setTargetCount] =
|
|
9
|
-
|
|
8
|
+
const [targetCount, setTargetCount] = require$$0.useState(minItems);
|
|
9
|
+
require$$0.useEffect(() => {
|
|
10
10
|
setTargetCount(minItems);
|
|
11
11
|
}, [scope, query, minItems]);
|
|
12
12
|
const snapshot = reactStore.useStore(
|
|
13
13
|
store,
|
|
14
14
|
() => orchestrator.selectItems(store, scope, query, targetCount, parentScope)
|
|
15
15
|
);
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const waitsOnAthena = snapshot.unavailable !== null;
|
|
17
|
+
require$$0.useEffect(() => {
|
|
18
|
+
if (!waitsOnAthena && snapshot.items.length < targetCount && snapshot.hasMore && !snapshot.isFetching) {
|
|
18
19
|
orchestrator.triggerFetchIfNeeded(store, scope, query, targetCount, parentScope);
|
|
19
20
|
}
|
|
20
21
|
}, [
|
|
@@ -23,12 +24,13 @@ function useMenuItems(store, options) {
|
|
|
23
24
|
query,
|
|
24
25
|
targetCount,
|
|
25
26
|
parentScope,
|
|
27
|
+
waitsOnAthena,
|
|
26
28
|
snapshot.items.length,
|
|
27
29
|
snapshot.hasMore,
|
|
28
30
|
snapshot.isFetching
|
|
29
31
|
]);
|
|
30
32
|
const loadMore = () => {
|
|
31
|
-
if (snapshot.hasMore && !snapshot.isFetching) {
|
|
33
|
+
if (!waitsOnAthena && snapshot.hasMore && !snapshot.isFetching) {
|
|
32
34
|
setTargetCount((prev) => prev + 50);
|
|
33
35
|
}
|
|
34
36
|
};
|
|
@@ -36,6 +38,7 @@ function useMenuItems(store, options) {
|
|
|
36
38
|
items: snapshot.items,
|
|
37
39
|
isFetching: snapshot.isFetching,
|
|
38
40
|
hasMore: snapshot.hasMore,
|
|
41
|
+
unavailable: snapshot.unavailable,
|
|
39
42
|
loadMore,
|
|
40
43
|
targetCount
|
|
41
44
|
// Expose for debugging
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-menu-items.cjs","sources":["../../../../../src/chat-ui/mentions/suggestions/data/use-menu-items.ts"],"sourcesContent":["import { useStore } from '@tanstack/react-store';\nimport { useEffect, useState } from 'react';\nimport { selectItems, triggerFetchIfNeeded } from './orchestrator';\nimport type { MenuItem, MenuScope } from './types';\nimport type { MentionSuggestionsStore } from './use-mention-suggestions';\n\n/**\n * useMenuItems - Like React Query, but for menu items\n *\n * Clean, automatic hook that:\n * - Reads items from store (reactive!)\n * - Auto-fetches if needed (in useEffect)\n * - Returns clean interface { items, isFetching, hasMore }\n *\n * Usage:\n * ```typescript\n * const { items, isFetching, hasMore } = useMenuItems(store, {\n * scope: 'athena_folders',\n * query: 'doc',\n * minItems: 10,\n * parentScope: 'root'\n * });\n * ```\n */\nexport interface UseMenuItemsOptions {\n scope: MenuScope;\n query?: string;\n minItems?: number;\n parentScope?: MenuScope;\n}\n\nexport interface UseMenuItemsResult {\n items: MenuItem[];\n isFetching: boolean;\n hasMore: boolean;\n loadMore: () => void; // Explicit load more (not automatic!)\n targetCount: number; // Current target for debugging\n}\n\nexport function useMenuItems(\n store: MentionSuggestionsStore,\n options: UseMenuItemsOptions\n): UseMenuItemsResult {\n const { scope, query = '', minItems = 50, parentScope } = options;\n\n // Target item count (increases when user clicks \"Load More\")\n const [targetCount, setTargetCount] = useState(minItems);\n\n // Reset target when scope/query changes\n // biome-ignore lint/correctness/useExhaustiveDependencies: We intentionally reset on scope/query change\n useEffect(() => {\n setTargetCount(minItems);\n }, [scope, query, minItems]);\n\n // Read from store (pure, reactive)\n const snapshot = useStore(store, () =>\n selectItems(store, scope, query, targetCount, parentScope)\n );\n\n // Auto-fetch when: cached < target AND hasMore AND !fetching\n useEffect(() => {\n if (snapshot.items.length < targetCount
|
|
1
|
+
{"version":3,"file":"use-menu-items.cjs","sources":["../../../../../src/chat-ui/mentions/suggestions/data/use-menu-items.ts"],"sourcesContent":["import type { LabelCopy } from '@athenaintel/agent-runtime/offline-status';\nimport { useStore } from '@tanstack/react-store';\nimport { useEffect, useState } from 'react';\nimport { selectItems, triggerFetchIfNeeded } from './orchestrator';\nimport type { MenuItem, MenuScope } from './types';\nimport type { MentionSuggestionsStore } from './use-mention-suggestions';\n\n/**\n * useMenuItems - Like React Query, but for menu items\n *\n * Clean, automatic hook that:\n * - Reads items from store (reactive!)\n * - Auto-fetches if needed (in useEffect)\n * - Returns clean interface { items, isFetching, hasMore }\n *\n * Usage:\n * ```typescript\n * const { items, isFetching, hasMore } = useMenuItems(store, {\n * scope: 'athena_folders',\n * query: 'doc',\n * minItems: 10,\n * parentScope: 'root'\n * });\n * ```\n */\nexport interface UseMenuItemsOptions {\n scope: MenuScope;\n query?: string;\n minItems?: number;\n parentScope?: MenuScope;\n}\n\nexport interface UseMenuItemsResult {\n items: MenuItem[];\n isFetching: boolean;\n hasMore: boolean;\n /** Why this scope can't load from Athena right now (`null` while it can, or for local items). */\n unavailable: LabelCopy | null;\n loadMore: () => void; // Explicit load more (not automatic!)\n targetCount: number; // Current target for debugging\n}\n\nexport function useMenuItems(\n store: MentionSuggestionsStore,\n options: UseMenuItemsOptions\n): UseMenuItemsResult {\n const { scope, query = '', minItems = 50, parentScope } = options;\n\n // Target item count (increases when user clicks \"Load More\")\n const [targetCount, setTargetCount] = useState(minItems);\n\n // Reset target when scope/query changes\n // biome-ignore lint/correctness/useExhaustiveDependencies: We intentionally reset on scope/query change\n useEffect(() => {\n setTargetCount(minItems);\n }, [scope, query, minItems]);\n\n // Read from store (pure, reactive)\n const snapshot = useStore(store, () =>\n selectItems(store, scope, query, targetCount, parentScope)\n );\n\n // Auto-fetch when: cached < target AND hasMore AND !fetching (and Athena can be asked)\n const waitsOnAthena = snapshot.unavailable !== null;\n useEffect(() => {\n if (\n !waitsOnAthena &&\n snapshot.items.length < targetCount &&\n snapshot.hasMore &&\n !snapshot.isFetching\n ) {\n triggerFetchIfNeeded(store, scope, query, targetCount, parentScope);\n }\n }, [\n store,\n scope,\n query,\n targetCount,\n parentScope,\n waitsOnAthena,\n snapshot.items.length,\n snapshot.hasMore,\n snapshot.isFetching,\n ]);\n\n // Explicit load more: Increase target by 50\n const loadMore = () => {\n if (!waitsOnAthena && snapshot.hasMore && !snapshot.isFetching) {\n setTargetCount((prev) => prev + 50);\n }\n };\n\n return {\n items: snapshot.items,\n isFetching: snapshot.isFetching,\n hasMore: snapshot.hasMore,\n unavailable: snapshot.unavailable,\n loadMore,\n targetCount, // Expose for debugging\n };\n}\n"],"names":["useState","useEffect","useStore","selectItems","triggerFetchIfNeeded"],"mappings":";;;;;AA0CO,SAAS,aACd,OACA,SACoB;AACpB,QAAM,EAAE,OAAO,QAAQ,IAAI,WAAW,IAAI,gBAAgB;AAG1D,QAAM,CAAC,aAAa,cAAc,IAAIA,WAAAA,SAAS,QAAQ;AAIvDC,aAAAA,UAAU,MAAM;AACd,mBAAe,QAAQ;AAAA,EACzB,GAAG,CAAC,OAAO,OAAO,QAAQ,CAAC;AAG3B,QAAM,WAAWC,WAAAA;AAAAA,IAAS;AAAA,IAAO,MAC/BC,aAAAA,YAAY,OAAO,OAAO,OAAO,aAAa,WAAW;AAAA,EAAA;AAI3D,QAAM,gBAAgB,SAAS,gBAAgB;AAC/CF,aAAAA,UAAU,MAAM;AACd,QACE,CAAC,iBACD,SAAS,MAAM,SAAS,eACxB,SAAS,WACT,CAAC,SAAS,YACV;AACAG,mBAAAA,qBAAqB,OAAO,OAAO,OAAO,aAAa,WAAW;AAAA,IACpE;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS,MAAM;AAAA,IACf,SAAS;AAAA,IACT,SAAS;AAAA,EAAA,CACV;AAGD,QAAM,WAAW,MAAM;AACrB,QAAI,CAAC,iBAAiB,SAAS,WAAW,CAAC,SAAS,YAAY;AAC9D,qBAAe,CAAC,SAAS,OAAO,EAAE;AAAA,IACpC;AAAA,EACF;AAEA,SAAO;AAAA,IACL,OAAO,SAAS;AAAA,IAChB,YAAY,SAAS;AAAA,IACrB,SAAS,SAAS;AAAA,IAClB,aAAa,SAAS;AAAA,IACtB;AAAA,IACA;AAAA;AAAA,EAAA;AAEJ;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LabelCopy } from '../../../../agent-runtime/src/offline-status';
|
|
1
2
|
import type { MenuItem, MenuScope } from './types';
|
|
2
3
|
import type { MentionSuggestionsStore } from './use-mention-suggestions';
|
|
3
4
|
/**
|
|
@@ -28,6 +29,8 @@ export interface UseMenuItemsResult {
|
|
|
28
29
|
items: MenuItem[];
|
|
29
30
|
isFetching: boolean;
|
|
30
31
|
hasMore: boolean;
|
|
32
|
+
/** Why this scope can't load from Athena right now (`null` while it can, or for local items). */
|
|
33
|
+
unavailable: LabelCopy | null;
|
|
31
34
|
loadMore: () => void;
|
|
32
35
|
targetCount: number;
|
|
33
36
|
}
|
|
@@ -11,8 +11,9 @@ function useMenuItems(store, options) {
|
|
|
11
11
|
store,
|
|
12
12
|
() => selectItems(store, scope, query, targetCount, parentScope)
|
|
13
13
|
);
|
|
14
|
+
const waitsOnAthena = snapshot.unavailable !== null;
|
|
14
15
|
useEffect(() => {
|
|
15
|
-
if (snapshot.items.length < targetCount && snapshot.hasMore && !snapshot.isFetching) {
|
|
16
|
+
if (!waitsOnAthena && snapshot.items.length < targetCount && snapshot.hasMore && !snapshot.isFetching) {
|
|
16
17
|
triggerFetchIfNeeded(store, scope, query, targetCount, parentScope);
|
|
17
18
|
}
|
|
18
19
|
}, [
|
|
@@ -21,12 +22,13 @@ function useMenuItems(store, options) {
|
|
|
21
22
|
query,
|
|
22
23
|
targetCount,
|
|
23
24
|
parentScope,
|
|
25
|
+
waitsOnAthena,
|
|
24
26
|
snapshot.items.length,
|
|
25
27
|
snapshot.hasMore,
|
|
26
28
|
snapshot.isFetching
|
|
27
29
|
]);
|
|
28
30
|
const loadMore = () => {
|
|
29
|
-
if (snapshot.hasMore && !snapshot.isFetching) {
|
|
31
|
+
if (!waitsOnAthena && snapshot.hasMore && !snapshot.isFetching) {
|
|
30
32
|
setTargetCount((prev) => prev + 50);
|
|
31
33
|
}
|
|
32
34
|
};
|
|
@@ -34,6 +36,7 @@ function useMenuItems(store, options) {
|
|
|
34
36
|
items: snapshot.items,
|
|
35
37
|
isFetching: snapshot.isFetching,
|
|
36
38
|
hasMore: snapshot.hasMore,
|
|
39
|
+
unavailable: snapshot.unavailable,
|
|
37
40
|
loadMore,
|
|
38
41
|
targetCount
|
|
39
42
|
// Expose for debugging
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-menu-items.js","sources":["../../../../../src/chat-ui/mentions/suggestions/data/use-menu-items.ts"],"sourcesContent":["import { useStore } from '@tanstack/react-store';\nimport { useEffect, useState } from 'react';\nimport { selectItems, triggerFetchIfNeeded } from './orchestrator';\nimport type { MenuItem, MenuScope } from './types';\nimport type { MentionSuggestionsStore } from './use-mention-suggestions';\n\n/**\n * useMenuItems - Like React Query, but for menu items\n *\n * Clean, automatic hook that:\n * - Reads items from store (reactive!)\n * - Auto-fetches if needed (in useEffect)\n * - Returns clean interface { items, isFetching, hasMore }\n *\n * Usage:\n * ```typescript\n * const { items, isFetching, hasMore } = useMenuItems(store, {\n * scope: 'athena_folders',\n * query: 'doc',\n * minItems: 10,\n * parentScope: 'root'\n * });\n * ```\n */\nexport interface UseMenuItemsOptions {\n scope: MenuScope;\n query?: string;\n minItems?: number;\n parentScope?: MenuScope;\n}\n\nexport interface UseMenuItemsResult {\n items: MenuItem[];\n isFetching: boolean;\n hasMore: boolean;\n loadMore: () => void; // Explicit load more (not automatic!)\n targetCount: number; // Current target for debugging\n}\n\nexport function useMenuItems(\n store: MentionSuggestionsStore,\n options: UseMenuItemsOptions\n): UseMenuItemsResult {\n const { scope, query = '', minItems = 50, parentScope } = options;\n\n // Target item count (increases when user clicks \"Load More\")\n const [targetCount, setTargetCount] = useState(minItems);\n\n // Reset target when scope/query changes\n // biome-ignore lint/correctness/useExhaustiveDependencies: We intentionally reset on scope/query change\n useEffect(() => {\n setTargetCount(minItems);\n }, [scope, query, minItems]);\n\n // Read from store (pure, reactive)\n const snapshot = useStore(store, () =>\n selectItems(store, scope, query, targetCount, parentScope)\n );\n\n // Auto-fetch when: cached < target AND hasMore AND !fetching\n useEffect(() => {\n if (snapshot.items.length < targetCount
|
|
1
|
+
{"version":3,"file":"use-menu-items.js","sources":["../../../../../src/chat-ui/mentions/suggestions/data/use-menu-items.ts"],"sourcesContent":["import type { LabelCopy } from '@athenaintel/agent-runtime/offline-status';\nimport { useStore } from '@tanstack/react-store';\nimport { useEffect, useState } from 'react';\nimport { selectItems, triggerFetchIfNeeded } from './orchestrator';\nimport type { MenuItem, MenuScope } from './types';\nimport type { MentionSuggestionsStore } from './use-mention-suggestions';\n\n/**\n * useMenuItems - Like React Query, but for menu items\n *\n * Clean, automatic hook that:\n * - Reads items from store (reactive!)\n * - Auto-fetches if needed (in useEffect)\n * - Returns clean interface { items, isFetching, hasMore }\n *\n * Usage:\n * ```typescript\n * const { items, isFetching, hasMore } = useMenuItems(store, {\n * scope: 'athena_folders',\n * query: 'doc',\n * minItems: 10,\n * parentScope: 'root'\n * });\n * ```\n */\nexport interface UseMenuItemsOptions {\n scope: MenuScope;\n query?: string;\n minItems?: number;\n parentScope?: MenuScope;\n}\n\nexport interface UseMenuItemsResult {\n items: MenuItem[];\n isFetching: boolean;\n hasMore: boolean;\n /** Why this scope can't load from Athena right now (`null` while it can, or for local items). */\n unavailable: LabelCopy | null;\n loadMore: () => void; // Explicit load more (not automatic!)\n targetCount: number; // Current target for debugging\n}\n\nexport function useMenuItems(\n store: MentionSuggestionsStore,\n options: UseMenuItemsOptions\n): UseMenuItemsResult {\n const { scope, query = '', minItems = 50, parentScope } = options;\n\n // Target item count (increases when user clicks \"Load More\")\n const [targetCount, setTargetCount] = useState(minItems);\n\n // Reset target when scope/query changes\n // biome-ignore lint/correctness/useExhaustiveDependencies: We intentionally reset on scope/query change\n useEffect(() => {\n setTargetCount(minItems);\n }, [scope, query, minItems]);\n\n // Read from store (pure, reactive)\n const snapshot = useStore(store, () =>\n selectItems(store, scope, query, targetCount, parentScope)\n );\n\n // Auto-fetch when: cached < target AND hasMore AND !fetching (and Athena can be asked)\n const waitsOnAthena = snapshot.unavailable !== null;\n useEffect(() => {\n if (\n !waitsOnAthena &&\n snapshot.items.length < targetCount &&\n snapshot.hasMore &&\n !snapshot.isFetching\n ) {\n triggerFetchIfNeeded(store, scope, query, targetCount, parentScope);\n }\n }, [\n store,\n scope,\n query,\n targetCount,\n parentScope,\n waitsOnAthena,\n snapshot.items.length,\n snapshot.hasMore,\n snapshot.isFetching,\n ]);\n\n // Explicit load more: Increase target by 50\n const loadMore = () => {\n if (!waitsOnAthena && snapshot.hasMore && !snapshot.isFetching) {\n setTargetCount((prev) => prev + 50);\n }\n };\n\n return {\n items: snapshot.items,\n isFetching: snapshot.isFetching,\n hasMore: snapshot.hasMore,\n unavailable: snapshot.unavailable,\n loadMore,\n targetCount, // Expose for debugging\n };\n}\n"],"names":[],"mappings":";;;AA0CO,SAAS,aACd,OACA,SACoB;AACpB,QAAM,EAAE,OAAO,QAAQ,IAAI,WAAW,IAAI,gBAAgB;AAG1D,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,QAAQ;AAIvD,YAAU,MAAM;AACd,mBAAe,QAAQ;AAAA,EACzB,GAAG,CAAC,OAAO,OAAO,QAAQ,CAAC;AAG3B,QAAM,WAAW;AAAA,IAAS;AAAA,IAAO,MAC/B,YAAY,OAAO,OAAO,OAAO,aAAa,WAAW;AAAA,EAAA;AAI3D,QAAM,gBAAgB,SAAS,gBAAgB;AAC/C,YAAU,MAAM;AACd,QACE,CAAC,iBACD,SAAS,MAAM,SAAS,eACxB,SAAS,WACT,CAAC,SAAS,YACV;AACA,2BAAqB,OAAO,OAAO,OAAO,aAAa,WAAW;AAAA,IACpE;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS,MAAM;AAAA,IACf,SAAS;AAAA,IACT,SAAS;AAAA,EAAA,CACV;AAGD,QAAM,WAAW,MAAM;AACrB,QAAI,CAAC,iBAAiB,SAAS,WAAW,CAAC,SAAS,YAAY;AAC9D,qBAAe,CAAC,SAAS,OAAO,EAAE;AAAA,IACpC;AAAA,EACF;AAEA,SAAO;AAAA,IACL,OAAO,SAAS;AAAA,IAChB,YAAY,SAAS;AAAA,IACrB,SAAS,SAAS;AAAA,IAClB,aAAa,SAAS;AAAA,IACtB;AAAA,IACA;AAAA;AAAA,EAAA;AAEJ;"}
|
|
@@ -1,20 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const reactQuery = require("@tanstack/react-query");
|
|
4
|
-
const
|
|
4
|
+
const AthenaCredentialSourceContext = require("../../auth/AthenaCredentialSourceContext.cjs");
|
|
5
|
+
const credentialSource = require("../../auth/credential-source.cjs");
|
|
5
6
|
const runtimeCatalog = require("../../catalog/runtime-catalog.cjs");
|
|
7
|
+
const useAthenaRestQuery = require("../../lib/use-athena-rest-query.cjs");
|
|
6
8
|
const credentialRenewal = require("../../runtime/credential-renewal.cjs");
|
|
7
9
|
const api = require("../../threads/api.cjs");
|
|
8
|
-
|
|
10
|
+
const tokenGetterIds = /* @__PURE__ */ new WeakMap();
|
|
11
|
+
let lastTokenGetterId = 0;
|
|
12
|
+
function tokenGetterId(getToken) {
|
|
13
|
+
if (getToken === void 0) return "";
|
|
14
|
+
let id = tokenGetterIds.get(getToken);
|
|
15
|
+
if (id === void 0) {
|
|
16
|
+
lastTokenGetterId += 1;
|
|
17
|
+
id = lastTokenGetterId;
|
|
18
|
+
tokenGetterIds.set(getToken, id);
|
|
19
|
+
}
|
|
20
|
+
return `getter:${id}`;
|
|
21
|
+
}
|
|
22
|
+
function heldTokenIdentity(token) {
|
|
23
|
+
if (!token) return "";
|
|
24
|
+
const subject = credentialSource.jwtSubject(token);
|
|
25
|
+
if (subject === null) return `token:${useAthenaRestQuery.keyPartFingerprint(token)}`;
|
|
26
|
+
const scope = credentialSource.jwtScope(token);
|
|
27
|
+
return scope === null ? `sub:${useAthenaRestQuery.keyPartFingerprint(subject)}` : `sub:${useAthenaRestQuery.keyPartFingerprint(subject)}|scope:${useAthenaRestQuery.keyPartFingerprint(scope)}`;
|
|
28
|
+
}
|
|
29
|
+
function useAccountIdentityRead(auth, { enabled, tokenGetter }) {
|
|
9
30
|
const queryClient = runtimeCatalog.useCatalogQueryClient();
|
|
10
|
-
const
|
|
11
|
-
const principal = (auth == null ? void 0 : auth.apiKey) ? `key:${runtimeCatalog.credentialFingerprint({ credential: auth.apiKey })}` : (auth == null ? void 0 : auth.userId) ?? ((auth == null ? void 0 : auth.accessToken) ? `token:${runtimeCatalog.credentialFingerprint({ credential: auth.accessToken })}` : anonymousScope);
|
|
31
|
+
const identityEpoch = AthenaCredentialSourceContext.useAthenaCredentialIdentityEpoch();
|
|
12
32
|
const query = reactQuery.useQuery(
|
|
13
33
|
{
|
|
14
|
-
queryKey: [
|
|
34
|
+
queryKey: [
|
|
35
|
+
"athena-sdk",
|
|
36
|
+
"account",
|
|
37
|
+
(auth == null ? void 0 : auth.backendUrl) ?? "",
|
|
38
|
+
(auth == null ? void 0 : auth.userId) ?? "",
|
|
39
|
+
(auth == null ? void 0 : auth.apiKey) ? useAthenaRestQuery.keyPartFingerprint(auth.apiKey) : "",
|
|
40
|
+
tokenGetterId(tokenGetter),
|
|
41
|
+
heldTokenIdentity(auth == null ? void 0 : auth.accessToken),
|
|
42
|
+
identityEpoch
|
|
43
|
+
],
|
|
15
44
|
queryFn: async ({ signal }) => {
|
|
16
45
|
if (!auth) return null;
|
|
17
|
-
|
|
46
|
+
return credentialRenewal.withCredentialRenewal(
|
|
18
47
|
async ({ force } = {}) => {
|
|
19
48
|
var _a, _b;
|
|
20
49
|
return {
|
|
@@ -25,15 +54,21 @@ function useAccountWorkspaceId(auth) {
|
|
|
25
54
|
},
|
|
26
55
|
(resolved) => api.fetchAccountIdentity(auth.backendUrl, resolved, { signal })
|
|
27
56
|
);
|
|
28
|
-
return identity.workspaceId ?? null;
|
|
29
57
|
},
|
|
30
|
-
enabled: auth !== null &&
|
|
58
|
+
enabled: auth !== null && enabled,
|
|
31
59
|
retry: false,
|
|
32
60
|
staleTime: 6e4
|
|
33
61
|
},
|
|
34
62
|
queryClient
|
|
35
63
|
);
|
|
36
|
-
return
|
|
64
|
+
return query.data;
|
|
65
|
+
}
|
|
66
|
+
function useAccountIdentity(auth, options = {}) {
|
|
67
|
+
const identity = useAccountIdentityRead(auth, { enabled: true, ...options });
|
|
68
|
+
return {
|
|
69
|
+
userId: identity == null ? void 0 : identity.userId,
|
|
70
|
+
workspaceId: (auth == null ? void 0 : auth.workspaceId) ?? (identity == null ? void 0 : identity.workspaceId) ?? void 0
|
|
71
|
+
};
|
|
37
72
|
}
|
|
38
|
-
exports.
|
|
73
|
+
exports.useAccountIdentity = useAccountIdentity;
|
|
39
74
|
//# sourceMappingURL=use-account-workspace-id.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-account-workspace-id.cjs","sources":["../../../src/chat-ui/mentions/use-account-workspace-id.ts"],"sourcesContent":["import { useQuery } from '@tanstack/react-query';\nimport {
|
|
1
|
+
{"version":3,"file":"use-account-workspace-id.cjs","sources":["../../../src/chat-ui/mentions/use-account-workspace-id.ts"],"sourcesContent":["import { useQuery } from '@tanstack/react-query';\nimport { useAthenaCredentialIdentityEpoch } from '../../auth/AthenaCredentialSourceContext';\nimport { jwtScope, jwtSubject } from '../../auth/credential-source';\nimport { useCatalogQueryClient } from '../../catalog/runtime-catalog';\nimport { keyPartFingerprint } from '../../lib/use-athena-rest-query';\nimport { withCredentialRenewal } from '../../runtime/credential-renewal';\nimport type { AthenaStatewireTokenGetter } from '../../runtime/statewire-auth-headers';\nimport { type AccountIdentity, fetchAccountIdentity } from '../../threads/api';\nimport type { MentionAuthContext } from './suggestions/data/api-client';\n\n/** The credential's agora identity, as far as it is known yet. */\nexport interface AccountIdentityState {\n /** Agora's user id (`user_…`) for the credential; unknown until `/me` answers. */\n userId: string | undefined;\n /** The host's workspace when it names one, else the credential's current workspace. */\n workspaceId: string | undefined;\n}\n\nexport interface AccountIdentityOptions {\n /**\n * The provider's token getter, which `auth.getAccessToken` wraps (`AthenaChat`\n * passes `useAthenaConfig().getToken`). Its identity keeps two providers\n * apart when only their getters know who they sign in.\n */\n tokenGetter?: AthenaStatewireTokenGetter;\n}\n\n/** One id per token getter, so the key can name a getter without holding it. */\nconst tokenGetterIds = new WeakMap<AthenaStatewireTokenGetter, number>();\nlet lastTokenGetterId = 0;\n\nfunction tokenGetterId(getToken: AthenaStatewireTokenGetter | undefined): string {\n if (getToken === undefined) return '';\n let id = tokenGetterIds.get(getToken);\n if (id === undefined) {\n lastTokenGetterId += 1;\n id = lastTokenGetterId;\n tokenGetterIds.set(getToken, id);\n }\n return `getter:${id}`;\n}\n\n/**\n * Who a held token acts as, and where, without the token: its JWT subject and\n * the claims scoping it to a workspace or org (`jwtScope`), or the token\n * itself when it is opaque, fingerprinted. A renewal for the same person and\n * scope keeps it, so a rotation is not a new identity; the same person's token\n * scoped to another workspace is.\n */\nfunction heldTokenIdentity(token: string | null | undefined): string {\n if (!token) return '';\n const subject = jwtSubject(token);\n if (subject === null) return `token:${keyPartFingerprint(token)}`;\n const scope = jwtScope(token);\n return scope === null\n ? `sub:${keyPartFingerprint(subject)}`\n : `sub:${keyPartFingerprint(subject)}|scope:${keyPartFingerprint(scope)}`;\n}\n\n/**\n * One `/me` read per credential, through the host's query cache (never a\n * process-wide user-id map), keyed by the credential the read is sent with and\n * never by the secret: the backend, the signed-in person, the API key's\n * fingerprint, the provider's token getter, who the held token acts as and\n * which workspace it is scoped to, and the provider's credential identity\n * epoch (`useAthenaCredentialIdentityEpoch`), which moves once the getter has\n * handed out a token that acts as someone else. A renewal for the same person\n * and scope keeps the key, so the answer stays put; an API-key switch, a held\n * token scoped to another workspace, or a getter now signing in someone else,\n * reads `/me` again under a new key, never a cached answer for the previous\n * credential. The epoch follows the person, not the scope: a host getter that\n * alone hands out the same person's token for another workspace is read again\n * once the answer goes stale. `enabled` is the caller's: a reader that only\n * needs the workspace skips the read when the host names one.\n */\nfunction useAccountIdentityRead(\n auth: MentionAuthContext | null,\n { enabled, tokenGetter }: { enabled: boolean } & AccountIdentityOptions\n): AccountIdentity | null | undefined {\n const queryClient = useCatalogQueryClient();\n const identityEpoch = useAthenaCredentialIdentityEpoch();\n const query = useQuery(\n {\n queryKey: [\n 'athena-sdk',\n 'account',\n auth?.backendUrl ?? '',\n auth?.userId ?? '',\n auth?.apiKey ? keyPartFingerprint(auth.apiKey) : '',\n tokenGetterId(tokenGetter),\n heldTokenIdentity(auth?.accessToken),\n identityEpoch,\n ],\n queryFn: async ({ signal }) => {\n if (!auth) return null;\n return withCredentialRenewal(\n async ({ force }: { force?: boolean } = {}) => ({\n token:\n (force ? await auth.renewAccessToken?.() : await auth.getAccessToken?.()) ??\n auth.accessToken ??\n null,\n apiKey: auth.apiKey,\n credentials: auth.credentials,\n }),\n (resolved) => fetchAccountIdentity(auth.backendUrl, resolved, { signal })\n );\n },\n enabled: auth !== null && enabled,\n retry: false,\n staleTime: 60_000,\n },\n queryClient\n );\n return query.data;\n}\n\n/** The workspace mentions search: the host's when it names one, else the credential's own. */\nexport function useAccountWorkspaceId(auth: MentionAuthContext | null): string | undefined {\n const identity = useAccountIdentityRead(auth, { enabled: !auth?.workspaceId });\n return auth?.workspaceId ?? identity?.workspaceId ?? undefined;\n}\n\n/**\n * The credential's agora user id and workspace from the same read. The auth\n * context carries the identity provider's user id, not agora's, so \"who is\n * the viewer\" (an answer label's \"for you\") needs this one, and it reads\n * `/me` even when the host names a workspace.\n */\nexport function useAccountIdentity(\n auth: MentionAuthContext | null,\n options: AccountIdentityOptions = {}\n): AccountIdentityState {\n const identity = useAccountIdentityRead(auth, { enabled: true, ...options });\n return {\n userId: identity?.userId,\n workspaceId: auth?.workspaceId ?? identity?.workspaceId ?? undefined,\n };\n}\n"],"names":["jwtSubject","keyPartFingerprint","jwtScope","useCatalogQueryClient","useAthenaCredentialIdentityEpoch","useQuery","withCredentialRenewal","fetchAccountIdentity"],"mappings":";;;;;;;;;AA4BA,MAAM,qCAAqB,QAAA;AAC3B,IAAI,oBAAoB;AAExB,SAAS,cAAc,UAA0D;AAC/E,MAAI,aAAa,OAAW,QAAO;AACnC,MAAI,KAAK,eAAe,IAAI,QAAQ;AACpC,MAAI,OAAO,QAAW;AACpB,yBAAqB;AACrB,SAAK;AACL,mBAAe,IAAI,UAAU,EAAE;AAAA,EACjC;AACA,SAAO,UAAU,EAAE;AACrB;AASA,SAAS,kBAAkB,OAA0C;AACnE,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,UAAUA,iBAAAA,WAAW,KAAK;AAChC,MAAI,YAAY,KAAM,QAAO,SAASC,mBAAAA,mBAAmB,KAAK,CAAC;AAC/D,QAAM,QAAQC,iBAAAA,SAAS,KAAK;AAC5B,SAAO,UAAU,OACb,OAAOD,mBAAAA,mBAAmB,OAAO,CAAC,KAClC,OAAOA,mBAAAA,mBAAmB,OAAO,CAAC,UAAUA,mBAAAA,mBAAmB,KAAK,CAAC;AAC3E;AAkBA,SAAS,uBACP,MACA,EAAE,SAAS,eACyB;AACpC,QAAM,cAAcE,eAAAA,sBAAA;AACpB,QAAM,gBAAgBC,8BAAAA,iCAAA;AACtB,QAAM,QAAQC,WAAAA;AAAAA,IACZ;AAAA,MACE,UAAU;AAAA,QACR;AAAA,QACA;AAAA,SACA,6BAAM,eAAc;AAAA,SACpB,6BAAM,WAAU;AAAA,SAChB,6BAAM,UAASJ,mBAAAA,mBAAmB,KAAK,MAAM,IAAI;AAAA,QACjD,cAAc,WAAW;AAAA,QACzB,kBAAkB,6BAAM,WAAW;AAAA,QACnC;AAAA,MAAA;AAAA,MAEF,SAAS,OAAO,EAAE,aAAa;AAC7B,YAAI,CAAC,KAAM,QAAO;AAClB,eAAOK,kBAAAA;AAAAA,UACL,OAAO,EAAE,MAAA,IAA+B,OAAC;;AAAO;AAAA,cAC9C,QACG,QAAQ,QAAM,UAAK,qBAAL,iCAA4B,QAAM,UAAK,mBAAL,mCACjD,KAAK,eACL;AAAA,cACF,QAAQ,KAAK;AAAA,cACb,aAAa,KAAK;AAAA,YAAA;AAAA;AAAA,UAEpB,CAAC,aAAaC,IAAAA,qBAAqB,KAAK,YAAY,UAAU,EAAE,QAAQ;AAAA,QAAA;AAAA,MAE5E;AAAA,MACA,SAAS,SAAS,QAAQ;AAAA,MAC1B,OAAO;AAAA,MACP,WAAW;AAAA,IAAA;AAAA,IAEb;AAAA,EAAA;AAEF,SAAO,MAAM;AACf;AAcO,SAAS,mBACd,MACA,UAAkC,IACZ;AACtB,QAAM,WAAW,uBAAuB,MAAM,EAAE,SAAS,MAAM,GAAG,SAAS;AAC3E,SAAO;AAAA,IACL,QAAQ,qCAAU;AAAA,IAClB,cAAa,6BAAM,iBAAe,qCAAU,gBAAe;AAAA,EAAA;AAE/D;;"}
|
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
import type { AthenaStatewireTokenGetter } from '../../runtime/statewire-auth-headers';
|
|
1
2
|
import type { MentionAuthContext } from './suggestions/data/api-client';
|
|
2
|
-
/**
|
|
3
|
+
/** The credential's agora identity, as far as it is known yet. */
|
|
4
|
+
export interface AccountIdentityState {
|
|
5
|
+
/** Agora's user id (`user_…`) for the credential; unknown until `/me` answers. */
|
|
6
|
+
userId: string | undefined;
|
|
7
|
+
/** The host's workspace when it names one, else the credential's current workspace. */
|
|
8
|
+
workspaceId: string | undefined;
|
|
9
|
+
}
|
|
10
|
+
export interface AccountIdentityOptions {
|
|
11
|
+
/**
|
|
12
|
+
* The provider's token getter, which `auth.getAccessToken` wraps (`AthenaChat`
|
|
13
|
+
* passes `useAthenaConfig().getToken`). Its identity keeps two providers
|
|
14
|
+
* apart when only their getters know who they sign in.
|
|
15
|
+
*/
|
|
16
|
+
tokenGetter?: AthenaStatewireTokenGetter;
|
|
17
|
+
}
|
|
18
|
+
/** The workspace mentions search: the host's when it names one, else the credential's own. */
|
|
3
19
|
export declare function useAccountWorkspaceId(auth: MentionAuthContext | null): string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* The credential's agora user id and workspace from the same read. The auth
|
|
22
|
+
* context carries the identity provider's user id, not agora's, so "who is
|
|
23
|
+
* the viewer" (an answer label's "for you") needs this one, and it reads
|
|
24
|
+
* `/me` even when the host names a workspace.
|
|
25
|
+
*/
|
|
26
|
+
export declare function useAccountIdentity(auth: MentionAuthContext | null, options?: AccountIdentityOptions): AccountIdentityState;
|