@orangecatai/element 0.0.1 → 0.0.3

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 (127) hide show
  1. package/README.md +1 -1
  2. package/dist/dev/index.js +42 -3
  3. package/dist/dev/index.js.map +2 -2
  4. package/dist/prod/index.js +1 -1
  5. package/dist/types/common/src/keys.d.ts +2 -0
  6. package/dist/types/element/src/arrows/focus.d.ts +1 -1
  7. package/dist/types/element/src/binding.d.ts +3 -3
  8. package/dist/types/element/src/bounds.d.ts +1 -1
  9. package/dist/types/element/src/collision.d.ts +1 -1
  10. package/dist/types/element/src/delta.d.ts +2 -2
  11. package/dist/types/element/src/dragElements.d.ts +1 -1
  12. package/dist/types/element/src/duplicate.d.ts +1 -1
  13. package/dist/types/element/src/embeddable.d.ts +1 -1
  14. package/dist/types/element/src/flowchart.d.ts +1 -1
  15. package/dist/types/element/src/frame.d.ts +4 -4
  16. package/dist/types/element/src/groups.d.ts +1 -1
  17. package/dist/types/element/src/renderElement.d.ts +1 -1
  18. package/dist/types/element/src/selection.d.ts +1 -1
  19. package/dist/types/element/src/shape.d.ts +2 -2
  20. package/dist/types/element/src/store.d.ts +2 -2
  21. package/dist/types/element/src/textElement.d.ts +1 -1
  22. package/dist/types/element/src/transform.d.ts +1 -1
  23. package/dist/types/element/src/utils.d.ts +1 -1
  24. package/dist/types/element/src/zindex.d.ts +1 -1
  25. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +1 -1
  26. package/dist/types/excalidraw/actions/actionCanvas.d.ts +184 -7
  27. package/dist/types/excalidraw/actions/actionClipboard.d.ts +7 -7
  28. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +2 -2
  29. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
  30. package/dist/types/excalidraw/actions/actionElementLink.d.ts +6 -6
  31. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +1 -1
  32. package/dist/types/excalidraw/actions/actionExport.d.ts +9 -9
  33. package/dist/types/excalidraw/actions/actionFrame.d.ts +178 -0
  34. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +7 -7
  35. package/dist/types/excalidraw/actions/actionLink.d.ts +3 -3
  36. package/dist/types/excalidraw/actions/actionMenu.d.ts +1 -1
  37. package/dist/types/excalidraw/actions/actionProperties.d.ts +1 -1
  38. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +4 -4
  39. package/dist/types/excalidraw/actions/actionStyles.d.ts +2 -2
  40. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +4 -4
  41. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +3 -3
  42. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +2 -2
  43. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +4 -4
  44. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +4 -4
  45. package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -8
  46. package/dist/types/excalidraw/actions/index.d.ts +1 -1
  47. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  48. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  49. package/dist/types/excalidraw/appState.d.ts +4 -4
  50. package/dist/types/excalidraw/components/AIChatPanel.d.ts +114 -0
  51. package/dist/types/excalidraw/components/Actions.d.ts +4 -1
  52. package/dist/types/excalidraw/components/App.d.ts +13 -2
  53. package/dist/types/excalidraw/components/CanvasBackgroundSwatch.d.ts +7 -0
  54. package/dist/types/excalidraw/components/ColorPicker/AdvancedColorPicker.d.ts +8 -0
  55. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +2 -2
  56. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +1 -1
  57. package/dist/types/excalidraw/components/ColorPicker/colorConversions.d.ts +27 -0
  58. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +1 -1
  59. package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
  60. package/dist/types/excalidraw/components/DefaultSidebar.d.ts +2 -2
  61. package/dist/types/excalidraw/components/ElementCanvasButtons.d.ts +1 -1
  62. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +2 -2
  63. package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
  64. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +1 -1
  65. package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +1 -1
  66. package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +1 -1
  67. package/dist/types/excalidraw/components/FrameToolbar.d.ts +1 -1
  68. package/dist/types/excalidraw/components/HintViewer.d.ts +1 -1
  69. package/dist/types/excalidraw/components/ImageEditToolbar.d.ts +16 -0
  70. package/dist/types/excalidraw/components/ImageExportDialog.d.ts +1 -1
  71. package/dist/types/excalidraw/components/ImageGeneratorPanel.d.ts +43 -0
  72. package/dist/types/excalidraw/components/ImageQuickEditPanel.d.ts +16 -0
  73. package/dist/types/excalidraw/components/JSONExportDialog.d.ts +1 -1
  74. package/dist/types/excalidraw/components/LayerUI.d.ts +1 -1
  75. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +2 -2
  76. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -2
  77. package/dist/types/excalidraw/components/Stats/FontSize.d.ts +1 -1
  78. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +1 -1
  79. package/dist/types/excalidraw/components/Stats/MultiFontSize.d.ts +1 -1
  80. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +1 -1
  81. package/dist/types/excalidraw/components/Stats/index.d.ts +1 -1
  82. package/dist/types/excalidraw/components/TTDDialog/types.d.ts +2 -2
  83. package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +1 -0
  84. package/dist/types/excalidraw/components/ToolButton.d.ts +1 -1
  85. package/dist/types/excalidraw/components/ai-chat/agentLoop.d.ts +112 -0
  86. package/dist/types/excalidraw/components/ai-chat/audioUtils.d.ts +10 -0
  87. package/dist/types/excalidraw/components/ai-chat/canvasTools.d.ts +685 -0
  88. package/dist/types/excalidraw/components/ai-chat/htmlToExcalidraw.d.ts +53 -0
  89. package/dist/types/excalidraw/components/ai-chat/openRouterStream.d.ts +50 -0
  90. package/dist/types/excalidraw/components/ai-chat/reviewerAgent.d.ts +64 -0
  91. package/dist/types/excalidraw/components/auto-resize/AutoResizePanel.d.ts +17 -0
  92. package/dist/types/excalidraw/components/auto-resize/AutoResizePanelHost.d.ts +4 -0
  93. package/dist/types/excalidraw/components/auto-resize/AutoResizeShimmerLayer.d.ts +11 -0
  94. package/dist/types/excalidraw/components/auto-resize/autoResizeEngine.d.ts +144 -0
  95. package/dist/types/excalidraw/components/auto-resize/autoResizePanelStore.d.ts +15 -0
  96. package/dist/types/excalidraw/components/auto-resize/autoResizeStore.d.ts +16 -0
  97. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +1 -1
  98. package/dist/types/excalidraw/components/icons.d.ts +1 -0
  99. package/dist/types/excalidraw/components/image-generation/pendingGenerations.d.ts +30 -0
  100. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +1 -1
  101. package/dist/types/excalidraw/components/template-builder/TemplateBuilderPanelHost.d.ts +4 -0
  102. package/dist/types/excalidraw/components/template-builder/TemplateBuilderTray.d.ts +4 -0
  103. package/dist/types/excalidraw/components/template-builder/slotTypes.d.ts +43 -0
  104. package/dist/types/excalidraw/components/template-builder/templateBuilderStore.d.ts +19 -0
  105. package/dist/types/excalidraw/components/ui/avatar.d.ts +6 -0
  106. package/dist/types/excalidraw/components/ui/button.d.ts +11 -0
  107. package/dist/types/excalidraw/components/ui/chat-container.d.ts +17 -0
  108. package/dist/types/excalidraw/components/ui/code-block.d.ts +16 -0
  109. package/dist/types/excalidraw/components/ui/markdown.d.ts +10 -0
  110. package/dist/types/excalidraw/components/ui/message.d.ts +35 -0
  111. package/dist/types/excalidraw/components/ui/prompt-input.d.ts +28 -0
  112. package/dist/types/excalidraw/components/ui/scroll-button.d.ts +10 -0
  113. package/dist/types/excalidraw/components/ui/textarea.d.ts +3 -0
  114. package/dist/types/excalidraw/components/ui/tooltip.d.ts +7 -0
  115. package/dist/types/excalidraw/data/blob.d.ts +19 -17
  116. package/dist/types/excalidraw/data/json.d.ts +8 -8
  117. package/dist/types/excalidraw/data/library.d.ts +1 -1
  118. package/dist/types/excalidraw/fonts/Fonts.d.ts +19 -2
  119. package/dist/types/excalidraw/i18n.d.ts +1 -1
  120. package/dist/types/excalidraw/index.d.ts +9 -0
  121. package/dist/types/excalidraw/lib/utils.d.ts +2 -0
  122. package/dist/types/excalidraw/types.d.ts +229 -0
  123. package/dist/types/excalidraw/utils/geminiApiKey.d.ts +1 -0
  124. package/dist/types/excalidraw/utils/leonardoApiKey.d.ts +1 -0
  125. package/dist/types/excalidraw/utils/openRouterApiKey.d.ts +1 -0
  126. package/dist/types/excalidraw/utils/removeBgApiKey.d.ts +1 -0
  127. package/package.json +6 -6
