@orangecatai/adgen-canvas 0.0.30 → 0.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/{chunk-2WAJTVZS.js → chunk-3SKNYE32.js} +2 -2
- package/dist/dev/{chunk-X6KPARLJ.js → chunk-N472V5Q6.js} +3 -3
- package/dist/dev/data/{image-HGVO7LLH.js → image-C5LHCG7R.js} +3 -3
- package/dist/dev/index.css +3 -0
- package/dist/dev/index.css.map +2 -2
- package/dist/dev/index.js +231 -48
- package/dist/dev/index.js.map +3 -3
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/{chunk-SZMIDXG6.js → chunk-7Z7DBJZ7.js} +1 -1
- package/dist/prod/{chunk-GTYNSLQE.js → chunk-ZRY46W7L.js} +2 -2
- package/dist/prod/data/image-NBSHNEUL.js +1 -0
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +65 -55
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/excalidraw/components/AIChatPanel.d.ts +11 -1
- package/dist/types/excalidraw/components/ai-chat/agentLoop.d.ts +18 -1
- package/dist/types/excalidraw/components/ai-chat/canvasTools.d.ts +43 -0
- package/dist/types/excalidraw/components/ai-chat/reviewerAgent.d.ts +7 -1
- package/package.json +1 -1
- package/dist/prod/data/image-B2RV64CG.js +0 -1
- /package/dist/dev/{chunk-2WAJTVZS.js.map → chunk-3SKNYE32.js.map} +0 -0
- /package/dist/dev/{chunk-X6KPARLJ.js.map → chunk-N472V5Q6.js.map} +0 -0
- /package/dist/dev/data/{image-HGVO7LLH.js.map → image-C5LHCG7R.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"./chunk-Z5NKEFVG.js";import"./chunk-
|
|
1
|
+
import{a,b,c,d}from"./chunk-Z5NKEFVG.js";import"./chunk-7Z7DBJZ7.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-
|
|
1
|
+
import{a as r,c as t}from"./chunk-Z5NKEFVG.js";import"./chunk-7Z7DBJZ7.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,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { type ToolAction } from "./ai-chat/agentLoop";
|
|
2
|
+
import { type ToolAction, type FrameGenerationMeta } from "./ai-chat/agentLoop";
|
|
3
3
|
import "./AIChatPanel.scss";
|
|
4
4
|
import type { ReviewerFeedback } from "./ai-chat/reviewerAgent";
|
|
5
5
|
import type { ExcalidrawImperativeAPI } from "../types";
|
|
@@ -18,6 +18,16 @@ export type ChatMessage = {
|
|
|
18
18
|
}>;
|
|
19
19
|
/** Reviewer feedback attached to an assistant message after HTML ad generation */
|
|
20
20
|
reviewFeedback?: ReviewerFeedback;
|
|
21
|
+
/**
|
|
22
|
+
* Set on an assistant message that generated/regenerated an image for a
|
|
23
|
+
* frame. Persisted so that on reload / session switch,
|
|
24
|
+
* resetAndSeedFrameGenerationMemory can rebuild canvasTools' in-memory
|
|
25
|
+
* frame-continuity state (original prompt anchor, reference-image reuse,
|
|
26
|
+
* "frames generated in this conversation" list) from chat history — none
|
|
27
|
+
* of that survives a reload on its own since it lives in a JS module, not
|
|
28
|
+
* the DB. See FrameGenerationMeta in agentLoop.ts.
|
|
29
|
+
*/
|
|
30
|
+
generatedFrame?: FrameGenerationMeta;
|
|
21
31
|
};
|
|
22
32
|
export type ChatSession = {
|
|
23
33
|
id: string;
|
|
@@ -56,9 +56,26 @@ export type AgentUpdate = {
|
|
|
56
56
|
message: string;
|
|
57
57
|
feedback: import("./reviewerAgent").ReviewerFeedback;
|
|
58
58
|
};
|
|
59
|
+
/**
|
|
60
|
+
* Metadata about a frame this turn generated an image for. The caller
|
|
61
|
+
* (AIChatPanel) attaches this to the persisted assistant ChatMessage so that
|
|
62
|
+
* on a later page load / session switch, canvasTools' in-memory
|
|
63
|
+
* frameGenerationMemory / chatCreatedFrames (which otherwise reset with the
|
|
64
|
+
* page) can be reconstructed from chat history via
|
|
65
|
+
* resetAndSeedFrameGenerationMemory — without this, "fix the previous image"
|
|
66
|
+
* only works within the same unreloaded tab, which defeats the point.
|
|
67
|
+
*/
|
|
68
|
+
export type FrameGenerationMeta = {
|
|
69
|
+
frameId: string;
|
|
70
|
+
prompt: string;
|
|
71
|
+
referenceImageIndex?: number;
|
|
72
|
+
userBrief: string;
|
|
73
|
+
};
|
|
59
74
|
export type AgentResult = {
|
|
60
75
|
reply: string;
|
|
61
76
|
toolActions: ToolAction[];
|
|
77
|
+
/** Set when this turn generated (or regenerated) an image for a frame. */
|
|
78
|
+
frameGeneration?: FrameGenerationMeta;
|
|
62
79
|
};
|
|
63
80
|
export type FileAttachment = {
|
|
64
81
|
name: string;
|
|
@@ -107,7 +124,7 @@ export declare function runAgentLoop(opts: {
|
|
|
107
124
|
* Maximum number of reviewer rounds per banner.
|
|
108
125
|
* After this many rounds the reviewer is skipped and the outer MAX_ITERATIONS
|
|
109
126
|
* cap handles loop termination.
|
|
110
|
-
* @default
|
|
127
|
+
* @default 1
|
|
111
128
|
*/
|
|
112
129
|
maxReviewRounds?: number;
|
|
113
130
|
}): Promise<AgentResult>;
|
|
@@ -1011,6 +1011,18 @@ export type ToolExecutionContext = {
|
|
|
1011
1011
|
* failure mode for private Vercel Blob URLs.
|
|
1012
1012
|
*/
|
|
1013
1013
|
_templateJsonCache?: Map<string, string>;
|
|
1014
|
+
/**
|
|
1015
|
+
* The user's own first message, verbatim (not the LLM's paraphrase of it).
|
|
1016
|
+
* generate_image's `prompt` argument is always authored fresh by the chat
|
|
1017
|
+
* model — nothing forces it to preserve specific subject/scene/action
|
|
1018
|
+
* details the user actually typed (only on-image copy is instructed to be
|
|
1019
|
+
* verbatim). execGenerateImage appends this raw text to every image-gen
|
|
1020
|
+
* call for a frame as a fidelity backstop, so a model that quietly drops or
|
|
1021
|
+
* substitutes a described detail (e.g. "boy playing guitar" -> "boy
|
|
1022
|
+
* walking") doesn't silently ship — the image model sees the user's exact
|
|
1023
|
+
* words either way.
|
|
1024
|
+
*/
|
|
1025
|
+
originalUserBrief?: string;
|
|
1014
1026
|
};
|
|
1015
1027
|
export type ToolResult = {
|
|
1016
1028
|
success: boolean;
|
|
@@ -1019,3 +1031,34 @@ export type ToolResult = {
|
|
|
1019
1031
|
statusMessage: string;
|
|
1020
1032
|
};
|
|
1021
1033
|
export declare function executeCanvasTool(toolName: string, rawArgs: string, ctx: ToolExecutionContext): Promise<ToolResult>;
|
|
1034
|
+
/**
|
|
1035
|
+
* Renders `chatCreatedFrames` as a system-message string for injection into
|
|
1036
|
+
* the agent loop, or "" if this session hasn't generated anything yet (in
|
|
1037
|
+
* which case the caller should skip adding a message at all).
|
|
1038
|
+
*/
|
|
1039
|
+
export declare function getChatCreatedFramesContext(): string;
|
|
1040
|
+
/**
|
|
1041
|
+
* Rebuilds `frameGenerationMemory` and `chatCreatedFrames` from persisted
|
|
1042
|
+
* chat history (the assistant messages' `generatedFrame` metadata — see
|
|
1043
|
+
* `FrameGenerationMeta` in agentLoop.ts). Both are in-memory module state
|
|
1044
|
+
* that would otherwise be empty after a page reload or a chat-session
|
|
1045
|
+
* switch, silently breaking "fix the previous image" the moment the tab
|
|
1046
|
+
* isn't the one that generated it. Call this whenever chat history is
|
|
1047
|
+
* (re)loaded — on mount and on every session switch — BEFORE the next
|
|
1048
|
+
* message is sent.
|
|
1049
|
+
*
|
|
1050
|
+
* Always clears first: this also fixes the memory leaking across sessions —
|
|
1051
|
+
* without a reset, switching to a different chat would keep the previous
|
|
1052
|
+
* session's frames in the "generated in this conversation" list.
|
|
1053
|
+
*
|
|
1054
|
+
* Takes a loosely-typed array (not the SDK's `ChatMessage[]`) to avoid a
|
|
1055
|
+
* circular import — `AIChatPanel.tsx` imports FROM this file already.
|
|
1056
|
+
*/
|
|
1057
|
+
export declare function resetAndSeedFrameGenerationMemory(messages: Array<{
|
|
1058
|
+
generatedFrame?: {
|
|
1059
|
+
frameId: string;
|
|
1060
|
+
prompt: string;
|
|
1061
|
+
referenceImageIndex?: number;
|
|
1062
|
+
userBrief: string;
|
|
1063
|
+
};
|
|
1064
|
+
}>): void;
|
|
@@ -62,7 +62,13 @@ export declare function runReviewerAgent(opts: {
|
|
|
62
62
|
width: number;
|
|
63
63
|
height: number;
|
|
64
64
|
};
|
|
65
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* All of the user's text turns in the conversation, concatenated — not
|
|
67
|
+
* just the first message. The actual creative brief is often not
|
|
68
|
+
* userMessages[0] (e.g. "hi" -> clarifying questions -> the message that
|
|
69
|
+
* actually describes the ad), so anchoring to only the first message can
|
|
70
|
+
* silently drop the real brief.
|
|
71
|
+
*/
|
|
66
72
|
userBrief: string;
|
|
67
73
|
/**
|
|
68
74
|
* The original user-supplied reference image used to generate this frame
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as a,T as b,U as c}from"../chunk-GTYNSLQE.js";import"../chunk-SZMIDXG6.js";import"../chunk-SRAX5OIU.js";export{c as decodePngMetadata,b as encodePngMetadata,a as getTEXtChunk};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|