Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ jobs:
- run: yarn install --frozen-lockfile --network-timeout 120000
- run: yarn run typecheck
- run: yarn run lint
# Windows checkouts get CRLF line endings, which prettier reports as unformatted.
- run: yarn run format:check
if: runner.os == 'Linux'
- run: yarn run build
# Sanity-check `npm pack` only once (Linux + Node 24) to avoid
# 6-way artifact-name collisions; lint/build coverage is what
Expand Down
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.scoria/
scoria.config.json
dist/
coverage/
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"printWidth": 160
}
19 changes: 3 additions & 16 deletions demo/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
<div v-if="ViewComponent" class="bg-gray-800 rounded-lg p-5 mb-5 shadow-md">
<h2 class="text-gray-200 text-xl mb-4">View Component</h2>
<div class="border border-gray-600 rounded h-[600px]">
<component
:is="ViewComponent"
:selectedResult="result"
:sendTextMessage="handleSendMessage"
/>
<component :is="ViewComponent" :selectedResult="result" :sendTextMessage="handleSendMessage" />
</div>
</div>

Expand All @@ -44,16 +40,11 @@
<script setup lang="ts">
import { ref, computed } from "vue";
import { plugin, executeGo } from "../src/vue";
import type {
ToolResult,
ToolSample,
ToolPlugin,
SendTextMessageOptions,
} from "gui-chat-protocol/vue";
import type { ToolResult, ToolSample, ToolPlugin, SendTextMessageOptions } from "gui-chat-protocol/vue";
import type { GoArgs, GoState, GoClickData } from "../src/core/types";
import { playGo } from "../src/core/logic";

const currentPlugin = plugin as unknown as ToolPlugin;

Check warning on line 47 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, ubuntu-latest)

Do not use any type assertions

Check warning on line 47 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, ubuntu-latest)

Do not use any type assertions

Check warning on line 47 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, macos-latest)

Do not use any type assertions

Check warning on line 47 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, macos-latest)

Do not use any type assertions

Check warning on line 47 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, ubuntu-latest)

Do not use any type assertions

Check warning on line 47 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, ubuntu-latest)

Do not use any type assertions

Check warning on line 47 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, macos-latest)

Do not use any type assertions

Check warning on line 47 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, macos-latest)

Do not use any type assertions

Check warning on line 47 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, windows-latest)

Do not use any type assertions

Check warning on line 47 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, windows-latest)

Do not use any type assertions

Check warning on line 47 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, windows-latest)

Do not use any type assertions

Check warning on line 47 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, windows-latest)

Do not use any type assertions

const pluginName = computed(() => currentPlugin.toolDefinition.name);
const samplesList = computed(() => currentPlugin.samples || []);
Expand All @@ -70,8 +61,8 @@
});

const executeSample = async (sample: ToolSample) => {
const args = sample.args as unknown as GoArgs;

Check warning on line 64 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, ubuntu-latest)

Do not use any type assertions

Check warning on line 64 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, ubuntu-latest)

Do not use any type assertions

Check warning on line 64 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, macos-latest)

Do not use any type assertions

Check warning on line 64 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, macos-latest)

Do not use any type assertions

Check warning on line 64 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, ubuntu-latest)

Do not use any type assertions

Check warning on line 64 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, ubuntu-latest)

Do not use any type assertions

Check warning on line 64 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, macos-latest)

Do not use any type assertions

Check warning on line 64 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, macos-latest)

Do not use any type assertions

Check warning on line 64 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, windows-latest)

Do not use any type assertions

Check warning on line 64 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, windows-latest)

Do not use any type assertions

Check warning on line 64 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, windows-latest)

Do not use any type assertions

Check warning on line 64 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, windows-latest)

Do not use any type assertions
const execResult = await executeGo({} as any, args);

Check warning on line 65 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, ubuntu-latest)

Unexpected any. Specify a different type

Check warning on line 65 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, ubuntu-latest)

Do not use any type assertions

Check warning on line 65 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, macos-latest)

Unexpected any. Specify a different type

Check warning on line 65 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, macos-latest)

Do not use any type assertions

Check warning on line 65 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, ubuntu-latest)

Unexpected any. Specify a different type

Check warning on line 65 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, ubuntu-latest)

Do not use any type assertions

Check warning on line 65 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, macos-latest)

