@agent-native/core 0.110.2 → 0.111.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +1 -1
- package/corpus/core/CHANGELOG.md +17 -0
- package/corpus/core/docs/content/components.mdx +7 -0
- package/corpus/core/docs/content/locales/ar-SA/components.mdx +4 -2
- package/corpus/core/docs/content/locales/de-DE/components.mdx +4 -2
- package/corpus/core/docs/content/locales/es-ES/components.mdx +4 -2
- package/corpus/core/docs/content/locales/fr-FR/components.mdx +4 -2
- package/corpus/core/docs/content/locales/hi-IN/components.mdx +3 -2
- package/corpus/core/docs/content/locales/ja-JP/components.mdx +3 -2
- package/corpus/core/docs/content/locales/ko-KR/components.mdx +3 -2
- package/corpus/core/docs/content/locales/pt-BR/components.mdx +4 -2
- package/corpus/core/docs/content/locales/zh-CN/components.mdx +3 -2
- package/corpus/core/docs/content/locales/zh-TW/components.mdx +3 -2
- package/corpus/core/docs/content/toolkit-agent-ux.mdx +8 -3
- package/corpus/core/migration-manifest.json +133 -269
- package/corpus/core/package.json +32 -33
- package/corpus/core/scripts/check-dist-imports.mjs +25 -1
- package/corpus/core/scripts/finalize-build.mjs +59 -2
- package/corpus/core/src/client/AgentAskPopover.tsx +1 -1
- package/corpus/core/src/client/AgentPanel.tsx +1 -1
- package/corpus/core/src/client/AssistantChat.tsx +12 -14
- package/corpus/core/src/client/NewWorkspaceAppFlow.tsx +1 -1
- package/corpus/core/src/client/agent-chat-adapter.ts +1 -1
- package/corpus/core/src/client/blocks/RegistryBlockDataProvider.tsx +121 -0
- package/corpus/core/src/client/blocks/index.ts +6 -0
- package/corpus/core/src/client/chat/attachment-adapters.ts +4 -5
- package/corpus/core/src/client/chat/index.ts +0 -1
- package/corpus/core/src/client/chat/message-components.tsx +2 -2
- package/corpus/core/src/client/code-agent-chat-adapter.ts +2 -2
- package/corpus/core/src/client/collab/index.ts +0 -22
- package/corpus/core/src/client/composer/index.ts +5 -66
- package/corpus/core/src/client/composer/runtime-adapters.tsx +123 -0
- package/corpus/core/src/client/composer/use-mention-search.ts +2 -79
- package/corpus/core/src/client/composer/wired-components.tsx +53 -0
- package/corpus/core/src/client/extensions/ExtensionViewer.tsx +1 -1
- package/corpus/core/src/client/extensions/ExtensionsListPage.tsx +1 -1
- package/corpus/core/src/client/extensions/ExtensionsSidebarSection.tsx +1 -1
- package/corpus/core/src/client/index.ts +0 -156
- package/corpus/core/src/client/resources/ResourceEditor.tsx +29 -681
- package/corpus/core/src/client/resources/ResourcesPanel.tsx +1 -1
- package/corpus/core/src/client/settings/AutomationsSection.tsx +1 -1
- package/corpus/core/src/client/sharing/index.ts +0 -4
- package/corpus/core/src/client/tombstone/agent-presence-chip.ts +17 -0
- package/corpus/core/src/client/tombstone/editor.ts +265 -0
- package/corpus/core/src/client/tombstone/live-cursor-overlay.ts +21 -0
- package/corpus/core/src/client/tombstone/presence-bar.ts +17 -0
- package/corpus/core/src/client/tombstone/recent-edit-highlights.ts +17 -0
- package/corpus/core/src/client/tombstone/remote-selection-rings.ts +21 -0
- package/corpus/core/src/client/tombstone/rich-markdown-editor.ts +265 -0
- package/corpus/core/src/client/tombstone/ui-dialog.ts +49 -0
- package/corpus/core/src/client/tombstone/ui-dropdown-menu.ts +69 -0
- package/corpus/core/src/client/tombstone/ui-hover-card.ts +21 -0
- package/corpus/core/src/client/tombstone/ui-popover.ts +25 -0
- package/corpus/core/src/client/tombstone/ui-sheet.ts +49 -0
- package/corpus/core/src/client/tombstone/ui-tooltip.ts +29 -0
- package/corpus/core/src/client/tombstone/visual-style-controls.ts +61 -0
- package/corpus/core/src/client/uploads/index.ts +5 -0
- package/corpus/core/src/client/{rich-markdown-editor/uploadEditorImage.ts → uploads/upload-editor-image.ts} +11 -4
- package/corpus/core/src/package-lifecycle/tombstone.ts +16 -2
- package/corpus/core/src/package-lifecycle/upgrade-error.ts +23 -5
- package/corpus/core/src/testing.ts +1 -4
- package/corpus/core/src/vite/client.ts +62 -22
- package/corpus/templates/content/app/components/editor/VisualEditor.tsx +2 -4
- package/corpus/templates/content/app/components/editor/extensions/registryBlocks.ts +1 -1
- package/corpus/templates/content/app/components/editor/registrySlashItems.ts +53 -52
- package/corpus/templates/plan/app/components/editor/PlanBlockNode.tsx +2 -2
- package/corpus/templates/plan/app/components/editor/planSlashCommands.ts +1 -1
- package/corpus/templates/plan/app/components/plan/DocumentArea.tsx +1 -1
- package/corpus/templates/plan/app/components/plan/PlanImageNode.tsx +1 -1
- package/corpus/templates/plan/app/components/plan/PlanMarkdownEditor.tsx +1 -1
- package/dist/catalog.json +1 -0
- package/dist/client/AgentAskPopover.js +1 -1
- package/dist/client/AgentAskPopover.js.map +1 -1
- package/dist/client/AgentPanel.js +1 -1
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +2 -2
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +5 -6
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/NewWorkspaceAppFlow.js +1 -1
- package/dist/client/NewWorkspaceAppFlow.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +1 -1
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/blocks/RegistryBlockDataProvider.d.ts +7 -0
- package/dist/client/blocks/RegistryBlockDataProvider.d.ts.map +1 -0
- package/dist/client/blocks/RegistryBlockDataProvider.js +54 -0
- package/dist/client/blocks/RegistryBlockDataProvider.js.map +1 -0
- package/dist/client/blocks/index.d.ts +2 -0
- package/dist/client/blocks/index.d.ts.map +1 -1
- package/dist/client/blocks/index.js +1 -0
- package/dist/client/blocks/index.js.map +1 -1
- package/dist/client/chat/attachment-adapters.d.ts.map +1 -1
- package/dist/client/chat/attachment-adapters.js +1 -1
- package/dist/client/chat/attachment-adapters.js.map +1 -1
- package/dist/client/chat/index.d.ts +0 -1
- package/dist/client/chat/index.d.ts.map +1 -1
- package/dist/client/chat/index.js +0 -1
- package/dist/client/chat/index.js.map +1 -1
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +2 -2
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/code-agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/code-agent-chat-adapter.js +1 -1
- package/dist/client/code-agent-chat-adapter.js.map +1 -1
- package/dist/client/collab/index.d.ts +0 -5
- package/dist/client/collab/index.d.ts.map +1 -1
- package/dist/client/collab/index.js +0 -5
- package/dist/client/collab/index.js.map +1 -1
- package/dist/client/composer/index.d.ts +3 -11
- package/dist/client/composer/index.d.ts.map +1 -1
- package/dist/client/composer/index.js +3 -10
- package/dist/client/composer/index.js.map +1 -1
- package/dist/client/composer/runtime-adapters.d.ts +5 -0
- package/dist/client/composer/runtime-adapters.d.ts.map +1 -0
- package/dist/client/composer/runtime-adapters.js +85 -0
- package/dist/client/composer/runtime-adapters.js.map +1 -0
- package/dist/client/composer/use-mention-search.d.ts +1 -2
- package/dist/client/composer/use-mention-search.d.ts.map +1 -1
- package/dist/client/composer/use-mention-search.js +2 -69
- package/dist/client/composer/use-mention-search.js.map +1 -1
- package/dist/client/composer/wired-components.d.ts +10 -0
- package/dist/client/composer/wired-components.d.ts.map +1 -0
- package/dist/client/composer/wired-components.js +20 -0
- package/dist/client/composer/wired-components.js.map +1 -0
- package/dist/client/extensions/ExtensionViewer.js +1 -1
- package/dist/client/extensions/ExtensionViewer.js.map +1 -1
- package/dist/client/extensions/ExtensionsListPage.js +1 -1
- package/dist/client/extensions/ExtensionsListPage.js.map +1 -1
- package/dist/client/extensions/ExtensionsSidebarSection.js +1 -1
- package/dist/client/extensions/ExtensionsSidebarSection.js.map +1 -1
- package/dist/client/index.d.ts +0 -10
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +0 -26
- package/dist/client/index.js.map +1 -1
- package/dist/client/resources/ResourceEditor.d.ts.map +1 -1
- package/dist/client/resources/ResourceEditor.js +14 -532
- package/dist/client/resources/ResourceEditor.js.map +1 -1
- package/dist/client/resources/ResourcesPanel.js +1 -1
- package/dist/client/resources/ResourcesPanel.js.map +1 -1
- package/dist/client/settings/AutomationsSection.js +1 -1
- package/dist/client/settings/AutomationsSection.js.map +1 -1
- package/dist/client/sharing/index.d.ts +0 -1
- package/dist/client/sharing/index.d.ts.map +1 -1
- package/dist/client/sharing/index.js +0 -1
- package/dist/client/sharing/index.js.map +1 -1
- package/dist/client/tombstone/agent-presence-chip.d.ts +6 -0
- package/dist/client/tombstone/agent-presence-chip.d.ts.map +1 -0
- package/dist/client/tombstone/agent-presence-chip.js +5 -0
- package/dist/client/tombstone/agent-presence-chip.js.map +1 -0
- package/dist/client/tombstone/editor.d.ts +128 -0
- package/dist/client/tombstone/editor.d.ts.map +1 -0
- package/dist/client/tombstone/editor.js +76 -0
- package/dist/client/tombstone/editor.js.map +1 -0
- package/dist/client/tombstone/live-cursor-overlay.d.ts +8 -0
- package/dist/client/tombstone/live-cursor-overlay.d.ts.map +1 -0
- package/dist/client/tombstone/live-cursor-overlay.js +5 -0
- package/dist/client/tombstone/live-cursor-overlay.js.map +1 -0
- package/dist/client/tombstone/presence-bar.d.ts +6 -0
- package/dist/client/tombstone/presence-bar.d.ts.map +1 -0
- package/dist/client/tombstone/presence-bar.js +5 -0
- package/dist/client/tombstone/presence-bar.js.map +1 -0
- package/dist/client/tombstone/recent-edit-highlights.d.ts +6 -0
- package/dist/client/tombstone/recent-edit-highlights.d.ts.map +1 -0
- package/dist/client/tombstone/recent-edit-highlights.js +5 -0
- package/dist/client/tombstone/recent-edit-highlights.js.map +1 -0
- package/dist/client/tombstone/remote-selection-rings.d.ts +8 -0
- package/dist/client/tombstone/remote-selection-rings.d.ts.map +1 -0
- package/dist/client/tombstone/remote-selection-rings.js +5 -0
- package/dist/client/tombstone/remote-selection-rings.js.map +1 -0
- package/dist/client/tombstone/rich-markdown-editor.d.ts +128 -0
- package/dist/client/tombstone/rich-markdown-editor.d.ts.map +1 -0
- package/dist/client/tombstone/rich-markdown-editor.js +76 -0
- package/dist/client/tombstone/rich-markdown-editor.js.map +1 -0
- package/dist/client/tombstone/ui-dialog.d.ts +22 -0
- package/dist/client/tombstone/ui-dialog.d.ts.map +1 -0
- package/dist/client/tombstone/ui-dialog.js +23 -0
- package/dist/client/tombstone/ui-dialog.js.map +1 -0
- package/dist/client/tombstone/ui-dropdown-menu.d.ts +32 -0
- package/dist/client/tombstone/ui-dropdown-menu.d.ts.map +1 -0
- package/dist/client/tombstone/ui-dropdown-menu.js +33 -0
- package/dist/client/tombstone/ui-dropdown-menu.js.map +1 -0
- package/dist/client/tombstone/ui-hover-card.d.ts +8 -0
- package/dist/client/tombstone/ui-hover-card.d.ts.map +1 -0
- package/dist/client/tombstone/ui-hover-card.js +9 -0
- package/dist/client/tombstone/ui-hover-card.js.map +1 -0
- package/dist/client/tombstone/ui-popover.d.ts +10 -0
- package/dist/client/tombstone/ui-popover.d.ts.map +1 -0
- package/dist/client/tombstone/ui-popover.js +11 -0
- package/dist/client/tombstone/ui-popover.js.map +1 -0
- package/dist/client/tombstone/ui-sheet.d.ts +22 -0
- package/dist/client/tombstone/ui-sheet.d.ts.map +1 -0
- package/dist/client/tombstone/ui-sheet.js +23 -0
- package/dist/client/tombstone/ui-sheet.js.map +1 -0
- package/dist/client/tombstone/ui-tooltip.d.ts +12 -0
- package/dist/client/tombstone/ui-tooltip.d.ts.map +1 -0
- package/dist/client/tombstone/ui-tooltip.js +13 -0
- package/dist/client/tombstone/ui-tooltip.js.map +1 -0
- package/dist/client/tombstone/visual-style-controls.d.ts +28 -0
- package/dist/client/tombstone/visual-style-controls.d.ts.map +1 -0
- package/dist/client/tombstone/visual-style-controls.js +23 -0
- package/dist/client/tombstone/visual-style-controls.js.map +1 -0
- package/dist/client/uploads/index.d.ts +1 -0
- package/dist/client/uploads/index.d.ts.map +1 -1
- package/dist/client/uploads/index.js +1 -0
- package/dist/client/uploads/index.js.map +1 -1
- package/dist/client/{rich-markdown-editor/uploadEditorImage.d.ts → uploads/upload-editor-image.d.ts} +8 -4
- package/dist/client/uploads/upload-editor-image.d.ts.map +1 -0
- package/dist/client/{rich-markdown-editor/uploadEditorImage.js → uploads/upload-editor-image.js} +2 -2
- package/dist/client/uploads/upload-editor-image.js.map +1 -0
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/package-lifecycle/tombstone.d.ts.map +1 -1
- package/dist/package-lifecycle/tombstone.js +13 -3
- package/dist/package-lifecycle/tombstone.js.map +1 -1
- package/dist/package-lifecycle/upgrade-error.d.ts +2 -2
- package/dist/package-lifecycle/upgrade-error.d.ts.map +1 -1
- package/dist/package-lifecycle/upgrade-error.js +8 -5
- package/dist/package-lifecycle/upgrade-error.js.map +1 -1
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/testing.d.ts +1 -3
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +1 -3
- package/dist/testing.js.map +1 -1
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +26 -22
- package/dist/vite/client.js.map +1 -1
- package/docs/content/components.mdx +7 -0
- package/docs/content/locales/ar-SA/components.mdx +4 -2
- package/docs/content/locales/de-DE/components.mdx +4 -2
- package/docs/content/locales/es-ES/components.mdx +4 -2
- package/docs/content/locales/fr-FR/components.mdx +4 -2
- package/docs/content/locales/hi-IN/components.mdx +3 -2
- package/docs/content/locales/ja-JP/components.mdx +3 -2
- package/docs/content/locales/ko-KR/components.mdx +3 -2
- package/docs/content/locales/pt-BR/components.mdx +4 -2
- package/docs/content/locales/zh-CN/components.mdx +3 -2
- package/docs/content/locales/zh-TW/components.mdx +3 -2
- package/docs/content/toolkit-agent-ux.mdx +8 -3
- package/migration-manifest.json +133 -269
- package/package.json +31 -32
- package/corpus/core/src/client/composer/AgentComposerFrame.tsx +0 -59
- package/corpus/core/src/client/composer/ComposerPlusMenu.tsx +0 -988
- package/corpus/core/src/client/composer/MentionPopover.tsx +0 -412
- package/corpus/core/src/client/composer/PastedTextChip.tsx +0 -150
- package/corpus/core/src/client/composer/PromptComposer.tsx +0 -714
- package/corpus/core/src/client/composer/RealtimeVoiceMode.tsx +0 -860
- package/corpus/core/src/client/composer/TiptapComposer.tsx +0 -2928
- package/corpus/core/src/client/composer/VoiceButton.tsx +0 -262
- package/corpus/core/src/client/composer/asset-picker-url.ts +0 -80
- package/corpus/core/src/client/composer/attachment-accept.ts +0 -71
- package/corpus/core/src/client/composer/draft-key.ts +0 -7
- package/corpus/core/src/client/composer/extensions/FileReference.tsx +0 -55
- package/corpus/core/src/client/composer/extensions/MentionReference.tsx +0 -93
- package/corpus/core/src/client/composer/extensions/SkillReference.tsx +0 -56
- package/corpus/core/src/client/composer/pasted-text.ts +0 -160
- package/corpus/core/src/client/composer/prompt-attachments.ts +0 -70
- package/corpus/core/src/client/composer/realtime-voice-audio-level.ts +0 -64
- package/corpus/core/src/client/composer/realtime-voice-transcript.ts +0 -134
- package/corpus/core/src/client/composer/types.ts +0 -66
- package/corpus/core/src/client/composer/use-file-search.ts +0 -63
- package/corpus/core/src/client/composer/use-skills.ts +0 -44
- package/corpus/core/src/client/composer/useRealtimeVoiceMode.tsx +0 -2095
- package/corpus/core/src/client/composer/useVoiceDictation.ts +0 -1155
- package/corpus/core/src/client/editor/index.ts +0 -1
- package/corpus/core/src/client/rich-markdown-editor/RegistryBlockNode.tsx +0 -799
- package/corpus/core/src/client/rich-markdown-editor/index.ts +0 -70
- package/corpus/core/src/client/rich-markdown-editor/registrySlashCommands.ts +0 -112
- package/dist/client/composer/AgentComposerFrame.d.ts +0 -19
- package/dist/client/composer/AgentComposerFrame.d.ts.map +0 -1
- package/dist/client/composer/AgentComposerFrame.js +0 -14
- package/dist/client/composer/AgentComposerFrame.js.map +0 -1
- package/dist/client/composer/ComposerPlusMenu.d.ts +0 -17
- package/dist/client/composer/ComposerPlusMenu.d.ts.map +0 -1
- package/dist/client/composer/ComposerPlusMenu.js +0 -501
- package/dist/client/composer/ComposerPlusMenu.js.map +0 -1
- package/dist/client/composer/MentionPopover.d.ts +0 -29
- package/dist/client/composer/MentionPopover.d.ts.map +0 -1
- package/dist/client/composer/MentionPopover.js +0 -180
- package/dist/client/composer/MentionPopover.js.map +0 -1
- package/dist/client/composer/PastedTextChip.d.ts +0 -9
- package/dist/client/composer/PastedTextChip.d.ts.map +0 -1
- package/dist/client/composer/PastedTextChip.js +0 -47
- package/dist/client/composer/PastedTextChip.js.map +0 -1
- package/dist/client/composer/PromptComposer.d.ts +0 -115
- package/dist/client/composer/PromptComposer.d.ts.map +0 -1
- package/dist/client/composer/PromptComposer.js +0 -299
- package/dist/client/composer/PromptComposer.js.map +0 -1
- package/dist/client/composer/RealtimeVoiceMode.d.ts +0 -104
- package/dist/client/composer/RealtimeVoiceMode.d.ts.map +0 -1
- package/dist/client/composer/RealtimeVoiceMode.js +0 -245
- package/dist/client/composer/RealtimeVoiceMode.js.map +0 -1
- package/dist/client/composer/TiptapComposer.d.ts +0 -222
- package/dist/client/composer/TiptapComposer.d.ts.map +0 -1
- package/dist/client/composer/TiptapComposer.js +0 -1834
- package/dist/client/composer/TiptapComposer.js.map +0 -1
- package/dist/client/composer/VoiceButton.d.ts +0 -23
- package/dist/client/composer/VoiceButton.d.ts.map +0 -1
- package/dist/client/composer/VoiceButton.js +0 -100
- package/dist/client/composer/VoiceButton.js.map +0 -1
- package/dist/client/composer/asset-picker-url.d.ts +0 -16
- package/dist/client/composer/asset-picker-url.d.ts.map +0 -1
- package/dist/client/composer/asset-picker-url.js +0 -64
- package/dist/client/composer/asset-picker-url.js.map +0 -1
- package/dist/client/composer/attachment-accept.d.ts +0 -9
- package/dist/client/composer/attachment-accept.d.ts.map +0 -1
- package/dist/client/composer/attachment-accept.js +0 -65
- package/dist/client/composer/attachment-accept.js.map +0 -1
- package/dist/client/composer/draft-key.d.ts +0 -2
- package/dist/client/composer/draft-key.d.ts.map +0 -1
- package/dist/client/composer/draft-key.js +0 -8
- package/dist/client/composer/draft-key.js.map +0 -1
- package/dist/client/composer/extensions/FileReference.d.ts +0 -3
- package/dist/client/composer/extensions/FileReference.d.ts.map +0 -1
- package/dist/client/composer/extensions/FileReference.js +0 -36
- package/dist/client/composer/extensions/FileReference.js.map +0 -1
- package/dist/client/composer/extensions/MentionReference.d.ts +0 -3
- package/dist/client/composer/extensions/MentionReference.d.ts.map +0 -1
- package/dist/client/composer/extensions/MentionReference.js +0 -66
- package/dist/client/composer/extensions/MentionReference.js.map +0 -1
- package/dist/client/composer/extensions/SkillReference.d.ts +0 -3
- package/dist/client/composer/extensions/SkillReference.d.ts.map +0 -1
- package/dist/client/composer/extensions/SkillReference.js +0 -40
- package/dist/client/composer/extensions/SkillReference.js.map +0 -1
- package/dist/client/composer/pasted-text.d.ts +0 -31
- package/dist/client/composer/pasted-text.d.ts.map +0 -1
- package/dist/client/composer/pasted-text.js +0 -130
- package/dist/client/composer/pasted-text.js.map +0 -1
- package/dist/client/composer/prompt-attachments.d.ts +0 -11
- package/dist/client/composer/prompt-attachments.d.ts.map +0 -1
- package/dist/client/composer/prompt-attachments.js +0 -45
- package/dist/client/composer/prompt-attachments.js.map +0 -1
- package/dist/client/composer/realtime-voice-audio-level.d.ts +0 -14
- package/dist/client/composer/realtime-voice-audio-level.d.ts.map +0 -1
- package/dist/client/composer/realtime-voice-audio-level.js +0 -47
- package/dist/client/composer/realtime-voice-audio-level.js.map +0 -1
- package/dist/client/composer/realtime-voice-transcript.d.ts +0 -26
- package/dist/client/composer/realtime-voice-transcript.d.ts.map +0 -1
- package/dist/client/composer/realtime-voice-transcript.js +0 -103
- package/dist/client/composer/realtime-voice-transcript.js.map +0 -1
- package/dist/client/composer/types.d.ts +0 -60
- package/dist/client/composer/types.d.ts.map +0 -1
- package/dist/client/composer/types.js +0 -2
- package/dist/client/composer/types.js.map +0 -1
- package/dist/client/composer/use-file-search.d.ts +0 -6
- package/dist/client/composer/use-file-search.d.ts.map +0 -1
- package/dist/client/composer/use-file-search.js +0 -52
- package/dist/client/composer/use-file-search.js.map +0 -1
- package/dist/client/composer/use-skills.d.ts +0 -7
- package/dist/client/composer/use-skills.d.ts.map +0 -1
- package/dist/client/composer/use-skills.js +0 -39
- package/dist/client/composer/use-skills.js.map +0 -1
- package/dist/client/composer/useRealtimeVoiceMode.d.ts +0 -172
- package/dist/client/composer/useRealtimeVoiceMode.d.ts.map +0 -1
- package/dist/client/composer/useRealtimeVoiceMode.js +0 -1648
- package/dist/client/composer/useRealtimeVoiceMode.js.map +0 -1
- package/dist/client/composer/useVoiceDictation.d.ts +0 -57
- package/dist/client/composer/useVoiceDictation.d.ts.map +0 -1
- package/dist/client/composer/useVoiceDictation.js +0 -975
- package/dist/client/composer/useVoiceDictation.js.map +0 -1
- package/dist/client/editor/index.d.ts +0 -2
- package/dist/client/editor/index.d.ts.map +0 -1
- package/dist/client/editor/index.js +0 -2
- package/dist/client/editor/index.js.map +0 -1
- package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts +0 -130
- package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/RegistryBlockNode.js +0 -426
- package/dist/client/rich-markdown-editor/RegistryBlockNode.js.map +0 -1
- package/dist/client/rich-markdown-editor/index.d.ts +0 -5
- package/dist/client/rich-markdown-editor/index.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/index.js +0 -5
- package/dist/client/rich-markdown-editor/index.js.map +0 -1
- package/dist/client/rich-markdown-editor/registrySlashCommands.d.ts +0 -60
- package/dist/client/rich-markdown-editor/registrySlashCommands.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/registrySlashCommands.js +0 -51
- package/dist/client/rich-markdown-editor/registrySlashCommands.js.map +0 -1
- package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/uploadEditorImage.js.map +0 -1
|
@@ -1,412 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IconFile,
|
|
3
|
-
IconFolder,
|
|
4
|
-
IconStack2,
|
|
5
|
-
IconFileText,
|
|
6
|
-
IconCheckbox,
|
|
7
|
-
IconMail,
|
|
8
|
-
IconUser,
|
|
9
|
-
IconPresentation,
|
|
10
|
-
IconMessageChatbot,
|
|
11
|
-
IconTrash,
|
|
12
|
-
IconPlus,
|
|
13
|
-
IconHelp,
|
|
14
|
-
IconHistory,
|
|
15
|
-
IconTerminal2,
|
|
16
|
-
IconClipboardList,
|
|
17
|
-
IconPencil,
|
|
18
|
-
} from "@tabler/icons-react";
|
|
19
|
-
import React, {
|
|
20
|
-
useState,
|
|
21
|
-
useEffect,
|
|
22
|
-
useRef,
|
|
23
|
-
useImperativeHandle,
|
|
24
|
-
forwardRef,
|
|
25
|
-
} from "react";
|
|
26
|
-
import { createPortal } from "react-dom";
|
|
27
|
-
|
|
28
|
-
import type { MentionItem, SkillResult, SlashCommand } from "./types.js";
|
|
29
|
-
|
|
30
|
-
export interface MentionPopoverRef {
|
|
31
|
-
moveUp: () => void;
|
|
32
|
-
moveDown: () => void;
|
|
33
|
-
getSelectedIndex: () => number;
|
|
34
|
-
getSelectedMention: () => MentionItem | null;
|
|
35
|
-
getSelectedCommand: () => SlashCommand | null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
interface MentionPopoverProps {
|
|
39
|
-
type: "@" | "/";
|
|
40
|
-
position: { top: number; left: number } | null;
|
|
41
|
-
mentionItems: MentionItem[];
|
|
42
|
-
skills: SkillResult[];
|
|
43
|
-
commands?: SlashCommand[];
|
|
44
|
-
hint?: string;
|
|
45
|
-
isLoading: boolean;
|
|
46
|
-
query: string;
|
|
47
|
-
onSelectMention: (item: MentionItem) => void;
|
|
48
|
-
onSelectSkill: (skill: SkillResult) => void;
|
|
49
|
-
onSelectCommand?: (command: SlashCommand) => void;
|
|
50
|
-
onClose: () => void;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const iconProps = { size: 14, className: "shrink-0 text-muted-foreground" };
|
|
54
|
-
|
|
55
|
-
function MentionItemIcon({ icon }: { icon?: string }) {
|
|
56
|
-
switch (icon) {
|
|
57
|
-
case "folder":
|
|
58
|
-
return <IconFolder {...iconProps} />;
|
|
59
|
-
case "document":
|
|
60
|
-
return <IconFileText {...iconProps} />;
|
|
61
|
-
case "form":
|
|
62
|
-
return <IconCheckbox {...iconProps} />;
|
|
63
|
-
case "email":
|
|
64
|
-
return <IconMail {...iconProps} />;
|
|
65
|
-
case "user":
|
|
66
|
-
return <IconUser {...iconProps} />;
|
|
67
|
-
case "deck":
|
|
68
|
-
return <IconPresentation {...iconProps} />;
|
|
69
|
-
case "agent":
|
|
70
|
-
return <IconMessageChatbot {...iconProps} />;
|
|
71
|
-
case "file":
|
|
72
|
-
return <IconFile {...iconProps} />;
|
|
73
|
-
default:
|
|
74
|
-
return <IconFile {...iconProps} />;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function CommandIcon({ icon }: { icon?: string }) {
|
|
79
|
-
switch (icon) {
|
|
80
|
-
case "clear":
|
|
81
|
-
return <IconTrash {...iconProps} />;
|
|
82
|
-
case "new":
|
|
83
|
-
return <IconPlus {...iconProps} />;
|
|
84
|
-
case "help":
|
|
85
|
-
return <IconHelp {...iconProps} />;
|
|
86
|
-
case "history":
|
|
87
|
-
return <IconHistory {...iconProps} />;
|
|
88
|
-
case "plan":
|
|
89
|
-
return <IconClipboardList {...iconProps} />;
|
|
90
|
-
case "act":
|
|
91
|
-
return <IconPencil {...iconProps} />;
|
|
92
|
-
default:
|
|
93
|
-
return <IconTerminal2 {...iconProps} />;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function HintWithLink({ hint }: { hint: string }) {
|
|
98
|
-
// If hint contains a URL, split it and render the URL as a link
|
|
99
|
-
const urlMatch = hint.match(/(https?:\/\/\S+)/);
|
|
100
|
-
if (!urlMatch) return <>{hint}</>;
|
|
101
|
-
const before = hint.slice(0, urlMatch.index);
|
|
102
|
-
const url = urlMatch[1];
|
|
103
|
-
return (
|
|
104
|
-
<>
|
|
105
|
-
{before}
|
|
106
|
-
<a
|
|
107
|
-
href={url}
|
|
108
|
-
target="_blank"
|
|
109
|
-
rel="noopener noreferrer"
|
|
110
|
-
className="underline hover:text-foreground"
|
|
111
|
-
>
|
|
112
|
-
Learn more
|
|
113
|
-
</a>
|
|
114
|
-
</>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function LoadingSkeleton() {
|
|
119
|
-
return (
|
|
120
|
-
<div className="space-y-1 p-1">
|
|
121
|
-
{[1, 2, 3].map((i) => (
|
|
122
|
-
<div key={i} className="flex items-center gap-2 rounded px-2 py-1.5">
|
|
123
|
-
<div className="h-3.5 w-3.5 rounded bg-muted animate-pulse" />
|
|
124
|
-
<div
|
|
125
|
-
className="h-3 rounded bg-muted animate-pulse"
|
|
126
|
-
style={{ width: `${60 + i * 20}px` }}
|
|
127
|
-
/>
|
|
128
|
-
</div>
|
|
129
|
-
))}
|
|
130
|
-
</div>
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function LoadingSkeletonRow() {
|
|
135
|
-
return (
|
|
136
|
-
<div className="flex items-center gap-2 rounded px-2 py-1.5">
|
|
137
|
-
<div className="h-3.5 w-3.5 rounded bg-muted animate-pulse" />
|
|
138
|
-
<div className="h-3 w-24 rounded bg-muted animate-pulse" />
|
|
139
|
-
</div>
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export const MentionPopover = forwardRef<
|
|
144
|
-
MentionPopoverRef,
|
|
145
|
-
MentionPopoverProps
|
|
146
|
-
>(function MentionPopover(props, ref) {
|
|
147
|
-
const {
|
|
148
|
-
type,
|
|
149
|
-
position,
|
|
150
|
-
mentionItems,
|
|
151
|
-
skills,
|
|
152
|
-
commands = [],
|
|
153
|
-
hint,
|
|
154
|
-
isLoading,
|
|
155
|
-
query,
|
|
156
|
-
onSelectMention,
|
|
157
|
-
onSelectSkill,
|
|
158
|
-
onSelectCommand,
|
|
159
|
-
onClose,
|
|
160
|
-
} = props;
|
|
161
|
-
|
|
162
|
-
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
163
|
-
const listRef = useRef<HTMLDivElement>(null);
|
|
164
|
-
|
|
165
|
-
const itemCount =
|
|
166
|
-
type === "@" ? mentionItems.length : commands.length + skills.length;
|
|
167
|
-
|
|
168
|
-
// Group mention items by section for @ popover
|
|
169
|
-
const groupedMentions = React.useMemo(() => {
|
|
170
|
-
if (type !== "@") return [];
|
|
171
|
-
const groups = new Map<string, MentionItem[]>();
|
|
172
|
-
for (const item of mentionItems) {
|
|
173
|
-
const section = item.section || "Other";
|
|
174
|
-
if (!groups.has(section)) groups.set(section, []);
|
|
175
|
-
groups.get(section)!.push(item);
|
|
176
|
-
}
|
|
177
|
-
// Sort: Agents first, then Connected Agents, then template-specific,
|
|
178
|
-
// then Files, then Other
|
|
179
|
-
const sorted: { section: string; items: MentionItem[] }[] = [];
|
|
180
|
-
const knownSections = new Set([
|
|
181
|
-
"Agents",
|
|
182
|
-
"Connected Agents",
|
|
183
|
-
"Files",
|
|
184
|
-
"Other",
|
|
185
|
-
]);
|
|
186
|
-
// Agents first
|
|
187
|
-
if (groups.has("Agents")) {
|
|
188
|
-
sorted.push({ section: "Agents", items: groups.get("Agents")! });
|
|
189
|
-
groups.delete("Agents");
|
|
190
|
-
}
|
|
191
|
-
if (groups.has("Connected Agents")) {
|
|
192
|
-
sorted.push({
|
|
193
|
-
section: "Connected Agents",
|
|
194
|
-
items: groups.get("Connected Agents")!,
|
|
195
|
-
});
|
|
196
|
-
groups.delete("Connected Agents");
|
|
197
|
-
}
|
|
198
|
-
// Template-specific sections (anything not in knownSections)
|
|
199
|
-
for (const [section, items] of groups) {
|
|
200
|
-
if (!knownSections.has(section)) {
|
|
201
|
-
sorted.push({ section, items });
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
// Files
|
|
205
|
-
if (groups.has("Files")) {
|
|
206
|
-
sorted.push({ section: "Files", items: groups.get("Files")! });
|
|
207
|
-
}
|
|
208
|
-
// Other
|
|
209
|
-
if (groups.has("Other")) {
|
|
210
|
-
sorted.push({ section: "Other", items: groups.get("Other")! });
|
|
211
|
-
}
|
|
212
|
-
return sorted;
|
|
213
|
-
}, [type, mentionItems]);
|
|
214
|
-
|
|
215
|
-
// Flat list of mention items in section order for keyboard index tracking
|
|
216
|
-
const flatMentionItems = React.useMemo(() => {
|
|
217
|
-
return groupedMentions.flatMap((g) => g.items);
|
|
218
|
-
}, [groupedMentions]);
|
|
219
|
-
|
|
220
|
-
// Reset selection when items change
|
|
221
|
-
useEffect(() => {
|
|
222
|
-
setSelectedIndex(0);
|
|
223
|
-
}, [commands, mentionItems, skills, query]);
|
|
224
|
-
|
|
225
|
-
// Scroll selected item into view
|
|
226
|
-
useEffect(() => {
|
|
227
|
-
const container = listRef.current;
|
|
228
|
-
if (!container) return;
|
|
229
|
-
// Find the actual item element by data attribute
|
|
230
|
-
const selected = container.querySelector(
|
|
231
|
-
`[data-mention-index="${selectedIndex}"]`,
|
|
232
|
-
) as HTMLElement | undefined;
|
|
233
|
-
if (selected) {
|
|
234
|
-
selected.scrollIntoView({ block: "nearest" });
|
|
235
|
-
}
|
|
236
|
-
}, [selectedIndex]);
|
|
237
|
-
|
|
238
|
-
useImperativeHandle(ref, () => ({
|
|
239
|
-
moveUp: () => {
|
|
240
|
-
setSelectedIndex((prev) =>
|
|
241
|
-
prev <= 0 ? Math.max(0, itemCount - 1) : prev - 1,
|
|
242
|
-
);
|
|
243
|
-
},
|
|
244
|
-
moveDown: () => {
|
|
245
|
-
setSelectedIndex((prev) => (prev >= itemCount - 1 ? 0 : prev + 1));
|
|
246
|
-
},
|
|
247
|
-
getSelectedIndex: () => selectedIndex,
|
|
248
|
-
getSelectedMention: () => flatMentionItems[selectedIndex] ?? null,
|
|
249
|
-
getSelectedCommand: () => {
|
|
250
|
-
if (type !== "/" || selectedIndex >= commands.length) return null;
|
|
251
|
-
return commands[selectedIndex] ?? null;
|
|
252
|
-
},
|
|
253
|
-
}));
|
|
254
|
-
|
|
255
|
-
if (!position) return null;
|
|
256
|
-
|
|
257
|
-
const content = (
|
|
258
|
-
<>
|
|
259
|
-
{/* Backdrop to capture outside clicks */}
|
|
260
|
-
<div className="fixed inset-0 z-[9998]" onClick={onClose} />
|
|
261
|
-
<div
|
|
262
|
-
data-agent-native-composer-popover="true"
|
|
263
|
-
className="fixed z-[9999] w-[320px] overflow-y-auto rounded-lg border border-border bg-popover shadow-lg"
|
|
264
|
-
style={{
|
|
265
|
-
bottom: `calc(100vh - ${position.top}px + 4px)`,
|
|
266
|
-
left: Math.max(8, Math.min(position.left, window.innerWidth - 336)),
|
|
267
|
-
maxHeight: Math.min(320, position.top - 8),
|
|
268
|
-
}}
|
|
269
|
-
>
|
|
270
|
-
{isLoading && itemCount === 0 ? (
|
|
271
|
-
<LoadingSkeleton />
|
|
272
|
-
) : itemCount === 0 ? (
|
|
273
|
-
<div className="px-3 py-4 text-center text-xs text-muted-foreground">
|
|
274
|
-
{type === "@" ? (
|
|
275
|
-
query ? (
|
|
276
|
-
"No results found"
|
|
277
|
-
) : (
|
|
278
|
-
"Type to search..."
|
|
279
|
-
)
|
|
280
|
-
) : hint ? (
|
|
281
|
-
<HintWithLink hint={hint} />
|
|
282
|
-
) : (
|
|
283
|
-
"No skills available"
|
|
284
|
-
)}
|
|
285
|
-
</div>
|
|
286
|
-
) : (
|
|
287
|
-
<div ref={listRef} className="p-1">
|
|
288
|
-
{isLoading && <LoadingSkeletonRow />}
|
|
289
|
-
{type === "@"
|
|
290
|
-
? (() => {
|
|
291
|
-
let flatIndex = 0;
|
|
292
|
-
return groupedMentions.map((group) => (
|
|
293
|
-
<div key={group.section}>
|
|
294
|
-
<div className="px-2 pt-2 pb-1 text-[10px] font-medium text-muted-foreground/70 uppercase tracking-wider">
|
|
295
|
-
{group.section}
|
|
296
|
-
</div>
|
|
297
|
-
{group.items.map((item) => {
|
|
298
|
-
const idx = flatIndex++;
|
|
299
|
-
return (
|
|
300
|
-
<button
|
|
301
|
-
key={item.id}
|
|
302
|
-
data-mention-index={idx}
|
|
303
|
-
className={`flex w-full items-center gap-2 rounded px-2 py-1.5 text-start text-sm ${
|
|
304
|
-
idx === selectedIndex
|
|
305
|
-
? "bg-accent text-accent-foreground"
|
|
306
|
-
: "hover:bg-accent/50"
|
|
307
|
-
}`}
|
|
308
|
-
onMouseEnter={() => setSelectedIndex(idx)}
|
|
309
|
-
onClick={() => onSelectMention(item)}
|
|
310
|
-
>
|
|
311
|
-
<MentionItemIcon icon={item.icon} />
|
|
312
|
-
<span className="truncate text-sm">
|
|
313
|
-
{item.label}
|
|
314
|
-
</span>
|
|
315
|
-
{item.description && (
|
|
316
|
-
<span className="ms-auto shrink-0 truncate max-w-[160px] text-xs text-muted-foreground">
|
|
317
|
-
{item.description}
|
|
318
|
-
</span>
|
|
319
|
-
)}
|
|
320
|
-
</button>
|
|
321
|
-
);
|
|
322
|
-
})}
|
|
323
|
-
</div>
|
|
324
|
-
));
|
|
325
|
-
})()
|
|
326
|
-
: (() => {
|
|
327
|
-
let idx = 0;
|
|
328
|
-
return (
|
|
329
|
-
<>
|
|
330
|
-
{commands.length > 0 && (
|
|
331
|
-
<div>
|
|
332
|
-
<div className="px-2 pt-2 pb-1 text-[10px] font-medium text-muted-foreground/70 uppercase tracking-wider">
|
|
333
|
-
Commands
|
|
334
|
-
</div>
|
|
335
|
-
{commands.map((cmd) => {
|
|
336
|
-
const i = idx++;
|
|
337
|
-
return (
|
|
338
|
-
<button
|
|
339
|
-
key={cmd.name}
|
|
340
|
-
data-mention-index={i}
|
|
341
|
-
className={`flex w-full items-center gap-2 rounded px-2 py-1.5 text-start text-sm ${
|
|
342
|
-
i === selectedIndex
|
|
343
|
-
? "bg-accent text-accent-foreground"
|
|
344
|
-
: "hover:bg-accent/50"
|
|
345
|
-
}`}
|
|
346
|
-
onMouseEnter={() => setSelectedIndex(i)}
|
|
347
|
-
onClick={() => onSelectCommand?.(cmd)}
|
|
348
|
-
>
|
|
349
|
-
<CommandIcon icon={cmd.icon} />
|
|
350
|
-
<span className="min-w-0 flex-1">
|
|
351
|
-
<span className="block truncate text-sm">
|
|
352
|
-
/{cmd.name}
|
|
353
|
-
</span>
|
|
354
|
-
{cmd.description && (
|
|
355
|
-
<span className="block truncate text-xs text-muted-foreground">
|
|
356
|
-
{cmd.description}
|
|
357
|
-
</span>
|
|
358
|
-
)}
|
|
359
|
-
</span>
|
|
360
|
-
</button>
|
|
361
|
-
);
|
|
362
|
-
})}
|
|
363
|
-
</div>
|
|
364
|
-
)}
|
|
365
|
-
{skills.length > 0 && (
|
|
366
|
-
<div>
|
|
367
|
-
{commands.length > 0 && (
|
|
368
|
-
<div className="px-2 pt-2 pb-1 text-[10px] font-medium text-muted-foreground/70 uppercase tracking-wider">
|
|
369
|
-
Skills
|
|
370
|
-
</div>
|
|
371
|
-
)}
|
|
372
|
-
{(skills as SkillResult[]).map((skill) => {
|
|
373
|
-
const i = idx++;
|
|
374
|
-
return (
|
|
375
|
-
<button
|
|
376
|
-
key={skill.path}
|
|
377
|
-
data-mention-index={i}
|
|
378
|
-
className={`flex w-full items-center gap-2 rounded px-2 py-1.5 text-start text-sm ${
|
|
379
|
-
i === selectedIndex
|
|
380
|
-
? "bg-accent text-accent-foreground"
|
|
381
|
-
: "hover:bg-accent/50"
|
|
382
|
-
}`}
|
|
383
|
-
onMouseEnter={() => setSelectedIndex(i)}
|
|
384
|
-
onClick={() => onSelectSkill(skill)}
|
|
385
|
-
>
|
|
386
|
-
<IconStack2 {...iconProps} />
|
|
387
|
-
<span className="min-w-0 flex-1">
|
|
388
|
-
<span className="block truncate text-sm">
|
|
389
|
-
{skill.name}
|
|
390
|
-
</span>
|
|
391
|
-
{skill.description && (
|
|
392
|
-
<span className="block truncate text-xs text-muted-foreground">
|
|
393
|
-
{skill.description}
|
|
394
|
-
</span>
|
|
395
|
-
)}
|
|
396
|
-
</span>
|
|
397
|
-
</button>
|
|
398
|
-
);
|
|
399
|
-
})}
|
|
400
|
-
</div>
|
|
401
|
-
)}
|
|
402
|
-
</>
|
|
403
|
-
);
|
|
404
|
-
})()}
|
|
405
|
-
</div>
|
|
406
|
-
)}
|
|
407
|
-
</div>
|
|
408
|
-
</>
|
|
409
|
-
);
|
|
410
|
-
|
|
411
|
-
return createPortal(content, document.body);
|
|
412
|
-
});
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import type { Attachment } from "@assistant-ui/react";
|
|
2
|
-
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
3
|
-
import { IconClipboardText, IconX } from "@tabler/icons-react";
|
|
4
|
-
import { useCallback, useEffect, useState } from "react";
|
|
5
|
-
|
|
6
|
-
import { cn } from "../utils.js";
|
|
7
|
-
import { countLines, unwrapAttachmentEnvelope } from "./pasted-text.js";
|
|
8
|
-
|
|
9
|
-
function readAttachmentText(attachment: Attachment): Promise<string> | string {
|
|
10
|
-
if ("file" in attachment && attachment.file instanceof File) {
|
|
11
|
-
return attachment.file.text();
|
|
12
|
-
}
|
|
13
|
-
const textPart = attachment.content?.find(
|
|
14
|
-
(p): p is { type: "text"; text: string } =>
|
|
15
|
-
p.type === "text" && "text" in p && typeof p.text === "string",
|
|
16
|
-
);
|
|
17
|
-
return textPart ? unwrapAttachmentEnvelope(textPart.text) : "";
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function usePastedAttachmentText(attachment: Attachment): {
|
|
21
|
-
text: string;
|
|
22
|
-
lines: number;
|
|
23
|
-
chars: number;
|
|
24
|
-
} {
|
|
25
|
-
const [text, setText] = useState("");
|
|
26
|
-
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
let cancelled = false;
|
|
29
|
-
const result = readAttachmentText(attachment);
|
|
30
|
-
if (typeof result === "string") {
|
|
31
|
-
setText(result);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
result
|
|
35
|
-
.then((value) => {
|
|
36
|
-
if (!cancelled) setText(value);
|
|
37
|
-
})
|
|
38
|
-
.catch(() => {});
|
|
39
|
-
return () => {
|
|
40
|
-
cancelled = true;
|
|
41
|
-
};
|
|
42
|
-
}, [attachment]);
|
|
43
|
-
|
|
44
|
-
return { text, lines: countLines(text), chars: text.length };
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface PastedTextChipProps {
|
|
48
|
-
attachment: Attachment;
|
|
49
|
-
onRemove?: (id: string) => void;
|
|
50
|
-
/** Compact variant rendered inside sent user messages. */
|
|
51
|
-
compact?: boolean;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export function PastedTextChip({
|
|
55
|
-
attachment,
|
|
56
|
-
onRemove,
|
|
57
|
-
compact = false,
|
|
58
|
-
}: PastedTextChipProps) {
|
|
59
|
-
const [open, setOpen] = useState(false);
|
|
60
|
-
const { text, lines, chars } = usePastedAttachmentText(attachment);
|
|
61
|
-
|
|
62
|
-
const handleRemove = useCallback(
|
|
63
|
-
(event: React.MouseEvent) => {
|
|
64
|
-
event.stopPropagation();
|
|
65
|
-
onRemove?.(attachment.id);
|
|
66
|
-
},
|
|
67
|
-
[attachment.id, onRemove],
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
const summary = lines > 0 ? `${lines} lines` : `${chars} chars`;
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
<PopoverPrimitive.Root open={open} onOpenChange={setOpen}>
|
|
74
|
-
<PopoverPrimitive.Trigger asChild>
|
|
75
|
-
<button
|
|
76
|
-
type="button"
|
|
77
|
-
className={cn(
|
|
78
|
-
"group relative inline-flex items-center gap-2 rounded-md border border-border/70 bg-muted/50 text-start text-foreground hover:bg-muted/70 cursor-pointer",
|
|
79
|
-
compact
|
|
80
|
-
? "max-w-[220px] px-2 py-1.5 text-xs"
|
|
81
|
-
: "max-w-[260px] px-2.5 py-2 text-xs",
|
|
82
|
-
onRemove && !compact && "pe-7",
|
|
83
|
-
)}
|
|
84
|
-
aria-label="Preview pasted text"
|
|
85
|
-
>
|
|
86
|
-
<span
|
|
87
|
-
className={cn(
|
|
88
|
-
"flex shrink-0 items-center justify-center rounded bg-background text-muted-foreground",
|
|
89
|
-
compact ? "h-6 w-6" : "h-8 w-8",
|
|
90
|
-
)}
|
|
91
|
-
>
|
|
92
|
-
<IconClipboardText
|
|
93
|
-
className={compact ? "h-3.5 w-3.5" : "h-4 w-4"}
|
|
94
|
-
/>
|
|
95
|
-
</span>
|
|
96
|
-
<span className="min-w-0 flex-1">
|
|
97
|
-
<span className="block truncate font-medium">Pasted text</span>
|
|
98
|
-
<span className="block text-[11px] text-muted-foreground">
|
|
99
|
-
{summary}
|
|
100
|
-
</span>
|
|
101
|
-
</span>
|
|
102
|
-
{onRemove && (
|
|
103
|
-
<span
|
|
104
|
-
role="button"
|
|
105
|
-
tabIndex={-1}
|
|
106
|
-
onClick={handleRemove}
|
|
107
|
-
aria-label="Remove pasted text"
|
|
108
|
-
className={cn(
|
|
109
|
-
"flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded text-muted-foreground hover:text-foreground",
|
|
110
|
-
compact ? "" : "absolute end-1.5 top-1.5",
|
|
111
|
-
)}
|
|
112
|
-
>
|
|
113
|
-
<IconX className="h-3 w-3" />
|
|
114
|
-
</span>
|
|
115
|
-
)}
|
|
116
|
-
</button>
|
|
117
|
-
</PopoverPrimitive.Trigger>
|
|
118
|
-
<PopoverPrimitive.Portal>
|
|
119
|
-
<PopoverPrimitive.Content
|
|
120
|
-
side="top"
|
|
121
|
-
align="start"
|
|
122
|
-
sideOffset={6}
|
|
123
|
-
collisionPadding={12}
|
|
124
|
-
className="z-50 w-[min(560px,calc(100vw-32px))] rounded-lg border border-border bg-popover text-popover-foreground shadow-lg origin-[var(--radix-popover-content-transform-origin)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95"
|
|
125
|
-
>
|
|
126
|
-
<div className="flex items-center justify-between gap-2 border-b border-border px-3 py-2">
|
|
127
|
-
<div className="flex items-center gap-2 min-w-0">
|
|
128
|
-
<IconClipboardText className="h-4 w-4 shrink-0 text-muted-foreground" />
|
|
129
|
-
<span className="text-sm font-medium truncate">Pasted text</span>
|
|
130
|
-
<span className="text-[11px] text-muted-foreground shrink-0">
|
|
131
|
-
{lines} lines · {chars} chars
|
|
132
|
-
</span>
|
|
133
|
-
</div>
|
|
134
|
-
<button
|
|
135
|
-
type="button"
|
|
136
|
-
onClick={() => setOpen(false)}
|
|
137
|
-
aria-label="Close preview"
|
|
138
|
-
className="flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded text-muted-foreground hover:text-foreground"
|
|
139
|
-
>
|
|
140
|
-
<IconX className="h-3.5 w-3.5" />
|
|
141
|
-
</button>
|
|
142
|
-
</div>
|
|
143
|
-
<pre className="max-h-[60vh] overflow-auto px-3 py-2 text-[12px] leading-[1.5] whitespace-pre-wrap break-words font-mono text-foreground">
|
|
144
|
-
{text}
|
|
145
|
-
</pre>
|
|
146
|
-
</PopoverPrimitive.Content>
|
|
147
|
-
</PopoverPrimitive.Portal>
|
|
148
|
-
</PopoverPrimitive.Root>
|
|
149
|
-
);
|
|
150
|
-
}
|