@gui-chat-plugin/go 0.1.1 → 0.4.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/vue.js CHANGED
@@ -1,247 +1,211 @@
1
- import { samples as B, pluginCore as T } from "./index.js";
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 m, renderList as b, normalizeClass as w } from "vue";
4
- const P = { class: "w-full h-full flex flex-col items-center justify-center p-4" }, M = {
5
- key: 0,
6
- class: "flex flex-col items-center"
7
- }, W = { class: "text-white text-lg font-bold mb-2 text-center" }, O = { class: "text-white text-sm mb-4 text-center" }, E = { class: "relative p-4 bg-amber-100 rounded-lg border-2 border-amber-900" }, G = {
8
- class: "grid gap-0",
9
- style: {
10
- gridTemplateColumns: "repeat(9, 1fr)",
11
- width: "432px",
12
- height: "432px"
13
- }
14
- }, z = ["onClick", "onMouseenter", "onMouseleave"], F = { class: "absolute inset-0 pointer-events-none" }, L = {
15
- key: 0,
16
- class: "absolute left-1/2 top-1/2 w-0.5 bg-black",
17
- style: { height: "48px", transform: "translateX(-50%)" }
18
- }, V = {
19
- key: 1,
20
- class: "absolute left-1/2 top-1/2 h-0.5 bg-black",
21
- style: { width: "48px", transform: "translateY(-50%)" }
1
+ import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./samples-CUD_StDT.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-2 text-center" }, S = { class: "text-white text-sm mb-4 text-center" }, C = { class: "relative p-4 bg-amber-100 rounded-lg border-2 border-amber-900" }, w = {
8
+ class: "grid gap-0",
9
+ style: {
10
+ gridTemplateColumns: "repeat(9, 1fr)",
11
+ width: "432px",
12
+ height: "432px"
13
+ }
14
+ }, T = [
15
+ "onClick",
16
+ "onMouseenter",
17
+ "onMouseleave"
18
+ ], E = { class: "absolute inset-0 pointer-events-none" }, D = {
19
+ key: 0,
20
+ class: "absolute left-1/2 top-1/2 w-0.5 bg-black",
21
+ style: {
22
+ height: "48px",
23
+ transform: "translateX(-50%)"
24
+ }
25
+ }, O = {
26
+ key: 1,
27
+ class: "absolute left-1/2 top-1/2 h-0.5 bg-black",
28
+ style: {
29
+ width: "48px",
30
+ transform: "translateY(-50%)"
31
+ }
32
+ }, k = {
33
+ key: 0,
34
+ class: "absolute inset-0 flex items-center justify-center pointer-events-none"
22
35
  }, A = {
23
- key: 0,
24
- class: "absolute inset-0 flex items-center justify-center pointer-events-none"
25
- }, Y = {
26
- key: 1,
27
- class: "absolute inset-0 flex items-center justify-center pointer-events-none"
36
+ key: 1,
37
+ class: "absolute inset-0 flex items-center justify-center pointer-events-none"
38
+ }, j = {
39
+ key: 2,
40
+ class: "absolute inset-0 flex items-center justify-center pointer-events-none"
41
+ }, M = { class: "absolute -bottom-6 left-4 right-4 flex justify-around" }, N = { class: "absolute -left-6 top-4 bottom-4 flex flex-col justify-around" }, P = /* @__PURE__ */ f({
42
+ __name: "View",
43
+ props: {
44
+ selectedResult: {},
45
+ sendTextMessage: { type: Function }
46
+ },
47
+ setup(e) {
48
+ let t = e, n = h(null), r = h(null), i = [
49
+ "A",
50
+ "B",
51
+ "C",
52
+ "D",
53
+ "E",
54
+ "F",
55
+ "G",
56
+ "H",
57
+ "J"
58
+ ];
59
+ v(() => t.selectedResult, (e) => {
60
+ e?.toolName === "playGo" && e.jsonData && (n.value = e.jsonData);
61
+ }, { immediate: !0 });
62
+ let a = c(() => {
63
+ if (!n.value?.playerNames) return "";
64
+ let e = n.value.playerNames[n.value.currentSide];
65
+ return e.charAt(0).toUpperCase() + e.slice(1);
66
+ }), o = c(() => n.value ? n.value.currentSide === "B" ? "Black" : "White" : ""), f = c(() => n.value?.playerNames && n.value.playerNames[n.value.currentSide] === "computer"), P = c(() => {
67
+ if (!n.value?.board) return [];
68
+ let e = [];
69
+ for (let t = 0; t < 9; t++) for (let r = 0; r < 9; r++) {
70
+ let i = n.value.board[t][r];
71
+ e.push({
72
+ row: t,
73
+ col: r,
74
+ piece: i === "." ? null : i
75
+ });
76
+ }
77
+ return e;
78
+ });
79
+ function F(e, t) {
80
+ return [
81
+ [2, 2],
82
+ [2, 6],
83
+ [4, 4],
84
+ [6, 2],
85
+ [6, 6]
86
+ ].some(([n, r]) => n === e && r === t);
87
+ }
88
+ function I(e) {
89
+ return `relative w-12 h-12 ${!e.piece && !f.value && !n.value?.isTerminal ? "cursor-pointer" : "cursor-default"}`;
90
+ }
91
+ function L(e) {
92
+ if (!n.value || n.value.isTerminal || f.value) return;
93
+ let r = P.value[e];
94
+ if (r.piece) return;
95
+ let a = i[r.col], o = r.row + 1, s = {
96
+ row: r.row,
97
+ col: r.col,
98
+ currentState: n.value
99
+ };
100
+ t.sendTextMessage(`I want to play at ${a}${o}, which is column=${r.col}, row=${r.row}`, { data: s });
101
+ }
102
+ function R(e, t) {
103
+ !n.value || n.value.isTerminal || f.value || P.value[e].piece || (r.value = t ? e : null);
104
+ }
105
+ return (e, t) => (m(), u("div", y, [n.value ? (m(), u("div", b, [
106
+ d("div", x, " Current Turn: " + _(a.value) + " (" + _(o.value) + ") ", 1),
107
+ d("div", S, " Captured - Black: " + _(n.value.capturedStones.B) + ", White: " + _(n.value.capturedStones.W), 1),
108
+ d("div", C, [
109
+ d("div", w, [(m(!0), u(s, null, g(P.value, (e, i) => (m(), u("div", {
110
+ key: i,
111
+ class: p(I(e)),
112
+ onClick: (e) => L(i),
113
+ onMouseenter: (e) => R(i, !0),
114
+ onMouseleave: (e) => R(i, !1)
115
+ }, [
116
+ d("div", E, [e.row < 8 ? (m(), u("div", D)) : l("", !0), e.col < 8 ? (m(), u("div", O)) : l("", !0)]),
117
+ F(e.row, e.col) ? (m(), u("div", k, [...t[0] ||= [d("div", { class: "w-2 h-2 bg-black rounded-full" }, null, -1)]])) : l("", !0),
118
+ e.piece ? (m(), u("div", A, [d("div", { class: p(["w-10 h-10 rounded-full border-2", e.piece === "B" ? "bg-black border-gray-700" : "bg-white border-gray-300"]) }, null, 2)])) : !f.value && r.value === i ? (m(), u("div", j, [d("div", { class: p(["w-10 h-10 rounded-full opacity-50", n.value.currentSide === "B" ? "bg-black" : "bg-white"]) }, null, 2)])) : l("", !0)
119
+ ], 42, T))), 128))]),
120
+ d("div", M, [(m(), u(s, null, g(i, (e) => d("div", {
121
+ key: e,
122
+ class: "text-xs font-bold text-white w-12 text-center"
123
+ }, _(e), 1)), 64))]),
124
+ d("div", N, [(m(), u(s, null, g(9, (e) => d("div", {
125
+ key: e,
126
+ class: "text-xs font-bold text-white h-12 flex items-center justify-center"
127
+ }, _(e), 1)), 64))])
128
+ ])
129
+ ])) : l("", !0)]));
130
+ }
131
+ }), F = { class: "p-3 bg-amber-50 rounded" }, I = {
132
+ key: 0,
133
+ class: "space-y-1"
134
+ }, L = { class: "flex justify-center" }, R = {
135
+ class: "inline-block relative",
136
+ style: {
137
+ "background-color": "#d4a574",
138
+ padding: "4px"
139
+ }
140
+ }, z = {
141
+ class: "grid grid-cols-9",
142
+ style: { gap: "0px" }
143
+ }, B = {
144
+ key: 0,
145
+ class: "absolute left-1/2 top-1/2 w-px bg-black",
146
+ style: {
147
+ height: "12px",
148
+ transform: "translateX(-50%)"
149
+ }
150
+ }, V = {
151
+ key: 1,
152
+ class: "absolute left-1/2 top-1/2 h-px bg-black",
153
+ style: {
154
+ width: "12px",
155
+ transform: "translateY(-50%)"
156
+ }
28
157
  }, H = {
29
- key: 2,
30
- class: "absolute inset-0 flex items-center justify-center pointer-events-none"
31
- }, R = { class: "absolute -bottom-6 left-4 right-4 flex justify-around" }, U = { class: "absolute -left-6 top-4 bottom-4 flex flex-col justify-around" }, X = /* @__PURE__ */ j({
32
- __name: "View",
33
- props: {
34
- selectedResult: {},
35
- sendTextMessage: { type: Function }
36
- },
37
- setup(u) {
38
- const y = u, r = C(null), _ = C(null), a = ["A", "B", "C", "D", "E", "F", "G", "H", "J"];
39
- S(
40
- () => y.selectedResult,
41
- (n) => {
42
- n?.toolName === "playGo" && n.jsonData && (r.value = n.jsonData);
43
- },
44
- { immediate: !0 }
45
- );
46
- const x = k(() => {
47
- if (!r.value?.playerNames) return "";
48
- const n = r.value.playerNames[r.value.currentSide];
49
- return n.charAt(0).toUpperCase() + n.slice(1);
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
- if (!r.value?.board) return [];
52
- const n = [];
53
- for (let l = 0; l < 9; l++)
54
- for (let e = 0; e < 9; e++) {
55
- const i = r.value.board[l][e];
56
- n.push({
57
- row: l,
58
- col: e,
59
- piece: i !== "." ? i : null
60
- });
61
- }
62
- return n;
63
- });
64
- function p(n, l) {
65
- return [
66
- [2, 2],
67
- [2, 6],
68
- [4, 4],
69
- [6, 2],
70
- [6, 6]
71
- ].some(([i, h]) => i === n && h === l);
72
- }
73
- function N(n) {
74
- const l = "relative w-12 h-12", e = !n.piece && !c.value && !r.value?.isTerminal ? "cursor-pointer" : "cursor-default";
75
- return `${l} ${e}`;
76
- }
77
- function D(n) {
78
- if (!r.value || r.value.isTerminal || c.value)
79
- return;
80
- const l = f.value[n];
81
- if (l.piece) return;
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 }
90
- );
91
- }
92
- function $(n, l) {
93
- !r.value || r.value.isTerminal || c.value || f.value[n].piece || (_.value = l ? n : null);
94
- }
95
- return (n, l) => (s(), t("div", P, [
96
- r.value ? (s(), t("div", M, [
97
- o("div", W, " Current Turn: " + d(x.value) + " (" + d(g.value) + ") ", 1),
98
- o("div", O, " Captured - Black: " + d(r.value.capturedStones.B) + ", White: " + d(r.value.capturedStones.W), 1),
99
- o("div", E, [
100
- o("div", G, [
101
- (s(!0), t(m, null, b(f.value, (e, i) => (s(), t("div", {
102
- key: i,
103
- class: w(N(e)),
104
- onClick: (h) => D(i),
105
- onMouseenter: (h) => $(i, !0),
106
- onMouseleave: (h) => $(i, !1)
107
- }, [
108
- o("div", F, [
109
- e.row < 8 ? (s(), t("div", L)) : v("", !0),
110
- e.col < 8 ? (s(), t("div", V)) : v("", !0)
111
- ]),
112
- p(e.row, e.col) ? (s(), t("div", A, [...l[0] || (l[0] = [
113
- o("div", { class: "w-2 h-2 bg-black rounded-full" }, null, -1)
114
- ])])) : v("", !0),
115
- e.piece ? (s(), t("div", Y, [
116
- o("div", {
117
- class: w([
118
- "w-10 h-10 rounded-full border-2",
119
- e.piece === "B" ? "bg-black border-gray-700" : "bg-white border-gray-300"
120
- ])
121
- }, null, 2)
122
- ])) : !c.value && _.value === i ? (s(), t("div", H, [
123
- o("div", {
124
- class: w(["w-10 h-10 rounded-full opacity-50", r.value.currentSide === "B" ? "bg-black" : "bg-white"])
125
- }, null, 2)
126
- ])) : v("", !0)
127
- ], 42, z))), 128))
128
- ]),
129
- o("div", R, [
130
- (s(), t(m, null, b(a, (e) => o("div", {
131
- key: e,
132
- class: "text-xs font-bold text-white w-12 text-center"
133
- }, d(e), 1)), 64))
134
- ]),
135
- o("div", U, [
136
- (s(), t(m, null, b(9, (e) => o("div", {
137
- key: e,
138
- class: "text-xs font-bold text-white h-12 flex items-center justify-center"
139
- }, d(e), 1)), 64))
140
- ])
141
- ])
142
- ])) : v("", !0)
143
- ]));
144
- }
145
- }), J = { class: "p-3 bg-amber-50 rounded" }, q = {
146
- key: 0,
147
- class: "space-y-1"
148
- }, K = { class: "flex justify-center" }, Q = {
149
- class: "inline-block relative",
150
- style: { "background-color": "#d4a574", padding: "4px" }
151
- }, Z = {
152
- class: "grid grid-cols-9",
153
- style: { gap: "0px" }
154
- }, I = {
155
- key: 0,
156
- class: "absolute left-1/2 top-1/2 w-px bg-black",
157
- style: { height: "12px", transform: "translateX(-50%)" }
158
- }, ee = {
159
- key: 1,
160
- class: "absolute left-1/2 top-1/2 h-px bg-black",
161
- style: { width: "12px", transform: "translateY(-50%)" }
162
- }, te = {
163
- key: 2,
164
- class: "absolute w-1 h-1 bg-black rounded-full",
165
- style: { "z-index": "1" }
166
- }, se = {
167
- key: 3,
168
- class: "w-2.5 h-2.5 bg-black rounded-full relative",
169
- style: { "z-index": "2" }
170
- }, re = {
171
- key: 4,
172
- class: "w-2.5 h-2.5 bg-white rounded-full border border-gray-300 relative",
173
- style: { "z-index": "2" }
174
- }, le = { class: "text-xs text-center space-y-1" }, ne = {
175
- key: 0,
176
- class: "text-gray-600"
177
- }, oe = {
178
- key: 1,
179
- class: "font-medium"
180
- }, ae = { class: "text-gray-500 text-xs" }, ie = /* @__PURE__ */ j({
181
- __name: "Preview",
182
- props: {
183
- result: {}
184
- },
185
- setup(u) {
186
- function y(a, x) {
187
- return [
188
- [2, 2],
189
- [2, 6],
190
- [4, 4],
191
- [6, 2],
192
- [6, 6]
193
- ].some(([c, f]) => c === a && f === x);
194
- }
195
- function r(a) {
196
- return a.isTerminal ? a.winner === "draw" ? "Draw!" : a.winner === "B" ? "⚫ Black Wins!" : a.winner === "W" ? "⚪ White Wins!" : "Game Over" : "";
197
- }
198
- function _(a) {
199
- return a.charAt(0).toUpperCase() + a.slice(1);
200
- }
201
- return (a, x) => (s(), t("div", J, [
202
- u.result.jsonData ? (s(), t("div", q, [
203
- o("div", K, [
204
- o("div", Q, [
205
- o("div", Z, [
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}`,
209
- class: "w-3 h-3 flex items-center justify-center relative"
210
- }, [
211
- Number(c) < 8 ? (s(), t("div", I)) : v("", !0),
212
- Number(p) < 8 ? (s(), t("div", ee)) : v("", !0),
213
- y(Number(c), Number(p)) ? (s(), t("div", te)) : v("", !0),
214
- f === "B" ? (s(), t("div", se)) : f === "W" ? (s(), t("div", re)) : v("", !0)
215
- ]))), 128))
216
- ], 64))), 128))
217
- ])
218
- ])
219
- ]),
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(_(
222
- u.result.jsonData.playerNames[u.result.jsonData.currentSide]
223
- )) + " to play ", 1)),
224
- o("div", ae, " Captured: ⚫" + d(u.result.jsonData.capturedStones.B) + " ⚪" + d(u.result.jsonData.capturedStones.W), 1)
225
- ])
226
- ])) : v("", !0)
227
- ]));
228
- }
229
- }), ue = {
230
- ...T,
231
- viewComponent: X,
232
- previewComponent: ie,
233
- samples: B
234
- }, ve = { plugin: ue };
235
- export {
236
- ie as Preview,
237
- me as SYSTEM_PROMPT,
238
- pe as TOOL_DEFINITION,
239
- be as TOOL_NAME,
240
- X as View,
241
- ve as default,
242
- ye as executeGo,
243
- _e as playGo,
244
- ue as plugin,
245
- T as pluginCore,
246
- B as samples
247
- };
158
+ key: 2,
159
+ class: "absolute w-1 h-1 bg-black rounded-full",
160
+ style: { "z-index": "1" }
161
+ }, U = {
162
+ key: 3,
163
+ class: "w-2.5 h-2.5 bg-black rounded-full relative",
164
+ style: { "z-index": "2" }
165
+ }, W = {
166
+ key: 4,
167
+ class: "w-2.5 h-2.5 bg-white rounded-full border border-gray-300 relative",
168
+ style: { "z-index": "2" }
169
+ }, G = { class: "text-xs text-center space-y-1" }, K = {
170
+ key: 0,
171
+ class: "text-gray-600"
172
+ }, q = {
173
+ key: 1,
174
+ class: "font-medium"
175
+ }, J = { class: "text-gray-500 text-xs" }, Y = /* @__PURE__ */ f({
176
+ __name: "Preview",
177
+ props: { result: {} },
178
+ setup(e) {
179
+ function t(e, t) {
180
+ return [
181
+ [2, 2],
182
+ [2, 6],
183
+ [4, 4],
184
+ [6, 2],
185
+ [6, 6]
186
+ ].some(([n, r]) => n === e && r === t);
187
+ }
188
+ function n(e) {
189
+ return e.isTerminal ? e.winner === "draw" ? "Draw!" : e.winner === "B" ? "⚫ Black Wins!" : e.winner === "W" ? "⚪ White Wins!" : "Game Over" : "";
190
+ }
191
+ function r(e) {
192
+ return e.charAt(0).toUpperCase() + e.slice(1);
193
+ }
194
+ return (i, a) => (m(), u("div", F, [e.result.jsonData ? (m(), u("div", I, [d("div", L, [d("div", R, [d("div", z, [(m(!0), u(s, null, g(e.result.jsonData.board, (e, n) => (m(), u(s, { key: n }, [(m(!0), u(s, null, g(e, (e, r) => (m(), u("div", {
195
+ key: `${n}-${r}`,
196
+ class: "w-3 h-3 flex items-center justify-center relative"
197
+ }, [
198
+ Number(n) < 8 ? (m(), u("div", B)) : l("", !0),
199
+ Number(r) < 8 ? (m(), u("div", V)) : l("", !0),
200
+ t(Number(n), Number(r)) ? (m(), u("div", H)) : l("", !0),
201
+ e === "B" ? (m(), u("div", U)) : e === "W" ? (m(), u("div", W)) : l("", !0)
202
+ ]))), 128))], 64))), 128))])])]), d("div", G, [e.result.jsonData.isTerminal ? (m(), u("div", q, _(n(e.result.jsonData)), 1)) : (m(), u("div", K, _(e.result.jsonData.currentSide === "B" ? "⚫" : "⚪") + " " + _(r(e.result.jsonData.playerNames[e.result.jsonData.currentSide])) + " to play ", 1)), d("div", J, " Captured: ⚫" + _(e.result.jsonData.capturedStones.B) + " ⚪" + _(e.result.jsonData.capturedStones.W), 1)])])) : l("", !0)]));
203
+ }
204
+ }), X = {
205
+ ...i,
206
+ viewComponent: P,
207
+ previewComponent: Y,
208
+ samples: o
209
+ }, Z = { plugin: X };
210
+ //#endregion
211
+ export { Y as Preview, e as SYSTEM_PROMPT, r as TOOL_DEFINITION, a as TOOL_NAME, P as View, Z as default, n as executeGo, t as playGo, X as plugin, i as pluginCore, o as samples };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gui-chat-plugin/go",
3
- "version": "0.1.1",
3
+ "version": "0.4.0",
4
4
  "description": "Go (Baduk/Weiqi) game plugin for GUI Chat",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -37,22 +37,23 @@
37
37
  "vue": "^3.5.0"
38
38
  },
39
39
  "dependencies": {
40
- "gui-chat-protocol": "^0.0.3"
40
+ "gui-chat-protocol": "^0.3.3"
41
41
  },
42
42
  "devDependencies": {
43
- "@tailwindcss/vite": "^4.1.18",
44
- "@typescript-eslint/eslint-plugin": "^8.53.0",
45
- "@typescript-eslint/parser": "^8.53.0",
46
- "@vitejs/plugin-vue": "^6.0.3",
47
- "eslint": "^9.39.2",
48
- "eslint-plugin-vue": "^10.6.2",
49
- "globals": "^17.0.0",
50
- "tailwindcss": "^4.1.18",
51
- "typescript": "~5.9.3",
52
- "vite": "^7.3.1",
53
- "vue": "^3.5.27",
54
- "vue-eslint-parser": "^10.2.0",
55
- "vue-tsc": "^3.2.2"
43
+ "@eslint/js": "^10.0.1",
44
+ "@tailwindcss/vite": "^4.2.4",
45
+ "@typescript-eslint/eslint-plugin": "^8.59.2",
46
+ "@typescript-eslint/parser": "^8.59.2",
47
+ "@vitejs/plugin-vue": "^6.0.5",
48
+ "eslint": "^10.3.0",
49
+ "eslint-plugin-vue": "^10.9.1",
50
+ "globals": "^17.6.0",
51
+ "tailwindcss": "^4.2.4",
52
+ "typescript": "~6.0.3",
53
+ "vite": "^8.0.11",
54
+ "vue": "^3.5.34",
55
+ "vue-eslint-parser": "^10.4.0",
56
+ "vue-tsc": "^3.2.8"
56
57
  },
57
58
  "keywords": [
58
59
  "guichat",