@orangecatai/element 0.0.2 → 0.0.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.
Files changed (93) hide show
  1. package/dist/dev/index.js +67 -4
  2. package/dist/dev/index.js.map +2 -2
  3. package/dist/prod/index.js +9 -9
  4. package/dist/types/common/src/constants.d.ts +4 -0
  5. package/dist/types/common/src/keys.d.ts +2 -0
  6. package/dist/types/element/src/Scene.d.ts +1 -1
  7. package/dist/types/element/src/frame.d.ts +5 -5
  8. package/dist/types/element/src/newElement.d.ts +10 -1
  9. package/dist/types/element/src/typeChecks.d.ts +2 -1
  10. package/dist/types/element/src/types.d.ts +17 -2
  11. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +1 -1
  12. package/dist/types/excalidraw/actions/actionCanvas.d.ts +177 -0
  13. package/dist/types/excalidraw/actions/actionClipboard.d.ts +7 -7
  14. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +2 -2
  15. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
  16. package/dist/types/excalidraw/actions/actionElementLink.d.ts +6 -6
  17. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +1 -1
  18. package/dist/types/excalidraw/actions/actionFrame.d.ts +219 -0
  19. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +48 -7
  20. package/dist/types/excalidraw/actions/actionLink.d.ts +3 -3
  21. package/dist/types/excalidraw/actions/actionMenu.d.ts +1 -1
  22. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +4 -4
  23. package/dist/types/excalidraw/actions/actionStyles.d.ts +2 -2
  24. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +4 -4
  25. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +3 -3
  26. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +2 -2
  27. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +4 -4
  28. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +4 -4
  29. package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -8
  30. package/dist/types/excalidraw/actions/index.d.ts +1 -1
  31. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  32. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  33. package/dist/types/excalidraw/components/AIChatPanel.d.ts +176 -0
  34. package/dist/types/excalidraw/components/Actions.d.ts +3 -0
  35. package/dist/types/excalidraw/components/App.d.ts +10 -0
  36. package/dist/types/excalidraw/components/CanvasBackgroundSwatch.d.ts +7 -0
  37. package/dist/types/excalidraw/components/ColorPicker/AdvancedColorPicker.d.ts +8 -0
  38. package/dist/types/excalidraw/components/ColorPicker/colorConversions.d.ts +27 -0
  39. package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
  40. package/dist/types/excalidraw/components/DefaultSidebar.d.ts +1 -1
  41. package/dist/types/excalidraw/components/ElementCanvasButtons.d.ts +1 -1
  42. package/dist/types/excalidraw/components/FrameToolbar.d.ts +1 -1
  43. package/dist/types/excalidraw/components/HintViewer.d.ts +1 -1
  44. package/dist/types/excalidraw/components/ImageEditToolbar.d.ts +15 -0
  45. package/dist/types/excalidraw/components/ImageGeneratorPanel.d.ts +59 -13
  46. package/dist/types/excalidraw/components/ImageQuickEditPanel.d.ts +10 -1
  47. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +2 -2
  48. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +1 -1
  49. package/dist/types/excalidraw/components/Stats/index.d.ts +1 -1
  50. package/dist/types/excalidraw/components/StockImagePanel.d.ts +49 -0
  51. package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +1 -0
  52. package/dist/types/excalidraw/components/ToolButton.d.ts +1 -1
  53. package/dist/types/excalidraw/components/VideoElement.d.ts +9 -0
  54. package/dist/types/excalidraw/components/VideoGeneratorPanel.d.ts +149 -0
  55. package/dist/types/excalidraw/components/ai-chat/AdGenShimmerLayer.d.ts +10 -0
  56. package/dist/types/excalidraw/components/ai-chat/adGenShimmerStore.d.ts +12 -0
  57. package/dist/types/excalidraw/components/ai-chat/agentLoop.d.ts +114 -0
  58. package/dist/types/excalidraw/components/ai-chat/audioUtils.d.ts +5 -0
  59. package/dist/types/excalidraw/components/ai-chat/canvasTools.d.ts +752 -0
  60. package/dist/types/excalidraw/components/ai-chat/htmlToExcalidraw.d.ts +53 -0
  61. package/dist/types/excalidraw/components/ai-chat/openRouterStream.d.ts +50 -0
  62. package/dist/types/excalidraw/components/ai-chat/reviewerAgent.d.ts +74 -0
  63. package/dist/types/excalidraw/components/auto-resize/AutoResizePanel.d.ts +17 -0
  64. package/dist/types/excalidraw/components/auto-resize/AutoResizePanelHost.d.ts +4 -0
  65. package/dist/types/excalidraw/components/auto-resize/AutoResizeShimmerLayer.d.ts +11 -0
  66. package/dist/types/excalidraw/components/auto-resize/autoResizeEngine.d.ts +185 -0
  67. package/dist/types/excalidraw/components/auto-resize/autoResizePanelStore.d.ts +15 -0
  68. package/dist/types/excalidraw/components/auto-resize/autoResizeStore.d.ts +16 -0
  69. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +1 -1
  70. package/dist/types/excalidraw/components/icons.d.ts +3 -0
  71. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +5 -1
  72. package/dist/types/excalidraw/components/template-builder/TemplateBuilderPanelHost.d.ts +4 -0
  73. package/dist/types/excalidraw/components/template-builder/TemplateBuilderTray.d.ts +4 -0
  74. package/dist/types/excalidraw/components/template-builder/slotTypes.d.ts +43 -0
  75. package/dist/types/excalidraw/components/template-builder/templateBuilderStore.d.ts +19 -0
  76. package/dist/types/excalidraw/components/ui/avatar.d.ts +6 -0
  77. package/dist/types/excalidraw/components/ui/button.d.ts +11 -0
  78. package/dist/types/excalidraw/components/ui/chat-container.d.ts +17 -0
  79. package/dist/types/excalidraw/components/ui/code-block.d.ts +16 -0
  80. package/dist/types/excalidraw/components/ui/markdown.d.ts +10 -0
  81. package/dist/types/excalidraw/components/ui/message.d.ts +35 -0
  82. package/dist/types/excalidraw/components/ui/scroll-button.d.ts +10 -0
  83. package/dist/types/excalidraw/data/blob.d.ts +4 -1
  84. package/dist/types/excalidraw/fonts/Fonts.d.ts +17 -0
  85. package/dist/types/excalidraw/index.d.ts +13 -1
  86. package/dist/types/excalidraw/scene/types.d.ts +1 -0
  87. package/dist/types/excalidraw/types.d.ts +286 -4
  88. package/dist/types/excalidraw/utils/brandContextUtils.d.ts +23 -0
  89. package/dist/types/excalidraw/utils/imageApi.d.ts +19 -0
  90. package/dist/types/excalidraw/utils/videoApi.d.ts +30 -0
  91. package/dist/types/utils/src/shape.d.ts +2 -2
  92. package/package.json +2 -2
  93. package/dist/types/excalidraw/utils/geminiApiKey.d.ts +0 -1
