@orangecatai/adgen-canvas 0.0.20 → 0.0.22
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/dist/dev/{chunk-Y6SGUVKW.js → chunk-DG4DHKBY.js} +2 -2
- package/dist/dev/{chunk-ILOOQ6LL.js → chunk-OIMA545L.js} +3 -15
- package/dist/dev/{chunk-ILOOQ6LL.js.map → chunk-OIMA545L.js.map} +2 -2
- package/dist/dev/data/{image-MFQPU4SU.js → image-AWVYCS2V.js} +3 -3
- package/dist/dev/index.css +73 -0
- package/dist/dev/index.css.map +2 -2
- package/dist/dev/index.js +2706 -3385
- package/dist/dev/index.js.map +4 -4
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/{chunk-SDWSFP7L.js → chunk-PJYEU4Z2.js} +1 -1
- package/dist/prod/{chunk-3BUGCS63.js → chunk-X4HZUT4M.js} +3 -3
- package/dist/prod/data/image-YCVSAMH5.js +1 -0
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +183 -426
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/excalidraw/components/AIChatPanel.d.ts +12 -1
- package/dist/types/excalidraw/components/ImageEditToolbar.d.ts +0 -1
- package/dist/types/excalidraw/components/ImageGeneratorPanel.d.ts +16 -2
- package/dist/types/excalidraw/components/ai-chat/AdGenShimmerLayer.d.ts +10 -0
- package/dist/types/excalidraw/components/ai-chat/adGenShimmerStore.d.ts +12 -0
- package/dist/types/excalidraw/components/ai-chat/agentLoop.d.ts +1 -5
- package/dist/types/excalidraw/components/ai-chat/audioUtils.d.ts +0 -5
- package/dist/types/excalidraw/components/ai-chat/canvasTools.d.ts +17 -41
- package/dist/types/excalidraw/components/ai-chat/reviewerAgent.d.ts +20 -10
- package/dist/types/excalidraw/components/auto-resize/AutoResizePanel.d.ts +2 -2
- package/dist/types/excalidraw/components/auto-resize/autoResizeEngine.d.ts +42 -1
- package/dist/types/excalidraw/types.d.ts +37 -19
- package/dist/types/excalidraw/utils/brandContextUtils.d.ts +20 -0
- package/dist/types/excalidraw/utils/imageApi.d.ts +19 -1
- package/package.json +1 -1
- package/dist/prod/data/image-NBDZMG3P.js +0 -1
- package/dist/types/excalidraw/utils/leonardoApiKey.d.ts +0 -1
- /package/dist/dev/{chunk-Y6SGUVKW.js.map → chunk-DG4DHKBY.js.map} +0 -0
- /package/dist/dev/data/{image-MFQPU4SU.js.map → image-AWVYCS2V.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"./chunk-Z5NKEFVG.js";import"./chunk-
|
|
1
|
+
import{a,b,c,d}from"./chunk-Z5NKEFVG.js";import"./chunk-PJYEU4Z2.js";import"./chunk-SRAX5OIU.js";export{a as Commands,b as subsetToBase64,c as subsetToBinary,d as toBase64};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r,c as t}from"./chunk-Z5NKEFVG.js";import"./chunk-
|
|
1
|
+
import{a as r,c as t}from"./chunk-Z5NKEFVG.js";import"./chunk-PJYEU4Z2.js";import"./chunk-SRAX5OIU.js";var s=import.meta.url?new URL(import.meta.url):void 0;typeof window>"u"&&typeof self<"u"&&(self.onmessage=async e=>{switch(e.data.command){case r.Subset:let a=await t(e.data.arrayBuffer,e.data.codePoints);self.postMessage(a,{transfer:[a]});break}});export{s as WorkerUrl};
|
|
@@ -31,7 +31,18 @@ export type AIChatPanelRef = {
|
|
|
31
31
|
export type AIChatPanelProps = {
|
|
32
32
|
isOpen: boolean;
|
|
33
33
|
onClose: () => void;
|
|
34
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Host proxy URL for the chat / agent loop / reviewer OpenRouter calls. The
|
|
36
|
+
* SDK POSTs the OpenRouter request body here; the host injects the API key,
|
|
37
|
+
* gates credits, and streams the response back. Keeps the provider key out of
|
|
38
|
+
* the browser.
|
|
39
|
+
*/
|
|
40
|
+
chatUrl?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Host proxy URL for the agent's generate_image tool. Same contract as
|
|
43
|
+
* `chatUrl`. Keeps the provider key out of the browser.
|
|
44
|
+
*/
|
|
45
|
+
imageGenUrl?: string;
|
|
35
46
|
excalidrawAPI?: ExcalidrawImperativeAPI;
|
|
36
47
|
initialMessages?: ChatMessage[];
|
|
37
48
|
initialSessionId?: string;
|
|
@@ -3,7 +3,6 @@ import type { ExcalidrawImageElement, NonDeletedExcalidrawElement } from "@orang
|
|
|
3
3
|
import type { AppClassProperties } from "../types";
|
|
4
4
|
export interface ImageEditToolbarCallbacks {
|
|
5
5
|
onQuickEdit?: () => void;
|
|
6
|
-
onUpscale?: () => void;
|
|
7
6
|
onRemoveBG?: () => void;
|
|
8
7
|
onCrop?: () => void;
|
|
9
8
|
onDownload?: () => void;
|
|
@@ -12,14 +12,14 @@ export declare const MODEL_CONFIG: {
|
|
|
12
12
|
readonly "nano banana 2": {
|
|
13
13
|
readonly modelId: "google/gemini-3.1-flash-image-preview";
|
|
14
14
|
readonly textOutput: true;
|
|
15
|
-
readonly supportsImageSize:
|
|
15
|
+
readonly supportsImageSize: false;
|
|
16
16
|
readonly supportedResolutions: readonly ["0.5K", "1K", "2K", "4K"];
|
|
17
17
|
readonly supportedRatios: readonly ["21:9", "16:9", "4:3", "3:2", "1:1", "9:16", "3:4", "2:3", "5:4", "4:5", "4:1", "1:4", "8:1", "1:8"];
|
|
18
18
|
};
|
|
19
19
|
readonly "nano banana pro": {
|
|
20
20
|
readonly modelId: "google/gemini-3-pro-image-preview";
|
|
21
21
|
readonly textOutput: true;
|
|
22
|
-
readonly supportsImageSize:
|
|
22
|
+
readonly supportsImageSize: false;
|
|
23
23
|
readonly supportedResolutions: readonly ["1K", "2K", "4K"];
|
|
24
24
|
readonly supportedRatios: readonly ["21:9", "16:9", "4:3", "3:2", "1:1", "9:16", "3:4", "2:3", "5:4", "4:5"];
|
|
25
25
|
};
|
|
@@ -37,6 +37,20 @@ export declare const MODEL_CONFIG: {
|
|
|
37
37
|
readonly supportedResolutions: readonly ["1K", "2K"];
|
|
38
38
|
readonly supportedRatios: readonly ["16:9", "4:3", "3:2", "1:1", "9:16", "3:4", "2:3", "5:4", "4:5"];
|
|
39
39
|
};
|
|
40
|
+
readonly "riverflow 2.5 fast": {
|
|
41
|
+
readonly modelId: "sourceful/riverflow-v2.5-fast";
|
|
42
|
+
readonly textOutput: false;
|
|
43
|
+
readonly supportsImageSize: true;
|
|
44
|
+
readonly supportedResolutions: readonly ["1K", "2K"];
|
|
45
|
+
readonly supportedRatios: readonly ["1:1", "21:9", "16:9", "3:2", "4:3", "5:4", "4:5", "3:4", "2:3", "9:16"];
|
|
46
|
+
};
|
|
47
|
+
readonly "riverflow 2.5 pro": {
|
|
48
|
+
readonly modelId: "sourceful/riverflow-v2.5-pro";
|
|
49
|
+
readonly textOutput: false;
|
|
50
|
+
readonly supportsImageSize: true;
|
|
51
|
+
readonly supportedResolutions: readonly ["1K", "2K", "4K"];
|
|
52
|
+
readonly supportedRatios: readonly ["1:1", "21:9", "16:9", "3:2", "4:3", "5:4", "4:5", "3:4", "2:3", "9:16"];
|
|
53
|
+
};
|
|
40
54
|
};
|
|
41
55
|
export type ModelName = keyof typeof MODEL_CONFIG;
|
|
42
56
|
export declare const MODEL_NAMES: ModelName[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders a shimmer overlay on top of frames that are currently being
|
|
3
|
+
* generated by the AI chat agent (create_frame → generate_image → review).
|
|
4
|
+
*
|
|
5
|
+
* Rendered unconditionally from App.tsx alongside AutoResizeShimmerLayer.
|
|
6
|
+
* Uses useExcalidrawAppState() so it repositions correctly on scroll/zoom.
|
|
7
|
+
* Reads current frame position from scene elements so it follows the frame
|
|
8
|
+
* if the user drags it during generation.
|
|
9
|
+
*/
|
|
10
|
+
export declare const AdGenShimmerLayer: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type AdGenFrameInfo = {
|
|
2
|
+
frameId: string;
|
|
3
|
+
};
|
|
4
|
+
type Listener = () => void;
|
|
5
|
+
export declare const adGenShimmerStore: {
|
|
6
|
+
startGenerating(frameId: string): void;
|
|
7
|
+
stopGenerating(frameId: string): void;
|
|
8
|
+
clear(): void;
|
|
9
|
+
getLoadingFrames(): AdGenFrameInfo[];
|
|
10
|
+
subscribe(fn: Listener): () => void;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -60,10 +60,6 @@ export type AgentResult = {
|
|
|
60
60
|
reply: string;
|
|
61
61
|
toolActions: ToolAction[];
|
|
62
62
|
};
|
|
63
|
-
/**
|
|
64
|
-
* Converts a BrandContext object to a concise system message string.
|
|
65
|
-
*/
|
|
66
|
-
export declare function buildBrandContextMessage(ctx: BrandContext): string;
|
|
67
63
|
export type FileAttachment = {
|
|
68
64
|
name: string;
|
|
69
65
|
type: "image" | "text" | "pdf" | "docx";
|
|
@@ -84,7 +80,7 @@ export declare function runAgentLoop(opts: {
|
|
|
84
80
|
frameScreenshot?: string;
|
|
85
81
|
fileAttachments?: FileAttachment[];
|
|
86
82
|
webSearchEnabled?: boolean;
|
|
87
|
-
|
|
83
|
+
chatUrl: string;
|
|
88
84
|
chatModel?: string;
|
|
89
85
|
agentImageModel?: string;
|
|
90
86
|
toolCtx: ToolExecutionContext;
|
|
@@ -3,8 +3,3 @@
|
|
|
3
3
|
* using the Web Audio API. Mistral Voxtral only accepts mp3 or wav.
|
|
4
4
|
*/
|
|
5
5
|
export declare function blobToWavBase64(blob: Blob): Promise<string>;
|
|
6
|
-
/**
|
|
7
|
-
* Sends a base64-encoded audio string to the OpenRouter Voxtral model for
|
|
8
|
-
* transcription. `format` must be "wav" or "mp3".
|
|
9
|
-
*/
|
|
10
|
-
export declare function transcribeAudio(base64Audio: string, format: string, apiKey: string, voiceModel?: string): Promise<string>;
|
|
@@ -297,7 +297,7 @@ export declare const BANNER_TOOLS: readonly [{
|
|
|
297
297
|
readonly type: "function";
|
|
298
298
|
readonly function: {
|
|
299
299
|
readonly name: "generate_image";
|
|
300
|
-
readonly description: "Generate
|
|
300
|
+
readonly description: "Generate the COMPLETE advertisement as a single AI image and place it into the frame. The image must contain BOTH the visuals AND all copy (headline, subheadline, CTA button, sign-off/brand name) rendered as legible text inside the image — this is the entire ad, not a text-free background. Fill the whole frame (x:0, y:0, width:frameW, height:frameH). Use referenceImageIndex when the user attached an image to use as a subject/style reference. Your prompt must spell on-image text exactly and specify brand colors, typographic style, composition, and dimensions. Do NOT call generate_html_banner afterwards — there is no separate text layer.";
|
|
301
301
|
readonly parameters: {
|
|
302
302
|
readonly type: "object";
|
|
303
303
|
readonly properties: {
|
|
@@ -307,7 +307,7 @@ export declare const BANNER_TOOLS: readonly [{
|
|
|
307
307
|
};
|
|
308
308
|
readonly prompt: {
|
|
309
309
|
readonly type: "string";
|
|
310
|
-
readonly description: "Detailed
|
|
310
|
+
readonly description: "Detailed prompt for the COMPLETE ad: the visual scene PLUS the exact on-image copy (quote headline/subheadline/CTA/sign-off verbatim), brand colors per element, typographic style described in words, composition/layout, and the target dimensions/aspect.";
|
|
311
311
|
};
|
|
312
312
|
readonly x: {
|
|
313
313
|
readonly type: "number";
|
|
@@ -334,27 +334,6 @@ export declare const BANNER_TOOLS: readonly [{
|
|
|
334
334
|
readonly additionalProperties: false;
|
|
335
335
|
};
|
|
336
336
|
};
|
|
337
|
-
}, {
|
|
338
|
-
readonly type: "function";
|
|
339
|
-
readonly function: {
|
|
340
|
-
readonly name: "generate_html_banner";
|
|
341
|
-
readonly description: "Place HTML/CSS text and shape elements into an EXISTING frame on the canvas. Always call create_frame first to get a frameId, then generate_image, then call this with that frameId. frameId is required — this tool does NOT create frames.";
|
|
342
|
-
readonly parameters: {
|
|
343
|
-
readonly type: "object";
|
|
344
|
-
readonly properties: {
|
|
345
|
-
readonly html: {
|
|
346
|
-
readonly type: "string";
|
|
347
|
-
readonly description: "Complete self-contained HTML with inline <style>. All layer elements must use position:absolute with explicit left/top/width/height in px. Root div must have class='canvas'.";
|
|
348
|
-
};
|
|
349
|
-
readonly frameId: {
|
|
350
|
-
readonly type: "string";
|
|
351
|
-
readonly description: "Required. The ID of the frame created by create_frame. Adds HTML elements into this existing frame, preserving existing children like images.";
|
|
352
|
-
};
|
|
353
|
-
};
|
|
354
|
-
readonly required: readonly ["html", "frameId"];
|
|
355
|
-
readonly additionalProperties: false;
|
|
356
|
-
};
|
|
357
|
-
};
|
|
358
337
|
}, {
|
|
359
338
|
readonly type: "function";
|
|
360
339
|
readonly function: {
|
|
@@ -589,23 +568,6 @@ export declare const BANNER_TOOLS: readonly [{
|
|
|
589
568
|
readonly additionalProperties: false;
|
|
590
569
|
};
|
|
591
570
|
};
|
|
592
|
-
}, {
|
|
593
|
-
readonly type: "function";
|
|
594
|
-
readonly function: {
|
|
595
|
-
readonly name: "finalize_ad";
|
|
596
|
-
readonly description: "Call this when ALL elements are placed on the canvas — brand assets, generated images, and the HTML text overlay. Captures a screenshot of the complete frame for review. Do NOT call this before all assets are in place.";
|
|
597
|
-
readonly parameters: {
|
|
598
|
-
readonly type: "object";
|
|
599
|
-
readonly properties: {
|
|
600
|
-
readonly frameId: {
|
|
601
|
-
readonly type: "string";
|
|
602
|
-
readonly description: "ID of the frame to capture for review";
|
|
603
|
-
};
|
|
604
|
-
};
|
|
605
|
-
readonly required: readonly ["frameId"];
|
|
606
|
-
readonly additionalProperties: false;
|
|
607
|
-
};
|
|
608
|
-
};
|
|
609
571
|
}];
|
|
610
572
|
export declare function serializeElements(elements: readonly ExcalidrawElement[]): Record<string, unknown>[];
|
|
611
573
|
export type FrameInfo = {
|
|
@@ -623,7 +585,8 @@ export declare function getFrameContext(api: ExcalidrawImperativeAPI, frameId: s
|
|
|
623
585
|
} | null;
|
|
624
586
|
export type ToolExecutionContext = {
|
|
625
587
|
excalidrawAPI: ExcalidrawImperativeAPI;
|
|
626
|
-
|
|
588
|
+
/** Host proxy URL for the agent's generate_image tool. Key stays server-side. */
|
|
589
|
+
imageGenUrl: string;
|
|
627
590
|
signal?: AbortSignal;
|
|
628
591
|
/** Override OpenRouter model ID for the agent's generate_image tool. */
|
|
629
592
|
agentImageModel?: string;
|
|
@@ -640,6 +603,19 @@ export type ToolExecutionContext = {
|
|
|
640
603
|
brandHeadlineFontName?: string;
|
|
641
604
|
/** Brand body font file name. Sourced from brand DNA. */
|
|
642
605
|
brandBodyFontName?: string;
|
|
606
|
+
/** Data URL of the master brand logo — passed as a visual reference image to the image generation model. */
|
|
607
|
+
brandLogoDataUrl?: string;
|
|
608
|
+
/** Data URL of text rendered in the brand headline font — passed as a visual reference to the image generation model. */
|
|
609
|
+
brandFontPreviewDataUrl?: string;
|
|
610
|
+
/** Data URL of text rendered in the brand body font — passed as a second visual reference to the image generation model. */
|
|
611
|
+
brandBodyFontPreviewDataUrl?: string;
|
|
612
|
+
/**
|
|
613
|
+
* Fetchable URL of the actual headline font file (.ttf/.otf), e.g. a presigned
|
|
614
|
+
* S3 URL. Only consumed by image models that accept a font file as input
|
|
615
|
+
* (Sourceful Riverflow v2+ -> OpenRouter `image_config.font_inputs`). Other
|
|
616
|
+
* models ignore it.
|
|
617
|
+
*/
|
|
618
|
+
brandFontUrl?: string;
|
|
643
619
|
/**
|
|
644
620
|
* Excalidraw fontFamilyId for the brand headline font.
|
|
645
621
|
* When set, ALL text elements (add_text, fill_template_slots headline slots)
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* reviewerAgent.ts
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* Brand Governance Agent — stateless reviewer that runs after the main agent
|
|
5
|
+
* generates a complete ad image (visuals + all copy baked in) and calls
|
|
6
|
+
* finalize_ad. It receives a focused context (the rendered screenshot, frame
|
|
7
|
+
* dimensions, brand guidelines, original user brief) and returns a precise
|
|
8
|
+
* critique covering creative quality AND brand-governance compliance:
|
|
9
|
+
* copy correctness, brand tone, logo usage, claim accuracy, legal mandatories,
|
|
10
|
+
* offer disclaimers, regulatory sensitivity, prohibited language, competitive
|
|
11
|
+
* claims, and data/privacy concerns.
|
|
9
12
|
*
|
|
10
|
-
* The reviewer is a separate LLM call from the main agent loop so it
|
|
11
|
-
*
|
|
13
|
+
* The reviewer is a separate LLM call from the main agent loop so it brings an
|
|
14
|
+
* independent eye to the generated ad. Because the ad is a single image, every
|
|
15
|
+
* fix is applied by regenerating the image with a revised prompt — there is no
|
|
16
|
+
* HTML/CSS layer to patch.
|
|
17
|
+
*
|
|
18
|
+
* @deprecated note (2026-06-17): this reviewer previously audited an HTML text
|
|
19
|
+
* layer composited over a text-free image and emitted CSS-only fixes. That
|
|
20
|
+
* flow is gone — see the image-first agent loop in agentLoop.ts.
|
|
12
21
|
*/
|
|
13
22
|
import type { BrandContext } from "../../types";
|
|
14
23
|
export type ReviewIssue = {
|
|
15
|
-
/** Which design element is affected */
|
|
16
|
-
element: "headline" | "subheadline" | "cta" | "image" | "layout" | "brand";
|
|
24
|
+
/** Which design element or governance dimension is affected */
|
|
25
|
+
element: "headline" | "subheadline" | "cta" | "image" | "layout" | "brand" | "brand_tone" | "logo" | "claim" | "legal" | "disclaimer" | "regulatory" | "prohibited_language" | "competitive_claim" | "privacy";
|
|
17
26
|
/** How bad it is */
|
|
18
27
|
severity: "critical" | "major" | "minor";
|
|
19
28
|
/** What is wrong — one sentence */
|
|
@@ -56,7 +65,8 @@ export declare function runReviewerAgent(opts: {
|
|
|
56
65
|
/** Original user request — first message only, not full conversation history */
|
|
57
66
|
userBrief: string;
|
|
58
67
|
brandContext?: BrandContext;
|
|
59
|
-
|
|
68
|
+
/** Host proxy URL for the reviewer's OpenRouter call. Key stays server-side. */
|
|
69
|
+
chatUrl: string;
|
|
60
70
|
/** OpenRouter model tag. Must be vision-capable. Defaults to minimax/minimax-m3 */
|
|
61
71
|
reviewerModel?: string;
|
|
62
72
|
signal?: AbortSignal;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./AutoResizePanel.scss";
|
|
2
2
|
import type { ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
|
|
3
3
|
import type { AppClassProperties } from "../../types";
|
|
4
|
-
export declare const AutoResizePanel: ({ element, app, onClose, onBeforeAutoResize, onAfterAutoResize, onRunningChange,
|
|
4
|
+
export declare const AutoResizePanel: ({ element, app, onClose, onBeforeAutoResize, onAfterAutoResize, onRunningChange, autoResizeUrl, chatModel, agentImageModel, }: {
|
|
5
5
|
element: NonDeletedExcalidrawElement & ExcalidrawFrameLikeElement;
|
|
6
6
|
app: AppClassProperties;
|
|
7
7
|
onClose: () => void;
|
|
@@ -11,7 +11,7 @@ export declare const AutoResizePanel: ({ element, app, onClose, onBeforeAutoResi
|
|
|
11
11
|
}>;
|
|
12
12
|
onAfterAutoResize?: () => void;
|
|
13
13
|
onRunningChange?: (running: boolean) => void;
|
|
14
|
-
|
|
14
|
+
autoResizeUrl: string;
|
|
15
15
|
chatModel: string;
|
|
16
16
|
agentImageModel?: string;
|
|
17
17
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -69,6 +69,37 @@ export declare function extractFrameInfo(elements: readonly ExcalidrawElement[],
|
|
|
69
69
|
export declare function computeCropLoss(sourceAR: number, targetAR: number): number;
|
|
70
70
|
export declare function needsBackgroundRegeneration(srcW: number, srcH: number, tgtW: number, tgtH: number): boolean;
|
|
71
71
|
export declare function nearestGeminiAspectRatio(w: number, h: number): string;
|
|
72
|
+
/**
|
|
73
|
+
* Resolution dimensions available for each aspect ratio in Gemini 3.1 Flash
|
|
74
|
+
* Image (Nano Banana 2). Maps aspect ratio → resolution level → [width, height].
|
|
75
|
+
* Exported so the Auto Resize panel can build its dimension presets from the
|
|
76
|
+
* exact model-supported sizes instead of duplicating the numbers.
|
|
77
|
+
*/
|
|
78
|
+
export declare const GEMINI_RESOLUTION_TABLE: Record<string, Record<string, [number, number]>>;
|
|
79
|
+
/**
|
|
80
|
+
* Resolution levels offered by the Auto Resize panel.
|
|
81
|
+
* Nano Banana (gemini-2.5-flash-image) and Nano Banana 2 (gemini-3.1-flash-image-preview)
|
|
82
|
+
* both support 0.5K–4K. 0.5K is the fastest/cheapest tier.
|
|
83
|
+
*/
|
|
84
|
+
export declare const AUTO_RESIZE_RESOLUTIONS: readonly ["0.5K", "1K", "2K", "4K"];
|
|
85
|
+
export type AutoResizeResolution = typeof AUTO_RESIZE_RESOLUTIONS[number];
|
|
86
|
+
/**
|
|
87
|
+
* Aspect ratios the Nano Banana 2 / Gemini 3.1 Flash Image model supports,
|
|
88
|
+
* ordered for display (common first, then the ultrawide / extreme-narrow ones).
|
|
89
|
+
* Each carries a human label for the panel.
|
|
90
|
+
*/
|
|
91
|
+
export declare const AUTO_RESIZE_ASPECT_RATIOS: {
|
|
92
|
+
ratio: string;
|
|
93
|
+
desc: string;
|
|
94
|
+
}[];
|
|
95
|
+
/**
|
|
96
|
+
* Concrete pixel dimensions for a given aspect ratio + resolution, straight from
|
|
97
|
+
* the Nano Banana 2 resolution table. Falls back to 1:1 / 1K if unknown.
|
|
98
|
+
*/
|
|
99
|
+
export declare function geminiDimsFor(ratio: string, resolution: string): {
|
|
100
|
+
width: number;
|
|
101
|
+
height: number;
|
|
102
|
+
};
|
|
72
103
|
/**
|
|
73
104
|
* Selects the optimal resolution for a given target dimension and aspect ratio.
|
|
74
105
|
* Chooses the resolution level that is closest to (but preferably >= ) the target size.
|
|
@@ -126,7 +157,7 @@ export declare function runAutoResize(opts: {
|
|
|
126
157
|
sourceFrameId: string;
|
|
127
158
|
targetDimensions: TargetDimension[];
|
|
128
159
|
app: AppClassProperties;
|
|
129
|
-
|
|
160
|
+
autoResizeUrl: string;
|
|
130
161
|
chatModel?: string;
|
|
131
162
|
agentImageModel?: string;
|
|
132
163
|
customFontMap?: Record<string, number>;
|
|
@@ -139,5 +170,15 @@ export declare function runAutoResize(opts: {
|
|
|
139
170
|
signal?: AbortSignal;
|
|
140
171
|
/** Pass the result of preCreateAllFrames() to skip redundant frame creation */
|
|
141
172
|
preCreatedFrameInfos?: PreCreatedFrameInfo[];
|
|
173
|
+
/**
|
|
174
|
+
* Brand assets handed to the image model so the recomposed ad keeps the brand
|
|
175
|
+
* logo, typeface, and (for font-aware models) the real font file. Sourced from
|
|
176
|
+
* `app.state.brandContext` by the panel.
|
|
177
|
+
*/
|
|
178
|
+
brandImages?: {
|
|
179
|
+
logo?: string;
|
|
180
|
+
fontPreview?: string;
|
|
181
|
+
fontUrl?: string;
|
|
182
|
+
};
|
|
142
183
|
}): Promise<DimensionResult[]>;
|
|
143
184
|
export {};
|
|
@@ -503,6 +503,21 @@ export type BrandContext = {
|
|
|
503
503
|
environment?: string;
|
|
504
504
|
negativeSpace?: string;
|
|
505
505
|
};
|
|
506
|
+
/** Data URL of the master brand logo — passed as a visual reference to the image generation model. */
|
|
507
|
+
logoDataUrl?: string;
|
|
508
|
+
/** Data URL of text rendered in the brand headline font — passed as a visual reference to the image generation model. */
|
|
509
|
+
headlineFontPreviewDataUrl?: string;
|
|
510
|
+
/** Data URL of text rendered in the brand body font — passed as a second visual reference alongside the headline preview. */
|
|
511
|
+
bodyFontPreviewDataUrl?: string;
|
|
512
|
+
/**
|
|
513
|
+
* Fetchable URL (e.g. a short-lived presigned S3 URL) of the actual headline
|
|
514
|
+
* font file (.ttf/.otf). Passed to image models that accept a font file as
|
|
515
|
+
* input (Sourceful Riverflow v2+ via OpenRouter `image_config.font_inputs`).
|
|
516
|
+
* Unlike `headlineFontPreviewDataUrl` (a rendered preview image), this is the
|
|
517
|
+
* real font file the provider's servers fetch directly, so it must be a URL
|
|
518
|
+
* reachable without auth cookies — not the private `/api/brand/font` proxy.
|
|
519
|
+
*/
|
|
520
|
+
headlineFontUrl?: string;
|
|
506
521
|
};
|
|
507
522
|
export interface ExcalidrawProps {
|
|
508
523
|
onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
|
|
@@ -566,20 +581,29 @@ export interface ExcalidrawProps {
|
|
|
566
581
|
showDeprecatedFonts?: boolean;
|
|
567
582
|
renderScrollbars?: boolean;
|
|
568
583
|
/**
|
|
569
|
-
*
|
|
570
|
-
*
|
|
584
|
+
* Host proxy URL for OpenRouter image generation (ImageGeneratorPanel,
|
|
585
|
+
* ImageQuickEditPanel). The SDK POSTs the OpenRouter request body here; the
|
|
586
|
+
* host injects the API key and forwards. Keeps the provider key out of the
|
|
587
|
+
* browser.
|
|
571
588
|
*/
|
|
572
|
-
|
|
589
|
+
imageGenUrl?: string;
|
|
573
590
|
/**
|
|
574
|
-
*
|
|
575
|
-
*
|
|
591
|
+
* Brand context (colors, typography, logo, font preview) passed to every
|
|
592
|
+
* image generation surface (ImageGeneratorPanel, ImageQuickEditPanel, and the
|
|
593
|
+
* AI chat agent). When present, the logo and font preview are sent as visual
|
|
594
|
+
* references to the image model.
|
|
576
595
|
*/
|
|
577
|
-
|
|
596
|
+
brandContext?: BrandContext;
|
|
578
597
|
/**
|
|
579
|
-
*
|
|
580
|
-
*
|
|
598
|
+
* Host proxy URL for the auto-resize engine's OpenRouter calls (layout
|
|
599
|
+
* planning, vision tagging, HTML generation, reviewer). Key stays server-side.
|
|
581
600
|
*/
|
|
582
|
-
|
|
601
|
+
autoResizeUrl?: string;
|
|
602
|
+
/**
|
|
603
|
+
* Host proxy URL for the remove.bg toolbar action. The SDK POSTs
|
|
604
|
+
* `{ imageDataUrl }` and receives `{ imageDataUrl }`. Key stays server-side.
|
|
605
|
+
*/
|
|
606
|
+
removeBgUrl?: string;
|
|
583
607
|
/**
|
|
584
608
|
* Called before any image generation (ImageGeneratorPanel, ImageQuickEditPanel,
|
|
585
609
|
* or agent loop generate_image tool). Return `{ allowed: false }` to block.
|
|
@@ -593,16 +617,6 @@ export interface ExcalidrawProps {
|
|
|
593
617
|
* Called after a successful image generation from any panel or agent tool.
|
|
594
618
|
*/
|
|
595
619
|
onAfterImageGen?: () => void;
|
|
596
|
-
/**
|
|
597
|
-
* Called before an upscale is run (deduct credits, check quota).
|
|
598
|
-
* Return `{ allowed: false, error: "..." }` to block the operation.
|
|
599
|
-
*/
|
|
600
|
-
onBeforeUpscale?: () => Promise<{
|
|
601
|
-
allowed: boolean;
|
|
602
|
-
error?: string;
|
|
603
|
-
}>;
|
|
604
|
-
/** Called after a successful upscale. */
|
|
605
|
-
onAfterUpscale?: () => void;
|
|
606
620
|
/**
|
|
607
621
|
* Called before a background removal is run (deduct credits, check quota).
|
|
608
622
|
* Return `{ allowed: false, error: "..." }` to block the operation.
|
|
@@ -809,6 +823,10 @@ export type AppClassProperties = {
|
|
|
809
823
|
onPointerDownEmitter: App["onPointerDownEmitter"];
|
|
810
824
|
lastPointerMoveCoords: App["lastPointerMoveCoords"];
|
|
811
825
|
bindModeHandler: App["bindModeHandler"];
|
|
826
|
+
refresh: App["refresh"];
|
|
827
|
+
refreshEditorInterface: App["refreshEditorInterface"];
|
|
828
|
+
lassoTrail: App["lassoTrail"];
|
|
829
|
+
toggleSidebar: App["toggleSidebar"];
|
|
812
830
|
};
|
|
813
831
|
export type PointerDownState = Readonly<{
|
|
814
832
|
origin: Readonly<{
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { BrandContext } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Converts a BrandContext object to a concise text block describing brand
|
|
4
|
+
* identity guidelines. Used as a system/prompt prefix for both the agent loop
|
|
5
|
+
* and direct image generation panels.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildBrandContextMessage(ctx: BrandContext): string;
|
|
8
|
+
/**
|
|
9
|
+
* Augments a raw user prompt with strong brand asset instructions — identical to
|
|
10
|
+
* the approach used by execGenerateImage in the AI chat agent. Call this in
|
|
11
|
+
* ImageGeneratorPanel and ImageQuickEditPanel before invoking callOpenRouterImageAPI
|
|
12
|
+
* so that direct-generation panels produce the same brand-faithful output as the
|
|
13
|
+
* agent loop.
|
|
14
|
+
*
|
|
15
|
+
* Brand DNA text (colors, visual style, etc.) should be passed separately as
|
|
16
|
+
* `brandImages.brandContextText` in callOpenRouterImageAPI so it's prepended as a
|
|
17
|
+
* block before the prompt. This function only appends the per-asset mandatory
|
|
18
|
+
* instructions that reference the visual attachments by position.
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildImageGenSafePrompt(prompt: string, brandContext: BrandContext): string;
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
export declare function callOpenRouterImageAPI(prompt: string, modelId: string, aspectRatio: string, imageSize: string | null, textOutput: boolean,
|
|
1
|
+
export declare function callOpenRouterImageAPI(prompt: string, modelId: string, aspectRatio: string, imageSize: string | null, textOutput: boolean, imageGenUrl: string, referenceImageDataUrl?: string, signal?: AbortSignal, brandImages?: {
|
|
2
|
+
logo?: string;
|
|
3
|
+
fontPreview?: string;
|
|
4
|
+
/** Optional second font preview (brand body typeface) shown as a reference. */
|
|
5
|
+
fontPreviewBody?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Fetchable URL of the real headline font file (.ttf/.otf). Only Sourceful
|
|
8
|
+
* Riverflow v2+ consumes this — sent via `image_config.font_inputs` so the
|
|
9
|
+
* model renders text in the actual brand typeface (not just a preview img).
|
|
10
|
+
*/
|
|
11
|
+
fontUrl?: string;
|
|
12
|
+
/** Text to render with `fontUrl` for the font_inputs entry. */
|
|
13
|
+
fontText?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Full brand identity context text (colors, typography, visual style, etc.)
|
|
16
|
+
* prepended to the prompt so the model applies brand guidelines to the image.
|
|
17
|
+
*/
|
|
18
|
+
brandContextText?: string;
|
|
19
|
+
}): Promise<string>;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{T as a,U as b,V as c}from"../chunk-3BUGCS63.js";import"../chunk-SDWSFP7L.js";import"../chunk-SRAX5OIU.js";export{c as decodePngMetadata,b as encodePngMetadata,a as getTEXtChunk};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function resolveLeonardoApiKey(propKey?: string): string;
|
|
File without changes
|
|
File without changes
|