@agent-native/core 0.88.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 +82 -2
- package/corpus/core/docs/content/agent-native-toolkit.mdx +87 -146
- 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 +100 -70
- 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/de-DE/agent-native-toolkit.mdx +100 -74
- 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/es-ES/agent-native-toolkit.mdx +100 -74
- 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/fr-FR/agent-native-toolkit.mdx +100 -76
- 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/hi-IN/agent-native-toolkit.mdx +100 -71
- 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/ja-JP/agent-native-toolkit.mdx +100 -64
- 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/ko-KR/agent-native-toolkit.mdx +100 -60
- 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/pt-BR/agent-native-toolkit.mdx +100 -74
- 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/zh-CN/agent-native-toolkit.mdx +100 -58
- 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-TW/agent-native-toolkit.mdx +100 -58
- 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/real-time-collaboration.mdx +10 -11
- 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 +5 -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/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/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/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/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 +12 -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/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/handlers/sql-query.ts +1 -1
- package/corpus/templates/analytics/server/lib/dashboard-panel-query.ts +109 -1
- 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/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/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/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/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/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/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/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/settings.tsx +6 -21
- package/corpus/templates/slides/changelog/2026-07-06-mobile-layouts-no-longer-stack-two-top-headers.md +5 -0
- package/corpus/templates/slides/server/handlers/uploads.ts +7 -2
- package/corpus/templates/slides/server/lib/chat-attachments.ts +1 -1
- 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 +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/observability/routes.d.ts +5 -5
- 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/progress/routes.d.ts +1 -1
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- 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/secrets/routes.d.ts +9 -9
- 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/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/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/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 +11 -0
- package/dist/vite/client.js.map +1 -1
- package/docs/content/agent-native-toolkit.mdx +87 -146
- 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 +100 -70
- 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/de-DE/agent-native-toolkit.mdx +100 -74
- 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/es-ES/agent-native-toolkit.mdx +100 -74
- 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/fr-FR/agent-native-toolkit.mdx +100 -76
- 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/hi-IN/agent-native-toolkit.mdx +100 -71
- 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/ja-JP/agent-native-toolkit.mdx +100 -64
- 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/ko-KR/agent-native-toolkit.mdx +100 -60
- 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/pt-BR/agent-native-toolkit.mdx +100 -74
- 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/zh-CN/agent-native-toolkit.mdx +100 -58
- 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-TW/agent-native-toolkit.mdx +100 -58
- 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/real-time-collaboration.mdx +10 -11
- 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 +6 -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/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
|
@@ -23,94 +23,11 @@ import {
|
|
|
23
23
|
useAcceptInvitation,
|
|
24
24
|
useJoinByDomain,
|
|
25
25
|
useOrg,
|
|
26
|
-
type OrgInfo,
|
|
27
|
-
type OrgInvitationSummary,
|
|
28
|
-
type DomainMatchOrg,
|
|
29
26
|
} from "@agent-native/core/client/org";
|
|
30
27
|
import {
|
|
31
28
|
useSetHeaderActions,
|
|
32
29
|
useSetPageTitle,
|
|
33
30
|
} from "@agent-native/toolkit/app-shell";
|
|
34
|
-
import {
|
|
35
|
-
AlertDialog,
|
|
36
|
-
AlertDialogAction,
|
|
37
|
-
AlertDialogCancel,
|
|
38
|
-
AlertDialogContent,
|
|
39
|
-
AlertDialogDescription,
|
|
40
|
-
AlertDialogFooter,
|
|
41
|
-
AlertDialogHeader,
|
|
42
|
-
AlertDialogTitle,
|
|
43
|
-
} from "@agent-native/toolkit/ui/alert-dialog";
|
|
44
|
-
import {
|
|
45
|
-
Avatar,
|
|
46
|
-
AvatarFallback,
|
|
47
|
-
AvatarImage,
|
|
48
|
-
} from "@agent-native/toolkit/ui/avatar";
|
|
49
|
-
import { Badge } from "@agent-native/toolkit/ui/badge";
|
|
50
|
-
import { Button } from "@agent-native/toolkit/ui/button";
|
|
51
|
-
import { Checkbox } from "@agent-native/toolkit/ui/checkbox";
|
|
52
|
-
import {
|
|
53
|
-
Collapsible,
|
|
54
|
-
CollapsibleContent,
|
|
55
|
-
CollapsibleTrigger,
|
|
56
|
-
} from "@agent-native/toolkit/ui/collapsible";
|
|
57
|
-
import {
|
|
58
|
-
Dialog,
|
|
59
|
-
DialogContent,
|
|
60
|
-
DialogDescription,
|
|
61
|
-
DialogFooter,
|
|
62
|
-
DialogHeader,
|
|
63
|
-
DialogTitle,
|
|
64
|
-
} from "@agent-native/toolkit/ui/dialog";
|
|
65
|
-
import {
|
|
66
|
-
DropdownMenu,
|
|
67
|
-
DropdownMenuCheckboxItem,
|
|
68
|
-
DropdownMenuContent,
|
|
69
|
-
DropdownMenuGroup,
|
|
70
|
-
DropdownMenuItem,
|
|
71
|
-
DropdownMenuLabel,
|
|
72
|
-
DropdownMenuRadioGroup,
|
|
73
|
-
DropdownMenuRadioItem,
|
|
74
|
-
DropdownMenuSeparator,
|
|
75
|
-
DropdownMenuSub,
|
|
76
|
-
DropdownMenuSubContent,
|
|
77
|
-
DropdownMenuSubTrigger,
|
|
78
|
-
DropdownMenuTrigger,
|
|
79
|
-
} from "@agent-native/toolkit/ui/dropdown-menu";
|
|
80
|
-
import { Input } from "@agent-native/toolkit/ui/input";
|
|
81
|
-
import { Label } from "@agent-native/toolkit/ui/label";
|
|
82
|
-
import {
|
|
83
|
-
Popover,
|
|
84
|
-
PopoverContent,
|
|
85
|
-
PopoverTrigger,
|
|
86
|
-
} from "@agent-native/toolkit/ui/popover";
|
|
87
|
-
import { ScrollArea } from "@agent-native/toolkit/ui/scroll-area";
|
|
88
|
-
import {
|
|
89
|
-
Select,
|
|
90
|
-
SelectContent,
|
|
91
|
-
SelectItem,
|
|
92
|
-
SelectTrigger,
|
|
93
|
-
SelectValue,
|
|
94
|
-
} from "@agent-native/toolkit/ui/select";
|
|
95
|
-
import { Separator } from "@agent-native/toolkit/ui/separator";
|
|
96
|
-
import {
|
|
97
|
-
Sheet,
|
|
98
|
-
SheetContent,
|
|
99
|
-
SheetDescription,
|
|
100
|
-
SheetHeader,
|
|
101
|
-
SheetTitle,
|
|
102
|
-
} from "@agent-native/toolkit/ui/sheet";
|
|
103
|
-
import { Skeleton } from "@agent-native/toolkit/ui/skeleton";
|
|
104
|
-
import { Textarea } from "@agent-native/toolkit/ui/textarea";
|
|
105
|
-
import {
|
|
106
|
-
ToggleGroup,
|
|
107
|
-
ToggleGroupItem,
|
|
108
|
-
} from "@agent-native/toolkit/ui/toggle-group";
|
|
109
|
-
import {
|
|
110
|
-
Tooltip,
|
|
111
|
-
TooltipContent,
|
|
112
|
-
TooltipTrigger,
|
|
113
|
-
} from "@agent-native/toolkit/ui/tooltip";
|
|
114
31
|
import {
|
|
115
32
|
SOURCE_AUTHOR_COMMENT_MENTION_EMAIL,
|
|
116
33
|
extractCommentMentions,
|
|
@@ -119,11 +36,9 @@ import {
|
|
|
119
36
|
normalizePlanCommentResolutionTarget,
|
|
120
37
|
parsePlanCommentAnchor,
|
|
121
38
|
planCommentAnchorDetails,
|
|
122
|
-
type PlanCommentAnchor,
|
|
123
39
|
type PlanCommentMention,
|
|
124
40
|
type PlanCommentResolutionTarget,
|
|
125
41
|
} from "@shared/comment-context";
|
|
126
|
-
import { mimeTypeFromFilename } from "@shared/plan-assets";
|
|
127
42
|
import type {
|
|
128
43
|
PlanAnnotation,
|
|
129
44
|
PlanBlock,
|
|
@@ -196,6 +111,7 @@ import { useTheme } from "next-themes";
|
|
|
196
111
|
import {
|
|
197
112
|
useCallback,
|
|
198
113
|
useEffect,
|
|
114
|
+
useLayoutEffect,
|
|
199
115
|
useMemo,
|
|
200
116
|
useRef,
|
|
201
117
|
useState,
|
|
@@ -219,7 +135,80 @@ import {
|
|
|
219
135
|
toggleWireframeStyle,
|
|
220
136
|
useWireframeStyle,
|
|
221
137
|
} from "@/components/plan/wireframe/use-wireframe-style";
|
|
138
|
+
import {
|
|
139
|
+
AlertDialog,
|
|
140
|
+
AlertDialogAction,
|
|
141
|
+
AlertDialogCancel,
|
|
142
|
+
AlertDialogContent,
|
|
143
|
+
AlertDialogDescription,
|
|
144
|
+
AlertDialogFooter,
|
|
145
|
+
AlertDialogHeader,
|
|
146
|
+
AlertDialogTitle,
|
|
147
|
+
} from "@/components/ui/alert-dialog";
|
|
148
|
+
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
|
|
149
|
+
import { Badge } from "@/components/ui/badge";
|
|
150
|
+
import { Button } from "@/components/ui/button";
|
|
151
|
+
import { Checkbox } from "@/components/ui/checkbox";
|
|
152
|
+
import {
|
|
153
|
+
Collapsible,
|
|
154
|
+
CollapsibleContent,
|
|
155
|
+
CollapsibleTrigger,
|
|
156
|
+
} from "@/components/ui/collapsible";
|
|
157
|
+
import {
|
|
158
|
+
Dialog,
|
|
159
|
+
DialogContent,
|
|
160
|
+
DialogDescription,
|
|
161
|
+
DialogFooter,
|
|
162
|
+
DialogHeader,
|
|
163
|
+
DialogTitle,
|
|
164
|
+
} from "@/components/ui/dialog";
|
|
165
|
+
import {
|
|
166
|
+
DropdownMenu,
|
|
167
|
+
DropdownMenuCheckboxItem,
|
|
168
|
+
DropdownMenuContent,
|
|
169
|
+
DropdownMenuGroup,
|
|
170
|
+
DropdownMenuItem,
|
|
171
|
+
DropdownMenuLabel,
|
|
172
|
+
DropdownMenuRadioGroup,
|
|
173
|
+
DropdownMenuRadioItem,
|
|
174
|
+
DropdownMenuSeparator,
|
|
175
|
+
DropdownMenuSub,
|
|
176
|
+
DropdownMenuSubContent,
|
|
177
|
+
DropdownMenuSubTrigger,
|
|
178
|
+
DropdownMenuTrigger,
|
|
179
|
+
} from "@/components/ui/dropdown-menu";
|
|
180
|
+
import { Input } from "@/components/ui/input";
|
|
181
|
+
import { Label } from "@/components/ui/label";
|
|
182
|
+
import {
|
|
183
|
+
Popover,
|
|
184
|
+
PopoverContent,
|
|
185
|
+
PopoverTrigger,
|
|
186
|
+
} from "@/components/ui/popover";
|
|
187
|
+
import { ScrollArea } from "@/components/ui/scroll-area";
|
|
188
|
+
import {
|
|
189
|
+
Select,
|
|
190
|
+
SelectContent,
|
|
191
|
+
SelectItem,
|
|
192
|
+
SelectTrigger,
|
|
193
|
+
SelectValue,
|
|
194
|
+
} from "@/components/ui/select";
|
|
195
|
+
import { Separator } from "@/components/ui/separator";
|
|
196
|
+
import {
|
|
197
|
+
Sheet,
|
|
198
|
+
SheetContent,
|
|
199
|
+
SheetDescription,
|
|
200
|
+
SheetHeader,
|
|
201
|
+
SheetTitle,
|
|
202
|
+
} from "@/components/ui/sheet";
|
|
203
|
+
import { Skeleton } from "@/components/ui/skeleton";
|
|
222
204
|
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
205
|
+
import { Textarea } from "@/components/ui/textarea";
|
|
206
|
+
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
|
|
207
|
+
import {
|
|
208
|
+
Tooltip,
|
|
209
|
+
TooltipContent,
|
|
210
|
+
TooltipTrigger,
|
|
211
|
+
} from "@/components/ui/tooltip";
|
|
223
212
|
import {
|
|
224
213
|
planBundleQueryKey,
|
|
225
214
|
localPlanBundleQueryKey,
|
|
@@ -254,13 +243,80 @@ import {
|
|
|
254
243
|
import {
|
|
255
244
|
getDesktopPlanFiles,
|
|
256
245
|
type DesktopPlanFilesFolder,
|
|
257
|
-
type PlanMdxFolder,
|
|
258
246
|
} from "@/lib/desktop-plan-files";
|
|
259
247
|
import { syncLocalControlResources } from "@/lib/local-control-resources";
|
|
248
|
+
import {
|
|
249
|
+
resolvePlanOrgAccessPrompt,
|
|
250
|
+
type PlanOrgAccessPrompt,
|
|
251
|
+
} from "@/lib/plan-access-prompt";
|
|
252
|
+
import {
|
|
253
|
+
PREFERRED_EDITOR_VALUES,
|
|
254
|
+
PREFERRED_EDITOR_STORAGE_KEY,
|
|
255
|
+
DESKTOP_PLAN_SYNC_AUTO_KEY_PREFIX,
|
|
256
|
+
injectAnnotationRuntime,
|
|
257
|
+
type PreferredEditor,
|
|
258
|
+
type RuntimeAnnotation,
|
|
259
|
+
type RuntimeAnnotationComment,
|
|
260
|
+
type RuntimeAnnotationParticipant,
|
|
261
|
+
} from "@/lib/plan-annotation-runtime";
|
|
262
|
+
import {
|
|
263
|
+
appendMessageToEditor,
|
|
264
|
+
canSubmitInlineCommentDraft,
|
|
265
|
+
commentBodyText,
|
|
266
|
+
createMentionChip,
|
|
267
|
+
displayNameForMention,
|
|
268
|
+
mentionQueryAtCaret,
|
|
269
|
+
serializeCommentEditor,
|
|
270
|
+
type CommentDraft,
|
|
271
|
+
} from "@/lib/plan-comment-editor-helpers";
|
|
260
272
|
import { planDocumentTitle } from "@/lib/plan-document-title";
|
|
273
|
+
import {
|
|
274
|
+
fetchLocalPlanBridgeBundle,
|
|
275
|
+
localPlanBridgeQueryKey,
|
|
276
|
+
localPlanBridgeRetryDelay,
|
|
277
|
+
localPlanRoutePath,
|
|
278
|
+
localPlanRouteUrl,
|
|
279
|
+
mergeLocalBridgeComments,
|
|
280
|
+
shouldRetryLocalPlanBridgeBundle,
|
|
281
|
+
shouldShowPlanLoadError,
|
|
282
|
+
updateLocalPlanBridgeComments,
|
|
283
|
+
type LocalPlanBundle,
|
|
284
|
+
type PlanBundleWithHtml,
|
|
285
|
+
type PlanCommentItem,
|
|
286
|
+
} from "@/lib/plan-local-bridge";
|
|
287
|
+
import {
|
|
288
|
+
buildNativeAnchorFromElement,
|
|
289
|
+
clamp,
|
|
290
|
+
findPlanBlockById,
|
|
291
|
+
nativeMarkerPlacementForAnchor,
|
|
292
|
+
nativePointForAnchor,
|
|
293
|
+
prototypeScreenIdForAnchor,
|
|
294
|
+
resolveNativeAnchorTarget,
|
|
295
|
+
selectorForElementWithin,
|
|
296
|
+
textQuoteContextForBlock,
|
|
297
|
+
type PlanAnnotationAnchor,
|
|
298
|
+
} from "@/lib/plan-native-anchors";
|
|
261
299
|
import { cn } from "@/lib/utils";
|
|
262
300
|
|
|
263
|
-
|
|
301
|
+
export {
|
|
302
|
+
resolvePlanOrgAccessPrompt,
|
|
303
|
+
buildNativeAnchorFromElement,
|
|
304
|
+
nativeMarkerPlacementForAnchor,
|
|
305
|
+
nativePointForAnchor,
|
|
306
|
+
prototypeScreenIdForAnchor,
|
|
307
|
+
resolveNativeAnchorTarget,
|
|
308
|
+
selectorForElementWithin,
|
|
309
|
+
localPlanBridgeRetryDelay,
|
|
310
|
+
shouldRetryLocalPlanBridgeBundle,
|
|
311
|
+
shouldShowPlanLoadError,
|
|
312
|
+
};
|
|
313
|
+
export type { NativeMarkerPlacement } from "@/lib/plan-native-anchors";
|
|
314
|
+
export type { PlanOrgAccessPrompt } from "@/lib/plan-access-prompt";
|
|
315
|
+
export { canSubmitInlineCommentDraft, mentionQueryAtCaret };
|
|
316
|
+
export type { CommentDraft } from "@/lib/plan-comment-editor-helpers";
|
|
317
|
+
|
|
318
|
+
const useBrowserLayoutEffect =
|
|
319
|
+
typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
264
320
|
|
|
265
321
|
function GoogleLogoIcon({ className }: { className?: string }) {
|
|
266
322
|
return (
|
|
@@ -327,44 +383,6 @@ const CURRENT_USER_FALLBACK_NAME = "You";
|
|
|
327
383
|
const CURRENT_USER_FALLBACK_INITIALS = "You";
|
|
328
384
|
const CURRENT_USER_FALLBACK_COLOR = "#2563eb";
|
|
329
385
|
|
|
330
|
-
type PreferredEditor =
|
|
331
|
-
| "vscode"
|
|
332
|
-
| "cursor"
|
|
333
|
-
| "finder"
|
|
334
|
-
| "terminal"
|
|
335
|
-
| "ghostty"
|
|
336
|
-
| "xcode";
|
|
337
|
-
|
|
338
|
-
const PREFERRED_EDITOR_STORAGE_KEY = "agent-native-plans.preferredEditor";
|
|
339
|
-
const DESKTOP_PLAN_SYNC_AUTO_KEY_PREFIX =
|
|
340
|
-
"agent-native-plans.desktopSync.auto.";
|
|
341
|
-
const PREFERRED_EDITOR_VALUES: PreferredEditor[] = [
|
|
342
|
-
"vscode",
|
|
343
|
-
"cursor",
|
|
344
|
-
"finder",
|
|
345
|
-
"terminal",
|
|
346
|
-
"ghostty",
|
|
347
|
-
"xcode",
|
|
348
|
-
];
|
|
349
|
-
|
|
350
|
-
const EDITOR_OPTIONS: Array<{ value: PreferredEditor; label: string }> = [
|
|
351
|
-
{ value: "vscode", label: "VS Code" }, // i18n-ignore stable app name
|
|
352
|
-
{ value: "cursor", label: "Cursor" }, // i18n-ignore stable app name
|
|
353
|
-
{ value: "finder", label: "Finder" }, // i18n-ignore stable app name
|
|
354
|
-
{ value: "terminal", label: "Terminal" }, // i18n-ignore stable app name
|
|
355
|
-
{ value: "ghostty", label: "Ghostty" }, // i18n-ignore stable app name
|
|
356
|
-
{ value: "xcode", label: "Xcode" }, // i18n-ignore stable app name
|
|
357
|
-
];
|
|
358
|
-
|
|
359
|
-
const EDITOR_ICON_HTML: Record<PreferredEditor, string> = {
|
|
360
|
-
vscode: `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="tabler-icon tabler-icon-brand-vscode" aria-hidden="true"><path d="M16 3v18l4 -2.5v-13l-4 -2.5"></path><path d="M9.165 13.903l-4.165 3.597l-2 -1l4.333 -4.5m1.735 -1.802l6.932 -7.198v5l-4.795 4.141"></path><path d="M16 16.5l-11 -10l-2 1l13 13.5"></path></svg>`, // i18n-ignore inline SVG icon markup
|
|
361
|
-
cursor: `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="tabler-icon tabler-icon-cube" aria-hidden="true"><path d="M21 16.008v-8.018a1.98 1.98 0 0 0 -1 -1.717l-7 -4.008a2.016 2.016 0 0 0 -2 0l-7 4.008c-.619 .355 -1 1.01 -1 1.718v8.018c0 .709 .381 1.363 1 1.717l7 4.008a2.016 2.016 0 0 0 2 0l7 -4.008c.619 -.355 1 -1.01 1 -1.718"></path><path d="M12 22v-10"></path><path d="M12 12l8.73 -5.04"></path><path d="M3.27 6.96l8.73 5.04"></path></svg>`, // i18n-ignore inline SVG icon markup
|
|
362
|
-
finder: `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="tabler-icon tabler-icon-brand-finder" aria-hidden="true"><path d="M3 5a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1l0 -14"></path><path d="M7 8v1"></path><path d="M17 8v1"></path><path d="M12.5 4c-.654 1.486 -1.26 3.443 -1.5 9h2.5c-.19 2.867 .094 5.024 .5 7"></path><path d="M7 15.5c3.667 2 6.333 2 10 0"></path></svg>`, // i18n-ignore inline SVG icon markup
|
|
363
|
-
terminal: `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="tabler-icon tabler-icon-terminal-2" aria-hidden="true"><path d="M8 9l3 3l-3 3"></path><path d="M13 15l3 0"></path><path d="M3 6a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2l0 -12"></path></svg>`, // i18n-ignore inline SVG icon markup
|
|
364
|
-
ghostty: `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="tabler-icon tabler-icon-ghost-3" aria-hidden="true"><path d="M5 11a7 7 0 0 1 14 0v7a1.78 1.78 0 0 1 -3.1 1.4a1.65 1.65 0 0 0 -2.6 0a1.65 1.65 0 0 1 -2.6 0a1.65 1.65 0 0 0 -2.6 0a1.78 1.78 0 0 1 -3.1 -1.4v-7"></path><path d="M10 10h.01"></path><path d="M14 10h.01"></path></svg>`, // i18n-ignore inline SVG icon markup
|
|
365
|
-
xcode: `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="tabler-icon tabler-icon-hammer" aria-hidden="true"><path d="M11.414 10l-7.383 7.418a2.091 2.091 0 0 0 0 2.967a2.11 2.11 0 0 0 2.976 0l7.407 -7.385"></path><path d="M18.121 15.293l2.586 -2.586a1 1 0 0 0 0 -1.414l-7.586 -7.586a1 1 0 0 0 -1.414 0l-2.586 2.586a1 1 0 0 0 0 1.414l7.586 7.586a1 1 0 0 0 1.414 0"></path></svg>`, // i18n-ignore inline SVG icon markup
|
|
366
|
-
};
|
|
367
|
-
|
|
368
386
|
function readPreferredEditor(): PreferredEditor {
|
|
369
387
|
if (typeof window === "undefined") return "vscode";
|
|
370
388
|
const stored = window.localStorage.getItem(PREFERRED_EDITOR_STORAGE_KEY);
|
|
@@ -382,63 +400,11 @@ function readDesktopPlanAutoSync(planId: string | undefined): boolean {
|
|
|
382
400
|
return window.localStorage.getItem(desktopPlanAutoSyncKey(planId)) === "1";
|
|
383
401
|
}
|
|
384
402
|
|
|
385
|
-
type PlanAnnotationAnchor = PlanCommentAnchor & { x: number; y: number };
|
|
386
|
-
|
|
387
|
-
export type CommentDraft = {
|
|
388
|
-
message: string;
|
|
389
|
-
mentions: PlanCommentMention[];
|
|
390
|
-
resolutionTarget: PlanCommentResolutionTarget;
|
|
391
|
-
};
|
|
392
|
-
|
|
393
403
|
type OrgMemberSuggestion = {
|
|
394
404
|
email: string;
|
|
395
405
|
role?: string;
|
|
396
406
|
};
|
|
397
407
|
|
|
398
|
-
type RuntimeAnnotation = {
|
|
399
|
-
id: string;
|
|
400
|
-
index: number;
|
|
401
|
-
message: string;
|
|
402
|
-
kind: string;
|
|
403
|
-
status: string;
|
|
404
|
-
createdBy: string;
|
|
405
|
-
parentCommentId?: string | null;
|
|
406
|
-
authorEmail?: string | null;
|
|
407
|
-
authorName?: string | null;
|
|
408
|
-
authorAvatarUrl?: string | null;
|
|
409
|
-
authorColor?: string | null;
|
|
410
|
-
authorInitials?: string | null;
|
|
411
|
-
sectionId?: string | null;
|
|
412
|
-
createdAt?: string;
|
|
413
|
-
anchor: PlanAnnotationAnchor;
|
|
414
|
-
replies: RuntimeAnnotationComment[];
|
|
415
|
-
participants: RuntimeAnnotationParticipant[];
|
|
416
|
-
commentCount: number;
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
type RuntimeAnnotationComment = {
|
|
420
|
-
id: string;
|
|
421
|
-
message: string;
|
|
422
|
-
status: string;
|
|
423
|
-
createdBy: string;
|
|
424
|
-
parentCommentId?: string | null;
|
|
425
|
-
authorEmail?: string | null;
|
|
426
|
-
authorName?: string | null;
|
|
427
|
-
authorAvatarUrl?: string | null;
|
|
428
|
-
authorColor?: string | null;
|
|
429
|
-
authorInitials?: string | null;
|
|
430
|
-
createdAt?: string;
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
type RuntimeAnnotationParticipant = {
|
|
434
|
-
id: string;
|
|
435
|
-
authorEmail?: string | null;
|
|
436
|
-
authorName?: string | null;
|
|
437
|
-
authorAvatarUrl?: string | null;
|
|
438
|
-
authorColor?: string | null;
|
|
439
|
-
authorInitials?: string | null;
|
|
440
|
-
};
|
|
441
|
-
|
|
442
408
|
type InlineCommentPosition = {
|
|
443
409
|
left: number;
|
|
444
410
|
top: number;
|
|
@@ -463,6 +429,17 @@ type PlanDocumentState = {
|
|
|
463
429
|
clientHeight: number;
|
|
464
430
|
};
|
|
465
431
|
|
|
432
|
+
export function resetPlanReaderScrollPosition(reader: HTMLElement | null) {
|
|
433
|
+
if (reader) {
|
|
434
|
+
reader.scrollTo({ left: 0, top: 0, behavior: "auto" });
|
|
435
|
+
reader.scrollLeft = 0;
|
|
436
|
+
reader.scrollTop = 0;
|
|
437
|
+
}
|
|
438
|
+
if (typeof window !== "undefined") {
|
|
439
|
+
window.scrollTo(0, 0);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
466
443
|
function shortDate(value: string) {
|
|
467
444
|
return new Intl.DateTimeFormat(undefined, {
|
|
468
445
|
month: "short",
|
|
@@ -501,432 +478,6 @@ type CurrentCommentAuthor = {
|
|
|
501
478
|
color: string;
|
|
502
479
|
};
|
|
503
480
|
|
|
504
|
-
type LocalPlanBundle = PlanBundle & {
|
|
505
|
-
localOnly: true;
|
|
506
|
-
slug: string;
|
|
507
|
-
folder: string;
|
|
508
|
-
repoPath?: string | null;
|
|
509
|
-
suggestedRepoPath?: string;
|
|
510
|
-
path?: string;
|
|
511
|
-
url?: string;
|
|
512
|
-
html?: string;
|
|
513
|
-
mdx?: PlanMdxFolder;
|
|
514
|
-
};
|
|
515
|
-
type PlanBundleWithHtml = (PlanBundle & { html?: string }) | LocalPlanBundle;
|
|
516
|
-
type PlanCommentItem = PlanBundle["comments"][number];
|
|
517
|
-
|
|
518
|
-
type LocalPlanBridgePayload = {
|
|
519
|
-
ok?: boolean;
|
|
520
|
-
version?: number;
|
|
521
|
-
source?: string;
|
|
522
|
-
localOnly?: boolean;
|
|
523
|
-
slug?: string;
|
|
524
|
-
dir?: string;
|
|
525
|
-
title?: string;
|
|
526
|
-
brief?: string;
|
|
527
|
-
kind?: PlanKind;
|
|
528
|
-
updatedAt?: string;
|
|
529
|
-
files?: string[];
|
|
530
|
-
mdx?: PlanMdxFolder;
|
|
531
|
-
comments?: PlanCommentItem[];
|
|
532
|
-
error?: string;
|
|
533
|
-
};
|
|
534
|
-
|
|
535
|
-
type LocalPlanBridgeCommentUpdate = {
|
|
536
|
-
comments?: PlanCommentInput[];
|
|
537
|
-
deletedCommentIds?: string[];
|
|
538
|
-
};
|
|
539
|
-
|
|
540
|
-
function assertLocalBridgeUrl(value: string): string {
|
|
541
|
-
let url: URL;
|
|
542
|
-
try {
|
|
543
|
-
url = new URL(value);
|
|
544
|
-
} catch {
|
|
545
|
-
throw new Error("Local plan bridge URL is invalid.");
|
|
546
|
-
}
|
|
547
|
-
const allowedHosts = new Set(["127.0.0.1", "localhost", "::1", "[::1]"]);
|
|
548
|
-
if (url.protocol !== "http:") {
|
|
549
|
-
throw new Error("Local plan bridge must use HTTP on localhost.");
|
|
550
|
-
}
|
|
551
|
-
if (!allowedHosts.has(url.hostname)) {
|
|
552
|
-
throw new Error("Local plan bridge must point to localhost.");
|
|
553
|
-
}
|
|
554
|
-
if (!url.port) {
|
|
555
|
-
throw new Error("Local plan bridge must use an explicit localhost port.");
|
|
556
|
-
}
|
|
557
|
-
if (url.username || url.password || url.hash) {
|
|
558
|
-
throw new Error("Local plan bridge URL contains unsupported credentials.");
|
|
559
|
-
}
|
|
560
|
-
if (url.pathname !== "/local-plan.json") {
|
|
561
|
-
throw new Error("Local plan bridge must point to /local-plan.json.");
|
|
562
|
-
}
|
|
563
|
-
const params = Array.from(url.searchParams.keys());
|
|
564
|
-
if (
|
|
565
|
-
params.length !== 1 ||
|
|
566
|
-
params[0] !== "token" ||
|
|
567
|
-
!url.searchParams.get("token")?.trim()
|
|
568
|
-
) {
|
|
569
|
-
throw new Error("Local plan bridge URL is missing its access token.");
|
|
570
|
-
}
|
|
571
|
-
return url.toString();
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
function localPlanBridgeCommentsUrl(value: string): string {
|
|
575
|
-
const url = new URL(assertLocalBridgeUrl(value));
|
|
576
|
-
url.pathname = "/local-plan-comments.json";
|
|
577
|
-
return url.toString();
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
const LOCAL_PLAN_BRIDGE_MAX_RETRIES = 5;
|
|
581
|
-
|
|
582
|
-
export function shouldRetryLocalPlanBridgeBundle(
|
|
583
|
-
failureCount: number,
|
|
584
|
-
error: unknown,
|
|
585
|
-
) {
|
|
586
|
-
const message = error instanceof Error ? error.message : String(error ?? "");
|
|
587
|
-
if (
|
|
588
|
-
message.includes("Local plan bridge URL") ||
|
|
589
|
-
message.includes("Local plan bridge must") ||
|
|
590
|
-
message.includes("Local plan bridge response was not")
|
|
591
|
-
) {
|
|
592
|
-
return false;
|
|
593
|
-
}
|
|
594
|
-
return failureCount < LOCAL_PLAN_BRIDGE_MAX_RETRIES;
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
export function localPlanBridgeRetryDelay(attemptIndex: number) {
|
|
598
|
-
return Math.min(500 * 2 ** attemptIndex, 2_500);
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
/**
|
|
602
|
-
* Decide whether the hosted-plan render should surface the retryable load
|
|
603
|
-
* error card instead of the initial skeleton.
|
|
604
|
-
*
|
|
605
|
-
* A React Query read can be *paused* (browser offline, or the tab blurred
|
|
606
|
-
* during a retry backoff): in that state it never errors and never resolves,
|
|
607
|
-
* so `isError`/`isLoading`/`isFetching` are all false and `data` stays
|
|
608
|
-
* undefined. Without treating that as an error-like state the page sits on the
|
|
609
|
-
* initial skeleton forever until a manual refresh — exactly the "wasn't
|
|
610
|
-
* loading the content until I do another refresh" report. Surfacing the
|
|
611
|
-
* retry card lets the user recover; React Query also auto-resumes the paused
|
|
612
|
-
* fetch when the network/tab returns, which clears the card on its own.
|
|
613
|
-
*/
|
|
614
|
-
export function shouldShowPlanLoadError(input: {
|
|
615
|
-
hasSelectedId: boolean;
|
|
616
|
-
localPlanMode: boolean;
|
|
617
|
-
hasBundle: boolean;
|
|
618
|
-
planQueryInitialPending: boolean;
|
|
619
|
-
planQueryError: boolean;
|
|
620
|
-
planQueryPaused: boolean;
|
|
621
|
-
accessStatusInitialPending: boolean;
|
|
622
|
-
accessStatusPaused: boolean;
|
|
623
|
-
accessDenied: boolean;
|
|
624
|
-
}): boolean {
|
|
625
|
-
if (!input.hasSelectedId || input.localPlanMode || input.hasBundle) {
|
|
626
|
-
return false;
|
|
627
|
-
}
|
|
628
|
-
if (input.planQueryError) return true;
|
|
629
|
-
if (!input.accessStatusInitialPending && input.accessDenied) return true;
|
|
630
|
-
// While the first read is actively in flight, keep showing the skeleton.
|
|
631
|
-
// Background refetches must not hide a settled access/error card.
|
|
632
|
-
if (input.planQueryInitialPending || input.accessStatusInitialPending) {
|
|
633
|
-
return false;
|
|
634
|
-
}
|
|
635
|
-
// Paused/stalled read that will never settle on its own input.
|
|
636
|
-
if (input.planQueryPaused || input.accessStatusPaused) return true;
|
|
637
|
-
return false;
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
export type PlanOrgAccessPrompt =
|
|
641
|
-
| {
|
|
642
|
-
kind: "invitation";
|
|
643
|
-
organizationId: string;
|
|
644
|
-
organizationName: string;
|
|
645
|
-
invitationId: string;
|
|
646
|
-
invitedBy: string;
|
|
647
|
-
buttonLabel: string;
|
|
648
|
-
message: string;
|
|
649
|
-
}
|
|
650
|
-
| {
|
|
651
|
-
kind: "domain";
|
|
652
|
-
organizationId: string;
|
|
653
|
-
organizationName: string;
|
|
654
|
-
domain: string | null;
|
|
655
|
-
buttonLabel: string;
|
|
656
|
-
message: string;
|
|
657
|
-
};
|
|
658
|
-
|
|
659
|
-
export function resolvePlanOrgAccessPrompt(input: {
|
|
660
|
-
accessStatus?: PlanAccessStatusResponse | null;
|
|
661
|
-
org?: Pick<OrgInfo, "email" | "pendingInvitations" | "domainMatches"> | null;
|
|
662
|
-
}): PlanOrgAccessPrompt | null {
|
|
663
|
-
const orgId = input.accessStatus?.orgId;
|
|
664
|
-
const orgName = input.accessStatus?.orgName?.trim();
|
|
665
|
-
if (
|
|
666
|
-
!orgId ||
|
|
667
|
-
!orgName ||
|
|
668
|
-
input.accessStatus?.visibility !== "org" ||
|
|
669
|
-
input.accessStatus.hasAccess
|
|
670
|
-
) {
|
|
671
|
-
return null;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
const pendingInvitation = input.org?.pendingInvitations?.find(
|
|
675
|
-
(inv: OrgInvitationSummary) => inv.orgId === orgId,
|
|
676
|
-
);
|
|
677
|
-
if (pendingInvitation) {
|
|
678
|
-
return {
|
|
679
|
-
kind: "invitation",
|
|
680
|
-
organizationId: orgId,
|
|
681
|
-
organizationName: orgName,
|
|
682
|
-
invitationId: pendingInvitation.id,
|
|
683
|
-
invitedBy: pendingInvitation.invitedBy,
|
|
684
|
-
buttonLabel: "",
|
|
685
|
-
message: "",
|
|
686
|
-
};
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
const domainMatch = input.org?.domainMatches?.find(
|
|
690
|
-
(match: DomainMatchOrg) => match.orgId === orgId,
|
|
691
|
-
);
|
|
692
|
-
if (domainMatch) {
|
|
693
|
-
const domain = input.org?.email?.split("@")[1]?.toLowerCase() || null;
|
|
694
|
-
return {
|
|
695
|
-
kind: "domain",
|
|
696
|
-
organizationId: orgId,
|
|
697
|
-
organizationName: orgName,
|
|
698
|
-
domain,
|
|
699
|
-
buttonLabel: "",
|
|
700
|
-
message: "",
|
|
701
|
-
};
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
return null;
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
function localPlanRoutePath(slug: string, repoPath?: string | null): string {
|
|
708
|
-
const base = appPath(`/local-plans/${encodeURIComponent(slug)}`);
|
|
709
|
-
if (!repoPath) return base;
|
|
710
|
-
const params = new URLSearchParams({ path: repoPath });
|
|
711
|
-
return `${base}?${params.toString()}`;
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
function localPlanRouteUrl(slug: string, repoPath?: string | null): string {
|
|
715
|
-
const path = localPlanRoutePath(slug, repoPath);
|
|
716
|
-
return typeof window === "undefined"
|
|
717
|
-
? path
|
|
718
|
-
: `${window.location.origin}${path}`;
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
function localPlanAssetDataUrl(
|
|
722
|
-
url: string | undefined,
|
|
723
|
-
assets: Record<string, string> | undefined,
|
|
724
|
-
): string | undefined {
|
|
725
|
-
if (!url || !assets) return url;
|
|
726
|
-
const match = url.match(/^(?:\.\/)?assets\/(.+)$/);
|
|
727
|
-
const filename = match?.[1];
|
|
728
|
-
if (!filename) return url;
|
|
729
|
-
const base64 = assets[filename];
|
|
730
|
-
if (!base64) return url;
|
|
731
|
-
const mime = mimeTypeFromFilename(filename);
|
|
732
|
-
if (!mime) return url;
|
|
733
|
-
return `data:${mime};base64,${base64}`;
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
function inlineLocalPlanAssets(
|
|
737
|
-
content: PlanContent,
|
|
738
|
-
assets: Record<string, string> | undefined,
|
|
739
|
-
): PlanContent {
|
|
740
|
-
if (!assets || Object.keys(assets).length === 0) return content;
|
|
741
|
-
const rewriteBlocks = (blocks: PlanBlock[]): PlanBlock[] =>
|
|
742
|
-
blocks.map((block): PlanBlock => {
|
|
743
|
-
if (block.type === "image") {
|
|
744
|
-
return {
|
|
745
|
-
...block,
|
|
746
|
-
data: {
|
|
747
|
-
...block.data,
|
|
748
|
-
url: localPlanAssetDataUrl(block.data.url, assets),
|
|
749
|
-
assetId: undefined,
|
|
750
|
-
},
|
|
751
|
-
};
|
|
752
|
-
}
|
|
753
|
-
if (block.type === "tabs") {
|
|
754
|
-
return {
|
|
755
|
-
...block,
|
|
756
|
-
data: {
|
|
757
|
-
...block.data,
|
|
758
|
-
tabs: block.data.tabs.map((tab) => ({
|
|
759
|
-
...tab,
|
|
760
|
-
blocks: rewriteBlocks(tab.blocks),
|
|
761
|
-
})),
|
|
762
|
-
},
|
|
763
|
-
};
|
|
764
|
-
}
|
|
765
|
-
if (block.type === "columns") {
|
|
766
|
-
return {
|
|
767
|
-
...block,
|
|
768
|
-
data: {
|
|
769
|
-
...block.data,
|
|
770
|
-
columns: block.data.columns.map((column) => ({
|
|
771
|
-
...column,
|
|
772
|
-
blocks: rewriteBlocks(column.blocks),
|
|
773
|
-
})),
|
|
774
|
-
},
|
|
775
|
-
};
|
|
776
|
-
}
|
|
777
|
-
return block;
|
|
778
|
-
});
|
|
779
|
-
return { ...content, blocks: rewriteBlocks(content.blocks) };
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
function countLocalPlanBlocks(blocks: PlanBlock[]): Record<string, number> {
|
|
783
|
-
const counts: Record<string, number> = {};
|
|
784
|
-
const visitBlocks = (items: PlanBlock[]) => {
|
|
785
|
-
for (const block of items) {
|
|
786
|
-
counts[block.type] = (counts[block.type] ?? 0) + 1;
|
|
787
|
-
if (block.type === "tabs") {
|
|
788
|
-
for (const tab of block.data.tabs) visitBlocks(tab.blocks);
|
|
789
|
-
} else if (block.type === "columns") {
|
|
790
|
-
for (const column of block.data.columns) visitBlocks(column.blocks);
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
};
|
|
794
|
-
visitBlocks(blocks);
|
|
795
|
-
return counts;
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
function localPlanBridgeQueryKey(slug: string, bridgeUrl: string) {
|
|
799
|
-
return ["local-plan-bridge", slug, bridgeUrl] as const;
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
// Merge folder comments.json onto a read-only bridge bundle (which serves none);
|
|
803
|
-
// the bundle's own comments win so optimistic/just-written ones aren't clobbered.
|
|
804
|
-
function mergeLocalBridgeComments(
|
|
805
|
-
bundle: LocalPlanBundle | undefined,
|
|
806
|
-
folderComments: LocalPlanBundle["comments"] | undefined,
|
|
807
|
-
): LocalPlanBundle | undefined {
|
|
808
|
-
if (!bundle) return bundle;
|
|
809
|
-
const comments =
|
|
810
|
-
bundle.comments.length > 0 ? bundle.comments : (folderComments ?? []);
|
|
811
|
-
if (comments === bundle.comments) return bundle;
|
|
812
|
-
return {
|
|
813
|
-
...bundle,
|
|
814
|
-
comments,
|
|
815
|
-
summary: {
|
|
816
|
-
...bundle.summary,
|
|
817
|
-
commentCount: comments.length,
|
|
818
|
-
openCommentCount: comments.filter((c) => c.status === "open").length,
|
|
819
|
-
},
|
|
820
|
-
};
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
async function localPlanBridgePayloadToBundle(
|
|
824
|
-
payload: LocalPlanBridgePayload,
|
|
825
|
-
fallbackSlug: string,
|
|
826
|
-
): Promise<LocalPlanBundle> {
|
|
827
|
-
if (
|
|
828
|
-
payload.source !== "agent-native-local-bridge" ||
|
|
829
|
-
!payload.mdx?.["plan.mdx"]
|
|
830
|
-
) {
|
|
831
|
-
throw new Error("Local plan bridge response was not a Plan MDX folder.");
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
const rawContent = await parsePlanMdxFolder(payload.mdx, {
|
|
835
|
-
salvageInvalidBlocks: payload.kind === "recap",
|
|
836
|
-
});
|
|
837
|
-
const content = inlineLocalPlanAssets(rawContent, payload.mdx["assets/"]);
|
|
838
|
-
const now = payload.updatedAt || new Date().toISOString();
|
|
839
|
-
const slug = payload.slug || fallbackSlug || "local-plan";
|
|
840
|
-
const kind = payload.kind === "recap" ? "recap" : "plan";
|
|
841
|
-
const title = content.title || payload.title || slug;
|
|
842
|
-
const brief = content.brief || payload.brief || "";
|
|
843
|
-
const url = localPlanRouteUrl(slug);
|
|
844
|
-
const comments = (payload.comments ?? []).filter(
|
|
845
|
-
(comment) => !comment.deletedAt,
|
|
846
|
-
);
|
|
847
|
-
const bundle: LocalPlanBundle = {
|
|
848
|
-
plan: {
|
|
849
|
-
id: `local-${slug}`,
|
|
850
|
-
title,
|
|
851
|
-
brief,
|
|
852
|
-
kind,
|
|
853
|
-
status: "review",
|
|
854
|
-
source: "imported",
|
|
855
|
-
repoPath: payload.dir ?? null,
|
|
856
|
-
currentFocus: "local-files preview",
|
|
857
|
-
html: null,
|
|
858
|
-
markdown: payload.mdx["plan.mdx"],
|
|
859
|
-
content,
|
|
860
|
-
createdAt: now,
|
|
861
|
-
updatedAt: now,
|
|
862
|
-
approvedAt: null,
|
|
863
|
-
},
|
|
864
|
-
access: {
|
|
865
|
-
role: "viewer",
|
|
866
|
-
ownerEmail: null,
|
|
867
|
-
orgId: null,
|
|
868
|
-
visibility: "private",
|
|
869
|
-
},
|
|
870
|
-
sections: [],
|
|
871
|
-
comments,
|
|
872
|
-
events: [],
|
|
873
|
-
summary: {
|
|
874
|
-
sectionCounts: countLocalPlanBlocks(content.blocks),
|
|
875
|
-
commentCount: comments.length,
|
|
876
|
-
openCommentCount: comments.filter((comment) => comment.status === "open")
|
|
877
|
-
.length,
|
|
878
|
-
},
|
|
879
|
-
localOnly: true,
|
|
880
|
-
slug,
|
|
881
|
-
folder: payload.dir ?? slug,
|
|
882
|
-
path: `/local-plans/${encodeURIComponent(slug)}`,
|
|
883
|
-
url,
|
|
884
|
-
mdx: payload.mdx,
|
|
885
|
-
};
|
|
886
|
-
return bundle;
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
async function fetchLocalPlanBridgeBundle(
|
|
890
|
-
bridgeUrl: string,
|
|
891
|
-
fallbackSlug: string,
|
|
892
|
-
): Promise<LocalPlanBundle> {
|
|
893
|
-
const safeUrl = assertLocalBridgeUrl(bridgeUrl);
|
|
894
|
-
const response = await fetch(safeUrl, { cache: "no-store" });
|
|
895
|
-
const payload = (await response
|
|
896
|
-
.json()
|
|
897
|
-
.catch(() => null)) as LocalPlanBridgePayload | null;
|
|
898
|
-
if (!response.ok || !payload?.ok) {
|
|
899
|
-
throw new Error(
|
|
900
|
-
payload?.error ||
|
|
901
|
-
`Local plan bridge returned ${response.status || "an error"}.`,
|
|
902
|
-
);
|
|
903
|
-
}
|
|
904
|
-
return localPlanBridgePayloadToBundle(payload, fallbackSlug);
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
async function updateLocalPlanBridgeComments(
|
|
908
|
-
bridgeUrl: string,
|
|
909
|
-
fallbackSlug: string,
|
|
910
|
-
update: LocalPlanBridgeCommentUpdate,
|
|
911
|
-
): Promise<LocalPlanBundle> {
|
|
912
|
-
const response = await fetch(localPlanBridgeCommentsUrl(bridgeUrl), {
|
|
913
|
-
method: "POST",
|
|
914
|
-
cache: "no-store",
|
|
915
|
-
headers: { "content-type": "application/json" },
|
|
916
|
-
body: JSON.stringify(update),
|
|
917
|
-
});
|
|
918
|
-
const payload = (await response
|
|
919
|
-
.json()
|
|
920
|
-
.catch(() => null)) as LocalPlanBridgePayload | null;
|
|
921
|
-
if (!response.ok || !payload?.ok) {
|
|
922
|
-
throw new Error(
|
|
923
|
-
payload?.error ||
|
|
924
|
-
`Local plan bridge returned ${response.status || "an error"}.`,
|
|
925
|
-
);
|
|
926
|
-
}
|
|
927
|
-
return localPlanBridgePayloadToBundle(payload, fallbackSlug);
|
|
928
|
-
}
|
|
929
|
-
|
|
930
481
|
type CommentThread = {
|
|
931
482
|
id: string;
|
|
932
483
|
root: PlanCommentItem;
|
|
@@ -1297,10 +848,6 @@ function useOrgMemberMentionSearch(query: string | null) {
|
|
|
1297
848
|
return { members, isLoading };
|
|
1298
849
|
}
|
|
1299
850
|
|
|
1300
|
-
function displayNameForMention(email: string) {
|
|
1301
|
-
return emailToName(email).replace(/\s+/g, " ").trim() || email;
|
|
1302
|
-
}
|
|
1303
|
-
|
|
1304
851
|
function elementForShortcutTarget(target: EventTarget | null) {
|
|
1305
852
|
if (target instanceof Element) return target;
|
|
1306
853
|
if (target instanceof Node) return target.parentElement;
|
|
@@ -1877,652 +1424,6 @@ function downloadBlob(filename: string, blob: Blob) {
|
|
|
1877
1424
|
URL.revokeObjectURL(url);
|
|
1878
1425
|
}
|
|
1879
1426
|
|
|
1880
|
-
function clamp(value: number, min: number, max: number) {
|
|
1881
|
-
return Math.max(min, Math.min(max, value));
|
|
1882
|
-
}
|
|
1883
|
-
|
|
1884
|
-
function percent(value: number, total: number) {
|
|
1885
|
-
return clamp((value / Math.max(total, 1)) * 100, 0, 100);
|
|
1886
|
-
}
|
|
1887
|
-
|
|
1888
|
-
const PLAN_TEXT_TARGET_SELECTOR = [
|
|
1889
|
-
"p",
|
|
1890
|
-
"li",
|
|
1891
|
-
"h1",
|
|
1892
|
-
"h2",
|
|
1893
|
-
"h3",
|
|
1894
|
-
"h4",
|
|
1895
|
-
"td",
|
|
1896
|
-
"th",
|
|
1897
|
-
"blockquote",
|
|
1898
|
-
"figcaption",
|
|
1899
|
-
"summary",
|
|
1900
|
-
"button",
|
|
1901
|
-
"a",
|
|
1902
|
-
"label",
|
|
1903
|
-
"pre",
|
|
1904
|
-
"code",
|
|
1905
|
-
"[data-plan-text]",
|
|
1906
|
-
].join(",");
|
|
1907
|
-
|
|
1908
|
-
const PLAN_VISUAL_TARGET_SELECTOR = [
|
|
1909
|
-
"img",
|
|
1910
|
-
"svg",
|
|
1911
|
-
"canvas",
|
|
1912
|
-
"video",
|
|
1913
|
-
"iframe",
|
|
1914
|
-
"table",
|
|
1915
|
-
"pre",
|
|
1916
|
-
"code",
|
|
1917
|
-
"[data-plan-canvas-world]",
|
|
1918
|
-
".plan-canvas-world",
|
|
1919
|
-
"[data-plan-prototype-viewer]",
|
|
1920
|
-
"[data-prototype-screen]",
|
|
1921
|
-
"[data-canvas-frame]",
|
|
1922
|
-
".plan-artboard-frame",
|
|
1923
|
-
".plan-block",
|
|
1924
|
-
].join(",");
|
|
1925
|
-
|
|
1926
|
-
function normalizedElementText(value: string | null | undefined) {
|
|
1927
|
-
return value?.replace(/\s+/g, " ").trim() ?? "";
|
|
1928
|
-
}
|
|
1929
|
-
|
|
1930
|
-
function textSnippetFromElement(element: Element | null, max = 220) {
|
|
1931
|
-
if (!element) return "";
|
|
1932
|
-
return normalizedElementText(element.textContent).slice(0, max);
|
|
1933
|
-
}
|
|
1934
|
-
|
|
1935
|
-
function textQuoteContextForBlock(input: {
|
|
1936
|
-
block: Element | null;
|
|
1937
|
-
quote: string;
|
|
1938
|
-
radius?: number;
|
|
1939
|
-
}) {
|
|
1940
|
-
const quote = normalizedElementText(input.quote);
|
|
1941
|
-
const blockText = normalizedElementText(input.block?.textContent);
|
|
1942
|
-
if (!quote || !blockText) return {};
|
|
1943
|
-
const index = blockText.indexOf(quote);
|
|
1944
|
-
if (index < 0) return {};
|
|
1945
|
-
const radius = input.radius ?? 60;
|
|
1946
|
-
const contextBefore = blockText.slice(Math.max(0, index - radius), index);
|
|
1947
|
-
const contextAfter = blockText.slice(
|
|
1948
|
-
index + quote.length,
|
|
1949
|
-
index + quote.length + radius,
|
|
1950
|
-
);
|
|
1951
|
-
const secondIndex = blockText.indexOf(quote, index + quote.length);
|
|
1952
|
-
return {
|
|
1953
|
-
contextBefore: contextBefore || undefined,
|
|
1954
|
-
contextAfter: contextAfter || undefined,
|
|
1955
|
-
ambiguous: secondIndex >= 0 || undefined,
|
|
1956
|
-
};
|
|
1957
|
-
}
|
|
1958
|
-
|
|
1959
|
-
function textNeedleForAnchor(anchor: PlanAnnotationAnchor) {
|
|
1960
|
-
const source =
|
|
1961
|
-
anchor.textQuote ??
|
|
1962
|
-
(anchor.anchorKind === "text" || anchor.targetKind === "text"
|
|
1963
|
-
? anchor.snippet
|
|
1964
|
-
: undefined);
|
|
1965
|
-
return normalizedElementText(source).slice(0, 120);
|
|
1966
|
-
}
|
|
1967
|
-
|
|
1968
|
-
function findTextAnchorTarget(scope: Element, needle: string) {
|
|
1969
|
-
if (!needle) return null;
|
|
1970
|
-
const candidates = [
|
|
1971
|
-
...(scope.matches(PLAN_TEXT_TARGET_SELECTOR) ? [scope] : []),
|
|
1972
|
-
...Array.from(
|
|
1973
|
-
scope.querySelectorAll<HTMLElement>(PLAN_TEXT_TARGET_SELECTOR),
|
|
1974
|
-
),
|
|
1975
|
-
];
|
|
1976
|
-
return (
|
|
1977
|
-
candidates.find((candidate) =>
|
|
1978
|
-
normalizedElementText(candidate.textContent).includes(needle),
|
|
1979
|
-
) ?? null
|
|
1980
|
-
);
|
|
1981
|
-
}
|
|
1982
|
-
|
|
1983
|
-
function findPlanBlockById(blocks: PlanBlock[], id: string): PlanBlock | null {
|
|
1984
|
-
for (const block of blocks) {
|
|
1985
|
-
if (block.id === id) return block;
|
|
1986
|
-
if (block.type !== "tabs") continue;
|
|
1987
|
-
for (const tab of block.data.tabs) {
|
|
1988
|
-
const match = findPlanBlockById(tab.blocks, id);
|
|
1989
|
-
if (match) return match;
|
|
1990
|
-
}
|
|
1991
|
-
}
|
|
1992
|
-
return null;
|
|
1993
|
-
}
|
|
1994
|
-
|
|
1995
|
-
function cssAttr(value: string) {
|
|
1996
|
-
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
1997
|
-
}
|
|
1998
|
-
|
|
1999
|
-
function elementIndexAmongType(element: Element) {
|
|
2000
|
-
const parent = element.parentElement;
|
|
2001
|
-
if (!parent) return 1;
|
|
2002
|
-
const tag = element.tagName;
|
|
2003
|
-
return (
|
|
2004
|
-
Array.from(parent.children)
|
|
2005
|
-
.filter((child) => child.tagName === tag)
|
|
2006
|
-
.indexOf(element) + 1
|
|
2007
|
-
);
|
|
2008
|
-
}
|
|
2009
|
-
|
|
2010
|
-
function childPathSelectorWithin(scope: Element, element: Element) {
|
|
2011
|
-
if (scope === element) return "";
|
|
2012
|
-
if (!scope.contains(element)) return undefined;
|
|
2013
|
-
const parts: string[] = [];
|
|
2014
|
-
let current: Element | null = element;
|
|
2015
|
-
while (current && current !== scope) {
|
|
2016
|
-
const parent = current.parentElement;
|
|
2017
|
-
if (!parent) return undefined;
|
|
2018
|
-
const tag = current.tagName.toLowerCase();
|
|
2019
|
-
parts.unshift(`${tag}:nth-of-type(${elementIndexAmongType(current)})`);
|
|
2020
|
-
current = parent;
|
|
2021
|
-
}
|
|
2022
|
-
return current === scope ? parts.join(" > ") : undefined;
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
function dataSelector(name: string, value: string) {
|
|
2026
|
-
return `[${name}="${cssAttr(value)}"]`;
|
|
2027
|
-
}
|
|
2028
|
-
|
|
2029
|
-
function scopedSelector(scope: string | undefined, selector: string) {
|
|
2030
|
-
return scope ? `${scope} ${selector}` : selector;
|
|
2031
|
-
}
|
|
2032
|
-
|
|
2033
|
-
function selectorForElementInScope(
|
|
2034
|
-
scopeElement: Element,
|
|
2035
|
-
scopeSelector: string,
|
|
2036
|
-
element: Element,
|
|
2037
|
-
) {
|
|
2038
|
-
const path = childPathSelectorWithin(scopeElement, element);
|
|
2039
|
-
if (path === undefined) return undefined;
|
|
2040
|
-
return path ? `${scopeSelector} > ${path}` : scopeSelector;
|
|
2041
|
-
}
|
|
2042
|
-
|
|
2043
|
-
function stableDataSelectorForElement(
|
|
2044
|
-
element: Element,
|
|
2045
|
-
scope?: string,
|
|
2046
|
-
): string | undefined {
|
|
2047
|
-
const wireNode = element.closest<HTMLElement>("[data-wire-node-id]");
|
|
2048
|
-
if (wireNode?.dataset.wireNodeId) {
|
|
2049
|
-
return scopedSelector(
|
|
2050
|
-
scope,
|
|
2051
|
-
dataSelector("data-wire-node-id", wireNode.dataset.wireNodeId),
|
|
2052
|
-
);
|
|
2053
|
-
}
|
|
2054
|
-
const designNode = element.closest<HTMLElement>("[data-design-id]");
|
|
2055
|
-
if (designNode?.dataset.designId) {
|
|
2056
|
-
return scopedSelector(
|
|
2057
|
-
scope,
|
|
2058
|
-
dataSelector("data-design-id", designNode.dataset.designId),
|
|
2059
|
-
);
|
|
2060
|
-
}
|
|
2061
|
-
const planDesignNode = element.closest<HTMLElement>("[data-plan-design-id]");
|
|
2062
|
-
if (planDesignNode?.dataset.planDesignId) {
|
|
2063
|
-
return scopedSelector(
|
|
2064
|
-
scope,
|
|
2065
|
-
dataSelector("data-plan-design-id", planDesignNode.dataset.planDesignId),
|
|
2066
|
-
);
|
|
2067
|
-
}
|
|
2068
|
-
return undefined;
|
|
2069
|
-
}
|
|
2070
|
-
|
|
2071
|
-
export function selectorForElementWithin(
|
|
2072
|
-
root: HTMLElement,
|
|
2073
|
-
element: Element | null,
|
|
2074
|
-
) {
|
|
2075
|
-
if (!element || !root.contains(element)) return undefined;
|
|
2076
|
-
const prototype = element.closest<HTMLElement>("[data-prototype-screen]");
|
|
2077
|
-
const prototypeScope = prototype?.dataset.prototypeScreen
|
|
2078
|
-
? dataSelector("data-prototype-screen", prototype.dataset.prototypeScreen)
|
|
2079
|
-
: undefined;
|
|
2080
|
-
const prototypeStableSelector = prototypeScope
|
|
2081
|
-
? stableDataSelectorForElement(element, prototypeScope)
|
|
2082
|
-
: undefined;
|
|
2083
|
-
if (prototypeStableSelector) return prototypeStableSelector;
|
|
2084
|
-
if (prototype && prototypeScope) {
|
|
2085
|
-
return selectorForElementInScope(prototype, prototypeScope, element);
|
|
2086
|
-
}
|
|
2087
|
-
const frame = element.closest<HTMLElement>("[data-canvas-frame]");
|
|
2088
|
-
const frameScope = frame?.dataset.canvasFrame
|
|
2089
|
-
? dataSelector("data-canvas-frame", frame.dataset.canvasFrame)
|
|
2090
|
-
: undefined;
|
|
2091
|
-
const frameStableSelector = frameScope
|
|
2092
|
-
? stableDataSelectorForElement(element, frameScope)
|
|
2093
|
-
: undefined;
|
|
2094
|
-
if (frameStableSelector) return frameStableSelector;
|
|
2095
|
-
if (frame && frameScope) {
|
|
2096
|
-
return selectorForElementInScope(frame, frameScope, element);
|
|
2097
|
-
}
|
|
2098
|
-
const canvasWorld = element.closest<HTMLElement>(
|
|
2099
|
-
"[data-plan-canvas-world], .plan-canvas-world",
|
|
2100
|
-
);
|
|
2101
|
-
if (canvasWorld) {
|
|
2102
|
-
return canvasWorld.hasAttribute("data-plan-canvas-world")
|
|
2103
|
-
? "[data-plan-canvas-world]"
|
|
2104
|
-
: ".plan-canvas-world";
|
|
2105
|
-
}
|
|
2106
|
-
const stableSelector = stableDataSelectorForElement(element);
|
|
2107
|
-
if (stableSelector) return stableSelector;
|
|
2108
|
-
const block = element.closest<HTMLElement>("[data-block-id]");
|
|
2109
|
-
if (block?.dataset.blockId) {
|
|
2110
|
-
return selectorForElementInScope(
|
|
2111
|
-
block,
|
|
2112
|
-
dataSelector("data-block-id", block.dataset.blockId),
|
|
2113
|
-
element,
|
|
2114
|
-
);
|
|
2115
|
-
}
|
|
2116
|
-
if (element.id) return `#${cssAttr(element.id)}`;
|
|
2117
|
-
return undefined;
|
|
2118
|
-
}
|
|
2119
|
-
|
|
2120
|
-
function prototypeScreenIdFromSelector(selector: string | undefined) {
|
|
2121
|
-
if (!selector) return undefined;
|
|
2122
|
-
const match = selector.match(/\[data-prototype-screen="([^"]+)"\]/);
|
|
2123
|
-
return match?.[1]?.replace(/\\"/g, '"').replace(/\\\\/g, "\\");
|
|
2124
|
-
}
|
|
2125
|
-
|
|
2126
|
-
export function prototypeScreenIdForAnchor(anchor: PlanAnnotationAnchor) {
|
|
2127
|
-
return (
|
|
2128
|
-
anchor.screenId ??
|
|
2129
|
-
prototypeScreenIdFromSelector(anchor.targetSelector) ??
|
|
2130
|
-
(anchor.targetKind === "prototype" ? anchor.sectionId : undefined)
|
|
2131
|
-
);
|
|
2132
|
-
}
|
|
2133
|
-
|
|
2134
|
-
function prototypeScopeForAnchor(
|
|
2135
|
-
anchor: PlanAnnotationAnchor,
|
|
2136
|
-
reader: HTMLElement,
|
|
2137
|
-
) {
|
|
2138
|
-
const screenId = prototypeScreenIdForAnchor(anchor);
|
|
2139
|
-
if (!screenId) return undefined;
|
|
2140
|
-
return (
|
|
2141
|
-
reader.querySelector<HTMLElement>(
|
|
2142
|
-
`[data-prototype-screen="${cssAttr(screenId)}"]`,
|
|
2143
|
-
) ?? null
|
|
2144
|
-
);
|
|
2145
|
-
}
|
|
2146
|
-
|
|
2147
|
-
function queryFirstElement(
|
|
2148
|
-
scopes: Array<Element | null | undefined>,
|
|
2149
|
-
selector: string,
|
|
2150
|
-
) {
|
|
2151
|
-
const seen = new Set<Element>();
|
|
2152
|
-
for (const scope of scopes) {
|
|
2153
|
-
if (!scope || seen.has(scope)) continue;
|
|
2154
|
-
seen.add(scope);
|
|
2155
|
-
const target = scope.matches(selector)
|
|
2156
|
-
? scope
|
|
2157
|
-
: scope.querySelector<HTMLElement>(selector);
|
|
2158
|
-
if (target) return target;
|
|
2159
|
-
}
|
|
2160
|
-
return null;
|
|
2161
|
-
}
|
|
2162
|
-
|
|
2163
|
-
function resolveStableVisualAnchorTarget(
|
|
2164
|
-
anchor: PlanAnnotationAnchor,
|
|
2165
|
-
reader: HTMLElement,
|
|
2166
|
-
queryRoot: Element,
|
|
2167
|
-
) {
|
|
2168
|
-
const frame = anchor.sectionId
|
|
2169
|
-
? reader.querySelector<HTMLElement>(
|
|
2170
|
-
dataSelector("data-canvas-frame", anchor.sectionId),
|
|
2171
|
-
)
|
|
2172
|
-
: null;
|
|
2173
|
-
if (anchor.targetNodeId) {
|
|
2174
|
-
const nodeSelectors = [
|
|
2175
|
-
dataSelector("data-wire-node-id", anchor.targetNodeId),
|
|
2176
|
-
dataSelector("data-design-id", anchor.targetNodeId),
|
|
2177
|
-
dataSelector("data-plan-design-id", anchor.targetNodeId),
|
|
2178
|
-
];
|
|
2179
|
-
for (const selector of nodeSelectors) {
|
|
2180
|
-
const target = queryFirstElement([frame, queryRoot, reader], selector);
|
|
2181
|
-
if (target) return target;
|
|
2182
|
-
}
|
|
2183
|
-
}
|
|
2184
|
-
return null;
|
|
2185
|
-
}
|
|
2186
|
-
|
|
2187
|
-
function sectionTitleForElement(element: Element | null, fallback?: string) {
|
|
2188
|
-
const block = element?.closest<HTMLElement>("[data-block-id]");
|
|
2189
|
-
const prototype = element?.closest<HTMLElement>("[data-prototype-screen]");
|
|
2190
|
-
const frame = element?.closest<HTMLElement>("[data-canvas-frame]");
|
|
2191
|
-
const title =
|
|
2192
|
-
prototype
|
|
2193
|
-
?.querySelector<HTMLElement>("h1,h2,h3,[data-plan-section-title]")
|
|
2194
|
-
?.textContent?.replace(/\s+/g, " ")
|
|
2195
|
-
.trim() ||
|
|
2196
|
-
block
|
|
2197
|
-
?.querySelector<HTMLElement>("h1,h2,h3,[data-plan-section-title]")
|
|
2198
|
-
?.textContent?.replace(/\s+/g, " ")
|
|
2199
|
-
.trim() ||
|
|
2200
|
-
frame
|
|
2201
|
-
?.querySelector<HTMLElement>(".plan-artboard-label")
|
|
2202
|
-
?.textContent?.replace(/\s+/g, " ")
|
|
2203
|
-
.trim() ||
|
|
2204
|
-
element
|
|
2205
|
-
?.closest<HTMLElement>(".plan-block,.plan-canvas")
|
|
2206
|
-
?.querySelector<HTMLElement>("h1,h2,h3,[data-plan-section-title]")
|
|
2207
|
-
?.textContent?.replace(/\s+/g, " ")
|
|
2208
|
-
.trim() ||
|
|
2209
|
-
fallback;
|
|
2210
|
-
return title || undefined;
|
|
2211
|
-
}
|
|
2212
|
-
|
|
2213
|
-
function targetKindForElement(
|
|
2214
|
-
element: Element | null,
|
|
2215
|
-
): PlanCommentAnchor["targetKind"] {
|
|
2216
|
-
if (!element) return undefined;
|
|
2217
|
-
const tag = element.tagName.toLowerCase();
|
|
2218
|
-
if (tag === "img") return "image";
|
|
2219
|
-
if (tag === "table") return "table";
|
|
2220
|
-
if (tag === "pre" || tag === "code") return "code";
|
|
2221
|
-
if (tag === "svg") return "diagram";
|
|
2222
|
-
if (element.closest("[data-plan-prototype-viewer]")) return "prototype";
|
|
2223
|
-
if (element.closest("[data-canvas-frame],.plan-artboard-frame")) {
|
|
2224
|
-
return "wireframe";
|
|
2225
|
-
}
|
|
2226
|
-
if (tag === "canvas" || element.closest(".plan-canvas")) return "canvas";
|
|
2227
|
-
if (element.matches("button,a,input,textarea,select,label")) return "control";
|
|
2228
|
-
if (element.closest("[data-block-id]")) return "block";
|
|
2229
|
-
return "unknown";
|
|
2230
|
-
}
|
|
2231
|
-
|
|
2232
|
-
export function buildNativeAnchorFromElement(input: {
|
|
2233
|
-
reader: HTMLElement;
|
|
2234
|
-
target: HTMLElement;
|
|
2235
|
-
pointX: number;
|
|
2236
|
-
pointY: number;
|
|
2237
|
-
planTitle?: string;
|
|
2238
|
-
}): PlanAnnotationAnchor {
|
|
2239
|
-
const { reader, target, pointX, pointY } = input;
|
|
2240
|
-
const scrollWidth = Math.max(reader.scrollWidth, 1);
|
|
2241
|
-
const scrollHeight = Math.max(reader.scrollHeight, 1);
|
|
2242
|
-
const base: PlanAnnotationAnchor = {
|
|
2243
|
-
x: percent(pointX + reader.scrollLeft, scrollWidth),
|
|
2244
|
-
y: percent(pointY + reader.scrollTop, scrollHeight),
|
|
2245
|
-
anchorKind: "point",
|
|
2246
|
-
visualLabel: input.planTitle,
|
|
2247
|
-
resolutionTarget: "agent",
|
|
2248
|
-
};
|
|
2249
|
-
|
|
2250
|
-
const textElement = target.closest<HTMLElement>(PLAN_TEXT_TARGET_SELECTOR);
|
|
2251
|
-
const visualElement = target.closest<HTMLElement>(
|
|
2252
|
-
PLAN_VISUAL_TARGET_SELECTOR,
|
|
2253
|
-
);
|
|
2254
|
-
const wireNodeEl = target.closest<HTMLElement>("[data-wire-node-id]");
|
|
2255
|
-
const designNodeEl = target.closest<HTMLElement>("[data-design-id]");
|
|
2256
|
-
const planDesignNodeEl = target.closest<HTMLElement>("[data-plan-design-id]");
|
|
2257
|
-
const stableVisualElement = wireNodeEl ?? designNodeEl ?? planDesignNodeEl;
|
|
2258
|
-
const anchorElement =
|
|
2259
|
-
stableVisualElement ??
|
|
2260
|
-
(textElement && textSnippetFromElement(textElement)
|
|
2261
|
-
? textElement
|
|
2262
|
-
: (visualElement ?? target));
|
|
2263
|
-
const rect = anchorElement.getBoundingClientRect();
|
|
2264
|
-
const readerRect = reader.getBoundingClientRect();
|
|
2265
|
-
const localX = pointX + readerRect.left;
|
|
2266
|
-
const localY = pointY + readerRect.top;
|
|
2267
|
-
const targetX = percent(
|
|
2268
|
-
clamp(localX, rect.left, rect.right) - rect.left,
|
|
2269
|
-
rect.width,
|
|
2270
|
-
);
|
|
2271
|
-
const targetY = percent(
|
|
2272
|
-
clamp(localY, rect.top, rect.bottom) - rect.top,
|
|
2273
|
-
rect.height,
|
|
2274
|
-
);
|
|
2275
|
-
const sectionTitle = sectionTitleForElement(anchorElement, input.planTitle);
|
|
2276
|
-
const prototype = anchorElement.closest<HTMLElement>(
|
|
2277
|
-
"[data-prototype-screen]",
|
|
2278
|
-
);
|
|
2279
|
-
const block = anchorElement.closest<HTMLElement>("[data-block-id]");
|
|
2280
|
-
const frame = anchorElement.closest<HTMLElement>("[data-canvas-frame]");
|
|
2281
|
-
const targetText = textSnippetFromElement(anchorElement);
|
|
2282
|
-
const targetKind = targetKindForElement(anchorElement);
|
|
2283
|
-
const image =
|
|
2284
|
-
anchorElement.tagName.toLowerCase() === "img"
|
|
2285
|
-
? (anchorElement as HTMLImageElement)
|
|
2286
|
-
: anchorElement.querySelector<HTMLImageElement>("img");
|
|
2287
|
-
const visualContext =
|
|
2288
|
-
prototype?.dataset.prototypeScreen && sectionTitle
|
|
2289
|
-
? `Inside prototype screen ${prototype.dataset.prototypeScreen} (${sectionTitle})`
|
|
2290
|
-
: prototype?.dataset.prototypeScreen
|
|
2291
|
-
? `Inside prototype screen ${prototype.dataset.prototypeScreen}`
|
|
2292
|
-
: frame?.dataset.canvasFrame && sectionTitle
|
|
2293
|
-
? `Inside canvas frame ${frame.dataset.canvasFrame} (${sectionTitle})`
|
|
2294
|
-
: frame?.dataset.canvasFrame
|
|
2295
|
-
? `Inside canvas frame ${frame.dataset.canvasFrame}`
|
|
2296
|
-
: undefined;
|
|
2297
|
-
|
|
2298
|
-
const targetNodeId =
|
|
2299
|
-
wireNodeEl?.dataset.wireNodeId ||
|
|
2300
|
-
designNodeEl?.dataset.designId ||
|
|
2301
|
-
planDesignNodeEl?.dataset.planDesignId ||
|
|
2302
|
-
undefined;
|
|
2303
|
-
|
|
2304
|
-
// Build a short human-readable node path from the frame root down to the
|
|
2305
|
-
// target node, e.g. `card > list > listItem "Acme Inc"`.
|
|
2306
|
-
let targetNodePath: string | undefined;
|
|
2307
|
-
if (wireNodeEl) {
|
|
2308
|
-
const frameRoot =
|
|
2309
|
-
anchorElement.closest<HTMLElement>("[data-canvas-frame]") ??
|
|
2310
|
-
anchorElement.closest<HTMLElement>(".plan-artboard-frame");
|
|
2311
|
-
if (frameRoot) {
|
|
2312
|
-
const pathEls: HTMLElement[] = [];
|
|
2313
|
-
let current: HTMLElement | null = wireNodeEl;
|
|
2314
|
-
while (current && current !== frameRoot && frameRoot.contains(current)) {
|
|
2315
|
-
if (current.dataset.wireNodeId) pathEls.unshift(current);
|
|
2316
|
-
current = current.parentElement;
|
|
2317
|
-
}
|
|
2318
|
-
if (pathEls.length === 0) pathEls.push(wireNodeEl);
|
|
2319
|
-
const segments = pathEls.map((el) => {
|
|
2320
|
-
const elName = el.dataset.wireNodeEl ?? el.tagName.toLowerCase();
|
|
2321
|
-
const directText = Array.from(el.childNodes)
|
|
2322
|
-
.filter((n) => n.nodeType === Node.TEXT_NODE)
|
|
2323
|
-
.map((n) => n.textContent ?? "")
|
|
2324
|
-
.join("")
|
|
2325
|
-
.replace(/\s+/g, " ")
|
|
2326
|
-
.trim()
|
|
2327
|
-
.slice(0, 40);
|
|
2328
|
-
return directText ? `${elName} "${directText}"` : elName;
|
|
2329
|
-
});
|
|
2330
|
-
if (segments.length > 0) targetNodePath = segments.join(" > ");
|
|
2331
|
-
}
|
|
2332
|
-
}
|
|
2333
|
-
|
|
2334
|
-
return {
|
|
2335
|
-
...base,
|
|
2336
|
-
sectionId:
|
|
2337
|
-
prototype?.dataset.prototypeScreen ??
|
|
2338
|
-
frame?.dataset.canvasFrame ??
|
|
2339
|
-
block?.dataset.blockId,
|
|
2340
|
-
screenId: prototype?.dataset.prototypeScreen,
|
|
2341
|
-
sectionTitle,
|
|
2342
|
-
targetSelector: selectorForElementWithin(reader, anchorElement),
|
|
2343
|
-
targetX,
|
|
2344
|
-
targetY,
|
|
2345
|
-
tagName: anchorElement.tagName.toLowerCase(),
|
|
2346
|
-
anchorKind:
|
|
2347
|
-
textElement && targetText ? "text" : targetKind ? "visual" : "point",
|
|
2348
|
-
textQuote: textElement && targetText ? targetText.slice(0, 220) : undefined,
|
|
2349
|
-
snippet: targetText || sectionTitle,
|
|
2350
|
-
visualLabel: sectionTitle ?? input.planTitle,
|
|
2351
|
-
visualX: targetX,
|
|
2352
|
-
visualY: targetY,
|
|
2353
|
-
targetKind,
|
|
2354
|
-
targetLabel:
|
|
2355
|
-
image?.alt?.trim() ||
|
|
2356
|
-
anchorElement.getAttribute("aria-label") ||
|
|
2357
|
-
sectionTitle ||
|
|
2358
|
-
targetText.slice(0, 80) ||
|
|
2359
|
-
input.planTitle,
|
|
2360
|
-
targetText: targetText || undefined,
|
|
2361
|
-
targetAlt: image?.alt?.trim() || undefined,
|
|
2362
|
-
targetSrc: image?.currentSrc || image?.src || undefined,
|
|
2363
|
-
visualContext,
|
|
2364
|
-
...(targetNodeId !== undefined ? { targetNodeId } : {}),
|
|
2365
|
-
...(targetNodePath !== undefined ? { targetNodePath } : {}),
|
|
2366
|
-
};
|
|
2367
|
-
}
|
|
2368
|
-
|
|
2369
|
-
export function resolveNativeAnchorTarget(
|
|
2370
|
-
anchor: PlanAnnotationAnchor,
|
|
2371
|
-
reader: HTMLElement,
|
|
2372
|
-
) {
|
|
2373
|
-
const prototypeScope = prototypeScopeForAnchor(anchor, reader);
|
|
2374
|
-
if (prototypeScope === null) return null;
|
|
2375
|
-
const queryRoot = prototypeScope ?? reader;
|
|
2376
|
-
const needle = textNeedleForAnchor(anchor);
|
|
2377
|
-
const stableVisualTarget = resolveStableVisualAnchorTarget(
|
|
2378
|
-
anchor,
|
|
2379
|
-
reader,
|
|
2380
|
-
queryRoot,
|
|
2381
|
-
);
|
|
2382
|
-
if (stableVisualTarget) return stableVisualTarget;
|
|
2383
|
-
if (anchor.targetSelector) {
|
|
2384
|
-
try {
|
|
2385
|
-
const target = queryRoot.matches(anchor.targetSelector)
|
|
2386
|
-
? queryRoot
|
|
2387
|
-
: queryRoot.querySelector<HTMLElement>(anchor.targetSelector);
|
|
2388
|
-
if (target) {
|
|
2389
|
-
if (!needle) return target;
|
|
2390
|
-
const textTarget = findTextAnchorTarget(target, needle);
|
|
2391
|
-
if (textTarget) return textTarget;
|
|
2392
|
-
}
|
|
2393
|
-
} catch {
|
|
2394
|
-
// Fall back to broad visual targets or quote matching below.
|
|
2395
|
-
}
|
|
2396
|
-
}
|
|
2397
|
-
if (
|
|
2398
|
-
anchor.planAnnotationId ||
|
|
2399
|
-
anchor.canvasX !== undefined ||
|
|
2400
|
-
anchor.targetKind === "canvas"
|
|
2401
|
-
) {
|
|
2402
|
-
const canvasWorld = reader.querySelector<HTMLElement>(
|
|
2403
|
-
"[data-plan-canvas-world], .plan-canvas-world",
|
|
2404
|
-
);
|
|
2405
|
-
if (canvasWorld) return canvasWorld;
|
|
2406
|
-
}
|
|
2407
|
-
if (anchor.targetKind === "wireframe" && anchor.sectionId) {
|
|
2408
|
-
const frame = reader.querySelector<HTMLElement>(
|
|
2409
|
-
dataSelector("data-canvas-frame", anchor.sectionId),
|
|
2410
|
-
);
|
|
2411
|
-
if (frame) return frame;
|
|
2412
|
-
}
|
|
2413
|
-
if (!needle) return null;
|
|
2414
|
-
const scopes: Element[] = [];
|
|
2415
|
-
if (prototypeScope) {
|
|
2416
|
-
scopes.push(prototypeScope);
|
|
2417
|
-
} else if (anchor.sectionId) {
|
|
2418
|
-
const byBlock = reader.querySelector<HTMLElement>(
|
|
2419
|
-
`[data-block-id="${cssAttr(anchor.sectionId)}"]`,
|
|
2420
|
-
);
|
|
2421
|
-
const byFrame = reader.querySelector<HTMLElement>(
|
|
2422
|
-
`[data-canvas-frame="${cssAttr(anchor.sectionId)}"]`,
|
|
2423
|
-
);
|
|
2424
|
-
if (byBlock) scopes.push(byBlock);
|
|
2425
|
-
if (byFrame) scopes.push(byFrame);
|
|
2426
|
-
}
|
|
2427
|
-
if (!prototypeScope) scopes.push(reader);
|
|
2428
|
-
for (const scope of scopes) {
|
|
2429
|
-
const match = findTextAnchorTarget(scope, needle);
|
|
2430
|
-
if (match) return match;
|
|
2431
|
-
}
|
|
2432
|
-
return null;
|
|
2433
|
-
}
|
|
2434
|
-
|
|
2435
|
-
export function nativePointForAnchor(
|
|
2436
|
-
anchor: PlanAnnotationAnchor,
|
|
2437
|
-
reader: HTMLElement,
|
|
2438
|
-
) {
|
|
2439
|
-
const target = resolveNativeAnchorTarget(anchor, reader);
|
|
2440
|
-
if (!target && prototypeScreenIdForAnchor(anchor)) return null;
|
|
2441
|
-
const readerRect = reader.getBoundingClientRect();
|
|
2442
|
-
if (target) {
|
|
2443
|
-
const rect = target.getBoundingClientRect();
|
|
2444
|
-
if (rect.width || rect.height) {
|
|
2445
|
-
return {
|
|
2446
|
-
left:
|
|
2447
|
-
rect.left -
|
|
2448
|
-
readerRect.left +
|
|
2449
|
-
((anchor.targetX ?? anchor.visualX ?? 50) / 100) * rect.width,
|
|
2450
|
-
top:
|
|
2451
|
-
rect.top -
|
|
2452
|
-
readerRect.top +
|
|
2453
|
-
((anchor.targetY ?? anchor.visualY ?? 50) / 100) * rect.height,
|
|
2454
|
-
};
|
|
2455
|
-
}
|
|
2456
|
-
}
|
|
2457
|
-
return {
|
|
2458
|
-
left: (anchor.x / 100) * reader.scrollWidth - reader.scrollLeft,
|
|
2459
|
-
top: (anchor.y / 100) * reader.scrollHeight - reader.scrollTop,
|
|
2460
|
-
};
|
|
2461
|
-
}
|
|
2462
|
-
|
|
2463
|
-
type NativeMarkerClip = {
|
|
2464
|
-
left: number;
|
|
2465
|
-
top: number;
|
|
2466
|
-
width: number;
|
|
2467
|
-
height: number;
|
|
2468
|
-
};
|
|
2469
|
-
|
|
2470
|
-
export type NativeMarkerPlacement = {
|
|
2471
|
-
marker: {
|
|
2472
|
-
left: number;
|
|
2473
|
-
top: number;
|
|
2474
|
-
};
|
|
2475
|
-
clip: NativeMarkerClip | null;
|
|
2476
|
-
};
|
|
2477
|
-
|
|
2478
|
-
function rectForElementWithinReader(element: HTMLElement, reader: HTMLElement) {
|
|
2479
|
-
const elementRect = element.getBoundingClientRect();
|
|
2480
|
-
if (!elementRect.width && !elementRect.height) return null;
|
|
2481
|
-
const readerRect = reader.getBoundingClientRect();
|
|
2482
|
-
return {
|
|
2483
|
-
left: elementRect.left - readerRect.left,
|
|
2484
|
-
top: elementRect.top - readerRect.top,
|
|
2485
|
-
width: elementRect.width,
|
|
2486
|
-
height: elementRect.height,
|
|
2487
|
-
} satisfies NativeMarkerClip;
|
|
2488
|
-
}
|
|
2489
|
-
|
|
2490
|
-
function visualMarkerClipForAnchor(
|
|
2491
|
-
anchor: PlanAnnotationAnchor,
|
|
2492
|
-
reader: HTMLElement,
|
|
2493
|
-
): NativeMarkerClip | null {
|
|
2494
|
-
const surfaceMode = visualSurfaceModeForAnchor(anchor);
|
|
2495
|
-
if (!surfaceMode) return null;
|
|
2496
|
-
const target = resolveNativeAnchorTarget(anchor, reader);
|
|
2497
|
-
const visualRoot =
|
|
2498
|
-
surfaceMode === "prototype"
|
|
2499
|
-
? (target?.closest<HTMLElement>("[data-plan-prototype-viewer]") ??
|
|
2500
|
-
prototypeScopeForAnchor(anchor, reader)?.closest<HTMLElement>(
|
|
2501
|
-
"[data-plan-prototype-viewer]",
|
|
2502
|
-
) ??
|
|
2503
|
-
reader.querySelector<HTMLElement>("[data-plan-prototype-viewer]"))
|
|
2504
|
-
: (target?.closest<HTMLElement>("[data-plan-canvas-viewport]") ??
|
|
2505
|
-
reader.querySelector<HTMLElement>("[data-plan-canvas-viewport]"));
|
|
2506
|
-
return visualRoot ? rectForElementWithinReader(visualRoot, reader) : null;
|
|
2507
|
-
}
|
|
2508
|
-
|
|
2509
|
-
export function nativeMarkerPlacementForAnchor(
|
|
2510
|
-
anchor: PlanAnnotationAnchor,
|
|
2511
|
-
reader: HTMLElement,
|
|
2512
|
-
): NativeMarkerPlacement | null {
|
|
2513
|
-
const point = nativePointForAnchor(anchor, reader);
|
|
2514
|
-
if (!point) return null;
|
|
2515
|
-
const clip = visualMarkerClipForAnchor(anchor, reader);
|
|
2516
|
-
if (!clip) return { marker: point, clip: null };
|
|
2517
|
-
return {
|
|
2518
|
-
clip,
|
|
2519
|
-
marker: {
|
|
2520
|
-
left: point.left - clip.left,
|
|
2521
|
-
top: point.top - clip.top,
|
|
2522
|
-
},
|
|
2523
|
-
};
|
|
2524
|
-
}
|
|
2525
|
-
|
|
2526
1427
|
function resolveInlineCommentPosition(input: {
|
|
2527
1428
|
pointX: number;
|
|
2528
1429
|
pointY: number;
|
|
@@ -3067,6 +1968,7 @@ export function PlansPage({ localPlanSlug }: { localPlanSlug?: string } = {}) {
|
|
|
3067
1968
|
const pendingDocumentRestoreRef = useRef<PlanDocumentState | null>(null);
|
|
3068
1969
|
const pendingDocumentRestoreTimerRef = useRef<number | null>(null);
|
|
3069
1970
|
const nativeScrollFrameRef = useRef<number | null>(null);
|
|
1971
|
+
const initialReaderScrollResetKeyRef = useRef<string | null>(null);
|
|
3070
1972
|
const [createOpen, setCreateOpen] = useState(false);
|
|
3071
1973
|
const [annotationsOpen, setAnnotationsOpen] = useState(false);
|
|
3072
1974
|
const [historyOpen, setHistoryOpen] = useState(false);
|
|
@@ -3977,18 +2879,28 @@ export function PlansPage({ localPlanSlug }: { localPlanSlug?: string } = {}) {
|
|
|
3977
2879
|
const annotatedDocumentHtml = useMemo(() => {
|
|
3978
2880
|
if (!bundle) return "";
|
|
3979
2881
|
const defaults = iframeRuntimeDefaultsRef.current;
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
2882
|
+
const annotations = buildCommentThreads(visiblePlanComments)
|
|
2883
|
+
.map((thread, index) =>
|
|
2884
|
+
runtimeAnnotationFromThread(
|
|
2885
|
+
thread,
|
|
2886
|
+
index,
|
|
2887
|
+
commentAvatarUrls,
|
|
2888
|
+
currentCommentAuthor,
|
|
2889
|
+
),
|
|
2890
|
+
)
|
|
2891
|
+
.filter((annotation): annotation is RuntimeAnnotation =>
|
|
2892
|
+
Boolean(annotation),
|
|
2893
|
+
);
|
|
2894
|
+
return injectAnnotationRuntime({
|
|
2895
|
+
html: documentHtml,
|
|
2896
|
+
annotations,
|
|
2897
|
+
annotateMode: false,
|
|
2898
|
+
theme: defaults.planTheme,
|
|
2899
|
+
preferredEditor: defaults.preferredEditor,
|
|
2900
|
+
labels: {
|
|
3987
2901
|
closeCodePreview: t("plansPage.reader.runtimeCloseCodePreview"),
|
|
3988
2902
|
},
|
|
3989
|
-
|
|
3990
|
-
currentCommentAuthor,
|
|
3991
|
-
);
|
|
2903
|
+
});
|
|
3992
2904
|
}, [
|
|
3993
2905
|
bundle,
|
|
3994
2906
|
commentAvatarUrls,
|
|
@@ -4242,6 +3154,47 @@ export function PlansPage({ localPlanSlug }: { localPlanSlug?: string } = {}) {
|
|
|
4242
3154
|
|
|
4243
3155
|
useEffect(() => clearPendingDocumentRestore, [clearPendingDocumentRestore]);
|
|
4244
3156
|
|
|
3157
|
+
useBrowserLayoutEffect(() => {
|
|
3158
|
+
if (!selectedId || !bundle?.plan.content || location.hash) return;
|
|
3159
|
+
const resetKey = `${bundle.plan.kind}:${selectedId}`;
|
|
3160
|
+
if (initialReaderScrollResetKeyRef.current === resetKey) return;
|
|
3161
|
+
initialReaderScrollResetKeyRef.current = resetKey;
|
|
3162
|
+
clearPendingDocumentRestore();
|
|
3163
|
+
documentStateRef.current = null;
|
|
3164
|
+
|
|
3165
|
+
const reset = () => resetPlanReaderScrollPosition(nativeReaderRef.current);
|
|
3166
|
+
const frameIds: number[] = [];
|
|
3167
|
+
const timeoutIds: number[] = [];
|
|
3168
|
+
const scheduleFrame = () => {
|
|
3169
|
+
frameIds.push(window.requestAnimationFrame(reset));
|
|
3170
|
+
};
|
|
3171
|
+
const scheduleTimeout = (delay: number) => {
|
|
3172
|
+
timeoutIds.push(
|
|
3173
|
+
window.setTimeout(() => {
|
|
3174
|
+
reset();
|
|
3175
|
+
scheduleFrame();
|
|
3176
|
+
}, delay),
|
|
3177
|
+
);
|
|
3178
|
+
};
|
|
3179
|
+
|
|
3180
|
+
reset();
|
|
3181
|
+
scheduleFrame();
|
|
3182
|
+
scheduleTimeout(0);
|
|
3183
|
+
scheduleTimeout(120);
|
|
3184
|
+
scheduleTimeout(500);
|
|
3185
|
+
|
|
3186
|
+
return () => {
|
|
3187
|
+
frameIds.forEach((id) => window.cancelAnimationFrame(id));
|
|
3188
|
+
timeoutIds.forEach((id) => window.clearTimeout(id));
|
|
3189
|
+
};
|
|
3190
|
+
}, [
|
|
3191
|
+
bundle?.plan.content,
|
|
3192
|
+
bundle?.plan.kind,
|
|
3193
|
+
clearPendingDocumentRestore,
|
|
3194
|
+
location.hash,
|
|
3195
|
+
selectedId,
|
|
3196
|
+
]);
|
|
3197
|
+
|
|
4245
3198
|
useEffect(() => {
|
|
4246
3199
|
const frame = requestAnimationFrame(() => postRuntimeState());
|
|
4247
3200
|
return () => cancelAnimationFrame(frame);
|
|
@@ -9609,132 +8562,6 @@ function CreatePlanDialog({
|
|
|
9609
8562
|
);
|
|
9610
8563
|
}
|
|
9611
8564
|
|
|
9612
|
-
function createMentionChip(mention: PlanCommentMention) {
|
|
9613
|
-
const chip = document.createElement("span");
|
|
9614
|
-
chip.contentEditable = "false";
|
|
9615
|
-
chip.dataset.mentionEmail = mention.email;
|
|
9616
|
-
chip.dataset.mentionLabel = mention.label;
|
|
9617
|
-
chip.className =
|
|
9618
|
-
"inline-flex max-w-[12rem] items-center gap-1 rounded-full border border-primary/20 bg-primary/10 px-1.5 py-0.5 text-xs font-medium text-primary";
|
|
9619
|
-
chip.textContent = `@${mention.label}`;
|
|
9620
|
-
return chip;
|
|
9621
|
-
}
|
|
9622
|
-
|
|
9623
|
-
function appendMessageToEditor(root: HTMLElement, message: string) {
|
|
9624
|
-
root.replaceChildren();
|
|
9625
|
-
const pattern = /@\[([^\]]+)\]\(mailto:([^)]+)\)/g;
|
|
9626
|
-
let lastIndex = 0;
|
|
9627
|
-
let match: RegExpExecArray | null;
|
|
9628
|
-
while ((match = pattern.exec(message)) !== null) {
|
|
9629
|
-
if (match.index > lastIndex) {
|
|
9630
|
-
root.append(
|
|
9631
|
-
document.createTextNode(message.slice(lastIndex, match.index)),
|
|
9632
|
-
);
|
|
9633
|
-
}
|
|
9634
|
-
const label = match[1]?.trim();
|
|
9635
|
-
const email = decodeURIComponent(match[2] ?? "")
|
|
9636
|
-
.trim()
|
|
9637
|
-
.toLowerCase();
|
|
9638
|
-
if (label && email) {
|
|
9639
|
-
root.append(createMentionChip({ label, email }));
|
|
9640
|
-
}
|
|
9641
|
-
lastIndex = pattern.lastIndex;
|
|
9642
|
-
}
|
|
9643
|
-
if (lastIndex < message.length) {
|
|
9644
|
-
root.append(document.createTextNode(message.slice(lastIndex)));
|
|
9645
|
-
}
|
|
9646
|
-
}
|
|
9647
|
-
|
|
9648
|
-
function serializeCommentEditor(root: HTMLElement) {
|
|
9649
|
-
const serialize = (node: Node): string => {
|
|
9650
|
-
if (node.nodeType === Node.TEXT_NODE) return node.textContent ?? "";
|
|
9651
|
-
if (!(node instanceof HTMLElement)) return "";
|
|
9652
|
-
const mentionEmail = node.dataset.mentionEmail;
|
|
9653
|
-
if (mentionEmail) {
|
|
9654
|
-
return formatPlanCommentMentionToken({
|
|
9655
|
-
email: mentionEmail,
|
|
9656
|
-
label: node.dataset.mentionLabel || displayNameForMention(mentionEmail),
|
|
9657
|
-
});
|
|
9658
|
-
}
|
|
9659
|
-
if (node.tagName === "BR") return "\n";
|
|
9660
|
-
return Array.from(node.childNodes).map(serialize).join("");
|
|
9661
|
-
};
|
|
9662
|
-
return Array.from(root.childNodes)
|
|
9663
|
-
.map(serialize)
|
|
9664
|
-
.join("")
|
|
9665
|
-
.replace(/\u00a0/g, " ")
|
|
9666
|
-
.replace(/[ \t]+\n/g, "\n")
|
|
9667
|
-
.trim();
|
|
9668
|
-
}
|
|
9669
|
-
|
|
9670
|
-
function commentBodyText(message: string) {
|
|
9671
|
-
return message
|
|
9672
|
-
.replace(/@\[([^\]]+)\]\(mailto:[^)]+\)/g, "")
|
|
9673
|
-
.replace(/\s+/g, " ")
|
|
9674
|
-
.trim();
|
|
9675
|
-
}
|
|
9676
|
-
|
|
9677
|
-
export function canSubmitInlineCommentDraft(input: {
|
|
9678
|
-
draft: CommentDraft;
|
|
9679
|
-
isSubmitting?: boolean;
|
|
9680
|
-
lockToAgent?: boolean;
|
|
9681
|
-
}) {
|
|
9682
|
-
const needsHumanMention =
|
|
9683
|
-
!input.lockToAgent &&
|
|
9684
|
-
input.draft.resolutionTarget === "human" &&
|
|
9685
|
-
input.draft.mentions.length === 0;
|
|
9686
|
-
return (
|
|
9687
|
-
commentBodyText(input.draft.message).length > 0 &&
|
|
9688
|
-
!needsHumanMention &&
|
|
9689
|
-
!input.isSubmitting
|
|
9690
|
-
);
|
|
9691
|
-
}
|
|
9692
|
-
|
|
9693
|
-
export function mentionQueryAtCaret(root: HTMLElement) {
|
|
9694
|
-
const selection = window.getSelection();
|
|
9695
|
-
if (!selection || selection.rangeCount === 0) return null;
|
|
9696
|
-
const range = selection.getRangeAt(0);
|
|
9697
|
-
if (!range.collapsed || !root.contains(range.startContainer)) return null;
|
|
9698
|
-
const textBeforeCaretRange = range.cloneRange();
|
|
9699
|
-
textBeforeCaretRange.selectNodeContents(root);
|
|
9700
|
-
textBeforeCaretRange.setEnd(range.startContainer, range.startOffset);
|
|
9701
|
-
const text = textBeforeCaretRange.toString();
|
|
9702
|
-
const match = /(?:^|\s)@([a-zA-Z0-9._+-]{0,64})$/.exec(text);
|
|
9703
|
-
if (!match) return null;
|
|
9704
|
-
const start = text.lastIndexOf("@");
|
|
9705
|
-
const end = text.length;
|
|
9706
|
-
const startPosition = textPositionInRoot(root, start);
|
|
9707
|
-
const endPosition = textPositionInRoot(root, end);
|
|
9708
|
-
if (!startPosition || !endPosition) return null;
|
|
9709
|
-
const queryRange = document.createRange();
|
|
9710
|
-
queryRange.setStart(startPosition.node, startPosition.offset);
|
|
9711
|
-
queryRange.setEnd(endPosition.node, endPosition.offset);
|
|
9712
|
-
return {
|
|
9713
|
-
query: match[1] ?? "",
|
|
9714
|
-
range: queryRange,
|
|
9715
|
-
};
|
|
9716
|
-
}
|
|
9717
|
-
|
|
9718
|
-
function textPositionInRoot(root: HTMLElement, offset: number) {
|
|
9719
|
-
const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);
|
|
9720
|
-
let seen = 0;
|
|
9721
|
-
let lastText: Text | null = null;
|
|
9722
|
-
let node = walker.nextNode() as Text | null;
|
|
9723
|
-
while (node) {
|
|
9724
|
-
const length = node.textContent?.length ?? 0;
|
|
9725
|
-
if (offset <= seen + length) {
|
|
9726
|
-
return { node, offset: Math.max(0, offset - seen) };
|
|
9727
|
-
}
|
|
9728
|
-
seen += length;
|
|
9729
|
-
lastText = node;
|
|
9730
|
-
node = walker.nextNode() as Text | null;
|
|
9731
|
-
}
|
|
9732
|
-
if (lastText && offset === seen) {
|
|
9733
|
-
return { node: lastText, offset: lastText.textContent?.length ?? 0 };
|
|
9734
|
-
}
|
|
9735
|
-
return null;
|
|
9736
|
-
}
|
|
9737
|
-
|
|
9738
8565
|
function CommentMentionEditor({
|
|
9739
8566
|
initialMessage,
|
|
9740
8567
|
resetKey,
|
|
@@ -11110,1364 +9937,6 @@ function formatAnchorForAgent(anchor: PlanAnnotationAnchor | null) {
|
|
|
11110
9937
|
return formatPlanCommentAnchorForAgent(anchor);
|
|
11111
9938
|
}
|
|
11112
9939
|
|
|
11113
|
-
function injectAnnotationRuntime(
|
|
11114
|
-
html: string,
|
|
11115
|
-
comments: PlanBundle["comments"],
|
|
11116
|
-
annotateMode: boolean,
|
|
11117
|
-
theme: "dark" | "light",
|
|
11118
|
-
preferredEditor: PreferredEditor,
|
|
11119
|
-
labels: {
|
|
11120
|
-
closeCodePreview: string;
|
|
11121
|
-
},
|
|
11122
|
-
avatarUrls: Record<string, string | null> = {},
|
|
11123
|
-
currentUser?: CurrentCommentAuthor | null,
|
|
11124
|
-
) {
|
|
11125
|
-
const annotations = buildCommentThreads(comments)
|
|
11126
|
-
.map((thread, index) =>
|
|
11127
|
-
runtimeAnnotationFromThread(thread, index, avatarUrls, currentUser),
|
|
11128
|
-
)
|
|
11129
|
-
.filter((annotation): annotation is RuntimeAnnotation =>
|
|
11130
|
-
Boolean(annotation),
|
|
11131
|
-
);
|
|
11132
|
-
const payload = JSON.stringify({
|
|
11133
|
-
annotateMode,
|
|
11134
|
-
annotations,
|
|
11135
|
-
theme,
|
|
11136
|
-
preferredEditor,
|
|
11137
|
-
}).replace(/[<>&\u2028\u2029]/g, (char) => {
|
|
11138
|
-
return (
|
|
11139
|
-
{
|
|
11140
|
-
"<": "\\u003c",
|
|
11141
|
-
">": "\\u003e",
|
|
11142
|
-
"&": "\\u0026",
|
|
11143
|
-
"\u2028": "\\u2028",
|
|
11144
|
-
"\u2029": "\\u2029",
|
|
11145
|
-
}[char] ?? char
|
|
11146
|
-
);
|
|
11147
|
-
});
|
|
11148
|
-
const editorOptionsPayload = JSON.stringify(EDITOR_OPTIONS).replace(
|
|
11149
|
-
/[<>&\u2028\u2029]/g,
|
|
11150
|
-
(char) => {
|
|
11151
|
-
return (
|
|
11152
|
-
{
|
|
11153
|
-
"<": "\\u003c",
|
|
11154
|
-
">": "\\u003e",
|
|
11155
|
-
"&": "\\u0026",
|
|
11156
|
-
"\u2028": "\\u2028",
|
|
11157
|
-
"\u2029": "\\u2029",
|
|
11158
|
-
}[char] ?? char
|
|
11159
|
-
);
|
|
11160
|
-
},
|
|
11161
|
-
);
|
|
11162
|
-
const editorIconPayload = JSON.stringify(EDITOR_ICON_HTML).replace(
|
|
11163
|
-
/[<>&\u2028\u2029]/g,
|
|
11164
|
-
(char) => {
|
|
11165
|
-
return (
|
|
11166
|
-
{
|
|
11167
|
-
"<": "\\u003c",
|
|
11168
|
-
">": "\\u003e",
|
|
11169
|
-
"&": "\\u0026",
|
|
11170
|
-
"\u2028": "\\u2028",
|
|
11171
|
-
"\u2029": "\\u2029",
|
|
11172
|
-
}[char] ?? char
|
|
11173
|
-
);
|
|
11174
|
-
},
|
|
11175
|
-
);
|
|
11176
|
-
const closeCodePreviewLabel = escapeRuntimeJsString(labels.closeCodePreview);
|
|
11177
|
-
const runtime = `<style>
|
|
11178
|
-
:root[data-agent-native-theme="light"] {
|
|
11179
|
-
color-scheme: light;
|
|
11180
|
-
--bg: #f7f7f4;
|
|
11181
|
-
--paper: #ffffff;
|
|
11182
|
-
--paper-2: #f3f3ef;
|
|
11183
|
-
--paper-3: #e9e9e3;
|
|
11184
|
-
--line: #dadad2;
|
|
11185
|
-
--line-soft: #e8e8e2;
|
|
11186
|
-
--text: #171717;
|
|
11187
|
-
--soft: #4b4b4b;
|
|
11188
|
-
--muted: #70706c;
|
|
11189
|
-
--faint: #999992;
|
|
11190
|
-
--accent: #00B5FF;
|
|
11191
|
-
--accent-soft: rgba(0, 181, 255, .11);
|
|
11192
|
-
--shadow: 0 24px 70px rgba(29, 29, 24, .08);
|
|
11193
|
-
}
|
|
11194
|
-
:root[data-agent-native-theme="light"] body { background: var(--bg) !important; color: var(--text) !important; }
|
|
11195
|
-
:root[data-agent-native-theme="light"] code { background: #eeeeea !important; color: #242424 !important; }
|
|
11196
|
-
:root[data-agent-native-theme] pre code,
|
|
11197
|
-
:root[data-agent-native-theme] pre code * { background: transparent !important; background-image: none !important; box-shadow: none !important; }
|
|
11198
|
-
:root[data-agent-native-theme="light"] .mock-plan,
|
|
11199
|
-
:root[data-agent-native-theme="light"] .mock-sidebar,
|
|
11200
|
-
:root[data-agent-native-theme="light"] .diagram-card,
|
|
11201
|
-
:root[data-agent-native-theme="light"] .mock-browser { background-color: #ffffff !important; }
|
|
11202
|
-
:root[data-agent-native-theme="light"] .floating-tools,
|
|
11203
|
-
:root[data-agent-native-theme="light"] .product-screen,
|
|
11204
|
-
:root[data-agent-native-theme="light"] .comment-screen,
|
|
11205
|
-
:root[data-agent-native-theme="light"] .annotation-card,
|
|
11206
|
-
:root[data-agent-native-theme="light"] .inline-comment,
|
|
11207
|
-
:root[data-agent-native-theme="light"] .panel { background-color: #f5f5f1 !important; }
|
|
11208
|
-
:root[data-agent-native-theme="light"] .doc-title,
|
|
11209
|
-
:root[data-agent-native-theme="light"] .tool.primary,
|
|
11210
|
-
:root[data-agent-native-theme="light"] .pin { background: #171717 !important; color: #ffffff !important; }
|
|
11211
|
-
:root[data-agent-native-theme="light"] .doc-line,
|
|
11212
|
-
:root[data-agent-native-theme="light"] .panel i,
|
|
11213
|
-
:root[data-agent-native-theme="light"] .pill { background: #d8d8d2 !important; }
|
|
11214
|
-
::selection { background: rgba(0,181,255,.32); }
|
|
11215
|
-
.an-plan-annotating, .an-plan-annotating * { cursor: crosshair !important; }
|
|
11216
|
-
.an-plan-annotation-layer { position: absolute; inset: 0; z-index: 2147483000; pointer-events: none; }
|
|
11217
|
-
.an-plan-marker { position: absolute; transform: translate(-50%, -50%); min-width: 30px; height: 30px; overflow: visible; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; background: rgba(23,23,25,.86); color: #fff; font: 800 10px/1 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; display: inline-flex; align-items: center; justify-content: center; gap: 3px; box-shadow: 0 10px 28px rgba(0,0,0,.36); pointer-events: auto; padding: 2px 6px 2px 2px; }
|
|
11218
|
-
.an-plan-marker[data-single="true"] { width: 30px; min-width: 30px; padding: 0; border: 2px solid var(--paper, #111113); background: var(--author-color, #00B5FF); overflow: hidden; }
|
|
11219
|
-
.an-plan-marker-stack { display: inline-flex; align-items: center; flex: 0 0 auto; }
|
|
11220
|
-
.an-plan-marker-face { width: 26px; height: 26px; margin-left: -7px; overflow: hidden; border: 2px solid var(--paper, #111113); border-radius: 999px; background: var(--author-color, #00B5FF); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
|
|
11221
|
-
.an-plan-marker-face:first-child { margin-left: 0; }
|
|
11222
|
-
.an-plan-marker[data-single="true"] .an-plan-marker-face { width: 28px; height: 28px; margin-left: 0; border: 0; }
|
|
11223
|
-
.an-plan-marker-avatar { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; display: block; }
|
|
11224
|
-
.an-plan-marker-initials { width: 100%; height: 100%; border-radius: inherit; background: var(--author-color, #00B5FF); color: #fff; display: inline-flex; align-items: center; justify-content: center; letter-spacing: 0; }
|
|
11225
|
-
.an-plan-marker-count { min-width: 13px; padding: 0 2px; color: rgba(255,255,255,.94); font-size: 11px; line-height: 1; }
|
|
11226
|
-
.an-plan-marker[hidden] { display: none !important; }
|
|
11227
|
-
.an-plan-marker[data-status="resolved"] { opacity: .46; }
|
|
11228
|
-
.an-plan-selection-toolbar { position: absolute; z-index: 2147483001; display: none; align-items: center; gap: 4px; border: 1px solid rgba(255,255,255,.16); border-radius: 14px; background: rgba(16,16,18,.96); padding: 5px; box-shadow: 0 14px 42px rgba(0,0,0,.34); backdrop-filter: blur(16px); }
|
|
11229
|
-
:root[data-agent-native-theme="light"] .an-plan-selection-toolbar { border-color: rgba(0,0,0,.12); background: rgba(255,255,255,.97); box-shadow: 0 14px 42px rgba(29,29,24,.13); }
|
|
11230
|
-
.an-plan-selection-toolbar button { height: 34px; display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 10px; background: transparent; color: var(--text); padding: 0 11px; font: 650 13px/1 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; cursor: pointer; }
|
|
11231
|
-
.an-plan-selection-toolbar button:hover { background: rgba(255,255,255,.08); }
|
|
11232
|
-
:root[data-agent-native-theme="light"] .an-plan-selection-toolbar button:hover { background: rgba(0,0,0,.06); }
|
|
11233
|
-
.an-plan-selection-toolbar svg { width: 17px; height: 17px; color: #00B5FF; }
|
|
11234
|
-
.an-plan-code-popover { position: absolute; z-index: 2147483001; width: min(760px, calc(100vw - 24px)); max-height: min(520px, calc(100vh - 24px)); overflow: hidden; border: 1px solid rgba(255,255,255,.16); border-radius: 16px; background: rgba(16,16,18,.98); box-shadow: 0 24px 70px rgba(0,0,0,.42); backdrop-filter: blur(18px); }
|
|
11235
|
-
:root[data-agent-native-theme="light"] .an-plan-code-popover { border-color: rgba(0,0,0,.12); background: rgba(255,255,255,.98); box-shadow: 0 24px 70px rgba(29,29,24,.16); }
|
|
11236
|
-
.an-plan-code-popover-header { display: flex; min-height: 46px; align-items: center; gap: 12px; border-bottom: 1px solid var(--line, rgba(255,255,255,.12)); padding: 7px 9px 7px 14px; color: var(--muted, #a4a4aa); font: 650 12px/1.3 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
|
|
11237
|
-
.an-plan-code-popover-title { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text, #f4f4f5); font: 650 13px/1.3 "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
|
|
11238
|
-
.an-plan-code-popover-actions { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
|
|
11239
|
-
.an-plan-code-popover-close { display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center; border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; font-size: 18px; }
|
|
11240
|
-
.an-plan-code-popover-close:hover { background: rgba(255,255,255,.08); color: var(--text, #f4f4f5); }
|
|
11241
|
-
:root[data-agent-native-theme="light"] .an-plan-code-popover-close:hover { background: rgba(0,0,0,.06); }
|
|
11242
|
-
.an-plan-code-popover .code-preview-title { display: none !important; }
|
|
11243
|
-
.an-plan-code-popover .code-preview { border: 0 !important; background: transparent !important; box-shadow: none !important; }
|
|
11244
|
-
.an-plan-code-popover .code-preview pre { margin: 0 !important; max-height: 474px; overflow: auto; padding: 14px 16px !important; background: #0c0c0e !important; color: #e9e9ea; font: 12px/1.65 "SFMono-Regular", Consolas, "Liberation Mono", monospace !important; tab-size: 2; }
|
|
11245
|
-
.an-plan-code-popover .code-preview pre code { display: block !important; min-width: max-content; border: 0 !important; background: transparent !important; color: inherit !important; font: inherit !important; padding: 0 !important; white-space: pre !important; }
|
|
11246
|
-
.an-plan-code-popover .code-preview pre code * { margin: 0 !important; border: 0 !important; border-radius: 0 !important; outline: 0 !important; background: transparent !important; background-image: none !important; box-shadow: none !important; padding: 0 !important; text-decoration: none !important; font: inherit !important; }
|
|
11247
|
-
.an-plan-code-popover .code-preview pre code code { display: inline !important; }
|
|
11248
|
-
.editor-picker { position: relative; display: inline-flex; min-height: 32px; align-items: stretch; overflow: visible; border: 1px solid var(--line, rgba(255,255,255,.14)); border-radius: 8px; background: transparent; }
|
|
11249
|
-
.editor-picker:focus-within, .editor-picker:hover { border-color: rgba(0,181,255,.44); background: rgba(0,181,255,.06); }
|
|
11250
|
-
.editor-picker button { min-height: 30px; border: 0; border-radius: 0; background: transparent; color: var(--soft, #d4d4d8); padding: 0 10px; font: 650 12px/30px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; cursor: pointer; }
|
|
11251
|
-
.editor-picker button:hover { color: var(--text, #f4f4f5); background: rgba(255,255,255,.05); }
|
|
11252
|
-
.editor-picker-trigger { display: inline-flex; width: 48px; align-items: center; justify-content: center; gap: 6px; border-right: 1px solid var(--line, rgba(255,255,255,.14)) !important; border-radius: 7px 0 0 7px !important; }
|
|
11253
|
-
.editor-picker-open { border-radius: 0 7px 7px 0 !important; color: var(--text, #f4f4f5) !important; }
|
|
11254
|
-
.editor-picker-select { display: none; }
|
|
11255
|
-
.editor-picker-caret { width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-1px) rotate(45deg); opacity: .72; }
|
|
11256
|
-
.editor-picker-menu { position: absolute; top: calc(100% + 7px); right: 0; z-index: 2147483002; display: none; width: 188px; border: 1px solid var(--line, rgba(255,255,255,.14)); border-radius: 12px; background: var(--paper, #111113); padding: 6px; box-shadow: 0 18px 50px rgba(0,0,0,.32); }
|
|
11257
|
-
.editor-picker[data-open="true"] .editor-picker-menu { display: grid; gap: 2px; }
|
|
11258
|
-
.editor-picker-option { display: flex !important; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; border-radius: 8px !important; text-align: left; }
|
|
11259
|
-
.editor-picker-option:hover, .editor-picker-option.is-active { background: rgba(255,255,255,.06); color: var(--text, #f4f4f5); }
|
|
11260
|
-
.editor-icon { display: inline-flex; width: 18px; height: 18px; flex: 0 0 auto; align-items: center; justify-content: center; }
|
|
11261
|
-
.editor-icon svg { width: 18px; height: 18px; stroke-width: 2; }
|
|
11262
|
-
.editor-icon-vscode { color: #41a6f6; }
|
|
11263
|
-
.editor-icon-cursor { color: var(--text, #f4f4f5); }
|
|
11264
|
-
.editor-icon-finder { color: #4aa9ff; }
|
|
11265
|
-
.editor-icon-terminal { color: #73d99f; }
|
|
11266
|
-
.editor-icon-ghostty { color: #a78bfa; }
|
|
11267
|
-
.editor-icon-xcode { color: #54a7ff; }
|
|
11268
|
-
.editor-picker-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
|
|
11269
|
-
:root[data-agent-native-theme="light"] .editor-picker button { color: var(--soft, #4b4b4b); }
|
|
11270
|
-
:root[data-agent-native-theme="light"] .editor-picker button:hover, :root[data-agent-native-theme="light"] .editor-picker-option.is-active { background: rgba(0,0,0,.06); color: var(--text, #171717); }
|
|
11271
|
-
:root[data-agent-native-theme="light"] .editor-picker-menu { background: var(--paper, #ffffff); box-shadow: 0 18px 50px rgba(29,29,24,.13); }
|
|
11272
|
-
.visual-tabs[data-plan-tabs] { display: grid; gap: 14px; }
|
|
11273
|
-
.visual-tabs[data-plan-tabs] .tab-list { display: inline-flex; width: fit-content; max-width: 100%; gap: 8px; border: 0; border-radius: 0; background: transparent; padding: 0; overflow-x: auto; }
|
|
11274
|
-
.visual-tabs[data-plan-tabs] .tab-button { min-height: 30px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted, #a4a4aa); padding: 0 11px; font: 650 12px/30px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; white-space: nowrap; cursor: pointer; }
|
|
11275
|
-
.visual-tabs[data-plan-tabs] .tab-button:hover { color: var(--text, #f4f4f5); background: rgba(255,255,255,.05); }
|
|
11276
|
-
.visual-tabs[data-plan-tabs] .tab-button.is-active { border-color: var(--text, #f4f4f5); background: transparent; color: var(--text, #f4f4f5); }
|
|
11277
|
-
.visual-tabs[data-plan-tabs] .tab-button.is-active:hover { background: transparent; color: var(--text, #f4f4f5); }
|
|
11278
|
-
:root[data-agent-native-theme="light"] .visual-tabs[data-plan-tabs] .tab-button:hover { background: rgba(0,0,0,.06); }
|
|
11279
|
-
:root[data-agent-native-theme="light"] .visual-tabs[data-plan-tabs] .tab-button.is-active:hover { background: transparent; color: var(--text, #171717); }
|
|
11280
|
-
.visual-tabs[data-plan-tabs] .tab-panel { display: none; }
|
|
11281
|
-
.visual-tabs[data-plan-tabs] .tab-panel.is-active { display: block; }
|
|
11282
|
-
.implementation-map { margin: 24px 0; border-top: 1px solid var(--line, rgba(255,255,255,.14)); }
|
|
11283
|
-
.implementation-map-header { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; color: var(--muted, #a4a4aa); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
|
|
11284
|
-
.implementation-file-tabs { min-height: 330px; display: grid; grid-template-columns: minmax(220px, .44fr) minmax(0, 1fr); border-top: 1px solid var(--line, rgba(255,255,255,.14)); border-bottom: 1px solid var(--line, rgba(255,255,255,.14)); }
|
|
11285
|
-
.implementation-file-list { display: grid; align-content: start; border-right: 1px solid var(--line, rgba(255,255,255,.14)); }
|
|
11286
|
-
.implementation-file-tab { width: 100%; display: grid; gap: 3px; border: 0; border-bottom: 1px solid var(--line, rgba(255,255,255,.14)); background: transparent; color: var(--muted, #a4a4aa); padding: 13px 14px; text-align: left; cursor: pointer; }
|
|
11287
|
-
.implementation-file-tab:hover { background: rgba(255,255,255,.035); color: var(--soft, #d4d4d8); }
|
|
11288
|
-
.implementation-file-tab.is-active { background: var(--paper-2, rgba(255,255,255,.04)); color: var(--text, #f4f4f5); box-shadow: inset 2px 0 0 var(--accent, #00B5FF); }
|
|
11289
|
-
.file-tab-name, .file-tab-path { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
11290
|
-
.file-tab-name { font: 700 14px/1.35 "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
|
|
11291
|
-
.file-tab-path { font: 500 12px/1.35 "SFMono-Regular", Consolas, "Liberation Mono", monospace; color: var(--muted, #a4a4aa); }
|
|
11292
|
-
.implementation-file-tab.is-active .file-tab-path { color: var(--soft, #d4d4d8); }
|
|
11293
|
-
.implementation-file-panels { min-width: 0; }
|
|
11294
|
-
.implementation-file-panel { display: none; min-height: 100%; padding: 18px 20px 20px; border: 0 !important; }
|
|
11295
|
-
.implementation-file-panel.is-active { display: block; }
|
|
11296
|
-
.file-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line, rgba(255,255,255,.14)); }
|
|
11297
|
-
.file-title-stack { min-width: 0; display: grid; gap: 5px; }
|
|
11298
|
-
.file-name { margin: 0; color: var(--text, #f4f4f5); font: 750 18px/1.25 "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
|
|
11299
|
-
.file-path { margin: 0; overflow-wrap: anywhere; color: var(--muted, #a4a4aa); font: 500 12px/1.45 "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
|
|
11300
|
-
.file-detail-body { padding-top: 16px; }
|
|
11301
|
-
.file-summary { max-width: 760px; margin: 0; color: var(--soft, #d4d4d8); font-size: 15px; }
|
|
11302
|
-
.inline-code-preview { margin-top: 18px; overflow: hidden; border: 1px solid var(--line, rgba(255,255,255,.14)); border-radius: 10px; background: #0c0c0e; }
|
|
11303
|
-
.code-preview pre, .inline-code-preview pre { margin: 0 !important; max-height: 420px; overflow: auto; padding: 14px 16px !important; background: #0c0c0e !important; color: #e9e9ea; font: 12px/1.65 "SFMono-Regular", Consolas, "Liberation Mono", monospace !important; tab-size: 2; }
|
|
11304
|
-
.code-preview pre code, .inline-code-preview pre code { display: block !important; min-width: max-content; border: 0 !important; background: transparent !important; color: inherit !important; font: inherit !important; padding: 0 !important; white-space: pre !important; }
|
|
11305
|
-
.code-preview pre code *, .inline-code-preview pre code * { margin: 0 !important; border: 0 !important; border-radius: 0 !important; outline: 0 !important; background: transparent !important; background-image: none !important; box-shadow: none !important; padding: 0 !important; text-decoration: none !important; font: inherit !important; }
|
|
11306
|
-
.code-preview pre code code, .inline-code-preview pre code code { display: inline !important; }
|
|
11307
|
-
.syntax-keyword { color: #7cc7ff; }
|
|
11308
|
-
.syntax-string { color: #a6e3a1; }
|
|
11309
|
-
.syntax-literal { color: #c4b5fd; }
|
|
11310
|
-
.syntax-comment { color: #7a7a83; }
|
|
11311
|
-
.file-actions { display: flex; align-items: flex-start; gap: 8px; }
|
|
11312
|
-
@media (max-width: 760px) { .implementation-file-tabs { grid-template-columns: 1fr; } .implementation-file-list { border-right: 0; } .implementation-file-panels { border-top: 1px solid var(--line, rgba(255,255,255,.14)); } .implementation-map-header, .file-detail-header, .file-actions { flex-wrap: wrap; } }
|
|
11313
|
-
</style><script>
|
|
11314
|
-
(() => {
|
|
11315
|
-
const state = ${payload};
|
|
11316
|
-
const editorOptions = ${editorOptionsPayload};
|
|
11317
|
-
const editorIconMap = ${editorIconPayload};
|
|
11318
|
-
const root = document.documentElement;
|
|
11319
|
-
root.dataset.agentNativeTheme = state.theme || "dark";
|
|
11320
|
-
if (state.annotateMode) root.classList.add("an-plan-annotating");
|
|
11321
|
-
function removeEmptyPlanSections() {
|
|
11322
|
-
const candidates = Array.from(document.querySelectorAll("section[data-plan-section-id], section.plan-section, section[id]"));
|
|
11323
|
-
for (const section of candidates) {
|
|
11324
|
-
const text = (section.textContent || "").replace(/\\s+/g, " ").trim();
|
|
11325
|
-
const hasMedia = Boolean(section.querySelector("img,svg,canvas,video,iframe,table,pre,code,template,.visual,.flow-diagram,.wireframe-shell,.implementation-map,[data-plan-tabs],[data-agent-native-code-preview]"));
|
|
11326
|
-
if (!text && !hasMedia) section.remove();
|
|
11327
|
-
}
|
|
11328
|
-
}
|
|
11329
|
-
function initializePlanTabs() {
|
|
11330
|
-
const tabsets = Array.from(document.querySelectorAll("[data-plan-tabs]"));
|
|
11331
|
-
for (const tabset of tabsets) {
|
|
11332
|
-
const buttons = Array.from(tabset.querySelectorAll("[data-tab-target]"));
|
|
11333
|
-
const panels = Array.from(tabset.querySelectorAll("[data-tab-panel]"));
|
|
11334
|
-
if (buttons.length === 0 || panels.length === 0) continue;
|
|
11335
|
-
const activate = (target, notify = true) => {
|
|
11336
|
-
for (const button of buttons) {
|
|
11337
|
-
const isActive = button.getAttribute("data-tab-target") === target;
|
|
11338
|
-
button.classList.toggle("is-active", isActive);
|
|
11339
|
-
button.setAttribute("aria-selected", String(isActive));
|
|
11340
|
-
}
|
|
11341
|
-
for (const panel of panels) {
|
|
11342
|
-
panel.classList.toggle("is-active", panel.getAttribute("data-tab-panel") === target);
|
|
11343
|
-
}
|
|
11344
|
-
requestAnimationFrame(syncAnnotationMarkers);
|
|
11345
|
-
if (notify) {
|
|
11346
|
-
window.parent.postMessage({ type: "agent-native-plan-close-comment-popover" }, "*");
|
|
11347
|
-
}
|
|
11348
|
-
postDocState();
|
|
11349
|
-
};
|
|
11350
|
-
for (const button of buttons) {
|
|
11351
|
-
button.setAttribute("role", "tab");
|
|
11352
|
-
button.addEventListener("click", (event) => {
|
|
11353
|
-
event.preventDefault();
|
|
11354
|
-
event.stopPropagation();
|
|
11355
|
-
activate(button.getAttribute("data-tab-target") || "");
|
|
11356
|
-
});
|
|
11357
|
-
}
|
|
11358
|
-
for (const panel of panels) panel.setAttribute("role", "tabpanel");
|
|
11359
|
-
const initial = buttons.find((button) => button.classList.contains("is-active")) || buttons[0];
|
|
11360
|
-
activate(initial.getAttribute("data-tab-target") || "", false);
|
|
11361
|
-
}
|
|
11362
|
-
}
|
|
11363
|
-
function displayFilePath(rawPath) {
|
|
11364
|
-
return String(rawPath || "").replace(/\\s+/g, " ").trim().replace(/:\\d+$/, "");
|
|
11365
|
-
}
|
|
11366
|
-
function basenameForPath(path) {
|
|
11367
|
-
return path.split("/").filter(Boolean).pop() || path || "File";
|
|
11368
|
-
}
|
|
11369
|
-
function removeImplementationSymbolList(file) {
|
|
11370
|
-
file.querySelector(".symbol-list")?.remove();
|
|
11371
|
-
}
|
|
11372
|
-
function removeImplementationPreviewButtons(container) {
|
|
11373
|
-
for (const button of Array.from(container.querySelectorAll("[data-agent-native-code-preview]"))) {
|
|
11374
|
-
button.removeAttribute("data-agent-native-code-preview");
|
|
11375
|
-
button.removeAttribute("data-agent-native-hover-preview");
|
|
11376
|
-
if (button.tagName === "BUTTON" && button.closest(".file-actions")) button.remove();
|
|
11377
|
-
}
|
|
11378
|
-
}
|
|
11379
|
-
function inlinePreviewFromTemplate(template) {
|
|
11380
|
-
const preview = template?.content?.querySelector?.(".code-preview");
|
|
11381
|
-
if (!preview) return null;
|
|
11382
|
-
const clone = preview.cloneNode(true);
|
|
11383
|
-
clone.classList.add("inline-code-preview");
|
|
11384
|
-
clone.querySelector?.(".code-preview-title")?.remove?.();
|
|
11385
|
-
return clone;
|
|
11386
|
-
}
|
|
11387
|
-
function ensureInlineCodePreview(file) {
|
|
11388
|
-
const body = file.querySelector(".file-detail-body");
|
|
11389
|
-
const template = file.querySelector("template");
|
|
11390
|
-
if (body && !body.querySelector(".inline-code-preview")) {
|
|
11391
|
-
const inline = inlinePreviewFromTemplate(template);
|
|
11392
|
-
if (inline) body.appendChild(inline);
|
|
11393
|
-
}
|
|
11394
|
-
template?.remove?.();
|
|
11395
|
-
removeImplementationPreviewButtons(file);
|
|
11396
|
-
}
|
|
11397
|
-
function upgradeImplementationFileMaps() {
|
|
11398
|
-
const maps = Array.from(document.querySelectorAll(".implementation-map"));
|
|
11399
|
-
for (const map of maps) {
|
|
11400
|
-
const oldContainer = map.querySelector(":scope > .implementation-files");
|
|
11401
|
-
if (!oldContainer) {
|
|
11402
|
-
removeImplementationPreviewButtons(map);
|
|
11403
|
-
for (const file of Array.from(map.querySelectorAll(".implementation-file"))) {
|
|
11404
|
-
removeImplementationSymbolList(file);
|
|
11405
|
-
file.querySelector(".file-path span")?.remove();
|
|
11406
|
-
ensureInlineCodePreview(file);
|
|
11407
|
-
}
|
|
11408
|
-
continue;
|
|
11409
|
-
}
|
|
11410
|
-
const files = Array.from(oldContainer.querySelectorAll(":scope > .implementation-file"));
|
|
11411
|
-
if (files.length === 0) continue;
|
|
11412
|
-
map.dataset.planTabs = "true";
|
|
11413
|
-
oldContainer.className = "implementation-file-tabs";
|
|
11414
|
-
const list = document.createElement("div");
|
|
11415
|
-
list.className = "implementation-file-list";
|
|
11416
|
-
list.setAttribute("role", "tablist");
|
|
11417
|
-
list.setAttribute("aria-label", "Files touched");
|
|
11418
|
-
const panels = document.createElement("div");
|
|
11419
|
-
panels.className = "implementation-file-panels";
|
|
11420
|
-
oldContainer.replaceChildren(list, panels);
|
|
11421
|
-
files.forEach((file, index) => {
|
|
11422
|
-
const path = displayFilePath(file.getAttribute("data-file-path") || file.querySelector(".file-path")?.textContent || ("File " + (index + 1)));
|
|
11423
|
-
const existingActions = file.querySelector(":scope > .file-actions") || file.querySelector(".file-actions");
|
|
11424
|
-
const existingTemplates = Array.from(file.querySelectorAll(":scope > template"));
|
|
11425
|
-
const existingInfo = Array.from(file.children).find((child) => child !== existingActions && child.tagName !== "TEMPLATE");
|
|
11426
|
-
const summary = existingInfo?.querySelector?.(".file-summary") || file.querySelector(".file-summary");
|
|
11427
|
-
const legacyButtons = Array.from(existingActions?.querySelectorAll("[data-agent-native-open-editor]") || []);
|
|
11428
|
-
const vscodeHref = legacyButtons.map((button) => button.getAttribute("data-agent-native-open-editor") || "").find((href) => href.startsWith("vscode://file/")) || "";
|
|
11429
|
-
const cursorHref = legacyButtons.map((button) => button.getAttribute("data-agent-native-open-editor") || "").find((href) => href.startsWith("cursor://file/")) || "";
|
|
11430
|
-
const openFile = openFileFromHref(vscodeHref || cursorHref);
|
|
11431
|
-
const target = "runtime-file-" + index + "-" + path.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-|-$/g, "");
|
|
11432
|
-
const tab = document.createElement("button");
|
|
11433
|
-
tab.type = "button";
|
|
11434
|
-
tab.className = "implementation-file-tab" + (index === 0 ? " is-active" : "");
|
|
11435
|
-
tab.dataset.tabTarget = target;
|
|
11436
|
-
tab.dataset.filePath = path;
|
|
11437
|
-
if (openFile) tab.dataset.agentNativeOpenFile = openFile;
|
|
11438
|
-
tab.innerHTML = '<span class="file-tab-name"></span><span class="file-tab-path"></span>';
|
|
11439
|
-
tab.querySelector(".file-tab-name").textContent = basenameForPath(path);
|
|
11440
|
-
tab.querySelector(".file-tab-path").textContent = path;
|
|
11441
|
-
list.appendChild(tab);
|
|
11442
|
-
|
|
11443
|
-
file.className = "implementation-file implementation-file-panel tab-panel" + (index === 0 ? " is-active" : "");
|
|
11444
|
-
file.dataset.tabPanel = target;
|
|
11445
|
-
file.dataset.filePath = path;
|
|
11446
|
-
|
|
11447
|
-
const header = document.createElement("div");
|
|
11448
|
-
header.className = "file-detail-header";
|
|
11449
|
-
const title = document.createElement("div");
|
|
11450
|
-
title.className = "file-title-stack";
|
|
11451
|
-
title.innerHTML = '<p class="file-name"></p><p class="file-path"></p>';
|
|
11452
|
-
title.querySelector(".file-name").textContent = basenameForPath(path);
|
|
11453
|
-
title.querySelector(".file-path").textContent = path;
|
|
11454
|
-
header.appendChild(title);
|
|
11455
|
-
if (existingActions) header.appendChild(existingActions);
|
|
11456
|
-
|
|
11457
|
-
const body = document.createElement("div");
|
|
11458
|
-
body.className = "file-detail-body";
|
|
11459
|
-
if (summary) body.appendChild(summary);
|
|
11460
|
-
const inlinePreview = inlinePreviewFromTemplate(existingTemplates[0]);
|
|
11461
|
-
if (inlinePreview) body.appendChild(inlinePreview);
|
|
11462
|
-
|
|
11463
|
-
removeImplementationPreviewButtons(file);
|
|
11464
|
-
file.replaceChildren(header, body);
|
|
11465
|
-
removeImplementationSymbolList(file);
|
|
11466
|
-
ensureInlineCodePreview(file);
|
|
11467
|
-
panels.appendChild(file);
|
|
11468
|
-
});
|
|
11469
|
-
}
|
|
11470
|
-
}
|
|
11471
|
-
const editorValues = editorOptions.map((option) => option.value);
|
|
11472
|
-
let preferredEditor = normalizeEditor(state.preferredEditor);
|
|
11473
|
-
function normalizeEditor(value) {
|
|
11474
|
-
return editorValues.includes(value) ? value : "vscode";
|
|
11475
|
-
}
|
|
11476
|
-
function editorLabel(editor) {
|
|
11477
|
-
return editorOptions.find((option) => option.value === editor)?.label || "VS Code";
|
|
11478
|
-
}
|
|
11479
|
-
function editorIconHtml(editor) {
|
|
11480
|
-
const normalized = normalizeEditor(editor);
|
|
11481
|
-
return '<span class="editor-icon editor-icon-' + normalized + '">' + (editorIconMap[normalized] || "") + '</span>';
|
|
11482
|
-
}
|
|
11483
|
-
function editorTriggerHtml(editor) {
|
|
11484
|
-
const normalized = normalizeEditor(editor);
|
|
11485
|
-
return editorIconHtml(normalized) + '<span class="editor-picker-sr">Preferred editor: ' + editorLabel(normalized) + '</span><span class="editor-picker-caret" aria-hidden="true"></span>';
|
|
11486
|
-
}
|
|
11487
|
-
function editorSelectOptionsHtml() {
|
|
11488
|
-
return editorOptions.map(({ value, label }) => '<option value="' + value + '">' + label + '</option>').join(""); // i18n-ignore generated editor picker markup with stable app labels
|
|
11489
|
-
}
|
|
11490
|
-
function editorMenuHtml(activeEditor) {
|
|
11491
|
-
const active = normalizeEditor(activeEditor);
|
|
11492
|
-
return editorOptions.map(({ value, label }) => {
|
|
11493
|
-
const selected = value === active;
|
|
11494
|
-
return '<button type="button" class="editor-picker-option' + (selected ? " is-active" : "") + '" data-agent-native-editor-option="' + value + '" role="menuitemradio" aria-checked="' + (selected ? "true" : "false") + '">' + editorIconHtml(value) + '<span>' + label + '</span></button>'; // i18n-ignore generated editor picker markup with stable app labels
|
|
11495
|
-
}).join("");
|
|
11496
|
-
}
|
|
11497
|
-
function closeEditorMenus(exceptPicker) {
|
|
11498
|
-
for (const picker of document.querySelectorAll("[data-agent-native-editor-picker]")) {
|
|
11499
|
-
if (picker !== exceptPicker) {
|
|
11500
|
-
picker.removeAttribute("data-open");
|
|
11501
|
-
picker.querySelector("[data-agent-native-editor-trigger]")?.setAttribute("aria-expanded", "false");
|
|
11502
|
-
}
|
|
11503
|
-
}
|
|
11504
|
-
}
|
|
11505
|
-
function setPreferredEditor(editor, notifyParent) {
|
|
11506
|
-
preferredEditor = normalizeEditor(editor);
|
|
11507
|
-
for (const picker of document.querySelectorAll("[data-agent-native-editor-picker]")) {
|
|
11508
|
-
picker.dataset.editor = preferredEditor;
|
|
11509
|
-
const trigger = picker.querySelector("[data-agent-native-editor-trigger]");
|
|
11510
|
-
if (trigger) {
|
|
11511
|
-
trigger.innerHTML = editorTriggerHtml(preferredEditor);
|
|
11512
|
-
trigger.setAttribute("aria-label", "Choose editor. Current: " + editorLabel(preferredEditor));
|
|
11513
|
-
}
|
|
11514
|
-
const select = picker.querySelector("[data-agent-native-editor-select]");
|
|
11515
|
-
if (select) select.value = preferredEditor;
|
|
11516
|
-
const menu = picker.querySelector("[data-agent-native-editor-menu]");
|
|
11517
|
-
if (menu) menu.innerHTML = editorMenuHtml(preferredEditor);
|
|
11518
|
-
}
|
|
11519
|
-
if (notifyParent) {
|
|
11520
|
-
window.parent.postMessage({ type: "agent-native-plan-editor-preference", editor: preferredEditor }, "*");
|
|
11521
|
-
}
|
|
11522
|
-
}
|
|
11523
|
-
function splitFileLocation(filePath, explicitLine) {
|
|
11524
|
-
const value = filePath || "";
|
|
11525
|
-
const match = value.match(/^(.*?)(?::(\\d+)(?::(\\d+))?)?$/);
|
|
11526
|
-
return {
|
|
11527
|
-
path: match?.[1] || value,
|
|
11528
|
-
line: explicitLine || match?.[2] || "",
|
|
11529
|
-
column: match?.[3] || "1"
|
|
11530
|
-
};
|
|
11531
|
-
}
|
|
11532
|
-
function openFileFromHref(href) {
|
|
11533
|
-
const match = String(href || "").match(/^(?:vscode|cursor):\\/\\/file(.+)$/);
|
|
11534
|
-
return match?.[1] ? decodeURI(match[1]) : "";
|
|
11535
|
-
}
|
|
11536
|
-
function directoryForPath(filePath) {
|
|
11537
|
-
const index = filePath.lastIndexOf("/");
|
|
11538
|
-
return index > 0 ? filePath.slice(0, index) : filePath;
|
|
11539
|
-
}
|
|
11540
|
-
function hrefForEditor(editor, filePath, line) {
|
|
11541
|
-
if (!filePath) return "";
|
|
11542
|
-
const normalized = normalizeEditor(editor);
|
|
11543
|
-
const location = splitFileLocation(filePath, line);
|
|
11544
|
-
const lineSuffix = location.line ? ":" + location.line + ":" + location.column : "";
|
|
11545
|
-
if (normalized === "finder") return "file://" + encodeURI(location.path);
|
|
11546
|
-
if (normalized === "xcode") {
|
|
11547
|
-
return "xcode://open?url=" + encodeURIComponent("file://" + location.path) + (location.line ? "&line=" + encodeURIComponent(location.line) : ""); // i18n-ignore stable editor URL scheme
|
|
11548
|
-
}
|
|
11549
|
-
if (normalized === "terminal") {
|
|
11550
|
-
return "terminal://open?path=" + encodeURIComponent(directoryForPath(location.path)); // i18n-ignore stable editor URL scheme
|
|
11551
|
-
}
|
|
11552
|
-
if (normalized === "ghostty") {
|
|
11553
|
-
return "ghostty://open?path=" + encodeURIComponent(directoryForPath(location.path)); // i18n-ignore stable editor URL scheme
|
|
11554
|
-
}
|
|
11555
|
-
return normalized + "://file" + encodeURI(location.path) + lineSuffix;
|
|
11556
|
-
}
|
|
11557
|
-
function createEditorPicker(openFile, hrefs = {}, line = "") {
|
|
11558
|
-
const picker = document.createElement("div");
|
|
11559
|
-
picker.className = "editor-picker";
|
|
11560
|
-
picker.dataset.agentNativeEditorPicker = "true";
|
|
11561
|
-
picker.dataset.editor = preferredEditor;
|
|
11562
|
-
const trigger = document.createElement("button");
|
|
11563
|
-
trigger.type = "button";
|
|
11564
|
-
trigger.className = "editor-picker-trigger";
|
|
11565
|
-
trigger.dataset.agentNativeEditorTrigger = "true";
|
|
11566
|
-
trigger.setAttribute("aria-haspopup", "menu");
|
|
11567
|
-
trigger.setAttribute("aria-expanded", "false");
|
|
11568
|
-
trigger.setAttribute("aria-label", "Choose editor. Current: " + editorLabel(preferredEditor));
|
|
11569
|
-
trigger.innerHTML = editorTriggerHtml(preferredEditor);
|
|
11570
|
-
const select = document.createElement("select");
|
|
11571
|
-
select.className = "editor-picker-select";
|
|
11572
|
-
select.dataset.agentNativeEditorSelect = "true";
|
|
11573
|
-
select.setAttribute("aria-hidden", "true");
|
|
11574
|
-
select.setAttribute("tabindex", "-1");
|
|
11575
|
-
select.innerHTML = editorSelectOptionsHtml();
|
|
11576
|
-
const menu = document.createElement("div");
|
|
11577
|
-
menu.className = "editor-picker-menu";
|
|
11578
|
-
menu.dataset.agentNativeEditorMenu = "true";
|
|
11579
|
-
menu.setAttribute("role", "menu");
|
|
11580
|
-
menu.innerHTML = editorMenuHtml(preferredEditor);
|
|
11581
|
-
const open = document.createElement("button");
|
|
11582
|
-
open.type = "button";
|
|
11583
|
-
open.className = "editor-picker-open";
|
|
11584
|
-
open.textContent = "Open";
|
|
11585
|
-
open.dataset.agentNativeOpenSelectedEditor = "true";
|
|
11586
|
-
if (openFile) open.dataset.agentNativeOpenFile = openFile;
|
|
11587
|
-
if (line) open.dataset.agentNativeOpenLine = line;
|
|
11588
|
-
if (hrefs.vscode) open.dataset.agentNativeOpenVscode = hrefs.vscode;
|
|
11589
|
-
if (hrefs.cursor) open.dataset.agentNativeOpenCursor = hrefs.cursor;
|
|
11590
|
-
picker.append(trigger, select, menu, open);
|
|
11591
|
-
return picker;
|
|
11592
|
-
}
|
|
11593
|
-
function upgradeEditorPickerElement(picker) {
|
|
11594
|
-
if (picker.querySelector("[data-agent-native-editor-trigger]")) return;
|
|
11595
|
-
const select = picker.querySelector("[data-agent-native-editor-select]");
|
|
11596
|
-
const open = picker.querySelector("[data-agent-native-open-selected-editor], [data-agent-native-open-file]") || document.createElement("button");
|
|
11597
|
-
const editor = normalizeEditor(select?.value || picker.dataset.editor || preferredEditor);
|
|
11598
|
-
const openFile = open.getAttribute?.("data-agent-native-open-file") || "";
|
|
11599
|
-
const openLine = open.getAttribute?.("data-agent-native-open-line") || "";
|
|
11600
|
-
const vscode = open.getAttribute?.("data-agent-native-open-vscode") || "";
|
|
11601
|
-
const cursor = open.getAttribute?.("data-agent-native-open-cursor") || "";
|
|
11602
|
-
const upgraded = createEditorPicker(openFile, { vscode, cursor }, openLine);
|
|
11603
|
-
picker.replaceChildren(...Array.from(upgraded.childNodes));
|
|
11604
|
-
picker.className = "editor-picker";
|
|
11605
|
-
picker.dataset.agentNativeEditorPicker = "true";
|
|
11606
|
-
picker.dataset.editor = editor;
|
|
11607
|
-
}
|
|
11608
|
-
function initializeEditorPickers() {
|
|
11609
|
-
const actionGroups = Array.from(document.querySelectorAll(".file-actions"));
|
|
11610
|
-
for (const actions of actionGroups) {
|
|
11611
|
-
if (actions.querySelector("[data-agent-native-editor-picker]")) {
|
|
11612
|
-
for (const picker of Array.from(actions.querySelectorAll("[data-agent-native-editor-picker]"))) {
|
|
11613
|
-
upgradeEditorPickerElement(picker);
|
|
11614
|
-
}
|
|
11615
|
-
continue;
|
|
11616
|
-
}
|
|
11617
|
-
const legacyButtons = Array.from(actions.querySelectorAll("[data-agent-native-open-editor]"));
|
|
11618
|
-
if (legacyButtons.length === 0) continue;
|
|
11619
|
-
const hrefs = {};
|
|
11620
|
-
for (const button of legacyButtons) {
|
|
11621
|
-
const href = button.getAttribute("data-agent-native-open-editor") || "";
|
|
11622
|
-
if (href.startsWith("cursor://file/")) hrefs.cursor = href;
|
|
11623
|
-
if (href.startsWith("vscode://file/")) hrefs.vscode = href;
|
|
11624
|
-
button.remove();
|
|
11625
|
-
}
|
|
11626
|
-
const openFile = openFileFromHref(hrefs.vscode || hrefs.cursor);
|
|
11627
|
-
if (!openFile && !hrefs.cursor && !hrefs.vscode) continue;
|
|
11628
|
-
actions.appendChild(createEditorPicker(openFile, hrefs));
|
|
11629
|
-
}
|
|
11630
|
-
for (const picker of Array.from(document.querySelectorAll("[data-agent-native-editor-picker]"))) {
|
|
11631
|
-
upgradeEditorPickerElement(picker);
|
|
11632
|
-
}
|
|
11633
|
-
setPreferredEditor(preferredEditor, false);
|
|
11634
|
-
}
|
|
11635
|
-
function escapeCodeHtml(value) {
|
|
11636
|
-
return String(value || "")
|
|
11637
|
-
.replace(/&/g, "&")
|
|
11638
|
-
.replace(/</g, "<")
|
|
11639
|
-
.replace(/>/g, ">")
|
|
11640
|
-
.replace(/"/g, """)
|
|
11641
|
-
.replace(/'/g, "'");
|
|
11642
|
-
}
|
|
11643
|
-
function highlightPlainCodeBlocks() {
|
|
11644
|
-
const blocks = Array.from(document.querySelectorAll(".code-preview pre, .inline-code-preview pre"));
|
|
11645
|
-
for (const pre of blocks) {
|
|
11646
|
-
const target = pre.querySelector("code") || pre;
|
|
11647
|
-
if (target.querySelector(".syntax-keyword,.syntax-string,.syntax-literal,.syntax-comment")) continue;
|
|
11648
|
-
const text = target.textContent || "";
|
|
11649
|
-
if (!text.trim()) continue;
|
|
11650
|
-
let html = escapeCodeHtml(text);
|
|
11651
|
-
html = html
|
|
11652
|
-
.replace(/("[^&]*(?:")|'[^&]*(?:')|\`[^\`]*\`)/g, '<span class="syntax-string">$1</span>')
|
|
11653
|
-
.replace(/\\b(import|export|from|const|let|var|function|return|type|interface|class|extends|async|await|if|else|for|while|new|throw|try|catch|switch|case|default)\\b/g, '<span class="syntax-keyword">$1</span>')
|
|
11654
|
-
.replace(/\\b(true|false|null|undefined)\\b/g, '<span class="syntax-literal">$1</span>')
|
|
11655
|
-
.replace(/(^|\\n)(\\s*\\/\\/.*)/g, '$1<span class="syntax-comment">$2</span>');
|
|
11656
|
-
target.innerHTML = html;
|
|
11657
|
-
}
|
|
11658
|
-
}
|
|
11659
|
-
function setRuntimeAnnotateMode(value) {
|
|
11660
|
-
state.annotateMode = Boolean(value);
|
|
11661
|
-
root.classList.toggle("an-plan-annotating", state.annotateMode);
|
|
11662
|
-
if (state.annotateMode) {
|
|
11663
|
-
closeEditorMenus();
|
|
11664
|
-
hideCodePopover();
|
|
11665
|
-
hideSelectionToolbar();
|
|
11666
|
-
} else {
|
|
11667
|
-
hideSelectionToolbar();
|
|
11668
|
-
}
|
|
11669
|
-
postDocState();
|
|
11670
|
-
}
|
|
11671
|
-
function setRuntimeTheme(theme) {
|
|
11672
|
-
state.theme = theme === "light" ? "light" : "dark";
|
|
11673
|
-
root.dataset.agentNativeTheme = state.theme;
|
|
11674
|
-
}
|
|
11675
|
-
function restoreDocumentScroll(savedState) {
|
|
11676
|
-
if (!savedState) return;
|
|
11677
|
-
const doc = document.documentElement;
|
|
11678
|
-
const scrollWidth = Math.max(doc.scrollWidth, document.body?.scrollWidth || 0);
|
|
11679
|
-
const scrollHeight = Math.max(doc.scrollHeight, document.body?.scrollHeight || 0);
|
|
11680
|
-
const x =
|
|
11681
|
-
typeof savedState.scrollX === "number"
|
|
11682
|
-
? savedState.scrollX * (scrollWidth / Math.max(savedState.scrollWidth || scrollWidth, 1))
|
|
11683
|
-
: 0;
|
|
11684
|
-
const y =
|
|
11685
|
-
typeof savedState.scrollY === "number"
|
|
11686
|
-
? savedState.scrollY * (scrollHeight / Math.max(savedState.scrollHeight || scrollHeight, 1))
|
|
11687
|
-
: 0;
|
|
11688
|
-
requestAnimationFrame(() => {
|
|
11689
|
-
window.scrollTo(x, y);
|
|
11690
|
-
syncAnnotationMarkers();
|
|
11691
|
-
postDocState();
|
|
11692
|
-
requestAnimationFrame(postDocState);
|
|
11693
|
-
});
|
|
11694
|
-
}
|
|
11695
|
-
window.addEventListener("message", (event) => {
|
|
11696
|
-
const data = event.data || {};
|
|
11697
|
-
if (data.type !== "agent-native-plan-runtime-state") return;
|
|
11698
|
-
if (typeof data.parentOrigin === "string" && data.parentOrigin && data.parentOrigin !== "null") {
|
|
11699
|
-
window.__agentNativePlanParentOrigin = data.parentOrigin;
|
|
11700
|
-
}
|
|
11701
|
-
if (typeof data.theme === "string") setRuntimeTheme(data.theme);
|
|
11702
|
-
if (typeof data.preferredEditor === "string") {
|
|
11703
|
-
setPreferredEditor(data.preferredEditor, false);
|
|
11704
|
-
}
|
|
11705
|
-
if (typeof data.annotateMode === "boolean") {
|
|
11706
|
-
setRuntimeAnnotateMode(data.annotateMode);
|
|
11707
|
-
}
|
|
11708
|
-
if (data.restoreScroll) restoreDocumentScroll(data.restoreScroll);
|
|
11709
|
-
});
|
|
11710
|
-
function postDocState() {
|
|
11711
|
-
const doc = document.documentElement;
|
|
11712
|
-
window.parent.postMessage({
|
|
11713
|
-
type: "agent-native-plan-doc-state",
|
|
11714
|
-
state: {
|
|
11715
|
-
scrollX: window.scrollX || doc.scrollLeft || 0,
|
|
11716
|
-
scrollY: window.scrollY || doc.scrollTop || 0,
|
|
11717
|
-
scrollWidth: Math.max(doc.scrollWidth, document.body?.scrollWidth || 0),
|
|
11718
|
-
scrollHeight: Math.max(doc.scrollHeight, document.body?.scrollHeight || 0),
|
|
11719
|
-
clientWidth: doc.clientWidth,
|
|
11720
|
-
clientHeight: doc.clientHeight
|
|
11721
|
-
}
|
|
11722
|
-
}, "*");
|
|
11723
|
-
}
|
|
11724
|
-
let annotationMarkerSyncFrame = 0;
|
|
11725
|
-
function scheduleAnnotationMarkerSync() {
|
|
11726
|
-
if (annotationMarkerSyncFrame) return;
|
|
11727
|
-
annotationMarkerSyncFrame = requestAnimationFrame(() => {
|
|
11728
|
-
annotationMarkerSyncFrame = 0;
|
|
11729
|
-
syncAnnotationMarkers();
|
|
11730
|
-
});
|
|
11731
|
-
}
|
|
11732
|
-
function markerAuthorFromItem(item) {
|
|
11733
|
-
return {
|
|
11734
|
-
authorName: item.authorName,
|
|
11735
|
-
authorEmail: item.authorEmail,
|
|
11736
|
-
authorAvatarUrl: item.authorAvatarUrl,
|
|
11737
|
-
authorColor: item.authorColor,
|
|
11738
|
-
authorInitials: item.authorInitials
|
|
11739
|
-
};
|
|
11740
|
-
}
|
|
11741
|
-
function createMarkerFace(author) {
|
|
11742
|
-
const face = document.createElement("span");
|
|
11743
|
-
face.className = "an-plan-marker-face";
|
|
11744
|
-
face.style.setProperty("--author-color", author.authorColor || "#00B5FF");
|
|
11745
|
-
const fallback = document.createElement("span");
|
|
11746
|
-
fallback.className = "an-plan-marker-initials";
|
|
11747
|
-
fallback.textContent = author.authorInitials || "?";
|
|
11748
|
-
if (author.authorAvatarUrl) {
|
|
11749
|
-
const image = document.createElement("img");
|
|
11750
|
-
image.className = "an-plan-marker-avatar";
|
|
11751
|
-
image.src = author.authorAvatarUrl;
|
|
11752
|
-
image.alt = author.authorName || "Comment author";
|
|
11753
|
-
image.addEventListener("error", () => {
|
|
11754
|
-
image.replaceWith(fallback);
|
|
11755
|
-
});
|
|
11756
|
-
face.appendChild(image);
|
|
11757
|
-
} else {
|
|
11758
|
-
face.appendChild(fallback);
|
|
11759
|
-
}
|
|
11760
|
-
return face;
|
|
11761
|
-
}
|
|
11762
|
-
function setMarkerThreadFaces(marker, item) {
|
|
11763
|
-
const participants = Array.isArray(item.participants) && item.participants.length
|
|
11764
|
-
? item.participants
|
|
11765
|
-
: [markerAuthorFromItem(item)];
|
|
11766
|
-
const count = Math.max(1, Number(item.commentCount || 1));
|
|
11767
|
-
const single = participants.length <= 1 && count <= 1;
|
|
11768
|
-
marker.dataset.single = String(single);
|
|
11769
|
-
marker.style.setProperty("--author-color", participants[0]?.authorColor || item.authorColor || "#00B5FF");
|
|
11770
|
-
const stack = document.createElement("span");
|
|
11771
|
-
stack.className = "an-plan-marker-stack";
|
|
11772
|
-
for (const author of participants.slice(0, 2)) {
|
|
11773
|
-
stack.appendChild(createMarkerFace(author));
|
|
11774
|
-
}
|
|
11775
|
-
marker.replaceChildren(stack);
|
|
11776
|
-
if (!single) {
|
|
11777
|
-
const countLabel = document.createElement("span");
|
|
11778
|
-
countLabel.className = "an-plan-marker-count";
|
|
11779
|
-
countLabel.textContent = count > 99 ? "99+" : String(count);
|
|
11780
|
-
marker.appendChild(countLabel);
|
|
11781
|
-
}
|
|
11782
|
-
}
|
|
11783
|
-
removeEmptyPlanSections();
|
|
11784
|
-
upgradeImplementationFileMaps();
|
|
11785
|
-
initializePlanTabs();
|
|
11786
|
-
initializeEditorPickers();
|
|
11787
|
-
highlightPlainCodeBlocks();
|
|
11788
|
-
postDocState();
|
|
11789
|
-
window.addEventListener("scroll", postDocState, { passive: true });
|
|
11790
|
-
window.addEventListener("resize", () => {
|
|
11791
|
-
scheduleAnnotationMarkerSync();
|
|
11792
|
-
postDocState();
|
|
11793
|
-
});
|
|
11794
|
-
window.addEventListener("agent-native-plan-board-layout-change", () => {
|
|
11795
|
-
scheduleAnnotationMarkerSync();
|
|
11796
|
-
postDocState();
|
|
11797
|
-
});
|
|
11798
|
-
function pct(value, total) {
|
|
11799
|
-
return Math.max(0, Math.min(100, Number(((value / Math.max(total, 1)) * 100).toFixed(3))));
|
|
11800
|
-
}
|
|
11801
|
-
function closestSection(target) {
|
|
11802
|
-
if (!(target instanceof Element)) return null;
|
|
11803
|
-
return target.closest("[data-plan-section-id], section[id], article[id], [id]");
|
|
11804
|
-
}
|
|
11805
|
-
function normalizeText(value) {
|
|
11806
|
-
return String(value || "").replace(/\\s+/g, " ").trim();
|
|
11807
|
-
}
|
|
11808
|
-
function textSnippet(target) {
|
|
11809
|
-
if (!(target instanceof Element)) return "";
|
|
11810
|
-
const text = normalizeText(target.innerText || target.textContent || "");
|
|
11811
|
-
return text.slice(0, 90);
|
|
11812
|
-
}
|
|
11813
|
-
function closestTextContext(target) {
|
|
11814
|
-
if (!(target instanceof Element)) return "";
|
|
11815
|
-
const selector = [
|
|
11816
|
-
"p",
|
|
11817
|
-
"li",
|
|
11818
|
-
"h1",
|
|
11819
|
-
"h2",
|
|
11820
|
-
"h3",
|
|
11821
|
-
"h4",
|
|
11822
|
-
"td",
|
|
11823
|
-
"th",
|
|
11824
|
-
"blockquote",
|
|
11825
|
-
"figcaption",
|
|
11826
|
-
"summary",
|
|
11827
|
-
"button",
|
|
11828
|
-
"a",
|
|
11829
|
-
"label",
|
|
11830
|
-
"pre",
|
|
11831
|
-
"code",
|
|
11832
|
-
"[data-plan-text]"
|
|
11833
|
-
].join(",");
|
|
11834
|
-
const direct = target.matches(selector) ? target : target.closest(selector);
|
|
11835
|
-
const candidates = [direct, target, target.parentElement, closestSection(target)].filter(Boolean);
|
|
11836
|
-
for (const candidate of candidates) {
|
|
11837
|
-
const text = normalizeText(candidate.innerText || candidate.textContent || "");
|
|
11838
|
-
if (text.length >= 8) return text.slice(0, 220);
|
|
11839
|
-
}
|
|
11840
|
-
return "";
|
|
11841
|
-
}
|
|
11842
|
-
function closestVisualContext(target) {
|
|
11843
|
-
if (!(target instanceof Element)) return null;
|
|
11844
|
-
return target.closest(".wireframe-shell,.mock-browser,.mock-plan,.mock-sidebar,.diagram-card,.flow-diagram,svg,canvas,img,figure,[data-plan-visual],[data-visual]");
|
|
11845
|
-
}
|
|
11846
|
-
function visualLabel(visual, section) {
|
|
11847
|
-
if (!(visual instanceof Element)) return "";
|
|
11848
|
-
return normalizeText(
|
|
11849
|
-
visual.getAttribute("aria-label") ||
|
|
11850
|
-
visual.getAttribute("data-label") ||
|
|
11851
|
-
visual.querySelector?.("strong,h3,h4")?.textContent ||
|
|
11852
|
-
sectionTitle(section) ||
|
|
11853
|
-
"Visual"
|
|
11854
|
-
);
|
|
11855
|
-
}
|
|
11856
|
-
function clamp(value, min, max) {
|
|
11857
|
-
return Math.max(min, Math.min(max, value));
|
|
11858
|
-
}
|
|
11859
|
-
function cssEscape(value) {
|
|
11860
|
-
if (window.CSS?.escape) return window.CSS.escape(String(value));
|
|
11861
|
-
return String(value).replace(/[^a-zA-Z0-9_-]/g, (char) => "\\\\" + char);
|
|
11862
|
-
}
|
|
11863
|
-
function cssAttr(value) {
|
|
11864
|
-
return String(value || "").replace(/\\\\/g, "\\\\\\\\").replace(/"/g, '\\"');
|
|
11865
|
-
}
|
|
11866
|
-
function uniqueSelector(selector) {
|
|
11867
|
-
try {
|
|
11868
|
-
return document.querySelectorAll(selector).length === 1;
|
|
11869
|
-
} catch {
|
|
11870
|
-
return false;
|
|
11871
|
-
}
|
|
11872
|
-
}
|
|
11873
|
-
function selectorForElement(element) {
|
|
11874
|
-
if (!(element instanceof Element)) return "";
|
|
11875
|
-
if (element.id) {
|
|
11876
|
-
const selector = "#" + cssEscape(element.id);
|
|
11877
|
-
if (uniqueSelector(selector)) return selector;
|
|
11878
|
-
}
|
|
11879
|
-
for (const attr of ["data-plan-section-id", "data-tab-panel", "data-file-path"]) {
|
|
11880
|
-
const value = element.getAttribute(attr);
|
|
11881
|
-
if (!value) continue;
|
|
11882
|
-
const selector = element.tagName.toLowerCase() + "[" + attr + '="' + cssAttr(value) + '"]';
|
|
11883
|
-
if (uniqueSelector(selector)) return selector;
|
|
11884
|
-
}
|
|
11885
|
-
const parts = [];
|
|
11886
|
-
let current = element;
|
|
11887
|
-
while (current && current !== document.body && current !== document.documentElement) {
|
|
11888
|
-
let part = current.tagName.toLowerCase();
|
|
11889
|
-
const parent = current.parentElement;
|
|
11890
|
-
if (!parent) break;
|
|
11891
|
-
const sameTagSiblings = Array.from(parent.children).filter((child) => child.tagName === current.tagName);
|
|
11892
|
-
if (sameTagSiblings.length > 1) {
|
|
11893
|
-
part += ":nth-of-type(" + (sameTagSiblings.indexOf(current) + 1) + ")";
|
|
11894
|
-
}
|
|
11895
|
-
parts.unshift(part);
|
|
11896
|
-
const selector = "body > " + parts.join(" > ");
|
|
11897
|
-
if (uniqueSelector(selector)) return selector;
|
|
11898
|
-
current = parent;
|
|
11899
|
-
}
|
|
11900
|
-
return parts.length ? "body > " + parts.join(" > ") : "";
|
|
11901
|
-
}
|
|
11902
|
-
function anchorTargetForElement(element) {
|
|
11903
|
-
if (!(element instanceof Element)) return null;
|
|
11904
|
-
const visual = closestVisualContext(element);
|
|
11905
|
-
if (visual) return visual;
|
|
11906
|
-
return closestTextElement(element) || element.closest("[data-tab-panel], [data-plan-section-id], section[id], article[id]") || element;
|
|
11907
|
-
}
|
|
11908
|
-
function withTargetAnchor(anchor, target, clientX, clientY) {
|
|
11909
|
-
const targetElement = anchorTargetForElement(target);
|
|
11910
|
-
const rect = targetElement?.getBoundingClientRect?.();
|
|
11911
|
-
if (!targetElement || !rect || (!rect.width && !rect.height)) return anchor;
|
|
11912
|
-
return {
|
|
11913
|
-
...anchor,
|
|
11914
|
-
targetSelector: selectorForElement(targetElement) || undefined,
|
|
11915
|
-
targetX: pct(clamp(clientX, rect.left, rect.right) - rect.left, rect.width),
|
|
11916
|
-
targetY: pct(clamp(clientY, rect.top, rect.bottom) - rect.top, rect.height)
|
|
11917
|
-
};
|
|
11918
|
-
}
|
|
11919
|
-
function ensureLayer() {
|
|
11920
|
-
let layer = document.querySelector(".an-plan-annotation-layer");
|
|
11921
|
-
if (!layer) {
|
|
11922
|
-
layer = document.createElement("div");
|
|
11923
|
-
layer.className = "an-plan-annotation-layer";
|
|
11924
|
-
document.body.style.position = document.body.style.position || "relative";
|
|
11925
|
-
document.body.appendChild(layer);
|
|
11926
|
-
}
|
|
11927
|
-
return layer;
|
|
11928
|
-
}
|
|
11929
|
-
function sectionForNode(node) {
|
|
11930
|
-
const element = node instanceof Element ? node : node?.parentElement;
|
|
11931
|
-
return closestSection(element);
|
|
11932
|
-
}
|
|
11933
|
-
function sectionTitle(section) {
|
|
11934
|
-
return section?.querySelector?.("h1,h2,h3,[data-plan-section-title]")?.textContent?.replace(/\\s+/g, " ").trim() || "";
|
|
11935
|
-
}
|
|
11936
|
-
function tabContextForElement(element) {
|
|
11937
|
-
if (!(element instanceof Element)) return {};
|
|
11938
|
-
const panel = element.closest("[data-tab-panel]");
|
|
11939
|
-
const tabPanelId = panel?.getAttribute("data-tab-panel") || "";
|
|
11940
|
-
if (!tabPanelId) return {};
|
|
11941
|
-
const tabset = panel.closest("[data-plan-tabs]");
|
|
11942
|
-
const tabButton = Array.from(tabset?.querySelectorAll("[data-tab-target]") || []).find((button) => button.getAttribute("data-tab-target") === tabPanelId);
|
|
11943
|
-
const tabLabel = normalizeText(tabButton?.textContent || panel.getAttribute("aria-label") || "");
|
|
11944
|
-
return {
|
|
11945
|
-
tabPanelId,
|
|
11946
|
-
tabLabel: tabLabel || undefined
|
|
11947
|
-
};
|
|
11948
|
-
}
|
|
11949
|
-
function tabContextForPoint(anchor) {
|
|
11950
|
-
if (!anchor || anchor.tabPanelId) return {};
|
|
11951
|
-
const doc = document.documentElement;
|
|
11952
|
-
const clientX = (anchor.x / 100) * doc.scrollWidth - window.scrollX;
|
|
11953
|
-
const clientY = (anchor.y / 100) * Math.max(doc.scrollHeight, document.body.scrollHeight) - window.scrollY;
|
|
11954
|
-
const element = document.elementFromPoint(clientX, clientY);
|
|
11955
|
-
return tabContextForElement(element);
|
|
11956
|
-
}
|
|
11957
|
-
function isTabContextActive(tabPanelId) {
|
|
11958
|
-
if (!tabPanelId) return true;
|
|
11959
|
-
const panel = Array.from(document.querySelectorAll("[data-tab-panel]")).find((candidate) => candidate.getAttribute("data-tab-panel") === tabPanelId);
|
|
11960
|
-
return Boolean(panel?.classList.contains("is-active"));
|
|
11961
|
-
}
|
|
11962
|
-
function elementTabPanelId(element) {
|
|
11963
|
-
if (!(element instanceof Element)) return "";
|
|
11964
|
-
return element.closest("[data-tab-panel]")?.getAttribute("data-tab-panel") || "";
|
|
11965
|
-
}
|
|
11966
|
-
function isElementTabActive(element) {
|
|
11967
|
-
const tabPanelId = elementTabPanelId(element);
|
|
11968
|
-
return !tabPanelId || isTabContextActive(tabPanelId);
|
|
11969
|
-
}
|
|
11970
|
-
function resolveAnchorTarget(anchor) {
|
|
11971
|
-
if (!anchor) return null;
|
|
11972
|
-
if (anchor.targetSelector) {
|
|
11973
|
-
try {
|
|
11974
|
-
const target = document.querySelector(anchor.targetSelector);
|
|
11975
|
-
if (target) return target;
|
|
11976
|
-
} catch {
|
|
11977
|
-
// Ignore stale selectors and fall back to quote matching.
|
|
11978
|
-
}
|
|
11979
|
-
}
|
|
11980
|
-
const quote = normalizeText(anchor.textQuote || anchor.snippet || "");
|
|
11981
|
-
if (!quote) return null;
|
|
11982
|
-
const needle = quote.slice(0, 120);
|
|
11983
|
-
const scopes = [];
|
|
11984
|
-
if (anchor.sectionId) {
|
|
11985
|
-
const escapedSection = cssEscape(anchor.sectionId);
|
|
11986
|
-
scopes.push(
|
|
11987
|
-
document.querySelector('[data-plan-section-id="' + cssAttr(anchor.sectionId) + '"]'),
|
|
11988
|
-
document.getElementById(anchor.sectionId),
|
|
11989
|
-
document.querySelector("#" + escapedSection)
|
|
11990
|
-
);
|
|
11991
|
-
}
|
|
11992
|
-
scopes.push(document);
|
|
11993
|
-
for (const scope of scopes.filter(Boolean)) {
|
|
11994
|
-
const candidates = Array.from(scope.querySelectorAll?.([
|
|
11995
|
-
"p",
|
|
11996
|
-
"li",
|
|
11997
|
-
"h1",
|
|
11998
|
-
"h2",
|
|
11999
|
-
"h3",
|
|
12000
|
-
"h4",
|
|
12001
|
-
"td",
|
|
12002
|
-
"th",
|
|
12003
|
-
"blockquote",
|
|
12004
|
-
"figcaption",
|
|
12005
|
-
"summary",
|
|
12006
|
-
"button",
|
|
12007
|
-
"a",
|
|
12008
|
-
"label",
|
|
12009
|
-
"pre",
|
|
12010
|
-
"code",
|
|
12011
|
-
"[data-plan-text]"
|
|
12012
|
-
].join(",")) || []);
|
|
12013
|
-
const match = candidates.find((candidate) => normalizeText(candidate.textContent || "").includes(needle));
|
|
12014
|
-
if (match) return anchorTargetForElement(match);
|
|
12015
|
-
}
|
|
12016
|
-
return null;
|
|
12017
|
-
}
|
|
12018
|
-
function pointForAnchor(anchor) {
|
|
12019
|
-
const doc = document.documentElement;
|
|
12020
|
-
const docHeight = Math.max(doc.scrollHeight, document.body.scrollHeight);
|
|
12021
|
-
const target = resolveAnchorTarget(anchor);
|
|
12022
|
-
if (target) {
|
|
12023
|
-
if (!isElementTabActive(target)) return null;
|
|
12024
|
-
const rect = target.getBoundingClientRect();
|
|
12025
|
-
if (rect && (rect.width || rect.height)) {
|
|
12026
|
-
return {
|
|
12027
|
-
left: rect.left + window.scrollX + ((anchor.targetX ?? anchor.visualX ?? 50) / 100) * rect.width,
|
|
12028
|
-
top: rect.top + window.scrollY + ((anchor.targetY ?? anchor.visualY ?? 50) / 100) * rect.height
|
|
12029
|
-
};
|
|
12030
|
-
}
|
|
12031
|
-
}
|
|
12032
|
-
const tabContext = anchor.tabPanelId ? { tabPanelId: anchor.tabPanelId } : tabContextForPoint(anchor);
|
|
12033
|
-
if (!isTabContextActive(tabContext.tabPanelId)) return null;
|
|
12034
|
-
return {
|
|
12035
|
-
left: (anchor.x / 100) * doc.scrollWidth,
|
|
12036
|
-
top: (anchor.y / 100) * docHeight
|
|
12037
|
-
};
|
|
12038
|
-
}
|
|
12039
|
-
function setMarkerVisibility(marker, visible) {
|
|
12040
|
-
marker.style.display = visible ? "inline-flex" : "none";
|
|
12041
|
-
marker.setAttribute("aria-hidden", String(!visible));
|
|
12042
|
-
}
|
|
12043
|
-
function positionMarker(marker, item) {
|
|
12044
|
-
const point = pointForAnchor(item.anchor);
|
|
12045
|
-
if (!point) {
|
|
12046
|
-
setMarkerVisibility(marker, false);
|
|
12047
|
-
return;
|
|
12048
|
-
}
|
|
12049
|
-
marker.style.left = point.left + "px";
|
|
12050
|
-
marker.style.top = point.top + "px";
|
|
12051
|
-
setMarkerVisibility(marker, true);
|
|
12052
|
-
}
|
|
12053
|
-
function anchorWithCurrentPoint(anchor) {
|
|
12054
|
-
const point = pointForAnchor(anchor);
|
|
12055
|
-
if (!point) return anchor;
|
|
12056
|
-
const doc = document.documentElement;
|
|
12057
|
-
return {
|
|
12058
|
-
...anchor,
|
|
12059
|
-
x: pct(point.left, doc.scrollWidth),
|
|
12060
|
-
y: pct(point.top, Math.max(doc.scrollHeight, document.body.scrollHeight))
|
|
12061
|
-
};
|
|
12062
|
-
}
|
|
12063
|
-
function rangeFromPoint(clientX, clientY) {
|
|
12064
|
-
if (document.caretPositionFromPoint) {
|
|
12065
|
-
const position = document.caretPositionFromPoint(clientX, clientY);
|
|
12066
|
-
if (!position?.offsetNode) return null;
|
|
12067
|
-
const range = document.createRange();
|
|
12068
|
-
range.setStart(position.offsetNode, position.offset);
|
|
12069
|
-
range.collapse(true);
|
|
12070
|
-
return range;
|
|
12071
|
-
}
|
|
12072
|
-
if (document.caretRangeFromPoint) {
|
|
12073
|
-
return document.caretRangeFromPoint(clientX, clientY);
|
|
12074
|
-
}
|
|
12075
|
-
return null;
|
|
12076
|
-
}
|
|
12077
|
-
function expandRangeToWord(range) {
|
|
12078
|
-
if (!range || range.startContainer.nodeType !== Node.TEXT_NODE) return null;
|
|
12079
|
-
const node = range.startContainer;
|
|
12080
|
-
const text = node.textContent || "";
|
|
12081
|
-
if (!text.trim()) return null;
|
|
12082
|
-
let index = Math.min(range.startOffset, Math.max(0, text.length - 1));
|
|
12083
|
-
if (/\\s/.test(text[index] || "")) {
|
|
12084
|
-
let left = index - 1;
|
|
12085
|
-
let right = index + 1;
|
|
12086
|
-
while (left >= 0 || right < text.length) {
|
|
12087
|
-
if (left >= 0 && !/\\s/.test(text[left])) {
|
|
12088
|
-
index = left;
|
|
12089
|
-
break;
|
|
12090
|
-
}
|
|
12091
|
-
if (right < text.length && !/\\s/.test(text[right])) {
|
|
12092
|
-
index = right;
|
|
12093
|
-
break;
|
|
12094
|
-
}
|
|
12095
|
-
left -= 1;
|
|
12096
|
-
right += 1;
|
|
12097
|
-
}
|
|
12098
|
-
}
|
|
12099
|
-
if (/\\s/.test(text[index] || "")) return null;
|
|
12100
|
-
let start = index;
|
|
12101
|
-
let end = index + 1;
|
|
12102
|
-
while (start > 0 && !/\\s/.test(text[start - 1])) start -= 1;
|
|
12103
|
-
while (end < text.length && !/\\s/.test(text[end])) end += 1;
|
|
12104
|
-
const selectedText = text.slice(start, end).trim();
|
|
12105
|
-
if (selectedText.length < 2) return null;
|
|
12106
|
-
const wordRange = document.createRange();
|
|
12107
|
-
wordRange.setStart(node, start);
|
|
12108
|
-
wordRange.setEnd(node, end);
|
|
12109
|
-
return { range: wordRange, selectedText };
|
|
12110
|
-
}
|
|
12111
|
-
function closestTextElement(target) {
|
|
12112
|
-
if (!(target instanceof Element)) return null;
|
|
12113
|
-
const selector = [
|
|
12114
|
-
"p",
|
|
12115
|
-
"li",
|
|
12116
|
-
"h1",
|
|
12117
|
-
"h2",
|
|
12118
|
-
"h3",
|
|
12119
|
-
"h4",
|
|
12120
|
-
"td",
|
|
12121
|
-
"th",
|
|
12122
|
-
"blockquote",
|
|
12123
|
-
"figcaption",
|
|
12124
|
-
"summary",
|
|
12125
|
-
"button",
|
|
12126
|
-
"a",
|
|
12127
|
-
"label",
|
|
12128
|
-
"pre",
|
|
12129
|
-
"code",
|
|
12130
|
-
"[data-plan-text]"
|
|
12131
|
-
].join(",");
|
|
12132
|
-
return target.matches(selector) ? target : target.closest(selector);
|
|
12133
|
-
}
|
|
12134
|
-
function anchorFromPoint(clientX, clientY, target) {
|
|
12135
|
-
const word = expandRangeToWord(rangeFromPoint(clientX, clientY));
|
|
12136
|
-
if (word) {
|
|
12137
|
-
const anchor = anchorFromRange(word.range, word.selectedText);
|
|
12138
|
-
if (anchor) return anchor;
|
|
12139
|
-
}
|
|
12140
|
-
const textElement = closestTextElement(target);
|
|
12141
|
-
if (!(textElement instanceof Element)) return null;
|
|
12142
|
-
const rect = textElement.getBoundingClientRect();
|
|
12143
|
-
if (!rect || (!rect.width && !rect.height)) return null;
|
|
12144
|
-
const doc = document.documentElement;
|
|
12145
|
-
const textQuote = closestTextContext(textElement);
|
|
12146
|
-
const section = closestSection(textElement);
|
|
12147
|
-
const anchor = {
|
|
12148
|
-
x: pct(clamp(clientX, rect.left, rect.right) + window.scrollX, doc.scrollWidth),
|
|
12149
|
-
y: pct(clamp(clientY, rect.top, rect.bottom) + window.scrollY, Math.max(doc.scrollHeight, document.body.scrollHeight)),
|
|
12150
|
-
sectionId: section?.getAttribute("data-plan-section-id") || section?.id || undefined,
|
|
12151
|
-
sectionTitle: sectionTitle(section) || undefined,
|
|
12152
|
-
...tabContextForElement(textElement),
|
|
12153
|
-
snippet: textQuote || textSnippet(textElement),
|
|
12154
|
-
textQuote: textQuote || undefined,
|
|
12155
|
-
anchorKind: textQuote ? "text" : "point",
|
|
12156
|
-
tagName: textElement.tagName.toLowerCase()
|
|
12157
|
-
};
|
|
12158
|
-
return withTargetAnchor(anchor, textElement, clientX, clientY);
|
|
12159
|
-
}
|
|
12160
|
-
function anchorFromRange(range, selectedText) {
|
|
12161
|
-
const rect = range.getBoundingClientRect();
|
|
12162
|
-
if (!rect || (!rect.width && !rect.height)) return null;
|
|
12163
|
-
const doc = document.documentElement;
|
|
12164
|
-
const section = sectionForNode(range.commonAncestorContainer);
|
|
12165
|
-
const rangeElement = range.commonAncestorContainer instanceof Element ? range.commonAncestorContainer : range.commonAncestorContainer.parentElement;
|
|
12166
|
-
const anchor = {
|
|
12167
|
-
x: pct(rect.left + window.scrollX + rect.width / 2, doc.scrollWidth),
|
|
12168
|
-
y: pct(rect.top + window.scrollY + rect.height / 2, Math.max(doc.scrollHeight, document.body.scrollHeight)),
|
|
12169
|
-
sectionId: section?.getAttribute("data-plan-section-id") || section?.id || undefined,
|
|
12170
|
-
sectionTitle: sectionTitle(section) || undefined,
|
|
12171
|
-
...tabContextForElement(rangeElement),
|
|
12172
|
-
snippet: selectedText.slice(0, 160),
|
|
12173
|
-
textQuote: selectedText.slice(0, 220),
|
|
12174
|
-
anchorKind: "text",
|
|
12175
|
-
tagName: "selection"
|
|
12176
|
-
};
|
|
12177
|
-
return withTargetAnchor(anchor, rangeElement, rect.left + rect.width / 2, rect.top + rect.height / 2);
|
|
12178
|
-
}
|
|
12179
|
-
function ensureSelectionToolbar() {
|
|
12180
|
-
let toolbar = document.querySelector(".an-plan-selection-toolbar");
|
|
12181
|
-
if (!toolbar) {
|
|
12182
|
-
toolbar = document.createElement("div");
|
|
12183
|
-
toolbar.className = "an-plan-selection-toolbar";
|
|
12184
|
-
toolbar.innerHTML = '<button type="button"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 9h8"/><path d="M8 13h6"/><path d="M12 20l-3-3H7a4 4 0 0 1-4-4V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4v4.5"/><path d="M19 16v6"/><path d="M16 19h6"/></svg><span>Comment</span></button>';
|
|
12185
|
-
const button = toolbar.querySelector("button");
|
|
12186
|
-
button?.addEventListener("mousedown", (event) => event.preventDefault());
|
|
12187
|
-
button?.addEventListener("click", (event) => {
|
|
12188
|
-
event.preventDefault();
|
|
12189
|
-
event.stopPropagation();
|
|
12190
|
-
const selection = window.getSelection();
|
|
12191
|
-
if (!selection || selection.rangeCount === 0 || selection.isCollapsed) return;
|
|
12192
|
-
const selectedText = selection.toString().replace(/\\s+/g, " ").trim();
|
|
12193
|
-
if (!selectedText) return;
|
|
12194
|
-
const anchor = anchorFromRange(selection.getRangeAt(0), selectedText);
|
|
12195
|
-
if (!anchor) return;
|
|
12196
|
-
toolbar.style.display = "none";
|
|
12197
|
-
window.parent.postMessage({ type: "agent-native-plan-annotate", anchor }, "*");
|
|
12198
|
-
});
|
|
12199
|
-
document.body.appendChild(toolbar);
|
|
12200
|
-
}
|
|
12201
|
-
return toolbar;
|
|
12202
|
-
}
|
|
12203
|
-
function hideSelectionToolbar() {
|
|
12204
|
-
const toolbar = document.querySelector(".an-plan-selection-toolbar");
|
|
12205
|
-
if (toolbar) toolbar.style.display = "none";
|
|
12206
|
-
}
|
|
12207
|
-
function hideCodePopover() {
|
|
12208
|
-
document.querySelector(".an-plan-code-popover")?.remove();
|
|
12209
|
-
}
|
|
12210
|
-
function showCodePopover(button, templateId) {
|
|
12211
|
-
const template = document.getElementById(templateId);
|
|
12212
|
-
if (!(template instanceof HTMLTemplateElement)) return;
|
|
12213
|
-
hideCodePopover();
|
|
12214
|
-
const popover = document.createElement("div");
|
|
12215
|
-
popover.className = "an-plan-code-popover";
|
|
12216
|
-
popover.innerHTML = '<div class="an-plan-code-popover-header"><span class="an-plan-code-popover-title"></span><div class="an-plan-code-popover-actions"></div><button type="button" class="an-plan-code-popover-close" aria-label="${closeCodePreviewLabel}">×</button></div><div class="an-plan-code-popover-body"></div>';
|
|
12217
|
-
const content = template.content.cloneNode(true);
|
|
12218
|
-
const codePreview = content.querySelector?.(".code-preview");
|
|
12219
|
-
const oldTitle = content.querySelector?.(".code-preview-title");
|
|
12220
|
-
const fileTitle = codePreview?.getAttribute?.("data-file-path") || oldTitle?.querySelector?.("strong")?.textContent?.trim() || button.getAttribute("data-file-path") || button.closest(".implementation-file")?.getAttribute("data-file-path") || "Snippet";
|
|
12221
|
-
const hrefs = {};
|
|
12222
|
-
const fileActions = button.closest(".implementation-file")?.querySelector(".file-actions");
|
|
12223
|
-
for (const openButton of Array.from(fileActions?.querySelectorAll("[data-agent-native-open-editor], [data-agent-native-open-selected-editor], [data-agent-native-open-file]") || [])) {
|
|
12224
|
-
const vscode = openButton.getAttribute("data-agent-native-open-vscode") || "";
|
|
12225
|
-
const cursor = openButton.getAttribute("data-agent-native-open-cursor") || "";
|
|
12226
|
-
const legacy = openButton.getAttribute("data-agent-native-open-editor") || "";
|
|
12227
|
-
if (vscode) hrefs.vscode = vscode;
|
|
12228
|
-
if (cursor) hrefs.cursor = cursor;
|
|
12229
|
-
if (legacy.startsWith("vscode://file/")) hrefs.vscode = legacy;
|
|
12230
|
-
if (legacy.startsWith("cursor://file/")) hrefs.cursor = legacy;
|
|
12231
|
-
}
|
|
12232
|
-
const openFile = button.getAttribute("data-agent-native-open-file") || codePreview?.getAttribute?.("data-agent-native-open-file") || openFileFromHref(hrefs.vscode || hrefs.cursor);
|
|
12233
|
-
const openLine = button.getAttribute("data-agent-native-open-line") || codePreview?.getAttribute?.("data-agent-native-open-line") || "";
|
|
12234
|
-
oldTitle?.remove?.();
|
|
12235
|
-
popover.querySelector(".an-plan-code-popover-title").textContent = fileTitle;
|
|
12236
|
-
if (openFile || hrefs.vscode || hrefs.cursor) {
|
|
12237
|
-
popover.querySelector(".an-plan-code-popover-actions")?.append(createEditorPicker(openFile, hrefs, openLine));
|
|
12238
|
-
setPreferredEditor(preferredEditor, false);
|
|
12239
|
-
}
|
|
12240
|
-
popover.querySelector(".an-plan-code-popover-body")?.append(content);
|
|
12241
|
-
popover.querySelector(".an-plan-code-popover-close")?.addEventListener("click", hideCodePopover);
|
|
12242
|
-
document.body.appendChild(popover);
|
|
12243
|
-
const rect = button.getBoundingClientRect();
|
|
12244
|
-
const width = popover.offsetWidth || 640;
|
|
12245
|
-
const height = popover.offsetHeight || 420;
|
|
12246
|
-
const minLeft = window.scrollX + 12;
|
|
12247
|
-
const maxLeft = window.scrollX + document.documentElement.clientWidth - width - 12;
|
|
12248
|
-
popover.style.left = clamp(rect.left + window.scrollX, minLeft, maxLeft) + "px";
|
|
12249
|
-
popover.style.top = clamp(rect.bottom + window.scrollY + 8, window.scrollY + 12, window.scrollY + document.documentElement.clientHeight - height - 12) + "px";
|
|
12250
|
-
}
|
|
12251
|
-
function updateSelectionToolbar() {
|
|
12252
|
-
if (state.annotateMode) {
|
|
12253
|
-
hideSelectionToolbar();
|
|
12254
|
-
return;
|
|
12255
|
-
}
|
|
12256
|
-
const selection = window.getSelection();
|
|
12257
|
-
if (!selection || selection.rangeCount === 0 || selection.isCollapsed) {
|
|
12258
|
-
hideSelectionToolbar();
|
|
12259
|
-
return;
|
|
12260
|
-
}
|
|
12261
|
-
const selectedText = selection.toString().replace(/\\s+/g, " ").trim();
|
|
12262
|
-
if (!selectedText) {
|
|
12263
|
-
hideSelectionToolbar();
|
|
12264
|
-
return;
|
|
12265
|
-
}
|
|
12266
|
-
const rect = selection.getRangeAt(0).getBoundingClientRect();
|
|
12267
|
-
if (!rect || (!rect.width && !rect.height)) {
|
|
12268
|
-
hideSelectionToolbar();
|
|
12269
|
-
return;
|
|
12270
|
-
}
|
|
12271
|
-
const toolbar = ensureSelectionToolbar();
|
|
12272
|
-
toolbar.style.display = "flex";
|
|
12273
|
-
const width = toolbar.offsetWidth || 124;
|
|
12274
|
-
const left = clamp(rect.left + window.scrollX + rect.width / 2 - width / 2, window.scrollX + 10, window.scrollX + document.documentElement.clientWidth - width - 10);
|
|
12275
|
-
const top = Math.max(window.scrollY + 10, rect.top + window.scrollY - (toolbar.offsetHeight || 44) - 10);
|
|
12276
|
-
toolbar.style.left = left + "px";
|
|
12277
|
-
toolbar.style.top = top + "px";
|
|
12278
|
-
}
|
|
12279
|
-
function syncAnnotationMarkers() {
|
|
12280
|
-
for (const marker of document.querySelectorAll("[data-agent-native-plan-marker]")) {
|
|
12281
|
-
if (marker.__agentNativePlanAnnotation) {
|
|
12282
|
-
positionMarker(marker, marker.__agentNativePlanAnnotation);
|
|
12283
|
-
continue;
|
|
12284
|
-
}
|
|
12285
|
-
const tabPanelId = marker.getAttribute("data-tab-panel-id") || "";
|
|
12286
|
-
setMarkerVisibility(marker, isTabContextActive(tabPanelId));
|
|
12287
|
-
}
|
|
12288
|
-
}
|
|
12289
|
-
const layer = ensureLayer();
|
|
12290
|
-
for (const item of state.annotations) {
|
|
12291
|
-
if (!item.anchor) continue;
|
|
12292
|
-
const button = document.createElement("button");
|
|
12293
|
-
const tabContext = item.anchor.tabPanelId ? { tabPanelId: item.anchor.tabPanelId, tabLabel: item.anchor.tabLabel } : tabContextForPoint(item.anchor);
|
|
12294
|
-
button.type = "button";
|
|
12295
|
-
button.className = "an-plan-marker";
|
|
12296
|
-
button.dataset.status = item.status || "open";
|
|
12297
|
-
button.dataset.agentNativePlanMarker = "true";
|
|
12298
|
-
button.__agentNativePlanAnnotation = item;
|
|
12299
|
-
if (tabContext.tabPanelId) {
|
|
12300
|
-
button.dataset.tabPanelId = tabContext.tabPanelId;
|
|
12301
|
-
}
|
|
12302
|
-
if (tabContext.tabLabel) {
|
|
12303
|
-
button.dataset.tabLabel = tabContext.tabLabel;
|
|
12304
|
-
}
|
|
12305
|
-
positionMarker(button, item);
|
|
12306
|
-
setMarkerThreadFaces(button, item);
|
|
12307
|
-
const participantNames = Array.isArray(item.participants)
|
|
12308
|
-
? item.participants.map((participant) => participant.authorName).filter(Boolean).slice(0, 3).join(", ")
|
|
12309
|
-
: "";
|
|
12310
|
-
const countLabel = (item.commentCount || 1) + " comment" + ((item.commentCount || 1) === 1 ? "" : "s");
|
|
12311
|
-
button.title = participantNames
|
|
12312
|
-
? countLabel + " by " + participantNames + ": " + (item.message || "Plan comment")
|
|
12313
|
-
: countLabel + ": " + (item.message || "Plan comment");
|
|
12314
|
-
button.setAttribute("aria-label", button.title);
|
|
12315
|
-
button.addEventListener("click", (event) => {
|
|
12316
|
-
event.preventDefault();
|
|
12317
|
-
event.stopPropagation();
|
|
12318
|
-
window.parent.postMessage({
|
|
12319
|
-
type: "agent-native-plan-open-comment",
|
|
12320
|
-
comment: {
|
|
12321
|
-
...item,
|
|
12322
|
-
anchor: anchorWithCurrentPoint(item.anchor)
|
|
12323
|
-
}
|
|
12324
|
-
}, "*");
|
|
12325
|
-
});
|
|
12326
|
-
layer.appendChild(button);
|
|
12327
|
-
}
|
|
12328
|
-
document.addEventListener("selectionchange", () => requestAnimationFrame(updateSelectionToolbar));
|
|
12329
|
-
document.addEventListener("mouseup", () => setTimeout(updateSelectionToolbar, 0));
|
|
12330
|
-
document.addEventListener("keyup", updateSelectionToolbar);
|
|
12331
|
-
document.addEventListener("keydown", (event) => {
|
|
12332
|
-
if (event.key === "Escape") {
|
|
12333
|
-
closeEditorMenus();
|
|
12334
|
-
if (state.annotateMode) {
|
|
12335
|
-
event.preventDefault();
|
|
12336
|
-
event.stopPropagation();
|
|
12337
|
-
setRuntimeAnnotateMode(false);
|
|
12338
|
-
window.parent.postMessage({ type: "agent-native-plan-exit-comment-mode" }, "*");
|
|
12339
|
-
}
|
|
12340
|
-
}
|
|
12341
|
-
});
|
|
12342
|
-
document.addEventListener("change", (event) => {
|
|
12343
|
-
const editorSelect = event.target instanceof Element ? event.target.closest("[data-agent-native-editor-select]") : null;
|
|
12344
|
-
if (!editorSelect) return;
|
|
12345
|
-
setPreferredEditor(editorSelect.value, true);
|
|
12346
|
-
});
|
|
12347
|
-
document.addEventListener("click", (event) => {
|
|
12348
|
-
const editorOption = event.target instanceof Element ? event.target.closest("[data-agent-native-editor-option]") : null;
|
|
12349
|
-
if (editorOption) {
|
|
12350
|
-
event.preventDefault();
|
|
12351
|
-
event.stopPropagation();
|
|
12352
|
-
setPreferredEditor(editorOption.getAttribute("data-agent-native-editor-option"), true);
|
|
12353
|
-
closeEditorMenus();
|
|
12354
|
-
return;
|
|
12355
|
-
}
|
|
12356
|
-
const editorTrigger = event.target instanceof Element ? event.target.closest("[data-agent-native-editor-trigger]") : null;
|
|
12357
|
-
if (editorTrigger) {
|
|
12358
|
-
event.preventDefault();
|
|
12359
|
-
event.stopPropagation();
|
|
12360
|
-
const picker = editorTrigger.closest("[data-agent-native-editor-picker]");
|
|
12361
|
-
const willOpen = picker?.getAttribute("data-open") !== "true";
|
|
12362
|
-
closeEditorMenus(picker);
|
|
12363
|
-
if (picker && willOpen) {
|
|
12364
|
-
picker.setAttribute("data-open", "true");
|
|
12365
|
-
editorTrigger.setAttribute("aria-expanded", "true");
|
|
12366
|
-
} else {
|
|
12367
|
-
picker?.removeAttribute("data-open");
|
|
12368
|
-
editorTrigger.setAttribute("aria-expanded", "false");
|
|
12369
|
-
}
|
|
12370
|
-
return;
|
|
12371
|
-
}
|
|
12372
|
-
const previewButton = event.target instanceof Element ? event.target.closest("[data-agent-native-code-preview]") : null;
|
|
12373
|
-
if (previewButton) {
|
|
12374
|
-
event.preventDefault();
|
|
12375
|
-
event.stopPropagation();
|
|
12376
|
-
showCodePopover(previewButton, previewButton.getAttribute("data-agent-native-code-preview") || "");
|
|
12377
|
-
return;
|
|
12378
|
-
}
|
|
12379
|
-
const editorButton = event.target instanceof Element ? event.target.closest("[data-agent-native-open-file], [data-agent-native-open-selected-editor]") : null;
|
|
12380
|
-
if (editorButton) {
|
|
12381
|
-
event.preventDefault();
|
|
12382
|
-
event.stopPropagation();
|
|
12383
|
-
const picker = editorButton.closest("[data-agent-native-editor-picker]");
|
|
12384
|
-
const select = picker?.querySelector?.("[data-agent-native-editor-select]");
|
|
12385
|
-
const editor = normalizeEditor(picker?.getAttribute("data-editor") || select?.value || preferredEditor);
|
|
12386
|
-
const directHref = editorButton.getAttribute("data-agent-native-open-" + editor) || "";
|
|
12387
|
-
const filePath = editorButton.getAttribute("data-agent-native-open-file") || "";
|
|
12388
|
-
const line = editorButton.getAttribute("data-agent-native-open-line") || "";
|
|
12389
|
-
const href = directHref || hrefForEditor(editor, filePath, line);
|
|
12390
|
-
closeEditorMenus();
|
|
12391
|
-
window.parent.postMessage({ type: "agent-native-plan-open-editor", href }, "*");
|
|
12392
|
-
return;
|
|
12393
|
-
}
|
|
12394
|
-
const link = event.target instanceof Element ? event.target.closest("a[href]") : null;
|
|
12395
|
-
if (!state.annotateMode && link) {
|
|
12396
|
-
const href = link.getAttribute("href") || "";
|
|
12397
|
-
if (href === "#" || href.trim() === "") {
|
|
12398
|
-
event.preventDefault();
|
|
12399
|
-
event.stopPropagation();
|
|
12400
|
-
window.parent.postMessage({ type: "agent-native-plan-link-blocked", href }, "*");
|
|
12401
|
-
return;
|
|
12402
|
-
}
|
|
12403
|
-
if (href && !href.startsWith("#")) {
|
|
12404
|
-
event.preventDefault();
|
|
12405
|
-
event.stopPropagation();
|
|
12406
|
-
window.parent.postMessage({ type: "agent-native-plan-link-blocked", href }, "*");
|
|
12407
|
-
return;
|
|
12408
|
-
}
|
|
12409
|
-
}
|
|
12410
|
-
if (!state.annotateMode) {
|
|
12411
|
-
if (event.target instanceof Element && event.target.closest(".an-plan-selection-toolbar")) return;
|
|
12412
|
-
if (event.target instanceof Element && event.target.closest(".an-plan-code-popover")) return;
|
|
12413
|
-
closeEditorMenus();
|
|
12414
|
-
hideCodePopover();
|
|
12415
|
-
window.parent.postMessage({ type: "agent-native-plan-close-comment-popover" }, "*");
|
|
12416
|
-
return;
|
|
12417
|
-
}
|
|
12418
|
-
if (!state.annotateMode) return;
|
|
12419
|
-
if (event.target instanceof Element && event.target.closest("[data-agent-native-plan-marker]")) return;
|
|
12420
|
-
hideSelectionToolbar();
|
|
12421
|
-
event.preventDefault();
|
|
12422
|
-
event.stopPropagation();
|
|
12423
|
-
const doc = document.documentElement;
|
|
12424
|
-
const target = event.target instanceof Element ? event.target : null;
|
|
12425
|
-
const section = closestSection(target);
|
|
12426
|
-
const visual = closestVisualContext(target);
|
|
12427
|
-
const visualRect = visual?.getBoundingClientRect?.();
|
|
12428
|
-
const tabContext = tabContextForElement(visual || target || section);
|
|
12429
|
-
const textAnchor = visual ? null : anchorFromPoint(event.clientX, event.clientY, target);
|
|
12430
|
-
const textQuote = visual ? "" : closestTextContext(target);
|
|
12431
|
-
const visualX = visualRect ? pct(event.clientX - visualRect.left, visualRect.width) : undefined;
|
|
12432
|
-
const visualY = visualRect ? pct(event.clientY - visualRect.top, visualRect.height) : undefined;
|
|
12433
|
-
const fallbackAnchor = {
|
|
12434
|
-
x: pct(event.pageX, doc.scrollWidth),
|
|
12435
|
-
y: pct(event.pageY, Math.max(doc.scrollHeight, document.body.scrollHeight)),
|
|
12436
|
-
sectionId: section?.getAttribute("data-plan-section-id") || section?.id || undefined,
|
|
12437
|
-
sectionTitle: sectionTitle(section) || undefined,
|
|
12438
|
-
...tabContext,
|
|
12439
|
-
snippet: textQuote || (target ? textSnippet(target) : ""),
|
|
12440
|
-
textQuote: textQuote || undefined,
|
|
12441
|
-
anchorKind: visual ? "visual" : textQuote ? "text" : "point",
|
|
12442
|
-
visualLabel: visual ? visualLabel(visual, section) : undefined,
|
|
12443
|
-
visualX,
|
|
12444
|
-
visualY,
|
|
12445
|
-
tagName: target ? target.tagName.toLowerCase() : undefined
|
|
12446
|
-
};
|
|
12447
|
-
const anchoredFallback = withTargetAnchor(fallbackAnchor, visual || target, event.clientX, event.clientY);
|
|
12448
|
-
window.parent.postMessage({
|
|
12449
|
-
type: "agent-native-plan-annotate",
|
|
12450
|
-
anchor: textAnchor ? { ...textAnchor, ...tabContext } : anchoredFallback
|
|
12451
|
-
}, "*");
|
|
12452
|
-
}, true);
|
|
12453
|
-
})();
|
|
12454
|
-
</script>`;
|
|
12455
|
-
if (html.includes("</body>")) {
|
|
12456
|
-
return html.replace("</body>", `${runtime}</body>`);
|
|
12457
|
-
}
|
|
12458
|
-
return `${html}${runtime}`;
|
|
12459
|
-
}
|
|
12460
|
-
|
|
12461
|
-
function escapeRuntimeJsString(value: string) {
|
|
12462
|
-
return value
|
|
12463
|
-
.replace(/\\/g, "\\\\")
|
|
12464
|
-
.replace(/'/g, "\\'")
|
|
12465
|
-
.replace(/&/g, "&")
|
|
12466
|
-
.replace(/</g, "\\u003c")
|
|
12467
|
-
.replace(/>/g, "\\u003e")
|
|
12468
|
-
.replace(/"/g, """);
|
|
12469
|
-
}
|
|
12470
|
-
|
|
12471
9940
|
function buildClientPlanHtml(
|
|
12472
9941
|
bundle: PlanBundle,
|
|
12473
9942
|
labels: {
|