@orangecatai/adgen-canvas 0.0.22 → 0.0.23

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.
@@ -1 +1 @@
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
+ import{a,b,c,d}from"./chunk-Z5NKEFVG.js";import"./chunk-GOHSI4TL.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-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};
1
+ import{a as r,c as t}from"./chunk-Z5NKEFVG.js";import"./chunk-GOHSI4TL.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};
@@ -115,6 +115,15 @@ export type AIChatPanelProps = {
115
115
  tags: string[];
116
116
  assetType: string;
117
117
  blobUrl: string;
118
+ previewDataUrl?: string;
119
+ }>>;
120
+ onSearchAdCreatives?: (query: string) => Promise<Array<{
121
+ id: string;
122
+ name: string;
123
+ tags: string[];
124
+ mimeType: string;
125
+ blobUrl: string;
126
+ previewDataUrl?: string;
118
127
  }>>;
119
128
  onListBrandTemplates?: (keywords?: string[]) => Promise<Array<{
120
129
  id: string;
@@ -124,10 +133,35 @@ export type AIChatPanelProps = {
124
133
  width?: number;
125
134
  height?: number;
126
135
  thumbnailBlobUrl?: string;
136
+ thumbnailDataUrl?: string;
127
137
  }>>;
128
138
  onGetTemplateVariant?: (variantId: string) => Promise<{
129
139
  canvasJson: string;
130
140
  }>;
141
+ /**
142
+ * Searches brand assets, ad creatives, and templates by keywords, returning
143
+ * top 3 matches with base64 preview images. Used by the visual agent's
144
+ * `find_brand_asset` tool and the @mention autocomplete.
145
+ */
146
+ onFindBrandAssets?: (type: "image-asset" | "ad-creative" | "template", keywords: string[]) => Promise<{
147
+ results: Array<{
148
+ id: string;
149
+ name: string;
150
+ tags?: string[];
151
+ width?: number | null;
152
+ height?: number | null;
153
+ previewDataUrl: string;
154
+ }>;
155
+ }>;
156
+ /**
157
+ * Called when user types after `@` in the chat input. Should return a
158
+ * lightweight list of matching items (no base64 — previews fetched on pick).
159
+ */
160
+ onMentionSearch?: (query: string) => Promise<Array<{
161
+ id: string;
162
+ type: "image-asset" | "ad-creative" | "template";
163
+ name: string;
164
+ }>>;
131
165
  /**
132
166
  * OpenRouter model tag for the reviewer agent. Must be vision-capable.
133
167
  * Defaults to the same model as chatModel.
@@ -449,6 +449,23 @@ export declare const BANNER_TOOLS: readonly [{
449
449
  readonly additionalProperties: false;
450
450
  };
451
451
  };
452
+ }, {
453
+ readonly type: "function";
454
+ readonly function: {
455
+ readonly name: "search_ad_creatives";
456
+ readonly description: "Search uploaded ad creatives (past static ads) by name or tag keywords. Returns top 3 matches with visual previews. Use this to find reference ads for inspiration or remixing.";
457
+ readonly parameters: {
458
+ readonly type: "object";
459
+ readonly properties: {
460
+ readonly query: {
461
+ readonly type: "string";
462
+ readonly description: "Search query — name or tag keywords";
463
+ };
464
+ };
465
+ readonly required: readonly ["query"];
466
+ readonly additionalProperties: false;
467
+ };
468
+ };
452
469
  }, {
453
470
  readonly type: "function";
454
471
  readonly function: {
@@ -568,6 +585,48 @@ export declare const BANNER_TOOLS: readonly [{
568
585
  readonly additionalProperties: false;
569
586
  };
570
587
  };
588
+ }, {
589
+ readonly type: "function";
590
+ readonly function: {
591
+ readonly name: "place_brand_asset";
592
+ readonly description: "Place a brand image asset or ad creative directly into a frame as an image element. Use after search_brand_assets or search_ad_creatives to insert the found asset. Maintains the asset's aspect ratio inside the frame.";
593
+ readonly parameters: {
594
+ readonly type: "object";
595
+ readonly properties: {
596
+ readonly frameId: {
597
+ readonly type: "string";
598
+ readonly description: "The frame to place the asset in";
599
+ };
600
+ readonly assetId: {
601
+ readonly type: "string";
602
+ readonly description: "Asset ID from search_brand_assets or search_ad_creatives [id:...] field";
603
+ };
604
+ readonly assetType: {
605
+ readonly type: "string";
606
+ readonly enum: readonly ["image-asset", "ad-creative"];
607
+ readonly description: "Type of asset — defaults to image-asset";
608
+ };
609
+ readonly x: {
610
+ readonly type: "number";
611
+ readonly description: "X offset from frame left edge (optional, centers by default)";
612
+ };
613
+ readonly y: {
614
+ readonly type: "number";
615
+ readonly description: "Y offset from frame top edge (optional, centers by default)";
616
+ };
617
+ readonly width: {
618
+ readonly type: "number";
619
+ readonly description: "Width of placed image (optional, auto-fits to frame by default)";
620
+ };
621
+ readonly height: {
622
+ readonly type: "number";
623
+ readonly description: "Height of placed image (optional, auto-fits to frame by default)";
624
+ };
625
+ };
626
+ readonly required: readonly ["frameId", "assetId"];
627
+ readonly additionalProperties: false;
628
+ };
629
+ };
571
630
  }];
572
631
  export declare function serializeElements(elements: readonly ExcalidrawElement[]): Record<string, unknown>[];
573
632
  export type FrameInfo = {
@@ -643,6 +702,15 @@ export type ToolExecutionContext = {
643
702
  tags: string[];
644
703
  assetType: string;
645
704
  blobUrl: string;
705
+ previewDataUrl?: string;
706
+ }>>;
707
+ onSearchAdCreatives?: (query: string) => Promise<Array<{
708
+ id: string;
709
+ name: string;
710
+ tags: string[];
711
+ mimeType: string;
712
+ blobUrl: string;
713
+ previewDataUrl?: string;
646
714
  }>>;
647
715
  onListBrandTemplates?: (keywords?: string[]) => Promise<Array<{
648
716
  id: string;
@@ -652,10 +720,21 @@ export type ToolExecutionContext = {
652
720
  width?: number;
653
721
  height?: number;
654
722
  thumbnailBlobUrl?: string;
723
+ thumbnailDataUrl?: string;
655
724
  }>>;
656
725
  onGetTemplateVariant?: (variantId: string) => Promise<{
657
726
  canvasJson: string;
658
727
  }>;
728
+ onFindBrandAssets?: (type: "image-asset" | "ad-creative" | "template", keywords: string[]) => Promise<{
729
+ results: Array<{
730
+ id: string;
731
+ name: string;
732
+ tags?: string[];
733
+ width?: number | null;
734
+ height?: number | null;
735
+ previewDataUrl: string;
736
+ }>;
737
+ }>;
659
738
  /**
660
739
  * Internal cache: populated by execGetTemplateVariant so that
661
740
  * execLoadTemplateIntoFrame can reuse the already-fetched JSON without a
@@ -179,6 +179,7 @@ export declare function runAutoResize(opts: {
179
179
  logo?: string;
180
180
  fontPreview?: string;
181
181
  fontUrl?: string;
182
+ name?: string;
182
183
  };
183
184
  }): Promise<DimensionResult[]>;
184
185
  export {};
@@ -14,6 +14,7 @@ export declare const Excalidraw: React.MemoExoticComponent<(props: ExcalidrawPro
14
14
  export { getSceneVersion, hashElementsVersion, hashString, getNonDeletedElements, } from "@orangecatai/element";
15
15
  export { getTextFromElements } from "@orangecatai/element";
16
16
  export { isInvisiblySmallElement } from "@orangecatai/element";
17
+ export { newImageElement, newTextElement, newFrameElement, } from "@orangecatai/element";
17
18
  export { defaultLang, useI18n, languages } from "./i18n";
18
19
  export { restoreAppState, restoreElement, restoreElements, restoreLibraryItems, } from "./data/restore";
19
20
  export { reconcileElements } from "./data/reconcile";
@@ -454,6 +454,8 @@ export type CustomFontSpec = {
454
454
  * When provided, the AI agent uses these guidelines when creating ads.
455
455
  */
456
456
  export type BrandContext = {
457
+ /** Brand name — injected as a system-level constraint so the model stays on-brand. */
458
+ name?: string;
457
459
  colors?: {
458
460
  primary?: string;
459
461
  secondary?: string;
@@ -722,6 +724,21 @@ export interface ExcalidrawProps {
722
724
  onGetTemplateVariant?: (templateId: string) => Promise<{
723
725
  canvasJson: string;
724
726
  }>;
727
+ /**
728
+ * Search brand image assets, ad creatives, or templates by keywords and
729
+ * return top 3 matches with base64 preview images. Used by the agent's
730
+ * `find_brand_asset` tool.
731
+ */
732
+ onFindBrandAssets?: (type: "image-asset" | "ad-creative" | "template", keywords: string[]) => Promise<{
733
+ results: Array<{
734
+ id: string;
735
+ name: string;
736
+ tags?: string[];
737
+ width?: number | null;
738
+ height?: number | null;
739
+ previewDataUrl: string;
740
+ }>;
741
+ }>;
725
742
  }
726
743
  export type SceneData = {
727
744
  elements?: ImportedDataState["elements"];
@@ -17,4 +17,7 @@ export declare function buildBrandContextMessage(ctx: BrandContext): string;
17
17
  * block before the prompt. This function only appends the per-asset mandatory
18
18
  * instructions that reference the visual attachments by position.
19
19
  */
20
- export declare function buildImageGenSafePrompt(prompt: string, brandContext: BrandContext): string;
20
+ export declare function buildImageGenSafePrompt(prompt: string, brandContext: BrandContext, dimensions?: {
21
+ width: number;
22
+ height: number;
23
+ }): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orangecatai/adgen-canvas",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "type": "module",
5
5
  "types": "./dist/types/excalidraw/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -1 +0,0 @@
1
- import{T as a,U as b,V as c}from"../chunk-X4HZUT4M.js";import"../chunk-PJYEU4Z2.js";import"../chunk-SRAX5OIU.js";export{c as decodePngMetadata,b as encodePngMetadata,a as getTEXtChunk};