chesspal 0.3.1 → 0.3.3

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.
Files changed (185) hide show
  1. package/README.md +1 -1
  2. package/dist/cli/cli.js +6 -6
  3. package/dist/commands/{analyse-game.d.ts → analysis/analyse.d.ts} +2 -2
  4. package/dist/commands/{analyse-game.js → analysis/analyse.js} +7 -11
  5. package/dist/commands/{annotate-game.d.ts → analysis/annotate.d.ts} +1 -1
  6. package/dist/commands/{annotate-game.js → analysis/annotate.js} +6 -9
  7. package/dist/commands/{delete-review.d.ts → analysis/delete-review.d.ts} +1 -1
  8. package/dist/commands/{delete-review.js → analysis/delete-review.js} +5 -5
  9. package/dist/commands/analysis/index.d.ts +4 -0
  10. package/dist/commands/analysis/index.js +5 -0
  11. package/dist/commands/{study-games.d.ts → analysis/study-games.d.ts} +1 -1
  12. package/dist/commands/{study-games.js → analysis/study-games.js} +4 -5
  13. package/dist/commands/{agents.d.ts → answers/agents.d.ts} +4 -4
  14. package/dist/commands/{agents.js → answers/agents.js} +13 -9
  15. package/dist/commands/{clock.d.ts → answers/clock.d.ts} +2 -2
  16. package/dist/commands/{clock.js → answers/clock.js} +2 -2
  17. package/dist/commands/{drawings.d.ts → answers/drawings.d.ts} +1 -1
  18. package/dist/commands/{drawings.js → answers/drawings.js} +1 -1
  19. package/dist/commands/answers/index.d.ts +12 -0
  20. package/dist/commands/answers/index.js +14 -0
  21. package/dist/commands/{lead-input.d.ts → answers/lead-input.d.ts} +1 -1
  22. package/dist/commands/{lead-input.js → answers/lead-input.js} +1 -1
  23. package/dist/commands/{answer-lines.d.ts → answers/lines.d.ts} +2 -2
  24. package/dist/commands/{answer-lines.js → answers/lines.js} +4 -4
  25. package/dist/commands/{opening-book.d.ts → answers/opening-book.d.ts} +1 -1
  26. package/dist/commands/{opening-book.js → answers/opening-book.js} +3 -3
  27. package/dist/commands/{play-move.d.ts → answers/play-move.d.ts} +2 -2
  28. package/dist/commands/{play-move.js → answers/play-move.js} +3 -3
  29. package/dist/commands/{say.d.ts → answers/say.d.ts} +3 -3
  30. package/dist/commands/{say.js → answers/say.js} +4 -4
  31. package/dist/commands/{speech.js → answers/speech.js} +1 -1
  32. package/dist/commands/{study.d.ts → answers/study.d.ts} +3 -3
  33. package/dist/commands/{study.js → answers/study.js} +3 -3
  34. package/dist/commands/{game-summary.d.ts → answers/summary.d.ts} +2 -2
  35. package/dist/commands/{game-summary.js → answers/summary.js} +4 -4
  36. package/dist/commands/{view.d.ts → answers/view.d.ts} +1 -1
  37. package/dist/commands/{ai-move.d.ts → game/ai-move.d.ts} +2 -2
  38. package/dist/commands/{ai-move.js → game/ai-move.js} +6 -11
  39. package/dist/commands/{coach.d.ts → game/coach.d.ts} +1 -1
  40. package/dist/commands/{coach.js → game/coach.js} +7 -13
  41. package/dist/commands/{draw-offer.d.ts → game/draw-offer.d.ts} +1 -1
  42. package/dist/commands/{draw-offer.js → game/draw-offer.js} +4 -4
  43. package/dist/commands/{end-game.d.ts → game/end.d.ts} +2 -2
  44. package/dist/commands/{end-game.js → game/end.js} +5 -9
  45. package/dist/commands/{export-game.d.ts → game/export.d.ts} +1 -1
  46. package/dist/commands/{export-game.js → game/export.js} +4 -4
  47. package/dist/commands/game/index.d.ts +11 -0
  48. package/dist/commands/game/index.js +13 -0
  49. package/dist/commands/{levels.d.ts → game/levels.d.ts} +3 -3
  50. package/dist/commands/{levels.js → game/levels.js} +3 -3
  51. package/dist/commands/{look.d.ts → game/look.d.ts} +3 -4
  52. package/dist/commands/{look.js → game/look.js} +5 -10
  53. package/dist/commands/{new-game.d.ts → game/new.d.ts} +3 -4
  54. package/dist/commands/{new-game.js → game/new.js} +17 -13
  55. package/dist/commands/{page-link.d.ts → game/page-link.d.ts} +1 -1
  56. package/dist/commands/{player-move.d.ts → game/player-move.d.ts} +2 -2
  57. package/dist/commands/{player-move.js → game/player-move.js} +4 -8
  58. package/dist/commands/{ponder.d.ts → game/ponder.d.ts} +3 -3
  59. package/dist/commands/{ponder.js → game/ponder.js} +6 -9
  60. package/dist/commands/{position.d.ts → game/position.d.ts} +2 -2
  61. package/dist/commands/{position.js → game/position.js} +5 -7
  62. package/dist/commands/{status.d.ts → game/status.d.ts} +2 -4
  63. package/dist/commands/{status.js → game/status.js} +12 -17
  64. package/dist/commands/index.d.ts +6 -17
  65. package/dist/commands/index.js +11 -38
  66. package/dist/commands/{delete-game.d.ts → profiles/delete-game.d.ts} +1 -1
  67. package/dist/commands/{delete-game.js → profiles/delete-game.js} +3 -3
  68. package/dist/commands/profiles/index.d.ts +4 -0
  69. package/dist/commands/profiles/index.js +5 -0
  70. package/dist/commands/{past-games.d.ts → profiles/past-games.d.ts} +1 -1
  71. package/dist/commands/{past-games.js → profiles/past-games.js} +5 -5
  72. package/dist/commands/{profiles.d.ts → profiles/profiles.d.ts} +7 -7
  73. package/dist/commands/{profiles.js → profiles/profiles.js} +4 -4
  74. package/dist/commands/{ratings.d.ts → profiles/ratings.d.ts} +1 -1
  75. package/dist/commands/{ratings.js → profiles/ratings.js} +2 -2
  76. package/dist/commands/{context.js → registry/context.js} +2 -2
  77. package/dist/commands/registry/index.d.ts +2 -0
  78. package/dist/commands/registry/index.js +3 -0
  79. package/dist/commands/setup/index.d.ts +2 -0
  80. package/dist/commands/setup/index.js +3 -0
  81. package/dist/commands/{init.d.ts → setup/init.d.ts} +1 -1
  82. package/dist/commands/{init.js → setup/init.js} +2 -3
  83. package/dist/commands/{instructions.d.ts → setup/instructions.d.ts} +2 -2
  84. package/dist/commands/{instructions.js → setup/instructions.js} +3 -3
  85. package/dist/commands/{ai-say.d.ts → talk/ai-say.d.ts} +2 -3
  86. package/dist/commands/{ai-say.js → talk/ai-say.js} +5 -9
  87. package/dist/commands/talk/index.d.ts +2 -0
  88. package/dist/commands/talk/index.js +3 -0
  89. package/dist/commands/{player-say.d.ts → talk/player-say.d.ts} +1 -1
  90. package/dist/commands/{player-say.js → talk/player-say.js} +4 -4
  91. package/dist/page/app/app.js +53 -21
  92. package/dist/page/app/served.js +15 -3
  93. package/dist/page/avatars/torretta.js +10 -3
  94. package/dist/page/dialogs/dialogs.css +10 -0
  95. package/dist/page/dialogs/profiles.js +1 -5
  96. package/dist/page/dialogs/settings.js +18 -4
  97. package/dist/page/game/column.js +1 -1
  98. package/dist/page/game/game.css +26 -3
  99. package/dist/page/guide/blocks.js +13 -2
  100. package/dist/page/guide/credits.js +6 -0
  101. package/dist/page/guide/drawings/analysis.js +13 -0
  102. package/dist/page/guide/drawings/drawings.css +329 -0
  103. package/dist/page/guide/drawings/drawings.js +15 -0
  104. package/dist/page/guide/drawings/game.js +15 -0
  105. package/dist/page/guide/drawings/helps.js +13 -0
  106. package/dist/page/guide/drawings/how-it-works.js +13 -0
  107. package/dist/page/guide/drawings/parts.js +103 -0
  108. package/dist/page/guide/drawings/players.js +19 -0
  109. package/dist/page/guide/drawings/talk.js +9 -0
  110. package/dist/page/guide/en.md +39 -25
  111. package/dist/page/guide/guide.css +123 -91
  112. package/dist/page/guide/guide.js +47 -25
  113. package/dist/page/guide/it.md +39 -25
  114. package/dist/page/guide/markdown.js +5 -0
  115. package/dist/page/helps/helps.css +201 -88
  116. package/dist/page/helps/helps.js +50 -31
  117. package/dist/page/helps/view.js +13 -3
  118. package/dist/page/{guide/foot.js → layout/footer.js} +7 -8
  119. package/dist/page/layout/header.js +5 -3
  120. package/dist/page/layout/layout.css +114 -10
  121. package/dist/page/layout/window.js +6 -26
  122. package/dist/page/main.js +1 -1
  123. package/dist/page/pieces/pieces.js +5 -2
  124. package/dist/page/style.css +1 -0
  125. package/dist/page/table/table.css +69 -0
  126. package/dist/page/table/update.js +82 -0
  127. package/dist/page/table/window.js +6 -5
  128. package/dist/page/talk/chat.css +6 -6
  129. package/dist/page/talk/talk.css +17 -67
  130. package/dist/page/talk/talk.js +6 -6
  131. package/dist/page/talk/voice.js +12 -0
  132. package/dist/page/text.js +78 -20
  133. package/dist/page/theme.css +2 -0
  134. package/dist/server/{bell.js → bell/bell.js} +17 -4
  135. package/dist/server/bell/index.d.ts +1 -0
  136. package/dist/server/bell/index.js +2 -0
  137. package/dist/server/{caller.d.ts → mcp/caller.d.ts} +1 -1
  138. package/dist/server/{caller.js → mcp/caller.js} +1 -1
  139. package/dist/server/mcp/index.d.ts +1 -0
  140. package/dist/server/mcp/index.js +2 -0
  141. package/dist/server/{mcp.d.ts → mcp/mcp.d.ts} +1 -1
  142. package/dist/server/{mcp.js → mcp/mcp.js} +9 -9
  143. package/dist/server/page/attach.js +8 -3
  144. package/dist/server/page/game.js +19 -3
  145. package/dist/server/page/http.d.ts +1 -1
  146. package/dist/server/page/index.d.ts +3 -0
  147. package/dist/server/page/index.js +3 -0
  148. package/dist/server/page/page.d.ts +12 -3
  149. package/dist/server/page/page.js +26 -5
  150. package/dist/server/page/table.d.ts +7 -1
  151. package/dist/server/page/table.js +79 -3
  152. package/dist/server/page/update.d.ts +18 -0
  153. package/dist/server/page/update.js +40 -0
  154. package/dist/server/table/browser.d.ts +1 -1
  155. package/dist/server/table/browser.js +1 -1
  156. package/dist/server/table/hosts/chats.d.ts +1 -1
  157. package/dist/server/table/hosts/chats.js +2 -2
  158. package/dist/server/table/hosts/index.d.ts +1 -1
  159. package/dist/server/table/hosts/index.js +1 -1
  160. package/dist/server/table/hosts/play.d.ts +8 -1
  161. package/dist/server/table/hosts/play.js +40 -4
  162. package/dist/server/table/hosts/seat.d.ts +5 -1
  163. package/dist/server/table/hosts/seat.js +1 -1
  164. package/dist/server/table/index.d.ts +3 -2
  165. package/dist/server/table/index.js +3 -2
  166. package/dist/server/table/launch.d.ts +5 -2
  167. package/dist/server/table/launch.js +6 -3
  168. package/dist/server/table/link.d.ts +1 -1
  169. package/dist/server/table/link.js +3 -3
  170. package/dist/server/table/table.d.ts +4 -5
  171. package/dist/server/table/table.js +15 -12
  172. package/dist/server/table/update.d.ts +17 -0
  173. package/dist/server/table/update.js +77 -0
  174. package/dist/sites/index.d.ts +1 -1
  175. package/dist/sites/index.js +2 -2
  176. package/dist/version.d.ts +4 -0
  177. package/dist/version.js +12 -1
  178. package/package.json +1 -1
  179. /package/dist/commands/{speech.d.ts → answers/speech.d.ts} +0 -0
  180. /package/dist/commands/{view.js → answers/view.js} +0 -0
  181. /package/dist/commands/{page-link.js → game/page-link.js} +0 -0
  182. /package/dist/commands/{context.d.ts → registry/context.d.ts} +0 -0
  183. /package/dist/commands/{registry.d.ts → registry/registry.d.ts} +0 -0
  184. /package/dist/commands/{registry.js → registry/registry.js} +0 -0
  185. /package/dist/server/{bell.d.ts → bell/bell.d.ts} +0 -0
