@orangecatai/element 0.0.2 → 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.
- package/dist/dev/index.js +39 -2
- package/dist/dev/index.js.map +2 -2
- package/dist/prod/index.js +1 -1
- package/dist/types/common/src/keys.d.ts +2 -0
- package/dist/types/element/src/frame.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +177 -0
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +7 -7
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionFrame.d.ts +178 -0
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +7 -7
- package/dist/types/excalidraw/actions/actionLink.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionMenu.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionStyles.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -8
- package/dist/types/excalidraw/actions/index.d.ts +1 -1
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +1 -1
- package/dist/types/excalidraw/components/AIChatPanel.d.ts +114 -0
- package/dist/types/excalidraw/components/Actions.d.ts +3 -0
- package/dist/types/excalidraw/components/CanvasBackgroundSwatch.d.ts +7 -0
- package/dist/types/excalidraw/components/ColorPicker/AdvancedColorPicker.d.ts +8 -0
- package/dist/types/excalidraw/components/ColorPicker/colorConversions.d.ts +27 -0
- package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
- package/dist/types/excalidraw/components/DefaultSidebar.d.ts +1 -1
- package/dist/types/excalidraw/components/ElementCanvasButtons.d.ts +1 -1
- package/dist/types/excalidraw/components/FrameToolbar.d.ts +1 -1
- package/dist/types/excalidraw/components/HintViewer.d.ts +1 -1
- package/dist/types/excalidraw/components/ImageEditToolbar.d.ts +16 -0
- package/dist/types/excalidraw/components/ImageGeneratorPanel.d.ts +9 -4
- package/dist/types/excalidraw/components/ImageQuickEditPanel.d.ts +10 -1
- package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/index.d.ts +1 -1
- package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +1 -0
- package/dist/types/excalidraw/components/ToolButton.d.ts +1 -1
- package/dist/types/excalidraw/components/ai-chat/agentLoop.d.ts +112 -0
- package/dist/types/excalidraw/components/ai-chat/audioUtils.d.ts +10 -0
- package/dist/types/excalidraw/components/ai-chat/canvasTools.d.ts +685 -0
- package/dist/types/excalidraw/components/ai-chat/htmlToExcalidraw.d.ts +53 -0
- package/dist/types/excalidraw/components/ai-chat/openRouterStream.d.ts +50 -0
- package/dist/types/excalidraw/components/ai-chat/reviewerAgent.d.ts +64 -0
- package/dist/types/excalidraw/components/auto-resize/AutoResizePanel.d.ts +17 -0
- package/dist/types/excalidraw/components/auto-resize/AutoResizePanelHost.d.ts +4 -0
- package/dist/types/excalidraw/components/auto-resize/AutoResizeShimmerLayer.d.ts +11 -0
- package/dist/types/excalidraw/components/auto-resize/autoResizeEngine.d.ts +144 -0
- package/dist/types/excalidraw/components/auto-resize/autoResizePanelStore.d.ts +15 -0
- package/dist/types/excalidraw/components/auto-resize/autoResizeStore.d.ts +16 -0
- package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +1 -1
- package/dist/types/excalidraw/components/icons.d.ts +1 -0
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +1 -1
- package/dist/types/excalidraw/components/template-builder/TemplateBuilderPanelHost.d.ts +4 -0
- package/dist/types/excalidraw/components/template-builder/TemplateBuilderTray.d.ts +4 -0
- package/dist/types/excalidraw/components/template-builder/slotTypes.d.ts +43 -0
- package/dist/types/excalidraw/components/template-builder/templateBuilderStore.d.ts +19 -0
- package/dist/types/excalidraw/components/ui/avatar.d.ts +6 -0
- package/dist/types/excalidraw/components/ui/button.d.ts +11 -0
- package/dist/types/excalidraw/components/ui/chat-container.d.ts +17 -0
- package/dist/types/excalidraw/components/ui/code-block.d.ts +16 -0
- package/dist/types/excalidraw/components/ui/markdown.d.ts +10 -0
- package/dist/types/excalidraw/components/ui/message.d.ts +35 -0
- package/dist/types/excalidraw/components/ui/scroll-button.d.ts +10 -0
- package/dist/types/excalidraw/fonts/Fonts.d.ts +17 -0
- package/dist/types/excalidraw/index.d.ts +8 -0
- package/dist/types/excalidraw/types.d.ts +220 -0
- package/dist/types/excalidraw/utils/leonardoApiKey.d.ts +1 -0
- package/dist/types/excalidraw/utils/openRouterApiKey.d.ts +1 -0
- package/dist/types/excalidraw/utils/removeBgApiKey.d.ts +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type ToolAction } from "./ai-chat/agentLoop";
|
|
3
|
+
import "./AIChatPanel.scss";
|
|
4
|
+
import type { ReviewerFeedback } from "./ai-chat/reviewerAgent";
|
|
5
|
+
import type { ExcalidrawImperativeAPI } from "../types";
|
|
6
|
+
export type ChatMessage = {
|
|
7
|
+
id: string;
|
|
8
|
+
role: "user" | "assistant";
|
|
9
|
+
content: string;
|
|
10
|
+
timestamp: Date;
|
|
11
|
+
toolActions?: ToolAction[];
|
|
12
|
+
attachments?: Array<{
|
|
13
|
+
name: string;
|
|
14
|
+
type: "image" | "text";
|
|
15
|
+
dataUrl?: string;
|
|
16
|
+
}>;
|
|
17
|
+
/** Reviewer feedback attached to an assistant message after HTML ad generation */
|
|
18
|
+
reviewFeedback?: ReviewerFeedback;
|
|
19
|
+
};
|
|
20
|
+
export type ChatSession = {
|
|
21
|
+
id: string;
|
|
22
|
+
title: string;
|
|
23
|
+
messages: ChatMessage[];
|
|
24
|
+
};
|
|
25
|
+
export type AIChatPanelRef = {
|
|
26
|
+
setMessages: (messages: ChatMessage[], sessionId?: string) => void;
|
|
27
|
+
send: (text: string) => void;
|
|
28
|
+
};
|
|
29
|
+
export type AIChatPanelProps = {
|
|
30
|
+
isOpen: boolean;
|
|
31
|
+
onClose: () => void;
|
|
32
|
+
apiKey?: string;
|
|
33
|
+
excalidrawAPI?: ExcalidrawImperativeAPI;
|
|
34
|
+
geminiApiKey?: string;
|
|
35
|
+
initialMessages?: ChatMessage[];
|
|
36
|
+
initialSessionId?: string;
|
|
37
|
+
initialSessions?: ChatSession[];
|
|
38
|
+
onMessagesChange?: (messages: ChatMessage[], sessionId: string) => void;
|
|
39
|
+
onSessionCreate?: (session: {
|
|
40
|
+
id: string;
|
|
41
|
+
title: string;
|
|
42
|
+
}) => void;
|
|
43
|
+
onSessionSwitch?: (sessionId: string) => void;
|
|
44
|
+
onBeforeSend?: (ctx: {
|
|
45
|
+
hasVoice: boolean;
|
|
46
|
+
}) => Promise<{
|
|
47
|
+
allowed: boolean;
|
|
48
|
+
error?: string;
|
|
49
|
+
}>;
|
|
50
|
+
onAfterSend?: (ctx: {
|
|
51
|
+
hasVoice: boolean;
|
|
52
|
+
}) => void;
|
|
53
|
+
onBeforeImageGen?: () => Promise<{
|
|
54
|
+
allowed: boolean;
|
|
55
|
+
error?: string;
|
|
56
|
+
}>;
|
|
57
|
+
onAfterImageGen?: () => void;
|
|
58
|
+
/**
|
|
59
|
+
* OpenRouter model tag for the chat system (both plain chat and agent loop).
|
|
60
|
+
* @default "google/gemini-3.1-flash-lite-preview"
|
|
61
|
+
* @example "openai/gpt-4o" or "anthropic/claude-sonnet-4"
|
|
62
|
+
*/
|
|
63
|
+
chatModel?: string;
|
|
64
|
+
/**
|
|
65
|
+
* OpenRouter model tag for voice/speech-to-text transcription.
|
|
66
|
+
* @default "mistralai/voxtral-small-24b-2507"
|
|
67
|
+
*/
|
|
68
|
+
voiceModel?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Gemini model ID used by the agent's generate_image tool.
|
|
71
|
+
* @default "gemini-3.1-flash-image-preview"
|
|
72
|
+
* @example "gemini-2.0-flash-preview-image-generation"
|
|
73
|
+
*/
|
|
74
|
+
agentImageModel?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Optional brand identity context. When provided, the AI agent receives
|
|
77
|
+
* the brand's colors, typography, tone of voice, and imagery direction as
|
|
78
|
+
* a system-level context message so it can create on-brand ads.
|
|
79
|
+
*
|
|
80
|
+
* Pair this with `customFonts` on `<Excalidraw>` so that any uploaded
|
|
81
|
+
* brand font files are also registered in the canvas.
|
|
82
|
+
*/
|
|
83
|
+
brandContext?: import("../types").BrandContext;
|
|
84
|
+
onSearchBrandAssets?: (query: string, type?: string) => Promise<Array<{
|
|
85
|
+
id: string;
|
|
86
|
+
name: string;
|
|
87
|
+
tags: string[];
|
|
88
|
+
assetType: string;
|
|
89
|
+
blobUrl: string;
|
|
90
|
+
}>>;
|
|
91
|
+
onListBrandTemplates?: (keywords?: string[]) => Promise<Array<{
|
|
92
|
+
id: string;
|
|
93
|
+
name: string;
|
|
94
|
+
campaignTag?: string;
|
|
95
|
+
label?: string;
|
|
96
|
+
width?: number;
|
|
97
|
+
height?: number;
|
|
98
|
+
thumbnailBlobUrl?: string;
|
|
99
|
+
}>>;
|
|
100
|
+
onGetTemplateVariant?: (variantId: string) => Promise<{
|
|
101
|
+
canvasJson: string;
|
|
102
|
+
}>;
|
|
103
|
+
/**
|
|
104
|
+
* OpenRouter model tag for the reviewer agent. Must be vision-capable.
|
|
105
|
+
* Defaults to the same model as chatModel.
|
|
106
|
+
*/
|
|
107
|
+
reviewerModel?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Maximum number of reviewer rounds per banner before the reviewer is skipped.
|
|
110
|
+
* @default 2
|
|
111
|
+
*/
|
|
112
|
+
maxReviewRounds?: number;
|
|
113
|
+
};
|
|
114
|
+
export declare const AIChatPanel: React.ForwardRefExoticComponent<AIChatPanelProps & React.RefAttributes<AIChatPanelRef>>;
|
|
@@ -30,6 +30,9 @@ export declare const ShapesSwitcher: ({ activeTool, setAppState, app, UIOptions,
|
|
|
30
30
|
app: AppClassProperties;
|
|
31
31
|
UIOptions: AppProps["UIOptions"];
|
|
32
32
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export declare const ScrollBackToContentAction: ({ renderAction, }: {
|
|
34
|
+
renderAction: ActionManager["renderAction"];
|
|
35
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
33
36
|
export declare const ZoomActions: ({ renderAction, zoom, }: {
|
|
34
37
|
renderAction: ActionManager["renderAction"];
|
|
35
38
|
zoom: Zoom;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "./CanvasBackgroundSwatch.scss";
|
|
2
|
+
import type { ActionManager } from "../actions/manager";
|
|
3
|
+
import type { UIAppState } from "../types";
|
|
4
|
+
export declare const CanvasBackgroundSwatch: ({ actionManager, appState, }: {
|
|
5
|
+
actionManager: ActionManager;
|
|
6
|
+
appState: UIAppState;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "./AdvancedColorPicker.scss";
|
|
2
|
+
interface AdvancedColorPickerProps {
|
|
3
|
+
color: string;
|
|
4
|
+
onChange: (color: string) => void;
|
|
5
|
+
showAlpha?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const AdvancedColorPicker: ({ color, onChange, showAlpha, }: AdvancedColorPickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure color conversion utilities for HSV ↔ RGB ↔ Hex with alpha support.
|
|
3
|
+
*/
|
|
4
|
+
export interface HSVA {
|
|
5
|
+
h: number;
|
|
6
|
+
s: number;
|
|
7
|
+
v: number;
|
|
8
|
+
a: number;
|
|
9
|
+
}
|
|
10
|
+
export interface RGBA {
|
|
11
|
+
r: number;
|
|
12
|
+
g: number;
|
|
13
|
+
b: number;
|
|
14
|
+
a: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const hsvaToRgba: ({ h, s, v, a }: HSVA) => RGBA;
|
|
17
|
+
export declare const rgbaToHsva: ({ r, g, b, a }: RGBA) => HSVA;
|
|
18
|
+
export declare const rgbaToHex: ({ r, g, b, a }: RGBA) => string;
|
|
19
|
+
export declare const hexToRgba: (hex: string) => RGBA;
|
|
20
|
+
export declare const hsvaToHex: (hsva: HSVA) => string;
|
|
21
|
+
export declare const hexToHsva: (hex: string) => HSVA;
|
|
22
|
+
/** Produces a CSS-safe rgba() string */
|
|
23
|
+
export declare const hsvaToRgbaString: (hsva: HSVA) => string;
|
|
24
|
+
/**
|
|
25
|
+
* Clamp a number between min and max.
|
|
26
|
+
*/
|
|
27
|
+
export declare const clampValue: (value: number, min: number, max: number) => number;
|
|
@@ -4,7 +4,7 @@ import type { SidebarProps, SidebarTriggerProps } from "./Sidebar/common";
|
|
|
4
4
|
export declare const DefaultSidebar: import("react").FC<Omit<MarkOptional<Omit<{
|
|
5
5
|
name: import("../types").SidebarName;
|
|
6
6
|
children: React.ReactNode;
|
|
7
|
-
onStateChange?: (state: import("
|
|
7
|
+
onStateChange?: (state: import("..").AppState["openSidebar"]) => void;
|
|
8
8
|
onDock?: (docked: boolean) => void;
|
|
9
9
|
docked?: boolean;
|
|
10
10
|
className?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ElementsMap, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
|
|
2
1
|
import "./ElementCanvasButtons.scss";
|
|
2
|
+
import type { ElementsMap, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
|
|
3
3
|
export declare const ElementCanvasButtons: ({ children, element, elementsMap, }: {
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
element: NonDeletedExcalidrawElement;
|
|
@@ -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;
|
|
@@ -3,21 +3,21 @@ import type { ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@o
|
|
|
3
3
|
import type { AppClassProperties } from "../types";
|
|
4
4
|
export declare const MODEL_CONFIG: {
|
|
5
5
|
readonly "Gemini 2.5 Flash": {
|
|
6
|
-
readonly geminiModelId: "gemini-
|
|
6
|
+
readonly geminiModelId: "gemini-3.1-flash-image";
|
|
7
7
|
readonly supportsImageSize: false;
|
|
8
8
|
readonly supportsThinking: false;
|
|
9
9
|
readonly supportedResolutions: readonly ["1K"];
|
|
10
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
11
|
};
|
|
12
12
|
readonly "Gemini 3.1 Flash": {
|
|
13
|
-
readonly geminiModelId: "gemini-3.1-flash-image
|
|
13
|
+
readonly geminiModelId: "gemini-3.1-flash-image";
|
|
14
14
|
readonly supportsImageSize: true;
|
|
15
15
|
readonly supportsThinking: true;
|
|
16
16
|
readonly supportedResolutions: readonly ["0.5K", "1K", "2K", "4K"];
|
|
17
17
|
readonly supportedRatios: readonly ["21:9", "16:9", "4:3", "3:2", "1:1", "9:16", "3:4", "2:3", "5:4", "4:5", "4:1", "1:4", "8:1", "1:8"];
|
|
18
18
|
};
|
|
19
19
|
readonly "Gemini 3 Pro": {
|
|
20
|
-
readonly geminiModelId: "gemini-3-pro-image
|
|
20
|
+
readonly geminiModelId: "gemini-3-pro-image";
|
|
21
21
|
readonly supportsImageSize: true;
|
|
22
22
|
readonly supportsThinking: false;
|
|
23
23
|
readonly supportedResolutions: readonly ["1K", "2K", "4K"];
|
|
@@ -32,7 +32,12 @@ export declare function getDimensions(model: ModelName, ratio: string, resolutio
|
|
|
32
32
|
height: number;
|
|
33
33
|
};
|
|
34
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, }: {
|
|
35
|
+
export declare const ImageGeneratorPanel: ({ element, app, onBeforeImageGen, onAfterImageGen, }: {
|
|
36
36
|
element: NonDeletedExcalidrawElement & ExcalidrawFrameLikeElement;
|
|
37
37
|
app: AppClassProperties;
|
|
38
|
+
onBeforeImageGen?: () => Promise<{
|
|
39
|
+
allowed: boolean;
|
|
40
|
+
error?: string;
|
|
41
|
+
}>;
|
|
42
|
+
onAfterImageGen?: () => void;
|
|
38
43
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import "./ImageQuickEditPanel.scss";
|
|
2
2
|
import type { ExcalidrawImageElement, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
|
|
3
3
|
import type { AppClassProperties } from "../types";
|
|
4
|
-
export declare const ImageQuickEditPanel: ({ element, app, }: {
|
|
4
|
+
export declare const ImageQuickEditPanel: ({ element, app, onBeforeImageGen, onAfterImageGen, forceOpen, onClose, }: {
|
|
5
5
|
element: ExcalidrawImageElement & NonDeletedExcalidrawElement;
|
|
6
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;
|
|
7
16
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -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("
|
|
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("
|
|
26
|
+
onStateChange?: (state: import("../..").AppState["openSidebar"]) => void;
|
|
27
27
|
onDock?: (docked: boolean) => void;
|
|
28
28
|
docked?: boolean;
|
|
29
29
|
className?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Scene } from "@orangecatai/element";
|
|
2
1
|
import { useApp, useExcalidrawSetAppState } from "../App";
|
|
3
2
|
import "./DragInput.scss";
|
|
3
|
+
import type { Scene } from "@orangecatai/element";
|
|
4
4
|
import type { ElementsMap, ExcalidrawElement } from "@orangecatai/element/types";
|
|
5
5
|
import type { StatsInputProperty } from "./utils";
|
|
6
6
|
import type { AppState } from "../../types";
|
|
@@ -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;
|
|
@@ -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>;
|