@athenaintel/react 0.22.4 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +390 -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 +1 -1
- package/src/chat-ui/tailwind-preset.js +14 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statewire-continue-run.js","sources":["../../../src/chat-ui/messages/statewire-continue-run.tsx"],"sourcesContent":["import { type ThreadMessage, useAuiState } from \"@assistant-ui/react\";\nimport {\n useStatewireRuns,\n useStatewireSendCommand,\n} from \"@assistant-ui/react-statewire\";\nimport {\n ATHENA_RUN_MARKER_CANCELLED,\n ATHENA_RUN_MARKER_FAILED,\n type AthenaRuntimeMessage,\n type AthenaRuntimeMessageKind,\n type DeepAgentThreadStatus,\n hasStatewireThreadExtras,\n readRetryableRunRefusal,\n readRunMarkerFromSourceMessages,\n readRuntimeMessageFromSourceMessages,\n useDeepAgentThreadStatus,\n} from \"@athenaintel/agent-runtime\";\nimport type { ReactElement, ReactNode } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { ContinuePill } from \"./continue-pill\";\nimport { RuntimeMessageCard } from \"./runtime-message\";\n\nexport interface StatewireContinueRunButtonProps {\n /**\n * Also offer Continue while the thread projects `ready`. An old snapshot\n * can report a resting thread whose last persisted ending is still\n * continuable; the marker row that mounts this button knows that.\n */\n allowReadyFallback?: boolean;\n /**\n * Called as the continue dispatches (after the pill's exit animation),\n * immediately before the command queues — the host's telemetry hook.\n * Receives the settled status and live run id the user acted on. Queueing\n * publishes the command's first update synchronously, so a hook that pairs\n * this click with that update must run first. Best-effort: a throwing hook\n * is swallowed and never blocks the dispatch.\n */\n onContinue?: (context: { status: DeepAgentThreadStatus; runId: string | null }) => void;\n}\n\nfunction notifyContinue(\n onContinue: StatewireContinueRunButtonProps[\"onContinue\"],\n context: { status: DeepAgentThreadStatus; runId: string | null },\n): void {\n try {\n onContinue?.(context);\n } catch (error) {\n console.debug(\"[StatewireContinueRunButton] onContinue hook failed:\", error);\n }\n}\n\n/**\n * Dispatches the bare `run/continue` for the live Statewire thread — the\n * heal-then-continue recovery for stopped, errored, and pod-drained runs. The\n * command is exactly what the library's `onResume` emits, so it inherits the\n * optimistic running-flip (the pill unmounts once the dispatch is accepted)\n * and routes rejections to the runtime's shared `onError` policy.\n *\n * Gated on the LIVE thread status, never on the persisted marker: markers live\n * in the transcript forever, while continuability is a property of the\n * current run state. Requires `capabilities.continue` on the host thread and\n * a statewire aui scope (throws outside one, like every `useStatewire*` hook).\n */\nexport function StatewireContinueRunButton({\n allowReadyFallback = false,\n onContinue,\n}: StatewireContinueRunButtonProps = {}): ReactElement | null {\n const status = useDeepAgentThreadStatus();\n const { runId } = useStatewireRuns();\n const sendCommand = useStatewireSendCommand();\n\n const isSettled = status === \"stopped\" || status === \"error\";\n if (!isSettled && !(allowReadyFallback && status === \"ready\")) return null;\n\n return (\n <ContinuePill\n ariaLabel=\"Continue this run from where it stopped\"\n dataTestId=\"statewire-continue-run\"\n onClick={() => {\n notifyContinue(onContinue, { status, runId });\n sendCommand({\n type: \"run/continue\",\n ...(runId !== null && { runId }),\n });\n }}\n />\n );\n}\n\nexport interface StatewireContinueRunAffordanceProps {\n /** Forwarded to the mounted `StatewireContinueRunButton`. */\n onContinue?: StatewireContinueRunButtonProps[\"onContinue\"];\n}\n\n/**\n * Recovery affordance for the latest persisted stopped/failed run marker,\n * for the `runtimeMessageAction` slot of `createAssistantMessage`.\n *\n * Marker messages remain in history forever, so only the current last message\n * may continue. The extras guard keeps Statewire hooks out of read-only or\n * legacy runtimes where they would throw.\n */\nexport function StatewireContinueRunAffordance({\n onContinue,\n}: StatewireContinueRunAffordanceProps = {}): ReactElement | null {\n const messageId = useAuiState((state) => state.message.id);\n const lastMessageId = useAuiState(\n (state) => state.thread.messages.at(-1)?.id,\n );\n const runMarker = useAuiState(\n (state) => readRunMarkerFromSourceMessages(state.message)?.marker,\n );\n const threadExtras = useAuiState((state) => state.thread.extras);\n\n const isContinuableMarker =\n runMarker === ATHENA_RUN_MARKER_CANCELLED ||\n runMarker === ATHENA_RUN_MARKER_FAILED;\n if (messageId !== lastMessageId || !isContinuableMarker) return null;\n if (!hasStatewireThreadExtras(threadExtras)) return null;\n\n return (\n <div className=\"flex w-full justify-center py-1\">\n <StatewireContinueRunButton allowReadyFallback onContinue={onContinue} />\n </div>\n );\n}\n\n/** The ending a transcript row paints, as the footer needs to know it. */\nexport interface StatewireTailEnding {\n kind: AthenaRuntimeMessageKind;\n /** A send-now cancellation: kept in the data, painted as nothing. */\n silent: boolean;\n}\n\n/** Reads the runtime ending (marker or handoff) a message row renders, if any. */\nexport type ReadStatewireTailEnding = (message: ThreadMessage) => StatewireTailEnding | null;\n\nconst readRuntimeTailEnding: ReadStatewireTailEnding = (message) => {\n const runtime = readRuntimeMessageFromSourceMessages(message);\n return runtime ? { kind: runtime.kind, silent: runtime.silent } : null;\n};\n\nexport interface StatewireRunEndedFooterActionsContext {\n /** The live settled status the footer describes. */\n status: \"stopped\" | \"error\";\n /** The ending the tail row renders, when it renders one (silent markers read as none). */\n tailEndingKind: AthenaRuntimeMessageKind | null;\n}\n\nexport interface StatewireRunEndedFooterProps {\n /** Merged onto the recovery card's default classes. */\n className?: string;\n /**\n * How the host's assistant row paints the transcript tail. The default reads\n * the runtime ending only (a persisted marker or handoff); a host whose row\n * also styles an assistant-ui error status as a failed ending passes a\n * reader that reports it, so the footer never doubles that row's recovery.\n */\n readTailEnding?: ReadStatewireTailEnding;\n /**\n * The recovery controls. The default renders Continue unless the tail row\n * (a marker of another kind) already carries it; hosts with richer recovery\n * (Retry + Continue) supply their own and decide ownership from the context.\n */\n renderActions?: (context: StatewireRunEndedFooterActionsContext) => ReactNode;\n /** Forwarded to the default Continue action (unused when `renderActions` is set). */\n onContinue?: StatewireContinueRunButtonProps[\"onContinue\"];\n}\n\n/**\n * Recovery row for a settled run whose persisted ending is no longer the\n * transcript tail — rendered after the messages (`renderMessages`). Rewinds,\n * compaction, and older snapshots can all leave the durable run state\n * recoverable without a marker row that owns the action. The failure copy\n * comes from the replicated run error (`runs.error.message`) — the same text\n * the marker would have carried. A RETRYABLE refusal recorded there\n * (`readRetryableRunRefusal`: a closing host refused to start the queued\n * work, which stays in its lane and re-dispatches on the thread's next\n * placement) is not a failure of the run and paints as a pause, keeping\n * Continue as the manual way on. Renders nothing on legacy (non-statewire)\n * threads.\n */\nexport function StatewireRunEndedFooter({\n className,\n readTailEnding,\n renderActions,\n onContinue,\n}: StatewireRunEndedFooterProps = {}): ReactElement | null {\n const threadExtras = useAuiState((state) => state.thread.extras);\n if (!hasStatewireThreadExtras(threadExtras)) return null;\n return (\n <StatewireRunEndedFooterContent\n className={className}\n readTailEnding={readTailEnding}\n renderActions={renderActions}\n onContinue={onContinue}\n />\n );\n}\n\nfunction StatewireRunEndedFooterContent({\n className,\n readTailEnding = readRuntimeTailEnding,\n renderActions,\n onContinue,\n}: StatewireRunEndedFooterProps): ReactElement | null {\n const status = useDeepAgentThreadStatus();\n const { error } = useStatewireRuns();\n // The reader builds a fresh object per call; select primitives so the\n // snapshots stay stable under `Object.is` comparison.\n const tailEndingKind = useAuiState((state) => {\n const last = state.thread.messages.at(-1);\n return last ? (readTailEnding(last)?.kind ?? null) : null;\n });\n const tailEndingSilent = useAuiState((state) => {\n const last = state.thread.messages.at(-1);\n return last ? (readTailEnding(last)?.silent ?? false) : false;\n });\n const transcriptEmpty = useAuiState((state) => state.thread.messages.length === 0);\n\n if (status !== \"stopped\" && status !== \"error\") return null;\n\n // A user stop that retracted the only turn (its text went back to the\n // composer) settles as stopped over an empty transcript: there is no\n // conversation to continue or retry, so the thread reads as fresh.\n if (status === \"stopped\" && transcriptEmpty) return null;\n\n // A send-now promotion intentionally cancels the superseded run without a\n // visible ending. Statewire can briefly report that cancellation as stopped;\n // preserve the silent contract instead of presenting a false recovery state.\n // A genuine error still wins and remains recoverable below.\n if (status === \"stopped\" && tailEndingSilent) return null;\n\n const tailRendersEnding = tailEndingKind !== null && !tailEndingSilent;\n const tailMatchesStatus =\n status === \"error\"\n ? tailEndingKind === \"failed\"\n : tailEndingKind === \"stopped\" || tailEndingKind === \"paused\";\n if (tailRendersEnding && tailMatchesStatus) return null;\n\n // An older run's marker at the tail still carries its own Continue (the\n // marker-row affordance); a handoff banner does not.\n const tailOwnsContinue = tailRendersEnding && tailEndingKind !== \"handoff\";\n const action = renderActions ? (\n renderActions({ status, tailEndingKind: tailRendersEnding ? tailEndingKind : null })\n ) : tailOwnsContinue ? undefined : (\n <StatewireContinueRunButton onContinue={onContinue} />\n );\n const refusal = status === \"error\" ? readRetryableRunRefusal(error) : null;\n const message: AthenaRuntimeMessage =\n status === \"error\"\n ? refusal\n ? {\n kind: \"paused\",\n reason: refusal.code,\n severity: \"info\",\n title: \"Waiting for a server update\",\n detail:\n \"The server hosting this chat is restarting, so the queued message could not start yet. It runs on a ready server automatically.\",\n text: undefined,\n silent: false,\n isSoleSourceMessage: true,\n }\n : {\n kind: \"failed\",\n reason: \"error\",\n severity: \"error\",\n title: \"Run failed\",\n detail: undefined,\n text: error?.message ? `⚠️ The run failed: ${error.message}` : undefined,\n silent: false,\n isSoleSourceMessage: true,\n }\n : {\n kind: \"stopped\",\n reason: undefined,\n severity: \"info\",\n title: \"Conversation stopped\",\n detail: undefined,\n text: undefined,\n silent: false,\n isSoleSourceMessage: true,\n };\n\n return (\n <RuntimeMessageCard\n data-testid=\"statewire-run-ended-footer\"\n message={message}\n action={action}\n className={cn(\"mx-auto max-w-[95%]\", className)}\n />\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAS,eACP,YACA,SACM;AACN,MAAI;AACF,6CAAa;AAAA,EACf,SAAS,OAAO;AACd,YAAQ,MAAM,wDAAwD,KAAK;AAAA,EAC7E;AACF;AAcO,SAAS,2BAA2B;AAAA,EACzC,qBAAqB;AAAA,EACrB;AACF,IAAqC,IAAyB;AAC5D,QAAM,SAAS,yBAAA;AACf,QAAM,EAAE,MAAA,IAAU,iBAAA;AAClB,QAAM,cAAc,wBAAA;AAEpB,QAAM,YAAY,WAAW,aAAa,WAAW;AACrD,MAAI,CAAC,aAAa,EAAE,sBAAsB,WAAW,SAAU,QAAO;AAEtE,SACE;AAAA,IAAC;AAAA,IAAA;A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,IACN,QAAQ;AAAA,IACR,qBAAqB;AAAA,EAAA,IAEvB;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAM,+BAAO,WAAU,sBAAsB,MAAM,OAAO,KAAK;AAAA,IAC/D,QAAQ;AAAA,IACR,qBAAqB;AAAA,EAAA,IAEzB;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,qBAAqB;AAAA,EAAA;AAG7B,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA,WAAW,GAAG,uBAAuB,SAAS;AAAA,IAAA;AAAA,EAAA;AAGpD;"}
|
|
1
|
+
{"version":3,"file":"statewire-continue-run.js","sources":["../../../src/chat-ui/messages/statewire-continue-run.tsx"],"sourcesContent":["import { type ThreadMessage, useAuiState } from \"@assistant-ui/react\";\nimport {\n useStatewireRuns,\n useStatewireSendCommand,\n} from \"@assistant-ui/react-statewire\";\nimport {\n ATHENA_RUN_MARKER_CANCELLED,\n ATHENA_RUN_MARKER_FAILED,\n type AthenaRuntimeMessage,\n type AthenaRuntimeMessageKind,\n type DeepAgentThreadStatus,\n hasStatewireThreadExtras,\n readRetryableRunRefusal,\n readRunMarkerFromSourceMessages,\n readRuntimeMessageFromSourceMessages,\n useDeepAgentThreadStatus,\n} from \"@athenaintel/agent-runtime\";\nimport type { ReactElement, ReactNode } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { ContinuePill } from \"./continue-pill\";\nimport { RuntimeMessageCard } from \"./runtime-message\";\n\nexport interface StatewireContinueRunButtonProps {\n /**\n * Also offer Continue while the thread projects `ready`. An old snapshot\n * can report a resting thread whose last persisted ending is still\n * continuable; the marker row that mounts this button knows that.\n */\n allowReadyFallback?: boolean;\n /**\n * Called as the continue dispatches (after the pill's exit animation),\n * immediately before the command queues — the host's telemetry hook.\n * Receives the settled status and live run id the user acted on. Queueing\n * publishes the command's first update synchronously, so a hook that pairs\n * this click with that update must run first. Best-effort: a throwing hook\n * is swallowed and never blocks the dispatch.\n */\n onContinue?: (context: { status: DeepAgentThreadStatus; runId: string | null }) => void;\n}\n\nfunction notifyContinue(\n onContinue: StatewireContinueRunButtonProps[\"onContinue\"],\n context: { status: DeepAgentThreadStatus; runId: string | null },\n): void {\n try {\n onContinue?.(context);\n } catch (error) {\n console.debug(\"[StatewireContinueRunButton] onContinue hook failed:\", error);\n }\n}\n\n/**\n * Dispatches the bare `run/continue` for the live Statewire thread — the\n * heal-then-continue recovery for stopped, errored, and pod-drained runs. The\n * command is exactly what the library's `onResume` emits, so it inherits the\n * optimistic running-flip (the pill unmounts once the dispatch is accepted)\n * and routes rejections to the runtime's shared `onError` policy.\n *\n * Gated on the LIVE thread status, never on the persisted marker: markers live\n * in the transcript forever, while continuability is a property of the\n * current run state. Requires `capabilities.continue` on the host thread and\n * a statewire aui scope (throws outside one, like every `useStatewire*` hook).\n */\nexport function StatewireContinueRunButton({\n allowReadyFallback = false,\n onContinue,\n}: StatewireContinueRunButtonProps = {}): ReactElement | null {\n const status = useDeepAgentThreadStatus();\n const { runId } = useStatewireRuns();\n const sendCommand = useStatewireSendCommand();\n\n const isSettled = status === \"stopped\" || status === \"error\";\n if (!isSettled && !(allowReadyFallback && status === \"ready\")) return null;\n\n return (\n <ContinuePill\n ariaLabel=\"Continue this run from where it stopped\"\n dataTestId=\"statewire-continue-run\"\n onClick={() => {\n notifyContinue(onContinue, { status, runId });\n sendCommand({\n type: \"run/continue\",\n ...(runId !== null && { runId }),\n });\n }}\n />\n );\n}\n\nexport interface StatewireContinueRunAffordanceProps {\n /** Forwarded to the mounted `StatewireContinueRunButton`. */\n onContinue?: StatewireContinueRunButtonProps[\"onContinue\"];\n}\n\n/**\n * Recovery affordance for the latest persisted stopped/failed run marker,\n * for the `runtimeMessageAction` slot of `createAssistantMessage`.\n *\n * Marker messages remain in history forever, so only the current last message\n * may continue. The extras guard keeps Statewire hooks out of read-only or\n * legacy runtimes where they would throw.\n */\nexport function StatewireContinueRunAffordance({\n onContinue,\n}: StatewireContinueRunAffordanceProps = {}): ReactElement | null {\n const messageId = useAuiState((state) => state.message.id);\n const lastMessageId = useAuiState(\n (state) => state.thread.messages.at(-1)?.id,\n );\n const runMarker = useAuiState(\n (state) => readRunMarkerFromSourceMessages(state.message)?.marker,\n );\n const threadExtras = useAuiState((state) => state.thread.extras);\n\n const isContinuableMarker =\n runMarker === ATHENA_RUN_MARKER_CANCELLED ||\n runMarker === ATHENA_RUN_MARKER_FAILED;\n if (messageId !== lastMessageId || !isContinuableMarker) return null;\n if (!hasStatewireThreadExtras(threadExtras)) return null;\n\n return (\n <div className=\"flex w-full justify-center py-1\">\n <StatewireContinueRunButton allowReadyFallback onContinue={onContinue} />\n </div>\n );\n}\n\n/** The ending a transcript row paints, as the footer needs to know it. */\nexport interface StatewireTailEnding {\n kind: AthenaRuntimeMessageKind;\n /** A send-now cancellation: kept in the data, painted as nothing. */\n silent: boolean;\n}\n\n/** Reads the runtime ending (marker or handoff) a message row renders, if any. */\nexport type ReadStatewireTailEnding = (message: ThreadMessage) => StatewireTailEnding | null;\n\nconst readRuntimeTailEnding: ReadStatewireTailEnding = (message) => {\n const runtime = readRuntimeMessageFromSourceMessages(message);\n return runtime ? { kind: runtime.kind, silent: runtime.silent } : null;\n};\n\nexport interface StatewireRunEndedFooterActionsContext {\n /** The live settled status the footer describes. */\n status: \"stopped\" | \"error\";\n /** The ending the tail row renders, when it renders one (silent markers read as none). */\n tailEndingKind: AthenaRuntimeMessageKind | null;\n}\n\nexport interface StatewireRunEndedFooterProps {\n /** Merged onto the recovery card's default classes. */\n className?: string;\n /**\n * How the host's assistant row paints the transcript tail. The default reads\n * the runtime ending only (a persisted marker or handoff); a host whose row\n * also styles an assistant-ui error status as a failed ending passes a\n * reader that reports it, so the footer never doubles that row's recovery.\n */\n readTailEnding?: ReadStatewireTailEnding;\n /**\n * The recovery controls. The default renders Continue unless the tail row\n * (a marker of another kind) already carries it; hosts with richer recovery\n * (Retry + Continue) supply their own and decide ownership from the context.\n */\n renderActions?: (context: StatewireRunEndedFooterActionsContext) => ReactNode;\n /** Forwarded to the default Continue action (unused when `renderActions` is set). */\n onContinue?: StatewireContinueRunButtonProps[\"onContinue\"];\n}\n\n/**\n * Recovery row for a settled run whose persisted ending is no longer the\n * transcript tail — rendered after the messages (`renderMessages`). Rewinds,\n * compaction, and older snapshots can all leave the durable run state\n * recoverable without a marker row that owns the action. The failure copy\n * comes from the replicated run error (`runs.error.message`) — the same text\n * the marker would have carried. A RETRYABLE refusal recorded there\n * (`readRetryableRunRefusal`: a closing host refused to start the queued\n * work, which stays in its lane and re-dispatches on the thread's next\n * placement) is not a failure of the run and paints as a pause, keeping\n * Continue as the manual way on. Renders nothing on legacy (non-statewire)\n * threads.\n */\nexport function StatewireRunEndedFooter({\n className,\n readTailEnding,\n renderActions,\n onContinue,\n}: StatewireRunEndedFooterProps = {}): ReactElement | null {\n const threadExtras = useAuiState((state) => state.thread.extras);\n if (!hasStatewireThreadExtras(threadExtras)) return null;\n return (\n <StatewireRunEndedFooterContent\n className={className}\n readTailEnding={readTailEnding}\n renderActions={renderActions}\n onContinue={onContinue}\n />\n );\n}\n\nfunction StatewireRunEndedFooterContent({\n className,\n readTailEnding = readRuntimeTailEnding,\n renderActions,\n onContinue,\n}: StatewireRunEndedFooterProps): ReactElement | null {\n const status = useDeepAgentThreadStatus();\n const { error } = useStatewireRuns();\n // The reader builds a fresh object per call; select primitives so the\n // snapshots stay stable under `Object.is` comparison.\n const tailEndingKind = useAuiState((state) => {\n const last = state.thread.messages.at(-1);\n return last ? (readTailEnding(last)?.kind ?? null) : null;\n });\n const tailEndingSilent = useAuiState((state) => {\n const last = state.thread.messages.at(-1);\n return last ? (readTailEnding(last)?.silent ?? false) : false;\n });\n const transcriptEmpty = useAuiState((state) => state.thread.messages.length === 0);\n\n if (status !== \"stopped\" && status !== \"error\") return null;\n\n // A user stop that retracted the only turn (its text went back to the\n // composer) settles as stopped over an empty transcript: there is no\n // conversation to continue or retry, so the thread reads as fresh.\n if (status === \"stopped\" && transcriptEmpty) return null;\n\n // A send-now promotion intentionally cancels the superseded run without a\n // visible ending. Statewire can briefly report that cancellation as stopped;\n // preserve the silent contract instead of presenting a false recovery state.\n // A genuine error still wins and remains recoverable below.\n if (status === \"stopped\" && tailEndingSilent) return null;\n\n const tailRendersEnding = tailEndingKind !== null && !tailEndingSilent;\n const tailMatchesStatus =\n status === \"error\"\n ? tailEndingKind === \"failed\"\n : tailEndingKind === \"stopped\" || tailEndingKind === \"paused\";\n if (tailRendersEnding && tailMatchesStatus) return null;\n\n // An older run's marker at the tail still carries its own Continue (the\n // marker-row affordance); a handoff banner does not.\n const tailOwnsContinue = tailRendersEnding && tailEndingKind !== \"handoff\";\n const action = renderActions ? (\n renderActions({ status, tailEndingKind: tailRendersEnding ? tailEndingKind : null })\n ) : tailOwnsContinue ? undefined : (\n <StatewireContinueRunButton onContinue={onContinue} />\n );\n const refusal = status === \"error\" ? readRetryableRunRefusal(error) : null;\n const message: AthenaRuntimeMessage =\n status === \"error\"\n ? refusal\n ? {\n kind: \"paused\",\n reason: refusal.code,\n severity: \"info\",\n title: \"Waiting for a server update\",\n detail:\n \"The server hosting this chat is restarting, so the queued message could not start yet. It runs on a ready server automatically.\",\n text: undefined,\n silent: false,\n isSoleSourceMessage: true,\n }\n : {\n kind: \"failed\",\n reason: \"error\",\n severity: \"error\",\n title: \"Run failed\",\n detail: undefined,\n text: error?.message ? `⚠️ The run failed: ${error.message}` : undefined,\n silent: false,\n isSoleSourceMessage: true,\n }\n : {\n kind: \"stopped\",\n reason: undefined,\n severity: \"info\",\n title: \"Conversation stopped\",\n detail: undefined,\n text: undefined,\n silent: false,\n isSoleSourceMessage: true,\n };\n\n return (\n <RuntimeMessageCard\n data-testid=\"statewire-run-ended-footer\"\n message={message}\n action={action}\n className={cn(\"mx-auto max-w-[95%]\", className)}\n />\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAS,eACP,YACA,SACM;AACN,MAAI;AACF,6CAAa;AAAA,EACf,SAAS,OAAO;AACd,YAAQ,MAAM,wDAAwD,KAAK;AAAA,EAC7E;AACF;AAcO,SAAS,2BAA2B;AAAA,EACzC,qBAAqB;AAAA,EACrB;AACF,IAAqC,IAAyB;AAC5D,QAAM,SAAS,yBAAA;AACf,QAAM,EAAE,MAAA,IAAU,iBAAA;AAClB,QAAM,cAAc,wBAAA;AAEpB,QAAM,YAAY,WAAW,aAAa,WAAW;AACrD,MAAI,CAAC,aAAa,EAAE,sBAAsB,WAAW,SAAU,QAAO;AAEtE,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,YAAW;AAAA,MACX,SAAS,MAAM;AACb,uBAAe,YAAY,EAAE,QAAQ,MAAA,CAAO;AAC5C,oBAAY;AAAA,UACV,MAAM;AAAA,UACN,GAAI,UAAU,QAAQ,EAAE,MAAA;AAAA,QAAM,CAC/B;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAGN;AAeO,SAAS,+BAA+B;AAAA,EAC7C;AACF,IAAyC,IAAyB;AAChE,QAAM,YAAY,YAAY,CAAC,UAAU,MAAM,QAAQ,EAAE;AACzD,QAAM,gBAAgB;AAAA,IACpB,CAAC,UAAA;;AAAU,yBAAM,OAAO,SAAS,GAAG,EAAE,MAA3B,mBAA8B;AAAA;AAAA,EAAA;AAE3C,QAAM,YAAY;AAAA,IAChB,CAAC,UAAA;;AAAU,mDAAgC,MAAM,OAAO,MAA7C,mBAAgD;AAAA;AAAA,EAAA;AAE7D,QAAM,eAAe,YAAY,CAAC,UAAU,MAAM,OAAO,MAAM;AAE/D,QAAM,sBACJ,cAAc,+BACd,cAAc;AAChB,MAAI,cAAc,iBAAiB,CAAC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AAMpD,MAAI,WAAW,aAAa,iBAAkB,QAAO;AAErD,QAAM,oBAAoB,mBAAmB,QAAQ,CAAC;AACtD,QAAM,oBACJ,WAAW,UACP,mBAAmB,WACnB,mBAAmB,aAAa,mBAAmB;AACzD,MAAI,qBAAqB,kBAAmB,QAAO;AAInD,QAAM,mBAAmB,qBAAqB,mBAAmB;AACjE,QAAM,SAAS,gBACb,cAAc,EAAE,QAAQ,gBAAgB,oBAAoB,iBAAiB,KAAA,CAAM,IACjF,mBAAmB,SACrB,oBAAC,8BAA2B,YAAwB;AAEtD,QAAM,UAAU,WAAW,UAAU,wBAAwB,KAAK,IAAI;AACtE,QAAM,UACJ,WAAW,UACP,UACE;AAAA,IACE,MAAM;AAAA,IACN,QAAQ,QAAQ;AAAA,IAChB,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QACE;AAAA,IACF,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,qBAAqB;AAAA,EAAA,IAEvB;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAM,+BAAO,WAAU,sBAAsB,MAAM,OAAO,KAAK;AAAA,IAC/D,QAAQ;AAAA,IACR,qBAAqB;AAAA,EAAA,IAEzB;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,qBAAqB;AAAA,EAAA;AAG7B,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA,WAAW,GAAG,uBAAuB,SAAS;AAAA,IAAA;AAAA,EAAA;AAGpD;"}
|
|
@@ -7,14 +7,16 @@ 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
|
require("../../packages/agent-runtime/src/statewire-state.cjs");
|
|
12
13
|
require("../../packages/agent-runtime/src/messages.cjs");
|
|
13
|
-
require("@assistant-ui/
|
|
14
|
+
require("@assistant-ui/store");
|
|
14
15
|
const useDeepAgentEditSubmit = require("../../packages/agent-runtime/src/use-deep-agent-edit-submit.cjs");
|
|
15
16
|
require("../../packages/agent-runtime/src/quota-safe-local-storage-session.cjs");
|
|
16
17
|
require("../../packages/agent-runtime/src/statewire-attach-observer.cjs");
|
|
17
18
|
require("../../packages/agent-runtime/src/thread-status.cjs");
|
|
19
|
+
require("@assistant-ui/react-statewire");
|
|
18
20
|
require("@assistant-ui/core");
|
|
19
21
|
require("../../packages/agent-runtime/src/thread-handoff.cjs");
|
|
20
22
|
const UserEditComposer = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-edit-composer.cjs","sources":["../../../src/chat-ui/messages/user-edit-composer.tsx"],"sourcesContent":["import { ComposerPrimitive, useAuiState } from \"@assistant-ui/react\";\nimport { useDeepAgentMessageEditSubmit } from \"@athenaintel/agent-runtime\";\nimport type { FC, KeyboardEvent } from \"react\";\n\n/**\n * Rendered in place of a user message while it is being edited (entered via\n * the action bar's Edit control, which seeds this composer with the message\n * text). Sending leaves as a `run/edit` anchored on the host's own parent of\n * the message (`useDeepAgentMessageEditSubmit`) — on a windowed wire the\n * lane's `anchorBefore` at the window edge — so the rewind is never rejected\n * `wrong-anchor` the way the library's converted-message anchor is after a\n * chunked assistant turn; Escape/Cancel exits edit mode.\n */\nexport const UserEditComposer: FC = () => {\n const submit = useDeepAgentMessageEditSubmit();\n const isEmpty = useAuiState((s) => s.message.composer.isEmpty);\n const onKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key !== \"Enter\" || event.shiftKey || event.nativeEvent.isComposing) return;\n event.preventDefault();\n void submit();\n };\n return (\n <div className=\"mb-3 flex justify-end\" data-testid=\"chat-user-edit-composer\">\n <ComposerPrimitive.Root className=\"flex w-full max-w-[85%] flex-col gap-2 rounded-2xl rounded-br-md border border-border bg-muted px-3.5 py-2.5\">\n <ComposerPrimitive.Input\n autoFocus\n submitMode=\"none\"\n onKeyDown={onKeyDown}\n className=\"w-full resize-none bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground\"\n />\n <div className=\"flex items-center justify-end gap-1.5\">\n <ComposerPrimitive.Cancel asChild>\n <button\n type=\"button\"\n className=\"rounded-lg px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n Cancel\n </button>\n </ComposerPrimitive.Cancel>\n <button\n type=\"button\"\n data-testid=\"chat-user-edit-send\"\n disabled={isEmpty}\n onClick={() => void submit()}\n className=\"rounded-lg bg-foreground px-2.5 py-1 text-xs font-medium text-background shadow-sm transition-colors hover:bg-foreground/80 disabled:cursor-not-allowed disabled:opacity-60\"\n >\n Send\n </button>\n </div>\n </ComposerPrimitive.Root>\n </div>\n );\n};\n"],"names":["useDeepAgentMessageEditSubmit","useAuiState","jsx","jsxs","ComposerPrimitive"],"mappings":"
|
|
1
|
+
{"version":3,"file":"user-edit-composer.cjs","sources":["../../../src/chat-ui/messages/user-edit-composer.tsx"],"sourcesContent":["import { ComposerPrimitive, useAuiState } from \"@assistant-ui/react\";\nimport { useDeepAgentMessageEditSubmit } from \"@athenaintel/agent-runtime\";\nimport type { FC, KeyboardEvent } from \"react\";\n\n/**\n * Rendered in place of a user message while it is being edited (entered via\n * the action bar's Edit control, which seeds this composer with the message\n * text). Sending leaves as a `run/edit` anchored on the host's own parent of\n * the message (`useDeepAgentMessageEditSubmit`) — on a windowed wire the\n * lane's `anchorBefore` at the window edge — so the rewind is never rejected\n * `wrong-anchor` the way the library's converted-message anchor is after a\n * chunked assistant turn; Escape/Cancel exits edit mode.\n */\nexport const UserEditComposer: FC = () => {\n const submit = useDeepAgentMessageEditSubmit();\n const isEmpty = useAuiState((s) => s.message.composer.isEmpty);\n const onKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key !== \"Enter\" || event.shiftKey || event.nativeEvent.isComposing) return;\n event.preventDefault();\n void submit();\n };\n return (\n <div className=\"mb-3 flex justify-end\" data-testid=\"chat-user-edit-composer\">\n <ComposerPrimitive.Root className=\"flex w-full max-w-[85%] flex-col gap-2 rounded-2xl rounded-br-md border border-border bg-muted px-3.5 py-2.5\">\n <ComposerPrimitive.Input\n autoFocus\n submitMode=\"none\"\n onKeyDown={onKeyDown}\n className=\"w-full resize-none bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground\"\n />\n <div className=\"flex items-center justify-end gap-1.5\">\n <ComposerPrimitive.Cancel asChild>\n <button\n type=\"button\"\n className=\"rounded-lg px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n Cancel\n </button>\n </ComposerPrimitive.Cancel>\n <button\n type=\"button\"\n data-testid=\"chat-user-edit-send\"\n disabled={isEmpty}\n onClick={() => void submit()}\n className=\"rounded-lg bg-foreground px-2.5 py-1 text-xs font-medium text-background shadow-sm transition-colors hover:bg-foreground/80 disabled:cursor-not-allowed disabled:opacity-60\"\n >\n Send\n </button>\n </div>\n </ComposerPrimitive.Root>\n </div>\n );\n};\n"],"names":["useDeepAgentMessageEditSubmit","useAuiState","jsx","jsxs","ComposerPrimitive"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAaO,MAAM,mBAAuB,MAAM;AACxC,QAAM,SAASA,uBAAAA,8BAAA;AACf,QAAM,UAAUC,MAAAA,YAAY,CAAC,MAAM,EAAE,QAAQ,SAAS,OAAO;AAC7D,QAAM,YAAY,CAAC,UAA8C;AAC/D,QAAI,MAAM,QAAQ,WAAW,MAAM,YAAY,MAAM,YAAY,YAAa;AAC9E,UAAM,eAAA;AACN,SAAK,OAAA;AAAA,EACP;AACA,SACEC,2BAAAA,IAAC,OAAA,EAAI,WAAU,yBAAwB,eAAY,2BACjD,UAAAC,2BAAAA,KAACC,MAAAA,kBAAkB,MAAlB,EAAuB,WAAU,gHAChC,UAAA;AAAA,IAAAF,2BAAAA;AAAAA,MAACE,MAAAA,kBAAkB;AAAA,MAAlB;AAAA,QACC,WAAS;AAAA,QACT,YAAW;AAAA,QACX;AAAA,QACA,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,IAEZD,2BAAAA,KAAC,OAAA,EAAI,WAAU,yCACb,UAAA;AAAA,MAAAD,2BAAAA,IAACE,MAAAA,kBAAkB,QAAlB,EAAyB,SAAO,MAC/B,UAAAF,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,WAAU;AAAA,UACX,UAAA;AAAA,QAAA;AAAA,MAAA,GAGH;AAAA,MACAA,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,eAAY;AAAA,UACZ,UAAU;AAAA,UACV,SAAS,MAAM,KAAK,OAAA;AAAA,UACpB,WAAU;AAAA,UACX,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAED,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;;"}
|
|
@@ -5,14 +5,16 @@ import "react";
|
|
|
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 "../../packages/agent-runtime/src/statewire-state.js";
|
|
10
11
|
import "../../packages/agent-runtime/src/messages.js";
|
|
11
|
-
import "@assistant-ui/
|
|
12
|
+
import "@assistant-ui/store";
|
|
12
13
|
import { useDeepAgentMessageEditSubmit } from "../../packages/agent-runtime/src/use-deep-agent-edit-submit.js";
|
|
13
14
|
import "../../packages/agent-runtime/src/quota-safe-local-storage-session.js";
|
|
14
15
|
import "../../packages/agent-runtime/src/statewire-attach-observer.js";
|
|
15
16
|
import "../../packages/agent-runtime/src/thread-status.js";
|
|
17
|
+
import "@assistant-ui/react-statewire";
|
|
16
18
|
import "@assistant-ui/core";
|
|
17
19
|
import "../../packages/agent-runtime/src/thread-handoff.js";
|
|
18
20
|
const UserEditComposer = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-edit-composer.js","sources":["../../../src/chat-ui/messages/user-edit-composer.tsx"],"sourcesContent":["import { ComposerPrimitive, useAuiState } from \"@assistant-ui/react\";\nimport { useDeepAgentMessageEditSubmit } from \"@athenaintel/agent-runtime\";\nimport type { FC, KeyboardEvent } from \"react\";\n\n/**\n * Rendered in place of a user message while it is being edited (entered via\n * the action bar's Edit control, which seeds this composer with the message\n * text). Sending leaves as a `run/edit` anchored on the host's own parent of\n * the message (`useDeepAgentMessageEditSubmit`) — on a windowed wire the\n * lane's `anchorBefore` at the window edge — so the rewind is never rejected\n * `wrong-anchor` the way the library's converted-message anchor is after a\n * chunked assistant turn; Escape/Cancel exits edit mode.\n */\nexport const UserEditComposer: FC = () => {\n const submit = useDeepAgentMessageEditSubmit();\n const isEmpty = useAuiState((s) => s.message.composer.isEmpty);\n const onKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key !== \"Enter\" || event.shiftKey || event.nativeEvent.isComposing) return;\n event.preventDefault();\n void submit();\n };\n return (\n <div className=\"mb-3 flex justify-end\" data-testid=\"chat-user-edit-composer\">\n <ComposerPrimitive.Root className=\"flex w-full max-w-[85%] flex-col gap-2 rounded-2xl rounded-br-md border border-border bg-muted px-3.5 py-2.5\">\n <ComposerPrimitive.Input\n autoFocus\n submitMode=\"none\"\n onKeyDown={onKeyDown}\n className=\"w-full resize-none bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground\"\n />\n <div className=\"flex items-center justify-end gap-1.5\">\n <ComposerPrimitive.Cancel asChild>\n <button\n type=\"button\"\n className=\"rounded-lg px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n Cancel\n </button>\n </ComposerPrimitive.Cancel>\n <button\n type=\"button\"\n data-testid=\"chat-user-edit-send\"\n disabled={isEmpty}\n onClick={() => void submit()}\n className=\"rounded-lg bg-foreground px-2.5 py-1 text-xs font-medium text-background shadow-sm transition-colors hover:bg-foreground/80 disabled:cursor-not-allowed disabled:opacity-60\"\n >\n Send\n </button>\n </div>\n </ComposerPrimitive.Root>\n </div>\n );\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"user-edit-composer.js","sources":["../../../src/chat-ui/messages/user-edit-composer.tsx"],"sourcesContent":["import { ComposerPrimitive, useAuiState } from \"@assistant-ui/react\";\nimport { useDeepAgentMessageEditSubmit } from \"@athenaintel/agent-runtime\";\nimport type { FC, KeyboardEvent } from \"react\";\n\n/**\n * Rendered in place of a user message while it is being edited (entered via\n * the action bar's Edit control, which seeds this composer with the message\n * text). Sending leaves as a `run/edit` anchored on the host's own parent of\n * the message (`useDeepAgentMessageEditSubmit`) — on a windowed wire the\n * lane's `anchorBefore` at the window edge — so the rewind is never rejected\n * `wrong-anchor` the way the library's converted-message anchor is after a\n * chunked assistant turn; Escape/Cancel exits edit mode.\n */\nexport const UserEditComposer: FC = () => {\n const submit = useDeepAgentMessageEditSubmit();\n const isEmpty = useAuiState((s) => s.message.composer.isEmpty);\n const onKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key !== \"Enter\" || event.shiftKey || event.nativeEvent.isComposing) return;\n event.preventDefault();\n void submit();\n };\n return (\n <div className=\"mb-3 flex justify-end\" data-testid=\"chat-user-edit-composer\">\n <ComposerPrimitive.Root className=\"flex w-full max-w-[85%] flex-col gap-2 rounded-2xl rounded-br-md border border-border bg-muted px-3.5 py-2.5\">\n <ComposerPrimitive.Input\n autoFocus\n submitMode=\"none\"\n onKeyDown={onKeyDown}\n className=\"w-full resize-none bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground\"\n />\n <div className=\"flex items-center justify-end gap-1.5\">\n <ComposerPrimitive.Cancel asChild>\n <button\n type=\"button\"\n className=\"rounded-lg px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n Cancel\n </button>\n </ComposerPrimitive.Cancel>\n <button\n type=\"button\"\n data-testid=\"chat-user-edit-send\"\n disabled={isEmpty}\n onClick={() => void submit()}\n className=\"rounded-lg bg-foreground px-2.5 py-1 text-xs font-medium text-background shadow-sm transition-colors hover:bg-foreground/80 disabled:cursor-not-allowed disabled:opacity-60\"\n >\n Send\n </button>\n </div>\n </ComposerPrimitive.Root>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAaO,MAAM,mBAAuB,MAAM;AACxC,QAAM,SAAS,8BAAA;AACf,QAAM,UAAU,YAAY,CAAC,MAAM,EAAE,QAAQ,SAAS,OAAO;AAC7D,QAAM,YAAY,CAAC,UAA8C;AAC/D,QAAI,MAAM,QAAQ,WAAW,MAAM,YAAY,MAAM,YAAY,YAAa;AAC9E,UAAM,eAAA;AACN,SAAK,OAAA;AAAA,EACP;AACA,SACE,oBAAC,OAAA,EAAI,WAAU,yBAAwB,eAAY,2BACjD,UAAA,qBAAC,kBAAkB,MAAlB,EAAuB,WAAU,gHAChC,UAAA;AAAA,IAAA;AAAA,MAAC,kBAAkB;AAAA,MAAlB;AAAA,QACC,WAAS;AAAA,QACT,YAAW;AAAA,QACX;AAAA,QACA,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,IAEZ,qBAAC,OAAA,EAAI,WAAU,yCACb,UAAA;AAAA,MAAA,oBAAC,kBAAkB,QAAlB,EAAyB,SAAO,MAC/B,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,WAAU;AAAA,UACX,UAAA;AAAA,QAAA;AAAA,MAAA,GAGH;AAAA,MACA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,eAAY;AAAA,UACZ,UAAU;AAAA,UACV,SAAS,MAAM,KAAK,OAAA;AAAA,UACpB,WAAU;AAAA,UACX,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAED,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const react = require("@assistant-ui/react");
|
|
5
|
+
require("../../packages/agent-runtime/src/generated/runconfig-contract.cjs");
|
|
6
|
+
const react$1 = require("react");
|
|
7
|
+
require("@assistant-ui/tap");
|
|
8
|
+
require("statewire");
|
|
9
|
+
require("../../packages/agent-runtime/src/statewire-suspended.cjs");
|
|
10
|
+
require("../../packages/agent-runtime/src/conversation-list.cjs");
|
|
11
|
+
require("@tanstack/react-query");
|
|
12
|
+
require("../../packages/agent-runtime/src/statewire-state.cjs");
|
|
13
|
+
require("../../packages/agent-runtime/src/messages.cjs");
|
|
14
|
+
require("@assistant-ui/store");
|
|
15
|
+
require("../../packages/agent-runtime/src/quota-safe-local-storage-session.cjs");
|
|
16
|
+
require("../../packages/agent-runtime/src/statewire-attach-observer.cjs");
|
|
17
|
+
require("../../packages/agent-runtime/src/thread-status.cjs");
|
|
18
|
+
require("@assistant-ui/react-statewire");
|
|
19
|
+
const githubWakeEvent = require("../../packages/agent-runtime/src/github-wake-event.cjs");
|
|
20
|
+
require("@assistant-ui/core");
|
|
21
|
+
require("../../packages/agent-runtime/src/thread-handoff.cjs");
|
|
22
|
+
const lucideReact = require("lucide-react");
|
|
23
|
+
const cnfast = require("cnfast");
|
|
24
|
+
const WakeMarkerCard = ({ event, className, ...rest }) => {
|
|
25
|
+
const target = event.number !== null ? `#${event.number}` : event.repo;
|
|
26
|
+
const reference = githubWakeEvent.githubWakeReference(event);
|
|
27
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
...rest,
|
|
31
|
+
role: "status",
|
|
32
|
+
"data-runtime-message-kind": "wake",
|
|
33
|
+
"data-testid": "wake-marker",
|
|
34
|
+
className: cnfast.cn(
|
|
35
|
+
"my-2 flex w-full items-start gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-muted-foreground text-sm",
|
|
36
|
+
className
|
|
37
|
+
),
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.GitPullRequestIcon, { className: "mt-0.5 size-4 shrink-0", "aria-hidden": "true" }),
|
|
40
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5 break-words [overflow-wrap:anywhere]", children: [
|
|
41
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-medium", children: [
|
|
42
|
+
"Woke: ",
|
|
43
|
+
githubWakeEvent.githubWakeEventLabel(event),
|
|
44
|
+
" on",
|
|
45
|
+
" ",
|
|
46
|
+
event.url ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
47
|
+
"a",
|
|
48
|
+
{
|
|
49
|
+
href: event.url,
|
|
50
|
+
target: "_blank",
|
|
51
|
+
rel: "noopener noreferrer",
|
|
52
|
+
title: event.title ?? reference,
|
|
53
|
+
className: "underline-offset-2 hover:underline",
|
|
54
|
+
children: target
|
|
55
|
+
}
|
|
56
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("span", { title: event.title ?? reference, children: target })
|
|
57
|
+
] }),
|
|
58
|
+
event.sender || event.title ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs opacity-90", children: [
|
|
59
|
+
event.sender ? `by ${event.sender}` : null,
|
|
60
|
+
event.sender && event.title ? " · " : null,
|
|
61
|
+
event.title
|
|
62
|
+
] }) : null,
|
|
63
|
+
event.bodyExcerpt ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "truncate text-xs italic opacity-90", title: event.bodyExcerpt, children: [
|
|
64
|
+
"“",
|
|
65
|
+
event.bodyExcerpt,
|
|
66
|
+
"”"
|
|
67
|
+
] }) : null
|
|
68
|
+
] })
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
const WakeMarkerMessage = ({ className }) => {
|
|
74
|
+
const custom = react.useAuiState((s) => {
|
|
75
|
+
var _a;
|
|
76
|
+
return (_a = s.message.metadata) == null ? void 0 : _a.custom;
|
|
77
|
+
});
|
|
78
|
+
const event = react$1.useMemo(() => githubWakeEvent.readGithubWakeEvent(custom), [custom]);
|
|
79
|
+
if (!event) return null;
|
|
80
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WakeMarkerCard, { event, className });
|
|
81
|
+
};
|
|
82
|
+
exports.WakeMarkerCard = WakeMarkerCard;
|
|
83
|
+
exports.WakeMarkerMessage = WakeMarkerMessage;
|
|
84
|
+
//# sourceMappingURL=wake-marker.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wake-marker.cjs","sources":["../../../src/chat-ui/messages/wake-marker.tsx"],"sourcesContent":["/**\n * The runtime marker for a wake turn: a GitHub webhook woke the session and\n * injected a user message (see `@athenaintel/agent-runtime`'s\n * `github-wake-event.ts`). It renders in the same visual language as the\n * runtime-ending card (`RuntimeMessageCard`) — a compact status row, not a\n * user bubble quoting the whole wake text.\n */\nimport { useAuiState } from \"@assistant-ui/react\";\nimport {\n type GithubWakeEvent,\n githubWakeEventLabel,\n githubWakeReference,\n readGithubWakeEvent,\n} from \"@athenaintel/agent-runtime\";\nimport { GitPullRequestIcon } from \"lucide-react\";\nimport { type ComponentPropsWithoutRef, type FC, useMemo } from \"react\";\nimport { cn } from \"../../lib/utils\";\n\nexport interface WakeMarkerCardProps\n extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\" | \"role\"> {\n event: GithubWakeEvent;\n}\n\n/** The \"Woke: review comment on #36337\" row; pure presenter. */\nexport const WakeMarkerCard: FC<WakeMarkerCardProps> = ({ event, className, ...rest }) => {\n const target = event.number !== null ? `#${event.number}` : event.repo;\n const reference = githubWakeReference(event);\n return (\n <div\n {...rest}\n role=\"status\"\n data-runtime-message-kind=\"wake\"\n data-testid=\"wake-marker\"\n className={cn(\n \"my-2 flex w-full items-start gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-muted-foreground text-sm\",\n className,\n )}\n >\n <GitPullRequestIcon className=\"mt-0.5 size-4 shrink-0\" aria-hidden=\"true\" />\n <div className=\"flex min-w-0 flex-1 flex-col gap-0.5 break-words [overflow-wrap:anywhere]\">\n <span className=\"font-medium\">\n Woke: {githubWakeEventLabel(event)} on{\" \"}\n {event.url ? (\n <a\n href={event.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n title={event.title ?? reference}\n className=\"underline-offset-2 hover:underline\"\n >\n {target}\n </a>\n ) : (\n <span title={event.title ?? reference}>{target}</span>\n )}\n </span>\n {event.sender || event.title ? (\n <span className=\"text-xs opacity-90\">\n {event.sender ? `by ${event.sender}` : null}\n {event.sender && event.title ? \" · \" : null}\n {event.title}\n </span>\n ) : null}\n {event.bodyExcerpt ? (\n <span className=\"truncate text-xs italic opacity-90\" title={event.bodyExcerpt}>\n “{event.bodyExcerpt}”\n </span>\n ) : null}\n </div>\n </div>\n );\n};\n\n/**\n * {@link WakeMarkerCard} bound to the assistant-ui message in scope. Selects\n * the message's `metadata.custom` (a stable store reference) and derives the\n * envelope from it: the reader allocates a fresh object per call, so selecting\n * its result directly would re-render on every store update.\n */\nexport const WakeMarkerMessage: FC<{ className?: string }> = ({ className }) => {\n const custom = useAuiState((s) => s.message.metadata?.custom);\n const event = useMemo(() => readGithubWakeEvent(custom), [custom]);\n if (!event) return null;\n return <WakeMarkerCard event={event} className={className} />;\n};\n"],"names":["githubWakeReference","jsxs","cn","jsx","GitPullRequestIcon","githubWakeEventLabel","useAuiState","useMemo","readGithubWakeEvent"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,WAAU,sCAAqC,OAAO,MAAM,aAAa,UAAA;AAAA,YAAA;AAAA,YAC3E,MAAM;AAAA,YAAY;AAAA,UAAA,EAAA,CACtB,IACE;AAAA,QAAA,EAAA,CACN;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;AAQO,MAAM,oBAAgD,CAAC,EAAE,gBAAgB;AAC9E,QAAM,SAASK,MAAAA,YAAY,CAAC;;AAAM,mBAAE,QAAQ,aAAV,mBAAoB;AAAA,GAAM;AAC5D,QAAM,QAAQC,QAAAA,QAAQ,MAAMC,gBAAAA,oBAAoB,MAAM,GAAG,CAAC,MAAM,CAAC;AACjE,MAAI,CAAC,MAAO,QAAO;AACnB,SAAOL,2BAAAA,IAAC,gBAAA,EAAe,OAAc,UAAA,CAAsB;AAC7D;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type GithubWakeEvent } from "@athenaintel/agent-runtime";
|
|
2
|
+
import { type ComponentPropsWithoutRef, type FC } from "react";
|
|
3
|
+
export interface WakeMarkerCardProps extends Omit<ComponentPropsWithoutRef<"div">, "children" | "role"> {
|
|
4
|
+
event: GithubWakeEvent;
|
|
5
|
+
}
|
|
6
|
+
/** The "Woke: review comment on #36337" row; pure presenter. */
|
|
7
|
+
export declare const WakeMarkerCard: FC<WakeMarkerCardProps>;
|
|
8
|
+
/**
|
|
9
|
+
* {@link WakeMarkerCard} bound to the assistant-ui message in scope. Selects
|
|
10
|
+
* the message's `metadata.custom` (a stable store reference) and derives the
|
|
11
|
+
* envelope from it: the reader allocates a fresh object per call, so selecting
|
|
12
|
+
* its result directly would re-render on every store update.
|
|
13
|
+
*/
|
|
14
|
+
export declare const WakeMarkerMessage: FC<{
|
|
15
|
+
className?: string;
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useAuiState } from "@assistant-ui/react";
|
|
3
|
+
import "../../packages/agent-runtime/src/generated/runconfig-contract.js";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
import "@assistant-ui/tap";
|
|
6
|
+
import "statewire";
|
|
7
|
+
import "../../packages/agent-runtime/src/statewire-suspended.js";
|
|
8
|
+
import "../../packages/agent-runtime/src/conversation-list.js";
|
|
9
|
+
import "@tanstack/react-query";
|
|
10
|
+
import "../../packages/agent-runtime/src/statewire-state.js";
|
|
11
|
+
import "../../packages/agent-runtime/src/messages.js";
|
|
12
|
+
import "@assistant-ui/store";
|
|
13
|
+
import "../../packages/agent-runtime/src/quota-safe-local-storage-session.js";
|
|
14
|
+
import "../../packages/agent-runtime/src/statewire-attach-observer.js";
|
|
15
|
+
import "../../packages/agent-runtime/src/thread-status.js";
|
|
16
|
+
import "@assistant-ui/react-statewire";
|
|
17
|
+
import { githubWakeReference, githubWakeEventLabel, readGithubWakeEvent } from "../../packages/agent-runtime/src/github-wake-event.js";
|
|
18
|
+
import "@assistant-ui/core";
|
|
19
|
+
import "../../packages/agent-runtime/src/thread-handoff.js";
|
|
20
|
+
import { GitPullRequestIcon } from "lucide-react";
|
|
21
|
+
import { cn } from "cnfast";
|
|
22
|
+
const WakeMarkerCard = ({ event, className, ...rest }) => {
|
|
23
|
+
const target = event.number !== null ? `#${event.number}` : event.repo;
|
|
24
|
+
const reference = githubWakeReference(event);
|
|
25
|
+
return /* @__PURE__ */ jsxs(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
...rest,
|
|
29
|
+
role: "status",
|
|
30
|
+
"data-runtime-message-kind": "wake",
|
|
31
|
+
"data-testid": "wake-marker",
|
|
32
|
+
className: cn(
|
|
33
|
+
"my-2 flex w-full items-start gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-muted-foreground text-sm",
|
|
34
|
+
className
|
|
35
|
+
),
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ jsx(GitPullRequestIcon, { className: "mt-0.5 size-4 shrink-0", "aria-hidden": "true" }),
|
|
38
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5 break-words [overflow-wrap:anywhere]", children: [
|
|
39
|
+
/* @__PURE__ */ jsxs("span", { className: "font-medium", children: [
|
|
40
|
+
"Woke: ",
|
|
41
|
+
githubWakeEventLabel(event),
|
|
42
|
+
" on",
|
|
43
|
+
" ",
|
|
44
|
+
event.url ? /* @__PURE__ */ jsx(
|
|
45
|
+
"a",
|
|
46
|
+
{
|
|
47
|
+
href: event.url,
|
|
48
|
+
target: "_blank",
|
|
49
|
+
rel: "noopener noreferrer",
|
|
50
|
+
title: event.title ?? reference,
|
|
51
|
+
className: "underline-offset-2 hover:underline",
|
|
52
|
+
children: target
|
|
53
|
+
}
|
|
54
|
+
) : /* @__PURE__ */ jsx("span", { title: event.title ?? reference, children: target })
|
|
55
|
+
] }),
|
|
56
|
+
event.sender || event.title ? /* @__PURE__ */ jsxs("span", { className: "text-xs opacity-90", children: [
|
|
57
|
+
event.sender ? `by ${event.sender}` : null,
|
|
58
|
+
event.sender && event.title ? " · " : null,
|
|
59
|
+
event.title
|
|
60
|
+
] }) : null,
|
|
61
|
+
event.bodyExcerpt ? /* @__PURE__ */ jsxs("span", { className: "truncate text-xs italic opacity-90", title: event.bodyExcerpt, children: [
|
|
62
|
+
"“",
|
|
63
|
+
event.bodyExcerpt,
|
|
64
|
+
"”"
|
|
65
|
+
] }) : null
|
|
66
|
+
] })
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
const WakeMarkerMessage = ({ className }) => {
|
|
72
|
+
const custom = useAuiState((s) => {
|
|
73
|
+
var _a;
|
|
74
|
+
return (_a = s.message.metadata) == null ? void 0 : _a.custom;
|
|
75
|
+
});
|
|
76
|
+
const event = useMemo(() => readGithubWakeEvent(custom), [custom]);
|
|
77
|
+
if (!event) return null;
|
|
78
|
+
return /* @__PURE__ */ jsx(WakeMarkerCard, { event, className });
|
|
79
|
+
};
|
|
80
|
+
export {
|
|
81
|
+
WakeMarkerCard,
|
|
82
|
+
WakeMarkerMessage
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=wake-marker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wake-marker.js","sources":["../../../src/chat-ui/messages/wake-marker.tsx"],"sourcesContent":["/**\n * The runtime marker for a wake turn: a GitHub webhook woke the session and\n * injected a user message (see `@athenaintel/agent-runtime`'s\n * `github-wake-event.ts`). It renders in the same visual language as the\n * runtime-ending card (`RuntimeMessageCard`) — a compact status row, not a\n * user bubble quoting the whole wake text.\n */\nimport { useAuiState } from \"@assistant-ui/react\";\nimport {\n type GithubWakeEvent,\n githubWakeEventLabel,\n githubWakeReference,\n readGithubWakeEvent,\n} from \"@athenaintel/agent-runtime\";\nimport { GitPullRequestIcon } from \"lucide-react\";\nimport { type ComponentPropsWithoutRef, type FC, useMemo } from \"react\";\nimport { cn } from \"../../lib/utils\";\n\nexport interface WakeMarkerCardProps\n extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\" | \"role\"> {\n event: GithubWakeEvent;\n}\n\n/** The \"Woke: review comment on #36337\" row; pure presenter. */\nexport const WakeMarkerCard: FC<WakeMarkerCardProps> = ({ event, className, ...rest }) => {\n const target = event.number !== null ? `#${event.number}` : event.repo;\n const reference = githubWakeReference(event);\n return (\n <div\n {...rest}\n role=\"status\"\n data-runtime-message-kind=\"wake\"\n data-testid=\"wake-marker\"\n className={cn(\n \"my-2 flex w-full items-start gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-muted-foreground text-sm\",\n className,\n )}\n >\n <GitPullRequestIcon className=\"mt-0.5 size-4 shrink-0\" aria-hidden=\"true\" />\n <div className=\"flex min-w-0 flex-1 flex-col gap-0.5 break-words [overflow-wrap:anywhere]\">\n <span className=\"font-medium\">\n Woke: {githubWakeEventLabel(event)} on{\" \"}\n {event.url ? (\n <a\n href={event.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n title={event.title ?? reference}\n className=\"underline-offset-2 hover:underline\"\n >\n {target}\n </a>\n ) : (\n <span title={event.title ?? reference}>{target}</span>\n )}\n </span>\n {event.sender || event.title ? (\n <span className=\"text-xs opacity-90\">\n {event.sender ? `by ${event.sender}` : null}\n {event.sender && event.title ? \" · \" : null}\n {event.title}\n </span>\n ) : null}\n {event.bodyExcerpt ? (\n <span className=\"truncate text-xs italic opacity-90\" title={event.bodyExcerpt}>\n “{event.bodyExcerpt}”\n </span>\n ) : null}\n </div>\n </div>\n );\n};\n\n/**\n * {@link WakeMarkerCard} bound to the assistant-ui message in scope. Selects\n * the message's `metadata.custom` (a stable store reference) and derives the\n * envelope from it: the reader allocates a fresh object per call, so selecting\n * its result directly would re-render on every store update.\n */\nexport const WakeMarkerMessage: FC<{ className?: string }> = ({ className }) => {\n const custom = useAuiState((s) => s.message.metadata?.custom);\n const event = useMemo(() => readGithubWakeEvent(custom), [custom]);\n if (!event) return null;\n return <WakeMarkerCard event={event} className={className} />;\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBO,MAAM,iBAA0C,CAAC,EAAE,OAAO,WAAW,GAAG,WAAW;AACxF,QAAM,SAAS,MAAM,WAAW,OAAO,IAAI,MAAM,MAAM,KAAK,MAAM;AAClE,QAAM,YAAY,oBAAoB,KAAK;AAC3C,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,MAAK;AAAA,MACL,6BAA0B;AAAA,MAC1B,eAAY;AAAA,MACZ,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MAAA;AAAA,MAGF,UAAA;AAAA,QAAA,oBAAC,oBAAA,EAAmB,WAAU,0BAAyB,eAAY,QAAO;AAAA,QAC1E,qBAAC,OAAA,EAAI,WAAU,6EACb,UAAA;AAAA,UAAA,qBAAC,QAAA,EAAK,WAAU,eAAc,UAAA;AAAA,YAAA;AAAA,YACrB,qBAAqB,KAAK;AAAA,YAAE;AAAA,YAAI;AAAA,YACtC,MAAM,MACL;A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/;
|
|
6
|
+
const DEFINITION_START = /^ {0,3}\[[^\]]+\]:\s*(\S.*)?$/;
|
|
7
|
+
const DESTINATION_WITH_TITLE = /^\s*\S+\s+(?:"[^"]*"|'[^']*'|\([^)]*\))\s*$/;
|
|
8
|
+
const TITLE_LINE = /^\s+(?:"[^"]*"|'[^']*'|\([^)]*\))\s*$/;
|
|
9
|
+
const DEFINITION = /^ {0,3}\[[^\]]+\]:[ \t]*\n?[ \t]*(<[^<>\n]*>|[^\s<][^\s]*)(?:[ \t]*\n?[ \t]*("[^"\n]*"|'[^'\n]*'|\([^()\n]*\)))?[ \t]*$/;
|
|
10
|
+
const LIST_MARKER = /^ {0,3}(?:([-*+])|\d{1,9}[.)])(?:\s|$)/;
|
|
11
|
+
function firstLine(text) {
|
|
12
|
+
const end = text.indexOf("\n");
|
|
13
|
+
return end === -1 ? text : text.slice(0, end);
|
|
14
|
+
}
|
|
15
|
+
function quoteDepth(line) {
|
|
16
|
+
var _a;
|
|
17
|
+
const markers = ((_a = LEADING_QUOTES.exec(line)) == null ? void 0 : _a[0]) ?? "";
|
|
18
|
+
let depth = 0;
|
|
19
|
+
for (const character of markers) if (character === ">") depth += 1;
|
|
20
|
+
return depth;
|
|
21
|
+
}
|
|
22
|
+
function balancedParentheses(destination) {
|
|
23
|
+
if (destination.startsWith("<")) return true;
|
|
24
|
+
let open = 0;
|
|
25
|
+
for (const character of destination) {
|
|
26
|
+
if (character === "(") open += 1;
|
|
27
|
+
else if (character === ")") {
|
|
28
|
+
open -= 1;
|
|
29
|
+
if (open < 0) return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return open === 0;
|
|
33
|
+
}
|
|
34
|
+
function isReferenceDefinition(lines) {
|
|
35
|
+
const match = DEFINITION.exec(lines.join("\n"));
|
|
36
|
+
return match !== null && balancedParentheses(match[1]);
|
|
37
|
+
}
|
|
38
|
+
function continuesPrevious(previous, next) {
|
|
39
|
+
if (/^\s/.test(next)) return true;
|
|
40
|
+
const before = LIST_MARKER.exec(firstLine(previous));
|
|
41
|
+
const after = LIST_MARKER.exec(firstLine(next));
|
|
42
|
+
return before !== null && after !== null && before[1] !== void 0 === (after[1] !== void 0);
|
|
43
|
+
}
|
|
44
|
+
function mergeContinuations(blocks) {
|
|
45
|
+
const merged = [];
|
|
46
|
+
for (const block of blocks) {
|
|
47
|
+
const previous = merged[merged.length - 1];
|
|
48
|
+
if (previous && previous.openFence === null && continuesPrevious(previous.text, block.text)) {
|
|
49
|
+
merged[merged.length - 1] = {
|
|
50
|
+
text: `${previous.text}
|
|
51
|
+
|
|
52
|
+
${block.text}`,
|
|
53
|
+
openFence: block.openFence
|
|
54
|
+
};
|
|
55
|
+
} else {
|
|
56
|
+
merged.push(block);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return merged;
|
|
60
|
+
}
|
|
61
|
+
function splitChatBlocks(markdown, { streaming = false } = {}) {
|
|
62
|
+
const blocks = [];
|
|
63
|
+
const definitions = [];
|
|
64
|
+
let current = [];
|
|
65
|
+
let fence = null;
|
|
66
|
+
let pending = [];
|
|
67
|
+
let continuation = null;
|
|
68
|
+
const closeBlock = () => {
|
|
69
|
+
while (current.length > 0 && current[current.length - 1].trim() === "") {
|
|
70
|
+
current.pop();
|
|
71
|
+
}
|
|
72
|
+
if (current.length > 0) blocks.push({ text: current.join("\n"), openFence: null });
|
|
73
|
+
current = [];
|
|
74
|
+
};
|
|
75
|
+
const settleDefinitions = () => {
|
|
76
|
+
if (pending.length > 0) {
|
|
77
|
+
if (isReferenceDefinition(pending)) definitions.push(...pending);
|
|
78
|
+
else current.push(...pending);
|
|
79
|
+
}
|
|
80
|
+
pending = [];
|
|
81
|
+
continuation = null;
|
|
82
|
+
};
|
|
83
|
+
const openFence = (opening, line) => {
|
|
84
|
+
settleDefinitions();
|
|
85
|
+
if (opening[1].length === 0) closeBlock();
|
|
86
|
+
const state = {
|
|
87
|
+
marker: opening[2],
|
|
88
|
+
language: opening[3].trim().split(/\s+/)[0] ?? "",
|
|
89
|
+
depth: quoteDepth(opening[1]),
|
|
90
|
+
start: current.length
|
|
91
|
+
};
|
|
92
|
+
current.push(line);
|
|
93
|
+
return state;
|
|
94
|
+
};
|
|
95
|
+
const asOpening = (line) => {
|
|
96
|
+
const opening = FENCE_LINE.exec(line);
|
|
97
|
+
if (!opening) return null;
|
|
98
|
+
return opening[2][0] === "`" && opening[3].includes("`") ? null : opening;
|
|
99
|
+
};
|
|
100
|
+
for (const line of markdown.split("\n")) {
|
|
101
|
+
if (fence) {
|
|
102
|
+
const depth = quoteDepth(line);
|
|
103
|
+
if (depth >= fence.depth) {
|
|
104
|
+
current.push(line);
|
|
105
|
+
const closing = FENCE_LINE.exec(line);
|
|
106
|
+
if (closing && quoteDepth(closing[1]) === fence.depth && closing[2][0] === fence.marker[0] && closing[2].length >= fence.marker.length && closing[3].trim() === "") {
|
|
107
|
+
fence = null;
|
|
108
|
+
}
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
fence = null;
|
|
112
|
+
}
|
|
113
|
+
const opening = asOpening(line);
|
|
114
|
+
if (opening) {
|
|
115
|
+
fence = openFence(opening, line);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (line.trim() === "") {
|
|
119
|
+
settleDefinitions();
|
|
120
|
+
closeBlock();
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (continuation !== null && /^\s/.test(line)) {
|
|
124
|
+
if (continuation === "destination") {
|
|
125
|
+
pending.push(line);
|
|
126
|
+
continuation = DESTINATION_WITH_TITLE.test(line) ? null : "title";
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (TITLE_LINE.test(line)) {
|
|
130
|
+
pending.push(line);
|
|
131
|
+
continuation = null;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
continuation = null;
|
|
136
|
+
if (current.length === 0) {
|
|
137
|
+
if (pending.length > 0 && !isReferenceDefinition(pending)) {
|
|
138
|
+
settleDefinitions();
|
|
139
|
+
} else {
|
|
140
|
+
const definition = DEFINITION_START.exec(line);
|
|
141
|
+
if (definition) {
|
|
142
|
+
if (pending.length > 0) {
|
|
143
|
+
definitions.push(...pending);
|
|
144
|
+
pending = [];
|
|
145
|
+
}
|
|
146
|
+
pending.push(line);
|
|
147
|
+
const rest = definition[1];
|
|
148
|
+
continuation = rest === void 0 ? "destination" : DESTINATION_WITH_TITLE.test(rest) ? null : "title";
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
settleDefinitions();
|
|
154
|
+
current.push(line);
|
|
155
|
+
}
|
|
156
|
+
if (fence) {
|
|
157
|
+
const lead = current.slice(0, fence.start);
|
|
158
|
+
const quoted = fence.depth > 0;
|
|
159
|
+
const code = current.slice(fence.start + 1).map((codeLine) => quoted ? codeLine.replace(BLOCKQUOTE_PREFIX, "") : codeLine);
|
|
160
|
+
blocks.push({
|
|
161
|
+
text: [...lead, ...current.slice(fence.start)].join("\n"),
|
|
162
|
+
openFence: { language: fence.language, code: code.join("\n") }
|
|
163
|
+
});
|
|
164
|
+
} else {
|
|
165
|
+
if (pending.length > 0 && streaming) {
|
|
166
|
+
current.push(...pending);
|
|
167
|
+
pending = [];
|
|
168
|
+
} else {
|
|
169
|
+
settleDefinitions();
|
|
170
|
+
}
|
|
171
|
+
closeBlock();
|
|
172
|
+
}
|
|
173
|
+
return { blocks: mergeContinuations(blocks), definitions: definitions.join("\n") };
|
|
174
|
+
}
|
|
175
|
+
exports.isReferenceDefinition = isReferenceDefinition;
|
|
176
|
+
exports.splitChatBlocks = splitChatBlocks;
|
|
177
|
+
//# sourceMappingURL=chat-blocks.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-blocks.cjs","sources":["../../../src/chat-ui/rich-text/chat-blocks.ts"],"sourcesContent":["/**\n * The top-level blocks of a streamed markdown message, so a message body can\n * parse each block once and re-parse only the one still being written.\n *\n * Streaming appends: every block before the last is settled the moment the\n * blank line after it arrives, and only the trailing block changes with the\n * next token. A body that re-parses the whole message per token does work\n * quadratic in the answer's length and re-renders every finished paragraph,\n * list and table each time; split into blocks, a finished block's text never\n * changes again, so its parse and its DOM are kept as they are.\n *\n * The split follows CommonMark's block boundaries as far as a linear scan\n * can: a blank line ends a block, except inside a fenced code block (whose\n * blank lines are content). A fence may sit inside a blockquote; it closes at\n * a fence line in the same quote depth with a matching marker, or implicitly\n * when a line leaves the quote — a fence at the margin after that opens a new\n * one, as CommonMark reads it. A fence that has not closed marks the trailing\n * block as open code, which the body draws as plain `<pre>` until the closing\n * fence lands. Constructs that legitimately span blank lines are stitched\n * back together: a block that starts indented continues the block before it\n * (a list item's second paragraph, a nested list, indented code), and a list\n * that follows a list of the same kind is one loose list. Link reference\n * definitions (`[1]: https://…`, with a destination or title on a following\n * indented line) are collected apart and handed to every block's parse, since\n * a `[label][1]` in one block may resolve to a definition written after it —\n * only runs that are definitions by CommonMark's shape (a destination without\n * spaces or in `<…>`, an optional quoted or parenthesized title, nothing\n * after) are lifted; a definition-shaped line the parser would show as text\n * stays text. A definition run still being streamed at the very end of the\n * text stays the trailing block (rendering nothing) until it settles, so the\n * settled blocks are not re-parsed on every token of its URL. Pure string\n * work, linear in the text.\n */\n\nexport interface OpenFence {\n /** The fence's info string up to its first space (the language), possibly empty. */\n language: string;\n /** The code written so far, without the fence line (and without the quote markers of a fence inside a blockquote). */\n code: string;\n}\n\nexport interface ChatBlock {\n /** The block's markdown, blank lines around it removed. */\n text: string;\n /** Set on the trailing block while its fenced code has not closed. */\n openFence: OpenFence | null;\n}\n\nexport interface ChatBlocks {\n blocks: ChatBlock[];\n /** Settled link reference definitions, one per line, to append to every block's parse. */\n definitions: string;\n}\n\nexport interface SplitChatBlocksOptions {\n /** The text is still streaming: a definition run at its very end is not settled yet. */\n streaming?: boolean;\n}\n\n/** A fence line: blockquote markers and indent, three or more backticks or tildes, the info string. */\nconst FENCE_LINE = /^((?:\\s*>)*\\s*)(`{3,}|~{3,})(.*)$/;\n/** Leading blockquote markers (`> `, `>>`), stripped from the code of a fence inside a quote. */\nconst BLOCKQUOTE_PREFIX = /^(?:\\s*>\\s?)+/;\n/** The blockquote markers a line opens with. */\nconst LEADING_QUOTES = /^(?:\\s*>)*/;\n/** `[label]:` at the start of a block; the destination follows on this line or, indented, on the next. */\nconst DEFINITION_START = /^ {0,3}\\[[^\\]]+\\]:\\s*(\\S.*)?$/;\n/** A definition's destination (and optional title) already carrying a title. */\nconst DESTINATION_WITH_TITLE = /^\\s*\\S+\\s+(?:\"[^\"]*\"|'[^']*'|\\([^)]*\\))\\s*$/;\n/** A definition title alone on an indented line. */\nconst TITLE_LINE = /^\\s+(?:\"[^\"]*\"|'[^']*'|\\([^)]*\\))\\s*$/;\n/**\n * A whole link reference definition as CommonMark shapes it: the label, a\n * destination in `<…>` or without whitespace, an optional title, nothing else.\n * Anything looser (`[x]:` with no destination, `[1]: two words`) is text.\n */\nconst DEFINITION =\n /^ {0,3}\\[[^\\]]+\\]:[ \\t]*\\n?[ \\t]*(<[^<>\\n]*>|[^\\s<][^\\s]*)(?:[ \\t]*\\n?[ \\t]*(\"[^\"\\n]*\"|'[^'\\n]*'|\\([^()\\n]*\\)))?[ \\t]*$/;\n/** A bullet (`-`, `*`, `+`) or ordered (`1.`, `1)`) list marker starting a line. */\nconst LIST_MARKER = /^ {0,3}(?:([-*+])|\\d{1,9}[.)])(?:\\s|$)/;\n\ninterface FenceState {\n marker: string;\n language: string;\n /** How many blockquote markers the fence line opened with (0 at the margin). */\n depth: number;\n /** Index of the fence line within the current block's lines. */\n start: number;\n}\n\n/** What the definition being read could still take from the next indented line. */\ntype DefinitionContinuation = \"destination\" | \"title\" | null;\n\nfunction firstLine(text: string): string {\n const end = text.indexOf(\"\\n\");\n return end === -1 ? text : text.slice(0, end);\n}\n\nfunction quoteDepth(line: string): number {\n const markers = LEADING_QUOTES.exec(line)?.[0] ?? \"\";\n let depth = 0;\n for (const character of markers) if (character === \">\") depth += 1;\n return depth;\n}\n\n/** A bare destination's parentheses must balance (`[1]: /a(b` is text). */\nfunction balancedParentheses(destination: string): boolean {\n if (destination.startsWith(\"<\")) return true;\n let open = 0;\n for (const character of destination) {\n if (character === \"(\") open += 1;\n else if (character === \")\") {\n open -= 1;\n if (open < 0) return false;\n }\n }\n return open === 0;\n}\n\n/** Whether a run of lines is a link reference definition the parser would swallow. */\nexport function isReferenceDefinition(lines: readonly string[]): boolean {\n const match = DEFINITION.exec(lines.join(\"\\n\"));\n return match !== null && balancedParentheses(match[1]!);\n}\n\n/** Whether `next` continues `previous`: an indented continuation, or another list of the same kind. */\nfunction continuesPrevious(previous: string, next: string): boolean {\n if (/^\\s/.test(next)) return true;\n const before = LIST_MARKER.exec(firstLine(previous));\n const after = LIST_MARKER.exec(firstLine(next));\n return (\n before !== null &&\n after !== null &&\n (before[1] !== undefined) === (after[1] !== undefined)\n );\n}\n\nfunction mergeContinuations(blocks: readonly ChatBlock[]): ChatBlock[] {\n const merged: ChatBlock[] = [];\n for (const block of blocks) {\n const previous = merged[merged.length - 1];\n if (\n previous &&\n previous.openFence === null &&\n continuesPrevious(previous.text, block.text)\n ) {\n merged[merged.length - 1] = {\n text: `${previous.text}\\n\\n${block.text}`,\n openFence: block.openFence,\n };\n } else {\n merged.push(block);\n }\n }\n return merged;\n}\n\n/** Split a message's markdown into its top-level blocks. */\nexport function splitChatBlocks(\n markdown: string,\n { streaming = false }: SplitChatBlocksOptions = {},\n): ChatBlocks {\n const blocks: ChatBlock[] = [];\n const definitions: string[] = [];\n let current: string[] = [];\n let fence: FenceState | null = null;\n /** The one definition being read (its label line plus any indented continuation); settled by the next label, blank line, fence or block. */\n let pending: string[] = [];\n let continuation: DefinitionContinuation = null;\n\n const closeBlock = (): void => {\n while (current.length > 0 && current[current.length - 1]!.trim() === \"\") {\n current.pop();\n }\n if (current.length > 0) blocks.push({ text: current.join(\"\\n\"), openFence: null });\n current = [];\n };\n /**\n * The pending run is a definition (lifted) or it is text (the start of the\n * block being read — `current` is empty whenever a run is pending).\n */\n const settleDefinitions = (): void => {\n if (pending.length > 0) {\n if (isReferenceDefinition(pending)) definitions.push(...pending);\n else current.push(...pending);\n }\n pending = [];\n continuation = null;\n };\n /** Start a fence at `line`; the caller assigns the state (an assignment inside a closure is invisible to narrowing). */\n const openFence = (opening: RegExpExecArray, line: string): FenceState => {\n settleDefinitions();\n // A fence at the margin interrupts a paragraph: it is its own block. An\n // indented or quoted fence belongs to the list item or quote around it.\n if (opening[1]!.length === 0) closeBlock();\n const state: FenceState = {\n marker: opening[2]!,\n language: opening[3]!.trim().split(/\\s+/)[0] ?? \"\",\n depth: quoteDepth(opening[1]!),\n start: current.length,\n };\n current.push(line);\n return state;\n };\n /** A fence line may open a fence: a backtick fence's info string cannot contain a backtick (that is inline code). */\n const asOpening = (line: string): RegExpExecArray | null => {\n const opening = FENCE_LINE.exec(line);\n if (!opening) return null;\n return opening[2]![0] === \"`\" && opening[3]!.includes(\"`\") ? null : opening;\n };\n\n for (const line of markdown.split(\"\\n\")) {\n if (fence) {\n const depth = quoteDepth(line);\n if (depth >= fence.depth) {\n current.push(line);\n const closing = FENCE_LINE.exec(line);\n if (\n closing &&\n quoteDepth(closing[1]!) === fence.depth &&\n closing[2]![0] === fence.marker[0] &&\n closing[2]!.length >= fence.marker.length &&\n closing[3]!.trim() === \"\"\n ) {\n fence = null;\n }\n continue;\n }\n // The line left the fence's blockquote, which ends the quote and the\n // fence with it; the line itself is read like any other.\n fence = null;\n }\n const opening = asOpening(line);\n if (opening) {\n fence = openFence(opening, line);\n continue;\n }\n if (line.trim() === \"\") {\n settleDefinitions();\n closeBlock();\n continue;\n }\n if (continuation !== null && /^\\s/.test(line)) {\n if (continuation === \"destination\") {\n pending.push(line);\n continuation = DESTINATION_WITH_TITLE.test(line) ? null : \"title\";\n continue;\n }\n if (TITLE_LINE.test(line)) {\n pending.push(line);\n continuation = null;\n continue;\n }\n }\n continuation = null;\n if (current.length === 0) {\n if (pending.length > 0 && !isReferenceDefinition(pending)) {\n // The run so far is not a definition: it is the paragraph this line continues.\n settleDefinitions();\n } else {\n const definition = DEFINITION_START.exec(line);\n if (definition) {\n // A new label ends the definition before it, which is complete and valid here.\n if (pending.length > 0) {\n definitions.push(...pending);\n pending = [];\n }\n pending.push(line);\n const rest = definition[1];\n continuation =\n rest === undefined\n ? \"destination\"\n : DESTINATION_WITH_TITLE.test(rest)\n ? null\n : \"title\";\n continue;\n }\n }\n }\n settleDefinitions();\n current.push(line);\n }\n\n if (fence) {\n const lead = current.slice(0, fence.start);\n const quoted = fence.depth > 0;\n const code = current\n .slice(fence.start + 1)\n .map((codeLine) => (quoted ? codeLine.replace(BLOCKQUOTE_PREFIX, \"\") : codeLine));\n blocks.push({\n text: [...lead, ...current.slice(fence.start)].join(\"\\n\"),\n openFence: { language: fence.language, code: code.join(\"\\n\") },\n });\n } else {\n // A definition run that ends still-streaming text is not settled: it stays\n // the trailing block (a valid one parses to nothing visible) so the blocks\n // before it keep their parse while its URL streams. Settled text lifts it.\n if (pending.length > 0 && streaming) {\n current.push(...pending);\n pending = [];\n } else {\n settleDefinitions();\n }\n closeBlock();\n }\n\n return { blocks: mergeContinuations(blocks), definitions: definitions.join(\"\\n\") };\n}\n"],"names":[],"mappings":";;AA4DA,MAAM,aAAa;AAEnB,MAAM,oBAAoB;AAE1B,MAAM,iBAAiB;AAEvB,MAAM,mBAAmB;AAEzB,MAAM,yBAAyB;AAE/B,MAAM,aAAa;AAMnB,MAAM,aACJ;AAEF,MAAM,cAAc;AAcpB,SAAS,UAAU,MAAsB;AACvC,QAAM,MAAM,KAAK,QAAQ,IAAI;AAC7B,SAAO,QAAQ,KAAK,OAAO,KAAK,MAAM,GAAG,GAAG;AAC9C;AAEA,SAAS,WAAW,MAAsB;;AACxC,QAAM,YAAU,oBAAe,KAAK,IAAI,MAAxB,mBAA4B,OAAM;AAClD,MAAI,QAAQ;AACZ,aAAW,aAAa,QAAS,KAAI,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