@gui-chat-plugin/othello 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index.cjs");exports.SYSTEM_PROMPT=e.SYSTEM_PROMPT;exports.TOOL_DEFINITION=e.TOOL_DEFINITION;exports.TOOL_NAME=e.TOOL_NAME;exports.executeOthello=e.executeOthello;exports.playOthello=e.playOthello;exports.pluginCore=e.pluginCore;exports.samples=e.samples;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./samples-DLeaq6qU.cjs`);exports.SYSTEM_PROMPT=e.a,exports.TOOL_DEFINITION=e.o,exports.TOOL_NAME=e.s,exports.executeOthello=e.n,exports.playOthello=e.i,exports.pluginCore=e.r,exports.samples=e.t;
package/dist/core.js CHANGED
@@ -1,10 +1,2 @@
1
- import { SYSTEM_PROMPT as l, TOOL_DEFINITION as o, TOOL_NAME as T, executeOthello as p, playOthello as t, pluginCore as r, samples as E } from "./index.js";
2
- export {
3
- l as SYSTEM_PROMPT,
4
- o as TOOL_DEFINITION,
5
- T as TOOL_NAME,
6
- p as executeOthello,
7
- t as playOthello,
8
- r as pluginCore,
9
- E as samples
10
- };
1
+ import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./samples-RIphLQPv.js";
2
+ export { e as SYSTEM_PROMPT, r as TOOL_DEFINITION, a as TOOL_NAME, n as executeOthello, t as playOthello, i as pluginCore, o as samples };
package/dist/index.cjs CHANGED
@@ -1,6 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S="playOthello",B={type:"function",name:S,description:"Play Othello/Reversi game with the user. You can start a new game, make moves, or pass turns.",parameters:{type:"object",properties:{action:{type:"string",enum:["new_game","move","pass"],description:"The action to perform: start a new game, make a move, or pass the turn"},col:{type:"number",description:"Column position for the move (0-7, required for 'move' action). The user will tell you the column by specifying A to H",minimum:0,maximum:7},row:{type:"number",description:"Row position for the move (0-7, required for 'move' action). The user will tell you the row by specifying 1 to 8",minimum:0,maximum:7},board:{type:"array",description:"Current 8x8 board state BEFORE the move (required for 'move' and 'pass' actions). IMPORTANT: Do NOT modify the board yourself - pass the current board state as-is, and the game logic will handle placing the piece and flipping opponent pieces.",items:{type:"array",items:{type:"string",enum:[".","B","W"]}}},currentSide:{type:"string",enum:["B","W"],description:"Current player's side (required for 'move' and 'pass' actions)"},playerNames:{type:"object",description:"Player assignments (required for 'move' and 'pass' actions)",properties:{B:{type:"string",enum:["user","computer"]},W:{type:"string",enum:["user","computer"]}},required:["B","W"]},firstPlayer:{type:"string",enum:["user","computer"],description:"Optional: Which player should play as Black (goes first) for 'new_game' action. If not specified, will be chosen randomly."}},required:["action"],additionalProperties:!1}},P=`You can play Othello/Reversi with users. When a user wants to play:
2
- 1. Start a new game with the "new_game" action
3
- 2. For moves, the user specifies column (A-H) and row (1-8)
4
- 3. Use the "move" action with the current board state
5
- 4. Pass the current board state as-is - the game logic handles piece placement and flipping`,k=[[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]];function $(){const r=[];for(let e=0;e<8;e++)r[e]=new Array(8).fill(".");return r}function C(){const r=$();return r[3][3]="W",r[3][4]="B",r[4][3]="B",r[4][4]="W",r}function x(r){return r.map(e=>[...e])}function O(r,e){return r>=0&&r<8&&e>=0&&e<8}function w(r){return r==="B"?"W":"B"}function R(r,e,o,t,n,a){const i=w(a),s=[];let l=e+t,c=o+n;for(;O(l,c)&&r[l][c]===i;)s.push({row:l,col:c}),l+=t,c+=n;return O(l,c)&&r[l][c]===a&&s.length>0?s:[]}function M(r,e,o,t){if(r[e][o]!==".")return[];const n=[];for(const[a,i]of k){const s=R(r,e,o,a,i,t);n.push(...s)}return n}function A(r,e,o,t){return M(r,e,o,t).length>0}function d(r,e){const o=[];for(let t=0;t<8;t++)for(let n=0;n<8;n++)A(r,t,n,e)&&o.push({row:t,col:n});return o}function q(r,e,o,t){const n=x(r),a=M(r,e,o,t);n[e][o]=t;for(const{row:i,col:s}of a)n[i][s]=t;return{newBoard:n,flippedCount:a.length}}function y(r){let e=0,o=0,t=0;for(let n=0;n<8;n++)for(let a=0;a<8;a++){const i=r[n][a];i==="B"?e++:i==="W"?o++:t++}return{B:e,W:o,empty:t}}function N(r){return r.empty>0?null:r.B>r.W?"B":r.W>r.B?"W":"draw"}function _(r){if(r.action==="new_game"){const{playerNames:u}=r,m=C(),h=d(m,"B"),f=y(m);return{board:m,currentSide:"B",playerNames:u,legalMoves:h,counts:f,isTerminal:!1,winner:null,lastAction:{type:"new_game"}}}if(r.action==="pass"){const{board:u,currentSide:m,playerNames:h}=r,f=w(m),v=d(u,f),b=y(u),T=v.length===0,I=T?N(b):null;return{board:u,currentSide:f,playerNames:h,legalMoves:v,counts:b,isTerminal:T,winner:I,lastAction:{type:"pass"}}}const{row:e,col:o,board:t,currentSide:n,playerNames:a}=r;if(!A(t,e,o,n)){const u=d(t,n),m=y(t);return{board:t,currentSide:n,playerNames:a,legalMoves:u,counts:m,isTerminal:!1,winner:null,lastAction:{type:"pass"},error:`Invalid move: (${e}, ${o}) is not a legal move for ${n}`}}const{newBoard:i,flippedCount:s}=q(t,e,o,n),l=w(n),c=d(i,l),p=y(i),g=c.length===0&&d(i,n).length===0,E=g?N(p):null;return{board:i,currentSide:l,playerNames:a,legalMoves:c,counts:p,isTerminal:g,winner:E,lastAction:{type:"move",row:e,col:o,flipped:s}}}const W=async(r,e)=>{try{let o;if(e.action==="new_game"){let s;e.firstPlayer?s=e.firstPlayer:s=Math.random()<.5?"computer":"user",o={action:"new_game",playerNames:{B:s,W:s==="user"?"computer":"user"}}}else if(e.action==="move"){if(typeof e.row!="number"||typeof e.col!="number"||!e.board||!e.currentSide||!e.playerNames)throw new Error("Move action requires row, col, board, currentSide, and playerNames parameters");o={action:"move",row:e.row,col:e.col,board:e.board,currentSide:e.currentSide,playerNames:e.playerNames}}else if(e.action==="pass"){if(!e.board||!e.currentSide||!e.playerNames)throw new Error("Pass action requires board, currentSide, and playerNames parameters");o={action:"pass",board:e.board,currentSide:e.currentSide,playerNames:e.playerNames}}else throw new Error(`Unknown action: ${e.action}`);const t=_(o);if(t.error){const s=t.playerNames[t.currentSide]==="computer",l=t.legalMoves.map(p=>`(${p.row}, ${p.col})`).join(", "),c=s?`Invalid move attempted. You must make a valid move. Legal moves are: ${l}. Choose one of these moves.`:`Invalid move attempted. Tell the user they must make a valid move. Legal moves are: ${l}. The user will tell you the move by specifying column (A to H) and row (1 to 8).`;return{message:t.error,jsonData:t,instructions:c,updating:!0}}let n="";t.lastAction.type==="new_game"?n="Started a new Othello game! Black (●) goes first.":t.lastAction.type==="move"?n=`Played at (${t.lastAction.row}, ${t.lastAction.col}) and flipped ${t.lastAction.flipped} pieces.`:t.lastAction.type==="pass"&&(n="Passed the turn."),t.isTerminal&&(t.winner==="draw"?n+=" Game over - it's a draw!":t.winner&&(n+=` Game over - ${t.winner==="B"?"Black":"White"} wins!`));const a=t.playerNames[t.currentSide]==="computer",i=t.isTerminal?"The game is over. Announce the game result.":a?"The game state has been updated. Do not describe the state of the game. It is assistant's turn. You MUSK choose your next move.":"The game state has been updated. Tell the user to make a move. Do not describe the state of the game. The user is able to see it. The user will tell you the move by specifying colum (A to H) and row (1 to 8)";return{message:n,jsonData:t,instructions:i,instructionsRequired:t.isTerminal||a,updating:e.action!=="new_game"}}catch(o){return console.error(`ERR: exception
6
- Othello game error`,o),{message:`Othello game error: ${o instanceof Error?o.message:"Unknown error"}`,instructions:"Acknowledge that there was an error with the Othello game and suggest trying again."}}},D={toolDefinition:B,execute:W,generatingMessage:"Processing Othello move...",isEnabled:()=>!0,systemPrompt:P},F=[{name:"New Game (User First)",args:{action:"new_game",firstPlayer:"user"}},{name:"New Game (Computer First)",args:{action:"new_game",firstPlayer:"computer"}}];exports.SYSTEM_PROMPT=P;exports.TOOL_DEFINITION=B;exports.TOOL_NAME=S;exports.executeOthello=W;exports.playOthello=_;exports.pluginCore=D;exports.samples=F;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./samples-DLeaq6qU.cjs`);exports.SYSTEM_PROMPT=e.a,exports.TOOL_DEFINITION=e.o,exports.TOOL_NAME=e.s,exports.executeOthello=e.n,exports.playOthello=e.i,exports.pluginCore=e.r,exports.samples=e.t;
package/dist/index.js CHANGED
@@ -1,291 +1,2 @@
1
- const A = "playOthello", W = {
2
- type: "function",
3
- name: A,
4
- description: "Play Othello/Reversi game with the user. You can start a new game, make moves, or pass turns.",
5
- parameters: {
6
- type: "object",
7
- properties: {
8
- action: {
9
- type: "string",
10
- enum: ["new_game", "move", "pass"],
11
- description: "The action to perform: start a new game, make a move, or pass the turn"
12
- },
13
- col: {
14
- type: "number",
15
- description: "Column position for the move (0-7, required for 'move' action). The user will tell you the column by specifying A to H",
16
- minimum: 0,
17
- maximum: 7
18
- },
19
- row: {
20
- type: "number",
21
- description: "Row position for the move (0-7, required for 'move' action). The user will tell you the row by specifying 1 to 8",
22
- minimum: 0,
23
- maximum: 7
24
- },
25
- board: {
26
- type: "array",
27
- description: "Current 8x8 board state BEFORE the move (required for 'move' and 'pass' actions). IMPORTANT: Do NOT modify the board yourself - pass the current board state as-is, and the game logic will handle placing the piece and flipping opponent pieces.",
28
- items: {
29
- type: "array",
30
- items: {
31
- type: "string",
32
- enum: [".", "B", "W"]
33
- }
34
- }
35
- },
36
- currentSide: {
37
- type: "string",
38
- enum: ["B", "W"],
39
- description: "Current player's side (required for 'move' and 'pass' actions)"
40
- },
41
- playerNames: {
42
- type: "object",
43
- description: "Player assignments (required for 'move' and 'pass' actions)",
44
- properties: {
45
- B: {
46
- type: "string",
47
- enum: ["user", "computer"]
48
- },
49
- W: {
50
- type: "string",
51
- enum: ["user", "computer"]
52
- }
53
- },
54
- required: ["B", "W"]
55
- },
56
- firstPlayer: {
57
- type: "string",
58
- enum: ["user", "computer"],
59
- description: "Optional: Which player should play as Black (goes first) for 'new_game' action. If not specified, will be chosen randomly."
60
- }
61
- },
62
- required: ["action"],
63
- additionalProperties: !1
64
- }
65
- }, _ = `You can play Othello/Reversi with users. When a user wants to play:
66
- 1. Start a new game with the "new_game" action
67
- 2. For moves, the user specifies column (A-H) and row (1-8)
68
- 3. Use the "move" action with the current board state
69
- 4. Pass the current board state as-is - the game logic handles piece placement and flipping`, k = [
70
- [-1, -1],
71
- [-1, 0],
72
- [-1, 1],
73
- [0, -1],
74
- [0, 1],
75
- [1, -1],
76
- [1, 0],
77
- [1, 1]
78
- ];
79
- function E() {
80
- const n = [];
81
- for (let e = 0; e < 8; e++)
82
- n[e] = new Array(8).fill(".");
83
- return n;
84
- }
85
- function I() {
86
- const n = E();
87
- return n[3][3] = "W", n[3][4] = "B", n[4][3] = "B", n[4][4] = "W", n;
88
- }
89
- function $(n) {
90
- return n.map((e) => [...e]);
91
- }
92
- function B(n, e) {
93
- return n >= 0 && n < 8 && e >= 0 && e < 8;
94
- }
95
- function w(n) {
96
- return n === "B" ? "W" : "B";
97
- }
98
- function x(n, e, o, t, r, a) {
99
- const i = w(a), s = [];
100
- let l = e + t, c = o + r;
101
- for (; B(l, c) && n[l][c] === i; )
102
- s.push({ row: l, col: c }), l += t, c += r;
103
- return B(l, c) && n[l][c] === a && s.length > 0 ? s : [];
104
- }
105
- function S(n, e, o, t) {
106
- if (n[e][o] !== ".")
107
- return [];
108
- const r = [];
109
- for (const [a, i] of k) {
110
- const s = x(n, e, o, a, i, t);
111
- r.push(...s);
112
- }
113
- return r;
114
- }
115
- function O(n, e, o, t) {
116
- return S(n, e, o, t).length > 0;
117
- }
118
- function d(n, e) {
119
- const o = [];
120
- for (let t = 0; t < 8; t++)
121
- for (let r = 0; r < 8; r++)
122
- O(n, t, r, e) && o.push({ row: t, col: r });
123
- return o;
124
- }
125
- function C(n, e, o, t) {
126
- const r = $(n), a = S(n, e, o, t);
127
- r[e][o] = t;
128
- for (const { row: i, col: s } of a)
129
- r[i][s] = t;
130
- return { newBoard: r, flippedCount: a.length };
131
- }
132
- function y(n) {
133
- let e = 0, o = 0, t = 0;
134
- for (let r = 0; r < 8; r++)
135
- for (let a = 0; a < 8; a++) {
136
- const i = n[r][a];
137
- i === "B" ? e++ : i === "W" ? o++ : t++;
138
- }
139
- return { B: e, W: o, empty: t };
140
- }
141
- function N(n) {
142
- return n.empty > 0 ? null : n.B > n.W ? "B" : n.W > n.B ? "W" : "draw";
143
- }
144
- function q(n) {
145
- if (n.action === "new_game") {
146
- const { playerNames: u } = n, m = I(), h = d(m, "B"), f = y(m);
147
- return {
148
- board: m,
149
- currentSide: "B",
150
- playerNames: u,
151
- legalMoves: h,
152
- counts: f,
153
- isTerminal: !1,
154
- winner: null,
155
- lastAction: { type: "new_game" }
156
- };
157
- }
158
- if (n.action === "pass") {
159
- const { board: u, currentSide: m, playerNames: h } = n, f = w(m), v = d(u, f), b = y(u), T = v.length === 0, M = T ? N(b) : null;
160
- return {
161
- board: u,
162
- currentSide: f,
163
- playerNames: h,
164
- legalMoves: v,
165
- counts: b,
166
- isTerminal: T,
167
- winner: M,
168
- lastAction: { type: "pass" }
169
- };
170
- }
171
- const { row: e, col: o, board: t, currentSide: r, playerNames: a } = n;
172
- if (!O(t, e, o, r)) {
173
- const u = d(t, r), m = y(t);
174
- return {
175
- board: t,
176
- currentSide: r,
177
- playerNames: a,
178
- legalMoves: u,
179
- counts: m,
180
- isTerminal: !1,
181
- winner: null,
182
- lastAction: { type: "pass" },
183
- // Keep previous action type
184
- error: `Invalid move: (${e}, ${o}) is not a legal move for ${r}`
185
- };
186
- }
187
- const { newBoard: i, flippedCount: s } = C(t, e, o, r), l = w(r), c = d(i, l), p = y(i), g = c.length === 0 && d(i, r).length === 0, P = g ? N(p) : null;
188
- return {
189
- board: i,
190
- currentSide: l,
191
- playerNames: a,
192
- legalMoves: c,
193
- counts: p,
194
- isTerminal: g,
195
- winner: P,
196
- lastAction: { type: "move", row: e, col: o, flipped: s }
197
- };
198
- }
199
- const R = async (n, e) => {
200
- try {
201
- let o;
202
- if (e.action === "new_game") {
203
- let s;
204
- e.firstPlayer ? s = e.firstPlayer : s = Math.random() < 0.5 ? "computer" : "user", o = {
205
- action: "new_game",
206
- playerNames: { B: s, W: s === "user" ? "computer" : "user" }
207
- };
208
- } else if (e.action === "move") {
209
- if (typeof e.row != "number" || typeof e.col != "number" || !e.board || !e.currentSide || !e.playerNames)
210
- throw new Error(
211
- "Move action requires row, col, board, currentSide, and playerNames parameters"
212
- );
213
- o = {
214
- action: "move",
215
- row: e.row,
216
- col: e.col,
217
- board: e.board,
218
- currentSide: e.currentSide,
219
- playerNames: e.playerNames
220
- };
221
- } else if (e.action === "pass") {
222
- if (!e.board || !e.currentSide || !e.playerNames)
223
- throw new Error(
224
- "Pass action requires board, currentSide, and playerNames parameters"
225
- );
226
- o = {
227
- action: "pass",
228
- board: e.board,
229
- currentSide: e.currentSide,
230
- playerNames: e.playerNames
231
- };
232
- } else
233
- throw new Error(`Unknown action: ${e.action}`);
234
- const t = q(o);
235
- if (t.error) {
236
- const s = t.playerNames[t.currentSide] === "computer", l = t.legalMoves.map((p) => `(${p.row}, ${p.col})`).join(", "), c = s ? `Invalid move attempted. You must make a valid move. Legal moves are: ${l}. Choose one of these moves.` : `Invalid move attempted. Tell the user they must make a valid move. Legal moves are: ${l}. The user will tell you the move by specifying column (A to H) and row (1 to 8).`;
237
- return {
238
- message: t.error,
239
- jsonData: t,
240
- instructions: c,
241
- updating: !0
242
- };
243
- }
244
- let r = "";
245
- t.lastAction.type === "new_game" ? r = "Started a new Othello game! Black (●) goes first." : t.lastAction.type === "move" ? r = `Played at (${t.lastAction.row}, ${t.lastAction.col}) and flipped ${t.lastAction.flipped} pieces.` : t.lastAction.type === "pass" && (r = "Passed the turn."), t.isTerminal && (t.winner === "draw" ? r += " Game over - it's a draw!" : t.winner && (r += ` Game over - ${t.winner === "B" ? "Black" : "White"} wins!`));
246
- const a = t.playerNames[t.currentSide] === "computer", i = t.isTerminal ? "The game is over. Announce the game result." : a ? "The game state has been updated. Do not describe the state of the game. It is assistant's turn. You MUSK choose your next move." : "The game state has been updated. Tell the user to make a move. Do not describe the state of the game. The user is able to see it. The user will tell you the move by specifying colum (A to H) and row (1 to 8)";
247
- return {
248
- message: r,
249
- jsonData: t,
250
- instructions: i,
251
- instructionsRequired: t.isTerminal || a,
252
- updating: e.action !== "new_game"
253
- };
254
- } catch (o) {
255
- return console.error(`ERR: exception
256
- Othello game error`, o), {
257
- message: `Othello game error: ${o instanceof Error ? o.message : "Unknown error"}`,
258
- instructions: "Acknowledge that there was an error with the Othello game and suggest trying again."
259
- };
260
- }
261
- }, D = {
262
- toolDefinition: W,
263
- execute: R,
264
- generatingMessage: "Processing Othello move...",
265
- isEnabled: () => !0,
266
- systemPrompt: _
267
- }, F = [
268
- {
269
- name: "New Game (User First)",
270
- args: {
271
- action: "new_game",
272
- firstPlayer: "user"
273
- }
274
- },
275
- {
276
- name: "New Game (Computer First)",
277
- args: {
278
- action: "new_game",
279
- firstPlayer: "computer"
280
- }
281
- }
282
- ];
283
- export {
284
- _ as SYSTEM_PROMPT,
285
- W as TOOL_DEFINITION,
286
- A as TOOL_NAME,
287
- R as executeOthello,
288
- q as playOthello,
289
- D as pluginCore,
290
- F as samples
291
- };
1
+ import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./samples-RIphLQPv.js";
2
+ export { e as SYSTEM_PROMPT, r as TOOL_DEFINITION, a as TOOL_NAME, n as executeOthello, t as playOthello, i as pluginCore, o as samples };
@@ -0,0 +1,6 @@
1
+ var e=`playOthello`,t={type:`function`,name:e,description:`Play Othello/Reversi game with the user. You can start a new game, make moves, or pass turns.`,parameters:{type:`object`,properties:{action:{type:`string`,enum:[`new_game`,`move`,`pass`],description:`The action to perform: start a new game, make a move, or pass the turn`},col:{type:`number`,description:`Column position for the move (0-7, required for 'move' action). The user will tell you the column by specifying A to H`,minimum:0,maximum:7},row:{type:`number`,description:`Row position for the move (0-7, required for 'move' action). The user will tell you the row by specifying 1 to 8`,minimum:0,maximum:7},board:{type:`array`,description:`Current 8x8 board state BEFORE the move (required for 'move' and 'pass' actions). IMPORTANT: Do NOT modify the board yourself - pass the current board state as-is, and the game logic will handle placing the piece and flipping opponent pieces.`,items:{type:`array`,items:{type:`string`,enum:[`.`,`B`,`W`]}}},currentSide:{type:`string`,enum:[`B`,`W`],description:`Current player's side (required for 'move' and 'pass' actions)`},playerNames:{type:`object`,description:`Player assignments (required for 'move' and 'pass' actions)`,properties:{B:{type:`string`,enum:[`user`,`computer`]},W:{type:`string`,enum:[`user`,`computer`]}},required:[`B`,`W`]},firstPlayer:{type:`string`,enum:[`user`,`computer`],description:`Optional: Which player should play as Black (goes first) for 'new_game' action. If not specified, will be chosen randomly.`}},required:[`action`],additionalProperties:!1}},n=`You can play Othello/Reversi with users. When a user wants to play:
2
+ 1. Start a new game with the "new_game" action
3
+ 2. For moves, the user specifies column (A-H) and row (1-8)
4
+ 3. Use the "move" action with the current board state
5
+ 4. Pass the current board state as-is - the game logic handles piece placement and flipping`,r=[[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]];function i(){let e=[];for(let t=0;t<8;t++)e[t]=Array(8).fill(`.`);return e}function a(){let e=i();return e[3][3]=`W`,e[3][4]=`B`,e[4][3]=`B`,e[4][4]=`W`,e}function o(e){return e.map(e=>[...e])}function s(e,t){return e>=0&&e<8&&t>=0&&t<8}function c(e){return e===`B`?`W`:`B`}function l(e,t,n,r,i,a){let o=c(a),l=[],u=t+r,d=n+i;for(;s(u,d)&&e[u][d]===o;)l.push({row:u,col:d}),u+=r,d+=i;return s(u,d)&&e[u][d]===a&&l.length>0?l:[]}function u(e,t,n,i){if(e[t][n]!==`.`)return[];let a=[];for(let[o,s]of r){let r=l(e,t,n,o,s,i);a.push(...r)}return a}function d(e,t,n,r){return u(e,t,n,r).length>0}function f(e,t){let n=[];for(let r=0;r<8;r++)for(let i=0;i<8;i++)d(e,r,i,t)&&n.push({row:r,col:i});return n}function p(e,t,n,r){let i=o(e),a=u(e,t,n,r);i[t][n]=r;for(let{row:e,col:t}of a)i[e][t]=r;return{newBoard:i,flippedCount:a.length}}function m(e){let t=0,n=0,r=0;for(let i=0;i<8;i++)for(let a=0;a<8;a++){let o=e[i][a];o===`B`?t++:o===`W`?n++:r++}return{B:t,W:n,empty:r}}function h(e){return e.empty>0?null:e.B>e.W?`B`:e.W>e.B?`W`:`draw`}function g(e){if(e.action===`new_game`){let{playerNames:t}=e,n=a();return{board:n,currentSide:`B`,playerNames:t,legalMoves:f(n,`B`),counts:m(n),isTerminal:!1,winner:null,lastAction:{type:`new_game`}}}if(e.action===`pass`){let{board:t,currentSide:n,playerNames:r}=e,i=c(n),a=f(t,i),o=m(t),s=a.length===0;return{board:t,currentSide:i,playerNames:r,legalMoves:a,counts:o,isTerminal:s,winner:s?h(o):null,lastAction:{type:`pass`}}}let{row:t,col:n,board:r,currentSide:i,playerNames:o}=e;if(!d(r,t,n,i))return{board:r,currentSide:i,playerNames:o,legalMoves:f(r,i),counts:m(r),isTerminal:!1,winner:null,lastAction:{type:`pass`},error:`Invalid move: (${t}, ${n}) is not a legal move for ${i}`};let{newBoard:s,flippedCount:l}=p(r,t,n,i),u=c(i),g=f(s,u),_=m(s),v=g.length===0&&f(s,i).length===0;return{board:s,currentSide:u,playerNames:o,legalMoves:g,counts:_,isTerminal:v,winner:v?h(_):null,lastAction:{type:`move`,row:t,col:n,flipped:l}}}var _=async(e,t)=>{try{let e;if(t.action===`new_game`){let n;n=t.firstPlayer?t.firstPlayer:Math.random()<.5?`computer`:`user`,e={action:`new_game`,playerNames:{B:n,W:n===`user`?`computer`:`user`}}}else if(t.action===`move`){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`);e={action:`move`,row:t.row,col:t.col,board:t.board,currentSide:t.currentSide,playerNames:t.playerNames}}else if(t.action===`pass`){if(!t.board||!t.currentSide||!t.playerNames)throw Error(`Pass action requires board, currentSide, and playerNames parameters`);e={action:`pass`,board:t.board,currentSide:t.currentSide,playerNames:t.playerNames}}else throw Error(`Unknown action: ${t.action}`);let n=g(e);if(n.error){let e=n.playerNames[n.currentSide]===`computer`,t=n.legalMoves.map(e=>`(${e.row}, ${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}. The user will tell you the move by specifying column (A to H) and row (1 to 8).`;return{message:n.error,jsonData:n,instructions:r,updating:!0}}let r=``;n.lastAction.type===`new_game`?r=`Started a new Othello game! Black (●) goes first.`:n.lastAction.type===`move`?r=`Played at (${n.lastAction.row}, ${n.lastAction.col}) and flipped ${n.lastAction.flipped} pieces.`:n.lastAction.type===`pass`&&(r=`Passed the turn.`),n.isTerminal&&(n.winner===`draw`?r+=` Game over - it's a draw!`:n.winner&&(r+=` Game over - ${n.winner===`B`?`Black`:`White`} wins!`));let i=n.playerNames[n.currentSide]===`computer`,a=n.isTerminal?`The game is over. Announce the game result.`:i?`The game state has been updated. Do not describe the state of the game. It is assistant's turn. You MUSK choose your next move.`:`The game state has been updated. Tell the user to make a move. Do not describe the state of the game. The user is able to see it. The user will tell you the move by specifying colum (A to H) and row (1 to 8)`;return{message:r,jsonData:n,instructions:a,instructionsRequired:n.isTerminal||i,updating:t.action!==`new_game`}}catch(e){return console.error(`ERR: exception
6
+ Othello game error`,e),{message:`Othello game error: ${e instanceof Error?e.message:`Unknown error`}`,instructions:`Acknowledge that there was an error with the Othello game and suggest trying again.`}}},v={toolDefinition:t,execute:_,generatingMessage:`Processing Othello move...`,isEnabled:()=>!0,systemPrompt:n},y=[{name:`New Game (User First)`,args:{action:`new_game`,firstPlayer:`user`}},{name:`New Game (Computer First)`,args:{action:`new_game`,firstPlayer:`computer`}}];Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return y}});
@@ -0,0 +1,289 @@
1
+ //#region src/core/definition.ts
2
+ var e = "playOthello", t = {
3
+ type: "function",
4
+ name: e,
5
+ description: "Play Othello/Reversi game with the user. You can start a new game, make moves, or pass turns.",
6
+ parameters: {
7
+ type: "object",
8
+ properties: {
9
+ action: {
10
+ type: "string",
11
+ enum: [
12
+ "new_game",
13
+ "move",
14
+ "pass"
15
+ ],
16
+ description: "The action to perform: start a new game, make a move, or pass the turn"
17
+ },
18
+ col: {
19
+ type: "number",
20
+ description: "Column position for the move (0-7, required for 'move' action). The user will tell you the column by specifying A to H",
21
+ minimum: 0,
22
+ maximum: 7
23
+ },
24
+ row: {
25
+ type: "number",
26
+ description: "Row position for the move (0-7, required for 'move' action). The user will tell you the row by specifying 1 to 8",
27
+ minimum: 0,
28
+ maximum: 7
29
+ },
30
+ board: {
31
+ type: "array",
32
+ description: "Current 8x8 board state BEFORE the move (required for 'move' and 'pass' actions). IMPORTANT: Do NOT modify the board yourself - pass the current board state as-is, and the game logic will handle placing the piece and flipping opponent pieces.",
33
+ items: {
34
+ type: "array",
35
+ items: {
36
+ type: "string",
37
+ enum: [
38
+ ".",
39
+ "B",
40
+ "W"
41
+ ]
42
+ }
43
+ }
44
+ },
45
+ currentSide: {
46
+ type: "string",
47
+ enum: ["B", "W"],
48
+ description: "Current player's side (required for 'move' and 'pass' actions)"
49
+ },
50
+ playerNames: {
51
+ type: "object",
52
+ description: "Player assignments (required for 'move' and 'pass' actions)",
53
+ properties: {
54
+ B: {
55
+ type: "string",
56
+ enum: ["user", "computer"]
57
+ },
58
+ W: {
59
+ type: "string",
60
+ enum: ["user", "computer"]
61
+ }
62
+ },
63
+ required: ["B", "W"]
64
+ },
65
+ firstPlayer: {
66
+ type: "string",
67
+ enum: ["user", "computer"],
68
+ description: "Optional: Which player should play as Black (goes first) for 'new_game' action. If not specified, will be chosen randomly."
69
+ }
70
+ },
71
+ required: ["action"],
72
+ additionalProperties: !1
73
+ }
74
+ }, n = "You can play Othello/Reversi with users. When a user wants to play:\n1. Start a new game with the \"new_game\" action\n2. For moves, the user specifies column (A-H) and row (1-8)\n3. Use the \"move\" action with the current board state\n4. Pass the current board state as-is - the game logic handles piece placement and flipping", r = [
75
+ [-1, -1],
76
+ [-1, 0],
77
+ [-1, 1],
78
+ [0, -1],
79
+ [0, 1],
80
+ [1, -1],
81
+ [1, 0],
82
+ [1, 1]
83
+ ];
84
+ function i() {
85
+ let e = [];
86
+ for (let t = 0; t < 8; t++) e[t] = Array(8).fill(".");
87
+ return e;
88
+ }
89
+ function a() {
90
+ let e = i();
91
+ return e[3][3] = "W", e[3][4] = "B", e[4][3] = "B", e[4][4] = "W", e;
92
+ }
93
+ function o(e) {
94
+ return e.map((e) => [...e]);
95
+ }
96
+ function s(e, t) {
97
+ return e >= 0 && e < 8 && t >= 0 && t < 8;
98
+ }
99
+ function c(e) {
100
+ return e === "B" ? "W" : "B";
101
+ }
102
+ function l(e, t, n, r, i, a) {
103
+ let o = c(a), l = [], u = t + r, d = n + i;
104
+ for (; s(u, d) && e[u][d] === o;) l.push({
105
+ row: u,
106
+ col: d
107
+ }), u += r, d += i;
108
+ return s(u, d) && e[u][d] === a && l.length > 0 ? l : [];
109
+ }
110
+ function u(e, t, n, i) {
111
+ if (e[t][n] !== ".") return [];
112
+ let a = [];
113
+ for (let [o, s] of r) {
114
+ let r = l(e, t, n, o, s, i);
115
+ a.push(...r);
116
+ }
117
+ return a;
118
+ }
119
+ function d(e, t, n, r) {
120
+ return u(e, t, n, r).length > 0;
121
+ }
122
+ function f(e, t) {
123
+ let n = [];
124
+ for (let r = 0; r < 8; r++) for (let i = 0; i < 8; i++) d(e, r, i, t) && n.push({
125
+ row: r,
126
+ col: i
127
+ });
128
+ return n;
129
+ }
130
+ function p(e, t, n, r) {
131
+ let i = o(e), a = u(e, t, n, r);
132
+ i[t][n] = r;
133
+ for (let { row: e, col: t } of a) i[e][t] = r;
134
+ return {
135
+ newBoard: i,
136
+ flippedCount: a.length
137
+ };
138
+ }
139
+ function m(e) {
140
+ let t = 0, n = 0, r = 0;
141
+ for (let i = 0; i < 8; i++) for (let a = 0; a < 8; a++) {
142
+ let o = e[i][a];
143
+ o === "B" ? t++ : o === "W" ? n++ : r++;
144
+ }
145
+ return {
146
+ B: t,
147
+ W: n,
148
+ empty: r
149
+ };
150
+ }
151
+ function h(e) {
152
+ return e.empty > 0 ? null : e.B > e.W ? "B" : e.W > e.B ? "W" : "draw";
153
+ }
154
+ function g(e) {
155
+ if (e.action === "new_game") {
156
+ let { playerNames: t } = e, n = a();
157
+ return {
158
+ board: n,
159
+ currentSide: "B",
160
+ playerNames: t,
161
+ legalMoves: f(n, "B"),
162
+ counts: m(n),
163
+ isTerminal: !1,
164
+ winner: null,
165
+ lastAction: { type: "new_game" }
166
+ };
167
+ }
168
+ if (e.action === "pass") {
169
+ let { board: t, currentSide: n, playerNames: r } = e, i = c(n), a = f(t, i), o = m(t), s = a.length === 0;
170
+ return {
171
+ board: t,
172
+ currentSide: i,
173
+ playerNames: r,
174
+ legalMoves: a,
175
+ counts: o,
176
+ isTerminal: s,
177
+ winner: s ? h(o) : null,
178
+ lastAction: { type: "pass" }
179
+ };
180
+ }
181
+ let { row: t, col: n, board: r, currentSide: i, playerNames: o } = e;
182
+ if (!d(r, t, n, i)) return {
183
+ board: r,
184
+ currentSide: i,
185
+ playerNames: o,
186
+ legalMoves: f(r, i),
187
+ counts: m(r),
188
+ isTerminal: !1,
189
+ winner: null,
190
+ lastAction: { type: "pass" },
191
+ error: `Invalid move: (${t}, ${n}) is not a legal move for ${i}`
192
+ };
193
+ let { newBoard: s, flippedCount: l } = p(r, t, n, i), u = c(i), g = f(s, u), _ = m(s), v = g.length === 0 && f(s, i).length === 0;
194
+ return {
195
+ board: s,
196
+ currentSide: u,
197
+ playerNames: o,
198
+ legalMoves: g,
199
+ counts: _,
200
+ isTerminal: v,
201
+ winner: v ? h(_) : null,
202
+ lastAction: {
203
+ type: "move",
204
+ row: t,
205
+ col: n,
206
+ flipped: l
207
+ }
208
+ };
209
+ }
210
+ //#endregion
211
+ //#region src/core/plugin.ts
212
+ var _ = async (e, t) => {
213
+ try {
214
+ let e;
215
+ if (t.action === "new_game") {
216
+ let n;
217
+ n = t.firstPlayer ? t.firstPlayer : Math.random() < .5 ? "computer" : "user", e = {
218
+ action: "new_game",
219
+ playerNames: {
220
+ B: n,
221
+ W: n === "user" ? "computer" : "user"
222
+ }
223
+ };
224
+ } else if (t.action === "move") {
225
+ 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");
226
+ e = {
227
+ action: "move",
228
+ row: t.row,
229
+ col: t.col,
230
+ board: t.board,
231
+ currentSide: t.currentSide,
232
+ playerNames: t.playerNames
233
+ };
234
+ } else if (t.action === "pass") {
235
+ if (!t.board || !t.currentSide || !t.playerNames) throw Error("Pass action requires board, currentSide, and playerNames parameters");
236
+ e = {
237
+ action: "pass",
238
+ board: t.board,
239
+ currentSide: t.currentSide,
240
+ playerNames: t.playerNames
241
+ };
242
+ } else throw Error(`Unknown action: ${t.action}`);
243
+ let n = g(e);
244
+ if (n.error) {
245
+ let e = n.playerNames[n.currentSide] === "computer", t = n.legalMoves.map((e) => `(${e.row}, ${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}. The user will tell you the move by specifying column (A to H) and row (1 to 8).`;
246
+ return {
247
+ message: n.error,
248
+ jsonData: n,
249
+ instructions: r,
250
+ updating: !0
251
+ };
252
+ }
253
+ let r = "";
254
+ n.lastAction.type === "new_game" ? r = "Started a new Othello game! Black (●) goes first." : n.lastAction.type === "move" ? r = `Played at (${n.lastAction.row}, ${n.lastAction.col}) and flipped ${n.lastAction.flipped} pieces.` : n.lastAction.type === "pass" && (r = "Passed the turn."), n.isTerminal && (n.winner === "draw" ? r += " Game over - it's a draw!" : n.winner && (r += ` Game over - ${n.winner === "B" ? "Black" : "White"} wins!`));
255
+ let i = n.playerNames[n.currentSide] === "computer", a = n.isTerminal ? "The game is over. Announce the game result." : i ? "The game state has been updated. Do not describe the state of the game. It is assistant's turn. You MUSK choose your next move." : "The game state has been updated. Tell the user to make a move. Do not describe the state of the game. The user is able to see it. The user will tell you the move by specifying colum (A to H) and row (1 to 8)";
256
+ return {
257
+ message: r,
258
+ jsonData: n,
259
+ instructions: a,
260
+ instructionsRequired: n.isTerminal || i,
261
+ updating: t.action !== "new_game"
262
+ };
263
+ } catch (e) {
264
+ return console.error("ERR: exception\n Othello game error", e), {
265
+ message: `Othello game error: ${e instanceof Error ? e.message : "Unknown error"}`,
266
+ instructions: "Acknowledge that there was an error with the Othello game and suggest trying again."
267
+ };
268
+ }
269
+ }, v = {
270
+ toolDefinition: t,
271
+ execute: _,
272
+ generatingMessage: "Processing Othello move...",
273
+ isEnabled: () => !0,
274
+ systemPrompt: n
275
+ }, y = [{
276
+ name: "New Game (User First)",
277
+ args: {
278
+ action: "new_game",
279
+ firstPlayer: "user"
280
+ }
281
+ }, {
282
+ name: "New Game (Computer First)",
283
+ args: {
284
+ action: "new_game",
285
+ firstPlayer: "computer"
286
+ }
287
+ }];
288
+ //#endregion
289
+ export { n as a, g as i, _ as n, t as o, v as r, e as s, y 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-green-50:oklch(98.2% .018 155.826);--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-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-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-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-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-bold:700;--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}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.contents{display:contents}.flex{display:flex}.grid{display:grid}.inline-block{display:inline-block}.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-\[500px\]{height:500px}.h-full{height:100%}.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-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[200px\]{max-width:200px}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.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-center{justify-content:center}.gap-0\.5{gap:calc(var(--spacing)*.5)}.gap-2{gap:calc(var(--spacing)*2)}: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)))}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-gray-600{border-color:var(--color-gray-600)}.border-green-900{border-color:var(--color-green-900)}.border-indigo-200{border-color:var(--color-indigo-200)}.bg-black{background-color:var(--color-black)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-800{background-color:var(--color-gray-800)}.bg-green-50{background-color:var(--color-green-50)}.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-white{background-color:var(--color-white)}.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)}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.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-white{color:var(--color-white)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}@media(hover:hover){.hover\:bg-green-600:hover{background-color:var(--color-green-600)}.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-green-50:oklch(98.2% .018 155.826);--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-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-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-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-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-bold:700;--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)}.end{inset-inline-end:var(--spacing)}.mx-auto{margin-inline:auto}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.contents{display:contents}.flex{display:flex}.grid{display:grid}.inline-block{display:inline-block}.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-\[500px\]{height:500px}.h-full{height:100%}.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-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[200px\]{max-width:200px}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.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-center{justify-content:center}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-2{gap:calc(var(--spacing) * 2)}: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)))}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-gray-600{border-color:var(--color-gray-600)}.border-green-900{border-color:var(--color-green-900)}.border-indigo-200{border-color:var(--color-indigo-200)}.bg-black{background-color:var(--color-black)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-800{background-color:var(--color-gray-800)}.bg-green-50{background-color:var(--color-green-50)}.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-white{background-color:var(--color-white)}.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)}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.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-white{color:var(--color-white)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}@media (hover:hover){.hover\:bg-green-600:hover{background-color:var(--color-green-600)}.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("./index.cjs"),e=require("vue"),C={class:"w-full h-full flex flex-col items-center justify-center p-4"},w={key:0,class:"flex flex-col items-center"},E={class:"text-white text-lg font-bold mb-4 text-center"},N={class:"grid grid-cols-8 gap-0.5 p-4 bg-green-800 rounded-lg border-2 border-green-900"},M=["onClick","onMouseenter","onMouseleave"],x={key:1,class:"w-10 h-10 flex items-center justify-center text-gray-300 text-sm font-bold"},h=e.defineComponent({__name:"View",props:{selectedResult:{},sendTextMessage:{type:Function}},setup(a){const m=a,t=e.ref(null),s=e.ref(null);e.watch(()=>m.selectedResult,l=>{l?.toolName==="playOthello"&&l.jsonData&&(t.value=l.jsonData)},{immediate:!0});const g=e.computed(()=>{if(!t.value?.playerNames)return"";const l=t.value.playerNames[t.value.currentSide];return l.charAt(0).toUpperCase()+l.slice(1)}),v=e.computed(()=>t.value?t.value.currentSide==="B"?"Black":"White":""),u=e.computed(()=>t.value?.playerNames&&t.value.playerNames[t.value.currentSide]==="computer"),d=e.computed(()=>{if(!t.value?.board)return[];const l=[];for(let o=0;o<8;o++)for(let r=0;r<8;r++){const n=t.value.board[o][r],c=t.value.legalMoves?.some(k=>k.row===o&&k.col===r);l.push({row:o,col:r,piece:n!=="."?n:null,isLegalMove:c??!1,label:c?String.fromCharCode(65+r)+(o+1):""})}return l});function p(l,o){const r="w-12 h-12 flex items-center justify-center border border-green-900 bg-green-700",n=l.isLegalMove&&!u.value&&s.value===o?"bg-green-600":"",c=l.isLegalMove&&!u.value&&!t.value?.isTerminal?"cursor-pointer hover:bg-green-600":"cursor-default";return`${r} ${n} ${c}`}function _(l){return l==="B"?"bg-black":"bg-white"}function b(l){if(!t.value||t.value.isTerminal||u.value)return;const o=d.value[l];if(!o.isLegalMove)return;const r=String.fromCharCode(65+o.col),n=o.row+1,c={row:o.row,col:o.col,currentState:t.value};m.sendTextMessage(`I want to play at ${r}${n}, which is column=${o.col}, row=${o.row} `,{data:c})}function f(l,o){!t.value||t.value.isTerminal||u.value||!d.value[l].isLegalMove||(s.value=o?l:null)}return(l,o)=>(e.openBlock(),e.createElementBlock("div",C,[t.value?(e.openBlock(),e.createElementBlock("div",w,[e.createElementVNode("div",E," Current Turn: "+e.toDisplayString(g.value)+" ("+e.toDisplayString(v.value)+") ",1),e.createElementVNode("div",N,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(r,n)=>(e.openBlock(),e.createElementBlock("div",{key:n,class:e.normalizeClass(p(r,n)),onClick:c=>b(n),onMouseenter:c=>f(n,!0),onMouseleave:c=>f(n,!1)},[r.piece?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([_(r.piece),"w-10 h-10 rounded-full border-2 border-gray-600"])},null,2)):r.isLegalMove&&!u.value?(e.openBlock(),e.createElementBlock("div",x,e.toDisplayString(r.label),1)):e.createCommentVNode("",!0)],42,M))),128))])])):e.createCommentVNode("",!0)]))}}),T={class:"p-3 bg-green-50 rounded"},$={key:0,class:"space-y-1"},D={class:"flex justify-center"},O={class:"inline-block",style:{"background-color":"#2d5016",padding:"1px"}},S={class:"grid grid-cols-8",style:{gap:"1px"}},j={key:0,class:"w-3 h-3 bg-black rounded-full"},L={key:1,class:"w-3 h-3 bg-white rounded-full"},V={class:"text-xs text-center space-y-1"},P={key:0,class:"text-gray-600"},F={key:1,class:"font-medium"},y=e.defineComponent({__name:"Preview",props:{result:{}},setup(a){function m(s){return s.isTerminal?s.winner==="draw"?"Draw!":s.winner==="B"?"⚫ Black Wins!":s.winner==="W"?"⚪ White Wins!":"Game Over":""}function t(s){return s.charAt(0).toUpperCase()+s.slice(1)}return(s,g)=>(e.openBlock(),e.createElementBlock("div",T,[a.result.jsonData?(e.openBlock(),e.createElementBlock("div",$,[e.createElementVNode("div",D,[e.createElementVNode("div",O,[e.createElementVNode("div",S,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.result.jsonData.board,(v,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:u},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v,(d,p)=>(e.openBlock(),e.createElementBlock("div",{key:`${u}-${p}`,class:"w-4 h-4 flex items-center justify-center",style:{"background-color":"#3d6b20"}},[d==="B"?(e.openBlock(),e.createElementBlock("div",j)):d==="W"?(e.openBlock(),e.createElementBlock("div",L)):e.createCommentVNode("",!0)]))),128))],64))),128))])])]),e.createElementVNode("div",V,[a.result.jsonData.isTerminal?(e.openBlock(),e.createElementBlock("div",F,e.toDisplayString(m(a.result.jsonData)),1)):(e.openBlock(),e.createElementBlock("div",P,e.toDisplayString(a.result.jsonData.currentSide==="B"?"⚫":"⚪")+" "+e.toDisplayString(t(a.result.jsonData.playerNames[a.result.jsonData.currentSide]))+" to play ",1))])])):e.createCommentVNode("",!0)]))}}),B={...i.pluginCore,viewComponent:h,previewComponent:y,samples:i.samples},I={plugin:B};exports.SYSTEM_PROMPT=i.SYSTEM_PROMPT;exports.TOOL_DEFINITION=i.TOOL_DEFINITION;exports.TOOL_NAME=i.TOOL_NAME;exports.executeOthello=i.executeOthello;exports.playOthello=i.playOthello;exports.pluginCore=i.pluginCore;exports.samples=i.samples;exports.Preview=y;exports.View=h;exports.default=I;exports.plugin=B;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./samples-DLeaq6qU.cjs`);let t=require(`vue`);var n={class:`w-full h-full flex flex-col items-center justify-center p-4`},r={key:0,class:`flex flex-col items-center`},i={class:`text-white text-lg font-bold mb-4 text-center`},a={class:`grid grid-cols-8 gap-0.5 p-4 bg-green-800 rounded-lg border-2 border-green-900`},o=[`onClick`,`onMouseenter`,`onMouseleave`],s={key:1,class:`w-10 h-10 flex items-center justify-center text-gray-300 text-sm font-bold`},c=(0,t.defineComponent)({__name:`View`,props:{selectedResult:{},sendTextMessage:{type:Function}},setup(e){let c=e,l=(0,t.ref)(null),u=(0,t.ref)(null);(0,t.watch)(()=>c.selectedResult,e=>{e?.toolName===`playOthello`&&e.jsonData&&(l.value=e.jsonData)},{immediate:!0});let d=(0,t.computed)(()=>{if(!l.value?.playerNames)return``;let e=l.value.playerNames[l.value.currentSide];return e.charAt(0).toUpperCase()+e.slice(1)}),f=(0,t.computed)(()=>l.value?l.value.currentSide===`B`?`Black`:`White`:``),p=(0,t.computed)(()=>l.value?.playerNames&&l.value.playerNames[l.value.currentSide]===`computer`),m=(0,t.computed)(()=>{if(!l.value?.board)return[];let e=[];for(let t=0;t<8;t++)for(let n=0;n<8;n++){let r=l.value.board[t][n],i=l.value.legalMoves?.some(e=>e.row===t&&e.col===n);e.push({row:t,col:n,piece:r===`.`?null:r,isLegalMove:i??!1,label:i?String.fromCharCode(65+n)+(t+1):``})}return e});function h(e,t){return`w-12 h-12 flex items-center justify-center border border-green-900 bg-green-700 ${e.isLegalMove&&!p.value&&u.value===t?`bg-green-600`:``} ${e.isLegalMove&&!p.value&&!l.value?.isTerminal?`cursor-pointer hover:bg-green-600`:`cursor-default`}`}function g(e){return e===`B`?`bg-black`:`bg-white`}function _(e){if(!l.value||l.value.isTerminal||p.value)return;let t=m.value[e];if(!t.isLegalMove)return;let n=String.fromCharCode(65+t.col),r=t.row+1,i={row:t.row,col:t.col,currentState:l.value};c.sendTextMessage(`I want to play at ${n}${r}, which is column=${t.col}, row=${t.row} `,{data:i})}function v(e,t){!l.value||l.value.isTerminal||p.value||m.value[e].isLegalMove&&(u.value=t?e:null)}return(e,c)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,n,[l.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,r,[(0,t.createElementVNode)(`div`,i,` Current Turn: `+(0,t.toDisplayString)(d.value)+` (`+(0,t.toDisplayString)(f.value)+`) `,1),(0,t.createElementVNode)(`div`,a,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(m.value,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n,class:(0,t.normalizeClass)(h(e,n)),onClick:e=>_(n),onMouseenter:e=>v(n,!0),onMouseleave:e=>v(n,!1)},[e.piece?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([g(e.piece),`w-10 h-10 rounded-full border-2 border-gray-600`])},null,2)):e.isLegalMove&&!p.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,s,(0,t.toDisplayString)(e.label),1)):(0,t.createCommentVNode)(``,!0)],42,o))),128))])])):(0,t.createCommentVNode)(``,!0)]))}}),l={class:`p-3 bg-green-50 rounded`},u={key:0,class:`space-y-1`},d={class:`flex justify-center`},f={class:`inline-block`,style:{"background-color":`#2d5016`,padding:`1px`}},p={class:`grid grid-cols-8`,style:{gap:`1px`}},m={key:0,class:`w-3 h-3 bg-black rounded-full`},h={key:1,class:`w-3 h-3 bg-white rounded-full`},g={class:`text-xs text-center space-y-1`},_={key:0,class:`text-gray-600`},v={key:1,class:`font-medium`},y=(0,t.defineComponent)({__name:`Preview`,props:{result:{}},setup(e){function n(e){return e.isTerminal?e.winner===`draw`?`Draw!`:e.winner===`B`?`⚫ Black Wins!`:e.winner===`W`?`⚪ White Wins!`:`Game Over`:``}function r(e){return e.charAt(0).toUpperCase()+e.slice(1)}return(i,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,l,[e.result.jsonData?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,u,[(0,t.createElementVNode)(`div`,d,[(0,t.createElementVNode)(`div`,f,[(0,t.createElementVNode)(`div`,p,[((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,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:`${n}-${r}`,class:`w-4 h-4 flex items-center justify-center`,style:{"background-color":`#3d6b20`}},[e===`B`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,m)):e===`W`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,h)):(0,t.createCommentVNode)(``,!0)]))),128))],64))),128))])])]),(0,t.createElementVNode)(`div`,g,[e.result.jsonData.isTerminal?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,v,(0,t.toDisplayString)(n(e.result.jsonData)),1)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,_,(0,t.toDisplayString)(e.result.jsonData.currentSide===`B`?`⚫`:`⚪`)+` `+(0,t.toDisplayString)(r(e.result.jsonData.playerNames[e.result.jsonData.currentSide]))+` to play `,1))])])):(0,t.createCommentVNode)(``,!0)]))}}),b={...e.r,viewComponent:c,previewComponent:y,samples:e.t},x={plugin:b};exports.Preview=y,exports.SYSTEM_PROMPT=e.a,exports.TOOL_DEFINITION=e.o,exports.TOOL_NAME=e.s,exports.View=c,exports.default=x,exports.executeOthello=e.n,exports.playOthello=e.i,exports.plugin=b,exports.pluginCore=e.r,exports.samples=e.t;
package/dist/vue.js CHANGED
@@ -1,168 +1,122 @@
1
- import { samples as T, pluginCore as D } from "./index.js";
2
- import { SYSTEM_PROMPT as re, TOOL_DEFINITION as se, TOOL_NAME as le, executeOthello as ne, playOthello as oe } from "./index.js";
3
- import { defineComponent as M, ref as x, watch as L, computed as g, createElementBlock as l, openBlock as n, createCommentVNode as p, createElementVNode as v, toDisplayString as f, Fragment as h, renderList as b, normalizeClass as $ } from "vue";
4
- const B = { class: "w-full h-full flex flex-col items-center justify-center p-4" }, O = {
5
- key: 0,
6
- class: "flex flex-col items-center"
7
- }, S = { class: "text-white text-lg font-bold mb-4 text-center" }, P = { class: "grid grid-cols-8 gap-0.5 p-4 bg-green-800 rounded-lg border-2 border-green-900" }, W = ["onClick", "onMouseenter", "onMouseleave"], E = {
8
- key: 1,
9
- class: "w-10 h-10 flex items-center justify-center text-gray-300 text-sm font-bold"
10
- }, V = /* @__PURE__ */ M({
11
- __name: "View",
12
- props: {
13
- selectedResult: {},
14
- sendTextMessage: { type: Function }
15
- },
16
- setup(c) {
17
- const m = c, e = x(null), a = x(null);
18
- L(
19
- () => m.selectedResult,
20
- (t) => {
21
- t?.toolName === "playOthello" && t.jsonData && (e.value = t.jsonData);
22
- },
23
- { immediate: !0 }
24
- );
25
- const w = g(() => {
26
- if (!e.value?.playerNames) return "";
27
- const t = e.value.playerNames[e.value.currentSide];
28
- return t.charAt(0).toUpperCase() + t.slice(1);
29
- }), y = g(() => e.value ? e.value.currentSide === "B" ? "Black" : "White" : ""), i = g(() => e.value?.playerNames && e.value.playerNames[e.value.currentSide] === "computer"), d = g(() => {
30
- if (!e.value?.board) return [];
31
- const t = [];
32
- for (let r = 0; r < 8; r++)
33
- for (let s = 0; s < 8; s++) {
34
- const o = e.value.board[r][s], u = e.value.legalMoves?.some(
35
- (k) => k.row === r && k.col === s
36
- );
37
- t.push({
38
- row: r,
39
- col: s,
40
- piece: o !== "." ? o : null,
41
- isLegalMove: u ?? !1,
42
- label: u ? String.fromCharCode(65 + s) + (r + 1) : ""
43
- });
44
- }
45
- return t;
46
- });
47
- function _(t, r) {
48
- const s = "w-12 h-12 flex items-center justify-center border border-green-900 bg-green-700", o = t.isLegalMove && !i.value && a.value === r ? "bg-green-600" : "", u = t.isLegalMove && !i.value && !e.value?.isTerminal ? "cursor-pointer hover:bg-green-600" : "cursor-default";
49
- return `${s} ${o} ${u}`;
50
- }
51
- function j(t) {
52
- return t === "B" ? "bg-black" : "bg-white";
53
- }
54
- function N(t) {
55
- if (!e.value || e.value.isTerminal || i.value)
56
- return;
57
- const r = d.value[t];
58
- if (!r.isLegalMove) return;
59
- const s = String.fromCharCode(65 + r.col), o = r.row + 1, u = {
60
- row: r.row,
61
- col: r.col,
62
- currentState: e.value
63
- };
64
- m.sendTextMessage(
65
- `I want to play at ${s}${o}, which is column=${r.col}, row=${r.row} `,
66
- { data: u }
67
- );
68
- }
69
- function C(t, r) {
70
- !e.value || e.value.isTerminal || i.value || !d.value[t].isLegalMove || (a.value = r ? t : null);
71
- }
72
- return (t, r) => (n(), l("div", B, [
73
- e.value ? (n(), l("div", O, [
74
- v("div", S, " Current Turn: " + f(w.value) + " (" + f(y.value) + ") ", 1),
75
- v("div", P, [
76
- (n(!0), l(h, null, b(d.value, (s, o) => (n(), l("div", {
77
- key: o,
78
- class: $(_(s, o)),
79
- onClick: (u) => N(o),
80
- onMouseenter: (u) => C(o, !0),
81
- onMouseleave: (u) => C(o, !1)
82
- }, [
83
- s.piece ? (n(), l("div", {
84
- key: 0,
85
- class: $([j(s.piece), "w-10 h-10 rounded-full border-2 border-gray-600"])
86
- }, null, 2)) : s.isLegalMove && !i.value ? (n(), l("div", E, f(s.label), 1)) : p("", !0)
87
- ], 42, W))), 128))
88
- ])
89
- ])) : p("", !0)
90
- ]));
91
- }
92
- }), F = { class: "p-3 bg-green-50 rounded" }, A = {
93
- key: 0,
94
- class: "space-y-1"
95
- }, I = { class: "flex justify-center" }, z = {
96
- class: "inline-block",
97
- style: { "background-color": "#2d5016", padding: "1px" }
98
- }, G = {
99
- class: "grid grid-cols-8",
100
- style: { gap: "1px" }
101
- }, R = {
102
- key: 0,
103
- class: "w-3 h-3 bg-black rounded-full"
104
- }, U = {
105
- key: 1,
106
- class: "w-3 h-3 bg-white rounded-full"
107
- }, H = { class: "text-xs text-center space-y-1" }, Y = {
108
- key: 0,
109
- class: "text-gray-600"
110
- }, q = {
111
- key: 1,
112
- class: "font-medium"
113
- }, J = /* @__PURE__ */ M({
114
- __name: "Preview",
115
- props: {
116
- result: {}
117
- },
118
- setup(c) {
119
- function m(a) {
120
- return a.isTerminal ? a.winner === "draw" ? "Draw!" : a.winner === "B" ? "⚫ Black Wins!" : a.winner === "W" ? "⚪ White Wins!" : "Game Over" : "";
121
- }
122
- function e(a) {
123
- return a.charAt(0).toUpperCase() + a.slice(1);
124
- }
125
- return (a, w) => (n(), l("div", F, [
126
- c.result.jsonData ? (n(), l("div", A, [
127
- v("div", I, [
128
- v("div", z, [
129
- v("div", G, [
130
- (n(!0), l(h, null, b(c.result.jsonData.board, (y, i) => (n(), l(h, { key: i }, [
131
- (n(!0), l(h, null, b(y, (d, _) => (n(), l("div", {
132
- key: `${i}-${_}`,
133
- class: "w-4 h-4 flex items-center justify-center",
134
- style: { "background-color": "#3d6b20" }
135
- }, [
136
- d === "B" ? (n(), l("div", R)) : d === "W" ? (n(), l("div", U)) : p("", !0)
137
- ]))), 128))
138
- ], 64))), 128))
139
- ])
140
- ])
141
- ]),
142
- v("div", H, [
143
- c.result.jsonData.isTerminal ? (n(), l("div", q, f(m(c.result.jsonData)), 1)) : (n(), l("div", Y, f(c.result.jsonData.currentSide === "B" ? "⚫" : "⚪") + " " + f(e(
144
- c.result.jsonData.playerNames[c.result.jsonData.currentSide]
145
- )) + " to play ", 1))
146
- ])
147
- ])) : p("", !0)
148
- ]));
149
- }
150
- }), K = {
151
- ...D,
152
- viewComponent: V,
153
- previewComponent: J,
154
- samples: T
155
- }, Z = { plugin: K };
156
- export {
157
- J as Preview,
158
- re as SYSTEM_PROMPT,
159
- se as TOOL_DEFINITION,
160
- le as TOOL_NAME,
161
- V as View,
162
- Z as default,
163
- ne as executeOthello,
164
- oe as playOthello,
165
- K as plugin,
166
- D as pluginCore,
167
- T as samples
168
- };
1
+ import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./samples-RIphLQPv.js";
2
+ import { Fragment as s, computed as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, defineComponent as f, normalizeClass as p, openBlock as m, ref as h, renderList as g, toDisplayString as _, watch as v } from "vue";
3
+ //#region src/vue/View.vue?vue&type=script&setup=true&lang.ts
4
+ var y = { class: "w-full h-full flex flex-col items-center justify-center p-4" }, b = {
5
+ key: 0,
6
+ class: "flex flex-col items-center"
7
+ }, x = { class: "text-white text-lg font-bold mb-4 text-center" }, S = { class: "grid grid-cols-8 gap-0.5 p-4 bg-green-800 rounded-lg border-2 border-green-900" }, C = [
8
+ "onClick",
9
+ "onMouseenter",
10
+ "onMouseleave"
11
+ ], w = {
12
+ key: 1,
13
+ class: "w-10 h-10 flex items-center justify-center text-gray-300 text-sm font-bold"
14
+ }, T = /* @__PURE__ */ f({
15
+ __name: "View",
16
+ props: {
17
+ selectedResult: {},
18
+ sendTextMessage: { type: Function }
19
+ },
20
+ setup(e) {
21
+ let t = e, n = h(null), r = h(null);
22
+ v(() => t.selectedResult, (e) => {
23
+ e?.toolName === "playOthello" && e.jsonData && (n.value = e.jsonData);
24
+ }, { immediate: !0 });
25
+ let i = c(() => {
26
+ if (!n.value?.playerNames) return "";
27
+ let e = n.value.playerNames[n.value.currentSide];
28
+ return e.charAt(0).toUpperCase() + e.slice(1);
29
+ }), a = c(() => n.value ? n.value.currentSide === "B" ? "Black" : "White" : ""), o = c(() => n.value?.playerNames && n.value.playerNames[n.value.currentSide] === "computer"), f = c(() => {
30
+ if (!n.value?.board) return [];
31
+ let e = [];
32
+ for (let t = 0; t < 8; t++) for (let r = 0; r < 8; r++) {
33
+ let i = n.value.board[t][r], a = n.value.legalMoves?.some((e) => e.row === t && e.col === r);
34
+ e.push({
35
+ row: t,
36
+ col: r,
37
+ piece: i === "." ? null : i,
38
+ isLegalMove: a ?? !1,
39
+ label: a ? String.fromCharCode(65 + r) + (t + 1) : ""
40
+ });
41
+ }
42
+ return e;
43
+ });
44
+ function T(e, t) {
45
+ return `w-12 h-12 flex items-center justify-center border border-green-900 bg-green-700 ${e.isLegalMove && !o.value && r.value === t ? "bg-green-600" : ""} ${e.isLegalMove && !o.value && !n.value?.isTerminal ? "cursor-pointer hover:bg-green-600" : "cursor-default"}`;
46
+ }
47
+ function E(e) {
48
+ return e === "B" ? "bg-black" : "bg-white";
49
+ }
50
+ function D(e) {
51
+ if (!n.value || n.value.isTerminal || o.value) return;
52
+ let r = f.value[e];
53
+ if (!r.isLegalMove) return;
54
+ let i = String.fromCharCode(65 + r.col), a = r.row + 1, s = {
55
+ row: r.row,
56
+ col: r.col,
57
+ currentState: n.value
58
+ };
59
+ t.sendTextMessage(`I want to play at ${i}${a}, which is column=${r.col}, row=${r.row} `, { data: s });
60
+ }
61
+ function O(e, t) {
62
+ !n.value || n.value.isTerminal || o.value || f.value[e].isLegalMove && (r.value = t ? e : null);
63
+ }
64
+ return (e, t) => (m(), u("div", y, [n.value ? (m(), u("div", b, [d("div", x, " Current Turn: " + _(i.value) + " (" + _(a.value) + ") ", 1), d("div", S, [(m(!0), u(s, null, g(f.value, (e, t) => (m(), u("div", {
65
+ key: t,
66
+ class: p(T(e, t)),
67
+ onClick: (e) => D(t),
68
+ onMouseenter: (e) => O(t, !0),
69
+ onMouseleave: (e) => O(t, !1)
70
+ }, [e.piece ? (m(), u("div", {
71
+ key: 0,
72
+ class: p([E(e.piece), "w-10 h-10 rounded-full border-2 border-gray-600"])
73
+ }, null, 2)) : e.isLegalMove && !o.value ? (m(), u("div", w, _(e.label), 1)) : l("", !0)], 42, C))), 128))])])) : l("", !0)]));
74
+ }
75
+ }), E = { class: "p-3 bg-green-50 rounded" }, D = {
76
+ key: 0,
77
+ class: "space-y-1"
78
+ }, O = { class: "flex justify-center" }, k = {
79
+ class: "inline-block",
80
+ style: {
81
+ "background-color": "#2d5016",
82
+ padding: "1px"
83
+ }
84
+ }, A = {
85
+ class: "grid grid-cols-8",
86
+ style: { gap: "1px" }
87
+ }, j = {
88
+ key: 0,
89
+ class: "w-3 h-3 bg-black rounded-full"
90
+ }, M = {
91
+ key: 1,
92
+ class: "w-3 h-3 bg-white rounded-full"
93
+ }, N = { class: "text-xs text-center space-y-1" }, P = {
94
+ key: 0,
95
+ class: "text-gray-600"
96
+ }, F = {
97
+ key: 1,
98
+ class: "font-medium"
99
+ }, I = /* @__PURE__ */ f({
100
+ __name: "Preview",
101
+ props: { result: {} },
102
+ setup(e) {
103
+ function t(e) {
104
+ return e.isTerminal ? e.winner === "draw" ? "Draw!" : e.winner === "B" ? "⚫ Black Wins!" : e.winner === "W" ? "⚪ White Wins!" : "Game Over" : "";
105
+ }
106
+ function n(e) {
107
+ return e.charAt(0).toUpperCase() + e.slice(1);
108
+ }
109
+ return (r, i) => (m(), u("div", E, [e.result.jsonData ? (m(), u("div", D, [d("div", O, [d("div", k, [d("div", A, [(m(!0), u(s, null, g(e.result.jsonData.board, (e, t) => (m(), u(s, { key: t }, [(m(!0), u(s, null, g(e, (e, n) => (m(), u("div", {
110
+ key: `${t}-${n}`,
111
+ class: "w-4 h-4 flex items-center justify-center",
112
+ style: { "background-color": "#3d6b20" }
113
+ }, [e === "B" ? (m(), u("div", j)) : e === "W" ? (m(), u("div", M)) : l("", !0)]))), 128))], 64))), 128))])])]), d("div", N, [e.result.jsonData.isTerminal ? (m(), u("div", F, _(t(e.result.jsonData)), 1)) : (m(), u("div", P, _(e.result.jsonData.currentSide === "B" ? "⚫" : "⚪") + " " + _(n(e.result.jsonData.playerNames[e.result.jsonData.currentSide])) + " to play ", 1))])])) : l("", !0)]));
114
+ }
115
+ }), L = {
116
+ ...i,
117
+ viewComponent: T,
118
+ previewComponent: I,
119
+ samples: o
120
+ }, R = { plugin: L };
121
+ //#endregion
122
+ export { I as Preview, e as SYSTEM_PROMPT, r as TOOL_DEFINITION, a as TOOL_NAME, T as View, R as default, n as executeOthello, t as playOthello, L as plugin, i as pluginCore, o as samples };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gui-chat-plugin/othello",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Othello/Reversi game plugin for GUI Chat",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -34,24 +34,25 @@
34
34
  "lint": "eslint src demo"
