@agent-native/core 0.106.2 → 0.107.0
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 +19 -0
- package/corpus/core/docs/content/external-agents.mdx +8 -0
- package/corpus/core/docs/content/integrations.mdx +597 -0
- package/corpus/core/docs/content/locales/ar-SA/external-agents.mdx +7 -0
- package/corpus/core/docs/content/locales/ar-SA/mcp-clients.mdx +19 -1
- package/corpus/core/docs/content/locales/ar-SA/mcp-protocol.mdx +7 -0
- package/corpus/core/docs/content/locales/de-DE/external-agents.mdx +9 -0
- package/corpus/core/docs/content/locales/de-DE/mcp-clients.mdx +22 -1
- package/corpus/core/docs/content/locales/de-DE/mcp-protocol.mdx +9 -0
- package/corpus/core/docs/content/locales/es-ES/external-agents.mdx +9 -0
- package/corpus/core/docs/content/locales/es-ES/mcp-clients.mdx +23 -1
- package/corpus/core/docs/content/locales/es-ES/mcp-protocol.mdx +9 -0
- package/corpus/core/docs/content/locales/fr-FR/external-agents.mdx +9 -0
- package/corpus/core/docs/content/locales/fr-FR/mcp-clients.mdx +23 -1
- package/corpus/core/docs/content/locales/fr-FR/mcp-protocol.mdx +9 -0
- package/corpus/core/docs/content/locales/hi-IN/external-agents.mdx +8 -0
- package/corpus/core/docs/content/locales/hi-IN/mcp-clients.mdx +22 -1
- package/corpus/core/docs/content/locales/hi-IN/mcp-protocol.mdx +8 -0
- package/corpus/core/docs/content/locales/ja-JP/external-agents.mdx +8 -0
- package/corpus/core/docs/content/locales/ja-JP/mcp-clients.mdx +21 -1
- package/corpus/core/docs/content/locales/ja-JP/mcp-protocol.mdx +8 -0
- package/corpus/core/docs/content/locales/ko-KR/external-agents.mdx +8 -0
- package/corpus/core/docs/content/locales/ko-KR/mcp-clients.mdx +20 -1
- package/corpus/core/docs/content/locales/ko-KR/mcp-protocol.mdx +8 -0
- package/corpus/core/docs/content/locales/pt-BR/external-agents.mdx +9 -0
- package/corpus/core/docs/content/locales/pt-BR/mcp-clients.mdx +22 -1
- package/corpus/core/docs/content/locales/pt-BR/mcp-protocol.mdx +9 -0
- package/corpus/core/docs/content/locales/zh-CN/external-agents.mdx +6 -0
- package/corpus/core/docs/content/locales/zh-CN/mcp-clients.mdx +17 -1
- package/corpus/core/docs/content/locales/zh-CN/mcp-protocol.mdx +6 -0
- package/corpus/core/docs/content/locales/zh-TW/external-agents.mdx +6 -0
- package/corpus/core/docs/content/locales/zh-TW/mcp-clients.mdx +17 -1
- package/corpus/core/docs/content/locales/zh-TW/mcp-protocol.mdx +6 -0
- package/corpus/core/docs/content/mcp-clients.mdx +51 -1
- package/corpus/core/docs/content/mcp-protocol.mdx +8 -0
- package/corpus/core/docs/content/organizations-teams-permissions.mdx +413 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/client/AssistantChat.tsx +13 -1
- 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 +240 -0
- package/corpus/core/src/client/resources/McpIntegrationDialog.tsx +159 -40
- package/corpus/core/src/client/resources/mcp-integration-catalog.ts +433 -4
- package/corpus/core/src/client/resources/mcp-integration-logos.ts +108 -0
- 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 +126 -1
- package/corpus/core/src/mcp/actions/call-mcp-tool.ts +1 -0
- package/corpus/core/src/mcp/builtin-tools.ts +115 -10
- 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/templates/analytics/.agents/skills/creative-context/SKILL.md +64 -0
- package/corpus/templates/analytics/AGENTS.md +5 -0
- package/corpus/templates/analytics/actions/clone-creative-context-dashboard.ts +86 -0
- package/corpus/templates/analytics/app/components/layout/Layout.tsx +2 -0
- 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/index.tsx +59 -0
- package/corpus/templates/analytics/app/routes/agent.tsx +7 -1
- 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/native-creative-context.ts +158 -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-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/calendar/actions/provider-api-request.ts +1 -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/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/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/clone-creative-context-document.ts +61 -0
- 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/sidebar/DocumentTreeItem.tsx +29 -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-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/mail/actions/provider-api-request.ts +1 -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/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-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/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +8 -2
- package/dist/client/AssistantChat.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 +115 -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 +48 -20
- package/dist/client/resources/McpIntegrationDialog.js.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.d.ts +9 -0
- package/dist/client/resources/mcp-integration-catalog.d.ts.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.js +387 -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/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 +98 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +99 -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/mcp/builtin-tools.d.ts.map +1 -1
- package/dist/mcp/builtin-tools.js +87 -6
- package/dist/mcp/builtin-tools.js.map +1 -1
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- 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/server/transcribe-voice.d.ts +1 -1
- 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/docs/content/external-agents.mdx +8 -0
- package/docs/content/integrations.mdx +597 -0
- package/docs/content/locales/ar-SA/external-agents.mdx +7 -0
- package/docs/content/locales/ar-SA/mcp-clients.mdx +19 -1
- package/docs/content/locales/ar-SA/mcp-protocol.mdx +7 -0
- package/docs/content/locales/de-DE/external-agents.mdx +9 -0
- package/docs/content/locales/de-DE/mcp-clients.mdx +22 -1
- package/docs/content/locales/de-DE/mcp-protocol.mdx +9 -0
- package/docs/content/locales/es-ES/external-agents.mdx +9 -0
- package/docs/content/locales/es-ES/mcp-clients.mdx +23 -1
- package/docs/content/locales/es-ES/mcp-protocol.mdx +9 -0
- package/docs/content/locales/fr-FR/external-agents.mdx +9 -0
- package/docs/content/locales/fr-FR/mcp-clients.mdx +23 -1
- package/docs/content/locales/fr-FR/mcp-protocol.mdx +9 -0
- package/docs/content/locales/hi-IN/external-agents.mdx +8 -0
- package/docs/content/locales/hi-IN/mcp-clients.mdx +22 -1
- package/docs/content/locales/hi-IN/mcp-protocol.mdx +8 -0
- package/docs/content/locales/ja-JP/external-agents.mdx +8 -0
- package/docs/content/locales/ja-JP/mcp-clients.mdx +21 -1
- package/docs/content/locales/ja-JP/mcp-protocol.mdx +8 -0
- package/docs/content/locales/ko-KR/external-agents.mdx +8 -0
- package/docs/content/locales/ko-KR/mcp-clients.mdx +20 -1
- package/docs/content/locales/ko-KR/mcp-protocol.mdx +8 -0
- package/docs/content/locales/pt-BR/external-agents.mdx +9 -0
- package/docs/content/locales/pt-BR/mcp-clients.mdx +22 -1
- package/docs/content/locales/pt-BR/mcp-protocol.mdx +9 -0
- package/docs/content/locales/zh-CN/external-agents.mdx +6 -0
- package/docs/content/locales/zh-CN/mcp-clients.mdx +17 -1
- package/docs/content/locales/zh-CN/mcp-protocol.mdx +6 -0
- package/docs/content/locales/zh-TW/external-agents.mdx +6 -0
- package/docs/content/locales/zh-TW/mcp-clients.mdx +17 -1
- package/docs/content/locales/zh-TW/mcp-protocol.mdx +6 -0
- package/docs/content/mcp-clients.mdx +51 -1
- package/docs/content/mcp-protocol.mdx +8 -0
- package/docs/content/organizations-teams-permissions.mdx +413 -0
- package/package.json +1 -1
- 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
|
+
};
|
|
@@ -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"
|