diff --git a/docs/AI_CONFIGURATION.md b/docs/AI_CONFIGURATION.md
new file mode 100644
index 00000000..4a6af7ac
--- /dev/null
+++ b/docs/AI_CONFIGURATION.md
@@ -0,0 +1,77 @@
+# AI models and credential sources
+
+AI remains optional. Text, images and files are sent only when an AI workflow is
+invoked. Provider profiles select the API family, base URL and credential source;
+model entries select a model ID and its capabilities.
+
+## Credential storage
+
+Existing profiles and Taskbone continue using their saved keys by default. These
+are **obfuscated**, not plain text, in the vault's plugin settings. Obfuscation is
+reversible and is not encryption.
+
+On Obsidian 1.11.4 or newer, create a secret in Obsidian's settings, then choose
+**Obsidian SecretStorage (this device)** and its name in the provider or Taskbone
+settings. Choosing that source removes the saved key from Excalidraw settings.
+Only the source and reference name are synced. Configure that secret on each
+device; an unavailable secret produces an error rather than falling back to a
+synced key. Excalidraw does not create, change or delete shared secrets.
+
+Switching back to **Obfuscated settings** requires entering a key again. Existing
+backups and version-control history may still contain previously saved keys.
+The script-facing `getAISettings()` exposes availability, never credential values
+or secret names. Secret values are resolved afresh for each request.
+
+## Reasoning effort
+
+Add or edit an OpenAI text model and select **Reasoning effort**. **Default** omits
+the parameter and keeps the API's default. Choices are filtered through the
+reviewed capability table in `src/utils/aiReasoning.ts`; unrecognized models offer
+Default only. Dated snapshots of listed model IDs use the same capabilities.
+
+For example, `gpt-6.1-sol` supports low, medium, high, xhigh and max; Terra and Luna
+also support none. Unsupported stored or scripted values fail before transport.
+OpenAI-only fields never enter Anthropic, Google, xAI or compatible-provider
+requests. Sampling parameters are omitted for reasoning models that reject them,
+including models reasoning at their API default. GPT-6 uses
+`max_completion_tokens`, including its reasoning-token budget.
+
+EA requests inherit the selected text-model preference. A `reasoningEffort`
+override chooses another supported level; `null` explicitly restores the API
+default for that request. Raw `model` overrides do not inherit another model's
+effort. ExcaliAI applies and displays the selected OpenAI model's effort for
+text results, image analysis and the prompt-writing step before image generation.
+
+## Recommendations for new installations
+
+| Purpose | Default | Reason |
+| --- | --- | --- |
+| Text | `gpt-6-luna` | Efficient general text tasks |
+| Image-aware text | `gpt-6.1-terra` | Visual reasoning |
+| Image generation/editing | `gpt-image-2.6-flare` | Fast interactive iteration |
+
+The new-install catalog also offers Sol, Claude Sonnet/Haiku/Opus 5.5, Gemini 3.8
+Flash, Grok 4.7, GPT Image 2.6 Sunburst, stable Gemini image models and Grok Imagine
+Image 2.0. Existing users keep their complete model maps, defaults, provider URLs,
+keys and custom fields; an upgrade never replaces their configured entries.
+Add current model IDs explicitly when retiring an old user-configured model.
+
+GPT Image 2.6 supports custom dimensions. The settings supply a useful subset
+within its documented limits rather than claiming that the old GPT Image sizes
+are exhaustive. PNG remains the pipeline's default output; SVG/GIF-specific
+options are not exposed by this change. Gemini Lite exposes only its supported
+1K tier; xAI pixel selections are converted to its `aspect_ratio` parameter.
+
+Provider documentation reviewed on November 16, 2026:
+
+- [OpenAI model compatibility](https://developers.openai.com/api/docs/guides/latest-model)
+- [OpenAI image generation and dimensions](https://developers.openai.com/api/docs/guides/image-generation)
+- [Claude models](https://platform.claude.com/docs/en/models/overview)
+- [Gemini models](https://ai.google.dev/gemini-api/docs/models)
+- [Gemini image Lite](https://aistudio.google.com/docs/models/gemini-3.1-flash-lite-image)
+- [xAI image generation](https://docs.x.ai/developers/model-capabilities/images/generation)
+
+Automated tests use fake credentials and mocked transport. They validate request
+construction, response normalization, secret isolation and persistence without
+paid API access. Live model availability, account permissions, provider billing
+and output quality require a separate test with the maintainer's own keys.
diff --git a/ea-scripts/ExcaliAI.md b/ea-scripts/ExcaliAI.md
index d305a461..04423c68 100644
--- a/ea-scripts/ExcaliAI.md
+++ b/ea-scripts/ExcaliAI.md
@@ -1,1259 +1,1522 @@
/*
-
-
-
-
-
-```js*/
-let dirty=false;
-
-if(!ea.verifyMinimumPluginVersion || !ea.verifyMinimumPluginVersion("2.23.0")) {
- new Notice("This script requires Excalidraw 2.23.0 or later. Please update the plugin.");
- return;
-}
-
-const EXCALIAI_SETTINGS_VERSION = 1;
-const DEFAULT_IMAGE_SIZE = "1024x1024";
-
-const TASK_EXECUTION_MODES = {
- TEXT_RESULT: "text-result",
- IMAGE_PROMPT: "image-prompt",
- IMAGE_DIRECT: "image-direct",
- IMAGE_EDIT: "image-edit",
-};
-
-const TASK_RESULT_TYPES = {
- HTML: "html",
- MINDMAP: "mindmap",
- MERMAID: "mermaid",
- SVG: "svg",
- IMAGE: "image",
- IMAGE_SILENT: "image-silent",
-};
-
-const TASK_INPUT_RULES = {
- DISABLED: "disabled",
- OPTIONAL: "optional",
- REQUIRED: "required",
-};
-
-const TASK_MASK_MODES = {
- DISABLED: "disabled",
- OPTIONAL: "optional",
- REQUIRED: "required",
-};
-
-const TASK_RUNTIME_APIS = {
- NONE: "",
- MINDMAP_BUILDER: "mindmap-builder",
-};
-
-const VALID_TASK_EXECUTION_MODES = Object.values(TASK_EXECUTION_MODES);
-const VALID_TASK_RESULT_TYPES = Object.values(TASK_RESULT_TYPES);
-const VALID_TASK_INPUT_RULES = Object.values(TASK_INPUT_RULES);
-const VALID_TASK_MASK_MODES = Object.values(TASK_MASK_MODES);
-const VALID_TASK_RUNTIME_APIS = Object.values(TASK_RUNTIME_APIS);
-
-const TASK_EXECUTION_MODE_META = {
- [TASK_EXECUTION_MODES.TEXT_RESULT]: {
- label: "Text response",
- description: "Uses the text or multimodal model and returns structured output such as HTML, Mermaid, a mind map, or Excalidraw strokes.",
- },
- [TASK_EXECUTION_MODES.IMAGE_PROMPT]: {
- label: "Write prompt, then generate image",
- description: "Uses the text model to write an image prompt from the canvas selection and/or user prompt, then sends that prompt to the image model.",
- },
- [TASK_EXECUTION_MODES.IMAGE_DIRECT]: {
- label: "Send prompt straight to image model",
- description: "Sends only the user's prompt to the image model. No text-model prompt writing step and no canvas image input.",
- },
- [TASK_EXECUTION_MODES.IMAGE_EDIT]: {
- label: "Edit selected image",
- description: "Uses the selected image as the source and applies either a mask edit or a prompt-based transform.",
- },
-};
-
-const TASK_RESULT_TYPE_META = {
- [TASK_RESULT_TYPES.HTML]: {
- label: "HTML",
- description: "Embeds the response as a single HTML result.",
- },
- [TASK_RESULT_TYPES.MINDMAP]: {
- label: "Mind Map",
- description: "Imports the response into MindMap Builder.",
- runtimeRequirement: TASK_RUNTIME_APIS.MINDMAP_BUILDER,
- },
- [TASK_RESULT_TYPES.MERMAID]: {
- label: "Mermaid",
- description: "Creates a Mermaid diagram.",
- },
- [TASK_RESULT_TYPES.SVG]: {
- label: "Excalidraw Strokes",
- description: "Uses SVG behind the scenes to generate Excalidraw strokes.",
- },
- [TASK_RESULT_TYPES.IMAGE]: {
- label: "Image + prompt note",
- description: "Generates an image and adds the model's revised prompt underneath when available.",
- },
- [TASK_RESULT_TYPES.IMAGE_SILENT]: {
- label: "Image only",
- description: "Generates only the image, without adding the revised prompt underneath.",
- },
-};
-
-const getTaskExecutionModeMeta = (mode) => (
- TASK_EXECUTION_MODE_META[mode] ?? TASK_EXECUTION_MODE_META[TASK_EXECUTION_MODES.TEXT_RESULT]
-);
-
-const getTaskExecutionModeLabel = (mode) => (
- getTaskExecutionModeMeta(mode).label
-);
-
-const getTaskExecutionModeDescription = (mode) => (
- getTaskExecutionModeMeta(mode).description
-);
-
-const getTaskResultTypeMeta = (resultType) => (
- TASK_RESULT_TYPE_META[resultType] ?? TASK_RESULT_TYPE_META[TASK_RESULT_TYPES.HTML]
-);
-
-const getTaskResultTypeLabel = (resultType) => (
- getTaskResultTypeMeta(resultType).label
-);
-
-const getTaskResultTypeDescription = (resultType) => (
- getTaskResultTypeMeta(resultType).description
-);
-
-const getTaskRuntimeRequirement = (taskConfig) => (
- getTaskResultTypeMeta(taskConfig?.execution?.resultType ?? TASK_RESULT_TYPES.HTML).runtimeRequirement
- ?? TASK_RUNTIME_APIS.NONE
-);
-
-const getTaskRuntimeRequirementLabel = (runtimeRequirement) => {
- switch(runtimeRequirement) {
- case TASK_RUNTIME_APIS.MINDMAP_BUILDER:
- return "MindMap Builder";
- default:
- return "None";
- }
-};
-
-const normalizeEnumValue = (value, validValues, fallbackValue) => (
- validValues.includes(value) ? value : fallbackValue
-);
-
-const cloneJSON = (value) => {
- if(value == null) {
- return value;
- }
- return JSON.parse(JSON.stringify(value));
-};
-
-const createTaskIdFromName = (value = "") => {
- const normalizedValue = String(value ?? "")
- .trim()
- .toLowerCase()
- .replace(/[^a-z0-9]+/g, "-")
- .replace(/^-+|-+$/g, "");
- return normalizedValue || "task";
-};
-
-const getDefaultOutputInstruction = (resultType) => {
- switch(resultType) {
- case TASK_RESULT_TYPES.HTML:
- return "Turn this into a single html file using tailwind. Return a single message containing only the html file in a codeblock.";
- case TASK_RESULT_TYPES.MINDMAP:
- return "Return only the mind map as plain text. Use one # heading for the central node, then nested - bullets for branches. Do not use bold, italics, code fences, tables, or explanatory text.";
- case TASK_RESULT_TYPES.MERMAID:
- return "Return a single message containing only the mermaid diagram in a codeblock.";
- case TASK_RESULT_TYPES.SVG:
- return "Return a single message containing only the SVG code in an html codeblock.";
- case TASK_RESULT_TYPES.IMAGE:
- case TASK_RESULT_TYPES.IMAGE_SILENT:
- return "Return a single message with the generated image prompt in a codeblock";
- default:
- return "";
- }
-};
-
-const getDefaultResultTypeForMode = (mode) => {
- switch(mode) {
- case TASK_EXECUTION_MODES.IMAGE_PROMPT:
- case TASK_EXECUTION_MODES.IMAGE_DIRECT:
- case TASK_EXECUTION_MODES.IMAGE_EDIT:
- return TASK_RESULT_TYPES.IMAGE;
- default:
- return TASK_RESULT_TYPES.HTML;
- }
-};
-
-const normalizeTaskConfig = (task = {}, index = 0) => {
- const execution = task.execution ?? {};
- const mode = normalizeEnumValue(
- execution.mode,
- VALID_TASK_EXECUTION_MODES,
- TASK_EXECUTION_MODES.TEXT_RESULT,
- );
- const resultType = normalizeEnumValue(
- execution.resultType,
- VALID_TASK_RESULT_TYPES,
- getDefaultResultTypeForMode(mode),
- );
- const imageInputFallback = mode === TASK_EXECUTION_MODES.IMAGE_DIRECT
- ? TASK_INPUT_RULES.DISABLED
- : mode === TASK_EXECUTION_MODES.IMAGE_EDIT
- ? TASK_INPUT_RULES.REQUIRED
- : TASK_INPUT_RULES.OPTIONAL;
-
- return {
- id: createTaskIdFromName(task.id ?? task.name ?? `task-${index + 1}`),
- name: String(task.name ?? "").trim() || `Task ${index + 1}`,
- help: String(task.help ?? "").trim(),
- systemPrompt: task.systemPrompt == null ? null : String(task.systemPrompt),
- outputInstruction: String(task.outputInstruction ?? getDefaultOutputInstruction(resultType)),
- execution: {
- mode,
- resultType,
- userPrompt: normalizeEnumValue(
- execution.userPrompt,
- VALID_TASK_INPUT_RULES,
- TASK_INPUT_RULES.OPTIONAL,
- ),
- imageInput: normalizeEnumValue(
- execution.imageInput,
- VALID_TASK_INPUT_RULES,
- imageInputFallback,
- ),
- maskMode: normalizeEnumValue(
- execution.maskMode,
- VALID_TASK_MASK_MODES,
- mode === TASK_EXECUTION_MODES.IMAGE_EDIT
- ? TASK_MASK_MODES.OPTIONAL
- : TASK_MASK_MODES.DISABLED,
- ),
- requiresApi: getTaskResultTypeMeta(resultType).runtimeRequirement ?? TASK_RUNTIME_APIS.NONE,
- },
- };
-};
-
-const normalizeTaskConfigs = (tasks, {fallbackToDefaults = false} = {}) => {
- if(!Array.isArray(tasks)) {
- return fallbackToDefaults ? normalizeTaskConfigs(createDefaultTaskConfigs()) : [];
- }
-
- const usedIds = new Set();
- return tasks.map((task, index) => {
- const normalizedTask = normalizeTaskConfig(task, index);
- if(normalizedTask.execution.mode !== TASK_EXECUTION_MODES.IMAGE_EDIT) {
- normalizedTask.execution.maskMode = TASK_MASK_MODES.DISABLED;
- }
- let nextId = normalizedTask.id || createTaskIdFromName(normalizedTask.name) || `task-${index + 1}`;
- let duplicateCount = 2;
- while(usedIds.has(nextId)) {
- nextId = `${normalizedTask.id}-${duplicateCount++}`;
- }
- usedIds.add(nextId);
- normalizedTask.id = nextId;
- return normalizedTask;
- });
-};
-
-const createDefaultTaskConfigs = () => ([
- {
- id: "challenge-my-thinking",
- name: "Challenge my thinking",
- help: "Turn the selected image and optional prompt into a Mermaid mind map. If conversion fails, open More Tools > Mermaid to Excalidraw and edit the generated script.",
- systemPrompt: `Your task is to interpret a screenshot of a whiteboard, translating its ideas into a Mermaid graph. The whiteboard will encompass thoughts on a subject. Within the mind map, distinguish ideas that challenge, dispute, or contradict the whiteboard content. Additionally, include concepts that expand, complement, or advance the user's thinking. Utilize the Mermaid graph diagram type and present the resulting Mermaid diagram within a code block. Ensure the Mermaid script excludes the use of parentheses ().`,
- outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.MERMAID),
- execution: {
- mode: TASK_EXECUTION_MODES.TEXT_RESULT,
- resultType: TASK_RESULT_TYPES.MERMAID,
- userPrompt: TASK_INPUT_RULES.OPTIONAL,
- imageInput: TASK_INPUT_RULES.OPTIONAL,
- maskMode: TASK_MASK_MODES.DISABLED,
- requiresApi: TASK_RUNTIME_APIS.NONE,
- },
- },
- {
- id: "convert-sketch-to-shapes",
- name: "Convert sketch to shapes",
- help: "Convert selected sketches into Excalidraw strokes. Works best with a small number of simple shapes. Experimental.",
- systemPrompt: `Given an image featuring various geometric shapes drawn by the user, your objective is to analyze the input and generate SVG code that accurately represents these shapes. Your output will be the SVG code enclosed in an HTML code block.`,
- outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.SVG),
- execution: {
- mode: TASK_EXECUTION_MODES.TEXT_RESULT,
- resultType: TASK_RESULT_TYPES.SVG,
- userPrompt: TASK_INPUT_RULES.OPTIONAL,
- imageInput: TASK_INPUT_RULES.OPTIONAL,
- maskMode: TASK_MASK_MODES.DISABLED,
- requiresApi: TASK_RUNTIME_APIS.NONE,
- },
- },
- {
- id: "create-a-simple-excalidraw-icon",
- name: "Create a simple Excalidraw icon",
- help: "Turn a text prompt into a simple icon and insert it into Excalidraw as strokes. Text prompt only. Experimental.",
- systemPrompt: `Given a description of an SVG image from the user, your objective is to generate the corresponding SVG code. Avoid incorporating textual elements within the generated SVG. Your output should be the resulting SVG code enclosed in an HTML code block.`,
- outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.SVG),
- execution: {
- mode: TASK_EXECUTION_MODES.TEXT_RESULT,
- resultType: TASK_RESULT_TYPES.SVG,
- userPrompt: TASK_INPUT_RULES.OPTIONAL,
- imageInput: TASK_INPUT_RULES.DISABLED,
- maskMode: TASK_MASK_MODES.DISABLED,
- requiresApi: TASK_RUNTIME_APIS.NONE,
- },
- },
- {
- id: "create-a-stick-figure",
- name: "Create a stick figure",
- help: "Send only the text prompt to the configured image model. Be specific. To keep the prompt unchanged, start with: 'DO NOT add any detail, just use it AS-IS:'",
- systemPrompt: "You will receive a prompt from the user. Your task involves drawing a simple stick figure or a scene involving a few stick figures based on the user's prompt. Create the stick figure based on the following style description. DO NOT add any detail, just use it AS-IS: Create a simple stick figure character with a large round head and a face in the style of sketchy caricatures. The stick figure should have a rudimentary body composed of straight lines representing the arms and legs. Hands and toes should be represented with round shapes, do not add details such as fingers or toes. Use fine lines, smooth curves, rounded shapes. The stick figure should retain a playful and childlike simplicity, reminiscent of a doodle someone might draw on the corner of a notebook page. Create a black and white drawing, a hand-drawn figure on white background.",
- outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.IMAGE),
- execution: {
- mode: TASK_EXECUTION_MODES.IMAGE_PROMPT,
- resultType: TASK_RESULT_TYPES.IMAGE,
- userPrompt: TASK_INPUT_RULES.OPTIONAL,
- imageInput: TASK_INPUT_RULES.DISABLED,
- maskMode: TASK_MASK_MODES.DISABLED,
- requiresApi: TASK_RUNTIME_APIS.NONE,
- },
- },
- {
- id: "edit-an-image",
- name: "Edit an image",
- help: "Image elements are used as the source image. In mask mode, shapes on top become the mask. Turn mask edit off to flatten non-image elements into the source image and apply a prompt-based transform.",
- systemPrompt: null,
- outputInstruction: "",
- execution: {
- mode: TASK_EXECUTION_MODES.IMAGE_EDIT,
- resultType: TASK_RESULT_TYPES.IMAGE,
- userPrompt: TASK_INPUT_RULES.REQUIRED,
- imageInput: TASK_INPUT_RULES.REQUIRED,
- maskMode: TASK_MASK_MODES.OPTIONAL,
- requiresApi: TASK_RUNTIME_APIS.NONE,
- },
- },
- {
- id: "generate-an-image-from-image-and-prompt",
- name: "Generate an image from image and prompt",
- help: "Generate an image from the selected image and your prompt. Add context in the prompt to guide how the image should be interpreted.",
- systemPrompt: "Your task involves receiving an image and a textual prompt from the user. Your goal is to craft a detailed, accurate, and descriptive narrative of the image, tailored for effective image generation. Utilize the user-provided text prompt to inform and guide your depiction of the image. Ensure the resulting image remains text-free.",
- outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.IMAGE),
- execution: {
- mode: TASK_EXECUTION_MODES.IMAGE_PROMPT,
- resultType: TASK_RESULT_TYPES.IMAGE,
- userPrompt: TASK_INPUT_RULES.OPTIONAL,
- imageInput: TASK_INPUT_RULES.OPTIONAL,
- maskMode: TASK_MASK_MODES.DISABLED,
- requiresApi: TASK_RUNTIME_APIS.NONE,
- },
- },
- {
- id: "generate-an-image-from-prompt",
- name: "Generate an image from prompt",
- help: "Send only the text prompt to the configured image model. Be specific. To keep the prompt unchanged, start with: 'DO NOT add any detail, just use it AS-IS:'",
- systemPrompt: null,
- outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.IMAGE),
- execution: {
- mode: TASK_EXECUTION_MODES.IMAGE_DIRECT,
- resultType: TASK_RESULT_TYPES.IMAGE,
- userPrompt: TASK_INPUT_RULES.OPTIONAL,
- imageInput: TASK_INPUT_RULES.DISABLED,
- maskMode: TASK_MASK_MODES.DISABLED,
- requiresApi: TASK_RUNTIME_APIS.NONE,
- },
- },
- {
- id: "generate-an-image-to-illustrate-a-quote",
- name: "Generate an image to illustrate a quote",
- help: "Turn a quote into an illustrated scene. Include the author's name if you want the result to reference them.",
- systemPrompt: "Your task involves transforming a user-provided quote into a detailed and imaginative illustration. Craft a visual representation that captures the essence of the quote and resonates well with a broad audience. If the Author's name is provided, aim to establish a connection between the illustration and the Author. This can be achieved by referencing a well-known story from the Author, situating the image in the Author's era or setting, or employing other creative methods of association. Additionally, provide preferences for styling, such as the chosen medium and artistic direction, to guide the image creation process. Ensure the resulting image remains text-free. Your task output should comprise a descriptive and detailed narrative aimed at facilitating the creation of a captivating illustration from the quote.",
- outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.IMAGE),
- execution: {
- mode: TASK_EXECUTION_MODES.IMAGE_PROMPT,
- resultType: TASK_RESULT_TYPES.IMAGE,
- userPrompt: TASK_INPUT_RULES.OPTIONAL,
- imageInput: TASK_INPUT_RULES.DISABLED,
- maskMode: TASK_MASK_MODES.DISABLED,
- requiresApi: TASK_RUNTIME_APIS.NONE,
- },
- },
- {
- id: "generate-4-icon-variants-based-on-input-image",
- name: "Generate 4 icon-variants based on input image",
- help: "Generate a 2x2 sheet of four icon variations from the selected sketch. Add a prompt if you want to steer the result.",
- systemPrompt: "Given a simple sketch and an optional text prompt from the user, your task is to generate a descriptive narrative tailored for effective image generation, capturing the style of the sketch. Utilize the text prompt to guide the description. Your objective is to instruct DALL-E to create a collage of four minimalist black and white hand-drawn pencil sketches in a 2x2 matrix format. Each sketch should convert the user's sketch into simple artistic SVG icons with transparent backgrounds. Ensure the resulting images remain text-free, maintaining a minimalist, easy-to-understand style, and omit framing borders. Only include a pencil in the drawing if it is explicitly mentioned in the user prompt or included in the sketch.",
- outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.IMAGE_SILENT),
- execution: {
- mode: TASK_EXECUTION_MODES.IMAGE_PROMPT,
- resultType: TASK_RESULT_TYPES.IMAGE_SILENT,
- userPrompt: TASK_INPUT_RULES.OPTIONAL,
- imageInput: TASK_INPUT_RULES.OPTIONAL,
- maskMode: TASK_MASK_MODES.DISABLED,
- requiresApi: TASK_RUNTIME_APIS.NONE,
- },
- },
- {
- id: "visual-brainstorm",
- name: "Visual brainstorm",
- help: "Generate an image from the selected image and prompt to spark new ideas.",
- systemPrompt: "Your objective is to interpret a screenshot of a whiteboard, creating an image aimed at sparking further thoughts on the subject. The whiteboard will present diverse ideas about a specific topic. Your generated image should achieve one of two purposes: highlighting concepts that challenge, dispute, or contradict the whiteboard content, or introducing ideas that expand, complement, or enrich the user's thinking. You have the option to include multiple tiles in the resulting image, resembling a sequence akin to a comic strip. Ensure that the image remains devoid of text.",
- outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.IMAGE),
- execution: {
- mode: TASK_EXECUTION_MODES.IMAGE_PROMPT,
- resultType: TASK_RESULT_TYPES.IMAGE,
- userPrompt: TASK_INPUT_RULES.OPTIONAL,
- imageInput: TASK_INPUT_RULES.OPTIONAL,
- maskMode: TASK_MASK_MODES.DISABLED,
- requiresApi: TASK_RUNTIME_APIS.NONE,
- },
- },
- {
- id: "wireframe-to-code",
- name: "Wireframe to code",
- help: "Interpret the selected wireframe and generate a web app as a single HTML file. You can copy the result from the embeddable menu.",
- systemPrompt: `You are an expert tailwind developer. A user will provide you with a low-fidelity wireframe of an application and you will return a single html file that uses tailwind to create the website. Use creative license to make the application more fleshed out. Write the necessary javascript code. If you need to insert an image, use placehold.co to create a placeholder image.`,
- outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.HTML),
- execution: {
- mode: TASK_EXECUTION_MODES.TEXT_RESULT,
- resultType: TASK_RESULT_TYPES.HTML,
- userPrompt: TASK_INPUT_RULES.OPTIONAL,
- imageInput: TASK_INPUT_RULES.OPTIONAL,
- maskMode: TASK_MASK_MODES.DISABLED,
- requiresApi: TASK_RUNTIME_APIS.NONE,
- },
- },
- {
- id: "create-mindmap",
- name: "Create Mindmap",
- help: "Create a hierarchical mind map from the selected image, if any, and your prompt, then import it into MindMap Builder. Requires MindMap Builder to be available.",
- systemPrompt: "You will receive a text prompt and may also receive an image. Create a mind map as a hierarchical plain-text outline based on the image content, if provided, and the text prompt. Return only the mind map. Use exactly one markdown H1 heading for the central node, then - bullets for branches and indented - bullets for sub-branches. Do not use bold, italics, code fences, numbering, commentary, or any markdown formatting other than the heading and bullet list.",
- outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.MINDMAP),
- execution: {
- mode: TASK_EXECUTION_MODES.TEXT_RESULT,
- resultType: TASK_RESULT_TYPES.MINDMAP,
- userPrompt: TASK_INPUT_RULES.OPTIONAL,
- imageInput: TASK_INPUT_RULES.OPTIONAL,
- maskMode: TASK_MASK_MODES.DISABLED,
- requiresApi: TASK_RUNTIME_APIS.MINDMAP_BUILDER,
- },
- },
-]);
-
-const DEFAULT_TASK_CONFIGS = normalizeTaskConfigs(createDefaultTaskConfigs());
-const DEFAULT_TASK_ID = DEFAULT_TASK_CONFIGS.find(task => task.id === "wireframe-to-code")?.id
- ?? DEFAULT_TASK_CONFIGS[0]?.id
- ?? "";
-
-const createDefaultState = (taskConfigs = []) => ({
- selectedTaskId: taskConfigs.find(task => task.id === DEFAULT_TASK_ID)?.id ?? taskConfigs[0]?.id ?? "",
- userPrompt: "",
- maskEdit: true,
- textModel: "",
- imageModel: "",
- maxTokens: "",
- imageSize: DEFAULT_IMAGE_SIZE,
-});
-
-const normalizeState = (state = {}, taskConfigs = []) => {
- const defaultState = createDefaultState(taskConfigs);
- const knownTaskIds = new Set(taskConfigs.map(task => task.id));
- const selectedTaskId = String(state.selectedTaskId ?? defaultState.selectedTaskId).trim();
- return {
- selectedTaskId: knownTaskIds.has(selectedTaskId) ? selectedTaskId : defaultState.selectedTaskId,
- userPrompt: String(state.userPrompt ?? defaultState.userPrompt),
- maskEdit: state.maskEdit !== false,
- textModel: String(state.textModel ?? defaultState.textModel),
- imageModel: String(state.imageModel ?? defaultState.imageModel),
- maxTokens: String(state.maxTokens ?? defaultState.maxTokens).trim(),
- imageSize: String(state.imageSize ?? defaultState.imageSize).trim() || defaultState.imageSize,
- };
-};
-
-const createDefaultExcaliAISettings = () => ({
- schemaVersion: EXCALIAI_SETTINGS_VERSION,
- config: {
- tasks: cloneJSON(DEFAULT_TASK_CONFIGS),
- },
- state: createDefaultState(DEFAULT_TASK_CONFIGS),
-});
-
-const LEGACY_TASK_NAME_TO_ID = Object.fromEntries(
- DEFAULT_TASK_CONFIGS.map(task => [task.name, task.id]),
-);
-
-const loadExcaliAISettings = (rawSettings) => {
- const sourceSettings = rawSettings && typeof rawSettings === "object" ? rawSettings : {};
- const normalizedSettings = createDefaultExcaliAISettings();
- normalizedSettings.config.tasks = normalizeTaskConfigs(sourceSettings.config?.tasks, {fallbackToDefaults: true});
-
- const legacyState = {
- selectedTaskId: LEGACY_TASK_NAME_TO_ID[String(sourceSettings["Agent's Task"] ?? "").trim()] ?? normalizedSettings.state.selectedTaskId,
- userPrompt: sourceSettings["User Prompt"] ?? normalizedSettings.state.userPrompt,
- maskEdit: sourceSettings["Mask Edit"] !== false,
- textModel: sourceSettings["Text Model"] ?? normalizedSettings.state.textModel,
- imageModel: sourceSettings["Image Model"] ?? normalizedSettings.state.imageModel,
- maxTokens: sourceSettings["Max Tokens"] ?? normalizedSettings.state.maxTokens,
- imageSize: sourceSettings["Image Size"] ?? normalizedSettings.state.imageSize,
- };
-
- normalizedSettings.state = normalizeState({
- ...legacyState,
- ...(sourceSettings.state ?? {}),
- }, normalizedSettings.config.tasks);
-
- return {
- settings: normalizedSettings,
- needsSave: JSON.stringify(sourceSettings) !== JSON.stringify(normalizedSettings),
- };
-};
-
-// --------------------------------------
-// Initialize values and settings
-// --------------------------------------
-let settings = ea.getScriptSettings();
-const loadedExcaliAISettings = loadExcaliAISettings(settings);
-settings = loadedExcaliAISettings.settings;
-if(loadedExcaliAISettings.needsSave) {
- await ea.setScriptSettings(settings);
-}
-
-let userPrompt = settings.state.userPrompt ?? "";
-let selectedTaskId = settings.state.selectedTaskId;
-let imageSize = settings.state.imageSize ?? DEFAULT_IMAGE_SIZE;
-let selectedTextModel = settings.state.textModel ?? "";
-let selectedImageModel = settings.state.imageModel ?? "";
-let selectedMaxTokens = String(settings.state.maxTokens ?? "").trim();
-let prefersMaskEdit = settings.state.maskEdit !== false;
-
-const aiSettings = ea.getAISettings();
-if(!aiSettings?.enabled) {
- new Notice("Excalidraw AI is disabled or unavailable. Enable it in plugin settings.");
- return;
-}
-let textModel, imageModel, validSizes;
-let imageDataURL = null;
-let maskDataURL = null;
-
-const parsePositiveInteger = (value) => {
- const normalizedValue = String(value ?? "").trim();
- if(!normalizedValue) {
- return null;
- }
-
- const parsedValue = parseInt(normalizedValue, 10);
- if(Number.isNaN(parsedValue) || parsedValue <= 0) {
- return null;
- }
-
- return parsedValue;
-};
-
-const getTaskConfigs = () => settings.config?.tasks ?? [];
-
-const isTaskRuntimeAvailable = (taskConfig) => {
- switch(getTaskRuntimeRequirement(taskConfig)) {
- case TASK_RUNTIME_APIS.MINDMAP_BUILDER:
- return Boolean(window?.MindMapBuilderAPI);
- default:
- return true;
- }
-};
-
-const getVisibleTaskConfigs = () => getTaskConfigs().filter(isTaskRuntimeAvailable);
-
-const getTaskConfigById = (taskId = selectedTaskId) => (
- getTaskConfigs().find(taskConfig => taskConfig.id === taskId) ?? null
-);
-
-const getVisibleTaskConfigById = (taskId = selectedTaskId) => (
- getVisibleTaskConfigs().find(taskConfig => taskConfig.id === taskId) ?? null
-);
-
-const ensureSelectedTaskId = () => {
- const activeVisibleTask = getVisibleTaskConfigById(selectedTaskId);
- const fallbackTask = activeVisibleTask ?? getVisibleTaskConfigs()[0] ?? null;
- const nextTaskId = fallbackTask?.id ?? "";
- if(selectedTaskId !== nextTaskId) {
- selectedTaskId = nextTaskId;
- dirty = true;
- }
- return fallbackTask;
-};
-
-const getActiveTaskConfig = () => ensureSelectedTaskId();
-
-const getTaskExecutionConfig = (taskId = selectedTaskId) => (
- getTaskConfigById(taskId)?.execution ?? null
-);
-
-const getTaskOutputType = (taskId = selectedTaskId) => {
- const taskConfig = typeof taskId === "string" ? getTaskConfigById(taskId) : taskId;
- return {
- instruction: taskConfig?.outputInstruction ?? "",
- blocktype: taskConfig?.execution?.resultType ?? TASK_RESULT_TYPES.HTML,
- };
-};
-
-const isImageEditTask = (taskId = selectedTaskId) => (
- getTaskExecutionConfig(taskId)?.mode === TASK_EXECUTION_MODES.IMAGE_EDIT
-);
-
-const isImageGenerationTask = (taskId = selectedTaskId) => {
- const mode = getTaskExecutionConfig(taskId)?.mode;
- return mode === TASK_EXECUTION_MODES.IMAGE_PROMPT
- || mode === TASK_EXECUTION_MODES.IMAGE_DIRECT
- || mode === TASK_EXECUTION_MODES.IMAGE_EDIT;
-};
-
-const doesTaskUseTextModel = (taskId = selectedTaskId) => {
- const mode = getTaskExecutionConfig(taskId)?.mode;
- return mode === TASK_EXECUTION_MODES.TEXT_RESULT || mode === TASK_EXECUTION_MODES.IMAGE_PROMPT;
-};
-
-const doesTaskAllowUserPrompt = (taskId = selectedTaskId) => (
- getTaskExecutionConfig(taskId)?.userPrompt !== TASK_INPUT_RULES.DISABLED
-);
-
-const taskRequiresUserPrompt = (taskId = selectedTaskId) => (
- getTaskExecutionConfig(taskId)?.userPrompt === TASK_INPUT_RULES.REQUIRED
-);
-
-const doesTaskAllowImageInput = (taskId = selectedTaskId) => (
- getTaskExecutionConfig(taskId)?.imageInput !== TASK_INPUT_RULES.DISABLED
-);
-
-const taskRequiresImageInput = (taskId = selectedTaskId) => (
- getTaskExecutionConfig(taskId)?.imageInput === TASK_INPUT_RULES.REQUIRED
-);
-
-const taskUsesDirectImageModel = (taskId = selectedTaskId) => (
- getTaskExecutionConfig(taskId)?.mode === TASK_EXECUTION_MODES.IMAGE_DIRECT
-);
-
-const taskUsesImagePromptPipeline = (taskId = selectedTaskId) => (
- getTaskExecutionConfig(taskId)?.mode === TASK_EXECUTION_MODES.IMAGE_PROMPT
-);
-
-const getTaskMaskMode = (taskId = selectedTaskId) => (
- getTaskExecutionConfig(taskId)?.maskMode ?? TASK_MASK_MODES.DISABLED
-);
-
-const getTaskConfigValidationMessage = (taskConfig = getActiveTaskConfig()) => {
- if(!taskConfig) {
- return "No runnable AI tasks are configured. Open Task Editor to add a task or reset the shipped presets.";
- }
-
- const {mode, resultType, maskMode} = taskConfig.execution;
- const isImageResultType = resultType === TASK_RESULT_TYPES.IMAGE || resultType === TASK_RESULT_TYPES.IMAGE_SILENT;
-
- if(mode === TASK_EXECUTION_MODES.TEXT_RESULT && isImageResultType) {
- return `Task \"${taskConfig.name}\" uses an image result with ${getTaskExecutionModeLabel(TASK_EXECUTION_MODES.TEXT_RESULT)}. Use ${getTaskExecutionModeLabel(TASK_EXECUTION_MODES.IMAGE_PROMPT)} or ${getTaskExecutionModeLabel(TASK_EXECUTION_MODES.IMAGE_DIRECT)} instead.`;
- }
-
- if(mode === TASK_EXECUTION_MODES.IMAGE_PROMPT && !isImageResultType) {
- return `Task \"${taskConfig.name}\" must use an image result when ${getTaskExecutionModeLabel(TASK_EXECUTION_MODES.IMAGE_PROMPT)} is selected.`;
- }
-
- if(mode === TASK_EXECUTION_MODES.IMAGE_DIRECT && !isImageResultType) {
- return `Task \"${taskConfig.name}\" must use an image result when ${getTaskExecutionModeLabel(TASK_EXECUTION_MODES.IMAGE_DIRECT)} is selected.`;
- }
-
- if(mode === TASK_EXECUTION_MODES.IMAGE_DIRECT && taskConfig.execution.imageInput !== TASK_INPUT_RULES.DISABLED) {
- return `Task \"${taskConfig.name}\" cannot send a canvas image when ${getTaskExecutionModeLabel(TASK_EXECUTION_MODES.IMAGE_DIRECT)} is selected.`;
- }
-
- if(mode === TASK_EXECUTION_MODES.IMAGE_EDIT && resultType !== TASK_RESULT_TYPES.IMAGE) {
- return `Task \"${taskConfig.name}\" must use the image result when ${getTaskExecutionModeLabel(TASK_EXECUTION_MODES.IMAGE_EDIT)} is selected.`;
- }
-
- if(mode !== TASK_EXECUTION_MODES.IMAGE_EDIT && maskMode !== TASK_MASK_MODES.DISABLED) {
- return `Task \"${taskConfig.name}\" can only enable mask mode when ${getTaskExecutionModeLabel(TASK_EXECUTION_MODES.IMAGE_EDIT)} is selected.`;
- }
-
- return "";
-};
-
-const getConfiguredTextMaxTokens = () => {
- const scriptOverride = parsePositiveInteger(selectedMaxTokens);
- if(scriptOverride) {
- return scriptOverride;
- }
-
- const pluginDefault = parsePositiveInteger(aiSettings.defaultMaxResponseTokens);
- return pluginDefault;
-};
-
-const getProviderProfiles = () => (
- aiSettings.providerProfiles ?? {}
-);
-
-const getTextModelConfigs = () => (
- aiSettings.textModels ?? {}
-);
-
-const getImageModelConfigs = () => (
- aiSettings.imageModels ?? {}
-);
-
-const hasConfiguredProviderApiKey = (providerId) => (
- Boolean(getProviderProfiles()[providerId]?.hasApiKey)
-);
-
-const getConfiguredModelIdsForKind = (kind) => {
- const configs = kind === "text"
- ? getTextModelConfigs()
- : getImageModelConfigs();
-
- return Object.keys(configs)
- .filter(modelId => hasConfiguredProviderApiKey(configs[modelId]?.providerId))
- .sort((left, right) => left.localeCompare(right));
-};
-
-const getMissingModelConfigurationMessage = (kind) => {
- if(kind === "text") {
- return "No text or multimodal models are ready to use. Add an API key to a provider profile and assign at least one text model in Excalidraw AI settings.";
- }
-
- return "No image models are ready to use. Add an API key to a provider profile and assign at least one image model in Excalidraw AI settings.";
-};
-
-const getConfiguredTextModel = () => (
- ((doesTaskAllowImageInput() && imageDataURL) ? aiSettings.defaultMultimodalTextModel : aiSettings.defaultTextModel)
- || aiSettings.defaultTextModel
- || aiSettings.defaultMultimodalTextModel
- || getConfiguredModelIdsForKind("text")[0]
- || ""
-);
-
-const getConfiguredImageModel = () => (
- aiSettings.defaultImageModel
- || getConfiguredModelIdsForKind("image")[0]
- || ""
-);
-
-const getModelConfigId = (configs, modelId) => {
- if(configs[modelId]) {
- return modelId;
- }
- return Object.keys(configs).find(configId => configs[configId]?.model === modelId) ?? "";
-};
-
-const getTextModelConfigId = (modelId) => getModelConfigId(getTextModelConfigs(), modelId);
-
-const getImageModelConfigId = (modelId) => {
- return getModelConfigId(getImageModelConfigs(), modelId);
-};
-
-const getTextModelConfig = (modelId) => {
- const configId = getTextModelConfigId(modelId);
- return configId ? getTextModelConfigs()[configId] ?? null : null;
-};
-
-const getImageModelConfig = (modelId) => {
- const configId = getImageModelConfigId(modelId);
- return configId ? getImageModelConfigs()[configId] ?? null : null;
-};
-
-const getAvailableTextModels = () => {
- const configuredModels = getConfiguredModelIdsForKind("text");
- if(configuredModels.length > 0) {
- return configuredModels;
- }
- return [];
-};
-
-const getAvailableImageModels = () => {
- const configuredModels = getConfiguredModelIdsForKind("image");
- if(configuredModels.length > 0) {
- return configuredModels;
- }
- return [];
-};
-
-const getValidSizesForModel = (model) => {
- if(!model) {
- return [];
- }
- const configuredSizes = getImageModelConfig(model)?.supportedSizes
- ?.map(size => size?.trim())
- .filter(Boolean);
- if(configuredSizes?.length) {
- return configuredSizes;
- }
- return ["1024x1024"];
-};
-
-const parseImageSizeDimensions = (size) => {
- const match = String(size ?? "").trim().match(/^(\d+)x(\d+)$/i);
- if(!match) {
- return null;
- }
- const width = parseInt(match[1], 10);
- const height = parseInt(match[2], 10);
- if(Number.isNaN(width) || Number.isNaN(height) || width <= 0 || height <= 0) {
- return null;
- }
- return {width, height};
-};
-
-const greatestCommonDivisor = (a, b) => {
- let x = Math.abs(a);
- let y = Math.abs(b);
- while(y !== 0) {
- const remainder = x % y;
- x = y;
- y = remainder;
- }
- return x || 1;
-};
-
-const CANONICAL_ASPECT_RATIOS = [
- "1:8",
- "1:4",
- "2:3",
- "3:4",
- "4:5",
- "9:16",
- "1:1",
- "16:9",
- "5:4",
- "4:3",
- "3:2",
- "4:1",
- "8:1",
- "21:9",
-].map((label) => {
- const [width, height] = label.split(":").map((value) => parseInt(value, 10));
- return {
- label,
- ratio: width/height,
- };
-});
-
-const ASPECT_RATIO_LABEL_RELATIVE_EPSILON = 0.02;
-
-const getCanonicalAspectRatioLabel = (width, height) => {
- const ratio = width/height;
- const nearest = CANONICAL_ASPECT_RATIOS
- .map((candidate) => ({
- ...candidate,
- delta: Math.abs(candidate.ratio - ratio),
- }))
- .sort((left, right) => left.delta - right.delta)[0];
-
- if(
- nearest &&
- nearest.delta/Math.max(nearest.ratio, Number.EPSILON)
- <= ASPECT_RATIO_LABEL_RELATIVE_EPSILON
- ) {
- return nearest.label;
- }
-
- const divisor = greatestCommonDivisor(width, height);
- return `${Math.round(width/divisor)}:${Math.round(height/divisor)}`;
-};
-
-const getAspectRatioLabelFromDimensions = (width, height) => {
- return getCanonicalAspectRatioLabel(width, height);
-};
-
-const getImageSizeDropdownOptions = (sizes = []) => {
- return sizes
- .map((size) => {
- const dimensions = parseImageSizeDimensions(size);
- if(!dimensions) {
- return {
- value: size,
- label: String(size ?? ""),
- ratioOrder: Number.POSITIVE_INFINITY,
- pixels: Number.POSITIVE_INFINITY,
- width: Number.POSITIVE_INFINITY,
- height: Number.POSITIVE_INFINITY,
- };
+# ExcaliAI
+
+Generate HTML, Mermaid, mind maps, editable SVG strokes and images from a canvas selection and a prompt. Includes an editable task library, image transforms, mask edits, aspect-ratio previews and response token overrides.
+
+Uses **Excalidraw AI** provider profiles and model preferences, including OpenAI reasoning effort. Configure keys in the plugin (obfuscated vault settings or device-local Obsidian SecretStorage); this script never stores API keys. Your chosen task sends its prompt and, when enabled, selected canvas image to that provider.
+
+Requires Excalidraw 2.29.2 or newer. Open a drawing and run **ExcaliAI**. Preserve that script filename when replacing an older copy so its task library and preferences remain under the same Script Engine settings key.
+
+The migration preserves legacy settings and task IDs. Existing JavaScript modal/export orchestration remains in run.js, with import-safe task helpers and typed request helpers. New script UI strings and default prompts are in lang/en.ts; maintained locale files use English fallback for untranslated advanced content.
+
+Build: npm run build. Deploy build/excali-ai/excali-ai.md as ea-scripts/ExcaliAI.md in the plugin repository.
+
+Validation uses fake providers and keys. Verify live providers, mask edits and generated content separately with your own API access.
+
+Tutorial: https://www.youtube.com/watch?v=A1vrSGBbWgo
+
+Maintained source: https://github.com/zsviczian/ea-scripts/tree/main/src/scripts/excali-ai
+
+Build version: 2026-11-17T17:24:59.281Z
+
+```javascript
+*/
+
+// Script bundle
+/* EA Script — excali-ai | ea-scripts v1.0.0 */
+(() => {
+ // src/scripts/excali-ai/tasks.ts
+ var createTaskHelpers = (t) => {
+ const EXCALIAI_SETTINGS_VERSION = 1;
+ const DEFAULT_IMAGE_SIZE = "1024x1024";
+ const TASK_EXECUTION_MODES = {
+ TEXT_RESULT: "text-result",
+ IMAGE_PROMPT: "image-prompt",
+ IMAGE_DIRECT: "image-direct",
+ IMAGE_EDIT: "image-edit"
+ };
+ const TASK_RESULT_TYPES = {
+ HTML: "html",
+ MINDMAP: "mindmap",
+ MERMAID: "mermaid",
+ SVG: "svg",
+ IMAGE: "image",
+ IMAGE_SILENT: "image-silent"
+ };
+ const TASK_INPUT_RULES = {
+ DISABLED: "disabled",
+ OPTIONAL: "optional",
+ REQUIRED: "required"
+ };
+ const TASK_MASK_MODES = {
+ DISABLED: "disabled",
+ OPTIONAL: "optional",
+ REQUIRED: "required"
+ };
+ const TASK_RUNTIME_APIS = {
+ NONE: "",
+ MINDMAP_BUILDER: "mindmap-builder"
+ };
+ const VALID_TASK_EXECUTION_MODES = Object.values(TASK_EXECUTION_MODES);
+ const VALID_TASK_RESULT_TYPES = Object.values(TASK_RESULT_TYPES);
+ const VALID_TASK_INPUT_RULES = Object.values(TASK_INPUT_RULES);
+ const VALID_TASK_MASK_MODES = Object.values(TASK_MASK_MODES);
+ const VALID_TASK_RUNTIME_APIS = Object.values(TASK_RUNTIME_APIS);
+ const TASK_EXECUTION_MODE_META = {
+ [TASK_EXECUTION_MODES.TEXT_RESULT]: {
+ label: t("textResponse"),
+ description: t("usesTheTextOrMultimodalModelAnd")
+ },
+ [TASK_EXECUTION_MODES.IMAGE_PROMPT]: {
+ label: t("writePromptThenGenerateImage"),
+ description: t("usesTheTextModelToWriteAn")
+ },
+ [TASK_EXECUTION_MODES.IMAGE_DIRECT]: {
+ label: t("sendPromptStraightToImageModel"),
+ description: t("sendsOnlyTheUserSPromptTo")
+ },
+ [TASK_EXECUTION_MODES.IMAGE_EDIT]: {
+ label: t("editSelectedImage"),
+ description: t("usesTheSelectedImageAsTheSource")
}
-
- const ratioLabel = getAspectRatioLabelFromDimensions(dimensions.width, dimensions.height);
- return {
- value: size,
- label: `(${ratioLabel}) ${dimensions.width}x${dimensions.height}`,
- ratioOrder: dimensions.width/dimensions.height,
- pixels: dimensions.width * dimensions.height,
- width: dimensions.width,
- height: dimensions.height,
- };
- })
- .sort((left, right) => {
- if(left.ratioOrder !== right.ratioOrder) {
- return left.ratioOrder - right.ratioOrder;
+ };
+ const TASK_RESULT_TYPE_META = {
+ [TASK_RESULT_TYPES.HTML]: {
+ label: "HTML",
+ description: t("embedsTheResponseAsASingleHtml")
+ },
+ [TASK_RESULT_TYPES.MINDMAP]: {
+ label: t("mindMap"),
+ description: t("importsTheResponseIntoMindmapBuilder"),
+ runtimeRequirement: TASK_RUNTIME_APIS.MINDMAP_BUILDER
+ },
+ [TASK_RESULT_TYPES.MERMAID]: {
+ label: t("mermaid"),
+ description: t("createsAMermaidDiagram")
+ },
+ [TASK_RESULT_TYPES.SVG]: {
+ label: t("excalidrawStrokes"),
+ description: t("usesSvgBehindTheScenesToGenerate")
+ },
+ [TASK_RESULT_TYPES.IMAGE]: {
+ label: t("imagePromptNote"),
+ description: t("generatesAnImageAndAddsTheModel")
+ },
+ [TASK_RESULT_TYPES.IMAGE_SILENT]: {
+ label: t("imageOnly"),
+ description: t("generatesOnlyTheImageWithoutAddingThe")
}
- if(left.pixels !== right.pixels) {
- return left.pixels - right.pixels;
+ };
+ const getTaskExecutionModeMeta = (mode) => TASK_EXECUTION_MODE_META[mode] ?? TASK_EXECUTION_MODE_META[TASK_EXECUTION_MODES.TEXT_RESULT];
+ const getTaskExecutionModeLabel = (mode) => getTaskExecutionModeMeta(mode).label;
+ const getTaskExecutionModeDescription = (mode) => getTaskExecutionModeMeta(mode).description;
+ const getTaskResultTypeMeta = (resultType) => TASK_RESULT_TYPE_META[resultType] ?? TASK_RESULT_TYPE_META[TASK_RESULT_TYPES.HTML];
+ const getTaskResultTypeLabel = (resultType) => getTaskResultTypeMeta(resultType).label;
+ const getTaskResultTypeDescription = (resultType) => getTaskResultTypeMeta(resultType).description;
+ const getTaskRuntimeRequirement = (taskConfig) => getTaskResultTypeMeta(taskConfig?.execution?.resultType ?? TASK_RESULT_TYPES.HTML).runtimeRequirement ?? TASK_RUNTIME_APIS.NONE;
+ const getTaskRuntimeRequirementLabel = (runtimeRequirement) => {
+ switch (runtimeRequirement) {
+ case TASK_RUNTIME_APIS.MINDMAP_BUILDER:
+ return t("mindmapBuilder");
+ default:
+ return t("none");
}
- if(left.width !== right.width) {
- return left.width - right.width;
+ };
+ const normalizeEnumValue = (value, validValues, fallbackValue) => typeof value === "string" && validValues.includes(value) ? value : fallbackValue;
+ const cloneJSON = (value) => {
+ if (value === null || value === void 0) {
+ return value;
}
- if(left.height !== right.height) {
- return left.height - right.height;
+ return JSON.parse(JSON.stringify(value));
+ };
+ const createTaskIdFromName = (value = "") => {
+ const normalizedValue = String(value ?? "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
+ return normalizedValue || "task";
+ };
+ const getDefaultOutputInstruction = (resultType) => {
+ switch (resultType) {
+ case TASK_RESULT_TYPES.HTML:
+ return t("turnThisIntoASingleHtmlFile");
+ case TASK_RESULT_TYPES.MINDMAP:
+ return t("returnOnlyTheMindMapAsPlain");
+ case TASK_RESULT_TYPES.MERMAID:
+ return t("returnASingleMessageContainingOnlyThe");
+ case TASK_RESULT_TYPES.SVG:
+ return t("returnASingleMessageContainingOnlyThe2");
+ case TASK_RESULT_TYPES.IMAGE:
+ case TASK_RESULT_TYPES.IMAGE_SILENT:
+ return t("returnASingleMessageWithTheGenerated");
+ default:
+ return "";
}
- return String(left.value).localeCompare(String(right.value));
- });
-};
-
-const getResolvedTextModelSelection = (requestedModelId = selectedTextModel) => {
- const availableModels = getAvailableTextModels();
- const requestedConfigId = getTextModelConfigId(requestedModelId);
- const configuredDefaultId = getTextModelConfigId(getConfiguredTextModel());
- const resolvedModelId = [requestedConfigId, configuredDefaultId, availableModels[0], requestedModelId]
- .find(modelId => modelId && availableModels.includes(modelId))
- || "";
- const modelConfig = getTextModelConfig(resolvedModelId);
- const providerProfiles = getProviderProfiles();
- const providerId = modelConfig?.providerId ?? Object.keys(providerProfiles)[0] ?? "";
- const providerProfile = providerProfiles[providerId] ?? null;
-
- return {
- modelId: resolvedModelId,
- modelConfig,
- providerId,
- providerProfile,
- requestConfig: {
- textModelId: resolvedModelId,
- },
- };
-};
-
-const getResolvedImageModelSelection = (requestedModelId = selectedImageModel) => {
- const availableModels = getAvailableImageModels();
- const requestedConfigId = getImageModelConfigId(requestedModelId);
- const configuredDefaultId = getImageModelConfigId(getConfiguredImageModel());
- const resolvedModelId = [requestedConfigId, configuredDefaultId, availableModels[0], requestedModelId]
- .find(modelId => modelId && availableModels.includes(modelId))
- || "";
- const modelConfig = getImageModelConfig(resolvedModelId);
- const providerProfiles = getProviderProfiles();
- const providerId = modelConfig?.providerId ?? Object.keys(providerProfiles)[0] ?? "";
- const providerProfile = providerProfiles[providerId] ?? null;
-
- return {
- modelId: resolvedModelId,
- modelConfig,
- providerId,
- providerProfile,
- requestConfig: {
- imageModelId: resolvedModelId,
- },
- };
-};
-
-const getTextModelValidationMessage = (modelId, {requireMultimodal = false} = {}) => {
- if(getAvailableTextModels().length === 0) {
- return getMissingModelConfigurationMessage("text");
- }
- const textSelection = getResolvedTextModelSelection(modelId);
- if(!textSelection.modelConfig) {
- return `The selected text model (${modelId || "unknown"}) isn't configured in Excalidraw AI settings.`;
- }
- if(!textSelection.providerProfile) {
- return `The provider profile (${textSelection.providerId || "unknown"}) for text model ${textSelection.modelId} is missing from Excalidraw AI settings.`;
- }
- if(!textSelection.providerProfile.hasApiKey) {
- return `The selected provider profile (${textSelection.providerId}) doesn't have an API key configured.`;
- }
- if(requireMultimodal && textSelection.modelConfig.multimodalSupport === false) {
- return `The selected text model (${textSelection.modelId}) is set to text-only. Choose a multimodal model for image analysis tasks.`;
- }
- return "";
-};
-
-const getImageModelValidationMessage = (modelId, {requirePromptTransformSupport = false, requireMaskEditSupport = false} = {}) => {
- if(getAvailableImageModels().length === 0) {
- return getMissingModelConfigurationMessage("image");
- }
- const imageSelection = getResolvedImageModelSelection(modelId);
- if(!imageSelection.modelConfig) {
- return getMissingModelConfigurationMessage("image");
- }
- if(!imageSelection.providerProfile) {
- return `The provider profile (${imageSelection.providerId || "unknown"}) for image model ${imageSelection.modelId} is missing from Excalidraw AI settings.`;
- }
- if(!imageSelection.providerProfile.hasApiKey) {
- return `The selected provider profile (${imageSelection.providerId}) doesn't have an API key configured.`;
- }
- if(requirePromptTransformSupport && imageSelection.modelConfig.supportsPromptImageTransforms === false) {
- return `The selected image model (${imageSelection.modelId}) doesn't support prompt-based transforms in Excalidraw AI settings.`;
- }
- if(requireMaskEditSupport && imageSelection.modelConfig.supportsMaskImageEdits === false) {
- return `The selected image model (${imageSelection.modelId}) doesn't support mask-based edits in Excalidraw AI settings.`;
- }
- return "";
-};
-
-const getImageRequestErrorMessage = (result, modelId) => {
- const baseMessage = result?.json?.error?.message ?? "The image request failed.";
- const errorContext = result?.json?.error;
- const imageSelection = getResolvedImageModelSelection(modelId);
- const contextParts = [];
- if(errorContext?.provider) {
- contextParts.push(`provider=${errorContext.provider}`);
- }
- if(errorContext?.status) {
- contextParts.push(`status=${errorContext.status}`);
- }
- if(errorContext?.endpoint) {
- contextParts.push(`endpoint=${errorContext.endpoint}`);
- }
- if(errorContext?.imageRequest?.model) {
- contextParts.push(`model=${errorContext.imageRequest.model}`);
- }
- if(errorContext?.imageRequest?.size) {
- contextParts.push(`size=${errorContext.imageRequest.size}`);
- }
- if(errorContext?.imageRequest?.mode) {
- contextParts.push(`mode=${errorContext.imageRequest.mode}`);
- }
- const contextText = contextParts.length > 0 ? ` (${contextParts.join(", ")})` : "";
- return `${baseMessage}${contextText}`;
-};
-
-const getTaskValidationMessage = ({
- usesTextModel,
- requiresMultimodalText,
- isImageGenRequest,
- isImageEditRequest,
- requiresPromptTransformSupport,
- requiresMaskEditSupport,
- activeTextSelection,
- activeImageSelection,
-}) => {
- if(usesTextModel) {
- const textValidationMessage = getTextModelValidationMessage(activeTextSelection.modelId, {
- requireMultimodal: requiresMultimodalText,
- });
- if(textValidationMessage) {
- return textValidationMessage;
- }
- }
-
- if(isImageGenRequest || isImageEditRequest) {
- return getImageModelValidationMessage(activeImageSelection.modelId, {
- requirePromptTransformSupport: requiresPromptTransformSupport,
- requireMaskEditSupport: requiresMaskEditSupport,
- });
- }
- return "";
-};
-
-const getActiveTextModel = () => {
- return getResolvedTextModelSelection(selectedTextModel).modelId;
-};
-
-const getActiveImageModel = () => {
- return getResolvedImageModelSelection(selectedImageModel).modelId;
-};
-
-const activeImageModelSupportsMaskEdits = () => {
- const modelConfig = getResolvedImageModelSelection(selectedImageModel).modelConfig;
- return Boolean(modelConfig) && modelConfig.supportsMaskImageEdits !== false;
-};
-
-const canUseMaskEdit = () => (
- isImageEditTask()
- && getTaskMaskMode() !== TASK_MASK_MODES.DISABLED
- && activeImageModelSupportsMaskEdits()
-);
-
-const shouldUseMaskEdit = () => {
- switch(getTaskMaskMode()) {
- case TASK_MASK_MODES.REQUIRED:
- return canUseMaskEdit();
- case TASK_MASK_MODES.OPTIONAL:
- return canUseMaskEdit() && prefersMaskEdit;
- default:
- return false;
- }
-};
-
-const shouldGenerateMaskPreview = () => (
- shouldUseMaskEdit()
-);
-
-const hasAvailableTextModels = () => getAvailableTextModels().length > 0;
-
-const hasAvailableImageModels = () => getAvailableImageModels().length > 0;
-
-const parseImageSize = (size) => {
- const [width, height] = (size ?? "1024x1024").split("x").map(value => parseInt(value, 10));
- if(Number.isNaN(width) || Number.isNaN(height) || width <= 0 || height <= 0) {
- return {width: 1024, height: 1024};
- }
- return {width, height};
-};
-
-const getEditTargetBoundingBox = (bb, size) => {
- const {width: targetWidth, height: targetHeight} = parseImageSize(size);
- const targetRatio = targetWidth/targetHeight;
- const sourceRatio = bb.width/bb.height;
-
- let width = bb.width;
- let height = bb.height;
- let topX = bb.topX;
- let topY = bb.topY;
-
- if(sourceRatio > targetRatio) {
- height = width/targetRatio;
- topY = bb.topY - (height - bb.height)/2;
- } else if(sourceRatio < targetRatio) {
- width = height*targetRatio;
- topX = bb.topX - (width - bb.width)/2;
- }
-
- return {topX, topY, width, height, targetWidth, targetHeight};
-};
-
-const setTextAndImageModels = () => {
- const nextTextModel = getActiveTextModel();
- if(selectedTextModel !== nextTextModel) {
- dirty = true;
- }
- textModel = nextTextModel;
- selectedTextModel = textModel;
-
- const nextImageModel = getActiveImageModel();
- if(selectedImageModel !== nextImageModel) {
- dirty = true;
- }
- imageModel = nextImageModel;
- selectedImageModel = imageModel;
- validSizes = imageModel ? getValidSizesForModel(imageModel) : [];
- if(imageModel && !validSizes.includes(imageSize)) {
- imageSize = validSizes[0] ?? "1024x1024";
- dirty = true;
- }
-}
-setTextAndImageModels();
-
-// --------------------------------------
-// Generate Image Blob From Selected Excalidraw Elements
-// --------------------------------------
-const calculateImageScale = (elements) => {
- const bb = ea.getBoundingBox(elements);
- const size = (bb.width*bb.height);
- const minRatio = Math.sqrt(360000/size);
- const maxRatio = Math.sqrt(size/16000000);
- return minRatio > 1
- ? minRatio
- : (
- maxRatio > 1
- ? 1/maxRatio
- : 1
+ };
+ const getDefaultResultTypeForMode = (mode) => {
+ switch (mode) {
+ case TASK_EXECUTION_MODES.IMAGE_PROMPT:
+ case TASK_EXECUTION_MODES.IMAGE_DIRECT:
+ case TASK_EXECUTION_MODES.IMAGE_EDIT:
+ return TASK_RESULT_TYPES.IMAGE;
+ default:
+ return TASK_RESULT_TYPES.HTML;
+ }
+ };
+ const normalizeTaskConfig = (task = {}, index = 0) => {
+ const execution = task.execution ?? {};
+ const mode = normalizeEnumValue(
+ execution.mode,
+ VALID_TASK_EXECUTION_MODES,
+ TASK_EXECUTION_MODES.TEXT_RESULT
);
-}
-
-const createMask = async (dataURL) => {
- return new Promise((resolve, reject) => {
- const img = new Image();
-
- img.onload = () => {
- const canvas = document.createElement('canvas');
- canvas.width = img.width;
- canvas.height = img.height;
-
- const ctx = canvas.getContext('2d');
- ctx.drawImage(img, 0, 0);
-
- const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
- const data = imageData.data;
-
- for (let i = 0; i < data.length; i += 4) {
- // If opaque (alpha > 0), make it transparent
- if (data[i + 3] > 0) {
- data[i + 3] = 0; // Set alpha to 0 (transparent)
- } else if (data[i + 3] === 0) {
- // If fully transparent, make it red
- data[i] = 255; // Red
- data[i + 1] = 0; // Green
- data[i + 2] = 0; // Blue
- data[i + 3] = 255; // make it opaque
+ const resultType = normalizeEnumValue(
+ execution.resultType,
+ VALID_TASK_RESULT_TYPES,
+ getDefaultResultTypeForMode(mode)
+ );
+ const imageInputFallback = mode === TASK_EXECUTION_MODES.IMAGE_DIRECT ? TASK_INPUT_RULES.DISABLED : mode === TASK_EXECUTION_MODES.IMAGE_EDIT ? TASK_INPUT_RULES.REQUIRED : TASK_INPUT_RULES.OPTIONAL;
+ return {
+ id: createTaskIdFromName(task.id ?? task.name ?? `task-${index + 1}`),
+ name: String(task.name ?? "").trim() || t("task", { value1: index + 1 }),
+ help: String(task.help ?? "").trim(),
+ systemPrompt: task.systemPrompt === null || task.systemPrompt === void 0 ? null : String(task.systemPrompt),
+ outputInstruction: String(task.outputInstruction ?? getDefaultOutputInstruction(resultType)),
+ execution: {
+ mode,
+ resultType,
+ userPrompt: normalizeEnumValue(
+ execution.userPrompt,
+ VALID_TASK_INPUT_RULES,
+ TASK_INPUT_RULES.OPTIONAL
+ ),
+ imageInput: normalizeEnumValue(
+ execution.imageInput,
+ VALID_TASK_INPUT_RULES,
+ imageInputFallback
+ ),
+ maskMode: normalizeEnumValue(
+ execution.maskMode,
+ VALID_TASK_MASK_MODES,
+ mode === TASK_EXECUTION_MODES.IMAGE_EDIT ? TASK_MASK_MODES.OPTIONAL : TASK_MASK_MODES.DISABLED
+ ),
+ requiresApi: getTaskResultTypeMeta(resultType).runtimeRequirement ?? TASK_RUNTIME_APIS.NONE
+ }
+ };
+ };
+ const normalizeTaskConfigs = (tasks, { fallbackToDefaults = false } = {}) => {
+ if (!Array.isArray(tasks)) {
+ return fallbackToDefaults ? normalizeTaskConfigs(createDefaultTaskConfigs()) : [];
+ }
+ const usedIds = /* @__PURE__ */ new Set();
+ return tasks.map((task, index) => {
+ const normalizedTask = normalizeTaskConfig(task, index);
+ if (normalizedTask.execution.mode !== TASK_EXECUTION_MODES.IMAGE_EDIT) {
+ normalizedTask.execution.maskMode = TASK_MASK_MODES.DISABLED;
+ }
+ let nextId = normalizedTask.id || createTaskIdFromName(normalizedTask.name) || `task-${index + 1}`;
+ let duplicateCount = 2;
+ while (usedIds.has(nextId)) {
+ nextId = `${normalizedTask.id}-${duplicateCount++}`;
+ }
+ usedIds.add(nextId);
+ normalizedTask.id = nextId;
+ return normalizedTask;
+ });
+ };
+ const createDefaultTaskConfigs = () => [
+ {
+ id: "challenge-my-thinking",
+ name: t("challengeMyThinking"),
+ help: t("turnTheSelectedImageAndOptionalPrompt"),
+ systemPrompt: t("yourTaskIsToInterpretAScreenshot"),
+ outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.MERMAID),
+ execution: {
+ mode: TASK_EXECUTION_MODES.TEXT_RESULT,
+ resultType: TASK_RESULT_TYPES.MERMAID,
+ userPrompt: TASK_INPUT_RULES.OPTIONAL,
+ imageInput: TASK_INPUT_RULES.OPTIONAL,
+ maskMode: TASK_MASK_MODES.DISABLED,
+ requiresApi: TASK_RUNTIME_APIS.NONE
+ }
+ },
+ {
+ id: "convert-sketch-to-shapes",
+ name: t("convertSketchToShapes"),
+ help: t("convertSelectedSketchesIntoExcalidrawStrokesWorks"),
+ systemPrompt: t("givenAnImageFeaturingVariousGeometricShapes"),
+ outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.SVG),
+ execution: {
+ mode: TASK_EXECUTION_MODES.TEXT_RESULT,
+ resultType: TASK_RESULT_TYPES.SVG,
+ userPrompt: TASK_INPUT_RULES.OPTIONAL,
+ imageInput: TASK_INPUT_RULES.OPTIONAL,
+ maskMode: TASK_MASK_MODES.DISABLED,
+ requiresApi: TASK_RUNTIME_APIS.NONE
+ }
+ },
+ {
+ id: "create-a-simple-excalidraw-icon",
+ name: t("createASimpleExcalidrawIcon"),
+ help: t("turnATextPromptIntoASimple"),
+ systemPrompt: t("givenADescriptionOfAnSvgImage"),
+ outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.SVG),
+ execution: {
+ mode: TASK_EXECUTION_MODES.TEXT_RESULT,
+ resultType: TASK_RESULT_TYPES.SVG,
+ userPrompt: TASK_INPUT_RULES.OPTIONAL,
+ imageInput: TASK_INPUT_RULES.DISABLED,
+ maskMode: TASK_MASK_MODES.DISABLED,
+ requiresApi: TASK_RUNTIME_APIS.NONE
+ }
+ },
+ {
+ id: "create-a-stick-figure",
+ name: t("createAStickFigure"),
+ help: t("sendOnlyTheTextPromptToThe"),
+ systemPrompt: t("youWillReceiveAPromptFromThe"),
+ outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.IMAGE),
+ execution: {
+ mode: TASK_EXECUTION_MODES.IMAGE_PROMPT,
+ resultType: TASK_RESULT_TYPES.IMAGE,
+ userPrompt: TASK_INPUT_RULES.OPTIONAL,
+ imageInput: TASK_INPUT_RULES.DISABLED,
+ maskMode: TASK_MASK_MODES.DISABLED,
+ requiresApi: TASK_RUNTIME_APIS.NONE
+ }
+ },
+ {
+ id: "edit-an-image",
+ name: t("editAnImage"),
+ help: t("imageElementsAreUsedAsTheSource"),
+ systemPrompt: null,
+ outputInstruction: "",
+ execution: {
+ mode: TASK_EXECUTION_MODES.IMAGE_EDIT,
+ resultType: TASK_RESULT_TYPES.IMAGE,
+ userPrompt: TASK_INPUT_RULES.REQUIRED,
+ imageInput: TASK_INPUT_RULES.REQUIRED,
+ maskMode: TASK_MASK_MODES.OPTIONAL,
+ requiresApi: TASK_RUNTIME_APIS.NONE
+ }
+ },
+ {
+ id: "generate-an-image-from-image-and-prompt",
+ name: t("generateAnImageFromImageAndPrompt"),
+ help: t("generateAnImageFromTheSelectedImage"),
+ systemPrompt: t("yourTaskInvolvesReceivingAnImageAnd"),
+ outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.IMAGE),
+ execution: {
+ mode: TASK_EXECUTION_MODES.IMAGE_PROMPT,
+ resultType: TASK_RESULT_TYPES.IMAGE,
+ userPrompt: TASK_INPUT_RULES.OPTIONAL,
+ imageInput: TASK_INPUT_RULES.OPTIONAL,
+ maskMode: TASK_MASK_MODES.DISABLED,
+ requiresApi: TASK_RUNTIME_APIS.NONE
+ }
+ },
+ {
+ id: "generate-an-image-from-prompt",
+ name: t("generateAnImageFromPrompt"),
+ help: t("sendOnlyTheTextPromptToThe"),
+ systemPrompt: null,
+ outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.IMAGE),
+ execution: {
+ mode: TASK_EXECUTION_MODES.IMAGE_DIRECT,
+ resultType: TASK_RESULT_TYPES.IMAGE,
+ userPrompt: TASK_INPUT_RULES.OPTIONAL,
+ imageInput: TASK_INPUT_RULES.DISABLED,
+ maskMode: TASK_MASK_MODES.DISABLED,
+ requiresApi: TASK_RUNTIME_APIS.NONE
+ }
+ },
+ {
+ id: "generate-an-image-to-illustrate-a-quote",
+ name: t("generateAnImageToIllustrateAQuote"),
+ help: t("turnAQuoteIntoAnIllustratedScene"),
+ systemPrompt: t("yourTaskInvolvesTransformingAUserProvided"),
+ outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.IMAGE),
+ execution: {
+ mode: TASK_EXECUTION_MODES.IMAGE_PROMPT,
+ resultType: TASK_RESULT_TYPES.IMAGE,
+ userPrompt: TASK_INPUT_RULES.OPTIONAL,
+ imageInput: TASK_INPUT_RULES.DISABLED,
+ maskMode: TASK_MASK_MODES.DISABLED,
+ requiresApi: TASK_RUNTIME_APIS.NONE
+ }
+ },
+ {
+ id: "generate-4-icon-variants-based-on-input-image",
+ name: t("generateIconVariantsBasedOnInputImage"),
+ help: t("generateAXSheetOfFourIcon"),
+ systemPrompt: t("givenASimpleSketchAndAnOptional"),
+ outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.IMAGE_SILENT),
+ execution: {
+ mode: TASK_EXECUTION_MODES.IMAGE_PROMPT,
+ resultType: TASK_RESULT_TYPES.IMAGE_SILENT,
+ userPrompt: TASK_INPUT_RULES.OPTIONAL,
+ imageInput: TASK_INPUT_RULES.OPTIONAL,
+ maskMode: TASK_MASK_MODES.DISABLED,
+ requiresApi: TASK_RUNTIME_APIS.NONE
+ }
+ },
+ {
+ id: "visual-brainstorm",
+ name: t("visualBrainstorm"),
+ help: t("generateAnImageFromTheSelectedImage2"),
+ systemPrompt: t("yourObjectiveIsToInterpretAScreenshot"),
+ outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.IMAGE),
+ execution: {
+ mode: TASK_EXECUTION_MODES.IMAGE_PROMPT,
+ resultType: TASK_RESULT_TYPES.IMAGE,
+ userPrompt: TASK_INPUT_RULES.OPTIONAL,
+ imageInput: TASK_INPUT_RULES.OPTIONAL,
+ maskMode: TASK_MASK_MODES.DISABLED,
+ requiresApi: TASK_RUNTIME_APIS.NONE
+ }
+ },
+ {
+ id: "wireframe-to-code",
+ name: t("wireframeToCode"),
+ help: t("interpretTheSelectedWireframeAndGenerateA"),
+ systemPrompt: t("youAreAnExpertTailwindDeveloperA"),
+ outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.HTML),
+ execution: {
+ mode: TASK_EXECUTION_MODES.TEXT_RESULT,
+ resultType: TASK_RESULT_TYPES.HTML,
+ userPrompt: TASK_INPUT_RULES.OPTIONAL,
+ imageInput: TASK_INPUT_RULES.OPTIONAL,
+ maskMode: TASK_MASK_MODES.DISABLED,
+ requiresApi: TASK_RUNTIME_APIS.NONE
+ }
+ },
+ {
+ id: "create-mindmap",
+ name: t("createMindmap"),
+ help: t("createAHierarchicalMindMapFromThe"),
+ systemPrompt: t("youWillReceiveATextPromptAnd"),
+ outputInstruction: getDefaultOutputInstruction(TASK_RESULT_TYPES.MINDMAP),
+ execution: {
+ mode: TASK_EXECUTION_MODES.TEXT_RESULT,
+ resultType: TASK_RESULT_TYPES.MINDMAP,
+ userPrompt: TASK_INPUT_RULES.OPTIONAL,
+ imageInput: TASK_INPUT_RULES.OPTIONAL,
+ maskMode: TASK_MASK_MODES.DISABLED,
+ requiresApi: TASK_RUNTIME_APIS.MINDMAP_BUILDER
}
}
-
- ctx.putImageData(imageData, 0, 0);
- const maskDataURL = canvas.toDataURL();
-
- resolve(maskDataURL);
+ ];
+ const DEFAULT_TASK_CONFIGS = normalizeTaskConfigs(createDefaultTaskConfigs());
+ const DEFAULT_TASK_ID = DEFAULT_TASK_CONFIGS.find((task) => task.id === "wireframe-to-code")?.id ?? DEFAULT_TASK_CONFIGS[0]?.id ?? "";
+ const createDefaultState = (taskConfigs = []) => ({
+ selectedTaskId: taskConfigs.find((task) => task.id === DEFAULT_TASK_ID)?.id ?? taskConfigs[0]?.id ?? "",
+ userPrompt: "",
+ maskEdit: true,
+ textModel: "",
+ imageModel: "",
+ maxTokens: "",
+ imageSize: DEFAULT_IMAGE_SIZE
+ });
+ const normalizeState = (state = {}, taskConfigs = []) => {
+ const defaultState = createDefaultState(taskConfigs);
+ const knownTaskIds = new Set(taskConfigs.map((task) => task.id));
+ const selectedTaskId = String(state.selectedTaskId ?? defaultState.selectedTaskId).trim();
+ return {
+ selectedTaskId: knownTaskIds.has(selectedTaskId) ? selectedTaskId : defaultState.selectedTaskId,
+ userPrompt: String(state.userPrompt ?? defaultState.userPrompt),
+ maskEdit: state.maskEdit !== false,
+ textModel: String(state.textModel ?? defaultState.textModel),
+ imageModel: String(state.imageModel ?? defaultState.imageModel),
+ maxTokens: String(state.maxTokens ?? defaultState.maxTokens).trim(),
+ imageSize: String(state.imageSize ?? defaultState.imageSize).trim() || defaultState.imageSize
+ };
};
-
- img.onerror = error => {
- reject(error);
- };
-
- img.src = dataURL;
- });
-}
-
-// For image edits, the selected content is padded to the requested output aspect ratio
-// so the exported image and mask match the requested model size.
-const generateCanvasDataURL = async (view, targetImageEdit=false) => {
- let PADDING = 5;
- await view.forceSave(true); //to ensure recently embedded PNG and other images are saved to file
- const viewElements = ea.getViewSelectedElements();
- if(viewElements.length === 0) {
- return {imageDataURL: null, maskDataURL: null} ;
- }
- ea.copyViewElementsToEAforEditing(viewElements, true); //copying the images objects over to EA for PNG generation
-
- let maskDataURL;
- const loader = ea.getEmbeddedFilesLoader(false);
- let scale = calculateImageScale(ea.getElements());
- const bb = ea.getBoundingBox(viewElements);
- if(ea.getElements()
- .filter(el=>el.type==="image")
- .some(el=>Math.round(el.width) === Math.round(bb.width) && Math.round(el.height) === Math.round(bb.height))
- ) { PADDING = 0; }
-
- let exportSettings = {withBackground: true, withTheme: true};
-
- if(targetImageEdit) {
- PADDING = 0;
- const strokeColor = ea.style.strokeColor;
- const backgroundColor = ea.style.backgroundColor;
- ea.style.backgroundColor = "transparent";
- ea.style.strokeColor = "transparent";
- const targetBounds = getEditTargetBoundingBox(bb, imageSize);
- const rectID = ea.addRect(targetBounds.topX, targetBounds.topY, targetBounds.width, targetBounds.height);
- const rect = ea.getElement(rectID);
- ea.style.strokeColor = strokeColor;
- ea.style.backgroundColor = backgroundColor;
- ea.getElements().filter(el=>el.type === "image").forEach(el=>{el.isDeleted = true});
-
- scale = targetBounds.targetWidth/rect.width;
- exportSettings = {withBackground: false, withTheme: true};
- maskDataURL= await ea.createPNGBase64(
- null, scale, exportSettings, loader, "light", PADDING
+ const createDefaultExcaliAISettings = () => ({
+ schemaVersion: EXCALIAI_SETTINGS_VERSION,
+ config: {
+ tasks: cloneJSON(DEFAULT_TASK_CONFIGS)
+ },
+ state: createDefaultState(DEFAULT_TASK_CONFIGS)
+ });
+ const LEGACY_TASK_NAME_TO_ID = Object.fromEntries(
+ DEFAULT_TASK_CONFIGS.map((task) => [task.name, task.id])
);
- maskDataURL = await createMask(maskDataURL)
- ea.getElements().filter(el=>el.type === "image").forEach(el=>{el.isDeleted = false});
- ea.getElements().filter(el=>el.type !== "image" && el.id !== rectID).forEach(el=>{el.isDeleted = true});
+ const loadExcaliAISettings = (rawSettings) => {
+ const sourceSettings = rawSettings && typeof rawSettings === "object" ? rawSettings : {};
+ const normalizedSettings = createDefaultExcaliAISettings();
+ normalizedSettings.config.tasks = normalizeTaskConfigs(sourceSettings.config?.tasks, {
+ fallbackToDefaults: true
+ });
+ const legacyState = {
+ selectedTaskId: LEGACY_TASK_NAME_TO_ID[String(sourceSettings["Agent's Task"] ?? "").trim()] ?? normalizedSettings.state.selectedTaskId,
+ userPrompt: sourceSettings["User Prompt"] ?? normalizedSettings.state.userPrompt,
+ maskEdit: sourceSettings["Mask Edit"] !== false,
+ textModel: sourceSettings["Text Model"] ?? normalizedSettings.state.textModel,
+ imageModel: sourceSettings["Image Model"] ?? normalizedSettings.state.imageModel,
+ maxTokens: sourceSettings["Max Tokens"] ?? normalizedSettings.state.maxTokens,
+ imageSize: sourceSettings["Image Size"] ?? normalizedSettings.state.imageSize
+ };
+ normalizedSettings.state = normalizeState(
+ {
+ ...legacyState,
+ ...sourceSettings.state ?? {}
+ },
+ normalizedSettings.config.tasks
+ );
+ return {
+ settings: normalizedSettings,
+ needsSave: JSON.stringify(sourceSettings) !== JSON.stringify(normalizedSettings)
+ };
+ };
+ return {
+ EXCALIAI_SETTINGS_VERSION,
+ DEFAULT_IMAGE_SIZE,
+ TASK_EXECUTION_MODES,
+ TASK_RESULT_TYPES,
+ TASK_INPUT_RULES,
+ TASK_MASK_MODES,
+ TASK_RUNTIME_APIS,
+ VALID_TASK_EXECUTION_MODES,
+ VALID_TASK_RESULT_TYPES,
+ VALID_TASK_INPUT_RULES,
+ VALID_TASK_MASK_MODES,
+ VALID_TASK_RUNTIME_APIS,
+ TASK_EXECUTION_MODE_META,
+ TASK_RESULT_TYPE_META,
+ getTaskExecutionModeMeta,
+ getTaskExecutionModeLabel,
+ getTaskExecutionModeDescription,
+ getTaskResultTypeMeta,
+ getTaskResultTypeLabel,
+ getTaskResultTypeDescription,
+ getTaskRuntimeRequirement,
+ getTaskRuntimeRequirementLabel,
+ normalizeEnumValue,
+ cloneJSON,
+ createTaskIdFromName,
+ getDefaultOutputInstruction,
+ getDefaultResultTypeForMode,
+ normalizeTaskConfig,
+ normalizeTaskConfigs,
+ createDefaultTaskConfigs,
+ DEFAULT_TASK_CONFIGS,
+ DEFAULT_TASK_ID,
+ createDefaultState,
+ normalizeState,
+ createDefaultExcaliAISettings,
+ LEGACY_TASK_NAME_TO_ID,
+ loadExcaliAISettings
+ };
+ };
+
+ // src/sharedUtils/i18n.ts
+ function interpolateTranslation(template, params = {}) {
+ return Object.entries(params).reduce(
+ (result, [key, value]) => result.split(`{${key}}`).join(String(value)),
+ template
+ );
+ }
+ function createTranslator(requestedLocale, catalogs, fallbackLocale = "en") {
+ const locale = requestedLocale.toLowerCase().replaceAll("_", "-");
+ const baseLocale = locale.split("-")[0] ?? locale;
+ return (key, params = {}) => {
+ const template = catalogs[locale]?.[key] ?? catalogs[baseLocale]?.[key] ?? catalogs[fallbackLocale]?.[key] ?? key;
+ return interpolateTranslation(template, params);
+ };
}
- const imageDataURL = await ea.createPNGBase64(
- null, scale, exportSettings, loader, "light", PADDING
- );
- ea.clear();
- return {imageDataURL, maskDataURL};
-}
+ // src/scripts/excali-ai/lang/en.ts
+ var en = {
+ scriptFailed: "ExcaliAI could not start. Check that your drawing is open and the selected images are available.",
+ requestFailed: "ExcaliAI could not complete this task. Check your model settings and try again.",
+ errorTitle: "Error",
+ thisScriptRequiresExcalidrawOrLaterPlease: "This script requires Excalidraw 2.23.0 or later. Please update the plugin.",
+ textResponse: "Text response",
+ usesTheTextOrMultimodalModelAnd: "Uses the text or multimodal model and returns structured output such as HTML, Mermaid, a mind map, or Excalidraw strokes.",
+ writePromptThenGenerateImage: "Write prompt, then generate image",
+ usesTheTextModelToWriteAn: "Uses the text model to write an image prompt from the canvas selection and/or user prompt, then sends that prompt to the image model.",
+ sendPromptStraightToImageModel: "Send prompt straight to image model",
+ sendsOnlyTheUserSPromptTo: "Sends only the user's prompt to the image model. No text-model prompt writing step and no canvas image input.",
+ editSelectedImage: "Edit selected image",
+ usesTheSelectedImageAsTheSource: "Uses the selected image as the source and applies either a mask edit or a prompt-based transform.",
+ embedsTheResponseAsASingleHtml: "Embeds the response as a single HTML result.",
+ mindMap: "Mind Map",
+ importsTheResponseIntoMindmapBuilder: "Imports the response into MindMap Builder.",
+ mermaid: "Mermaid",
+ createsAMermaidDiagram: "Creates a Mermaid diagram.",
+ excalidrawStrokes: "Excalidraw Strokes",
+ usesSvgBehindTheScenesToGenerate: "Uses SVG behind the scenes to generate Excalidraw strokes.",
+ imagePromptNote: "Image + prompt note",
+ generatesAnImageAndAddsTheModel: "Generates an image and adds the model's revised prompt underneath when available.",
+ imageOnly: "Image only",
+ generatesOnlyTheImageWithoutAddingThe: "Generates only the image, without adding the revised prompt underneath.",
+ mindmapBuilder: "MindMap Builder",
+ none: "None",
+ turnThisIntoASingleHtmlFile: "Turn this into a single html file using tailwind. Return a single message containing only the html file in a codeblock.",
+ returnOnlyTheMindMapAsPlain: "Return only the mind map as plain text. Use one # heading for the central node, then nested - bullets for branches. Do not use bold, italics, code fences, tables, or explanatory text.",
+ returnASingleMessageContainingOnlyThe: "Return a single message containing only the mermaid diagram in a codeblock.",
+ returnASingleMessageContainingOnlyThe2: "Return a single message containing only the SVG code in an html codeblock.",
+ returnASingleMessageWithTheGenerated: "Return a single message with the generated image prompt in a codeblock",
+ task: "Task {value1}",
+ challengeMyThinking: "Challenge my thinking",
+ turnTheSelectedImageAndOptionalPrompt: "Turn the selected image and optional prompt into a Mermaid mind map. If conversion fails, open More Tools > Mermaid to Excalidraw and edit the generated script.",
+ yourTaskIsToInterpretAScreenshot: "Your task is to interpret a screenshot of a whiteboard, translating its ideas into a Mermaid graph. The whiteboard will encompass thoughts on a subject. Within the mind map, distinguish ideas that challenge, dispute, or contradict the whiteboard content. Additionally, include concepts that expand, complement, or advance the user's thinking. Utilize the Mermaid graph diagram type and present the resulting Mermaid diagram within a code block. Ensure the Mermaid script excludes the use of parentheses ().",
+ convertSketchToShapes: "Convert sketch to shapes",
+ convertSelectedSketchesIntoExcalidrawStrokesWorks: "Convert selected sketches into Excalidraw strokes. Works best with a small number of simple shapes. Experimental.",
+ givenAnImageFeaturingVariousGeometricShapes: "Given an image featuring various geometric shapes drawn by the user, your objective is to analyze the input and generate SVG code that accurately represents these shapes. Your output will be the SVG code enclosed in an HTML code block.",
+ createASimpleExcalidrawIcon: "Create a simple Excalidraw icon",
+ turnATextPromptIntoASimple: "Turn a text prompt into a simple icon and insert it into Excalidraw as strokes. Text prompt only. Experimental.",
+ givenADescriptionOfAnSvgImage: "Given a description of an SVG image from the user, your objective is to generate the corresponding SVG code. Avoid incorporating textual elements within the generated SVG. Your output should be the resulting SVG code enclosed in an HTML code block.",
+ createAStickFigure: "Create a stick figure",
+ sendOnlyTheTextPromptToThe: "Send only the text prompt to the configured image model. Be specific. To keep the prompt unchanged, start with: 'DO NOT add any detail, just use it AS-IS:'",
+ youWillReceiveAPromptFromThe: "You will receive a prompt from the user. Your task involves drawing a simple stick figure or a scene involving a few stick figures based on the user's prompt. Create the stick figure based on the following style description. DO NOT add any detail, just use it AS-IS: Create a simple stick figure character with a large round head and a face in the style of sketchy caricatures. The stick figure should have a rudimentary body composed of straight lines representing the arms and legs. Hands and toes should be represented with round shapes, do not add details such as fingers or toes. Use fine lines, smooth curves, rounded shapes. The stick figure should retain a playful and childlike simplicity, reminiscent of a doodle someone might draw on the corner of a notebook page. Create a black and white drawing, a hand-drawn figure on white background.",
+ editAnImage: "Edit an image",
+ imageElementsAreUsedAsTheSource: "Image elements are used as the source image. In mask mode, shapes on top become the mask. Turn mask edit off to flatten non-image elements into the source image and apply a prompt-based transform.",
+ generateAnImageFromImageAndPrompt: "Generate an image from image and prompt",
+ generateAnImageFromTheSelectedImage: "Generate an image from the selected image and your prompt. Add context in the prompt to guide how the image should be interpreted.",
+ yourTaskInvolvesReceivingAnImageAnd: "Your task involves receiving an image and a textual prompt from the user. Your goal is to craft a detailed, accurate, and descriptive narrative of the image, tailored for effective image generation. Utilize the user-provided text prompt to inform and guide your depiction of the image. Ensure the resulting image remains text-free.",
+ generateAnImageFromPrompt: "Generate an image from prompt",
+ generateAnImageToIllustrateAQuote: "Generate an image to illustrate a quote",
+ turnAQuoteIntoAnIllustratedScene: "Turn a quote into an illustrated scene. Include the author's name if you want the result to reference them.",
+ yourTaskInvolvesTransformingAUserProvided: "Your task involves transforming a user-provided quote into a detailed and imaginative illustration. Craft a visual representation that captures the essence of the quote and resonates well with a broad audience. If the Author's name is provided, aim to establish a connection between the illustration and the Author. This can be achieved by referencing a well-known story from the Author, situating the image in the Author's era or setting, or employing other creative methods of association. Additionally, provide preferences for styling, such as the chosen medium and artistic direction, to guide the image creation process. Ensure the resulting image remains text-free. Your task output should comprise a descriptive and detailed narrative aimed at facilitating the creation of a captivating illustration from the quote.",
+ generateIconVariantsBasedOnInputImage: "Generate 4 icon-variants based on input image",
+ generateAXSheetOfFourIcon: "Generate a 2x2 sheet of four icon variations from the selected sketch. Add a prompt if you want to steer the result.",
+ givenASimpleSketchAndAnOptional: "Given a simple sketch and an optional text prompt from the user, your task is to generate a descriptive narrative tailored for effective image generation, capturing the style of the sketch. Utilize the text prompt to guide the description. Your objective is to instruct DALL-E to create a collage of four minimalist black and white hand-drawn pencil sketches in a 2x2 matrix format. Each sketch should convert the user's sketch into simple artistic SVG icons with transparent backgrounds. Ensure the resulting images remain text-free, maintaining a minimalist, easy-to-understand style, and omit framing borders. Only include a pencil in the drawing if it is explicitly mentioned in the user prompt or included in the sketch.",
+ visualBrainstorm: "Visual brainstorm",
+ generateAnImageFromTheSelectedImage2: "Generate an image from the selected image and prompt to spark new ideas.",
+ yourObjectiveIsToInterpretAScreenshot: "Your objective is to interpret a screenshot of a whiteboard, creating an image aimed at sparking further thoughts on the subject. The whiteboard will present diverse ideas about a specific topic. Your generated image should achieve one of two purposes: highlighting concepts that challenge, dispute, or contradict the whiteboard content, or introducing ideas that expand, complement, or enrich the user's thinking. You have the option to include multiple tiles in the resulting image, resembling a sequence akin to a comic strip. Ensure that the image remains devoid of text.",
+ wireframeToCode: "Wireframe to code",
+ interpretTheSelectedWireframeAndGenerateA: "Interpret the selected wireframe and generate a web app as a single HTML file. You can copy the result from the embeddable menu.",
+ youAreAnExpertTailwindDeveloperA: "You are an expert tailwind developer. A user will provide you with a low-fidelity wireframe of an application and you will return a single html file that uses tailwind to create the website. Use creative license to make the application more fleshed out. Write the necessary javascript code. If you need to insert an image, use placehold.co to create a placeholder image.",
+ createMindmap: "Create Mindmap",
+ createAHierarchicalMindMapFromThe: "Create a hierarchical mind map from the selected image, if any, and your prompt, then import it into MindMap Builder. Requires MindMap Builder to be available.",
+ youWillReceiveATextPromptAnd: "You will receive a text prompt and may also receive an image. Create a mind map as a hierarchical plain-text outline based on the image content, if provided, and the text prompt. Return only the mind map. Use exactly one markdown H1 heading for the central node, then - bullets for branches and indented - bullets for sub-branches. Do not use bold, italics, code fences, numbering, commentary, or any markdown formatting other than the heading and bullet list.",
+ excalidrawAiIsDisabledOrUnavailableEnable: "Excalidraw AI is disabled or unavailable. Enable it in plugin settings.",
+ noRunnableAiTasksAreConfiguredOpen: "No runnable AI tasks are configured. Open Task Editor to add a task or reset the shipped presets.",
+ taskUsesAnImageResultWithUse: 'Task "{value1}" uses an image result with {value2}. Use {value3} or {value4} instead.',
+ taskMustUseAnImageResultWhen: 'Task "{value1}" must use an image result when {value2} is selected.',
+ taskCannotSendACanvasImageWhen: 'Task "{value1}" cannot send a canvas image when {value2} is selected.',
+ taskMustUseTheImageResultWhen: 'Task "{value1}" must use the image result when {value2} is selected.',
+ taskCanOnlyEnableMaskModeWhen: 'Task "{value1}" can only enable mask mode when {value2} is selected.',
+ noTextOrMultimodalModelsAreReady: "No text or multimodal models are ready to use. Add an API key to a provider profile and assign at least one text model in Excalidraw AI settings.",
+ noImageModelsAreReadyToUse: "No image models are ready to use. Add an API key to a provider profile and assign at least one image model in Excalidraw AI settings.",
+ theSelectedTextModelIsnTConfigured: "The selected text model ({value1}) isn't configured in Excalidraw AI settings.",
+ theProviderProfileForTextModelIs: "The provider profile ({value1}) for text model {value2} is missing from Excalidraw AI settings.",
+ theSelectedProviderProfileDoesnTHave: "The selected provider profile ({value1}) doesn't have an API key configured.",
+ theSelectedTextModelIsSetTo: "The selected text model ({value1}) is set to text-only. Choose a multimodal model for image analysis tasks.",
+ theProviderProfileForImageModelIs: "The provider profile ({value1}) for image model {value2} is missing from Excalidraw AI settings.",
+ theSelectedImageModelDoesnTSupport: "The selected image model ({value1}) doesn't support prompt-based transforms in Excalidraw AI settings.",
+ theSelectedImageModelDoesnTSupport2: "The selected image model ({value1}) doesn't support mask-based edits in Excalidraw AI settings.",
+ theImageRequestFailed: "The image request failed.",
+ somethingWentWrongCheckDeveloperConsoleFor: "Something went wrong! Check developer console for more.",
+ localstorageSetitemError: "localStorage.setItem error: {value1}",
+ selectContentBeforeRunningExcaliai: "Select content before running ExcaliAI.",
+ enterAPromptBeforeRunningExcaliai: "Enter a prompt before running ExcaliAI.",
+ enterAPromptOrSelectContentBefore: "Enter a prompt or select content before running ExcaliAI.",
+ enterInstructionsForHowTheImageShould: "Enter instructions for how the image should be changed.",
+ selectAnImage: "Select an image.",
+ selectCanvasContentBeforeRunningThisTask: "Select canvas content before running this task.",
+ selectOrCreateAMask: "Select or create a mask.",
+ unexpectedExcalidrawautomateError: "Unexpected ExcalidrawAutomate error.",
+ theModelHitTheTokenLimitBefore: "The model hit the token limit before it finished the HTML output. Increase 'Text max token override' in ExcaliAI or raise the default AI response token limit in plugin settings.",
+ mindmapBuilderIsNotAvailable: "MindMap Builder is not available.",
+ couldNotConnectToMindmapBuilder: "Could not connect to MindMap Builder.",
+ couldNotCreateTheMindMap: "Could not create the mind map.",
+ mindMapCreatedInMindmapBuilder: "Mind map created in MindMap Builder.",
+ openMoreToolsMermaidToExcalidrawTo: "Open [More Tools > Mermaid to Excalidraw] to review and fix the generated Mermaid script.
",
+ openMoreToolsMermaidToExcalidrawTo2: "Open More Tools > Mermaid to Excalidraw to review or edit the generated diagram.",
+ newTask: "New Task {value1}",
+ describeWhatThisTaskDoes: "Describe what this task does.",
+ thisTaskIgnoresTheCurrentCanvasSelection: "This task ignores the current canvas selection and uses only the text prompt.",
+ maskEditIsOffNonImageElements: "Mask edit is off. Non-image elements are flattened into the preview image and sent as a prompt-based transform.",
+ thisModelDoesnTSupportMaskEdits: "This model doesn't support mask edits. Non-image elements are flattened into the preview image and sent as a prompt-based transform.",
+ determinesHowTheTaskRuns: "Determines how the task runs.",
+ controlsHowExcaliaiInterpretsTheModelResponse: "Controls how ExcaliAI interprets the model response.",
+ validationNoTasksConfiguredAddATask: "Validation: No tasks configured. Add a task or reset the shipped presets.",
+ validation: "Validation: {value1}",
+ validationTaskConfigurationIsValid: "Validation: Task configuration is valid.",
+ excaliaiTaskEditor: '{value1}