@mulmochat-plugin/generate-image 0.2.1 → 0.3.0

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.
@@ -0,0 +1,6 @@
1
+ /**
2
+ * GenerateImage Tool Definition (Schema)
3
+ */
4
+ import type { ToolDefinition } from "gui-chat-protocol";
5
+ export declare const TOOL_NAME = "generateImage";
6
+ export declare const TOOL_DEFINITION: ToolDefinition;
@@ -1,8 +1,10 @@
1
1
  /**
2
- * MulmoChat GenerateImage Plugin - Core (Framework-agnostic)
2
+ * MulmoChat Plugin Core Exports
3
3
  *
4
- * This module exports the core plugin logic without UI components.
5
- * Import from "@mulmochat-plugin/generate-image" or "@mulmochat-plugin/generate-image/core"
4
+ * Framework-agnostic types and plugin logic.
5
+ * Import from "@mulmochat-plugin/generate-image/core"
6
6
  */
7
- export type { BackendType, ToolContextApp, ToolContext, ToolResult, ToolResultComplete, JsonSchemaProperty, ToolDefinition, StartApiResponse, ToolSample, InputHandler, FileInputHandler, ClipboardImageInputHandler, UrlInputHandler, TextInputHandler, FileUploadConfig, ConfigValue, ConfigFieldSchema, PluginConfigSchema, ViewComponentProps, PreviewComponentProps, ToolPluginCore, ImageToolData, GenerateImageArgs, ImageGenerationConfigValue, } from "./types";
8
- export { TOOL_NAME, TOOL_DEFINITION, SAMPLES, createUploadedImageResult, executeGenerateImage, pluginCore, } from "./plugin";
7
+ export type { ImageToolData, GenerateImageArgs, ImageGenerationConfigValue, } from "./types";
8
+ export { pluginCore, executeGenerateImage, createUploadedImageResult, } from "./plugin";
9
+ export { TOOL_NAME, TOOL_DEFINITION } from "./definition";
10
+ export { SAMPLES } from "./samples";
@@ -4,10 +4,8 @@
4
4
  * Contains the plugin logic without UI components.
5
5
  * Can be used by any framework (Vue, React, etc.)
6
6
  */
7
- import type { ToolPluginCore, ToolContext, ToolResult, ToolDefinition, ToolSample, ImageToolData, GenerateImageArgs } from "./types";
8
- export declare const TOOL_NAME = "generateImage";
9
- export declare const TOOL_DEFINITION: ToolDefinition;
10
- export declare const SAMPLES: ToolSample[];
7
+ import type { ToolPluginCore, ToolContext, ToolResult } from "gui-chat-protocol";
8
+ import type { ImageToolData, GenerateImageArgs } from "./types";
11
9
  /**
12
10
  * Create a ToolResult for an uploaded image file
13
11
  */
@@ -0,0 +1,5 @@
1
+ /**
2
+ * GenerateImage Sample Data
3
+ */
4
+ import type { ToolSample } from "gui-chat-protocol";
5
+ export declare const SAMPLES: ToolSample[];
@@ -1,227 +1,9 @@
1
1
  /**
2
- * MulmoChat Plugin Core Types (Framework-agnostic)
2
+ * GenerateImage Plugin Types
3
3
  *
4
- * These types can be used by any framework implementation (Vue, React, etc.)
4
+ * Plugin-specific type definitions only.
5
+ * Common types should be imported directly from gui-chat-protocol.
5
6
  */
