@athenaintel/react 0.41.2 → 0.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -9
- package/dist/agent-runtime/src/asset-attachment.d.ts +98 -0
- package/dist/agent-runtime/src/athena-asset-drag.d.ts +32 -0
- package/dist/agent-runtime/src/auth-denial.d.ts +29 -0
- package/dist/agent-runtime/src/chat-outbox-attachments.cjs +41 -0
- package/dist/agent-runtime/src/chat-outbox-attachments.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-attachments.d.ts +38 -0
- package/dist/agent-runtime/src/chat-outbox-attachments.js +41 -0
- package/dist/agent-runtime/src/chat-outbox-attachments.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-signals.cjs +63 -0
- package/dist/agent-runtime/src/chat-outbox-signals.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-signals.d.ts +12 -0
- package/dist/agent-runtime/src/chat-outbox-signals.js +63 -0
- package/dist/agent-runtime/src/chat-outbox-signals.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-store.cjs +509 -0
- package/dist/agent-runtime/src/chat-outbox-store.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-store.d.ts +203 -0
- package/dist/agent-runtime/src/chat-outbox-store.js +509 -0
- package/dist/agent-runtime/src/chat-outbox-store.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-thread.cjs +136 -0
- package/dist/agent-runtime/src/chat-outbox-thread.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox-thread.d.ts +118 -0
- package/dist/agent-runtime/src/chat-outbox-thread.js +136 -0
- package/dist/agent-runtime/src/chat-outbox-thread.js.map +1 -0
- package/dist/agent-runtime/src/chat-outbox.cjs +696 -0
- package/dist/agent-runtime/src/chat-outbox.cjs.map +1 -0
- package/dist/agent-runtime/src/chat-outbox.d.ts +285 -0
- package/dist/agent-runtime/src/chat-outbox.js +696 -0
- package/dist/agent-runtime/src/chat-outbox.js.map +1 -0
- package/dist/agent-runtime/src/chat-socket-reachability.d.ts +45 -0
- package/dist/agent-runtime/src/client-tool-bridge.d.ts +152 -0
- package/dist/agent-runtime/src/client-tools.d.ts +133 -0
- package/dist/agent-runtime/src/composer-markdown.cjs +10 -0
- package/dist/agent-runtime/src/composer-markdown.cjs.map +1 -1
- package/dist/agent-runtime/src/composer-markdown.d.ts +108 -0
- package/dist/agent-runtime/src/composer-markdown.js +10 -0
- package/dist/agent-runtime/src/composer-markdown.js.map +1 -1
- package/dist/agent-runtime/src/config-mutations.d.ts +51 -0
- package/dist/agent-runtime/src/conversation-index.d.ts +110 -0
- package/dist/agent-runtime/src/conversation-list.d.ts +343 -0
- package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs +3 -2
- package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.d.ts +166 -0
- package/dist/agent-runtime/src/deep-agent-transport-recipe.js +3 -2
- package/dist/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -1
- package/dist/agent-runtime/src/desktop-handoff.d.ts +139 -0
- package/dist/agent-runtime/src/durable-thread-snapshot-cache.cjs +158 -0
- package/dist/agent-runtime/src/durable-thread-snapshot-cache.cjs.map +1 -0
- package/dist/agent-runtime/src/durable-thread-snapshot-cache.d.ts +60 -0
- package/dist/agent-runtime/src/durable-thread-snapshot-cache.js +158 -0
- package/dist/agent-runtime/src/durable-thread-snapshot-cache.js.map +1 -0
- package/dist/agent-runtime/src/edit-command.d.ts +156 -0
- package/dist/agent-runtime/src/errors.d.ts +174 -0
- package/dist/agent-runtime/src/execute-output.d.ts +31 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs +16 -2
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +202 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.js +16 -2
- package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
- package/dist/agent-runtime/src/github-wake-event.d.ts +77 -0
- package/dist/agent-runtime/src/index.d.ts +74 -0
- package/dist/agent-runtime/src/interrupts.cjs +17 -0
- package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
- package/dist/agent-runtime/src/interrupts.d.ts +348 -0
- package/dist/agent-runtime/src/interrupts.js +17 -0
- package/dist/agent-runtime/src/interrupts.js.map +1 -1
- package/dist/agent-runtime/src/lane-follow.d.ts +121 -0
- package/dist/agent-runtime/src/lane-history.cjs +209 -0
- package/dist/agent-runtime/src/lane-history.cjs.map +1 -0
- package/dist/agent-runtime/src/lane-history.d.ts +175 -0
- package/dist/agent-runtime/src/lane-history.js +209 -0
- package/dist/agent-runtime/src/lane-history.js.map +1 -0
- package/dist/agent-runtime/src/lane-images.d.ts +184 -0
- package/dist/agent-runtime/src/message-author.d.ts +43 -0
- package/dist/agent-runtime/src/message-text.cjs +15 -0
- package/dist/agent-runtime/src/message-text.cjs.map +1 -0
- package/dist/agent-runtime/src/message-text.d.ts +47 -0
- package/dist/agent-runtime/src/message-text.js +15 -0
- package/dist/agent-runtime/src/message-text.js.map +1 -0
- package/dist/agent-runtime/src/message-window.cjs +15 -1
- package/dist/agent-runtime/src/message-window.cjs.map +1 -1
- package/dist/agent-runtime/src/message-window.d.ts +159 -0
- package/dist/agent-runtime/src/message-window.js +16 -2
- package/dist/agent-runtime/src/message-window.js.map +1 -1
- package/dist/agent-runtime/src/messages.cjs +88 -4
- package/dist/agent-runtime/src/messages.cjs.map +1 -1
- package/dist/agent-runtime/src/messages.d.ts +603 -0
- package/dist/agent-runtime/src/messages.js +88 -4
- package/dist/agent-runtime/src/messages.js.map +1 -1
- package/dist/agent-runtime/src/model-context.d.ts +22 -0
- package/dist/agent-runtime/src/offline-status.d.ts +157 -0
- package/dist/agent-runtime/src/optimistic-content.d.ts +21 -0
- package/dist/agent-runtime/src/protocol.cjs +12 -4
- package/dist/agent-runtime/src/protocol.cjs.map +1 -1
- package/dist/agent-runtime/src/protocol.d.ts +119 -0
- package/dist/agent-runtime/src/protocol.js +13 -5
- package/dist/agent-runtime/src/protocol.js.map +1 -1
- package/dist/agent-runtime/src/ptc-subcalls.d.ts +51 -0
- package/dist/agent-runtime/src/queue.d.ts +138 -0
- package/dist/agent-runtime/src/quota-safe-local-storage-session.d.ts +154 -0
- package/dist/agent-runtime/src/running-tool-placeholder.cjs +11 -0
- package/dist/agent-runtime/src/running-tool-placeholder.cjs.map +1 -0
- package/dist/agent-runtime/src/running-tool-placeholder.d.ts +25 -0
- package/dist/agent-runtime/src/running-tool-placeholder.js +11 -0
- package/dist/agent-runtime/src/running-tool-placeholder.js.map +1 -0
- package/dist/agent-runtime/src/runtime-messages.d.ts +104 -0
- package/dist/agent-runtime/src/screen-point.d.ts +151 -0
- package/dist/agent-runtime/src/sealed-idb.cjs +112 -0
- package/dist/agent-runtime/src/sealed-idb.cjs.map +1 -0
- package/dist/agent-runtime/src/sealed-idb.d.ts +106 -0
- package/dist/agent-runtime/src/sealed-idb.js +112 -0
- package/dist/agent-runtime/src/sealed-idb.js.map +1 -0
- package/dist/agent-runtime/src/send-recovery.d.ts +40 -0
- package/dist/agent-runtime/src/statewire-attach-observer.d.ts +194 -0
- package/dist/agent-runtime/src/statewire-diagnostics.d.ts +74 -0
- package/dist/agent-runtime/src/statewire-state.d.ts +29 -0
- package/dist/agent-runtime/src/statewire-suspended.cjs.map +1 -1
- package/dist/agent-runtime/src/statewire-suspended.d.ts +27 -0
- package/dist/agent-runtime/src/statewire-suspended.js.map +1 -1
- package/dist/agent-runtime/src/statewire-transport.d.ts +40 -0
- package/dist/agent-runtime/src/streaming-markdown.d.ts +46 -0
- package/dist/agent-runtime/src/subagent-transcripts.cjs +209 -0
- package/dist/agent-runtime/src/subagent-transcripts.cjs.map +1 -0
- package/dist/agent-runtime/src/subagent-transcripts.d.ts +71 -0
- package/dist/agent-runtime/src/subagent-transcripts.js +209 -0
- package/dist/agent-runtime/src/subagent-transcripts.js.map +1 -0
- package/dist/agent-runtime/src/subagents.cjs +253 -0
- package/dist/agent-runtime/src/subagents.cjs.map +1 -0
- package/dist/agent-runtime/src/subagents.d.ts +311 -0
- package/dist/agent-runtime/src/subagents.js +253 -0
- package/dist/agent-runtime/src/subagents.js.map +1 -0
- package/dist/agent-runtime/src/subscription-wake-event.d.ts +111 -0
- package/dist/agent-runtime/src/thread-extras.d.ts +43 -0
- package/dist/agent-runtime/src/thread-handoff.d.ts +364 -0
- package/dist/agent-runtime/src/thread-prewarm-controller.d.ts +76 -0
- package/dist/agent-runtime/src/thread-prewarm.d.ts +118 -0
- package/dist/agent-runtime/src/thread-snapshot-cache.d.ts +99 -0
- package/dist/agent-runtime/src/thread-snapshot-mirror.cjs +329 -0
- package/dist/agent-runtime/src/thread-snapshot-mirror.cjs.map +1 -0
- package/dist/agent-runtime/src/thread-snapshot-mirror.d.ts +101 -0
- package/dist/agent-runtime/src/thread-snapshot-mirror.js +329 -0
- package/dist/agent-runtime/src/thread-snapshot-mirror.js.map +1 -0
- package/dist/agent-runtime/src/thread-status.d.ts +53 -0
- package/dist/agent-runtime/src/tool-metadata.d.ts +146 -0
- package/dist/agent-runtime/src/tool-names.cjs +67 -0
- package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-names.d.ts +60 -0
- package/dist/agent-runtime/src/tool-names.js +68 -1
- package/dist/agent-runtime/src/tool-names.js.map +1 -1
- package/dist/agent-runtime/src/tool-outputs.d.ts +35 -0
- package/dist/agent-runtime/src/tool-result.cjs +1 -0
- package/dist/agent-runtime/src/tool-result.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-result.d.ts +126 -0
- package/dist/agent-runtime/src/tool-result.js +1 -0
- package/dist/agent-runtime/src/tool-result.js.map +1 -1
- package/dist/agent-runtime/src/types.d.ts +159 -0
- package/dist/agent-runtime/src/use-conversation-list.d.ts +76 -0
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +136 -0
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +64 -0
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +136 -0
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-config.d.ts +169 -0
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs +13 -0
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.d.ts +22 -0
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.js +13 -0
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +20 -2
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +168 -0
- package/dist/agent-runtime/src/use-deep-agent-runtime.js +20 -2
- package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs +12 -4
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.d.ts +320 -0
- package/dist/agent-runtime/src/use-deep-agent-thread.js +12 -4
- package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs +999 -0
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +409 -0
- package/dist/agent-runtime/src/use-deep-agent-voice.js +999 -0
- package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -0
- package/dist/agent-runtime/src/use-deep-agent-window-sync.d.ts +102 -0
- package/dist/agent-runtime/src/use-historical-edit-attachments.d.ts +2 -0
- package/dist/agent-runtime/src/use-thread-handoff-flow.d.ts +84 -0
- package/dist/agent-runtime/src/voice-presentation.d.ts +80 -0
- package/dist/agent-runtime/src/voice-turn-grouping.d.ts +28 -0
- package/dist/agent-runtime/src/voice-wire-types.d.ts +15 -0
- package/dist/agent-runtime/src/withdrawn-turns.d.ts +97 -0
- package/dist/chat/AthenaChat.cjs +77 -6
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.js +78 -7
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/chat/StatewireApprovalCard.d.ts +1 -1
- package/dist/chat/StatewireClientToolBridge.d.ts +1 -1
- package/dist/chat/StatewireQueuedMessages.cjs +11 -4
- package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.d.ts +1 -1
- package/dist/chat/StatewireQueuedMessages.js +11 -4
- package/dist/chat/StatewireQueuedMessages.js.map +1 -1
- package/dist/chat/chat-outbox-rows.cjs +223 -0
- package/dist/chat/chat-outbox-rows.cjs.map +1 -0
- package/dist/chat/chat-outbox-rows.d.ts +29 -0
- package/dist/chat/chat-outbox-rows.js +223 -0
- package/dist/chat/chat-outbox-rows.js.map +1 -0
- package/dist/chat/statewire-approval.d.ts +1 -1
- package/dist/chat/statewire-client-tools.d.ts +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.cjs +3 -1
- package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.d.ts +7 -1
- package/dist/chat/super-grouping/SuperGroupingCard.js +3 -1
- package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +7 -2
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.d.ts +2 -2
- package/dist/chat/super-grouping/SuperGroupingTranscript.js +7 -2
- package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.cjs +19 -11
- package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.d.ts +25 -9
- package/dist/chat/super-grouping/activity-timeline.js +19 -11
- package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
- package/dist/chat/use-statewire-approval-request.cjs +36 -0
- package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
- package/dist/chat/use-statewire-approval-request.d.ts +49 -1
- package/dist/chat/use-statewire-approval-request.js +39 -3
- package/dist/chat/use-statewire-approval-request.js.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.cjs +102 -3
- package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.d.ts +32 -1
- package/dist/chat-ui/composer/tiptap-composer.js +103 -4
- package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
- package/dist/chat-ui/header/conversation-history-panel.d.ts +1 -1
- package/dist/chat-ui/index.d.ts +1 -1
- package/dist/chat-ui/messages/message-components.cjs +15 -0
- package/dist/chat-ui/messages/message-components.cjs.map +1 -1
- package/dist/chat-ui/messages/message-components.js +15 -0
- package/dist/chat-ui/messages/message-components.js.map +1 -1
- package/dist/chat-ui/messages/runtime-message.d.ts +1 -1
- package/dist/chat-ui/messages/statewire-continue-run.d.ts +1 -1
- package/dist/chat-ui/messages/user-edit-composer.cjs +15 -2
- package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
- package/dist/chat-ui/messages/user-edit-composer.d.ts +4 -2
- package/dist/chat-ui/messages/user-edit-composer.js +15 -2
- package/dist/chat-ui/messages/user-edit-composer.js.map +1 -1
- package/dist/chat-ui/messages/wake-marker.d.ts +1 -1
- package/dist/chat-ui/rich-text/chat-text-schema.cjs +1 -0
- package/dist/chat-ui/rich-text/chat-text-schema.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-text-schema.d.ts +3 -0
- package/dist/chat-ui/rich-text/chat-text-schema.js +1 -0
- package/dist/chat-ui/rich-text/chat-text-schema.js.map +1 -1
- package/dist/chat-ui/statewire.cjs +1 -0
- package/dist/chat-ui/statewire.cjs.map +1 -1
- package/dist/chat-ui/statewire.d.ts +2 -2
- package/dist/chat-ui/statewire.js +2 -1
- package/dist/chat-ui/thread/statewire-history-edge.d.ts +1 -1
- package/dist/composer/AttachmentContext.cjs +8 -4
- package/dist/composer/AttachmentContext.cjs.map +1 -1
- package/dist/composer/AttachmentContext.d.ts +7 -0
- package/dist/composer/AttachmentContext.js +8 -4
- package/dist/composer/AttachmentContext.js.map +1 -1
- package/dist/composer/build-composed-message.cjs +34 -0
- package/dist/composer/build-composed-message.cjs.map +1 -1
- package/dist/composer/build-composed-message.d.ts +20 -0
- package/dist/composer/build-composed-message.js +35 -1
- package/dist/composer/build-composed-message.js.map +1 -1
- package/dist/composer/composer-handoff.cjs +39 -2
- package/dist/composer/composer-handoff.cjs.map +1 -1
- package/dist/composer/composer-handoff.d.ts +28 -3
- package/dist/composer/composer-handoff.js +39 -2
- package/dist/composer/composer-handoff.js.map +1 -1
- package/dist/composer/useAttachFiles.cjs +15 -2
- package/dist/composer/useAttachFiles.cjs.map +1 -1
- package/dist/composer/useAttachFiles.d.ts +11 -0
- package/dist/composer/useAttachFiles.js +15 -2
- package/dist/composer/useAttachFiles.js.map +1 -1
- package/dist/composer/useSendMessage.cjs.map +1 -1
- package/dist/composer/useSendMessage.d.ts +4 -3
- package/dist/composer/useSendMessage.js.map +1 -1
- package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
- package/dist/diagnostics/athena-diagnostics.d.ts +3 -1
- package/dist/diagnostics/athena-diagnostics.js.map +1 -1
- package/dist/index.cjs +18 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +15 -6
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/dist/offline/chat-outbox.cjs +57 -0
- package/dist/offline/chat-outbox.cjs.map +1 -0
- package/dist/offline/chat-outbox.d.ts +80 -0
- package/dist/offline/chat-outbox.js +57 -0
- package/dist/offline/chat-outbox.js.map +1 -0
- package/dist/offline/offline-history.cjs +77 -0
- package/dist/offline/offline-history.cjs.map +1 -0
- package/dist/offline/offline-history.d.ts +60 -0
- package/dist/offline/offline-history.js +77 -0
- package/dist/offline/offline-history.js.map +1 -0
- package/dist/provider/AthenaProvider.cjs +206 -9
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +22 -1
- package/dist/provider/AthenaProvider.js +207 -10
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/provider/statewire-window-context.d.ts +1 -1
- package/dist/react/package.json.cjs +1 -1
- package/dist/react/package.json.js +1 -1
- package/dist/references/src/anchors/file-line-range.d.ts +58 -0
- package/dist/references/src/anchors/format.d.ts +21 -0
- package/dist/references/src/anchors/message-anchors.d.ts +71 -0
- package/dist/references/src/anchors/parse.d.ts +8 -0
- package/dist/references/src/anchors/registry-contract.d.ts +24 -0
- package/dist/references/src/anchors/registry.d.ts +19 -0
- package/dist/references/src/anchors/schemas.d.ts +194 -0
- package/dist/references/src/anchors/serialize.d.ts +8 -0
- package/dist/references/src/anchors/time.d.ts +78 -0
- package/dist/references/src/anchors/types.d.ts +474 -0
- package/dist/references/src/asset-bounds.d.ts +27 -0
- package/dist/references/src/asset-links.d.ts +23 -0
- package/dist/references/src/asset-reference.d.ts +16 -0
- package/dist/references/src/formats/format-catalog.d.ts +79 -0
- package/dist/references/src/formats/markdown/parse-reference-markdown.d.ts +28 -0
- package/dist/references/src/formats/markdown/reference-display-name.d.ts +6 -0
- package/dist/references/src/formats/object/asset-object.d.ts +9 -0
- package/dist/references/src/formats/object/callable-object.d.ts +6 -0
- package/dist/references/src/formats/object/decode-reference-object-payload.d.ts +3 -0
- package/dist/references/src/formats/object/external-url-object.d.ts +9 -0
- package/dist/references/src/formats/object/group-object.d.ts +9 -0
- package/dist/references/src/formats/object/navigation-object.d.ts +9 -0
- package/dist/references/src/formats/object/parse-reference-object.d.ts +11 -0
- package/dist/references/src/formats/object/person-object.d.ts +9 -0
- package/dist/references/src/formats/uri/asset-mention-uri.d.ts +9 -0
- package/dist/references/src/formats/uri/asset-spaces-url.d.ts +9 -0
- package/dist/references/src/formats/uri/callable-mention-uris.d.ts +9 -0
- package/dist/references/src/formats/uri/detect-uri-wire.d.ts +9 -0
- package/dist/references/src/formats/uri/group-mention-uri.d.ts +12 -0
- package/dist/references/src/formats/uri/navigation-spaces-url.d.ts +14 -0
- package/dist/references/src/formats/uri/parse-reference-uri.d.ts +20 -0
- package/dist/references/src/formats/uri/person-mention-uri.d.ts +9 -0
- package/dist/references/src/formats/uri/template-placeholder.d.ts +12 -0
- package/dist/references/src/index.d.ts +47 -0
- package/dist/references/src/legacy/index.d.ts +14 -0
- package/dist/references/src/legacy/pre-reference-asset-url.d.ts +57 -0
- package/dist/references/src/legacy/pre-reference-citation-bridge.d.ts +22 -0
- package/dist/references/src/legacy/pre-reference-citation.d.ts +138 -0
- package/dist/references/src/legacy/pre-reference-external-url.d.ts +31 -0
- package/dist/references/src/legacy/pre-reference-format.d.ts +8 -0
- package/dist/references/src/legacy/pre-reference-mention.d.ts +27 -0
- package/dist/references/src/legacy/pre-reference-object.d.ts +8 -0
- package/dist/references/src/legacy/pre-reference-uri.d.ts +12 -0
- package/dist/references/src/legacy.d.ts +2 -0
- package/dist/references/src/mention-href-patterns.d.ts +19 -0
- package/dist/references/src/mention-node/index.d.ts +5 -0
- package/dist/references/src/mention-node/mention-node.d.ts +31 -0
- package/dist/references/src/mention-node/resolve-node-attrs.d.ts +27 -0
- package/dist/references/src/parse-reference.d.ts +23 -0
- package/dist/references/src/schemas.d.ts +463 -0
- package/dist/references/src/serialize-reference.d.ts +50 -0
- package/dist/references/src/sheet-name.d.ts +10 -0
- package/dist/references/src/tool-option-schemas.d.ts +597 -0
- package/dist/references/src/types.d.ts +125 -0
- package/dist/references/src/version-ref.d.ts +30 -0
- package/dist/runtime/statewire-lifecycle.d.ts +1 -1
- package/dist/runtime/statewire-model-lane.d.ts +1 -1
- package/dist/runtime/statewire-server-lane-context.d.ts +1 -1
- package/dist/runtime/statewire-session-key.cjs +7 -0
- package/dist/runtime/statewire-session-key.cjs.map +1 -1
- package/dist/runtime/statewire-session-key.d.ts +16 -0
- package/dist/runtime/statewire-session-key.js +8 -1
- package/dist/runtime/statewire-session-key.js.map +1 -1
- package/dist/runtime/statewire-session-lane.cjs +48 -0
- package/dist/runtime/statewire-session-lane.cjs.map +1 -0
- package/dist/runtime/statewire-session-lane.d.ts +29 -0
- package/dist/runtime/statewire-session-lane.js +48 -0
- package/dist/runtime/statewire-session-lane.js.map +1 -0
- package/dist/runtime/statewire-thread-config-lane.d.ts +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.cjs +16 -5
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +15 -1
- package/dist/runtime/useAthenaStatewireRuntime.js +17 -6
- package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/threads/api.d.ts +1 -1
- package/dist/threads/conversation-list-fetcher.d.ts +1 -1
- package/dist/threads/index-triggered-refresh.cjs +164 -0
- package/dist/threads/index-triggered-refresh.cjs.map +1 -0
- package/dist/threads/index-triggered-refresh.d.ts +70 -0
- package/dist/threads/index-triggered-refresh.js +164 -0
- package/dist/threads/index-triggered-refresh.js.map +1 -0
- package/dist/threads/offline-session-list.cjs +75 -0
- package/dist/threads/offline-session-list.cjs.map +1 -0
- package/dist/threads/offline-session-list.d.ts +27 -0
- package/dist/threads/offline-session-list.js +75 -0
- package/dist/threads/offline-session-list.js.map +1 -0
- package/dist/threads/pull-request-display.d.ts +1 -1
- package/dist/threads/session-list-model.d.ts +1 -1
- package/dist/threads/session-list-tab-share.cjs +150 -0
- package/dist/threads/session-list-tab-share.cjs.map +1 -0
- package/dist/threads/session-list-tab-share.d.ts +73 -0
- package/dist/threads/session-list-tab-share.js +150 -0
- package/dist/threads/session-list-tab-share.js.map +1 -0
- package/dist/threads/session-row-parts.d.ts +1 -1
- package/dist/threads/sessions-query.d.ts +1 -1
- package/dist/threads/statewire-thread-list.cjs +105 -20
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.d.ts +31 -3
- package/dist/threads/statewire-thread-list.js +107 -22
- package/dist/threads/statewire-thread-list.js.map +1 -1
- package/dist/threads/thread-prefetcher.d.ts +1 -1
- package/dist/threads/use-athena-session-attention.d.ts +1 -1
- package/dist/threads/use-athena-sessions.cjs +32 -22
- package/dist/threads/use-athena-sessions.cjs.map +1 -1
- package/dist/threads/use-athena-sessions.js +33 -23
- package/dist/threads/use-athena-sessions.js.map +1 -1
- package/dist/threads/use-rest-conversation-history.d.ts +1 -1
- package/dist/threads/use-statewire-conversation-history.d.ts +5 -5
- package/dist/tiptap-markdown-table/src/markdown-table-serializer.d.ts +56 -0
- package/dist/tools/NestedPtcMessages.cjs +14 -9
- package/dist/tools/NestedPtcMessages.cjs.map +1 -1
- package/dist/tools/NestedPtcMessages.d.ts +9 -0
- package/dist/tools/NestedPtcMessages.js +6 -1
- package/dist/tools/NestedPtcMessages.js.map +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/primitives.d.ts +1 -1
- package/dist/tools/subagent-task-tool-ui.cjs +494 -0
- package/dist/tools/subagent-task-tool-ui.cjs.map +1 -0
- package/dist/tools/subagent-task-tool-ui.d.ts +109 -0
- package/dist/tools/subagent-task-tool-ui.js +494 -0
- package/dist/tools/subagent-task-tool-ui.js.map +1 -0
- package/dist/tools/tool-fallback.d.ts +1 -1
- package/dist/tools/tool-icons.d.ts +1 -1
- package/dist/tools/tool-summary.d.ts +1 -1
- package/dist/tools/tool-uis.cjs +4 -0
- package/dist/tools/tool-uis.cjs.map +1 -1
- package/dist/tools/tool-uis.js +4 -0
- package/dist/tools/tool-uis.js.map +1 -1
- package/dist/voice/chat.cjs +6 -0
- package/dist/voice/chat.cjs.map +1 -0
- package/dist/voice/chat.d.ts +2 -0
- package/dist/voice/chat.js +6 -0
- package/dist/voice/chat.js.map +1 -0
- package/dist/voice/livekit-join.cjs +119 -0
- package/dist/voice/livekit-join.cjs.map +1 -0
- package/dist/voice/livekit-join.d.ts +8 -0
- package/dist/voice/livekit-join.js +119 -0
- package/dist/voice/livekit-join.js.map +1 -0
- package/dist/voice/livekit.cjs +32 -0
- package/dist/voice/livekit.cjs.map +1 -0
- package/dist/voice/livekit.d.ts +80 -0
- package/dist/voice/livekit.js +32 -0
- package/dist/voice/livekit.js.map +1 -0
- package/package.json +20 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-components.js","sources":["../../../src/chat-ui/messages/message-components.tsx"],"sourcesContent":["import {\n ActionBarPrimitive,\n AuiIf,\n BranchPickerPrimitive,\n MessagePrimitive,\n useAuiState,\n useMessagePartText,\n useSmooth,\n type ToolCallMessagePartComponent,\n} from \"@assistant-ui/react\";\nimport {\n DEEP_AGENT_COMPOSER_MARKDOWN_KEY,\n hideUnterminatedMarkdownLink,\n isGithubWakeMessage,\n isSubscriptionWakeMessage,\n isVoiceDelegationMessage,\n readDeepAgentComposerMarkdown,\n readRuntimeMessageFromSourceMessages,\n readSoleRuntimeMessageKind,\n} from \"@athenaintel/agent-runtime\";\nimport {\n ArrowUpIcon,\n CheckIcon,\n ChevronLeftIcon,\n ChevronRightIcon,\n CopyIcon,\n ListPlusIcon,\n PencilIcon,\n RefreshCwIcon,\n} from \"lucide-react\";\nimport {\n type FC,\n type ReactNode,\n useMemo,\n} from \"react\";\nimport { useAthenaRunLive } from \"../../chat/use-athena-run-live\";\nimport type { ComposerAction } from \"../composer/composer-action\";\nimport { cn } from \"../../lib/utils\";\nimport { ChatMessageBody } from \"../rich-text/chat-message-body\";\nimport { useMessageActionsReadOnly } from \"./message-actions-config\";\nimport { RuntimeMessageCard } from \"./runtime-message\";\nimport { hasVisibleContent } from \"./running-indicator\";\nimport { VoiceDelegationMessage } from \"./voice-delegation-card\";\nimport { WakeMarkerMessage } from \"./wake-marker\";\nimport { SmallIconButton } from \"./thread-chrome\";\n\nexport {\n IconButton,\n SmallIconButton,\n THREAD_HEADER_ACTIONS_CLASS,\n THREAD_HEADER_CLASS,\n THREAD_HEADER_ICON_CLASS,\n THREAD_HEADER_PILL_CLASS,\n THREAD_PANEL_CLASS,\n} from \"./thread-chrome\";\n\nexport const BranchPicker: FC = () => (\n <BranchPickerPrimitive.Root\n hideWhenSingleBranch\n className=\"inline-flex items-center gap-0.5 text-xs text-muted-foreground\"\n data-testid=\"chat-branch-picker\"\n >\n <BranchPickerPrimitive.Previous asChild>\n <SmallIconButton\n tooltip=\"Previous branch\"\n data-testid=\"chat-branch-previous\"\n >\n <ChevronLeftIcon className=\"size-3\" />\n </SmallIconButton>\n </BranchPickerPrimitive.Previous>\n <span className=\"font-medium\" data-testid=\"chat-branch-count\">\n <BranchPickerPrimitive.Number /> / <BranchPickerPrimitive.Count />\n </span>\n <BranchPickerPrimitive.Next asChild>\n <SmallIconButton tooltip=\"Next branch\" data-testid=\"chat-branch-next\">\n <ChevronRightIcon className=\"size-3\" />\n </SmallIconButton>\n </BranchPickerPrimitive.Next>\n </BranchPickerPrimitive.Root>\n);\n\nconst CopyActionButton: FC = () => (\n <ActionBarPrimitive.Copy asChild>\n <SmallIconButton tooltip=\"Copy\">\n <AuiIf condition={(state) => state.message.isCopied}>\n <CheckIcon className=\"size-3\" />\n </AuiIf>\n <AuiIf condition={(state) => !state.message.isCopied}>\n <CopyIcon className=\"size-3\" />\n </AuiIf>\n </SmallIconButton>\n </ActionBarPrimitive.Copy>\n);\n\n/**\n * The edit primitive does not check the runtime's edit capability itself —\n * clicking it on a runtime without one throws inside onPress, where no error\n * boundary can catch it — so the button must gate on the capability and, to\n * match the rewind semantics of `run/edit`, stay hidden while a run is live.\n * The read-only context covers threads the capability flags cannot: a host's\n * static `edit: true` still applies to fenced legacy conversations.\n */\nconst EditActionButton: FC = () => {\n const allowEdit = useAuiState((s) => s.thread.capabilities.edit);\n const isRunning = useAthenaRunLive();\n const readOnly = useMessageActionsReadOnly();\n if (!allowEdit || isRunning || readOnly) return null;\n return (\n <ActionBarPrimitive.Edit asChild>\n <SmallIconButton tooltip=\"Edit\" data-testid=\"chat-message-edit\">\n <PencilIcon className=\"size-3\" />\n </SmallIconButton>\n </ActionBarPrimitive.Edit>\n );\n};\n\n/** Regenerate dispatches `run/reload`, so it hides on read-only threads too. */\nconst RegenerateActionButton: FC = () => {\n const readOnly = useMessageActionsReadOnly();\n if (readOnly) return null;\n return (\n <ActionBarPrimitive.Reload asChild>\n <SmallIconButton tooltip=\"Regenerate\">\n <RefreshCwIcon className=\"size-3\" />\n </SmallIconButton>\n </ActionBarPrimitive.Reload>\n );\n};\n\n/**\n * Reveal-on-demand treatment for action bars: invisible and click-through\n * until the surrounding named group is hovered or a control inside receives\n * keyboard focus. The `focus-within` escape hatch is what keeps the hidden\n * controls reachable for keyboard users.\n */\nexport const ACTION_BAR_REVEAL_CLASS =\n \"pointer-events-none opacity-0 transition-opacity focus-within:pointer-events-auto focus-within:opacity-100\";\n\n/** Shared chat body; the reveal holds incomplete links until their URL is complete. */\nexport const MarkdownText: FC = () => {\n const revealed = useSmooth(useMessagePartText(), true);\n const isRunning = revealed.status.type === \"running\";\n const text = isRunning ? hideUnterminatedMarkdownLink(revealed.text) : revealed.text;\n return <ChatMessageBody text={text} isRunning={isRunning} />;\n};\n\n/**\n * A user message's text, shown as it was typed.\n *\n * A composer sends plain text exactly as typed, because the model reads it\n * literally, so the text alone no longer says which characters are\n * formatting: read as Markdown, `List<T>` loses `<T>`, `obj.__init__` shows a\n * bold \"init\" and `a\\\\b` one backslash. A composer send therefore carries the\n * draft it was serialized from (`metadata.composer_markdown`, only when the\n * two differ), and this renders that draft when it is a draft of the\n * message's own text (`readDeepAgentComposerMarkdown`), formatting and\n * mention chips included. Any other text — no draft, or one of other words —\n * renders with the typed reading (`ChatMessageBody typed`), which leaves raw\n * HTML and underscore emphasis as the characters they were typed with, so\n * `List<T>`, `obj.__init__` and `a\\b` show as typed there too.\n *\n * Copy copies the message text, which is the text as sent, and Edit opens it\n * in a plain-text box, so neither reads the draft.\n */\nexport const UserMessageText: FC<{ text: string }> = ({ text }) => {\n const composerMarkdown: unknown = useAuiState(\n (s) => s.message.metadata?.custom?.[DEEP_AGENT_COMPOSER_MARKDOWN_KEY],\n );\n const shown = useMemo(\n () =>\n readDeepAgentComposerMarkdown({\n metadata: { [DEEP_AGENT_COMPOSER_MARKDOWN_KEY]: composerMarkdown },\n text,\n }) ?? text,\n [composerMarkdown, text],\n );\n return <ChatMessageBody text={shown} typed />;\n};\n\nconst UserActionBar: FC = () => (\n <ActionBarPrimitive.Root\n autohide=\"never\"\n className={cn(\n \"flex min-h-6 items-center gap-0.5\",\n ACTION_BAR_REVEAL_CLASS,\n \"group-hover/user-message:pointer-events-auto group-hover/user-message:opacity-100\",\n )}\n >\n <CopyActionButton />\n <EditActionButton />\n </ActionBarPrimitive.Root>\n);\n\nexport const UserMessage: FC = () => {\n // A GitHub wake or a subscription's delivery is an event, not words the\n // user typed: it renders as the compact wake marker instead of a bubble\n // quoting the injected text.\n const isWake = useAuiState(\n (s) =>\n isGithubWakeMessage(s.message.metadata?.custom) ||\n isSubscriptionWakeMessage(s.message.metadata?.custom),\n );\n // A voice delegation's anchor is the ask the live voice model handed to the\n // thread, not words the user typed: it renders as the shared voice-task\n // card on every host instead of a second user bubble under the spoken turn.\n const isVoiceDelegation = useAuiState((s) =>\n isVoiceDelegationMessage({ messageId: s.message.id, custom: s.message.metadata?.custom }),\n );\n if (isWake) {\n return (\n <MessagePrimitive.Root data-message-role=\"user\" className=\"mb-3\">\n <WakeMarkerMessage />\n </MessagePrimitive.Root>\n );\n }\n if (isVoiceDelegation) {\n return (\n <MessagePrimitive.Root data-message-role=\"user\" className=\"mb-3\">\n <VoiceDelegationMessage />\n </MessagePrimitive.Root>\n );\n }\n return (\n <MessagePrimitive.Root\n data-message-role=\"user\"\n className=\"group/user-message mb-3 flex justify-end\"\n >\n <div className=\"flex min-w-0 max-w-[85%] flex-col items-end gap-1\">\n <div className=\"min-w-0 max-w-full rounded-2xl rounded-br-md bg-muted px-3.5 py-2 text-sm text-foreground\">\n <MessagePrimitive.Content components={{ Text: UserMessageText }} />\n </div>\n <div className=\"flex min-h-6 items-center gap-1\">\n <BranchPicker />\n <UserActionBar />\n </div>\n </div>\n </MessagePrimitive.Root>\n );\n};\n\nexport interface CreateAssistantMessageOptions {\n /** Host-registered card for tools without a dedicated UI. */\n toolFallback: ToolCallMessagePartComponent;\n /** Extra action-bar controls appended after copy/regenerate. */\n extraActions?: ReactNode;\n /**\n * Renders the message body. Hosts that group content into activity\n * timelines supply their own; the default renders markdown and tool cards.\n */\n content?: FC;\n /**\n * Inline affordance rendered inside a runtime-ending card (e.g. a Continue\n * button). Hosts without one leave it unset.\n */\n runtimeMessageAction?: ReactNode;\n}\n\n/**\n * Builds the assistant bubble. Call this once per host (memoized on its\n * inputs) so the returned component identity stays stable across renders.\n */\nexport function createAssistantMessage({\n toolFallback,\n extraActions,\n content: Content,\n runtimeMessageAction,\n}: CreateAssistantMessageOptions): FC {\n const AssistantActionBar: FC = () => {\n // The latest reply keeps its actions visible; older replies reveal them\n // on hover so a long transcript is not a wall of icon rows.\n const isLast = useAuiState((s) => s.message.isLast);\n return (\n <ActionBarPrimitive.Root\n autohide=\"never\"\n className={cn(\n \"mt-1 flex min-h-6 items-center gap-0.5\",\n !isLast && [\n ACTION_BAR_REVEAL_CLASS,\n \"group-hover/assistant-message:pointer-events-auto group-hover/assistant-message:opacity-100\",\n ],\n )}\n >\n <CopyActionButton />\n <RegenerateActionButton />\n {extraActions}\n </ActionBarPrimitive.Root>\n );\n };\n\n // A run-lifecycle marker or handoff summary is a system event, not\n // assistant speech. When it owns the whole row, render the status card in\n // place of the bubble; when it is chunked in with the assistant's own work\n // (or is a handoff whose text IS the closing summary), keep the body and\n // frame it with the card above.\n const RuntimeEnding: FC<{ placement: \"row\" | \"banner\" }> = ({ placement }) => {\n // Select the message (a stable store reference) and derive from it: the\n // reader allocates a fresh object per call, and `useAuiState` compares\n // snapshots with `Object.is`, so selecting the reader's result directly\n // would re-render on every store update and trip React's update-depth\n // guard.\n const message = useAuiState((s) => s.message);\n const runtime = useMemo(() => readRuntimeMessageFromSourceMessages(message), [message]);\n if (!runtime || runtime.silent) return null;\n if (placement === \"row\" && !runtime.isSoleSourceMessage) return null;\n if (placement === \"banner\" && runtime.isSoleSourceMessage && runtime.kind !== \"handoff\") {\n return null;\n }\n return <RuntimeMessageCard message={runtime} action={runtimeMessageAction} />;\n };\n\n const AssistantMessage: FC = () => {\n // An assistant row exists before its first token streams; showing\n // copy/regenerate against nothing looks broken, so wait for content.\n const showActions = useAuiState((state) =>\n hasVisibleContent(state.message.content),\n );\n // Primitive selector: the reader builds a fresh object per call.\n const soleRuntimeKind = useAuiState((s) => readSoleRuntimeMessageKind(s.message));\n const soleRuntimeSilent = useAuiState(\n (s) => readRuntimeMessageFromSourceMessages(s.message)?.silent === true,\n );\n\n if (soleRuntimeKind && soleRuntimeKind !== \"handoff\") {\n if (soleRuntimeSilent) return null;\n return (\n <MessagePrimitive.Root\n data-message-role=\"assistant\"\n className=\"group group/assistant-message mb-3\"\n >\n <div className=\"max-w-[95%]\">\n <RuntimeEnding placement=\"row\" />\n </div>\n </MessagePrimitive.Root>\n );\n }\n\n return (\n <MessagePrimitive.Root\n data-message-role=\"assistant\"\n className=\"group group/assistant-message mb-3\"\n >\n <div className=\"max-w-[95%]\">\n <RuntimeEnding placement=\"banner\" />\n {Content ? (\n <Content />\n ) : (\n <MessagePrimitive.Content\n components={{\n Text: MarkdownText,\n tools: { Fallback: toolFallback },\n }}\n />\n )}\n {showActions ? (\n <div className=\"flex min-h-6 items-center gap-1\">\n <BranchPicker />\n <AssistantActionBar />\n </div>\n ) : null}\n </div>\n </MessagePrimitive.Root>\n );\n };\n\n return AssistantMessage;\n}\n\n/** Composer chrome: the dock around the composer, its surface and its rows. */\nexport const COMPOSER_DOCK_CLASS = \"bg-background px-2.5 pb-2 pt-1.5\";\nexport const COMPOSER_SURFACE_CLASS =\n \"relative flex flex-col gap-1 rounded-xl border border-neutral-200 bg-white shadow-[0_2px_10px_rgba(54,45,33,0.08)]\";\nexport const COMPOSER_EDITOR_ROW_CLASS = \"px-2.5 pt-1\";\nexport const COMPOSER_TOOLBAR_CLASS =\n \"flex items-center gap-1 border-t border-neutral-100 px-2 py-1.5\";\n/**\n * Paper composer chrome (`ChatComposerDock appearance=\"paper\"`): a card-toned\n * surface with a larger radius, a focus-within ring, a drag-over tint keyed\n * off `data-drag-active`, and a bottom rail — the chrome the SDK's\n * `AthenaChat` thread renders. Hosts on the default chrome above are\n * untouched. The dock carries no padding of its own; the paper host's footer\n * spaces it. The radius and border colour also bind to the `--composer-radius`\n * / `--composer-border` theme variables in `styles.css`.\n */\nexport const COMPOSER_PAPER_DOCK_CLASS = \"aui-composer-dock\";\nexport const COMPOSER_PAPER_SURFACE_CLASS =\n \"aui-composer-root relative flex w-full flex-col rounded-[1.375rem] border border-border bg-card p-2.5 text-card-foreground shadow-[0_1px_2px_rgba(0,0,0,0.04)] outline-none transition-shadow duration-150 focus-within:shadow-[0_8px_24px_-14px_rgba(0,0,0,0.25)] focus-within:ring-2 focus-within:ring-ring/40 data-[drag-active=true]:bg-primary/5 data-[drag-active=true]:ring-2 data-[drag-active=true]:ring-primary/40\";\nexport const COMPOSER_PAPER_EDITOR_ROW_CLASS = \"px-0.5\";\nexport const COMPOSER_PAPER_TOOLBAR_CLASS =\n \"aui-composer-action-wrapper relative flex items-center justify-between gap-1 pt-1\";\nexport const THREAD_SCROLL_TO_BOTTOM_CLASS =\n \"inline-flex items-center justify-center rounded-full border bg-background/80 p-1 shadow-sm backdrop-blur transition-opacity hover:bg-accent disabled:invisible\";\n\nconst ComposerStopIcon: FC = () => (\n <svg\n aria-hidden=\"true\"\n className=\"size-4\"\n viewBox=\"0 0 16 16\"\n fill=\"currentColor\"\n >\n <rect width=\"10\" height=\"10\" x=\"3\" y=\"3\" rx=\"2\" />\n </svg>\n);\n\nexport interface ComposerStopButtonProps {\n onStop: () => void;\n disabled?: boolean;\n title?: string;\n}\n\nexport interface ComposerSendButtonProps {\n action: Extract<ComposerAction, \"send\" | \"queue\">;\n onSend: () => void;\n disabled?: boolean;\n title?: string;\n}\n\n/** Stop control shown while a run is in flight and there is nothing queued. */\nexport const ComposerStopButton: FC<ComposerStopButtonProps> = ({\n onStop,\n disabled = false,\n title = \"Stop generation\",\n}) => (\n <button\n type=\"button\"\n onClick={onStop}\n disabled={disabled}\n title={title}\n className={cn(\n \"inline-flex size-8 shrink-0 items-center justify-center rounded-lg bg-foreground text-background shadow-sm transition-colors hover:bg-foreground/80\",\n disabled && \"cursor-not-allowed opacity-60\",\n )}\n >\n <ComposerStopIcon />\n </button>\n);\n/** Send control, which becomes a queue control while a run is in flight. */\nexport const ComposerSendButton: FC<ComposerSendButtonProps> = ({\n action,\n onSend,\n disabled = false,\n title,\n}) => (\n <button\n type=\"button\"\n onClick={onSend}\n disabled={disabled}\n title={title ?? (action === \"queue\" ? \"Queue message\" : \"Send\")}\n className={cn(\n \"inline-flex size-8 shrink-0 items-center justify-center rounded-full shadow-sm transition-colors\",\n disabled\n ? \"cursor-not-allowed bg-muted text-muted-foreground opacity-60\"\n : \"bg-foreground text-background hover:bg-foreground/80\",\n )}\n >\n {action === \"queue\" ? (\n <ListPlusIcon className=\"size-4\" />\n ) : (\n <ArrowUpIcon className=\"size-4\" />\n )}\n </button>\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAwDO,MAAM,eAAmB,MAC9B;AAAA,EAAC,sBAAsB;AAAA,EAAtB;AAAA,IACC,sBAAoB;AAAA,IACpB,WAAU;AAAA,IACV,eAAY;AAAA,IAEZ,UAAA;AAAA,MAAA,oBAAC,sBAAsB,UAAtB,EAA+B,SAAO,MACrC,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,SAAQ;AAAA,UACR,eAAY;AAAA,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AW;AAAA,EACX;AACF,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,MAAK;AAAA,IACL,SAAS;AAAA,IACT;AAAA,IACA,OAAO,UAAU,WAAW,UAAU,kBAAkB;AAAA,IACxD,WAAW;AAAA,MACT;AAAA,MACA,WACI,iEACA;AAAA,IAAA;AAAA,IAGL,UAAA,WAAW,UACV,oBAAC,cAAA,EAAa,WAAU,UAAS,IAEjC,oBAAC,aAAA,EAAY,WAAU,SAAA,CAAS;AAAA,EAAA;AAEpC;"}
|
|
1
|
+
{"version":3,"file":"message-components.js","sources":["../../../src/chat-ui/messages/message-components.tsx"],"sourcesContent":["import {\n ActionBarPrimitive,\n AuiIf,\n BranchPickerPrimitive,\n MessagePrimitive,\n useAuiState,\n useMessagePartText,\n useSmooth,\n type ToolCallMessagePartComponent,\n} from \"@assistant-ui/react\";\nimport {\n CHAT_EDIT_UNREACHABLE_LABEL,\n DEEP_AGENT_COMPOSER_MARKDOWN_KEY,\n hideUnterminatedMarkdownLink,\n isGithubWakeMessage,\n isSubscriptionWakeMessage,\n isVoiceDelegationMessage,\n readDeepAgentComposerMarkdown,\n readRuntimeMessageFromSourceMessages,\n readSoleRuntimeMessageKind,\n useChatOutboxReachable,\n useDeepAgentChatOutboxContext,\n} from \"@athenaintel/agent-runtime\";\nimport {\n ArrowUpIcon,\n CheckIcon,\n ChevronLeftIcon,\n ChevronRightIcon,\n CopyIcon,\n ListPlusIcon,\n PencilIcon,\n RefreshCwIcon,\n} from \"lucide-react\";\nimport {\n type FC,\n type ReactNode,\n useMemo,\n} from \"react\";\nimport { useAthenaRunLive } from \"../../chat/use-athena-run-live\";\nimport type { ComposerAction } from \"../composer/composer-action\";\nimport { cn } from \"../../lib/utils\";\nimport { ChatMessageBody } from \"../rich-text/chat-message-body\";\nimport { useMessageActionsReadOnly } from \"./message-actions-config\";\nimport { RuntimeMessageCard } from \"./runtime-message\";\nimport { hasVisibleContent } from \"./running-indicator\";\nimport { VoiceDelegationMessage } from \"./voice-delegation-card\";\nimport { WakeMarkerMessage } from \"./wake-marker\";\nimport { SmallIconButton } from \"./thread-chrome\";\n\nexport {\n IconButton,\n SmallIconButton,\n THREAD_HEADER_ACTIONS_CLASS,\n THREAD_HEADER_CLASS,\n THREAD_HEADER_ICON_CLASS,\n THREAD_HEADER_PILL_CLASS,\n THREAD_PANEL_CLASS,\n} from \"./thread-chrome\";\n\nexport const BranchPicker: FC = () => (\n <BranchPickerPrimitive.Root\n hideWhenSingleBranch\n className=\"inline-flex items-center gap-0.5 text-xs text-muted-foreground\"\n data-testid=\"chat-branch-picker\"\n >\n <BranchPickerPrimitive.Previous asChild>\n <SmallIconButton\n tooltip=\"Previous branch\"\n data-testid=\"chat-branch-previous\"\n >\n <ChevronLeftIcon className=\"size-3\" />\n </SmallIconButton>\n </BranchPickerPrimitive.Previous>\n <span className=\"font-medium\" data-testid=\"chat-branch-count\">\n <BranchPickerPrimitive.Number /> / <BranchPickerPrimitive.Count />\n </span>\n <BranchPickerPrimitive.Next asChild>\n <SmallIconButton tooltip=\"Next branch\" data-testid=\"chat-branch-next\">\n <ChevronRightIcon className=\"size-3\" />\n </SmallIconButton>\n </BranchPickerPrimitive.Next>\n </BranchPickerPrimitive.Root>\n);\n\nconst CopyActionButton: FC = () => (\n <ActionBarPrimitive.Copy asChild>\n <SmallIconButton tooltip=\"Copy\">\n <AuiIf condition={(state) => state.message.isCopied}>\n <CheckIcon className=\"size-3\" />\n </AuiIf>\n <AuiIf condition={(state) => !state.message.isCopied}>\n <CopyIcon className=\"size-3\" />\n </AuiIf>\n </SmallIconButton>\n </ActionBarPrimitive.Copy>\n);\n\n/**\n * The edit primitive does not check the runtime's edit capability itself —\n * clicking it on a runtime without one throws inside onPress, where no error\n * boundary can catch it — so the button must gate on the capability and, to\n * match the rewind semantics of `run/edit`, stay hidden while a run is live.\n * The read-only context covers threads the capability flags cannot: a host's\n * static `edit: true` still applies to fenced legacy conversations. While the\n * host's chat outbox says Athena can't be reached it is not offered: shown\n * disabled, its tooltip says why, and it comes back once Athena answers.\n */\nconst EditActionButton: FC = () => {\n const allowEdit = useAuiState((s) => s.thread.capabilities.edit);\n const isRunning = useAthenaRunLive();\n const readOnly = useMessageActionsReadOnly();\n const reachable = useChatOutboxReachable(useDeepAgentChatOutboxContext());\n if (!allowEdit || isRunning || readOnly) return null;\n if (!reachable) {\n return (\n <SmallIconButton\n tooltip={CHAT_EDIT_UNREACHABLE_LABEL}\n aria-disabled\n data-testid=\"chat-message-edit-unreachable\"\n className=\"cursor-not-allowed opacity-50 hover:bg-transparent hover:text-muted-foreground\"\n >\n <PencilIcon className=\"size-3\" />\n </SmallIconButton>\n );\n }\n return (\n <ActionBarPrimitive.Edit asChild>\n <SmallIconButton tooltip=\"Edit\" data-testid=\"chat-message-edit\">\n <PencilIcon className=\"size-3\" />\n </SmallIconButton>\n </ActionBarPrimitive.Edit>\n );\n};\n\n/** Regenerate dispatches `run/reload`, so it hides on read-only threads too. */\nconst RegenerateActionButton: FC = () => {\n const readOnly = useMessageActionsReadOnly();\n if (readOnly) return null;\n return (\n <ActionBarPrimitive.Reload asChild>\n <SmallIconButton tooltip=\"Regenerate\">\n <RefreshCwIcon className=\"size-3\" />\n </SmallIconButton>\n </ActionBarPrimitive.Reload>\n );\n};\n\n/**\n * Reveal-on-demand treatment for action bars: invisible and click-through\n * until the surrounding named group is hovered or a control inside receives\n * keyboard focus. The `focus-within` escape hatch is what keeps the hidden\n * controls reachable for keyboard users.\n */\nexport const ACTION_BAR_REVEAL_CLASS =\n \"pointer-events-none opacity-0 transition-opacity focus-within:pointer-events-auto focus-within:opacity-100\";\n\n/** Shared chat body; the reveal holds incomplete links until their URL is complete. */\nexport const MarkdownText: FC = () => {\n const revealed = useSmooth(useMessagePartText(), true);\n const isRunning = revealed.status.type === \"running\";\n const text = isRunning ? hideUnterminatedMarkdownLink(revealed.text) : revealed.text;\n return <ChatMessageBody text={text} isRunning={isRunning} />;\n};\n\n/**\n * A user message's text, shown as it was typed.\n *\n * A composer sends plain text exactly as typed, because the model reads it\n * literally, so the text alone no longer says which characters are\n * formatting: read as Markdown, `List<T>` loses `<T>`, `obj.__init__` shows a\n * bold \"init\" and `a\\\\b` one backslash. A composer send therefore carries the\n * draft it was serialized from (`metadata.composer_markdown`, only when the\n * two differ), and this renders that draft when it is a draft of the\n * message's own text (`readDeepAgentComposerMarkdown`), formatting and\n * mention chips included. Any other text — no draft, or one of other words —\n * renders with the typed reading (`ChatMessageBody typed`), which leaves raw\n * HTML and underscore emphasis as the characters they were typed with, so\n * `List<T>`, `obj.__init__` and `a\\b` show as typed there too.\n *\n * Copy copies the message text, which is the text as sent, and Edit opens it\n * in a plain-text box, so neither reads the draft.\n */\nexport const UserMessageText: FC<{ text: string }> = ({ text }) => {\n const composerMarkdown: unknown = useAuiState(\n (s) => s.message.metadata?.custom?.[DEEP_AGENT_COMPOSER_MARKDOWN_KEY],\n );\n const shown = useMemo(\n () =>\n readDeepAgentComposerMarkdown({\n metadata: { [DEEP_AGENT_COMPOSER_MARKDOWN_KEY]: composerMarkdown },\n text,\n }) ?? text,\n [composerMarkdown, text],\n );\n return <ChatMessageBody text={shown} typed />;\n};\n\nconst UserActionBar: FC = () => (\n <ActionBarPrimitive.Root\n autohide=\"never\"\n className={cn(\n \"flex min-h-6 items-center gap-0.5\",\n ACTION_BAR_REVEAL_CLASS,\n \"group-hover/user-message:pointer-events-auto group-hover/user-message:opacity-100\",\n )}\n >\n <CopyActionButton />\n <EditActionButton />\n </ActionBarPrimitive.Root>\n);\n\nexport const UserMessage: FC = () => {\n // A GitHub wake or a subscription's delivery is an event, not words the\n // user typed: it renders as the compact wake marker instead of a bubble\n // quoting the injected text.\n const isWake = useAuiState(\n (s) =>\n isGithubWakeMessage(s.message.metadata?.custom) ||\n isSubscriptionWakeMessage(s.message.metadata?.custom),\n );\n // A voice delegation's anchor is the ask the live voice model handed to the\n // thread, not words the user typed: it renders as the shared voice-task\n // card on every host instead of a second user bubble under the spoken turn.\n const isVoiceDelegation = useAuiState((s) =>\n isVoiceDelegationMessage({ messageId: s.message.id, custom: s.message.metadata?.custom }),\n );\n if (isWake) {\n return (\n <MessagePrimitive.Root data-message-role=\"user\" className=\"mb-3\">\n <WakeMarkerMessage />\n </MessagePrimitive.Root>\n );\n }\n if (isVoiceDelegation) {\n return (\n <MessagePrimitive.Root data-message-role=\"user\" className=\"mb-3\">\n <VoiceDelegationMessage />\n </MessagePrimitive.Root>\n );\n }\n return (\n <MessagePrimitive.Root\n data-message-role=\"user\"\n className=\"group/user-message mb-3 flex justify-end\"\n >\n <div className=\"flex min-w-0 max-w-[85%] flex-col items-end gap-1\">\n <div className=\"min-w-0 max-w-full rounded-2xl rounded-br-md bg-muted px-3.5 py-2 text-sm text-foreground\">\n <MessagePrimitive.Content components={{ Text: UserMessageText }} />\n </div>\n <div className=\"flex min-h-6 items-center gap-1\">\n <BranchPicker />\n <UserActionBar />\n </div>\n </div>\n </MessagePrimitive.Root>\n );\n};\n\nexport interface CreateAssistantMessageOptions {\n /** Host-registered card for tools without a dedicated UI. */\n toolFallback: ToolCallMessagePartComponent;\n /** Extra action-bar controls appended after copy/regenerate. */\n extraActions?: ReactNode;\n /**\n * Renders the message body. Hosts that group content into activity\n * timelines supply their own; the default renders markdown and tool cards.\n */\n content?: FC;\n /**\n * Inline affordance rendered inside a runtime-ending card (e.g. a Continue\n * button). Hosts without one leave it unset.\n */\n runtimeMessageAction?: ReactNode;\n}\n\n/**\n * Builds the assistant bubble. Call this once per host (memoized on its\n * inputs) so the returned component identity stays stable across renders.\n */\nexport function createAssistantMessage({\n toolFallback,\n extraActions,\n content: Content,\n runtimeMessageAction,\n}: CreateAssistantMessageOptions): FC {\n const AssistantActionBar: FC = () => {\n // The latest reply keeps its actions visible; older replies reveal them\n // on hover so a long transcript is not a wall of icon rows.\n const isLast = useAuiState((s) => s.message.isLast);\n return (\n <ActionBarPrimitive.Root\n autohide=\"never\"\n className={cn(\n \"mt-1 flex min-h-6 items-center gap-0.5\",\n !isLast && [\n ACTION_BAR_REVEAL_CLASS,\n \"group-hover/assistant-message:pointer-events-auto group-hover/assistant-message:opacity-100\",\n ],\n )}\n >\n <CopyActionButton />\n <RegenerateActionButton />\n {extraActions}\n </ActionBarPrimitive.Root>\n );\n };\n\n // A run-lifecycle marker or handoff summary is a system event, not\n // assistant speech. When it owns the whole row, render the status card in\n // place of the bubble; when it is chunked in with the assistant's own work\n // (or is a handoff whose text IS the closing summary), keep the body and\n // frame it with the card above.\n const RuntimeEnding: FC<{ placement: \"row\" | \"banner\" }> = ({ placement }) => {\n // Select the message (a stable store reference) and derive from it: the\n // reader allocates a fresh object per call, and `useAuiState` compares\n // snapshots with `Object.is`, so selecting the reader's result directly\n // would re-render on every store update and trip React's update-depth\n // guard.\n const message = useAuiState((s) => s.message);\n const runtime = useMemo(() => readRuntimeMessageFromSourceMessages(message), [message]);\n if (!runtime || runtime.silent) return null;\n if (placement === \"row\" && !runtime.isSoleSourceMessage) return null;\n if (placement === \"banner\" && runtime.isSoleSourceMessage && runtime.kind !== \"handoff\") {\n return null;\n }\n return <RuntimeMessageCard message={runtime} action={runtimeMessageAction} />;\n };\n\n const AssistantMessage: FC = () => {\n // An assistant row exists before its first token streams; showing\n // copy/regenerate against nothing looks broken, so wait for content.\n const showActions = useAuiState((state) =>\n hasVisibleContent(state.message.content),\n );\n // Primitive selector: the reader builds a fresh object per call.\n const soleRuntimeKind = useAuiState((s) => readSoleRuntimeMessageKind(s.message));\n const soleRuntimeSilent = useAuiState(\n (s) => readRuntimeMessageFromSourceMessages(s.message)?.silent === true,\n );\n\n if (soleRuntimeKind && soleRuntimeKind !== \"handoff\") {\n if (soleRuntimeSilent) return null;\n return (\n <MessagePrimitive.Root\n data-message-role=\"assistant\"\n className=\"group group/assistant-message mb-3\"\n >\n <div className=\"max-w-[95%]\">\n <RuntimeEnding placement=\"row\" />\n </div>\n </MessagePrimitive.Root>\n );\n }\n\n return (\n <MessagePrimitive.Root\n data-message-role=\"assistant\"\n className=\"group group/assistant-message mb-3\"\n >\n <div className=\"max-w-[95%]\">\n <RuntimeEnding placement=\"banner\" />\n {Content ? (\n <Content />\n ) : (\n <MessagePrimitive.Content\n components={{\n Text: MarkdownText,\n tools: { Fallback: toolFallback },\n }}\n />\n )}\n {showActions ? (\n <div className=\"flex min-h-6 items-center gap-1\">\n <BranchPicker />\n <AssistantActionBar />\n </div>\n ) : null}\n </div>\n </MessagePrimitive.Root>\n );\n };\n\n return AssistantMessage;\n}\n\n/** Composer chrome: the dock around the composer, its surface and its rows. */\nexport const COMPOSER_DOCK_CLASS = \"bg-background px-2.5 pb-2 pt-1.5\";\nexport const COMPOSER_SURFACE_CLASS =\n \"relative flex flex-col gap-1 rounded-xl border border-neutral-200 bg-white shadow-[0_2px_10px_rgba(54,45,33,0.08)]\";\nexport const COMPOSER_EDITOR_ROW_CLASS = \"px-2.5 pt-1\";\nexport const COMPOSER_TOOLBAR_CLASS =\n \"flex items-center gap-1 border-t border-neutral-100 px-2 py-1.5\";\n/**\n * Paper composer chrome (`ChatComposerDock appearance=\"paper\"`): a card-toned\n * surface with a larger radius, a focus-within ring, a drag-over tint keyed\n * off `data-drag-active`, and a bottom rail — the chrome the SDK's\n * `AthenaChat` thread renders. Hosts on the default chrome above are\n * untouched. The dock carries no padding of its own; the paper host's footer\n * spaces it. The radius and border colour also bind to the `--composer-radius`\n * / `--composer-border` theme variables in `styles.css`.\n */\nexport const COMPOSER_PAPER_DOCK_CLASS = \"aui-composer-dock\";\nexport const COMPOSER_PAPER_SURFACE_CLASS =\n \"aui-composer-root relative flex w-full flex-col rounded-[1.375rem] border border-border bg-card p-2.5 text-card-foreground shadow-[0_1px_2px_rgba(0,0,0,0.04)] outline-none transition-shadow duration-150 focus-within:shadow-[0_8px_24px_-14px_rgba(0,0,0,0.25)] focus-within:ring-2 focus-within:ring-ring/40 data-[drag-active=true]:bg-primary/5 data-[drag-active=true]:ring-2 data-[drag-active=true]:ring-primary/40\";\nexport const COMPOSER_PAPER_EDITOR_ROW_CLASS = \"px-0.5\";\nexport const COMPOSER_PAPER_TOOLBAR_CLASS =\n \"aui-composer-action-wrapper relative flex items-center justify-between gap-1 pt-1\";\nexport const THREAD_SCROLL_TO_BOTTOM_CLASS =\n \"inline-flex items-center justify-center rounded-full border bg-background/80 p-1 shadow-sm backdrop-blur transition-opacity hover:bg-accent disabled:invisible\";\n\nconst ComposerStopIcon: FC = () => (\n <svg\n aria-hidden=\"true\"\n className=\"size-4\"\n viewBox=\"0 0 16 16\"\n fill=\"currentColor\"\n >\n <rect width=\"10\" height=\"10\" x=\"3\" y=\"3\" rx=\"2\" />\n </svg>\n);\n\nexport interface ComposerStopButtonProps {\n onStop: () => void;\n disabled?: boolean;\n title?: string;\n}\n\nexport interface ComposerSendButtonProps {\n action: Extract<ComposerAction, \"send\" | \"queue\">;\n onSend: () => void;\n disabled?: boolean;\n title?: string;\n}\n\n/** Stop control shown while a run is in flight and there is nothing queued. */\nexport const ComposerStopButton: FC<ComposerStopButtonProps> = ({\n onStop,\n disabled = false,\n title = \"Stop generation\",\n}) => (\n <button\n type=\"button\"\n onClick={onStop}\n disabled={disabled}\n title={title}\n className={cn(\n \"inline-flex size-8 shrink-0 items-center justify-center rounded-lg bg-foreground text-background shadow-sm transition-colors hover:bg-foreground/80\",\n disabled && \"cursor-not-allowed opacity-60\",\n )}\n >\n <ComposerStopIcon />\n </button>\n);\n/** Send control, which becomes a queue control while a run is in flight. */\nexport const ComposerSendButton: FC<ComposerSendButtonProps> = ({\n action,\n onSend,\n disabled = false,\n title,\n}) => (\n <button\n type=\"button\"\n onClick={onSend}\n disabled={disabled}\n title={title ?? (action === \"queue\" ? \"Queue message\" : \"Send\")}\n className={cn(\n \"inline-flex size-8 shrink-0 items-center justify-center rounded-full shadow-sm transition-colors\",\n disabled\n ? \"cursor-not-allowed bg-muted text-muted-foreground opacity-60\"\n : \"bg-foreground text-background hover:bg-foreground/80\",\n )}\n >\n {action === \"queue\" ? (\n <ListPlusIcon className=\"size-4\" />\n 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ACK,MAAM,gCACX;AAEF,MAAM,mBAAuB,MAC3B;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,eAAY;AAAA,IACZ,WAAU;AAAA,IACV,SAAQ;AAAA,IACR,MAAK;AAAA,IAEL,UAAA,oBAAC,QAAA,EAAK,OAAM,MAAK,QAAO,MAAK,GAAE,KAAI,GAAE,KAAI,IAAG,IAAA,CAAI;AAAA,EAAA;AAClD;AAiBK,MAAM,qBAAkD,CAAC;AAAA,EAC9D;AAAA,EACA,WAAW;AAAA,EACX,QAAQ;AACV,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,MAAK;AAAA,IACL,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA,YAAY;AAAA,IAAA;AAAA,IAGd,8BAAC,kBAAA,CAAA,CAAiB;AAAA,EAAA;AACpB;AAGK,MAAM,qBAAkD,CAAC;AAAA,EAC9D;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AACF,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,MAAK;AAAA,IACL,SAAS;AAAA,IACT;AAAA,IACA,OAAO,UAAU,WAAW,UAAU,kBAAkB;AAAA,IACxD,WAAW;AAAA,MACT;AAAA,MACA,WACI,iEACA;AAAA,IAAA;AAAA,IAGL,UAAA,WAAW,UACV,oBAAC,cAAA,EAAa,WAAU,UAAS,IAEjC,oBAAC,aAAA,EAAY,WAAU,SAAA,CAAS;AAAA,EAAA;AAEpC;"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* free; hosts with their own row (Olympus, mobile) render their own presenter
|
|
7
7
|
* from the same {@link AthenaRuntimeMessage} so the taxonomy cannot drift.
|
|
8
8
|
*/
|
|
9
|
-
import { type AthenaRuntimeMessage } from "
|
|
9
|
+
import { type AthenaRuntimeMessage } from "../../agent-runtime/src/index";
|
|
10
10
|
import type { ComponentPropsWithoutRef, FC, ReactNode } from "react";
|
|
11
11
|
export interface RuntimeMessageCardProps extends Omit<ComponentPropsWithoutRef<"div">, "children" | "role"> {
|
|
12
12
|
message: AthenaRuntimeMessage;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ThreadMessage } from "@assistant-ui/react";
|
|
2
|
-
import { type AthenaRuntimeMessageKind, type DeepAgentThreadStatus } from "
|
|
2
|
+
import { type AthenaRuntimeMessageKind, type DeepAgentThreadStatus } from "../../agent-runtime/src/index";
|
|
3
3
|
import type { ReactElement, ReactNode } from "react";
|
|
4
4
|
export interface StatewireContinueRunButtonProps {
|
|
5
5
|
/**
|
|
@@ -2,14 +2,26 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const react = require("@assistant-ui/react");
|
|
5
|
+
const react$1 = require("react");
|
|
5
6
|
const useDeepAgentEditSubmit = require("../../agent-runtime/src/use-deep-agent-edit-submit.cjs");
|
|
7
|
+
const useDeepAgentChatOutbox = require("../../agent-runtime/src/use-deep-agent-chat-outbox.cjs");
|
|
8
|
+
const chatOutbox = require("../../agent-runtime/src/chat-outbox.cjs");
|
|
6
9
|
const UserEditComposer = () => {
|
|
7
10
|
const submit = useDeepAgentEditSubmit.useDeepAgentMessageEditSubmit();
|
|
8
11
|
const isEmpty = react.useAuiState((s) => s.message.composer.isEmpty);
|
|
12
|
+
const reachable = useDeepAgentChatOutbox.useChatOutboxReachable(useDeepAgentChatOutbox.useDeepAgentChatOutboxContext());
|
|
13
|
+
const [refused, setRefused] = react$1.useState(false);
|
|
14
|
+
const send = () => {
|
|
15
|
+
setRefused(false);
|
|
16
|
+
submit().catch((error) => {
|
|
17
|
+
if (!(error instanceof chatOutbox.ChatEditUnreachableError)) throw error;
|
|
18
|
+
setRefused(true);
|
|
19
|
+
});
|
|
20
|
+
};
|
|
9
21
|
const onKeyDown = (event) => {
|
|
10
22
|
if (event.key !== "Enter" || event.shiftKey || event.nativeEvent.isComposing) return;
|
|
11
23
|
event.preventDefault();
|
|
12
|
-
|
|
24
|
+
send();
|
|
13
25
|
};
|
|
14
26
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-3 flex justify-end", "data-testid": "chat-user-edit-composer", children: /* @__PURE__ */ jsxRuntime.jsxs(react.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", children: [
|
|
15
27
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -21,6 +33,7 @@ const UserEditComposer = () => {
|
|
|
21
33
|
className: "w-full resize-none bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground"
|
|
22
34
|
}
|
|
23
35
|
),
|
|
36
|
+
refused && !reachable && /* @__PURE__ */ jsxRuntime.jsx("p", { role: "status", "data-testid": "chat-user-edit-refused", className: "text-xs text-muted-foreground", children: chatOutbox.CHAT_EDIT_KEPT_MESSAGE }),
|
|
24
37
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-1.5", children: [
|
|
25
38
|
/* @__PURE__ */ jsxRuntime.jsx(react.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
26
39
|
"button",
|
|
@@ -36,7 +49,7 @@ const UserEditComposer = () => {
|
|
|
36
49
|
type: "button",
|
|
37
50
|
"data-testid": "chat-user-edit-send",
|
|
38
51
|
disabled: isEmpty,
|
|
39
|
-
onClick:
|
|
52
|
+
onClick: send,
|
|
40
53
|
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",
|
|
41
54
|
children: "Send"
|
|
42
55
|
}
|
|
@@ -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 {
|
|
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 {\n CHAT_EDIT_KEPT_MESSAGE,\n ChatEditUnreachableError,\n useChatOutboxReachable,\n useDeepAgentChatOutboxContext,\n useDeepAgentMessageEditSubmit,\n} from \"@athenaintel/agent-runtime\";\nimport { type FC, type KeyboardEvent, useState } 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. An edit submitted\n * while the host's chat outbox says Athena can't be reached is refused: the\n * draft stays here and the composer says why until Athena answers again.\n */\nexport const UserEditComposer: FC = () => {\n const submit = useDeepAgentMessageEditSubmit();\n const isEmpty = useAuiState((s) => s.message.composer.isEmpty);\n const reachable = useChatOutboxReachable(useDeepAgentChatOutboxContext());\n const [refused, setRefused] = useState(false);\n const send = () => {\n setRefused(false);\n submit().catch((error: unknown) => {\n if (!(error instanceof ChatEditUnreachableError)) throw error;\n setRefused(true);\n });\n };\n const onKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key !== \"Enter\" || event.shiftKey || event.nativeEvent.isComposing) return;\n event.preventDefault();\n send();\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 {refused && !reachable && (\n <p role=\"status\" data-testid=\"chat-user-edit-refused\" className=\"text-xs text-muted-foreground\">\n {CHAT_EDIT_KEPT_MESSAGE}\n </p>\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={send}\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","useChatOutboxReachable","useDeepAgentChatOutboxContext","useState","ChatEditUnreachableError","jsx","jsxs","ComposerPrimitive","CHAT_EDIT_KEPT_MESSAGE"],"mappings":";;;;;;;;AAqBO,MAAM,mBAAuB,MAAM;AACxC,QAAM,SAASA,uBAAAA,8BAAA;AACf,QAAM,UAAUC,MAAAA,YAAY,CAAC,MAAM,EAAE,QAAQ,SAAS,OAAO;AAC7D,QAAM,YAAYC,8CAAuBC,uBAAAA,+BAA+B;AACxE,QAAM,CAAC,SAAS,UAAU,IAAIC,QAAAA,SAAS,KAAK;AAC5C,QAAM,OAAO,MAAM;AACjB,eAAW,KAAK;AAChB,WAAA,EAAS,MAAM,CAAC,UAAmB;AACjC,UAAI,EAAE,iBAAiBC,qCAA2B,OAAM;AACxD,iBAAW,IAAI;AAAA,IACjB,CAAC;AAAA,EACH;AACA,QAAM,YAAY,CAAC,UAA8C;AAC/D,QAAI,MAAM,QAAQ,WAAW,MAAM,YAAY,MAAM,YAAY,YAAa;AAC9E,UAAM,eAAA;AACN,SAAA;AAAA,EACF;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,IAEX,WAAW,CAAC,aACXF,2BAAAA,IAAC,KAAA,EAAE,MAAK,UAAS,eAAY,0BAAyB,WAAU,iCAC7D,UAAAG,WAAAA,uBAAA,CACH;AAAA,IAEFF,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;AAAA,UACT,WAAU;AAAA,UACX,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAED,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type FC } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* Rendered in place of a user message while it is being edited (entered via
|
|
4
4
|
* the action bar's Edit control, which seeds this composer with the message
|
|
@@ -6,6 +6,8 @@ import type { FC } from "react";
|
|
|
6
6
|
* the message (`useDeepAgentMessageEditSubmit`) — on a windowed wire the
|
|
7
7
|
* lane's `anchorBefore` at the window edge — so the rewind is never rejected
|
|
8
8
|
* `wrong-anchor` the way the library's converted-message anchor is after a
|
|
9
|
-
* chunked assistant turn; Escape/Cancel exits edit mode.
|
|
9
|
+
* chunked assistant turn; Escape/Cancel exits edit mode. An edit submitted
|
|
10
|
+
* while the host's chat outbox says Athena can't be reached is refused: the
|
|
11
|
+
* draft stays here and the composer says why until Athena answers again.
|
|
10
12
|
*/
|
|
11
13
|
export declare const UserEditComposer: FC;
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useAuiState, ComposerPrimitive } from "@assistant-ui/react";
|
|
3
|
+
import { useState } from "react";
|
|
3
4
|
import { useDeepAgentMessageEditSubmit } from "../../agent-runtime/src/use-deep-agent-edit-submit.js";
|
|
5
|
+
import { useChatOutboxReachable, useDeepAgentChatOutboxContext } from "../../agent-runtime/src/use-deep-agent-chat-outbox.js";
|
|
6
|
+
import { CHAT_EDIT_KEPT_MESSAGE, ChatEditUnreachableError } from "../../agent-runtime/src/chat-outbox.js";
|
|
4
7
|
const UserEditComposer = () => {
|
|
5
8
|
const submit = useDeepAgentMessageEditSubmit();
|
|
6
9
|
const isEmpty = useAuiState((s) => s.message.composer.isEmpty);
|
|
10
|
+
const reachable = useChatOutboxReachable(useDeepAgentChatOutboxContext());
|
|
11
|
+
const [refused, setRefused] = useState(false);
|
|
12
|
+
const send = () => {
|
|
13
|
+
setRefused(false);
|
|
14
|
+
submit().catch((error) => {
|
|
15
|
+
if (!(error instanceof ChatEditUnreachableError)) throw error;
|
|
16
|
+
setRefused(true);
|
|
17
|
+
});
|
|
18
|
+
};
|
|
7
19
|
const onKeyDown = (event) => {
|
|
8
20
|
if (event.key !== "Enter" || event.shiftKey || event.nativeEvent.isComposing) return;
|
|
9
21
|
event.preventDefault();
|
|
10
|
-
|
|
22
|
+
send();
|
|
11
23
|
};
|
|
12
24
|
return /* @__PURE__ */ jsx("div", { className: "mb-3 flex justify-end", "data-testid": "chat-user-edit-composer", children: /* @__PURE__ */ jsxs(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", children: [
|
|
13
25
|
/* @__PURE__ */ jsx(
|
|
@@ -19,6 +31,7 @@ const UserEditComposer = () => {
|
|
|
19
31
|
className: "w-full resize-none bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground"
|
|
20
32
|
}
|
|
21
33
|
),
|
|
34
|
+
refused && !reachable && /* @__PURE__ */ jsx("p", { role: "status", "data-testid": "chat-user-edit-refused", className: "text-xs text-muted-foreground", children: CHAT_EDIT_KEPT_MESSAGE }),
|
|
22
35
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-1.5", children: [
|
|
23
36
|
/* @__PURE__ */ jsx(ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
24
37
|
"button",
|
|
@@ -34,7 +47,7 @@ const UserEditComposer = () => {
|
|
|
34
47
|
type: "button",
|
|
35
48
|
"data-testid": "chat-user-edit-send",
|
|
36
49
|
disabled: isEmpty,
|
|
37
|
-
onClick:
|
|
50
|
+
onClick: send,
|
|
38
51
|
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",
|
|
39
52
|
children: "Send"
|
|
40
53
|
}
|
|
@@ -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 {
|
|
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 {\n CHAT_EDIT_KEPT_MESSAGE,\n ChatEditUnreachableError,\n useChatOutboxReachable,\n useDeepAgentChatOutboxContext,\n useDeepAgentMessageEditSubmit,\n} from \"@athenaintel/agent-runtime\";\nimport { type FC, type KeyboardEvent, useState } 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. An edit submitted\n * while the host's chat outbox says Athena can't be reached is refused: the\n * draft stays here and the composer says why until Athena answers again.\n */\nexport const UserEditComposer: FC = () => {\n const submit = useDeepAgentMessageEditSubmit();\n const isEmpty = useAuiState((s) => s.message.composer.isEmpty);\n const reachable = useChatOutboxReachable(useDeepAgentChatOutboxContext());\n const [refused, setRefused] = useState(false);\n const send = () => {\n setRefused(false);\n submit().catch((error: unknown) => {\n if (!(error instanceof ChatEditUnreachableError)) throw error;\n setRefused(true);\n });\n };\n const onKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key !== \"Enter\" || event.shiftKey || event.nativeEvent.isComposing) return;\n event.preventDefault();\n send();\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 {refused && !reachable && (\n <p role=\"status\" data-testid=\"chat-user-edit-refused\" className=\"text-xs text-muted-foreground\">\n {CHAT_EDIT_KEPT_MESSAGE}\n </p>\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={send}\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":";;;;;;AAqBO,MAAM,mBAAuB,MAAM;AACxC,QAAM,SAAS,8BAAA;AACf,QAAM,UAAU,YAAY,CAAC,MAAM,EAAE,QAAQ,SAAS,OAAO;AAC7D,QAAM,YAAY,uBAAuB,+BAA+B;AACxE,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,OAAO,MAAM;AACjB,eAAW,KAAK;AAChB,WAAA,EAAS,MAAM,CAAC,UAAmB;AACjC,UAAI,EAAE,iBAAiB,0BAA2B,OAAM;AACxD,iBAAW,IAAI;AAAA,IACjB,CAAC;AAAA,EACH;AACA,QAAM,YAAY,CAAC,UAA8C;AAC/D,QAAI,MAAM,QAAQ,WAAW,MAAM,YAAY,MAAM,YAAY,YAAa;AAC9E,UAAM,eAAA;AACN,SAAA;AAAA,EACF;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,IAEX,WAAW,CAAC,aACX,oBAAC,KAAA,EAAE,MAAK,UAAS,eAAY,0BAAyB,WAAU,iCAC7D,UAAA,uBAAA,CACH;AAAA,IAEF,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;AAAA,UACT,WAAU;AAAA,UACX,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAED,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type GithubWakeEvent, type SubscriptionWakeEvent } from "
|
|
1
|
+
import { type GithubWakeEvent, type SubscriptionWakeEvent } from "../../agent-runtime/src/index";
|
|
2
2
|
import { type ComponentPropsWithoutRef, type FC } from "react";
|
|
3
3
|
export interface WakeMarkerCardProps extends Omit<ComponentPropsWithoutRef<"div">, "children" | "role"> {
|
|
4
4
|
event: GithubWakeEvent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-text-schema.cjs","sources":["../../../src/chat-ui/rich-text/chat-text-schema.tsx"],"sourcesContent":["import { Editor, Extension, type Extensions } from \"@tiptap/core\";\nimport { DOMParser as ProseMirrorDOMParser } from \"@tiptap/pm/model\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport CodeBlock from \"@tiptap/extension-code-block\";\nimport { ReactNodeViewRenderer } from \"@tiptap/react\";\nimport Link from \"@tiptap/extension-link\";\nimport Image from \"@tiptap/extension-image\";\nimport { Table, TableCell, TableHeader, TableRow } from \"@tiptap/extension-table\";\nimport TaskList from \"@tiptap/extension-task-list\";\nimport TaskItem from \"@tiptap/extension-task-item\";\nimport { markdownTableStorage } from \"@athenaintel/tiptap-markdown-table\";\nimport { Markdown } from \"tiptap-markdown\";\nimport { getMarkdownStorage } from \"../markdown-storage\";\nimport { MentionExtension } from \"../mentions/mention-extension\";\nimport { ChatCodeBlockNodeView, ChatMentionNodeView } from \"./chat-node-views\";\nimport { isAllowedChatHref, normalizeCitationAnchors } from \"./citation-anchors\";\n\nconst ChatMentionExtension = MentionExtension.extend({\n addNodeView: () => ReactNodeViewRenderer(ChatMentionNodeView, { as: \"span\" }),\n});\n/** Fenced code rendered through `ChatCodeBlock` (language label + copy button). */\nexport const ChatCodeBlockExtension = CodeBlock.extend({\n addNodeView: () => ReactNodeViewRenderer(ChatCodeBlockNodeView),\n});\n\n/**\n * The table node, written to Markdown through the table writer Olympus's\n * editors share (`@athenaintel/tiptap-markdown-table`), which escapes a `|`\n * inside a cell as `\\|`, so a draft's table reaches the message with the cells\n * it was typed with.\n */\nexport const ChatTableExtension = Table.extend({\n addStorage() {\n return { ...this.parent?.(), ...markdownTableStorage() };\n },\n});\n\n/**\n * The Link mark with the excerpt a citation carries (`data-excerpt`, the\n * source chip's tooltip and scroll-to-text target) and an href allow-list\n * narrower than tiptap's default: `http(s):`, `mailto:`, the screen-point\n * protocol and app-relative Spaces paths pass; every other scheme\n * (`javascript:`, `ftp:`, `data:`, protocol-relative `//host`) is dropped and\n * its label kept as text. The same rule governs the composer's autolink.\n */\nexport const ChatLinkExtension = Link.extend({\n addAttributes() {\n return {\n ...this.parent?.(),\n excerpt: {\n default: null,\n parseHTML: (element: HTMLElement) => element.getAttribute(\"data-excerpt\"),\n renderHTML: (attributes: Record<string, unknown>) =>\n typeof attributes.excerpt === \"string\" && attributes.excerpt\n ? { \"data-excerpt\": attributes.excerpt }\n : {},\n },\n };\n },\n});\n\n/** Both the editable draft and the static message body use this schema and parser. */\nexport function createChatTextExtensions(): Extensions {\n return [\n StarterKit.configure({\n codeBlock: false,\n // Tiptap 3 StarterKit also bundles these; chat text registers its own link and never had the rest.\n link: false,\n underline: false,\n listKeymap: false,\n trailingNode: false,\n }),\n ChatCodeBlockExtension,\n ChatLinkExtension.configure({\n openOnClick: false,\n autolink: true,\n linkOnPaste: true,\n // No `protocols`: Tiptap's Link registers them with linkifyjs in every\n // editor's onCreate, and linkifyjs accepts a scheme only before its first\n // scan — so each chat body or composer created after the first one logged\n // \"linkifyjs: already initialized\" (seen in Chrome's extension Errors\n // page). Screen points arrive as markdown links (`[label](athena-point://…)`),\n // which parse without linkify, and `isAllowedChatHref` already admits\n // the scheme; only autolinking a bare `athena-point://` string needed it.\n isAllowedUri: (url) => isAllowedChatHref(url),\n }),\n Image.configure({ inline: true }),\n ChatTableExtension.configure({ resizable: false }),\n TableRow,\n TableCell,\n TableHeader,\n TaskList,\n TaskItem.configure({ nested: true }),\n Markdown.configure({\n html: true,\n tightLists: true,\n tightListClass: \"tight\",\n bulletListMarker: \"-\",\n linkify: true,\n breaks: true,\n transformPastedText: true,\n transformCopiedText: false,\n }),\n ChatMentionExtension,\n ];\n}\n\n/** The slice of a markdown-it token {@link TypedTextReading} rewrites. */\ninterface MarkdownToken {\n type: string;\n tag: string;\n nesting: number;\n markup: string;\n content: string;\n children: MarkdownToken[] | null;\n}\n\n/** The slice of markdown-it (the instance tiptap-markdown parses with) {@link TypedTextReading} configures. */\ninterface MarkdownIt {\n disable(rules: string | string[], ignoreInvalid?: boolean): unknown;\n core: {\n ruler: {\n after(\n afterName: string,\n ruleName: string,\n rule: (state: { tokens: MarkdownToken[] }) => void,\n ): void;\n };\n };\n}\n\n/** A line break tag: the one piece of HTML a composer writes, for a line break inside a table cell. */\nconst LINE_BREAK_TAG = /^<br\\s*\\/?>$/i;\n\n/**\n * The inline token a typed reading shows as the characters it was written\n * with. Raw HTML counts only when it is in the text itself (`source`, the\n * inline block's own content): a task list's checkbox is HTML markdown-it's\n * task-list rule makes, not text anyone typed.\n */\nfunction isTypedCharacters(token: MarkdownToken, source: string, inTable: boolean): boolean {\n if (token.type === \"html_inline\") {\n return (\n source.includes(token.content) && !(inTable && LINE_BREAK_TAG.test(token.content.trim()))\n );\n }\n return (\n (token.type === \"em_open\" ||\n token.type === \"em_close\" ||\n token.type === \"strong_open\" ||\n token.type === \"strong_close\") &&\n token.markup.startsWith(\"_\")\n );\n}\n\nconst typedReadingInstalled = new WeakSet<object>();\n\nfunction installTypedTextReading(markdownit: MarkdownIt): void {\n if (typedReadingInstalled.has(markdownit)) return;\n typedReadingInstalled.add(markdownit);\n markdownit.disable(\"html_block\");\n markdownit.core.ruler.after(\"inline\", \"athena_typed_text\", (state) => {\n let tables = 0;\n for (const block of state.tokens) {\n if (block.type === \"table_open\") tables += 1;\n if (block.type === \"table_close\") tables -= 1;\n for (const token of block.children ?? []) {\n if (!isTypedCharacters(token, block.content, tables > 0)) continue;\n if (token.type !== \"html_inline\") token.content = token.markup;\n token.type = \"text\";\n token.tag = \"\";\n token.nesting = 0;\n }\n }\n });\n}\n\n/**\n * How a person's typed text reads in the user bubble: the chat's Markdown,\n * except for the two readings no composer send relies on and plain text often\n * trips. Raw HTML stays the characters it was typed with (`List<T>` keeps its\n * `<T>`, `a <b>c</b>` is not bold): a composer writes a typed `<` as `<`,\n * and its only tag is a `<br>` for a line break inside a table cell, which a\n * table cell still reads as one. Underscore emphasis stays underscores\n * (`obj.__init__` keeps them, `_private_` is not italic): a composer writes\n * emphasis with `*` and escapes a typed `_`. Everything a composer does write\n * (bold, lists, code, links, mention chips, tables, and the escaped Markdown\n * of older sends) reads as the assistant's reading reads it.\n */\nconst TypedTextReading = Extension.create({\n name: \"athenaTypedTextReading\",\n addStorage() {\n return {\n markdown: {\n parse: {\n setup: (markdownit: MarkdownIt) => installTypedTextReading(markdownit),\n },\n },\n };\n },\n});\n\nlet parserEditor: Editor | undefined;\nlet typedParserEditor: Editor | undefined;\n\nfunction parseWith(editor: Editor, markdown: string) {\n const html: string = getMarkdownStorage(editor).parser.parse(markdown);\n const body = new window.DOMParser().parseFromString(html, \"text/html\").body;\n normalizeCitationAnchors(body);\n return ProseMirrorDOMParser.fromSchema(editor.schema).parse(body);\n}\n\n/**\n * A single detached parser per browser tab, never an editor per message.\n * Markdown → HTML (markdown-it, with bare URLs linkified and inline HTML kept)\n * → agora's citation anchors given their hrefs → the schema's document.\n */\nexport function parseChatText(markdown: string) {\n parserEditor ??= new Editor({\n extensions: createChatTextExtensions(),\n content: \"\",\n editable: false,\n });\n return parseWith(parserEditor, markdown);\n}\n\n/**\n * {@link parseChatText} for text a person typed (a user message): the same\n * schema and document, read with {@link TypedTextReading}.\n */\nexport function parseTypedChatText(markdown: string) {\n typedParserEditor ??= new Editor({\n extensions: [...createChatTextExtensions(), TypedTextReading],\n content: \"\",\n editable: false,\n });\n return parseWith(typedParserEditor, markdown);\n}\n\n/** Typography is shared; the composer supplies only its padding and scroll boundary. */\nexport const CHAT_TEXT_CLASS =\n \"aui-md prose prose-sm max-w-none min-w-0 break-words text-sm leading-snug text-foreground prose-p:my-1.5 prose-p:leading-snug prose-headings:mt-3 prose-headings:mb-1.5 prose-headings:font-semibold prose-h1:text-sm prose-h2:text-sm prose-h3:text-xs prose-ul:my-1.5 prose-ol:my-1.5 prose-li:my-0.5 prose-blockquote:border-l-2 prose-blockquote:border-border prose-blockquote:text-muted-foreground prose-code:rounded prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:text-xs prose-code:font-mono prose-code:before:content-none prose-code:after:content-none prose-pre:my-2 prose-pre:overflow-x-auto prose-pre:rounded-lg prose-pre:border prose-pre:border-border prose-pre:bg-muted/30 prose-pre:p-3 prose-a:text-primary prose-a:underline prose-a:decoration-primary/40 prose-a:underline-offset-2 hover:prose-a:decoration-primary prose-strong:font-semibold prose-hr:border-border [&>:first-child]:mt-0 [&>:last-child]:mb-0 [&_table]:block [&_table]:overflow-x-auto [&_td]:border [&_td]:border-border [&_td]:px-2 [&_th]:border [&_th]:border-border [&_th]:px-2 [&_ul[data-type=taskList]]:list-none [&_ul[data-type=taskList]]:pl-0 [&_li[data-type=taskItem]]:flex [&_li[data-type=taskItem]]:gap-2\";\n"],"names":["MentionExtension","ReactNodeViewRenderer","ChatMentionNodeView","ChatCodeBlockNodeView","Table","markdownTableStorage","isAllowedChatHref","TableRow","TableCell","TableHeader","Markdown","Extension","getMarkdownStorage","normalizeCitationAnchors","ProseMir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,MAAM,mBAAmBC,KAAAA,UAAU,OAAO;AAAA,EACxC,MAAM;AAAA,EACN,aAAa;AACX,WAAO;AAAA,MACL,UAAU;AAAA,QACR,OAAO;AAAA,UACL,OAAO,CAAC,eAA2B,wBAAwB,UAAU;AAAA,QAAA;AAAA,MACvE;AAAA,IACF;AAAA,EAEJ;AACF,CAAC;AAED,IAAI;AACJ,IAAI;AAEJ,SAAS,UAAU,QAAgB,UAAkB;AACnD,QAAM,OAAeC,gBAAAA,mBAAmB,MAAM,EAAE,OAAO,MAAM,QAAQ;AACrE,QAAM,OAAO,IAAI,OAAO,UAAA,EAAY,gBAAgB,MAAM,WAAW,EAAE;AACvEC,kBAAAA,yBAAyB,IAAI;AAC7B,SAAOC,MAAAA,UAAqB,WAAW,OAAO,MAAM,EAAE,MAAM,IAAI;AAClE;AAOO,SAAS,cAAc,UAAkB;AAC9C,kCAAiB,IAAIC,KAAAA,OAAO;AAAA,IAC1B,YAAY,yBAAA;AAAA,IACZ,SAAS;AAAA,IACT,UAAU;AAAA,EAAA,CACX;AACD,SAAO,UAAU,cAAc,QAAQ;AACzC;AAMO,SAAS,mBAAmB,UAAkB;AACnD,4CAAsB,IAAIA,KAAAA,OAAO;AAAA,IAC/B,YAAY,CAAC,GAAG,yBAAA,GAA4B,gBAAgB;AAAA,IAC5D,SAAS;AAAA,IACT,UAAU;AAAA,EAAA,CACX;AACD,SAAO,UAAU,mBAAmB,QAAQ;AAC9C;AAGO,MAAM,kBACX;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"chat-text-schema.cjs","sources":["../../../src/chat-ui/rich-text/chat-text-schema.tsx"],"sourcesContent":["import { Editor, Extension, type Extensions } from \"@tiptap/core\";\nimport { DOMParser as ProseMirrorDOMParser } from \"@tiptap/pm/model\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport CodeBlock from \"@tiptap/extension-code-block\";\nimport { ReactNodeViewRenderer } from \"@tiptap/react\";\nimport Link from \"@tiptap/extension-link\";\nimport Image from \"@tiptap/extension-image\";\nimport { Table, TableCell, TableHeader, TableRow } from \"@tiptap/extension-table\";\nimport TaskList from \"@tiptap/extension-task-list\";\nimport TaskItem from \"@tiptap/extension-task-item\";\nimport { markdownTableStorage } from \"@athenaintel/tiptap-markdown-table\";\nimport { Markdown } from \"tiptap-markdown\";\nimport { getMarkdownStorage } from \"../markdown-storage\";\nimport { MentionExtension } from \"../mentions/mention-extension\";\nimport { ChatCodeBlockNodeView, ChatMentionNodeView } from \"./chat-node-views\";\nimport { isAllowedChatHref, normalizeCitationAnchors } from \"./citation-anchors\";\n\nconst ChatMentionExtension = MentionExtension.extend({\n addNodeView: () => ReactNodeViewRenderer(ChatMentionNodeView, { as: \"span\" }),\n});\n/** Fenced code rendered through `ChatCodeBlock` (language label + copy button). */\nexport const ChatCodeBlockExtension = CodeBlock.extend({\n addNodeView: () => ReactNodeViewRenderer(ChatCodeBlockNodeView),\n});\n\n/**\n * The table node, written to Markdown through the table writer Olympus's\n * editors share (`@athenaintel/tiptap-markdown-table`), which escapes a `|`\n * inside a cell as `\\|`, so a draft's table reaches the message with the cells\n * it was typed with.\n */\nexport const ChatTableExtension = Table.extend({\n addStorage() {\n return { ...this.parent?.(), ...markdownTableStorage() };\n },\n});\n\n/**\n * The Link mark with the excerpt a citation carries (`data-excerpt`, the\n * source chip's tooltip and scroll-to-text target) and an href allow-list\n * narrower than tiptap's default: `http(s):`, `mailto:`, the screen-point\n * protocol and app-relative Spaces paths pass; every other scheme\n * (`javascript:`, `ftp:`, `data:`, protocol-relative `//host`) is dropped and\n * its label kept as text. The same rule governs the composer's autolink.\n *\n * Not inclusive (Tiptap makes an autolinking Link inclusive), so text typed at\n * a link's end, like the space after a pasted URL, stays outside the link.\n */\nexport const ChatLinkExtension = Link.extend({\n inclusive: false,\n\n addAttributes() {\n return {\n ...this.parent?.(),\n excerpt: {\n default: null,\n parseHTML: (element: HTMLElement) => element.getAttribute(\"data-excerpt\"),\n renderHTML: (attributes: Record<string, unknown>) =>\n typeof attributes.excerpt === \"string\" && attributes.excerpt\n ? { \"data-excerpt\": attributes.excerpt }\n : {},\n },\n };\n },\n});\n\n/** Both the editable draft and the static message body use this schema and parser. */\nexport function createChatTextExtensions(): Extensions {\n return [\n StarterKit.configure({\n codeBlock: false,\n // Tiptap 3 StarterKit also bundles these; chat text registers its own link and never had the rest.\n link: false,\n underline: false,\n listKeymap: false,\n trailingNode: false,\n }),\n ChatCodeBlockExtension,\n ChatLinkExtension.configure({\n openOnClick: false,\n autolink: true,\n linkOnPaste: true,\n // No `protocols`: Tiptap's Link registers them with linkifyjs in every\n // editor's onCreate, and linkifyjs accepts a scheme only before its first\n // scan — so each chat body or composer created after the first one logged\n // \"linkifyjs: already initialized\" (seen in Chrome's extension Errors\n // page). Screen points arrive as markdown links (`[label](athena-point://…)`),\n // which parse without linkify, and `isAllowedChatHref` already admits\n // the scheme; only autolinking a bare `athena-point://` string needed it.\n isAllowedUri: (url) => isAllowedChatHref(url),\n }),\n Image.configure({ inline: true }),\n ChatTableExtension.configure({ resizable: false }),\n TableRow,\n TableCell,\n TableHeader,\n TaskList,\n TaskItem.configure({ nested: true }),\n Markdown.configure({\n html: true,\n tightLists: true,\n tightListClass: \"tight\",\n bulletListMarker: \"-\",\n linkify: true,\n breaks: true,\n transformPastedText: true,\n transformCopiedText: false,\n }),\n ChatMentionExtension,\n ];\n}\n\n/** The slice of a markdown-it token {@link TypedTextReading} rewrites. */\ninterface MarkdownToken {\n type: string;\n tag: string;\n nesting: number;\n markup: string;\n content: string;\n children: MarkdownToken[] | null;\n}\n\n/** The slice of markdown-it (the instance tiptap-markdown parses with) {@link TypedTextReading} configures. */\ninterface MarkdownIt {\n disable(rules: string | string[], ignoreInvalid?: boolean): unknown;\n core: {\n ruler: {\n after(\n afterName: string,\n ruleName: string,\n rule: (state: { tokens: MarkdownToken[] }) => void,\n ): void;\n };\n };\n}\n\n/** A line break tag: the one piece of HTML a composer writes, for a line break inside a table cell. */\nconst LINE_BREAK_TAG = /^<br\\s*\\/?>$/i;\n\n/**\n * The inline token a typed reading shows as the characters it was written\n * with. Raw HTML counts only when it is in the text itself (`source`, the\n * inline block's own content): a task list's checkbox is HTML markdown-it's\n * task-list rule makes, not text anyone typed.\n */\nfunction isTypedCharacters(token: MarkdownToken, source: string, inTable: boolean): boolean {\n if (token.type === \"html_inline\") {\n return (\n source.includes(token.content) && !(inTable && LINE_BREAK_TAG.test(token.content.trim()))\n );\n }\n return (\n (token.type === \"em_open\" ||\n token.type === \"em_close\" ||\n token.type === \"strong_open\" ||\n token.type === \"strong_close\") &&\n token.markup.startsWith(\"_\")\n );\n}\n\nconst typedReadingInstalled = new WeakSet<object>();\n\nfunction installTypedTextReading(markdownit: MarkdownIt): void {\n if (typedReadingInstalled.has(markdownit)) return;\n typedReadingInstalled.add(markdownit);\n markdownit.disable(\"html_block\");\n markdownit.core.ruler.after(\"inline\", \"athena_typed_text\", (state) => {\n let tables = 0;\n for (const block of state.tokens) {\n if (block.type === \"table_open\") tables += 1;\n if (block.type === \"table_close\") tables -= 1;\n for (const token of block.children ?? []) {\n if (!isTypedCharacters(token, block.content, tables > 0)) continue;\n if (token.type !== \"html_inline\") token.content = token.markup;\n token.type = \"text\";\n token.tag = \"\";\n token.nesting = 0;\n }\n }\n });\n}\n\n/**\n * How a person's typed text reads in the user bubble: the chat's Markdown,\n * except for the two readings no composer send relies on and plain text often\n * trips. Raw HTML stays the characters it was typed with (`List<T>` keeps its\n * `<T>`, `a <b>c</b>` is not bold): a composer writes a typed `<` as `<`,\n * and its only tag is a `<br>` for a line break inside a table cell, which a\n * table cell still reads as one. Underscore emphasis stays underscores\n * (`obj.__init__` keeps them, `_private_` is not italic): a composer writes\n * emphasis with `*` and escapes a typed `_`. Everything a composer does write\n * (bold, lists, code, links, mention chips, tables, and the escaped Markdown\n * of older sends) reads as the assistant's reading reads it.\n */\nconst TypedTextReading = Extension.create({\n name: \"athenaTypedTextReading\",\n addStorage() {\n return {\n markdown: {\n parse: {\n setup: (markdownit: MarkdownIt) => installTypedTextReading(markdownit),\n },\n },\n };\n },\n});\n\nlet parserEditor: Editor | undefined;\nlet typedParserEditor: Editor | undefined;\n\nfunction parseWith(editor: Editor, markdown: string) {\n const html: string = getMarkdownStorage(editor).parser.parse(markdown);\n const body = new window.DOMParser().parseFromString(html, \"text/html\").body;\n normalizeCitationAnchors(body);\n return ProseMirrorDOMParser.fromSchema(editor.schema).parse(body);\n}\n\n/**\n * A single detached parser per browser tab, never an editor per message.\n * Markdown → HTML (markdown-it, with bare URLs linkified and inline HTML kept)\n * → agora's citation anchors given their hrefs → the schema's document.\n */\nexport function parseChatText(markdown: string) {\n parserEditor ??= new Editor({\n extensions: createChatTextExtensions(),\n content: \"\",\n editable: false,\n });\n return parseWith(parserEditor, markdown);\n}\n\n/**\n * {@link parseChatText} for text a person typed (a user message): the same\n * schema and document, read with {@link TypedTextReading}.\n */\nexport function parseTypedChatText(markdown: string) {\n typedParserEditor ??= new Editor({\n extensions: [...createChatTextExtensions(), TypedTextReading],\n content: \"\",\n editable: false,\n });\n return parseWith(typedParserEditor, markdown);\n}\n\n/** Typography is shared; the composer supplies only its padding and scroll boundary. */\nexport const CHAT_TEXT_CLASS =\n \"aui-md prose prose-sm max-w-none min-w-0 break-words text-sm leading-snug text-foreground prose-p:my-1.5 prose-p:leading-snug prose-headings:mt-3 prose-headings:mb-1.5 prose-headings:font-semibold prose-h1:text-sm prose-h2:text-sm prose-h3:text-xs prose-ul:my-1.5 prose-ol:my-1.5 prose-li:my-0.5 prose-blockquote:border-l-2 prose-blockquote:border-border prose-blockquote:text-muted-foreground prose-code:rounded prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:text-xs prose-code:font-mono prose-code:before:content-none prose-code:after:content-none prose-pre:my-2 prose-pre:overflow-x-auto prose-pre:rounded-lg prose-pre:border prose-pre:border-border prose-pre:bg-muted/30 prose-pre:p-3 prose-a:text-primary prose-a:underline prose-a:decoration-primary/40 prose-a:underline-offset-2 hover:prose-a:decoration-primary prose-strong:font-semibold prose-hr:border-border [&>:first-child]:mt-0 [&>:last-child]:mb-0 [&_table]:block [&_table]:overflow-x-auto [&_td]:border [&_td]:border-border [&_td]:px-2 [&_th]:border [&_th]:border-border [&_th]:px-2 [&_ul[data-type=taskList]]:list-none [&_ul[data-type=taskList]]:pl-0 [&_li[data-type=taskItem]]:flex [&_li[data-type=taskItem]]:gap-2\";\n"],"names":["MentionExtension","ReactNodeViewRenderer","ChatMentionNodeView","ChatCodeBlockNodeView","Table","markdownTableStorage","isAllowedChatHref","TableRow","TableCell","TableHeader","Markdown","Extension","getMarkdownStorage","normalizeCitationAnchors","ProseMirrorDOMParser","Editor"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAM,uBAAuBA,iBAAAA,iBAAiB,OAAO;AAAA,EACnD,aAAa,MAAMC,MAAAA,sBAAsBC,cAAAA,qBAAqB,EAAE,IAAI,QAAQ;AAC9E,CAAC;AAEM,MAAM,yBAAyB,UAAU,OAAO;AAAA,EACrD,aAAa,MAAMD,MAAAA,sBAAsBE,cAAAA,qBAAqB;AAChE,CAAC;AAQM,MAAM,qBAAqBC,eAAAA,MAAM,OAAO;AAAA,EAC7C,aAAa;;AACX,WAAO,EAAE,IAAG,UAAK,WAAL,+BAAiB,GAAGC,wBAAAA,uBAAqB;AAAA,EACvD;AACF,CAAC;AAaM,MAAM,oBAAoB,KAAK,OAAO;AAAA,EAC3C,WAAW;AAAA,EAEX,gBAAgB;;AACd,WAAO;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,SAAS;AAAA,QACP,SAAS;AAAA,QACT,WAAW,CAAC,YAAyB,QAAQ,aAAa,cAAc;AAAA,QACxE,YAAY,CAAC,eACX,OAAO,WAAW,YAAY,YAAY,WAAW,UACjD,EAAE,gBAAgB,WAAW,QAAA,IAC7B,CAAA;AAAA,MAAC;AAAA,IACT;AAAA,EAEJ;AACF,CAAC;AAGM,SAAS,2BAAuC;AACrD,SAAO;AAAA,IACL,WAAW,UAAU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,SAAS;AAAA,IACT,UAAU;AAAA,EAAA,CACX;AACD,SAAO,UAAU,mBAAmB,QAAQ;AAC9C;AAGO,MAAM,kBACX;;;;;;;;"}
|
|
@@ -15,6 +15,9 @@ export declare const ChatTableExtension: import("@tiptap/core").Node<import("@ti
|
|
|
15
15
|
* protocol and app-relative Spaces paths pass; every other scheme
|
|
16
16
|
* (`javascript:`, `ftp:`, `data:`, protocol-relative `//host`) is dropped and
|
|
17
17
|
* its label kept as text. The same rule governs the composer's autolink.
|
|
18
|
+
*
|
|
19
|
+
* Not inclusive (Tiptap makes an autolinking Link inclusive), so text typed at
|
|
20
|
+
* a link's end, like the space after a pasted URL, stays outside the link.
|
|
18
21
|
*/
|
|
19
22
|
export declare const ChatLinkExtension: import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any>;
|
|
20
23
|
/** Both the editable draft and the static message body use this schema and parser. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-text-schema.js","sources":["../../../src/chat-ui/rich-text/chat-text-schema.tsx"],"sourcesContent":["import { Editor, Extension, type Extensions } from \"@tiptap/core\";\nimport { DOMParser as ProseMirrorDOMParser } from \"@tiptap/pm/model\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport CodeBlock from \"@tiptap/extension-code-block\";\nimport { ReactNodeViewRenderer } from \"@tiptap/react\";\nimport Link from \"@tiptap/extension-link\";\nimport Image from \"@tiptap/extension-image\";\nimport { Table, TableCell, TableHeader, TableRow } from \"@tiptap/extension-table\";\nimport TaskList from \"@tiptap/extension-task-list\";\nimport TaskItem from \"@tiptap/extension-task-item\";\nimport { markdownTableStorage } from \"@athenaintel/tiptap-markdown-table\";\nimport { Markdown } from \"tiptap-markdown\";\nimport { getMarkdownStorage } from \"../markdown-storage\";\nimport { MentionExtension } from \"../mentions/mention-extension\";\nimport { ChatCodeBlockNodeView, ChatMentionNodeView } from \"./chat-node-views\";\nimport { isAllowedChatHref, normalizeCitationAnchors } from \"./citation-anchors\";\n\nconst ChatMentionExtension = MentionExtension.extend({\n addNodeView: () => ReactNodeViewRenderer(ChatMentionNodeView, { as: \"span\" }),\n});\n/** Fenced code rendered through `ChatCodeBlock` (language label + copy button). */\nexport const ChatCodeBlockExtension = CodeBlock.extend({\n addNodeView: () => ReactNodeViewRenderer(ChatCodeBlockNodeView),\n});\n\n/**\n * The table node, written to Markdown through the table writer Olympus's\n * editors share (`@athenaintel/tiptap-markdown-table`), which escapes a `|`\n * inside a cell as `\\|`, so a draft's table reaches the message with the cells\n * it was typed with.\n */\nexport const ChatTableExtension = Table.extend({\n addStorage() {\n return { ...this.parent?.(), ...markdownTableStorage() };\n },\n});\n\n/**\n * The Link mark with the excerpt a citation carries (`data-excerpt`, the\n * source chip's tooltip and scroll-to-text target) and an href allow-list\n * narrower than tiptap's default: `http(s):`, `mailto:`, the screen-point\n * protocol and app-relative Spaces paths pass; every other scheme\n * (`javascript:`, `ftp:`, `data:`, protocol-relative `//host`) is dropped and\n * its label kept as text. The same rule governs the composer's autolink.\n */\nexport const ChatLinkExtension = Link.extend({\n addAttributes() {\n return {\n ...this.parent?.(),\n excerpt: {\n default: null,\n parseHTML: (element: HTMLElement) => element.getAttribute(\"data-excerpt\"),\n renderHTML: (attributes: Record<string, unknown>) =>\n typeof attributes.excerpt === \"string\" && attributes.excerpt\n ? { \"data-excerpt\": attributes.excerpt }\n : {},\n },\n };\n },\n});\n\n/** Both the editable draft and the static message body use this schema and parser. */\nexport function createChatTextExtensions(): Extensions {\n return [\n StarterKit.configure({\n codeBlock: false,\n // Tiptap 3 StarterKit also bundles these; chat text registers its own link and never had the rest.\n link: false,\n underline: false,\n listKeymap: false,\n trailingNode: false,\n }),\n ChatCodeBlockExtension,\n ChatLinkExtension.configure({\n openOnClick: false,\n autolink: true,\n linkOnPaste: true,\n // No `protocols`: Tiptap's Link registers them with linkifyjs in every\n // editor's onCreate, and linkifyjs accepts a scheme only before its first\n // scan — so each chat body or composer created after the first one logged\n // \"linkifyjs: already initialized\" (seen in Chrome's extension Errors\n // page). Screen points arrive as markdown links (`[label](athena-point://…)`),\n // which parse without linkify, and `isAllowedChatHref` already admits\n // the scheme; only autolinking a bare `athena-point://` string needed it.\n isAllowedUri: (url) => isAllowedChatHref(url),\n }),\n Image.configure({ inline: true }),\n ChatTableExtension.configure({ resizable: false }),\n TableRow,\n TableCell,\n TableHeader,\n TaskList,\n TaskItem.configure({ nested: true }),\n Markdown.configure({\n html: true,\n tightLists: true,\n tightListClass: \"tight\",\n bulletListMarker: \"-\",\n linkify: true,\n breaks: true,\n transformPastedText: true,\n transformCopiedText: false,\n }),\n ChatMentionExtension,\n ];\n}\n\n/** The slice of a markdown-it token {@link TypedTextReading} rewrites. */\ninterface MarkdownToken {\n type: string;\n tag: string;\n nesting: number;\n markup: string;\n content: string;\n children: MarkdownToken[] | null;\n}\n\n/** The slice of markdown-it (the instance tiptap-markdown parses with) {@link TypedTextReading} configures. */\ninterface MarkdownIt {\n disable(rules: string | string[], ignoreInvalid?: boolean): unknown;\n core: {\n ruler: {\n after(\n afterName: string,\n ruleName: string,\n rule: (state: { tokens: MarkdownToken[] }) => void,\n ): void;\n };\n };\n}\n\n/** A line break tag: the one piece of HTML a composer writes, for a line break inside a table cell. */\nconst LINE_BREAK_TAG = /^<br\\s*\\/?>$/i;\n\n/**\n * The inline token a typed reading shows as the characters it was written\n * with. Raw HTML counts only when it is in the text itself (`source`, the\n * inline block's own content): a task list's checkbox is HTML markdown-it's\n * task-list rule makes, not text anyone typed.\n */\nfunction isTypedCharacters(token: MarkdownToken, source: string, inTable: boolean): boolean {\n if (token.type === \"html_inline\") {\n return (\n source.includes(token.content) && !(inTable && LINE_BREAK_TAG.test(token.content.trim()))\n );\n }\n return (\n (token.type === \"em_open\" ||\n token.type === \"em_close\" ||\n token.type === \"strong_open\" ||\n token.type === \"strong_close\") &&\n token.markup.startsWith(\"_\")\n );\n}\n\nconst typedReadingInstalled = new WeakSet<object>();\n\nfunction installTypedTextReading(markdownit: MarkdownIt): void {\n if (typedReadingInstalled.has(markdownit)) return;\n typedReadingInstalled.add(markdownit);\n markdownit.disable(\"html_block\");\n markdownit.core.ruler.after(\"inline\", \"athena_typed_text\", (state) => {\n let tables = 0;\n for (const block of state.tokens) {\n if (block.type === \"table_open\") tables += 1;\n if (block.type === \"table_close\") tables -= 1;\n for (const token of block.children ?? []) {\n if (!isTypedCharacters(token, block.content, tables > 0)) continue;\n if (token.type !== \"html_inline\") token.content = token.markup;\n token.type = \"text\";\n token.tag = \"\";\n token.nesting = 0;\n }\n }\n });\n}\n\n/**\n * How a person's typed text reads in the user bubble: the chat's Markdown,\n * except for the two readings no composer send relies on and plain text often\n * trips. Raw HTML stays the characters it was typed with (`List<T>` keeps its\n * `<T>`, `a <b>c</b>` is not bold): a composer writes a typed `<` as `<`,\n * and its only tag is a `<br>` for a line break inside a table cell, which a\n * table cell still reads as one. Underscore emphasis stays underscores\n * (`obj.__init__` keeps them, `_private_` is not italic): a composer writes\n * emphasis with `*` and escapes a typed `_`. Everything a composer does write\n * (bold, lists, code, links, mention chips, tables, and the escaped Markdown\n * of older sends) reads as the assistant's reading reads it.\n */\nconst TypedTextReading = Extension.create({\n name: \"athenaTypedTextReading\",\n addStorage() {\n return {\n markdown: {\n parse: {\n setup: (markdownit: MarkdownIt) => installTypedTextReading(markdownit),\n },\n },\n };\n },\n});\n\nlet parserEditor: Editor | undefined;\nlet typedParserEditor: Editor | undefined;\n\nfunction parseWith(editor: Editor, markdown: string) {\n const html: string = getMarkdownStorage(editor).parser.parse(markdown);\n const body = new window.DOMParser().parseFromString(html, \"text/html\").body;\n normalizeCitationAnchors(body);\n return ProseMirrorDOMParser.fromSchema(editor.schema).parse(body);\n}\n\n/**\n * A single detached parser per browser tab, never an editor per message.\n * Markdown → HTML (markdown-it, with bare URLs linkified and inline HTML kept)\n * → agora's citation anchors given their hrefs → the schema's document.\n */\nexport function parseChatText(markdown: string) {\n parserEditor ??= new Editor({\n extensions: createChatTextExtensions(),\n content: \"\",\n editable: false,\n });\n return parseWith(parserEditor, markdown);\n}\n\n/**\n * {@link parseChatText} for text a person typed (a user message): the same\n * schema and document, read with {@link TypedTextReading}.\n */\nexport function parseTypedChatText(markdown: string) {\n typedParserEditor ??= new Editor({\n extensions: [...createChatTextExtensions(), TypedTextReading],\n content: \"\",\n editable: false,\n });\n return parseWith(typedParserEditor, markdown);\n}\n\n/** Typography is shared; the composer supplies only its padding and scroll boundary. */\nexport const CHAT_TEXT_CLASS =\n \"aui-md prose prose-sm max-w-none min-w-0 break-words text-sm leading-snug text-foreground prose-p:my-1.5 prose-p:leading-snug prose-headings:mt-3 prose-headings:mb-1.5 prose-headings:font-semibold prose-h1:text-sm prose-h2:text-sm prose-h3:text-xs prose-ul:my-1.5 prose-ol:my-1.5 prose-li:my-0.5 prose-blockquote:border-l-2 prose-blockquote:border-border prose-blockquote:text-muted-foreground prose-code:rounded prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:text-xs prose-code:font-mono prose-code:before:content-none prose-code:after:content-none prose-pre:my-2 prose-pre:overflow-x-auto prose-pre:rounded-lg prose-pre:border prose-pre:border-border prose-pre:bg-muted/30 prose-pre:p-3 prose-a:text-primary prose-a:underline prose-a:decoration-primary/40 prose-a:underline-offset-2 hover:prose-a:decoration-primary prose-strong:font-semibold prose-hr:border-border [&>:first-child]:mt-0 [&>:last-child]:mb-0 [&_table]:block [&_table]:overflow-x-auto [&_td]:border [&_td]:border-border [&_td]:px-2 [&_th]:border [&_th]:border-border [&_th]:px-2 [&_ul[data-type=taskList]]:list-none [&_ul[data-type=taskList]]:pl-0 [&_li[data-type=taskItem]]:flex [&_li[data-type=taskItem]]:gap-2\";\n"],"names":["ProseMirrorDOMParser"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAM,uBAAuB,iBAAiB,OAAO;AAAA,EACnD,aAAa,MAAM,sBAAsB,qBAAqB,EAAE,IAAI,QAAQ;AAC9E,CAAC;AAEM,MAAM,yBAAyB,UAAU,OAAO;AAAA,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,EAAE,OAAO,MAAM,QAAQ;AACrE,QAAM,OAAO,IAAI,OAAO,UAAA,EAAY,gBAAgB,MAAM,WAAW,EAAE;AACvE,2BAAyB,IAAI;AAC7B,SAAOA,UAAqB,WAAW,OAAO,MAAM,EAAE,MAAM,IAAI;AAClE;AAOO,SAAS,cAAc,UAAkB;AAC9C,kCAAiB,IAAI,OAAO;AAAA,IAC1B,YAAY,yBAAA;AAAA,IACZ,SAAS;AAAA,IACT,UAAU;AAAA,EAAA,CACX;AACD,SAAO,UAAU,cAAc,QAAQ;AACzC;AAMO,SAAS,mBAAmB,UAAkB;AACnD,4CAAsB,IAAI,OAAO;AAAA,IAC/B,YAAY,CAAC,GAAG,yBAAA,GAA4B,gBAAgB;AAAA,IAC5D,SAAS;AAAA,IACT,UAAU;AAAA,EAAA,CACX;AACD,SAAO,UAAU,mBAAmB,QAAQ;AAC9C;AAGO,MAAM,kBACX;"}
|
|
1
|
+
{"version":3,"file":"chat-text-schema.js","sources":["../../../src/chat-ui/rich-text/chat-text-schema.tsx"],"sourcesContent":["import { Editor, Extension, type Extensions } from \"@tiptap/core\";\nimport { DOMParser as ProseMirrorDOMParser } from \"@tiptap/pm/model\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport CodeBlock from \"@tiptap/extension-code-block\";\nimport { ReactNodeViewRenderer } from \"@tiptap/react\";\nimport Link from \"@tiptap/extension-link\";\nimport Image from \"@tiptap/extension-image\";\nimport { Table, TableCell, TableHeader, TableRow } from \"@tiptap/extension-table\";\nimport TaskList from \"@tiptap/extension-task-list\";\nimport TaskItem from \"@tiptap/extension-task-item\";\nimport { markdownTableStorage } from \"@athenaintel/tiptap-markdown-table\";\nimport { Markdown } from \"tiptap-markdown\";\nimport { getMarkdownStorage } from \"../markdown-storage\";\nimport { MentionExtension } from \"../mentions/mention-extension\";\nimport { ChatCodeBlockNodeView, ChatMentionNodeView } from \"./chat-node-views\";\nimport { isAllowedChatHref, normalizeCitationAnchors } from \"./citation-anchors\";\n\nconst ChatMentionExtension = MentionExtension.extend({\n addNodeView: () => ReactNodeViewRenderer(ChatMentionNodeView, { as: \"span\" }),\n});\n/** Fenced code rendered through `ChatCodeBlock` (language label + copy button). */\nexport const ChatCodeBlockExtension = CodeBlock.extend({\n addNodeView: () => ReactNodeViewRenderer(ChatCodeBlockNodeView),\n});\n\n/**\n * The table node, written to Markdown through the table writer Olympus's\n * editors share (`@athenaintel/tiptap-markdown-table`), which escapes a `|`\n * inside a cell as `\\|`, so a draft's table reaches the message with the cells\n * it was typed with.\n */\nexport const ChatTableExtension = Table.extend({\n addStorage() {\n return { ...this.parent?.(), ...markdownTableStorage() };\n },\n});\n\n/**\n * The Link mark with the excerpt a citation carries (`data-excerpt`, the\n * source chip's tooltip and scroll-to-text target) and an href allow-list\n * narrower than tiptap's default: `http(s):`, `mailto:`, the screen-point\n * protocol and app-relative Spaces paths pass; every other scheme\n * (`javascript:`, `ftp:`, `data:`, protocol-relative `//host`) is dropped and\n * its label kept as text. The same rule governs the composer's autolink.\n *\n * Not inclusive (Tiptap makes an autolinking Link inclusive), so text typed at\n * a link's end, like the space after a pasted URL, stays outside the link.\n */\nexport const ChatLinkExtension = Link.extend({\n inclusive: false,\n\n addAttributes() {\n return {\n ...this.parent?.(),\n excerpt: {\n default: null,\n parseHTML: (element: HTMLElement) => element.getAttribute(\"data-excerpt\"),\n renderHTML: (attributes: Record<string, unknown>) =>\n typeof attributes.excerpt === \"string\" && attributes.excerpt\n ? { \"data-excerpt\": attributes.excerpt }\n : {},\n },\n };\n },\n});\n\n/** Both the editable draft and the static message body use this schema and parser. */\nexport function createChatTextExtensions(): Extensions {\n return [\n StarterKit.configure({\n codeBlock: false,\n // Tiptap 3 StarterKit also bundles these; chat text registers its own link and never had the rest.\n link: false,\n underline: false,\n listKeymap: false,\n trailingNode: false,\n }),\n ChatCodeBlockExtension,\n ChatLinkExtension.configure({\n openOnClick: false,\n autolink: true,\n linkOnPaste: true,\n // No `protocols`: Tiptap's Link registers them with linkifyjs in every\n // editor's onCreate, and linkifyjs accepts a scheme only before its first\n // scan — so each chat body or composer created after the first one logged\n // \"linkifyjs: already initialized\" (seen in Chrome's extension Errors\n // page). Screen points arrive as markdown links (`[label](athena-point://…)`),\n // which parse without linkify, and `isAllowedChatHref` already admits\n // the scheme; only autolinking a bare `athena-point://` string needed it.\n isAllowedUri: (url) => isAllowedChatHref(url),\n }),\n Image.configure({ inline: true }),\n ChatTableExtension.configure({ resizable: false }),\n TableRow,\n TableCell,\n TableHeader,\n TaskList,\n TaskItem.configure({ nested: true }),\n Markdown.configure({\n html: true,\n tightLists: true,\n tightListClass: \"tight\",\n bulletListMarker: \"-\",\n linkify: true,\n breaks: true,\n transformPastedText: true,\n transformCopiedText: false,\n }),\n ChatMentionExtension,\n ];\n}\n\n/** The slice of a markdown-it token {@link TypedTextReading} rewrites. */\ninterface MarkdownToken {\n type: string;\n tag: string;\n nesting: number;\n markup: string;\n content: string;\n children: MarkdownToken[] | null;\n}\n\n/** The slice of markdown-it (the instance tiptap-markdown parses with) {@link TypedTextReading} configures. */\ninterface MarkdownIt {\n disable(rules: string | string[], ignoreInvalid?: boolean): unknown;\n core: {\n ruler: {\n after(\n afterName: string,\n ruleName: string,\n rule: (state: { tokens: MarkdownToken[] }) => void,\n ): void;\n };\n };\n}\n\n/** A line break tag: the one piece of HTML a composer writes, for a line break inside a table cell. */\nconst LINE_BREAK_TAG = /^<br\\s*\\/?>$/i;\n\n/**\n * The inline token a typed reading shows as the characters it was written\n * with. Raw HTML counts only when it is in the text itself (`source`, the\n * inline block's own content): a task list's checkbox is HTML markdown-it's\n * task-list rule makes, not text anyone typed.\n */\nfunction isTypedCharacters(token: MarkdownToken, source: string, inTable: boolean): boolean {\n if (token.type === \"html_inline\") {\n return (\n source.includes(token.content) && !(inTable && LINE_BREAK_TAG.test(token.content.trim()))\n );\n }\n return (\n (token.type === \"em_open\" ||\n token.type === \"em_close\" ||\n token.type === \"strong_open\" ||\n token.type === \"strong_close\") &&\n token.markup.startsWith(\"_\")\n );\n}\n\nconst typedReadingInstalled = new WeakSet<object>();\n\nfunction installTypedTextReading(markdownit: MarkdownIt): void {\n if (typedReadingInstalled.has(markdownit)) return;\n typedReadingInstalled.add(markdownit);\n markdownit.disable(\"html_block\");\n markdownit.core.ruler.after(\"inline\", \"athena_typed_text\", (state) => {\n let tables = 0;\n for (const block of state.tokens) {\n if (block.type === \"table_open\") tables += 1;\n if (block.type === \"table_close\") tables -= 1;\n for (const token of block.children ?? []) {\n if (!isTypedCharacters(token, block.content, tables > 0)) continue;\n if (token.type !== \"html_inline\") token.content = token.markup;\n token.type = \"text\";\n token.tag = \"\";\n token.nesting = 0;\n }\n }\n });\n}\n\n/**\n * How a person's typed text reads in the user bubble: the chat's Markdown,\n * except for the two readings no composer send relies on and plain text often\n * trips. Raw HTML stays the characters it was typed with (`List<T>` keeps its\n * `<T>`, `a <b>c</b>` is not bold): a composer writes a typed `<` as `<`,\n * and its only tag is a `<br>` for a line break inside a table cell, which a\n * table cell still reads as one. Underscore emphasis stays underscores\n * (`obj.__init__` keeps them, `_private_` is not italic): a composer writes\n * emphasis with `*` and escapes a typed `_`. Everything a composer does write\n * (bold, lists, code, links, mention chips, tables, and the escaped Markdown\n * of older sends) reads as the assistant's reading reads it.\n */\nconst TypedTextReading = Extension.create({\n name: \"athenaTypedTextReading\",\n addStorage() {\n return {\n markdown: {\n parse: {\n setup: (markdownit: MarkdownIt) => installTypedTextReading(markdownit),\n },\n },\n };\n },\n});\n\nlet parserEditor: Editor | undefined;\nlet typedParserEditor: Editor | undefined;\n\nfunction parseWith(editor: Editor, markdown: string) {\n const html: string = getMarkdownStorage(editor).parser.parse(markdown);\n const body = new window.DOMParser().parseFromString(html, \"text/html\").body;\n normalizeCitationAnchors(body);\n return ProseMirrorDOMParser.fromSchema(editor.schema).parse(body);\n}\n\n/**\n * A single detached parser per browser tab, never an editor per message.\n * Markdown → HTML (markdown-it, with bare URLs linkified and inline HTML kept)\n * → agora's citation anchors given their hrefs → the schema's document.\n */\nexport function parseChatText(markdown: string) {\n parserEditor ??= new Editor({\n extensions: createChatTextExtensions(),\n content: \"\",\n editable: false,\n });\n return parseWith(parserEditor, markdown);\n}\n\n/**\n * {@link parseChatText} for text a person typed (a user message): the same\n * schema and document, read with {@link TypedTextReading}.\n */\nexport function parseTypedChatText(markdown: string) {\n typedParserEditor ??= new Editor({\n extensions: [...createChatTextExtensions(), TypedTextReading],\n content: \"\",\n editable: false,\n });\n return parseWith(typedParserEditor, markdown);\n}\n\n/** Typography is shared; the composer supplies only its padding and scroll boundary. */\nexport const CHAT_TEXT_CLASS =\n \"aui-md prose prose-sm max-w-none min-w-0 break-words text-sm leading-snug text-foreground prose-p:my-1.5 prose-p:leading-snug prose-headings:mt-3 prose-headings:mb-1.5 prose-headings:font-semibold prose-h1:text-sm prose-h2:text-sm prose-h3:text-xs prose-ul:my-1.5 prose-ol:my-1.5 prose-li:my-0.5 prose-blockquote:border-l-2 prose-blockquote:border-border prose-blockquote:text-muted-foreground prose-code:rounded prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:text-xs prose-code:font-mono prose-code:before:content-none prose-code:after:content-none prose-pre:my-2 prose-pre:overflow-x-auto prose-pre:rounded-lg prose-pre:border prose-pre:border-border prose-pre:bg-muted/30 prose-pre:p-3 prose-a:text-primary prose-a:underline prose-a:decoration-primary/40 prose-a:underline-offset-2 hover:prose-a:decoration-primary prose-strong:font-semibold prose-hr:border-border [&>:first-child]:mt-0 [&>:last-child]:mb-0 [&_table]:block [&_table]:overflow-x-auto [&_td]:border [&_td]:border-border [&_td]:px-2 [&_th]:border [&_th]:border-border [&_th]:px-2 [&_ul[data-type=taskList]]:list-none [&_ul[data-type=taskList]]:pl-0 [&_li[data-type=taskItem]]:flex [&_li[data-type=taskItem]]:gap-2\";\n"],"names":["ProseMirrorDOMParser"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAM,uBAAuB,iBAAiB,OAAO;AAAA,EACnD,aAAa,MAAM,sBAA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;AACF,CAAC;AAED,IAAI;AACJ,IAAI;AAEJ,SAAS,UAAU,QAAgB,UAAkB;AACnD,QAAM,OAAe,mBAAmB,MAAM,EAAE,OAAO,MAAM,QAAQ;AACrE,QAAM,OAAO,IAAI,OAAO,UAAA,EAAY,gBAAgB,MAAM,WAAW,EAAE;AACvE,2BAAyB,IAAI;AAC7B,SAAOA,UAAqB,WAAW,OAAO,MAAM,EAAE,MAAM,IAAI;AAClE;AAOO,SAAS,cAAc,UAAkB;AAC9C,kCAAiB,IAAI,OAAO;AAAA,IAC1B,YAAY,yBAAA;AAAA,IACZ,SAAS;AAAA,IACT,UAAU;AAAA,EAAA,CACX;AACD,SAAO,UAAU,cAAc,QAAQ;AACzC;AAMO,SAAS,mBAAmB,UAAkB;AACnD,4CAAsB,IAAI,OAAO;AAAA,IAC/B,YAAY,CAAC,GAAG,yBAAA,GAA4B,gBAAgB;AAAA,IAC5D,SAAS;AAAA,IACT,UAAU;AAAA,EAAA,CACX;AACD,SAAO,UAAU,mBAAmB,QAAQ;AAC9C;AAGO,MAAM,kBACX;"}
|
|
@@ -14,6 +14,7 @@ const statewireContinueRun = require("./messages/statewire-continue-run.cjs");
|
|
|
14
14
|
const interrupts = require("../agent-runtime/src/interrupts.cjs");
|
|
15
15
|
exports.StatewireApprovalCard = StatewireApprovalCard.StatewireApprovalCard;
|
|
16
16
|
exports.useStatewireApprovalRequest = useStatewireApprovalRequest.useStatewireApprovalRequest;
|
|
17
|
+
exports.useStatewireApprovalWait = useStatewireApprovalRequest.useStatewireApprovalWait;
|
|
17
18
|
exports.RUN_START_REFUSAL_FALLBACK_MESSAGE = StatewireRunRefusalNotice.RUN_START_REFUSAL_FALLBACK_MESSAGE;
|
|
18
19
|
exports.StatewireRunRefusalNotice = StatewireRunRefusalNotice.StatewireRunRefusalNotice;
|
|
19
20
|
exports.StatewireQueuedMessages = StatewireQueuedMessages.StatewireQueuedMessages;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statewire.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"statewire.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* Published as the `@athenaintel/react/chat-ui/statewire` sub-path.
|
|
11
11
|
*/
|
|
12
12
|
export { StatewireApprovalCard, type StatewireApprovalCardProps, type StatewireApprovalEditorContext, type StatewireApprovalRequestContext, } from "../chat/StatewireApprovalCard";
|
|
13
|
-
export { type StatewireApprovalRequest, type StatewireInterruptPredicate, type UseStatewireApprovalRequestOptions, useStatewireApprovalRequest, } from "../chat/use-statewire-approval-request";
|
|
13
|
+
export { type StatewireApprovalRequest, type StatewireApprovalWait, type StatewireInterruptPredicate, type UseStatewireApprovalRequestOptions, useStatewireApprovalRequest, useStatewireApprovalWait, } from "../chat/use-statewire-approval-request";
|
|
14
14
|
export { RUN_START_REFUSAL_FALLBACK_MESSAGE, StatewireRunRefusalNotice, type StatewireRunRefusalNoticeProps, } from "../chat/StatewireRunRefusalNotice";
|
|
15
15
|
export { StatewireQueuedMessages, type StatewireQueueEditorContext, type StatewireQueueEvent, type StatewireQueueRowContentContext, type StatewireQueueRowMarkerContext, type StatewireQueuedMessagesProps, } from "../chat/StatewireQueuedMessages";
|
|
16
16
|
export { HistoryEdgeRow, type HistoryEdgeRowProps, StatewireHistoryEdge, type StatewireHistoryEdgeProps, } from "./thread/statewire-history-edge";
|
|
@@ -20,4 +20,4 @@ export { RuntimeMessageCard, type RuntimeMessageCardProps } from "./messages/run
|
|
|
20
20
|
export { WakeMarkerCard, type WakeMarkerCardProps, WakeMarkerMessage, } from "./messages/wake-marker";
|
|
21
21
|
export { WaitingOnYouBanner, type WaitingOnYouBannerProps, WaitingOnYouBannerView, type WaitingOnYouBannerViewProps, } from "../chat/WaitingOnYouBanner";
|
|
22
22
|
export { type ReadStatewireTailEnding, StatewireContinueRunAffordance, StatewireContinueRunButton, type StatewireContinueRunButtonProps, StatewireRunEndedFooter, type StatewireRunEndedFooterActionsContext, type StatewireRunEndedFooterProps, type StatewireTailEnding, } from "./messages/statewire-continue-run";
|
|
23
|
-
export { HITL_PENDING_RESUME_GRACE_MS } from "
|
|
23
|
+
export { HITL_PENDING_RESUME_GRACE_MS } from "../agent-runtime/src/index";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StatewireApprovalCard } from "../chat/StatewireApprovalCard.js";
|
|
2
|
-
import { useStatewireApprovalRequest } from "../chat/use-statewire-approval-request.js";
|
|
2
|
+
import { useStatewireApprovalRequest, useStatewireApprovalWait } from "../chat/use-statewire-approval-request.js";
|
|
3
3
|
import { RUN_START_REFUSAL_FALLBACK_MESSAGE, StatewireRunRefusalNotice } from "../chat/StatewireRunRefusalNotice.js";
|
|
4
4
|
import { StatewireQueuedMessages } from "../chat/StatewireQueuedMessages.js";
|
|
5
5
|
import { HistoryEdgeRow, StatewireHistoryEdge } from "./thread/statewire-history-edge.js";
|
|
@@ -29,6 +29,7 @@ export {
|
|
|
29
29
|
WakeMarkerCard,
|
|
30
30
|
WakeMarkerMessage,
|
|
31
31
|
useStatewireApprovalRequest,
|
|
32
|
+
useStatewireApprovalWait,
|
|
32
33
|
useStatewireToolOutputs
|
|
33
34
|
};
|
|
34
35
|
//# sourceMappingURL=statewire.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DeepAgentHistoryLoadEvent, type DeepAgentToolOutputStore } from "
|
|
1
|
+
import { type DeepAgentHistoryLoadEvent, type DeepAgentToolOutputStore } from "../../agent-runtime/src/index";
|
|
2
2
|
import type { FC } from "react";
|
|
3
3
|
/** The attribute `ChatThreadShell` stamps on the scroll viewport. */
|
|
4
4
|
export declare const THREAD_VIEWPORT_ATTR = "data-aui-thread-viewport";
|
|
@@ -7,7 +7,7 @@ const vanilla = require("zustand/vanilla");
|
|
|
7
7
|
const athenaUrls = require("../lib/athena-urls.cjs");
|
|
8
8
|
const AttachmentCtx = react.createContext(null);
|
|
9
9
|
function createAttachmentStore() {
|
|
10
|
-
return vanilla.createStore(() => ({ attachments: [], isUploading: false }));
|
|
10
|
+
return vanilla.createStore(() => ({ attachments: [], isUploading: false, notice: null }));
|
|
11
11
|
}
|
|
12
12
|
function AttachmentProvider({
|
|
13
13
|
children,
|
|
@@ -28,6 +28,7 @@ function StoreAttachmentProvider({
|
|
|
28
28
|
}) {
|
|
29
29
|
const attachments = zustand.useStore(store, (state) => state.attachments);
|
|
30
30
|
const isUploading = zustand.useStore(store, (state) => state.isUploading);
|
|
31
|
+
const notice = zustand.useStore(store, (state) => state.notice ?? null);
|
|
31
32
|
const actions = react.useMemo(
|
|
32
33
|
() => ({
|
|
33
34
|
addAttachments: (assets) => store.setState((state) => ({ attachments: [...state.attachments, ...assets] })),
|
|
@@ -35,13 +36,16 @@ function StoreAttachmentProvider({
|
|
|
35
36
|
attachments: state.attachments.filter((attachment) => attachment.id !== id)
|
|
36
37
|
})),
|
|
37
38
|
clearAttachments: () => store.setState({ attachments: [] }),
|
|
38
|
-
setIsUploading: (uploading) => store.setState({ isUploading: uploading })
|
|
39
|
+
setIsUploading: (uploading) => store.setState({ isUploading: uploading }),
|
|
40
|
+
setNotice: (next) => {
|
|
41
|
+
if ((store.getState().notice ?? null) !== next) store.setState({ notice: next });
|
|
42
|
+
}
|
|
39
43
|
}),
|
|
40
44
|
[store]
|
|
41
45
|
);
|
|
42
46
|
const value = react.useMemo(
|
|
43
|
-
() => ({ attachments, isUploading, ...actions }),
|
|
44
|
-
[attachments, isUploading, actions]
|
|
47
|
+
() => ({ attachments, isUploading, notice, ...actions }),
|
|
48
|
+
[attachments, isUploading, notice, actions]
|
|
45
49
|
);
|
|
46
50
|
return /* @__PURE__ */ jsxRuntime.jsx(AttachmentCtx.Provider, { value, children });
|
|
47
51
|
}
|