@athenaintel/react 0.28.1 → 0.32.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 +479 -10
- package/dist/agent-runtime/src/asset-attachment.cjs.map +1 -0
- package/dist/agent-runtime/src/asset-attachment.js.map +1 -0
- package/dist/agent-runtime/src/athena-asset-drag.cjs +44 -0
- package/dist/agent-runtime/src/athena-asset-drag.cjs.map +1 -0
- package/dist/agent-runtime/src/athena-asset-drag.js +44 -0
- package/dist/agent-runtime/src/athena-asset-drag.js.map +1 -0
- package/dist/agent-runtime/src/auth-denial.cjs.map +1 -0
- package/dist/agent-runtime/src/auth-denial.js.map +1 -0
- package/dist/agent-runtime/src/client-tool-bridge.cjs.map +1 -0
- package/dist/agent-runtime/src/client-tool-bridge.js.map +1 -0
- package/dist/agent-runtime/src/client-tools.cjs.map +1 -0
- package/dist/agent-runtime/src/client-tools.js.map +1 -0
- package/dist/agent-runtime/src/composer-markdown.cjs +124 -0
- package/dist/agent-runtime/src/composer-markdown.cjs.map +1 -0
- package/dist/agent-runtime/src/composer-markdown.js +124 -0
- package/dist/agent-runtime/src/composer-markdown.js.map +1 -0
- package/dist/agent-runtime/src/config-mutations.cjs +59 -0
- package/dist/agent-runtime/src/config-mutations.cjs.map +1 -0
- package/dist/agent-runtime/src/config-mutations.js +59 -0
- package/dist/agent-runtime/src/config-mutations.js.map +1 -0
- package/dist/agent-runtime/src/conversation-index.cjs.map +1 -0
- package/dist/agent-runtime/src/conversation-index.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/conversation-list.cjs +36 -0
- package/dist/agent-runtime/src/conversation-list.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/conversation-list.js +36 -0
- package/dist/agent-runtime/src/conversation-list.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/deep-agent-transport-recipe.cjs +5 -3
- package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/deep-agent-transport-recipe.js +6 -4
- package/dist/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -0
- package/dist/agent-runtime/src/edit-command.cjs.map +1 -0
- package/dist/agent-runtime/src/edit-command.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/errors.cjs +23 -0
- package/dist/agent-runtime/src/errors.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/errors.js +23 -0
- package/dist/agent-runtime/src/errors.js.map +1 -0
- package/dist/agent-runtime/src/execute-output.cjs +41 -0
- package/dist/agent-runtime/src/execute-output.cjs.map +1 -0
- package/dist/agent-runtime/src/execute-output.js +41 -0
- package/dist/agent-runtime/src/execute-output.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/generated/runconfig-contract.cjs +16 -2
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/generated/runconfig-contract.js +16 -2
- package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -0
- package/dist/agent-runtime/src/github-wake-event.cjs.map +1 -0
- package/dist/agent-runtime/src/github-wake-event.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/interrupts.cjs +24 -1
- package/dist/agent-runtime/src/interrupts.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/interrupts.js +24 -1
- package/dist/agent-runtime/src/interrupts.js.map +1 -0
- package/dist/agent-runtime/src/message-author.cjs.map +1 -0
- package/dist/agent-runtime/src/message-author.js.map +1 -0
- package/dist/agent-runtime/src/message-window.cjs.map +1 -0
- package/dist/agent-runtime/src/message-window.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/messages.cjs +8 -4
- package/dist/agent-runtime/src/messages.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/messages.js +6 -2
- package/dist/agent-runtime/src/messages.js.map +1 -0
- package/dist/agent-runtime/src/model-context.cjs.map +1 -0
- package/dist/agent-runtime/src/model-context.js.map +1 -0
- package/dist/agent-runtime/src/optimistic-content.cjs.map +1 -0
- package/dist/agent-runtime/src/optimistic-content.js.map +1 -0
- package/dist/agent-runtime/src/protocol.cjs.map +1 -0
- package/dist/agent-runtime/src/protocol.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/queue.cjs +23 -2
- package/dist/agent-runtime/src/queue.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/queue.js +23 -2
- package/dist/agent-runtime/src/queue.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/quota-safe-local-storage-session.cjs +71 -13
- package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/quota-safe-local-storage-session.js +73 -15
- package/dist/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -0
- package/dist/agent-runtime/src/runtime-messages.cjs.map +1 -0
- package/dist/agent-runtime/src/runtime-messages.js.map +1 -0
- package/dist/agent-runtime/src/screen-point.cjs.map +1 -0
- package/dist/agent-runtime/src/screen-point.js.map +1 -0
- package/dist/agent-runtime/src/send-recovery.cjs.map +1 -0
- package/dist/agent-runtime/src/send-recovery.js.map +1 -0
- package/dist/agent-runtime/src/statewire-attach-observer.cjs.map +1 -0
- package/dist/agent-runtime/src/statewire-attach-observer.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/statewire-state.cjs +8 -0
- package/dist/agent-runtime/src/statewire-state.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/statewire-state.js +8 -0
- package/dist/agent-runtime/src/statewire-state.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/statewire-suspended.cjs +4 -0
- package/dist/agent-runtime/src/statewire-suspended.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/statewire-suspended.js +4 -0
- package/dist/agent-runtime/src/statewire-suspended.js.map +1 -0
- package/dist/agent-runtime/src/statewire-transport.cjs +43 -0
- package/dist/agent-runtime/src/statewire-transport.cjs.map +1 -0
- package/dist/agent-runtime/src/statewire-transport.js +43 -0
- package/dist/agent-runtime/src/statewire-transport.js.map +1 -0
- package/dist/agent-runtime/src/streaming-markdown.cjs.map +1 -0
- package/dist/agent-runtime/src/streaming-markdown.js.map +1 -0
- package/dist/agent-runtime/src/subscription-wake-event.cjs +252 -0
- package/dist/agent-runtime/src/subscription-wake-event.cjs.map +1 -0
- package/dist/agent-runtime/src/subscription-wake-event.js +252 -0
- package/dist/agent-runtime/src/subscription-wake-event.js.map +1 -0
- package/dist/agent-runtime/src/thread-extras.cjs.map +1 -0
- package/dist/agent-runtime/src/thread-extras.js.map +1 -0
- package/dist/agent-runtime/src/thread-snapshot-cache.cjs.map +1 -0
- package/dist/agent-runtime/src/thread-snapshot-cache.js.map +1 -0
- package/dist/agent-runtime/src/thread-status.cjs.map +1 -0
- package/dist/agent-runtime/src/thread-status.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/tool-metadata.cjs +304 -9
- package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/tool-metadata.js +304 -9
- package/dist/agent-runtime/src/tool-metadata.js.map +1 -0
- package/dist/agent-runtime/src/tool-names.cjs +5 -0
- package/dist/agent-runtime/src/tool-names.cjs.map +1 -0
- package/dist/agent-runtime/src/tool-names.js +5 -0
- package/dist/agent-runtime/src/tool-names.js.map +1 -0
- package/dist/agent-runtime/src/tool-outputs.cjs.map +1 -0
- package/dist/agent-runtime/src/tool-outputs.js.map +1 -0
- package/dist/agent-runtime/src/tool-result.cjs.map +1 -0
- package/dist/agent-runtime/src/tool-result.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/use-conversation-list.cjs +33 -22
- package/dist/agent-runtime/src/use-conversation-list.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/use-conversation-list.js +34 -23
- package/dist/agent-runtime/src/use-conversation-list.js.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-config.cjs +129 -0
- package/dist/agent-runtime/src/use-deep-agent-config.cjs.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-config.js +129 -0
- package/dist/agent-runtime/src/use-deep-agent-config.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/use-deep-agent-edit-submit.cjs +2 -0
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/use-deep-agent-edit-submit.js +2 -0
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.js.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/use-deep-agent-thread.cjs +1 -0
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/use-deep-agent-thread.js +2 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-window-sync.js.map +1 -0
- package/dist/agent-runtime/src/use-historical-edit-attachments.cjs +52 -0
- package/dist/agent-runtime/src/use-historical-edit-attachments.cjs.map +1 -0
- package/dist/agent-runtime/src/use-historical-edit-attachments.js +52 -0
- package/dist/agent-runtime/src/use-historical-edit-attachments.js.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/voice-presentation.cjs +14 -0
- package/dist/agent-runtime/src/voice-presentation.cjs.map +1 -0
- package/dist/{packages/agent-runtime → agent-runtime}/src/voice-presentation.js +14 -0
- package/dist/agent-runtime/src/voice-presentation.js.map +1 -0
- package/dist/agent-runtime/src/voice-turn-grouping.cjs.map +1 -0
- package/dist/agent-runtime/src/voice-turn-grouping.js.map +1 -0
- package/dist/assets/AthenaAssetEmbed.cjs +13 -2
- package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
- package/dist/assets/AthenaAssetEmbed.d.ts +10 -0
- package/dist/assets/AthenaAssetEmbed.js +14 -3
- package/dist/assets/AthenaAssetEmbed.js.map +1 -1
- package/dist/assets/AthenaLayout.cjs +97 -31
- package/dist/assets/AthenaLayout.cjs.map +1 -1
- package/dist/assets/AthenaLayout.d.ts +13 -0
- package/dist/assets/AthenaLayout.js +98 -32
- package/dist/assets/AthenaLayout.js.map +1 -1
- package/dist/assets/asset-embed-messages.cjs +6 -0
- package/dist/assets/asset-embed-messages.cjs.map +1 -1
- package/dist/assets/asset-embed-messages.d.ts +13 -0
- package/dist/assets/asset-embed-messages.js +6 -0
- package/dist/assets/asset-embed-messages.js.map +1 -1
- package/dist/assets/asset-panel-store.cjs +68 -32
- package/dist/assets/asset-panel-store.cjs.map +1 -1
- package/dist/assets/asset-panel-store.d.ts +47 -1
- package/dist/assets/asset-panel-store.js +68 -32
- package/dist/assets/asset-panel-store.js.map +1 -1
- package/dist/assets/use-asset-embed.cjs +29 -8
- package/dist/assets/use-asset-embed.cjs.map +1 -1
- package/dist/assets/use-asset-embed.d.ts +7 -0
- package/dist/assets/use-asset-embed.js +29 -8
- package/dist/assets/use-asset-embed.js.map +1 -1
- package/dist/catalog/chat-pickers.cjs +152 -0
- package/dist/catalog/chat-pickers.cjs.map +1 -0
- package/dist/catalog/chat-pickers.d.ts +22 -0
- package/dist/catalog/chat-pickers.js +152 -0
- package/dist/catalog/chat-pickers.js.map +1 -0
- package/dist/catalog/runtime-catalog.cjs +181 -0
- package/dist/catalog/runtime-catalog.cjs.map +1 -0
- package/dist/catalog/runtime-catalog.d.ts +100 -0
- package/dist/catalog/runtime-catalog.js +181 -0
- package/dist/catalog/runtime-catalog.js.map +1 -0
- package/dist/chat/AthenaChat.cjs +122 -67
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +21 -4
- package/dist/chat/AthenaChat.js +124 -69
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/chat/StatewireApprovalCard.cjs +38 -37
- package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
- package/dist/chat/StatewireApprovalCard.d.ts +2 -0
- package/dist/chat/StatewireApprovalCard.js +39 -38
- package/dist/chat/StatewireApprovalCard.js.map +1 -1
- package/dist/chat/StatewireClientToolBridge.cjs +2 -2
- package/dist/chat/StatewireClientToolBridge.js +2 -2
- package/dist/chat/StatewireQueuedMessages.cjs +15 -12
- package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.d.ts +22 -2
- package/dist/chat/StatewireQueuedMessages.js +15 -12
- package/dist/chat/StatewireQueuedMessages.js.map +1 -1
- package/dist/chat/StatewireRunRefusalNotice.cjs +48 -0
- package/dist/chat/StatewireRunRefusalNotice.cjs.map +1 -0
- package/dist/chat/StatewireRunRefusalNotice.d.ts +25 -0
- package/dist/chat/StatewireRunRefusalNotice.js +48 -0
- package/dist/chat/StatewireRunRefusalNotice.js.map +1 -0
- package/dist/chat/WaitingOnYouBanner.cjs +2 -2
- package/dist/chat/WaitingOnYouBanner.js +2 -2
- package/dist/chat/athena-citation-links.cjs +19 -15
- package/dist/chat/athena-citation-links.cjs.map +1 -1
- package/dist/chat/athena-citation-links.js +19 -15
- package/dist/chat/athena-citation-links.js.map +1 -1
- package/dist/chat/run-activity.cjs +9 -1
- package/dist/chat/run-activity.cjs.map +1 -1
- package/dist/chat/run-activity.d.ts +6 -0
- package/dist/chat/run-activity.js +10 -2
- package/dist/chat/run-activity.js.map +1 -1
- package/dist/chat/statewire-banners.cjs +30 -1
- package/dist/chat/statewire-banners.cjs.map +1 -1
- package/dist/chat/statewire-banners.d.ts +20 -1
- package/dist/chat/statewire-banners.js +32 -3
- package/dist/chat/statewire-banners.js.map +1 -1
- package/dist/chat/statewire-client-tools.cjs +1 -1
- package/dist/chat/statewire-client-tools.js +1 -1
- package/dist/chat/super-grouping/CollapsibleGroup.cjs +1 -1
- package/dist/chat/super-grouping/CollapsibleGroup.cjs.map +1 -1
- package/dist/chat/super-grouping/CollapsibleGroup.js +1 -1
- package/dist/chat/super-grouping/CollapsibleGroup.js.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.cjs +38 -16
- package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.d.ts +21 -4
- package/dist/chat/super-grouping/SuperGroupingCard.js +39 -17
- package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +377 -0
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -0
- package/dist/chat/super-grouping/SuperGroupingTranscript.d.ts +31 -0
- package/dist/chat/super-grouping/SuperGroupingTranscript.js +377 -0
- package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -0
- package/dist/chat/super-grouping/ToolTimeline.cjs +13 -2
- package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -1
- package/dist/chat/super-grouping/ToolTimeline.d.ts +10 -3
- package/dist/chat/super-grouping/ToolTimeline.js +13 -2
- package/dist/chat/super-grouping/ToolTimeline.js.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.cjs +69 -29
- package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.d.ts +60 -9
- package/dist/chat/super-grouping/activity-timeline.js +70 -30
- package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
- package/dist/chat/super-grouping/index.cjs +14 -0
- package/dist/chat/super-grouping/index.cjs.map +1 -1
- package/dist/chat/super-grouping/index.d.ts +7 -2
- package/dist/chat/super-grouping/index.js +16 -2
- package/dist/chat/super-grouping/index.js.map +1 -1
- package/dist/chat/super-grouping/timeline-step.cjs +14 -5
- package/dist/chat/super-grouping/timeline-step.cjs.map +1 -1
- package/dist/chat/super-grouping/timeline-step.d.ts +10 -1
- package/dist/chat/super-grouping/timeline-step.js +15 -6
- package/dist/chat/super-grouping/timeline-step.js.map +1 -1
- package/dist/chat/super-grouping/toolkit-map.cjs +1 -0
- package/dist/chat/super-grouping/toolkit-map.cjs.map +1 -1
- package/dist/chat/super-grouping/toolkit-map.js +1 -0
- package/dist/chat/super-grouping/toolkit-map.js.map +1 -1
- package/dist/chat/super-grouping/turn-segments.cjs +82 -0
- package/dist/chat/super-grouping/turn-segments.cjs.map +1 -0
- package/dist/chat/super-grouping/turn-segments.d.ts +69 -0
- package/dist/chat/super-grouping/turn-segments.js +82 -0
- package/dist/chat/super-grouping/turn-segments.js.map +1 -0
- package/dist/chat/super-grouping/turn-timing.cjs +110 -0
- package/dist/chat/super-grouping/turn-timing.cjs.map +1 -0
- package/dist/chat/super-grouping/turn-timing.d.ts +52 -0
- package/dist/chat/super-grouping/turn-timing.js +110 -0
- package/dist/chat/super-grouping/turn-timing.js.map +1 -0
- package/dist/chat/tiptap-text.cjs +1 -1
- package/dist/chat/tiptap-text.js +1 -1
- package/dist/chat/use-athena-run-live.cjs +1 -1
- package/dist/chat/use-athena-run-live.js +1 -1
- package/dist/chat/use-statewire-approval-request.cjs +73 -4
- package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
- package/dist/chat/use-statewire-approval-request.js +74 -5
- package/dist/chat/use-statewire-approval-request.js.map +1 -1
- package/dist/chat-ui/composer/composer-message.cjs +284 -0
- package/dist/chat-ui/composer/composer-message.cjs.map +1 -0
- package/dist/chat-ui/composer/composer-message.d.ts +152 -0
- package/dist/chat-ui/composer/composer-message.js +284 -0
- package/dist/chat-ui/composer/composer-message.js.map +1 -0
- package/dist/chat-ui/composer/tiptap-composer.cjs +97 -15
- package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.d.ts +34 -6
- package/dist/chat-ui/composer/tiptap-composer.js +97 -15
- package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
- package/dist/chat-ui/index.cjs +4 -1
- package/dist/chat-ui/index.cjs.map +1 -1
- package/dist/chat-ui/index.d.ts +3 -2
- package/dist/chat-ui/index.js +5 -2
- package/dist/chat-ui/index.js.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.cjs +31 -3
- package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.d.ts +2 -5
- package/dist/chat-ui/mentions/mention-chip.js +33 -5
- package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
- package/dist/chat-ui/mentions/mention-extension.cjs +9 -3
- package/dist/chat-ui/mentions/mention-extension.cjs.map +1 -1
- package/dist/chat-ui/mentions/mention-extension.js +9 -3
- package/dist/chat-ui/mentions/mention-extension.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs +3 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.js +3 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +65 -19
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +15 -0
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js +67 -21
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs +4 -2
- 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 +2 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js +5 -3
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js.map +1 -1
- package/dist/chat-ui/mentions/use-account-workspace-id.cjs +61 -0
- package/dist/chat-ui/mentions/use-account-workspace-id.cjs.map +1 -0
- package/dist/chat-ui/mentions/use-account-workspace-id.d.ts +3 -0
- package/dist/chat-ui/mentions/use-account-workspace-id.js +61 -0
- package/dist/chat-ui/mentions/use-account-workspace-id.js.map +1 -0
- package/dist/chat-ui/mentions/use-member-avatar.cjs +75 -0
- package/dist/chat-ui/mentions/use-member-avatar.cjs.map +1 -0
- package/dist/chat-ui/mentions/use-member-avatar.d.ts +2 -0
- package/dist/chat-ui/mentions/use-member-avatar.js +75 -0
- package/dist/chat-ui/mentions/use-member-avatar.js.map +1 -0
- package/dist/chat-ui/messages/message-components.cjs +30 -10
- package/dist/chat-ui/messages/message-components.cjs.map +1 -1
- package/dist/chat-ui/messages/message-components.d.ts +21 -1
- package/dist/chat-ui/messages/message-components.js +30 -10
- package/dist/chat-ui/messages/message-components.js.map +1 -1
- package/dist/chat-ui/messages/runtime-message.cjs +1 -1
- package/dist/chat-ui/messages/runtime-message.js +1 -1
- package/dist/chat-ui/messages/statewire-continue-run.cjs +5 -5
- package/dist/chat-ui/messages/statewire-continue-run.js +5 -5
- package/dist/chat-ui/messages/user-edit-composer.cjs +1 -1
- package/dist/chat-ui/messages/user-edit-composer.js +1 -1
- package/dist/chat-ui/messages/wake-marker.cjs +39 -4
- package/dist/chat-ui/messages/wake-marker.cjs.map +1 -1
- package/dist/chat-ui/messages/wake-marker.d.ts +16 -5
- package/dist/chat-ui/messages/wake-marker.js +40 -5
- package/dist/chat-ui/messages/wake-marker.js.map +1 -1
- package/dist/chat-ui/rich-text/chat-message-body.cjs +12 -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 +6 -1
- package/dist/chat-ui/rich-text/chat-message-body.js +13 -9
- package/dist/chat-ui/rich-text/chat-message-body.js.map +1 -1
- package/dist/chat-ui/rich-text/chat-text-schema.cjs +64 -6
- package/dist/chat-ui/rich-text/chat-text-schema.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-text-schema.d.ts +5 -0
- package/dist/chat-ui/rich-text/chat-text-schema.js +66 -8
- package/dist/chat-ui/rich-text/chat-text-schema.js.map +1 -1
- package/dist/chat-ui/statewire.cjs +1 -1
- package/dist/chat-ui/statewire.d.ts +1 -1
- package/dist/chat-ui/statewire.js +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.cjs +2 -2
- package/dist/chat-ui/thread/statewire-history-edge.js +2 -2
- package/dist/collab/client.cjs +282 -16
- package/dist/collab/client.cjs.map +1 -1
- package/dist/collab/client.d.ts +127 -2
- package/dist/collab/client.js +285 -20
- package/dist/collab/client.js.map +1 -1
- package/dist/collab/index.cjs +2 -0
- package/dist/collab/index.cjs.map +1 -1
- package/dist/collab/index.d.ts +1 -1
- package/dist/collab/index.js +3 -1
- package/dist/composer/AttachmentContext.cjs +38 -12
- package/dist/composer/AttachmentContext.cjs.map +1 -1
- package/dist/composer/AttachmentContext.d.ts +22 -1
- package/dist/composer/AttachmentContext.js +40 -14
- package/dist/composer/AttachmentContext.js.map +1 -1
- package/dist/composer/QuoteContext.cjs +80 -28
- package/dist/composer/QuoteContext.cjs.map +1 -1
- package/dist/composer/QuoteContext.d.ts +35 -6
- package/dist/composer/QuoteContext.js +82 -30
- package/dist/composer/QuoteContext.js.map +1 -1
- package/dist/composer/build-composed-message.cjs +27 -0
- package/dist/composer/build-composed-message.cjs.map +1 -1
- package/dist/composer/build-composed-message.d.ts +21 -0
- package/dist/composer/build-composed-message.js +28 -1
- package/dist/composer/build-composed-message.js.map +1 -1
- package/dist/composer/composer-handoff.cjs +13 -1
- package/dist/composer/composer-handoff.cjs.map +1 -1
- package/dist/composer/composer-handoff.d.ts +12 -0
- package/dist/composer/composer-handoff.js +15 -3
- package/dist/composer/composer-handoff.js.map +1 -1
- package/dist/composer/index.d.ts +6 -3
- package/dist/composer/useReadComposerDraft.cjs +16 -0
- package/dist/composer/useReadComposerDraft.cjs.map +1 -0
- package/dist/composer/useReadComposerDraft.d.ts +6 -0
- package/dist/composer/useReadComposerDraft.js +16 -0
- package/dist/composer/useReadComposerDraft.js.map +1 -0
- package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
- package/dist/diagnostics/athena-diagnostics.d.ts +3 -1
- package/dist/diagnostics/athena-diagnostics.js.map +1 -1
- package/dist/diagnostics/errors.cjs +6 -0
- package/dist/diagnostics/errors.cjs.map +1 -1
- package/dist/diagnostics/errors.d.ts +6 -0
- package/dist/diagnostics/errors.js +6 -0
- package/dist/diagnostics/errors.js.map +1 -1
- package/dist/index.cjs +163 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +55 -12
- package/dist/index.js +170 -14
- package/dist/index.js.map +1 -1
- package/dist/lib/owner-document.cjs +32 -0
- package/dist/lib/owner-document.cjs.map +1 -0
- package/dist/lib/owner-document.d.ts +17 -0
- package/dist/lib/owner-document.js +32 -0
- package/dist/lib/owner-document.js.map +1 -0
- package/dist/lib/portal-surface.cjs +55 -0
- package/dist/lib/portal-surface.cjs.map +1 -0
- package/dist/lib/portal-surface.d.ts +37 -0
- package/dist/lib/portal-surface.js +55 -0
- package/dist/lib/portal-surface.js.map +1 -0
- package/dist/lib/use-athena-rest-query.cjs +34 -0
- package/dist/lib/use-athena-rest-query.cjs.map +1 -0
- package/dist/lib/use-athena-rest-query.d.ts +31 -0
- package/dist/lib/use-athena-rest-query.js +34 -0
- package/dist/lib/use-athena-rest-query.js.map +1 -0
- package/dist/provider/AthenaProvider.cjs +70 -10
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +27 -2
- package/dist/provider/AthenaProvider.js +74 -14
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/provider/citation-links.d.ts +10 -2
- package/dist/{packages/react → react}/package.json.cjs +1 -1
- package/dist/{packages/react → react}/package.json.js +1 -1
- package/dist/runtime/StatewireModelLaneSync.cjs +96 -0
- package/dist/runtime/StatewireModelLaneSync.cjs.map +1 -0
- package/dist/runtime/StatewireModelLaneSync.d.ts +45 -0
- package/dist/runtime/StatewireModelLaneSync.js +96 -0
- package/dist/runtime/StatewireModelLaneSync.js.map +1 -0
- package/dist/runtime/statewire-lifecycle.cjs +20 -5
- package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
- package/dist/runtime/statewire-lifecycle.d.ts +11 -0
- package/dist/runtime/statewire-lifecycle.js +20 -5
- package/dist/runtime/statewire-lifecycle.js.map +1 -1
- package/dist/runtime/statewire-model-lane.cjs +28 -0
- package/dist/runtime/statewire-model-lane.cjs.map +1 -0
- package/dist/runtime/statewire-model-lane.d.ts +64 -0
- package/dist/runtime/statewire-model-lane.js +28 -0
- package/dist/runtime/statewire-model-lane.js.map +1 -0
- package/dist/runtime/statewire-run-config.cjs +16 -2
- package/dist/runtime/statewire-run-config.cjs.map +1 -1
- package/dist/runtime/statewire-run-config.d.ts +10 -0
- package/dist/runtime/statewire-run-config.js +16 -2
- package/dist/runtime/statewire-run-config.js.map +1 -1
- package/dist/runtime/statewire-server-lane-context.cjs +24 -0
- package/dist/runtime/statewire-server-lane-context.cjs.map +1 -0
- package/dist/runtime/statewire-server-lane-context.d.ts +30 -0
- package/dist/runtime/statewire-server-lane-context.js +24 -0
- package/dist/runtime/statewire-server-lane-context.js.map +1 -0
- package/dist/runtime/useAthenaStatewireRuntime.cjs +47 -23
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +8 -1
- package/dist/runtime/useAthenaStatewireRuntime.js +48 -24
- package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
- package/dist/search/useAthenaRepoSearch.cjs +5 -13
- package/dist/search/useAthenaRepoSearch.cjs.map +1 -1
- package/dist/search/useAthenaRepoSearch.d.ts +3 -3
- package/dist/search/useAthenaRepoSearch.js +6 -14
- package/dist/search/useAthenaRepoSearch.js.map +1 -1
- package/dist/sheet-range/a1.cjs +162 -0
- package/dist/sheet-range/a1.cjs.map +1 -0
- package/dist/sheet-range/a1.d.ts +91 -0
- package/dist/sheet-range/a1.js +162 -0
- package/dist/sheet-range/a1.js.map +1 -0
- package/dist/sheet-range/index.cjs +22 -0
- package/dist/sheet-range/index.cjs.map +1 -0
- package/dist/sheet-range/index.d.ts +12 -0
- package/dist/sheet-range/index.js +22 -0
- package/dist/sheet-range/index.js.map +1 -0
- package/dist/sheet-range/range-preview-table.cjs +75 -0
- package/dist/sheet-range/range-preview-table.cjs.map +1 -0
- package/dist/sheet-range/range-preview-table.d.ts +20 -0
- package/dist/sheet-range/range-preview-table.js +75 -0
- package/dist/sheet-range/range-preview-table.js.map +1 -0
- package/dist/sheet-range/range-preview.cjs +116 -0
- package/dist/sheet-range/range-preview.cjs.map +1 -0
- package/dist/sheet-range/range-preview.d.ts +67 -0
- package/dist/sheet-range/range-preview.js +116 -0
- package/dist/sheet-range/range-preview.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/threads/Inbox.cjs +289 -0
- package/dist/threads/Inbox.cjs.map +1 -0
- package/dist/threads/Inbox.d.ts +46 -0
- package/dist/threads/Inbox.js +289 -0
- package/dist/threads/Inbox.js.map +1 -0
- package/dist/threads/SessionList.cjs +51 -126
- package/dist/threads/SessionList.cjs.map +1 -1
- package/dist/threads/SessionList.d.ts +26 -1
- package/dist/threads/SessionList.js +45 -120
- package/dist/threads/SessionList.js.map +1 -1
- package/dist/threads/SessionsPage.cjs +753 -0
- package/dist/threads/SessionsPage.cjs.map +1 -0
- package/dist/threads/SessionsPage.d.ts +35 -0
- package/dist/threads/SessionsPage.js +753 -0
- package/dist/threads/SessionsPage.js.map +1 -0
- package/dist/threads/api.cjs +23 -2
- package/dist/threads/api.cjs.map +1 -1
- package/dist/threads/api.d.ts +60 -0
- package/dist/threads/api.js +23 -2
- package/dist/threads/api.js.map +1 -1
- package/dist/threads/conversation-list-fetcher.cjs +9 -2
- package/dist/threads/conversation-list-fetcher.cjs.map +1 -1
- package/dist/threads/conversation-list-fetcher.d.ts +14 -1
- package/dist/threads/conversation-list-fetcher.js +9 -2
- package/dist/threads/conversation-list-fetcher.js.map +1 -1
- package/dist/threads/index.d.ts +2 -1
- package/dist/threads/pull-request-display.cjs +25 -0
- package/dist/threads/pull-request-display.cjs.map +1 -0
- package/dist/threads/pull-request-display.d.ts +15 -0
- package/dist/threads/pull-request-display.js +25 -0
- package/dist/threads/pull-request-display.js.map +1 -0
- package/dist/threads/session-list-model.cjs +16 -2
- package/dist/threads/session-list-model.cjs.map +1 -1
- package/dist/threads/session-list-model.d.ts +10 -0
- package/dist/threads/session-list-model.js +16 -2
- package/dist/threads/session-list-model.js.map +1 -1
- package/dist/threads/session-row-parts.cjs +152 -0
- package/dist/threads/session-row-parts.cjs.map +1 -0
- package/dist/threads/session-row-parts.d.ts +50 -0
- package/dist/threads/session-row-parts.js +152 -0
- package/dist/threads/session-row-parts.js.map +1 -0
- package/dist/threads/sessions-page-model.cjs +305 -0
- package/dist/threads/sessions-page-model.cjs.map +1 -0
- package/dist/threads/sessions-page-model.d.ts +86 -0
- package/dist/threads/sessions-page-model.js +305 -0
- package/dist/threads/sessions-page-model.js.map +1 -0
- package/dist/threads/sessions-page-storage.cjs +93 -0
- package/dist/threads/sessions-page-storage.cjs.map +1 -0
- package/dist/threads/sessions-page-storage.d.ts +23 -0
- package/dist/threads/sessions-page-storage.js +93 -0
- package/dist/threads/sessions-page-storage.js.map +1 -0
- package/dist/threads/sessions-query.cjs +235 -0
- package/dist/threads/sessions-query.cjs.map +1 -0
- package/dist/threads/sessions-query.d.ts +119 -0
- package/dist/threads/sessions-query.js +235 -0
- package/dist/threads/sessions-query.js.map +1 -0
- package/dist/threads/statewire-thread-list.cjs +133 -40
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.d.ts +83 -2
- package/dist/threads/statewire-thread-list.js +134 -41
- package/dist/threads/statewire-thread-list.js.map +1 -1
- package/dist/threads/use-athena-sessions.cjs +198 -0
- package/dist/threads/use-athena-sessions.cjs.map +1 -0
- package/dist/threads/use-athena-sessions.d.ts +81 -0
- package/dist/threads/use-athena-sessions.js +198 -0
- package/dist/threads/use-athena-sessions.js.map +1 -0
- package/dist/threads/use-athena-thread-model.cjs +14 -0
- package/dist/threads/use-athena-thread-model.cjs.map +1 -0
- package/dist/threads/use-athena-thread-model.d.ts +22 -0
- package/dist/threads/use-athena-thread-model.js +14 -0
- package/dist/threads/use-athena-thread-model.js.map +1 -0
- package/dist/threads/use-rest-conversation-history.cjs +1 -1
- package/dist/threads/use-rest-conversation-history.js +1 -1
- package/dist/threads/use-statewire-conversation-history.cjs +1 -1
- package/dist/threads/use-statewire-conversation-history.d.ts +3 -0
- package/dist/threads/use-statewire-conversation-history.js +1 -1
- package/dist/threads/use-thread-read-state.cjs +73 -0
- package/dist/threads/use-thread-read-state.cjs.map +1 -0
- package/dist/threads/use-thread-read-state.d.ts +51 -0
- package/dist/threads/use-thread-read-state.js +73 -0
- package/dist/threads/use-thread-read-state.js.map +1 -0
- package/dist/tiptap-markdown-table/src/markdown-table-serializer.cjs.map +1 -0
- package/dist/tiptap-markdown-table/src/markdown-table-serializer.js.map +1 -0
- package/dist/tools/auto-open-tools.cjs +2 -0
- package/dist/tools/auto-open-tools.cjs.map +1 -1
- package/dist/tools/auto-open-tools.js +2 -0
- package/dist/tools/auto-open-tools.js.map +1 -1
- package/dist/tools/file-tool-uis.cjs +18 -43
- package/dist/tools/file-tool-uis.cjs.map +1 -1
- package/dist/tools/file-tool-uis.d.ts +1 -2
- package/dist/tools/file-tool-uis.js +18 -42
- package/dist/tools/file-tool-uis.js.map +1 -1
- package/dist/tools/index.cjs +6 -2
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +6 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/misc-tool-uis.cjs +2 -2
- package/dist/tools/misc-tool-uis.js +2 -2
- package/dist/tools/primitives.cjs +1 -1
- package/dist/tools/primitives.js +1 -1
- package/dist/tools/read-asset-tool-ui.cjs +21 -70
- package/dist/tools/read-asset-tool-ui.cjs.map +1 -1
- package/dist/tools/read-asset-tool-ui.js +21 -70
- package/dist/tools/read-asset-tool-ui.js.map +1 -1
- package/dist/tools/step-text.cjs +21 -0
- package/dist/tools/step-text.cjs.map +1 -0
- package/dist/tools/step-text.d.ts +10 -0
- package/dist/tools/step-text.js +21 -0
- package/dist/tools/step-text.js.map +1 -0
- package/dist/tools/tool-fallback.cjs +24 -5
- package/dist/tools/tool-fallback.cjs.map +1 -1
- package/dist/tools/tool-fallback.d.ts +3 -1
- package/dist/tools/tool-fallback.js +24 -5
- package/dist/tools/tool-fallback.js.map +1 -1
- package/dist/tools/tool-summary.cjs +661 -0
- package/dist/tools/tool-summary.cjs.map +1 -0
- package/dist/tools/tool-summary.d.ts +99 -0
- package/dist/tools/tool-summary.js +661 -0
- package/dist/tools/tool-summary.js.map +1 -0
- package/dist/tools/tool-uis.cjs +37 -95
- package/dist/tools/tool-uis.cjs.map +1 -1
- package/dist/tools/tool-uis.js +37 -95
- package/dist/tools/tool-uis.js.map +1 -1
- package/dist/tools/voice-update-tool-ui.cjs +1 -1
- package/dist/tools/voice-update-tool-ui.js +1 -1
- package/dist/tools/write-todos-tool-ui.cjs +3 -2
- package/dist/tools/write-todos-tool-ui.cjs.map +1 -1
- package/dist/tools/write-todos-tool-ui.d.ts +5 -0
- package/dist/tools/write-todos-tool-ui.js +5 -4
- package/dist/tools/write-todos-tool-ui.js.map +1 -1
- package/dist/ui/popover.cjs +6 -6
- package/dist/ui/popover.cjs.map +1 -1
- package/dist/ui/popover.js +6 -6
- package/dist/ui/popover.js.map +1 -1
- package/dist/ui/tooltip.cjs +16 -2
- package/dist/ui/tooltip.cjs.map +1 -1
- package/dist/ui/tooltip.d.ts +1 -1
- package/dist/ui/tooltip.js +16 -2
- package/dist/ui/tooltip.js.map +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/dist/voice/use-athena-voice-session.cjs.map +1 -1
- package/dist/voice/use-athena-voice-session.d.ts +3 -3
- package/dist/voice/use-athena-voice-session.js.map +1 -1
- package/dist/workbench/SessionWorkbench.cjs +378 -0
- package/dist/workbench/SessionWorkbench.cjs.map +1 -0
- package/dist/workbench/SessionWorkbench.d.ts +30 -0
- package/dist/workbench/SessionWorkbench.js +378 -0
- package/dist/workbench/SessionWorkbench.js.map +1 -0
- package/dist/workbench/session-workbench-context.cjs +26 -0
- package/dist/workbench/session-workbench-context.cjs.map +1 -0
- package/dist/workbench/session-workbench-context.d.ts +55 -0
- package/dist/workbench/session-workbench-context.js +26 -0
- package/dist/workbench/session-workbench-context.js.map +1 -0
- package/dist/workbench/session-workbench-model.cjs +288 -0
- package/dist/workbench/session-workbench-model.cjs.map +1 -0
- package/dist/workbench/session-workbench-model.d.ts +168 -0
- package/dist/workbench/session-workbench-model.js +288 -0
- package/dist/workbench/session-workbench-model.js.map +1 -0
- package/dist/workbench/session-workbench-panes.cjs +580 -0
- package/dist/workbench/session-workbench-panes.cjs.map +1 -0
- package/dist/workbench/session-workbench-panes.d.ts +16 -0
- package/dist/workbench/session-workbench-panes.js +580 -0
- package/dist/workbench/session-workbench-panes.js.map +1 -0
- package/dist/workbench/session-workspace-api.cjs +157 -0
- package/dist/workbench/session-workspace-api.cjs.map +1 -0
- package/dist/workbench/session-workspace-api.d.ts +70 -0
- package/dist/workbench/session-workspace-api.js +157 -0
- package/dist/workbench/session-workspace-api.js.map +1 -0
- package/dist/workbench/use-session-workspace.cjs +100 -0
- package/dist/workbench/use-session-workspace.cjs.map +1 -0
- package/dist/workbench/use-session-workspace.d.ts +45 -0
- package/dist/workbench/use-session-workspace.js +100 -0
- package/dist/workbench/use-session-workspace.js.map +1 -0
- package/dist/workbench/workbench-layout-context.cjs +10 -0
- package/dist/workbench/workbench-layout-context.cjs.map +1 -0
- package/dist/workbench/workbench-layout-context.d.ts +17 -0
- package/dist/workbench/workbench-layout-context.js +10 -0
- package/dist/workbench/workbench-layout-context.js.map +1 -0
- package/package.json +21 -10
- package/dist/node_modules/@assistant-ui/react-langchain/dist/converter.cjs +0 -77
- package/dist/node_modules/@assistant-ui/react-langchain/dist/converter.cjs.map +0 -1
- package/dist/node_modules/@assistant-ui/react-langchain/dist/converter.js +0 -77
- package/dist/node_modules/@assistant-ui/react-langchain/dist/converter.js.map +0 -1
- package/dist/node_modules/@assistant-ui/react-langgraph/dist/convertLangChainMessages.cjs +0 -181
- package/dist/node_modules/@assistant-ui/react-langgraph/dist/convertLangChainMessages.cjs.map +0 -1
- package/dist/node_modules/@assistant-ui/react-langgraph/dist/convertLangChainMessages.js +0 -181
- package/dist/node_modules/@assistant-ui/react-langgraph/dist/convertLangChainMessages.js.map +0 -1
- package/dist/packages/agent-runtime/src/asset-attachment.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/asset-attachment.js.map +0 -1
- package/dist/packages/agent-runtime/src/auth-denial.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/auth-denial.js.map +0 -1
- package/dist/packages/agent-runtime/src/client-tool-bridge.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/client-tool-bridge.js.map +0 -1
- package/dist/packages/agent-runtime/src/client-tools.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/client-tools.js.map +0 -1
- package/dist/packages/agent-runtime/src/conversation-index.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/conversation-index.js.map +0 -1
- package/dist/packages/agent-runtime/src/conversation-list.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/conversation-list.js.map +0 -1
- package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.js.map +0 -1
- package/dist/packages/agent-runtime/src/edit-command.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/edit-command.js.map +0 -1
- package/dist/packages/agent-runtime/src/errors.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/errors.js.map +0 -1
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.js.map +0 -1
- package/dist/packages/agent-runtime/src/github-wake-event.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/github-wake-event.js.map +0 -1
- package/dist/packages/agent-runtime/src/interrupts.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/interrupts.js.map +0 -1
- package/dist/packages/agent-runtime/src/message-author.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/message-author.js.map +0 -1
- package/dist/packages/agent-runtime/src/message-window.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/message-window.js.map +0 -1
- package/dist/packages/agent-runtime/src/messages.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/messages.js.map +0 -1
- package/dist/packages/agent-runtime/src/model-context.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/model-context.js.map +0 -1
- package/dist/packages/agent-runtime/src/optimistic-content.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/optimistic-content.js.map +0 -1
- package/dist/packages/agent-runtime/src/protocol.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/protocol.js.map +0 -1
- package/dist/packages/agent-runtime/src/queue.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/queue.js.map +0 -1
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js.map +0 -1
- package/dist/packages/agent-runtime/src/runtime-messages.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/runtime-messages.js.map +0 -1
- package/dist/packages/agent-runtime/src/screen-point.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/screen-point.js.map +0 -1
- package/dist/packages/agent-runtime/src/send-recovery.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/send-recovery.js.map +0 -1
- package/dist/packages/agent-runtime/src/statewire-attach-observer.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/statewire-attach-observer.js.map +0 -1
- package/dist/packages/agent-runtime/src/statewire-state.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/statewire-state.js.map +0 -1
- package/dist/packages/agent-runtime/src/statewire-suspended.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/statewire-suspended.js.map +0 -1
- package/dist/packages/agent-runtime/src/statewire-transport.cjs +0 -11
- package/dist/packages/agent-runtime/src/statewire-transport.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/statewire-transport.js +0 -11
- package/dist/packages/agent-runtime/src/statewire-transport.js.map +0 -1
- package/dist/packages/agent-runtime/src/streaming-markdown.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/streaming-markdown.js.map +0 -1
- package/dist/packages/agent-runtime/src/thread-extras.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/thread-extras.js.map +0 -1
- package/dist/packages/agent-runtime/src/thread-snapshot-cache.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/thread-snapshot-cache.js.map +0 -1
- package/dist/packages/agent-runtime/src/thread-status.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/thread-status.js.map +0 -1
- package/dist/packages/agent-runtime/src/tool-metadata.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/tool-metadata.js.map +0 -1
- package/dist/packages/agent-runtime/src/tool-outputs.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/tool-outputs.js.map +0 -1
- package/dist/packages/agent-runtime/src/tool-result.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/tool-result.js.map +0 -1
- package/dist/packages/agent-runtime/src/use-conversation-list.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/use-conversation-list.js.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-config.cjs +0 -13
- package/dist/packages/agent-runtime/src/use-deep-agent-config.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-config.js +0 -13
- package/dist/packages/agent-runtime/src/use-deep-agent-config.js.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.js.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-runtime.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-runtime.js.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-thread.js.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.js.map +0 -1
- package/dist/packages/agent-runtime/src/voice-presentation.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/voice-presentation.js.map +0 -1
- package/dist/packages/agent-runtime/src/voice-turn-grouping.cjs.map +0 -1
- package/dist/packages/agent-runtime/src/voice-turn-grouping.js.map +0 -1
- package/dist/packages/tiptap-markdown-table/src/markdown-table-serializer.cjs.map +0 -1
- package/dist/packages/tiptap-markdown-table/src/markdown-table-serializer.js.map +0 -1
- /package/dist/{packages/agent-runtime → agent-runtime}/src/asset-attachment.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/asset-attachment.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/auth-denial.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/auth-denial.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/client-tool-bridge.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/client-tool-bridge.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/client-tools.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/client-tools.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/conversation-index.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/conversation-index.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/edit-command.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/edit-command.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/github-wake-event.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/github-wake-event.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/message-author.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/message-author.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/message-window.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/message-window.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/model-context.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/model-context.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/optimistic-content.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/optimistic-content.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/protocol.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/protocol.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/runtime-messages.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/runtime-messages.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/screen-point.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/screen-point.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/send-recovery.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/send-recovery.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/statewire-attach-observer.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/statewire-attach-observer.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/streaming-markdown.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/streaming-markdown.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/thread-extras.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/thread-extras.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/thread-snapshot-cache.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/thread-snapshot-cache.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/thread-status.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/thread-status.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/tool-outputs.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/tool-outputs.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/tool-result.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/tool-result.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/use-deep-agent-runtime.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/use-deep-agent-runtime.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/use-deep-agent-window-sync.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/use-deep-agent-window-sync.js +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/voice-turn-grouping.cjs +0 -0
- /package/dist/{packages/agent-runtime → agent-runtime}/src/voice-turn-grouping.js +0 -0
- /package/dist/{packages/react → react}/package.json.cjs.map +0 -0
- /package/dist/{packages/react → react}/package.json.js.map +0 -0
- /package/dist/{packages/tiptap-markdown-table → tiptap-markdown-table}/src/markdown-table-serializer.cjs +0 -0
- /package/dist/{packages/tiptap-markdown-table → tiptap-markdown-table}/src/markdown-table-serializer.js +0 -0
|
@@ -9,14 +9,16 @@ import { useAui, unstable_useComposerInput } from "@assistant-ui/react";
|
|
|
9
9
|
import { useComposerHandoffStore } from "../../composer/composer-handoff.js";
|
|
10
10
|
import { LoaderCircleIcon, XIcon } from "lucide-react";
|
|
11
11
|
import { CHAT_TEXT_CLASS, createChatTextExtensions } from "../rich-text/chat-text-schema.js";
|
|
12
|
-
import { getMarkdownStorage } from "../markdown-storage.js";
|
|
13
12
|
import { MentionSuggestionsExtension } from "../mentions/suggestions/mention-suggestions.extension.js";
|
|
14
13
|
import { MentionSuggestionPopup } from "../mentions/suggestions/components/mention-suggestion-popup.js";
|
|
15
14
|
import { MentionSuggestionList } from "../mentions/suggestions/components/mention-suggestion-list.js";
|
|
16
15
|
import { useMentionSuggestions } from "../mentions/suggestions/data/use-mention-suggestions.js";
|
|
16
|
+
import { Selection } from "@tiptap/pm/state";
|
|
17
|
+
import { captureComposerSend, prepareComposerSend, ComposerDraftWhitespace, draftForReturnedSend, serializeComposerDraft } from "./composer-message.js";
|
|
17
18
|
import { PendingAttachmentUploads } from "./pending-attachment-uploads.js";
|
|
18
19
|
import { runInputRulesOnEnter } from "./run-input-rules-on-enter.js";
|
|
19
|
-
import {
|
|
20
|
+
import { readAthenaAssetDrop, isAthenaAssetDrag } from "../../agent-runtime/src/athena-asset-drag.js";
|
|
21
|
+
import { registerChatAssetMentionHandler } from "../../agent-runtime/src/asset-attachment.js";
|
|
20
22
|
import { cn } from "cnfast";
|
|
21
23
|
const SubmitKeybind = Extension.create({
|
|
22
24
|
name: "submitKeybind",
|
|
@@ -74,7 +76,16 @@ const MENTION_STYLES = `
|
|
|
74
76
|
}
|
|
75
77
|
`;
|
|
76
78
|
function serializeDraft(editor) {
|
|
77
|
-
return
|
|
79
|
+
return serializeComposerDraft(editor);
|
|
80
|
+
}
|
|
81
|
+
function appendPlainText(editor, text) {
|
|
82
|
+
const words = text.trim();
|
|
83
|
+
if (!words || editor.isDestroyed) return false;
|
|
84
|
+
const end = Selection.atEnd(editor.state.doc);
|
|
85
|
+
const before = end.$from.nodeBefore;
|
|
86
|
+
const needsSpace = before !== null && before.type.name !== "hardBreak" && !(before.isText && /\s$/.test(before.text ?? ""));
|
|
87
|
+
editor.chain().setTextSelection(end.from).insertContent({ type: "text", text: needsSpace ? ` ${words}` : words }).run();
|
|
88
|
+
return true;
|
|
78
89
|
}
|
|
79
90
|
const NO_WEBPAGES = [];
|
|
80
91
|
function revokeImagePreview(src) {
|
|
@@ -156,6 +167,7 @@ const TiptapComposer = forwardRef(
|
|
|
156
167
|
const handoff = useComposerHandoffStore();
|
|
157
168
|
const applyingRuntimeTextRef = useRef(false);
|
|
158
169
|
const lastEmittedMarkdownRef = useRef(null);
|
|
170
|
+
const restoredSendRef = useRef(null);
|
|
159
171
|
const listRef = useRef(null);
|
|
160
172
|
const pendingUploadsRef = useRef(new PendingAttachmentUploads());
|
|
161
173
|
const submitInFlightRef = useRef(false);
|
|
@@ -226,10 +238,10 @@ const TiptapComposer = forwardRef(
|
|
|
226
238
|
await (waitForHostUploads == null ? void 0 : waitForHostUploads());
|
|
227
239
|
const ed = editorRef.current;
|
|
228
240
|
if (!ed) return;
|
|
229
|
-
const text =
|
|
241
|
+
const { text, draftMarkdown } = captureComposerSend(ed);
|
|
230
242
|
if (interceptSubmit) {
|
|
231
243
|
const hasAttachments = (((_a = aui.composer.getState().attachments) == null ? void 0 : _a.length) ?? 0) > 0;
|
|
232
|
-
if (!hasAttachments && await interceptSubmit(text)) {
|
|
244
|
+
if (!hasAttachments && await interceptSubmit(text, draftMarkdown)) {
|
|
233
245
|
ed.commands.clearContent(false);
|
|
234
246
|
clearImagePreviews();
|
|
235
247
|
onDraftStateChange == null ? void 0 : onDraftStateChange(false);
|
|
@@ -239,6 +251,7 @@ const TiptapComposer = forwardRef(
|
|
|
239
251
|
}
|
|
240
252
|
if (!text) return;
|
|
241
253
|
if (!composerInput.canSend) return;
|
|
254
|
+
prepareComposerSend({ threadId, text, draftMarkdown });
|
|
242
255
|
composerInput.setText(text);
|
|
243
256
|
composerInput.send({ steer: false });
|
|
244
257
|
ed.commands.clearContent(false);
|
|
@@ -255,6 +268,7 @@ const TiptapComposer = forwardRef(
|
|
|
255
268
|
interceptSubmit,
|
|
256
269
|
onDraftStateChange,
|
|
257
270
|
onSubmitted,
|
|
271
|
+
threadId,
|
|
258
272
|
waitForHostUploads
|
|
259
273
|
]);
|
|
260
274
|
const handleSubmitRef = useRef(handleSubmit);
|
|
@@ -342,29 +356,65 @@ const TiptapComposer = forwardRef(
|
|
|
342
356
|
},
|
|
343
357
|
[addAttachment, fileIntake, onAttachmentError]
|
|
344
358
|
);
|
|
359
|
+
const disabledRef = useRef(disabled);
|
|
360
|
+
disabledRef.current = disabled;
|
|
361
|
+
const insertAssetMentionRef = useRef(
|
|
362
|
+
() => {
|
|
363
|
+
}
|
|
364
|
+
);
|
|
365
|
+
const handleAssetDrop = useCallback(
|
|
366
|
+
(event, view) => {
|
|
367
|
+
if (disabledRef.current || !event.dataTransfer) return false;
|
|
368
|
+
const dropped = readAthenaAssetDrop(event.dataTransfer);
|
|
369
|
+
if (!dropped) return false;
|
|
370
|
+
event.preventDefault();
|
|
371
|
+
if (dropped.kind !== "asset") return true;
|
|
372
|
+
const position = view == null ? void 0 : view.posAtCoords({
|
|
373
|
+
left: event.clientX,
|
|
374
|
+
top: event.clientY
|
|
375
|
+
});
|
|
376
|
+
if (view) {
|
|
377
|
+
const { state } = view;
|
|
378
|
+
view.dispatch(
|
|
379
|
+
state.tr.setSelection(
|
|
380
|
+
position ? Selection.near(state.doc.resolve(position.pos)) : Selection.atEnd(state.doc)
|
|
381
|
+
)
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
insertAssetMentionRef.current(dropped.asset);
|
|
385
|
+
return true;
|
|
386
|
+
},
|
|
387
|
+
[]
|
|
388
|
+
);
|
|
345
389
|
const handleDrop = useCallback(
|
|
346
|
-
(
|
|
390
|
+
(view, event) => {
|
|
347
391
|
var _a;
|
|
392
|
+
if (handleAssetDrop(event, view)) return true;
|
|
348
393
|
const files = (_a = event.dataTransfer) == null ? void 0 : _a.files;
|
|
349
394
|
if (!(files == null ? void 0 : files.length)) return false;
|
|
350
395
|
const handled = addDroppedImages(files);
|
|
351
396
|
if (handled) event.preventDefault();
|
|
352
397
|
return handled;
|
|
353
398
|
},
|
|
354
|
-
[addDroppedImages]
|
|
399
|
+
[addDroppedImages, handleAssetDrop]
|
|
355
400
|
);
|
|
356
401
|
const handleComposerDrop = useCallback(
|
|
357
402
|
(event) => {
|
|
403
|
+
var _a;
|
|
358
404
|
if (event.defaultPrevented) return;
|
|
405
|
+
if (handleAssetDrop(event.nativeEvent, (_a = editorRef.current) == null ? void 0 : _a.view)) return;
|
|
359
406
|
if (addDroppedImages(event.dataTransfer.files)) event.preventDefault();
|
|
360
407
|
},
|
|
361
|
-
[addDroppedImages]
|
|
408
|
+
[addDroppedImages, handleAssetDrop]
|
|
362
409
|
);
|
|
410
|
+
const placeholderRef = useRef(placeholder);
|
|
411
|
+
placeholderRef.current = placeholder;
|
|
363
412
|
const editor = useEditor({
|
|
364
413
|
editable: !disabled,
|
|
365
414
|
extensions: [
|
|
366
415
|
...createChatTextExtensions(),
|
|
367
|
-
|
|
416
|
+
ComposerDraftWhitespace,
|
|
417
|
+
Placeholder.configure({ placeholder: () => placeholderRef.current }),
|
|
368
418
|
MentionSuggestionsExtension.configure({
|
|
369
419
|
store,
|
|
370
420
|
callbacks: callbacksRef.current
|
|
@@ -407,20 +457,29 @@ const TiptapComposer = forwardRef(
|
|
|
407
457
|
useEffect(() => {
|
|
408
458
|
editor == null ? void 0 : editor.setEditable(!disabled);
|
|
409
459
|
}, [disabled, editor]);
|
|
460
|
+
useEffect(() => {
|
|
461
|
+
if (!editor || editor.isDestroyed) return;
|
|
462
|
+
editor.view.dispatch(editor.state.tr.setMeta("addToHistory", false));
|
|
463
|
+
}, [editor, placeholder]);
|
|
410
464
|
useEffect(() => {
|
|
411
465
|
if (!editor) return;
|
|
412
466
|
const value = composerInput.value;
|
|
413
467
|
if (value === lastEmittedMarkdownRef.current) return;
|
|
468
|
+
if (value === restoredSendRef.current) return;
|
|
469
|
+
restoredSendRef.current = null;
|
|
414
470
|
const currentMarkdown = serializeDraft(editor);
|
|
415
471
|
lastEmittedMarkdownRef.current = currentMarkdown;
|
|
416
|
-
|
|
472
|
+
const returnedDraft = editor.isEmpty ? draftForReturnedSend({ threadId, text: value }) : null;
|
|
473
|
+
const restored = returnedDraft ?? value;
|
|
474
|
+
if (restored === currentMarkdown) return;
|
|
417
475
|
let cancelled = false;
|
|
418
476
|
queueMicrotask(() => {
|
|
419
477
|
if (cancelled || editor.isDestroyed) return;
|
|
420
478
|
applyingRuntimeTextRef.current = true;
|
|
421
479
|
try {
|
|
422
|
-
editor.commands.setContent(
|
|
480
|
+
editor.commands.setContent(restored, { emitUpdate: false });
|
|
423
481
|
lastEmittedMarkdownRef.current = serializeDraft(editor);
|
|
482
|
+
if (returnedDraft !== null) restoredSendRef.current = value;
|
|
424
483
|
} finally {
|
|
425
484
|
applyingRuntimeTextRef.current = false;
|
|
426
485
|
}
|
|
@@ -433,12 +492,16 @@ const TiptapComposer = forwardRef(
|
|
|
433
492
|
return () => {
|
|
434
493
|
cancelled = true;
|
|
435
494
|
};
|
|
436
|
-
}, [composerInput.value, editor, handoff, onDraftStateChange]);
|
|
495
|
+
}, [composerInput.value, editor, handoff, onDraftStateChange, threadId]);
|
|
437
496
|
useEffect(() => {
|
|
438
497
|
if (!editor || !handoff) return;
|
|
439
498
|
handoff.focusEnd = () => {
|
|
440
499
|
if (!editor.isDestroyed) editor.commands.focus("end");
|
|
441
500
|
};
|
|
501
|
+
if (handoff.focusOnMount) {
|
|
502
|
+
handoff.focusOnMount = false;
|
|
503
|
+
handoff.focusEnd();
|
|
504
|
+
}
|
|
442
505
|
return () => {
|
|
443
506
|
handoff.focusEnd = null;
|
|
444
507
|
};
|
|
@@ -483,6 +546,7 @@ const TiptapComposer = forwardRef(
|
|
|
483
546
|
},
|
|
484
547
|
[replaceImagePreviews, showImagePreviews]
|
|
485
548
|
);
|
|
549
|
+
insertAssetMentionRef.current = insertAssetMention;
|
|
486
550
|
const removeImagePreview = useCallback(
|
|
487
551
|
(preview) => {
|
|
488
552
|
if (!preview.assetId) return;
|
|
@@ -521,15 +585,32 @@ const TiptapComposer = forwardRef(
|
|
|
521
585
|
const needsSpace = before.length > 0 && !/[\s([{"']/.test(before);
|
|
522
586
|
currentEditor.chain().focus().insertContent({ type: "text", text: needsSpace ? " @" : "@" }).run();
|
|
523
587
|
}, [disabled]);
|
|
588
|
+
const appendText = useCallback((text) => {
|
|
589
|
+
const currentEditor = editorRef.current;
|
|
590
|
+
if (currentEditor) appendPlainText(currentEditor, text);
|
|
591
|
+
}, []);
|
|
592
|
+
const captureSend = useCallback(() => {
|
|
593
|
+
const currentEditor = editorRef.current;
|
|
594
|
+
return currentEditor && !currentEditor.isDestroyed ? captureComposerSend(currentEditor) : null;
|
|
595
|
+
}, []);
|
|
524
596
|
useImperativeHandle(
|
|
525
597
|
outerRef,
|
|
526
598
|
() => ({
|
|
527
599
|
submit: handleSubmit,
|
|
528
600
|
addAttachment,
|
|
529
601
|
insertAssetMention,
|
|
530
|
-
openMentionMenu
|
|
602
|
+
openMentionMenu,
|
|
603
|
+
appendText,
|
|
604
|
+
captureSend
|
|
531
605
|
}),
|
|
532
|
-
[
|
|
606
|
+
[
|
|
607
|
+
addAttachment,
|
|
608
|
+
appendText,
|
|
609
|
+
captureSend,
|
|
610
|
+
handleSubmit,
|
|
611
|
+
insertAssetMention,
|
|
612
|
+
openMentionMenu
|
|
613
|
+
]
|
|
533
614
|
);
|
|
534
615
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
535
616
|
/* @__PURE__ */ jsx("style", { children: MENTION_STYLES }),
|
|
@@ -544,7 +625,8 @@ const TiptapComposer = forwardRef(
|
|
|
544
625
|
"aria-label": "Message composer",
|
|
545
626
|
"aria-disabled": disabled,
|
|
546
627
|
onDragOver: (event) => {
|
|
547
|
-
|
|
628
|
+
const types = Array.from(event.dataTransfer.types);
|
|
629
|
+
if (types.includes("Files") || !disabled && isAthenaAssetDrag(types)) {
|
|
548
630
|
event.preventDefault();
|
|
549
631
|
event.dataTransfer.dropEffect = "copy";
|
|
550
632
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-composer.js","sources":["../../../src/chat-ui/composer/tiptap-composer.tsx"],"sourcesContent":["/**\n * Tiptap Composer — Full Olympus mention system integration\n *\n * Uses the ported Olympus infrastructure:\n * - MentionSuggestionList (with scope navigation, breadcrumbs, keyboard nav)\n * - MentionSuggestionPopup (Floating UI positioning)\n * - MentionSuggestionsExtension (Tiptap @ trigger)\n * - MentionExtension (inline mention chips)\n * - useMentionSuggestions (full Olympus categories + async data)\n *\n * Auth credentials for GraphQL are provided via MentionAuthCtx, and the host\n * app (Chrome side panel, Office task pane, the SDK's AthenaChat) supplies any\n * host-only mention items — browser tabs through `webpages`, its own Tools /\n * Toolkits list through `tools`.\n *\n * The draft serializes to Markdown through `tiptap-markdown` — the serializer\n * the Olympus chat composer sends with — so pasted hyperlinks keep their URL,\n * formatting marks survive, paragraphs stay separated, and a mention is the\n * `[@Name](url)` link the message renderer parses back into a chip.\n */\n\nimport { athenaDiagnostics } from \"../../diagnostics/athena-diagnostics\";\nimport {\n clipboardHasMeaningfulText,\n extractPastedImages,\n} from \"../../composer/clipboard\";\nimport {\n useRef,\n useState,\n useCallback,\n useEffect,\n forwardRef,\n useImperativeHandle,\n type DragEvent as ReactDragEvent,\n} from \"react\";\nimport { useEditor, EditorContent } from \"@tiptap/react\";\nimport Placeholder from \"@tiptap/extension-placeholder\";\nimport { Extension, type Editor } from \"@tiptap/core\";\nimport { unstable_useComposerInput, useAui } from \"@assistant-ui/react\";\nimport { useComposerHandoffStore } from \"../../composer/composer-handoff\";\nimport { LoaderCircleIcon, XIcon } from \"lucide-react\";\nimport { cn } from \"../../lib/utils\";\nimport { CHAT_TEXT_CLASS, createChatTextExtensions } from \"../rich-text/chat-text-schema\";\nimport { getMarkdownStorage } from \"../markdown-storage\";\nimport {\n MentionSuggestionsExtension,\n type MentionSuggestionCallbacks,\n type MentionSuggestionRenderProps,\n} from \"../mentions/suggestions/mention-suggestions.extension\";\nimport { MentionSuggestionPopup } from \"../mentions/suggestions/components/mention-suggestion-popup\";\nimport {\n MentionSuggestionList,\n} from \"../mentions/suggestions/components/mention-suggestion-list\";\nimport {\n useMentionSuggestions,\n type MentionRootCategory,\n} from \"../mentions/suggestions/data/use-mention-suggestions\";\nimport type {\n MentionTool,\n MenuItem,\n WebpageMention,\n} from \"../mentions/suggestions/data/types\";\nimport type { KeyboardNavigationHandle } from \"../mentions/suggestions/components/use-keyboard-navigation\";\nimport {\n registerChatAssetMentionHandler,\n type UploadedChatAsset,\n} from \"@athenaintel/agent-runtime\";\nimport { PendingAttachmentUploads } from \"./pending-attachment-uploads\";\nimport { runInputRulesOnEnter } from \"./run-input-rules-on-enter\";\n\n// ── Submit keybind extension ──\n\nconst SubmitKeybind = Extension.create<{ onSubmit: () => void; isMentionOpen: () => boolean }>({\n name: \"submitKeybind\",\n priority: 1000,\n addOptions() {\n return { onSubmit: () => {}, isMentionOpen: () => false };\n },\n addKeyboardShortcuts() {\n return {\n Enter: () => {\n // Don't submit when the mention popup is open — let it handle Enter\n if (this.options.isMentionOpen()) return false;\n // A typed \"1.\" or \"-\" starts a list rather than sending.\n if (runInputRulesOnEnter(this.editor)) return true;\n // Let the schema's keymaps continue lists, insert code newlines, and\n // split paragraphs inside structured blocks, as in the web composer.\n if ([\"listItem\", \"taskItem\", \"codeBlock\", \"table\", \"blockquote\"].some(\n (node) => this.editor.isActive(node),\n )) return false;\n this.options.onSubmit();\n return true;\n },\n \"Shift-Enter\": () => {\n return this.editor.commands.newlineInCode() || this.editor.commands.setHardBreak();\n },\n };\n },\n});\n\n// ── CSS for mention chips + editor ──\n\nconst MENTION_STYLES = `\n .image-preview-composer .mention-chip[data-display-as-preview=\"true\"] {\n display: none;\n }\n /* Scoped to this editor: hosts render other ProseMirror instances on the\n same page (AthenaChat's message renderer), which must keep their own\n height and placeholder rules. */\n .athena-chat-composer .ProseMirror {\n outline: none;\n min-height: 36px;\n max-height: 120px;\n overflow-y: auto;\n }\n .athena-chat-composer .ProseMirror p.is-editor-empty:first-child::before {\n content: attr(data-placeholder);\n float: left;\n color: #9ca3af;\n pointer-events: none;\n height: 0;\n }\n /* The paper appearance (the SDK thread): a taller resting height, room for\n about eight lines before the draft scrolls, and a placeholder at 35% of\n the text colour. Same specificity as the rules above, so order decides. */\n .athena-chat-composer--paper .ProseMirror {\n min-height: 44px;\n max-height: 12rem;\n }\n .athena-chat-composer--paper .ProseMirror p.is-editor-empty:first-child::before {\n color: color-mix(in srgb, currentColor 35%, transparent);\n }\n`;\n\n/**\n * The editor's look. `default` is what the Chrome extension and Office add-in\n * render; `paper` pairs with `ChatComposerDock appearance=\"paper\"`.\n */\nexport type TiptapComposerAppearance = \"default\" | \"paper\";\n\n/** The draft as it is sent: Markdown, mentions as `[@Name](url)` links. */\nexport function serializeDraft(editor: Editor): string {\n return getMarkdownStorage(editor).getMarkdown();\n}\n\n/**\n * A host's own intake for the files pasted into or dropped on the composer\n * (AthenaChat uploads them into its attachment pills). Without `onDrop` the\n * composer leaves drops untouched so an enclosing drop zone receives them.\n */\nexport interface ComposerFileIntake {\n onPaste: (files: readonly File[]) => void;\n onDrop?: (files: readonly File[]) => void;\n}\n\n// ── Main component ──\n\nexport interface TiptapComposerHandle {\n submit: () => Promise<void>;\n addAttachment: (file: File) => Promise<void>;\n insertAssetMention: (asset: UploadedChatAsset) => void;\n /**\n * Focuses the editor and types the `@` trigger at the caret (after a space\n * when the caret follows a word), opening the mention menu — the toolbar's\n * `@` button. A no-op while the editor is disabled or the menu is open.\n * Optional on the type so hosts' handle stand-ins written before it keep\n * type-checking; the composer itself always provides it.\n */\n openMentionMenu?: () => void;\n}\n\nexport interface TiptapComposerProps {\n placeholder?: string;\n threadId: string;\n disabled?: boolean;\n /** Editor look; defaults to the side-panel / task-pane editor. */\n appearance?: TiptapComposerAppearance;\n /** Host-provided browser-tab mentions; empty in hosts without tab access. */\n webpages?: readonly WebpageMention[];\n /**\n * Host-provided Tools / Toolkits mention candidates. When set they replace\n * the server tool catalog for those categories (see `useMentionSuggestions`).\n */\n tools?: readonly MentionTool[];\n rootCategories?: readonly MentionRootCategory[];\n onDraftStateChange?: (hasDraft: boolean) => void;\n /** Show local image thumbnails while mention-backed uploads are in the draft. */\n showImagePreviews?: boolean;\n /** Surface paste/drop attachment failures in host UI as well as diagnostics. */\n onAttachmentError?: (message: string) => void;\n /**\n * Host-owned intake for pasted and dropped files. Without it the composer\n * attaches them itself through `aui.composer.addAttachment`.\n */\n fileIntake?: ComposerFileIntake;\n /**\n * Awaited before every submit (Enter and the imperative handle), after the\n * composer's own pending uploads have settled: a host whose uploads live\n * outside the composer (AthenaChat's attachment pills) resolves once they\n * land, so a send never leaves without its attachment.\n */\n waitForHostUploads?: () => Promise<void> | void;\n /**\n * Optional submit interception: called with the serialized draft — possibly\n * empty, for a host composing its own extras into the send — before the\n * composer-runtime send. Return `true` when the host consumed the draft\n * through another lane (e.g. a live voice session) — the editor clears and\n * the normal send is skipped. Return `false` to fall through unchanged.\n */\n interceptSubmit?: (text: string) => boolean | Promise<boolean>;\n /**\n * Called after a draft has left the editor — through the composer-runtime\n * send or a host interception — from Enter and the imperative handle alike.\n * Hosts use it for per-send UI such as a first-use keyboard hint.\n */\n onSubmitted?: () => void;\n}\n\nconst NO_WEBPAGES: readonly WebpageMention[] = [];\n\ninterface ComposerImagePreview {\n key: string;\n file: File;\n name: string;\n src: string;\n assetId?: string;\n}\n\nfunction revokeImagePreview(src: string): void {\n if (typeof URL.revokeObjectURL === \"function\") URL.revokeObjectURL(src);\n}\n\nfunction ImagePreviewStrip({\n previews,\n onRemove,\n}: {\n previews: readonly ComposerImagePreview[];\n onRemove: (preview: ComposerImagePreview) => void;\n}) {\n if (previews.length === 0) return null;\n\n return (\n <div\n className=\"flex w-full gap-2 overflow-x-auto px-1.5 pb-1 pt-1.5\"\n role=\"list\"\n aria-label=\"Image attachments\"\n >\n {previews.map((preview) => {\n const uploading = preview.assetId === undefined;\n return (\n <div\n key={preview.key}\n className=\"group relative h-16 w-[clamp(76px,30vw,112px)] shrink-0 overflow-hidden rounded-lg border border-neutral-200 bg-neutral-100 shadow-sm\"\n role=\"listitem\"\n >\n <img\n src={preview.src}\n alt={preview.name}\n className=\"size-full object-cover\"\n />\n <div className=\"absolute inset-x-0 bottom-0 truncate bg-gradient-to-t from-black/75 to-transparent px-1.5 pb-1 pt-4 text-[10px] font-medium text-white\">\n {preview.name}\n </div>\n {uploading ? (\n <span\n className=\"absolute left-1 top-1 inline-flex size-5 items-center justify-center rounded-full bg-black/65 text-white\"\n title=\"Uploading image\"\n >\n <LoaderCircleIcon className=\"size-3 animate-spin\" />\n </span>\n ) : (\n <button\n type=\"button\"\n onClick={() => onRemove(preview)}\n className=\"absolute right-1 top-1 inline-flex size-5 items-center justify-center rounded-full bg-black/65 text-white opacity-80 transition-opacity hover:bg-black/80 hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white\"\n aria-label={`Remove ${preview.name}`}\n title=\"Remove image\"\n >\n <XIcon className=\"size-3\" />\n </button>\n )}\n </div>\n );\n })}\n </div>\n );\n}\n\nexport const TiptapComposer = forwardRef<\n TiptapComposerHandle,\n TiptapComposerProps\n>(\n (\n {\n placeholder = \"Message Athena... (type @ to mention)\",\n threadId,\n disabled = false,\n appearance = \"default\",\n webpages = NO_WEBPAGES,\n tools,\n rootCategories,\n onDraftStateChange,\n showImagePreviews = false,\n onAttachmentError,\n fileIntake,\n waitForHostUploads,\n interceptSubmit,\n onSubmitted,\n },\n outerRef,\n ) => {\n const aui = useAui();\n const composerInput = unstable_useComposerInput();\n const handoff = useComposerHandoffStore();\n const applyingRuntimeTextRef = useRef(false);\n // What this editor last mirrored into the composer runtime; a value equal to\n // it is our own echo and needs no re-serialization or restore.\n const lastEmittedMarkdownRef = useRef<string | null>(null);\n const listRef = useRef<KeyboardNavigationHandle>(null);\n const pendingUploadsRef = useRef(new PendingAttachmentUploads());\n const submitInFlightRef = useRef(false);\n const imagePreviewsRef = useRef<ComposerImagePreview[]>([]);\n const [imagePreviews, setImagePreviews] = useState<ComposerImagePreview[]>([]);\n\n const replaceImagePreviews = useCallback((next: ComposerImagePreview[]) => {\n imagePreviewsRef.current = next;\n setImagePreviews(next);\n }, []);\n\n const removeImagePreviews = useCallback(\n (shouldRemove: (preview: ComposerImagePreview) => boolean) => {\n const kept: ComposerImagePreview[] = [];\n let removed = false;\n for (const preview of imagePreviewsRef.current) {\n if (shouldRemove(preview)) {\n revokeImagePreview(preview.src);\n removed = true;\n } else kept.push(preview);\n }\n if (removed) replaceImagePreviews(kept);\n },\n [replaceImagePreviews],\n );\n\n const clearImagePreviews = useCallback(() => {\n removeImagePreviews(() => true);\n }, [removeImagePreviews]);\n\n useEffect(() => clearImagePreviews(), [clearImagePreviews, threadId]);\n useEffect(\n () => () => {\n for (const preview of imagePreviewsRef.current) {\n revokeImagePreview(preview.src);\n }\n imagePreviewsRef.current = [];\n },\n [],\n );\n\n const { store } = useMentionSuggestions({ webpages, tools, rootCategories });\n\n // Popup state\n const [popupOpen, setPopupOpen] = useState(false);\n const popupOpenRef = useRef(false);\n const [popupProps, setPopupProps] = useState<MentionSuggestionRenderProps | null>(null);\n\n // Suggestion callbacks — drive the popup lifecycle\n const callbacksRef = useRef<MentionSuggestionCallbacks>({\n onStart: (props) => {\n setPopupOpen(true);\n popupOpenRef.current = true;\n setPopupProps(props);\n },\n onUpdate: (props) => {\n setPopupProps(props);\n },\n onKeyDown: (event) => {\n // Route keyboard events to the MentionSuggestionList\n return listRef.current?.onKeyDown(event) ?? false;\n },\n onExit: () => {\n setPopupOpen(false);\n popupOpenRef.current = false;\n setPopupProps(null);\n },\n });\n\n // Editor ref — needed because handleSubmit is created before useEditor returns\n const editorRef = useRef<ReturnType<typeof useEditor>>(null);\n\n // Submit via composer runtime so attachments (screenshots, files) are included.\n // aui.composer.setText() + aui.composer.send() bundles text + pending attachments.\n //\n // Statewire turns a send during an active run into a queued command. Do not\n // cancel first: cancellation aborts the shared run for every connected\n // client and turns a normal queued follow-up into a destructive stop.\n const handleSubmit = useCallback(async () => {\n if (disabled) return;\n if (submitInFlightRef.current) return;\n submitInFlightRef.current = true;\n try {\n await pendingUploadsRef.current.waitForIdle();\n await waitForHostUploads?.();\n const ed = editorRef.current;\n if (!ed) return;\n const text = serializeDraft(ed).trim();\n\n // Interception carries TEXT only: a draft with pending attachments\n // (screenshots, files) must ride the composer-runtime send that\n // bundles them, or the attachments would silently vanish. Attachment\n // state is read only when a host actually intercepts. It runs before\n // the empty check because a host may compose extras of its own into\n // an otherwise empty draft (AthenaChat's quote and attachment pills).\n if (interceptSubmit) {\n const hasAttachments =\n (aui.composer.getState().attachments?.length ?? 0) > 0;\n if (!hasAttachments && (await interceptSubmit(text))) {\n ed.commands.clearContent(false);\n clearImagePreviews();\n onDraftStateChange?.(false);\n onSubmitted?.();\n return;\n }\n }\n\n if (!text) return;\n if (!composerInput.canSend) return;\n\n composerInput.setText(text);\n composerInput.send({ steer: false });\n\n ed.commands.clearContent(false);\n clearImagePreviews();\n onDraftStateChange?.(false);\n onSubmitted?.();\n } finally {\n submitInFlightRef.current = false;\n }\n }, [\n clearImagePreviews,\n composerInput,\n disabled,\n interceptSubmit,\n onDraftStateChange,\n onSubmitted,\n waitForHostUploads,\n ]);\n\n const handleSubmitRef = useRef(handleSubmit);\n handleSubmitRef.current = handleSubmit;\n\n const addAttachment = useCallback(\n (file: File) => {\n let previewKey: string | undefined;\n if (\n showImagePreviews &&\n file.type.startsWith(\"image/\") &&\n typeof URL.createObjectURL === \"function\"\n ) {\n previewKey = crypto.randomUUID();\n replaceImagePreviews([\n ...imagePreviewsRef.current,\n {\n key: previewKey,\n file,\n name: file.name || \"Pasted image\",\n src: URL.createObjectURL(file),\n },\n ]);\n }\n\n return pendingUploadsRef.current\n .track(aui.composer.addAttachment(file))\n .catch((error: unknown) => {\n if (previewKey) {\n removeImagePreviews((preview) => preview.key === previewKey);\n }\n throw error;\n });\n },\n [aui, removeImagePreviews, replaceImagePreviews, showImagePreviews],\n );\n\n // Handle paste events — intercept images from clipboard and add as attachments\n const handlePaste = useCallback(\n (_view: unknown, event: ClipboardEvent) => {\n const clipboardData = event.clipboardData;\n if (!clipboardData) return false;\n\n const images = extractPastedImages({ clipboardData });\n if (images.length === 0) return false;\n // Office and spreadsheet copies put the cells' text beside a bitmap of\n // them: the text is what the user copied, so the editor's native paste\n // keeps it and the incidental screenshot is left alone. A copied image\n // file's own name (Finder, Explorer) is not such text.\n if (\n clipboardHasMeaningfulText({\n clipboardData,\n pastedFileNames: images.map((image) => image.originalName),\n })\n ) {\n return false;\n }\n event.preventDefault();\n\n const files = images.map((image) => image.file);\n if (fileIntake) {\n fileIntake.onPaste(files);\n return true;\n }\n for (const file of files) {\n void addAttachment(file).catch((error: unknown) => {\n onAttachmentError?.(\"Couldn’t paste that image.\");\n athenaDiagnostics.error(\n \"composer.attachment.error\",\n error,\n { code: \"attachment_failed\", message: \"Pasted image upload failed\" },\n { source: \"paste\", type: file.type },\n );\n });\n }\n return true;\n },\n [addAttachment, fileIntake, onAttachmentError],\n );\n\n // Without a host intake the composer attaches dropped images itself; a host\n // intake without `onDrop` leaves drops to the enclosing drop zone.\n const addDroppedImages = useCallback(\n (files: FileList | readonly File[]) => {\n const images = Array.from(files).filter((file) =>\n file.type.startsWith(\"image/\"),\n );\n if (images.length === 0) return false;\n if (fileIntake) {\n if (!fileIntake.onDrop) return false;\n fileIntake.onDrop(images);\n return true;\n }\n for (const file of images) {\n void addAttachment(file).catch((error: unknown) => {\n onAttachmentError?.(\"Couldn’t attach that dropped image.\");\n athenaDiagnostics.error(\n \"composer.attachment.error\",\n error,\n { code: \"attachment_failed\", message: \"Dropped image upload failed\" },\n { source: \"drop\", type: file.type },\n );\n });\n }\n return true;\n },\n [addAttachment, fileIntake, onAttachmentError],\n );\n\n // ProseMirror owns drops that land in the editable surface. The React\n // wrapper below catches the rest of the composer area; defaultPrevented\n // keeps one gesture from being attached twice.\n const handleDrop = useCallback(\n (_view: unknown, event: DragEvent) => {\n const files = event.dataTransfer?.files;\n if (!files?.length) return false;\n const handled = addDroppedImages(files);\n if (handled) event.preventDefault();\n return handled;\n },\n [addDroppedImages],\n );\n\n const handleComposerDrop = useCallback(\n (event: ReactDragEvent<HTMLDivElement>) => {\n if (event.defaultPrevented) return;\n if (addDroppedImages(event.dataTransfer.files)) event.preventDefault();\n },\n [addDroppedImages],\n );\n\n const editor = useEditor({\n editable: !disabled,\n extensions: [\n ...createChatTextExtensions(),\n Placeholder.configure({ placeholder }),\n MentionSuggestionsExtension.configure({\n store,\n callbacks: callbacksRef.current,\n }),\n SubmitKeybind.configure({\n onSubmit: () => void handleSubmitRef.current(),\n isMentionOpen: () => popupOpenRef.current,\n }),\n ],\n editorProps: {\n attributes: {\n class: cn(CHAT_TEXT_CLASS, \"w-full resize-none bg-transparent px-1.5 py-2 outline-none\"),\n \"data-testid\": \"athena-chat-composer\",\n },\n handlePaste,\n handleDrop,\n },\n onUpdate: ({ editor: updatedEditor }) => {\n const nextText = serializeDraft(updatedEditor);\n lastEmittedMarkdownRef.current = nextText;\n if (!applyingRuntimeTextRef.current) {\n composerInput.setText(nextText);\n }\n onDraftStateChange?.(nextText.trim().length > 0);\n\n if (showImagePreviews) {\n const mentionedAssetIds = new Set<string>();\n updatedEditor.state.doc.descendants((node) => {\n if (\n node.type.name === \"mention\" &&\n node.attrs.type === \"asset\" &&\n typeof node.attrs.id === \"string\"\n ) {\n mentionedAssetIds.add(node.attrs.id);\n }\n });\n removeImagePreviews(\n (preview) =>\n preview.assetId !== undefined &&\n !mentionedAssetIds.has(preview.assetId),\n );\n }\n },\n immediatelyRender: false,\n });\n\n // Keep ref in sync so handleSubmit always has the editor\n editorRef.current = editor;\n\n useEffect(() => {\n editor?.setEditable(!disabled);\n }, [disabled, editor]);\n\n // This rich editor replaces ComposerPrimitive.Input, so it must mirror its\n // draft into assistant-ui's composer state. Statewire restores that state\n // when a send is rejected during reconnect, and a host may write to it\n // (`useAppendToComposer`); mirroring it back into Tiptap — parsed as the\n // Markdown it was serialized to, mention links included — preserves the\n // user's message instead of leaving an empty composer. Our own echo is\n // skipped on the ref; a restore's re-serialization may differ from the\n // value byte-for-byte, so the ref takes that form to stop a second pass.\n useEffect(() => {\n if (!editor) return;\n const value = composerInput.value;\n if (value === lastEmittedMarkdownRef.current) return;\n const currentMarkdown = serializeDraft(editor);\n lastEmittedMarkdownRef.current = currentMarkdown;\n if (value === currentMarkdown) return;\n // React node views flush their mounts synchronously. Restore outside\n // React's effect phase, and cancel a restore superseded by a newer draft.\n let cancelled = false;\n queueMicrotask(() => {\n if (cancelled || editor.isDestroyed) return;\n applyingRuntimeTextRef.current = true;\n try {\n editor.commands.setContent(value, { emitUpdate: false });\n lastEmittedMarkdownRef.current = serializeDraft(editor);\n } finally {\n applyingRuntimeTextRef.current = false;\n }\n onDraftStateChange?.(value.trim().length > 0);\n // A host prefill (`useAppendToComposer(..., { focus: true })`) asked\n // for the caret after its text: now that the text is on screen.\n if (handoff?.focusOnNextMirror) {\n handoff.focusOnNextMirror = false;\n editor.commands.focus(\"end\");\n }\n });\n return () => { cancelled = true; };\n }, [composerInput.value, editor, handoff, onDraftStateChange]);\n\n // Lets host UI outside the chat place the caret at the end of the draft\n // (`useAppendToComposer` focus option) without reaching into the DOM.\n useEffect(() => {\n if (!editor || !handoff) return;\n handoff.focusEnd = () => {\n if (!editor.isDestroyed) editor.commands.focus(\"end\");\n };\n return () => {\n handoff.focusEnd = null;\n };\n }, [editor, handoff]);\n\n const insertAssetMention = useCallback(\n (asset: UploadedChatAsset, sourceFile?: File) => {\n const currentEditor = editorRef.current;\n if (!currentEditor) throw new Error(\"The chat composer is not ready.\");\n currentEditor\n .chain()\n .focus()\n .insertContent({\n type: \"mention\",\n attrs: {\n type: \"asset\",\n name: asset.title,\n id: asset.id,\n assetType: asset.assetType,\n displayAsPreview:\n showImagePreviews && sourceFile?.type.startsWith(\"image/\"),\n },\n })\n // A text node, not a string: the Markdown extension parses string\n // content as Markdown, which would drop a lone space.\n .insertContent({ type: \"text\", text: \" \" })\n .run();\n\n if (\n showImagePreviews &&\n sourceFile?.type.startsWith(\"image/\") &&\n typeof URL.createObjectURL === \"function\"\n ) {\n const existing = imagePreviewsRef.current.find(\n (preview) => preview.file === sourceFile,\n );\n if (existing) {\n replaceImagePreviews(\n imagePreviewsRef.current.map((preview) =>\n preview.key === existing.key\n ? { ...preview, assetId: asset.id, name: asset.title }\n : preview,\n ),\n );\n } else {\n replaceImagePreviews([\n ...imagePreviewsRef.current,\n {\n key: crypto.randomUUID(),\n file: sourceFile,\n name: asset.title,\n src: URL.createObjectURL(sourceFile),\n assetId: asset.id,\n },\n ]);\n }\n }\n },\n [replaceImagePreviews, showImagePreviews],\n );\n\n const removeImagePreview = useCallback(\n (preview: ComposerImagePreview) => {\n if (!preview.assetId) return;\n const currentEditor = editorRef.current;\n if (!currentEditor) return;\n const positions: Array<{ from: number; to: number }> = [];\n currentEditor.state.doc.descendants((node, position) => {\n if (\n node.type.name === \"mention\" &&\n node.attrs.type === \"asset\" &&\n node.attrs.id === preview.assetId\n ) {\n positions.push({ from: position, to: position + node.nodeSize });\n }\n });\n let transaction = currentEditor.state.tr;\n for (const position of positions.reverse()) {\n transaction = transaction.delete(position.from, position.to);\n }\n if (transaction.docChanged) currentEditor.view.dispatch(transaction);\n removeImagePreviews((candidate) => candidate.key === preview.key);\n currentEditor.commands.focus();\n },\n [removeImagePreviews],\n );\n\n useEffect(\n () => registerChatAssetMentionHandler(threadId, insertAssetMention),\n [insertAssetMention, threadId],\n );\n\n const openMentionMenu = useCallback(() => {\n if (disabled) return;\n const currentEditor = editorRef.current;\n if (!currentEditor || currentEditor.isDestroyed) return;\n if (popupOpenRef.current) {\n currentEditor.commands.focus();\n return;\n }\n // The suggestion plugin only opens on an `@` that starts a word\n // (`allowedPrefixes`), so a trigger typed right after text — or after a\n // mention chip, which `textBetween` reports as its leaf text — gets the\n // separating space a user would type.\n const { from } = currentEditor.state.selection;\n const before =\n from > 0\n ? currentEditor.state.doc.textBetween(from - 1, from, \"\\0\", \"\\0\")\n : \"\";\n const needsSpace = before.length > 0 && !/[\\s([{\"']/.test(before);\n currentEditor\n .chain()\n .focus()\n .insertContent({ type: \"text\", text: needsSpace ? \" @\" : \"@\" })\n .run();\n }, [disabled]);\n\n useImperativeHandle(\n outerRef,\n () => ({\n submit: handleSubmit,\n addAttachment,\n insertAssetMention,\n openMentionMenu,\n }),\n [addAttachment, handleSubmit, insertAssetMention, openMentionMenu],\n );\n\n return (\n <>\n <style>{MENTION_STYLES}</style>\n <div\n className={cn(\n \"athena-chat-composer flex-1 min-w-0\",\n appearance === \"paper\" && \"athena-chat-composer--paper\",\n showImagePreviews && \"image-preview-composer\",\n )}\n aria-label=\"Message composer\"\n aria-disabled={disabled}\n onDragOver={(event) => {\n if (Array.from(event.dataTransfer.types).includes(\"Files\")) {\n event.preventDefault();\n event.dataTransfer.dropEffect = \"copy\";\n }\n }}\n onDrop={handleComposerDrop}\n >\n <ImagePreviewStrip\n previews={imagePreviews}\n onRemove={removeImagePreview}\n />\n <EditorContent editor={editor} />\n </div>\n\n {/* Olympus-style mention popup */}\n {popupOpen && popupProps && editor && (\n <MentionSuggestionPopup clientRect={popupProps.clientRect}>\n <MentionSuggestionList\n ref={listRef}\n store={store}\n editor={editor}\n query={popupProps.query}\n command={(item: MenuItem) => popupProps.command(item)}\n closeMenu={() => {\n setPopupOpen(false);\n editor.commands.focus();\n }}\n />\n </MentionSuggestionPopup>\n )}\n </>\n );\n },\n);\n\nTiptapComposer.displayName = \"TiptapComposer\";\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAwEA,MAAM,gBAAgB,UAAU,OAA+D;AAAA,EAC7F,MAAM;AAAA,EACN,UAAU;AAAA,EACV,aAAa;AACX,WAAO,EAAE,UAAU,MAAM;AAAA,IAAC,GAAG,eAAe,MAAM,MAAA;AAAA,EACpD;AAAA,EACA,uBAAuB;AACrB,WAAO;AAAA,MACL,OAAO,MAAM;AAEX,YAAI,KAAK,QAAQ,cAAA,EAAiB,QAAO;AAEzC,YAAI,qBAAqB,KAAK,MAAM,EAAG,QAAO;AAG9C,YAAI,CAAC,YAAY,YAAY,aAAa,SAAS,YAAY,EAAE;AAAA,UAC/D,CAAC,SAAS,KAAK,OAAO,SAAS,IAAI;AAAA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,UAClB,SAAS,CAAC,SAAmB,WAAW,QAAQ,IAAI;AAAA,UACpD,WAAW,MAAM;AACf,yBAAa,KAAK;AAClB,mBAAO,SAAS,MAAA;AAAA,UAClB;AAAA,QAAA;AAAA,MAAA,EACF,CACF;AAAA,IAAA,GAEJ;AAAA,EAEF;AACF;AAEA,eAAe,cAAc;"}
|
|
1
|
+
{"version":3,"file":"tiptap-composer.js","sources":["../../../src/chat-ui/composer/tiptap-composer.tsx"],"sourcesContent":["/**\n * Tiptap Composer — Full Olympus mention system integration\n *\n * Uses the ported Olympus infrastructure:\n * - MentionSuggestionList (with scope navigation, breadcrumbs, keyboard nav)\n * - MentionSuggestionPopup (Floating UI positioning)\n * - MentionSuggestionsExtension (Tiptap @ trigger)\n * - MentionExtension (inline mention chips)\n * - useMentionSuggestions (full Olympus categories + async data)\n *\n * Auth credentials for GraphQL are provided via MentionAuthCtx, and the host\n * app (Chrome side panel, Office task pane, the SDK's AthenaChat) supplies any\n * host-only mention items — browser tabs through `webpages`, its own Tools /\n * Toolkits list through `tools`.\n *\n * The draft serializes to Markdown through `tiptap-markdown`, so pasted\n * hyperlinks keep their URL, formatting marks survive, paragraphs stay\n * separated, and a mention is the `[@Name](url)` link the message renderer\n * parses back into a chip. Send delivers that Markdown with every plain-text\n * run written exactly as typed (`serializeComposerMessage`), as the Olympus\n * chat composer does, and the message carries the draft it was sent from\n * (`metadata.composer_markdown`, only when the two differ) so its bubble\n * shows the text exactly as typed.\n */\n\nimport { athenaDiagnostics } from \"../../diagnostics/athena-diagnostics\";\nimport {\n clipboardHasMeaningfulText,\n extractPastedImages,\n} from \"../../composer/clipboard\";\nimport {\n useRef,\n useState,\n useCallback,\n useEffect,\n forwardRef,\n useImperativeHandle,\n type DragEvent as ReactDragEvent,\n} from \"react\";\nimport { useEditor, EditorContent } from \"@tiptap/react\";\nimport Placeholder from \"@tiptap/extension-placeholder\";\nimport { Extension, type Editor } from \"@tiptap/core\";\nimport { unstable_useComposerInput, useAui } from \"@assistant-ui/react\";\nimport { useComposerHandoffStore } from \"../../composer/composer-handoff\";\nimport { LoaderCircleIcon, XIcon } from \"lucide-react\";\nimport { cn } from \"../../lib/utils\";\nimport { CHAT_TEXT_CLASS, createChatTextExtensions } from \"../rich-text/chat-text-schema\";\nimport {\n MentionSuggestionsExtension,\n type MentionSuggestionCallbacks,\n type MentionSuggestionRenderProps,\n} from \"../mentions/suggestions/mention-suggestions.extension\";\nimport { MentionSuggestionPopup } from \"../mentions/suggestions/components/mention-suggestion-popup\";\nimport {\n MentionSuggestionList,\n} from \"../mentions/suggestions/components/mention-suggestion-list\";\nimport {\n useMentionSuggestions,\n type MentionRootCategory,\n} from \"../mentions/suggestions/data/use-mention-suggestions\";\nimport type {\n MentionTool,\n MenuItem,\n WebpageMention,\n} from \"../mentions/suggestions/data/types\";\nimport type { KeyboardNavigationHandle } from \"../mentions/suggestions/components/use-keyboard-navigation\";\nimport { Selection } from \"@tiptap/pm/state\";\nimport type { EditorView } from \"@tiptap/pm/view\";\nimport {\n isAthenaAssetDrag,\n readAthenaAssetDrop,\n registerChatAssetMentionHandler,\n type UploadedChatAsset,\n} from \"@athenaintel/agent-runtime\";\nimport {\n captureComposerSend,\n ComposerDraftWhitespace,\n type ComposerSend,\n draftForReturnedSend,\n prepareComposerSend,\n serializeComposerDraft,\n} from \"./composer-message\";\nimport { PendingAttachmentUploads } from \"./pending-attachment-uploads\";\nimport { runInputRulesOnEnter } from \"./run-input-rules-on-enter\";\n\n// ── Submit keybind extension ──\n\nconst SubmitKeybind = Extension.create<{ onSubmit: () => void; isMentionOpen: () => boolean }>({\n name: \"submitKeybind\",\n priority: 1000,\n addOptions() {\n return { onSubmit: () => {}, isMentionOpen: () => false };\n },\n addKeyboardShortcuts() {\n return {\n Enter: () => {\n // Don't submit when the mention popup is open — let it handle Enter\n if (this.options.isMentionOpen()) return false;\n // A typed \"1.\" or \"-\" starts a list rather than sending.\n if (runInputRulesOnEnter(this.editor)) return true;\n // Let the schema's keymaps continue lists, insert code newlines, and\n // split paragraphs inside structured blocks, as in the web composer.\n if ([\"listItem\", \"taskItem\", \"codeBlock\", \"table\", \"blockquote\"].some(\n (node) => this.editor.isActive(node),\n )) return false;\n this.options.onSubmit();\n return true;\n },\n \"Shift-Enter\": () => {\n return this.editor.commands.newlineInCode() || this.editor.commands.setHardBreak();\n },\n };\n },\n});\n\n// ── CSS for mention chips + editor ──\n\nconst MENTION_STYLES = `\n .image-preview-composer .mention-chip[data-display-as-preview=\"true\"] {\n display: none;\n }\n /* Scoped to this editor: hosts render other ProseMirror instances on the\n same page (AthenaChat's message renderer), which must keep their own\n height and placeholder rules. */\n .athena-chat-composer .ProseMirror {\n outline: none;\n min-height: 36px;\n max-height: 120px;\n overflow-y: auto;\n }\n .athena-chat-composer .ProseMirror p.is-editor-empty:first-child::before {\n content: attr(data-placeholder);\n float: left;\n color: #9ca3af;\n pointer-events: none;\n height: 0;\n }\n /* The paper appearance (the SDK thread): a taller resting height, room for\n about eight lines before the draft scrolls, and a placeholder at 35% of\n the text colour. Same specificity as the rules above, so order decides. */\n .athena-chat-composer--paper .ProseMirror {\n min-height: 44px;\n max-height: 12rem;\n }\n .athena-chat-composer--paper .ProseMirror p.is-editor-empty:first-child::before {\n color: color-mix(in srgb, currentColor 35%, transparent);\n }\n`;\n\n/**\n * The editor's look. `default` is what the Chrome extension and Office add-in\n * render; `paper` pairs with `ChatComposerDock appearance=\"paper\"`.\n */\nexport type TiptapComposerAppearance = \"default\" | \"paper\";\n\n/**\n * The draft as Markdown, mentions as `[@Name](url)` links: what the composer\n * mirrors into the composer runtime and parses back on a restore\n * (`serializeComposerDraft`, which reads back into the same document). Send\n * delivers it with plain text written as typed (`serializeComposerMessage`).\n */\nexport function serializeDraft(editor: Editor): string {\n return serializeComposerDraft(editor);\n}\n\n/**\n * Append `text` to the editor's draft as typed plain text — never read as\n * Markdown — one space after any text already on the last line, the way a\n * dictated phrase joins the draft. Returns whether anything was added.\n */\nfunction appendPlainText(editor: Editor, text: string): boolean {\n const words = text.trim();\n if (!words || editor.isDestroyed) return false;\n const end = Selection.atEnd(editor.state.doc);\n const before = end.$from.nodeBefore;\n const needsSpace =\n before !== null &&\n before.type.name !== \"hardBreak\" &&\n !(before.isText && /\\s$/.test(before.text ?? \"\"));\n editor\n .chain()\n .setTextSelection(end.from)\n // A text node, not a string: the Markdown extension parses string content\n // as Markdown, which would turn spoken words into formatting.\n .insertContent({ type: \"text\", text: needsSpace ? ` ${words}` : words })\n .run();\n return true;\n}\n\n/**\n * A host's own intake for the files pasted into or dropped on the composer\n * (AthenaChat uploads them into its attachment pills). Without `onDrop` the\n * composer leaves drops untouched so an enclosing drop zone receives them.\n */\nexport interface ComposerFileIntake {\n onPaste: (files: readonly File[]) => void;\n onDrop?: (files: readonly File[]) => void;\n}\n\n// ── Main component ──\n\nexport interface TiptapComposerHandle {\n submit: () => Promise<void>;\n addAttachment: (file: File) => Promise<void>;\n insertAssetMention: (asset: UploadedChatAsset) => void;\n /**\n * Focuses the editor and types the `@` trigger at the caret (after a space\n * when the caret follows a word), opening the mention menu — the toolbar's\n * `@` button. A no-op while the editor is disabled or the menu is open.\n * Optional on the type so hosts' handle stand-ins written before it keep\n * type-checking; the composer itself always provides it.\n */\n openMentionMenu?: () => void;\n /**\n * Appends `text` to the draft as typed plain text, never read as Markdown,\n * one space after any text on the draft's last line — how dictated words\n * join the draft. Optional on the type, like `openMentionMenu`.\n */\n appendText?: (text: string) => void;\n /**\n * The draft as a send would deliver it — `text` with plain text exactly as\n * typed, `draftMarkdown` the same document as Markdown that reads back into\n * it — or `null` before the editor mounts. For a host that sends the draft\n * itself (AthenaChat's dictated send) through `prepareComposerSend`.\n */\n captureSend?: () => ComposerSend | null;\n}\n\nexport interface TiptapComposerProps {\n placeholder?: string;\n threadId: string;\n disabled?: boolean;\n /** Editor look; defaults to the side-panel / task-pane editor. */\n appearance?: TiptapComposerAppearance;\n /** Host-provided browser-tab mentions; empty in hosts without tab access. */\n webpages?: readonly WebpageMention[];\n /**\n * Host-provided Tools / Toolkits mention candidates. When set they replace\n * the server tool catalog for those categories (see `useMentionSuggestions`).\n */\n tools?: readonly MentionTool[];\n rootCategories?: readonly MentionRootCategory[];\n onDraftStateChange?: (hasDraft: boolean) => void;\n /** Show local image thumbnails while mention-backed uploads are in the draft. */\n showImagePreviews?: boolean;\n /** Surface paste/drop attachment failures in host UI as well as diagnostics. */\n onAttachmentError?: (message: string) => void;\n /**\n * Host-owned intake for pasted and dropped files. Without it the composer\n * attaches them itself through `aui.composer.addAttachment`.\n */\n fileIntake?: ComposerFileIntake;\n /**\n * Awaited before every submit (Enter and the imperative handle), after the\n * composer's own pending uploads have settled: a host whose uploads live\n * outside the composer (AthenaChat's attachment pills) resolves once they\n * land, so a send never leaves without its attachment.\n */\n waitForHostUploads?: () => Promise<void> | void;\n /**\n * Optional submit interception: called with the serialized draft — possibly\n * empty, for a host composing its own extras into the send — before the\n * composer-runtime send. Return `true` when the host consumed the draft\n * through another lane (e.g. a live voice session) — the editor clears and\n * the normal send is skipped. Return `false` to fall through unchanged.\n * `text` is plain text written exactly as typed (what the model should\n * read); `draftMarkdown` is the same draft with plain text escaped for\n * Markdown (`serializeComposerDraft`), for a host that sends the message\n * itself: `prepareComposerSend` remembers it, so a send handed back loads\n * exactly, and puts it on the message as its composer markdown.\n */\n interceptSubmit?: (text: string, draftMarkdown: string) => boolean | Promise<boolean>;\n /**\n * Called after a draft has left the editor — through the composer-runtime\n * send or a host interception — from Enter and the imperative handle alike.\n * Hosts use it for per-send UI such as a first-use keyboard hint.\n */\n onSubmitted?: () => void;\n}\n\nconst NO_WEBPAGES: readonly WebpageMention[] = [];\n\ninterface ComposerImagePreview {\n key: string;\n file: File;\n name: string;\n src: string;\n assetId?: string;\n}\n\nfunction revokeImagePreview(src: string): void {\n if (typeof URL.revokeObjectURL === \"function\") URL.revokeObjectURL(src);\n}\n\nfunction ImagePreviewStrip({\n previews,\n onRemove,\n}: {\n previews: readonly ComposerImagePreview[];\n onRemove: (preview: ComposerImagePreview) => void;\n}) {\n if (previews.length === 0) return null;\n\n return (\n <div\n className=\"flex w-full gap-2 overflow-x-auto px-1.5 pb-1 pt-1.5\"\n role=\"list\"\n aria-label=\"Image attachments\"\n >\n {previews.map((preview) => {\n const uploading = preview.assetId === undefined;\n return (\n <div\n key={preview.key}\n className=\"group relative h-16 w-[clamp(76px,30vw,112px)] shrink-0 overflow-hidden rounded-lg border border-neutral-200 bg-neutral-100 shadow-sm\"\n role=\"listitem\"\n >\n <img\n src={preview.src}\n alt={preview.name}\n className=\"size-full object-cover\"\n />\n <div className=\"absolute inset-x-0 bottom-0 truncate bg-gradient-to-t from-black/75 to-transparent px-1.5 pb-1 pt-4 text-[10px] font-medium text-white\">\n {preview.name}\n </div>\n {uploading ? (\n <span\n className=\"absolute left-1 top-1 inline-flex size-5 items-center justify-center rounded-full bg-black/65 text-white\"\n title=\"Uploading image\"\n >\n <LoaderCircleIcon className=\"size-3 animate-spin\" />\n </span>\n ) : (\n <button\n type=\"button\"\n onClick={() => onRemove(preview)}\n className=\"absolute right-1 top-1 inline-flex size-5 items-center justify-center rounded-full bg-black/65 text-white opacity-80 transition-opacity hover:bg-black/80 hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white\"\n aria-label={`Remove ${preview.name}`}\n title=\"Remove image\"\n >\n <XIcon className=\"size-3\" />\n </button>\n )}\n </div>\n );\n })}\n </div>\n );\n}\n\nexport const TiptapComposer = forwardRef<\n TiptapComposerHandle,\n TiptapComposerProps\n>(\n (\n {\n placeholder = \"Message Athena... (type @ to mention)\",\n threadId,\n disabled = false,\n appearance = \"default\",\n webpages = NO_WEBPAGES,\n tools,\n rootCategories,\n onDraftStateChange,\n showImagePreviews = false,\n onAttachmentError,\n fileIntake,\n waitForHostUploads,\n interceptSubmit,\n onSubmitted,\n },\n outerRef,\n ) => {\n const aui = useAui();\n const composerInput = unstable_useComposerInput();\n const handoff = useComposerHandoffStore();\n const applyingRuntimeTextRef = useRef(false);\n // What this editor last mirrored into the composer runtime; a value equal to\n // it is our own echo and needs no re-serialization or restore.\n const lastEmittedMarkdownRef = useRef<string | null>(null);\n // The returned send last loaded from its draft: the runtime still holds its\n // verbatim text, which must not be parsed over the draft on a later pass.\n const restoredSendRef = useRef<string | null>(null);\n const listRef = useRef<KeyboardNavigationHandle>(null);\n const pendingUploadsRef = useRef(new PendingAttachmentUploads());\n const submitInFlightRef = useRef(false);\n const imagePreviewsRef = useRef<ComposerImagePreview[]>([]);\n const [imagePreviews, setImagePreviews] = useState<ComposerImagePreview[]>([]);\n\n const replaceImagePreviews = useCallback((next: ComposerImagePreview[]) => {\n imagePreviewsRef.current = next;\n setImagePreviews(next);\n }, []);\n\n const removeImagePreviews = useCallback(\n (shouldRemove: (preview: ComposerImagePreview) => boolean) => {\n const kept: ComposerImagePreview[] = [];\n let removed = false;\n for (const preview of imagePreviewsRef.current) {\n if (shouldRemove(preview)) {\n revokeImagePreview(preview.src);\n removed = true;\n } else kept.push(preview);\n }\n if (removed) replaceImagePreviews(kept);\n },\n [replaceImagePreviews],\n );\n\n const clearImagePreviews = useCallback(() => {\n removeImagePreviews(() => true);\n }, [removeImagePreviews]);\n\n useEffect(() => clearImagePreviews(), [clearImagePreviews, threadId]);\n useEffect(\n () => () => {\n for (const preview of imagePreviewsRef.current) {\n revokeImagePreview(preview.src);\n }\n imagePreviewsRef.current = [];\n },\n [],\n );\n\n const { store } = useMentionSuggestions({ webpages, tools, rootCategories });\n\n // Popup state\n const [popupOpen, setPopupOpen] = useState(false);\n const popupOpenRef = useRef(false);\n const [popupProps, setPopupProps] = useState<MentionSuggestionRenderProps | null>(null);\n\n // Suggestion callbacks — drive the popup lifecycle\n const callbacksRef = useRef<MentionSuggestionCallbacks>({\n onStart: (props) => {\n setPopupOpen(true);\n popupOpenRef.current = true;\n setPopupProps(props);\n },\n onUpdate: (props) => {\n setPopupProps(props);\n },\n onKeyDown: (event) => {\n // Route keyboard events to the MentionSuggestionList\n return listRef.current?.onKeyDown(event) ?? false;\n },\n onExit: () => {\n setPopupOpen(false);\n popupOpenRef.current = false;\n setPopupProps(null);\n },\n });\n\n // Editor ref — needed because handleSubmit is created before useEditor returns\n const editorRef = useRef<ReturnType<typeof useEditor>>(null);\n\n // Submit via composer runtime so attachments (screenshots, files) are included.\n // aui.composer.setText() + aui.composer.send() bundles text + pending attachments.\n //\n // Statewire turns a send during an active run into a queued command. Do not\n // cancel first: cancellation aborts the shared run for every connected\n // client and turns a normal queued follow-up into a destructive stop.\n const handleSubmit = useCallback(async () => {\n if (disabled) return;\n if (submitInFlightRef.current) return;\n submitInFlightRef.current = true;\n try {\n await pendingUploadsRef.current.waitForIdle();\n await waitForHostUploads?.();\n const ed = editorRef.current;\n if (!ed) return;\n // The model reads the sent text literally, so plain text goes out\n // exactly as typed; the draft keeps its Markdown escaping.\n const { text, draftMarkdown } = captureComposerSend(ed);\n\n // Interception carries TEXT only: a draft with pending attachments\n // (screenshots, files) must ride the composer-runtime send that\n // bundles them, or the attachments would silently vanish. Attachment\n // state is read only when a host actually intercepts. It runs before\n // the empty check because a host may compose extras of its own into\n // an otherwise empty draft (AthenaChat's quote and attachment pills).\n if (interceptSubmit) {\n const hasAttachments =\n (aui.composer.getState().attachments?.length ?? 0) > 0;\n if (!hasAttachments && (await interceptSubmit(text, draftMarkdown))) {\n ed.commands.clearContent(false);\n clearImagePreviews();\n onDraftStateChange?.(false);\n onSubmitted?.();\n return;\n }\n }\n\n if (!text) return;\n if (!composerInput.canSend) return;\n\n // A send statewire hands back (refused during a reconnect) is restored\n // from the draft it was sent from, not parsed from its verbatim text;\n // the message carries that draft so its bubble shows it as typed.\n prepareComposerSend({ threadId, text, draftMarkdown });\n composerInput.setText(text);\n composerInput.send({ steer: false });\n\n ed.commands.clearContent(false);\n clearImagePreviews();\n onDraftStateChange?.(false);\n onSubmitted?.();\n } finally {\n submitInFlightRef.current = false;\n }\n }, [\n clearImagePreviews,\n composerInput,\n disabled,\n interceptSubmit,\n onDraftStateChange,\n onSubmitted,\n threadId,\n waitForHostUploads,\n ]);\n\n const handleSubmitRef = useRef(handleSubmit);\n handleSubmitRef.current = handleSubmit;\n\n const addAttachment = useCallback(\n (file: File) => {\n let previewKey: string | undefined;\n if (\n showImagePreviews &&\n file.type.startsWith(\"image/\") &&\n typeof URL.createObjectURL === \"function\"\n ) {\n previewKey = crypto.randomUUID();\n replaceImagePreviews([\n ...imagePreviewsRef.current,\n {\n key: previewKey,\n file,\n name: file.name || \"Pasted image\",\n src: URL.createObjectURL(file),\n },\n ]);\n }\n\n return pendingUploadsRef.current\n .track(aui.composer.addAttachment(file))\n .catch((error: unknown) => {\n if (previewKey) {\n removeImagePreviews((preview) => preview.key === previewKey);\n }\n throw error;\n });\n },\n [aui, removeImagePreviews, replaceImagePreviews, showImagePreviews],\n );\n\n // Handle paste events — intercept images from clipboard and add as attachments\n const handlePaste = useCallback(\n (_view: unknown, event: ClipboardEvent) => {\n const clipboardData = event.clipboardData;\n if (!clipboardData) return false;\n\n const images = extractPastedImages({ clipboardData });\n if (images.length === 0) return false;\n // Office and spreadsheet copies put the cells' text beside a bitmap of\n // them: the text is what the user copied, so the editor's native paste\n // keeps it and the incidental screenshot is left alone. A copied image\n // file's own name (Finder, Explorer) is not such text.\n if (\n clipboardHasMeaningfulText({\n clipboardData,\n pastedFileNames: images.map((image) => image.originalName),\n })\n ) {\n return false;\n }\n event.preventDefault();\n\n const files = images.map((image) => image.file);\n if (fileIntake) {\n fileIntake.onPaste(files);\n return true;\n }\n for (const file of files) {\n void addAttachment(file).catch((error: unknown) => {\n onAttachmentError?.(\"Couldn’t paste that image.\");\n athenaDiagnostics.error(\n \"composer.attachment.error\",\n error,\n { code: \"attachment_failed\", message: \"Pasted image upload failed\" },\n { source: \"paste\", type: file.type },\n );\n });\n }\n return true;\n },\n [addAttachment, fileIntake, onAttachmentError],\n );\n\n // Without a host intake the composer attaches dropped images itself; a host\n // intake without `onDrop` leaves drops to the enclosing drop zone.\n const addDroppedImages = useCallback(\n (files: FileList | readonly File[]) => {\n const images = Array.from(files).filter((file) =>\n file.type.startsWith(\"image/\"),\n );\n if (images.length === 0) return false;\n if (fileIntake) {\n if (!fileIntake.onDrop) return false;\n fileIntake.onDrop(images);\n return true;\n }\n for (const file of images) {\n void addAttachment(file).catch((error: unknown) => {\n onAttachmentError?.(\"Couldn’t attach that dropped image.\");\n athenaDiagnostics.error(\n \"composer.attachment.error\",\n error,\n { code: \"attachment_failed\", message: \"Dropped image upload failed\" },\n { source: \"drop\", type: file.type },\n );\n });\n }\n return true;\n },\n [addAttachment, fileIntake, onAttachmentError],\n );\n\n // Read through a ref: the mention inserter is defined after the editor.\n const disabledRef = useRef(disabled);\n disabledRef.current = disabled;\n const insertAssetMentionRef = useRef<(asset: UploadedChatAsset) => void>(\n () => {},\n );\n\n // A Spaces asset dragged in from Olympus becomes a mention. Without this,\n // ProseMirror pastes the drag's text — FlexLayout's `--flexlayout--`.\n const handleAssetDrop = useCallback(\n (event: DragEvent, view?: EditorView): boolean => {\n if (disabledRef.current || !event.dataTransfer) return false;\n const dropped = readAthenaAssetDrop(event.dataTransfer);\n if (!dropped) return false;\n event.preventDefault();\n if (dropped.kind !== \"asset\") return true;\n const position = view?.posAtCoords({\n left: event.clientX,\n top: event.clientY,\n });\n if (view) {\n // A drop outside the text (e.g. on the preview strip) lands at the\n // end rather than replacing whatever is selected.\n const { state } = view;\n view.dispatch(\n state.tr.setSelection(\n position\n ? Selection.near(state.doc.resolve(position.pos))\n : Selection.atEnd(state.doc),\n ),\n );\n }\n insertAssetMentionRef.current(dropped.asset);\n return true;\n },\n [],\n );\n\n // ProseMirror owns drops that land in the editable surface. The React\n // wrapper below catches the rest of the composer area; defaultPrevented\n // keeps one gesture from being attached twice.\n const handleDrop = useCallback(\n (view: EditorView, event: DragEvent) => {\n if (handleAssetDrop(event, view)) return true;\n const files = event.dataTransfer?.files;\n if (!files?.length) return false;\n const handled = addDroppedImages(files);\n if (handled) event.preventDefault();\n return handled;\n },\n [addDroppedImages, handleAssetDrop],\n );\n\n const handleComposerDrop = useCallback(\n (event: ReactDragEvent<HTMLDivElement>) => {\n if (event.defaultPrevented) return;\n if (handleAssetDrop(event.nativeEvent, editorRef.current?.view)) return;\n if (addDroppedImages(event.dataTransfer.files)) event.preventDefault();\n },\n [addDroppedImages, handleAssetDrop],\n );\n\n // Read through a ref so a host can change the hint (e.g. while a run is\n // live) without rebuilding the editor; the effect below repaints it.\n const placeholderRef = useRef(placeholder);\n placeholderRef.current = placeholder;\n const editor = useEditor({\n editable: !disabled,\n extensions: [\n ...createChatTextExtensions(),\n ComposerDraftWhitespace,\n Placeholder.configure({ placeholder: () => placeholderRef.current }),\n MentionSuggestionsExtension.configure({\n store,\n callbacks: callbacksRef.current,\n }),\n SubmitKeybind.configure({\n onSubmit: () => void handleSubmitRef.current(),\n isMentionOpen: () => popupOpenRef.current,\n }),\n ],\n editorProps: {\n attributes: {\n class: cn(CHAT_TEXT_CLASS, \"w-full resize-none bg-transparent px-1.5 py-2 outline-none\"),\n \"data-testid\": \"athena-chat-composer\",\n },\n handlePaste,\n handleDrop,\n },\n onUpdate: ({ editor: updatedEditor }) => {\n const nextText = serializeDraft(updatedEditor);\n lastEmittedMarkdownRef.current = nextText;\n if (!applyingRuntimeTextRef.current) {\n composerInput.setText(nextText);\n }\n onDraftStateChange?.(nextText.trim().length > 0);\n\n if (showImagePreviews) {\n const mentionedAssetIds = new Set<string>();\n updatedEditor.state.doc.descendants((node) => {\n if (\n node.type.name === \"mention\" &&\n node.attrs.type === \"asset\" &&\n typeof node.attrs.id === \"string\"\n ) {\n mentionedAssetIds.add(node.attrs.id);\n }\n });\n removeImagePreviews(\n (preview) =>\n preview.assetId !== undefined &&\n !mentionedAssetIds.has(preview.assetId),\n );\n }\n },\n immediatelyRender: false,\n });\n\n // Keep ref in sync so handleSubmit always has the editor\n editorRef.current = editor;\n\n useEffect(() => {\n editor?.setEditable(!disabled);\n }, [disabled, editor]);\n\n // The placeholder decoration is recomputed per transaction; an empty one\n // repaints a changed hint at once.\n useEffect(() => {\n if (!editor || editor.isDestroyed) return;\n editor.view.dispatch(editor.state.tr.setMeta(\"addToHistory\", false));\n }, [editor, placeholder]);\n\n // This rich editor replaces ComposerPrimitive.Input, so it must mirror its\n // draft into assistant-ui's composer state. Statewire restores that state\n // when a send is rejected during reconnect, and a host may write to it\n // (`useAppendToComposer`); mirroring it back into Tiptap — parsed as the\n // Markdown it was serialized to, mention links included — preserves the\n // user's message instead of leaving an empty composer. A send this composer\n // made (its text is verbatim) that comes back to the empty composer soon\n // after loads the draft it was sent from (`draftForReturnedSend`); any other\n // value, a host's prefill included, is parsed as Markdown. Our own echo is\n // skipped on the ref; a restore's re-serialization may differ from the\n // value byte-for-byte, so the ref takes that form to stop a second pass,\n // and a returned send already loaded from its draft is not loaded again.\n useEffect(() => {\n if (!editor) return;\n const value = composerInput.value;\n if (value === lastEmittedMarkdownRef.current) return;\n if (value === restoredSendRef.current) return;\n restoredSendRef.current = null;\n const currentMarkdown = serializeDraft(editor);\n lastEmittedMarkdownRef.current = currentMarkdown;\n // Statewire puts a refused send back only into an empty composer.\n const returnedDraft: string | null = editor.isEmpty\n ? draftForReturnedSend({ threadId, text: value })\n : null;\n const restored = returnedDraft ?? value;\n if (restored === currentMarkdown) return;\n // React node views flush their mounts synchronously. Restore outside\n // React's effect phase, and cancel a restore superseded by a newer draft.\n let cancelled = false;\n queueMicrotask(() => {\n if (cancelled || editor.isDestroyed) return;\n applyingRuntimeTextRef.current = true;\n try {\n editor.commands.setContent(restored, { emitUpdate: false });\n lastEmittedMarkdownRef.current = serializeDraft(editor);\n if (returnedDraft !== null) restoredSendRef.current = value;\n } finally {\n applyingRuntimeTextRef.current = false;\n }\n onDraftStateChange?.(value.trim().length > 0);\n // A host prefill (`useAppendToComposer(..., { focus: true })`) asked\n // for the caret after its text: now that the text is on screen.\n if (handoff?.focusOnNextMirror) {\n handoff.focusOnNextMirror = false;\n editor.commands.focus(\"end\");\n }\n });\n return () => { cancelled = true; };\n }, [composerInput.value, editor, handoff, onDraftStateChange, threadId]);\n\n // Lets host UI outside the chat place the caret at the end of the draft\n // (`useAppendToComposer` focus option) without reaching into the DOM.\n useEffect(() => {\n if (!editor || !handoff) return;\n handoff.focusEnd = () => {\n if (!editor.isDestroyed) editor.commands.focus(\"end\");\n };\n // `useFocusComposer` asked before this editor mounted.\n if (handoff.focusOnMount) {\n handoff.focusOnMount = false;\n handoff.focusEnd();\n }\n return () => {\n handoff.focusEnd = null;\n };\n }, [editor, handoff]);\n\n const insertAssetMention = useCallback(\n (asset: UploadedChatAsset, sourceFile?: File) => {\n const currentEditor = editorRef.current;\n if (!currentEditor) throw new Error(\"The chat composer is not ready.\");\n currentEditor\n .chain()\n .focus()\n .insertContent({\n type: \"mention\",\n attrs: {\n type: \"asset\",\n name: asset.title,\n id: asset.id,\n assetType: asset.assetType,\n displayAsPreview:\n showImagePreviews && sourceFile?.type.startsWith(\"image/\"),\n },\n })\n // A text node, not a string: the Markdown extension parses string\n // content as Markdown, which would drop a lone space.\n .insertContent({ type: \"text\", text: \" \" })\n .run();\n\n if (\n showImagePreviews &&\n sourceFile?.type.startsWith(\"image/\") &&\n typeof URL.createObjectURL === \"function\"\n ) {\n const existing = imagePreviewsRef.current.find(\n (preview) => preview.file === sourceFile,\n );\n if (existing) {\n replaceImagePreviews(\n imagePreviewsRef.current.map((preview) =>\n preview.key === existing.key\n ? { ...preview, assetId: asset.id, name: asset.title }\n : preview,\n ),\n );\n } else {\n replaceImagePreviews([\n ...imagePreviewsRef.current,\n {\n key: crypto.randomUUID(),\n file: sourceFile,\n name: asset.title,\n src: URL.createObjectURL(sourceFile),\n assetId: asset.id,\n },\n ]);\n }\n }\n },\n [replaceImagePreviews, showImagePreviews],\n );\n insertAssetMentionRef.current = insertAssetMention;\n\n const removeImagePreview = useCallback(\n (preview: ComposerImagePreview) => {\n if (!preview.assetId) return;\n const currentEditor = editorRef.current;\n if (!currentEditor) return;\n const positions: Array<{ from: number; to: number }> = [];\n currentEditor.state.doc.descendants((node, position) => {\n if (\n node.type.name === \"mention\" &&\n node.attrs.type === \"asset\" &&\n node.attrs.id === preview.assetId\n ) {\n positions.push({ from: position, to: position + node.nodeSize });\n }\n });\n let transaction = currentEditor.state.tr;\n for (const position of positions.reverse()) {\n transaction = transaction.delete(position.from, position.to);\n }\n if (transaction.docChanged) currentEditor.view.dispatch(transaction);\n removeImagePreviews((candidate) => candidate.key === preview.key);\n currentEditor.commands.focus();\n },\n [removeImagePreviews],\n );\n\n useEffect(\n () => registerChatAssetMentionHandler(threadId, insertAssetMention),\n [insertAssetMention, threadId],\n );\n\n const openMentionMenu = useCallback(() => {\n if (disabled) return;\n const currentEditor = editorRef.current;\n if (!currentEditor || currentEditor.isDestroyed) return;\n if (popupOpenRef.current) {\n currentEditor.commands.focus();\n return;\n }\n // The suggestion plugin only opens on an `@` that starts a word\n // (`allowedPrefixes`), so a trigger typed right after text — or after a\n // mention chip, which `textBetween` reports as its leaf text — gets the\n // separating space a user would type.\n const { from } = currentEditor.state.selection;\n const before =\n from > 0\n ? currentEditor.state.doc.textBetween(from - 1, from, \"\\0\", \"\\0\")\n : \"\";\n const needsSpace = before.length > 0 && !/[\\s([{\"']/.test(before);\n currentEditor\n .chain()\n .focus()\n .insertContent({ type: \"text\", text: needsSpace ? \" @\" : \"@\" })\n .run();\n }, [disabled]);\n\n const appendText = useCallback((text: string) => {\n const currentEditor = editorRef.current;\n if (currentEditor) appendPlainText(currentEditor, text);\n }, []);\n\n const captureSend = useCallback((): ComposerSend | null => {\n const currentEditor = editorRef.current;\n return currentEditor && !currentEditor.isDestroyed\n ? captureComposerSend(currentEditor)\n : null;\n }, []);\n\n useImperativeHandle(\n outerRef,\n () => ({\n submit: handleSubmit,\n addAttachment,\n insertAssetMention,\n openMentionMenu,\n appendText,\n captureSend,\n }),\n [\n addAttachment,\n appendText,\n captureSend,\n handleSubmit,\n insertAssetMention,\n openMentionMenu,\n ],\n );\n\n return (\n <>\n <style>{MENTION_STYLES}</style>\n <div\n className={cn(\n \"athena-chat-composer flex-1 min-w-0\",\n appearance === \"paper\" && \"athena-chat-composer--paper\",\n showImagePreviews && \"image-preview-composer\",\n )}\n aria-label=\"Message composer\"\n aria-disabled={disabled}\n onDragOver={(event) => {\n const types = Array.from(event.dataTransfer.types);\n if (\n types.includes(\"Files\") ||\n (!disabled && isAthenaAssetDrag(types))\n ) {\n event.preventDefault();\n event.dataTransfer.dropEffect = \"copy\";\n }\n }}\n onDrop={handleComposerDrop}\n >\n <ImagePreviewStrip\n previews={imagePreviews}\n onRemove={removeImagePreview}\n />\n <EditorContent editor={editor} />\n </div>\n\n {/* Olympus-style mention popup */}\n {popupOpen && popupProps && editor && (\n <MentionSuggestionPopup clientRect={popupProps.clientRect}>\n <MentionSuggestionList\n ref={listRef}\n store={store}\n editor={editor}\n query={popupProps.query}\n command={(item: MenuItem) => popupProps.command(item)}\n closeMenu={() => {\n setPopupOpen(false);\n editor.commands.focus();\n }}\n />\n </MentionSuggestionPopup>\n )}\n </>\n );\n },\n);\n\nTiptapComposer.displayName = \"TiptapComposer\";\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuFA,MAAM,gBAAgB,UAAU,OAA+D;AAAA,EAC7F,MAAM;AAAA,EACN,UAAU;AAAA,EACV,aAAa;AACX,WAAO,EAAE,UAAU,MAAM;AAAA,IAAC,GAAG,eAAe,MAAM,MAAA;AAAA,EACpD;AAAA,EACA,uBAAuB;AACrB,WAAO;AAAA,MACL,OAAO,MAAM;AAEX,YAAI,KAAK,QAAQ,cAAA,EAAiB,QAAO;AAEzC,YAAI,qBAAqB,KAAK,MAAM,EAAG,QAAO;AAG9C,YAAI,CAAC,YAAY,YAAY,aAAa,SAAS,YAAY,EAAE;AAAA,UAC/D,CAAC,SAAS,KAAK,OAAO,SAAS,IAAI;AAAA,QAAA,EAClC,QAAO;AACV,aAAK,QAAQ,SAAA;AACb,eAAO;AAAA,MACT;AAAA,MACA,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package/dist/chat-ui/index.cjs
CHANGED
|
@@ -9,6 +9,7 @@ const composerSendOrStop = require("./thread/composer-send-or-stop.cjs");
|
|
|
9
9
|
const chatHeader = require("./header/chat-header.cjs");
|
|
10
10
|
const conversationHistoryPanel = require("./header/conversation-history-panel.cjs");
|
|
11
11
|
const tiptapComposer = require("./composer/tiptap-composer.cjs");
|
|
12
|
+
const composerMessage = require("./composer/composer-message.cjs");
|
|
12
13
|
const pendingAttachmentUploads = require("./composer/pending-attachment-uploads.cjs");
|
|
13
14
|
const composerAction = require("./composer/composer-action.cjs");
|
|
14
15
|
const mentionExtension = require("./mentions/mention-extension.cjs");
|
|
@@ -39,7 +40,7 @@ const StatewireApprovalCard = require("../chat/StatewireApprovalCard.cjs");
|
|
|
39
40
|
const useStatewireApprovalRequest = require("../chat/use-statewire-approval-request.cjs");
|
|
40
41
|
const StatewireQueuedMessages = require("../chat/StatewireQueuedMessages.cjs");
|
|
41
42
|
const WaitingOnYouBanner = require("../chat/WaitingOnYouBanner.cjs");
|
|
42
|
-
const interrupts = require("../
|
|
43
|
+
const interrupts = require("../agent-runtime/src/interrupts.cjs");
|
|
43
44
|
exports.ChatThreadShell = chatThreadShell.ChatThreadShell;
|
|
44
45
|
exports.ChatComposerDock = chatComposerDock.ChatComposerDock;
|
|
45
46
|
exports.HISTORY_EDGE_NEAR_MARGIN_PX = statewireHistoryEdge.HISTORY_EDGE_NEAR_MARGIN_PX;
|
|
@@ -58,6 +59,7 @@ exports.ChatHeaderRoot = chatHeader.ChatHeaderRoot;
|
|
|
58
59
|
exports.ConversationHistoryPanel = conversationHistoryPanel.ConversationHistoryPanel;
|
|
59
60
|
exports.TiptapComposer = tiptapComposer.TiptapComposer;
|
|
60
61
|
exports.serializeDraft = tiptapComposer.serializeDraft;
|
|
62
|
+
exports.prepareComposerSend = composerMessage.prepareComposerSend;
|
|
61
63
|
exports.PendingAttachmentUploads = pendingAttachmentUploads.PendingAttachmentUploads;
|
|
62
64
|
exports.resolveComposerAction = composerAction.resolveComposerAction;
|
|
63
65
|
exports.MentionExtension = mentionExtension.MentionExtension;
|
|
@@ -102,6 +104,7 @@ exports.ComposerStopButton = messageComponents.ComposerStopButton;
|
|
|
102
104
|
exports.MarkdownText = messageComponents.MarkdownText;
|
|
103
105
|
exports.THREAD_SCROLL_TO_BOTTOM_CLASS = messageComponents.THREAD_SCROLL_TO_BOTTOM_CLASS;
|
|
104
106
|
exports.UserMessage = messageComponents.UserMessage;
|
|
107
|
+
exports.UserMessageText = messageComponents.UserMessageText;
|
|
105
108
|
exports.createAssistantMessage = messageComponents.createAssistantMessage;
|
|
106
109
|
exports.IconButton = threadChrome.IconButton;
|
|
107
110
|
exports.SmallIconButton = threadChrome.SmallIconButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/chat-ui/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export type { ComposerSendOrStopComponents, ComposerSendOrStopProps, ComposerSto
|
|
|
19
19
|
export { ChatHeader, ChatHeaderActions, ChatHeaderIdentity, ChatHeaderRoot, } from './header/chat-header';
|
|
20
20
|
export { ConversationHistoryPanel, type ConversationActivityFilter, type ConversationHistoryPanelProps, } from './header/conversation-history-panel';
|
|
21
21
|
export { TiptapComposer, serializeDraft, type ComposerFileIntake, type TiptapComposerAppearance, type TiptapComposerHandle, type TiptapComposerProps, } from "./composer/tiptap-composer";
|
|
22
|
+
export { type ComposerSend, prepareComposerSend } from "./composer/composer-message";
|
|
22
23
|
export { PendingAttachmentUploads } from "./composer/pending-attachment-uploads";
|
|
23
24
|
export { resolveComposerAction, type ComposerAction, } from "./composer/composer-action";
|
|
24
25
|
export { MentionExtension, makeMentionUrl, parseAssetAnchorAttributes, parseMentionAnchorAttributes, serializeMention, } from "./mentions/mention-extension";
|
|
@@ -34,7 +35,7 @@ export { buildRootMenuItems } from "./mentions/suggestions/data/sources";
|
|
|
34
35
|
export { assetTypeToIcon, assetTypeToThumb, configureAssetIconBasePath, } from "./mentions/suggestions/data/sources/asset-type-icons";
|
|
35
36
|
export { MentionMenuSection, type MentionTool, type MenuItem, type MenuScope, type WebpageMention, type WebpageMentionScope, } from "./mentions/suggestions/data/types";
|
|
36
37
|
export { createOlympusAssetUrl } from "./lib/asset-urls";
|
|
37
|
-
export { COMPOSER_DOCK_CLASS, COMPOSER_EDITOR_ROW_CLASS, COMPOSER_PAPER_DOCK_CLASS, COMPOSER_PAPER_EDITOR_ROW_CLASS, COMPOSER_PAPER_SURFACE_CLASS, COMPOSER_PAPER_TOOLBAR_CLASS, COMPOSER_SURFACE_CLASS, COMPOSER_TOOLBAR_CLASS, BranchPicker, ComposerSendButton, ComposerStopButton, type ComposerSendButtonProps, type ComposerStopButtonProps, MarkdownText, THREAD_SCROLL_TO_BOTTOM_CLASS, UserMessage, createAssistantMessage, type CreateAssistantMessageOptions, } from "./messages/message-components";
|
|
38
|
+
export { COMPOSER_DOCK_CLASS, COMPOSER_EDITOR_ROW_CLASS, COMPOSER_PAPER_DOCK_CLASS, COMPOSER_PAPER_EDITOR_ROW_CLASS, COMPOSER_PAPER_SURFACE_CLASS, COMPOSER_PAPER_TOOLBAR_CLASS, COMPOSER_SURFACE_CLASS, COMPOSER_TOOLBAR_CLASS, BranchPicker, ComposerSendButton, ComposerStopButton, type ComposerSendButtonProps, type ComposerStopButtonProps, MarkdownText, THREAD_SCROLL_TO_BOTTOM_CLASS, UserMessage, UserMessageText, createAssistantMessage, type CreateAssistantMessageOptions, } from "./messages/message-components";
|
|
38
39
|
export { IconButton, SmallIconButton, THREAD_HEADER_ACTIONS_CLASS, THREAD_HEADER_CLASS, THREAD_HEADER_ICON_CLASS, THREAD_HEADER_PILL_CLASS, THREAD_PANEL_CLASS, } from "./messages/thread-chrome";
|
|
39
40
|
export { UserEditComposer } from "./messages/user-edit-composer";
|
|
40
41
|
export { MessageActionsReadOnlyProvider, useMessageActionsReadOnly, } from "./messages/message-actions-config";
|
|
@@ -47,6 +48,6 @@ export { ContinuePill } from "./messages/continue-pill";
|
|
|
47
48
|
export { type ReadStatewireTailEnding, StatewireContinueRunAffordance, StatewireContinueRunButton, type StatewireContinueRunButtonProps, StatewireRunEndedFooter, type StatewireRunEndedFooterActionsContext, type StatewireRunEndedFooterProps, type StatewireTailEnding, } from "./messages/statewire-continue-run";
|
|
48
49
|
export { StatewireApprovalCard, type StatewireApprovalCardProps, type StatewireApprovalEditorContext, type StatewireApprovalRequestContext, } from "../chat/StatewireApprovalCard";
|
|
49
50
|
export { type StatewireApprovalRequest, type StatewireInterruptPredicate, type UseStatewireApprovalRequestOptions, useStatewireApprovalRequest, } from "../chat/use-statewire-approval-request";
|
|
50
|
-
export { StatewireQueuedMessages, type StatewireQueueEditorContext, type StatewireQueueEvent, type StatewireQueueRowContentContext, type StatewireQueuedMessagesProps, } from "../chat/StatewireQueuedMessages";
|
|
51
|
+
export { StatewireQueuedMessages, type StatewireQueueEditorContext, type StatewireQueueEvent, type StatewireQueueRowContentContext, type StatewireQueueRowMarkerContext, type StatewireQueuedMessagesProps, } from "../chat/StatewireQueuedMessages";
|
|
51
52
|
export { WaitingOnYouBanner, type WaitingOnYouBannerProps, WaitingOnYouBannerView, type WaitingOnYouBannerViewProps, } from "../chat/WaitingOnYouBanner";
|
|
52
53
|
export { HITL_PENDING_RESUME_GRACE_MS } from "@athenaintel/agent-runtime";
|
package/dist/chat-ui/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import { ComposerSendOrStop } from "./thread/composer-send-or-stop.js";
|
|
|
7
7
|
import { ChatHeader, ChatHeaderActions, ChatHeaderIdentity, ChatHeaderRoot } from "./header/chat-header.js";
|
|
8
8
|
import { ConversationHistoryPanel } from "./header/conversation-history-panel.js";
|
|
9
9
|
import { TiptapComposer, serializeDraft } from "./composer/tiptap-composer.js";
|
|
10
|
+
import { prepareComposerSend } from "./composer/composer-message.js";
|
|
10
11
|
import { PendingAttachmentUploads } from "./composer/pending-attachment-uploads.js";
|
|
11
12
|
import { resolveComposerAction } from "./composer/composer-action.js";
|
|
12
13
|
import { MentionExtension, makeMentionUrl, parseAssetAnchorAttributes, parseMentionAnchorAttributes, serializeMention } from "./mentions/mention-extension.js";
|
|
@@ -22,7 +23,7 @@ import { buildRootMenuItems } from "./mentions/suggestions/data/sources/index.js
|
|
|
22
23
|
import { assetTypeToIcon, assetTypeToThumb, configureAssetIconBasePath } from "./mentions/suggestions/data/sources/asset-type-icons.js";
|
|
23
24
|
import { MentionMenuSection } from "./mentions/suggestions/data/types.js";
|
|
24
25
|
import { createOlympusAssetUrl } from "./lib/asset-urls.js";
|
|
25
|
-
import { BranchPicker, COMPOSER_DOCK_CLASS, COMPOSER_EDITOR_ROW_CLASS, COMPOSER_PAPER_DOCK_CLASS, COMPOSER_PAPER_EDITOR_ROW_CLASS, COMPOSER_PAPER_SURFACE_CLASS, COMPOSER_PAPER_TOOLBAR_CLASS, COMPOSER_SURFACE_CLASS, COMPOSER_TOOLBAR_CLASS, ComposerSendButton, ComposerStopButton, MarkdownText, THREAD_SCROLL_TO_BOTTOM_CLASS, UserMessage, createAssistantMessage } from "./messages/message-components.js";
|
|
26
|
+
import { BranchPicker, COMPOSER_DOCK_CLASS, COMPOSER_EDITOR_ROW_CLASS, COMPOSER_PAPER_DOCK_CLASS, COMPOSER_PAPER_EDITOR_ROW_CLASS, COMPOSER_PAPER_SURFACE_CLASS, COMPOSER_PAPER_TOOLBAR_CLASS, COMPOSER_SURFACE_CLASS, COMPOSER_TOOLBAR_CLASS, ComposerSendButton, ComposerStopButton, MarkdownText, THREAD_SCROLL_TO_BOTTOM_CLASS, UserMessage, UserMessageText, createAssistantMessage } from "./messages/message-components.js";
|
|
26
27
|
import { IconButton, SmallIconButton, THREAD_HEADER_ACTIONS_CLASS, THREAD_HEADER_CLASS, THREAD_HEADER_ICON_CLASS, THREAD_HEADER_PILL_CLASS, THREAD_PANEL_CLASS } from "./messages/thread-chrome.js";
|
|
27
28
|
import { UserEditComposer } from "./messages/user-edit-composer.js";
|
|
28
29
|
import { MessageActionsReadOnlyProvider, useMessageActionsReadOnly } from "./messages/message-actions-config.js";
|
|
@@ -37,7 +38,7 @@ import { StatewireApprovalCard } from "../chat/StatewireApprovalCard.js";
|
|
|
37
38
|
import { useStatewireApprovalRequest } from "../chat/use-statewire-approval-request.js";
|
|
38
39
|
import { StatewireQueuedMessages } from "../chat/StatewireQueuedMessages.js";
|
|
39
40
|
import { WaitingOnYouBanner, WaitingOnYouBannerView } from "../chat/WaitingOnYouBanner.js";
|
|
40
|
-
import { HITL_PENDING_RESUME_GRACE_MS } from "../
|
|
41
|
+
import { HITL_PENDING_RESUME_GRACE_MS } from "../agent-runtime/src/interrupts.js";
|
|
41
42
|
export {
|
|
42
43
|
BranchPicker,
|
|
43
44
|
COMPOSER_DOCK_CLASS,
|
|
@@ -107,6 +108,7 @@ export {
|
|
|
107
108
|
TiptapComposer,
|
|
108
109
|
UserEditComposer,
|
|
109
110
|
UserMessage,
|
|
111
|
+
UserMessageText,
|
|
110
112
|
VoiceDelegationCard,
|
|
111
113
|
VoiceDelegationMessage,
|
|
112
114
|
WaitingOnYouBanner,
|
|
@@ -126,6 +128,7 @@ export {
|
|
|
126
128
|
parseMentionAnchorAttributes,
|
|
127
129
|
parseMentionUrl,
|
|
128
130
|
parseMentionsInText,
|
|
131
|
+
prepareComposerSend,
|
|
129
132
|
resolveComposerAction,
|
|
130
133
|
serializeDraft,
|
|
131
134
|
serializeMention,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|