@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,191 @@
|
|
|
1
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
+
|
|
3
|
+
import { putPrivateBlob } from "@agent-native/core/private-blob";
|
|
4
|
+
import { accessFilter, resolveAccess } from "@agent-native/core/sharing";
|
|
5
|
+
import type { NativeResourceCaptureAdapter } from "@agent-native/creative-context/server";
|
|
6
|
+
import { and, inArray } from "drizzle-orm";
|
|
7
|
+
|
|
8
|
+
import { flushOpenDocumentEditorToSql } from "../../actions/_document-flush.js";
|
|
9
|
+
import { getDb, schema } from "../db/index.js";
|
|
10
|
+
|
|
11
|
+
interface DocumentPreviewBlock {
|
|
12
|
+
kind: "heading" | "paragraph" | "bullet" | "quote" | "code";
|
|
13
|
+
text: string;
|
|
14
|
+
level?: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function documentPreview(markdown: string) {
|
|
18
|
+
const lines = markdown.replace(/\r\n/g, "\n").split("\n");
|
|
19
|
+
const headings = lines
|
|
20
|
+
.filter((line) => /^#{1,6}\s+/.test(line))
|
|
21
|
+
.map((line) =>
|
|
22
|
+
line
|
|
23
|
+
.replace(/^#{1,6}\s+/, "")
|
|
24
|
+
.trim()
|
|
25
|
+
.slice(0, 160),
|
|
26
|
+
)
|
|
27
|
+
.filter(Boolean)
|
|
28
|
+
.slice(0, 8);
|
|
29
|
+
const excerpt = lines
|
|
30
|
+
.filter((line) => !/^\s*(?:```|#{1,6}\s+)/.test(line))
|
|
31
|
+
.join(" ")
|
|
32
|
+
.replace(/\s+/g, " ")
|
|
33
|
+
.trim()
|
|
34
|
+
.slice(0, 1_500);
|
|
35
|
+
let inCode = false;
|
|
36
|
+
const blocks = lines
|
|
37
|
+
.slice(0, 240)
|
|
38
|
+
.flatMap<DocumentPreviewBlock>((rawLine) => {
|
|
39
|
+
const line = rawLine.trim();
|
|
40
|
+
if (/^```/.test(line)) {
|
|
41
|
+
inCode = !inCode;
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
if (!line) return [];
|
|
45
|
+
if (inCode) {
|
|
46
|
+
return [{ kind: "code" as const, text: rawLine.slice(0, 600) }];
|
|
47
|
+
}
|
|
48
|
+
const heading = /^(#{1,6})\s+(.+)$/.exec(line);
|
|
49
|
+
if (heading) {
|
|
50
|
+
return [
|
|
51
|
+
{
|
|
52
|
+
kind: "heading" as const,
|
|
53
|
+
text: (heading[2] ?? "").slice(0, 300),
|
|
54
|
+
level: heading[1]?.length ?? 1,
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
const bullet = /^(?:[-*+] |\d+[.)] )(.+)$/.exec(line);
|
|
59
|
+
if (bullet) {
|
|
60
|
+
return [
|
|
61
|
+
{ kind: "bullet" as const, text: (bullet[1] ?? "").slice(0, 600) },
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
if (line.startsWith(">")) {
|
|
65
|
+
return [
|
|
66
|
+
{ kind: "quote" as const, text: line.slice(1).trim().slice(0, 600) },
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
return [{ kind: "paragraph" as const, text: line.slice(0, 600) }];
|
|
70
|
+
});
|
|
71
|
+
return {
|
|
72
|
+
type: "document" as const,
|
|
73
|
+
headings,
|
|
74
|
+
excerpt,
|
|
75
|
+
blocks: blocks.slice(0, 40),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const nativeDocumentCreativeContextAdapter: NativeResourceCaptureAdapter =
|
|
80
|
+
{
|
|
81
|
+
appId: "content",
|
|
82
|
+
resourceType: "document",
|
|
83
|
+
async listResourceVersions(resourceIds) {
|
|
84
|
+
if (!resourceIds.length) return [];
|
|
85
|
+
return getDb()
|
|
86
|
+
.select({
|
|
87
|
+
resourceId: schema.documents.id,
|
|
88
|
+
sourceModifiedAt: schema.documents.updatedAt,
|
|
89
|
+
})
|
|
90
|
+
.from(schema.documents)
|
|
91
|
+
.where(
|
|
92
|
+
and(
|
|
93
|
+
inArray(schema.documents.id, [...resourceIds]),
|
|
94
|
+
accessFilter(schema.documents, schema.documentShares),
|
|
95
|
+
),
|
|
96
|
+
);
|
|
97
|
+
},
|
|
98
|
+
async capture(reference) {
|
|
99
|
+
const access = await resolveAccess("document", reference.resourceId);
|
|
100
|
+
if (!access) throw new Error("Document not found");
|
|
101
|
+
const initial = access.resource as typeof schema.documents.$inferSelect;
|
|
102
|
+
if (
|
|
103
|
+
reference.expectedUpdatedAt &&
|
|
104
|
+
reference.expectedUpdatedAt !== initial.updatedAt
|
|
105
|
+
)
|
|
106
|
+
throw new Error(
|
|
107
|
+
"Document changed before it could be submitted to Context.",
|
|
108
|
+
);
|
|
109
|
+
await flushOpenDocumentEditorToSql({
|
|
110
|
+
documentId: initial.id,
|
|
111
|
+
ownerEmail: initial.ownerEmail ?? null,
|
|
112
|
+
});
|
|
113
|
+
const refreshed = await resolveAccess("document", initial.id);
|
|
114
|
+
if (!refreshed) throw new Error("Document not found");
|
|
115
|
+
const document =
|
|
116
|
+
refreshed.resource as typeof schema.documents.$inferSelect;
|
|
117
|
+
const contentHash = createHash("sha256")
|
|
118
|
+
.update(document.content)
|
|
119
|
+
.digest("hex");
|
|
120
|
+
const versionId = randomUUID();
|
|
121
|
+
await getDb().insert(schema.documentVersions).values({
|
|
122
|
+
id: versionId,
|
|
123
|
+
ownerEmail: document.ownerEmail,
|
|
124
|
+
documentId: document.id,
|
|
125
|
+
title: document.title,
|
|
126
|
+
content: document.content,
|
|
127
|
+
createdAt: new Date().toISOString(),
|
|
128
|
+
});
|
|
129
|
+
const handle = await putPrivateBlob({
|
|
130
|
+
data: Buffer.from(document.content),
|
|
131
|
+
filename: `${document.id}.md`,
|
|
132
|
+
mimeType: "text/markdown",
|
|
133
|
+
ownerEmail: document.ownerEmail,
|
|
134
|
+
key: `creative-context/content/${document.id}/${contentHash}.md`,
|
|
135
|
+
metadata: {
|
|
136
|
+
appId: "content",
|
|
137
|
+
resourceType: "document",
|
|
138
|
+
resourceId: document.id,
|
|
139
|
+
contentHash,
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
if (!handle)
|
|
143
|
+
throw new Error(
|
|
144
|
+
"Private blob storage is required to submit a document to Context.",
|
|
145
|
+
);
|
|
146
|
+
return {
|
|
147
|
+
artifactKey: `content:document:${document.id}`,
|
|
148
|
+
source: {
|
|
149
|
+
name: "Content",
|
|
150
|
+
kind: "native-app",
|
|
151
|
+
externalRef: document.id,
|
|
152
|
+
access: {
|
|
153
|
+
visibility: document.visibility ?? "private",
|
|
154
|
+
canManage: refreshed.role === "owner" || refreshed.role === "admin",
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
items: [
|
|
158
|
+
{
|
|
159
|
+
externalId: `native:content:document:${document.id}`,
|
|
160
|
+
kind: "document",
|
|
161
|
+
title: document.title,
|
|
162
|
+
canonicalUrl: `/page/${document.id}`,
|
|
163
|
+
mimeType: "text/markdown",
|
|
164
|
+
content: document.content.slice(0, 40_000),
|
|
165
|
+
summary: document.description ?? "Immutable Markdown document.",
|
|
166
|
+
contentHash,
|
|
167
|
+
sourceModifiedAt: document.updatedAt,
|
|
168
|
+
sourceVersion: versionId,
|
|
169
|
+
metadata: { preview: documentPreview(document.content) },
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
privateMetadata: {
|
|
173
|
+
nativeResource: {
|
|
174
|
+
appId: "content",
|
|
175
|
+
resourceType: "document",
|
|
176
|
+
resourceId: document.id,
|
|
177
|
+
expectedUpdatedAt: reference.expectedUpdatedAt,
|
|
178
|
+
},
|
|
179
|
+
clone: {
|
|
180
|
+
handle,
|
|
181
|
+
appId: "content",
|
|
182
|
+
resourceType: "document",
|
|
183
|
+
resourceId: document.id,
|
|
184
|
+
contentHash,
|
|
185
|
+
sourceVersion: versionId,
|
|
186
|
+
updatedAt: document.updatedAt,
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
},
|
|
191
|
+
};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { registerOnboardingStep } from "@agent-native/core/onboarding";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
registerNativeResourceCaptureAdapter,
|
|
4
|
+
setupCreativeContext,
|
|
5
|
+
} from "@agent-native/creative-context/server";
|
|
3
6
|
import { listContextSources } from "@agent-native/creative-context/store";
|
|
4
7
|
|
|
8
|
+
import { nativeDocumentCreativeContextAdapter } from "../lib/native-creative-context.js";
|
|
9
|
+
|
|
5
10
|
registerOnboardingStep({
|
|
6
11
|
id: "creative-context-library",
|
|
7
12
|
order: 18,
|
|
@@ -28,4 +33,6 @@ registerOnboardingStep({
|
|
|
28
33
|
},
|
|
29
34
|
});
|
|
30
35
|
|
|
36
|
+
registerNativeResourceCaptureAdapter(nativeDocumentCreativeContextAdapter);
|
|
37
|
+
|
|
31
38
|
export default setupCreativeContext({ appId: "content" });
|
|
@@ -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
|
}
|
|
@@ -114,3 +117,8 @@ If `nativeCode.content` is `null` and `oversized` is true, use the named
|
|
|
114
117
|
`get-context-item`, but the inline content is only the validated manifest shell.
|
|
115
118
|
Never concatenate a truncated fragment or use delimited `version.content` as
|
|
116
119
|
HTML.
|
|
120
|
+
|
|
121
|
+
For an app-created Design snapshot, use
|
|
122
|
+
`clone-creative-context-design-native` instead. That typed action resolves the
|
|
123
|
+
exact approved private file/Yjs payload and duplicates it through Design's
|
|
124
|
+
native path. Generic context actions must never receive or return that payload.
|
|
@@ -178,6 +178,11 @@ patterns live in `.agents/skills/`.
|
|
|
178
178
|
`.agents/skills/creative-context/SKILL.md`: explicit request and current
|
|
179
179
|
design first, then a pinned/current pack, then narrow library search. Respect
|
|
180
180
|
`creative-context.contextMode: "off"` without silently restoring a pack.
|
|
181
|
+
- To submit a design to a governed Creative Context, use the Context tab or
|
|
182
|
+
`manage-context-membership`; it captures one immutable live design snapshot.
|
|
183
|
+
Reuse only a returned opaque native clone reference through the Design clone action.
|
|
184
|
+
Use `operation="submit-latest"` with a Library membership id when its native
|
|
185
|
+
update status reports `update-available`.
|
|
181
186
|
- For reusable design-system setup from Figma, connected code/GitHub, local
|
|
182
187
|
code/design files, or optional `design.md`, use Builder-backed DSI indexing
|
|
183
188
|
through `index-design-system-with-builder` or the Design System Setup `.fig`
|
|
@@ -0,0 +1,111 @@
|
|
|
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 { mutateDesignData } from "../server/lib/design-data-mutation.js";
|
|
12
|
+
import { saveImportedDesignFiles } from "../server/lib/import-design-files.js";
|
|
13
|
+
import createDesign from "./create-design.js";
|
|
14
|
+
|
|
15
|
+
const payloadSchema = z.object({
|
|
16
|
+
designId: z.string(),
|
|
17
|
+
designData: z.string(),
|
|
18
|
+
files: z.array(
|
|
19
|
+
z.object({
|
|
20
|
+
filename: z.string(),
|
|
21
|
+
fileType: z.enum(["html", "css", "jsx", "asset"]),
|
|
22
|
+
content: z.string(),
|
|
23
|
+
}),
|
|
24
|
+
),
|
|
25
|
+
tweaks: z.unknown().optional(),
|
|
26
|
+
appliedTweaks: z.unknown().optional(),
|
|
27
|
+
resolvedCssVars: z.unknown().optional(),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export default defineAction({
|
|
31
|
+
description:
|
|
32
|
+
"Clone an exact governed Design snapshot into a new editable Design project without exposing the source payload.",
|
|
33
|
+
schema: z.object({
|
|
34
|
+
contextId: z.string(),
|
|
35
|
+
artifactKey: z.string(),
|
|
36
|
+
resourceId: z.string(),
|
|
37
|
+
expectedUpdatedAt: z.string().optional(),
|
|
38
|
+
title: z.string().optional(),
|
|
39
|
+
}),
|
|
40
|
+
publicAgent: { expose: true, readOnly: false, requiresAuth: true },
|
|
41
|
+
run: async (args) => {
|
|
42
|
+
const reference = await resolveNativeContextCloneReference({
|
|
43
|
+
appId: "design",
|
|
44
|
+
resourceType: "design",
|
|
45
|
+
resourceId: args.resourceId,
|
|
46
|
+
expectedUpdatedAt: args.expectedUpdatedAt,
|
|
47
|
+
contextId: args.contextId,
|
|
48
|
+
artifactKey: args.artifactKey,
|
|
49
|
+
});
|
|
50
|
+
const raw = await readPrivateBlob(
|
|
51
|
+
reference.cloneHandle as PrivateBlobHandle,
|
|
52
|
+
);
|
|
53
|
+
const body = Buffer.from(raw.data).toString("utf8");
|
|
54
|
+
const hash = createHash("sha256").update(body).digest("hex");
|
|
55
|
+
if (
|
|
56
|
+
raw.metadata?.appId !== "design" ||
|
|
57
|
+
raw.metadata?.resourceType !== "design" ||
|
|
58
|
+
raw.metadata?.resourceId !== args.resourceId ||
|
|
59
|
+
raw.metadata?.contentHash !== hash
|
|
60
|
+
)
|
|
61
|
+
throw new Error(
|
|
62
|
+
"Governed design clone payload failed integrity verification.",
|
|
63
|
+
);
|
|
64
|
+
const payload = payloadSchema.parse(JSON.parse(body));
|
|
65
|
+
const created = await createDesign.run({
|
|
66
|
+
title: args.title?.trim() || "Context design",
|
|
67
|
+
projectType: "prototype",
|
|
68
|
+
});
|
|
69
|
+
const saved = await saveImportedDesignFiles({
|
|
70
|
+
designId: created.id,
|
|
71
|
+
sourceType: "creative-context-native-clone",
|
|
72
|
+
preserveExactContent: true,
|
|
73
|
+
files: payload.files.map((file) => ({
|
|
74
|
+
...file,
|
|
75
|
+
source: {
|
|
76
|
+
creativeContextItemVersionId: reference.publishedItemVersionId,
|
|
77
|
+
},
|
|
78
|
+
})),
|
|
79
|
+
});
|
|
80
|
+
if (saved.files.length !== payload.files.length)
|
|
81
|
+
throw new Error("Design clone did not persist every saved file.");
|
|
82
|
+
const capturedData = z
|
|
83
|
+
.record(z.string(), z.unknown())
|
|
84
|
+
.parse(JSON.parse(payload.designData));
|
|
85
|
+
const {
|
|
86
|
+
canvasFrames: _capturedFrames,
|
|
87
|
+
screenMetadata: _capturedMetadata,
|
|
88
|
+
...capturedState
|
|
89
|
+
} = capturedData;
|
|
90
|
+
await mutateDesignData({
|
|
91
|
+
designId: created.id,
|
|
92
|
+
mutate: (current) => ({
|
|
93
|
+
...capturedState,
|
|
94
|
+
canvasFrames: current.canvasFrames,
|
|
95
|
+
screenMetadata: current.screenMetadata,
|
|
96
|
+
}),
|
|
97
|
+
isApplied: (persisted) =>
|
|
98
|
+
Object.entries(capturedState).every(
|
|
99
|
+
([key, value]) =>
|
|
100
|
+
JSON.stringify(persisted[key]) === JSON.stringify(value),
|
|
101
|
+
),
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
designId: saved.designId,
|
|
105
|
+
title: created.title,
|
|
106
|
+
fileCount: saved.files.length,
|
|
107
|
+
urlPath: saved.urlPath,
|
|
108
|
+
clonedExactVersion: reference.publishedItemVersionId,
|
|
109
|
+
};
|
|
110
|
+
},
|
|
111
|
+
});
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
injectSessionReplayIframeBootstrap,
|
|
9
9
|
SESSION_REPLAY_IFRAME_ATTRIBUTE,
|
|
10
10
|
} from "@agent-native/core/client";
|
|
11
|
+
import { CreativeContextShareSheet } from "@agent-native/creative-context/client";
|
|
11
12
|
import {
|
|
12
13
|
useSetHeaderActions,
|
|
13
14
|
useSetPageTitle,
|
|
@@ -109,6 +110,7 @@ export default function Index() {
|
|
|
109
110
|
);
|
|
110
111
|
const [renameId, setRenameId] = useState<string | null>(null);
|
|
111
112
|
const [renameDraft, setRenameDraft] = useState("");
|
|
113
|
+
const [contextDesigns, setContextDesigns] = useState<Design[]>([]);
|
|
112
114
|
|
|
113
115
|
const anchorElRef = useRef<HTMLElement | null>(null);
|
|
114
116
|
const anchorRef = useRef<HTMLElement | null>(null);
|
|
@@ -809,6 +811,21 @@ export default function Index() {
|
|
|
809
811
|
</TooltipTrigger>
|
|
810
812
|
<TooltipContent>{t("home.clearSelection")}</TooltipContent>
|
|
811
813
|
</Tooltip>
|
|
814
|
+
<Button
|
|
815
|
+
variant="outline"
|
|
816
|
+
size="sm"
|
|
817
|
+
onClick={() =>
|
|
818
|
+
setContextDesigns(
|
|
819
|
+
designs.filter((design) =>
|
|
820
|
+
selectedDesignIds.has(design.id),
|
|
821
|
+
),
|
|
822
|
+
)
|
|
823
|
+
}
|
|
824
|
+
className="cursor-pointer"
|
|
825
|
+
>
|
|
826
|
+
<IconPlus className="w-3.5 h-3.5" />
|
|
827
|
+
{t("creativeContext.addToContext" /* i18n-key-ignore */)}
|
|
828
|
+
</Button>
|
|
812
829
|
<Button
|
|
813
830
|
variant="destructive"
|
|
814
831
|
size="sm"
|
|
@@ -936,6 +953,18 @@ export default function Index() {
|
|
|
936
953
|
<IconCopy className="w-3.5 h-3.5 me-2" />
|
|
937
954
|
{t("home.duplicate")}
|
|
938
955
|
</DropdownMenuItem>
|
|
956
|
+
<DropdownMenuItem
|
|
957
|
+
onSelect={(event) => {
|
|
958
|
+
event.preventDefault();
|
|
959
|
+
setContextDesigns([design]);
|
|
960
|
+
}}
|
|
961
|
+
className="cursor-pointer"
|
|
962
|
+
>
|
|
963
|
+
<IconPlus className="w-3.5 h-3.5 me-2" />
|
|
964
|
+
{t(
|
|
965
|
+
"creativeContext.addToContext" /* i18n-key-ignore */,
|
|
966
|
+
)}
|
|
967
|
+
</DropdownMenuItem>
|
|
939
968
|
<DropdownMenuItem
|
|
940
969
|
onClick={() => setDeleteId(design.id)}
|
|
941
970
|
className="text-red-400 focus:text-red-400 cursor-pointer"
|
|
@@ -954,6 +983,21 @@ export default function Index() {
|
|
|
954
983
|
)}
|
|
955
984
|
</main>
|
|
956
985
|
|
|
986
|
+
<CreativeContextShareSheet
|
|
987
|
+
open={contextDesigns.length > 0}
|
|
988
|
+
onOpenChange={(open) => {
|
|
989
|
+
if (!open) setContextDesigns([]);
|
|
990
|
+
}}
|
|
991
|
+
resources={contextDesigns.map((design) => ({
|
|
992
|
+
appId: "design",
|
|
993
|
+
resourceType: "design",
|
|
994
|
+
resourceId: design.id,
|
|
995
|
+
title: design.title,
|
|
996
|
+
updatedAt: design.updatedAt ?? design.createdAt,
|
|
997
|
+
preview: { kind: "document", label: "Design" },
|
|
998
|
+
}))}
|
|
999
|
+
/>
|
|
1000
|
+
|
|
957
1001
|
<PromptPopover
|
|
958
1002
|
open={showNewPrompt}
|
|
959
1003
|
onOpenChange={handleNewPromptOpenChange}
|