@@ -1,4 +1,4 @@
1
- import type { Context } from "./context.ts";
1
+ import type { Context } from "../registry/index.ts";
2
2
  /** A draw offer or answer refused, and why, for the page to say it in the player's language: one stands already, none stands, or no side has moved yet. */
3
3
  export declare class DrawRefused extends Error {
4
4
  readonly reason: "offered" | "none" | "early";
@@ -1,8 +1,8 @@
1
1
  // The draw offers of the board page (D-65): the player's, made on their turn as on Lichess, and their answer to the AI's, which ai_move makes with its move.
2
- import { bothSidesMoved, drawOfferOf, saveGame } from "../games/index.js";
3
- import { gameFolder } from "../profiles/index.js";
4
- import { endGame } from "./end-game.js";
5
- import { gameGoingOn } from "./game-summary.js";
2
+ import { bothSidesMoved, drawOfferOf, saveGame } from "../../games/index.js";
3
+ import { gameFolder } from "../../profiles/index.js";
4
+ import { gameGoingOn } from "../answers/index.js";
5
+ import { endGame } from "./end.js";
6
6
  /** A draw offer or answer refused, and why, for the page to say it in the player's language: one stands already, none stands, or no side has moved yet. */
7
7
  export class DrawRefused extends Error {
8
8
  reason;
@@ -1,11 +1,11 @@
1
1
  import { z } from "zod";
2
- import { type GameSummary } from "./game-summary.ts";
2
+ import { type GameSummary } from "../answers/index.ts";
3
3
  interface Ended {
4
4
  game: GameSummary;
5
5
  warning?: string;
6
6
  }
7
7
  /** The endings the board cannot see: a resignation, a draw agreed on an offer (D-65). Checkmate, stalemate and the draws by rule end the game by themselves (D-37). */
8
- export declare const endGame: import("./registry.ts").Command<z.ZodObject<{
8
+ export declare const endGame: import("../registry/registry.ts").Command<z.ZodObject<{
9
9
  result: z.ZodEnum<{
10
10
  player_resigns: "player_resigns";
11
11
  ai_resigns: "ai_resigns";
@@ -1,13 +1,9 @@
1
1
  import { z } from "zod";
2
- import { canMate, endWithMood, Game, moods, timeLeft } from "../core/index.js";
3
- import { archiveEnded, bothSidesMoved, drawOfferOf, saveGame } from "../games/index.js";
4
- import { gameFolder } from "../profiles/index.js";
5
- import { withAnalyst } from "./agents.js";
6
- import { nextStep, positionLines } from "./answer-lines.js";
7
- import { gameGoingOn, summaryOf } from "./game-summary.js";
8
- import { refuseUnseenPosition } from "./play-move.js";
9
- import { defineCommand } from "./registry.js";
10
- import { colourName } from "./view.js";
2
+ import { canMate, endWithMood, Game, moods, timeLeft } from "../../core/index.js";
3
+ import { archiveEnded, bothSidesMoved, drawOfferOf, saveGame } from "../../games/index.js";
4
+ import { gameFolder } from "../../profiles/index.js";
5
+ import { colourName, gameGoingOn, nextStep, positionLines, refuseUnseenPosition, summaryOf, withAnalyst } from "../answers/index.js";
6
+ import { defineCommand } from "../registry/index.js";
11
7
  /** The endings the board cannot see: a resignation, a draw agreed on an offer (D-65). Checkmate, stalemate and the draws by rule end the game by themselves (D-37). */
12
8
  export const endGame = defineCommand({
13
9
  name: "end_game",
@@ -4,7 +4,7 @@ interface Exported {
4
4
  text: string;
5
5
  }
6
6
  /** The game as PGN or its position as FEN, for the player to copy or keep: the plans stay hidden while it goes on (D-29); the moves alone for another site. */
7
- export declare const exportGame: import("./registry.ts").Command<z.ZodObject<{
7
+ export declare const exportGame: import("../registry/registry.ts").Command<z.ZodObject<{
8
8
  format: z.ZodEnum<{
9
9
  fen: "fen";
10
10
  moves: "moves";
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod";
2
- import { movesPgn, playerPgn } from "../games/index.js";
3
- import { gameFolder } from "../profiles/index.js";
4
- import { gameAt } from "./clock.js";
5
- import { defineCommand } from "./registry.js";
2
+ import { movesPgn, playerPgn } from "../../games/index.js";
3
+ import { gameFolder } from "../../profiles/index.js";
4
+ import { gameAt } from "../answers/index.js";
5
+ import { defineCommand } from "../registry/index.js";
6
6
  /** The game as PGN or its position as FEN, for the player to copy or keep: the plans stay hidden while it goes on (D-29); the moves alone for another site. */
7
7
  export const exportGame = defineCommand({
8
8
  name: "export",
@@ -0,0 +1,11 @@
1
+ export { aiMove } from "./ai-move.ts";
2
+ export { coach } from "./coach.ts";
3
+ export { answerDraw, DrawRefused, offerDraw } from "./draw-offer.ts";
4
+ export { endGame } from "./end.ts";
5
+ export { exportGame } from "./export.ts";
6
+ export { look } from "./look.ts";
7
+ export { ChatNotClear, newGame, startNewGame } from "./new.ts";
8
+ export { playerMove } from "./player-move.ts";
9
+ export { ponder } from "./ponder.ts";
10
+ export { position } from "./position.ts";
11
+ export { status } from "./status.ts";
@@ -0,0 +1,13 @@
1
+ // The commands of the game being played: started, moved, looked at, offered a draw, ended and exported; the AI's pondering while the player thinks,
2
+ // and the coach beside the player.
3
+ export { aiMove } from "./ai-move.js";
4
+ export { coach } from "./coach.js";
5
+ export { answerDraw, DrawRefused, offerDraw } from "./draw-offer.js";
6
+ export { endGame } from "./end.js";
7
+ export { exportGame } from "./export.js";
8
+ export { look } from "./look.js";
9
+ export { ChatNotClear, newGame, startNewGame } from "./new.js";
10
+ export { playerMove } from "./player-move.js";
11
+ export { ponder } from "./ponder.js";
12
+ export { position } from "./position.js";
13
+ export { status } from "./status.js";
@@ -1,6 +1,6 @@
1
- import { type AiLevel, type Layer } from "../core/index.ts";
2
- import { type CurrentGame } from "../games/index.ts";
3
- import type { Context } from "./context.ts";
1
+ import { type AiLevel, type Layer } from "../../core/index.ts";
2
+ import { type CurrentGame } from "../../games/index.ts";
3
+ import type { Context } from "../registry/index.ts";
4
4
  /** The level of a new game when the call names none: the game before's, else the one that suits the player in use, else the level before levels came. */
5
5
  export declare function levelToPlay(context: Context, before: CurrentGame | undefined): AiLevel;
6
6
  /** The level and what the AI sees at it, in few words: at the club level (board and tactical facts: no position). */
@@ -1,7 +1,7 @@
1
1
  // The level of a game as the AI reads it (D-60, D-61): what it sees, and the refusal of a tool its level does not give.
2
- import { levelOf, sees, suggestedLevel } from "../core/index.js";
3
- import { endOf } from "../games/index.js";
4
- import { activeProfile } from "../profiles/index.js";
2
+ import { levelOf, sees, suggestedLevel } from "../../core/index.js";
3
+ import { endOf } from "../../games/index.js";
4
+ import { activeProfile } from "../../profiles/index.js";
5
5
  /** The level of a new game when the call names none: the game before's, else the one that suits the player in use, else the level before levels came. */
6
6
  export function levelToPlay(context, before) {
7
7
  return suggestedLevel(before?.game.record, before === undefined ? activeProfile(context.home()).level : undefined);
@@ -1,7 +1,6 @@
1
1
  import { z } from "zod";
2
- import { type Chances, type Facts, type Possibilities, type Side } from "../core/index.ts";
3
- import { type GameSummary } from "./game-summary.ts";
4
- import { type Written } from "./say.ts";
2
+ import { type Chances, type Facts, type Possibilities, type Side } from "../../core/index.ts";
3
+ import { type GameSummary, type Written } from "../answers/index.ts";
5
4
  /** The game with the facts, the possibilities and the threats of its position, whoever is to move. */
6
5
  type Viewed = GameSummary & {
7
6
  facts: Facts;
@@ -17,7 +16,7 @@ interface StudyView {
17
16
  threats: Chances | undefined;
18
17
  }
19
18
  /** The whole view (D-26), when the compact one after the player's move is not enough; or the board for the player, where the host does not show it (D-36). */
20
- export declare const look: import("./registry.ts").Command<z.ZodObject<{
19
+ export declare const look: import("../registry/registry.ts").Command<z.ZodObject<{
21
20
  game: z.ZodOptional<z.ZodString>;
22
21
  move: z.ZodOptional<z.ZodString>;
23
22
  only: z.ZodOptional<z.ZodEnum<{
@@ -1,15 +1,10 @@
1
1
  import { z } from "zod";
2
- import { boardText, materialOf, sees } from "../core/index.js";
3
- import { analystAgent } from "../host-files/index.js";
4
- import { gameFolder } from "../profiles/index.js";
5
- import { headLines, wordLines } from "./answer-lines.js";
6
- import { gameAt } from "./clock.js";
7
- import { summaryOf } from "./game-summary.js";
2
+ import { boardText, materialOf, sees } from "../../core/index.js";
3
+ import { analystAgent } from "../../host-files/index.js";
4
+ import { gameFolder } from "../../profiles/index.js";
5
+ import { fullView, gameAt, gameShown, headLines, materialText, newWords, positionAfter, positionLine, studyInput, summaryOf, wordLines } from "../answers/index.js";
6
+ import { defineCommand } from "../registry/index.js";
8
7
  import { refuseUnseen } from "./levels.js";
9
- import { defineCommand } from "./registry.js";
10
- import { newWords } from "./say.js";
11
- import { gameShown, positionAfter, positionLine, studyInput } from "./study.js";
12
- import { fullView, materialText } from "./view.js";
13
8
  /** The whole view (D-26), when the compact one after the player's move is not enough; or the board for the player, where the host does not show it (D-36). */
14
9
  export const look = defineCommand({
15
10
  name: "look",
@@ -1,7 +1,6 @@
1
1
  import { z } from "zod";
2
- import type { Context } from "./context.ts";
3
- import { type GameSummary } from "./game-summary.ts";
4
- import { type Speech } from "./speech.ts";
2
+ import { type GameSummary, type Speech } from "../answers/index.ts";
3
+ import { type Context } from "../registry/index.ts";
5
4
  interface NewGame {
6
5
  game: GameSummary;
7
6
  /** Where the game before went: one going on, unfinished; one over, when its archive could not be written at its end. */
@@ -40,7 +39,7 @@ declare const newGameInput: z.ZodObject<{
40
39
  replace: z.ZodDefault<z.ZodBoolean>;
41
40
  }, z.core.$strip>;
42
41
  /** A new game against the player, from the standard position or from a FEN or PGN; a game going on is never lost (D-41). */
43
- export declare const newGame: import("./registry.ts").Command<z.ZodObject<{
42
+ export declare const newGame: import("../registry/registry.ts").Command<z.ZodObject<{
44
43
  ai_colour: z.ZodOptional<z.ZodEnum<{
45
44
  white: "white";
46
45
  black: "black";
@@ -1,18 +1,12 @@
1
1
  import { z } from "zod";
2
- import { aiLevels, Game, levelTag, pgnDate, readPgn, startClock, timeControlOf, timeControlTag, withoutMoods } from "../core/index.js";
3
- import { archivedName, archiveGame, cleanSince, endAnalysis, endOf, endTableTalk, lastChatStart, loadGame, saveGame, startOfNewGame, withoutPlans } from "../games/index.js";
4
- import { gameFolder, gameFolders } from "../profiles/index.js";
5
- import { coachRuns } from "./agents.js";
6
- import { nextStep, positionLines, sidesLine } from "./answer-lines.js";
7
- import { gameAt } from "./clock.js";
8
- import { summaryOf, withThought } from "./game-summary.js";
2
+ import { aiLevels, Game, levelTag, pgnDate, readPgn, startClock, timeControlOf, timeControlTag, withoutMoods } from "../../core/index.js";
3
+ import { archivedName, archiveGame, cleanSince, endAnalysis, endOf, endTableTalk, lastChatStart, loadGame, saveGame, startOfNewGame, withoutPlans } from "../../games/index.js";
4
+ import { gameFolder, gameFolders } from "../../profiles/index.js";
5
+ import { coachRuns, gameAt, nextStep, positionLines, refuseUnseenPosition, sidesLine, speechLine, speechOf, summaryOf, withThought } from "../answers/index.js";
6
+ import { pastGameLines, playerLine } from "../profiles/index.js";
7
+ import { defineCommand } from "../registry/index.js";
9
8
  import { levelText, levelToPlay } from "./levels.js";
10
9
  import { closedPage, pageGiven, pageLine } from "./page-link.js";
11
- import { pastGameLines } from "./past-games.js";
12
- import { refuseUnseenPosition } from "./play-move.js";
13
- import { playerLine } from "./profiles.js";
14
- import { defineCommand } from "./registry.js";
15
- import { speechLine, speechOf } from "./speech.js";
16
10
  const newGameInput = z.object({
17
11
  ai_colour: z.enum(["white", "black", "random"]).optional().describe("the colour you play: random draws it; left out with the rest, the page's window asks"),
18
12
  from: z.string().optional().describe("a FEN or a PGN to go on from, instead of the standard position"),
@@ -112,12 +106,17 @@ function startedLines({ game, archived, past, player, speech, closedPage: closed
112
106
  }
113
107
  /**
114
108
  * The New game window opened on the board page, or its address for the player to open it first; a chat to clear refuses it as a new game does (D-57), and
115
- * without the page the player is asked in the chat.
109
+ * without the page the player is asked in the chat. A game just begun, with no move yet, is the one the player chose there: the chat the table started
110
+ * again for it would open the window over it (Priya).
116
111
  */
117
112
  function askedOnPage(context) {
118
113
  if (chatToClear(context)) {
119
114
  throw new ChatNotClear();
120
115
  }
116
+ if (context.page !== undefined && justBegun(context)) {
117
+ throw new Error("A new game has just begun on the board page, with no move yet: don't open another. Call status to see it; when the player wants another game, "
118
+ + "the page's New game button starts it. Nothing changed.");
119
+ }
121
120
  if (context.askNewGame?.() === true) {
122
121
  return { window: "opened" };
123
122
  }
@@ -127,6 +126,11 @@ function askedOnPage(context) {
127
126
  throw new Error("There is no board page here: ask the player which colour they want, whether they want a clock and at which level you play, then call new_game with "
128
127
  + "them. Nothing changed.");
129
128
  }
129
+ /** Whether a game is going on with no move played yet. */
130
+ function justBegun(context) {
131
+ const current = gameAt(gameFolder(context.home()), context.now());
132
+ return current !== undefined && endOf(current.game) === undefined && current.game.record.moves.length === 0;
133
+ }
130
134
  function askedLine({ window, page }) {
131
135
  return window === "opened"
132
136
  ? "The New game window is open on the board page: the player chooses the game there. Don't ask in the chat; end your turn, the doorbell wakes you when "
@@ -1,4 +1,4 @@
1
- import type { Context } from "./context.ts";
1
+ import type { Context } from "../registry/index.ts";
2
2
  /** The board page's address when the chat serves it and no browser has it open; none on the command line, or with the page open. */
3
3
  export declare function closedPage(context: Context): string | undefined;
4
4
  /** The board page's address once a game, for a move written in the chat while no browser has the page open: the game is played there (D-85). */
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
- import { type MovePlayed } from "./game-summary.ts";
2
+ import { type MovePlayed } from "../answers/index.ts";
3
3
  /** The player's move, written in the chat and given by the AI: it answers with the position the AI decides on (D-34). */
4
- export declare const playerMove: import("./registry.ts").Command<z.ZodObject<{
4
+ export declare const playerMove: import("../registry/registry.ts").Command<z.ZodObject<{
5
5
  move: z.ZodString;
6
6
  offer_draw: z.ZodOptional<z.ZodBoolean>;
7
7
  }, z.core.$strip>, PlayerMove>;
@@ -1,13 +1,9 @@
1
1
  import { z } from "zod";
2
- import { loadGame } from "../games/index.js";
3
- import { gameFolder } from "../profiles/index.js";
4
- import { coachOnEnd, coachOnEndLine, coachRuns, withAnalyst } from "./agents.js";
5
- import { closingLines, lastMoveText, moveLines, shownMove } from "./answer-lines.js";
6
- import {} from "./game-summary.js";
2
+ import { loadGame } from "../../games/index.js";
3
+ import { gameFolder } from "../../profiles/index.js";
4
+ import { closingLines, coachOnEnd, coachOnEndLine, coachRuns, lastMoveText, moveLines, newWords, playMove, positionIn, refuseUnseenPosition, shownMove, withAnalyst } from "../answers/index.js";
5
+ import { defineCommand } from "../registry/index.js";
7
6
  import { inviteLine, pageInvite } from "./page-link.js";
8
- import { playMove, positionIn, refuseUnseenPosition } from "./play-move.js";
9
- import { defineCommand } from "./registry.js";
10
- import { newWords } from "./say.js";
11
7
  /** The player's move, written in the chat and given by the AI: it answers with the position the AI decides on (D-34). */
12
8
  export const playerMove = defineCommand({
13
9
  name: "player_move",
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { type Thought } from "../games/index.ts";
3
- import { type GameSummary } from "./game-summary.ts";
2
+ import { type Thought } from "../../games/index.ts";
3
+ import { type GameSummary } from "../answers/index.ts";
4
4
  /** What ponder answers: stop, the position to think on, the position after a reply, the thoughts kept, its words said, or still the player's move. */
5
5
  type Pondered = {
6
6
  stop: "moved" | "waited";
@@ -31,7 +31,7 @@ interface Start {
31
31
  * The AI's thinking on the player's time (D-72), for the agent that does it: the position, the view after a reply, its answer kept for its move, and its
32
32
  * words on the board page. Its calls are not the chat's: the doorbell still wakes the chat for the player's move. Offered to the hosts that run the agent (D-98).
33
33
  */
34
- export declare const ponder: import("./registry.ts").Command<z.ZodObject<{
34
+ export declare const ponder: import("../registry/registry.ts").Command<z.ZodObject<{
35
35
  position: z.ZodOptional<z.ZodInt>;
36
36
  reply: z.ZodOptional<z.ZodString>;
37
37
  move: z.ZodOptional<z.ZodString>;
@@ -1,14 +1,11 @@
1
1
  import { z } from "zod";
2
- import { Game, levelOf, moodAt, sees, timeLeft } from "../core/index.js";
3
- import { currentPlan, endOf, keepThought, loadGame, notePondering, talkLimits, thoughtKey, waitingSince } from "../games/index.js";
4
- import { agentHosts, isCodex, ponderAgents } from "../host-files/index.js";
5
- import { gameFolder } from "../profiles/index.js";
6
- import { positionLines } from "./answer-lines.js";
7
- import { summaryOf } from "./game-summary.js";
2
+ import { Game, levelOf, moodAt, sees, timeLeft } from "../../core/index.js";
3
+ import { currentPlan, endOf, keepThought, loadGame, notePondering, talkLimits, thoughtKey, waitingSince } from "../../games/index.js";
4
+ import { agentHosts, isCodex, ponderAgents } from "../../host-files/index.js";
5
+ import { gameFolder } from "../../profiles/index.js";
6
+ import { boardView, colourName, compactView, positionLines, say as sayWords, summaryOf } from "../answers/index.js";
7
+ import { defineCommand, sentence } from "../registry/index.js";
8
8
  import { levelText } from "./levels.js";
9
- import { defineCommand, sentence } from "./registry.js";
10
- import { say as sayWords } from "./say.js";
11
- import { boardView, colourName, compactView } from "./view.js";
12
9
  /**
13
10
  * The AI's thinking on the player's time (D-72), for the agent that does it: the position, the view after a reply, its answer kept for its move, and its
14
11
  * words on the board page. Its calls are not the chat's: the doorbell still wakes the chat for the player's move. Offered to the hosts that run the agent (D-98).
@@ -1,11 +1,11 @@
1
1
  import { z } from "zod";
2
- import { type Profile } from "../core/index.ts";
2
+ import { type Profile } from "../../core/index.ts";
3
3
  /** The positional profile of a position: of a game studied, with where it stands. */
4
4
  type Described = Profile & {
5
5
  where?: string;
6
6
  };
7
7
  /** The positional profile of the game in progress (D-19), or of any position of a game over (D-68): separate facts, never a score. */
8
- export declare const position: import("./registry.ts").Command<z.ZodObject<{
8
+ export declare const position: import("../registry/registry.ts").Command<z.ZodObject<{
9
9
  game: z.ZodOptional<z.ZodString>;
10
10
  move: z.ZodOptional<z.ZodString>;
11
11
  }, z.core.$strip>, Described>;
@@ -1,12 +1,10 @@
1
1
  import { z } from "zod";
2
- import {} from "../core/index.js";
3
- import { analystAgent } from "../host-files/index.js";
4
- import { gameFolder } from "../profiles/index.js";
5
- import { gameAt } from "./clock.js";
2
+ import {} from "../../core/index.js";
3
+ import { analystAgent } from "../../host-files/index.js";
4
+ import { gameFolder } from "../../profiles/index.js";
5
+ import { colourName, gameAt, gameShown, materialText, positionAfter, positionLine, studyInput } from "../answers/index.js";
6
+ import { defineCommand } from "../registry/index.js";
6
7
  import { refuseUnseen } from "./levels.js";
7
- import { defineCommand } from "./registry.js";
8
- import { gameShown, positionAfter, positionLine, studyInput } from "./study.js";
9
- import { colourName, materialText } from "./view.js";
10
8
  /** The positional profile of the game in progress (D-19), or of any position of a game over (D-68): separate facts, never a score. */
11
9
  export const position = defineCommand({
12
10
  name: "position",
@@ -1,7 +1,5 @@
1
1
  import { z } from "zod";
2
- import { type GameSummary } from "./game-summary.ts";
3
- import { type Written } from "./say.ts";
4
- import { type Speech } from "./speech.ts";
2
+ import { type GameSummary, type Speech, type Written } from "../answers/index.ts";
5
3
  interface Status {
6
4
  version: string;
7
5
  folder: string;
@@ -35,5 +33,5 @@ interface Status {
35
33
  unread?: true;
36
34
  }
37
35
  /** What Chesspal sees now, the first call of a chat: a dashboard under 150 tokens while the player is to move, with the next step. */
38
- export declare const status: import("./registry.ts").Command<z.ZodObject<{}, z.core.$strip>, Status>;
36
+ export declare const status: import("../registry/registry.ts").Command<z.ZodObject<{}, z.core.$strip>, Status>;
39
37
  export {};
@@ -1,21 +1,15 @@
1
1
  import { z } from "zod";
2
- import { gameReviewOf, leadOf, reviewOf } from "../core/index.js";
3
- import { archivedName, cleanSince, endOf, gameInAnalysis, lastChatStart } from "../games/index.js";
4
- import { outdatedHostFiles } from "../host-files/index.js";
5
- import { gameFolder } from "../profiles/index.js";
6
- import { version } from "../version.js";
7
- import { analystLine, analystRuns, coachOnEnd, coachOnEndLine, coachRuns, goneOver, reviewedLine, withAnalyst } from "./agents.js";
8
- import { closingLines, newGameStep, positionLines, shownMoves, sidesLine, wordLines } from "./answer-lines.js";
9
- import { gameAt } from "./clock.js";
10
- import { summaryOf, withThought } from "./game-summary.js";
11
- import { instructionsRead } from "./instructions.js";
2
+ import { gameReviewOf, leadOf, reviewOf } from "../../core/index.js";
3
+ import { archivedName, cleanSince, endOf, gameInAnalysis, lastChatStart } from "../../games/index.js";
4
+ import { outdatedHostFiles } from "../../host-files/index.js";
5
+ import { gameFolder } from "../../profiles/index.js";
6
+ import { version } from "../../version.js";
7
+ import { analystLine, analystRuns, closingLines, coachOnEnd, coachOnEndLine, coachRuns, gameAt, goneOver, namedGame, newGameStep, positionLines, reviewedLine, shownMoves, sidesLine, speechLine, speechOf, summaryOf, unansweredWords, withAnalyst, withThought, wordLines, } from "../answers/index.js";
8
+ import { playerLine } from "../profiles/index.js";
9
+ import { defineCommand } from "../registry/index.js";
10
+ import { instructionsRead } from "../setup/index.js";
12
11
  import { levelText } from "./levels.js";
13
12
  import { closedPage, pageGiven, pageLine } from "./page-link.js";
14
- import { playerLine } from "./profiles.js";
15
- import { defineCommand } from "./registry.js";
16
- import { unansweredWords } from "./say.js";
17
- import { speechLine, speechOf } from "./speech.js";
18
- import { namedGame } from "./study.js";
19
13
  /** What Chesspal sees now, the first call of a chat: a dashboard under 150 tokens while the player is to move, with the next step. */
20
14
  export const status = defineCommand({
21
15
  name: "status",
@@ -57,8 +51,9 @@ export const status = defineCommand({
57
51
  if (status.pageClosed === true) {
58
52
  pageGiven(context, current.started);
59
53
  }
60
- // A game a summarized or resumed chat still holds is its own; without the host's word of the chat's start, any game began before it.
61
- if (first && endOf(current.game) === undefined && (chatStart === undefined || cleanSince(chatStart, current.started))) {
54
+ // A game a summarized or resumed chat still holds is its own; without the host's word of the chat's start, any game began before it. One with no
55
+ // move yet has nothing to go on with: the chat the table starts again for a new game begins just after it (D-76).
56
+ if (first && endOf(current.game) === undefined && current.game.record.moves.length > 0 && (chatStart === undefined || cleanSince(chatStart, current.started))) {
62
57
  status.fromBefore = true;
63
58
  }
64
59
  // The player's move on the board page that ended the game: the coach judges it too (D-88).
@@ -1,19 +1,8 @@
1
- import type { AnyCommand } from "./registry.ts";
2
- export { aiMove } from "./ai-move.ts";
3
- export { analyseGame } from "./analyse-game.ts";
4
- export { gameAt } from "./clock.ts";
5
- export { type Caller, type Context, defaultContext, type SeenPosition, speaksItalian } from "./context.ts";
6
- export { deleteGame } from "./delete-game.ts";
7
- export { deleteReview } from "./delete-review.ts";
8
- export { answerDraw, DrawRefused, offerDraw } from "./draw-offer.ts";
9
- export { endGame } from "./end-game.ts";
10
- export { ChatNotClear, newGame, startNewGame } from "./new-game.ts";
11
- export { bookOpening, bookPlies } from "./opening-book.ts";
12
- export { playMove, PositionChanged, positionIn, samePosition } from "./play-move.ts";
13
- export { chooseDrawnAvatar, editProfile, GameGoingOn, newProfile, useProfile } from "./profiles.ts";
14
- export { ratingsAge, refreshRatings } from "./ratings.ts";
15
- export { type AnyCommand, baseType, type Command, commandLineFieldProblem, inputProblems, isBoolean, isList, takesNumbers } from "./registry.ts";
16
- export { say } from "./say.ts";
17
- export { gameToStudy, namedGame, shownPosition } from "./study.ts";
1
+ import type { AnyCommand } from "./registry/index.ts";
2
+ export { analyseGame, deleteReview } from "./analysis/index.ts";
3
+ export { analystOf, bookOpening, bookPlies, gameAt, gameToStudy, namedGame, playMove, PositionChanged, positionIn, samePosition, say, shownPosition } from "./answers/index.ts";
4
+ export { aiMove, answerDraw, ChatNotClear, DrawRefused, endGame, newGame, offerDraw, startNewGame } from "./game/index.ts";
5
+ export { chooseDrawnAvatar, deleteGame, editProfile, GameGoingOn, newProfile, ratingsAge, refreshRatings, useProfile } from "./profiles/index.ts";
6
+ export { type AnyCommand, baseType, type Caller, type Command, commandLineFieldProblem, type Context, defaultContext, inputProblems, isBoolean, isList, type SeenPosition, speaksItalian, takesNumbers } from "./registry/index.ts";
18
7
  /** Every command of Chesspal, in the order the command line lists them and the MCP server offers them. */
19
8
  export declare const commands: AnyCommand[];
@@ -1,42 +1,15 @@
1
- // The commands: the only way the AI, the command line and the page change a game (D-5, D-27), each defined once in the file named as its tool.
2
- import { aiMove } from "./ai-move.js";
3
- import { aiSay } from "./ai-say.js";
4
- import { analyseGame } from "./analyse-game.js";
5
- import { annotateGame } from "./annotate-game.js";
6
- import { coach } from "./coach.js";
7
- import { deleteGame } from "./delete-game.js";
8
- import { deleteReview } from "./delete-review.js";
9
- import { endGame } from "./end-game.js";
10
- import { exportGame } from "./export-game.js";
11
- import { init } from "./init.js";
12
- import { instructions } from "./instructions.js";
13
- import { look } from "./look.js";
14
- import { newGame } from "./new-game.js";
15
- import { pastGames } from "./past-games.js";
16
- import { playerMove } from "./player-move.js";
17
- import { playerSay } from "./player-say.js";
18
- import { ponder } from "./ponder.js";
19
- import { position } from "./position.js";
20
- import { editProfile, newProfile, profiles, setAvatar, useProfile } from "./profiles.js";
21
- import { status } from "./status.js";
22
- import { studyGames } from "./study-games.js";
1
+ // The commands: the only way the AI, the command line and the page change a game (D-5, D-27), grouped by area, each defined once.
2
+ import { analyseGame, annotateGame, deleteReview, studyGames } from "./analysis/index.js";
3
+ import { aiMove, coach, endGame, exportGame, look, newGame, playerMove, ponder, position, status } from "./game/index.js";
4
+ import { deleteGame, editProfile, newProfile, pastGames, profiles, setAvatar, useProfile } from "./profiles/index.js";
5
+ import { init, instructions } from "./setup/index.js";
6
+ import { aiSay, playerSay } from "./talk/index.js";
23
7
  // What the server and the command line use besides the list: the context, the reading of an input, and the operations the page shares with the tools.
24
- export { aiMove } from "./ai-move.js";
25
- export { analyseGame } from "./analyse-game.js";
26
- export { gameAt } from "./clock.js";
27
- export { defaultContext, speaksItalian } from "./context.js";
28
- export { deleteGame } from "./delete-game.js";
29
- export { deleteReview } from "./delete-review.js";
30
- export { answerDraw, DrawRefused, offerDraw } from "./draw-offer.js";
31
- export { endGame } from "./end-game.js";
32
- export { ChatNotClear, newGame, startNewGame } from "./new-game.js";
33
- export { bookOpening, bookPlies } from "./opening-book.js";
34
- export { playMove, PositionChanged, positionIn, samePosition } from "./play-move.js";
35
- export { chooseDrawnAvatar, editProfile, GameGoingOn, newProfile, useProfile } from "./profiles.js";
36
- export { ratingsAge, refreshRatings } from "./ratings.js";
37
- export { baseType, commandLineFieldProblem, inputProblems, isBoolean, isList, takesNumbers } from "./registry.js";
38
- export { say } from "./say.js";
39
- export { gameToStudy, namedGame, shownPosition } from "./study.js";
8
+ export { analyseGame, deleteReview } from "./analysis/index.js";
9
+ export { analystOf, bookOpening, bookPlies, gameAt, gameToStudy, namedGame, playMove, PositionChanged, positionIn, samePosition, say, shownPosition } from "./answers/index.js";
10
+ export { aiMove, answerDraw, ChatNotClear, DrawRefused, endGame, newGame, offerDraw, startNewGame } from "./game/index.js";
11
+ export { chooseDrawnAvatar, deleteGame, editProfile, GameGoingOn, newProfile, ratingsAge, refreshRatings, useProfile } from "./profiles/index.js";
12
+ export { baseType, commandLineFieldProblem, defaultContext, inputProblems, isBoolean, isList, speaksItalian, takesNumbers } from "./registry/index.js";
40
13
  /** Every command of Chesspal, in the order the command line lists them and the MCP server offers them. */
41
14
  export const commands = [
42
15
  init,
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  /** Deletes a game of the profile in use, by its name as past_games or study_games writes it. */
3
- export declare const deleteGame: import("./registry.ts").Command<z.ZodObject<{
3
+ export declare const deleteGame: import("../registry/registry.ts").Command<z.ZodObject<{
4
4
  game: z.ZodString;
5
5
  }, z.core.$strip>, {
6
6
  deleted: string;
@@ -1,8 +1,8 @@
1
1
  // A game deleted from a profile (D-92): played here or kept to study, with its review. Only the command line and the page delete, never the AI.
2
2
  import { z } from "zod";
3
- import { deleteGame as deleteGameFile, endAnalysis, gameInAnalysis, isOverOnTable, listedName, removeGame } from "../games/index.js";
4
- import { gameFolder } from "../profiles/index.js";
5
- import { defineCommand } from "./registry.js";
3
+ import { deleteGame as deleteGameFile, endAnalysis, gameInAnalysis, isOverOnTable, listedName, removeGame } from "../../games/index.js";
4
+ import { gameFolder } from "../../profiles/index.js";
5
+ import { defineCommand } from "../registry/index.js";
6
6
  /** Deletes a game of the profile in use, by its name as past_games or study_games writes it. */
7
7
  export const deleteGame = defineCommand({
8
8
  name: "delete_game",
@@ -0,0 +1,4 @@
1
+ export { deleteGame } from "./delete-game.ts";
2
+ export { pastGameLines, pastGames } from "./past-games.ts";
3
+ export { chooseDrawnAvatar, editProfile, GameGoingOn, newProfile, playerLine, profiles, ratingsText, setAvatar, useProfile } from "./profiles.ts";
4
+ export { ratingsAge, refreshRatings } from "./ratings.ts";
@@ -0,0 +1,5 @@
1
+ // The commands on the players: their profiles, their ratings read from the sites, their past games and the deletion of one.
2
+ export { deleteGame } from "./delete-game.js";
3
+ export { pastGameLines, pastGames } from "./past-games.js";
4
+ export { chooseDrawnAvatar, editProfile, GameGoingOn, newProfile, playerLine, profiles, ratingsText, setAvatar, useProfile } from "./profiles.js";
5
+ export { ratingsAge, refreshRatings } from "./ratings.js";
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  /** The AI's memory of the games played (D-57): how the latest went, one line each, or one game whole from the archive. */
3
- export declare const pastGames: import("./registry.ts").Command<z.ZodObject<{
3
+ export declare const pastGames: import("../registry/registry.ts").Command<z.ZodObject<{
4
4
  game: z.ZodOptional<z.ZodString>;
5
5
  }, z.core.$strip>, {
6
6
  games: string[];
@@ -1,9 +1,9 @@
1
1
  import { z } from "zod";
2
- import { writePgn } from "../core/index.js";
3
- import { archivedGame, archivedGames, archivedWhen } from "../games/index.js";
4
- import { gameFolder } from "../profiles/index.js";
5
- import { openingName } from "./opening-book.js";
6
- import { defineCommand } from "./registry.js";
2
+ import { writePgn } from "../../core/index.js";
3
+ import { archivedGame, archivedGames, archivedWhen } from "../../games/index.js";
4
+ import { gameFolder } from "../../profiles/index.js";
5
+ import { openingName } from "../answers/index.js";
6
+ import { defineCommand } from "../registry/index.js";
7
7
  /** The AI's memory of the games played (D-57): how the latest went, one line each, or one game whole from the archive. */
8
8
  export const pastGames = defineCommand({
9
9
  name: "past_games",