@orangecatai/adgen-canvas 0.0.20 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/dev/{chunk-Y6SGUVKW.js → chunk-RD5LX7MN.js} +2 -2
  2. package/dist/dev/{chunk-ILOOQ6LL.js → chunk-WFKR6OGI.js} +3 -15
  3. package/dist/dev/{chunk-ILOOQ6LL.js.map → chunk-WFKR6OGI.js.map} +2 -2
  4. package/dist/dev/data/{image-MFQPU4SU.js → image-DSU2H6P5.js} +3 -3
  5. package/dist/dev/index.js +132 -494
  6. package/dist/dev/index.js.map +4 -4
  7. package/dist/dev/subset-shared.chunk.js +1 -1
  8. package/dist/dev/subset-worker.chunk.js +1 -1
  9. package/dist/prod/{chunk-SDWSFP7L.js → chunk-OWNL6YOR.js} +1 -1
  10. package/dist/prod/{chunk-3BUGCS63.js → chunk-RXJEXEKA.js} +3 -3
  11. package/dist/prod/data/image-I7MZ4QNS.js +1 -0
  12. package/dist/prod/index.js +56 -56
  13. package/dist/prod/subset-shared.chunk.js +1 -1
  14. package/dist/prod/subset-worker.chunk.js +1 -1
  15. package/dist/types/excalidraw/components/AIChatPanel.d.ts +12 -1
  16. package/dist/types/excalidraw/components/ImageEditToolbar.d.ts +0 -1
  17. package/dist/types/excalidraw/components/ai-chat/agentLoop.d.ts +1 -1
  18. package/dist/types/excalidraw/components/ai-chat/audioUtils.d.ts +0 -5
  19. package/dist/types/excalidraw/components/ai-chat/canvasTools.d.ts +2 -1
  20. package/dist/types/excalidraw/components/ai-chat/reviewerAgent.d.ts +2 -1
  21. package/dist/types/excalidraw/components/auto-resize/AutoResizePanel.d.ts +2 -2
  22. package/dist/types/excalidraw/components/auto-resize/autoResizeEngine.d.ts +1 -1
  23. package/dist/types/excalidraw/types.d.ts +15 -19
  24. package/dist/types/excalidraw/utils/imageApi.d.ts +1 -1
  25. package/package.json +1 -1
  26. package/dist/prod/data/image-NBDZMG3P.js +0 -1
  27. package/dist/types/excalidraw/utils/leonardoApiKey.d.ts +0 -1
  28. /package/dist/dev/{chunk-Y6SGUVKW.js.map → chunk-RD5LX7MN.js.map} +0 -0
  29. /package/dist/dev/data/{image-MFQPU4SU.js.map → image-DSU2H6P5.js.map} +0 -0
