@athenaintel/react 0.43.0 → 0.48.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 +215 -3
- 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/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/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 +14 -8
- package/dist/agent-runtime/src/interrupts.cjs +43 -18
- package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
- package/dist/agent-runtime/src/interrupts.d.ts +19 -2
- package/dist/agent-runtime/src/interrupts.js +28 -3
- 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/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 +40 -0
- 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 +756 -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 +11 -11
- package/dist/agent-runtime/src/use-conversation-list.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +24 -19
- 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 +2 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +6 -1
- 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 +16 -16
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.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 +547 -124
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +129 -10
- package/dist/agent-runtime/src/use-deep-agent-voice.js +487 -64
- 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 +28 -26
- 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 +49 -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-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 +7 -0
- 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 +11 -1
- 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 +125 -31
- package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
- package/dist/chat/StatewireApprovalCard.d.ts +73 -1
- package/dist/chat/StatewireApprovalCard.js +115 -21
- 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 +25 -63
- package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.d.ts +11 -13
- package/dist/chat/StatewireQueuedMessages.js +16 -54
- package/dist/chat/StatewireQueuedMessages.js.map +1 -1
- package/dist/chat/WaitingOnYouBanner.cjs +3 -3
- package/dist/chat/WaitingOnYouBanner.cjs.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 +93 -28
- package/dist/chat/chat-voice-controls.cjs.map +1 -1
- package/dist/chat/chat-voice-controls.d.ts +36 -2
- package/dist/chat/chat-voice-controls.js +89 -24
- 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 +18 -0
- package/dist/chat-ui/index.cjs.map +1 -1
- package/dist/chat-ui/index.d.ts +7 -1
- package/dist/chat-ui/index.js +18 -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/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 +2 -2
- package/dist/chat-ui/rich-text/chat-link.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-message-body.cjs +8 -8
- package/dist/chat-ui/rich-text/chat-message-body.cjs.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 +43 -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 +35 -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 +40 -3
- package/dist/collab/client.cjs.map +1 -1
- package/dist/collab/client.d.ts +25 -0
- package/dist/collab/client.js +40 -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/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 +2 -2
- package/dist/composer/useReadComposerDraft.cjs.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 +26 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +15 -3
- package/dist/index.js +26 -2
- 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/update-attributions.cjs +111 -0
- package/dist/keryx-http/src/update-attributions.cjs.map +1 -0
- package/dist/keryx-http/src/update-attributions.d.ts +75 -0
- package/dist/keryx-http/src/update-attributions.js +111 -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 +116 -79
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.js +40 -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/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 +51 -51
- package/dist/threads/statewire-thread-list.cjs.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 +10 -10
- package/dist/threads/use-athena-sessions.cjs.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-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
package/dist/collab/react.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const require$$0 = require("react");
|
|
4
4
|
const AthenaCredentialSourceContext = require("../auth/AthenaCredentialSourceContext.cjs");
|
|
5
5
|
const AthenaContext = require("../provider/AthenaContext.cjs");
|
|
6
6
|
const client = require("./client.cjs");
|
|
@@ -8,9 +8,9 @@ function useGenericDoc(assetId, options) {
|
|
|
8
8
|
const config = AthenaContext.useAthenaConfig();
|
|
9
9
|
const identityEpoch = AthenaCredentialSourceContext.useAthenaCredentialIdentityEpoch();
|
|
10
10
|
const access = (options == null ? void 0 : options.access) ?? "view";
|
|
11
|
-
const [handle, setHandle] =
|
|
12
|
-
const handleRef =
|
|
13
|
-
|
|
11
|
+
const [handle, setHandle] = require$$0.useState(null);
|
|
12
|
+
const handleRef = require$$0.useRef(null);
|
|
13
|
+
require$$0.useEffect(() => {
|
|
14
14
|
const next = client.connectGenericDoc({
|
|
15
15
|
assetId,
|
|
16
16
|
access,
|
|
@@ -28,14 +28,14 @@ function useGenericDoc(assetId, options) {
|
|
|
28
28
|
next.destroy();
|
|
29
29
|
};
|
|
30
30
|
}, [assetId, access, config.backendUrl, config.apiKey, config.getToken, identityEpoch]);
|
|
31
|
-
const subscribe =
|
|
31
|
+
const subscribe = require$$0.useMemo(() => {
|
|
32
32
|
return (onStoreChange) => {
|
|
33
33
|
if (!handle) return () => {
|
|
34
34
|
};
|
|
35
35
|
return handle.onChange(onStoreChange);
|
|
36
36
|
};
|
|
37
37
|
}, [handle]);
|
|
38
|
-
|
|
38
|
+
require$$0.useSyncExternalStore(
|
|
39
39
|
subscribe,
|
|
40
40
|
() => {
|
|
41
41
|
if (!handle) return EMPTY_SNAPSHOT;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.cjs","sources":["../../src/collab/react.ts"],"sourcesContent":["/**\n * React bindings for Generic Doc live collaboration.\n *\n * `useGenericDoc(assetId)` opens (and owns) a `connectGenericDoc` handle,\n * resolving auth from the surrounding `AthenaProvider` (per-viewer bearer when\n * present, API key otherwise) and re-rendering on status/presence changes via\n * `useSyncExternalStore`.\n */\n\nimport { useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';\nimport { useAthenaCredentialIdentityEpoch } from '../auth/AthenaCredentialSourceContext';\nimport { useAthenaConfig } from '../provider/AthenaContext';\nimport {\n type GenericDocHandle,\n type GenericDocStatus,\n type PresenceEntry,\n connectGenericDoc,\n} from './client';\nimport type * as Y from '@y/y';\n\nexport interface UseGenericDocResult {\n /** Null until the handle is created (first render effect). */\n doc: Y.Doc | null;\n status: GenericDocStatus;\n /**\n * Whether the initial server sync completed for the current connection —\n * `status === 'connected'` fires before the server state arrives, so gate\n * \"is this doc really empty?\" UI on this.\n */\n synced: boolean;\n accessType: 'r' | 'rw' | null;\n error: Error | null;\n presence: PresenceEntry[];\n setPresence: (state: Record<string, unknown> | null) => void;\n}\n\nexport function useGenericDoc(\n assetId: string,\n options?: { access?: 'view' | 'edit' }\n): UseGenericDocResult {\n const config = useAthenaConfig();\n const identityEpoch = useAthenaCredentialIdentityEpoch();\n const access = options?.access ?? 'view';\n const [handle, setHandle] = useState<GenericDocHandle | null>(null);\n const handleRef = useRef<GenericDocHandle | null>(null);\n\n useEffect(() => {\n const next = connectGenericDoc({\n assetId,\n access,\n auth: {\n backendUrl: config.backendUrl,\n apiKey: config.apiKey,\n token: config.token,\n getToken: config.getToken,\n },\n });\n handleRef.current = next;\n setHandle(next);\n return () => {\n handleRef.current = null;\n next.destroy();\n };\n // Recreate when the target or the signed-in identity changes (the\n // credential source's identity epoch). A renewed token for the same\n // identity reaches the next re-mint through `getToken`, so a renewal\n // does not tear the live connection down.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [assetId, access, config.backendUrl, config.apiKey, config.getToken, identityEpoch]);\n\n const subscribe = useMemo(() => {\n return (onStoreChange: () => void) => {\n if (!handle) return () => {};\n return handle.onChange(onStoreChange);\n };\n }, [handle]);\n\n const snapshot = useSyncExternalStore(\n subscribe,\n () => {\n if (!handle) return EMPTY_SNAPSHOT;\n return `${handle.status}|${handle.synced}|${handle.accessType ?? ''}|${handle.version}`;\n },\n () => EMPTY_SNAPSHOT\n );\n void snapshot;\n\n return {\n doc: handle?.doc ?? null,\n status: handle?.status ?? 'connecting',\n synced: handle?.synced ?? false,\n accessType: handle?.accessType ?? null,\n error: handle?.error ?? null,\n presence: handle?.getPresence() ?? [],\n setPresence: (state) => handleRef.current?.setPresence(state),\n };\n}\n\nconst EMPTY_SNAPSHOT = 'init|false||0';\n"],"names":["useAthenaConfig","useAthenaCredentialIdentityEpoch","useState","useRef","useEffect","connectGenericDoc","useMemo","useSyncExternalStore"],"mappings":";;;;;;AAoCO,SAAS,cACd,SACA,SACqB;AACrB,QAAM,SAASA,cAAAA,gBAAA;AACf,QAAM,gBAAgBC,8BAAAA,iCAAA;AACtB,QAAM,UAAS,mCAAS,WAAU;AAClC,QAAM,CAAC,QAAQ,SAAS,IAAIC,
|
|
1
|
+
{"version":3,"file":"react.cjs","sources":["../../src/collab/react.ts"],"sourcesContent":["/**\n * React bindings for Generic Doc live collaboration.\n *\n * `useGenericDoc(assetId)` opens (and owns) a `connectGenericDoc` handle,\n * resolving auth from the surrounding `AthenaProvider` (per-viewer bearer when\n * present, API key otherwise) and re-rendering on status/presence changes via\n * `useSyncExternalStore`.\n */\n\nimport { useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';\nimport { useAthenaCredentialIdentityEpoch } from '../auth/AthenaCredentialSourceContext';\nimport { useAthenaConfig } from '../provider/AthenaContext';\nimport {\n type GenericDocHandle,\n type GenericDocStatus,\n type PresenceEntry,\n connectGenericDoc,\n} from './client';\nimport type * as Y from '@y/y';\n\nexport interface UseGenericDocResult {\n /** Null until the handle is created (first render effect). */\n doc: Y.Doc | null;\n status: GenericDocStatus;\n /**\n * Whether the initial server sync completed for the current connection —\n * `status === 'connected'` fires before the server state arrives, so gate\n * \"is this doc really empty?\" UI on this.\n */\n synced: boolean;\n accessType: 'r' | 'rw' | null;\n error: Error | null;\n presence: PresenceEntry[];\n setPresence: (state: Record<string, unknown> | null) => void;\n}\n\nexport function useGenericDoc(\n assetId: string,\n options?: { access?: 'view' | 'edit' }\n): UseGenericDocResult {\n const config = useAthenaConfig();\n const identityEpoch = useAthenaCredentialIdentityEpoch();\n const access = options?.access ?? 'view';\n const [handle, setHandle] = useState<GenericDocHandle | null>(null);\n const handleRef = useRef<GenericDocHandle | null>(null);\n\n useEffect(() => {\n const next = connectGenericDoc({\n assetId,\n access,\n auth: {\n backendUrl: config.backendUrl,\n apiKey: config.apiKey,\n token: config.token,\n getToken: config.getToken,\n },\n });\n handleRef.current = next;\n setHandle(next);\n return () => {\n handleRef.current = null;\n next.destroy();\n };\n // Recreate when the target or the signed-in identity changes (the\n // credential source's identity epoch). A renewed token for the same\n // identity reaches the next re-mint through `getToken`, so a renewal\n // does not tear the live connection down.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [assetId, access, config.backendUrl, config.apiKey, config.getToken, identityEpoch]);\n\n const subscribe = useMemo(() => {\n return (onStoreChange: () => void) => {\n if (!handle) return () => {};\n return handle.onChange(onStoreChange);\n };\n }, [handle]);\n\n const snapshot = useSyncExternalStore(\n subscribe,\n () => {\n if (!handle) return EMPTY_SNAPSHOT;\n return `${handle.status}|${handle.synced}|${handle.accessType ?? ''}|${handle.version}`;\n },\n () => EMPTY_SNAPSHOT\n );\n void snapshot;\n\n return {\n doc: handle?.doc ?? null,\n status: handle?.status ?? 'connecting',\n synced: handle?.synced ?? false,\n accessType: handle?.accessType ?? null,\n error: handle?.error ?? null,\n presence: handle?.getPresence() ?? [],\n setPresence: (state) => handleRef.current?.setPresence(state),\n };\n}\n\nconst EMPTY_SNAPSHOT = 'init|false||0';\n"],"names":["useAthenaConfig","useAthenaCredentialIdentityEpoch","useState","useRef","useEffect","connectGenericDoc","useMemo","useSyncExternalStore"],"mappings":";;;;;;AAoCO,SAAS,cACd,SACA,SACqB;AACrB,QAAM,SAASA,cAAAA,gBAAA;AACf,QAAM,gBAAgBC,8BAAAA,iCAAA;AACtB,QAAM,UAAS,mCAAS,WAAU;AAClC,QAAM,CAAC,QAAQ,SAAS,IAAIC,WAAAA,SAAkC,IAAI;AAClE,QAAM,YAAYC,WAAAA,OAAgC,IAAI;AAEtDC,aAAAA,UAAU,MAAM;AACd,UAAM,OAAOC,OAAAA,kBAAkB;AAAA,MAC7B;AAAA,MACA;AAAA,MACA,MAAM;AAAA,QACJ,YAAY,OAAO;AAAA,QACnB,QAAQ,OAAO;AAAA,QACf,OAAO,OAAO;AAAA,QACd,UAAU,OAAO;AAAA,MAAA;AAAA,IACnB,CACD;AACD,cAAU,UAAU;AACpB,cAAU,IAAI;AACd,WAAO,MAAM;AACX,gBAAU,UAAU;AACpB,WAAK,QAAA;AAAA,IACP;AAAA,EAMF,GAAG,CAAC,SAAS,QAAQ,OAAO,YAAY,OAAO,QAAQ,OAAO,UAAU,aAAa,CAAC;AAEtF,QAAM,YAAYC,WAAAA,QAAQ,MAAM;AAC9B,WAAO,CAAC,kBAA8B;AACpC,UAAI,CAAC,OAAQ,QAAO,MAAM;AAAA,MAAC;AAC3B,aAAO,OAAO,SAAS,aAAa;AAAA,IACtC;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEMC,aAAAA;AAAAA,IACf;AAAA,IACA,MAAM;AACJ,UAAI,CAAC,OAAQ,QAAO;AACpB,aAAO,GAAG,OAAO,MAAM,IAAI,OAAO,MAAM,IAAI,OAAO,cAAc,EAAE,IAAI,OAAO,OAAO;AAAA,IACvF;AAAA,IACA,MAAM;AAAA,EAAA;AAIR,SAAO;AAAA,IACL,MAAK,iCAAQ,QAAO;AAAA,IACpB,SAAQ,iCAAQ,WAAU;AAAA,IAC1B,SAAQ,iCAAQ,WAAU;AAAA,IAC1B,aAAY,iCAAQ,eAAc;AAAA,IAClC,QAAO,iCAAQ,UAAS;AAAA,IACxB,WAAU,iCAAQ,kBAAiB,CAAA;AAAA,IACnC,aAAa,CAAC,UAAA;;AAAU,6BAAU,YAAV,mBAAmB,YAAY;AAAA;AAAA,EAAK;AAEhE;AAEA,MAAM,iBAAiB;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const
|
|
4
|
+
const require$$0 = require("react");
|
|
5
5
|
const zustand = require("zustand");
|
|
6
6
|
const vanilla = require("zustand/vanilla");
|
|
7
7
|
const athenaUrls = require("../lib/athena-urls.cjs");
|
|
8
|
-
const AttachmentCtx =
|
|
8
|
+
const AttachmentCtx = require$$0.createContext(null);
|
|
9
9
|
function createAttachmentStore() {
|
|
10
10
|
return vanilla.createStore(() => ({ attachments: [], isUploading: false, notice: null }));
|
|
11
11
|
}
|
|
@@ -13,15 +13,22 @@ function AttachmentProvider({
|
|
|
13
13
|
children,
|
|
14
14
|
store
|
|
15
15
|
}) {
|
|
16
|
-
const outer =
|
|
16
|
+
const outer = require$$0.useContext(AttachmentCtx);
|
|
17
17
|
if (store) return /* @__PURE__ */ jsxRuntime.jsx(StoreAttachmentProvider, { store, children });
|
|
18
18
|
if (outer) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
19
19
|
return /* @__PURE__ */ jsxRuntime.jsx(OwnAttachmentProvider, { children });
|
|
20
20
|
}
|
|
21
21
|
function OwnAttachmentProvider({ children }) {
|
|
22
|
-
const [store] =
|
|
22
|
+
const [store] = require$$0.useState(createAttachmentStore);
|
|
23
|
+
require$$0.useEffect(() => () => revokePreviews(store.getState().attachments), [store]);
|
|
23
24
|
return /* @__PURE__ */ jsxRuntime.jsx(StoreAttachmentProvider, { store, children });
|
|
24
25
|
}
|
|
26
|
+
function revokePreviews(attachments) {
|
|
27
|
+
if (typeof URL === "undefined" || typeof URL.revokeObjectURL !== "function") return;
|
|
28
|
+
for (const attachment of attachments) {
|
|
29
|
+
if (attachment.previewUrl) URL.revokeObjectURL(attachment.previewUrl);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
25
32
|
function StoreAttachmentProvider({
|
|
26
33
|
children,
|
|
27
34
|
store
|
|
@@ -29,13 +36,19 @@ function StoreAttachmentProvider({
|
|
|
29
36
|
const attachments = zustand.useStore(store, (state) => state.attachments);
|
|
30
37
|
const isUploading = zustand.useStore(store, (state) => state.isUploading);
|
|
31
38
|
const notice = zustand.useStore(store, (state) => state.notice ?? null);
|
|
32
|
-
const actions =
|
|
39
|
+
const actions = require$$0.useMemo(
|
|
33
40
|
() => ({
|
|
34
41
|
addAttachments: (assets) => store.setState((state) => ({ attachments: [...state.attachments, ...assets] })),
|
|
35
|
-
removeAttachment: (id) =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
removeAttachment: (id) => {
|
|
43
|
+
revokePreviews(store.getState().attachments.filter((attachment) => attachment.id === id));
|
|
44
|
+
store.setState((state) => ({
|
|
45
|
+
attachments: state.attachments.filter((attachment) => attachment.id !== id)
|
|
46
|
+
}));
|
|
47
|
+
},
|
|
48
|
+
clearAttachments: () => {
|
|
49
|
+
revokePreviews(store.getState().attachments);
|
|
50
|
+
store.setState({ attachments: [] });
|
|
51
|
+
},
|
|
39
52
|
setIsUploading: (uploading) => store.setState({ isUploading: uploading }),
|
|
40
53
|
setNotice: (next) => {
|
|
41
54
|
if ((store.getState().notice ?? null) !== next) store.setState({ notice: next });
|
|
@@ -43,14 +56,14 @@ function StoreAttachmentProvider({
|
|
|
43
56
|
}),
|
|
44
57
|
[store]
|
|
45
58
|
);
|
|
46
|
-
const value =
|
|
59
|
+
const value = require$$0.useMemo(
|
|
47
60
|
() => ({ attachments, isUploading, notice, ...actions }),
|
|
48
61
|
[attachments, isUploading, notice, actions]
|
|
49
62
|
);
|
|
50
63
|
return /* @__PURE__ */ jsxRuntime.jsx(AttachmentCtx.Provider, { value, children });
|
|
51
64
|
}
|
|
52
65
|
function useAttachments() {
|
|
53
|
-
const ctx =
|
|
66
|
+
const ctx = require$$0.useContext(AttachmentCtx);
|
|
54
67
|
if (!ctx) {
|
|
55
68
|
throw new Error("[AthenaSDK] useAttachments must be used within <AttachmentProvider>");
|
|
56
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentContext.cjs","sources":["../../src/composer/AttachmentContext.tsx"],"sourcesContent":["import { createContext, useContext, useMemo, useState, type ReactNode } from 'react';\nimport { useStore } from 'zustand';\nimport { createStore, type StoreApi } from 'zustand/vanilla';\nimport { createAthenaSpacesUrl, DEFAULT_APP_URL } from '../lib/athena-urls';\nimport type { UploadedAsset } from './useFileUpload';\n\ninterface AttachmentContextValue {\n attachments: UploadedAsset[];\n addAttachments: (assets: UploadedAsset[]) => void;\n removeAttachment: (id: string) => void;\n clearAttachments: () => void;\n /** True when one or more files are currently being uploaded. */\n isUploading: boolean;\n setIsUploading: (v: boolean) => void;\n /**\n * Why the last files offered were not attached, for the composer to say (a file picked while\n * Athena can't be reached cannot upload), or `null`.\n */\n notice: string | null;\n setNotice: (notice: string | null) => void;\n}\n\nconst AttachmentCtx = createContext<AttachmentContextValue | null>(null);\n\ninterface AttachmentStoreState {\n attachments: UploadedAsset[];\n isUploading: boolean;\n notice?: string | null;\n}\n\n/**\n * A composer's staged attachments, kept outside React (`createAttachmentStore`):\n * a host that shows several chats gives each its own, and keeps it while that\n * chat's `AthenaChat` remounts (a tab moving between windows).\n */\nexport type AttachmentStore = StoreApi<AttachmentStoreState>;\n\n/** An empty `AttachmentStore`, for `<AttachmentProvider store>`. */\nexport function createAttachmentStore(): AttachmentStore {\n return createStore<AttachmentStoreState>(() => ({ attachments: [], isUploading: false, notice: null }));\n}\n\n/**\n * Staged attachments for the composer. With a `store`, they are that store's,\n * whatever is mounted above: one per chat when a host shows several. Without\n * one, a provider already mounted above (a host's, outliving a remounting\n * \\`AthenaChat\\` such as a tab moving between windows) is reused instead of\n * starting empty.\n */\nexport function AttachmentProvider({\n children,\n store,\n}: {\n children: ReactNode;\n store?: AttachmentStore;\n}) {\n const outer = useContext(AttachmentCtx);\n if (store) return <StoreAttachmentProvider store={store}>{children}</StoreAttachmentProvider>;\n if (outer) return <>{children}</>;\n return <OwnAttachmentProvider>{children}</OwnAttachmentProvider>;\n}\n\nfunction OwnAttachmentProvider({ children }: { children: ReactNode }) {\n const [store] = useState(createAttachmentStore);\n return <StoreAttachmentProvider store={store}>{children}</StoreAttachmentProvider>;\n}\n\nfunction StoreAttachmentProvider({\n children,\n store,\n}: {\n children: ReactNode;\n store: AttachmentStore;\n}) {\n const attachments = useStore(store, (state) => state.attachments);\n const isUploading = useStore(store, (state) => state.isUploading);\n const notice = useStore(store, (state) => state.notice ?? null);\n const actions = useMemo(\n () => ({\n addAttachments: (assets: UploadedAsset[]) =>\n store.setState((state) => ({ attachments: [...state.attachments, ...assets] })),\n removeAttachment: (id: string)
|
|
1
|
+
{"version":3,"file":"AttachmentContext.cjs","sources":["../../src/composer/AttachmentContext.tsx"],"sourcesContent":["import { createContext, useContext, useEffect, useMemo, useState, type ReactNode } from 'react';\nimport { useStore } from 'zustand';\nimport { createStore, type StoreApi } from 'zustand/vanilla';\nimport { createAthenaSpacesUrl, DEFAULT_APP_URL } from '../lib/athena-urls';\nimport type { UploadedAsset } from './useFileUpload';\n\ninterface AttachmentContextValue {\n attachments: UploadedAsset[];\n addAttachments: (assets: UploadedAsset[]) => void;\n removeAttachment: (id: string) => void;\n clearAttachments: () => void;\n /** True when one or more files are currently being uploaded. */\n isUploading: boolean;\n setIsUploading: (v: boolean) => void;\n /**\n * Why the last files offered were not attached, for the composer to say (a file picked while\n * Athena can't be reached cannot upload), or `null`.\n */\n notice: string | null;\n setNotice: (notice: string | null) => void;\n}\n\nconst AttachmentCtx = createContext<AttachmentContextValue | null>(null);\n\ninterface AttachmentStoreState {\n attachments: UploadedAsset[];\n isUploading: boolean;\n notice?: string | null;\n}\n\n/**\n * A composer's staged attachments, kept outside React (`createAttachmentStore`):\n * a host that shows several chats gives each its own, and keeps it while that\n * chat's `AthenaChat` remounts (a tab moving between windows).\n */\nexport type AttachmentStore = StoreApi<AttachmentStoreState>;\n\n/** An empty `AttachmentStore`, for `<AttachmentProvider store>`. */\nexport function createAttachmentStore(): AttachmentStore {\n return createStore<AttachmentStoreState>(() => ({ attachments: [], isUploading: false, notice: null }));\n}\n\n/**\n * Staged attachments for the composer. With a `store`, they are that store's,\n * whatever is mounted above: one per chat when a host shows several. Without\n * one, a provider already mounted above (a host's, outliving a remounting\n * \\`AthenaChat\\` such as a tab moving between windows) is reused instead of\n * starting empty.\n */\nexport function AttachmentProvider({\n children,\n store,\n}: {\n children: ReactNode;\n store?: AttachmentStore;\n}) {\n const outer = useContext(AttachmentCtx);\n if (store) return <StoreAttachmentProvider store={store}>{children}</StoreAttachmentProvider>;\n if (outer) return <>{children}</>;\n return <OwnAttachmentProvider>{children}</OwnAttachmentProvider>;\n}\n\nfunction OwnAttachmentProvider({ children }: { children: ReactNode }) {\n const [store] = useState(createAttachmentStore);\n // The store is this provider's alone and goes with it: free the pictures a\n // draft still held. A host's store (`store`, an outer provider) outlives a\n // remount and keeps them.\n useEffect(() => () => revokePreviews(store.getState().attachments), [store]);\n return <StoreAttachmentProvider store={store}>{children}</StoreAttachmentProvider>;\n}\n\n/** Frees the local picture previews of attachments the draft lets go. */\nfunction revokePreviews(attachments: readonly UploadedAsset[]): void {\n if (typeof URL === 'undefined' || typeof URL.revokeObjectURL !== 'function') return;\n for (const attachment of attachments) {\n if (attachment.previewUrl) URL.revokeObjectURL(attachment.previewUrl);\n }\n}\n\nfunction StoreAttachmentProvider({\n children,\n store,\n}: {\n children: ReactNode;\n store: AttachmentStore;\n}) {\n const attachments = useStore(store, (state) => state.attachments);\n const isUploading = useStore(store, (state) => state.isUploading);\n const notice = useStore(store, (state) => state.notice ?? null);\n const actions = useMemo(\n () => ({\n addAttachments: (assets: UploadedAsset[]) =>\n store.setState((state) => ({ attachments: [...state.attachments, ...assets] })),\n removeAttachment: (id: string) => {\n revokePreviews(store.getState().attachments.filter((attachment) => attachment.id === id));\n store.setState((state) => ({\n attachments: state.attachments.filter((attachment) => attachment.id !== id),\n }));\n },\n clearAttachments: () => {\n revokePreviews(store.getState().attachments);\n store.setState({ attachments: [] });\n },\n setIsUploading: (uploading: boolean) => store.setState({ isUploading: uploading }),\n setNotice: (next: string | null) => {\n if ((store.getState().notice ?? null) !== next) store.setState({ notice: next });\n },\n }),\n [store],\n );\n const value = useMemo(\n () => ({ attachments, isUploading, notice, ...actions }),\n [attachments, isUploading, notice, actions],\n );\n\n return (\n <AttachmentCtx.Provider value={value}>\n {children}\n </AttachmentCtx.Provider>\n );\n}\n\nexport function useAttachments(): AttachmentContextValue {\n const ctx = useContext(AttachmentCtx);\n if (!ctx) {\n throw new Error('[AthenaSDK] useAttachments must be used within <AttachmentProvider>');\n }\n return ctx;\n}\n\n/**\n * Build the markdown references for the current attachments.\n * Returns empty string if no attachments.\n *\n * @deprecated Use `buildAttachmentMarkdownWithAppUrl` to avoid defaulting links to the production Athena app URL.\n */\nexport function buildAttachmentMarkdown(attachments: UploadedAsset[]): string {\n return buildAttachmentMarkdownWithAppUrl({ attachments });\n}\n\nexport function buildAttachmentMarkdownWithAppUrl({\n attachments,\n appUrl = DEFAULT_APP_URL,\n}: {\n attachments: UploadedAsset[];\n appUrl?: string;\n}): string {\n if (attachments.length === 0) return '';\n return attachments\n .map((attachment) => `[@${attachment.title}](${createAthenaSpacesUrl({ appUrl, assetIds: attachment.id })})`)\n .join('\\n');\n}\n"],"names":["createContext","createStore","useContext","jsx","Fragment","useState","useEffect","useStore","useMemo","DEFAULT_APP_URL","createAthenaSpacesUrl"],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useContext, createContext, useMemo, useState } from "react";
|
|
2
|
+
import { useContext, createContext, useMemo, useState, useEffect } from "react";
|
|
3
3
|
import { useStore } from "zustand";
|
|
4
4
|
import { createStore } from "zustand/vanilla";
|
|
5
5
|
import { createAthenaSpacesUrl, DEFAULT_APP_URL } from "../lib/athena-urls.js";
|
|
@@ -18,8 +18,15 @@ function AttachmentProvider({
|
|
|
18
18
|
}
|
|
19
19
|
function OwnAttachmentProvider({ children }) {
|
|
20
20
|
const [store] = useState(createAttachmentStore);
|
|
21
|
+
useEffect(() => () => revokePreviews(store.getState().attachments), [store]);
|
|
21
22
|
return /* @__PURE__ */ jsx(StoreAttachmentProvider, { store, children });
|
|
22
23
|
}
|
|
24
|
+
function revokePreviews(attachments) {
|
|
25
|
+
if (typeof URL === "undefined" || typeof URL.revokeObjectURL !== "function") return;
|
|
26
|
+
for (const attachment of attachments) {
|
|
27
|
+
if (attachment.previewUrl) URL.revokeObjectURL(attachment.previewUrl);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
23
30
|
function StoreAttachmentProvider({
|
|
24
31
|
children,
|
|
25
32
|
store
|
|
@@ -30,10 +37,16 @@ function StoreAttachmentProvider({
|
|
|
30
37
|
const actions = useMemo(
|
|
31
38
|
() => ({
|
|
32
39
|
addAttachments: (assets) => store.setState((state) => ({ attachments: [...state.attachments, ...assets] })),
|
|
33
|
-
removeAttachment: (id) =>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
removeAttachment: (id) => {
|
|
41
|
+
revokePreviews(store.getState().attachments.filter((attachment) => attachment.id === id));
|
|
42
|
+
store.setState((state) => ({
|
|
43
|
+
attachments: state.attachments.filter((attachment) => attachment.id !== id)
|
|
44
|
+
}));
|
|
45
|
+
},
|
|
46
|
+
clearAttachments: () => {
|
|
47
|
+
revokePreviews(store.getState().attachments);
|
|
48
|
+
store.setState({ attachments: [] });
|
|
49
|
+
},
|
|
37
50
|
setIsUploading: (uploading) => store.setState({ isUploading: uploading }),
|
|
38
51
|
setNotice: (next) => {
|
|
39
52
|
if ((store.getState().notice ?? null) !== next) store.setState({ notice: next });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentContext.js","sources":["../../src/composer/AttachmentContext.tsx"],"sourcesContent":["import { createContext, useContext, useMemo, useState, type ReactNode } from 'react';\nimport { useStore } from 'zustand';\nimport { createStore, type StoreApi } from 'zustand/vanilla';\nimport { createAthenaSpacesUrl, DEFAULT_APP_URL } from '../lib/athena-urls';\nimport type { UploadedAsset } from './useFileUpload';\n\ninterface AttachmentContextValue {\n attachments: UploadedAsset[];\n addAttachments: (assets: UploadedAsset[]) => void;\n removeAttachment: (id: string) => void;\n clearAttachments: () => void;\n /** True when one or more files are currently being uploaded. */\n isUploading: boolean;\n setIsUploading: (v: boolean) => void;\n /**\n * Why the last files offered were not attached, for the composer to say (a file picked while\n * Athena can't be reached cannot upload), or `null`.\n */\n notice: string | null;\n setNotice: (notice: string | null) => void;\n}\n\nconst AttachmentCtx = createContext<AttachmentContextValue | null>(null);\n\ninterface AttachmentStoreState {\n attachments: UploadedAsset[];\n isUploading: boolean;\n notice?: string | null;\n}\n\n/**\n * A composer's staged attachments, kept outside React (`createAttachmentStore`):\n * a host that shows several chats gives each its own, and keeps it while that\n * chat's `AthenaChat` remounts (a tab moving between windows).\n */\nexport type AttachmentStore = StoreApi<AttachmentStoreState>;\n\n/** An empty `AttachmentStore`, for `<AttachmentProvider store>`. */\nexport function createAttachmentStore(): AttachmentStore {\n return createStore<AttachmentStoreState>(() => ({ attachments: [], isUploading: false, notice: null }));\n}\n\n/**\n * Staged attachments for the composer. With a `store`, they are that store's,\n * whatever is mounted above: one per chat when a host shows several. Without\n * one, a provider already mounted above (a host's, outliving a remounting\n * \\`AthenaChat\\` such as a tab moving between windows) is reused instead of\n * starting empty.\n */\nexport function AttachmentProvider({\n children,\n store,\n}: {\n children: ReactNode;\n store?: AttachmentStore;\n}) {\n const outer = useContext(AttachmentCtx);\n if (store) return <StoreAttachmentProvider store={store}>{children}</StoreAttachmentProvider>;\n if (outer) return <>{children}</>;\n return <OwnAttachmentProvider>{children}</OwnAttachmentProvider>;\n}\n\nfunction OwnAttachmentProvider({ children }: { children: ReactNode }) {\n const [store] = useState(createAttachmentStore);\n return <StoreAttachmentProvider store={store}>{children}</StoreAttachmentProvider>;\n}\n\nfunction StoreAttachmentProvider({\n children,\n store,\n}: {\n children: ReactNode;\n store: AttachmentStore;\n}) {\n const attachments = useStore(store, (state) => state.attachments);\n const isUploading = useStore(store, (state) => state.isUploading);\n const notice = useStore(store, (state) => state.notice ?? null);\n const actions = useMemo(\n () => ({\n addAttachments: (assets: UploadedAsset[]) =>\n store.setState((state) => ({ attachments: [...state.attachments, ...assets] })),\n removeAttachment: (id: string)
|
|
1
|
+
{"version":3,"file":"AttachmentContext.js","sources":["../../src/composer/AttachmentContext.tsx"],"sourcesContent":["import { createContext, useContext, useEffect, useMemo, useState, type ReactNode } from 'react';\nimport { useStore } from 'zustand';\nimport { createStore, type StoreApi } from 'zustand/vanilla';\nimport { createAthenaSpacesUrl, DEFAULT_APP_URL } from '../lib/athena-urls';\nimport type { UploadedAsset } from './useFileUpload';\n\ninterface AttachmentContextValue {\n attachments: UploadedAsset[];\n addAttachments: (assets: UploadedAsset[]) => void;\n removeAttachment: (id: string) => void;\n clearAttachments: () => void;\n /** True when one or more files are currently being uploaded. */\n isUploading: boolean;\n setIsUploading: (v: boolean) => void;\n /**\n * Why the last files offered were not attached, for the composer to say (a file picked while\n * Athena can't be reached cannot upload), or `null`.\n */\n notice: string | null;\n setNotice: (notice: string | null) => void;\n}\n\nconst AttachmentCtx = createContext<AttachmentContextValue | null>(null);\n\ninterface AttachmentStoreState {\n attachments: UploadedAsset[];\n isUploading: boolean;\n notice?: string | null;\n}\n\n/**\n * A composer's staged attachments, kept outside React (`createAttachmentStore`):\n * a host that shows several chats gives each its own, and keeps it while that\n * chat's `AthenaChat` remounts (a tab moving between windows).\n */\nexport type AttachmentStore = StoreApi<AttachmentStoreState>;\n\n/** An empty `AttachmentStore`, for `<AttachmentProvider store>`. */\nexport function createAttachmentStore(): AttachmentStore {\n return createStore<AttachmentStoreState>(() => ({ attachments: [], isUploading: false, notice: null }));\n}\n\n/**\n * Staged attachments for the composer. With a `store`, they are that store's,\n * whatever is mounted above: one per chat when a host shows several. Without\n * one, a provider already mounted above (a host's, outliving a remounting\n * \\`AthenaChat\\` such as a tab moving between windows) is reused instead of\n * starting empty.\n */\nexport function AttachmentProvider({\n children,\n store,\n}: {\n children: ReactNode;\n store?: AttachmentStore;\n}) {\n const outer = useContext(AttachmentCtx);\n if (store) return <StoreAttachmentProvider store={store}>{children}</StoreAttachmentProvider>;\n if (outer) return <>{children}</>;\n return <OwnAttachmentProvider>{children}</OwnAttachmentProvider>;\n}\n\nfunction OwnAttachmentProvider({ children }: { children: ReactNode }) {\n const [store] = useState(createAttachmentStore);\n // The store is this provider's alone and goes with it: free the pictures a\n // draft still held. A host's store (`store`, an outer provider) outlives a\n // remount and keeps them.\n useEffect(() => () => revokePreviews(store.getState().attachments), [store]);\n return <StoreAttachmentProvider store={store}>{children}</StoreAttachmentProvider>;\n}\n\n/** Frees the local picture previews of attachments the draft lets go. */\nfunction revokePreviews(attachments: readonly UploadedAsset[]): void {\n if (typeof URL === 'undefined' || typeof URL.revokeObjectURL !== 'function') return;\n for (const attachment of attachments) {\n if (attachment.previewUrl) URL.revokeObjectURL(attachment.previewUrl);\n }\n}\n\nfunction StoreAttachmentProvider({\n children,\n store,\n}: {\n children: ReactNode;\n store: AttachmentStore;\n}) {\n const attachments = useStore(store, (state) => state.attachments);\n const isUploading = useStore(store, (state) => state.isUploading);\n const notice = useStore(store, (state) => state.notice ?? null);\n const actions = useMemo(\n () => ({\n addAttachments: (assets: UploadedAsset[]) =>\n store.setState((state) => ({ attachments: [...state.attachments, ...assets] })),\n removeAttachment: (id: string) => {\n revokePreviews(store.getState().attachments.filter((attachment) => attachment.id === id));\n store.setState((state) => ({\n attachments: state.attachments.filter((attachment) => attachment.id !== id),\n }));\n },\n clearAttachments: () => {\n revokePreviews(store.getState().attachments);\n store.setState({ attachments: [] });\n },\n setIsUploading: (uploading: boolean) => store.setState({ isUploading: uploading }),\n setNotice: (next: string | null) => {\n if ((store.getState().notice ?? null) !== next) store.setState({ notice: next });\n },\n }),\n [store],\n );\n const value = useMemo(\n () => ({ attachments, isUploading, notice, ...actions }),\n [attachments, isUploading, notice, actions],\n );\n\n return (\n <AttachmentCtx.Provider value={value}>\n {children}\n </AttachmentCtx.Provider>\n );\n}\n\nexport function useAttachments(): AttachmentContextValue {\n const ctx = useContext(AttachmentCtx);\n if (!ctx) {\n throw new Error('[AthenaSDK] useAttachments must be used within <AttachmentProvider>');\n }\n return ctx;\n}\n\n/**\n * Build the markdown references for the current attachments.\n * Returns empty string if no attachments.\n *\n * @deprecated Use `buildAttachmentMarkdownWithAppUrl` to avoid defaulting links to the production Athena app URL.\n */\nexport function buildAttachmentMarkdown(attachments: UploadedAsset[]): string {\n return buildAttachmentMarkdownWithAppUrl({ attachments });\n}\n\nexport function buildAttachmentMarkdownWithAppUrl({\n attachments,\n appUrl = DEFAULT_APP_URL,\n}: {\n attachments: UploadedAsset[];\n appUrl?: string;\n}): string {\n if (attachments.length === 0) return '';\n return attachments\n .map((attachment) => `[@${attachment.title}](${createAthenaSpacesUrl({ appUrl, assetIds: attachment.id })})`)\n .join('\\n');\n}\n"],"names":[],"mappings":";;;;;AAsBA,MAAM,gBAAgB,cAA6C,IAAI;AAgBhE,SAAS,wBAAyC;AACvD,SAAO,YAAkC,OAAO,EAAE,aAAa,CAAA,GAAI,aAAa,OAAO,QAAQ,KAAA,EAAO;AACxG;AASO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AACF,GAGG;AACD,QAAM,QAAQ,WAAW,aAAa;AACtC,MAAI,MAAO,QAAO,oBAAC,yBAAA,EAAwB,OAAe,UAAS;AACnE,MAAI,MAAO,QAAO,oBAAA,UAAA,EAAG,SAAA,CAAS;AAC9B,SAAO,oBAAC,yBAAuB,UAAS;AAC1C;AAEA,SAAS,sBAAsB,EAAE,YAAqC;AACpE,QAAM,CAAC,KAAK,IAAI,SAAS,qBAAqB;AAI9C,YAAU,MAAM,MAAM,eAAe,MAAM,SAAA,EAAW,WAAW,GAAG,CAAC,KAAK,CAAC;AAC3E,SAAO,oBAAC,yBAAA,EAAwB,OAAe,SAAA,CAAS;AAC1D;AAGA,SAAS,eAAe,aAA6C;AACnE,MAAI,OAAO,QAAQ,eAAe,OAAO,IAAI,oBAAoB,WAAY;AAC7E,aAAW,cAAc,aAAa;AACpC,QAAI,WAAW,WAAY,KAAI,gBAAgB,WAAW,UAAU;AAAA,EACtE;AACF;AAEA,SAAS,wBAAwB;AAAA,EAC/B;AAAA,EACA;AACF,GAGG;AACD,QAAM,cAAc,SAAS,OAAO,CAAC,UAAU,MAAM,WAAW;AAChE,QAAM,cAAc,SAAS,OAAO,CAAC,UAAU,MAAM,WAAW;AAChE,QAAM,SAAS,SAAS,OAAO,CAAC,UAAU,MAAM,UAAU,IAAI;AAC9D,QAAM,UAAU;AAAA,IACd,OAAO;AAAA,MACL,gBAAgB,CAAC,WACf,MAAM,SAAS,CAAC,WAAW,EAAE,aAAa,CAAC,GAAG,MAAM,aAAa,GAAG,MAAM,IAAI;AAAA,MAChF,kBAAkB,CAAC,OAAe;AAChC,uBAAe,MAAM,SAAA,EAAW,YAAY,OAAO,CAAC,eAAe,WAAW,OAAO,EAAE,CAAC;AACxF,cAAM,SAAS,CAAC,WAAW;AAAA,UACzB,aAAa,MAAM,YAAY,OAAO,CAAC,eAAe,WAAW,OAAO,EAAE;AAAA,QAAA,EAC1E;AAAA,MACJ;AAAA,MACA,kBAAkB,MAAM;AACtB,uBAAe,MAAM,SAAA,EAAW,WAAW;AAC3C,cAAM,SAAS,EAAE,aAAa,CAAA,GAAI;AAAA,MACpC;AAAA,MACA,gBAAgB,CAAC,cAAuB,MAAM,SAAS,EAAE,aAAa,WAAW;AAAA,MACjF,WAAW,CAAC,SAAwB;AAClC,aAAK,MAAM,SAAA,EAAW,UAAU,UAAU,KAAM,OAAM,SAAS,EAAE,QAAQ,KAAA,CAAM;AAAA,MACjF;AAAA,IAAA;AAAA,IAEF,CAAC,KAAK;AAAA,EAAA;AAER,QAAM,QAAQ;AAAA,IACZ,OAAO,EAAE,aAAa,aAAa,QAAQ,GAAG,QAAA;AAAA,IAC9C,CAAC,aAAa,aAAa,QAAQ,OAAO;AAAA,EAAA;AAG5C,SACE,oBAAC,cAAc,UAAd,EAAuB,OACrB,SAAA,CACH;AAEJ;AAEO,SAAS,iBAAyC;AACvD,QAAM,MAAM,WAAW,aAAa;AACpC,MAAI,CAAC,KAAK;AACR,UAAM,IAAI,MAAM,qEAAqE;AAAA,EACvF;AACA,SAAO;AACT;AAYO,SAAS,kCAAkC;AAAA,EAChD;AAAA,EACA,SAAS;AACX,GAGW;AACT,MAAI,YAAY,WAAW,EAAG,QAAO;AACrC,SAAO,YACJ,IAAI,CAAC,eAAe,KAAK,WAAW,KAAK,KAAK,sBAAsB,EAAE,QAAQ,UAAU,WAAW,GAAA,CAAI,CAAC,GAAG,EAC3G,KAAK,IAAI;AACd;"}
|
|
@@ -2,37 +2,92 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const lucideReact = require("lucide-react");
|
|
5
|
+
const require$$0 = require("react");
|
|
6
|
+
const imageViewer = require("../ui/image-viewer.cjs");
|
|
5
7
|
const AttachmentContext = require("./AttachmentContext.cjs");
|
|
6
8
|
const cnfast = require("cnfast");
|
|
9
|
+
const isPicture = (asset) => Boolean(asset.previewUrl);
|
|
10
|
+
const REMOVE_BUTTON_CLASS = "shrink-0 rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors";
|
|
7
11
|
const ComposerAttachmentPreview = ({ className }) => {
|
|
8
12
|
const { attachments, isUploading, removeAttachment } = AttachmentContext.useAttachments();
|
|
13
|
+
const pictures = require$$0.useMemo(() => attachments.filter(isPicture), [attachments]);
|
|
14
|
+
const images = require$$0.useMemo(
|
|
15
|
+
() => pictures.map((picture) => ({ src: picture.previewUrl, name: picture.title })),
|
|
16
|
+
[pictures]
|
|
17
|
+
);
|
|
18
|
+
const [viewingId, setViewingId] = require$$0.useState(null);
|
|
19
|
+
const viewingIndex = pictures.findIndex((picture) => picture.id === viewingId);
|
|
9
20
|
if (attachments.length === 0 && !isUploading) return null;
|
|
10
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cnfast.cn("aui-attachment-preview mx-3 mt-2 flex flex-wrap gap-1.5", className), children: [
|
|
11
|
-
attachments.map(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cnfast.cn("aui-attachment-preview mx-3 mt-2 flex flex-wrap items-end gap-1.5", className), children: [
|
|
22
|
+
attachments.map(
|
|
23
|
+
(asset) => isPicture(asset) ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
className: "group relative h-14 w-[72px] shrink-0 overflow-hidden rounded-lg border border-border/60 bg-muted/40",
|
|
27
|
+
"data-slot": "attachment-picture",
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
30
|
+
"button",
|
|
31
|
+
{
|
|
32
|
+
type: "button",
|
|
33
|
+
onClick: () => setViewingId(asset.id),
|
|
34
|
+
className: "block size-full cursor-zoom-in focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
|
|
35
|
+
"aria-label": `View ${asset.title}`,
|
|
36
|
+
title: asset.title,
|
|
37
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: asset.previewUrl, alt: asset.title, draggable: false, className: "size-full object-cover" })
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
41
|
+
"button",
|
|
42
|
+
{
|
|
43
|
+
type: "button",
|
|
44
|
+
onClick: () => removeAttachment(asset.id),
|
|
45
|
+
className: "absolute right-0.5 top-0.5 inline-flex size-5 items-center justify-center rounded-full bg-black/65 text-white opacity-80 transition-opacity hover:bg-black/80 hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white",
|
|
46
|
+
"aria-label": `Remove ${asset.title}`,
|
|
47
|
+
title: "Remove",
|
|
48
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { className: "size-3" })
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
asset.id
|
|
54
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
className: "flex items-center gap-1.5 rounded-lg border border-border/60 bg-muted/40 px-2.5 py-1.5 text-xs",
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.PaperclipIcon, { className: "size-3 shrink-0 text-muted-foreground/60" }),
|
|
60
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "max-w-[180px] truncate text-foreground/80", children: asset.title }),
|
|
61
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
62
|
+
"button",
|
|
63
|
+
{
|
|
64
|
+
type: "button",
|
|
65
|
+
onClick: () => removeAttachment(asset.id),
|
|
66
|
+
className: REMOVE_BUTTON_CLASS,
|
|
67
|
+
"aria-label": `Remove ${asset.title}`,
|
|
68
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { className: "size-3" })
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
asset.id
|
|
74
|
+
)
|
|
75
|
+
),
|
|
32
76
|
isUploading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 rounded-lg border border-border/60 bg-muted/40 px-2.5 py-1.5 text-xs text-muted-foreground", children: [
|
|
33
77
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2Icon, { className: "size-3 shrink-0 animate-spin" }),
|
|
34
78
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Uploading..." })
|
|
35
|
-
] }) : null
|
|
79
|
+
] }) : null,
|
|
80
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
81
|
+
imageViewer.ImageViewer,
|
|
82
|
+
{
|
|
83
|
+
images,
|
|
84
|
+
index: viewingIndex === -1 ? null : viewingIndex,
|
|
85
|
+
onIndexChange: (index) => {
|
|
86
|
+
var _a;
|
|
87
|
+
return setViewingId(index === null ? null : ((_a = pictures[index]) == null ? void 0 : _a.id) ?? null);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
)
|
|
36
91
|
] });
|
|
37
92
|
};
|
|
38
93
|
exports.ComposerAttachmentPreview = ComposerAttachmentPreview;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComposerAttachmentPreview.cjs","sources":["../../src/composer/ComposerAttachmentPreview.tsx"],"sourcesContent":["import { Loader2Icon, PaperclipIcon, XIcon } from 'lucide-react';\nimport type
|
|
1
|
+
{"version":3,"file":"ComposerAttachmentPreview.cjs","sources":["../../src/composer/ComposerAttachmentPreview.tsx"],"sourcesContent":["import { Loader2Icon, PaperclipIcon, XIcon } from 'lucide-react';\nimport { type FC, useMemo, useState } from 'react';\nimport { ImageViewer, type ImageViewerImage } from '../ui/image-viewer';\nimport { useAttachments } from './AttachmentContext';\nimport type { UploadedAsset } from './useFileUpload';\nimport { cn } from '../lib/utils';\n\nexport interface ComposerAttachmentPreviewProps {\n className?: string;\n}\n\n/** A staged picture: the attachment, with the local preview it shows. */\ntype PictureAttachment = UploadedAsset & { previewUrl: string };\n\nconst isPicture = (asset: UploadedAsset): asset is PictureAttachment => Boolean(asset.previewUrl);\n\nconst REMOVE_BUTTON_CLASS =\n 'shrink-0 rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors';\n\n/**\n * Renders the draft's attachments above the composer. A picture shows as a\n * thumbnail that opens full screen, as Devin's composer does (← → page through\n * the draft's pictures, Esc closes); any other file shows as a pill with its\n * name. Each has a dismiss button.\n */\nexport const ComposerAttachmentPreview: FC<ComposerAttachmentPreviewProps> = ({ className }) => {\n const { attachments, isUploading, removeAttachment } = useAttachments();\n const pictures = useMemo(() => attachments.filter(isPicture), [attachments]);\n const images = useMemo<ImageViewerImage[]>(\n () => pictures.map((picture) => ({ src: picture.previewUrl, name: picture.title })),\n [pictures],\n );\n // The picture open in the viewer, by attachment id: removing another one\n // never moves the viewer to a different picture.\n const [viewingId, setViewingId] = useState<string | null>(null);\n const viewingIndex = pictures.findIndex((picture) => picture.id === viewingId);\n\n if (attachments.length === 0 && !isUploading) return null;\n\n return (\n <div className={cn('aui-attachment-preview mx-3 mt-2 flex flex-wrap items-end gap-1.5', className)}>\n {attachments.map((asset) =>\n isPicture(asset) ? (\n <div\n key={asset.id}\n className=\"group relative h-14 w-[72px] shrink-0 overflow-hidden rounded-lg border border-border/60 bg-muted/40\"\n data-slot=\"attachment-picture\"\n >\n <button\n type=\"button\"\n onClick={() => setViewingId(asset.id)}\n className=\"block size-full cursor-zoom-in focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring\"\n aria-label={`View ${asset.title}`}\n title={asset.title}\n >\n <img src={asset.previewUrl} alt={asset.title} draggable={false} className=\"size-full object-cover\" />\n </button>\n <button\n type=\"button\"\n onClick={() => removeAttachment(asset.id)}\n className=\"absolute right-0.5 top-0.5 inline-flex size-5 items-center justify-center rounded-full bg-black/65 text-white opacity-80 transition-opacity hover:bg-black/80 hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white\"\n aria-label={`Remove ${asset.title}`}\n title=\"Remove\"\n >\n <XIcon className=\"size-3\" />\n </button>\n </div>\n ) : (\n <div\n key={asset.id}\n className=\"flex items-center gap-1.5 rounded-lg border border-border/60 bg-muted/40 px-2.5 py-1.5 text-xs\"\n >\n <PaperclipIcon className=\"size-3 shrink-0 text-muted-foreground/60\" />\n <span className=\"max-w-[180px] truncate text-foreground/80\">{asset.title}</span>\n <button\n type=\"button\"\n onClick={() => removeAttachment(asset.id)}\n className={REMOVE_BUTTON_CLASS}\n aria-label={`Remove ${asset.title}`}\n >\n <XIcon className=\"size-3\" />\n </button>\n </div>\n ),\n )}\n {isUploading ? (\n <div className=\"flex items-center gap-1.5 rounded-lg border border-border/60 bg-muted/40 px-2.5 py-1.5 text-xs text-muted-foreground\">\n <Loader2Icon className=\"size-3 shrink-0 animate-spin\" />\n <span>Uploading...</span>\n </div>\n ) : null}\n <ImageViewer\n images={images}\n index={viewingIndex === -1 ? null : viewingIndex}\n onIndexChange={(index) => setViewingId(index === null ? null : (pictures[index]?.id ?? null))}\n />\n </div>\n );\n};\n"],"names":["useAttachments","useMemo","useState","cn","jsxs","jsx","XIcon","PaperclipIcon","Loader2Icon","ImageViewer"],"mappings":"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"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type FC } from 'react';
|
|
2
2
|
export interface ComposerAttachmentPreviewProps {
|
|
3
3
|
className?: string;
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
|
-
* Renders
|
|
7
|
-
*
|
|
6
|
+
* Renders the draft's attachments above the composer. A picture shows as a
|
|
7
|
+
* thumbnail that opens full screen, as Devin's composer does (← → page through
|
|
8
|
+
* the draft's pictures, Esc closes); any other file shows as a pill with its
|
|
9
|
+
* name. Each has a dismiss button.
|
|
8
10
|
*/
|
|
9
11
|
export declare const ComposerAttachmentPreview: FC<ComposerAttachmentPreviewProps>;
|
|
@@ -1,36 +1,91 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { XIcon, PaperclipIcon, Loader2Icon } from "lucide-react";
|
|
3
|
+
import { useMemo, useState } from "react";
|
|
4
|
+
import { ImageViewer } from "../ui/image-viewer.js";
|
|
3
5
|
import { useAttachments } from "./AttachmentContext.js";
|
|
4
6
|
import { cn } from "cnfast";
|
|
7
|
+
const isPicture = (asset) => Boolean(asset.previewUrl);
|
|
8
|
+
const REMOVE_BUTTON_CLASS = "shrink-0 rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors";
|
|
5
9
|
const ComposerAttachmentPreview = ({ className }) => {
|
|
6
10
|
const { attachments, isUploading, removeAttachment } = useAttachments();
|
|
11
|
+
const pictures = useMemo(() => attachments.filter(isPicture), [attachments]);
|
|
12
|
+
const images = useMemo(
|
|
13
|
+
() => pictures.map((picture) => ({ src: picture.previewUrl, name: picture.title })),
|
|
14
|
+
[pictures]
|
|
15
|
+
);
|
|
16
|
+
const [viewingId, setViewingId] = useState(null);
|
|
17
|
+
const viewingIndex = pictures.findIndex((picture) => picture.id === viewingId);
|
|
7
18
|
if (attachments.length === 0 && !isUploading) return null;
|
|
8
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("aui-attachment-preview mx-3 mt-2 flex flex-wrap gap-1.5", className), children: [
|
|
9
|
-
attachments.map(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("aui-attachment-preview mx-3 mt-2 flex flex-wrap items-end gap-1.5", className), children: [
|
|
20
|
+
attachments.map(
|
|
21
|
+
(asset) => isPicture(asset) ? /* @__PURE__ */ jsxs(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
className: "group relative h-14 w-[72px] shrink-0 overflow-hidden rounded-lg border border-border/60 bg-muted/40",
|
|
25
|
+
"data-slot": "attachment-picture",
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsx(
|
|
28
|
+
"button",
|
|
29
|
+
{
|
|
30
|
+
type: "button",
|
|
31
|
+
onClick: () => setViewingId(asset.id),
|
|
32
|
+
className: "block size-full cursor-zoom-in focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
|
|
33
|
+
"aria-label": `View ${asset.title}`,
|
|
34
|
+
title: asset.title,
|
|
35
|
+
children: /* @__PURE__ */ jsx("img", { src: asset.previewUrl, alt: asset.title, draggable: false, className: "size-full object-cover" })
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
/* @__PURE__ */ jsx(
|
|
39
|
+
"button",
|
|
40
|
+
{
|
|
41
|
+
type: "button",
|
|
42
|
+
onClick: () => removeAttachment(asset.id),
|
|
43
|
+
className: "absolute right-0.5 top-0.5 inline-flex size-5 items-center justify-center rounded-full bg-black/65 text-white opacity-80 transition-opacity hover:bg-black/80 hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white",
|
|
44
|
+
"aria-label": `Remove ${asset.title}`,
|
|
45
|
+
title: "Remove",
|
|
46
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "size-3" })
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
asset.id
|
|
52
|
+
) : /* @__PURE__ */ jsxs(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
className: "flex items-center gap-1.5 rounded-lg border border-border/60 bg-muted/40 px-2.5 py-1.5 text-xs",
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ jsx(PaperclipIcon, { className: "size-3 shrink-0 text-muted-foreground/60" }),
|
|
58
|
+
/* @__PURE__ */ jsx("span", { className: "max-w-[180px] truncate text-foreground/80", children: asset.title }),
|
|
59
|
+
/* @__PURE__ */ jsx(
|
|
60
|
+
"button",
|
|
61
|
+
{
|
|
62
|
+
type: "button",
|
|
63
|
+
onClick: () => removeAttachment(asset.id),
|
|
64
|
+
className: REMOVE_BUTTON_CLASS,
|
|
65
|
+
"aria-label": `Remove ${asset.title}`,
|
|
66
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "size-3" })
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
asset.id
|
|
72
|
+
)
|
|
73
|
+
),
|
|
30
74
|
isUploading ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 rounded-lg border border-border/60 bg-muted/40 px-2.5 py-1.5 text-xs text-muted-foreground", children: [
|
|
31
75
|
/* @__PURE__ */ jsx(Loader2Icon, { className: "size-3 shrink-0 animate-spin" }),
|
|
32
76
|
/* @__PURE__ */ jsx("span", { children: "Uploading..." })
|
|
33
|
-
] }) : null
|
|
77
|
+
] }) : null,
|
|
78
|
+
/* @__PURE__ */ jsx(
|
|
79
|
+
ImageViewer,
|
|
80
|
+
{
|
|
81
|
+
images,
|
|
82
|
+
index: viewingIndex === -1 ? null : viewingIndex,
|
|
83
|
+
onIndexChange: (index) => {
|
|
84
|
+
var _a;
|
|
85
|
+
return setViewingId(index === null ? null : ((_a = pictures[index]) == null ? void 0 : _a.id) ?? null);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
)
|
|
34
89
|
] });
|
|
35
90
|
};
|
|
36
91
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComposerAttachmentPreview.js","sources":["../../src/composer/ComposerAttachmentPreview.tsx"],"sourcesContent":["import { Loader2Icon, PaperclipIcon, XIcon } from 'lucide-react';\nimport type
|
|
1
|
+
{"version":3,"file":"ComposerAttachmentPreview.js","sources":["../../src/composer/ComposerAttachmentPreview.tsx"],"sourcesContent":["import { Loader2Icon, PaperclipIcon, XIcon } from 'lucide-react';\nimport { type FC, useMemo, useState } from 'react';\nimport { ImageViewer, type ImageViewerImage } from '../ui/image-viewer';\nimport { useAttachments } from './AttachmentContext';\nimport type { UploadedAsset } from './useFileUpload';\nimport { cn } from '../lib/utils';\n\nexport interface ComposerAttachmentPreviewProps {\n className?: string;\n}\n\n/** A staged picture: the attachment, with the local preview it shows. */\ntype PictureAttachment = UploadedAsset & { previewUrl: string };\n\nconst isPicture = (asset: UploadedAsset): asset is PictureAttachment => Boolean(asset.previewUrl);\n\nconst REMOVE_BUTTON_CLASS =\n 'shrink-0 rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors';\n\n/**\n * Renders the draft's attachments above the composer. A picture shows as a\n * thumbnail that opens full screen, as Devin's composer does (← → page through\n * the draft's pictures, Esc closes); any other file shows as a pill with its\n * name. Each has a dismiss button.\n */\nexport const ComposerAttachmentPreview: FC<ComposerAttachmentPreviewProps> = ({ className }) => {\n const { attachments, isUploading, removeAttachment } = useAttachments();\n const pictures = useMemo(() => attachments.filter(isPicture), [attachments]);\n const images = useMemo<ImageViewerImage[]>(\n () => pictures.map((picture) => ({ src: picture.previewUrl, name: picture.title })),\n [pictures],\n );\n // The picture open in the viewer, by attachment id: removing another one\n // never moves the viewer to a different picture.\n const [viewingId, setViewingId] = useState<string | null>(null);\n const viewingIndex = pictures.findIndex((picture) => picture.id === viewingId);\n\n if (attachments.length === 0 && !isUploading) return null;\n\n return (\n <div className={cn('aui-attachment-preview mx-3 mt-2 flex flex-wrap items-end gap-1.5', className)}>\n {attachments.map((asset) =>\n isPicture(asset) ? (\n <div\n key={asset.id}\n className=\"group relative h-14 w-[72px] shrink-0 overflow-hidden rounded-lg border border-border/60 bg-muted/40\"\n data-slot=\"attachment-picture\"\n >\n <button\n type=\"button\"\n onClick={() => setViewingId(asset.id)}\n className=\"block size-full cursor-zoom-in focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring\"\n aria-label={`View ${asset.title}`}\n title={asset.title}\n >\n <img src={asset.previewUrl} alt={asset.title} draggable={false} className=\"size-full object-cover\" />\n </button>\n <button\n type=\"button\"\n onClick={() => removeAttachment(asset.id)}\n className=\"absolute right-0.5 top-0.5 inline-flex size-5 items-center justify-center rounded-full bg-black/65 text-white opacity-80 transition-opacity hover:bg-black/80 hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white\"\n aria-label={`Remove ${asset.title}`}\n title=\"Remove\"\n >\n <XIcon className=\"size-3\" />\n </button>\n </div>\n ) : (\n <div\n key={asset.id}\n className=\"flex items-center gap-1.5 rounded-lg border border-border/60 bg-muted/40 px-2.5 py-1.5 text-xs\"\n >\n <PaperclipIcon className=\"size-3 shrink-0 text-muted-foreground/60\" />\n <span className=\"max-w-[180px] truncate text-foreground/80\">{asset.title}</span>\n <button\n type=\"button\"\n onClick={() => removeAttachment(asset.id)}\n className={REMOVE_BUTTON_CLASS}\n aria-label={`Remove ${asset.title}`}\n >\n <XIcon className=\"size-3\" />\n </button>\n </div>\n ),\n )}\n {isUploading ? (\n <div className=\"flex items-center gap-1.5 rounded-lg border border-border/60 bg-muted/40 px-2.5 py-1.5 text-xs text-muted-foreground\">\n <Loader2Icon className=\"size-3 shrink-0 animate-spin\" />\n <span>Uploading...</span>\n </div>\n ) : null}\n <ImageViewer\n images={images}\n index={viewingIndex === -1 ? null : viewingIndex}\n onIndexChange={(index) => setViewingId(index === null ? null : (pictures[index]?.id ?? null))}\n />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;AAcA,MAAM,YAAY,CAAC,UAAqD,QAAQ,MAAM,UAAU;AAEhG,MAAM,sBACJ;AAQK,MAAM,4BAAgE,CAAC,EAAE,gBAAgB;AAC9F,QAAM,EAAE,aAAa,aAAa,iBAAA,IAAqB,eAAA;AACvD,QAAM,WAAW,QAAQ,MAAM,YAAY,OAAO,SAAS,GAAG,CAAC,WAAW,CAAC;AAC3E,QAAM,SAAS;AAAA,IACb,MAAM,SAAS,IAAI,CAAC,aAAa,EAAE,KAAK,QAAQ,YAAY,MAAM,QAAQ,MAAA,EAAQ;AAAA,IAClF,CAAC,QAAQ;AAAA,EAAA;AAIX,QAAM,CAAC,WAAW,YAAY,IAAI,SAAwB,IAAI;AAC9D,QAAM,eAAe,SAAS,UAAU,CAAC,YAAY,QAAQ,OAAO,SAAS;AAE7E,MAAI,YAAY,WAAW,KAAK,CAAC,YAAa,QAAO;AAErD,8BACG,OAAA,EAAI,WAAW,GAAG,qEAAqE,SAAS,GAC9F,UAAA;AAAA,IAAA,YAAY;AAAA,MAAI,CAAC,UAChB,UAAU,KAAK,IACb;AAAA,QAAC;AAAA,QAAA;AAAA,UAEC,WAAU;AAAA,UACV,aAAU;AAAA,UAEV,UAAA;AAAA,YAAA;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,SAAS,MAAM,aAAa,MAAM,EAAE;AAAA,gBACpC,WAAU;AAAA,gBACV,cAAY,QAAQ,MAAM,KAAK;AAAA,gBAC/B,OAAO,MAAM;AAAA,gBAEb,UAAA,oBAAC,OAAA,EAAI,KAAK,MAAM,YAAY,KAAK,MAAM,OAAO,WAAW,OAAO,WAAU,yBAAA,CAAyB;AAAA,cAAA;AAAA,YAAA;AAAA,YAErG;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,SAAS,MAAM,iBAAiB,MAAM,EAAE;AAAA,gBACxC,WAAU;AAAA,gBACV,cAAY,UAAU,MAAM,KAAK;AAAA,gBACjC,OAAM;AAAA,gBAEN,UAAA,oBAAC,OAAA,EAAM,WAAU,SAAA,CAAS;AAAA,cAAA;AAAA,YAAA;AAAA,UAC5B;AAAA,QAAA;AAAA,QArBK,MAAM;AAAA,MAAA,IAwBb;AAAA,QAAC;AAAA,QAAA;AAAA,UAEC,WAAU;AAAA,UAEV,UAAA;AAAA,YAAA,oBAAC,eAAA,EAAc,WAAU,2CAAA,CAA2C;AAAA,YACpE,oBAAC,QAAA,EAAK,WAAU,6CAA6C,gBAAM,OAAM;AAAA,YACzE;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,SAAS,MAAM,iBAAiB,MAAM,EAAE;AAAA,gBACxC,WAAW;AAAA,gBACX,cAAY,UAAU,MAAM,KAAK;AAAA,gBAEjC,UAAA,oBAAC,OAAA,EAAM,WAAU,SAAA,CAAS;AAAA,cAAA;AAAA,YAAA;AAAA,UAC5B;AAAA,QAAA;AAAA,QAZK,MAAM;AAAA,MAAA;AAAA,IAab;AAAA,IAGH,cACC,qBAAC,OAAA,EAAI,WAAU,wHACb,UAAA;AAAA,MAAA,oBAAC,aAAA,EAAY,WAAU,+BAAA,CAA+B;AAAA,MACtD,oBAAC,UAAK,UAAA,eAAA,CAAY;AAAA,IAAA,EAAA,CACpB,IACE;AAAA,IACJ;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,OAAO,iBAAiB,KAAK,OAAO;AAAA,QACpC,eAAe,CAAC;;AAAU,8BAAa,UAAU,OAAO,SAAQ,cAAS,KAAK,MAAd,mBAAiB,OAAM,IAAK;AAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAC9F,GACF;AAEJ;"}
|