@gui-chat-plugin/go 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @gui-chat-plugin/go
2
2
 
3
+ [![npm version](https://badge.fury.io/js/%40gui-chat-plugin%2Fgo.svg)](https://www.npmjs.com/package/@gui-chat-plugin/go)
4
+
3
5
  Go (Baduk/Weiqi) game plugin for GUI Chat applications. Play Go on a 9x9 board against an AI assistant.
4
6
 
5
7
  ## Features
@@ -105,6 +107,14 @@ yarn build
105
107
  yarn lint
106
108
  ```
107
109
 
110
+ ## Test Prompts
111
+
112
+ Try these prompts to test the plugin:
113
+
114
+ 1. "Let's play Go! I'll take black"
115
+ 2. "Start a new Go game, you play first"
116
+ 3. "Place my stone at position E5"
117
+
108
118
  ## License
109
119
 
110
120
  MIT
@@ -90,3 +90,11 @@ export interface GoState {
90
90
  };
91
91
  error?: string;
92
92
  }
93
+ /**
94
+ * Data passed from handleCellClick for testing/debugging
95
+ */
96
+ export interface GoClickData {
97
+ row: number;
98
+ col: number;
99
+ currentState: GoState;
100
+ }
@@ -1,8 +1,8 @@
1
- import type { ToolResult } from "gui-chat-protocol/vue";
1
+ import type { ToolResult, SendTextMessageOptions } from "gui-chat-protocol/vue";
2
2
  import type { GoState } from "../core/types";
3
3
  type __VLS_Props = {
4
4
  selectedResult: ToolResult<never, GoState> | null;
5
- sendTextMessage: (text?: string) => void;
5
+ sendTextMessage: (text?: string, options?: SendTextMessageOptions) => void;
6
6
  };
7
7
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
8
  declare const _default: typeof __VLS_export;
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"),E={class:"w-full h-full flex flex-col items-center justify-center p-4"},N={key:0,class:"flex flex-col items-center"},x={class:"text-white text-lg font-bold mb-2 text-center"},C={class:"text-white text-sm mb-4 text-center"},w={class:"relative p-4 bg-amber-100 rounded-lg border-2 border-amber-900"},V={class:"grid gap-0",style:{gridTemplateColumns:"repeat(9, 1fr)",width:"432px",height:"432px"}},S=["onClick","onMouseenter","onMouseleave"],$={class:"absolute inset-0 pointer-events-none"},D={key:0,class:"absolute left-1/2 top-1/2 w-0.5 bg-black",style:{height:"48px",transform:"translateX(-50%)"}},j={key:1,class:"absolute left-1/2 top-1/2 h-0.5 bg-black",style:{width:"48px",transform:"translateY(-50%)"}},T={key:0,class:"absolute inset-0 flex items-center justify-center pointer-events-none"},M={key:1,class:"absolute inset-0 flex items-center justify-center pointer-events-none"},O={key:2,class:"absolute inset-0 flex items-center justify-center pointer-events-none"},P={class:"absolute -bottom-6 left-4 right-4 flex justify-around"},F={class:"absolute -left-6 top-4 bottom-4 flex flex-col justify-around"},h=e.defineComponent({__name:"View",props:{selectedResult:{},sendTextMessage:{type:Function}},setup(a){const m=a,o=e.ref(null),p=e.ref(null),r=["A","B","C","D","E","F","G","H","J"];e.watch(()=>m.selectedResult,l=>{l?.toolName==="playGo"&&l.jsonData&&(o.value=l.jsonData)},{immediate:!0});const v=e.computed(()=>{if(!o.value?.playerNames)return"";const l=o.value.playerNames[o.value.currentSide];return l.charAt(0).toUpperCase()+l.slice(1)}),k=e.computed(()=>o.value?o.value.currentSide==="B"?"Black":"White":""),c=e.computed(()=>o.value?.playerNames&&o.value.playerNames[o.value.currentSide]==="computer"),u=e.computed(()=>{if(!o.value?.board)return[];const l=[];for(let n=0;n<9;n++)for(let t=0;t<9;t++){const s=o.value.board[n][t];l.push({row:n,col:t,piece:s!=="."?s:null})}return l});function d(l,n){return[[2,2],[2,6],[4,4],[6,2],[6,6]].some(([s,f])=>s===l&&f===n)}function _(l){const n="relative w-12 h-12",t=!l.piece&&!c.value&&!o.value?.isTerminal?"cursor-pointer":"cursor-default";return`${n} ${t}`}function g(l){if(!o.value||o.value.isTerminal||c.value)return;const n=u.value[l];if(n.piece)return;const t=r[n.col],s=n.row+1;m.sendTextMessage(`I want to play at ${t}${s}, which is column=${n.col}, row=${n.row}`)}function y(l,n){!o.value||o.value.isTerminal||c.value||u.value[l].piece||(p.value=n?l:null)}return(l,n)=>(e.openBlock(),e.createElementBlock("div",E,[o.value?(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("div",x," Current Turn: "+e.toDisplayString(v.value)+" ("+e.toDisplayString(k.value)+") ",1),e.createElementVNode("div",C," Captured - Black: "+e.toDisplayString(o.value.capturedStones.B)+", White: "+e.toDisplayString(o.value.capturedStones.W),1),e.createElementVNode("div",w,[e.createElementVNode("div",V,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(t,s)=>(e.openBlock(),e.createElementBlock("div",{key:s,class:e.normalizeClass(_(t)),onClick:f=>g(s),onMouseenter:f=>y(s,!0),onMouseleave:f=>y(s,!1)},[e.createElementVNode("div",$,[t.row<8?(e.openBlock(),e.createElementBlock("div",D)):e.createCommentVNode("",!0),t.col<8?(e.openBlock(),e.createElementBlock("div",j)):e.createCommentVNode("",!0)]),d(t.row,t.col)?(e.openBlock(),e.createElementBlock("div",T,[...n[0]||(n[0]=[e.createElementVNode("div",{class:"w-2 h-2 bg-black rounded-full"},null,-1)])])):e.createCommentVNode("",!0),t.piece?(e.openBlock(),e.createElementBlock("div",M,[e.createElementVNode("div",{class:e.normalizeClass(["w-10 h-10 rounded-full border-2",t.piece==="B"?"bg-black border-gray-700":"bg-white border-gray-300"])},null,2)])):!c.value&&p.value===s?(e.openBlock(),e.createElementBlock("div",O,[e.createElementVNode("div",{class:e.normalizeClass(["w-10 h-10 rounded-full opacity-50",o.value.currentSide==="B"?"bg-black":"bg-white"])},null,2)])):e.createCommentVNode("",!0)],42,S))),128))]),e.createElementVNode("div",P,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(r,t=>e.createElementVNode("div",{key:t,class:"text-xs font-bold text-white w-12 text-center"},e.toDisplayString(t),1)),64))]),e.createElementVNode("div",F,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(9,t=>e.createElementVNode("div",{key:t,class:"text-xs font-bold text-white h-12 flex items-center justify-center"},e.toDisplayString(t),1)),64))])])])):e.createCommentVNode("",!0)]))}}),L={class:"p-3 bg-amber-50 rounded"},W={key:0,class:"space-y-1"},G={class:"flex justify-center"},z={class:"inline-block relative",style:{"background-color":"#d4a574",padding:"4px"}},A={class:"grid grid-cols-9",style:{gap:"0px"}},Y={key:0,class:"absolute left-1/2 top-1/2 w-px bg-black",style:{height:"12px",transform:"translateX(-50%)"}},R={key:1,class:"absolute left-1/2 top-1/2 h-px bg-black",style:{width:"12px",transform:"translateY(-50%)"}},q={key:2,class:"absolute w-1 h-1 bg-black rounded-full",style:{"z-index":"1"}},H={key:3,class:"w-2.5 h-2.5 bg-black rounded-full relative",style:{"z-index":"2"}},I={key:4,class:"w-2.5 h-2.5 bg-white rounded-full border border-gray-300 relative",style:{"z-index":"2"}},U={class:"text-xs text-center space-y-1"},X={key:0,class:"text-gray-600"},J={key:1,class:"font-medium"},K={class:"text-gray-500 text-xs"},b=e.defineComponent({__name:"Preview",props:{result:{}},setup(a){function m(r,v){return[[2,2],[2,6],[4,4],[6,2],[6,6]].some(([c,u])=>c===r&&u===v)}function o(r){return r.isTerminal?r.winner==="draw"?"Draw!":r.winner==="B"?"⚫ Black Wins!":r.winner==="W"?"⚪ White Wins!":"Game Over":""}function p(r){return r.charAt(0).toUpperCase()+r.slice(1)}return(r,v)=>(e.openBlock(),e.createElementBlock("div",L,[a.result.jsonData?(e.openBlock(),e.createElementBlock("div",W,[e.createElementVNode("div",G,[e.createElementVNode("div",z,[e.createElementVNode("div",A,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.result.jsonData.board,(k,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:c},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k,(u,d)=>(e.openBlock(),e.createElementBlock("div",{key:`${c}-${d}`,class:"w-3 h-3 flex items-center justify-center relative"},[Number(c)<8?(e.openBlock(),e.createElementBlock("div",Y)):e.createCommentVNode("",!0),Number(d)<8?(e.openBlock(),e.createElementBlock("div",R)):e.createCommentVNode("",!0),m(Number(c),Number(d))?(e.openBlock(),e.createElementBlock("div",q)):e.createCommentVNode("",!0),u==="B"?(e.openBlock(),e.createElementBlock("div",H)):u==="W"?(e.openBlock(),e.createElementBlock("div",I)):e.createCommentVNode("",!0)]))),128))],64))),128))])])]),e.createElementVNode("div",U,[a.result.jsonData.isTerminal?(e.openBlock(),e.createElementBlock("div",J,e.toDisplayString(o(a.result.jsonData)),1)):(e.openBlock(),e.createElementBlock("div",X,e.toDisplayString(a.result.jsonData.currentSide==="B"?"⚫":"⚪")+" "+e.toDisplayString(p(a.result.jsonData.playerNames[a.result.jsonData.currentSide]))+" to play ",1)),e.createElementVNode("div",K," Captured: ⚫"+e.toDisplayString(a.result.jsonData.capturedStones.B)+" ⚪"+e.toDisplayString(a.result.jsonData.capturedStones.W),1)])])):e.createCommentVNode("",!0)]))}}),B={...i.pluginCore,viewComponent:h,previewComponent:b,samples:i.samples},Q={plugin:B};exports.SYSTEM_PROMPT=i.SYSTEM_PROMPT;exports.TOOL_DEFINITION=i.TOOL_DEFINITION;exports.TOOL_NAME=i.TOOL_NAME;exports.executeGo=i.executeGo;exports.playGo=i.playGo;exports.pluginCore=i.pluginCore;exports.samples=i.samples;exports.Preview=b;exports.View=h;exports.default=Q;exports.plugin=B;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("./index.cjs"),e=require("vue"),E={class:"w-full h-full flex flex-col items-center justify-center p-4"},N={key:0,class:"flex flex-col items-center"},x={class:"text-white text-lg font-bold mb-2 text-center"},w={class:"text-white text-sm mb-4 text-center"},C={class:"relative p-4 bg-amber-100 rounded-lg border-2 border-amber-900"},V={class:"grid gap-0",style:{gridTemplateColumns:"repeat(9, 1fr)",width:"432px",height:"432px"}},S=["onClick","onMouseenter","onMouseleave"],D={class:"absolute inset-0 pointer-events-none"},$={key:0,class:"absolute left-1/2 top-1/2 w-0.5 bg-black",style:{height:"48px",transform:"translateX(-50%)"}},j={key:1,class:"absolute left-1/2 top-1/2 h-0.5 bg-black",style:{width:"48px",transform:"translateY(-50%)"}},T={key:0,class:"absolute inset-0 flex items-center justify-center pointer-events-none"},M={key:1,class:"absolute inset-0 flex items-center justify-center pointer-events-none"},O={key:2,class:"absolute inset-0 flex items-center justify-center pointer-events-none"},P={class:"absolute -bottom-6 left-4 right-4 flex justify-around"},F={class:"absolute -left-6 top-4 bottom-4 flex flex-col justify-around"},h=e.defineComponent({__name:"View",props:{selectedResult:{},sendTextMessage:{type:Function}},setup(a){const p=a,o=e.ref(null),v=e.ref(null),r=["A","B","C","D","E","F","G","H","J"];e.watch(()=>p.selectedResult,n=>{n?.toolName==="playGo"&&n.jsonData&&(o.value=n.jsonData)},{immediate:!0});const k=e.computed(()=>{if(!o.value?.playerNames)return"";const n=o.value.playerNames[o.value.currentSide];return n.charAt(0).toUpperCase()+n.slice(1)}),f=e.computed(()=>o.value?o.value.currentSide==="B"?"Black":"White":""),c=e.computed(()=>o.value?.playerNames&&o.value.playerNames[o.value.currentSide]==="computer"),u=e.computed(()=>{if(!o.value?.board)return[];const n=[];for(let l=0;l<9;l++)for(let t=0;t<9;t++){const s=o.value.board[l][t];n.push({row:l,col:t,piece:s!=="."?s:null})}return n});function m(n,l){return[[2,2],[2,6],[4,4],[6,2],[6,6]].some(([s,d])=>s===n&&d===l)}function _(n){const l="relative w-12 h-12",t=!n.piece&&!c.value&&!o.value?.isTerminal?"cursor-pointer":"cursor-default";return`${l} ${t}`}function g(n){if(!o.value||o.value.isTerminal||c.value)return;const l=u.value[n];if(l.piece)return;const t=r[l.col],s=l.row+1,d={row:l.row,col:l.col,currentState:o.value};p.sendTextMessage(`I want to play at ${t}${s}, which is column=${l.col}, row=${l.row}`,{data:d})}function y(n,l){!o.value||o.value.isTerminal||c.value||u.value[n].piece||(v.value=l?n:null)}return(n,l)=>(e.openBlock(),e.createElementBlock("div",E,[o.value?(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("div",x," Current Turn: "+e.toDisplayString(k.value)+" ("+e.toDisplayString(f.value)+") ",1),e.createElementVNode("div",w," Captured - Black: "+e.toDisplayString(o.value.capturedStones.B)+", White: "+e.toDisplayString(o.value.capturedStones.W),1),e.createElementVNode("div",C,[e.createElementVNode("div",V,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(t,s)=>(e.openBlock(),e.createElementBlock("div",{key:s,class:e.normalizeClass(_(t)),onClick:d=>g(s),onMouseenter:d=>y(s,!0),onMouseleave:d=>y(s,!1)},[e.createElementVNode("div",D,[t.row<8?(e.openBlock(),e.createElementBlock("div",$)):e.createCommentVNode("",!0),t.col<8?(e.openBlock(),e.createElementBlock("div",j)):e.createCommentVNode("",!0)]),m(t.row,t.col)?(e.openBlock(),e.createElementBlock("div",T,[...l[0]||(l[0]=[e.createElementVNode("div",{class:"w-2 h-2 bg-black rounded-full"},null,-1)])])):e.createCommentVNode("",!0),t.piece?(e.openBlock(),e.createElementBlock("div",M,[e.createElementVNode("div",{class:e.normalizeClass(["w-10 h-10 rounded-full border-2",t.piece==="B"?"bg-black border-gray-700":"bg-white border-gray-300"])},null,2)])):!c.value&&v.value===s?(e.openBlock(),e.createElementBlock("div",O,[e.createElementVNode("div",{class:e.normalizeClass(["w-10 h-10 rounded-full opacity-50",o.value.currentSide==="B"?"bg-black":"bg-white"])},null,2)])):e.createCommentVNode("",!0)],42,S))),128))]),e.createElementVNode("div",P,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(r,t=>e.createElementVNode("div",{key:t,class:"text-xs font-bold text-white w-12 text-center"},e.toDisplayString(t),1)),64))]),e.createElementVNode("div",F,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(9,t=>e.createElementVNode("div",{key:t,class:"text-xs font-bold text-white h-12 flex items-center justify-center"},e.toDisplayString(t),1)),64))])])])):e.createCommentVNode("",!0)]))}}),L={class:"p-3 bg-amber-50 rounded"},W={key:0,class:"space-y-1"},G={class:"flex justify-center"},z={class:"inline-block relative",style:{"background-color":"#d4a574",padding:"4px"}},A={class:"grid grid-cols-9",style:{gap:"0px"}},Y={key:0,class:"absolute left-1/2 top-1/2 w-px bg-black",style:{height:"12px",transform:"translateX(-50%)"}},R={key:1,class:"absolute left-1/2 top-1/2 h-px bg-black",style:{width:"12px",transform:"translateY(-50%)"}},q={key:2,class:"absolute w-1 h-1 bg-black rounded-full",style:{"z-index":"1"}},H={key:3,class:"w-2.5 h-2.5 bg-black rounded-full relative",style:{"z-index":"2"}},I={key:4,class:"w-2.5 h-2.5 bg-white rounded-full border border-gray-300 relative",style:{"z-index":"2"}},U={class:"text-xs text-center space-y-1"},X={key:0,class:"text-gray-600"},J={key:1,class:"font-medium"},K={class:"text-gray-500 text-xs"},b=e.defineComponent({__name:"Preview",props:{result:{}},setup(a){function p(r,k){return[[2,2],[2,6],[4,4],[6,2],[6,6]].some(([c,u])=>c===r&&u===k)}function o(r){return r.isTerminal?r.winner==="draw"?"Draw!":r.winner==="B"?"⚫ Black Wins!":r.winner==="W"?"⚪ White Wins!":"Game Over":""}function v(r){return r.charAt(0).toUpperCase()+r.slice(1)}return(r,k)=>(e.openBlock(),e.createElementBlock("div",L,[a.result.jsonData?(e.openBlock(),e.createElementBlock("div",W,[e.createElementVNode("div",G,[e.createElementVNode("div",z,[e.createElementVNode("div",A,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.result.jsonData.board,(f,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:c},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f,(u,m)=>(e.openBlock(),e.createElementBlock("div",{key:`${c}-${m}`,class:"w-3 h-3 flex items-center justify-center relative"},[Number(c)<8?(e.openBlock(),e.createElementBlock("div",Y)):e.createCommentVNode("",!0),Number(m)<8?(e.openBlock(),e.createElementBlock("div",R)):e.createCommentVNode("",!0),p(Number(c),Number(m))?(e.openBlock(),e.createElementBlock("div",q)):e.createCommentVNode("",!0),u==="B"?(e.openBlock(),e.createElementBlock("div",H)):u==="W"?(e.openBlock(),e.createElementBlock("div",I)):e.createCommentVNode("",!0)]))),128))],64))),128))])])]),e.createElementVNode("div",U,[a.result.jsonData.isTerminal?(e.openBlock(),e.createElementBlock("div",J,e.toDisplayString(o(a.result.jsonData)),1)):(e.openBlock(),e.createElementBlock("div",X,e.toDisplayString(a.result.jsonData.currentSide==="B"?"⚫":"⚪")+" "+e.toDisplayString(v(a.result.jsonData.playerNames[a.result.jsonData.currentSide]))+" to play ",1)),e.createElementVNode("div",K," Captured: ⚫"+e.toDisplayString(a.result.jsonData.capturedStones.B)+" ⚪"+e.toDisplayString(a.result.jsonData.capturedStones.W),1)])])):e.createCommentVNode("",!0)]))}}),B={...i.pluginCore,viewComponent:h,previewComponent:b,samples:i.samples},Q={plugin:B};exports.SYSTEM_PROMPT=i.SYSTEM_PROMPT;exports.TOOL_DEFINITION=i.TOOL_DEFINITION;exports.TOOL_NAME=i.TOOL_NAME;exports.executeGo=i.executeGo;exports.playGo=i.playGo;exports.pluginCore=i.pluginCore;exports.samples=i.samples;exports.Preview=b;exports.View=h;exports.default=Q;exports.plugin=B;
package/dist/vue.js CHANGED
@@ -1,6 +1,6 @@
1
- import { samples as D, pluginCore as T } from "./index.js";
1
+ import { samples as B, pluginCore as T } from "./index.js";
2
2
  import { SYSTEM_PROMPT as me, TOOL_DEFINITION as pe, TOOL_NAME as be, executeGo as ye, playGo as _e } from "./index.js";
3
- import { defineComponent as j, ref as C, watch as S, computed as k, createElementBlock as t, openBlock as s, createCommentVNode as v, createElementVNode as o, toDisplayString as d, Fragment as h, renderList as p, normalizeClass as w } from "vue";
3
+ import { defineComponent as j, ref as C, watch as S, computed as k, createElementBlock as t, openBlock as s, createCommentVNode as v, createElementVNode as o, toDisplayString as d, Fragment as m, renderList as b, normalizeClass as w } from "vue";
4
4
  const P = { class: "w-full h-full flex flex-col items-center justify-center p-4" }, M = {
5
5
  key: 0,
6
6
  class: "flex flex-col items-center"
@@ -35,19 +35,19 @@ const P = { class: "w-full h-full flex flex-col items-center justify-center p-4"
35
35
  sendTextMessage: { type: Function }
36
36
  },
37
37
  setup(u) {
38
- const b = u, r = C(null), y = C(null), a = ["A", "B", "C", "D", "E", "F", "G", "H", "J"];
38
+ const y = u, r = C(null), _ = C(null), a = ["A", "B", "C", "D", "E", "F", "G", "H", "J"];
39
39
  S(
40
- () => b.selectedResult,
40
+ () => y.selectedResult,
41
41
  (n) => {
42
42
  n?.toolName === "playGo" && n.jsonData && (r.value = n.jsonData);
43
43
  },
44
44
  { immediate: !0 }
45
45
  );
46
- const _ = k(() => {
46
+ const x = k(() => {
47
47
  if (!r.value?.playerNames) return "";
48
48
  const n = r.value.playerNames[r.value.currentSide];
49
49
  return n.charAt(0).toUpperCase() + n.slice(1);
50
- }), x = k(() => r.value ? r.value.currentSide === "B" ? "Black" : "White" : ""), c = k(() => r.value?.playerNames && r.value.playerNames[r.value.currentSide] === "computer"), f = k(() => {
50
+ }), g = k(() => r.value ? r.value.currentSide === "B" ? "Black" : "White" : ""), c = k(() => r.value?.playerNames && r.value.playerNames[r.value.currentSide] === "computer"), f = k(() => {
51
51
  if (!r.value?.board) return [];
52
52
  const n = [];
53
53
  for (let l = 0; l < 9; l++)
@@ -61,50 +61,55 @@ const P = { class: "w-full h-full flex flex-col items-center justify-center p-4"
61
61
  }
62
62
  return n;
63
63
  });
64
- function m(n, l) {
64
+ function p(n, l) {
65
65
  return [
66
66
  [2, 2],
67
67
  [2, 6],
68
68
  [4, 4],
69
69
  [6, 2],
70
70
  [6, 6]
71
- ].some(([i, g]) => i === n && g === l);
71
+ ].some(([i, h]) => i === n && h === l);
72
72
  }
73
73
  function N(n) {
74
74
  const l = "relative w-12 h-12", e = !n.piece && !c.value && !r.value?.isTerminal ? "cursor-pointer" : "cursor-default";
75
75
  return `${l} ${e}`;
76
76
  }
77
- function B(n) {
77
+ function D(n) {
78
78
  if (!r.value || r.value.isTerminal || c.value)
79
79
  return;
80
80
  const l = f.value[n];
81
81
  if (l.piece) return;
82
- const e = a[l.col], i = l.row + 1;
83
- b.sendTextMessage(
84
- `I want to play at ${e}${i}, which is column=${l.col}, row=${l.row}`
82
+ const e = a[l.col], i = l.row + 1, h = {
83
+ row: l.row,
84
+ col: l.col,
85
+ currentState: r.value
86
+ };
87
+ y.sendTextMessage(
88
+ `I want to play at ${e}${i}, which is column=${l.col}, row=${l.row}`,
89
+ { data: h }
85
90
  );
86
91
  }
87
92
  function $(n, l) {
88
- !r.value || r.value.isTerminal || c.value || f.value[n].piece || (y.value = l ? n : null);
93
+ !r.value || r.value.isTerminal || c.value || f.value[n].piece || (_.value = l ? n : null);
89
94
  }
90
95
  return (n, l) => (s(), t("div", P, [
91
96
  r.value ? (s(), t("div", M, [
92
- o("div", W, " Current Turn: " + d(_.value) + " (" + d(x.value) + ") ", 1),
97
+ o("div", W, " Current Turn: " + d(x.value) + " (" + d(g.value) + ") ", 1),
93
98
  o("div", O, " Captured - Black: " + d(r.value.capturedStones.B) + ", White: " + d(r.value.capturedStones.W), 1),
94
99
  o("div", E, [
95
100
  o("div", G, [
96
- (s(!0), t(h, null, p(f.value, (e, i) => (s(), t("div", {
101
+ (s(!0), t(m, null, b(f.value, (e, i) => (s(), t("div", {
97
102
  key: i,
98
103
  class: w(N(e)),
99
- onClick: (g) => B(i),
100
- onMouseenter: (g) => $(i, !0),
101
- onMouseleave: (g) => $(i, !1)
104
+ onClick: (h) => D(i),
105
+ onMouseenter: (h) => $(i, !0),
106
+ onMouseleave: (h) => $(i, !1)
102
107
  }, [
103
108
  o("div", F, [
104
109
  e.row < 8 ? (s(), t("div", L)) : v("", !0),
105
110
  e.col < 8 ? (s(), t("div", V)) : v("", !0)
106
111
  ]),
107
- m(e.row, e.col) ? (s(), t("div", A, [...l[0] || (l[0] = [
112
+ p(e.row, e.col) ? (s(), t("div", A, [...l[0] || (l[0] = [
108
113
  o("div", { class: "w-2 h-2 bg-black rounded-full" }, null, -1)
109
114
  ])])) : v("", !0),
110
115
  e.piece ? (s(), t("div", Y, [
@@ -114,7 +119,7 @@ const P = { class: "w-full h-full flex flex-col items-center justify-center p-4"
114
119
  e.piece === "B" ? "bg-black border-gray-700" : "bg-white border-gray-300"
115
120
  ])
116
121
  }, null, 2)
117
- ])) : !c.value && y.value === i ? (s(), t("div", H, [
122
+ ])) : !c.value && _.value === i ? (s(), t("div", H, [
118
123
  o("div", {
119
124
  class: w(["w-10 h-10 rounded-full opacity-50", r.value.currentSide === "B" ? "bg-black" : "bg-white"])
120
125
  }, null, 2)
@@ -122,13 +127,13 @@ const P = { class: "w-full h-full flex flex-col items-center justify-center p-4"
122
127
  ], 42, z))), 128))
123
128
  ]),
124
129
  o("div", R, [
125
- (s(), t(h, null, p(a, (e) => o("div", {
130
+ (s(), t(m, null, b(a, (e) => o("div", {
126
131
  key: e,
127
132
  class: "text-xs font-bold text-white w-12 text-center"
128
133
  }, d(e), 1)), 64))
129
134
  ]),
130
135
  o("div", U, [
131
- (s(), t(h, null, p(9, (e) => o("div", {
136
+ (s(), t(m, null, b(9, (e) => o("div", {
132
137
  key: e,
133
138
  class: "text-xs font-bold text-white h-12 flex items-center justify-center"
134
139
  }, d(e), 1)), 64))
@@ -166,7 +171,7 @@ const P = { class: "w-full h-full flex flex-col items-center justify-center p-4"
166
171
  key: 4,
167
172
  class: "w-2.5 h-2.5 bg-white rounded-full border border-gray-300 relative",
168
173
  style: { "z-index": "2" }
169
- }, ne = { class: "text-xs text-center space-y-1" }, le = {
174
+ }, le = { class: "text-xs text-center space-y-1" }, ne = {
170
175
  key: 0,
171
176
  class: "text-gray-600"
172
177
  }, oe = {
@@ -178,42 +183,42 @@ const P = { class: "w-full h-full flex flex-col items-center justify-center p-4"
178
183
  result: {}
179
184
  },
180
185
  setup(u) {
181
- function b(a, _) {
186
+ function y(a, x) {
182
187
  return [
183
188
  [2, 2],
184
189
  [2, 6],
185
190
  [4, 4],
186
191
  [6, 2],
187
192
  [6, 6]
188
- ].some(([c, f]) => c === a && f === _);
193
+ ].some(([c, f]) => c === a && f === x);
189
194
  }
190
195
  function r(a) {
191
196
  return a.isTerminal ? a.winner === "draw" ? "Draw!" : a.winner === "B" ? "⚫ Black Wins!" : a.winner === "W" ? "⚪ White Wins!" : "Game Over" : "";
192
197
  }
193
- function y(a) {
198
+ function _(a) {
194
199
  return a.charAt(0).toUpperCase() + a.slice(1);
195
200
  }
196
- return (a, _) => (s(), t("div", J, [
201
+ return (a, x) => (s(), t("div", J, [
197
202
  u.result.jsonData ? (s(), t("div", q, [
198
203
  o("div", K, [
199
204
  o("div", Q, [
200
205
  o("div", Z, [
201
- (s(!0), t(h, null, p(u.result.jsonData.board, (x, c) => (s(), t(h, { key: c }, [
202
- (s(!0), t(h, null, p(x, (f, m) => (s(), t("div", {
203
- key: `${c}-${m}`,
206
+ (s(!0), t(m, null, b(u.result.jsonData.board, (g, c) => (s(), t(m, { key: c }, [
207
+ (s(!0), t(m, null, b(g, (f, p) => (s(), t("div", {
208
+ key: `${c}-${p}`,
204
209
  class: "w-3 h-3 flex items-center justify-center relative"
205
210
  }, [
206
211
  Number(c) < 8 ? (s(), t("div", I)) : v("", !0),
207
- Number(m) < 8 ? (s(), t("div", ee)) : v("", !0),
208
- b(Number(c), Number(m)) ? (s(), t("div", te)) : v("", !0),
212
+ Number(p) < 8 ? (s(), t("div", ee)) : v("", !0),
213
+ y(Number(c), Number(p)) ? (s(), t("div", te)) : v("", !0),
209
214
  f === "B" ? (s(), t("div", se)) : f === "W" ? (s(), t("div", re)) : v("", !0)
210
215
  ]))), 128))
211
216
  ], 64))), 128))
212
217
  ])
213
218
  ])
214
219
  ]),
215
- o("div", ne, [
216
- u.result.jsonData.isTerminal ? (s(), t("div", oe, d(r(u.result.jsonData)), 1)) : (s(), t("div", le, d(u.result.jsonData.currentSide === "B" ? "⚫" : "⚪") + " " + d(y(
220
+ o("div", le, [
221
+ u.result.jsonData.isTerminal ? (s(), t("div", oe, d(r(u.result.jsonData)), 1)) : (s(), t("div", ne, d(u.result.jsonData.currentSide === "B" ? "⚫" : "⚪") + " " + d(_(
217
222
  u.result.jsonData.playerNames[u.result.jsonData.currentSide]
218
223
  )) + " to play ", 1)),
219
224
  o("div", ae, " Captured: ⚫" + d(u.result.jsonData.capturedStones.B) + " ⚪" + d(u.result.jsonData.capturedStones.W), 1)
@@ -225,7 +230,7 @@ const P = { class: "w-full h-full flex flex-col items-center justify-center p-4"
225
230
  ...T,
226
231
  viewComponent: X,
227
232
  previewComponent: ie,
228
- samples: D
233
+ samples: B
229
234
  }, ve = { plugin: ue };
230
235
  export {
231
236
  ie as Preview,
@@ -238,5 +243,5 @@ export {
238
243
  _e as playGo,
239
244
  ue as plugin,
240
245
  T as pluginCore,
241
- D as samples
246
+ B as samples
242
247
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gui-chat-plugin/go",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Go (Baduk/Weiqi) game plugin for GUI Chat",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -24,7 +24,9 @@
24
24
  },
25
25
  "./style.css": "./dist/style.css"
26
26
  },
27
- "files": ["dist"],
27
+ "files": [
28
+ "dist"
29
+ ],
28
30
  "scripts": {
29
31
  "dev": "vite",
30
32
  "build": "vite build && vue-tsc -p tsconfig.build.json --emitDeclarationOnly",
@@ -35,7 +37,7 @@
35
37
  "vue": "^3.5.0"
36
38
  },
37
39
  "dependencies": {
38
- "gui-chat-protocol": "^0.0.1"
40
+ "gui-chat-protocol": "^0.0.3"
39
41
  },
40
42
  "devDependencies": {
41
43
  "@tailwindcss/vite": "^4.1.18",
@@ -48,10 +50,17 @@
48
50
  "tailwindcss": "^4.1.18",
49
51
  "typescript": "~5.9.3",
50
52
  "vite": "^7.3.1",
51
- "vue": "^3.5.26",
53
+ "vue": "^3.5.27",
52
54
  "vue-eslint-parser": "^10.2.0",
53
55
  "vue-tsc": "^3.2.2"
54
56
  },
55
- "keywords": ["guichat", "plugin", "go", "baduk", "weiqi", "game"],
57
+ "keywords": [
58
+ "guichat",
59
+ "plugin",
60
+ "go",
61
+ "baduk",
62
+ "weiqi",
63
+ "game"
64
+ ],
56
65
  "license": "MIT"
57
66
  }