@agent-native/core 0.106.3 → 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 +13 -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/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/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/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +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 +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/notifications/routes.d.ts +1 -1
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/resources/handlers.d.ts +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/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/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/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
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
type CollabUser,
|
|
12
12
|
} from "@agent-native/core/client";
|
|
13
13
|
import { RunsTray } from "@agent-native/core/client/progress";
|
|
14
|
+
import { CreativeContextShareTab } from "@agent-native/creative-context/client";
|
|
14
15
|
import {
|
|
15
16
|
IconArrowLeft,
|
|
16
17
|
IconPlayerPlay,
|
|
@@ -955,6 +956,26 @@ graph TD
|
|
|
955
956
|
secondaryShareUrlDescription={t(
|
|
956
957
|
"editorToolbar.presentationLinkDescription",
|
|
957
958
|
)}
|
|
959
|
+
shareTabs={{
|
|
960
|
+
tabs: [
|
|
961
|
+
{
|
|
962
|
+
value: "context",
|
|
963
|
+
label: "Context",
|
|
964
|
+
content: (
|
|
965
|
+
<CreativeContextShareTab
|
|
966
|
+
resource={{
|
|
967
|
+
appId: "slides",
|
|
968
|
+
resourceType: "deck",
|
|
969
|
+
resourceId: deckId,
|
|
970
|
+
title: deckTitle,
|
|
971
|
+
updatedAt: deck.updatedAt,
|
|
972
|
+
preview: { kind: "document", label: "Deck" },
|
|
973
|
+
}}
|
|
974
|
+
/>
|
|
975
|
+
),
|
|
976
|
+
},
|
|
977
|
+
],
|
|
978
|
+
}}
|
|
958
979
|
/>
|
|
959
980
|
</div>
|
|
960
981
|
{/* Present button — matches Share trigger height (h-9) */}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
|
|
3
|
+
import { putPrivateBlob } from "@agent-native/core/private-blob";
|
|
4
|
+
import { accessFilter, resolveAccess } from "@agent-native/core/sharing";
|
|
5
|
+
import {
|
|
6
|
+
renderSafeNativeHtmlPreviews,
|
|
7
|
+
serializePrivateBlobHandle,
|
|
8
|
+
type NativeResourceCaptureAdapter,
|
|
9
|
+
} from "@agent-native/creative-context/server";
|
|
10
|
+
import { and, inArray } from "drizzle-orm";
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
getAspectRatioDims,
|
|
14
|
+
type AspectRatio,
|
|
15
|
+
} from "../../shared/aspect-ratios.js";
|
|
16
|
+
import { getDb, schema } from "../db/index.js";
|
|
17
|
+
import { createDeckVersionSnapshot } from "./deck-versions.js";
|
|
18
|
+
|
|
19
|
+
function hash(value: string | Uint8Array) {
|
|
20
|
+
return createHash("sha256").update(value).digest("hex");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function text(value: string) {
|
|
24
|
+
return value
|
|
25
|
+
.replace(/<[^>]+>/g, " ")
|
|
26
|
+
.replace(/\s+/g, " ")
|
|
27
|
+
.trim();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function previewText(value: string | undefined, limit = 280) {
|
|
31
|
+
return text(value ?? "").slice(0, limit);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function slidePreviewDocument(content: string, width: number, height: number) {
|
|
35
|
+
return `<!doctype html><html><head><style>
|
|
36
|
+
*,*::before,*::after{box-sizing:border-box}html,body{width:${width}px;height:${height}px;margin:0;overflow:hidden;background:#fff}.context-slide{position:relative;width:${width}px;height:${height}px;overflow:hidden}.context-slide>*{width:100%;height:100%}.fmd-slide{width:100%;height:100%}
|
|
37
|
+
</style></head><body><div class="context-slide">${content}</div></body></html>`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function captureSlidePreviewMedia(input: {
|
|
41
|
+
deckId: string;
|
|
42
|
+
ownerEmail: string;
|
|
43
|
+
slides: Array<{ id: string; content: string; title: string }>;
|
|
44
|
+
aspectRatio?: AspectRatio;
|
|
45
|
+
}) {
|
|
46
|
+
const dimensions = getAspectRatioDims(input.aspectRatio);
|
|
47
|
+
const rendered = await renderSafeNativeHtmlPreviews(
|
|
48
|
+
input.slides.map((slide) => ({
|
|
49
|
+
id: slide.id,
|
|
50
|
+
html: slidePreviewDocument(
|
|
51
|
+
slide.content,
|
|
52
|
+
dimensions.width,
|
|
53
|
+
dimensions.height,
|
|
54
|
+
),
|
|
55
|
+
width: dimensions.width,
|
|
56
|
+
height: dimensions.height,
|
|
57
|
+
})),
|
|
58
|
+
);
|
|
59
|
+
const media = new Map<
|
|
60
|
+
string,
|
|
61
|
+
{
|
|
62
|
+
kind: "image";
|
|
63
|
+
mimeType: "image/png";
|
|
64
|
+
accessMode: "private";
|
|
65
|
+
storageKey: string;
|
|
66
|
+
altText: string;
|
|
67
|
+
contentHash: string;
|
|
68
|
+
width: number;
|
|
69
|
+
height: number;
|
|
70
|
+
metadata: { role: "slide-preview"; slideId: string };
|
|
71
|
+
}
|
|
72
|
+
>();
|
|
73
|
+
await Promise.all(
|
|
74
|
+
rendered.map(async (preview) => {
|
|
75
|
+
const contentHash = hash(preview.data);
|
|
76
|
+
const handle = await putPrivateBlob({
|
|
77
|
+
data: preview.data,
|
|
78
|
+
filename: `${input.deckId}-${preview.id}.preview.png`,
|
|
79
|
+
mimeType: "image/png",
|
|
80
|
+
ownerEmail: input.ownerEmail,
|
|
81
|
+
key: `creative-context/slides/${input.deckId}/previews/${contentHash}.png`,
|
|
82
|
+
metadata: {
|
|
83
|
+
appId: "slides",
|
|
84
|
+
resourceType: "slide-preview",
|
|
85
|
+
resourceId: input.deckId,
|
|
86
|
+
contentHash,
|
|
87
|
+
},
|
|
88
|
+
}).catch(() => null);
|
|
89
|
+
if (!handle) return;
|
|
90
|
+
const slide = input.slides.find(
|
|
91
|
+
(candidate) => candidate.id === preview.id,
|
|
92
|
+
);
|
|
93
|
+
media.set(preview.id, {
|
|
94
|
+
kind: "image",
|
|
95
|
+
mimeType: "image/png",
|
|
96
|
+
accessMode: "private",
|
|
97
|
+
storageKey: serializePrivateBlobHandle(handle),
|
|
98
|
+
altText: slide?.title ?? "Slide preview",
|
|
99
|
+
contentHash,
|
|
100
|
+
width: preview.width,
|
|
101
|
+
height: preview.height,
|
|
102
|
+
metadata: { role: "slide-preview", slideId: preview.id },
|
|
103
|
+
});
|
|
104
|
+
}),
|
|
105
|
+
);
|
|
106
|
+
return media;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export const nativeDeckCreativeContextAdapter: NativeResourceCaptureAdapter = {
|
|
110
|
+
appId: "slides",
|
|
111
|
+
resourceType: "deck",
|
|
112
|
+
async listResourceVersions(resourceIds) {
|
|
113
|
+
if (!resourceIds.length) return [];
|
|
114
|
+
return getDb()
|
|
115
|
+
.select({
|
|
116
|
+
resourceId: schema.decks.id,
|
|
117
|
+
sourceModifiedAt: schema.decks.updatedAt,
|
|
118
|
+
})
|
|
119
|
+
.from(schema.decks)
|
|
120
|
+
.where(
|
|
121
|
+
and(
|
|
122
|
+
inArray(schema.decks.id, [...resourceIds]),
|
|
123
|
+
accessFilter(schema.decks, schema.deckShares),
|
|
124
|
+
),
|
|
125
|
+
);
|
|
126
|
+
},
|
|
127
|
+
async capture(reference) {
|
|
128
|
+
const access = await resolveAccess("deck", reference.resourceId);
|
|
129
|
+
if (!access) throw new Error("Deck not found");
|
|
130
|
+
const deck = access.resource as {
|
|
131
|
+
id: string;
|
|
132
|
+
title: string;
|
|
133
|
+
data: string;
|
|
134
|
+
ownerEmail: string;
|
|
135
|
+
updatedAt: string;
|
|
136
|
+
visibility?: "private" | "org" | "public";
|
|
137
|
+
};
|
|
138
|
+
if (
|
|
139
|
+
reference.expectedUpdatedAt &&
|
|
140
|
+
reference.expectedUpdatedAt !== deck.updatedAt
|
|
141
|
+
) {
|
|
142
|
+
throw new Error("Deck changed before it could be submitted to Context.");
|
|
143
|
+
}
|
|
144
|
+
const version = await createDeckVersionSnapshot(deck, {
|
|
145
|
+
force: true,
|
|
146
|
+
label: "Creative Context submission",
|
|
147
|
+
});
|
|
148
|
+
const contentHash = hash(deck.data);
|
|
149
|
+
const handle = await putPrivateBlob({
|
|
150
|
+
data: Buffer.from(deck.data),
|
|
151
|
+
filename: `${deck.id}.deck.json`,
|
|
152
|
+
mimeType: "application/json",
|
|
153
|
+
ownerEmail: deck.ownerEmail,
|
|
154
|
+
key: `creative-context/slides/${deck.id}/${contentHash}.json`,
|
|
155
|
+
metadata: {
|
|
156
|
+
appId: "slides",
|
|
157
|
+
resourceType: "deck",
|
|
158
|
+
resourceId: deck.id,
|
|
159
|
+
contentHash,
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
if (!handle)
|
|
163
|
+
throw new Error(
|
|
164
|
+
"Private blob storage is required to submit a deck to Context.",
|
|
165
|
+
);
|
|
166
|
+
const parsed = JSON.parse(deck.data) as {
|
|
167
|
+
aspectRatio?: string;
|
|
168
|
+
slides?: Array<{
|
|
169
|
+
id?: string;
|
|
170
|
+
content?: string;
|
|
171
|
+
notes?: string;
|
|
172
|
+
title?: string;
|
|
173
|
+
}>;
|
|
174
|
+
};
|
|
175
|
+
const slides = Array.isArray(parsed.slides) ? parsed.slides : [];
|
|
176
|
+
const slidePreviewMedia = await captureSlidePreviewMedia({
|
|
177
|
+
deckId: deck.id,
|
|
178
|
+
ownerEmail: deck.ownerEmail,
|
|
179
|
+
aspectRatio:
|
|
180
|
+
parsed.aspectRatio === "16:9" ||
|
|
181
|
+
parsed.aspectRatio === "1:1" ||
|
|
182
|
+
parsed.aspectRatio === "9:16" ||
|
|
183
|
+
parsed.aspectRatio === "4:5"
|
|
184
|
+
? parsed.aspectRatio
|
|
185
|
+
: undefined,
|
|
186
|
+
slides: slides.slice(0, 12).map((slide, index) => ({
|
|
187
|
+
id: slide.id ?? String(index),
|
|
188
|
+
content: slide.content ?? "",
|
|
189
|
+
title: slide.title ?? `Slide ${index + 1}`,
|
|
190
|
+
})),
|
|
191
|
+
});
|
|
192
|
+
return {
|
|
193
|
+
artifactKey: `slides:deck:${deck.id}`,
|
|
194
|
+
source: {
|
|
195
|
+
name: "Slides",
|
|
196
|
+
kind: "native-app",
|
|
197
|
+
externalRef: deck.id,
|
|
198
|
+
access: {
|
|
199
|
+
visibility: deck.visibility ?? "private",
|
|
200
|
+
canManage: access.role === "owner" || access.role === "admin",
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
items: [
|
|
204
|
+
{
|
|
205
|
+
externalId: `native:slides:deck:${deck.id}`,
|
|
206
|
+
kind: "slides-deck",
|
|
207
|
+
title: deck.title || "Untitled deck",
|
|
208
|
+
canonicalUrl: `/deck/${deck.id}`,
|
|
209
|
+
mimeType: "application/json",
|
|
210
|
+
content: slides
|
|
211
|
+
.map(
|
|
212
|
+
(slide, index) =>
|
|
213
|
+
`Slide ${index + 1}: ${text(slide.content ?? "")} ${slide.notes ?? ""}`,
|
|
214
|
+
)
|
|
215
|
+
.join("\n")
|
|
216
|
+
.slice(0, 40_000),
|
|
217
|
+
summary: `${slides.length} slides captured as an immutable deck version.`,
|
|
218
|
+
contentHash,
|
|
219
|
+
sourceModifiedAt: deck.updatedAt,
|
|
220
|
+
sourceVersion: version.id ?? contentHash,
|
|
221
|
+
metadata: {
|
|
222
|
+
preview: {
|
|
223
|
+
type: "slides",
|
|
224
|
+
slideCount: slides.length,
|
|
225
|
+
slides: slides.slice(0, 24).map((slide, index) => ({
|
|
226
|
+
index: index + 1,
|
|
227
|
+
title: previewText(slide.title, 120) || `Slide ${index + 1}`,
|
|
228
|
+
excerpt: previewText(slide.content),
|
|
229
|
+
})),
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
media: [...slidePreviewMedia.values()],
|
|
233
|
+
edges: slides.map((slide, index) => ({
|
|
234
|
+
relation: "contains",
|
|
235
|
+
toExternalId: `native:slides:deck:${deck.id}:slide:${slide.id ?? index}`,
|
|
236
|
+
})),
|
|
237
|
+
},
|
|
238
|
+
...slides.map((slide, index) => {
|
|
239
|
+
const content =
|
|
240
|
+
`${text(slide.content ?? "")} ${slide.notes ?? ""}`.trim();
|
|
241
|
+
const id = slide.id ?? String(index);
|
|
242
|
+
return {
|
|
243
|
+
externalId: `native:slides:deck:${deck.id}:slide:${id}`,
|
|
244
|
+
kind: "slide",
|
|
245
|
+
title: slide.title ?? `Slide ${index + 1}`,
|
|
246
|
+
canonicalUrl: `/deck/${deck.id}?slide=${encodeURIComponent(id)}`,
|
|
247
|
+
mimeType: "text/html",
|
|
248
|
+
content,
|
|
249
|
+
summary: content.slice(0, 500),
|
|
250
|
+
contentHash: hash(
|
|
251
|
+
`${deck.id}:${id}:${slide.content ?? ""}:${slide.notes ?? ""}`,
|
|
252
|
+
),
|
|
253
|
+
sourceModifiedAt: deck.updatedAt,
|
|
254
|
+
sourceVersion: version.id ?? contentHash,
|
|
255
|
+
metadata: {
|
|
256
|
+
preview: {
|
|
257
|
+
type: "slide",
|
|
258
|
+
index: index + 1,
|
|
259
|
+
title: previewText(slide.title, 120) || `Slide ${index + 1}`,
|
|
260
|
+
excerpt: previewText(slide.content),
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
media: slidePreviewMedia.has(id)
|
|
264
|
+
? [slidePreviewMedia.get(id)!]
|
|
265
|
+
: undefined,
|
|
266
|
+
};
|
|
267
|
+
}),
|
|
268
|
+
],
|
|
269
|
+
privateMetadata: {
|
|
270
|
+
nativeResource: {
|
|
271
|
+
appId: "slides",
|
|
272
|
+
resourceType: "deck",
|
|
273
|
+
resourceId: deck.id,
|
|
274
|
+
expectedUpdatedAt: reference.expectedUpdatedAt,
|
|
275
|
+
},
|
|
276
|
+
clone: {
|
|
277
|
+
handle,
|
|
278
|
+
appId: "slides",
|
|
279
|
+
resourceType: "deck",
|
|
280
|
+
resourceId: deck.id,
|
|
281
|
+
contentHash,
|
|
282
|
+
sourceVersion: version.id ?? contentHash,
|
|
283
|
+
updatedAt: deck.updatedAt,
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
};
|
|
287
|
+
},
|
|
288
|
+
};
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
getRequestUserEmail,
|
|
5
5
|
} from "@agent-native/core/server/request-context";
|
|
6
6
|
import {
|
|
7
|
+
registerNativeResourceCaptureAdapter,
|
|
7
8
|
setupCreativeContext,
|
|
8
9
|
type CreativeContextProjectionAdapters,
|
|
9
10
|
} from "@agent-native/creative-context/server";
|
|
@@ -12,6 +13,7 @@ import { desc, eq } from "drizzle-orm";
|
|
|
12
13
|
import { nanoid } from "nanoid";
|
|
13
14
|
|
|
14
15
|
import { getDb, schema } from "../db/index.js";
|
|
16
|
+
import { nativeDeckCreativeContextAdapter } from "../lib/native-creative-context.js";
|
|
15
17
|
|
|
16
18
|
type ProjectedLayoutTemplate = {
|
|
17
19
|
id: string;
|
|
@@ -163,4 +165,6 @@ registerOnboardingStep({
|
|
|
163
165
|
},
|
|
164
166
|
});
|
|
165
167
|
|
|
168
|
+
registerNativeResourceCaptureAdapter(nativeDeckCreativeContextAdapter);
|
|
169
|
+
|
|
166
170
|
export default setupCreativeContext({ appId: "slides", projections });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantChat.d.ts","sourceRoot":"","sources":["../../src/client/AssistantChat.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAEV,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,qBAAqB,CAAC;AAW7B,OAAO,KASN,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAYrE,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAUL,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,C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C;AAsDjD,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,QAI9C;AAkDD,OAAO,EACL,iBAAiB,EAElB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAsE7B;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,YAAY,EAAE,OAAO,GACpB;IAAE,cAAc,EAAE,OAAO,CAAC;IAAC,eAAe,EAAE,MAAM,IAAI,CAAA;CAAE,CA2D1D;AAy6GD,eAAO,MAAM,aAAa,gGA2GxB,CAAC"}
|
|
@@ -33,6 +33,7 @@ import { useNearBottomAutoscroll } from "./conversation/index.js";
|
|
|
33
33
|
import { useAgentDynamicSuggestionsResult, } from "./dynamic-suggestions.js";
|
|
34
34
|
import { GuidedQuestionFlow, useGuidedQuestionFlow, } from "./guided-questions.js";
|
|
35
35
|
import { useT } from "./i18n.js";
|
|
36
|
+
import { McpConnectionSuggestion } from "./resources/McpConnectionSuggestion.js";
|
|
36
37
|
import { AgentAutoContinueSignal, readSSEStreamRaw, settleInterruptedToolCalls, } from "./sse-event-processor.js";
|
|
37
38
|
import { fetchAgentEngineConfiguredState, useAgentEngineConfigured, } from "./use-agent-engine-configured.js";
|
|
38
39
|
import { useDevMode } from "./use-dev-mode.js";
|
|
@@ -1308,6 +1309,11 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1308
1309
|
// (unsupported format, size cap, body-size rejection, drop errors).
|
|
1309
1310
|
// Cleared on the next message send.
|
|
1310
1311
|
const [composerError, setComposerError] = useState(null);
|
|
1312
|
+
const [composerText, setComposerText] = useState("");
|
|
1313
|
+
const handleComposerTextChange = useCallback((text) => {
|
|
1314
|
+
setComposerText(text);
|
|
1315
|
+
onComposerTextChange?.(text);
|
|
1316
|
+
}, [onComposerTextChange]);
|
|
1311
1317
|
const dropDepthRef = useRef(0);
|
|
1312
1318
|
const handleChatDragEnter = useCallback((e) => {
|
|
1313
1319
|
if (!Array.from(e.dataTransfer?.types ?? []).includes("Files"))
|
|
@@ -3781,7 +3787,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
3781
3787
|
}), resolvedThreadFooterSlot ? (_jsx(MessageScrollerItem, { children: _jsx("div", { className: "agent-thread-footer-slot", children: resolvedThreadFooterSlot }) })) : null] })) }), !authError &&
|
|
3782
3788
|
!isRestoring &&
|
|
3783
3789
|
!showEmptyState &&
|
|
3784
|
-
showScrollToBottom ? (_jsx("div", { className: "shrink-0 flex justify-center -mb-1", children: _jsx("button", { type: "button", onClick: scrollToBottom, className: "flex h-7 w-7 items-center justify-center rounded-full border border-border bg-background shadow-sm hover:bg-accent", "aria-label": "Scroll to bottom", children: _jsx(IconChevronDown, { className: "h-3.5 w-3.5 text-muted-foreground" }) }) })) : null] }) }, chatScrollResetKey), showComposerSlot ? composerSlot : null, showCenteredEmptyThreadFooterSlot ? (_jsx("div", { className: "agent-thread-footer-slot agent-thread-footer-slot--centered-empty", children: resolvedThreadFooterSlot })) : null, guidedQuestions && guidedQuestions.length > 0 && (_jsx("div", { className: "shrink-0 px-3 pb-2", children: _jsx(GuidedQuestionFlow, { questions: guidedQuestions, onSubmit: handleGuidedQuestionsSubmit, onSkip: handleGuidedQuestionsSkip, ...(guidedQuestionsTitle
|
|
3790
|
+
showScrollToBottom ? (_jsx("div", { className: "shrink-0 flex justify-center -mb-1", children: _jsx("button", { type: "button", onClick: scrollToBottom, className: "flex h-7 w-7 items-center justify-center rounded-full border border-border bg-background shadow-sm hover:bg-accent", "aria-label": "Scroll to bottom", children: _jsx(IconChevronDown, { className: "h-3.5 w-3.5 text-muted-foreground" }) }) })) : null] }) }, chatScrollResetKey), showComposerSlot ? composerSlot : null, isActiveComposer && (_jsx(McpConnectionSuggestion, { text: composerText })), showCenteredEmptyThreadFooterSlot ? (_jsx("div", { className: "agent-thread-footer-slot agent-thread-footer-slot--centered-empty", children: resolvedThreadFooterSlot })) : null, guidedQuestions && guidedQuestions.length > 0 && (_jsx("div", { className: "shrink-0 px-3 pb-2", children: _jsx(GuidedQuestionFlow, { questions: guidedQuestions, onSubmit: handleGuidedQuestionsSubmit, onSkip: handleGuidedQuestionsSkip, ...(guidedQuestionsTitle
|
|
3785
3791
|
? { title: guidedQuestionsTitle }
|
|
3786
3792
|
: {}), ...(guidedQuestionsDescription
|
|
3787
3793
|
? { description: guidedQuestionsDescription }
|
|
@@ -3795,7 +3801,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
3795
3801
|
"agent-composer-root--missing-key"), children: showMissingKeySetup ? (_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { type: "button", className: "agent-composer-missing-key-trigger", "aria-label": "Connect AI to start chatting", children: _jsxs("span", { className: "agent-composer-missing-key-copy", children: [_jsx("span", { className: "agent-composer-missing-key-title", children: missingApiKeySetupLayout === "sidebar"
|
|
3796
3802
|
? "Connect AI to chat"
|
|
3797
3803
|
: "Connect AI to start chatting" }), missingApiKeySetupLayout !== "sidebar" ? (_jsx("span", { className: "agent-composer-missing-key-description", children: "Builder.io includes free credits, or use your own API key." })) : null] }) }) })) : (_jsxs(_Fragment, { children: [_jsx(ComposerAttachmentPreviewStrip, {}), _jsx(TiptapComposer, { focusRef: tiptapRef, onTextChange: isActiveComposer
|
|
3798
|
-
?
|
|
3804
|
+
? handleComposerTextChange
|
|
3799
3805
|
: undefined, disabled: isComposerDisabled, placeholder: missingApiKey
|
|
3800
3806
|
? "Connect AI to start chatting..."
|
|
3801
3807
|
: isProviderStatusChecking
|