@@ -1 +1 @@
1
- import{a,b,c,d}from"./chunk-Z5NKEFVG.js";import"./chunk-SDWSFP7L.js";import"./chunk-SRAX5OIU.js";export{a as Commands,b as subsetToBase64,c as subsetToBinary,d as toBase64};
1
+ import{a,b,c,d}from"./chunk-Z5NKEFVG.js";import"./chunk-OWNL6YOR.js";import"./chunk-SRAX5OIU.js";export{a as Commands,b as subsetToBase64,c as subsetToBinary,d as toBase64};
@@ -1 +1 @@
1
- import{a as r,c as t}from"./chunk-Z5NKEFVG.js";import"./chunk-SDWSFP7L.js";import"./chunk-SRAX5OIU.js";var s=import.meta.url?new URL(import.meta.url):void 0;typeof window>"u"&&typeof self<"u"&&(self.onmessage=async e=>{switch(e.data.command){case r.Subset:let a=await t(e.data.arrayBuffer,e.data.codePoints);self.postMessage(a,{transfer:[a]});break}});export{s as WorkerUrl};
1
+ import{a as r,c as t}from"./chunk-Z5NKEFVG.js";import"./chunk-OWNL6YOR.js";import"./chunk-SRAX5OIU.js";var s=import.meta.url?new URL(import.meta.url):void 0;typeof window>"u"&&typeof self<"u"&&(self.onmessage=async e=>{switch(e.data.command){case r.Subset:let a=await t(e.data.arrayBuffer,e.data.codePoints);self.postMessage(a,{transfer:[a]});break}});export{s as WorkerUrl};
@@ -31,7 +31,18 @@ export type AIChatPanelRef = {
31
31
  export type AIChatPanelProps = {
32
32
  isOpen: boolean;
33
33
  onClose: () => void;
34
- apiKey?: string;
34
+ /**
35
+ * Host proxy URL for the chat / agent loop / reviewer OpenRouter calls. The
36
+ * SDK POSTs the OpenRouter request body here; the host injects the API key,
37
+ * gates credits, and streams the response back. Keeps the provider key out of
38
+ * the browser.
39
+ */
40
+ chatUrl?: string;
41
+ /**
42
+ * Host proxy URL for the agent's generate_image tool. Same contract as
43
+ * `chatUrl`. Keeps the provider key out of the browser.
44
+ */
45
+ imageGenUrl?: string;
35
46
  excalidrawAPI?: ExcalidrawImperativeAPI;
36
47
  initialMessages?: ChatMessage[];
37
48
  initialSessionId?: string;
@@ -3,7 +3,6 @@ import type { ExcalidrawImageElement, NonDeletedExcalidrawElement } from "@orang
3
3
  import type { AppClassProperties } from "../types";
4
4
  export interface ImageEditToolbarCallbacks {
5
5
  onQuickEdit?: () => void;
6
- onUpscale?: () => void;
7
6
  onRemoveBG?: () => void;
8
7
  onCrop?: () => void;
9
8
  onDownload?: () => void;
@@ -84,7 +84,7 @@ export declare function runAgentLoop(opts: {
84
84
  frameScreenshot?: string;
85
85
  fileAttachments?: FileAttachment[];
86
86
  webSearchEnabled?: boolean;
87
- apiKey: string;
87
+ chatUrl: string;
88
88
  chatModel?: string;
89
89
  agentImageModel?: string;
90
90
  toolCtx: ToolExecutionContext;
@@ -3,8 +3,3 @@
3
3
  * using the Web Audio API. Mistral Voxtral only accepts mp3 or wav.
4
4
  */
5
5
  export declare function blobToWavBase64(blob: Blob): Promise<string>;
6
- /**
7
- * Sends a base64-encoded audio string to the OpenRouter Voxtral model for
8
- * transcription. `format` must be "wav" or "mp3".
9
- */
10
- export declare function transcribeAudio(base64Audio: string, format: string, apiKey: string, voiceModel?: string): Promise<string>;
@@ -623,7 +623,8 @@ export declare function getFrameContext(api: ExcalidrawImperativeAPI, frameId: s
623
623
  } | null;
624
624
  export type ToolExecutionContext = {
625
625
  excalidrawAPI: ExcalidrawImperativeAPI;
626
- openRouterApiKey: string;
626
+ /** Host proxy URL for the agent's generate_image tool. Key stays server-side. */
627
+ imageGenUrl: string;
627
628
  signal?: AbortSignal;
628
629
  /** Override OpenRouter model ID for the agent's generate_image tool. */
629
630
  agentImageModel?: string;
@@ -56,7 +56,8 @@ export declare function runReviewerAgent(opts: {
56
56
  /** Original user request — first message only, not full conversation history */
57
57
  userBrief: string;
58
58
  brandContext?: BrandContext;
59
- apiKey: string;
59
+ /** Host proxy URL for the reviewer's OpenRouter call. Key stays server-side. */
60
+ chatUrl: string;
60
61
  /** OpenRouter model tag. Must be vision-capable. Defaults to minimax/minimax-m3 */
61
62
  reviewerModel?: string;
62
63
  signal?: AbortSignal;
@@ -1,7 +1,7 @@
1
1
  import "./AutoResizePanel.scss";
2
2
  import type { ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@orangecatai/element/types";
3
3
  import type { AppClassProperties } from "../../types";
4
- export declare const AutoResizePanel: ({ element, app, onClose, onBeforeAutoResize, onAfterAutoResize, onRunningChange, openRouterApiKey, chatModel, agentImageModel, }: {
4
+ export declare const AutoResizePanel: ({ element, app, onClose, onBeforeAutoResize, onAfterAutoResize, onRunningChange, autoResizeUrl, chatModel, agentImageModel, }: {
5
5
  element: NonDeletedExcalidrawElement & ExcalidrawFrameLikeElement;
6
6
  app: AppClassProperties;
7
7
  onClose: () => void;
@@ -11,7 +11,7 @@ export declare const AutoResizePanel: ({ element, app, onClose, onBeforeAutoResi
11
11
  }>;
12
12
  onAfterAutoResize?: () => void;
13
13
  onRunningChange?: (running: boolean) => void;
14
- openRouterApiKey: string;
14
+ autoResizeUrl: string;
15
15
  chatModel: string;
16
16
  agentImageModel?: string;
17
17
  }) => import("react/jsx-runtime").JSX.Element;
@@ -126,7 +126,7 @@ export declare function runAutoResize(opts: {
126
126
  sourceFrameId: string;
127
127
  targetDimensions: TargetDimension[];
128
128
  app: AppClassProperties;
129
- openRouterApiKey: string;
129
+ autoResizeUrl: string;
130
130
  chatModel?: string;
131
131
  agentImageModel?: string;
132
132
  customFontMap?: Record<string, number>;
@@ -566,20 +566,22 @@ export interface ExcalidrawProps {
566
566
  showDeprecatedFonts?: boolean;
567
567
  renderScrollbars?: boolean;
568
568
  /**
569
- * Leonardo API key for image toolbar upscale action.
570
- * When provided, takes precedence over the VITE_APP_LEONARDO_API_KEY env variable.
569
+ * Host proxy URL for OpenRouter image generation (ImageGeneratorPanel,
570
+ * ImageQuickEditPanel). The SDK POSTs the OpenRouter request body here; the
571
+ * host injects the API key and forwards. Keeps the provider key out of the
572
+ * browser.
571
573
  */
572
- leonardoApiKey?: string;
574
+ imageGenUrl?: string;
573
575
  /**
574
- * OpenRouter API key for auto-resize layout planning.
575
- * When provided, takes precedence over the VITE_APP_OPEN_ROUTER_API_KEY env variable.
576
+ * Host proxy URL for the auto-resize engine's OpenRouter calls (layout
577
+ * planning, vision tagging, HTML generation, reviewer). Key stays server-side.
576
578
  */
577
- openRouterApiKey?: string;
579
+ autoResizeUrl?: string;
578
580
  /**
579
- * remove.bg API key for the remove background toolbar action.
580
- * When provided, takes precedence over the VITE_APP_REMOVE_BG_API_KEY env variable.
581
+ * Host proxy URL for the remove.bg toolbar action. The SDK POSTs
582
+ * `{ imageDataUrl }` and receives `{ imageDataUrl }`. Key stays server-side.
581
583
  */
582
- removeBgApiKey?: string;
584
+ removeBgUrl?: string;
583
585
  /**
584
586
  * Called before any image generation (ImageGeneratorPanel, ImageQuickEditPanel,
585
587
  * or agent loop generate_image tool). Return `{ allowed: false }` to block.
@@ -593,16 +595,6 @@ export interface ExcalidrawProps {
593
595
  * Called after a successful image generation from any panel or agent tool.
594
596
  */
595
597
  onAfterImageGen?: () => void;
596
- /**
597
- * Called before an upscale is run (deduct credits, check quota).
598
- * Return `{ allowed: false, error: "..." }` to block the operation.
599
- */
600
- onBeforeUpscale?: () => Promise<{
601
- allowed: boolean;
602
- error?: string;
603
- }>;
604
- /** Called after a successful upscale. */
605
- onAfterUpscale?: () => void;
606
598
  /**
607
599
  * Called before a background removal is run (deduct credits, check quota).
608
600
  * Return `{ allowed: false, error: "..." }` to block the operation.
@@ -809,6 +801,10 @@ export type AppClassProperties = {
809
801
  onPointerDownEmitter: App["onPointerDownEmitter"];
810
802
  lastPointerMoveCoords: App["lastPointerMoveCoords"];
811
803
  bindModeHandler: App["bindModeHandler"];
804
+ refresh: App["refresh"];
805
+ refreshEditorInterface: App["refreshEditorInterface"];
806
+ lassoTrail: App["lassoTrail"];
807
+ toggleSidebar: App["toggleSidebar"];
812
808
  };
813
809
  export type PointerDownState = Readonly<{
814
810
  origin: Readonly<{
@@ -1 +1 @@
1
- export declare function callOpenRouterImageAPI(prompt: string, modelId: string, aspectRatio: string, imageSize: string | null, textOutput: boolean, apiKey: string, referenceImageDataUrl?: string, signal?: AbortSignal): Promise<string>;
1
+ export declare function callOpenRouterImageAPI(prompt: string, modelId: string, aspectRatio: string, imageSize: string | null, textOutput: boolean, imageGenUrl: string, referenceImageDataUrl?: string, signal?: AbortSignal): Promise<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orangecatai/adgen-canvas",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "type": "module",
5
5
  "types": "./dist/types/excalidraw/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -1 +0,0 @@
1
- import{T as a,U as b,V as c}from"../chunk-3BUGCS63.js";import"../chunk-SDWSFP7L.js";import"../chunk-SRAX5OIU.js";export{c as decodePngMetadata,b as encodePngMetadata,a as getTEXtChunk};
@@ -1 +0,0 @@
1
- export declare function resolveLeonardoApiKey(propKey?: string): string;