Unexpected any. Specify a different type

Check warning on line 65 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, macos-latest)

Do not use any type assertions

Check warning on line 65 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, windows-latest)

Unexpected any. Specify a different type

Check warning on line 65 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, windows-latest)

Do not use any type assertions

Check warning on line 65 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, windows-latest)

Unexpected any. Specify a different type

Check warning on line 65 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, windows-latest)

Do not use any type assertions
result.value = {
...result.value,
...execResult,
Expand All @@ -85,7 +76,7 @@

// If data is provided (from handleCellClick), process the move
if (options?.data) {
const clickData = options.data as GoClickData;

Check warning on line 79 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, ubuntu-latest)

Do not use any type assertions

Check warning on line 79 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, macos-latest)

Do not use any type assertions

Check warning on line 79 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, ubuntu-latest)

Do not use any type assertions

Check warning on line 79 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, macos-latest)

Do not use any type assertions

Check warning on line 79 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (24.x, windows-latest)

Do not use any type assertions

Check warning on line 79 in demo/App.vue

View workflow job for this annotation

GitHub Actions / lint_test (26.x, windows-latest)

Do not use any type assertions
processUserMove(clickData);
}
};
Expand Down Expand Up @@ -115,11 +106,7 @@
};

// If it's now computer's turn and game is not over, make computer move
if (
!newState.isTerminal &&
!newState.error &&
newState.playerNames[newState.currentSide] === "computer"
) {
if (!newState.isTerminal && !newState.error && newState.playerNames[newState.currentSide] === "computer") {
// Small delay for visual feedback
setTimeout(() => {
makeComputerMove(newState);
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
"build": "vite build && vue-tsc -p tsconfig.build.json --emitDeclarationOnly",
"typecheck": "vue-tsc --noEmit",
"lint": "eslint src demo",
"quality": "scoria"
"quality": "scoria",
"format": "prettier --write \"{src,demo}/**/*.{ts,tsx,vue,json,css}\" \"*.{ts,js,json}\"",
"format:check": "prettier --check \"{src,demo}/**/*.{ts,tsx,vue,json,css}\" \"*.{ts,js,json}\""
},
"peerDependencies": {
"gui-chat-protocol": "^2.1.0",
Expand All @@ -48,6 +50,7 @@
"eslint-plugin-vue": "^10.11.1",
"globals": "^17.13.0",
"gui-chat-protocol": "^2.3.0",
"prettier": "^3.9.10",
"scoria": "^0.4.1",
"tailwindcss": "^4.3.3",
"typescript": "~6.0.3",
Expand Down
27 changes: 9 additions & 18 deletions src/core/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,23 @@ export const TOOL_DEFINITION: ToolDefinition = {
action: {
type: "string",
enum: ["new_game", "move", "pass"],
description:
"The action to perform: start a new game, make a move, or pass the turn",
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-8, required for 'move' action). The user will tell you the column by specifying A to J (skipping I)",
description: "Column position for the move (0-8, required for 'move' action). The user will tell you the column by specifying A to J (skipping I)",
minimum: 0,
maximum: 8,
},
row: {
type: "number",
description:
"Row position for the move (0-8, required for 'move' action). The user will tell you the row by specifying 1 to 9",
description: "Row position for the move (0-8, required for 'move' action). The user will tell you the row by specifying 1 to 9",
minimum: 0,
maximum: 8,
},
board: {
type: "array",
description:
"Current 9x9 board state (required for 'move' and 'pass' actions)",
description: "Current 9x9 board state (required for 'move' and 'pass' actions)",
items: {
type: "array",
items: {
Expand All @@ -49,13 +45,11 @@ export const TOOL_DEFINITION: ToolDefinition = {
currentSide: {
type: "string",
enum: ["B", "W"],
description:
"Current player's side (required for 'move' and 'pass' actions)",
description: "Current player's side (required for 'move' and 'pass' actions)",
},
playerNames: {
type: "object",
description:
"Player assignments (required for 'move' and 'pass' actions)",
description: "Player assignments (required for 'move' and 'pass' actions)",
properties: {
B: {
type: "string",
Expand All @@ -70,8 +64,7 @@ export const TOOL_DEFINITION: ToolDefinition = {
},
capturedStones: {
type: "object",
description:
"Count of captured stones for each player (required for 'move' and 'pass' actions)",
description: "Count of captured stones for each player (required for 'move' and 'pass' actions)",
properties: {
B: {
type: "number",
Expand All @@ -86,16 +79,14 @@ export const TOOL_DEFINITION: ToolDefinition = {
},
consecutivePasses: {
type: "number",
description:
"Number of consecutive passes (required for 'pass' action, 0-2)",
description: "Number of consecutive passes (required for 'pass' action, 0-2)",
minimum: 0,
maximum: 2,
},
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.",
description: "Optional: Which player should play as Black (goes first) for 'new_game' action. If not specified, will be chosen randomly.",
},
},
required: ["action"],
Expand Down
22 changes: 2 additions & 20 deletions src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,8 @@
* Go Plugin - Core Entry Point
*/

export type {
Cell,
Side,
GoBoard,
GoCellValue,
GoPlayerType,
GoArgs,
GoState,
Command,
NewGameCommand,
MoveCommand,
} from "./types";
export type { Cell, Side, GoBoard, GoCellValue, GoPlayerType, GoArgs, GoState, Command, NewGameCommand, MoveCommand } from "./types";

export {
TOOL_NAME,
TOOL_DEFINITION,
SYSTEM_PROMPT,
executeGo,
pluginCore,
playGo,
} from "./plugin";
export { TOOL_NAME, TOOL_DEFINITION, SYSTEM_PROMPT, executeGo, pluginCore, playGo } from "./plugin";

export { samples } from "./samples";
54 changes: 9 additions & 45 deletions src/core/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
function createEmptyBoard(): GoBoard {
const board: GoBoard = [];
for (let i = 0; i < BOARD_SIZE; i++) {
board[i] = new Array(BOARD_SIZE).fill(".") as Cell[];

Check warning on line 19 in src/core/logic.ts

View workflow job for this annotation

GitHub Actions / lint_test (26.x, ubuntu-latest)

Do not use any type assertions

Check warning on line 19 in src/core/logic.ts

View workflow job for this annotation

GitHub Actions / lint_test (26.x, macos-latest)

Do not use any type assertions

Check warning on line 19 in src/core/logic.ts

View workflow job for this annotation

GitHub Actions / lint_test (24.x, ubuntu-latest)

Do not use any type assertions

Check warning on line 19 in src/core/logic.ts

View workflow job for this annotation

GitHub Actions / lint_test (24.x, macos-latest)

Do not use any type assertions

Check warning on line 19 in src/core/logic.ts

View workflow job for this annotation

GitHub Actions / lint_test (24.x, windows-latest)

Do not use any type assertions

Check warning on line 19 in src/core/logic.ts

View workflow job for this annotation

GitHub Actions / lint_test (26.x, windows-latest)

Do not use any type assertions
}
return board;
}
Expand All @@ -34,12 +34,7 @@
}

// Find all stones connected to the stone at (row, col)
function getGroup(
board: GoBoard,
row: number,
col: number,
visited: boolean[][],
): { row: number; col: number }[] {
function getGroup(board: GoBoard, row: number, col: number, visited: boolean[][]): { row: number; col: number }[] {
const color = board[row][col];
if (color === ".") return [];

Expand All @@ -47,7 +42,7 @@
const stack: { row: number; col: number }[] = [{ row, col }];

while (stack.length > 0) {
const pos = stack.pop()!;

Check warning on line 45 in src/core/logic.ts

View workflow job for this annotation

GitHub Actions / lint_test (26.x, ubuntu-latest)

Forbidden non-null assertion

Check warning on line 45 in src/core/logic.ts

View workflow job for this annotation

GitHub Actions / lint_test (26.x, macos-latest)

Forbidden non-null assertion

Check warning on line 45 in src/core/logic.ts

View workflow job for this annotation

GitHub Actions / lint_test (24.x, ubuntu-latest)

Forbidden non-null assertion

Check warning on line 45 in src/core/logic.ts

View workflow job for this annotation

GitHub Actions / lint_test (24.x, macos-latest)

Forbidden non-null assertion

Check warning on line 45 in src/core/logic.ts

View workflow job for this annotation

GitHub Actions / lint_test (24.x, windows-latest)

Forbidden non-null assertion

Check warning on line 45 in src/core/logic.ts

View workflow job for this annotation

GitHub Actions / lint_test (26.x, windows-latest)

Forbidden non-null assertion
const r = pos.row;
const c = pos.col;

Expand All @@ -67,10 +62,7 @@
}

// Check if a group has any liberties (empty adjacent spaces)
function hasLiberties(
board: GoBoard,
group: { row: number; col: number }[],
): boolean {
function hasLiberties(board: GoBoard, group: { row: number; col: number }[]): boolean {
for (const { row, col } of group) {
for (const [dr, dc] of DIRECTIONS) {
const r = row + dr;
Expand All @@ -84,10 +76,7 @@
}

// Remove captured stones and return count
function removeCapturedStones(
board: GoBoard,
opponentSide: Side,
): { board: GoBoard; capturedCount: number } {
function removeCapturedStones(board: GoBoard, opponentSide: Side): { board: GoBoard; capturedCount: number } {
const newBoard = copyBoard(board);
const visited: boolean[][] = Array(BOARD_SIZE)
.fill(null)
Expand All @@ -113,12 +102,7 @@
}

// Check if a move is legal (not suicide rule)
function isLegalMove(
board: GoBoard,
row: number,
col: number,
side: Side,
): boolean {
function isLegalMove(board: GoBoard, row: number, col: number, side: Side): boolean {
// Position must be empty
if (board[row][col] !== ".") {
return false;
Expand All @@ -130,10 +114,7 @@

// First, check if this move captures opponent stones
const opponentSide = getOpponent(side);
const { board: boardAfterCapture } = removeCapturedStones(
testBoard,
opponentSide,
);
const { board: boardAfterCapture } = removeCapturedStones(testBoard, opponentSide);

// Then check if our own group has liberties (suicide rule)
const visited: boolean[][] = Array(BOARD_SIZE)
Expand All @@ -144,21 +125,13 @@
return hasLiberties(boardAfterCapture, ourGroup);
}

function makeMove(
board: GoBoard,
row: number,
col: number,
side: Side,
): { newBoard: GoBoard; capturedCount: number } {
function makeMove(board: GoBoard, row: number, col: number, side: Side): { newBoard: GoBoard; capturedCount: number } {
const newBoard = copyBoard(board);
newBoard[row][col] = side;

// Remove captured opponent stones
const opponentSide = getOpponent(side);
const { board: finalBoard, capturedCount } = removeCapturedStones(
newBoard,
opponentSide,
);
const { board: finalBoard, capturedCount } = removeCapturedStones(newBoard, opponentSide);

return { newBoard: finalBoard, capturedCount };
}
Expand Down Expand Up @@ -201,7 +174,7 @@
const adjacentColors = new Set<Cell>();

while (stack.length > 0) {
const pos = stack.pop()!;

Check warning on line 177 in src/core/logic.ts

View workflow job for this annotation

GitHub Actions / lint_test (26.x, ubuntu-latest)

Forbidden non-null assertion

Check warning on line 177 in src/core/logic.ts

View workflow job for this annotation

GitHub Actions / lint_test (26.x, macos-latest)

Forbidden non-null assertion

Check warning on line 177 in src/core/logic.ts

View workflow job for this annotation

GitHub Actions / lint_test (24.x, ubuntu-latest)

Forbidden non-null assertion

Check warning on line 177 in src/core/logic.ts

View workflow job for this annotation

GitHub Actions / lint_test (24.x, macos-latest)

Forbidden non-null assertion

Check warning on line 177 in src/core/logic.ts

View workflow job for this annotation

GitHub Actions / lint_test (24.x, windows-latest)

Forbidden non-null assertion

Check warning on line 177 in src/core/logic.ts

View workflow job for this annotation

GitHub Actions / lint_test (26.x, windows-latest)

Forbidden non-null assertion
const r = pos.row;
const c = pos.col;

Expand Down Expand Up @@ -235,10 +208,7 @@
return { B: territoryB, W: territoryW };
}

function determineWinner(
board: GoBoard,
capturedStones: { B: number; W: number },
): Side | "draw" | null {
function determineWinner(board: GoBoard, capturedStones: { B: number; W: number }): Side | "draw" | null {
const counts = countStones(board);
const territory = calculateTerritory(board);

Expand Down Expand Up @@ -271,13 +241,7 @@
}

if (cmd.action === "pass") {
const {
board,
currentSide,
playerNames,
capturedStones,
consecutivePasses,
} = cmd;
const { board, currentSide, playerNames, capturedStones, consecutivePasses } = cmd;
const nextSide = getOpponent(currentSide);
const counts = countStones(board);
const newConsecutivePasses = consecutivePasses + 1;
Expand Down
41 changes: 8 additions & 33 deletions src/core/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import { playGo } from "./logic";
export { TOOL_NAME, TOOL_DEFINITION, SYSTEM_PROMPT } from "./definition";
export { playGo } from "./logic";

export const executeGo = async (
_context: ToolContext,
args: GoArgs,
): Promise<ToolResult<never, GoState>> => {
export const executeGo = async (_context: ToolContext, args: GoArgs): Promise<ToolResult<never, GoState>> => {
try {
let command: Command;

Expand All @@ -31,17 +28,8 @@ export const executeGo = async (
playerNames: { B: blackPlayer, W: whitePlayer },
};
} else if (args.action === "move") {
if (
typeof args.row !== "number" ||
typeof args.col !== "number" ||
!args.board ||
!args.currentSide ||
!args.playerNames ||
!args.capturedStones
) {
throw new Error(
"Move action requires row, col, board, currentSide, playerNames, and capturedStones parameters",
);
if (typeof args.row !== "number" || typeof args.col !== "number" || !args.board || !args.currentSide || !args.playerNames || !args.capturedStones) {
throw new Error("Move action requires row, col, board, currentSide, playerNames, and capturedStones parameters");
}
command = {
action: "move",
Expand All @@ -53,16 +41,8 @@ export const executeGo = async (
capturedStones: args.capturedStones,
};
} else if (args.action === "pass") {
if (
!args.board ||
!args.currentSide ||
!args.playerNames ||
!args.capturedStones ||
typeof args.consecutivePasses !== "number"
) {
throw new Error(
"Pass action requires board, currentSide, playerNames, capturedStones, and consecutivePasses parameters",
);
if (!args.board || !args.currentSide || !args.playerNames || !args.capturedStones || typeof args.consecutivePasses !== "number") {
throw new Error("Pass action requires board, currentSide, playerNames, capturedStones, and consecutivePasses parameters");
}
command = {
action: "pass",
Expand All @@ -80,8 +60,7 @@ export const executeGo = async (

// Handle invalid move
if (state.error) {
const isComputerTurn =
state.playerNames[state.currentSide] === "computer";
const isComputerTurn = state.playerNames[state.currentSide] === "computer";

const instructions = isComputerTurn
? `Invalid move attempted. You must make a valid move. Choose an empty intersection where placing a stone would not result in immediate capture (suicide rule).`
Expand All @@ -99,10 +78,7 @@ export const executeGo = async (
if (state.lastAction.type === "new_game") {
message = "Started a new Go game on a 9x9 board! Black (●) goes first.";
} else if (state.lastAction.type === "move") {
const captureMsg =
state.lastAction.captured > 0
? ` and captured ${state.lastAction.captured} stone${state.lastAction.captured > 1 ? "s" : ""}`
: "";
const captureMsg = state.lastAction.captured > 0 ? ` and captured ${state.lastAction.captured} stone${state.lastAction.captured > 1 ? "s" : ""}` : "";
message = `Played at (${state.lastAction.row}, ${state.lastAction.col})${captureMsg}.`;
} else if (state.lastAction.type === "pass") {
message = "Passed the turn.";
Expand Down Expand Up @@ -137,8 +113,7 @@ export const executeGo = async (
console.error("ERR: exception\n Go game error", error);
return {
message: `Go game error: ${error instanceof Error ? error.message : "Unknown error"}`,
instructions:
"Acknowledge that there was an error with the Go game and suggest trying again.",
instructions: "Acknowledge that there was an error with the Go game and suggest trying again.",
};
}
};
Expand Down
5 changes: 1 addition & 4 deletions src/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ export interface GoState {
isTerminal: boolean;
winner: Side | "draw" | null;
consecutivePasses: number;
lastAction:
| { type: "new_game" }
| { type: "move"; row: number; col: number; captured: number }
| { type: "pass" };
lastAction: { type: "new_game" } | { type: "move"; row: number; col: number; captured: number } | { type: "pass" };
error?: string;
}

Expand Down
Loading
Loading