@agent-native/core 0.106.3 → 0.107.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 +23 -0
- package/corpus/core/docs/content/integrations.mdx +597 -0
- package/corpus/core/docs/content/locales/ar-SA/mcp-clients.mdx +19 -1
- package/corpus/core/docs/content/locales/de-DE/mcp-clients.mdx +22 -1
- package/corpus/core/docs/content/locales/es-ES/mcp-clients.mdx +23 -1
- package/corpus/core/docs/content/locales/fr-FR/mcp-clients.mdx +23 -1
- package/corpus/core/docs/content/locales/hi-IN/mcp-clients.mdx +22 -1
- package/corpus/core/docs/content/locales/ja-JP/mcp-clients.mdx +21 -1
- package/corpus/core/docs/content/locales/ko-KR/mcp-clients.mdx +20 -1
- package/corpus/core/docs/content/locales/pt-BR/mcp-clients.mdx +22 -1
- package/corpus/core/docs/content/locales/zh-CN/mcp-clients.mdx +17 -1
- package/corpus/core/docs/content/locales/zh-TW/mcp-clients.mdx +17 -1
- package/corpus/core/docs/content/mcp-clients.mdx +51 -1
- package/corpus/core/docs/content/organizations-teams-permissions.mdx +413 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/agent/production-agent.ts +19 -0
- package/corpus/core/src/agent/run-store.ts +98 -2
- package/corpus/core/src/client/AssistantChat.tsx +26 -1
- package/corpus/core/src/client/CommandMenu.tsx +5 -0
- package/corpus/core/src/client/active-run-state.ts +34 -0
- package/corpus/core/src/client/agent-chat-adapter.ts +4 -0
- package/corpus/core/src/client/chat/message-components.tsx +41 -0
- package/corpus/core/src/client/composer/TiptapComposer.tsx +45 -8
- package/corpus/core/src/client/integrations/IntegrationsPanel.tsx +30 -11
- package/corpus/core/src/client/resources/McpConnectionSuggestion.tsx +270 -0
- package/corpus/core/src/client/resources/McpIntegrationDialog.tsx +177 -40
- package/corpus/core/src/client/resources/mcp-integration-catalog.ts +478 -4
- package/corpus/core/src/client/resources/mcp-integration-logos.ts +108 -0
- package/corpus/core/src/client/sharing/ShareButton.tsx +30 -9
- package/corpus/core/src/client/use-agent-chat-home-handoff.ts +2 -2
- package/corpus/core/src/deploy/build.ts +32 -0
- package/corpus/core/src/extensions/html-shell.ts +33 -1
- package/corpus/core/src/ingestion/office.ts +1 -2
- package/corpus/core/src/ingestion/pptx.ts +2 -4
- package/corpus/core/src/localization/default-messages.ts +129 -1
- package/corpus/core/src/mcp/actions/call-mcp-tool.ts +1 -0
- package/corpus/core/src/secrets/register-framework-secrets.ts +28 -0
- package/corpus/core/src/server/agent-chat-plugin.ts +29 -1
- package/corpus/core/src/server/index.ts +4 -0
- package/corpus/core/src/server/org-admin.ts +28 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +9 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/extensions/references/api.md +31 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +9 -0
- package/corpus/core/src/vite/client.ts +24 -0
- package/corpus/templates/analytics/.agents/skills/creative-context/SKILL.md +64 -0
- package/corpus/templates/analytics/.agents/skills/dashboard-management/SKILL.md +29 -21
- package/corpus/templates/analytics/AGENTS.md +13 -0
- package/corpus/templates/analytics/actions/clone-creative-context-dashboard.ts +86 -0
- package/corpus/templates/analytics/actions/dashboard-mutation-api.ts +1 -1
- package/corpus/templates/analytics/actions/update-dashboard.ts +6 -2
- package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +35 -7
- package/corpus/templates/analytics/app/components/layout/Layout.tsx +3 -3
- package/corpus/templates/analytics/app/i18n/zh-TW.ts +1 -0
- package/corpus/templates/analytics/app/i18n-data.ts +1 -0
- package/corpus/templates/analytics/app/pages/Ask.tsx +8 -4
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/SqlChartCard.tsx +11 -1
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/extension-slot.ts +11 -0
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +86 -0
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/types.ts +6 -0
- package/corpus/templates/analytics/app/routes/agent.tsx +7 -1
- package/corpus/templates/analytics/changelog/2026-07-17-dashboard-extension-boxes.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-17-library-now-flags-published-dashboards-with-newer-versions-a.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-17-resources-can-be-added-to-creative-context-from-their-action.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-17-you-can-add-exact-approved-artifact-versions-to-governed-cre.md +6 -0
- package/corpus/templates/analytics/package.json +1 -0
- package/corpus/templates/analytics/server/lib/agent-readable-resource-context.ts +8 -0
- package/corpus/templates/analytics/server/lib/native-creative-context.ts +158 -0
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +1 -0
- package/corpus/templates/analytics/server/plugins/creative-context.ts +10 -0
- package/corpus/templates/assets/.agents/skills/creative-context/SKILL.md +12 -3
- package/corpus/templates/assets/AGENTS.md +5 -0
- package/corpus/templates/assets/actions/clone-creative-context-asset.ts +74 -0
- package/corpus/templates/assets/app/hooks/use-navigation-state.ts +2 -1
- package/corpus/templates/assets/app/routes/brand-kits.$id.tsx +308 -178
- package/corpus/templates/assets/app/routes/library.tsx +5 -11
- package/corpus/templates/assets/changelog/2026-07-17-library-now-flags-published-assets-with-newer-versions-and-l.md +6 -0
- package/corpus/templates/assets/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it-or-sta.md +6 -0
- package/corpus/templates/assets/changelog/2026-07-17-you-can-add-exact-approved-artifact-versions-to-governed-cre.md +6 -0
- package/corpus/templates/assets/server/lib/native-creative-context.ts +198 -0
- package/corpus/templates/assets/server/plugins/creative-context.ts +4 -0
- package/corpus/templates/brain/actions/provider-api-request.ts +1 -0
- package/corpus/templates/brain/app/hooks/use-navigation-state.ts +6 -1
- package/corpus/templates/brain/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it-or-sta.md +6 -0
- package/corpus/templates/calendar/actions/provider-api-request.ts +1 -0
- package/corpus/templates/calendar/app/components/layout/AppLayout.tsx +1 -1
- package/corpus/templates/calendar/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it-or-sta.md +6 -0
- package/corpus/templates/chat/app/hooks/use-navigation-state.ts +4 -1
- package/corpus/templates/chat/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it-or-sta.md +6 -0
- package/corpus/templates/clips/actions/get-recording-insights.ts +7 -4
- package/corpus/templates/clips/actions/list-recordings.ts +48 -0
- package/corpus/templates/clips/actions/list-viewers.ts +2 -1
- package/corpus/templates/clips/app/components/editor/stitch-manager.tsx +3 -1
- package/corpus/templates/clips/app/components/library/library-layout.tsx +1 -1
- package/corpus/templates/clips/app/components/player/share-dialog.tsx +1 -3
- package/corpus/templates/clips/app/hooks/use-desktop-promo.ts +11 -6
- package/corpus/templates/clips/app/hooks/use-view-tracking.ts +6 -1
- package/corpus/templates/clips/app/lib/ffmpeg-export.ts +4 -2
- package/corpus/templates/clips/app/routes/share.$shareId.tsx +21 -3
- package/corpus/templates/clips/changelog/2026-07-17-dictation-keeps-sentence-spacing-and-no-longer-crashes-when-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-17-shared-clips-now-preserve-editor-access-and-show-editor-insi.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-17-stitching-clips-no-longer-fails-when-editor-media-metadata-i.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it-or-sta.md +6 -0
- package/corpus/templates/clips/server/routes/api/public-recording.get.ts +14 -8
- package/corpus/templates/clips/shared/view-analytics.ts +4 -0
- package/corpus/templates/content/.agents/skills/creative-context/SKILL.md +12 -3
- package/corpus/templates/content/AGENTS.md +5 -0
- package/corpus/templates/content/actions/_content-space-access.ts +45 -2
- package/corpus/templates/content/actions/clone-creative-context-document.ts +61 -0
- package/corpus/templates/content/actions/create-content-database.ts +41 -7
- package/corpus/templates/content/actions/provider-api-request.ts +1 -0
- package/corpus/templates/content/app/components/editor/DocumentToolbar.tsx +21 -0
- package/corpus/templates/content/app/components/layout/Layout.tsx +1 -1
- package/corpus/templates/content/app/components/sidebar/DocumentTreeItem.tsx +29 -0
- package/corpus/templates/content/app/root.tsx +1 -10
- package/corpus/templates/content/changelog/2026-07-17-creating-a-database-now-completes-reliably-in-hosted-workspa.md +6 -0
- package/corpus/templates/content/changelog/2026-07-17-library-now-flags-published-documents-with-newer-versions-an.md +6 -0
- package/corpus/templates/content/changelog/2026-07-17-resources-can-be-added-to-creative-context-from-their-action.md +6 -0
- package/corpus/templates/content/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it-or-sta.md +6 -0
- package/corpus/templates/content/changelog/2026-07-17-you-can-add-exact-approved-artifact-versions-to-governed-cre.md +6 -0
- package/corpus/templates/content/parity/matrix.md +1 -1
- package/corpus/templates/content/parity/matrix.ts +1 -0
- package/corpus/templates/content/server/lib/native-creative-context.ts +191 -0
- package/corpus/templates/content/server/plugins/creative-context.ts +8 -1
- package/corpus/templates/design/.agents/skills/creative-context/SKILL.md +11 -3
- package/corpus/templates/design/AGENTS.md +5 -0
- package/corpus/templates/design/actions/clone-creative-context-design-native.ts +111 -0
- package/corpus/templates/design/actions/provider-api-request.ts +1 -0
- package/corpus/templates/design/app/pages/Index.tsx +44 -0
- package/corpus/templates/design/app/pages/design-editor/types.ts +1 -0
- package/corpus/templates/design/changelog/2026-07-17-library-now-flags-published-designs-with-newer-versions-and-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-17-resources-can-be-added-to-creative-context-from-their-action.md +6 -0
- package/corpus/templates/design/changelog/2026-07-17-you-can-add-exact-approved-artifact-versions-to-governed-cre.md +6 -0
- package/corpus/templates/design/server/lib/native-creative-context.ts +265 -0
- package/corpus/templates/design/server/plugins/creative-context.ts +8 -1
- package/corpus/templates/dispatch/actions/provider-api-request.ts +1 -0
- package/corpus/templates/dispatch/app/hooks/use-navigation-state.ts +4 -1
- package/corpus/templates/dispatch/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it-or-sta.md +6 -0
- package/corpus/templates/forms/app/components/layout/Layout.tsx +2 -4
- package/corpus/templates/forms/app/components/ui/popover.tsx +25 -1
- package/corpus/templates/forms/app/hooks/use-navigation-state.ts +6 -1
- package/corpus/templates/forms/app/pages/FormBuilderPage.tsx +13 -10
- package/corpus/templates/forms/app/root.tsx +6 -1
- package/corpus/templates/forms/changelog/2026-07-17-form-builder-popovers-stay-within-the-viewport.md +6 -0
- package/corpus/templates/forms/changelog/2026-07-17-form-editor-loading-matches-current-sidebar-free-layout.md +6 -0
- package/corpus/templates/forms/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it-or-sta.md +6 -0
- package/corpus/templates/mail/actions/provider-api-request.ts +1 -0
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +1 -1
- package/corpus/templates/mail/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it-or-sta.md +6 -0
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +14 -3
- package/corpus/templates/plan/app/hooks/use-navigation-state.ts +8 -1
- package/corpus/templates/plan/app/root.tsx +0 -2
- package/corpus/templates/plan/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it-or-sta.md +6 -0
- package/corpus/templates/slides/.agents/skills/creative-context/SKILL.md +11 -3
- package/corpus/templates/slides/AGENTS.md +5 -0
- package/corpus/templates/slides/actions/clone-creative-context-deck.ts +96 -0
- package/corpus/templates/slides/actions/extract-pdf.ts +3 -2
- package/corpus/templates/slides/actions/import-file.ts +3 -2
- package/corpus/templates/slides/actions/provider-api-request.ts +1 -0
- package/corpus/templates/slides/app/components/deck/DeckCard.tsx +27 -0
- package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +21 -0
- package/corpus/templates/slides/app/components/layout/Layout.tsx +1 -1
- package/corpus/templates/slides/app/context/DeckContext.tsx +23 -23
- package/corpus/templates/slides/changelog/2026-07-17-duplicated-slides-now-stay-in-the-deck.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-17-library-now-flags-published-decks-with-newer-versions-and-le.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-17-pdf-and-powerpoint-imports-now-work-reliably-in-hosted-decks.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-17-resources-can-be-added-to-creative-context-from-their-action.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it-or-sta.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-17-you-can-add-exact-approved-artifact-versions-to-governed-cre.md +6 -0
- package/corpus/templates/slides/server/lib/native-creative-context.ts +288 -0
- package/corpus/templates/slides/server/plugins/creative-context.ts +4 -0
- package/corpus/templates/tasks/app/components/layout/Layout.tsx +2 -13
- package/corpus/templates/tasks/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it.md +6 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +13 -1
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-store.d.ts +17 -0
- package/dist/agent/run-store.d.ts.map +1 -1
- package/dist/agent/run-store.js +84 -2
- package/dist/agent/run-store.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +18 -3
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/CommandMenu.d.ts.map +1 -1
- package/dist/client/CommandMenu.js +4 -0
- package/dist/client/CommandMenu.js.map +1 -1
- package/dist/client/active-run-state.d.ts +7 -0
- package/dist/client/active-run-state.d.ts.map +1 -1
- package/dist/client/active-run-state.js +28 -0
- package/dist/client/active-run-state.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +4 -1
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +35 -1
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/composer/TiptapComposer.d.ts +7 -0
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +37 -8
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/integrations/IntegrationsPanel.d.ts.map +1 -1
- package/dist/client/integrations/IntegrationsPanel.js +3 -2
- package/dist/client/integrations/IntegrationsPanel.js.map +1 -1
- package/dist/client/resources/McpConnectionSuggestion.d.ts +9 -0
- package/dist/client/resources/McpConnectionSuggestion.d.ts.map +1 -0
- package/dist/client/resources/McpConnectionSuggestion.js +134 -0
- package/dist/client/resources/McpConnectionSuggestion.js.map +1 -0
- package/dist/client/resources/McpIntegrationDialog.d.ts +2 -1
- package/dist/client/resources/McpIntegrationDialog.d.ts.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.js +51 -21
- package/dist/client/resources/McpIntegrationDialog.js.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.d.ts +15 -0
- package/dist/client/resources/mcp-integration-catalog.d.ts.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.js +420 -4
- package/dist/client/resources/mcp-integration-catalog.js.map +1 -1
- package/dist/client/resources/mcp-integration-logos.d.ts +2 -0
- package/dist/client/resources/mcp-integration-logos.d.ts.map +1 -0
- package/dist/client/resources/mcp-integration-logos.js +109 -0
- package/dist/client/resources/mcp-integration-logos.js.map +1 -0
- package/dist/client/sharing/ShareButton.d.ts.map +1 -1
- package/dist/client/sharing/ShareButton.js +15 -12
- package/dist/client/sharing/ShareButton.js.map +1 -1
- package/dist/client/use-agent-chat-home-handoff.d.ts +1 -1
- package/dist/client/use-agent-chat-home-handoff.d.ts.map +1 -1
- package/dist/client/use-agent-chat-home-handoff.js +1 -1
- package/dist/client/use-agent-chat-home-handoff.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +23 -0
- package/dist/deploy/build.js.map +1 -1
- package/dist/extensions/html-shell.d.ts.map +1 -1
- package/dist/extensions/html-shell.js +33 -1
- package/dist/extensions/html-shell.js.map +1 -1
- package/dist/ingestion/office.d.ts.map +1 -1
- package/dist/ingestion/office.js +1 -2
- package/dist/ingestion/office.js.map +1 -1
- package/dist/ingestion/pptx.js +2 -4
- package/dist/ingestion/pptx.js.map +1 -1
- package/dist/localization/default-messages.d.ts +100 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +101 -1
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/mcp/actions/call-mcp-tool.js +1 -0
- package/dist/mcp/actions/call-mcp-tool.js.map +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/observability/routes.d.ts +5 -5
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/secrets/register-framework-secrets.d.ts.map +1 -1
- package/dist/secrets/register-framework-secrets.js +25 -0
- package/dist/secrets/register-framework-secrets.js.map +1 -1
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +23 -1
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/org-admin.d.ts +3 -0
- package/dist/server/org-admin.d.ts.map +1 -0
- package/dist/server/org-admin.js +24 -0
- package/dist/server/org-admin.js.map +1 -0
- package/dist/templates/chat/app/hooks/use-navigation-state.ts +4 -1
- package/dist/templates/chat/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it-or-sta.md +6 -0
- package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +9 -0
- package/dist/templates/workspace-core/.agents/skills/extensions/references/api.md +31 -0
- package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +9 -0
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +20 -0
- package/dist/vite/client.js.map +1 -1
- package/docs/content/integrations.mdx +597 -0
- package/docs/content/locales/ar-SA/mcp-clients.mdx +19 -1
- package/docs/content/locales/de-DE/mcp-clients.mdx +22 -1
- package/docs/content/locales/es-ES/mcp-clients.mdx +23 -1
- package/docs/content/locales/fr-FR/mcp-clients.mdx +23 -1
- package/docs/content/locales/hi-IN/mcp-clients.mdx +22 -1
- package/docs/content/locales/ja-JP/mcp-clients.mdx +21 -1
- package/docs/content/locales/ko-KR/mcp-clients.mdx +20 -1
- package/docs/content/locales/pt-BR/mcp-clients.mdx +22 -1
- package/docs/content/locales/zh-CN/mcp-clients.mdx +17 -1
- package/docs/content/locales/zh-TW/mcp-clients.mdx +17 -1
- package/docs/content/mcp-clients.mdx +51 -1
- package/docs/content/organizations-teams-permissions.mdx +413 -0
- package/package.json +1 -1
- package/src/templates/chat/app/hooks/use-navigation-state.ts +4 -1
- package/src/templates/chat/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it-or-sta.md +6 -0
- package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +9 -0
- package/src/templates/workspace-core/.agents/skills/extensions/references/api.md +31 -0
- package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +9 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
|
|
3
|
+
import { putPrivateBlob } from "@agent-native/core/private-blob";
|
|
4
|
+
import {
|
|
5
|
+
getRequestOrgId,
|
|
6
|
+
getRequestUserEmail,
|
|
7
|
+
} from "@agent-native/core/server";
|
|
8
|
+
import { accessFilter } from "@agent-native/core/sharing";
|
|
9
|
+
import type { NativeResourceCaptureAdapter } from "@agent-native/creative-context/server";
|
|
10
|
+
import { and, inArray } from "drizzle-orm";
|
|
11
|
+
|
|
12
|
+
import { getDb, schema } from "../db/index.js";
|
|
13
|
+
import { getDashboard } from "./dashboards-store.js";
|
|
14
|
+
|
|
15
|
+
function syntheticPreview(config: Record<string, unknown>) {
|
|
16
|
+
const panels = Array.isArray(config.panels) ? config.panels : [];
|
|
17
|
+
return panels.slice(0, 24).map((panel: any, index) => ({
|
|
18
|
+
id: typeof panel?.id === "string" ? panel.id : String(index),
|
|
19
|
+
title:
|
|
20
|
+
typeof panel?.title === "string" ? panel.title : `Panel ${index + 1}`,
|
|
21
|
+
visualization:
|
|
22
|
+
typeof panel?.visualization === "string"
|
|
23
|
+
? panel.visualization
|
|
24
|
+
: typeof panel?.type === "string"
|
|
25
|
+
? panel.type
|
|
26
|
+
: "chart",
|
|
27
|
+
data: "synthetic",
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const nativeDashboardCreativeContextAdapter: NativeResourceCaptureAdapter =
|
|
32
|
+
{
|
|
33
|
+
appId: "analytics",
|
|
34
|
+
resourceType: "dashboard",
|
|
35
|
+
async listResourceVersions(resourceIds) {
|
|
36
|
+
if (!resourceIds.length) return [];
|
|
37
|
+
return getDb()
|
|
38
|
+
.select({
|
|
39
|
+
resourceId: schema.dashboards.id,
|
|
40
|
+
sourceModifiedAt: schema.dashboards.updatedAt,
|
|
41
|
+
})
|
|
42
|
+
.from(schema.dashboards)
|
|
43
|
+
.where(
|
|
44
|
+
and(
|
|
45
|
+
inArray(schema.dashboards.id, [...resourceIds]),
|
|
46
|
+
accessFilter(schema.dashboards, schema.dashboardShares),
|
|
47
|
+
),
|
|
48
|
+
);
|
|
49
|
+
},
|
|
50
|
+
async capture(reference) {
|
|
51
|
+
const email = getRequestUserEmail();
|
|
52
|
+
if (!email) throw new Error("no authenticated user");
|
|
53
|
+
const dashboard = await getDashboard(reference.resourceId, {
|
|
54
|
+
email,
|
|
55
|
+
orgId: getRequestOrgId() ?? null,
|
|
56
|
+
});
|
|
57
|
+
if (!dashboard) throw new Error("Dashboard not found");
|
|
58
|
+
if (
|
|
59
|
+
reference.expectedUpdatedAt &&
|
|
60
|
+
reference.expectedUpdatedAt !== dashboard.updatedAt
|
|
61
|
+
)
|
|
62
|
+
throw new Error(
|
|
63
|
+
"Dashboard changed before it could be submitted to Context.",
|
|
64
|
+
);
|
|
65
|
+
const payload = JSON.stringify({
|
|
66
|
+
id: dashboard.id,
|
|
67
|
+
kind: dashboard.kind,
|
|
68
|
+
title: dashboard.title,
|
|
69
|
+
config: dashboard.config,
|
|
70
|
+
updatedAt: dashboard.updatedAt,
|
|
71
|
+
});
|
|
72
|
+
const contentHash = createHash("sha256").update(payload).digest("hex");
|
|
73
|
+
const revisionId = `context-${Date.now()}-${contentHash.slice(0, 12)}`;
|
|
74
|
+
await getDb()
|
|
75
|
+
.insert(schema.dashboardRevisions)
|
|
76
|
+
.values({
|
|
77
|
+
id: revisionId,
|
|
78
|
+
dashboardId: dashboard.id,
|
|
79
|
+
kind: dashboard.kind,
|
|
80
|
+
title: dashboard.title,
|
|
81
|
+
config: JSON.stringify(dashboard.config),
|
|
82
|
+
createdAt: new Date().toISOString(),
|
|
83
|
+
createdBy: email,
|
|
84
|
+
ownerEmail: dashboard.ownerEmail,
|
|
85
|
+
orgId: dashboard.orgId,
|
|
86
|
+
});
|
|
87
|
+
const handle = await putPrivateBlob({
|
|
88
|
+
data: Buffer.from(payload),
|
|
89
|
+
filename: `${dashboard.id}.dashboard.json`,
|
|
90
|
+
mimeType: "application/json",
|
|
91
|
+
ownerEmail: dashboard.ownerEmail,
|
|
92
|
+
key: `creative-context/analytics/${dashboard.id}/${contentHash}.json`,
|
|
93
|
+
metadata: {
|
|
94
|
+
appId: "analytics",
|
|
95
|
+
resourceType: "dashboard",
|
|
96
|
+
resourceId: dashboard.id,
|
|
97
|
+
contentHash,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
if (!handle)
|
|
101
|
+
throw new Error(
|
|
102
|
+
"Private blob storage is required to submit a dashboard to Context.",
|
|
103
|
+
);
|
|
104
|
+
const preview = syntheticPreview(dashboard.config);
|
|
105
|
+
return {
|
|
106
|
+
artifactKey: `analytics:dashboard:${dashboard.id}`,
|
|
107
|
+
source: {
|
|
108
|
+
name: "Analytics",
|
|
109
|
+
kind: "native-app",
|
|
110
|
+
externalRef: dashboard.id,
|
|
111
|
+
access: {
|
|
112
|
+
visibility: dashboard.visibility,
|
|
113
|
+
canManage: dashboard.canManage === true,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
items: [
|
|
117
|
+
{
|
|
118
|
+
externalId: `native:analytics:dashboard:${dashboard.id}`,
|
|
119
|
+
kind: "dashboard",
|
|
120
|
+
title: dashboard.title,
|
|
121
|
+
canonicalUrl: `/adhoc/sql-dashboard/${dashboard.id}`,
|
|
122
|
+
mimeType: "application/json",
|
|
123
|
+
content: preview
|
|
124
|
+
.map((panel) => `${panel.title} (${panel.visualization})`)
|
|
125
|
+
.join("\n"),
|
|
126
|
+
summary: `${preview.length} dashboard panels represented with synthetic preview data only.`,
|
|
127
|
+
contentHash,
|
|
128
|
+
sourceModifiedAt: dashboard.updatedAt,
|
|
129
|
+
sourceVersion: revisionId,
|
|
130
|
+
metadata: {
|
|
131
|
+
preview: {
|
|
132
|
+
type: "dashboard",
|
|
133
|
+
data: "synthetic",
|
|
134
|
+
panels: preview,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
privateMetadata: {
|
|
140
|
+
nativeResource: {
|
|
141
|
+
appId: "analytics",
|
|
142
|
+
resourceType: "dashboard",
|
|
143
|
+
resourceId: dashboard.id,
|
|
144
|
+
expectedUpdatedAt: reference.expectedUpdatedAt,
|
|
145
|
+
},
|
|
146
|
+
clone: {
|
|
147
|
+
handle,
|
|
148
|
+
appId: "analytics",
|
|
149
|
+
resourceType: "dashboard",
|
|
150
|
+
resourceId: dashboard.id,
|
|
151
|
+
contentHash,
|
|
152
|
+
sourceVersion: revisionId,
|
|
153
|
+
updatedAt: dashboard.updatedAt,
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
};
|
|
@@ -704,6 +704,7 @@ export default createAgentChatPlugin({
|
|
|
704
704
|
analyticsSourceGuidanceOpening() +
|
|
705
705
|
"DASHBOARD CREATION RULE — You may create dashboards, analyses, SQL panels, or other resources only when the user explicitly asks you to (e.g. 'build me a dashboard for...', 'create a new analysis', 'add a chart for...'). Never create any resource proactively during research, trend analysis, or answering questions. If you think a dashboard would be useful, suggest it and wait for explicit confirmation before creating anything. Never add new items to the sidebar or modify existing dashboards without an explicit user directive. " +
|
|
706
706
|
"DASHBOARD MUTATION RULE — For dashboard edits, default to `mutate-dashboard` with the typed `dashboard.*` script API so the main payload is a string and avoids native-array serialization traps. It can move panels by id, edit titles/SQL/config, insert, duplicate, remove, and patch dashboard fields in one atomic save. The script API is constrained: no variables/imports/loops/functions, only JSON-compatible arguments on documented dashboard methods. Do not count shifting `/panels/<index>` positions for ordinary dashboard edits unless the user specifically asks for low-level JSON-pointer operations. " +
|
|
707
|
+
'DASHBOARD EXTENSION BOX RULE — Analytics dashboards support extension boxes. Insert `chartType: "extension"` panels with `config.extensionSlotId` set to `analytics.dashboard.<dashboard-id>.panel.<panel-id>`, then call `add-extension-slot-target` and `install-extension` with that same id. The install is per-user; the extension box stays on the shared dashboard and receives dashboard/panel/current-filter context. Use `get-sql-dashboard` panel summaries to inspect an existing box; `config.extensionId` is only the legacy direct-embed format. ' +
|
|
707
708
|
"EXTENSION DATA-REPAIR RULE — When fixing data in an existing extension-backed dashboard or migrated surface such as Risk Meeting, inspect the current dashboard and extension first, then use `update-extension` `patches`/`edits` that change only the data-loading seam. Preserve the existing layout, CSS, copy, and interactions; never reconstruct the full HTML body for a data-only fix. Full-body replacement is blocked unless `allowFullReplacement=true`, which is reserved for an explicit visual rewrite or a complete replacement body supplied by the user. If a focused edit fails, change the target instead of retrying identical arguments. " +
|
|
708
709
|
'FIRST-PARTY DASHBOARD TIME RULE — AI-generated `source: "first-party"` panels are dashboard-time-bound by default: set `config.timeScope` to `dashboard` and include a matching dashboard time predicate. `{{timeRange}}` requires a matching `filters` entry with `id: "timeRange"` and `type: "select"`; `{{<id>Start}}`/`{{<id>End}}` require a matching `type: "date-range"` filter with that id. Allowed `timeScope` values are `dashboard`, `fixed-window`, `cohort-history`, and `all-time`; use `all-time` only when the user requests full available history and put all-time, lifetime, or historical in the title or description. Server validation rejects unbound first-party SQL. ' +
|
|
709
710
|
"DASHBOARD READ RULE — `get-sql-dashboard` is compact by default: use its `panels` summaries plus `layout.panelOrder`, `layout.firstPanelIds`, and `layout.groups[].rows[].rowNumber/panelIds` for orientation and verification. Pass `includeConfig: true` only when you truly need full panel SQL/config. " +
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
registerNativeResourceCaptureAdapter,
|
|
3
|
+
setupCreativeContext,
|
|
4
|
+
} from "@agent-native/creative-context/server";
|
|
5
|
+
|
|
6
|
+
import { nativeDashboardCreativeContextAdapter } from "../lib/native-creative-context.js";
|
|
7
|
+
|
|
8
|
+
registerNativeResourceCaptureAdapter(nativeDashboardCreativeContextAdapter);
|
|
9
|
+
|
|
10
|
+
export default setupCreativeContext({ appId: "analytics" });
|
|
@@ -35,9 +35,11 @@ role cannot silently stand in for another:
|
|
|
35
35
|
|
|
36
36
|
1. Follow the user's explicit instructions and the object currently selected in
|
|
37
37
|
the app.
|
|
38
|
-
2. Read the `creative-context` application-state record. If
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
2. Read the `creative-context` application-state record. If `pinnedPackId` is
|
|
39
|
+
set, replay that immutable pack. Otherwise honor `selectedContextId`; when it
|
|
40
|
+
is unset, let retrieval use Default plus at most one app-bound or
|
|
41
|
+
semantically matching specialty context. `currentPackId` is the receipt from
|
|
42
|
+
the latest materialized generation, not a replacement for context selection.
|
|
41
43
|
3. Call `search-creative-context` with a narrow query for exact facts, visual
|
|
42
44
|
language, audience guidance, prior decisions, or reusable references.
|
|
43
45
|
4. Call `get-context-item` only for the specific search result versions
|
|
@@ -60,6 +62,7 @@ The single state key is `creative-context`:
|
|
|
60
62
|
```json
|
|
61
63
|
{
|
|
62
64
|
"contextMode": "auto",
|
|
65
|
+
"selectedContextId": null,
|
|
63
66
|
"currentPackId": null,
|
|
64
67
|
"pinnedPackId": null
|
|
65
68
|
}
|
|
@@ -84,3 +87,9 @@ pass that asset id through the normal `referenceAssetIds` path. Do not pass a
|
|
|
84
87
|
context-item URL directly to an image provider. Keep the returned
|
|
85
88
|
`contextPackId` and reuse labels in generation-run and output-asset metadata
|
|
86
89
|
alongside the normal reference selection provenance.
|
|
90
|
+
|
|
91
|
+
When the approved asset itself should be reused, call
|
|
92
|
+
`clone-creative-context-asset` with its exact item and version ids instead of
|
|
93
|
+
regenerating it. The typed action copies the approved private object through
|
|
94
|
+
Assets' normal import path; generic context actions never expose its blob
|
|
95
|
+
handle.
|
|
@@ -46,6 +46,11 @@ Detailed library, generation, image, embed, and engine rules live in
|
|
|
46
46
|
Respect `creative-context.contextMode: "off"` without silently restoring a
|
|
47
47
|
pack. This shared Agent-page Library does not replace Assets' existing
|
|
48
48
|
`/library` media workflow.
|
|
49
|
+
- To submit an asset to a governed Creative Context, use the Context tab or
|
|
50
|
+
`manage-context-membership`; it pins immutable media bytes and metadata.
|
|
51
|
+
Reuse only its opaque native clone reference through the Assets action path.
|
|
52
|
+
Use `operation="submit-latest"` with a Library membership id when its native
|
|
53
|
+
update status reports `update-available`.
|
|
49
54
|
|
|
50
55
|
- `navigation` exposes library, asset, generation, picker, embed, and selection
|
|
51
56
|
context. Human Library state uses
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
|
|
3
|
+
import { defineAction } from "@agent-native/core";
|
|
4
|
+
import {
|
|
5
|
+
readPrivateBlob,
|
|
6
|
+
type PrivateBlobHandle,
|
|
7
|
+
} from "@agent-native/core/private-blob";
|
|
8
|
+
import { resolveNativeContextCloneReference } from "@agent-native/creative-context/server";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
|
|
11
|
+
import { createAssetFromBuffer } from "../server/lib/assets.js";
|
|
12
|
+
import { getAssetOrThrow, requireLibrary } from "./_helpers.js";
|
|
13
|
+
|
|
14
|
+
export default defineAction({
|
|
15
|
+
description:
|
|
16
|
+
"Clone immutable governed media bytes into an editable Assets library without exposing the private source payload.",
|
|
17
|
+
schema: z.object({
|
|
18
|
+
contextId: z.string(),
|
|
19
|
+
artifactKey: z.string(),
|
|
20
|
+
resourceId: z.string(),
|
|
21
|
+
expectedUpdatedAt: z.string().optional(),
|
|
22
|
+
libraryId: z.string(),
|
|
23
|
+
title: z.string().optional(),
|
|
24
|
+
}),
|
|
25
|
+
publicAgent: { expose: true, readOnly: false, requiresAuth: true },
|
|
26
|
+
run: async (args) => {
|
|
27
|
+
await requireLibrary(args.libraryId);
|
|
28
|
+
const reference = await resolveNativeContextCloneReference({
|
|
29
|
+
appId: "assets",
|
|
30
|
+
resourceType: "asset",
|
|
31
|
+
resourceId: args.resourceId,
|
|
32
|
+
expectedUpdatedAt: args.expectedUpdatedAt,
|
|
33
|
+
contextId: args.contextId,
|
|
34
|
+
artifactKey: args.artifactKey,
|
|
35
|
+
});
|
|
36
|
+
const raw = await readPrivateBlob(
|
|
37
|
+
reference.cloneHandle as PrivateBlobHandle,
|
|
38
|
+
);
|
|
39
|
+
const bytes = Buffer.from(raw.data);
|
|
40
|
+
const hash = createHash("sha256").update(bytes).digest("hex");
|
|
41
|
+
if (
|
|
42
|
+
raw.metadata?.appId !== "assets" ||
|
|
43
|
+
raw.metadata?.resourceType !== "asset" ||
|
|
44
|
+
raw.metadata?.resourceId !== args.resourceId ||
|
|
45
|
+
raw.metadata?.contentHash !== hash
|
|
46
|
+
)
|
|
47
|
+
throw new Error(
|
|
48
|
+
"Governed asset clone payload failed integrity verification.",
|
|
49
|
+
);
|
|
50
|
+
const created = await createAssetFromBuffer({
|
|
51
|
+
libraryId: args.libraryId,
|
|
52
|
+
buffer: bytes,
|
|
53
|
+
mimeType: raw.mimeType ?? "application/octet-stream",
|
|
54
|
+
role: "style_reference",
|
|
55
|
+
status: "reference",
|
|
56
|
+
title: args.title?.trim() || "Context asset",
|
|
57
|
+
metadata: {
|
|
58
|
+
creativeContext: {
|
|
59
|
+
itemVersionId: reference.publishedItemVersionId,
|
|
60
|
+
sourceAssetId: args.resourceId,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
const persisted = await getAssetOrThrow(created.id);
|
|
65
|
+
if (persisted.id !== created.id || persisted.libraryId !== args.libraryId)
|
|
66
|
+
throw new Error("Asset clone did not persist.");
|
|
67
|
+
return {
|
|
68
|
+
id: persisted.id,
|
|
69
|
+
libraryId: persisted.libraryId,
|
|
70
|
+
title: persisted.title,
|
|
71
|
+
clonedExactVersion: reference.publishedItemVersionId,
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
});
|
|
@@ -15,7 +15,8 @@ function optionalParam(params: URLSearchParams, key: string) {
|
|
|
15
15
|
|
|
16
16
|
function optionalLibraryTab(params: URLSearchParams) {
|
|
17
17
|
const tab = params.get("tab");
|
|
18
|
-
return tab === "
|
|
18
|
+
return tab === "drafts" ||
|
|
19
|
+
tab === "references" ||
|
|
19
20
|
tab === "generated" ||
|
|
20
21
|
tab === "runs" ||
|
|
21
22
|
tab === "settings"
|