@dwelle/excalidraw 0.5.0-e05a141 → 0.5.0-e2a82c4d8
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/{chunk-JCMFCSXV.js → chunk-7M7SVUYU.js} +121 -7
- package/dist/dev/chunk-7M7SVUYU.js.map +7 -0
- package/dist/dev/{chunk-P7XQCHXR.js → chunk-HJWER26G.js} +901 -439
- package/dist/dev/chunk-HJWER26G.js.map +7 -0
- package/dist/dev/{chunk-B7UQ5W6R.js → chunk-Q5BO7QEK.js} +2 -2
- package/dist/dev/{chunk-B7UQ5W6R.js.map → chunk-Q5BO7QEK.js.map} +1 -1
- package/dist/dev/components/TTDDialog/CodeMirrorEditor-4GD6MAJW.js +259 -0
- package/dist/dev/components/TTDDialog/CodeMirrorEditor-4GD6MAJW.js.map +7 -0
- package/dist/dev/data/{image-BUI6GQJR.js → image-UQK7BQY4.js} +3 -3
- package/dist/dev/index.css +2444 -173
- package/dist/dev/index.css.map +3 -3
- package/dist/dev/index.js +6875 -1415
- package/dist/dev/index.js.map +4 -4
- package/dist/dev/locales/{en-SEGQGVZN.js → en-IHKMFGHF.js} +6 -2
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/chunk-QHCRJDAB.js +12 -0
- package/dist/prod/chunk-R2CZDOAE.js +34 -0
- package/dist/prod/{chunk-KDBB3MAO.js → chunk-XXRJJHWR.js} +1 -1
- package/dist/prod/components/TTDDialog/CodeMirrorEditor-P2CDXXOC.js +1 -0
- package/dist/prod/data/image-WAWRV65K.js +1 -0
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +34 -25
- package/dist/prod/locales/en-QQWGF6XN.js +1 -0
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/common/src/utils.d.ts +5 -3
- package/dist/types/element/src/Scene.d.ts +2 -0
- package/dist/types/element/src/arrowheads.d.ts +3 -0
- package/dist/types/element/src/binding.d.ts +5 -4
- package/dist/types/element/src/bounds.d.ts +5 -3
- package/dist/types/element/src/elbowArrow.d.ts +2 -0
- package/dist/types/element/src/frame.d.ts +1 -1
- package/dist/types/element/src/index.d.ts +1 -0
- package/dist/types/element/src/linearElementEditor.d.ts +5 -2
- package/dist/types/element/src/mutateElement.d.ts +2 -0
- package/dist/types/element/src/selection.d.ts +7 -3
- package/dist/types/element/src/shape.d.ts +1 -1
- package/dist/types/element/src/textElement.d.ts +1 -1
- package/dist/types/element/src/textWrapping.d.ts +26 -0
- package/dist/types/element/src/types.d.ts +4 -1
- package/dist/types/element/src/utils.d.ts +2 -2
- package/dist/types/excalidraw/TTA/TTAChatEmptyState.d.ts +7 -0
- package/dist/types/excalidraw/TTA/TTAChatMessage.d.ts +15 -0
- package/dist/types/excalidraw/TTA/TTAComposer.d.ts +24 -0
- package/dist/types/excalidraw/TTA/TTADialog.d.ts +19 -0
- package/dist/types/excalidraw/TTA/TTADialogPanel.d.ts +46 -0
- package/dist/types/excalidraw/TTA/TTADialogTrigger.d.ts +10 -0
- package/dist/types/excalidraw/TTA/TTAHistory.d.ts +11 -0
- package/dist/types/excalidraw/TTA/TTAWarningMessage.d.ts +5 -0
- package/dist/types/excalidraw/TTA/chatErrors.d.ts +13 -0
- package/dist/types/excalidraw/TTA/chatHelpers.d.ts +26 -0
- package/dist/types/excalidraw/TTA/client.d.ts +74 -0
- package/dist/types/excalidraw/TTA/history.d.ts +2 -0
- package/dist/types/excalidraw/TTA/insertAISkeletons.d.ts +20 -0
- package/dist/types/excalidraw/TTA/types.d.ts +167 -0
- package/dist/types/excalidraw/TTA/useAIAssistantPreview.d.ts +18 -0
- package/dist/types/excalidraw/TTA/useAIStreamingCanvasPreview.d.ts +21 -0
- package/dist/types/excalidraw/TTA/useAIStreamingLifecycle.d.ts +34 -0
- package/dist/types/excalidraw/TTA/useTTAChatHistory.d.ts +18 -0
- package/dist/types/excalidraw/TTA/utils.d.ts +14 -0
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +15 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +11 -5
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +50 -20
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +10 -4
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +15 -6
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +161 -0
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +10 -4
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionExport.d.ts +21 -8
- package/dist/types/excalidraw/actions/actionFrame.d.ts +20 -8
- package/dist/types/excalidraw/actions/actionGroup.d.ts +11 -5
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionLink.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionMenu.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionProperties.d.ts +12 -6
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionStyles.d.ts +6 -2
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +174 -0
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +174 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +5 -2
- package/dist/types/excalidraw/actions/index.d.ts +3 -0
- package/dist/types/excalidraw/actions/types.d.ts +1 -1
- package/dist/types/excalidraw/aiWarnings.d.ts +7 -0
- package/dist/types/excalidraw/appState.d.ts +4 -0
- package/dist/types/excalidraw/components/AI/ChatMessage.d.ts +33 -0
- package/dist/types/excalidraw/components/AI/index.d.ts +2 -0
- package/dist/types/excalidraw/components/App.d.ts +11 -1
- package/dist/types/excalidraw/components/FilledButton.d.ts +1 -1
- package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
- package/dist/types/excalidraw/components/Range.d.ts +10 -4
- package/dist/types/excalidraw/components/TTDDialog/Chat/TTDRateLimitWarningContent.d.ts +5 -0
- package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
- package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +2 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +4 -1
- package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
- package/dist/types/excalidraw/components/TTDDialog/types.d.ts +5 -1
- package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +24 -6
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +10 -0
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +1 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -1
- package/dist/types/excalidraw/components/icons.d.ts +18 -8
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +3 -0
- package/dist/types/excalidraw/context/tunnels.d.ts +1 -0
- package/dist/types/excalidraw/data/blob.d.ts +9 -3
- package/dist/types/excalidraw/data/filesystem.d.ts +3 -3
- package/dist/types/excalidraw/data/index.d.ts +1 -1
- package/dist/types/excalidraw/data/json.d.ts +6 -3
- package/dist/types/excalidraw/data/resave.d.ts +1 -1
- package/dist/types/excalidraw/data/sse.d.ts +15 -0
- package/dist/types/excalidraw/index.d.ts +15 -2
- package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
- package/dist/types/excalidraw/types.d.ts +15 -2
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +5 -1
- package/dist/types/math/src/curve.d.ts +4 -1
- package/dist/types/math/src/point.d.ts +1 -1
- package/package.json +11 -5
- package/CHANGELOG.md +0 -2385
- package/dist/dev/chunk-JCMFCSXV.js.map +0 -7
- package/dist/dev/chunk-P7XQCHXR.js.map +0 -7
- package/dist/prod/chunk-FVPDTNSG.js +0 -12
- package/dist/prod/chunk-LRBVLW2I.js +0 -33
- package/dist/prod/data/image-KI7JN73E.js +0 -1
- package/dist/prod/locales/en-6237XDE7.js +0 -1
- package/dist/types/excalidraw/data/ai/types.d.ts +0 -242
- package/history.ts +0 -249
- /package/dist/dev/data/{image-BUI6GQJR.js.map → image-UQK7BQY4.js.map} +0 -0
- /package/dist/dev/locales/{en-SEGQGVZN.js.map → en-IHKMFGHF.js.map} +0 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import type { ExcalidrawElementSkeleton } from "@excalidraw/element";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import type { AIRateLimitWarningDescriptor } from "../aiWarnings";
|
|
4
|
+
export type AIServerMessageRole = "user" | "assistant";
|
|
5
|
+
export type AIAssistantLifecycleStatus = "pending" | "completed" | "failed" | "aborted";
|
|
6
|
+
export interface AIServerConversationMessage {
|
|
7
|
+
role: AIServerMessageRole;
|
|
8
|
+
content: string;
|
|
9
|
+
images?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface AIGenerationRetryContext {
|
|
12
|
+
reason: "user_not_happy" | "generation_error";
|
|
13
|
+
avoidSimilarity?: boolean;
|
|
14
|
+
retryAssistantMessageId?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface AIGenerateRequestPayload extends Record<string, unknown> {
|
|
17
|
+
prompt: string;
|
|
18
|
+
images?: string[];
|
|
19
|
+
chatId?: string | null;
|
|
20
|
+
retry?: AIGenerationRetryContext;
|
|
21
|
+
}
|
|
22
|
+
export interface ExcalidrawServerPayloadBase {
|
|
23
|
+
skeletons: ExcalidrawElementSkeleton[];
|
|
24
|
+
}
|
|
25
|
+
export interface AIStreamPartialPayload extends ExcalidrawServerPayloadBase {
|
|
26
|
+
isComplete: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface AIStreamStartedPayload {
|
|
29
|
+
chatId: string;
|
|
30
|
+
turnId: string;
|
|
31
|
+
messageId: string;
|
|
32
|
+
lifecycleStatus?: Extract<AIAssistantLifecycleStatus, "pending">;
|
|
33
|
+
updatedAt?: number | null;
|
|
34
|
+
}
|
|
35
|
+
export interface AIStreamMessagePayload {
|
|
36
|
+
message: string;
|
|
37
|
+
}
|
|
38
|
+
export interface AIStreamFinalPayload extends AIStreamPartialPayload {
|
|
39
|
+
chatId?: string | null;
|
|
40
|
+
turnId?: string | null;
|
|
41
|
+
messageId?: string | null;
|
|
42
|
+
lifecycleStatus?: Extract<AIAssistantLifecycleStatus, "completed">;
|
|
43
|
+
updatedAt?: number | null;
|
|
44
|
+
}
|
|
45
|
+
export declare const AI_ERRORS: {
|
|
46
|
+
readonly RATE_LIMIT: {
|
|
47
|
+
readonly code: 429;
|
|
48
|
+
readonly message: "Rate limit exceeded. Please wait before trying again.";
|
|
49
|
+
};
|
|
50
|
+
readonly SERVER_ERROR: {
|
|
51
|
+
readonly code: 500;
|
|
52
|
+
readonly message: "An internal server error occurred. Please try again later.";
|
|
53
|
+
};
|
|
54
|
+
readonly REQUEST_ERROR: {
|
|
55
|
+
readonly code: 400;
|
|
56
|
+
readonly message: "The request could not be processed due to invalid data.";
|
|
57
|
+
};
|
|
58
|
+
readonly GENERATION_ERROR: {
|
|
59
|
+
readonly code: 422;
|
|
60
|
+
readonly message: "Failed to generate valid content.";
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export type AI_ERROR_CODE = typeof AI_ERRORS[keyof typeof AI_ERRORS]["code"];
|
|
64
|
+
export type StreamChunk = {
|
|
65
|
+
type: "started";
|
|
66
|
+
chatId: string;
|
|
67
|
+
turnId: string;
|
|
68
|
+
messageId: string;
|
|
69
|
+
lifecycleStatus?: Extract<AIAssistantLifecycleStatus, "pending">;
|
|
70
|
+
updatedAt?: number;
|
|
71
|
+
} | {
|
|
72
|
+
type: "message";
|
|
73
|
+
message: string;
|
|
74
|
+
} | {
|
|
75
|
+
type: "partial";
|
|
76
|
+
skeletons: ExcalidrawElementSkeleton[];
|
|
77
|
+
} | {
|
|
78
|
+
type: "done";
|
|
79
|
+
lifecycleStatus?: Extract<AIAssistantLifecycleStatus, "completed">;
|
|
80
|
+
finishReason: "stop" | "length" | "content_filter" | "tool_calls" | null;
|
|
81
|
+
skeletons: ExcalidrawElementSkeleton[];
|
|
82
|
+
chatId?: string;
|
|
83
|
+
turnId?: string;
|
|
84
|
+
messageId?: string;
|
|
85
|
+
updatedAt?: number;
|
|
86
|
+
} | {
|
|
87
|
+
type: "error";
|
|
88
|
+
lifecycleStatus?: Extract<AIAssistantLifecycleStatus, "failed">;
|
|
89
|
+
error: {
|
|
90
|
+
code?: number;
|
|
91
|
+
message: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
export type UserChatMessage = {
|
|
95
|
+
role: "user";
|
|
96
|
+
id: string;
|
|
97
|
+
content: string;
|
|
98
|
+
images?: string[];
|
|
99
|
+
createdAt?: number;
|
|
100
|
+
turnId?: string;
|
|
101
|
+
};
|
|
102
|
+
export type AssistantChatMessage = {
|
|
103
|
+
id: string;
|
|
104
|
+
role: "assistant";
|
|
105
|
+
lifecycleStatus?: AIAssistantLifecycleStatus;
|
|
106
|
+
statusText?: string;
|
|
107
|
+
createdAt?: number;
|
|
108
|
+
turnId?: string;
|
|
109
|
+
messageId?: string;
|
|
110
|
+
skeletons?: ReadonlyArray<ExcalidrawElementSkeleton>;
|
|
111
|
+
parseError?: string;
|
|
112
|
+
isComplete?: boolean;
|
|
113
|
+
stopReason?: "user" | "interrupted";
|
|
114
|
+
warningType?: AIRateLimitWarningDescriptor["variant"];
|
|
115
|
+
error?: {
|
|
116
|
+
code?: AI_ERROR_CODE | number;
|
|
117
|
+
message: string;
|
|
118
|
+
rateLimit?: number | null;
|
|
119
|
+
rateLimitRemaining?: number | null;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
export type ChatMessage = UserChatMessage | AssistantChatMessage;
|
|
123
|
+
export type AssistantChatTurnMessage = {
|
|
124
|
+
messageId?: string;
|
|
125
|
+
lifecycleStatus?: AIAssistantLifecycleStatus;
|
|
126
|
+
statusText?: string;
|
|
127
|
+
createdAt?: number;
|
|
128
|
+
skeletons?: ReadonlyArray<ExcalidrawElementSkeleton>;
|
|
129
|
+
parseError?: string;
|
|
130
|
+
isComplete?: boolean;
|
|
131
|
+
stopReason?: "user" | "interrupted";
|
|
132
|
+
error?: AssistantChatMessage["error"];
|
|
133
|
+
};
|
|
134
|
+
export type ChatTurn = {
|
|
135
|
+
turnId: string;
|
|
136
|
+
prompt: string;
|
|
137
|
+
images?: string[];
|
|
138
|
+
createdAt?: number;
|
|
139
|
+
updatedAt?: number;
|
|
140
|
+
assistantMessages: AssistantChatTurnMessage[];
|
|
141
|
+
};
|
|
142
|
+
export type ChatConversation = {
|
|
143
|
+
id: string;
|
|
144
|
+
title: string;
|
|
145
|
+
turns: ChatTurn[];
|
|
146
|
+
updatedAt: number;
|
|
147
|
+
};
|
|
148
|
+
export interface TTARateLimits {
|
|
149
|
+
rateLimit: number;
|
|
150
|
+
rateLimitRemaining: number;
|
|
151
|
+
}
|
|
152
|
+
export type TTAChatScrollOptions = {
|
|
153
|
+
keepElementTopVisible?: HTMLElement | null;
|
|
154
|
+
behavior?: ScrollBehavior;
|
|
155
|
+
};
|
|
156
|
+
export interface TTAPersistenceAdapter {
|
|
157
|
+
loadHistory(): Promise<ChatConversation[]>;
|
|
158
|
+
saveHistory(history: ChatConversation[]): Promise<void>;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Return `undefined` to use the built-in warning/error rendering.
|
|
162
|
+
* Receives a shared warning descriptor as the first argument.
|
|
163
|
+
* Returning a node replaces the full assistant message row.
|
|
164
|
+
*/
|
|
165
|
+
export type TTADialogRenderWarning = (warning: AIRateLimitWarningDescriptor, chatMessage: Extract<ChatMessage, {
|
|
166
|
+
role: "assistant";
|
|
167
|
+
}>) => ReactNode | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ExcalidrawElementSkeleton } from "@excalidraw/element";
|
|
2
|
+
import type { AssistantChatMessage } from "./types";
|
|
3
|
+
import type { AppClassProperties, AppState } from "../types";
|
|
4
|
+
export type AIAssistantPreviewStatus = "idle" | "loading" | "done" | "unavailable";
|
|
5
|
+
type AIAssistantPreviewState = {
|
|
6
|
+
previewSvg: string | null;
|
|
7
|
+
status: AIAssistantPreviewStatus;
|
|
8
|
+
};
|
|
9
|
+
type UseAIAssistantPreviewOptions = {
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const renderAIAssistantPreviewDataUrl: ({ app, skeletons, theme, }: {
|
|
13
|
+
app: AppClassProperties;
|
|
14
|
+
skeletons: ReadonlyArray<ExcalidrawElementSkeleton>;
|
|
15
|
+
theme: AppState["theme"];
|
|
16
|
+
}) => Promise<string | null>;
|
|
17
|
+
export declare const useAIAssistantPreview: (message: AssistantChatMessage, options?: UseAIAssistantPreviewOptions) => AIAssistantPreviewState;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AIStreamPartialPayload } from "./types";
|
|
2
|
+
import type { AppClassProperties } from "../types";
|
|
3
|
+
type ThrottledStreamingCanvasPreviewRenderer = {
|
|
4
|
+
(result: AIStreamPartialPayload, messageId: string): void;
|
|
5
|
+
flush: () => void;
|
|
6
|
+
cancel: () => void;
|
|
7
|
+
};
|
|
8
|
+
type UseAIStreamingCanvasPreviewOptions = {
|
|
9
|
+
app: AppClassProperties;
|
|
10
|
+
removeGeneratedElementsByMessageId: (messageId: string | null) => void;
|
|
11
|
+
commitQueuedGenerationReplacements: (activeMessageId?: string | null) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const useAIStreamingCanvasPreview: ({ app, removeGeneratedElementsByMessageId, commitQueuedGenerationReplacements, }: UseAIStreamingCanvasPreviewOptions) => {
|
|
14
|
+
applyStreamingCanvasPreviewResult: (result: AIStreamPartialPayload, messageId: string) => void;
|
|
15
|
+
throttledApplyStreamingCanvasPreviewResult: ThrottledStreamingCanvasPreviewRenderer;
|
|
16
|
+
clearStreamingCanvasPreview: () => void;
|
|
17
|
+
clearActiveCanvasDraftFromCanvas: () => void;
|
|
18
|
+
resetActiveCanvasDraft: () => void;
|
|
19
|
+
resetStreamingCanvasPreviewState: () => void;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type AIGenerateRequestPayload, type ChatMessage } from "./types";
|
|
2
|
+
import type { Dispatch, SetStateAction } from "react";
|
|
3
|
+
import type { TTATransportAdapter } from "./client";
|
|
4
|
+
import type { useI18n } from "../i18n";
|
|
5
|
+
import type { AppClassProperties } from "../types";
|
|
6
|
+
type UseAIStreamingLifecycleOptions = {
|
|
7
|
+
app: AppClassProperties;
|
|
8
|
+
chatMessages: ChatMessage[];
|
|
9
|
+
t: ReturnType<typeof useI18n>["t"];
|
|
10
|
+
setChatMessages: Dispatch<SetStateAction<ChatMessage[]>>;
|
|
11
|
+
applyServerChatMetadata: (metadata: {
|
|
12
|
+
chatId?: string | null;
|
|
13
|
+
turnId?: string | null;
|
|
14
|
+
messageId?: string | null;
|
|
15
|
+
updatedAt?: number | null;
|
|
16
|
+
}) => void;
|
|
17
|
+
removeGeneratedElementsByMessageId: (messageId: string | null) => void;
|
|
18
|
+
commitQueuedGenerationReplacements: (activeMessageId?: string | null) => void;
|
|
19
|
+
streamFetch: TTATransportAdapter["stream"];
|
|
20
|
+
onRateLimitInfo?: (rateLimitInfo: {
|
|
21
|
+
rateLimit?: number | null;
|
|
22
|
+
rateLimitRemaining?: number | null;
|
|
23
|
+
}) => void;
|
|
24
|
+
};
|
|
25
|
+
export declare const useAIStreamingLifecycle: ({ app, chatMessages, t, setChatMessages, applyServerChatMetadata, removeGeneratedElementsByMessageId, commitQueuedGenerationReplacements, streamFetch, onRateLimitInfo, }: UseAIStreamingLifecycleOptions) => {
|
|
26
|
+
clearStreamingCanvasPreview: () => void;
|
|
27
|
+
clearActiveCanvasDraftFromCanvas: () => void;
|
|
28
|
+
resetActiveCanvasDraft: () => void;
|
|
29
|
+
cancelActiveStream: () => void;
|
|
30
|
+
cancelPendingCanvasPreviewRenders: () => void;
|
|
31
|
+
setStopRequested: (value: boolean) => void;
|
|
32
|
+
generateResponse: (assistantId: string, payload: AIGenerateRequestPayload) => Promise<void>;
|
|
33
|
+
};
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ChatConversation, ChatMessage, TTAPersistenceAdapter } from "./types";
|
|
2
|
+
type UseTTAChatHistoryOptions = {
|
|
3
|
+
chatMessages: ChatMessage[];
|
|
4
|
+
persistenceAdapter: TTAPersistenceAdapter;
|
|
5
|
+
};
|
|
6
|
+
type SaveConversationToHistoryOptions = {
|
|
7
|
+
updatedAt?: number | null;
|
|
8
|
+
};
|
|
9
|
+
export declare const useTTAChatHistory: ({ chatMessages, persistenceAdapter, }: UseTTAChatHistoryOptions) => {
|
|
10
|
+
activeChatId: string;
|
|
11
|
+
chatHistory: ChatConversation[];
|
|
12
|
+
latestHistoryChat: ChatConversation | null;
|
|
13
|
+
saveConversationToHistory: (chatId: string, messages: ChatMessage[], options?: SaveConversationToHistoryOptions) => void;
|
|
14
|
+
setActiveChatId: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
15
|
+
setActiveChatUpdatedAt: import("react").Dispatch<import("react").SetStateAction<number | null>>;
|
|
16
|
+
setChatHistory: (args_0: ChatConversation[] | ((prev: ChatConversation[]) => ChatConversation[])) => void;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type AI_ERROR_CODE } from "./types";
|
|
2
|
+
export declare const AI_CLIENT_ERRORS: {
|
|
3
|
+
readonly INVALID_RESULT: 1001;
|
|
4
|
+
};
|
|
5
|
+
type AIChatError = {
|
|
6
|
+
code?: AI_ERROR_CODE | number;
|
|
7
|
+
message?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const isLikelyConnectionError: (message: string) => boolean;
|
|
10
|
+
export declare const isLikelyServerUnavailableError: (message: string) => boolean;
|
|
11
|
+
export declare const getAIErrorMessageKey: (error: AIChatError, opts?: {
|
|
12
|
+
isOffline?: boolean;
|
|
13
|
+
}) => "ai.chat.errors.rateLimit" | "ai.chat.errors.invalidResult" | "ai.chat.errors.serverUnavailable" | "ai.chat.errors.offline" | "ai.chat.errors.connection" | "ai.chat.errors.requestFailed";
|
|
14
|
+
export {};
|
|
@@ -26,6 +26,9 @@ export declare const actionAddToLibrary: {
|
|
|
26
26
|
multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
|
|
27
27
|
selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
28
28
|
isBindingEnabled: boolean;
|
|
29
|
+
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
30
|
+
bindingPreference: "enabled" | "disabled";
|
|
31
|
+
isMidpointSnappingEnabled: boolean;
|
|
29
32
|
startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
|
|
30
33
|
suggestedBinding: {
|
|
31
34
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
@@ -40,7 +43,7 @@ export declare const actionAddToLibrary: {
|
|
|
40
43
|
};
|
|
41
44
|
editingFrame: string | null;
|
|
42
45
|
elementsToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawElement>[] | null;
|
|
43
|
-
editingTextElement: import("@excalidraw/element/types").
|
|
46
|
+
editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
|
|
44
47
|
activeTool: {
|
|
45
48
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
46
49
|
locked: boolean;
|
|
@@ -130,7 +133,7 @@ export declare const actionAddToLibrary: {
|
|
|
130
133
|
height: number;
|
|
131
134
|
offsetTop: number;
|
|
132
135
|
offsetLeft: number;
|
|
133
|
-
fileHandle: import("
|
|
136
|
+
fileHandle: import("../data/filesystem").FileSystemHandle | null;
|
|
134
137
|
collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
|
|
135
138
|
stats: {
|
|
136
139
|
open: boolean;
|
|
@@ -179,6 +182,9 @@ export declare const actionAddToLibrary: {
|
|
|
179
182
|
multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
|
|
180
183
|
selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
181
184
|
isBindingEnabled: boolean;
|
|
185
|
+
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
186
|
+
bindingPreference: "enabled" | "disabled";
|
|
187
|
+
isMidpointSnappingEnabled: boolean;
|
|
182
188
|
startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
|
|
183
189
|
suggestedBinding: {
|
|
184
190
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
@@ -193,7 +199,7 @@ export declare const actionAddToLibrary: {
|
|
|
193
199
|
};
|
|
194
200
|
editingFrame: string | null;
|
|
195
201
|
elementsToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawElement>[] | null;
|
|
196
|
-
editingTextElement: import("@excalidraw/element/types").
|
|
202
|
+
editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
|
|
197
203
|
activeTool: {
|
|
198
204
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
199
205
|
locked: boolean;
|
|
@@ -288,7 +294,7 @@ export declare const actionAddToLibrary: {
|
|
|
288
294
|
height: number;
|
|
289
295
|
offsetTop: number;
|
|
290
296
|
offsetLeft: number;
|
|
291
|
-
fileHandle: import("
|
|
297
|
+
fileHandle: import("../data/filesystem").FileSystemHandle | null;
|
|
292
298
|
collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
|
|
293
299
|
stats: {
|
|
294
300
|
open: boolean;
|
|
@@ -337,6 +343,9 @@ export declare const actionAddToLibrary: {
|
|
|
337
343
|
multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
|
|
338
344
|
selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
339
345
|
isBindingEnabled: boolean;
|
|
346
|
+
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
347
|
+
bindingPreference: "enabled" | "disabled";
|
|
348
|
+
isMidpointSnappingEnabled: boolean;
|
|
340
349
|
startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
|
|
341
350
|
suggestedBinding: {
|
|
342
351
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
@@ -351,7 +360,7 @@ export declare const actionAddToLibrary: {
|
|
|
351
360
|
};
|
|
352
361
|
editingFrame: string | null;
|
|
353
362
|
elementsToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawElement>[] | null;
|
|
354
|
-
editingTextElement: import("@excalidraw/element/types").
|
|
363
|
+
editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
|
|
355
364
|
activeTool: {
|
|
356
365
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
357
366
|
locked: boolean;
|
|
@@ -446,7 +455,7 @@ export declare const actionAddToLibrary: {
|
|
|
446
455
|
height: number;
|
|
447
456
|
offsetTop: number;
|
|
448
457
|
offsetLeft: number;
|
|
449
|
-
fileHandle: import("
|
|
458
|
+
fileHandle: import("../data/filesystem").FileSystemHandle | null;
|
|
450
459
|
collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
|
|
451
460
|
stats: {
|
|
452
461
|
open: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExcalidrawElement, ExcalidrawLinearElement } from "@excalidraw/element/types";
|
|
1
|
+
import type { ExcalidrawElement, ExcalidrawLinearElement, ExcalidrawTextElement } from "@excalidraw/element/types";
|
|
2
2
|
import type { Mutable } from "@excalidraw/common/utility-types";
|
|
3
3
|
import type { AppState } from "../types";
|
|
4
4
|
export declare const actionUnbindText: {
|
|
@@ -46,6 +46,9 @@ export declare const actionBindText: {
|
|
|
46
46
|
multiElement: import("@excalidraw/element/types").NonDeleted<ExcalidrawLinearElement> | null;
|
|
47
47
|
selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
48
48
|
isBindingEnabled: boolean;
|
|
49
|
+
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
50
|
+
bindingPreference: "enabled" | "disabled";
|
|
51
|
+
isMidpointSnappingEnabled: boolean;
|
|
49
52
|
startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
|
|
50
53
|
suggestedBinding: {
|
|
51
54
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
@@ -60,7 +63,7 @@ export declare const actionBindText: {
|
|
|
60
63
|
};
|
|
61
64
|
editingFrame: string | null;
|
|
62
65
|
elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
|
|
63
|
-
editingTextElement:
|
|
66
|
+
editingTextElement: ExcalidrawTextElement | null;
|
|
64
67
|
activeTool: {
|
|
65
68
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
66
69
|
locked: boolean;
|
|
@@ -152,7 +155,7 @@ export declare const actionBindText: {
|
|
|
152
155
|
height: number;
|
|
153
156
|
offsetTop: number;
|
|
154
157
|
offsetLeft: number;
|
|
155
|
-
fileHandle: import("
|
|
158
|
+
fileHandle: import("../data/filesystem").FileSystemHandle | null;
|
|
156
159
|
collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
|
|
157
160
|
stats: {
|
|
158
161
|
open: boolean;
|
|
@@ -216,6 +219,9 @@ export declare const actionWrapTextInContainer: {
|
|
|
216
219
|
multiElement: import("@excalidraw/element/types").NonDeleted<ExcalidrawLinearElement> | null;
|
|
217
220
|
selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
218
221
|
isBindingEnabled: boolean;
|
|
222
|
+
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
223
|
+
bindingPreference: "enabled" | "disabled";
|
|
224
|
+
isMidpointSnappingEnabled: boolean;
|
|
219
225
|
startBoundElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
|
|
220
226
|
suggestedBinding: {
|
|
221
227
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
@@ -230,7 +236,7 @@ export declare const actionWrapTextInContainer: {
|
|
|
230
236
|
};
|
|
231
237
|
editingFrame: string | null;
|
|
232
238
|
elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
|
|
233
|
-
editingTextElement:
|
|
239
|
+
editingTextElement: ExcalidrawTextElement | null;
|
|
234
240
|
activeTool: {
|
|
235
241
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
236
242
|
locked: boolean;
|
|
@@ -322,7 +328,7 @@ export declare const actionWrapTextInContainer: {
|
|
|
322
328
|
height: number;
|
|
323
329
|
offsetTop: number;
|
|
324
330
|
offsetLeft: number;
|
|
325
|
-
fileHandle: import("
|
|
331
|
+
fileHandle: import("../data/filesystem").FileSystemHandle | null;
|
|
326
332
|
collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
|
|
327
333
|
stats: {
|
|
328
334
|
open: boolean;
|