@athenaintel/react 0.22.4 → 0.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +394 -4
- package/dist/chat/AthenaChat.cjs +346 -244
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +19 -8
- package/dist/chat/AthenaChat.js +350 -248
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/chat/StatewireApprovalCard.cjs +2 -1
- package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
- package/dist/chat/StatewireApprovalCard.js +2 -1
- package/dist/chat/StatewireApprovalCard.js.map +1 -1
- package/dist/chat/StatewireClientToolBridge.cjs +1 -0
- package/dist/chat/StatewireClientToolBridge.cjs.map +1 -1
- package/dist/chat/StatewireClientToolBridge.js +1 -0
- package/dist/chat/StatewireClientToolBridge.js.map +1 -1
- package/dist/chat/StatewireQueuedMessages.cjs +1 -0
- package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.js +1 -0
- package/dist/chat/StatewireQueuedMessages.js.map +1 -1
- package/dist/chat/WaitingOnYouBanner.cjs +100 -0
- package/dist/chat/WaitingOnYouBanner.cjs.map +1 -0
- package/dist/chat/WaitingOnYouBanner.d.ts +29 -0
- package/dist/chat/WaitingOnYouBanner.js +100 -0
- package/dist/chat/WaitingOnYouBanner.js.map +1 -0
- package/dist/chat/athena-chat-welcome.cjs +148 -0
- package/dist/chat/athena-chat-welcome.cjs.map +1 -0
- package/dist/chat/athena-chat-welcome.d.ts +54 -0
- package/dist/chat/athena-chat-welcome.js +148 -0
- package/dist/chat/athena-chat-welcome.js.map +1 -0
- package/dist/chat/athena-composer-controls.cjs +76 -0
- package/dist/chat/athena-composer-controls.cjs.map +1 -0
- package/dist/chat/athena-composer-controls.d.ts +21 -0
- package/dist/chat/athena-composer-controls.js +76 -0
- package/dist/chat/athena-composer-controls.js.map +1 -0
- package/dist/chat/composer-keyboard-hint.cjs +61 -0
- package/dist/chat/composer-keyboard-hint.cjs.map +1 -0
- package/dist/chat/composer-keyboard-hint.d.ts +33 -0
- package/dist/chat/composer-keyboard-hint.js +61 -0
- package/dist/chat/composer-keyboard-hint.js.map +1 -0
- package/dist/chat/message-time.cjs +64 -0
- package/dist/chat/message-time.cjs.map +1 -0
- package/dist/chat/message-time.d.ts +45 -0
- package/dist/chat/message-time.js +64 -0
- package/dist/chat/message-time.js.map +1 -0
- package/dist/chat/run-activity.cjs +38 -7
- package/dist/chat/run-activity.cjs.map +1 -1
- package/dist/chat/run-activity.d.ts +14 -3
- package/dist/chat/run-activity.js +39 -8
- package/dist/chat/run-activity.js.map +1 -1
- package/dist/chat/statewire-client-tools.cjs +2 -1
- package/dist/chat/statewire-client-tools.cjs.map +1 -1
- package/dist/chat/statewire-client-tools.js +2 -1
- package/dist/chat/statewire-client-tools.js.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.cjs +2 -1
- package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.js +2 -1
- package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
- package/dist/chat/thread-scroll-to-bottom.cjs +24 -0
- package/dist/chat/thread-scroll-to-bottom.cjs.map +1 -0
- package/dist/chat/thread-scroll-to-bottom.d.ts +11 -0
- package/dist/chat/thread-scroll-to-bottom.js +24 -0
- package/dist/chat/thread-scroll-to-bottom.js.map +1 -0
- package/dist/chat/tiptap-text.cjs +26 -95
- package/dist/chat/tiptap-text.cjs.map +1 -1
- package/dist/chat/tiptap-text.d.ts +13 -0
- package/dist/chat/tiptap-text.js +26 -95
- package/dist/chat/tiptap-text.js.map +1 -1
- package/dist/chat/use-athena-run-live.cjs +2 -1
- package/dist/chat/use-athena-run-live.cjs.map +1 -1
- package/dist/chat/use-athena-run-live.js +2 -1
- package/dist/chat/use-athena-run-live.js.map +1 -1
- package/dist/chat/use-statewire-approval-request.cjs +1 -0
- package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
- package/dist/chat/use-statewire-approval-request.js +1 -0
- package/dist/chat/use-statewire-approval-request.js.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.cjs +39 -4
- package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.d.ts +21 -0
- package/dist/chat-ui/composer/tiptap-composer.js +39 -4
- package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
- package/dist/chat-ui/index.cjs +15 -1
- package/dist/chat-ui/index.cjs.map +1 -1
- package/dist/chat-ui/index.d.ts +6 -3
- package/dist/chat-ui/index.js +16 -2
- package/dist/chat-ui/index.js.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.cjs +31 -4
- package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.js +31 -4
- package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
- package/dist/chat-ui/messages/message-components.cjs +19 -1
- package/dist/chat-ui/messages/message-components.cjs.map +1 -1
- package/dist/chat-ui/messages/message-components.d.ts +13 -0
- package/dist/chat-ui/messages/message-components.js +19 -1
- package/dist/chat-ui/messages/message-components.js.map +1 -1
- package/dist/chat-ui/messages/runtime-message.cjs +2 -1
- package/dist/chat-ui/messages/runtime-message.cjs.map +1 -1
- package/dist/chat-ui/messages/runtime-message.js +2 -1
- package/dist/chat-ui/messages/runtime-message.js.map +1 -1
- package/dist/chat-ui/messages/statewire-continue-run.cjs +1 -0
- package/dist/chat-ui/messages/statewire-continue-run.cjs.map +1 -1
- package/dist/chat-ui/messages/statewire-continue-run.js +1 -0
- package/dist/chat-ui/messages/statewire-continue-run.js.map +1 -1
- package/dist/chat-ui/messages/user-edit-composer.cjs +3 -1
- package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
- package/dist/chat-ui/messages/user-edit-composer.js +3 -1
- package/dist/chat-ui/messages/user-edit-composer.js.map +1 -1
- package/dist/chat-ui/messages/wake-marker.cjs +84 -0
- package/dist/chat-ui/messages/wake-marker.cjs.map +1 -0
- package/dist/chat-ui/messages/wake-marker.d.ts +16 -0
- package/dist/chat-ui/messages/wake-marker.js +84 -0
- package/dist/chat-ui/messages/wake-marker.js.map +1 -0
- package/dist/chat-ui/rich-text/chat-blocks.cjs +177 -0
- package/dist/chat-ui/rich-text/chat-blocks.cjs.map +1 -0
- package/dist/chat-ui/rich-text/chat-blocks.d.ts +58 -0
- package/dist/chat-ui/rich-text/chat-blocks.js +177 -0
- package/dist/chat-ui/rich-text/chat-blocks.js.map +1 -0
- package/dist/chat-ui/rich-text/chat-link.cjs +69 -0
- package/dist/chat-ui/rich-text/chat-link.cjs.map +1 -0
- package/dist/chat-ui/rich-text/chat-link.d.ts +24 -0
- package/dist/chat-ui/rich-text/chat-link.js +69 -0
- package/dist/chat-ui/rich-text/chat-link.js.map +1 -0
- package/dist/chat-ui/rich-text/chat-message-body.cjs +144 -18
- package/dist/chat-ui/rich-text/chat-message-body.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-message-body.d.ts +10 -1
- package/dist/chat-ui/rich-text/chat-message-body.js +149 -23
- package/dist/chat-ui/rich-text/chat-message-body.js.map +1 -1
- package/dist/chat-ui/rich-text/chat-node-views.cjs +38 -5
- package/dist/chat-ui/rich-text/chat-node-views.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-node-views.d.ts +11 -0
- package/dist/chat-ui/rich-text/chat-node-views.js +39 -6
- package/dist/chat-ui/rich-text/chat-node-views.js.map +1 -1
- package/dist/chat-ui/rich-text/chat-text-schema.cjs +20 -3
- package/dist/chat-ui/rich-text/chat-text-schema.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-text-schema.d.ts +15 -2
- package/dist/chat-ui/rich-text/chat-text-schema.js +20 -3
- package/dist/chat-ui/rich-text/chat-text-schema.js.map +1 -1
- package/dist/chat-ui/rich-text/citation-anchors.cjs +139 -0
- package/dist/chat-ui/rich-text/citation-anchors.cjs.map +1 -0
- package/dist/chat-ui/rich-text/citation-anchors.d.ts +74 -0
- package/dist/chat-ui/rich-text/citation-anchors.js +139 -0
- package/dist/chat-ui/rich-text/citation-anchors.js.map +1 -0
- package/dist/chat-ui/statewire.cjs +8 -1
- package/dist/chat-ui/statewire.cjs.map +1 -1
- package/dist/chat-ui/statewire.d.ts +2 -0
- package/dist/chat-ui/statewire.js +8 -1
- package/dist/chat-ui/statewire.js.map +1 -1
- package/dist/chat-ui/thread/chat-composer-dock.cjs +27 -6
- package/dist/chat-ui/thread/chat-composer-dock.cjs.map +1 -1
- package/dist/chat-ui/thread/chat-composer-dock.d.ts +21 -1
- package/dist/chat-ui/thread/chat-composer-dock.js +28 -7
- package/dist/chat-ui/thread/chat-composer-dock.js.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.cjs +12 -13
- package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.d.ts +11 -10
- package/dist/chat-ui/thread/statewire-history-edge.js +13 -14
- package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
- package/dist/chat-ui/thread/thread-loading-overlay.cjs +31 -0
- package/dist/chat-ui/thread/thread-loading-overlay.cjs.map +1 -0
- package/dist/chat-ui/thread/thread-loading-overlay.d.ts +14 -0
- package/dist/chat-ui/thread/thread-loading-overlay.js +31 -0
- package/dist/chat-ui/thread/thread-loading-overlay.js.map +1 -0
- package/dist/composer/ComposerDropZone.cjs +8 -1
- package/dist/composer/ComposerDropZone.cjs.map +1 -1
- package/dist/composer/ComposerDropZone.d.ts +6 -0
- package/dist/composer/ComposerDropZone.js +9 -2
- package/dist/composer/ComposerDropZone.js.map +1 -1
- package/dist/diagnostics/errors.cjs +20 -0
- package/dist/diagnostics/errors.cjs.map +1 -1
- package/dist/diagnostics/errors.d.ts +20 -0
- package/dist/diagnostics/errors.js +20 -0
- package/dist/diagnostics/errors.js.map +1 -1
- package/dist/index.cjs +47 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +26 -7
- package/dist/index.js +51 -5
- package/dist/index.js.map +1 -1
- package/dist/lib/use-prefers-reduced-motion.cjs +29 -0
- package/dist/lib/use-prefers-reduced-motion.cjs.map +1 -0
- package/dist/lib/use-prefers-reduced-motion.d.ts +6 -0
- package/dist/lib/use-prefers-reduced-motion.js +29 -0
- package/dist/lib/use-prefers-reduced-motion.js.map +1 -0
- package/dist/packages/agent-runtime/src/conversation-index.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/conversation-index.js.map +1 -1
- package/dist/packages/agent-runtime/src/conversation-list.cjs +59 -0
- package/dist/packages/agent-runtime/src/conversation-list.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/conversation-list.js +60 -1
- package/dist/packages/agent-runtime/src/conversation-list.js.map +1 -1
- package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.cjs +5 -3
- package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.js +5 -3
- package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -1
- package/dist/packages/agent-runtime/src/edit-command.cjs +21 -17
- package/dist/packages/agent-runtime/src/edit-command.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/edit-command.js +22 -18
- package/dist/packages/agent-runtime/src/edit-command.js.map +1 -1
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs +9 -11
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.js +9 -11
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
- package/dist/packages/agent-runtime/src/github-wake-event.cjs +86 -0
- package/dist/packages/agent-runtime/src/github-wake-event.cjs.map +1 -0
- package/dist/packages/agent-runtime/src/github-wake-event.js +86 -0
- package/dist/packages/agent-runtime/src/github-wake-event.js.map +1 -0
- package/dist/packages/agent-runtime/src/message-window.cjs +150 -42
- package/dist/packages/agent-runtime/src/message-window.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/message-window.js +151 -43
- package/dist/packages/agent-runtime/src/message-window.js.map +1 -1
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs +13 -9
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js +13 -9
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
- package/dist/packages/agent-runtime/src/statewire-suspended.cjs +1 -3
- package/dist/packages/agent-runtime/src/statewire-suspended.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/statewire-suspended.js +1 -3
- package/dist/packages/agent-runtime/src/statewire-suspended.js.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.js.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs +61 -30
- package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-thread.js +59 -28
- package/dist/packages/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.cjs +56 -36
- package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.js +59 -39
- package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.js.map +1 -1
- package/dist/packages/react/package.json.cjs +1 -1
- package/dist/packages/react/package.json.js +1 -1
- package/dist/provider/AthenaContext.cjs.map +1 -1
- package/dist/provider/AthenaContext.d.ts +3 -0
- package/dist/provider/AthenaContext.js.map +1 -1
- package/dist/provider/AthenaProvider.cjs +93 -45
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +6 -1
- package/dist/provider/AthenaProvider.js +97 -49
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/runtime/statewire-lifecycle.cjs +2 -1
- package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
- package/dist/runtime/statewire-lifecycle.js +2 -1
- package/dist/runtime/statewire-lifecycle.js.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.cjs +3 -2
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +8 -12
- package/dist/runtime/useAthenaStatewireRuntime.js +3 -2
- package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
- package/dist/search/useAthenaRepoSearch.cjs +94 -0
- package/dist/search/useAthenaRepoSearch.cjs.map +1 -0
- package/dist/search/useAthenaRepoSearch.d.ts +95 -0
- package/dist/search/useAthenaRepoSearch.js +94 -0
- package/dist/search/useAthenaRepoSearch.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/threads/SessionList.cjs +486 -0
- package/dist/threads/SessionList.cjs.map +1 -0
- package/dist/threads/SessionList.d.ts +60 -0
- package/dist/threads/SessionList.js +486 -0
- package/dist/threads/SessionList.js.map +1 -0
- package/dist/threads/api.cjs +112 -4
- package/dist/threads/api.cjs.map +1 -1
- package/dist/threads/api.d.ts +128 -1
- package/dist/threads/api.js +113 -5
- package/dist/threads/api.js.map +1 -1
- package/dist/threads/conversation-list-fetcher.cjs +27 -3
- package/dist/threads/conversation-list-fetcher.cjs.map +1 -1
- package/dist/threads/conversation-list-fetcher.d.ts +16 -3
- package/dist/threads/conversation-list-fetcher.js +27 -3
- package/dist/threads/conversation-list-fetcher.js.map +1 -1
- package/dist/threads/index.d.ts +5 -1
- package/dist/threads/session-list-model.cjs +130 -0
- package/dist/threads/session-list-model.cjs.map +1 -0
- package/dist/threads/session-list-model.d.ts +62 -0
- package/dist/threads/session-list-model.js +130 -0
- package/dist/threads/session-list-model.js.map +1 -0
- package/dist/threads/statewire-thread-list.cjs +220 -38
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.d.ts +152 -2
- package/dist/threads/statewire-thread-list.js +222 -40
- package/dist/threads/statewire-thread-list.js.map +1 -1
- package/dist/threads/thread-prefetcher.cjs +63 -0
- package/dist/threads/thread-prefetcher.cjs.map +1 -0
- package/dist/threads/thread-prefetcher.d.ts +54 -0
- package/dist/threads/thread-prefetcher.js +63 -0
- package/dist/threads/thread-prefetcher.js.map +1 -0
- package/dist/threads/use-athena-session-attention.cjs +22 -0
- package/dist/threads/use-athena-session-attention.cjs.map +1 -0
- package/dist/threads/use-athena-session-attention.d.ts +24 -0
- package/dist/threads/use-athena-session-attention.js +22 -0
- package/dist/threads/use-athena-session-attention.js.map +1 -0
- package/dist/threads/use-rest-conversation-history.cjs +25 -2
- package/dist/threads/use-rest-conversation-history.cjs.map +1 -1
- package/dist/threads/use-rest-conversation-history.d.ts +8 -1
- package/dist/threads/use-rest-conversation-history.js +25 -2
- package/dist/threads/use-rest-conversation-history.js.map +1 -1
- package/dist/threads/use-statewire-conversation-history.cjs +40 -16
- package/dist/threads/use-statewire-conversation-history.cjs.map +1 -1
- package/dist/threads/use-statewire-conversation-history.d.ts +13 -0
- package/dist/threads/use-statewire-conversation-history.js +40 -16
- package/dist/threads/use-statewire-conversation-history.js.map +1 -1
- package/dist/threads/use-thread-archive.cjs +128 -0
- package/dist/threads/use-thread-archive.cjs.map +1 -0
- package/dist/threads/use-thread-archive.d.ts +26 -0
- package/dist/threads/use-thread-archive.js +128 -0
- package/dist/threads/use-thread-archive.js.map +1 -0
- package/dist/threads/use-thread-favorite.cjs +53 -0
- package/dist/threads/use-thread-favorite.cjs.map +1 -0
- package/dist/threads/use-thread-favorite.d.ts +49 -0
- package/dist/threads/use-thread-favorite.js +53 -0
- package/dist/threads/use-thread-favorite.js.map +1 -0
- package/dist/threads/use-thread-field-override.cjs +184 -0
- package/dist/threads/use-thread-field-override.cjs.map +1 -0
- package/dist/threads/use-thread-field-override.d.ts +55 -0
- package/dist/threads/use-thread-field-override.js +184 -0
- package/dist/threads/use-thread-field-override.js.map +1 -0
- package/dist/threads/use-thread-rename.cjs +53 -0
- package/dist/threads/use-thread-rename.cjs.map +1 -0
- package/dist/threads/use-thread-rename.d.ts +48 -0
- package/dist/threads/use-thread-rename.js +53 -0
- package/dist/threads/use-thread-rename.js.map +1 -0
- package/dist/tools/index.cjs +5 -1
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +7 -3
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/misc-tool-uis.cjs +2 -1
- package/dist/tools/misc-tool-uis.cjs.map +1 -1
- package/dist/tools/misc-tool-uis.js +2 -1
- package/dist/tools/misc-tool-uis.js.map +1 -1
- package/dist/tools/primitives.cjs +25 -2
- package/dist/tools/primitives.cjs.map +1 -1
- package/dist/tools/primitives.d.ts +9 -2
- package/dist/tools/primitives.js +26 -3
- package/dist/tools/primitives.js.map +1 -1
- package/dist/tools/tool-appearance.cjs +11 -0
- package/dist/tools/tool-appearance.cjs.map +1 -0
- package/dist/tools/tool-appearance.d.ts +29 -0
- package/dist/tools/tool-appearance.js +11 -0
- package/dist/tools/tool-appearance.js.map +1 -0
- package/dist/tools/tool-fallback.cjs +211 -13
- package/dist/tools/tool-fallback.cjs.map +1 -1
- package/dist/tools/tool-fallback.d.ts +31 -4
- package/dist/tools/tool-fallback.js +214 -16
- package/dist/tools/tool-fallback.js.map +1 -1
- package/dist/tools/use-elapsed-seconds.cjs +24 -0
- package/dist/tools/use-elapsed-seconds.cjs.map +1 -0
- package/dist/tools/use-elapsed-seconds.d.ts +10 -0
- package/dist/tools/use-elapsed-seconds.js +24 -0
- package/dist/tools/use-elapsed-seconds.js.map +1 -0
- package/dist/tools/voice-update-tool-ui.cjs +2 -1
- package/dist/tools/voice-update-tool-ui.cjs.map +1 -1
- package/dist/tools/voice-update-tool-ui.js +2 -1
- package/dist/tools/voice-update-tool-ui.js.map +1 -1
- package/package.json +3 -3
- package/src/chat-ui/tailwind-preset.js +14 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AthenaChat.js","sources":["../../src/chat/AthenaChat.tsx"],"sourcesContent":["import { TiptapText } from './tiptap-text';\nimport { AthenaChatErrorBoundary } from './AthenaChatErrorBoundary';\nimport { StatewireApprovalCard } from './StatewireApprovalCard';\nimport { StatewireQueuedMessages } from './StatewireQueuedMessages';\nimport { StatewireConnectionBanner, StatewireErrorBanner } from './statewire-banners';\nimport { ToolFallback } from '../tools/tool-fallback';\nimport { AppendDocumentToolUI } from '../tools/append-document-tool-ui';\nimport { ReadAssetToolUI } from '../tools/read-asset-tool-ui';\nimport { TOOL_UI_REGISTRY } from '../tools/tool-uis';\nimport { SuperGroupingCard, SuperGroupingFinalText } from './super-grouping/SuperGroupingCard';\nimport {\n NestedPtcComponentsProvider,\n NestedPtcMessages,\n useNestedPtcComponents,\n} from '../tools/NestedPtcMessages';\nimport { TooltipIconButton } from './tooltip-icon-button';\nimport { Button } from '../ui/button';\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../ui/collapsible';\nimport { ChatComposerDock } from '../chat-ui/thread/chat-composer-dock';\nimport { ChatThreadShell } from '../chat-ui/thread/chat-thread-shell';\nimport { StatewireHistoryEdge } from '../chat-ui/thread/statewire-history-edge';\nimport { ComposerSendOrStop } from '../chat-ui/thread/composer-send-or-stop';\nimport {\n TiptapComposer,\n type ComposerFileIntake,\n type TiptapComposerHandle,\n} from '../chat-ui/composer/tiptap-composer';\nimport {\n MentionAuthCtx,\n type MentionAuthContext,\n} from '../chat-ui/mentions/suggestions/data/api-client';\nimport type { MentionRootCategory } from '../chat-ui/mentions/suggestions/data/use-mention-suggestions';\nimport type { MentionTool } from '../chat-ui/mentions/suggestions/data/types';\nimport {\n ACTION_BAR_REVEAL_CLASS,\n BranchPicker,\n type ComposerSendButtonProps,\n type ComposerStopButtonProps,\n} from '../chat-ui/messages/message-components';\nimport { useMessageActionsReadOnly } from '../chat-ui/messages/message-actions-config';\nimport { useAthenaRunLive } from './use-athena-run-live';\nimport {\n ActionBarMorePrimitive,\n ActionBarPrimitive,\n AuiIf,\n ErrorPrimitive,\n MessagePrimitive,\n ThreadPrimitive,\n useAui,\n useAuiState,\n} from '@assistant-ui/react';\nimport type {\n EmptyMessagePartComponent,\n PartState,\n ReasoningMessagePartProps,\n ReasoningMessagePartComponent,\n TextMessagePartProps,\n TextMessagePartComponent,\n ToolCallMessagePartComponent,\n ToolCallMessagePartProps,\n} from '@assistant-ui/react';\nimport {\n AlertCircleIcon,\n ArrowDownIcon,\n ArrowUpIcon,\n ArrowRightIcon,\n BrainIcon,\n CheckIcon,\n ChevronDownIcon,\n ChevronRightIcon,\n CopyIcon,\n DownloadIcon,\n ExternalLinkIcon,\n LayersIcon,\n ListPlusIcon,\n MoreHorizontalIcon,\n PencilIcon,\n RefreshCwIcon,\n SquareIcon,\n SearchIcon,\n FileTextIcon,\n PresentationIcon,\n} from 'lucide-react';\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type FC,\n} from 'react';\nimport { useAthenaStatewireThreadId, useAthenaThreadId } from '../threads/thread-id-context';\nimport { FileUploadButton } from '../composer/FileUploadButton';\nimport { ComposerQuotePreview } from '../composer/ComposerQuotePreview';\nimport { ComposerAttachmentPreview } from '../composer/ComposerAttachmentPreview';\nimport { ComposerDropZone } from '../composer/ComposerDropZone';\nimport { useQuote, QuoteProvider, useQuoteFromPostMessage } from '../composer/QuoteContext';\nimport { AttachmentProvider, useAttachments } from '../composer/AttachmentContext';\nimport { buildComposedMessage } from '../composer/build-composed-message';\nimport { useAttachFiles } from '../composer/useAttachFiles';\nimport { useAthenaConfig } from '../provider/AthenaContext';\nimport { createAthenaSpacesUrl } from '../lib/athena-urls';\nimport { cn, isRecord } from '../lib/utils';\nimport { useSendMessage } from '../composer/useSendMessage';\nimport { getToolkitDisplayInfo } from '../toolkits';\nimport {\n RUN_ACTIVITY_STALL_SECONDS,\n runActivityKey,\n runActivityLabel,\n} from './run-activity';\n\nfunction QuotePostMessageBridge() {\n useQuoteFromPostMessage();\n return null;\n}\n\nexport interface WelcomeSuggestion {\n icon: React.ElementType;\n title: string;\n prompt: string;\n}\n\nconst DEFAULT_SUGGESTIONS: WelcomeSuggestion[] = [\n {\n icon: SearchIcon,\n title: \"Research a topic and draft a report\",\n prompt: \"Search the web for the latest developments in enterprise AI adoption, then create a document summarizing the key trends, market data, and strategic implications.\",\n },\n {\n icon: SearchIcon,\n title: \"Compare recent AI model launches\",\n prompt: \"Search the web for the latest major AI model launches from OpenAI, Anthropic, and Google, then summarize the release dates, standout capabilities, and practical tradeoffs in a concise comparison table.\",\n },\n {\n icon: PresentationIcon,\n title: \"Build a presentation from scratch\",\n prompt: \"Create a 5-slide investor update presentation covering market opportunity, product traction, key metrics, competitive positioning, and next steps.\",\n },\n {\n icon: FileTextIcon,\n title: \"Set up a structured spreadsheet\",\n prompt: \"Create a project tracking spreadsheet with columns for task name, owner, priority, status, start date, due date, and completion percentage.\",\n },\n];\n\nexport interface AthenaChatProps {\n /** CSS class name for the root element. */\n className?: string;\n /** Welcome heading text. Defaults to \"Hello there!\" */\n welcomeMessage?: string;\n /** Welcome subheading text. */\n welcomeSubtext?: string;\n /** Maximum width for the thread content. Defaults to \"44rem\". */\n maxWidth?: string;\n /**\n * Scroll anchoring for new turns. \"bottom\" (default) keeps the viewport\n * pinned to the end while the assistant streams — classic chat follow.\n * \"top\" pins the just-sent user message to the top of the viewport and\n * intentionally does NOT follow the streaming response (assistant-ui\n * disables autoScroll in that mode), so readers scroll at their own pace.\n */\n turnAnchor?: \"top\" | \"bottom\";\n /**\n * Marks the transcript read-only: Edit and Regenerate hide while Copy stays\n * available. For threads whose server rejects dispatch (e.g. legacy\n * pre-cutover conversations) — the runtime's static capability flags cannot\n * express a per-thread fence, so the host that knows passes it here.\n */\n readOnly?: boolean;\n /** Additional tool UIs to register by name. */\n toolUIs?: Record<string, ToolCallMessagePartComponent>;\n /** Tools / Toolkits offered by the composer's `@` menu beside the asset\n * library. Defaults to the toolkits enabled on the provider. */\n mentionTools?: MentionTool[];\n /** Suggestion cards shown on the welcome screen. Pass `[]` to hide.\n * For workflow launchers outside AthenaChat, use `useSendMessage()`.\n */\n welcomeSuggestions?: WelcomeSuggestion[];\n /** Optional component overrides for message containers and key message parts. */\n components?: AthenaChatComponents;\n /** Collapse adjacent tool calls into a single expandable group. Defaults to `false`. */\n groupToolCalls?: boolean;\n}\n\nexport interface AthenaChatMessagePartComponents {\n Text?: TextMessagePartComponent;\n Reasoning?: ReasoningMessagePartComponent;\n Empty?: EmptyMessagePartComponent;\n}\n\nexport interface AthenaChatComponents {\n UserMessage?: FC;\n AssistantMessage?: FC;\n AssistantActionBar?: FC<AthenaAssistantActionBarProps>;\n messageParts?: AthenaChatMessagePartComponents;\n}\n\nexport interface AthenaUserMessageProps {\n TextComponent?: TextMessagePartComponent;\n}\n\nexport interface AthenaAssistantActionBarProps {\n className?: string;\n}\n\nexport interface AthenaAssistantMessageProps {\n toolUIs: Record<string, ToolCallMessagePartComponent>;\n TextComponent?: TextMessagePartComponent;\n ReasoningComponent?: ReasoningMessagePartComponent;\n EmptyComponent?: EmptyMessagePartComponent;\n ActionBarComponent?: FC<AthenaAssistantActionBarProps>;\n /** Collapse adjacent tool calls into a single expandable group. Defaults to `false`. */\n groupToolCalls?: boolean;\n}\n\nexport interface AthenaReasoningPartProps extends ReasoningMessagePartProps {\n TextComponent?: TextMessagePartComponent;\n}\n\ninterface AthenaChatDefaultComponentsContextValue {\n toolUIs: Record<string, ToolCallMessagePartComponent>;\n TextComponent: TextMessagePartComponent;\n ReasoningComponent?: ReasoningMessagePartComponent;\n EmptyComponent: EmptyMessagePartComponent;\n ActionBarComponent: FC<AthenaAssistantActionBarProps>;\n groupToolCalls: boolean;\n}\n\nconst AthenaChatDefaultComponentsContext =\n createContext<AthenaChatDefaultComponentsContextValue | null>(null);\n\nconst AthenaReasoningTextComponentContext = createContext<TextMessagePartComponent | null>(null);\n\nconst useAthenaChatDefaultComponents = (): AthenaChatDefaultComponentsContextValue => {\n const value = useContext(AthenaChatDefaultComponentsContext);\n\n if (!value) {\n throw new Error('Athena default chat components must be used within AthenaChat.');\n }\n\n return value;\n};\n\nconst AthenaDefaultAssistantMessage: FC = () => {\n const { toolUIs, TextComponent, ReasoningComponent, EmptyComponent, ActionBarComponent, groupToolCalls } =\n useAthenaChatDefaultComponents();\n\n return (\n <AthenaAssistantMessage\n toolUIs={toolUIs}\n TextComponent={TextComponent}\n ReasoningComponent={ReasoningComponent}\n EmptyComponent={EmptyComponent}\n ActionBarComponent={ActionBarComponent}\n groupToolCalls={groupToolCalls}\n />\n );\n};\n\nconst AthenaDefaultUserMessage: FC = () => {\n const { TextComponent } = useAthenaChatDefaultComponents();\n\n return <AthenaUserMessage TextComponent={TextComponent} />;\n};\n\nconst getReasoningTokensFromMetadata = (metadata: unknown): number | undefined => {\n if (!isRecord(metadata)) {\n return undefined;\n }\n\n const customMetadata = metadata.custom;\n if (!isRecord(customMetadata)) {\n return undefined;\n }\n\n const athenaMetadata = customMetadata._athena;\n if (!isRecord(athenaMetadata)) {\n return undefined;\n }\n\n const reasoningTokens = athenaMetadata.reasoningTokens;\n return typeof reasoningTokens === 'number' && Number.isFinite(reasoningTokens)\n ? reasoningTokens\n : undefined;\n};\n\nconst formatReasoningTokens = (reasoningTokens: number) =>\n `${reasoningTokens.toLocaleString('en-US')} ${reasoningTokens === 1 ? 'token' : 'tokens'}`;\n\nconst withNestedPtcMessages = (\n ToolUI: ToolCallMessagePartComponent\n): ToolCallMessagePartComponent => {\n const ToolUIWithNestedPtcMessages: ToolCallMessagePartComponent = (props) => {\n const nestedComponents = useNestedPtcComponents(ToolFallback);\n\n return (\n <>\n <ToolUI {...props} />\n <NestedPtcMessages components={nestedComponents} />\n </>\n );\n };\n\n return ToolUIWithNestedPtcMessages;\n};\n\nconst SuggestionCard: FC<{ suggestion: WelcomeSuggestion; index: number }> = ({\n suggestion,\n index,\n}) => {\n const Icon = suggestion.icon;\n const sendMessage = useSendMessage();\n\n const handleClick = useCallback(() => {\n void sendMessage(suggestion.prompt);\n }, [sendMessage, suggestion.prompt]);\n\n return (\n <button\n type=\"button\"\n onClick={handleClick}\n className={`fade-in slide-in-from-bottom-2 animate-in fill-mode-both group flex items-start gap-3 rounded-xl border border-border/60 bg-background p-3.5 text-left shadow-sm transition-all duration-150 hover:border-border hover:bg-muted/40 hover:shadow-md`}\n style={{ animationDelay: `${100 + index * 75}ms` }}\n >\n <div className=\"flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted/60 text-muted-foreground transition-colors group-hover:bg-primary/10 group-hover:text-primary\">\n <Icon className=\"size-4\" />\n </div>\n <div className=\"min-w-0 flex-1\">\n <span className=\"text-[13px] font-medium leading-snug text-foreground\">\n {suggestion.title}\n </span>\n </div>\n <ArrowRightIcon className=\"mt-0.5 size-3.5 shrink-0 text-muted-foreground/0 transition-all group-hover:text-muted-foreground\" />\n </button>\n );\n};\n\nconst AthenaChatWelcome: FC<{\n welcomeMessage: string;\n welcomeSubtext?: string;\n welcomeSuggestions: WelcomeSuggestion[];\n}> = ({ welcomeMessage, welcomeSubtext, welcomeSuggestions }) => (\n <div className=\"aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col\">\n <div className=\"aui-thread-welcome-center flex w-full grow flex-col items-center justify-center\">\n <div className=\"aui-thread-welcome-message flex size-full flex-col justify-center px-4\">\n <h1 className=\"aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both font-semibold text-2xl duration-200\">\n {welcomeMessage}\n </h1>\n {welcomeSubtext && (\n <p className=\"aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-muted-foreground text-lg delay-75 duration-200\">\n {welcomeSubtext}\n </p>\n )}\n {welcomeSuggestions.length > 0 && (\n <div className=\"mt-6 grid grid-cols-1 gap-2.5 sm:grid-cols-2\">\n {welcomeSuggestions.map((s, i) => (\n <SuggestionCard key={s.title} suggestion={s} index={i} />\n ))}\n </div>\n )}\n </div>\n </div>\n </div>\n);\n\nexport const AthenaChat: FC<AthenaChatProps> = ({\n className,\n welcomeMessage = \"Hello there!\",\n welcomeSubtext = \"What can I help you with?\",\n maxWidth = \"44rem\",\n turnAnchor = \"bottom\",\n readOnly = false,\n toolUIs,\n mentionTools,\n welcomeSuggestions = DEFAULT_SUGGESTIONS,\n components,\n groupToolCalls = false,\n}) => {\n const athenaConfig = useAthenaConfig();\n // The mention menu's GraphQL credentials: the backend and credential the\n // provider resolved. `athenaConfig` keeps its identity across token\n // rotations (its `token` is a getter over a ref — see useAthenaConfigValue),\n // so this object is stable too. The mention store lists `accessToken` among\n // its memo dependencies, so it rebuilds (and refetches its lists) on the\n // composer's next render after a rotation; the getter is what hands the\n // rotated token to any fetch before that render. With neither token nor\n // API key the fetch rides the same-origin session cookie, as the SDK's\n // upload and thread REST calls do.\n const mentionAuth = useMemo<MentionAuthContext>(\n () => ({\n backendUrl: athenaConfig.backendUrl,\n appUrl: athenaConfig.appUrl,\n apiKey: athenaConfig.apiKey,\n credentials: 'include',\n get accessToken() {\n return athenaConfig.token ?? undefined;\n },\n }),\n [athenaConfig],\n );\n const providerMentionTools = useMemo<MentionTool[]>(() => {\n const uniqueToolkitIds = Array.from(new Set(athenaConfig.enabledToolkits));\n\n return uniqueToolkitIds.map((id) => {\n const toolkit = getToolkitDisplayInfo(id);\n\n return {\n id: toolkit.id,\n name: toolkit.name,\n description: toolkit.description,\n icon: toolkit.icon,\n type: 'toolkit',\n };\n });\n }, [athenaConfig.enabledToolkits]);\n const tools = mentionTools ?? providerMentionTools;\n const mergedToolUIs = useMemo(\n () => ({\n append_markdown_to_athena_document: AppendDocumentToolUI,\n read_full_asset: ReadAssetToolUI,\n read_asset: ReadAssetToolUI,\n ...TOOL_UI_REGISTRY,\n ...toolUIs,\n }),\n [toolUIs],\n );\n\n const textComponent = components?.messageParts?.Text ?? TiptapText;\n const reasoningComponent = components?.messageParts?.Reasoning;\n const emptyComponent = components?.messageParts?.Empty ?? AthenaAssistantMessageEmpty;\n const actionBarComponent = components?.AssistantActionBar ?? AthenaAssistantActionBar;\n\n const defaultComponentsContextValue = useMemo<AthenaChatDefaultComponentsContextValue>(\n () => ({\n toolUIs: mergedToolUIs,\n TextComponent: textComponent,\n ReasoningComponent: reasoningComponent,\n EmptyComponent: emptyComponent,\n ActionBarComponent: actionBarComponent,\n groupToolCalls,\n }),\n [actionBarComponent, emptyComponent, groupToolCalls, mergedToolUIs, reasoningComponent, textComponent],\n );\n const AssistantMessageComponent = components?.AssistantMessage ?? AthenaDefaultAssistantMessage;\n const UserMessageComponent = components?.UserMessage ?? AthenaDefaultUserMessage;\n const messageComponents = useMemo(\n () => ({\n UserMessage: UserMessageComponent,\n AssistantMessage: AssistantMessageComponent,\n }),\n [AssistantMessageComponent, UserMessageComponent],\n );\n\n return (\n <AthenaChatDefaultComponentsContext.Provider value={defaultComponentsContextValue}>\n {/* Contain render crashes to the chat pane (telemetry + retry) instead of\n unmounting the integrator's subtree. */}\n <AthenaChatErrorBoundary>\n <ChatThreadShell\n overlay={<ThreadLoadingOverlay />}\n panelClassName={cn(\n 'aui-root aui-thread-root @container relative flex h-full flex-col bg-background',\n className,\n )}\n maxWidth={maxWidth}\n turnAnchor={turnAnchor}\n readOnly={readOnly}\n viewportClassName=\"aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4\"\n contentClassName=\"flex w-full flex-1 flex-col\"\n viewportOverlay={<ThreadScrollToTop />}\n welcome={\n <AthenaChatWelcome\n welcomeMessage={welcomeMessage}\n welcomeSubtext={welcomeSubtext}\n welcomeSuggestions={welcomeSuggestions}\n />\n }\n beforeMessages={<StatewireHistoryEdge className=\"aui-thread-history-edge\" />}\n components={messageComponents}\n runningIndicator={null}\n scrollToBottom={<ThreadScrollToBottom />}\n viewportFooterClassName=\"aui-thread-viewport-footer sticky bottom-0 mx-auto mt-auto flex w-full max-w-(--thread-max-width) flex-col gap-4 overflow-visible rounded-t-3xl bg-background pb-4 md:pb-6\"\n viewportFooter={\n <>\n <StatewireConnectionBanner />\n <StatewireErrorBanner />\n <StatewireApprovalCard />\n <StatewireQueuedMessages />\n <AttachmentProvider>\n <QuoteProvider>\n <QuotePostMessageBridge />\n <MentionAuthCtx.Provider value={mentionAuth}>\n <AthenaChatComposer tools={tools} />\n </MentionAuthCtx.Provider>\n </QuoteProvider>\n </AttachmentProvider>\n </>\n }\n />\n </AthenaChatErrorBoundary>\n </AthenaChatDefaultComponentsContext.Provider>\n );\n};\n\nconst ThreadLoadingOverlay: FC = () => {\n const remoteId = useAthenaThreadId();\n const [timedOut, setTimedOut] = useState(false);\n\n useEffect(() => {\n if (!remoteId) return;\n setTimedOut(false);\n const timer = setTimeout(() => setTimedOut(true), 15000);\n return () => clearTimeout(timer);\n }, [remoteId]);\n\n if (!remoteId || timedOut) return null;\n\n return (\n <AuiIf condition={(s) => s.thread.isEmpty}>\n <div className=\"absolute inset-0 z-10 flex items-center justify-center bg-background/80\">\n <div className=\"size-5 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent\" />\n </div>\n </AuiIf>\n );\n};\n\nconst THREAD_VIEWPORT_ATTR = 'data-aui-thread-viewport';\n\nconst useScrollToTop = () => {\n const [isAtTop, setIsAtTop] = useState(true);\n const [buttonEl, setButtonEl] = useState<HTMLButtonElement | null>(null);\n\n const containerRef = useCallback((node: HTMLButtonElement | null) => {\n setButtonEl(node);\n }, []);\n\n const getViewport = useCallback((): HTMLElement | null => {\n if (!buttonEl) return null;\n return buttonEl.closest(`[${THREAD_VIEWPORT_ATTR}]`) as HTMLElement | null;\n }, [buttonEl]);\n\n useEffect(() => {\n const viewport: HTMLElement | null = getViewport();\n if (!viewport) return;\n\n const handleScroll = () => {\n setIsAtTop(viewport.scrollTop <= 50);\n };\n\n handleScroll();\n viewport.addEventListener('scroll', handleScroll, { passive: true });\n return () => viewport.removeEventListener('scroll', handleScroll);\n }, [getViewport]);\n\n const handleClick = useCallback(() => {\n const viewport: HTMLElement | null = getViewport();\n if (!viewport) return;\n viewport.scrollTo({ top: 0, behavior: 'smooth' });\n }, [getViewport]);\n\n return { isAtTop, containerRef, handleClick };\n};\n\nconst ThreadScrollToTop: FC = () => {\n const { isAtTop, containerRef, handleClick } = useScrollToTop();\n const isEmpty = useAuiState((s) => s.thread.isEmpty);\n\n if (isEmpty) return null;\n\n return (\n <div className=\"sticky top-0 z-10 mx-auto flex h-0 w-full max-w-(--thread-max-width) justify-center\">\n <TooltipIconButton\n ref={containerRef}\n tooltip=\"Scroll to top\"\n variant=\"outline\"\n className={cn('aui-thread-scroll-to-top absolute top-2 rounded-full p-4 dark:bg-background dark:hover:bg-accent', isAtTop && 'invisible')}\n onClick={handleClick}\n >\n <ArrowUpIcon />\n </TooltipIconButton>\n </div>\n );\n};\n\nconst ThreadScrollToBottom: FC = () => (\n <ThreadPrimitive.ScrollToBottom asChild>\n <TooltipIconButton\n tooltip=\"Scroll to bottom\"\n variant=\"outline\"\n className=\"aui-thread-scroll-to-bottom absolute -top-12 z-10 self-center rounded-full p-4 disabled:invisible dark:bg-background dark:hover:bg-accent\"\n >\n <ArrowDownIcon />\n </TooltipIconButton>\n </ThreadPrimitive.ScrollToBottom>\n);\n\nconst AthenaComposerSendButton: FC<ComposerSendButtonProps> = ({\n action,\n onSend,\n disabled,\n title,\n}) => {\n const label = action === 'queue' ? 'Queue message' : 'Send message';\n return (\n <TooltipIconButton\n tooltip={title ?? label}\n side=\"bottom\"\n type=\"button\"\n variant=\"default\"\n size=\"icon\"\n className=\"aui-composer-send size-8 rounded-full\"\n aria-label={label}\n onClick={onSend}\n disabled={disabled}\n >\n {action === 'queue' ? (\n <ListPlusIcon className=\"aui-composer-send-icon size-4\" />\n ) : (\n <ArrowUpIcon className=\"aui-composer-send-icon size-4\" />\n )}\n </TooltipIconButton>\n );\n};\n\nconst AthenaComposerStopButton: FC<ComposerStopButtonProps> = ({ onStop, disabled, title }) => (\n <Button\n type=\"button\"\n variant=\"default\"\n size=\"icon\"\n className=\"aui-composer-cancel size-8 rounded-full\"\n aria-label=\"Stop generating\"\n title={title}\n onClick={onStop}\n disabled={disabled}\n >\n <SquareIcon className=\"aui-composer-cancel-icon size-3 fill-current\" />\n </Button>\n);\n\nconst ATHENA_COMPOSER_COMPONENTS = {\n SendButton: AthenaComposerSendButton,\n StopButton: AthenaComposerStopButton,\n};\n\n/**\n * The asset-library categories of AthenaChat's `@` menu. Browse profiles,\n * team and drives are left out: they need browser-side scoping or a workspace\n * id that API-key auth does not carry. The Tools / Toolkits categories are\n * added when the host (or the provider's enabled toolkits) offers any.\n */\nconst ATHENA_CHAT_MENTION_CATEGORIES: readonly MentionRootCategory[] = [\n 'favorites',\n 'assets',\n 'projects',\n 'folders',\n];\n\n/**\n * AthenaChat's composer: the shared chat-ui Tiptap editor and `@` mention menu\n * with AthenaChat's quote and attachment pills composed into the send.\n *\n * A draft with a quote or attachment pills — text or not — is intercepted on\n * submit and dispatched as one composed message through the composer runtime,\n * the path the server-owned queue observes, so a mid-run submit queues like\n * any other send. Pasted images upload into the pills through the same intake\n * as the paperclip and the drop zone, and every submit path (Enter, the send\n * button) waits for an in-flight upload so a send never leaves without its\n * attachment. The send control resolves send / queue / stop through the\n * shared chat-ui logic.\n */\nconst AthenaChatComposer: FC<{ tools: MentionTool[] }> = ({ tools }) => {\n const aui = useAui();\n const threadId = useAthenaStatewireThreadId();\n const { appUrl } = useAthenaConfig();\n const { attachments, clearAttachments, isUploading } = useAttachments();\n const { quote, clearQuote } = useQuote();\n const { attachFiles } = useAttachFiles();\n const composerRef = useRef<TiptapComposerHandle>(null);\n const [hasText, setHasText] = useState(false);\n\n const rootCategories = useMemo<readonly MentionRootCategory[]>(() => {\n const categories = [...ATHENA_CHAT_MENTION_CATEGORIES];\n if (tools.some((tool) => tool.type === 'toolkit')) categories.push('toolkits');\n if (tools.some((tool) => tool.type === 'tool')) categories.push('tools');\n return categories;\n }, [tools]);\n\n // The submit paths are captured once by the editor's keybinding, so they\n // read the current draft extras through refs.\n const attachmentsRef = useRef(attachments);\n attachmentsRef.current = attachments;\n const quoteRef = useRef(quote);\n quoteRef.current = quote;\n const hasExtras = attachments.length > 0 || quote !== null;\n\n // A submit during an upload parks until the pills have the asset; the\n // waiters resolve on the render that turns `isUploading` off, by which\n // point `attachmentsRef` holds the uploaded asset.\n const isUploadingRef = useRef(isUploading);\n isUploadingRef.current = isUploading;\n const uploadWaitersRef = useRef<Array<() => void>>([]);\n useEffect(() => {\n if (isUploading) return;\n const waiters = uploadWaitersRef.current;\n uploadWaitersRef.current = [];\n for (const resolve of waiters) resolve();\n }, [isUploading]);\n const waitForHostUploads = useCallback(() => {\n if (!isUploadingRef.current) return;\n return new Promise<void>((resolve) => {\n uploadWaitersRef.current.push(resolve);\n });\n }, []);\n\n const sendComposed = useCallback(\n (userText: string): boolean => {\n const message = buildComposedMessage({\n attachments: attachmentsRef.current,\n quote: quoteRef.current,\n userText,\n appUrl,\n });\n if (!message) return false;\n // steer: false — a mid-run send queues behind the active run instead of\n // interrupting it; idle sends dispatch immediately.\n aui.composer.setText(message);\n aui.composer.send({ steer: false });\n clearAttachments();\n clearQuote();\n return true;\n },\n [appUrl, aui, clearAttachments, clearQuote],\n );\n\n // Consumes the editor's draft (possibly empty) only when there are extras\n // to compose with it.\n const interceptSubmit = useCallback(\n (text: string) =>\n attachmentsRef.current.length > 0 || quoteRef.current !== null\n ? sendComposed(text)\n : false,\n [sendComposed],\n );\n\n // Pasted images go through the pills' intake; drops are left to the\n // enclosing ComposerDropZone.\n const fileIntake = useMemo<ComposerFileIntake>(\n () => ({\n onPaste: (files) => {\n void attachFiles(files, 'paste');\n },\n }),\n [attachFiles],\n );\n\n return (\n <ComposerDropZone>\n <ChatComposerDock\n className=\"\"\n surfaceClassName=\"aui-composer-root relative flex w-full flex-col rounded-2xl border border-input bg-background px-1 pt-2 outline-none transition-shadow focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/20\"\n editorRowClassName=\"px-2.5\"\n toolbarClassName=\"aui-composer-action-wrapper relative mx-2 mb-2 flex items-center\"\n beforeEditor={\n <>\n <ComposerQuotePreview />\n <ComposerAttachmentPreview />\n </>\n }\n editor={\n <TiptapComposer\n ref={composerRef}\n threadId={threadId}\n placeholder=\"Type @ to tag an asset\"\n tools={tools}\n rootCategories={rootCategories}\n onDraftStateChange={setHasText}\n waitForHostUploads={waitForHostUploads}\n interceptSubmit={interceptSubmit}\n fileIntake={fileIntake}\n />\n }\n toolbarStart={\n <div className=\"flex items-center gap-1\">\n <FileUploadButton />\n </div>\n }\n toolbarEnd={\n <div className=\"flex items-center gap-1\">\n <ComposerSendOrStop\n composerRef={composerRef}\n hasDraft={hasText || hasExtras}\n sendBlockedReason={isUploading ? 'Upload in progress...' : null}\n components={ATHENA_COMPOSER_COMPONENTS}\n />\n </div>\n }\n />\n </ComposerDropZone>\n );\n};\n\nconst MessageError: FC = () => (\n <MessagePrimitive.Error>\n <ErrorPrimitive.Root className=\"aui-message-error-root mt-2 flex items-start gap-2 rounded-md border border-destructive bg-destructive/10 p-3 text-destructive text-sm dark:bg-destructive/5 dark:text-red-200\">\n <AlertCircleIcon className=\"mt-0.5 size-4 shrink-0\" />\n <ErrorPrimitive.Message className=\"aui-message-error-message grow\" />\n <ActionBarPrimitive.Reload asChild>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className=\"size-6 shrink-0 text-destructive hover:text-destructive dark:text-red-200 dark:hover:text-red-100\"\n >\n <RefreshCwIcon className=\"size-3.5\" />\n </Button>\n </ActionBarPrimitive.Reload>\n </ErrorPrimitive.Root>\n </MessagePrimitive.Error>\n);\n\nconst AthenaAssistantMessageEmpty: EmptyMessagePartComponent = ({ status }) => {\n if (status?.type !== 'running') return null;\n return (\n <span className=\"shimmer text-[13px] text-muted-foreground\">Thinking...</span>\n );\n};\n\n/**\n * Renders the empty/loading indicator while a message is running but has no\n * parts yet. `MessagePrimitive.GroupedParts` only renders existing parts, so\n * the indicator can't live inside its switch — it goes here as a sibling.\n */\nconst AthenaMessageEmptyIndicator: FC<{ EmptyComponent: EmptyMessagePartComponent }> = ({\n EmptyComponent,\n}) => {\n const hasParts = useAuiState((s) => s.message.parts.length > 0);\n const isRunning = useAuiState((s) => s.message.status?.type === 'running');\n if (hasParts || !isRunning) return null;\n return <EmptyComponent status={{ type: 'running' }} />;\n};\n\n/**\n * Run-liveness row under a running message whose tail is a tool call.\n *\n * Answers \"is anything still happening?\" once parts exist: pulsing dots plus\n * an elapsed counter that resets whenever the stream moves the tail part, and\n * a stall tone once nothing has streamed for a while — so a busy run and a\n * possibly-stuck one stop looking identical. Text/reasoning tails animate on\n * their own and render no row.\n */\nconst AthenaMessageActivityIndicator: FC = () => {\n const isRunning = useAuiState((s) => s.message.status?.type === 'running');\n const activityKey = useAuiState((s) => runActivityKey(s.message.parts));\n const [seconds, setSeconds] = useState(0);\n useEffect(() => {\n setSeconds(0);\n if (!isRunning || activityKey === null) return;\n const startedAt = Date.now();\n const timer = setInterval(() => {\n setSeconds(Math.floor((Date.now() - startedAt) / 1000));\n }, 1000);\n return () => clearInterval(timer);\n }, [isRunning, activityKey]);\n if (!isRunning || activityKey === null) return null;\n const stalled = seconds >= RUN_ACTIVITY_STALL_SECONDS;\n return (\n <div className=\"aui-run-activity mt-2 flex items-center gap-2 px-1 text-[12px] text-muted-foreground\">\n <span className=\"flex items-center gap-1\" aria-hidden>\n <span className=\"size-1.5 animate-bounce rounded-full bg-current [animation-delay:0ms]\" />\n <span className=\"size-1.5 animate-bounce rounded-full bg-current [animation-delay:150ms]\" />\n <span className=\"size-1.5 animate-bounce rounded-full bg-current [animation-delay:300ms]\" />\n </span>\n <span aria-hidden className={stalled ? 'text-amber-600 dark:text-amber-400' : undefined}>\n {runActivityLabel(seconds)}\n </span>\n {/* The visible counter ticks every second; announcing each tick would\n drown a screen reader, so the live region only speaks the two\n meaningful transitions: work started, and work looks stalled. */}\n <span aria-live=\"polite\" className=\"sr-only\">\n {stalled\n ? 'Assistant is still working; nothing new for over thirty seconds.'\n : 'Assistant is working.'}\n </span>\n </div>\n );\n};\n\nexport const AthenaReasoningPart: FC<AthenaReasoningPartProps> = ({\n text,\n status,\n TextComponent,\n}) => {\n const inheritedTextComponent = useContext(AthenaReasoningTextComponentContext);\n const EffectiveTextComponent = TextComponent ?? inheritedTextComponent ?? TiptapText;\n const isMessageRunning = useAuiState((state) => state.message.status?.type === 'running');\n const reasoningTokens = useAuiState((state) =>\n getReasoningTokensFromMetadata(state.message.metadata)\n );\n const isRunning = isMessageRunning || status?.type === 'running';\n const [isCollapsed, setIsCollapsed] = useState(!isRunning);\n const userOverrodeOpenStateRef = useRef(false);\n const hasText = text.trim().length > 0;\n\n const reasoningTextProps: TextMessagePartProps = {\n type: 'text',\n text,\n status: isRunning\n ? ({ type: 'running' } as TextMessagePartProps['status'])\n : (status as TextMessagePartProps['status']),\n };\n\n useEffect(() => {\n if (userOverrodeOpenStateRef.current) {\n return;\n }\n\n setIsCollapsed(!isRunning);\n }, [isRunning]);\n\n if (!hasText && !isRunning) {\n return null;\n }\n\n return (\n <Collapsible\n open={!isCollapsed}\n onOpenChange={(open) => {\n userOverrodeOpenStateRef.current = true;\n setIsCollapsed(!open);\n }}\n className=\"aui-assistant-reasoning-root mb-3 rounded-2xl border border-border/60 bg-muted/30 px-3 py-2\"\n >\n <CollapsibleTrigger asChild>\n <button\n type=\"button\"\n className=\"flex w-full items-center justify-between gap-3 text-left\"\n aria-label={isRunning ? 'Toggle reasoning while streaming' : 'Toggle reasoning'}\n >\n <span className=\"flex min-w-0 items-center gap-2 text-[13px] font-medium text-muted-foreground\">\n <BrainIcon className=\"size-4 shrink-0\" />\n <span>{isRunning ? 'Reasoning...' : 'Reasoning'}</span>\n </span>\n <span className=\"flex shrink-0 items-center gap-2\">\n {reasoningTokens !== undefined && (\n <span className=\"rounded-full border border-border/60 bg-background px-2 py-0.5 text-[11px] font-medium text-muted-foreground\">\n {formatReasoningTokens(reasoningTokens)}\n </span>\n )}\n <span\n className={cn(\n 'flex size-5 items-center justify-center text-muted-foreground transition-transform',\n isCollapsed ? 'rotate-0' : 'rotate-90'\n )}\n aria-hidden=\"true\"\n >\n <ChevronRightIcon className=\"size-4\" />\n </span>\n </span>\n </button>\n </CollapsibleTrigger>\n\n <CollapsibleContent className=\"pt-3\">\n {isRunning && !hasText ? (\n <span className=\"shimmer text-[13px] text-muted-foreground\">Analyzing...</span>\n ) : (\n <div className=\"aui-assistant-reasoning-body text-[13px] leading-relaxed\">\n <EffectiveTextComponent {...reasoningTextProps} />\n </div>\n )}\n </CollapsibleContent>\n </Collapsible>\n );\n};\n\nconst groupAdjacentToolCalls = (part: PartState) =>\n part.type === 'tool-call' ? (['group-tool'] as const) : null;\nconst noToolGrouping = () => null;\n\nexport const AthenaAssistantMessage: FC<AthenaAssistantMessageProps> = ({\n toolUIs,\n TextComponent = TiptapText,\n ReasoningComponent,\n EmptyComponent = AthenaAssistantMessageEmpty,\n ActionBarComponent = AthenaAssistantActionBar,\n groupToolCalls = false,\n}) => {\n const effectiveReasoningComponent = ReasoningComponent ?? AthenaReasoningPart;\n const toolUIsWithNestedMessages = useMemo(() => {\n const wrappedToolUIs: Record<string, ToolCallMessagePartComponent> = {};\n\n for (const [toolName, ToolUI] of Object.entries(toolUIs)) {\n wrappedToolUIs[toolName] = withNestedPtcMessages(ToolUI);\n }\n\n return wrappedToolUIs;\n }, [toolUIs]);\n\n // NestedPtcComponentsProvider still consumes the legacy parts-config shape\n // (Text / Reasoning / tools.by_name / Empty) to render PTC sub-tool messages\n // inside a tool card. The outer rendering uses GroupedParts, but the inner\n // PTC tree continues to mirror the parent registry.\n const nestedPtcComponents = useMemo(\n () => ({\n Text: TextComponent,\n Reasoning: effectiveReasoningComponent,\n tools: {\n Fallback: ToolFallback,\n by_name: toolUIsWithNestedMessages,\n },\n Empty: EmptyComponent,\n }),\n [EmptyComponent, TextComponent, effectiveReasoningComponent, toolUIsWithNestedMessages],\n );\n\n return (\n <MessagePrimitive.Root\n className=\"aui-assistant-message-root group/aui-assistant-message fade-in slide-in-from-bottom-1 relative mx-auto w-full max-w-(--thread-max-width) animate-in py-3 duration-150\"\n data-role=\"assistant\"\n >\n <AthenaReasoningTextComponentContext.Provider value={TextComponent}>\n <div className=\"aui-assistant-message-content wrap-break-word px-2 text-foreground leading-relaxed\">\n <NestedPtcComponentsProvider components={nestedPtcComponents}>\n {groupToolCalls ? (\n <div className=\"flex flex-col space-y-2\">\n <SuperGroupingCard\n toolUIs={toolUIsWithNestedMessages}\n TextComponent={TextComponent}\n ReasoningComponent={effectiveReasoningComponent}\n />\n <SuperGroupingFinalText TextComponent={TextComponent} />\n <AthenaMessageActivityIndicator />\n </div>\n ) : (\n <>\n <AthenaMessageEmptyIndicator EmptyComponent={EmptyComponent} />\n <MessagePrimitive.GroupedParts groupBy={noToolGrouping}>\n {({ part }) => {\n switch (part.type) {\n case 'tool-call': {\n const ToolUI = toolUIsWithNestedMessages[part.toolName];\n const toolProps = part as unknown as ToolCallMessagePartProps;\n return ToolUI ? <ToolUI {...toolProps} /> : <ToolFallback {...toolProps} />;\n }\n case 'reasoning': {\n const ReasoningRenderer = effectiveReasoningComponent;\n return <ReasoningRenderer {...(part as ReasoningMessagePartProps)} />;\n }\n case 'text': {\n const textPart = part as TextMessagePartProps;\n if (textPart.text === '' && textPart.status?.type === 'running') {\n return <EmptyComponent status={textPart.status} />;\n }\n return <TextComponent {...textPart} />;\n }\n default:\n return null;\n }\n }}\n </MessagePrimitive.GroupedParts>\n <AthenaMessageActivityIndicator />\n </>\n )}\n </NestedPtcComponentsProvider>\n <MessageError />\n </div>\n </AthenaReasoningTextComponentContext.Provider>\n <div className=\"aui-assistant-message-footer mt-1 ml-2 flex items-center gap-1\">\n <BranchPicker />\n <ActionBarComponent />\n </div>\n </MessagePrimitive.Root>\n );\n};\n\nconst AthenaToolGroup: FC<{ children: React.ReactNode; count: number }> = ({ children, count }) => {\n const [expanded, setExpanded] = useState(false);\n\n return (\n <div className=\"my-3 w-full overflow-hidden rounded-xl border border-border/60 bg-background shadow-sm\">\n <button\n type=\"button\"\n onClick={() => setExpanded((v) => !v)}\n className=\"flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-muted/20\"\n aria-expanded={expanded}\n >\n <div className=\"flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted/60 text-muted-foreground\">\n <LayersIcon className=\"size-4\" />\n </div>\n <div className=\"min-w-0 flex-1\">\n <span className=\"text-[13px] font-medium text-foreground\">\n {count} tool {count === 1 ? 'call' : 'calls'}\n </span>\n </div>\n <ChevronDownIcon\n className={cn(\n 'size-4 shrink-0 text-muted-foreground transition-transform duration-200',\n !expanded && '-rotate-90',\n )}\n />\n </button>\n {expanded && (\n <div className=\"border-t border-border/40 bg-muted/5 px-3 pt-1 pb-2 [&>*]:my-2\">\n {children}\n </div>\n )}\n </div>\n );\n};\n\nconst CopyMessageButton: FC = () => (\n <ActionBarPrimitive.Copy asChild>\n <TooltipIconButton tooltip=\"Copy\">\n <AuiIf condition={(s) => s.message.isCopied}>\n <CheckIcon />\n </AuiIf>\n <AuiIf condition={(s) => !s.message.isCopied}>\n <CopyIcon />\n </AuiIf>\n </TooltipIconButton>\n </ActionBarPrimitive.Copy>\n);\n\n/** Regenerate dispatches `run/reload`, so it hides on read-only threads. */\nconst RegenerateMessageButton: FC = () => {\n const readOnly = useMessageActionsReadOnly();\n if (readOnly) return null;\n return (\n <ActionBarPrimitive.Reload asChild>\n <TooltipIconButton tooltip=\"Regenerate\">\n <RefreshCwIcon />\n </TooltipIconButton>\n </ActionBarPrimitive.Reload>\n );\n};\n\n/**\n * The edit primitive does not check the runtime's edit capability itself —\n * clicking it on a runtime without one throws inside onPress — so the button\n * gates on the capability and, to match the rewind semantics of `run/edit`,\n * stays hidden while a run is live or the transcript is read-only.\n */\nconst EditMessageButton: FC = () => {\n const allowEdit = useAuiState((s) => s.thread.capabilities.edit);\n const isRunning = useAthenaRunLive();\n const readOnly = useMessageActionsReadOnly();\n if (!allowEdit || isRunning || readOnly) return null;\n return (\n <ActionBarPrimitive.Edit asChild>\n <TooltipIconButton tooltip=\"Edit\">\n <PencilIcon />\n </TooltipIconButton>\n </ActionBarPrimitive.Edit>\n );\n};\n\n/** Hover-revealed copy / edit row under a user bubble; mirrors the assistant bar. */\nconst AthenaUserActionBar: FC = () => {\n const isThreadRunning = useAuiState((s) => s.thread.isRunning);\n return (\n <ActionBarPrimitive.Root\n autohide=\"never\"\n className={cn(\n 'aui-user-action-bar-root flex min-h-6 gap-1 text-muted-foreground',\n isThreadRunning\n ? 'invisible'\n : [\n ACTION_BAR_REVEAL_CLASS,\n 'group-hover/aui-user-message:pointer-events-auto group-hover/aui-user-message:opacity-100',\n ],\n )}\n >\n <CopyMessageButton />\n <EditMessageButton />\n </ActionBarPrimitive.Root>\n );\n};\n\nexport const AthenaAssistantActionBar: FC<AthenaAssistantActionBarProps> = ({ className }) => {\n const threadId = useAthenaThreadId();\n const { appUrl } = useAthenaConfig();\n // The bar stays mounted so the footer keeps its height: assistant-ui's\n // `autohide` / `hideWhenRunning` unmount it, which shifts the whole message\n // up and down on every hover. Visibility is CSS instead — the latest reply\n // keeps its actions, older replies reveal on hover or keyboard focus, and\n // while the thread runs every bar is `invisible` (layout kept, controls\n // unfocusable — opacity alone would still let Tab reveal them).\n const isLast = useAuiState((s) => s.message.isLast);\n const isThreadRunning = useAuiState((s) => s.thread.isRunning);\n\n return (\n <ActionBarPrimitive.Root\n autohide=\"never\"\n className={cn(\n 'aui-assistant-action-bar-root -ml-1 flex min-h-6 gap-1 text-muted-foreground',\n isThreadRunning && 'invisible',\n !isThreadRunning &&\n !isLast && [\n ACTION_BAR_REVEAL_CLASS,\n 'group-hover/aui-assistant-message:pointer-events-auto group-hover/aui-assistant-message:opacity-100',\n ],\n className,\n )}\n >\n <CopyMessageButton />\n <RegenerateMessageButton />\n <ActionBarMorePrimitive.Root>\n <ActionBarMorePrimitive.Trigger asChild>\n <TooltipIconButton tooltip=\"More\" className=\"data-[state=open]:bg-accent\">\n <MoreHorizontalIcon />\n </TooltipIconButton>\n </ActionBarMorePrimitive.Trigger>\n <ActionBarMorePrimitive.Content\n side=\"bottom\"\n align=\"start\"\n className=\"aui-action-bar-more-content z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md\"\n >\n <ActionBarPrimitive.ExportMarkdown asChild>\n <ActionBarMorePrimitive.Item className=\"aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground\">\n <DownloadIcon className=\"size-4\" />\n Export as Markdown\n </ActionBarMorePrimitive.Item>\n </ActionBarPrimitive.ExportMarkdown>\n {threadId && (\n <ActionBarMorePrimitive.Item\n className=\"aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground\"\n onClick={() => {\n window.open(createAthenaSpacesUrl({ appUrl, sessionId: threadId }), '_blank');\n }}\n >\n <ExternalLinkIcon className=\"size-4\" />\n Open in Athena\n </ActionBarMorePrimitive.Item>\n )}\n </ActionBarMorePrimitive.Content>\n </ActionBarMorePrimitive.Root>\n </ActionBarPrimitive.Root>\n );\n};\n\nexport const AthenaUserMessage: FC<AthenaUserMessageProps> = ({\n TextComponent = TiptapText,\n}) => (\n <MessagePrimitive.Root\n className=\"aui-user-message-root group/aui-user-message fade-in slide-in-from-bottom-1 mx-auto flex w-full max-w-(--thread-max-width) animate-in justify-end px-2 py-3 duration-150\"\n data-role=\"user\"\n >\n <div className=\"flex min-w-0 max-w-full flex-col items-end gap-1\">\n <div className=\"aui-user-message-content wrap-break-word rounded-2xl bg-muted px-4 py-2.5 text-foreground\">\n <MessagePrimitive.Parts components={{ Text: TextComponent }} />\n </div>\n <div className=\"aui-user-message-footer -mr-1 flex items-center gap-1\">\n <BranchPicker />\n <AthenaUserActionBar />\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;AAAA,oBAC9E;AAAA,oBAEA,UAAA;AAAA,sBAAA,oBAAC,kBAAA,EAAiB,WAAU,SAAA,CAAS;AAAA,sBAAE;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBAAA;AAAA,cAEzC;AAAA,YAAA;AAAA,UAAA;AAAA,QAEJ,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;AAEO,MAAM,oBAAgD,CAAC;AAAA,EAC5D,gBAAgB;AAClB,MACE;AAAA,EAAC,iBAAiB;AAAA,EAAjB;AAAA,IACC,WAAU;AAAA,IACV,aAAU;AAAA,IAEV,UAAA,qBAAC,OAAA,EAAI,WAAU,oDACb,UAAA;AAAA,MAAA,oBAAC,OAAA,EAAI,WAAU,6FACb,UAAA,oBAAC,iBAAiB,OAAjB,EAAuB,YAAY,EAAE,MAAM,cAAA,EAAc,CAAG,EAAA,CAC/D;AAAA,MACA,qBAAC,OAAA,EAAI,WAAU,yDACb,UAAA;AAAA,QAAA,oBAAC,cAAA,EAAa;AAAA,4BACb,qBAAA,CAAA,CAAoB;AAAA,MAAA,EAAA,CACvB;AAAA,IAAA,EAAA,CACF;AAAA,EAAA;AACF;"}
|
|
1
|
+
{"version":3,"file":"AthenaChat.js","sources":["../../src/chat/AthenaChat.tsx"],"sourcesContent":["import { isGithubWakeMessage } from '@athenaintel/agent-runtime';\nimport { TiptapText } from './tiptap-text';\nimport { AthenaChatErrorBoundary } from './AthenaChatErrorBoundary';\nimport { StatewireApprovalCard } from './StatewireApprovalCard';\nimport { StatewireQueuedMessages } from './StatewireQueuedMessages';\nimport { StatewireConnectionBanner, StatewireErrorBanner } from './statewire-banners';\nimport { WaitingOnYouBanner } from './WaitingOnYouBanner';\nimport { WakeMarkerMessage } from '../chat-ui/messages/wake-marker';\nimport { ToolFallback, ToolFallbackAppearanceProvider } from '../tools/tool-fallback';\nimport { AppendDocumentToolUI } from '../tools/append-document-tool-ui';\nimport { ReadAssetToolUI } from '../tools/read-asset-tool-ui';\nimport { TOOL_UI_REGISTRY } from '../tools/tool-uis';\nimport { SuperGroupingCard, SuperGroupingFinalText } from './super-grouping/SuperGroupingCard';\nimport {\n NestedPtcComponentsProvider,\n NestedPtcMessages,\n useNestedPtcComponents,\n} from '../tools/NestedPtcMessages';\nimport { TooltipIconButton } from './tooltip-icon-button';\nimport { Button } from '../ui/button';\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../ui/collapsible';\nimport { ChatComposerDock } from '../chat-ui/thread/chat-composer-dock';\nimport { ChatThreadShell } from '../chat-ui/thread/chat-thread-shell';\nimport { StatewireHistoryEdge } from '../chat-ui/thread/statewire-history-edge';\nimport { ThreadLoadingOverlay } from '../chat-ui/thread/thread-loading-overlay';\nimport { ComposerSendOrStop } from '../chat-ui/thread/composer-send-or-stop';\nimport {\n TiptapComposer,\n type ComposerFileIntake,\n type TiptapComposerHandle,\n} from '../chat-ui/composer/tiptap-composer';\nimport {\n MentionAuthCtx,\n type MentionAuthContext,\n} from '../chat-ui/mentions/suggestions/data/api-client';\nimport type { MentionRootCategory } from '../chat-ui/mentions/suggestions/data/use-mention-suggestions';\nimport type { MentionTool } from '../chat-ui/mentions/suggestions/data/types';\nimport { ACTION_BAR_REVEAL_CLASS, BranchPicker } from '../chat-ui/messages/message-components';\nimport { useMessageActionsReadOnly } from '../chat-ui/messages/message-actions-config';\nimport { useAthenaRunLive } from './use-athena-run-live';\nimport {\n AthenaChatWelcome,\n AthenaChatWelcomeSuggestions,\n DEFAULT_WELCOME_SUGGESTIONS,\n welcomeComposerDelayMs,\n welcomeEntrance,\n type WelcomeSuggestion,\n} from './athena-chat-welcome';\nimport {\n ATHENA_COMPOSER_COMPONENTS,\n AthenaComposerMentionButton,\n} from './athena-composer-controls';\nimport { ComposerKeyboardHint, useComposerKeyboardHint } from './composer-keyboard-hint';\nimport { usePrefersReducedMotion } from '../lib/use-prefers-reduced-motion';\nimport {\n ActionBarMorePrimitive,\n ActionBarPrimitive,\n AuiIf,\n ErrorPrimitive,\n MessagePrimitive,\n ThreadPrimitive,\n useAui,\n useAuiState,\n} from '@assistant-ui/react';\nimport type {\n EmptyMessagePartComponent,\n PartState,\n ReasoningMessagePartProps,\n ReasoningMessagePartComponent,\n TextMessagePartProps,\n TextMessagePartComponent,\n ToolCallMessagePartComponent,\n ToolCallMessagePartProps,\n} from '@assistant-ui/react';\nimport {\n AlertCircleIcon,\n ArrowUpIcon,\n BrainIcon,\n CheckIcon,\n ChevronDownIcon,\n ChevronRightIcon,\n CopyIcon,\n DownloadIcon,\n ExternalLinkIcon,\n LayersIcon,\n MoreHorizontalIcon,\n PencilIcon,\n RefreshCwIcon,\n} from 'lucide-react';\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type FC,\n} from 'react';\nimport {\n AthenaStatewireThreadIdContext,\n useAthenaStatewireThreadId,\n useAthenaThreadId,\n} from '../threads/thread-id-context';\nimport { FileUploadButton } from '../composer/FileUploadButton';\nimport { ComposerQuotePreview } from '../composer/ComposerQuotePreview';\nimport { ComposerAttachmentPreview } from '../composer/ComposerAttachmentPreview';\nimport { ComposerDropZone } from '../composer/ComposerDropZone';\nimport { useQuote, QuoteProvider, useQuoteFromPostMessage } from '../composer/QuoteContext';\nimport { AttachmentProvider, useAttachments } from '../composer/AttachmentContext';\nimport { buildComposedMessage } from '../composer/build-composed-message';\nimport { useAttachFiles } from '../composer/useAttachFiles';\nimport { useAthenaConfig } from '../provider/AthenaContext';\nimport { createAthenaSpacesUrl } from '../lib/athena-urls';\nimport { cn, isRecord } from '../lib/utils';\nimport { getToolkitDisplayInfo } from '../toolkits';\nimport {\n RUN_ACTIVITY_COUNTER_SECONDS,\n RUN_ACTIVITY_STALL_SECONDS,\n runActivityKey,\n runActivityLabel,\n runActivityVerb,\n} from './run-activity';\nimport {\n formatDayLabel,\n formatMessageDateTime,\n formatMessageTime,\n isSameCalendarDay,\n parseMessageTime,\n readMessageCreatedAt,\n} from './message-time';\nimport { ThreadScrollToBottom } from './thread-scroll-to-bottom';\n\nfunction QuotePostMessageBridge() {\n useQuoteFromPostMessage();\n return null;\n}\n\nexport type { WelcomeSuggestion } from './athena-chat-welcome';\n\nexport interface AthenaChatProps {\n /** CSS class name for the root element. */\n className?: string;\n /** Welcome heading text. Defaults to \"Hello there!\" */\n welcomeMessage?: string;\n /** Welcome subheading text. */\n welcomeSubtext?: string;\n /**\n * Maximum width of the reading column (messages, welcome, composer).\n * Defaults to \"46rem\" — about 760 px, a comfortable measure for 15 px text.\n */\n maxWidth?: string;\n /**\n * Scroll anchoring for new turns. \"bottom\" (default) keeps the viewport\n * pinned to the end while the assistant streams — classic chat follow.\n * \"top\" pins the just-sent user message to the top of the viewport and\n * intentionally does NOT follow the streaming response (assistant-ui\n * disables autoScroll in that mode), so readers scroll at their own pace.\n */\n turnAnchor?: \"top\" | \"bottom\";\n /**\n * Marks the transcript read-only: Edit and Regenerate hide while Copy stays\n * available. For threads whose server rejects dispatch (e.g. legacy\n * pre-cutover conversations) — the runtime's static capability flags cannot\n * express a per-thread fence, so the host that knows passes it here.\n */\n readOnly?: boolean;\n /** Additional tool UIs to register by name. */\n toolUIs?: Record<string, ToolCallMessagePartComponent>;\n /** Tools / Toolkits offered by the composer's `@` menu beside the asset\n * library. Defaults to the toolkits enabled on the provider. */\n mentionTools?: MentionTool[];\n /** Suggestion cards shown on the welcome screen. Pass `[]` to hide.\n * For workflow launchers outside AthenaChat, use `useSendMessage()`.\n */\n welcomeSuggestions?: WelcomeSuggestion[];\n /** Optional component overrides for message containers and key message parts. */\n components?: AthenaChatComponents;\n /**\n * Fold a turn's tool calls into one collapsible activity group with a\n * count, the answer rendered below it. Defaults to `true`; pass `false` to\n * list every tool card inline in the order it was called.\n */\n groupToolCalls?: boolean;\n}\n\nexport interface AthenaChatMessagePartComponents {\n Text?: TextMessagePartComponent;\n Reasoning?: ReasoningMessagePartComponent;\n Empty?: EmptyMessagePartComponent;\n}\n\nexport interface AthenaChatComponents {\n UserMessage?: FC;\n AssistantMessage?: FC;\n AssistantActionBar?: FC<AthenaAssistantActionBarProps>;\n /**\n * Rendered in the leading column of every assistant turn (a small avatar or\n * mark). Without it the column holds a quiet 2 px rule.\n */\n AssistantAvatar?: FC;\n messageParts?: AthenaChatMessagePartComponents;\n}\n\nexport interface AthenaUserMessageProps {\n TextComponent?: TextMessagePartComponent;\n}\n\nexport interface AthenaAssistantActionBarProps {\n className?: string;\n}\n\nexport interface AthenaAssistantMessageProps {\n toolUIs: Record<string, ToolCallMessagePartComponent>;\n /** Leading-column content for the turn; a quiet 2 px rule when unset. */\n AvatarComponent?: FC;\n TextComponent?: TextMessagePartComponent;\n ReasoningComponent?: ReasoningMessagePartComponent;\n EmptyComponent?: EmptyMessagePartComponent;\n ActionBarComponent?: FC<AthenaAssistantActionBarProps>;\n /** Fold the turn's tool calls into one collapsible activity group. Defaults to `true`. */\n groupToolCalls?: boolean;\n}\n\nexport interface AthenaReasoningPartProps extends ReasoningMessagePartProps {\n TextComponent?: TextMessagePartComponent;\n}\n\ninterface AthenaChatDefaultComponentsContextValue {\n toolUIs: Record<string, ToolCallMessagePartComponent>;\n TextComponent: TextMessagePartComponent;\n ReasoningComponent?: ReasoningMessagePartComponent;\n EmptyComponent: EmptyMessagePartComponent;\n ActionBarComponent: FC<AthenaAssistantActionBarProps>;\n AvatarComponent?: FC;\n groupToolCalls: boolean;\n}\n\nconst AthenaChatDefaultComponentsContext =\n createContext<AthenaChatDefaultComponentsContextValue | null>(null);\n\nconst AthenaReasoningTextComponentContext = createContext<TextMessagePartComponent | null>(null);\n\nconst useAthenaChatDefaultComponents = (): AthenaChatDefaultComponentsContextValue => {\n const value = useContext(AthenaChatDefaultComponentsContext);\n\n if (!value) {\n throw new Error('Athena default chat components must be used within AthenaChat.');\n }\n\n return value;\n};\n\nconst AthenaDefaultAssistantMessage: FC = () => {\n const {\n toolUIs,\n TextComponent,\n ReasoningComponent,\n EmptyComponent,\n ActionBarComponent,\n AvatarComponent,\n groupToolCalls,\n } = useAthenaChatDefaultComponents();\n\n return (\n <AthenaAssistantMessage\n toolUIs={toolUIs}\n AvatarComponent={AvatarComponent}\n TextComponent={TextComponent}\n ReasoningComponent={ReasoningComponent}\n EmptyComponent={EmptyComponent}\n ActionBarComponent={ActionBarComponent}\n groupToolCalls={groupToolCalls}\n />\n );\n};\n\nconst AthenaDefaultUserMessage: FC = () => {\n const { TextComponent } = useAthenaChatDefaultComponents();\n\n return <AthenaUserMessage TextComponent={TextComponent} />;\n};\n\nconst getReasoningTokensFromMetadata = (metadata: unknown): number | undefined => {\n if (!isRecord(metadata)) {\n return undefined;\n }\n\n const customMetadata = metadata.custom;\n if (!isRecord(customMetadata)) {\n return undefined;\n }\n\n const athenaMetadata = customMetadata._athena;\n if (!isRecord(athenaMetadata)) {\n return undefined;\n }\n\n const reasoningTokens = athenaMetadata.reasoningTokens;\n return typeof reasoningTokens === 'number' && Number.isFinite(reasoningTokens)\n ? reasoningTokens\n : undefined;\n};\n\nconst formatReasoningTokens = (reasoningTokens: number) =>\n `${reasoningTokens.toLocaleString('en-US')} ${reasoningTokens === 1 ? 'token' : 'tokens'}`;\n\nconst withNestedPtcMessages = (\n ToolUI: ToolCallMessagePartComponent\n): ToolCallMessagePartComponent => {\n const ToolUIWithNestedPtcMessages: ToolCallMessagePartComponent = (props) => {\n const nestedComponents = useNestedPtcComponents(ToolFallback);\n\n return (\n <>\n <ToolUI {...props} />\n <NestedPtcMessages components={nestedComponents} />\n </>\n );\n };\n\n return ToolUIWithNestedPtcMessages;\n};\n\nexport const AthenaChat: FC<AthenaChatProps> = ({\n className,\n welcomeMessage = \"Hello there!\",\n welcomeSubtext = \"What can I help you with?\",\n maxWidth = \"46rem\",\n turnAnchor = \"bottom\",\n readOnly = false,\n toolUIs,\n mentionTools,\n welcomeSuggestions = DEFAULT_WELCOME_SUGGESTIONS,\n components,\n groupToolCalls = true,\n}) => {\n const athenaConfig = useAthenaConfig();\n // The chat surface is per thread. `AthenaProvider` keeps the host's\n // children mounted across a thread switch and swaps only the client under\n // them, so what used to reset with the whole tree — the composer draft, the\n // viewport's scroll position, the approval card and banner state, a caught\n // render crash — is reset here instead, keyed on the attached thread (the\n // id the provider publishes together with that thread's client, so the\n // fresh surface never renders against the previous thread's runtime).\n const statewireThreadId = useContext(AthenaStatewireThreadIdContext);\n // The mention menu's GraphQL credentials: the backend and credential the\n // provider resolved. `athenaConfig` keeps its identity across token\n // rotations (its `token` is a getter over a ref — see useAthenaConfigValue),\n // so this object is stable too. The mention store lists `accessToken` among\n // its memo dependencies, so it rebuilds (and refetches its lists) on the\n // composer's next render after a rotation; the getter is what hands the\n // rotated token to any fetch before that render. With neither token nor\n // API key the fetch rides the same-origin session cookie, as the SDK's\n // upload and thread REST calls do.\n const mentionAuth = useMemo<MentionAuthContext>(\n () => ({\n backendUrl: athenaConfig.backendUrl,\n appUrl: athenaConfig.appUrl,\n apiKey: athenaConfig.apiKey,\n credentials: 'include',\n get accessToken() {\n return athenaConfig.token ?? undefined;\n },\n }),\n [athenaConfig],\n );\n const providerMentionTools = useMemo<MentionTool[]>(() => {\n const uniqueToolkitIds = Array.from(new Set(athenaConfig.enabledToolkits));\n\n return uniqueToolkitIds.map((id) => {\n const toolkit = getToolkitDisplayInfo(id);\n\n return {\n id: toolkit.id,\n name: toolkit.name,\n description: toolkit.description,\n icon: toolkit.icon,\n type: 'toolkit',\n };\n });\n }, [athenaConfig.enabledToolkits]);\n const tools = mentionTools ?? providerMentionTools;\n const mergedToolUIs = useMemo(\n () => ({\n append_markdown_to_athena_document: AppendDocumentToolUI,\n read_full_asset: ReadAssetToolUI,\n read_asset: ReadAssetToolUI,\n ...TOOL_UI_REGISTRY,\n ...toolUIs,\n }),\n [toolUIs],\n );\n\n const textComponent = components?.messageParts?.Text ?? TiptapText;\n const reasoningComponent = components?.messageParts?.Reasoning;\n const emptyComponent = components?.messageParts?.Empty ?? AthenaAssistantMessageEmpty;\n const actionBarComponent = components?.AssistantActionBar ?? AthenaAssistantActionBar;\n const avatarComponent = components?.AssistantAvatar;\n\n const defaultComponentsContextValue = useMemo<AthenaChatDefaultComponentsContextValue>(\n () => ({\n toolUIs: mergedToolUIs,\n TextComponent: textComponent,\n ReasoningComponent: reasoningComponent,\n EmptyComponent: emptyComponent,\n ActionBarComponent: actionBarComponent,\n AvatarComponent: avatarComponent,\n groupToolCalls,\n }),\n [\n actionBarComponent,\n avatarComponent,\n emptyComponent,\n groupToolCalls,\n mergedToolUIs,\n reasoningComponent,\n textComponent,\n ],\n );\n const AssistantMessageComponent = components?.AssistantMessage ?? AthenaDefaultAssistantMessage;\n const UserMessageComponent = components?.UserMessage ?? AthenaDefaultUserMessage;\n const messageComponents = useMemo(\n () => ({\n UserMessage: UserMessageComponent,\n AssistantMessage: AssistantMessageComponent,\n }),\n [AssistantMessageComponent, UserMessageComponent],\n );\n\n return (\n <AthenaChatDefaultComponentsContext.Provider value={defaultComponentsContextValue}>\n {/* Contain render crashes to the chat pane (telemetry + retry) instead of\n unmounting the integrator's subtree. */}\n <AthenaChatErrorBoundary key={statewireThreadId ?? undefined}>\n {/* Every tool call in the thread — generic fallback, dedicated tool\n UI, nested PTC sub-call — renders as the one-line thread row. */}\n <ToolFallbackAppearanceProvider appearance=\"thread\">\n <ChatThreadShell\n overlay={<ThreadLoadingOverlay />}\n panelClassName={cn(\n 'aui-root aui-thread-root @container relative flex h-full flex-col bg-background',\n className,\n )}\n maxWidth={maxWidth}\n turnAnchor={turnAnchor}\n readOnly={readOnly}\n // Persistent \"waiting on you\" strip above the viewport; the approval\n // card it points at stays in the sticky footer below.\n banners={<WaitingOnYouBanner className=\"px-4 pt-3\" />}\n viewportClassName=\"aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4\"\n contentClassName=\"flex w-full flex-1 flex-col\"\n viewportOverlay={<ThreadScrollToTop />}\n welcome={\n <AthenaChatWelcome welcomeMessage={welcomeMessage} welcomeSubtext={welcomeSubtext} />\n }\n beforeMessages={<StatewireHistoryEdge className=\"aui-thread-history-edge\" />}\n components={messageComponents}\n runningIndicator={null}\n // The scroll-to-bottom pill is docked on the composer (see\n // AthenaChatComposer) instead of floating over the messages; the\n // footer's top padding is the room it sits in.\n scrollToBottom={null}\n viewportFooterClassName=\"aui-thread-viewport-footer sticky bottom-0 mx-auto mt-auto flex w-full max-w-(--thread-max-width) flex-col gap-4 overflow-visible rounded-t-3xl bg-background pt-4 pb-4 md:pb-6\"\n viewportFooter={\n <>\n {/* Empty state: the suggestion cards sit directly above the\n composer (the greeting stays centred in the viewport). */}\n {welcomeSuggestions.length > 0 && (\n <ThreadPrimitive.Empty>\n <AthenaChatWelcomeSuggestions suggestions={welcomeSuggestions} />\n </ThreadPrimitive.Empty>\n )}\n <StatewireConnectionBanner />\n <StatewireErrorBanner />\n <StatewireApprovalCard />\n <StatewireQueuedMessages />\n <AttachmentProvider>\n <QuoteProvider>\n <QuotePostMessageBridge />\n <MentionAuthCtx.Provider value={mentionAuth}>\n <AthenaChatComposer\n tools={tools}\n welcomeSuggestionCount={welcomeSuggestions.length}\n />\n </MentionAuthCtx.Provider>\n </QuoteProvider>\n </AttachmentProvider>\n </>\n }\n />\n </ToolFallbackAppearanceProvider>\n </AthenaChatErrorBoundary>\n </AthenaChatDefaultComponentsContext.Provider>\n );\n};\n\nconst THREAD_VIEWPORT_ATTR = 'data-aui-thread-viewport';\n\nconst useScrollToTop = () => {\n const [isAtTop, setIsAtTop] = useState(true);\n const [buttonEl, setButtonEl] = useState<HTMLButtonElement | null>(null);\n\n const containerRef = useCallback((node: HTMLButtonElement | null) => {\n setButtonEl(node);\n }, []);\n\n const getViewport = useCallback((): HTMLElement | null => {\n if (!buttonEl) return null;\n return buttonEl.closest(`[${THREAD_VIEWPORT_ATTR}]`) as HTMLElement | null;\n }, [buttonEl]);\n\n useEffect(() => {\n const viewport: HTMLElement | null = getViewport();\n if (!viewport) return;\n\n const handleScroll = () => {\n setIsAtTop(viewport.scrollTop <= 50);\n };\n\n handleScroll();\n viewport.addEventListener('scroll', handleScroll, { passive: true });\n return () => viewport.removeEventListener('scroll', handleScroll);\n }, [getViewport]);\n\n const handleClick = useCallback(() => {\n const viewport: HTMLElement | null = getViewport();\n if (!viewport) return;\n viewport.scrollTo({ top: 0, behavior: 'smooth' });\n }, [getViewport]);\n\n return { isAtTop, containerRef, handleClick };\n};\n\nconst ThreadScrollToTop: FC = () => {\n const { isAtTop, containerRef, handleClick } = useScrollToTop();\n const isEmpty = useAuiState((s) => s.thread.isEmpty);\n\n if (isEmpty) return null;\n\n return (\n <div className=\"sticky top-0 z-10 mx-auto flex h-0 w-full max-w-(--thread-max-width) justify-center\">\n <TooltipIconButton\n ref={containerRef}\n tooltip=\"Scroll to top\"\n variant=\"outline\"\n className={cn('aui-thread-scroll-to-top absolute top-2 rounded-full p-4 dark:bg-background dark:hover:bg-accent', isAtTop && 'invisible')}\n onClick={handleClick}\n >\n <ArrowUpIcon />\n </TooltipIconButton>\n </div>\n );\n};\n\n/**\n * The asset-library categories of AthenaChat's `@` menu. Browse profiles,\n * team and drives are left out: they need browser-side scoping or a workspace\n * id that API-key auth does not carry. The Tools / Toolkits categories are\n * added when the host (or the provider's enabled toolkits) offers any.\n */\nconst ATHENA_CHAT_MENTION_CATEGORIES: readonly MentionRootCategory[] = [\n 'favorites',\n 'assets',\n 'projects',\n 'folders',\n];\n\n/**\n * AthenaChat's composer: the shared chat-ui Tiptap editor and `@` mention menu\n * with AthenaChat's quote and attachment pills composed into the send.\n *\n * A draft with a quote or attachment pills — text or not — is intercepted on\n * submit and dispatched as one composed message through the composer runtime,\n * the path the server-owned queue observes, so a mid-run submit queues like\n * any other send. Pasted images upload into the pills through the same intake\n * as the paperclip and the drop zone, and every submit path (Enter, the send\n * button) waits for an in-flight upload so a send never leaves without its\n * attachment. The send control resolves send / queue / stop through the\n * shared chat-ui logic.\n *\n * The chrome is the shared dock's paper appearance (`data-appearance=\"paper\"`\n * on `.aui-composer-root`): the drop zone reports drag-over into\n * `data-drag-active`, the first focus in a browser shows the Enter /\n * Shift+Enter hint until the first send, and a thread that mounts empty\n * brings the composer in last, after the greeting and the suggestion cards.\n */\nconst AthenaChatComposer: FC<{\n tools: MentionTool[];\n /** How many suggestion cards precede the composer's entrance in the empty state. */\n welcomeSuggestionCount: number;\n}> = ({ tools, welcomeSuggestionCount }) => {\n const aui = useAui();\n const threadId = useAthenaStatewireThreadId();\n const { appUrl } = useAthenaConfig();\n const { attachments, clearAttachments, isUploading } = useAttachments();\n const { quote, clearQuote } = useQuote();\n const { attachFiles } = useAttachFiles();\n const composerRef = useRef<TiptapComposerHandle>(null);\n const [hasText, setHasText] = useState(false);\n const [dragActive, setDragActive] = useState(false);\n const keyboardHint = useComposerKeyboardHint();\n const reducedMotion = usePrefersReducedMotion();\n // The staged entrance belongs to the empty state only: a composer that\n // mounts over an existing transcript is simply there.\n const isEmpty = useAuiState((state) => state.thread.isEmpty);\n const [mountedEmpty] = useState(() => isEmpty);\n const entrance = welcomeEntrance(\n welcomeComposerDelayMs(welcomeSuggestionCount),\n reducedMotion || !mountedEmpty,\n );\n\n const rootCategories = useMemo<readonly MentionRootCategory[]>(() => {\n const categories = [...ATHENA_CHAT_MENTION_CATEGORIES];\n if (tools.some((tool) => tool.type === 'toolkit')) categories.push('toolkits');\n if (tools.some((tool) => tool.type === 'tool')) categories.push('tools');\n return categories;\n }, [tools]);\n\n // The submit paths are captured once by the editor's keybinding, so they\n // read the current draft extras through refs.\n const attachmentsRef = useRef(attachments);\n attachmentsRef.current = attachments;\n const quoteRef = useRef(quote);\n quoteRef.current = quote;\n const hasExtras = attachments.length > 0 || quote !== null;\n\n // A submit during an upload parks until the pills have the asset; the\n // waiters resolve on the render that turns `isUploading` off, by which\n // point `attachmentsRef` holds the uploaded asset.\n const isUploadingRef = useRef(isUploading);\n isUploadingRef.current = isUploading;\n const uploadWaitersRef = useRef<Array<() => void>>([]);\n useEffect(() => {\n if (isUploading) return;\n const waiters = uploadWaitersRef.current;\n uploadWaitersRef.current = [];\n for (const resolve of waiters) resolve();\n }, [isUploading]);\n const waitForHostUploads = useCallback(() => {\n if (!isUploadingRef.current) return;\n return new Promise<void>((resolve) => {\n uploadWaitersRef.current.push(resolve);\n });\n }, []);\n\n const sendComposed = useCallback(\n (userText: string): boolean => {\n const message = buildComposedMessage({\n attachments: attachmentsRef.current,\n quote: quoteRef.current,\n userText,\n appUrl,\n });\n if (!message) return false;\n // steer: false — a mid-run send queues behind the active run instead of\n // interrupting it; idle sends dispatch immediately.\n aui.composer.setText(message);\n aui.composer.send({ steer: false });\n clearAttachments();\n clearQuote();\n return true;\n },\n [appUrl, aui, clearAttachments, clearQuote],\n );\n\n // Consumes the editor's draft (possibly empty) only when there are extras\n // to compose with it.\n const interceptSubmit = useCallback(\n (text: string) =>\n attachmentsRef.current.length > 0 || quoteRef.current !== null\n ? sendComposed(text)\n : false,\n [sendComposed],\n );\n\n // Pasted images go through the pills' intake; drops are left to the\n // enclosing ComposerDropZone.\n const fileIntake = useMemo<ComposerFileIntake>(\n () => ({\n onPaste: (files) => {\n void attachFiles(files, 'paste');\n },\n }),\n [attachFiles],\n );\n\n return (\n <ComposerDropZone onDragActiveChange={setDragActive}>\n {/* React delivers `onFocus` as focusin, so the editor's focus reaches\n this wrapper; the same element carries the staged entrance. */}\n <div\n className={cn('aui-composer-entrance', entrance.className)}\n style={entrance.style}\n onFocus={keyboardHint.onFocus}\n >\n <ChatComposerDock\n appearance=\"paper\"\n dragActive={dragActive}\n aboveSurface={<ThreadScrollToBottom />}\n beforeEditor={\n <>\n <ComposerQuotePreview />\n <ComposerAttachmentPreview />\n </>\n }\n editor={\n <TiptapComposer\n ref={composerRef}\n threadId={threadId}\n appearance=\"paper\"\n placeholder=\"Type @ to tag an asset\"\n tools={tools}\n rootCategories={rootCategories}\n onDraftStateChange={setHasText}\n waitForHostUploads={waitForHostUploads}\n interceptSubmit={interceptSubmit}\n fileIntake={fileIntake}\n onSubmitted={keyboardHint.onSubmitted}\n />\n }\n toolbarStart={\n <div className=\"flex items-center gap-1\">\n <FileUploadButton className=\"aui-composer-attach size-8 rounded-full p-0 disabled:opacity-30\" />\n <AthenaComposerMentionButton\n onClick={() => composerRef.current?.openMentionMenu?.()}\n />\n </div>\n }\n toolbarEnd={\n <div className=\"flex items-center gap-1\">\n <ComposerSendOrStop\n composerRef={composerRef}\n hasDraft={hasText || hasExtras}\n sendBlockedReason={isUploading ? 'Upload in progress...' : null}\n components={ATHENA_COMPOSER_COMPONENTS}\n />\n </div>\n }\n belowSurface={<ComposerKeyboardHint visible={keyboardHint.visible} />}\n />\n </div>\n </ComposerDropZone>\n );\n};\n\nconst MessageError: FC = () => (\n <MessagePrimitive.Error>\n <ErrorPrimitive.Root className=\"aui-message-error-root mt-2 flex items-start gap-2 rounded-md border border-destructive bg-destructive/10 p-3 text-destructive text-sm dark:bg-destructive/5 dark:text-red-200\">\n <AlertCircleIcon className=\"mt-0.5 size-4 shrink-0\" />\n <ErrorPrimitive.Message className=\"aui-message-error-message grow\" />\n <ActionBarPrimitive.Reload asChild>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className=\"size-6 shrink-0 text-destructive hover:text-destructive dark:text-red-200 dark:hover:text-red-100\"\n >\n <RefreshCwIcon className=\"size-3.5\" />\n </Button>\n </ActionBarPrimitive.Reload>\n </ErrorPrimitive.Root>\n </MessagePrimitive.Error>\n);\n\n/**\n * The quiet status line under a running turn: one pulsing dot, the verb\n * (\"Thinking…\", or the running tool's activity such as \"Searching the web…\"),\n * the elapsed seconds once the counter is due, and a stall tone once nothing\n * has streamed for a while — so a busy run and a possibly-stuck one stop\n * looking identical. The timer restarts whenever `resetKey` changes.\n */\nconst RunStatusLine: FC<{\n verb: string;\n resetKey: string;\n /** Render nothing until the counter is due (a host header already names the verb). */\n counterOnly?: boolean;\n className?: string;\n}> = ({ verb, resetKey, counterOnly = false, className }) => {\n const [seconds, setSeconds] = useState(0);\n useEffect(() => {\n setSeconds(0);\n const startedAt = Date.now();\n const timer = setInterval(() => {\n setSeconds(Math.floor((Date.now() - startedAt) / 1000));\n }, 1000);\n return () => clearInterval(timer);\n }, [resetKey]);\n const stalled = seconds >= RUN_ACTIVITY_STALL_SECONDS;\n if (counterOnly && seconds < RUN_ACTIVITY_COUNTER_SECONDS) return null;\n return (\n <div\n data-slot=\"run-status-line\"\n data-stalled={stalled ? 'true' : undefined}\n className={cn(\n 'aui-run-activity mt-2 flex items-center gap-2 px-1 text-[12px] text-muted-foreground',\n className,\n )}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n 'size-1.5 shrink-0 rounded-full bg-current opacity-60',\n !stalled && 'animate-pulse motion-reduce:animate-none',\n )}\n />\n <span\n aria-hidden=\"true\"\n className={cn('tabular-nums', stalled && 'text-amber-600 dark:text-amber-400')}\n >\n {runActivityLabel(seconds, verb)}\n </span>\n {/* The visible counter ticks every second; announcing each tick would\n drown a screen reader, so the live region only speaks the two\n meaningful transitions: what the run is doing, and that it looks\n stalled. */}\n <span aria-live=\"polite\" className=\"sr-only\">\n {stalled ? 'Assistant is still working; nothing new for over thirty seconds.' : `${verb}…`}\n </span>\n </div>\n );\n};\n\nconst AthenaAssistantMessageEmpty: EmptyMessagePartComponent = ({ status }) => {\n if (status?.type !== 'running') return null;\n return <RunStatusLine verb=\"Thinking\" resetKey=\"empty\" className=\"mt-0\" />;\n};\n\n/**\n * Renders the empty/loading indicator while a message is running but has no\n * parts yet. `MessagePrimitive.GroupedParts` only renders existing parts, so\n * the indicator can't live inside its switch — it goes here as a sibling.\n */\nconst AthenaMessageEmptyIndicator: FC<{ EmptyComponent: EmptyMessagePartComponent }> = ({\n EmptyComponent,\n}) => {\n const hasParts = useAuiState((s) => s.message.parts.length > 0);\n const isRunning = useAuiState((s) => s.message.status?.type === 'running');\n if (hasParts || !isRunning) return null;\n return <EmptyComponent status={{ type: 'running' }} />;\n};\n\n/**\n * Run-liveness line under a running message whose tail is a tool call: the\n * tool's own verb from the shared registry, an elapsed counter that resets\n * whenever the stream moves the tail part, and the stall tone. Text and\n * reasoning tails animate on their own and render no line.\n */\nconst AthenaMessageActivityIndicator: FC = () => {\n const isRunning = useAuiState((s) => s.message.status?.type === 'running');\n const activityKey = useAuiState((s) => runActivityKey(s.message.parts));\n const verb = useAuiState((s) => runActivityVerb(s.message.parts));\n if (!isRunning || activityKey === null) return null;\n return <RunStatusLine verb={verb ?? 'Working'} resetKey={activityKey} />;\n};\n\n/**\n * The grouped view's running meta: the activity card already names the verb,\n * so this adds only the elapsed counter (after three seconds) and the stall\n * tone, keyed to the stream's tail like the inline indicator.\n */\nconst AthenaGroupedRunMeta: FC = () => {\n const activityKey = useAuiState((s) => runActivityKey(s.message.parts));\n return (\n <RunStatusLine\n verb=\"Working\"\n resetKey={activityKey ?? 'thinking'}\n counterOnly\n className=\"mt-1 px-0\"\n />\n );\n};\nconst renderGroupedRunningMeta = () => <AthenaGroupedRunMeta />;\n\n/**\n * The centered hairline with the date, rendered above the first message of a\n * calendar day that differs from the previous message's. Both messages need\n * the runtime's `_created_at` stamp; without it there is nothing truthful to\n * separate on.\n */\nconst MessageDaySeparator: FC = () => {\n const stamp = useAuiState((s) => readMessageCreatedAt(s.message.metadata?.custom));\n const previousStamp = useAuiState((s) => {\n const index = s.message.index;\n const previous = index > 0 ? s.thread.messages[index - 1] : undefined;\n return readMessageCreatedAt(previous?.metadata?.custom);\n });\n const label = useMemo(() => {\n const date = stamp ? parseMessageTime(stamp) : null;\n const previous = previousStamp ? parseMessageTime(previousStamp) : null;\n if (!date || !previous || isSameCalendarDay(date, previous)) return null;\n return formatDayLabel(date);\n }, [stamp, previousStamp]);\n if (!label) return null;\n return (\n <div\n role=\"separator\"\n aria-label={label}\n data-slot=\"day-separator\"\n className=\"aui-day-separator mb-3 flex w-full items-center gap-3 text-[11px] font-medium text-muted-foreground\"\n >\n <span aria-hidden=\"true\" className=\"h-px flex-1 bg-border\" />\n <span>{label}</span>\n <span aria-hidden=\"true\" className=\"h-px flex-1 bg-border\" />\n </div>\n );\n};\n\n/**\n * The message's clock time, revealed on hover beside the action bar (the\n * full date in its `title`). Reads the runtime's `_created_at` stamp; a\n * message without one shows no time rather than a wrong one.\n */\nconst MessageTimestamp: FC<{ className?: string }> = ({ className }) => {\n const stamp = useAuiState((s) => readMessageCreatedAt(s.message.metadata?.custom));\n const date = useMemo(() => (stamp ? parseMessageTime(stamp) : null), [stamp]);\n if (!date) return null;\n return (\n <time\n dateTime={date.toISOString()}\n title={formatMessageDateTime(date)}\n data-slot=\"message-timestamp\"\n className={cn(\n 'aui-message-timestamp shrink-0 text-[11px] tabular-nums text-muted-foreground',\n ACTION_BAR_REVEAL_CLASS,\n className,\n )}\n >\n {formatMessageTime(date)}\n </time>\n );\n};\n\nexport const AthenaReasoningPart: FC<AthenaReasoningPartProps> = ({\n text,\n status,\n TextComponent,\n}) => {\n const inheritedTextComponent = useContext(AthenaReasoningTextComponentContext);\n const EffectiveTextComponent = TextComponent ?? inheritedTextComponent ?? TiptapText;\n const isMessageRunning = useAuiState((state) => state.message.status?.type === 'running');\n const reasoningTokens = useAuiState((state) =>\n getReasoningTokensFromMetadata(state.message.metadata)\n );\n const isRunning = isMessageRunning || status?.type === 'running';\n const [isCollapsed, setIsCollapsed] = useState(!isRunning);\n const userOverrodeOpenStateRef = useRef(false);\n const hasText = text.trim().length > 0;\n\n const reasoningTextProps: TextMessagePartProps = {\n type: 'text',\n text,\n status: isRunning\n ? ({ type: 'running' } as TextMessagePartProps['status'])\n : (status as TextMessagePartProps['status']),\n };\n\n useEffect(() => {\n if (userOverrodeOpenStateRef.current) {\n return;\n }\n\n setIsCollapsed(!isRunning);\n }, [isRunning]);\n\n if (!hasText && !isRunning) {\n return null;\n }\n\n return (\n <Collapsible\n open={!isCollapsed}\n onOpenChange={(open) => {\n userOverrodeOpenStateRef.current = true;\n setIsCollapsed(!open);\n }}\n className=\"aui-assistant-reasoning-root mb-3 rounded-2xl border border-border/60 bg-muted/30 px-3 py-2\"\n >\n <CollapsibleTrigger asChild>\n <button\n type=\"button\"\n className=\"flex w-full items-center justify-between gap-3 text-left\"\n aria-label={isRunning ? 'Toggle reasoning while streaming' : 'Toggle reasoning'}\n >\n <span className=\"flex min-w-0 items-center gap-2 text-[13px] font-medium text-muted-foreground\">\n <BrainIcon className=\"size-4 shrink-0\" />\n <span>{isRunning ? 'Reasoning...' : 'Reasoning'}</span>\n </span>\n <span className=\"flex shrink-0 items-center gap-2\">\n {reasoningTokens !== undefined && (\n <span className=\"rounded-full border border-border/60 bg-background px-2 py-0.5 text-[11px] font-medium text-muted-foreground\">\n {formatReasoningTokens(reasoningTokens)}\n </span>\n )}\n <span\n className={cn(\n 'flex size-5 items-center justify-center text-muted-foreground transition-transform',\n isCollapsed ? 'rotate-0' : 'rotate-90'\n )}\n aria-hidden=\"true\"\n >\n <ChevronRightIcon className=\"size-4\" />\n </span>\n </span>\n </button>\n </CollapsibleTrigger>\n\n <CollapsibleContent className=\"pt-3\">\n {isRunning && !hasText ? (\n <span className=\"shimmer text-[13px] text-muted-foreground\">Analyzing...</span>\n ) : (\n <div className=\"aui-assistant-reasoning-body text-[13px] leading-relaxed\">\n <EffectiveTextComponent {...reasoningTextProps} />\n </div>\n )}\n </CollapsibleContent>\n </Collapsible>\n );\n};\n\nconst groupAdjacentToolCalls = (part: PartState) =>\n part.type === 'tool-call' ? (['group-tool'] as const) : null;\nconst noToolGrouping = () => null;\n\nexport const AthenaAssistantMessage: FC<AthenaAssistantMessageProps> = ({\n toolUIs,\n AvatarComponent,\n TextComponent = TiptapText,\n ReasoningComponent,\n EmptyComponent = AthenaAssistantMessageEmpty,\n ActionBarComponent = AthenaAssistantActionBar,\n groupToolCalls = true,\n}) => {\n const effectiveReasoningComponent = ReasoningComponent ?? AthenaReasoningPart;\n const toolUIsWithNestedMessages = useMemo(() => {\n const wrappedToolUIs: Record<string, ToolCallMessagePartComponent> = {};\n\n for (const [toolName, ToolUI] of Object.entries(toolUIs)) {\n wrappedToolUIs[toolName] = withNestedPtcMessages(ToolUI);\n }\n\n return wrappedToolUIs;\n }, [toolUIs]);\n\n // NestedPtcComponentsProvider still consumes the legacy parts-config shape\n // (Text / Reasoning / tools.by_name / Empty) to render PTC sub-tool messages\n // inside a tool card. The outer rendering uses GroupedParts, but the inner\n // PTC tree continues to mirror the parent registry.\n const nestedPtcComponents = useMemo(\n () => ({\n Text: TextComponent,\n Reasoning: effectiveReasoningComponent,\n tools: {\n Fallback: ToolFallback,\n by_name: toolUIsWithNestedMessages,\n },\n Empty: EmptyComponent,\n }),\n [EmptyComponent, TextComponent, effectiveReasoningComponent, toolUIsWithNestedMessages],\n );\n\n return (\n <MessagePrimitive.Root\n className=\"aui-assistant-message-root group/aui-assistant-message fade-in slide-in-from-bottom-1 relative mx-auto w-full max-w-(--thread-max-width) animate-in py-3 duration-150\"\n data-role=\"assistant\"\n >\n <MessageDaySeparator />\n <div className=\"flex gap-3\">\n {/* The leading column that makes an assistant turn scannable against\n the right-aligned user bubbles: the host's avatar, else a rule. */}\n <div\n data-slot=\"assistant-lead\"\n className=\"aui-assistant-message-lead flex shrink-0 justify-center\"\n >\n {AvatarComponent ? (\n <AvatarComponent />\n ) : (\n <span\n aria-hidden=\"true\"\n data-slot=\"assistant-rule\"\n className=\"aui-assistant-message-rule w-0.5 self-stretch rounded-full bg-border\"\n />\n )}\n </div>\n <div className=\"min-w-0 flex-1\">\n <AthenaReasoningTextComponentContext.Provider value={TextComponent}>\n <div className=\"aui-assistant-message-content wrap-break-word px-2 text-foreground leading-relaxed\">\n <NestedPtcComponentsProvider components={nestedPtcComponents}>\n {groupToolCalls ? (\n <div className=\"flex flex-col space-y-2\">\n <SuperGroupingCard\n toolUIs={toolUIsWithNestedMessages}\n TextComponent={TextComponent}\n ReasoningComponent={effectiveReasoningComponent}\n renderRunningMeta={renderGroupedRunningMeta}\n />\n <SuperGroupingFinalText TextComponent={TextComponent} />\n </div>\n ) : (\n <>\n <AthenaMessageEmptyIndicator EmptyComponent={EmptyComponent} />\n <MessagePrimitive.GroupedParts groupBy={noToolGrouping}>\n {({ part }) => {\n switch (part.type) {\n case 'tool-call': {\n const ToolUI = toolUIsWithNestedMessages[part.toolName];\n const toolProps = part as unknown as ToolCallMessagePartProps;\n return ToolUI ? <ToolUI {...toolProps} /> : <ToolFallback {...toolProps} />;\n }\n case 'reasoning': {\n const ReasoningRenderer = effectiveReasoningComponent;\n return <ReasoningRenderer {...(part as ReasoningMessagePartProps)} />;\n }\n case 'text': {\n const textPart = part as TextMessagePartProps;\n if (textPart.text === '' && textPart.status?.type === 'running') {\n return <EmptyComponent status={textPart.status} />;\n }\n return <TextComponent {...textPart} />;\n }\n default:\n return null;\n }\n }}\n </MessagePrimitive.GroupedParts>\n <AthenaMessageActivityIndicator />\n </>\n )}\n </NestedPtcComponentsProvider>\n <MessageError />\n </div>\n </AthenaReasoningTextComponentContext.Provider>\n <div className=\"aui-assistant-message-footer mt-1 ml-2 flex items-center gap-1\">\n <BranchPicker />\n <ActionBarComponent />\n <MessageTimestamp className=\"ml-auto group-hover/aui-assistant-message:opacity-100\" />\n </div>\n </div>\n </div>\n </MessagePrimitive.Root>\n );\n};\n\nconst AthenaToolGroup: FC<{ children: React.ReactNode; count: number }> = ({ children, count }) => {\n const [expanded, setExpanded] = useState(false);\n\n return (\n <div className=\"my-3 w-full overflow-hidden rounded-xl border border-border/60 bg-background shadow-sm\">\n <button\n type=\"button\"\n onClick={() => setExpanded((v) => !v)}\n className=\"flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-muted/20\"\n aria-expanded={expanded}\n >\n <div className=\"flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted/60 text-muted-foreground\">\n <LayersIcon className=\"size-4\" />\n </div>\n <div className=\"min-w-0 flex-1\">\n <span className=\"text-[13px] font-medium text-foreground\">\n {count} tool {count === 1 ? 'call' : 'calls'}\n </span>\n </div>\n <ChevronDownIcon\n className={cn(\n 'size-4 shrink-0 text-muted-foreground transition-transform duration-200',\n !expanded && '-rotate-90',\n )}\n />\n </button>\n {expanded && (\n <div className=\"border-t border-border/40 bg-muted/5 px-3 pt-1 pb-2 [&>*]:my-2\">\n {children}\n </div>\n )}\n </div>\n );\n};\n\nconst CopyMessageButton: FC = () => (\n <ActionBarPrimitive.Copy asChild>\n <TooltipIconButton tooltip=\"Copy\">\n <AuiIf condition={(s) => s.message.isCopied}>\n <CheckIcon />\n </AuiIf>\n <AuiIf condition={(s) => !s.message.isCopied}>\n <CopyIcon />\n </AuiIf>\n </TooltipIconButton>\n </ActionBarPrimitive.Copy>\n);\n\n/** Regenerate dispatches `run/reload`, so it hides on read-only threads. */\nconst RegenerateMessageButton: FC = () => {\n const readOnly = useMessageActionsReadOnly();\n if (readOnly) return null;\n return (\n <ActionBarPrimitive.Reload asChild>\n <TooltipIconButton tooltip=\"Regenerate\">\n <RefreshCwIcon />\n </TooltipIconButton>\n </ActionBarPrimitive.Reload>\n );\n};\n\n/**\n * The edit primitive does not check the runtime's edit capability itself —\n * clicking it on a runtime without one throws inside onPress — so the button\n * gates on the capability and, to match the rewind semantics of `run/edit`,\n * stays hidden while a run is live or the transcript is read-only.\n */\nconst EditMessageButton: FC = () => {\n const allowEdit = useAuiState((s) => s.thread.capabilities.edit);\n const isRunning = useAthenaRunLive();\n const readOnly = useMessageActionsReadOnly();\n if (!allowEdit || isRunning || readOnly) return null;\n return (\n <ActionBarPrimitive.Edit asChild>\n <TooltipIconButton tooltip=\"Edit\">\n <PencilIcon />\n </TooltipIconButton>\n </ActionBarPrimitive.Edit>\n );\n};\n\n/** Hover-revealed copy / edit row under a user bubble; mirrors the assistant bar. */\nconst AthenaUserActionBar: FC = () => {\n const isThreadRunning = useAuiState((s) => s.thread.isRunning);\n return (\n <ActionBarPrimitive.Root\n autohide=\"never\"\n className={cn(\n 'aui-user-action-bar-root flex min-h-6 gap-1 text-muted-foreground',\n isThreadRunning\n ? 'invisible'\n : [\n ACTION_BAR_REVEAL_CLASS,\n 'group-hover/aui-user-message:pointer-events-auto group-hover/aui-user-message:opacity-100',\n ],\n )}\n >\n <CopyMessageButton />\n <EditMessageButton />\n </ActionBarPrimitive.Root>\n );\n};\n\nexport const AthenaAssistantActionBar: FC<AthenaAssistantActionBarProps> = ({ className }) => {\n const threadId = useAthenaThreadId();\n const { appUrl } = useAthenaConfig();\n // The bar stays mounted so the footer keeps its height: assistant-ui's\n // `autohide` / `hideWhenRunning` unmount it, which shifts the whole message\n // up and down on every hover. Visibility is CSS instead — the latest reply\n // keeps its actions, older replies reveal on hover or keyboard focus, and\n // while the thread runs every bar is `invisible` (layout kept, controls\n // unfocusable — opacity alone would still let Tab reveal them).\n const isLast = useAuiState((s) => s.message.isLast);\n const isThreadRunning = useAuiState((s) => s.thread.isRunning);\n\n return (\n <ActionBarPrimitive.Root\n autohide=\"never\"\n className={cn(\n 'aui-assistant-action-bar-root -ml-1 flex min-h-6 gap-1 text-muted-foreground',\n isThreadRunning && 'invisible',\n !isThreadRunning &&\n !isLast && [\n ACTION_BAR_REVEAL_CLASS,\n 'group-hover/aui-assistant-message:pointer-events-auto group-hover/aui-assistant-message:opacity-100',\n ],\n className,\n )}\n >\n <CopyMessageButton />\n <RegenerateMessageButton />\n <ActionBarMorePrimitive.Root>\n <ActionBarMorePrimitive.Trigger asChild>\n <TooltipIconButton tooltip=\"More\" className=\"data-[state=open]:bg-accent\">\n <MoreHorizontalIcon />\n </TooltipIconButton>\n </ActionBarMorePrimitive.Trigger>\n <ActionBarMorePrimitive.Content\n side=\"bottom\"\n align=\"start\"\n className=\"aui-action-bar-more-content z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md\"\n >\n <ActionBarPrimitive.ExportMarkdown asChild>\n <ActionBarMorePrimitive.Item className=\"aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground\">\n <DownloadIcon className=\"size-4\" />\n Export as Markdown\n </ActionBarMorePrimitive.Item>\n </ActionBarPrimitive.ExportMarkdown>\n {threadId && (\n <ActionBarMorePrimitive.Item\n className=\"aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground\"\n onClick={() => {\n window.open(createAthenaSpacesUrl({ appUrl, sessionId: threadId }), '_blank');\n }}\n >\n <ExternalLinkIcon className=\"size-4\" />\n Open in Athena\n </ActionBarMorePrimitive.Item>\n )}\n </ActionBarMorePrimitive.Content>\n </ActionBarMorePrimitive.Root>\n </ActionBarPrimitive.Root>\n );\n};\n\nexport const AthenaUserMessage: FC<AthenaUserMessageProps> = ({\n TextComponent = TiptapText,\n}) => {\n // A GitHub wake turn is an event, not words the user typed: it renders as\n // the compact wake marker instead of a bubble quoting the injected text.\n const isWake = useAuiState((s) => isGithubWakeMessage(s.message.metadata?.custom));\n if (isWake) {\n return (\n <MessagePrimitive.Root\n className=\"aui-user-message-root aui-wake-marker-root mx-auto w-full max-w-(--thread-max-width) px-2 py-1\"\n data-role=\"user\"\n >\n <MessageDaySeparator />\n <WakeMarkerMessage />\n </MessagePrimitive.Root>\n );\n }\n return (\n <MessagePrimitive.Root\n className=\"aui-user-message-root group/aui-user-message fade-in slide-in-from-bottom-1 mx-auto flex w-full max-w-(--thread-max-width) animate-in flex-col items-end px-2 py-3 duration-150\"\n data-role=\"user\"\n >\n <MessageDaySeparator />\n {/* A soft bubble on a 75% measure: the user's words stay a bubble, the\n assistant's reading column stays the page. */}\n <div className=\"flex min-w-0 max-w-[75%] flex-col items-end gap-1\">\n <div className=\"aui-user-message-content wrap-break-word rounded-2xl bg-muted/70 px-4 py-2.5 text-foreground\">\n <MessagePrimitive.Parts components={{ Text: TextComponent }} />\n </div>\n <div className=\"aui-user-message-footer -mr-1 flex items-center gap-1\">\n <MessageTimestamp className=\"mr-1 group-hover/aui-user-message:opacity-100\" />\n <BranchPicker />\n <AthenaUserActionBar />\n </div>\n </div>\n </MessagePrimitive.Root>\n );\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AA,QACC,WAAU;AAAA,QACV,aAAU;AAAA,QAEV,UAAA;AAAA,UAAA,oBAAC,qBAAA,EAAoB;AAAA,8BACpB,mBAAA,CAAA,CAAkB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGzB;AACA,SACE;AAAA,IAAC,iBAAiB;AAAA,IAAjB;AAAA,MACC,WAAU;AAAA,MACV,aAAU;AAAA,MAEV,UAAA;AAAA,QAAA,oBAAC,qBAAA,EAAoB;AAAA,QAGrB,qBAAC,OAAA,EAAI,WAAU,qDACb,UAAA;AAAA,UAAA,oBAAC,OAAA,EAAI,WAAU,gGACb,UAAA,oBAAC,iBAAiB,OAAjB,EAAuB,YAAY,EAAE,MAAM,cAAA,EAAc,CAAG,EAAA,CAC/D;AAAA,UACA,qBAAC,OAAA,EAAI,WAAU,yDACb,UAAA;AAAA,YAAA,oBAAC,kBAAA,EAAiB,WAAU,gDAAA,CAAgD;AAAA,gCAC3E,cAAA,EAAa;AAAA,gCACb,qBAAA,CAAA,CAAoB;AAAA,UAAA,EAAA,CACvB;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -7,16 +7,17 @@ const react$1 = require("react");
|
|
|
7
7
|
require("@assistant-ui/tap");
|
|
8
8
|
require("statewire");
|
|
9
9
|
require("../packages/agent-runtime/src/statewire-suspended.cjs");
|
|
10
|
+
require("../packages/agent-runtime/src/conversation-list.cjs");
|
|
10
11
|
require("@tanstack/react-query");
|
|
11
12
|
const interrupts = require("../packages/agent-runtime/src/interrupts.cjs");
|
|
12
13
|
require("../packages/agent-runtime/src/messages.cjs");
|
|
13
14
|
require("../packages/agent-runtime/src/statewire-state.cjs");
|
|
14
15
|
const threadExtras = require("../packages/agent-runtime/src/thread-extras.cjs");
|
|
15
|
-
require("@assistant-ui/react-statewire");
|
|
16
16
|
require("@assistant-ui/store");
|
|
17
17
|
require("../packages/agent-runtime/src/quota-safe-local-storage-session.cjs");
|
|
18
18
|
require("../packages/agent-runtime/src/statewire-attach-observer.cjs");
|
|
19
19
|
require("../packages/agent-runtime/src/thread-status.cjs");
|
|
20
|
+
require("@assistant-ui/react-statewire");
|
|
20
21
|
require("@assistant-ui/core");
|
|
21
22
|
require("../packages/agent-runtime/src/thread-handoff.cjs");
|
|
22
23
|
const lucideReact = require("lucide-react");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatewireApprovalCard.cjs","sources":["../../src/chat/StatewireApprovalCard.tsx"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport type { StatewireThread } from '@assistant-ui/react-statewire';\nimport {\n canApproveForSession,\n fanLaneDecision,\n hasStatewireThreadExtras,\n type HitlApprovalPayload,\n hitlResumeApprove,\n hitlResumeApproveForSession,\n hitlResumeReject,\n interruptResumeDecline,\n laneInterruptIds,\n type PendingActionRequest,\n readInterruptMessage,\n} from '@athenaintel/agent-runtime';\nimport {\n CheckCheckIcon,\n CheckIcon,\n ChevronDownIcon,\n TriangleAlertIcon,\n XIcon,\n} from 'lucide-react';\nimport { type FC, type ReactNode, useCallback, useRef, useState } from 'react';\nimport { cn } from '../lib/utils';\nimport { Button } from '../ui/button';\nimport {\n type StatewireInterruptPredicate,\n useStatewireApprovalRequest,\n} from './use-statewire-approval-request';\n\n/**\n * Human-in-the-loop approval card for the statewire transport — the one\n * approval UI every Athena chat surface mounts (the SDK's `AthenaChat`, the\n * Chrome side panel, the Office task pane, Olympus).\n *\n * When the deep-agent runtime hits an approval-gated tool call, the backend\n * parks the run on an `interrupt` input request. This card reads that request\n * through `useStatewireApprovalRequest` and answers it with\n * `{ type: 'run/input', requestId, response: { type: 'resume', value } }` —\n * the exact command the backend's resume path consumes. Without an answer the\n * run stays parked forever, so this card must be mounted on every statewire\n * chat surface. On legacy (non-statewire) threads it renders nothing.\n *\n * A gated call raised inside a delegated subagent parks only its lane: the\n * host mirrors that interrupt while the sibling lanes keep streaming, before\n * any input request exists. The card renders the mirrored payload the same\n * way and answers it with `run/lane-input` keyed by the lane's langgraph\n * interrupt id (`laneInterruptIds`); the host queues the decision and applies\n * it the moment the run parks, so the approver never waits on the siblings.\n * Once parked, a payload whose calls all carry interrupt ids resumes as a\n * `lane_decisions` map too — one positional `run/input` can only answer the\n * first of several parked lanes.\n *\n * Host-specific review UIs (subagent cards, email summaries) slot in through\n * `renderDetails`; requests another surface answers (typed interrupt\n * families, per-lane subagent approvals) stand down through\n * `isHandledElsewhere`; viewers without edit rights see `readOnlyNotice`.\n */\n\n/** The pending request a host slot renders or judges. */\nexport interface StatewireApprovalRequestContext {\n /** The parked input request — `undefined` while the run still streams (a live lane approval). */\n request: StatewireThread.CustomInputRequest | undefined;\n /** The payload narrowed to the Athena HITL approval shape, or `null` for a generic park. */\n hitl: HitlApprovalPayload | null;\n /** Every gated call the approval covers, in decision order (empty for non-HITL parks). */\n actionRequests: PendingActionRequest[];\n}\n\nexport interface StatewireApprovalCardProps {\n /** Surface-styling overrides merged onto the default classes. */\n classNames?: {\n /** The approval card container. */\n root?: string;\n /** The \"approval was cancelled\" notice container. */\n abandoned?: string;\n /** The disclosed details block. */\n details?: string;\n /** The decision row. */\n actions?: string;\n };\n /** Copy shown when an interrupt payload carries no message. */\n fallbackMessage?: string;\n /**\n * Which pending interrupt this card answers. Defaults to\n * `isApprovalCardInterrupt` (client-tool parks excluded — keep it that way\n * unless the surface handles those itself).\n */\n interruptPredicate?: StatewireInterruptPredicate;\n /**\n * How long a clicked decision keeps the buttons locked when no resume run\n * ever starts (a `run/input` the host rejected before any run began).\n * Defaults to `HITL_PENDING_RESUME_GRACE_MS`.\n */\n pendingResumeGraceMs?: number;\n /**\n * Return true when another surface answers this request (a typed Athena\n * interrupt family, per-lane subagent approval cards). The card renders\n * nothing for it — two surfaces must never answer the same input request.\n */\n isHandledElsewhere?: (context: StatewireApprovalRequestContext) => boolean;\n /**\n * Replace the default argument disclosure (one JSON block per gated call)\n * with a host-specific review UI. Rendered inside the collapsible details\n * region; the decision buttons stay with the card.\n */\n renderDetails?: (context: StatewireApprovalRequestContext) => ReactNode;\n /**\n * The viewer may see the request (it explains why the run is parked) but\n * cannot decide it — answering steers the shared run. Renders\n * `readOnlyNotice` in place of the buttons.\n */\n readOnly?: boolean;\n readOnlyNotice?: ReactNode;\n /**\n * Copy for a park that is not a HITL approval — a typed Athena interrupt\n * this surface has no card for. The only honest action is to decline it\n * (`{ action: 'reject' }`, which every typed raiser treats as a clean user\n * decline); a generic \"Continue\" would be rejected by the raiser's resume\n * schema and surface as a tool error.\n */\n nonHitlNotice?: ReactNode;\n /**\n * The host refused a decision (or the transport lost it). The optimistic\n * fold has rolled back and the request is on screen again with its actions\n * re-enabled; this is where a host tells the user why (a toast, a log line).\n */\n onResumeRejected?: (error: unknown, requestId: string) => void;\n}\n\nexport const StatewireApprovalCard: FC<StatewireApprovalCardProps> = (props) => {\n const extras = useAuiState((s) => s.thread.extras);\n if (!hasStatewireThreadExtras(extras)) return null;\n return <StatewireApprovalCardInner {...props} />;\n};\n\nconst StatewireApprovalCardInner: FC<StatewireApprovalCardProps> = ({\n classNames,\n fallbackMessage,\n interruptPredicate,\n pendingResumeGraceMs,\n isHandledElsewhere,\n renderDetails,\n readOnly = false,\n readOnlyNotice = 'Waiting for someone with edit access to respond.',\n nonHitlNotice = 'This request needs an answer this surface cannot collect.',\n onResumeRejected,\n}) => {\n const {\n request,\n requestId,\n hitl: parkedHitl,\n actionRequests: parkedActionRequests,\n liveHitl,\n liveActionRequests,\n queuedLaneDecisions,\n abandonedInterrupt,\n pending,\n resume,\n sendLaneDecisions,\n } = useStatewireApprovalRequest({ interruptPredicate, pendingResumeGraceMs, onResumeRejected });\n const [dismissedId, setDismissedId] = useState<string>();\n // The card shares the chat column with the thread. A lone gated call is\n // small enough to show inline, but a fan-out of a dozen calls would swallow\n // the conversation, so a batch starts collapsed until someone opens it.\n const [detailsOverride, setDetailsOverride] = useState<boolean>();\n // The live lanes a decision was sent for (joined ids); the buttons stay\n // locked until the host echoes them in `queuedLaneDecisions` or refuses.\n const [liveSentKey, setLiveSentKey] = useState<string>();\n\n const isLive = request === undefined && liveHitl !== null;\n const hitl = isLive ? liveHitl : parkedHitl;\n const actionRequests = isLive ? liveActionRequests : parkedActionRequests;\n const laneIds = laneInterruptIds(actionRequests);\n const undecidedLaneIds = laneIds?.filter((id) => !(id in queuedLaneDecisions)) ?? null;\n const liveKey = isLive ? (laneIds?.join('|') ?? null) : null;\n const viewKey = requestId ?? liveKey ?? undefined;\n\n // A fresh approval gets the default for ITS batch size, not the disclosure\n // the previous one was left in. Reset during render via React's \"previous\n // value\" pattern.\n const prevViewKeyRef = useRef(viewKey);\n if (prevViewKeyRef.current !== viewKey) {\n prevViewKeyRef.current = viewKey;\n if (detailsOverride !== undefined) setDetailsOverride(undefined);\n if (liveSentKey !== undefined) setLiveSentKey(undefined);\n }\n\n const decide = useCallback(\n (value: Record<string, string>) => {\n // Several parked lanes (or a live one) answer by interrupt id: a\n // positional `run/input` would resume only the first and re-park the\n // rest. A lone parked lane keeps the positional resume every host\n // already speaks.\n if (laneIds === null || undecidedLaneIds === null || (!isLive && laneIds.length <= 1)) {\n resume(value);\n return;\n }\n const lanes = fanLaneDecision({ interruptIds: undecidedLaneIds, decision: value });\n if (!isLive) {\n sendLaneDecisions(lanes);\n return;\n }\n const key = undecidedLaneIds.join('|');\n setLiveSentKey(key);\n Promise.resolve(sendLaneDecisions(lanes)).catch((error: unknown) => {\n setLiveSentKey((current) => (current === key ? undefined : current));\n onResumeRejected?.(error, undecidedLaneIds[0] ?? '');\n });\n },\n [laneIds, undecidedLaneIds, isLive, resume, sendLaneDecisions, onResumeRejected],\n );\n\n if (!request && !isLive) {\n if (!abandonedInterrupt || abandonedInterrupt.id === dismissedId) return null;\n return (\n <div\n className={cn(\n 'aui-approval-abandoned flex w-full items-center justify-between gap-3 rounded-xl border border-amber-300 bg-amber-50 px-3 py-2 text-amber-800 text-xs',\n classNames?.abandoned,\n )}\n >\n <p>Approval was cancelled — the run moved on.</p>\n <button\n type=\"button\"\n aria-label=\"Dismiss cancelled approval\"\n onClick={() => setDismissedId(abandonedInterrupt.id)}\n className=\"shrink-0 rounded-md p-1 hover:bg-amber-100\"\n >\n <XIcon className=\"size-3.5\" />\n </button>\n </div>\n );\n }\n\n const context: StatewireApprovalRequestContext = { request, hitl, actionRequests };\n if (isHandledElsewhere?.(context)) return null;\n // A live mirror without lane stamps cannot be answered before the run\n // parks; the parked request renders it then.\n if (isLive && laneIds === null) return null;\n\n const message = readInterruptMessage(request ? request.payload : liveHitl, fallbackMessage);\n const toolName = hitl?.context?.tool_name ?? hitl?.context?.tool_id;\n const pendingCount = hitl?.context?.pending_action_count ?? 1;\n const hasDetails = hitl !== null && actionRequests.length > 0;\n const showDetails = hasDetails && (detailsOverride ?? actionRequests.length <= 1);\n const sessionApprovalOffered = hitl !== null && canApproveForSession(actionRequests);\n const laneDecided =\n undecidedLaneIds !== null &&\n laneIds !== null &&\n (undecidedLaneIds.length === 0 || liveSentKey === undecidedLaneIds.join('|'));\n const locked = pending || laneDecided;\n\n return (\n <section\n aria-label={hitl ? 'Approval required' : 'Input required'}\n className={cn(\n 'aui-approval-card w-full rounded-2xl border border-amber-300 bg-amber-50 px-4 py-3 text-amber-900',\n classNames?.root,\n )}\n >\n <div className=\"flex items-start gap-3\">\n <TriangleAlertIcon className=\"mt-0.5 size-4 shrink-0\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"flex items-center gap-2 font-semibold text-sm\">\n <span>{hitl ? 'Approval required' : 'Waiting for input'}</span>\n {hitl && pendingCount > 1 ? (\n <span className=\"shrink-0 font-normal text-amber-800 text-xs\">\n {pendingCount} tool calls\n </span>\n ) : null}\n </p>\n <p className=\"pt-1 text-amber-800 text-sm leading-snug\">\n {hitl && pendingCount === 1 && toolName ? (\n <>\n <span className=\"font-mono\">{toolName}</span> requires approval before it runs.\n </>\n ) : (\n message\n )}\n </p>\n {isLive ? (\n <p className=\"pt-1 text-amber-700 text-xs\" data-testid=\"statewire-approval-live\">\n {laneDecided\n ? 'Decision sent — it applies as soon as this step pauses.'\n : 'Other work keeps running while you decide.'}\n </p>\n ) : null}\n {hasDetails ? (\n <button\n type=\"button\"\n onClick={() => setDetailsOverride(!showDetails)}\n aria-expanded={showDetails}\n className=\"mt-2 flex items-center gap-1 rounded px-1 py-0.5 text-amber-800 text-xs transition-colors hover:text-amber-950\"\n >\n <ChevronDownIcon\n className={cn('size-3 transition-transform', showDetails && 'rotate-180')}\n />\n {showDetails ? 'Hide details' : 'Review details'}\n </button>\n ) : null}\n {/* EVERY pending gated call renders, in order — one decision\n authorizes the whole batch, so nothing may hide behind a host's\n richer cards. All read-only: this runtime resumes through\n `hitl_response_to_decisions`, which has no `tool_args` channel —\n an editable composer would let someone rewrite an email and then\n watch the original go out. */}\n {showDetails ? (\n <div className={cn('mt-2 flex flex-col gap-2', classNames?.details)}>\n {renderDetails ? (\n renderDetails(context)\n ) : (\n <DefaultApprovalDetails actionRequests={actionRequests} />\n )}\n </div>\n ) : null}\n </div>\n </div>\n <div className={cn('flex flex-wrap items-center gap-2 pt-3', classNames?.actions)}>\n {readOnly ? (\n <p className=\"text-amber-800 text-sm\" data-testid=\"statewire-approval-read-only\">\n {readOnlyNotice}\n </p>\n ) : hitl ? (\n <>\n <Button\n size=\"sm\"\n disabled={locked}\n onClick={() => decide(hitlResumeApprove())}\n className=\"bg-green-600 text-white hover:bg-green-700\"\n >\n <CheckIcon />\n Approve\n </Button>\n {sessionApprovalOffered ? (\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={locked}\n onClick={() => decide(hitlResumeApproveForSession())}\n data-testid=\"statewire-approval-approve-session\"\n >\n <CheckCheckIcon />\n Approve all for this session\n </Button>\n ) : null}\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={locked}\n onClick={() => decide(hitlResumeReject())}\n >\n <XIcon />\n Reject\n </Button>\n </>\n ) : (\n <>\n <p className=\"text-amber-800 text-sm\" data-testid=\"statewire-approval-non-hitl\">\n {nonHitlNotice}\n </p>\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={pending}\n onClick={() => resume(interruptResumeDecline())}\n >\n <XIcon />\n Decline\n </Button>\n </>\n )}\n </div>\n </section>\n );\n};\n\n/** One block per gated call: its name (when the batch has several) and its arguments as JSON. */\nconst DefaultApprovalDetails: FC<{ actionRequests: PendingActionRequest[] }> = ({\n actionRequests,\n}) => (\n <>\n {actionRequests.map((action, index) => (\n <div\n key={`${action.name}-${index}`}\n className=\"rounded-lg bg-amber-100 p-2 text-amber-900 text-xs leading-relaxed\"\n >\n {actionRequests.length > 1 ? (\n <p className=\"font-mono font-semibold\">{action.name}</p>\n ) : null}\n {Object.keys(action.args).length > 0 ? (\n <pre className=\"mt-1 max-h-32 overflow-auto whitespace-pre-wrap break-words rounded bg-white/60 p-1.5 font-mono text-[11px]\">\n {JSON.stringify(action.args, null, 2)}\n </pre>\n ) : (\n <p className=\"text-amber-800\">No arguments.</p>\n )}\n </div>\n ))}\n </>\n);\n"],"names":["useAuiState","hasStatewireThreadExtras","jsx","useStatewireApprovalRequest","useState","laneInterruptIds","useRef","useCallback","fanLaneDecision","jsxs","cn","XIcon","readInterruptMessage","canApproveForSession","TriangleAlertIcon","Fragment","ChevronDownIcon","Button","hitlResumeApprove","CheckIcon","hitlResumeApproveForSession","CheckCheckIcon","hitlResumeReject","interruptResumeDecline"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkIO,MAAM,wBAAwD,CAAC,UAAU;AAC9E,QAAM,SAASA,MAAAA,YAAY,CAAC,MAAM,EAAE,OAAO,MAAM;AACjD,MAAI,CAACC,aAAAA,yBAAyB,MAAM,EAAG,QAAO;AAC9C,SAAOC,+BAAC,4BAAA,EAA4B,GAAG,MAAA,CAAO;AAChD;AAEA,MAAM,6BAA6D,CAAC;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,iBAAiB;AAAA,EAC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,CAAa;AAAA,IAAA;AAAA,EAAA;AAAA,EAXxC,GAAG,OAAO,IAAI,IAAI,KAAK;AAa9B,CACD,GACH;;"}
|
|
1
|
+
{"version":3,"file":"StatewireApprovalCard.cjs","sources":["../../src/chat/StatewireApprovalCard.tsx"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport type { StatewireThread } from '@assistant-ui/react-statewire';\nimport {\n canApproveForSession,\n fanLaneDecision,\n hasStatewireThreadExtras,\n type HitlApprovalPayload,\n hitlResumeApprove,\n hitlResumeApproveForSession,\n hitlResumeReject,\n interruptResumeDecline,\n laneInterruptIds,\n type PendingActionRequest,\n readInterruptMessage,\n} from '@athenaintel/agent-runtime';\nimport {\n CheckCheckIcon,\n CheckIcon,\n ChevronDownIcon,\n TriangleAlertIcon,\n XIcon,\n} from 'lucide-react';\nimport { type FC, type ReactNode, useCallback, useRef, useState } from 'react';\nimport { cn } from '../lib/utils';\nimport { Button } from '../ui/button';\nimport {\n type StatewireInterruptPredicate,\n useStatewireApprovalRequest,\n} from './use-statewire-approval-request';\n\n/**\n * Human-in-the-loop approval card for the statewire transport — the one\n * approval UI every Athena chat surface mounts (the SDK's `AthenaChat`, the\n * Chrome side panel, the Office task pane, Olympus).\n *\n * When the deep-agent runtime hits an approval-gated tool call, the backend\n * parks the run on an `interrupt` input request. This card reads that request\n * through `useStatewireApprovalRequest` and answers it with\n * `{ type: 'run/input', requestId, response: { type: 'resume', value } }` —\n * the exact command the backend's resume path consumes. Without an answer the\n * run stays parked forever, so this card must be mounted on every statewire\n * chat surface. On legacy (non-statewire) threads it renders nothing.\n *\n * A gated call raised inside a delegated subagent parks only its lane: the\n * host mirrors that interrupt while the sibling lanes keep streaming, before\n * any input request exists. The card renders the mirrored payload the same\n * way and answers it with `run/lane-input` keyed by the lane's langgraph\n * interrupt id (`laneInterruptIds`); the host queues the decision and applies\n * it the moment the run parks, so the approver never waits on the siblings.\n * Once parked, a payload whose calls all carry interrupt ids resumes as a\n * `lane_decisions` map too — one positional `run/input` can only answer the\n * first of several parked lanes.\n *\n * Host-specific review UIs (subagent cards, email summaries) slot in through\n * `renderDetails`; requests another surface answers (typed interrupt\n * families, per-lane subagent approvals) stand down through\n * `isHandledElsewhere`; viewers without edit rights see `readOnlyNotice`.\n */\n\n/** The pending request a host slot renders or judges. */\nexport interface StatewireApprovalRequestContext {\n /** The parked input request — `undefined` while the run still streams (a live lane approval). */\n request: StatewireThread.CustomInputRequest | undefined;\n /** The payload narrowed to the Athena HITL approval shape, or `null` for a generic park. */\n hitl: HitlApprovalPayload | null;\n /** Every gated call the approval covers, in decision order (empty for non-HITL parks). */\n actionRequests: PendingActionRequest[];\n}\n\nexport interface StatewireApprovalCardProps {\n /** Surface-styling overrides merged onto the default classes. */\n classNames?: {\n /** The approval card container. */\n root?: string;\n /** The \"approval was cancelled\" notice container. */\n abandoned?: string;\n /** The disclosed details block. */\n details?: string;\n /** The decision row. */\n actions?: string;\n };\n /** Copy shown when an interrupt payload carries no message. */\n fallbackMessage?: string;\n /**\n * Which pending interrupt this card answers. Defaults to\n * `isApprovalCardInterrupt` (client-tool parks excluded — keep it that way\n * unless the surface handles those itself).\n */\n interruptPredicate?: StatewireInterruptPredicate;\n /**\n * How long a clicked decision keeps the buttons locked when no resume run\n * ever starts (a `run/input` the host rejected before any run began).\n * Defaults to `HITL_PENDING_RESUME_GRACE_MS`.\n */\n pendingResumeGraceMs?: number;\n /**\n * Return true when another surface answers this request (a typed Athena\n * interrupt family, per-lane subagent approval cards). The card renders\n * nothing for it — two surfaces must never answer the same input request.\n */\n isHandledElsewhere?: (context: StatewireApprovalRequestContext) => boolean;\n /**\n * Replace the default argument disclosure (one JSON block per gated call)\n * with a host-specific review UI. Rendered inside the collapsible details\n * region; the decision buttons stay with the card.\n */\n renderDetails?: (context: StatewireApprovalRequestContext) => ReactNode;\n /**\n * The viewer may see the request (it explains why the run is parked) but\n * cannot decide it — answering steers the shared run. Renders\n * `readOnlyNotice` in place of the buttons.\n */\n readOnly?: boolean;\n readOnlyNotice?: ReactNode;\n /**\n * Copy for a park that is not a HITL approval — a typed Athena interrupt\n * this surface has no card for. The only honest action is to decline it\n * (`{ action: 'reject' }`, which every typed raiser treats as a clean user\n * decline); a generic \"Continue\" would be rejected by the raiser's resume\n * schema and surface as a tool error.\n */\n nonHitlNotice?: ReactNode;\n /**\n * The host refused a decision (or the transport lost it). The optimistic\n * fold has rolled back and the request is on screen again with its actions\n * re-enabled; this is where a host tells the user why (a toast, a log line).\n */\n onResumeRejected?: (error: unknown, requestId: string) => void;\n}\n\nexport const StatewireApprovalCard: FC<StatewireApprovalCardProps> = (props) => {\n const extras = useAuiState((s) => s.thread.extras);\n if (!hasStatewireThreadExtras(extras)) return null;\n return <StatewireApprovalCardInner {...props} />;\n};\n\nconst StatewireApprovalCardInner: FC<StatewireApprovalCardProps> = ({\n classNames,\n fallbackMessage,\n interruptPredicate,\n pendingResumeGraceMs,\n isHandledElsewhere,\n renderDetails,\n readOnly = false,\n readOnlyNotice = 'Waiting for someone with edit access to respond.',\n nonHitlNotice = 'This request needs an answer this surface cannot collect.',\n onResumeRejected,\n}) => {\n const {\n request,\n requestId,\n hitl: parkedHitl,\n actionRequests: parkedActionRequests,\n liveHitl,\n liveActionRequests,\n queuedLaneDecisions,\n abandonedInterrupt,\n pending,\n resume,\n sendLaneDecisions,\n } = useStatewireApprovalRequest({ interruptPredicate, pendingResumeGraceMs, onResumeRejected });\n const [dismissedId, setDismissedId] = useState<string>();\n // The card shares the chat column with the thread. A lone gated call is\n // small enough to show inline, but a fan-out of a dozen calls would swallow\n // the conversation, so a batch starts collapsed until someone opens it.\n const [detailsOverride, setDetailsOverride] = useState<boolean>();\n // The live lanes a decision was sent for (joined ids); the buttons stay\n // locked until the host echoes them in `queuedLaneDecisions` or refuses.\n const [liveSentKey, setLiveSentKey] = useState<string>();\n\n const isLive = request === undefined && liveHitl !== null;\n const hitl = isLive ? liveHitl : parkedHitl;\n const actionRequests = isLive ? liveActionRequests : parkedActionRequests;\n const laneIds = laneInterruptIds(actionRequests);\n const undecidedLaneIds = laneIds?.filter((id) => !(id in queuedLaneDecisions)) ?? null;\n const liveKey = isLive ? (laneIds?.join('|') ?? null) : null;\n const viewKey = requestId ?? liveKey ?? undefined;\n\n // A fresh approval gets the default for ITS batch size, not the disclosure\n // the previous one was left in. Reset during render via React's \"previous\n // value\" pattern.\n const prevViewKeyRef = useRef(viewKey);\n if (prevViewKeyRef.current !== viewKey) {\n prevViewKeyRef.current = viewKey;\n if (detailsOverride !== undefined) setDetailsOverride(undefined);\n if (liveSentKey !== undefined) setLiveSentKey(undefined);\n }\n\n const decide = useCallback(\n (value: Record<string, string>) => {\n // Several parked lanes (or a live one) answer by interrupt id: a\n // positional `run/input` would resume only the first and re-park the\n // rest. A lone parked lane keeps the positional resume every host\n // already speaks.\n if (laneIds === null || undecidedLaneIds === null || (!isLive && laneIds.length <= 1)) {\n resume(value);\n return;\n }\n const lanes = fanLaneDecision({ interruptIds: undecidedLaneIds, decision: value });\n if (!isLive) {\n sendLaneDecisions(lanes);\n return;\n }\n const key = undecidedLaneIds.join('|');\n setLiveSentKey(key);\n Promise.resolve(sendLaneDecisions(lanes)).catch((error: unknown) => {\n setLiveSentKey((current) => (current === key ? undefined : current));\n onResumeRejected?.(error, undecidedLaneIds[0] ?? '');\n });\n },\n [laneIds, undecidedLaneIds, isLive, resume, sendLaneDecisions, onResumeRejected],\n );\n\n if (!request && !isLive) {\n if (!abandonedInterrupt || abandonedInterrupt.id === dismissedId) return null;\n return (\n <div\n className={cn(\n 'aui-approval-abandoned flex w-full items-center justify-between gap-3 rounded-xl border border-amber-300 bg-amber-50 px-3 py-2 text-amber-800 text-xs',\n classNames?.abandoned,\n )}\n >\n <p>Approval was cancelled — the run moved on.</p>\n <button\n type=\"button\"\n aria-label=\"Dismiss cancelled approval\"\n onClick={() => setDismissedId(abandonedInterrupt.id)}\n className=\"shrink-0 rounded-md p-1 hover:bg-amber-100\"\n >\n <XIcon className=\"size-3.5\" />\n </button>\n </div>\n );\n }\n\n const context: StatewireApprovalRequestContext = { request, hitl, actionRequests };\n if (isHandledElsewhere?.(context)) return null;\n // A live mirror without lane stamps cannot be answered before the run\n // parks; the parked request renders it then.\n if (isLive && laneIds === null) return null;\n\n const message = readInterruptMessage(request ? request.payload : liveHitl, fallbackMessage);\n const toolName = hitl?.context?.tool_name ?? hitl?.context?.tool_id;\n const pendingCount = hitl?.context?.pending_action_count ?? 1;\n const hasDetails = hitl !== null && actionRequests.length > 0;\n const showDetails = hasDetails && (detailsOverride ?? actionRequests.length <= 1);\n const sessionApprovalOffered = hitl !== null && canApproveForSession(actionRequests);\n const laneDecided =\n undecidedLaneIds !== null &&\n laneIds !== null &&\n (undecidedLaneIds.length === 0 || liveSentKey === undecidedLaneIds.join('|'));\n const locked = pending || laneDecided;\n\n return (\n <section\n aria-label={hitl ? 'Approval required' : 'Input required'}\n className={cn(\n 'aui-approval-card w-full rounded-2xl border border-amber-300 bg-amber-50 px-4 py-3 text-amber-900',\n classNames?.root,\n )}\n >\n <div className=\"flex items-start gap-3\">\n <TriangleAlertIcon className=\"mt-0.5 size-4 shrink-0\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"flex items-center gap-2 font-semibold text-sm\">\n <span>{hitl ? 'Approval required' : 'Waiting for input'}</span>\n {hitl && pendingCount > 1 ? (\n <span className=\"shrink-0 font-normal text-amber-800 text-xs\">\n {pendingCount} tool calls\n </span>\n ) : null}\n </p>\n <p className=\"pt-1 text-amber-800 text-sm leading-snug\">\n {hitl && pendingCount === 1 && toolName ? (\n <>\n <span className=\"font-mono\">{toolName}</span> requires approval before it runs.\n </>\n ) : (\n message\n )}\n </p>\n {isLive ? (\n <p className=\"pt-1 text-amber-700 text-xs\" data-testid=\"statewire-approval-live\">\n {laneDecided\n ? 'Decision sent — it applies as soon as this step pauses.'\n : 'Other work keeps running while you decide.'}\n </p>\n ) : null}\n {hasDetails ? (\n <button\n type=\"button\"\n onClick={() => setDetailsOverride(!showDetails)}\n aria-expanded={showDetails}\n className=\"mt-2 flex items-center gap-1 rounded px-1 py-0.5 text-amber-800 text-xs transition-colors hover:text-amber-950\"\n >\n <ChevronDownIcon\n className={cn('size-3 transition-transform', showDetails && 'rotate-180')}\n />\n {showDetails ? 'Hide details' : 'Review details'}\n </button>\n ) : null}\n {/* EVERY pending gated call renders, in order — one decision\n authorizes the whole batch, so nothing may hide behind a host's\n richer cards. All read-only: this runtime resumes through\n `hitl_response_to_decisions`, which has no `tool_args` channel —\n an editable composer would let someone rewrite an email and then\n watch the original go out. */}\n {showDetails ? (\n <div className={cn('mt-2 flex flex-col gap-2', classNames?.details)}>\n {renderDetails ? (\n renderDetails(context)\n ) : (\n <DefaultApprovalDetails actionRequests={actionRequests} />\n )}\n </div>\n ) : null}\n </div>\n </div>\n <div className={cn('flex flex-wrap items-center gap-2 pt-3', classNames?.actions)}>\n {readOnly ? (\n <p className=\"text-amber-800 text-sm\" data-testid=\"statewire-approval-read-only\">\n {readOnlyNotice}\n </p>\n ) : hitl ? (\n <>\n <Button\n size=\"sm\"\n disabled={locked}\n onClick={() => decide(hitlResumeApprove())}\n className=\"bg-green-600 text-white hover:bg-green-700\"\n >\n <CheckIcon />\n Approve\n </Button>\n {sessionApprovalOffered ? (\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={locked}\n onClick={() => decide(hitlResumeApproveForSession())}\n data-testid=\"statewire-approval-approve-session\"\n >\n <CheckCheckIcon />\n Approve all for this session\n </Button>\n ) : null}\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={locked}\n onClick={() => decide(hitlResumeReject())}\n >\n <XIcon />\n Reject\n </Button>\n </>\n ) : (\n <>\n <p className=\"text-amber-800 text-sm\" data-testid=\"statewire-approval-non-hitl\">\n {nonHitlNotice}\n </p>\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={pending}\n onClick={() => resume(interruptResumeDecline())}\n >\n <XIcon />\n Decline\n </Button>\n </>\n )}\n </div>\n </section>\n );\n};\n\n/** One block per gated call: its name (when the batch has several) and its arguments as JSON. */\nconst DefaultApprovalDetails: FC<{ actionRequests: PendingActionRequest[] }> = ({\n actionRequests,\n}) => (\n <>\n {actionRequests.map((action, index) => (\n <div\n key={`${action.name}-${index}`}\n className=\"rounded-lg bg-amber-100 p-2 text-amber-900 text-xs leading-relaxed\"\n >\n {actionRequests.length > 1 ? (\n <p className=\"font-mono font-semibold\">{action.name}</p>\n ) : null}\n {Object.keys(action.args).length > 0 ? (\n <pre className=\"mt-1 max-h-32 overflow-auto whitespace-pre-wrap break-words rounded bg-white/60 p-1.5 font-mono text-[11px]\">\n {JSON.stringify(action.args, null, 2)}\n </pre>\n ) : (\n <p className=\"text-amber-800\">No arguments.</p>\n )}\n </div>\n ))}\n </>\n);\n"],"names":["useAuiState","hasStatewireThreadExtras","jsx","useStatewireApprovalRequest","useState","laneInterruptIds","useRef","useCallback","fanLaneDecision","jsxs","cn","XIcon","readInterruptMessage","canApproveForSession","TriangleAlertIcon","Fragment","ChevronDownIcon","Button","hitlResumeApprove","CheckIcon","hitlResumeApproveForSession","CheckCheckIcon","hitlResumeReject","interruptResumeDecline"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkIO,MAAM,wBAAwD,CAAC,UAAU;AAC9E,QAAM,SAASA,MAAAA,YAAY,CAAC,MAAM,EAAE,OAAO,MAAM;AACjD,MAAI,CAACC,aAAAA,yBAAyB,MAAM,EAAG,QAAO;AAC9C,SAAOC,+BAAC,4BAAA,EAA4B,GAAG,MAAA,CAAO;AAChD;AAEA,MAAM,6BAA6D,CAAC;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB;AACF,MAAM;;AACJ,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,I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|
5
5
|
import "@assistant-ui/tap";
|
|
6
6
|
import "statewire";
|
|
7
7
|
import "../packages/agent-runtime/src/statewire-suspended.js";
|
|
8
|
+
import "../packages/agent-runtime/src/conversation-list.js";
|
|
8
9
|
import "@tanstack/react-query";
|
|
9
10
|
import { laneInterruptIds, fanLaneDecision, readInterruptMessage, canApproveForSession, hitlResumeApprove, hitlResumeApproveForSession, hitlResumeReject, interruptResumeDecline } from "../packages/agent-runtime/src/interrupts.js";
|
|
10
11
|
import "../packages/agent-runtime/src/messages.js";
|
|
11
12
|
import "../packages/agent-runtime/src/statewire-state.js";
|
|
12
13
|
import { hasStatewireThreadExtras } from "../packages/agent-runtime/src/thread-extras.js";
|
|
13
|
-
import "@assistant-ui/react-statewire";
|
|
14
14
|
import "@assistant-ui/store";
|
|
15
15
|
import "../packages/agent-runtime/src/quota-safe-local-storage-session.js";
|
|
16
16
|
import "../packages/agent-runtime/src/statewire-attach-observer.js";
|
|
17
17
|
import "../packages/agent-runtime/src/thread-status.js";
|
|
18
|
+
import "@assistant-ui/react-statewire";
|
|
18
19
|
import "@assistant-ui/core";
|
|
19
20
|
import "../packages/agent-runtime/src/thread-handoff.js";
|
|
20
21
|
import { XIcon, TriangleAlertIcon, ChevronDownIcon, CheckIcon, CheckCheckIcon } from "lucide-react";
|