@athenaintel/react 0.43.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +258 -8
- package/dist/agent-runtime/src/answer-label.cjs +137 -0
- package/dist/agent-runtime/src/answer-label.cjs.map +1 -0
- package/dist/agent-runtime/src/answer-label.d.ts +104 -0
- package/dist/agent-runtime/src/answer-label.js +137 -0
- package/dist/agent-runtime/src/answer-label.js.map +1 -0
- package/dist/agent-runtime/src/answer-rows.cjs +180 -0
- package/dist/agent-runtime/src/answer-rows.cjs.map +1 -0
- package/dist/agent-runtime/src/answer-rows.d.ts +86 -0
- package/dist/agent-runtime/src/answer-rows.js +180 -0
- package/dist/agent-runtime/src/answer-rows.js.map +1 -0
- package/dist/agent-runtime/src/call-recap.cjs +319 -0
- package/dist/agent-runtime/src/call-recap.cjs.map +1 -0
- package/dist/agent-runtime/src/call-recap.d.ts +142 -0
- package/dist/agent-runtime/src/call-recap.js +319 -0
- package/dist/agent-runtime/src/call-recap.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-store.cjs +1 -0
- package/dist/agent-runtime/src/chat-outbox-store.cjs.map +1 -1
- package/dist/agent-runtime/src/chat-outbox-store.d.ts +7 -0
- package/dist/agent-runtime/src/chat-outbox-store.js +1 -0
- package/dist/agent-runtime/src/chat-outbox-store.js.map +1 -1
- package/dist/agent-runtime/src/chat-outbox.cjs +46 -5
- package/dist/agent-runtime/src/chat-outbox.cjs.map +1 -1
- package/dist/agent-runtime/src/chat-outbox.d.ts +29 -0
- package/dist/agent-runtime/src/chat-outbox.js +46 -5
- package/dist/agent-runtime/src/chat-outbox.js.map +1 -1
- package/dist/agent-runtime/src/client-tool-bridge.cjs +15 -15
- package/dist/agent-runtime/src/client-tool-bridge.cjs.map +1 -1
- package/dist/agent-runtime/src/conversation-index.cjs +8 -8
- package/dist/agent-runtime/src/conversation-index.cjs.map +1 -1
- package/dist/agent-runtime/src/conversation-index.d.ts +7 -0
- package/dist/agent-runtime/src/conversation-index.js.map +1 -1
- package/dist/agent-runtime/src/conversation-list.cjs +2 -1
- package/dist/agent-runtime/src/conversation-list.cjs.map +1 -1
- package/dist/agent-runtime/src/conversation-list.d.ts +19 -3
- package/dist/agent-runtime/src/conversation-list.js +2 -1
- package/dist/agent-runtime/src/conversation-list.js.map +1 -1
- package/dist/agent-runtime/src/decision-checks.cjs +207 -0
- package/dist/agent-runtime/src/decision-checks.cjs.map +1 -0
- package/dist/agent-runtime/src/decision-checks.d.ts +142 -0
- package/dist/agent-runtime/src/decision-checks.js +207 -0
- package/dist/agent-runtime/src/decision-checks.js.map +1 -0
- package/dist/agent-runtime/src/desktop-handoff.d.ts +12 -0
- package/dist/agent-runtime/src/errors.cjs +18 -0
- package/dist/agent-runtime/src/errors.cjs.map +1 -1
- package/dist/agent-runtime/src/errors.d.ts +7 -0
- package/dist/agent-runtime/src/errors.js +18 -0
- package/dist/agent-runtime/src/errors.js.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs +12 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +6 -6
- package/dist/agent-runtime/src/generated/runconfig-contract.js +12 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
- package/dist/agent-runtime/src/handoff-arrival.cjs +60 -0
- package/dist/agent-runtime/src/handoff-arrival.cjs.map +1 -0
- package/dist/agent-runtime/src/handoff-arrival.d.ts +46 -0
- package/dist/agent-runtime/src/handoff-arrival.js +60 -0
- package/dist/agent-runtime/src/handoff-arrival.js.map +1 -0
- package/dist/agent-runtime/src/index.d.ts +16 -9
- package/dist/agent-runtime/src/interrupts.cjs +71 -19
- package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
- package/dist/agent-runtime/src/interrupts.d.ts +40 -3
- package/dist/agent-runtime/src/interrupts.js +56 -4
- package/dist/agent-runtime/src/interrupts.js.map +1 -1
- package/dist/agent-runtime/src/lane-history.cjs +8 -8
- package/dist/agent-runtime/src/lane-history.cjs.map +1 -1
- package/dist/agent-runtime/src/messages.cjs +43 -8
- package/dist/agent-runtime/src/messages.cjs.map +1 -1
- package/dist/agent-runtime/src/messages.d.ts +25 -3
- package/dist/agent-runtime/src/messages.js +43 -8
- package/dist/agent-runtime/src/messages.js.map +1 -1
- package/dist/agent-runtime/src/model-context.cjs +3 -2
- package/dist/agent-runtime/src/model-context.cjs.map +1 -1
- package/dist/agent-runtime/src/model-context.d.ts +6 -1
- package/dist/agent-runtime/src/model-context.js +3 -2
- package/dist/agent-runtime/src/model-context.js.map +1 -1
- package/dist/agent-runtime/src/offline-status.cjs +36 -0
- package/dist/agent-runtime/src/offline-status.cjs.map +1 -0
- package/dist/agent-runtime/src/offline-status.d.ts +118 -3
- package/dist/agent-runtime/src/offline-status.js +36 -0
- package/dist/agent-runtime/src/offline-status.js.map +1 -0
- package/dist/agent-runtime/src/queue.cjs +0 -9
- package/dist/agent-runtime/src/queue.cjs.map +1 -1
- package/dist/agent-runtime/src/queue.js +0 -9
- package/dist/agent-runtime/src/queue.js.map +1 -1
- package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs +9 -9
- package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
- package/dist/agent-runtime/src/runtime-catalog.cjs +42 -0
- package/dist/agent-runtime/src/runtime-catalog.cjs.map +1 -0
- package/dist/agent-runtime/src/runtime-catalog.d.ts +35 -0
- package/dist/agent-runtime/src/runtime-catalog.js +42 -0
- package/dist/agent-runtime/src/runtime-catalog.js.map +1 -0
- package/dist/agent-runtime/src/runtime-messages.cjs.map +1 -1
- package/dist/agent-runtime/src/runtime-messages.d.ts +1 -1
- package/dist/agent-runtime/src/runtime-messages.js.map +1 -1
- package/dist/agent-runtime/src/runtime.d.ts +41 -0
- package/dist/agent-runtime/src/send-recovery.cjs +37 -3
- package/dist/agent-runtime/src/send-recovery.cjs.map +1 -1
- package/dist/agent-runtime/src/send-recovery.d.ts +19 -0
- package/dist/agent-runtime/src/send-recovery.js +37 -3
- package/dist/agent-runtime/src/send-recovery.js.map +1 -1
- package/dist/agent-runtime/src/statewire-suspended.cjs +3 -3
- package/dist/agent-runtime/src/statewire-suspended.cjs.map +1 -1
- package/dist/agent-runtime/src/subagents.cjs +32 -2
- package/dist/agent-runtime/src/subagents.cjs.map +1 -1
- package/dist/agent-runtime/src/subagents.d.ts +9 -0
- package/dist/agent-runtime/src/subagents.js +30 -0
- package/dist/agent-runtime/src/subagents.js.map +1 -1
- package/dist/agent-runtime/src/thread-driver.cjs +67 -0
- package/dist/agent-runtime/src/thread-driver.cjs.map +1 -0
- package/dist/agent-runtime/src/thread-driver.d.ts +49 -0
- package/dist/agent-runtime/src/thread-driver.js +67 -0
- package/dist/agent-runtime/src/thread-driver.js.map +1 -0
- package/dist/agent-runtime/src/thread-handoff-flow-machine.d.ts +172 -0
- package/dist/agent-runtime/src/thread-handoff-protocol.d.ts +868 -0
- package/dist/agent-runtime/src/thread-handoff-qr.d.ts +11 -0
- package/dist/agent-runtime/src/thread-handoff.d.ts +3 -364
- package/dist/agent-runtime/src/thread-status.cjs +3 -3
- package/dist/agent-runtime/src/thread-status.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-metadata.cjs +210 -25
- package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-metadata.d.ts +12 -0
- package/dist/agent-runtime/src/tool-metadata.js +210 -25
- package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
- package/dist/agent-runtime/src/tool-names.cjs +2 -0
- package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-names.d.ts +2 -0
- package/dist/agent-runtime/src/tool-names.js +2 -0
- package/dist/agent-runtime/src/tool-names.js.map +1 -1
- package/dist/agent-runtime/src/types.d.ts +10 -2
- package/dist/agent-runtime/src/use-conversation-list.cjs +14 -13
- package/dist/agent-runtime/src/use-conversation-list.cjs.map +1 -1
- package/dist/agent-runtime/src/use-conversation-list.d.ts +6 -0
- package/dist/agent-runtime/src/use-conversation-list.js +3 -2
- package/dist/agent-runtime/src/use-conversation-list.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +45 -20
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +10 -3
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +27 -2
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-config.cjs +14 -14
- package/dist/agent-runtime/src/use-deep-agent-config.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs +6 -6
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +40 -22
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +17 -0
- package/dist/agent-runtime/src/use-deep-agent-runtime.js +24 -6
- package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs +45 -45
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs +588 -130
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +162 -10
- package/dist/agent-runtime/src/use-deep-agent-voice.js +529 -71
- package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs +26 -26
- package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs.map +1 -1
- package/dist/agent-runtime/src/use-historical-edit-attachments.cjs +4 -4
- package/dist/agent-runtime/src/use-historical-edit-attachments.cjs.map +1 -1
- package/dist/agent-runtime/src/use-thread-handoff-flow.d.ts +34 -26
- package/dist/agent-runtime/src/voice-earcon.cjs +139 -0
- package/dist/agent-runtime/src/voice-earcon.cjs.map +1 -0
- package/dist/agent-runtime/src/voice-earcon.d.ts +38 -0
- package/dist/agent-runtime/src/voice-earcon.js +139 -0
- package/dist/agent-runtime/src/voice-earcon.js.map +1 -0
- package/dist/agent-runtime/src/voice-media.cjs +117 -0
- package/dist/agent-runtime/src/voice-media.cjs.map +1 -0
- package/dist/agent-runtime/src/voice-media.d.ts +63 -0
- package/dist/agent-runtime/src/voice-media.js +117 -0
- package/dist/agent-runtime/src/voice-media.js.map +1 -0
- package/dist/agent-runtime/src/voice-presentation.cjs +2 -0
- package/dist/agent-runtime/src/voice-presentation.cjs.map +1 -1
- package/dist/agent-runtime/src/voice-presentation.js +2 -0
- package/dist/agent-runtime/src/voice-presentation.js.map +1 -1
- package/dist/agent-runtime/src/voice-wire-types.d.ts +32 -0
- package/dist/assets/AssetPanel.cjs +11 -11
- package/dist/assets/AssetPanel.cjs.map +1 -1
- package/dist/assets/AthenaAssetEmbed.cjs +11 -9
- package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
- package/dist/assets/AthenaAssetEmbed.d.ts +18 -5
- package/dist/assets/AthenaAssetEmbed.js +4 -2
- package/dist/assets/AthenaAssetEmbed.js.map +1 -1
- package/dist/assets/AthenaLayout.cjs +16 -16
- package/dist/assets/AthenaLayout.cjs.map +1 -1
- package/dist/assets/use-asset-content.cjs +4 -4
- package/dist/assets/use-asset-content.cjs.map +1 -1
- package/dist/assets/use-asset-embed.cjs +14 -7
- package/dist/assets/use-asset-embed.cjs.map +1 -1
- package/dist/assets/use-asset-embed.d.ts +23 -6
- package/dist/assets/use-asset-embed.js +10 -3
- package/dist/assets/use-asset-embed.js.map +1 -1
- package/dist/auth/AthenaAuthContext.cjs +3 -3
- package/dist/auth/AthenaAuthContext.cjs.map +1 -1
- package/dist/auth/AthenaAuthProvider.cjs +8 -8
- package/dist/auth/AthenaAuthProvider.cjs.map +1 -1
- package/dist/auth/AthenaCredentialSourceContext.cjs +5 -5
- package/dist/auth/AthenaCredentialSourceContext.cjs.map +1 -1
- package/dist/auth/AthenaSSOProvider.cjs +14 -14
- package/dist/auth/AthenaSSOProvider.cjs.map +1 -1
- package/dist/auth/credential-source.cjs +26 -13
- package/dist/auth/credential-source.cjs.map +1 -1
- package/dist/auth/credential-source.d.ts +8 -0
- package/dist/auth/credential-source.js +26 -13
- package/dist/auth/credential-source.js.map +1 -1
- package/dist/catalog/agent-model-options.cjs +25 -17
- package/dist/catalog/agent-model-options.cjs.map +1 -1
- package/dist/catalog/agent-model-options.d.ts +38 -5
- package/dist/catalog/agent-model-options.js +25 -17
- package/dist/catalog/agent-model-options.js.map +1 -1
- package/dist/catalog/channel-refusal.cjs +36 -0
- package/dist/catalog/channel-refusal.cjs.map +1 -0
- package/dist/catalog/channel-refusal.d.ts +29 -0
- package/dist/catalog/channel-refusal.js +36 -0
- package/dist/catalog/channel-refusal.js.map +1 -0
- package/dist/catalog/chat-pickers.cjs +60 -24
- package/dist/catalog/chat-pickers.cjs.map +1 -1
- package/dist/catalog/chat-pickers.d.ts +12 -2
- package/dist/catalog/chat-pickers.js +56 -20
- package/dist/catalog/chat-pickers.js.map +1 -1
- package/dist/catalog/runtime-catalog.cjs +89 -23
- package/dist/catalog/runtime-catalog.cjs.map +1 -1
- package/dist/catalog/runtime-catalog.d.ts +8 -2
- package/dist/catalog/runtime-catalog.js +83 -17
- package/dist/catalog/runtime-catalog.js.map +1 -1
- package/dist/catalog/use-athena-chat-mode.cjs +12 -12
- package/dist/catalog/use-athena-chat-mode.cjs.map +1 -1
- package/dist/chat/AthenaChat.cjs +155 -67
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +42 -2
- package/dist/chat/AthenaChat.js +106 -18
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/chat/AthenaChatErrorBoundary.cjs +3 -3
- package/dist/chat/AthenaChatErrorBoundary.cjs.map +1 -1
- package/dist/chat/DrivingOnChip.cjs +23 -0
- package/dist/chat/DrivingOnChip.cjs.map +1 -0
- package/dist/chat/DrivingOnChip.d.ts +17 -0
- package/dist/chat/DrivingOnChip.js +23 -0
- package/dist/chat/DrivingOnChip.js.map +1 -0
- package/dist/chat/StatewireApprovalCard.cjs +166 -37
- package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
- package/dist/chat/StatewireApprovalCard.d.ts +91 -2
- package/dist/chat/StatewireApprovalCard.js +156 -27
- package/dist/chat/StatewireApprovalCard.js.map +1 -1
- package/dist/chat/StatewireClientToolBridge.cjs +2 -2
- package/dist/chat/StatewireClientToolBridge.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.cjs +81 -69
- package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.d.ts +25 -13
- package/dist/chat/StatewireQueuedMessages.js +73 -61
- package/dist/chat/StatewireQueuedMessages.js.map +1 -1
- package/dist/chat/WaitingOnYouBanner.cjs +9 -5
- package/dist/chat/WaitingOnYouBanner.cjs.map +1 -1
- package/dist/chat/WaitingOnYouBanner.js +7 -3
- package/dist/chat/WaitingOnYouBanner.js.map +1 -1
- package/dist/chat/athena-chat-welcome.cjs +2 -2
- package/dist/chat/athena-chat-welcome.cjs.map +1 -1
- package/dist/chat/athena-citation-links.cjs +5 -5
- package/dist/chat/athena-citation-links.cjs.map +1 -1
- package/dist/chat/athena-composer-controls.cjs +26 -16
- package/dist/chat/athena-composer-controls.cjs.map +1 -1
- package/dist/chat/athena-composer-controls.d.ts +6 -0
- package/dist/chat/athena-composer-controls.js +26 -16
- package/dist/chat/athena-composer-controls.js.map +1 -1
- package/dist/chat/athena-turn-end-status.cjs +42 -0
- package/dist/chat/athena-turn-end-status.cjs.map +1 -0
- package/dist/chat/athena-turn-end-status.d.ts +24 -0
- package/dist/chat/athena-turn-end-status.js +42 -0
- package/dist/chat/athena-turn-end-status.js.map +1 -0
- package/dist/chat/browser-decision-check.cjs +131 -0
- package/dist/chat/browser-decision-check.cjs.map +1 -0
- package/dist/chat/browser-decision-check.d.ts +61 -0
- package/dist/chat/browser-decision-check.js +131 -0
- package/dist/chat/browser-decision-check.js.map +1 -0
- package/dist/chat/chat-outbox-rows.cjs +3 -3
- package/dist/chat/chat-outbox-rows.cjs.map +1 -1
- package/dist/chat/chat-voice-controls.cjs +96 -29
- package/dist/chat/chat-voice-controls.cjs.map +1 -1
- package/dist/chat/chat-voice-controls.d.ts +42 -3
- package/dist/chat/chat-voice-controls.js +92 -25
- package/dist/chat/chat-voice-controls.js.map +1 -1
- package/dist/chat/composer-keyboard-hint.cjs +5 -5
- package/dist/chat/composer-keyboard-hint.cjs.map +1 -1
- package/dist/chat/device-operation.cjs +29 -0
- package/dist/chat/device-operation.cjs.map +1 -0
- package/dist/chat/device-operation.d.ts +34 -0
- package/dist/chat/device-operation.js +29 -0
- package/dist/chat/device-operation.js.map +1 -0
- package/dist/chat/super-grouping/CollapsibleGroup.cjs +14 -14
- package/dist/chat/super-grouping/CollapsibleGroup.cjs.map +1 -1
- package/dist/chat/super-grouping/GroupedMessageParts.cjs +4 -4
- package/dist/chat/super-grouping/GroupedMessageParts.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.cjs +52 -36
- package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.d.ts +19 -4
- package/dist/chat/super-grouping/SuperGroupingCard.js +29 -13
- package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +32 -32
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.js +3 -3
- package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
- package/dist/chat/super-grouping/ToolTimeline.cjs +73 -40
- package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -1
- package/dist/chat/super-grouping/ToolTimeline.d.ts +10 -2
- package/dist/chat/super-grouping/ToolTimeline.js +69 -36
- package/dist/chat/super-grouping/ToolTimeline.js.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.cjs +47 -12
- package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.d.ts +21 -0
- package/dist/chat/super-grouping/activity-timeline.js +47 -12
- package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
- package/dist/chat/super-grouping/grouping-function.cjs +4 -0
- package/dist/chat/super-grouping/grouping-function.cjs.map +1 -1
- package/dist/chat/super-grouping/grouping-function.d.ts +7 -0
- package/dist/chat/super-grouping/grouping-function.js +5 -1
- package/dist/chat/super-grouping/grouping-function.js.map +1 -1
- package/dist/chat/super-grouping/index.cjs +6 -0
- package/dist/chat/super-grouping/index.cjs.map +1 -1
- package/dist/chat/super-grouping/index.d.ts +5 -2
- package/dist/chat/super-grouping/index.js +7 -1
- package/dist/chat/super-grouping/index.js.map +1 -1
- package/dist/chat/super-grouping/tool-part-placement.cjs +17 -0
- package/dist/chat/super-grouping/tool-part-placement.cjs.map +1 -0
- package/dist/chat/super-grouping/tool-part-placement.d.ts +22 -0
- package/dist/chat/super-grouping/tool-part-placement.js +17 -0
- package/dist/chat/super-grouping/tool-part-placement.js.map +1 -0
- package/dist/chat/thread-scroll-to-bottom.cjs +2 -2
- package/dist/chat/thread-scroll-to-bottom.cjs.map +1 -1
- package/dist/chat/thread-scroll-to-bottom.d.ts +10 -7
- package/dist/chat/thread-scroll-to-bottom.js +2 -2
- package/dist/chat/thread-scroll-to-bottom.js.map +1 -1
- package/dist/chat/tooltip-icon-button.cjs +2 -2
- package/dist/chat/tooltip-icon-button.cjs.map +1 -1
- package/dist/chat/use-athena-voice-live.cjs +11 -0
- package/dist/chat/use-athena-voice-live.cjs.map +1 -0
- package/dist/chat/use-athena-voice-live.d.ts +11 -0
- package/dist/chat/use-athena-voice-live.js +11 -0
- package/dist/chat/use-athena-voice-live.js.map +1 -0
- package/dist/chat/use-statewire-approval-request.cjs +56 -24
- package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
- package/dist/chat/use-statewire-approval-request.d.ts +33 -4
- package/dist/chat/use-statewire-approval-request.js +41 -9
- package/dist/chat/use-statewire-approval-request.js.map +1 -1
- package/dist/chat-ui/auth/sign-in-card.cjs +2 -2
- package/dist/chat-ui/auth/sign-in-card.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.cjs +138 -107
- package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.d.ts +20 -4
- package/dist/chat-ui/composer/tiptap-composer.js +85 -54
- package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
- package/dist/chat-ui/header/conversation-history-panel.cjs +49 -23
- package/dist/chat-ui/header/conversation-history-panel.cjs.map +1 -1
- package/dist/chat-ui/header/conversation-history-panel.d.ts +12 -1
- package/dist/chat-ui/header/conversation-history-panel.js +38 -12
- package/dist/chat-ui/header/conversation-history-panel.js.map +1 -1
- package/dist/chat-ui/index.cjs +21 -0
- package/dist/chat-ui/index.cjs.map +1 -1
- package/dist/chat-ui/index.d.ts +8 -1
- package/dist/chat-ui/index.js +21 -0
- package/dist/chat-ui/index.js.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.cjs +4 -4
- package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs +10 -9
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js +3 -2
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs +2 -2
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs +29 -6
- package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-list.d.ts +7 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-list.js +25 -2
- package/dist/chat-ui/mentions/suggestions/components/menu-list.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.cjs +2 -2
- package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.cjs +2 -2
- package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +3 -3
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.cjs +56 -2
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.d.ts +12 -0
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.js +56 -2
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +24 -3
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +7 -0
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js +24 -3
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs +35 -13
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +15 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js +28 -6
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.cjs +9 -6
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.d.ts +3 -0
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.js +5 -2
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.js.map +1 -1
- package/dist/chat-ui/mentions/use-account-workspace-id.cjs +45 -10
- package/dist/chat-ui/mentions/use-account-workspace-id.cjs.map +1 -1
- package/dist/chat-ui/mentions/use-account-workspace-id.d.ts +24 -1
- package/dist/chat-ui/mentions/use-account-workspace-id.js +46 -11
- package/dist/chat-ui/mentions/use-account-workspace-id.js.map +1 -1
- package/dist/chat-ui/mentions/use-member-avatar.cjs +4 -4
- package/dist/chat-ui/mentions/use-member-avatar.cjs.map +1 -1
- package/dist/chat-ui/mentions/use-mention-asset.cjs +3 -3
- package/dist/chat-ui/mentions/use-mention-asset.cjs.map +1 -1
- package/dist/chat-ui/messages/answer-label.cjs +42 -0
- package/dist/chat-ui/messages/answer-label.cjs.map +1 -0
- package/dist/chat-ui/messages/answer-label.d.ts +33 -0
- package/dist/chat-ui/messages/answer-label.js +42 -0
- package/dist/chat-ui/messages/answer-label.js.map +1 -0
- package/dist/chat-ui/messages/arrival-animation.cjs +13 -0
- package/dist/chat-ui/messages/arrival-animation.cjs.map +1 -0
- package/dist/chat-ui/messages/arrival-animation.d.ts +14 -0
- package/dist/chat-ui/messages/arrival-animation.js +13 -0
- package/dist/chat-ui/messages/arrival-animation.js.map +1 -0
- package/dist/chat-ui/messages/continue-pill.cjs +5 -5
- package/dist/chat-ui/messages/continue-pill.cjs.map +1 -1
- package/dist/chat-ui/messages/from-the-call-card.cjs +124 -0
- package/dist/chat-ui/messages/from-the-call-card.cjs.map +1 -0
- package/dist/chat-ui/messages/from-the-call-card.d.ts +17 -0
- package/dist/chat-ui/messages/from-the-call-card.js +124 -0
- package/dist/chat-ui/messages/from-the-call-card.js.map +1 -0
- package/dist/chat-ui/messages/handoff-arrival-divider.cjs +44 -0
- package/dist/chat-ui/messages/handoff-arrival-divider.cjs.map +1 -0
- package/dist/chat-ui/messages/handoff-arrival-divider.d.ts +17 -0
- package/dist/chat-ui/messages/handoff-arrival-divider.js +44 -0
- package/dist/chat-ui/messages/handoff-arrival-divider.js.map +1 -0
- package/dist/chat-ui/messages/message-actions-config.cjs +3 -3
- package/dist/chat-ui/messages/message-actions-config.cjs.map +1 -1
- package/dist/chat-ui/messages/message-components.cjs +8 -4
- package/dist/chat-ui/messages/message-components.cjs.map +1 -1
- package/dist/chat-ui/messages/message-components.js +5 -1
- package/dist/chat-ui/messages/message-components.js.map +1 -1
- package/dist/chat-ui/messages/message-images.cjs +66 -0
- package/dist/chat-ui/messages/message-images.cjs.map +1 -0
- package/dist/chat-ui/messages/message-images.d.ts +16 -0
- package/dist/chat-ui/messages/message-images.js +66 -0
- package/dist/chat-ui/messages/message-images.js.map +1 -0
- package/dist/chat-ui/messages/user-edit-composer.cjs +2 -2
- package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
- package/dist/chat-ui/messages/wake-marker.cjs +3 -3
- package/dist/chat-ui/messages/wake-marker.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-link.cjs +3 -2
- package/dist/chat-ui/rich-text/chat-link.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-link.d.ts +4 -0
- package/dist/chat-ui/rich-text/chat-link.js +4 -3
- package/dist/chat-ui/rich-text/chat-link.js.map +1 -1
- package/dist/chat-ui/rich-text/chat-message-body.cjs +9 -8
- package/dist/chat-ui/rich-text/chat-message-body.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-message-body.d.ts +12 -0
- package/dist/chat-ui/rich-text/chat-message-body.js +2 -1
- package/dist/chat-ui/rich-text/chat-message-body.js.map +1 -1
- package/dist/chat-ui/rich-text/chat-node-views.cjs +6 -6
- package/dist/chat-ui/rich-text/chat-node-views.cjs.map +1 -1
- package/dist/chat-ui/rich-text/dom-output-spec.cjs +2 -2
- package/dist/chat-ui/rich-text/dom-output-spec.cjs.map +1 -1
- package/dist/chat-ui/statewire.cjs +3 -0
- package/dist/chat-ui/statewire.cjs.map +1 -1
- package/dist/chat-ui/statewire.d.ts +2 -1
- package/dist/chat-ui/statewire.js +3 -0
- package/dist/chat-ui/statewire.js.map +1 -1
- package/dist/chat-ui/thread/chat-thread-shell.cjs +45 -14
- package/dist/chat-ui/thread/chat-thread-shell.cjs.map +1 -1
- package/dist/chat-ui/thread/chat-thread-shell.d.ts +16 -2
- package/dist/chat-ui/thread/chat-thread-shell.js +37 -6
- package/dist/chat-ui/thread/chat-thread-shell.js.map +1 -1
- package/dist/chat-ui/thread/composer-send-or-stop.cjs +30 -20
- package/dist/chat-ui/thread/composer-send-or-stop.cjs.map +1 -1
- package/dist/chat-ui/thread/composer-send-or-stop.d.ts +8 -0
- package/dist/chat-ui/thread/composer-send-or-stop.js +29 -19
- package/dist/chat-ui/thread/composer-send-or-stop.js.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.cjs +20 -21
- package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.js +3 -4
- package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
- package/dist/chat-ui/thread/thread-loading-overlay.cjs +5 -5
- package/dist/chat-ui/thread/thread-loading-overlay.cjs.map +1 -1
- package/dist/collab/client.cjs +52 -3
- package/dist/collab/client.cjs.map +1 -1
- package/dist/collab/client.d.ts +27 -0
- package/dist/collab/client.js +52 -3
- package/dist/collab/client.js.map +1 -1
- package/dist/collab/document-status.cjs +150 -0
- package/dist/collab/document-status.cjs.map +1 -0
- package/dist/collab/document-status.d.ts +68 -0
- package/dist/collab/document-status.js +150 -0
- package/dist/collab/document-status.js.map +1 -0
- package/dist/collab/index.cjs +7 -0
- package/dist/collab/index.cjs.map +1 -1
- package/dist/collab/index.d.ts +6 -1
- package/dist/collab/index.js +7 -0
- package/dist/collab/index.js.map +1 -1
- package/dist/collab/presence-react.cjs +11 -11
- package/dist/collab/presence-react.cjs.map +1 -1
- package/dist/collab/react.cjs +6 -6
- package/dist/collab/react.cjs.map +1 -1
- package/dist/composer/AttachmentContext.cjs +24 -11
- package/dist/composer/AttachmentContext.cjs.map +1 -1
- package/dist/composer/AttachmentContext.js +18 -5
- package/dist/composer/AttachmentContext.js.map +1 -1
- package/dist/composer/ComposerAttachmentPreview.cjs +78 -23
- package/dist/composer/ComposerAttachmentPreview.cjs.map +1 -1
- package/dist/composer/ComposerAttachmentPreview.d.ts +5 -3
- package/dist/composer/ComposerAttachmentPreview.js +79 -24
- package/dist/composer/ComposerAttachmentPreview.js.map +1 -1
- package/dist/composer/ComposerDropZone.cjs +7 -7
- package/dist/composer/ComposerDropZone.cjs.map +1 -1
- package/dist/composer/FileUploadButton.cjs +37 -22
- package/dist/composer/FileUploadButton.cjs.map +1 -1
- package/dist/composer/FileUploadButton.d.ts +6 -0
- package/dist/composer/FileUploadButton.js +34 -19
- package/dist/composer/FileUploadButton.js.map +1 -1
- package/dist/composer/QuoteContext.cjs +8 -8
- package/dist/composer/QuoteContext.cjs.map +1 -1
- package/dist/composer/composer-handoff.cjs +4 -4
- package/dist/composer/composer-handoff.cjs.map +1 -1
- package/dist/composer/index.d.ts +1 -1
- package/dist/composer/useAppendToComposer.cjs +4 -4
- package/dist/composer/useAppendToComposer.cjs.map +1 -1
- package/dist/composer/useAttachFiles.cjs +23 -6
- package/dist/composer/useAttachFiles.cjs.map +1 -1
- package/dist/composer/useAttachFiles.d.ts +15 -7
- package/dist/composer/useAttachFiles.js +22 -5
- package/dist/composer/useAttachFiles.js.map +1 -1
- package/dist/composer/useComposerAttachment.cjs +4 -4
- package/dist/composer/useComposerAttachment.cjs.map +1 -1
- package/dist/composer/useFileUpload.cjs +21 -16
- package/dist/composer/useFileUpload.cjs.map +1 -1
- package/dist/composer/useFileUpload.d.ts +12 -0
- package/dist/composer/useFileUpload.js +12 -7
- package/dist/composer/useFileUpload.js.map +1 -1
- package/dist/composer/useReadComposerDraft.cjs +27 -8
- package/dist/composer/useReadComposerDraft.cjs.map +1 -1
- package/dist/composer/useReadComposerDraft.d.ts +23 -1
- package/dist/composer/useReadComposerDraft.js +27 -8
- package/dist/composer/useReadComposerDraft.js.map +1 -1
- package/dist/composer/useSendMessage.cjs +4 -4
- package/dist/composer/useSendMessage.cjs.map +1 -1
- package/dist/diagnostics/useAthenaDiagnostics.cjs +4 -4
- package/dist/diagnostics/useAthenaDiagnostics.cjs.map +1 -1
- package/dist/dictation/audio-level-history.cjs +3 -3
- package/dist/dictation/audio-level-history.cjs.map +1 -1
- package/dist/dictation/dictation-controls.cjs +24 -20
- package/dist/dictation/dictation-controls.cjs.map +1 -1
- package/dist/dictation/dictation-controls.d.ts +6 -1
- package/dist/dictation/dictation-controls.js +24 -20
- package/dist/dictation/dictation-controls.js.map +1 -1
- package/dist/dictation/use-athena-dictation-engine.cjs +3 -3
- package/dist/dictation/use-athena-dictation-engine.cjs.map +1 -1
- package/dist/dictation/use-dictation.cjs +22 -22
- package/dist/dictation/use-dictation.cjs.map +1 -1
- package/dist/index.cjs +29 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +18 -4
- package/dist/index.js +30 -3
- package/dist/index.js.map +1 -1
- package/dist/keryx-http/src/receive-only-socket.cjs +40 -0
- package/dist/keryx-http/src/receive-only-socket.cjs.map +1 -0
- package/dist/keryx-http/src/receive-only-socket.d.ts +27 -0
- package/dist/keryx-http/src/receive-only-socket.js +40 -0
- package/dist/keryx-http/src/receive-only-socket.js.map +1 -0
- package/dist/keryx-http/src/unconfirmed-update-attributions.cjs +190 -0
- package/dist/keryx-http/src/unconfirmed-update-attributions.cjs.map +1 -0
- package/dist/keryx-http/src/unconfirmed-update-attributions.d.ts +132 -0
- package/dist/keryx-http/src/unconfirmed-update-attributions.js +190 -0
- package/dist/keryx-http/src/unconfirmed-update-attributions.js.map +1 -0
- package/dist/keryx-http/src/update-attributions.cjs +141 -0
- package/dist/keryx-http/src/update-attributions.cjs.map +1 -0
- package/dist/keryx-http/src/update-attributions.d.ts +107 -0
- package/dist/keryx-http/src/update-attributions.js +141 -0
- package/dist/keryx-http/src/update-attributions.js.map +1 -0
- package/dist/lib/owner-document.cjs +6 -6
- package/dist/lib/owner-document.cjs.map +1 -1
- package/dist/lib/use-athena-rest-query.cjs +4 -4
- package/dist/lib/use-athena-rest-query.cjs.map +1 -1
- package/dist/lib/use-document-active.cjs +4 -4
- package/dist/lib/use-document-active.cjs.map +1 -1
- package/dist/lib/use-prefers-reduced-motion.cjs +2 -2
- package/dist/lib/use-prefers-reduced-motion.cjs.map +1 -1
- package/dist/offline/offline-history.cjs +7 -7
- package/dist/offline/offline-history.cjs.map +1 -1
- package/dist/provider/AthenaContext.cjs +3 -3
- package/dist/provider/AthenaContext.cjs.map +1 -1
- package/dist/provider/AthenaProvider.cjs +120 -79
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +11 -1
- package/dist/provider/AthenaProvider.js +44 -3
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/provider/PostHogProvider.cjs +2 -2
- package/dist/provider/PostHogProvider.cjs.map +1 -1
- package/dist/provider/agent-selection-context.cjs +2 -2
- package/dist/provider/agent-selection-context.cjs.map +1 -1
- package/dist/provider/chat-mode-context.cjs +2 -2
- package/dist/provider/chat-mode-context.cjs.map +1 -1
- package/dist/provider/session-persistence-context.cjs +10 -0
- package/dist/provider/session-persistence-context.cjs.map +1 -0
- package/dist/provider/session-persistence-context.d.ts +15 -0
- package/dist/provider/session-persistence-context.js +10 -0
- package/dist/provider/session-persistence-context.js.map +1 -0
- package/dist/provider/statewire-history-context.cjs +4 -4
- package/dist/provider/statewire-history-context.cjs.map +1 -1
- package/dist/provider/statewire-lifecycle-context.cjs +3 -3
- package/dist/provider/statewire-lifecycle-context.cjs.map +1 -1
- package/dist/provider/statewire-window-context.cjs +3 -3
- package/dist/provider/statewire-window-context.cjs.map +1 -1
- package/dist/provider/theme-style-context.cjs +3 -3
- package/dist/provider/theme-style-context.cjs.map +1 -1
- package/dist/react/package.json.cjs +1 -1
- package/dist/react/package.json.js +1 -1
- package/dist/runtime/StatewireThreadConfigLaneSync.cjs +10 -10
- package/dist/runtime/StatewireThreadConfigLaneSync.cjs.map +1 -1
- package/dist/runtime/auth-refusal-restart.cjs +7 -7
- package/dist/runtime/auth-refusal-restart.cjs.map +1 -1
- package/dist/runtime/auth.cjs +13 -13
- package/dist/runtime/auth.cjs.map +1 -1
- package/dist/runtime/statewire-lifecycle.cjs +1 -0
- package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
- package/dist/runtime/statewire-lifecycle.d.ts +3 -1
- package/dist/runtime/statewire-lifecycle.js +2 -1
- package/dist/runtime/statewire-lifecycle.js.map +1 -1
- package/dist/runtime/statewire-server-lane-context.cjs +2 -2
- package/dist/runtime/statewire-server-lane-context.cjs.map +1 -1
- package/dist/runtime/statewire-session-lane.cjs +4 -4
- package/dist/runtime/statewire-session-lane.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.cjs +10 -8
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +2 -0
- package/dist/runtime/useAthenaStatewireRuntime.js +2 -0
- package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/threads/Inbox.cjs +8 -8
- package/dist/threads/Inbox.cjs.map +1 -1
- package/dist/threads/SessionList.cjs +9 -9
- package/dist/threads/SessionList.cjs.map +1 -1
- package/dist/threads/SessionsPage.cjs +11 -11
- package/dist/threads/SessionsPage.cjs.map +1 -1
- package/dist/threads/api.cjs.map +1 -1
- package/dist/threads/api.d.ts +15 -0
- package/dist/threads/api.js.map +1 -1
- package/dist/threads/conversation-list-fetcher.cjs +13 -5
- package/dist/threads/conversation-list-fetcher.cjs.map +1 -1
- package/dist/threads/conversation-list-fetcher.d.ts +4 -1
- package/dist/threads/conversation-list-fetcher.js +13 -5
- package/dist/threads/conversation-list-fetcher.js.map +1 -1
- package/dist/threads/index-triggered-refresh.cjs +10 -10
- package/dist/threads/index-triggered-refresh.cjs.map +1 -1
- package/dist/threads/mark-viewed-thread-read.cjs +12 -12
- package/dist/threads/mark-viewed-thread-read.cjs.map +1 -1
- package/dist/threads/offline-session-list.cjs +3 -3
- package/dist/threads/offline-session-list.cjs.map +1 -1
- package/dist/threads/session-list-tab-share.cjs +5 -5
- package/dist/threads/session-list-tab-share.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.cjs +79 -57
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.d.ts +20 -8
- package/dist/threads/statewire-thread-list.js +28 -6
- package/dist/threads/statewire-thread-list.js.map +1 -1
- package/dist/threads/thread-id-context.cjs +5 -5
- package/dist/threads/thread-id-context.cjs.map +1 -1
- package/dist/threads/use-athena-session-attention.cjs +2 -2
- package/dist/threads/use-athena-session-attention.cjs.map +1 -1
- package/dist/threads/use-athena-sessions.cjs +37 -15
- package/dist/threads/use-athena-sessions.cjs.map +1 -1
- package/dist/threads/use-athena-sessions.d.ts +10 -5
- package/dist/threads/use-athena-sessions.js +28 -6
- package/dist/threads/use-athena-sessions.js.map +1 -1
- package/dist/threads/use-athena-thread-model.cjs +3 -3
- package/dist/threads/use-athena-thread-model.cjs.map +1 -1
- package/dist/threads/use-rest-conversation-history.cjs +3 -3
- package/dist/threads/use-rest-conversation-history.cjs.map +1 -1
- package/dist/threads/use-rest-conversation-history.d.ts +1 -0
- package/dist/threads/use-statewire-conversation-history.cjs +8 -8
- package/dist/threads/use-statewire-conversation-history.cjs.map +1 -1
- package/dist/threads/use-thread-archive.cjs +9 -9
- package/dist/threads/use-thread-archive.cjs.map +1 -1
- package/dist/threads/use-thread-favorite.cjs +2 -2
- package/dist/threads/use-thread-favorite.cjs.map +1 -1
- package/dist/threads/use-thread-field-override.cjs +20 -20
- package/dist/threads/use-thread-field-override.cjs.map +1 -1
- package/dist/threads/use-thread-read-state.cjs +4 -4
- package/dist/threads/use-thread-read-state.cjs.map +1 -1
- package/dist/threads/use-thread-rename.cjs +2 -2
- package/dist/threads/use-thread-rename.cjs.map +1 -1
- package/dist/threads/useAthenaThreadManager.cjs +2 -2
- package/dist/threads/useAthenaThreadManager.cjs.map +1 -1
- package/dist/tools/NestedPtcMessages.cjs +6 -6
- package/dist/tools/NestedPtcMessages.cjs.map +1 -1
- package/dist/tools/append-document-tool-ui.cjs +7 -7
- package/dist/tools/append-document-tool-ui.cjs.map +1 -1
- package/dist/tools/file-tool-uis.cjs +2 -2
- package/dist/tools/file-tool-uis.cjs.map +1 -1
- package/dist/tools/misc-tool-uis.cjs +2 -2
- package/dist/tools/misc-tool-uis.cjs.map +1 -1
- package/dist/tools/primitives.cjs +6 -6
- package/dist/tools/primitives.cjs.map +1 -1
- package/dist/tools/read-asset-tool-ui.cjs +6 -6
- package/dist/tools/read-asset-tool-ui.cjs.map +1 -1
- package/dist/tools/subagent-task-tool-ui.cjs +21 -21
- package/dist/tools/subagent-task-tool-ui.cjs.map +1 -1
- package/dist/tools/test-recording-tool-uis.cjs +16 -16
- package/dist/tools/test-recording-tool-uis.cjs.map +1 -1
- package/dist/tools/todo-plan-store.cjs +4 -4
- package/dist/tools/todo-plan-store.cjs.map +1 -1
- package/dist/tools/tool-appearance.cjs +3 -3
- package/dist/tools/tool-appearance.cjs.map +1 -1
- package/dist/tools/tool-fallback.cjs +14 -14
- package/dist/tools/tool-fallback.cjs.map +1 -1
- package/dist/tools/tool-uis.cjs +74 -74
- package/dist/tools/tool-uis.cjs.map +1 -1
- package/dist/tools/use-elapsed-seconds.cjs +3 -3
- package/dist/tools/use-elapsed-seconds.cjs.map +1 -1
- package/dist/tools/write-todos-tool-ui.cjs +9 -9
- package/dist/tools/write-todos-tool-ui.cjs.map +1 -1
- package/dist/ui/image-viewer.cjs +382 -0
- package/dist/ui/image-viewer.cjs.map +1 -0
- package/dist/ui/image-viewer.d.ts +50 -0
- package/dist/ui/image-viewer.js +382 -0
- package/dist/ui/image-viewer.js.map +1 -0
- package/dist/voice/chat.cjs +6 -0
- package/dist/voice/chat.cjs.map +1 -1
- package/dist/voice/chat.d.ts +1 -1
- package/dist/voice/chat.js +8 -2
- package/dist/voice/livekit-join.cjs +52 -101
- package/dist/voice/livekit-join.cjs.map +1 -1
- package/dist/voice/livekit-join.d.ts +1 -6
- package/dist/voice/livekit-join.js +52 -101
- package/dist/voice/livekit-join.js.map +1 -1
- package/dist/voice/livekit.cjs.map +1 -1
- package/dist/voice/livekit.d.ts +11 -1
- package/dist/voice/livekit.js.map +1 -1
- package/dist/voice/use-athena-voice-session.cjs +34 -34
- package/dist/voice/use-athena-voice-session.cjs.map +1 -1
- package/dist/workbench/ComputerLiveDesktop.cjs +13 -13
- package/dist/workbench/ComputerLiveDesktop.cjs.map +1 -1
- package/dist/workbench/SessionWorkbench.cjs +22 -22
- package/dist/workbench/SessionWorkbench.cjs.map +1 -1
- package/dist/workbench/session-workbench-context.cjs +3 -3
- package/dist/workbench/session-workbench-context.cjs.map +1 -1
- package/dist/workbench/session-workbench-panes.cjs +8 -8
- package/dist/workbench/session-workbench-panes.cjs.map +1 -1
- package/dist/workbench/workbench-layout-context.cjs +3 -3
- package/dist/workbench/workbench-layout-context.cjs.map +1 -1
- package/package.json +2 -1
package/dist/collab/index.cjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const closePolicy = require("./close-policy.cjs");
|
|
4
|
+
const documentStatus = require("./document-status.cjs");
|
|
4
5
|
const client = require("./client.cjs");
|
|
6
|
+
const updateAttributions = require("../keryx-http/src/update-attributions.cjs");
|
|
5
7
|
const mint = require("./mint.cjs");
|
|
6
8
|
const presenceClient = require("./presence-client.cjs");
|
|
7
9
|
const presenceMint = require("./presence-mint.cjs");
|
|
@@ -13,9 +15,14 @@ const tokenRefresh = require("./token-refresh.cjs");
|
|
|
13
15
|
exports.WS_CLOSE_AUTH_REVOKED = closePolicy.WS_CLOSE_AUTH_REVOKED;
|
|
14
16
|
exports.WS_CLOSE_DOC_DELETED = closePolicy.WS_CLOSE_DOC_DELETED;
|
|
15
17
|
exports.classifyClose = closePolicy.classifyClose;
|
|
18
|
+
exports.DOCUMENT_STATUS_READ_TIMEOUT_MS = documentStatus.DOCUMENT_STATUS_READ_TIMEOUT_MS;
|
|
19
|
+
exports.DOCUMENT_STATUS_REFRESH_MS = documentStatus.DOCUMENT_STATUS_REFRESH_MS;
|
|
20
|
+
exports.DOCUMENT_STATUS_REFUSED_REFRESH_MS = documentStatus.DOCUMENT_STATUS_REFUSED_REFRESH_MS;
|
|
16
21
|
exports.DEFAULT_OFFLINE_GATE_AFTER_MS = client.DEFAULT_OFFLINE_GATE_AFTER_MS;
|
|
17
22
|
exports.connectGenericDoc = client.connectGenericDoc;
|
|
18
23
|
exports.isRetryableMintError = client.isRetryableMintError;
|
|
24
|
+
exports.BACKGROUND_UPDATE_ATTRIBUTIONS = updateAttributions.BACKGROUND_UPDATE_ATTRIBUTIONS;
|
|
25
|
+
exports.runWithDocUpdateAttributions = updateAttributions.runWithDocUpdateAttributions;
|
|
19
26
|
exports.CollabTokenError = mint.CollabTokenError;
|
|
20
27
|
exports.getAthenaApiBaseUrl = mint.getAthenaApiBaseUrl;
|
|
21
28
|
exports.mintCollabToken = mint.mintCollabToken;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/collab/index.d.ts
CHANGED
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
* Built on yjs v14 (`@y/y`) and the v14-line WebSocket provider
|
|
6
6
|
* (`@y/websocket`). Document auth flows through the public collab-token mint
|
|
7
7
|
* (`POST /api/v0/assets/{id}/collab-token`), which is allowlisted server-side
|
|
8
|
-
* to `generic_doc` assets and admin-only during the initial rollout.
|
|
8
|
+
* to `generic_doc` assets and admin-only during the initial rollout. A write
|
|
9
|
+
* the host makes on its own goes out as housekeeping, not as the person's edit,
|
|
10
|
+
* when it is made inside `runWithDocUpdateAttributions` for the handle's doc
|
|
11
|
+
* with `BACKGROUND_UPDATE_ATTRIBUTIONS`.
|
|
9
12
|
*
|
|
10
13
|
* Workspace presence (`useWorkspacePresence` / `connectWorkspacePresence`)
|
|
11
14
|
* observes the Keryx workspace awareness room (`<workspaceId>/awareness`) —
|
|
@@ -17,7 +20,9 @@
|
|
|
17
20
|
* in awareness contexts into titles the caller may see.
|
|
18
21
|
*/
|
|
19
22
|
export { classifyClose, WS_CLOSE_AUTH_REVOKED, WS_CLOSE_DOC_DELETED } from './close-policy';
|
|
23
|
+
export { DOCUMENT_STATUS_READ_TIMEOUT_MS, DOCUMENT_STATUS_REFRESH_MS, DOCUMENT_STATUS_REFUSED_REFRESH_MS, type DocumentStatusReading, type ReadDocumentStatus, } from './document-status';
|
|
20
24
|
export { CollabTokenError, connectGenericDoc, DEFAULT_OFFLINE_GATE_AFTER_MS, isRetryableMintError, type CollabAuth, type CollabMint, type CollabTokenResponse, type GenericDocConnectGate, type GenericDocHandle, type GenericDocLocalCopy, type GenericDocStatus, type GenericDocTransportView, type PresenceEntry, } from './client';
|
|
25
|
+
export { BACKGROUND_UPDATE_ATTRIBUTIONS, runWithDocUpdateAttributions, type UpdateAttribution, } from '../keryx-http/src/update-attributions';
|
|
21
26
|
export { getAthenaApiBaseUrl, mintCollabToken } from './mint';
|
|
22
27
|
export { PRESENCE_SWEEP_INTERVAL_MS, connectWorkspacePresence, type WorkspacePresenceHandle, type WorkspacePresenceStatus, } from './presence-client';
|
|
23
28
|
export { mintWorkspacePresenceToken, resolveWorkspacePresence, type WorkspacePresenceResolveRequest, type WorkspacePresenceResolveResponse, type WorkspacePresenceResolvedAsset, type WorkspacePresenceResolvedMember, type WorkspacePresenceResolvedProject, type WorkspacePresenceResolvedSession, type WorkspacePresenceTokenResponse, } from './presence-mint';
|
package/dist/collab/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { WS_CLOSE_AUTH_REVOKED, WS_CLOSE_DOC_DELETED, classifyClose } from "./close-policy.js";
|
|
2
|
+
import { DOCUMENT_STATUS_READ_TIMEOUT_MS, DOCUMENT_STATUS_REFRESH_MS, DOCUMENT_STATUS_REFUSED_REFRESH_MS } from "./document-status.js";
|
|
2
3
|
import { DEFAULT_OFFLINE_GATE_AFTER_MS, connectGenericDoc, isRetryableMintError } from "./client.js";
|
|
4
|
+
import { BACKGROUND_UPDATE_ATTRIBUTIONS, runWithDocUpdateAttributions } from "../keryx-http/src/update-attributions.js";
|
|
3
5
|
import { CollabTokenError, getAthenaApiBaseUrl, mintCollabToken } from "./mint.js";
|
|
4
6
|
import { PRESENCE_SWEEP_INTERVAL_MS, connectWorkspacePresence } from "./presence-client.js";
|
|
5
7
|
import { mintWorkspacePresenceToken, resolveWorkspacePresence } from "./presence-mint.js";
|
|
@@ -9,8 +11,12 @@ import { useGenericDoc } from "./react.js";
|
|
|
9
11
|
import { defineDocShape } from "./shape.js";
|
|
10
12
|
import { MAX_CONSECUTIVE_REMINTS, MIN_REFRESH_DELAY_MS, REFRESH_HEADROOM_MS, refreshDelayMs } from "./token-refresh.js";
|
|
11
13
|
export {
|
|
14
|
+
BACKGROUND_UPDATE_ATTRIBUTIONS,
|
|
12
15
|
CollabTokenError,
|
|
13
16
|
DEFAULT_OFFLINE_GATE_AFTER_MS,
|
|
17
|
+
DOCUMENT_STATUS_READ_TIMEOUT_MS,
|
|
18
|
+
DOCUMENT_STATUS_REFRESH_MS,
|
|
19
|
+
DOCUMENT_STATUS_REFUSED_REFRESH_MS,
|
|
14
20
|
MAX_CONSECUTIVE_REMINTS,
|
|
15
21
|
MAX_PRESENCE_CONTEXTS_PER_SLOT,
|
|
16
22
|
MAX_PRESENCE_STRING_CHARS,
|
|
@@ -35,6 +41,7 @@ export {
|
|
|
35
41
|
mintWorkspacePresenceToken,
|
|
36
42
|
refreshDelayMs,
|
|
37
43
|
resolveWorkspacePresence,
|
|
44
|
+
runWithDocUpdateAttributions,
|
|
38
45
|
useGenericDoc,
|
|
39
46
|
useWorkspacePresence,
|
|
40
47
|
useWorkspacePresenceResolver
|
package/dist/collab/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -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 presenceClient = require("./presence-client.cjs");
|
|
@@ -15,9 +15,9 @@ function useWorkspacePresence(workspaceId, options) {
|
|
|
15
15
|
const identityEpoch = AthenaCredentialSourceContext.useAthenaCredentialIdentityEpoch();
|
|
16
16
|
const enabled = (options == null ? void 0 : options.enabled) !== false && workspaceId !== null;
|
|
17
17
|
const tickMs = (options == null ? void 0 : options.tickMs) ?? PRESENCE_DEFAULT_TICK_MS;
|
|
18
|
-
const [entry, setEntry] =
|
|
19
|
-
const handleRef =
|
|
20
|
-
|
|
18
|
+
const [entry, setEntry] = require$$0.useState(null);
|
|
19
|
+
const handleRef = require$$0.useRef(null);
|
|
20
|
+
require$$0.useEffect(() => {
|
|
21
21
|
if (!enabled || workspaceId === null) {
|
|
22
22
|
setEntry(null);
|
|
23
23
|
return;
|
|
@@ -39,14 +39,14 @@ function useWorkspacePresence(workspaceId, options) {
|
|
|
39
39
|
};
|
|
40
40
|
}, [enabled, workspaceId, config.backendUrl, config.apiKey, config.getToken, identityEpoch]);
|
|
41
41
|
const handle = enabled && entry !== null && entry.workspaceId === workspaceId ? entry.handle : null;
|
|
42
|
-
const subscribe =
|
|
42
|
+
const subscribe = require$$0.useMemo(() => {
|
|
43
43
|
return (onStoreChange) => {
|
|
44
44
|
if (!handle) return () => {
|
|
45
45
|
};
|
|
46
46
|
return handle.onChange(onStoreChange);
|
|
47
47
|
};
|
|
48
48
|
}, [handle]);
|
|
49
|
-
|
|
49
|
+
require$$0.useSyncExternalStore(
|
|
50
50
|
subscribe,
|
|
51
51
|
() => {
|
|
52
52
|
if (!handle) return EMPTY_SNAPSHOT;
|
|
@@ -54,8 +54,8 @@ function useWorkspacePresence(workspaceId, options) {
|
|
|
54
54
|
},
|
|
55
55
|
() => EMPTY_SNAPSHOT
|
|
56
56
|
);
|
|
57
|
-
const [now, setNow] =
|
|
58
|
-
|
|
57
|
+
const [now, setNow] = require$$0.useState(() => Date.now());
|
|
58
|
+
require$$0.useEffect(() => {
|
|
59
59
|
if (!enabled) return;
|
|
60
60
|
setNow(Date.now());
|
|
61
61
|
const timer = setInterval(() => {
|
|
@@ -66,7 +66,7 @@ function useWorkspacePresence(workspaceId, options) {
|
|
|
66
66
|
};
|
|
67
67
|
}, [enabled, tickMs]);
|
|
68
68
|
const rosterHumans = (handle == null ? void 0 : handle.humans) ?? NO_HUMANS;
|
|
69
|
-
const humans =
|
|
69
|
+
const humans = require$$0.useMemo(
|
|
70
70
|
() => rosterHumans.map((human) => ({
|
|
71
71
|
...human,
|
|
72
72
|
state: presenceSlots.derivePresenceState({
|
|
@@ -78,7 +78,7 @@ function useWorkspacePresence(workspaceId, options) {
|
|
|
78
78
|
})),
|
|
79
79
|
[rosterHumans, now]
|
|
80
80
|
);
|
|
81
|
-
const refreshNow =
|
|
81
|
+
const refreshNow = require$$0.useCallback(() => {
|
|
82
82
|
var _a;
|
|
83
83
|
return ((_a = handleRef.current) == null ? void 0 : _a.refreshNow()) ?? Promise.resolve();
|
|
84
84
|
}, []);
|
|
@@ -93,7 +93,7 @@ function useWorkspacePresence(workspaceId, options) {
|
|
|
93
93
|
}
|
|
94
94
|
function useWorkspacePresenceResolver(workspaceId) {
|
|
95
95
|
const config = AthenaContext.useAthenaConfig();
|
|
96
|
-
return
|
|
96
|
+
return require$$0.useCallback(
|
|
97
97
|
(request, signal) => {
|
|
98
98
|
if (workspaceId === null) {
|
|
99
99
|
return Promise.reject(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presence-react.cjs","sources":["../../src/collab/presence-react.ts"],"sourcesContent":["/**\n * React bindings for the workspace presence feed.\n *\n * `useWorkspacePresence(workspaceId)` opens (and owns) a\n * `connectWorkspacePresence` handle, resolving auth from the surrounding\n * `AthenaProvider` (per-viewer bearer when present, API key otherwise), and\n * re-renders on status/roster changes via `useSyncExternalStore`. Each person\n * carries a `state` on the intent ladder, recomputed against a clock that\n * ticks every `tickMs` so `active` decays to `idle` and `away` between\n * awareness events.\n *\n * `useWorkspacePresenceResolver(workspaceId)` returns the batch id→title\n * resolver bound to the same auth. It is deliberately thin: callers own\n * caching (TanStack Query is the expected home for it).\n */\n\nimport { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';\nimport { useAthenaCredentialIdentityEpoch } from '../auth/AthenaCredentialSourceContext';\nimport { useAthenaConfig } from '../provider/AthenaContext';\nimport {\n type WorkspacePresenceHandle,\n type WorkspacePresenceStatus,\n connectWorkspacePresence,\n} from './presence-client';\nimport {\n type WorkspacePresenceResolveRequest,\n type WorkspacePresenceResolveResponse,\n resolveWorkspacePresence,\n} from './presence-mint';\nimport {\n type PresenceAgent,\n type PresenceHuman,\n type PresenceState,\n derivePresenceState,\n} from './presence-slots';\n\n/** Default cadence for re-deriving each person's intent state. */\nexport const PRESENCE_DEFAULT_TICK_MS = 10_000;\n\nexport interface PresenceHumanWithState extends PresenceHuman {\n /** Where the person sits on the intent ladder as of the last tick. */\n state: PresenceState;\n}\n\nexport interface UseWorkspacePresenceOptions {\n /** `false` closes the feed without unmounting the caller. Default `true`. */\n enabled?: boolean;\n /** How often `state` is re-derived from `lastIntentAt`. Default 10 s. */\n tickMs?: number;\n}\n\nexport interface UseWorkspacePresenceResult {\n /** `'closed'` while disabled or without a workspace; `'connecting'` until the first mint resolves. */\n status: WorkspacePresenceStatus;\n error: Error | null;\n accessType: 'r' | 'rw' | null;\n humans: PresenceHumanWithState[];\n agents: PresenceAgent[];\n /** Force an early token refresh; resolves immediately when no feed is open. */\n refreshNow: () => Promise<void>;\n}\n\nconst EMPTY_SNAPSHOT = 'init||0';\nconst NO_HUMANS: PresenceHuman[] = [];\nconst NO_AGENTS: PresenceAgent[] = [];\n\nexport function useWorkspacePresence(\n workspaceId: string | null,\n options?: UseWorkspacePresenceOptions\n): UseWorkspacePresenceResult {\n const config = useAthenaConfig();\n const identityEpoch = useAthenaCredentialIdentityEpoch();\n const enabled = options?.enabled !== false && workspaceId !== null;\n const tickMs = options?.tickMs ?? PRESENCE_DEFAULT_TICK_MS;\n const [entry, setEntry] = useState<{\n workspaceId: string;\n handle: WorkspacePresenceHandle;\n } | null>(null);\n const handleRef = useRef<WorkspacePresenceHandle | null>(null);\n\n useEffect(() => {\n if (!enabled || workspaceId === null) {\n setEntry(null);\n return;\n }\n const next = connectWorkspacePresence({\n workspaceId,\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 setEntry({ workspaceId, handle: 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 }, [enabled, workspaceId, config.backendUrl, config.apiKey, config.getToken, identityEpoch]);\n\n // React renders with the new arguments before the effect above runs, so a\n // handle opened for a previous workspace, or before the feed was disabled,\n // still sits in state for that one render. Expose it only while it is the\n // handle this render asked for; otherwise the closed / connecting empty\n // result wins, and a disabled feed never leaks a roster.\n const handle =\n enabled && entry !== null && entry.workspaceId === workspaceId ? entry.handle : null;\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.accessType ?? ''}|${handle.version}`;\n },\n () => EMPTY_SNAPSHOT\n );\n void snapshot;\n\n // The ladder decays with wall-clock time, not with awareness events; a\n // person who stops typing must drift to idle even when nothing arrives.\n const [now, setNow] = useState(() => Date.now());\n useEffect(() => {\n if (!enabled) return;\n setNow(Date.now());\n const timer = setInterval(() => {\n setNow(Date.now());\n }, tickMs);\n return () => {\n clearInterval(timer);\n };\n }, [enabled, tickMs]);\n\n const rosterHumans = handle?.humans ?? NO_HUMANS;\n const humans = useMemo(\n () =>\n rosterHumans.map((human) => ({\n ...human,\n state: derivePresenceState({\n lastIntentAt: human.lastIntentAt,\n hidden: human.hidden,\n manualAway: human.manualAway,\n now,\n }),\n })),\n [rosterHumans, now]\n );\n\n const refreshNow = useCallback(() => handleRef.current?.refreshNow() ?? Promise.resolve(), []);\n\n return {\n status: handle ? handle.status : enabled ? 'connecting' : 'closed',\n error: handle?.error ?? null,\n accessType: handle?.accessType ?? null,\n humans,\n agents: handle?.agents ?? NO_AGENTS,\n refreshNow,\n };\n}\n\nexport type WorkspacePresenceResolver = (\n request: WorkspacePresenceResolveRequest,\n signal?: AbortSignal\n) => Promise<WorkspacePresenceResolveResponse>;\n\n/**\n * A stable resolver bound to the provider's auth and the given workspace.\n * Credentials are read on every call (the provider serves the current token\n * through getters), and `getToken` renews a refused one once. Rejects when\n * called without a workspace; no caching — callers own that.\n */\nexport function useWorkspacePresenceResolver(\n workspaceId: string | null\n): WorkspacePresenceResolver {\n const config = useAthenaConfig();\n return useCallback<WorkspacePresenceResolver>(\n (request, signal) => {\n if (workspaceId === null) {\n return Promise.reject(\n new Error('[AthenaSDK] useWorkspacePresenceResolver: no workspace selected')\n );\n }\n return resolveWorkspacePresence({\n auth: {\n backendUrl: config.backendUrl,\n apiKey: config.apiKey,\n token: config.token,\n getToken: config.getToken,\n },\n workspaceId,\n request,\n signal,\n });\n },\n [workspaceId, config]\n );\n}\n"],"names":["useAthenaConfig","useAthenaCredentialIdentityEpoch","useState","useRef","useEffect","connectWorkspacePresence","useMemo","useSyncExternalStore","derivePresenceState","useCallback","resolveWorkspacePresence"],"mappings":";;;;;;;;AAqCO,MAAM,2BAA2B;AAyBxC,MAAM,iBAAiB;AACvB,MAAM,YAA6B,CAAA;AACnC,MAAM,YAA6B,CAAA;AAE5B,SAAS,qBACd,aACA,SAC4B;AAC5B,QAAM,SAASA,cAAAA,gBAAA;AACf,QAAM,gBAAgBC,8BAAAA,iCAAA;AACtB,QAAM,WAAU,mCAAS,aAAY,SAAS,gBAAgB;AAC9D,QAAM,UAAS,mCAAS,WAAU;AAClC,QAAM,CAAC,OAAO,QAAQ,IAAIC,
|
|
1
|
+
{"version":3,"file":"presence-react.cjs","sources":["../../src/collab/presence-react.ts"],"sourcesContent":["/**\n * React bindings for the workspace presence feed.\n *\n * `useWorkspacePresence(workspaceId)` opens (and owns) a\n * `connectWorkspacePresence` handle, resolving auth from the surrounding\n * `AthenaProvider` (per-viewer bearer when present, API key otherwise), and\n * re-renders on status/roster changes via `useSyncExternalStore`. Each person\n * carries a `state` on the intent ladder, recomputed against a clock that\n * ticks every `tickMs` so `active` decays to `idle` and `away` between\n * awareness events.\n *\n * `useWorkspacePresenceResolver(workspaceId)` returns the batch id→title\n * resolver bound to the same auth. It is deliberately thin: callers own\n * caching (TanStack Query is the expected home for it).\n */\n\nimport { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';\nimport { useAthenaCredentialIdentityEpoch } from '../auth/AthenaCredentialSourceContext';\nimport { useAthenaConfig } from '../provider/AthenaContext';\nimport {\n type WorkspacePresenceHandle,\n type WorkspacePresenceStatus,\n connectWorkspacePresence,\n} from './presence-client';\nimport {\n type WorkspacePresenceResolveRequest,\n type WorkspacePresenceResolveResponse,\n resolveWorkspacePresence,\n} from './presence-mint';\nimport {\n type PresenceAgent,\n type PresenceHuman,\n type PresenceState,\n derivePresenceState,\n} from './presence-slots';\n\n/** Default cadence for re-deriving each person's intent state. */\nexport const PRESENCE_DEFAULT_TICK_MS = 10_000;\n\nexport interface PresenceHumanWithState extends PresenceHuman {\n /** Where the person sits on the intent ladder as of the last tick. */\n state: PresenceState;\n}\n\nexport interface UseWorkspacePresenceOptions {\n /** `false` closes the feed without unmounting the caller. Default `true`. */\n enabled?: boolean;\n /** How often `state` is re-derived from `lastIntentAt`. Default 10 s. */\n tickMs?: number;\n}\n\nexport interface UseWorkspacePresenceResult {\n /** `'closed'` while disabled or without a workspace; `'connecting'` until the first mint resolves. */\n status: WorkspacePresenceStatus;\n error: Error | null;\n accessType: 'r' | 'rw' | null;\n humans: PresenceHumanWithState[];\n agents: PresenceAgent[];\n /** Force an early token refresh; resolves immediately when no feed is open. */\n refreshNow: () => Promise<void>;\n}\n\nconst EMPTY_SNAPSHOT = 'init||0';\nconst NO_HUMANS: PresenceHuman[] = [];\nconst NO_AGENTS: PresenceAgent[] = [];\n\nexport function useWorkspacePresence(\n workspaceId: string | null,\n options?: UseWorkspacePresenceOptions\n): UseWorkspacePresenceResult {\n const config = useAthenaConfig();\n const identityEpoch = useAthenaCredentialIdentityEpoch();\n const enabled = options?.enabled !== false && workspaceId !== null;\n const tickMs = options?.tickMs ?? PRESENCE_DEFAULT_TICK_MS;\n const [entry, setEntry] = useState<{\n workspaceId: string;\n handle: WorkspacePresenceHandle;\n } | null>(null);\n const handleRef = useRef<WorkspacePresenceHandle | null>(null);\n\n useEffect(() => {\n if (!enabled || workspaceId === null) {\n setEntry(null);\n return;\n }\n const next = connectWorkspacePresence({\n workspaceId,\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 setEntry({ workspaceId, handle: 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 }, [enabled, workspaceId, config.backendUrl, config.apiKey, config.getToken, identityEpoch]);\n\n // React renders with the new arguments before the effect above runs, so a\n // handle opened for a previous workspace, or before the feed was disabled,\n // still sits in state for that one render. Expose it only while it is the\n // handle this render asked for; otherwise the closed / connecting empty\n // result wins, and a disabled feed never leaks a roster.\n const handle =\n enabled && entry !== null && entry.workspaceId === workspaceId ? entry.handle : null;\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.accessType ?? ''}|${handle.version}`;\n },\n () => EMPTY_SNAPSHOT\n );\n void snapshot;\n\n // The ladder decays with wall-clock time, not with awareness events; a\n // person who stops typing must drift to idle even when nothing arrives.\n const [now, setNow] = useState(() => Date.now());\n useEffect(() => {\n if (!enabled) return;\n setNow(Date.now());\n const timer = setInterval(() => {\n setNow(Date.now());\n }, tickMs);\n return () => {\n clearInterval(timer);\n };\n }, [enabled, tickMs]);\n\n const rosterHumans = handle?.humans ?? NO_HUMANS;\n const humans = useMemo(\n () =>\n rosterHumans.map((human) => ({\n ...human,\n state: derivePresenceState({\n lastIntentAt: human.lastIntentAt,\n hidden: human.hidden,\n manualAway: human.manualAway,\n now,\n }),\n })),\n [rosterHumans, now]\n );\n\n const refreshNow = useCallback(() => handleRef.current?.refreshNow() ?? Promise.resolve(), []);\n\n return {\n status: handle ? handle.status : enabled ? 'connecting' : 'closed',\n error: handle?.error ?? null,\n accessType: handle?.accessType ?? null,\n humans,\n agents: handle?.agents ?? NO_AGENTS,\n refreshNow,\n };\n}\n\nexport type WorkspacePresenceResolver = (\n request: WorkspacePresenceResolveRequest,\n signal?: AbortSignal\n) => Promise<WorkspacePresenceResolveResponse>;\n\n/**\n * A stable resolver bound to the provider's auth and the given workspace.\n * Credentials are read on every call (the provider serves the current token\n * through getters), and `getToken` renews a refused one once. Rejects when\n * called without a workspace; no caching — callers own that.\n */\nexport function useWorkspacePresenceResolver(\n workspaceId: string | null\n): WorkspacePresenceResolver {\n const config = useAthenaConfig();\n return useCallback<WorkspacePresenceResolver>(\n (request, signal) => {\n if (workspaceId === null) {\n return Promise.reject(\n new Error('[AthenaSDK] useWorkspacePresenceResolver: no workspace selected')\n );\n }\n return resolveWorkspacePresence({\n auth: {\n backendUrl: config.backendUrl,\n apiKey: config.apiKey,\n token: config.token,\n getToken: config.getToken,\n },\n workspaceId,\n request,\n signal,\n });\n },\n [workspaceId, config]\n );\n}\n"],"names":["useAthenaConfig","useAthenaCredentialIdentityEpoch","useState","useRef","useEffect","connectWorkspacePresence","useMemo","useSyncExternalStore","derivePresenceState","useCallback","resolveWorkspacePresence"],"mappings":";;;;;;;;AAqCO,MAAM,2BAA2B;AAyBxC,MAAM,iBAAiB;AACvB,MAAM,YAA6B,CAAA;AACnC,MAAM,YAA6B,CAAA;AAE5B,SAAS,qBACd,aACA,SAC4B;AAC5B,QAAM,SAASA,cAAAA,gBAAA;AACf,QAAM,gBAAgBC,8BAAAA,iCAAA;AACtB,QAAM,WAAU,mCAAS,aAAY,SAAS,gBAAgB;AAC9D,QAAM,UAAS,mCAAS,WAAU;AAClC,QAAM,CAAC,OAAO,QAAQ,IAAIC,WAAAA,SAGhB,IAAI;AACd,QAAM,YAAYC,WAAAA,OAAuC,IAAI;AAE7DC,aAAAA,UAAU,MAAM;AACd,QAAI,CAAC,WAAW,gBAAgB,MAAM;AACpC,eAAS,IAAI;AACb;AAAA,IACF;AACA,UAAM,OAAOC,eAAAA,yBAAyB;AAAA,MACpC;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,aAAS,EAAE,aAAa,QAAQ,KAAA,CAAM;AACtC,WAAO,MAAM;AACX,gBAAU,UAAU;AACpB,WAAK,QAAA;AAAA,IACP;AAAA,EAMF,GAAG,CAAC,SAAS,aAAa,OAAO,YAAY,OAAO,QAAQ,OAAO,UAAU,aAAa,CAAC;AAO3F,QAAM,SACJ,WAAW,UAAU,QAAQ,MAAM,gBAAgB,cAAc,MAAM,SAAS;AAElF,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,cAAc,EAAE,IAAI,OAAO,OAAO;AAAA,IACtE;AAAA,IACA,MAAM;AAAA,EAAA;AAMR,QAAM,CAAC,KAAK,MAAM,IAAIL,WAAAA,SAAS,MAAM,KAAK,KAAK;AAC/CE,aAAAA,UAAU,MAAM;AACd,QAAI,CAAC,QAAS;AACd,WAAO,KAAK,KAAK;AACjB,UAAM,QAAQ,YAAY,MAAM;AAC9B,aAAO,KAAK,KAAK;AAAA,IACnB,GAAG,MAAM;AACT,WAAO,MAAM;AACX,oBAAc,KAAK;AAAA,IACrB;AAAA,EACF,GAAG,CAAC,SAAS,MAAM,CAAC;AAEpB,QAAM,gBAAe,iCAAQ,WAAU;AACvC,QAAM,SAASE,WAAAA;AAAAA,IACb,MACE,aAAa,IAAI,CAAC,WAAW;AAAA,MAC3B,GAAG;AAAA,MACH,OAAOE,cAAAA,oBAAoB;AAAA,QACzB,cAAc,MAAM;AAAA,QACpB,QAAQ,MAAM;AAAA,QACd,YAAY,MAAM;AAAA,QAClB;AAAA,MAAA,CACD;AAAA,IAAA,EACD;AAAA,IACJ,CAAC,cAAc,GAAG;AAAA,EAAA;AAGpB,QAAM,aAAaC,uBAAY,MAAA;;AAAM,4BAAU,YAAV,mBAAmB,iBAAgB,QAAQ,QAAA;AAAA,KAAW,EAAE;AAE7F,SAAO;AAAA,IACL,QAAQ,SAAS,OAAO,SAAS,UAAU,eAAe;AAAA,IAC1D,QAAO,iCAAQ,UAAS;AAAA,IACxB,aAAY,iCAAQ,eAAc;AAAA,IAClC;AAAA,IACA,SAAQ,iCAAQ,WAAU;AAAA,IAC1B;AAAA,EAAA;AAEJ;AAaO,SAAS,6BACd,aAC2B;AAC3B,QAAM,SAAST,cAAAA,gBAAA;AACf,SAAOS,WAAAA;AAAAA,IACL,CAAC,SAAS,WAAW;AACnB,UAAI,gBAAgB,MAAM;AACxB,eAAO,QAAQ;AAAA,UACb,IAAI,MAAM,iEAAiE;AAAA,QAAA;AAAA,MAE/E;AACA,aAAOC,sCAAyB;AAAA,QAC9B,MAAM;AAAA,UACJ,YAAY,OAAO;AAAA,UACnB,QAAQ,OAAO;AAAA,UACf,OAAO,OAAO;AAAA,UACd,UAAU,OAAO;AAAA,QAAA;AAAA,QAEnB;AAAA,QACA;AAAA,QACA;AAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,CAAC,aAAa,MAAM;AAAA,EAAA;AAExB;;;;"}
|
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":";;;;;;;AAsBA,MAAM,gBAAgBA,WAAAA,cAA6C,IAAI;AAgBhE,SAAS,wBAAyC;AACvD,SAAOC,QAAAA,YAAkC,OAAO,EAAE,aAAa,CAAA,GAAI,aAAa,OAAO,QAAQ,KAAA,EAAO;AACxG;AASO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AACF,GAGG;AACD,QAAM,QAAQC,WAAAA,WAAW,aAAa;AACtC,MAAI,MAAO,QAAOC,2BAAAA,IAAC,yBAAA,EAAwB,OAAe,UAAS;AACnE,MAAI,MAAO,QAAOA,2BAAAA,IAAAC,WAAAA,UAAA,EAAG,SAAA,CAAS;AAC9B,SAAOD,+BAAC,yBAAuB,UAAS;AAC1C;AAEA,SAAS,sBAAsB,EAAE,YAAqC;AACpE,QAAM,CAAC,KAAK,IAAIE,WAAAA,SAAS,qBAAqB;AAI9CC,uBAAU,MAAM,MAAM,eAAe,MAAM,SAAA,EAAW,WAAW,GAAG,CAAC,KAAK,CAAC;AAC3E,SAAOH,2BAAAA,IAAC,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,cAAcI,QAAAA,SAAS,OAAO,CAAC,UAAU,MAAM,WAAW;AAChE,QAAM,cAAcA,QAAAA,SAAS,OAAO,CAAC,UAAU,MAAM,WAAW;AAChE,QAAM,SAASA,QAAAA,SAAS,OAAO,CAAC,UAAU,MAAM,UAAU,IAAI;AAC9D,QAAM,UAAUC,WAAAA;AAAAA,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,QAAQA,WAAAA;AAAAA,IACZ,OAAO,EAAE,aAAa,aAAa,QAAQ,GAAG,QAAA;AAAA,IAC9C,CAAC,aAAa,aAAa,QAAQ,OAAO;AAAA,EAAA;AAG5C,SACEL,2BAAAA,IAAC,cAAc,UAAd,EAAuB,OACrB,SAAA,CACH;AAEJ;AAEO,SAAS,iBAAyC;AACvD,QAAM,MAAMD,WAAAA,WAAW,aAAa;AACpC,MAAI,CAAC,KAAK;AACR,UAAM,IAAI,MAAM,qEAAqE;AAAA,EACvF;AACA,SAAO;AACT;AAYO,SAAS,kCAAkC;AAAA,EAChD;AAAA,EACA,SAASO,WAAAA;AACX,GAGW;AACT,MAAI,YAAY,WAAW,EAAG,QAAO;AACrC,SAAO,YACJ,IAAI,CAAC,eAAe,KAAK,WAAW,KAAK,KAAKC,WAAAA,sBAAsB,EAAE,QAAQ,UAAU,WAAW,GAAA,CAAI,CAAC,GAAG,EAC3G,KAAK,IAAI;AACd;;;;;"}
|
|
@@ -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;
|