@gui-chat-plugin/drawing-game 0.1.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,112 @@
1
+ # @gui-chat-plugin/drawing-game
2
+
3
+ Drawing game plugin for GUI Chat applications. Draw pictures using only primitive shapes through voice/chat instructions, then let AI guess what you drew!
4
+
5
+ ## Features
6
+
7
+ - Draw with primitive shapes: circle, ellipse, rectangle, triangle, line
8
+ - Fill patterns: solid, hatched, dotted, striped
9
+ - Edit operations: move, undo
10
+ - AI guessing: Let the AI guess what you drew
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ yarn add @gui-chat-plugin/drawing-game
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ### Vue Integration
21
+
22
+ ```typescript
23
+ // In src/tools/index.ts
24
+ import DrawingGamePlugin from "@gui-chat-plugin/drawing-game/vue";
25
+
26
+ const pluginList = [
27
+ // ... other plugins
28
+ DrawingGamePlugin,
29
+ ];
30
+
31
+ // In src/main.ts
32
+ import "@gui-chat-plugin/drawing-game/style.css";
33
+ ```
34
+
35
+ ### Core-only Usage
36
+
37
+ ```typescript
38
+ import { executeDrawingGame, TOOL_DEFINITION } from "@gui-chat-plugin/drawing-game";
39
+
40
+ // Start a new game
41
+ const result = await executeDrawingGame(context, { action: "start" });
42
+
43
+ // Draw a circle
44
+ const result = await executeDrawingGame(context, {
45
+ action: "circle",
46
+ x: 50,
47
+ y: 50,
48
+ size: 30,
49
+ color: "blue",
50
+ });
51
+ ```
52
+
53
+ ## API
54
+
55
+ ### Actions
56
+
57
+ | Action | Description |
58
+ |--------|-------------|
59
+ | `start` | Clear canvas and start new game |
60
+ | `circle` | Draw a circle (x, y, size, color, pattern) |
61
+ | `ellipse` | Draw an ellipse (x, y, width, height, color, pattern) |
62
+ | `rectangle` | Draw a rectangle (x, y, width, height, color, pattern) |
63
+ | `triangle` | Draw a triangle (x, y, size, color, pattern) |
64
+ | `line` | Draw a line (x1, y1, x2, y2, color, strokeWidth) |
65
+ | `fill` | Change default fill color |
66
+ | `pattern` | Change default pattern (solid/hatched/dotted/striped) |
67
+ | `move` | Move last shape (dx, dy) |
68
+ | `undo` | Remove last shape |
69
+ | `guess` | AI guesses what the drawing is |
70
+
71
+ ### Position Guide
72
+
73
+ - **x**: 0=left, 50=center, 100=right
74
+ - **y**: 0=top, 50=center, 100=bottom
75
+ - **size**: 5=tiny, 15=small, 30=medium, 50=large
76
+
77
+ ### Patterns
78
+
79
+ - `solid` - Normal fill
80
+ - `hatched` - Diagonal lines
81
+ - `dotted` - Dots pattern
82
+ - `striped` - Horizontal stripes
83
+
84
+ ## Test Prompts
85
+
86
+ Try these prompts to test the plugin:
87
+
88
+ 1. "Let's play the drawing game"
89
+ 2. "Draw a big blue circle in the center"
90
+ 3. "Add a small red triangle on top"
91
+ 4. "Move it a bit to the right"
92
+ 5. "Guess what I drew!"
93
+
94
+ ## Development
95
+
96
+ ```bash
97
+ # Install dependencies
98
+ yarn install
99
+
100
+ # Run Vue demo
101
+ yarn dev
102
+
103
+ # Build
104
+ yarn build
105
+
106
+ # Lint
107
+ yarn lint
108
+ ```
109
+
110
+ ## License
111
+
112
+ MIT
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Drawing Game Tool Definition
3
+ */
4
+ import type { ToolDefinition } from "gui-chat-protocol";
5
+ export declare const TOOL_NAME = "drawingGame";
6
+ export declare const TOOL_DEFINITION: ToolDefinition;
7
+ export declare const SYSTEM_PROMPT = "You are playing a drawing game. The user will describe what they want to draw, and you must interpret their instructions using ONLY primitive shapes.\n\nAVAILABLE COMMANDS:\n- start: Clear canvas and begin new game\n- circle: Draw a circle (x, y, size, color, pattern)\n- ellipse: Draw an ellipse (x, y, width, height, color, pattern)\n- rectangle: Draw a rectangle (x, y, width, height, color, pattern)\n- triangle: Draw a triangle (x, y, size, color, pattern)\n- line: Draw a line (x1, y1, x2, y2, color, strokeWidth)\n- fill: Change default fill color\n- pattern: Change default pattern (solid/hatched/dotted/striped)\n- move: Move last shape (dx, dy as relative movement)\n- undo: Remove last shape\n- guess: Guess what the drawing is\n\nPOSITION GUIDE (0-100):\n- x: 0=left edge, 50=center, 100=right edge\n- y: 0=top edge, 50=center, 100=bottom edge\n- size: 5=tiny, 15=small, 30=medium, 50=large\n\nPATTERNS:\n- solid: Normal fill\n- hatched: Diagonal lines (\u7DB2\u639B\u3051)\n- dotted: Dots pattern\n- striped: Horizontal stripes\n\nEXAMPLES:\n- \"\u5927\u304D\u306A\u9752\u3044\u4E38\u3092\u4E2D\u592E\u306B\" \u2192 circle x:50, y:50, size:30, color:blue\n- \"\u4E0A\u306B\u5C0F\u3055\u306A\u8D64\u3044\u4E09\u89D2\" \u2192 triangle x:50, y:20, size:15, color:red\n- \"\u7DB2\u639B\u3051\u306E\u56DB\u89D2\" \u2192 rectangle with pattern:hatched\n- \"\u3061\u3087\u3063\u3068\u53F3\u306B\" \u2192 move dx:10, dy:0\n- \"\u5F53\u3066\u3066!\" \u2192 guess\n\nRULES:\n1. Only use primitive shapes - no complex drawings!\n2. Interpret user's natural language into coordinates\n3. When user says \"\u5F53\u3066\u3066\" or \"guess\", call the guess action\n4. Be creative but stick to primitives!";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Drawing Game Plugin Core Exports
3
+ */
4
+ export type { PatternType, Shape, CircleShape, EllipseShape, RectangleShape, TriangleShape, LineShape, GamePhase, DrawingGameData, DrawingGameJsonData, ActionType, DrawingGameArgs, } from "./types";
5
+ export { pluginCore, executeDrawingGame } from "./plugin";
6
+ export { TOOL_NAME, TOOL_DEFINITION, SYSTEM_PROMPT } from "./definition";
7
+ export { SAMPLES } from "./samples";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Drawing Game Plugin Core
3
+ */
4
+ import type { ToolPluginCore, ToolContext, ToolResult } from "gui-chat-protocol";
5
+ import type { DrawingGameData, DrawingGameJsonData, DrawingGameArgs } from "./types";
6
+ export declare const executeDrawingGame: (context: ToolContext, args: DrawingGameArgs) => Promise<ToolResult<DrawingGameData, DrawingGameJsonData>>;
7
+ export declare const pluginCore: ToolPluginCore<DrawingGameData, DrawingGameJsonData, DrawingGameArgs>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Drawing Game Sample Data
3
+ */
4
+ import type { ToolSample } from "gui-chat-protocol";
5
+ export declare const SAMPLES: ToolSample[];
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Drawing Game Plugin Types
3
+ */
4
+ export type PatternType = "solid" | "hatched" | "dotted" | "striped";
5
+ export interface BaseShape {
6
+ id: string;
7
+ type: "circle" | "ellipse" | "rectangle" | "triangle" | "line";
8
+ color: string;
9
+ pattern: PatternType;
10
+ }
11
+ export interface CircleShape extends BaseShape {
12
+ type: "circle";
13
+ x: number;
14
+ y: number;
15
+ size: number;
16
+ }
17
+ export interface EllipseShape extends BaseShape {
18
+ type: "ellipse";
19
+ x: number;
20
+ y: number;
21
+ width: number;
22
+ height: number;
23
+ }
24
+ export interface RectangleShape extends BaseShape {
25
+ type: "rectangle";
26
+ x: number;
27
+ y: number;
28
+ width: number;
29
+ height: number;
30
+ }
31
+ export interface TriangleShape extends BaseShape {
32
+ type: "triangle";
33
+ x: number;
34
+ y: number;
35
+ size: number;
36
+ }
37
+ export interface LineShape extends BaseShape {
38
+ type: "line";
39
+ x1: number;
40
+ y1: number;
41
+ x2: number;
42
+ y2: number;
43
+ strokeWidth: number;
44
+ }
45
+ export type Shape = CircleShape | EllipseShape | RectangleShape | TriangleShape | LineShape;
46
+ export type GamePhase = "drawing" | "guessing";
47
+ /** Data for View/Preview components */
48
+ export interface DrawingGameData {
49
+ shapes: Shape[];
50
+ defaultColor: string;
51
+ defaultPattern: PatternType;
52
+ gamePhase: GamePhase;
53
+ }
54
+ /** Data returned to LLM */
55
+ export interface DrawingGameJsonData {
56
+ shapeCount: number;
57
+ gamePhase: GamePhase;
58
+ lastAction: string;
59
+ shapeDescriptions?: string[];
60
+ }
61
+ export type ActionType = "start" | "circle" | "ellipse" | "rectangle" | "triangle" | "line" | "fill" | "pattern" | "move" | "undo" | "guess";
62
+ export interface DrawingGameArgs {
63
+ action: ActionType;
64
+ x?: number;
65
+ y?: number;
66
+ size?: number;
67
+ width?: number;
68
+ height?: number;
69
+ x1?: number;
70
+ y1?: number;
71
+ x2?: number;
72
+ y2?: number;
73
+ strokeWidth?: number;
74
+ color?: string;
75
+ pattern?: PatternType;
76
+ dx?: number;
77
+ dy?: number;
78
+ }
package/dist/core.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./plugin-Csnn_dZJ.cjs`);exports.SAMPLES=e.r,exports.SYSTEM_PROMPT=e.i,exports.TOOL_DEFINITION=e.a,exports.TOOL_NAME=e.o,exports.executeDrawingGame=e.t,exports.pluginCore=e.n;
package/dist/core.js ADDED
@@ -0,0 +1,2 @@
1
+ import { a as e, i as t, n, o as r, r as i, t as a } from "./plugin-B4TbiRHo.js";
2
+ export { i as SAMPLES, t as SYSTEM_PROMPT, e as TOOL_DEFINITION, r as TOOL_NAME, a as executeDrawingGame, n as pluginCore };
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./plugin-Csnn_dZJ.cjs`);require(`./core.cjs`),exports.SAMPLES=e.r,exports.SYSTEM_PROMPT=e.i,exports.TOOL_DEFINITION=e.a,exports.TOOL_NAME=e.o,exports.default=e.n,exports.pluginCore=e.n,exports.executeDrawingGame=e.t;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * MulmoChat Quiz Plugin
3
+ *
4
+ * Default export is the framework-agnostic core.
5
+ * For Vue implementation, import from "@mulmochat-plugin/quiz/vue"
6
+ *
7
+ * @example Default (Core - framework-agnostic)
8
+ * ```typescript
9
+ * import { pluginCore, TOOL_NAME, QuizData } from "@mulmochat-plugin/quiz";
10
+ * ```
11
+ *
12
+ * @example Vue implementation
13
+ * ```typescript
14
+ * import QuizPlugin from "@mulmochat-plugin/quiz/vue";
15
+ * import "@mulmochat-plugin/quiz/style.css";
16
+ * ```
17
+ */
18
+ export * from "./core/index";
19
+ export { pluginCore as default } from "./core/index";
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import { a as e, i as t, n, o as r, r as i, t as a } from "./plugin-B4TbiRHo.js";
2
+ import "./core.js";
3
+ export { i as SAMPLES, t as SYSTEM_PROMPT, e as TOOL_DEFINITION, r as TOOL_NAME, n as default, n as pluginCore, a as executeDrawingGame };
@@ -0,0 +1,327 @@
1
+ //#region src/core/definition.ts
2
+ var e = "drawingGame", t = {
3
+ type: "function",
4
+ name: e,
5
+ description: "A drawing game where you help the user draw pictures using only primitive shapes. The user describes what to draw, and you interpret their instructions into shape commands. At the end, you guess what they drew.",
6
+ parameters: {
7
+ type: "object",
8
+ properties: {
9
+ action: {
10
+ type: "string",
11
+ enum: [
12
+ "start",
13
+ "circle",
14
+ "ellipse",
15
+ "rectangle",
16
+ "triangle",
17
+ "line",
18
+ "fill",
19
+ "pattern",
20
+ "move",
21
+ "undo",
22
+ "guess"
23
+ ],
24
+ description: "The action to perform. start: Clear canvas and start new game. circle/ellipse/rectangle/triangle/line: Draw shapes. fill: Change default fill color. pattern: Change default pattern (solid/hatched/dotted/striped). move: Move the last shape. undo: Remove last shape. guess: Make a guess what the drawing represents."
25
+ },
26
+ x: {
27
+ type: "number",
28
+ description: "X position (0-100, where 0=left, 50=center, 100=right)"
29
+ },
30
+ y: {
31
+ type: "number",
32
+ description: "Y position (0-100, where 0=top, 50=center, 100=bottom)"
33
+ },
34
+ size: {
35
+ type: "number",
36
+ description: "Size for circle/triangle (0-100, where 5=tiny, 15=small, 30=medium, 50=large)"
37
+ },
38
+ width: {
39
+ type: "number",
40
+ description: "Width for ellipse/rectangle (0-100)"
41
+ },
42
+ height: {
43
+ type: "number",
44
+ description: "Height for ellipse/rectangle (0-100)"
45
+ },
46
+ x1: {
47
+ type: "number",
48
+ description: "Start X for line (0-100)"
49
+ },
50
+ y1: {
51
+ type: "number",
52
+ description: "Start Y for line (0-100)"
53
+ },
54
+ x2: {
55
+ type: "number",
56
+ description: "End X for line (0-100)"
57
+ },
58
+ y2: {
59
+ type: "number",
60
+ description: "End Y for line (0-100)"
61
+ },
62
+ strokeWidth: {
63
+ type: "number",
64
+ description: "Line width (1-10, default 2)"
65
+ },
66
+ color: {
67
+ type: "string",
68
+ description: "CSS color name or hex (e.g., 'blue', 'red', '#FF5733')"
69
+ },
70
+ pattern: {
71
+ type: "string",
72
+ enum: [
73
+ "solid",
74
+ "hatched",
75
+ "dotted",
76
+ "striped"
77
+ ],
78
+ description: "Fill pattern: solid (normal), hatched (diagonal lines), dotted, striped (horizontal)"
79
+ },
80
+ dx: {
81
+ type: "number",
82
+ description: "Relative X movement for move action (-100 to 100)"
83
+ },
84
+ dy: {
85
+ type: "number",
86
+ description: "Relative Y movement for move action (-100 to 100)"
87
+ }
88
+ },
89
+ required: ["action"]
90
+ }
91
+ }, n = "You are playing a drawing game. The user will describe what they want to draw, and you must interpret their instructions using ONLY primitive shapes.\n\nAVAILABLE COMMANDS:\n- start: Clear canvas and begin new game\n- circle: Draw a circle (x, y, size, color, pattern)\n- ellipse: Draw an ellipse (x, y, width, height, color, pattern)\n- rectangle: Draw a rectangle (x, y, width, height, color, pattern)\n- triangle: Draw a triangle (x, y, size, color, pattern)\n- line: Draw a line (x1, y1, x2, y2, color, strokeWidth)\n- fill: Change default fill color\n- pattern: Change default pattern (solid/hatched/dotted/striped)\n- move: Move last shape (dx, dy as relative movement)\n- undo: Remove last shape\n- guess: Guess what the drawing is\n\nPOSITION GUIDE (0-100):\n- x: 0=left edge, 50=center, 100=right edge\n- y: 0=top edge, 50=center, 100=bottom edge\n- size: 5=tiny, 15=small, 30=medium, 50=large\n\nPATTERNS:\n- solid: Normal fill\n- hatched: Diagonal lines (網掛け)\n- dotted: Dots pattern\n- striped: Horizontal stripes\n\nEXAMPLES:\n- \"大きな青い丸を中央に\" → circle x:50, y:50, size:30, color:blue\n- \"上に小さな赤い三角\" → triangle x:50, y:20, size:15, color:red\n- \"網掛けの四角\" → rectangle with pattern:hatched\n- \"ちょっと右に\" → move dx:10, dy:0\n- \"当てて!\" → guess\n\nRULES:\n1. Only use primitive shapes - no complex drawings!\n2. Interpret user's natural language into coordinates\n3. When user says \"当てて\" or \"guess\", call the guess action\n4. Be creative but stick to primitives!", r = [
92
+ {
93
+ name: "Start Game",
94
+ args: { action: "start" }
95
+ },
96
+ {
97
+ name: "Blue Circle",
98
+ args: {
99
+ action: "circle",
100
+ x: 50,
101
+ y: 50,
102
+ size: 25,
103
+ color: "blue"
104
+ }
105
+ },
106
+ {
107
+ name: "Red Triangle",
108
+ args: {
109
+ action: "triangle",
110
+ x: 50,
111
+ y: 25,
112
+ size: 15,
113
+ color: "red"
114
+ }
115
+ },
116
+ {
117
+ name: "Green Rectangle",
118
+ args: {
119
+ action: "rectangle",
120
+ x: 50,
121
+ y: 75,
122
+ width: 40,
123
+ height: 15,
124
+ color: "green"
125
+ }
126
+ },
127
+ {
128
+ name: "Yellow Ellipse",
129
+ args: {
130
+ action: "ellipse",
131
+ x: 30,
132
+ y: 50,
133
+ width: 20,
134
+ height: 30,
135
+ color: "gold"
136
+ }
137
+ },
138
+ {
139
+ name: "Black Line",
140
+ args: {
141
+ action: "line",
142
+ x1: 10,
143
+ y1: 90,
144
+ x2: 90,
145
+ y2: 90,
146
+ color: "black",
147
+ strokeWidth: 3
148
+ }
149
+ },
150
+ {
151
+ name: "Hatched Pattern",
152
+ args: {
153
+ action: "rectangle",
154
+ x: 70,
155
+ y: 30,
156
+ width: 20,
157
+ height: 20,
158
+ color: "purple",
159
+ pattern: "hatched"
160
+ }
161
+ },
162
+ {
163
+ name: "Move Right",
164
+ args: {
165
+ action: "move",
166
+ dx: 10,
167
+ dy: 0
168
+ }
169
+ },
170
+ {
171
+ name: "Undo",
172
+ args: { action: "undo" }
173
+ },
174
+ {
175
+ name: "Guess!",
176
+ args: { action: "guess" }
177
+ }
178
+ ], i = () => Math.random().toString(36).substring(2, 9), a = (e, t, n) => Math.max(t, Math.min(n, e)), o = (e) => {
179
+ let t = e.pattern === "solid" ? "" : ` ${e.pattern}`, n = (e, t) => `${t < 33 ? "top" : t > 66 ? "bottom" : "middle"}-${e < 33 ? "left" : e > 66 ? "right" : "center"}`;
180
+ switch (e.type) {
181
+ case "circle": return `${e.size < 15 ? "small" : e.size > 35 ? "large" : "medium"}${t} ${e.color} circle at ${n(e.x, e.y)}`;
182
+ case "ellipse": return `${t} ${e.color} ellipse at ${n(e.x, e.y)}`;
183
+ case "rectangle": {
184
+ let r = Math.abs(e.width - e.height) < 5 ? "square" : "rectangle";
185
+ return `${t} ${e.color} ${r} at ${n(e.x, e.y)}`;
186
+ }
187
+ case "triangle": return `${e.size < 15 ? "small" : e.size > 35 ? "large" : "medium"}${t} ${e.color} triangle at ${n(e.x, e.y)}`;
188
+ case "line": return `${e.color} line from (${e.x1},${e.y1}) to (${e.x2},${e.y2})`;
189
+ }
190
+ }, s = async (e, n) => {
191
+ let { action: r } = n, s = e.currentResult?.data, c = s?.shapes ?? [], l = s?.defaultColor ?? "black", u = s?.defaultPattern ?? "solid", d = s?.gamePhase ?? "drawing", f = n.color ?? l, p = n.pattern ?? u, m, h;
192
+ switch (r) {
193
+ case "start":
194
+ c = [], l = "black", u = "solid", d = "drawing", m = "New drawing game started! Canvas is clear.", h = "The drawing canvas is now clear. Help the user draw by interpreting their descriptions into primitive shapes (circle, ellipse, rectangle, triangle, line). Ask them what they want to draw!";
195
+ break;
196
+ case "circle": {
197
+ let e = a(n.x ?? 50, 0, 100), t = a(n.y ?? 50, 0, 100), r = a(n.size ?? 20, 1, 100), o = {
198
+ id: i(),
199
+ type: "circle",
200
+ x: e,
201
+ y: t,
202
+ size: r,
203
+ color: f,
204
+ pattern: p
205
+ };
206
+ c = [...c, o], m = `Drew a ${f} circle at (${e}, ${t}) with size ${r}`, h = "Circle added. Ask the user what else they want to add or if they want you to guess.";
207
+ break;
208
+ }
209
+ case "ellipse": {
210
+ let e = a(n.x ?? 50, 0, 100), t = a(n.y ?? 50, 0, 100), r = a(n.width ?? 30, 1, 100), o = a(n.height ?? 20, 1, 100), s = {
211
+ id: i(),
212
+ type: "ellipse",
213
+ x: e,
214
+ y: t,
215
+ width: r,
216
+ height: o,
217
+ color: f,
218
+ pattern: p
219
+ };
220
+ c = [...c, s], m = `Drew a ${f} ellipse at (${e}, ${t})`, h = "Ellipse added. Ask the user what else they want to add.";
221
+ break;
222
+ }
223
+ case "rectangle": {
224
+ let e = a(n.x ?? 50, 0, 100), t = a(n.y ?? 50, 0, 100), r = a(n.width ?? 30, 1, 100), o = a(n.height ?? 20, 1, 100), s = {
225
+ id: i(),
226
+ type: "rectangle",
227
+ x: e,
228
+ y: t,
229
+ width: r,
230
+ height: o,
231
+ color: f,
232
+ pattern: p
233
+ };
234
+ c = [...c, s], m = `Drew a ${f} rectangle at (${e}, ${t})`, h = "Rectangle added. Ask the user what else they want to add.";
235
+ break;
236
+ }
237
+ case "triangle": {
238
+ let e = a(n.x ?? 50, 0, 100), t = a(n.y ?? 50, 0, 100), r = a(n.size ?? 20, 1, 100), o = {
239
+ id: i(),
240
+ type: "triangle",
241
+ x: e,
242
+ y: t,
243
+ size: r,
244
+ color: f,
245
+ pattern: p
246
+ };
247
+ c = [...c, o], m = `Drew a ${f} triangle at (${e}, ${t}) with size ${r}`, h = "Triangle added. Ask the user what else they want to add.";
248
+ break;
249
+ }
250
+ case "line": {
251
+ let e = a(n.x1 ?? 20, 0, 100), t = a(n.y1 ?? 50, 0, 100), r = a(n.x2 ?? 80, 0, 100), o = a(n.y2 ?? 50, 0, 100), s = a(n.strokeWidth ?? 2, 1, 10), l = {
252
+ id: i(),
253
+ type: "line",
254
+ x1: e,
255
+ y1: t,
256
+ x2: r,
257
+ y2: o,
258
+ strokeWidth: s,
259
+ color: f,
260
+ pattern: "solid"
261
+ };
262
+ c = [...c, l], m = `Drew a ${f} line from (${e}, ${t}) to (${r}, ${o})`, h = "Line added. Ask the user what else they want to add.";
263
+ break;
264
+ }
265
+ case "fill":
266
+ n.color ? (l = n.color, m = `Default fill color changed to ${n.color}`, h = "Default color updated. Future shapes will use this color unless specified otherwise.") : (m = "No color specified for fill action", h = "Ask the user what color they want to use.");
267
+ break;
268
+ case "pattern":
269
+ n.pattern ? (u = n.pattern, m = `Default pattern changed to ${n.pattern}`, h = "Default pattern updated. Future shapes will use this pattern unless specified otherwise.") : (m = "No pattern specified", h = "Ask the user what pattern they want (solid, hatched, dotted, striped).");
270
+ break;
271
+ case "move":
272
+ if (c.length === 0) m = "No shapes to move", h = "There are no shapes on the canvas yet. Help the user draw something first.";
273
+ else {
274
+ let e = n.dx ?? 0, t = n.dy ?? 0, r = c[c.length - 1], i;
275
+ i = r.type === "line" ? {
276
+ ...r,
277
+ x1: a(r.x1 + e, 0, 100),
278
+ y1: a(r.y1 + t, 0, 100),
279
+ x2: a(r.x2 + e, 0, 100),
280
+ y2: a(r.y2 + t, 0, 100)
281
+ } : {
282
+ ...r,
283
+ x: a(r.x + e, 0, 100),
284
+ y: a(r.y + t, 0, 100)
285
+ }, c = [...c.slice(0, -1), i], m = `Moved last shape by (${e}, ${t})`, h = "Shape moved. Ask the user if they want to continue adjusting.";
286
+ }
287
+ break;
288
+ case "undo":
289
+ c.length === 0 ? (m = "No shapes to undo", h = "The canvas is already empty.") : (c = c.slice(0, -1), m = `Removed last shape. ${c.length} shapes remaining.`, h = "Last shape removed. Ask the user what they want to do next.");
290
+ break;
291
+ case "guess": {
292
+ d = "guessing";
293
+ let e = c.map(o);
294
+ m = `Guessing phase! The drawing has ${c.length} shapes.`, h = `Look at the shape descriptions and make your best guess what the user drew. Be creative and fun with your guess! Shape descriptions: ${e.join("; ")}. After guessing, ask the user if you were correct.`;
295
+ break;
296
+ }
297
+ default: m = `Unknown action: ${r}`, h = "Ask the user what they want to do.";
298
+ }
299
+ let g = {
300
+ shapes: c,
301
+ defaultColor: l,
302
+ defaultPattern: u,
303
+ gamePhase: d
304
+ }, _ = {
305
+ shapeCount: c.length,
306
+ gamePhase: d,
307
+ lastAction: r,
308
+ ...r === "guess" && { shapeDescriptions: c.map(o) }
309
+ };
310
+ return {
311
+ toolName: t.name,
312
+ message: m,
313
+ data: g,
314
+ jsonData: _,
315
+ instructions: h,
316
+ updating: r !== "start"
317
+ };
318
+ }, c = {
319
+ toolDefinition: t,
320
+ execute: s,
321
+ generatingMessage: "Drawing...",
322
+ isEnabled: () => !0,
323
+ systemPrompt: n,
324
+ samples: r
325
+ };
326
+ //#endregion
327
+ export { t as a, n as i, c as n, e as o, r, s as t };
@@ -0,0 +1,38 @@
1
+ var e=`drawingGame`,t={type:`function`,name:e,description:`A drawing game where you help the user draw pictures using only primitive shapes. The user describes what to draw, and you interpret their instructions into shape commands. At the end, you guess what they drew.`,parameters:{type:`object`,properties:{action:{type:`string`,enum:[`start`,`circle`,`ellipse`,`rectangle`,`triangle`,`line`,`fill`,`pattern`,`move`,`undo`,`guess`],description:`The action to perform. start: Clear canvas and start new game. circle/ellipse/rectangle/triangle/line: Draw shapes. fill: Change default fill color. pattern: Change default pattern (solid/hatched/dotted/striped). move: Move the last shape. undo: Remove last shape. guess: Make a guess what the drawing represents.`},x:{type:`number`,description:`X position (0-100, where 0=left, 50=center, 100=right)`},y:{type:`number`,description:`Y position (0-100, where 0=top, 50=center, 100=bottom)`},size:{type:`number`,description:`Size for circle/triangle (0-100, where 5=tiny, 15=small, 30=medium, 50=large)`},width:{type:`number`,description:`Width for ellipse/rectangle (0-100)`},height:{type:`number`,description:`Height for ellipse/rectangle (0-100)`},x1:{type:`number`,description:`Start X for line (0-100)`},y1:{type:`number`,description:`Start Y for line (0-100)`},x2:{type:`number`,description:`End X for line (0-100)`},y2:{type:`number`,description:`End Y for line (0-100)`},strokeWidth:{type:`number`,description:`Line width (1-10, default 2)`},color:{type:`string`,description:`CSS color name or hex (e.g., 'blue', 'red', '#FF5733')`},pattern:{type:`string`,enum:[`solid`,`hatched`,`dotted`,`striped`],description:`Fill pattern: solid (normal), hatched (diagonal lines), dotted, striped (horizontal)`},dx:{type:`number`,description:`Relative X movement for move action (-100 to 100)`},dy:{type:`number`,description:`Relative Y movement for move action (-100 to 100)`}},required:[`action`]}},n=`You are playing a drawing game. The user will describe what they want to draw, and you must interpret their instructions using ONLY primitive shapes.
2
+
3
+ AVAILABLE COMMANDS:
4
+ - start: Clear canvas and begin new game
5
+ - circle: Draw a circle (x, y, size, color, pattern)
6
+ - ellipse: Draw an ellipse (x, y, width, height, color, pattern)
7
+ - rectangle: Draw a rectangle (x, y, width, height, color, pattern)
8
+ - triangle: Draw a triangle (x, y, size, color, pattern)
9
+ - line: Draw a line (x1, y1, x2, y2, color, strokeWidth)
10
+ - fill: Change default fill color
11
+ - pattern: Change default pattern (solid/hatched/dotted/striped)
12
+ - move: Move last shape (dx, dy as relative movement)
13
+ - undo: Remove last shape
14
+ - guess: Guess what the drawing is
15
+
16
+ POSITION GUIDE (0-100):
17
+ - x: 0=left edge, 50=center, 100=right edge
18
+ - y: 0=top edge, 50=center, 100=bottom edge
19
+ - size: 5=tiny, 15=small, 30=medium, 50=large
20
+
21
+ PATTERNS:
22
+ - solid: Normal fill
23
+ - hatched: Diagonal lines (網掛け)
24
+ - dotted: Dots pattern
25
+ - striped: Horizontal stripes
26
+
27
+ EXAMPLES:
28
+ - "大きな青い丸を中央に" → circle x:50, y:50, size:30, color:blue
29
+ - "上に小さな赤い三角" → triangle x:50, y:20, size:15, color:red
30
+ - "網掛けの四角" → rectangle with pattern:hatched
31
+ - "ちょっと右に" → move dx:10, dy:0
32
+ - "当てて!" → guess
33
+
34
+ RULES:
35
+ 1. Only use primitive shapes - no complex drawings!
36
+ 2. Interpret user's natural language into coordinates
37
+ 3. When user says "当てて" or "guess", call the guess action
38
+ 4. Be creative but stick to primitives!`,r=[{name:`Start Game`,args:{action:`start`}},{name:`Blue Circle`,args:{action:`circle`,x:50,y:50,size:25,color:`blue`}},{name:`Red Triangle`,args:{action:`triangle`,x:50,y:25,size:15,color:`red`}},{name:`Green Rectangle`,args:{action:`rectangle`,x:50,y:75,width:40,height:15,color:`green`}},{name:`Yellow Ellipse`,args:{action:`ellipse`,x:30,y:50,width:20,height:30,color:`gold`}},{name:`Black Line`,args:{action:`line`,x1:10,y1:90,x2:90,y2:90,color:`black`,strokeWidth:3}},{name:`Hatched Pattern`,args:{action:`rectangle`,x:70,y:30,width:20,height:20,color:`purple`,pattern:`hatched`}},{name:`Move Right`,args:{action:`move`,dx:10,dy:0}},{name:`Undo`,args:{action:`undo`}},{name:`Guess!`,args:{action:`guess`}}],i=()=>Math.random().toString(36).substring(2,9),a=(e,t,n)=>Math.max(t,Math.min(n,e)),o=e=>{let t=e.pattern===`solid`?``:` ${e.pattern}`,n=(e,t)=>`${t<33?`top`:t>66?`bottom`:`middle`}-${e<33?`left`:e>66?`right`:`center`}`;switch(e.type){case`circle`:return`${e.size<15?`small`:e.size>35?`large`:`medium`}${t} ${e.color} circle at ${n(e.x,e.y)}`;case`ellipse`:return`${t} ${e.color} ellipse at ${n(e.x,e.y)}`;case`rectangle`:{let r=Math.abs(e.width-e.height)<5?`square`:`rectangle`;return`${t} ${e.color} ${r} at ${n(e.x,e.y)}`}case`triangle`:return`${e.size<15?`small`:e.size>35?`large`:`medium`}${t} ${e.color} triangle at ${n(e.x,e.y)}`;case`line`:return`${e.color} line from (${e.x1},${e.y1}) to (${e.x2},${e.y2})`}},s=async(e,n)=>{let{action:r}=n,s=e.currentResult?.data,c=s?.shapes??[],l=s?.defaultColor??`black`,u=s?.defaultPattern??`solid`,d=s?.gamePhase??`drawing`,f=n.color??l,p=n.pattern??u,m,h;switch(r){case`start`:c=[],l=`black`,u=`solid`,d=`drawing`,m=`New drawing game started! Canvas is clear.`,h=`The drawing canvas is now clear. Help the user draw by interpreting their descriptions into primitive shapes (circle, ellipse, rectangle, triangle, line). Ask them what they want to draw!`;break;case`circle`:{let e=a(n.x??50,0,100),t=a(n.y??50,0,100),r=a(n.size??20,1,100),o={id:i(),type:`circle`,x:e,y:t,size:r,color:f,pattern:p};c=[...c,o],m=`Drew a ${f} circle at (${e}, ${t}) with size ${r}`,h=`Circle added. Ask the user what else they want to add or if they want you to guess.`;break}case`ellipse`:{let e=a(n.x??50,0,100),t=a(n.y??50,0,100),r=a(n.width??30,1,100),o=a(n.height??20,1,100),s={id:i(),type:`ellipse`,x:e,y:t,width:r,height:o,color:f,pattern:p};c=[...c,s],m=`Drew a ${f} ellipse at (${e}, ${t})`,h=`Ellipse added. Ask the user what else they want to add.`;break}case`rectangle`:{let e=a(n.x??50,0,100),t=a(n.y??50,0,100),r=a(n.width??30,1,100),o=a(n.height??20,1,100),s={id:i(),type:`rectangle`,x:e,y:t,width:r,height:o,color:f,pattern:p};c=[...c,s],m=`Drew a ${f} rectangle at (${e}, ${t})`,h=`Rectangle added. Ask the user what else they want to add.`;break}case`triangle`:{let e=a(n.x??50,0,100),t=a(n.y??50,0,100),r=a(n.size??20,1,100),o={id:i(),type:`triangle`,x:e,y:t,size:r,color:f,pattern:p};c=[...c,o],m=`Drew a ${f} triangle at (${e}, ${t}) with size ${r}`,h=`Triangle added. Ask the user what else they want to add.`;break}case`line`:{let e=a(n.x1??20,0,100),t=a(n.y1??50,0,100),r=a(n.x2??80,0,100),o=a(n.y2??50,0,100),s=a(n.strokeWidth??2,1,10),l={id:i(),type:`line`,x1:e,y1:t,x2:r,y2:o,strokeWidth:s,color:f,pattern:`solid`};c=[...c,l],m=`Drew a ${f} line from (${e}, ${t}) to (${r}, ${o})`,h=`Line added. Ask the user what else they want to add.`;break}case`fill`:n.color?(l=n.color,m=`Default fill color changed to ${n.color}`,h=`Default color updated. Future shapes will use this color unless specified otherwise.`):(m=`No color specified for fill action`,h=`Ask the user what color they want to use.`);break;case`pattern`:n.pattern?(u=n.pattern,m=`Default pattern changed to ${n.pattern}`,h=`Default pattern updated. Future shapes will use this pattern unless specified otherwise.`):(m=`No pattern specified`,h=`Ask the user what pattern they want (solid, hatched, dotted, striped).`);break;case`move`:if(c.length===0)m=`No shapes to move`,h=`There are no shapes on the canvas yet. Help the user draw something first.`;else{let e=n.dx??0,t=n.dy??0,r=c[c.length-1],i;i=r.type===`line`?{...r,x1:a(r.x1+e,0,100),y1:a(r.y1+t,0,100),x2:a(r.x2+e,0,100),y2:a(r.y2+t,0,100)}:{...r,x:a(r.x+e,0,100),y:a(r.y+t,0,100)},c=[...c.slice(0,-1),i],m=`Moved last shape by (${e}, ${t})`,h=`Shape moved. Ask the user if they want to continue adjusting.`}break;case`undo`:c.length===0?(m=`No shapes to undo`,h=`The canvas is already empty.`):(c=c.slice(0,-1),m=`Removed last shape. ${c.length} shapes remaining.`,h=`Last shape removed. Ask the user what they want to do next.`);break;case`guess`:{d=`guessing`;let e=c.map(o);m=`Guessing phase! The drawing has ${c.length} shapes.`,h=`Look at the shape descriptions and make your best guess what the user drew. Be creative and fun with your guess! Shape descriptions: ${e.join(`; `)}. After guessing, ask the user if you were correct.`;break}default:m=`Unknown action: ${r}`,h=`Ask the user what they want to do.`}let g={shapes:c,defaultColor:l,defaultPattern:u,gamePhase:d},_={shapeCount:c.length,gamePhase:d,lastAction:r,...r===`guess`&&{shapeDescriptions:c.map(o)}};return{toolName:t.name,message:m,data:g,jsonData:_,instructions:h,updating:r!==`start`}},c={toolDefinition:t,execute:s,generatingMessage:`Drawing...`,isEnabled:()=>!0,systemPrompt:n,samples:r};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return s}});
package/dist/style.css ADDED
@@ -0,0 +1,3 @@
1
+ /*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */
2
+ @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-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--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;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial}}}@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-100:oklch(93.6% .032 17.717);--color-red-700:oklch(50.5% .213 27.518);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(44.8% .119 151.328);--color-green-900:oklch(39.3% .095 152.535);--color-blue-50:oklch(97% .014 254.604);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-900:oklch(37.9% .146 265.522);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--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-purple-100:oklch(94.6% .033 307.174);--color-purple-500:oklch(62.7% .265 303.9);--color-purple-700:oklch(49.6% .265 301.924);--color-pink-100:oklch(94.8% .028 342.258);--color-pink-500:oklch(65.6% .241 354.308);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--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-500:oklch(55.1% .027 264.364);--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-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--container-2xl:42rem;--container-3xl:48rem;--container-6xl:72rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--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%;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;-webkit-text-decoration:inherit;-webkit-text-decoration: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]){appearance:button}::file-selector-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{.visible{visibility:visible}.relative{position:relative}.start{inset-inline-start:var(--spacing)}.m-4{margin:calc(var(--spacing) * 4)}.mx-auto{margin-inline:auto}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-8{margin-top:calc(var(--spacing) * 8)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mr-3{margin-right:calc(var(--spacing) * 3)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.contents{display:contents}.flex{display:flex}.grid{display:grid}.inline{display:inline}.inline-block{display:inline-block}.aspect-square{aspect-ratio:1}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-full{width:100%;height:100%}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-10{height:calc(var(--spacing) * 10)}.h-12{height:calc(var(--spacing) * 12)}.h-\[600px\]{height:600px}.h-full{height:100%}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-\[300px\]{min-height:300px}.min-h-screen{min-height:100vh}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-10{width:calc(var(--spacing) * 10)}.w-12{width:calc(var(--spacing) * 12)}.w-24{width:calc(var(--spacing) * 24)}.w-48{width:calc(var(--spacing) * 48)}.w-\[100px\]{width:100px}.w-\[137px\]{width:137px}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-\[85\%\]{max-width:85%}.max-w-\[200px\]{max-width:200px}.max-w-md{max-width:var(--container-md)}.flex-1{flex:1}.flex-shrink{flex-shrink:1}.flex-shrink-0{flex-shrink:0}.animate-pulse{animation:var(--animate-pulse)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-\[\#3d3d5c\]{border-color:#3d3d5c}.border-blue-500{border-color:var(--color-blue-500)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-gray-600{border-color:var(--color-gray-600)}.border-green-900{border-color:var(--color-green-900)}.border-slate-200{border-color:var(--color-slate-200)}.border-slate-300{border-color:var(--color-slate-300)}.border-transparent{border-color:#0000}.bg-\[\#1a1a2e\]{background-color:#1a1a2e}.bg-\[\#2d2d44\]{background-color:#2d2d44}.bg-\[\#3d3d5c\]{background-color:#3d3d5c}.bg-amber-50{background-color:var(--color-amber-50)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-black{background-color:var(--color-black)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-blue-900{background-color:var(--color-blue-900)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-400{background-color:var(--color-gray-400)}.bg-gray-600{background-color:var(--color-gray-600)}.bg-green-400{background-color:var(--color-green-400)}.bg-green-600{background-color:var(--color-green-600)}.bg-green-700{background-color:var(--color-green-700)}.bg-green-800{background-color:var(--color-green-800)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-red-100{background-color:var(--color-red-100)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-slate-900{background-color:var(--color-slate-900)}.bg-white{background-color:var(--color-white)}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-purple-100{--tw-gradient-from:var(--color-purple-100);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-purple-500{--tw-gradient-from:var(--color-purple-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-pink-100{--tw-gradient-to:var(--color-pink-100);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-pink-500{--tw-gradient-to:var(--color-pink-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.p-\[10px\]{padding:10px}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.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-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#f0f0f0\]{color:#f0f0f0}.text-amber-600{color:var(--color-amber-600)}.text-blue-400{color:var(--color-blue-400)}.text-blue-600{color:var(--color-blue-600)}.text-blue-700{color:var(--color-blue-700)}.text-gray-200{color:var(--color-gray-200)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.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-green-600{color:var(--color-green-600)}.text-indigo-600{color:var(--color-indigo-600)}.text-indigo-700{color:var(--color-indigo-700)}.text-purple-700{color:var(--color-purple-700)}.text-red-700{color:var(--color-red-700)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-800{color:var(--color-slate-800)}.text-white{color:var(--color-white)}.opacity-10{opacity:.1}.opacity-50{opacity:.5}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px 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)}.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)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.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))}.duration-200{--tw-duration:.2s;transition-duration:.2s}@media (hover:hover){.hover\:border-blue-400:hover{border-color:var(--color-blue-400)}.hover\:bg-blue-200:hover{background-color:var(--color-blue-200)}.hover\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-gray-300:hover{background-color:var(--color-gray-300)}.hover\:bg-green-500:hover{background-color:var(--color-green-500)}.hover\:bg-green-600:hover{background-color:var(--color-green-600)}.hover\:bg-indigo-200:hover{background-color:var(--color-indigo-200)}.hover\:bg-indigo-700:hover{background-color:var(--color-indigo-700)}}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + 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:focus{--tw-ring-color:var(--color-indigo-500)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-gray-100:disabled{background-color:var(--color-gray-100)}.disabled\:bg-gray-400:disabled{background-color:var(--color-gray-400)}@media (width>=64rem){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}}body{margin:calc(var(--spacing) * 0);background-color:var(--color-gray-100);padding:calc(var(--spacing) * 5);font-family:var(--font-sans)}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@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}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes pulse{50%{opacity:.5}}
3
+ /*$vite$:1*/
@@ -0,0 +1,7 @@
1
+ import type { ToolResult } from "gui-chat-protocol";
2
+ type __VLS_Props = {
3
+ result: ToolResult;
4
+ };
5
+ declare const __VLS_export: 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>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import type { ToolResult } from "gui-chat-protocol";
2
+ type __VLS_Props = {
3
+ selectedResult: ToolResult;
4
+ sendTextMessage: (text?: string) => void;
5
+ };
6
+ declare const __VLS_export: 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
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Drawing Game Plugin - Vue Implementation
3
+ */
4
+ import "../style.css";
5
+ import type { ToolPlugin } from "gui-chat-protocol/vue";
6
+ import type { DrawingGameData, DrawingGameJsonData, DrawingGameArgs } from "../core/types";
7
+ import View from "./View.vue";
8
+ import Preview from "./Preview.vue";
9
+ export declare const plugin: ToolPlugin<DrawingGameData, DrawingGameJsonData, DrawingGameArgs>;
10
+ export type { PatternType, Shape, CircleShape, EllipseShape, RectangleShape, TriangleShape, LineShape, GamePhase, DrawingGameData, DrawingGameJsonData, ActionType, DrawingGameArgs, } from "../core/types";
11
+ export { pluginCore, executeDrawingGame } from "../core/plugin";
12
+ export { TOOL_NAME, TOOL_DEFINITION, SYSTEM_PROMPT } from "../core/definition";
13
+ export { SAMPLES } from "../core/samples";
14
+ export { View, Preview };
15
+ declare const _default: {
16
+ plugin: ToolPlugin<DrawingGameData, DrawingGameJsonData, DrawingGameArgs, import("gui-chat-protocol/vue").InputHandler, Record<string, unknown>>;
17
+ };
18
+ export default _default;
package/dist/vue.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./plugin-Csnn_dZJ.cjs`);let t=require(`vue`);var n={class:`size-full overflow-hidden p-4 bg-slate-100 flex flex-col items-center`},r={key:0,class:`w-full max-w-2xl`},i={class:`flex items-center justify-between mb-4`},a={class:`flex items-center gap-4 text-sm text-slate-600`},o={class:`bg-white rounded-lg shadow-lg overflow-hidden border-2 border-slate-300`},s=[`viewBox`],c={class:`opacity-10`},l=[`x1`,`x2`],u=[`y1`,`y2`],d=[`cx`,`cy`,`r`,`fill`,`stroke`],f=[`cx`,`cy`,`rx`,`ry`,`fill`,`stroke`],p=[`x`,`y`,`width`,`height`,`fill`,`stroke`],m=[`points`,`fill`,`stroke`],h=[`x1`,`y1`,`x2`,`y2`,`stroke`,`stroke-width`],g={class:`mt-4 text-center text-sm text-slate-500`},_={key:0},v={key:1},y={key:2},b=500,x=(0,t.defineComponent)({__name:`View`,props:{selectedResult:{},sendTextMessage:{type:Function}},setup(e){let x=e,S=(0,t.ref)(null);(0,t.watch)(()=>x.selectedResult,e=>{e?.toolName===`drawingGame`&&e.data&&(S.value=e.data)},{immediate:!0,deep:!0});let C=e=>e/100*b,w=e=>e.type===`line`?`none`:e.pattern===`solid`?e.color:`url(#pattern-${e.pattern})`,T=e=>e.pattern===`solid`?``:`color: ${e.color}`,E=e=>{let t=C(e.x),n=C(e.y),r=C(e.size)/2,i=n-r,a=n+r*.5;return`${t},${i} ${t-r*.866},${a} ${t+r*.866},${a}`};return(e,x)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,n,[S.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,r,[(0,t.createElementVNode)(`div`,i,[x[0]||=(0,t.createElementVNode)(`h2`,{class:`text-xl font-bold text-slate-800`},`Drawing Game`,-1),(0,t.createElementVNode)(`div`,a,[(0,t.createElementVNode)(`span`,null,`Shapes: `+(0,t.toDisplayString)(S.value.shapes.length),1),(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)(S.value.gamePhase===`guessing`?`text-amber-600 font-semibold`:``)},(0,t.toDisplayString)(S.value.gamePhase===`guessing`?`Guessing!`:`Drawing`),3)])]),(0,t.createElementVNode)(`div`,o,[((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,{viewBox:`0 0 ${b} ${b}`,class:`w-full aspect-square`,style:{background:`white`}},[x[1]||=(0,t.createStaticVNode)(`<defs><pattern id="pattern-hatched" patternUnits="userSpaceOnUse" width="8" height="8" patternTransform="rotate(45)"><line x1="0" y1="0" x2="0" y2="8" stroke="currentColor" stroke-width="2"></line></pattern><pattern id="pattern-dotted" patternUnits="userSpaceOnUse" width="10" height="10"><circle cx="5" cy="5" r="2" fill="currentColor"></circle></pattern><pattern id="pattern-striped" patternUnits="userSpaceOnUse" width="10" height="10"><line x1="0" y1="5" x2="10" y2="5" stroke="currentColor" stroke-width="3"></line></pattern></defs>`,1),(0,t.createElementVNode)(`g`,c,[((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(9,e=>(0,t.createElementVNode)(`line`,{key:`v-${e}`,x1:e*50,y1:`0`,x2:e*50,y2:b,stroke:`#999`,"stroke-width":`1`},null,8,l)),64)),((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(9,e=>(0,t.createElementVNode)(`line`,{key:`h-${e}`,x1:`0`,y1:e*50,x2:b,y2:e*50,stroke:`#999`,"stroke-width":`1`},null,8,u)),64))]),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(S.value.shapes,e=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:e.id},[e.type===`circle`?((0,t.openBlock)(),(0,t.createElementBlock)(`circle`,{key:0,cx:C(e.x),cy:C(e.y),r:C(e.size)/2,fill:w(e),stroke:e.color,"stroke-width":`2`,style:(0,t.normalizeStyle)(T(e))},null,12,d)):e.type===`ellipse`?((0,t.openBlock)(),(0,t.createElementBlock)(`ellipse`,{key:1,cx:C(e.x),cy:C(e.y),rx:C(e.width)/2,ry:C(e.height)/2,fill:w(e),stroke:e.color,"stroke-width":`2`,style:(0,t.normalizeStyle)(T(e))},null,12,f)):e.type===`rectangle`?((0,t.openBlock)(),(0,t.createElementBlock)(`rect`,{key:2,x:C(e.x)-C(e.width)/2,y:C(e.y)-C(e.height)/2,width:C(e.width),height:C(e.height),fill:w(e),stroke:e.color,"stroke-width":`2`,style:(0,t.normalizeStyle)(T(e))},null,12,p)):e.type===`triangle`?((0,t.openBlock)(),(0,t.createElementBlock)(`polygon`,{key:3,points:E(e),fill:w(e),stroke:e.color,"stroke-width":`2`,style:(0,t.normalizeStyle)(T(e))},null,12,m)):e.type===`line`?((0,t.openBlock)(),(0,t.createElementBlock)(`line`,{key:4,x1:C(e.x1),y1:C(e.y1),x2:C(e.x2),y2:C(e.y2),stroke:e.color,"stroke-width":e.strokeWidth*2,"stroke-linecap":`round`},null,8,h)):(0,t.createCommentVNode)(``,!0)],64))),128))],8,s))]),(0,t.createElementVNode)(`div`,g,[S.value.shapes.length===0?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,_,` Say something like "draw a big blue circle in the center" `)):S.value.gamePhase===`drawing`?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,v,` Keep adding shapes or say "guess!" when done `)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,y,` Waiting for the guess... `))])])):(0,t.createCommentVNode)(``,!0)]))}}),S={class:`p-3 bg-amber-50 rounded-md`},C={key:0,class:`flex flex-col gap-2`},w={class:`bg-white rounded border border-slate-200 overflow-hidden`},T={viewBox:`0 0 100 100`,class:`w-full aspect-square`},E=[`cx`,`cy`,`r`,`fill`,`stroke`],D=[`cx`,`cy`,`rx`,`ry`,`fill`],O=[`x`,`y`,`width`,`height`,`fill`],k=[`points`,`fill`],A=[`x1`,`y1`,`x2`,`y2`,`stroke`],j={class:`text-center`},M={class:`inline-block bg-amber-500 text-white text-xs font-bold py-1 px-3 rounded-full`},N=(0,t.defineComponent)({__name:`Preview`,props:{result:{}},setup(e){let n=e,r=(0,t.computed)(()=>n.result.data),i=e=>{let t=e.x,n=e.y,r=e.size/2,i=n-r,a=n+r*.5;return`${t},${i} ${t-r*.866},${a} ${t+r*.866},${a}`};return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,S,[r.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,C,[n[0]||=(0,t.createElementVNode)(`div`,{class:`text-sm font-semibold text-slate-800 text-center`},` Drawing Game `,-1),(0,t.createElementVNode)(`div`,w,[((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,T,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(r.value.shapes,e=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:e.id},[e.type===`circle`?((0,t.openBlock)(),(0,t.createElementBlock)(`circle`,{key:0,cx:e.x,cy:e.y,r:e.size/2,fill:e.color,stroke:e.color,"stroke-width":`0.5`},null,8,E)):e.type===`ellipse`?((0,t.openBlock)(),(0,t.createElementBlock)(`ellipse`,{key:1,cx:e.x,cy:e.y,rx:e.width/2,ry:e.height/2,fill:e.color},null,8,D)):e.type===`rectangle`?((0,t.openBlock)(),(0,t.createElementBlock)(`rect`,{key:2,x:e.x-e.width/2,y:e.y-e.height/2,width:e.width,height:e.height,fill:e.color},null,8,O)):e.type===`triangle`?((0,t.openBlock)(),(0,t.createElementBlock)(`polygon`,{key:3,points:i(e),fill:e.color},null,8,k)):e.type===`line`?((0,t.openBlock)(),(0,t.createElementBlock)(`line`,{key:4,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.color,"stroke-width":`1`},null,8,A)):(0,t.createCommentVNode)(``,!0)],64))),128))]))]),(0,t.createElementVNode)(`div`,j,[(0,t.createElementVNode)(`span`,M,(0,t.toDisplayString)(r.value.shapes.length)+` shapes `,1)])])):(0,t.createCommentVNode)(``,!0)]))}}),P={...e.n,viewComponent:x,previewComponent:N},F={plugin:P};exports.Preview=N,exports.SAMPLES=e.r,exports.SYSTEM_PROMPT=e.i,exports.TOOL_DEFINITION=e.a,exports.TOOL_NAME=e.o,exports.View=x,exports.default=F,exports.executeDrawingGame=e.t,exports.plugin=P,exports.pluginCore=e.n;
package/dist/vue.js ADDED
@@ -0,0 +1,215 @@
1
+ import { a as e, i as t, n, o as r, r as i, t as a } from "./plugin-B4TbiRHo.js";
2
+ import { Fragment as o, computed as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createStaticVNode as d, defineComponent as f, normalizeClass as p, normalizeStyle as m, openBlock as h, ref as g, renderList as _, toDisplayString as v, watch as y } from "vue";
3
+ //#region src/vue/View.vue?vue&type=script&setup=true&lang.ts
4
+ var b = { class: "size-full overflow-hidden p-4 bg-slate-100 flex flex-col items-center" }, x = {
5
+ key: 0,
6
+ class: "w-full max-w-2xl"
7
+ }, S = { class: "flex items-center justify-between mb-4" }, C = { class: "flex items-center gap-4 text-sm text-slate-600" }, w = { class: "bg-white rounded-lg shadow-lg overflow-hidden border-2 border-slate-300" }, T = ["viewBox"], E = { class: "opacity-10" }, D = ["x1", "x2"], O = ["y1", "y2"], k = [
8
+ "cx",
9
+ "cy",
10
+ "r",
11
+ "fill",
12
+ "stroke"
13
+ ], A = [
14
+ "cx",
15
+ "cy",
16
+ "rx",
17
+ "ry",
18
+ "fill",
19
+ "stroke"
20
+ ], j = [
21
+ "x",
22
+ "y",
23
+ "width",
24
+ "height",
25
+ "fill",
26
+ "stroke"
27
+ ], M = [
28
+ "points",
29
+ "fill",
30
+ "stroke"
31
+ ], N = [
32
+ "x1",
33
+ "y1",
34
+ "x2",
35
+ "y2",
36
+ "stroke",
37
+ "stroke-width"
38
+ ], P = { class: "mt-4 text-center text-sm text-slate-500" }, F = { key: 0 }, I = { key: 1 }, L = { key: 2 }, R = 500, z = /* @__PURE__ */ f({
39
+ __name: "View",
40
+ props: {
41
+ selectedResult: {},
42
+ sendTextMessage: { type: Function }
43
+ },
44
+ setup(e) {
45
+ let t = e, n = g(null);
46
+ y(() => t.selectedResult, (e) => {
47
+ e?.toolName === "drawingGame" && e.data && (n.value = e.data);
48
+ }, {
49
+ immediate: !0,
50
+ deep: !0
51
+ });
52
+ let r = (e) => e / 100 * R, i = (e) => e.type === "line" ? "none" : e.pattern === "solid" ? e.color : `url(#pattern-${e.pattern})`, a = (e) => e.pattern === "solid" ? "" : `color: ${e.color}`, s = (e) => {
53
+ let t = r(e.x), n = r(e.y), i = r(e.size) / 2, a = n - i, o = n + i * .5;
54
+ return `${t},${a} ${t - i * .866},${o} ${t + i * .866},${o}`;
55
+ };
56
+ return (e, t) => (h(), l("div", b, [n.value ? (h(), l("div", x, [
57
+ u("div", S, [t[0] ||= u("h2", { class: "text-xl font-bold text-slate-800" }, "Drawing Game", -1), u("div", C, [u("span", null, "Shapes: " + v(n.value.shapes.length), 1), u("span", { class: p(n.value.gamePhase === "guessing" ? "text-amber-600 font-semibold" : "") }, v(n.value.gamePhase === "guessing" ? "Guessing!" : "Drawing"), 3)])]),
58
+ u("div", w, [(h(), l("svg", {
59
+ viewBox: `0 0 ${R} ${R}`,
60
+ class: "w-full aspect-square",
61
+ style: { background: "white" }
62
+ }, [
63
+ t[1] ||= d("<defs><pattern id=\"pattern-hatched\" patternUnits=\"userSpaceOnUse\" width=\"8\" height=\"8\" patternTransform=\"rotate(45)\"><line x1=\"0\" y1=\"0\" x2=\"0\" y2=\"8\" stroke=\"currentColor\" stroke-width=\"2\"></line></pattern><pattern id=\"pattern-dotted\" patternUnits=\"userSpaceOnUse\" width=\"10\" height=\"10\"><circle cx=\"5\" cy=\"5\" r=\"2\" fill=\"currentColor\"></circle></pattern><pattern id=\"pattern-striped\" patternUnits=\"userSpaceOnUse\" width=\"10\" height=\"10\"><line x1=\"0\" y1=\"5\" x2=\"10\" y2=\"5\" stroke=\"currentColor\" stroke-width=\"3\"></line></pattern></defs>", 1),
64
+ u("g", E, [(h(), l(o, null, _(9, (e) => u("line", {
65
+ key: `v-${e}`,
66
+ x1: e * 50,
67
+ y1: "0",
68
+ x2: e * 50,
69
+ y2: R,
70
+ stroke: "#999",
71
+ "stroke-width": "1"
72
+ }, null, 8, D)), 64)), (h(), l(o, null, _(9, (e) => u("line", {
73
+ key: `h-${e}`,
74
+ x1: "0",
75
+ y1: e * 50,
76
+ x2: R,
77
+ y2: e * 50,
78
+ stroke: "#999",
79
+ "stroke-width": "1"
80
+ }, null, 8, O)), 64))]),
81
+ (h(!0), l(o, null, _(n.value.shapes, (e) => (h(), l(o, { key: e.id }, [e.type === "circle" ? (h(), l("circle", {
82
+ key: 0,
83
+ cx: r(e.x),
84
+ cy: r(e.y),
85
+ r: r(e.size) / 2,
86
+ fill: i(e),
87
+ stroke: e.color,
88
+ "stroke-width": "2",
89
+ style: m(a(e))
90
+ }, null, 12, k)) : e.type === "ellipse" ? (h(), l("ellipse", {
91
+ key: 1,
92
+ cx: r(e.x),
93
+ cy: r(e.y),
94
+ rx: r(e.width) / 2,
95
+ ry: r(e.height) / 2,
96
+ fill: i(e),
97
+ stroke: e.color,
98
+ "stroke-width": "2",
99
+ style: m(a(e))
100
+ }, null, 12, A)) : e.type === "rectangle" ? (h(), l("rect", {
101
+ key: 2,
102
+ x: r(e.x) - r(e.width) / 2,
103
+ y: r(e.y) - r(e.height) / 2,
104
+ width: r(e.width),
105
+ height: r(e.height),
106
+ fill: i(e),
107
+ stroke: e.color,
108
+ "stroke-width": "2",
109
+ style: m(a(e))
110
+ }, null, 12, j)) : e.type === "triangle" ? (h(), l("polygon", {
111
+ key: 3,
112
+ points: s(e),
113
+ fill: i(e),
114
+ stroke: e.color,
115
+ "stroke-width": "2",
116
+ style: m(a(e))
117
+ }, null, 12, M)) : e.type === "line" ? (h(), l("line", {
118
+ key: 4,
119
+ x1: r(e.x1),
120
+ y1: r(e.y1),
121
+ x2: r(e.x2),
122
+ y2: r(e.y2),
123
+ stroke: e.color,
124
+ "stroke-width": e.strokeWidth * 2,
125
+ "stroke-linecap": "round"
126
+ }, null, 8, N)) : c("", !0)], 64))), 128))
127
+ ], 8, T))]),
128
+ u("div", P, [n.value.shapes.length === 0 ? (h(), l("span", F, " Say something like \"draw a big blue circle in the center\" ")) : n.value.gamePhase === "drawing" ? (h(), l("span", I, " Keep adding shapes or say \"guess!\" when done ")) : (h(), l("span", L, " Waiting for the guess... "))])
129
+ ])) : c("", !0)]));
130
+ }
131
+ }), B = { class: "p-3 bg-amber-50 rounded-md" }, V = {
132
+ key: 0,
133
+ class: "flex flex-col gap-2"
134
+ }, H = { class: "bg-white rounded border border-slate-200 overflow-hidden" }, U = {
135
+ viewBox: "0 0 100 100",
136
+ class: "w-full aspect-square"
137
+ }, W = [
138
+ "cx",
139
+ "cy",
140
+ "r",
141
+ "fill",
142
+ "stroke"
143
+ ], G = [
144
+ "cx",
145
+ "cy",
146
+ "rx",
147
+ "ry",
148
+ "fill"
149
+ ], K = [
150
+ "x",
151
+ "y",
152
+ "width",
153
+ "height",
154
+ "fill"
155
+ ], q = ["points", "fill"], J = [
156
+ "x1",
157
+ "y1",
158
+ "x2",
159
+ "y2",
160
+ "stroke"
161
+ ], Y = { class: "text-center" }, X = { class: "inline-block bg-amber-500 text-white text-xs font-bold py-1 px-3 rounded-full" }, Z = /* @__PURE__ */ f({
162
+ __name: "Preview",
163
+ props: { result: {} },
164
+ setup(e) {
165
+ let t = e, n = s(() => t.result.data), r = (e) => {
166
+ let t = e.x, n = e.y, r = e.size / 2, i = n - r, a = n + r * .5;
167
+ return `${t},${i} ${t - r * .866},${a} ${t + r * .866},${a}`;
168
+ };
169
+ return (e, t) => (h(), l("div", B, [n.value ? (h(), l("div", V, [
170
+ t[0] ||= u("div", { class: "text-sm font-semibold text-slate-800 text-center" }, " Drawing Game ", -1),
171
+ u("div", H, [(h(), l("svg", U, [(h(!0), l(o, null, _(n.value.shapes, (e) => (h(), l(o, { key: e.id }, [e.type === "circle" ? (h(), l("circle", {
172
+ key: 0,
173
+ cx: e.x,
174
+ cy: e.y,
175
+ r: e.size / 2,
176
+ fill: e.color,
177
+ stroke: e.color,
178
+ "stroke-width": "0.5"
179
+ }, null, 8, W)) : e.type === "ellipse" ? (h(), l("ellipse", {
180
+ key: 1,
181
+ cx: e.x,
182
+ cy: e.y,
183
+ rx: e.width / 2,
184
+ ry: e.height / 2,
185
+ fill: e.color
186
+ }, null, 8, G)) : e.type === "rectangle" ? (h(), l("rect", {
187
+ key: 2,
188
+ x: e.x - e.width / 2,
189
+ y: e.y - e.height / 2,
190
+ width: e.width,
191
+ height: e.height,
192
+ fill: e.color
193
+ }, null, 8, K)) : e.type === "triangle" ? (h(), l("polygon", {
194
+ key: 3,
195
+ points: r(e),
196
+ fill: e.color
197
+ }, null, 8, q)) : e.type === "line" ? (h(), l("line", {
198
+ key: 4,
199
+ x1: e.x1,
200
+ y1: e.y1,
201
+ x2: e.x2,
202
+ y2: e.y2,
203
+ stroke: e.color,
204
+ "stroke-width": "1"
205
+ }, null, 8, J)) : c("", !0)], 64))), 128))]))]),
206
+ u("div", Y, [u("span", X, v(n.value.shapes.length) + " shapes ", 1)])
207
+ ])) : c("", !0)]));
208
+ }
209
+ }), Q = {
210
+ ...n,
211
+ viewComponent: z,
212
+ previewComponent: Z
213
+ }, $ = { plugin: Q };
214
+ //#endregion
215
+ export { Z as Preview, i as SAMPLES, t as SYSTEM_PROMPT, e as TOOL_DEFINITION, r as TOOL_NAME, z as View, $ as default, a as executeDrawingGame, Q as plugin, n as pluginCore };
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@gui-chat-plugin/drawing-game",
3
+ "version": "0.1.1",
4
+ "description": "Drawing game plugin - draw with primitives and let AI guess",
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
+ "./core": {
16
+ "types": "./dist/core/index.d.ts",
17
+ "import": "./dist/core.js",
18
+ "require": "./dist/core.cjs"
19
+ },
20
+ "./vue": {
21
+ "types": "./dist/vue/index.d.ts",
22
+ "import": "./dist/vue.js",
23
+ "require": "./dist/vue.cjs"
24
+ },
25
+ "./style.css": "./dist/style.css"
26
+ },
27
+ "files": [
28
+ "dist"
29
+ ],
30
+ "scripts": {
31
+ "dev": "vite",
32
+ "build": "vite build && vue-tsc -p tsconfig.build.json --emitDeclarationOnly",
33
+ "typecheck": "vue-tsc --noEmit",
34
+ "lint": "eslint src demo"
35
+ },
36
+ "peerDependencies": {
37
+ "vue": "^3.5.0"
38
+ },
39
+ "peerDependenciesMeta": {
40
+ "vue": {
41
+ "optional": true
42
+ }
43
+ },
44
+ "devDependencies": {
45
+ "@eslint/js": "^10.0.1",
46
+ "@tailwindcss/vite": "^4.2.2",
47
+ "@typescript-eslint/eslint-plugin": "^8.58.0",
48
+ "@typescript-eslint/parser": "^8.58.0",
49
+ "@vitejs/plugin-vue": "^6.0.5",
50
+ "eslint": "^10.1.0",
51
+ "eslint-plugin-vue": "^10.8.0",
52
+ "globals": "^17.4.0",
53
+ "openai": "^6.16.0",
54
+ "tailwindcss": "^4.2.2",
55
+ "typescript": "~5.9.3",
56
+ "vite": "^8.0.3",
57
+ "vue": "^3.5.31",
58
+ "vue-eslint-parser": "^10.4.0",
59
+ "vue-tsc": "^3.2.6"
60
+ },
61
+ "keywords": [
62
+ "guichat",
63
+ "plugin",
64
+ "drawing",
65
+ "game",
66
+ "svg",
67
+ "primitives"
68
+ ],
69
+ "license": "MIT",
70
+ "dependencies": {
71
+ "gui-chat-protocol": "^0.0.4"
72
+ }
73
+ }