@@ -0,0 +1,752 @@
1
+ import type { ExcalidrawElement } from "@orangecatai/element/types";
2
+ import type { ExcalidrawImperativeAPI } from "../../types";
3
+ export declare const CANVAS_TOOLS: readonly [{
4
+ readonly type: "function";
5
+ readonly function: {
6
+ readonly name: "create_frame";
7
+ readonly description: "Create a new frame on the canvas. Frames act as artboards that clip their children. Default size is 512x512.";
8
+ readonly parameters: {
9
+ readonly type: "object";
10
+ readonly properties: {
11
+ readonly width: {
12
+ readonly type: "number";
13
+ readonly description: "Frame width in pixels (default 512)";
14
+ };
15
+ readonly height: {
16
+ readonly type: "number";
17
+ readonly description: "Frame height in pixels (default 512)";
18
+ };
19
+ readonly name: {
20
+ readonly type: "string";
21
+ readonly description: "Optional display name for the frame";
22
+ };
23
+ };
24
+ readonly required: readonly [];
25
+ readonly additionalProperties: false;
26
+ };
27
+ };
28
+ }, {
29
+ readonly type: "function";
30
+ readonly function: {
31
+ readonly name: "add_rectangle";
32
+ readonly description: "Add a filled rectangle inside a frame. Commonly used for solid background fills behind images and text.";
33
+ readonly parameters: {
34
+ readonly type: "object";
35
+ readonly properties: {
36
+ readonly frameId: {
37
+ readonly type: "string";
38
+ readonly description: "ID of the parent frame";
39
+ };
40
+ readonly x: {
41
+ readonly type: "number";
42
+ readonly description: "X position relative to canvas (use the frame's x for full coverage)";
43
+ };
44
+ readonly y: {
45
+ readonly type: "number";
46
+ readonly description: "Y position relative to canvas (use the frame's y for full coverage)";
47
+ };
48
+ readonly width: {
49
+ readonly type: "number";
50
+ readonly description: "Rectangle width in pixels";
51
+ };
52
+ readonly height: {
53
+ readonly type: "number";
54
+ readonly description: "Rectangle height in pixels";
55
+ };
56
+ readonly backgroundColor: {
57
+ readonly type: "string";
58
+ readonly description: "Fill color as hex string e.g. \"#1a1a2e\". Use \"transparent\" for no fill.";
59
+ };
60
+ readonly fillStyle: {
61
+ readonly type: "string";
62
+ readonly enum: readonly ["solid", "hachure", "cross-hatch"];
63
+ readonly description: "Fill style (default \"solid\")";
64
+ };
65
+ readonly strokeColor: {
66
+ readonly type: "string";
67
+ readonly description: "Stroke/border color as hex (default \"transparent\")";
68
+ };
69
+ readonly strokeWidth: {
70
+ readonly type: "number";
71
+ readonly description: "Stroke width in pixels (default 0)";
72
+ };
73
+ readonly opacity: {
74
+ readonly type: "number";
75
+ readonly description: "Opacity 0-100 (default 100)";
76
+ };
77
+ };
78
+ readonly required: readonly ["frameId", "x", "y", "width", "height", "backgroundColor"];
79
+ readonly additionalProperties: false;
80
+ };
81
+ };
82
+ }, {
83
+ readonly type: "function";
84
+ readonly function: {
85
+ readonly name: "add_text";
86
+ readonly description: "Add a text element inside a frame. Use for headlines, subheads, body copy, CTAs etc.";
87
+ readonly parameters: {
88
+ readonly type: "object";
89
+ readonly properties: {
90
+ readonly frameId: {
91
+ readonly type: "string";
92
+ readonly description: "ID of the parent frame";
93
+ };
94
+ readonly x: {
95
+ readonly type: "number";
96
+ readonly description: "X position (canvas coordinates)";
97
+ };
98
+ readonly y: {
99
+ readonly type: "number";
100
+ readonly description: "Y position (canvas coordinates)";
101
+ };
102
+ readonly text: {
103
+ readonly type: "string";
104
+ readonly description: "The text content";
105
+ };
106
+ readonly fontSize: {
107
+ readonly type: "number";
108
+ readonly description: "Font size in pixels (default 20)";
109
+ };
110
+ readonly fontFamily: {
111
+ readonly type: "number";
112
+ readonly enum: readonly [1, 2, 3, 4, 5];
113
+ readonly description: "Font family: 1=Excalifont(hand), 2=Nunito(sans), 3=Comic Shanns(code), 4=Liberation Sans(clean sans), 5=Cascadia(code). Default 2.";
114
+ };
115
+ readonly strokeColor: {
116
+ readonly type: "string";
117
+ readonly description: "Text color as hex string (default \"#000000\")";
118
+ };
119
+ readonly textAlign: {
120
+ readonly type: "string";
121
+ readonly enum: readonly ["left", "center", "right"];
122
+ readonly description: "Horizontal alignment (default left)";
123
+ };
124
+ readonly width: {
125
+ readonly type: "number";
126
+ readonly description: "Optional fixed width for text wrapping";
127
+ };
128
+ };
129
+ readonly required: readonly ["frameId", "x", "y", "text"];
130
+ readonly additionalProperties: false;
131
+ };
132
+ };
133
+ }, {
134
+ readonly type: "function";
135
+ readonly function: {
136
+ readonly name: "generate_image";
137
+ readonly description: "Generate an image using AI (Gemini) from a text prompt and place it inside a frame. Use for hero images, product shots, backgrounds, illustrations etc.";
138
+ readonly parameters: {
139
+ readonly type: "object";
140
+ readonly properties: {
141
+ readonly frameId: {
142
+ readonly type: "string";
143
+ readonly description: "ID of the parent frame to insert the image into";
144
+ };
145
+ readonly prompt: {
146
+ readonly type: "string";
147
+ readonly description: "Detailed image generation prompt describing what to create";
148
+ };
149
+ readonly x: {
150
+ readonly type: "number";
151
+ readonly description: "X position for the image (canvas coordinates)";
152
+ };
153
+ readonly y: {
154
+ readonly type: "number";
155
+ readonly description: "Y position for the image (canvas coordinates)";
156
+ };
157
+ readonly width: {
158
+ readonly type: "number";
159
+ readonly description: "Image width in pixels";
160
+ };
161
+ readonly height: {
162
+ readonly type: "number";
163
+ readonly description: "Image height in pixels";
164
+ };
165
+ };
166
+ readonly required: readonly ["frameId", "prompt", "x", "y", "width", "height"];
167
+ readonly additionalProperties: false;
168
+ };
169
+ };
170
+ }, {
171
+ readonly type: "function";
172
+ readonly function: {
173
+ readonly name: "update_element";
174
+ readonly description: "Update properties of an existing element (move, resize, recolor, change text, etc.)";
175
+ readonly parameters: {
176
+ readonly type: "object";
177
+ readonly properties: {
178
+ readonly elementId: {
179
+ readonly type: "string";
180
+ readonly description: "ID of the element to update";
181
+ };
182
+ readonly x: {
183
+ readonly type: "number";
184
+ readonly description: "New X position";
185
+ };
186
+ readonly y: {
187
+ readonly type: "number";
188
+ readonly description: "New Y position";
189
+ };
190
+ readonly width: {
191
+ readonly type: "number";
192
+ readonly description: "New width";
193
+ };
194
+ readonly height: {
195
+ readonly type: "number";
196
+ readonly description: "New height";
197
+ };
198
+ readonly backgroundColor: {
199
+ readonly type: "string";
200
+ readonly description: "New background/fill color";
201
+ };
202
+ readonly strokeColor: {
203
+ readonly type: "string";
204
+ readonly description: "New stroke/text color";
205
+ };
206
+ readonly opacity: {
207
+ readonly type: "number";
208
+ readonly description: "New opacity 0-100";
209
+ };
210
+ readonly fontSize: {
211
+ readonly type: "number";
212
+ readonly description: "New font size (text elements only)";
213
+ };
214
+ readonly text: {
215
+ readonly type: "string";
216
+ readonly description: "New text content (text elements only)";
217
+ };
218
+ readonly fillStyle: {
219
+ readonly type: "string";
220
+ readonly enum: readonly ["solid", "hachure", "cross-hatch"];
221
+ readonly description: "New fill style";
222
+ };
223
+ };
224
+ readonly required: readonly ["elementId"];
225
+ readonly additionalProperties: false;
226
+ };
227
+ };
228
+ }, {
229
+ readonly type: "function";
230
+ readonly function: {
231
+ readonly name: "delete_element";
232
+ readonly description: "Delete an element from the canvas";
233
+ readonly parameters: {
234
+ readonly type: "object";
235
+ readonly properties: {
236
+ readonly elementId: {
237
+ readonly type: "string";
238
+ readonly description: "ID of the element to delete";
239
+ };
240
+ };
241
+ readonly required: readonly ["elementId"];
242
+ readonly additionalProperties: false;
243
+ };
244
+ };
245
+ }, {
246
+ readonly type: "function";
247
+ readonly function: {
248
+ readonly name: "get_frame_elements";
249
+ readonly description: "Get all child elements inside a frame. Returns their IDs, types, positions, sizes, colors, and text content. Use this to understand the current layout before making changes.";
250
+ readonly parameters: {
251
+ readonly type: "object";
252
+ readonly properties: {
253
+ readonly frameId: {
254
+ readonly type: "string";
255
+ readonly description: "ID of the frame to inspect";
256
+ };
257
+ };
258
+ readonly required: readonly ["frameId"];
259
+ readonly additionalProperties: false;
260
+ };
261
+ };
262
+ }];
263
+ /**
264
+ * Returns the canvas tool definitions for the agent, optionally extending
265
+ * the `add_text` fontFamily enum with custom font IDs.
266
+ *
267
+ * Pass the family IDs registered via `Fonts.registerCustomFont` so the
268
+ * agent knows it can use those numbers in `add_text` calls.
269
+ */
270
+ export declare function getCanvasTools(extraFontIds?: number[]): typeof CANVAS_TOOLS;
271
+ export declare const BANNER_TOOLS: readonly [{
272
+ readonly type: "function";
273
+ readonly function: {
274
+ readonly name: "create_frame";
275
+ readonly description: "Create a new frame on the canvas to act as the root container for your banner. Default size is 512x512. ALWAYS call this FIRST before generating images or HTML.";
276
+ readonly parameters: {
277
+ readonly type: "object";
278
+ readonly properties: {
279
+ readonly width: {
280
+ readonly type: "number";
281
+ readonly description: "Frame width in pixels (default 512)";
282
+ };
283
+ readonly height: {
284
+ readonly type: "number";
285
+ readonly description: "Frame height in pixels (default 512)";
286
+ };
287
+ readonly name: {
288
+ readonly type: "string";
289
+ readonly description: "Optional display name for the frame";
290
+ };
291
+ };
292
+ readonly required: readonly [];
293
+ readonly additionalProperties: false;
294
+ };
295
+ };
296
+ }, {
297
+ readonly type: "function";
298
+ readonly function: {
299
+ readonly name: "generate_image";
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
+ readonly parameters: {
302
+ readonly type: "object";
303
+ readonly properties: {
304
+ readonly frameId: {
305
+ readonly type: "string";
306
+ readonly description: "ID of the parent frame to insert the image into";
307
+ };
308
+ readonly prompt: {
309
+ readonly type: "string";
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
+ };
312
+ readonly x: {
313
+ readonly type: "number";
314
+ readonly description: "X position relative to the frame's top-left corner";
315
+ };
316
+ readonly y: {
317
+ readonly type: "number";
318
+ readonly description: "Y position relative to the frame's top-left corner";
319
+ };
320
+ readonly width: {
321
+ readonly type: "number";
322
+ readonly description: "Image width in pixels";
323
+ };
324
+ readonly height: {
325
+ readonly type: "number";
326
+ readonly description: "Image height in pixels";
327
+ };
328
+ readonly referenceImageIndex: {
329
+ readonly type: "number";
330
+ readonly description: "0-based index of the user's attached image to pass to Gemini as reference. Always use 0 when the user has attached an image.";
331
+ };
332
+ };
333
+ readonly required: readonly ["frameId", "prompt", "x", "y", "width", "height"];
334
+ readonly additionalProperties: false;
335
+ };
336
+ };
337
+ }, {
338
+ readonly type: "function";
339
+ readonly function: {
340
+ readonly name: "get_frame_elements";
341
+ readonly description: "Get all child elements inside a frame. Use when editing an existing banner to understand its current state before replacing.";
342
+ readonly parameters: {
343
+ readonly type: "object";
344
+ readonly properties: {
345
+ readonly frameId: {
346
+ readonly type: "string";
347
+ readonly description: "ID of the frame to inspect";
348
+ };
349
+ };
350
+ readonly required: readonly ["frameId"];
351
+ readonly additionalProperties: false;
352
+ };
353
+ };
354
+ }, {
355
+ readonly type: "function";
356
+ readonly function: {
357
+ readonly name: "update_element";
358
+ readonly description: "Update properties of an existing element. Use for minor targeted fixes after the banner is placed.";
359
+ readonly parameters: {
360
+ readonly type: "object";
361
+ readonly properties: {
362
+ readonly elementId: {
363
+ readonly type: "string";
364
+ };
365
+ readonly x: {
366
+ readonly type: "number";
367
+ };
368
+ readonly y: {
369
+ readonly type: "number";
370
+ };
371
+ readonly width: {
372
+ readonly type: "number";
373
+ };
374
+ readonly height: {
375
+ readonly type: "number";
376
+ };
377
+ readonly backgroundColor: {
378
+ readonly type: "string";
379
+ };
380
+ readonly strokeColor: {
381
+ readonly type: "string";
382
+ };
383
+ readonly opacity: {
384
+ readonly type: "number";
385
+ };
386
+ readonly fontSize: {
387
+ readonly type: "number";
388
+ };
389
+ readonly text: {
390
+ readonly type: "string";
391
+ };
392
+ readonly fillStyle: {
393
+ readonly type: "string";
394
+ readonly enum: readonly ["solid", "hachure", "cross-hatch"];
395
+ };
396
+ };
397
+ readonly required: readonly ["elementId"];
398
+ readonly additionalProperties: false;
399
+ };
400
+ };
401
+ }, {
402
+ readonly type: "function";
403
+ readonly function: {
404
+ readonly name: "delete_element";
405
+ readonly description: "Delete an element from the canvas.";
406
+ readonly parameters: {
407
+ readonly type: "object";
408
+ readonly properties: {
409
+ readonly elementId: {
410
+ readonly type: "string";
411
+ readonly description: "ID of the element to delete";
412
+ };
413
+ };
414
+ readonly required: readonly ["elementId"];
415
+ readonly additionalProperties: false;
416
+ };
417
+ };
418
+ }, {
419
+ readonly type: "function";
420
+ readonly function: {
421
+ readonly name: "list_frames";
422
+ readonly description: "List all frames currently on the canvas. Returns each frame's id, name, width, height, and child element count. Call this when you need to find a frameId and none was provided by the user.";
423
+ readonly parameters: {
424
+ readonly type: "object";
425
+ readonly properties: {};
426
+ readonly required: readonly [];
427
+ readonly additionalProperties: false;
428
+ };
429
+ };
430
+ }, {
431
+ readonly type: "function";
432
+ readonly function: {
433
+ readonly name: "search_brand_assets";
434
+ readonly description: "Search the brand asset bank for existing product shots, logos, and lifestyle images. ALWAYS call this before generate_image to check if a brand asset already exists.";
435
+ readonly parameters: {
436
+ readonly type: "object";
437
+ readonly properties: {
438
+ readonly query: {
439
+ readonly type: "string";
440
+ readonly description: "Search query — name or tag keywords";
441
+ };
442
+ readonly type: {
443
+ readonly type: "string";
444
+ readonly enum: readonly ["product", "logo", "lifestyle", "auxiliary"];
445
+ readonly description: "Optional filter by asset type";
446
+ };
447
+ };
448
+ readonly required: readonly ["query"];
449
+ readonly additionalProperties: false;
450
+ };
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
+ };
469
+ }, {
470
+ readonly type: "function";
471
+ readonly function: {
472
+ readonly name: "list_brand_templates";
473
+ readonly description: "List available brand templates by keyword search across template names, campaign tags, and labels.\n\nMANDATORY SEARCH PROTOCOL — follow exactly, no shortcuts:\n\nATTEMPT 1: Generate TWO sets of 10 keywords each from the user's request:\n - Set A (campaign tag variations): 10 synonyms/abbreviations/phrasings of the campaign topic (e.g. for \"noida datacenter\": [\"datacenter\", \"data center\", \"dc\", \"noida dc\", \"noida datacenter\", \"data centre\", \"server farm\", \"cloud infra\", \"hyperscale\", \"colocation\"])\n - Set B (template name variations): 10 different name keywords the template might have (e.g. [\"noida\", \"datacenter campaign\", \"new datacenter\", \"dc launch\", \"infrastructure\", \"cloud\", \"enterprise\", \"b2b\", \"tech\", \"facility\"])\n Merge all 20 into the keywords array. Call list_brand_templates with all 20.\n\nIF templates returned is empty → ATTEMPT 2 (MANDATORY — do NOT skip):\n Generate a completely DIFFERENT set of 20 keywords — do not reuse any from attempt 1. Think laterally: different synonyms, related industry terms, the city name, brand-adjacent words, seasonal terms. Call list_brand_templates again with the new 20.\n\nONLY after both attempts return empty → tell the user no matching template was found.\n\nIf no search context exists, call with an empty keywords array to list all templates.";
474
+ readonly parameters: {
475
+ readonly type: "object";
476
+ readonly properties: {
477
+ readonly keywords: {
478
+ readonly type: "array";
479
+ readonly items: {
480
+ readonly type: "string";
481
+ };
482
+ readonly description: "Up to 20 keyword variations to search across template names, campaign tags, and labels. All are OR-matched case-insensitively. Generate 10 tag synonyms + 10 name variations from the user's request.";
483
+ };
484
+ };
485
+ readonly required: readonly [];
486
+ readonly additionalProperties: false;
487
+ };
488
+ };
489
+ }, {
490
+ readonly type: "function";
491
+ readonly function: {
492
+ readonly name: "get_template_variant";
493
+ readonly description: "Fetch the full canvas JSON for a specific template by its ID.";
494
+ readonly parameters: {
495
+ readonly type: "object";
496
+ readonly properties: {
497
+ readonly variantId: {
498
+ readonly type: "string";
499
+ readonly description: "The template ID to fetch";
500
+ };
501
+ };
502
+ readonly required: readonly ["variantId"];
503
+ readonly additionalProperties: false;
504
+ };
505
+ };
506
+ }, {
507
+ readonly type: "function";
508
+ readonly function: {
509
+ readonly name: "load_template_into_frame";
510
+ readonly description: "Load a template into an existing frame, replacing its contents with the template elements.";
511
+ readonly parameters: {
512
+ readonly type: "object";
513
+ readonly properties: {
514
+ readonly frameId: {
515
+ readonly type: "string";
516
+ readonly description: "The frame ID to load the template into";
517
+ };
518
+ readonly variantId: {
519
+ readonly type: "string";
520
+ readonly description: "The template ID to load (from list_brand_templates)";
521
+ };
522
+ };
523
+ readonly required: readonly ["frameId", "variantId"];
524
+ readonly additionalProperties: false;
525
+ };
526
+ };
527
+ }, {
528
+ readonly type: "function";
529
+ readonly function: {
530
+ readonly name: "fill_template_slots";
531
+ readonly description: "Fill the slot elements inside a frame with content. Use this after load_template_into_frame to populate slots with actual content.";
532
+ readonly parameters: {
533
+ readonly type: "object";
534
+ readonly properties: {
535
+ readonly frameId: {
536
+ readonly type: "string";
537
+ readonly description: "The frame ID containing slot elements";
538
+ };
539
+ readonly headline: {
540
+ readonly type: "string";
541
+ readonly description: "Text for the headline slot";
542
+ };
543
+ readonly subhead: {
544
+ readonly type: "string";
545
+ readonly description: "Text for the subhead slot";
546
+ };
547
+ readonly cta: {
548
+ readonly type: "string";
549
+ readonly description: "Text for the CTA slot";
550
+ };
551
+ readonly signoff: {
552
+ readonly type: "string";
553
+ readonly description: "Text for the signoff slot";
554
+ };
555
+ readonly product_image_url: {
556
+ readonly type: "string";
557
+ readonly description: "URL for the product image slot (from search_brand_assets blobUrl, or a generated image data URL)";
558
+ };
559
+ readonly product_image_asset_id: {
560
+ readonly type: "string";
561
+ readonly description: "Asset ID for the product image (from search_brand_assets [id:...] field). Required when using a brand asset so the image can be swapped later.";
562
+ };
563
+ readonly logo_url: {
564
+ readonly type: "string";
565
+ readonly description: "URL for the logo slot (from search_brand_assets blobUrl)";
566
+ };
567
+ readonly logo_asset_id: {
568
+ readonly type: "string";
569
+ readonly description: "Asset ID for the logo (from search_brand_assets [id:...] field). Required when using a brand asset.";
570
+ };
571
+ readonly auxiliary_image_url: {
572
+ readonly type: "string";
573
+ readonly description: "URL for the auxiliary image slot";
574
+ };
575
+ readonly auxiliary_image_asset_id: {
576
+ readonly type: "string";
577
+ readonly description: "Asset ID for the auxiliary image (from search_brand_assets [id:...] field). Required when using a brand asset.";
578
+ };
579
+ readonly background_color: {
580
+ readonly type: "string";
581
+ readonly description: "Hex color (e.g. #000000) for the background slot";
582
+ };
583
+ };
584
+ readonly required: readonly ["frameId"];
585
+ readonly additionalProperties: false;
586
+ };
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
+ };
630
+ }];
631
+ export declare function serializeElements(elements: readonly ExcalidrawElement[]): Record<string, unknown>[];
632
+ export type FrameInfo = {
633
+ id: string;
634
+ name: string;
635
+ width: number;
636
+ height: number;
637
+ childCount: number;
638
+ };
639
+ export declare function listFrames(api: ExcalidrawImperativeAPI): FrameInfo[];
640
+ export declare function captureFrameScreenshot(api: ExcalidrawImperativeAPI, frameId: string): Promise<string | null>;
641
+ export declare function getFrameContext(api: ExcalidrawImperativeAPI, frameId: string): {
642
+ serialized: string;
643
+ frameInfo: FrameInfo;
644
+ } | null;
645
+ export type ToolExecutionContext = {
646
+ excalidrawAPI: ExcalidrawImperativeAPI;
647
+ /** Host proxy URL for the agent's generate_image tool. Key stays server-side. */
648
+ imageGenUrl: string;
649
+ signal?: AbortSignal;
650
+ /** Override OpenRouter model ID for the agent's generate_image tool. */
651
+ agentImageModel?: string;
652
+ /**
653
+ * Maps lowercase brand font-family names to their registered Excalidraw
654
+ * fontFamilyIds. Built from BrandContext.typography in runAgentLoop and
655
+ * used by the HTML parser to preserve brand fonts in text elements.
656
+ */
657
+ customFontMap?: Record<string, number>;
658
+ /**
659
+ * Brand headline font file name (e.g. "Avenir-Heavy.otf"). Sourced from brand DNA.
660
+ * Passed to generate_image as style context so the AI knows the brand typography.
661
+ */
662
+ brandHeadlineFontName?: string;
663
+ /** Brand body font file name. Sourced from brand DNA. */
664
+ brandBodyFontName?: string;
665
+ /** Data URL of the master brand logo — passed as a visual reference image to the image generation model. */
666
+ brandLogoDataUrl?: string;
667
+ /** Data URL of text rendered in the brand headline font — passed as a visual reference to the image generation model. */
668
+ brandFontPreviewDataUrl?: string;
669
+ /** Data URL of text rendered in the brand body font — passed as a second visual reference to the image generation model. */
670
+ brandBodyFontPreviewDataUrl?: string;
671
+ /**
672
+ * Fetchable URL of the actual headline font file (.ttf/.otf), e.g. a presigned
673
+ * S3 URL. Only consumed by image models that accept a font file as input
674
+ * (Sourceful Riverflow v2+ -> OpenRouter `image_config.font_inputs`). Other
675
+ * models ignore it.
676
+ */
677
+ brandFontUrl?: string;
678
+ /**
679
+ * Excalidraw fontFamilyId for the brand headline font.
680
+ * When set, ALL text elements (add_text, fill_template_slots headline slots)
681
+ * use this font. Falls back to brandBodyFontId, then Excalidraw default.
682
+ */
683
+ brandHeadlineFontId?: number;
684
+ /**
685
+ * Excalidraw fontFamilyId for the brand body font.
686
+ * When set, ALL text elements use this font — never a built-in fallback
687
+ * unless the font failed to load.
688
+ */
689
+ brandBodyFontId?: number;
690
+ /**
691
+ * Image file attachments the user uploaded in the current chat turn.
692
+ * Indexed 0-based in the order they were attached.
693
+ * Used by place_attachment (direct placement) and generate_image (as Gemini reference).
694
+ */
695
+ fileAttachments?: Array<{
696
+ name: string;
697
+ dataUrl?: string;
698
+ }>;
699
+ onSearchBrandAssets?: (query: string, type?: string) => Promise<Array<{
700
+ id: string;
701
+ name: string;
702
+ tags: string[];
703
+ assetType: string;
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;
714
+ }>>;
715
+ onListBrandTemplates?: (keywords?: string[]) => Promise<Array<{
716
+ id: string;
717
+ name: string;
718
+ campaignTag?: string;
719
+ label?: string;
720
+ width?: number;
721
+ height?: number;
722
+ thumbnailBlobUrl?: string;
723
+ thumbnailDataUrl?: string;
724
+ }>>;
725
+ onGetTemplateVariant?: (variantId: string) => Promise<{
726
+ canvasJson: string;
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
+ }>;
738
+ /**
739
+ * Internal cache: populated by execGetTemplateVariant so that
740
+ * execLoadTemplateIntoFrame can reuse the already-fetched JSON without a
741
+ * second round-trip. Avoids the "double fetch → silent {} fallback → crash"
742
+ * failure mode for private Vercel Blob URLs.
743
+ */
744
+ _templateJsonCache?: Map<string, string>;
745
+ };
746
+ export type ToolResult = {
747
+ success: boolean;
748
+ data?: Record<string, unknown>;
749
+ error?: string;
750
+ statusMessage: string;
751
+ };
752
+ export declare function executeCanvasTool(toolName: string, rawArgs: string, ctx: ToolExecutionContext): Promise<ToolResult>;