@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
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import type { FontFamilyValues } from "@orangecatai/element/types";
3
2
  import "./FontPicker.scss";
3
+ import type { FontFamilyValues } from "@orangecatai/element/types";
4
4
  export declare const DEFAULT_FONTS: {
5
5
  value: number;
6
6
  icon: import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { type FontFamilyValues } from "@orangecatai/element/types";
3
- import type { ValueOf } from "@orangecatai/common/utility-types";
4
3
  import { DropDownMenuItemBadgeType } from "../dropdownMenu/DropdownMenuItem";
4
+ import type { ValueOf } from "@orangecatai/common/utility-types";
5
5
  import type { JSX } from "react";
6
6
  export interface FontDescriptor {
7
7
  value: number;
@@ -1,5 +1,5 @@
1
- import type { Node } from "@orangecatai/common";
2
1
  import { type FontDescriptor } from "./FontPickerList";
2
+ import type { Node } from "@orangecatai/common";
3
3
  interface FontPickerKeyNavHandlerProps {
4
4
  event: React.KeyboardEvent<HTMLDivElement>;
5
5
  inputRef: React.RefObject<HTMLInputElement | null>;
@@ -1,5 +1,5 @@
1
- import type { ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
2
1
  import "./FrameToolbar.scss";
2
+ import type { ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
3
3
  import type { AppClassProperties } from "../types";
4
4
  export declare const FrameToolbar: ({ element, app, }: {
5
5
  element: NonDeletedExcalidrawElement & ExcalidrawFrameLikeElement;
@@ -1,5 +1,5 @@
1
- import type { EditorInterface } from "@orangecatai/common";
2
1
  import "./HintViewer.scss";
2
+ import type { EditorInterface } from "@orangecatai/common";
3
3
  import type { AppClassProperties, UIAppState } from "../types";
4
4
  interface HintViewerProps {
5
5
  appState: UIAppState;
@@ -0,0 +1,16 @@
1
+ import "./ImageEditToolbar.scss";
2
+ import type { ExcalidrawImageElement, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
3
+ import type { AppClassProperties } from "../types";
4
+ export interface ImageEditToolbarCallbacks {
5
+ onQuickEdit?: () => void;
6
+ onUpscale?: () => void;
7
+ onRemoveBG?: () => void;
8
+ onCrop?: () => void;
9
+ onDownload?: () => void;
10
+ onSwapAsset?: (elementId: string) => Promise<void>;
11
+ }
12
+ export declare const ImageEditToolbar: ({ element, app, callbacks, }: {
13
+ element: ExcalidrawImageElement & NonDeletedExcalidrawElement;
14
+ app: AppClassProperties;
15
+ callbacks?: ImageEditToolbarCallbacks;
16
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,5 +1,5 @@
1
- import type { NonDeletedExcalidrawElement } from "@orangecatai/element/types";
2
1
  import "./ImageExportDialog.scss";
2
+ import type { NonDeletedExcalidrawElement } from "@orangecatai/element/types";
3
3
  import type { ActionManager } from "../actions/manager";
4
4
  import type { AppClassProperties, BinaryFiles, UIAppState } from "../types";
5
5
  export declare const ErrorCanvasPreview: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,43 @@
1
+ import "./ImageGeneratorPanel.scss";
2
+ import type { ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
3
+ import type { AppClassProperties } from "../types";
4
+ export declare const MODEL_CONFIG: {
5
+ readonly "Gemini 2.5 Flash": {
6
+ readonly geminiModelId: "gemini-3.1-flash-image";
7
+ readonly supportsImageSize: false;
8
+ readonly supportsThinking: false;
9
+ readonly supportedResolutions: readonly ["1K"];
10
+ readonly supportedRatios: readonly ["21:9", "16:9", "4:3", "3:2", "1:1", "9:16", "3:4", "2:3", "5:4", "4:5"];
11
+ };
12
+ readonly "Gemini 3.1 Flash": {
13
+ readonly geminiModelId: "gemini-3.1-flash-image";
14
+ readonly supportsImageSize: true;
15
+ readonly supportsThinking: true;
16
+ readonly supportedResolutions: readonly ["0.5K", "1K", "2K", "4K"];
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
+ };
19
+ readonly "Gemini 3 Pro": {
20
+ readonly geminiModelId: "gemini-3-pro-image";
21
+ readonly supportsImageSize: true;
22
+ readonly supportsThinking: false;
23
+ readonly supportedResolutions: readonly ["1K", "2K", "4K"];
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
+ };
26
+ };
27
+ export type ModelName = keyof typeof MODEL_CONFIG;
28
+ export declare const MODEL_NAMES: ModelName[];
29
+ export type Resolution = "0.5K" | "1K" | "2K" | "4K";
30
+ export declare function getDimensions(model: ModelName, ratio: string, resolution: Resolution): {
31
+ width: number;
32
+ height: number;
33
+ };
34
+ export declare function callGeminiAPI(prompt: string, modelId: string, aspectRatio: string, resolution: Resolution, supportsImageSize: boolean, supportsThinking: boolean, apiKey: string, referenceImageDataUrl?: string, signal?: AbortSignal): Promise<string>;
35
+ export declare const ImageGeneratorPanel: ({ element, app, onBeforeImageGen, onAfterImageGen, }: {
36
+ element: NonDeletedExcalidrawElement & ExcalidrawFrameLikeElement;
37
+ app: AppClassProperties;
38
+ onBeforeImageGen?: () => Promise<{
39
+ allowed: boolean;
40
+ error?: string;
41
+ }>;
42
+ onAfterImageGen?: () => void;
43
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,16 @@
1
+ import "./ImageQuickEditPanel.scss";
2
+ import type { ExcalidrawImageElement, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
3
+ import type { AppClassProperties } from "../types";
4
+ export declare const ImageQuickEditPanel: ({ element, app, onBeforeImageGen, onAfterImageGen, forceOpen, onClose, }: {
5
+ element: ExcalidrawImageElement & NonDeletedExcalidrawElement;
6
+ app: AppClassProperties;
7
+ onBeforeImageGen?: () => Promise<{
8
+ allowed: boolean;
9
+ error?: string;
10
+ }>;
11
+ onAfterImageGen?: () => void;
12
+ /** When true, skip the trigger bar and render the panel directly. */
13
+ forceOpen?: boolean;
14
+ /** Called when the panel closes itself (only used when forceOpen=true). */
15
+ onClose?: () => void;
16
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import type { NonDeletedExcalidrawElement } from "@orangecatai/element/types";
3
2
  import "./ExportDialog.scss";
3
+ import type { NonDeletedExcalidrawElement } from "@orangecatai/element/types";
4
4
  import type { ActionManager } from "../actions/manager";
5
5
  import type { ExportOpts, BinaryFiles, UIAppState } from "../types";
6
6
  export type ExportCB = (elements: readonly NonDeletedExcalidrawElement[], scale?: number) => void;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
- import type { NonDeletedExcalidrawElement } from "@orangecatai/element/types";
3
2
  import "./LayerUI.scss";
4
3
  import "./Toolbar.scss";
4
+ import type { NonDeletedExcalidrawElement } from "@orangecatai/element/types";
5
5
  import type { ActionManager } from "../actions/manager";
6
6
  import type { Language } from "../i18n";
7
7
  import type { AppProps, AppState, ExcalidrawProps, BinaryFiles, UIAppState, AppClassProperties } from "../types";
@@ -14,7 +14,7 @@ export declare const isSidebarDockedAtom: import("jotai/vanilla/atom").Primitive
14
14
  export declare const SidebarInner: React.ForwardRefExoticComponent<Omit<{
15
15
  name: import("../../types").SidebarName;
16
16
  children: React.ReactNode;
17
- onStateChange?: (state: import("../../types").AppState["openSidebar"]) => void;
17
+ onStateChange?: (state: import("../..").AppState["openSidebar"]) => void;
18
18
  onDock?: (docked: boolean) => void;
19
19
  docked?: boolean;
20
20
  className?: string;
@@ -23,7 +23,7 @@ export declare const SidebarInner: React.ForwardRefExoticComponent<Omit<{
23
23
  export declare const Sidebar: React.ForwardRefExoticComponent<{
24
24
  name: import("../../types").SidebarName;
25
25
  children: React.ReactNode;
26
- onStateChange?: (state: import("../../types").AppState["openSidebar"]) => void;
26
+ onStateChange?: (state: import("../..").AppState["openSidebar"]) => void;
27
27
  onDock?: (docked: boolean) => void;
28
28
  docked?: boolean;
29
29
  className?: string;
@@ -1,7 +1,7 @@
1
- import type { ElementsMap, ExcalidrawElement } from "@orangecatai/element/types";
2
- import type { Scene } from "@orangecatai/element";
3
1
  import { useApp, useExcalidrawSetAppState } from "../App";
4
2
  import "./DragInput.scss";
3
+ import type { Scene } from "@orangecatai/element";
4
+ import type { ElementsMap, ExcalidrawElement } from "@orangecatai/element/types";
5
5
  import type { StatsInputProperty } from "./utils";
6
6
  import type { AppState } from "../../types";
7
7
  export type DragInputCallbackType<P extends StatsInputProperty, E = ExcalidrawElement> = (props: {
@@ -1,5 +1,5 @@
1
- import type { ExcalidrawElement } from "@orangecatai/element/types";
2
1
  import type { Scene } from "@orangecatai/element";
2
+ import type { ExcalidrawElement } from "@orangecatai/element/types";
3
3
  import type { AppState } from "../../types";
4
4
  interface FontSizeProps {
5
5
  element: ExcalidrawElement;
@@ -1,5 +1,5 @@
1
- import type { ExcalidrawElement, NonDeletedSceneElementsMap } from "@orangecatai/element/types";
2
1
  import type { Scene } from "@orangecatai/element";
2
+ import type { ExcalidrawElement, NonDeletedSceneElementsMap } from "@orangecatai/element/types";
3
3
  import type { AtomicUnit } from "./utils";
4
4
  import type { AppState } from "../../types";
5
5
  interface MultiDimensionProps {
@@ -1,5 +1,5 @@
1
- import type { ExcalidrawElement, NonDeletedSceneElementsMap } from "@orangecatai/element/types";
2
1
  import type { Scene } from "@orangecatai/element";
2
+ import type { ExcalidrawElement, NonDeletedSceneElementsMap } from "@orangecatai/element/types";
3
3
  import type { AppState } from "../../types";
4
4
  interface MultiFontSizeProps {
5
5
  elements: readonly ExcalidrawElement[];
@@ -1,5 +1,5 @@
1
- import type { ElementsMap, ExcalidrawElement } from "@orangecatai/element/types";
2
1
  import type { Scene } from "@orangecatai/element";
2
+ import type { ElementsMap, ExcalidrawElement } from "@orangecatai/element/types";
3
3
  import type { AtomicUnit } from "./utils";
4
4
  import type { AppState } from "../../types";
5
5
  interface MultiPositionProps {
@@ -1,5 +1,5 @@
1
- import type { NonDeletedExcalidrawElement } from "@orangecatai/element/types";
2
1
  import "./Stats.scss";
2
+ import type { NonDeletedExcalidrawElement } from "@orangecatai/element/types";
3
3
  import type { AppClassProperties, AppState, ExcalidrawProps } from "../../types";
4
4
  interface StatsProps {
5
5
  app: AppClassProperties;
@@ -1,7 +1,7 @@
1
- import type { RequestError } from "@orangecatai/adgen-canvas/errors";
2
- import type { NonDeletedExcalidrawElement } from "@orangecatai/element/types";
3
1
  import type { MermaidConfig } from "@excalidraw/mermaid-to-excalidraw";
4
2
  import type { MermaidToExcalidrawResult } from "@excalidraw/mermaid-to-excalidraw/dist/interfaces";
3
+ import type { RequestError } from "@orangecatai/adgen-canvas/errors";
4
+ import type { NonDeletedExcalidrawElement } from "@orangecatai/element/types";
5
5
  import type { BinaryFiles } from "../../types";
6
6
  export type LLMMessage = {
7
7
  role: "user" | "assistant";
@@ -20,5 +20,6 @@ export type StreamChunk = {
20
20
  status?: number;
21
21
  };
22
22
  };
23
+ export declare function parseSSEStream(reader: ReadableStreamDefaultReader<Uint8Array>): AsyncGenerator<string, void, unknown>;
23
24
  export declare function TTDStreamFetch(options: StreamingOptions): Promise<TTTDDialog.OnTextSubmitRetValue>;
24
25
  export {};
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import type { PointerType } from "@orangecatai/element/types";
3
2
  import "./ToolIcon.scss";
3
+ import type { PointerType } from "@orangecatai/element/types";
4
4
  import type { CSSProperties } from "react";
5
5
  export type ToolButtonSize = "small" | "medium";
6
6
  type ToolButtonBaseProps = {
@@ -0,0 +1,112 @@
1
+ import { type ToolExecutionContext } from "./canvasTools";
2
+ import type { BrandContext } from "../../types";
3
+ type ContentPart = {
4
+ type: "text";
5
+ text: string;
6
+ } | {
7
+ type: "image_url";
8
+ image_url: {
9
+ url: string;
10
+ };
11
+ };
12
+ export type AgentMessage = {
13
+ role: "system";
14
+ content: string;
15
+ } | {
16
+ role: "user";
17
+ content: string | ContentPart[];
18
+ } | {
19
+ role: "assistant";
20
+ content: string | null;
21
+ tool_calls?: ToolCall[];
22
+ } | {
23
+ role: "tool";
24
+ tool_call_id: string;
25
+ content: string;
26
+ };
27
+ export type ToolCall = {
28
+ id: string;
29
+ type: "function";
30
+ function: {
31
+ name: string;
32
+ arguments: string;
33
+ };
34
+ };
35
+ export type ToolAction = {
36
+ result: {
37
+ success: boolean;
38
+ statusMessage: string;
39
+ };
40
+ };
41
+ export type AgentUpdate = {
42
+ type: "status" | "tool_start" | "tool_done" | "final" | "content_delta";
43
+ message: string;
44
+ toolAction?: ToolAction;
45
+ } | {
46
+ type: "review_start";
47
+ message: string;
48
+ } | {
49
+ type: "review_done";
50
+ message: string;
51
+ feedback: import("./reviewerAgent").ReviewerFeedback;
52
+ };
53
+ export type AgentResult = {
54
+ reply: string;
55
+ toolActions: ToolAction[];
56
+ };
57
+ /**
58
+ * Converts a BrandContext object to a concise system message string.
59
+ */
60
+ export declare function buildBrandContextMessage(ctx: BrandContext): string;
61
+ export type FileAttachment = {
62
+ name: string;
63
+ type: "image" | "text";
64
+ dataUrl?: string;
65
+ textContent?: string;
66
+ };
67
+ export declare function runAgentLoop(opts: {
68
+ userMessages: Array<{
69
+ role: "user" | "assistant";
70
+ content: string;
71
+ /** Images attached to THIS specific message (from the user's upload history) */
72
+ imageAttachments?: Array<{
73
+ name: string;
74
+ dataUrl: string;
75
+ }>;
76
+ }>;
77
+ elementContext?: string;
78
+ frameScreenshot?: string;
79
+ fileAttachments?: FileAttachment[];
80
+ webSearchEnabled?: boolean;
81
+ apiKey: string;
82
+ chatModel?: string;
83
+ agentImageModel?: string;
84
+ toolCtx: ToolExecutionContext;
85
+ onUpdate: (update: AgentUpdate) => void;
86
+ signal?: AbortSignal;
87
+ onBeforeImageGen?: () => Promise<{
88
+ allowed: boolean;
89
+ error?: string;
90
+ }>;
91
+ onAfterImageGen?: () => void;
92
+ /** Optional brand identity context — injected as a system message before user messages. */
93
+ brandContext?: BrandContext;
94
+ /**
95
+ * @deprecated Font IDs are now derived from brandContext.typography.fontFamilyId.
96
+ * Kept for API compatibility but no longer used internally.
97
+ */
98
+ customFontIds?: number[];
99
+ /**
100
+ * OpenRouter model tag for the reviewer agent. Must be vision-capable.
101
+ * Defaults to the same model as chatModel.
102
+ */
103
+ reviewerModel?: string;
104
+ /**
105
+ * Maximum number of reviewer rounds per banner.
106
+ * After this many rounds the reviewer is skipped and the outer MAX_ITERATIONS
107
+ * cap handles loop termination.
108
+ * @default 2
109
+ */
110
+ maxReviewRounds?: number;
111
+ }): Promise<AgentResult>;
112
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Converts any audio Blob (webm, mp4, ogg…) to a base64-encoded WAV string
3
+ * using the Web Audio API. Mistral Voxtral only accepts mp3 or wav.
4
+ */
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>;