@agent-native/core 0.141.3 → 0.141.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +1 -1
- package/corpus/templates/analytics/.agents/skills/analysis-workspace/SKILL.md +1 -1
- package/corpus/templates/analytics/actions/gong-calls.ts +56 -18
- package/corpus/templates/analytics/changelog/2026-08-05-analytics-queries-keep-every-table-tenant-scoped.md +6 -0
- package/corpus/templates/analytics/changelog/2026-08-05-fixed-sign-in-and-dashboard-requests-failing-when-background.md +6 -0
- package/corpus/templates/analytics/changelog/2026-08-05-historical-rollups-stay-complete-while-live-events-arrive.md +6 -0
- package/corpus/templates/analytics/server/db/schema.ts +1 -0
- package/corpus/templates/analytics/server/lib/dashboard-report.ts +2 -0
- package/corpus/templates/analytics/server/lib/emails.ts +51 -0
- package/corpus/templates/analytics/server/lib/first-party-analytics-health.ts +8 -12
- package/corpus/templates/analytics/server/lib/first-party-analytics-rollups.ts +9 -0
- package/corpus/templates/analytics/server/lib/first-party-analytics.ts +262 -13
- package/corpus/templates/analytics/server/lib/gong.ts +132 -33
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +1 -1
- package/corpus/templates/analytics/server/plugins/auth.ts +21 -2
- package/corpus/templates/analytics/server/plugins/db.ts +11 -3
- package/corpus/templates/analytics/server/plugins/transactional-emails.ts +5 -0
- package/corpus/templates/calendar/app/components/calendar/InlineEventPickers.tsx +17 -7
- package/corpus/templates/calendar/server/lib/booking-emails.ts +154 -70
- package/corpus/templates/calendar/server/lib/emails.ts +167 -0
- package/corpus/templates/calendar/server/lib/event-guest-notifications.ts +64 -28
- package/corpus/templates/calendar/server/plugins/transactional-emails.ts +5 -0
- package/corpus/templates/clips/actions/invite-member.ts +39 -16
- package/corpus/templates/clips/app/components/player/share-dialog.tsx +73 -1
- package/corpus/templates/clips/app/i18n/en-US.ts +3 -0
- package/corpus/templates/clips/app/routes/r.$recordingId.tsx +10 -25
- package/corpus/templates/clips/app/routes/share.$shareId.tsx +2 -0
- package/corpus/templates/clips/changelog/2026-08-05-activity-is-now-the-default-clips-recording-tab-and-ai-setup.md +6 -0
- package/corpus/templates/clips/changelog/2026-08-05-clips-can-copy-a-linked-email-preview-for-public-recordings.md +6 -0
- package/corpus/templates/clips/changelog/2026-08-05-preparing-recording-now-uses-a-clean-shadow-free-status-card.md +6 -0
- package/corpus/templates/clips/desktop/src/styles.css +0 -3
- package/corpus/templates/clips/server/lib/emails.ts +256 -0
- package/corpus/templates/clips/server/lib/transactional-email-templates.ts +24 -0
- package/corpus/templates/clips/server/plugins/transactional-email-catalog.ts +5 -0
- package/corpus/templates/clips/server/routes/api/thumbnail/[recordingId].get.ts +4 -1
- package/corpus/templates/clips/shared/email-preview.ts +61 -0
- package/corpus/templates/content/server/lib/comment-notifications.ts +57 -26
- package/corpus/templates/content/server/lib/emails.ts +70 -0
- package/corpus/templates/content/server/plugins/transactional-emails.ts +5 -0
- package/corpus/templates/design/actions/import-design-tokens.ts +11 -8
- package/corpus/templates/design/actions/index-design-tokens.ts +13 -6
- package/corpus/templates/design/changelog/2026-08-05-design-token-imports-classify-typography-dimensions-correctly.md +6 -0
- package/corpus/templates/dispatch/app/routes/transactional-email.$appId.$id.tsx +4 -0
- package/corpus/templates/dispatch/app/routes/transactional-email.tsx +4 -0
- package/corpus/templates/dispatch/changelog/2026-08-05-transactional-email-catalogs-and-delivery-activity-are-available-again.md +6 -0
- package/corpus/templates/factory/AGENTS.md +18 -17
- package/corpus/templates/factory/actions/get-factory-automation-health.ts +50 -0
- package/corpus/templates/factory/actions/get-triage-config.ts +8 -0
- package/corpus/templates/factory/actions/save-triage-config.ts +26 -0
- package/corpus/templates/factory/app/i18n/en-US.ts +27 -0
- package/corpus/templates/factory/app/routes/factory.tsx +376 -206
- package/corpus/templates/factory/changelog/2026-08-05-factory-now-keeps-production-automations-running-shows-sched.md +6 -0
- package/corpus/templates/factory/server/db/schema.ts +6 -0
- package/corpus/templates/factory/server/plugins/factory-migrations.ts +10 -0
- package/corpus/templates/factory/server/plugins/factory-scheduler-job.ts +141 -2
- package/corpus/templates/forms/app/pages/FormsListPage.tsx +41 -21
- package/corpus/templates/forms/changelog/2026-08-05-form-links-can-now-be-cmd-clicked-to-open-in-a-new-tab.md +6 -0
- package/corpus/templates/forms/server/lib/emails.ts +52 -0
- package/corpus/templates/forms/server/lib/response-email.ts +2 -0
- package/corpus/templates/forms/server/plugins/transactional-emails.ts +5 -0
- package/corpus/templates/plan/actions/request-plan-access.ts +33 -12
- package/corpus/templates/plan/server/lib/comment-notifications.ts +53 -27
- package/corpus/templates/plan/server/lib/emails.ts +67 -0
- package/corpus/templates/plan/server/plugins/transactional-emails.ts +5 -0
- package/corpus/templates/slides/actions/import-from-url.ts +1 -0
- package/corpus/templates/slides/app/components/editor/NewDeckReferenceStep.tsx +492 -381
- package/corpus/templates/slides/app/components/editor/PromptDialog.tsx +8 -7
- package/corpus/templates/slides/app/components/layout/Layout.tsx +27 -23
- package/corpus/templates/slides/app/components/onboarding/FirstDeckOnboardingFlow.tsx +313 -0
- package/corpus/templates/slides/app/components/ui/command.tsx +1 -0
- package/corpus/templates/slides/app/i18n/en-US.ts +8 -2
- package/corpus/templates/slides/app/lib/create-deck-generation.ts +305 -0
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +12 -12
- package/corpus/templates/slides/app/pages/Index.tsx +127 -137
- package/corpus/templates/slides/app/root.tsx +8 -0
- package/corpus/templates/slides/changelog/2026-08-05-deck-browsing-keeps-all-and-mine-in-the-header-with-a-tighte.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-05-new-deck-creation-now-flows-through-a-clean-full-screen-refe.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-05-website-imports-now-include-linked-stylesheets-for-more-accu.md +6 -0
- package/corpus/templates/slides/server/lib/comment-notifications.ts +44 -21
- package/corpus/templates/slides/server/lib/emails.ts +40 -0
- package/corpus/templates/slides/server/plugins/transactional-emails.ts +5 -0
- package/dist/brand-kit/index.d.ts +1 -0
- package/dist/brand-kit/index.js +1 -0
- package/dist/brand-kit/tokens.d.ts +91 -0
- package/dist/brand-kit/tokens.js +279 -0
- package/dist/brand-kit/types.d.ts +25 -0
- package/dist/client/AssistantChat.js +7 -7
- package/dist/client/onboarding/FirstRunOnboarding.js +26 -2
- package/dist/client/onboarding/first-run-registry.d.ts +25 -0
- package/dist/client/onboarding/first-run-registry.js +18 -0
- package/dist/client/onboarding/index.d.ts +2 -0
- package/dist/client/onboarding/index.js +1 -0
- package/dist/collab/routes.d.ts +1 -1
- package/dist/deploy/build.d.ts +8 -0
- package/dist/deploy/build.js +92 -3
- package/dist/deploy/workspace-deploy.js +86 -3
- package/dist/email-catalog/actions/list-email-activity.d.ts +5 -0
- package/dist/email-catalog/actions/list-email-activity.js +19 -0
- package/dist/email-catalog/actions/list-email-engagement.d.ts +5 -0
- package/dist/email-catalog/actions/list-email-engagement.js +15 -0
- package/dist/email-catalog/actions/list-email-log.d.ts +7 -0
- package/dist/email-catalog/actions/list-email-log.js +23 -0
- package/dist/email-catalog/actions/list-transactional-emails.d.ts +22 -0
- package/dist/email-catalog/actions/list-transactional-emails.js +67 -0
- package/dist/email-catalog/actions/render-transactional-email-preview.d.ts +9 -0
- package/dist/email-catalog/actions/render-transactional-email-preview.js +25 -0
- package/dist/email-catalog/authorize.d.ts +1 -0
- package/dist/email-catalog/authorize.js +9 -0
- package/dist/email-catalog/log.d.ts +60 -0
- package/dist/email-catalog/log.js +142 -0
- package/dist/email-catalog/provider-metrics.d.ts +34 -0
- package/dist/email-catalog/provider-metrics.js +182 -0
- package/dist/email-catalog/registry.d.ts +78 -0
- package/dist/email-catalog/registry.js +70 -0
- package/dist/email-catalog/schema.d.ts +231 -0
- package/dist/email-catalog/schema.js +53 -0
- package/dist/email-catalog/system-emails.d.ts +13 -0
- package/dist/email-catalog/system-emails.js +67 -0
- package/dist/jobs/index.d.ts +2 -0
- package/dist/jobs/index.js +2 -0
- package/dist/jobs/run-history.js +48 -1
- package/dist/jobs/scheduler-dispatch.d.ts +7 -0
- package/dist/jobs/scheduler-dispatch.js +7 -0
- package/dist/jobs/scheduler-health.d.ts +22 -0
- package/dist/jobs/scheduler-health.js +172 -0
- package/dist/jobs/scheduler.js +67 -2
- package/dist/localization/default-messages.d.ts +45 -0
- package/dist/localization/default-messages.js +45 -0
- package/dist/mcp/screen-memory-stdio.d.ts +7 -7
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +5 -5
- package/dist/org/handlers.js +9 -1
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +10 -10
- package/dist/provider-api/actions/provider-api.d.ts +8 -8
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/action-discovery.js +22 -0
- package/dist/server/agent-chat/recurring-jobs-runtime.d.ts +7 -1
- package/dist/server/agent-chat/recurring-jobs-runtime.js +12 -0
- package/dist/server/agent-chat-plugin.d.ts +2 -1
- package/dist/server/agent-chat-plugin.js +39 -1
- package/dist/server/better-auth-instance.js +17 -2
- package/dist/server/design-token-utils.d.ts +6 -1
- package/dist/server/design-token-utils.js +252 -59
- package/dist/server/email.d.ts +11 -0
- package/dist/server/email.js +54 -3
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1 -0
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/vite/client.js +20 -14
- package/package.json +2 -1
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { callAction } from "@agent-native/core/client/hooks";
|
|
2
|
+
import { extractGoogleDocUrls } from "@shared/google-docs";
|
|
3
|
+
import { flushSync } from "react-dom";
|
|
4
|
+
|
|
5
|
+
import type { NewDeckReferenceSelection } from "@/components/editor/NewDeckReferenceStep";
|
|
6
|
+
import type { UploadedFile } from "@/components/editor/PromptDialog";
|
|
7
|
+
import type { Deck } from "@/context/DeckContext";
|
|
8
|
+
import { createDeckAgentMessage } from "@/lib/agent-visible-message";
|
|
9
|
+
|
|
10
|
+
interface DesignSystemGenerationContextResult {
|
|
11
|
+
agentContext?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async function loadDesignSystemGenerationContext(
|
|
15
|
+
designSystemId?: string | null,
|
|
16
|
+
): Promise<string> {
|
|
17
|
+
if (!designSystemId) return "";
|
|
18
|
+
try {
|
|
19
|
+
const result = (await callAction(
|
|
20
|
+
"get-design-system",
|
|
21
|
+
{ id: designSystemId },
|
|
22
|
+
{ method: "GET" },
|
|
23
|
+
)) as DesignSystemGenerationContextResult | undefined;
|
|
24
|
+
if (result?.agentContext?.trim()) {
|
|
25
|
+
return [
|
|
26
|
+
"",
|
|
27
|
+
result.agentContext.trim(),
|
|
28
|
+
"",
|
|
29
|
+
"The selected design system context above was hydrated before this agent run. Follow it directly; do not replace it with generic colors, fonts, spacing, imagery, or slide components.",
|
|
30
|
+
].join("\n");
|
|
31
|
+
}
|
|
32
|
+
} catch (error) {
|
|
33
|
+
const message =
|
|
34
|
+
error instanceof Error ? error.message : "unknown loading error";
|
|
35
|
+
return [
|
|
36
|
+
"",
|
|
37
|
+
"## Selected Design System Context",
|
|
38
|
+
`The selected design system id "${designSystemId}" could not be loaded before generation: ${message}`,
|
|
39
|
+
"Before adding slides, call `get-design-system` for this id. If it still fails, stop and tell the user the selected design system is unavailable instead of improvising a generic style.",
|
|
40
|
+
].join("\n");
|
|
41
|
+
}
|
|
42
|
+
return [
|
|
43
|
+
"",
|
|
44
|
+
"## Selected Design System Context",
|
|
45
|
+
`The selected design system id "${designSystemId}" returned no generation context.`,
|
|
46
|
+
"Call `get-design-system` for this id before adding slides. If it still has no usable tokens/docs, stop and ask the user to finish design-system indexing instead of improvising a generic style.",
|
|
47
|
+
].join("\n");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface ReferenceDeckContextResult {
|
|
51
|
+
agentContext?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function loadReferenceDeckGenerationContext(
|
|
55
|
+
referenceDeckId?: string | null,
|
|
56
|
+
): Promise<string> {
|
|
57
|
+
if (!referenceDeckId) return "";
|
|
58
|
+
try {
|
|
59
|
+
const result = (await callAction(
|
|
60
|
+
"get-deck-reference-context",
|
|
61
|
+
{ id: referenceDeckId },
|
|
62
|
+
{ method: "GET" },
|
|
63
|
+
)) as ReferenceDeckContextResult | undefined;
|
|
64
|
+
if (result?.agentContext?.trim()) {
|
|
65
|
+
return `\n${result.agentContext.trim()}`;
|
|
66
|
+
}
|
|
67
|
+
} catch (error) {
|
|
68
|
+
const message =
|
|
69
|
+
error instanceof Error ? error.message : "unknown loading error";
|
|
70
|
+
return [
|
|
71
|
+
"",
|
|
72
|
+
"## Reference Deck",
|
|
73
|
+
`The user picked deck "${referenceDeckId}" as a style reference, but it could not be loaded before generation: ${message}`,
|
|
74
|
+
"Before adding slides, call `get-deck-reference-context` for this id. If it still fails, tell the user the reference deck is unavailable instead of inventing a style.",
|
|
75
|
+
].join("\n");
|
|
76
|
+
}
|
|
77
|
+
return [
|
|
78
|
+
"",
|
|
79
|
+
"## Reference Deck",
|
|
80
|
+
`The user picked deck "${referenceDeckId}" as a style reference, but it returned no usable context.`,
|
|
81
|
+
`Call \`get-deck --id ${referenceDeckId}\` before generating. If that deck is empty, tell the user instead of silently generating without a reference.`,
|
|
82
|
+
].join("\n");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function describeUploadedFilesForAgent(
|
|
86
|
+
files: UploadedFile[],
|
|
87
|
+
deckId: string,
|
|
88
|
+
): string {
|
|
89
|
+
if (files.length === 0) return "";
|
|
90
|
+
const fileList = files
|
|
91
|
+
.map(
|
|
92
|
+
(file) =>
|
|
93
|
+
`- ${file.originalName} (${file.type}, ${(file.size / 1024).toFixed(1)}KB) at path: ${file.path}${file.url ? `; embeddable URL: ${file.url}` : ""}`,
|
|
94
|
+
)
|
|
95
|
+
.join("\n");
|
|
96
|
+
return [
|
|
97
|
+
"",
|
|
98
|
+
`The user uploaded ${files.length} file(s). These paths are real uploaded files; process them with import actions before using their contents:`,
|
|
99
|
+
fileList,
|
|
100
|
+
"",
|
|
101
|
+
"File handling rules:",
|
|
102
|
+
`- PPTX files: call \`import-pptx --filePath \"<path>\" --deckId ${deckId}\` before adding or editing slides.`,
|
|
103
|
+
`- PDF and DOCX files: call \`import-file --filePath \"<path>\" --format auto --deckId ${deckId}\` and use the returned extracted text as source material. The returned text is capped for reliability; re-run with maxChars only if more context is needed.`,
|
|
104
|
+
"- Text-like files: use the uploaded-text-file blocks already included in the prompt; do not call import-file for them.",
|
|
105
|
+
'- Image files with an embeddable URL can be inserted directly into slide HTML as `<img src="...">` or used as visual references.',
|
|
106
|
+
"- Image files without a URL are visual/reference assets only; do not claim to have processed a PPTX/PDF/DOCX unless the relevant import action succeeds.",
|
|
107
|
+
].join("\n");
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function mergeUploadedFilesForRetry(
|
|
111
|
+
savedFiles: UploadedFile[],
|
|
112
|
+
newFiles: UploadedFile[],
|
|
113
|
+
): UploadedFile[] {
|
|
114
|
+
const seen = new Set<string>();
|
|
115
|
+
return [...savedFiles, ...newFiles].filter((file) => {
|
|
116
|
+
const key = file.path || file.url || file.filename;
|
|
117
|
+
if (seen.has(key)) return false;
|
|
118
|
+
seen.add(key);
|
|
119
|
+
return true;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
type Navigate = (
|
|
124
|
+
to: string,
|
|
125
|
+
options?: { flushSync?: boolean; replace?: boolean },
|
|
126
|
+
) => void;
|
|
127
|
+
|
|
128
|
+
type CreateDeck = (
|
|
129
|
+
title?: string,
|
|
130
|
+
options?: { noDefaultSlides?: boolean; designSystemId?: string | null },
|
|
131
|
+
) => Deck;
|
|
132
|
+
|
|
133
|
+
type SubmitAgent = (
|
|
134
|
+
message: string,
|
|
135
|
+
context: string,
|
|
136
|
+
options: {
|
|
137
|
+
newTab: boolean;
|
|
138
|
+
reuseEmptyTab: boolean;
|
|
139
|
+
openSidebar: boolean;
|
|
140
|
+
},
|
|
141
|
+
) => void;
|
|
142
|
+
|
|
143
|
+
export interface StartDeckGenerationOptions {
|
|
144
|
+
session: unknown | null;
|
|
145
|
+
prompt: string;
|
|
146
|
+
files: UploadedFile[];
|
|
147
|
+
retryFiles?: UploadedFile[];
|
|
148
|
+
referenceSelection?: NewDeckReferenceSelection;
|
|
149
|
+
selectedDesignSystemId?: string | null;
|
|
150
|
+
selectedReferenceDeckId?: string | null;
|
|
151
|
+
designSystems: Array<{ id: string; title: string }>;
|
|
152
|
+
createDeck: CreateDeck;
|
|
153
|
+
ensureDeckPersisted: (id: string) => Promise<boolean>;
|
|
154
|
+
deleteDeck: (id: string) => void;
|
|
155
|
+
navigate: Navigate;
|
|
156
|
+
agentSubmit: SubmitAgent;
|
|
157
|
+
onPromptClosed: () => void;
|
|
158
|
+
onUnauthenticated: (prompt: string, hadFiles: boolean) => void;
|
|
159
|
+
onPersistenceFailure: (prompt: string, files: UploadedFile[]) => void;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** Create the optimistic deck, hydrate references, and start the agent run. */
|
|
163
|
+
export async function startDeckGeneration({
|
|
164
|
+
session,
|
|
165
|
+
prompt,
|
|
166
|
+
files,
|
|
167
|
+
retryFiles = [],
|
|
168
|
+
referenceSelection = {},
|
|
169
|
+
selectedDesignSystemId,
|
|
170
|
+
selectedReferenceDeckId,
|
|
171
|
+
designSystems,
|
|
172
|
+
createDeck,
|
|
173
|
+
ensureDeckPersisted,
|
|
174
|
+
deleteDeck,
|
|
175
|
+
navigate,
|
|
176
|
+
agentSubmit,
|
|
177
|
+
onPromptClosed,
|
|
178
|
+
onUnauthenticated,
|
|
179
|
+
onPersistenceFailure,
|
|
180
|
+
}: StartDeckGenerationOptions): Promise<
|
|
181
|
+
"started" | "failed" | "unauthenticated"
|
|
182
|
+
> {
|
|
183
|
+
if (!session) {
|
|
184
|
+
onUnauthenticated(prompt, files.length > 0);
|
|
185
|
+
return "unauthenticated";
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const filesForGeneration = mergeUploadedFilesForRetry(retryFiles, files);
|
|
189
|
+
const designSystemId =
|
|
190
|
+
referenceSelection.designSystemId !== undefined
|
|
191
|
+
? referenceSelection.designSystemId
|
|
192
|
+
: selectedDesignSystemId && selectedDesignSystemId !== "none"
|
|
193
|
+
? selectedDesignSystemId
|
|
194
|
+
: null;
|
|
195
|
+
const referenceDeckId =
|
|
196
|
+
referenceSelection.referenceDeckId !== undefined
|
|
197
|
+
? referenceSelection.referenceDeckId
|
|
198
|
+
: selectedReferenceDeckId && selectedReferenceDeckId !== "none"
|
|
199
|
+
? selectedReferenceDeckId
|
|
200
|
+
: null;
|
|
201
|
+
const selectedDesignSystem = designSystemId
|
|
202
|
+
? designSystems.find((designSystem) => designSystem.id === designSystemId)
|
|
203
|
+
: undefined;
|
|
204
|
+
|
|
205
|
+
let deck: Deck | undefined;
|
|
206
|
+
flushSync(() => {
|
|
207
|
+
deck = createDeck(undefined, {
|
|
208
|
+
noDefaultSlides: true,
|
|
209
|
+
designSystemId: selectedDesignSystem?.id ?? null,
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
if (!deck) return "failed";
|
|
213
|
+
const deckId = deck.id;
|
|
214
|
+
onPromptClosed();
|
|
215
|
+
|
|
216
|
+
const persisted = await ensureDeckPersisted(deck.id);
|
|
217
|
+
if (!persisted) {
|
|
218
|
+
onPersistenceFailure(prompt, filesForGeneration);
|
|
219
|
+
deleteDeck(deckId);
|
|
220
|
+
return "failed";
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
navigate(`/deck/${deck.id}`, { flushSync: true });
|
|
224
|
+
|
|
225
|
+
const trimmedPrompt = prompt.trim();
|
|
226
|
+
const hasImportedGoogleDocContext = trimmedPrompt.includes("<google-doc ");
|
|
227
|
+
const googleDocUrls = hasImportedGoogleDocContext
|
|
228
|
+
? []
|
|
229
|
+
: extractGoogleDocUrls(trimmedPrompt);
|
|
230
|
+
const fileContext = describeUploadedFilesForAgent(filesForGeneration, deckId);
|
|
231
|
+
const googleDocContext =
|
|
232
|
+
googleDocUrls.length > 0
|
|
233
|
+
? [
|
|
234
|
+
"",
|
|
235
|
+
"The request includes Google Docs URL(s):",
|
|
236
|
+
...googleDocUrls.map((url) => `- ${url}`),
|
|
237
|
+
"Before adding slides, call `import-google-doc` for each URL and use the returned text as source material.",
|
|
238
|
+
"If the action cannot read a private document, tell the user the exact sharing step from the action error instead of generating from the URL alone.",
|
|
239
|
+
].join("\n")
|
|
240
|
+
: "";
|
|
241
|
+
const referenceDeckContext =
|
|
242
|
+
await loadReferenceDeckGenerationContext(referenceDeckId);
|
|
243
|
+
const hydratedDesignSystemContext = await loadDesignSystemGenerationContext(
|
|
244
|
+
selectedDesignSystem?.id,
|
|
245
|
+
);
|
|
246
|
+
const designSystemContext = selectedDesignSystem
|
|
247
|
+
? [
|
|
248
|
+
"",
|
|
249
|
+
"Design system selection:",
|
|
250
|
+
`- Use "${selectedDesignSystem.title}" (id: ${selectedDesignSystem.id}).`,
|
|
251
|
+
"- The deck has already been linked to this design system.",
|
|
252
|
+
"- Use the hydrated design system context below for colors, typography, spacing, imagery, and slide defaults.",
|
|
253
|
+
hydratedDesignSystemContext,
|
|
254
|
+
"- Do not choose or apply a different design system.",
|
|
255
|
+
].join("\n")
|
|
256
|
+
: [
|
|
257
|
+
"",
|
|
258
|
+
"Design system selection:",
|
|
259
|
+
"- None selected. Do not apply a design system unless the user asks for one.",
|
|
260
|
+
].join("\n");
|
|
261
|
+
const referenceSource = referenceSelection.referenceSource;
|
|
262
|
+
const referenceSourceContext = referenceSource
|
|
263
|
+
? [
|
|
264
|
+
"",
|
|
265
|
+
"Additional reference source selected in the reference step:",
|
|
266
|
+
`- ${referenceSource.kind}: ${referenceSource.value}`,
|
|
267
|
+
referenceSource.kind === "google-docs"
|
|
268
|
+
? "Call `import-google-doc` before generating and use the returned text as source material."
|
|
269
|
+
: referenceSource.kind === "website"
|
|
270
|
+
? "Call `import-from-url` before generating and use the returned page context as a reference."
|
|
271
|
+
: "Use the Figma source as the design reference. If Builder or Figma access is required, report the exact connection step instead of guessing.",
|
|
272
|
+
].join("\n")
|
|
273
|
+
: "";
|
|
274
|
+
|
|
275
|
+
const context = [
|
|
276
|
+
`The user just created a new empty deck (id: "${deckId}") and wants to create a presentation or standalone visual.`,
|
|
277
|
+
"The visible user message above contains the user's request and/or pasted source material for the deck. Treat pasted memo content as source material even if the user did not explicitly say they are pasting it.",
|
|
278
|
+
googleDocContext,
|
|
279
|
+
fileContext,
|
|
280
|
+
referenceDeckContext,
|
|
281
|
+
designSystemContext,
|
|
282
|
+
referenceSourceContext,
|
|
283
|
+
"",
|
|
284
|
+
"Before generating, if the request or selected references leave a meaningful choice unresolved, use the `ask-question` tool to ask one concise, prompt-specific question in the inline guided-question flow. Generate the question wording and 2 to 4 options from the user's request and selected references, like Claude's design-question flow; do not use a fixed generic questionnaire. Ask only a choice that materially affects the deck, such as audience, tone, structure, or length. If the prompt already makes the choice clear, do not ask it again. Wait for the user's answer or skip before adding slides.",
|
|
285
|
+
"Start a `manage-progress` run so progress appears in the app header. Add the first slide as soon as it is ready, then continue one slide at a time so the editor visibly fills in.",
|
|
286
|
+
`After reading any requested or imported source material, but before adding the first slide, choose a concise, specific deck title from the user's request and source material. Call \`patch-deck\` with \`deckId: \"${deckId}\"\` and \`operations: [{ \"op\": \"patch-deck-fields\", \"fields\": { \"title\": \"<generated title>\" } }]\`. Include only \`title\` in \`fields\`; omit all other optional fields. Never leave a generated deck named \"Untitled Deck\" or another placeholder.`,
|
|
287
|
+
"If the user asks for a standalone visual, diagram, hero, one-pager, poster, or a couple of visuals, create only the requested one/few polished visual slides. Do not pad the result into a full presentation.",
|
|
288
|
+
`Add slides ONE AT A TIME using the \`add-slide\` action with --deckId=${deckId}. Wait for each \`add-slide\` result before calling it again; do not batch or parallelize slide writes.`,
|
|
289
|
+
"If the user asked for a specific slide count, keep going sequentially until that count is reached unless a tool error blocks you.",
|
|
290
|
+
"Every slide is rendered into a fixed native canvas (default 16:9 is 960x540 CSS pixels, with 740x380px available inside standard 80px 110px padding). Keep the main content within that fit budget; split dense source material across more slides instead of packing it tightly. Never use zoom, transform: scale(), clipping, or scroll overflow to hide content overflow, and keep body text at least 16px.",
|
|
291
|
+
"Each slide's --content must be full HTML. Slide HTML templates are in your AGENTS.md.",
|
|
292
|
+
"Do NOT use create-deck (the deck already exists). Do NOT call db-schema, the resources tool, or search-files.",
|
|
293
|
+
].join("\n");
|
|
294
|
+
|
|
295
|
+
navigate(`/deck/${deck.id}?generating=1`, {
|
|
296
|
+
replace: true,
|
|
297
|
+
flushSync: true,
|
|
298
|
+
});
|
|
299
|
+
agentSubmit(createDeckAgentMessage(trimmedPrompt), context, {
|
|
300
|
+
newTab: true,
|
|
301
|
+
reuseEmptyTab: true,
|
|
302
|
+
openSidebar: true,
|
|
303
|
+
});
|
|
304
|
+
return "started";
|
|
305
|
+
}
|
|
@@ -34,7 +34,6 @@ import { DeckEditorSkeleton } from "@/components/editor/DeckEditorSkeleton";
|
|
|
34
34
|
import { EditorActionCluster } from "@/components/editor/EditorActionCluster";
|
|
35
35
|
import EditorSidebar from "@/components/editor/EditorSidebar";
|
|
36
36
|
import EditorToolbar from "@/components/editor/EditorToolbar";
|
|
37
|
-
import GeneratingOverlay from "@/components/editor/GeneratingOverlay";
|
|
38
37
|
import GeneratingSlidePreview from "@/components/editor/GeneratingSlidePreview";
|
|
39
38
|
import HistoryPanel from "@/components/editor/HistoryPanel";
|
|
40
39
|
import ImageDropPromptPopover from "@/components/editor/ImageDropPromptPopover";
|
|
@@ -1157,18 +1156,19 @@ export default function DeckEditor() {
|
|
|
1157
1156
|
)}
|
|
1158
1157
|
|
|
1159
1158
|
{!generatingSlideSelected &&
|
|
1160
|
-
|
|
1159
|
+
generatingSlideVisible &&
|
|
1161
1160
|
deck.slides.length === 0 &&
|
|
1162
|
-
!showQuestionFlow &&
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1161
|
+
!showQuestionFlow && (
|
|
1162
|
+
<div className="flex min-h-0 flex-1 overflow-auto bg-background p-4 md:p-8">
|
|
1163
|
+
<div className="m-auto w-full max-w-6xl">
|
|
1164
|
+
<GeneratingSlidePreview
|
|
1165
|
+
content={streamedGeneratingSlideContent}
|
|
1166
|
+
aspectRatio={deck.aspectRatio}
|
|
1167
|
+
thumbnail={false}
|
|
1168
|
+
/>
|
|
1169
|
+
</div>
|
|
1170
|
+
</div>
|
|
1171
|
+
)}
|
|
1172
1172
|
|
|
1173
1173
|
{showCurrentSlideEditor && currentSlide && (
|
|
1174
1174
|
<SlideEditor
|