@gui-chat-plugin/tictactoe 0.1.1 → 0.1.2

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,405 @@
1
+ //#region src/core/definition.ts
2
+ var e = "playTicTacToe", t = {
3
+ type: "function",
4
+ name: e,
5
+ description: "Play Tic-Tac-Toe (Noughts and Crosses) game with the user. You can start a new game or make moves on the 3x3 board.",
6
+ parameters: {
7
+ type: "object",
8
+ properties: {
9
+ action: {
10
+ type: "string",
11
+ enum: ["new_game", "move"],
12
+ description: "The action to perform: start a new game or make a move"
13
+ },
14
+ col: {
15
+ type: "number",
16
+ description: "Column position for the move (0-2, required for 'move' action). Left=0, Center=1, Right=2",
17
+ minimum: 0,
18
+ maximum: 2
19
+ },
20
+ row: {
21
+ type: "number",
22
+ description: "Row position for the move (0-2, required for 'move' action). Top=0, Middle=1, Bottom=2",
23
+ minimum: 0,
24
+ maximum: 2
25
+ },
26
+ board: {
27
+ type: "array",
28
+ description: "Current 3x3 board state BEFORE the move (required for 'move' action). Pass the current board state as-is.",
29
+ items: {
30
+ type: "array",
31
+ items: {
32
+ type: "string",
33
+ enum: [
34
+ ".",
35
+ "X",
36
+ "O"
37
+ ]
38
+ }
39
+ }
40
+ },
41
+ currentSide: {
42
+ type: "string",
43
+ enum: ["X", "O"],
44
+ description: "Current player's side (required for 'move' action). X always goes first."
45
+ },
46
+ playerNames: {
47
+ type: "object",
48
+ description: "Player assignments (required for 'move' action)",
49
+ properties: {
50
+ X: {
51
+ type: "string",
52
+ enum: ["user", "computer"]
53
+ },
54
+ O: {
55
+ type: "string",
56
+ enum: ["user", "computer"]
57
+ }
58
+ },
59
+ required: ["X", "O"]
60
+ },
61
+ firstPlayer: {
62
+ type: "string",
63
+ enum: ["user", "computer"],
64
+ description: "Optional: Which player should play as X (goes first) for 'new_game' action. If not specified, will be chosen randomly."
65
+ }
66
+ },
67
+ required: ["action"],
68
+ additionalProperties: !1
69
+ }
70
+ }, n = "You can play Tic-Tac-Toe with users using the playTicTacToe tool.\n\nIMPORTANT: When the user specifies a move (e.g., \"I want to play at top-left, which is row=0, col=0\"), you MUST call the playTicTacToe tool with action=\"move\", NOT respond with text.\n\nGame rules:\n1. Start a new game with action=\"new_game\"\n2. For moves, use action=\"move\" with row (0-2) and col (0-2), plus the current board state\n3. X always goes first. Win by getting 3 in a row (horizontal, vertical, or diagonal)\n4. Positions: row=0 is top, row=2 is bottom; col=0 is left, col=2 is right", r = [
71
+ [
72
+ {
73
+ row: 0,
74
+ col: 0
75
+ },
76
+ {
77
+ row: 0,
78
+ col: 1
79
+ },
80
+ {
81
+ row: 0,
82
+ col: 2
83
+ }
84
+ ],
85
+ [
86
+ {
87
+ row: 1,
88
+ col: 0
89
+ },
90
+ {
91
+ row: 1,
92
+ col: 1
93
+ },
94
+ {
95
+ row: 1,
96
+ col: 2
97
+ }
98
+ ],
99
+ [
100
+ {
101
+ row: 2,
102
+ col: 0
103
+ },
104
+ {
105
+ row: 2,
106
+ col: 1
107
+ },
108
+ {
109
+ row: 2,
110
+ col: 2
111
+ }
112
+ ],
113
+ [
114
+ {
115
+ row: 0,
116
+ col: 0
117
+ },
118
+ {
119
+ row: 1,
120
+ col: 0
121
+ },
122
+ {
123
+ row: 2,
124
+ col: 0
125
+ }
126
+ ],
127
+ [
128
+ {
129
+ row: 0,
130
+ col: 1
131
+ },
132
+ {
133
+ row: 1,
134
+ col: 1
135
+ },
136
+ {
137
+ row: 2,
138
+ col: 1
139
+ }
140
+ ],
141
+ [
142
+ {
143
+ row: 0,
144
+ col: 2
145
+ },
146
+ {
147
+ row: 1,
148
+ col: 2
149
+ },
150
+ {
151
+ row: 2,
152
+ col: 2
153
+ }
154
+ ],
155
+ [
156
+ {
157
+ row: 0,
158
+ col: 0
159
+ },
160
+ {
161
+ row: 1,
162
+ col: 1
163
+ },
164
+ {
165
+ row: 2,
166
+ col: 2
167
+ }
168
+ ],
169
+ [
170
+ {
171
+ row: 0,
172
+ col: 2
173
+ },
174
+ {
175
+ row: 1,
176
+ col: 1
177
+ },
178
+ {
179
+ row: 2,
180
+ col: 0
181
+ }
182
+ ]
183
+ ];
184
+ function i() {
185
+ let e = [];
186
+ for (let t = 0; t < 3; t++) e[t] = [
187
+ ,
188
+ ,
189
+ ,
190
+ ].fill(".");
191
+ return e;
192
+ }
193
+ function a(e) {
194
+ return e.map((e) => [...e]);
195
+ }
196
+ function o(e) {
197
+ return e === "X" ? "O" : "X";
198
+ }
199
+ function s(e) {
200
+ let t = [];
201
+ for (let n = 0; n < 3; n++) for (let r = 0; r < 3; r++) e[n][r] === "." && t.push({
202
+ row: n,
203
+ col: r
204
+ });
205
+ return t;
206
+ }
207
+ function c(e, t, n, r) {
208
+ let i = a(e);
209
+ return i[t][n] = r, i;
210
+ }
211
+ function l(e) {
212
+ let t = 0, n = 0, r = 0;
213
+ for (let i = 0; i < 3; i++) for (let a = 0; a < 3; a++) {
214
+ let o = e[i][a];
215
+ o === "X" ? t++ : o === "O" ? n++ : r++;
216
+ }
217
+ return {
218
+ X: t,
219
+ O: n,
220
+ empty: r
221
+ };
222
+ }
223
+ function u(e) {
224
+ for (let t of r) {
225
+ let n = t.map((t) => e[t.row][t.col]);
226
+ if (n[0] !== "." && n[0] === n[1] && n[1] === n[2]) return {
227
+ winner: n[0],
228
+ winningLine: t
229
+ };
230
+ }
231
+ return {
232
+ winner: null,
233
+ winningLine: null
234
+ };
235
+ }
236
+ function d(e) {
237
+ let { winner: t, winningLine: n } = u(e);
238
+ return t ? {
239
+ isTerminal: !0,
240
+ winner: t,
241
+ winningLine: n
242
+ } : l(e).empty === 0 ? {
243
+ isTerminal: !0,
244
+ winner: "draw",
245
+ winningLine: null
246
+ } : {
247
+ isTerminal: !1,
248
+ winner: null,
249
+ winningLine: null
250
+ };
251
+ }
252
+ function f(e) {
253
+ if (e.action === "new_game") {
254
+ let { playerNames: t } = e, n = i();
255
+ return {
256
+ board: n,
257
+ currentSide: "X",
258
+ playerNames: t,
259
+ legalMoves: s(n),
260
+ counts: l(n),
261
+ isTerminal: !1,
262
+ winner: null,
263
+ winningLine: null,
264
+ lastAction: { type: "new_game" }
265
+ };
266
+ }
267
+ let { row: t, col: n, board: r, currentSide: a, playerNames: u } = e;
268
+ if (t < 0 || t > 2 || n < 0 || n > 2) return {
269
+ board: r,
270
+ currentSide: a,
271
+ playerNames: u,
272
+ legalMoves: s(r),
273
+ counts: l(r),
274
+ isTerminal: !1,
275
+ winner: null,
276
+ winningLine: null,
277
+ lastAction: {
278
+ type: "move",
279
+ row: t,
280
+ col: n
281
+ },
282
+ error: `Invalid move: (${t}, ${n}) is out of bounds. Row and column must be 0-2.`
283
+ };
284
+ if (r[t][n] !== ".") return {
285
+ board: r,
286
+ currentSide: a,
287
+ playerNames: u,
288
+ legalMoves: s(r),
289
+ counts: l(r),
290
+ isTerminal: !1,
291
+ winner: null,
292
+ winningLine: null,
293
+ lastAction: {
294
+ type: "move",
295
+ row: t,
296
+ col: n
297
+ },
298
+ error: `Invalid move: (${t}, ${n}) is already occupied by ${r[t][n]}.`
299
+ };
300
+ let f = c(r, t, n, a), p = o(a), m = s(f), h = l(f), { isTerminal: g, winner: _, winningLine: v } = d(f);
301
+ return {
302
+ board: f,
303
+ currentSide: p,
304
+ playerNames: u,
305
+ legalMoves: m,
306
+ counts: h,
307
+ isTerminal: g,
308
+ winner: _,
309
+ winningLine: v,
310
+ lastAction: {
311
+ type: "move",
312
+ row: t,
313
+ col: n
314
+ }
315
+ };
316
+ }
317
+ //#endregion
318
+ //#region src/core/plugin.ts
319
+ var p = async (e, t) => {
320
+ try {
321
+ let e;
322
+ if (t.action === "new_game") {
323
+ let n;
324
+ n = t.firstPlayer ? t.firstPlayer : Math.random() < .5 ? "computer" : "user", e = {
325
+ action: "new_game",
326
+ playerNames: {
327
+ X: n,
328
+ O: n === "user" ? "computer" : "user"
329
+ }
330
+ };
331
+ } else if (t.action === "move") {
332
+ if (typeof t.row != "number" || typeof t.col != "number" || !t.board || !t.currentSide || !t.playerNames) throw Error("Move action requires row, col, board, currentSide, and playerNames parameters");
333
+ e = {
334
+ action: "move",
335
+ row: t.row,
336
+ col: t.col,
337
+ board: t.board,
338
+ currentSide: t.currentSide,
339
+ playerNames: t.playerNames
340
+ };
341
+ } else throw Error(`Unknown action: ${t.action}`);
342
+ let n = f(e);
343
+ if (n.error) {
344
+ let e = n.playerNames[n.currentSide] === "computer", t = n.legalMoves.map((e) => `(row=${e.row}, col=${e.col})`).join(", "), r = e ? `Invalid move attempted. You must make a valid move. Legal moves are: ${t}. Choose one of these moves.` : `Invalid move attempted. Tell the user they must make a valid move. Legal moves are: ${t}.`;
345
+ return {
346
+ message: n.error,
347
+ jsonData: n,
348
+ instructions: r,
349
+ updating: !0
350
+ };
351
+ }
352
+ let r = "";
353
+ if (n.lastAction.type === "new_game") r = "Started a new Tic-Tac-Toe game! X goes first.";
354
+ else if (n.lastAction.type === "move") {
355
+ let e = m(n.lastAction.row, n.lastAction.col);
356
+ r = `Played ${n.board[n.lastAction.row][n.lastAction.col] === "X" ? "O" : "X"} at ${e} (row=${n.lastAction.row}, col=${n.lastAction.col}).`;
357
+ }
358
+ n.isTerminal && (n.winner === "draw" ? r += " Game over - it's a draw!" : n.winner && (r += ` Game over - ${n.winner} wins!`));
359
+ let i = n.playerNames[n.currentSide] === "computer", a = n.isTerminal ? "The game is over. Briefly announce the result. Do NOT draw the board - the user can see it in the GUI." : i ? "It is your turn. You MUST call playTicTacToe with action='move' immediately. Do NOT describe the board or explain - just make your move." : "It is the user's turn. Do NOT draw or describe the board - the user can see it in the GUI. Just say it's their turn briefly. When they specify a move, call playTicTacToe with action='move'.";
360
+ return {
361
+ message: r,
362
+ jsonData: n,
363
+ instructions: a,
364
+ instructionsRequired: n.isTerminal || i,
365
+ updating: t.action !== "new_game"
366
+ };
367
+ } catch (e) {
368
+ return console.error("ERR: TicTacToe game error", e), {
369
+ message: `TicTacToe game error: ${e instanceof Error ? e.message : "Unknown error"}`,
370
+ instructions: "Acknowledge that there was an error with the TicTacToe game and suggest trying again."
371
+ };
372
+ }
373
+ };
374
+ function m(e, t) {
375
+ return `${[
376
+ "Top",
377
+ "Middle",
378
+ "Bottom"
379
+ ][e]}-${[
380
+ "Left",
381
+ "Center",
382
+ "Right"
383
+ ][t]}`;
384
+ }
385
+ var h = {
386
+ toolDefinition: t,
387
+ execute: p,
388
+ generatingMessage: "Processing TicTacToe move...",
389
+ isEnabled: () => !0,
390
+ systemPrompt: n
391
+ }, g = [{
392
+ name: "New Game (User plays X)",
393
+ args: {
394
+ action: "new_game",
395
+ firstPlayer: "user"
396
+ }
397
+ }, {
398
+ name: "New Game (Computer plays X)",
399
+ args: {
400
+ action: "new_game",
401
+ firstPlayer: "computer"
402
+ }
403
+ }];
404
+ //#endregion
405
+ export { n as a, f as i, p as n, t as o, h as r, e as s, g as t };
package/dist/style.css CHANGED
@@ -1 +1,3 @@
1
- @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-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-400:oklch(70.4% .191 22.216);--color-red-600:oklch(57.7% .245 27.325);--color-yellow-200:oklch(94.5% .129 101.54);--color-yellow-400:oklch(85.2% .199 91.936);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-600:oklch(54.6% .245 262.881);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--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-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-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-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);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--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;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{.mx-auto{margin-inline:auto}.mt-4{margin-top:calc(var(--spacing)*4)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.flex{display:flex}.grid{display:grid}.inline-block{display:inline-block}.h-4{height:calc(var(--spacing)*4)}.h-6{height:calc(var(--spacing)*6)}.h-16{height:calc(var(--spacing)*16)}.h-24{height:calc(var(--spacing)*24)}.h-\[500px\]{height:500px}.h-full{height:100%}.w-4{width:calc(var(--spacing)*4)}.w-6{width:calc(var(--spacing)*6)}.w-16{width:calc(var(--spacing)*16)}.w-24{width:calc(var(--spacing)*24)}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[200px\]{max-width:200px}.cursor-pointer{cursor:pointer}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.gap-0\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}: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)))}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-gray-600{border-color:var(--color-gray-600)}.border-indigo-200{border-color:var(--color-indigo-200)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-600{background-color:var(--color-gray-600)}.bg-gray-700{background-color:var(--color-gray-700)}.bg-gray-800{background-color:var(--color-gray-800)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-white{background-color:var(--color-white)}.bg-yellow-200{background-color:var(--color-yellow-200)}.p-0\.5{padding:calc(var(--spacing)*.5)}.p-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-8{padding:calc(var(--spacing)*8)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-2{padding-block:calc(var(--spacing)*2)}.text-center{text-align:center}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--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)}.text-blue-400{color:var(--color-blue-400)}.text-blue-600{color:var(--color-blue-600)}.text-gray-200{color:var(--color-gray-200)}.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-indigo-700{color:var(--color-indigo-700)}.text-red-400{color:var(--color-red-400)}.text-red-600{color:var(--color-red-600)}.opacity-30{opacity:.3}.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)}.ring-2{--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)}.ring-yellow-400{--tw-ring-color:var(--color-yellow-400)}@media(hover:hover){.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\:bg-indigo-200:hover{background-color:var(--color-indigo-200)}}}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@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}
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-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-400:oklch(70.4% .191 22.216);--color-red-600:oklch(57.7% .245 27.325);--color-yellow-200:oklch(94.5% .129 101.54);--color-yellow-400:oklch(85.2% .199 91.936);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-600:oklch(54.6% .245 262.881);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--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-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-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-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);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--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{.start{inset-inline-start:var(--spacing)}.mx-auto{margin-inline:auto}.mt-4{margin-top:calc(var(--spacing) * 4)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.flex{display:flex}.grid{display:grid}.inline-block{display:inline-block}.h-4{height:calc(var(--spacing) * 4)}.h-6{height:calc(var(--spacing) * 6)}.h-16{height:calc(var(--spacing) * 16)}.h-24{height:calc(var(--spacing) * 24)}.h-\[500px\]{height:500px}.h-full{height:100%}.w-4{width:calc(var(--spacing) * 4)}.w-6{width:calc(var(--spacing) * 6)}.w-16{width:calc(var(--spacing) * 16)}.w-24{width:calc(var(--spacing) * 24)}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[200px\]{max-width:200px}.cursor-pointer{cursor:pointer}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-8{gap:calc(var(--spacing) * 8)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}: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)))}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-gray-600{border-color:var(--color-gray-600)}.border-indigo-200{border-color:var(--color-indigo-200)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-600{background-color:var(--color-gray-600)}.bg-gray-700{background-color:var(--color-gray-700)}.bg-gray-800{background-color:var(--color-gray-800)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-white{background-color:var(--color-white)}.bg-yellow-200{background-color:var(--color-yellow-200)}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-8{padding:calc(var(--spacing) * 8)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-2{padding-block:calc(var(--spacing) * 2)}.text-center{text-align:center}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--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)}.text-blue-400{color:var(--color-blue-400)}.text-blue-600{color:var(--color-blue-600)}.text-gray-200{color:var(--color-gray-200)}.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-indigo-700{color:var(--color-indigo-700)}.text-red-400{color:var(--color-red-400)}.text-red-600{color:var(--color-red-600)}.opacity-30{opacity:.3}.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)}.ring-2{--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)}.ring-yellow-400{--tw-ring-color:var(--color-yellow-400)}@media (hover:hover){.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\:bg-indigo-200:hover{background-color:var(--color-indigo-200)}}}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@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}
3
+ /*$vite$:1*/
package/dist/vue.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("./core.cjs"),e=require("vue"),N={class:"w-full h-full flex flex-col items-center justify-center p-4 bg-gray-100"},T={key:0,class:"flex flex-col items-center"},C={key:0},h={key:1},V={class:"grid grid-cols-3 gap-1 p-2 bg-gray-700 rounded-lg shadow-lg"},b=["onClick","onMouseenter","onMouseleave"],_={key:0,class:"w-16 h-16 text-blue-600",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round"},D={key:1,class:"w-16 h-16 text-red-600",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3"},S={key:1,cx:"12",cy:"12",r:"8"},O={class:"mt-4 flex gap-8 text-lg"},$={class:"flex items-center gap-2"},M={class:"text-gray-500 text-sm"},j={class:"flex items-center gap-2"},L={class:"text-gray-500 text-sm"},w=e.defineComponent({__name:"View",props:{selectedResult:{},sendTextMessage:{type:Function}},setup(a){const u=a,t=e.ref(null),v=e.ref(null);e.watch(()=>u.selectedResult,n=>{n?.toolName==="playTicTacToe"&&n.jsonData&&(t.value=n.jsonData)},{immediate:!0});const f=e.computed(()=>{if(!t.value?.playerNames)return"";const n=t.value.playerNames[t.value.currentSide];return n.charAt(0).toUpperCase()+n.slice(1)}),d=e.computed(()=>t.value?.playerNames&&t.value.playerNames[t.value.currentSide]==="computer"),s=e.computed(()=>t.value?t.value.isTerminal?t.value.winner==="draw"?"text-gray-600":t.value.winner==="X"?"text-blue-600":"text-red-600":t.value.currentSide==="X"?"text-blue-600":"text-red-600":""),c=e.computed(()=>{if(!t.value?.board)return[];const n=[];for(let l=0;l<3;l++)for(let o=0;o<3;o++){const r=t.value.board[l][o],p=t.value.legalMoves?.some(y=>y.row===l&&y.col===o),x=t.value.winningLine?.some(y=>y.row===l&&y.col===o);n.push({row:l,col:o,piece:r!=="."?r:null,isLegalMove:p??!1,isWinningCell:x??!1})}return n});function m(n,l){const o="w-24 h-24 flex items-center justify-center bg-white rounded";let r="";return n.isWinningCell?r="bg-yellow-200 ring-2 ring-yellow-400":n.isLegalMove&&!d.value&&!t.value?.isTerminal&&(r=v.value===l?"bg-gray-200 cursor-pointer":"hover:bg-gray-100 cursor-pointer"),`${o} ${r}`}function g(n){if(!t.value||t.value.isTerminal||d.value)return;const l=c.value[n];if(!l.isLegalMove)return;const o=["top","middle","bottom"],r=["left","center","right"],p=`${o[l.row]}-${r[l.col]}`,x={row:l.row,col:l.col,currentState:t.value};u.sendTextMessage?.(`I want to play at ${p}, which is row=${l.row}, col=${l.col}`,{data:x})}function k(n,l){!t.value||t.value.isTerminal||d.value||!c.value[n].isLegalMove||(v.value=l?n:null)}return(n,l)=>(e.openBlock(),e.createElementBlock("div",N,[t.value?(e.openBlock(),e.createElementBlock("div",T,[l[6]||(l[6]=e.createElementVNode("h1",{class:"text-2xl font-bold text-gray-800 mb-2"},"Tic-Tac-Toe",-1)),e.createElementVNode("div",{class:e.normalizeClass(["text-lg font-semibold mb-4 text-center",s.value])},[t.value.isTerminal?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.value.winner==="draw"?(e.openBlock(),e.createElementBlock("span",C,"It's a Draw!")):(e.openBlock(),e.createElementBlock("span",h,e.toDisplayString(t.value.winner)+" Wins!",1))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(f.value)+"'s Turn ("+e.toDisplayString(t.value.currentSide)+") ",1)],64))],2),e.createElementVNode("div",V,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(o,r)=>(e.openBlock(),e.createElementBlock("div",{key:r,class:e.normalizeClass(m(o,r)),onClick:p=>g(r),onMouseenter:p=>k(r,!0),onMouseleave:p=>k(r,!1)},[o.piece==="X"?(e.openBlock(),e.createElementBlock("svg",_,[...l[0]||(l[0]=[e.createElementVNode("line",{x1:"4",y1:"4",x2:"20",y2:"20"},null,-1),e.createElementVNode("line",{x1:"20",y1:"4",x2:"4",y2:"20"},null,-1)])])):o.piece==="O"?(e.openBlock(),e.createElementBlock("svg",D,[...l[1]||(l[1]=[e.createElementVNode("circle",{cx:"12",cy:"12",r:"8"},null,-1)])])):o.isLegalMove&&!d.value&&v.value===r?(e.openBlock(),e.createElementBlock("svg",{key:2,class:e.normalizeClass(["w-16 h-16 opacity-30",t.value.currentSide==="X"?"text-blue-400":"text-red-400"]),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round"},[t.value.currentSide==="X"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[l[2]||(l[2]=e.createElementVNode("line",{x1:"4",y1:"4",x2:"20",y2:"20"},null,-1)),l[3]||(l[3]=e.createElementVNode("line",{x1:"20",y1:"4",x2:"4",y2:"20"},null,-1))],64)):(e.openBlock(),e.createElementBlock("circle",S))],2)):e.createCommentVNode("",!0)],42,b))),128))]),e.createElementVNode("div",O,[e.createElementVNode("div",$,[l[4]||(l[4]=e.createElementVNode("span",{class:"text-blue-600 font-bold"},"X:",-1)),e.createElementVNode("span",null,e.toDisplayString(t.value.counts.X),1),e.createElementVNode("span",M,"("+e.toDisplayString(t.value.playerNames.X)+")",1)]),e.createElementVNode("div",j,[l[5]||(l[5]=e.createElementVNode("span",{class:"text-red-600 font-bold"},"O:",-1)),e.createElementVNode("span",null,e.toDisplayString(t.value.counts.O),1),e.createElementVNode("span",L,"("+e.toDisplayString(t.value.playerNames.O)+")",1)])])])):e.createCommentVNode("",!0)]))}}),X={class:"p-3 bg-gray-50 rounded"},F={key:0,class:"space-y-2"},P={class:"flex justify-center"},z={class:"inline-block bg-gray-600 p-0.5 rounded"},W={class:"grid grid-cols-3 gap-0.5"},I={key:0,class:"w-4 h-4 text-blue-600",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round"},A={key:1,class:"w-4 h-4 text-red-600",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3"},R={class:"text-xs text-center space-y-1"},q={key:0,class:"text-gray-600"},E=e.defineComponent({__name:"Preview",props:{result:{}},setup(a){const u=a;function t(s,c){return u.result.jsonData?.winningLine?.some(m=>m.row===s&&m.col===c)??!1}function v(s){return s.isTerminal?s.winner==="draw"?"Draw!":s.winner==="X"?"X Wins!":s.winner==="O"?"O Wins!":"Game Over":""}function f(){return u.result.jsonData?.isTerminal?u.result.jsonData.winner==="draw"?"text-gray-600":u.result.jsonData.winner==="X"?"text-blue-600":u.result.jsonData.winner==="O"?"text-red-600":"":""}function d(s){return s.charAt(0).toUpperCase()+s.slice(1)}return(s,c)=>(e.openBlock(),e.createElementBlock("div",X,[a.result.jsonData?(e.openBlock(),e.createElementBlock("div",F,[e.createElementVNode("div",P,[e.createElementVNode("div",z,[e.createElementVNode("div",W,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.result.jsonData.board,(m,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m,(k,n)=>(e.openBlock(),e.createElementBlock("div",{key:`${g}-${n}`,class:e.normalizeClass(["w-6 h-6 flex items-center justify-center bg-white rounded-sm",t(g,n)?"bg-yellow-200":""])},[k==="X"?(e.openBlock(),e.createElementBlock("svg",I,[...c[0]||(c[0]=[e.createElementVNode("line",{x1:"4",y1:"4",x2:"20",y2:"20"},null,-1),e.createElementVNode("line",{x1:"20",y1:"4",x2:"4",y2:"20"},null,-1)])])):k==="O"?(e.openBlock(),e.createElementBlock("svg",A,[...c[1]||(c[1]=[e.createElementVNode("circle",{cx:"12",cy:"12",r:"8"},null,-1)])])):e.createCommentVNode("",!0)],2))),128))],64))),128))])])]),e.createElementVNode("div",R,[a.result.jsonData.isTerminal?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["font-medium",f()])},e.toDisplayString(v(a.result.jsonData)),3)):(e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("span",{class:e.normalizeClass(a.result.jsonData.currentSide==="X"?"text-blue-600":"text-red-600")},e.toDisplayString(a.result.jsonData.currentSide),3),e.createTextVNode(" "+e.toDisplayString(d(a.result.jsonData.playerNames[a.result.jsonData.currentSide]))+" to play ",1)]))])])):e.createCommentVNode("",!0)]))}}),B={...i.pluginCore,viewComponent:w,previewComponent:E,samples:i.samples},G={plugin:B};exports.SYSTEM_PROMPT=i.SYSTEM_PROMPT;exports.TOOL_DEFINITION=i.TOOL_DEFINITION;exports.TOOL_NAME=i.TOOL_NAME;exports.executeTicTacToe=i.executeTicTacToe;exports.playTicTacToe=i.playTicTacToe;exports.pluginCore=i.pluginCore;exports.samples=i.samples;exports.Preview=E;exports.View=w;exports.default=G;exports.plugin=B;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./samples-5nF6v9m_.cjs`);let t=require(`vue`);var n={class:`w-full h-full flex flex-col items-center justify-center p-4 bg-gray-100`},r={key:0,class:`flex flex-col items-center`},i={key:0},a={key:1},o={class:`grid grid-cols-3 gap-1 p-2 bg-gray-700 rounded-lg shadow-lg`},s=[`onClick`,`onMouseenter`,`onMouseleave`],c={key:0,class:`w-16 h-16 text-blue-600`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`},l={key:1,class:`w-16 h-16 text-red-600`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`},u={key:1,cx:`12`,cy:`12`,r:`8`},d={class:`mt-4 flex gap-8 text-lg`},f={class:`flex items-center gap-2`},p={class:`text-gray-500 text-sm`},m={class:`flex items-center gap-2`},h={class:`text-gray-500 text-sm`},g=(0,t.defineComponent)({__name:`View`,props:{selectedResult:{},sendTextMessage:{type:Function}},setup(e){let g=e,_=(0,t.ref)(null),v=(0,t.ref)(null);(0,t.watch)(()=>g.selectedResult,e=>{e?.toolName===`playTicTacToe`&&e.jsonData&&(_.value=e.jsonData)},{immediate:!0});let y=(0,t.computed)(()=>{if(!_.value?.playerNames)return``;let e=_.value.playerNames[_.value.currentSide];return e.charAt(0).toUpperCase()+e.slice(1)}),b=(0,t.computed)(()=>_.value?.playerNames&&_.value.playerNames[_.value.currentSide]===`computer`),x=(0,t.computed)(()=>_.value?_.value.isTerminal?_.value.winner===`draw`?`text-gray-600`:_.value.winner===`X`?`text-blue-600`:`text-red-600`:_.value.currentSide===`X`?`text-blue-600`:`text-red-600`:``),S=(0,t.computed)(()=>{if(!_.value?.board)return[];let e=[];for(let t=0;t<3;t++)for(let n=0;n<3;n++){let r=_.value.board[t][n],i=_.value.legalMoves?.some(e=>e.row===t&&e.col===n),a=_.value.winningLine?.some(e=>e.row===t&&e.col===n);e.push({row:t,col:n,piece:r===`.`?null:r,isLegalMove:i??!1,isWinningCell:a??!1})}return e});function C(e,t){let n=``;return e.isWinningCell?n=`bg-yellow-200 ring-2 ring-yellow-400`:e.isLegalMove&&!b.value&&!_.value?.isTerminal&&(n=v.value===t?`bg-gray-200 cursor-pointer`:`hover:bg-gray-100 cursor-pointer`),`w-24 h-24 flex items-center justify-center bg-white rounded ${n}`}function w(e){if(!_.value||_.value.isTerminal||b.value)return;let t=S.value[e];if(!t.isLegalMove)return;let n=`${[`top`,`middle`,`bottom`][t.row]}-${[`left`,`center`,`right`][t.col]}`,r={row:t.row,col:t.col,currentState:_.value};g.sendTextMessage?.(`I want to play at ${n}, which is row=${t.row}, col=${t.col}`,{data:r})}function T(e,t){!_.value||_.value.isTerminal||b.value||S.value[e].isLegalMove&&(v.value=t?e:null)}return(e,g)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,n,[_.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,r,[g[6]||=(0,t.createElementVNode)(`h1`,{class:`text-2xl font-bold text-gray-800 mb-2`},`Tic-Tac-Toe`,-1),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`text-lg font-semibold mb-4 text-center`,x.value])},[_.value.isTerminal?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[_.value.winner===`draw`?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,i,`It's a Draw!`)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,a,(0,t.toDisplayString)(_.value.winner)+` Wins!`,1))],64)):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createTextVNode)((0,t.toDisplayString)(y.value)+`'s Turn (`+(0,t.toDisplayString)(_.value.currentSide)+`) `,1)],64))],2),(0,t.createElementVNode)(`div`,o,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(S.value,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n,class:(0,t.normalizeClass)(C(e,n)),onClick:e=>w(n),onMouseenter:e=>T(n,!0),onMouseleave:e=>T(n,!1)},[e.piece===`X`?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,c,[...g[0]||=[(0,t.createElementVNode)(`line`,{x1:`4`,y1:`4`,x2:`20`,y2:`20`},null,-1),(0,t.createElementVNode)(`line`,{x1:`20`,y1:`4`,x2:`4`,y2:`20`},null,-1)]])):e.piece===`O`?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,l,[...g[1]||=[(0,t.createElementVNode)(`circle`,{cx:`12`,cy:`12`,r:`8`},null,-1)]])):e.isLegalMove&&!b.value&&v.value===n?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,{key:2,class:(0,t.normalizeClass)([`w-16 h-16 opacity-30`,_.value.currentSide===`X`?`text-blue-400`:`text-red-400`]),viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`},[_.value.currentSide===`X`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[g[2]||=(0,t.createElementVNode)(`line`,{x1:`4`,y1:`4`,x2:`20`,y2:`20`},null,-1),g[3]||=(0,t.createElementVNode)(`line`,{x1:`20`,y1:`4`,x2:`4`,y2:`20`},null,-1)],64)):((0,t.openBlock)(),(0,t.createElementBlock)(`circle`,u))],2)):(0,t.createCommentVNode)(``,!0)],42,s))),128))]),(0,t.createElementVNode)(`div`,d,[(0,t.createElementVNode)(`div`,f,[g[4]||=(0,t.createElementVNode)(`span`,{class:`text-blue-600 font-bold`},`X:`,-1),(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(_.value.counts.X),1),(0,t.createElementVNode)(`span`,p,`(`+(0,t.toDisplayString)(_.value.playerNames.X)+`)`,1)]),(0,t.createElementVNode)(`div`,m,[g[5]||=(0,t.createElementVNode)(`span`,{class:`text-red-600 font-bold`},`O:`,-1),(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(_.value.counts.O),1),(0,t.createElementVNode)(`span`,h,`(`+(0,t.toDisplayString)(_.value.playerNames.O)+`)`,1)])])])):(0,t.createCommentVNode)(``,!0)]))}}),_={class:`p-3 bg-gray-50 rounded`},v={key:0,class:`space-y-2`},y={class:`flex justify-center`},b={class:`inline-block bg-gray-600 p-0.5 rounded`},x={class:`grid grid-cols-3 gap-0.5`},S={key:0,class:`w-4 h-4 text-blue-600`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`},C={key:1,class:`w-4 h-4 text-red-600`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`},w={class:`text-xs text-center space-y-1`},T={key:0,class:`text-gray-600`},E=(0,t.defineComponent)({__name:`Preview`,props:{result:{}},setup(e){let n=e;function r(e,t){return n.result.jsonData?.winningLine?.some(n=>n.row===e&&n.col===t)??!1}function i(e){return e.isTerminal?e.winner===`draw`?`Draw!`:e.winner===`X`?`X Wins!`:e.winner===`O`?`O Wins!`:`Game Over`:``}function a(){return n.result.jsonData?.isTerminal?n.result.jsonData.winner===`draw`?`text-gray-600`:n.result.jsonData.winner===`X`?`text-blue-600`:n.result.jsonData.winner===`O`?`text-red-600`:``:``}function o(e){return e.charAt(0).toUpperCase()+e.slice(1)}return(n,s)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,_,[e.result.jsonData?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,v,[(0,t.createElementVNode)(`div`,y,[(0,t.createElementVNode)(`div`,b,[(0,t.createElementVNode)(`div`,x,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.result.jsonData.board,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:n},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e,(e,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:`${n}-${i}`,class:(0,t.normalizeClass)([`w-6 h-6 flex items-center justify-center bg-white rounded-sm`,r(n,i)?`bg-yellow-200`:``])},[e===`X`?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,S,[...s[0]||=[(0,t.createElementVNode)(`line`,{x1:`4`,y1:`4`,x2:`20`,y2:`20`},null,-1),(0,t.createElementVNode)(`line`,{x1:`20`,y1:`4`,x2:`4`,y2:`20`},null,-1)]])):e===`O`?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,C,[...s[1]||=[(0,t.createElementVNode)(`circle`,{cx:`12`,cy:`12`,r:`8`},null,-1)]])):(0,t.createCommentVNode)(``,!0)],2))),128))],64))),128))])])]),(0,t.createElementVNode)(`div`,w,[e.result.jsonData.isTerminal?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:(0,t.normalizeClass)([`font-medium`,a()])},(0,t.toDisplayString)(i(e.result.jsonData)),3)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,T,[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)(e.result.jsonData.currentSide===`X`?`text-blue-600`:`text-red-600`)},(0,t.toDisplayString)(e.result.jsonData.currentSide),3),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(o(e.result.jsonData.playerNames[e.result.jsonData.currentSide]))+` to play `,1)]))])])):(0,t.createCommentVNode)(``,!0)]))}}),D={...e.r,viewComponent:g,previewComponent:E,samples:e.t},O={plugin:D};exports.Preview=E,exports.SYSTEM_PROMPT=e.a,exports.TOOL_DEFINITION=e.o,exports.TOOL_NAME=e.s,exports.View=g,exports.default=O,exports.executeTicTacToe=e.n,exports.playTicTacToe=e.i,exports.plugin=D,exports.pluginCore=e.r,exports.samples=e.t;