6
- /**
7
- * Backend types that plugins can declare they use.
8
- * App layer manages actual provider/model settings for each type.
9
- */
10
- export type BackendType = "textLLM" | "imageGen" | "audio" | "search" | "browse" | "map" | "mulmocast";
11
- /**
12
- * App interface provided to plugins via context.app
13
- * Contains backend functions and config accessors
14
- */
15
- export interface ToolContextApp extends Record<string, (...args: any[]) => any> {
16
- getConfig: <T = unknown>(key: string) => T | undefined;
17
- setConfig: (key: string, value: unknown) => void;
18
- }
19
- /**
20
- * Context passed to plugin execute function
21
- */
22
- export interface ToolContext {
23
- currentResult?: ToolResult<unknown> | null;
24
- app?: ToolContextApp;
25
- }
26
- /**
27
- * Result returned from plugin execution
28
- */
29
- export interface ToolResult<T = unknown, J = unknown> {
30
- toolName?: string;
31
- uuid?: string;
32
- message: string;
33
- title?: string;
34
- jsonData?: J;
35
- instructions?: string;
36
- instructionsRequired?: boolean;
37
- updating?: boolean;
38
- cancelled?: boolean;
39
- data?: T;
40
- viewState?: Record<string, unknown>;
41
- }
42
- /**
43
- * Complete tool result with required fields
44
- */
45
- export interface ToolResultComplete<T = unknown, J = unknown> extends ToolResult<T, J> {
46
- toolName: string;
47
- uuid: string;
48
- }
49
- /**
50
- * JSON Schema property definition for tool parameters
51
- */
52
- export interface JsonSchemaProperty {
53
- type?: string;
54
- description?: string;
55
- enum?: string[];
56
- items?: JsonSchemaProperty;
57
- minimum?: number;
58
- maximum?: number;
59
- minItems?: number;
60
- maxItems?: number;
61
- properties?: Record<string, JsonSchemaProperty>;
62
- required?: string[];
63
- additionalProperties?: boolean;
64
- oneOf?: JsonSchemaProperty[];
65
- [key: string]: unknown;
66
- }
67
- /**
68
- * Tool definition for OpenAI-compatible function calling
69
- */
70
- export interface ToolDefinition {
71
- type: "function";
72
- name: string;
73
- description: string;
74
- parameters?: {
75
- type: "object";
76
- properties: Record<string, JsonSchemaProperty>;
77
- required: string[];
78
- additionalProperties?: boolean;
79
- };
80
- }
81
- /**
82
- * API response from server start endpoint
83
- */
84
- export interface StartApiResponse {
85
- hasOpenAIApiKey?: boolean;
86
- hasAnthropicApiKey?: boolean;
87
- hasGoogleApiKey?: boolean;
88
- [key: string]: unknown;
89
- }
90
- /**
91
- * Sample arguments for testing
92
- */
93
- export interface ToolSample {
94
- name: string;
95
- args: Record<string, unknown>;
96
- }
97
- /**
98
- * File input handler
99
- */
100
- export interface FileInputHandler {
101
- type: "file";
102
- acceptedTypes: string[];
103
- handleInput: (fileData: string, fileName: string) => ToolResult<unknown, unknown>;
104
- }
105
- /**
106
- * Clipboard image input handler
107
- */
108
- export interface ClipboardImageInputHandler {
109
- type: "clipboard-image";
110
- handleInput: (imageData: string) => ToolResult<unknown, unknown>;
111
- }
112
- /**
113
- * URL input handler
114
- */
115
- export interface UrlInputHandler {
116
- type: "url";
117
- patterns?: string[];
118
- handleInput: (url: string) => ToolResult<unknown, unknown>;
119
- }
120
- /**
121
- * Text input handler
122
- */
123
- export interface TextInputHandler {
124
- type: "text";
125
- patterns?: string[];
126
- handleInput: (text: string) => ToolResult<unknown, unknown>;
127
- }
128
- /**
129
- * Union of all input handler types
130
- */
131
- export type InputHandler = FileInputHandler | ClipboardImageInputHandler | UrlInputHandler | TextInputHandler;
132
- /**
133
- * Legacy file upload config (for backward compatibility)
134
- * @deprecated Use InputHandler instead
135
- */
136
- export interface FileUploadConfig {
137
- acceptedTypes: string[];
138
- handleUpload: (fileData: string, fileName: string, ...args: unknown[]) => ToolResult<unknown, unknown>;
139
- }
140
- export type ConfigValue = string | number | boolean | string[];
141
- interface BaseFieldSchema {
142
- label: string;
143
- description?: string;
144
- required?: boolean;
145
- }
146
- export interface StringFieldSchema extends BaseFieldSchema {
147
- type: "string";
148
- placeholder?: string;
149
- minLength?: number;
150
- maxLength?: number;
151
- pattern?: string;
152
- }
153
- export interface NumberFieldSchema extends BaseFieldSchema {
154
- type: "number";
155
- min?: number;
156
- max?: number;
157
- step?: number;
158
- }
159
- export interface BooleanFieldSchema extends BaseFieldSchema {
160
- type: "boolean";
161
- }
162
- export interface SelectOption {
163
- value: string;
164
- label: string;
165
- description?: string;
166
- disabled?: boolean;
167
- }
168
- export interface SelectFieldSchema extends BaseFieldSchema {
169
- type: "select";
170
- options: SelectOption[];
171
- }
172
- export interface MultiSelectFieldSchema extends BaseFieldSchema {
173
- type: "multiselect";
174
- options: SelectOption[];
175
- minItems?: number;
176
- maxItems?: number;
177
- }
178
- export type ConfigFieldSchema = StringFieldSchema | NumberFieldSchema | BooleanFieldSchema | SelectFieldSchema | MultiSelectFieldSchema;
179
- /**
180
- * Plugin configuration schema (JSON Schema based)
181
- */
182
- export interface PluginConfigSchema {
183
- key: string;
184
- defaultValue: ConfigValue;
185
- schema: ConfigFieldSchema;
186
- }
187
- /**
188
- * Standard props for View components
189
- */
190
- export interface ViewComponentProps<T = unknown, J = unknown> {
191
- selectedResult: ToolResultComplete<T, J>;
192
- sendTextMessage: (text?: string) => void;
193
- onUpdateResult?: (result: Partial<ToolResult<T, J>>) => void;
194
- pluginConfigs?: Record<string, unknown>;
195
- }
196
- /**
197
- * Standard props for Preview components
198
- */
199
- export interface PreviewComponentProps<T = unknown, J = unknown> {
200
- result: ToolResultComplete<T, J>;
201
- isSelected?: boolean;
202
- onSelect?: () => void;
203
- }
204
- /**
205
- * Core plugin interface - framework agnostic
206
- * Does not include UI components
207
- */
208
- export interface ToolPluginCore<T = unknown, J = unknown, A extends object = object> {
209
- toolDefinition: ToolDefinition;
210
- execute: (context: ToolContext, args: A) => Promise<ToolResult<T, J>>;
211
- generatingMessage: string;
212
- waitingMessage?: string;
213
- uploadMessage?: string;
214
- isEnabled: (startResponse?: StartApiResponse | null) => boolean;
215
- delayAfterExecution?: number;
216
- systemPrompt?: string;
217
- inputHandlers?: InputHandler[];
218
- /** @deprecated Use inputHandlers instead */
219
- fileUpload?: FileUploadConfig;
220
- /** New JSON Schema based config (framework-agnostic) */
221
- configSchema?: PluginConfigSchema;
222
- samples?: ToolSample[];
223
- backends?: BackendType[];
224
- }
225
7
  /** Image tool data stored in result.data */
