@gui-chat-plugin/edit-image 0.0.1

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/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # @gui-chat-plugin/edit-image
2
+
3
+ [![npm version](https://badge.fury.io/js/%40gui-chat-plugin%2Fedit-image.svg)](https://www.npmjs.com/package/@gui-chat-plugin/edit-image)
4
+
5
+ Image editing plugin for GUI Chat applications. Edit previously generated images based on text prompts.
6
+
7
+ ## Features
8
+
9
+ - Edit existing images with natural language prompts
10
+ - Support for various editing operations (add objects, change style, modify background)
11
+ - Display edited images with original prompt
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ yarn add @gui-chat-plugin/edit-image
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ### Vue Integration
22
+
23
+ ```typescript
24
+ // In src/tools/index.ts
25
+ import EditImagePlugin from "@gui-chat-plugin/edit-image/vue";
26
+
27
+ const pluginList = [
28
+ // ... other plugins
29
+ EditImagePlugin,
30
+ ];
31
+
32
+ // In src/main.ts
33
+ import "@gui-chat-plugin/edit-image/style.css";
34
+ ```
35
+
36
+ ### Core-only Usage
37
+
38
+ ```typescript
39
+ import { executeEditImage, TOOL_DEFINITION } from "@gui-chat-plugin/edit-image";
40
+
41
+ // Edit an image
42
+ const result = await executeEditImage(context, {
43
+ prompt: "Add sunglasses to the person",
44
+ });
45
+ ```
46
+
47
+ ## API
48
+
49
+ ### EditImageArgs
50
+
51
+ ```typescript
52
+ interface EditImageArgs {
53
+ prompt: string; // Description of edits to make
54
+ }
55
+ ```
56
+
57
+ ### ImageToolData
58
+
59
+ ```typescript
60
+ interface ImageToolData {
61
+ imageData: string; // Base64 encoded image data
62
+ prompt: string; // The edit prompt used
63
+ }
64
+ ```
65
+
66
+ ## Requirements
67
+
68
+ This plugin requires the host application to provide an `editImage` function via the context:
69
+
70
+ ```typescript
71
+ context.app.editImage(prompt: string): Promise<EditImageResult>
72
+ ```
73
+
74
+ ## Development
75
+
76
+ ```bash
77
+ # Install dependencies
78
+ yarn install
79
+
80
+ # Run demo
81
+ yarn dev
82
+
83
+ # Build
84
+ yarn build
85
+
86
+ # Lint
87
+ yarn lint
88
+ ```
89
+
90
+ ## Test Prompts
91
+
92
+ Try these prompts to test the plugin (after generating an image first):
93
+
94
+ 1. "Add a rainbow in the sky of this image"
95
+ 2. "Change the background to a beach scene"
96
+ 3. "Make the colors more vibrant and add some butterflies"
97
+
98
+ ## License
99
+
100
+ MIT
@@ -0,0 +1,17 @@
1
+ export declare const TOOL_NAME = "editImage";
2
+ export declare const TOOL_DEFINITION: {
3
+ type: "function";
4
+ name: string;
5
+ description: string;
6
+ parameters: {
7
+ type: "object";
8
+ properties: {
9
+ prompt: {
10
+ type: string;
11
+ description: string;
12
+ };
13
+ };
14
+ required: string[];
15
+ };
16
+ };
17
+ //# sourceMappingURL=definition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/core/definition.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,cAAc,CAAC;AAErC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;CAe3B,CAAC"}
@@ -0,0 +1,5 @@
1
+ export type { ImageToolData, EditImageArgs, EditImageResult } from "./types";
2
+ export { TOOL_NAME, TOOL_DEFINITION } from "./definition";
3
+ export { pluginCore, editImage, executeEditImage } from "./plugin";
4
+ export { samples } from "./samples";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { ToolContext, ToolPluginCore } from "gui-chat-protocol";
2
+ import type { EditImageArgs, ImageToolData, EditImageResult } from "./types";
3
+ import { TOOL_NAME, TOOL_DEFINITION } from "./definition";
4
+ export declare const editImage: (context: ToolContext, args: EditImageArgs) => Promise<EditImageResult>;
5
+ export declare const pluginCore: ToolPluginCore<ImageToolData, unknown, EditImageArgs>;
6
+ export { TOOL_NAME, TOOL_DEFINITION };
7
+ export declare const executeEditImage: (context: ToolContext, args: EditImageArgs) => Promise<EditImageResult>;
8
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/core/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE1D,eAAO,MAAM,SAAS,GACpB,SAAS,WAAW,EACpB,MAAM,aAAa,KAClB,OAAO,CAAC,eAAe,CAQzB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,cAAc,CAAC,aAAa,EAAE,OAAO,EAAE,aAAa,CAM5E,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;AACtC,eAAO,MAAM,gBAAgB,YArBlB,WAAW,QACd,aAAa,KAClB,OAAO,CAAC,eAAe,CAmBe,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ToolSample } from "gui-chat-protocol";
2
+ export declare const samples: ToolSample[];
3
+ //# sourceMappingURL=samples.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"samples.d.ts","sourceRoot":"","sources":["../../src/core/samples.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAO,MAAM,OAAO,EAAE,UAAU,EAmB/B,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { ToolResult } from "gui-chat-protocol";
2
+ export interface ImageToolData {
3
+ imageData: string;
4
+ prompt: string;
5
+ }
6
+ export interface EditImageArgs {
7
+ prompt: string;
8
+ }
9
+ export type EditImageResult = ToolResult<ImageToolData>;
10
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC"}
package/dist/core.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i="editImage",n={type:"function",name:i,description:"Edit the previously generated image based on a text prompt.",parameters:{type:"object",properties:{prompt:{type:"string",description:"Description of the edits to be made to the image in English"}},required:["prompt"]}},e=async(t,s)=>{var a;const{prompt:o}=s;return(a=t.app)!=null&&a.editImage?t.app.editImage(o):{message:"editImage function not available"}},r={toolDefinition:n,execute:e,generatingMessage:"Editing image...",isEnabled:()=>!0,backends:["imageGen"]},g=e,p=[{name:"Add Sunglasses",args:{prompt:"Add stylish sunglasses to the subject"}},{name:"Change Background",args:{prompt:"Change the background to a beautiful sunset beach"}},{name:"Make it Artistic",args:{prompt:"Transform into an oil painting style"}}];exports.TOOL_DEFINITION=n;exports.TOOL_NAME=i;exports.editImage=e;exports.executeEditImage=g;exports.pluginCore=r;exports.samples=p;
package/dist/core.js ADDED
@@ -0,0 +1,52 @@
1
+ const s = "editImage", o = {
2
+ type: "function",
3
+ name: s,
4
+ description: "Edit the previously generated image based on a text prompt.",
5
+ parameters: {
6
+ type: "object",
7
+ properties: {
8
+ prompt: {
9
+ type: "string",
10
+ description: "Description of the edits to be made to the image in English"
11
+ }
12
+ },
13
+ required: ["prompt"]
14
+ }
15
+ }, a = async (e, n) => {
16
+ var t;
17
+ const { prompt: i } = n;
18
+ return (t = e.app) != null && t.editImage ? e.app.editImage(i) : { message: "editImage function not available" };
19
+ }, r = {
20
+ toolDefinition: o,
21
+ execute: a,
22
+ generatingMessage: "Editing image...",
23
+ isEnabled: () => !0,
24
+ backends: ["imageGen"]
25
+ }, p = a, g = [
26
+ {
27
+ name: "Add Sunglasses",
28
+ args: {
29
+ prompt: "Add stylish sunglasses to the subject"
30
+ }
31
+ },
32
+ {
33
+ name: "Change Background",
34
+ args: {
35
+ prompt: "Change the background to a beautiful sunset beach"
36
+ }
37
+ },
38
+ {
39
+ name: "Make it Artistic",
40
+ args: {
41
+ prompt: "Transform into an oil painting style"
42
+ }
43
+ }
44
+ ];
45
+ export {
46
+ o as TOOL_DEFINITION,
47
+ s as TOOL_NAME,
48
+ a as editImage,
49
+ p as executeEditImage,
50
+ r as pluginCore,
51
+ g as samples
52
+ };
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./core.cjs");exports.TOOL_DEFINITION=e.TOOL_DEFINITION;exports.TOOL_NAME=e.TOOL_NAME;exports.editImage=e.editImage;exports.executeEditImage=e.executeEditImage;exports.pluginCore=e.pluginCore;exports.samples=e.samples;
@@ -0,0 +1,2 @@
1
+ export * from "./core/index";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ import { TOOL_DEFINITION as O, TOOL_NAME as m, editImage as t, executeEditImage as a, pluginCore as g, samples as i } from "./core.js";
2
+ export {
3
+ O as TOOL_DEFINITION,
4
+ m as TOOL_NAME,
5
+ t as editImage,
6
+ a as executeEditImage,
7
+ g as pluginCore,
8
+ i as samples
9
+ };
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ /*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-600:oklch(57.7% .245 27.325);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-800:oklch(43.2% .095 166.913);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--font-weight-medium:500;--radius-md:.375rem;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.m-0{margin:calc(var(--spacing)*0)}.mx-auto{margin-inline:auto}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.block{display:block}.flex{display:flex}.h-auto{height:auto}.h-full{height:100%}.max-h-full{max-height:100%}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-\[100px\]{min-height:100px}.min-h-full{min-height:100%}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[200px\]{max-width:200px}.max-w-full{max-width:100%}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.cursor-pointer{cursor:pointer}.resize-y{resize:vertical}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-none{--tw-border-style:none;border-style:none}.border-emerald-200{border-color:var(--color-emerald-200)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-indigo-200{border-color:var(--color-indigo-200)}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-white{background-color:var(--color-white)}.object-contain{object-fit:contain}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.font-mono{font-family:var(--font-mono)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.whitespace-pre-wrap{white-space:pre-wrap}.text-emerald-800{color:var(--color-emerald-800)}.text-gray-400{color:var(--color-gray-400)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-indigo-700{color:var(--color-indigo-700)}.text-red-600{color:var(--color-red-600)}.text-white{color:var(--color-white)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media(hover:hover){.hover\:border-indigo-300:hover{border-color:var(--color-indigo-300)}.hover\:bg-indigo-200:hover{background-color:var(--color-indigo-200)}.hover\:bg-indigo-700:hover{background-color:var(--color-indigo-700)}}.focus\:border-indigo-500:focus{border-color:var(--color-indigo-500)}.focus\:ring-\[3px\]:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-indigo-500\/10:focus{--tw-ring-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.focus\:ring-indigo-500\/10:focus{--tw-ring-color:color-mix(in oklab,var(--color-indigo-500)10%,transparent)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}
@@ -0,0 +1,8 @@
1
+ import type { ToolResult } from "gui-chat-protocol";
2
+ import type { ImageToolData } from "../core/types";
3
+ type __VLS_Props = {
4
+ result: ToolResult<ImageToolData>;
5
+ };
6
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ export default _default;
8
+ //# sourceMappingURL=Preview.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Preview.vue.d.ts","sourceRoot":"","sources":["../../src/vue/Preview.vue"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;CACnC,CAAC;;AAsDF,wBAMG"}
@@ -0,0 +1,8 @@
1
+ import type { ToolResult } from "gui-chat-protocol";
2
+ import type { ImageToolData } from "../core/types";
3
+ type __VLS_Props = {
4
+ selectedResult: ToolResult<ImageToolData>;
5
+ };
6
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ export default _default;
8
+ //# sourceMappingURL=View.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"View.vue.d.ts","sourceRoot":"","sources":["../../src/vue/View.vue"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;CAC3C,CAAC;;AAmFF,wBAMG"}
@@ -0,0 +1,17 @@
1
+ import "../style.css";
2
+ import type { ToolPlugin } from "gui-chat-protocol/vue";
3
+ import type { ImageToolData, EditImageArgs } from "../core/types";
4
+ import View from "./View.vue";
5
+ import Preview from "./Preview.vue";
6
+ export declare const TOOL_NAME = "editImage";
7
+ export declare const SYSTEM_PROMPT = "When the user asks 'turn this image into ...', call editImage API to generate a new image.";
8
+ export declare const plugin: ToolPlugin<ImageToolData, unknown, EditImageArgs>;
9
+ export type { ImageToolData, EditImageArgs, EditImageResult } from "../core/types";
10
+ export { TOOL_DEFINITION, executeEditImage, pluginCore, } from "../core/plugin";
11
+ export { samples } from "../core/samples";
12
+ export { View, Preview };
13
+ declare const _default: {
14
+ plugin: ToolPlugin<ImageToolData, unknown, EditImageArgs, import("gui-chat-protocol/vue").InputHandler, Record<string, unknown>>;
15
+ };
16
+ export default _default;
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vue/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGlE,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,OAAO,MAAM,eAAe,CAAC;AAEpC,eAAO,MAAM,SAAS,cAAc,CAAC;AAErC,eAAO,MAAM,aAAa,+FAAkG,CAAC;AAE7H,eAAO,MAAM,MAAM,EAAE,UAAU,CAAC,aAAa,EAAE,OAAO,EAAE,aAAa,CAMpE,CAAC;AAEF,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEnF,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,UAAU,GACX,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;;;AAEzB,wBAA0B"}
package/dist/vue.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("./core.cjs"),e=require("vue"),u={class:"w-full h-full overflow-y-auto"},p={class:"min-h-full flex flex-col items-center justify-center p-4"},_={class:"flex-1 flex items-center justify-center min-h-0"},g=["src"],f={key:0,class:"mt-4 p-3 bg-gray-100 rounded-lg max-w-full flex-shrink-0"},x={class:"text-sm text-gray-700"},a=e.defineComponent({__name:"View",props:{selectedResult:{}},setup(t){return(d,n)=>{var l,o;return e.openBlock(),e.createElementBlock("div",u,[e.createElementVNode("div",p,[e.createElementVNode("div",_,[e.createElementVNode("img",{src:(l=t.selectedResult.data)==null?void 0:l.imageData,class:"max-w-full max-h-full object-contain rounded",alt:"Edited image"},null,8,g)]),(o=t.selectedResult.data)!=null&&o.prompt?(e.openBlock(),e.createElementBlock("div",f,[e.createElementVNode("p",x,[n[0]||(n[0]=e.createElementVNode("span",{class:"font-medium"},"Edit prompt:",-1)),e.createTextVNode(" "+e.toDisplayString(t.selectedResult.data.prompt),1)])])):e.createCommentVNode("",!0)])])}}}),E={class:"min-h-[100px] flex items-center justify-center"},h=["src"],k={key:1,class:"text-gray-400 text-sm"},c=e.defineComponent({__name:"Preview",props:{result:{}},setup(t){return(d,n)=>{var l;return e.openBlock(),e.createElementBlock("div",E,[(l=t.result.data)!=null&&l.imageData?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.result.data.imageData,class:"max-w-full h-auto rounded",alt:"Edited image"},null,8,h)):(e.openBlock(),e.createElementBlock("div",k,"No image yet"))])}}}),i="editImage",r=`When the user asks 'turn this image into ...', call ${i} API to generate a new image.`,m={...s.pluginCore,viewComponent:a,previewComponent:c,samples:s.samples,systemPrompt:r},v={plugin:m};exports.TOOL_DEFINITION=s.TOOL_DEFINITION;exports.executeEditImage=s.executeEditImage;exports.pluginCore=s.pluginCore;exports.samples=s.samples;exports.Preview=c;exports.SYSTEM_PROMPT=r;exports.TOOL_NAME=i;exports.View=a;exports.default=v;exports.plugin=m;
package/dist/vue.js ADDED
@@ -0,0 +1,73 @@
1
+ import { samples as r, pluginCore as m } from "./core.js";
2
+ import { TOOL_DEFINITION as $, executeEditImage as j } from "./core.js";
3
+ import { defineComponent as i, createElementBlock as a, openBlock as o, createElementVNode as s, createCommentVNode as d, createTextVNode as u, toDisplayString as f } from "vue";
4
+ const p = { class: "w-full h-full overflow-y-auto" }, _ = { class: "min-h-full flex flex-col items-center justify-center p-4" }, x = { class: "flex-1 flex items-center justify-center min-h-0" }, g = ["src"], h = {
5
+ key: 0,
6
+ class: "mt-4 p-3 bg-gray-100 rounded-lg max-w-full flex-shrink-0"
7
+ }, y = { class: "text-sm text-gray-700" }, w = /* @__PURE__ */ i({
8
+ __name: "View",
9
+ props: {
10
+ selectedResult: {}
11
+ },
12
+ setup(e) {
13
+ return (c, n) => {
14
+ var t, l;
15
+ return o(), a("div", p, [
16
+ s("div", _, [
17
+ s("div", x, [
18
+ s("img", {
19
+ src: (t = e.selectedResult.data) == null ? void 0 : t.imageData,
20
+ class: "max-w-full max-h-full object-contain rounded",
21
+ alt: "Edited image"
22
+ }, null, 8, g)
23
+ ]),
24
+ (l = e.selectedResult.data) != null && l.prompt ? (o(), a("div", h, [
25
+ s("p", y, [
26
+ n[0] || (n[0] = s("span", { class: "font-medium" }, "Edit prompt:", -1)),
27
+ u(" " + f(e.selectedResult.data.prompt), 1)
28
+ ])
29
+ ])) : d("", !0)
30
+ ])
31
+ ]);
32
+ };
33
+ }
34
+ }), v = { class: "min-h-[100px] flex items-center justify-center" }, E = ["src"], k = {
35
+ key: 1,
36
+ class: "text-gray-400 text-sm"
37
+ }, N = /* @__PURE__ */ i({
38
+ __name: "Preview",
39
+ props: {
40
+ result: {}
41
+ },
42
+ setup(e) {
43
+ return (c, n) => {
44
+ var t;
45
+ return o(), a("div", v, [
46
+ (t = e.result.data) != null && t.imageData ? (o(), a("img", {
47
+ key: 0,
48
+ src: e.result.data.imageData,
49
+ class: "max-w-full h-auto rounded",
50
+ alt: "Edited image"
51
+ }, null, 8, E)) : (o(), a("div", k, "No image yet"))
52
+ ]);
53
+ };
54
+ }
55
+ }), I = "editImage", O = `When the user asks 'turn this image into ...', call ${I} API to generate a new image.`, P = {
56
+ ...m,
57
+ viewComponent: w,
58
+ previewComponent: N,
59
+ samples: r,
60
+ systemPrompt: O
61
+ }, D = { plugin: P };
62
+ export {
63
+ N as Preview,
64
+ O as SYSTEM_PROMPT,
65
+ $ as TOOL_DEFINITION,
66
+ I as TOOL_NAME,
67
+ w as View,
68
+ D as default,
69
+ j as executeEditImage,
70
+ P as plugin,
71
+ m as pluginCore,
72
+ r as samples
73
+ };
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@gui-chat-plugin/edit-image",
3
+ "version": "0.0.1",
4
+ "description": "Image editing plugin for GUI Chat applications",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ },
15
+ "./vue": {
16
+ "types": "./dist/vue/index.d.ts",
17
+ "import": "./dist/vue.js",
18
+ "require": "./dist/vue.cjs"
19
+ },
20
+ "./style.css": "./dist/style.css"
21
+ },
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "scripts": {
26
+ "dev": "vite",
27
+ "build": "vite build && vue-tsc -p tsconfig.build.json --emitDeclarationOnly",
28
+ "lint": "eslint .",
29
+ "preview": "vite preview"
30
+ },
31
+ "dependencies": {
32
+ "gui-chat-protocol": "^0.0.1"
33
+ },
34
+ "devDependencies": {
35
+ "@tailwindcss/vite": "^4.0.0",
36
+ "@types/node": "^22.10.5",
37
+ "@vitejs/plugin-vue": "^5.2.1",
38
+ "eslint": "^9.17.0",
39
+ "tailwindcss": "^4.0.0",
40
+ "typescript": "^5.7.2",
41
+ "vite": "^6.0.7",
42
+ "vite-plugin-dts": "^4.4.0",
43
+ "vue": "^3.5.13",
44
+ "vue-tsc": "^2.2.0"
45
+ },
46
+ "peerDependencies": {
47
+ "vue": "^3.5.0"
48
+ },
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "https://github.com/receptron/GUIChatPluginEditImage.git"
52
+ },
53
+ "license": "MIT"
54
+ }