@agent-native/core 0.87.0 → 0.90.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/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +88 -2
- package/corpus/core/docs/content/agent-native-toolkit.mdx +103 -0
- package/corpus/core/docs/content/cloneable-saas.mdx +19 -19
- package/corpus/core/docs/content/components.mdx +16 -4
- package/corpus/core/docs/content/data-programs.mdx +329 -0
- package/corpus/core/docs/content/deployment.mdx +9 -9
- package/corpus/core/docs/content/extensions.mdx +8 -7
- package/corpus/core/docs/content/generative-ui.mdx +5 -3
- package/corpus/core/docs/content/key-concepts.mdx +6 -9
- package/corpus/core/docs/content/locales/ar-SA/agent-native-toolkit.mdx +103 -0
- package/corpus/core/docs/content/locales/ar-SA/cloneable-saas.mdx +19 -19
- package/corpus/core/docs/content/locales/ar-SA/components.mdx +12 -2
- package/corpus/core/docs/content/locales/ar-SA/data-programs.mdx +329 -0
- package/corpus/core/docs/content/locales/ar-SA/deployment.mdx +8 -9
- package/corpus/core/docs/content/locales/ar-SA/extensions.mdx +6 -4
- package/corpus/core/docs/content/locales/ar-SA/key-concepts.mdx +7 -9
- package/corpus/core/docs/content/locales/ar-SA/real-time-collaboration.mdx +9 -10
- package/corpus/core/docs/content/locales/ar-SA/sharing.mdx +15 -7
- package/corpus/core/docs/content/locales/de-DE/agent-native-toolkit.mdx +103 -0
- package/corpus/core/docs/content/locales/de-DE/cloneable-saas.mdx +19 -19
- package/corpus/core/docs/content/locales/de-DE/components.mdx +12 -2
- package/corpus/core/docs/content/locales/de-DE/data-programs.mdx +329 -0
- package/corpus/core/docs/content/locales/de-DE/deployment.mdx +8 -9
- package/corpus/core/docs/content/locales/de-DE/extensions.mdx +6 -4
- package/corpus/core/docs/content/locales/de-DE/key-concepts.mdx +8 -10
- package/corpus/core/docs/content/locales/de-DE/real-time-collaboration.mdx +9 -10
- package/corpus/core/docs/content/locales/de-DE/sharing.mdx +15 -7
- package/corpus/core/docs/content/locales/es-ES/agent-native-toolkit.mdx +103 -0
- package/corpus/core/docs/content/locales/es-ES/cloneable-saas.mdx +19 -19
- package/corpus/core/docs/content/locales/es-ES/components.mdx +12 -2
- package/corpus/core/docs/content/locales/es-ES/data-programs.mdx +329 -0
- package/corpus/core/docs/content/locales/es-ES/deployment.mdx +8 -9
- package/corpus/core/docs/content/locales/es-ES/extensions.mdx +6 -4
- package/corpus/core/docs/content/locales/es-ES/key-concepts.mdx +8 -10
- package/corpus/core/docs/content/locales/es-ES/real-time-collaboration.mdx +9 -10
- package/corpus/core/docs/content/locales/es-ES/sharing.mdx +15 -7
- package/corpus/core/docs/content/locales/fr-FR/agent-native-toolkit.mdx +103 -0
- package/corpus/core/docs/content/locales/fr-FR/cloneable-saas.mdx +19 -19
- package/corpus/core/docs/content/locales/fr-FR/components.mdx +12 -2
- package/corpus/core/docs/content/locales/fr-FR/data-programs.mdx +329 -0
- package/corpus/core/docs/content/locales/fr-FR/deployment.mdx +8 -9
- package/corpus/core/docs/content/locales/fr-FR/extensions.mdx +6 -4
- package/corpus/core/docs/content/locales/fr-FR/key-concepts.mdx +8 -10
- package/corpus/core/docs/content/locales/fr-FR/real-time-collaboration.mdx +9 -10
- package/corpus/core/docs/content/locales/fr-FR/sharing.mdx +15 -7
- package/corpus/core/docs/content/locales/hi-IN/agent-native-toolkit.mdx +103 -0
- package/corpus/core/docs/content/locales/hi-IN/cloneable-saas.mdx +19 -19
- package/corpus/core/docs/content/locales/hi-IN/components.mdx +20 -10
- package/corpus/core/docs/content/locales/hi-IN/data-programs.mdx +329 -0
- package/corpus/core/docs/content/locales/hi-IN/deployment.mdx +8 -9
- package/corpus/core/docs/content/locales/hi-IN/extensions.mdx +6 -4
- package/corpus/core/docs/content/locales/hi-IN/key-concepts.mdx +8 -10
- package/corpus/core/docs/content/locales/hi-IN/real-time-collaboration.mdx +9 -10
- package/corpus/core/docs/content/locales/hi-IN/sharing.mdx +15 -7
- package/corpus/core/docs/content/locales/ja-JP/agent-native-toolkit.mdx +103 -0
- package/corpus/core/docs/content/locales/ja-JP/cloneable-saas.mdx +19 -19
- package/corpus/core/docs/content/locales/ja-JP/components.mdx +12 -2
- package/corpus/core/docs/content/locales/ja-JP/data-programs.mdx +329 -0
- package/corpus/core/docs/content/locales/ja-JP/deployment.mdx +8 -9
- package/corpus/core/docs/content/locales/ja-JP/extensions.mdx +6 -4
- package/corpus/core/docs/content/locales/ja-JP/key-concepts.mdx +9 -11
- package/corpus/core/docs/content/locales/ja-JP/real-time-collaboration.mdx +9 -10
- package/corpus/core/docs/content/locales/ja-JP/sharing.mdx +15 -7
- package/corpus/core/docs/content/locales/ko-KR/agent-native-toolkit.mdx +103 -0
- package/corpus/core/docs/content/locales/ko-KR/cloneable-saas.mdx +19 -19
- package/corpus/core/docs/content/locales/ko-KR/components.mdx +20 -10
- package/corpus/core/docs/content/locales/ko-KR/data-programs.mdx +329 -0
- package/corpus/core/docs/content/locales/ko-KR/deployment.mdx +8 -9
- package/corpus/core/docs/content/locales/ko-KR/extensions.mdx +16 -14
- package/corpus/core/docs/content/locales/ko-KR/key-concepts.mdx +9 -11
- package/corpus/core/docs/content/locales/ko-KR/real-time-collaboration.mdx +9 -10
- package/corpus/core/docs/content/locales/ko-KR/sharing.mdx +15 -7
- package/corpus/core/docs/content/locales/pt-BR/agent-native-toolkit.mdx +103 -0
- package/corpus/core/docs/content/locales/pt-BR/cloneable-saas.mdx +19 -19
- package/corpus/core/docs/content/locales/pt-BR/components.mdx +12 -2
- package/corpus/core/docs/content/locales/pt-BR/data-programs.mdx +329 -0
- package/corpus/core/docs/content/locales/pt-BR/deployment.mdx +8 -9
- package/corpus/core/docs/content/locales/pt-BR/extensions.mdx +6 -4
- package/corpus/core/docs/content/locales/pt-BR/key-concepts.mdx +8 -11
- package/corpus/core/docs/content/locales/pt-BR/real-time-collaboration.mdx +9 -10
- package/corpus/core/docs/content/locales/pt-BR/sharing.mdx +15 -7
- package/corpus/core/docs/content/locales/zh-CN/agent-native-toolkit.mdx +103 -0
- package/corpus/core/docs/content/locales/zh-CN/cloneable-saas.mdx +19 -19
- package/corpus/core/docs/content/locales/zh-CN/components.mdx +20 -10
- package/corpus/core/docs/content/locales/zh-CN/data-programs.mdx +329 -0
- package/corpus/core/docs/content/locales/zh-CN/deployment.mdx +7 -9
- package/corpus/core/docs/content/locales/zh-CN/extensions.mdx +16 -14
- package/corpus/core/docs/content/locales/zh-CN/key-concepts.mdx +7 -11
- package/corpus/core/docs/content/locales/zh-CN/real-time-collaboration.mdx +10 -11
- package/corpus/core/docs/content/locales/zh-CN/sharing.mdx +15 -7
- package/corpus/core/docs/content/locales/zh-TW/agent-native-toolkit.mdx +103 -0
- package/corpus/core/docs/content/locales/zh-TW/cloneable-saas.mdx +19 -19
- package/corpus/core/docs/content/locales/zh-TW/components.mdx +20 -10
- package/corpus/core/docs/content/locales/zh-TW/data-programs.mdx +329 -0
- package/corpus/core/docs/content/locales/zh-TW/deployment.mdx +7 -9
- package/corpus/core/docs/content/locales/zh-TW/extensions.mdx +16 -14
- package/corpus/core/docs/content/locales/zh-TW/key-concepts.mdx +7 -11
- package/corpus/core/docs/content/locales/zh-TW/real-time-collaboration.mdx +10 -11
- package/corpus/core/docs/content/locales/zh-TW/sharing.mdx +15 -7
- package/corpus/core/docs/content/real-time-collaboration.mdx +10 -11
- package/corpus/core/docs/content/sharing.mdx +39 -7
- package/corpus/core/docs/content/toolkit-app-adapters.mdx +46 -0
- package/corpus/core/docs/content/toolkit-collaboration-ui.mdx +48 -0
- package/corpus/core/docs/content/toolkit-sharing-ui.mdx +33 -0
- package/corpus/core/docs/content/toolkit-shell-hooks.mdx +27 -0
- package/corpus/core/docs/content/toolkit-ui.mdx +69 -0
- package/corpus/core/package.json +6 -1
- package/corpus/core/src/agent/durable-background.ts +53 -0
- package/corpus/core/src/agent/engine/ai-sdk-engine.ts +7 -1
- package/corpus/core/src/agent/engine/anthropic-engine.ts +29 -1
- package/corpus/core/src/agent/engine/builder-engine.ts +1 -0
- package/corpus/core/src/agent/engine/output-tokens.ts +26 -13
- package/corpus/core/src/agent/engine/registry.ts +45 -26
- package/corpus/core/src/agent/engine/translate-ai-sdk.ts +56 -7
- package/corpus/core/src/agent/engine/translate-anthropic.ts +43 -1
- package/corpus/core/src/agent/engine/types.ts +16 -0
- package/corpus/core/src/agent/model-config.ts +100 -0
- package/corpus/core/src/agent/production-agent.ts +492 -241
- package/corpus/core/src/agent/runtime-context.ts +50 -12
- package/corpus/core/src/agent/tool-result-images.ts +178 -0
- package/corpus/core/src/brand-kit/fig/index.ts +8 -4
- package/corpus/core/src/client/AgentPanel.tsx +88 -31
- package/corpus/core/src/client/AssistantChat.tsx +95 -46
- package/corpus/core/src/client/KeepTabOpenNotice.tsx +176 -0
- package/corpus/core/src/client/MultiTabAssistantChat.tsx +7 -0
- package/corpus/core/src/client/RunStuckBanner.tsx +13 -1
- package/corpus/core/src/client/chat/run-recovery.tsx +7 -1
- package/corpus/core/src/client/clipboard.ts +17 -13
- package/corpus/core/src/client/components/AgentPresenceChip.tsx +4 -69
- package/corpus/core/src/client/components/LiveCursorOverlay.tsx +5 -240
- package/corpus/core/src/client/components/PresenceBar.tsx +4 -346
- package/corpus/core/src/client/components/RecentEditHighlights.tsx +4 -219
- package/corpus/core/src/client/components/RemoteSelectionRings.tsx +5 -220
- package/corpus/core/src/client/composer/TiptapComposer.tsx +94 -38
- package/corpus/core/src/client/db-admin/SqlEditor.tsx +13 -3
- package/corpus/core/src/client/dynamic-suggestions.ts +6 -1
- package/corpus/core/src/client/extensions/ExtensionViewer.tsx +0 -14
- package/corpus/core/src/client/extensions/ExtensionsListPage.tsx +29 -30
- package/corpus/core/src/client/extensions/ExtensionsSidebarSection.tsx +2 -1
- package/corpus/core/src/client/host-bridge.ts +29 -8
- package/corpus/core/src/client/i18n.tsx +7 -1
- package/corpus/core/src/client/index.ts +5 -0
- package/corpus/core/src/client/resources/McpIntegrationDialog.tsx +34 -69
- package/corpus/core/src/client/rich-markdown-editor/SharedRichEditor.tsx +4 -0
- package/corpus/core/src/client/rich-markdown-editor/useCollabReconcile.ts +7 -1
- package/corpus/core/src/client/settings/SettingsPanel.tsx +409 -230
- package/corpus/core/src/client/settings/SettingsTabsPage.tsx +5 -7
- package/corpus/core/src/client/settings/index.ts +5 -1
- package/corpus/core/src/client/sharing/VisibilityBadge.tsx +4 -37
- package/corpus/core/src/client/use-run-stuck-detection.ts +10 -1
- package/corpus/core/src/coding-tools/run-code.ts +473 -74
- package/corpus/core/src/coding-tools/sandbox/background.ts +406 -0
- package/corpus/core/src/coding-tools/sandbox/executions-store.ts +517 -0
- package/corpus/core/src/coding-tools/sandbox/index.ts +53 -13
- package/corpus/core/src/coding-tools/sandbox/local-child-process-adapter.ts +61 -4
- package/corpus/core/src/collab/client.ts +870 -562
- package/corpus/core/src/collab/presence.ts +12 -23
- package/corpus/core/src/collab/recent-edits.ts +13 -32
- package/corpus/core/src/data-programs/actions.ts +335 -0
- package/corpus/core/src/data-programs/contract.ts +284 -0
- package/corpus/core/src/data-programs/execute.ts +693 -0
- package/corpus/core/src/data-programs/index.ts +72 -0
- package/corpus/core/src/data-programs/schema.ts +148 -0
- package/corpus/core/src/data-programs/store.ts +755 -0
- package/corpus/core/src/deploy/build.ts +34 -0
- package/corpus/core/src/extensions/actions.ts +2 -2
- package/corpus/core/src/file-upload/builder.ts +11 -0
- package/corpus/core/src/integrations/webhook-handler.ts +27 -8
- package/corpus/core/src/local-artifacts/index.ts +1 -1
- package/corpus/core/src/localization/default-messages.ts +1 -2
- package/corpus/core/src/mcp-client/index.ts +29 -0
- package/corpus/core/src/onboarding/default-steps.ts +5 -2
- package/corpus/core/src/resources/store.ts +34 -3
- package/corpus/core/src/scripts/agent-engines/list-agent-engines.ts +4 -8
- package/corpus/core/src/scripts/agent-engines/test-agent-engine.ts +9 -2
- package/corpus/core/src/scripts/db/tool-mode.ts +2 -2
- package/corpus/core/src/scripts/resources/migrate-learnings.ts +9 -13
- package/corpus/core/src/server/action-discovery.ts +4 -0
- package/corpus/core/src/server/action-routes.ts +8 -1
- package/corpus/core/src/server/agent-chat-plugin.ts +154 -62
- package/corpus/core/src/server/agent-discovery.ts +67 -7
- package/corpus/core/src/server/auth.ts +90 -3
- package/corpus/core/src/server/builder-design-systems.ts +2 -2
- package/corpus/core/src/server/core-routes-plugin.ts +119 -22
- package/corpus/core/src/server/credential-provider.ts +28 -8
- package/corpus/core/src/server/csrf.ts +3 -0
- package/corpus/core/src/server/index.ts +9 -0
- package/corpus/core/src/server/oauth-helpers.ts +11 -1
- package/corpus/core/src/server/onboarding-html.ts +80 -48
- package/corpus/core/src/server/prompts/shared-rules.ts +2 -2
- package/corpus/core/src/server/transcribe-voice.ts +93 -9
- package/corpus/core/src/shared/agent-readable-resource.ts +111 -0
- package/corpus/core/src/shared/index.ts +9 -0
- package/corpus/core/src/sharing/actions/create-agent-resource-link.ts +91 -0
- package/corpus/core/src/sharing/registry.ts +19 -0
- package/corpus/core/src/styles/agent-native.css +57 -45
- package/corpus/core/src/templates/default/.agents/skills/actions/SKILL.md +55 -0
- package/corpus/core/src/templates/default/AGENTS.md +11 -14
- package/corpus/core/src/templates/default/actions/navigate.ts +1 -1
- package/corpus/core/src/templates/default/app/i18n/ar-SA.ts +0 -1
- package/corpus/core/src/templates/default/app/i18n/de-DE.ts +0 -1
- package/corpus/core/src/templates/default/app/i18n/en-US.ts +0 -1
- package/corpus/core/src/templates/default/app/i18n/es-ES.ts +0 -1
- package/corpus/core/src/templates/default/app/i18n/fr-FR.ts +0 -1
- package/corpus/core/src/templates/default/app/i18n/hi-IN.ts +0 -1
- package/corpus/core/src/templates/default/app/i18n/ja-JP.ts +0 -1
- package/corpus/core/src/templates/default/app/i18n/ko-KR.ts +0 -1
- package/corpus/core/src/templates/default/app/i18n/pt-BR.ts +0 -1
- package/corpus/core/src/templates/default/app/i18n/zh-CN.ts +0 -1
- package/corpus/core/src/templates/default/app/i18n/zh-TW.ts +0 -1
- package/corpus/core/src/templates/default/app/routes/settings.tsx +22 -33
- package/corpus/core/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +20 -7
- package/corpus/core/src/templates/headless/AGENTS.md +9 -6
- package/corpus/core/src/templates/workspace-core/.agents/skills/actions/SKILL.md +55 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +92 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/data-programs/SKILL.md +128 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/harness-agents/SKILL.md +10 -4
- package/corpus/core/src/vite/agents-bundle-plugin.ts +26 -1
- package/corpus/core/src/vite/client.ts +13 -0
- package/corpus/templates/analytics/.agents/skills/actions/SKILL.md +55 -0
- package/corpus/templates/analytics/.agents/skills/analysis-workspace/SKILL.md +8 -0
- package/corpus/templates/analytics/.agents/skills/data-programs/SKILL.md +348 -0
- package/corpus/templates/analytics/.agents/skills/provider-api/SKILL.md +10 -0
- package/corpus/templates/analytics/AGENTS.md +31 -32
- package/corpus/templates/analytics/actions/dashboard-mutation-api.ts +1 -1
- package/corpus/templates/analytics/actions/delete-data-source-credentials.ts +32 -0
- package/corpus/templates/analytics/actions/ensure-risk-meeting-dashboard.ts +247 -0
- package/corpus/templates/analytics/actions/get-sql-dashboard.ts +9 -113
- package/corpus/templates/analytics/actions/update-data-source-credentials.ts +123 -0
- package/corpus/templates/analytics/app/components/InlineMetric.tsx +2 -2
- package/corpus/templates/analytics/app/components/dashboard/CumulativeNetChart.tsx +2 -7
- package/corpus/templates/analytics/app/components/dashboard/DataTable.tsx +11 -16
- package/corpus/templates/analytics/app/components/dashboard/DateRangePicker.tsx +1 -2
- package/corpus/templates/analytics/app/components/dashboard/MetricCard.tsx +2 -7
- package/corpus/templates/analytics/app/components/dashboard/RecentActivity.tsx +3 -6
- package/corpus/templates/analytics/app/components/dashboard/RevenueChart.tsx +1 -6
- package/corpus/templates/analytics/app/components/dashboard/RevenueComparisonChart.tsx +2 -7
- package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +11 -15
- package/corpus/templates/analytics/app/components/dashboard/StatsCard.tsx +1 -7
- package/corpus/templates/analytics/app/components/dashboard/TimeSeriesChart.tsx +2 -7
- package/corpus/templates/analytics/app/components/layout/CommandPalette.tsx +16 -16
- package/corpus/templates/analytics/app/components/layout/Header.tsx +2 -2
- package/corpus/templates/analytics/app/components/layout/HeaderActions.tsx +2 -1
- package/corpus/templates/analytics/app/components/layout/Layout.tsx +2 -2
- package/corpus/templates/analytics/app/components/layout/MobileNav.tsx +33 -17
- package/corpus/templates/analytics/app/components/layout/NewAnalysisDialog.tsx +6 -6
- package/corpus/templates/analytics/app/components/layout/NewDashboardDialog.tsx +4 -3
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +119 -68
- package/corpus/templates/analytics/app/components/ui/alert-dialog.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/alert.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/avatar.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/badge.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/button.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/calendar.tsx +1 -1
- package/corpus/templates/analytics/app/components/ui/card.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/checkbox.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/collapsible.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/command.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/date-picker.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/dialog.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/dropdown-menu.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/input.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/label.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/popover.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/progress.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/select.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/sheet.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/skeleton.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/sonner.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/spinner.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/switch.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/table.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/tabs.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/textarea.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/toaster.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/toggle-group.tsx +1 -0
- package/corpus/templates/analytics/app/components/ui/toolkit-provider.tsx +12 -0
- package/corpus/templates/analytics/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/analytics/app/global.css +26 -3
- package/corpus/templates/analytics/app/i18n/zh-TW.ts +27 -4
- package/corpus/templates/analytics/app/i18n-data.ts +277 -42
- package/corpus/templates/analytics/app/pages/Agents.tsx +19 -19
- package/corpus/templates/analytics/app/pages/DataDictionary.tsx +21 -21
- package/corpus/templates/analytics/app/pages/DataSources.tsx +31 -54
- package/corpus/templates/analytics/app/pages/NotFound.tsx +2 -1
- package/corpus/templates/analytics/app/pages/Placeholder.tsx +2 -1
- package/corpus/templates/analytics/app/pages/Settings.tsx +19 -37
- package/corpus/templates/analytics/app/pages/adhoc/DashboardSkeleton.tsx +3 -2
- package/corpus/templates/analytics/app/pages/adhoc/_shared/KpiChart.tsx +8 -13
- package/corpus/templates/analytics/app/pages/adhoc/_shared/components/DateRangeInput.tsx +1 -2
- package/corpus/templates/analytics/app/pages/adhoc/explorer/components/ChartTypePicker.tsx +2 -4
- package/corpus/templates/analytics/app/pages/adhoc/explorer/components/DateRangePicker.tsx +1 -2
- package/corpus/templates/analytics/app/pages/adhoc/explorer/components/EventCombobox.tsx +7 -7
- package/corpus/templates/analytics/app/pages/adhoc/explorer/components/EventPanel.tsx +2 -1
- package/corpus/templates/analytics/app/pages/adhoc/explorer/components/EventRow.tsx +2 -1
- package/corpus/templates/analytics/app/pages/adhoc/explorer/components/ExplorerChart.tsx +3 -8
- package/corpus/templates/analytics/app/pages/adhoc/explorer/components/FilterBuilder.tsx +5 -4
- package/corpus/templates/analytics/app/pages/adhoc/explorer/components/GroupByPicker.tsx +2 -1
- package/corpus/templates/analytics/app/pages/adhoc/explorer/components/PropertyCombobox.tsx +7 -7
- package/corpus/templates/analytics/app/pages/adhoc/explorer/components/PropertyValueCombobox.tsx +7 -7
- package/corpus/templates/analytics/app/pages/adhoc/explorer/components/SqlPreview.tsx +1 -1
- package/corpus/templates/analytics/app/pages/adhoc/explorer/index.tsx +16 -16
- package/corpus/templates/analytics/app/pages/adhoc/explorer-dashboard/ChartCard.tsx +16 -21
- package/corpus/templates/analytics/app/pages/adhoc/explorer-dashboard/index.tsx +32 -32
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/DashboardFilterBar.tsx +14 -14
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/EmailReportDialog.tsx +14 -13
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/PanelEditorDialog.tsx +200 -52
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/SqlChartCard.tsx +23 -28
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/ViewSqlPopover.tsx +13 -12
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/ViewsMenu.tsx +15 -15
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +32 -36
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/types.ts +2 -1
- package/corpus/templates/analytics/app/pages/analyses/AnalysesList.tsx +8 -7
- package/corpus/templates/analytics/app/pages/analyses/AnalysisDetail.tsx +19 -19
- package/corpus/templates/analytics/app/pages/analyses/LegacyFusionAnalysis.tsx +11 -15
- package/corpus/templates/analytics/app/pages/sessions/SessionDetailPage.tsx +14 -14
- package/corpus/templates/analytics/app/pages/sessions/SessionDevToolsPanel.tsx +7 -12
- package/corpus/templates/analytics/app/pages/sessions/SessionsPage.tsx +12 -12
- package/corpus/templates/analytics/app/pages/settings/AlertRulesSettingsCard.tsx +25 -25
- package/corpus/templates/analytics/app/root.tsx +22 -19
- package/corpus/templates/analytics/app/routes/catalog.tsx +8 -8
- package/corpus/templates/analytics/changelog/2026-07-06-dashboard-lists-and-headers-stay-compact.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-06-dashboards-can-now-chart-data-programs-saved-server-side-scr.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-06-extension-pages-and-mobile-headers-now-share-one-background-shade.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-06-mobile-chat-header-is-more-compact-and-the-menu-button-opens-navigation.md +5 -0
- package/corpus/templates/analytics/learnings.defaults.md +36 -0
- package/corpus/templates/analytics/seeds/data-programs/risk-meeting-cohort.js +254 -0
- package/corpus/templates/analytics/seeds/data-programs/risk-meeting-pylon-early-warning.js +184 -0
- package/corpus/templates/analytics/server/db/index.ts +14 -0
- package/corpus/templates/analytics/server/handlers/sql-query.ts +1 -1
- package/corpus/templates/analytics/server/lib/agent-readable-resource-context.ts +156 -0
- package/corpus/templates/analytics/server/lib/dashboard-panel-query.ts +109 -1
- package/corpus/templates/analytics/server/routes/[...page].get.ts +92 -25
- package/corpus/templates/analytics/server/routes/api/analysis-agent-context.json.get.ts +94 -0
- package/corpus/templates/analytics/server/routes/api/dashboard-agent-context.json.get.ts +109 -0
- package/corpus/templates/analytics/shared/resource-agent-access.ts +6 -0
- package/corpus/templates/assets/.agents/skills/actions/SKILL.md +55 -0
- package/corpus/templates/assets/app/components/create/RecentDraftsSection.tsx +3 -2
- package/corpus/templates/assets/app/components/generation/GenerationResults.tsx +16 -10
- package/corpus/templates/assets/app/components/layout/Header.tsx +1 -1
- package/corpus/templates/assets/app/components/layout/PageShell.tsx +4 -4
- package/corpus/templates/assets/app/components/layout/Sidebar.tsx +12 -12
- package/corpus/templates/assets/app/components/library/CreateLibraryDialog.tsx +8 -8
- package/corpus/templates/assets/app/components/library/EditLibraryDialog.tsx +7 -7
- package/corpus/templates/assets/app/components/library/LibraryCard.tsx +8 -8
- package/corpus/templates/assets/app/components/library/LibraryPresetGrid.tsx +3 -2
- package/corpus/templates/assets/app/components/ui/alert-dialog.tsx +1 -0
- package/corpus/templates/assets/app/components/ui/badge.tsx +1 -0
- package/corpus/templates/assets/app/components/ui/button.tsx +1 -0
- package/corpus/templates/assets/app/components/ui/card.tsx +1 -0
- package/corpus/templates/assets/app/components/ui/checkbox.tsx +1 -0
- package/corpus/templates/assets/app/components/ui/dialog.tsx +1 -0
- package/corpus/templates/assets/app/components/ui/dropdown-menu.tsx +1 -0
- package/corpus/templates/assets/app/components/ui/input.tsx +1 -0
- package/corpus/templates/assets/app/components/ui/label.tsx +1 -0
- package/corpus/templates/assets/app/components/ui/popover.tsx +1 -0
- package/corpus/templates/assets/app/components/ui/select.tsx +1 -0
- package/corpus/templates/assets/app/components/ui/separator.tsx +1 -0
- package/corpus/templates/assets/app/components/ui/sheet.tsx +1 -0
- package/corpus/templates/assets/app/components/ui/skeleton.tsx +1 -0
- package/corpus/templates/assets/app/components/ui/sonner.tsx +1 -0
- package/corpus/templates/assets/app/components/ui/spinner.tsx +1 -0
- package/corpus/templates/assets/app/components/ui/tabs.tsx +1 -0
- package/corpus/templates/assets/app/components/ui/toolkit-provider.tsx +12 -0
- package/corpus/templates/assets/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/assets/app/global.css +1 -0
- package/corpus/templates/assets/app/root.tsx +12 -9
- package/corpus/templates/assets/app/routes/asset.$id.tsx +19 -19
- package/corpus/templates/assets/app/routes/audit.tsx +15 -14
- package/corpus/templates/assets/app/routes/brand-kits.$id.tsx +49 -54
- package/corpus/templates/assets/app/routes/library.tsx +31 -31
- package/corpus/templates/assets/app/routes/settings.tsx +21 -35
- package/corpus/templates/assets/changelog/2026-07-06-mobile-layouts-no-longer-stack-two-top-headers.md +5 -0
- package/corpus/templates/brain/.agents/skills/actions/SKILL.md +55 -0
- package/corpus/templates/brain/.agents/skills/ask-across-everything/SKILL.md +6 -1
- package/corpus/templates/brain/.agents/skills/brain/SKILL.md +63 -5
- package/corpus/templates/brain/.agents/skills/ingestion-and-connectors/SKILL.md +112 -0
- package/corpus/templates/brain/AGENTS.md +93 -8
- package/corpus/templates/brain/app/components/brain/CanonicalPreviewSheet.tsx +6 -5
- package/corpus/templates/brain/app/components/brain/Surface.tsx +3 -8
- package/corpus/templates/brain/app/components/layout/Layout.tsx +7 -7
- package/corpus/templates/brain/app/components/layout/Sidebar.tsx +6 -6
- package/corpus/templates/brain/app/components/ui/badge.tsx +1 -0
- package/corpus/templates/brain/app/components/ui/button.tsx +1 -0
- package/corpus/templates/brain/app/components/ui/card.tsx +1 -0
- package/corpus/templates/brain/app/components/ui/input.tsx +1 -0
- package/corpus/templates/brain/app/components/ui/label.tsx +1 -0
- package/corpus/templates/brain/app/components/ui/progress.tsx +1 -0
- package/corpus/templates/brain/app/components/ui/select.tsx +1 -0
- package/corpus/templates/brain/app/components/ui/separator.tsx +1 -0
- package/corpus/templates/brain/app/components/ui/sheet.tsx +1 -0
- package/corpus/templates/brain/app/components/ui/skeleton.tsx +1 -0
- package/corpus/templates/brain/app/components/ui/switch.tsx +1 -0
- package/corpus/templates/brain/app/components/ui/table.tsx +1 -0
- package/corpus/templates/brain/app/components/ui/textarea.tsx +1 -0
- package/corpus/templates/brain/app/components/ui/toolkit-provider.tsx +12 -0
- package/corpus/templates/brain/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/brain/app/global.css +1 -0
- package/corpus/templates/brain/app/hooks/use-distillation-bridge.ts +9 -4
- package/corpus/templates/brain/app/root.tsx +11 -8
- package/corpus/templates/brain/app/routes/knowledge.tsx +19 -19
- package/corpus/templates/brain/app/routes/ops.tsx +18 -18
- package/corpus/templates/brain/app/routes/review.tsx +22 -27
- package/corpus/templates/brain/app/routes/search.tsx +20 -20
- package/corpus/templates/brain/app/routes/settings.tsx +25 -40
- package/corpus/templates/brain/app/routes/sources.tsx +23 -23
- package/corpus/templates/calendar/.agents/skills/actions/SKILL.md +55 -0
- package/corpus/templates/calendar/actions/find-a-time.ts +29 -16
- package/corpus/templates/calendar/actions/list-bookings.ts +33 -2
- package/corpus/templates/calendar/actions/list-events.ts +34 -8
- package/corpus/templates/calendar/actions/update-calendar-visual-preferences.ts +105 -34
- package/corpus/templates/calendar/app/components/ThemeToggle.tsx +5 -5
- package/corpus/templates/calendar/app/components/TimezoneCombobox.tsx +6 -6
- package/corpus/templates/calendar/app/components/booking/BookingConfirmation.tsx +2 -1
- package/corpus/templates/calendar/app/components/booking/BookingForm.tsx +9 -8
- package/corpus/templates/calendar/app/components/booking/DatePicker.tsx +2 -2
- package/corpus/templates/calendar/app/components/booking/TimeSlotPicker.tsx +3 -2
- package/corpus/templates/calendar/app/components/calendar/AddCalendarDialog.tsx +10 -15
- package/corpus/templates/calendar/app/components/calendar/AttendeeAutocomplete.tsx +6 -6
- package/corpus/templates/calendar/app/components/calendar/CommandPalette.tsx +73 -3
- package/corpus/templates/calendar/app/components/calendar/CreateEventDialog.tsx +27 -27
- package/corpus/templates/calendar/app/components/calendar/DayView.tsx +553 -267
- package/corpus/templates/calendar/app/components/calendar/DeleteEventDialog.tsx +9 -12
- package/corpus/templates/calendar/app/components/calendar/EventAttendeesSection.tsx +10 -13
- package/corpus/templates/calendar/app/components/calendar/EventDetailPanel.tsx +7 -7
- package/corpus/templates/calendar/app/components/calendar/EventDetailPopover.tsx +21 -21
- package/corpus/templates/calendar/app/components/calendar/EventDialog.tsx +11 -11
- package/corpus/templates/calendar/app/components/calendar/EventOptionControls.tsx +9 -9
- package/corpus/templates/calendar/app/components/calendar/FindTimePanel.tsx +9 -9
- package/corpus/templates/calendar/app/components/calendar/GoogleConnectBanner.tsx +6 -6
- package/corpus/templates/calendar/app/components/calendar/GoogleSetupWizard.tsx +3 -3
- package/corpus/templates/calendar/app/components/calendar/GoogleSyncButton.tsx +1 -1
- package/corpus/templates/calendar/app/components/calendar/GuestNotificationDialog.tsx +8 -10
- package/corpus/templates/calendar/app/components/calendar/IntegrationsSidebar.tsx +12 -12
- package/corpus/templates/calendar/app/components/calendar/KeyboardShortcutsHelp.tsx +2 -2
- package/corpus/templates/calendar/app/components/calendar/MonthView.tsx +93 -41
- package/corpus/templates/calendar/app/components/calendar/PeopleSearchDialog.tsx +6 -6
- package/corpus/templates/calendar/app/components/calendar/WeekView.tsx +530 -299
- package/corpus/templates/calendar/app/components/layout/AppLayout.tsx +229 -134
- package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +135 -108
- package/corpus/templates/calendar/app/components/ui/alert-dialog.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/badge.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/button.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/card.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/checkbox.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/collapsible.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/command.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/dialog.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/dropdown-menu.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/input.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/label.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/popover.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/radio-group.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/select.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/separator.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/skeleton.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/spinner.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/switch.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/table.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/tabs.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/textarea.tsx +1 -0
- package/corpus/templates/calendar/app/components/ui/toolkit-provider.tsx +12 -0
- package/corpus/templates/calendar/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/calendar/app/global.css +1 -0
- package/corpus/templates/calendar/app/hooks/use-event-drag.ts +63 -9
- package/corpus/templates/calendar/app/hooks/use-google-auth.ts +15 -27
- package/corpus/templates/calendar/app/hooks/use-grid-create-drag.ts +254 -0
- package/corpus/templates/calendar/app/hooks/use-mobile.ts +1 -0
- package/corpus/templates/calendar/app/hooks/use-view-preferences.ts +287 -21
- package/corpus/templates/calendar/app/hooks/use-zoom-auth.ts +56 -19
- package/corpus/templates/calendar/app/i18n/zh-TW.ts +3 -0
- package/corpus/templates/calendar/app/i18n-data.ts +31 -0
- package/corpus/templates/calendar/app/lib/event-colors.ts +29 -8
- package/corpus/templates/calendar/app/pages/AvailabilitySettings.tsx +11 -11
- package/corpus/templates/calendar/app/pages/BookingLinksPage.tsx +45 -50
- package/corpus/templates/calendar/app/pages/BookingPage.tsx +2 -2
- package/corpus/templates/calendar/app/pages/BookingsList.tsx +12 -12
- package/corpus/templates/calendar/app/pages/CalendarView.tsx +438 -271
- package/corpus/templates/calendar/app/pages/ManageBookingPage.tsx +13 -13
- package/corpus/templates/calendar/app/pages/Settings.tsx +15 -29
- package/corpus/templates/calendar/app/root.tsx +19 -15
- package/corpus/templates/calendar/app/routes/event.tsx +2 -2
- package/corpus/templates/calendar/changelog/2026-07-06-calendar-now-loads-view-preferences-much-more-efficiently.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-06-connected-calendars-keep-their-own-color-when-you-customize-.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-06-create-events-from-the-command-menu-with-natural-phrases-lik.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-06-drag-across-empty-week-or-day-slots-to-create-an-event-with-.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-06-dragging-and-resizing-events-is-much-smoother-especially-on-.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-06-each-connected-google-account-can-now-have-its-own-calendar-.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-06-events-spanning-multiple-days-now-show-on-every-day-they-cov.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-06-google-calendar-now-finishes-connecting-correctly-after-sign.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-06-public-booking-pages-respond-faster.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-06-the-app-header-no-longer-shows-the-global-notifications-bell.md +6 -0
- package/corpus/templates/calendar/package.json +1 -0
- package/corpus/templates/calendar/server/handlers/bookings.ts +46 -52
- package/corpus/templates/calendar/server/handlers/google-auth.ts +21 -5
- package/corpus/templates/calendar/server/lib/google-calendar.ts +32 -3
- package/corpus/templates/calendar/shared/calendar-view-preferences.ts +66 -2
- package/corpus/templates/chat/.agents/skills/actions/SKILL.md +55 -0
- package/corpus/templates/chat/app/components/layout/Layout.tsx +6 -6
- package/corpus/templates/chat/app/components/layout/Sidebar.tsx +12 -12
- package/corpus/templates/chat/app/components/ui/button.tsx +1 -0
- package/corpus/templates/chat/app/components/ui/card.tsx +1 -0
- package/corpus/templates/chat/app/components/ui/dropdown-menu.tsx +1 -0
- package/corpus/templates/chat/app/components/ui/input.tsx +1 -0
- package/corpus/templates/chat/app/components/ui/label.tsx +1 -0
- package/corpus/templates/chat/app/components/ui/sheet.tsx +1 -0
- package/corpus/templates/chat/app/components/ui/toolkit-provider.tsx +12 -0
- package/corpus/templates/chat/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/chat/app/global.css +1 -0
- package/corpus/templates/chat/app/root.tsx +7 -4
- package/corpus/templates/chat/app/routes/settings.tsx +6 -21
- package/corpus/templates/clips/.agents/skills/actions/SKILL.md +55 -0
- package/corpus/templates/clips/.agents/skills/video-sharing/SKILL.md +18 -4
- package/corpus/templates/clips/.env.example +8 -0
- package/corpus/templates/clips/actions/accept-invite.ts +3 -0
- package/corpus/templates/clips/actions/add-recording-to-space.ts +55 -27
- package/corpus/templates/clips/actions/add-vocabulary-term.ts +3 -1
- package/corpus/templates/clips/actions/archive-recording.ts +5 -12
- package/corpus/templates/clips/actions/cleanup-transcript.ts +5 -4
- package/corpus/templates/clips/actions/clear-edits.ts +42 -29
- package/corpus/templates/clips/actions/create-meeting.ts +87 -40
- package/corpus/templates/clips/actions/create-recording.ts +6 -3
- package/corpus/templates/clips/actions/delete-meeting.ts +25 -0
- package/corpus/templates/clips/actions/delete-recording-permanent.ts +3 -0
- package/corpus/templates/clips/actions/disconnect-calendar.ts +10 -4
- package/corpus/templates/clips/actions/export-insights-csv.ts +28 -8
- package/corpus/templates/clips/actions/finalize-meeting.ts +106 -33
- package/corpus/templates/clips/actions/finalize-recording.ts +201 -3
- package/corpus/templates/clips/actions/get-organization-insights.ts +51 -7
- package/corpus/templates/clips/actions/import-loom-recording.ts +17 -0
- package/corpus/templates/clips/actions/lib/audio-only-transcription.ts +18 -1
- package/corpus/templates/clips/actions/lib/create-recording-schema.ts +7 -1
- package/corpus/templates/clips/actions/lib/ensure-seekable-video.ts +16 -0
- package/corpus/templates/clips/actions/list-clip-views.ts +60 -0
- package/corpus/templates/clips/actions/regenerate-summary.ts +10 -0
- package/corpus/templates/clips/actions/remove-vocabulary-term.ts +59 -0
- package/corpus/templates/clips/actions/request-transcript.ts +170 -25
- package/corpus/templates/clips/actions/restore-recording.ts +5 -12
- package/corpus/templates/clips/actions/save-browser-transcript.ts +13 -2
- package/corpus/templates/clips/actions/set-chapters.ts +6 -15
- package/corpus/templates/clips/actions/set-thumbnail.ts +77 -36
- package/corpus/templates/clips/actions/split-recording.ts +49 -35
- package/corpus/templates/clips/actions/stitch-recordings.ts +7 -4
- package/corpus/templates/clips/actions/stop-meeting-recording.ts +15 -1
- package/corpus/templates/clips/actions/sync-calendars.ts +10 -108
- package/corpus/templates/clips/actions/trash-recording.ts +43 -14
- package/corpus/templates/clips/actions/trim-recording.ts +48 -27
- package/corpus/templates/clips/actions/undo-edit.ts +49 -37
- package/corpus/templates/clips/app/components/capture-install-options.tsx +6 -6
- package/corpus/templates/clips/app/components/dictate/vocabulary-section.tsx +208 -0
- package/corpus/templates/clips/app/components/editable-recording-title.tsx +2 -2
- package/corpus/templates/clips/app/components/editor/chapters-editor.tsx +7 -7
- package/corpus/templates/clips/app/components/editor/editor-toolbar.tsx +26 -26
- package/corpus/templates/clips/app/components/editor/split-button.tsx +5 -4
- package/corpus/templates/clips/app/components/editor/stitch-manager.tsx +9 -9
- package/corpus/templates/clips/app/components/editor/thumbnail-picker.tsx +11 -16
- package/corpus/templates/clips/app/components/editor/timeline.tsx +3 -3
- package/corpus/templates/clips/app/components/editor/transcript-editor.tsx +5 -5
- package/corpus/templates/clips/app/components/library/bulk-action-toolbar.tsx +4 -4
- package/corpus/templates/clips/app/components/library/create-space-dialog.tsx +8 -8
- package/corpus/templates/clips/app/components/library/empty-state.tsx +2 -1
- package/corpus/templates/clips/app/components/library/folder-tree.tsx +14 -14
- package/corpus/templates/clips/app/components/library/library-grid.tsx +24 -98
- package/corpus/templates/clips/app/components/library/library-layout.tsx +18 -19
- package/corpus/templates/clips/app/components/library/organization-switcher.tsx +11 -11
- package/corpus/templates/clips/app/components/library/recording-card.tsx +44 -50
- package/corpus/templates/clips/app/components/library/search-bar.tsx +5 -5
- package/corpus/templates/clips/app/components/library/sort-menu.tsx +4 -3
- package/corpus/templates/clips/app/components/library/tag-input.tsx +4 -4
- package/corpus/templates/clips/app/components/meetings/attendee-stack.tsx +2 -6
- package/corpus/templates/clips/app/components/meetings/auto-record-prompt.tsx +1 -1
- package/corpus/templates/clips/app/components/meetings/bullet-link.tsx +4 -4
- package/corpus/templates/clips/app/components/meetings/canvas-editor.tsx +5 -5
- package/corpus/templates/clips/app/components/meetings/meeting-card.tsx +3 -3
- package/corpus/templates/clips/app/components/meetings/quick-ask-sidebar.tsx +17 -9
- package/corpus/templates/clips/app/components/meetings/share-meeting-dialog.tsx +6 -11
- package/corpus/templates/clips/app/components/meetings/transcript-bubbles.tsx +215 -21
- package/corpus/templates/clips/app/components/player/access-password-prompt.tsx +3 -2
- package/corpus/templates/clips/app/components/player/comments-panel.tsx +14 -14
- package/corpus/templates/clips/app/components/player/delete-recording-menu.tsx +7 -6
- package/corpus/templates/clips/app/components/player/insights-panel.tsx +18 -6
- package/corpus/templates/clips/app/components/player/player-controls.tsx +42 -36
- package/corpus/templates/clips/app/components/player/reactions-tray.tsx +4 -4
- package/corpus/templates/clips/app/components/player/settings-panel.tsx +13 -12
- package/corpus/templates/clips/app/components/player/share-dialog.tsx +80 -49
- package/corpus/templates/clips/app/components/player/sign-in-prompt-dialog.tsx +3 -2
- package/corpus/templates/clips/app/components/player/timestamped-comment-button.tsx +2 -2
- package/corpus/templates/clips/app/components/player/transcript-panel.tsx +7 -7
- package/corpus/templates/clips/app/components/player/video-player.tsx +182 -15
- package/corpus/templates/clips/app/components/recorder/camera-visualizer.tsx +1 -1
- package/corpus/templates/clips/app/components/recorder/microphone-visualizer.tsx +1 -1
- package/corpus/templates/clips/app/components/recorder/pre-record-panel.tsx +49 -36
- package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +285 -24
- package/corpus/templates/clips/app/components/recorder/recording-toolbar.tsx +6 -5
- package/corpus/templates/clips/app/components/recorder/storage-setup-card.tsx +7 -6
- package/corpus/templates/clips/app/components/sharing/share-ui.tsx +10 -10
- package/corpus/templates/clips/app/components/sharing/viewed-by-popover.tsx +132 -0
- package/corpus/templates/clips/app/components/ui/alert-dialog.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/avatar.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/badge.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/button.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/card.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/checkbox.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/collapsible.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/context-menu.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/dialog.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/dropdown-menu.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/input.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/label.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/popover.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/scroll-area.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/select.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/separator.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/sheet.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/skeleton.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/slider.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/sonner.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/spinner.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/switch.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/table.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/tabs.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/textarea.tsx +1 -0
- package/corpus/templates/clips/app/components/ui/toolkit-provider.tsx +12 -0
- package/corpus/templates/clips/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/clips/app/components/workspace/branding-editor.tsx +5 -9
- package/corpus/templates/clips/app/components/workspace/insights-hub.tsx +9 -19
- package/corpus/templates/clips/app/components/workspace/invite-dialog.tsx +10 -9
- package/corpus/templates/clips/app/components/workspace/members-list.tsx +11 -10
- package/corpus/templates/clips/app/components/workspace/notifications-list.tsx +2 -1
- package/corpus/templates/clips/app/components/workspace/top-creators-table.tsx +3 -2
- package/corpus/templates/clips/app/components/workspace/top-videos-table.tsx +3 -2
- package/corpus/templates/clips/app/global.css +1 -0
- package/corpus/templates/clips/app/hooks/use-desktop-promo.ts +2 -1
- package/corpus/templates/clips/app/hooks/use-mobile.ts +1 -0
- package/corpus/templates/clips/app/hooks/use-player-shortcuts.ts +14 -10
- package/corpus/templates/clips/app/hooks/use-view-tracking.ts +14 -0
- package/corpus/templates/clips/app/i18n/ar-SA.ts +56 -0
- package/corpus/templates/clips/app/i18n/de-DE.ts +53 -0
- package/corpus/templates/clips/app/i18n/en-US.ts +52 -0
- package/corpus/templates/clips/app/i18n/es-ES.ts +53 -0
- package/corpus/templates/clips/app/i18n/fr-FR.ts +53 -0
- package/corpus/templates/clips/app/i18n/hi-IN.ts +52 -0
- package/corpus/templates/clips/app/i18n/ja-JP.ts +53 -0
- package/corpus/templates/clips/app/i18n/ko-KR.ts +52 -0
- package/corpus/templates/clips/app/i18n/pt-BR.ts +53 -0
- package/corpus/templates/clips/app/i18n/zh-CN.ts +51 -0
- package/corpus/templates/clips/app/i18n/zh-TW.ts +51 -0
- package/corpus/templates/clips/app/lib/recorder-preferences.ts +4 -0
- package/corpus/templates/clips/app/lib/timestamp-mapping.ts +5 -0
- package/corpus/templates/clips/app/root.tsx +26 -23
- package/corpus/templates/clips/app/routes/_app.dictate.tsx +39 -23
- package/corpus/templates/clips/app/routes/_app.meetings.$meetingId.tsx +134 -39
- package/corpus/templates/clips/app/routes/_app.meetings._index.tsx +20 -20
- package/corpus/templates/clips/app/routes/_app.notifications.tsx +3 -3
- package/corpus/templates/clips/app/routes/_app.settings._index.tsx +92 -60
- package/corpus/templates/clips/app/routes/_app.settings.organization.tsx +8 -13
- package/corpus/templates/clips/app/routes/_app.spaces._index.tsx +1 -1
- package/corpus/templates/clips/app/routes/_app.trash.tsx +96 -31
- package/corpus/templates/clips/app/routes/bug-report.done.tsx +1 -1
- package/corpus/templates/clips/app/routes/bug-report.tsx +11 -11
- package/corpus/templates/clips/app/routes/download.tsx +2 -2
- package/corpus/templates/clips/app/routes/embed.$shareId.tsx +2 -1
- package/corpus/templates/clips/app/routes/invite.$token.tsx +8 -13
- package/corpus/templates/clips/app/routes/r.$recordingId.tsx +263 -251
- package/corpus/templates/clips/app/routes/record.tsx +28 -10
- package/corpus/templates/clips/app/routes/share.$shareId.tsx +51 -29
- package/corpus/templates/clips/app/routes/share.meeting.$meetingId.tsx +71 -16
- package/corpus/templates/clips/changelog/2026-07-05-mobile-clip-pages-use-a-tighter-viewer-layout-with-inline-ac.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-ai-setup-now-switches-to-your-saved-provider-key-and-uses-fa.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-browsers-that-can-t-play-a-clip-s-video-format-now-see-a-cle.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-calendar-connections-no-longer-ask-you-to-reconnect-after-te.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-chrome-extension-recordings-keep-your-selected-microphone.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-clip-recordings-now-use-streaming-uploads-by-default.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-clip-titles-in-the-library-grid-now-open-the-clip-instead-of.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-desktop-countdown-now-dims-the-screen-before-recording.md +5 -0
- package/corpus/templates/clips/changelog/2026-07-06-desktop-popover-no-longer-drops-bluetooth-headphones-into-call-quality-mode.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-desktop-recorder-now-refreshes-cameras-and-mics-when-the-pop.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-desktop-recordings-keep-microphone-volume-clear-while-recor.md +5 -0
- package/corpus/templates/clips/changelog/2026-07-06-desktop-recordings-no-longer-get-stuck-optimizing-when-scree.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-dictation-history-from-the-desktop-app-now-appears-in-the-di.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-dictation-no-longer-overwrites-your-clipboard-and-messaging-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-double-tap-your-dictation-key-for-hands-free-dictation-tap-a.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-fixed-desktop-recordings-sometimes-uploading-without-audio-a.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-fixed-desktop-recordings-that-could-get-stuck-uploading-and-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-fixed-recordings-sometimes-capturing-from-the-wrong-micropho.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-hands-free-dictation-and-meeting-cleanup-recover-more-reliab.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-live-meetings-show-time-remaining-and-you-can-end-a-meeting-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-manage-your-personal-dictation-dictionary-from-the-dictate-t.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-meetings-interrupted-by-quitting-or-crashing-now-close-out-c.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-mic-only-desktop-recordings-now-use-the-selected-microphone-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-paste-your-last-dictation-anytime-with-cmd-ctrl-v-or-from-th.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-press-esc-to-cancel-a-dictation-in-progress.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-recordings-whose-video-file-contains-no-audio-track-no-longe.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-search-inside-meeting-transcripts.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-see-who-viewed-your-shared-clips-and-when-click-the-view-cou.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-share-links-for-agents-now-appear-as-soon-as-the-share-menu-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-share-popovers-now-stay-above-video-playback-controls.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-shared-clip-pages-now-recover-automatically-from-transient-v.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-the-desktop-app-now-walks-you-through-permissions-on-first-l.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-transcript-cleanup-preferences-now-save-per-user.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-transcripts-now-retry-automatically-after-transient-failures.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-06-video-compression-now-runs-in-the-background-without-blocking.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-07-native-microphone-recordings-now-reduce-steady-background-noise.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-07-recording-transcripts-now-line-up-with-the-video-start-afte.md +6 -0
- package/corpus/templates/clips/chrome-extension/public/manifest.json +1 -1
- package/corpus/templates/clips/chrome-extension/src/background.ts +141 -48
- package/corpus/templates/clips/chrome-extension/src/offscreen.ts +383 -59
- package/corpus/templates/clips/chrome-extension/src/overlay.ts +51 -10
- package/corpus/templates/clips/chrome-extension/src/popup.ts +57 -6
- package/corpus/templates/clips/desktop/package.json +1 -1
- package/corpus/templates/clips/desktop/scripts/sign-macos-local.ts +67 -0
- package/corpus/templates/clips/desktop/src/app.tsx +38 -13
- package/corpus/templates/clips/desktop/src/components/SourceRow.tsx +1 -0
- package/corpus/templates/clips/desktop/src/hooks/useMediaDevices.ts +88 -28
- package/corpus/templates/clips/desktop/src/hooks/useMeetingTranscription.ts +165 -55
- package/corpus/templates/clips/desktop/src/hooks/useMicMeter.ts +35 -10
- package/corpus/templates/clips/desktop/src/lib/backtrack.ts +12 -0
- package/corpus/templates/clips/desktop/src/lib/media-capture-constraints.ts +129 -34
- package/corpus/templates/clips/desktop/src/lib/media-device-selection.ts +157 -0
- package/corpus/templates/clips/desktop/src/lib/permissions.ts +2 -0
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +109 -47
- package/corpus/templates/clips/desktop/src/lib/transcription-capture.ts +22 -2
- package/corpus/templates/clips/desktop/src/lib/transcription-engine.ts +29 -1
- package/corpus/templates/clips/desktop/src/lib/updater.ts +6 -0
- package/corpus/templates/clips/desktop/src/lib/voice-dictation.ts +372 -31
- package/corpus/templates/clips/desktop/src/overlays/finalizing.tsx +90 -0
- package/corpus/templates/clips/desktop/src/overlays/flow-bar.tsx +4 -6
- package/corpus/templates/clips/desktop/src/overlays/onboarding.tsx +214 -9
- package/corpus/templates/clips/desktop/src/overlays/recording-pill.tsx +37 -52
- package/corpus/templates/clips/desktop/src/styles.css +1 -1
- package/corpus/templates/clips/desktop/src-tauri/Cargo.toml +7 -0
- package/corpus/templates/clips/desktop/src-tauri/src/clips/mod.rs +371 -43
- package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +79 -0
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +1418 -260
- package/corpus/templates/clips/desktop/src-tauri/src/native_speech.rs +188 -44
- package/corpus/templates/clips/desktop/src-tauri/src/shortcuts.rs +197 -8
- package/corpus/templates/clips/desktop/src-tauri/src/silence_detector.rs +64 -8
- package/corpus/templates/clips/desktop/src-tauri/src/state.rs +3 -2
- package/corpus/templates/clips/desktop/src-tauri/src/system_audio.rs +10 -0
- package/corpus/templates/clips/desktop/src-tauri/src/tray.rs +29 -8
- package/corpus/templates/clips/desktop/src-tauri/src/whisper_speech.rs +136 -13
- package/corpus/templates/clips/desktop/vite.config.ts +3 -0
- package/corpus/templates/clips/package.json +1 -1
- package/corpus/templates/clips/server/db/schema.ts +26 -0
- package/corpus/templates/clips/server/jobs/builder-media-compression.ts +41 -0
- package/corpus/templates/clips/server/jobs/stale-meeting-sweeper.ts +294 -0
- package/corpus/templates/clips/server/lib/builder-media-compression.ts +976 -0
- package/corpus/templates/clips/server/lib/calendar-event-meetings.ts +107 -56
- package/corpus/templates/clips/server/lib/env-flags.ts +4 -0
- package/corpus/templates/clips/server/lib/google-calendar-client.ts +8 -1
- package/corpus/templates/clips/server/lib/media-worker.ts +153 -0
- package/corpus/templates/clips/server/lib/s3-upload-provider.ts +58 -17
- package/corpus/templates/clips/server/lib/streaming-upload-mode.ts +17 -5
- package/corpus/templates/clips/server/lib/video-remux.ts +90 -0
- package/corpus/templates/clips/server/plugins/calendar-jobs.ts +4 -0
- package/corpus/templates/clips/server/plugins/db.ts +196 -0
- package/corpus/templates/clips/server/register-secrets.ts +78 -0
- package/corpus/templates/clips/server/routes/_agent-native/clips/user-prefs.get.ts +15 -0
- package/corpus/templates/clips/server/routes/_agent-native/clips/user-prefs.put.ts +27 -0
- package/corpus/templates/clips/server/routes/api/media-worker/callback.post.ts +88 -0
- package/corpus/templates/clips/server/routes/api/public-recording.get.ts +87 -7
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/abort.post.ts +7 -0
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/chunk.post.ts +35 -10
- package/corpus/templates/clips/server/routes/api/video/[recordingId].get.ts +24 -42
- package/corpus/templates/clips/server/routes/api/view-event.post.ts +29 -1
- package/corpus/templates/clips/shared/media-device-selection.ts +157 -0
- package/corpus/templates/clips/shared/media-worker-contract.ts +146 -0
- package/corpus/templates/content/.agents/skills/actions/SKILL.md +55 -0
- package/corpus/templates/content/.agents/skills/notion-integration/SKILL.md +67 -2
- package/corpus/templates/content/AGENTS.md +22 -14
- package/corpus/templates/content/actions/_local-file-documents.ts +90 -1
- package/corpus/templates/content/actions/_notion-action-utils.ts +6 -2
- package/corpus/templates/content/actions/delete-document.ts +8 -0
- package/corpus/templates/content/actions/remove-local-file-source.ts +100 -0
- package/corpus/templates/content/actions/sync-notion-comments.ts +174 -20
- package/corpus/templates/content/actions/update-document.ts +91 -5
- package/corpus/templates/content/app/blocks/SourceComponentBlock.tsx +31 -3
- package/corpus/templates/content/app/blocks/contentBlockRegistry.tsx +4 -4
- package/corpus/templates/content/app/components/EmptyState.tsx +1 -1
- package/corpus/templates/content/app/components/ThemeToggle.tsx +6 -6
- package/corpus/templates/content/app/components/editor/BubbleToolbar.tsx +5 -5
- package/corpus/templates/content/app/components/editor/CommentsSidebar.tsx +5 -5
- package/corpus/templates/content/app/components/editor/ContentReferencePreview.tsx +1 -1
- package/corpus/templates/content/app/components/editor/DocumentDatabase.tsx +10 -14630
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +72 -51
- package/corpus/templates/content/app/components/editor/DocumentEditorSkeleton.tsx +36 -0
- package/corpus/templates/content/app/components/editor/DocumentProperties.tsx +29 -29
- package/corpus/templates/content/app/components/editor/DocumentToolbar.tsx +29 -44
- package/corpus/templates/content/app/components/editor/EmojiPicker.tsx +5 -4
- package/corpus/templates/content/app/components/editor/LinkHoverPreview.tsx +5 -4
- package/corpus/templates/content/app/components/editor/NotionConflictBanner.tsx +1 -1
- package/corpus/templates/content/app/components/editor/NotionSyncBar.tsx +2 -2
- package/corpus/templates/content/app/components/editor/SlashCommandMenu.tsx +5 -5
- package/corpus/templates/content/app/components/editor/TableHoverControls.tsx +13 -13
- package/corpus/templates/content/app/components/editor/VersionHistoryPanel.tsx +10 -10
- package/corpus/templates/content/app/components/editor/VisualEditor.tsx +24 -7
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +2856 -8389
- package/corpus/templates/content/app/components/editor/database/navigation-state.ts +36 -1
- package/corpus/templates/content/app/components/editor/database/settings.tsx +3224 -0
- package/corpus/templates/content/app/components/editor/database/shared.tsx +19 -19
- package/corpus/templates/content/app/components/editor/database/text.ts +23 -0
- package/corpus/templates/content/app/components/editor/database-sources/BuilderSourceReviewDialog.tsx +9 -8
- package/corpus/templates/content/app/components/editor/extensions/AudioBlock.tsx +19 -18
- package/corpus/templates/content/app/components/editor/extensions/ImageBlock.tsx +21 -20
- package/corpus/templates/content/app/components/editor/extensions/LocalMdxComponentNode.tsx +8 -8
- package/corpus/templates/content/app/components/editor/extensions/NotionExtensions.tsx +9 -0
- package/corpus/templates/content/app/components/editor/extensions/VideoBlock.tsx +19 -18
- package/corpus/templates/content/app/components/layout/Header.tsx +1 -5
- package/corpus/templates/content/app/components/layout/Layout.tsx +25 -8
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +203 -55
- package/corpus/templates/content/app/components/sidebar/DocumentTreeItem.tsx +22 -22
- package/corpus/templates/content/app/components/sidebar/NotionButton.tsx +11 -11
- package/corpus/templates/content/app/components/sidebar/document-sidebar-sections.ts +109 -1
- package/corpus/templates/content/app/components/ui/alert-dialog.tsx +1 -0
- package/corpus/templates/content/app/components/ui/button.tsx +1 -0
- package/corpus/templates/content/app/components/ui/dialog.tsx +1 -0
- package/corpus/templates/content/app/components/ui/dropdown-menu.tsx +1 -0
- package/corpus/templates/content/app/components/ui/input.tsx +1 -0
- package/corpus/templates/content/app/components/ui/label.tsx +1 -0
- package/corpus/templates/content/app/components/ui/popover.tsx +1 -0
- package/corpus/templates/content/app/components/ui/separator.tsx +1 -0
- package/corpus/templates/content/app/components/ui/sheet.tsx +1 -0
- package/corpus/templates/content/app/components/ui/skeleton.tsx +1 -0
- package/corpus/templates/content/app/components/ui/sonner.tsx +1 -0
- package/corpus/templates/content/app/components/ui/spinner.tsx +1 -0
- package/corpus/templates/content/app/components/ui/table.tsx +1 -0
- package/corpus/templates/content/app/components/ui/toaster.tsx +1 -0
- package/corpus/templates/content/app/components/ui/toolkit-provider.tsx +12 -0
- package/corpus/templates/content/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/content/app/global.css +1 -0
- package/corpus/templates/content/app/hooks/use-documents.ts +89 -37
- package/corpus/templates/content/app/hooks/use-mobile.ts +1 -0
- package/corpus/templates/content/app/hooks/use-notion.ts +73 -5
- package/corpus/templates/content/app/i18n/zh-TW.ts +14 -0
- package/corpus/templates/content/app/i18n-data.ts +153 -0
- package/corpus/templates/content/app/root.tsx +35 -29
- package/corpus/templates/content/app/routes/_app._index.tsx +1 -1
- package/corpus/templates/content/app/routes/_app.local-files.tsx +268 -81
- package/corpus/templates/content/app/routes/_app.settings.tsx +4 -21
- package/corpus/templates/content/app/routes/p.$id.tsx +114 -9
- package/corpus/templates/content/changelog/2026-07-01-builder-source-components-show-preservation-and-review-states.md +6 -0
- package/corpus/templates/content/changelog/2026-07-06-document-headers-and-page-bodies-now-share-one-background-shade.md +6 -0
- package/corpus/templates/content/changelog/2026-07-06-export-submenus-stay-visible-outside-the-page-actions-menu.md +6 -0
- package/corpus/templates/content/changelog/2026-07-06-fixed-collaborative-documents-reapplying-content-before-save.md +6 -0
- package/corpus/templates/content/changelog/2026-07-06-local-files-now-remember-sidebar-collapse-state-and-include-.md +6 -0
- package/corpus/templates/content/changelog/2026-07-06-notion-comment-sync-now-preserves-threads-replies-stay-attac.md +6 -0
- package/corpus/templates/content/changelog/2026-07-06-notion-sync-is-far-more-reliable-auto-sync-no-longer-overwri.md +6 -0
- package/corpus/templates/content/changelog/2026-07-06-opening-pages-now-highlights-the-sidebar-item-and-shows-the-.md +6 -0
- package/corpus/templates/content/changelog/2026-07-06-presence-markers-in-the-editor-are-now-compact-instead-of-co.md +6 -0
- package/corpus/templates/content/changelog/2026-07-06-sidebar-collapse-now-keeps-the-same-background-shade-as-the-.md +6 -0
- package/corpus/templates/content/changelog/2026-07-06-the-content-header-no-longer-shows-the-global-notifications-.md +6 -0
- package/corpus/templates/content/parity/matrix.md +24 -24
- package/corpus/templates/content/parity/matrix.ts +7 -3
- package/corpus/templates/content/server/db/index.ts +9 -0
- package/corpus/templates/content/server/db/schema.ts +15 -0
- package/corpus/templates/content/server/lib/notion-sync.ts +481 -39
- package/corpus/templates/content/server/lib/notion.ts +212 -48
- package/corpus/templates/content/server/plugins/db.ts +20 -0
- package/corpus/templates/content/server/routes/api/document-agent-context.json.get.ts +90 -0
- package/corpus/templates/content/server/routes/api/documents/[id]/notion/resolve.post.ts +14 -2
- package/corpus/templates/content/server/routes/api/notion/callback.get.ts +54 -6
- package/corpus/templates/content/shared/agent-readable.ts +56 -0
- package/corpus/templates/content/shared/builder-mdx.ts +68 -12
- package/corpus/templates/content/shared/builder-source-component-registry.ts +177 -0
- package/corpus/templates/content/shared/nfm.ts +459 -66
- package/corpus/templates/content/shared/source-component-block.ts +72 -6
- package/corpus/templates/content/vite.config.ts +17 -1
- package/corpus/templates/design/.agents/skills/actions/SKILL.md +55 -0
- package/corpus/templates/design/.agents/skills/design-generation/SKILL.md +21 -12
- package/corpus/templates/design/AGENTS.md +3 -2
- package/corpus/templates/design/actions/import-design-source.ts +8 -58
- package/corpus/templates/design/actions/run-design-audit.ts +127 -1
- package/corpus/templates/design/actions/take-design-screenshot.ts +673 -0
- package/corpus/templates/design/app/components/ThemeToggle.tsx +6 -6
- package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +11 -11
- package/corpus/templates/design/app/components/design/DesignEditorSkeleton.tsx +2 -2
- package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +16 -21
- package/corpus/templates/design/app/components/design/DesignImportPanel.tsx +6 -97
- package/corpus/templates/design/app/components/design/DrawOverlay.tsx +7 -7
- package/corpus/templates/design/app/components/design/EditPanel.tsx +30 -30
- package/corpus/templates/design/app/components/design/FusionAppBanner.tsx +9 -8
- package/corpus/templates/design/app/components/design/LayersPanel.tsx +14 -14
- package/corpus/templates/design/app/components/design/LocalhostWriteConsentDialog.tsx +6 -5
- package/corpus/templates/design/app/components/design/MotionDock.tsx +15 -15
- package/corpus/templates/design/app/components/design/QuestionFlow.tsx +3 -3
- package/corpus/templates/design/app/components/design/ReviewPanel.tsx +3 -3
- package/corpus/templates/design/app/components/design/StatesPanel.tsx +13 -13
- package/corpus/templates/design/app/components/design/TokensPanel.tsx +14 -14
- package/corpus/templates/design/app/components/design/TweaksPanel.tsx +6 -6
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +39 -9
- package/corpus/templates/design/app/components/design/code-workbench/ActivityBar.tsx +3 -3
- package/corpus/templates/design/app/components/design/code-workbench/SideBar.tsx +4 -7
- package/corpus/templates/design/app/components/design/code-workbench/editor/EditorTabs.tsx +6 -6
- package/corpus/templates/design/app/components/design/code-workbench/editor/MonacoHost.tsx +2 -1
- package/corpus/templates/design/app/components/design/code-workbench/explorer/FileTree.tsx +17 -17
- package/corpus/templates/design/app/components/design/code-workbench/search/SearchView.tsx +6 -6
- package/corpus/templates/design/app/components/design/inspector/AlignmentMatrix.tsx +3 -3
- package/corpus/templates/design/app/components/design/inspector/AutoLayoutMatrix.tsx +7 -7
- package/corpus/templates/design/app/components/design/inspector/ConstraintsWidget.tsx +3 -3
- package/corpus/templates/design/app/components/design/inspector/DesignColorPicker.tsx +18 -18
- package/corpus/templates/design/app/components/design/inspector/ExportSettingsPanel.tsx +6 -6
- package/corpus/templates/design/app/components/design/inspector/ImageFillControls.tsx +6 -6
- package/corpus/templates/design/app/components/design/inspector/InspectorAiActions.tsx +7 -7
- package/corpus/templates/design/app/components/design/inspector/ScrubInput.tsx +7 -7
- package/corpus/templates/design/app/components/design/inspector/ShaderControls.tsx +14 -14
- package/corpus/templates/design/app/components/design/inspector/ShaderEffectRow.tsx +9 -9
- package/corpus/templates/design/app/components/design/inspector/ShaderFillsPanel.tsx +6 -6
- package/corpus/templates/design/app/components/design-system/DesignSystemCard.tsx +3 -2
- package/corpus/templates/design/app/components/editor/PromptDialog.tsx +15 -18
- package/corpus/templates/design/app/components/layout/Header.tsx +2 -2
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +5 -5
- package/corpus/templates/design/app/components/ui/alert-dialog.tsx +1 -0
- package/corpus/templates/design/app/components/ui/avatar.tsx +1 -0
- package/corpus/templates/design/app/components/ui/badge.tsx +1 -0
- package/corpus/templates/design/app/components/ui/button.tsx +1 -0
- package/corpus/templates/design/app/components/ui/card.tsx +1 -0
- package/corpus/templates/design/app/components/ui/checkbox.tsx +1 -0
- package/corpus/templates/design/app/components/ui/collapsible.tsx +1 -0
- package/corpus/templates/design/app/components/ui/context-menu.tsx +1 -0
- package/corpus/templates/design/app/components/ui/dialog.tsx +1 -0
- package/corpus/templates/design/app/components/ui/dropdown-menu.tsx +1 -0
- package/corpus/templates/design/app/components/ui/input.tsx +1 -0
- package/corpus/templates/design/app/components/ui/label.tsx +1 -0
- package/corpus/templates/design/app/components/ui/popover.tsx +1 -0
- package/corpus/templates/design/app/components/ui/select.tsx +1 -0
- package/corpus/templates/design/app/components/ui/separator.tsx +1 -0
- package/corpus/templates/design/app/components/ui/sheet.tsx +1 -0
- package/corpus/templates/design/app/components/ui/skeleton.tsx +1 -0
- package/corpus/templates/design/app/components/ui/slider.tsx +1 -0
- package/corpus/templates/design/app/components/ui/sonner.tsx +1 -0
- package/corpus/templates/design/app/components/ui/spinner.tsx +1 -0
- package/corpus/templates/design/app/components/ui/switch.tsx +1 -0
- package/corpus/templates/design/app/components/ui/tabs.tsx +1 -0
- package/corpus/templates/design/app/components/ui/textarea.tsx +1 -0
- package/corpus/templates/design/app/components/ui/toolkit-provider.tsx +12 -0
- package/corpus/templates/design/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/design/app/components/visual-editor/CanvasCommentPins.tsx +7 -7
- package/corpus/templates/design/app/components/visual-editor/DrawOverlay.tsx +7 -7
- package/corpus/templates/design/app/components/visual-editor/SaveStatusIndicator.tsx +3 -3
- package/corpus/templates/design/app/global.css +1 -0
- package/corpus/templates/design/app/i18n/zh-TW.ts +3 -4
- package/corpus/templates/design/app/i18n-data.ts +38 -35
- package/corpus/templates/design/app/pages/DesignEditor.tsx +47 -51
- package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +6 -6
- package/corpus/templates/design/app/pages/DesignSystems.tsx +31 -31
- package/corpus/templates/design/app/pages/Index.tsx +25 -29
- package/corpus/templates/design/app/pages/NotFound.tsx +2 -1
- package/corpus/templates/design/app/pages/Present.tsx +2 -1
- package/corpus/templates/design/app/pages/VisualEdit.tsx +2 -1
- package/corpus/templates/design/app/root.tsx +7 -4
- package/corpus/templates/design/app/routes/settings.tsx +22 -49
- package/corpus/templates/design/changelog/2026-07-05-code-sidebar-tabs-now-use-a-quieter-active-highlight-that-ma.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-fig-files-now-stay-on-the-builder-indexing-path-through-desi.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-mobile-layouts-no-longer-stack-two-top-headers.md +5 -0
- package/corpus/templates/design/changelog/2026-07-06-the-design-agent-now-visually-reviews-rendered-screenshots-o.md +6 -0
- package/corpus/templates/design/server/db/index.ts +8 -0
- package/corpus/templates/design/server/handlers/import-design-file.ts +4 -43
- package/corpus/templates/design/server/handlers/index-design-system-with-builder.ts +2 -2
- package/corpus/templates/design/server/lib/visible-clipboard-html.ts +32 -0
- package/corpus/templates/design/server/routes/[...page].get.ts +94 -1
- package/corpus/templates/design/server/routes/api/design-agent-context.json.get.ts +84 -0
- package/corpus/templates/design/shared/agent-readable.ts +2 -0
- package/corpus/templates/design/shared/design-review.ts +1 -0
- package/corpus/templates/dispatch/.agents/skills/actions/SKILL.md +55 -0
- package/corpus/templates/dispatch/actions/list-staged-datasets.ts +3 -0
- package/corpus/templates/dispatch/app/routes/settings.tsx +3 -17
- package/corpus/templates/forms/.agents/skills/actions/SKILL.md +55 -0
- package/corpus/templates/forms/app/components/CloudUpgrade.tsx +10 -10
- package/corpus/templates/forms/app/components/ThemeToggle.tsx +5 -5
- package/corpus/templates/forms/app/components/builder/FieldPropertiesPanel.tsx +11 -10
- package/corpus/templates/forms/app/components/builder/FieldRenderer.tsx +10 -13
- package/corpus/templates/forms/app/components/layout/Sidebar.tsx +17 -17
- package/corpus/templates/forms/app/components/ui/alert-dialog.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/badge.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/button.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/calendar.tsx +1 -1
- package/corpus/templates/forms/app/components/ui/card.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/checkbox.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/command.tsx +1 -1
- package/corpus/templates/forms/app/components/ui/dialog.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/dropdown-menu.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/input.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/label.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/popover.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/radio-group.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/scroll-area.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/select.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/separator.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/skeleton.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/slider.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/switch.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/table.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/tabs.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/textarea.tsx +1 -0
- package/corpus/templates/forms/app/components/ui/toolkit-provider.tsx +12 -0
- package/corpus/templates/forms/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/forms/app/global.css +1 -0
- package/corpus/templates/forms/app/hooks/use-mobile.ts +1 -0
- package/corpus/templates/forms/app/hooks/use-navigation-state.ts +0 -1
- package/corpus/templates/forms/app/pages/FormBuilderPage.tsx +24 -26
- package/corpus/templates/forms/app/pages/FormFillPage.tsx +2 -2
- package/corpus/templates/forms/app/pages/FormsListPage.tsx +21 -21
- package/corpus/templates/forms/app/pages/ResponseInsightsPage.tsx +11 -11
- package/corpus/templates/forms/app/pages/ResponsesPage.tsx +4 -4
- package/corpus/templates/forms/app/root.tsx +11 -8
- package/corpus/templates/forms/app/routes/_app.settings.tsx +6 -21
- package/corpus/templates/forms/app/routes/form-preview.tsx +3 -3
- package/corpus/templates/forms/changelog/2026-07-06-the-form-builder-header-no-longer-shows-the-global-notificat.md +6 -0
- package/corpus/templates/macros/app/components/AddExerciseDialog.tsx +1 -1
- package/corpus/templates/macros/app/components/AddMealDialog.tsx +1 -1
- package/corpus/templates/macros/app/components/AddWeightDialog.tsx +1 -1
- package/corpus/templates/macros/app/components/DailyProgress.tsx +7 -7
- package/corpus/templates/macros/app/components/WeeklyCaloriesChart.tsx +2 -1
- package/corpus/templates/macros/app/components/WeightCard.tsx +10 -10
- package/corpus/templates/macros/app/components/WeightTracker.tsx +1 -1
- package/corpus/templates/macros/app/components/layout/AppLayout.tsx +6 -10
- package/corpus/templates/macros/app/components/ui/alert-dialog.tsx +1 -0
- package/corpus/templates/macros/app/components/ui/label.tsx +1 -0
- package/corpus/templates/macros/app/components/ui/select.tsx +1 -0
- package/corpus/templates/macros/app/components/ui/sheet.tsx +1 -0
- package/corpus/templates/macros/app/components/ui/skeleton.tsx +1 -0
- package/corpus/templates/macros/app/components/ui/sonner.tsx +1 -0
- package/corpus/templates/macros/app/components/ui/toolkit-provider.tsx +12 -0
- package/corpus/templates/macros/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/macros/app/global.css +1 -0
- package/corpus/templates/macros/app/root.tsx +17 -14
- package/corpus/templates/macros/app/routes/_index.tsx +1 -1
- package/corpus/templates/macros/app/routes/analytics.tsx +8 -8
- package/corpus/templates/macros/app/routes/settings.tsx +4 -19
- package/corpus/templates/mail/.agents/skills/actions/SKILL.md +55 -0
- package/corpus/templates/mail/.agents/skills/contacts-and-crm/SKILL.md +67 -0
- package/corpus/templates/mail/.agents/skills/draft-queue/SKILL.md +35 -1
- package/corpus/templates/mail/.agents/skills/email-drafts/SKILL.md +74 -33
- package/corpus/templates/mail/AGENTS.md +102 -16
- package/corpus/templates/mail/actions/archive-email.ts +67 -11
- package/corpus/templates/mail/actions/manage-snippets.ts +106 -0
- package/corpus/templates/mail/actions/mark-read.ts +45 -11
- package/corpus/templates/mail/actions/send-queued-drafts.ts +77 -42
- package/corpus/templates/mail/actions/star-email.ts +55 -10
- package/corpus/templates/mail/actions/trash-email.ts +48 -9
- package/corpus/templates/mail/app/components/GoogleConnectBanner.tsx +1 -1
- package/corpus/templates/mail/app/components/ThemeToggle.tsx +6 -6
- package/corpus/templates/mail/app/components/agent-engine-picker.tsx +10 -10
- package/corpus/templates/mail/app/components/email/CodeBlockLangPicker.tsx +4 -3
- package/corpus/templates/mail/app/components/email/ComposeBubbleToolbar.tsx +5 -5
- package/corpus/templates/mail/app/components/email/ComposeEditor.tsx +109 -10
- package/corpus/templates/mail/app/components/email/ComposeModal.tsx +44 -19
- package/corpus/templates/mail/app/components/email/ComposeSlashMenu.tsx +139 -17
- package/corpus/templates/mail/app/components/email/EmailList.tsx +522 -314
- package/corpus/templates/mail/app/components/email/EmailListItem.tsx +130 -45
- package/corpus/templates/mail/app/components/email/EmailThread.tsx +9 -9
- package/corpus/templates/mail/app/components/email/InlineReplyComposer.tsx +35 -13
- package/corpus/templates/mail/app/components/email/IntegrationsSidebar.tsx +13 -13
- package/corpus/templates/mail/app/components/email/MobileActionBar.tsx +13 -13
- package/corpus/templates/mail/app/components/email/RecipientInput.tsx +53 -42
- package/corpus/templates/mail/app/components/email/SendLaterButton.tsx +5 -4
- package/corpus/templates/mail/app/components/email/SnoozeModal.tsx +1 -1
- package/corpus/templates/mail/app/components/email/SnoozePopover.tsx +6 -6
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +19 -23
- package/corpus/templates/mail/app/components/layout/HeaderActions.tsx +12 -4
- package/corpus/templates/mail/app/components/layout/SearchBar.tsx +138 -18
- package/corpus/templates/mail/app/components/settings/GmailFiltersSection.tsx +23 -23
- package/corpus/templates/mail/app/components/settings/SnippetsSection.tsx +303 -0
- package/corpus/templates/mail/app/components/ui/alert-dialog.tsx +1 -0
- package/corpus/templates/mail/app/components/ui/badge.tsx +1 -0
- package/corpus/templates/mail/app/components/ui/button.tsx +1 -0
- package/corpus/templates/mail/app/components/ui/calendar.tsx +1 -1
- package/corpus/templates/mail/app/components/ui/command.tsx +1 -1
- package/corpus/templates/mail/app/components/ui/dialog.tsx +1 -0
- package/corpus/templates/mail/app/components/ui/drawer.tsx +1 -0
- package/corpus/templates/mail/app/components/ui/dropdown-menu.tsx +1 -0
- package/corpus/templates/mail/app/components/ui/popover.tsx +1 -0
- package/corpus/templates/mail/app/components/ui/select.tsx +1 -0
- package/corpus/templates/mail/app/components/ui/skeleton.tsx +1 -0
- package/corpus/templates/mail/app/components/ui/spinner.tsx +1 -0
- package/corpus/templates/mail/app/components/ui/switch.tsx +1 -0
- package/corpus/templates/mail/app/components/ui/toolkit-provider.tsx +12 -0
- package/corpus/templates/mail/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/mail/app/global.css +20 -3
- package/corpus/templates/mail/app/hooks/use-emails.ts +187 -0
- package/corpus/templates/mail/app/hooks/use-snippets.ts +103 -0
- package/corpus/templates/mail/app/i18n/ar-SA.ts +17 -0
- package/corpus/templates/mail/app/i18n/de-DE.ts +18 -0
- package/corpus/templates/mail/app/i18n/en-US.ts +17 -0
- package/corpus/templates/mail/app/i18n/es-ES.ts +17 -0
- package/corpus/templates/mail/app/i18n/fr-FR.ts +18 -0
- package/corpus/templates/mail/app/i18n/hi-IN.ts +17 -0
- package/corpus/templates/mail/app/i18n/ja-JP.ts +18 -0
- package/corpus/templates/mail/app/i18n/ko-KR.ts +17 -0
- package/corpus/templates/mail/app/i18n/pt-BR.ts +17 -0
- package/corpus/templates/mail/app/i18n/zh-CN.ts +16 -0
- package/corpus/templates/mail/app/i18n/zh-TW.ts +16 -0
- package/corpus/templates/mail/app/pages/DraftQueuePage.tsx +14 -14
- package/corpus/templates/mail/app/pages/InboxPage.tsx +3 -3
- package/corpus/templates/mail/app/pages/NotFound.tsx +2 -1
- package/corpus/templates/mail/app/pages/SettingsPage.tsx +64 -66
- package/corpus/templates/mail/app/root.tsx +21 -18
- package/corpus/templates/mail/app/routes/_index.tsx +2 -1
- package/corpus/templates/mail/app/routes/email.tsx +2 -2
- package/corpus/templates/mail/changelog/2026-07-06-a-queued-draft-can-no-longer-be-sent-twice-by-simultaneous-s.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-06-bulk-archive-trash-star-and-mark-read-now-complete-in-one-fa.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-06-dark-mode-sidebars-and-notifications-now-use-the-softer-gray.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-06-inbox-automations-pick-up-new-mail-faster.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-06-inbox-lists-stay-fast-as-scheduled-and-snoozed-mail-accumula.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-06-long-inboxes-scroll-smoothly-and-stay-fast-as-more-mail-load.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-06-paste-or-drop-images-straight-into-the-composer-to-send-them.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-06-save-reusable-snippets-and-insert-them-from-the-compose-slas.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-06-scrolling-older-mail-keeps-loading-correctly-when-no-gmail-a.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-06-search-shows-instant-matches-from-already-loaded-mail-while-.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-06-sends-now-fail-with-a-clear-error-instead-of-quietly-missing.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-06-the-mail-header-no-longer-shows-the-global-notifications-bel.md +6 -0
- package/corpus/templates/mail/package.json +1 -0
- package/corpus/templates/mail/server/db/schema.ts +11 -0
- package/corpus/templates/mail/server/handlers/emails.ts +20 -1
- package/corpus/templates/mail/server/lib/automation-engine.ts +53 -25
- package/corpus/templates/mail/server/lib/google-auth.ts +140 -9
- package/corpus/templates/mail/server/lib/jobs.ts +22 -6
- package/corpus/templates/mail/server/lib/outgoing-email.ts +11 -2
- package/corpus/templates/mail/server/lib/queued-drafts.ts +145 -4
- package/corpus/templates/mail/server/plugins/db.ts +29 -0
- package/corpus/templates/plan/.agents/skills/actions/SKILL.md +55 -0
- package/corpus/templates/plan/app/components/editor/PlanDocumentEditor.tsx +42 -3
- package/corpus/templates/plan/app/components/layout/Layout.tsx +5 -4
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +20 -20
- package/corpus/templates/plan/app/components/plan/CanvasArea.tsx +3 -2
- package/corpus/templates/plan/app/components/plan/DocumentArea.tsx +2 -2
- package/corpus/templates/plan/app/components/plan/GuestModeBanner.tsx +2 -1
- package/corpus/templates/plan/app/components/plan/LocalCodebasePicker.tsx +8 -8
- package/corpus/templates/plan/app/components/plan/PlanContentRenderer.tsx +6 -1
- package/corpus/templates/plan/app/components/plan/PlanImageViewer.tsx +8 -12
- package/corpus/templates/plan/app/components/plan/PlanMarkdownEditor.tsx +6 -1
- package/corpus/templates/plan/app/components/plan/PlanVisualSurface.tsx +3 -3
- package/corpus/templates/plan/app/components/plan/planBlocks.tsx +4 -4
- package/corpus/templates/plan/app/components/plan/wireframe/kit/rough.tsx +61 -27
- package/corpus/templates/plan/app/components/ui/alert-dialog.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/avatar.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/badge.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/button.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/card.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/checkbox.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/collapsible.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/dialog.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/dropdown-menu.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/input.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/label.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/popover.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/scroll-area.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/select.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/separator.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/sheet.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/skeleton.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/sonner.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/spinner.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/textarea.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/toggle-group.tsx +1 -0
- package/corpus/templates/plan/app/components/ui/toolkit-provider.tsx +12 -0
- package/corpus/templates/plan/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/plan/app/global.css +13 -0
- package/corpus/templates/plan/app/hooks/use-plan-presence.ts +11 -1
- package/corpus/templates/plan/app/lib/plan-access-prompt.ts +74 -0
- package/corpus/templates/plan/app/lib/plan-annotation-runtime.ts +1435 -0
- package/corpus/templates/plan/app/lib/plan-comment-editor-helpers.ts +142 -0
- package/corpus/templates/plan/app/lib/plan-local-bridge.ts +376 -0
- package/corpus/templates/plan/app/lib/plan-native-anchors.ts +682 -0
- package/corpus/templates/plan/app/pages/PlansPage.tsx +216 -2747
- package/corpus/templates/plan/app/root.tsx +13 -10
- package/corpus/templates/plan/app/routes/_index.tsx +1 -2
- package/corpus/templates/plan/app/routes/local-plans.$slug.tsx +1 -1
- package/corpus/templates/plan/app/routes/plans.$id.tsx +1 -2
- package/corpus/templates/plan/app/routes/plans.tsx +1 -2
- package/corpus/templates/plan/app/routes/recaps.$id.tsx +1 -2
- package/corpus/templates/plan/app/routes/recaps.tsx +1 -2
- package/corpus/templates/plan/app/routes/settings.tsx +7 -21
- package/corpus/templates/plan/changelog/2026-07-05-plan-pages-open-at-the-top-unless-a-shared-link-targets-a-sp.md +6 -0
- package/corpus/templates/plan/changelog/2026-07-06-fixed-collaborative-plan-editing-so-content-no-longer-duplic.md +6 -0
- package/corpus/templates/plan/changelog/2026-07-06-fixed-visual-reports-using-excessive-cpu-while-rendering-ske.md +6 -0
- package/corpus/templates/plan/server/db/index.ts +12 -0
- package/corpus/templates/plan/server/plans.ts +25 -1
- package/corpus/templates/plan/server/routes/[...page].get.ts +107 -1
- package/corpus/templates/plan/server/routes/api/plan-agent-context.json.get.ts +65 -0
- package/corpus/templates/plan/shared/agent-readable.ts +2 -0
- package/corpus/templates/slides/.agents/skills/actions/SKILL.md +55 -0
- package/corpus/templates/slides/app/components/ThemeToggle.tsx +6 -6
- package/corpus/templates/slides/app/components/comments/SlideCommentsPanel.tsx +5 -5
- package/corpus/templates/slides/app/components/deck/DeckCard.tsx +7 -7
- package/corpus/templates/slides/app/components/deck/ExcalidrawSlide.tsx +2 -1
- package/corpus/templates/slides/app/components/deck/SlideRenderer.tsx +1 -1
- package/corpus/templates/slides/app/components/design-system/DesignSystemCard.tsx +3 -2
- package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +15 -14
- package/corpus/templates/slides/app/components/editor/AnimationsPanel.tsx +7 -7
- package/corpus/templates/slides/app/components/editor/BlockBubbleMenu.tsx +5 -5
- package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +6 -6
- package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +14 -14
- package/corpus/templates/slides/app/components/editor/ExportMenu.tsx +10 -9
- package/corpus/templates/slides/app/components/editor/GenerateSlidesDialog.tsx +6 -5
- package/corpus/templates/slides/app/components/editor/HistoryPanel.tsx +12 -12
- package/corpus/templates/slides/app/components/editor/ImageDropPromptPopover.tsx +4 -3
- package/corpus/templates/slides/app/components/editor/ImageSearchPanel.tsx +5 -4
- package/corpus/templates/slides/app/components/editor/ImportButton.tsx +4 -3
- package/corpus/templates/slides/app/components/editor/PromptDialog.tsx +2 -1
- package/corpus/templates/slides/app/components/editor/ShareDialog.tsx +10 -10
- package/corpus/templates/slides/app/components/editor/SlideBubbleMenu.tsx +10 -10
- package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +6 -6
- package/corpus/templates/slides/app/components/editor/SlideStyleInspector.tsx +2 -1
- package/corpus/templates/slides/app/components/editor/TweaksPanel.tsx +1 -1
- package/corpus/templates/slides/app/components/layout/Header.tsx +2 -2
- package/corpus/templates/slides/app/components/layout/Sidebar.tsx +5 -5
- package/corpus/templates/slides/app/components/ui/alert-dialog.tsx +1 -0
- package/corpus/templates/slides/app/components/ui/button.tsx +1 -0
- package/corpus/templates/slides/app/components/ui/card.tsx +1 -0
- package/corpus/templates/slides/app/components/ui/dialog.tsx +1 -0
- package/corpus/templates/slides/app/components/ui/dropdown-menu.tsx +1 -0
- package/corpus/templates/slides/app/components/ui/input.tsx +1 -0
- package/corpus/templates/slides/app/components/ui/label.tsx +1 -0
- package/corpus/templates/slides/app/components/ui/popover.tsx +1 -0
- package/corpus/templates/slides/app/components/ui/scroll-area.tsx +1 -0
- package/corpus/templates/slides/app/components/ui/select.tsx +1 -0
- package/corpus/templates/slides/app/components/ui/separator.tsx +1 -0
- package/corpus/templates/slides/app/components/ui/sheet.tsx +1 -0
- package/corpus/templates/slides/app/components/ui/skeleton.tsx +1 -0
- package/corpus/templates/slides/app/components/ui/spinner.tsx +1 -0
- package/corpus/templates/slides/app/components/ui/textarea.tsx +1 -0
- package/corpus/templates/slides/app/components/ui/toast.tsx +1 -0
- package/corpus/templates/slides/app/components/ui/toaster.tsx +1 -0
- package/corpus/templates/slides/app/components/ui/toggle-group.tsx +1 -0
- package/corpus/templates/slides/app/components/ui/toolkit-provider.tsx +12 -0
- package/corpus/templates/slides/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/slides/app/components/visual-editor/CanvasCommentPins.tsx +6 -6
- package/corpus/templates/slides/app/components/visual-editor/DrawOverlay.tsx +7 -7
- package/corpus/templates/slides/app/global.css +1 -0
- package/corpus/templates/slides/app/hooks/use-toast.ts +1 -0
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +3 -3
- package/corpus/templates/slides/app/pages/DesignSystems.tsx +1 -1
- package/corpus/templates/slides/app/pages/Index.tsx +14 -17
- package/corpus/templates/slides/app/root.tsx +13 -10
- package/corpus/templates/slides/app/routes/p.$id.tsx +126 -12
- package/corpus/templates/slides/app/routes/settings.tsx +6 -21
- package/corpus/templates/slides/app/routes/share.$token.tsx +55 -8
- package/corpus/templates/slides/changelog/2026-07-06-mobile-layouts-no-longer-stack-two-top-headers.md +5 -0
- package/corpus/templates/slides/server/db/index.ts +9 -0
- package/corpus/templates/slides/server/handlers/uploads.ts +7 -2
- package/corpus/templates/slides/server/lib/chat-attachments.ts +1 -1
- package/corpus/templates/slides/server/routes/api/deck-agent-context.json.get.ts +97 -0
- package/corpus/templates/slides/shared/agent-readable.ts +2 -0
- package/dist/agent/durable-background.d.ts +29 -0
- package/dist/agent/durable-background.d.ts.map +1 -1
- package/dist/agent/durable-background.js +46 -0
- package/dist/agent/durable-background.js.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.js +7 -2
- package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
- package/dist/agent/engine/anthropic-engine.d.ts.map +1 -1
- package/dist/agent/engine/anthropic-engine.js +28 -2
- package/dist/agent/engine/anthropic-engine.js.map +1 -1
- package/dist/agent/engine/builder-engine.d.ts.map +1 -1
- package/dist/agent/engine/builder-engine.js +1 -1
- package/dist/agent/engine/builder-engine.js.map +1 -1
- package/dist/agent/engine/output-tokens.d.ts +3 -3
- package/dist/agent/engine/output-tokens.d.ts.map +1 -1
- package/dist/agent/engine/output-tokens.js +16 -14
- package/dist/agent/engine/output-tokens.js.map +1 -1
- package/dist/agent/engine/registry.d.ts +3 -3
- package/dist/agent/engine/registry.d.ts.map +1 -1
- package/dist/agent/engine/registry.js +28 -25
- package/dist/agent/engine/registry.js.map +1 -1
- package/dist/agent/engine/translate-ai-sdk.d.ts +14 -2
- package/dist/agent/engine/translate-ai-sdk.d.ts.map +1 -1
- package/dist/agent/engine/translate-ai-sdk.js +33 -18
- package/dist/agent/engine/translate-ai-sdk.js.map +1 -1
- package/dist/agent/engine/translate-anthropic.d.ts.map +1 -1
- package/dist/agent/engine/translate-anthropic.js +42 -1
- package/dist/agent/engine/translate-anthropic.js.map +1 -1
- package/dist/agent/engine/types.d.ts +15 -0
- package/dist/agent/engine/types.d.ts.map +1 -1
- package/dist/agent/engine/types.js.map +1 -1
- package/dist/agent/model-config.d.ts +8 -0
- package/dist/agent/model-config.d.ts.map +1 -1
- package/dist/agent/model-config.js +86 -0
- package/dist/agent/model-config.js.map +1 -1
- package/dist/agent/production-agent.d.ts +91 -5
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +389 -180
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/runtime-context.d.ts +29 -0
- package/dist/agent/runtime-context.d.ts.map +1 -1
- package/dist/agent/runtime-context.js +40 -11
- package/dist/agent/runtime-context.js.map +1 -1
- package/dist/agent/tool-result-images.d.ts +49 -0
- package/dist/agent/tool-result-images.d.ts.map +1 -0
- package/dist/agent/tool-result-images.js +141 -0
- package/dist/agent/tool-result-images.js.map +1 -0
- package/dist/brand-kit/fig/index.d.ts.map +1 -1
- package/dist/brand-kit/fig/index.js +6 -3
- package/dist/brand-kit/fig/index.js.map +1 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +66 -17
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +72 -40
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/KeepTabOpenNotice.d.ts +55 -0
- package/dist/client/KeepTabOpenNotice.d.ts.map +1 -0
- package/dist/client/KeepTabOpenNotice.js +85 -0
- package/dist/client/KeepTabOpenNotice.js.map +1 -0
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +2 -1
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/RunStuckBanner.d.ts +7 -1
- package/dist/client/RunStuckBanner.d.ts.map +1 -1
- package/dist/client/RunStuckBanner.js +7 -2
- package/dist/client/RunStuckBanner.js.map +1 -1
- package/dist/client/chat/run-recovery.d.ts.map +1 -1
- package/dist/client/chat/run-recovery.js +7 -1
- package/dist/client/chat/run-recovery.js.map +1 -1
- package/dist/client/clipboard.d.ts.map +1 -1
- package/dist/client/clipboard.js +5 -6
- package/dist/client/clipboard.js.map +1 -1
- package/dist/client/components/AgentPresenceChip.d.ts +1 -11
- package/dist/client/components/AgentPresenceChip.d.ts.map +1 -1
- package/dist/client/components/AgentPresenceChip.js +1 -41
- package/dist/client/components/AgentPresenceChip.js.map +1 -1
- package/dist/client/components/LiveCursorOverlay.d.ts +1 -44
- package/dist/client/components/LiveCursorOverlay.d.ts.map +1 -1
- package/dist/client/components/LiveCursorOverlay.js +1 -123
- package/dist/client/components/LiveCursorOverlay.js.map +1 -1
- package/dist/client/components/PresenceBar.d.ts +1 -26
- package/dist/client/components/PresenceBar.d.ts.map +1 -1
- package/dist/client/components/PresenceBar.js +1 -164
- package/dist/client/components/PresenceBar.js.map +1 -1
- package/dist/client/components/RecentEditHighlights.d.ts +1 -42
- package/dist/client/components/RecentEditHighlights.d.ts.map +1 -1
- package/dist/client/components/RecentEditHighlights.js +1 -145
- package/dist/client/components/RecentEditHighlights.js.map +1 -1
- package/dist/client/components/RemoteSelectionRings.d.ts +1 -51
- package/dist/client/components/RemoteSelectionRings.d.ts.map +1 -1
- package/dist/client/components/RemoteSelectionRings.js +1 -129
- package/dist/client/components/RemoteSelectionRings.js.map +1 -1
- package/dist/client/composer/TiptapComposer.d.ts +4 -0
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +74 -26
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/db-admin/SqlEditor.d.ts.map +1 -1
- package/dist/client/db-admin/SqlEditor.js +13 -3
- package/dist/client/db-admin/SqlEditor.js.map +1 -1
- package/dist/client/dynamic-suggestions.d.ts.map +1 -1
- package/dist/client/dynamic-suggestions.js +7 -1
- package/dist/client/dynamic-suggestions.js.map +1 -1
- package/dist/client/extensions/ExtensionViewer.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionViewer.js +7 -7
- package/dist/client/extensions/ExtensionViewer.js.map +1 -1
- package/dist/client/extensions/ExtensionsListPage.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionsListPage.js +5 -7
- package/dist/client/extensions/ExtensionsListPage.js.map +1 -1
- package/dist/client/extensions/ExtensionsSidebarSection.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionsSidebarSection.js +1 -1
- package/dist/client/extensions/ExtensionsSidebarSection.js.map +1 -1
- package/dist/client/host-bridge.d.ts +2 -0
- package/dist/client/host-bridge.d.ts.map +1 -1
- package/dist/client/host-bridge.js +26 -10
- package/dist/client/host-bridge.js.map +1 -1
- package/dist/client/i18n.d.ts +1 -0
- package/dist/client/i18n.d.ts.map +1 -1
- package/dist/client/i18n.js +3 -1
- package/dist/client/i18n.js.map +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.d.ts.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.js +12 -31
- package/dist/client/resources/McpIntegrationDialog.js.map +1 -1
- package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts +3 -1
- package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts.map +1 -1
- package/dist/client/rich-markdown-editor/SharedRichEditor.js +2 -1
- package/dist/client/rich-markdown-editor/SharedRichEditor.js.map +1 -1
- package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts +3 -1
- package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts.map +1 -1
- package/dist/client/rich-markdown-editor/useCollabReconcile.js +6 -2
- package/dist/client/rich-markdown-editor/useCollabReconcile.js.map +1 -1
- package/dist/client/settings/SettingsPanel.d.ts +3 -1
- package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
- package/dist/client/settings/SettingsPanel.js +103 -9
- package/dist/client/settings/SettingsPanel.js.map +1 -1
- package/dist/client/settings/SettingsTabsPage.d.ts.map +1 -1
- package/dist/client/settings/SettingsTabsPage.js +5 -5
- package/dist/client/settings/SettingsTabsPage.js.map +1 -1
- package/dist/client/settings/index.d.ts +1 -1
- package/dist/client/settings/index.d.ts.map +1 -1
- package/dist/client/settings/index.js +1 -1
- package/dist/client/settings/index.js.map +1 -1
- package/dist/client/sharing/VisibilityBadge.d.ts +1 -10
- package/dist/client/sharing/VisibilityBadge.d.ts.map +1 -1
- package/dist/client/sharing/VisibilityBadge.js +1 -18
- package/dist/client/sharing/VisibilityBadge.js.map +1 -1
- package/dist/client/use-run-stuck-detection.d.ts +8 -1
- package/dist/client/use-run-stuck-detection.d.ts.map +1 -1
- package/dist/client/use-run-stuck-detection.js +3 -2
- package/dist/client/use-run-stuck-detection.js.map +1 -1
- package/dist/coding-tools/run-code.d.ts +36 -0
- package/dist/coding-tools/run-code.d.ts.map +1 -1
- package/dist/coding-tools/run-code.js +333 -62
- package/dist/coding-tools/run-code.js.map +1 -1
- package/dist/coding-tools/sandbox/background.d.ts +141 -0
- package/dist/coding-tools/sandbox/background.d.ts.map +1 -0
- package/dist/coding-tools/sandbox/background.js +279 -0
- package/dist/coding-tools/sandbox/background.js.map +1 -0
- package/dist/coding-tools/sandbox/executions-store.d.ts +138 -0
- package/dist/coding-tools/sandbox/executions-store.d.ts.map +1 -0
- package/dist/coding-tools/sandbox/executions-store.js +380 -0
- package/dist/coding-tools/sandbox/executions-store.js.map +1 -0
- package/dist/coding-tools/sandbox/index.d.ts +22 -13
- package/dist/coding-tools/sandbox/index.d.ts.map +1 -1
- package/dist/coding-tools/sandbox/index.js +31 -13
- package/dist/coding-tools/sandbox/index.js.map +1 -1
- package/dist/coding-tools/sandbox/local-child-process-adapter.d.ts.map +1 -1
- package/dist/coding-tools/sandbox/local-child-process-adapter.js +61 -4
- package/dist/coding-tools/sandbox/local-child-process-adapter.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/client.d.ts +16 -12
- package/dist/collab/client.d.ts.map +1 -1
- package/dist/collab/client.js +744 -496
- package/dist/collab/client.js.map +1 -1
- package/dist/collab/presence.d.ts +2 -20
- package/dist/collab/presence.d.ts.map +1 -1
- package/dist/collab/presence.js +3 -0
- package/dist/collab/presence.js.map +1 -1
- package/dist/collab/recent-edits.d.ts +2 -37
- package/dist/collab/recent-edits.d.ts.map +1 -1
- package/dist/collab/recent-edits.js +2 -9
- package/dist/collab/recent-edits.js.map +1 -1
- package/dist/collab/routes.d.ts +2 -2
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/data-programs/actions.d.ts +19 -0
- package/dist/data-programs/actions.d.ts.map +1 -0
- package/dist/data-programs/actions.js +279 -0
- package/dist/data-programs/actions.js.map +1 -0
- package/dist/data-programs/contract.d.ts +70 -0
- package/dist/data-programs/contract.d.ts.map +1 -0
- package/dist/data-programs/contract.js +225 -0
- package/dist/data-programs/contract.js.map +1 -0
- package/dist/data-programs/execute.d.ts +96 -0
- package/dist/data-programs/execute.d.ts.map +1 -0
- package/dist/data-programs/execute.js +454 -0
- package/dist/data-programs/execute.js.map +1 -0
- package/dist/data-programs/index.d.ts +11 -0
- package/dist/data-programs/index.d.ts.map +1 -0
- package/dist/data-programs/index.js +11 -0
- package/dist/data-programs/index.js.map +1 -0
- package/dist/data-programs/schema.d.ts +517 -0
- package/dist/data-programs/schema.d.ts.map +1 -0
- package/dist/data-programs/schema.js +138 -0
- package/dist/data-programs/schema.js.map +1 -0
- package/dist/data-programs/store.d.ts +158 -0
- package/dist/data-programs/store.d.ts.map +1 -0
- package/dist/data-programs/store.js +493 -0
- package/dist/data-programs/store.js.map +1 -0
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +34 -0
- package/dist/deploy/build.js.map +1 -1
- package/dist/extensions/actions.js +2 -2
- package/dist/extensions/actions.js.map +1 -1
- package/dist/file-upload/builder.d.ts.map +1 -1
- package/dist/file-upload/builder.js +9 -0
- package/dist/file-upload/builder.js.map +1 -1
- package/dist/integrations/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +21 -10
- package/dist/integrations/webhook-handler.js.map +1 -1
- package/dist/local-artifacts/index.js +1 -1
- package/dist/local-artifacts/index.js.map +1 -1
- package/dist/localization/default-messages.d.ts +0 -1
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +1 -2
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/mcp-client/index.d.ts +9 -0
- package/dist/mcp-client/index.d.ts.map +1 -1
- package/dist/mcp-client/index.js +23 -0
- package/dist/mcp-client/index.js.map +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/onboarding/default-steps.d.ts.map +1 -1
- package/dist/onboarding/default-steps.js +2 -2
- package/dist/onboarding/default-steps.js.map +1 -1
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/resources/store.d.ts.map +1 -1
- package/dist/resources/store.js +35 -3
- package/dist/resources/store.js.map +1 -1
- package/dist/scripts/agent-engines/list-agent-engines.d.ts.map +1 -1
- package/dist/scripts/agent-engines/list-agent-engines.js +4 -8
- package/dist/scripts/agent-engines/list-agent-engines.js.map +1 -1
- package/dist/scripts/agent-engines/test-agent-engine.d.ts.map +1 -1
- package/dist/scripts/agent-engines/test-agent-engine.js +7 -2
- package/dist/scripts/agent-engines/test-agent-engine.js.map +1 -1
- package/dist/scripts/db/tool-mode.js +3 -3
- package/dist/scripts/db/tool-mode.js.map +1 -1
- package/dist/scripts/resources/migrate-learnings.d.ts +5 -1
- package/dist/scripts/resources/migrate-learnings.d.ts.map +1 -1
- package/dist/scripts/resources/migrate-learnings.js +8 -10
- package/dist/scripts/resources/migrate-learnings.js.map +1 -1
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +4 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/action-routes.d.ts.map +1 -1
- package/dist/server/action-routes.js +8 -2
- package/dist/server/action-routes.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts +20 -6
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +138 -59
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-discovery.d.ts.map +1 -1
- package/dist/server/agent-discovery.js +62 -8
- package/dist/server/agent-discovery.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +75 -3
- package/dist/server/auth.js.map +1 -1
- package/dist/server/builder-design-systems.js +2 -2
- package/dist/server/builder-design-systems.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +100 -20
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/credential-provider.d.ts +6 -3
- package/dist/server/credential-provider.d.ts.map +1 -1
- package/dist/server/credential-provider.js +25 -8
- package/dist/server/credential-provider.js.map +1 -1
- package/dist/server/csrf.d.ts.map +1 -1
- package/dist/server/csrf.js +3 -0
- package/dist/server/csrf.js.map +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/oauth-helpers.d.ts.map +1 -1
- package/dist/server/oauth-helpers.js +9 -1
- package/dist/server/oauth-helpers.js.map +1 -1
- package/dist/server/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +80 -48
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/server/prompts/shared-rules.js +2 -2
- package/dist/server/prompts/shared-rules.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts.map +1 -1
- package/dist/server/transcribe-voice.js +77 -15
- package/dist/server/transcribe-voice.js.map +1 -1
- package/dist/shared/agent-readable-resource.d.ts +29 -0
- package/dist/shared/agent-readable-resource.d.ts.map +1 -0
- package/dist/shared/agent-readable-resource.js +60 -0
- package/dist/shared/agent-readable-resource.js.map +1 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +1 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/sharing/actions/create-agent-resource-link.d.ts +13 -0
- package/dist/sharing/actions/create-agent-resource-link.d.ts.map +1 -0
- package/dist/sharing/actions/create-agent-resource-link.js +72 -0
- package/dist/sharing/actions/create-agent-resource-link.js.map +1 -0
- package/dist/sharing/registry.d.ts +17 -0
- package/dist/sharing/registry.d.ts.map +1 -1
- package/dist/sharing/registry.js.map +1 -1
- package/dist/styles/agent-native.css +57 -45
- package/dist/templates/default/.agents/skills/actions/SKILL.md +55 -0
- package/dist/templates/default/AGENTS.md +11 -14
- package/dist/templates/default/actions/navigate.ts +1 -1
- package/dist/templates/default/app/i18n/ar-SA.ts +0 -1
- package/dist/templates/default/app/i18n/de-DE.ts +0 -1
- package/dist/templates/default/app/i18n/en-US.ts +0 -1
- package/dist/templates/default/app/i18n/es-ES.ts +0 -1
- package/dist/templates/default/app/i18n/fr-FR.ts +0 -1
- package/dist/templates/default/app/i18n/hi-IN.ts +0 -1
- package/dist/templates/default/app/i18n/ja-JP.ts +0 -1
- package/dist/templates/default/app/i18n/ko-KR.ts +0 -1
- package/dist/templates/default/app/i18n/pt-BR.ts +0 -1
- package/dist/templates/default/app/i18n/zh-CN.ts +0 -1
- package/dist/templates/default/app/i18n/zh-TW.ts +0 -1
- package/dist/templates/default/app/routes/settings.tsx +22 -33
- package/dist/templates/headless/.agents/skills/agent-native-docs/SKILL.md +20 -7
- package/dist/templates/headless/AGENTS.md +9 -6
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +55 -0
- package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +92 -0
- package/dist/templates/workspace-core/.agents/skills/data-programs/SKILL.md +128 -0
- package/dist/templates/workspace-core/.agents/skills/harness-agents/SKILL.md +10 -4
- package/dist/vite/agents-bundle-plugin.d.ts.map +1 -1
- package/dist/vite/agents-bundle-plugin.js +26 -1
- package/dist/vite/agents-bundle-plugin.js.map +1 -1
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +12 -0
- package/dist/vite/client.js.map +1 -1
- package/docs/content/agent-native-toolkit.mdx +103 -0
- package/docs/content/cloneable-saas.mdx +19 -19
- package/docs/content/components.mdx +16 -4
- package/docs/content/data-programs.mdx +329 -0
- package/docs/content/deployment.mdx +9 -9
- package/docs/content/extensions.mdx +8 -7
- package/docs/content/generative-ui.mdx +5 -3
- package/docs/content/key-concepts.mdx +6 -9
- package/docs/content/locales/ar-SA/agent-native-toolkit.mdx +103 -0
- package/docs/content/locales/ar-SA/cloneable-saas.mdx +19 -19
- package/docs/content/locales/ar-SA/components.mdx +12 -2
- package/docs/content/locales/ar-SA/data-programs.mdx +329 -0
- package/docs/content/locales/ar-SA/deployment.mdx +8 -9
- package/docs/content/locales/ar-SA/extensions.mdx +6 -4
- package/docs/content/locales/ar-SA/key-concepts.mdx +7 -9
- package/docs/content/locales/ar-SA/real-time-collaboration.mdx +9 -10
- package/docs/content/locales/ar-SA/sharing.mdx +15 -7
- package/docs/content/locales/de-DE/agent-native-toolkit.mdx +103 -0
- package/docs/content/locales/de-DE/cloneable-saas.mdx +19 -19
- package/docs/content/locales/de-DE/components.mdx +12 -2
- package/docs/content/locales/de-DE/data-programs.mdx +329 -0
- package/docs/content/locales/de-DE/deployment.mdx +8 -9
- package/docs/content/locales/de-DE/extensions.mdx +6 -4
- package/docs/content/locales/de-DE/key-concepts.mdx +8 -10
- package/docs/content/locales/de-DE/real-time-collaboration.mdx +9 -10
- package/docs/content/locales/de-DE/sharing.mdx +15 -7
- package/docs/content/locales/es-ES/agent-native-toolkit.mdx +103 -0
- package/docs/content/locales/es-ES/cloneable-saas.mdx +19 -19
- package/docs/content/locales/es-ES/components.mdx +12 -2
- package/docs/content/locales/es-ES/data-programs.mdx +329 -0
- package/docs/content/locales/es-ES/deployment.mdx +8 -9
- package/docs/content/locales/es-ES/extensions.mdx +6 -4
- package/docs/content/locales/es-ES/key-concepts.mdx +8 -10
- package/docs/content/locales/es-ES/real-time-collaboration.mdx +9 -10
- package/docs/content/locales/es-ES/sharing.mdx +15 -7
- package/docs/content/locales/fr-FR/agent-native-toolkit.mdx +103 -0
- package/docs/content/locales/fr-FR/cloneable-saas.mdx +19 -19
- package/docs/content/locales/fr-FR/components.mdx +12 -2
- package/docs/content/locales/fr-FR/data-programs.mdx +329 -0
- package/docs/content/locales/fr-FR/deployment.mdx +8 -9
- package/docs/content/locales/fr-FR/extensions.mdx +6 -4
- package/docs/content/locales/fr-FR/key-concepts.mdx +8 -10
- package/docs/content/locales/fr-FR/real-time-collaboration.mdx +9 -10
- package/docs/content/locales/fr-FR/sharing.mdx +15 -7
- package/docs/content/locales/hi-IN/agent-native-toolkit.mdx +103 -0
- package/docs/content/locales/hi-IN/cloneable-saas.mdx +19 -19
- package/docs/content/locales/hi-IN/components.mdx +20 -10
- package/docs/content/locales/hi-IN/data-programs.mdx +329 -0
- package/docs/content/locales/hi-IN/deployment.mdx +8 -9
- package/docs/content/locales/hi-IN/extensions.mdx +6 -4
- package/docs/content/locales/hi-IN/key-concepts.mdx +8 -10
- package/docs/content/locales/hi-IN/real-time-collaboration.mdx +9 -10
- package/docs/content/locales/hi-IN/sharing.mdx +15 -7
- package/docs/content/locales/ja-JP/agent-native-toolkit.mdx +103 -0
- package/docs/content/locales/ja-JP/cloneable-saas.mdx +19 -19
- package/docs/content/locales/ja-JP/components.mdx +12 -2
- package/docs/content/locales/ja-JP/data-programs.mdx +329 -0
- package/docs/content/locales/ja-JP/deployment.mdx +8 -9
- package/docs/content/locales/ja-JP/extensions.mdx +6 -4
- package/docs/content/locales/ja-JP/key-concepts.mdx +9 -11
- package/docs/content/locales/ja-JP/real-time-collaboration.mdx +9 -10
- package/docs/content/locales/ja-JP/sharing.mdx +15 -7
- package/docs/content/locales/ko-KR/agent-native-toolkit.mdx +103 -0
- package/docs/content/locales/ko-KR/cloneable-saas.mdx +19 -19
- package/docs/content/locales/ko-KR/components.mdx +20 -10
- package/docs/content/locales/ko-KR/data-programs.mdx +329 -0
- package/docs/content/locales/ko-KR/deployment.mdx +8 -9
- package/docs/content/locales/ko-KR/extensions.mdx +16 -14
- package/docs/content/locales/ko-KR/key-concepts.mdx +9 -11
- package/docs/content/locales/ko-KR/real-time-collaboration.mdx +9 -10
- package/docs/content/locales/ko-KR/sharing.mdx +15 -7
- package/docs/content/locales/pt-BR/agent-native-toolkit.mdx +103 -0
- package/docs/content/locales/pt-BR/cloneable-saas.mdx +19 -19
- package/docs/content/locales/pt-BR/components.mdx +12 -2
- package/docs/content/locales/pt-BR/data-programs.mdx +329 -0
- package/docs/content/locales/pt-BR/deployment.mdx +8 -9
- package/docs/content/locales/pt-BR/extensions.mdx +6 -4
- package/docs/content/locales/pt-BR/key-concepts.mdx +8 -11
- package/docs/content/locales/pt-BR/real-time-collaboration.mdx +9 -10
- package/docs/content/locales/pt-BR/sharing.mdx +15 -7
- package/docs/content/locales/zh-CN/agent-native-toolkit.mdx +103 -0
- package/docs/content/locales/zh-CN/cloneable-saas.mdx +19 -19
- package/docs/content/locales/zh-CN/components.mdx +20 -10
- package/docs/content/locales/zh-CN/data-programs.mdx +329 -0
- package/docs/content/locales/zh-CN/deployment.mdx +7 -9
- package/docs/content/locales/zh-CN/extensions.mdx +16 -14
- package/docs/content/locales/zh-CN/key-concepts.mdx +7 -11
- package/docs/content/locales/zh-CN/real-time-collaboration.mdx +10 -11
- package/docs/content/locales/zh-CN/sharing.mdx +15 -7
- package/docs/content/locales/zh-TW/agent-native-toolkit.mdx +103 -0
- package/docs/content/locales/zh-TW/cloneable-saas.mdx +19 -19
- package/docs/content/locales/zh-TW/components.mdx +20 -10
- package/docs/content/locales/zh-TW/data-programs.mdx +329 -0
- package/docs/content/locales/zh-TW/deployment.mdx +7 -9
- package/docs/content/locales/zh-TW/extensions.mdx +16 -14
- package/docs/content/locales/zh-TW/key-concepts.mdx +7 -11
- package/docs/content/locales/zh-TW/real-time-collaboration.mdx +10 -11
- package/docs/content/locales/zh-TW/sharing.mdx +15 -7
- package/docs/content/real-time-collaboration.mdx +10 -11
- package/docs/content/sharing.mdx +39 -7
- package/docs/content/toolkit-app-adapters.mdx +46 -0
- package/docs/content/toolkit-collaboration-ui.mdx +48 -0
- package/docs/content/toolkit-sharing-ui.mdx +33 -0
- package/docs/content/toolkit-shell-hooks.mdx +27 -0
- package/docs/content/toolkit-ui.mdx +69 -0
- package/package.json +7 -2
- package/src/templates/default/.agents/skills/actions/SKILL.md +55 -0
- package/src/templates/default/AGENTS.md +11 -14
- package/src/templates/default/actions/navigate.spec.ts +53 -0
- package/src/templates/default/actions/navigate.ts +1 -1
- package/src/templates/default/app/i18n/ar-SA.ts +0 -1
- package/src/templates/default/app/i18n/de-DE.ts +0 -1
- package/src/templates/default/app/i18n/en-US.ts +0 -1
- package/src/templates/default/app/i18n/es-ES.ts +0 -1
- package/src/templates/default/app/i18n/fr-FR.ts +0 -1
- package/src/templates/default/app/i18n/hi-IN.ts +0 -1
- package/src/templates/default/app/i18n/ja-JP.ts +0 -1
- package/src/templates/default/app/i18n/ko-KR.ts +0 -1
- package/src/templates/default/app/i18n/pt-BR.ts +0 -1
- package/src/templates/default/app/i18n/zh-CN.ts +0 -1
- package/src/templates/default/app/i18n/zh-TW.ts +0 -1
- package/src/templates/default/app/routes/settings.tsx +22 -33
- package/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +20 -7
- package/src/templates/headless/AGENTS.md +9 -6
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +55 -0
- package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +92 -0
- package/src/templates/workspace-core/.agents/skills/data-programs/SKILL.md +128 -0
- package/src/templates/workspace-core/.agents/skills/harness-agents/SKILL.md +10 -4
- package/corpus/templates/design/server/lib/figma-import/clipboard.ts +0 -122
- package/corpus/templates/design/server/lib/figma-import/decode.ts +0 -455
- package/corpus/templates/design/server/lib/figma-import/processor.ts +0 -116
- package/corpus/templates/design/server/lib/figma-import/render-html.ts +0 -397
- package/corpus/templates/design/server/lib/figma-import/types.ts +0 -60
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TiptapComposer.js","sourceRoot":"","sources":["../../../src/client/composer/TiptapComposer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EACL,WAAW,EACX,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,iBAAiB,EACjB,UAAU,EACV,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,WAAW,MAAM,+BAA+B,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,UAAU,MAAM,qBAAqB,CAAC;AA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QAAQ,EAAE,CAAC,OAAO,8BACO,aAAa,EACtC,SAAS,EAAC,6LAA6L,YAEvM,KAAC,WAAW,IAAC,SAAS,EAAC,aAAa,GAAG,GAChC,GACM,EACjB,KAAC,cAAc,+BAA8B,IACrC,IACT,CACJ,IACG,EACN,KAAC,cAAc,IACb,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,GAAG,EAC1B,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,IAAI,EACnC,YAAY,EAAE,oBAAoB,EAClC,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,gBAAgB,EAC1B,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,OAAO,EAAE,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,EAClE,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,EAAE,EAC3B,eAAe,EAAE,mBAAmB,EACpC,aAAa,EAAE,iBAAiB,EAChC,eAAe,EAAE,mBAAmB,EACpC,OAAO,EAAE,YAAY,GACrB,IACD,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import { useComposer, useComposerRuntime } from \"@assistant-ui/react\";\nimport {\n IconArrowUp,\n IconCheck,\n IconChevronDown,\n IconChevronRight,\n IconBulb,\n IconClock,\n IconBolt,\n IconTool,\n IconX,\n IconClipboardList,\n IconPencil,\n IconPlugConnected,\n} from \"@tabler/icons-react\";\nimport Placeholder from \"@tiptap/extension-placeholder\";\nimport type { EditorView } from \"@tiptap/pm/view\";\nimport { useEditor, EditorContent } from \"@tiptap/react\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport React, {\n useState,\n useRef,\n useEffect,\n useCallback,\n useImperativeHandle,\n useMemo,\n} from \"react\";\n\nimport {\n getReasoningEffortOptionsForModel,\n reasoningEffortLabel,\n type ReasoningEffort,\n} from \"../../shared/reasoning-effort.js\";\nimport type { VoiceContextPack } from \"../../voice/index.js\";\nimport {\n AgentComposerReference,\n formatAgentChatContextItemsForPrompt,\n normalizeAgentComposerReference,\n sendToAgentChat,\n type AgentChatContextItem,\n AgentComposerReferenceInsertPayload,\n AGENT_CHAT_INSERT_REFERENCE_EVENT,\n AGENT_CHAT_INSERT_REFERENCE_MESSAGE_TYPE,\n} from \"../agent-chat.js\";\nimport { tryDelegateBuildRequestToBuilder } from \"../builder-frame.js\";\nimport { isTrustedBuilderMessage } from \"../builder-frame.js\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"../components/ui/popover.js\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"../components/ui/tooltip.js\";\nimport { isTrustedFrameMessage } from \"../frame.js\";\nimport { useBuilderConnectFlow } from \"../settings/useBuilderStatus.js\";\nimport { ComposerPlusMenu } from \"./ComposerPlusMenu.js\";\nimport { getComposerDraftKey } from \"./draft-key.js\";\nimport { FileReference } from \"./extensions/FileReference.js\";\nimport { MentionReference } from \"./extensions/MentionReference.js\";\nimport { SkillReference } from \"./extensions/SkillReference.js\";\nimport { MentionPopover, type MentionPopoverRef } from \"./MentionPopover.js\";\nimport {\n createPastedAttachmentFile,\n readClipboardPaste,\n shouldConvertClipboardToAttachment,\n} from \"./pasted-text.js\";\nimport type {\n MentionItem,\n SkillResult,\n Reference,\n SlashCommand,\n ComposerMode,\n AgentComposerLayoutVariant,\n} from \"./types.js\";\nimport { useMentionSearch } from \"./use-mention-search.js\";\nimport { useSkills } from \"./use-skills.js\";\nimport { useVoiceDictation } from \"./useVoiceDictation.js\";\nimport { VoiceButton, VoiceRecordingOverlay } from \"./VoiceButton.js\";\nexport interface TiptapComposerHandle {\n focus(): void;\n setText(text: string): void;\n insertReference(ref: AgentComposerReference): void;\n}\n\nexport type ComposerSubmitIntent = \"immediate\" | \"queued\";\n\nexport const DEFAULT_VOICE_DICTATION_ENABLED = false;\n\nexport interface TiptapComposerSubmitOptions {\n intent?: ComposerSubmitIntent;\n}\n\nexport function canSubmitComposerContent(options: {\n hasEditorContent: boolean;\n attachmentCount: number;\n disabled?: boolean;\n}): boolean {\n return (\n !options.disabled &&\n (options.hasEditorContent || options.attachmentCount > 0)\n );\n}\n\nconst MAX_DOCUMENT_ATTACHMENT_BYTES = 4 * 1024 * 1024;\n\nfunction composerReferenceFromMentionItem(\n item: MentionItem,\n): AgentComposerReference {\n return {\n label: item.label,\n icon: item.icon || \"file\",\n source: item.source,\n refType: item.refType,\n refId: item.refId || null,\n refPath: item.refPath || null,\n slotKey: item.slotKey,\n slotLabel: item.slotLabel,\n metadata: item.metadata,\n clearsSlots: item.clearsSlots,\n relatedReferences: item.relatedReferences,\n };\n}\n\nfunction mentionReferenceAttrs(ref: AgentComposerReference) {\n return {\n label: ref.label,\n icon: ref.icon || \"file\",\n source: ref.source,\n refType: ref.refType,\n refId: ref.refId || null,\n refPath: ref.refPath || null,\n slotKey: ref.slotKey || null,\n slotLabel: ref.slotLabel || null,\n metadata: ref.metadata || null,\n };\n}\n\nfunction referenceFromComposerReference(\n ref: AgentComposerReference,\n): Reference {\n return {\n type:\n ref.refType === \"file\"\n ? \"file\"\n : ref.refType === \"agent\"\n ? \"agent\"\n : ref.refType === \"custom-agent\"\n ? \"custom-agent\"\n : \"mention\",\n path: ref.refPath || \"\",\n name: ref.label,\n source: ref.source || \"\",\n refType: ref.refType,\n refId: ref.refId || undefined,\n slotKey: ref.slotKey,\n slotLabel: ref.slotLabel,\n metadata: ref.metadata,\n };\n}\n\nfunction applySlotReferenceChanges(\n current: AgentComposerReference[],\n references: AgentComposerReference[],\n): AgentComposerReference[] {\n let next = current;\n\n const applyOne = (ref: AgentComposerReference) => {\n for (const related of ref.relatedReferences ?? []) {\n applyOne(related);\n }\n if (!ref.slotKey) return;\n const cleared = new Set([ref.slotKey, ...(ref.clearsSlots ?? [])]);\n next = next.filter((existing) => !cleared.has(existing.slotKey ?? \"\"));\n next = [...next, ref];\n };\n\n for (const ref of references) {\n applyOne(ref);\n }\n\n return next;\n}\n\nfunction removeSlotReference(\n current: AgentComposerReference[],\n ref: AgentComposerReference,\n): AgentComposerReference[] {\n const removed = new Set([ref.slotKey, ...(ref.clearsSlots ?? [])]);\n return current.filter((existing) => !removed.has(existing.slotKey ?? \"\"));\n}\n\nfunction slotReferenceTitle(ref: AgentComposerReference): string {\n return ref.slotLabel ? `${ref.slotLabel}: ${ref.label}` : ref.label;\n}\n\nfunction metadataString(\n metadata: Record<string, unknown> | undefined,\n key: string,\n): string | null {\n const value = metadata?.[key];\n return typeof value === \"string\" && value.trim() ? value.trim() : null;\n}\n\nfunction trimVoiceContextValue(value: string, maxChars: number): string | null {\n const trimmed = value.replace(/\\0/g, \"\").trim();\n if (!trimmed) return null;\n if (trimmed.length <= maxChars) return trimmed;\n return `${trimmed.slice(0, maxChars).trimEnd()}\\n[truncated]`;\n}\n\nfunction filterMentionItemsForSlots(\n items: MentionItem[],\n slotReferences: AgentComposerReference[],\n): MentionItem[] {\n return items.filter((item) => {\n const requiredSlotKey = metadataString(item.metadata, \"requiredSlotKey\");\n const requiredRefId = metadataString(item.metadata, \"requiredRefId\");\n if (!requiredSlotKey || !requiredRefId) return true;\n const selected = slotReferences.find(\n (ref) => ref.slotKey === requiredSlotKey,\n );\n if (!selected?.refId) return true;\n return selected.refId === requiredRefId;\n });\n}\n\nfunction isDocumentAttachment(value: Record<string, unknown>): boolean {\n if (value.type === \"document\") return true;\n const contentType = String(value.contentType ?? \"\").toLowerCase();\n const name = String(value.name ?? \"\").toLowerCase();\n return contentType === \"application/pdf\" || name.endsWith(\".pdf\");\n}\n\nexport function getOversizedDocumentAttachmentError(\n attachments: ReadonlyArray<unknown>,\n): string | null {\n for (const attachment of attachments) {\n if (!attachment || typeof attachment !== \"object\") continue;\n const candidate = attachment as Record<string, unknown>;\n if (!isDocumentAttachment(candidate)) continue;\n const file = candidate.file;\n if (!(file instanceof File)) continue;\n if (file.size <= MAX_DOCUMENT_ATTACHMENT_BYTES) continue;\n const name =\n typeof candidate.name === \"string\" && candidate.name.trim()\n ? candidate.name\n : file.name;\n const mb = (file.size / 1024 / 1024).toFixed(1);\n const maxMb = (MAX_DOCUMENT_ATTACHMENT_BYTES / 1024 / 1024).toFixed(0);\n return `\"${name}\" is ${mb} MB — PDFs are capped at ${maxMb} MB to stay within message limits. Please reduce the file size or split it into smaller parts.`;\n }\n return null;\n}\n\nexport function getComposerSubmitIntentForEnterKey(\n event: Pick<KeyboardEvent, \"key\" | \"shiftKey\" | \"metaKey\" | \"ctrlKey\">,\n isMac: boolean,\n): ComposerSubmitIntent | null {\n if (event.key !== \"Enter\" || event.shiftKey) return null;\n\n const queuedModifierPressed = isMac ? event.metaKey : event.ctrlKey;\n if (queuedModifierPressed) return \"queued\";\n\n if (!event.metaKey && !event.ctrlKey) return \"immediate\";\n\n return null;\n}\n\nexport function insertComposerHardBreakAndScrollIntoView(\n view: Pick<EditorView, \"state\" | \"dispatch\">,\n): boolean {\n const hardBreak = view.state.schema.nodes.hardBreak;\n if (!hardBreak) return false;\n\n view.dispatch(\n view.state.tr.replaceSelectionWith(hardBreak.create()).scrollIntoView(),\n );\n return true;\n}\n\nexport function displayableComposerModeMessage(options: {\n messagePrefix: string;\n trimmedText: string;\n attachmentCount: number;\n}): string {\n const modePrompt =\n options.trimmedText ||\n (options.attachmentCount > 0 ? \"Use the attached context.\" : \"\");\n return `${options.messagePrefix}${modePrompt}`;\n}\n\nfunction uniquifyComposerImageFile(file: File): File {\n if (!file.type.startsWith(\"image/\")) return file;\n const uniqueName = `${Date.now()}-${Math.random().toString(36).slice(2)}-${file.name}`;\n return new File([file], uniqueName, { type: file.type });\n}\n\nfunction composerDocumentHasContent(doc: {\n textContent: string;\n descendants: (callback: (node: any) => boolean | void) => void;\n}): boolean {\n if (doc.textContent.trim().length > 0) return true;\n let hasContent = false;\n doc.descendants((node: any) => {\n if (\n node.type.name === \"mentionReference\" ||\n node.type.name === \"fileReference\" ||\n node.type.name === \"skillReference\"\n ) {\n hasContent = true;\n return false;\n }\n return true;\n });\n return hasContent;\n}\n\nexport function handleComposerFileDrop(options: {\n event: Pick<DragEvent, \"dataTransfer\" | \"preventDefault\" | \"stopPropagation\">;\n addAttachment: (file: File) => Promise<unknown>;\n onError?: (error: unknown) => void;\n}): boolean {\n const droppedFiles = Array.from(options.event.dataTransfer?.files ?? []);\n if (droppedFiles.length === 0) return false;\n\n options.event.preventDefault();\n options.event.stopPropagation();\n const attachments = droppedFiles.map(uniquifyComposerImageFile);\n void Promise.all(\n attachments.map((file) => options.addAttachment(file)),\n ).catch((error) => {\n options.onError?.(error);\n });\n return true;\n}\n\nconst BUILT_IN_COMMANDS: SlashCommand[] = [\n { name: \"clear\", description: \"Start a new chat\", icon: \"clear\" },\n { name: \"new\", description: \"Start a new chat\", icon: \"new\" },\n { name: \"history\", description: \"Browse all chats\", icon: \"history\" },\n { name: \"plan\", description: \"Switch to read-only planning\", icon: \"plan\" },\n { name: \"act\", description: \"Switch back to acting\", icon: \"act\" },\n { name: \"help\", description: \"Show available commands\", icon: \"help\" },\n];\n\nfunction normalizeSlashCommandName(name: string): string {\n return name.replace(/^\\/+/, \"\").trim().toLowerCase();\n}\n\nfunction mergeSlashCommands(commands: SlashCommand[]): SlashCommand[] {\n const seen = new Set<string>();\n const merged: SlashCommand[] = [];\n for (const command of commands) {\n const name = normalizeSlashCommandName(command.name);\n if (!name || seen.has(name)) continue;\n seen.add(name);\n merged.push({ ...command, name });\n }\n return merged;\n}\n\nfunction mergeSlashSkills(skills: SkillResult[]): SkillResult[] {\n const seen = new Set<string>();\n const merged: SkillResult[] = [];\n for (const skill of skills) {\n const key = `${skill.source ?? \"\"}:${skill.path ?? \"\"}:${skill.name}`;\n if (!skill.name || seen.has(key)) continue;\n seen.add(key);\n merged.push(skill);\n }\n return merged;\n}\n\nconst COMPOSER_MODE_CONFIGS: Record<\n ComposerMode,\n {\n label: string;\n icon: React.ComponentType<{ className?: string }>;\n placeholder: string;\n messagePrefix: string;\n getContext: (prompt: string) => string;\n beforeSend?: () => void;\n }\n> = {\n skill: {\n label: \"Create Skill\",\n icon: IconBulb,\n placeholder: \"Describe the skill you want to create...\",\n messagePrefix: \"Create a skill: \",\n getContext: (prompt) =>\n `The user wants to create an agent skill. Their description: \"${prompt}\"\n\nFollow the create-skill pattern to build this. Before writing:\n\n1. **Determine the skill name** — derive a hyphen-case name from the description (e.g. \"code review\" → \"code-review\")\n2. **Determine the skill type** — Pattern (architectural rule), Workflow (step-by-step), or Generator (scaffolding)\n3. **Write the skill** as a personal resource at path \"skills/<name>/SKILL.md\" using the \\`resources\\` tool with \\`action: \"write\"\\`\n\nThe skill file MUST have YAML frontmatter with name and description (under 40 words), then markdown with:\n- Clear rule/purpose statement\n- Why this skill exists\n- How to follow it (with code examples where helpful)\n- Common violations to avoid\n- Related skills\n\nAfter creating, update the shared AGENTS.md resource to reference the new skill in its skills table.\n\nKeep the skill concise (under 500 lines) and actionable.`,\n },\n job: {\n label: \"Schedule Task\",\n icon: IconClock,\n placeholder: \"Describe what should happen and when...\",\n messagePrefix: \"Create a recurring job: \",\n getContext: (prompt) =>\n `The user wants to create a recurring job. Their description: \"${prompt}\"\n\nUse the manage-jobs tool with action \"create\" to create this. You need to:\n1. Derive a hyphen-case name from the description\n2. Convert the schedule to a cron expression (e.g., \"every weekday at 9am\" → \"0 9 * * 1-5\")\n3. Write clear, self-contained instructions for what the agent should do each time the job runs\n4. Create it in personal scope\n\nThe job will run automatically on the schedule. Make the instructions specific — include which actions to call and what to do with results.`,\n },\n automation: {\n label: \"Create Automation\",\n icon: IconBolt,\n placeholder: \"Describe what you want to automate...\",\n messagePrefix: \"Create an automation: \",\n beforeSend: () => {\n window.dispatchEvent(\n new CustomEvent(\"agent-panel:set-mode\", {\n detail: { mode: \"chat\" },\n }),\n );\n },\n getContext: (prompt) =>\n `The user wants to create a new automation. Scope: personal. Their description: \"${prompt}\"\n\nUse manage-automations with action=define to create it. Ask clarifying questions if needed about what event to trigger on, conditions, and what actions to take.`,\n },\n extension: {\n label: \"Create Extension\",\n icon: IconTool,\n placeholder: \"Describe the interactive extension you want to build...\",\n messagePrefix: \"Create an extension: \",\n getContext: (prompt) =>\n `The user wants to create an interactive extension (sandboxed mini-app). Their description: \"${prompt}\"\n\nUse the create-extension action with Alpine.js HTML content. The extension runs as a sandboxed iframe with Tailwind CSS and modest default canvas padding. For edge-to-edge layouts, put data-extension-layout=\"full-bleed\" on the outermost element.\n\nAfter creating the extension, navigate the user to it with the path returned by create-extension; extension URLs may include a friendly \"/extensions/<id>/<slug>\" suffix.\n\nMake the extension functional and visually polished. Extensions can use extensionFetch() for external API calls, appAction()/appFetch() for app operations, extensionData for per-extension persistence, and dbQuery()/dbExec() only for existing app tables.\n\nPrefer appAction()/appFetch() for app data. Some actions return JSON strings for CLI compatibility, so parse string results before counting rows or reading arrays. Do not guess raw SQL table names or columns for app data; use dbQuery()/dbExec() only when the table is known to exist in the current schema.`,\n },\n};\n\nfunction ComposerModeChip({\n mode,\n onRemove,\n}: {\n mode: ComposerMode;\n onRemove: () => void;\n}) {\n const config = COMPOSER_MODE_CONFIGS[mode];\n const Icon = config.icon;\n return (\n <span className=\"inline-flex items-center gap-1 rounded-md border border-border bg-muted/50 px-1.5 py-0.5 text-xs font-medium text-foreground\">\n <Icon className=\"h-3 w-3 text-muted-foreground\" />\n {config.label}\n <button\n type=\"button\"\n onClick={onRemove}\n className=\"ms-0.5 rounded-sm text-muted-foreground hover:text-foreground cursor-pointer\"\n >\n <IconX className=\"h-3 w-3\" />\n </button>\n </span>\n );\n}\n\ntype ExecMode = \"build\" | \"plan\";\n\nexport interface TiptapComposerProps {\n placeholder?: string;\n disabled?: boolean;\n focusRef?: React.Ref<TiptapComposerHandle>;\n /** Programmatically seed the editor with plain text. */\n initialText?: string;\n /** Stable key used to re-apply the seeded text. */\n initialTextKey?: string | number;\n /**\n * When provided, called instead of composerRuntime.send(). Used for queue\n * mode and standalone prompt popovers. Receives the live composer\n * attachments so callers (e.g. PromptComposer) can surface uploaded files.\n */\n onSubmit?: (\n text: string,\n references: Reference[],\n attachments?: ReadonlyArray<unknown>,\n options?: TiptapComposerSubmitOptions,\n ) => void;\n /** Return false to stop a submit before it enters the chat runtime. */\n onBeforeSubmit?: () => boolean | Promise<boolean>;\n /**\n * Clear the editor after an onSubmit handler runs. Standalone workflows that\n * may fail outside the composer can keep the draft visible for quick edits.\n */\n clearOnSubmit?: boolean;\n /** Called whenever the plain editor text changes. */\n onTextChange?: (text: string) => void;\n /** Custom action button (e.g. stop button) to render instead of the default send button. */\n actionButton?: React.ReactNode;\n /** Extra button to render alongside the default send button (e.g. stop while running). */\n extraActionButton?: React.ReactNode;\n /** Custom attachment button to render instead of ComposerPrimitive.AddAttachment. */\n attachButton?: React.ReactNode;\n /** Custom host-owned control rendered next to the attachment affordance. */\n modeControl?: React.ReactNode;\n /** Explicit host-owned toolbar slot rendered next to the attachment affordance. */\n toolbarSlot?: React.ReactNode;\n /** Shared sizing/layout variant for host surfaces. Default keeps sidebar behavior. */\n layoutVariant?: AgentComposerLayoutVariant;\n /** Additional slash commands surfaced in the shared / menu. */\n slashCommands?: SlashCommand[];\n /** Additional slash skills surfaced in the shared / menu. */\n slashSkills?: SkillResult[];\n /** Include built-in sidebar slash commands like /clear and /help. Default true. */\n includeDefaultSlashCommands?: boolean;\n /** Include app-discovered skills from the default agent endpoint. Default true. */\n includeDefaultSlashSkills?: boolean;\n /** Called when a slash command (e.g. /clear, /help) is executed */\n onSlashCommand?: (command: string) => void;\n /** Current execution mode (build/plan) */\n execMode?: ExecMode;\n /** Callback to change execution mode */\n onExecModeChange?: (mode: ExecMode) => void;\n /** Disable Plan mode while leaving Act mode available. */\n planModeDisabled?: boolean;\n /** Explanation shown next to the disabled Plan option. */\n planModeDisabledReason?: string;\n /** Show the microphone button for voice dictation. Defaults to DEFAULT_VOICE_DICTATION_ENABLED. */\n voiceEnabled?: boolean;\n /** Selected model override for this conversation */\n selectedModel?: string;\n /** Selected reasoning effort override for this conversation */\n selectedEffort?: ReasoningEffort;\n /** Available models grouped by provider */\n availableModels?: Array<{\n engine: string;\n label: string;\n models: string[];\n configured: boolean;\n }>;\n /** Callback when user picks a model */\n onModelChange?: (model: string, engine: string) => void;\n /** Callback when user picks a reasoning effort */\n onEffortChange?: (effort: ReasoningEffort) => void;\n /**\n * Disable Builder/provider status polling for hosts that supply provider\n * state through another channel, such as Electron IPC.\n */\n providerConnectStatusEnabled?: boolean;\n /**\n * Override the Builder.io connect action in the model picker. When provided,\n * clicking \"Connect Builder.io\" calls this instead of opening a browser popup.\n * Used by the Electron desktop app to route through the native IPC handler.\n */\n onConnectProvider?: () => void;\n /**\n * Optional secondary model menu (e.g. an image-generation model) rendered as\n * an extra section inside the model picker. Opt-in; omit for chat-only apps.\n */\n imageModelMenu?: ComposerImageModelMenu;\n /** Stable scope for persisted drafts, usually the active thread or tab id. */\n draftScope?: string;\n /** Keyed context nuggets staged for the next submitted prompt. */\n contextItems?: AgentChatContextItem[];\n /** Remove a staged context nugget by key. */\n onRemoveContextItem?: (key: string) => void;\n /**\n * Controls the \"+\" menu next to the composer. `\"full\"` (default) shows the\n * normal Upload / Skill / Job / Automation / Tool / MCP picker. `\"upload-only\"`\n * collapses it to a single button that opens the file picker directly.\n * `\"hidden\"` hides attachment controls for text-only prompt surfaces.\n */\n plusMenuMode?: \"full\" | \"upload-only\" | \"hidden\";\n /**\n * When true and the composer is running inside the Builder.io webview/iframe,\n * intercept \"build me an app/agent\" prompts and forward them to the parent\n * Builder chat via `builder.submitChat` instead of sending to the local\n * agent. Off by default — the chat sidebar opts in; standalone prompt\n * forms (NewWorkspaceAppFlow, etc.) handle delegation themselves with\n * extra context (vault keys, computed app ids) that the raw composer\n * text lacks.\n */\n interceptBuildRequestsForBuilder?: boolean;\n /**\n * Called when a drag-drop or paste attachment fails (e.g. unsupported format,\n * size cap). Use this to surface a visible error in the parent chat surface\n * rather than silently swallowing the problem.\n */\n onAttachmentError?: (message: string) => void;\n}\n\nfunction plainTextToDoc(text: string) {\n const lines = text.length > 0 ? text.split(/\\r?\\n/) : [\"\"];\n return {\n type: \"doc\",\n content: lines.map((line) => ({\n type: \"paragraph\",\n content: line ? [{ type: \"text\", text: line }] : [],\n })),\n };\n}\n\nexport function createTiptapComposerExtensions(\n getPlaceholder: () => string | undefined,\n) {\n return [\n StarterKit.configure({\n heading: false,\n horizontalRule: false,\n bulletList: false,\n orderedList: false,\n listItem: false,\n listKeymap: false,\n blockquote: false,\n codeBlock: false,\n strike: false,\n italic: false,\n bold: false,\n code: false,\n dropcursor: false,\n gapcursor: false,\n link: false,\n trailingNode: false,\n underline: false,\n }),\n Placeholder.configure({\n placeholder: () => getPlaceholder() ?? \"\",\n emptyEditorClass: \"is-editor-empty\",\n showOnlyCurrent: false,\n }),\n FileReference,\n SkillReference,\n MentionReference,\n ];\n}\n\nfunction ModeSelector({\n mode,\n onChange,\n planModeDisabled = false,\n planModeDisabledReason = \"Open Agent Native Desktop to use Plan mode.\",\n}: {\n mode: ExecMode;\n onChange: (mode: ExecMode) => void;\n planModeDisabled?: boolean;\n planModeDisabledReason?: string;\n}) {\n const [open, setOpen] = useState(false);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n aria-label={mode === \"build\" ? \"Act mode\" : \"Plan mode\"}\n data-agent-composer-slot=\"mode-button\"\n className=\"agent-composer-mode-button shrink-0 flex items-center gap-1 rounded-md px-2 py-1 text-[12px] font-medium text-muted-foreground hover:bg-accent/50 hover:text-foreground\"\n >\n {mode === \"build\" ? \"Act\" : \"Plan\"}\n <IconChevronDown className=\"h-3 w-3 opacity-60\" />\n </button>\n </PopoverTrigger>\n <PopoverContent\n side=\"top\"\n align=\"end\"\n sideOffset={6}\n collisionPadding={8}\n data-agent-native-composer-popover=\"true\"\n className=\"z-[260] w-60 rounded-lg border-border p-0 py-1 shadow-lg\"\n style={{ fontSize: 13 }}\n >\n <button\n type=\"button\"\n onClick={() => {\n onChange(\"build\");\n setOpen(false);\n }}\n className=\"flex w-full items-center gap-3 px-3 py-2 hover:bg-accent/50 text-start\"\n >\n <IconPencil className=\"h-4 w-4 shrink-0 text-muted-foreground\" />\n <div className=\"flex-1 min-w-0\">\n <span className=\"font-medium text-foreground text-[13px]\">Act</span>\n <p className=\"text-[11px] text-muted-foreground mt-0.5\">\n Use tools and make approved changes\n </p>\n </div>\n {mode === \"build\" && (\n <IconCheck className=\"h-3.5 w-3.5 shrink-0 text-blue-500\" />\n )}\n </button>\n <button\n type=\"button\"\n disabled={planModeDisabled}\n title={planModeDisabled ? planModeDisabledReason : undefined}\n onClick={() => {\n if (planModeDisabled) return;\n onChange(\"plan\");\n setOpen(false);\n }}\n className={`flex w-full items-center gap-3 px-3 py-2 text-start ${\n planModeDisabled\n ? \"cursor-not-allowed opacity-60\"\n : \"hover:bg-accent/50\"\n }`}\n >\n <IconClipboardList className=\"h-4 w-4 shrink-0 text-muted-foreground\" />\n <div className=\"flex-1 min-w-0\">\n <span className=\"font-medium text-foreground text-[13px]\">\n Plan\n </span>\n <p className=\"text-[11px] text-muted-foreground mt-0.5\">\n {planModeDisabled\n ? planModeDisabledReason\n : \"Read-only research and approval first\"}\n </p>\n </div>\n {mode === \"plan\" && !planModeDisabled && (\n <IconCheck className=\"h-3.5 w-3.5 shrink-0 text-blue-500\" />\n )}\n </button>\n </PopoverContent>\n </Popover>\n );\n}\n\nconst FRIENDLY_MODEL_NAMES: Record<string, string> = {\n auto: \"Default model\",\n \"claude-fable-5\": \"Fable 5\",\n \"grok-code-fast\": \"Grok Code Fast\",\n \"qwen3-coder\": \"Qwen3 Coder\",\n \"kimi-k2-5\": \"Kimi K2.5\",\n \"deepseek-v3-1\": \"DeepSeek v3.1\",\n \"z-ai/glm-5.2\": \"GLM 5.2\",\n};\n\nexport const MODEL_SELECTOR_POPOVER_STYLE = {\n fontSize: 13,\n maxHeight: \"min(500px, var(--radix-popover-content-available-height, 500px))\",\n} satisfies React.CSSProperties;\n\nfunction friendlyModelName(model: string): string {\n if (FRIENDLY_MODEL_NAMES[model]) return FRIENDLY_MODEL_NAMES[model];\n // Claude: claude-{tier}-{major}[-minor][-dateYYYYMMDD] → Tier Major[.Minor]\n const claude = model.match(\n /^claude-(opus|sonnet|haiku)-(\\d+)(?:-(\\d+))?(?:-\\d{8,})?$/,\n );\n if (claude) {\n const tier = claude[1][0].toUpperCase() + claude[1].slice(1);\n return `${tier} ${claude[2]}${claude[3] ? `.${claude[3]}` : \"\"}`;\n }\n // GPT: gpt-{major}-{minor}[-suffix] or gpt-{major}.{minor}[-suffix]\n if (model.startsWith(\"gpt-\")) {\n const rest = model.slice(4);\n const gpt = rest.match(/^(\\d+)[.-](\\d+)(?:[.-](.+))?$/);\n if (gpt) {\n const suffix = gpt[3]\n ? \" \" +\n gpt[3]\n .split(\"-\")\n .map((s) => s[0].toUpperCase() + s.slice(1))\n .join(\" \")\n : \"\";\n return `GPT-${gpt[1]}.${gpt[2]}${suffix}`;\n }\n return `GPT-${rest}`;\n }\n if (/^o\\d/.test(model)) return model;\n // Gemini: gemini-{major}-{minor}-{variant}[-preview] → Gemini Major.Minor Variant\n const geminiVersioned = model.match(\n /^gemini-(\\d+)-(\\d+)-(.+?)(?:-preview)?$/,\n );\n if (geminiVersioned) {\n const variant = geminiVersioned[3]\n .split(\"-\")\n .map((s) => s[0].toUpperCase() + s.slice(1))\n .join(\" \");\n return `Gemini ${geminiVersioned[1]}.${geminiVersioned[2]} ${variant}`;\n }\n // Gemini: gemini-{version.parts}[-preview] → Gemini Version Parts\n const gemini = model.match(/^gemini-(.+?)(?:-preview)?$/);\n if (gemini) {\n const parts = gemini[1]\n .split(\"-\")\n .map((s) => s[0].toUpperCase() + s.slice(1))\n .join(\" \");\n return `Gemini ${parts}`;\n }\n return model;\n}\n\n/**\n * Deduplicate models to only the latest version per family.\n * e.g. [opus-4-7, opus-4-6, opus-4-5] → [opus-4-7]\n */\nfunction latestModelsOnly(models: string[]): string[] {\n const seen = new Set<string>();\n return models.filter((m) => {\n // Claude: family = tier (opus/sonnet/haiku)\n const claude = m.match(/^claude-(opus|sonnet|haiku)-/);\n if (claude) {\n if (seen.has(claude[1])) return false;\n seen.add(claude[1]);\n return true;\n }\n // GPT: family = gpt-{major} (e.g. gpt-5.4 and gpt-5.4-mini are different)\n // OpenAI reasoning: each is its own family\n // Gemini: family = gemini-{major} + variant\n const gemini = m.match(/^gemini-(\\d+(?:\\.\\d+)?)-(.+?)(?:-preview)?$/);\n if (gemini) {\n const family = gemini[2]; // flash, pro, etc.\n if (seen.has(`gemini-${family}`)) return false;\n seen.add(`gemini-${family}`);\n return true;\n }\n return true;\n });\n}\n\n/**\n * Optional secondary model menu for apps that drive a separate generation model\n * alongside the chat LLM (e.g. the Assets app's image-generation model). When\n * provided, the model picker renders an extra collapsible section so the user\n * can see and pick both \"what reasons about my request\" (the chat model) and\n * \"what produces the output\" (this model). Opt-in — omit it and nothing changes.\n */\nexport interface ComposerImageModelMenu {\n /** Currently-selected model id for this secondary menu. */\n value: string;\n /** Selectable options (stable id + human label). */\n options: Array<{ value: string; label: string }>;\n /** Invoked when the user picks a different option. */\n onChange: (value: string) => void;\n /** Section header. Defaults to \"Image model\". */\n label?: string;\n}\n\nfunction ModelSelector({\n model,\n effort = \"auto\",\n engines,\n onChange,\n onEffortChange,\n providerConnectStatusEnabled = true,\n onConnectProvider,\n imageModel,\n}: {\n model: string;\n effort?: ReasoningEffort;\n engines: Array<{\n engine: string;\n label: string;\n models: string[];\n configured: boolean;\n }>;\n onChange: (model: string, engine: string) => void;\n onEffortChange?: (effort: ReasoningEffort) => void;\n providerConnectStatusEnabled?: boolean;\n onConnectProvider?: () => void;\n imageModel?: ComposerImageModelMenu;\n}) {\n const [open, setOpen] = useState(false);\n const autoModelGroup = engines.find((group) => group.models.includes(\"auto\"));\n const providerGroups = useMemo(\n () =>\n engines\n .map((group) => ({\n ...group,\n models: group.models.filter((candidate) => candidate !== \"auto\"),\n }))\n .filter((group) => group.models.length > 0),\n [engines],\n );\n const effortOptions =\n model === \"auto\"\n ? ([\n \"auto\",\n \"low\",\n \"medium\",\n \"high\",\n \"xhigh\",\n \"max\",\n ] satisfies ReasoningEffort[])\n : getReasoningEffortOptionsForModel(model);\n\n // Collapse non-selected families by default. The family containing the\n // currently-selected model stays expanded so the user sees their pick at\n // a glance; clicking another family's header expands it inline.\n const selectedGroupKey = useMemo(() => {\n const found = providerGroups.find((g) => g.models.includes(model));\n return found ? `${found.engine}:${found.label}` : null;\n }, [model, providerGroups]);\n\n const [expandedGroups, setExpandedGroups] = useState<Set<string>>(\n () => new Set(selectedGroupKey ? [selectedGroupKey] : []),\n );\n\n // Reset expansion when the popover re-opens so the picker always lands\n // on the \"selected family expanded, others collapsed\" view.\n useEffect(() => {\n if (open) {\n setExpandedGroups(new Set(selectedGroupKey ? [selectedGroupKey] : []));\n }\n }, [open, selectedGroupKey]);\n\n const toggleGroup = useCallback((key: string) => {\n setExpandedGroups((prev) => {\n const next = new Set(prev);\n if (next.has(key)) next.delete(key);\n else next.add(key);\n return next;\n });\n }, []);\n\n // The reasoning effort list is collapsed by default — it's a secondary\n // control most users don't touch, so it stays tucked behind a header that\n // reveals the current effort at a glance. Reset to collapsed on each open.\n const [reasoningExpanded, setReasoningExpanded] = useState(false);\n useEffect(() => {\n if (open) setReasoningExpanded(false);\n }, [open]);\n\n // The optional image-model section follows the same collapsed-by-default\n // pattern; the current selection shows next to the header.\n const [imageExpanded, setImageExpanded] = useState(false);\n useEffect(() => {\n if (open) setImageExpanded(false);\n }, [open]);\n const imageModelLabel =\n imageModel?.options.find((option) => option.value === imageModel.value)\n ?.label ?? imageModel?.value;\n\n // When Builder.io isn't connected, surface a one-click connect path —\n // it unlocks every model family (Claude, OpenAI, Gemini) without the\n // user having to paste individual API keys.\n const builderFlow = useBuilderConnectFlow({\n enabled: providerConnectStatusEnabled,\n trackingSource: \"composer_builder_cta\",\n });\n const hasConfiguredBuilderModels = providerGroups.some(\n (group) => group.engine === \"builder\" && group.configured,\n );\n const showBuilderCta =\n (builderFlow.hasFetchedStatus ||\n (!providerConnectStatusEnabled && !!onConnectProvider)) &&\n !builderFlow.configured &&\n !builderFlow.envManaged &&\n !hasConfiguredBuilderModels;\n const openLlmSettings = useCallback(() => {\n try {\n window.location.hash = \"llm\";\n } catch {}\n window.dispatchEvent(new CustomEvent(\"agent-panel:open-settings\"));\n setOpen(false);\n }, []);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n data-agent-composer-slot=\"model-button\"\n className=\"agent-composer-model-button flex min-w-0 max-w-[10.5rem] shrink items-center gap-1 rounded-md px-2 py-1 text-[12px] font-medium text-muted-foreground hover:bg-accent/50 hover:text-foreground\"\n >\n <span className=\"min-w-0 truncate\">{friendlyModelName(model)}</span>\n {effortOptions.length > 0 && (\n <span className=\"agent-composer-model-effort min-w-0 shrink truncate text-muted-foreground/70\">\n · {reasoningEffortLabel(effort)}\n </span>\n )}\n <IconChevronDown className=\"h-3 w-3 shrink-0 opacity-60\" />\n </button>\n </PopoverTrigger>\n <PopoverContent\n side=\"top\"\n align=\"end\"\n sideOffset={6}\n collisionPadding={8}\n data-agent-native-composer-popover=\"true\"\n className=\"z-[260] box-border w-72 overflow-y-auto rounded-lg border-border p-0 py-1 shadow-lg\"\n style={MODEL_SELECTOR_POPOVER_STYLE}\n >\n {showBuilderCta && (\n <>\n <button\n type=\"button\"\n onClick={() => {\n if (onConnectProvider) {\n onConnectProvider();\n } else {\n builderFlow.start();\n }\n }}\n disabled={!onConnectProvider && builderFlow.connecting}\n className=\"flex w-full items-start gap-2 px-3 py-2 text-start hover:bg-accent/50 disabled:opacity-60\"\n >\n <IconPlugConnected className=\"h-4 w-4 shrink-0 mt-0.5 text-blue-500\" />\n <span className=\"flex-1 min-w-0\">\n <span className=\"block text-[12px] font-medium text-foreground\">\n {!onConnectProvider && builderFlow.connecting\n ? \"Connecting Builder.io…\"\n : \"Connect Builder.io\"}\n </span>\n <span className=\"block text-[11px] text-muted-foreground\">\n Free credits for Claude, OpenAI & Gemini\n </span>\n </span>\n </button>\n <div className=\"my-1 border-t border-border\" />\n </>\n )}\n {imageModel && imageModel.options.length > 0 && (\n <>\n <div className=\"flex items-center hover:bg-accent/30\">\n <button\n type=\"button\"\n aria-expanded={imageExpanded}\n onClick={() => setImageExpanded((prev) => !prev)}\n className=\"flex flex-1 min-w-0 items-center gap-1.5 px-2 py-1.5 cursor-pointer text-start\"\n >\n {imageExpanded ? (\n <IconChevronDown className=\"h-3 w-3 shrink-0 text-muted-foreground\" />\n ) : (\n <IconChevronRight className=\"h-3 w-3 shrink-0 text-muted-foreground rtl:-scale-x-100\" />\n )}\n <span className=\"text-[11px] font-medium text-muted-foreground uppercase tracking-wide shrink-0\">\n {imageModel.label ?? \"Image model\"}\n </span>\n {!imageExpanded && imageModelLabel && (\n <span className=\"text-[11px] text-muted-foreground/80 truncate\">\n {imageModelLabel}\n </span>\n )}\n </button>\n </div>\n {imageExpanded &&\n imageModel.options.map((option) => (\n <button\n key={option.value}\n type=\"button\"\n onClick={() => {\n imageModel.onChange(option.value);\n setImageExpanded(false);\n }}\n className=\"flex w-full items-center gap-3 ps-7 pe-3 py-1.5 text-start hover:bg-accent/50\"\n >\n <span className=\"flex-1 min-w-0 text-[13px] text-foreground truncate\">\n {option.label}\n </span>\n {option.value === imageModel.value && (\n <IconCheck className=\"h-3.5 w-3.5 shrink-0 text-blue-500\" />\n )}\n </button>\n ))}\n <div className=\"my-1 border-t border-border\" />\n </>\n )}\n {autoModelGroup && (\n <button\n type=\"button\"\n onClick={() => {\n onChange(\"auto\", autoModelGroup.engine);\n setOpen(false);\n }}\n className=\"flex w-full items-center gap-3 px-3 py-1.5 text-start hover:bg-accent/50\"\n >\n <span className=\"flex-1 min-w-0 text-[13px] text-foreground truncate\">\n Auto\n </span>\n {model === \"auto\" && (\n <IconCheck className=\"h-3.5 w-3.5 shrink-0 text-blue-500\" />\n )}\n </button>\n )}\n {autoModelGroup && providerGroups.length > 0 && (\n <div className=\"my-1 border-t border-border\" />\n )}\n {providerGroups.map((group) => {\n const models = latestModelsOnly(group.models);\n const groupKey = `${group.engine}:${group.label}`;\n const isExpanded = expandedGroups.has(groupKey);\n const ChevronIcon = isExpanded ? IconChevronDown : IconChevronRight;\n return (\n <div key={groupKey}>\n <div className=\"flex items-center hover:bg-accent/30\">\n <button\n type=\"button\"\n aria-expanded={isExpanded}\n onClick={() => toggleGroup(groupKey)}\n className=\"flex flex-1 min-w-0 items-center gap-1.5 px-2 py-1.5 cursor-pointer text-start\"\n >\n <ChevronIcon className=\"h-3 w-3 shrink-0 text-muted-foreground rtl:-scale-x-100\" />\n <span className=\"text-[11px] font-medium text-muted-foreground uppercase tracking-wide shrink-0\">\n {group.label}\n </span>\n {!isExpanded && groupKey === selectedGroupKey && (\n <span className=\"text-[11px] text-muted-foreground/80 truncate\">\n {friendlyModelName(model)}\n </span>\n )}\n </button>\n {!group.configured && (\n <button\n type=\"button\"\n className=\"text-[10px] text-muted-foreground/60 hover:text-foreground cursor-pointer pe-3 py-1.5\"\n onClick={openLlmSettings}\n >\n needs API key\n </button>\n )}\n </div>\n {isExpanded &&\n models.map((m) => (\n <button\n key={m}\n type=\"button\"\n onClick={() => {\n if (!group.configured) {\n openLlmSettings();\n return;\n }\n onChange(m, group.engine);\n const nextOptions = getReasoningEffortOptionsForModel(m);\n if (\n effort !== \"auto\" &&\n nextOptions.length > 0 &&\n !nextOptions.includes(effort)\n ) {\n onEffortChange?.(\"auto\");\n }\n setOpen(false);\n }}\n className={`flex w-full items-center gap-3 ps-7 pe-3 py-1.5 text-start ${\n group.configured\n ? \"hover:bg-accent/50\"\n : \"opacity-40 cursor-default\"\n }`}\n >\n <span className=\"flex-1 min-w-0 text-[13px] text-foreground truncate\">\n {friendlyModelName(m)}\n </span>\n {m === model && group.configured && (\n <IconCheck className=\"h-3.5 w-3.5 shrink-0 text-blue-500\" />\n )}\n </button>\n ))}\n </div>\n );\n })}\n {effortOptions.length > 0 && (\n <>\n <div className=\"my-1 border-t border-border\" />\n <div className=\"flex items-center hover:bg-accent/30\">\n <button\n type=\"button\"\n aria-expanded={reasoningExpanded}\n onClick={() => setReasoningExpanded((prev) => !prev)}\n className=\"flex flex-1 min-w-0 items-center gap-1.5 px-2 py-1.5 cursor-pointer text-start\"\n >\n {reasoningExpanded ? (\n <IconChevronDown className=\"h-3 w-3 shrink-0 text-muted-foreground\" />\n ) : (\n <IconChevronRight className=\"h-3 w-3 shrink-0 text-muted-foreground rtl:-scale-x-100\" />\n )}\n <span className=\"text-[11px] font-medium text-muted-foreground uppercase tracking-wide shrink-0\">\n Reasoning\n </span>\n {!reasoningExpanded && (\n <span className=\"text-[11px] text-muted-foreground/80 truncate\">\n {reasoningEffortLabel(effort)}\n </span>\n )}\n </button>\n </div>\n {reasoningExpanded &&\n effortOptions.map((option) => (\n <button\n key={option}\n type=\"button\"\n onClick={() => onEffortChange?.(option)}\n className=\"flex w-full items-center gap-3 ps-7 pe-3 py-1.5 text-start hover:bg-accent/50\"\n >\n <span className=\"flex-1 min-w-0 text-[13px] text-foreground truncate\">\n {reasoningEffortLabel(option)}\n </span>\n {option === effort && (\n <IconCheck className=\"h-3.5 w-3.5 shrink-0 text-blue-500\" />\n )}\n </button>\n ))}\n </>\n )}\n </PopoverContent>\n </Popover>\n );\n}\n\ntype PopoverState = {\n type: \"@\" | \"/\";\n position: { top: number; left: number };\n startPos: number;\n query: string;\n} | null;\n\nexport function TiptapComposer({\n placeholder = \"Message agent...\",\n disabled = false,\n focusRef,\n initialText,\n initialTextKey,\n onSubmit,\n onBeforeSubmit,\n clearOnSubmit = true,\n onTextChange,\n actionButton,\n extraActionButton,\n attachButton,\n modeControl,\n toolbarSlot,\n layoutVariant = \"default\",\n slashCommands = [],\n slashSkills = [],\n includeDefaultSlashCommands = true,\n includeDefaultSlashSkills = true,\n onSlashCommand,\n execMode,\n onExecModeChange,\n planModeDisabled = false,\n planModeDisabledReason,\n voiceEnabled = DEFAULT_VOICE_DICTATION_ENABLED,\n selectedModel,\n selectedEffort,\n availableModels,\n onModelChange,\n onEffortChange,\n providerConnectStatusEnabled,\n onConnectProvider,\n imageModelMenu,\n draftScope,\n contextItems = [],\n onRemoveContextItem,\n plusMenuMode = \"full\",\n interceptBuildRequestsForBuilder = false,\n onAttachmentError,\n}: TiptapComposerProps) {\n const [popover, setPopover] = useState<PopoverState>(null);\n const popoverRef = useRef<MentionPopoverRef>(null);\n const composerRuntime = useComposerRuntime();\n const submitInFlightRef = useRef(false);\n const [editorHasText, setEditorHasText] = useState(false);\n const [slotReferences, setSlotReferences] = useState<\n AgentComposerReference[]\n >([]);\n const composerText = useComposer((state) => state.text);\n const composerAttachments = useComposer((state) => state.attachments);\n const canSend = canSubmitComposerContent({\n hasEditorContent: editorHasText || slotReferences.length > 0,\n attachmentCount: composerAttachments.length,\n disabled,\n });\n const hasContextRows = contextItems.length > 0 || slotReferences.length > 0;\n const [composerMode, setComposerMode] = useState<ComposerMode | null>(null);\n const composerModeRef = useRef<ComposerMode | null>(null);\n const isMac =\n typeof navigator !== \"undefined\" &&\n /Mac|iPhone|iPad/.test(navigator.userAgent);\n\n // Refs for values accessed in handleKeyDown (ProseMirror doesn't re-bind)\n const popoverStateRef = useRef<PopoverState>(null);\n const onAttachmentErrorRef = useRef(onAttachmentError);\n onAttachmentErrorRef.current = onAttachmentError;\n const execModeRef = useRef(execMode);\n execModeRef.current = execMode;\n const onExecModeChangeRef = useRef(onExecModeChange);\n onExecModeChangeRef.current = onExecModeChange;\n const planModeDisabledRef = useRef(planModeDisabled);\n planModeDisabledRef.current = planModeDisabled;\n\n const { items: mentionItems, isLoading: mentionsLoading } = useMentionSearch(\n popover?.type === \"@\" ? popover.query : \"\",\n popover?.type === \"@\",\n );\n const filteredMentionItems = useMemo(\n () => filterMentionItemsForSlots(mentionItems, slotReferences),\n [mentionItems, slotReferences],\n );\n\n const {\n skills,\n hint,\n isLoading: skillsLoading,\n } = useSkills(includeDefaultSlashSkills && popover?.type === \"/\");\n\n const allSlashCommands = useMemo(\n () =>\n mergeSlashCommands([\n ...(includeDefaultSlashCommands ? BUILT_IN_COMMANDS : []),\n ...slashCommands,\n ]),\n [includeDefaultSlashCommands, slashCommands],\n );\n\n const allSlashSkills = useMemo(\n () =>\n mergeSlashSkills([\n ...(includeDefaultSlashSkills ? skills : []),\n ...slashSkills,\n ]),\n [includeDefaultSlashSkills, skills, slashSkills],\n );\n\n const filteredCommands = useMemo(() => {\n if (!popover || popover.type !== \"/\") return allSlashCommands;\n const q = popover.query.toLowerCase();\n if (!q) return allSlashCommands;\n return allSlashCommands.filter(\n (c) =>\n c.name.toLowerCase().includes(q) ||\n c.description.toLowerCase().includes(q),\n );\n }, [allSlashCommands, popover]);\n\n const filteredSkills = useMemo(() => {\n if (!popover || popover.type !== \"/\") return allSlashSkills;\n const q = popover.query.toLowerCase();\n if (!q) return allSlashSkills;\n return allSlashSkills.filter(\n (s) =>\n s.name.toLowerCase().includes(q) ||\n s.description?.toLowerCase().includes(q),\n );\n }, [allSlashSkills, popover]);\n\n // Keep refs in sync with state\n const mentionItemsRef = useRef(filteredMentionItems);\n mentionItemsRef.current = filteredMentionItems;\n const filteredCommandsRef = useRef(filteredCommands);\n filteredCommandsRef.current = filteredCommands;\n const filteredSkillsRef = useRef(filteredSkills);\n filteredSkillsRef.current = filteredSkills;\n const onSlashCommandRef = useRef(onSlashCommand);\n onSlashCommandRef.current = onSlashCommand;\n const onTextChangeRef = useRef(onTextChange);\n onTextChangeRef.current = onTextChange;\n const initialTextKeyRef = useRef<string | number | undefined>(undefined);\n const seenReferenceInsertIdsRef = useRef<Set<string>>(new Set());\n\n const closePopover = useCallback(() => {\n setPopover(null);\n popoverStateRef.current = null;\n }, []);\n\n // Persist draft to localStorage so hot-reloads don't lose the prompt\n const draftKey = getComposerDraftKey(draftScope);\n const draftTimerRef = useRef<ReturnType<typeof setTimeout>>(undefined);\n useEffect(() => {\n return () => {\n clearTimeout(draftTimerRef.current);\n };\n }, []);\n // Tiptap reads extension config once at init; ref keeps runtime prop\n // changes visible to Placeholder's function form.\n const placeholderRef = useRef(placeholder);\n useEffect(() => {\n placeholderRef.current = composerMode\n ? COMPOSER_MODE_CONFIGS[composerMode].placeholder\n : placeholder;\n }, [placeholder, composerMode]);\n\n const editor = useEditor({\n extensions: createTiptapComposerExtensions(() => placeholderRef.current),\n editable: !disabled,\n onCreate: ({ editor: ed }) => {\n // Restore draft on mount\n try {\n if (initialText !== undefined) {\n ed.commands.setContent(plainTextToDoc(initialText));\n ed.commands.focus(\"end\");\n setEditorHasText(composerDocumentHasContent(ed.state.doc));\n initialTextKeyRef.current = initialTextKey ?? initialText;\n } else {\n const saved = localStorage.getItem(draftKey);\n if (saved) {\n ed.commands.setContent(saved);\n ed.commands.focus(\"end\");\n setEditorHasText(composerDocumentHasContent(ed.state.doc));\n }\n }\n onTextChangeRef.current?.(ed.state.doc.textContent.trim());\n } catch {}\n },\n onUpdate: ({ editor: ed }) => {\n // Drive the send button's enabled state from the actual editor contents;\n // the composer runtime is only synced on submit, so its isEmpty lags.\n setEditorHasText(composerDocumentHasContent(ed.state.doc));\n onTextChangeRef.current?.(ed.state.doc.textContent.trim());\n\n // Debounce-save draft to localStorage\n clearTimeout(draftTimerRef.current);\n draftTimerRef.current = setTimeout(() => {\n try {\n const html = ed.getHTML();\n const isEmpty = !composerDocumentHasContent(ed.state.doc);\n if (isEmpty) {\n localStorage.removeItem(draftKey);\n } else {\n localStorage.setItem(draftKey, html);\n }\n } catch {}\n }, 300);\n },\n editorProps: {\n attributes: {\n \"data-agent-composer-variant\": layoutVariant,\n \"data-agent-composer-slot\": \"editor-input\",\n class:\n \"agent-composer-prosemirror flex-1 resize-none bg-transparent text-sm text-foreground outline-none leading-[1.625rem] min-h-[3.25rem] max-h-[10rem] overflow-y-auto\",\n },\n handlePaste: (_view, event) => {\n const paste = readClipboardPaste(event.clipboardData);\n const pastedText = paste.text;\n const files = Array.from(event.clipboardData?.files ?? []).filter(\n (file) => file.type.startsWith(\"image/\"),\n );\n if (files.length > 0) {\n event.preventDefault();\n const attachments: File[] = files.map((file) => {\n // SimpleImageAttachmentAdapter uses file.name as the attachment id.\n // Clipboard images (e.g. screenshots) are typically all named\n // \"image.png\", so a second paste would replace the first instead of\n // appending. Prepend a unique token so each paste gets a distinct id.\n const uniqueName = `${Date.now()}-${Math.random().toString(36).slice(2)}-${file.name}`;\n return new File([file], uniqueName, { type: file.type });\n });\n\n // Google Docs rich clipboard payloads can contain both embedded\n // image files and the document text. Since handling files means we\n // prevent Tiptap's default paste, preserve any text as its own chip\n // instead of silently dropping the source material.\n if (pastedText.trim()) {\n attachments.push(createPastedAttachmentFile(paste));\n }\n\n void Promise.all(\n attachments.map((file) => composerRuntime.addAttachment(file)),\n ).catch((error) => {\n const msg =\n error instanceof Error\n ? error.message\n : \"Could not attach the pasted image. Try a different format.\";\n onAttachmentErrorRef.current?.(msg);\n });\n return true;\n }\n\n // Page-sized pastes turn into a `Pasted text` attachment chip so the\n // prompt stays readable while normal paragraphs and lists stay inline.\n // When the paste is HTML (e.g. an Alpine.js extension or a document the\n // user wants hosted), it's stored as a real .html attachment so it\n // travels the same rail as uploading that file — the agent reads it\n // verbatim via contentFromAttachment instead of retyping it inline,\n // which cuts off mid-stream on large files and triggers a spin.\n if (shouldConvertClipboardToAttachment(paste)) {\n event.preventDefault();\n void composerRuntime\n .addAttachment(createPastedAttachmentFile(paste))\n .catch((error) => {\n const msg =\n error instanceof Error\n ? error.message\n : \"Could not attach the pasted text.\";\n onAttachmentErrorRef.current?.(msg);\n });\n return true;\n }\n\n return false;\n },\n handleDrop: (_view, event) => {\n // Drag-and-drop files (decks, images, PDFs, etc.) into the composer.\n // Mark handled drops as consumed so the chat-wide drop target does not\n // add the same file a second time.\n return handleComposerFileDrop({\n event: event as DragEvent,\n addAttachment: (file) => composerRuntime.addAttachment(file),\n onError: (error) => {\n const msg =\n error instanceof Error\n ? error.message\n : \"Could not attach the dropped file. Try a different format.\";\n onAttachmentErrorRef.current?.(msg);\n },\n });\n },\n handleKeyDown: (view, event) => {\n const pop = popoverStateRef.current;\n\n // Handle popover keyboard nav\n if (pop) {\n if (event.key === \"ArrowUp\") {\n event.preventDefault();\n popoverRef.current?.moveUp();\n return true;\n }\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n popoverRef.current?.moveDown();\n return true;\n }\n if (event.key === \"Enter\") {\n event.preventDefault();\n const idx = popoverRef.current?.getSelectedIndex() ?? 0;\n const currentCommands = filteredCommandsRef.current;\n const currentSkills = filteredSkillsRef.current;\n if (pop.type === \"@\") {\n const item = popoverRef.current?.getSelectedMention();\n if (item) selectMention(view, pop, item);\n } else if (pop.type === \"/\") {\n const cmd = popoverRef.current?.getSelectedCommand();\n if (cmd) {\n executeCommand(view, pop, cmd);\n } else {\n const skillIdx = idx - currentCommands.length;\n if (currentSkills[skillIdx]) {\n selectSkill(view, pop, currentSkills[skillIdx]);\n }\n }\n }\n return true;\n }\n if (event.key === \"Escape\") {\n event.preventDefault();\n popoverStateRef.current = null;\n setPopover(null);\n return true;\n }\n if (event.key === \" \" && pop.query === \"\") {\n popoverStateRef.current = null;\n setPopover(null);\n return false;\n }\n }\n\n // Backspace removes composer mode chip when editor is empty\n if (event.key === \"Backspace\" && composerModeRef.current) {\n const { from, to } = view.state.selection;\n if (\n view.state.doc.textContent.trim() === \"\" &&\n from === to &&\n from <= 1\n ) {\n setComposerMode(null);\n composerModeRef.current = null;\n return true;\n }\n }\n\n // Keyboard shortcut toggles Act/Plan mode from inside the editor.\n if (event.key === \"Tab\" && event.shiftKey) {\n event.preventDefault();\n const current = execModeRef.current;\n const cb = onExecModeChangeRef.current;\n if (current && cb) {\n const next = current === \"build\" ? \"plan\" : \"build\";\n if (next !== \"plan\" || !planModeDisabledRef.current) {\n cb(next);\n }\n }\n return true;\n }\n\n // Submit on Enter. Shift+Enter inserts a newline and keeps the\n // composer scrolled to the caret.\n // Cmd+Enter on macOS / Ctrl+Enter elsewhere marks the submit queued.\n if (event.key === \"Enter\" && event.shiftKey) {\n event.preventDefault();\n return insertComposerHardBreakAndScrollIntoView(view);\n }\n\n const submitIntent = getComposerSubmitIntentForEnterKey(event, isMac);\n if (submitIntent) {\n event.preventDefault();\n void submitComposer(submitIntent);\n return true;\n }\n\n // Detect @ trigger — only when preceded by start-of-text, space, or newline\n // (not after alphanumeric chars, which would indicate an email address)\n if (event.key === \"@\") {\n const { from } = view.state.selection;\n const textBefore = view.state.doc.textBetween(\n Math.max(0, from - 1),\n from,\n );\n if (from === 1 || textBefore === \"\" || /\\s/.test(textBefore)) {\n const coords = view.coordsAtPos(from);\n setTimeout(() => {\n const state: PopoverState = {\n type: \"@\",\n position: { top: coords.top, left: coords.left },\n startPos: view.state.selection.from,\n query: \"\",\n };\n popoverStateRef.current = state;\n setPopover(state);\n }, 0);\n }\n return false;\n }\n\n // Detect / trigger (only at start of line or after whitespace)\n if (event.key === \"/\") {\n const { from } = view.state.selection;\n const textBefore = view.state.doc.textBetween(\n Math.max(0, from - 1),\n from,\n );\n if (from === 1 || textBefore === \"\" || /\\s/.test(textBefore)) {\n const coords = view.coordsAtPos(from);\n setTimeout(() => {\n const state: PopoverState = {\n type: \"/\",\n position: { top: coords.top, left: coords.left },\n startPos: view.state.selection.from,\n query: \"\",\n };\n popoverStateRef.current = state;\n setPopover(state);\n }, 0);\n }\n return false;\n }\n\n return false;\n },\n },\n });\n\n const insertReference = useCallback(\n (ref: AgentComposerReference) => {\n const normalized = normalizeAgentComposerReference(ref);\n const ed = editor;\n if (!normalized || !ed) return;\n if (normalized.slotKey) {\n setSlotReferences((current) =>\n applySlotReferenceChanges(current, [normalized]),\n );\n ed.commands.focus(\"end\");\n return;\n }\n if (normalized.relatedReferences?.some((item) => item.slotKey)) {\n setSlotReferences((current) =>\n applySlotReferenceChanges(\n current,\n normalized.relatedReferences ?? [],\n ),\n );\n }\n ed.chain()\n .focus()\n .insertContent({\n type: \"mentionReference\",\n attrs: mentionReferenceAttrs(normalized),\n })\n .insertContent(\" \")\n .run();\n setEditorHasText(true);\n },\n [editor],\n );\n\n const insertReferenceIfEmpty = useCallback(\n (payload: AgentComposerReferenceInsertPayload) => {\n const insertMessageId =\n typeof payload.insertMessageId === \"string\"\n ? payload.insertMessageId\n : \"\";\n if (insertMessageId) {\n if (seenReferenceInsertIdsRef.current.has(insertMessageId)) return;\n seenReferenceInsertIdsRef.current.add(insertMessageId);\n }\n const ed = editor;\n if (!ed || disabled || composerModeRef.current) return;\n const normalized = normalizeAgentComposerReference(payload);\n if (normalized?.slotKey) {\n insertReference(normalized);\n return;\n }\n if (composerAttachments.length > 0) return;\n if (composerDocumentHasContent(ed.state.doc)) return;\n insertReference(payload);\n },\n [composerAttachments.length, disabled, editor, insertReference],\n );\n\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n const handleEvent = (event: Event) => {\n const payload = (event as CustomEvent).detail;\n const normalized = normalizeAgentComposerReference(payload);\n if (!normalized) return;\n insertReferenceIfEmpty({\n ...normalized,\n insertMessageId:\n typeof payload?.insertMessageId === \"string\"\n ? payload.insertMessageId\n : \"\",\n });\n };\n const handleMessage = (event: MessageEvent) => {\n if (!isTrustedFrameMessage(event) && !isTrustedBuilderMessage(event)) {\n return;\n }\n if (event.data?.type !== AGENT_CHAT_INSERT_REFERENCE_MESSAGE_TYPE) {\n return;\n }\n const payload = event.data.data;\n const normalized = normalizeAgentComposerReference(payload);\n if (!normalized) return;\n insertReferenceIfEmpty({\n ...normalized,\n insertMessageId:\n typeof payload?.insertMessageId === \"string\"\n ? payload.insertMessageId\n : \"\",\n });\n };\n window.addEventListener(AGENT_CHAT_INSERT_REFERENCE_EVENT, handleEvent);\n window.addEventListener(\"message\", handleMessage);\n return () => {\n window.removeEventListener(\n AGENT_CHAT_INSERT_REFERENCE_EVENT,\n handleEvent,\n );\n window.removeEventListener(\"message\", handleMessage);\n };\n }, [insertReferenceIfEmpty]);\n\n useImperativeHandle(focusRef, () => ({\n focus() {\n editor?.commands.focus(\"end\");\n },\n setText(text: string) {\n if (!editor) return;\n editor.commands.setContent(plainTextToDoc(text));\n editor.commands.focus(\"end\");\n const trimmed = editor.state.doc.textContent.trim();\n setEditorHasText(trimmed.length > 0);\n setSlotReferences([]);\n composerRuntime.setText(trimmed);\n onTextChangeRef.current?.(trimmed);\n try {\n if (trimmed) {\n localStorage.setItem(draftKey, editor.getHTML());\n } else {\n localStorage.removeItem(draftKey);\n }\n } catch {}\n },\n insertReference,\n }));\n\n const handleSelectMode = useCallback(\n (mode: ComposerMode) => {\n setComposerMode(mode);\n composerModeRef.current = mode;\n setTimeout(() => editor?.commands.focus(\"end\"), 50);\n },\n [editor],\n );\n\n // --- Live voice transcription: text appears in the editor as the user speaks ---\n const voiceAnchorRef = useRef<number | null>(null);\n const prevVoiceInsertRef = useRef(\"\");\n\n const handleLiveUpdate = useCallback(\n (finalText: string, interimText: string) => {\n const ed = editor;\n if (!ed) return;\n\n if (voiceAnchorRef.current == null) {\n const { from } = ed.state.selection;\n const prevChar =\n from > 1 ? ed.state.doc.textBetween(from - 1, from) : \"\";\n if (prevChar && !/\\s/.test(prevChar)) {\n ed.chain().insertContent(\" \").run();\n }\n voiceAnchorRef.current = ed.state.selection.from;\n prevVoiceInsertRef.current = \"\";\n }\n\n const anchor = voiceAnchorRef.current;\n const prevLen = prevVoiceInsertRef.current.length;\n const newText = finalText + interimText;\n\n if (newText === prevVoiceInsertRef.current) return;\n\n ed.chain()\n .deleteRange({ from: anchor, to: anchor + prevLen })\n .insertContentAt(anchor, newText)\n .run();\n\n prevVoiceInsertRef.current = newText;\n },\n [editor],\n );\n\n const insertTranscript = useCallback(\n (text: string) => {\n const ed = editor;\n if (!ed) return;\n\n const anchor = voiceAnchorRef.current;\n if (anchor != null) {\n const prevLen = prevVoiceInsertRef.current.length;\n if (text) {\n ed.chain()\n .focus()\n .deleteRange({ from: anchor, to: anchor + prevLen })\n .insertContentAt(anchor, text + \" \")\n .run();\n } else if (prevLen > 0) {\n ed.chain()\n .deleteRange({ from: anchor, to: anchor + prevLen })\n .run();\n }\n voiceAnchorRef.current = null;\n prevVoiceInsertRef.current = \"\";\n } else if (text) {\n const { from } = ed.state.selection;\n const prevChar =\n from > 1 ? ed.state.doc.textBetween(from - 1, from) : \"\";\n const needsLead = prevChar && !/\\s/.test(prevChar);\n ed.chain()\n .focus()\n .insertContent((needsLead ? \" \" : \"\") + text + \" \")\n .run();\n }\n },\n [editor],\n );\n\n const buildVoiceContextPack = useCallback(():\n | VoiceContextPack\n | undefined => {\n const snippets: Array<{ label: string; value: string }> = [];\n\n const activeContext = trimVoiceContextValue(\n formatAgentChatContextItemsForPrompt(contextItems),\n 3200,\n );\n if (activeContext) {\n snippets.push({ label: \"Active app context\", value: activeContext });\n }\n\n const selectedReferences = trimVoiceContextValue(\n slotReferences.map((ref) => slotReferenceTitle(ref)).join(\", \"),\n 1200,\n );\n if (selectedReferences) {\n snippets.push({\n label: \"Selected references\",\n value: selectedReferences,\n });\n }\n\n const draft = editor\n ? trimVoiceContextValue(editor.state.doc.textContent, 1200)\n : null;\n if (draft) snippets.push({ label: \"Current draft\", value: draft });\n\n if (typeof document !== \"undefined\") {\n const title = trimVoiceContextValue(document.title, 160);\n if (title) snippets.push({ label: \"Page title\", value: title });\n }\n\n if (typeof window !== \"undefined\") {\n const route = trimVoiceContextValue(window.location.pathname, 240);\n if (route) snippets.push({ label: \"Route\", value: route });\n }\n\n if (snippets.length === 0) return undefined;\n return {\n surface: \"agent-composer\",\n mode: \"dictation\",\n snippets,\n };\n }, [contextItems, editor, slotReferences]);\n\n const voice = useVoiceDictation({\n onTranscript: insertTranscript,\n onLiveUpdate: handleLiveUpdate,\n contextPack: buildVoiceContextPack,\n });\n\n // Clean up live text if voice session ends without a final transcript (cancel/error)\n useEffect(() => {\n if (voice.state === \"idle\" && voiceAnchorRef.current != null) {\n const anchor = voiceAnchorRef.current;\n const prevLen = prevVoiceInsertRef.current.length;\n if (editor && prevLen > 0) {\n editor\n .chain()\n .deleteRange({ from: anchor, to: anchor + prevLen })\n .run();\n }\n voiceAnchorRef.current = null;\n prevVoiceInsertRef.current = \"\";\n }\n }, [voice.state, editor]);\n\n // Global shortcut: Cmd/Ctrl + Shift + M toggles dictation. Escape cancels\n // while recording. Scoped to avoid firing when focus is outside the app.\n useEffect(() => {\n if (!voiceEnabled || !voice.supported) return;\n const handler = (e: KeyboardEvent) => {\n // e.key can be undefined on some trusted keydown events (autofill/IME\n // quirks) — seen crashing in production (AGENT-NATIVE-BROWSER-S).\n const isToggleCombo =\n typeof e.key === \"string\" &&\n e.key.toLowerCase() === \"m\" &&\n e.shiftKey &&\n (e.metaKey || e.ctrlKey) &&\n !e.altKey;\n if (isToggleCombo) {\n e.preventDefault();\n if (voice.state === \"recording\" || voice.state === \"starting\") {\n voice.stop();\n } else if (voice.state !== \"transcribing\") {\n void voice.start();\n }\n return;\n }\n if (\n e.key === \"Escape\" &&\n (voice.state === \"recording\" || voice.state === \"starting\")\n ) {\n e.preventDefault();\n voice.cancel();\n }\n };\n window.addEventListener(\"keydown\", handler);\n return () => window.removeEventListener(\"keydown\", handler);\n }, [voiceEnabled, voice]);\n\n const extractComposerPayload = useCallback(() => {\n const ed = editor;\n if (!ed) {\n return {\n text: slotReferences.map((ref) => slotReferenceTitle(ref)).join(\", \"),\n references: slotReferences.map(referenceFromComposerReference),\n };\n }\n\n const references: Reference[] = slotReferences.map(\n referenceFromComposerReference,\n );\n\n // Build text that preserves @mentions (getText() strips them).\n // Walk the document and reconstruct with @name for mention/file/skill nodes.\n const textParts: string[] = [];\n ed.state.doc.descendants((node: any) => {\n if (node.isText) {\n textParts.push(node.text);\n } else if (node.type.name === \"mentionReference\") {\n textParts.push(`@[${node.attrs.label}|${node.attrs.icon || \"file\"}]`);\n } else if (node.type.name === \"fileReference\") {\n const label = node.attrs.path?.split(\"/\").pop() || node.attrs.path;\n textParts.push(`@[${label}|file]`);\n } else if (node.type.name === \"skillReference\") {\n textParts.push(`/${node.attrs.name}`);\n } else if (node.type.name === \"hardBreak\") {\n textParts.push(\"\\n\");\n } else if (\n node.type.name === \"paragraph\" &&\n textParts.length > 0 &&\n textParts[textParts.length - 1] !== \"\\n\"\n ) {\n textParts.push(\"\\n\");\n }\n });\n const rawText = textParts.join(\"\").trim();\n const text =\n rawText ||\n slotReferences.map((ref) => slotReferenceTitle(ref)).join(\", \");\n\n ed.state.doc.descendants((node: any) => {\n if (node.type.name === \"fileReference\") {\n // Legacy support\n references.push({\n type: \"file\",\n path: node.attrs.path,\n name: node.attrs.path?.split(\"/\").pop() || node.attrs.path,\n source: node.attrs.source || \"codebase\",\n });\n } else if (node.type.name === \"mentionReference\") {\n const refType = node.attrs.refType;\n references.push({\n type:\n refType === \"file\"\n ? \"file\"\n : refType === \"agent\"\n ? \"agent\"\n : refType === \"custom-agent\"\n ? \"custom-agent\"\n : \"mention\",\n path: node.attrs.refPath || \"\",\n name: node.attrs.label,\n source: node.attrs.source,\n refType: node.attrs.refType,\n refId: node.attrs.refId,\n slotKey: node.attrs.slotKey,\n slotLabel: node.attrs.slotLabel,\n metadata: node.attrs.metadata,\n });\n } else if (node.type.name === \"skillReference\") {\n references.push({\n type: \"skill\",\n path: node.attrs.path,\n name: node.attrs.name,\n source: node.attrs.source || \"codebase\",\n });\n }\n });\n\n return { text, references };\n }, [editor, slotReferences]);\n\n const syncComposerState = useCallback(() => {\n const { text, references } = extractComposerPayload();\n const requestMode =\n execMode === \"plan\" ? \"plan\" : execMode === \"build\" ? \"act\" : undefined;\n const custom: {\n references?: Reference[];\n requestMode?: \"act\" | \"plan\";\n } = {};\n if (references.length > 0) {\n custom.references = references;\n }\n if (requestMode) {\n custom.requestMode = requestMode;\n }\n composerRuntime.setText(text);\n composerRuntime.setRunConfig(\n Object.keys(custom).length > 0 ? { custom } : {},\n );\n return { text, references };\n }, [composerRuntime, execMode, extractComposerPayload]);\n\n const submitComposer = useCallback(\n async (intent: ComposerSubmitIntent = \"immediate\") => {\n const ed = editor;\n if (!ed) return;\n if (submitInFlightRef.current) return;\n\n const { text, references } = syncComposerState();\n const attachments = composerRuntime.getState().attachments;\n if (!text.trim() && references.length === 0 && attachments.length === 0)\n return;\n const oversizedDocumentError =\n getOversizedDocumentAttachmentError(attachments);\n if (oversizedDocumentError) {\n onAttachmentErrorRef.current?.(oversizedDocumentError);\n return;\n }\n const cancelActiveVoice = () => {\n if (\n voice.state === \"recording\" ||\n voice.state === \"starting\" ||\n voice.state === \"transcribing\"\n ) {\n voice.cancel();\n }\n };\n\n // Intercept slash commands typed directly (e.g. \"/clear\" + Enter)\n const trimmed = text.trim();\n if (trimmed.startsWith(\"/\") && references.length === 0) {\n const cmdName = normalizeSlashCommandName(trimmed);\n const matched = allSlashCommands.find((c) => c.name === cmdName);\n if (matched) {\n ed.commands.clearContent();\n try {\n localStorage.removeItem(draftKey);\n } catch {}\n closePopover();\n onSlashCommandRef.current?.(matched.name);\n return;\n }\n }\n\n // Builder iframe delegation: when this app is mounted inside the\n // Builder.io webview and the user typed a \"build me an app/agent\"\n // prompt, hand it up to the parent Builder chat instead of sending\n // it to this app's domain agent. Builder is the code-writing agent;\n // the local agent (dispatch, mail, etc.) cannot scaffold workspace\n // apps from inside its own iframe.\n if (\n !composerMode &&\n interceptBuildRequestsForBuilder &&\n tryDelegateBuildRequestToBuilder(trimmed)\n ) {\n cancelActiveVoice();\n ed.commands.clearContent();\n setEditorHasText(false);\n setSlotReferences([]);\n try {\n localStorage.removeItem(draftKey);\n } catch {}\n closePopover();\n return;\n }\n\n if (onBeforeSubmit) {\n submitInFlightRef.current = true;\n try {\n const shouldSubmit = await onBeforeSubmit();\n if (!shouldSubmit) return;\n } finally {\n submitInFlightRef.current = false;\n }\n }\n\n // Composer mode: send with context via agent chat bridge\n if (composerMode) {\n const config = COMPOSER_MODE_CONFIGS[composerMode];\n config.beforeSend?.();\n const message = displayableComposerModeMessage({\n messagePrefix: config.messagePrefix,\n trimmedText: trimmed,\n attachmentCount: attachments.length,\n });\n const modePrompt =\n trimmed ||\n (attachments.length > 0 ? \"Use the attached context.\" : \"\");\n if (attachments.length > 0) {\n composerRuntime.setText(\n `${message}\\n\\n<context>\\n${config.getContext(modePrompt)}\\n</context>`,\n );\n composerRuntime.send();\n } else {\n sendToAgentChat({\n message,\n context: config.getContext(modePrompt),\n mode:\n execMode === \"plan\"\n ? \"plan\"\n : execMode === \"build\"\n ? \"act\"\n : undefined,\n submit: true,\n });\n }\n cancelActiveVoice();\n ed.commands.clearContent();\n setEditorHasText(false);\n setSlotReferences([]);\n setComposerMode(null);\n composerModeRef.current = null;\n try {\n localStorage.removeItem(draftKey);\n } catch {}\n closePopover();\n return;\n }\n\n if (onSubmit) {\n onSubmit(text, references, attachments, { intent });\n // Clear any pending attachments now that the host has them.\n void composerRuntime.clearAttachments().catch(() => {});\n if (!clearOnSubmit) {\n closePopover();\n return;\n }\n } else {\n composerRuntime.send();\n }\n cancelActiveVoice();\n ed.commands.clearContent();\n setEditorHasText(false);\n setSlotReferences([]);\n try {\n localStorage.removeItem(draftKey);\n } catch {}\n closePopover();\n },\n [\n closePopover,\n composerMode,\n composerRuntime,\n draftKey,\n editor,\n interceptBuildRequestsForBuilder,\n clearOnSubmit,\n onBeforeSubmit,\n onSubmit,\n syncComposerState,\n voice,\n allSlashCommands,\n ],\n );\n\n // Helper functions that operate on the editor view directly\n // These are called from handleKeyDown which can't use React state\n function selectMention(\n _view: any,\n pop: NonNullable<PopoverState>,\n item: MentionItem,\n ) {\n const ed = editor;\n if (!ed) return;\n const currentPos = ed.state.selection.from;\n // startPos is after the trigger char, so -1 to include the @ or /\n const deleteFrom = Math.max(0, pop.startPos - 1);\n ed.chain().focus().deleteRange({ from: deleteFrom, to: currentPos }).run();\n insertReference(composerReferenceFromMentionItem(item));\n popoverStateRef.current = null;\n setPopover(null);\n }\n\n function executeCommand(\n _view: any,\n pop: NonNullable<PopoverState>,\n command: SlashCommand,\n ) {\n const ed = editor;\n if (!ed) return;\n const currentPos = ed.state.selection.from;\n const deleteFrom = Math.max(0, pop.startPos - 1);\n ed.chain().focus().deleteRange({ from: deleteFrom, to: currentPos }).run();\n popoverStateRef.current = null;\n setPopover(null);\n onSlashCommandRef.current?.(command.name);\n }\n\n function selectSkill(\n _view: any,\n pop: NonNullable<PopoverState>,\n skill: SkillResult,\n ) {\n const ed = editor;\n if (!ed) return;\n const currentPos = ed.state.selection.from;\n const deleteFrom = Math.max(0, pop.startPos - 1);\n ed.chain()\n .focus()\n .deleteRange({ from: deleteFrom, to: currentPos })\n .insertContent({\n type: \"skillReference\",\n attrs: { name: skill.name, path: skill.path, source: skill.source },\n })\n .insertContent(\" \")\n .run();\n popoverStateRef.current = null;\n setPopover(null);\n }\n\n // Popover select handlers for click-based selection (from MentionPopover)\n const handleSelectMention = useCallback(\n (item: MentionItem) => {\n if (!editor || !popover) return;\n const currentPos = editor.state.selection.from;\n const deleteFrom = Math.max(0, popover.startPos - 1);\n editor\n .chain()\n .focus()\n .deleteRange({ from: deleteFrom, to: currentPos })\n .run();\n insertReference(composerReferenceFromMentionItem(item));\n closePopover();\n },\n [editor, popover, closePopover, insertReference],\n );\n\n const handleSelectCommand = useCallback(\n (command: SlashCommand) => {\n if (!editor || !popover) return;\n const currentPos = editor.state.selection.from;\n const deleteFrom = Math.max(0, popover.startPos - 1);\n editor\n .chain()\n .focus()\n .deleteRange({ from: deleteFrom, to: currentPos })\n .run();\n closePopover();\n onSlashCommand?.(command.name);\n },\n [editor, popover, closePopover, onSlashCommand],\n );\n\n const handleSelectSkill = useCallback(\n (skill: SkillResult) => {\n if (!editor || !popover) return;\n const currentPos = editor.state.selection.from;\n const deleteFrom = Math.max(0, popover.startPos - 1);\n editor\n .chain()\n .focus()\n .deleteRange({ from: deleteFrom, to: currentPos })\n .insertContent({\n type: \"skillReference\",\n attrs: { name: skill.name, path: skill.path, source: skill.source },\n })\n .insertContent(\" \")\n .run();\n closePopover();\n },\n [editor, popover, closePopover],\n );\n\n // Track query text as user types after trigger\n useEffect(() => {\n if (!editor || !popover) return;\n\n const updateHandler = () => {\n syncComposerState();\n\n const pop = popoverStateRef.current;\n if (!pop) return;\n const { from } = editor.state.selection;\n const { startPos, type } = pop;\n\n if (from < startPos) {\n closePopover();\n return;\n }\n\n const text = editor.state.doc.textBetween(startPos, from);\n\n // Verify the trigger character is still there\n if (startPos > 0) {\n const triggerChar = editor.state.doc.textBetween(\n startPos - 1,\n startPos,\n );\n if (\n (type === \"@\" && triggerChar !== \"@\") ||\n (type === \"/\" && triggerChar !== \"/\")\n ) {\n closePopover();\n return;\n }\n }\n\n const updated = { ...pop, query: text };\n popoverStateRef.current = updated;\n setPopover(updated);\n };\n\n editor.on(\"update\", updateHandler);\n editor.on(\"selectionUpdate\", updateHandler);\n return () => {\n editor.off(\"update\", updateHandler);\n editor.off(\"selectionUpdate\", updateHandler);\n };\n }, [editor, popover, closePopover, syncComposerState]);\n\n useEffect(() => {\n if (!editor) return;\n if (composerText !== \"\") return;\n if (editor.isEmpty) return;\n editor.commands.clearContent();\n }, [composerText, editor]);\n\n useEffect(() => {\n if (!editor || initialText === undefined) return;\n const key = initialTextKey ?? initialText;\n if (initialTextKeyRef.current === key) return;\n initialTextKeyRef.current = key;\n editor.commands.setContent(plainTextToDoc(initialText));\n editor.commands.focus(\"end\");\n const trimmed = editor.state.doc.textContent.trim();\n setEditorHasText(trimmed.length > 0);\n composerRuntime.setText(trimmed);\n onTextChangeRef.current?.(trimmed);\n try {\n if (trimmed) {\n localStorage.setItem(draftKey, editor.getHTML());\n } else {\n localStorage.removeItem(draftKey);\n }\n } catch {}\n }, [composerRuntime, draftKey, editor, initialText, initialTextKey]);\n\n // Tiptap only reads `editable` at init; prop changes need setEditable.\n useEffect(() => {\n if (!editor) return;\n editor.setEditable(!disabled);\n if (disabled) editor.commands.blur();\n }, [editor, disabled]);\n\n return (\n <>\n <style>{`\n .aui-composer .ProseMirror p.is-editor-empty:first-child::before {\n content: attr(data-placeholder);\n color: var(--color-muted-foreground);\n opacity: 0.5;\n float: left;\n height: 0;\n pointer-events: none;\n }\n `}</style>\n {composerMode && (\n <div\n data-agent-composer-variant={layoutVariant}\n data-agent-composer-slot=\"mode-row\"\n className=\"agent-composer-mode-row px-2.5 pt-2 pb-0\"\n >\n <ComposerModeChip\n mode={composerMode}\n onRemove={() => {\n setComposerMode(null);\n composerModeRef.current = null;\n editor?.commands.focus(\"end\");\n }}\n />\n </div>\n )}\n {hasContextRows && (\n <div\n data-agent-composer-variant={layoutVariant}\n data-agent-composer-slot=\"context-row\"\n className=\"agent-composer-context-row flex flex-wrap gap-1.5 px-2.5 pt-2 pb-0\"\n >\n {slotReferences.map((ref) => (\n <span\n key={ref.slotKey}\n className=\"inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-background px-2 py-1 text-[11px] font-medium text-foreground shadow-sm\"\n >\n <IconClipboardList className=\"h-3 w-3 shrink-0 text-muted-foreground\" />\n {ref.slotLabel && (\n <span className=\"shrink-0 text-muted-foreground\">\n {ref.slotLabel}\n </span>\n )}\n <span className=\"min-w-0 truncate\">{ref.label}</span>\n <button\n type=\"button\"\n onClick={() => {\n setSlotReferences((current) =>\n removeSlotReference(current, ref),\n );\n editor?.commands.focus(\"end\");\n }}\n aria-label={`Remove ${slotReferenceTitle(ref)} reference`}\n className=\"ms-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground\"\n >\n <IconX className=\"h-3 w-3\" />\n </button>\n </span>\n ))}\n {contextItems.map((item) => (\n <span\n key={item.key}\n className=\"inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted/50 px-2 py-1 text-[11px] font-medium text-foreground\"\n >\n <IconClipboardList className=\"h-3 w-3 shrink-0 text-muted-foreground\" />\n <span className=\"min-w-0 truncate\">{item.title}</span>\n <button\n type=\"button\"\n onClick={() => onRemoveContextItem?.(item.key)}\n aria-label={`Remove ${item.title} context`}\n className=\"ms-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground\"\n >\n <IconX className=\"h-3 w-3\" />\n </button>\n </span>\n ))}\n </div>\n )}\n <div\n data-agent-composer-variant={layoutVariant}\n data-agent-composer-slot=\"editor-wrap\"\n className={`agent-composer-editor-wrap ${\n composerMode || hasContextRows ? \"px-2 pt-1 pb-1\" : \"px-2 pt-2 pb-1\"\n }`}\n >\n <EditorContent\n editor={editor}\n data-agent-composer-variant={layoutVariant}\n data-agent-composer-slot=\"editor\"\n className=\"agent-composer-editor aui-composer flex-1 min-w-0 [&_.ProseMirror]:outline-none [&_.ProseMirror_p]:m-0 px-0.5\"\n />\n </div>\n {voiceEnabled && <VoiceRecordingOverlay voice={voice} />}\n <div\n data-agent-composer-variant={layoutVariant}\n data-agent-composer-slot=\"toolbar\"\n className=\"agent-composer-toolbar flex items-center gap-1 px-2 py-1.5\"\n >\n {attachButton ??\n (plusMenuMode === \"hidden\" ? null : (\n <ComposerPlusMenu\n onSelectMode={handleSelectMode}\n mode={plusMenuMode}\n onAttachmentError={onAttachmentError}\n />\n ))}\n {toolbarSlot ?? modeControl}\n <div data-agent-composer-slot=\"toolbar-spacer\" className=\"flex-1\" />\n {selectedModel && availableModels && onModelChange && (\n <ModelSelector\n model={selectedModel}\n effort={selectedEffort}\n engines={availableModels}\n onChange={onModelChange}\n onEffortChange={onEffortChange}\n providerConnectStatusEnabled={providerConnectStatusEnabled}\n onConnectProvider={onConnectProvider}\n imageModel={imageModelMenu}\n />\n )}\n {execMode && onExecModeChange && (\n <ModeSelector\n mode={execMode}\n onChange={onExecModeChange}\n planModeDisabled={planModeDisabled}\n planModeDisabledReason={planModeDisabledReason}\n />\n )}\n {actionButton ?? (\n <>\n {extraActionButton}\n {voiceEnabled && (\n <VoiceButton voice={voice} isMac={isMac} disabled={disabled} />\n )}\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n onClick={() => void submitComposer(\"immediate\")}\n disabled={!canSend}\n data-agent-composer-slot=\"send-button\"\n className=\"agent-composer-send-button shrink-0 flex h-7 w-7 items-center justify-center rounded-md bg-primary text-primary-foreground hover:opacity-90 disabled:opacity-30 disabled:cursor-not-allowed\"\n >\n <IconArrowUp className=\"h-3.5 w-3.5\" />\n </button>\n </TooltipTrigger>\n <TooltipContent>Send message</TooltipContent>\n </Tooltip>\n </>\n )}\n </div>\n <MentionPopover\n ref={popoverRef}\n type={popover?.type ?? \"@\"}\n position={popover?.position ?? null}\n mentionItems={filteredMentionItems}\n skills={filteredSkills}\n commands={filteredCommands}\n hint={hint}\n isLoading={popover?.type === \"@\" ? mentionsLoading : skillsLoading}\n query={popover?.query ?? \"\"}\n onSelectMention={handleSelectMention}\n onSelectSkill={handleSelectSkill}\n onSelectCommand={handleSelectCommand}\n onClose={closePopover}\n />\n </>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TiptapComposer.js","sourceRoot":"","sources":["../../../src/client/composer/TiptapComposer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EACL,WAAW,EACX,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,iBAAiB,EACjB,UAAU,EACV,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,WAAW,MAAM,+BAA+B,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAc,EACZ,QAAQ,EACR,MAAM,EACN,SAAS,EACT,WAAW,EACX,mBAAmB,EACnB,OAAO,GACR,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,iCAAiC,EACjC,oBAAoB,GAErB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAEL,oCAAoC,EACpC,+BAA+B,EAC/B,eAAe,EAGf,iCAAiC,EACjC,wCAAwC,GACzC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,uB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E,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAChE,EACD,MAAC,OAAO,eACN,KAAC,cAAc,IAAC,OAAO,kBACrB,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,cAAc,CAAC,WAAW,CAAC,EAC/C,QAAQ,EAAE,CAAC,OAAO,8BACO,aAAa,EACtC,SAAS,EAAC,6LAA6L,YAEvM,KAAC,WAAW,IAAC,SAAS,EAAC,aAAa,GAAG,GAChC,GACM,EACjB,KAAC,cAAc,+BAA8B,IACrC,IACT,CACJ,IACG,EACN,KAAC,cAAc,IACb,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,GAAG,EAC1B,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,IAAI,EACnC,YAAY,EAAE,oBAAoB,EAClC,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,gBAAgB,EAC1B,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,OAAO,EAAE,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,EAClE,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,EAAE,EAC3B,eAAe,EAAE,mBAAmB,EACpC,aAAa,EAAE,iBAAiB,EAChC,eAAe,EAAE,mBAAmB,EACpC,OAAO,EAAE,YAAY,GACrB,IACD,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import { useComposer, useComposerRuntime } from \"@assistant-ui/react\";\nimport {\n IconArrowUp,\n IconCheck,\n IconChevronDown,\n IconChevronRight,\n IconBulb,\n IconClock,\n IconBolt,\n IconTool,\n IconX,\n IconClipboardList,\n IconPencil,\n IconPlugConnected,\n} from \"@tabler/icons-react\";\nimport Placeholder from \"@tiptap/extension-placeholder\";\nimport type { EditorView } from \"@tiptap/pm/view\";\nimport { useEditor, EditorContent } from \"@tiptap/react\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport React, {\n useState,\n useRef,\n useEffect,\n useCallback,\n useImperativeHandle,\n useMemo,\n} from \"react\";\n\nimport {\n getReasoningEffortOptionsForModel,\n reasoningEffortLabel,\n type ReasoningEffort,\n} from \"../../shared/reasoning-effort.js\";\nimport type { VoiceContextPack } from \"../../voice/index.js\";\nimport {\n AgentComposerReference,\n formatAgentChatContextItemsForPrompt,\n normalizeAgentComposerReference,\n sendToAgentChat,\n type AgentChatContextItem,\n AgentComposerReferenceInsertPayload,\n AGENT_CHAT_INSERT_REFERENCE_EVENT,\n AGENT_CHAT_INSERT_REFERENCE_MESSAGE_TYPE,\n} from \"../agent-chat.js\";\nimport { tryDelegateBuildRequestToBuilder } from \"../builder-frame.js\";\nimport { isTrustedBuilderMessage } from \"../builder-frame.js\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"../components/ui/popover.js\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"../components/ui/tooltip.js\";\nimport { isTrustedFrameMessage } from \"../frame.js\";\nimport { useBuilderConnectFlow } from \"../settings/useBuilderStatus.js\";\nimport { ComposerPlusMenu } from \"./ComposerPlusMenu.js\";\nimport { getComposerDraftKey } from \"./draft-key.js\";\nimport { FileReference } from \"./extensions/FileReference.js\";\nimport { MentionReference } from \"./extensions/MentionReference.js\";\nimport { SkillReference } from \"./extensions/SkillReference.js\";\nimport { MentionPopover, type MentionPopoverRef } from \"./MentionPopover.js\";\nimport {\n createPastedAttachmentFile,\n readClipboardPaste,\n shouldConvertClipboardToAttachment,\n} from \"./pasted-text.js\";\nimport type {\n MentionItem,\n SkillResult,\n Reference,\n SlashCommand,\n ComposerMode,\n AgentComposerLayoutVariant,\n} from \"./types.js\";\nimport { useMentionSearch } from \"./use-mention-search.js\";\nimport { useSkills } from \"./use-skills.js\";\nimport { useVoiceDictation } from \"./useVoiceDictation.js\";\nimport { VoiceButton, VoiceRecordingOverlay } from \"./VoiceButton.js\";\nexport interface TiptapComposerHandle {\n focus(): void;\n setText(text: string): void;\n insertReference(ref: AgentComposerReference): void;\n}\n\nexport type ComposerSubmitIntent = \"immediate\" | \"queued\";\n\nexport const DEFAULT_VOICE_DICTATION_ENABLED = false;\n\nexport interface TiptapComposerSubmitOptions {\n intent?: ComposerSubmitIntent;\n}\n\nexport function canSubmitComposerContent(options: {\n hasEditorContent: boolean;\n attachmentCount: number;\n disabled?: boolean;\n}): boolean {\n return (\n !options.disabled &&\n (options.hasEditorContent || options.attachmentCount > 0)\n );\n}\n\nconst MAX_DOCUMENT_ATTACHMENT_BYTES = 4 * 1024 * 1024;\n\nfunction composerReferenceFromMentionItem(\n item: MentionItem,\n): AgentComposerReference {\n return {\n label: item.label,\n icon: item.icon || \"file\",\n source: item.source,\n refType: item.refType,\n refId: item.refId || null,\n refPath: item.refPath || null,\n slotKey: item.slotKey,\n slotLabel: item.slotLabel,\n metadata: item.metadata,\n clearsSlots: item.clearsSlots,\n relatedReferences: item.relatedReferences,\n };\n}\n\nfunction mentionReferenceAttrs(ref: AgentComposerReference) {\n return {\n label: ref.label,\n icon: ref.icon || \"file\",\n source: ref.source,\n refType: ref.refType,\n refId: ref.refId || null,\n refPath: ref.refPath || null,\n slotKey: ref.slotKey || null,\n slotLabel: ref.slotLabel || null,\n metadata: ref.metadata || null,\n };\n}\n\nfunction referenceFromComposerReference(\n ref: AgentComposerReference,\n): Reference {\n return {\n type:\n ref.refType === \"file\"\n ? \"file\"\n : ref.refType === \"agent\"\n ? \"agent\"\n : ref.refType === \"custom-agent\"\n ? \"custom-agent\"\n : \"mention\",\n path: ref.refPath || \"\",\n name: ref.label,\n source: ref.source || \"\",\n refType: ref.refType,\n refId: ref.refId || undefined,\n slotKey: ref.slotKey,\n slotLabel: ref.slotLabel,\n metadata: ref.metadata,\n };\n}\n\nfunction applySlotReferenceChanges(\n current: AgentComposerReference[],\n references: AgentComposerReference[],\n): AgentComposerReference[] {\n let next = current;\n\n const applyOne = (ref: AgentComposerReference) => {\n for (const related of ref.relatedReferences ?? []) {\n applyOne(related);\n }\n if (!ref.slotKey) return;\n const cleared = new Set([ref.slotKey, ...(ref.clearsSlots ?? [])]);\n next = next.filter((existing) => !cleared.has(existing.slotKey ?? \"\"));\n next = [...next, ref];\n };\n\n for (const ref of references) {\n applyOne(ref);\n }\n\n return next;\n}\n\nfunction removeSlotReference(\n current: AgentComposerReference[],\n ref: AgentComposerReference,\n): AgentComposerReference[] {\n const removed = new Set([ref.slotKey, ...(ref.clearsSlots ?? [])]);\n return current.filter((existing) => !removed.has(existing.slotKey ?? \"\"));\n}\n\nfunction slotReferenceTitle(ref: AgentComposerReference): string {\n return ref.slotLabel ? `${ref.slotLabel}: ${ref.label}` : ref.label;\n}\n\nfunction metadataString(\n metadata: Record<string, unknown> | undefined,\n key: string,\n): string | null {\n const value = metadata?.[key];\n return typeof value === \"string\" && value.trim() ? value.trim() : null;\n}\n\nfunction trimVoiceContextValue(value: string, maxChars: number): string | null {\n const trimmed = value.replace(/\\0/g, \"\").trim();\n if (!trimmed) return null;\n if (trimmed.length <= maxChars) return trimmed;\n return `${trimmed.slice(0, maxChars).trimEnd()}\\n[truncated]`;\n}\n\nfunction filterMentionItemsForSlots(\n items: MentionItem[],\n slotReferences: AgentComposerReference[],\n): MentionItem[] {\n return items.filter((item) => {\n const requiredSlotKey = metadataString(item.metadata, \"requiredSlotKey\");\n const requiredRefId = metadataString(item.metadata, \"requiredRefId\");\n if (!requiredSlotKey || !requiredRefId) return true;\n const selected = slotReferences.find(\n (ref) => ref.slotKey === requiredSlotKey,\n );\n if (!selected?.refId) return true;\n return selected.refId === requiredRefId;\n });\n}\n\nfunction isDocumentAttachment(value: Record<string, unknown>): boolean {\n if (value.type === \"document\") return true;\n const contentType = String(value.contentType ?? \"\").toLowerCase();\n const name = String(value.name ?? \"\").toLowerCase();\n return contentType === \"application/pdf\" || name.endsWith(\".pdf\");\n}\n\nexport function getOversizedDocumentAttachmentError(\n attachments: ReadonlyArray<unknown>,\n): string | null {\n for (const attachment of attachments) {\n if (!attachment || typeof attachment !== \"object\") continue;\n const candidate = attachment as Record<string, unknown>;\n if (!isDocumentAttachment(candidate)) continue;\n const file = candidate.file;\n if (!(file instanceof File)) continue;\n if (file.size <= MAX_DOCUMENT_ATTACHMENT_BYTES) continue;\n const name =\n typeof candidate.name === \"string\" && candidate.name.trim()\n ? candidate.name\n : file.name;\n const mb = (file.size / 1024 / 1024).toFixed(1);\n const maxMb = (MAX_DOCUMENT_ATTACHMENT_BYTES / 1024 / 1024).toFixed(0);\n return `\"${name}\" is ${mb} MB — PDFs are capped at ${maxMb} MB to stay within message limits. Please reduce the file size or split it into smaller parts.`;\n }\n return null;\n}\n\nexport function getComposerSubmitIntentForEnterKey(\n event: Pick<KeyboardEvent, \"key\" | \"shiftKey\" | \"metaKey\" | \"ctrlKey\">,\n isMac: boolean,\n): ComposerSubmitIntent | null {\n if (event.key !== \"Enter\" || event.shiftKey) return null;\n\n const queuedModifierPressed = isMac ? event.metaKey : event.ctrlKey;\n if (queuedModifierPressed) return \"queued\";\n\n if (!event.metaKey && !event.ctrlKey) return \"immediate\";\n\n return null;\n}\n\nexport function insertComposerHardBreakAndScrollIntoView(\n view: Pick<EditorView, \"state\" | \"dispatch\">,\n): boolean {\n const hardBreak = view.state.schema.nodes.hardBreak;\n if (!hardBreak) return false;\n\n view.dispatch(\n view.state.tr.replaceSelectionWith(hardBreak.create()).scrollIntoView(),\n );\n return true;\n}\n\nexport function getComposerPopoverPosition(\n view: Pick<EditorView, \"coordsAtPos\">,\n pos: number,\n): { top: number; left: number } | null {\n try {\n const coords = view.coordsAtPos(pos);\n if (!Number.isFinite(coords.top) || !Number.isFinite(coords.left)) {\n return null;\n }\n return { top: coords.top, left: coords.left };\n } catch {\n return null;\n }\n}\n\nexport function displayableComposerModeMessage(options: {\n messagePrefix: string;\n trimmedText: string;\n attachmentCount: number;\n}): string {\n const modePrompt =\n options.trimmedText ||\n (options.attachmentCount > 0 ? \"Use the attached context.\" : \"\");\n return `${options.messagePrefix}${modePrompt}`;\n}\n\nfunction uniquifyComposerImageFile(file: File): File {\n if (!file.type.startsWith(\"image/\")) return file;\n const uniqueName = `${Date.now()}-${Math.random().toString(36).slice(2)}-${file.name}`;\n return new File([file], uniqueName, { type: file.type });\n}\n\nfunction composerDocumentHasContent(doc: {\n textContent: string;\n descendants: (callback: (node: any) => boolean | void) => void;\n}): boolean {\n if (doc.textContent.trim().length > 0) return true;\n let hasContent = false;\n doc.descendants((node: any) => {\n if (\n node.type.name === \"mentionReference\" ||\n node.type.name === \"fileReference\" ||\n node.type.name === \"skillReference\"\n ) {\n hasContent = true;\n return false;\n }\n return true;\n });\n return hasContent;\n}\n\nexport function handleComposerFileDrop(options: {\n event: Pick<DragEvent, \"dataTransfer\" | \"preventDefault\" | \"stopPropagation\">;\n addAttachment: (file: File) => Promise<unknown>;\n onError?: (error: unknown) => void;\n}): boolean {\n const droppedFiles = Array.from(options.event.dataTransfer?.files ?? []);\n if (droppedFiles.length === 0) return false;\n\n options.event.preventDefault();\n options.event.stopPropagation();\n const attachments = droppedFiles.map(uniquifyComposerImageFile);\n void Promise.all(\n attachments.map((file) => options.addAttachment(file)),\n ).catch((error) => {\n options.onError?.(error);\n });\n return true;\n}\n\nconst BUILT_IN_COMMANDS: SlashCommand[] = [\n { name: \"clear\", description: \"Start a new chat\", icon: \"clear\" },\n { name: \"new\", description: \"Start a new chat\", icon: \"new\" },\n { name: \"history\", description: \"Browse all chats\", icon: \"history\" },\n { name: \"plan\", description: \"Switch to read-only planning\", icon: \"plan\" },\n { name: \"act\", description: \"Switch back to acting\", icon: \"act\" },\n { name: \"help\", description: \"Show available commands\", icon: \"help\" },\n];\n\nfunction normalizeSlashCommandName(name: string): string {\n return name.replace(/^\\/+/, \"\").trim().toLowerCase();\n}\n\nfunction mergeSlashCommands(commands: SlashCommand[]): SlashCommand[] {\n const seen = new Set<string>();\n const merged: SlashCommand[] = [];\n for (const command of commands) {\n const name = normalizeSlashCommandName(command.name);\n if (!name || seen.has(name)) continue;\n seen.add(name);\n merged.push({ ...command, name });\n }\n return merged;\n}\n\nfunction mergeSlashSkills(skills: SkillResult[]): SkillResult[] {\n const seen = new Set<string>();\n const merged: SkillResult[] = [];\n for (const skill of skills) {\n const key = `${skill.source ?? \"\"}:${skill.path ?? \"\"}:${skill.name}`;\n if (!skill.name || seen.has(key)) continue;\n seen.add(key);\n merged.push(skill);\n }\n return merged;\n}\n\nconst COMPOSER_MODE_CONFIGS: Record<\n ComposerMode,\n {\n label: string;\n icon: React.ComponentType<{ className?: string }>;\n placeholder: string;\n messagePrefix: string;\n getContext: (prompt: string) => string;\n beforeSend?: () => void;\n }\n> = {\n skill: {\n label: \"Create Skill\",\n icon: IconBulb,\n placeholder: \"Describe the skill you want to create...\",\n messagePrefix: \"Create a skill: \",\n getContext: (prompt) =>\n `The user wants to create an agent skill. Their description: \"${prompt}\"\n\nFollow the create-skill pattern to build this. Before writing:\n\n1. **Determine the skill name** — derive a hyphen-case name from the description (e.g. \"code review\" → \"code-review\")\n2. **Determine the skill type** — Pattern (architectural rule), Workflow (step-by-step), or Generator (scaffolding)\n3. **Write the skill** as a personal resource at path \"skills/<name>/SKILL.md\" using the \\`resources\\` tool with \\`action: \"write\"\\`\n\nThe skill file MUST have YAML frontmatter with name and description (under 40 words), then markdown with:\n- Clear rule/purpose statement\n- Why this skill exists\n- How to follow it (with code examples where helpful)\n- Common violations to avoid\n- Related skills\n\nAfter creating, update the shared AGENTS.md resource to reference the new skill in its skills table.\n\nKeep the skill concise (under 500 lines) and actionable.`,\n },\n job: {\n label: \"Schedule Task\",\n icon: IconClock,\n placeholder: \"Describe what should happen and when...\",\n messagePrefix: \"Create a recurring job: \",\n getContext: (prompt) =>\n `The user wants to create a recurring job. Their description: \"${prompt}\"\n\nUse the manage-jobs tool with action \"create\" to create this. You need to:\n1. Derive a hyphen-case name from the description\n2. Convert the schedule to a cron expression (e.g., \"every weekday at 9am\" → \"0 9 * * 1-5\")\n3. Write clear, self-contained instructions for what the agent should do each time the job runs\n4. Create it in personal scope\n\nThe job will run automatically on the schedule. Make the instructions specific — include which actions to call and what to do with results.`,\n },\n automation: {\n label: \"Create Automation\",\n icon: IconBolt,\n placeholder: \"Describe what you want to automate...\",\n messagePrefix: \"Create an automation: \",\n beforeSend: () => {\n window.dispatchEvent(\n new CustomEvent(\"agent-panel:set-mode\", {\n detail: { mode: \"chat\" },\n }),\n );\n },\n getContext: (prompt) =>\n `The user wants to create a new automation. Scope: personal. Their description: \"${prompt}\"\n\nUse manage-automations with action=define to create it. Ask clarifying questions if needed about what event to trigger on, conditions, and what actions to take.`,\n },\n extension: {\n label: \"Create Extension\",\n icon: IconTool,\n placeholder: \"Describe the interactive extension you want to build...\",\n messagePrefix: \"Create an extension: \",\n getContext: (prompt) =>\n `The user wants to create an interactive extension (sandboxed mini-app). Their description: \"${prompt}\"\n\nUse the create-extension action with Alpine.js HTML content. The extension runs as a sandboxed iframe with Tailwind CSS and modest default canvas padding. For edge-to-edge layouts, put data-extension-layout=\"full-bleed\" on the outermost element.\n\nAfter creating the extension, navigate the user to it with the path returned by create-extension; extension URLs may include a friendly \"/extensions/<id>/<slug>\" suffix.\n\nMake the extension functional and visually polished. Extensions can use extensionFetch() for external API calls, appAction()/appFetch() for app operations and app data writes, extensionData for per-extension persistence, and dbQuery() only for read-only inspection of existing app tables.\n\nPrefer appAction()/appFetch() for app data. Some actions return JSON strings for CLI compatibility, so parse string results before counting rows or reading arrays. Do not guess raw SQL table names or columns for app data; use dbQuery() only when the table is known to exist in the current schema.`,\n },\n};\n\nfunction ComposerModeChip({\n mode,\n onRemove,\n}: {\n mode: ComposerMode;\n onRemove: () => void;\n}) {\n const config = COMPOSER_MODE_CONFIGS[mode];\n const Icon = config.icon;\n return (\n <span className=\"inline-flex items-center gap-1 rounded-md border border-border bg-muted/50 px-1.5 py-0.5 text-xs font-medium text-foreground\">\n <Icon className=\"h-3 w-3 text-muted-foreground\" />\n {config.label}\n <button\n type=\"button\"\n onClick={onRemove}\n className=\"ms-0.5 rounded-sm text-muted-foreground hover:text-foreground cursor-pointer\"\n >\n <IconX className=\"h-3 w-3\" />\n </button>\n </span>\n );\n}\n\ntype ExecMode = \"build\" | \"plan\";\n\nexport interface TiptapComposerProps {\n placeholder?: string;\n disabled?: boolean;\n focusRef?: React.Ref<TiptapComposerHandle>;\n /** Programmatically seed the editor with plain text. */\n initialText?: string;\n /** Stable key used to re-apply the seeded text. */\n initialTextKey?: string | number;\n /**\n * When provided, called instead of composerRuntime.send(). Used for queue\n * mode and standalone prompt popovers. Receives the live composer\n * attachments so callers (e.g. PromptComposer) can surface uploaded files.\n */\n onSubmit?: (\n text: string,\n references: Reference[],\n attachments?: ReadonlyArray<unknown>,\n options?: TiptapComposerSubmitOptions,\n ) => void;\n /** Return false to stop a submit before it enters the chat runtime. */\n onBeforeSubmit?: () => boolean | Promise<boolean>;\n /**\n * Clear the editor after an onSubmit handler runs. Standalone workflows that\n * may fail outside the composer can keep the draft visible for quick edits.\n */\n clearOnSubmit?: boolean;\n /** Called whenever the plain editor text changes. */\n onTextChange?: (text: string) => void;\n /** Custom action button (e.g. stop button) to render instead of the default send button. */\n actionButton?: React.ReactNode;\n /** Extra button to render alongside the default send button (e.g. stop while running). */\n extraActionButton?: React.ReactNode;\n /** Custom attachment button to render instead of ComposerPrimitive.AddAttachment. */\n attachButton?: React.ReactNode;\n /** Custom host-owned control rendered next to the attachment affordance. */\n modeControl?: React.ReactNode;\n /** Explicit host-owned toolbar slot rendered next to the attachment affordance. */\n toolbarSlot?: React.ReactNode;\n /** Shared sizing/layout variant for host surfaces. Default keeps sidebar behavior. */\n layoutVariant?: AgentComposerLayoutVariant;\n /** Additional slash commands surfaced in the shared / menu. */\n slashCommands?: SlashCommand[];\n /** Additional slash skills surfaced in the shared / menu. */\n slashSkills?: SkillResult[];\n /** Include built-in sidebar slash commands like /clear and /help. Default true. */\n includeDefaultSlashCommands?: boolean;\n /** Include app-discovered skills from the default agent endpoint. Default true. */\n includeDefaultSlashSkills?: boolean;\n /** Called when a slash command (e.g. /clear, /help) is executed */\n onSlashCommand?: (command: string) => void;\n /** Current execution mode (build/plan) */\n execMode?: ExecMode;\n /** Callback to change execution mode */\n onExecModeChange?: (mode: ExecMode) => void;\n /** Disable Plan mode while leaving Act mode available. */\n planModeDisabled?: boolean;\n /** Explanation shown next to the disabled Plan option. */\n planModeDisabledReason?: string;\n /** Show the microphone button for voice dictation. Defaults to DEFAULT_VOICE_DICTATION_ENABLED. */\n voiceEnabled?: boolean;\n /** Selected model override for this conversation */\n selectedModel?: string;\n /** Selected reasoning effort override for this conversation */\n selectedEffort?: ReasoningEffort;\n /** Available models grouped by provider */\n availableModels?: Array<{\n engine: string;\n label: string;\n models: string[];\n configured: boolean;\n }>;\n /** Callback when user picks a model */\n onModelChange?: (model: string, engine: string) => void;\n /** Callback when user picks a reasoning effort */\n onEffortChange?: (effort: ReasoningEffort) => void;\n /**\n * Disable Builder/provider status polling for hosts that supply provider\n * state through another channel, such as Electron IPC.\n */\n providerConnectStatusEnabled?: boolean;\n /**\n * Override the Builder.io connect action in the model picker. When provided,\n * clicking \"Connect Builder.io\" calls this instead of opening a browser popup.\n * Used by the Electron desktop app to route through the native IPC handler.\n */\n onConnectProvider?: () => void;\n /**\n * Optional secondary model menu (e.g. an image-generation model) rendered as\n * an extra section inside the model picker. Opt-in; omit for chat-only apps.\n */\n imageModelMenu?: ComposerImageModelMenu;\n /** Stable scope for persisted drafts, usually the active thread or tab id. */\n draftScope?: string;\n /** Keyed context nuggets staged for the next submitted prompt. */\n contextItems?: AgentChatContextItem[];\n /** Remove a staged context nugget by key. */\n onRemoveContextItem?: (key: string) => void;\n /**\n * Controls the \"+\" menu next to the composer. `\"full\"` (default) shows the\n * normal Upload / Skill / Job / Automation / Tool / MCP picker. `\"upload-only\"`\n * collapses it to a single button that opens the file picker directly.\n * `\"hidden\"` hides attachment controls for text-only prompt surfaces.\n */\n plusMenuMode?: \"full\" | \"upload-only\" | \"hidden\";\n /**\n * When true and the composer is running inside the Builder.io webview/iframe,\n * intercept \"build me an app/agent\" prompts and forward them to the parent\n * Builder chat via `builder.submitChat` instead of sending to the local\n * agent. Off by default — the chat sidebar opts in; standalone prompt\n * forms (NewWorkspaceAppFlow, etc.) handle delegation themselves with\n * extra context (vault keys, computed app ids) that the raw composer\n * text lacks.\n */\n interceptBuildRequestsForBuilder?: boolean;\n /**\n * Called when a drag-drop or paste attachment fails (e.g. unsupported format,\n * size cap). Use this to surface a visible error in the parent chat surface\n * rather than silently swallowing the problem.\n */\n onAttachmentError?: (message: string) => void;\n}\n\nfunction plainTextToDoc(text: string) {\n const lines = text.length > 0 ? text.split(/\\r?\\n/) : [\"\"];\n return {\n type: \"doc\",\n content: lines.map((line) => ({\n type: \"paragraph\",\n content: line ? [{ type: \"text\", text: line }] : [],\n })),\n };\n}\n\nexport function createTiptapComposerExtensions(\n getPlaceholder: () => string | undefined,\n) {\n return [\n StarterKit.configure({\n heading: false,\n horizontalRule: false,\n bulletList: false,\n orderedList: false,\n listItem: false,\n listKeymap: false,\n blockquote: false,\n codeBlock: false,\n strike: false,\n italic: false,\n bold: false,\n code: false,\n dropcursor: false,\n gapcursor: false,\n link: false,\n trailingNode: false,\n underline: false,\n }),\n Placeholder.configure({\n placeholder: () => getPlaceholder() ?? \"\",\n emptyEditorClass: \"is-editor-empty\",\n showOnlyCurrent: false,\n }),\n FileReference,\n SkillReference,\n MentionReference,\n ];\n}\n\nfunction ModeSelector({\n mode,\n onChange,\n planModeDisabled = false,\n planModeDisabledReason = \"Open Agent Native Desktop to use Plan mode.\",\n}: {\n mode: ExecMode;\n onChange: (mode: ExecMode) => void;\n planModeDisabled?: boolean;\n planModeDisabledReason?: string;\n}) {\n const [open, setOpen] = useState(false);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n aria-label={mode === \"build\" ? \"Act mode\" : \"Plan mode\"}\n data-agent-composer-slot=\"mode-button\"\n className=\"agent-composer-mode-button shrink-0 flex items-center gap-1 rounded-md px-2 py-1 text-[12px] font-medium text-muted-foreground hover:bg-accent/50 hover:text-foreground\"\n >\n {mode === \"build\" ? \"Act\" : \"Plan\"}\n <IconChevronDown className=\"h-3 w-3 opacity-60\" />\n </button>\n </PopoverTrigger>\n <PopoverContent\n side=\"top\"\n align=\"end\"\n sideOffset={6}\n collisionPadding={8}\n data-agent-native-composer-popover=\"true\"\n className=\"z-[260] w-60 rounded-lg border-border p-0 py-1 shadow-lg\"\n style={{ fontSize: 13 }}\n >\n <button\n type=\"button\"\n onClick={() => {\n onChange(\"build\");\n setOpen(false);\n }}\n className=\"flex w-full items-center gap-3 px-3 py-2 hover:bg-accent/50 text-start\"\n >\n <IconPencil className=\"h-4 w-4 shrink-0 text-muted-foreground\" />\n <div className=\"flex-1 min-w-0\">\n <span className=\"font-medium text-foreground text-[13px]\">Act</span>\n <p className=\"text-[11px] text-muted-foreground mt-0.5\">\n Use tools and make approved changes\n </p>\n </div>\n {mode === \"build\" && (\n <IconCheck className=\"h-3.5 w-3.5 shrink-0 text-blue-500\" />\n )}\n </button>\n <button\n type=\"button\"\n disabled={planModeDisabled}\n title={planModeDisabled ? planModeDisabledReason : undefined}\n onClick={() => {\n if (planModeDisabled) return;\n onChange(\"plan\");\n setOpen(false);\n }}\n className={`flex w-full items-center gap-3 px-3 py-2 text-start ${\n planModeDisabled\n ? \"cursor-not-allowed opacity-60\"\n : \"hover:bg-accent/50\"\n }`}\n >\n <IconClipboardList className=\"h-4 w-4 shrink-0 text-muted-foreground\" />\n <div className=\"flex-1 min-w-0\">\n <span className=\"font-medium text-foreground text-[13px]\">\n Plan\n </span>\n <p className=\"text-[11px] text-muted-foreground mt-0.5\">\n {planModeDisabled\n ? planModeDisabledReason\n : \"Read-only research and approval first\"}\n </p>\n </div>\n {mode === \"plan\" && !planModeDisabled && (\n <IconCheck className=\"h-3.5 w-3.5 shrink-0 text-blue-500\" />\n )}\n </button>\n </PopoverContent>\n </Popover>\n );\n}\n\nconst FRIENDLY_MODEL_NAMES: Record<string, string> = {\n auto: \"Default model\",\n \"claude-fable-5\": \"Fable 5\",\n \"grok-code-fast\": \"Grok Code Fast\",\n \"qwen3-coder\": \"Qwen3 Coder\",\n \"kimi-k2-5\": \"Kimi K2.5\",\n \"deepseek-v3-1\": \"DeepSeek v3.1\",\n \"z-ai/glm-5.2\": \"GLM 5.2\",\n};\n\nexport const MODEL_SELECTOR_POPOVER_STYLE = {\n fontSize: 13,\n maxHeight: \"min(500px, var(--radix-popover-content-available-height, 500px))\",\n} satisfies React.CSSProperties;\n\nfunction friendlyModelName(model: string): string {\n if (FRIENDLY_MODEL_NAMES[model]) return FRIENDLY_MODEL_NAMES[model];\n // Claude: claude-{tier}-{major}[-minor][-dateYYYYMMDD] → Tier Major[.Minor]\n const claude = model.match(\n /^claude-(opus|sonnet|haiku)-(\\d+)(?:-(\\d+))?(?:-\\d{8,})?$/,\n );\n if (claude) {\n const tier = claude[1][0].toUpperCase() + claude[1].slice(1);\n return `${tier} ${claude[2]}${claude[3] ? `.${claude[3]}` : \"\"}`;\n }\n // GPT: gpt-{major}-{minor}[-suffix] or gpt-{major}.{minor}[-suffix]\n if (model.startsWith(\"gpt-\")) {\n const rest = model.slice(4);\n const gpt = rest.match(/^(\\d+)[.-](\\d+)(?:[.-](.+))?$/);\n if (gpt) {\n const suffix = gpt[3]\n ? \" \" +\n gpt[3]\n .split(\"-\")\n .map((s) => s[0].toUpperCase() + s.slice(1))\n .join(\" \")\n : \"\";\n return `GPT-${gpt[1]}.${gpt[2]}${suffix}`;\n }\n return `GPT-${rest}`;\n }\n if (/^o\\d/.test(model)) return model;\n // Gemini: gemini-{major}-{minor}-{variant}[-preview] → Gemini Major.Minor Variant\n const geminiVersioned = model.match(\n /^gemini-(\\d+)-(\\d+)-(.+?)(?:-preview)?$/,\n );\n if (geminiVersioned) {\n const variant = geminiVersioned[3]\n .split(\"-\")\n .map((s) => s[0].toUpperCase() + s.slice(1))\n .join(\" \");\n return `Gemini ${geminiVersioned[1]}.${geminiVersioned[2]} ${variant}`;\n }\n // Gemini: gemini-{version.parts}[-preview] → Gemini Version Parts\n const gemini = model.match(/^gemini-(.+?)(?:-preview)?$/);\n if (gemini) {\n const parts = gemini[1]\n .split(\"-\")\n .map((s) => s[0].toUpperCase() + s.slice(1))\n .join(\" \");\n return `Gemini ${parts}`;\n }\n return model;\n}\n\n/**\n * Deduplicate models to only the latest version per family.\n * e.g. [opus-4-7, opus-4-6, opus-4-5] → [opus-4-7]\n */\nfunction latestModelsOnly(models: string[]): string[] {\n const seen = new Set<string>();\n return models.filter((m) => {\n // Claude: family = tier (opus/sonnet/haiku)\n const claude = m.match(/^claude-(opus|sonnet|haiku)-/);\n if (claude) {\n if (seen.has(claude[1])) return false;\n seen.add(claude[1]);\n return true;\n }\n // GPT: family = gpt-{major} (e.g. gpt-5.4 and gpt-5.4-mini are different)\n // OpenAI reasoning: each is its own family\n // Gemini: family = gemini-{major} + variant\n const gemini = m.match(/^gemini-(\\d+(?:\\.\\d+)?)-(.+?)(?:-preview)?$/);\n if (gemini) {\n const family = gemini[2]; // flash, pro, etc.\n if (seen.has(`gemini-${family}`)) return false;\n seen.add(`gemini-${family}`);\n return true;\n }\n return true;\n });\n}\n\n/**\n * Optional secondary model menu for apps that drive a separate generation model\n * alongside the chat LLM (e.g. the Assets app's image-generation model). When\n * provided, the model picker renders an extra collapsible section so the user\n * can see and pick both \"what reasons about my request\" (the chat model) and\n * \"what produces the output\" (this model). Opt-in — omit it and nothing changes.\n */\nexport interface ComposerImageModelMenu {\n /** Currently-selected model id for this secondary menu. */\n value: string;\n /** Selectable options (stable id + human label). */\n options: Array<{ value: string; label: string }>;\n /** Invoked when the user picks a different option. */\n onChange: (value: string) => void;\n /** Section header. Defaults to \"Image model\". */\n label?: string;\n}\n\nfunction ModelSelector({\n model,\n effort = \"auto\",\n engines,\n onChange,\n onEffortChange,\n providerConnectStatusEnabled = true,\n onConnectProvider,\n imageModel,\n}: {\n model: string;\n effort?: ReasoningEffort;\n engines: Array<{\n engine: string;\n label: string;\n models: string[];\n configured: boolean;\n }>;\n onChange: (model: string, engine: string) => void;\n onEffortChange?: (effort: ReasoningEffort) => void;\n providerConnectStatusEnabled?: boolean;\n onConnectProvider?: () => void;\n imageModel?: ComposerImageModelMenu;\n}) {\n const [open, setOpen] = useState(false);\n const autoModelGroup = engines.find((group) => group.models.includes(\"auto\"));\n const providerGroups = useMemo(\n () =>\n engines\n .map((group) => ({\n ...group,\n models: group.models.filter((candidate) => candidate !== \"auto\"),\n }))\n .filter((group) => group.models.length > 0),\n [engines],\n );\n const effortOptions =\n model === \"auto\"\n ? ([\n \"auto\",\n \"low\",\n \"medium\",\n \"high\",\n \"xhigh\",\n \"max\",\n ] satisfies ReasoningEffort[])\n : getReasoningEffortOptionsForModel(model);\n\n // Collapse non-selected families by default. The family containing the\n // currently-selected model stays expanded so the user sees their pick at\n // a glance; clicking another family's header expands it inline.\n const selectedGroupKey = useMemo(() => {\n const found = providerGroups.find((g) => g.models.includes(model));\n return found ? `${found.engine}:${found.label}` : null;\n }, [model, providerGroups]);\n\n const [expandedGroups, setExpandedGroups] = useState<Set<string>>(\n () => new Set(selectedGroupKey ? [selectedGroupKey] : []),\n );\n\n // Reset expansion when the popover re-opens so the picker always lands\n // on the \"selected family expanded, others collapsed\" view.\n useEffect(() => {\n if (open) {\n setExpandedGroups(new Set(selectedGroupKey ? [selectedGroupKey] : []));\n }\n }, [open, selectedGroupKey]);\n\n const toggleGroup = useCallback((key: string) => {\n setExpandedGroups((prev) => {\n const next = new Set(prev);\n if (next.has(key)) next.delete(key);\n else next.add(key);\n return next;\n });\n }, []);\n\n // The reasoning effort list is collapsed by default — it's a secondary\n // control most users don't touch, so it stays tucked behind a header that\n // reveals the current effort at a glance. Reset to collapsed on each open.\n const [reasoningExpanded, setReasoningExpanded] = useState(false);\n useEffect(() => {\n if (open) setReasoningExpanded(false);\n }, [open]);\n\n // The optional image-model section follows the same collapsed-by-default\n // pattern; the current selection shows next to the header.\n const [imageExpanded, setImageExpanded] = useState(false);\n useEffect(() => {\n if (open) setImageExpanded(false);\n }, [open]);\n const imageModelLabel =\n imageModel?.options.find((option) => option.value === imageModel.value)\n ?.label ?? imageModel?.value;\n\n // When Builder.io isn't connected, surface a one-click connect path —\n // it unlocks every model family (Claude, OpenAI, Gemini) without the\n // user having to paste individual API keys.\n const builderFlow = useBuilderConnectFlow({\n enabled: providerConnectStatusEnabled,\n trackingSource: \"composer_builder_cta\",\n });\n const hasConfiguredBuilderModels = providerGroups.some(\n (group) => group.engine === \"builder\" && group.configured,\n );\n const showBuilderCta =\n (builderFlow.hasFetchedStatus ||\n (!providerConnectStatusEnabled && !!onConnectProvider)) &&\n !builderFlow.configured &&\n !builderFlow.envManaged &&\n !hasConfiguredBuilderModels;\n const openLlmSettings = useCallback(() => {\n try {\n window.location.hash = \"llm\";\n } catch {}\n window.dispatchEvent(new CustomEvent(\"agent-panel:open-settings\"));\n setOpen(false);\n }, []);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n data-agent-composer-slot=\"model-button\"\n className=\"agent-composer-model-button flex min-w-0 max-w-[10.5rem] shrink items-center gap-1 rounded-md px-2 py-1 text-[12px] font-medium text-muted-foreground hover:bg-accent/50 hover:text-foreground\"\n >\n <span className=\"min-w-0 truncate\">{friendlyModelName(model)}</span>\n {effortOptions.length > 0 && (\n <span className=\"agent-composer-model-effort min-w-0 shrink truncate text-muted-foreground/70\">\n · {reasoningEffortLabel(effort)}\n </span>\n )}\n <IconChevronDown className=\"h-3 w-3 shrink-0 opacity-60\" />\n </button>\n </PopoverTrigger>\n <PopoverContent\n side=\"top\"\n align=\"end\"\n sideOffset={6}\n collisionPadding={8}\n data-agent-native-composer-popover=\"true\"\n className=\"z-[260] box-border w-72 overflow-y-auto rounded-lg border-border p-0 py-1 shadow-lg\"\n style={MODEL_SELECTOR_POPOVER_STYLE}\n >\n {showBuilderCta && (\n <>\n <button\n type=\"button\"\n onClick={() => {\n if (onConnectProvider) {\n onConnectProvider();\n } else {\n builderFlow.start();\n }\n }}\n disabled={!onConnectProvider && builderFlow.connecting}\n className=\"flex w-full items-start gap-2 px-3 py-2 text-start hover:bg-accent/50 disabled:opacity-60\"\n >\n <IconPlugConnected className=\"h-4 w-4 shrink-0 mt-0.5 text-blue-500\" />\n <span className=\"flex-1 min-w-0\">\n <span className=\"block text-[12px] font-medium text-foreground\">\n {!onConnectProvider && builderFlow.connecting\n ? \"Connecting Builder.io…\"\n : \"Connect Builder.io\"}\n </span>\n <span className=\"block text-[11px] text-muted-foreground\">\n Free credits for Claude, OpenAI & Gemini\n </span>\n </span>\n </button>\n <div className=\"my-1 border-t border-border\" />\n </>\n )}\n {imageModel && imageModel.options.length > 0 && (\n <>\n <div className=\"flex items-center hover:bg-accent/30\">\n <button\n type=\"button\"\n aria-expanded={imageExpanded}\n onClick={() => setImageExpanded((prev) => !prev)}\n className=\"flex flex-1 min-w-0 items-center gap-1.5 px-2 py-1.5 cursor-pointer text-start\"\n >\n {imageExpanded ? (\n <IconChevronDown className=\"h-3 w-3 shrink-0 text-muted-foreground\" />\n ) : (\n <IconChevronRight className=\"h-3 w-3 shrink-0 text-muted-foreground rtl:-scale-x-100\" />\n )}\n <span className=\"text-[11px] font-medium text-muted-foreground uppercase tracking-wide shrink-0\">\n {imageModel.label ?? \"Image model\"}\n </span>\n {!imageExpanded && imageModelLabel && (\n <span className=\"text-[11px] text-muted-foreground/80 truncate\">\n {imageModelLabel}\n </span>\n )}\n </button>\n </div>\n {imageExpanded &&\n imageModel.options.map((option) => (\n <button\n key={option.value}\n type=\"button\"\n onClick={() => {\n imageModel.onChange(option.value);\n setImageExpanded(false);\n }}\n className=\"flex w-full items-center gap-3 ps-7 pe-3 py-1.5 text-start hover:bg-accent/50\"\n >\n <span className=\"flex-1 min-w-0 text-[13px] text-foreground truncate\">\n {option.label}\n </span>\n {option.value === imageModel.value && (\n <IconCheck className=\"h-3.5 w-3.5 shrink-0 text-blue-500\" />\n )}\n </button>\n ))}\n <div className=\"my-1 border-t border-border\" />\n </>\n )}\n {autoModelGroup && (\n <button\n type=\"button\"\n onClick={() => {\n onChange(\"auto\", autoModelGroup.engine);\n setOpen(false);\n }}\n className=\"flex w-full items-center gap-3 px-3 py-1.5 text-start hover:bg-accent/50\"\n >\n <span className=\"flex-1 min-w-0 text-[13px] text-foreground truncate\">\n Auto\n </span>\n {model === \"auto\" && (\n <IconCheck className=\"h-3.5 w-3.5 shrink-0 text-blue-500\" />\n )}\n </button>\n )}\n {autoModelGroup && providerGroups.length > 0 && (\n <div className=\"my-1 border-t border-border\" />\n )}\n {providerGroups.map((group) => {\n const models = latestModelsOnly(group.models);\n const groupKey = `${group.engine}:${group.label}`;\n const isExpanded = expandedGroups.has(groupKey);\n const ChevronIcon = isExpanded ? IconChevronDown : IconChevronRight;\n return (\n <div key={groupKey}>\n <div className=\"flex items-center hover:bg-accent/30\">\n <button\n type=\"button\"\n aria-expanded={isExpanded}\n onClick={() => toggleGroup(groupKey)}\n className=\"flex flex-1 min-w-0 items-center gap-1.5 px-2 py-1.5 cursor-pointer text-start\"\n >\n <ChevronIcon className=\"h-3 w-3 shrink-0 text-muted-foreground rtl:-scale-x-100\" />\n <span className=\"text-[11px] font-medium text-muted-foreground uppercase tracking-wide shrink-0\">\n {group.label}\n </span>\n {!isExpanded && groupKey === selectedGroupKey && (\n <span className=\"text-[11px] text-muted-foreground/80 truncate\">\n {friendlyModelName(model)}\n </span>\n )}\n </button>\n {!group.configured && (\n <button\n type=\"button\"\n className=\"text-[10px] text-muted-foreground/60 hover:text-foreground cursor-pointer pe-3 py-1.5\"\n onClick={openLlmSettings}\n >\n needs API key\n </button>\n )}\n </div>\n {isExpanded &&\n models.map((m) => (\n <button\n key={m}\n type=\"button\"\n onClick={() => {\n if (!group.configured) {\n openLlmSettings();\n return;\n }\n onChange(m, group.engine);\n const nextOptions = getReasoningEffortOptionsForModel(m);\n if (\n effort !== \"auto\" &&\n nextOptions.length > 0 &&\n !nextOptions.includes(effort)\n ) {\n onEffortChange?.(\"auto\");\n }\n setOpen(false);\n }}\n className={`flex w-full items-center gap-3 ps-7 pe-3 py-1.5 text-start ${\n group.configured\n ? \"hover:bg-accent/50\"\n : \"opacity-40 cursor-default\"\n }`}\n >\n <span className=\"flex-1 min-w-0 text-[13px] text-foreground truncate\">\n {friendlyModelName(m)}\n </span>\n {m === model && group.configured && (\n <IconCheck className=\"h-3.5 w-3.5 shrink-0 text-blue-500\" />\n )}\n </button>\n ))}\n </div>\n );\n })}\n {effortOptions.length > 0 && (\n <>\n <div className=\"my-1 border-t border-border\" />\n <div className=\"flex items-center hover:bg-accent/30\">\n <button\n type=\"button\"\n aria-expanded={reasoningExpanded}\n onClick={() => setReasoningExpanded((prev) => !prev)}\n className=\"flex flex-1 min-w-0 items-center gap-1.5 px-2 py-1.5 cursor-pointer text-start\"\n >\n {reasoningExpanded ? (\n <IconChevronDown className=\"h-3 w-3 shrink-0 text-muted-foreground\" />\n ) : (\n <IconChevronRight className=\"h-3 w-3 shrink-0 text-muted-foreground rtl:-scale-x-100\" />\n )}\n <span className=\"text-[11px] font-medium text-muted-foreground uppercase tracking-wide shrink-0\">\n Reasoning\n </span>\n {!reasoningExpanded && (\n <span className=\"text-[11px] text-muted-foreground/80 truncate\">\n {reasoningEffortLabel(effort)}\n </span>\n )}\n </button>\n </div>\n {reasoningExpanded &&\n effortOptions.map((option) => (\n <button\n key={option}\n type=\"button\"\n onClick={() => onEffortChange?.(option)}\n className=\"flex w-full items-center gap-3 ps-7 pe-3 py-1.5 text-start hover:bg-accent/50\"\n >\n <span className=\"flex-1 min-w-0 text-[13px] text-foreground truncate\">\n {reasoningEffortLabel(option)}\n </span>\n {option === effort && (\n <IconCheck className=\"h-3.5 w-3.5 shrink-0 text-blue-500\" />\n )}\n </button>\n ))}\n </>\n )}\n </PopoverContent>\n </Popover>\n );\n}\n\ntype PopoverState = {\n type: \"@\" | \"/\";\n position: { top: number; left: number };\n startPos: number;\n query: string;\n} | null;\n\nexport function TiptapComposer({\n placeholder = \"Message agent...\",\n disabled = false,\n focusRef,\n initialText,\n initialTextKey,\n onSubmit,\n onBeforeSubmit,\n clearOnSubmit = true,\n onTextChange,\n actionButton,\n extraActionButton,\n attachButton,\n modeControl,\n toolbarSlot,\n layoutVariant = \"default\",\n slashCommands = [],\n slashSkills = [],\n includeDefaultSlashCommands = true,\n includeDefaultSlashSkills = true,\n onSlashCommand,\n execMode,\n onExecModeChange,\n planModeDisabled = false,\n planModeDisabledReason,\n voiceEnabled = DEFAULT_VOICE_DICTATION_ENABLED,\n selectedModel,\n selectedEffort,\n availableModels,\n onModelChange,\n onEffortChange,\n providerConnectStatusEnabled,\n onConnectProvider,\n imageModelMenu,\n draftScope,\n contextItems = [],\n onRemoveContextItem,\n plusMenuMode = \"full\",\n interceptBuildRequestsForBuilder = false,\n onAttachmentError,\n}: TiptapComposerProps) {\n const [popover, setPopover] = useState<PopoverState>(null);\n const popoverRef = useRef<MentionPopoverRef>(null);\n const composerRuntime = useComposerRuntime();\n const lastComposerRuntimeSyncRef = useRef<{\n text: string;\n runConfigSignature: string;\n } | null>(null);\n const submitInFlightRef = useRef(false);\n const [editorHasText, setEditorHasText] = useState(false);\n const [slotReferences, setSlotReferences] = useState<\n AgentComposerReference[]\n >([]);\n const composerText = useComposer((state) => state.text);\n const composerAttachments = useComposer((state) => state.attachments);\n const canSend = canSubmitComposerContent({\n hasEditorContent: editorHasText || slotReferences.length > 0,\n attachmentCount: composerAttachments.length,\n disabled,\n });\n const hasContextRows = contextItems.length > 0 || slotReferences.length > 0;\n const [composerMode, setComposerMode] = useState<ComposerMode | null>(null);\n const composerModeRef = useRef<ComposerMode | null>(null);\n const isMac =\n typeof navigator !== \"undefined\" &&\n /Mac|iPhone|iPad/.test(navigator.userAgent);\n\n // Refs for values accessed in handleKeyDown (ProseMirror doesn't re-bind)\n const popoverStateRef = useRef<PopoverState>(null);\n const onAttachmentErrorRef = useRef(onAttachmentError);\n onAttachmentErrorRef.current = onAttachmentError;\n const execModeRef = useRef(execMode);\n execModeRef.current = execMode;\n const onExecModeChangeRef = useRef(onExecModeChange);\n onExecModeChangeRef.current = onExecModeChange;\n const planModeDisabledRef = useRef(planModeDisabled);\n planModeDisabledRef.current = planModeDisabled;\n\n const { items: mentionItems, isLoading: mentionsLoading } = useMentionSearch(\n popover?.type === \"@\" ? popover.query : \"\",\n popover?.type === \"@\",\n );\n const filteredMentionItems = useMemo(\n () => filterMentionItemsForSlots(mentionItems, slotReferences),\n [mentionItems, slotReferences],\n );\n\n const {\n skills,\n hint,\n isLoading: skillsLoading,\n } = useSkills(includeDefaultSlashSkills && popover?.type === \"/\");\n\n const allSlashCommands = useMemo(\n () =>\n mergeSlashCommands([\n ...(includeDefaultSlashCommands ? BUILT_IN_COMMANDS : []),\n ...slashCommands,\n ]),\n [includeDefaultSlashCommands, slashCommands],\n );\n\n const allSlashSkills = useMemo(\n () =>\n mergeSlashSkills([\n ...(includeDefaultSlashSkills ? skills : []),\n ...slashSkills,\n ]),\n [includeDefaultSlashSkills, skills, slashSkills],\n );\n\n const filteredCommands = useMemo(() => {\n if (!popover || popover.type !== \"/\") return allSlashCommands;\n const q = popover.query.toLowerCase();\n if (!q) return allSlashCommands;\n return allSlashCommands.filter(\n (c) =>\n c.name.toLowerCase().includes(q) ||\n c.description.toLowerCase().includes(q),\n );\n }, [allSlashCommands, popover]);\n\n const filteredSkills = useMemo(() => {\n if (!popover || popover.type !== \"/\") return allSlashSkills;\n const q = popover.query.toLowerCase();\n if (!q) return allSlashSkills;\n return allSlashSkills.filter(\n (s) =>\n s.name.toLowerCase().includes(q) ||\n s.description?.toLowerCase().includes(q),\n );\n }, [allSlashSkills, popover]);\n\n // Keep refs in sync with state\n const mentionItemsRef = useRef(filteredMentionItems);\n mentionItemsRef.current = filteredMentionItems;\n const filteredCommandsRef = useRef(filteredCommands);\n filteredCommandsRef.current = filteredCommands;\n const filteredSkillsRef = useRef(filteredSkills);\n filteredSkillsRef.current = filteredSkills;\n const onSlashCommandRef = useRef(onSlashCommand);\n onSlashCommandRef.current = onSlashCommand;\n const onTextChangeRef = useRef(onTextChange);\n onTextChangeRef.current = onTextChange;\n const initialTextKeyRef = useRef<string | number | undefined>(undefined);\n const seenReferenceInsertIdsRef = useRef<Set<string>>(new Set());\n\n const closePopover = useCallback(() => {\n setPopover(null);\n popoverStateRef.current = null;\n }, []);\n\n // Persist draft to localStorage so hot-reloads don't lose the prompt\n const draftKey = getComposerDraftKey(draftScope);\n const draftTimerRef = useRef<ReturnType<typeof setTimeout>>(undefined);\n useEffect(() => {\n return () => {\n clearTimeout(draftTimerRef.current);\n };\n }, []);\n useEffect(() => {\n lastComposerRuntimeSyncRef.current = null;\n }, [composerRuntime]);\n // Tiptap reads extension config once at init; ref keeps runtime prop\n // changes visible to Placeholder's function form.\n const placeholderRef = useRef(placeholder);\n useEffect(() => {\n placeholderRef.current = composerMode\n ? COMPOSER_MODE_CONFIGS[composerMode].placeholder\n : placeholder;\n }, [placeholder, composerMode]);\n\n const editor = useEditor({\n extensions: createTiptapComposerExtensions(() => placeholderRef.current),\n editable: !disabled,\n onCreate: ({ editor: ed }) => {\n // Restore draft on mount\n try {\n if (initialText !== undefined) {\n ed.commands.setContent(plainTextToDoc(initialText));\n ed.commands.focus(\"end\");\n setEditorHasText(composerDocumentHasContent(ed.state.doc));\n initialTextKeyRef.current = initialTextKey ?? initialText;\n } else {\n const saved = localStorage.getItem(draftKey);\n if (saved) {\n ed.commands.setContent(saved);\n ed.commands.focus(\"end\");\n setEditorHasText(composerDocumentHasContent(ed.state.doc));\n }\n }\n onTextChangeRef.current?.(ed.state.doc.textContent.trim());\n } catch {}\n },\n onUpdate: ({ editor: ed }) => {\n // Drive the send button's enabled state from the actual editor contents;\n // the composer runtime is only synced on submit, so its isEmpty lags.\n setEditorHasText(composerDocumentHasContent(ed.state.doc));\n onTextChangeRef.current?.(ed.state.doc.textContent.trim());\n\n // Debounce-save draft to localStorage\n clearTimeout(draftTimerRef.current);\n draftTimerRef.current = setTimeout(() => {\n try {\n const html = ed.getHTML();\n const isEmpty = !composerDocumentHasContent(ed.state.doc);\n if (isEmpty) {\n localStorage.removeItem(draftKey);\n } else {\n localStorage.setItem(draftKey, html);\n }\n } catch {}\n }, 300);\n },\n editorProps: {\n attributes: {\n \"data-agent-composer-variant\": layoutVariant,\n \"data-agent-composer-slot\": \"editor-input\",\n class:\n \"agent-composer-prosemirror flex-1 resize-none bg-transparent text-sm text-foreground outline-none leading-[1.625rem] min-h-[3.25rem] max-h-[10rem] overflow-y-auto\",\n },\n handlePaste: (_view, event) => {\n const paste = readClipboardPaste(event.clipboardData);\n const pastedText = paste.text;\n const files = Array.from(event.clipboardData?.files ?? []).filter(\n (file) => file.type.startsWith(\"image/\"),\n );\n if (files.length > 0) {\n event.preventDefault();\n const attachments: File[] = files.map((file) => {\n // SimpleImageAttachmentAdapter uses file.name as the attachment id.\n // Clipboard images (e.g. screenshots) are typically all named\n // \"image.png\", so a second paste would replace the first instead of\n // appending. Prepend a unique token so each paste gets a distinct id.\n const uniqueName = `${Date.now()}-${Math.random().toString(36).slice(2)}-${file.name}`;\n return new File([file], uniqueName, { type: file.type });\n });\n\n // Google Docs rich clipboard payloads can contain both embedded\n // image files and the document text. Since handling files means we\n // prevent Tiptap's default paste, preserve any text as its own chip\n // instead of silently dropping the source material.\n if (pastedText.trim()) {\n attachments.push(createPastedAttachmentFile(paste));\n }\n\n void Promise.all(\n attachments.map((file) => composerRuntime.addAttachment(file)),\n ).catch((error) => {\n const msg =\n error instanceof Error\n ? error.message\n : \"Could not attach the pasted image. Try a different format.\";\n onAttachmentErrorRef.current?.(msg);\n });\n return true;\n }\n\n // Page-sized pastes turn into a `Pasted text` attachment chip so the\n // prompt stays readable while normal paragraphs and lists stay inline.\n // When the paste is HTML (e.g. an Alpine.js extension or a document the\n // user wants hosted), it's stored as a real .html attachment so it\n // travels the same rail as uploading that file — the agent reads it\n // verbatim via contentFromAttachment instead of retyping it inline,\n // which cuts off mid-stream on large files and triggers a spin.\n if (shouldConvertClipboardToAttachment(paste)) {\n event.preventDefault();\n void composerRuntime\n .addAttachment(createPastedAttachmentFile(paste))\n .catch((error) => {\n const msg =\n error instanceof Error\n ? error.message\n : \"Could not attach the pasted text.\";\n onAttachmentErrorRef.current?.(msg);\n });\n return true;\n }\n\n return false;\n },\n handleDrop: (_view, event) => {\n // Drag-and-drop files (decks, images, PDFs, etc.) into the composer.\n // Mark handled drops as consumed so the chat-wide drop target does not\n // add the same file a second time.\n return handleComposerFileDrop({\n event: event as DragEvent,\n addAttachment: (file) => composerRuntime.addAttachment(file),\n onError: (error) => {\n const msg =\n error instanceof Error\n ? error.message\n : \"Could not attach the dropped file. Try a different format.\";\n onAttachmentErrorRef.current?.(msg);\n },\n });\n },\n handleKeyDown: (view, event) => {\n const pop = popoverStateRef.current;\n\n // Handle popover keyboard nav\n if (pop) {\n if (event.key === \"ArrowUp\") {\n event.preventDefault();\n popoverRef.current?.moveUp();\n return true;\n }\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n popoverRef.current?.moveDown();\n return true;\n }\n if (event.key === \"Enter\") {\n event.preventDefault();\n const idx = popoverRef.current?.getSelectedIndex() ?? 0;\n const currentCommands = filteredCommandsRef.current;\n const currentSkills = filteredSkillsRef.current;\n if (pop.type === \"@\") {\n const item = popoverRef.current?.getSelectedMention();\n if (item) selectMention(view, pop, item);\n } else if (pop.type === \"/\") {\n const cmd = popoverRef.current?.getSelectedCommand();\n if (cmd) {\n executeCommand(view, pop, cmd);\n } else {\n const skillIdx = idx - currentCommands.length;\n if (currentSkills[skillIdx]) {\n selectSkill(view, pop, currentSkills[skillIdx]);\n }\n }\n }\n return true;\n }\n if (event.key === \"Escape\") {\n event.preventDefault();\n popoverStateRef.current = null;\n setPopover(null);\n return true;\n }\n if (event.key === \" \" && pop.query === \"\") {\n popoverStateRef.current = null;\n setPopover(null);\n return false;\n }\n }\n\n // Backspace removes composer mode chip when editor is empty\n if (event.key === \"Backspace\" && composerModeRef.current) {\n const { from, to } = view.state.selection;\n if (\n view.state.doc.textContent.trim() === \"\" &&\n from === to &&\n from <= 1\n ) {\n setComposerMode(null);\n composerModeRef.current = null;\n return true;\n }\n }\n\n // Keyboard shortcut toggles Act/Plan mode from inside the editor.\n if (event.key === \"Tab\" && event.shiftKey) {\n event.preventDefault();\n const current = execModeRef.current;\n const cb = onExecModeChangeRef.current;\n if (current && cb) {\n const next = current === \"build\" ? \"plan\" : \"build\";\n if (next !== \"plan\" || !planModeDisabledRef.current) {\n cb(next);\n }\n }\n return true;\n }\n\n // Submit on Enter. Shift+Enter inserts a newline and keeps the\n // composer scrolled to the caret.\n // Cmd+Enter on macOS / Ctrl+Enter elsewhere marks the submit queued.\n if (event.key === \"Enter\" && event.shiftKey) {\n event.preventDefault();\n return insertComposerHardBreakAndScrollIntoView(view);\n }\n\n const submitIntent = getComposerSubmitIntentForEnterKey(event, isMac);\n if (submitIntent) {\n event.preventDefault();\n void submitComposer(submitIntent);\n return true;\n }\n\n // Detect @ trigger — only when preceded by start-of-text, space, or newline\n // (not after alphanumeric chars, which would indicate an email address)\n if (event.key === \"@\") {\n const { from } = view.state.selection;\n const textBefore = view.state.doc.textBetween(\n Math.max(0, from - 1),\n from,\n );\n if (from === 1 || textBefore === \"\" || /\\s/.test(textBefore)) {\n const position = getComposerPopoverPosition(view, from);\n if (!position) return false;\n setTimeout(() => {\n const state: PopoverState = {\n type: \"@\",\n position,\n startPos: view.state.selection.from,\n query: \"\",\n };\n popoverStateRef.current = state;\n setPopover(state);\n }, 0);\n }\n return false;\n }\n\n // Detect / trigger (only at start of line or after whitespace)\n if (event.key === \"/\") {\n const { from } = view.state.selection;\n const textBefore = view.state.doc.textBetween(\n Math.max(0, from - 1),\n from,\n );\n if (from === 1 || textBefore === \"\" || /\\s/.test(textBefore)) {\n const position = getComposerPopoverPosition(view, from);\n if (!position) return false;\n setTimeout(() => {\n const state: PopoverState = {\n type: \"/\",\n position,\n startPos: view.state.selection.from,\n query: \"\",\n };\n popoverStateRef.current = state;\n setPopover(state);\n }, 0);\n }\n return false;\n }\n\n return false;\n },\n },\n });\n\n const insertReference = useCallback(\n (ref: AgentComposerReference) => {\n const normalized = normalizeAgentComposerReference(ref);\n const ed = editor;\n if (!normalized || !ed) return;\n if (normalized.slotKey) {\n setSlotReferences((current) =>\n applySlotReferenceChanges(current, [normalized]),\n );\n ed.commands.focus(\"end\");\n return;\n }\n if (normalized.relatedReferences?.some((item) => item.slotKey)) {\n setSlotReferences((current) =>\n applySlotReferenceChanges(\n current,\n normalized.relatedReferences ?? [],\n ),\n );\n }\n ed.chain()\n .focus()\n .insertContent({\n type: \"mentionReference\",\n attrs: mentionReferenceAttrs(normalized),\n })\n .insertContent(\" \")\n .run();\n setEditorHasText(true);\n },\n [editor],\n );\n\n const insertReferenceIfEmpty = useCallback(\n (payload: AgentComposerReferenceInsertPayload) => {\n const insertMessageId =\n typeof payload.insertMessageId === \"string\"\n ? payload.insertMessageId\n : \"\";\n if (insertMessageId) {\n if (seenReferenceInsertIdsRef.current.has(insertMessageId)) return;\n seenReferenceInsertIdsRef.current.add(insertMessageId);\n }\n const ed = editor;\n if (!ed || disabled || composerModeRef.current) return;\n const normalized = normalizeAgentComposerReference(payload);\n if (normalized?.slotKey) {\n insertReference(normalized);\n return;\n }\n if (composerAttachments.length > 0) return;\n if (composerDocumentHasContent(ed.state.doc)) return;\n insertReference(payload);\n },\n [composerAttachments.length, disabled, editor, insertReference],\n );\n\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n const handleEvent = (event: Event) => {\n const payload = (event as CustomEvent).detail;\n const normalized = normalizeAgentComposerReference(payload);\n if (!normalized) return;\n insertReferenceIfEmpty({\n ...normalized,\n insertMessageId:\n typeof payload?.insertMessageId === \"string\"\n ? payload.insertMessageId\n : \"\",\n });\n };\n const handleMessage = (event: MessageEvent) => {\n if (!isTrustedFrameMessage(event) && !isTrustedBuilderMessage(event)) {\n return;\n }\n if (event.data?.type !== AGENT_CHAT_INSERT_REFERENCE_MESSAGE_TYPE) {\n return;\n }\n const payload = event.data.data;\n const normalized = normalizeAgentComposerReference(payload);\n if (!normalized) return;\n insertReferenceIfEmpty({\n ...normalized,\n insertMessageId:\n typeof payload?.insertMessageId === \"string\"\n ? payload.insertMessageId\n : \"\",\n });\n };\n window.addEventListener(AGENT_CHAT_INSERT_REFERENCE_EVENT, handleEvent);\n window.addEventListener(\"message\", handleMessage);\n return () => {\n window.removeEventListener(\n AGENT_CHAT_INSERT_REFERENCE_EVENT,\n handleEvent,\n );\n window.removeEventListener(\"message\", handleMessage);\n };\n }, [insertReferenceIfEmpty]);\n\n useImperativeHandle(focusRef, () => ({\n focus() {\n editor?.commands.focus(\"end\");\n },\n setText(text: string) {\n if (!editor) return;\n editor.commands.setContent(plainTextToDoc(text));\n editor.commands.focus(\"end\");\n const trimmed = editor.state.doc.textContent.trim();\n setEditorHasText(trimmed.length > 0);\n setSlotReferences([]);\n composerRuntime.setText(trimmed);\n onTextChangeRef.current?.(trimmed);\n try {\n if (trimmed) {\n localStorage.setItem(draftKey, editor.getHTML());\n } else {\n localStorage.removeItem(draftKey);\n }\n } catch {}\n },\n insertReference,\n }));\n\n const handleSelectMode = useCallback(\n (mode: ComposerMode) => {\n setComposerMode(mode);\n composerModeRef.current = mode;\n setTimeout(() => editor?.commands.focus(\"end\"), 50);\n },\n [editor],\n );\n\n // --- Live voice transcription: text appears in the editor as the user speaks ---\n const voiceAnchorRef = useRef<number | null>(null);\n const prevVoiceInsertRef = useRef(\"\");\n\n const handleLiveUpdate = useCallback(\n (finalText: string, interimText: string) => {\n const ed = editor;\n if (!ed) return;\n\n if (voiceAnchorRef.current == null) {\n const { from } = ed.state.selection;\n const prevChar =\n from > 1 ? ed.state.doc.textBetween(from - 1, from) : \"\";\n if (prevChar && !/\\s/.test(prevChar)) {\n ed.chain().insertContent(\" \").run();\n }\n voiceAnchorRef.current = ed.state.selection.from;\n prevVoiceInsertRef.current = \"\";\n }\n\n const anchor = voiceAnchorRef.current;\n const prevLen = prevVoiceInsertRef.current.length;\n const newText = finalText + interimText;\n\n if (newText === prevVoiceInsertRef.current) return;\n\n ed.chain()\n .deleteRange({ from: anchor, to: anchor + prevLen })\n .insertContentAt(anchor, newText)\n .run();\n\n prevVoiceInsertRef.current = newText;\n },\n [editor],\n );\n\n const insertTranscript = useCallback(\n (text: string) => {\n const ed = editor;\n if (!ed) return;\n\n const anchor = voiceAnchorRef.current;\n if (anchor != null) {\n const prevLen = prevVoiceInsertRef.current.length;\n if (text) {\n ed.chain()\n .focus()\n .deleteRange({ from: anchor, to: anchor + prevLen })\n .insertContentAt(anchor, text + \" \")\n .run();\n } else if (prevLen > 0) {\n ed.chain()\n .deleteRange({ from: anchor, to: anchor + prevLen })\n .run();\n }\n voiceAnchorRef.current = null;\n prevVoiceInsertRef.current = \"\";\n } else if (text) {\n const { from } = ed.state.selection;\n const prevChar =\n from > 1 ? ed.state.doc.textBetween(from - 1, from) : \"\";\n const needsLead = prevChar && !/\\s/.test(prevChar);\n ed.chain()\n .focus()\n .insertContent((needsLead ? \" \" : \"\") + text + \" \")\n .run();\n }\n },\n [editor],\n );\n\n const buildVoiceContextPack = useCallback(():\n | VoiceContextPack\n | undefined => {\n const snippets: Array<{ label: string; value: string }> = [];\n\n const activeContext = trimVoiceContextValue(\n formatAgentChatContextItemsForPrompt(contextItems),\n 3200,\n );\n if (activeContext) {\n snippets.push({ label: \"Active app context\", value: activeContext });\n }\n\n const selectedReferences = trimVoiceContextValue(\n slotReferences.map((ref) => slotReferenceTitle(ref)).join(\", \"),\n 1200,\n );\n if (selectedReferences) {\n snippets.push({\n label: \"Selected references\",\n value: selectedReferences,\n });\n }\n\n const draft = editor\n ? trimVoiceContextValue(editor.state.doc.textContent, 1200)\n : null;\n if (draft) snippets.push({ label: \"Current draft\", value: draft });\n\n if (typeof document !== \"undefined\") {\n const title = trimVoiceContextValue(document.title, 160);\n if (title) snippets.push({ label: \"Page title\", value: title });\n }\n\n if (typeof window !== \"undefined\") {\n const route = trimVoiceContextValue(window.location.pathname, 240);\n if (route) snippets.push({ label: \"Route\", value: route });\n }\n\n if (snippets.length === 0) return undefined;\n return {\n surface: \"agent-composer\",\n mode: \"dictation\",\n snippets,\n };\n }, [contextItems, editor, slotReferences]);\n\n const voice = useVoiceDictation({\n onTranscript: insertTranscript,\n onLiveUpdate: handleLiveUpdate,\n contextPack: buildVoiceContextPack,\n });\n\n // Clean up live text if voice session ends without a final transcript (cancel/error)\n useEffect(() => {\n if (voice.state === \"idle\" && voiceAnchorRef.current != null) {\n const anchor = voiceAnchorRef.current;\n const prevLen = prevVoiceInsertRef.current.length;\n if (editor && prevLen > 0) {\n editor\n .chain()\n .deleteRange({ from: anchor, to: anchor + prevLen })\n .run();\n }\n voiceAnchorRef.current = null;\n prevVoiceInsertRef.current = \"\";\n }\n }, [voice.state, editor]);\n\n // Global shortcut: Cmd/Ctrl + Shift + M toggles dictation. Escape cancels\n // while recording. Scoped to avoid firing when focus is outside the app.\n useEffect(() => {\n if (!voiceEnabled || !voice.supported) return;\n const handler = (e: KeyboardEvent) => {\n // e.key can be undefined on some trusted keydown events (autofill/IME\n // quirks) — seen crashing in production (AGENT-NATIVE-BROWSER-S).\n const isToggleCombo =\n typeof e.key === \"string\" &&\n e.key.toLowerCase() === \"m\" &&\n e.shiftKey &&\n (e.metaKey || e.ctrlKey) &&\n !e.altKey;\n if (isToggleCombo) {\n e.preventDefault();\n if (voice.state === \"recording\" || voice.state === \"starting\") {\n voice.stop();\n } else if (voice.state !== \"transcribing\") {\n void voice.start();\n }\n return;\n }\n if (\n e.key === \"Escape\" &&\n (voice.state === \"recording\" || voice.state === \"starting\")\n ) {\n e.preventDefault();\n voice.cancel();\n }\n };\n window.addEventListener(\"keydown\", handler);\n return () => window.removeEventListener(\"keydown\", handler);\n }, [voiceEnabled, voice]);\n\n const extractComposerPayload = useCallback(() => {\n const ed = editor;\n if (!ed) {\n return {\n text: slotReferences.map((ref) => slotReferenceTitle(ref)).join(\", \"),\n references: slotReferences.map(referenceFromComposerReference),\n };\n }\n\n const references: Reference[] = slotReferences.map(\n referenceFromComposerReference,\n );\n\n // Build text that preserves @mentions (getText() strips them).\n // Walk the document and reconstruct with @name for mention/file/skill nodes.\n const textParts: string[] = [];\n ed.state.doc.descendants((node: any) => {\n if (node.isText) {\n textParts.push(node.text);\n } else if (node.type.name === \"mentionReference\") {\n textParts.push(`@[${node.attrs.label}|${node.attrs.icon || \"file\"}]`);\n } else if (node.type.name === \"fileReference\") {\n const label = node.attrs.path?.split(\"/\").pop() || node.attrs.path;\n textParts.push(`@[${label}|file]`);\n } else if (node.type.name === \"skillReference\") {\n textParts.push(`/${node.attrs.name}`);\n } else if (node.type.name === \"hardBreak\") {\n textParts.push(\"\\n\");\n } else if (\n node.type.name === \"paragraph\" &&\n textParts.length > 0 &&\n textParts[textParts.length - 1] !== \"\\n\"\n ) {\n textParts.push(\"\\n\");\n }\n });\n const rawText = textParts.join(\"\").trim();\n const text =\n rawText ||\n slotReferences.map((ref) => slotReferenceTitle(ref)).join(\", \");\n\n ed.state.doc.descendants((node: any) => {\n if (node.type.name === \"fileReference\") {\n // Legacy support\n references.push({\n type: \"file\",\n path: node.attrs.path,\n name: node.attrs.path?.split(\"/\").pop() || node.attrs.path,\n source: node.attrs.source || \"codebase\",\n });\n } else if (node.type.name === \"mentionReference\") {\n const refType = node.attrs.refType;\n references.push({\n type:\n refType === \"file\"\n ? \"file\"\n : refType === \"agent\"\n ? \"agent\"\n : refType === \"custom-agent\"\n ? \"custom-agent\"\n : \"mention\",\n path: node.attrs.refPath || \"\",\n name: node.attrs.label,\n source: node.attrs.source,\n refType: node.attrs.refType,\n refId: node.attrs.refId,\n slotKey: node.attrs.slotKey,\n slotLabel: node.attrs.slotLabel,\n metadata: node.attrs.metadata,\n });\n } else if (node.type.name === \"skillReference\") {\n references.push({\n type: \"skill\",\n path: node.attrs.path,\n name: node.attrs.name,\n source: node.attrs.source || \"codebase\",\n });\n }\n });\n\n return { text, references };\n }, [editor, slotReferences]);\n\n const syncComposerRuntimeState = useCallback(\n (text: string, references: Reference[]) => {\n const requestMode =\n execMode === \"plan\" ? \"plan\" : execMode === \"build\" ? \"act\" : undefined;\n const custom: {\n references?: Reference[];\n requestMode?: \"act\" | \"plan\";\n } = {};\n if (references.length > 0) {\n custom.references = references;\n }\n if (requestMode) {\n custom.requestMode = requestMode;\n }\n const runConfig = Object.keys(custom).length > 0 ? { custom } : {};\n const runConfigSignature = JSON.stringify(runConfig);\n const last = lastComposerRuntimeSyncRef.current;\n if (\n last?.text === text &&\n last.runConfigSignature === runConfigSignature\n ) {\n return;\n }\n composerRuntime.setText(text);\n composerRuntime.setRunConfig(runConfig);\n lastComposerRuntimeSyncRef.current = { text, runConfigSignature };\n },\n [composerRuntime, execMode],\n );\n\n const resetComposerRuntimeState = useCallback(() => {\n const runConfigSignature = \"{}\";\n const last = lastComposerRuntimeSyncRef.current;\n if (last?.text === \"\" && last.runConfigSignature === runConfigSignature) {\n return;\n }\n composerRuntime.setText(\"\");\n composerRuntime.setRunConfig({});\n lastComposerRuntimeSyncRef.current = { text: \"\", runConfigSignature };\n }, [composerRuntime]);\n\n const syncComposerState = useCallback(() => {\n const { text, references } = extractComposerPayload();\n syncComposerRuntimeState(text, references);\n return { text, references };\n }, [extractComposerPayload, syncComposerRuntimeState]);\n\n const clearEditorAfterSubmit = useCallback(() => {\n const ed = editor;\n if (!ed) return;\n ed.commands.clearContent();\n setEditorHasText(false);\n setSlotReferences([]);\n resetComposerRuntimeState();\n try {\n localStorage.removeItem(draftKey);\n } catch {}\n closePopover();\n }, [closePopover, draftKey, editor, resetComposerRuntimeState]);\n\n const submitComposer = useCallback(\n async (intent: ComposerSubmitIntent = \"immediate\") => {\n const ed = editor;\n if (!ed) return;\n if (submitInFlightRef.current) return;\n\n const { text, references } = syncComposerState();\n const attachments = composerRuntime.getState().attachments;\n if (!text.trim() && references.length === 0 && attachments.length === 0)\n return;\n const oversizedDocumentError =\n getOversizedDocumentAttachmentError(attachments);\n if (oversizedDocumentError) {\n onAttachmentErrorRef.current?.(oversizedDocumentError);\n return;\n }\n const cancelActiveVoice = () => {\n if (\n voice.state === \"recording\" ||\n voice.state === \"starting\" ||\n voice.state === \"transcribing\"\n ) {\n voice.cancel();\n }\n };\n\n // Intercept slash commands typed directly (e.g. \"/clear\" + Enter)\n const trimmed = text.trim();\n if (trimmed.startsWith(\"/\") && references.length === 0) {\n const cmdName = normalizeSlashCommandName(trimmed);\n const matched = allSlashCommands.find((c) => c.name === cmdName);\n if (matched) {\n clearEditorAfterSubmit();\n onSlashCommandRef.current?.(matched.name);\n return;\n }\n }\n\n // Builder iframe delegation: when this app is mounted inside the\n // Builder.io webview and the user typed a \"build me an app/agent\"\n // prompt, hand it up to the parent Builder chat instead of sending\n // it to this app's domain agent. Builder is the code-writing agent;\n // the local agent (dispatch, mail, etc.) cannot scaffold workspace\n // apps from inside its own iframe.\n if (\n !composerMode &&\n interceptBuildRequestsForBuilder &&\n tryDelegateBuildRequestToBuilder(trimmed)\n ) {\n cancelActiveVoice();\n clearEditorAfterSubmit();\n return;\n }\n\n if (onBeforeSubmit) {\n submitInFlightRef.current = true;\n try {\n const shouldSubmit = await onBeforeSubmit();\n if (!shouldSubmit) return;\n } finally {\n submitInFlightRef.current = false;\n }\n }\n\n // Composer mode: send with context via agent chat bridge\n if (composerMode) {\n const config = COMPOSER_MODE_CONFIGS[composerMode];\n config.beforeSend?.();\n const message = displayableComposerModeMessage({\n messagePrefix: config.messagePrefix,\n trimmedText: trimmed,\n attachmentCount: attachments.length,\n });\n const modePrompt =\n trimmed ||\n (attachments.length > 0 ? \"Use the attached context.\" : \"\");\n if (attachments.length > 0) {\n composerRuntime.setText(\n `${message}\\n\\n<context>\\n${config.getContext(modePrompt)}\\n</context>`,\n );\n composerRuntime.send();\n } else {\n sendToAgentChat({\n message,\n context: config.getContext(modePrompt),\n mode:\n execMode === \"plan\"\n ? \"plan\"\n : execMode === \"build\"\n ? \"act\"\n : undefined,\n submit: true,\n });\n }\n cancelActiveVoice();\n ed.commands.clearContent();\n setEditorHasText(false);\n setSlotReferences([]);\n setComposerMode(null);\n composerModeRef.current = null;\n try {\n localStorage.removeItem(draftKey);\n } catch {}\n closePopover();\n return;\n }\n\n if (onSubmit) {\n onSubmit(text, references, attachments, { intent });\n // Clear any pending attachments now that the host has them.\n void composerRuntime.clearAttachments().catch(() => {});\n if (!clearOnSubmit) {\n closePopover();\n return;\n }\n cancelActiveVoice();\n clearEditorAfterSubmit();\n return;\n } else {\n composerRuntime.send();\n }\n cancelActiveVoice();\n ed.commands.clearContent();\n setEditorHasText(false);\n setSlotReferences([]);\n try {\n localStorage.removeItem(draftKey);\n } catch {}\n closePopover();\n },\n [\n closePopover,\n clearEditorAfterSubmit,\n composerMode,\n composerRuntime,\n draftKey,\n editor,\n interceptBuildRequestsForBuilder,\n clearOnSubmit,\n onBeforeSubmit,\n onSubmit,\n syncComposerState,\n voice,\n allSlashCommands,\n ],\n );\n\n // Helper functions that operate on the editor view directly\n // These are called from handleKeyDown which can't use React state\n function selectMention(\n _view: any,\n pop: NonNullable<PopoverState>,\n item: MentionItem,\n ) {\n const ed = editor;\n if (!ed) return;\n const currentPos = ed.state.selection.from;\n // startPos is after the trigger char, so -1 to include the @ or /\n const deleteFrom = Math.max(0, pop.startPos - 1);\n ed.chain().focus().deleteRange({ from: deleteFrom, to: currentPos }).run();\n insertReference(composerReferenceFromMentionItem(item));\n popoverStateRef.current = null;\n setPopover(null);\n }\n\n function executeCommand(\n _view: any,\n pop: NonNullable<PopoverState>,\n command: SlashCommand,\n ) {\n const ed = editor;\n if (!ed) return;\n const currentPos = ed.state.selection.from;\n const deleteFrom = Math.max(0, pop.startPos - 1);\n ed.chain().focus().deleteRange({ from: deleteFrom, to: currentPos }).run();\n popoverStateRef.current = null;\n setPopover(null);\n onSlashCommandRef.current?.(command.name);\n }\n\n function selectSkill(\n _view: any,\n pop: NonNullable<PopoverState>,\n skill: SkillResult,\n ) {\n const ed = editor;\n if (!ed) return;\n const currentPos = ed.state.selection.from;\n const deleteFrom = Math.max(0, pop.startPos - 1);\n ed.chain()\n .focus()\n .deleteRange({ from: deleteFrom, to: currentPos })\n .insertContent({\n type: \"skillReference\",\n attrs: { name: skill.name, path: skill.path, source: skill.source },\n })\n .insertContent(\" \")\n .run();\n popoverStateRef.current = null;\n setPopover(null);\n }\n\n // Popover select handlers for click-based selection (from MentionPopover)\n const handleSelectMention = useCallback(\n (item: MentionItem) => {\n if (!editor || !popover) return;\n const currentPos = editor.state.selection.from;\n const deleteFrom = Math.max(0, popover.startPos - 1);\n editor\n .chain()\n .focus()\n .deleteRange({ from: deleteFrom, to: currentPos })\n .run();\n insertReference(composerReferenceFromMentionItem(item));\n closePopover();\n },\n [editor, popover, closePopover, insertReference],\n );\n\n const handleSelectCommand = useCallback(\n (command: SlashCommand) => {\n if (!editor || !popover) return;\n const currentPos = editor.state.selection.from;\n const deleteFrom = Math.max(0, popover.startPos - 1);\n editor\n .chain()\n .focus()\n .deleteRange({ from: deleteFrom, to: currentPos })\n .run();\n closePopover();\n onSlashCommand?.(command.name);\n },\n [editor, popover, closePopover, onSlashCommand],\n );\n\n const handleSelectSkill = useCallback(\n (skill: SkillResult) => {\n if (!editor || !popover) return;\n const currentPos = editor.state.selection.from;\n const deleteFrom = Math.max(0, popover.startPos - 1);\n editor\n .chain()\n .focus()\n .deleteRange({ from: deleteFrom, to: currentPos })\n .insertContent({\n type: \"skillReference\",\n attrs: { name: skill.name, path: skill.path, source: skill.source },\n })\n .insertContent(\" \")\n .run();\n closePopover();\n },\n [editor, popover, closePopover],\n );\n\n // Track query text as user types after trigger\n useEffect(() => {\n if (!editor || !popover) return;\n\n const updateHandler = () => {\n const pop = popoverStateRef.current;\n if (!pop) return;\n const { from } = editor.state.selection;\n const { startPos, type } = pop;\n\n if (from < startPos) {\n closePopover();\n return;\n }\n\n const text = editor.state.doc.textBetween(startPos, from);\n\n // Verify the trigger character is still there\n if (startPos > 0) {\n const triggerChar = editor.state.doc.textBetween(\n startPos - 1,\n startPos,\n );\n if (\n (type === \"@\" && triggerChar !== \"@\") ||\n (type === \"/\" && triggerChar !== \"/\")\n ) {\n closePopover();\n return;\n }\n }\n\n if (pop.query === text) return;\n const updated = { ...pop, query: text };\n popoverStateRef.current = updated;\n setPopover(updated);\n };\n\n editor.on(\"update\", updateHandler);\n editor.on(\"selectionUpdate\", updateHandler);\n return () => {\n editor.off(\"update\", updateHandler);\n editor.off(\"selectionUpdate\", updateHandler);\n };\n }, [editor, popover, closePopover]);\n\n useEffect(() => {\n if (!editor) return;\n if (composerText !== \"\") return;\n if (editor.isEmpty) return;\n editor.commands.clearContent();\n }, [composerText, editor]);\n\n useEffect(() => {\n if (!editor || initialText === undefined) return;\n const key = initialTextKey ?? initialText;\n if (initialTextKeyRef.current === key) return;\n initialTextKeyRef.current = key;\n editor.commands.setContent(plainTextToDoc(initialText));\n editor.commands.focus(\"end\");\n const trimmed = editor.state.doc.textContent.trim();\n setEditorHasText(trimmed.length > 0);\n composerRuntime.setText(trimmed);\n onTextChangeRef.current?.(trimmed);\n try {\n if (trimmed) {\n localStorage.setItem(draftKey, editor.getHTML());\n } else {\n localStorage.removeItem(draftKey);\n }\n } catch {}\n }, [composerRuntime, draftKey, editor, initialText, initialTextKey]);\n\n // Tiptap only reads `editable` at init; prop changes need setEditable.\n useEffect(() => {\n if (!editor) return;\n editor.setEditable(!disabled);\n if (disabled) editor.commands.blur();\n }, [editor, disabled]);\n\n return (\n <>\n <style>{`\n .aui-composer .ProseMirror p.is-editor-empty:first-child::before {\n content: attr(data-placeholder);\n color: var(--color-muted-foreground);\n opacity: 0.5;\n float: left;\n height: 0;\n pointer-events: none;\n }\n `}</style>\n {composerMode && (\n <div\n data-agent-composer-variant={layoutVariant}\n data-agent-composer-slot=\"mode-row\"\n className=\"agent-composer-mode-row px-2.5 pt-2 pb-0\"\n >\n <ComposerModeChip\n mode={composerMode}\n onRemove={() => {\n setComposerMode(null);\n composerModeRef.current = null;\n editor?.commands.focus(\"end\");\n }}\n />\n </div>\n )}\n {hasContextRows && (\n <div\n data-agent-composer-variant={layoutVariant}\n data-agent-composer-slot=\"context-row\"\n className=\"agent-composer-context-row flex flex-wrap gap-1.5 px-2.5 pt-2 pb-0\"\n >\n {slotReferences.map((ref) => (\n <span\n key={ref.slotKey}\n className=\"inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-background px-2 py-1 text-[11px] font-medium text-foreground shadow-sm\"\n >\n <IconClipboardList className=\"h-3 w-3 shrink-0 text-muted-foreground\" />\n {ref.slotLabel && (\n <span className=\"shrink-0 text-muted-foreground\">\n {ref.slotLabel}\n </span>\n )}\n <span className=\"min-w-0 truncate\">{ref.label}</span>\n <button\n type=\"button\"\n onClick={() => {\n setSlotReferences((current) =>\n removeSlotReference(current, ref),\n );\n editor?.commands.focus(\"end\");\n }}\n aria-label={`Remove ${slotReferenceTitle(ref)} reference`}\n className=\"ms-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground\"\n >\n <IconX className=\"h-3 w-3\" />\n </button>\n </span>\n ))}\n {contextItems.map((item) => (\n <span\n key={item.key}\n className=\"inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted/50 px-2 py-1 text-[11px] font-medium text-foreground\"\n >\n <IconClipboardList className=\"h-3 w-3 shrink-0 text-muted-foreground\" />\n <span className=\"min-w-0 truncate\">{item.title}</span>\n <button\n type=\"button\"\n onClick={() => onRemoveContextItem?.(item.key)}\n aria-label={`Remove ${item.title} context`}\n className=\"ms-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground\"\n >\n <IconX className=\"h-3 w-3\" />\n </button>\n </span>\n ))}\n </div>\n )}\n <div\n data-agent-composer-variant={layoutVariant}\n data-agent-composer-slot=\"editor-wrap\"\n className={`agent-composer-editor-wrap ${\n composerMode || hasContextRows ? \"px-2 pt-1 pb-1\" : \"px-2 pt-2 pb-1\"\n }`}\n >\n <EditorContent\n editor={editor}\n data-agent-composer-variant={layoutVariant}\n data-agent-composer-slot=\"editor\"\n className=\"agent-composer-editor aui-composer flex-1 min-w-0 [&_.ProseMirror]:outline-none [&_.ProseMirror_p]:m-0 px-0.5\"\n />\n </div>\n {voiceEnabled && <VoiceRecordingOverlay voice={voice} />}\n <div\n data-agent-composer-variant={layoutVariant}\n data-agent-composer-slot=\"toolbar\"\n className=\"agent-composer-toolbar flex items-center gap-1 px-2 py-1.5\"\n >\n {attachButton ??\n (plusMenuMode === \"hidden\" ? null : (\n <ComposerPlusMenu\n onSelectMode={handleSelectMode}\n mode={plusMenuMode}\n onAttachmentError={onAttachmentError}\n />\n ))}\n {toolbarSlot ?? modeControl}\n <div data-agent-composer-slot=\"toolbar-spacer\" className=\"flex-1\" />\n {selectedModel && availableModels && onModelChange && (\n <ModelSelector\n model={selectedModel}\n effort={selectedEffort}\n engines={availableModels}\n onChange={onModelChange}\n onEffortChange={onEffortChange}\n providerConnectStatusEnabled={providerConnectStatusEnabled}\n onConnectProvider={onConnectProvider}\n imageModel={imageModelMenu}\n />\n )}\n {execMode && onExecModeChange && (\n <ModeSelector\n mode={execMode}\n onChange={onExecModeChange}\n planModeDisabled={planModeDisabled}\n planModeDisabledReason={planModeDisabledReason}\n />\n )}\n {actionButton ?? (\n <>\n {extraActionButton}\n {voiceEnabled && (\n <VoiceButton voice={voice} isMac={isMac} disabled={disabled} />\n )}\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n onClick={() => void submitComposer(\"immediate\")}\n disabled={!canSend}\n data-agent-composer-slot=\"send-button\"\n className=\"agent-composer-send-button shrink-0 flex h-7 w-7 items-center justify-center rounded-md bg-primary text-primary-foreground hover:opacity-90 disabled:opacity-30 disabled:cursor-not-allowed\"\n >\n <IconArrowUp className=\"h-3.5 w-3.5\" />\n </button>\n </TooltipTrigger>\n <TooltipContent>Send message</TooltipContent>\n </Tooltip>\n </>\n )}\n </div>\n <MentionPopover\n ref={popoverRef}\n type={popover?.type ?? \"@\"}\n position={popover?.position ?? null}\n mentionItems={filteredMentionItems}\n skills={filteredSkills}\n commands={filteredCommands}\n hint={hint}\n isLoading={popover?.type === \"@\" ? mentionsLoading : skillsLoading}\n query={popover?.query ?? \"\"}\n onSelectMention={handleSelectMention}\n onSelectSkill={handleSelectSkill}\n onSelectCommand={handleSelectCommand}\n onClose={closePopover}\n />\n </>\n );\n}\n"]}
|