226
8
  export interface ImageToolData {
227
9
  imageData: string;
@@ -238,4 +20,3 @@ export interface ImageGenerationConfigValue {
238
20
  geminiModel?: "gemini-2.5-flash-image" | "gemini-3-pro-image-preview";
239
21
  openaiModel?: "gpt-image-1" | "gpt-image-1.5" | "gpt-image-1-mini";
240
22
  }
241
- export {};
@@ -1,4 +1,5 @@
1
- import type { ToolResult, ImageToolData } from "./types";
1
+ import type { ToolResult } from "gui-chat-protocol";
2
+ import type { ImageToolData } from "../core/types";
2
3
  type __VLS_Props = {
3
4
  result: ToolResult<ImageToolData>;
4
5
  };
@@ -1,4 +1,5 @@
1
- import type { ToolResult, ImageToolData } from "./types";
1
+ import type { ToolResult } from "gui-chat-protocol";
2
+ import type { ImageToolData } from "../core/types";
2
3
  type __VLS_Props = {
3
4
  selectedResult: ToolResult<ImageToolData>;
4
5
  sendTextMessage: (text?: string) => void;
@@ -5,18 +5,20 @@
5
5
  * Import from "@mulmochat-plugin/generate-image/vue"
6
6
  */
7
7
  import "../style.css";
8
- import type { ToolPlugin, ImageToolData, GenerateImageArgs } from "./types";
8
+ import type { ToolPlugin } from "gui-chat-protocol/vue";
9
+ import type { ImageToolData, GenerateImageArgs } from "../core/types";
9
10
  import View from "./View.vue";
10
11
  import Preview from "./Preview.vue";
11
12
  /**
12
13
  * GenerateImage plugin instance with Vue components
13
14
  */
14
15
  export declare const plugin: ToolPlugin<ImageToolData, never, GenerateImageArgs>;
15
- export type { ToolPlugin, ToolPluginConfig } from "./types";
16
- export type { BackendType, ToolContextApp, ToolContext, ToolResult, ToolResultComplete, JsonSchemaProperty, ToolDefinition, StartApiResponse, ToolSample, InputHandler, FileUploadConfig, ConfigValue, ConfigFieldSchema, PluginConfigSchema, ViewComponentProps, PreviewComponentProps, ToolPluginCore, ImageToolData, GenerateImageArgs, ImageGenerationConfigValue, } from "./types";
17
- export { TOOL_NAME, TOOL_DEFINITION, SAMPLES, createUploadedImageResult, executeGenerateImage, pluginCore, } from "../core/plugin";
16
+ export type { ImageToolData, GenerateImageArgs, ImageGenerationConfigValue, } from "../core/types";
17
+ export { pluginCore, executeGenerateImage, createUploadedImageResult, } from "../core/plugin";
18
+ export { TOOL_NAME, TOOL_DEFINITION } from "../core/definition";
19
+ export { SAMPLES } from "../core/samples";
18
20
  export { View, Preview };
19
21
  declare const _default: {
20
- plugin: ToolPlugin<ImageToolData, never, GenerateImageArgs>;
22
+ plugin: ToolPlugin<ImageToolData, never, GenerateImageArgs, import("gui-chat-protocol/vue").InputHandler, Record<string, unknown>>;
21
23
  };
22
24
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mulmochat-plugin/generate-image",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Image generation plugin for MulmoChat",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -37,6 +37,9 @@
37
37
  "@mulmochat-plugin/ui-image": "^0.1.0",
38
38
  "vue": "^3.5.0"
39
39
  },
40
+ "dependencies": {
41
+ "gui-chat-protocol": "^0.0.1"
42
+ },
40
43
  "devDependencies": {
41
44
  "@mulmochat-plugin/ui-image": "^0.1.0",
42
45
  "@tailwindcss/vite": "^4.1.18",
@@ -1,32 +0,0 @@
1
- /**
2
- * MulmoChat Plugin Vue Types
3
- *
4
- * Vue-specific types that extend the core plugin interface.
5
- */
6
- import type { Component } from "vue";
7
- import type { ToolPluginCore } from "../core/types";
8
- type VueComponent = Component<any>;
9
- /**
10
- * Legacy Vue component-based config
11
- * @deprecated Use PluginConfigSchema instead
12
- */
13
- export interface ToolPluginConfig {
14
- key: string;
15
- defaultValue: unknown;
16
- component: VueComponent;
17
- }
18
- /**
19
- * Vue plugin interface - extends core with Vue components
20
- */
21
- export interface ToolPlugin<T = unknown, J = unknown, A extends object = object> extends ToolPluginCore<T, J, A> {
22
- /** Vue component for full view */
23
- viewComponent?: VueComponent;
24
- /** Vue component for preview/thumbnail */
25
- previewComponent?: VueComponent;
26
- /**
27
- * Legacy Vue component-based config (for backward compatibility)
28
- * @deprecated Use configSchema instead
29
- */
30
- config?: ToolPluginConfig;
31
- }
32
- export type { BackendType, ToolContextApp, ToolContext, ToolResult, ToolResultComplete, JsonSchemaProperty, ToolDefinition, StartApiResponse, ToolSample, InputHandler, FileInputHandler, ClipboardImageInputHandler, UrlInputHandler, TextInputHandler, FileUploadConfig, ConfigValue, ConfigFieldSchema, PluginConfigSchema, ViewComponentProps, PreviewComponentProps, ToolPluginCore, ImageToolData, GenerateImageArgs, ImageGenerationConfigValue, } from "../core/types";