35
35
  },
36
36
  "peerDependencies": {
37
- "gui-chat-protocol": "^0.0.1",
37
+ "gui-chat-protocol": "^0.1.0",
38
38
  "vue": "^3.5.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@tailwindcss/vite": "^4.1.18",
42
- "@typescript-eslint/eslint-plugin": "^8.53.0",
43
- "@typescript-eslint/parser": "^8.53.0",
44
- "@vitejs/plugin-vue": "^6.0.3",
45
- "eslint": "^9.39.2",
46
- "eslint-plugin-vue": "^10.6.2",
47
- "globals": "^17.0.0",
48
- "gui-chat-protocol": "^0.0.2",
49
- "tailwindcss": "^4.1.18",
50
- "typescript": "~5.9.3",
51
- "vite": "^7.3.1",
52
- "vue": "^3.5.27",
53
- "vue-eslint-parser": "^10.2.0",
54
- "vue-tsc": "^3.2.2"
41
+ "@eslint/js": "^10.0.1",
42
+ "@tailwindcss/vite": "^4.2.2",
43
+ "@typescript-eslint/eslint-plugin": "^8.58.0",
44
+ "@typescript-eslint/parser": "^8.58.0",
45
+ "@vitejs/plugin-vue": "^6.0.5",
46
+ "eslint": "^10.1.0",
47
+ "eslint-plugin-vue": "^10.8.0",
48
+ "globals": "^17.4.0",
49
+ "gui-chat-protocol": "^0.1.0",
50
+ "tailwindcss": "^4.2.2",
51
+ "typescript": "~6.0.2",
52
+ "vite": "^8.0.3",
53
+ "vue": "^3.5.31",
54
+ "vue-eslint-parser": "^10.4.0",
55
+ "vue-tsc": "^3.2.6"
55
56
  },
56
57
  "keywords": [
57
58
  "guichat",