@agent-native/core 0.92.0 → 0.92.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 +1 -1
- package/corpus/core/CHANGELOG.md +14 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/application-state/store.ts +12 -1
- package/corpus/core/src/client/AssistantChat.tsx +27 -14
- package/corpus/core/src/client/PoweredByBadge.tsx +1 -8
- package/corpus/core/src/client/agent-chat-adapter.ts +37 -10
- package/corpus/core/src/client/chat/widgets/DataTableWidget.tsx +52 -1
- package/corpus/core/src/client/db-admin/TableEditor.tsx +49 -0
- package/corpus/core/src/client/db-admin/export-utils.ts +13 -4
- package/corpus/core/src/client/db-admin/useAgentSync.ts +72 -0
- package/corpus/core/src/client/error-capture.ts +69 -7
- package/corpus/core/src/client/extensions/EmbeddedExtension.tsx +5 -1
- package/corpus/core/src/client/extensions/ExtensionViewer.tsx +53 -8
- package/corpus/core/src/client/extensions/InlineExtensionFrame.tsx +5 -1
- package/corpus/core/src/client/extensions/portable-extension.ts +1 -0
- package/corpus/core/src/client/org/OrgSwitcher.tsx +12 -9
- package/corpus/core/src/client/org/TeamPage.tsx +77 -71
- package/corpus/core/src/client/settings/SettingsPanel.tsx +205 -52
- package/corpus/core/src/client/settings/SettingsSection.tsx +8 -1
- package/corpus/core/src/client/settings/SettingsTabsPage.tsx +25 -9
- package/corpus/core/src/db-admin/agent-tools.ts +8 -2
- package/corpus/core/src/db-admin/operations.ts +116 -4
- package/corpus/core/src/db-admin/routes.ts +1 -0
- package/corpus/core/src/db-admin/types.ts +4 -0
- package/corpus/core/src/extensions/html-shell.ts +5 -4
- package/corpus/core/src/extensions/routes.ts +10 -0
- package/corpus/core/src/navigation/index.ts +1 -1
- package/corpus/core/src/resources/handlers.ts +10 -8
- package/corpus/core/src/server/poll.ts +293 -8
- package/corpus/core/src/styles/agent-native.css +27 -0
- package/corpus/core/src/templates/default/.agents/skills/actions/SKILL.md +5 -0
- package/corpus/core/src/templates/default/.agents/skills/adding-a-feature/SKILL.md +5 -0
- package/corpus/core/src/templates/default/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/core/src/templates/default/.agents/skills/security/SKILL.md +7 -0
- package/corpus/core/src/templates/default/.agents/skills/storing-data/SKILL.md +5 -1
- package/corpus/core/src/templates/default/AGENTS.md +4 -2
- package/corpus/core/src/templates/headless/AGENTS.md +4 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/actions/SKILL.md +5 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +5 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +4 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +6 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/performance/SKILL.md +4 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/security/SKILL.md +7 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/storing-data/SKILL.md +5 -1
- package/corpus/core/src/templates/workspace-core/AGENTS.md +7 -1
- package/corpus/core/src/templates/workspace-root/AGENTS.md +7 -1
- package/corpus/templates/analytics/.agents/skills/actions/SKILL.md +5 -0
- package/corpus/templates/analytics/.agents/skills/dashboard-management/SKILL.md +10 -0
- package/corpus/templates/analytics/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/analytics/.agents/skills/security/SKILL.md +7 -0
- package/corpus/templates/analytics/.agents/skills/storing-data/SKILL.md +5 -1
- package/corpus/templates/analytics/AGENTS.md +33 -14
- package/corpus/templates/analytics/actions/capture-test-error.ts +4 -0
- package/corpus/templates/analytics/actions/get-analytics-alert-rule-defaults.ts +23 -0
- package/corpus/templates/analytics/actions/get-error-issue.ts +1 -1
- package/corpus/templates/analytics/actions/list-analysis-revisions.ts +40 -0
- package/corpus/templates/analytics/actions/list-dashboard-revisions.ts +40 -0
- package/corpus/templates/analytics/actions/list-dashboard-usage-stats.ts +299 -0
- package/corpus/templates/analytics/actions/navigate.ts +4 -2
- package/corpus/templates/analytics/actions/restore-analysis-revision.ts +43 -0
- package/corpus/templates/analytics/actions/restore-dashboard-revision.ts +68 -0
- package/corpus/templates/analytics/actions/save-analytics-alert-rule.ts +14 -0
- package/corpus/templates/analytics/actions/save-monitor.ts +1 -1
- package/corpus/templates/analytics/actions/view-screen.ts +24 -0
- package/corpus/templates/analytics/app/components/analysis/AnalysisHistoryPanel.tsx +181 -0
- package/corpus/templates/analytics/app/components/dashboard/DashboardHistoryPanel.tsx +184 -0
- package/corpus/templates/analytics/app/components/layout/CommandPalette.tsx +22 -16
- package/corpus/templates/analytics/app/components/layout/Header.tsx +1 -1
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +27 -21
- package/corpus/templates/analytics/app/hooks/use-analysis-revisions.ts +43 -0
- package/corpus/templates/analytics/app/hooks/use-dashboard-chat-context.ts +110 -0
- package/corpus/templates/analytics/app/hooks/use-dashboard-revisions.ts +43 -0
- package/corpus/templates/analytics/app/hooks/use-navigation-state.ts +8 -3
- package/corpus/templates/analytics/app/i18n/zh-TW.ts +64 -2
- package/corpus/templates/analytics/app/i18n-data.ts +783 -3
- package/corpus/templates/analytics/app/pages/Agents.tsx +359 -19
- package/corpus/templates/analytics/app/pages/Settings.tsx +3 -2
- package/corpus/templates/analytics/app/pages/adhoc/explorer-dashboard/index.tsx +34 -1
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +28 -0
- package/corpus/templates/analytics/app/pages/analyses/AnalysisDetail.tsx +18 -1
- package/corpus/templates/analytics/app/pages/monitoring/ErrorsPanel.tsx +7 -10
- package/corpus/templates/analytics/app/pages/monitoring/errors/IssueDetail.tsx +479 -23
- package/corpus/templates/analytics/app/pages/monitoring/errors/IssueList.tsx +0 -9
- package/corpus/templates/analytics/app/pages/monitoring/errors/i18n.ts +11 -0
- package/corpus/templates/analytics/app/pages/monitoring/errors/types.ts +9 -1
- package/corpus/templates/analytics/app/pages/monitoring/uptime/MonitorFormPage.tsx +6 -3
- package/corpus/templates/analytics/app/pages/sessions/SessionDetailPage.tsx +26 -30
- package/corpus/templates/analytics/app/pages/sessions/SessionsPage.tsx +9 -99
- package/corpus/templates/analytics/app/pages/settings/AlertRulesSettingsCard.tsx +262 -104
- package/corpus/templates/analytics/app/routes/team.tsx +1 -1
- package/corpus/templates/analytics/changelog/2026-07-08-admins-can-audit-dashboard-usage-ownership-and-cleanup-signa.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-agent-monitoring-stays-available-to-non-admins.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-alert-rules-are-easier-to-scan-expand-and-edit-from-settings.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-analytics-alert-forms-remember-last-email-recipients.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-analytics-alert-rules-can-now-use-per-rule-slack-and-webhook.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-dashboard-history-and-chat-context.md +5 -0
- package/corpus/templates/analytics/changelog/2026-07-08-dashboard-usage-now-counts-explorer-dashboard-traffic.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-demo-mode-session-emails-are-filtered-and-anonymized.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-error-issue-detail-adds-stack-traces-and-frequency-bars.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-error-issue-detail-now-shows-the-latest-occurrence-message-a.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-monitoring-errors-only-show-test-action-when-empty.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-production-session-replay-now-requires-private-blob-storage-.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-shared-extension-links-now-show-a-clear-message-when-you-do-.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-team-settings-show-access-controls-next-to-member-lists.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-uptime-monitors-now-use-a-10-second-request-timeout-by-defau.md +6 -0
- package/corpus/templates/analytics/server/db/schema-monitoring.ts +1 -1
- package/corpus/templates/analytics/server/db/schema.ts +56 -0
- package/corpus/templates/analytics/server/lib/analytics-alerts.ts +92 -0
- package/corpus/templates/analytics/server/lib/dashboards-store.ts +334 -5
- package/corpus/templates/analytics/server/lib/error-capture.ts +231 -36
- package/corpus/templates/analytics/server/lib/session-replay.ts +114 -8
- package/corpus/templates/analytics/server/lib/uptime-monitors.ts +5 -4
- package/corpus/templates/analytics/server/plugins/db.ts +112 -2
- package/corpus/templates/analytics/server/routes/api/dashboard-agent-context.json.get.ts +1 -0
- package/corpus/templates/assets/.agents/skills/actions/SKILL.md +5 -0
- package/corpus/templates/assets/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/assets/.agents/skills/security/SKILL.md +7 -0
- package/corpus/templates/assets/.agents/skills/storing-data/SKILL.md +5 -1
- package/corpus/templates/assets/AGENTS.md +4 -0
- package/corpus/templates/assets/app/routes/settings.tsx +1 -1
- package/corpus/templates/assets/app/routes/team.tsx +1 -1
- package/corpus/templates/brain/.agents/skills/actions/SKILL.md +5 -0
- package/corpus/templates/brain/.agents/skills/adding-a-feature/SKILL.md +5 -0
- package/corpus/templates/brain/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/brain/.agents/skills/security/SKILL.md +7 -0
- package/corpus/templates/brain/AGENTS.md +4 -0
- package/corpus/templates/brain/app/routes/team.tsx +1 -1
- package/corpus/templates/calendar/.agents/skills/actions/SKILL.md +5 -0
- package/corpus/templates/calendar/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/calendar/.agents/skills/security/SKILL.md +7 -0
- package/corpus/templates/calendar/.agents/skills/storing-data/SKILL.md +5 -1
- package/corpus/templates/calendar/AGENTS.md +4 -0
- package/corpus/templates/calendar/app/components/calendar/DayView.tsx +11 -2
- package/corpus/templates/calendar/app/components/calendar/EventDetailPopover.tsx +21 -8
- package/corpus/templates/calendar/app/components/calendar/MonthView.tsx +7 -1
- package/corpus/templates/calendar/app/components/calendar/WeekView.tsx +11 -2
- package/corpus/templates/calendar/app/lib/popover-click-guard.ts +48 -4
- package/corpus/templates/calendar/app/pages/Settings.tsx +1 -1
- package/corpus/templates/calendar/app/routes/_app.team.tsx +1 -1
- package/corpus/templates/calendar/changelog/2026-07-08-clicking-empty-calendar-space-closes-an-open-event-popover-b.md +6 -0
- package/corpus/templates/chat/.agents/skills/actions/SKILL.md +5 -0
- package/corpus/templates/chat/.agents/skills/adding-a-feature/SKILL.md +5 -0
- package/corpus/templates/chat/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/chat/.agents/skills/security/SKILL.md +7 -0
- package/corpus/templates/chat/AGENTS.md +4 -0
- package/corpus/templates/chat/app/hooks/use-navigation-state.ts +1 -1
- package/corpus/templates/chat/app/routes/settings.tsx +2 -2
- package/corpus/templates/chat/app/routes/team.tsx +1 -1
- package/corpus/templates/clips/.agents/skills/actions/SKILL.md +5 -0
- package/corpus/templates/clips/.agents/skills/security/SKILL.md +7 -0
- package/corpus/templates/clips/AGENTS.md +4 -0
- package/corpus/templates/clips/actions/finalize-recording.ts +9 -3
- package/corpus/templates/clips/actions/set-thumbnail.ts +11 -2
- package/corpus/templates/clips/app/components/meetings/canvas-editor.tsx +1 -7
- package/corpus/templates/clips/app/components/player/player-controls.tsx +21 -13
- package/corpus/templates/clips/app/components/player/video-player.tsx +30 -75
- package/corpus/templates/clips/app/i18n/ar-SA.ts +6 -5
- package/corpus/templates/clips/app/i18n/de-DE.ts +6 -6
- package/corpus/templates/clips/app/i18n/en-US.ts +6 -5
- package/corpus/templates/clips/app/i18n/es-ES.ts +6 -5
- package/corpus/templates/clips/app/i18n/fr-FR.ts +6 -6
- package/corpus/templates/clips/app/i18n/hi-IN.ts +6 -5
- package/corpus/templates/clips/app/i18n/ja-JP.ts +6 -5
- package/corpus/templates/clips/app/i18n/ko-KR.ts +6 -5
- package/corpus/templates/clips/app/i18n/pt-BR.ts +6 -5
- package/corpus/templates/clips/app/i18n/zh-CN.ts +6 -5
- package/corpus/templates/clips/app/i18n/zh-TW.ts +6 -5
- package/corpus/templates/clips/app/routes/_app.meetings.$meetingId.tsx +51 -118
- package/corpus/templates/clips/changelog/2026-07-08-hosted-clip-uploads-now-clear-failed-buffered-chunks.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-hosted-recording-uploads-now-avoid-sql-chunk-storage.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-meeting-recaps-now-keep-summaries-action-items-and-transcrip.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-video-playback-controls-now-match-loom-style-5-second-skips-.md +6 -0
- package/corpus/templates/clips/server/lib/recording-upload-state.ts +63 -0
- package/corpus/templates/clips/server/lib/video-storage.ts +4 -0
- package/corpus/templates/clips/server/routes/api/recordings/[recordingId]/thumbnail.post.ts +19 -13
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/chunk.post.ts +40 -1
- package/corpus/templates/content/.agents/skills/actions/SKILL.md +5 -0
- package/corpus/templates/content/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/content/.agents/skills/security/SKILL.md +7 -0
- package/corpus/templates/content/.agents/skills/storing-data/SKILL.md +5 -1
- package/corpus/templates/content/AGENTS.md +4 -0
- package/corpus/templates/content/app/routes/_app.settings.tsx +2 -2
- package/corpus/templates/content/app/routes/_app.team.tsx +1 -1
- package/corpus/templates/design/.agents/skills/actions/SKILL.md +5 -0
- package/corpus/templates/design/.agents/skills/security/SKILL.md +7 -0
- package/corpus/templates/design/AGENTS.md +4 -0
- package/corpus/templates/design/actions/take-design-screenshot.ts +12 -9
- package/corpus/templates/design/app/components/design/inspector/ImageFillControls.tsx +57 -13
- package/corpus/templates/design/app/routes/team.tsx +1 -1
- package/corpus/templates/design/changelog/2026-07-08-local-images-added-to-designs-now-upload-to-file-storage-ins.md +6 -0
- package/corpus/templates/dispatch/.agents/skills/actions/SKILL.md +5 -0
- package/corpus/templates/dispatch/.agents/skills/security/SKILL.md +7 -0
- package/corpus/templates/dispatch/AGENTS.md +4 -0
- package/corpus/templates/dispatch/app/hooks/use-navigation-state.ts +1 -1
- package/corpus/templates/dispatch/app/routes/settings.tsx +2 -2
- package/corpus/templates/dispatch/app/routes/team.tsx +1 -1
- package/corpus/templates/forms/.agents/skills/actions/SKILL.md +5 -0
- package/corpus/templates/forms/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/forms/.agents/skills/security/SKILL.md +7 -0
- package/corpus/templates/forms/.agents/skills/storing-data/SKILL.md +5 -1
- package/corpus/templates/forms/AGENTS.md +4 -0
- package/corpus/templates/forms/app/routes/_app.settings.tsx +2 -2
- package/corpus/templates/forms/app/routes/_app.team.tsx +1 -1
- package/corpus/templates/forms/shared/navigation.ts +1 -1
- package/corpus/templates/macros/.agents/skills/security/SKILL.md +7 -0
- package/corpus/templates/macros/AGENTS.md +4 -0
- package/corpus/templates/macros/app/routes/settings.tsx +2 -2
- package/corpus/templates/macros/app/routes/team.tsx +1 -1
- package/corpus/templates/mail/.agents/skills/actions/SKILL.md +5 -0
- package/corpus/templates/mail/.agents/skills/email-drafts/SKILL.md +1 -1
- package/corpus/templates/mail/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/mail/.agents/skills/security/SKILL.md +7 -0
- package/corpus/templates/mail/.agents/skills/storing-data/SKILL.md +5 -1
- package/corpus/templates/mail/AGENTS.md +4 -0
- package/corpus/templates/mail/changelog/2026-07-08-mail-attachments-in-hosted-environments-now-require-file-sto.md +6 -0
- package/corpus/templates/mail/server/handlers/media.ts +26 -1
- package/corpus/templates/mail/server/lib/outgoing-email.ts +24 -1
- package/corpus/templates/mail/server/lib/upload-store.ts +2 -1
- package/corpus/templates/plan/.agents/skills/actions/SKILL.md +5 -0
- package/corpus/templates/plan/.agents/skills/adding-a-feature/SKILL.md +5 -0
- package/corpus/templates/plan/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/plan/.agents/skills/security/SKILL.md +7 -0
- package/corpus/templates/plan/AGENTS.md +4 -0
- package/corpus/templates/plan/app/hooks/use-navigation-state.ts +1 -1
- package/corpus/templates/plan/app/routes/settings.tsx +2 -2
- package/corpus/templates/plan/app/routes/team.tsx +1 -1
- package/corpus/templates/plan/changelog/2026-07-08-hosted-plan-images-now-require-connected-storage.md +6 -0
- package/corpus/templates/plan/server/lib/plan-assets.ts +33 -4
- package/corpus/templates/slides/.agents/skills/actions/SKILL.md +5 -0
- package/corpus/templates/slides/.agents/skills/security/SKILL.md +7 -0
- package/corpus/templates/slides/AGENTS.md +4 -0
- package/corpus/templates/slides/actions/generate-image-api.ts +15 -3
- package/corpus/templates/slides/app/routes/settings.tsx +2 -2
- package/corpus/templates/slides/app/routes/team.tsx +1 -1
- package/corpus/templates/slides/changelog/2026-07-08-generated-slide-images-now-return-hosted-file-storage-urls-i.md +6 -0
- package/corpus/templates/slides/shared/api.ts +1 -1
- package/dist/application-state/store.d.ts.map +1 -1
- package/dist/application-state/store.js +8 -2
- package/dist/application-state/store.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +24 -13
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/PoweredByBadge.d.ts +1 -1
- package/dist/client/PoweredByBadge.d.ts.map +1 -1
- package/dist/client/PoweredByBadge.js +3 -9
- package/dist/client/PoweredByBadge.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +28 -9
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/chat/widgets/DataTableWidget.d.ts.map +1 -1
- package/dist/client/chat/widgets/DataTableWidget.js +19 -2
- package/dist/client/chat/widgets/DataTableWidget.js.map +1 -1
- package/dist/client/db-admin/TableEditor.d.ts.map +1 -1
- package/dist/client/db-admin/TableEditor.js +19 -2
- package/dist/client/db-admin/TableEditor.js.map +1 -1
- package/dist/client/db-admin/export-utils.d.ts +2 -0
- package/dist/client/db-admin/export-utils.d.ts.map +1 -1
- package/dist/client/db-admin/export-utils.js +11 -3
- package/dist/client/db-admin/export-utils.js.map +1 -1
- package/dist/client/db-admin/useAgentSync.d.ts.map +1 -1
- package/dist/client/db-admin/useAgentSync.js +63 -0
- package/dist/client/db-admin/useAgentSync.js.map +1 -1
- package/dist/client/error-capture.d.ts.map +1 -1
- package/dist/client/error-capture.js +41 -7
- package/dist/client/error-capture.js.map +1 -1
- package/dist/client/extensions/EmbeddedExtension.d.ts.map +1 -1
- package/dist/client/extensions/EmbeddedExtension.js +3 -1
- package/dist/client/extensions/EmbeddedExtension.js.map +1 -1
- package/dist/client/extensions/ExtensionViewer.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionViewer.js +32 -5
- package/dist/client/extensions/ExtensionViewer.js.map +1 -1
- package/dist/client/extensions/InlineExtensionFrame.d.ts.map +1 -1
- package/dist/client/extensions/InlineExtensionFrame.js +3 -1
- package/dist/client/extensions/InlineExtensionFrame.js.map +1 -1
- package/dist/client/extensions/portable-extension.d.ts.map +1 -1
- package/dist/client/extensions/portable-extension.js +1 -0
- package/dist/client/extensions/portable-extension.js.map +1 -1
- package/dist/client/org/OrgSwitcher.d.ts +1 -1
- package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
- package/dist/client/org/OrgSwitcher.js +11 -6
- package/dist/client/org/OrgSwitcher.js.map +1 -1
- package/dist/client/org/TeamPage.d.ts.map +1 -1
- package/dist/client/org/TeamPage.js +5 -5
- package/dist/client/org/TeamPage.js.map +1 -1
- package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
- package/dist/client/settings/SettingsPanel.js +37 -14
- package/dist/client/settings/SettingsPanel.js.map +1 -1
- package/dist/client/settings/SettingsSection.js +1 -1
- package/dist/client/settings/SettingsSection.js.map +1 -1
- package/dist/client/settings/SettingsTabsPage.d.ts.map +1 -1
- package/dist/client/settings/SettingsTabsPage.js +21 -10
- package/dist/client/settings/SettingsTabsPage.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/db-admin/agent-tools.d.ts.map +1 -1
- package/dist/db-admin/agent-tools.js +7 -2
- package/dist/db-admin/agent-tools.js.map +1 -1
- package/dist/db-admin/operations.d.ts.map +1 -1
- package/dist/db-admin/operations.js +90 -4
- package/dist/db-admin/operations.js.map +1 -1
- package/dist/db-admin/routes.d.ts.map +1 -1
- package/dist/db-admin/routes.js +1 -0
- package/dist/db-admin/routes.js.map +1 -1
- package/dist/db-admin/types.d.ts +4 -0
- package/dist/db-admin/types.d.ts.map +1 -1
- package/dist/db-admin/types.js.map +1 -1
- package/dist/extensions/html-shell.d.ts +5 -4
- package/dist/extensions/html-shell.d.ts.map +1 -1
- package/dist/extensions/html-shell.js.map +1 -1
- package/dist/extensions/routes.d.ts.map +1 -1
- package/dist/extensions/routes.js +8 -0
- package/dist/extensions/routes.js.map +1 -1
- package/dist/navigation/index.d.ts +1 -1
- package/dist/navigation/index.d.ts.map +1 -1
- package/dist/navigation/index.js +1 -1
- package/dist/navigation/index.js.map +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/observability/routes.d.ts +1 -1
- package/dist/resources/handlers.d.ts +6 -1
- package/dist/resources/handlers.d.ts.map +1 -1
- package/dist/resources/handlers.js +9 -8
- package/dist/resources/handlers.js.map +1 -1
- package/dist/server/poll.d.ts +12 -4
- package/dist/server/poll.d.ts.map +1 -1
- package/dist/server/poll.js +236 -9
- package/dist/server/poll.js.map +1 -1
- package/dist/styles/agent-native.css +27 -0
- package/dist/templates/default/.agents/skills/actions/SKILL.md +5 -0
- package/dist/templates/default/.agents/skills/adding-a-feature/SKILL.md +5 -0
- package/dist/templates/default/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/dist/templates/default/.agents/skills/security/SKILL.md +7 -0
- package/dist/templates/default/.agents/skills/storing-data/SKILL.md +5 -1
- package/dist/templates/default/AGENTS.md +4 -2
- package/dist/templates/headless/AGENTS.md +4 -0
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +5 -0
- package/dist/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +5 -0
- package/dist/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +4 -0
- package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +6 -0
- package/dist/templates/workspace-core/.agents/skills/performance/SKILL.md +4 -0
- package/dist/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/dist/templates/workspace-core/.agents/skills/security/SKILL.md +7 -0
- package/dist/templates/workspace-core/.agents/skills/storing-data/SKILL.md +5 -1
- package/dist/templates/workspace-core/AGENTS.md +7 -1
- package/dist/templates/workspace-root/AGENTS.md +7 -1
- package/package.json +1 -1
- package/src/templates/default/.agents/skills/actions/SKILL.md +5 -0
- package/src/templates/default/.agents/skills/adding-a-feature/SKILL.md +5 -0
- package/src/templates/default/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/src/templates/default/.agents/skills/security/SKILL.md +7 -0
- package/src/templates/default/.agents/skills/storing-data/SKILL.md +5 -1
- package/src/templates/default/AGENTS.md +4 -2
- package/src/templates/headless/AGENTS.md +4 -0
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +5 -0
- package/src/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +5 -0
- package/src/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +4 -0
- package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +6 -0
- package/src/templates/workspace-core/.agents/skills/performance/SKILL.md +4 -0
- package/src/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/src/templates/workspace-core/.agents/skills/security/SKILL.md +7 -0
- package/src/templates/workspace-core/.agents/skills/storing-data/SKILL.md +5 -1
- package/src/templates/workspace-core/AGENTS.md +7 -1
- package/src/templates/workspace-root/AGENTS.md +7 -1
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { useT } from "@agent-native/core/client";
|
|
2
|
+
import { IconHistory, IconLoader2, IconRotate } from "@tabler/icons-react";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { toast } from "sonner";
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
AlertDialog,
|
|
8
|
+
AlertDialogAction,
|
|
9
|
+
AlertDialogCancel,
|
|
10
|
+
AlertDialogContent,
|
|
11
|
+
AlertDialogDescription,
|
|
12
|
+
AlertDialogFooter,
|
|
13
|
+
AlertDialogHeader,
|
|
14
|
+
AlertDialogTitle,
|
|
15
|
+
} from "@/components/ui/alert-dialog";
|
|
16
|
+
import { Button } from "@/components/ui/button";
|
|
17
|
+
import {
|
|
18
|
+
Sheet,
|
|
19
|
+
SheetContent,
|
|
20
|
+
SheetDescription,
|
|
21
|
+
SheetHeader,
|
|
22
|
+
SheetTitle,
|
|
23
|
+
} from "@/components/ui/sheet";
|
|
24
|
+
import {
|
|
25
|
+
type DashboardRevision,
|
|
26
|
+
useDashboardRevisions,
|
|
27
|
+
useRestoreDashboardRevision,
|
|
28
|
+
} from "@/hooks/use-dashboard-revisions";
|
|
29
|
+
|
|
30
|
+
function formatRelativeTime(dateStr: string): string {
|
|
31
|
+
const then = new Date(dateStr).getTime();
|
|
32
|
+
if (!Number.isFinite(then)) return dateStr;
|
|
33
|
+
const diffMs = Date.now() - then;
|
|
34
|
+
const diffMin = Math.floor(diffMs / 60_000);
|
|
35
|
+
const diffHr = Math.floor(diffMs / 3_600_000);
|
|
36
|
+
const diffDay = Math.floor(diffMs / 86_400_000);
|
|
37
|
+
|
|
38
|
+
if (diffMin < 1) return "Just now";
|
|
39
|
+
if (diffMin < 60) return `${diffMin}m ago`;
|
|
40
|
+
if (diffHr < 24) return `${diffHr}h ago`;
|
|
41
|
+
if (diffDay < 7) return `${diffDay}d ago`;
|
|
42
|
+
return new Date(dateStr).toLocaleDateString();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface DashboardHistoryPanelProps {
|
|
46
|
+
dashboardId: string;
|
|
47
|
+
open: boolean;
|
|
48
|
+
onOpenChange: (open: boolean) => void;
|
|
49
|
+
canRestore?: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function DashboardHistoryPanel({
|
|
53
|
+
dashboardId,
|
|
54
|
+
open,
|
|
55
|
+
onOpenChange,
|
|
56
|
+
canRestore = true,
|
|
57
|
+
}: DashboardHistoryPanelProps) {
|
|
58
|
+
const t = useT();
|
|
59
|
+
const { data: revisions, isLoading } = useDashboardRevisions(
|
|
60
|
+
open ? dashboardId : null,
|
|
61
|
+
);
|
|
62
|
+
const restoreRevision = useRestoreDashboardRevision(dashboardId);
|
|
63
|
+
const [pendingRestore, setPendingRestore] =
|
|
64
|
+
useState<DashboardRevision | null>(null);
|
|
65
|
+
|
|
66
|
+
const doRestore = async (revision: DashboardRevision) => {
|
|
67
|
+
try {
|
|
68
|
+
await restoreRevision.mutateAsync({
|
|
69
|
+
dashboardId,
|
|
70
|
+
revisionId: revision.id,
|
|
71
|
+
});
|
|
72
|
+
toast.success(t("dashboard.historyRestored"));
|
|
73
|
+
setPendingRestore(null);
|
|
74
|
+
onOpenChange(false);
|
|
75
|
+
} catch {
|
|
76
|
+
toast.error(t("dashboard.historyRestoreFailed"));
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<>
|
|
82
|
+
<Sheet open={open} onOpenChange={onOpenChange}>
|
|
83
|
+
<SheetContent side="right" className="w-[85vw] max-w-[420px] p-0">
|
|
84
|
+
<SheetHeader className="px-4 pb-0 pt-4">
|
|
85
|
+
<SheetTitle className="flex items-center gap-2 text-sm font-medium">
|
|
86
|
+
<IconHistory size={16} />
|
|
87
|
+
{t("dashboard.historyTitle")}
|
|
88
|
+
</SheetTitle>
|
|
89
|
+
<SheetDescription>
|
|
90
|
+
{t("dashboard.historyDescription")}
|
|
91
|
+
</SheetDescription>
|
|
92
|
+
</SheetHeader>
|
|
93
|
+
|
|
94
|
+
<div className="mt-3 border-t border-border" />
|
|
95
|
+
|
|
96
|
+
<div className="h-[calc(100%-96px)] overflow-y-auto p-2">
|
|
97
|
+
{isLoading ? (
|
|
98
|
+
<div className="flex items-center justify-center py-12">
|
|
99
|
+
<IconLoader2
|
|
100
|
+
size={16}
|
|
101
|
+
className="animate-spin text-muted-foreground"
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
) : !revisions?.length ? (
|
|
105
|
+
<div className="px-6 py-12 text-center text-xs text-muted-foreground">
|
|
106
|
+
{t("dashboard.historyEmpty")}
|
|
107
|
+
</div>
|
|
108
|
+
) : (
|
|
109
|
+
<div className="space-y-1">
|
|
110
|
+
{revisions.map((revision) => (
|
|
111
|
+
<div
|
|
112
|
+
key={revision.id}
|
|
113
|
+
className="rounded-lg border border-border bg-card p-3"
|
|
114
|
+
>
|
|
115
|
+
<div className="flex items-start justify-between gap-3">
|
|
116
|
+
<div className="min-w-0">
|
|
117
|
+
<p className="truncate text-xs font-medium">
|
|
118
|
+
{revision.title || t("common.untitledDashboard")}
|
|
119
|
+
</p>
|
|
120
|
+
<p className="mt-0.5 text-[10px] text-muted-foreground">
|
|
121
|
+
{formatRelativeTime(revision.createdAt)}
|
|
122
|
+
{revision.createdBy
|
|
123
|
+
? ` by ${revision.createdBy}`
|
|
124
|
+
: ""}
|
|
125
|
+
</p>
|
|
126
|
+
</div>
|
|
127
|
+
{canRestore ? (
|
|
128
|
+
<Button
|
|
129
|
+
type="button"
|
|
130
|
+
size="sm"
|
|
131
|
+
variant="outline"
|
|
132
|
+
className="h-7 shrink-0 px-2 text-[11px]"
|
|
133
|
+
onClick={() => setPendingRestore(revision)}
|
|
134
|
+
disabled={restoreRevision.isPending}
|
|
135
|
+
>
|
|
136
|
+
{restoreRevision.isPending ? (
|
|
137
|
+
<IconLoader2 size={13} className="animate-spin" />
|
|
138
|
+
) : (
|
|
139
|
+
<IconRotate size={13} />
|
|
140
|
+
)}
|
|
141
|
+
<span className="ml-1">
|
|
142
|
+
{t("dashboard.historyRestore")}
|
|
143
|
+
</span>
|
|
144
|
+
</Button>
|
|
145
|
+
) : null}
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
))}
|
|
149
|
+
</div>
|
|
150
|
+
)}
|
|
151
|
+
</div>
|
|
152
|
+
</SheetContent>
|
|
153
|
+
</Sheet>
|
|
154
|
+
|
|
155
|
+
<AlertDialog
|
|
156
|
+
open={pendingRestore !== null}
|
|
157
|
+
onOpenChange={(nextOpen) => {
|
|
158
|
+
if (!nextOpen) setPendingRestore(null);
|
|
159
|
+
}}
|
|
160
|
+
>
|
|
161
|
+
<AlertDialogContent>
|
|
162
|
+
<AlertDialogHeader>
|
|
163
|
+
<AlertDialogTitle>
|
|
164
|
+
{t("dashboard.historyRestoreQuestion")}
|
|
165
|
+
</AlertDialogTitle>
|
|
166
|
+
<AlertDialogDescription>
|
|
167
|
+
{t("dashboard.historyRestoreWarning")}
|
|
168
|
+
</AlertDialogDescription>
|
|
169
|
+
</AlertDialogHeader>
|
|
170
|
+
<AlertDialogFooter>
|
|
171
|
+
<AlertDialogCancel>{t("common.cancel")}</AlertDialogCancel>
|
|
172
|
+
<AlertDialogAction
|
|
173
|
+
onClick={() => {
|
|
174
|
+
if (pendingRestore) void doRestore(pendingRestore);
|
|
175
|
+
}}
|
|
176
|
+
>
|
|
177
|
+
{t("dashboard.historyRestore")}
|
|
178
|
+
</AlertDialogAction>
|
|
179
|
+
</AlertDialogFooter>
|
|
180
|
+
</AlertDialogContent>
|
|
181
|
+
</AlertDialog>
|
|
182
|
+
</>
|
|
183
|
+
);
|
|
184
|
+
}
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
useT,
|
|
9
9
|
} from "@agent-native/core/client";
|
|
10
10
|
import { extensionPath } from "@agent-native/core/client/extensions";
|
|
11
|
+
import { useOrgRole } from "@agent-native/core/client/org";
|
|
11
12
|
import {
|
|
12
13
|
IconFlask,
|
|
13
14
|
IconTool,
|
|
@@ -64,8 +65,8 @@ interface ExtensionSearchItem {
|
|
|
64
65
|
const defaultTools = [
|
|
65
66
|
{
|
|
66
67
|
id: "agents",
|
|
67
|
-
nameKey: "navigation.
|
|
68
|
-
href: "/agents",
|
|
68
|
+
nameKey: "navigation.admin",
|
|
69
|
+
href: "/agents?view=dashboards",
|
|
69
70
|
keywords: [
|
|
70
71
|
"agent monitoring",
|
|
71
72
|
"observability",
|
|
@@ -74,6 +75,8 @@ const defaultTools = [
|
|
|
74
75
|
"feedback",
|
|
75
76
|
"database",
|
|
76
77
|
"db admin",
|
|
78
|
+
"dashboard usage",
|
|
79
|
+
"dashboard audit",
|
|
77
80
|
"ab testing",
|
|
78
81
|
"llm",
|
|
79
82
|
],
|
|
@@ -218,6 +221,7 @@ function persistThemePreference(theme: "light" | "dark") {
|
|
|
218
221
|
|
|
219
222
|
export function CommandPalette() {
|
|
220
223
|
const t = useT();
|
|
224
|
+
const { canManageOrg } = useOrgRole();
|
|
221
225
|
const [open, setOpen] = useState(false);
|
|
222
226
|
const [changelogOpen, setChangelogOpen] = useState(false);
|
|
223
227
|
const [languageOpen, setLanguageOpen] = useState(false);
|
|
@@ -428,20 +432,22 @@ export function CommandPalette() {
|
|
|
428
432
|
</CommandGroup>
|
|
429
433
|
|
|
430
434
|
<CommandGroup heading={t("commandPalette.groupTools")}>
|
|
431
|
-
{defaultTools
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
435
|
+
{defaultTools
|
|
436
|
+
.filter((tool) => tool.id !== "agents" || canManageOrg)
|
|
437
|
+
.map((tool) => (
|
|
438
|
+
<CommandItem
|
|
439
|
+
key={`tool-${tool.id}`}
|
|
440
|
+
onSelect={() => go(tool.href)}
|
|
441
|
+
keywords={commandPaletteKeywords(
|
|
442
|
+
t(tool.nameKey),
|
|
443
|
+
"tool",
|
|
444
|
+
...tool.keywords,
|
|
445
|
+
)}
|
|
446
|
+
>
|
|
447
|
+
<IconTool className="me-2 h-4 w-4 text-muted-foreground" />
|
|
448
|
+
{t(tool.nameKey)}
|
|
449
|
+
</CommandItem>
|
|
450
|
+
))}
|
|
445
451
|
</CommandGroup>
|
|
446
452
|
|
|
447
453
|
<CommandGroup heading={t("commandPalette.groupAppearance")}>
|
|
@@ -21,7 +21,7 @@ const pageTitleKeys: Record<string, string> = {
|
|
|
21
21
|
"/analyses": "navigation.analyses",
|
|
22
22
|
"/sessions": "navigation.sessions",
|
|
23
23
|
"/monitoring": "navigation.monitoring",
|
|
24
|
-
"/agents": "navigation.
|
|
24
|
+
"/agents": "navigation.admin",
|
|
25
25
|
"/dashboards/explorer": "navigation.explorer",
|
|
26
26
|
"/settings": "navigation.settings",
|
|
27
27
|
};
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
IconReportAnalytics,
|
|
15
15
|
IconSearch,
|
|
16
16
|
IconArchive,
|
|
17
|
-
IconActivity,
|
|
18
17
|
IconHeartbeat,
|
|
19
18
|
IconPin,
|
|
20
19
|
IconPlus,
|
|
@@ -27,6 +26,7 @@ import {
|
|
|
27
26
|
IconPlayerPlay,
|
|
28
27
|
IconLayoutSidebarLeftCollapse,
|
|
29
28
|
IconLayoutSidebarLeftExpand,
|
|
29
|
+
IconShieldCheck,
|
|
30
30
|
} from "@tabler/icons-react";
|
|
31
31
|
import {
|
|
32
32
|
useQuery,
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
type ChatThreadSummary,
|
|
84
84
|
} from "@agent-native/core/client";
|
|
85
85
|
import { ExtensionsSidebarSection } from "@agent-native/core/client/extensions";
|
|
86
|
-
import { OrgSwitcher } from "@agent-native/core/client/org";
|
|
86
|
+
import { OrgSwitcher, useOrgRole } from "@agent-native/core/client/org";
|
|
87
87
|
|
|
88
88
|
import {
|
|
89
89
|
AlertDialog,
|
|
@@ -1585,6 +1585,7 @@ export function Sidebar({ mobile }: { mobile?: boolean } = {}) {
|
|
|
1585
1585
|
const navigate = useNavigate();
|
|
1586
1586
|
const t = useT();
|
|
1587
1587
|
const queryClient = useQueryClient();
|
|
1588
|
+
const { canManageOrg } = useOrgRole();
|
|
1588
1589
|
const { setTheme } = useTheme();
|
|
1589
1590
|
|
|
1590
1591
|
const isAskRoute = location.pathname === "/ask";
|
|
@@ -2397,12 +2398,16 @@ export function Sidebar({ mobile }: { mobile?: boolean } = {}) {
|
|
|
2397
2398
|
href: "/monitoring",
|
|
2398
2399
|
active: location.pathname.startsWith("/monitoring"),
|
|
2399
2400
|
},
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2401
|
+
...(canManageOrg
|
|
2402
|
+
? [
|
|
2403
|
+
{
|
|
2404
|
+
icon: IconShieldCheck,
|
|
2405
|
+
label: t("navigation.admin"),
|
|
2406
|
+
href: "/agents?view=dashboards",
|
|
2407
|
+
active: location.pathname.startsWith("/agents"),
|
|
2408
|
+
},
|
|
2409
|
+
]
|
|
2410
|
+
: []),
|
|
2406
2411
|
{
|
|
2407
2412
|
icon: IconDatabase,
|
|
2408
2413
|
label: t("navigation.dataSources"),
|
|
@@ -2618,19 +2623,20 @@ export function Sidebar({ mobile }: { mobile?: boolean } = {}) {
|
|
|
2618
2623
|
{t("navigation.monitoring")}
|
|
2619
2624
|
</Link>
|
|
2620
2625
|
|
|
2621
|
-
{
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2626
|
+
{canManageOrg ? (
|
|
2627
|
+
<Link
|
|
2628
|
+
to="/agents?view=dashboards"
|
|
2629
|
+
className={cn(
|
|
2630
|
+
"flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",
|
|
2631
|
+
location.pathname.startsWith("/agents")
|
|
2632
|
+
? "bg-sidebar-accent text-sidebar-accent-foreground"
|
|
2633
|
+
: "text-muted-foreground hover:bg-sidebar-accent/50",
|
|
2634
|
+
)}
|
|
2635
|
+
>
|
|
2636
|
+
<IconShieldCheck className="h-4 w-4" />
|
|
2637
|
+
{t("navigation.admin")}
|
|
2638
|
+
</Link>
|
|
2639
|
+
) : null}
|
|
2634
2640
|
|
|
2635
2641
|
{/* Data Sources link */}
|
|
2636
2642
|
<Link
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useActionMutation, useActionQuery } from "@agent-native/core/client";
|
|
2
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
|
|
4
|
+
export interface AnalysisRevision {
|
|
5
|
+
id: string;
|
|
6
|
+
analysisId: string;
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
createdAt: string;
|
|
10
|
+
createdBy: string | null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function useAnalysisRevisions(analysisId: string | null) {
|
|
14
|
+
return useActionQuery<AnalysisRevision[]>(
|
|
15
|
+
"list-analysis-revisions",
|
|
16
|
+
analysisId ? { analysisId } : undefined,
|
|
17
|
+
{
|
|
18
|
+
enabled: !!analysisId,
|
|
19
|
+
select: (data: any) => {
|
|
20
|
+
const revisions = data?.revisions ?? data;
|
|
21
|
+
return Array.isArray(revisions) ? revisions : [];
|
|
22
|
+
},
|
|
23
|
+
placeholderData: (prev: any) => prev,
|
|
24
|
+
} as any,
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function useRestoreAnalysisRevision(analysisId: string) {
|
|
29
|
+
const queryClient = useQueryClient();
|
|
30
|
+
return useActionMutation<
|
|
31
|
+
{ id: string; name: string; updatedAt: string },
|
|
32
|
+
{ analysisId: string; revisionId: string }
|
|
33
|
+
>("restore-analysis-revision", {
|
|
34
|
+
onSuccess: () => {
|
|
35
|
+
queryClient.invalidateQueries({
|
|
36
|
+
queryKey: ["action", "list-analysis-revisions", { analysisId }],
|
|
37
|
+
});
|
|
38
|
+
queryClient.invalidateQueries({
|
|
39
|
+
queryKey: ["analysis-detail", analysisId],
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deleteClientAppState,
|
|
3
|
+
readClientAppState,
|
|
4
|
+
removeAgentChatContextItem,
|
|
5
|
+
setAgentChatContextItem,
|
|
6
|
+
setClientAppState,
|
|
7
|
+
} from "@agent-native/core/client";
|
|
8
|
+
import { useEffect } from "react";
|
|
9
|
+
|
|
10
|
+
import { TAB_ID } from "@/lib/tab-id";
|
|
11
|
+
|
|
12
|
+
const DASHBOARD_CONTEXT_KEY = "analytics-selected-dashboard";
|
|
13
|
+
const SELECTED_OBJECT_STATE_KEY = "selected-object";
|
|
14
|
+
const SELECTED_OBJECT_SOURCE_FIELD = "__agentNativeSelectedObjectSource";
|
|
15
|
+
|
|
16
|
+
export interface DashboardChatContextArgs {
|
|
17
|
+
id: string | null | undefined;
|
|
18
|
+
kind: "explorer" | "sql";
|
|
19
|
+
title?: string | null;
|
|
20
|
+
panelCount?: number;
|
|
21
|
+
canEdit?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function dashboardContext(
|
|
25
|
+
args: Required<Pick<DashboardChatContextArgs, "id" | "kind">> & {
|
|
26
|
+
title: string;
|
|
27
|
+
panelCount?: number;
|
|
28
|
+
canEdit?: boolean;
|
|
29
|
+
},
|
|
30
|
+
): string {
|
|
31
|
+
const lines = [
|
|
32
|
+
`The user currently has this Analytics dashboard selected: ${args.title}.`,
|
|
33
|
+
`Dashboard id: ${args.id}`,
|
|
34
|
+
`Dashboard kind: ${args.kind}`,
|
|
35
|
+
];
|
|
36
|
+
if (typeof args.panelCount === "number") {
|
|
37
|
+
lines.push(`Panel count: ${args.panelCount}`);
|
|
38
|
+
}
|
|
39
|
+
if (typeof args.canEdit === "boolean") {
|
|
40
|
+
lines.push(`User can edit: ${args.canEdit ? "yes" : "no"}`);
|
|
41
|
+
}
|
|
42
|
+
if (typeof window !== "undefined") {
|
|
43
|
+
lines.push(
|
|
44
|
+
`Current URL: ${window.location.pathname}${window.location.search}`,
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
lines.push(
|
|
48
|
+
"Use the Analytics dashboard actions to inspect, edit, or restore this dashboard.",
|
|
49
|
+
);
|
|
50
|
+
return lines.join("\n");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function deleteSelectedObjectIfOwned() {
|
|
54
|
+
try {
|
|
55
|
+
const current = await readClientAppState<Record<string, unknown>>(
|
|
56
|
+
SELECTED_OBJECT_STATE_KEY,
|
|
57
|
+
);
|
|
58
|
+
if (current?.[SELECTED_OBJECT_SOURCE_FIELD] !== TAB_ID) return;
|
|
59
|
+
await deleteClientAppState(SELECTED_OBJECT_STATE_KEY, {
|
|
60
|
+
keepalive: true,
|
|
61
|
+
requestSource: TAB_ID,
|
|
62
|
+
});
|
|
63
|
+
} catch {
|
|
64
|
+
// Best effort only; avoid clearing another tab's selected object on errors.
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function useDashboardChatContext(args: DashboardChatContextArgs): void {
|
|
69
|
+
const { id, kind, title, panelCount, canEdit } = args;
|
|
70
|
+
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
if (!id) return;
|
|
73
|
+
const displayTitle = title?.trim() || id;
|
|
74
|
+
const selection = {
|
|
75
|
+
type: "dashboard",
|
|
76
|
+
id,
|
|
77
|
+
kind,
|
|
78
|
+
title: displayTitle,
|
|
79
|
+
panelCount,
|
|
80
|
+
canEdit,
|
|
81
|
+
[SELECTED_OBJECT_SOURCE_FIELD]: TAB_ID,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
setAgentChatContextItem({
|
|
85
|
+
key: DASHBOARD_CONTEXT_KEY,
|
|
86
|
+
title: `Dashboard: ${displayTitle}`,
|
|
87
|
+
context: dashboardContext({
|
|
88
|
+
id,
|
|
89
|
+
kind,
|
|
90
|
+
title: displayTitle,
|
|
91
|
+
panelCount,
|
|
92
|
+
canEdit,
|
|
93
|
+
}),
|
|
94
|
+
openSidebar: false,
|
|
95
|
+
focus: false,
|
|
96
|
+
});
|
|
97
|
+
setClientAppState(SELECTED_OBJECT_STATE_KEY, selection, {
|
|
98
|
+
keepalive: true,
|
|
99
|
+
requestSource: TAB_ID,
|
|
100
|
+
}).catch(() => {});
|
|
101
|
+
|
|
102
|
+
return () => {
|
|
103
|
+
removeAgentChatContextItem({
|
|
104
|
+
key: DASHBOARD_CONTEXT_KEY,
|
|
105
|
+
openSidebar: false,
|
|
106
|
+
});
|
|
107
|
+
deleteSelectedObjectIfOwned();
|
|
108
|
+
};
|
|
109
|
+
}, [canEdit, id, kind, panelCount, title]);
|
|
110
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useActionMutation, useActionQuery } from "@agent-native/core/client";
|
|
2
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
|
|
4
|
+
export interface DashboardRevision {
|
|
5
|
+
id: string;
|
|
6
|
+
dashboardId: string;
|
|
7
|
+
kind: "explorer" | "sql";
|
|
8
|
+
title: string;
|
|
9
|
+
createdAt: string;
|
|
10
|
+
createdBy: string | null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function useDashboardRevisions(dashboardId: string | null) {
|
|
14
|
+
return useActionQuery<DashboardRevision[]>(
|
|
15
|
+
"list-dashboard-revisions",
|
|
16
|
+
dashboardId ? { dashboardId } : undefined,
|
|
17
|
+
{
|
|
18
|
+
enabled: !!dashboardId,
|
|
19
|
+
select: (data: any) => {
|
|
20
|
+
const revisions = data?.revisions ?? data;
|
|
21
|
+
return Array.isArray(revisions) ? revisions : [];
|
|
22
|
+
},
|
|
23
|
+
placeholderData: (prev: any) => prev,
|
|
24
|
+
} as any,
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function useRestoreDashboardRevision(dashboardId: string) {
|
|
29
|
+
const queryClient = useQueryClient();
|
|
30
|
+
return useActionMutation<
|
|
31
|
+
{ id: string; name: string; updatedAt: string },
|
|
32
|
+
{ dashboardId: string; revisionId: string }
|
|
33
|
+
>("restore-dashboard-revision", {
|
|
34
|
+
onSuccess: () => {
|
|
35
|
+
queryClient.invalidateQueries({
|
|
36
|
+
queryKey: ["action", "list-dashboard-revisions", { dashboardId }],
|
|
37
|
+
});
|
|
38
|
+
queryClient.invalidateQueries({
|
|
39
|
+
queryKey: ["dashboard", dashboardId],
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
@@ -127,9 +127,14 @@ export function useNavigationState() {
|
|
|
127
127
|
if (cmd.view === "sessions" && cmd.recordingId)
|
|
128
128
|
return `/sessions/${encodeURIComponent(cmd.recordingId)}`;
|
|
129
129
|
if (cmd.view === "sessions") return "/sessions";
|
|
130
|
-
if (
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
if (
|
|
131
|
+
cmd.view === "agents" &&
|
|
132
|
+
(cmd.agentsView === "database" || cmd.agentsView === "dashboards")
|
|
133
|
+
) {
|
|
134
|
+
const params = new URLSearchParams({ view: cmd.agentsView });
|
|
135
|
+
if (cmd.agentsView === "database" && cmd.dbAdminConnectionId) {
|
|
136
|
+
params.set("db", cmd.dbAdminConnectionId);
|
|
137
|
+
}
|
|
133
138
|
return `/agents?${params.toString()}`;
|
|
134
139
|
}
|
|
135
140
|
if (cmd.view === "agents") return "/agents";
|