@@ -0,0 +1,685 @@
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 an image using AI (Gemini) and place it onto the canvas. Always call this for any photo or image content — even when the user has attached a reference image. The attached image is passed to Gemini as visual reference; Gemini generates the final output. Use referenceImageIndex to tell Gemini which user attachment to reference. IMPORTANT: your prompt must describe a purely visual scene — NO text, NO typography, NO words, NO captions, NO watermarks. All copy is handled by the HTML layer. A 'no text' safety suffix will be auto-appended, but you must also describe composition clearly (e.g. which side should be left open/empty for the HTML text).";
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 generation prompt. When using a reference image, describe what you want Gemini to produce — e.g. 'use this building as the subject, wide cinematic crop with open sky on the left for text overlay'.";
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: "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
+ }, {
359
+ readonly type: "function";
360
+ readonly function: {
361
+ readonly name: "get_frame_elements";
362
+ readonly description: "Get all child elements inside a frame. Use when editing an existing banner to understand its current state before replacing.";
363
+ readonly parameters: {
364
+ readonly type: "object";
365
+ readonly properties: {
366
+ readonly frameId: {
367
+ readonly type: "string";
368
+ readonly description: "ID of the frame to inspect";
369
+ };
370
+ };
371
+ readonly required: readonly ["frameId"];
372
+ readonly additionalProperties: false;
373
+ };
374
+ };
375
+ }, {
376
+ readonly type: "function";
377
+ readonly function: {
378
+ readonly name: "update_element";
379
+ readonly description: "Update properties of an existing element. Use for minor targeted fixes after the banner is placed.";
380
+ readonly parameters: {
381
+ readonly type: "object";
382
+ readonly properties: {
383
+ readonly elementId: {
384
+ readonly type: "string";
385
+ };
386
+ readonly x: {
387
+ readonly type: "number";
388
+ };
389
+ readonly y: {
390
+ readonly type: "number";
391
+ };
392
+ readonly width: {
393
+ readonly type: "number";
394
+ };
395
+ readonly height: {
396
+ readonly type: "number";
397
+ };
398
+ readonly backgroundColor: {
399
+ readonly type: "string";
400
+ };
401
+ readonly strokeColor: {
402
+ readonly type: "string";
403
+ };
404
+ readonly opacity: {
405
+ readonly type: "number";
406
+ };
407
+ readonly fontSize: {
408
+ readonly type: "number";
409
+ };
410
+ readonly text: {
411
+ readonly type: "string";
412
+ };
413
+ readonly fillStyle: {
414
+ readonly type: "string";
415
+ readonly enum: readonly ["solid", "hachure", "cross-hatch"];
416
+ };
417
+ };
418
+ readonly required: readonly ["elementId"];
419
+ readonly additionalProperties: false;
420
+ };
421
+ };
422
+ }, {
423
+ readonly type: "function";
424
+ readonly function: {
425
+ readonly name: "delete_element";
426
+ readonly description: "Delete an element from the canvas.";
427
+ readonly parameters: {
428
+ readonly type: "object";
429
+ readonly properties: {
430
+ readonly elementId: {
431
+ readonly type: "string";
432
+ readonly description: "ID of the element to delete";
433
+ };
434
+ };
435
+ readonly required: readonly ["elementId"];
436
+ readonly additionalProperties: false;
437
+ };
438
+ };
439
+ }, {
440
+ readonly type: "function";
441
+ readonly function: {
442
+ readonly name: "search_brand_assets";
443
+ 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.";
444
+ readonly parameters: {
445
+ readonly type: "object";
446
+ readonly properties: {
447
+ readonly query: {
448
+ readonly type: "string";
449
+ readonly description: "Search query — name or tag keywords";
450
+ };
451
+ readonly type: {
452
+ readonly type: "string";
453
+ readonly enum: readonly ["product", "logo", "lifestyle", "auxiliary"];
454
+ readonly description: "Optional filter by asset type";
455
+ };
456
+ };
457
+ readonly required: readonly ["query"];
458
+ readonly additionalProperties: false;
459
+ };
460
+ };
461
+ }, {
462
+ readonly type: "function";
463
+ readonly function: {
464
+ readonly name: "list_brand_templates";
465
+ 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.";
466
+ readonly parameters: {
467
+ readonly type: "object";
468
+ readonly properties: {
469
+ readonly keywords: {
470
+ readonly type: "array";
471
+ readonly items: {
472
+ readonly type: "string";
473
+ };
474
+ 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.";
475
+ };
476
+ };
477
+ readonly required: readonly [];
478
+ readonly additionalProperties: false;
479
+ };
480
+ };
481
+ }, {
482
+ readonly type: "function";
483
+ readonly function: {
484
+ readonly name: "get_template_variant";
485
+ readonly description: "Fetch the full canvas JSON for a specific template by its ID.";
486
+ readonly parameters: {
487
+ readonly type: "object";
488
+ readonly properties: {
489
+ readonly variantId: {
490
+ readonly type: "string";
491
+ readonly description: "The template ID to fetch";
492
+ };
493
+ };
494
+ readonly required: readonly ["variantId"];
495
+ readonly additionalProperties: false;
496
+ };
497
+ };
498
+ }, {
499
+ readonly type: "function";
500
+ readonly function: {
501
+ readonly name: "load_template_into_frame";
502
+ readonly description: "Load a template into an existing frame, replacing its contents with the template elements.";
503
+ readonly parameters: {
504
+ readonly type: "object";
505
+ readonly properties: {
506
+ readonly frameId: {
507
+ readonly type: "string";
508
+ readonly description: "The frame ID to load the template into";
509
+ };
510
+ readonly variantId: {
511
+ readonly type: "string";
512
+ readonly description: "The template ID to load (from list_brand_templates)";
513
+ };
514
+ };
515
+ readonly required: readonly ["frameId", "variantId"];
516
+ readonly additionalProperties: false;
517
+ };
518
+ };
519
+ }, {
520
+ readonly type: "function";
521
+ readonly function: {
522
+ readonly name: "fill_template_slots";
523
+ readonly description: "Fill the slot elements inside a frame with content. Use this after load_template_into_frame to populate slots with actual content.";
524
+ readonly parameters: {
525
+ readonly type: "object";
526
+ readonly properties: {
527
+ readonly frameId: {
528
+ readonly type: "string";
529
+ readonly description: "The frame ID containing slot elements";
530
+ };
531
+ readonly headline: {
532
+ readonly type: "string";
533
+ readonly description: "Text for the headline slot";
534
+ };
535
+ readonly subhead: {
536
+ readonly type: "string";
537
+ readonly description: "Text for the subhead slot";
538
+ };
539
+ readonly cta: {
540
+ readonly type: "string";
541
+ readonly description: "Text for the CTA slot";
542
+ };
543
+ readonly signoff: {
544
+ readonly type: "string";
545
+ readonly description: "Text for the signoff slot";
546
+ };
547
+ readonly product_image_url: {
548
+ readonly type: "string";
549
+ readonly description: "URL for the product image slot (from search_brand_assets blobUrl, or a generated image data URL)";
550
+ };
551
+ readonly product_image_asset_id: {
552
+ readonly type: "string";
553
+ 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.";
554
+ };
555
+ readonly logo_url: {
556
+ readonly type: "string";
557
+ readonly description: "URL for the logo slot (from search_brand_assets blobUrl)";
558
+ };
559
+ readonly logo_asset_id: {
560
+ readonly type: "string";
561
+ readonly description: "Asset ID for the logo (from search_brand_assets [id:...] field). Required when using a brand asset.";
562
+ };
563
+ readonly auxiliary_image_url: {
564
+ readonly type: "string";
565
+ readonly description: "URL for the auxiliary image slot";
566
+ };
567
+ readonly auxiliary_image_asset_id: {
568
+ readonly type: "string";
569
+ readonly description: "Asset ID for the auxiliary image (from search_brand_assets [id:...] field). Required when using a brand asset.";
570
+ };
571
+ readonly background_color: {
572
+ readonly type: "string";
573
+ readonly description: "Hex color (e.g. #000000) for the background slot";
574
+ };
575
+ };
576
+ readonly required: readonly ["frameId"];
577
+ readonly additionalProperties: false;
578
+ };
579
+ };
580
+ }, {
581
+ readonly type: "function";
582
+ readonly function: {
583
+ readonly name: "finalize_ad";
584
+ 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.";
585
+ readonly parameters: {
586
+ readonly type: "object";
587
+ readonly properties: {
588
+ readonly frameId: {
589
+ readonly type: "string";
590
+ readonly description: "ID of the frame to capture for review";
591
+ };
592
+ };
593
+ readonly required: readonly ["frameId"];
594
+ readonly additionalProperties: false;
595
+ };
596
+ };
597
+ }];
598
+ export declare function serializeElements(elements: readonly ExcalidrawElement[]): Record<string, unknown>[];
599
+ export type FrameInfo = {
600
+ id: string;
601
+ name: string;
602
+ width: number;
603
+ height: number;
604
+ childCount: number;
605
+ };
606
+ export declare function listFrames(api: ExcalidrawImperativeAPI): FrameInfo[];
607
+ export declare function captureFrameScreenshot(api: ExcalidrawImperativeAPI, frameId: string): Promise<string | null>;
608
+ export declare function getFrameContext(api: ExcalidrawImperativeAPI, frameId: string): {
609
+ serialized: string;
610
+ frameInfo: FrameInfo;
611
+ } | null;
612
+ export type ToolExecutionContext = {
613
+ excalidrawAPI: ExcalidrawImperativeAPI;
614
+ geminiApiKey: string;
615
+ signal?: AbortSignal;
616
+ /** Override Gemini model ID for the agent's generate_image tool. */
617
+ agentImageModel?: string;
618
+ /**
619
+ * Maps lowercase brand font-family names to their registered Excalidraw
620
+ * fontFamilyIds. Built from BrandContext.typography in runAgentLoop and
621
+ * used by the HTML parser to preserve brand fonts in text elements.
622
+ */
623
+ customFontMap?: Record<string, number>;
624
+ /**
625
+ * Brand headline font file name (e.g. "Avenir-Heavy.otf"). Sourced from brand DNA.
626
+ * Passed to generate_image as style context so the AI knows the brand typography.
627
+ */
628
+ brandHeadlineFontName?: string;
629
+ /** Brand body font file name. Sourced from brand DNA. */
630
+ brandBodyFontName?: string;
631
+ /**
632
+ * Excalidraw fontFamilyId for the brand headline font.
633
+ * When set, ALL text elements (add_text, fill_template_slots headline slots)
634
+ * use this font. Falls back to brandBodyFontId, then Excalidraw default.
635
+ */
636
+ brandHeadlineFontId?: number;
637
+ /**
638
+ * Excalidraw fontFamilyId for the brand body font.
639
+ * When set, ALL text elements use this font — never a built-in fallback
640
+ * unless the font failed to load.
641
+ */
642
+ brandBodyFontId?: number;
643
+ /**
644
+ * Image file attachments the user uploaded in the current chat turn.
645
+ * Indexed 0-based in the order they were attached.
646
+ * Used by place_attachment (direct placement) and generate_image (as Gemini reference).
647
+ */
648
+ fileAttachments?: Array<{
649
+ name: string;
650
+ dataUrl?: string;
651
+ }>;
652
+ onSearchBrandAssets?: (query: string, type?: string) => Promise<Array<{
653
+ id: string;
654
+ name: string;
655
+ tags: string[];
656
+ assetType: string;
657
+ blobUrl: string;
658
+ }>>;
659
+ onListBrandTemplates?: (keywords?: string[]) => Promise<Array<{
660
+ id: string;
661
+ name: string;
662
+ campaignTag?: string;
663
+ label?: string;
664
+ width?: number;
665
+ height?: number;
666
+ thumbnailBlobUrl?: string;
667
+ }>>;
668
+ onGetTemplateVariant?: (variantId: string) => Promise<{
669
+ canvasJson: string;
670
+ }>;
671
+ /**
672
+ * Internal cache: populated by execGetTemplateVariant so that
673
+ * execLoadTemplateIntoFrame can reuse the already-fetched JSON without a
674
+ * second round-trip. Avoids the "double fetch → silent {} fallback → crash"
675
+ * failure mode for private Vercel Blob URLs.
676
+ */
677
+ _templateJsonCache?: Map<string, string>;
678
+ };
679
+ export type ToolResult = {
680
+ success: boolean;
681
+ data?: Record<string, unknown>;
682
+ error?: string;
683
+ statusMessage: string;
684
+ };
685
+ export declare function executeCanvasTool(toolName: string, rawArgs: string, ctx: ToolExecutionContext): Promise<ToolResult>;