chesspal 0.3.5 → 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/README.md +1 -0
- package/dist/cli/cli.js +17 -4
- package/dist/cli/command-line.js +22 -12
- package/dist/cli/icon.d.ts +2 -0
- package/dist/cli/icon.js +11 -1
- package/dist/cli/prompt-hook.d.ts +17 -0
- package/dist/cli/prompt-hook.js +100 -0
- package/dist/commands/analysis/analyse.d.ts +2 -2
- package/dist/commands/analysis/analyse.js +10 -16
- package/dist/commands/analysis/annotate.d.ts +8 -0
- package/dist/commands/analysis/annotate.js +19 -3
- package/dist/commands/answers/agents.d.ts +17 -7
- package/dist/commands/answers/agents.js +46 -16
- package/dist/commands/answers/clock.js +2 -1
- package/dist/commands/answers/drawings.js +6 -2
- package/dist/commands/answers/index.d.ts +4 -3
- package/dist/commands/answers/index.js +4 -3
- package/dist/commands/answers/lines.d.ts +5 -3
- package/dist/commands/answers/lines.js +17 -9
- package/dist/commands/answers/opening-book.d.ts +13 -7
- package/dist/commands/answers/opening-book.js +34 -38
- package/dist/commands/answers/opening-tags.d.ts +4 -0
- package/dist/commands/answers/opening-tags.js +11 -0
- package/dist/commands/answers/play-move.d.ts +3 -1
- package/dist/commands/answers/play-move.js +9 -6
- package/dist/commands/answers/say.js +2 -1
- package/dist/commands/answers/summary.d.ts +7 -3
- package/dist/commands/answers/summary.js +16 -5
- package/dist/commands/answers/view.d.ts +1 -1
- package/dist/commands/answers/view.js +2 -2
- package/dist/commands/game/ai-move.js +4 -4
- package/dist/commands/game/coach.js +7 -6
- package/dist/commands/game/end.js +2 -2
- package/dist/commands/game/export.d.ts +1 -1
- package/dist/commands/game/index.d.ts +1 -1
- package/dist/commands/game/index.js +1 -1
- package/dist/commands/game/look.d.ts +7 -3
- package/dist/commands/game/look.js +9 -4
- package/dist/commands/game/new.js +42 -12
- package/dist/commands/game/player-move.d.ts +16 -0
- package/dist/commands/game/player-move.js +69 -19
- package/dist/commands/game/ponder.js +7 -4
- package/dist/commands/game/position.d.ts +2 -1
- package/dist/commands/game/position.js +9 -4
- package/dist/commands/game/status.d.ts +4 -2
- package/dist/commands/game/status.js +24 -14
- package/dist/commands/index.d.ts +3 -3
- package/dist/commands/index.js +3 -3
- package/dist/commands/profiles/past-games.d.ts +7 -2
- package/dist/commands/profiles/past-games.js +45 -18
- package/dist/commands/registry/context.d.ts +2 -0
- package/dist/commands/registry/context.js +5 -0
- package/dist/commands/registry/index.d.ts +1 -1
- package/dist/commands/registry/index.js +1 -1
- package/dist/commands/talk/ai-say.d.ts +1 -1
- package/dist/commands/talk/ai-say.js +7 -6
- package/dist/core/game.d.ts +13 -0
- package/dist/core/game.js +29 -3
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +3 -3
- package/dist/core/openings.d.ts +20 -6
- package/dist/core/openings.js +45 -22
- package/dist/core/pgn.d.ts +4 -0
- package/dist/core/pgn.js +35 -6
- package/dist/games/analysis.d.ts +7 -4
- package/dist/games/analysis.js +5 -3
- package/dist/games/archive.d.ts +25 -5
- package/dist/games/archive.js +52 -19
- package/dist/games/chat-start.d.ts +2 -2
- package/dist/games/chat-start.js +6 -1
- package/dist/games/current-game.d.ts +2 -2
- package/dist/games/current-game.js +3 -2
- package/dist/games/index.d.ts +3 -2
- package/dist/games/index.js +3 -2
- package/dist/games/position-shown.d.ts +24 -0
- package/dist/games/position-shown.js +51 -0
- package/dist/games/thoughts.d.ts +12 -4
- package/dist/games/thoughts.js +27 -10
- package/dist/home/index.d.ts +1 -0
- package/dist/home/index.js +1 -0
- package/dist/home/same-path.d.ts +7 -0
- package/dist/home/same-path.js +24 -0
- package/dist/host-files/host-files.d.ts +5 -0
- package/dist/host-files/host-files.js +21 -7
- package/dist/host-files/index.d.ts +1 -1
- package/dist/host-files/index.js +1 -1
- package/dist/page/app/anchor.js +15 -11
- package/dist/page/app/app.js +49 -14
- package/dist/page/app/served.js +30 -38
- package/dist/page/app/watch.js +97 -0
- package/dist/page/avatars/torretta.css +108 -0
- package/dist/page/base.css +1 -1
- package/dist/page/board/board.css +11 -8
- package/dist/page/board/marks.js +2 -2
- package/dist/page/board/pointer.js +2 -2
- package/dist/page/dialogs/analyses.js +5 -3
- package/dist/page/dialogs/dialogs.css +3 -1
- package/dist/page/dialogs/rows.js +72 -0
- package/dist/page/dialogs/site-games.js +3 -1
- package/dist/page/game/column.js +10 -8
- package/dist/page/game/game.css +137 -16
- package/dist/page/game/move-list.js +7 -5
- package/dist/page/game/plies.js +4 -0
- package/dist/page/game/review-progress.js +11 -0
- package/dist/page/guide/drawings/drawings.css +0 -1
- package/dist/page/guide/en.md +2 -2
- package/dist/page/guide/it.md +2 -2
- package/dist/page/helps/helps.css +5 -5
- package/dist/page/helps/helps.js +3 -181
- package/dist/page/helps/rows.js +16 -0
- package/dist/page/helps/strategy.js +105 -0
- package/dist/page/helps/tactics.js +69 -0
- package/dist/page/layout/header.js +49 -6
- package/dist/page/layout/icon.ico +0 -0
- package/dist/page/layout/layout.css +49 -17
- package/dist/page/layout/window.js +45 -6
- package/dist/page/lead/lead.js +41 -4
- package/dist/page/legend/legend.css +4 -16
- package/dist/page/legend/legend.js +28 -15
- package/dist/page/profile/settings.js +1 -0
- package/dist/page/sounds/sounds.js +1 -1
- package/dist/page/style.css +1 -0
- package/dist/page/table/action.js +42 -0
- package/dist/page/table/table.css +57 -39
- package/dist/page/table/window.js +67 -67
- package/dist/page/talk/talk.css +52 -118
- package/dist/page/talk/talk.js +65 -20
- package/dist/page/talk/voice.js +92 -21
- package/dist/page/text.js +34 -8
- package/dist/page/theme.css +13 -0
- package/dist/profiles/profiles.js +5 -1
- package/dist/server/bell/bell.d.ts +24 -29
- package/dist/server/bell/bell.js +79 -133
- package/dist/server/bell/index.d.ts +1 -1
- package/dist/server/bell/index.js +2 -2
- package/dist/server/mcp/mcp.js +49 -7
- package/dist/server/page/analyses.js +15 -4
- package/dist/server/page/chat.d.ts +5 -1
- package/dist/server/page/chat.js +5 -1
- package/dist/server/page/files.js +3 -1
- package/dist/server/page/game.d.ts +5 -0
- package/dist/server/page/game.js +95 -15
- package/dist/server/page/http.d.ts +1 -1
- package/dist/server/page/page.d.ts +14 -9
- package/dist/server/page/page.js +111 -26
- package/dist/server/page/table.d.ts +40 -5
- package/dist/server/page/table.js +65 -25
- package/dist/server/page/update.d.ts +1 -1
- package/dist/server/page/update.js +4 -4
- package/dist/server/page/windows.d.ts +22 -0
- package/dist/server/page/windows.js +45 -0
- package/dist/server/ports/index.d.ts +1 -0
- package/dist/server/ports/index.js +2 -0
- package/dist/server/ports/ports.d.ts +78 -0
- package/dist/server/ports/ports.js +222 -0
- package/dist/server/table/browser.d.ts +22 -6
- package/dist/server/table/browser.js +98 -20
- package/dist/server/table/hosts/chats.d.ts +5 -0
- package/dist/server/table/hosts/chats.js +11 -4
- package/dist/server/table/hosts/hooks.d.ts +6 -0
- package/dist/server/table/hosts/hooks.js +38 -0
- package/dist/server/table/hosts/hosts.d.ts +13 -5
- package/dist/server/table/hosts/hosts.js +16 -10
- package/dist/server/table/hosts/index.d.ts +1 -0
- package/dist/server/table/hosts/index.js +1 -0
- package/dist/server/table/hosts/play.d.ts +7 -3
- package/dist/server/table/hosts/play.js +63 -9
- package/dist/server/table/icon/index.d.ts +2 -0
- package/dist/server/table/icon/index.js +16 -2
- package/dist/server/table/index.d.ts +2 -2
- package/dist/server/table/index.js +1 -1
- package/dist/server/table/launch.d.ts +5 -4
- package/dist/server/table/launch.js +18 -5
- package/dist/server/table/link.js +4 -1
- package/dist/server/table/table.d.ts +7 -0
- package/dist/server/table/table.js +40 -12
- package/dist/sites/index.d.ts +1 -1
- package/dist/sites/index.js +1 -1
- package/dist/sites/{chesscom.d.ts → ratings/chesscom.d.ts} +2 -2
- package/dist/sites/{chesscom.js → ratings/chesscom.js} +1 -1
- package/dist/sites/{choice.d.ts → ratings/choice.d.ts} +1 -1
- package/dist/sites/{choice.js → ratings/choice.js} +1 -1
- package/dist/sites/ratings/index.d.ts +1 -0
- package/dist/sites/ratings/index.js +2 -0
- package/dist/sites/{lichess.d.ts → ratings/lichess.d.ts} +2 -2
- package/dist/sites/{lichess.js → ratings/lichess.js} +1 -1
- package/dist/sites/{sites.d.ts → ratings/ratings.d.ts} +2 -2
- package/dist/sites/{sites.js → ratings/ratings.js} +1 -1
- package/instructions/opponent.md +1 -1
- package/instructions/start.md +1 -1
- package/package.json +1 -1
|
@@ -7,11 +7,11 @@ import { speaksItalian } from "../../commands/index.js";
|
|
|
7
7
|
import { tableFolder } from "../../home/index.js";
|
|
8
8
|
import { version } from "../../version.js";
|
|
9
9
|
import { openInBrowser } from "./browser.js";
|
|
10
|
-
import { askToQuit, tableAt } from "./table.js";
|
|
10
|
+
import { askToOpen, askToQuit, askToRelease, tableAt } from "./table.js";
|
|
11
11
|
/**
|
|
12
12
|
* Opens the table's page in the browser, the table started first when none answers, or when the one that does is of another version, which is asked to
|
|
13
|
-
* quit; a table of this version another `chesspal` started meanwhile is as good.
|
|
14
|
-
* within ten seconds throws.
|
|
13
|
+
* quit; a table of this version another `chesspal` started meanwhile is as good. The window opened last stays, the table's older ones close, and none opens
|
|
14
|
+
* while another is opening (D-104). What to tell the player, in their language; a table that does not start within ten seconds throws.
|
|
15
15
|
*/
|
|
16
16
|
export async function openTable(context, launcher = processLauncher(context.platform)) {
|
|
17
17
|
const home = context.home();
|
|
@@ -23,7 +23,7 @@ export async function openTable(context, launcher = processLauncher(context.plat
|
|
|
23
23
|
for (;;) {
|
|
24
24
|
const table = await tableAt(folder);
|
|
25
25
|
if (table?.version === version) {
|
|
26
|
-
return styleText(["bold", "green"], `♜ ${(await
|
|
26
|
+
return styleText(["bold", "green"], `♜ ${(await openWindow(table.url, table.port, launcher)) ? words.opened(table.url) : words.notOpened(table.url)}`);
|
|
27
27
|
}
|
|
28
28
|
if (table !== undefined && !asked.has(table.port)) {
|
|
29
29
|
asked.add(table.port);
|
|
@@ -60,10 +60,23 @@ export function processLauncher(platform, command = [...process.execArgv, proces
|
|
|
60
60
|
// Its own process group, with no console and nothing of this one's: the terminal can close, the table stays.
|
|
61
61
|
spawn(process.execPath, [...command, "table"], { cwd: home, detached: true, stdio: "ignore", windowsHide: true }).unref();
|
|
62
62
|
},
|
|
63
|
-
open: (url) => openInBrowser(url, platform),
|
|
63
|
+
open: (url, opening) => openInBrowser(url, platform, opening),
|
|
64
64
|
wait: (milliseconds) => new Promise((done) => setTimeout(done, milliseconds)),
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
+
// The table's window, opened unless another opening has not reached the table yet, as two clicks on the icon ask: then the one opening is as good. One
|
|
68
|
+
// that will never reach it, as no browser started or only a tab with no opening did, is let go at once: the next chesspal opens its own.
|
|
69
|
+
async function openWindow(url, port, launcher) {
|
|
70
|
+
const opening = await askToOpen(port);
|
|
71
|
+
if (opening === null) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
const opened = await launcher.open(url, opening);
|
|
75
|
+
if (opening !== undefined && opened !== "window") {
|
|
76
|
+
await askToRelease(port, opening);
|
|
77
|
+
}
|
|
78
|
+
return opened !== "none";
|
|
79
|
+
}
|
|
67
80
|
// A table answers within ten seconds of its start, an older one quitting first, looked for every tenth of a second.
|
|
68
81
|
const startWait = 10_000;
|
|
69
82
|
const every = 100;
|
|
@@ -50,6 +50,7 @@ function tablePage(link, url) {
|
|
|
50
50
|
heard: () => link.copy(true),
|
|
51
51
|
chatCalls: () => link.calls(),
|
|
52
52
|
toolEnded: () => link.copy(false),
|
|
53
|
+
findable: true,
|
|
53
54
|
open: () => link.open,
|
|
54
55
|
inUse: () => true,
|
|
55
56
|
askNewGame: () => link.askNewGame(),
|
|
@@ -198,14 +199,16 @@ function answerOf(status, text) {
|
|
|
198
199
|
}
|
|
199
200
|
return status === 200 ? jsonOf(text) : undefined;
|
|
200
201
|
}
|
|
201
|
-
/** What the chat says of itself as it attaches:its version, session and folder, its host,
|
|
202
|
+
/** What the chat says of itself as it attaches: its version, session and folder, its host, whether its folder needs init again, and the seat of its play. */
|
|
202
203
|
function attachment(context) {
|
|
204
|
+
const seat = Number(process.env.CHESSPAL_SEAT);
|
|
203
205
|
return {
|
|
204
206
|
version,
|
|
205
207
|
session: process.env.CLAUDE_CODE_SESSION_ID ?? null,
|
|
206
208
|
folder: context.folder,
|
|
207
209
|
host: context.host?.(),
|
|
208
210
|
outdated: outdatedHostFiles(context.folder, context.platform).length > 0,
|
|
211
|
+
...(Number.isInteger(seat) && seat > 0 ? { seat } : {}),
|
|
209
212
|
};
|
|
210
213
|
}
|
|
211
214
|
/** What the chat saw, for the table's copy: the game and the position, the words it was given, its host, and who played as the AI (D-82, D-97). */
|
|
@@ -32,3 +32,10 @@ export declare function startTable(context: Context, times?: TableTimes, chats?:
|
|
|
32
32
|
export declare function tableAt(folder: string): Promise<TableFound | undefined>;
|
|
33
33
|
/** Asks the table at a port to quit; it answers before it goes, and a table that cannot be reached, or does not answer within a second or so, is let be. */
|
|
34
34
|
export declare function askToQuit(port: number): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Asks the table at a port for an opening of its window: its number, which the window carries, null while another opening has not reached the table
|
|
37
|
+
* yet, so that no second window opens; undefined when the table did not answer.
|
|
38
|
+
*/
|
|
39
|
+
export declare function askToOpen(port: number): Promise<number | null | undefined>;
|
|
40
|
+
/** Lets go of the opening the table at a port gave, whose window will never reach it: the next `chesspal` opens its own at once. */
|
|
41
|
+
export declare function askToRelease(port: number, opening: number): Promise<void>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// The table (D-104): the board page served in a process of its own, on a folder of the data folder that is one for every profile, which a chat attaches
|
|
2
2
|
// to; it closes by itself once no browser has had the page open, and no chat been attached, for a while.
|
|
3
3
|
import { request } from "node:http";
|
|
4
|
-
import { tableFolder } from "../../home/index.js";
|
|
5
|
-
import { setUpHosts } from "../../host-files/index.js";
|
|
6
|
-
import { pageAt, pagePorts, samePath } from "../bell/index.js";
|
|
4
|
+
import { samePath, tableFolder } from "../../home/index.js";
|
|
7
5
|
import { startPage } from "../page/index.js";
|
|
6
|
+
import { pageAt, pagePorts } from "../ports/index.js";
|
|
7
|
+
import { setUpTable } from "./hosts/index.js";
|
|
8
8
|
/** Five minutes with no browser and no chat, looked at every fifteen seconds (D-104). */
|
|
9
9
|
export const tableTimes = { idle: 5 * 60_000, every: 15_000 };
|
|
10
10
|
/**
|
|
@@ -14,7 +14,7 @@ export const tableTimes = { idle: 5 * 60_000, every: 15_000 };
|
|
|
14
14
|
*/
|
|
15
15
|
export async function startTable(context, times = tableTimes, chats, updater) {
|
|
16
16
|
const folder = tableFolder(context.home());
|
|
17
|
-
|
|
17
|
+
setUpTable(folder, context.platform);
|
|
18
18
|
let quit = () => undefined;
|
|
19
19
|
const quitting = new Promise((done) => {
|
|
20
20
|
quit = done;
|
|
@@ -61,19 +61,47 @@ export async function tableAt(folder) {
|
|
|
61
61
|
return port === undefined ? undefined : { url: `http://127.0.0.1:${port}/`, port, version: said[index]?.version, chat: said[index]?.chat };
|
|
62
62
|
}
|
|
63
63
|
/** Asks the table at a port to quit; it answers before it goes, and a table that cannot be reached, or does not answer within a second or so, is let be. */
|
|
64
|
-
export function askToQuit(port) {
|
|
64
|
+
export async function askToQuit(port) {
|
|
65
|
+
await askTable(port, "/api/table/quit");
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Asks the table at a port for an opening of its window: its number, which the window carries, null while another opening has not reached the table
|
|
69
|
+
* yet, so that no second window opens; undefined when the table did not answer.
|
|
70
|
+
*/
|
|
71
|
+
export async function askToOpen(port) {
|
|
72
|
+
const answer = await askTable(port, "/api/table/open");
|
|
73
|
+
const opening = answer?.opening;
|
|
74
|
+
return typeof opening === "number" || opening === null ? opening : undefined;
|
|
75
|
+
}
|
|
76
|
+
/** Lets go of the opening the table at a port gave, whose window will never reach it: the next `chesspal` opens its own at once. */
|
|
77
|
+
export async function askToRelease(port, opening) {
|
|
78
|
+
await askTable(port, "/api/table/open", { release: opening });
|
|
79
|
+
}
|
|
80
|
+
// A POST of JSON to a route of the table: its answer read as JSON, undefined when it could not be reached or read in time.
|
|
81
|
+
function askTable(port, path, body = {}) {
|
|
65
82
|
return new Promise((done) => {
|
|
66
|
-
const asked = request({ host: "127.0.0.1", port, path
|
|
67
|
-
|
|
68
|
-
response.
|
|
83
|
+
const asked = request({ host: "127.0.0.1", port, path, method: "POST", headers: { "Content-Type": "application/json" }, agent: false }, (response) => {
|
|
84
|
+
let body = "";
|
|
85
|
+
response.setEncoding("utf8");
|
|
86
|
+
response.on("data", (chunk) => {
|
|
87
|
+
body += chunk;
|
|
88
|
+
});
|
|
89
|
+
response.on("end", () => {
|
|
90
|
+
try {
|
|
91
|
+
done(JSON.parse(body));
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
done(undefined);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
69
97
|
});
|
|
70
|
-
asked.setTimeout(
|
|
71
|
-
asked.on("error", () => done());
|
|
72
|
-
asked.end(
|
|
98
|
+
asked.setTimeout(tableWait, () => asked.destroy());
|
|
99
|
+
asked.on("error", () => done(undefined));
|
|
100
|
+
asked.end(JSON.stringify(body));
|
|
73
101
|
});
|
|
74
102
|
}
|
|
75
103
|
// A table answers at once: one stuck must not hold the chat's first tool, nor `chesspal`.
|
|
76
|
-
const
|
|
104
|
+
const tableWait = 1_500;
|
|
77
105
|
/** Whether a table of the same folder answers on a lower port than this one's: the other won, and this one goes. */
|
|
78
106
|
async function lostTo(url, folder) {
|
|
79
107
|
const port = Number(new URL(url).port);
|
package/dist/sites/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { isSiteGameName, pointsAtSite, readSiteGames, type SiteGame, siteGameName, type SiteGames, siteOfGameName } from "./games/index.ts";
|
|
2
|
+
export { readingsStale, readSites } from "./ratings/index.ts";
|
|
2
3
|
export { answerTime, askSite, type Fetch } from "./request/index.ts";
|
|
3
|
-
export { readingsStale, readSites } from "./sites.ts";
|
package/dist/sites/index.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
// asked by a tool of the AI's (D-106); and their latest games there, which a tool lists too, to study one (D-110). Below the commands, beside the profiles,
|
|
3
3
|
// whose types it fills. Its request asks npm too, for a newer Chesspal (D-108).
|
|
4
4
|
export { isSiteGameName, pointsAtSite, readSiteGames, siteGameName, siteOfGameName } from "./games/index.js";
|
|
5
|
+
export { readingsStale, readSites } from "./ratings/index.js";
|
|
5
6
|
export { answerTime, askSite } from "./request/index.js";
|
|
6
|
-
export { readingsStale, readSites } from "./sites.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SiteReading } from "
|
|
2
|
-
import { type Fetch } from "
|
|
1
|
+
import type { SiteReading } from "../../profiles/index.ts";
|
|
2
|
+
import { type Fetch } from "../request/index.ts";
|
|
3
3
|
/** What Chess.com says of a name: undefined when it could not be reached. */
|
|
4
4
|
export declare function chesscomReading(account: string, fetch: Fetch, signal: AbortSignal): Promise<SiteReading | undefined>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { askSite } from "../request/index.js";
|
|
1
2
|
import { counted } from "./choice.js";
|
|
2
|
-
import { askSite } from "./request/index.js";
|
|
3
3
|
/** What Chess.com says of a name: undefined when it could not be reached. */
|
|
4
4
|
export async function chesscomReading(account, fetch, signal) {
|
|
5
5
|
const statistics = await askSite(`https://api.chess.com/pub/player/${encodeURIComponent(account.toLowerCase())}/stats`, fetch, signal);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Which of a site's ratings counts (D-106): the rapid, and when it is missing or provisional the classical, then the blitz.
|
|
2
|
-
import { speeds } from "
|
|
2
|
+
import { speeds } from "../../profiles/index.js";
|
|
3
3
|
/** The first established rating in the order the speeds count: none when every one is missing or provisional. */
|
|
4
4
|
export function counted(at) {
|
|
5
5
|
for (const speed of speeds) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { readingsStale, readSites } from "./ratings.ts";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SiteReading } from "
|
|
2
|
-
import { type Fetch } from "
|
|
1
|
+
import type { SiteReading } from "../../profiles/index.ts";
|
|
2
|
+
import { type Fetch } from "../request/index.ts";
|
|
3
3
|
/** What Lichess says of a name: undefined when it could not be reached. */
|
|
4
4
|
export declare function lichessReading(account: string, fetch: Fetch, signal: AbortSignal): Promise<SiteReading | undefined>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { askSite } from "../request/index.js";
|
|
1
2
|
import { counted } from "./choice.js";
|
|
2
|
-
import { askSite } from "./request/index.js";
|
|
3
3
|
/** What Lichess says of a name: undefined when it could not be reached. */
|
|
4
4
|
export async function lichessReading(account, fetch, signal) {
|
|
5
5
|
const user = await askSite(`${address}/${encodeURIComponent(account)}`, fetch, signal);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Accounts, SiteReadings } from "
|
|
2
|
-
import { type Fetch } from "
|
|
1
|
+
import type { Accounts, SiteReadings } from "../../profiles/index.ts";
|
|
2
|
+
import { type Fetch } from "../request/index.ts";
|
|
3
3
|
/** What Lichess and Chess.com say now of the player's names there, at `now`; a site that cannot be reached keeps what it said before of the same name. */
|
|
4
4
|
export declare function readSites(accounts: Accounts, fetch: Fetch, before: SiteReadings | undefined, now: Date): Promise<SiteReadings>;
|
|
5
5
|
/** Whether the readings are of other names than the profile's now, or a site did not answer a while ago: they are read again then, whatever their age. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { answerTime } from "../request/index.js";
|
|
1
2
|
import { chesscomReading } from "./chesscom.js";
|
|
2
3
|
import { lichessReading } from "./lichess.js";
|
|
3
|
-
import { answerTime } from "./request/index.js";
|
|
4
4
|
/** What Lichess and Chess.com say now of the player's names there, at `now`; a site that cannot be reached keeps what it said before of the same name. */
|
|
5
5
|
export async function readSites(accounts, fetch, before, now) {
|
|
6
6
|
const signal = AbortSignal.timeout(answerTime);
|
package/instructions/opponent.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
You choose your moves, explain them briefly and talk with the player.
|
|
2
2
|
|
|
3
3
|
- `status` says where the game stands and what to do next. The game is played on the board page, in the player's browser, and the chat is for talking: when `status` says nobody has it open, give them its address once. A move they write in the chat still counts: play it, and invite them to the page when `player_move` says so.
|
|
4
|
-
- Every move goes through the tools: the player's with `player_move`, which answers with the position for your reply; yours with `ai_move`, with your plan. Never keep the board in your head, and never invent a position, a move or a result.
|
|
4
|
+
- Every move goes through the tools: the player's with `player_move`, which answers with the position for your reply (a move they write alone in Claude Code may come already played by Chesspal, with that position); yours with `ai_move`, with your plan. Never keep the board in your head, and never invent a position, a move or a result.
|
|
5
5
|
- When your level gives them (`status` and `new_game` say it), `look` gives the whole view of the position when the one you have is not enough; `position` gives the positional facts (pawns, files, outposts, king safety, phase) when you set or change your plan. Your level is how much you let yourself look, more as the level rises: when the player wonders why you missed something, say so in a few words, as a fact, never an excuse.
|
|
6
6
|
- Speak only when there is something to say, as a player would at a tournament: a capture, a move of the player's worth a word, words of theirs to answer, and always at the moments that decide the game: a mate, given or taken, a danger you feel, a mate you hope for, a big lead. Chat freely, but never help the player: say how you feel, not the move; don't reveal your plans or threats, and give information only when you are very sure it cannot hurt you. Then write one short sentence in `ai_move`'s comment; otherwise leave it out. `ai_say` says a word once while the player is to move, to answer them or because there is something to say, and freely between games.
|
|
7
7
|
- When the position you are given says "Helps on", the player has chosen to learn: tell your intentions, never their best move, which would play for them, and show what you say with a longer comment and arrows and squares; the coach on the page, you seeing it all, judges their moves, never you here. "Helps off now" brings back the tournament.
|
package/instructions/start.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
This folder is the player's chess table, and you are their opponent; Chesspal keeps the rules, the board, the clock and the games. In every chat, before you write anything, even to a greeting, call `instructions` and `status`; again after the conversation is summarized. Every move goes through Chesspal's tools: never keep the board in your head or invent a position.
|
|
1
|
+
This folder is the player's chess table, and you are their opponent; Chesspal keeps the rules, the board, the clock and the games. In every chat, before you write anything, even to a greeting, call `instructions` and `status`; again after the conversation is summarized. Every move goes through Chesspal's tools: never keep the board in your head or invent a position. Without them, tell the player plainly to reopen this chat in this folder and trust it; name no tool or setting.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chesspal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Play chess against an AI with a character, and learn with an AI coach: Chesspal keeps the rules, the board, the games and the memory; the AI plays, reasons and talks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|